'),vv=be(' | ');function _v(u){return{name:String(u.level),words:u.words.map(s=>s.chinese)}}function wv(u){return{name:String(u.frequency),words:u.words}}const Gn=[{name:"new_hsk",displayName:"New HSK",type:"hsk"},{name:"活着",displayName:"活着",type:"frequency"},{name:"subtlex",displayName:"Subtlex",type:"frequency"}],xv=[300,1e3,3e3,1e4,3e4,1e5];function mv(u,s){const r=new Map,a=u.flatMap(h=>h.words),c=s.flatMap(h=>h.words);return u.forEach(h=>{s.forEach(d=>{r.set(`${h.name}-${d.name}`,Xr.intersection(h.words,d.words))})}),u.forEach(h=>{r.set(`${h.name}-undefined`,Xr.difference(h.words,c))}),s.forEach(h=>{r.set(`undefined-${h.name}`,Xr.difference(h.words,a))}),r}function bv(){const u=new Map;Gn.map(b=>{if(b.type==="hsk"){const[T]=Zn(Qn.NEW,nl,{initialValue:[]});u.set(b.name,()=>rl(T()).map(_v))}else{const[T]=Zn(b.name,av,{initialValue:[]});u.set(b.name,()=>hv(T(),xv).map(wv))}});const[s,r]=Se(Gn[0].name),[a,c]=Se(Gn[0].name),h=fe(()=>{var b;return((b=u.get(s()))==null?void 0:b())??[]}),d=fe(()=>{var b;return((b=u.get(a()))==null?void 0:b())??[]}),p=fe(()=>mv(h(),d())),m=()=>{Df(()=>{const b=s();r(a()),c(b)})};return(()=>{const b=dv(),T=b.firstChild,S=T.nextSibling,M=S.firstChild,D=M.nextSibling,v=D.firstChild,y=D.nextSibling,E=S.nextSibling,Z=E.firstChild,I=Z.firstChild;I.firstChild;const P=Z.nextSibling;return M.addEventListener("change",O=>r(O.target.value)),ue(M,te(Et,{each:Gn,children:O=>(()=>{const W=Wf();return ue(W,()=>O.displayName),Ue(()=>W.value=O.name),W})()})),D.$$click=()=>m(),Xn(v,"src",ov),y.addEventListener("change",O=>c(O.target.value)),ue(y,te(Et,{each:Gn,children:O=>(()=>{const W=Wf();return ue(W,()=>O.displayName),Ue(()=>W.value=O.name),W})()})),ue(I,te(Et,{get each(){return[...d().map(O=>O.name),void 0]},children:O=>(()=>{const W=gv();return ue(W,O??"n/a"),W})()}),null),ue(P,te(Et,{get each(){return[...h(),void 0]},children:O=>(()=>{const W=pv(),H=W.firstChild;return ue(H,()=>(O==null?void 0:O.name)??"n/a"),ue(W,te(Et,{get each(){return[...d(),void 0]},children:X=>(()=>{const N=vv();return ue(N,()=>{var Y;return(Y=p().get((O==null?void 0:O.name)+"-"+(X==null?void 0:X.name)))==null?void 0:Y.length}),N})()}),null),W})()})),Ue(()=>M.value=s()),Ue(()=>y.value=a()),b})()}Qt(["click"]);async function Av(u){const r=await(await fetch("/chinese-chart/new_hsk_anki_notes.tsv")).text(),a=new Map;return r.split(`
+`).map(s=>{const[r,a]=s.split(" ");return{word:r.trim(),frequency:Number(a)}})}function hv(u,s){let r=0;return s.map(a=>{const c=u.slice(r,Math.min(u.length,a)).map(h=>h.word);return r=a,{frequency:a,words:c}})}const dv=be('Compare | '),Wf=be("
|
---|