@qnroa/qtype 0.2.0 → 0.2.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.
@@ -54,7 +54,7 @@ Error generating stack: `+o.message+`
54
54
  *
55
55
  * This source code is licensed under the MIT license found in the
56
56
  * LICENSE file in the root directory of this source tree.
57
- */var nd=v,CV=_8;function EV(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var RV=typeof Object.is=="function"?Object.is:EV,_V=CV.useSyncExternalStore,TV=nd.useRef,MV=nd.useEffect,PV=nd.useMemo,IV=nd.useDebugValue;C8.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var o=TV(null);if(o.current===null){var s={hasValue:!1,value:null};o.current=s}else s=o.current;o=PV(function(){function a(p){if(!c){if(c=!0,h=p,p=r(p),i!==void 0&&s.hasValue){var g=s.value;if(i(g,p))return d=g}return d=p}if(g=d,RV(h,p))return g;var y=r(p);return i!==void 0&&i(g,y)?(h=p,g):(h=p,d=y)}var c=!1,h,d,u=n===void 0?null:n;return[function(){return a(t())},u===null?void 0:function(){return a(u())}]},[t,n,r,i]);var l=_V(e,o[0],o[1]);return MV(function(){s.hasValue=!0,s.value=l},[l]),IV(l),l};S8.exports=C8;var LV=S8.exports;function NV(e,t){return e===t}function Pi(e,t,n=NV){const r=v.useCallback(s=>{if(!e)return()=>{};const{unsubscribe:l}=e.subscribe(s);return l},[e]),i=v.useCallback(()=>e==null?void 0:e.get(),[e]);return LV.useSyncExternalStoreWithSelector(r,i,i,t,n)}var m0={};function DV(e,t){const n=v.useRef();return r=>{const i=e!=null&&e.select?e.select(r):r;return(e==null?void 0:e.structuralSharing)??t.options.defaultStructuralSharing?n.current=ho(n.current,i):i}}function Bo(e){const t=pr(),n=v.useContext(e.from?fV:td),r=e.from??n,i=t.stores.getMatchStore(r),o=DV(e,t),s=Pi(i,l=>l?o(l):m0);if(s!==m0)return s;(e.shouldThrow??!0)&&K3()}function T8(e){return Bo({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function M8(e){const{select:t,...n}=e;return Bo({...n,select:r=>t?t(r.loaderDeps):r.loaderDeps})}function P8(e){return Bo({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{const n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function I8(e){return Bo({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function rc(e){const t=pr();return v.useCallback(n=>t.navigate({...n,from:n.from??(e==null?void 0:e.from)}),[e==null?void 0:e.from,t])}function L8(e){return Bo({...e,select:t=>e.select?e.select(t.context):t.context})}function lh(e){const t=v.useRef(e);return zi(t.current,e,{ignoreUndefined:!1})||(t.current=e),t.current}function OV(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function BV(e,t,n){if(e!=null&&e.external)return l1(e.href,n)?void 0:e.href;if(!GV(t)&&!(typeof t!="string"||t.indexOf(":")===-1))try{return new URL(t),l1(t,n)?void 0:t}catch{}}function FV(e,t,n,r,i,o){if(o)return!1;if(n!=null&&n.exact){if(!Vb(e.pathname,t.pathname,r))return!1}else{const s=c1(e.pathname,r),l=c1(t.pathname,r);if(!(s.startsWith(l)&&(s.length===l.length||s[l.length]==="/")))return!1}return((n==null?void 0:n.includeSearch)??!0)&&!zi(e.search,t.search,{partial:!(n!=null&&n.exact),ignoreUndefined:!(n!=null&&n.explicitUndefined)})?!1:n!=null&&n.includeHash?i&&e.hash===t.hash:!0}function HV(e,t){const n=pr(),r=sb(t),{activeProps:i,inactiveProps:o,activeOptions:s,to:l,preload:a,preloadDelay:c,preloadIntentProximity:h,hashScrollIntoView:d,replace:u,startTransition:p,resetScroll:g,viewTransition:y,children:q,target:m,disabled:A,style:w,className:x,onClick:V,onBlur:k,onFocus:b,onMouseEnter:j,onMouseLeave:z,onTouchStart:S,ignoreBlocker:R,params:T,search:E,hash:C,state:_,mask:L,reloadDocument:D,unsafeRelative:M,from:N,_fromLocation:O,...$}=e,P=V8(),H=lh(e.search),Z=lh(e.params),G=lh(s),Q=v.useMemo(()=>e,[n,e.from,e._fromLocation,e.hash,e.to,H,Z,e.state,e.mask,e.unsafeRelative]),le=v.useCallback(te=>{const pe=n.buildLocation({_fromLocation:te,...Q}),ke=$V(pe.maskedLocation?pe.maskedLocation.publicHref:pe.publicHref,pe.maskedLocation?pe.maskedLocation.external:pe.external,n.history,A),$t=BV(ke,l,n.protocolAllowlist);return[ke==null?void 0:ke.href,$t,FV(te,pe,G,n.basepath,P,$t!==void 0)]},[G,A,P,Q,n,l]),[F,ie,be]=Pi(n.stores.location,le,OV),Ae=be?Xs(i,{})??UV:ah,qe=be?ah:Xs(o,{})??ah,ze=[x,Ae.className,qe.className].filter(Boolean).join(" "),Ve=(w||Ae.style||qe.style)&&{...w,...Ae.style,...qe.style},ge=v.useRef(!1),ye=e.reloadDocument||ie||A?!1:a??n.options.defaultPreload,Ee=c??n.options.defaultPreloadDelay??0,ae=v.useCallback(()=>{n.preloadRoute(Q).catch(te=>{console.warn(te),console.warn(lV)})},[n,Q]),dt=v.useCallback(te=>{if(!te){ch(r);return}if(!(te.isIntersecting??ye==="intent")){te.isIntersecting===!1&&ch(r);return}if(!Ee){ae();return}oa.has(r)||oa.set(r,setTimeout(()=>{oa.delete(r),ae()},Ee))},[ae,r,ye,Ee]);ob(r,dt,ye!=="viewport"),v.useEffect(()=>{ge.current||ye==="render"&&(ae(),ge.current=!0)},[ae,ye]);const Lt=te=>{const pe=te.currentTarget.getAttribute("target"),ke=m!==void 0?m:pe;!A&&!(te.metaKey||te.altKey||te.ctrlKey||te.shiftKey)&&!te.defaultPrevented&&(!ke||ke==="_self")&&te.button===0&&(te.preventDefault(),n.navigate({...Q,replace:u,resetScroll:g,hashScrollIntoView:d,startTransition:p,viewTransition:y,ignoreBlocker:R}))};if(ie)return{...$,ref:r,href:ie,...q&&{children:q},...m&&{target:m},...A&&{disabled:A},...w&&{style:w},...x&&{className:x},...V&&{onClick:V},...k&&{onBlur:k},...b&&{onFocus:b},...j&&{onMouseEnter:j},...z&&{onMouseLeave:z},...S&&{onTouchStart:S}};const I=()=>{ye==="intent"&&ae()},X=()=>{ye==="intent"&&ch(r)};return{...$,...Ae,...qe,href:F,ref:r,onClick:Qo([V,Lt]),onBlur:Qo([k,X]),onFocus:Qo([b,dt]),onMouseEnter:Qo([j,dt]),onMouseLeave:Qo([z,X]),onTouchStart:Qo([S,I]),disabled:!!A,target:m,...Ve&&{style:Ve},...ze&&{className:ze},...A&&WV,...be&&KV}}var ah={},UV={className:"active"},WV={role:"link","aria-disabled":!0},KV={"data-status":"active","aria-current":"page"},oa=new WeakMap,ch=e=>{clearTimeout(oa.get(e)),oa.delete(e)},Qo=e=>t=>{for(const n of e)if(n){if(t.defaultPrevented)return;n(t)}};function $V(e,t,n,r){if(!r)return t?{href:e,external:!0}:{href:n.createHref(e)||"/",external:!1}}function GV(e){if(typeof e!="string")return!1;const t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var N8=v.forwardRef((e,t)=>{const{_asChild:n,...r}=e,{type:i,...o}=HV(r,t),s=typeof r.children=="function"?r.children({isActive:o["data-status"]==="active"}):r.children;if(!n){const{disabled:l,...a}=o;return v.createElement("a",a,s)}return v.createElement(n,o,s)}),QV=class extends b8{constructor(t){super(t),this.useMatch=n=>Bo({select:n==null?void 0:n.select,from:this.id,structuralSharing:n==null?void 0:n.structuralSharing}),this.useRouteContext=n=>L8({...n,from:this.id}),this.useSearch=n=>I8({select:n==null?void 0:n.select,structuralSharing:n==null?void 0:n.structuralSharing,from:this.id}),this.useParams=n=>P8({select:n==null?void 0:n.select,structuralSharing:n==null?void 0:n.structuralSharing,from:this.id}),this.useLoaderDeps=n=>M8({...n,from:this.id}),this.useLoaderData=n=>T8({...n,from:this.id}),this.useNavigate=()=>rc({from:this.fullPath}),this.Link=re.forwardRef((n,r)=>f.jsx(N8,{ref:r,from:this.fullPath,...n}))}};function YV(e){return new QV(e)}var ZV=class extends aV{constructor(e){super(e),this.useMatch=t=>Bo({select:t==null?void 0:t.select,from:this.id,structuralSharing:t==null?void 0:t.structuralSharing}),this.useRouteContext=t=>L8({...t,from:this.id}),this.useSearch=t=>I8({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useParams=t=>P8({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useLoaderDeps=t=>M8({...t,from:this.id}),this.useLoaderData=t=>T8({...t,from:this.id}),this.useNavigate=()=>rc({from:this.fullPath}),this.Link=re.forwardRef((t,n)=>f.jsx(N8,{ref:n,from:this.fullPath,...t}))}};function XV(e){return new ZV(e)}function D8(e){return t=>{const n=YV(t);return n.isRoot=!1,n}}function JV(e){const t=pr(),n=`not-found-${Pi(t.stores.location,r=>r.pathname)}-${Pi(t.stores.status,r=>r)}`;return f.jsx(J3,{getResetKey:()=>n,onCatch:(r,i)=>{var o;if(zo(r))(o=e.onCatch)==null||o.call(e,r,i);else throw r},errorComponent:({error:r})=>{var i;if(zo(r))return(i=e.fallback)==null?void 0:i.call(e,r);throw r},children:e.children})}function ek(){return f.jsx("p",{children:"Not Found"})}function rs(e){return f.jsx(f.Fragment,{children:e.children})}function O8(e,t,n){return t.options.notFoundComponent?f.jsx(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?f.jsx(e.options.defaultNotFoundComponent,{...n}):f.jsx(ek,{})}function rd(e,t){const n=(t==null?void 0:t.options.pendingComponent)??e.options.defaultPendingComponent;return n?f.jsx(n,{}):null}var tk=(e,t)=>e[0]===t[0]&&e[1]===t[1],B8=(e,t,n)=>!t.isRoot||t.options.shellComponent||t.options.wrapInSuspense||n===!1||n==="data-only"||!e.ssr,F8=v.memo(function({routeId:t}){const n=pr();return f.jsx(nk,{router:n,match:Pi(n.stores.getMatchStore(t),r=>r)})});function nk({router:e,match:t}){var d,u;const n=e.routesById[t.routeId],r=rd(e,n),i=n.options.errorComponent??e.options.defaultErrorComponent,o=n.options.onCatch??e.options.defaultOnCatch,s=n.isRoot?n.options.notFoundComponent??((d=e.options.notFoundRoute)==null?void 0:d.options.component):n.options.notFoundComponent,l=t.ssr===!1||t.ssr==="data-only",a=B8(e,n,t.ssr)&&(n.options.wrapInSuspense??r??(((u=n.options.errorComponent)==null?void 0:u.preload)||l))?v.Suspense:rs,c=i?J3:rs,h=s?JV:rs;return f.jsxs(n.isRoot?n.options.shellComponent??rs:rs,{children:[f.jsx(td.Provider,{value:t.routeId,children:f.jsx(a,{fallback:r,children:f.jsx(c,{getResetKey:()=>t,errorComponent:i,onCatch:(p,g)=>{if(zo(p))throw p.routeId??(p.routeId=t.routeId),p;o==null||o(p,g)},children:f.jsx(h,{fallback:p=>{if(p.routeId??(p.routeId=t.routeId),p.routeId!==t.routeId)throw p;return v.createElement(s,p)},children:l?f.jsx(dV,{fallback:r,children:f.jsx(y0,{match:t})}):f.jsx(y0,{match:t})})})})}),null]})}var y0=v.memo(function({match:t}){const n=pr(),r=t.routeId,i=n.routesById[r],o=v.useMemo(()=>{var a;const l=(a=i.options.remountDeps??n.options.defaultRemountDeps)==null?void 0:a({routeId:r,loaderDeps:t.loaderDeps,params:t._strictParams,search:t._strictSearch});return l?JSON.stringify(l):void 0},[r,t.loaderDeps,t._strictParams,t._strictSearch,i.options.remountDeps,n.options.defaultRemountDeps]),s=v.useMemo(()=>{const l=i.options.component??n.options.defaultComponent;return l?f.jsx(l,{},o):f.jsx(H8,{})},[o,i.options.component,n.options.defaultComponent]);if(t.status==="pending"){if(n.ssr&&!B8(n,i,t.ssr))return s;if(n._tx)throw n._tx[5];return rd(n,i)}if(t.status==="notFound")return O8(n,i,t.error);if(t.status==="error")throw t.error;return s}),H8=v.memo(function(){const t=pr(),n=v.useContext(td);let r,i,o;{const l=t.stores.getMatchStore(n);[r,i]=Pi(l,a=>[!!a._notFound,a.error],tk),o=Pi(t.stores.ids,a=>a[a.indexOf(n)+1])}if(r)return O8(t,t.routesById[n],i);if(!o)return null;const s=f.jsx(F8,{routeId:o});return n===Ms?f.jsx(v.Suspense,{fallback:rd(t),children:s}):s});function U8(e,t){const n=e[1];e.length=0,n==null||n(t)}function rk({t:e}){const t=pr(),n=t._rendered??(t._rendered=[]);return t.startTransition=(r,i)=>new Promise((o,s)=>{U8(n,!1),n.push(i,o),e(t),v.startTransition(()=>{try{r()}catch(l){n[1]===o&&(n.length=0),s(l)}})}),e8(()=>{const r=t.history.subscribe(t.load);t.updateLatestLocation();const i=t.latestLocation,o=t.buildLocation({to:i.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});if(Vr(i.publicHref)!==Vr(o.publicHref))return t.commitLocation({...o,replace:!0,ignoreBlocker:!0}),r;const s=t.stores.resolvedLocation.get();return(s==null?void 0:s.href)===i.href&&s.state.__TSR_key===i.state.__TSR_key?n.push(t.stores.matches.get(),l=>{l&&t.emit({type:"onRendered",...J1(s,s)})}):t._tx||t.load().catch(console.error),r},[t,t.history]),null}function ik(){const e=pr(),t=e.routesById[Ms],n=rd(e,t),r=e.ssr?rs:v.Suspense,i=f.jsxs(f.Fragment,{children:[f.jsx(rk,{t:v.useState()[1]}),f.jsx(r,{fallback:n,children:f.jsx(ok,{})})]});return e.options.InnerWrap?f.jsx(e.options.InnerWrap,{children:i}):i}function ok(){const e=pr(),t=e._rendered,n=Pi(e.stores.matches,s=>t[0]??s),r=n[0],i=r==null?void 0:r.routeId;e8(()=>{t[0]===n&&U8(t,!0)},[t,n]);const o=i?f.jsx(F8,{routeId:i}):null;return f.jsx(td.Provider,{value:i,children:e.options.disableGlobalCatchBoundary?o:f.jsx(J3,{getResetKey:()=>r,onCatch:void 0,children:o})})}var sk=e=>({createMutableStore:p0,createReadonlyStore:p0,batch:AV}),lk=e=>new ak(e),ak=class extends Qb{constructor(e){super(e,sk)}};function ck({router:e,children:t,...n}){n8(n)&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});const r=f.jsx(k8.Provider,{value:e,children:t});return e.options.Wrap?f.jsx(e.options.Wrap,{children:r}):r}function uk({router:e,...t}){return f.jsx(ck,{router:e,...t,children:f.jsx(ik,{})})}class mi extends Error{constructor(n,r,i){super(i);Re(this,"code");Re(this,"vars");this.name="KvError",this.code=n,this.vars=r}}function _l(){try{return globalThis.localStorage??null}catch{return null}}class Uc{constructor(t,n=`qtype.config.${t}`){this.scope=t,this.storageKey=n}get origin(){return`localStorage:${this.storageKey}`}async available(){return _l()!==null}async read(){const t=_l();if(!t)return{};const n=t.getItem(this.storageKey);if(!n)return{};let r;try{r=JSON.parse(n)}catch(i){throw new mi("err.kv.storage.parseFailed",{origin:this.origin,reason:i.message},`${this.origin}: JSON parse error — ${i.message}`)}if(r==null)return{};if(typeof r!="object"||Array.isArray(r))throw new mi("err.kv.storage.parseFailed",{origin:this.origin,reason:`root must be a JSON object, got ${Array.isArray(r)?"array":typeof r}`},`${this.origin}: root must be a JSON object`);return r}async write(t){const n=_l();if(!n)throw new mi("err.kv.storage.unavailable",{scope:this.scope,origin:this.origin},`${this.origin}: localStorage not available`);try{n.setItem(this.storageKey,JSON.stringify(t))}catch(r){throw new mi("err.kv.storage.writeFailed",{origin:this.origin,reason:r.message},`${this.origin}: write failed — ${r.message}`)}}readSync(){const t=_l();if(!t)return{};const n=t.getItem(this.storageKey);if(!n)return{};try{const r=JSON.parse(n);if(r&&typeof r=="object"&&!Array.isArray(r))return r}catch{}return{}}writeSync(t){const n=_l();if(n)try{n.setItem(this.storageKey,JSON.stringify(t))}catch{}}}function Tl(){try{return globalThis.sessionStorage??null}catch{return null}}class dk{constructor(t,n=`qtype.${t}`){this.scope=t,this.storageKey=n}get origin(){return`sessionStorage:${this.storageKey}`}async available(){return Tl()!==null}async read(){const t=Tl();if(!t)return{};const n=t.getItem(this.storageKey);if(!n)return{};let r;try{r=JSON.parse(n)}catch(i){throw new mi("err.kv.storage.parseFailed",{origin:this.origin,reason:i.message},`${this.origin}: JSON parse error — ${i.message}`)}if(r==null)return{};if(typeof r!="object"||Array.isArray(r))throw new mi("err.kv.storage.parseFailed",{origin:this.origin,reason:`root must be a JSON object, got ${Array.isArray(r)?"array":typeof r}`},`${this.origin}: root must be a JSON object`);return r}async write(t){const n=Tl();if(!n)throw new mi("err.kv.storage.unavailable",{scope:this.scope,origin:this.origin},`${this.origin}: sessionStorage not available`);try{n.setItem(this.storageKey,JSON.stringify(t))}catch(r){throw new mi("err.kv.storage.writeFailed",{origin:this.origin,reason:r.message},`${this.origin}: write failed — ${r.message}`)}}readSync(){const t=Tl();if(!t)return{};const n=t.getItem(this.storageKey);if(!n)return{};try{const r=JSON.parse(n);if(r&&typeof r=="object"&&!Array.isArray(r))return r}catch{}return{}}writeSync(t){const n=Tl();if(n)try{n.setItem(this.storageKey,JSON.stringify(t))}catch{}}}const is={settings:new Uc("user","qtype.settings"),progress:new Uc("user","qtype.progress"),session:new dk("session","qtype.session"),keybindings:new Uc("user","qtype.keybindings"),handOffsets:new Uc("user","qtype.handOffsets")},e4={settings:is.settings.readSync(),progress:is.progress.readSync(),session:is.session.readSync(),keybindings:is.keybindings.readSync(),handOffsets:is.handOffsets.readSync()},Y2=new Map;function W8(e,t){return`${e}::${t}`}function el(e,t,n){const r=e4[e];return t in r?r[t]:typeof n=="function"?n():n}function vo(e,t,n){const r=e4[e];r[t]=n,is[e].writeSync(r),K8(e,t)}function t4(e,t,n){const r=W8(e,t);let i=Y2.get(r);return i||(i=new Set,Y2.set(r,i)),i.add(n),()=>i.delete(n)}function K8(e,t){const n=Y2.get(W8(e,t));if(n)for(const r of n)r()}if(typeof window<"u"){const e={"qtype.settings":"settings","qtype.progress":"progress","qtype.keybindings":"keybindings","qtype.handOffsets":"handOffsets"};window.addEventListener("storage",t=>{if(!t.key||!(t.key in e))return;const n=e[t.key];let r={};try{r=t.newValue!==null?JSON.parse(t.newValue):{}}catch{return}const i=e4[n],o=new Set([...Object.keys(i),...Object.keys(r)]);for(const s of o)Object.is(i[s],r[s])||(i[s]=r[s],K8(n,s))})}const hk={"settings.title":"设置","settings.subtitle":"修改偏好后立即生效,无需保存。","settings.search.placeholder":"搜索设置...","settings.search.empty":"没有找到匹配「{query}」的设置","settings.search.resultCount":"{count} 项匹配","settings.sidebar.aria":"设置分类","settings.action.expand":"放大","settings.action.shrink":"缩小","settings.group.general":"常规","settings.group.typing":"打字","settings.group.keyboard":"键盘","settings.tab.appearance":"外观","settings.tab.keyboard":"键盘","settings.tab.typing":"打字","settings.tab.typing_rules":"打字规则","settings.tab.audio":"音频","settings.tab.interface":"界面","settings.tab.data":"数据","settings.tab.language":"语言","settings.tab.shortcuts":"快捷键","settings.audio.title":"音频","settings.audio.subtitle":"键盘音效、错误提示音、语音朗读。","settings.audio.keySound":"键盘声音","settings.audio.keySound.desc":"敲击键盘时的音效。","settings.audio.errorSound":"错误声音","settings.audio.errorSound.desc":"打错字符时的提示音。","settings.audio.autoSpeak":"自动朗读","settings.audio.autoSpeak.desc":"切换单词/句子卡片时自动播放一次目标音频。","settings.audio.autoSpeakRepeat":"自动朗读次数","settings.audio.autoSpeakRepeat.desc":"自动朗读时连续播放的次数。","settings.audio.ttsVolume":"朗读音量","settings.audio.ttsVolume.desc":"朗读播放的音量。","settings.audio.ttsRate":"朗读语速","settings.audio.ttsRate.desc":"浏览器朗读的语速倍率。","settings.audio.completeSound":"完成提示音","settings.audio.completeSound.desc":"打完一张卡片时播放的提示音。","settings.audio.ttsProvider":"语音来源","settings.audio.ttsProvider.desc":"选择朗读服务。自动会根据浏览器语言选(zh 用网易,其他用 Google);网络不通时切换到浏览器兜底。","settings.audio.ttsProvider.streamelements":"StreamElements","settings.audio.ttsProvider.auto":"自动","settings.audio.ttsProvider.browser":"浏览器","settings.audio.ttsProvider.youdao":"网易","settings.audio.ttsProvider.google":"Google","settings.interface.title":"界面","settings.interface.subtitle":"打字区周边的显示元素。","settings.interface.showPhonetic":"显示音标/拼音","settings.interface.showPhonetic.desc":"单词/句子卡片的音标或拼音注解行。可在 HUD 里临时切换。","settings.interface.showGloss":"显示释义","settings.interface.showGloss.desc":"单词/句子卡片下方的释义或翻译。","settings.interface.neighborPreview":"邻卡预览","settings.interface.neighborPreview.desc":"打字区两侧显示上一张/下一张卡片的预览。","settings.interface.autoHideCursor":"自动隐藏鼠标","settings.interface.autoHideCursor.desc":"鼠标在打字区静止时自动淡出。","settings.interface.showResultPopup":"完成结果弹窗","settings.interface.showResultPopup.desc":"打完一张卡片时弹出成绩摘要。","settings.interface.codeSyntaxHighlight":"代码语法高亮","settings.interface.codeSyntaxHighlight.desc":"为代码卡片启用 Shiki 语法高亮。关闭以节省 ~1MB 下载,仅显示对错颜色。","settings.interface.mathRenderer":"数学公式渲染","settings.interface.mathRenderer.desc":"在题干 / 文章 / 短章里把 $...$ 和 $$...$$ 用 KaTeX 渲染成公式(懒加载,约 280KB)。关闭则显示 LaTeX 源码。","settings.interface.afkSeconds":"AFK 阈值","settings.interface.afkSeconds.desc":"在此时间内没有任何键盘、鼠标移动、滚轮或触摸操作时,arena 自动暂停。鼠标只是悬停不动、切换标签或窗口失焦也会立即暂停。","settings.appearance.title":"外观","settings.appearance.subtitle":"控制界面的整体视觉——主题、字体、间距。","settings.appearance.theme":"主题","settings.appearance.theme.desc":"控制界面整体的明暗基调。","settings.appearance.theme.dark":"暗色","settings.appearance.theme.light":"亮色","settings.appearance.theme.auto":"跟随系统","settings.appearance.uiLang":"界面语言","settings.appearance.uiLang.desc":"覆盖界面语言(默认跟随素材语言)。","settings.appearance.uiLang.auto":"自动","settings.appearance.fontSize":"字体大小","settings.appearance.fontSize.desc":"打字区文字的显示大小。","settings.appearance.letterSpacing":"字符间距","settings.appearance.letterSpacing.desc":"字符之间的横向间距。","settings.appearance.spaceGlyph":"空格样式","settings.appearance.spaceGlyph.desc":"空格如何可视化(横杠/中点/无)。","settings.appearance.breakWord":"换行断词","settings.appearance.breakWord.desc":"行末长单词是否拆开换行。","settings.keyboard.title":"键盘","settings.keyboard.subtitle":"打字页底部的键盘图与指法提示。","settings.keyboard.showKeyboard":"显示键盘图","settings.keyboard.showKeyboard.desc":"打字页底部显示 QWERTY 键盘,当前应按的键高亮。","settings.keyboard.showHands":"显示手掌","settings.keyboard.showHands.desc":"键盘图上叠加手掌图示,提示指法。依赖键盘图打开。","settings.keyboard.size":"键盘大小","settings.keyboard.size.desc":"键盘图的尺寸档位。","settings.keyboard.calibrate":"手位校准","settings.keyboard.calibrate.desc":"逐个手位微调手掌在键盘图上的位置,校准结果可导出为新默认值。","settings.keyboard.calibrate.open":"打开校准","settings.keyboard.keySound":"键盘声音","settings.keyboard.keySound.desc":"敲击键盘时的音效。","settings.keyboard.errorSound":"错误声音","settings.keyboard.errorSound.desc":"打错字符时的提示音。","settings.typing.title":"打字","settings.typing.subtitle":"影响打字过程的行为与判定。","settings.typing.hint":"答案提示","settings.typing.hint.desc":"关:答案区空白,凭记忆打;开:答案骨架显示,覆盖打字。","settings.typing.speedUnit":"速度单位","settings.typing.speedUnit.desc":"HUD 上显示的速度单位。WPM = 每分钟词数;CPM = 每分钟字符数,中文常用。","settings.typing.targetWpm":"目标速度","settings.typing.targetWpm.desc":"在文本上显示一个影子光标, 按目标 WPM 移动。0 = 关闭。","settings.typing.maxWrongRate":"最大错字率","settings.typing.maxWrongRate.desc":"错字率超过阈值时自动退格,防止硬闯。","settings.typing.tabBehavior":"Tab 键行为","settings.typing.tabBehavior.desc":"重置: 按 Tab 重打当前卡片;输入: Tab 展开成空格打入(代码用)。","settings.typing.tabBehavior.reset":"重置","settings.typing.tabBehavior.input":"输入","settings.typing.tabWidth":"Tab 宽度","settings.typing.tabWidth.desc":"输入模式下,一次 Tab 展开成几个空格。","settings.typing.tabWidth.2":"2 空格","settings.typing.tabWidth.4":"4 空格","settings.typing.completion":"完成条件","settings.typing.completion.desc":"打到末尾即完成 / 需要一遍无错 / 允许 ≤5% 错。","settings.typing.completion.through":"打完","settings.typing.completion.lenient":"容错","settings.typing.completion.perfect":"无错","settings.typing.advance":"通过后","settings.typing.advance.desc":"通过完成条件后自动进入下一张,或停在当前卡等你确认。","settings.typing.advance.auto":"自动","settings.typing.advance.manual":"确认","settings.typing.confirmKey":"确认键","settings.typing.confirmKey.desc":"确认模式下按哪个键进入下一张,键盘上会高亮提示。","settings.typing.confirmKey.enter":"回车","settings.typing.confirmKey.space":"空格","typing.advance.hint.enter":"按回车进入下一张","typing.advance.hint.space":"按空格进入下一张","settings.typing.retry":"失败重来","settings.typing.retry.desc":"未通过完成条件时,是否自动清空重试。","settings.typing.retry.off":"关","settings.typing.retry.auto":"打完检查","settings.typing.retry.immediate":"一错就重","settings.typing.maxRetries":"最多重试","settings.typing.maxRetries.desc":"本卡累计重试超过后自动跳过。","settings.typing.maxRetries.unlimited":"∞","settings.typing.autoHideCursor":"自动隐藏鼠标","settings.typing.autoHideCursor.desc":"打字时鼠标停留 3 秒自动隐藏,移动鼠标即恢复。","settings.typing.neighborPreview":"相邻卡片预览","settings.typing.neighborPreview.desc":"打字区左右两侧显示上一张 / 下一张卡片的标题,一眼看到接下来是什么。","settings.typing.ignoreCase":"忽略大小写","settings.typing.ignoreCase.desc":"开启后,大小写不同也视为正确输入。","settings.typing.ignorePunctuation":"忽略标点","settings.typing.ignorePunctuation.desc":"开启后遇到标点自动跳过,只需要打入字母/数字。","settings.typing.allowBackspace":"允许退格","settings.typing.allowBackspace.desc":"关闭后 Backspace 无效,输错只能重打。","settings.typing.minAccuracy":"最低准确率","settings.typing.minAccuracy.desc":"结算准确率低于该阈值时高亮提示。0 = 关闭。","hud.accuracy.low":"准确率低于 {min}%","hud.pinyinErrors":"拼音按键错误次数(不影响准确率)","typing.result.summary":"完成 · {speed} {unit} · 准确率 {accuracy}% · {seconds}s","settings.data.title":"数据","settings.data.subtitle":"导入 / 导出与全局重置。所有数据仅存在本地浏览器。","settings.data.completed":"已完成的资料","settings.data.completed.desc":"{count} 份资料已标记为完成。","settings.data.resetAll":"重置全部","settings.data.export":"导出进度","settings.data.export.desc":"将所有完成状态和卡片打字进度导出为 JSON 文件。","settings.data.export.action":"导出","settings.data.import":"导入进度","settings.data.import.desc":"从 JSON 文件恢复完成状态和卡片打字进度。","settings.data.import.action":"选择文件…","settings.language.title":"语言","settings.language.subtitle":"界面语言。","settings.language.label":"界面语言","settings.language.desc":"切换 UI 显示语言。","common.on":"开","common.off":"关","common.close":"关闭","common.cancel":"取消","common.confirm":"确定","common.save":"保存","common.reset":"重置","size.s":"小","size.m":"中","size.l":"大","spacing.tight":"紧","spacing.normal":"标准","spacing.wide":"宽","spaceGlyph.none":"无","confirm.resetDone":"确定要重置所有完成状态吗?此操作不可撤销。","confirm.overwriteImport":"导入将覆盖当前进度,继续?","confirm.resetAllOffsets":"清除所有本地校准, 回到打包默认?","toast.importOk":"导入完成","toast.importFail":"导入失败: {msg}","quickinput.placeholder.cmd":"输入命令名称…","quickinput.placeholder.help":"帮助","quickinput.placeholder.theme":"筛选主题…","quickinput.placeholder.cardJump":"输入 1 - {total} 跳到指定卡片…","quickinput.placeholder.noMultiCards":"当前资料没有多张卡片","quickinput.placeholder.default":"搜索资料、输入 > 执行命令、? 查看帮助","quickinput.cmd.exec":"执行命令…","quickinput.cmd.help":"帮助","quickinput.cmd.searchMaterials":"搜索资料","quickinput.cmd.searchMaterials.detail":"直接输入关键词","quickinput.cmd.searchMaterials.desc":"无前缀","quickinput.cmd.palette":"命令面板","quickinput.cmd.palette.detail":"执行主题、视图、进度等操作","quickinput.cmd.theme":"切换主题(当前:{current})","quickinput.cmd.theme.detail":"从命令面板或底栏","toolbar.selection.count.pre":"已选 ","toolbar.selection.count.mid":" · 共 {total}","toolbar.selection.selectAll":"全选","toolbar.selection.clearDone":"清除打过状态","toolbar.selection.cancel":"取消","toolbar.tags.expand":"展开全部标签","toolbar.tags.collapse":"折叠标签","toolbar.tags.clear":"清空","toolbar.tags.overflow.selected":"折叠区还有 {count} 个选中","toolbar.tags.clearN":"清空 {count} 个筛选","toolbar.type.placeholder":"类型","toolbar.tag.placeholder":"标签","toolbar.status.placeholder":"状态","toolbar.status.done":"已完成","toolbar.status.pending":"未完成","toolbar.search.placeholder":"搜索…","toolbar.search.empty":"无匹配","combobox.footer.selected":"已选 {count} 项","combobox.footer.clear":"清空","renderer.speak":"朗读","toolbar.selection.enter":"选择","toolbar.selection.enterAria":"进入选择模式","toolbar.view.grid":"卡片视图","toolbar.view.list":"列表视图","header.home":"回到首页","footer.theme.toDark":"切换到暗色","footer.theme.toLight":"切换到亮色","footer.settings":"设置","footer.settings.open":"打开设置","cmd.materials.search":"搜索资料","cmd.theme.pick":"选择主题(当前:{current})","cmd.theme.dark":"暗色","cmd.theme.light":"亮色","cmd.view.grid":"切换到卡片视图","cmd.view.list":"切换到列表视图","cmd.material.reload":"重新加载资料","cmd.material.random":"打开随机资料","cmd.progress.reset":"重置所有打过状态","cmd.progress.count":"已有 {count} 份","cmd.filter.reset":"清空筛选","cmd.hint.toggle":"切换提示模式(当前:{current})","cmd.hint.ghost":"跟打","cmd.hint.blind":"盲打","cmd.settings.open":"打开设置","cmd.card.jump":"跳到指定卡片(共 {total} 张)","cmd.card.jump.detail":"输入卡号","home.loading":"加载中…","home.empty":"资料为空","home.noMatch":"无匹配的资料","home.stats":"{materials} 份资料 · {cards} 张卡片","home.dir.count":"{count} 份资料","home.dir.progress":"{done} / {total} 完成","home.breadcrumb.root":"全部","typing.loadFailed":"资料加载失败 · {msg}","typing.backHome":"回首页","typing.done":"已完成","typing.deckSize":"{title} · {total} 张卡片","typing.card.unsupported":"该卡片包含无法练习的字符:","hud.pause.start":"开始","hud.pause.pause":"暂停","hud.hint.on":"提示: 开","hud.hint.off":"提示: 关","hud.keyboard.on":"键盘: 开","hud.keyboard.off":"键盘: 关","hud.hands.on":"手掌: 开","hud.hands.off":"手掌: 关","hud.back":"返回上一级","hud.more":"更多","hud.more.showPhonetic":"显示音标/拼音","hud.more.showGloss":"显示释义","hud.more.showHands":"显示手掌","hud.more.autoSpeak":"自动朗读","cardnav.aria":"卡片导航","cardnav.prev":"上一张","cardnav.prev.title":"上一张 (Alt+←)","cardnav.next":"下一张","cardnav.next.title":"下一张 (Alt+→)","cardnav.jumpToDone":"跳到第 {n} 张(已完成)","cardnav.jumpTo":"跳到第 {n} 张","cardnav.itemDone":"第 {n} 张 · 已完成","cardnav.item":"第 {n} 张","cardnav.input.aria":"跳到第 N 张","cardnav.input.hint":"点击跳转到指定卡片","materialCard.select":"选择","materialCard.unselect":"取消选择","materialCard.more":"更多","materialCard.clearDone":"清除状态","materialCard.cardCount":"{count} 张卡片","materialCard.done":"已完成","materialCard.count":"{count} 张","materialCard.peak":"最快 {value} {unit}","wpmHistory.peak":"最快","wpmHistory.avg":"平均","wpmHistory.last":"最近","wpmHistory.count":"样本","arena.mask.hint.pre":"点击或按","arena.mask.hint.post":"开始","arena.mask.paused":"已暂停","arena.mask.press":"按","arena.mask.toStart":"开始","arena.mask.resumeLabel":"点击或按暂停键继续","arena.violation.wrongRate":"错字率超过 {limit}%,请退格","arena.violation.leftBoundary":"不能通过左键移动到上一段落,只可用删除键","arena.violation.moveLimit":"仅可在末尾两位移动光标","arena.violation.bulkInput":"发现一次性输入大量文字","calibrator.title":"手位校准","calibrator.hint":"拖拽移动 · 点击换手势 · 方向键微调 (Shift ×10) · [ / ] 上/下一个","calibrator.prev":"◀ 上一个","calibrator.next":"下一个 ▶","calibrator.leftHand":"左手","calibrator.rightHand":"右手","calibrator.unsaved":"未保存","calibrator.customized":"已校准","calibrator.save":"保存","calibrator.cancel":"取消","calibrator.resetThis":"重置此项","calibrator.resetAll":"全部重置","calibrator.export":"导出 keyBindings.json","calibrator.picker.title":"选择手势 ({side})","password.checking":"检查加密状态…","password.desc":"该站点已加密,请输入访问密码","password.error":"密码错误","password.busy":"验证中…","password.unlock":"解锁","password.cooldown":"太多次尝试,请等待 {s} 秒后再试","password.rememberHint":"解锁后本次会话内不会再次提示","cmd.card.reset":"重置当前卡片","cmd.card.next":"下一张卡片","cmd.card.prev":"上一张卡片","cmd.theme.toMocha":"切换到 Mocha(暗色)","cmd.theme.toLatte":"切换到 Latte(亮色)","cmd.theme.toggle":"切换主题","err.badData":"数据格式不正确","err.noFile":"未选择文件","err.readFail":"读取失败","quickinput.theme.dark":"暗色 · ☾","quickinput.theme.light":"亮色 · ☀","quickinput.card.none":"当前资料没有多张卡片","quickinput.card.none.detail":"此模式在多卡资料中启用","quickinput.card.hint":"输入 1 - {total} 跳到指定卡片","quickinput.card.hint.detail":"按 Enter 跳转","quickinput.card.invalid":'"{input}" 不是有效卡号',"quickinput.card.range":"请输入 1 - {total}","quickinput.card.oor":"第 {n} 张超出范围","quickinput.card.jump":"跳到第 {n} 张","quickinput.card.current":"当前","quickinput.card.untitled":"(无标题)","quickinput.card.nomatch":'没有匹配 "{input}" 的卡片',"settings.shortcuts.title":"快捷键","settings.shortcuts.subtitle":"自定义快捷键。点击键位录制新的组合,Esc 取消。","settings.shortcuts.search":"搜索动作…","settings.shortcuts.reset":"重置","settings.shortcuts.resetAll":"全部重置","settings.shortcuts.disabled":"未绑定","settings.shortcuts.recording":"按下新的组合…","settings.shortcuts.conflict":"与 {name} 冲突","settings.shortcuts.noModifier":"无修饰键 · 打字时可能误触发","settings.shortcuts.group.global":"全局","settings.shortcuts.group.hud":"打字页 HUD","settings.shortcuts.group.card":"卡片导航","settings.shortcuts.confirmResetAll":"重置所有快捷键为默认?","action.palette.open":"打开搜索 / 命令面板","action.palette.commands":"打开命令面板","action.palette.search":"打开搜索","action.hud.pause":"开始 / 暂停","action.hud.hint":"切换答案提示","action.hud.keyboard":"切换键盘图","action.hud.hands":"切换手掌","action.hud.back":"返回上一级","action.card.prev":"上一张卡片","action.card.next":"下一张卡片","cmd.card.jump.registry":"跳到指定卡片","cmd.theme.pick.registry":"选择主题","cmd.hint.toggle.registry":"切换答案提示","toast.card.atFirst":"已经是第一张了","toast.card.atLast":"已经是最后一张了"},fk={"settings.title":"Settings","settings.subtitle":"Changes take effect immediately, no save needed.","settings.search.placeholder":"Search settings…","settings.search.empty":"No settings match “{query}”","settings.search.resultCount":"{count} matches","settings.sidebar.aria":"Settings categories","settings.action.expand":"Expand","settings.action.shrink":"Shrink","settings.group.general":"General","settings.group.typing":"Typing","settings.group.keyboard":"Keyboard","settings.tab.typing_rules":"Typing rules","settings.tab.audio":"Audio","settings.tab.interface":"Interface","settings.audio.title":"Audio","settings.audio.subtitle":"Keystroke sounds, error alert, spoken playback.","settings.audio.keySound":"Keystroke sound","settings.audio.keySound.desc":"Click sound played on each keystroke.","settings.audio.errorSound":"Error sound","settings.audio.errorSound.desc":"Alert played on a wrong character.","settings.audio.autoSpeak":"Auto-speak","settings.audio.autoSpeak.desc":"Play the target aloud once when a word/sentence card appears.","settings.audio.autoSpeakRepeat":"Auto-speak repeat","settings.audio.autoSpeakRepeat.desc":"How many times to repeat when auto-speaking.","settings.audio.ttsVolume":"TTS volume","settings.audio.ttsVolume.desc":"Playback volume for speech.","settings.audio.ttsRate":"TTS rate","settings.audio.ttsRate.desc":"Speech rate multiplier (browser voice).","settings.audio.completeSound":"Complete sound","settings.audio.completeSound.desc":"Play a success chime when a card is completed.","settings.audio.ttsProvider":"TTS provider","settings.audio.ttsProvider.desc":"Auto picks by your browser language (zh → Youdao, otherwise Google). Force a specific one manually if that guess isn't right for your network.","settings.audio.ttsProvider.streamelements":"StreamElements","settings.audio.ttsProvider.auto":"Auto","settings.audio.ttsProvider.browser":"Browser","settings.audio.ttsProvider.youdao":"Youdao","settings.audio.ttsProvider.google":"Google","settings.interface.title":"Interface","settings.interface.subtitle":"Visual elements around the typing arena.","settings.interface.showPhonetic":"Show phonetic / pinyin","settings.interface.showPhonetic.desc":"Annotation line on word/sentence cards. Also toggleable in the HUD.","settings.interface.showGloss":"Show gloss / translation","settings.interface.showGloss.desc":"The gloss line under word/sentence cards.","settings.interface.neighborPreview":"Neighbor preview","settings.interface.neighborPreview.desc":"Show previous / next card previews beside the arena.","settings.interface.autoHideCursor":"Auto-hide cursor","settings.interface.autoHideCursor.desc":"Fade the mouse pointer when idle over the typing arena.","settings.interface.showResultPopup":"Result popup","settings.interface.showResultPopup.desc":"Show a summary popup after completing a card.","settings.interface.codeSyntaxHighlight":"Code syntax highlight","settings.interface.codeSyntaxHighlight.desc":"Enable Shiki syntax highlighting on code cards. Off to skip the ~1MB download and show hit/miss colors only.","settings.interface.mathRenderer":"Math rendering","settings.interface.mathRenderer.desc":"Render $...$ and $$...$$ in prompts / articles / snippets as math via KaTeX (lazy-loaded, ~280KB). Off to show LaTeX source as-is.","settings.interface.afkSeconds":"AFK threshold","settings.interface.afkSeconds.desc":"Auto-pause when there is no keyboard, mouse-move, wheel, or touch activity for this long. Mouse just hovering without moving, tab hidden, or window blur pauses immediately.","settings.tab.appearance":"Appearance","settings.tab.keyboard":"Keyboard","settings.tab.typing":"Typing","settings.tab.data":"Data","settings.tab.language":"Language","settings.appearance.title":"Appearance","settings.appearance.subtitle":"Overall UI look — theme, font, spacing.","settings.appearance.theme":"Theme","settings.appearance.theme.desc":"Overall light / dark tone.","settings.appearance.theme.dark":"Dark","settings.appearance.theme.light":"Light","settings.appearance.theme.auto":"Auto","settings.appearance.uiLang":"UI language","settings.appearance.uiLang.desc":"Override the UI language (defaults to material language).","settings.appearance.uiLang.auto":"Auto","settings.appearance.fontSize":"Font size","settings.appearance.fontSize.desc":"Size of the typing area text.","settings.appearance.letterSpacing":"Letter spacing","settings.appearance.letterSpacing.desc":"Horizontal spacing between characters.","settings.appearance.spaceGlyph":"Space glyph","settings.appearance.spaceGlyph.desc":"How the literal space character is drawn.","settings.appearance.breakWord":"Break words","settings.appearance.breakWord.desc":"Split long words at line-end instead of overflowing.","settings.keyboard.title":"Keyboard","settings.keyboard.subtitle":"Keyboard image and finger hints under the typing area.","settings.keyboard.showKeyboard":"Show keyboard","settings.keyboard.showKeyboard.desc":"Show the QWERTY keyboard beneath the typing area with the next key highlighted.","settings.keyboard.showHands":"Show hands","settings.keyboard.showHands.desc":"Overlay hand pose diagrams on the keyboard. Requires the keyboard to be shown.","settings.keyboard.size":"Keyboard size","settings.keyboard.size.desc":"Keyboard image size tier.","settings.keyboard.calibrate":"Calibrate hands","settings.keyboard.calibrate.desc":"Fine-tune each hand pose's position on the keyboard. Export the result as the new default.","settings.keyboard.calibrate.open":"Open calibrator","settings.keyboard.keySound":"Key sound","settings.keyboard.keySound.desc":"Sound when a key is pressed.","settings.keyboard.errorSound":"Error sound","settings.keyboard.errorSound.desc":"Sound when a wrong character is typed.","settings.typing.title":"Typing","settings.typing.subtitle":"Typing behaviour and completion rules.","settings.typing.hint":"Answer hint","settings.typing.hint.desc":"Off: blank target, type from memory. On: ghost target, type over it.","settings.typing.speedUnit":"Speed unit","settings.typing.speedUnit.desc":"Unit shown in the HUD. WPM = words per minute; CPM = characters per minute, common for CJK.","settings.typing.targetWpm":"Target speed","settings.typing.targetWpm.desc":"Show a shadow cursor advancing at the target WPM. 0 disables it.","settings.typing.maxWrongRate":"Max wrong rate","settings.typing.maxWrongRate.desc":"Auto-backspace once the wrong-char rate exceeds this threshold.","settings.typing.tabBehavior":"Tab behaviour","settings.typing.tabBehavior.desc":"Reset: restart the current card. Input: Tab expands to spaces (for code).","settings.typing.tabBehavior.reset":"Reset","settings.typing.tabBehavior.input":"Input","settings.typing.tabWidth":"Tab width","settings.typing.tabWidth.desc":"How many spaces one Tab expands into in input mode.","settings.typing.tabWidth.2":"2 spaces","settings.typing.tabWidth.4":"4 spaces","settings.typing.completion":"Completion","settings.typing.completion.desc":"Through / lenient (≤5% wrong) / perfect (zero wrong).","settings.typing.completion.through":"Through","settings.typing.completion.lenient":"Lenient","settings.typing.completion.perfect":"Perfect","settings.typing.advance":"After pass","settings.typing.advance.desc":"Auto-advance to the next card, or stay and wait for you to confirm.","settings.typing.advance.auto":"Auto","settings.typing.advance.manual":"Confirm","settings.typing.confirmKey":"Confirm key","settings.typing.confirmKey.desc":"Which key advances in Confirm mode. Also highlighted on the on-screen keyboard.","settings.typing.confirmKey.enter":"Enter","settings.typing.confirmKey.space":"Space","typing.advance.hint.enter":"Press Enter to continue","typing.advance.hint.space":"Press Space to continue","settings.typing.retry":"Retry on fail","settings.typing.retry.desc":"Auto-reset the arena when the pass doesn't meet completion.","settings.typing.retry.off":"Off","settings.typing.retry.auto":"After pass","settings.typing.retry.immediate":"On error","settings.typing.maxRetries":"Max retries","settings.typing.maxRetries.desc":"Skip the card once retries reach this many.","settings.typing.maxRetries.unlimited":"∞","settings.typing.autoHideCursor":"Auto-hide cursor","settings.typing.autoHideCursor.desc":"Hide the mouse after 3s of idle; any movement restores it.","settings.typing.neighborPreview":"Neighbor preview","settings.typing.neighborPreview.desc":"Show the previous / next card's title beside the arena so you can see what's coming.","settings.typing.ignoreCase":"Ignore case","settings.typing.ignoreCase.desc":"Treat differing case as a correct keystroke.","settings.typing.ignorePunctuation":"Ignore punctuation","settings.typing.ignorePunctuation.desc":"Auto-skip punctuation — only type letters and digits.","settings.typing.allowBackspace":"Allow backspace","settings.typing.allowBackspace.desc":"When off, Backspace does nothing — type through your mistakes.","settings.typing.minAccuracy":"Minimum accuracy","settings.typing.minAccuracy.desc":"Highlight the accuracy stat if it drops below this. 0 disables.","hud.accuracy.low":"Accuracy below {min}%","hud.pinyinErrors":"Wrong pinyin keystrokes (doesn't affect accuracy)","typing.result.summary":"Done · {speed} {unit} · {accuracy}% · {seconds}s","settings.data.title":"Data","settings.data.subtitle":"Import / export and global reset. All data stays in this browser.","settings.data.completed":"Completed materials","settings.data.completed.desc":"{count} materials marked as done.","settings.data.resetAll":"Reset all","settings.data.export":"Export progress","settings.data.export.desc":"Export completion state and card progress as JSON.","settings.data.export.action":"Export","settings.data.import":"Import progress","settings.data.import.desc":"Restore completion state and card progress from JSON.","settings.data.import.action":"Choose file…","settings.language.title":"Language","settings.language.subtitle":"UI language.","settings.language.label":"UI language","settings.language.desc":"Switch the UI display language.","common.on":"On","common.off":"Off","common.close":"Close","common.cancel":"Cancel","common.confirm":"OK","common.save":"Save","common.reset":"Reset","size.s":"S","size.m":"M","size.l":"L","spacing.tight":"Tight","spacing.normal":"Normal","spacing.wide":"Wide","spaceGlyph.none":"None","confirm.resetDone":"Reset all completion state? This cannot be undone.","confirm.overwriteImport":"This will overwrite current progress. Continue?","confirm.resetAllOffsets":"Clear all local calibration and restore shipped defaults?","toast.importOk":"Import complete","toast.importFail":"Import failed: {msg}","quickinput.placeholder.cmd":"Type a command…","quickinput.placeholder.help":"Help","quickinput.placeholder.theme":"Filter themes…","quickinput.placeholder.cardJump":"Enter 1 - {total} to jump to a card…","quickinput.placeholder.noMultiCards":"This deck only has one card","quickinput.placeholder.default":"Search materials, > for commands, ? for help","quickinput.cmd.exec":"Run a command…","quickinput.cmd.help":"Help","quickinput.cmd.searchMaterials":"Search materials","quickinput.cmd.searchMaterials.detail":"Type keywords directly","quickinput.cmd.searchMaterials.desc":"No prefix","quickinput.cmd.palette":"Command palette","quickinput.cmd.palette.detail":"Theme, view, progress, and more","quickinput.cmd.theme":"Switch theme (current: {current})","quickinput.cmd.theme.detail":"From palette or footer","toolbar.selection.count.pre":"","toolbar.selection.count.mid":" selected · {total} total","toolbar.selection.selectAll":"Select all","toolbar.selection.clearDone":"Clear done","toolbar.selection.cancel":"Cancel","toolbar.tags.expand":"Show all tags","toolbar.tags.collapse":"Collapse tags","toolbar.tags.clear":"Clear","toolbar.tags.overflow.selected":"{count} selected in overflow","toolbar.tags.clearN":"Clear {count} filter(s)","toolbar.type.placeholder":"Type","toolbar.tag.placeholder":"Tag","toolbar.status.placeholder":"Status","toolbar.status.done":"Done","toolbar.status.pending":"Pending","toolbar.search.placeholder":"Search…","toolbar.search.empty":"No matches","combobox.footer.selected":"{count} selected","combobox.footer.clear":"Clear","renderer.speak":"Speak","toolbar.selection.enter":"Select","toolbar.selection.enterAria":"Enter selection mode","toolbar.view.grid":"Grid view","toolbar.view.list":"List view","header.home":"Back to home","footer.theme.toDark":"Switch to dark","footer.theme.toLight":"Switch to light","footer.settings":"Settings","footer.settings.open":"Open settings","cmd.materials.search":"Search materials","cmd.theme.pick":"Pick theme (current: {current})","cmd.theme.dark":"Dark","cmd.theme.light":"Light","cmd.view.grid":"Switch to grid view","cmd.view.list":"Switch to list view","cmd.material.reload":"Reload materials","cmd.material.random":"Open random material","cmd.progress.reset":"Reset all typed progress","cmd.progress.count":"{count} completed","cmd.filter.reset":"Clear filter","cmd.hint.toggle":"Toggle hint mode (current: {current})","cmd.hint.ghost":"Ghost","cmd.hint.blind":"Blind","cmd.settings.open":"Open settings","cmd.card.jump":"Jump to card ({total} total)","cmd.card.jump.detail":"Enter a card number","home.loading":"Loading…","home.empty":"No materials","home.dir.count":"{count} materials","home.dir.progress":"{done} / {total} done","home.breadcrumb.root":"All","home.noMatch":"No matching materials","home.stats":"{materials} materials · {cards} cards","typing.loadFailed":"Failed to load · {msg}","typing.backHome":"Back to home","typing.done":"Done","typing.deckSize":"{title} · {total} cards","typing.card.unsupported":"This card contains unsupported characters:","hud.pause.start":"Start","hud.pause.pause":"Pause","hud.hint.on":"Hint: on","hud.hint.off":"Hint: off","hud.keyboard.on":"Keyboard: on","hud.keyboard.off":"Keyboard: off","hud.hands.on":"Hands: on","hud.hands.off":"Hands: off","hud.back":"Back","hud.more":"More","hud.more.showPhonetic":"Show phonetic / pinyin","hud.more.showGloss":"Show gloss / translation","hud.more.showHands":"Show hands","hud.more.autoSpeak":"Auto-speak","cardnav.aria":"Card navigation","cardnav.prev":"Previous","cardnav.prev.title":"Previous (Alt+←)","cardnav.next":"Next","cardnav.next.title":"Next (Alt+→)","cardnav.jumpToDone":"Jump to card {n} (done)","cardnav.jumpTo":"Jump to card {n}","cardnav.itemDone":"Card {n} · done","cardnav.item":"Card {n}","cardnav.input.aria":"Jump to card N","cardnav.input.hint":"Click to jump to a card","materialCard.select":"Select","materialCard.unselect":"Unselect","materialCard.more":"More","materialCard.clearDone":"Clear done","materialCard.cardCount":"{count} cards","materialCard.done":"Done","materialCard.count":"{count}","materialCard.peak":"Best {value} {unit}","wpmHistory.peak":"Peak","wpmHistory.avg":"Avg","wpmHistory.last":"Last","wpmHistory.count":"Samples","arena.mask.hint.pre":"Click or press","arena.mask.hint.post":"to start","arena.mask.paused":"Paused","arena.mask.press":"Press","arena.mask.toStart":"to start","arena.mask.resumeLabel":"Click or press pause key to resume","arena.violation.wrongRate":"Wrong rate exceeds {limit}%, press backspace","arena.violation.leftBoundary":"Can't move left across paragraphs; use backspace","arena.violation.moveLimit":"Can only move within the last two positions","arena.violation.bulkInput":"Bulk input detected","calibrator.title":"Hand calibration","calibrator.hint":"Drag to move · click to change pose · arrow keys nudge (Shift ×10) · [ / ] prev/next","calibrator.prev":"◀ Previous","calibrator.next":"Next ▶","calibrator.leftHand":"Left","calibrator.rightHand":"Right","calibrator.unsaved":"Unsaved","calibrator.customized":"Calibrated","calibrator.save":"Save","calibrator.cancel":"Cancel","calibrator.resetThis":"Reset this","calibrator.resetAll":"Reset all","calibrator.export":"Export keyBindings.json","calibrator.picker.title":"Pick a pose ({side})","password.checking":"Checking encryption…","password.desc":"This site is encrypted. Enter the access password.","password.error":"Wrong password","password.busy":"Verifying…","password.unlock":"Unlock","password.cooldown":"Too many attempts. Try again in {s}s.","password.rememberHint":"You won't be asked again this session.","cmd.card.reset":"Reset current card","cmd.card.next":"Next card","cmd.card.prev":"Previous card","cmd.theme.toMocha":"Switch to Mocha (dark)","cmd.theme.toLatte":"Switch to Latte (light)","cmd.theme.toggle":"Toggle theme","err.badData":"Bad data format","err.noFile":"No file selected","err.readFail":"Read failed","quickinput.theme.dark":"Dark · ☾","quickinput.theme.light":"Light · ☀","quickinput.card.none":"This deck only has one card","quickinput.card.none.detail":"Available when the deck has multiple cards","quickinput.card.hint":"Enter 1 - {total} to jump","quickinput.card.hint.detail":"Press Enter to jump","quickinput.card.invalid":'"{input}" is not a valid card number',"quickinput.card.range":"Please enter 1 - {total}","quickinput.card.oor":"Card {n} is out of range","quickinput.card.jump":"Jump to card {n}","quickinput.card.current":"Current","quickinput.card.untitled":"(untitled)","quickinput.card.nomatch":'No cards match "{input}"',"settings.tab.shortcuts":"Shortcuts","settings.shortcuts.title":"Shortcuts","settings.shortcuts.subtitle":"Customise keyboard shortcuts. Click a binding to record a new combo, Esc to cancel.","settings.shortcuts.search":"Search actions…","settings.shortcuts.reset":"Reset","settings.shortcuts.resetAll":"Reset all","settings.shortcuts.disabled":"Unbound","settings.shortcuts.recording":"Press a new combo…","settings.shortcuts.conflict":"Conflicts with {name}","settings.shortcuts.noModifier":"No modifier · may trigger while typing","settings.shortcuts.group.global":"Global","settings.shortcuts.group.hud":"Typing HUD","settings.shortcuts.group.card":"Card navigation","settings.shortcuts.confirmResetAll":"Reset all shortcuts to defaults?","action.palette.open":"Open search / command palette","action.palette.commands":"Open command palette","action.palette.search":"Open search","action.hud.pause":"Start / pause","action.hud.hint":"Toggle answer hint","action.hud.keyboard":"Toggle keyboard image","action.hud.hands":"Toggle hands","action.hud.back":"Back","action.card.prev":"Previous card","action.card.next":"Next card","cmd.card.jump.registry":"Jump to card","cmd.theme.pick.registry":"Pick theme","cmd.hint.toggle.registry":"Toggle answer hint","toast.card.atFirst":"Already at the first card","toast.card.atLast":"Already at the last card"},gk=hk,pk=fk,mk={"zh-CN":gk,"en-US":pk};function yk(e){return e==="zh"||e==="zh-CN"?"zh-CN":e==="en"||e==="en-US"?"en-US":null}function Ak(e){const t=mk[e];return(n,r)=>{let i=t[n]??n;if(r)for(const[o,s]of Object.entries(r))i=i.replace(`{${o}}`,String(s));return i}}const vk="en-US";let Z2=vk;const X2=new Set;function qk(e){return X2.add(e),()=>X2.delete(e)}function wk(e){const t=yk(e);if(t&&t!==Z2){Z2=t;for(const n of X2)n()}}function xk(){const e=el("settings","uiLang","auto");return e==="zh"||e==="en"?e:"auto"}function bk(e){const t=qk(e),n=t4("settings","uiLang",e);return()=>{t(),n()}}function A0(){const e=xk();return e==="zh"?"zh-CN":e==="en"?"en-US":Z2}function ve(e={}){const{forced:t}=e,n=v.useSyncExternalStore(bk,A0,A0),r=t??n,i=Ak(r);return{lang:r,t:i}}function Vk(e,t){return t==="theme"?{kind:"theme",query:e.trim()}:t==="card"?{kind:"card",query:e.trim()}:e.startsWith(">")?{kind:"commands",query:e.slice(1).trim()}:e.startsWith("?")?{kind:"help"}:e.startsWith("#")?{kind:"card",query:e.slice(1).trim()}:e.trim()?{kind:"search",query:e.trim()}:{kind:"menu"}}const kk=v.forwardRef(function({commands:t,materials:n,theme:r,onSearchDeck:i,onRunCommand:o,onPickTheme:s,cardTotal:l,cards:a,currentCardIdx:c,onJumpCard:h},d){const{t:u}=ve(),[p,g]=v.useState(""),[y,q]=v.useState(null),[m,A]=v.useState(!1),[w,x]=v.useState(0),V=v.useRef(null),k=v.useRef(null),b=v.useMemo(()=>Vk(p,y),[p,y]),j=v.useCallback(()=>{var C;g(""),q(null),(C=V.current)==null||C.blur(),A(!1)},[]);v.useImperativeHandle(d,()=>({open(C){g((C==null?void 0:C.value)??""),q((C==null?void 0:C.submode)??null),requestAnimationFrame(()=>{const _=V.current;_&&(_.focus(),_.setSelectionRange(_.value.length,_.value.length),A(!0))})},close(){j()}}),[j]);const z=v.useMemo(()=>b.kind==="menu"?[{key:"menu-cmd",label:u("quickinput.cmd.exec"),description:">",run:()=>g(">")},{key:"menu-help",label:u("quickinput.cmd.help"),description:"?",run:()=>g("?")},...v0(n,"",i,j)]:b.kind==="search"?v0(n,b.query,i,j):b.kind==="commands"?jk(t,b.query,C=>{if(C==="pick.theme"){g(""),q("theme");return}if(C==="card.jump"){g(""),q("card");return}o(C),j()}):b.kind==="help"?[{key:"help-search",label:u("quickinput.cmd.searchMaterials"),detail:u("quickinput.cmd.searchMaterials.detail"),description:u("quickinput.cmd.searchMaterials.desc"),run:()=>g("")},{key:"help-cmd",label:u("quickinput.cmd.palette"),detail:u("quickinput.cmd.palette.detail"),description:">",run:()=>g(">")},{key:"help-theme",label:u("quickinput.cmd.theme",{current:u(r==="mocha"?"cmd.theme.dark":"cmd.theme.light")}),detail:u("quickinput.cmd.theme.detail"),description:"cmd",run:()=>{g(""),q("theme")}}]:b.kind==="theme"?zk(r,b.query,C=>{s(C),j()},u):Sk(b.query,l,a,c,C=>{h==null||h(C),j()},u),[b,n,t,r,l,a,c,i,o,s,h,j,u]);v.useEffect(()=>{x(C=>{if(!z.length)return 0;const _=z.findIndex(L=>L.active);return _>=0?_:C>=z.length?0:C})},[z]),v.useEffect(()=>{const C=_=>{var D;if(!m)return;const L=_.target;L&&((D=k.current)!=null&&D.contains(L))||j()};return document.addEventListener("pointerdown",C,!0),()=>document.removeEventListener("pointerdown",C,!0)},[m,j]);const S=v.useCallback(()=>{const C=z[w];C&&!C.disabled&&C.run()},[z,w]),R=v.useCallback(C=>{if(C.key==="Escape"){C.preventDefault(),j();return}if(C.key==="ArrowDown"){C.preventDefault(),x(_=>{var L;for(let D=1;D<=z.length;D++){const M=(_+D)%z.length;if(!((L=z[M])!=null&&L.disabled))return M}return _});return}if(C.key==="ArrowUp"){C.preventDefault(),x(_=>{var L;for(let D=1;D<=z.length;D++){const M=(_-D+z.length)%z.length;if(!((L=z[M])!=null&&L.disabled))return M}return _});return}C.key==="Enter"&&(C.preventDefault(),S())},[z,j,S]),T=b.kind==="commands"?u("quickinput.placeholder.cmd"):b.kind==="help"?u("quickinput.placeholder.help"):b.kind==="theme"?u("quickinput.placeholder.theme"):b.kind==="card"?l?u("quickinput.placeholder.cardJump",{total:l}):u("quickinput.placeholder.noMultiCards"):u("quickinput.placeholder.default"),E=m&&z.length>0;return f.jsxs("div",{className:"qt-qi",ref:k,children:[f.jsx("input",{ref:V,className:"qt-qi__input",type:"text",value:p,onChange:C=>g(C.target.value),onFocus:()=>A(!0),onKeyDown:R,placeholder:T,spellCheck:!1,autoComplete:"off","aria-label":"quick input"}),!p&&!m&&f.jsx("kbd",{className:"qt-qi__kbd",children:"⌘K"}),E&&f.jsx("div",{className:"qt-qi__panel",role:"listbox",children:z.map((C,_)=>f.jsxs("button",{className:`qt-qi__row ${_===w?"is-focused":""} ${C.active?"is-active":""} ${C.disabled?"is-disabled":""}`,disabled:C.disabled,onMouseEnter:()=>x(_),onClick:()=>{C.disabled||C.run()},role:"option","aria-selected":_===w,children:[f.jsxs("div",{className:"qt-qi__body",children:[f.jsx("span",{className:"qt-qi__label",children:C.label}),C.detail&&f.jsx("span",{className:"qt-qi__detail",children:C.detail})]}),C.description&&f.jsx("span",{className:"qt-qi__desc",children:C.description})]},C.key))})]})});function v0(e,t,n,r){const i=t.trim().toLowerCase();if(!i)return e.slice(0,8).map(s=>({key:`material-${s.file}`,label:s.title,detail:s.file,run:()=>{n(s.file),r()}}));const o=[];for(const s of e){const l=s.title.toLowerCase();let a=0,c;if(l.includes(i)&&(a+=100),s.matchText){const h=s.matchText.toLowerCase().indexOf(i);h>=0&&(a+=10-Math.min(10,h*.001),c=Ck(s.matchText,h,i.length))}a>0&&o.push({d:s,score:a,hit:c})}return o.sort((s,l)=>l.score-s.score),o.slice(0,30).map(({d:s,hit:l})=>({key:`material-${s.file}`,label:s.title,detail:l??s.file,run:()=>{n(s.file),r()}}))}function jk(e,t,n){const r=t.trim().toLowerCase();return e.filter(i=>!r||i.label.toLowerCase().includes(r)).map(i=>({key:`cmd-${i.id}`,label:i.label,description:i.description,disabled:i.enabled===!1,run:()=>n(i.id)}))}function zk(e,t,n,r){const i=[{v:"mocha",label:r("quickinput.theme.dark")},{v:"latte",label:r("quickinput.theme.light")}],o=t.trim().toLowerCase();return i.filter(s=>!o||s.label.toLowerCase().includes(o)).map(s=>({key:`theme-${s.v}`,label:s.label,active:s.v===e,run:()=>n(s.v)}))}function Sk(e,t,n,r,i,o){if(!t||t<=1)return[{key:"card-none",label:o("quickinput.card.none"),detail:o("quickinput.card.none.detail"),run:()=>{}}];const s=e.trim();if(!n||n.length===0){if(!s)return[{key:"card-hint",label:o("quickinput.card.hint",{total:t}),detail:o("quickinput.card.hint.detail"),run:()=>{}}];const h=Number.parseInt(s,10);return!Number.isFinite(h)||h<1||h>t?[{key:"card-oor",label:o("quickinput.card.oor",{n:s}),detail:o("quickinput.card.range",{total:t}),run:()=>{}}]:[{key:`card-${h}`,label:o("quickinput.card.jump",{n:h}),description:"Enter",run:()=>i(h-1)}]}const l=s&&/^\d+$/.test(s)?Number(s):null;if(l!==null&&l>=1&&l<=n.length)return[{key:`card-${l}`,label:o("quickinput.card.jump",{n:l}),description:"Enter",run:()=>i(l-1)}];const a=s.toLowerCase(),c=[];return n.forEach((h,d)=>{if(a&&!h.title.toLowerCase().includes(a))return;const u=d===r,g=`${h.done?"✓ ":" "}${d+1}. ${h.title||o("quickinput.card.untitled")}`;c.push({key:`card-row-${h.id}`,label:u?`▸ ${g}`:g,description:u?o("quickinput.card.current"):void 0,run:()=>i(d)})}),c.length===0&&c.push({key:"card-nomatch",label:o("quickinput.card.nomatch",{input:s}),run:()=>{}}),c}function Ck(e,t,n){const r=Math.max(0,t-30),i=Math.min(e.length,t+n+60);let o=e.slice(r,i).replace(/\s+/g," ").trim();return r>0&&(o="…"+o),i<e.length&&(o=o+"…"),o}function q0(){if(typeof window>"u")return"l";const e=window.innerWidth;return e<640?"s":e<1024?"m":"l"}function Ek(){const[e,t]=v.useState(q0);return v.useEffect(()=>{const n=()=>t(q0());return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),e}function Rk(){const[e,t]=v.useState(()=>typeof window>"u"?!1:window.innerHeight<500);return v.useEffect(()=>{const n=()=>t(window.innerHeight<500);return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),e}function _k(){return{repoName:document.documentElement.dataset.qtypeRepoName??"qtype"}}const $8=v.forwardRef(function({onGoHome:t,progressCurrent:n,progressTotal:r,...i},o){const{t:s}=ve(),l=Ek(),a=l==="s"?"qt-header qt-header--s":"qt-header qt-header--ml",c=r>0,h=c?Math.min(100,Math.round(n/r*100)):0,d=v.useMemo(()=>_k().repoName,[]),u=v.useRef(null);return v.useEffect(()=>{var p;(p=u.current)==null||p.style.setProperty("--qt-progress",`${h}%`)},[h]),f.jsxs("header",{className:a,children:[f.jsxs("button",{className:"qt-brand",onClick:t,"aria-label":s("header.home"),title:s("header.home"),children:[f.jsx("img",{className:"qt-brand__logo",src:"/qtype-mark.svg",alt:"","aria-hidden":"true",width:28,height:28}),f.jsx("span",{className:"qt-brand__name",children:d})]}),f.jsx("div",{className:"qt-header-search",children:f.jsx(kk,{ref:o,...i})}),f.jsxs("div",{className:"qt-header-right",children:[c&&l==="s"&&f.jsxs("span",{className:"qt-header-pct",children:[h,"%"]}),c&&l!=="s"&&f.jsxs("div",{className:"qt-header-stats",children:[f.jsxs("span",{className:"qt-header-count",children:[n," / ",r,f.jsxs("span",{className:"qt-header-count-pct",children:[" (",h,"%)"]})]}),l==="l"&&f.jsx("div",{ref:u,className:"qt-header-bar",children:f.jsx("div",{className:"qt-header-bar__fill"})})]})]})]})});function Rn({size:e=16,strokeWidth:t=2,viewBox:n="0 0 24 24",fill:r="none",stroke:i="currentColor",strokeLinecap:o="round",strokeLinejoin:s="round","aria-hidden":l=!0,children:a,...c}){return f.jsx("svg",{width:e,height:e,viewBox:n,fill:r,stroke:i,strokeWidth:t,strokeLinecap:o,strokeLinejoin:s,"aria-hidden":l,...c,children:a})}function G8(e){return f.jsx(Rn,{...e,children:f.jsx("path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"})})}function Q8(e){return f.jsxs(Rn,{...e,children:[f.jsx("path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"}),f.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function Tk(e){return f.jsxs(Rn,{...e,children:[f.jsx("circle",{cx:"12",cy:"12",r:"4"}),f.jsx("path",{d:"M12 2v2"}),f.jsx("path",{d:"M12 20v2"}),f.jsx("path",{d:"m4.93 4.93 1.41 1.41"}),f.jsx("path",{d:"m17.66 17.66 1.41 1.41"}),f.jsx("path",{d:"M2 12h2"}),f.jsx("path",{d:"M20 12h2"}),f.jsx("path",{d:"m6.34 17.66-1.41 1.41"}),f.jsx("path",{d:"m19.07 4.93-1.41 1.41"})]})}function Mk(e){return f.jsx(Rn,{...e,children:f.jsx("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})})}function Y8(e){return f.jsx(Rn,{...e,children:f.jsx("polyline",{points:"15 18 9 12 15 6"})})}function n4(e){return f.jsx(Rn,{...e,children:f.jsx("polyline",{points:"9 18 15 12 9 6"})})}function Pk(e){return f.jsx(Rn,{...e,children:f.jsx("path",{d:"m6 9 6 6 6-6"})})}function w0(e){return f.jsx(Rn,{...e,children:f.jsx("path",{d:"M18 6 6 18M6 6l12 12"})})}function Ik(e){return f.jsxs(Rn,{...e,children:[f.jsx("circle",{cx:"11",cy:"11",r:"8"}),f.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]})}function Lk(e){return f.jsxs(Rn,{...e,children:[f.jsx("polyline",{points:"15 3 21 3 21 9"}),f.jsx("polyline",{points:"9 21 3 21 3 15"}),f.jsx("line",{x1:"21",y1:"3",x2:"14",y2:"10"}),f.jsx("line",{x1:"3",y1:"21",x2:"10",y2:"14"})]})}function Nk(e){return f.jsxs(Rn,{...e,children:[f.jsx("polyline",{points:"4 14 10 14 10 20"}),f.jsx("polyline",{points:"20 10 14 10 14 4"}),f.jsx("line",{x1:"14",y1:"10",x2:"21",y2:"3"}),f.jsx("line",{x1:"3",y1:"21",x2:"10",y2:"14"})]})}function Dk(e){return f.jsxs(Rn,{...e,children:[f.jsx("path",{d:"M11 5 6 9H2v6h4l5 4z"}),f.jsx("path",{d:"M15.54 8.46a5 5 0 0 1 0 7.07"}),f.jsx("path",{d:"M19.07 4.93a10 10 0 0 1 0 14.14"})]})}function Z8({left:e,center:t,theme:n,onToggleTheme:r,onOpenSettings:i}){const{t:o}=ve(),s=n==="mocha"?Mk:Tk;return f.jsxs("footer",{className:"qt-footer",children:[f.jsx("span",{className:"qt-footer__left",children:e}),t&&f.jsx("span",{className:"qt-footer__center",children:t}),f.jsxs("span",{className:"qt-footer__right",children:[f.jsx("button",{className:"qt-footer__stat",onClick:r,"aria-label":"toggle theme",title:o(n==="mocha"?"footer.theme.toLight":"footer.theme.toDark"),children:f.jsx(s,{size:13,className:"qt-footer__icon"})}),i&&f.jsx("button",{className:"qt-footer__stat",onClick:i,"aria-label":o("footer.settings.open"),title:o("footer.settings"),children:f.jsx(Q8,{size:13,className:"qt-footer__icon"})})]})]})}var Ok=Object.defineProperty,dl=(e,t)=>Ok(e,"name",{value:t,configurable:!0}),X8=!!(typeof window<"u"&&window.document&&window.document.createElement);function xt(e,t,{checkForDefaultPrevented:n=!0}={}){return dl(function(i){if(e==null||e(i),n===!1||!i||!i.defaultPrevented)return t==null?void 0:t(i)},"handleEvent")}dl(xt,"composeEventHandlers");function Bk(e){var t;if(!X8)throw new Error("Cannot access window outside of the DOM");return((t=e==null?void 0:e.ownerDocument)==null?void 0:t.defaultView)??window}dl(Bk,"getOwnerWindow");function J2(e){if(!X8)throw new Error("Cannot access document outside of the DOM");return(e==null?void 0:e.ownerDocument)??document}dl(J2,"getOwnerDocument");function J8(e,t=!1){const{activeElement:n}=J2(e);if(!(n!=null&&n.nodeName))return null;if(em(n)&&n.contentDocument)return J8(n.contentDocument.body,t);if(t){const r=n.getAttribute("aria-activedescendant");if(r){const i=J2(n).getElementById(r);if(i)return i}}return n}dl(J8,"getActiveElement");function em(e){return e.tagName==="IFRAME"}dl(em,"isFrame");var Fk=Object.defineProperty,r4=(e,t)=>Fk(e,"name",{value:t,configurable:!0});function ef(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}r4(ef,"setRef");function Co(...e){return t=>{let n=!1;const r=e.map(i=>{const o=ef(i,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let i=0;i<r.length;i++){const o=r[i];typeof o=="function"?o():ef(e[i],null)}}}}r4(Co,"composeRefs");function _n(...e){return v.useCallback(Co(...e),e)}r4(_n,"useComposedRefs");var Hk=Object.defineProperty,wn=(e,t)=>Hk(e,"name",{value:t,configurable:!0});function Uk(e,t){const n=v.createContext(t);n.displayName=e+"Context";const r=wn(o=>{const{children:s,...l}=o,a=v.useMemo(()=>l,Object.values(l));return f.jsx(n.Provider,{value:a,children:s})},"Provider");r.displayName=e+"Provider";function i(o,s={}){const{optional:l=!1}=s,a=v.useContext(n);if(a)return a;if(t!==void 0)return t;if(!l)throw new Error(`\`${o}\` must be used within \`${e}\``)}return wn(i,"useContext"),[r,i]}wn(Uk,"createContext");function ic(e,t=[]){let n=[];function r(o,s){const l=v.createContext(s);l.displayName=o+"Context";const a=n.length;n=[...n,s];const c=wn(d=>{var m;const{scope:u,children:p,...g}=d,y=((m=u==null?void 0:u[e])==null?void 0:m[a])||l,q=v.useMemo(()=>g,Object.values(g));return f.jsx(y.Provider,{value:q,children:p})},"Provider");c.displayName=o+"Provider";function h(d,u,p={}){var m;const{optional:g=!1}=p,y=((m=u==null?void 0:u[e])==null?void 0:m[a])||l,q=v.useContext(y);if(q)return q;if(s!==void 0)return s;if(!g)throw new Error(`\`${d}\` must be used within \`${o}\``)}return wn(h,"useContext"),[c,h]}wn(r,"createContext");const i=wn(()=>{const o=n.map(s=>v.createContext(s));return wn(function(l){const a=(l==null?void 0:l[e])||o;return v.useMemo(()=>({[`__scope${e}`]:{...l,[e]:a}}),[l,a])},"useScope")},"createScope");return i.scopeName=e,[r,tm(i,...t)]}wn(ic,"createContextScope");function tm(...e){const t=e[0];if(e.length===1)return t;const n=wn(()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return wn(function(o){const s=r.reduce((l,{useScope:a,scopeName:c})=>{const d=a(o)[`__scope${c}`];return{...l,...d}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])},"useComposedScopes")},"createScope");return n.scopeName=t.scopeName,n}wn(tm,"composeContextScopes");var Wk=Object.defineProperty,$n=(e,t)=>Wk(e,"name",{value:t,configurable:!0});function id(e){const t=v.forwardRef((n,r)=>{let{children:i,...o}=n,s=null,l=!1;const a=[];tf(i)&&typeof Wc=="function"&&(i=Wc(i._payload)),v.Children.forEach(i,u=>{var p;if(sm(u)){l=!0;const g=u;let y="child"in g.props?g.props.child:g.props.children;tf(y)&&typeof Wc=="function"&&(y=Wc(y._payload)),s=Kk(g,y),a.push((p=s==null?void 0:s.props)==null?void 0:p.children)}else a.push(u)}),s?s=v.cloneElement(s,void 0,a):!l&&v.Children.count(i)===1&&v.isValidElement(i)&&(s=i);const c=s?om(s):void 0,h=_n(r,c);if(!s){if(i||i===0)throw new Error(l?Qk(e):Gk(e));return i}const d=im(o,s.props??{});return s.type!==v.Fragment&&(d.ref=r?h:c),v.cloneElement(s,d)});return t.displayName=`${e}.Slot`,t}$n(id,"createSlot");var nm=Symbol.for("radix.slottable");function rm(e){const t=$n(n=>"child"in n?n.children(n.child):n.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=nm,t}$n(rm,"createSlottable");var Kk=$n((e,t)=>{if("child"in e.props){const n=e.props.child;return v.isValidElement(n)?v.cloneElement(n,void 0,e.props.children(n.props.children)):null}return v.isValidElement(t)?t:null},"getSlottableElementFromSlottable");function im(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...l)=>{const a=o(...l);return i(...l),a}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}$n(im,"mergeProps");function om(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}$n(om,"getElementRef");function sm(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===nm}$n(sm,"isSlottable");var $k=Symbol.for("react.lazy");function tf(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===$k&&"_payload"in e&&lm(e._payload)}$n(tf,"isLazyComponent");function lm(e){return typeof e=="object"&&e!==null&&"then"in e}$n(lm,"isPromiseLike");var Gk=$n(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),Qk=$n(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),Wc=Za[" use ".trim().toString()],Yk=Object.defineProperty,Zk=(e,t)=>Yk(e,"name",{value:t,configurable:!0}),Xk=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],at=Xk.reduce((e,t)=>{const n=id(`Primitive.${t}`),r=v.forwardRef((i,o)=>{const{asChild:s,...l}=i,a=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),f.jsx(a,{...l,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function am(e,t){e&&nc.flushSync(()=>e.dispatchEvent(t))}Zk(am,"dispatchDiscreteCustomEvent");var Jk=Object.defineProperty,ej=(e,t)=>Jk(e,"name",{value:t,configurable:!0});function Eo(e){const t=v.useRef(e);return v.useEffect(()=>{t.current=e}),v.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}ej(Eo,"useCallbackRef");var tj=Object.defineProperty,wt=(e,t)=>tj(e,"name",{value:t,configurable:!0}),nf="dismissableLayer.update",nj="dismissableLayer.pointerDownOutside",rj="dismissableLayer.focusOutside",x0,cm=v.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),i4=v.forwardRef(wt(function(t,n){const{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:i=!1,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:l,onInteractOutside:a,onDismiss:c,...h}=t,d=v.useContext(cm),[u,p]=v.useState(null),g=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=v.useState({}),q=_n(n,p),m=Array.from(d.layers),[A]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),w=A?m.indexOf(A):-1,x=u?m.indexOf(u):-1,V=d.layersWithOutsidePointerEventsDisabled.size>0,k=x>=w,b=v.useRef(!1),j=dm(T=>{s==null||s(T),a==null||a(T),T.defaultPrevented||c==null||c()},{ownerDocument:g,deferPointerDownOutside:i,isDeferredPointerDownOutsideRef:b,dismissableSurfaces:d.dismissableSurfaces,shouldHandlePointerDownOutside:v.useCallback(T=>{if(!(T instanceof Node))return!1;const E=[...d.branches].some(C=>C.contains(T));return k&&!E},[d.branches,k])}),z=hm(T=>{if(i&&b.current)return;const E=T.target;[...d.branches].some(_=>_.contains(E))||(l==null||l(T),a==null||a(T),T.defaultPrevented||c==null||c())},g),S=u?x===m.length-1:!1,R=Eo(T=>{T.key==="Escape"&&(o==null||o(T),!T.defaultPrevented&&c&&(T.preventDefault(),c()))});return v.useEffect(()=>{if(S)return g.addEventListener("keydown",R,{capture:!0}),()=>g.removeEventListener("keydown",R,{capture:!0})},[g,S,R]),v.useEffect(()=>{if(u)return r&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(x0=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(u)),d.layers.add(u),rf(),()=>{r&&(d.layersWithOutsidePointerEventsDisabled.delete(u),d.layersWithOutsidePointerEventsDisabled.size===0&&(g.body.style.pointerEvents=x0))}},[u,g,r,d]),v.useEffect(()=>()=>{u&&(d.layers.delete(u),d.layersWithOutsidePointerEventsDisabled.delete(u),rf())},[u,d]),v.useEffect(()=>{const T=wt(()=>y({}),"handleUpdate");return document.addEventListener(nf,T),()=>document.removeEventListener(nf,T)},[]),f.jsx(at.div,{...h,ref:q,style:{pointerEvents:V?k?"auto":"none":void 0,...t.style},onFocusCapture:xt(t.onFocusCapture,z.onFocusCapture),onBlurCapture:xt(t.onBlurCapture,z.onBlurCapture),onPointerDownCapture:xt(t.onPointerDownCapture,j.onPointerDownCapture)})},"DismissableLayer"));function um(){const e=v.useContext(cm),[t,n]=v.useState(null);return v.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}wt(um,"useDismissableLayerSurface");var ij=wt(()=>!0,"IS_TRUE");function dm(e,t){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:o,shouldHandlePointerDownOutside:s=ij}=t,l=Eo(e),a=v.useRef(!1),c=v.useRef(!1),h=v.useRef(new Map),d=v.useRef(()=>{});return v.useEffect(()=>{function u(){c.current=!1,i.current=!1,h.current.clear()}wt(u,"resetOutsideInteraction");function p(){return Array.from(h.current.values()).some(Boolean)}wt(p,"isOutsideInteractionIntercepted");function g(w){if(!c.current)return;const x=w.target;x instanceof Node&&[...o].some(k=>k.contains(x))||h.current.set(w.type,!0),w.type==="click"&&window.setTimeout(()=>{c.current&&d.current()},0)}wt(g,"handleInteractionCapture");function y(w){c.current&&h.current.set(w.type,!1)}wt(y,"handleInteractionBubble");const q=wt(w=>{if(w.target&&!a.current){let x=function(){n.removeEventListener("click",d.current);const k=p();u(),k||o4(nj,l,V,{discrete:!0})};if(wt(x,"handleAndDispatchPointerDownOutsideEvent"),!s(w.target)){n.removeEventListener("click",d.current),u(),a.current=!1;return}const V={originalEvent:w};c.current=!0,i.current=r&&w.button===0,h.current.clear(),!r||w.button!==0?x():(n.removeEventListener("click",d.current),d.current=x,n.addEventListener("click",d.current,{once:!0}))}else n.removeEventListener("click",d.current),u();a.current=!1},"handlePointerDown"),m=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const w of m)n.addEventListener(w,g,!0),n.addEventListener(w,y);const A=window.setTimeout(()=>{n.addEventListener("pointerdown",q)},0);return()=>{window.clearTimeout(A),n.removeEventListener("pointerdown",q),n.removeEventListener("click",d.current);for(const w of m)n.removeEventListener(w,g,!0),n.removeEventListener(w,y)}},[n,l,r,i,o,s]),{onPointerDownCapture:wt(()=>a.current=!0,"onPointerDownCapture")}}wt(dm,"usePointerDownOutside");function hm(e,t=globalThis==null?void 0:globalThis.document){const n=Eo(e),r=v.useRef(!1);return v.useEffect(()=>{const i=wt(o=>{o.target&&!r.current&&o4(rj,n,{originalEvent:o},{discrete:!1})},"handleFocus");return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,n]),{onFocusCapture:wt(()=>r.current=!0,"onFocusCapture"),onBlurCapture:wt(()=>r.current=!1,"onBlurCapture")}}wt(hm,"useFocusOutside");function rf(){const e=new CustomEvent(nf);document.dispatchEvent(e)}wt(rf,"dispatchUpdate");function o4(e,t,n,{discrete:r}){const i=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?am(i,o):i.dispatchEvent(o)}wt(o4,"handleAndDispatchCustomEvent");var oj=Object.defineProperty,s4=(e,t)=>oj(e,"name",{value:t,configurable:!0}),Kc=0,Xn=null;function sj(e){return od(),e.children}s4(sj,"FocusGuards");function od(){v.useEffect(()=>{Xn||(Xn={start:of(),end:of()});const{start:e,end:t}=Xn;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),Kc++,()=>{Kc===1&&(Xn==null||Xn.start.remove(),Xn==null||Xn.end.remove(),Xn=null),Kc=Math.max(0,Kc-1)}},[])}s4(od,"useFocusGuards");function of(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}s4(of,"createFocusGuard");var lj=Object.defineProperty,Bt=(e,t)=>lj(e,"name",{value:t,configurable:!0}),uh="focusScope.autoFocusOnMount",dh="focusScope.autoFocusOnUnmount",b0={bubbles:!1,cancelable:!0},fm=v.forwardRef(Bt(function(t,n){const{loop:r=!1,trapped:i=!1,onMountAutoFocus:o,onUnmountAutoFocus:s,...l}=t,[a,c]=v.useState(null),h=Eo(o),d=Eo(s),u=v.useRef(null),p=_n(n,c),g=v.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;v.useEffect(()=>{if(i){let q=function(x){if(g.paused||!a)return;const V=x.target;a.contains(V)?u.current=V:wr(u.current,{select:!0})},m=function(x){if(g.paused||!a)return;const V=x.relatedTarget;V!==null&&(a.contains(V)||wr(u.current,{select:!0}))},A=function(x){if(document.activeElement===document.body)for(const k of x)k.removedNodes.length>0&&wr(a)};Bt(q,"handleFocusIn"),Bt(m,"handleFocusOut"),Bt(A,"handleMutations"),document.addEventListener("focusin",q),document.addEventListener("focusout",m);const w=new MutationObserver(A);return a&&w.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",q),document.removeEventListener("focusout",m),w.disconnect()}}},[i,a,g.paused]),v.useEffect(()=>{if(a){V0.add(g);const q=document.activeElement;if(!a.contains(q)){const A=new CustomEvent(uh,b0);a.addEventListener(uh,h),a.dispatchEvent(A),A.defaultPrevented||(gm(vm(l4(a)),{select:!0}),document.activeElement===q&&wr(a))}return()=>{a.removeEventListener(uh,h),setTimeout(()=>{const A=new CustomEvent(dh,b0);a.addEventListener(dh,d),a.dispatchEvent(A),A.defaultPrevented||wr(q??document.body,{select:!0}),a.removeEventListener(dh,d),V0.remove(g)},0)}}},[a,h,d,g]);const y=v.useCallback(q=>{if(!r&&!i||g.paused)return;const m=q.key==="Tab"&&!q.altKey&&!q.ctrlKey&&!q.metaKey,A=document.activeElement;if(m&&A){const w=q.currentTarget,[x,V]=pm(w);x&&V?!q.shiftKey&&A===V?(q.preventDefault(),r&&wr(x,{select:!0})):q.shiftKey&&A===x&&(q.preventDefault(),r&&wr(V,{select:!0})):A===w&&q.preventDefault()}},[r,i,g.paused]);return f.jsx(at.div,{tabIndex:-1,...l,ref:p,onKeyDown:y})},"FocusScope"));function gm(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(wr(r,{select:t}),document.activeElement!==n)return}Bt(gm,"focusFirst");function pm(e){const t=l4(e),n=sf(t,e),r=sf(t.reverse(),e);return[n,r]}Bt(pm,"getTabbableEdges");function l4(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:Bt(r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;n.nextNode();)t.push(n.currentNode);return t}Bt(l4,"getTabbableCandidates");function sf(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):mm(r,{upTo:t})))return r}Bt(sf,"findVisible");function mm(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}Bt(mm,"isHidden");function ym(e){return e instanceof HTMLInputElement&&"select"in e}Bt(ym,"isSelectableInput");function wr(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&ym(e)&&t&&e.select()}}Bt(wr,"focus");var V0=Am();function Am(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=lf(e,t),e.unshift(t)},remove(t){var n;e=lf(e,t),(n=e[0])==null||n.resume()}}}Bt(Am,"createFocusScopesStack");function lf(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}Bt(lf,"arrayRemove");function vm(e){return e.filter(t=>t.tagName!=="A")}Bt(vm,"removeLinks");var un=globalThis!=null&&globalThis.document?v.useLayoutEffect:()=>{},aj=Object.defineProperty,cj=(e,t)=>aj(e,"name",{value:t,configurable:!0}),uj=Za[" useId ".trim().toString()]||(()=>{}),dj=0;function Sn(e){const[t,n]=v.useState(uj());return un(()=>{e||n(r=>r??String(dj++))},[e]),e||(t?`radix-${t}`:"")}cj(Sn,"useId");const hj=["top","right","bottom","left"],Ii=Math.min,_r=Math.max,h1=Math.round,$c=Math.floor,Tr=e=>({x:e,y:e}),fj={left:"right",right:"left",bottom:"top",top:"bottom"};function qm(e,t,n){return _r(e,Ii(t,n))}function Or(e,t){return typeof e=="function"?e(t):e}function Li(e){return e.split("-")[0]}function hl(e){return e.split("-")[1]}function a4(e){return e==="x"?"y":"x"}function c4(e){return e==="y"?"height":"width"}function sr(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function u4(e){return a4(sr(e))}function gj(e,t,n){n===void 0&&(n=!1);const r=hl(e),i=u4(e),o=c4(i);let s=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(s=f1(s)),[s,f1(s)]}function pj(e){const t=f1(e);return[af(e),t,af(t)]}function af(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const k0=["left","right"],j0=["right","left"],mj=["top","bottom"],yj=["bottom","top"];function Aj(e,t,n){switch(e){case"top":case"bottom":return n?t?j0:k0:t?k0:j0;case"left":case"right":return t?mj:yj;default:return[]}}function vj(e,t,n,r){const i=hl(e);let o=Aj(Li(e),n==="start",r);return i&&(o=o.map(s=>s+"-"+i),t&&(o=o.concat(o.map(af)))),o}function f1(e){const t=Li(e);return fj[t]+e.slice(t.length)}function qj(e){var t,n,r,i;return{top:(t=e.top)!=null?t:0,right:(n=e.right)!=null?n:0,bottom:(r=e.bottom)!=null?r:0,left:(i=e.left)!=null?i:0}}function wm(e){return typeof e!="number"?qj(e):{top:e,right:e,bottom:e,left:e}}function g1(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function z0(e,t,n){let{reference:r,floating:i}=e;const o=sr(t),s=u4(t),l=c4(s),a=Li(t),c=o==="y",h=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,u=r[l]/2-i[l]/2;let p;switch(a){case"top":p={x:h,y:r.y-i.height};break;case"bottom":p={x:h,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:d};break;case"left":p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}const g=hl(t);return g&&(p[s]+=u*(g==="end"?1:-1)*(n&&c?-1:1)),p}async function wj(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:o,rects:s,elements:l,strategy:a}=e,{boundary:c="clippingAncestors",rootBoundary:h="viewport",elementContext:d="floating",altBoundary:u=!1,padding:p=0}=Or(t,e),g=wm(p),q=l[u?d==="floating"?"reference":"floating":d],m=g1(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(q)))==null||n?q:q.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(l.floating)),boundary:c,rootBoundary:h,strategy:a})),A=d==="floating"?{x:r,y:i,width:s.floating.width,height:s.floating.height}:s.reference,w=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l.floating)),x=await(o.isElement==null?void 0:o.isElement(w))&&await(o.getScale==null?void 0:o.getScale(w))||{x:1,y:1},V=g1(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:A,offsetParent:w,strategy:a}):A);return{top:(m.top-V.top+g.top)/x.y,bottom:(V.bottom-m.bottom+g.bottom)/x.y,left:(m.left-V.left+g.left)/x.x,right:(V.right-m.right+g.right)/x.x}}const xj=50,bj=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:s}=n,l=s.detectOverflow?s:{...s,detectOverflow:wj},a=await(s.isRTL==null?void 0:s.isRTL(t));let c=await s.getElementRects({reference:e,floating:t,strategy:i}),{x:h,y:d}=z0(c,r,a),u=r,p=0;const g={};for(let y=0;y<o.length;y++){const q=o[y];if(!q)continue;const{name:m,fn:A}=q,{x:w,y:x,data:V,reset:k}=await A({x:h,y:d,initialPlacement:r,placement:u,strategy:i,middlewareData:g,rects:c,platform:l,elements:{reference:e,floating:t}});h=w??h,d=x??d,g[m]={...g[m],...V},k&&p<xj&&(p++,typeof k=="object"&&(k.placement&&(u=k.placement),k.rects&&(c=k.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:i}):k.rects),{x:h,y:d}=z0(c,u,a)),y=-1)}return{x:h,y:d,placement:u,strategy:i,middlewareData:g}},Vj=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:o,platform:s,elements:l,middlewareData:a}=t,{element:c,padding:h=0}=Or(e,t)||{};if(c==null)return{};const d=wm(h),u={x:n,y:r},p=u4(i),g=c4(p),y=await s.getDimensions(c),q=p==="y",m=q?"top":"left",A=q?"bottom":"right",w=q?"clientHeight":"clientWidth",x=o.reference[g]+o.reference[p]-u[p]-o.floating[g],V=u[p]-o.reference[p],k=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c));let b=k?k[w]:0;(!b||!await(s.isElement==null?void 0:s.isElement(k)))&&(b=l.floating[w]||o.floating[g]);const j=x/2-V/2,z=b/2-y[g]/2-1,S=Ii(d[m],z),R=Ii(d[A],z),T=b-y[g]-R,E=b/2-y[g]/2+j,C=qm(S,E,T),_=!a.arrow&&hl(i)!=null&&E!==C&&o.reference[g]/2-(E<S?S:R)-y[g]/2<0,L=_?E<S?E-S:E-T:0;return{[p]:u[p]+L,data:{[p]:C,centerOffset:E-C-L,..._&&{alignmentOffset:L}},reset:_}}}),kj=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:o,rects:s,initialPlacement:l,platform:a,elements:c}=t,{mainAxis:h=!0,crossAxis:d=!0,fallbackPlacements:u,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:y=!0,...q}=Or(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const m=Li(i),A=sr(l),w=Li(l)===l,x=await(a.isRTL==null?void 0:a.isRTL(c.floating)),V=u||(w||!y?[f1(l)]:pj(l)),k=g!=="none";!u&&k&&V.push(...vj(l,y,g,x));const b=[l,...V],j=await a.detectOverflow(t,q),z=[];let S=((r=o.flip)==null?void 0:r.overflows)||[];if(h&&z.push(j[m]),d){const C=gj(i,s,x);z.push(j[C[0]],j[C[1]])}if(S=[...S,{placement:i,overflows:z}],!z.every(C=>C<=0)){var R,T;const C=(((R=o.flip)==null?void 0:R.index)||0)+1,_=b[C];if(_&&(!(d==="alignment"?A!==sr(_):!1)||S.every(M=>sr(M.placement)===A?M.overflows[0]>0:!0)))return{data:{index:C,overflows:S},reset:{placement:_}};let L=(T=S.filter(D=>D.overflows[0]<=0).sort((D,M)=>D.overflows[1]-M.overflows[1])[0])==null?void 0:T.placement;if(!L)switch(p){case"bestFit":{var E;const D=(E=S.filter(M=>{if(k){const N=sr(M.placement);return N===A||N==="y"}return!0}).map(M=>[M.placement,M.overflows.filter(N=>N>0).reduce((N,O)=>N+O,0)]).sort((M,N)=>M[1]-N[1])[0])==null?void 0:E[0];D&&(L=D);break}case"initialPlacement":L=l;break}if(i!==L)return{reset:{placement:L}}}return{}}}};function S0(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function C0(e){return hj.some(t=>e[t]>=0)}const jj=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:i="referenceHidden",...o}=Or(e,t);switch(i){case"referenceHidden":{const s=await r.detectOverflow(t,{...o,elementContext:"reference"}),l=S0(s,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:C0(l)}}}case"escaped":{const s=await r.detectOverflow(t,{...o,altBoundary:!0}),l=S0(s,n.floating);return{data:{escapedOffsets:l,escaped:C0(l)}}}default:return{}}}}},xm=new Set(["left","top"]);async function zj(e,t){const{placement:n,platform:r,elements:i}=e,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),s=Li(n),l=hl(n),a=sr(n)==="y",c=xm.has(s)?-1:1,h=o&&a?-1:1,d=Or(t,e);let{mainAxis:u,crossAxis:p,alignmentAxis:g}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return l&&typeof g=="number"&&(p=l==="end"?g*-1:g),a?{x:p*h,y:u*c}:{x:u*c,y:p*h}}const Sj=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:o,placement:s,middlewareData:l}=t,a=await zj(t,e);return s===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:i+a.x,y:o+a.y,data:{...a,placement:s}}}}},Cj=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i,platform:o}=t,{mainAxis:s=!0,crossAxis:l=!1,limiter:a={fn:A=>{let{x:w,y:x}=A;return{x:w,y:x}}},...c}=Or(e,t),h={x:n,y:r},d=await o.detectOverflow(t,c),u=sr(i),p=a4(u);let g=h[p],y=h[u];const q=(A,w)=>qm(w+d[A==="y"?"top":"left"],w,w-d[A==="y"?"bottom":"right"]);s&&(g=q(p,g)),l&&(y=q(u,y));const m=a.fn({...t,[p]:g,[u]:y});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[p]:s,[u]:l}}}}}},Ej=function(e){return e===void 0&&(e={}),{options:e,fn(t){var n,r;const{x:i,y:o,placement:s,rects:l,middlewareData:a}=t,{offset:c=0,mainAxis:h=!0,crossAxis:d=!0}=Or(e,t),u={x:i,y:o},p=sr(s),g=a4(p);let y=u[g],q=u[p];const m=Or(c,t),A=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:(n=m.mainAxis)!=null?n:0,crossAxis:(r=m.crossAxis)!=null?r:0};if(h){const V=g==="y"?"height":"width",k=l.reference[g]-l.floating[V]+A.mainAxis,b=l.reference[g]+l.reference[V]-A.mainAxis;y<k?y=k:y>b&&(y=b)}if(d){var w,x;const V=g==="y"?"width":"height",k=xm.has(Li(s)),b=l.reference[p]-l.floating[V]+(k&&((w=a.offset)==null?void 0:w[p])||0)+(k?0:A.crossAxis),j=l.reference[p]+l.reference[V]+(k?0:((x=a.offset)==null?void 0:x[p])||0)-(k?A.crossAxis:0);q<b?q=b:q>j&&(q=j)}return{[g]:y,[p]:q}}}},Rj=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:i,elements:o}=t,{apply:s=()=>{},...l}=Or(e,t),a=await i.detectOverflow(t,l),c=Li(n),h=hl(n),d=sr(n)==="y",{width:u,height:p}=r.floating;let g,y;c==="top"||c==="bottom"?(g=c,y=h===(await(i.isRTL==null?void 0:i.isRTL(o.floating))?"start":"end")?"left":"right"):(y=c,g=h==="end"?"top":"bottom");const q=p-a.top-a.bottom,m=u-a.left-a.right,A=Ii(p-a[g],q),w=Ii(u-a[y],m),x=t.middlewareData.shift,V=!x;let k=A,b=w;x!=null&&x.enabled.x&&(b=m),x!=null&&x.enabled.y&&(k=q),V&&!h&&(d?b=u-2*_r(a.left,a.right):k=p-2*_r(a.top,a.bottom)),await s({...t,availableWidth:b,availableHeight:k});const j=await i.getDimensions(o.floating);return u!==j.width||p!==j.height?{reset:{rects:!0}}:{}}}};function sd(){return typeof window<"u"}function fl(e){return bm(e)?(e.nodeName||"").toLowerCase():"#document"}function rn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ur(e){var t;return(t=(bm(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function bm(e){return sd()?e instanceof Node||e instanceof rn(e).Node:!1}function fr(e){return sd()?e instanceof Element||e instanceof rn(e).Element:!1}function Ki(e){return sd()?e instanceof HTMLElement||e instanceof rn(e).HTMLElement:!1}function E0(e){return!sd()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof rn(e).ShadowRoot}function ld(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=gr(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!=="inline"&&i!=="contents"}function _j(e){return/^(table|td|th)$/.test(fl(e))}function ad(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Tj=/transform|translate|scale|rotate|perspective|filter/,Mj=/paint|layout|strict|content/,io=e=>!!e&&e!=="none";let hh;function d4(e){const t=fr(e)?gr(e):e;return io(t.transform)||io(t.translate)||io(t.scale)||io(t.rotate)||io(t.perspective)||!h4()&&(io(t.backdropFilter)||io(t.filter))||Tj.test(t.willChange||"")||Mj.test(t.contain||"")}function Pj(e){let t=Ro(e);for(;Ki(t)&&!Ta(t);){if(d4(t))return t;if(ad(t))return null;t=Ro(t)}return null}function h4(){return hh==null&&(hh=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),hh}function Ta(e){return/^(html|body|#document)$/.test(fl(e))}function gr(e){return rn(e).getComputedStyle(e)}function cd(e){return fr(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ro(e){if(fl(e)==="html")return e;const t=e.assignedSlot||e.parentNode||E0(e)&&e.host||Ur(e);return E0(t)?t.host:t}function Vm(e){const t=Ro(e);return Ta(t)?(e.ownerDocument||e).body:Ki(t)&&ld(t)?t:Vm(t)}function Ma(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=Vm(e),o=i===((r=e.ownerDocument)==null?void 0:r.body),s=rn(i);if(o){const l=cf(s);return t.concat(s,s.visualViewport||[],ld(i)?i:[],l&&n?Ma(l):[])}else return t.concat(i,Ma(i,[],n))}function cf(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function km(e){const t=gr(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=Ki(e),o=i?e.offsetWidth:n,s=i?e.offsetHeight:r,l=h1(n)!==o||h1(r)!==s;return l&&(n=o,r=s),{width:n,height:r,$:l}}function f4(e){return fr(e)?e:e.contextElement}function Ls(e){const t=f4(e);if(!Ki(t))return Tr(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:o}=km(t);let s=(o?h1(n.width):n.width)/r,l=(o?h1(n.height):n.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!l||!Number.isFinite(l))&&(l=1),{x:s,y:l}}const Ij=Tr(0);function jm(e){const t=rn(e);return!h4()||!t.visualViewport?Ij:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Lj(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===rn(e)}function _o(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),o=f4(e);let s=Tr(1);t&&(r?fr(r)&&(s=Ls(r)):s=Ls(e));const l=Lj(o,n,r)?jm(o):Tr(0);let a=(i.left+l.x)/s.x,c=(i.top+l.y)/s.y,h=i.width/s.x,d=i.height/s.y;if(o&&r){const u=rn(o),p=fr(r)?rn(r):r;let g=u,y=cf(g);for(;y&&p!==g;){const q=Ls(y),m=y.getBoundingClientRect(),A=gr(y),w=m.left+(y.clientLeft+parseFloat(A.paddingLeft))*q.x,x=m.top+(y.clientTop+parseFloat(A.paddingTop))*q.y;a*=q.x,c*=q.y,h*=q.x,d*=q.y,a+=w,c+=x,g=rn(y),y=cf(g)}}return g1({width:h,height:d,x:a,y:c})}function ud(e,t){const n=cd(e).scrollLeft;return t?t.left+n:_o(Ur(e)).left+n}function zm(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-ud(e,n),i=n.top+t.scrollTop;return{x:r,y:i}}function Nj(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const o=i==="fixed",s=Ur(r),l=t?ad(t.floating):!1;if(r===s||l&&o)return n;let a={scrollLeft:0,scrollTop:0},c=Tr(1);const h=Tr(0),d=Ki(r);if((d||!o)&&((fl(r)!=="body"||ld(s))&&(a=cd(r)),d)){const p=_o(r);c=Ls(r),h.x=p.x+r.clientLeft,h.y=p.y+r.clientTop}const u=s&&!d&&!o?zm(s,a):Tr(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-a.scrollLeft*c.x+h.x+u.x,y:n.y*c.y-a.scrollTop*c.y+h.y+u.y}}function Dj(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Oj(e){const t=cd(e),n=e.ownerDocument.body,r=_r(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=_r(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let o=-t.scrollLeft+ud(e);const s=-t.scrollTop;return gr(n).direction==="rtl"&&(o+=_r(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:o,y:s}}const Bj=25;function Fj(e,t,n){n===void 0&&(n="viewport");const r=n==="layoutViewport",i=rn(e),o=Ur(e),s=i.visualViewport;let l=o.clientWidth,a=o.clientHeight,c=0,h=0;if(s){const u=!h4()||t==="fixed";r?u||(c=-s.offsetLeft,h=-s.offsetTop):(l=s.width,a=s.height,u&&(c=s.offsetLeft,h=s.offsetTop))}if(ud(o)<=0){const u=o.ownerDocument,p=u.body,g=getComputedStyle(p),y=u.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,q=Math.abs(o.clientWidth-p.clientWidth-y),m=getComputedStyle(o).scrollbarGutter==="stable both-edges"?q/2:q;m<=Bj&&(l-=m)}return{width:l,height:a,x:c,y:h}}function Hj(e,t){const n=_o(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,o=Ls(e),s=e.clientWidth*o.x,l=e.clientHeight*o.y,a=i*o.x,c=r*o.y;return{width:s,height:l,x:a,y:c}}function R0(e,t,n){let r;if(t==="viewport"||t==="layoutViewport")r=Fj(e,n,t);else if(t==="document")r=Oj(Ur(e));else if(fr(t))r=Hj(t,n);else{const i=jm(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return g1(r)}function Uj(e,t){const n=t.get(e);if(n)return n;let r=Ma(e,[],!1).filter(l=>fr(l)&&fl(l)!=="body"),i=null;const o=gr(e).position==="fixed";let s=o?Ro(e):e;for(;fr(s)&&!Ta(s);){const l=gr(s),a=d4(s),c=i?i.position:o?"fixed":"";!a&&(c==="fixed"||c==="absolute"&&l.position==="static")?r=r.filter(d=>d!==s):i=l,s=Ro(s)}return t.set(e,r),r}function Wj(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const s=[...n==="clippingAncestors"?ad(t)?[]:Uj(t,this._c):[].concat(n),r],l=R0(t,s[0],i);let a=l.top,c=l.right,h=l.bottom,d=l.left;for(let u=1;u<s.length;u++){const p=R0(t,s[u],i);a=_r(p.top,a),c=Ii(p.right,c),h=Ii(p.bottom,h),d=_r(p.left,d)}return{width:c-d,height:h-a,x:d,y:a}}function Kj(e){const{width:t,height:n}=km(e);return{width:t,height:n}}function $j(e,t,n){const r=Ki(t),i=Ur(t),o=n==="fixed",s=_o(e,!0,o,t);let l={scrollLeft:0,scrollTop:0};const a=Tr(0);if((r||!o)&&((fl(t)!=="body"||ld(i))&&(l=cd(t)),r)){const u=_o(t,!0,o,t);a.x=u.x+t.clientLeft,a.y=u.y+t.clientTop}!r&&i&&(a.x=ud(i));const c=i&&!r&&!o?zm(i,l):Tr(0),h=s.left+l.scrollLeft-a.x-c.x,d=s.top+l.scrollTop-a.y-c.y;return{x:h,y:d,width:s.width,height:s.height}}function fh(e){return gr(e).position==="static"}function _0(e,t){if(!Ki(e)||gr(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ur(e)===n&&(n=n.ownerDocument.body),n}function Sm(e,t){const n=rn(e);if(ad(e))return n;if(!Ki(e)){let i=Ro(e);for(;i&&!Ta(i);){if(fr(i)&&!fh(i))return i;i=Ro(i)}return n}let r=_0(e,t);for(;r&&_j(r)&&fh(r);)r=_0(r,t);return r&&Ta(r)&&fh(r)&&!d4(r)?n:r||Pj(e)||n}const Gj=async function(e){const t=this.getOffsetParent||Sm,n=this.getDimensions,r=await n(e.floating);return{reference:$j(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Qj(e){return gr(e).direction==="rtl"}const Yj={convertOffsetParentRelativeRectToViewportRelativeRect:Nj,getDocumentElement:Ur,getClippingRect:Wj,getOffsetParent:Sm,getElementRects:Gj,getClientRects:Dj,getDimensions:Kj,getScale:Ls,isElement:fr,isRTL:Qj};function Cm(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Zj(e,t,n){let r=null,i;const o=Ur(e);function s(){var h;clearTimeout(i),(h=r)==null||h.disconnect(),r=null}function l(h,d){h===void 0&&(h=!1),d===void 0&&(d=1),s();const u=e.getBoundingClientRect(),{left:p,top:g,width:y,height:q}=u;if(h||t(),!y||!q)return;const m=$c(g),A=$c(o.clientWidth-(p+y)),w=$c(o.clientHeight-(g+q)),x=$c(p),k={rootMargin:-m+"px "+-A+"px "+-w+"px "+-x+"px",threshold:_r(0,Ii(1,d))||1};let b=!0;function j(z){const S=z[0].intersectionRatio;if(!Cm(u,e.getBoundingClientRect()))return l();if(S!==d){if(!b)return l();S?l(!1,S):i=setTimeout(()=>{l(!1,1e-7)},1e3)}b=!1}try{r=new IntersectionObserver(j,{...k,root:o.ownerDocument})}catch{r=new IntersectionObserver(j,k)}r.observe(e)}const a=rn(e),c=()=>l(n);return a.addEventListener("resize",c),l(!0),()=>{a.removeEventListener("resize",c),s()}}function Xj(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:a=!1}=r,c=f4(e),h=i||o?[...c?Ma(c):[],...t?Ma(t):[]]:[];h.forEach(m=>{i&&m.addEventListener("scroll",n),o&&m.addEventListener("resize",n)});const d=c&&l?Zj(c,n,o):null;let u=-1,p=null;s&&(p=new ResizeObserver(m=>{let[A]=m;A&&A.target===c&&p&&t&&(p.unobserve(t),cancelAnimationFrame(u),u=requestAnimationFrame(()=>{var w;(w=p)==null||w.observe(t)})),n()}),c&&!a&&p.observe(c),t&&p.observe(t));let g,y=a?_o(e):null;a&&q();function q(){const m=_o(e);y&&!Cm(y,m)&&n(),y=m,g=requestAnimationFrame(q)}return n(),()=>{var m;h.forEach(A=>{i&&A.removeEventListener("scroll",n),o&&A.removeEventListener("resize",n)}),d==null||d(),(m=p)==null||m.disconnect(),p=null,a&&cancelAnimationFrame(g)}}const Jj=Sj,ez=Cj,tz=kj,nz=Rj,rz=jj,T0=Vj,iz=Ej,oz=(e,t,n)=>{const r=new Map,i=n??{},o={...Yj,...i.platform,_c:r};return bj(e,t,{...i,platform:o})};var sz=typeof document<"u",lz=function(){},Su=sz?v.useLayoutEffect:lz;function p1(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!p1(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){const o=i[r];if(!(o==="_owner"&&e.$$typeof)&&!p1(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function Em(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function M0(e,t){const n=Em(e);return Math.round(t*n)/n}function gh(e){const t=v.useRef(e);return Su(()=>{t.current=e}),t}function az(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:o,floating:s}={},transform:l=!0,whileElementsMounted:a,open:c}=e,[h,d]=v.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[u,p]=v.useState(r);p1(u,r)||p(r);const[g,y]=v.useState(null),[q,m]=v.useState(null),A=v.useCallback(M=>{M!==k.current&&(k.current=M,y(M))},[]),w=v.useCallback(M=>{M!==b.current&&(b.current=M,m(M))},[]),x=o||g,V=s||q,k=v.useRef(null),b=v.useRef(null),j=v.useRef(h),z=a!=null,S=gh(a),R=gh(i),T=gh(c),E=v.useCallback(()=>{if(!k.current||!b.current)return;const M={placement:t,strategy:n,middleware:u};R.current&&(M.platform=R.current),oz(k.current,b.current,M).then(N=>{const O={...N,isPositioned:T.current!==!1};C.current&&!p1(j.current,O)&&(j.current=O,nc.flushSync(()=>{d(O)}))})},[u,t,n,R,T]);Su(()=>{c===!1&&j.current.isPositioned&&(j.current.isPositioned=!1,d(M=>({...M,isPositioned:!1})))},[c]);const C=v.useRef(!1);Su(()=>(C.current=!0,()=>{C.current=!1}),[]),Su(()=>{if(x&&(k.current=x),V&&(b.current=V),x&&V){if(S.current)return S.current(x,V,E);E()}},[x,V,E,S,z]);const _=v.useMemo(()=>({reference:k,floating:b,setReference:A,setFloating:w}),[A,w]),L=v.useMemo(()=>({reference:x,floating:V}),[x,V]),D=v.useMemo(()=>{const M={position:n,left:0,top:0};if(!L.floating)return M;const N=M0(L.floating,h.x),O=M0(L.floating,h.y);return l?{...M,transform:"translate("+N+"px, "+O+"px)",...Em(L.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:N,top:O}},[n,l,L.floating,h.x,h.y]);return v.useMemo(()=>({...h,update:E,refs:_,elements:L,floatingStyles:D}),[h,E,_,L,D])}const cz=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:i}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?T0({element:r.current,padding:i}).fn(n):{}:r?T0({element:r,padding:i}).fn(n):{}}}},uz=(e,t)=>{const n=Jj(e);return{name:n.name,fn:n.fn,options:[e,t]}},dz=(e,t)=>{const n=ez(e);return{name:n.name,fn:n.fn,options:[e,t]}},hz=(e,t)=>({fn:iz(e).fn,options:[e,t]}),fz=(e,t)=>{const n=tz(e);return{name:n.name,fn:n.fn,options:[e,t]}},gz=(e,t)=>{const n=nz(e);return{name:n.name,fn:n.fn,options:[e,t]}},pz=(e,t)=>{const n=rz(e);return{name:n.name,fn:n.fn,options:[e,t]}},mz=(e,t)=>{const n=cz(e);return{name:n.name,fn:n.fn,options:[e,t]}};var yz=Object.defineProperty,Az=(e,t)=>yz(e,"name",{value:t,configurable:!0}),vz=v.forwardRef(Az(function(t,n){const{children:r,width:i=10,height:o=5,...s}=t;return f.jsx(at.svg,{...s,ref:n,width:i,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:f.jsx("polygon",{points:"0,0 30,0 15,10"})})},"Arrow")),qz=vz,wz=Object.defineProperty,xz=(e,t)=>wz(e,"name",{value:t,configurable:!0});function Rm(e){const[t,n]=v.useState(void 0);return un(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const o=i[0];let s,l;if("borderBoxSize"in o){const a=o.borderBoxSize,c=Array.isArray(a)?a[0]:a;s=c.inlineSize,l=c.blockSize}else s=e.offsetWidth,l=e.offsetHeight;n({width:s,height:l})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}xz(Rm,"useSize");var bz=Object.defineProperty,Mr=(e,t)=>bz(e,"name",{value:t,configurable:!0}),_m="Popper",[Tm,dd]=ic(_m),[Vz,Mm]=Tm(_m),kz=Mr(e=>{const{__scopePopper:t,children:n}=e,[r,i]=v.useState(null),[o,s]=v.useState(void 0);return f.jsx(Vz,{scope:t,anchor:r,onAnchorChange:i,placementState:o,setPlacementState:s,children:n})},"Popper"),jz="PopperAnchor",zz=v.forwardRef(Mr(function(t,n){const{__scopePopper:r,virtualRef:i,...o}=t,s=Mm(jz,r),l=v.useRef(null),a=s.onAnchorChange,c=v.useCallback(y=>{l.current=y,y&&a(y)},[a]),h=_n(n,c),d=v.useRef(null);v.useEffect(()=>{if(!i)return;const y=d.current;d.current=i.current,y!==d.current&&a(d.current)});const u=s.placementState&&hd(s.placementState),p=u==null?void 0:u[0],g=u==null?void 0:u[1];return i?null:f.jsx(at.div,{"data-radix-popper-side":p,"data-radix-popper-align":g,...o,ref:h})},"PopperAnchor")),Pm="PopperContent",[Sz,Cz]=Tm(Pm),Ez=v.forwardRef(Mr(function(t,n){var ie,be,Ae,qe,ze,Ve,ge;const{__scopePopper:r,side:i="bottom",sideOffset:o=0,align:s="center",alignOffset:l=0,arrowPadding:a=0,avoidCollisions:c=!0,collisionBoundary:h=[],collisionPadding:d=0,sticky:u="partial",hideWhenDetached:p=!1,updatePositionStrategy:g="optimized",onPlaced:y,...q}=t,m=Mm(Pm,r),[A,w]=v.useState(null),x=_n(n,w),[V,k]=v.useState(null),b=Rm(V),j=(b==null?void 0:b.width)??0,z=(b==null?void 0:b.height)??0,S=i+(s!=="center"?"-"+s:""),R=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},T=Array.isArray(h)?h:[h],E=T.length>0,C={padding:R,boundary:T.filter(Im),altBoundary:E},{refs:_,floatingStyles:L,placement:D,isPositioned:M,middlewareData:N}=az({strategy:"fixed",placement:S,whileElementsMounted:Mr((...ye)=>Xj(...ye,{animationFrame:g==="always"}),"whileElementsMounted"),elements:{reference:m.anchor},middleware:[uz({mainAxis:o+z,alignmentAxis:l}),c&&dz({mainAxis:!0,crossAxis:!1,limiter:u==="partial"?hz():void 0,...C}),c&&fz({...C}),gz({...C,apply:Mr(({elements:ye,rects:Ee,availableWidth:ae,availableHeight:dt})=>{const{width:Lt,height:I}=Ee.reference,X=ye.floating.style;X.setProperty("--radix-popper-available-width",`${ae}px`),X.setProperty("--radix-popper-available-height",`${dt}px`),X.setProperty("--radix-popper-anchor-width",`${Lt}px`),X.setProperty("--radix-popper-anchor-height",`${I}px`)},"apply")}),V&&mz({element:V,padding:a}),Mz({arrowWidth:j,arrowHeight:z}),p&&pz({strategy:"referenceHidden",...C,boundary:E?C.boundary:void 0})]}),O=m.setPlacementState;un(()=>(O(D),()=>{O(void 0)}),[D,O]);const[$,P]=hd(D),H=Eo(y);un(()=>{M&&(H==null||H())},[M,H]);const Z=(ie=N.arrow)==null?void 0:ie.x,G=(be=N.arrow)==null?void 0:be.y,Q=((Ae=N.arrow)==null?void 0:Ae.centerOffset)!==0,[le,F]=v.useState();return un(()=>{A&&F(window.getComputedStyle(A).zIndex)},[A]),f.jsx("div",{ref:_.setFloating,"data-radix-popper-content-wrapper":"",style:{...L,transform:M?L.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:le,"--radix-popper-transform-origin":[(qe=N.transformOrigin)==null?void 0:qe.x,(ze=N.transformOrigin)==null?void 0:ze.y].join(" "),...((Ve=N.hide)==null?void 0:Ve.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:f.jsx(Sz,{scope:r,placedSide:$,placedAlign:P,onArrowChange:k,arrowX:Z,arrowY:G,shouldHideArrow:Q,children:f.jsx(at.div,{"data-side":$,"data-align":P,...q,ref:x,style:{...q.style,animation:M?(ge=q.style)==null?void 0:ge.animation:"none"}})})})},"PopperContent")),Rz="PopperArrow",_z={top:"bottom",right:"left",bottom:"top",left:"right"},Tz=v.forwardRef(Mr(function(t,n){const{__scopePopper:r,...i}=t,o=Cz(Rz,r),s=_z[o.placedSide];return f.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:f.jsx(qz,{...i,ref:n,style:{...i.style,display:"block"}})})},"PopperArrow"));function Im(e){return e!==null}Mr(Im,"isNotNull");var Mz=Mr(e=>({name:"transformOrigin",options:e,fn(t){var q,m,A;const{placement:n,rects:r,middlewareData:i}=t,s=((q=i.arrow)==null?void 0:q.centerOffset)!==0,l=s?0:e.arrowWidth,a=s?0:e.arrowHeight,[c,h]=hd(n),d={start:"0%",center:"50%",end:"100%"}[h],u=(((m=i.arrow)==null?void 0:m.x)??0)+l/2,p=(((A=i.arrow)==null?void 0:A.y)??0)+a/2;let g="",y="";return c==="bottom"?(g=s?d:`${u}px`,y=`${-a}px`):c==="top"?(g=s?d:`${u}px`,y=`${r.floating.height+a}px`):c==="right"?(g=`${-a}px`,y=s?d:`${p}px`):c==="left"&&(g=`${r.floating.width+a}px`,y=s?d:`${p}px`),{data:{x:g,y}}}}),"transformOrigin");function hd(e){const[t,n="center"]=e.split("-");return[t,n]}Mr(hd,"getSideAndAlignFromPlacement");var Lm=kz,Nm=zz,Dm=Ez,Pz=Tz,Iz=Object.defineProperty,Lz=(e,t)=>Iz(e,"name",{value:t,configurable:!0}),g4=v.forwardRef(Lz(function(t,n){var a;const{container:r,...i}=t,[o,s]=v.useState(!1);un(()=>s(!0),[]);const l=r||o&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return l?nc.createPortal(f.jsx(at.div,{...i,ref:n}),l):null},"Portal")),Nz=Object.defineProperty,Br=(e,t)=>Nz(e,"name",{value:t,configurable:!0});function Om(e,t){return v.useReducer((n,r)=>t[n][r]??n,e)}Br(Om,"useStateMachine");var Fo=Br(e=>{const{present:t,children:n}=e,r=Bm(t),i=typeof n=="function"?n({present:r.isPresent}):v.Children.only(n),o=Fm(r.ref,Hm(i));return typeof n=="function"||r.isPresent?v.cloneElement(i,{ref:o}):null},"Presence");function Bm(e){const[t,n]=v.useState(),r=v.useRef(null),i=v.useRef(e),o=v.useRef("none"),s=v.useRef(void 0),l=e?"mounted":"unmounted",[a,c]=Om(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return v.useEffect(()=>{a==="mounted"?(o.current=s.current??os(r.current),s.current=void 0):o.current="none"},[a]),un(()=>{const h=r.current,d=i.current;if(d!==e){const p=o.current,g=os(h);e?(s.current=g,c("MOUNT")):g==="none"||(h==null?void 0:h.display)==="none"?c("UNMOUNT"):c(d&&p!==g?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,c]),un(()=>{if(t){let h;const d=t.ownerDocument.defaultView??window,u=Br(g=>{const q=os(r.current).includes(CSS.escape(g.animationName));if(g.target===t&&q&&(c("ANIMATION_END"),!i.current)){const m=t.style.animationFillMode;t.style.animationFillMode="forwards",h=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=m)})}},"handleAnimationEnd"),p=Br(g=>{g.target===t&&(o.current=os(r.current))},"handleAnimationStart");return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",u),t.addEventListener("animationend",u),()=>{d.clearTimeout(h),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",u),t.removeEventListener("animationend",u)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:v.useCallback(h=>{if(h){const d=getComputedStyle(h);r.current=d,s.current=os(d)}else r.current=null;n(h)},[])}}Br(Bm,"usePresence");function uf(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}Br(uf,"setRef");function Fm(...e){const t=v.useRef(e);return t.current=e,v.useCallback(n=>{const r=t.current;let i=!1;const o=r.map(s=>{const l=uf(s,n);return!i&&typeof l=="function"&&(i=!0),l});if(i)return()=>{for(let s=0;s<o.length;s++){const l=o[s];typeof l=="function"?l():uf(r[s],null)}}},[])}Br(Fm,"useStableComposedRefs");function os(e){return(e==null?void 0:e.animationName)||"none"}Br(os,"getAnimationName");function Hm(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}Br(Hm,"getElementRef");var Dz=Object.defineProperty,Oz=(e,t)=>Dz(e,"name",{value:t,configurable:!0}),P0=Za[" useEffectEvent ".trim().toString()],I0=Za[" useInsertionEffect ".trim().toString()];function Um(e){if(typeof P0=="function")return P0(e);const t=v.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof I0=="function"?I0(()=>{t.current=e}):un(()=>{t.current=e}),v.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}Oz(Um,"useEffectEvent");var Bz=Object.defineProperty,oc=(e,t)=>Bz(e,"name",{value:t,configurable:!0}),Fz=Za[" useInsertionEffect ".trim().toString()]||un;function fd({prop:e,defaultProp:t,onChange:n=oc(()=>{},"onChange"),caller:r}){const[i,o,s]=Wm({defaultProp:t,onChange:n}),l=e!==void 0,a=l?e:i,c=v.useCallback(h=>{var d;if(l){const u=Km(h)?h(e):h;u!==e&&((d=s.current)==null||d.call(s,u))}else o(h)},[l,e,o,s]);return[a,c]}oc(fd,"useControllableState");function Wm({defaultProp:e,onChange:t}){const[n,r]=v.useState(e),i=v.useRef(n),o=v.useRef(t);return Fz(()=>{o.current=t},[t]),v.useEffect(()=>{var s;i.current!==n&&((s=o.current)==null||s.call(o,n),i.current=n)},[n,i]),[n,r,o]}oc(Wm,"useUncontrolledState");function Km(e){return typeof e=="function"}oc(Km,"isFunction");var L0=Symbol("RADIX:SYNC_STATE");function Hz(e,t,n,r){const{prop:i,defaultProp:o,onChange:s,caller:l}=t,a=i!==void 0,c=Um(s),h=[{...n,state:o}];r&&h.push(r);const[d,u]=v.useReducer((q,m)=>{if(m.type===L0)return{...q,state:m.state};const A=e(q,m);return a&&!Object.is(A.state,q.state)&&c(A.state),A},...h),p=d.state,g=v.useRef(p);v.useEffect(()=>{g.current!==p&&(g.current=p,a||c(p))},[p,g,a]);const y=v.useMemo(()=>i!==void 0?{...d,state:i}:d,[d,i]);return v.useEffect(()=>{a&&!Object.is(i,d.state)&&u({type:L0,state:i})},[i,d.state,a]),[y,u]}oc(Hz,"useControllableStateReducer");var Uz=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Yo=new WeakMap,Gc=new WeakMap,Qc={},ph=0,$m=function(e){return e&&(e.host||$m(e.parentNode))},Wz=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=$m(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},Kz=function(e,t,n,r){var i=Wz(t,Array.isArray(e)?e:[e]);Qc[n]||(Qc[n]=new WeakMap);var o=Qc[n],s=[],l=new Set,a=new Set(i),c=function(d){!d||l.has(d)||(l.add(d),c(d.parentNode))};i.forEach(c);var h=function(d){!d||a.has(d)||Array.prototype.forEach.call(d.children,function(u){if(l.has(u))h(u);else try{var p=u.getAttribute(r),g=p!==null&&p!=="false",y=(Yo.get(u)||0)+1,q=(o.get(u)||0)+1;Yo.set(u,y),o.set(u,q),s.push(u),y===1&&g&&Gc.set(u,!0),q===1&&u.setAttribute(n,"true"),g||u.setAttribute(r,"true")}catch(m){console.error("aria-hidden: cannot operate on ",u,m)}})};return h(t),l.clear(),ph++,function(){s.forEach(function(d){var u=Yo.get(d)-1,p=o.get(d)-1;Yo.set(d,u),o.set(d,p),u||(Gc.has(d)||d.removeAttribute(r),Gc.delete(d)),p||d.removeAttribute(n)}),ph--,ph||(Yo=new WeakMap,Yo=new WeakMap,Gc=new WeakMap,Qc={})}},Gm=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),i=Uz(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),Kz(r,i,n,"aria-hidden")):function(){return null}},or=function(){return or=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},or.apply(this,arguments)};function Qm(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function $z(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,o;r<i;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}var Cu="right-scroll-bar-position",Eu="width-before-scroll-bar",Gz="with-scroll-bars-hidden",Qz="--removed-body-scroll-bar-size";function mh(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Yz(e,t){var n=v.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var i=n.value;i!==r&&(n.value=r,n.callback(r,i))}}}})[0];return n.callback=t,n.facade}var Zz=typeof window<"u"?v.useLayoutEffect:v.useEffect,N0=new WeakMap;function Xz(e,t){var n=Yz(null,function(r){return e.forEach(function(i){return mh(i,r)})});return Zz(function(){var r=N0.get(n);if(r){var i=new Set(r),o=new Set(e),s=n.current;i.forEach(function(l){o.has(l)||mh(l,null)}),o.forEach(function(l){i.has(l)||mh(l,s)})}N0.set(n,e)},[e]),n}function Jz(e){return e}function eS(e,t){t===void 0&&(t=Jz);var n=[],r=!1,i={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(o){var s=t(o,r);return n.push(s),function(){n=n.filter(function(l){return l!==s})}},assignSyncMedium:function(o){for(r=!0;n.length;){var s=n;n=[],s.forEach(o)}n={push:function(l){return o(l)},filter:function(){return n}}},assignMedium:function(o){r=!0;var s=[];if(n.length){var l=n;n=[],l.forEach(o),s=n}var a=function(){var h=s;s=[],h.forEach(o)},c=function(){return Promise.resolve().then(a)};c(),n={push:function(h){s.push(h),c()},filter:function(h){return s=s.filter(h),n}}}};return i}function tS(e){e===void 0&&(e={});var t=eS(null);return t.options=or({async:!0,ssr:!1},e),t}var Ym=function(e){var t=e.sideCar,n=Qm(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return v.createElement(r,or({},n))};Ym.isSideCarExport=!0;function nS(e,t){return e.useMedium(t),Ym}var Zm=tS(),yh=function(){},gd=v.forwardRef(function(e,t){var n=v.useRef(null),r=v.useState({onScrollCapture:yh,onWheelCapture:yh,onTouchMoveCapture:yh}),i=r[0],o=r[1],s=e.forwardProps,l=e.children,a=e.className,c=e.removeScrollBar,h=e.enabled,d=e.shards,u=e.sideCar,p=e.noRelative,g=e.noIsolation,y=e.inert,q=e.allowPinchZoom,m=e.as,A=m===void 0?"div":m,w=e.gapMode,x=Qm(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),V=u,k=Xz([n,t]),b=or(or({},x),i);return v.createElement(v.Fragment,null,h&&v.createElement(V,{sideCar:Zm,removeScrollBar:c,shards:d,noRelative:p,noIsolation:g,inert:y,setCallbacks:o,allowPinchZoom:!!q,lockRef:n,gapMode:w}),s?v.cloneElement(v.Children.only(l),or(or({},b),{ref:k})):v.createElement(A,or({},b,{className:a,ref:k}),l))});gd.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};gd.classNames={fullWidth:Eu,zeroRight:Cu};var rS=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function iS(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=rS();return t&&e.setAttribute("nonce",t),e}function oS(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function sS(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var lS=function(){var e=0,t=null;return{add:function(n){e==0&&(t=iS())&&(oS(t,n),sS(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},aS=function(){var e=lS();return function(t,n){v.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Xm=function(){var e=aS(),t=function(n){var r=n.styles,i=n.dynamic;return e(r,i),null};return t},cS={left:0,top:0,right:0,gap:0},Ah=function(e){return parseInt(e||"",10)||0},uS=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],i=t[e==="padding"?"paddingRight":"marginRight"];return[Ah(n),Ah(r),Ah(i)]},dS=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return cS;var t=uS(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},hS=Xm(),Ns="data-scroll-locked",fS=function(e,t,n,r){var i=e.left,o=e.top,s=e.right,l=e.gap;return n===void 0&&(n="margin"),`
57
+ */var nd=v,CV=_8;function EV(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var RV=typeof Object.is=="function"?Object.is:EV,_V=CV.useSyncExternalStore,TV=nd.useRef,MV=nd.useEffect,PV=nd.useMemo,IV=nd.useDebugValue;C8.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var o=TV(null);if(o.current===null){var s={hasValue:!1,value:null};o.current=s}else s=o.current;o=PV(function(){function a(p){if(!c){if(c=!0,h=p,p=r(p),i!==void 0&&s.hasValue){var g=s.value;if(i(g,p))return d=g}return d=p}if(g=d,RV(h,p))return g;var y=r(p);return i!==void 0&&i(g,y)?(h=p,g):(h=p,d=y)}var c=!1,h,d,u=n===void 0?null:n;return[function(){return a(t())},u===null?void 0:function(){return a(u())}]},[t,n,r,i]);var l=_V(e,o[0],o[1]);return MV(function(){s.hasValue=!0,s.value=l},[l]),IV(l),l};S8.exports=C8;var LV=S8.exports;function NV(e,t){return e===t}function Pi(e,t,n=NV){const r=v.useCallback(s=>{if(!e)return()=>{};const{unsubscribe:l}=e.subscribe(s);return l},[e]),i=v.useCallback(()=>e==null?void 0:e.get(),[e]);return LV.useSyncExternalStoreWithSelector(r,i,i,t,n)}var m0={};function DV(e,t){const n=v.useRef();return r=>{const i=e!=null&&e.select?e.select(r):r;return(e==null?void 0:e.structuralSharing)??t.options.defaultStructuralSharing?n.current=ho(n.current,i):i}}function Bo(e){const t=pr(),n=v.useContext(e.from?fV:td),r=e.from??n,i=t.stores.getMatchStore(r),o=DV(e,t),s=Pi(i,l=>l?o(l):m0);if(s!==m0)return s;(e.shouldThrow??!0)&&K3()}function T8(e){return Bo({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function M8(e){const{select:t,...n}=e;return Bo({...n,select:r=>t?t(r.loaderDeps):r.loaderDeps})}function P8(e){return Bo({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{const n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function I8(e){return Bo({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function rc(e){const t=pr();return v.useCallback(n=>t.navigate({...n,from:n.from??(e==null?void 0:e.from)}),[e==null?void 0:e.from,t])}function L8(e){return Bo({...e,select:t=>e.select?e.select(t.context):t.context})}function lh(e){const t=v.useRef(e);return zi(t.current,e,{ignoreUndefined:!1})||(t.current=e),t.current}function OV(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function BV(e,t,n){if(e!=null&&e.external)return l1(e.href,n)?void 0:e.href;if(!GV(t)&&!(typeof t!="string"||t.indexOf(":")===-1))try{return new URL(t),l1(t,n)?void 0:t}catch{}}function FV(e,t,n,r,i,o){if(o)return!1;if(n!=null&&n.exact){if(!Vb(e.pathname,t.pathname,r))return!1}else{const s=c1(e.pathname,r),l=c1(t.pathname,r);if(!(s.startsWith(l)&&(s.length===l.length||s[l.length]==="/")))return!1}return((n==null?void 0:n.includeSearch)??!0)&&!zi(e.search,t.search,{partial:!(n!=null&&n.exact),ignoreUndefined:!(n!=null&&n.explicitUndefined)})?!1:n!=null&&n.includeHash?i&&e.hash===t.hash:!0}function HV(e,t){const n=pr(),r=sb(t),{activeProps:i,inactiveProps:o,activeOptions:s,to:l,preload:a,preloadDelay:c,preloadIntentProximity:h,hashScrollIntoView:d,replace:u,startTransition:p,resetScroll:g,viewTransition:y,children:q,target:m,disabled:A,style:w,className:x,onClick:V,onBlur:k,onFocus:b,onMouseEnter:j,onMouseLeave:z,onTouchStart:S,ignoreBlocker:R,params:T,search:E,hash:C,state:_,mask:L,reloadDocument:D,unsafeRelative:M,from:N,_fromLocation:O,...$}=e,P=V8(),H=lh(e.search),Z=lh(e.params),G=lh(s),Q=v.useMemo(()=>e,[n,e.from,e._fromLocation,e.hash,e.to,H,Z,e.state,e.mask,e.unsafeRelative]),le=v.useCallback(te=>{const pe=n.buildLocation({_fromLocation:te,...Q}),ke=$V(pe.maskedLocation?pe.maskedLocation.publicHref:pe.publicHref,pe.maskedLocation?pe.maskedLocation.external:pe.external,n.history,A),$t=BV(ke,l,n.protocolAllowlist);return[ke==null?void 0:ke.href,$t,FV(te,pe,G,n.basepath,P,$t!==void 0)]},[G,A,P,Q,n,l]),[F,ie,be]=Pi(n.stores.location,le,OV),Ae=be?Xs(i,{})??UV:ah,qe=be?ah:Xs(o,{})??ah,ze=[x,Ae.className,qe.className].filter(Boolean).join(" "),Ve=(w||Ae.style||qe.style)&&{...w,...Ae.style,...qe.style},ge=v.useRef(!1),ye=e.reloadDocument||ie||A?!1:a??n.options.defaultPreload,Ee=c??n.options.defaultPreloadDelay??0,ae=v.useCallback(()=>{n.preloadRoute(Q).catch(te=>{console.warn(te),console.warn(lV)})},[n,Q]),dt=v.useCallback(te=>{if(!te){ch(r);return}if(!(te.isIntersecting??ye==="intent")){te.isIntersecting===!1&&ch(r);return}if(!Ee){ae();return}oa.has(r)||oa.set(r,setTimeout(()=>{oa.delete(r),ae()},Ee))},[ae,r,ye,Ee]);ob(r,dt,ye!=="viewport"),v.useEffect(()=>{ge.current||ye==="render"&&(ae(),ge.current=!0)},[ae,ye]);const Lt=te=>{const pe=te.currentTarget.getAttribute("target"),ke=m!==void 0?m:pe;!A&&!(te.metaKey||te.altKey||te.ctrlKey||te.shiftKey)&&!te.defaultPrevented&&(!ke||ke==="_self")&&te.button===0&&(te.preventDefault(),n.navigate({...Q,replace:u,resetScroll:g,hashScrollIntoView:d,startTransition:p,viewTransition:y,ignoreBlocker:R}))};if(ie)return{...$,ref:r,href:ie,...q&&{children:q},...m&&{target:m},...A&&{disabled:A},...w&&{style:w},...x&&{className:x},...V&&{onClick:V},...k&&{onBlur:k},...b&&{onFocus:b},...j&&{onMouseEnter:j},...z&&{onMouseLeave:z},...S&&{onTouchStart:S}};const I=()=>{ye==="intent"&&ae()},X=()=>{ye==="intent"&&ch(r)};return{...$,...Ae,...qe,href:F,ref:r,onClick:Qo([V,Lt]),onBlur:Qo([k,X]),onFocus:Qo([b,dt]),onMouseEnter:Qo([j,dt]),onMouseLeave:Qo([z,X]),onTouchStart:Qo([S,I]),disabled:!!A,target:m,...Ve&&{style:Ve},...ze&&{className:ze},...A&&WV,...be&&KV}}var ah={},UV={className:"active"},WV={role:"link","aria-disabled":!0},KV={"data-status":"active","aria-current":"page"},oa=new WeakMap,ch=e=>{clearTimeout(oa.get(e)),oa.delete(e)},Qo=e=>t=>{for(const n of e)if(n){if(t.defaultPrevented)return;n(t)}};function $V(e,t,n,r){if(!r)return t?{href:e,external:!0}:{href:n.createHref(e)||"/",external:!1}}function GV(e){if(typeof e!="string")return!1;const t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var N8=v.forwardRef((e,t)=>{const{_asChild:n,...r}=e,{type:i,...o}=HV(r,t),s=typeof r.children=="function"?r.children({isActive:o["data-status"]==="active"}):r.children;if(!n){const{disabled:l,...a}=o;return v.createElement("a",a,s)}return v.createElement(n,o,s)}),QV=class extends b8{constructor(t){super(t),this.useMatch=n=>Bo({select:n==null?void 0:n.select,from:this.id,structuralSharing:n==null?void 0:n.structuralSharing}),this.useRouteContext=n=>L8({...n,from:this.id}),this.useSearch=n=>I8({select:n==null?void 0:n.select,structuralSharing:n==null?void 0:n.structuralSharing,from:this.id}),this.useParams=n=>P8({select:n==null?void 0:n.select,structuralSharing:n==null?void 0:n.structuralSharing,from:this.id}),this.useLoaderDeps=n=>M8({...n,from:this.id}),this.useLoaderData=n=>T8({...n,from:this.id}),this.useNavigate=()=>rc({from:this.fullPath}),this.Link=re.forwardRef((n,r)=>f.jsx(N8,{ref:r,from:this.fullPath,...n}))}};function YV(e){return new QV(e)}var ZV=class extends aV{constructor(e){super(e),this.useMatch=t=>Bo({select:t==null?void 0:t.select,from:this.id,structuralSharing:t==null?void 0:t.structuralSharing}),this.useRouteContext=t=>L8({...t,from:this.id}),this.useSearch=t=>I8({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useParams=t=>P8({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useLoaderDeps=t=>M8({...t,from:this.id}),this.useLoaderData=t=>T8({...t,from:this.id}),this.useNavigate=()=>rc({from:this.fullPath}),this.Link=re.forwardRef((t,n)=>f.jsx(N8,{ref:n,from:this.fullPath,...t}))}};function XV(e){return new ZV(e)}function D8(e){return t=>{const n=YV(t);return n.isRoot=!1,n}}function JV(e){const t=pr(),n=`not-found-${Pi(t.stores.location,r=>r.pathname)}-${Pi(t.stores.status,r=>r)}`;return f.jsx(J3,{getResetKey:()=>n,onCatch:(r,i)=>{var o;if(zo(r))(o=e.onCatch)==null||o.call(e,r,i);else throw r},errorComponent:({error:r})=>{var i;if(zo(r))return(i=e.fallback)==null?void 0:i.call(e,r);throw r},children:e.children})}function ek(){return f.jsx("p",{children:"Not Found"})}function rs(e){return f.jsx(f.Fragment,{children:e.children})}function O8(e,t,n){return t.options.notFoundComponent?f.jsx(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?f.jsx(e.options.defaultNotFoundComponent,{...n}):f.jsx(ek,{})}function rd(e,t){const n=(t==null?void 0:t.options.pendingComponent)??e.options.defaultPendingComponent;return n?f.jsx(n,{}):null}var tk=(e,t)=>e[0]===t[0]&&e[1]===t[1],B8=(e,t,n)=>!t.isRoot||t.options.shellComponent||t.options.wrapInSuspense||n===!1||n==="data-only"||!e.ssr,F8=v.memo(function({routeId:t}){const n=pr();return f.jsx(nk,{router:n,match:Pi(n.stores.getMatchStore(t),r=>r)})});function nk({router:e,match:t}){var d,u;const n=e.routesById[t.routeId],r=rd(e,n),i=n.options.errorComponent??e.options.defaultErrorComponent,o=n.options.onCatch??e.options.defaultOnCatch,s=n.isRoot?n.options.notFoundComponent??((d=e.options.notFoundRoute)==null?void 0:d.options.component):n.options.notFoundComponent,l=t.ssr===!1||t.ssr==="data-only",a=B8(e,n,t.ssr)&&(n.options.wrapInSuspense??r??(((u=n.options.errorComponent)==null?void 0:u.preload)||l))?v.Suspense:rs,c=i?J3:rs,h=s?JV:rs;return f.jsxs(n.isRoot?n.options.shellComponent??rs:rs,{children:[f.jsx(td.Provider,{value:t.routeId,children:f.jsx(a,{fallback:r,children:f.jsx(c,{getResetKey:()=>t,errorComponent:i,onCatch:(p,g)=>{if(zo(p))throw p.routeId??(p.routeId=t.routeId),p;o==null||o(p,g)},children:f.jsx(h,{fallback:p=>{if(p.routeId??(p.routeId=t.routeId),p.routeId!==t.routeId)throw p;return v.createElement(s,p)},children:l?f.jsx(dV,{fallback:r,children:f.jsx(y0,{match:t})}):f.jsx(y0,{match:t})})})})}),null]})}var y0=v.memo(function({match:t}){const n=pr(),r=t.routeId,i=n.routesById[r],o=v.useMemo(()=>{var a;const l=(a=i.options.remountDeps??n.options.defaultRemountDeps)==null?void 0:a({routeId:r,loaderDeps:t.loaderDeps,params:t._strictParams,search:t._strictSearch});return l?JSON.stringify(l):void 0},[r,t.loaderDeps,t._strictParams,t._strictSearch,i.options.remountDeps,n.options.defaultRemountDeps]),s=v.useMemo(()=>{const l=i.options.component??n.options.defaultComponent;return l?f.jsx(l,{},o):f.jsx(H8,{})},[o,i.options.component,n.options.defaultComponent]);if(t.status==="pending"){if(n.ssr&&!B8(n,i,t.ssr))return s;if(n._tx)throw n._tx[5];return rd(n,i)}if(t.status==="notFound")return O8(n,i,t.error);if(t.status==="error")throw t.error;return s}),H8=v.memo(function(){const t=pr(),n=v.useContext(td);let r,i,o;{const l=t.stores.getMatchStore(n);[r,i]=Pi(l,a=>[!!a._notFound,a.error],tk),o=Pi(t.stores.ids,a=>a[a.indexOf(n)+1])}if(r)return O8(t,t.routesById[n],i);if(!o)return null;const s=f.jsx(F8,{routeId:o});return n===Ms?f.jsx(v.Suspense,{fallback:rd(t),children:s}):s});function U8(e,t){const n=e[1];e.length=0,n==null||n(t)}function rk({t:e}){const t=pr(),n=t._rendered??(t._rendered=[]);return t.startTransition=(r,i)=>new Promise((o,s)=>{U8(n,!1),n.push(i,o),e(t),v.startTransition(()=>{try{r()}catch(l){n[1]===o&&(n.length=0),s(l)}})}),e8(()=>{const r=t.history.subscribe(t.load);t.updateLatestLocation();const i=t.latestLocation,o=t.buildLocation({to:i.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});if(Vr(i.publicHref)!==Vr(o.publicHref))return t.commitLocation({...o,replace:!0,ignoreBlocker:!0}),r;const s=t.stores.resolvedLocation.get();return(s==null?void 0:s.href)===i.href&&s.state.__TSR_key===i.state.__TSR_key?n.push(t.stores.matches.get(),l=>{l&&t.emit({type:"onRendered",...J1(s,s)})}):t._tx||t.load().catch(console.error),r},[t,t.history]),null}function ik(){const e=pr(),t=e.routesById[Ms],n=rd(e,t),r=e.ssr?rs:v.Suspense,i=f.jsxs(f.Fragment,{children:[f.jsx(rk,{t:v.useState()[1]}),f.jsx(r,{fallback:n,children:f.jsx(ok,{})})]});return e.options.InnerWrap?f.jsx(e.options.InnerWrap,{children:i}):i}function ok(){const e=pr(),t=e._rendered,n=Pi(e.stores.matches,s=>t[0]??s),r=n[0],i=r==null?void 0:r.routeId;e8(()=>{t[0]===n&&U8(t,!0)},[t,n]);const o=i?f.jsx(F8,{routeId:i}):null;return f.jsx(td.Provider,{value:i,children:e.options.disableGlobalCatchBoundary?o:f.jsx(J3,{getResetKey:()=>r,onCatch:void 0,children:o})})}var sk=e=>({createMutableStore:p0,createReadonlyStore:p0,batch:AV}),lk=e=>new ak(e),ak=class extends Qb{constructor(e){super(e,sk)}};function ck({router:e,children:t,...n}){n8(n)&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});const r=f.jsx(k8.Provider,{value:e,children:t});return e.options.Wrap?f.jsx(e.options.Wrap,{children:r}):r}function uk({router:e,...t}){return f.jsx(ck,{router:e,...t,children:f.jsx(ik,{})})}class mi extends Error{constructor(n,r,i){super(i);Re(this,"code");Re(this,"vars");this.name="KvError",this.code=n,this.vars=r}}function _l(){try{return globalThis.localStorage??null}catch{return null}}class Uc{constructor(t,n=`qtype.config.${t}`){this.scope=t,this.storageKey=n}get origin(){return`localStorage:${this.storageKey}`}async available(){return _l()!==null}async read(){const t=_l();if(!t)return{};const n=t.getItem(this.storageKey);if(!n)return{};let r;try{r=JSON.parse(n)}catch(i){throw new mi("err.kv.storage.parseFailed",{origin:this.origin,reason:i.message},`${this.origin}: JSON parse error — ${i.message}`)}if(r==null)return{};if(typeof r!="object"||Array.isArray(r))throw new mi("err.kv.storage.parseFailed",{origin:this.origin,reason:`root must be a JSON object, got ${Array.isArray(r)?"array":typeof r}`},`${this.origin}: root must be a JSON object`);return r}async write(t){const n=_l();if(!n)throw new mi("err.kv.storage.unavailable",{scope:this.scope,origin:this.origin},`${this.origin}: localStorage not available`);try{n.setItem(this.storageKey,JSON.stringify(t))}catch(r){throw new mi("err.kv.storage.writeFailed",{origin:this.origin,reason:r.message},`${this.origin}: write failed — ${r.message}`)}}readSync(){const t=_l();if(!t)return{};const n=t.getItem(this.storageKey);if(!n)return{};try{const r=JSON.parse(n);if(r&&typeof r=="object"&&!Array.isArray(r))return r}catch{}return{}}writeSync(t){const n=_l();if(n)try{n.setItem(this.storageKey,JSON.stringify(t))}catch{}}}function Tl(){try{return globalThis.sessionStorage??null}catch{return null}}class dk{constructor(t,n=`qtype.${t}`){this.scope=t,this.storageKey=n}get origin(){return`sessionStorage:${this.storageKey}`}async available(){return Tl()!==null}async read(){const t=Tl();if(!t)return{};const n=t.getItem(this.storageKey);if(!n)return{};let r;try{r=JSON.parse(n)}catch(i){throw new mi("err.kv.storage.parseFailed",{origin:this.origin,reason:i.message},`${this.origin}: JSON parse error — ${i.message}`)}if(r==null)return{};if(typeof r!="object"||Array.isArray(r))throw new mi("err.kv.storage.parseFailed",{origin:this.origin,reason:`root must be a JSON object, got ${Array.isArray(r)?"array":typeof r}`},`${this.origin}: root must be a JSON object`);return r}async write(t){const n=Tl();if(!n)throw new mi("err.kv.storage.unavailable",{scope:this.scope,origin:this.origin},`${this.origin}: sessionStorage not available`);try{n.setItem(this.storageKey,JSON.stringify(t))}catch(r){throw new mi("err.kv.storage.writeFailed",{origin:this.origin,reason:r.message},`${this.origin}: write failed — ${r.message}`)}}readSync(){const t=Tl();if(!t)return{};const n=t.getItem(this.storageKey);if(!n)return{};try{const r=JSON.parse(n);if(r&&typeof r=="object"&&!Array.isArray(r))return r}catch{}return{}}writeSync(t){const n=Tl();if(n)try{n.setItem(this.storageKey,JSON.stringify(t))}catch{}}}const is={settings:new Uc("user","qtype.settings"),progress:new Uc("user","qtype.progress"),session:new dk("session","qtype.session"),keybindings:new Uc("user","qtype.keybindings"),handOffsets:new Uc("user","qtype.handOffsets")},e4={settings:is.settings.readSync(),progress:is.progress.readSync(),session:is.session.readSync(),keybindings:is.keybindings.readSync(),handOffsets:is.handOffsets.readSync()},Y2=new Map;function W8(e,t){return`${e}::${t}`}function el(e,t,n){const r=e4[e];return t in r?r[t]:typeof n=="function"?n():n}function vo(e,t,n){const r=e4[e];r[t]=n,is[e].writeSync(r),K8(e,t)}function t4(e,t,n){const r=W8(e,t);let i=Y2.get(r);return i||(i=new Set,Y2.set(r,i)),i.add(n),()=>i.delete(n)}function K8(e,t){const n=Y2.get(W8(e,t));if(n)for(const r of n)r()}if(typeof window<"u"){const e={"qtype.settings":"settings","qtype.progress":"progress","qtype.keybindings":"keybindings","qtype.handOffsets":"handOffsets"};window.addEventListener("storage",t=>{if(!t.key||!(t.key in e))return;const n=e[t.key];let r={};try{r=t.newValue!==null?JSON.parse(t.newValue):{}}catch{return}const i=e4[n],o=new Set([...Object.keys(i),...Object.keys(r)]);for(const s of o)Object.is(i[s],r[s])||(i[s]=r[s],K8(n,s))})}const hk={"settings.title":"设置","settings.subtitle":"修改偏好后立即生效,无需保存。","settings.search.placeholder":"搜索设置...","settings.search.empty":"没有找到匹配「{query}」的设置","settings.search.resultCount":"{count} 项匹配","settings.sidebar.aria":"设置分类","settings.action.expand":"放大","settings.action.shrink":"缩小","settings.group.general":"常规","settings.group.typing":"打字","settings.group.keyboard":"键盘","settings.tab.appearance":"外观","settings.tab.keyboard":"键盘","settings.tab.typing":"打字","settings.tab.typing_rules":"打字规则","settings.tab.audio":"音频","settings.tab.interface":"界面","settings.tab.data":"数据","settings.tab.language":"语言","settings.tab.shortcuts":"快捷键","settings.audio.title":"音频","settings.audio.subtitle":"键盘音效、错误提示音、语音朗读。","settings.audio.keySound":"键盘声音","settings.audio.keySound.desc":"敲击键盘时的音效。","settings.audio.errorSound":"错误声音","settings.audio.errorSound.desc":"打错字符时的提示音。","settings.audio.autoSpeak":"自动朗读","settings.audio.autoSpeak.desc":"切换单词/句子卡片时自动播放一次目标音频。","settings.audio.autoSpeakRepeat":"自动朗读次数","settings.audio.autoSpeakRepeat.desc":"自动朗读时连续播放的次数。","settings.audio.ttsVolume":"朗读音量","settings.audio.ttsVolume.desc":"朗读播放的音量。","settings.audio.ttsRate":"朗读语速","settings.audio.ttsRate.desc":"浏览器朗读的语速倍率。","settings.audio.completeSound":"完成提示音","settings.audio.completeSound.desc":"打完一张卡片时播放的提示音。","settings.audio.ttsProvider":"语音来源","settings.audio.ttsProvider.desc":"选择朗读服务。自动会根据浏览器语言选(zh 用网易,其他用 Google);网络不通时切换到浏览器兜底。","settings.audio.ttsProvider.streamelements":"StreamElements","settings.audio.ttsProvider.auto":"自动","settings.audio.ttsProvider.browser":"浏览器","settings.audio.ttsProvider.youdao":"网易","settings.audio.ttsProvider.google":"Google","settings.interface.title":"界面","settings.interface.subtitle":"打字区周边的显示元素。","settings.interface.showPhonetic":"显示音标/拼音","settings.interface.showPhonetic.desc":"单词/句子卡片的音标或拼音注解行。可在 HUD 里临时切换。","settings.interface.showGloss":"显示释义","settings.interface.showGloss.desc":"单词/句子卡片下方的释义或翻译。","settings.interface.neighborPreview":"邻卡预览","settings.interface.neighborPreview.desc":"打字区两侧显示上一张/下一张卡片的预览。","settings.interface.autoHideCursor":"自动隐藏鼠标","settings.interface.autoHideCursor.desc":"鼠标在打字区静止时自动淡出。","settings.interface.showResultPopup":"完成结果弹窗","settings.interface.showResultPopup.desc":"打完一张卡片时弹出成绩摘要。","settings.interface.codeSyntaxHighlight":"代码语法高亮","settings.interface.codeSyntaxHighlight.desc":"为代码卡片启用 Shiki 语法高亮。关闭以节省 ~1MB 下载,仅显示对错颜色。","settings.interface.mathRenderer":"数学公式渲染","settings.interface.mathRenderer.desc":"在题干 / 文章 / 短章里把 $...$ 和 $$...$$ 用 KaTeX 渲染成公式(懒加载,约 280KB)。关闭则显示 LaTeX 源码。","settings.interface.afkSeconds":"AFK 阈值","settings.interface.afkSeconds.desc":"在此时间内没有任何键盘、鼠标移动、滚轮或触摸操作时,arena 自动暂停。鼠标只是悬停不动、切换标签或窗口失焦也会立即暂停。","settings.appearance.title":"外观","settings.appearance.subtitle":"控制界面的整体视觉——主题、字体、间距。","settings.appearance.theme":"主题","settings.appearance.theme.desc":"控制界面整体的明暗基调。","settings.appearance.theme.dark":"暗色","settings.appearance.theme.light":"亮色","settings.appearance.theme.auto":"跟随系统","settings.appearance.uiLang":"界面语言","settings.appearance.uiLang.desc":"覆盖界面语言(默认跟随素材语言)。","settings.appearance.uiLang.auto":"自动","settings.appearance.fontSize":"字体大小","settings.appearance.fontSize.desc":"打字区文字的显示大小。","settings.appearance.letterSpacing":"字符间距","settings.appearance.letterSpacing.desc":"字符之间的横向间距。","settings.appearance.spaceGlyph":"空格样式","settings.appearance.spaceGlyph.desc":"空格如何可视化(横杠/中点/无)。","settings.appearance.breakWord":"换行断词","settings.appearance.breakWord.desc":"行末长单词是否拆开换行。","settings.keyboard.title":"键盘","settings.keyboard.subtitle":"打字页底部的键盘图与指法提示。","settings.keyboard.showKeyboard":"显示键盘图","settings.keyboard.showKeyboard.desc":"打字页底部显示 QWERTY 键盘,当前应按的键高亮。","settings.keyboard.showHands":"显示手掌","settings.keyboard.showHands.desc":"键盘图上叠加手掌图示,提示指法。依赖键盘图打开。","settings.keyboard.size":"键盘大小","settings.keyboard.size.desc":"键盘图的尺寸档位。","settings.keyboard.calibrate":"手位校准","settings.keyboard.calibrate.desc":"逐个手位微调手掌在键盘图上的位置,校准结果可导出为新默认值。","settings.keyboard.calibrate.open":"打开校准","settings.keyboard.keySound":"键盘声音","settings.keyboard.keySound.desc":"敲击键盘时的音效。","settings.keyboard.errorSound":"错误声音","settings.keyboard.errorSound.desc":"打错字符时的提示音。","settings.typing.title":"打字","settings.typing.subtitle":"影响打字过程的行为与判定。","settings.typing.hint":"答案提示","settings.typing.hint.desc":"关:答案区空白,凭记忆打;开:答案骨架显示,覆盖打字。","settings.typing.speedUnit":"速度单位","settings.typing.speedUnit.desc":"HUD 上显示的速度单位。WPM = 每分钟词数;CPM = 每分钟字符数,中文常用。","settings.typing.targetWpm":"目标速度","settings.typing.targetWpm.desc":"在文本上显示一个影子光标, 按目标 WPM 移动。0 = 关闭。","settings.typing.maxWrongRate":"最大错字率","settings.typing.maxWrongRate.desc":"错字率超过阈值时自动退格,防止硬闯。","settings.typing.tabBehavior":"Tab 键行为","settings.typing.tabBehavior.desc":"重置: 按 Tab 重打当前卡片;输入: Tab 展开成空格打入(代码用)。","settings.typing.tabBehavior.reset":"重置","settings.typing.tabBehavior.input":"输入","settings.typing.tabWidth":"Tab 宽度","settings.typing.tabWidth.desc":"输入模式下,一次 Tab 展开成几个空格。","settings.typing.tabWidth.2":"2 空格","settings.typing.tabWidth.4":"4 空格","settings.typing.completion":"完成条件","settings.typing.completion.desc":"打到末尾即完成 / 需要一遍无错 / 允许 ≤5% 错。","settings.typing.completion.through":"打完","settings.typing.completion.lenient":"容错","settings.typing.completion.perfect":"无错","settings.typing.advance":"通过后","settings.typing.advance.desc":"通过完成条件后自动进入下一张,或停在当前卡等你确认。","settings.typing.advance.auto":"自动","settings.typing.advance.manual":"确认","settings.typing.confirmKey":"确认键","settings.typing.confirmKey.desc":"确认模式下按哪个键进入下一张,键盘上会高亮提示。","settings.typing.confirmKey.enter":"回车","settings.typing.confirmKey.space":"空格","typing.advance.hint.enter":"按回车进入下一张","typing.advance.hint.space":"按空格进入下一张","settings.typing.retry":"失败重来","settings.typing.retry.desc":"未通过完成条件时,是否自动清空重试。","settings.typing.retry.off":"关","settings.typing.retry.auto":"打完检查","settings.typing.retry.immediate":"一错就重","settings.typing.maxRetries":"最多重试","settings.typing.maxRetries.desc":"本卡累计重试超过后自动跳过。","settings.typing.maxRetries.unlimited":"∞","settings.typing.autoHideCursor":"自动隐藏鼠标","settings.typing.autoHideCursor.desc":"打字时鼠标停留 3 秒自动隐藏,移动鼠标即恢复。","settings.typing.neighborPreview":"相邻卡片预览","settings.typing.neighborPreview.desc":"打字区左右两侧显示上一张 / 下一张卡片的标题,一眼看到接下来是什么。","settings.typing.ignoreCase":"忽略大小写","settings.typing.ignoreCase.desc":"开启后,大小写不同也视为正确输入。","settings.typing.ignorePunctuation":"忽略标点","settings.typing.ignorePunctuation.desc":"开启后遇到标点自动跳过,只需要打入字母/数字。","settings.typing.allowBackspace":"允许退格","settings.typing.allowBackspace.desc":"关闭后 Backspace 无效,输错只能重打。","settings.typing.minAccuracy":"最低准确率","settings.typing.minAccuracy.desc":"结算准确率低于该阈值时高亮提示。0 = 关闭。","hud.accuracy.low":"准确率低于 {min}%","hud.pinyinErrors":"拼音按键错误次数(不影响准确率)","typing.result.summary":"完成 · {speed} {unit} · 准确率 {accuracy}% · {seconds}s","settings.data.title":"数据","settings.data.subtitle":"导入 / 导出与全局重置。所有数据仅存在本地浏览器。","settings.data.completed":"已完成的资料","settings.data.completed.desc":"{count} 份资料已标记为完成。","settings.data.resetAll":"重置全部","settings.data.export":"导出进度","settings.data.export.desc":"将所有完成状态和卡片打字进度导出为 JSON 文件。","settings.data.export.action":"导出","settings.data.import":"导入进度","settings.data.import.desc":"从 JSON 文件恢复完成状态和卡片打字进度。","settings.data.import.action":"选择文件…","settings.language.title":"语言","settings.language.subtitle":"界面语言。","settings.language.label":"界面语言","settings.language.desc":"切换 UI 显示语言。","common.on":"开","common.off":"关","common.close":"关闭","common.cancel":"取消","common.confirm":"确定","common.save":"保存","common.reset":"重置","size.s":"小","size.m":"中","size.l":"大","spacing.tight":"紧","spacing.normal":"标准","spacing.wide":"宽","spaceGlyph.none":"无","confirm.resetDone":"确定要重置所有完成状态吗?此操作不可撤销。","confirm.overwriteImport":"导入将覆盖当前进度,继续?","confirm.resetAllOffsets":"清除所有本地校准, 回到打包默认?","toast.importOk":"导入完成","toast.importFail":"导入失败: {msg}","quickinput.placeholder.cmd":"输入命令名称…","quickinput.placeholder.help":"帮助","quickinput.placeholder.theme":"筛选主题…","quickinput.placeholder.cardJump":"输入 1 - {total} 跳到指定卡片…","quickinput.placeholder.noMultiCards":"当前资料没有多张卡片","quickinput.placeholder.default":"搜索资料、输入 > 执行命令、? 查看帮助","quickinput.cmd.exec":"执行命令…","quickinput.cmd.help":"帮助","quickinput.cmd.searchMaterials":"搜索资料","quickinput.cmd.searchMaterials.detail":"直接输入关键词","quickinput.cmd.searchMaterials.desc":"无前缀","quickinput.cmd.palette":"命令面板","quickinput.cmd.palette.detail":"执行主题、视图、进度等操作","quickinput.cmd.theme":"切换主题(当前:{current})","quickinput.cmd.theme.detail":"从命令面板或底栏","toolbar.selection.count.pre":"已选 ","toolbar.selection.count.mid":" · 共 {total}","toolbar.selection.selectAll":"全选","toolbar.selection.clearDone":"清除打过状态","toolbar.selection.cancel":"取消","toolbar.tags.expand":"展开全部标签","toolbar.tags.collapse":"折叠标签","toolbar.tags.clear":"清空","toolbar.tags.overflow.selected":"折叠区还有 {count} 个选中","toolbar.tags.clearN":"清空 {count} 个筛选","toolbar.type.placeholder":"类型","toolbar.tag.placeholder":"标签","toolbar.status.placeholder":"状态","toolbar.status.done":"已完成","toolbar.status.pending":"未完成","toolbar.search.placeholder":"搜索…","toolbar.search.empty":"无匹配","combobox.footer.selected":"已选 {count} 项","combobox.footer.clear":"清空","renderer.speak":"朗读","toolbar.selection.enter":"选择","toolbar.selection.enterAria":"进入选择模式","toolbar.view.grid":"卡片视图","toolbar.view.list":"列表视图","header.home":"回到首页","footer.theme.toDark":"切换到暗色","footer.theme.toLight":"切换到亮色","footer.settings":"设置","footer.settings.open":"打开设置","cmd.materials.search":"搜索资料","cmd.theme.pick":"选择主题(当前:{current})","cmd.theme.dark":"暗色","cmd.theme.light":"亮色","cmd.view.grid":"切换到卡片视图","cmd.view.list":"切换到列表视图","cmd.material.reload":"重新加载资料","cmd.material.random":"打开随机资料","cmd.progress.reset":"重置所有打过状态","cmd.progress.count":"已有 {count} 份","cmd.filter.reset":"清空筛选","cmd.hint.toggle":"切换提示模式(当前:{current})","cmd.hint.ghost":"跟打","cmd.hint.blind":"盲打","cmd.settings.open":"打开设置","cmd.card.jump":"跳到指定卡片(共 {total} 张)","cmd.card.jump.detail":"输入卡号","home.loading":"加载中…","home.empty":"资料为空","home.noMatch":"无匹配的资料","home.stats":"{materials} 份资料 · {cards} 张卡片","home.dir.count":"{count} 份资料","home.dir.progress":"{done} / {total} 完成","home.breadcrumb.root":"全部","typing.loadFailed":"资料加载失败 · {msg}","typing.backHome":"回首页","typing.done":"已完成","typing.deckSize":"{title} · {total} 张卡片","typing.card.unsupported":"该卡片包含无法练习的字符:","hud.pause.start":"开始","hud.pause.pause":"暂停","hud.hint.on":"提示: 开","hud.hint.off":"提示: 关","hud.keyboard.on":"键盘: 开","hud.keyboard.off":"键盘: 关","hud.hands.on":"手掌: 开","hud.hands.off":"手掌: 关","hud.back":"返回上一级","hud.more":"更多","hud.more.showPhonetic":"显示音标/拼音","hud.more.showGloss":"显示释义","hud.more.showHands":"显示手掌","hud.more.autoSpeak":"自动朗读","cardnav.aria":"卡片导航","cardnav.prev":"上一张","cardnav.prev.title":"上一张 (Alt+←)","cardnav.next":"下一张","cardnav.next.title":"下一张 (Alt+→)","cardnav.jumpToDone":"跳到第 {n} 张(已完成)","cardnav.jumpTo":"跳到第 {n} 张","cardnav.itemDone":"第 {n} 张 · 已完成","cardnav.item":"第 {n} 张","cardnav.input.aria":"跳到第 N 张","cardnav.input.hint":"点击跳转到指定卡片","materialCard.select":"选择","materialCard.unselect":"取消选择","materialCard.more":"更多","materialCard.clearDone":"清除状态","materialCard.cardCount":"{count} 张卡片","materialCard.done":"已完成","materialCard.count":"{count} 张","materialCard.peak":"最快 {value} {unit}","wpmHistory.peak":"最快","wpmHistory.avg":"平均","wpmHistory.last":"最近","wpmHistory.count":"样本","arena.mask.hint.pre":"点击或按","arena.mask.hint.post":"开始","arena.mask.paused":"已暂停","arena.mask.press":"按","arena.mask.toStart":"开始","arena.mask.resumeLabel":"点击或按暂停键继续","arena.violation.wrongRate":"错字率超过 {limit}%,请退格","arena.violation.leftBoundary":"不能通过左键移动到上一段落,只可用删除键","arena.violation.moveLimit":"仅可在末尾两位移动光标","arena.violation.bulkInput":"发现一次性输入大量文字","calibrator.title":"手位校准","calibrator.hint":"拖拽移动 · 点击换手势 · 方向键微调 (Shift ×10) · [ / ] 上/下一个","calibrator.prev":"◀ 上一个","calibrator.next":"下一个 ▶","calibrator.leftHand":"左手","calibrator.rightHand":"右手","calibrator.unsaved":"未保存","calibrator.customized":"已校准","calibrator.save":"保存","calibrator.cancel":"取消","calibrator.resetThis":"重置此项","calibrator.resetAll":"全部重置","calibrator.export":"导出 keyBindings.json","calibrator.picker.title":"选择手势 ({side})","password.checking":"检查加密状态…","password.desc":"该站点已加密,请输入访问密码","password.error":"密码错误","password.busy":"验证中…","password.unlock":"解锁","password.cooldown":"太多次尝试,请等待 {s} 秒后再试","password.rememberHint":"解锁后本次会话内不会再次提示","cmd.card.reset":"重置当前卡片","cmd.card.next":"下一张卡片","cmd.card.prev":"上一张卡片","cmd.theme.toMocha":"切换到 Mocha(暗色)","cmd.theme.toLatte":"切换到 Latte(亮色)","cmd.theme.toggle":"切换主题","err.badData":"数据格式不正确","err.noFile":"未选择文件","err.readFail":"读取失败","quickinput.theme.dark":"暗色 · ☾","quickinput.theme.light":"亮色 · ☀","quickinput.card.none":"当前资料没有多张卡片","quickinput.card.none.detail":"此模式在多卡资料中启用","quickinput.card.hint":"输入 1 - {total} 跳到指定卡片","quickinput.card.hint.detail":"按 Enter 跳转","quickinput.card.invalid":'"{input}" 不是有效卡号',"quickinput.card.range":"请输入 1 - {total}","quickinput.card.oor":"第 {n} 张超出范围","quickinput.card.jump":"跳到第 {n} 张","quickinput.card.current":"当前","quickinput.card.untitled":"(无标题)","quickinput.card.nomatch":'没有匹配 "{input}" 的卡片',"settings.shortcuts.title":"快捷键","settings.shortcuts.subtitle":"自定义快捷键。点击键位录制新的组合,Esc 取消。","settings.shortcuts.search":"搜索动作…","settings.shortcuts.reset":"重置","settings.shortcuts.resetAll":"全部重置","settings.shortcuts.disabled":"未绑定","settings.shortcuts.recording":"按下新的组合…","settings.shortcuts.conflict":"与 {name} 冲突","settings.shortcuts.noModifier":"无修饰键 · 打字时可能误触发","settings.shortcuts.group.global":"全局","settings.shortcuts.group.hud":"打字页 HUD","settings.shortcuts.group.card":"卡片导航","settings.shortcuts.confirmResetAll":"重置所有快捷键为默认?","action.palette.open":"打开搜索 / 命令面板","action.palette.commands":"打开命令面板","action.palette.search":"打开搜索","action.hud.pause":"开始 / 暂停","action.hud.hint":"切换答案提示","action.hud.keyboard":"切换键盘图","action.hud.hands":"切换手掌","action.hud.back":"返回上一级","action.card.prev":"上一张卡片","action.card.next":"下一张卡片","cmd.card.jump.registry":"跳到指定卡片","cmd.theme.pick.registry":"选择主题","cmd.hint.toggle.registry":"切换答案提示","toast.card.atFirst":"已经是第一张了","toast.card.atLast":"已经是最后一张了"},fk={"settings.title":"Settings","settings.subtitle":"Changes take effect immediately, no save needed.","settings.search.placeholder":"Search settings…","settings.search.empty":"No settings match “{query}”","settings.search.resultCount":"{count} matches","settings.sidebar.aria":"Settings categories","settings.action.expand":"Expand","settings.action.shrink":"Shrink","settings.group.general":"General","settings.group.typing":"Typing","settings.group.keyboard":"Keyboard","settings.tab.typing_rules":"Typing rules","settings.tab.audio":"Audio","settings.tab.interface":"Interface","settings.audio.title":"Audio","settings.audio.subtitle":"Keystroke sounds, error alert, spoken playback.","settings.audio.keySound":"Keystroke sound","settings.audio.keySound.desc":"Click sound played on each keystroke.","settings.audio.errorSound":"Error sound","settings.audio.errorSound.desc":"Alert played on a wrong character.","settings.audio.autoSpeak":"Auto-speak","settings.audio.autoSpeak.desc":"Play the target aloud once when a word/sentence card appears.","settings.audio.autoSpeakRepeat":"Auto-speak repeat","settings.audio.autoSpeakRepeat.desc":"How many times to repeat when auto-speaking.","settings.audio.ttsVolume":"TTS volume","settings.audio.ttsVolume.desc":"Playback volume for speech.","settings.audio.ttsRate":"TTS rate","settings.audio.ttsRate.desc":"Speech rate multiplier (browser voice).","settings.audio.completeSound":"Complete sound","settings.audio.completeSound.desc":"Play a success chime when a card is completed.","settings.audio.ttsProvider":"TTS provider","settings.audio.ttsProvider.desc":"Auto picks by your browser language (zh → Youdao, otherwise Google). Force a specific one manually if that guess isn't right for your network.","settings.audio.ttsProvider.streamelements":"StreamElements","settings.audio.ttsProvider.auto":"Auto","settings.audio.ttsProvider.browser":"Browser","settings.audio.ttsProvider.youdao":"Youdao","settings.audio.ttsProvider.google":"Google","settings.interface.title":"Interface","settings.interface.subtitle":"Visual elements around the typing arena.","settings.interface.showPhonetic":"Show phonetic / pinyin","settings.interface.showPhonetic.desc":"Annotation line on word/sentence cards. Also toggleable in the HUD.","settings.interface.showGloss":"Show gloss / translation","settings.interface.showGloss.desc":"The gloss line under word/sentence cards.","settings.interface.neighborPreview":"Neighbor preview","settings.interface.neighborPreview.desc":"Show previous / next card previews beside the arena.","settings.interface.autoHideCursor":"Auto-hide cursor","settings.interface.autoHideCursor.desc":"Fade the mouse pointer when idle over the typing arena.","settings.interface.showResultPopup":"Result popup","settings.interface.showResultPopup.desc":"Show a summary popup after completing a card.","settings.interface.codeSyntaxHighlight":"Code syntax highlight","settings.interface.codeSyntaxHighlight.desc":"Enable Shiki syntax highlighting on code cards. Off to skip the ~1MB download and show hit/miss colors only.","settings.interface.mathRenderer":"Math rendering","settings.interface.mathRenderer.desc":"Render $...$ and $$...$$ in prompts / articles / snippets as math via KaTeX (lazy-loaded, ~280KB). Off to show LaTeX source as-is.","settings.interface.afkSeconds":"AFK threshold","settings.interface.afkSeconds.desc":"Auto-pause when there is no keyboard, mouse-move, wheel, or touch activity for this long. Mouse just hovering without moving, tab hidden, or window blur pauses immediately.","settings.tab.appearance":"Appearance","settings.tab.keyboard":"Keyboard","settings.tab.typing":"Typing","settings.tab.data":"Data","settings.tab.language":"Language","settings.appearance.title":"Appearance","settings.appearance.subtitle":"Overall UI look — theme, font, spacing.","settings.appearance.theme":"Theme","settings.appearance.theme.desc":"Overall light / dark tone.","settings.appearance.theme.dark":"Dark","settings.appearance.theme.light":"Light","settings.appearance.theme.auto":"Auto","settings.appearance.uiLang":"UI language","settings.appearance.uiLang.desc":"Override the UI language (defaults to material language).","settings.appearance.uiLang.auto":"Auto","settings.appearance.fontSize":"Font size","settings.appearance.fontSize.desc":"Size of the typing area text.","settings.appearance.letterSpacing":"Letter spacing","settings.appearance.letterSpacing.desc":"Horizontal spacing between characters.","settings.appearance.spaceGlyph":"Space glyph","settings.appearance.spaceGlyph.desc":"How the literal space character is drawn.","settings.appearance.breakWord":"Break words","settings.appearance.breakWord.desc":"Split long words at line-end instead of overflowing.","settings.keyboard.title":"Keyboard","settings.keyboard.subtitle":"Keyboard image and finger hints under the typing area.","settings.keyboard.showKeyboard":"Show keyboard","settings.keyboard.showKeyboard.desc":"Show the QWERTY keyboard beneath the typing area with the next key highlighted.","settings.keyboard.showHands":"Show hands","settings.keyboard.showHands.desc":"Overlay hand pose diagrams on the keyboard. Requires the keyboard to be shown.","settings.keyboard.size":"Keyboard size","settings.keyboard.size.desc":"Keyboard image size tier.","settings.keyboard.calibrate":"Calibrate hands","settings.keyboard.calibrate.desc":"Fine-tune each hand pose's position on the keyboard. Export the result as the new default.","settings.keyboard.calibrate.open":"Open calibrator","settings.keyboard.keySound":"Key sound","settings.keyboard.keySound.desc":"Sound when a key is pressed.","settings.keyboard.errorSound":"Error sound","settings.keyboard.errorSound.desc":"Sound when a wrong character is typed.","settings.typing.title":"Typing","settings.typing.subtitle":"Typing behaviour and completion rules.","settings.typing.hint":"Answer hint","settings.typing.hint.desc":"Off: blank target, type from memory. On: ghost target, type over it.","settings.typing.speedUnit":"Speed unit","settings.typing.speedUnit.desc":"Unit shown in the HUD. WPM = words per minute; CPM = characters per minute, common for CJK.","settings.typing.targetWpm":"Target speed","settings.typing.targetWpm.desc":"Show a shadow cursor advancing at the target WPM. 0 disables it.","settings.typing.maxWrongRate":"Max wrong rate","settings.typing.maxWrongRate.desc":"Auto-backspace once the wrong-char rate exceeds this threshold.","settings.typing.tabBehavior":"Tab behaviour","settings.typing.tabBehavior.desc":"Reset: restart the current card. Input: Tab expands to spaces (for code).","settings.typing.tabBehavior.reset":"Reset","settings.typing.tabBehavior.input":"Input","settings.typing.tabWidth":"Tab width","settings.typing.tabWidth.desc":"How many spaces one Tab expands into in input mode.","settings.typing.tabWidth.2":"2 spaces","settings.typing.tabWidth.4":"4 spaces","settings.typing.completion":"Completion","settings.typing.completion.desc":"Through / lenient (≤5% wrong) / perfect (zero wrong).","settings.typing.completion.through":"Through","settings.typing.completion.lenient":"Lenient","settings.typing.completion.perfect":"Perfect","settings.typing.advance":"After pass","settings.typing.advance.desc":"Auto-advance to the next card, or stay and wait for you to confirm.","settings.typing.advance.auto":"Auto","settings.typing.advance.manual":"Confirm","settings.typing.confirmKey":"Confirm key","settings.typing.confirmKey.desc":"Which key advances in Confirm mode. Also highlighted on the on-screen keyboard.","settings.typing.confirmKey.enter":"Enter","settings.typing.confirmKey.space":"Space","typing.advance.hint.enter":"Press Enter to continue","typing.advance.hint.space":"Press Space to continue","settings.typing.retry":"Retry on fail","settings.typing.retry.desc":"Auto-reset the arena when the pass doesn't meet completion.","settings.typing.retry.off":"Off","settings.typing.retry.auto":"After pass","settings.typing.retry.immediate":"On error","settings.typing.maxRetries":"Max retries","settings.typing.maxRetries.desc":"Skip the card once retries reach this many.","settings.typing.maxRetries.unlimited":"∞","settings.typing.autoHideCursor":"Auto-hide cursor","settings.typing.autoHideCursor.desc":"Hide the mouse after 3s of idle; any movement restores it.","settings.typing.neighborPreview":"Neighbor preview","settings.typing.neighborPreview.desc":"Show the previous / next card's title beside the arena so you can see what's coming.","settings.typing.ignoreCase":"Ignore case","settings.typing.ignoreCase.desc":"Treat differing case as a correct keystroke.","settings.typing.ignorePunctuation":"Ignore punctuation","settings.typing.ignorePunctuation.desc":"Auto-skip punctuation — only type letters and digits.","settings.typing.allowBackspace":"Allow backspace","settings.typing.allowBackspace.desc":"When off, Backspace does nothing — type through your mistakes.","settings.typing.minAccuracy":"Minimum accuracy","settings.typing.minAccuracy.desc":"Highlight the accuracy stat if it drops below this. 0 disables.","hud.accuracy.low":"Accuracy below {min}%","hud.pinyinErrors":"Wrong pinyin keystrokes (doesn't affect accuracy)","typing.result.summary":"Done · {speed} {unit} · {accuracy}% · {seconds}s","settings.data.title":"Data","settings.data.subtitle":"Import / export and global reset. All data stays in this browser.","settings.data.completed":"Completed materials","settings.data.completed.desc":"{count} materials marked as done.","settings.data.resetAll":"Reset all","settings.data.export":"Export progress","settings.data.export.desc":"Export completion state and card progress as JSON.","settings.data.export.action":"Export","settings.data.import":"Import progress","settings.data.import.desc":"Restore completion state and card progress from JSON.","settings.data.import.action":"Choose file…","settings.language.title":"Language","settings.language.subtitle":"UI language.","settings.language.label":"UI language","settings.language.desc":"Switch the UI display language.","common.on":"On","common.off":"Off","common.close":"Close","common.cancel":"Cancel","common.confirm":"OK","common.save":"Save","common.reset":"Reset","size.s":"S","size.m":"M","size.l":"L","spacing.tight":"Tight","spacing.normal":"Normal","spacing.wide":"Wide","spaceGlyph.none":"None","confirm.resetDone":"Reset all completion state? This cannot be undone.","confirm.overwriteImport":"This will overwrite current progress. Continue?","confirm.resetAllOffsets":"Clear all local calibration and restore shipped defaults?","toast.importOk":"Import complete","toast.importFail":"Import failed: {msg}","quickinput.placeholder.cmd":"Type a command…","quickinput.placeholder.help":"Help","quickinput.placeholder.theme":"Filter themes…","quickinput.placeholder.cardJump":"Enter 1 - {total} to jump to a card…","quickinput.placeholder.noMultiCards":"This deck only has one card","quickinput.placeholder.default":"Search materials, > for commands, ? for help","quickinput.cmd.exec":"Run a command…","quickinput.cmd.help":"Help","quickinput.cmd.searchMaterials":"Search materials","quickinput.cmd.searchMaterials.detail":"Type keywords directly","quickinput.cmd.searchMaterials.desc":"No prefix","quickinput.cmd.palette":"Command palette","quickinput.cmd.palette.detail":"Theme, view, progress, and more","quickinput.cmd.theme":"Switch theme (current: {current})","quickinput.cmd.theme.detail":"From palette or footer","toolbar.selection.count.pre":"","toolbar.selection.count.mid":" selected · {total} total","toolbar.selection.selectAll":"Select all","toolbar.selection.clearDone":"Clear done","toolbar.selection.cancel":"Cancel","toolbar.tags.expand":"Show all tags","toolbar.tags.collapse":"Collapse tags","toolbar.tags.clear":"Clear","toolbar.tags.overflow.selected":"{count} selected in overflow","toolbar.tags.clearN":"Clear {count} filter(s)","toolbar.type.placeholder":"Type","toolbar.tag.placeholder":"Tag","toolbar.status.placeholder":"Status","toolbar.status.done":"Done","toolbar.status.pending":"Pending","toolbar.search.placeholder":"Search…","toolbar.search.empty":"No matches","combobox.footer.selected":"{count} selected","combobox.footer.clear":"Clear","renderer.speak":"Speak","toolbar.selection.enter":"Select","toolbar.selection.enterAria":"Enter selection mode","toolbar.view.grid":"Grid view","toolbar.view.list":"List view","header.home":"Back to home","footer.theme.toDark":"Switch to dark","footer.theme.toLight":"Switch to light","footer.settings":"Settings","footer.settings.open":"Open settings","cmd.materials.search":"Search materials","cmd.theme.pick":"Pick theme (current: {current})","cmd.theme.dark":"Dark","cmd.theme.light":"Light","cmd.view.grid":"Switch to grid view","cmd.view.list":"Switch to list view","cmd.material.reload":"Reload materials","cmd.material.random":"Open random material","cmd.progress.reset":"Reset all typed progress","cmd.progress.count":"{count} completed","cmd.filter.reset":"Clear filter","cmd.hint.toggle":"Toggle hint mode (current: {current})","cmd.hint.ghost":"Ghost","cmd.hint.blind":"Blind","cmd.settings.open":"Open settings","cmd.card.jump":"Jump to card ({total} total)","cmd.card.jump.detail":"Enter a card number","home.loading":"Loading…","home.empty":"No materials","home.dir.count":"{count} materials","home.dir.progress":"{done} / {total} done","home.breadcrumb.root":"All","home.noMatch":"No matching materials","home.stats":"{materials} materials · {cards} cards","typing.loadFailed":"Failed to load · {msg}","typing.backHome":"Back to home","typing.done":"Done","typing.deckSize":"{title} · {total} cards","typing.card.unsupported":"This card contains unsupported characters:","hud.pause.start":"Start","hud.pause.pause":"Pause","hud.hint.on":"Hint: on","hud.hint.off":"Hint: off","hud.keyboard.on":"Keyboard: on","hud.keyboard.off":"Keyboard: off","hud.hands.on":"Hands: on","hud.hands.off":"Hands: off","hud.back":"Back","hud.more":"More","hud.more.showPhonetic":"Show phonetic / pinyin","hud.more.showGloss":"Show gloss / translation","hud.more.showHands":"Show hands","hud.more.autoSpeak":"Auto-speak","cardnav.aria":"Card navigation","cardnav.prev":"Previous","cardnav.prev.title":"Previous (Alt+←)","cardnav.next":"Next","cardnav.next.title":"Next (Alt+→)","cardnav.jumpToDone":"Jump to card {n} (done)","cardnav.jumpTo":"Jump to card {n}","cardnav.itemDone":"Card {n} · done","cardnav.item":"Card {n}","cardnav.input.aria":"Jump to card N","cardnav.input.hint":"Click to jump to a card","materialCard.select":"Select","materialCard.unselect":"Unselect","materialCard.more":"More","materialCard.clearDone":"Clear done","materialCard.cardCount":"{count} cards","materialCard.done":"Done","materialCard.count":"{count}","materialCard.peak":"Best {value} {unit}","wpmHistory.peak":"Peak","wpmHistory.avg":"Avg","wpmHistory.last":"Last","wpmHistory.count":"Samples","arena.mask.hint.pre":"Click or press","arena.mask.hint.post":"to start","arena.mask.paused":"Paused","arena.mask.press":"Press","arena.mask.toStart":"to start","arena.mask.resumeLabel":"Click or press pause key to resume","arena.violation.wrongRate":"Wrong rate exceeds {limit}%, press backspace","arena.violation.leftBoundary":"Can't move left across paragraphs; use backspace","arena.violation.moveLimit":"Can only move within the last two positions","arena.violation.bulkInput":"Bulk input detected","calibrator.title":"Hand calibration","calibrator.hint":"Drag to move · click to change pose · arrow keys nudge (Shift ×10) · [ / ] prev/next","calibrator.prev":"◀ Previous","calibrator.next":"Next ▶","calibrator.leftHand":"Left","calibrator.rightHand":"Right","calibrator.unsaved":"Unsaved","calibrator.customized":"Calibrated","calibrator.save":"Save","calibrator.cancel":"Cancel","calibrator.resetThis":"Reset this","calibrator.resetAll":"Reset all","calibrator.export":"Export keyBindings.json","calibrator.picker.title":"Pick a pose ({side})","password.checking":"Checking encryption…","password.desc":"This site is encrypted. Enter the access password.","password.error":"Wrong password","password.busy":"Verifying…","password.unlock":"Unlock","password.cooldown":"Too many attempts. Try again in {s}s.","password.rememberHint":"You won't be asked again this session.","cmd.card.reset":"Reset current card","cmd.card.next":"Next card","cmd.card.prev":"Previous card","cmd.theme.toMocha":"Switch to Mocha (dark)","cmd.theme.toLatte":"Switch to Latte (light)","cmd.theme.toggle":"Toggle theme","err.badData":"Bad data format","err.noFile":"No file selected","err.readFail":"Read failed","quickinput.theme.dark":"Dark · ☾","quickinput.theme.light":"Light · ☀","quickinput.card.none":"This deck only has one card","quickinput.card.none.detail":"Available when the deck has multiple cards","quickinput.card.hint":"Enter 1 - {total} to jump","quickinput.card.hint.detail":"Press Enter to jump","quickinput.card.invalid":'"{input}" is not a valid card number',"quickinput.card.range":"Please enter 1 - {total}","quickinput.card.oor":"Card {n} is out of range","quickinput.card.jump":"Jump to card {n}","quickinput.card.current":"Current","quickinput.card.untitled":"(untitled)","quickinput.card.nomatch":'No cards match "{input}"',"settings.tab.shortcuts":"Shortcuts","settings.shortcuts.title":"Shortcuts","settings.shortcuts.subtitle":"Customise keyboard shortcuts. Click a binding to record a new combo, Esc to cancel.","settings.shortcuts.search":"Search actions…","settings.shortcuts.reset":"Reset","settings.shortcuts.resetAll":"Reset all","settings.shortcuts.disabled":"Unbound","settings.shortcuts.recording":"Press a new combo…","settings.shortcuts.conflict":"Conflicts with {name}","settings.shortcuts.noModifier":"No modifier · may trigger while typing","settings.shortcuts.group.global":"Global","settings.shortcuts.group.hud":"Typing HUD","settings.shortcuts.group.card":"Card navigation","settings.shortcuts.confirmResetAll":"Reset all shortcuts to defaults?","action.palette.open":"Open search / command palette","action.palette.commands":"Open command palette","action.palette.search":"Open search","action.hud.pause":"Start / pause","action.hud.hint":"Toggle answer hint","action.hud.keyboard":"Toggle keyboard image","action.hud.hands":"Toggle hands","action.hud.back":"Back","action.card.prev":"Previous card","action.card.next":"Next card","cmd.card.jump.registry":"Jump to card","cmd.theme.pick.registry":"Pick theme","cmd.hint.toggle.registry":"Toggle answer hint","toast.card.atFirst":"Already at the first card","toast.card.atLast":"Already at the last card"},gk=hk,pk=fk,mk={"zh-CN":gk,"en-US":pk};function yk(e){return e==="zh"||e==="zh-CN"?"zh-CN":e==="en"||e==="en-US"?"en-US":null}function Ak(e){const t=mk[e];return(n,r)=>{let i=t[n]??n;if(r)for(const[o,s]of Object.entries(r))i=i.replace(`{${o}}`,String(s));return i}}const vk="en-US";let Z2=vk;const X2=new Set;function qk(e){return X2.add(e),()=>X2.delete(e)}function wk(e){const t=yk(e);if(t&&t!==Z2){Z2=t;for(const n of X2)n()}}function xk(){const e=el("settings","uiLang","auto");return e==="zh"||e==="en"?e:"auto"}function bk(e){const t=qk(e),n=t4("settings","uiLang",e);return()=>{t(),n()}}function A0(){const e=xk();return e==="zh"?"zh-CN":e==="en"?"en-US":Z2}function ve(e={}){const{forced:t}=e,n=v.useSyncExternalStore(bk,A0,A0),r=t??n,i=Ak(r);return{lang:r,t:i}}function Vk(e,t){return t==="theme"?{kind:"theme",query:e.trim()}:t==="card"?{kind:"card",query:e.trim()}:e.startsWith(">")?{kind:"commands",query:e.slice(1).trim()}:e.startsWith("?")?{kind:"help"}:e.startsWith("#")?{kind:"card",query:e.slice(1).trim()}:e.trim()?{kind:"search",query:e.trim()}:{kind:"menu"}}const kk=v.forwardRef(function({commands:t,materials:n,theme:r,onSearchDeck:i,onRunCommand:o,onPickTheme:s,cardTotal:l,cards:a,currentCardIdx:c,onJumpCard:h},d){const{t:u}=ve(),[p,g]=v.useState(""),[y,q]=v.useState(null),[m,A]=v.useState(!1),[w,x]=v.useState(0),V=v.useRef(null),k=v.useRef(null),b=v.useMemo(()=>Vk(p,y),[p,y]),j=v.useCallback(()=>{var C;g(""),q(null),(C=V.current)==null||C.blur(),A(!1)},[]);v.useImperativeHandle(d,()=>({open(C){g((C==null?void 0:C.value)??""),q((C==null?void 0:C.submode)??null),requestAnimationFrame(()=>{const _=V.current;_&&(_.focus(),_.setSelectionRange(_.value.length,_.value.length),A(!0))})},close(){j()}}),[j]);const z=v.useMemo(()=>b.kind==="menu"?[{key:"menu-cmd",label:u("quickinput.cmd.exec"),description:">",run:()=>g(">")},{key:"menu-help",label:u("quickinput.cmd.help"),description:"?",run:()=>g("?")},...v0(n,"",i,j)]:b.kind==="search"?v0(n,b.query,i,j):b.kind==="commands"?jk(t,b.query,C=>{if(C==="pick.theme"){g(""),q("theme");return}if(C==="card.jump"){g(""),q("card");return}o(C),j()}):b.kind==="help"?[{key:"help-search",label:u("quickinput.cmd.searchMaterials"),detail:u("quickinput.cmd.searchMaterials.detail"),description:u("quickinput.cmd.searchMaterials.desc"),run:()=>g("")},{key:"help-cmd",label:u("quickinput.cmd.palette"),detail:u("quickinput.cmd.palette.detail"),description:">",run:()=>g(">")},{key:"help-theme",label:u("quickinput.cmd.theme",{current:u(r==="mocha"?"cmd.theme.dark":"cmd.theme.light")}),detail:u("quickinput.cmd.theme.detail"),description:"cmd",run:()=>{g(""),q("theme")}}]:b.kind==="theme"?zk(r,b.query,C=>{s(C),j()},u):Sk(b.query,l,a,c,C=>{h==null||h(C),j()},u),[b,n,t,r,l,a,c,i,o,s,h,j,u]);v.useEffect(()=>{x(C=>{if(!z.length)return 0;const _=z.findIndex(L=>L.active);return _>=0?_:C>=z.length?0:C})},[z]),v.useEffect(()=>{const C=_=>{var D;if(!m)return;const L=_.target;L&&((D=k.current)!=null&&D.contains(L))||j()};return document.addEventListener("pointerdown",C,!0),()=>document.removeEventListener("pointerdown",C,!0)},[m,j]);const S=v.useCallback(()=>{const C=z[w];C&&!C.disabled&&C.run()},[z,w]),R=v.useCallback(C=>{if(C.key==="Escape"){C.preventDefault(),j();return}if(C.key==="ArrowDown"){C.preventDefault(),x(_=>{var L;for(let D=1;D<=z.length;D++){const M=(_+D)%z.length;if(!((L=z[M])!=null&&L.disabled))return M}return _});return}if(C.key==="ArrowUp"){C.preventDefault(),x(_=>{var L;for(let D=1;D<=z.length;D++){const M=(_-D+z.length)%z.length;if(!((L=z[M])!=null&&L.disabled))return M}return _});return}C.key==="Enter"&&(C.preventDefault(),S())},[z,j,S]),T=b.kind==="commands"?u("quickinput.placeholder.cmd"):b.kind==="help"?u("quickinput.placeholder.help"):b.kind==="theme"?u("quickinput.placeholder.theme"):b.kind==="card"?l?u("quickinput.placeholder.cardJump",{total:l}):u("quickinput.placeholder.noMultiCards"):u("quickinput.placeholder.default"),E=m&&z.length>0;return f.jsxs("div",{className:"qt-qi",ref:k,children:[f.jsx("input",{ref:V,className:"qt-qi__input",type:"text",value:p,onChange:C=>g(C.target.value),onFocus:()=>A(!0),onKeyDown:R,placeholder:T,spellCheck:!1,autoComplete:"off","aria-label":"quick input"}),!p&&!m&&f.jsx("kbd",{className:"qt-qi__kbd",children:"⌘K"}),E&&f.jsx("div",{className:"qt-qi__panel",role:"listbox",children:z.map((C,_)=>f.jsxs("button",{className:`qt-qi__row ${_===w?"is-focused":""} ${C.active?"is-active":""} ${C.disabled?"is-disabled":""}`,disabled:C.disabled,onMouseEnter:()=>x(_),onClick:()=>{C.disabled||C.run()},role:"option","aria-selected":_===w,children:[f.jsxs("div",{className:"qt-qi__body",children:[f.jsx("span",{className:"qt-qi__label",children:C.label}),C.detail&&f.jsx("span",{className:"qt-qi__detail",children:C.detail})]}),C.description&&f.jsx("span",{className:"qt-qi__desc",children:C.description})]},C.key))})]})});function v0(e,t,n,r){const i=t.trim().toLowerCase();if(!i)return e.slice(0,8).map(s=>({key:`material-${s.file}`,label:s.title,detail:s.file,run:()=>{n(s.file),r()}}));const o=[];for(const s of e){const l=s.title.toLowerCase();let a=0,c;if(l.includes(i)&&(a+=100),s.matchText){const h=s.matchText.toLowerCase().indexOf(i);h>=0&&(a+=10-Math.min(10,h*.001),c=Ck(s.matchText,h,i.length))}a>0&&o.push({d:s,score:a,hit:c})}return o.sort((s,l)=>l.score-s.score),o.slice(0,30).map(({d:s,hit:l})=>({key:`material-${s.file}`,label:s.title,detail:l??s.file,run:()=>{n(s.file),r()}}))}function jk(e,t,n){const r=t.trim().toLowerCase();return e.filter(i=>!r||i.label.toLowerCase().includes(r)).map(i=>({key:`cmd-${i.id}`,label:i.label,description:i.description,disabled:i.enabled===!1,run:()=>n(i.id)}))}function zk(e,t,n,r){const i=[{v:"mocha",label:r("quickinput.theme.dark")},{v:"latte",label:r("quickinput.theme.light")}],o=t.trim().toLowerCase();return i.filter(s=>!o||s.label.toLowerCase().includes(o)).map(s=>({key:`theme-${s.v}`,label:s.label,active:s.v===e,run:()=>n(s.v)}))}function Sk(e,t,n,r,i,o){if(!t||t<=1)return[{key:"card-none",label:o("quickinput.card.none"),detail:o("quickinput.card.none.detail"),run:()=>{}}];const s=e.trim();if(!n||n.length===0){if(!s)return[{key:"card-hint",label:o("quickinput.card.hint",{total:t}),detail:o("quickinput.card.hint.detail"),run:()=>{}}];const h=Number.parseInt(s,10);return!Number.isFinite(h)||h<1||h>t?[{key:"card-oor",label:o("quickinput.card.oor",{n:s}),detail:o("quickinput.card.range",{total:t}),run:()=>{}}]:[{key:`card-${h}`,label:o("quickinput.card.jump",{n:h}),description:"Enter",run:()=>i(h-1)}]}const l=s&&/^\d+$/.test(s)?Number(s):null;if(l!==null&&l>=1&&l<=n.length)return[{key:`card-${l}`,label:o("quickinput.card.jump",{n:l}),description:"Enter",run:()=>i(l-1)}];const a=s.toLowerCase(),c=[];return n.forEach((h,d)=>{if(a&&!h.title.toLowerCase().includes(a))return;const u=d===r,g=`${h.done?"✓ ":" "}${d+1}. ${h.title||o("quickinput.card.untitled")}`;c.push({key:`card-row-${h.id}`,label:u?`▸ ${g}`:g,description:u?o("quickinput.card.current"):void 0,run:()=>i(d)})}),c.length===0&&c.push({key:"card-nomatch",label:o("quickinput.card.nomatch",{input:s}),run:()=>{}}),c}function Ck(e,t,n){const r=Math.max(0,t-30),i=Math.min(e.length,t+n+60);let o=e.slice(r,i).replace(/\s+/g," ").trim();return r>0&&(o="…"+o),i<e.length&&(o=o+"…"),o}function q0(){if(typeof window>"u")return"l";const e=window.innerWidth;return e<640?"s":e<1024?"m":"l"}function Ek(){const[e,t]=v.useState(q0);return v.useEffect(()=>{const n=()=>t(q0());return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),e}function Rk(){const[e,t]=v.useState(()=>typeof window>"u"?!1:window.innerHeight<500);return v.useEffect(()=>{const n=()=>t(window.innerHeight<500);return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),e}function _k(){const e=document.documentElement.dataset,t=e.qtypeLogoExt;return{repoName:e.qtypeRepoName??"qtype",logoExt:t==="png"?"png":"svg"}}const $8=v.forwardRef(function({onGoHome:t,progressCurrent:n,progressTotal:r,...i},o){const{t:s}=ve(),l=Ek(),a=l==="s"?"qt-header qt-header--s":"qt-header qt-header--ml",c=r>0,h=c?Math.min(100,Math.round(n/r*100)):0,d=v.useMemo(()=>_k(),[]),u=d.repoName,p=`/logo.${d.logoExt}`,g=v.useRef(null);return v.useEffect(()=>{var y;(y=g.current)==null||y.style.setProperty("--qt-progress",`${h}%`)},[h]),f.jsxs("header",{className:a,children:[f.jsxs("button",{className:"qt-brand",onClick:t,"aria-label":s("header.home"),title:s("header.home"),children:[f.jsx("img",{className:"qt-brand__logo",src:p,alt:"","aria-hidden":"true",width:28,height:28}),f.jsx("span",{className:"qt-brand__name",children:u})]}),f.jsx("div",{className:"qt-header-search",children:f.jsx(kk,{ref:o,...i})}),f.jsxs("div",{className:"qt-header-right",children:[c&&l==="s"&&f.jsxs("span",{className:"qt-header-pct",children:[h,"%"]}),c&&l!=="s"&&f.jsxs("div",{className:"qt-header-stats",children:[f.jsxs("span",{className:"qt-header-count",children:[n," / ",r,f.jsxs("span",{className:"qt-header-count-pct",children:[" (",h,"%)"]})]}),l==="l"&&f.jsx("div",{ref:g,className:"qt-header-bar",children:f.jsx("div",{className:"qt-header-bar__fill"})})]})]})]})});function Rn({size:e=16,strokeWidth:t=2,viewBox:n="0 0 24 24",fill:r="none",stroke:i="currentColor",strokeLinecap:o="round",strokeLinejoin:s="round","aria-hidden":l=!0,children:a,...c}){return f.jsx("svg",{width:e,height:e,viewBox:n,fill:r,stroke:i,strokeWidth:t,strokeLinecap:o,strokeLinejoin:s,"aria-hidden":l,...c,children:a})}function G8(e){return f.jsx(Rn,{...e,children:f.jsx("path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"})})}function Q8(e){return f.jsxs(Rn,{...e,children:[f.jsx("path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"}),f.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function Tk(e){return f.jsxs(Rn,{...e,children:[f.jsx("circle",{cx:"12",cy:"12",r:"4"}),f.jsx("path",{d:"M12 2v2"}),f.jsx("path",{d:"M12 20v2"}),f.jsx("path",{d:"m4.93 4.93 1.41 1.41"}),f.jsx("path",{d:"m17.66 17.66 1.41 1.41"}),f.jsx("path",{d:"M2 12h2"}),f.jsx("path",{d:"M20 12h2"}),f.jsx("path",{d:"m6.34 17.66-1.41 1.41"}),f.jsx("path",{d:"m19.07 4.93-1.41 1.41"})]})}function Mk(e){return f.jsx(Rn,{...e,children:f.jsx("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})})}function Y8(e){return f.jsx(Rn,{...e,children:f.jsx("polyline",{points:"15 18 9 12 15 6"})})}function n4(e){return f.jsx(Rn,{...e,children:f.jsx("polyline",{points:"9 18 15 12 9 6"})})}function Pk(e){return f.jsx(Rn,{...e,children:f.jsx("path",{d:"m6 9 6 6 6-6"})})}function w0(e){return f.jsx(Rn,{...e,children:f.jsx("path",{d:"M18 6 6 18M6 6l12 12"})})}function Ik(e){return f.jsxs(Rn,{...e,children:[f.jsx("circle",{cx:"11",cy:"11",r:"8"}),f.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]})}function Lk(e){return f.jsxs(Rn,{...e,children:[f.jsx("polyline",{points:"15 3 21 3 21 9"}),f.jsx("polyline",{points:"9 21 3 21 3 15"}),f.jsx("line",{x1:"21",y1:"3",x2:"14",y2:"10"}),f.jsx("line",{x1:"3",y1:"21",x2:"10",y2:"14"})]})}function Nk(e){return f.jsxs(Rn,{...e,children:[f.jsx("polyline",{points:"4 14 10 14 10 20"}),f.jsx("polyline",{points:"20 10 14 10 14 4"}),f.jsx("line",{x1:"14",y1:"10",x2:"21",y2:"3"}),f.jsx("line",{x1:"3",y1:"21",x2:"10",y2:"14"})]})}function Dk(e){return f.jsxs(Rn,{...e,children:[f.jsx("path",{d:"M11 5 6 9H2v6h4l5 4z"}),f.jsx("path",{d:"M15.54 8.46a5 5 0 0 1 0 7.07"}),f.jsx("path",{d:"M19.07 4.93a10 10 0 0 1 0 14.14"})]})}function Z8({left:e,center:t,theme:n,onToggleTheme:r,onOpenSettings:i}){const{t:o}=ve(),s=n==="mocha"?Mk:Tk;return f.jsxs("footer",{className:"qt-footer",children:[f.jsx("span",{className:"qt-footer__left",children:f.jsx("span",{className:"qt-footer__left-inner",children:e})}),t&&f.jsx("span",{className:"qt-footer__center",children:t}),f.jsxs("span",{className:"qt-footer__right",children:[f.jsx("button",{className:"qt-footer__stat",onClick:r,"aria-label":"toggle theme",title:o(n==="mocha"?"footer.theme.toLight":"footer.theme.toDark"),children:f.jsx(s,{size:13,className:"qt-footer__icon"})}),i&&f.jsx("button",{className:"qt-footer__stat",onClick:i,"aria-label":o("footer.settings.open"),title:o("footer.settings"),children:f.jsx(Q8,{size:13,className:"qt-footer__icon"})})]})]})}var Ok=Object.defineProperty,dl=(e,t)=>Ok(e,"name",{value:t,configurable:!0}),X8=!!(typeof window<"u"&&window.document&&window.document.createElement);function xt(e,t,{checkForDefaultPrevented:n=!0}={}){return dl(function(i){if(e==null||e(i),n===!1||!i||!i.defaultPrevented)return t==null?void 0:t(i)},"handleEvent")}dl(xt,"composeEventHandlers");function Bk(e){var t;if(!X8)throw new Error("Cannot access window outside of the DOM");return((t=e==null?void 0:e.ownerDocument)==null?void 0:t.defaultView)??window}dl(Bk,"getOwnerWindow");function J2(e){if(!X8)throw new Error("Cannot access document outside of the DOM");return(e==null?void 0:e.ownerDocument)??document}dl(J2,"getOwnerDocument");function J8(e,t=!1){const{activeElement:n}=J2(e);if(!(n!=null&&n.nodeName))return null;if(em(n)&&n.contentDocument)return J8(n.contentDocument.body,t);if(t){const r=n.getAttribute("aria-activedescendant");if(r){const i=J2(n).getElementById(r);if(i)return i}}return n}dl(J8,"getActiveElement");function em(e){return e.tagName==="IFRAME"}dl(em,"isFrame");var Fk=Object.defineProperty,r4=(e,t)=>Fk(e,"name",{value:t,configurable:!0});function ef(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}r4(ef,"setRef");function Co(...e){return t=>{let n=!1;const r=e.map(i=>{const o=ef(i,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let i=0;i<r.length;i++){const o=r[i];typeof o=="function"?o():ef(e[i],null)}}}}r4(Co,"composeRefs");function _n(...e){return v.useCallback(Co(...e),e)}r4(_n,"useComposedRefs");var Hk=Object.defineProperty,wn=(e,t)=>Hk(e,"name",{value:t,configurable:!0});function Uk(e,t){const n=v.createContext(t);n.displayName=e+"Context";const r=wn(o=>{const{children:s,...l}=o,a=v.useMemo(()=>l,Object.values(l));return f.jsx(n.Provider,{value:a,children:s})},"Provider");r.displayName=e+"Provider";function i(o,s={}){const{optional:l=!1}=s,a=v.useContext(n);if(a)return a;if(t!==void 0)return t;if(!l)throw new Error(`\`${o}\` must be used within \`${e}\``)}return wn(i,"useContext"),[r,i]}wn(Uk,"createContext");function ic(e,t=[]){let n=[];function r(o,s){const l=v.createContext(s);l.displayName=o+"Context";const a=n.length;n=[...n,s];const c=wn(d=>{var m;const{scope:u,children:p,...g}=d,y=((m=u==null?void 0:u[e])==null?void 0:m[a])||l,q=v.useMemo(()=>g,Object.values(g));return f.jsx(y.Provider,{value:q,children:p})},"Provider");c.displayName=o+"Provider";function h(d,u,p={}){var m;const{optional:g=!1}=p,y=((m=u==null?void 0:u[e])==null?void 0:m[a])||l,q=v.useContext(y);if(q)return q;if(s!==void 0)return s;if(!g)throw new Error(`\`${d}\` must be used within \`${o}\``)}return wn(h,"useContext"),[c,h]}wn(r,"createContext");const i=wn(()=>{const o=n.map(s=>v.createContext(s));return wn(function(l){const a=(l==null?void 0:l[e])||o;return v.useMemo(()=>({[`__scope${e}`]:{...l,[e]:a}}),[l,a])},"useScope")},"createScope");return i.scopeName=e,[r,tm(i,...t)]}wn(ic,"createContextScope");function tm(...e){const t=e[0];if(e.length===1)return t;const n=wn(()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return wn(function(o){const s=r.reduce((l,{useScope:a,scopeName:c})=>{const d=a(o)[`__scope${c}`];return{...l,...d}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])},"useComposedScopes")},"createScope");return n.scopeName=t.scopeName,n}wn(tm,"composeContextScopes");var Wk=Object.defineProperty,$n=(e,t)=>Wk(e,"name",{value:t,configurable:!0});function id(e){const t=v.forwardRef((n,r)=>{let{children:i,...o}=n,s=null,l=!1;const a=[];tf(i)&&typeof Wc=="function"&&(i=Wc(i._payload)),v.Children.forEach(i,u=>{var p;if(sm(u)){l=!0;const g=u;let y="child"in g.props?g.props.child:g.props.children;tf(y)&&typeof Wc=="function"&&(y=Wc(y._payload)),s=Kk(g,y),a.push((p=s==null?void 0:s.props)==null?void 0:p.children)}else a.push(u)}),s?s=v.cloneElement(s,void 0,a):!l&&v.Children.count(i)===1&&v.isValidElement(i)&&(s=i);const c=s?om(s):void 0,h=_n(r,c);if(!s){if(i||i===0)throw new Error(l?Qk(e):Gk(e));return i}const d=im(o,s.props??{});return s.type!==v.Fragment&&(d.ref=r?h:c),v.cloneElement(s,d)});return t.displayName=`${e}.Slot`,t}$n(id,"createSlot");var nm=Symbol.for("radix.slottable");function rm(e){const t=$n(n=>"child"in n?n.children(n.child):n.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=nm,t}$n(rm,"createSlottable");var Kk=$n((e,t)=>{if("child"in e.props){const n=e.props.child;return v.isValidElement(n)?v.cloneElement(n,void 0,e.props.children(n.props.children)):null}return v.isValidElement(t)?t:null},"getSlottableElementFromSlottable");function im(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...l)=>{const a=o(...l);return i(...l),a}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}$n(im,"mergeProps");function om(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}$n(om,"getElementRef");function sm(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===nm}$n(sm,"isSlottable");var $k=Symbol.for("react.lazy");function tf(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===$k&&"_payload"in e&&lm(e._payload)}$n(tf,"isLazyComponent");function lm(e){return typeof e=="object"&&e!==null&&"then"in e}$n(lm,"isPromiseLike");var Gk=$n(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),Qk=$n(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),Wc=Za[" use ".trim().toString()],Yk=Object.defineProperty,Zk=(e,t)=>Yk(e,"name",{value:t,configurable:!0}),Xk=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],at=Xk.reduce((e,t)=>{const n=id(`Primitive.${t}`),r=v.forwardRef((i,o)=>{const{asChild:s,...l}=i,a=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),f.jsx(a,{...l,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function am(e,t){e&&nc.flushSync(()=>e.dispatchEvent(t))}Zk(am,"dispatchDiscreteCustomEvent");var Jk=Object.defineProperty,ej=(e,t)=>Jk(e,"name",{value:t,configurable:!0});function Eo(e){const t=v.useRef(e);return v.useEffect(()=>{t.current=e}),v.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}ej(Eo,"useCallbackRef");var tj=Object.defineProperty,wt=(e,t)=>tj(e,"name",{value:t,configurable:!0}),nf="dismissableLayer.update",nj="dismissableLayer.pointerDownOutside",rj="dismissableLayer.focusOutside",x0,cm=v.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),i4=v.forwardRef(wt(function(t,n){const{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:i=!1,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:l,onInteractOutside:a,onDismiss:c,...h}=t,d=v.useContext(cm),[u,p]=v.useState(null),g=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=v.useState({}),q=_n(n,p),m=Array.from(d.layers),[A]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),w=A?m.indexOf(A):-1,x=u?m.indexOf(u):-1,V=d.layersWithOutsidePointerEventsDisabled.size>0,k=x>=w,b=v.useRef(!1),j=dm(T=>{s==null||s(T),a==null||a(T),T.defaultPrevented||c==null||c()},{ownerDocument:g,deferPointerDownOutside:i,isDeferredPointerDownOutsideRef:b,dismissableSurfaces:d.dismissableSurfaces,shouldHandlePointerDownOutside:v.useCallback(T=>{if(!(T instanceof Node))return!1;const E=[...d.branches].some(C=>C.contains(T));return k&&!E},[d.branches,k])}),z=hm(T=>{if(i&&b.current)return;const E=T.target;[...d.branches].some(_=>_.contains(E))||(l==null||l(T),a==null||a(T),T.defaultPrevented||c==null||c())},g),S=u?x===m.length-1:!1,R=Eo(T=>{T.key==="Escape"&&(o==null||o(T),!T.defaultPrevented&&c&&(T.preventDefault(),c()))});return v.useEffect(()=>{if(S)return g.addEventListener("keydown",R,{capture:!0}),()=>g.removeEventListener("keydown",R,{capture:!0})},[g,S,R]),v.useEffect(()=>{if(u)return r&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(x0=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(u)),d.layers.add(u),rf(),()=>{r&&(d.layersWithOutsidePointerEventsDisabled.delete(u),d.layersWithOutsidePointerEventsDisabled.size===0&&(g.body.style.pointerEvents=x0))}},[u,g,r,d]),v.useEffect(()=>()=>{u&&(d.layers.delete(u),d.layersWithOutsidePointerEventsDisabled.delete(u),rf())},[u,d]),v.useEffect(()=>{const T=wt(()=>y({}),"handleUpdate");return document.addEventListener(nf,T),()=>document.removeEventListener(nf,T)},[]),f.jsx(at.div,{...h,ref:q,style:{pointerEvents:V?k?"auto":"none":void 0,...t.style},onFocusCapture:xt(t.onFocusCapture,z.onFocusCapture),onBlurCapture:xt(t.onBlurCapture,z.onBlurCapture),onPointerDownCapture:xt(t.onPointerDownCapture,j.onPointerDownCapture)})},"DismissableLayer"));function um(){const e=v.useContext(cm),[t,n]=v.useState(null);return v.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}wt(um,"useDismissableLayerSurface");var ij=wt(()=>!0,"IS_TRUE");function dm(e,t){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:o,shouldHandlePointerDownOutside:s=ij}=t,l=Eo(e),a=v.useRef(!1),c=v.useRef(!1),h=v.useRef(new Map),d=v.useRef(()=>{});return v.useEffect(()=>{function u(){c.current=!1,i.current=!1,h.current.clear()}wt(u,"resetOutsideInteraction");function p(){return Array.from(h.current.values()).some(Boolean)}wt(p,"isOutsideInteractionIntercepted");function g(w){if(!c.current)return;const x=w.target;x instanceof Node&&[...o].some(k=>k.contains(x))||h.current.set(w.type,!0),w.type==="click"&&window.setTimeout(()=>{c.current&&d.current()},0)}wt(g,"handleInteractionCapture");function y(w){c.current&&h.current.set(w.type,!1)}wt(y,"handleInteractionBubble");const q=wt(w=>{if(w.target&&!a.current){let x=function(){n.removeEventListener("click",d.current);const k=p();u(),k||o4(nj,l,V,{discrete:!0})};if(wt(x,"handleAndDispatchPointerDownOutsideEvent"),!s(w.target)){n.removeEventListener("click",d.current),u(),a.current=!1;return}const V={originalEvent:w};c.current=!0,i.current=r&&w.button===0,h.current.clear(),!r||w.button!==0?x():(n.removeEventListener("click",d.current),d.current=x,n.addEventListener("click",d.current,{once:!0}))}else n.removeEventListener("click",d.current),u();a.current=!1},"handlePointerDown"),m=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const w of m)n.addEventListener(w,g,!0),n.addEventListener(w,y);const A=window.setTimeout(()=>{n.addEventListener("pointerdown",q)},0);return()=>{window.clearTimeout(A),n.removeEventListener("pointerdown",q),n.removeEventListener("click",d.current);for(const w of m)n.removeEventListener(w,g,!0),n.removeEventListener(w,y)}},[n,l,r,i,o,s]),{onPointerDownCapture:wt(()=>a.current=!0,"onPointerDownCapture")}}wt(dm,"usePointerDownOutside");function hm(e,t=globalThis==null?void 0:globalThis.document){const n=Eo(e),r=v.useRef(!1);return v.useEffect(()=>{const i=wt(o=>{o.target&&!r.current&&o4(rj,n,{originalEvent:o},{discrete:!1})},"handleFocus");return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,n]),{onFocusCapture:wt(()=>r.current=!0,"onFocusCapture"),onBlurCapture:wt(()=>r.current=!1,"onBlurCapture")}}wt(hm,"useFocusOutside");function rf(){const e=new CustomEvent(nf);document.dispatchEvent(e)}wt(rf,"dispatchUpdate");function o4(e,t,n,{discrete:r}){const i=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?am(i,o):i.dispatchEvent(o)}wt(o4,"handleAndDispatchCustomEvent");var oj=Object.defineProperty,s4=(e,t)=>oj(e,"name",{value:t,configurable:!0}),Kc=0,Xn=null;function sj(e){return od(),e.children}s4(sj,"FocusGuards");function od(){v.useEffect(()=>{Xn||(Xn={start:of(),end:of()});const{start:e,end:t}=Xn;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),Kc++,()=>{Kc===1&&(Xn==null||Xn.start.remove(),Xn==null||Xn.end.remove(),Xn=null),Kc=Math.max(0,Kc-1)}},[])}s4(od,"useFocusGuards");function of(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}s4(of,"createFocusGuard");var lj=Object.defineProperty,Bt=(e,t)=>lj(e,"name",{value:t,configurable:!0}),uh="focusScope.autoFocusOnMount",dh="focusScope.autoFocusOnUnmount",b0={bubbles:!1,cancelable:!0},fm=v.forwardRef(Bt(function(t,n){const{loop:r=!1,trapped:i=!1,onMountAutoFocus:o,onUnmountAutoFocus:s,...l}=t,[a,c]=v.useState(null),h=Eo(o),d=Eo(s),u=v.useRef(null),p=_n(n,c),g=v.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;v.useEffect(()=>{if(i){let q=function(x){if(g.paused||!a)return;const V=x.target;a.contains(V)?u.current=V:wr(u.current,{select:!0})},m=function(x){if(g.paused||!a)return;const V=x.relatedTarget;V!==null&&(a.contains(V)||wr(u.current,{select:!0}))},A=function(x){if(document.activeElement===document.body)for(const k of x)k.removedNodes.length>0&&wr(a)};Bt(q,"handleFocusIn"),Bt(m,"handleFocusOut"),Bt(A,"handleMutations"),document.addEventListener("focusin",q),document.addEventListener("focusout",m);const w=new MutationObserver(A);return a&&w.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",q),document.removeEventListener("focusout",m),w.disconnect()}}},[i,a,g.paused]),v.useEffect(()=>{if(a){V0.add(g);const q=document.activeElement;if(!a.contains(q)){const A=new CustomEvent(uh,b0);a.addEventListener(uh,h),a.dispatchEvent(A),A.defaultPrevented||(gm(vm(l4(a)),{select:!0}),document.activeElement===q&&wr(a))}return()=>{a.removeEventListener(uh,h),setTimeout(()=>{const A=new CustomEvent(dh,b0);a.addEventListener(dh,d),a.dispatchEvent(A),A.defaultPrevented||wr(q??document.body,{select:!0}),a.removeEventListener(dh,d),V0.remove(g)},0)}}},[a,h,d,g]);const y=v.useCallback(q=>{if(!r&&!i||g.paused)return;const m=q.key==="Tab"&&!q.altKey&&!q.ctrlKey&&!q.metaKey,A=document.activeElement;if(m&&A){const w=q.currentTarget,[x,V]=pm(w);x&&V?!q.shiftKey&&A===V?(q.preventDefault(),r&&wr(x,{select:!0})):q.shiftKey&&A===x&&(q.preventDefault(),r&&wr(V,{select:!0})):A===w&&q.preventDefault()}},[r,i,g.paused]);return f.jsx(at.div,{tabIndex:-1,...l,ref:p,onKeyDown:y})},"FocusScope"));function gm(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(wr(r,{select:t}),document.activeElement!==n)return}Bt(gm,"focusFirst");function pm(e){const t=l4(e),n=sf(t,e),r=sf(t.reverse(),e);return[n,r]}Bt(pm,"getTabbableEdges");function l4(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:Bt(r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;n.nextNode();)t.push(n.currentNode);return t}Bt(l4,"getTabbableCandidates");function sf(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):mm(r,{upTo:t})))return r}Bt(sf,"findVisible");function mm(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}Bt(mm,"isHidden");function ym(e){return e instanceof HTMLInputElement&&"select"in e}Bt(ym,"isSelectableInput");function wr(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&ym(e)&&t&&e.select()}}Bt(wr,"focus");var V0=Am();function Am(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=lf(e,t),e.unshift(t)},remove(t){var n;e=lf(e,t),(n=e[0])==null||n.resume()}}}Bt(Am,"createFocusScopesStack");function lf(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}Bt(lf,"arrayRemove");function vm(e){return e.filter(t=>t.tagName!=="A")}Bt(vm,"removeLinks");var un=globalThis!=null&&globalThis.document?v.useLayoutEffect:()=>{},aj=Object.defineProperty,cj=(e,t)=>aj(e,"name",{value:t,configurable:!0}),uj=Za[" useId ".trim().toString()]||(()=>{}),dj=0;function Sn(e){const[t,n]=v.useState(uj());return un(()=>{e||n(r=>r??String(dj++))},[e]),e||(t?`radix-${t}`:"")}cj(Sn,"useId");const hj=["top","right","bottom","left"],Ii=Math.min,_r=Math.max,h1=Math.round,$c=Math.floor,Tr=e=>({x:e,y:e}),fj={left:"right",right:"left",bottom:"top",top:"bottom"};function qm(e,t,n){return _r(e,Ii(t,n))}function Or(e,t){return typeof e=="function"?e(t):e}function Li(e){return e.split("-")[0]}function hl(e){return e.split("-")[1]}function a4(e){return e==="x"?"y":"x"}function c4(e){return e==="y"?"height":"width"}function sr(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function u4(e){return a4(sr(e))}function gj(e,t,n){n===void 0&&(n=!1);const r=hl(e),i=u4(e),o=c4(i);let s=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(s=f1(s)),[s,f1(s)]}function pj(e){const t=f1(e);return[af(e),t,af(t)]}function af(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const k0=["left","right"],j0=["right","left"],mj=["top","bottom"],yj=["bottom","top"];function Aj(e,t,n){switch(e){case"top":case"bottom":return n?t?j0:k0:t?k0:j0;case"left":case"right":return t?mj:yj;default:return[]}}function vj(e,t,n,r){const i=hl(e);let o=Aj(Li(e),n==="start",r);return i&&(o=o.map(s=>s+"-"+i),t&&(o=o.concat(o.map(af)))),o}function f1(e){const t=Li(e);return fj[t]+e.slice(t.length)}function qj(e){var t,n,r,i;return{top:(t=e.top)!=null?t:0,right:(n=e.right)!=null?n:0,bottom:(r=e.bottom)!=null?r:0,left:(i=e.left)!=null?i:0}}function wm(e){return typeof e!="number"?qj(e):{top:e,right:e,bottom:e,left:e}}function g1(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function z0(e,t,n){let{reference:r,floating:i}=e;const o=sr(t),s=u4(t),l=c4(s),a=Li(t),c=o==="y",h=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,u=r[l]/2-i[l]/2;let p;switch(a){case"top":p={x:h,y:r.y-i.height};break;case"bottom":p={x:h,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:d};break;case"left":p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}const g=hl(t);return g&&(p[s]+=u*(g==="end"?1:-1)*(n&&c?-1:1)),p}async function wj(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:o,rects:s,elements:l,strategy:a}=e,{boundary:c="clippingAncestors",rootBoundary:h="viewport",elementContext:d="floating",altBoundary:u=!1,padding:p=0}=Or(t,e),g=wm(p),q=l[u?d==="floating"?"reference":"floating":d],m=g1(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(q)))==null||n?q:q.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(l.floating)),boundary:c,rootBoundary:h,strategy:a})),A=d==="floating"?{x:r,y:i,width:s.floating.width,height:s.floating.height}:s.reference,w=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l.floating)),x=await(o.isElement==null?void 0:o.isElement(w))&&await(o.getScale==null?void 0:o.getScale(w))||{x:1,y:1},V=g1(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:A,offsetParent:w,strategy:a}):A);return{top:(m.top-V.top+g.top)/x.y,bottom:(V.bottom-m.bottom+g.bottom)/x.y,left:(m.left-V.left+g.left)/x.x,right:(V.right-m.right+g.right)/x.x}}const xj=50,bj=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:s}=n,l=s.detectOverflow?s:{...s,detectOverflow:wj},a=await(s.isRTL==null?void 0:s.isRTL(t));let c=await s.getElementRects({reference:e,floating:t,strategy:i}),{x:h,y:d}=z0(c,r,a),u=r,p=0;const g={};for(let y=0;y<o.length;y++){const q=o[y];if(!q)continue;const{name:m,fn:A}=q,{x:w,y:x,data:V,reset:k}=await A({x:h,y:d,initialPlacement:r,placement:u,strategy:i,middlewareData:g,rects:c,platform:l,elements:{reference:e,floating:t}});h=w??h,d=x??d,g[m]={...g[m],...V},k&&p<xj&&(p++,typeof k=="object"&&(k.placement&&(u=k.placement),k.rects&&(c=k.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:i}):k.rects),{x:h,y:d}=z0(c,u,a)),y=-1)}return{x:h,y:d,placement:u,strategy:i,middlewareData:g}},Vj=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:o,platform:s,elements:l,middlewareData:a}=t,{element:c,padding:h=0}=Or(e,t)||{};if(c==null)return{};const d=wm(h),u={x:n,y:r},p=u4(i),g=c4(p),y=await s.getDimensions(c),q=p==="y",m=q?"top":"left",A=q?"bottom":"right",w=q?"clientHeight":"clientWidth",x=o.reference[g]+o.reference[p]-u[p]-o.floating[g],V=u[p]-o.reference[p],k=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c));let b=k?k[w]:0;(!b||!await(s.isElement==null?void 0:s.isElement(k)))&&(b=l.floating[w]||o.floating[g]);const j=x/2-V/2,z=b/2-y[g]/2-1,S=Ii(d[m],z),R=Ii(d[A],z),T=b-y[g]-R,E=b/2-y[g]/2+j,C=qm(S,E,T),_=!a.arrow&&hl(i)!=null&&E!==C&&o.reference[g]/2-(E<S?S:R)-y[g]/2<0,L=_?E<S?E-S:E-T:0;return{[p]:u[p]+L,data:{[p]:C,centerOffset:E-C-L,..._&&{alignmentOffset:L}},reset:_}}}),kj=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:o,rects:s,initialPlacement:l,platform:a,elements:c}=t,{mainAxis:h=!0,crossAxis:d=!0,fallbackPlacements:u,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:y=!0,...q}=Or(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const m=Li(i),A=sr(l),w=Li(l)===l,x=await(a.isRTL==null?void 0:a.isRTL(c.floating)),V=u||(w||!y?[f1(l)]:pj(l)),k=g!=="none";!u&&k&&V.push(...vj(l,y,g,x));const b=[l,...V],j=await a.detectOverflow(t,q),z=[];let S=((r=o.flip)==null?void 0:r.overflows)||[];if(h&&z.push(j[m]),d){const C=gj(i,s,x);z.push(j[C[0]],j[C[1]])}if(S=[...S,{placement:i,overflows:z}],!z.every(C=>C<=0)){var R,T;const C=(((R=o.flip)==null?void 0:R.index)||0)+1,_=b[C];if(_&&(!(d==="alignment"?A!==sr(_):!1)||S.every(M=>sr(M.placement)===A?M.overflows[0]>0:!0)))return{data:{index:C,overflows:S},reset:{placement:_}};let L=(T=S.filter(D=>D.overflows[0]<=0).sort((D,M)=>D.overflows[1]-M.overflows[1])[0])==null?void 0:T.placement;if(!L)switch(p){case"bestFit":{var E;const D=(E=S.filter(M=>{if(k){const N=sr(M.placement);return N===A||N==="y"}return!0}).map(M=>[M.placement,M.overflows.filter(N=>N>0).reduce((N,O)=>N+O,0)]).sort((M,N)=>M[1]-N[1])[0])==null?void 0:E[0];D&&(L=D);break}case"initialPlacement":L=l;break}if(i!==L)return{reset:{placement:L}}}return{}}}};function S0(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function C0(e){return hj.some(t=>e[t]>=0)}const jj=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:i="referenceHidden",...o}=Or(e,t);switch(i){case"referenceHidden":{const s=await r.detectOverflow(t,{...o,elementContext:"reference"}),l=S0(s,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:C0(l)}}}case"escaped":{const s=await r.detectOverflow(t,{...o,altBoundary:!0}),l=S0(s,n.floating);return{data:{escapedOffsets:l,escaped:C0(l)}}}default:return{}}}}},xm=new Set(["left","top"]);async function zj(e,t){const{placement:n,platform:r,elements:i}=e,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),s=Li(n),l=hl(n),a=sr(n)==="y",c=xm.has(s)?-1:1,h=o&&a?-1:1,d=Or(t,e);let{mainAxis:u,crossAxis:p,alignmentAxis:g}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return l&&typeof g=="number"&&(p=l==="end"?g*-1:g),a?{x:p*h,y:u*c}:{x:u*c,y:p*h}}const Sj=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:o,placement:s,middlewareData:l}=t,a=await zj(t,e);return s===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:i+a.x,y:o+a.y,data:{...a,placement:s}}}}},Cj=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i,platform:o}=t,{mainAxis:s=!0,crossAxis:l=!1,limiter:a={fn:A=>{let{x:w,y:x}=A;return{x:w,y:x}}},...c}=Or(e,t),h={x:n,y:r},d=await o.detectOverflow(t,c),u=sr(i),p=a4(u);let g=h[p],y=h[u];const q=(A,w)=>qm(w+d[A==="y"?"top":"left"],w,w-d[A==="y"?"bottom":"right"]);s&&(g=q(p,g)),l&&(y=q(u,y));const m=a.fn({...t,[p]:g,[u]:y});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[p]:s,[u]:l}}}}}},Ej=function(e){return e===void 0&&(e={}),{options:e,fn(t){var n,r;const{x:i,y:o,placement:s,rects:l,middlewareData:a}=t,{offset:c=0,mainAxis:h=!0,crossAxis:d=!0}=Or(e,t),u={x:i,y:o},p=sr(s),g=a4(p);let y=u[g],q=u[p];const m=Or(c,t),A=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:(n=m.mainAxis)!=null?n:0,crossAxis:(r=m.crossAxis)!=null?r:0};if(h){const V=g==="y"?"height":"width",k=l.reference[g]-l.floating[V]+A.mainAxis,b=l.reference[g]+l.reference[V]-A.mainAxis;y<k?y=k:y>b&&(y=b)}if(d){var w,x;const V=g==="y"?"width":"height",k=xm.has(Li(s)),b=l.reference[p]-l.floating[V]+(k&&((w=a.offset)==null?void 0:w[p])||0)+(k?0:A.crossAxis),j=l.reference[p]+l.reference[V]+(k?0:((x=a.offset)==null?void 0:x[p])||0)-(k?A.crossAxis:0);q<b?q=b:q>j&&(q=j)}return{[g]:y,[p]:q}}}},Rj=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:i,elements:o}=t,{apply:s=()=>{},...l}=Or(e,t),a=await i.detectOverflow(t,l),c=Li(n),h=hl(n),d=sr(n)==="y",{width:u,height:p}=r.floating;let g,y;c==="top"||c==="bottom"?(g=c,y=h===(await(i.isRTL==null?void 0:i.isRTL(o.floating))?"start":"end")?"left":"right"):(y=c,g=h==="end"?"top":"bottom");const q=p-a.top-a.bottom,m=u-a.left-a.right,A=Ii(p-a[g],q),w=Ii(u-a[y],m),x=t.middlewareData.shift,V=!x;let k=A,b=w;x!=null&&x.enabled.x&&(b=m),x!=null&&x.enabled.y&&(k=q),V&&!h&&(d?b=u-2*_r(a.left,a.right):k=p-2*_r(a.top,a.bottom)),await s({...t,availableWidth:b,availableHeight:k});const j=await i.getDimensions(o.floating);return u!==j.width||p!==j.height?{reset:{rects:!0}}:{}}}};function sd(){return typeof window<"u"}function fl(e){return bm(e)?(e.nodeName||"").toLowerCase():"#document"}function rn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ur(e){var t;return(t=(bm(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function bm(e){return sd()?e instanceof Node||e instanceof rn(e).Node:!1}function fr(e){return sd()?e instanceof Element||e instanceof rn(e).Element:!1}function Ki(e){return sd()?e instanceof HTMLElement||e instanceof rn(e).HTMLElement:!1}function E0(e){return!sd()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof rn(e).ShadowRoot}function ld(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=gr(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!=="inline"&&i!=="contents"}function _j(e){return/^(table|td|th)$/.test(fl(e))}function ad(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Tj=/transform|translate|scale|rotate|perspective|filter/,Mj=/paint|layout|strict|content/,io=e=>!!e&&e!=="none";let hh;function d4(e){const t=fr(e)?gr(e):e;return io(t.transform)||io(t.translate)||io(t.scale)||io(t.rotate)||io(t.perspective)||!h4()&&(io(t.backdropFilter)||io(t.filter))||Tj.test(t.willChange||"")||Mj.test(t.contain||"")}function Pj(e){let t=Ro(e);for(;Ki(t)&&!Ta(t);){if(d4(t))return t;if(ad(t))return null;t=Ro(t)}return null}function h4(){return hh==null&&(hh=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),hh}function Ta(e){return/^(html|body|#document)$/.test(fl(e))}function gr(e){return rn(e).getComputedStyle(e)}function cd(e){return fr(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ro(e){if(fl(e)==="html")return e;const t=e.assignedSlot||e.parentNode||E0(e)&&e.host||Ur(e);return E0(t)?t.host:t}function Vm(e){const t=Ro(e);return Ta(t)?(e.ownerDocument||e).body:Ki(t)&&ld(t)?t:Vm(t)}function Ma(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=Vm(e),o=i===((r=e.ownerDocument)==null?void 0:r.body),s=rn(i);if(o){const l=cf(s);return t.concat(s,s.visualViewport||[],ld(i)?i:[],l&&n?Ma(l):[])}else return t.concat(i,Ma(i,[],n))}function cf(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function km(e){const t=gr(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=Ki(e),o=i?e.offsetWidth:n,s=i?e.offsetHeight:r,l=h1(n)!==o||h1(r)!==s;return l&&(n=o,r=s),{width:n,height:r,$:l}}function f4(e){return fr(e)?e:e.contextElement}function Ls(e){const t=f4(e);if(!Ki(t))return Tr(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:o}=km(t);let s=(o?h1(n.width):n.width)/r,l=(o?h1(n.height):n.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!l||!Number.isFinite(l))&&(l=1),{x:s,y:l}}const Ij=Tr(0);function jm(e){const t=rn(e);return!h4()||!t.visualViewport?Ij:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Lj(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===rn(e)}function _o(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),o=f4(e);let s=Tr(1);t&&(r?fr(r)&&(s=Ls(r)):s=Ls(e));const l=Lj(o,n,r)?jm(o):Tr(0);let a=(i.left+l.x)/s.x,c=(i.top+l.y)/s.y,h=i.width/s.x,d=i.height/s.y;if(o&&r){const u=rn(o),p=fr(r)?rn(r):r;let g=u,y=cf(g);for(;y&&p!==g;){const q=Ls(y),m=y.getBoundingClientRect(),A=gr(y),w=m.left+(y.clientLeft+parseFloat(A.paddingLeft))*q.x,x=m.top+(y.clientTop+parseFloat(A.paddingTop))*q.y;a*=q.x,c*=q.y,h*=q.x,d*=q.y,a+=w,c+=x,g=rn(y),y=cf(g)}}return g1({width:h,height:d,x:a,y:c})}function ud(e,t){const n=cd(e).scrollLeft;return t?t.left+n:_o(Ur(e)).left+n}function zm(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-ud(e,n),i=n.top+t.scrollTop;return{x:r,y:i}}function Nj(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const o=i==="fixed",s=Ur(r),l=t?ad(t.floating):!1;if(r===s||l&&o)return n;let a={scrollLeft:0,scrollTop:0},c=Tr(1);const h=Tr(0),d=Ki(r);if((d||!o)&&((fl(r)!=="body"||ld(s))&&(a=cd(r)),d)){const p=_o(r);c=Ls(r),h.x=p.x+r.clientLeft,h.y=p.y+r.clientTop}const u=s&&!d&&!o?zm(s,a):Tr(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-a.scrollLeft*c.x+h.x+u.x,y:n.y*c.y-a.scrollTop*c.y+h.y+u.y}}function Dj(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Oj(e){const t=cd(e),n=e.ownerDocument.body,r=_r(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=_r(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let o=-t.scrollLeft+ud(e);const s=-t.scrollTop;return gr(n).direction==="rtl"&&(o+=_r(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:o,y:s}}const Bj=25;function Fj(e,t,n){n===void 0&&(n="viewport");const r=n==="layoutViewport",i=rn(e),o=Ur(e),s=i.visualViewport;let l=o.clientWidth,a=o.clientHeight,c=0,h=0;if(s){const u=!h4()||t==="fixed";r?u||(c=-s.offsetLeft,h=-s.offsetTop):(l=s.width,a=s.height,u&&(c=s.offsetLeft,h=s.offsetTop))}if(ud(o)<=0){const u=o.ownerDocument,p=u.body,g=getComputedStyle(p),y=u.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,q=Math.abs(o.clientWidth-p.clientWidth-y),m=getComputedStyle(o).scrollbarGutter==="stable both-edges"?q/2:q;m<=Bj&&(l-=m)}return{width:l,height:a,x:c,y:h}}function Hj(e,t){const n=_o(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,o=Ls(e),s=e.clientWidth*o.x,l=e.clientHeight*o.y,a=i*o.x,c=r*o.y;return{width:s,height:l,x:a,y:c}}function R0(e,t,n){let r;if(t==="viewport"||t==="layoutViewport")r=Fj(e,n,t);else if(t==="document")r=Oj(Ur(e));else if(fr(t))r=Hj(t,n);else{const i=jm(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return g1(r)}function Uj(e,t){const n=t.get(e);if(n)return n;let r=Ma(e,[],!1).filter(l=>fr(l)&&fl(l)!=="body"),i=null;const o=gr(e).position==="fixed";let s=o?Ro(e):e;for(;fr(s)&&!Ta(s);){const l=gr(s),a=d4(s),c=i?i.position:o?"fixed":"";!a&&(c==="fixed"||c==="absolute"&&l.position==="static")?r=r.filter(d=>d!==s):i=l,s=Ro(s)}return t.set(e,r),r}function Wj(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const s=[...n==="clippingAncestors"?ad(t)?[]:Uj(t,this._c):[].concat(n),r],l=R0(t,s[0],i);let a=l.top,c=l.right,h=l.bottom,d=l.left;for(let u=1;u<s.length;u++){const p=R0(t,s[u],i);a=_r(p.top,a),c=Ii(p.right,c),h=Ii(p.bottom,h),d=_r(p.left,d)}return{width:c-d,height:h-a,x:d,y:a}}function Kj(e){const{width:t,height:n}=km(e);return{width:t,height:n}}function $j(e,t,n){const r=Ki(t),i=Ur(t),o=n==="fixed",s=_o(e,!0,o,t);let l={scrollLeft:0,scrollTop:0};const a=Tr(0);if((r||!o)&&((fl(t)!=="body"||ld(i))&&(l=cd(t)),r)){const u=_o(t,!0,o,t);a.x=u.x+t.clientLeft,a.y=u.y+t.clientTop}!r&&i&&(a.x=ud(i));const c=i&&!r&&!o?zm(i,l):Tr(0),h=s.left+l.scrollLeft-a.x-c.x,d=s.top+l.scrollTop-a.y-c.y;return{x:h,y:d,width:s.width,height:s.height}}function fh(e){return gr(e).position==="static"}function _0(e,t){if(!Ki(e)||gr(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ur(e)===n&&(n=n.ownerDocument.body),n}function Sm(e,t){const n=rn(e);if(ad(e))return n;if(!Ki(e)){let i=Ro(e);for(;i&&!Ta(i);){if(fr(i)&&!fh(i))return i;i=Ro(i)}return n}let r=_0(e,t);for(;r&&_j(r)&&fh(r);)r=_0(r,t);return r&&Ta(r)&&fh(r)&&!d4(r)?n:r||Pj(e)||n}const Gj=async function(e){const t=this.getOffsetParent||Sm,n=this.getDimensions,r=await n(e.floating);return{reference:$j(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Qj(e){return gr(e).direction==="rtl"}const Yj={convertOffsetParentRelativeRectToViewportRelativeRect:Nj,getDocumentElement:Ur,getClippingRect:Wj,getOffsetParent:Sm,getElementRects:Gj,getClientRects:Dj,getDimensions:Kj,getScale:Ls,isElement:fr,isRTL:Qj};function Cm(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Zj(e,t,n){let r=null,i;const o=Ur(e);function s(){var h;clearTimeout(i),(h=r)==null||h.disconnect(),r=null}function l(h,d){h===void 0&&(h=!1),d===void 0&&(d=1),s();const u=e.getBoundingClientRect(),{left:p,top:g,width:y,height:q}=u;if(h||t(),!y||!q)return;const m=$c(g),A=$c(o.clientWidth-(p+y)),w=$c(o.clientHeight-(g+q)),x=$c(p),k={rootMargin:-m+"px "+-A+"px "+-w+"px "+-x+"px",threshold:_r(0,Ii(1,d))||1};let b=!0;function j(z){const S=z[0].intersectionRatio;if(!Cm(u,e.getBoundingClientRect()))return l();if(S!==d){if(!b)return l();S?l(!1,S):i=setTimeout(()=>{l(!1,1e-7)},1e3)}b=!1}try{r=new IntersectionObserver(j,{...k,root:o.ownerDocument})}catch{r=new IntersectionObserver(j,k)}r.observe(e)}const a=rn(e),c=()=>l(n);return a.addEventListener("resize",c),l(!0),()=>{a.removeEventListener("resize",c),s()}}function Xj(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:a=!1}=r,c=f4(e),h=i||o?[...c?Ma(c):[],...t?Ma(t):[]]:[];h.forEach(m=>{i&&m.addEventListener("scroll",n),o&&m.addEventListener("resize",n)});const d=c&&l?Zj(c,n,o):null;let u=-1,p=null;s&&(p=new ResizeObserver(m=>{let[A]=m;A&&A.target===c&&p&&t&&(p.unobserve(t),cancelAnimationFrame(u),u=requestAnimationFrame(()=>{var w;(w=p)==null||w.observe(t)})),n()}),c&&!a&&p.observe(c),t&&p.observe(t));let g,y=a?_o(e):null;a&&q();function q(){const m=_o(e);y&&!Cm(y,m)&&n(),y=m,g=requestAnimationFrame(q)}return n(),()=>{var m;h.forEach(A=>{i&&A.removeEventListener("scroll",n),o&&A.removeEventListener("resize",n)}),d==null||d(),(m=p)==null||m.disconnect(),p=null,a&&cancelAnimationFrame(g)}}const Jj=Sj,ez=Cj,tz=kj,nz=Rj,rz=jj,T0=Vj,iz=Ej,oz=(e,t,n)=>{const r=new Map,i=n??{},o={...Yj,...i.platform,_c:r};return bj(e,t,{...i,platform:o})};var sz=typeof document<"u",lz=function(){},Su=sz?v.useLayoutEffect:lz;function p1(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!p1(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){const o=i[r];if(!(o==="_owner"&&e.$$typeof)&&!p1(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function Em(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function M0(e,t){const n=Em(e);return Math.round(t*n)/n}function gh(e){const t=v.useRef(e);return Su(()=>{t.current=e}),t}function az(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:o,floating:s}={},transform:l=!0,whileElementsMounted:a,open:c}=e,[h,d]=v.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[u,p]=v.useState(r);p1(u,r)||p(r);const[g,y]=v.useState(null),[q,m]=v.useState(null),A=v.useCallback(M=>{M!==k.current&&(k.current=M,y(M))},[]),w=v.useCallback(M=>{M!==b.current&&(b.current=M,m(M))},[]),x=o||g,V=s||q,k=v.useRef(null),b=v.useRef(null),j=v.useRef(h),z=a!=null,S=gh(a),R=gh(i),T=gh(c),E=v.useCallback(()=>{if(!k.current||!b.current)return;const M={placement:t,strategy:n,middleware:u};R.current&&(M.platform=R.current),oz(k.current,b.current,M).then(N=>{const O={...N,isPositioned:T.current!==!1};C.current&&!p1(j.current,O)&&(j.current=O,nc.flushSync(()=>{d(O)}))})},[u,t,n,R,T]);Su(()=>{c===!1&&j.current.isPositioned&&(j.current.isPositioned=!1,d(M=>({...M,isPositioned:!1})))},[c]);const C=v.useRef(!1);Su(()=>(C.current=!0,()=>{C.current=!1}),[]),Su(()=>{if(x&&(k.current=x),V&&(b.current=V),x&&V){if(S.current)return S.current(x,V,E);E()}},[x,V,E,S,z]);const _=v.useMemo(()=>({reference:k,floating:b,setReference:A,setFloating:w}),[A,w]),L=v.useMemo(()=>({reference:x,floating:V}),[x,V]),D=v.useMemo(()=>{const M={position:n,left:0,top:0};if(!L.floating)return M;const N=M0(L.floating,h.x),O=M0(L.floating,h.y);return l?{...M,transform:"translate("+N+"px, "+O+"px)",...Em(L.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:N,top:O}},[n,l,L.floating,h.x,h.y]);return v.useMemo(()=>({...h,update:E,refs:_,elements:L,floatingStyles:D}),[h,E,_,L,D])}const cz=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:i}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?T0({element:r.current,padding:i}).fn(n):{}:r?T0({element:r,padding:i}).fn(n):{}}}},uz=(e,t)=>{const n=Jj(e);return{name:n.name,fn:n.fn,options:[e,t]}},dz=(e,t)=>{const n=ez(e);return{name:n.name,fn:n.fn,options:[e,t]}},hz=(e,t)=>({fn:iz(e).fn,options:[e,t]}),fz=(e,t)=>{const n=tz(e);return{name:n.name,fn:n.fn,options:[e,t]}},gz=(e,t)=>{const n=nz(e);return{name:n.name,fn:n.fn,options:[e,t]}},pz=(e,t)=>{const n=rz(e);return{name:n.name,fn:n.fn,options:[e,t]}},mz=(e,t)=>{const n=cz(e);return{name:n.name,fn:n.fn,options:[e,t]}};var yz=Object.defineProperty,Az=(e,t)=>yz(e,"name",{value:t,configurable:!0}),vz=v.forwardRef(Az(function(t,n){const{children:r,width:i=10,height:o=5,...s}=t;return f.jsx(at.svg,{...s,ref:n,width:i,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:f.jsx("polygon",{points:"0,0 30,0 15,10"})})},"Arrow")),qz=vz,wz=Object.defineProperty,xz=(e,t)=>wz(e,"name",{value:t,configurable:!0});function Rm(e){const[t,n]=v.useState(void 0);return un(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const o=i[0];let s,l;if("borderBoxSize"in o){const a=o.borderBoxSize,c=Array.isArray(a)?a[0]:a;s=c.inlineSize,l=c.blockSize}else s=e.offsetWidth,l=e.offsetHeight;n({width:s,height:l})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}xz(Rm,"useSize");var bz=Object.defineProperty,Mr=(e,t)=>bz(e,"name",{value:t,configurable:!0}),_m="Popper",[Tm,dd]=ic(_m),[Vz,Mm]=Tm(_m),kz=Mr(e=>{const{__scopePopper:t,children:n}=e,[r,i]=v.useState(null),[o,s]=v.useState(void 0);return f.jsx(Vz,{scope:t,anchor:r,onAnchorChange:i,placementState:o,setPlacementState:s,children:n})},"Popper"),jz="PopperAnchor",zz=v.forwardRef(Mr(function(t,n){const{__scopePopper:r,virtualRef:i,...o}=t,s=Mm(jz,r),l=v.useRef(null),a=s.onAnchorChange,c=v.useCallback(y=>{l.current=y,y&&a(y)},[a]),h=_n(n,c),d=v.useRef(null);v.useEffect(()=>{if(!i)return;const y=d.current;d.current=i.current,y!==d.current&&a(d.current)});const u=s.placementState&&hd(s.placementState),p=u==null?void 0:u[0],g=u==null?void 0:u[1];return i?null:f.jsx(at.div,{"data-radix-popper-side":p,"data-radix-popper-align":g,...o,ref:h})},"PopperAnchor")),Pm="PopperContent",[Sz,Cz]=Tm(Pm),Ez=v.forwardRef(Mr(function(t,n){var ie,be,Ae,qe,ze,Ve,ge;const{__scopePopper:r,side:i="bottom",sideOffset:o=0,align:s="center",alignOffset:l=0,arrowPadding:a=0,avoidCollisions:c=!0,collisionBoundary:h=[],collisionPadding:d=0,sticky:u="partial",hideWhenDetached:p=!1,updatePositionStrategy:g="optimized",onPlaced:y,...q}=t,m=Mm(Pm,r),[A,w]=v.useState(null),x=_n(n,w),[V,k]=v.useState(null),b=Rm(V),j=(b==null?void 0:b.width)??0,z=(b==null?void 0:b.height)??0,S=i+(s!=="center"?"-"+s:""),R=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},T=Array.isArray(h)?h:[h],E=T.length>0,C={padding:R,boundary:T.filter(Im),altBoundary:E},{refs:_,floatingStyles:L,placement:D,isPositioned:M,middlewareData:N}=az({strategy:"fixed",placement:S,whileElementsMounted:Mr((...ye)=>Xj(...ye,{animationFrame:g==="always"}),"whileElementsMounted"),elements:{reference:m.anchor},middleware:[uz({mainAxis:o+z,alignmentAxis:l}),c&&dz({mainAxis:!0,crossAxis:!1,limiter:u==="partial"?hz():void 0,...C}),c&&fz({...C}),gz({...C,apply:Mr(({elements:ye,rects:Ee,availableWidth:ae,availableHeight:dt})=>{const{width:Lt,height:I}=Ee.reference,X=ye.floating.style;X.setProperty("--radix-popper-available-width",`${ae}px`),X.setProperty("--radix-popper-available-height",`${dt}px`),X.setProperty("--radix-popper-anchor-width",`${Lt}px`),X.setProperty("--radix-popper-anchor-height",`${I}px`)},"apply")}),V&&mz({element:V,padding:a}),Mz({arrowWidth:j,arrowHeight:z}),p&&pz({strategy:"referenceHidden",...C,boundary:E?C.boundary:void 0})]}),O=m.setPlacementState;un(()=>(O(D),()=>{O(void 0)}),[D,O]);const[$,P]=hd(D),H=Eo(y);un(()=>{M&&(H==null||H())},[M,H]);const Z=(ie=N.arrow)==null?void 0:ie.x,G=(be=N.arrow)==null?void 0:be.y,Q=((Ae=N.arrow)==null?void 0:Ae.centerOffset)!==0,[le,F]=v.useState();return un(()=>{A&&F(window.getComputedStyle(A).zIndex)},[A]),f.jsx("div",{ref:_.setFloating,"data-radix-popper-content-wrapper":"",style:{...L,transform:M?L.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:le,"--radix-popper-transform-origin":[(qe=N.transformOrigin)==null?void 0:qe.x,(ze=N.transformOrigin)==null?void 0:ze.y].join(" "),...((Ve=N.hide)==null?void 0:Ve.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:f.jsx(Sz,{scope:r,placedSide:$,placedAlign:P,onArrowChange:k,arrowX:Z,arrowY:G,shouldHideArrow:Q,children:f.jsx(at.div,{"data-side":$,"data-align":P,...q,ref:x,style:{...q.style,animation:M?(ge=q.style)==null?void 0:ge.animation:"none"}})})})},"PopperContent")),Rz="PopperArrow",_z={top:"bottom",right:"left",bottom:"top",left:"right"},Tz=v.forwardRef(Mr(function(t,n){const{__scopePopper:r,...i}=t,o=Cz(Rz,r),s=_z[o.placedSide];return f.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:f.jsx(qz,{...i,ref:n,style:{...i.style,display:"block"}})})},"PopperArrow"));function Im(e){return e!==null}Mr(Im,"isNotNull");var Mz=Mr(e=>({name:"transformOrigin",options:e,fn(t){var q,m,A;const{placement:n,rects:r,middlewareData:i}=t,s=((q=i.arrow)==null?void 0:q.centerOffset)!==0,l=s?0:e.arrowWidth,a=s?0:e.arrowHeight,[c,h]=hd(n),d={start:"0%",center:"50%",end:"100%"}[h],u=(((m=i.arrow)==null?void 0:m.x)??0)+l/2,p=(((A=i.arrow)==null?void 0:A.y)??0)+a/2;let g="",y="";return c==="bottom"?(g=s?d:`${u}px`,y=`${-a}px`):c==="top"?(g=s?d:`${u}px`,y=`${r.floating.height+a}px`):c==="right"?(g=`${-a}px`,y=s?d:`${p}px`):c==="left"&&(g=`${r.floating.width+a}px`,y=s?d:`${p}px`),{data:{x:g,y}}}}),"transformOrigin");function hd(e){const[t,n="center"]=e.split("-");return[t,n]}Mr(hd,"getSideAndAlignFromPlacement");var Lm=kz,Nm=zz,Dm=Ez,Pz=Tz,Iz=Object.defineProperty,Lz=(e,t)=>Iz(e,"name",{value:t,configurable:!0}),g4=v.forwardRef(Lz(function(t,n){var a;const{container:r,...i}=t,[o,s]=v.useState(!1);un(()=>s(!0),[]);const l=r||o&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return l?nc.createPortal(f.jsx(at.div,{...i,ref:n}),l):null},"Portal")),Nz=Object.defineProperty,Br=(e,t)=>Nz(e,"name",{value:t,configurable:!0});function Om(e,t){return v.useReducer((n,r)=>t[n][r]??n,e)}Br(Om,"useStateMachine");var Fo=Br(e=>{const{present:t,children:n}=e,r=Bm(t),i=typeof n=="function"?n({present:r.isPresent}):v.Children.only(n),o=Fm(r.ref,Hm(i));return typeof n=="function"||r.isPresent?v.cloneElement(i,{ref:o}):null},"Presence");function Bm(e){const[t,n]=v.useState(),r=v.useRef(null),i=v.useRef(e),o=v.useRef("none"),s=v.useRef(void 0),l=e?"mounted":"unmounted",[a,c]=Om(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return v.useEffect(()=>{a==="mounted"?(o.current=s.current??os(r.current),s.current=void 0):o.current="none"},[a]),un(()=>{const h=r.current,d=i.current;if(d!==e){const p=o.current,g=os(h);e?(s.current=g,c("MOUNT")):g==="none"||(h==null?void 0:h.display)==="none"?c("UNMOUNT"):c(d&&p!==g?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,c]),un(()=>{if(t){let h;const d=t.ownerDocument.defaultView??window,u=Br(g=>{const q=os(r.current).includes(CSS.escape(g.animationName));if(g.target===t&&q&&(c("ANIMATION_END"),!i.current)){const m=t.style.animationFillMode;t.style.animationFillMode="forwards",h=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=m)})}},"handleAnimationEnd"),p=Br(g=>{g.target===t&&(o.current=os(r.current))},"handleAnimationStart");return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",u),t.addEventListener("animationend",u),()=>{d.clearTimeout(h),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",u),t.removeEventListener("animationend",u)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:v.useCallback(h=>{if(h){const d=getComputedStyle(h);r.current=d,s.current=os(d)}else r.current=null;n(h)},[])}}Br(Bm,"usePresence");function uf(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}Br(uf,"setRef");function Fm(...e){const t=v.useRef(e);return t.current=e,v.useCallback(n=>{const r=t.current;let i=!1;const o=r.map(s=>{const l=uf(s,n);return!i&&typeof l=="function"&&(i=!0),l});if(i)return()=>{for(let s=0;s<o.length;s++){const l=o[s];typeof l=="function"?l():uf(r[s],null)}}},[])}Br(Fm,"useStableComposedRefs");function os(e){return(e==null?void 0:e.animationName)||"none"}Br(os,"getAnimationName");function Hm(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}Br(Hm,"getElementRef");var Dz=Object.defineProperty,Oz=(e,t)=>Dz(e,"name",{value:t,configurable:!0}),P0=Za[" useEffectEvent ".trim().toString()],I0=Za[" useInsertionEffect ".trim().toString()];function Um(e){if(typeof P0=="function")return P0(e);const t=v.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof I0=="function"?I0(()=>{t.current=e}):un(()=>{t.current=e}),v.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}Oz(Um,"useEffectEvent");var Bz=Object.defineProperty,oc=(e,t)=>Bz(e,"name",{value:t,configurable:!0}),Fz=Za[" useInsertionEffect ".trim().toString()]||un;function fd({prop:e,defaultProp:t,onChange:n=oc(()=>{},"onChange"),caller:r}){const[i,o,s]=Wm({defaultProp:t,onChange:n}),l=e!==void 0,a=l?e:i,c=v.useCallback(h=>{var d;if(l){const u=Km(h)?h(e):h;u!==e&&((d=s.current)==null||d.call(s,u))}else o(h)},[l,e,o,s]);return[a,c]}oc(fd,"useControllableState");function Wm({defaultProp:e,onChange:t}){const[n,r]=v.useState(e),i=v.useRef(n),o=v.useRef(t);return Fz(()=>{o.current=t},[t]),v.useEffect(()=>{var s;i.current!==n&&((s=o.current)==null||s.call(o,n),i.current=n)},[n,i]),[n,r,o]}oc(Wm,"useUncontrolledState");function Km(e){return typeof e=="function"}oc(Km,"isFunction");var L0=Symbol("RADIX:SYNC_STATE");function Hz(e,t,n,r){const{prop:i,defaultProp:o,onChange:s,caller:l}=t,a=i!==void 0,c=Um(s),h=[{...n,state:o}];r&&h.push(r);const[d,u]=v.useReducer((q,m)=>{if(m.type===L0)return{...q,state:m.state};const A=e(q,m);return a&&!Object.is(A.state,q.state)&&c(A.state),A},...h),p=d.state,g=v.useRef(p);v.useEffect(()=>{g.current!==p&&(g.current=p,a||c(p))},[p,g,a]);const y=v.useMemo(()=>i!==void 0?{...d,state:i}:d,[d,i]);return v.useEffect(()=>{a&&!Object.is(i,d.state)&&u({type:L0,state:i})},[i,d.state,a]),[y,u]}oc(Hz,"useControllableStateReducer");var Uz=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Yo=new WeakMap,Gc=new WeakMap,Qc={},ph=0,$m=function(e){return e&&(e.host||$m(e.parentNode))},Wz=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=$m(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},Kz=function(e,t,n,r){var i=Wz(t,Array.isArray(e)?e:[e]);Qc[n]||(Qc[n]=new WeakMap);var o=Qc[n],s=[],l=new Set,a=new Set(i),c=function(d){!d||l.has(d)||(l.add(d),c(d.parentNode))};i.forEach(c);var h=function(d){!d||a.has(d)||Array.prototype.forEach.call(d.children,function(u){if(l.has(u))h(u);else try{var p=u.getAttribute(r),g=p!==null&&p!=="false",y=(Yo.get(u)||0)+1,q=(o.get(u)||0)+1;Yo.set(u,y),o.set(u,q),s.push(u),y===1&&g&&Gc.set(u,!0),q===1&&u.setAttribute(n,"true"),g||u.setAttribute(r,"true")}catch(m){console.error("aria-hidden: cannot operate on ",u,m)}})};return h(t),l.clear(),ph++,function(){s.forEach(function(d){var u=Yo.get(d)-1,p=o.get(d)-1;Yo.set(d,u),o.set(d,p),u||(Gc.has(d)||d.removeAttribute(r),Gc.delete(d)),p||d.removeAttribute(n)}),ph--,ph||(Yo=new WeakMap,Yo=new WeakMap,Gc=new WeakMap,Qc={})}},Gm=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),i=Uz(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),Kz(r,i,n,"aria-hidden")):function(){return null}},or=function(){return or=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},or.apply(this,arguments)};function Qm(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function $z(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,o;r<i;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}var Cu="right-scroll-bar-position",Eu="width-before-scroll-bar",Gz="with-scroll-bars-hidden",Qz="--removed-body-scroll-bar-size";function mh(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Yz(e,t){var n=v.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var i=n.value;i!==r&&(n.value=r,n.callback(r,i))}}}})[0];return n.callback=t,n.facade}var Zz=typeof window<"u"?v.useLayoutEffect:v.useEffect,N0=new WeakMap;function Xz(e,t){var n=Yz(null,function(r){return e.forEach(function(i){return mh(i,r)})});return Zz(function(){var r=N0.get(n);if(r){var i=new Set(r),o=new Set(e),s=n.current;i.forEach(function(l){o.has(l)||mh(l,null)}),o.forEach(function(l){i.has(l)||mh(l,s)})}N0.set(n,e)},[e]),n}function Jz(e){return e}function eS(e,t){t===void 0&&(t=Jz);var n=[],r=!1,i={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(o){var s=t(o,r);return n.push(s),function(){n=n.filter(function(l){return l!==s})}},assignSyncMedium:function(o){for(r=!0;n.length;){var s=n;n=[],s.forEach(o)}n={push:function(l){return o(l)},filter:function(){return n}}},assignMedium:function(o){r=!0;var s=[];if(n.length){var l=n;n=[],l.forEach(o),s=n}var a=function(){var h=s;s=[],h.forEach(o)},c=function(){return Promise.resolve().then(a)};c(),n={push:function(h){s.push(h),c()},filter:function(h){return s=s.filter(h),n}}}};return i}function tS(e){e===void 0&&(e={});var t=eS(null);return t.options=or({async:!0,ssr:!1},e),t}var Ym=function(e){var t=e.sideCar,n=Qm(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return v.createElement(r,or({},n))};Ym.isSideCarExport=!0;function nS(e,t){return e.useMedium(t),Ym}var Zm=tS(),yh=function(){},gd=v.forwardRef(function(e,t){var n=v.useRef(null),r=v.useState({onScrollCapture:yh,onWheelCapture:yh,onTouchMoveCapture:yh}),i=r[0],o=r[1],s=e.forwardProps,l=e.children,a=e.className,c=e.removeScrollBar,h=e.enabled,d=e.shards,u=e.sideCar,p=e.noRelative,g=e.noIsolation,y=e.inert,q=e.allowPinchZoom,m=e.as,A=m===void 0?"div":m,w=e.gapMode,x=Qm(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),V=u,k=Xz([n,t]),b=or(or({},x),i);return v.createElement(v.Fragment,null,h&&v.createElement(V,{sideCar:Zm,removeScrollBar:c,shards:d,noRelative:p,noIsolation:g,inert:y,setCallbacks:o,allowPinchZoom:!!q,lockRef:n,gapMode:w}),s?v.cloneElement(v.Children.only(l),or(or({},b),{ref:k})):v.createElement(A,or({},b,{className:a,ref:k}),l))});gd.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};gd.classNames={fullWidth:Eu,zeroRight:Cu};var rS=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function iS(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=rS();return t&&e.setAttribute("nonce",t),e}function oS(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function sS(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var lS=function(){var e=0,t=null;return{add:function(n){e==0&&(t=iS())&&(oS(t,n),sS(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},aS=function(){var e=lS();return function(t,n){v.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Xm=function(){var e=aS(),t=function(n){var r=n.styles,i=n.dynamic;return e(r,i),null};return t},cS={left:0,top:0,right:0,gap:0},Ah=function(e){return parseInt(e||"",10)||0},uS=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],i=t[e==="padding"?"paddingRight":"marginRight"];return[Ah(n),Ah(r),Ah(i)]},dS=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return cS;var t=uS(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},hS=Xm(),Ns="data-scroll-locked",fS=function(e,t,n,r){var i=e.left,o=e.top,s=e.right,l=e.gap;return n===void 0&&(n="margin"),`
58
58
  .`.concat(Gz,` {
59
59
  overflow: hidden `).concat(r,`;
60
60
  padding-right: `).concat(l,"px ").concat(r,`;
@@ -177,7 +177,7 @@ Error generating stack: `+o.message+`
177
177
  `)}function WP(e){const{card:t}=e,n=t.question?KP(t.question):"";return f.jsx(gc,{type:"snippet",variant:"centered",slots:[{role:"title",content:t.title},n?{role:"image",content:f.jsx(Ag,{source:n})}:{role:"image",content:null},{role:"arena",content:f.jsx(ml,{...yl(e)},t.id)}]})}function KP(e){const t=[];for(const n of e.split(`
178
178
  `))/!\[[^\]]*\]\([^)]*\)/.test(n)&&t.push(n);return t.join(`
179
179
 
180
- `)}function t6(e){const{card:t}=e;return f.jsx(gc,{type:"qa",variant:"flow",slots:[{role:"title",content:t.title},t.question?{role:"question",content:f.jsx(Ag,{source:t.question})}:{role:"question",content:null},{role:"arena",content:f.jsx(ml,{...yl(e)},t.id)}]})}const $P=v.lazy(()=>tg(()=>import("./index-BsZ7hVEw.js"),[]).then(e=>({default:e.CodeCard})));function GP(e){switch(e.card.type){case"word":return f.jsx(BP,{...e});case"sentence":return f.jsx(FP,{...e});case"article":return f.jsx(HP,{...e});case"snippet":return f.jsx(WP,{...e});case"qa":return f.jsx(t6,{...e});case"code":return f.jsx(v.Suspense,{fallback:f.jsx(t6,{...e}),children:f.jsx($P,{...e})});default:return f.jsx(_P,{...e})}}const QP="doneCards";function Ll(e){return typeof e=="number"&&Number.isFinite(e)}function ov(e){const t=e;return{wpm:Ll(t==null?void 0:t.wpm)?t.wpm:0,cpm:Ll(t==null?void 0:t.cpm)?t.cpm:0,accuracy:Ll(t==null?void 0:t.accuracy)?t.accuracy:0,elapsedMs:Ll(t==null?void 0:t.elapsedMs)?t.elapsedMs:0,ts:Ll(t==null?void 0:t.ts)?t.ts:0}}const n6={serialize:e=>JSON.stringify(e),deserialize:e=>{try{const t=JSON.parse(e);if(t&&typeof t=="object"&&!Array.isArray(t)){const n={};for(const[r,i]of Object.entries(t))if(!(typeof r!="string"||r.length===0)&&Array.isArray(i)){const o=[];for(const s of i)o.push(ov(s));n[r]=o}return n}}catch{}return{}}};function rg(){const[e,t]=de("progress",QP,()=>({}),n6),n=v.useCallback(()=>{t({})},[t]),r=v.useCallback(y=>{t(q=>{const m={...q};let A=!1;for(const w of y)w in m&&(delete m[w],A=!0);return A?m:q})},[t]),i=v.useCallback((y,q)=>{let m=!1;const A=ov({...q,ts:(q==null?void 0:q.ts)??Date.now()});return t(w=>{const x=w[y]??[];x.length===0&&(m=!0);const V=[...x,A].slice(-20);return{...w,[y]:V}}),m},[t]),o=v.useCallback(y=>e[y]!==void 0,[e]),s=v.useCallback(y=>{const q=e[y];return q&&q.length>0?q[q.length-1]:null},[e]),l=v.useCallback(y=>e[y]??[],[e]),a=v.useCallback(y=>{let q=0;for(const m of y)e[m]!==void 0&&q++;return q},[e]),c=v.useCallback(y=>{if(y.length===0)return!1;for(const q of y)if(e[q]===void 0)return!1;return!0},[e]),h=v.useCallback(y=>{const q=[];for(const m of y){const A=e[m];if(!A||A.length===0)continue;const w=A[A.length-1];w.ts>0&&q.push(w.wpm)}return q},[e]),d=v.useCallback(y=>{let q=0,m=0,A=!1;for(const w of y){const x=e[w];if(!x||x.length===0)continue;const V=x[x.length-1];A=!0,V.wpm>q&&(q=V.wpm),V.ts>m&&(m=V.ts)}return A?{peakWpm:q,latestTs:m}:null},[e]),u=v.useCallback(()=>({cardMap:e}),[e]),p=v.useCallback(y=>{if(!y||typeof y!="object")throw new Error("err.badData");const q=y,m=q.cardMap&&typeof q.cardMap=="object"?q.cardMap:{},A=n6.deserialize(JSON.stringify(m));t(A)},[t]);return v.useMemo(()=>({cardMap:e,clearAll:n,clearIds:r,markCardDone:i,isCardDone:o,cardStats:s,cardHistory:l,doneCountOf:a,isMaterialDone:c,wpmSeriesOf:h,bestOf:d,exportProgress:u,importProgress:p}),[e,n,r,i,o,s,l,a,c,h,d,u,p])}let Nh=null;const If=new Set;function r6(){for(const e of If)e()}const wo={get(){return Nh},set(e){Nh=e,r6()},clear(){Nh=null,r6()},subscribe(e){return If.add(e),()=>{If.delete(e)}}};function YP(){return v.useSyncExternalStore(wo.subscribe,wo.get,wo.get)}function ZP(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global}function XP(){const e=ZP();if(e.__xstate__)return e.__xstate__}const JP=e=>{if(typeof window>"u")return;const t=XP();t&&t.register(e)};class i6{constructor(t){this._process=t,this._active=!1,this._current=null,this._last=null}start(){this._active=!0,this.flush()}clear(){this._current&&(this._current.next=null,this._last=this._current)}enqueue(t){const n={value:t,next:null};if(this._current){this._last.next=n,this._last=n;return}this._current=n,this._last=n,this._active&&this.flush()}flush(){for(;this._current;){const t=this._current;this._process(t.value),this._current=t.next}this._last=null}}const sv=".",eI="",lv="",tI="#",nI="*",av="xstate.init",rI="xstate.error",Lf="xstate.stop";function iI(e,t){return{type:`xstate.after.${e}.${t}`}}function Nf(e,t){return{type:`xstate.done.state.${e}`,output:t}}function oI(e,t){return{type:`xstate.done.actor.${e}`,output:t,actorId:e}}function cv(e,t){return{type:`xstate.error.actor.${e}`,error:t,actorId:e}}function uv(e){return{type:av,input:e}}function Jn(e){setTimeout(()=>{throw e})}const sI=typeof Symbol=="function"&&Symbol.observable||"@@observable";function dv(e,t){const n=o6(e),r=o6(t);return typeof r=="string"?typeof n=="string"?r===n:!1:typeof n=="string"?n in r:Object.keys(n).every(i=>i in r?dv(n[i],r[i]):!1)}function ig(e){if(fv(e))return e;const t=[];let n="";for(let r=0;r<e.length;r++){switch(e.charCodeAt(r)){case 92:n+=e[r+1],r++;continue;case 46:t.push(n),n="";continue}n+=e[r]}return t.push(n),t}function o6(e){if(HI(e))return e.value;if(typeof e!="string")return e;const t=ig(e);return lI(t)}function lI(e){if(e.length===1)return e[0];const t={};let n=t;for(let r=0;r<e.length-1;r++)if(r===e.length-2)n[e[r]]=e[r+1];else{const i=n;n={},i[e[r]]=n}return t}function s6(e,t){const n={},r=Object.keys(e);for(let i=0;i<r.length;i++){const o=r[i];n[o]=t(e[o],o,e,i)}return n}function hv(e){return fv(e)?e:[e]}function Ai(e){return e===void 0?[]:hv(e)}function Df(e,t,n,r){return typeof e=="function"?e({context:t,event:n,self:r}):e}function fv(e){return Array.isArray(e)}function aI(e){return e.type.startsWith("xstate.error.actor")}function as(e){return hv(e).map(t=>typeof t>"u"||typeof t=="string"?{target:t}:t)}function gv(e){if(!(e===void 0||e===eI))return Ai(e)}function Tu(e,t,n){var o,s,l;const r=typeof e=="object",i=r?e:void 0;return{next:(o=r?e.next:e)==null?void 0:o.bind(i),error:(s=r?e.error:t)==null?void 0:s.bind(i),complete:(l=r?e.complete:n)==null?void 0:l.bind(i)}}function l6(e,t){return`${t}.${e}`}function og(e,t){const n=t.match(/^xstate\.invoke\.(\d+)\.(.*)/);if(!n)return e.implementations.actors[t];const[,r,i]=n,s=e.getStateNodeById(i).config.invoke;return(Array.isArray(s)?s[r]:s).src}function cI(e,t){if(t===e||t===nI)return!0;if(!t.endsWith(".*"))return!1;const n=t.split("."),r=e.split(".");for(let i=0;i<n.length;i++){const o=n[i],s=r[i];if(o==="*")return i===n.length-1;if(o!==s)return!1}return!0}function a6(e,t){return`${e.sessionId}.${t}`}let uI=0;function dI(e,t){const n=new Map,r=new Map,i=new WeakMap,o=new Set,s={},{clock:l,logger:a}=t,c={schedule:(u,p,g,y,q=Math.random().toString(36).slice(2))=>{const m={source:u,target:p,event:g,delay:y,id:q,startedAt:Date.now()},A=a6(u,q);d._snapshot._scheduledEvents[A]=m;const w=l.setTimeout(()=>{delete s[A],delete d._snapshot._scheduledEvents[A],d._relay(u,p,g)},y);s[A]=w},cancel:(u,p)=>{const g=a6(u,p),y=s[g];delete s[g],delete d._snapshot._scheduledEvents[g],y!==void 0&&l.clearTimeout(y)},cancelAll:u=>{for(const p in d._snapshot._scheduledEvents){const g=d._snapshot._scheduledEvents[p];g.source===u&&c.cancel(u,g.id)}}},h=u=>{if(!o.size)return;const p={...u,rootId:e.sessionId};o.forEach(g=>{var y;return(y=g.next)==null?void 0:y.call(g,p)})},d={_snapshot:{_scheduledEvents:((t==null?void 0:t.snapshot)&&t.snapshot.scheduler)??{}},_bookId:()=>`x:${uI++}`,_register:(u,p)=>(n.set(u,p),u),_unregister:u=>{n.delete(u.sessionId);const p=i.get(u);p!==void 0&&(r.delete(p),i.delete(u))},get:u=>r.get(u),getAll:()=>Object.fromEntries(r.entries()),_set:(u,p)=>{const g=r.get(u);if(g&&g!==p)throw new Error(`Actor with system ID '${u}' already exists.`);r.set(u,p),i.set(p,u)},inspect:u=>{const p=Tu(u);return o.add(p),{unsubscribe(){o.delete(p)}}},_sendInspectionEvent:h,_relay:(u,p,g)=>{d._sendInspectionEvent({type:"@xstate.event",sourceRef:u,actorRef:p,event:g}),p._send(g)},scheduler:c,getSnapshot:()=>({_scheduledEvents:{...d._snapshot._scheduledEvents}}),start:()=>{const u=d._snapshot._scheduledEvents;d._snapshot._scheduledEvents={};for(const p in u){const{source:g,target:y,event:q,delay:m,id:A}=u[p];c.schedule(g,y,q,m,A)}},_clock:l,_logger:a};return d}let Dh=!1;const sg=1;let Qt=function(e){return e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped",e}({});const hI={clock:{setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e)},logger:console.log.bind(console),devTools:!1};class fI{constructor(t,n){this.logic=t,this._snapshot=void 0,this.clock=void 0,this.options=void 0,this.id=void 0,this.mailbox=new i6(this._process.bind(this)),this.observers=new Set,this.eventListeners=new Map,this.logger=void 0,this._processingStatus=Qt.NotStarted,this._parent=void 0,this._syncSnapshot=void 0,this.ref=void 0,this._actorScope=void 0,this.systemId=void 0,this.sessionId=void 0,this.system=void 0,this._doneEvent=void 0,this.src=void 0,this._deferred=[];const r={...hI,...n},{clock:i,logger:o,parent:s,syncSnapshot:l,id:a,systemId:c,inspect:h}=r;this.system=s?s.system:dI(this,{clock:i,logger:o}),h&&!s&&this.system.inspect(Tu(h)),this.sessionId=this.system._bookId(),this.id=a??this.sessionId,this.logger=(n==null?void 0:n.logger)??this.system._logger,this.clock=(n==null?void 0:n.clock)??this.system._clock,this._parent=s,this._syncSnapshot=l,this.options=r,this.src=r.src??t,this.ref=this,this._actorScope={self:this,id:this.id,sessionId:this.sessionId,logger:this.logger,defer:d=>{this._deferred.push(d)},system:this.system,stopChild:d=>{if(d._parent!==this)throw new Error(`Cannot stop child actor ${d.id} of ${this.id} because it is not a child`);d._stop()},emit:d=>{const u=this.eventListeners.get(d.type),p=this.eventListeners.get("*");if(!u&&!p)return;const g=[...u?u.values():[],...p?p.values():[]];for(const y of g)try{y(d)}catch(q){Jn(q)}},actionExecutor:d=>{const u=()=>{if(this._actorScope.system._sendInspectionEvent({type:"@xstate.action",actorRef:this,action:{type:d.type,params:d.params}}),!d.exec)return;const p=Dh;try{Dh=!0,d.exec(d.info,d.params)}finally{Dh=p}};this._processingStatus===Qt.Running?u():this._deferred.push(u)}},this.send=this.send.bind(this),this.system._sendInspectionEvent({type:"@xstate.actor",actorRef:this}),c&&(this.systemId=c,this.system._set(c,this)),this._initState((n==null?void 0:n.snapshot)??(n==null?void 0:n.state)),c&&this._snapshot.status!=="active"&&this.system._unregister(this)}_initState(t){var n;try{this._snapshot=t?this.logic.restoreSnapshot?this.logic.restoreSnapshot(t,this._actorScope):t:this.logic.getInitialSnapshot(this._actorScope,(n=this.options)==null?void 0:n.input)}catch(r){this._snapshot={status:"error",output:void 0,error:r}}}update(t,n){var i,o;this._snapshot=t;let r;for(;r=this._deferred.shift();)try{r()}catch(s){this._deferred.length=0,this._snapshot={...t,status:"error",error:s}}switch(this._snapshot.status){case"active":for(const s of this.observers)try{(i=s.next)==null||i.call(s,t)}catch(l){Jn(l)}break;case"done":for(const s of this.observers)try{(o=s.next)==null||o.call(s,t)}catch(l){Jn(l)}this._stopProcedure(),this._complete(),this._doneEvent=oI(this.id,this._snapshot.output),this._parent&&this.system._relay(this,this._parent,this._doneEvent);break;case"error":this._error(this._snapshot.error);break}this.system._sendInspectionEvent({type:"@xstate.snapshot",actorRef:this,event:n,snapshot:t})}subscribe(t,n,r){var o;const i=Tu(t,n,r);if(this._processingStatus!==Qt.Stopped)this.observers.add(i);else switch(this._snapshot.status){case"done":try{(o=i.complete)==null||o.call(i)}catch(s){Jn(s)}break;case"error":{const s=this._snapshot.error;if(!i.error)Jn(s);else try{i.error(s)}catch(l){Jn(l)}break}}return{unsubscribe:()=>{this.observers.delete(i)}}}on(t,n){let r=this.eventListeners.get(t);r||(r=new Set,this.eventListeners.set(t,r));const i=n.bind(void 0);return r.add(i),{unsubscribe:()=>{r.delete(i)}}}select(t,n=Object.is){return{subscribe:r=>{const i=Tu(r),o=this.getSnapshot();let s=t(o);return this.subscribe(l=>{var c;const a=t(l);n(s,a)||(s=a,(c=i.next)==null||c.call(i,a))})},get:()=>t(this.getSnapshot())}}start(){if(this._processingStatus===Qt.Running)return this;this._syncSnapshot&&this.subscribe({next:r=>{r.status==="active"&&this.system._relay(this,this._parent,{type:`xstate.snapshot.${this.id}`,snapshot:r})},error:()=>{}}),this.system._register(this.sessionId,this),this.systemId&&this.system._set(this.systemId,this),this._processingStatus=Qt.Running;const t=uv(this.options.input);switch(this.system._sendInspectionEvent({type:"@xstate.event",sourceRef:this._parent,actorRef:this,event:t}),this._snapshot.status){case"done":return this.update(this._snapshot,t),this;case"error":return this._error(this._snapshot.error),this}if(this._parent||this.system.start(),this.logic.start)try{this.logic.start(this._snapshot,this._actorScope)}catch(r){return this._snapshot={...this._snapshot,status:"error",error:r},this._error(r),this}return this.update(this._snapshot,t),this.options.devTools&&this.attachDevTools(),this.mailbox.start(),this}_process(t){let n,r;try{n=this.logic.transition(this._snapshot,t,this._actorScope)}catch(i){r={err:i}}if(r){const{err:i}=r;this._snapshot={...this._snapshot,status:"error",error:i},this._error(i);return}this.update(n,t),t.type===Lf&&(this._stopProcedure(),this._complete())}_stop(){return this._processingStatus===Qt.Stopped?this:(this.mailbox.clear(),this._processingStatus===Qt.NotStarted?(this._processingStatus=Qt.Stopped,this):(this.mailbox.enqueue({type:Lf}),this))}stop(){if(this._parent)throw new Error("A non-root actor cannot be stopped directly.");return this._stop()}_complete(){var t;for(const n of this.observers)try{(t=n.complete)==null||t.call(n)}catch(r){Jn(r)}this.observers.clear(),this.eventListeners.clear()}_reportError(t){if(!this.observers.size){this._parent||Jn(t),this.eventListeners.clear();return}let n=!1;for(const r of this.observers){const i=r.error;n||(n=!i);try{i==null||i(t)}catch(o){Jn(o)}}this.observers.clear(),this.eventListeners.clear(),n&&Jn(t)}_error(t){this._stopProcedure(),this._reportError(t),this._parent&&this.system._relay(this,this._parent,cv(this.id,t))}_stopProcedure(){return this._processingStatus!==Qt.Running?this:(this.system.scheduler.cancelAll(this),this.mailbox.clear(),this.mailbox=new i6(this._process.bind(this)),this._processingStatus=Qt.Stopped,this.system._unregister(this),this)}_send(t){this._processingStatus!==Qt.Stopped&&this.mailbox.enqueue(t)}send(t){this.system._relay(void 0,this,t)}attachDevTools(){const{devTools:t}=this.options;t&&(typeof t=="function"?t:JP)(this)}toJSON(){return{xstate$$type:sg,id:this.id}}getPersistedSnapshot(t){return this.logic.getPersistedSnapshot(this._snapshot,t)}[sI](){return this}getSnapshot(){return this._snapshot}}function il(e,...[t]){return new fI(e,t)}function gI(e,t,n,r,{sendId:i}){const o=typeof i=="function"?i(n,r):i;return[t,{sendId:o},void 0]}function pI(e,t){e.defer(()=>{e.system.scheduler.cancel(e.self,t.sendId)})}function lg(e){function t(n,r){}return t.type="xstate.cancel",t.sendId=e,t.resolve=gI,t.execute=pI,t}function mI(e,t,n,r,{id:i,systemId:o,src:s,input:l,syncSnapshot:a}){const c=typeof s=="string"?og(t.machine,s):s,h=typeof i=="function"?i(n):i;let d,u;return c&&(u=typeof l=="function"?l({context:t.context,event:n.event,self:e.self}):l,d=il(c,{id:h,src:s,parent:e.self,syncSnapshot:a,systemId:o,input:u})),[Bi(t,{children:{...t.children,[h]:d}}),{id:i,systemId:o,actorRef:d,src:s,input:u},void 0]}function yI(e,{actorRef:t}){t&&e.defer(()=>{t._processingStatus!==Qt.Stopped&&t.start()})}function ag(...[e,{id:t,systemId:n,input:r,syncSnapshot:i=!1}={}]){function o(s,l){}return o.type="xstate.spawnChild",o.id=t,o.systemId=n,o.src=e,o.input=r,o.syncSnapshot=i,o.resolve=mI,o.execute=yI,o}function AI(e,t,n,r,{actorRef:i}){const o=typeof i=="function"?i(n,r):i,s=typeof o=="string"?t.children[o]:o;let l=t.children;return s&&(l={...l},delete l[s.id]),[Bi(t,{children:l}),s,void 0]}function pv(e,t){const n=t.getSnapshot();if(n&&"children"in n)for(const r of Object.values(n.children))pv(e,r);e.system._unregister(t)}function vI(e,t){if(t){if(pv(e,t),t._processingStatus!==Qt.Running){e.stopChild(t);return}e.defer(()=>{e.stopChild(t)})}}function jd(e){function t(n,r){}return t.type="xstate.stopChild",t.actorRef=e,t.resolve=AI,t.execute=vI,t}function qI(e,{context:t,event:n},{guards:r}){return r.every(i=>pc(i,t,n,e))}function wI(e){function t(n,r){return!1}return t.check=qI,t.guards=e,t}function pc(e,t,n,r){const{machine:i}=r,o=typeof e=="function",s=o?e:i.implementations.guards[typeof e=="string"?e:e.type];if(!o&&!s)throw new Error(`Guard '${typeof e=="string"?e:e.type}' is not implemented.'.`);if(typeof s!="function")return pc(s,t,n,r);const l={context:t,event:n},a=o||typeof e=="string"?void 0:"params"in e?typeof e.params=="function"?e.params({context:t,event:n}):e.params:void 0;return"check"in s?s.check(r,l,s):s(l,a)}function cg(e){return e.type==="atomic"||e.type==="final"}function ol(e){return Object.values(e.states).filter(t=>t.type!=="history")}function mc(e,t){const n=[];if(t===e)return n;let r=e.parent;for(;r&&r!==t;)n.push(r),r=r.parent;return n}function S1(e){const t=new Set(e),n=yv(t);for(const r of t)if(r.type==="compound"&&(!n.get(r)||!n.get(r).length))c6(r).forEach(i=>t.add(i));else if(r.type==="parallel"){for(const i of ol(r))if(i.type!=="history"&&!t.has(i)){const o=c6(i);for(const s of o)t.add(s)}}for(const r of t){let i=r.parent;for(;i;)t.add(i),i=i.parent}return t}function mv(e,t){const n=t.get(e);if(!n)return{};if(e.type==="compound"){const i=n[0];if(i){if(cg(i))return i.key}else return{}}const r={};for(const i of n)r[i.key]=mv(i,t);return r}function yv(e){const t=new Map;for(const n of e)t.has(n)||t.set(n,[]),n.parent&&(t.has(n.parent)||t.set(n.parent,[]),t.get(n.parent).push(n));return t}function Av(e,t){const n=S1(t);return mv(e,yv(n))}function ug(e,t){return t.type==="compound"?ol(t).some(n=>n.type==="final"&&e.has(n)):t.type==="parallel"?ol(t).every(n=>ug(e,n)):t.type==="final"}const zd=e=>e[0]===tI;function xI(e,t){const n=e.transitions.get(t),r=[...e.transitions.keys()].filter(i=>i!==t&&cI(t,i)).sort((i,o)=>o.length-i.length).flatMap(i=>e.transitions.get(i));return n?[...n,...r]:r}function bI(e){const t=e.config.after;if(!t)return[];const n=i=>{const o=iI(i,e.id),s=o.type;return e.entry.push(fg(o,{id:s,delay:i})),e.exit.push(lg(s)),s};return Object.keys(t).flatMap(i=>{const o=t[i],s=typeof o=="string"?{target:o}:o,l=Number.isNaN(+i)?i:+i,a=n(l);return Ai(s).map(c=>({...c,event:a,delay:l}))}).map(i=>{const{delay:o}=i;return{...ui(e,i.event,i),delay:o}})}function ui(e,t,n){const r=gv(n.target),i=n.reenter??!1,o=zI(e,r),s={...n,actions:Ai(n.actions),guard:n.guard,target:o,source:e,reenter:i,eventType:t,toJSON:()=>({...s,source:`#${e.id}`,target:o?o.map(l=>`#${l.id}`):void 0})};return s}function VI(e){const t=new Map;if(e.config.on)for(const n of Object.keys(e.config.on)){if(n===lv)throw new Error('Null events ("") cannot be specified as a transition key. Use `always: { ... }` instead.');const r=e.config.on[n];t.set(n,as(r).map(i=>ui(e,n,i)))}if(e.config.onDone){const n=`xstate.done.state.${e.id}`;t.set(n,as(e.config.onDone).map(r=>ui(e,n,r)))}for(const n of e.invoke){if(n.onDone){const r=`xstate.done.actor.${n.id}`;t.set(r,as(n.onDone).map(i=>ui(e,r,i)))}if(n.onError){const r=`xstate.error.actor.${n.id}`;t.set(r,as(n.onError).map(i=>ui(e,r,i)))}if(n.onSnapshot){const r=`xstate.snapshot.${n.id}`;t.set(r,as(n.onSnapshot).map(i=>ui(e,r,i)))}}for(const n of e.after){let r=t.get(n.eventType);r||(r=[],t.set(n.eventType,r)),r.push(n)}return t}function kI(e){const t=[],n=r=>{Object.values(r).forEach(i=>{if(i.config.route&&i.config.id){const o=i.config.id,s=i.config.route.guard,l=({event:c})=>c.to===`#${o}`,a={...i.config.route,guard:s?wI([l,s]):l,target:`#${o}`};t.push(ui(e,"xstate.route",a))}i.states&&n(i.states)})};n(e.states),t.length>0&&e.transitions.set("xstate.route",t)}function jI(e,t){const n=typeof t=="string"?e.states[t]:t?e.states[t.target]:void 0;if(!n&&t)throw new Error(`Initial state node "${t}" not found on parent state node #${e.id}`);const r={source:e,actions:!t||typeof t=="string"?[]:Ai(t.actions),eventType:null,reenter:!1,target:n?[n]:[],toJSON:()=>({...r,source:`#${e.id}`,target:n?[`#${n.id}`]:[]})};return r}function zI(e,t){if(t!==void 0)return t.map(n=>{if(typeof n!="string")return n;if(zd(n))return e.machine.getStateNodeById(n);const r=n[0]===sv;if(r&&!e.parent)return C1(e,n.slice(1));const i=r?e.key+n:n;if(e.parent)try{return C1(e.parent,i)}catch(o){throw new Error(`Invalid transition definition for state node '${e.id}':
180
+ `)}function t6(e){const{card:t}=e;return f.jsx(gc,{type:"qa",variant:"flow",slots:[{role:"title",content:t.title},t.question?{role:"question",content:f.jsx(Ag,{source:t.question})}:{role:"question",content:null},{role:"arena",content:f.jsx(ml,{...yl(e)},t.id)}]})}const $P=v.lazy(()=>tg(()=>import("./index-BEGTg0_e.js"),[]).then(e=>({default:e.CodeCard})));function GP(e){switch(e.card.type){case"word":return f.jsx(BP,{...e});case"sentence":return f.jsx(FP,{...e});case"article":return f.jsx(HP,{...e});case"snippet":return f.jsx(WP,{...e});case"qa":return f.jsx(t6,{...e});case"code":return f.jsx(v.Suspense,{fallback:f.jsx(t6,{...e}),children:f.jsx($P,{...e})});default:return f.jsx(_P,{...e})}}const QP="doneCards";function Ll(e){return typeof e=="number"&&Number.isFinite(e)}function ov(e){const t=e;return{wpm:Ll(t==null?void 0:t.wpm)?t.wpm:0,cpm:Ll(t==null?void 0:t.cpm)?t.cpm:0,accuracy:Ll(t==null?void 0:t.accuracy)?t.accuracy:0,elapsedMs:Ll(t==null?void 0:t.elapsedMs)?t.elapsedMs:0,ts:Ll(t==null?void 0:t.ts)?t.ts:0}}const n6={serialize:e=>JSON.stringify(e),deserialize:e=>{try{const t=JSON.parse(e);if(t&&typeof t=="object"&&!Array.isArray(t)){const n={};for(const[r,i]of Object.entries(t))if(!(typeof r!="string"||r.length===0)&&Array.isArray(i)){const o=[];for(const s of i)o.push(ov(s));n[r]=o}return n}}catch{}return{}}};function rg(){const[e,t]=de("progress",QP,()=>({}),n6),n=v.useCallback(()=>{t({})},[t]),r=v.useCallback(y=>{t(q=>{const m={...q};let A=!1;for(const w of y)w in m&&(delete m[w],A=!0);return A?m:q})},[t]),i=v.useCallback((y,q)=>{let m=!1;const A=ov({...q,ts:(q==null?void 0:q.ts)??Date.now()});return t(w=>{const x=w[y]??[];x.length===0&&(m=!0);const V=[...x,A].slice(-20);return{...w,[y]:V}}),m},[t]),o=v.useCallback(y=>e[y]!==void 0,[e]),s=v.useCallback(y=>{const q=e[y];return q&&q.length>0?q[q.length-1]:null},[e]),l=v.useCallback(y=>e[y]??[],[e]),a=v.useCallback(y=>{let q=0;for(const m of y)e[m]!==void 0&&q++;return q},[e]),c=v.useCallback(y=>{if(y.length===0)return!1;for(const q of y)if(e[q]===void 0)return!1;return!0},[e]),h=v.useCallback(y=>{const q=[];for(const m of y){const A=e[m];if(!A||A.length===0)continue;const w=A[A.length-1];w.ts>0&&q.push(w.wpm)}return q},[e]),d=v.useCallback(y=>{let q=0,m=0,A=!1;for(const w of y){const x=e[w];if(!x||x.length===0)continue;const V=x[x.length-1];A=!0,V.wpm>q&&(q=V.wpm),V.ts>m&&(m=V.ts)}return A?{peakWpm:q,latestTs:m}:null},[e]),u=v.useCallback(()=>({cardMap:e}),[e]),p=v.useCallback(y=>{if(!y||typeof y!="object")throw new Error("err.badData");const q=y,m=q.cardMap&&typeof q.cardMap=="object"?q.cardMap:{},A=n6.deserialize(JSON.stringify(m));t(A)},[t]);return v.useMemo(()=>({cardMap:e,clearAll:n,clearIds:r,markCardDone:i,isCardDone:o,cardStats:s,cardHistory:l,doneCountOf:a,isMaterialDone:c,wpmSeriesOf:h,bestOf:d,exportProgress:u,importProgress:p}),[e,n,r,i,o,s,l,a,c,h,d,u,p])}let Nh=null;const If=new Set;function r6(){for(const e of If)e()}const wo={get(){return Nh},set(e){Nh=e,r6()},clear(){Nh=null,r6()},subscribe(e){return If.add(e),()=>{If.delete(e)}}};function YP(){return v.useSyncExternalStore(wo.subscribe,wo.get,wo.get)}function ZP(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global}function XP(){const e=ZP();if(e.__xstate__)return e.__xstate__}const JP=e=>{if(typeof window>"u")return;const t=XP();t&&t.register(e)};class i6{constructor(t){this._process=t,this._active=!1,this._current=null,this._last=null}start(){this._active=!0,this.flush()}clear(){this._current&&(this._current.next=null,this._last=this._current)}enqueue(t){const n={value:t,next:null};if(this._current){this._last.next=n,this._last=n;return}this._current=n,this._last=n,this._active&&this.flush()}flush(){for(;this._current;){const t=this._current;this._process(t.value),this._current=t.next}this._last=null}}const sv=".",eI="",lv="",tI="#",nI="*",av="xstate.init",rI="xstate.error",Lf="xstate.stop";function iI(e,t){return{type:`xstate.after.${e}.${t}`}}function Nf(e,t){return{type:`xstate.done.state.${e}`,output:t}}function oI(e,t){return{type:`xstate.done.actor.${e}`,output:t,actorId:e}}function cv(e,t){return{type:`xstate.error.actor.${e}`,error:t,actorId:e}}function uv(e){return{type:av,input:e}}function Jn(e){setTimeout(()=>{throw e})}const sI=typeof Symbol=="function"&&Symbol.observable||"@@observable";function dv(e,t){const n=o6(e),r=o6(t);return typeof r=="string"?typeof n=="string"?r===n:!1:typeof n=="string"?n in r:Object.keys(n).every(i=>i in r?dv(n[i],r[i]):!1)}function ig(e){if(fv(e))return e;const t=[];let n="";for(let r=0;r<e.length;r++){switch(e.charCodeAt(r)){case 92:n+=e[r+1],r++;continue;case 46:t.push(n),n="";continue}n+=e[r]}return t.push(n),t}function o6(e){if(HI(e))return e.value;if(typeof e!="string")return e;const t=ig(e);return lI(t)}function lI(e){if(e.length===1)return e[0];const t={};let n=t;for(let r=0;r<e.length-1;r++)if(r===e.length-2)n[e[r]]=e[r+1];else{const i=n;n={},i[e[r]]=n}return t}function s6(e,t){const n={},r=Object.keys(e);for(let i=0;i<r.length;i++){const o=r[i];n[o]=t(e[o],o,e,i)}return n}function hv(e){return fv(e)?e:[e]}function Ai(e){return e===void 0?[]:hv(e)}function Df(e,t,n,r){return typeof e=="function"?e({context:t,event:n,self:r}):e}function fv(e){return Array.isArray(e)}function aI(e){return e.type.startsWith("xstate.error.actor")}function as(e){return hv(e).map(t=>typeof t>"u"||typeof t=="string"?{target:t}:t)}function gv(e){if(!(e===void 0||e===eI))return Ai(e)}function Tu(e,t,n){var o,s,l;const r=typeof e=="object",i=r?e:void 0;return{next:(o=r?e.next:e)==null?void 0:o.bind(i),error:(s=r?e.error:t)==null?void 0:s.bind(i),complete:(l=r?e.complete:n)==null?void 0:l.bind(i)}}function l6(e,t){return`${t}.${e}`}function og(e,t){const n=t.match(/^xstate\.invoke\.(\d+)\.(.*)/);if(!n)return e.implementations.actors[t];const[,r,i]=n,s=e.getStateNodeById(i).config.invoke;return(Array.isArray(s)?s[r]:s).src}function cI(e,t){if(t===e||t===nI)return!0;if(!t.endsWith(".*"))return!1;const n=t.split("."),r=e.split(".");for(let i=0;i<n.length;i++){const o=n[i],s=r[i];if(o==="*")return i===n.length-1;if(o!==s)return!1}return!0}function a6(e,t){return`${e.sessionId}.${t}`}let uI=0;function dI(e,t){const n=new Map,r=new Map,i=new WeakMap,o=new Set,s={},{clock:l,logger:a}=t,c={schedule:(u,p,g,y,q=Math.random().toString(36).slice(2))=>{const m={source:u,target:p,event:g,delay:y,id:q,startedAt:Date.now()},A=a6(u,q);d._snapshot._scheduledEvents[A]=m;const w=l.setTimeout(()=>{delete s[A],delete d._snapshot._scheduledEvents[A],d._relay(u,p,g)},y);s[A]=w},cancel:(u,p)=>{const g=a6(u,p),y=s[g];delete s[g],delete d._snapshot._scheduledEvents[g],y!==void 0&&l.clearTimeout(y)},cancelAll:u=>{for(const p in d._snapshot._scheduledEvents){const g=d._snapshot._scheduledEvents[p];g.source===u&&c.cancel(u,g.id)}}},h=u=>{if(!o.size)return;const p={...u,rootId:e.sessionId};o.forEach(g=>{var y;return(y=g.next)==null?void 0:y.call(g,p)})},d={_snapshot:{_scheduledEvents:((t==null?void 0:t.snapshot)&&t.snapshot.scheduler)??{}},_bookId:()=>`x:${uI++}`,_register:(u,p)=>(n.set(u,p),u),_unregister:u=>{n.delete(u.sessionId);const p=i.get(u);p!==void 0&&(r.delete(p),i.delete(u))},get:u=>r.get(u),getAll:()=>Object.fromEntries(r.entries()),_set:(u,p)=>{const g=r.get(u);if(g&&g!==p)throw new Error(`Actor with system ID '${u}' already exists.`);r.set(u,p),i.set(p,u)},inspect:u=>{const p=Tu(u);return o.add(p),{unsubscribe(){o.delete(p)}}},_sendInspectionEvent:h,_relay:(u,p,g)=>{d._sendInspectionEvent({type:"@xstate.event",sourceRef:u,actorRef:p,event:g}),p._send(g)},scheduler:c,getSnapshot:()=>({_scheduledEvents:{...d._snapshot._scheduledEvents}}),start:()=>{const u=d._snapshot._scheduledEvents;d._snapshot._scheduledEvents={};for(const p in u){const{source:g,target:y,event:q,delay:m,id:A}=u[p];c.schedule(g,y,q,m,A)}},_clock:l,_logger:a};return d}let Dh=!1;const sg=1;let Qt=function(e){return e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped",e}({});const hI={clock:{setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e)},logger:console.log.bind(console),devTools:!1};class fI{constructor(t,n){this.logic=t,this._snapshot=void 0,this.clock=void 0,this.options=void 0,this.id=void 0,this.mailbox=new i6(this._process.bind(this)),this.observers=new Set,this.eventListeners=new Map,this.logger=void 0,this._processingStatus=Qt.NotStarted,this._parent=void 0,this._syncSnapshot=void 0,this.ref=void 0,this._actorScope=void 0,this.systemId=void 0,this.sessionId=void 0,this.system=void 0,this._doneEvent=void 0,this.src=void 0,this._deferred=[];const r={...hI,...n},{clock:i,logger:o,parent:s,syncSnapshot:l,id:a,systemId:c,inspect:h}=r;this.system=s?s.system:dI(this,{clock:i,logger:o}),h&&!s&&this.system.inspect(Tu(h)),this.sessionId=this.system._bookId(),this.id=a??this.sessionId,this.logger=(n==null?void 0:n.logger)??this.system._logger,this.clock=(n==null?void 0:n.clock)??this.system._clock,this._parent=s,this._syncSnapshot=l,this.options=r,this.src=r.src??t,this.ref=this,this._actorScope={self:this,id:this.id,sessionId:this.sessionId,logger:this.logger,defer:d=>{this._deferred.push(d)},system:this.system,stopChild:d=>{if(d._parent!==this)throw new Error(`Cannot stop child actor ${d.id} of ${this.id} because it is not a child`);d._stop()},emit:d=>{const u=this.eventListeners.get(d.type),p=this.eventListeners.get("*");if(!u&&!p)return;const g=[...u?u.values():[],...p?p.values():[]];for(const y of g)try{y(d)}catch(q){Jn(q)}},actionExecutor:d=>{const u=()=>{if(this._actorScope.system._sendInspectionEvent({type:"@xstate.action",actorRef:this,action:{type:d.type,params:d.params}}),!d.exec)return;const p=Dh;try{Dh=!0,d.exec(d.info,d.params)}finally{Dh=p}};this._processingStatus===Qt.Running?u():this._deferred.push(u)}},this.send=this.send.bind(this),this.system._sendInspectionEvent({type:"@xstate.actor",actorRef:this}),c&&(this.systemId=c,this.system._set(c,this)),this._initState((n==null?void 0:n.snapshot)??(n==null?void 0:n.state)),c&&this._snapshot.status!=="active"&&this.system._unregister(this)}_initState(t){var n;try{this._snapshot=t?this.logic.restoreSnapshot?this.logic.restoreSnapshot(t,this._actorScope):t:this.logic.getInitialSnapshot(this._actorScope,(n=this.options)==null?void 0:n.input)}catch(r){this._snapshot={status:"error",output:void 0,error:r}}}update(t,n){var i,o;this._snapshot=t;let r;for(;r=this._deferred.shift();)try{r()}catch(s){this._deferred.length=0,this._snapshot={...t,status:"error",error:s}}switch(this._snapshot.status){case"active":for(const s of this.observers)try{(i=s.next)==null||i.call(s,t)}catch(l){Jn(l)}break;case"done":for(const s of this.observers)try{(o=s.next)==null||o.call(s,t)}catch(l){Jn(l)}this._stopProcedure(),this._complete(),this._doneEvent=oI(this.id,this._snapshot.output),this._parent&&this.system._relay(this,this._parent,this._doneEvent);break;case"error":this._error(this._snapshot.error);break}this.system._sendInspectionEvent({type:"@xstate.snapshot",actorRef:this,event:n,snapshot:t})}subscribe(t,n,r){var o;const i=Tu(t,n,r);if(this._processingStatus!==Qt.Stopped)this.observers.add(i);else switch(this._snapshot.status){case"done":try{(o=i.complete)==null||o.call(i)}catch(s){Jn(s)}break;case"error":{const s=this._snapshot.error;if(!i.error)Jn(s);else try{i.error(s)}catch(l){Jn(l)}break}}return{unsubscribe:()=>{this.observers.delete(i)}}}on(t,n){let r=this.eventListeners.get(t);r||(r=new Set,this.eventListeners.set(t,r));const i=n.bind(void 0);return r.add(i),{unsubscribe:()=>{r.delete(i)}}}select(t,n=Object.is){return{subscribe:r=>{const i=Tu(r),o=this.getSnapshot();let s=t(o);return this.subscribe(l=>{var c;const a=t(l);n(s,a)||(s=a,(c=i.next)==null||c.call(i,a))})},get:()=>t(this.getSnapshot())}}start(){if(this._processingStatus===Qt.Running)return this;this._syncSnapshot&&this.subscribe({next:r=>{r.status==="active"&&this.system._relay(this,this._parent,{type:`xstate.snapshot.${this.id}`,snapshot:r})},error:()=>{}}),this.system._register(this.sessionId,this),this.systemId&&this.system._set(this.systemId,this),this._processingStatus=Qt.Running;const t=uv(this.options.input);switch(this.system._sendInspectionEvent({type:"@xstate.event",sourceRef:this._parent,actorRef:this,event:t}),this._snapshot.status){case"done":return this.update(this._snapshot,t),this;case"error":return this._error(this._snapshot.error),this}if(this._parent||this.system.start(),this.logic.start)try{this.logic.start(this._snapshot,this._actorScope)}catch(r){return this._snapshot={...this._snapshot,status:"error",error:r},this._error(r),this}return this.update(this._snapshot,t),this.options.devTools&&this.attachDevTools(),this.mailbox.start(),this}_process(t){let n,r;try{n=this.logic.transition(this._snapshot,t,this._actorScope)}catch(i){r={err:i}}if(r){const{err:i}=r;this._snapshot={...this._snapshot,status:"error",error:i},this._error(i);return}this.update(n,t),t.type===Lf&&(this._stopProcedure(),this._complete())}_stop(){return this._processingStatus===Qt.Stopped?this:(this.mailbox.clear(),this._processingStatus===Qt.NotStarted?(this._processingStatus=Qt.Stopped,this):(this.mailbox.enqueue({type:Lf}),this))}stop(){if(this._parent)throw new Error("A non-root actor cannot be stopped directly.");return this._stop()}_complete(){var t;for(const n of this.observers)try{(t=n.complete)==null||t.call(n)}catch(r){Jn(r)}this.observers.clear(),this.eventListeners.clear()}_reportError(t){if(!this.observers.size){this._parent||Jn(t),this.eventListeners.clear();return}let n=!1;for(const r of this.observers){const i=r.error;n||(n=!i);try{i==null||i(t)}catch(o){Jn(o)}}this.observers.clear(),this.eventListeners.clear(),n&&Jn(t)}_error(t){this._stopProcedure(),this._reportError(t),this._parent&&this.system._relay(this,this._parent,cv(this.id,t))}_stopProcedure(){return this._processingStatus!==Qt.Running?this:(this.system.scheduler.cancelAll(this),this.mailbox.clear(),this.mailbox=new i6(this._process.bind(this)),this._processingStatus=Qt.Stopped,this.system._unregister(this),this)}_send(t){this._processingStatus!==Qt.Stopped&&this.mailbox.enqueue(t)}send(t){this.system._relay(void 0,this,t)}attachDevTools(){const{devTools:t}=this.options;t&&(typeof t=="function"?t:JP)(this)}toJSON(){return{xstate$$type:sg,id:this.id}}getPersistedSnapshot(t){return this.logic.getPersistedSnapshot(this._snapshot,t)}[sI](){return this}getSnapshot(){return this._snapshot}}function il(e,...[t]){return new fI(e,t)}function gI(e,t,n,r,{sendId:i}){const o=typeof i=="function"?i(n,r):i;return[t,{sendId:o},void 0]}function pI(e,t){e.defer(()=>{e.system.scheduler.cancel(e.self,t.sendId)})}function lg(e){function t(n,r){}return t.type="xstate.cancel",t.sendId=e,t.resolve=gI,t.execute=pI,t}function mI(e,t,n,r,{id:i,systemId:o,src:s,input:l,syncSnapshot:a}){const c=typeof s=="string"?og(t.machine,s):s,h=typeof i=="function"?i(n):i;let d,u;return c&&(u=typeof l=="function"?l({context:t.context,event:n.event,self:e.self}):l,d=il(c,{id:h,src:s,parent:e.self,syncSnapshot:a,systemId:o,input:u})),[Bi(t,{children:{...t.children,[h]:d}}),{id:i,systemId:o,actorRef:d,src:s,input:u},void 0]}function yI(e,{actorRef:t}){t&&e.defer(()=>{t._processingStatus!==Qt.Stopped&&t.start()})}function ag(...[e,{id:t,systemId:n,input:r,syncSnapshot:i=!1}={}]){function o(s,l){}return o.type="xstate.spawnChild",o.id=t,o.systemId=n,o.src=e,o.input=r,o.syncSnapshot=i,o.resolve=mI,o.execute=yI,o}function AI(e,t,n,r,{actorRef:i}){const o=typeof i=="function"?i(n,r):i,s=typeof o=="string"?t.children[o]:o;let l=t.children;return s&&(l={...l},delete l[s.id]),[Bi(t,{children:l}),s,void 0]}function pv(e,t){const n=t.getSnapshot();if(n&&"children"in n)for(const r of Object.values(n.children))pv(e,r);e.system._unregister(t)}function vI(e,t){if(t){if(pv(e,t),t._processingStatus!==Qt.Running){e.stopChild(t);return}e.defer(()=>{e.stopChild(t)})}}function jd(e){function t(n,r){}return t.type="xstate.stopChild",t.actorRef=e,t.resolve=AI,t.execute=vI,t}function qI(e,{context:t,event:n},{guards:r}){return r.every(i=>pc(i,t,n,e))}function wI(e){function t(n,r){return!1}return t.check=qI,t.guards=e,t}function pc(e,t,n,r){const{machine:i}=r,o=typeof e=="function",s=o?e:i.implementations.guards[typeof e=="string"?e:e.type];if(!o&&!s)throw new Error(`Guard '${typeof e=="string"?e:e.type}' is not implemented.'.`);if(typeof s!="function")return pc(s,t,n,r);const l={context:t,event:n},a=o||typeof e=="string"?void 0:"params"in e?typeof e.params=="function"?e.params({context:t,event:n}):e.params:void 0;return"check"in s?s.check(r,l,s):s(l,a)}function cg(e){return e.type==="atomic"||e.type==="final"}function ol(e){return Object.values(e.states).filter(t=>t.type!=="history")}function mc(e,t){const n=[];if(t===e)return n;let r=e.parent;for(;r&&r!==t;)n.push(r),r=r.parent;return n}function S1(e){const t=new Set(e),n=yv(t);for(const r of t)if(r.type==="compound"&&(!n.get(r)||!n.get(r).length))c6(r).forEach(i=>t.add(i));else if(r.type==="parallel"){for(const i of ol(r))if(i.type!=="history"&&!t.has(i)){const o=c6(i);for(const s of o)t.add(s)}}for(const r of t){let i=r.parent;for(;i;)t.add(i),i=i.parent}return t}function mv(e,t){const n=t.get(e);if(!n)return{};if(e.type==="compound"){const i=n[0];if(i){if(cg(i))return i.key}else return{}}const r={};for(const i of n)r[i.key]=mv(i,t);return r}function yv(e){const t=new Map;for(const n of e)t.has(n)||t.set(n,[]),n.parent&&(t.has(n.parent)||t.set(n.parent,[]),t.get(n.parent).push(n));return t}function Av(e,t){const n=S1(t);return mv(e,yv(n))}function ug(e,t){return t.type==="compound"?ol(t).some(n=>n.type==="final"&&e.has(n)):t.type==="parallel"?ol(t).every(n=>ug(e,n)):t.type==="final"}const zd=e=>e[0]===tI;function xI(e,t){const n=e.transitions.get(t),r=[...e.transitions.keys()].filter(i=>i!==t&&cI(t,i)).sort((i,o)=>o.length-i.length).flatMap(i=>e.transitions.get(i));return n?[...n,...r]:r}function bI(e){const t=e.config.after;if(!t)return[];const n=i=>{const o=iI(i,e.id),s=o.type;return e.entry.push(fg(o,{id:s,delay:i})),e.exit.push(lg(s)),s};return Object.keys(t).flatMap(i=>{const o=t[i],s=typeof o=="string"?{target:o}:o,l=Number.isNaN(+i)?i:+i,a=n(l);return Ai(s).map(c=>({...c,event:a,delay:l}))}).map(i=>{const{delay:o}=i;return{...ui(e,i.event,i),delay:o}})}function ui(e,t,n){const r=gv(n.target),i=n.reenter??!1,o=zI(e,r),s={...n,actions:Ai(n.actions),guard:n.guard,target:o,source:e,reenter:i,eventType:t,toJSON:()=>({...s,source:`#${e.id}`,target:o?o.map(l=>`#${l.id}`):void 0})};return s}function VI(e){const t=new Map;if(e.config.on)for(const n of Object.keys(e.config.on)){if(n===lv)throw new Error('Null events ("") cannot be specified as a transition key. Use `always: { ... }` instead.');const r=e.config.on[n];t.set(n,as(r).map(i=>ui(e,n,i)))}if(e.config.onDone){const n=`xstate.done.state.${e.id}`;t.set(n,as(e.config.onDone).map(r=>ui(e,n,r)))}for(const n of e.invoke){if(n.onDone){const r=`xstate.done.actor.${n.id}`;t.set(r,as(n.onDone).map(i=>ui(e,r,i)))}if(n.onError){const r=`xstate.error.actor.${n.id}`;t.set(r,as(n.onError).map(i=>ui(e,r,i)))}if(n.onSnapshot){const r=`xstate.snapshot.${n.id}`;t.set(r,as(n.onSnapshot).map(i=>ui(e,r,i)))}}for(const n of e.after){let r=t.get(n.eventType);r||(r=[],t.set(n.eventType,r)),r.push(n)}return t}function kI(e){const t=[],n=r=>{Object.values(r).forEach(i=>{if(i.config.route&&i.config.id){const o=i.config.id,s=i.config.route.guard,l=({event:c})=>c.to===`#${o}`,a={...i.config.route,guard:s?wI([l,s]):l,target:`#${o}`};t.push(ui(e,"xstate.route",a))}i.states&&n(i.states)})};n(e.states),t.length>0&&e.transitions.set("xstate.route",t)}function jI(e,t){const n=typeof t=="string"?e.states[t]:t?e.states[t.target]:void 0;if(!n&&t)throw new Error(`Initial state node "${t}" not found on parent state node #${e.id}`);const r={source:e,actions:!t||typeof t=="string"?[]:Ai(t.actions),eventType:null,reenter:!1,target:n?[n]:[],toJSON:()=>({...r,source:`#${e.id}`,target:n?[`#${n.id}`]:[]})};return r}function zI(e,t){if(t!==void 0)return t.map(n=>{if(typeof n!="string")return n;if(zd(n))return e.machine.getStateNodeById(n);const r=n[0]===sv;if(r&&!e.parent)return C1(e,n.slice(1));const i=r?e.key+n:n;if(e.parent)try{return C1(e.parent,i)}catch(o){throw new Error(`Invalid transition definition for state node '${e.id}':
181
181
  ${o.message}`)}else throw new Error(`Invalid target: "${n}" is not a valid target from the root node. Did you mean ".${n}"?`)})}function vv(e){const t=gv(e.config.target);return t?{target:t.map(n=>typeof n=="string"?C1(e.parent,n):n)}:e.parent.type==="parallel"?{target:[e.parent]}:e.parent.initial}function go(e){return e.type==="history"}function c6(e){const t=qv(e);for(const n of t)for(const r of mc(n,e))t.add(r);return t}function qv(e){const t=new Set;function n(r){if(!t.has(r)){if(t.add(r),r.type==="compound")n(r.initial.target[0]);else if(r.type==="parallel")for(const i of ol(r))n(i)}}return n(e),t}function sl(e,t){if(zd(t))return e.machine.getStateNodeById(t);if(!e.states)throw new Error(`Unable to retrieve child state '${t}' from '${e.id}'; no child states exist.`);const n=e.states[t];if(!n)throw new Error(`Child state '${t}' does not exist on '${e.id}'`);return n}function C1(e,t){if(typeof t=="string"&&zd(t))try{return e.machine.getStateNodeById(t)}catch{}const n=ig(t).slice();let r=e;for(;n.length;){const i=n.shift();if(!i.length)break;r=sl(r,i)}return r}function E1(e,t){if(typeof t=="string"){const i=e.states[t];if(!i)throw new Error(`State '${t}' does not exist on '${e.id}'`);return[e,i]}const n=Object.keys(t),r=n.map(i=>sl(e,i)).filter(Boolean);return[e.machine.root,e].concat(r,n.reduce((i,o)=>{const s=sl(e,o);if(!s)return i;const l=E1(s,t[o]);return i.concat(l)},[]))}function SI(e,t,n,r){const o=sl(e,t).next(n,r);return!o||!o.length?e.next(n,r):o}function CI(e,t,n,r){const i=Object.keys(t),o=sl(e,i[0]),s=dg(o,t[i[0]],n,r);return!s||!s.length?e.next(n,r):s}function EI(e,t,n,r){const i=[];for(const o of Object.keys(t)){const s=t[o];if(!s)continue;const l=sl(e,o),a=dg(l,s,n,r);a&&i.push(...a)}return i.length?i:e.next(n,r)}function dg(e,t,n,r){return typeof t=="string"?SI(e,t,n,r):Object.keys(t).length===1?CI(e,t,n,r):EI(e,t,n,r)}function RI(e){return Object.keys(e.states).map(t=>e.states[t]).filter(t=>t.type==="history")}function Oi(e,t){let n=e;for(;n.parent&&n.parent!==t;)n=n.parent;return n.parent===t}function _I(e,t){const n=new Set(e),r=new Set(t);for(const i of n)if(r.has(i))return!0;for(const i of r)if(n.has(i))return!0;return!1}function wv(e,t,n){const r=new Set;for(const i of e){let o=!1;const s=new Set;for(const l of r)if(_I(Of([i],t,n),Of([l],t,n)))if(Oi(i.source,l.source))s.add(l);else{o=!0;break}if(!o){for(const l of s)r.delete(l);r.add(i)}}return Array.from(r)}function TI(e){const[t,...n]=e;for(const r of mc(t,void 0))if(n.every(i=>Oi(i,r)))return r}function hg(e,t){if(!e.target)return[];const n=new Set;for(const r of e.target)if(go(r))if(t[r.id])for(const i of t[r.id])n.add(i);else for(const i of hg(vv(r),t))n.add(i);else n.add(r);return[...n]}function xv(e,t){const n=hg(e,t);if(!n)return;if(!e.reenter&&n.every(i=>i===e.source||Oi(i,e.source)))return e.source;const r=TI(n.concat(e.source));if(r)return r;if(!e.reenter)return e.source.machine.root}function Of(e,t,n){var i;const r=new Set;for(const o of e)if((i=o.target)!=null&&i.length){const s=xv(o,n);o.reenter&&o.source===s&&r.add(s);for(const l of t)Oi(l,s)&&r.add(l)}return[...r]}function MI(e,t){if(e.length!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function PI(e,t,n,r,i){return Bf([{target:[...qv(e)],source:e,reenter:!0,actions:[],eventType:null,toJSON:null}],t,n,r,!0,i)}function Bf(e,t,n,r,i,o){const s=[];if(!e.length)return[t,s];const l=n.actionExecutor;n.actionExecutor=a=>{s.push(a),l(a)};try{const a=new Set(t._nodes);let c=t.historyValue;const h=wv(e,a,c);let d=t;i||([d,c]=DI(d,r,n,h,a,c,o,n.actionExecutor)),d=ll(d,r,n,h.flatMap(p=>p.actions),o,void 0),d=LI(d,r,n,h,a,o,c,i);const u=[...a];d.status==="done"&&(d=ll(d,r,n,u.sort((p,g)=>g.order-p.order).flatMap(p=>p.exit),o,void 0));try{return c===t.historyValue&&MI(t._nodes,a)?[d,s]:[Bi(d,{_nodes:u,historyValue:c}),s]}catch(p){throw p}}finally{n.actionExecutor=l}}function II(e,t,n,r,i){if(r.output===void 0)return;const o=Nf(i.id,i.output!==void 0&&i.parent?Df(i.output,e.context,t,n.self):void 0);return Df(r.output,e.context,o,n.self)}function LI(e,t,n,r,i,o,s,l){let a=e;const c=new Set,h=new Set;NI(r,s,h,c),l&&h.add(e.machine.root);const d=new Set;for(const u of[...c].sort((p,g)=>p.order-g.order)){i.add(u);const p=[];p.push(...u.entry);for(const g of u.invoke)p.push(ag(g.src,{...g,syncSnapshot:!!g.onSnapshot}));if(h.has(u)){const g=u.initial.actions;p.push(...g)}if(a=ll(a,t,n,p,o,u.invoke.map(g=>g.id)),u.type==="final"){const g=u.parent;let y=(g==null?void 0:g.type)==="parallel"?g:g==null?void 0:g.parent,q=y||u;for((g==null?void 0:g.type)==="compound"&&o.push(Nf(g.id,u.output!==void 0?Df(u.output,a.context,t,n.self):void 0));(y==null?void 0:y.type)==="parallel"&&!d.has(y)&&ug(i,y);)d.add(y),o.push(Nf(y.id)),q=y,y=y.parent;if(y)continue;a=Bi(a,{status:"done",output:II(a,t,n,a.machine.root,q)})}}return a}function NI(e,t,n,r){for(const i of e){const o=xv(i,t);for(const l of i.target||[])!go(l)&&(i.source!==l||i.source!==o||i.reenter)&&(r.add(l),n.add(l)),ks(l,t,n,r);const s=hg(i,t);for(const l of s){const a=mc(l,o);(o==null?void 0:o.type)==="parallel"&&a.push(o),bv(r,t,n,a,!i.source.parent&&i.reenter?void 0:o)}}}function ks(e,t,n,r){var i;if(go(e))if(t[e.id]){const o=t[e.id];for(const s of o)r.add(s),ks(s,t,n,r);for(const s of o)Oh(s,e.parent,r,t,n)}else{const o=vv(e);for(const s of o.target)r.add(s),o===((i=e.parent)==null?void 0:i.initial)&&n.add(e.parent),ks(s,t,n,r);for(const s of o.target)Oh(s,e.parent,r,t,n)}else if(e.type==="compound"){const[o]=e.initial.target;go(o)||(r.add(o),n.add(o)),ks(o,t,n,r),Oh(o,e,r,t,n)}else if(e.type==="parallel")for(const o of ol(e).filter(s=>!go(s)))[...r].some(s=>Oi(s,o))||(go(o)||(r.add(o),n.add(o)),ks(o,t,n,r))}function bv(e,t,n,r,i){for(const o of r)if((!i||Oi(o,i))&&e.add(o),o.type==="parallel")for(const s of ol(o).filter(l=>!go(l)))[...e].some(l=>Oi(l,s))||(e.add(s),ks(s,t,n,e))}function Oh(e,t,n,r,i){bv(n,r,i,mc(e,t))}function DI(e,t,n,r,i,o,s,l){let a=e;const c=Of(r,i,o);c.sort((d,u)=>u.order-d.order);let h;for(const d of c)for(const u of RI(d)){let p;u.history==="deep"?p=g=>cg(g)&&Oi(g,d):p=g=>g.parent===d,h??(h={...o}),h[u.id]=Array.from(i).filter(p)}for(const d of c)a=ll(a,t,n,[...d.exit,...d.invoke.map(u=>jd(u.id))],s,void 0),i.delete(d);return[a,h||o]}function OI(e,t){return e.implementations.actions[t]}function Vv(e,t,n,r,i,o){const{machine:s}=e;let l=e;for(const a of r){const c=typeof a=="function",h=c?a:OI(s,typeof a=="string"?a:a.type),d={context:l.context,event:t,self:n.self,system:n.system},u=c||typeof a=="string"?void 0:"params"in a?typeof a.params=="function"?a.params({context:l.context,event:t}):a.params:void 0;if(!h||!("resolve"in h)){n.actionExecutor({type:typeof a=="string"?a:typeof a=="object"?a.type:a.name||"(anonymous)",info:d,params:u,exec:h});continue}const p=h,[g,y,q]=p.resolve(n,l,d,u,h,i);l=g,"retryResolve"in p&&(o==null||o.push([p,y])),"execute"in p&&n.actionExecutor({type:p.type,info:d,params:y,exec:p.execute.bind(null,n,y)}),q&&(l=Vv(l,t,n,q,i,o))}return l}function ll(e,t,n,r,i,o){const s=o?[]:void 0,l=Vv(e,t,n,r,{internalQueue:i,deferredActorIds:o},s);return s==null||s.forEach(([a,c])=>{a.retryResolve(n,l,c)}),l}function Bh(e,t,n,r){var d;let i=e;const o=[];function s(u,p,g){n.system._sendInspectionEvent({type:"@xstate.microstep",actorRef:n.self,event:p,snapshot:u[0],_transitions:g}),o.push(u)}if(t.type===Lf)return i=Bi(u6(i,t,n),{status:"stopped"}),s([i,[]],t,[]),{snapshot:i,microsteps:o};let l=t;if(l.type!==av){const u=l,p=aI(u),g=d6(u,i);if(p&&!g.length)return i=Bi(e,{status:"error",error:u.error}),s([i,[]],u,[]),{snapshot:i,microsteps:o};const y=Bf(g,e,n,l,!1,r);i=y[0],s(y,u,g)}let a=!0;const c=((d=e.machine.options)==null?void 0:d.maxIterations)??1/0;let h=0;for(;i.status==="active";){if(h++,h>c)throw new Error(`Infinite loop detected: the machine has processed more than ${c} microsteps without reaching a stable state. This usually happens when there's a cycle of transitions (e.g., eventless transitions or raised events causing state A -> B -> C -> A).`);let u=a?BI(i,l):[];const p=u.length?i:void 0;if(!u.length){if(!r.length)break;l=r.shift(),u=d6(l,i)}const g=Bf(u,i,n,l,!1,r);i=g[0],a=i!==p,s(g,l,u)}return i.status!=="active"&&u6(i,l,n),{snapshot:i,microsteps:o}}function u6(e,t,n){return ll(e,t,n,Object.values(e.children).map(r=>jd(r)),[],void 0)}function d6(e,t){return t.machine.getTransitionData(t,e)}function BI(e,t){const n=new Set,r=e._nodes.filter(cg);for(const i of r)e:for(const o of[i].concat(mc(i,void 0)))if(o.always){for(const s of o.always)if(s.guard===void 0||pc(s.guard,e.context,t,e)){n.add(s);break e}}return wv(Array.from(n),new Set(e._nodes),e.historyValue)}function FI(e,t){const n=S1(E1(e,t));return Av(e,[...n])}function HI(e){return!!e&&typeof e=="object"&&"machine"in e&&"value"in e}const UI=function(t){return dv(t,this.value)},WI=function(t){return this.tags.has(t)},KI=function(t){const n=this.machine.getTransitionData(this,t);return!!(n!=null&&n.length)&&n.some(r=>r.target!==void 0||r.actions.length)},$I=function(){const{_nodes:t,tags:n,machine:r,getMeta:i,toJSON:o,can:s,hasTag:l,matches:a,...c}=this;return{...c,tags:Array.from(n)}},GI=function(){return this._nodes.reduce((t,n)=>(n.meta!==void 0&&(t[n.id]=n.meta),t),{})};function Gl(e,t){return{status:e.status,output:e.output,error:e.error,machine:t,context:e.context,_nodes:e._nodes,value:Av(t.root,e._nodes),tags:new Set(e._nodes.flatMap(n=>n.tags)),children:e.children,historyValue:e.historyValue||{},matches:UI,hasTag:WI,can:KI,getMeta:GI,toJSON:$I}}function Bi(e,t={}){return Gl({...e,...t},e.machine)}function QI(e){if(typeof e!="object"||e===null)return{};const t={};for(const n in e){const r=e[n];Array.isArray(r)&&(t[n]=r.map(i=>({id:i.id})))}return t}function YI(e,t){const{_nodes:n,tags:r,machine:i,children:o,context:s,can:l,hasTag:a,matches:c,getMeta:h,toJSON:d,...u}=e,p={};for(const y in o){const q=o[y];p[y]={snapshot:q.getPersistedSnapshot(t),src:q.src,systemId:q.systemId,syncSnapshot:q._syncSnapshot}}return{...u,context:kv(s),children:p,historyValue:QI(u.historyValue)}}function kv(e){let t;for(const n in e){const r=e[n];if(r&&typeof r=="object")if("sessionId"in r&&"send"in r&&"ref"in r)t??(t=Array.isArray(e)?e.slice():{...e}),t[n]={xstate$$type:sg,id:r.id};else{const i=kv(r);i!==r&&(t??(t=Array.isArray(e)?e.slice():{...e}),t[n]=i)}}return t??e}function ZI(e,t,n,r,{event:i,id:o,delay:s},{internalQueue:l}){const a=t.machine.implementations.delays;if(typeof i=="string")throw new Error(`Only event objects may be used with raise; use raise({ type: "${i}" }) instead`);const c=typeof i=="function"?i(n,r):i;let h;if(typeof s=="string"){const d=a&&a[s];h=typeof d=="function"?d(n,r):d}else h=typeof s=="function"?s(n,r):s;return typeof h!="number"&&l.push(c),[t,{event:c,id:o,delay:h},void 0]}function XI(e,t){const{event:n,delay:r,id:i}=t;if(typeof r=="number"){e.defer(()=>{const o=e.self;e.system.scheduler.schedule(o,o,n,r,i)});return}}function fg(e,t){function n(r,i){}return n.type="xstate.raise",n.event=e,n.id=t==null?void 0:t.id,n.delay=t==null?void 0:t.delay,n.resolve=ZI,n.execute=XI,n}function JI(e,{machine:t,context:n},r,i){const o=(s,l)=>{if(typeof s=="string"){const a=og(t,s);if(!a)throw new Error(`Actor logic '${s}' not implemented in machine '${t.id}'`);const c=il(a,{id:l==null?void 0:l.id,parent:e.self,syncSnapshot:l==null?void 0:l.syncSnapshot,input:typeof(l==null?void 0:l.input)=="function"?l.input({context:n,event:r,self:e.self}):l==null?void 0:l.input,src:s,systemId:l==null?void 0:l.systemId});return i[c.id]=c,c}else return il(s,{id:l==null?void 0:l.id,parent:e.self,syncSnapshot:l==null?void 0:l.syncSnapshot,input:l==null?void 0:l.input,src:s,systemId:l==null?void 0:l.systemId})};return(s,l)=>{const a=o(s,l);return i[a.id]=a,e.defer(()=>{a._processingStatus!==Qt.Stopped&&a.start()}),a}}function eL(e,t,n,r,{assignment:i}){if(!t.context)throw new Error("Cannot assign to undefined `context`. Ensure that `context` is defined in the machine config.");const o={},s={context:t.context,event:n.event,spawn:JI(e,t,n.event,o),self:e.self,system:e.system};let l={};if(typeof i=="function")l=i(s,r);else for(const c of Object.keys(i)){const h=i[c];l[c]=typeof h=="function"?h(s,r):h}const a=Object.assign({},t.context,l);return[Bi(t,{context:a,children:Object.keys(o).length?{...t.children,...o}:t.children}),void 0,void 0]}function di(e){function t(n,r){}return t.type="xstate.assign",t.assignment=e,t.resolve=eL,t}const h6=new WeakMap;function ns(e,t,n){let r=h6.get(e);return r?t in r||(r[t]=n()):(r={[t]:n()},h6.set(e,r)),r[t]}const tL={},Nl=e=>typeof e=="string"?{type:e}:typeof e=="function"?"resolve"in e?{type:e.type}:{type:e.name}:e;class R1{constructor(t,n){if(this.config=t,this.key=void 0,this.id=void 0,this.type=void 0,this.path=void 0,this.states=void 0,this.history=void 0,this.entry=void 0,this.exit=void 0,this.parent=void 0,this.machine=void 0,this.meta=void 0,this.output=void 0,this.order=-1,this.description=void 0,this.tags=[],this.transitions=void 0,this.always=void 0,this.parent=n._parent,this.key=n._key,this.machine=n._machine,this.path=this.parent?this.parent.path.concat(this.key):[],this.id=this.config.id||[this.machine.id,...this.path].join(sv),this.type=this.config.type||(this.config.states&&Object.keys(this.config.states).length?"compound":this.config.history?"history":"atomic"),this.description=this.config.description,this.order=this.machine.idMap.size,this.machine.idMap.set(this.id,this),this.states=this.config.states?s6(this.config.states,(r,i)=>new R1(r,{_parent:this,_key:i,_machine:this.machine})):tL,this.type==="compound"&&!this.config.initial)throw new Error(`No initial state specified for compound state node "#${this.id}". Try adding { initial: "${Object.keys(this.states)[0]}" } to the state config.`);this.history=this.config.history===!0?"shallow":this.config.history||!1,this.entry=Ai(this.config.entry).slice(),this.exit=Ai(this.config.exit).slice(),this.meta=this.config.meta,this.output=this.type==="final"||!this.parent?this.config.output:void 0,this.tags=Ai(t.tags).slice()}_initialize(){this.transitions=VI(this),this.config.always&&(this.always=as(this.config.always).map(t=>ui(this,lv,t))),Object.keys(this.states).forEach(t=>{this.states[t]._initialize()})}get definition(){return{id:this.id,key:this.key,version:this.machine.version,type:this.type,initial:this.initial?{target:this.initial.target,source:this,actions:this.initial.actions.map(Nl),eventType:null,reenter:!1,toJSON:()=>({target:this.initial.target.map(t=>`#${t.id}`),source:`#${this.id}`,actions:this.initial.actions.map(Nl),eventType:null})}:void 0,history:this.history,states:s6(this.states,t=>t.definition),on:this.on,transitions:[...this.transitions.values()].flat().map(t=>({...t,actions:t.actions.map(Nl)})),entry:this.entry.map(Nl),exit:this.exit.map(Nl),meta:this.meta,order:this.order||-1,output:this.output,invoke:this.invoke,description:this.description,tags:this.tags}}toJSON(){return this.definition}get invoke(){return ns(this,"invoke",()=>Ai(this.config.invoke).map((t,n)=>{const{src:r,systemId:i}=t,o=t.id??l6(this.id,n),s=typeof r=="string"?r:`xstate.invoke.${l6(this.id,n)}`;return{...t,src:s,id:o,systemId:i,toJSON(){const{onDone:l,onError:a,...c}=t;return{...c,type:"xstate.invoke",src:s,id:o}}}}))}get on(){return ns(this,"on",()=>[...this.transitions].flatMap(([n,r])=>r.map(i=>[n,i])).reduce((n,[r,i])=>(n[r]=n[r]||[],n[r].push(i),n),{}))}get after(){return ns(this,"delayedTransitions",()=>bI(this))}get initial(){return ns(this,"initial",()=>jI(this,this.config.initial))}next(t,n){const r=n.type,i=[];let o;const s=ns(this,`candidates-${r}`,()=>xI(this,r));for(const l of s){const{guard:a}=l,c=t.context;let h=!1;try{h=!a||pc(a,c,n,t)}catch(d){const u=typeof a=="string"?a:typeof a=="object"?a.type:void 0;throw new Error(`Unable to evaluate guard ${u?`'${u}' `:""}in transition for event '${r}' in state node '${this.id}':
182
182
  ${d.message}`)}if(h){i.push(...l.actions),o=l;break}}return o?[o]:void 0}get events(){return ns(this,"events",()=>{const{states:t}=this,n=new Set(this.ownEvents);if(t)for(const r of Object.keys(t)){const i=t[r];if(i.states)for(const o of i.events)n.add(`${o}`)}return Array.from(n)})}get ownEvents(){const t=Object.keys(Object.fromEntries(this.transitions)),n=new Set(t.filter(r=>this.transitions.get(r).some(i=>!(!i.target&&!i.actions.length&&!i.reenter))));return Array.from(n)}}const nL="#";class gg{constructor(t,n){this.config=t,this.version=void 0,this.schemas=void 0,this.implementations=void 0,this.options=void 0,this.__xstatenode=!0,this.idMap=new Map,this.root=void 0,this.id=void 0,this.states=void 0,this.events=void 0,this.id=t.id||"(machine)",this.implementations={actors:(n==null?void 0:n.actors)??{},actions:(n==null?void 0:n.actions)??{},delays:(n==null?void 0:n.delays)??{},guards:(n==null?void 0:n.guards)??{}},this.version=this.config.version,this.schemas=this.config.schemas,this.options={maxIterations:1/0,...this.config.options},this.transition=this.transition.bind(this),this.getInitialSnapshot=this.getInitialSnapshot.bind(this),this.getPersistedSnapshot=this.getPersistedSnapshot.bind(this),this.restoreSnapshot=this.restoreSnapshot.bind(this),this.start=this.start.bind(this),this.root=new R1(t,{_key:this.id,_machine:this}),this.root._initialize(),kI(this.root),this.states=this.root.states,this.events=this.root.events}provide(t){const{actions:n,guards:r,actors:i,delays:o}=this.implementations;return new gg(this.config,{actions:{...n,...t.actions},guards:{...r,...t.guards},actors:{...i,...t.actors},delays:{...o,...t.delays}})}resolveState(t){const n=FI(this.root,t.value),r=S1(E1(this.root,n));return Gl({_nodes:[...r],context:t.context||{},children:{},status:ug(r,this.root)?"done":t.status||"active",output:t.output,error:t.error,historyValue:t.historyValue},this)}transition(t,n,r){return Bh(t,n,r,[]).snapshot}microstep(t,n,r){return Bh(t,n,r,[]).microsteps.map(([i])=>i)}getTransitionData(t,n){return dg(this.root,t.value,t,n)||[]}_getPreInitialState(t,n,r){const{context:i}=this.config,o=Gl({context:typeof i!="function"&&i?i:{},_nodes:[this.root],children:{},status:"active"},this);return typeof i=="function"?ll(o,n,t,[di(({spawn:l,event:a,self:c})=>i({spawn:l,input:a.input,self:c}))],r,void 0):o}getInitialSnapshot(t,n){const r=uv(n),i=[];let o=Gl({context:typeof this.config.context!="function"&&this.config.context?this.config.context:{},_nodes:[this.root],children:{},status:"active"},this);try{o=this._getPreInitialState(t,r,i);const[s]=PI(this.root,o,t,r,i),{snapshot:l}=Bh(s,r,t,i);return l}catch(s){return Bi(o,{status:"error",error:s})}}start(t){Object.values(t.children).forEach(n=>{n.getSnapshot().status==="active"&&n.start()})}getStateNodeById(t){const n=ig(t),r=n.slice(1),i=zd(n[0])?n[0].slice(nL.length):n[0],o=this.idMap.get(i);if(!o)throw new Error(`Child state node '#${i}' does not exist on machine '${this.id}'`);return C1(o,r)}get definition(){return this.root.definition}toJSON(){return this.definition}getPersistedSnapshot(t,n){return YI(t,n)}restoreSnapshot(t,n){const r={},i=t.children;Object.keys(i).forEach(d=>{const u=i[d],p=u.snapshot,g=u.src,y=typeof g=="string"?og(this,g):g;if(!y)return;const q=il(y,{id:d,parent:n.self,syncSnapshot:u.syncSnapshot,snapshot:p,src:g,systemId:u.systemId});r[d]=q});function o(d,u){if(u instanceof R1)return u;try{return d.machine.getStateNodeById(u.id)}catch{}}function s(d,u){if(!u||typeof u!="object")return{};const p={};for(const g in u){const y=u[g];for(const q of y){const m=o(d,q);m&&(p[g]??(p[g]=[]),p[g].push(m))}}return p}const l=s(this.root,t.historyValue),a=Gl({...t,children:r,_nodes:Array.from(S1(E1(this.root,t.value))),historyValue:l},this),c=new Set;function h(d,u){if(!c.has(d)){c.add(d);for(const p in d){const g=d[p];if(g&&typeof g=="object"){if("xstate$$type"in g&&g.xstate$$type===sg){d[p]=u[g.id];continue}h(g,u)}}}}return h(a.context,r),a}}function rL(e,t,n,r,{event:i}){const o=typeof i=="function"?i(n,r):i;return[t,{event:o},void 0]}function iL(e,{event:t}){e.defer(()=>e.emit(t))}function jv(e){function t(n,r){}return t.type="xstate.emit",t.event=e,t.resolve=rL,t.execute=iL,t}let Ff=function(e){return e.Parent="#_parent",e.Internal="#_internal",e}({});function oL(e,t,n,r,{to:i,event:o,id:s,delay:l},a){var g;const c=t.machine.implementations.delays;if(typeof o=="string")throw new Error(`Only event objects may be used with sendTo; use sendTo({ type: "${o}" }) instead`);const h=typeof o=="function"?o(n,r):o;let d;if(typeof l=="string"){const y=c&&c[l];d=typeof y=="function"?y(n,r):y}else d=typeof l=="function"?l(n,r):l;const u=typeof i=="function"?i(n,r):i;let p;if(typeof u=="string"){if(u===Ff.Parent?p=e.self._parent:u===Ff.Internal?p=e.self:u.startsWith("#_")?p=t.children[u.slice(2)]:p=(g=a.deferredActorIds)!=null&&g.includes(u)?u:t.children[u],!p)throw new Error(`Unable to send event to actor '${u}' from machine '${t.machine.id}'.`)}else p=u||e.self;return[t,{to:p,targetId:typeof u=="string"?u:void 0,event:h,id:s,delay:d},void 0]}function sL(e,t,n){typeof n.to=="string"&&(n.to=t.children[n.to])}function lL(e,t){e.defer(()=>{const{to:n,event:r,delay:i,id:o}=t;if(typeof i=="number"){e.system.scheduler.schedule(e.self,n,r,i,o);return}e.system._relay(e.self,n,r.type===rI?cv(e.self.id,r.data):r)})}function pg(e,t,n){function r(i,o){}return r.type="xstate.sendTo",r.to=e,r.event=t,r.id=n==null?void 0:n.id,r.delay=n==null?void 0:n.delay,r.resolve=oL,r.retryResolve=sL,r.execute=lL,r}function aL(e,t){return pg(Ff.Parent,e,t)}function cL(e,t,n,r,{collect:i}){const o=[],s=function(a){o.push(a)};return s.assign=(...l)=>{o.push(di(...l))},s.cancel=(...l)=>{o.push(lg(...l))},s.raise=(...l)=>{o.push(fg(...l))},s.sendTo=(...l)=>{o.push(pg(...l))},s.sendParent=(...l)=>{o.push(aL(...l))},s.spawnChild=(...l)=>{o.push(ag(...l))},s.stopChild=(...l)=>{o.push(jd(...l))},s.emit=(...l)=>{o.push(jv(...l))},i({context:n.context,event:n.event,enqueue:s,check:l=>pc(l,t.context,n.event,t),self:e.self,system:e.system},r),[t,void 0,o]}function uL(e){function t(n,r){}return t.type="xstate.enqueueActions",t.collect=e,t.resolve=cL,t}function dL(e,t,n,r,{value:i,label:o}){return[t,{value:typeof i=="function"?i(n,r):i,label:o},void 0]}function hL({logger:e},{value:t,label:n}){n?e(n,t):e(t)}function fL(e=({context:n,event:r})=>({context:n,event:r}),t){function n(r,i){}return n.type="xstate.log",n.value=e,n.label=t,n.resolve=dL,n.execute=hL,n}function gL(e,t){return new gg(e,t)}function zv({schemas:e,actors:t,actions:n,guards:r,delays:i}){return{assign:di,sendTo:pg,raise:fg,log:fL,cancel:lg,stopChild:jd,enqueueActions:uL,emit:jv,spawnChild:ag,createStateConfig:o=>o,createAction:o=>o,createMachine:o=>gL({...o,schemas:e},{actors:t,actions:n,guards:r,delays:i}),extend:o=>zv({schemas:e,actors:t,actions:{...n,...o.actions},guards:{...r,...o.guards},delays:{...i,...o.delays}})}}const pL=zv({actions:{absorbCardEnter:di(({event:e})=>e.type!=="CARD_ENTER"?{}:{cardId:e.cardId,answerLen:e.answerLen,advanceMode:e.advanceMode,confirmKey:e.confirmKey,isDone:e.isDone,awaitingAdvance:!1}),absorbModeChange:di(({event:e})=>e.type!=="MODE_CHANGE"?{}:{advanceMode:e.advanceMode,confirmKey:e.confirmKey}),clearAwaitingAdvance:di({awaitingAdvance:!1}),clearIsDone:di({isDone:!1})},guards:{isDone:({event:e})=>e.type==="CARD_ENTER"&&e.isDone===!0}}).createMachine({id:"typing",initial:"idle",context:({input:e})=>({cardId:e.cardId,answerLen:e.answerLen,advanceMode:e.advanceMode,confirmKey:e.confirmKey,isDone:e.isDone,awaitingAdvance:!1}),states:{idle:{on:{START:"typing",CARD_ENTER:[{guard:"isDone",target:"completed",actions:"absorbCardEnter"},{target:"idle",actions:"absorbCardEnter",reenter:!0}],MODE_CHANGE:{actions:"absorbModeChange"}}},typing:{on:{PAUSE:"paused",ENGINE_FINISH:{target:"passed",actions:di(({context:e})=>({awaitingAdvance:e.advanceMode==="manual"}))},CARD_ENTER:[{guard:"isDone",target:"completed",actions:"absorbCardEnter"},{target:"typing",actions:"absorbCardEnter",reenter:!0}],MODE_CHANGE:{actions:"absorbModeChange"}}},paused:{on:{START:"typing",CARD_ENTER:[{guard:"isDone",target:"completed",actions:"absorbCardEnter"},{target:"idle",actions:"absorbCardEnter"}],MODE_CHANGE:{actions:"absorbModeChange"}}},passed:{on:{STAMP_TIMEOUT:{actions:"clearAwaitingAdvance"},CONFIRM_ADVANCE:{actions:"clearAwaitingAdvance"},ADVANCE_END:"finished",CARD_ENTER:[{guard:"isDone",target:"completed",actions:"absorbCardEnter"},{target:"typing",actions:"absorbCardEnter",reenter:!0}],MODE_CHANGE:{actions:"absorbModeChange"}}},completed:{on:{RESTART:{target:"typing",actions:"clearIsDone"},CARD_ENTER:[{guard:"isDone",target:"completed",actions:"absorbCardEnter",reenter:!0},{target:"typing",actions:"absorbCardEnter"}],MODE_CHANGE:{actions:"absorbModeChange"}}},finished:{on:{CARD_ENTER:[{guard:"isDone",target:"completed",actions:"absorbCardEnter"},{target:"typing",actions:"absorbCardEnter"}],MODE_CHANGE:{actions:"absorbModeChange"}}}}});var mL=v.useLayoutEffect;const Sv=(e,t)=>{t(e);const n=e.getSnapshot().children;n&&Object.values(n).forEach(r=>{Sv(r,t)})};function yL(e){var r,i;const t=[];Sv(e,o=>{t.push([o,o.getSnapshot()]),o.observers=new Set});const n=(i=(r=e.system).getSnapshot)==null?void 0:i.call(r);e.stop(),e.system._snapshot=n,t.forEach(([o,s])=>{o._processingStatus=0,o._snapshot=s})}function AL(e,...[t]){let[[n,r],i]=v.useState(()=>{const o=il(e,t);return[e.config,o]});if(e.config!==n){const o=il(e,{...t,snapshot:r.getPersistedSnapshot({__unsafeAllowInlineActors:!0})});i([e.config,o]),r=o}return mL(()=>{r.logic.implementations=e.implementations}),r}function vL(e,...[t]){const n=AL(e,t),r=v.useCallback(()=>n.getSnapshot(),[n]),i=v.useCallback(l=>{const{unsubscribe:a}=n.subscribe({next:l,error:l});return a},[n]),o=_8.useSyncExternalStore(i,r,r),s="status"in o?o:void 0;if((s==null?void 0:s.status)==="error")throw s.error;return v.useEffect(()=>(n.start(),()=>{yL(n)}),[n]),[o,n.send,n]}function qL(e,...[t]){return vL(e,t)}function wL(e){const{cardId:t,answerLen:n,advanceMode:r,confirmKey:i,isDone:o,currentKeystroke:s}=e,[l,a]=qL(pL,{input:{cardId:t,answerLen:n,advanceMode:r,confirmKey:i,isDone:o}}),c=v.useRef(o);c.current=o;const h=v.useRef(r);h.current=r;const d=v.useRef(i);d.current=i,v.useEffect(()=>{a({type:"CARD_ENTER",cardId:t,answerLen:n,isDone:c.current,advanceMode:h.current,confirmKey:d.current})},[t,n]),v.useEffect(()=>{a({type:"MODE_CHANGE",advanceMode:r,confirmKey:i})},[r,i]);const u=l.value,p=l.context.awaitingAdvance,g=v.useMemo(()=>({kind:u,awaitingAdvance:p,showMask:u==="idle"||u==="paused",hudPaused:u!=="typing",showStamp:u==="passed"?"pass":null,showPill:u==="passed"&&p,keyboardKeystroke:u==="passed"&&p?{key:i==="Space"?"space":"enter"}:u==="completed"||u==="finished"||u==="passed"?null:s,acceptTyping:u==="typing",finished:u==="finished"}),[u,p,i,s]);return{kind:u,awaitingAdvance:p,send:a,derived:g}}function xL(e,t){const[n]=O4(),[r]=B4(),[i]=F4(),o=v.useMemo(()=>new d_(t,{ignoreCase:n,ignorePunctuation:r,allowBackspace:i}),[e,t]);return o.settings.ignoreCase=n,o.settings.ignorePunctuation=r,o.settings.allowBackspace=i,o}const bL={cpm:0,wpm:0,accuracy:1,elapsedMs:0};function VL(e){return{target:e.target,typed:"",cursor:0,correctCount:0,wrongCount:0,startedAt:null,finishedAt:null,composing:!1}}function kL(e){var n;return((n=G4(e.target)[0])==null?void 0:n.keystrokes[0])??null}function jL(e){const t=v.useMemo(()=>e?VL(e):null,[e]),n=v.useMemo(()=>e?kL(e):null,[e]),[r,i]=v.useState(null),[o,s]=v.useState(null),[l,a]=v.useState(null),c=v.useCallback((h,d,u)=>{i(h),s(d),a(u)},[]);return v.useEffect(()=>{i(null),s(null),a(null)},[e]),{typingState:r??t,typingMetrics:o??(t?bL:null),currentKeystroke:l??n,handleTypingChange:c}}function zL({open:e,onOpenChange:t,title:n,message:r,confirmLabel:i,cancelLabel:o,danger:s,alertOnly:l,onConfirm:a,onCancel:c}){const{t:h}=ve();return f.jsx(sc,{open:e,onOpenChange:t,children:f.jsxs(lc,{children:[f.jsx(ac,{className:"qt-confirm__overlay"}),f.jsxs(cc,{className:"qt-confirm__content",onEscapeKeyDown:d=>{l&&(d.preventDefault(),a())},children:[n&&f.jsx(pd,{className:"qt-confirm__title",children:n}),f.jsx(uy,{className:"qt-confirm__message",children:r}),f.jsxs("div",{className:"qt-confirm__actions",children:[!l&&f.jsx("button",{type:"button",className:"qt-confirm__btn",onClick:()=>{c==null||c(),t(!1)},children:o??h("common.cancel")}),f.jsx("button",{type:"button",className:`qt-confirm__btn qt-confirm__btn--primary ${s?"qt-confirm__btn--danger":""}`,onClick:()=>{a(),t(!1)},autoFocus:!0,children:i??h("common.confirm")})]})]})]})})}const _1=[];let Fh=null,lu=null;function Cv(){Fh||(lu=document.createElement("div"),lu.id="qt-confirm-root",document.body.appendChild(lu),Fh=W3(lu),Fh.render(f.jsx(SL,{})))}let qn=null;function SL(){const[e,t]=v.useState(null),[n,r]=v.useState(!1);v.useEffect(()=>(qn=()=>{t(o=>{if(o)return o;const s=_1.shift()??null;return s&&r(!0),s})},qn(),()=>{qn=null}),[]);const i=o=>{e&&(e.resolve(o),t(null),r(!1),setTimeout(()=>{_1.length>0&&(qn==null||qn())},100))};return e?f.jsx(zL,{open:n,onOpenChange:o=>{o||i(!1)},title:e.opts.title,message:e.opts.message,confirmLabel:e.opts.confirmLabel,cancelLabel:e.opts.cancelLabel,danger:e.opts.danger,alertOnly:e.alertOnly,onConfirm:()=>i(!0),onCancel:()=>i(!1)}):null}function T1(e){return new Promise(t=>{Cv(),_1.push({opts:e,alertOnly:!1,resolve:t}),qn==null||qn()})}function f6(e){const t=typeof e=="string"?{message:e}:e;return new Promise(n=>{Cv(),_1.push({opts:{message:t.message,title:t.title,confirmLabel:t.confirmLabel},alertOnly:!0,resolve:()=>n()}),qn==null||qn()})}function CL(){const{t:e}=ve(),{cardMap:t,clearAll:n,exportProgress:r,importProgress:i}=rg(),o=Object.keys(t).length,s=()=>{BA(r(),"qtype-progress.json")},l=async()=>{try{const c=await LM();if(!await T1({message:e("confirm.overwriteImport"),danger:!0}))return;i(c),await f6({message:e("toast.importOk")})}catch(c){const h=c instanceof Error?c.message:String(c),d=h.startsWith("err.")?e(h):h;await f6({message:e("toast.importFail",{msg:d})})}},a=async()=>{if(o===0)return;await T1({message:e("confirm.resetDone"),danger:!0})&&n()};return f.jsxs("div",{children:[f.jsx(Wo,{title:e("settings.data.title"),subtitle:e("settings.data.subtitle")}),f.jsx(fe,{title:e("settings.data.completed"),description:e("settings.data.completed.desc",{count:o}),divider:!1,children:f.jsx("button",{className:"qt-danger-btn",onClick:a,disabled:o===0,children:e("settings.data.resetAll")})}),f.jsx(fe,{title:e("settings.data.export"),description:e("settings.data.export.desc"),children:f.jsx("button",{className:"qt-setting-btn",onClick:s,children:e("settings.data.export.action")})}),f.jsx(fe,{title:e("settings.data.import"),description:e("settings.data.import.desc"),children:f.jsx("button",{className:"qt-setting-btn",onClick:l,children:e("settings.data.import.action")})})]})}function EL(){const{t:e}=ve(),[t,n]=hA(),[r,i]=fA(),[o,s]=wd(),[l,a]=xd(),[c,h]=gA(),[d,u]=pA(),[p,g]=nR(),[y,q]=yA();return f.jsxs("div",{children:[f.jsx(Wo,{title:e("settings.interface.title"),subtitle:e("settings.interface.subtitle")}),f.jsx(fe,{id:"showPhonetic",title:e("settings.interface.showPhonetic"),description:e("settings.interface.showPhonetic.desc"),divider:!1,children:f.jsx(kt,{checked:o,onChange:s})}),f.jsx(fe,{id:"showGloss",title:e("settings.interface.showGloss"),description:e("settings.interface.showGloss.desc"),children:f.jsx(kt,{checked:l,onChange:a})}),f.jsx(fe,{id:"neighborPreview",title:e("settings.interface.neighborPreview"),description:e("settings.interface.neighborPreview.desc"),children:f.jsx(kt,{checked:r,onChange:i})}),f.jsx(fe,{id:"autoHideCursor",title:e("settings.interface.autoHideCursor"),description:e("settings.interface.autoHideCursor.desc"),children:f.jsx(kt,{checked:t,onChange:n})}),f.jsx(fe,{id:"showResultPopup",title:e("settings.interface.showResultPopup"),description:e("settings.interface.showResultPopup.desc"),children:f.jsx(kt,{checked:c,onChange:h})}),f.jsx(fe,{id:"codeSyntaxHighlight",title:e("settings.interface.codeSyntaxHighlight"),description:e("settings.interface.codeSyntaxHighlight.desc"),children:f.jsx(kt,{checked:p,onChange:g})}),f.jsx(fe,{id:"mathRenderer",title:e("settings.interface.mathRenderer"),description:e("settings.interface.mathRenderer.desc"),children:f.jsx(kt,{checked:y,onChange:q})}),f.jsx(fe,{id:"afkSeconds",title:e("settings.interface.afkSeconds"),description:e("settings.interface.afkSeconds.desc"),children:f.jsx(ot,{value:String(d),onChange:m=>u(parseInt(m,10)),options:[{value:"10",label:"10s"},{value:"15",label:"15s"},{value:"30",label:"30s"},{value:"60",label:"60s"},{value:"120",label:"2m"}]})})]})}const g6=800,RL=4,ni=(()=>{const e=["LHome","L00","L01","L02","L03","L04","L05","L10","L11","L12","L13","L14","L15","L20","L21","L22","L23","L24","L25","L30","L31","L32","L33","L34","L35","L40"],t=["RHome","R00","R01","R02","R03","R04","R05","R06","R07","R10","R11","R12","R13","R14","R15","R16","R17","R20","R21","R22","R23","R24","R25","R26","R30","R31","R32","R33","R34","R35","R40"],n=[];return e.forEach((r,i)=>{r==="LHome"?n.push({id:r,label:"L·home",side:"left"}):n.push({id:r,label:`L${i-1}`,side:"left"})}),t.forEach((r,i)=>{r==="RHome"?n.push({id:r,label:"R·home",side:"right"}):n.push({id:r,label:`R${i-1}`,side:"right"})}),n})();function _L({open:e,onOpenChange:t}){var R,T,E;const{t:n}=ve(),[r,i]=v.useState(0),o=ni[r],[s,l]=v.useState(()=>yi()),[a,c]=v.useState(null),[h,d]=v.useState(!1);v.useEffect(()=>c(null),[r]);const u=s[o.id]??Vs[o.id]??{x:0,y:0,svg:o.id},p=a??u,g=p.svg??o.id,y=a!==null,q=s[o.id],m=!!q&&(q.x!==((R=Vs[o.id])==null?void 0:R.x)||q.y!==((T=Vs[o.id])==null?void 0:T.y)||q.svg!==((E=Vs[o.id])==null?void 0:E.svg)),A=v.useRef(null),w=v.useCallback(C=>{C.preventDefault();const _=C.currentTarget.offsetParent,L=_==null?void 0:_.getBoundingClientRect(),D=L&&(_!=null&&_.offsetWidth)?L.width/_.offsetWidth:1;A.current={startX:C.clientX,startY:C.clientY,origX:p.x,origY:p.y,scale:D,moved:!1};const M=C.currentTarget;M.setPointerCapture(C.pointerId);const N=$=>{const P=A.current;if(!P)return;const H=$.clientX-P.startX,Z=$.clientY-P.startY;if(!P.moved&&Math.hypot(H,Z)>RL&&(P.moved=!0),P.moved){const G=H/P.scale,Q=Z/P.scale;c(le=>({x:P.origX+G,y:P.origY+Q,svg:(le==null?void 0:le.svg)??p.svg}))}},O=$=>{M.releasePointerCapture($.pointerId),M.removeEventListener("pointermove",N),M.removeEventListener("pointerup",O),M.removeEventListener("pointercancel",O);const P=A.current;A.current=null,P&&!P.moved&&d(!0)};M.addEventListener("pointermove",N),M.addEventListener("pointerup",O),M.addEventListener("pointercancel",O)},[p.x,p.y,p.svg]);v.useEffect(()=>{if(!e||h)return;const C=_=>{var M;const L=(M=_.target)==null?void 0:M.tagName;if(L==="INPUT"||L==="TEXTAREA")return;const D=_.shiftKey?10:1;if(_.key==="ArrowLeft"||_.key==="ArrowRight"||_.key==="ArrowUp"||_.key==="ArrowDown"){_.preventDefault();const N=_.key==="ArrowLeft"?-D:_.key==="ArrowRight"?D:0,O=_.key==="ArrowUp"?-D:_.key==="ArrowDown"?D:0;c($=>({x:(($==null?void 0:$.x)??p.x)+N,y:(($==null?void 0:$.y)??p.y)+O,svg:($==null?void 0:$.svg)??p.svg}))}else _.key==="["?i(N=>(N-1+ni.length)%ni.length):_.key==="]"&&i(N=>(N+1)%ni.length)};return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[e,h,p.x,p.y,p.svg]);const x=()=>{a&&(NM(o.id,{x:a.x,y:a.y,svg:a.svg??g}),l(yi()),c(null))},V=()=>c(null),k=()=>{DM(o.id),l(yi()),c(null)},b=async()=>{await T1({message:n("confirm.resetAllOffsets"),danger:!0})&&(OM(),l(yi()),c(null))},j=()=>BM("keyBindings.json"),z=()=>i(C=>(C-1+ni.length)%ni.length),S=()=>i(C=>(C+1)%ni.length);return f.jsxs(f.Fragment,{children:[f.jsx(sc,{open:e,onOpenChange:t,children:f.jsxs(lc,{children:[f.jsx(ac,{className:"qt-kcal__overlay"}),f.jsxs(cc,{className:"qt-kcal__content",children:[f.jsxs("div",{className:"qt-kcal__header",children:[f.jsx(pd,{className:"qt-kcal__title",children:n("calibrator.title")}),f.jsx("span",{className:"qt-kcal__hint",children:n("calibrator.hint")}),f.jsx(V4,{className:"qt-kcal__close","aria-label":n("common.close"),children:"×"})]}),f.jsxs("div",{className:"qt-kcal__body",children:[f.jsxs("div",{className:"qt-kcal__nav",children:[f.jsx("button",{className:"qt-kcal__btn",onClick:z,children:n("calibrator.prev")}),f.jsxs("div",{className:"qt-kcal__pose-label",children:[f.jsx("span",{className:"qt-kcal__pose-side",children:o.side==="left"?n("calibrator.leftHand"):n("calibrator.rightHand")}),f.jsx("span",{className:"qt-kcal__pose-name",children:o.label}),f.jsxs("span",{className:"qt-kcal__pose-idx",children:[r+1," / ",ni.length]})]}),f.jsx("button",{className:"qt-kcal__btn",onClick:S,children:n("calibrator.next")})]}),f.jsx("div",{className:"qt-kcal__stage",children:f.jsx(HA,{showHands:!0,calibration:{handId:o.id,svgId:g,offset:{x:p.x,y:p.y},onHandPointerDown:w}})}),f.jsxs("div",{className:"qt-kcal__coords",children:[f.jsxs("span",{children:[f.jsx("b",{children:o.id}),f.jsxs("span",{className:"qt-kcal__svg-tag",children:[" → svg: ",g]})]}),f.jsxs("span",{children:["x: ",p.x.toFixed(1)]}),f.jsxs("span",{children:["y: ",p.y.toFixed(1)]}),y&&f.jsx("span",{className:"qt-kcal__dirty",children:n("calibrator.unsaved")}),!y&&m&&f.jsx("span",{className:"qt-kcal__customized",children:n("calibrator.customized")})]}),f.jsxs("div",{className:"qt-kcal__actions",children:[f.jsx("button",{className:"qt-kcal__btn qt-kcal__btn--primary",onClick:x,disabled:!y,children:n("calibrator.save")}),f.jsx("button",{className:"qt-kcal__btn",onClick:V,disabled:!y,children:n("calibrator.cancel")}),f.jsx("button",{className:"qt-kcal__btn",onClick:k,disabled:!m&&!y,children:n("calibrator.resetThis")})]})]}),f.jsxs("div",{className:"qt-kcal__footer",children:[f.jsx("button",{className:"qt-kcal__btn",onClick:b,children:n("calibrator.resetAll")}),f.jsx("div",{className:"qt-kcal__footer-spacer"}),f.jsx("button",{className:"qt-kcal__btn qt-kcal__btn--primary",onClick:j,children:n("calibrator.export")})]})]})]})}),f.jsx(TL,{open:h,currentSvg:g,side:o.side,onPick:C=>{c(_=>({x:(_==null?void 0:_.x)??p.x,y:(_==null?void 0:_.y)??p.y,svg:C})),d(!1)},onClose:()=>d(!1)})]})}function TL({open:e,currentSvg:t,side:n,onPick:r,onClose:i}){const{t:o}=ve(),s=v.useMemo(()=>{const l=n==="left"?"L":"R";return Object.keys(z1).filter(a=>a.startsWith(l)).sort((a,c)=>{const h=a==="LHome"||a==="RHome"?-1:parseInt(a.slice(1),10),d=c==="LHome"||c==="RHome"?-1:parseInt(c.slice(1),10);return h-d})},[n]);return f.jsx(sc,{open:e,onOpenChange:l=>!l&&i(),children:f.jsxs(lc,{children:[f.jsx(ac,{className:"qt-kcal__picker-overlay"}),f.jsxs(cc,{className:"qt-kcal__picker",children:[f.jsxs("div",{className:"qt-kcal__picker-header",children:[f.jsx(pd,{className:"qt-kcal__picker-title",children:o("calibrator.picker.title",{side:o(n==="left"?"calibrator.leftHand":"calibrator.rightHand")})}),f.jsx(V4,{className:"qt-kcal__close","aria-label":o("common.close"),children:"×"})]}),f.jsx("div",{className:"qt-kcal__picker-grid",children:s.map(l=>{const a=z1[l];return f.jsx("button",{className:`qt-kcal__picker-cell ${l===t?"is-selected":""}`,onClick:()=>r(l),title:l,children:f.jsx("svg",{viewBox:`0 0 ${g6} ${g6}`,width:bs/3,height:bs/3,dangerouslySetInnerHTML:{__html:a}})},l)})})]})]})})}function ML(){const{t:e}=ve(),[t,n]=cA(),[r,i]=uA(),[o,s]=dA(),[l,a]=v.useState(!1);return f.jsxs("div",{children:[f.jsx(Wo,{title:e("settings.keyboard.title"),subtitle:e("settings.keyboard.subtitle")}),f.jsx(fe,{id:"showKeyboard",title:e("settings.keyboard.showKeyboard"),description:e("settings.keyboard.showKeyboard.desc"),divider:!1,children:f.jsx(kt,{checked:t,onChange:n})}),f.jsx(fe,{id:"showHands",title:e("settings.keyboard.showHands"),description:e("settings.keyboard.showHands.desc"),children:f.jsx(kt,{checked:r&&t,onChange:i})}),f.jsx(fe,{id:"keyboardSize",title:e("settings.keyboard.size"),description:e("settings.keyboard.size.desc"),children:f.jsx(ot,{value:o,onChange:s,options:[{value:"s",label:e("size.s")},{value:"m",label:e("size.m")},{value:"l",label:e("size.l")}]})}),f.jsx(fe,{id:"calibrate",title:e("settings.keyboard.calibrate"),description:e("settings.keyboard.calibrate.desc"),children:f.jsx("button",{type:"button",className:"qt-setting-btn",onClick:()=>a(!0),children:e("settings.keyboard.calibrate.open")})}),f.jsx(_L,{open:l,onOpenChange:a})]})}function PL(){const{t:e}=ve(),[t,n]=v.useState(null),r=v.useMemo(()=>{const o=new Map;for(const s of pl){if(s.paletteOnly)continue;const l=s.group??"other",a=o.get(l)??[];a.push(s),o.set(l,a)}return Array.from(o.entries())},[]);v.useEffect(()=>{if(!t)return;const o=s=>{if(s.preventDefault(),s.stopPropagation(),s.key==="Escape"){n(null);return}const l=qy(s);l&&(by(t,[CC(l)]),n(null))};return window.addEventListener("keydown",o,!0),()=>window.removeEventListener("keydown",o,!0)},[t]);const i=async()=>{await T1({message:e("settings.shortcuts.confirmResetAll"),danger:!0})&&LC()};return f.jsxs("div",{children:[f.jsx(Wo,{title:e("settings.shortcuts.title"),subtitle:e("settings.shortcuts.subtitle")}),f.jsx("div",{className:"qt-shortcuts",children:r.map(([o,s])=>f.jsxs("div",{className:"qt-shortcuts__group",children:[f.jsx("div",{className:"qt-shortcuts__group-title",children:e(`settings.shortcuts.group.${o}`)}),s.map(l=>f.jsx(IL,{actionId:l.id,labelKey:l.labelKey,recording:t===l.id,onRecord:()=>n(l.id),onCancel:()=>n(null)},l.id))]},o))}),f.jsx(fe,{title:"",description:"",children:f.jsx("button",{className:"qt-setting-btn",onClick:i,children:e("settings.shortcuts.resetAll")})})]})}function IL({actionId:e,labelKey:t,recording:n,onRecord:r,onCancel:i}){var h;const{t:o}=ve(),s=ai(e),l=s[0]??"",a=l?NC(l,e):[],c=l?!PC(l):!1;return f.jsxs("div",{className:"qt-shortcut-row",children:[f.jsx("div",{className:"qt-shortcut-row__label",children:o(t)}),f.jsx("button",{className:`qt-shortcut-row__key ${n?"is-recording":""}`,onClick:()=>n?i():r(),children:n?f.jsx("span",{className:"qt-shortcut-row__hint",children:o("settings.shortcuts.recording")}):s.length===0?f.jsx("span",{className:"qt-shortcut-row__disabled",children:o("settings.shortcuts.disabled")}):f.jsx("kbd",{className:"qt-shortcut-row__kbd",children:Ho(s)})}),f.jsx("button",{className:"qt-shortcut-row__btn",onClick:()=>IC(e),title:o("settings.shortcuts.reset"),"aria-label":o("settings.shortcuts.reset"),children:"↻"}),f.jsx("button",{className:"qt-shortcut-row__btn qt-shortcut-row__btn--danger",onClick:()=>by(e,[]),"aria-label":o("settings.shortcuts.disabled"),children:"×"}),(a.length>0||c)&&f.jsxs("div",{className:"qt-shortcut-row__warn",children:[a.length>0&&f.jsx("span",{children:o("settings.shortcuts.conflict",{name:o(((h=z4(a[0]))==null?void 0:h.labelKey)??a[0])})}),c&&f.jsx("span",{children:o("settings.shortcuts.noModifier")})]})]})}function LL(){const{t:e}=ve(),[t,n]=de("settings","hint","ghost",{serialize:_=>_,deserialize:_=>_==="none"||_==="ghost"?_:"ghost"}),[r,i]=Zy(),[o,s]=D4(),[l,a]=Xy(),[c,h]=K4(),[d,u]=Jy(),[p,g]=eA(),[y,q]=tA(),[m,A]=nA(),[w,x]=rA(),[V,k]=iA(),[b,j]=O4(),[z,S]=B4(),[R,T]=F4(),[E,C]=mA();return f.jsxs("div",{children:[f.jsx(Wo,{title:e("settings.typing.title"),subtitle:e("settings.typing.subtitle")}),f.jsx(fe,{id:"hint",title:e("settings.typing.hint"),description:e("settings.typing.hint.desc"),divider:!1,children:f.jsx(ot,{value:t,onChange:n,options:[{value:"none",label:e("common.off")},{value:"ghost",label:e("common.on")}]})}),f.jsx(fe,{id:"speedUnit",title:e("settings.typing.speedUnit"),description:e("settings.typing.speedUnit.desc"),children:f.jsx(ot,{value:c,onChange:h,options:[{value:"wpm",label:"WPM"},{value:"cpm",label:"CPM"}]})}),f.jsx(fe,{id:"targetWpm",title:e("settings.typing.targetWpm"),description:e("settings.typing.targetWpm.desc"),children:f.jsx(ot,{value:String(r),onChange:_=>i(parseInt(_,10)),options:[{value:"0",label:e("common.off")},{value:"20",label:"20"},{value:"40",label:"40"},{value:"60",label:"60"},{value:"80",label:"80"}]})}),f.jsx(fe,{id:"maxWrongRate",title:e("settings.typing.maxWrongRate"),description:e("settings.typing.maxWrongRate.desc"),children:f.jsx(ot,{value:String(d),onChange:_=>u(parseInt(_,10)),options:[{value:"0",label:e("common.off")},{value:"5",label:"5%"},{value:"10",label:"10%"},{value:"20",label:"20%"}]})}),f.jsx(fe,{id:"tabBehavior",title:e("settings.typing.tabBehavior"),description:e("settings.typing.tabBehavior.desc"),children:f.jsx(ot,{value:o,onChange:s,options:[{value:"reset",label:e("settings.typing.tabBehavior.reset")},{value:"input",label:e("settings.typing.tabBehavior.input")}]})}),o==="input"&&f.jsx(fe,{id:"tabWidth",title:e("settings.typing.tabWidth"),description:e("settings.typing.tabWidth.desc"),children:f.jsx(ot,{value:String(l),onChange:_=>a(_==="2"?2:4),options:[{value:"2",label:e("settings.typing.tabWidth.2")},{value:"4",label:e("settings.typing.tabWidth.4")}]})}),f.jsx(fe,{id:"completion",title:e("settings.typing.completion"),description:e("settings.typing.completion.desc"),children:f.jsx(ot,{value:p,onChange:g,options:[{value:"through",label:e("settings.typing.completion.through")},{value:"lenient",label:e("settings.typing.completion.lenient")},{value:"perfect",label:e("settings.typing.completion.perfect")}]})}),f.jsx(fe,{id:"advance",title:e("settings.typing.advance"),description:e("settings.typing.advance.desc"),children:f.jsx(ot,{value:y,onChange:q,options:[{value:"auto",label:e("settings.typing.advance.auto")},{value:"manual",label:e("settings.typing.advance.manual")}]})}),y==="manual"&&f.jsx(fe,{id:"confirmKey",title:e("settings.typing.confirmKey"),description:e("settings.typing.confirmKey.desc"),children:f.jsx(ot,{value:m,onChange:A,options:[{value:"Enter",label:e("settings.typing.confirmKey.enter")},{value:"Space",label:e("settings.typing.confirmKey.space")}]})}),f.jsx(fe,{id:"retry",title:e("settings.typing.retry"),description:e("settings.typing.retry.desc"),children:f.jsx(ot,{value:w,onChange:x,options:[{value:"off",label:e("settings.typing.retry.off")},{value:"auto",label:e("settings.typing.retry.auto")},{value:"immediate",label:e("settings.typing.retry.immediate")}]})}),f.jsx(fe,{id:"maxRetries",title:e("settings.typing.maxRetries"),description:e("settings.typing.maxRetries.desc"),children:f.jsx(ot,{value:String(V),onChange:_=>k(parseInt(_,10)),options:[{value:"3",label:"3"},{value:"5",label:"5"},{value:"10",label:"10"},{value:"0",label:e("settings.typing.maxRetries.unlimited")}]})}),f.jsx(fe,{id:"ignoreCase",title:e("settings.typing.ignoreCase"),description:e("settings.typing.ignoreCase.desc"),children:f.jsx(kt,{checked:b,onChange:j})}),f.jsx(fe,{id:"ignorePunctuation",title:e("settings.typing.ignorePunctuation"),description:e("settings.typing.ignorePunctuation.desc"),children:f.jsx(kt,{checked:z,onChange:S})}),f.jsx(fe,{id:"allowBackspace",title:e("settings.typing.allowBackspace"),description:e("settings.typing.allowBackspace.desc"),children:f.jsx(kt,{checked:R,onChange:T})}),f.jsx(fe,{id:"minAccuracy",title:e("settings.typing.minAccuracy"),description:e("settings.typing.minAccuracy.desc"),children:f.jsx(ot,{value:String(E),onChange:_=>C(parseInt(_,10)),options:[{value:"0",label:e("common.off")},{value:"70",label:"70%"},{value:"80",label:"80%"},{value:"90",label:"90%"},{value:"95",label:"95%"}]})})]})}function p6({text:e,query:t,className:n}){const r=t.trim();if(!r)return f.jsx("span",{className:n,children:e});const i=e.toLowerCase(),o=r.toLowerCase(),s=[];let l=0,a=i.indexOf(o,l),c=0;for(;a!==-1;)a>l&&s.push(e.slice(l,a)),s.push(f.jsx("mark",{className:"qt-settings__highlight",children:e.slice(a,a+o.length)},c++)),l=a+o.length,a=i.indexOf(o,l);return l<e.length&&s.push(e.slice(l)),f.jsx("span",{className:n,children:s})}function NL({query:e,matches:t,onPick:n}){const{t:r}=ve();if(t.length===0)return f.jsx("div",{className:"qt-settings-search__empty",children:r("settings.search.empty",{query:e})});const i=new Map;for(const o of t){const s=i.get(o.tab)??[];s.push(o),i.set(o.tab,s)}return f.jsxs("div",{className:"qt-settings-search",children:[f.jsx("div",{className:"qt-settings-search__count",children:r("settings.search.resultCount",{count:t.length})}),Array.from(i.entries()).map(([o,s])=>f.jsxs("div",{className:"qt-settings-search__group",children:[f.jsx("div",{className:"qt-settings-search__group-label",children:r(Hy[o])}),s.map(l=>f.jsxs("button",{type:"button",className:"qt-settings-search__row",onClick:()=>n(l.id,l.tab),children:[f.jsx("div",{className:"qt-settings-search__row-title",children:f.jsx(p6,{text:r(l.titleKey),query:e})}),l.descKey&&f.jsx("div",{className:"qt-settings-search__row-desc",children:f.jsx(p6,{text:r(l.descKey),query:e})})]},l.id))]},o))]})}function DL({activeTab:e,expandedGroups:t,onTabChange:n,onGroupToggle:r,matchCounts:i,searching:o=!1}){const{t:s}=ve();return f.jsx("nav",{className:"qt-settings-sidebar","aria-label":s("settings.sidebar.aria"),children:N4.map(l=>{const a=t.has(l.id),c=o?l.tabs.reduce((d,u)=>d+((i==null?void 0:i.get(u))??0),0):0,h=o&&c===0;return f.jsxs("div",{className:"qt-settings-sidebar__group",children:[f.jsxs("button",{type:"button",className:`qt-settings-sidebar__group-row ${h?"is-dim":""}`,onClick:()=>r(l.id),"aria-expanded":a,children:[f.jsx(n4,{size:12,className:`qt-settings-sidebar__chevron ${a?"is-open":""}`}),f.jsx("span",{className:"qt-settings-sidebar__group-label",children:s(l.labelKey)}),o&&c>0&&f.jsx("span",{className:"qt-settings-sidebar__count",children:c})]}),a&&f.jsx("div",{role:"list",className:"qt-settings-sidebar__tabs",children:l.tabs.map(d=>{const u=(i==null?void 0:i.get(d))??0,p=o&&u===0;return f.jsxs("button",{type:"button",role:"listitem",className:`qt-settings-sidebar__tab ${e===d?"is-active":""} ${p?"is-dim":""}`,onClick:()=>n(d),"aria-current":e===d?"page":void 0,disabled:p,children:[f.jsx("span",{className:"qt-settings-sidebar__tab-label",children:s(Hy[d])}),o&&u>0&&f.jsx("span",{className:"qt-settings-sidebar__count",children:u})]},d)})})]},l.id)})})}const OL="qtype.settings-dialog.sidebar",BL="qtype.settings-dialog.content",FL=["[data-separator]","[data-panel-resize-handle-enabled]","[data-panel-group]","[data-group]"].join(",");function m6(e){return e instanceof HTMLElement?e.closest(FL)!==null:!1}function HL(e){switch(e){case"appearance":return f.jsx(rR,{});case"data":return f.jsx(CL,{});case"typing-rules":return f.jsx(LL,{});case"audio":return f.jsx(iR,{});case"interface":return f.jsx(EL,{});case"keyboard":return f.jsx(ML,{});case"shortcuts":return f.jsx(PL,{});default:return null}}function UL(){const{isOpen:e,isExpanded:t,activeTab:n,expandedGroups:r,query:i,close:o,setTab:s,toggleGroup:l,toggleExpanded:a,setQuery:c,clearQuery:h,revealSetting:d}=Wy(),{t:u}=ve(),p=v.useMemo(()=>i?eR(i,u):[],[i,u]),g=v.useMemo(()=>{const q=new Map;for(const m of p)q.set(m.tab,(q.get(m.tab)??0)+1);return q},[p]),y=i.trim().length>0;return f.jsx(sc,{open:e,onOpenChange:q=>!q&&o(),children:f.jsxs(lc,{children:[f.jsx(ac,{className:"qt-settings__overlay"}),f.jsxs(cc,{className:`qt-settings__content ${t?"is-expanded":""}`,onOpenAutoFocus:q=>q.preventDefault(),onPointerDownOutside:q=>{m6(q.target)&&q.preventDefault()},onInteractOutside:q=>{m6(q.target)&&q.preventDefault()},children:[f.jsxs("div",{className:"qt-settings__titlebar",children:[f.jsxs("div",{className:"qt-settings__brand",children:[f.jsx(Q8,{size:14,strokeWidth:1.6}),f.jsx(pd,{className:"qt-settings__brand-text",children:u("settings.title")})]}),f.jsx(uy,{className:"qt-sr-only",children:u("settings.subtitle")}),f.jsxs("div",{className:"qt-settings__titlebar-actions",children:[f.jsx("button",{type:"button",className:"qt-settings__icon-btn",onClick:a,"aria-label":u(t?"settings.action.shrink":"settings.action.expand"),title:u(t?"settings.action.shrink":"settings.action.expand"),children:t?f.jsx(Nk,{size:14,strokeWidth:1.6}):f.jsx(Lk,{size:14,strokeWidth:1.6})}),f.jsx(V4,{asChild:!0,children:f.jsx("button",{type:"button",className:"qt-settings__icon-btn","aria-label":u("common.close"),children:f.jsx(w0,{size:15,strokeWidth:1.6})})})]})]}),f.jsxs("div",{className:"qt-settings__body",children:[f.jsxs("div",{className:"qt-settings__search",children:[f.jsx(Ik,{size:13,strokeWidth:1.6}),f.jsx("input",{type:"text",value:i,onChange:q=>c(q.target.value),placeholder:u("settings.search.placeholder"),"aria-label":u("settings.search.placeholder"),autoFocus:!0}),i&&f.jsx("button",{type:"button",className:"qt-settings__search-clear",onClick:h,"aria-label":u("common.close"),children:f.jsx(w0,{size:15,strokeWidth:1.6})})]}),f.jsxs(By,{id:"qtype.settings-dialog",orientation:"horizontal",className:"qt-settings__group",children:[f.jsx(Af,{id:OL,defaultSize:"220px",minSize:"120px",className:"qt-settings__pane",children:f.jsx("div",{className:"qt-settings__card",children:f.jsx(DL,{activeTab:n,expandedGroups:r,onTabChange:s,onGroupToggle:l,matchCounts:g,searching:y})})}),f.jsx(Fy,{className:"qt-settings__separator"}),f.jsx(Af,{id:BL,minSize:"300px",className:"qt-settings__pane",children:f.jsx("div",{className:"qt-settings__card",children:f.jsx("div",{className:"qt-settings__content-scroll",children:y?f.jsx(NL,{query:i,matches:p,onPick:d}):HL(n)})})})]})]})]})]})})}function WL(){return typeof navigator>"u"?"browser":(navigator.language||"").toLowerCase().startsWith("zh")?"youdao":"google"}function mg(){const[e]=lA();return v.useMemo(()=>e!=="auto"?e:WL(),[e])}let Hh=null,y6=!1;function KL(){y6||(y6=!0,tg(()=>Promise.resolve({}),__vite__mapDeps([0])))}function $L(){return Hh||(KL(),Hh=tg(()=>import("./katex-C5jXJg4s.js"),[]).then(e=>({renderToString:e.default.renderToString}))),Hh}function GL(e){const[t,n]=v.useState(null);return v.useEffect(()=>{if(!e)return;let r=!1;return $L().then(i=>{r||n(i)}),()=>{r=!0}},[e]),t}const yg=v.createContext({svgs:{},ensureFile:()=>{}});function QL({children:e}){const[t,n]=v.useState({}),r=v.useRef(new Set),i=v.useRef(!1),o=v.useMemo(()=>l=>{if(r.current.has(l))return;r.current.add(l);const a=l.replace(/\.md$/,".mermaid.json");fetch(`/material/${a}`).then(c=>c.ok?c.json():null).then(c=>{if(!c||typeof c!="object"||(n(d=>({...d,...c})),i.current))return;i.current=!0;const h="qt-mermaid-css";document.getElementById(h)||fetch("/material/mermaid.css").then(d=>{d.ok&&d.text().then(u=>{const p=document.createElement("style");p.id=h,p.textContent=u,document.head.appendChild(p)})})}).catch(()=>{})},[]),s=v.useMemo(()=>({svgs:t,ensureFile:o}),[t,o]);return f.jsx(yg.Provider,{value:s,children:e})}function YL(){return v.useContext(yg).ensureFile}const ZL=/\$\$([\s\S]+?)\$\$/,XL=/\$([^$\n]+?)\$/,JL="/material";function eN(e){return/^(?:[a-z][a-z0-9+.-]*:|\/\/|\/)/i.test(e)?e:`${JL}/${e.replace(/^\.\//,"")}`}function Ag({source:e}){const{svgs:t}=v.useContext(yg),[n]=yA(),r=n&&(ZL.test(e)||XL.test(e)),i=GL(r),o=v.useMemo(()=>tN(e,t,n,i),[e,t,n,i]),s=v.useRef(null);return v.useEffect(()=>{if(!i||!s.current)return;s.current.querySelectorAll(".qt-md-math[data-math-pending], .qt-md-math-inline[data-math-pending]").forEach(a=>{const c=a.dataset.mathSrc;if(c===void 0)return;const h=a.classList.contains("qt-md-math");try{a.innerHTML=i.renderToString(c,{throwOnError:!1,displayMode:h})}catch{a.textContent=c}delete a.dataset.mathPending})},[i,o]),f.jsx("div",{ref:s,className:"qt-md",dangerouslySetInnerHTML:{__html:o}})}function tN(e,t,n,r){const i=x=>x.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),o=[],s=e.replace(/\$\$([\s\S]+?)\$\$/g,(x,V)=>{const k=o.length;return o.push(String(V).trim()),`
183
183