@ihabdevteam/core 0.9.1 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/components.cjs.js +11 -11
- package/dist/components.esm.js +13 -13
- package/dist/hooks.cjs.js +5 -5
- package/dist/hooks.esm.js +5 -5
- package/dist/ihabdevteam-core.cjs.js +13 -13
- package/dist/ihabdevteam-core.d.ts +10 -6
- package/dist/ihabdevteam-core.esm.js +15 -15
- package/dist/packages/core/src/components.d.ts +2 -0
- package/dist/packages/core/src/components.js +8 -0
- package/dist/packages/core/src/hooks/useVisitAllPanel.js +12 -5
- package/package.json +1 -1
package/dist/hooks.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{useState as B,useEffect as X,createContext as Gn,useContext as Yn,useRef as Oe,useCallback as q,useMemo as we,forwardRef as Po,createElement as Ut,useLayoutEffect as Nu}from"react";import{useTranslation as kt}from"react-i18next";import{jsx as oe,jsxs as Ie,Fragment as Gt}from"react/jsx-runtime";import{createPortal as $o}from"react-dom";function Mu({storageKey:e="fontScale",baseFont:t=20,minScale:n=.8,maxScale:o=1.4,step:r=.1,lineHeightRatio:u=1.4}={}){const i=g=>Math.max(n,Math.min(o,Number(g))),[l,s]=B(()=>{try{const g=localStorage.getItem(e),m=g?Number(g):1;return Number.isFinite(m)?m:1}catch{return 1}});X(()=>{try{localStorage.setItem(e,String(l))}catch{}},[e,l]);const p=g=>{s(typeof g=="function"?m=>i(g(m)):i(g))},h=()=>p(g=>+(g+r).toFixed(6)),f=()=>p(g=>+(g-r).toFixed(6)),c=l<o-Number.EPSILON,y=l>n+Number.EPSILON,b=Math.round(t*l),w=Math.round(b*u);return{scale:l,setScale:p,increase:h,decrease:f,canIncrease:c,canDecrease:y,fontSize:b,lineHeight:w}}const Fo=Gn(null);function Tu(e){return/max-width:\s*7[0-9][0-9]px/.test(e)}function Bu(e){const t=Yn(Fo),n=u=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia(u).matches,[o,r]=B(n(e));return X(()=>{if(typeof window>"u"||!window.matchMedia)return;const u=window.matchMedia(e),i=s=>r(s.matches),l=u;return l.addEventListener?l.addEventListener("change",i):l.addListener&&l.addListener(i),r(u.matches),()=>{l.removeEventListener?l.removeEventListener("change",i):l.removeListener&&l.removeListener(i)}},[e]),t&&typeof t.mobile=="boolean"&&Tu(e)?t.mobile:o}function Ho(e){const t=Oe(e);return X(()=>{t.current=e}),t}function zo(e,t){const n=Ho(t);X(()=>{const o=()=>n.current();try{window.addEventListener(e,o)}catch{}return()=>{try{window.removeEventListener(e,o)}catch{}}},[e,n])}const qn=" \xB7 ",Vo=(()=>{if(typeof document>"u")return"";const e=document.title;return e.includes(qn)?e.split(qn).pop()??e:e})(),Uo=Gn(!1);function Du(e){const t=Yn(Uo);X(()=>{if(t||typeof e!="string"||!e)return;const n=document.title;return document.title=Vo?`${e}${qn}${Vo}`:e,()=>{document.title=n}},[e,t])}function xu(){const{t:e}=kt();return q(t=>{if(!t)return"";const n=new Date(t).getTime();if(Number.isNaN(n))return"";const o=Math.floor((Date.now()-n)/864e5);return o<=0?e("myHomework.relativeDay.today","\uC624\uB298"):o===1?e("myHomework.relativeDay.yesterday","\uC5B4\uC81C"):e("myHomework.relativeDay.daysAgo",{n:o})},[e])}function vu(e){const[t,n]=B({current:"",next:"",confirm:""}),[o,r]=B(null),[u,i]=B(!1),l=Oe(null);X(()=>()=>{l.current!==null&&clearTimeout(l.current)},[]);const s=q(()=>{n({current:"",next:"",confirm:""}),r(null)},[]),p=q(async()=>{if(!t.current){r({type:"error",text:"\uD604\uC7AC \uBE44\uBC00\uBC88\uD638\uB97C \uC785\uB825\uD558\uC138\uC694."});return}if(!t.next){r({type:"error",text:"\uC0C8 \uBE44\uBC00\uBC88\uD638\uB97C \uC785\uB825\uD558\uC138\uC694."});return}if(t.next!==t.confirm){r({type:"error",text:"\uC0C8 \uBE44\uBC00\uBC88\uD638\uAC00 \uC77C\uCE58\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4."});return}i(!0);const h=e?await e(t.current,t.next):null;if(i(!1),h){r({type:"error",text:h});return}r({type:"success",text:"\uBE44\uBC00\uBC88\uD638\uAC00 \uBCC0\uACBD\uB418\uC5C8\uC2B5\uB2C8\uB2E4."}),n({current:"",next:"",confirm:""}),l.current!==null&&clearTimeout(l.current),l.current=setTimeout(()=>r(null),1500)},[t,e]);return{pw:t,setPw:n,pwMsg:o,setPwMsg:r,pwLoading:u,handleChangePw:p,reset:s}}const Se=["\u3131","\u3132","\u3134","\u3137","\u3138","\u3139","\u3141","\u3142","\u3143","\u3145","\u3146","\u3147","\u3148","\u3149","\u314A","\u314B","\u314C","\u314D","\u314E"],st=["\u314F","\u3150","\u3151","\u3152","\u3153","\u3154","\u3155","\u3156","\u3157","\u3158","\u3159","\u315A","\u315B","\u315C","\u315D","\u315E","\u315F","\u3160","\u3161","\u3162","\u3163"],Ve=["","\u3131","\u3132","\u3133","\u3134","\u3135","\u3136","\u3137","\u3139","\u313A","\u313B","\u313C","\u313D","\u313E","\u313F","\u3140","\u3141","\u3142","\u3144","\u3145","\u3146","\u3147","\u3148","\u314A","\u314B","\u314C","\u314D","\u314E"];function se(e){if(!e)return null;const t=e.charCodeAt(0)-44032;return t<0||t>=11172?null:{cho:Math.floor(t/588),jung:Math.floor(t%588/28),jong:t%28}}function Ou(){const e=new Map;return t=>{let n=e.get(t);return n||(n=[...t].map(o=>se(o)),e.set(t,n)),n}}function At(e,t,n=0){return String.fromCharCode(44032+(e*21+t)*28+n)}function Lu(e,t){if(!e||!t||e===t||e.length!==t.length)return"random";let n=0,o=null;for(let r=0;r<e.length;r++){const u=se(e[r]),i=se(t[r]);if(!u||!i)return"random";if(u.cho===i.cho&&u.jung===i.jung&&u.jong===i.jong)continue;n++;const l=u.cho!==i.cho,s=u.jung!==i.jung,p=u.jong!==i.jong;(l?1:0)+(s?1:0)+(p?1:0)>1?o="multi":l?o="cho":s?o="jung":o="jong"}return n!==1?"random":o==="cho"?"cho":o==="jung"?"jung":o==="jong"?"jong":"random"}const Yt={3:["\u3131","\u3145"],5:["\u3134","\u3148"],6:["\u3134","\u314E"],9:["\u3139","\u3131"],10:["\u3139","\u3141"],11:["\u3139","\u3142"],12:["\u3139","\u3145"],13:["\u3139","\u314C"],14:["\u3139","\u314D"],15:["\u3139","\u314E"],18:["\u3142","\u3145"]};Object.fromEntries(Object.entries(Yt).map(([e,t])=>[t.join(""),Ve[Number(e)]]));function Ru(e,t){if(!e||!t)return!1;for(const n of e){const o=se(n);if(o){if(Se[o.cho]===t)return!0;if(o.jong>0){if(Ve[o.jong]===t)return!0;const r=Yt[o.jong];if(r&&r.includes(t))return!0}}}return!1}function bn(e){if(!e)return 0;let t=0;for(const n of e)se(n)&&t++;return t}function Iu(e){if(!e)return!1;let t=!1;for(const n of e){const o=se(n);if(o&&(t=!0,o.jong>0))return!1}return t}function ju(e,t){if(e.jong<=0)return!1;if(t.includes(Ve[e.jong]))return!0;const n=Yt[e.jong];return!!n&&n.some(o=>t.includes(o))}function Pu(e,t,n){if(!e)return!1;const o=[...e],r=u=>{const i=se(o[u]);if(!i||t.cho&&!t.cho.includes(Se[i.cho])||t.jung&&!t.jung.includes(st[i.jung]))return!1;if(t.jongNone){if(i.jong>0)return!1}else if(t.jong&&!ju(i,t.jong))return!1;return!0};if(n==="head")return r(0);if(n==="tail")return r(o.length-1);if(n==="mid"){for(let u=1;u<o.length-1;u++)if(r(u))return!0;return!1}for(let u=0;u<o.length;u++)if(r(u))return!0;return!1}const $u={cho:Se.length,jung:st.length,jong:Ve.length};function Fu(e,t,n,o,r=1/0){if(!e||n<1)return[];const u=[...e].map(f=>se(f));if(u.some(f=>!f))return[];const i=u,l=i.length;if(n>l)return[];const s=$u[t],p=new Set,h=[];(function f(c,y){if(y.length===n){h.push([...y]);return}for(let b=c;b<l;b++)y.push(b),f(b+1,y),y.pop()})(0,[]);for(const f of h)if((function c(y,b){if(p.size>=r)return;if(y===f.length){const m=b.map(E=>At(E.cho,E.jung,E.jong)).join("");m!==e&&o.has(m)&&p.add(m);return}const w=f[y],g=i[w][t];for(let m=0;m<s;m++){if(m===g)continue;const E=b.slice();if(E[w]={...b[w],[t]:m},c(y+1,E),p.size>=r)return}})(0,i),p.size>=r)break;return[...p]}function Hu(e,t){if(!e||!t||e.length!==t.length)return-1;let n=0;for(let o=0;o<e.length;o++){const r=se(e[o]),u=se(t[o]);if(!r||!u)return-1;r.cho!==u.cho&&n++,r.jung!==u.jung&&n++,r.jong!==u.jong&&n++}return n}const Go="word_pair_index_v2",Yo="word_pair_index_sig_v2";let qt=null;function zu(){try{if(typeof localStorage>"u")return null;const e=localStorage.getItem(Go),t=localStorage.getItem(Yo);return!e||!t?null:{index:JSON.parse(e),sig:t}}catch{return null}}function Wt(){if(qt)return qt;const e=zu();return e?(qt=e.index,e.sig,qt):null}function Vu(){qt=null;try{typeof localStorage<"u"&&(localStorage.removeItem(Go),localStorage.removeItem(Yo))}catch{}}const qo="word_image_existence_map_v1";let Rt=null;function Wo(){if(Rt)return Rt;try{const e=typeof localStorage<"u"?localStorage.getItem(qo):null;Rt=e?JSON.parse(e):{}}catch{Rt={}}return Rt}function Uu(e,t){return`${e}_${t??1}`}function Gu(e,t){const n=Wo(),o=Uu(e,t);return o in n?n[o]:void 0}function Ko(){const e=Wo(),t=Object.values(e);return t.length===0?null:{total:t.length,exists:t.filter(Boolean).length}}function Yu(){Rt={};try{typeof localStorage<"u"&&localStorage.removeItem(qo)}catch{}}const Xo=[{id:"wordData",labelKey:"settings.cache.group.wordData.label",subKey:"settings.cache.group.wordData.sub",keys:["word_data_cache","word_data_version"]},{id:"pairIndex",labelKey:"settings.cache.group.pairIndex.label",subKey:"settings.cache.group.pairIndex.sub",keys:["word_pair_index_v2","word_pair_index_sig_v2"]},{id:"imageCache",labelKey:"settings.cache.group.imageCache.label",subKey:"settings.cache.group.imageCache.sub",keys:["word_image_existence_map_v1"]}];function Zo(e){return e.reduce((t,n)=>{try{const o=localStorage.getItem(n);return t+(o?new Blob([o]).size:0)}catch{return t}},0)}function qu(e){return e===0?"0 B":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(2)} MB`:`${(e/(1024*1024*1024)).toFixed(2)} GB`}function Wu(e){const{t}=kt(),[n,o]=B({}),[r,u]=B(null),[i,l]=B(null),[s,p]=B(null),h=q(()=>{const c={};Xo.forEach(y=>{c[y.id]=Zo([...y.keys])}),o(c),typeof navigator<"u"&&navigator.storage?.estimate&&navigator.storage.estimate().then(y=>{p({usage:y.usage??0,quota:y.quota??0})}).catch(()=>{})},[]);X(()=>{h()},[h]);const f=q(async c=>{u(c);try{c==="wordData"?(localStorage.removeItem("word_data_cache"),localStorage.removeItem("word_data_version")):c==="pairIndex"?Vu():c==="imageCache"&&Yu(),h(),e?.(t("settings.cache.cleared","\uCE90\uC2DC\uAC00 \uC0AD\uC81C\uB418\uC5C8\uC2B5\uB2C8\uB2E4."))}finally{u(null)}},[h,e,t]);return{cacheSizes:n,clearingId:r,confirmCacheId:i,setConfirmCacheId:l,storageEstimate:s,refreshCacheSizes:h,handleClearCache:f}}function Ku(e){const[t,n]=B(null),[o,r]=B(null),u=q(()=>{const i=Wt();if(i){const s=Object.values(i),p=s.filter(h=>h.cho.length+h.jung.length+h.jong.length>0).length;n({matched:p,total:s.length})}else n(null);const l=Ko();r(l?{exists:l.exists,total:l.total}:null)},[]);return X(()=>{u();const i=setTimeout(u,1e3);return()=>clearTimeout(i)},[e,u]),{pairStats:t,imgStats:o,setPairStats:n,setImgStats:r,refreshStats:u}}function Jo(e,t=[]){const[n,o]=B(t),[r,u]=B(null),[i,l]=B(!1),[s,p]=B(e),h=Oe(i);X(()=>{h.current=i});const f=Oe(null);X(()=>{if(h.current)return;const m=f.current;m!==null&&m.length===t.length&&m.every((E,k)=>E===t[k])||(f.current=t,o(t))},[t]);const c=q(m=>{u(m),l(!1),p({...m})},[]),y=q(()=>l(!0),[]),b=q(()=>l(!1),[]),w=q((m,E)=>{o(m),u(E),l(!1)},[]),g=q(m=>{o(E=>E.filter(k=>k!==m)),u(null)},[]);return{list:n,setList:o,selected:r,setSelected:u,isEditing:i,setIsEditing:l,editForm:s,setEditForm:p,openDetail:c,startEditing:y,cancelEditing:b,commitEdit:w,remove:g}}const Kt=()=>{const e=new Date;return{year:String(e.getFullYear()),month:String(e.getMonth()+1).padStart(2,"0"),day:String(e.getDate()).padStart(2,"0")}},Xu={year:"",month:"",day:"",hour:"09",minute:"00",memo:""};function Zu(e=[]){const{list:t,setList:n,selected:o,setSelected:r,isEditing:u,setIsEditing:i,editForm:l,setEditForm:s,openDetail:p,commitEdit:h}=Jo(Xu,e),{year:f,month:c,day:y}=Kt(),[b,w]=B({year:f,month:c,day:y,hour:"09",minute:"00",memo:""});return{visitHistory:t,visitForm:b,setVisitForm:w,setVisit:g=>m=>w(E=>({...E,[g]:m})),selectedVisit:o,setSelectedVisit:r,isEditingVisit:u,setIsEditingVisit:i,editVisitForm:l,setEditVisitForm:s,openVisitDetail:p,handleVisitSave:g=>{n(x=>[b,...x]);const{year:m,month:E,day:k}=Kt();w({year:m,month:E,day:k,hour:"09",minute:"00",memo:""}),g?.()},handleVisitEditSave:()=>{h(g=>g.map(m=>m===o?l:m),l)},addVisit:g=>{n(m=>[g,...m])},removeVisit:g=>{n(m=>m.filter(E=>E!==g))},revertVisitEdit:(g,m)=>{n(E=>E.map(k=>k===m?g:k)),r(E=>E===m?g:E)}}}const Qo=e=>`${e.year.padStart(4,"0")}-${e.month.padStart(2,"0")}-${e.day.padStart(2,"0")} ${e.hour.padStart(2,"0")}:${e.minute.padStart(2,"0")}`,kn=e=>[...e].sort((t,n)=>{const o=Qo(t),r=Qo(n);return o<r?-1:o>r?1:0}),Ju={year:"",month:"",day:"",hour:"09",minute:"00",memo:""};function Qu(e,t=[]){const n=we(()=>kn(t),[t]),{list:o,setList:r,selected:u,setSelected:i,isEditing:l,setIsEditing:s,editForm:p,setEditForm:h,openDetail:f,commitEdit:c,remove:y}=Jo(Ju,n),[b,w]=B([]),{year:g,month:m,day:E}=Kt(),[k,x]=B({year:g,month:m,day:E,hour:"09",minute:"00",memo:""}),R=z=>D=>x(O=>({...O,[z]:D})),v=z=>{r(Z=>kn([...Z,k]));const{year:D,month:O,day:me}=Kt();x({year:D,month:O,day:me,hour:"09",minute:"00",memo:""}),z?.()},j=()=>{c(z=>kn(z.map(D=>D===u?p:D)),p)},H=q(z=>{y(z)},[y]),U=q(z=>{e({year:z.year,month:z.month,day:z.day,hour:z.hour,minute:z.minute,memo:z.memo}),y(z)},[e,y]),F=q(z=>{r(D=>D.filter(O=>O!==z)),w(D=>[z,...D]),i(null)},[r,i]),Q=q(z=>{r(D=>kn([...D,z]))},[r]),G=q(z=>{r(D=>D.filter(O=>O!==z))},[r]),W=q((z,D)=>{r(O=>O.map(me=>me===D?z:me)),i(O=>O===D?z:O)},[r,i]);return{scheduleList:o,noShowList:b,addSchedule:Q,removeSchedule:G,revertScheduleEdit:W,scheduleForm:k,setScheduleForm:x,setSchedule:R,selectedSchedule:u,setSelectedSchedule:i,isEditingSchedule:l,setIsEditingSchedule:s,editScheduleForm:p,setEditScheduleForm:h,openScheduleDetail:f,handleScheduleSave:v,handleScheduleEditSave:j,handleScheduleDelete:H,handleScheduleToVisit:U,handleScheduleNoVisit:F}}const er=[{value:"10",label:"10\uAC1C\uC529 \uBCF4\uAE30"},{value:"25",label:"25\uAC1C\uC529 \uBCF4\uAE30"},{value:"50",label:"50\uAC1C\uC529 \uBCF4\uAE30"},{value:"100",label:"100\uAC1C\uC529 \uBCF4\uAE30"}];function ea(e){const[t,n]=B(""),[o,r]=B("25"),[u,i]=B("all"),[l,s]=B(1),p=we(()=>e.filter(({item:c,status:y})=>!(t&&!c.memo.includes(t)||u!=="all"&&y!==u)),[e,t,u]),h=Math.max(1,Math.ceil(p.length/Number(o))),f=we(()=>{const c=Math.min(l,h);return p.slice((c-1)*Number(o),c*Number(o))},[p,l,o,h]);return{vapSearch:t,setVapSearch:n,vapPageSize:o,setVapPageSize:r,vapStatus:u,setVapStatus:i,vapPage:l,setVapPage:s,vapFiltered:p,vapTotal:h,vapPageItems:f}}function ta(e,t){const{t:n}=kt(),[o,r]=B("25"),[u,i]=B(1),[l,s]=B(t);l!==t&&(s(t),u!==1&&i(1));const p=we(()=>er.map(y=>({...y,label:n("visits.showN",{n:y.value})})),[n]),h=q(y=>{r(y),i(1)},[]),f=Math.max(1,Math.ceil(e.length/Number(o))),c=Math.min(u,f);return{pageRows:we(()=>e.slice((c-1)*Number(o),c*Number(o)),[e,c,o]),pageSizeProps:{options:p,value:o,onChange:h},paginationProps:{page:c,total:f,onChange:i},setPage:i}}function na(){const[e,t]=B(null),n=q(r=>{t(u=>u?.key===r?{key:r,asc:!u.asc}:{key:r,asc:!0})},[]),o=q((r,u)=>({label:r,sortDir:e?.key===u?e.asc?"asc":"desc":null,onClick:()=>n(u)}),[e,n]);return{\uC815\uB82C:e,\uCE78:o}}function oa(){const[e,t]=B(!1),[n,o]=B("\uC88C"),[r,u]=B({\uC88C:null,\uC6B0:null}),[i,l]=B({\uC88C:[],\uC6B0:[]}),[s,p]=B(!1),[h,f]=B("\uC88C"),c=q(b=>{const w=b.direction;u(g=>({...g,[w]:b})),l(g=>({...g,[w]:[b,...g[w]]})),t(!1)},[]),y=q(b=>{const w=b.direction;u(g=>({...g,[w]:b})),p(!1)},[]);return{showDevice:e,setShowDevice:t,deviceDirection:n,setDeviceDirection:o,devices:r,setDevices:u,deviceHistory:i,setDeviceHistory:l,showDeviceList:s,setShowDeviceList:p,listForSide:h,setListForSide:f,handleDeviceSubmit:c,handleSelectFromList:y}}const ra="__ihab_core_word_pool__";function An(){return globalThis[ra]??null}function le(e,t=Math.random){const n=e.slice();for(let o=n.length-1;o>0;o--){const r=Math.floor(t()*(o+1));[n[o],n[r]]=[n[r],n[o]]}return n}function dt(e,t,n=Math.random){return!Array.isArray(e)||e.length===0||t<=0?[]:t>=e.length?le(e,n):le(e,n).slice(0,t)}const Wn={SAME_SOUND_PICK:{difficulty:!0,choseong:!0,group:"discrimination"},SAME_OR_DIFF:{difficulty:!0,choseong:!0,group:"discrimination"},HEAR_AND_PICK_SAME:{difficulty:!0,choseong:!0,group:"discrimination"},HEAR_AND_PICK_INCLUDED:{difficulty:!0,choseong:!0,group:"discrimination"},STARTS_WITH_SAME_SOUND:{difficulty:!1,choseong:!0,group:"discrimination"},LISTEN_AND_REMEMBER_ORDER:{difficulty:!1,choseong:!0,group:"attention"},MERGE_2_SYLLABLES:{difficulty:!1,choseong:!0,group:"synthesis"},MERGE_3_SYLLABLES:{difficulty:!1,choseong:!0,group:"synthesis"},MERGE_2_PHONEMES:{difficulty:!1,choseong:!0,group:"synthesis"},MERGE_3_PHONEMES:{difficulty:!1,choseong:!0,group:"synthesis"},DROP_1_FROM_2SYLL:{difficulty:!1,choseong:!0,group:"deletion"},DROP_1_FROM_3SYLL:{difficulty:!1,choseong:!0,group:"deletion"},DROP_PART_FROM_COMPOUND:{difficulty:!1,choseong:!0,group:"deletion"},DROP_FINAL_CONSONANT_FROM_1SYLL:{difficulty:!1,choseong:!0,group:"deletion"},REMOVE_CONSONANT_AND_IDENTIFY_PHONEME:{difficulty:!1,choseong:!0,group:"deletion"},CHANGE_1_SYLL_IN_2SYLL:{difficulty:!0,choseong:!0,group:"substitution"},CHANGE_1_SYLL_IN_3SYLL:{difficulty:!0,choseong:!0,group:"substitution"},CHANGE_1_PHONEME_IN_1SYLL:{difficulty:!1,choseong:!0,group:"substitution"},CHANGE_1_PHONEME_IN_2SYLL:{difficulty:!0,choseong:!0,group:"substitution"}},ua=Se.indexOf("\u3147"),tr={DROP_FINAL_CONSONANT_FROM_1SYLL:{syllables:1,syllable:e=>e.jong>0},REMOVE_CONSONANT_AND_IDENTIFY_PHONEME:{syllables:1,syllable:e=>e.jong===0&&e.cho!==ua},MERGE_2_SYLLABLES:{syllables:2,syllable:()=>!0},MERGE_3_SYLLABLES:{syllables:3,syllable:()=>!0},MERGE_2_PHONEMES:{syllables:1,syllable:e=>e.jong===0},MERGE_3_PHONEMES:{syllables:1,syllable:e=>e.jong>0}},aa={\u3131:"\u3131",\u3132:"\u3131",\u314B:"\u3131",\u3133:"\u3131",\u313A:"\u3131",\u3134:"\u3134",\u3135:"\u3134",\u3136:"\u3134",\u3137:"\u3137",\u3145:"\u3137",\u3146:"\u3137",\u3148:"\u3137",\u314A:"\u3137",\u314C:"\u3137",\u314E:"\u3137",\u3139:"\u3139",\u313C:"\u3139",\u313D:"\u3139",\u313E:"\u3139",\u3140:"\u3139",\u3141:"\u3141",\u313B:"\u3141",\u3142:"\u3142",\u314D:"\u3142",\u313F:"\u3142",\u3144:"\u3142",\u3147:"\u3147"},ia={\u314F:{nucleus:"\u314F"},\u3151:{glide:"j",nucleus:"\u314F"},\u3153:{nucleus:"\u3153"},\u3155:{glide:"j",nucleus:"\u3153"},\u3157:{nucleus:"\u3157"},\u315B:{glide:"j",nucleus:"\u3157"},\u315C:{nucleus:"\u315C"},\u3160:{glide:"j",nucleus:"\u315C"},\u3161:{nucleus:"\u3161"},\u3163:{nucleus:"\u3163"},\u3150:{nucleus:"\u3154/\u3150"},\u3152:{glide:"j",nucleus:"\u3154/\u3150"},\u3154:{nucleus:"\u3154/\u3150"},\u3156:{glide:"j",nucleus:"\u3154/\u3150"},\u3158:{glide:"w",nucleus:"\u314F"},\u3159:{glide:"w",nucleus:"\u3154/\u3150"},\u315A:{glide:"w",nucleus:"\u3154/\u3150"},\u315D:{glide:"w",nucleus:"\u3153"},\u315E:{glide:"w",nucleus:"\u3154/\u3150"},\u315F:{glide:"w",nucleus:"\u3163"},\u3162:{glide:"\u0270",nucleus:"\u3163"}};function nr(e){return aa[e]??e}const Kn={cho:Se,jung:st,jong:Ve},be=e=>Array.isArray(e)?e.length>0:!!e;function Xn(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){const o=e[n],r=t[n];if(!(!o||!r)&&(o.cho!==r.cho&&Se[o.cho]==="\u3147"!=(Se[r.cho]==="\u3147")||o.jong!==r.jong&&o.jong===0!=(r.jong===0)))return!0}return!1}function la(e,t,n){const o=n.pronOf(e),r=n.decompOf,u=n.sameStructureOnly&&r?r(o):null,i=[];for(const l of t)l!==e&&(n.okSet&&!n.okSet.has(l)||n.pronOf(l)!==o&&(u&&r&&Xn(u,r(n.pronOf(l)))||i.push(l)));return i}function or(e,t,n){const o=t?.[e];if(!o)return[];const r=n.kind?o[n.kind]??[]:[...o.cho??[],...o.jung??[],...o.jong??[]];return la(e,r,n)}function ca(e,t,n,o,r,u,i){const l=["cho","jung","jong"].filter(c=>be(e[c])),s={};for(const c of l){const y=e[c];s[c]=new Set(Array.isArray(y)?y:[y])}const p=r==="pron",h=new Map;for(const c of t){const y=n(u(c));if(y.some(m=>!m))continue;let b=y;if(!p&&(b=n(c),b.length!==y.length||b.some(m=>!m)))continue;const w=y.length,g=h.get(w);g?g.push({w:c,dPron:y,dPos:b}):h.set(w,[{w:c,dPron:y,dPos:b}])}const f=new Map;for(const[c,y]of h){const b=new Map,w=(g,m)=>{const E=g.dPos[m];return E!=null&&l.every(k=>s[k].has(Kn[k][E[k]]))};for(const g of y){let m;if(i==="head")m=w(g,0)?0:-1;else if(i==="tail")m=w(g,c-1)?c-1:-1;else if(i==="mid"){m=-1;for(let k=1;k<c-1;k++)if(w(g,k)){m=k;break}}else m=g.dPos.findIndex(k=>k!=null&&l.every(x=>s[x].has(Kn[x][k[x]])));if(m<0)continue;const E=b.get(m);E?E.push(g):b.set(m,[g])}for(const[g,m]of b){const E=new Set(l.map(R=>g+":"+R)),k=R=>{let v="";for(let j=0;j<c;j++){const H=R[j];for(const U of["cho","jung","jong"])v+=(E.has(j+":"+U)?"*":H[U])+"."}return v},x=new Map;for(const R of y){const v=k(R.dPron),j=x.get(v);j?j.push(R):x.set(v,[R])}for(const R of m){const v=x.get(k(R.dPron))??[],j=[];for(const H of v){if(H.w===R.w)continue;let U=!0;for(const F of l){const Q=R.dPron[g][F],G=H.dPron[g][F];if(G===Q){U=!1;break}if(p&&s[F].has(Kn[F][G])){U=!1;break}}U&&(o&&Xn(R.dPron,H.dPron)||j.push(H.w))}f.set(R.w,j)}}}return f}const sa=e=>e==null?[]:Array.isArray(e)?e:[e];function da(e){if([...e].length!==1)return"";const t=se(e);if(!t)return"";const n=nr(Ve[t.jong]),o=n===""?0:Ve.indexOf(n);return At(t.cho,t.jung,o<0?0:o)}function rr(e,t){return t.get(e)||da(e)||e}function Zn(e){return e?be(e.cho)?"cho":be(e.jung)?"jung":be(e.jong)?"jong":null:null}function It(e,t){const n=(o,r)=>!be(o)||sa(o).includes(r);return n(t.cho,Se[e.cho])&&n(t.jung,st[e.jung])&&n(t.jong,Ve[e.jong])}function Xt(e,t,n){const o=[...e];if(n!=="pron")return o.map(u=>se(u));const r=[...t.get(e)||e];return r.length!==o.length?o.map(u=>se(u)):r.map(u=>se(u))}function Zt(e,t,n,o,r){const u=t==="cho"?Se:t==="jung"?st:Ve,i=e[t],l=[],s=new Set([rr(n,r)]),p=le(u.map((h,f)=>f).filter(h=>h!==i&&(t!=="cho"||u[h]!=="\u3147")&&(t!=="jong"||h!==0)));for(const h of p){if(l.length>=o)break;const f=t==="cho"?At(h,e.jung,e.jong):t==="jung"?At(e.cho,h,e.jong):At(e.cho,e.jung,h),c=rr(f,r);s.has(c)||(s.add(c),l.push(f))}return l}function ha(e,t,n,o,r,u=null){const i=[...e];if(i.length!==2)return null;const l=i.map(f=>se(f));if(l.some(f=>!f))return null;const s=Xt(e,n,o);if(s.some(f=>!f))return null;const p=Zn(t);let h=p&&t?s.map((f,c)=>It(f,t)?c:-1).filter(f=>f>=0):[0,1];if(u!=null&&(h=h.filter(f=>f!==u)),!h.length)return null;for(const f of le(h)){const c=i[f];if(!r.has(c))continue;const y=Zt(l[f],p??"cho",c,40,n),b=[];for(const w of y)if(w!==c&&r.has(w)&&!b.includes(w)&&b.push(w),b.length>=2)break;if(!(b.length<2))return{question:e,distractors:[c,...b]}}return null}function pa(e,t,n,o,r,u=null){const i=[...e];if(i.length!==3)return null;const l=i.map(f=>se(f));if(l.some(f=>!f))return null;const s=Xt(e,n,o);if(s.some(f=>!f))return null;const p=Zn(t),h=p&&t?s.map((f,c)=>It(f,t)?c:-1).filter(f=>f>=0):[0,1,2];if(!h.length)return null;for(const f of le(h))for(const c of le([0,1,2].filter(y=>y!==f&&(u==null||y===u)))){const y=[0,1,2].filter(E=>E!==c),b=y.map(E=>i[E]).join("");if(!r.has(b))continue;const w=y.indexOf(f),g=Zt(l[f],p??"cho",i[f],40,n),m=[];for(const E of g){const k=y.map(R=>i[R]);k[w]=E;const x=k.join("");if(x!==b&&r.has(x)&&!m.includes(x)&&m.push(x),m.length>=2)break}if(!(m.length<2))return{question:e,distractors:[b,...m]}}return null}function fa(e,t,n,o,r,u=null){const i=[...e],l=i.length;if(l<2)return null;const s=[];for(let h=1;h<=l-1;h++)s.push({remain:i.slice(0,h).join(""),dropped:i.slice(h).join(""),droppedEnd:1}),s.push({remain:i.slice(l-h).join(""),dropped:i.slice(0,l-h).join(""),droppedEnd:0});const p=Zn(t);for(const{remain:h,dropped:f,droppedEnd:c}of le(s)){if(u!=null&&c!==u||h===e||!r.has(h)||!r.has(f))continue;const y=[...h],b=y.map(m=>se(m));if(b.some(m=>!m))continue;const w=Xt(h,n,o);if(w.some(m=>!m))continue;const g=p&&t?w.map((m,E)=>It(m,t)?E:-1).filter(m=>m>=0):y.map((m,E)=>E);if(g.length)for(const m of le(g)){const E=Zt(b[m],p??"cho",y[m],40,n),k=[];for(const x of E){const R=[...y];R[m]=x;const v=R.join("");if(v!==h&&r.has(v)&&!k.includes(v)&&k.push(v),k.length>=2)break}if(k.length>=2)return{question:e,distractors:[h,...k]}}}return null}function Ca(e,t,n,o,r,u=null){if([...e].length!==1)return null;const i=se(n.get(e)||e);if(!i||i.jong===0)return null;const l=At(i.cho,i.jung,0),s=Zt({cho:i.cho,jung:i.jung,jong:0},"cho",l,2,n);return s.length<2?null:{question:e,distractors:[l,...s]}}const Jn=Se.indexOf("\u3147");function ya(e,t,n,o,r,u=null){if([...e].length!==1)return null;const i=se(n.get(e)||e);if(!i||i.jong!==0||i.cho===Jn)return null;const l=At(Jn,i.jung,0),s=Zt({cho:Jn,jung:i.jung,jong:0},"jung",l,2,n);return s.length<2?null:{question:e,distractors:[l,...s]}}function ma(e){const t=new Map;for(const n of e){const o=[...n],r=o.length;if(!(r<2||r>3))for(let u=0;u<r;u++){let i=r+"|"+u+"|";for(let s=0;s<r;s++)i+=s===u?"*":o[s];const l=t.get(i);l?l.push(n):t.set(i,[n])}}return t}function ga(e,t,n,o,r,u=null,i=null,l=2){const s=[...e],p=s.length;if(p<2||p>3)return null;const h=s.map(E=>se(E));if(h.some(E=>!E))return null;const f=Xt(e,n,o);if(f.some(E=>!E))return null;const c=E=>n.get(E)??E,y=c(e),b=!!t&&(be(t.cho)||be(t.jung)||be(t.jong)),w=!!i&&(be(i.cho)||be(i.jung)||be(i.jong)),g=E=>{let k=p+"|"+E+"|";for(let x=0;x<p;x++)k+=x===E?"*":s[x];return k};let m;if(u!=null){if(u>=p||b&&!It(f[u],t))return null;m=[u]}else b?m=f.map((E,k)=>It(E,t)?k:-1).filter(E=>E>=0):m=Array.from({length:p},(E,k)=>k);for(const E of le(m)){const k=r.get(g(E))??[],x=[],R=[];for(const F of k){if(F===e)continue;const Q=[...F].map(D=>se(D)),G=h[E],W=Q[E];if(!G||!W)continue;let z=0;if(G.cho!==W.cho&&z++,G.jung!==W.jung&&z++,G.jong!==W.jong&&z++,!(z<l||c(F)===y))if(w){const D=Xt(F,n,o)[E];D&&It(D,i)?x.push(F):R.push(F)}else x.push(F)}if(!x.length)continue;const v=le(x)[0],j=[],H=new Set([y,c(v)]),U=w?R:x.filter(F=>F!==v);for(const F of le(U)){const Q=c(F);if(!H.has(Q)&&(H.add(Q),j.push(F),j.length>=2))break}if(!w&&j.length<2)for(const F of le(k)){if(F===e||F===v)continue;const Q=c(F);if(!H.has(Q)&&(H.add(Q),j.push(F),j.length>=2))break}if(!(j.length<2))return{question:e,distractors:[v,...j]}}return null}let wn=null,ur=null,ar=null;function _a(){const e=An();if(e&&e.entries.length>0){const t=Wt();if(wn&&ur===e&&ar===t)return wn;const n=new Set,o=[];for(const r of e.entries)!r.word||n.has(r.word)||(n.add(r.word),o.push({w:r.word,s:r.syllables,p:t?.[r.word]?[...t[r.word].cho??[],...t[r.word].jung??[],...t[r.word].jong??[]]:[],pron:r.pronunciation||r.word,grade:r.grade}));return wn=o,ur=e,ar=t,wn}return[]}const Ye=new Proxy([],{get(e,t){const n=_a(),o=n[t];return typeof o=="function"?o.bind(n):o}});function Sn(e){return e.length?e[Math.floor(Math.random()*e.length)]:void 0}function qe(e,t){if(t>=e.length)return le(e);if(t===0)return[];const n=e.slice();for(let o=0;o<t;o++){const r=o+Math.floor(Math.random()*(n.length-o)),u=n[o];n[o]=n[r],n[r]=u}return n.slice(0,t)}let Qn=null,ir=null;function wt(){const e=An();if(Qn&&ir===e)return Qn;const t=new Map;for(const n of Ye)n.w&&t.set(n.w,n.pron);return Qn=t,ir=e,t}function je(e){return wt().get(e)||e}function eo(e,t,n=new Set){const o=[];for(const r of le(e)){if(o.length>=t)break;const u=je(r);n.has(u)||(n.add(u),o.push(r))}return o}let Ea=0;function Ne(e){return`${e}-rt-${++Ea}`}function Jt(e){const t=Ko();if(!t||t.total===0){const o=new Set;for(const r of e)o.add(r);return o}const n=new Set;for(const o of e)Gu(o)===!0&&n.add(o);return n}const Nn=new Map;let lr=null,cr=null;function Qt(e){return e==null?"":Array.isArray(e)?e.slice().sort().join(","):e}function sr(e){const t=Qt(e.choseong),n=e.composition,o=n?.syllable==null?"":Array.isArray(n.syllable)?n.syllable.slice().sort().join(","):String(n.syllable),r=n?`${Qt(n.cho)}/${Qt(n.jung)}/${Qt(n.jong)}/${n.jongNone?"N":""}/${o}`:"",u=Qt(e.grade);return`${e.difficulty??""}|${t}|${r}|${e.excludeNoImage?"1":"0"}|${e.count??""}|x${e.contrastCount??1}|${e.fullCount?"F":""}|s${e.sameStructureOnly===!1?"0":"1"}|v${e.phonemeView==="pron"?"p":"c"}|g${u}|t${e.targetSyllable??""}|c${e.choicesPerItem??""}`}async function Pe(e){const t=An(),n=Wt();(t!==lr||n!==cr)&&(Nn.clear(),lr=t,cr=n);const o=sr(e);return Nn.has(o)||Nn.set(o,ka(e)),Nn.get(o)}function ba(e){if(!e)return null;const t=i=>i==null?null:Array.isArray(i)?i.length?i:null:[i],n=t(e.cho),o=t(e.jung),r=!!e.jongNone,u=r?null:t(e.jong);return n||o||u||r?r&&!n&&!o&&!u?i=>Iu(i):i=>Pu(i,{cho:n,jung:o,jong:u,jongNone:r}):null}async function ka(e){const{difficulty:t=null,choseong:n=null,composition:o=null,targetSyllable:r=null,excludeNoImage:u=!1}=e,i=e.grade&&e.grade.length>0?new Set(e.grade):null,l=e.sameStructureOnly??!0,s=e.phonemeView==="pron"?"pron":"char",p=Math.max(1,e.contrastCount??1),h=t==="cho"||t==="jung"||t==="jong",f=h&&p>=2,c=t==="count",y=n?new Set(Array.isArray(n)?n:[n]):null,b=o?.syllable!=null?new Set(Array.isArray(o.syllable)?o.syllable:[o.syllable]):null,w=o?[ba(o),b?S=>b.has(bn(S)):null].filter(S=>S!=null):[],g=t==="random"||t===null,m=g||c,E=g||f||c;let k=Ye.filter(S=>!S.w||i&&(!S.grade||!i.has(S.grade))?!1:E?!0:Array.isArray(S.p)&&S.p.length>0);y&&(k=k.filter(S=>{for(const P of y)if(Ru(S.w,P))return!0;return!1})),w.length>0&&(k=k.filter(S=>{const P=s==="pron"?je(S.w):S.w;return w.every(re=>re(P))})),r&&(k=k.filter(S=>S.w[0]===r));let x;if(u){const S=new Set;for(const P of k)if(S.add(P.w),Array.isArray(P.p))for(const re of P.p)S.add(re);if(m)for(const P of Ye)P.w&&S.add(P.w);x=Jt(S)}else{const S=new Set;for(const P of k)if(S.add(P.w),Array.isArray(P.p))for(const re of P.p)S.add(re);if(m)for(const P of Ye)P.w&&S.add(P.w);x=S}let R=null;if(f){const S=new Set;for(const P of Ye)P.w&&S.add(P.w);R=u?Jt(S):S}const v=k.filter(S=>x.has(S.w)),j=600,H=Array.from(x),U=H.length>j?qe(H,j):H,F=c&&o!=null&&(be(o.cho)||be(o.jung)||be(o.jong)),Q=2500,G=new Map;if(c&&!F&&p>=2){for(const S of H){const P=bn(S),re=G.get(P);re?re.push(S):G.set(P,[S])}for(const[S,P]of G)P.length>Q&&G.set(S,qe(P,Q))}const W=Ou(),z=F?ca(o,H,W,l,s,je):null,D=500,O=1500,me=e.fullCount?v:t==="random"?v.length>D?qe(v,D):v:v.length>O?qe(v,O):v,Z=Wt(),ee=[];for(const S of me){let P;const re=je(S.w);if(f)P=Fu(S.w,t,p,R,24).filter(ue=>je(ue)!==re);else if(c)F?P=(z.get(S.w)??[]).filter(ue=>je(ue)!==re):p<=1?P=or(S.w,Z,{okSet:x,pronOf:je,decompOf:W,sameStructureOnly:!1}):P=(G.get(bn(S.w))??[]).filter(ue=>{if(ue===S.w||je(ue)===re)return!1;const Y=Hu(S.w,ue);return p>=5?Y>=5:Y===p});else if(g)P=U.filter(ue=>ue!==S.w&&ue.length===S.w.length&&je(ue)!==re);else{const ue=t;P=or(S.w,Z,{kind:ue,okSet:x,pronOf:je,decompOf:W,sameStructureOnly:!1}),P.length===0&&(P=(U.length>30?qe(U,30):U).filter(Y=>Y!==S.w&&Lu(S.w,Y)===t&&je(Y)!==re))}if(l&&P.length>0&&(h||c&&!F)){const ue=W(je(S.w));P=P.filter(Y=>!Xn(ue,W(je(Y))))}P.length!==0&&ee.push({word:S,usable:P})}return ee}async function dr(e,t){const{choicesPerItem:n=3,count:o=10}=t,r=n-1,u=(await Pe(t)).filter(l=>l.usable.length>=r),i=[];for(const l of le(u)){if(i.length>=o)break;const s=eo(l.usable,r);if(s.length<r)continue;const p=le([l.word.w,...s]);i.push({id:Ne(e+"-item"),index:i.length+1,word:l.word.w,syllables:l.word.s,choices:p,answerIndex:p.indexOf(l.word.w)})}return i}async function Aa(e){const{choicesPerItem:t=3,count:n=10}=e,o=t-1,r=await Pe({...e,difficulty:null});if(r.length<t)return[];const u=[],i=le([...r]);for(const l of i){if(u.length>=n)break;const s=l.word.w,p=[...l.word.pron||s],h=Sn(p);if(!h)continue;const f=r.filter(b=>b.word.w!==s&&b.word.s===l.word.s&&!(b.word.pron||b.word.w).includes(h)&&b.word.pron!==l.word.pron);if(f.length<o)continue;const c=eo(f.map(b=>b.word.w),o);if(c.length<o)continue;const y=le([s,...c]);u.push({id:Ne("HPI-item"),index:u.length+1,targetSyllable:h,word:s,choices:y,answerIndex:y.indexOf(s)})}return u}async function wa(e){const{count:t=10}=e,n=(await Pe(e)).filter(o=>o.usable.length>=1);return Array.from({length:t},(o,r)=>{const u=Sn(n);if(!u)return null;const i=r%2===0;let l;if(i)l=[u.word.w,u.word.w];else{const s=Sn(u.usable);l=Math.random()<.5?[u.word.w,s]:[s,u.word.w]}return{id:Ne("SOD-item"),index:r+1,word:u.word.w,pair:l,same:i}}).filter(o=>!!o)}async function Sa(e){const{choicesPerItem:t=3,count:n=10}=e,o=t-1,r=await Pe({...e,difficulty:null});if(r.length<t+1)return[];const u=r.map(c=>c.word.w),i=new Map(r.map(c=>[c.word.w,c.word.pron])),l=c=>(i.get(c)||c)[0]??"",s={};for(const c of r){const y=l(c.word.w);y&&(s[y]||(s[y]=[]),s[y].push(c.word.w))}const p=Object.entries(s).filter(([,c])=>c.length>=2).map(([c])=>c);if(p.length===0)return[];const h=[],f=le([...p]);for(let c=0;h.length<n&&c<n*4;c++){const y=f[c%f.length],b=s[y];if(b.length<2)continue;const w=le([...b]),g=w[0],m=w[1];if(!g||!m||g===m||(i.get(g)||g)===(i.get(m)||m))continue;const E=i.get(m)||m,k=u.filter(v=>l(v)!==y&&v!==g&&v!==m&&v.length===m.length&&(i.get(v)||v)!==E);if(k.length<o)continue;const x=eo(k,o);if(x.length<o)continue;const R=le([m,...x]);h.push({id:Ne("SWS-item"),index:h.length+1,sourceWord:g,targetSyllable:y,word:m,choices:R,answerIndex:R.indexOf(m)})}return h}function hr(e,t,n){return qe(e,t).map((o,r)=>{const u=Sn(o.usable)??"",i=[...o.word.w],l=[...u],s=i.findIndex((h,f)=>h!==l[f]),p=le(o.usable.filter(h=>h&&h!==u)).slice(0,2);return{id:Ne(n),index:r+1,word:o.word.w,original:o.word.w,changed:u,changedFrom:s>=0?i[s]:"",changedTo:s>=0?l[s]:"",distractors:p}})}async function pr(e,t,n){const{count:o=10}=t,r=wt(),u=Ye.filter(y=>y.w&&y.s===e),i=t.excludeNoImage?Jt(u.map(y=>y.w)):null,l=i?u.filter(y=>i.has(y.w)):u,s=new Set(l.map(y=>y.w)),p=ma(s),h=t.phonemeView??"char",f=t.composition??null,c=[];for(const y of le(l)){if(c.length>=o)break;const b=ga(y.w,f,r,h,p,null,null);if(!b)continue;const w=b.distractors[0],g=[...y.w],m=[...w],E=g.findIndex((k,x)=>k!==m[x]);c.push({id:Ne(n),index:c.length+1,word:y.w,original:y.w,changed:w,changedFrom:E>=0?g[E]:"",changedTo:E>=0?m[E]:"",distractors:b.distractors.slice(1)})}return c}async function Na(e){return pr(2,e,"CS2-item")}async function Ma(e){return pr(3,e,"CS3-item")}async function Ta(e){const t=(await Pe({...e,difficulty:"count",contrastCount:1})).filter(n=>n.word.s===1&&n.usable.length>=1);return hr(t,e.count??10,"CP1-item")}async function Ba(e){const t=e.difficulty&&e.difficulty!=="random"?e.difficulty:"count",n=(await Pe({...e,difficulty:t,contrastCount:1})).filter(o=>o.word.s===2&&o.usable.length>=1);return hr(n,e.count??10,"CP2-item")}async function Da(e){const{count:t=10}=e,n=(await Pe({...e})).filter(o=>o.word.s===2);return qe(n,t).map((o,r)=>({id:Ne("M2S-item"),index:r+1,word:o.word.w,answer:o.word.w,parts:[...o.word.w]}))}async function xa(e){const{count:t=10}=e,n=(await Pe({...e})).filter(o=>o.word.s===3);return qe(n,t).map((o,r)=>({id:Ne("M3S-item"),index:r+1,word:o.word.w,answer:o.word.w,parts:[...o.word.w]}))}async function va(e){const{count:t=10}=e,n=(await Pe({...e})).filter(l=>l.word.s===2),o=wt(),r=new Set(Ye.map(l=>l.w)),u=e.phonemeView??"char",i=[];for(const l of le(n)){if(i.length>=t)break;const s=ha(l.word.w,e.composition??null,o,u,r);if(!s)continue;const[p,...h]=s.distractors,f=[...l.word.w],c=f[0]===p?f[1]:f[0];i.push({id:Ne("D2-item"),index:i.length+1,original:l.word.w,word:l.word.w,dropped:c,missingResult:p,distractors:h})}return i}async function Oa(e){const{count:t=10}=e,n=(await Pe({...e})).filter(l=>l.word.s===3),o=wt(),r=new Set(Ye.map(l=>l.w)),u=e.phonemeView??"char",i=[];for(const l of le(n)){if(i.length>=t)break;const s=pa(l.word.w,e.composition??null,o,u,r);if(!s)continue;const[p,...h]=s.distractors,f=[...l.word.w];let c="";for(let y=0;y<f.length;y++)if(f.filter((b,w)=>w!==y).join("")===p){c=f[y];break}i.push({id:Ne("D3-item"),index:i.length+1,original:l.word.w,word:l.word.w,dropped:c,missingResult:p,distractors:h})}return i}async function La(e){const{count:t=10}=e,n=(await Pe({...e})).filter(l=>l.word.s>=2),o=wt(),r=new Set(Ye.map(l=>l.w)),u=e.phonemeView??"char",i=[];for(const l of le(n)){if(i.length>=t)break;const s=fa(l.word.w,e.composition??null,o,u,r);if(!s)continue;const[p,...h]=s.distractors,f=l.word.w,c=f.startsWith(p)?f.slice(p.length):f.endsWith(p)?f.slice(0,f.length-p.length):"";i.push({id:Ne("DPC-item"),index:i.length+1,original:f,word:f,dropped:c,missingResult:p,distractors:h})}return i}async function Ra(e){const{count:t=10}=e,n=(await Pe({...e})).map(o=>o.word.w);return n.length<3?[]:Array.from({length:t},(o,r)=>{const u=qe(n,3);return{id:Ne("LRO-item"),index:r+1,sequence:u,choices:le(u)}})}function Mn(e,t,n){const o=Ye.filter(i=>i.w&&i.s===e),r=t?Jt(o.map(i=>i.w)):null,u=[];for(const i of o)if(!(r&&!r.has(i.w))){if(n){const l=se(i.w);if(!l||!n(l))continue}u.push(i)}return u}function Ia(e){const t=Mn(1,e.excludeNoImage??!1,n=>n.jong===0);return qe(t,e.count??10).map((n,o)=>{const r=se(n.w);return{id:Ne("M2P-item"),index:o+1,parts:[Se[r.cho],st[r.jung]],answer:n.w,word:n.w}})}function ja(e){const t=Mn(1,e.excludeNoImage??!1,n=>n.jong>0&&!Yt[n.jong]);return qe(t,e.count??10).map((n,o)=>{const r=se(n.w);return{id:Ne("M3P-item"),index:o+1,parts:[Se[r.cho],st[r.jung],Ve[r.jong]],answer:n.w,word:n.w}})}function Pa(e){const t=tr.DROP_FINAL_CONSONANT_FROM_1SYLL,n=Mn(t.syllables,e.excludeNoImage??!1,t.syllable),o=wt(),r=[];for(const u of le(n)){if(r.length>=(e.count??10))break;const i=Ca(u.w,null,o);if(!i)continue;const[l,...s]=i.distractors;r.push({id:Ne("DFC-item"),index:r.length+1,original:u.w,word:u.w,result:l,distractors:s})}return r}function $a(e){const t=tr.REMOVE_CONSONANT_AND_IDENTIFY_PHONEME,n=Mn(t.syllables,e.excludeNoImage??!1,t.syllable),o=wt(),r=[];for(const u of le(n)){if(r.length>=(e.count??10))break;const i=ya(u.w,null,o);if(!i)continue;const l=se(o.get(u.w)||u.w);if(!l)continue;const[s,...p]=i.distractors;r.push({id:Ne("RCP-item"),index:r.length+1,base:u.w,word:u.w,missingConsonant:Se[l.cho],remaining:s,distractors:p})}return r}const Tn=new Map;let fr=null,Cr=null;async function yr(e,t={}){const n=An(),o=Wt();(n!==fr||o!==Cr)&&(Tn.clear(),fr=n,Cr=o);const r=`${e}:${sr(t)}`;if(Tn.has(r))return Tn.get(r);const u=await Ha(e,t);return Tn.set(r,u),u}const Fa={SAME_SOUND_PICK:e=>dr("SSP",e),HEAR_AND_PICK_SAME:e=>dr("HPS",e),HEAR_AND_PICK_INCLUDED:e=>Aa(e),SAME_OR_DIFF:e=>wa(e),STARTS_WITH_SAME_SOUND:e=>Sa(e),LISTEN_AND_REMEMBER_ORDER:e=>Ra(e),MERGE_2_SYLLABLES:e=>Da(e),MERGE_3_SYLLABLES:e=>xa(e),MERGE_2_PHONEMES:e=>Ia(e),MERGE_3_PHONEMES:e=>ja(e),DROP_1_FROM_2SYLL:e=>va(e),DROP_1_FROM_3SYLL:e=>Oa(e),DROP_PART_FROM_COMPOUND:e=>La(e),DROP_FINAL_CONSONANT_FROM_1SYLL:e=>Pa(e),REMOVE_CONSONANT_AND_IDENTIFY_PHONEME:e=>$a(e),CHANGE_1_SYLL_IN_2SYLL:e=>Na(e),CHANGE_1_SYLL_IN_3SYLL:e=>Ma(e),CHANGE_1_PHONEME_IN_1SYLL:e=>Ta(e),CHANGE_1_PHONEME_IN_2SYLL:e=>Ba(e)};async function Ha(e,t={}){const n=Fa[e];return n?await n(t):[]}async function za(e){const t=[null,"count"],n=Object.keys(Wn);let o=0;for(const r of t)for(const u of n){const i=Wn[u];yr(u,{difficulty:i.difficulty?r:null,choseong:null,count:10,excludeNoImage:e}).catch(()=>{}),++o%6===0&&await new Promise(l=>setTimeout(l,0))}}async function Va(e){return(await Pe({...e,fullCount:!0})).length}async function Ua(e={}){const t=[];for(const l of Ye)l.w&&t.push(l.w);const n=e.excludeNoImage?Jt(t):t,o=new Set,r=new Set,u=new Set,i=new Set;for(const l of n){i.add(bn(l));for(const s of l){const p=se(s);if(p&&(Se[p.cho]!=="\u3147"&&o.add(Se[p.cho]),r.add(st[p.jung]),p.jong>0)){u.add(Ve[p.jong]);const h=Yt[p.jong];h&&h.forEach(f=>u.add(f))}}}return{cho:o,jung:r,jong:u,syllable:i}}const St="\uC804\uCCB4";function Ga(...e){return e.filter(Boolean).join(" ")}/**
|
|
1
|
+
import{useState as B,useEffect as X,createContext as Gn,useContext as Yn,useRef as Oe,useCallback as q,useMemo as we,forwardRef as Po,createElement as Ut,useLayoutEffect as Nu}from"react";import{useTranslation as kt}from"react-i18next";import{jsx as oe,jsxs as Ie,Fragment as Gt}from"react/jsx-runtime";import{createPortal as $o}from"react-dom";function Mu({storageKey:e="fontScale",baseFont:t=20,minScale:n=.8,maxScale:o=1.4,step:r=.1,lineHeightRatio:u=1.4}={}){const i=g=>Math.max(n,Math.min(o,Number(g))),[l,c]=B(()=>{try{const g=localStorage.getItem(e),m=g?Number(g):1;return Number.isFinite(m)?m:1}catch{return 1}});X(()=>{try{localStorage.setItem(e,String(l))}catch{}},[e,l]);const f=g=>{c(typeof g=="function"?m=>i(g(m)):i(g))},h=()=>f(g=>+(g+r).toFixed(6)),p=()=>f(g=>+(g-r).toFixed(6)),s=l<o-Number.EPSILON,y=l>n+Number.EPSILON,b=Math.round(t*l),w=Math.round(b*u);return{scale:l,setScale:f,increase:h,decrease:p,canIncrease:s,canDecrease:y,fontSize:b,lineHeight:w}}const Fo=Gn(null);function Tu(e){return/max-width:\s*7[0-9][0-9]px/.test(e)}function Bu(e){const t=Yn(Fo),n=u=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia(u).matches,[o,r]=B(n(e));return X(()=>{if(typeof window>"u"||!window.matchMedia)return;const u=window.matchMedia(e),i=c=>r(c.matches),l=u;return l.addEventListener?l.addEventListener("change",i):l.addListener&&l.addListener(i),r(u.matches),()=>{l.removeEventListener?l.removeEventListener("change",i):l.removeListener&&l.removeListener(i)}},[e]),t&&typeof t.mobile=="boolean"&&Tu(e)?t.mobile:o}function Ho(e){const t=Oe(e);return X(()=>{t.current=e}),t}function zo(e,t){const n=Ho(t);X(()=>{const o=()=>n.current();try{window.addEventListener(e,o)}catch{}return()=>{try{window.removeEventListener(e,o)}catch{}}},[e,n])}const qn=" \xB7 ",Vo=(()=>{if(typeof document>"u")return"";const e=document.title;return e.includes(qn)?e.split(qn).pop()??e:e})(),Uo=Gn(!1);function Du(e){const t=Yn(Uo);X(()=>{if(t||typeof e!="string"||!e)return;const n=document.title;return document.title=Vo?`${e}${qn}${Vo}`:e,()=>{document.title=n}},[e,t])}function xu(){const{t:e}=kt();return q(t=>{if(!t)return"";const n=new Date(t).getTime();if(Number.isNaN(n))return"";const o=Math.floor((Date.now()-n)/864e5);return o<=0?e("myHomework.relativeDay.today","\uC624\uB298"):o===1?e("myHomework.relativeDay.yesterday","\uC5B4\uC81C"):e("myHomework.relativeDay.daysAgo",{n:o})},[e])}function vu(e){const[t,n]=B({current:"",next:"",confirm:""}),[o,r]=B(null),[u,i]=B(!1),l=Oe(null);X(()=>()=>{l.current!==null&&clearTimeout(l.current)},[]);const c=q(()=>{n({current:"",next:"",confirm:""}),r(null)},[]),f=q(async()=>{if(!t.current){r({type:"error",text:"\uD604\uC7AC \uBE44\uBC00\uBC88\uD638\uB97C \uC785\uB825\uD558\uC138\uC694."});return}if(!t.next){r({type:"error",text:"\uC0C8 \uBE44\uBC00\uBC88\uD638\uB97C \uC785\uB825\uD558\uC138\uC694."});return}if(t.next!==t.confirm){r({type:"error",text:"\uC0C8 \uBE44\uBC00\uBC88\uD638\uAC00 \uC77C\uCE58\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4."});return}i(!0);const h=e?await e(t.current,t.next):null;if(i(!1),h){r({type:"error",text:h});return}r({type:"success",text:"\uBE44\uBC00\uBC88\uD638\uAC00 \uBCC0\uACBD\uB418\uC5C8\uC2B5\uB2C8\uB2E4."}),n({current:"",next:"",confirm:""}),l.current!==null&&clearTimeout(l.current),l.current=setTimeout(()=>r(null),1500)},[t,e]);return{pw:t,setPw:n,pwMsg:o,setPwMsg:r,pwLoading:u,handleChangePw:f,reset:c}}const Se=["\u3131","\u3132","\u3134","\u3137","\u3138","\u3139","\u3141","\u3142","\u3143","\u3145","\u3146","\u3147","\u3148","\u3149","\u314A","\u314B","\u314C","\u314D","\u314E"],st=["\u314F","\u3150","\u3151","\u3152","\u3153","\u3154","\u3155","\u3156","\u3157","\u3158","\u3159","\u315A","\u315B","\u315C","\u315D","\u315E","\u315F","\u3160","\u3161","\u3162","\u3163"],Ve=["","\u3131","\u3132","\u3133","\u3134","\u3135","\u3136","\u3137","\u3139","\u313A","\u313B","\u313C","\u313D","\u313E","\u313F","\u3140","\u3141","\u3142","\u3144","\u3145","\u3146","\u3147","\u3148","\u314A","\u314B","\u314C","\u314D","\u314E"];function se(e){if(!e)return null;const t=e.charCodeAt(0)-44032;return t<0||t>=11172?null:{cho:Math.floor(t/588),jung:Math.floor(t%588/28),jong:t%28}}function Ou(){const e=new Map;return t=>{let n=e.get(t);return n||(n=[...t].map(o=>se(o)),e.set(t,n)),n}}function At(e,t,n=0){return String.fromCharCode(44032+(e*21+t)*28+n)}function Lu(e,t){if(!e||!t||e===t||e.length!==t.length)return"random";let n=0,o=null;for(let r=0;r<e.length;r++){const u=se(e[r]),i=se(t[r]);if(!u||!i)return"random";if(u.cho===i.cho&&u.jung===i.jung&&u.jong===i.jong)continue;n++;const l=u.cho!==i.cho,c=u.jung!==i.jung,f=u.jong!==i.jong;(l?1:0)+(c?1:0)+(f?1:0)>1?o="multi":l?o="cho":c?o="jung":o="jong"}return n!==1?"random":o==="cho"?"cho":o==="jung"?"jung":o==="jong"?"jong":"random"}const Yt={3:["\u3131","\u3145"],5:["\u3134","\u3148"],6:["\u3134","\u314E"],9:["\u3139","\u3131"],10:["\u3139","\u3141"],11:["\u3139","\u3142"],12:["\u3139","\u3145"],13:["\u3139","\u314C"],14:["\u3139","\u314D"],15:["\u3139","\u314E"],18:["\u3142","\u3145"]};Object.fromEntries(Object.entries(Yt).map(([e,t])=>[t.join(""),Ve[Number(e)]]));function Ru(e,t){if(!e||!t)return!1;for(const n of e){const o=se(n);if(o){if(Se[o.cho]===t)return!0;if(o.jong>0){if(Ve[o.jong]===t)return!0;const r=Yt[o.jong];if(r&&r.includes(t))return!0}}}return!1}function bn(e){if(!e)return 0;let t=0;for(const n of e)se(n)&&t++;return t}function Iu(e){if(!e)return!1;let t=!1;for(const n of e){const o=se(n);if(o&&(t=!0,o.jong>0))return!1}return t}function ju(e,t){if(e.jong<=0)return!1;if(t.includes(Ve[e.jong]))return!0;const n=Yt[e.jong];return!!n&&n.some(o=>t.includes(o))}function Pu(e,t,n){if(!e)return!1;const o=[...e],r=u=>{const i=se(o[u]);if(!i||t.cho&&!t.cho.includes(Se[i.cho])||t.jung&&!t.jung.includes(st[i.jung]))return!1;if(t.jongNone){if(i.jong>0)return!1}else if(t.jong&&!ju(i,t.jong))return!1;return!0};if(n==="head")return r(0);if(n==="tail")return r(o.length-1);if(n==="mid"){for(let u=1;u<o.length-1;u++)if(r(u))return!0;return!1}for(let u=0;u<o.length;u++)if(r(u))return!0;return!1}const $u={cho:Se.length,jung:st.length,jong:Ve.length};function Fu(e,t,n,o,r=1/0){if(!e||n<1)return[];const u=[...e].map(p=>se(p));if(u.some(p=>!p))return[];const i=u,l=i.length;if(n>l)return[];const c=$u[t],f=new Set,h=[];(function p(s,y){if(y.length===n){h.push([...y]);return}for(let b=s;b<l;b++)y.push(b),p(b+1,y),y.pop()})(0,[]);for(const p of h)if((function s(y,b){if(f.size>=r)return;if(y===p.length){const m=b.map(E=>At(E.cho,E.jung,E.jong)).join("");m!==e&&o.has(m)&&f.add(m);return}const w=p[y],g=i[w][t];for(let m=0;m<c;m++){if(m===g)continue;const E=b.slice();if(E[w]={...b[w],[t]:m},s(y+1,E),f.size>=r)return}})(0,i),f.size>=r)break;return[...f]}function Hu(e,t){if(!e||!t||e.length!==t.length)return-1;let n=0;for(let o=0;o<e.length;o++){const r=se(e[o]),u=se(t[o]);if(!r||!u)return-1;r.cho!==u.cho&&n++,r.jung!==u.jung&&n++,r.jong!==u.jong&&n++}return n}const Go="word_pair_index_v2",Yo="word_pair_index_sig_v2";let qt=null;function zu(){try{if(typeof localStorage>"u")return null;const e=localStorage.getItem(Go),t=localStorage.getItem(Yo);return!e||!t?null:{index:JSON.parse(e),sig:t}}catch{return null}}function Wt(){if(qt)return qt;const e=zu();return e?(qt=e.index,e.sig,qt):null}function Vu(){qt=null;try{typeof localStorage<"u"&&(localStorage.removeItem(Go),localStorage.removeItem(Yo))}catch{}}const qo="word_image_existence_map_v1";let Rt=null;function Wo(){if(Rt)return Rt;try{const e=typeof localStorage<"u"?localStorage.getItem(qo):null;Rt=e?JSON.parse(e):{}}catch{Rt={}}return Rt}function Uu(e,t){return`${e}_${t??1}`}function Gu(e,t){const n=Wo(),o=Uu(e,t);return o in n?n[o]:void 0}function Ko(){const e=Wo(),t=Object.values(e);return t.length===0?null:{total:t.length,exists:t.filter(Boolean).length}}function Yu(){Rt={};try{typeof localStorage<"u"&&localStorage.removeItem(qo)}catch{}}const Xo=[{id:"wordData",labelKey:"settings.cache.group.wordData.label",subKey:"settings.cache.group.wordData.sub",keys:["word_data_cache","word_data_version"]},{id:"pairIndex",labelKey:"settings.cache.group.pairIndex.label",subKey:"settings.cache.group.pairIndex.sub",keys:["word_pair_index_v2","word_pair_index_sig_v2"]},{id:"imageCache",labelKey:"settings.cache.group.imageCache.label",subKey:"settings.cache.group.imageCache.sub",keys:["word_image_existence_map_v1"]}];function Zo(e){return e.reduce((t,n)=>{try{const o=localStorage.getItem(n);return t+(o?new Blob([o]).size:0)}catch{return t}},0)}function qu(e){return e===0?"0 B":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(2)} MB`:`${(e/(1024*1024*1024)).toFixed(2)} GB`}function Wu(e){const{t}=kt(),[n,o]=B({}),[r,u]=B(null),[i,l]=B(null),[c,f]=B(null),h=q(()=>{const s={};Xo.forEach(y=>{s[y.id]=Zo([...y.keys])}),o(s),typeof navigator<"u"&&navigator.storage?.estimate&&navigator.storage.estimate().then(y=>{f({usage:y.usage??0,quota:y.quota??0})}).catch(()=>{})},[]);X(()=>{h()},[h]);const p=q(async s=>{u(s);try{s==="wordData"?(localStorage.removeItem("word_data_cache"),localStorage.removeItem("word_data_version")):s==="pairIndex"?Vu():s==="imageCache"&&Yu(),h(),e?.(t("settings.cache.cleared","\uCE90\uC2DC\uAC00 \uC0AD\uC81C\uB418\uC5C8\uC2B5\uB2C8\uB2E4."))}finally{u(null)}},[h,e,t]);return{cacheSizes:n,clearingId:r,confirmCacheId:i,setConfirmCacheId:l,storageEstimate:c,refreshCacheSizes:h,handleClearCache:p}}function Ku(e){const[t,n]=B(null),[o,r]=B(null),u=q(()=>{const i=Wt();if(i){const c=Object.values(i),f=c.filter(h=>h.cho.length+h.jung.length+h.jong.length>0).length;n({matched:f,total:c.length})}else n(null);const l=Ko();r(l?{exists:l.exists,total:l.total}:null)},[]);return X(()=>{u();const i=setTimeout(u,1e3);return()=>clearTimeout(i)},[e,u]),{pairStats:t,imgStats:o,setPairStats:n,setImgStats:r,refreshStats:u}}function Jo(e,t=[]){const[n,o]=B(t),[r,u]=B(null),[i,l]=B(!1),[c,f]=B(e),h=Oe(i);X(()=>{h.current=i});const p=Oe(null);X(()=>{if(h.current)return;const m=p.current;m!==null&&m.length===t.length&&m.every((E,k)=>E===t[k])||(p.current=t,o(t))},[t]);const s=q(m=>{u(m),l(!1),f({...m})},[]),y=q(()=>l(!0),[]),b=q(()=>l(!1),[]),w=q((m,E)=>{o(m),u(E),l(!1)},[]),g=q(m=>{o(E=>E.filter(k=>k!==m)),u(null)},[]);return{list:n,setList:o,selected:r,setSelected:u,isEditing:i,setIsEditing:l,editForm:c,setEditForm:f,openDetail:s,startEditing:y,cancelEditing:b,commitEdit:w,remove:g}}const Kt=()=>{const e=new Date;return{year:String(e.getFullYear()),month:String(e.getMonth()+1).padStart(2,"0"),day:String(e.getDate()).padStart(2,"0")}},Xu={year:"",month:"",day:"",hour:"09",minute:"00",memo:""};function Zu(e=[]){const{list:t,setList:n,selected:o,setSelected:r,isEditing:u,setIsEditing:i,editForm:l,setEditForm:c,openDetail:f,commitEdit:h}=Jo(Xu,e),{year:p,month:s,day:y}=Kt(),[b,w]=B({year:p,month:s,day:y,hour:"09",minute:"00",memo:""});return{visitHistory:t,visitForm:b,setVisitForm:w,setVisit:g=>m=>w(E=>({...E,[g]:m})),selectedVisit:o,setSelectedVisit:r,isEditingVisit:u,setIsEditingVisit:i,editVisitForm:l,setEditVisitForm:c,openVisitDetail:f,handleVisitSave:g=>{n(x=>[b,...x]);const{year:m,month:E,day:k}=Kt();w({year:m,month:E,day:k,hour:"09",minute:"00",memo:""}),g?.()},handleVisitEditSave:()=>{h(g=>g.map(m=>m===o?l:m),l)},addVisit:g=>{n(m=>[g,...m])},removeVisit:g=>{n(m=>m.filter(E=>E!==g))},revertVisitEdit:(g,m)=>{n(E=>E.map(k=>k===m?g:k)),r(E=>E===m?g:E)}}}const Qo=e=>`${e.year.padStart(4,"0")}-${e.month.padStart(2,"0")}-${e.day.padStart(2,"0")} ${e.hour.padStart(2,"0")}:${e.minute.padStart(2,"0")}`,kn=e=>[...e].sort((t,n)=>{const o=Qo(t),r=Qo(n);return o<r?-1:o>r?1:0}),Ju={year:"",month:"",day:"",hour:"09",minute:"00",memo:""};function Qu(e,t=[]){const n=we(()=>kn(t),[t]),{list:o,setList:r,selected:u,setSelected:i,isEditing:l,setIsEditing:c,editForm:f,setEditForm:h,openDetail:p,commitEdit:s,remove:y}=Jo(Ju,n),[b,w]=B([]),{year:g,month:m,day:E}=Kt(),[k,x]=B({year:g,month:m,day:E,hour:"09",minute:"00",memo:""}),R=z=>D=>x(O=>({...O,[z]:D})),v=z=>{r(Z=>kn([...Z,k]));const{year:D,month:O,day:me}=Kt();x({year:D,month:O,day:me,hour:"09",minute:"00",memo:""}),z?.()},j=()=>{s(z=>kn(z.map(D=>D===u?f:D)),f)},H=q(z=>{y(z)},[y]),U=q(z=>{e({year:z.year,month:z.month,day:z.day,hour:z.hour,minute:z.minute,memo:z.memo}),y(z)},[e,y]),F=q(z=>{r(D=>D.filter(O=>O!==z)),w(D=>[z,...D]),i(null)},[r,i]),Q=q(z=>{r(D=>kn([...D,z]))},[r]),G=q(z=>{r(D=>D.filter(O=>O!==z))},[r]),W=q((z,D)=>{r(O=>O.map(me=>me===D?z:me)),i(O=>O===D?z:O)},[r,i]);return{scheduleList:o,noShowList:b,addSchedule:Q,removeSchedule:G,revertScheduleEdit:W,scheduleForm:k,setScheduleForm:x,setSchedule:R,selectedSchedule:u,setSelectedSchedule:i,isEditingSchedule:l,setIsEditingSchedule:c,editScheduleForm:f,setEditScheduleForm:h,openScheduleDetail:p,handleScheduleSave:v,handleScheduleEditSave:j,handleScheduleDelete:H,handleScheduleToVisit:U,handleScheduleNoVisit:F}}const er=[{value:"10",label:"10\uAC1C\uC529 \uBCF4\uAE30"},{value:"25",label:"25\uAC1C\uC529 \uBCF4\uAE30"},{value:"50",label:"50\uAC1C\uC529 \uBCF4\uAE30"},{value:"100",label:"100\uAC1C\uC529 \uBCF4\uAE30"}];function ea(e){const[t,n]=B(""),[o,r]=B("25"),[u,i]=B("all"),[l,c]=B(1),f=we(()=>e.filter(({item:y,status:b})=>!(t&&!y.memo.includes(t)||u!=="all"&&b!==u)),[e,t,u]),h=Math.max(1,Math.ceil(f.length/Number(o))),p=Math.min(l,h),s=we(()=>f.slice((p-1)*Number(o),p*Number(o)),[f,p,o]);return{vapSearch:t,setVapSearch:n,vapPageSize:o,setVapPageSize:r,vapStatus:u,setVapStatus:i,vapPage:p,setVapPage:c,vapFiltered:f,vapTotal:h,vapPageItems:s}}function ta(e,t){const{t:n}=kt(),[o,r]=B("25"),[u,i]=B(1),[l,c]=B(t);l!==t&&(c(t),u!==1&&i(1));const f=we(()=>er.map(y=>({...y,label:n("visits.showN",{n:y.value})})),[n]),h=q(y=>{r(y),i(1)},[]),p=Math.max(1,Math.ceil(e.length/Number(o))),s=Math.min(u,p);return{pageRows:we(()=>e.slice((s-1)*Number(o),s*Number(o)),[e,s,o]),pageSizeProps:{options:f,value:o,onChange:h},paginationProps:{page:s,total:p,onChange:i},setPage:i}}function na(){const[e,t]=B(null),n=q(r=>{t(u=>u?.key===r?{key:r,asc:!u.asc}:{key:r,asc:!0})},[]),o=q((r,u)=>({label:r,sortDir:e?.key===u?e.asc?"asc":"desc":null,onClick:()=>n(u)}),[e,n]);return{\uC815\uB82C:e,\uCE78:o}}function oa(){const[e,t]=B(!1),[n,o]=B("\uC88C"),[r,u]=B({\uC88C:null,\uC6B0:null}),[i,l]=B({\uC88C:[],\uC6B0:[]}),[c,f]=B(!1),[h,p]=B("\uC88C"),s=q(b=>{const w=b.direction;u(g=>({...g,[w]:b})),l(g=>({...g,[w]:[b,...g[w]]})),t(!1)},[]),y=q(b=>{const w=b.direction;u(g=>({...g,[w]:b})),f(!1)},[]);return{showDevice:e,setShowDevice:t,deviceDirection:n,setDeviceDirection:o,devices:r,setDevices:u,deviceHistory:i,setDeviceHistory:l,showDeviceList:c,setShowDeviceList:f,listForSide:h,setListForSide:p,handleDeviceSubmit:s,handleSelectFromList:y}}const ra="__ihab_core_word_pool__";function An(){return globalThis[ra]??null}function le(e,t=Math.random){const n=e.slice();for(let o=n.length-1;o>0;o--){const r=Math.floor(t()*(o+1));[n[o],n[r]]=[n[r],n[o]]}return n}function dt(e,t,n=Math.random){return!Array.isArray(e)||e.length===0||t<=0?[]:t>=e.length?le(e,n):le(e,n).slice(0,t)}const Wn={SAME_SOUND_PICK:{difficulty:!0,choseong:!0,group:"discrimination"},SAME_OR_DIFF:{difficulty:!0,choseong:!0,group:"discrimination"},HEAR_AND_PICK_SAME:{difficulty:!0,choseong:!0,group:"discrimination"},HEAR_AND_PICK_INCLUDED:{difficulty:!0,choseong:!0,group:"discrimination"},STARTS_WITH_SAME_SOUND:{difficulty:!1,choseong:!0,group:"discrimination"},LISTEN_AND_REMEMBER_ORDER:{difficulty:!1,choseong:!0,group:"attention"},MERGE_2_SYLLABLES:{difficulty:!1,choseong:!0,group:"synthesis"},MERGE_3_SYLLABLES:{difficulty:!1,choseong:!0,group:"synthesis"},MERGE_2_PHONEMES:{difficulty:!1,choseong:!0,group:"synthesis"},MERGE_3_PHONEMES:{difficulty:!1,choseong:!0,group:"synthesis"},DROP_1_FROM_2SYLL:{difficulty:!1,choseong:!0,group:"deletion"},DROP_1_FROM_3SYLL:{difficulty:!1,choseong:!0,group:"deletion"},DROP_PART_FROM_COMPOUND:{difficulty:!1,choseong:!0,group:"deletion"},DROP_FINAL_CONSONANT_FROM_1SYLL:{difficulty:!1,choseong:!0,group:"deletion"},REMOVE_CONSONANT_AND_IDENTIFY_PHONEME:{difficulty:!1,choseong:!0,group:"deletion"},CHANGE_1_SYLL_IN_2SYLL:{difficulty:!0,choseong:!0,group:"substitution"},CHANGE_1_SYLL_IN_3SYLL:{difficulty:!0,choseong:!0,group:"substitution"},CHANGE_1_PHONEME_IN_1SYLL:{difficulty:!1,choseong:!0,group:"substitution"},CHANGE_1_PHONEME_IN_2SYLL:{difficulty:!0,choseong:!0,group:"substitution"}},ua=Se.indexOf("\u3147"),tr={DROP_FINAL_CONSONANT_FROM_1SYLL:{syllables:1,syllable:e=>e.jong>0},REMOVE_CONSONANT_AND_IDENTIFY_PHONEME:{syllables:1,syllable:e=>e.jong===0&&e.cho!==ua},MERGE_2_SYLLABLES:{syllables:2,syllable:()=>!0},MERGE_3_SYLLABLES:{syllables:3,syllable:()=>!0},MERGE_2_PHONEMES:{syllables:1,syllable:e=>e.jong===0},MERGE_3_PHONEMES:{syllables:1,syllable:e=>e.jong>0}},aa={\u3131:"\u3131",\u3132:"\u3131",\u314B:"\u3131",\u3133:"\u3131",\u313A:"\u3131",\u3134:"\u3134",\u3135:"\u3134",\u3136:"\u3134",\u3137:"\u3137",\u3145:"\u3137",\u3146:"\u3137",\u3148:"\u3137",\u314A:"\u3137",\u314C:"\u3137",\u314E:"\u3137",\u3139:"\u3139",\u313C:"\u3139",\u313D:"\u3139",\u313E:"\u3139",\u3140:"\u3139",\u3141:"\u3141",\u313B:"\u3141",\u3142:"\u3142",\u314D:"\u3142",\u313F:"\u3142",\u3144:"\u3142",\u3147:"\u3147"},ia={\u314F:{nucleus:"\u314F"},\u3151:{glide:"j",nucleus:"\u314F"},\u3153:{nucleus:"\u3153"},\u3155:{glide:"j",nucleus:"\u3153"},\u3157:{nucleus:"\u3157"},\u315B:{glide:"j",nucleus:"\u3157"},\u315C:{nucleus:"\u315C"},\u3160:{glide:"j",nucleus:"\u315C"},\u3161:{nucleus:"\u3161"},\u3163:{nucleus:"\u3163"},\u3150:{nucleus:"\u3154/\u3150"},\u3152:{glide:"j",nucleus:"\u3154/\u3150"},\u3154:{nucleus:"\u3154/\u3150"},\u3156:{glide:"j",nucleus:"\u3154/\u3150"},\u3158:{glide:"w",nucleus:"\u314F"},\u3159:{glide:"w",nucleus:"\u3154/\u3150"},\u315A:{glide:"w",nucleus:"\u3154/\u3150"},\u315D:{glide:"w",nucleus:"\u3153"},\u315E:{glide:"w",nucleus:"\u3154/\u3150"},\u315F:{glide:"w",nucleus:"\u3163"},\u3162:{glide:"\u0270",nucleus:"\u3163"}};function nr(e){return aa[e]??e}const Kn={cho:Se,jung:st,jong:Ve},be=e=>Array.isArray(e)?e.length>0:!!e;function Xn(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){const o=e[n],r=t[n];if(!(!o||!r)&&(o.cho!==r.cho&&Se[o.cho]==="\u3147"!=(Se[r.cho]==="\u3147")||o.jong!==r.jong&&o.jong===0!=(r.jong===0)))return!0}return!1}function la(e,t,n){const o=n.pronOf(e),r=n.decompOf,u=n.sameStructureOnly&&r?r(o):null,i=[];for(const l of t)l!==e&&(n.okSet&&!n.okSet.has(l)||n.pronOf(l)!==o&&(u&&r&&Xn(u,r(n.pronOf(l)))||i.push(l)));return i}function or(e,t,n){const o=t?.[e];if(!o)return[];const r=n.kind?o[n.kind]??[]:[...o.cho??[],...o.jung??[],...o.jong??[]];return la(e,r,n)}function ca(e,t,n,o,r,u,i){const l=["cho","jung","jong"].filter(s=>be(e[s])),c={};for(const s of l){const y=e[s];c[s]=new Set(Array.isArray(y)?y:[y])}const f=r==="pron",h=new Map;for(const s of t){const y=n(u(s));if(y.some(m=>!m))continue;let b=y;if(!f&&(b=n(s),b.length!==y.length||b.some(m=>!m)))continue;const w=y.length,g=h.get(w);g?g.push({w:s,dPron:y,dPos:b}):h.set(w,[{w:s,dPron:y,dPos:b}])}const p=new Map;for(const[s,y]of h){const b=new Map,w=(g,m)=>{const E=g.dPos[m];return E!=null&&l.every(k=>c[k].has(Kn[k][E[k]]))};for(const g of y){let m;if(i==="head")m=w(g,0)?0:-1;else if(i==="tail")m=w(g,s-1)?s-1:-1;else if(i==="mid"){m=-1;for(let k=1;k<s-1;k++)if(w(g,k)){m=k;break}}else m=g.dPos.findIndex(k=>k!=null&&l.every(x=>c[x].has(Kn[x][k[x]])));if(m<0)continue;const E=b.get(m);E?E.push(g):b.set(m,[g])}for(const[g,m]of b){const E=new Set(l.map(R=>g+":"+R)),k=R=>{let v="";for(let j=0;j<s;j++){const H=R[j];for(const U of["cho","jung","jong"])v+=(E.has(j+":"+U)?"*":H[U])+"."}return v},x=new Map;for(const R of y){const v=k(R.dPron),j=x.get(v);j?j.push(R):x.set(v,[R])}for(const R of m){const v=x.get(k(R.dPron))??[],j=[];for(const H of v){if(H.w===R.w)continue;let U=!0;for(const F of l){const Q=R.dPron[g][F],G=H.dPron[g][F];if(G===Q){U=!1;break}if(f&&c[F].has(Kn[F][G])){U=!1;break}}U&&(o&&Xn(R.dPron,H.dPron)||j.push(H.w))}p.set(R.w,j)}}}return p}const sa=e=>e==null?[]:Array.isArray(e)?e:[e];function da(e){if([...e].length!==1)return"";const t=se(e);if(!t)return"";const n=nr(Ve[t.jong]),o=n===""?0:Ve.indexOf(n);return At(t.cho,t.jung,o<0?0:o)}function rr(e,t){return t.get(e)||da(e)||e}function Zn(e){return e?be(e.cho)?"cho":be(e.jung)?"jung":be(e.jong)?"jong":null:null}function It(e,t){const n=(o,r)=>!be(o)||sa(o).includes(r);return n(t.cho,Se[e.cho])&&n(t.jung,st[e.jung])&&n(t.jong,Ve[e.jong])}function Xt(e,t,n){const o=[...e];if(n!=="pron")return o.map(u=>se(u));const r=[...t.get(e)||e];return r.length!==o.length?o.map(u=>se(u)):r.map(u=>se(u))}function Zt(e,t,n,o,r){const u=t==="cho"?Se:t==="jung"?st:Ve,i=e[t],l=[],c=new Set([rr(n,r)]),f=le(u.map((h,p)=>p).filter(h=>h!==i&&(t!=="cho"||u[h]!=="\u3147")&&(t!=="jong"||h!==0)));for(const h of f){if(l.length>=o)break;const p=t==="cho"?At(h,e.jung,e.jong):t==="jung"?At(e.cho,h,e.jong):At(e.cho,e.jung,h),s=rr(p,r);c.has(s)||(c.add(s),l.push(p))}return l}function ha(e,t,n,o,r,u=null){const i=[...e];if(i.length!==2)return null;const l=i.map(p=>se(p));if(l.some(p=>!p))return null;const c=Xt(e,n,o);if(c.some(p=>!p))return null;const f=Zn(t);let h=f&&t?c.map((p,s)=>It(p,t)?s:-1).filter(p=>p>=0):[0,1];if(u!=null&&(h=h.filter(p=>p!==u)),!h.length)return null;for(const p of le(h)){const s=i[p];if(!r.has(s))continue;const y=Zt(l[p],f??"cho",s,40,n),b=[];for(const w of y)if(w!==s&&r.has(w)&&!b.includes(w)&&b.push(w),b.length>=2)break;if(!(b.length<2))return{question:e,distractors:[s,...b]}}return null}function pa(e,t,n,o,r,u=null){const i=[...e];if(i.length!==3)return null;const l=i.map(p=>se(p));if(l.some(p=>!p))return null;const c=Xt(e,n,o);if(c.some(p=>!p))return null;const f=Zn(t),h=f&&t?c.map((p,s)=>It(p,t)?s:-1).filter(p=>p>=0):[0,1,2];if(!h.length)return null;for(const p of le(h))for(const s of le([0,1,2].filter(y=>y!==p&&(u==null||y===u)))){const y=[0,1,2].filter(E=>E!==s),b=y.map(E=>i[E]).join("");if(!r.has(b))continue;const w=y.indexOf(p),g=Zt(l[p],f??"cho",i[p],40,n),m=[];for(const E of g){const k=y.map(R=>i[R]);k[w]=E;const x=k.join("");if(x!==b&&r.has(x)&&!m.includes(x)&&m.push(x),m.length>=2)break}if(!(m.length<2))return{question:e,distractors:[b,...m]}}return null}function fa(e,t,n,o,r,u=null){const i=[...e],l=i.length;if(l<2)return null;const c=[];for(let h=1;h<=l-1;h++)c.push({remain:i.slice(0,h).join(""),dropped:i.slice(h).join(""),droppedEnd:1}),c.push({remain:i.slice(l-h).join(""),dropped:i.slice(0,l-h).join(""),droppedEnd:0});const f=Zn(t);for(const{remain:h,dropped:p,droppedEnd:s}of le(c)){if(u!=null&&s!==u||h===e||!r.has(h)||!r.has(p))continue;const y=[...h],b=y.map(m=>se(m));if(b.some(m=>!m))continue;const w=Xt(h,n,o);if(w.some(m=>!m))continue;const g=f&&t?w.map((m,E)=>It(m,t)?E:-1).filter(m=>m>=0):y.map((m,E)=>E);if(g.length)for(const m of le(g)){const E=Zt(b[m],f??"cho",y[m],40,n),k=[];for(const x of E){const R=[...y];R[m]=x;const v=R.join("");if(v!==h&&r.has(v)&&!k.includes(v)&&k.push(v),k.length>=2)break}if(k.length>=2)return{question:e,distractors:[h,...k]}}}return null}function Ca(e,t,n,o,r,u=null){if([...e].length!==1)return null;const i=se(n.get(e)||e);if(!i||i.jong===0)return null;const l=At(i.cho,i.jung,0),c=Zt({cho:i.cho,jung:i.jung,jong:0},"cho",l,2,n);return c.length<2?null:{question:e,distractors:[l,...c]}}const Jn=Se.indexOf("\u3147");function ya(e,t,n,o,r,u=null){if([...e].length!==1)return null;const i=se(n.get(e)||e);if(!i||i.jong!==0||i.cho===Jn)return null;const l=At(Jn,i.jung,0),c=Zt({cho:Jn,jung:i.jung,jong:0},"jung",l,2,n);return c.length<2?null:{question:e,distractors:[l,...c]}}function ma(e){const t=new Map;for(const n of e){const o=[...n],r=o.length;if(!(r<2||r>3))for(let u=0;u<r;u++){let i=r+"|"+u+"|";for(let c=0;c<r;c++)i+=c===u?"*":o[c];const l=t.get(i);l?l.push(n):t.set(i,[n])}}return t}function ga(e,t,n,o,r,u=null,i=null,l=2){const c=[...e],f=c.length;if(f<2||f>3)return null;const h=c.map(E=>se(E));if(h.some(E=>!E))return null;const p=Xt(e,n,o);if(p.some(E=>!E))return null;const s=E=>n.get(E)??E,y=s(e),b=!!t&&(be(t.cho)||be(t.jung)||be(t.jong)),w=!!i&&(be(i.cho)||be(i.jung)||be(i.jong)),g=E=>{let k=f+"|"+E+"|";for(let x=0;x<f;x++)k+=x===E?"*":c[x];return k};let m;if(u!=null){if(u>=f||b&&!It(p[u],t))return null;m=[u]}else b?m=p.map((E,k)=>It(E,t)?k:-1).filter(E=>E>=0):m=Array.from({length:f},(E,k)=>k);for(const E of le(m)){const k=r.get(g(E))??[],x=[],R=[];for(const F of k){if(F===e)continue;const Q=[...F].map(D=>se(D)),G=h[E],W=Q[E];if(!G||!W)continue;let z=0;if(G.cho!==W.cho&&z++,G.jung!==W.jung&&z++,G.jong!==W.jong&&z++,!(z<l||s(F)===y))if(w){const D=Xt(F,n,o)[E];D&&It(D,i)?x.push(F):R.push(F)}else x.push(F)}if(!x.length)continue;const v=le(x)[0],j=[],H=new Set([y,s(v)]),U=w?R:x.filter(F=>F!==v);for(const F of le(U)){const Q=s(F);if(!H.has(Q)&&(H.add(Q),j.push(F),j.length>=2))break}if(!w&&j.length<2)for(const F of le(k)){if(F===e||F===v)continue;const Q=s(F);if(!H.has(Q)&&(H.add(Q),j.push(F),j.length>=2))break}if(!(j.length<2))return{question:e,distractors:[v,...j]}}return null}let wn=null,ur=null,ar=null;function _a(){const e=An();if(e&&e.entries.length>0){const t=Wt();if(wn&&ur===e&&ar===t)return wn;const n=new Set,o=[];for(const r of e.entries)!r.word||n.has(r.word)||(n.add(r.word),o.push({w:r.word,s:r.syllables,p:t?.[r.word]?[...t[r.word].cho??[],...t[r.word].jung??[],...t[r.word].jong??[]]:[],pron:r.pronunciation||r.word,grade:r.grade}));return wn=o,ur=e,ar=t,wn}return[]}const Ye=new Proxy([],{get(e,t){const n=_a(),o=n[t];return typeof o=="function"?o.bind(n):o}});function Sn(e){return e.length?e[Math.floor(Math.random()*e.length)]:void 0}function qe(e,t){if(t>=e.length)return le(e);if(t===0)return[];const n=e.slice();for(let o=0;o<t;o++){const r=o+Math.floor(Math.random()*(n.length-o)),u=n[o];n[o]=n[r],n[r]=u}return n.slice(0,t)}let Qn=null,ir=null;function wt(){const e=An();if(Qn&&ir===e)return Qn;const t=new Map;for(const n of Ye)n.w&&t.set(n.w,n.pron);return Qn=t,ir=e,t}function je(e){return wt().get(e)||e}function eo(e,t,n=new Set){const o=[];for(const r of le(e)){if(o.length>=t)break;const u=je(r);n.has(u)||(n.add(u),o.push(r))}return o}let Ea=0;function Ne(e){return`${e}-rt-${++Ea}`}function Jt(e){const t=Ko();if(!t||t.total===0){const o=new Set;for(const r of e)o.add(r);return o}const n=new Set;for(const o of e)Gu(o)===!0&&n.add(o);return n}const Nn=new Map;let lr=null,cr=null;function Qt(e){return e==null?"":Array.isArray(e)?e.slice().sort().join(","):e}function sr(e){const t=Qt(e.choseong),n=e.composition,o=n?.syllable==null?"":Array.isArray(n.syllable)?n.syllable.slice().sort().join(","):String(n.syllable),r=n?`${Qt(n.cho)}/${Qt(n.jung)}/${Qt(n.jong)}/${n.jongNone?"N":""}/${o}`:"",u=Qt(e.grade);return`${e.difficulty??""}|${t}|${r}|${e.excludeNoImage?"1":"0"}|${e.count??""}|x${e.contrastCount??1}|${e.fullCount?"F":""}|s${e.sameStructureOnly===!1?"0":"1"}|v${e.phonemeView==="pron"?"p":"c"}|g${u}|t${e.targetSyllable??""}|c${e.choicesPerItem??""}`}async function Pe(e){const t=An(),n=Wt();(t!==lr||n!==cr)&&(Nn.clear(),lr=t,cr=n);const o=sr(e);return Nn.has(o)||Nn.set(o,ka(e)),Nn.get(o)}function ba(e){if(!e)return null;const t=i=>i==null?null:Array.isArray(i)?i.length?i:null:[i],n=t(e.cho),o=t(e.jung),r=!!e.jongNone,u=r?null:t(e.jong);return n||o||u||r?r&&!n&&!o&&!u?i=>Iu(i):i=>Pu(i,{cho:n,jung:o,jong:u,jongNone:r}):null}async function ka(e){const{difficulty:t=null,choseong:n=null,composition:o=null,targetSyllable:r=null,excludeNoImage:u=!1}=e,i=e.grade&&e.grade.length>0?new Set(e.grade):null,l=e.sameStructureOnly??!0,c=e.phonemeView==="pron"?"pron":"char",f=Math.max(1,e.contrastCount??1),h=t==="cho"||t==="jung"||t==="jong",p=h&&f>=2,s=t==="count",y=n?new Set(Array.isArray(n)?n:[n]):null,b=o?.syllable!=null?new Set(Array.isArray(o.syllable)?o.syllable:[o.syllable]):null,w=o?[ba(o),b?S=>b.has(bn(S)):null].filter(S=>S!=null):[],g=t==="random"||t===null,m=g||s,E=g||p||s;let k=Ye.filter(S=>!S.w||i&&(!S.grade||!i.has(S.grade))?!1:E?!0:Array.isArray(S.p)&&S.p.length>0);y&&(k=k.filter(S=>{for(const P of y)if(Ru(S.w,P))return!0;return!1})),w.length>0&&(k=k.filter(S=>{const P=c==="pron"?je(S.w):S.w;return w.every(re=>re(P))})),r&&(k=k.filter(S=>S.w[0]===r));let x;if(u){const S=new Set;for(const P of k)if(S.add(P.w),Array.isArray(P.p))for(const re of P.p)S.add(re);if(m)for(const P of Ye)P.w&&S.add(P.w);x=Jt(S)}else{const S=new Set;for(const P of k)if(S.add(P.w),Array.isArray(P.p))for(const re of P.p)S.add(re);if(m)for(const P of Ye)P.w&&S.add(P.w);x=S}let R=null;if(p){const S=new Set;for(const P of Ye)P.w&&S.add(P.w);R=u?Jt(S):S}const v=k.filter(S=>x.has(S.w)),j=600,H=Array.from(x),U=H.length>j?qe(H,j):H,F=s&&o!=null&&(be(o.cho)||be(o.jung)||be(o.jong)),Q=2500,G=new Map;if(s&&!F&&f>=2){for(const S of H){const P=bn(S),re=G.get(P);re?re.push(S):G.set(P,[S])}for(const[S,P]of G)P.length>Q&&G.set(S,qe(P,Q))}const W=Ou(),z=F?ca(o,H,W,l,c,je):null,D=500,O=1500,me=e.fullCount?v:t==="random"?v.length>D?qe(v,D):v:v.length>O?qe(v,O):v,Z=Wt(),ee=[];for(const S of me){let P;const re=je(S.w);if(p)P=Fu(S.w,t,f,R,24).filter(ue=>je(ue)!==re);else if(s)F?P=(z.get(S.w)??[]).filter(ue=>je(ue)!==re):f<=1?P=or(S.w,Z,{okSet:x,pronOf:je,decompOf:W,sameStructureOnly:!1}):P=(G.get(bn(S.w))??[]).filter(ue=>{if(ue===S.w||je(ue)===re)return!1;const Y=Hu(S.w,ue);return f>=5?Y>=5:Y===f});else if(g)P=U.filter(ue=>ue!==S.w&&ue.length===S.w.length&&je(ue)!==re);else{const ue=t;P=or(S.w,Z,{kind:ue,okSet:x,pronOf:je,decompOf:W,sameStructureOnly:!1}),P.length===0&&(P=(U.length>30?qe(U,30):U).filter(Y=>Y!==S.w&&Lu(S.w,Y)===t&&je(Y)!==re))}if(l&&P.length>0&&(h||s&&!F)){const ue=W(je(S.w));P=P.filter(Y=>!Xn(ue,W(je(Y))))}P.length!==0&&ee.push({word:S,usable:P})}return ee}async function dr(e,t){const{choicesPerItem:n=3,count:o=10}=t,r=n-1,u=(await Pe(t)).filter(l=>l.usable.length>=r),i=[];for(const l of le(u)){if(i.length>=o)break;const c=eo(l.usable,r);if(c.length<r)continue;const f=le([l.word.w,...c]);i.push({id:Ne(e+"-item"),index:i.length+1,word:l.word.w,syllables:l.word.s,choices:f,answerIndex:f.indexOf(l.word.w)})}return i}async function Aa(e){const{choicesPerItem:t=3,count:n=10}=e,o=t-1,r=await Pe({...e,difficulty:null});if(r.length<t)return[];const u=[],i=le([...r]);for(const l of i){if(u.length>=n)break;const c=l.word.w,f=[...l.word.pron||c],h=Sn(f);if(!h)continue;const p=r.filter(b=>b.word.w!==c&&b.word.s===l.word.s&&!(b.word.pron||b.word.w).includes(h)&&b.word.pron!==l.word.pron);if(p.length<o)continue;const s=eo(p.map(b=>b.word.w),o);if(s.length<o)continue;const y=le([c,...s]);u.push({id:Ne("HPI-item"),index:u.length+1,targetSyllable:h,word:c,choices:y,answerIndex:y.indexOf(c)})}return u}async function wa(e){const{count:t=10}=e,n=(await Pe(e)).filter(o=>o.usable.length>=1);return Array.from({length:t},(o,r)=>{const u=Sn(n);if(!u)return null;const i=r%2===0;let l;if(i)l=[u.word.w,u.word.w];else{const c=Sn(u.usable);l=Math.random()<.5?[u.word.w,c]:[c,u.word.w]}return{id:Ne("SOD-item"),index:r+1,word:u.word.w,pair:l,same:i}}).filter(o=>!!o)}async function Sa(e){const{choicesPerItem:t=3,count:n=10}=e,o=t-1,r=await Pe({...e,difficulty:null});if(r.length<t+1)return[];const u=r.map(s=>s.word.w),i=new Map(r.map(s=>[s.word.w,s.word.pron])),l=s=>(i.get(s)||s)[0]??"",c={};for(const s of r){const y=l(s.word.w);y&&(c[y]||(c[y]=[]),c[y].push(s.word.w))}const f=Object.entries(c).filter(([,s])=>s.length>=2).map(([s])=>s);if(f.length===0)return[];const h=[],p=le([...f]);for(let s=0;h.length<n&&s<n*4;s++){const y=p[s%p.length],b=c[y];if(b.length<2)continue;const w=le([...b]),g=w[0],m=w[1];if(!g||!m||g===m||(i.get(g)||g)===(i.get(m)||m))continue;const E=i.get(m)||m,k=u.filter(v=>l(v)!==y&&v!==g&&v!==m&&v.length===m.length&&(i.get(v)||v)!==E);if(k.length<o)continue;const x=eo(k,o);if(x.length<o)continue;const R=le([m,...x]);h.push({id:Ne("SWS-item"),index:h.length+1,sourceWord:g,targetSyllable:y,word:m,choices:R,answerIndex:R.indexOf(m)})}return h}function hr(e,t,n){return qe(e,t).map((o,r)=>{const u=Sn(o.usable)??"",i=[...o.word.w],l=[...u],c=i.findIndex((h,p)=>h!==l[p]),f=le(o.usable.filter(h=>h&&h!==u)).slice(0,2);return{id:Ne(n),index:r+1,word:o.word.w,original:o.word.w,changed:u,changedFrom:c>=0?i[c]:"",changedTo:c>=0?l[c]:"",distractors:f}})}async function pr(e,t,n){const{count:o=10}=t,r=wt(),u=Ye.filter(y=>y.w&&y.s===e),i=t.excludeNoImage?Jt(u.map(y=>y.w)):null,l=i?u.filter(y=>i.has(y.w)):u,c=new Set(l.map(y=>y.w)),f=ma(c),h=t.phonemeView??"char",p=t.composition??null,s=[];for(const y of le(l)){if(s.length>=o)break;const b=ga(y.w,p,r,h,f,null,null);if(!b)continue;const w=b.distractors[0],g=[...y.w],m=[...w],E=g.findIndex((k,x)=>k!==m[x]);s.push({id:Ne(n),index:s.length+1,word:y.w,original:y.w,changed:w,changedFrom:E>=0?g[E]:"",changedTo:E>=0?m[E]:"",distractors:b.distractors.slice(1)})}return s}async function Na(e){return pr(2,e,"CS2-item")}async function Ma(e){return pr(3,e,"CS3-item")}async function Ta(e){const t=(await Pe({...e,difficulty:"count",contrastCount:1})).filter(n=>n.word.s===1&&n.usable.length>=1);return hr(t,e.count??10,"CP1-item")}async function Ba(e){const t=e.difficulty&&e.difficulty!=="random"?e.difficulty:"count",n=(await Pe({...e,difficulty:t,contrastCount:1})).filter(o=>o.word.s===2&&o.usable.length>=1);return hr(n,e.count??10,"CP2-item")}async function Da(e){const{count:t=10}=e,n=(await Pe({...e})).filter(o=>o.word.s===2);return qe(n,t).map((o,r)=>({id:Ne("M2S-item"),index:r+1,word:o.word.w,answer:o.word.w,parts:[...o.word.w]}))}async function xa(e){const{count:t=10}=e,n=(await Pe({...e})).filter(o=>o.word.s===3);return qe(n,t).map((o,r)=>({id:Ne("M3S-item"),index:r+1,word:o.word.w,answer:o.word.w,parts:[...o.word.w]}))}async function va(e){const{count:t=10}=e,n=(await Pe({...e})).filter(l=>l.word.s===2),o=wt(),r=new Set(Ye.map(l=>l.w)),u=e.phonemeView??"char",i=[];for(const l of le(n)){if(i.length>=t)break;const c=ha(l.word.w,e.composition??null,o,u,r);if(!c)continue;const[f,...h]=c.distractors,p=[...l.word.w],s=p[0]===f?p[1]:p[0];i.push({id:Ne("D2-item"),index:i.length+1,original:l.word.w,word:l.word.w,dropped:s,missingResult:f,distractors:h})}return i}async function Oa(e){const{count:t=10}=e,n=(await Pe({...e})).filter(l=>l.word.s===3),o=wt(),r=new Set(Ye.map(l=>l.w)),u=e.phonemeView??"char",i=[];for(const l of le(n)){if(i.length>=t)break;const c=pa(l.word.w,e.composition??null,o,u,r);if(!c)continue;const[f,...h]=c.distractors,p=[...l.word.w];let s="";for(let y=0;y<p.length;y++)if(p.filter((b,w)=>w!==y).join("")===f){s=p[y];break}i.push({id:Ne("D3-item"),index:i.length+1,original:l.word.w,word:l.word.w,dropped:s,missingResult:f,distractors:h})}return i}async function La(e){const{count:t=10}=e,n=(await Pe({...e})).filter(l=>l.word.s>=2),o=wt(),r=new Set(Ye.map(l=>l.w)),u=e.phonemeView??"char",i=[];for(const l of le(n)){if(i.length>=t)break;const c=fa(l.word.w,e.composition??null,o,u,r);if(!c)continue;const[f,...h]=c.distractors,p=l.word.w,s=p.startsWith(f)?p.slice(f.length):p.endsWith(f)?p.slice(0,p.length-f.length):"";i.push({id:Ne("DPC-item"),index:i.length+1,original:p,word:p,dropped:s,missingResult:f,distractors:h})}return i}async function Ra(e){const{count:t=10}=e,n=(await Pe({...e})).map(o=>o.word.w);return n.length<3?[]:Array.from({length:t},(o,r)=>{const u=qe(n,3);return{id:Ne("LRO-item"),index:r+1,sequence:u,choices:le(u)}})}function Mn(e,t,n){const o=Ye.filter(i=>i.w&&i.s===e),r=t?Jt(o.map(i=>i.w)):null,u=[];for(const i of o)if(!(r&&!r.has(i.w))){if(n){const l=se(i.w);if(!l||!n(l))continue}u.push(i)}return u}function Ia(e){const t=Mn(1,e.excludeNoImage??!1,n=>n.jong===0);return qe(t,e.count??10).map((n,o)=>{const r=se(n.w);return{id:Ne("M2P-item"),index:o+1,parts:[Se[r.cho],st[r.jung]],answer:n.w,word:n.w}})}function ja(e){const t=Mn(1,e.excludeNoImage??!1,n=>n.jong>0&&!Yt[n.jong]);return qe(t,e.count??10).map((n,o)=>{const r=se(n.w);return{id:Ne("M3P-item"),index:o+1,parts:[Se[r.cho],st[r.jung],Ve[r.jong]],answer:n.w,word:n.w}})}function Pa(e){const t=tr.DROP_FINAL_CONSONANT_FROM_1SYLL,n=Mn(t.syllables,e.excludeNoImage??!1,t.syllable),o=wt(),r=[];for(const u of le(n)){if(r.length>=(e.count??10))break;const i=Ca(u.w,null,o);if(!i)continue;const[l,...c]=i.distractors;r.push({id:Ne("DFC-item"),index:r.length+1,original:u.w,word:u.w,result:l,distractors:c})}return r}function $a(e){const t=tr.REMOVE_CONSONANT_AND_IDENTIFY_PHONEME,n=Mn(t.syllables,e.excludeNoImage??!1,t.syllable),o=wt(),r=[];for(const u of le(n)){if(r.length>=(e.count??10))break;const i=ya(u.w,null,o);if(!i)continue;const l=se(o.get(u.w)||u.w);if(!l)continue;const[c,...f]=i.distractors;r.push({id:Ne("RCP-item"),index:r.length+1,base:u.w,word:u.w,missingConsonant:Se[l.cho],remaining:c,distractors:f})}return r}const Tn=new Map;let fr=null,Cr=null;async function yr(e,t={}){const n=An(),o=Wt();(n!==fr||o!==Cr)&&(Tn.clear(),fr=n,Cr=o);const r=`${e}:${sr(t)}`;if(Tn.has(r))return Tn.get(r);const u=await Ha(e,t);return Tn.set(r,u),u}const Fa={SAME_SOUND_PICK:e=>dr("SSP",e),HEAR_AND_PICK_SAME:e=>dr("HPS",e),HEAR_AND_PICK_INCLUDED:e=>Aa(e),SAME_OR_DIFF:e=>wa(e),STARTS_WITH_SAME_SOUND:e=>Sa(e),LISTEN_AND_REMEMBER_ORDER:e=>Ra(e),MERGE_2_SYLLABLES:e=>Da(e),MERGE_3_SYLLABLES:e=>xa(e),MERGE_2_PHONEMES:e=>Ia(e),MERGE_3_PHONEMES:e=>ja(e),DROP_1_FROM_2SYLL:e=>va(e),DROP_1_FROM_3SYLL:e=>Oa(e),DROP_PART_FROM_COMPOUND:e=>La(e),DROP_FINAL_CONSONANT_FROM_1SYLL:e=>Pa(e),REMOVE_CONSONANT_AND_IDENTIFY_PHONEME:e=>$a(e),CHANGE_1_SYLL_IN_2SYLL:e=>Na(e),CHANGE_1_SYLL_IN_3SYLL:e=>Ma(e),CHANGE_1_PHONEME_IN_1SYLL:e=>Ta(e),CHANGE_1_PHONEME_IN_2SYLL:e=>Ba(e)};async function Ha(e,t={}){const n=Fa[e];return n?await n(t):[]}async function za(e){const t=[null,"count"],n=Object.keys(Wn);let o=0;for(const r of t)for(const u of n){const i=Wn[u];yr(u,{difficulty:i.difficulty?r:null,choseong:null,count:10,excludeNoImage:e}).catch(()=>{}),++o%6===0&&await new Promise(l=>setTimeout(l,0))}}async function Va(e){return(await Pe({...e,fullCount:!0})).length}async function Ua(e={}){const t=[];for(const l of Ye)l.w&&t.push(l.w);const n=e.excludeNoImage?Jt(t):t,o=new Set,r=new Set,u=new Set,i=new Set;for(const l of n){i.add(bn(l));for(const c of l){const f=se(c);if(f&&(Se[f.cho]!=="\u3147"&&o.add(Se[f.cho]),r.add(st[f.jung]),f.jong>0)){u.add(Ve[f.jong]);const h=Yt[f.jong];h&&h.forEach(p=>u.add(p))}}}return{cho:o,jung:r,jong:u,syllable:i}}const St="\uC804\uCCB4";function Ga(...e){return e.filter(Boolean).join(" ")}/**
|
|
2
2
|
* @license lucide-react v1.38.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -28,7 +28,7 @@ import{useState as B,useEffect as X,createContext as Gn,useContext as Yn,useRef
|
|
|
28
28
|
*
|
|
29
29
|
* This source code is licensed under the ISC license.
|
|
30
30
|
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
-
*/const Wa=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},Ka=Gn({}),Xa=()=>Yn(Ka),Za=Po(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:o,className:r="",children:u,iconNode:i,...l},
|
|
31
|
+
*/const Wa=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},Ka=Gn({}),Xa=()=>Yn(Ka),Za=Po(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:o,className:r="",children:u,iconNode:i,...l},c)=>{const{size:f=24,strokeWidth:h=2,absoluteStrokeWidth:p=!1,color:s="currentColor",className:y=""}=Xa()??{},b=o??p?Number(n??h)*24/Number(t??f):n??h;return Ut("svg",{ref:c,...to,width:t??f??to.width,height:t??f??to.height,stroke:e??s,strokeWidth:b,className:mr("lucide",y,r),...!u&&!Wa(l)&&{"aria-hidden":"true"},...l},[...i.map(([w,g])=>Ut(w,g)),...Array.isArray(u)?u:[u]])});/**
|
|
32
32
|
* @license lucide-react v1.38.0 - ISC
|
|
33
33
|
*
|
|
34
34
|
* This source code is licensed under the ISC license.
|
|
@@ -778,6 +778,6 @@ import{useState as B,useEffect as X,createContext as Gn,useContext as Yn,useRef
|
|
|
778
778
|
*
|
|
779
779
|
* This source code is licensed under the ISC license.
|
|
780
780
|
* See the LICENSE file in the root directory of this source tree.
|
|
781
|
-
*/const b0=[["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}],["path",{d:"M7 10v12",key:"1qc93n"}]],k0=C("thumbs-up",b0),kr={"alert-triangle":_r,"align-start-vertical":ei,anchor:L1,"arrow-down":ni,"arrow-left":ri,"arrow-right":ai,"arrow-right-left":li,"arrow-up-a-z":I1,"audio-lines":si,baby:hi,ban:fi,"bar-chart-2":P1,bell:yi,"book-marked":gi,"book-open":Ei,"bow-arrow":ki,braces:wi,bug:Ni,calendar:F1,"calendar-check":Ti,"calendar-days":Di,camera:vi,car:z1,"chart-column":Li,"chart-line":Ii,"chart-pie":Pi,check:Fi,"chevron-down":s0,"chevron-left":zi,"chevron-right":Ui,"chevron-up":h0,circle:f0,"clipboard-list":Yi,coffee:U1,combine:Wi,copy:Xi,"credit-card":Ji,database:el,diff:nl,download:rl,ear:al,edit:ll,"edit-2":sl,"edit-3":hl,ellipsis:Er,eraser:Cl,"external-link":ml,eye:_l,"file-text":bl,"flip-horizontal":Al,"folder-open":Sl,"folder-plus":Ml,gamepad:Bl,"gamepad-2":Y1,gavel:xl,"git-merge":Ol,globe:Rl,headphones:jl,heart:$l,home:Hl,inbox:W1,info:Vl,"key-round":Gl,landmark:ql,layers:Kl,"layout-dashboard":Zl,leaf:Ql,lightbulb:tc,link:oc,"link-2":uc,"link-2-off":ic,list:cc,"list-checks":dc,"list-ordered":pc,"list-tree":X1,loader:Cc,"log-out":mc,mail:_c,"map-pin":bc,menu:g0,"message-circle":Ac,"message-circle-question-mark":Sc,"message-square":Mc,"message-square-more":J1,"message-square-text":Bc,minus:e0,"minus-circle":xc,moon:E0,"more-horizontal":Er,package:Oc,palette:Rc,"party-popper":jc,pause:$c,pencil:Hc,phone:Vc,play:Gc,"play-circle":qc,plus:Kc,printer:Zc,"refresh-cw":Qc,repeat:ts,replace:os,rocket:us,"rotate-ccw":is,"rotate-cw":cs,salad:ds,"scan-search":ps,search:gs,"circle-alert":br,"alert-circle":br,"check-circle":ys,scissors:Es,"search-x":ks,send:ws,settings:Ns,"share-2":n0,"shield-check":Ts,"shopping-cart":Ds,shuffle:vs,"skip-back":Ls,"skip-forward":Is,sparkles:r0,square:Ps,star:Fs,store:zs,"sun-medium":Us,table:Ys,"table-2":Ws,terminal:Xs,"text-cursor-input":Js,"text-initial":e1,"thumbs-up":k0,ticket:n1,triangle:y0,"trash-2":r1,"trending-up":a1,"triangle-alert":_r,trophy:l1,type:a0,unlink:s1,upload:h1,user:f1,"user-plus":y1,"user-round":g1,"user-round-check":E1,users:k1,"users-round":w1,volume:l0,"volume-2":N1,wrench:T1,x:D1,zap:v1};function A0(e){return kr[e]??null}const Ar=new Set,w0=(()=>{try{if(import.meta.env?.DEV)return!0}catch{}try{const e=globalThis;return e.process!=null&&e.process.env?.NODE_ENV!=="production"}catch{return!1}})();function S0(e){return w0&&!(e in kr)&&!Ar.has(e)&&(Ar.add(e),console.warn(`[ihabdevteam-core] lucide \uC544\uC774\uCF58 '${e}' \uC774 \uC815\uC801 \uBAA9\uB85D\uC5D0 \uC5C6\uC5B4 \uB80C\uB354\uB418\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4. utils/lucideIconSet.ts \uC758 STATIC_LUCIDE_ICONS \uC5D0 \uCD94\uAC00\uD558\uC138\uC694.`)),Promise.resolve(null)}const N0=e=>e.replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Za-z])([0-9])/g,"$1-$2").replace(/[_ ]+/g,"-").toLowerCase();function M0(e){const t=e.toLowerCase();if(t.startsWith("http://")||t.startsWith("https://")||t.startsWith("data:")||e.includes("/assets/"))return null;const n=(e.split("/").pop()||"").replace(/\.svg$/,"");return n?N0(n):null}const wr=new Map;function T0(e){const t=typeof e=="string"?M0(e):null,n=t?A0(t)??wr.get(t)??null:null,[o,r]=B(null);return X(()=>{if(!t||n)return;let u=!1;return S0(t).then(i=>{wr.set(t,i),u||r(i)}),()=>{u=!0}},[t,n]),n??o}/*! @license DOMPurify 3.4.14 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.14/LICENSE */function Sr(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n<t;n++)o[n]=e[n];return o}function B0(e){if(Array.isArray(e))return e}function D0(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var o,r,u,i,l=[],
|
|
782
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function v0(e,t){return B0(e)||D0(e,t)||O0(e,t)||x0()}function O0(e,t){if(e){if(typeof e=="string")return Sr(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Sr(e,t):void 0}}const Nr=Object.entries,Mr=Object.setPrototypeOf,L0=Object.isFrozen,R0=Object.getPrototypeOf,I0=Object.getOwnPropertyDescriptor;let ye=Object.freeze,Ee=Object.seal,jt=Object.create,Tr=typeof Reflect<"u"&&Reflect,no=Tr.apply,oo=Tr.construct;ye||(ye=function(t){return t}),Ee||(Ee=function(t){return t}),no||(no=function(t,n){for(var o=arguments.length,r=new Array(o>2?o-2:0),u=2;u<o;u++)r[u-2]=arguments[u];return t.apply(n,r)}),oo||(oo=function(t){for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];return new t(...o)});const Nt=pe(Array.prototype.forEach),j0=pe(Array.prototype.lastIndexOf),Br=pe(Array.prototype.pop),en=pe(Array.prototype.push),P0=pe(Array.prototype.splice),Pt=Array.isArray,tn=pe(String.prototype.toLowerCase),ro=pe(String.prototype.toString),Dr=pe(String.prototype.match),nn=pe(String.prototype.replace),xr=pe(String.prototype.indexOf),$0=pe(String.prototype.trim),F0=pe(Number.prototype.toString),H0=pe(Boolean.prototype.toString),vr=typeof BigInt>"u"?null:pe(BigInt.prototype.toString),Or=typeof Symbol>"u"?null:pe(Symbol.prototype.toString),Le=pe(Object.prototype.hasOwnProperty),on=pe(Object.prototype.toString),Me=pe(RegExp.prototype.test),Mt=z0(TypeError);function pe(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];return no(e,t,o)}}function z0(e){return function(){for(var t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];return oo(e,n)}}function J(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:tn;if(Mr&&Mr(e,null),!Pt(t))return e;let o=t.length;for(;o--;){let r=t[o];if(typeof r=="string"){const u=n(r);u!==r&&(L0(t)||(t[o]=u),r=u)}e[r]=!0}return e}function V0(e){for(let t=0;t<e.length;t++)Le(e,t)||(e[t]=null);return e}function $e(e){const t=jt(null);for(const o of Nr(e)){var n=v0(o,2);const r=n[0],u=n[1];Le(e,r)&&(Pt(u)?t[r]=V0(u):u&&typeof u=="object"&&u.constructor===Object?t[r]=$e(u):t[r]=u)}return t}function U0(e){switch(typeof e){case"string":return e;case"number":return F0(e);case"boolean":return H0(e);case"bigint":return vr?vr(e):"0";case"symbol":return Or?Or(e):"Symbol()";case"undefined":return on(e);case"function":case"object":{if(e===null)return on(e);const t=e,n=We(t,"toString");if(typeof n=="function"){const o=n(t);return typeof o=="string"?o:on(o)}return on(e)}default:return on(e)}}function We(e,t){for(;e!==null;){const o=I0(e,t);if(o){if(o.get)return pe(o.get);if(typeof o.value=="function")return pe(o.value)}e=R0(e)}function n(){return null}return n}function G0(e){try{return Me(e,""),!0}catch{return!1}}const Lr=ye(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),uo=ye(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),ao=ye(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Y0=ye(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),io=ye(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),q0=ye(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Rr=ye(["#text"]),Ir=ye(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),lo=ye(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","pointer-events","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","vector-effect","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),jr=ye(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Bn=ye(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),W0=Ee(/{{[\w\W]*|^[\w\W]*}}/g),K0=Ee(/<%[\w\W]*|^[\w\W]*%>/g),X0=Ee(/\${[\w\W]*/g),Z0=Ee(/^data-[\-\w.\u00B7-\uFFFF]+$/),J0=Ee(/^aria-[\-\w]+$/),Pr=Ee(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Q0=Ee(/^(?:\w+script|data):/i),ed=Ee(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),td=Ee(/^html$/i),nd=Ee(/^[a-z][.\w]*(-[.\w]+)+$/i),$r=Ee(/<[/\w!]/g),Fr=Ee(/<[/\w]/g),od=Ee(/<\/no(script|embed|frames)/i),rd=Ee(/\/>/i),Fe={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Hr=["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"],ud=ye(J({},Hr)),ad=(function(){const e={};return Nt(Hr,t=>{e[t]=Ee(new RegExp("</"+t+"(?=[\\t\\n\\f\\r />])","i"))}),ye(e)})(),id=function(){return typeof window>"u"?null:window},ld=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let o=null;const r="data-tt-policy-suffix";n&&n.hasAttribute(r)&&(o=n.getAttribute(r));const u="dompurify"+(o?"#"+o:"");try{return t.createPolicy(u,{createHTML(i){return i},createScriptURL(i){return i}})}catch{return console.warn("TrustedTypes policy "+u+" could not be created."),null}},zr=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},gt=function(t,n,o,r){return Le(t,n)&&Pt(t[n])?J(r.base?$e(r.base):{},t[n],r.transform):o},co=function(t,n,o){const r=Le(t,n)?t[n]:void 0;return r&&typeof r=="object"?$e(r):o()};function Vr(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:id();const t=N=>Vr(N);if(t.version="3.4.14",t.removed=[],!e||!e.document||e.document.nodeType!==Fe.document||!e.Element)return t.isSupported=!1,t;let n=e.document;const o=n,r=o.currentScript;e.DocumentFragment;const u=e.HTMLTemplateElement,i=e.Node,l=e.Element,s=e.NodeFilter,p=e.NamedNodeMap;p===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;const h=e.DOMParser,f=e.trustedTypes,c=l.prototype,y=We(c,"cloneNode"),b=We(c,"remove"),w=We(c,"nextSibling"),g=We(c,"childNodes"),m=We(c,"parentNode"),E=We(c,"shadowRoot"),k=We(c,"attributes"),x=i&&i.prototype?We(i.prototype,"nodeType"):null,R=i&&i.prototype?We(i.prototype,"nodeName"):null,v=i&&i.prototype?We(i.prototype,"ownerDocument"):null,j=function(a){return x?x(a):a.nodeType},H=function(a){return R?R(a):a.nodeName};if(typeof u=="function"){const N=n.createElement("template");N.content&&N.content.ownerDocument&&(n=N.content.ownerDocument)}let U,F="",Q,G=!1,W=0;const z=function(){if(W>0)throw Mt('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},D=function(a){z(),W++;try{return U.createHTML(a)}finally{W--}},O=function(a){z(),W++;try{return U.createScriptURL(a)}finally{W--}},me=function(){return G||(Q=ld(f,r),G=!0),Q},Z=n,ee=Z.implementation,S=Z.createNodeIterator,P=Z.createDocumentFragment,re=Z.getElementsByTagName,ue=o.importNode;let Y=zr();t.isSupported=typeof Nr=="function"&&typeof m=="function"&&ee&&ee.createHTMLDocument!==void 0;const Ae=W0,M=K0,fe=X0,Ce=Z0,He=J0,ft=Q0,Ke=ed,rt=nd;let Ue=Pr,te=null;const ut=J({},[...Lr,...uo,...ao,...io,...Rr]);let ae=null;const A=J({},[...Ir,...lo,...jr,...Bn]);let L=Object.seal(jt(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),$=null,K=null;const ne=Object.seal(jt(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let De=!0,Te=!0,Xe=!1,Ge=!0,ge=!1,ze=!0,Re=!1,Ct=!1,Ze=null,at=null,it=!1,lt=!1,Tt=!1,Et=!1,Ft=!0,_e=!1;const Bt="user-content-";let Dt=!0,ct=!1,yt={},Je=null;const ie=J({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let Qe=null;const Ht=J({},["audio","video","img","source","image","track"]);let xt=null;const ko=J({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),pn="http://www.w3.org/1998/Math/MathML",fn="http://www.w3.org/2000/svg",et="http://www.w3.org/1999/xhtml";let vt=et,jn=!1,Pn=null;const su=J({},[pn,fn,et],ro),Ao=ye(["mi","mo","mn","ms","mtext"]);let $n=J({},Ao);const wo=ye(["annotation-xml"]);let Fn=J({},wo);const du=J({},["title","style","font","a","script"]);let zt=null;const hu=["application/xhtml+xml","text/html"],pu="text/html";let he=null,Ot=null;const fu=n.createElement("form"),So=function(a){return a instanceof RegExp||a instanceof Function},Hn=function(){let a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Ot&&Ot===a)return;(!a||typeof a!="object")&&(a={}),a=$e(a),zt=hu.indexOf(a.PARSER_MEDIA_TYPE)===-1?pu:a.PARSER_MEDIA_TYPE,he=zt==="application/xhtml+xml"?ro:tn,te=gt(a,"ALLOWED_TAGS",ut,{transform:he}),ae=gt(a,"ALLOWED_ATTR",A,{transform:he}),Pn=gt(a,"ALLOWED_NAMESPACES",su,{transform:ro}),xt=gt(a,"ADD_URI_SAFE_ATTR",ko,{transform:he,base:ko}),Qe=gt(a,"ADD_DATA_URI_TAGS",Ht,{transform:he,base:Ht}),Je=gt(a,"FORBID_CONTENTS",ie,{transform:he}),$=gt(a,"FORBID_TAGS",$e({}),{transform:he}),K=gt(a,"FORBID_ATTR",$e({}),{transform:he}),yt=Le(a,"USE_PROFILES")?a.USE_PROFILES&&typeof a.USE_PROFILES=="object"?$e(a.USE_PROFILES):a.USE_PROFILES:!1,De=a.ALLOW_ARIA_ATTR!==!1,Te=a.ALLOW_DATA_ATTR!==!1,Xe=a.ALLOW_UNKNOWN_PROTOCOLS||!1,Ge=a.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ge=a.SAFE_FOR_TEMPLATES||!1,ze=a.SAFE_FOR_XML!==!1,Re=a.WHOLE_DOCUMENT||!1,lt=a.RETURN_DOM||!1,Tt=a.RETURN_DOM_FRAGMENT||!1,Et=a.RETURN_TRUSTED_TYPE||!1,it=a.FORCE_BODY||!1,Ft=a.SANITIZE_DOM!==!1,_e=a.SANITIZE_NAMED_PROPS||!1,Dt=a.KEEP_CONTENT!==!1,ct=a.IN_PLACE||!1,Ue=G0(a.ALLOWED_URI_REGEXP)?a.ALLOWED_URI_REGEXP:Pr,vt=typeof a.NAMESPACE=="string"?a.NAMESPACE:et,$n=co(a,"MATHML_TEXT_INTEGRATION_POINTS",()=>J({},Ao)),Fn=co(a,"HTML_INTEGRATION_POINTS",()=>J({},wo));const d=co(a,"CUSTOM_ELEMENT_HANDLING",()=>jt(null));if(L=jt(null),Le(d,"tagNameCheck")&&So(d.tagNameCheck)&&(L.tagNameCheck=d.tagNameCheck),Le(d,"attributeNameCheck")&&So(d.attributeNameCheck)&&(L.attributeNameCheck=d.attributeNameCheck),Le(d,"allowCustomizedBuiltInElements")&&typeof d.allowCustomizedBuiltInElements=="boolean"&&(L.allowCustomizedBuiltInElements=d.allowCustomizedBuiltInElements),Ee(L),ge&&(Te=!1),Tt&&(lt=!0),yt&&(te=J({},Rr),ae=jt(null),yt.html===!0&&(J(te,Lr),J(ae,Ir)),yt.svg===!0&&(J(te,uo),J(ae,lo),J(ae,Bn)),yt.svgFilters===!0&&(J(te,ao),J(ae,lo),J(ae,Bn)),yt.mathMl===!0&&(J(te,io),J(ae,jr),J(ae,Bn))),ne.tagCheck=null,ne.attributeCheck=null,Le(a,"ADD_TAGS")&&(typeof a.ADD_TAGS=="function"?ne.tagCheck=a.ADD_TAGS:Pt(a.ADD_TAGS)&&(te===ut&&(te=$e(te)),J(te,a.ADD_TAGS,he))),Le(a,"ADD_ATTR")&&(typeof a.ADD_ATTR=="function"?ne.attributeCheck=a.ADD_ATTR:Pt(a.ADD_ATTR)&&(ae===A&&(ae=$e(ae)),J(ae,a.ADD_ATTR,he))),Le(a,"ADD_FORBID_CONTENTS")&&Pt(a.ADD_FORBID_CONTENTS)&&(Je===ie&&(Je=$e(Je)),J(Je,a.ADD_FORBID_CONTENTS,he)),Dt&&(te["#text"]=!0),Re&&J(te,["html","head","body"]),te.table&&(J(te,["tbody"]),delete $.tbody),a.TRUSTED_TYPES_POLICY){if(typeof a.TRUSTED_TYPES_POLICY.createHTML!="function")throw Mt('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof a.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Mt('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const _=U;U=a.TRUSTED_TYPES_POLICY;try{F=D("")}catch(T){throw U=_,T}}else a.TRUSTED_TYPES_POLICY===null?(U=void 0,F=""):(U===void 0&&(U=me()),U&&typeof F=="string"&&(F=D("")));ye&&ye(a),Ot=a},No=J({},[...uo,...ao,...Y0]),Mo=J({},[...io,...q0]),Cu=function(a,d,_){return d.namespaceURI===et?a==="svg":d.namespaceURI===pn?a==="svg"&&(_==="annotation-xml"||$n[_]):!!No[a]},yu=function(a,d,_){return d.namespaceURI===et?a==="math":d.namespaceURI===fn?a==="math"&&Fn[_]:!!Mo[a]},mu=function(a,d,_){return d.namespaceURI===fn&&!Fn[_]||d.namespaceURI===pn&&!$n[_]?!1:!Mo[a]&&(du[a]||!No[a])},gu=function(a){let d=m(a);(!d||!d.tagName)&&(d={namespaceURI:vt,tagName:"template"});const _=tn(a.tagName),T=tn(d.tagName);return Pn[a.namespaceURI]?a.namespaceURI===fn?Cu(_,d,T):a.namespaceURI===pn?yu(_,d,T):a.namespaceURI===et?mu(_,d,T):!!(zt==="application/xhtml+xml"&&Pn[a.namespaceURI]):!1},mt=function(a){en(t.removed,{element:a});try{m(a).removeChild(a)}catch{if(b(a),!m(a))throw Mt("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},To=function(a,d,_){try{a.removeAttributeNode(d)}catch{try{a.removeAttribute(_)}catch{}}},Cn=function(a){yn(a);const d=g(a);if(d){const T=[];Nt(d,I=>{en(T,I)}),Nt(T,I=>{try{b(I)}catch{}})}const _=k(a);if(_)for(let T=_.length-1;T>=0;--T){const I=_[T],V=I&&I.name;typeof V=="string"&&To(a,I,V)}},bt=function(a,d,_){if(!_)try{_=d.getAttributeNode(a)}catch{_=null}en(t.removed,{attribute:_||null,from:d});try{_?d.removeAttributeNode(_):d.removeAttribute(a)}catch{try{d.removeAttribute(a)}catch{}}if(a==="is")if(lt||Tt)try{mt(d)}catch{}else try{d.setAttribute(a,"")}catch{}},_u=function(a){const d=k(a);if(d)for(let _=d.length-1;_>=0;--_){const T=d[_],I=T&&T.name;typeof I!="string"||ae[he(I)]||To(a,T,I)}},yn=function(a){const d=[a];for(;d.length>0;){const _=d.pop();j(_)===Fe.element&&_u(_);const I=g(_);if(I)for(let V=I.length-1;V>=0;--V)d.push(I[V])}},Bo=function(a,d){return ze?a==="patchsrc"?!0:a==="for"&&d!=="label"&&d!=="output":!1},Eu=function(a){if(!ze)return;const d=[a];for(;d.length>0;){const _=d.pop(),T=j(_);if(T===Fe.processingInstruction||T===Fe.comment&&Me(Fr,_.data)){try{b(_)}catch{}continue}if(T===Fe.element){const V=_,ce=he(H(_));try{V.hasAttribute&&V.hasAttribute("patchsrc")&&V.removeAttribute("patchsrc"),V.hasAttribute&&V.hasAttribute("for")&&Bo("for",ce)&&V.removeAttribute("for")}catch{}}const I=g(_);if(I)for(let V=I.length-1;V>=0;--V)d.push(I[V])}},Do=function(a){let d=null,_=null;if(it)a="<remove></remove>"+a;else{const V=Dr(a,/^[\r\n\t ]+/);_=V&&V[0]}zt==="application/xhtml+xml"&&vt===et&&(a='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+a+"</body></html>");const T=U?D(a):a;if(vt===et)try{d=new h().parseFromString(T,zt)}catch{}if(!d||!d.documentElement){d=ee.createDocument(vt,"template",null);try{d.documentElement.innerHTML=jn?F:T}catch{}}const I=d.body||d.documentElement;return a&&_&&I.insertBefore(n.createTextNode(_),I.childNodes[0]||null),vt===et?re.call(d,Re?"html":"body")[0]:Re?d.documentElement:I},xo=function(a){const d=v?v(a):a.ownerDocument;return S.call(d||a,a,s.SHOW_ELEMENT|s.SHOW_COMMENT|s.SHOW_TEXT|s.SHOW_PROCESSING_INSTRUCTION|s.SHOW_CDATA_SECTION,null)},mn=function(a){return a=nn(a,Ae," "),a=nn(a,M," "),a=nn(a,fe," "),a},zn=function(a){var d;a.normalize();const _=v?v(a):a.ownerDocument,T=S.call(_||a,a,s.SHOW_TEXT|s.SHOW_COMMENT|s.SHOW_CDATA_SECTION|s.SHOW_PROCESSING_INSTRUCTION,null);let I=T.nextNode();for(;I;)I.data=mn(I.data),I=T.nextNode();const V=(d=a.querySelectorAll)===null||d===void 0?void 0:d.call(a,"template");V&&Nt(V,ce=>{Lt(ce.content)&&zn(ce.content)})},gn=function(a){const d=R?R(a):null;return typeof d!="string"||he(d)!=="form"?!1:typeof a.nodeName!="string"||typeof a.textContent!="string"||typeof a.removeChild!="function"||a.attributes!==k(a)||typeof a.removeAttribute!="function"||typeof a.setAttribute!="function"||typeof a.namespaceURI!="string"||typeof a.insertBefore!="function"||typeof a.hasChildNodes!="function"||a.nodeType!==x(a)||a.childNodes!==g(a)},Lt=function(a){if(!x||typeof a!="object"||a===null)return!1;try{return x(a)===Fe.documentFragment}catch{return!1}},Vt=function(a){if(!x||typeof a!="object"||a===null)return!1;try{return typeof x(a)=="number"}catch{return!1}};function tt(N,a,d){N.length!==0&&Nt(N,_=>{_.call(t,a,d,Ot)})}const bu=function(a,d){return!!(ze&&a.hasChildNodes()&&!Vt(a.firstElementChild)&&Me($r,a.textContent)&&Me($r,a.innerHTML)||ze&&a.namespaceURI===et&&ud[d]&&(Vt(a.firstElementChild)||typeof a.textContent=="string"&&Me(ad[d],a.textContent))||a.nodeType===Fe.processingInstruction||ze&&a.nodeType===Fe.comment&&Me(Fr,a.data))},_n=function(a,d){if(a instanceof RegExp)return Me(a,d);if(a instanceof Function){for(var _=arguments.length,T=new Array(_>2?_-2:0),I=2;I<_;I++)T[I-2]=arguments[I];return!!a(d,...T)}return!1},ku=function(a,d,_){if(!$[d]&&Io(d)&&_n(L.tagNameCheck,d))return!1;if(Dt&&!Je[d]){const T=m(a),I=g(a);if(I&&T){const V=I.length;for(let ce=V-1;ce>=0;--ce){const de=a===_?y(I[ce],!0):I[ce];T.insertBefore(de,w(a))}}}return mt(a),!0},vo=function(a,d,_,T){return a.length===0?d:d===_||d===T?$e(d):d},Oo=function(a,d){return a===d||m(a)!==null?!1:(ct&&yn(a),!0)},Lo=function(a,d){if(tt(Y.beforeSanitizeElements,a,null),Oo(a,d))return!0;if(gn(a))return mt(a),!0;const _=he(H(a));if(te=vo(Y.uponSanitizeElement,te,ut,Ze),tt(Y.uponSanitizeElement,a,{tagName:_,allowedTags:te}),Oo(a,d))return!0;if(bu(a,_))return mt(a),!0;if($[_]||!(ne.tagCheck instanceof Function&&ne.tagCheck(_))&&!te[_]){const I=ku(a,_,d);return I===!1&&tt(Y.afterSanitizeElements,a,null),I}if(j(a)===Fe.element&&!gu(a)||(_==="noscript"||_==="noembed"||_==="noframes")&&Me(od,a.innerHTML))return mt(a),!0;if(ge&&a.nodeType===Fe.text){const I=mn(a.textContent);a.textContent!==I&&(en(t.removed,{element:a.cloneNode()}),a.textContent=I)}return tt(Y.afterSanitizeElements,a,null),!1},Ro=function(a,d,_){if(K[d]||Bo(d,a)||Ft&&(d==="id"||d==="name")&&(_ in n||_ in fu))return!1;const T=ae[d]||ne.attributeCheck instanceof Function&&ne.attributeCheck(d,a);return Te&&Me(Ce,d)||De&&Me(He,d)?!0:T?xt[d]||Me(Ue,nn(_,Ke,""))||(d==="src"||d==="xlink:href"||d==="href")&&a!=="script"&&xr(_,"data:")===0&&Qe[a]||Xe&&!Me(ft,nn(_,Ke,""))?!0:!_:Io(a)&&_n(L.tagNameCheck,a)&&_n(L.attributeNameCheck,d,a)||d==="is"&&L.allowCustomizedBuiltInElements&&_n(L.tagNameCheck,_)},Au=J({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Io=function(a){return!Au[tn(a)]&&Me(rt,a)},wu=function(a,d,_,T){if(U&&typeof f=="object"&&typeof f.getAttributeType=="function"&&!_)switch(f.getAttributeType(a,d)){case"TrustedHTML":return D(T);case"TrustedScriptURL":return O(T)}return T},Su=function(a,d,_,T){try{_?a.setAttributeNS(_,d,T):a.setAttribute(d,T),gn(a)?mt(a):Br(t.removed)}catch{bt(d,a)}},jo=function(a){tt(Y.beforeSanitizeAttributes,a,null);const d=a.attributes;if(!d||gn(a))return;ae=vo(Y.uponSanitizeAttribute,ae,A,at);const _={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ae,forceKeepAttr:void 0};let T=d.length;const I=he(a.nodeName);for(;T--;){const V=d[T],ce=V.name,de=V.namespaceURI,xe=V.value,ve=he(ce),Un=xe;let Be=ce==="value"?Un:$0(Un);if(_.attrName=ve,_.attrValue=Be,_.keepAttr=!0,_.forceKeepAttr=void 0,tt(Y.uponSanitizeAttribute,a,_),Be=_.attrValue,_e&&(ve==="id"||ve==="name")&&xr(Be,Bt)!==0&&(bt(ce,a,V),Be=Bt+Be),ze&&Me(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Be)){bt(ce,a,V);continue}if(ve==="attributename"&&Dr(Be,"href")){bt(ce,a,V);continue}if(!_.forceKeepAttr){if(!_.keepAttr){bt(ce,a,V);continue}if(!Ge&&Me(rd,Be)){bt(ce,a,V);continue}if(ge&&(Be=mn(Be)),!Ro(I,ve,Be)){bt(ce,a,V);continue}Be=wu(I,ve,de,Be),Be!==Un&&Su(a,ce,de,Be)}}tt(Y.afterSanitizeAttributes,a,null)},En=function(a){let d=null;const _=xo(a);for(tt(Y.beforeSanitizeShadowDOM,a,null);d=_.nextNode();)if(tt(Y.uponSanitizeShadowNode,d,null),Lo(d,a),jo(d),Lt(d.content)&&En(d.content),j(d)===Fe.element){const T=E(d);Lt(T)&&(Vn(T),En(T))}tt(Y.afterSanitizeShadowDOM,a,null)},Vn=function(a){const d=[{node:a,shadow:null}];for(;d.length>0;){const _=d.pop();if(_.shadow){En(_.shadow);continue}const T=_.node,V=j(T)===Fe.element,ce=g(T);if(ce)for(let de=ce.length-1;de>=0;--de)d.push({node:ce[de],shadow:null});if(V){const de=R?R(T):null;if(typeof de=="string"&&he(de)==="template"){const xe=T.content;Lt(xe)&&d.push({node:xe,shadow:null})}}if(V){const de=E(T);Lt(de)&&d.push({node:null,shadow:de},{node:de,shadow:null})}}};return t.sanitize=function(N){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},d=null,_=null,T=null,I=null;if(jn=!N,jn&&(N="<!-->"),typeof N!="string"&&!Vt(N)&&(N=U0(N),typeof N!="string"))throw Mt("dirty is not a string, aborting");if(!t.isSupported)return N;Ct?(te=Ze,ae=at):Hn(a),(Y.uponSanitizeElement.length>0||Y.uponSanitizeAttribute.length>0)&&(te=$e(te)),Y.uponSanitizeAttribute.length>0&&(ae=$e(ae)),t.removed=[];const V=ct&&typeof N!="string"&&Vt(N);if(V){Eu(N);const xe=H(N);if(typeof xe=="string"){const ve=he(xe);if(!te[ve]||$[ve])throw Cn(N),Mt("root node is forbidden and cannot be sanitized in-place")}if(gn(N))throw Cn(N),Mt("root node is clobbered and cannot be sanitized in-place");try{Vn(N)}catch(ve){throw Cn(N),ve}}else if(Vt(N))d=Do("<!---->"),_=d.ownerDocument.importNode(N,!0),_.nodeType===Fe.element&&_.nodeName==="BODY"||_.nodeName==="HTML"?d=_:d.appendChild(_),Vn(_);else{if(!lt&&!ge&&!Re&&N.indexOf("<")===-1)return U&&Et?D(N):N;if(d=Do(N),!d)return lt?null:Et?F:""}d&&it&&mt(d.firstChild);const ce=V?N:d;try{const xe=xo(ce);for(;T=xe.nextNode();)Lo(T,ce),jo(T),Lt(T.content)&&En(T.content)}catch(xe){throw V&&(Cn(N),Nt(t.removed,ve=>{ve.element&&yn(ve.element)})),xe}if(V)return Nt(t.removed,xe=>{xe.element&&yn(xe.element)}),ge&&zn(N),N;if(lt){if(ge&&zn(d),Tt)for(I=P.call(d.ownerDocument);d.firstChild;)I.appendChild(d.firstChild);else I=d;return(ae.shadowroot||ae.shadowrootmode)&&(I=ue.call(o,I,!0)),I}let de=Re?d.outerHTML:d.innerHTML;return Re&&te["!doctype"]&&d.ownerDocument&&d.ownerDocument.doctype&&d.ownerDocument.doctype.name&&Me(td,d.ownerDocument.doctype.name)&&(de="<!DOCTYPE "+d.ownerDocument.doctype.name+`>
|
|
783
|
-
`+de),ge&&(de=mn(de)),U&&Et?D(de):de},t.setConfig=function(){let N=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Hn(N),Ct=!0,Ze=te,at=ae},t.clearConfig=function(){Ot=null,Ct=!1,Ze=null,at=null,U=Q,F=""},t.isValidAttribute=function(N,a,d){Ot||Hn({});const _=he(N),T=he(a);return Ro(_,T,d)},t.addHook=function(N,a){typeof a=="function"&&Le(Y,N)&&en(Y[N],a)},t.removeHook=function(N,a){if(Le(Y,N)){if(a!==void 0){const d=j0(Y[N],a);return d===-1?void 0:P0(Y[N],d,1)[0]}return Br(Y[N])}},t.removeHooks=function(N){Le(Y,N)&&(Y[N]=[])},t.removeAllHooks=function(){Y=zr()},t}var cd=Vr();const sd=/^(?:[a-z]+:)?\/\//i;let dd="";function hd(){return dd}function so(e){const t=String(e||"").trim();if(!t)return"";if(sd.test(t)||t.startsWith("data:")||t.startsWith("blob:"))return t;const n=t.startsWith("/")?t:`/${t}`,o=hd();return o?`${o}${n}`:n}function pd(){return Dn(new Date)}function Dn(e){if(e==null||e==="")return"";const t=e instanceof Date?e:new Date(e);return isNaN(t.getTime())?"":new Intl.DateTimeFormat("fr-CA",{timeZone:"Asia/Seoul"}).format(t)}const rn=[],un=[],an=[],ln=[],xn={LISTEN_IN_NOISE:[],SHORT_STORY:[],LONG_STORY:[],ORDERING_SENTENCE:[]},vn={LISTEN_IN_NOISE:[],SHORT_STORY:[],LONG_STORY:[],ORDERING_SENTENCE:[]},fd={LISTEN_IN_NOISE:3,SHORT_STORY:2,LONG_STORY:1,ORDERING_SENTENCE:2};let ho=null,Ur=null,_t=null;function Cd({counts:e,forceRefresh:t}={}){const n=Object.assign({},fd,e||{}),o=pd(),r=Dn(new Date(`${o}T00:00:00+09:00`).getTime()-864e5),u=JSON.stringify(n);if(!t&&Ur===o&&ho===u&&_t)return Object.assign(xn,_t.today),Object.assign(vn,_t.yesterday?.selection||{LISTEN_IN_NOISE:[],SHORT_STORY:[],LONG_STORY:[],ORDERING_SENTENCE:[]}),{today:xn,yesterday:vn};const i={LISTEN_IN_NOISE:dt(rn,Math.max(0,Number(n.LISTEN_IN_NOISE)||0)),SHORT_STORY:dt(un,Math.max(0,Number(n.SHORT_STORY)||0)),LONG_STORY:dt(an,Math.max(0,Number(n.LONG_STORY)||0)),ORDERING_SENTENCE:dt(ln,Math.max(0,Number(n.ORDERING_SENTENCE)||0))};let l=null;return _t&&ho===u&&_t.yesterday&&_t.yesterday.date===r&&(l=_t.yesterday.selection),l||(l={LISTEN_IN_NOISE:dt(rn,Math.max(0,Number(n.LISTEN_IN_NOISE)||0)),SHORT_STORY:dt(un,Math.max(0,Number(n.SHORT_STORY)||0)),LONG_STORY:dt(an,Math.max(0,Number(n.LONG_STORY)||0)),ORDERING_SENTENCE:dt(ln,Math.max(0,Number(n.ORDERING_SENTENCE)||0))}),Object.assign(xn,i),Object.assign(vn,l),Ur=o,ho=u,_t={today:i,yesterday:{date:r,countsKey:u,selection:l}},{today:xn,yesterday:vn}}let Gr=!1,cn=null;async function yd(){try{const e=import.meta&&import.meta.env&&import.meta.env.BASE_URL||"/",t=await fetch(`${e}data/allTrainingData.json`);return t.ok?await t.json():null}catch{return null}}async function md(){if(!Gr)return cn||(cn=(async()=>{const e=await yd();if(!e){cn=null;try{window.dispatchEvent(new Event("speechear.data.error"))}catch{}return}try{for(const t of Object.keys(e||{})){const n=e[t]||[];for(const o of n){const r=o,u=String(r.training_type||t),i=String(r.category_main_code||r.category_main||r.category_0||""),l=String(r.category_sub_code||r.category_sub||r.category_1||""),s=Object.assign({},r,{training_type:u,category_0:i,category_1:l});u==="LISTEN_IN_NOISE"?rn.push(s):u==="SHORT_STORY"?un.push(s):u==="LONG_STORY"?an.push(s):u==="ORDERING_SENTENCE"&&ln.push(s)}}}catch{cn=null;try{window.dispatchEvent(new Event("speechear.data.error"))}catch{}return}try{window.dispatchEvent(new Event("speechear.data.updated"))}catch{}try{Cd()}catch{}Gr=!0})(),cn)}async function gd(e=3e3){const t=md();return Promise.race([t,new Promise(n=>setTimeout(n,e))])}const _d=[{key:"LISTEN_IN_NOISE",label:"\uC18C\uC74C \uD558 \uBB38\uC7A5 \uB4E3\uAE30",icon:"party-popper",desc:"\uB2E4\uC591\uD55C \uC18C\uC74C \uD658\uACBD\uC5D0\uC11C \uBB38\uC7A5 \uCCAD\uB825\uC744 \uD6C8\uB828\uD569\uB2C8\uB2E4."},{key:"SHORT_STORY",label:"\uC9E7\uC740 \uC774\uC57C\uAE30 \uB4E3\uAE30",icon:"message-square",desc:"\uC9E7\uC740 \uC774\uC57C\uAE30\uB97C \uB4E3\uACE0 \uAE30\uC5B5\uD558\uC5EC \uBB38\uC81C\uB97C \uD480\uC5B4\uBD05\uB2C8\uB2E4."},{key:"LONG_STORY",label:"\uAE34 \uC774\uC57C\uAE30 \uB4E3\uAE30",icon:"message-square-text",desc:"\uAE34 \uC774\uC57C\uAE30\uB97C \uB4E3\uACE0 \uAE30\uC5B5\uD558\uC5EC \uB2E4\uC218\uC758 \uBB38\uC81C\uB97C \uD480\uC5B4\uBD05\uB2C8\uB2E4."},{key:"ORDERING_SENTENCE",label:"\uBB38\uC7A5 \uC21C\uC11C\uD654 \uD558\uAE30",icon:"align-start-vertical",desc:"\uC5EC\uB7EC\uAC1C\uC758 \uC9E7\uC740 \uBB38\uC7A5\uC744 \uB4E3\uACE0 \uAE30\uC5B5\uD558\uC5EC \uADF8 \uC21C\uC11C\uC5D0 \uB9DE\uAC8C \uBC30\uC5F4\uD569\uB2C8\uB2E4."}],Ed={LISTEN_IN_NOISE:"listenInNoise",SHORT_STORY:"shortStory",LONG_STORY:"longStory",ORDERING_SENTENCE:"orderingSentence"};function bd(e){return _d.map(t=>{const n=Ed[t.key];return n?{...t,label:e(`trainingType.${n}.title`),desc:e(`trainingType.${n}.desc`)}:t})}function kd(e){return typeof window>"u"?"":cd.sanitize(e,{USE_PROFILES:{svg:!0,svgFilters:!0},FORBID_TAGS:["script","use"],FORBID_ATTR:["xlink:href","href"]})}function Ad(e){const[t,n]=B(null),[o,r]=B(null),[u,i]=B(null),[l,s]=B(null);return X(()=>{if(!e||typeof e!="string"||!e.endsWith(".svg")){n(null),r(null),i(null);return}const p=e.split("/").pop();let h=e;p&&(e.startsWith("/")?h=so(e):/^(Logo|Symbol)/i.test(p)?h=so(`logo/${p}`):(/^https?:\/\//i.test(e)||e.startsWith("data:"),h=e)),n(h)},[e]),X(()=>{if(!t)return;let p=!1;async function h(){try{let f=await fetch(t);f.ok||(f=await fetch(t));const c=f.headers.get("content-type")||"";if(p)return;if(c.includes("svg")){r("mask");return}if(c.startsWith("image/")){r("img");return}const y=await fetch(t);if(!y.ok)throw new Error("not ok");const b=await y.text();if(p)return;if(/^\s*<svg[\s>]/i.test(b)){const w=kd(b);if(!w){r("none");return}i(w),r("inline");return}r("none")}catch{p||r("none")}}return h(),()=>{p=!0}},[t]),X(()=>{let p=!1,h=null;return o==="mask"&&t&&fetch(t).then(f=>{if(!f.ok)throw new Error("fetch failed");return f.blob()}).then(f=>{p||(h=URL.createObjectURL(f),s(h))}).catch(()=>{p||r("img")}),()=>{p=!0,h&&URL.revokeObjectURL(h),s(null)}},[o,t]),{iconToUse:t,mode:o,svgText:u,blobUrl:l}}function wd(e){const{icon:t,label:n,className:o,imgClassName:r,maskClassName:u,svgClassName:i,wrapperStyle:l,size:s}=e||{},p=o??"iconRenderer-icon",h=r??"iconRenderer-icon-image",f=u??"iconRenderer-icon-mask",c=i??"iconRenderer-icon-svg",y=typeof t=="string"?t:null,b=T0(y),{iconToUse:w,mode:g,svgText:m,blobUrl:E}=Ad(y),k=(j,H={})=>oe("span",{className:p,style:l,...H,children:j}),x=(j,H={})=>oe("img",{src:j,alt:typeof n=="string"?n:n?String(n):"",className:h,...H});if(!t)return null;if(typeof t!="string")return k(t);if(t==="none")return k(oe("span",{className:c,dangerouslySetInnerHTML:{__html:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" aria-hidden="true"></svg>'}}),{"aria-hidden":"true"});if(b)try{return k(Ut(b,{className:c,size:typeof s=="number"?s:20}),{"aria-hidden":"true"})}catch{}if(w&&w.endsWith(".svg")){if(g==="mask"){const j={"--icon-url":E?`url(${E})`:`url(${w})`};return k(oe("span",{className:f,style:j}),{"aria-hidden":"true"})}return g==="img"?k(x(w,{onError:j=>{j.currentTarget.onerror=null,j.currentTarget.style.display="none"}}),{"aria-hidden":"true"}):g==="inline"?k(oe("span",{className:c,dangerouslySetInnerHTML:m?{__html:m}:void 0}),{"aria-hidden":"true"}):k(null,{"aria-hidden":"true"})}if(t.startsWith("/")||t.includes("/assets/")||t.match(/\.(png|jpg|jpeg|webp|gif)$/i))return x(so(t),{style:l,onError:j=>{j.currentTarget.onerror=null,j.currentTarget.style.display="none"}});const R=typeof s=="number"?s:20,v=`<svg width="${R}" height="${R}" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><rect x="3" y="3" width="18" height="18" rx="2" ry="2" style="fill:none;stroke:currentColor;stroke-width:2"/></svg>`;return k(oe("span",{className:c,dangerouslySetInnerHTML:{__html:v}}),{"aria-hidden":"true"})}function Yr(e){const{anchorRect:t,anchorEl:n,offset:o=20,edgeMargin:r=20,onClose:u,closeOnOutsideClick:i=!0,className:l="",role:s="dialog",ariaLabel:p="",children:h,backdrop:f=!1,isMobilePopup:c=!1,useBorder:y=!0,header:b}=e||{},w=Oe(null),[g,m]=B({position:"fixed",left:0,top:-9999}),[E,k]=B(!1),[x,R]=B("bottom"),[v,j]=B(!1),[H,U]=B(!1),F=!t&&!n,Q=q((D=!1)=>{if(H&&c)return;const O=n?n.getBoundingClientRect():t;if(!O||!w.current)return;const me=w.current,{offsetWidth:Z,offsetHeight:ee}=me,S=window.innerWidth,P=window.innerHeight,re=S-O.right,ue=O.left,Y=O.top,Ae=P-O.bottom;let M=0,fe=0,Ce="top";if(Y>=ee+o)Ce="top",fe=O.top-o-ee,M=O.left+O.width/2-Z/2;else if(Ae>=ee+o)Ce="bottom",fe=O.bottom+o,M=O.left+O.width/2-Z/2;else if(re>=Z+o)Ce="right",M=O.right+o,fe=O.top+O.height/2-ee/2;else if(ue>=Z+o)Ce="left",M=O.left-o-Z,fe=O.top+O.height/2-ee/2;else{const rt=Math.max(Y,Ae,re,ue);rt===Y?(Ce="top",fe=O.top-o-ee,M=O.left+O.width/2-Z/2):rt===Ae?(Ce="bottom",fe=O.bottom+o,M=O.left+O.width/2-Z/2):rt===re?(Ce="right",M=O.right+o,fe=O.top+O.height/2-ee/2):(Ce="left",M=O.left-o-Z,fe=O.top+O.height/2-ee/2)}const He=Number(r)||8;M=Math.min(Math.max(M,He),S-Z-He),fe=Math.min(Math.max(fe,He),P-ee-He);const ft=Math.round(M),Ke=Math.round(fe);D&&w.current?(w.current.style.left=`${ft}px`,w.current.style.top=`${Ke}px`,w.current.dataset.placement=Ce):(R(Ce||x),m({position:"fixed",left:ft,top:Ke}),j(!0))},[H,c,n,t,o,r,x]);Nu(()=>{if(F)return;if(H&&c){m({position:"fixed",left:"50%",top:"50%",transform:"translate(-50%, -50%)",width:"calc(100% - 40px)",maxWidth:"calc(100% - 40px)"}),j(!0);return}Q();const D=requestAnimationFrame(()=>Q());return()=>cancelAnimationFrame(D)},[t,n,o,h,r,F,H,c,Q]),X(()=>{if(F||H&&c||!w.current||typeof ResizeObserver>"u")return;const D=new ResizeObserver(()=>{t&&Q()});return D.observe(w.current),()=>D.disconnect()},[t,h,r,F,H,c,Q]),X(()=>{if(F||H&&c)return;const D=()=>Q(!0);return window.addEventListener("resize",D),document.addEventListener("scroll",D,{passive:!0,capture:!0}),()=>{window.removeEventListener("resize",D),document.removeEventListener("scroll",D,{capture:!0})}},[t,o,h,r,F,H,c,Q]),X(()=>{if(typeof window>"u"||!window.matchMedia)return;const D=window.matchMedia("(max-width: 768px)"),O=()=>U(!!D.matches);O();try{D.addEventListener?D.addEventListener("change",O):D.addListener(O)}catch{try{D.addListener(O)}catch{}}return()=>{try{D.removeEventListener?D.removeEventListener("change",O):D.removeListener(O)}catch{}}},[]);const G=Oe(!1),W=q((D=!1)=>{if(!(E||G.current)){if(G.current=!0,D){k(!0);try{u&&u()}catch{}return}k(!0),setTimeout(()=>{u&&u()},200)}},[E,u,k]);X(()=>{const D=Z=>{const ee=w.current;if(!ee)return;const S=Z.target;if(S&&!ee.contains(S)){try{if(S.closest&&S.closest("[data-tooltip-ignore]"))return}catch{}i&&W(!0)}},O=Z=>{const ee=w.current;if(!ee)return;const S=Z.target;if(S&&!ee.contains(S)){try{if(S.closest&&S.closest("[data-tooltip-ignore]"))return}catch{}i&&W(!0)}},me=Z=>{if(Z.key==="Escape"){Z.stopPropagation(),W();return}if(Z.key==="Tab"){const ee=w.current;if(!ee)return;const S=ee.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(!S||S.length===0)return;const P=S[0],re=S[S.length-1],ue=document.activeElement;Z.shiftKey?ue===P&&(Z.preventDefault(),re.focus()):ue===re&&(Z.preventDefault(),P.focus())}};return document.addEventListener("pointerdown",D,!0),document.addEventListener("click",O,!0),document.addEventListener("keydown",me),()=>{document.removeEventListener("pointerdown",D,!0),document.removeEventListener("click",O,!0),document.removeEventListener("keydown",me)}},[u,i,W]),X(()=>{const D=()=>{W(!0)};return typeof document<"u"&&document.addEventListener("speechear-close-tooltips",D),()=>{typeof document<"u"&&document.removeEventListener("speechear-close-tooltips",D)}},[W]);const z=Ie("div",{ref:w,className:`tooltip-content ${y?"tooltip-content--bordered":""} ${E?"is-closing":""} ${l} ${H&&c?"is-mobile":""}`,role:s,"aria-label":p||void 0,style:F?{}:{...g,visibility:v?"visible":"hidden"},tabIndex:-1,"data-placement":x,"data-left":F?"":g.left,"data-top":F?"":g.top,"data-anchor-left":t?Math.round(t.left):"","data-anchor-top":t?Math.round(t.top):"","data-anchor-width":t?Math.round(t.width):"","data-anchor-height":t?Math.round(t.height):"",children:[b!=null&&oe("div",{className:"tooltip-content__header h5",children:b}),h]});if(F||typeof document>"u")return z;if(f||H&&c){const D=Ie("div",{className:"tooltip-portal",children:[oe("div",{className:"tooltip-backdrop",onClick:()=>{i&&W(!0)}}),z]});return $o(D,document.body)}return $o(z,document.body)}function Sd(e){const{anchorRect:t,text:n,offset:o=8,onClose:r,className:u="",ariaLabel:i}=e||{};return n?oe(Yr,{anchorRect:t,offset:o,onClose:r,closeOnOutsideClick:!1,className:`tooltip-info ${u}`,ariaLabel:i||n,children:oe("div",{className:"tooltip-info__content body-3",children:n})}):null}function qr(e){const{anchorRect:t,title:n,items:o,activeIndex:r=-1,showIndex:u=!0,onClose:i,offset:l=12}=e||{},s=Array.isArray(o)?o:o?[o]:[];return!s.length&&!n?null:oe(Yr,{anchorRect:t,offset:l,onClose:i,closeOnOutsideClick:!0,useBorder:!1,className:"tooltip-description",children:Ie("div",{className:"tooltip-description__box",children:[n&&oe("span",{className:"tooltip-description__title body-2",children:n}),oe("ol",{className:"tooltip-description__items",children:s.map((p,h)=>Ie("li",{className:`tooltip-description__item body-3${h===r?" tooltip-description__item--active":""}`,children:[u&&s.length>1&&Ie("span",{className:"tooltip-description__index button-1",children:[h+1,"."]}),oe("span",{children:p})]},h))})]})})}function Nd(e){const{size:t=48,type:n,htmlType:o,href:r,target:u,rel:i,icon:l,rightIcon:s,label:p,count:h,subLabel:f,children:c,ariaLabel:y,variant:b="default",align:w="center",selected:g,toggleable:m=!1,disabled:E=!1,useLabel:k=!0,useBorder:x=!0,useBG:R=!0,useDisabledCovered:v=!1,useDisabledInvisible:j=!1,width:H,minWidth:U,onClick:F,onDisabledClick:Q,showTooltipInfo:G=!1,tooltipInfoText:W=null,tooltipDescription:z=null,iconSize:D="medium",iconColor:O,shape:me="rounded",color:Z,className:ee,...S}=e,P=typeof t=="string"&&isNaN(Number(t))?t.toLowerCase():String(Number(t)||48),re=P.match(/^\d+$/)?`button${P}`:`button-${P}`,ue=Number(t),Y=!isNaN(ue)&&ue<40?"button-2":"button-1",Ae=p??c,M=E||!!S.disabled,fe=M?v?"disabled-covered":j?"disabled-invisibled":"disabled":b,Ce=fe?`button--variant-${fe}`:"",He=w?`button--align-${w}`:"",ft=me?`button--shape-${me}`:"",Ke=typeof O=="string"&&O.startsWith("--")?`var(${O})`:O,rt={...H?{width:typeof H=="number"?`${H}px`:H}:{},...U?{minWidth:typeof U=="number"?`${U}px`:U}:{},...x?{}:{"--button-border":M?"0":"1px solid transparent"},...Ke?{"--button-icon-color":Ke}:{},...Z?{"--color-main":Z}:{}},Ue=k===!1?"":Ae,te=Array.isArray(Ue)?Ue.length>0:!!Ue,ut=!!s,ae=n??(te||l||ut?"bar":"dot"),A=`${re}--${ae}`,L=Oe(null),$=Oe(M),[K,ne]=B(!!g),[De,Te]=B(!1),[Xe,Ge]=B(null),ge=q(()=>Te(!1),[]);X(()=>{(G||z)&&M&&De&&(Te(!1),Ge(null))},[M,G,z,De]),X(()=>{typeof g=="boolean"&&ne(g)},[g]),X(()=>{if($.current&&!M&&L.current){const ie=L.current;ie.blur(),ie.style.pointerEvents="none";const Qe=requestAnimationFrame(()=>{requestAnimationFrame(()=>{L.current&&(L.current.style.pointerEvents="")})});return()=>cancelAnimationFrame(Qe)}$.current=M},[M]);const ze=typeof g=="boolean"?!!g:K,Re=m||typeof g=="boolean"?ze?"true":"false":void 0,Ct=Ga("button",re,A,Ce,He,ft,ze?"is-selected":null,R?null:"button--no-bg",ee),Ze=`button__icon button__icon--${D}`,at=Array.isArray(f)?f:f!==void 0?[f]:[],it=()=>{if(Array.isArray(Ue))return Ue.map((Qe,Ht)=>{const xt=at[Ht];return Ie("span",{className:`button__label-text${xt!==void 0?" button__label-text--has-sub":""}`,children:[Qe,xt!==void 0&&oe("span",{className:"button__sub-label-text caption-1",children:xt})]},Ht)});const ie=f!==void 0;return Ie("span",{className:`button__label-text${ie?" button__label-text--has-sub":""}`,children:[Ue,h!=null&&oe("span",{className:"button__count",children:h}),ie&&oe("span",{className:"button__sub-label-text caption-1",children:f})]})},lt=ie=>{M||(typeof S.onMouseLeave=="function"&&S.onMouseLeave(ie),typeof g!="boolean"&&ne(!1),ie.currentTarget.blur())},Tt=ie=>{if(M){Q?.(ie);return}typeof g!="boolean"&&m&&ne(Qe=>!Qe),F?.(ie)},Et=q(()=>{!M&&(G||z)&&(Te(!0),Ge(L.current?.getBoundingClientRect()??null))},[M,G,z]),Ft=q(()=>{(G||z)&&(Te(!1),Ge(null))},[G,z]),_e={...S};delete _e.disabled,delete _e.className,delete _e.faded,delete _e.useFaded,delete _e.loading,delete _e.onMouseLeave,delete _e.onPointerEnter,delete _e.onPointerLeave,delete _e.onFocus,delete _e.onBlur,M&&(Object.keys(_e).forEach(ie=>{/^on[A-Z]/.test(ie)&&typeof _e[ie]=="function"&&delete _e[ie]}),_e["aria-disabled"]="true");const Bt=(typeof G=="string"?G:null)??(typeof W=="string"?W:null)??(typeof y=="string"?y:null)??(typeof Ae=="string"?Ae:null)??void 0,Dt=typeof y=="string"?y:typeof Ae=="string"?Ae:Bt,ct=(ie,Qe)=>oe(wd,{icon:ie,label:Qe??Dt,className:Ze,imgClassName:"button__icon-img",maskClassName:"button__icon-mask",svgClassName:"button__icon-svg"}),yt=()=>ae==="dot"?Ie(Gt,{children:[ct(l),te&&oe("span",{className:`button__label ${Y}`,children:it()})]}):w==="center"&&l?Ie(Gt,{children:[Ie("span",{className:"button__center-group",children:[oe("span",{className:"button__left",children:ct(l)}),te&&oe("span",{className:`button__label ${Y}`,children:it()})]}),ut&&oe("span",{className:"button__right",children:ct(s)})]}):Ie(Gt,{children:[l&&oe("span",{className:"button__left",children:ct(l,y??Ae)}),te&&oe("span",{className:`button__label ${Y}`,children:it()}),ut&&oe("span",{className:"button__right",children:ct(s)})]}),Je=!!r&&!M;return Ie(Gt,{children:[oe(Je?"a":"button",{..._e,ref:L,...Je?{href:r,target:u,rel:i??(u==="_blank"?"noreferrer":void 0)}:{type:o,disabled:M&&!Q},className:Ct,"aria-pressed":Re,"aria-label":Dt,"aria-disabled":Je&&M?!0:void 0,style:rt,onClick:Tt,onMouseLeave:lt,onPointerEnter:ie=>{Et(),!M&&typeof S.onPointerEnter=="function"&&S.onPointerEnter(ie)},onPointerLeave:ie=>{Ft(),!M&&typeof S.onPointerLeave=="function"&&S.onPointerLeave(ie)},onFocus:ie=>{Et(),!M&&typeof S.onFocus=="function"&&S.onFocus(ie)},onBlur:ie=>{lt(ie),Ft(),!M&&typeof S.onBlur=="function"&&S.onBlur(ie)},children:yt()}),De&&z?oe(qr,{anchorRect:Xe,title:z.title,items:z.items,onClose:ge}):De&&Bt?oe(Sd,{anchorRect:Xe,text:Bt,onClose:ge}):null]})}function Wr(){const[e,t]=B(null),n=q(u=>t(u.getBoundingClientRect()),[]),o=q(()=>t(null),[]),r=q(u=>{const i=u.getBoundingClientRect();t(l=>l?null:i)},[]);return{anchorRect:e,isOpen:e!=null,openAt:n,close:o,toggleAt:r}}function Md(e){const[t,n]=B(null),[o,r]=B(null),u=Oe(null);X(()=>()=>{u.current&&clearTimeout(u.current)},[]);const i=q((s,p)=>{u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{n(s),r(p)},e)},[e]),l=q(()=>{u.current&&clearTimeout(u.current),n(null),r(null)},[]);return{payload:t,anchorRect:o,openAfterDelay:i,close:l}}function Td({title:e,items:t}){const{t:n}=kt(),{anchorRect:o,openAt:r,close:u}=Wr();return Ie(Gt,{children:[oe(Nd,{size:24,type:"dot",icon:"info",variant:"transparent-gray",useBorder:!1,selected:!!o,ariaLabel:n("common.info","\uC124\uBA85"),onPointerEnter:i=>r(i.currentTarget),onPointerLeave:u,onFocus:i=>r(i.currentTarget),onBlur:u}),o&&oe(qr,{title:e,items:t,showIndex:t.length>1,anchorRect:o,onClose:u})]})}function Kr(){const{t:e}=kt();return we(()=>({difficulty:e("wordSearch.filter.difficulty","\uB4F1\uAE09"),syllables:e("wordSearch.filter.syllables","\uC74C\uC808 \uC218"),syllable5plus:e("wordSearch.filter.syllable5plus","5\uC74C\uC808 \uC774\uC0C1"),partOfSpeech:e("wordSearch.filter.partOfSpeech","\uD488\uC0AC"),wordType:e("wordSearch.filter.wordType","\uC720\uD615"),posMap:{[e("wordSearch.filter.pos.noun","\uCCB4\uC5B8(\uBA85\uC0AC, \uC218\uC0AC)")]:["\uBA85","\uC218"],[e("wordSearch.filter.pos.verb","\uC6A9\uC5B8(\uB3D9\uC0AC, \uD615\uC6A9\uC0AC)")]:["\uB3D9","\uD615"],[e("wordSearch.filter.pos.modifier","\uC218\uC2DD\uC5B8(\uBD80\uC0AC, \uAD00\uD615\uC0AC)")]:["\uBD80","\uAD00"]},typeMap:{[e("wordSearch.filter.type.native","\uACE0\uC720\uC5B4")]:"\uACE0\uC720",[e("wordSearch.filter.type.sino","\uD55C\uC790\uC5B4")]:"\uD55C\uC790",[e("wordSearch.filter.type.foreign","\uC678\uB798\uC5B4")]:"\uC678\uB798",[e("wordSearch.filter.type.mixed","\uD63C\uC885\uC5B4")]:"\uD63C\uC885"}}),[e])}function Xr(e,t,n){return{label:t.difficulty,items:[1,2,3,4].map(o=>e("wordSearch.filter.grade",{n:o})),multiple:!0,allOption:!0,allLabel:n?.allLabel,labelAction:n?.labelAction}}function Zr(e){return{label:e.partOfSpeech,items:Object.keys(e.posMap),multiple:!0,allOption:!0}}function Jr(e){return{label:e.wordType,items:Object.keys(e.typeMap),multiple:!0,allOption:!0}}function Bd(e,t){return{label:t.syllables,items:[e("wordSearch.filter.syllable",{n:1}),e("wordSearch.filter.syllable",{n:2}),e("wordSearch.filter.syllable",{n:3}),e("wordSearch.filter.syllable",{n:4}),t.syllable5plus],multiple:!0,allOption:!0}}function Dd(e,t){const n=[e("wordPairs.filter.onlyHasImage","\uC774\uBBF8\uC9C0 \uC788\uB294 \uB2E8\uC5B4\uB9CC")];return t?.includeStructure&&n.push(e("wordPairs.filter.onlySameStructure","\uC74C\uC18C \uAD6C\uC870 \uAC19\uC740 \uB2E8\uC5B4\uB9CC")),{label:e("wordPairs.filter.selectLabel","\uC120\uD0DD"),items:n,multiple:!0,labelAction:t?.labelAction}}function xd(e,t){const{label:n,headValue:o,midValue:r,tailValue:u,includeMid:i=!0,headDisabled:l,midDisabled:s,tailDisabled:p,allOptionDisabled:h,groupLabel:f,labelAction:c}=t;return{label:n,...f?{groupLabel:f}:{},...c?{labelAction:c}:{},allOption:!0,allLabel:e("wordSearch.filter.positionAny",{defaultValue:"\uBB34\uAD00"}),...h?{allOptionDisabled:h}:{},items:[{value:o,displayLabel:e("wordSearch.filter.positionHead",{defaultValue:"\uC5B4\uB450"}),disabled:l},...i?[{value:r,displayLabel:e("wordSearch.filter.positionMid",{defaultValue:"\uC5B4\uC911"}),disabled:s}]:[],{value:u,displayLabel:e("wordSearch.filter.positionTail",{defaultValue:"\uC5B4\uB9D0"}),disabled:p}]}}function vd(e,t,n){if(t===St){const{[n]:u,...i}=e;return i}const o=e[n]??[],r=o.includes(t)?o.filter(u=>u!==t):[...o,t];if(r.length===0){const{[n]:u,...i}=e;return i}return{...e,[n]:r}}Object.fromEntries(Object.entries(ia).map(([e,{nucleus:t}])=>[e,t]));const Od={\uACE0\uC720\uC5B4:"\uACE0\uC720",\uD55C\uC790\uC5B4:"\uD55C\uC790",\uC678\uB798\uC5B4:"\uC678\uB798",\uD63C\uC885\uC5B4:"\uD63C\uC885"},Ld={"\uCCB4\uC5B8(\uBA85\uC0AC,\uC218\uC0AC)":["\uBA85","\uC218"],"\uC6A9\uC5B8(\uB3D9\uC0AC,\uD615\uC6A9\uC0AC)":["\uB3D9","\uD615"],"\uC218\uC2DD\uC5B8(\uBD80\uC0AC,\uAD00\uD615\uC0AC)":["\uBD80","\uAD00"]},Rd={difficulty:"\uB09C\uC774\uB3C4 \uB4F1\uAE09",syllables:"\uC74C\uC808 \uC218",syllable5plus:"5\uC74C\uC808 \uC774\uC0C1",partOfSpeech:"\uD488\uC0AC",wordType:"\uC720\uD615",posMap:Ld,typeMap:Od};function Id(e,t,n=Rd){const o=t[n.difficulty];if(o?.length&&!o.some(l=>e.grade===l.replace(/\D/g,"")))return!1;const r=t[n.syllables];if(r?.length){const l=e.syllables??0;if(!r.some(s=>s===n.syllable5plus?l>=5:l===parseInt(s)))return!1}const u=t[n.partOfSpeech];if(u?.length&&!u.flatMap(l=>n.posMap[l]??[l]).some(l=>(e.pos??"").includes(l)))return!1;const i=t[n.wordType];return!(i?.length&&!i.some(l=>e.wordType===n.typeMap[l]))}const ht=(e,t)=>t.map(n=>({jamos:[n],tooltip:e})),ke=(e,t)=>({jamos:[...e],tooltip:t}),po={cho:[ht("\uC591\uC21C\uC74C",["\u3142","\u3143","\u314D","\u3141"]),ht("\uCE58\uC870\uC74C",["\u3137","\u3138","\u314C","\u3134","\u3139"]),ht("\uCE58\uC870\uC74C",["\u3145","\u3146"]),ht("\uACBD\uAD6C\uAC1C\uC74C",["\u3148","\u3149","\u314A"]),ht("\uC5F0\uAD6C\uAC1C\uC74C",["\u3131","\u3132","\u314B"]),ht("\uC131\uBB38\uC74C",["\u314E"])],jung:[[ke("\u3163","\uC804\uC124 \uACE0\uBAA8\uC74C"),ke("\u315F","\uC804\uC124 \uACE0\uBAA8\uC74C \xB7 w\uD65C\uC74C"),ke("\u3162","\uC804\uC124 \uACE0\uBAA8\uC74C \xB7 \u0270\uD65C\uC74C")],[ke("\u3161","\uD6C4\uC124 \uACE0\uBAA8\uC74C \uD3C9\uC21C")],[ke("\u315C","\uD6C4\uC124 \uACE0\uBAA8\uC74C \uC6D0\uC21C"),ke("\u3160","\uD6C4\uC124 \uACE0\uBAA8\uC74C \uC6D0\uC21C \xB7 j\uD65C\uC74C")],[ke("\u3154\u3150","\uC804\uC124 \uC911\uBAA8\uC74C"),ke("\u3156\u3152","\uC804\uC124 \uC911\uBAA8\uC74C \xB7 j\uD65C\uC74C"),ke("\u3159\u315A\u315E","\uC804\uC124 \uC911\uBAA8\uC74C \xB7 w\uD65C\uC74C")],[ke("\u3153","\uD6C4\uC124 \uC911\uBAA8\uC74C \uD3C9\uC21C"),ke("\u3155","\uD6C4\uC124 \uC911\uBAA8\uC74C \uD3C9\uC21C \xB7 j\uD65C\uC74C"),ke("\u315D","\uD6C4\uC124 \uC911\uBAA8\uC74C \uD3C9\uC21C \xB7 w\uD65C\uC74C")],[ke("\u3157","\uD6C4\uC124 \uC911\uBAA8\uC74C \uC6D0\uC21C"),ke("\u315B","\uD6C4\uC124 \uC911\uBAA8\uC74C \uC6D0\uC21C \xB7 j\uD65C\uC74C")],[ke("\u314F","\uC800\uBAA8\uC74C"),ke("\u3151","\uC800\uBAA8\uC74C \xB7 j\uD65C\uC74C"),ke("\u3158","\uC800\uBAA8\uC74C \xB7 w\uD65C\uC74C")]],jong:[ht("\uC591\uC21C\uC74C",["\u3142","\u3141"]),ht("\uCE58\uC870\uC74C",["\u3137","\u3134","\u3139"]),ht("\uC5F0\uAD6C\uAC1C\uC74C",["\u3131","\u3147"])]},jd=[...Se],Pd=[...st],$d=Ve.filter(e=>e!==""),pt=e=>e===nt?[]:Array.from(e),nt="__NO_CODA__",Qr=[1,2,3,4],ot=5,Fd=12,eu="SYL_",fo=e=>`${eu}${e}`,Hd=e=>Number(e.slice(eu.length));function Co(e){return e>=ot?Array.from({length:Fd-ot+1},(t,n)=>ot+n):[e]}const tu={cho:jd,jung:Pd,jong:$d},yo=e=>e.map(t=>t.map(({jamos:n,tooltip:o})=>({v:n.join(""),tooltip:o}))),mo={cho:yo(po.cho),jung:yo(po.jung),jong:yo(po.jong)},nu={};mo.jung.flat().forEach(({v:e})=>{for(const t of pt(e))nu[t]=e});const zd=new Set(mo.cho.flat().map(e=>e.v));function ou(e,t){return e==="cho"?zd.has(t)?t:null:e==="jung"?nu[t]??t:nr(t)}function ru(e,t,n){if(e==="jung"){const o=pt(t);return n&&o.includes(n)?n:o[0]??t}return t}function uu(e,t,n){const o=(r,u)=>u?r==="jong"&&u===nt?nt:t==="pron"?ou(r,u):ru(r,u,r==="jung"?n:null):null;return{...e,cho:o("cho",e.cho),jung:o("jung",e.jung),jong:o("jong",e.jong)}}const go={cho:null,jung:null,jong:null,syllable:null},Vd="wt_filter",au=e=>`wt_filter_${e}`;function Ud(e){try{const t=localStorage.getItem(au(e))??localStorage.getItem(Vd);if(t)return JSON.parse(t)}catch{}return null}function Gd(e){const t=e;return t?.composition?{cho:t.composition.cho??null,jung:t.composition.jung??null,jong:t.composition.jong??null,syllable:t.composition.syllable??null}:t?.choseong?{...go,cho:t.choseong}:go}function Yd(e,t,n){const{t:o,i18n:r}=kt(),[u]=B(()=>n?.resetOnMount?null:Ud(e)),i=u?.contrastCount,l=typeof i=="number"&&Number.isFinite(i)?i:1,[s,p]=B(Math.min(5,Math.max(1,l))),[h,f]=B(u?.phonemeView==="pron"?"pron":u?.phonemeView==="direct"?"direct":"char"),[c,y]=B(()=>Gd(u)),b=q(()=>t.requireSyllable?{cho:"\u3131",jung:"\u314F",jong:nt,syllable:t.fixedSyllable??null}:{cho:null,jung:null,jong:t.fixedNoCoda?nt:null,syllable:t.fixedSyllable??null},[t.requireSyllable,t.fixedSyllable,t.fixedNoCoda]);X(()=>{!t.requireSyllable&&t.fixedSyllable==null&&!t.fixedNoCoda||y(A=>A.cho||A.jung||A.syllable!=null||A.jong?A:b())},[]);const w=we(()=>be(c.cho)||be(c.jung)||be(c.jong)?"count":"random",[c.cho,c.jung,c.jong]),g=Oe(h==="char"?c.jung:null);X(()=>{h==="char"&&(g.current=c.jung)},[h,c.jung]);const[m,E]=B(n?.resetOnMount?!!n?.defaultImageOnly:u?.excludeNoImage??!0),[k,x]=B(n?.resetOnMount?!1:u?.sameStructureOnly??!0),[R,v]=B(Array.isArray(u?.gradeFilter)?u.gradeFilter:[]),[j,H]=B(Array.isArray(u?.posFilter)?u.posFilter:[]),[U,F]=B(Array.isArray(u?.wordTypeFilter)?u.wordTypeFilter:[]),Q=Oe(n?.resetKey);X(()=>{Q.current!==n?.resetKey&&(Q.current=n?.resetKey,y(b()),E(!1),x(!1),v([]),H([]),F([]),p(1))},[n?.resetKey]);const G=Kr(),[W,z]=B({cho:new Set,jung:new Set,jong:new Set,syllable:new Set}),[D,O]=B(!1),[me,Z]=B(null),ee=1,S=Math.max(1,[c.cho,c.jung,c.jong].filter(Boolean).length);X(()=>{s<S&&p(S)},[S,s]),X(()=>{if(!n?.resetOnMount)try{localStorage.setItem(au(e),JSON.stringify({contrastCount:s,composition:c,excludeNoImage:m,sameStructureOnly:k,phonemeView:h,gradeFilter:R,posFilter:j,wordTypeFilter:U}))}catch{}},[n?.resetOnMount,e,s,c,m,k,h,R,j,U]);const[P,re]=B(0);zo("wordpool:update",()=>re(A=>A+1));const ue=Oe(r.language);X(()=>{ue.current!==r.language&&(ue.current=r.language,re(A=>A+1))},[r.language]),X(()=>{if(!t.choseong)return;let A=!1;return Ua({difficulty:w,excludeNoImage:m}).then(L=>{A||(z(L),L.cho.size+L.jung.size+L.jong.size>0&&O(!0))}).catch(()=>{A||z({cho:new Set,jung:new Set,jong:new Set,syllable:new Set})}),()=>{A=!0}},[t.choseong,w,m,P]),X(()=>{let A=!1;const L=c,$=L.cho?pt(L.cho):null,K=L.jung?pt(L.jung):null,ne=L.jong===nt,De=ne?null:L.jong?pt(L.jong):null,Te=L.syllable!=null?Co(L.syllable):null,Xe=!!($||K||De||ne||Te);return Va({difficulty:t.difficulty?w:null,contrastCount:t.difficulty?s:1,composition:t.choseong&&Xe?{cho:$,jung:K,jong:De,jongNone:ne,syllable:Te}:null,excludeNoImage:m,sameStructureOnly:k,phonemeView:h==="pron"?"pron":"char",grade:R.length>0?R:null}).then(Ge=>{A||Z(Ge)}).catch(()=>{A||Z(null)}),()=>{A=!0}},[t.choseong,t.difficulty,w,s,c,h,m,k,P,R]),X(()=>{D&&y(A=>{const L={...A};let $=!1;return["cho","jung","jong"].forEach(K=>{const ne=A[K];!ne||ne===nt||pt(ne).some(De=>W[K].has(De))||(L[K]=null,$=!0)}),A.syllable!=null&&t.fixedSyllable==null&&(A.syllable>=ot?[...W.syllable].some(K=>K>=ot)||(L.syllable=null,$=!0):(!W.syllable.has(A.syllable)||A.syllable<ee)&&(L.syllable=null,$=!0)),$?L:A})},[W,D,ee,t.fixedSyllable]);const Y=we(()=>{const A=L=>{const $=new Set;for(const K of tu[L])W[L].has(K)&&$.add(K);return $};return{cho:A("cho"),jung:A("jung"),jong:A("jong")}},[W]),Ae=we(()=>({exact:new Set(Qr.filter(A=>W.syllable.has(A))),min:[...W.syllable].some(A=>A>=ot)}),[W]),M=we(()=>({diffPhonemeCount:o("training.contrast.diffPhonemeCount",{defaultValue:"\uB2E4\uB978 \uC74C\uC18C\uC758 \uCD1D \uAC2F\uC218"}),composition:o("wordPairs.composition","\uC815\uB2F5 \uB2E8\uC5B4 \uAD6C\uC131"),syllableCount:o("wordPairs.syllableCount","\uC74C\uC808 \uC218"),onset:o("wordPairs.onset","\uCD08\uC131"),vowel:o("wordPairs.vowel","\uBAA8\uC74C"),coda:o("wordPairs.coda","\uC885\uC131"),phonemeGroup:o("training.filter.phonemeGroup",{defaultValue:"\uD6C8\uB828 \uC74C\uC808"}),trainOnset:o("training.filter.trainOnset",{defaultValue:"\uCD08\uC131"}),trainVowel:o("training.filter.trainVowel",{defaultValue:"\uBAA8\uC74C"}),trainCoda:o("training.filter.trainCoda",{defaultValue:"\uC885\uC131"}),random:o("training.filter.random","\uBB34\uC791\uC704"),exclude:o("wordSearch.filter.exclude","\uC81C\uC678"),selectLabel:o("training.filter.selectSection",{defaultValue:"\uC120\uD0DD"}),none:o("common.none","\uC5C6\uC74C"),noImage:o("wordSearch.filter.excludeNoImage","\uC774\uBBF8\uC9C0 \uC5C6\uC74C"),excludeImage:o("training.filter.excludeImage",{defaultValue:"\uC774\uBBF8\uC9C0 \uC788\uB294 \uB2E8\uC5B4\uB9CC"}),sameStructure:o("training.filter.sameStructure",{defaultValue:"\uC74C\uC18C \uAD6C\uC870 \uAC19\uC740 \uB2E8\uC5B4\uB9CC"}),noLimit:o("training.filter.noLimit",{defaultValue:"\uBB34\uAD00"}),codaExclude:o("training.filter.codaExclude",{defaultValue:"\uC81C\uC678"}),gradeLabel:o("training.filter.gradeLabel",{defaultValue:"\uB09C\uC774\uB3C4 \uB4F1\uAE09"})}),[o]),fe=we(()=>({[M.trainOnset]:"cho",[M.trainVowel]:"jung",[M.trainCoda]:"jong"}),[M]),Ce=q((A,L)=>Ut(Td,{title:L,items:A}),[]),He=we(()=>[o("training.filter.excludeImageInfo",{defaultValue:"\uC774\uBBF8\uC9C0 \uC788\uB294 \uB2E8\uC5B4\uB9CC: \uB2E8\uC5B4 \uC911\uC5D0 \uC774\uBBF8\uC9C0\uAC00 \uC788\uB294 \uB2E8\uC5B4\uB9CC \uACB0\uACFC\uC5D0 \uBCF4\uC5EC\uC90D\uB2C8\uB2E4."}),o("training.filter.sameStructureInfo",{defaultValue:"\uC74C\uC18C \uAD6C\uC870 \uAC19\uC740 \uB2E8\uC5B4\uB9CC: \uC815\uB2F5\uACFC \uC624\uB2F5\uC758 \uC74C\uC808 \uAD6C\uC870(\uAE00\uC790 \uC218\xB7\uBC1B\uCE68 \uC720\uBB34 \uB4F1)\uAC00 \uAC19\uC740 \uACB0\uACFC\uB9CC \uB0A8\uACA8\uC694."})],[o]),ft=we(()=>{const A=[];if(t.choseong){const L={value:nt,displayLabel:M.codaExclude},$=t.fixedNoCoda===!0,K=(ne,De)=>{const Te=$&&ne==="jong",Xe={label:De,groupLabel:M.phonemeGroup,allOption:!t.requireSyllable,allLabel:M.noLimit,allOptionDisabled:Te};if(h==="pron"){const ge=mo[ne].map(ze=>ze.map(({v:Re,tooltip:Ct})=>{const Ze=pt(Re),at=Te||!Ze.some(it=>W[ne].has(it));return Ze.length>1?{value:Re,labels:Ze,tooltip:Ct,disabled:at}:{value:Re,tooltip:Ct,disabled:at}}));return ne==="jong"&&!t.requireCoda&&ge.unshift([L]),{...Xe,groups:ge}}const Ge=tu[ne].map(ge=>!Te&&Y[ne].has(ge)?ge:{value:ge,disabled:!0});return{...Xe,items:ne==="jong"&&!t.requireCoda?[L,...Ge]:Ge}};A.push(K("cho",M.trainOnset)),A.push(K("jung",M.trainVowel)),A.push(K("jong",M.trainCoda))}if(A.push({...Xr(o,G,{labelAction:Ce([o("wordPairs.filter.difficultyInfo",{defaultValue:"\uAD6D\uB9BD\uAD6D\uC5B4\uC6D0\uC758 \uAE30\uCD08 \uC5B4\uD718 \uB4F1\uAE09\uC774 \uACB0\uACFC\uC5D0 \uBC18\uC601\uB429\uB2C8\uB2E4."})])}),label:M.gradeLabel}),t.partOfSpeech&&A.push(Zr(G)),t.wordType&&A.push(Jr(G)),t.choseong||t.fixedSyllable!=null){const L=t.fixedSyllable;A.push({label:M.syllableCount,items:[...Qr.map($=>({value:fo($),displayLabel:o("wordPairs.syllableN",{n:$,defaultValue:"{{n}}\uC74C\uC808"}),disabled:L!=null?$!==L:!Ae.exact.has($)||$<ee})),{value:fo(ot),displayLabel:o("wordPairs.syllableNPlus",{n:ot,defaultValue:"{{n}}\uC74C\uC808 \uC774\uC0C1"}),disabled:L!=null?ot!==L:!Ae.min}],allOption:!0,allOptionDisabled:L!=null})}return t.choseong?A.push({label:M.exclude,displayLabel:M.selectLabel,multiple:!0,items:[M.excludeImage,M.sameStructure],labelAction:Ce(He)}):A.push({label:M.exclude,displayLabel:M.selectLabel,multiple:!0,items:[M.excludeImage],labelAction:Ce([He[0]])}),A},[t.choseong,t.partOfSpeech,t.wordType,t.requireSyllable,t.fixedSyllable,t.fixedNoCoda,t.requireCoda,ee,Y,W,h,Ae,M,o,Ce,He,G]),Ke={...t.difficulty?{[M.diffPhonemeCount]:String(s)}:{},...(t.choseong||t.fixedSyllable!=null)&&c.syllable!=null?{[M.syllableCount]:fo(c.syllable)}:{},...t.choseong&&c.cho?{[M.trainOnset]:c.cho}:{},...t.choseong&&c.jung?{[M.trainVowel]:c.jung}:{},...t.choseong&&c.jong?{[M.trainCoda]:c.jong}:{},[M.exclude]:[...m?[M.excludeImage]:[],...k?[M.sameStructure]:[]],[M.gradeLabel]:R.map(A=>o("wordSearch.filter.grade",{n:Number(A),defaultValue:"{{n}}\uB4F1\uAE09"})),...t.partOfSpeech?{[G.partOfSpeech]:j}:{},...t.wordType?{[G.wordType]:U}:{}},rt=q((A,L)=>{if(L===M.diffPhonemeCount){const $=Number(A);$>=1&&p($)}else if(L===M.exclude)A===M.excludeImage?E($=>!$):A===M.sameStructure&&x($=>!$);else if(L===M.syllableCount)y($=>{if(!A||A===St)return{...$,syllable:null};const K=Hd(A);return{...$,syllable:$.syllable===K?null:K}});else if(L===M.gradeLabel){if(!A||A===St){v([]);return}const $=A.replace(/\D/g,"");v(K=>K.includes($)?K.filter(ne=>ne!==$):[...K,$])}else if(L===G.partOfSpeech){if(!A||A===St){H([]);return}H($=>$.includes(A)?$.filter(K=>K!==A):[...$,A])}else if(L===G.wordType){if(!A||A===St){F([]);return}F($=>$.includes(A)?$.filter(K=>K!==A):[...$,A])}else{const $=fe[L];if(!$)return;y(K=>t.requireSyllable?A&&A!==St?{...K,[$]:A}:K:!A||A===St||K[$]===A?{...K,[$]:null}:{...K,[$]:A})}},[M,fe,G,t.requireSyllable]),Ue=q(A=>!t.partOfSpeech&&!t.wordType?!0:Id(A,{...t.partOfSpeech?{[G.partOfSpeech]:j}:{},...t.wordType?{[G.wordType]:U}:{}},G),[t.partOfSpeech,t.wordType,j,U,G]),te=q(A=>{A!==h&&(A!=="direct"&&h!=="direct"&&y(L=>uu(L,A,g.current)),f(A))},[h]),ut=q(()=>({composition:c,contrastCount:s,excludeNoImage:m,sameStructureOnly:k,phonemeView:h,gradeFilter:R}),[c,s,m,k,h,R]),ae=q(A=>{y(A.composition),p(A.contrastCount),E(A.excludeNoImage),x(A.sameStructureOnly??!0),f(A.phonemeView),v(Array.isArray(A.gradeFilter)?A.gradeFilter:[])},[]);return{difficulty:w,contrastCount:s,composition:c,choseong:c.cho,excludeNoImage:m,sameStructureOnly:k,gradeFilter:R,posFilter:j,wordTypeFilter:U,matchesWordAttributes:Ue,poolVersion:P,filterSections:ft,filterSelected:Ke,handleFilterSelect:rt,phonemeView:h,setPhonemeView:te,phonemeGroupLabel:M.phonemeGroup,wordCount:me,getFilterSnapshot:ut,restoreFilterSnapshot:ae}}function qd(e){const t=l=>l?pt(l):null,n=t(e.cho),o=t(e.jung),r=e.jong===nt,u=r?null:t(e.jong),i=e.syllable!=null?Co(e.syllable):null;return!n&&!o&&!u&&!r&&!i?null:{cho:n,jung:o,jong:u,jongNone:r,syllable:i}}function Wd(e,t,n,o,r,u,i=!0,l="char",s=[]){const[p,h]=B({}),[f,c]=B(!1),{cho:y=null,jung:b=null,jong:w=null,syllable:g=null}=o??{};return X(()=>{u>0&&za(r).catch(()=>{})},[u,r]),X(()=>{let m=!1;return c(!0),(async()=>{const E=qd({cho:y,jung:b,jong:w,syllable:g}),k=s.length>0?s.slice().sort().join(","):"",x=`${y??""}_${b??""}_${w??""}_${g??""}_${k}`,R={};await Promise.all(e.map(async v=>{const j=Wn[v.key];try{const H=await yr(v.key,{difficulty:j.difficulty?t:null,contrastCount:j.difficulty?n:1,composition:j.choseong?E:null,count:5,excludeNoImage:r,sameStructureOnly:i,phonemeView:l,grade:s.length>0?s:null});H&&H.length>0?R[v.key]={id:`wt-${v.key}-${t}-${x}-${Date.now()}`,name:v.label,training_type:v.key,category_main_code:"WORD",iconColor:v.color,subTitle:v.subTitle,items:H,itemCount:H.length}:R[v.key]={id:`wt-${v.key}-empty`,name:v.label,training_type:v.key,category_main_code:"WORD",iconColor:v.color,subTitle:v.subTitle,items:[],itemCount:0,__empty:!0}}catch{R[v.key]=null}})),m||(h(R),c(!1))})(),()=>{m=!0}},[t,n,y,b,w,g,r,i,l,u,s]),{perTypeData:p,generating:f}}function Kd(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0}function Xd(e){let t=e>>>0;return()=>{t|=0,t=t+1831565813|0;let n=Math.imul(t^t>>>15,1|t);return n=n+Math.imul(n^n>>>7,61|n)^n,((n^n>>>14)>>>0)/4294967296}}const On=dt;function _o(e,t){const n=t?Xd(Kd(t)):Math.random;return{LISTEN_IN_NOISE:On(rn,Math.max(0,e.LISTEN_IN_NOISE||0),n),SHORT_STORY:On(un,Math.max(0,e.SHORT_STORY||0),n),LONG_STORY:On(an,Math.max(0,e.LONG_STORY||0),n),ORDERING_SENTENCE:On(ln,Math.max(0,e.ORDERING_SENTENCE||0),n)}}function iu(e){return e?!!(e.LISTEN_IN_NOISE?.length||e.SHORT_STORY?.length||e.LONG_STORY?.length||e.ORDERING_SENTENCE?.length):!1}const Zd={LISTEN_IN_NOISE:3,SHORT_STORY:2,LONG_STORY:1,ORDERING_SENTENCE:2};function lu(e=!1,t=Zd,n){const o=Dn(Date.now()),r=Dn(Date.now()-864e5),u=`${n??""}|${o}`,i=`${n??""}|${r}`;return rn.length>0||un.length>0||an.length>0||ln.length>0?{today:_o(t,u),yesterday:_o(t,i)}:{today:_o(t,u),yesterday:null}}function Jd(e){const t=Oe({LISTEN_IN_NOISE:[],SHORT_STORY:[],LONG_STORY:[],ORDERING_SENTENCE:[]}),n=Oe(null),[o,r]=B(!1),[u,i]=B(!1),[l,s]=B(0);X(()=>{let h=!1,f,c=0;const y=40,b=()=>{f!==void 0&&(clearInterval(f),f=void 0)};let w=!1;try{const E=new URLSearchParams(window.location.search),k=E.get("forceRefresh")||E.get("force");w=k==="1"||k==="true"}catch{}const g=E=>{t.current=E.today,n.current=E.yesterday,r(!0),s(k=>k+1),h=!0,b()},m=async()=>{if(h)return;if(!w){const k=lu(!1,void 0,e);if(iu(k.today)){g(k);return}}try{await gd(3e3)}catch{}if(h)return;const E=lu(w,void 0,e);if(iu(E.today)){g(E);return}++c>=y&&(r(!0),h=!0,b())};return m(),f=setInterval(m,250),()=>{h=!0,b()}},[e]);const p=q(h=>{const f=u?n.current:t.current,c=u?t.current:n.current;return f?.[h]?.length?f[h]:c?.[h]?.length?c[h]:void 0},[u,l]);return{loaded:o,showYesterday:u,setShowYesterday:i,getTrainingPerType:p}}const $t=[];let Ln=!1;function cu(e){if(e.key!=="Escape"||e.defaultPrevented)return;const t=$t[$t.length-1];t&&(e.stopPropagation(),t())}function Qd(e){return $t.push(e),!Ln&&typeof document<"u"&&(document.addEventListener("keydown",cu),Ln=!0),()=>{const t=$t.lastIndexOf(e);t>=0&&$t.splice(t,1),$t.length===0&&Ln&&typeof document<"u"&&(document.removeEventListener("keydown",cu),Ln=!1)}}function eh(e,t=!0){const n=Ho(e);X(()=>{if(t)return Qd(()=>{n.current?.()})},[t,n])}const Eo=(e,t)=>`${e}:${t??1}`,bo=new Map;function th(e,t){const[n,o]=B(0),r=e.map(u=>Eo(u.word,u.homonum)).join("|");return X(()=>{const u=(r?r.split("|"):[]).filter(s=>!bo.has(s));if(u.length===0)return;let i=!1;const l=Array.from(new Set(u.map(s=>s.slice(0,s.lastIndexOf(":")))));return t(l).then(s=>{if(!(i||s.length===0)){for(const p of s)p.Meaning&&bo.set(Eo(p.Word,p.Homonum??void 0),p.Meaning);o(p=>p+1)}}),()=>{i=!0}},[r,t]),we(()=>{const u=r?r.split("|"):[],i=new Map;for(const l of u){const s=bo.get(l);s!=null&&i.set(l,s)}return i},[r,n])}function nh(e,t,n){const o=Number.isFinite(t)&&t>=1?Math.floor(t):1,r=Math.max(1,Math.ceil(e.length/o)),u=Number.isFinite(n)?Math.min(Math.max(1,Math.floor(n)),r):1;return{pageItems:we(()=>e.slice((u-1)*o,u*o),[e,u,o]),totalPages:r,curPage:u}}function oh(e="warning"){const[t,n]=B(""),[o,r]=B(e),[u,i]=B(0),l=q((f,c)=>{r(c),n(f),i(y=>y+1)},[]),s=q(f=>l(f,"warning"),[l]),p=q(f=>l(f,"normal"),[l]),h=q(()=>n(""),[]);return{toastMessage:t,toastType:o,toastKey:u,showToast:l,showWarning:s,showNormal:p,clearToast:h}}const sn={blue:"#60A5FA",green:"#4ADE80",amber:"#FBBF24",purple:"#A78BFA",pink:"#F472B6"},dn=sn.blue,Rn=sn.green,hn=sn.amber,In=sn.purple,rh=sn.pink,uh=[{key:"discrimination",label:"\uBCC0\uBCC4\uD6C8\uB828",disc:"\uB450 \uC18C\uB9AC\uAC00 \uAC19\uC740\uC9C0 \uB2E4\uB978\uC9C0, \uB610\uB294 \uD2B9\uC815 \uC18C\uB9AC\uB97C \uAD6C\uBCC4\uD558\uB294 \uD6C8\uB828\uC785\uB2C8\uB2E4.",icon:"ear",types:[{key:"SAME_SOUND_PICK",label:"\uAC19\uC740 \uC18C\uB9AC \uACE0\uB974\uAE30",icon:"volume-2",color:dn,subTitle:"\uB4E4\uC740 \uC18C\uB9AC\uC640 \uAC19\uC740 \uB2E8\uC5B4 \uCE74\uB4DC\uB97C \uACE0\uB974\uC138\uC694."},{key:"SAME_OR_DIFF",label:"\uAC19\uC740\uC9C0 \uB2E4\uB978\uC9C0 \uB9DE\uD788\uAE30",icon:"diff",color:dn,subTitle:"\uB450 \uC18C\uB9AC\uAC00 \uAC19\uC740\uC9C0, \uB2E4\uB978\uC9C0 \uAD6C\uBD84\uD558\uC138\uC694."},{key:"HEAR_AND_PICK_SAME",label:"\uC77C\uCE58\uD558\uB294 \uB2E8\uC5B4 \uB9DE\uD788\uAE30",icon:"headphones",color:dn,subTitle:"\uB4E4\uC740 \uC18C\uB9AC\uC758 \uB2E8\uC5B4 \uCE74\uB4DC\uB97C \uACE0\uB974\uC138\uC694."},{key:"HEAR_AND_PICK_INCLUDED",label:"\uD55C \uC74C\uC808 \uD3EC\uD568 \uB2E8\uC5B4 \uB9DE\uD788\uAE30",icon:"scan-search",color:dn,subTitle:"\uB4E4\uC740 \uC74C\uC808\uC774 \uD3EC\uD568\uB41C \uB2E8\uC5B4 \uCE74\uB4DC\uB97C \uACE0\uB974\uC138\uC694."},{key:"STARTS_WITH_SAME_SOUND",label:"\uCCAB \uC74C\uC808\uC774 \uAC19\uC740 \uB2E8\uC5B4 \uB9DE\uD788\uAE30",icon:"play-circle",color:dn,subTitle:"\uB4E4\uC740 \uB2E8\uC5B4\uC640 \uAC19\uC740 \uC18C\uB9AC\uB85C \uC2DC\uC791\uD558\uB294 \uB2E8\uC5B4\uB97C \uACE0\uB974\uC138\uC694."}]},{key:"synthesis",label:"\uD569\uC131\uD6C8\uB828",disc:"\uB450 \uAC1C \uC774\uC0C1\uC758 \uC74C\uC808\uC774\uB098 \uC74C\uC18C\uB97C \uD569\uCCD0 \uB2E8\uC5B4\uB97C \uB9CC\uB4DC\uB294 \uD6C8\uB828\uC785\uB2C8\uB2E4.",icon:"git-merge",types:[{key:"MERGE_2_SYLLABLES",label:"\uC74C\uC808 2\uAC1C \uD569\uCE58\uAE30",icon:"link-2",color:Rn,subTitle:"\uB450 \uC74C\uC808\uC744 \uD569\uCE58\uBA74 \uC5B4\uB5A4 \uB2E8\uC5B4\uAC00 \uB420\uAE4C\uC694?"},{key:"MERGE_3_SYLLABLES",label:"\uC74C\uC808 3\uAC1C \uD569\uCE58\uAE30",icon:"git-merge",color:Rn,subTitle:"\uC138 \uC74C\uC808\uC744 \uD569\uCE58\uBA74 \uC5B4\uB5A4 \uB2E8\uC5B4\uAC00 \uB420\uAE4C\uC694?"},{key:"MERGE_2_PHONEMES",label:"\uC74C\uC18C 2\uAC1C \uD569\uCE58\uAE30",icon:"combine",color:Rn,subTitle:"\uB450 \uC74C\uC18C\uB97C \uD569\uCE58\uBA74 \uC5B4\uB5A4 \uC18C\uB9AC\uAC00 \uB420\uAE4C\uC694?"},{key:"MERGE_3_PHONEMES",label:"\uC74C\uC18C 3\uAC1C \uD569\uCE58\uAE30",icon:"braces",color:Rn,subTitle:"\uC138 \uC74C\uC18C\uB97C \uD569\uCE58\uBA74 \uC5B4\uB5A4 \uC18C\uB9AC\uAC00 \uB420\uAE4C\uC694?"}]},{key:"deletion",label:"\uD0C8\uB77D\uD6C8\uB828",disc:"\uB2E8\uC5B4\uC5D0\uC11C \uC74C\uC808\uC774\uB098 \uC74C\uC18C\uB97C \uC81C\uAC70\uD588\uC744 \uB54C \uB0A8\uB294 \uC18C\uB9AC\uB97C \uC778\uC2DD\uD558\uB294 \uD6C8\uB828\uC785\uB2C8\uB2E4.",icon:"scissors",types:[{key:"DROP_1_FROM_2SYLL",label:"2\uC74C\uC808\uC5D0\uC11C 1\uC74C\uC808 \uD0C8\uB77D",icon:"scissors",color:hn,subTitle:"2\uC74C\uC808 \uB2E8\uC5B4\uC5D0\uC11C \uD55C \uC74C\uC808\uC744 \uBE7C\uBA74 \uC5B4\uB5A4 \uC18C\uB9AC\uAC00 \uB420\uAE4C\uC694?"},{key:"DROP_1_FROM_3SYLL",label:"3\uC74C\uC808\uC5D0\uC11C 1\uC74C\uC808 \uD0C8\uB77D",icon:"minus-circle",color:hn,subTitle:"3\uC74C\uC808 \uB2E8\uC5B4\uC5D0\uC11C \uD55C \uC74C\uC808\uC744 \uBE7C\uBA74 \uC5B4\uB5A4 \uC18C\uB9AC\uAC00 \uB420\uAE4C\uC694?"},{key:"DROP_PART_FROM_COMPOUND",label:"\uD569\uC131\uC5B4\uC5D0\uC11C \uBD80\uBD84\uD0C8\uB77D",icon:"unlink",color:hn,subTitle:"\uD569\uC131\uC5B4\uC758 \uC77C\uBD80\uB97C \uBE7C\uBA74 \uC5B4\uB5A4 \uB2E8\uC5B4\uAC00 \uB420\uAE4C\uC694?"},{key:"DROP_FINAL_CONSONANT_FROM_1SYLL",label:"1\uC74C\uC808\uC5D0\uC11C \uBC1B\uCE68 \uD0C8\uB77D",icon:"eraser",color:hn,subTitle:"\uBC1B\uCE68\uC744 \uBE7C\uBA74 \uC5B4\uB5A4 \uC18C\uB9AC\uAC00 \uB420\uAE4C\uC694?"},{key:"REMOVE_CONSONANT_AND_IDENTIFY_PHONEME",label:"1\uC74C\uC808\uC5D0\uC11C \uC790\uC74C \uD0C8\uB77D",icon:"audio-lines",color:hn,subTitle:"\uC790\uC74C\uC744 \uBE7C\uBA74 \uC5B4\uB5A4 \uC18C\uB9AC\uAC00 \uB0A8\uC744\uAE4C\uC694?"}]},{key:"substitution",label:"\uB300\uCE58\uD6C8\uB828",disc:"\uB2E8\uC5B4\uC758 \uC77C\uBD80 \uC74C\uC808\uC774\uB098 \uC74C\uC18C\uB97C \uBC14\uAFB8\uC5B4 \uC0C8\uB85C\uC6B4 \uC18C\uB9AC\uB97C \uB9CC\uB4DC\uB294 \uD6C8\uB828\uC785\uB2C8\uB2E4.",icon:"replace",types:[{key:"CHANGE_1_SYLL_IN_2SYLL",label:"2\uC74C\uC808\uC5D0\uC11C \uD55C \uC74C\uC808 \uBC14\uAFB8\uAE30",icon:"replace",color:In,subTitle:"2\uC74C\uC808 \uB2E8\uC5B4\uC758 \uD55C \uC74C\uC808\uC744 \uBC14\uAFD4 \uC0C8 \uB2E8\uC5B4\uB97C \uB9CC\uB4DC\uC138\uC694."},{key:"CHANGE_1_SYLL_IN_3SYLL",label:"3\uC74C\uC808\uC5D0\uC11C \uD55C \uC74C\uC808 \uBC14\uAFB8\uAE30",icon:"shuffle",color:In,subTitle:"3\uC74C\uC808 \uB2E8\uC5B4\uC758 \uD55C \uC74C\uC808\uC744 \uBC14\uAFD4 \uC0C8 \uB2E8\uC5B4\uB97C \uB9CC\uB4DC\uC138\uC694."},{key:"CHANGE_1_PHONEME_IN_1SYLL",label:"1\uC74C\uC808\uC5D0\uC11C \uD55C \uC74C\uC18C \uBC14\uAFB8\uAE30",icon:"arrow-right-left",color:In,subTitle:"1\uC74C\uC808 \uB2E8\uC5B4\uC758 \uD55C \uC74C\uC18C\uB97C \uBC14\uAFD4 \uC0C8 \uC18C\uB9AC\uB97C \uB9CC\uB4DC\uC138\uC694."},{key:"CHANGE_1_PHONEME_IN_2SYLL",label:"2\uC74C\uC808\uC5D0\uC11C \uD55C \uC74C\uC18C \uBC14\uAFB8\uAE30",icon:"flip-horizontal",color:In,subTitle:"2\uC74C\uC808 \uB2E8\uC5B4\uC758 \uD55C \uC74C\uC18C\uB97C \uBC14\uAFD4 \uC0C8 \uB2E8\uC5B4\uB97C \uB9CC\uB4DC\uC138\uC694."}]},{key:"attention",label:"\uCCAD\uAC01\uC801\uC8FC\uC758\uB825\uD6C8\uB828",disc:"\uC5EC\uB7EC \uC18C\uB9AC\uB97C \uB4E3\uACE0 \uC21C\uC11C\uB97C \uAE30\uC5B5\uD558\uB294 \uC8FC\uC758\uB825\uACFC \uB2E8\uAE30 \uAE30\uC5B5 \uD6C8\uB828\uC785\uB2C8\uB2E4.",icon:"list-ordered",types:[{key:"LISTEN_AND_REMEMBER_ORDER",label:"\uB4E3\uACE0 \uC21C\uC11C\uB300\uB85C \uAE30\uC5B5\uD558\uAE30",icon:"list-ordered",color:rh,subTitle:"\uC138 \uB2E8\uC5B4\uB97C \uB4E4\uC740 \uC21C\uC11C\uB300\uB85C \uCE74\uB4DC\uB97C \uC120\uD0DD\uD558\uC138\uC694."}]}];function ah(){const{t:e}=kt();return we(()=>{const t=Object.fromEntries(bd(e).map(o=>[o.key,o.label])),n={...t};return uh.flatMap(o=>o.types).forEach(o=>{n[o.key]=e(`trainingType.${o.key}.label`,{defaultValue:o.label})}),{sentence:t,all:n}},[e])}export{Xo as CACHE_GROUPS,Uo as DocumentTitleSuppressContext,go as EMPTY_COMPOSITION,Fo as MediaQueryOverrideContext,nt as NO_CODA,ot as SYLLABLE_MIN,er as VAP_PAGE_SIZE_OPTIONS,Xr as buildGradeSection,Zr as buildPartOfSpeechSection,xd as buildPositionSection,Dd as buildSelectSection,Bd as buildSyllableSection,Jr as buildWordTypeSection,ou as charToPronValue,uu as convertComposition,qu as fmtBytes,Zo as lsBytes,Eo as meaningKey,ru as pronToCharValue,Co as syllableToFilter,Kt as today,vd as toggleAttributeFilter,Wu as useCacheManagement,Jd as useDailyTrainingSelection,Md as useDelayedHoverAnchor,oa as useDeviceManagement,Du as useDocumentTitle,eh as useEscToClose,Mu as useFontScale,Wr as useHoverAnchor,Bu as useMediaQuery,nh as usePagedList,vu as usePasswordChange,xu as useRelativeDay,ta as useTablePaging,na as useTableSort,oh as useToastState,ah as useTrainingTypeLabels,ea as useVisitAllPanel,Zu as useVisitHistory,Qu as useVisitSchedule,zo as useWindowEvent,Kr as useWordAttributeFilterKeys,Ku as useWordDataStats,th as useWordMeanings,Wd as useWordTrainingDataGeneration,Yd as useWordTrainingFilter,pt as valueToJamos};
|
|
781
|
+
*/const b0=[["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}],["path",{d:"M7 10v12",key:"1qc93n"}]],k0=C("thumbs-up",b0),kr={"alert-triangle":_r,"align-start-vertical":ei,anchor:L1,"arrow-down":ni,"arrow-left":ri,"arrow-right":ai,"arrow-right-left":li,"arrow-up-a-z":I1,"audio-lines":si,baby:hi,ban:fi,"bar-chart-2":P1,bell:yi,"book-marked":gi,"book-open":Ei,"bow-arrow":ki,braces:wi,bug:Ni,calendar:F1,"calendar-check":Ti,"calendar-days":Di,camera:vi,car:z1,"chart-column":Li,"chart-line":Ii,"chart-pie":Pi,check:Fi,"chevron-down":s0,"chevron-left":zi,"chevron-right":Ui,"chevron-up":h0,circle:f0,"clipboard-list":Yi,coffee:U1,combine:Wi,copy:Xi,"credit-card":Ji,database:el,diff:nl,download:rl,ear:al,edit:ll,"edit-2":sl,"edit-3":hl,ellipsis:Er,eraser:Cl,"external-link":ml,eye:_l,"file-text":bl,"flip-horizontal":Al,"folder-open":Sl,"folder-plus":Ml,gamepad:Bl,"gamepad-2":Y1,gavel:xl,"git-merge":Ol,globe:Rl,headphones:jl,heart:$l,home:Hl,inbox:W1,info:Vl,"key-round":Gl,landmark:ql,layers:Kl,"layout-dashboard":Zl,leaf:Ql,lightbulb:tc,link:oc,"link-2":uc,"link-2-off":ic,list:cc,"list-checks":dc,"list-ordered":pc,"list-tree":X1,loader:Cc,"log-out":mc,mail:_c,"map-pin":bc,menu:g0,"message-circle":Ac,"message-circle-question-mark":Sc,"message-square":Mc,"message-square-more":J1,"message-square-text":Bc,minus:e0,"minus-circle":xc,moon:E0,"more-horizontal":Er,package:Oc,palette:Rc,"party-popper":jc,pause:$c,pencil:Hc,phone:Vc,play:Gc,"play-circle":qc,plus:Kc,printer:Zc,"refresh-cw":Qc,repeat:ts,replace:os,rocket:us,"rotate-ccw":is,"rotate-cw":cs,salad:ds,"scan-search":ps,search:gs,"circle-alert":br,"alert-circle":br,"check-circle":ys,scissors:Es,"search-x":ks,send:ws,settings:Ns,"share-2":n0,"shield-check":Ts,"shopping-cart":Ds,shuffle:vs,"skip-back":Ls,"skip-forward":Is,sparkles:r0,square:Ps,star:Fs,store:zs,"sun-medium":Us,table:Ys,"table-2":Ws,terminal:Xs,"text-cursor-input":Js,"text-initial":e1,"thumbs-up":k0,ticket:n1,triangle:y0,"trash-2":r1,"trending-up":a1,"triangle-alert":_r,trophy:l1,type:a0,unlink:s1,upload:h1,user:f1,"user-plus":y1,"user-round":g1,"user-round-check":E1,users:k1,"users-round":w1,volume:l0,"volume-2":N1,wrench:T1,x:D1,zap:v1};function A0(e){return kr[e]??null}const Ar=new Set,w0=(()=>{try{if(import.meta.env?.DEV)return!0}catch{}try{const e=globalThis;return e.process!=null&&e.process.env?.NODE_ENV!=="production"}catch{return!1}})();function S0(e){return w0&&!(e in kr)&&!Ar.has(e)&&(Ar.add(e),console.warn(`[ihabdevteam-core] lucide \uC544\uC774\uCF58 '${e}' \uC774 \uC815\uC801 \uBAA9\uB85D\uC5D0 \uC5C6\uC5B4 \uB80C\uB354\uB418\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4. utils/lucideIconSet.ts \uC758 STATIC_LUCIDE_ICONS \uC5D0 \uCD94\uAC00\uD558\uC138\uC694.`)),Promise.resolve(null)}const N0=e=>e.replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Za-z])([0-9])/g,"$1-$2").replace(/[_ ]+/g,"-").toLowerCase();function M0(e){const t=e.toLowerCase();if(t.startsWith("http://")||t.startsWith("https://")||t.startsWith("data:")||e.includes("/assets/"))return null;const n=(e.split("/").pop()||"").replace(/\.svg$/,"");return n?N0(n):null}const wr=new Map;function T0(e){const t=typeof e=="string"?M0(e):null,n=t?A0(t)??wr.get(t)??null:null,[o,r]=B(null);return X(()=>{if(!t||n)return;let u=!1;return S0(t).then(i=>{wr.set(t,i),u||r(i)}),()=>{u=!0}},[t,n]),n??o}/*! @license DOMPurify 3.4.14 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.14/LICENSE */function Sr(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n<t;n++)o[n]=e[n];return o}function B0(e){if(Array.isArray(e))return e}function D0(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var o,r,u,i,l=[],c=!0,f=!1;try{if(u=(n=n.call(e)).next,t!==0)for(;!(c=(o=u.call(n)).done)&&(l.push(o.value),l.length!==t);c=!0);}catch(h){f=!0,r=h}finally{try{if(!c&&n.return!=null&&(i=n.return(),Object(i)!==i))return}finally{if(f)throw r}}return l}}function x0(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
782
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function v0(e,t){return B0(e)||D0(e,t)||O0(e,t)||x0()}function O0(e,t){if(e){if(typeof e=="string")return Sr(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Sr(e,t):void 0}}const Nr=Object.entries,Mr=Object.setPrototypeOf,L0=Object.isFrozen,R0=Object.getPrototypeOf,I0=Object.getOwnPropertyDescriptor;let ye=Object.freeze,Ee=Object.seal,jt=Object.create,Tr=typeof Reflect<"u"&&Reflect,no=Tr.apply,oo=Tr.construct;ye||(ye=function(t){return t}),Ee||(Ee=function(t){return t}),no||(no=function(t,n){for(var o=arguments.length,r=new Array(o>2?o-2:0),u=2;u<o;u++)r[u-2]=arguments[u];return t.apply(n,r)}),oo||(oo=function(t){for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];return new t(...o)});const Nt=pe(Array.prototype.forEach),j0=pe(Array.prototype.lastIndexOf),Br=pe(Array.prototype.pop),en=pe(Array.prototype.push),P0=pe(Array.prototype.splice),Pt=Array.isArray,tn=pe(String.prototype.toLowerCase),ro=pe(String.prototype.toString),Dr=pe(String.prototype.match),nn=pe(String.prototype.replace),xr=pe(String.prototype.indexOf),$0=pe(String.prototype.trim),F0=pe(Number.prototype.toString),H0=pe(Boolean.prototype.toString),vr=typeof BigInt>"u"?null:pe(BigInt.prototype.toString),Or=typeof Symbol>"u"?null:pe(Symbol.prototype.toString),Le=pe(Object.prototype.hasOwnProperty),on=pe(Object.prototype.toString),Me=pe(RegExp.prototype.test),Mt=z0(TypeError);function pe(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];return no(e,t,o)}}function z0(e){return function(){for(var t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];return oo(e,n)}}function J(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:tn;if(Mr&&Mr(e,null),!Pt(t))return e;let o=t.length;for(;o--;){let r=t[o];if(typeof r=="string"){const u=n(r);u!==r&&(L0(t)||(t[o]=u),r=u)}e[r]=!0}return e}function V0(e){for(let t=0;t<e.length;t++)Le(e,t)||(e[t]=null);return e}function $e(e){const t=jt(null);for(const o of Nr(e)){var n=v0(o,2);const r=n[0],u=n[1];Le(e,r)&&(Pt(u)?t[r]=V0(u):u&&typeof u=="object"&&u.constructor===Object?t[r]=$e(u):t[r]=u)}return t}function U0(e){switch(typeof e){case"string":return e;case"number":return F0(e);case"boolean":return H0(e);case"bigint":return vr?vr(e):"0";case"symbol":return Or?Or(e):"Symbol()";case"undefined":return on(e);case"function":case"object":{if(e===null)return on(e);const t=e,n=We(t,"toString");if(typeof n=="function"){const o=n(t);return typeof o=="string"?o:on(o)}return on(e)}default:return on(e)}}function We(e,t){for(;e!==null;){const o=I0(e,t);if(o){if(o.get)return pe(o.get);if(typeof o.value=="function")return pe(o.value)}e=R0(e)}function n(){return null}return n}function G0(e){try{return Me(e,""),!0}catch{return!1}}const Lr=ye(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),uo=ye(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),ao=ye(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Y0=ye(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),io=ye(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),q0=ye(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Rr=ye(["#text"]),Ir=ye(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),lo=ye(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","pointer-events","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","vector-effect","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),jr=ye(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Bn=ye(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),W0=Ee(/{{[\w\W]*|^[\w\W]*}}/g),K0=Ee(/<%[\w\W]*|^[\w\W]*%>/g),X0=Ee(/\${[\w\W]*/g),Z0=Ee(/^data-[\-\w.\u00B7-\uFFFF]+$/),J0=Ee(/^aria-[\-\w]+$/),Pr=Ee(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Q0=Ee(/^(?:\w+script|data):/i),ed=Ee(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),td=Ee(/^html$/i),nd=Ee(/^[a-z][.\w]*(-[.\w]+)+$/i),$r=Ee(/<[/\w!]/g),Fr=Ee(/<[/\w]/g),od=Ee(/<\/no(script|embed|frames)/i),rd=Ee(/\/>/i),Fe={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Hr=["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"],ud=ye(J({},Hr)),ad=(function(){const e={};return Nt(Hr,t=>{e[t]=Ee(new RegExp("</"+t+"(?=[\\t\\n\\f\\r />])","i"))}),ye(e)})(),id=function(){return typeof window>"u"?null:window},ld=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let o=null;const r="data-tt-policy-suffix";n&&n.hasAttribute(r)&&(o=n.getAttribute(r));const u="dompurify"+(o?"#"+o:"");try{return t.createPolicy(u,{createHTML(i){return i},createScriptURL(i){return i}})}catch{return console.warn("TrustedTypes policy "+u+" could not be created."),null}},zr=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},gt=function(t,n,o,r){return Le(t,n)&&Pt(t[n])?J(r.base?$e(r.base):{},t[n],r.transform):o},co=function(t,n,o){const r=Le(t,n)?t[n]:void 0;return r&&typeof r=="object"?$e(r):o()};function Vr(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:id();const t=N=>Vr(N);if(t.version="3.4.14",t.removed=[],!e||!e.document||e.document.nodeType!==Fe.document||!e.Element)return t.isSupported=!1,t;let n=e.document;const o=n,r=o.currentScript;e.DocumentFragment;const u=e.HTMLTemplateElement,i=e.Node,l=e.Element,c=e.NodeFilter,f=e.NamedNodeMap;f===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;const h=e.DOMParser,p=e.trustedTypes,s=l.prototype,y=We(s,"cloneNode"),b=We(s,"remove"),w=We(s,"nextSibling"),g=We(s,"childNodes"),m=We(s,"parentNode"),E=We(s,"shadowRoot"),k=We(s,"attributes"),x=i&&i.prototype?We(i.prototype,"nodeType"):null,R=i&&i.prototype?We(i.prototype,"nodeName"):null,v=i&&i.prototype?We(i.prototype,"ownerDocument"):null,j=function(a){return x?x(a):a.nodeType},H=function(a){return R?R(a):a.nodeName};if(typeof u=="function"){const N=n.createElement("template");N.content&&N.content.ownerDocument&&(n=N.content.ownerDocument)}let U,F="",Q,G=!1,W=0;const z=function(){if(W>0)throw Mt('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},D=function(a){z(),W++;try{return U.createHTML(a)}finally{W--}},O=function(a){z(),W++;try{return U.createScriptURL(a)}finally{W--}},me=function(){return G||(Q=ld(p,r),G=!0),Q},Z=n,ee=Z.implementation,S=Z.createNodeIterator,P=Z.createDocumentFragment,re=Z.getElementsByTagName,ue=o.importNode;let Y=zr();t.isSupported=typeof Nr=="function"&&typeof m=="function"&&ee&&ee.createHTMLDocument!==void 0;const Ae=W0,M=K0,fe=X0,Ce=Z0,He=J0,ft=Q0,Ke=ed,rt=nd;let Ue=Pr,te=null;const ut=J({},[...Lr,...uo,...ao,...io,...Rr]);let ae=null;const A=J({},[...Ir,...lo,...jr,...Bn]);let L=Object.seal(jt(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),$=null,K=null;const ne=Object.seal(jt(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let De=!0,Te=!0,Xe=!1,Ge=!0,ge=!1,ze=!0,Re=!1,Ct=!1,Ze=null,at=null,it=!1,lt=!1,Tt=!1,Et=!1,Ft=!0,_e=!1;const Bt="user-content-";let Dt=!0,ct=!1,yt={},Je=null;const ie=J({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let Qe=null;const Ht=J({},["audio","video","img","source","image","track"]);let xt=null;const ko=J({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),pn="http://www.w3.org/1998/Math/MathML",fn="http://www.w3.org/2000/svg",et="http://www.w3.org/1999/xhtml";let vt=et,jn=!1,Pn=null;const su=J({},[pn,fn,et],ro),Ao=ye(["mi","mo","mn","ms","mtext"]);let $n=J({},Ao);const wo=ye(["annotation-xml"]);let Fn=J({},wo);const du=J({},["title","style","font","a","script"]);let zt=null;const hu=["application/xhtml+xml","text/html"],pu="text/html";let he=null,Ot=null;const fu=n.createElement("form"),So=function(a){return a instanceof RegExp||a instanceof Function},Hn=function(){let a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Ot&&Ot===a)return;(!a||typeof a!="object")&&(a={}),a=$e(a),zt=hu.indexOf(a.PARSER_MEDIA_TYPE)===-1?pu:a.PARSER_MEDIA_TYPE,he=zt==="application/xhtml+xml"?ro:tn,te=gt(a,"ALLOWED_TAGS",ut,{transform:he}),ae=gt(a,"ALLOWED_ATTR",A,{transform:he}),Pn=gt(a,"ALLOWED_NAMESPACES",su,{transform:ro}),xt=gt(a,"ADD_URI_SAFE_ATTR",ko,{transform:he,base:ko}),Qe=gt(a,"ADD_DATA_URI_TAGS",Ht,{transform:he,base:Ht}),Je=gt(a,"FORBID_CONTENTS",ie,{transform:he}),$=gt(a,"FORBID_TAGS",$e({}),{transform:he}),K=gt(a,"FORBID_ATTR",$e({}),{transform:he}),yt=Le(a,"USE_PROFILES")?a.USE_PROFILES&&typeof a.USE_PROFILES=="object"?$e(a.USE_PROFILES):a.USE_PROFILES:!1,De=a.ALLOW_ARIA_ATTR!==!1,Te=a.ALLOW_DATA_ATTR!==!1,Xe=a.ALLOW_UNKNOWN_PROTOCOLS||!1,Ge=a.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ge=a.SAFE_FOR_TEMPLATES||!1,ze=a.SAFE_FOR_XML!==!1,Re=a.WHOLE_DOCUMENT||!1,lt=a.RETURN_DOM||!1,Tt=a.RETURN_DOM_FRAGMENT||!1,Et=a.RETURN_TRUSTED_TYPE||!1,it=a.FORCE_BODY||!1,Ft=a.SANITIZE_DOM!==!1,_e=a.SANITIZE_NAMED_PROPS||!1,Dt=a.KEEP_CONTENT!==!1,ct=a.IN_PLACE||!1,Ue=G0(a.ALLOWED_URI_REGEXP)?a.ALLOWED_URI_REGEXP:Pr,vt=typeof a.NAMESPACE=="string"?a.NAMESPACE:et,$n=co(a,"MATHML_TEXT_INTEGRATION_POINTS",()=>J({},Ao)),Fn=co(a,"HTML_INTEGRATION_POINTS",()=>J({},wo));const d=co(a,"CUSTOM_ELEMENT_HANDLING",()=>jt(null));if(L=jt(null),Le(d,"tagNameCheck")&&So(d.tagNameCheck)&&(L.tagNameCheck=d.tagNameCheck),Le(d,"attributeNameCheck")&&So(d.attributeNameCheck)&&(L.attributeNameCheck=d.attributeNameCheck),Le(d,"allowCustomizedBuiltInElements")&&typeof d.allowCustomizedBuiltInElements=="boolean"&&(L.allowCustomizedBuiltInElements=d.allowCustomizedBuiltInElements),Ee(L),ge&&(Te=!1),Tt&&(lt=!0),yt&&(te=J({},Rr),ae=jt(null),yt.html===!0&&(J(te,Lr),J(ae,Ir)),yt.svg===!0&&(J(te,uo),J(ae,lo),J(ae,Bn)),yt.svgFilters===!0&&(J(te,ao),J(ae,lo),J(ae,Bn)),yt.mathMl===!0&&(J(te,io),J(ae,jr),J(ae,Bn))),ne.tagCheck=null,ne.attributeCheck=null,Le(a,"ADD_TAGS")&&(typeof a.ADD_TAGS=="function"?ne.tagCheck=a.ADD_TAGS:Pt(a.ADD_TAGS)&&(te===ut&&(te=$e(te)),J(te,a.ADD_TAGS,he))),Le(a,"ADD_ATTR")&&(typeof a.ADD_ATTR=="function"?ne.attributeCheck=a.ADD_ATTR:Pt(a.ADD_ATTR)&&(ae===A&&(ae=$e(ae)),J(ae,a.ADD_ATTR,he))),Le(a,"ADD_FORBID_CONTENTS")&&Pt(a.ADD_FORBID_CONTENTS)&&(Je===ie&&(Je=$e(Je)),J(Je,a.ADD_FORBID_CONTENTS,he)),Dt&&(te["#text"]=!0),Re&&J(te,["html","head","body"]),te.table&&(J(te,["tbody"]),delete $.tbody),a.TRUSTED_TYPES_POLICY){if(typeof a.TRUSTED_TYPES_POLICY.createHTML!="function")throw Mt('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof a.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Mt('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const _=U;U=a.TRUSTED_TYPES_POLICY;try{F=D("")}catch(T){throw U=_,T}}else a.TRUSTED_TYPES_POLICY===null?(U=void 0,F=""):(U===void 0&&(U=me()),U&&typeof F=="string"&&(F=D("")));ye&&ye(a),Ot=a},No=J({},[...uo,...ao,...Y0]),Mo=J({},[...io,...q0]),Cu=function(a,d,_){return d.namespaceURI===et?a==="svg":d.namespaceURI===pn?a==="svg"&&(_==="annotation-xml"||$n[_]):!!No[a]},yu=function(a,d,_){return d.namespaceURI===et?a==="math":d.namespaceURI===fn?a==="math"&&Fn[_]:!!Mo[a]},mu=function(a,d,_){return d.namespaceURI===fn&&!Fn[_]||d.namespaceURI===pn&&!$n[_]?!1:!Mo[a]&&(du[a]||!No[a])},gu=function(a){let d=m(a);(!d||!d.tagName)&&(d={namespaceURI:vt,tagName:"template"});const _=tn(a.tagName),T=tn(d.tagName);return Pn[a.namespaceURI]?a.namespaceURI===fn?Cu(_,d,T):a.namespaceURI===pn?yu(_,d,T):a.namespaceURI===et?mu(_,d,T):!!(zt==="application/xhtml+xml"&&Pn[a.namespaceURI]):!1},mt=function(a){en(t.removed,{element:a});try{m(a).removeChild(a)}catch{if(b(a),!m(a))throw Mt("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},To=function(a,d,_){try{a.removeAttributeNode(d)}catch{try{a.removeAttribute(_)}catch{}}},Cn=function(a){yn(a);const d=g(a);if(d){const T=[];Nt(d,I=>{en(T,I)}),Nt(T,I=>{try{b(I)}catch{}})}const _=k(a);if(_)for(let T=_.length-1;T>=0;--T){const I=_[T],V=I&&I.name;typeof V=="string"&&To(a,I,V)}},bt=function(a,d,_){if(!_)try{_=d.getAttributeNode(a)}catch{_=null}en(t.removed,{attribute:_||null,from:d});try{_?d.removeAttributeNode(_):d.removeAttribute(a)}catch{try{d.removeAttribute(a)}catch{}}if(a==="is")if(lt||Tt)try{mt(d)}catch{}else try{d.setAttribute(a,"")}catch{}},_u=function(a){const d=k(a);if(d)for(let _=d.length-1;_>=0;--_){const T=d[_],I=T&&T.name;typeof I!="string"||ae[he(I)]||To(a,T,I)}},yn=function(a){const d=[a];for(;d.length>0;){const _=d.pop();j(_)===Fe.element&&_u(_);const I=g(_);if(I)for(let V=I.length-1;V>=0;--V)d.push(I[V])}},Bo=function(a,d){return ze?a==="patchsrc"?!0:a==="for"&&d!=="label"&&d!=="output":!1},Eu=function(a){if(!ze)return;const d=[a];for(;d.length>0;){const _=d.pop(),T=j(_);if(T===Fe.processingInstruction||T===Fe.comment&&Me(Fr,_.data)){try{b(_)}catch{}continue}if(T===Fe.element){const V=_,ce=he(H(_));try{V.hasAttribute&&V.hasAttribute("patchsrc")&&V.removeAttribute("patchsrc"),V.hasAttribute&&V.hasAttribute("for")&&Bo("for",ce)&&V.removeAttribute("for")}catch{}}const I=g(_);if(I)for(let V=I.length-1;V>=0;--V)d.push(I[V])}},Do=function(a){let d=null,_=null;if(it)a="<remove></remove>"+a;else{const V=Dr(a,/^[\r\n\t ]+/);_=V&&V[0]}zt==="application/xhtml+xml"&&vt===et&&(a='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+a+"</body></html>");const T=U?D(a):a;if(vt===et)try{d=new h().parseFromString(T,zt)}catch{}if(!d||!d.documentElement){d=ee.createDocument(vt,"template",null);try{d.documentElement.innerHTML=jn?F:T}catch{}}const I=d.body||d.documentElement;return a&&_&&I.insertBefore(n.createTextNode(_),I.childNodes[0]||null),vt===et?re.call(d,Re?"html":"body")[0]:Re?d.documentElement:I},xo=function(a){const d=v?v(a):a.ownerDocument;return S.call(d||a,a,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},mn=function(a){return a=nn(a,Ae," "),a=nn(a,M," "),a=nn(a,fe," "),a},zn=function(a){var d;a.normalize();const _=v?v(a):a.ownerDocument,T=S.call(_||a,a,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null);let I=T.nextNode();for(;I;)I.data=mn(I.data),I=T.nextNode();const V=(d=a.querySelectorAll)===null||d===void 0?void 0:d.call(a,"template");V&&Nt(V,ce=>{Lt(ce.content)&&zn(ce.content)})},gn=function(a){const d=R?R(a):null;return typeof d!="string"||he(d)!=="form"?!1:typeof a.nodeName!="string"||typeof a.textContent!="string"||typeof a.removeChild!="function"||a.attributes!==k(a)||typeof a.removeAttribute!="function"||typeof a.setAttribute!="function"||typeof a.namespaceURI!="string"||typeof a.insertBefore!="function"||typeof a.hasChildNodes!="function"||a.nodeType!==x(a)||a.childNodes!==g(a)},Lt=function(a){if(!x||typeof a!="object"||a===null)return!1;try{return x(a)===Fe.documentFragment}catch{return!1}},Vt=function(a){if(!x||typeof a!="object"||a===null)return!1;try{return typeof x(a)=="number"}catch{return!1}};function tt(N,a,d){N.length!==0&&Nt(N,_=>{_.call(t,a,d,Ot)})}const bu=function(a,d){return!!(ze&&a.hasChildNodes()&&!Vt(a.firstElementChild)&&Me($r,a.textContent)&&Me($r,a.innerHTML)||ze&&a.namespaceURI===et&&ud[d]&&(Vt(a.firstElementChild)||typeof a.textContent=="string"&&Me(ad[d],a.textContent))||a.nodeType===Fe.processingInstruction||ze&&a.nodeType===Fe.comment&&Me(Fr,a.data))},_n=function(a,d){if(a instanceof RegExp)return Me(a,d);if(a instanceof Function){for(var _=arguments.length,T=new Array(_>2?_-2:0),I=2;I<_;I++)T[I-2]=arguments[I];return!!a(d,...T)}return!1},ku=function(a,d,_){if(!$[d]&&Io(d)&&_n(L.tagNameCheck,d))return!1;if(Dt&&!Je[d]){const T=m(a),I=g(a);if(I&&T){const V=I.length;for(let ce=V-1;ce>=0;--ce){const de=a===_?y(I[ce],!0):I[ce];T.insertBefore(de,w(a))}}}return mt(a),!0},vo=function(a,d,_,T){return a.length===0?d:d===_||d===T?$e(d):d},Oo=function(a,d){return a===d||m(a)!==null?!1:(ct&&yn(a),!0)},Lo=function(a,d){if(tt(Y.beforeSanitizeElements,a,null),Oo(a,d))return!0;if(gn(a))return mt(a),!0;const _=he(H(a));if(te=vo(Y.uponSanitizeElement,te,ut,Ze),tt(Y.uponSanitizeElement,a,{tagName:_,allowedTags:te}),Oo(a,d))return!0;if(bu(a,_))return mt(a),!0;if($[_]||!(ne.tagCheck instanceof Function&&ne.tagCheck(_))&&!te[_]){const I=ku(a,_,d);return I===!1&&tt(Y.afterSanitizeElements,a,null),I}if(j(a)===Fe.element&&!gu(a)||(_==="noscript"||_==="noembed"||_==="noframes")&&Me(od,a.innerHTML))return mt(a),!0;if(ge&&a.nodeType===Fe.text){const I=mn(a.textContent);a.textContent!==I&&(en(t.removed,{element:a.cloneNode()}),a.textContent=I)}return tt(Y.afterSanitizeElements,a,null),!1},Ro=function(a,d,_){if(K[d]||Bo(d,a)||Ft&&(d==="id"||d==="name")&&(_ in n||_ in fu))return!1;const T=ae[d]||ne.attributeCheck instanceof Function&&ne.attributeCheck(d,a);return Te&&Me(Ce,d)||De&&Me(He,d)?!0:T?xt[d]||Me(Ue,nn(_,Ke,""))||(d==="src"||d==="xlink:href"||d==="href")&&a!=="script"&&xr(_,"data:")===0&&Qe[a]||Xe&&!Me(ft,nn(_,Ke,""))?!0:!_:Io(a)&&_n(L.tagNameCheck,a)&&_n(L.attributeNameCheck,d,a)||d==="is"&&L.allowCustomizedBuiltInElements&&_n(L.tagNameCheck,_)},Au=J({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Io=function(a){return!Au[tn(a)]&&Me(rt,a)},wu=function(a,d,_,T){if(U&&typeof p=="object"&&typeof p.getAttributeType=="function"&&!_)switch(p.getAttributeType(a,d)){case"TrustedHTML":return D(T);case"TrustedScriptURL":return O(T)}return T},Su=function(a,d,_,T){try{_?a.setAttributeNS(_,d,T):a.setAttribute(d,T),gn(a)?mt(a):Br(t.removed)}catch{bt(d,a)}},jo=function(a){tt(Y.beforeSanitizeAttributes,a,null);const d=a.attributes;if(!d||gn(a))return;ae=vo(Y.uponSanitizeAttribute,ae,A,at);const _={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ae,forceKeepAttr:void 0};let T=d.length;const I=he(a.nodeName);for(;T--;){const V=d[T],ce=V.name,de=V.namespaceURI,xe=V.value,ve=he(ce),Un=xe;let Be=ce==="value"?Un:$0(Un);if(_.attrName=ve,_.attrValue=Be,_.keepAttr=!0,_.forceKeepAttr=void 0,tt(Y.uponSanitizeAttribute,a,_),Be=_.attrValue,_e&&(ve==="id"||ve==="name")&&xr(Be,Bt)!==0&&(bt(ce,a,V),Be=Bt+Be),ze&&Me(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Be)){bt(ce,a,V);continue}if(ve==="attributename"&&Dr(Be,"href")){bt(ce,a,V);continue}if(!_.forceKeepAttr){if(!_.keepAttr){bt(ce,a,V);continue}if(!Ge&&Me(rd,Be)){bt(ce,a,V);continue}if(ge&&(Be=mn(Be)),!Ro(I,ve,Be)){bt(ce,a,V);continue}Be=wu(I,ve,de,Be),Be!==Un&&Su(a,ce,de,Be)}}tt(Y.afterSanitizeAttributes,a,null)},En=function(a){let d=null;const _=xo(a);for(tt(Y.beforeSanitizeShadowDOM,a,null);d=_.nextNode();)if(tt(Y.uponSanitizeShadowNode,d,null),Lo(d,a),jo(d),Lt(d.content)&&En(d.content),j(d)===Fe.element){const T=E(d);Lt(T)&&(Vn(T),En(T))}tt(Y.afterSanitizeShadowDOM,a,null)},Vn=function(a){const d=[{node:a,shadow:null}];for(;d.length>0;){const _=d.pop();if(_.shadow){En(_.shadow);continue}const T=_.node,V=j(T)===Fe.element,ce=g(T);if(ce)for(let de=ce.length-1;de>=0;--de)d.push({node:ce[de],shadow:null});if(V){const de=R?R(T):null;if(typeof de=="string"&&he(de)==="template"){const xe=T.content;Lt(xe)&&d.push({node:xe,shadow:null})}}if(V){const de=E(T);Lt(de)&&d.push({node:null,shadow:de},{node:de,shadow:null})}}};return t.sanitize=function(N){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},d=null,_=null,T=null,I=null;if(jn=!N,jn&&(N="<!-->"),typeof N!="string"&&!Vt(N)&&(N=U0(N),typeof N!="string"))throw Mt("dirty is not a string, aborting");if(!t.isSupported)return N;Ct?(te=Ze,ae=at):Hn(a),(Y.uponSanitizeElement.length>0||Y.uponSanitizeAttribute.length>0)&&(te=$e(te)),Y.uponSanitizeAttribute.length>0&&(ae=$e(ae)),t.removed=[];const V=ct&&typeof N!="string"&&Vt(N);if(V){Eu(N);const xe=H(N);if(typeof xe=="string"){const ve=he(xe);if(!te[ve]||$[ve])throw Cn(N),Mt("root node is forbidden and cannot be sanitized in-place")}if(gn(N))throw Cn(N),Mt("root node is clobbered and cannot be sanitized in-place");try{Vn(N)}catch(ve){throw Cn(N),ve}}else if(Vt(N))d=Do("<!---->"),_=d.ownerDocument.importNode(N,!0),_.nodeType===Fe.element&&_.nodeName==="BODY"||_.nodeName==="HTML"?d=_:d.appendChild(_),Vn(_);else{if(!lt&&!ge&&!Re&&N.indexOf("<")===-1)return U&&Et?D(N):N;if(d=Do(N),!d)return lt?null:Et?F:""}d&&it&&mt(d.firstChild);const ce=V?N:d;try{const xe=xo(ce);for(;T=xe.nextNode();)Lo(T,ce),jo(T),Lt(T.content)&&En(T.content)}catch(xe){throw V&&(Cn(N),Nt(t.removed,ve=>{ve.element&&yn(ve.element)})),xe}if(V)return Nt(t.removed,xe=>{xe.element&&yn(xe.element)}),ge&&zn(N),N;if(lt){if(ge&&zn(d),Tt)for(I=P.call(d.ownerDocument);d.firstChild;)I.appendChild(d.firstChild);else I=d;return(ae.shadowroot||ae.shadowrootmode)&&(I=ue.call(o,I,!0)),I}let de=Re?d.outerHTML:d.innerHTML;return Re&&te["!doctype"]&&d.ownerDocument&&d.ownerDocument.doctype&&d.ownerDocument.doctype.name&&Me(td,d.ownerDocument.doctype.name)&&(de="<!DOCTYPE "+d.ownerDocument.doctype.name+`>
|
|
783
|
+
`+de),ge&&(de=mn(de)),U&&Et?D(de):de},t.setConfig=function(){let N=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Hn(N),Ct=!0,Ze=te,at=ae},t.clearConfig=function(){Ot=null,Ct=!1,Ze=null,at=null,U=Q,F=""},t.isValidAttribute=function(N,a,d){Ot||Hn({});const _=he(N),T=he(a);return Ro(_,T,d)},t.addHook=function(N,a){typeof a=="function"&&Le(Y,N)&&en(Y[N],a)},t.removeHook=function(N,a){if(Le(Y,N)){if(a!==void 0){const d=j0(Y[N],a);return d===-1?void 0:P0(Y[N],d,1)[0]}return Br(Y[N])}},t.removeHooks=function(N){Le(Y,N)&&(Y[N]=[])},t.removeAllHooks=function(){Y=zr()},t}var cd=Vr();const sd=/^(?:[a-z]+:)?\/\//i;let dd="";function hd(){return dd}function so(e){const t=String(e||"").trim();if(!t)return"";if(sd.test(t)||t.startsWith("data:")||t.startsWith("blob:"))return t;const n=t.startsWith("/")?t:`/${t}`,o=hd();return o?`${o}${n}`:n}function pd(){return Dn(new Date)}function Dn(e){if(e==null||e==="")return"";const t=e instanceof Date?e:new Date(e);return isNaN(t.getTime())?"":new Intl.DateTimeFormat("fr-CA",{timeZone:"Asia/Seoul"}).format(t)}const rn=[],un=[],an=[],ln=[],xn={LISTEN_IN_NOISE:[],SHORT_STORY:[],LONG_STORY:[],ORDERING_SENTENCE:[]},vn={LISTEN_IN_NOISE:[],SHORT_STORY:[],LONG_STORY:[],ORDERING_SENTENCE:[]},fd={LISTEN_IN_NOISE:3,SHORT_STORY:2,LONG_STORY:1,ORDERING_SENTENCE:2};let ho=null,Ur=null,_t=null;function Cd({counts:e,forceRefresh:t}={}){const n=Object.assign({},fd,e||{}),o=pd(),r=Dn(new Date(`${o}T00:00:00+09:00`).getTime()-864e5),u=JSON.stringify(n);if(!t&&Ur===o&&ho===u&&_t)return Object.assign(xn,_t.today),Object.assign(vn,_t.yesterday?.selection||{LISTEN_IN_NOISE:[],SHORT_STORY:[],LONG_STORY:[],ORDERING_SENTENCE:[]}),{today:xn,yesterday:vn};const i={LISTEN_IN_NOISE:dt(rn,Math.max(0,Number(n.LISTEN_IN_NOISE)||0)),SHORT_STORY:dt(un,Math.max(0,Number(n.SHORT_STORY)||0)),LONG_STORY:dt(an,Math.max(0,Number(n.LONG_STORY)||0)),ORDERING_SENTENCE:dt(ln,Math.max(0,Number(n.ORDERING_SENTENCE)||0))};let l=null;return _t&&ho===u&&_t.yesterday&&_t.yesterday.date===r&&(l=_t.yesterday.selection),l||(l={LISTEN_IN_NOISE:dt(rn,Math.max(0,Number(n.LISTEN_IN_NOISE)||0)),SHORT_STORY:dt(un,Math.max(0,Number(n.SHORT_STORY)||0)),LONG_STORY:dt(an,Math.max(0,Number(n.LONG_STORY)||0)),ORDERING_SENTENCE:dt(ln,Math.max(0,Number(n.ORDERING_SENTENCE)||0))}),Object.assign(xn,i),Object.assign(vn,l),Ur=o,ho=u,_t={today:i,yesterday:{date:r,countsKey:u,selection:l}},{today:xn,yesterday:vn}}let Gr=!1,cn=null;async function yd(){try{const e=import.meta&&import.meta.env&&import.meta.env.BASE_URL||"/",t=await fetch(`${e}data/allTrainingData.json`);return t.ok?await t.json():null}catch{return null}}async function md(){if(!Gr)return cn||(cn=(async()=>{const e=await yd();if(!e){cn=null;try{window.dispatchEvent(new Event("speechear.data.error"))}catch{}return}try{for(const t of Object.keys(e||{})){const n=e[t]||[];for(const o of n){const r=o,u=String(r.training_type||t),i=String(r.category_main_code||r.category_main||r.category_0||""),l=String(r.category_sub_code||r.category_sub||r.category_1||""),c=Object.assign({},r,{training_type:u,category_0:i,category_1:l});u==="LISTEN_IN_NOISE"?rn.push(c):u==="SHORT_STORY"?un.push(c):u==="LONG_STORY"?an.push(c):u==="ORDERING_SENTENCE"&&ln.push(c)}}}catch{cn=null;try{window.dispatchEvent(new Event("speechear.data.error"))}catch{}return}try{window.dispatchEvent(new Event("speechear.data.updated"))}catch{}try{Cd()}catch{}Gr=!0})(),cn)}async function gd(e=3e3){const t=md();return Promise.race([t,new Promise(n=>setTimeout(n,e))])}const _d=[{key:"LISTEN_IN_NOISE",label:"\uC18C\uC74C \uD558 \uBB38\uC7A5 \uB4E3\uAE30",icon:"party-popper",desc:"\uB2E4\uC591\uD55C \uC18C\uC74C \uD658\uACBD\uC5D0\uC11C \uBB38\uC7A5 \uCCAD\uB825\uC744 \uD6C8\uB828\uD569\uB2C8\uB2E4."},{key:"SHORT_STORY",label:"\uC9E7\uC740 \uC774\uC57C\uAE30 \uB4E3\uAE30",icon:"message-square",desc:"\uC9E7\uC740 \uC774\uC57C\uAE30\uB97C \uB4E3\uACE0 \uAE30\uC5B5\uD558\uC5EC \uBB38\uC81C\uB97C \uD480\uC5B4\uBD05\uB2C8\uB2E4."},{key:"LONG_STORY",label:"\uAE34 \uC774\uC57C\uAE30 \uB4E3\uAE30",icon:"message-square-text",desc:"\uAE34 \uC774\uC57C\uAE30\uB97C \uB4E3\uACE0 \uAE30\uC5B5\uD558\uC5EC \uB2E4\uC218\uC758 \uBB38\uC81C\uB97C \uD480\uC5B4\uBD05\uB2C8\uB2E4."},{key:"ORDERING_SENTENCE",label:"\uBB38\uC7A5 \uC21C\uC11C\uD654 \uD558\uAE30",icon:"align-start-vertical",desc:"\uC5EC\uB7EC\uAC1C\uC758 \uC9E7\uC740 \uBB38\uC7A5\uC744 \uB4E3\uACE0 \uAE30\uC5B5\uD558\uC5EC \uADF8 \uC21C\uC11C\uC5D0 \uB9DE\uAC8C \uBC30\uC5F4\uD569\uB2C8\uB2E4."}],Ed={LISTEN_IN_NOISE:"listenInNoise",SHORT_STORY:"shortStory",LONG_STORY:"longStory",ORDERING_SENTENCE:"orderingSentence"};function bd(e){return _d.map(t=>{const n=Ed[t.key];return n?{...t,label:e(`trainingType.${n}.title`),desc:e(`trainingType.${n}.desc`)}:t})}function kd(e){return typeof window>"u"?"":cd.sanitize(e,{USE_PROFILES:{svg:!0,svgFilters:!0},FORBID_TAGS:["script","use"],FORBID_ATTR:["xlink:href","href"]})}function Ad(e){const[t,n]=B(null),[o,r]=B(null),[u,i]=B(null),[l,c]=B(null);return X(()=>{if(!e||typeof e!="string"||!e.endsWith(".svg")){n(null),r(null),i(null);return}const f=e.split("/").pop();let h=e;f&&(e.startsWith("/")?h=so(e):/^(Logo|Symbol)/i.test(f)?h=so(`logo/${f}`):(/^https?:\/\//i.test(e)||e.startsWith("data:"),h=e)),n(h)},[e]),X(()=>{if(!t)return;let f=!1;async function h(){try{let p=await fetch(t);p.ok||(p=await fetch(t));const s=p.headers.get("content-type")||"";if(f)return;if(s.includes("svg")){r("mask");return}if(s.startsWith("image/")){r("img");return}const y=await fetch(t);if(!y.ok)throw new Error("not ok");const b=await y.text();if(f)return;if(/^\s*<svg[\s>]/i.test(b)){const w=kd(b);if(!w){r("none");return}i(w),r("inline");return}r("none")}catch{f||r("none")}}return h(),()=>{f=!0}},[t]),X(()=>{let f=!1,h=null;return o==="mask"&&t&&fetch(t).then(p=>{if(!p.ok)throw new Error("fetch failed");return p.blob()}).then(p=>{f||(h=URL.createObjectURL(p),c(h))}).catch(()=>{f||r("img")}),()=>{f=!0,h&&URL.revokeObjectURL(h),c(null)}},[o,t]),{iconToUse:t,mode:o,svgText:u,blobUrl:l}}function wd(e){const{icon:t,label:n,className:o,imgClassName:r,maskClassName:u,svgClassName:i,wrapperStyle:l,size:c}=e||{},f=o??"iconRenderer-icon",h=r??"iconRenderer-icon-image",p=u??"iconRenderer-icon-mask",s=i??"iconRenderer-icon-svg",y=typeof t=="string"?t:null,b=T0(y),{iconToUse:w,mode:g,svgText:m,blobUrl:E}=Ad(y),k=(j,H={})=>oe("span",{className:f,style:l,...H,children:j}),x=(j,H={})=>oe("img",{src:j,alt:typeof n=="string"?n:n?String(n):"",className:h,...H});if(!t)return null;if(typeof t!="string")return k(t);if(t==="none")return k(oe("span",{className:s,dangerouslySetInnerHTML:{__html:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" aria-hidden="true"></svg>'}}),{"aria-hidden":"true"});if(b)try{return k(Ut(b,{className:s,size:typeof c=="number"?c:20}),{"aria-hidden":"true"})}catch{}if(w&&w.endsWith(".svg")){if(g==="mask"){const j={"--icon-url":E?`url(${E})`:`url(${w})`};return k(oe("span",{className:p,style:j}),{"aria-hidden":"true"})}return g==="img"?k(x(w,{onError:j=>{j.currentTarget.onerror=null,j.currentTarget.style.display="none"}}),{"aria-hidden":"true"}):g==="inline"?k(oe("span",{className:s,dangerouslySetInnerHTML:m?{__html:m}:void 0}),{"aria-hidden":"true"}):k(null,{"aria-hidden":"true"})}if(t.startsWith("/")||t.includes("/assets/")||t.match(/\.(png|jpg|jpeg|webp|gif)$/i))return x(so(t),{style:l,onError:j=>{j.currentTarget.onerror=null,j.currentTarget.style.display="none"}});const R=typeof c=="number"?c:20,v=`<svg width="${R}" height="${R}" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><rect x="3" y="3" width="18" height="18" rx="2" ry="2" style="fill:none;stroke:currentColor;stroke-width:2"/></svg>`;return k(oe("span",{className:s,dangerouslySetInnerHTML:{__html:v}}),{"aria-hidden":"true"})}function Yr(e){const{anchorRect:t,anchorEl:n,offset:o=20,edgeMargin:r=20,onClose:u,closeOnOutsideClick:i=!0,className:l="",role:c="dialog",ariaLabel:f="",children:h,backdrop:p=!1,isMobilePopup:s=!1,useBorder:y=!0,header:b}=e||{},w=Oe(null),[g,m]=B({position:"fixed",left:0,top:-9999}),[E,k]=B(!1),[x,R]=B("bottom"),[v,j]=B(!1),[H,U]=B(!1),F=!t&&!n,Q=q((D=!1)=>{if(H&&s)return;const O=n?n.getBoundingClientRect():t;if(!O||!w.current)return;const me=w.current,{offsetWidth:Z,offsetHeight:ee}=me,S=window.innerWidth,P=window.innerHeight,re=S-O.right,ue=O.left,Y=O.top,Ae=P-O.bottom;let M=0,fe=0,Ce="top";if(Y>=ee+o)Ce="top",fe=O.top-o-ee,M=O.left+O.width/2-Z/2;else if(Ae>=ee+o)Ce="bottom",fe=O.bottom+o,M=O.left+O.width/2-Z/2;else if(re>=Z+o)Ce="right",M=O.right+o,fe=O.top+O.height/2-ee/2;else if(ue>=Z+o)Ce="left",M=O.left-o-Z,fe=O.top+O.height/2-ee/2;else{const rt=Math.max(Y,Ae,re,ue);rt===Y?(Ce="top",fe=O.top-o-ee,M=O.left+O.width/2-Z/2):rt===Ae?(Ce="bottom",fe=O.bottom+o,M=O.left+O.width/2-Z/2):rt===re?(Ce="right",M=O.right+o,fe=O.top+O.height/2-ee/2):(Ce="left",M=O.left-o-Z,fe=O.top+O.height/2-ee/2)}const He=Number(r)||8;M=Math.min(Math.max(M,He),S-Z-He),fe=Math.min(Math.max(fe,He),P-ee-He);const ft=Math.round(M),Ke=Math.round(fe);D&&w.current?(w.current.style.left=`${ft}px`,w.current.style.top=`${Ke}px`,w.current.dataset.placement=Ce):(R(Ce||x),m({position:"fixed",left:ft,top:Ke}),j(!0))},[H,s,n,t,o,r,x]);Nu(()=>{if(F)return;if(H&&s){m({position:"fixed",left:"50%",top:"50%",transform:"translate(-50%, -50%)",width:"calc(100% - 40px)",maxWidth:"calc(100% - 40px)"}),j(!0);return}Q();const D=requestAnimationFrame(()=>Q());return()=>cancelAnimationFrame(D)},[t,n,o,h,r,F,H,s,Q]),X(()=>{if(F||H&&s||!w.current||typeof ResizeObserver>"u")return;const D=new ResizeObserver(()=>{t&&Q()});return D.observe(w.current),()=>D.disconnect()},[t,h,r,F,H,s,Q]),X(()=>{if(F||H&&s)return;const D=()=>Q(!0);return window.addEventListener("resize",D),document.addEventListener("scroll",D,{passive:!0,capture:!0}),()=>{window.removeEventListener("resize",D),document.removeEventListener("scroll",D,{capture:!0})}},[t,o,h,r,F,H,s,Q]),X(()=>{if(typeof window>"u"||!window.matchMedia)return;const D=window.matchMedia("(max-width: 768px)"),O=()=>U(!!D.matches);O();try{D.addEventListener?D.addEventListener("change",O):D.addListener(O)}catch{try{D.addListener(O)}catch{}}return()=>{try{D.removeEventListener?D.removeEventListener("change",O):D.removeListener(O)}catch{}}},[]);const G=Oe(!1),W=q((D=!1)=>{if(!(E||G.current)){if(G.current=!0,D){k(!0);try{u&&u()}catch{}return}k(!0),setTimeout(()=>{u&&u()},200)}},[E,u,k]);X(()=>{const D=Z=>{const ee=w.current;if(!ee)return;const S=Z.target;if(S&&!ee.contains(S)){try{if(S.closest&&S.closest("[data-tooltip-ignore]"))return}catch{}i&&W(!0)}},O=Z=>{const ee=w.current;if(!ee)return;const S=Z.target;if(S&&!ee.contains(S)){try{if(S.closest&&S.closest("[data-tooltip-ignore]"))return}catch{}i&&W(!0)}},me=Z=>{if(Z.key==="Escape"){Z.stopPropagation(),W();return}if(Z.key==="Tab"){const ee=w.current;if(!ee)return;const S=ee.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(!S||S.length===0)return;const P=S[0],re=S[S.length-1],ue=document.activeElement;Z.shiftKey?ue===P&&(Z.preventDefault(),re.focus()):ue===re&&(Z.preventDefault(),P.focus())}};return document.addEventListener("pointerdown",D,!0),document.addEventListener("click",O,!0),document.addEventListener("keydown",me),()=>{document.removeEventListener("pointerdown",D,!0),document.removeEventListener("click",O,!0),document.removeEventListener("keydown",me)}},[u,i,W]),X(()=>{const D=()=>{W(!0)};return typeof document<"u"&&document.addEventListener("speechear-close-tooltips",D),()=>{typeof document<"u"&&document.removeEventListener("speechear-close-tooltips",D)}},[W]);const z=Ie("div",{ref:w,className:`tooltip-content ${y?"tooltip-content--bordered":""} ${E?"is-closing":""} ${l} ${H&&s?"is-mobile":""}`,role:c,"aria-label":f||void 0,style:F?{}:{...g,visibility:v?"visible":"hidden"},tabIndex:-1,"data-placement":x,"data-left":F?"":g.left,"data-top":F?"":g.top,"data-anchor-left":t?Math.round(t.left):"","data-anchor-top":t?Math.round(t.top):"","data-anchor-width":t?Math.round(t.width):"","data-anchor-height":t?Math.round(t.height):"",children:[b!=null&&oe("div",{className:"tooltip-content__header h5",children:b}),h]});if(F||typeof document>"u")return z;if(p||H&&s){const D=Ie("div",{className:"tooltip-portal",children:[oe("div",{className:"tooltip-backdrop",onClick:()=>{i&&W(!0)}}),z]});return $o(D,document.body)}return $o(z,document.body)}function Sd(e){const{anchorRect:t,text:n,offset:o=8,onClose:r,className:u="",ariaLabel:i}=e||{};return n?oe(Yr,{anchorRect:t,offset:o,onClose:r,closeOnOutsideClick:!1,className:`tooltip-info ${u}`,ariaLabel:i||n,children:oe("div",{className:"tooltip-info__content body-3",children:n})}):null}function qr(e){const{anchorRect:t,title:n,items:o,activeIndex:r=-1,showIndex:u=!0,onClose:i,offset:l=12}=e||{},c=Array.isArray(o)?o:o?[o]:[];return!c.length&&!n?null:oe(Yr,{anchorRect:t,offset:l,onClose:i,closeOnOutsideClick:!0,useBorder:!1,className:"tooltip-description",children:Ie("div",{className:"tooltip-description__box",children:[n&&oe("span",{className:"tooltip-description__title body-2",children:n}),oe("ol",{className:"tooltip-description__items",children:c.map((f,h)=>Ie("li",{className:`tooltip-description__item body-3${h===r?" tooltip-description__item--active":""}`,children:[u&&c.length>1&&Ie("span",{className:"tooltip-description__index button-1",children:[h+1,"."]}),oe("span",{children:f})]},h))})]})})}function Nd(e){const{size:t=48,type:n,htmlType:o,href:r,target:u,rel:i,icon:l,rightIcon:c,label:f,count:h,subLabel:p,children:s,ariaLabel:y,variant:b="default",align:w="center",selected:g,toggleable:m=!1,disabled:E=!1,useLabel:k=!0,useBorder:x=!0,useBG:R=!0,useDisabledCovered:v=!1,useDisabledInvisible:j=!1,width:H,minWidth:U,onClick:F,onDisabledClick:Q,showTooltipInfo:G=!1,tooltipInfoText:W=null,tooltipDescription:z=null,iconSize:D="medium",iconColor:O,shape:me="rounded",color:Z,className:ee,...S}=e,P=typeof t=="string"&&isNaN(Number(t))?t.toLowerCase():String(Number(t)||48),re=P.match(/^\d+$/)?`button${P}`:`button-${P}`,ue=Number(t),Y=!isNaN(ue)&&ue<40?"button-2":"button-1",Ae=f??s,M=E||!!S.disabled,fe=M?v?"disabled-covered":j?"disabled-invisibled":"disabled":b,Ce=fe?`button--variant-${fe}`:"",He=w?`button--align-${w}`:"",ft=me?`button--shape-${me}`:"",Ke=typeof O=="string"&&O.startsWith("--")?`var(${O})`:O,rt={...H?{width:typeof H=="number"?`${H}px`:H}:{},...U?{minWidth:typeof U=="number"?`${U}px`:U}:{},...x?{}:{"--button-border":M?"0":"1px solid transparent"},...Ke?{"--button-icon-color":Ke}:{},...Z?{"--color-main":Z}:{}},Ue=k===!1?"":Ae,te=Array.isArray(Ue)?Ue.length>0:!!Ue,ut=!!c,ae=n??(te||l||ut?"bar":"dot"),A=`${re}--${ae}`,L=Oe(null),$=Oe(M),[K,ne]=B(!!g),[De,Te]=B(!1),[Xe,Ge]=B(null),ge=q(()=>Te(!1),[]);X(()=>{(G||z)&&M&&De&&(Te(!1),Ge(null))},[M,G,z,De]),X(()=>{typeof g=="boolean"&&ne(g)},[g]),X(()=>{if($.current&&!M&&L.current){const ie=L.current;ie.blur(),ie.style.pointerEvents="none";const Qe=requestAnimationFrame(()=>{requestAnimationFrame(()=>{L.current&&(L.current.style.pointerEvents="")})});return()=>cancelAnimationFrame(Qe)}$.current=M},[M]);const ze=typeof g=="boolean"?!!g:K,Re=m||typeof g=="boolean"?ze?"true":"false":void 0,Ct=Ga("button",re,A,Ce,He,ft,ze?"is-selected":null,R?null:"button--no-bg",ee),Ze=`button__icon button__icon--${D}`,at=Array.isArray(p)?p:p!==void 0?[p]:[],it=()=>{if(Array.isArray(Ue))return Ue.map((Qe,Ht)=>{const xt=at[Ht];return Ie("span",{className:`button__label-text${xt!==void 0?" button__label-text--has-sub":""}`,children:[Qe,xt!==void 0&&oe("span",{className:"button__sub-label-text caption-1",children:xt})]},Ht)});const ie=p!==void 0;return Ie("span",{className:`button__label-text${ie?" button__label-text--has-sub":""}`,children:[Ue,h!=null&&oe("span",{className:"button__count",children:h}),ie&&oe("span",{className:"button__sub-label-text caption-1",children:p})]})},lt=ie=>{M||(typeof S.onMouseLeave=="function"&&S.onMouseLeave(ie),typeof g!="boolean"&&ne(!1),ie.currentTarget.blur())},Tt=ie=>{if(M){Q?.(ie);return}typeof g!="boolean"&&m&&ne(Qe=>!Qe),F?.(ie)},Et=q(()=>{!M&&(G||z)&&(Te(!0),Ge(L.current?.getBoundingClientRect()??null))},[M,G,z]),Ft=q(()=>{(G||z)&&(Te(!1),Ge(null))},[G,z]),_e={...S};delete _e.disabled,delete _e.className,delete _e.faded,delete _e.useFaded,delete _e.loading,delete _e.onMouseLeave,delete _e.onPointerEnter,delete _e.onPointerLeave,delete _e.onFocus,delete _e.onBlur,M&&(Object.keys(_e).forEach(ie=>{/^on[A-Z]/.test(ie)&&typeof _e[ie]=="function"&&delete _e[ie]}),_e["aria-disabled"]="true");const Bt=(typeof G=="string"?G:null)??(typeof W=="string"?W:null)??(typeof y=="string"?y:null)??(typeof Ae=="string"?Ae:null)??void 0,Dt=typeof y=="string"?y:typeof Ae=="string"?Ae:Bt,ct=(ie,Qe)=>oe(wd,{icon:ie,label:Qe??Dt,className:Ze,imgClassName:"button__icon-img",maskClassName:"button__icon-mask",svgClassName:"button__icon-svg"}),yt=()=>ae==="dot"?Ie(Gt,{children:[ct(l),te&&oe("span",{className:`button__label ${Y}`,children:it()})]}):w==="center"&&l?Ie(Gt,{children:[Ie("span",{className:"button__center-group",children:[oe("span",{className:"button__left",children:ct(l)}),te&&oe("span",{className:`button__label ${Y}`,children:it()})]}),ut&&oe("span",{className:"button__right",children:ct(c)})]}):Ie(Gt,{children:[l&&oe("span",{className:"button__left",children:ct(l,y??Ae)}),te&&oe("span",{className:`button__label ${Y}`,children:it()}),ut&&oe("span",{className:"button__right",children:ct(c)})]}),Je=!!r&&!M;return Ie(Gt,{children:[oe(Je?"a":"button",{..._e,ref:L,...Je?{href:r,target:u,rel:i??(u==="_blank"?"noreferrer":void 0)}:{type:o,disabled:M&&!Q},className:Ct,"aria-pressed":Re,"aria-label":Dt,"aria-disabled":Je&&M?!0:void 0,style:rt,onClick:Tt,onMouseLeave:lt,onPointerEnter:ie=>{Et(),!M&&typeof S.onPointerEnter=="function"&&S.onPointerEnter(ie)},onPointerLeave:ie=>{Ft(),!M&&typeof S.onPointerLeave=="function"&&S.onPointerLeave(ie)},onFocus:ie=>{Et(),!M&&typeof S.onFocus=="function"&&S.onFocus(ie)},onBlur:ie=>{lt(ie),Ft(),!M&&typeof S.onBlur=="function"&&S.onBlur(ie)},children:yt()}),De&&z?oe(qr,{anchorRect:Xe,title:z.title,items:z.items,onClose:ge}):De&&Bt?oe(Sd,{anchorRect:Xe,text:Bt,onClose:ge}):null]})}function Wr(){const[e,t]=B(null),n=q(u=>t(u.getBoundingClientRect()),[]),o=q(()=>t(null),[]),r=q(u=>{const i=u.getBoundingClientRect();t(l=>l?null:i)},[]);return{anchorRect:e,isOpen:e!=null,openAt:n,close:o,toggleAt:r}}function Md(e){const[t,n]=B(null),[o,r]=B(null),u=Oe(null);X(()=>()=>{u.current&&clearTimeout(u.current)},[]);const i=q((c,f)=>{u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{n(c),r(f)},e)},[e]),l=q(()=>{u.current&&clearTimeout(u.current),n(null),r(null)},[]);return{payload:t,anchorRect:o,openAfterDelay:i,close:l}}function Td({title:e,items:t}){const{t:n}=kt(),{anchorRect:o,openAt:r,close:u}=Wr();return Ie(Gt,{children:[oe(Nd,{size:24,type:"dot",icon:"info",variant:"transparent-gray",useBorder:!1,selected:!!o,ariaLabel:n("common.info","\uC124\uBA85"),onPointerEnter:i=>r(i.currentTarget),onPointerLeave:u,onFocus:i=>r(i.currentTarget),onBlur:u}),o&&oe(qr,{title:e,items:t,showIndex:t.length>1,anchorRect:o,onClose:u})]})}function Kr(){const{t:e}=kt();return we(()=>({difficulty:e("wordSearch.filter.difficulty","\uB4F1\uAE09"),syllables:e("wordSearch.filter.syllables","\uC74C\uC808 \uC218"),syllable5plus:e("wordSearch.filter.syllable5plus","5\uC74C\uC808 \uC774\uC0C1"),partOfSpeech:e("wordSearch.filter.partOfSpeech","\uD488\uC0AC"),wordType:e("wordSearch.filter.wordType","\uC720\uD615"),posMap:{[e("wordSearch.filter.pos.noun","\uCCB4\uC5B8(\uBA85\uC0AC, \uC218\uC0AC)")]:["\uBA85","\uC218"],[e("wordSearch.filter.pos.verb","\uC6A9\uC5B8(\uB3D9\uC0AC, \uD615\uC6A9\uC0AC)")]:["\uB3D9","\uD615"],[e("wordSearch.filter.pos.modifier","\uC218\uC2DD\uC5B8(\uBD80\uC0AC, \uAD00\uD615\uC0AC)")]:["\uBD80","\uAD00"]},typeMap:{[e("wordSearch.filter.type.native","\uACE0\uC720\uC5B4")]:"\uACE0\uC720",[e("wordSearch.filter.type.sino","\uD55C\uC790\uC5B4")]:"\uD55C\uC790",[e("wordSearch.filter.type.foreign","\uC678\uB798\uC5B4")]:"\uC678\uB798",[e("wordSearch.filter.type.mixed","\uD63C\uC885\uC5B4")]:"\uD63C\uC885"}}),[e])}function Xr(e,t,n){return{label:t.difficulty,items:[1,2,3,4].map(o=>e("wordSearch.filter.grade",{n:o})),multiple:!0,allOption:!0,allLabel:n?.allLabel,labelAction:n?.labelAction}}function Zr(e){return{label:e.partOfSpeech,items:Object.keys(e.posMap),multiple:!0,allOption:!0}}function Jr(e){return{label:e.wordType,items:Object.keys(e.typeMap),multiple:!0,allOption:!0}}function Bd(e,t){return{label:t.syllables,items:[e("wordSearch.filter.syllable",{n:1}),e("wordSearch.filter.syllable",{n:2}),e("wordSearch.filter.syllable",{n:3}),e("wordSearch.filter.syllable",{n:4}),t.syllable5plus],multiple:!0,allOption:!0}}function Dd(e,t){const n=[e("wordPairs.filter.onlyHasImage","\uC774\uBBF8\uC9C0 \uC788\uB294 \uB2E8\uC5B4\uB9CC")];return t?.includeStructure&&n.push(e("wordPairs.filter.onlySameStructure","\uC74C\uC18C \uAD6C\uC870 \uAC19\uC740 \uB2E8\uC5B4\uB9CC")),{label:e("wordPairs.filter.selectLabel","\uC120\uD0DD"),items:n,multiple:!0,labelAction:t?.labelAction}}function xd(e,t){const{label:n,headValue:o,midValue:r,tailValue:u,includeMid:i=!0,headDisabled:l,midDisabled:c,tailDisabled:f,allOptionDisabled:h,groupLabel:p,labelAction:s}=t;return{label:n,...p?{groupLabel:p}:{},...s?{labelAction:s}:{},allOption:!0,allLabel:e("wordSearch.filter.positionAny",{defaultValue:"\uBB34\uAD00"}),...h?{allOptionDisabled:h}:{},items:[{value:o,displayLabel:e("wordSearch.filter.positionHead",{defaultValue:"\uC5B4\uB450"}),disabled:l},...i?[{value:r,displayLabel:e("wordSearch.filter.positionMid",{defaultValue:"\uC5B4\uC911"}),disabled:c}]:[],{value:u,displayLabel:e("wordSearch.filter.positionTail",{defaultValue:"\uC5B4\uB9D0"}),disabled:f}]}}function vd(e,t,n){if(t===St){const{[n]:u,...i}=e;return i}const o=e[n]??[],r=o.includes(t)?o.filter(u=>u!==t):[...o,t];if(r.length===0){const{[n]:u,...i}=e;return i}return{...e,[n]:r}}Object.fromEntries(Object.entries(ia).map(([e,{nucleus:t}])=>[e,t]));const Od={\uACE0\uC720\uC5B4:"\uACE0\uC720",\uD55C\uC790\uC5B4:"\uD55C\uC790",\uC678\uB798\uC5B4:"\uC678\uB798",\uD63C\uC885\uC5B4:"\uD63C\uC885"},Ld={"\uCCB4\uC5B8(\uBA85\uC0AC,\uC218\uC0AC)":["\uBA85","\uC218"],"\uC6A9\uC5B8(\uB3D9\uC0AC,\uD615\uC6A9\uC0AC)":["\uB3D9","\uD615"],"\uC218\uC2DD\uC5B8(\uBD80\uC0AC,\uAD00\uD615\uC0AC)":["\uBD80","\uAD00"]},Rd={difficulty:"\uB09C\uC774\uB3C4 \uB4F1\uAE09",syllables:"\uC74C\uC808 \uC218",syllable5plus:"5\uC74C\uC808 \uC774\uC0C1",partOfSpeech:"\uD488\uC0AC",wordType:"\uC720\uD615",posMap:Ld,typeMap:Od};function Id(e,t,n=Rd){const o=t[n.difficulty];if(o?.length&&!o.some(l=>e.grade===l.replace(/\D/g,"")))return!1;const r=t[n.syllables];if(r?.length){const l=e.syllables??0;if(!r.some(c=>c===n.syllable5plus?l>=5:l===parseInt(c)))return!1}const u=t[n.partOfSpeech];if(u?.length&&!u.flatMap(l=>n.posMap[l]??[l]).some(l=>(e.pos??"").includes(l)))return!1;const i=t[n.wordType];return!(i?.length&&!i.some(l=>e.wordType===n.typeMap[l]))}const ht=(e,t)=>t.map(n=>({jamos:[n],tooltip:e})),ke=(e,t)=>({jamos:[...e],tooltip:t}),po={cho:[ht("\uC591\uC21C\uC74C",["\u3142","\u3143","\u314D","\u3141"]),ht("\uCE58\uC870\uC74C",["\u3137","\u3138","\u314C","\u3134","\u3139"]),ht("\uCE58\uC870\uC74C",["\u3145","\u3146"]),ht("\uACBD\uAD6C\uAC1C\uC74C",["\u3148","\u3149","\u314A"]),ht("\uC5F0\uAD6C\uAC1C\uC74C",["\u3131","\u3132","\u314B"]),ht("\uC131\uBB38\uC74C",["\u314E"])],jung:[[ke("\u3163","\uC804\uC124 \uACE0\uBAA8\uC74C"),ke("\u315F","\uC804\uC124 \uACE0\uBAA8\uC74C \xB7 w\uD65C\uC74C"),ke("\u3162","\uC804\uC124 \uACE0\uBAA8\uC74C \xB7 \u0270\uD65C\uC74C")],[ke("\u3161","\uD6C4\uC124 \uACE0\uBAA8\uC74C \uD3C9\uC21C")],[ke("\u315C","\uD6C4\uC124 \uACE0\uBAA8\uC74C \uC6D0\uC21C"),ke("\u3160","\uD6C4\uC124 \uACE0\uBAA8\uC74C \uC6D0\uC21C \xB7 j\uD65C\uC74C")],[ke("\u3154\u3150","\uC804\uC124 \uC911\uBAA8\uC74C"),ke("\u3156\u3152","\uC804\uC124 \uC911\uBAA8\uC74C \xB7 j\uD65C\uC74C"),ke("\u3159\u315A\u315E","\uC804\uC124 \uC911\uBAA8\uC74C \xB7 w\uD65C\uC74C")],[ke("\u3153","\uD6C4\uC124 \uC911\uBAA8\uC74C \uD3C9\uC21C"),ke("\u3155","\uD6C4\uC124 \uC911\uBAA8\uC74C \uD3C9\uC21C \xB7 j\uD65C\uC74C"),ke("\u315D","\uD6C4\uC124 \uC911\uBAA8\uC74C \uD3C9\uC21C \xB7 w\uD65C\uC74C")],[ke("\u3157","\uD6C4\uC124 \uC911\uBAA8\uC74C \uC6D0\uC21C"),ke("\u315B","\uD6C4\uC124 \uC911\uBAA8\uC74C \uC6D0\uC21C \xB7 j\uD65C\uC74C")],[ke("\u314F","\uC800\uBAA8\uC74C"),ke("\u3151","\uC800\uBAA8\uC74C \xB7 j\uD65C\uC74C"),ke("\u3158","\uC800\uBAA8\uC74C \xB7 w\uD65C\uC74C")]],jong:[ht("\uC591\uC21C\uC74C",["\u3142","\u3141"]),ht("\uCE58\uC870\uC74C",["\u3137","\u3134","\u3139"]),ht("\uC5F0\uAD6C\uAC1C\uC74C",["\u3131","\u3147"])]},jd=[...Se],Pd=[...st],$d=Ve.filter(e=>e!==""),pt=e=>e===nt?[]:Array.from(e),nt="__NO_CODA__",Qr=[1,2,3,4],ot=5,Fd=12,eu="SYL_",fo=e=>`${eu}${e}`,Hd=e=>Number(e.slice(eu.length));function Co(e){return e>=ot?Array.from({length:Fd-ot+1},(t,n)=>ot+n):[e]}const tu={cho:jd,jung:Pd,jong:$d},yo=e=>e.map(t=>t.map(({jamos:n,tooltip:o})=>({v:n.join(""),tooltip:o}))),mo={cho:yo(po.cho),jung:yo(po.jung),jong:yo(po.jong)},nu={};mo.jung.flat().forEach(({v:e})=>{for(const t of pt(e))nu[t]=e});const zd=new Set(mo.cho.flat().map(e=>e.v));function ou(e,t){return e==="cho"?zd.has(t)?t:null:e==="jung"?nu[t]??t:nr(t)}function ru(e,t,n){if(e==="jung"){const o=pt(t);return n&&o.includes(n)?n:o[0]??t}return t}function uu(e,t,n){const o=(r,u)=>u?r==="jong"&&u===nt?nt:t==="pron"?ou(r,u):ru(r,u,r==="jung"?n:null):null;return{...e,cho:o("cho",e.cho),jung:o("jung",e.jung),jong:o("jong",e.jong)}}const go={cho:null,jung:null,jong:null,syllable:null},Vd="wt_filter",au=e=>`wt_filter_${e}`;function Ud(e){try{const t=localStorage.getItem(au(e))??localStorage.getItem(Vd);if(t)return JSON.parse(t)}catch{}return null}function Gd(e){const t=e;return t?.composition?{cho:t.composition.cho??null,jung:t.composition.jung??null,jong:t.composition.jong??null,syllable:t.composition.syllable??null}:t?.choseong?{...go,cho:t.choseong}:go}function Yd(e,t,n){const{t:o,i18n:r}=kt(),[u]=B(()=>n?.resetOnMount?null:Ud(e)),i=u?.contrastCount,l=typeof i=="number"&&Number.isFinite(i)?i:1,[c,f]=B(Math.min(5,Math.max(1,l))),[h,p]=B(u?.phonemeView==="pron"?"pron":u?.phonemeView==="direct"?"direct":"char"),[s,y]=B(()=>Gd(u)),b=q(()=>t.requireSyllable?{cho:"\u3131",jung:"\u314F",jong:nt,syllable:t.fixedSyllable??null}:{cho:null,jung:null,jong:t.fixedNoCoda?nt:null,syllable:t.fixedSyllable??null},[t.requireSyllable,t.fixedSyllable,t.fixedNoCoda]);X(()=>{!t.requireSyllable&&t.fixedSyllable==null&&!t.fixedNoCoda||y(A=>A.cho||A.jung||A.syllable!=null||A.jong?A:b())},[]);const w=we(()=>be(s.cho)||be(s.jung)||be(s.jong)?"count":"random",[s.cho,s.jung,s.jong]),g=Oe(h==="char"?s.jung:null);X(()=>{h==="char"&&(g.current=s.jung)},[h,s.jung]);const[m,E]=B(n?.resetOnMount?!!n?.defaultImageOnly:u?.excludeNoImage??!0),[k,x]=B(n?.resetOnMount?!1:u?.sameStructureOnly??!0),[R,v]=B(Array.isArray(u?.gradeFilter)?u.gradeFilter:[]),[j,H]=B(Array.isArray(u?.posFilter)?u.posFilter:[]),[U,F]=B(Array.isArray(u?.wordTypeFilter)?u.wordTypeFilter:[]),Q=Oe(n?.resetKey);X(()=>{Q.current!==n?.resetKey&&(Q.current=n?.resetKey,y(b()),E(!1),x(!1),v([]),H([]),F([]),f(1))},[n?.resetKey]);const G=Kr(),[W,z]=B({cho:new Set,jung:new Set,jong:new Set,syllable:new Set}),[D,O]=B(!1),[me,Z]=B(null),ee=1,S=Math.max(1,[s.cho,s.jung,s.jong].filter(Boolean).length);X(()=>{c<S&&f(S)},[S,c]),X(()=>{if(!n?.resetOnMount)try{localStorage.setItem(au(e),JSON.stringify({contrastCount:c,composition:s,excludeNoImage:m,sameStructureOnly:k,phonemeView:h,gradeFilter:R,posFilter:j,wordTypeFilter:U}))}catch{}},[n?.resetOnMount,e,c,s,m,k,h,R,j,U]);const[P,re]=B(0);zo("wordpool:update",()=>re(A=>A+1));const ue=Oe(r.language);X(()=>{ue.current!==r.language&&(ue.current=r.language,re(A=>A+1))},[r.language]),X(()=>{if(!t.choseong)return;let A=!1;return Ua({difficulty:w,excludeNoImage:m}).then(L=>{A||(z(L),L.cho.size+L.jung.size+L.jong.size>0&&O(!0))}).catch(()=>{A||z({cho:new Set,jung:new Set,jong:new Set,syllable:new Set})}),()=>{A=!0}},[t.choseong,w,m,P]),X(()=>{let A=!1;const L=s,$=L.cho?pt(L.cho):null,K=L.jung?pt(L.jung):null,ne=L.jong===nt,De=ne?null:L.jong?pt(L.jong):null,Te=L.syllable!=null?Co(L.syllable):null,Xe=!!($||K||De||ne||Te);return Va({difficulty:t.difficulty?w:null,contrastCount:t.difficulty?c:1,composition:t.choseong&&Xe?{cho:$,jung:K,jong:De,jongNone:ne,syllable:Te}:null,excludeNoImage:m,sameStructureOnly:k,phonemeView:h==="pron"?"pron":"char",grade:R.length>0?R:null}).then(Ge=>{A||Z(Ge)}).catch(()=>{A||Z(null)}),()=>{A=!0}},[t.choseong,t.difficulty,w,c,s,h,m,k,P,R]),X(()=>{D&&y(A=>{const L={...A};let $=!1;return["cho","jung","jong"].forEach(K=>{const ne=A[K];!ne||ne===nt||pt(ne).some(De=>W[K].has(De))||(L[K]=null,$=!0)}),A.syllable!=null&&t.fixedSyllable==null&&(A.syllable>=ot?[...W.syllable].some(K=>K>=ot)||(L.syllable=null,$=!0):(!W.syllable.has(A.syllable)||A.syllable<ee)&&(L.syllable=null,$=!0)),$?L:A})},[W,D,ee,t.fixedSyllable]);const Y=we(()=>{const A=L=>{const $=new Set;for(const K of tu[L])W[L].has(K)&&$.add(K);return $};return{cho:A("cho"),jung:A("jung"),jong:A("jong")}},[W]),Ae=we(()=>({exact:new Set(Qr.filter(A=>W.syllable.has(A))),min:[...W.syllable].some(A=>A>=ot)}),[W]),M=we(()=>({diffPhonemeCount:o("training.contrast.diffPhonemeCount",{defaultValue:"\uB2E4\uB978 \uC74C\uC18C\uC758 \uCD1D \uAC2F\uC218"}),composition:o("wordPairs.composition","\uC815\uB2F5 \uB2E8\uC5B4 \uAD6C\uC131"),syllableCount:o("wordPairs.syllableCount","\uC74C\uC808 \uC218"),onset:o("wordPairs.onset","\uCD08\uC131"),vowel:o("wordPairs.vowel","\uBAA8\uC74C"),coda:o("wordPairs.coda","\uC885\uC131"),phonemeGroup:o("training.filter.phonemeGroup",{defaultValue:"\uD6C8\uB828 \uC74C\uC808"}),trainOnset:o("training.filter.trainOnset",{defaultValue:"\uCD08\uC131"}),trainVowel:o("training.filter.trainVowel",{defaultValue:"\uBAA8\uC74C"}),trainCoda:o("training.filter.trainCoda",{defaultValue:"\uC885\uC131"}),random:o("training.filter.random","\uBB34\uC791\uC704"),exclude:o("wordSearch.filter.exclude","\uC81C\uC678"),selectLabel:o("training.filter.selectSection",{defaultValue:"\uC120\uD0DD"}),none:o("common.none","\uC5C6\uC74C"),noImage:o("wordSearch.filter.excludeNoImage","\uC774\uBBF8\uC9C0 \uC5C6\uC74C"),excludeImage:o("training.filter.excludeImage",{defaultValue:"\uC774\uBBF8\uC9C0 \uC788\uB294 \uB2E8\uC5B4\uB9CC"}),sameStructure:o("training.filter.sameStructure",{defaultValue:"\uC74C\uC18C \uAD6C\uC870 \uAC19\uC740 \uB2E8\uC5B4\uB9CC"}),noLimit:o("training.filter.noLimit",{defaultValue:"\uBB34\uAD00"}),codaExclude:o("training.filter.codaExclude",{defaultValue:"\uC81C\uC678"}),gradeLabel:o("training.filter.gradeLabel",{defaultValue:"\uB09C\uC774\uB3C4 \uB4F1\uAE09"})}),[o]),fe=we(()=>({[M.trainOnset]:"cho",[M.trainVowel]:"jung",[M.trainCoda]:"jong"}),[M]),Ce=q((A,L)=>Ut(Td,{title:L,items:A}),[]),He=we(()=>[o("training.filter.excludeImageInfo",{defaultValue:"\uC774\uBBF8\uC9C0 \uC788\uB294 \uB2E8\uC5B4\uB9CC: \uB2E8\uC5B4 \uC911\uC5D0 \uC774\uBBF8\uC9C0\uAC00 \uC788\uB294 \uB2E8\uC5B4\uB9CC \uACB0\uACFC\uC5D0 \uBCF4\uC5EC\uC90D\uB2C8\uB2E4."}),o("training.filter.sameStructureInfo",{defaultValue:"\uC74C\uC18C \uAD6C\uC870 \uAC19\uC740 \uB2E8\uC5B4\uB9CC: \uC815\uB2F5\uACFC \uC624\uB2F5\uC758 \uC74C\uC808 \uAD6C\uC870(\uAE00\uC790 \uC218\xB7\uBC1B\uCE68 \uC720\uBB34 \uB4F1)\uAC00 \uAC19\uC740 \uACB0\uACFC\uB9CC \uB0A8\uACA8\uC694."})],[o]),ft=we(()=>{const A=[];if(t.choseong){const L={value:nt,displayLabel:M.codaExclude},$=t.fixedNoCoda===!0,K=(ne,De)=>{const Te=$&&ne==="jong",Xe={label:De,groupLabel:M.phonemeGroup,allOption:!t.requireSyllable,allLabel:M.noLimit,allOptionDisabled:Te};if(h==="pron"){const ge=mo[ne].map(ze=>ze.map(({v:Re,tooltip:Ct})=>{const Ze=pt(Re),at=Te||!Ze.some(it=>W[ne].has(it));return Ze.length>1?{value:Re,labels:Ze,tooltip:Ct,disabled:at}:{value:Re,tooltip:Ct,disabled:at}}));return ne==="jong"&&!t.requireCoda&&ge.unshift([L]),{...Xe,groups:ge}}const Ge=tu[ne].map(ge=>!Te&&Y[ne].has(ge)?ge:{value:ge,disabled:!0});return{...Xe,items:ne==="jong"&&!t.requireCoda?[L,...Ge]:Ge}};A.push(K("cho",M.trainOnset)),A.push(K("jung",M.trainVowel)),A.push(K("jong",M.trainCoda))}if(A.push({...Xr(o,G,{labelAction:Ce([o("wordPairs.filter.difficultyInfo",{defaultValue:"\uAD6D\uB9BD\uAD6D\uC5B4\uC6D0\uC758 \uAE30\uCD08 \uC5B4\uD718 \uB4F1\uAE09\uC774 \uACB0\uACFC\uC5D0 \uBC18\uC601\uB429\uB2C8\uB2E4."})])}),label:M.gradeLabel}),t.partOfSpeech&&A.push(Zr(G)),t.wordType&&A.push(Jr(G)),t.choseong||t.fixedSyllable!=null){const L=t.fixedSyllable;A.push({label:M.syllableCount,items:[...Qr.map($=>({value:fo($),displayLabel:o("wordPairs.syllableN",{n:$,defaultValue:"{{n}}\uC74C\uC808"}),disabled:L!=null?$!==L:!Ae.exact.has($)||$<ee})),{value:fo(ot),displayLabel:o("wordPairs.syllableNPlus",{n:ot,defaultValue:"{{n}}\uC74C\uC808 \uC774\uC0C1"}),disabled:L!=null?ot!==L:!Ae.min}],allOption:!0,allOptionDisabled:L!=null})}return t.choseong?A.push({label:M.exclude,displayLabel:M.selectLabel,multiple:!0,items:[M.excludeImage,M.sameStructure],labelAction:Ce(He)}):A.push({label:M.exclude,displayLabel:M.selectLabel,multiple:!0,items:[M.excludeImage],labelAction:Ce([He[0]])}),A},[t.choseong,t.partOfSpeech,t.wordType,t.requireSyllable,t.fixedSyllable,t.fixedNoCoda,t.requireCoda,ee,Y,W,h,Ae,M,o,Ce,He,G]),Ke={...t.difficulty?{[M.diffPhonemeCount]:String(c)}:{},...(t.choseong||t.fixedSyllable!=null)&&s.syllable!=null?{[M.syllableCount]:fo(s.syllable)}:{},...t.choseong&&s.cho?{[M.trainOnset]:s.cho}:{},...t.choseong&&s.jung?{[M.trainVowel]:s.jung}:{},...t.choseong&&s.jong?{[M.trainCoda]:s.jong}:{},[M.exclude]:[...m?[M.excludeImage]:[],...k?[M.sameStructure]:[]],[M.gradeLabel]:R.map(A=>o("wordSearch.filter.grade",{n:Number(A),defaultValue:"{{n}}\uB4F1\uAE09"})),...t.partOfSpeech?{[G.partOfSpeech]:j}:{},...t.wordType?{[G.wordType]:U}:{}},rt=q((A,L)=>{if(L===M.diffPhonemeCount){const $=Number(A);$>=1&&f($)}else if(L===M.exclude)A===M.excludeImage?E($=>!$):A===M.sameStructure&&x($=>!$);else if(L===M.syllableCount)y($=>{if(!A||A===St)return{...$,syllable:null};const K=Hd(A);return{...$,syllable:$.syllable===K?null:K}});else if(L===M.gradeLabel){if(!A||A===St){v([]);return}const $=A.replace(/\D/g,"");v(K=>K.includes($)?K.filter(ne=>ne!==$):[...K,$])}else if(L===G.partOfSpeech){if(!A||A===St){H([]);return}H($=>$.includes(A)?$.filter(K=>K!==A):[...$,A])}else if(L===G.wordType){if(!A||A===St){F([]);return}F($=>$.includes(A)?$.filter(K=>K!==A):[...$,A])}else{const $=fe[L];if(!$)return;y(K=>t.requireSyllable?A&&A!==St?{...K,[$]:A}:K:!A||A===St||K[$]===A?{...K,[$]:null}:{...K,[$]:A})}},[M,fe,G,t.requireSyllable]),Ue=q(A=>!t.partOfSpeech&&!t.wordType?!0:Id(A,{...t.partOfSpeech?{[G.partOfSpeech]:j}:{},...t.wordType?{[G.wordType]:U}:{}},G),[t.partOfSpeech,t.wordType,j,U,G]),te=q(A=>{A!==h&&(A!=="direct"&&h!=="direct"&&y(L=>uu(L,A,g.current)),p(A))},[h]),ut=q(()=>({composition:s,contrastCount:c,excludeNoImage:m,sameStructureOnly:k,phonemeView:h,gradeFilter:R}),[s,c,m,k,h,R]),ae=q(A=>{y(A.composition),f(A.contrastCount),E(A.excludeNoImage),x(A.sameStructureOnly??!0),p(A.phonemeView),v(Array.isArray(A.gradeFilter)?A.gradeFilter:[])},[]);return{difficulty:w,contrastCount:c,composition:s,choseong:s.cho,excludeNoImage:m,sameStructureOnly:k,gradeFilter:R,posFilter:j,wordTypeFilter:U,matchesWordAttributes:Ue,poolVersion:P,filterSections:ft,filterSelected:Ke,handleFilterSelect:rt,phonemeView:h,setPhonemeView:te,phonemeGroupLabel:M.phonemeGroup,wordCount:me,getFilterSnapshot:ut,restoreFilterSnapshot:ae}}function qd(e){const t=l=>l?pt(l):null,n=t(e.cho),o=t(e.jung),r=e.jong===nt,u=r?null:t(e.jong),i=e.syllable!=null?Co(e.syllable):null;return!n&&!o&&!u&&!r&&!i?null:{cho:n,jung:o,jong:u,jongNone:r,syllable:i}}function Wd(e,t,n,o,r,u,i=!0,l="char",c=[]){const[f,h]=B({}),[p,s]=B(!1),{cho:y=null,jung:b=null,jong:w=null,syllable:g=null}=o??{};return X(()=>{u>0&&za(r).catch(()=>{})},[u,r]),X(()=>{let m=!1;return s(!0),(async()=>{const E=qd({cho:y,jung:b,jong:w,syllable:g}),k=c.length>0?c.slice().sort().join(","):"",x=`${y??""}_${b??""}_${w??""}_${g??""}_${k}`,R={};await Promise.all(e.map(async v=>{const j=Wn[v.key];try{const H=await yr(v.key,{difficulty:j.difficulty?t:null,contrastCount:j.difficulty?n:1,composition:j.choseong?E:null,count:5,excludeNoImage:r,sameStructureOnly:i,phonemeView:l,grade:c.length>0?c:null});H&&H.length>0?R[v.key]={id:`wt-${v.key}-${t}-${x}-${Date.now()}`,name:v.label,training_type:v.key,category_main_code:"WORD",iconColor:v.color,subTitle:v.subTitle,items:H,itemCount:H.length}:R[v.key]={id:`wt-${v.key}-empty`,name:v.label,training_type:v.key,category_main_code:"WORD",iconColor:v.color,subTitle:v.subTitle,items:[],itemCount:0,__empty:!0}}catch{R[v.key]=null}})),m||(h(R),s(!1))})(),()=>{m=!0}},[t,n,y,b,w,g,r,i,l,u,c]),{perTypeData:f,generating:p}}function Kd(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0}function Xd(e){let t=e>>>0;return()=>{t|=0,t=t+1831565813|0;let n=Math.imul(t^t>>>15,1|t);return n=n+Math.imul(n^n>>>7,61|n)^n,((n^n>>>14)>>>0)/4294967296}}const On=dt;function _o(e,t){const n=t?Xd(Kd(t)):Math.random;return{LISTEN_IN_NOISE:On(rn,Math.max(0,e.LISTEN_IN_NOISE||0),n),SHORT_STORY:On(un,Math.max(0,e.SHORT_STORY||0),n),LONG_STORY:On(an,Math.max(0,e.LONG_STORY||0),n),ORDERING_SENTENCE:On(ln,Math.max(0,e.ORDERING_SENTENCE||0),n)}}function iu(e){return e?!!(e.LISTEN_IN_NOISE?.length||e.SHORT_STORY?.length||e.LONG_STORY?.length||e.ORDERING_SENTENCE?.length):!1}const Zd={LISTEN_IN_NOISE:3,SHORT_STORY:2,LONG_STORY:1,ORDERING_SENTENCE:2};function lu(e=!1,t=Zd,n){const o=Dn(Date.now()),r=Dn(Date.now()-864e5),u=`${n??""}|${o}`,i=`${n??""}|${r}`;return rn.length>0||un.length>0||an.length>0||ln.length>0?{today:_o(t,u),yesterday:_o(t,i)}:{today:_o(t,u),yesterday:null}}function Jd(e){const t=Oe({LISTEN_IN_NOISE:[],SHORT_STORY:[],LONG_STORY:[],ORDERING_SENTENCE:[]}),n=Oe(null),[o,r]=B(!1),[u,i]=B(!1),[l,c]=B(0);X(()=>{let h=!1,p,s=0;const y=40,b=()=>{p!==void 0&&(clearInterval(p),p=void 0)};let w=!1;try{const E=new URLSearchParams(window.location.search),k=E.get("forceRefresh")||E.get("force");w=k==="1"||k==="true"}catch{}const g=E=>{t.current=E.today,n.current=E.yesterday,r(!0),c(k=>k+1),h=!0,b()},m=async()=>{if(h)return;if(!w){const k=lu(!1,void 0,e);if(iu(k.today)){g(k);return}}try{await gd(3e3)}catch{}if(h)return;const E=lu(w,void 0,e);if(iu(E.today)){g(E);return}++s>=y&&(r(!0),h=!0,b())};return m(),p=setInterval(m,250),()=>{h=!0,b()}},[e]);const f=q(h=>{const p=u?n.current:t.current,s=u?t.current:n.current;return p?.[h]?.length?p[h]:s?.[h]?.length?s[h]:void 0},[u,l]);return{loaded:o,showYesterday:u,setShowYesterday:i,getTrainingPerType:f}}const $t=[];let Ln=!1;function cu(e){if(e.key!=="Escape"||e.defaultPrevented)return;const t=$t[$t.length-1];t&&(e.stopPropagation(),t())}function Qd(e){return $t.push(e),!Ln&&typeof document<"u"&&(document.addEventListener("keydown",cu),Ln=!0),()=>{const t=$t.lastIndexOf(e);t>=0&&$t.splice(t,1),$t.length===0&&Ln&&typeof document<"u"&&(document.removeEventListener("keydown",cu),Ln=!1)}}function eh(e,t=!0){const n=Ho(e);X(()=>{if(t)return Qd(()=>{n.current?.()})},[t,n])}const Eo=(e,t)=>`${e}:${t??1}`,bo=new Map;function th(e,t){const[n,o]=B(0),r=e.map(u=>Eo(u.word,u.homonum)).join("|");return X(()=>{const u=(r?r.split("|"):[]).filter(c=>!bo.has(c));if(u.length===0)return;let i=!1;const l=Array.from(new Set(u.map(c=>c.slice(0,c.lastIndexOf(":")))));return t(l).then(c=>{if(!(i||c.length===0)){for(const f of c)f.Meaning&&bo.set(Eo(f.Word,f.Homonum??void 0),f.Meaning);o(f=>f+1)}}),()=>{i=!0}},[r,t]),we(()=>{const u=r?r.split("|"):[],i=new Map;for(const l of u){const c=bo.get(l);c!=null&&i.set(l,c)}return i},[r,n])}function nh(e,t,n){const o=Number.isFinite(t)&&t>=1?Math.floor(t):1,r=Math.max(1,Math.ceil(e.length/o)),u=Number.isFinite(n)?Math.min(Math.max(1,Math.floor(n)),r):1;return{pageItems:we(()=>e.slice((u-1)*o,u*o),[e,u,o]),totalPages:r,curPage:u}}function oh(e="warning"){const[t,n]=B(""),[o,r]=B(e),[u,i]=B(0),l=q((p,s)=>{r(s),n(p),i(y=>y+1)},[]),c=q(p=>l(p,"warning"),[l]),f=q(p=>l(p,"normal"),[l]),h=q(()=>n(""),[]);return{toastMessage:t,toastType:o,toastKey:u,showToast:l,showWarning:c,showNormal:f,clearToast:h}}const sn={blue:"#60A5FA",green:"#4ADE80",amber:"#FBBF24",purple:"#A78BFA",pink:"#F472B6"},dn=sn.blue,Rn=sn.green,hn=sn.amber,In=sn.purple,rh=sn.pink,uh=[{key:"discrimination",label:"\uBCC0\uBCC4\uD6C8\uB828",disc:"\uB450 \uC18C\uB9AC\uAC00 \uAC19\uC740\uC9C0 \uB2E4\uB978\uC9C0, \uB610\uB294 \uD2B9\uC815 \uC18C\uB9AC\uB97C \uAD6C\uBCC4\uD558\uB294 \uD6C8\uB828\uC785\uB2C8\uB2E4.",icon:"ear",types:[{key:"SAME_SOUND_PICK",label:"\uAC19\uC740 \uC18C\uB9AC \uACE0\uB974\uAE30",icon:"volume-2",color:dn,subTitle:"\uB4E4\uC740 \uC18C\uB9AC\uC640 \uAC19\uC740 \uB2E8\uC5B4 \uCE74\uB4DC\uB97C \uACE0\uB974\uC138\uC694."},{key:"SAME_OR_DIFF",label:"\uAC19\uC740\uC9C0 \uB2E4\uB978\uC9C0 \uB9DE\uD788\uAE30",icon:"diff",color:dn,subTitle:"\uB450 \uC18C\uB9AC\uAC00 \uAC19\uC740\uC9C0, \uB2E4\uB978\uC9C0 \uAD6C\uBD84\uD558\uC138\uC694."},{key:"HEAR_AND_PICK_SAME",label:"\uC77C\uCE58\uD558\uB294 \uB2E8\uC5B4 \uB9DE\uD788\uAE30",icon:"headphones",color:dn,subTitle:"\uB4E4\uC740 \uC18C\uB9AC\uC758 \uB2E8\uC5B4 \uCE74\uB4DC\uB97C \uACE0\uB974\uC138\uC694."},{key:"HEAR_AND_PICK_INCLUDED",label:"\uD55C \uC74C\uC808 \uD3EC\uD568 \uB2E8\uC5B4 \uB9DE\uD788\uAE30",icon:"scan-search",color:dn,subTitle:"\uB4E4\uC740 \uC74C\uC808\uC774 \uD3EC\uD568\uB41C \uB2E8\uC5B4 \uCE74\uB4DC\uB97C \uACE0\uB974\uC138\uC694."},{key:"STARTS_WITH_SAME_SOUND",label:"\uCCAB \uC74C\uC808\uC774 \uAC19\uC740 \uB2E8\uC5B4 \uB9DE\uD788\uAE30",icon:"play-circle",color:dn,subTitle:"\uB4E4\uC740 \uB2E8\uC5B4\uC640 \uAC19\uC740 \uC18C\uB9AC\uB85C \uC2DC\uC791\uD558\uB294 \uB2E8\uC5B4\uB97C \uACE0\uB974\uC138\uC694."}]},{key:"synthesis",label:"\uD569\uC131\uD6C8\uB828",disc:"\uB450 \uAC1C \uC774\uC0C1\uC758 \uC74C\uC808\uC774\uB098 \uC74C\uC18C\uB97C \uD569\uCCD0 \uB2E8\uC5B4\uB97C \uB9CC\uB4DC\uB294 \uD6C8\uB828\uC785\uB2C8\uB2E4.",icon:"git-merge",types:[{key:"MERGE_2_SYLLABLES",label:"\uC74C\uC808 2\uAC1C \uD569\uCE58\uAE30",icon:"link-2",color:Rn,subTitle:"\uB450 \uC74C\uC808\uC744 \uD569\uCE58\uBA74 \uC5B4\uB5A4 \uB2E8\uC5B4\uAC00 \uB420\uAE4C\uC694?"},{key:"MERGE_3_SYLLABLES",label:"\uC74C\uC808 3\uAC1C \uD569\uCE58\uAE30",icon:"git-merge",color:Rn,subTitle:"\uC138 \uC74C\uC808\uC744 \uD569\uCE58\uBA74 \uC5B4\uB5A4 \uB2E8\uC5B4\uAC00 \uB420\uAE4C\uC694?"},{key:"MERGE_2_PHONEMES",label:"\uC74C\uC18C 2\uAC1C \uD569\uCE58\uAE30",icon:"combine",color:Rn,subTitle:"\uB450 \uC74C\uC18C\uB97C \uD569\uCE58\uBA74 \uC5B4\uB5A4 \uC18C\uB9AC\uAC00 \uB420\uAE4C\uC694?"},{key:"MERGE_3_PHONEMES",label:"\uC74C\uC18C 3\uAC1C \uD569\uCE58\uAE30",icon:"braces",color:Rn,subTitle:"\uC138 \uC74C\uC18C\uB97C \uD569\uCE58\uBA74 \uC5B4\uB5A4 \uC18C\uB9AC\uAC00 \uB420\uAE4C\uC694?"}]},{key:"deletion",label:"\uD0C8\uB77D\uD6C8\uB828",disc:"\uB2E8\uC5B4\uC5D0\uC11C \uC74C\uC808\uC774\uB098 \uC74C\uC18C\uB97C \uC81C\uAC70\uD588\uC744 \uB54C \uB0A8\uB294 \uC18C\uB9AC\uB97C \uC778\uC2DD\uD558\uB294 \uD6C8\uB828\uC785\uB2C8\uB2E4.",icon:"scissors",types:[{key:"DROP_1_FROM_2SYLL",label:"2\uC74C\uC808\uC5D0\uC11C 1\uC74C\uC808 \uD0C8\uB77D",icon:"scissors",color:hn,subTitle:"2\uC74C\uC808 \uB2E8\uC5B4\uC5D0\uC11C \uD55C \uC74C\uC808\uC744 \uBE7C\uBA74 \uC5B4\uB5A4 \uC18C\uB9AC\uAC00 \uB420\uAE4C\uC694?"},{key:"DROP_1_FROM_3SYLL",label:"3\uC74C\uC808\uC5D0\uC11C 1\uC74C\uC808 \uD0C8\uB77D",icon:"minus-circle",color:hn,subTitle:"3\uC74C\uC808 \uB2E8\uC5B4\uC5D0\uC11C \uD55C \uC74C\uC808\uC744 \uBE7C\uBA74 \uC5B4\uB5A4 \uC18C\uB9AC\uAC00 \uB420\uAE4C\uC694?"},{key:"DROP_PART_FROM_COMPOUND",label:"\uD569\uC131\uC5B4\uC5D0\uC11C \uBD80\uBD84\uD0C8\uB77D",icon:"unlink",color:hn,subTitle:"\uD569\uC131\uC5B4\uC758 \uC77C\uBD80\uB97C \uBE7C\uBA74 \uC5B4\uB5A4 \uB2E8\uC5B4\uAC00 \uB420\uAE4C\uC694?"},{key:"DROP_FINAL_CONSONANT_FROM_1SYLL",label:"1\uC74C\uC808\uC5D0\uC11C \uBC1B\uCE68 \uD0C8\uB77D",icon:"eraser",color:hn,subTitle:"\uBC1B\uCE68\uC744 \uBE7C\uBA74 \uC5B4\uB5A4 \uC18C\uB9AC\uAC00 \uB420\uAE4C\uC694?"},{key:"REMOVE_CONSONANT_AND_IDENTIFY_PHONEME",label:"1\uC74C\uC808\uC5D0\uC11C \uC790\uC74C \uD0C8\uB77D",icon:"audio-lines",color:hn,subTitle:"\uC790\uC74C\uC744 \uBE7C\uBA74 \uC5B4\uB5A4 \uC18C\uB9AC\uAC00 \uB0A8\uC744\uAE4C\uC694?"}]},{key:"substitution",label:"\uB300\uCE58\uD6C8\uB828",disc:"\uB2E8\uC5B4\uC758 \uC77C\uBD80 \uC74C\uC808\uC774\uB098 \uC74C\uC18C\uB97C \uBC14\uAFB8\uC5B4 \uC0C8\uB85C\uC6B4 \uC18C\uB9AC\uB97C \uB9CC\uB4DC\uB294 \uD6C8\uB828\uC785\uB2C8\uB2E4.",icon:"replace",types:[{key:"CHANGE_1_SYLL_IN_2SYLL",label:"2\uC74C\uC808\uC5D0\uC11C \uD55C \uC74C\uC808 \uBC14\uAFB8\uAE30",icon:"replace",color:In,subTitle:"2\uC74C\uC808 \uB2E8\uC5B4\uC758 \uD55C \uC74C\uC808\uC744 \uBC14\uAFD4 \uC0C8 \uB2E8\uC5B4\uB97C \uB9CC\uB4DC\uC138\uC694."},{key:"CHANGE_1_SYLL_IN_3SYLL",label:"3\uC74C\uC808\uC5D0\uC11C \uD55C \uC74C\uC808 \uBC14\uAFB8\uAE30",icon:"shuffle",color:In,subTitle:"3\uC74C\uC808 \uB2E8\uC5B4\uC758 \uD55C \uC74C\uC808\uC744 \uBC14\uAFD4 \uC0C8 \uB2E8\uC5B4\uB97C \uB9CC\uB4DC\uC138\uC694."},{key:"CHANGE_1_PHONEME_IN_1SYLL",label:"1\uC74C\uC808\uC5D0\uC11C \uD55C \uC74C\uC18C \uBC14\uAFB8\uAE30",icon:"arrow-right-left",color:In,subTitle:"1\uC74C\uC808 \uB2E8\uC5B4\uC758 \uD55C \uC74C\uC18C\uB97C \uBC14\uAFD4 \uC0C8 \uC18C\uB9AC\uB97C \uB9CC\uB4DC\uC138\uC694."},{key:"CHANGE_1_PHONEME_IN_2SYLL",label:"2\uC74C\uC808\uC5D0\uC11C \uD55C \uC74C\uC18C \uBC14\uAFB8\uAE30",icon:"flip-horizontal",color:In,subTitle:"2\uC74C\uC808 \uB2E8\uC5B4\uC758 \uD55C \uC74C\uC18C\uB97C \uBC14\uAFD4 \uC0C8 \uB2E8\uC5B4\uB97C \uB9CC\uB4DC\uC138\uC694."}]},{key:"attention",label:"\uCCAD\uAC01\uC801\uC8FC\uC758\uB825\uD6C8\uB828",disc:"\uC5EC\uB7EC \uC18C\uB9AC\uB97C \uB4E3\uACE0 \uC21C\uC11C\uB97C \uAE30\uC5B5\uD558\uB294 \uC8FC\uC758\uB825\uACFC \uB2E8\uAE30 \uAE30\uC5B5 \uD6C8\uB828\uC785\uB2C8\uB2E4.",icon:"list-ordered",types:[{key:"LISTEN_AND_REMEMBER_ORDER",label:"\uB4E3\uACE0 \uC21C\uC11C\uB300\uB85C \uAE30\uC5B5\uD558\uAE30",icon:"list-ordered",color:rh,subTitle:"\uC138 \uB2E8\uC5B4\uB97C \uB4E4\uC740 \uC21C\uC11C\uB300\uB85C \uCE74\uB4DC\uB97C \uC120\uD0DD\uD558\uC138\uC694."}]}];function ah(){const{t:e}=kt();return we(()=>{const t=Object.fromEntries(bd(e).map(o=>[o.key,o.label])),n={...t};return uh.flatMap(o=>o.types).forEach(o=>{n[o.key]=e(`trainingType.${o.key}.label`,{defaultValue:o.label})}),{sentence:t,all:n}},[e])}export{Xo as CACHE_GROUPS,Uo as DocumentTitleSuppressContext,go as EMPTY_COMPOSITION,Fo as MediaQueryOverrideContext,nt as NO_CODA,ot as SYLLABLE_MIN,er as VAP_PAGE_SIZE_OPTIONS,Xr as buildGradeSection,Zr as buildPartOfSpeechSection,xd as buildPositionSection,Dd as buildSelectSection,Bd as buildSyllableSection,Jr as buildWordTypeSection,ou as charToPronValue,uu as convertComposition,qu as fmtBytes,Zo as lsBytes,Eo as meaningKey,ru as pronToCharValue,Co as syllableToFilter,Kt as today,vd as toggleAttributeFilter,Wu as useCacheManagement,Jd as useDailyTrainingSelection,Md as useDelayedHoverAnchor,oa as useDeviceManagement,Du as useDocumentTitle,eh as useEscToClose,Mu as useFontScale,Wr as useHoverAnchor,Bu as useMediaQuery,nh as usePagedList,vu as usePasswordChange,xu as useRelativeDay,ta as useTablePaging,na as useTableSort,oh as useToastState,ah as useTrainingTypeLabels,ea as useVisitAllPanel,Zu as useVisitHistory,Qu as useVisitSchedule,zo as useWindowEvent,Kr as useWordAttributeFilterKeys,Ku as useWordDataStats,th as useWordMeanings,Wd as useWordTrainingDataGeneration,Yd as useWordTrainingFilter,pt as valueToJamos};
|