dsh-aha-tutor 1.9.0 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/README.en.md +2 -2
- package/README.md +2 -2
- package/docs/guide.zh-CN.md +6 -4
- package/lib/agent.js +1 -1
- package/lib/client.js +16 -16
- package/lib/index.js +283 -141
- package/lib/{runtime-C3yJfJTT.js → runtime-DkuLvkuv.js} +34 -9
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
window.__ModuleLoader__.load({id:`dsh-aha-tutor`,factory:e=>{var t={exports:{}},n=t.exports;Object.defineProperty(n,Symbol.toStringTag,{value:`Module`});let r=e("react"),i=e("react/jsx-runtime"),a=e("@deepseek-ai/dsh-client-ui-primitives"),o=e("react-dom");var s=class extends r.Component{constructor(e){super(e),this.state={failed:!1,error:null,resetKey:e.resetKey},this.retry=()=>this.setState({failed:!1,error:null})}static getDerivedStateFromError(e){return{failed:!0,error:e}}static getDerivedStateFromProps(e,t){return e.resetKey===t.resetKey?null:{failed:!1,error:null,resetKey:e.resetKey}}componentDidCatch(e){this.props.onError?.(e)}render(){return this.state.failed?this.props.fallback({error:this.state.error,retry:this.retry}):this.props.children}};function c(e){return String(e?.message??e).slice(0,300)}function l({t:e,error:t,place:n=`page`,onRetry:i,onHome:a}){let o=i?(0,r.createElement)(`button`,{type:`button`,className:`aha-btn`,"data-size":n===`page`?void 0:`sm`,onClick:i},e(`retry`)):null;return n===`card`?(0,r.createElement)(`div`,{className:`aha-spread`,role:`alert`},(0,r.createElement)(`span`,{className:`aha-error`,title:c(t)},e(`crashPart`)),o):n===`tab`?(0,r.createElement)(`div`,{className:`aha-col`,role:`alert`,style:{gap:8}},(0,r.createElement)(`p`,{className:`aha-error`,title:c(t)},e(`crashPart`)),o?(0,r.createElement)(`div`,null,o):null):(0,r.createElement)(`div`,{className:`aha-page`},(0,r.createElement)(`div`,{className:`aha-card`,role:`alert`,style:{alignItems:`center`,textAlign:`center`,gap:12,padding:`28px 16px`}},(0,r.createElement)(`p`,{className:`aha-cardTitle`,title:c(t)},e(`crashPage`)),o?(0,r.createElement)(`p`,{className:`aha-hint`},e(`crashPageHint`)):null,(0,r.createElement)(`div`,{className:`aha-row`,style:{justifyContent:`center`}},o,(0,r.createElement)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,onClick:a},e(`backHome`)))))}var u=class extends Error{constructor(e,t){super(t),this.name=`ApiError`,this.code=e}};function d(e){async function t(t,n={}){let r;try{r=await e.call(`/aha-tutor`,t,n??{})}catch(e){throw new u(`connection`,e?.message||`Connection to DSH failed`)}if(!r?.ok)throw new u(r?.error?.code??`failed`,r?.error?.message??`Request failed`);return r.value}async function n(e,{onPartial:n,onProgress:r,onPreview:i,signal:a}={}){let o=e?.job;if(!o)return e;let s=0,c=o;for(;;){if(c.partial?.length&&(n?.(c.partial,s),s+=c.partial.length),c.progress&&r?.(c.progress),c.preview&&i?.(c.preview,c),c.status===`done`)return c.result;if(c.status===`cancelled`||a?.aborted)throw new u(`cancelled`,`cancelled`);if(c.status===`failed`)throw new u(c.error?.code??c.status,c.error?.message??c.status);if(c.status===`missing`)throw new u(`missing`,`The task was lost; try again`);await new Promise(e=>{setTimeout(e,650)}),c=await t(`job/get`,{id:o.id,since:s})}}async function r(e,r,i){return n(await t(e,r),i)}function i(e){let n=typeof e==`string`?e:e?.id;return n?t(`job/cancel`,{id:n}).catch(()=>void 0):Promise.resolve()}return{call:t,follow:n,run:r,cancel:i}}function f(e,t){return t?.id?{...e,jobId:t.id}:e}function p(e){return new Promise((t,n)=>{let r=new FileReader;r.onerror=()=>n(r.error??Error(`read failed`)),r.onload=()=>{let e=String(r.result??``);t(e.slice(e.indexOf(`,`)+1))},r.readAsDataURL(e)})}function m(e,t=`aha`){return String(e??``).replace(/[<>:"/\\|?*\u0000-\u001f]/gu,` `).replace(/\s+/gu,` `).trim().slice(0,60).trim()||t}function h(e,t,n=`application/json`){let r=URL.createObjectURL(new Blob([t],{type:`${n};charset=utf-8`})),i=document.createElement(`a`);i.href=r,i.download=e,document.body.append(i),i.click(),i.remove(),setTimeout(()=>URL.revokeObjectURL(r),5e3)}function g(e,t){let n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=e,document.body.append(r),r.click(),r.remove(),setTimeout(()=>URL.revokeObjectURL(n),1e4)}let _=(0,r.createContext)(null);function v(){let e=(0,r.useContext)(_);if(!e)throw Error(`AppContext missing`);return e}function y(e,t=[]){let[n,i]=(0,r.useState)({loading:!0,error:null,value:void 0}),a=(0,r.useRef)(0),o=(0,r.useCallback)(()=>{let t=++a.current;i(e=>({...e,loading:!0,error:null})),Promise.resolve().then(e).then(e=>{a.current===t&&i({loading:!1,error:null,value:e})}).catch(e=>{a.current===t&&i(t=>({loading:!1,error:e,value:t.value}))})},t);return(0,r.useEffect)(()=>(o(),()=>{a.current+=1}),[o]),{...n,reload:o,setValue:e=>i(t=>({...t,value:typeof e==`function`?e(t.value):e}))}}function b(){let{api:e}=v(),[t,n]=(0,r.useState)({running:!1,progress:null,preview:null,error:null}),i=(0,r.useRef)(null),a=(0,r.useRef)(null);(0,r.useEffect)(()=>()=>i.current?.abort(),[]);let o=(0,r.useCallback)(async(t,r,{onPartial:o,existing:s}={})=>{i.current?.abort();let c=new AbortController;i.current=c,a.current=s?.id??null,n({running:!0,progress:null,preview:null,error:null});try{let i={signal:c.signal,onPartial:o,onProgress:e=>{c.signal.aborted||n(t=>({...t,progress:e}))},onPreview:e=>{c.signal.aborted||n(t=>({...t,preview:e}))}},l=s?{job:s}:await e.call(t,r);l?.job?.id&&!c.signal.aborted&&(a.current=l.job.id);let u=await e.follow(l,i);return c.signal.aborted||n({running:!1,progress:null,preview:null,error:null}),u}catch(e){throw c.signal.aborted||n({running:!1,progress:null,preview:null,error:e}),e}},[e]),s=(0,r.useCallback)(()=>{i.current?.abort(),a.current&&e.cancel(a.current),a.current=null,n({running:!1,progress:null,preview:null,error:null})},[e]);return{...t,run:o,cancel:s}}function x(e){let[t]=(0,r.useState)(()=>{if(!e)return!1;let t=`aha-tutor:once:${e}`;try{if(window.sessionStorage.getItem(t))return!1;window.sessionStorage.setItem(t,`1`)}catch{}return!0});return t}function S(e,t){let[n,i]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{if(i(!1),!e)return;let n=setTimeout(()=>i(!0),t);return()=>clearTimeout(n)},[e,t]),e&&n}function C(e,t){let n=`aha-tutor:${e}`,[i,a]=(0,r.useState)(()=>{try{let e=window.localStorage.getItem(n);return e===null?t:JSON.parse(e)}catch{return t}});return(0,r.useEffect)(()=>{try{window.localStorage.setItem(n,JSON.stringify(i))}catch{}},[n,i]),[i,a]}function w(){let e=()=>{if(document.body?.hasAttribute(`data-ds-dark-theme`))return!0;let e=getComputedStyle(document.documentElement).colorScheme;return/dark/iu.test(e)&&!/light/iu.test(e)?!0:!document.body&&window.matchMedia?.(`(prefers-color-scheme: dark)`).matches===!0},[t,n]=(0,r.useState)(e);return(0,r.useEffect)(()=>{let t=window.matchMedia?.(`(prefers-color-scheme: dark)`),r=()=>n(e());t?.addEventListener?.(`change`,r);let i=new MutationObserver(r);return i.observe(document.body,{attributes:!0,attributeFilter:[`data-ds-dark-theme`]}),i.observe(document.documentElement,{attributes:!0,attributeFilter:[`style`,`data-ds-theme-source`]}),()=>{t?.removeEventListener?.(`change`,r),i.disconnect()}},[]),t}function T(e){let t=new Uint8Array(e);globalThis.crypto.getRandomValues(t);let n=``;for(let e of t)n+=(e%36).toString(36);return n}function E(e){if(!/^[a-z]{2,6}$/u.test(e))throw TypeError(`invalid id prefix "${e}"`);return`${e}_${Date.now().toString(36)}${T(6)}`}let D=Object.freeze({chars:240,nodes:400,depth:40});var O=class extends Error{constructor(e){super(e),this.name=`ExprError`}};let k=Object.freeze({sin:[1,Math.sin],cos:[1,Math.cos],tan:[1,Math.tan],cot:[1,e=>1/Math.tan(e)],sec:[1,e=>1/Math.cos(e)],csc:[1,e=>1/Math.sin(e)],asin:[1,Math.asin],acos:[1,Math.acos],atan:[1,Math.atan],arcsin:[1,Math.asin],arccos:[1,Math.acos],arctan:[1,Math.atan],atan2:[2,Math.atan2],sinh:[1,Math.sinh],cosh:[1,Math.cosh],tanh:[1,Math.tanh],asinh:[1,Math.asinh],acosh:[1,Math.acosh],atanh:[1,Math.atanh],exp:[1,Math.exp],ln:[1,Math.log],log:[1,Math.log10],lg:[1,Math.log10],log10:[1,Math.log10],log2:[1,Math.log2],sqrt:[1,Math.sqrt],cbrt:[1,Math.cbrt],abs:[1,Math.abs],sign:[1,Math.sign],floor:[1,Math.floor],ceil:[1,Math.ceil],round:[1,Math.round],min:[-2,Math.min],max:[-2,Math.max],pow:[2,Math.pow]}),A=Object.freeze({pi:Math.PI,π:Math.PI,e:Math.E}),ee=e=>Object.hasOwn(k,e),te=e=>Object.hasOwn(A,e),j=[[/[−–—]/gu,`-`],[/[×·⋅∙]/gu,`*`],[/÷/gu,`/`],[/\*\*/gu,`^`],[/²/gu,`^2`],[/³/gu,`^3`],[/[(]/gu,`(`],[/[)]/gu,`)`],[/[,]/gu,`,`]];function ne(e){let t=String(e??``);for(let[e,n]of j)t=t.replace(e,n);let n=[],r=0;for(;r<t.length;){let e=t[r];if(/\s/u.test(e)){r+=1;continue}let i=/^(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?/u.exec(t.slice(r));if(i){n.push({type:`num`,value:Number(i[0])}),r+=i[0].length;continue}let a=/^[\p{L}_][\p{L}\p{N}_]*/u.exec(t.slice(r));if(a){n.push({type:`name`,value:a[0]}),r+=a[0].length;continue}if(`+-*/^(),|√`.includes(e)){n.push({type:e}),r+=1;continue}throw new O(`Unexpected "${e}"`)}return n}function re(e,t=[]){let n=String(e??``);if(!n.trim())throw new O(`Empty formula`);if(n.length>D.chars)throw new O(`Formula too long`);let r=new Set(t),i=ne(n),a=0,o=0,s=0,c=()=>i[a],l=e=>{let t=i[a];if(!t||e&&t.type!==e)throw new O(e?`Expected "${e}"`:`Unexpected end`);return a+=1,t},u=e=>{if(o+=1,o>D.nodes)throw new O(`Formula too long`);return e},d=e=>{if(s+=1,s>D.depth)throw new O(`Formula nested too deeply`);try{return e()}finally{--s}},f=e=>e&&(e.type===`num`||e.type===`name`||e.type===`(`||e.type===`√`);function p(){let e=m();for(;c()?.type===`+`||c()?.type===`-`;){let t=l().type;e=u({k:`bin`,op:t,a:e,b:m()})}return e}function m(){let e=h();for(;;){let t=c();if(t?.type===`*`||t?.type===`/`)l(),e=u({k:`bin`,op:t.type,a:e,b:h()});else if(f(t))e=u({k:`bin`,op:`*`,a:e,b:g()});else return e}}function h(){let e=c();return e?.type===`-`?(l(),u({k:`neg`,a:d(h)})):e?.type===`+`?(l(),d(h)):g()}function g(){let e=b();return c()?.type===`^`?(l(),u({k:`bin`,op:`^`,a:e,b:d(h)})):e}function _(e){let[t]=k[e];l(`(`);let n=[d(p)];for(;c()?.type===`,`;)l(),n.push(d(p));if(l(`)`),t>0?n.length!==t:n.length<-t)throw new O(`${e} takes ${Math.abs(t)} argument${Math.abs(t)>1?`s`:``}`);return u({k:`call`,f:e,args:n})}function v(e){if(r.has(e))return u({k:`var`,n:e});if(te(e))return u({k:`num`,v:A[e]});if(ee(e)){if(c()?.type!==`(`)throw new O(`Write ${e}(…) with parentheses`);return _(e)}let t=y(e);if(!t)throw new O(`Unknown name "${e}"`);let n=null;for(let[i,a]of t.entries()){let o;if(ee(a)){if(i!==t.length-1||c()?.type!==`(`)throw new O(`Unknown name "${e}"`);o=_(a)}else o=u(r.has(a)?{k:`var`,n:a}:{k:`num`,v:A[a]});n=n?u({k:`bin`,op:`*`,a:n,b:o}):o}return n}function y(e){let t=[...r,...Object.keys(A),...Object.keys(k)].sort((e,t)=>t.length-e.length),n=[],i=e;for(;i;){let e=t.find(e=>i.startsWith(e));if(!e)return null;n.push(e),i=i.slice(e.length)}return n.length>1?n:null}function b(){let e=l();if(e.type===`num`)return u({k:`num`,v:e.value});if(e.type===`name`)return v(e.value);if(e.type===`(`){let e=d(p);return l(`)`),e}if(e.type===`|`){let e=d(p);return l(`|`),u({k:`call`,f:`abs`,args:[e]})}if(e.type===`√`)return u({k:`call`,f:`sqrt`,args:[d(g)]});throw new O(`Unexpected "${e.type}"`)}let x=p();if(a<i.length)throw new O(`Unexpected "${i[a].type===`name`||i[a].type===`num`?i[a].value:i[a].type}"`);return x}function ie(e,t=[]){let n=new Map(t.map((e,t)=>[e,t])),r=e=>{switch(e.k){case`num`:{let t=e.v;return()=>t}case`var`:{let t=n.get(e.n);if(t===void 0)throw new O(`Unknown name "${e.n}"`);return e=>e[t]}case`neg`:{let t=r(e.a);return e=>-t(e)}case`bin`:{let t=r(e.a),n=r(e.b);return e.op===`+`?e=>t(e)+n(e):e.op===`-`?e=>t(e)-n(e):e.op===`*`?e=>t(e)*n(e):e.op===`/`?e=>t(e)/n(e):e=>ae(t(e),n(e))}case`call`:{let t=k[e.f][1],n=e.args.map(r);if(n.length===1){let[e]=n;return n=>t(e(n))}return e=>t(...n.map(t=>t(e)))}default:throw new O(`Bad formula`)}};return r(e)}function ae(e,t){let n=e**t;if(!Number.isNaN(n)||e>=0||!Number.isFinite(t))return n;for(let n of[3,5,7,9]){let r=Math.round(t*n);if(Math.abs(r/n-t)<1e-9)return(-((-e)**(1/n)))**r}return n}let oe={0:`⁰`,1:`¹`,2:`²`,3:`³`,4:`⁴`,5:`⁵`,6:`⁶`,7:`⁷`,8:`⁸`,9:`⁹`,"-":`⁻`},se={pi:`π`,theta:`θ`,omega:`ω`,phi:`φ`,alpha:`α`,beta:`β`,lambda:`λ`,mu:`μ`,sigma:`σ`,tau:`τ`},ce={"+":1,"-":1,"*":2,"/":2,"^":4};function le(e){return Math.abs(e-Math.PI)<1e-12?`π`:Math.abs(e-Math.E)<1e-12?`e`:Number(e.toPrecision(6)).toString()}let ue=e=>[...String(e)].map(e=>oe[e]).join(``),de=e=>[...e].length===1&&/\p{L}/u.test(e);function fe(e,t=se){let n=e=>t[e]??e,r=(e,t=0)=>{switch(e.k){case`num`:return le(e.v);case`var`:return n(e.n);case`neg`:{let n=r(e.a,3);return t>2?`(−${n})`:`−${n}`}case`call`:return e.f===`abs`?`|${r(e.args[0])}|`:e.f===`sqrt`?`√(${r(e.args[0])})`:`${e.f}(${e.args.map(e=>r(e)).join(`, `)})`;case`bin`:{let n=ce[e.op],i;if(e.op===`^`){let t=r(e.a,5),n=e=>e.k===`num`&&Number.isInteger(e.v)&&Math.abs(e.v)<100,a=r(e.b);i=`${t}${n(e.b)?ue(e.b.v):e.b.k===`neg`&&n(e.b.a)?`⁻${ue(e.b.a.v)}`:de(a)?`^${a}`:`^(${a})`}`}else if(e.op===`*`){let t=r(e.a,n),a=r(e.b,n);i=e.a.k===`num`&&/\d$/u.test(t)&&/^[\p{L}(√|]/u.test(a)||de(t)&&(de(a)||a.startsWith(`(`))||e.a.k!==`call`&&/^[\d\p{L}]+$/u.test(t)&&/\p{L}$/u.test(t)&&de(a)||e.a.k!==`call`&&t.endsWith(`)`)&&a.startsWith(`(`)?`${t}${a}`:`${t}·${a}`}else{let t=r(e.a,n),a=r(e.b,e.op===`+`?n:n+.5);i=`${t} ${e.op===`-`?`−`:e.op} ${a}`}return n<t?`(${i})`:i}default:return``}};return r(e)}let pe=Object.freeze({fns:4,params:4,points:8,lines:6,shades:3,tangents:3,samples:480}),me=Object.freeze({fx:[`x`,`t`],param:[`t`,`θ`,`theta`],polar:[`θ`,`theta`,`t`]});function he(e,t){return me[e].filter(e=>!t.includes(e))}function ge(e){let t=e.params.map(e=>e.name);return e.fns.map(e=>{let n=he(e.kind,t),r=[...n,...t],i=e=>{let t=ie(re(e,r),r),i=Array(r.length).fill(0);return(e,r)=>{for(let t=0;t<n.length;t+=1)i[t]=e;for(let e=0;e<r.length;e+=1)i[n.length+e]=r[e];return t(i)}};if(e.kind===`polar`){let t=i(e.r);return{kind:`polar`,at:(e,n)=>{let r=t(e,n);return[r*Math.cos(e),r*Math.sin(e)]}}}if(e.kind===`param`){let t=i(e.x),n=i(e.y);return{kind:`param`,at:(e,r)=>[t(e,r),n(e,r)]}}let a=i(e.y);return{kind:`fx`,y:a,at:(e,t)=>[e,a(e,t)]}})}let _e=e=>e.params.map(e=>e.value);function ve(e,t,n,r=e.x){return e.fns.map((e,i)=>{let a=t[i],[o,s]=e.kind===`fx`?[Math.max(r?.min??-5,e.domain?.[0]??-1/0),Math.min(r?.max??5,e.domain?.[1]??1/0)]:e.t,c=e.kind===`fx`?pe.samples:pe.samples*1.5,l=[];if(!(s>o))return l;for(let e=0;e<=c;e+=1)l.push(a.at(o+(s-o)*e/c,n));return l})}function ye(e,t,n,r=1){let i=Math.max(1e-7,Math.abs(r)*1e-5);return(e.y(t+i,n)-e.y(t-i,n))/(2*i)}function be(e,t){return e[Math.min(e.length-1,Math.max(0,Math.round((e.length-1)*t)))]}function xe(e,t=ge(e)){let n=[[]];for(let t of e.params){let e=[];for(let r of n)for(let n of new Set([t.min,t.value,t.max]))e.push([...r,n]);n.splice(0,n.length,...e)}let r=[],i=[];for(let a of n)for(let n of ve(e,t,a))for(let[e,t]of n)!Number.isFinite(e)||!Number.isFinite(t)||(r.push(e),i.push(t));for(let t of e.points)Number.isFinite(t.y)&&i.push(t.y);for(let t of e.lines)t.y!==void 0&&i.push(t.y);let a=(e,t)=>{if(!e.length)return t;let n=[...e].sort((e,t)=>e-t),[r,i]=[n[0],n[n.length-1]],[a,o]=[be(n,.03),be(n,.97)];i-r>6*Math.max(1e-9,o-a)&&([r,i]=[a,o]),i-r<1e-9&&([r,i]=[r-1,i+1]);let s=(i-r)*.08;return r>0&&r<(i-r)*.35&&(r=0),i<0&&-i<(i-r)*.35&&(i=0),{min:r===0?0:r-s,max:i===0?0:i+s}},o=e.x??a(r,{min:-5,max:5}),s=e.y??a(i,{min:-5,max:5});return{x:{min:o.min,max:o.max},y:{min:Math.min(s.min,s.max-1e-9),max:s.max}}}function Se(e,t){try{return fe(re(e,[...new Set([...Object.values(me).flat(),...t.params.map(e=>e.name)])]))}catch{return e}}let Ce=e=>{if(!Number.isFinite(e))return String(e);let t=e/Math.PI;if(e!==0&&Math.abs(t*4-Math.round(t*4))<1e-6){let e=Math.round(t*4),[n,r]=e%4==0?[e/4,1]:e%2==0?[e/2,2]:[e,4],i=n===1?`π`:n===-1?`−π`:`${n}π`.replace(`-`,`−`);return r===1?i:`${i}/${r}`}return Number(e.toPrecision(4)).toString().replace(`-`,`−`)},we=Ce;function Te(e){return e.fns.map(t=>t.kind===`polar`?`r = ${Se(t.r,e)}`:t.kind===`param`?`x = ${Se(t.x,e)}, y = ${Se(t.y,e)}`:`y = ${Se(t.y,e)}`)}function Ee(e){let t=[e.title||e.caption].filter(Boolean),n=Te(e).map((t,n)=>{let r=e.fns[n],i=r.kind===`fx`?e.x?`, x ${Ce(r.domain?.[0]??e.x.min)} … ${Ce(r.domain?.[1]??e.x.max)}`:``:`, ${r.kind===`polar`?`θ`:`t`} ${Ce(r.t[0])} … ${Ce(r.t[1])}`;return`${r.name?`${r.name}: `:``}${t}${i}`});return t.push(...n),e.params.length&&t.push(e.params.map(e=>`${e.label||e.name} = ${Ce(e.value)} (${Ce(e.min)} … ${Ce(e.max)})`).join(`; `)),t.join(`
|
|
2
|
-
`)}Object.freeze({questions:6,options:5,units:12,lecturesPerUnit:8,lessonsPerLecture:8,lessons:120,objectives:5,concepts:6,projects:3,milestones:6,rubric:8,starterFiles:12,starterFileBytes:64*1024,practiceItems:12,options4:6,cards:60,sheetSections:24,sheetItems:16});function De(e,t=400){return e==null?``:String(e).replace(/\u0000/gu,``).trim().slice(0,t)}let Oe=Object.freeze([`intuition`,`definition`,`derivation`,`application`,`extension`]);function ke(e){let t=De(e,200),n=t.search(/[::]/u);return n>0?t.slice(0,n).trim():t}function Ae(e){let t=[];for(let n of e?.units??[])for(let e of n.lectures??[])for(let r of e.lessons??[])t.push({unit:n,lecture:e,lesson:r,index:t.length});return t}function je(e,t){let n=e=>{let t=new Map;for(let n of e?.units??[])for(let e of n.lectures??[])for(let r of e.lessons??[])t.set(r.id,{lesson:r,unit:n.title});return t},r=e=>JSON.stringify([e.summary??``,e.objectives??[],e.estMinutes??0,(e.concepts??[]).map(e=>e.name),e.depth??``]),i=n(e),a=n(t),o=[],s=[],c=[];for(let[e,t]of a){let n=i.get(e);n?n.lesson.title===t.lesson.title?(r(n.lesson)!==r(t.lesson)||n.unit!==t.unit)&&c.push({title:t.lesson.title,unit:t.unit}):s.push({from:n.lesson.title,to:t.lesson.title,unit:t.unit}):o.push({title:t.lesson.title,unit:t.unit})}let l=[...i].filter(([e])=>!a.has(e)).map(([,e])=>({title:e.lesson.title,unit:e.unit})),u=new Set((e?.units??[]).map(e=>e.id)),d=new Set((t?.units??[]).map(e=>e.id));return{title:(e?.title??``)===(t?.title??``)?null:{from:e?.title??``,to:t?.title??``},unitsAdded:(t?.units??[]).filter(e=>!u.has(e.id)).map(e=>e.title),unitsRemoved:(e?.units??[]).filter(e=>!d.has(e.id)).map(e=>e.title),added:o,removed:l,renamed:s,changed:c}}function Me(e){return!e.title&&!e.unitsAdded.length&&!e.unitsRemoved.length&&!e.added.length&&!e.removed.length&&!e.renamed.length&&!e.changed.length}function Ne(e){let t=new Map;for(let{lesson:n}of Ae(e))for(let e of n.concepts??[])t.set(e.id,{...e,lessonId:n.id});return t}function Pe(e,t){return e?.lessons?.[t]?.status??`new`}function Fe(e,t){let n=Ae(e),r=n.filter(e=>Pe(t,e.lesson.id)===`done`),i=n.filter(e=>Pe(t,e.lesson.id)!==`done`).reduce((e,t)=>e+(t.lesson.estMinutes||15),0);return{total:n.length,done:r.length,percent:n.length?Math.round(r.length/n.length*100):0,minutesLeft:i}}function Ie(e,t){let n=Ae(e);return n.find(e=>Pe(t,e.lesson.id)===`learning`)??n.find(e=>Pe(t,e.lesson.id)===`new`)??null}function Le(e,t){let n=Ae(e),r=n.findIndex(e=>e.lesson.id===t);return r>=0?n[r+1]??null:null}Object.freeze({steps:48,opsPerStep:14,say:1200,opText:1600,listItems:12,tableRows:16,tableCols:8,svgBytes:48*1024,animBytes:64*1024,codeBytes:12*1024,chartPoints:400,chartSeries:6}),Object.freeze([`title`,`h`,`p`,`math`,`list`,`svg`,`chart`,`plot`,`table`,`code`,`note`,`mark`,`anim`,`col`,`page`]),Object.freeze({heading:`h`,header:`h`,subtitle:`h`,text:`p`,paragraph:`p`,write:`p`,formula:`math`,equation:`math`,latex:`math`,bullets:`list`,bullet:`list`,diagram:`svg`,drawing:`svg`,figure:`svg`,graph:`chart`,function:`plot`,curve:`plot`,callout:`note`,highlight:`mark`,underline:`mark`,animation:`anim`,interactive:`anim`,column:`col`,newcolumn:`col`,newpage:`page`,clear:`page`});let Re=/[-ヿ㐀-䶿一-鿿가-]/gu;function ze(e,t=1){let n=String(e??``),r=(n.match(Re)??[]).length,i=n.replace(Re,` `).split(/\s+/u).filter(Boolean).length,a=r/4.4+i/2.6;return Math.round(a*1e3/Math.max(.5,Math.min(2,t||1)))}function Be(e){switch(e.t){case`title`:case`h`:case`p`:case`note`:return e.text.length;case`math`:return Math.min(80,e.tex.length);case`list`:return e.items.join(` `).length;case`table`:return e.rows.flat().join(` `).length/2;case`code`:return Math.min(400,e.code.length/2);default:return 60}}function Ve(e){return e.t===`col`||e.t===`page`?0:e.t===`mark`?600:e.t===`svg`||e.t===`chart`||e.t===`plot`||e.t===`anim`?2200:Math.min(7e3,Math.max(450,Be(e)*55))}function He(e,{rate:t=1,speechMs:n}={}){let r=n??ze(e.say,t),i=e.ops.map(Ve),a=i.reduce((e,t)=>e+t,0),o=r>0?r*.85:a,s=a>0&&o>0?Math.min(1.6,Math.max(.35,o/a)):1,c=i.map(e=>Math.round(e*s));return{speechMs:r,writeMs:c,durationMs:Math.max(r,c.reduce((e,t)=>e+t,0))+350}}function Ue(e){let t=[];e.title&&t.push(`# ${e.title}`,``);for(let n of e.steps){for(let e of n.ops)if(e.t===`title`)t.push(`## ${e.text}`,``);else if(e.t===`h`)t.push(`### ${e.text}`,``);else if(e.t===`p`)t.push(e.text,``);else if(e.t===`math`)t.push(`$$${e.tex}$$`,``);else if(e.t===`list`)t.push(...e.items.map((t,n)=>e.ordered?`${n+1}. ${t}`:`- ${t}`),``);else if(e.t===`note`)t.push(`> ${e.text}`,``);else if(e.t===`code`)t.push(`\`\`\`${e.lang}`,e.code,"```",``);else if(e.t===`plot`)t.push(...Ee(e).split(`
|
|
2
|
+
`)}Object.freeze({questions:6,options:5,units:12,lecturesPerUnit:8,lessonsPerLecture:8,lessons:120,objectives:5,concepts:6,projects:3,milestones:6,rubric:8,starterFiles:12,starterFileBytes:64*1024,practiceItems:12,quizItems:30,options4:6,cards:60,sheetSections:24,sheetItems:16});function De(e,t=400){return e==null?``:String(e).replace(/\u0000/gu,``).trim().slice(0,t)}let Oe=Object.freeze([`intuition`,`definition`,`derivation`,`application`,`extension`]);function ke(e){let t=De(e,200),n=t.search(/[::]/u);return n>0?t.slice(0,n).trim():t}function Ae(e){let t=[];for(let n of e?.units??[])for(let e of n.lectures??[])for(let r of e.lessons??[])t.push({unit:n,lecture:e,lesson:r,index:t.length});return t}function je(e,t){let n=e=>{let t=new Map;for(let n of e?.units??[])for(let e of n.lectures??[])for(let r of e.lessons??[])t.set(r.id,{lesson:r,unit:n.title});return t},r=e=>JSON.stringify([e.summary??``,e.objectives??[],e.estMinutes??0,(e.concepts??[]).map(e=>e.name),e.depth??``]),i=n(e),a=n(t),o=[],s=[],c=[];for(let[e,t]of a){let n=i.get(e);n?n.lesson.title===t.lesson.title?(r(n.lesson)!==r(t.lesson)||n.unit!==t.unit)&&c.push({title:t.lesson.title,unit:t.unit}):s.push({from:n.lesson.title,to:t.lesson.title,unit:t.unit}):o.push({title:t.lesson.title,unit:t.unit})}let l=[...i].filter(([e])=>!a.has(e)).map(([,e])=>({title:e.lesson.title,unit:e.unit})),u=new Set((e?.units??[]).map(e=>e.id)),d=new Set((t?.units??[]).map(e=>e.id));return{title:(e?.title??``)===(t?.title??``)?null:{from:e?.title??``,to:t?.title??``},unitsAdded:(t?.units??[]).filter(e=>!u.has(e.id)).map(e=>e.title),unitsRemoved:(e?.units??[]).filter(e=>!d.has(e.id)).map(e=>e.title),added:o,removed:l,renamed:s,changed:c}}function Me(e){return!e.title&&!e.unitsAdded.length&&!e.unitsRemoved.length&&!e.added.length&&!e.removed.length&&!e.renamed.length&&!e.changed.length}function Ne(e){let t=new Map;for(let{lesson:n}of Ae(e))for(let e of n.concepts??[])t.set(e.id,{...e,lessonId:n.id});return t}function Pe(e,t){return e?.lessons?.[t]?.status??`new`}function Fe(e,t){let n=Ae(e),r=n.filter(e=>Pe(t,e.lesson.id)===`done`),i=n.filter(e=>Pe(t,e.lesson.id)!==`done`).reduce((e,t)=>e+(t.lesson.estMinutes||15),0);return{total:n.length,done:r.length,percent:n.length?Math.round(r.length/n.length*100):0,minutesLeft:i}}function Ie(e,t){let n=Ae(e);return n.find(e=>Pe(t,e.lesson.id)===`learning`)??n.find(e=>Pe(t,e.lesson.id)===`new`)??null}function Le(e,t){let n=Ae(e),r=n.findIndex(e=>e.lesson.id===t);return r>=0?n[r+1]??null:null}Object.freeze({steps:48,opsPerStep:14,say:1200,opText:1600,listItems:12,tableRows:16,tableCols:8,svgBytes:48*1024,animBytes:64*1024,codeBytes:12*1024,chartPoints:400,chartSeries:6}),Object.freeze([`title`,`h`,`p`,`math`,`list`,`svg`,`chart`,`plot`,`table`,`code`,`note`,`mark`,`anim`,`col`,`page`]),Object.freeze({heading:`h`,header:`h`,subtitle:`h`,text:`p`,paragraph:`p`,write:`p`,formula:`math`,equation:`math`,latex:`math`,bullets:`list`,bullet:`list`,diagram:`svg`,drawing:`svg`,figure:`svg`,graph:`chart`,function:`plot`,curve:`plot`,callout:`note`,highlight:`mark`,underline:`mark`,animation:`anim`,interactive:`anim`,column:`col`,newcolumn:`col`,newpage:`page`,clear:`page`});let Re=/[-ヿ㐀-䶿一-鿿가-]/gu;function ze(e,t=1){let n=String(e??``),r=(n.match(Re)??[]).length,i=n.replace(Re,` `).split(/\s+/u).filter(Boolean).length,a=r/4.4+i/2.6;return Math.round(a*1e3/Math.max(.5,Math.min(2,t||1)))}function Be(e){switch(e.t){case`title`:case`h`:case`p`:case`note`:return e.text.length;case`math`:return Math.min(80,e.tex.length);case`list`:return e.items.join(` `).length;case`table`:return e.rows.flat().join(` `).length/2;case`code`:return Math.min(400,e.code.length/2);default:return 60}}function Ve(e){return e.t===`col`||e.t===`page`?0:e.t===`mark`?600:e.t===`svg`||e.t===`chart`||e.t===`plot`||e.t===`anim`?2200:Math.min(7e3,Math.max(450,Be(e)*55))}function He(e,{rate:t=1,speechMs:n}={}){let r=n??ze(e.say,t),i=e.ops.map(Ve),a=i.reduce((e,t)=>e+t,0),o=r>0?r*.85:a,s=a>0&&o>0?Math.min(1.6,Math.max(.35,o/a)):1,c=i.map(e=>Math.round(e*s));return{speechMs:r,writeMs:c,durationMs:Math.max(r,c.reduce((e,t)=>e+t,0))+350}}function Ue(e){let t=[];e.title&&t.push(`# ${e.title}`,``);for(let n of e.steps){for(let e of n.ops)if(e.t===`title`)t.push(`## ${e.text}`,``);else if(e.t===`h`)t.push(`### ${e.text}`,``);else if(e.t===`p`)t.push(e.text,``);else if(e.t===`math`)t.push(`$$${e.tex}$$`,``);else if(e.t===`list`)t.push(...e.items.map((t,n)=>e.ordered?`${n+1}. ${t}`:`- ${t}`),``);else if(e.t===`note`)t.push(`> ${e.text}`,``);else if(e.t===`code`)t.push(`\`\`\`${e.lang}`,e.code,"```",``);else if(e.t===`plot`)t.push(...Ee(e).split(`
|
|
3
3
|
`).map(e=>`> 📈 ${e}`),``);else if(e.t===`table`){let n=e.head.length?e.head:e.rows[0].map(()=>` `);t.push(`| ${n.join(` | `)} |`,`| ${n.map(()=>`---`).join(` | `)} |`,...e.rows.map(e=>`| ${e.join(` | `)} |`),``)}else e.caption&&t.push(`*${e.caption}*`,``);n.say&&t.push(`<!-- ${n.say.replace(/--/gu,`—`)} -->`,``)}return t.join(`
|
|
4
4
|
`).replace(/\n{3,}/gu,`
|
|
5
5
|
|
|
@@ -264,17 +264,17 @@ l0,-`+(t+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
|
|
|
264
264
|
`){i();continue}r+=n;let a=n===`.`&&(e+1===t.length||/\s/u.test(t[e+1])&&/[\p{Lu}\p{Lo}]/u.test(t[e+2]??``));if(!(!il.has(n)&&!a)){for(;e+1<t.length&&(il.has(t[e+1])||al.has(t[e+1]));)r+=t[++e];i()}}};for(let e of t.matchAll(Ec))o(t.slice(a,e.index)),r+=e[0],a=e.index+e[0].length;return o(t.slice(a)),i(),n}function sl(e,t){return Math.max(1,Math.ceil(String(e??``).length/t))}function cl(e){switch(e.t){case`title`:return 1.6;case`h`:return 1.4;case`p`:return sl(e.text,26)*1.05;case`math`:{let t=[...nl(e.tex)].length;return t<=40?2:2+(Math.ceil(t/28)-1)*1.2}case`list`:return e.items.reduce((e,t)=>e+sl(t,24),0)*1.05;case`note`:return sl(e.text,24)+1;case`table`:return(e.rows.length+1)*1.1+.6;case`code`:return Math.min(14,e.code.split(`
|
|
265
265
|
`).length*.8+1);case`svg`:case`chart`:return 8.5;case`plot`:return(e.equal?10:9)+e.params.length*1.1;case`anim`:return Math.round(e.height/34);default:return 0}}function ll(e){let t=[],n=new Map,r=null,i=0,a=0,o=!1,s=e=>{r={title:e??``,columns:[[],[]]},t.push(r),i=0,a=0,o=!1};return s(``),e.forEach((e,c)=>{for(let l of e.ops??[]){if(l.t===`page`){r.columns[0].length||r.columns[1].length?s(l.title):r.title=l.title||r.title,n.set(l.id,{page:t.length-1,column:i});continue}if(l.t===`col`){i===0?(i=1,a=0):o?o=!1:s(``),n.set(l.id,{page:t.length-1,column:i});continue}if(l.t===`mark`){n.set(l.id,n.get(l.ref)??{page:t.length-1,column:i});continue}if(l.t===`title`){r.columns[0].length||r.columns[1].length?s(l.text):r.title=l.text,n.set(l.id,{page:t.length-1,column:0,title:!0});continue}let e=cl(l);a>0&&a+e>26&&(i===0?(i=1,a=0,o=!0):s(``)),r.columns[i].push({op:l,step:c}),n.set(l.id,{page:t.length-1,column:i}),a+=e}}),{pages:t,where:n}}function ul(e,t){return e.map((e,n)=>{let r=new Map(e.ops.map(e=>[e.id,`${t}${e.id}`]));return{...e,id:`${t}${e.id??n}`,aside:!0,ops:e.ops.map(e=>({...e,id:r.get(e.id),...e.t===`mark`?{ref:r.get(e.ref)??e.ref}:{}})),...e.check?{check:{...e.check,id:`${t}${e.check.id}`}}:{}}})}function dl(e,t=12e3){let n=[];for(let t of e)for(let e of t.ops)if(e.text&&n.push(e.text),e.caption&&n.push(e.caption),e.items&&n.push(...e.items),e.head&&n.push(...e.head),e.rows)for(let t of e.rows)n.push(...t);return[...new Set([...n.join(``)])].join(``).slice(0,t)}function fl(e,t,n){return!n||e<n.index?1:e>n.index?0:t<n.op?1:t>n.op?0:n.progress}function pl({text:e,reveal:t=1}){let n=(0,r.useMemo)(()=>kc(e),[e]),a=(0,r.useMemo)(()=>jc(n),[n]);return(t>=1?n:Mc(n,a*t)).map((e,t)=>{if(e.kind===`math`){let n=(0,i.jsx)(Ks,{tex:e.tex},t);return e.style===`mark`?(0,i.jsx)(`mark`,{children:n},t):e.style===`bold`?(0,i.jsx)(`strong`,{children:n},t):n}return e.kind===`bold`?(0,i.jsx)(`strong`,{children:e.text},t):e.kind===`mark`?(0,i.jsx)(`mark`,{children:e.text},t):(0,i.jsx)(`span`,{children:e.text},t)})}function ml({markup:e,reveal:t,caption:n}){let a=(0,r.useRef)(null),o=(0,r.useMemo)(()=>lc(e),[e]);return(0,r.useLayoutEffect)(()=>{let e=a.current?.querySelector(`svg`);if(!e)return;let n=[...e.querySelectorAll(`path,line,polyline,polygon,rect,circle,ellipse`)],r=[...e.querySelectorAll(`text`)],i=r.length?.8:1;n.forEach((e,r)=>{let a=0;try{a=e.getTotalLength?.()??0}catch{a=0}let o=r/Math.max(1,n.length)*i,s=(r+1)/Math.max(1,n.length)*i,c=Math.min(1,Math.max(0,(t-o)/Math.max(1e-4,s-o)));a>0&&c<1?(e.style.strokeDasharray=`${a}`,e.style.strokeDashoffset=`${a*(1-c)}`):(e.style.strokeDasharray=``,e.style.strokeDashoffset=``),e.style.fillOpacity=c>=1?``:String(c*.6),a||(e.style.opacity=String(c))});let o=r.length?Math.min(1,Math.max(0,(t-i)/(1-i))):1;r.forEach(e=>{e.style.opacity=String(t>=1?1:o)})},[t,o]),o?(0,i.jsxs)(`div`,{className:`aha-op-figure`,children:[(0,i.jsx)(`div`,{ref:a,dangerouslySetInnerHTML:{__html:o}}),n?(0,i.jsx)(`div`,{className:`aha-figCaption`,style:{opacity:t>=1?1:.4},children:n}):null]}):null}function hl({op:e,reveal:t,still:n,onInteract:a}){let o=(0,r.useMemo)(()=>Ys(e),[e]),[s,c]=(0,r.useState)(()=>_e(e));(0,r.useEffect)(()=>{c(_e(e))},[JSON.stringify([e.fns,e.params])]);let l=(0,r.useMemo)(()=>o?nc(e,s,{prepared:o}):``,[e,o,s]);if(!o)return null;let u=(e,t)=>{a?.(),c(n=>n.map((n,r)=>r===e?t:n))},d=t>=1;return(0,i.jsxs)(`div`,{className:`aha-plot`,children:[(0,i.jsx)(ml,{markup:l,reveal:t,caption:``}),!n&&e.params.length?(0,i.jsx)(`div`,{className:`aha-plotSliders`,"data-written":d,"aria-hidden":!d,children:e.params.map((e,t)=>(0,i.jsxs)(`label`,{className:`aha-plotSlider`,children:[(0,i.jsx)(`span`,{className:`aha-plotName`,children:e.label||e.name}),(0,i.jsx)(`input`,{type:`range`,min:e.min,max:e.max,step:e.step,value:s[t]??e.value,disabled:!d,onPointerDown:()=>a?.(),onChange:e=>u(t,Number(e.currentTarget.value))}),(0,i.jsx)(`span`,{className:`aha-plotValue`,children:we(s[t]??e.value)})]},e.name))}):null,e.caption?(0,i.jsx)(`div`,{className:`aha-figCaption`,style:{opacity:d?1:.4},children:e.caption}):null]})}function gl({op:e,reveal:t,theme:n}){let a=(0,r.useMemo)(()=>uc(e.html,n),[e.html,n]),o=(0,r.useRef)(null),[s,c]=(0,r.useState)(e.height);return(0,r.useLayoutEffect)(()=>{let t=o.current;if(!t||typeof ResizeObserver!=`function`)return;let n=()=>c(Math.round(Math.max(120,Math.min(e.height,e.height*t.clientWidth/560))));n();let r=new ResizeObserver(n);return r.observe(t),()=>r.disconnect()},[e.height,t>0]),t<=0?null:(0,i.jsxs)(`div`,{className:`aha-op-figure`,style:{opacity:Math.min(1,t*3)},children:[(0,i.jsx)(`iframe`,{ref:o,className:`aha-op-anim`,title:e.caption||`animation`,sandbox:`allow-scripts`,referrerPolicy:`no-referrer`,srcDoc:a,style:{height:s,colorScheme:n===`dark`?`dark`:`light`}}),e.caption?(0,i.jsx)(`div`,{className:`aha-figCaption`,children:e.caption}):null]})}function _l({tex:e,reveal:t}){let n=(0,r.useRef)(null),[a,o]=(0,r.useState)([]);(0,r.useLayoutEffect)(()=>{let e=n.current;if(!e)return;let t=-1,r=()=>{t=e.clientWidth,xc(e),o(Cc(e))};r();let i=0,a=typeof ResizeObserver==`function`?new ResizeObserver(()=>{e.clientWidth!==t&&(cancelAnimationFrame(i),i=requestAnimationFrame(r))}):null;a?.observe(e);let s=typeof document<`u`?document.fonts:null;return s?.addEventListener?.(`loadingdone`,r),()=>{a?.disconnect(),cancelAnimationFrame(i),s?.removeEventListener?.(`loadingdone`,r)}},[e]);let{clip:s,pen:c}=Tc(a,t);return(0,i.jsx)(`div`,{ref:n,className:`aha-op-math`,style:s?{clipPath:s}:void 0,"data-pen":c?`${Math.round(c.x)} ${Math.round(c.y)}`:void 0,children:(0,i.jsx)(Ks,{tex:e,display:!0})})}function vl({op:e,label:t}){return e.poster?(0,i.jsx)(ml,{markup:e.poster,reveal:1,caption:e.caption}):(0,i.jsxs)(`div`,{className:`aha-op-note`,"data-tone":`tip`,children:[`▶ `,e.caption||t]})}function yl({op:e,reveal:t,marks:n,aside:r,now:a,opRef:o,theme:s,still:c=!1,animationLabel:l=``,onInteract:u,fixedNote:d}){let f=n.map(e=>(0,i.jsx)(`span`,{className:e.style===`circle`?`aha-markRing`:e.style===`box`?`aha-markBox`:`aha-markLine`,style:{opacity:e.reveal,clipPath:`inset(0 ${100-e.reveal*100}% 0 0)`}},e.id)),p;switch(e.t){case`h`:p=(0,i.jsx)(`div`,{className:`aha-op-h`,children:(0,i.jsx)(`span`,{children:(0,i.jsx)(pl,{text:e.text,reveal:t})})});break;case`p`:p=(0,i.jsx)(`div`,{className:`aha-op-p`,children:(0,i.jsx)(pl,{text:e.text,reveal:t})});break;case`math`:p=(0,i.jsx)(_l,{tex:e.tex,reveal:t});break;case`list`:{let n=e.items.reduce((e,t)=>e+jc(kc(t)),0)*t;p=(0,i.jsx)(e.ordered?`ol`:`ul`,{className:`aha-op-list`,children:e.items.map((e,r)=>{let a=jc(kc(e)),o=t>=1?1:Math.max(0,Math.min(1,n/Math.max(1,a)));return n-=a,o>0?(0,i.jsx)(`li`,{children:(0,i.jsx)(pl,{text:e,reveal:o})},r):null})});break}case`note`:p=(0,i.jsx)(`div`,{className:`aha-op-note`,"data-tone":e.tone,children:(0,i.jsx)(pl,{text:e.text,reveal:t})});break;case`svg`:p=(0,i.jsx)(ml,{markup:e.svg,reveal:t,caption:e.caption});break;case`chart`:p=(0,i.jsx)(ml,{markup:Pt(e),reveal:t,caption:``});break;case`plot`:p=(0,i.jsx)(hl,{op:e,reveal:t,still:c,onInteract:u});break;case`table`:{let n=t>=1?e.rows.length:Math.floor(e.rows.length*t);p=(0,i.jsxs)(`table`,{className:`aha-op-table`,children:[e.head.length?(0,i.jsx)(`thead`,{children:(0,i.jsx)(`tr`,{children:e.head.map((e,t)=>(0,i.jsx)(`th`,{children:(0,i.jsx)(pl,{text:e})},t))})}):null,(0,i.jsx)(`tbody`,{children:e.rows.slice(0,n).map((e,t)=>(0,i.jsx)(`tr`,{children:e.map((e,t)=>(0,i.jsx)(`td`,{children:(0,i.jsx)(pl,{text:e})},t))},t))})]});break}case`code`:{let n=e.code.split(`
|
|
266
266
|
`);p=(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`pre`,{className:`aha-op-code`,children:(t>=1?n:n.slice(0,Math.ceil(n.length*t))).join(`
|
|
267
|
-
`)}),e.caption?(0,i.jsx)(`div`,{className:`aha-figCaption`,children:e.caption}):null]});break}case`anim`:p=c?(0,i.jsx)(vl,{op:e,label:l}):(0,i.jsx)(gl,{op:e,reveal:t,theme:s});break;default:p=null}let m=e.fixed&&d&&t>=1?d(e):null;return(0,i.jsxs)(`div`,{ref:o,className:`aha-op`,"data-t":e.t,"data-aside":r?`true`:void 0,"data-now":a?`true`:void 0,"data-op":e.id,children:[p,f,m?(0,i.jsxs)(`span`,{className:`aha-fixed`,title:m.title,children:[`✎ `,m.label]}):null]})}function bl({target:e,active:t,stage:n,scale:a=1,scrolls:o=!1}){let[s,c]=(0,r.useState)(null);return(0,r.useLayoutEffect)(()=>{let r=e?.current,i=n?.current;if(!t||!r||!i){c(e=>e===null?e:null);return}let s=r.getBoundingClientRect(),l=i.getBoundingClientRect(),u=r.querySelector(`.aha-op-math`),d=u?[]:r.querySelectorAll(`span,strong,mark,li,td,pre`),f=d[d.length-1]?.getBoundingClientRect(),p=f&&f.width?f.right:s.left+s.width*t.progress,m=f&&f.height?f.bottom-4*a:s.top+s.height/2;if(u?.dataset.pen){let[e,t]=u.dataset.pen.split(` `).map(Number),n=u.getBoundingClientRect();p=n.left+e*a,m=n.top+(t-4)*a}let h={left:Math.round((p-l.left)/a+(o?i.scrollLeft:0)),top:Math.round((m-l.top)/a+(o?i.scrollTop:0)),glide:!u};c(e=>e&&e.left===h.left&&e.top===h.top&&e.glide===h.glide?e:h)}),s?(0,i.jsxs)(`svg`,{className:`aha-pencil`,style:{left:s.left,top:s.top},"data-glide":s.glide,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:[(0,i.jsx)(`path`,{d:`M3 21l3.5-1 11-11-2.5-2.5-11 11L3 21z`,fill:`var(--pencil)`,stroke:`var(--ink)`,strokeWidth:`1.2`,strokeLinejoin:`round`}),(0,i.jsx)(`path`,{d:`M14.5 6.5l2.5 2.5 2-2a1.77 1.77 0 0 0-2.5-2.5l-2 2z`,fill:`var(--accent)`,stroke:`var(--ink)`,strokeWidth:`1.2`})]}):null}let xl=new Set([`p`,`h`,`list`,`note`,`math`,`title`]);function Sl({page:e,title:t,board:n,activeRef:r}){let{reveal:a,marks:o,nowIds:s,opMeta:c,activeOp:l,theme:u,onInteract:d,fixedNote:f}=n,p=t?a(t.id):1;return(0,i.jsxs)(i.Fragment,{children:[e.title&&p>0?(0,i.jsx)(`h2`,{className:`aha-boardTitle`,children:(0,i.jsx)(`span`,{children:(0,i.jsx)(pl,{text:e.title,reveal:p})})}):null,(0,i.jsx)(`div`,{className:`aha-cols`,children:e.columns.map((e,t)=>(0,i.jsx)(`div`,{className:`aha-colBody`,children:e.map(({op:e})=>{let t=a(e.id);if(t<=0)return null;let n=l?.id===e.id&&t<1;return(0,i.jsx)(yl,{op:e,reveal:t,marks:o.get(e.id)??[],aside:c.get(e.id)?.aside,now:s.has(e.id),opRef:n?r:void 0,theme:u,onInteract:d,fixedNote:f},e.id)})},t))})]})}function Cl(e,t,n){let{reveal:r,marks:i,nowIds:a}=n,o=[t?`t${Math.round(r(t.id)*1e3)}`:``];for(let t of e.columns)for(let{op:e}of t){let t=Math.round(r(e.id)*1e3);t<=0||o.push(`${e.id}:${t}${a.has(e.id)?`*`:``}${(i.get(e.id)??[]).map(e=>`/${e.id}:${Math.round(e.reveal*1e3)}`).join(``)}`)}return o.join(` `)}let wl=(0,r.memo)(function({index:e,page:t,title:n,board:r,activeRef:a,label:o}){return(0,i.jsx)(`section`,{className:`aha-frame`,"data-frame":e,"aria-label":o,children:(0,i.jsx)(Sl,{page:t,title:n,board:r,activeRef:a})})},(e,t)=>e.signature===t.signature&&e.page===t.page&&e.activeRef===t.activeRef&&e.board.theme===t.board.theme&&e.label===t.label);function Tl({board:e,layout:t,position:n,activePage:a,pencil:o}){let{activeOp:s}=e,[c,l]=(0,r.useState)(null);(0,r.useEffect)(()=>{l(null)},[a]);let u=Math.min(t.pages.length-1,c??a),d=t.pages[u],f=(0,r.useRef)(null),p=(0,r.useRef)(null);(0,r.useEffect)(()=>{let e=f.current,t=s?e?.querySelector(`[data-op="${s.id}"]`):null;if(!e||!t)return;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();n.bottom>r.bottom-24?e.scrollTo({top:e.scrollTop+n.bottom-r.bottom+56,behavior:`smooth`}):n.top<r.top+8&&e.scrollTo({top:Math.max(0,e.scrollTop-(r.top-n.top)-24),behavior:`smooth`})},[s?`${s.id}:${Math.round((n?.progress??0)*4)}`:``,u]);let m=t.pages.map((e,t)=>t).filter(e=>e<=Math.max(a,c??0)||!n);return(0,i.jsxs)(i.Fragment,{children:[m.length>1?(0,i.jsx)(`div`,{className:`aha-pager`,children:m.map(e=>(0,i.jsx)(`button`,{type:`button`,"data-active":e===u,onClick:()=>l(e),children:e+1},e))}):null,(0,i.jsxs)(`div`,{className:`aha-boardScroll`,ref:f,children:[d?(0,i.jsx)(Sl,{page:d,title:e.titles.get(u),board:e,activeRef:p}):null,(0,i.jsx)(bl,{target:p,stage:f,scrolls:!0,active:o})]})]})}function El({board:e,layout:t,position:n,activePage:a,pencil:o}){let{t:s}=v(),{activeOp:c}=e,l=(0,r.useRef)(null),u=(0,r.useRef)(null),d=(0,r.useRef)(null),[f,p]=(0,r.useState)({width:0,height:0}),[m,h]=(0,r.useState)({x:16,y:16,k:1,animate:!1}),[g,_]=(0,r.useState)(!0),[y,b]=(0,r.useState)(!1),x=(0,r.useRef)({camera:m,size:f,pointers:new Map,drag:null}),S=(0,r.useRef)(-1);x.current.camera=m,x.current.size=f,(0,r.useLayoutEffect)(()=>{let e=l.current;if(!e)return;let t=()=>p(t=>t.width===e.clientWidth&&t.height===e.clientHeight?t:{width:e.clientWidth,height:e.clientHeight});t();let n=typeof ResizeObserver==`function`?new ResizeObserver(t):null;return n?.observe(e),()=>n?.disconnect()},[]);let C=Math.max(240,f.width-32),w=()=>({width:u.current?.offsetWidth??C,height:u.current?.offsetHeight??0}),T=(e,{animate:t=!1,manual:n=!1}={})=>{n&&_(!1),h(n=>({...gc(typeof e==`function`?e(n):e,x.current.size,w()),animate:t}))};(0,r.useEffect)(()=>{let e=l.current;if(!e)return;let t=t=>{t.preventDefault();let n=e.getBoundingClientRect(),r=_c(t,n.height);t.ctrlKey||t.metaKey?T(e=>pc(e,t.clientX-n.left,t.clientY-n.top,vc(r.y)),{manual:!0}):T(e=>({...e,x:e.x-(t.shiftKey?r.y:r.x),y:e.y-(t.shiftKey?0:r.y)}),{manual:!0})};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[]);let E=e=>{e.pointerType===`mouse`&&e.button!==0||e.target.closest?.(`button,a,input,textarea,select,iframe,.aha-canvasBar`)||(x.current.pointers.set(e.pointerId,{x:e.clientX,y:e.clientY}),x.current.drag||(x.current.drag={x:e.clientX,y:e.clientY,moved:!1}),l.current?.setPointerCapture?.(e.pointerId))},D=e=>{let{pointers:t,drag:n}=x.current,r=t.get(e.pointerId);if(!r)return;let i={x:e.clientX,y:e.clientY};if(t.size===1){if(!n.moved&&Math.hypot(i.x-n.x,i.y-n.y)<4)return;n.moved=!0,b(!0),t.set(e.pointerId,i),T(e=>({...e,x:e.x+i.x-r.x,y:e.y+i.y-r.y}),{manual:!0});return}let a=[...t.entries()].find(([t])=>t!==e.pointerId)?.[1];if(t.set(e.pointerId,i),!a)return;let o=l.current.getBoundingClientRect(),s={x:(r.x+a.x)/2,y:(r.y+a.y)/2,d:Math.hypot(r.x-a.x,r.y-a.y)},c={x:(i.x+a.x)/2,y:(i.y+a.y)/2,d:Math.hypot(i.x-a.x,i.y-a.y)};n.moved=!0,T(e=>{let t=pc(e,s.x-o.left,s.y-o.top,c.d/Math.max(1,s.d));return{...t,x:t.x+c.x-s.x,y:t.y+c.y-s.y}},{manual:!0})},O=e=>{x.current.pointers.delete(e.pointerId),x.current.pointers.size||(x.current.drag=null,b(!1))},k=(e,t)=>T(mc(x.current.size,e,{margin:16,maxZoom:t}),{animate:!0,manual:!0}),A=e=>{let t=e.target.closest?.(`.aha-frame`);t&&k({x:t.offsetLeft,y:t.offsetTop,width:t.offsetWidth,height:t.offsetHeight})},ee=e=>T(t=>pc(t,x.current.size.width/2,x.current.size.height/2,e),{animate:!0,manual:!0}),te=()=>k({x:0,y:0,...w()},1),j=()=>T(e=>({...pc(e,x.current.size.width/2,x.current.size.height/2,1/e.k),x:16}),{animate:!0,manual:!0});(0,r.useLayoutEffect)(()=>{if(!g||!n||!f.height)return;let e=u.current?.querySelector(`[data-frame="${a}"]`);if(!e)return;let t=c?.t===`mark`?c.ref:c?.id,r=e.querySelectorAll(`[data-op]`),i=t?u.current.querySelector(`[data-op="${t}"]`):c?null:r[r.length-1]??null,o=e.offsetTop;for(let t=i;t&&t!==e;t=t.offsetParent)o+=t.offsetTop;let s=i?.offsetHeight??0,l=S.current!==a;S.current=a,h(t=>{let n=t.k===1&&t.x===16?t:{x:16,y:t.y,k:1},r=n.y;return(l||!i)&&(r+=16-(r+e.offsetTop)),i&&(r+=hc(x.current.size,{top:r+o,height:s})),r===t.y&&n===t?t:{...n,y:r,animate:!0}})},[c?`${c.id}:${Math.round((n?.progress??0)*4)}`:`page:${a}`,a,g,f.width,f.height]);let ne=t.pages.map((e,t)=>t).filter(e=>!n||e<=a);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`div`,{ref:l,className:`aha-canvas`,"data-panning":y?`true`:void 0,onPointerDown:E,onPointerMove:D,onPointerUp:O,onPointerCancel:O,onDoubleClick:A,children:(0,i.jsxs)(`div`,{ref:u,className:`aha-canvasWorld`,style:{width:C,transform:`translate(${m.x}px, ${m.y}px) scale(${m.k})`,transition:m.animate?`transform .45s ease`:`none`},children:[ne.map(n=>(0,i.jsx)(wl,{index:n,page:t.pages[n],title:e.titles.get(n),board:e,signature:Cl(t.pages[n],e.titles.get(n),e),activeRef:n===a?d:null,label:s(`canvasPage`,{n:n+1})},n)),(0,i.jsx)(bl,{target:d,stage:u,scale:m.k,active:o})]})}),(0,i.jsxs)(`div`,{className:`aha-canvasBar`,role:`toolbar`,"aria-label":s(`canvasTools`),title:s(`canvasHelp`),children:[!g&&n?(0,i.jsx)(`button`,{type:`button`,className:`aha-canvasFollow`,onClick:()=>_(!0),children:s(`canvasFollow`)}):null,(0,i.jsx)(`button`,{type:`button`,"aria-label":s(`canvasZoomOut`),title:s(`canvasZoomOut`),onClick:()=>ee(1/dc),children:`−`}),(0,i.jsxs)(`button`,{type:`button`,className:`aha-canvasZoom`,title:s(`canvasZoomReset`),onClick:j,children:[Math.round(m.k*100),`%`]}),(0,i.jsx)(`button`,{type:`button`,"aria-label":s(`canvasZoomIn`),title:s(`canvasZoomIn`),onClick:()=>ee(dc),children:`+`}),(0,i.jsx)(`button`,{type:`button`,title:s(`canvasFit`),onClick:te,children:s(`canvasFitShort`)})]})]})}function Dl({steps:e,position:t,theme:n=`light`,font:a=`hand`,buffering:o=!1,bufferingLabel:s=``,view:c=`canvas`,onInteract:l}){let{t:u}=v(),d=(0,r.useMemo)(()=>ll(e),[e]),f=(0,r.useMemo)(()=>a===`hand`?dl(e):``,[e,a]);(0,r.useEffect)(()=>{if(!(!f||typeof document>`u`||!document.fonts?.load))for(let e of[`Aha Hand Latin`,`Aha Hand`])document.fonts.load(`20px '${e}'`,f).catch(()=>void 0)},[f]);let p=(0,r.useMemo)(()=>{let t=new Map;return e.forEach((e,n)=>e.ops.forEach((r,i)=>t.set(r.id,{stepIndex:n,opIndex:i,aside:e.aside===!0}))),t},[e]),m=(0,r.useMemo)(()=>{let t=new Map;for(let n of e)for(let e of n.ops)if(e.t===`title`){let n=d.where.get(e.id);n&&!t.has(n.page)&&t.set(n.page,e)}return t},[e,d]),h=t&&e[t.index]?.ops[t.op],g=h?d.where.get(h.id)?.page??0:t?kl(d,e,t):0,_=e=>{let n=p.get(e);return n?fl(n.stepIndex,n.opIndex,t):0},y=new Map;e.forEach(e=>e.ops.forEach(e=>{if(e.t!==`mark`)return;let t=_(e.id);if(t<=0)return;let n=y.get(e.ref)??[];n.push({id:e.id,style:e.style,reveal:t}),y.set(e.ref,n)}));let b={reveal:_,marks:y,nowIds:new Set(t?.now??[]),opMeta:p,activeOp:h,theme:n,titles:m,onInteract:l,fixedNote:e=>({label:u(`fixed`),title:u(`fixedWas`,{was:e.fixed.was})})},x=h&&t&&t.progress<1&&xl.has(h.t)?t:null;return(0,i.jsxs)(`div`,{className:`aha-board`,"data-theme":n,"data-font":a,"data-view":c===`pages`?`pages`:`canvas`,children:[(0,i.jsx)(c===`pages`?Tl:El,{board:b,layout:d,position:t,activePage:g,pencil:x}),o?(0,i.jsxs)(`div`,{className:`aha-buffering`,children:[(0,i.jsx)(`span`,{className:`aha-spinner`}),s]}):null]})}function Ol({steps:e,title:t=``,theme:n=`light`,font:a=`hand`,footer:o={},animationLabel:s=``,fixedLabel:c=``}){let l=(0,r.useMemo)(()=>ll(e),[e]),u=(0,r.useMemo)(()=>new Set(e.flatMap(e=>e.aside?e.ops.map(e=>e.id):[])),[e]),d=(0,r.useMemo)(()=>{let t=new Map;for(let n of e)for(let e of n.ops)e.t===`mark`&&t.set(e.ref,[...t.get(e.ref)??[],{id:e.id,style:e.style,reveal:1}]);return t},[e]),f=l.pages.filter(e=>e.columns.some(e=>e.length));return f.map((e,r)=>{let l=e.title||(r===0?t:``);return(0,i.jsxs)(`div`,{className:`aha-board aha-exportPage`,"data-theme":n,"data-font":a,"data-sheet":r,children:[l?(0,i.jsx)(`h2`,{className:`aha-boardTitle`,children:(0,i.jsx)(`span`,{children:(0,i.jsx)(pl,{text:l})})}):null,(0,i.jsx)(`div`,{className:`aha-cols`,children:e.columns.map((e,t)=>(0,i.jsx)(`div`,{className:`aha-colBody`,children:e.map(({op:e})=>(0,i.jsx)(yl,{op:e,reveal:1,marks:d.get(e.id)??[],aside:u.has(e.id),now:!1,theme:n,still:!0,animationLabel:s,fixedNote:c?()=>({label:c}):void 0},e.id))},t))}),(0,i.jsxs)(`div`,{className:`aha-exportFoot`,children:[(0,i.jsx)(`span`,{children:o.left??``}),(0,i.jsx)(`span`,{children:[o.right,`${r+1} / ${f.length}`].filter(Boolean).join(` · `)})]})]},r)})}function kl(e,t,n){let r=0;return t.forEach((t,i)=>t.ops.forEach((t,a)=>{fl(i,a,n)>0&&(r=Math.max(r,e.where.get(t.id)?.page??0))})),r}function Al({speech:e,onChange:t,onNarration:n,now:r=()=>performance.now(),frame:i,cancelFrame:a,startIndex:o=0}){let s=i??(e=>requestAnimationFrame(e)),c=a??(e=>cancelAnimationFrame(e)),l=[],u=!1,d=1,f=null,p=null,m=new Set,h={index:Math.max(0,o),op:0,progress:0,sentence:0,status:`idle`},g=()=>{if(!p?.synced||h.status!==`playing`&&h.status!==`paused`)return[];let e=Math.max(0,p.sentences.length-1);return p.step.ops.filter((t,n)=>n<=h.op&&Math.min(t.at,e)===h.sentence).map(e=>e.t===`mark`?e.ref:e.id)},_=()=>({...h,total:l.length,complete:u,rate:d,step:l[h.index]??null,now:g()}),v=()=>t?.(_());function y(){f!==null&&c(f),f=null}function b(){y(),e?.cancel?.();let t=l[h.index];if(!t){h.status=u?`ended`:`buffering`,v();return}h.op=0,h.progress=0,h.sentence=0,h.status=`playing`;let i=He(t,{rate:d}),a=ol(t.say).map(rl),o=!!t.say&&t.ops.some(e=>Number.isInteger(e.at));p={step:t,timing:i,startedAt:r(),elapsedBefore:0,speechDone:!t.say,silentUntil:null,token:{},sentences:a,exactSentence:!1,synced:o,written:0,lastTime:0,finishAt:null};let s=p.token;t.say&&((e?.speak(rl(t.say),{rate:d,sentences:a,onSentence:e=>{!p||p.token!==s||(p.exactSentence=!0,h.sentence!==e&&(h.sentence=e,v()))}})??{done:Promise.resolve({silent:!0})}).done.then(e=>{!p||p.token!==s||(e?.silent||e?.error?p.silentUntil=ze(t.say,d)*.8:p.speechDone=!0,n?.(e))}),e?.prefetch?.(rl(l[h.index+1]?.say??``))),v(),C()}function x(e){let t=p?.sentences??[];if(t.length<2)return 0;if(p.speechDone)return t.length-1;let n=ze(p.step.say,d),r=t.map(e=>[...e].length),i=r.reduce((e,t)=>e+t,0)||1,a=0;for(let t=0;t<r.length;t+=1)if(a+=r[t],e<a/i*n)return t;return t.length-1}function S(){return p?p.elapsedBefore+(h.status===`playing`?r()-p.startedAt:0):0}function C(){f=s(T)}function w(e,t,n){if(!p.synced)return e;let r=Math.max(0,e-p.lastTime);p.lastTime=e;let i=Math.max(0,p.sentences.length-1),a=p.speechDone?1/0:t,o=0,s=0;for(;o<n.length&&Math.min(p.step.ops[o].at,i)<=a;)s+=n[o],o+=1;return p.written=Math.min(p.written+r,s),p.written}function T(){if(f=null,h.status!==`playing`||!p)return;let e=S(),t=p.timing.writeMs;p.silentUntil!==null&&e>=p.silentUntil&&(p.speechDone=!0);let n=p.exactSentence?h.sentence:x(e),r=w(e,n,t),i=0,a=t.length,o=1;for(let e=0;e<t.length;e+=1){if(r<i+t[e]){a=e,o=t[e]?(r-i)/t[e]:1;break}i+=t[e]}let s=a!==h.op||Math.abs(o-h.progress)>.002||n!==h.sentence;if(h.op=a,h.sentence=n,h.progress=Math.min(1,Math.max(0,o)),a>=t.length&&p.speechDone&&(p.finishAt??=p.synced?e+450:i+450,e>=p.finishAt)){E();return}s&&v(),C()}function E(){let e=l[h.index];if(h.op=e?.ops.length??0,h.progress=1,e?.check&&!m.has(e.check.id)){h.status=`check`,v();return}D()}function D(){h.index+=1,b()}return{get state(){return _()},setSteps(e,{done:t=!1}={}){l=e,u=t,h.status===`buffering`&&l[h.index]?b():(h.status===`buffering`&&u&&(h.status=`ended`),v())},play(){if(h.status!==`playing`){if(h.status===`paused`&&p){h.status=`playing`,p.startedAt=r(),e?.resume?.(),v(),C();return}h.status===`ended`&&(h.index=0),h.status!==`check`&&b()}},pause(){h.status!==`playing`||!p||(p.elapsedBefore=S(),h.status=`paused`,y(),e?.pause?.(),v())},toggle(){h.status===`playing`?this.pause():this.play()},next(){let t=l[h.index];h.status===`check`&&t?.check&&m.add(t.check.id),t&&(y(),e?.cancel?.(),D())},prev(){y(),e?.cancel?.();let t=h.op===0&&h.progress<.05;h.index=Math.max(0,Math.min(l.length-1,t?h.index-1:h.index)),b()},seek(t){y(),e?.cancel?.(),h.index=Math.min(Math.max(0,t),Math.max(0,l.length)),b()},answer(e){m.add(e),h.status===`check`&&D()},setRate(t){let n=Math.min(2,Math.max(.5,Number(t)||1));if(p&&h.status===`playing`){let e=S(),t=d/n;p.elapsedBefore=e*t,p.startedAt=r(),p.timing=He(p.step,{rate:n}),p.written*=t,p.lastTime=p.elapsedBefore,p.finishAt=null}d=n,e?.setRate?.(n),v()},insertAfterCurrent(e){if(!e?.length)return l;let t=Math.min(l.length,h.index+1);return l=[...l.slice(0,t),...e,...l.slice(t)],v(),l},dispose(){y(),e?.cancel?.(),p=null}}}function jl(e,t,n,r=!1){if(!n)return[];if(!e.some(e=>Number.isInteger(e.goal)))return null;if(r)return Array(n).fill(`done`);let i=Array(n).fill(-1);e.forEach((e,t)=>{Number.isInteger(e.goal)&&e.goal<n&&(i[e.goal]=Math.max(i[e.goal],t))});let a=e[t]?.goal;return i.map((e,n)=>a===n?`current`:e>=0&&t>e?`done`:`todo`)}function Ml(e,t,n=[]){let r=[],i=e=>[`question`,`correction`,`challenge`].includes(e.kind)?e.kind:`reexplain`,a=new Set,o=e=>n.find(t=>e.startsWith(`${t.id}_`));e.forEach((e,n)=>{if(!(n>t)){if(e.aside){let t=o(e.id);t&&!a.has(t.id)&&(a.add(t.id),r.push({key:`${t.id}:ask`,kind:i(t),text:t.label,stepIndex:n,aside:!0}))}e.say&&r.push({key:e.id,kind:`say`,text:e.say,stepIndex:n,aside:e.aside===!0})}});for(let e of n)e.streaming&&!e.steps.length&&r.push({key:`${e.id}:ask`,kind:i(e),text:e.label,stepIndex:-1,aside:!0,pending:!0});return r}function Nl(e,t,n=null){let r=Math.min(t,e.length-1);for(;r>0&&e[r]?.aside;)--r;let i=e[r]?.id;return i?n&&e.findIndex(e=>e.id===n)>=r?n:i:n}let Pl=Object.freeze([{target:`.aha-stage`,title:`tourBoardTitle`,text:`tourBoard`},{target:`.aha-controls`,title:`tourControlsTitle`,text:`tourControls`},{target:`[data-tour=raise]`,title:`tourRaiseTitle`,text:`tourRaise`},{target:`[data-tour=reexplain]`,title:`tourReexplainTitle`,text:`tourReexplain`},{target:`[data-tour=challenge]`,title:`tourChallengeTitle`,text:`tourChallenge`},{target:`.aha-panel`,title:`tourPanelTitle`,text:`tourPanel`}]);function Fl(e,t,n){let r=(e,t)=>Math.max(8,Math.min(e,t-8)),i=r(e.x,n.width-t.width);return e.y+e.height+12+t.height<=n.height-8?{x:i,y:e.y+e.height+12,side:`below`}:e.y-12-t.height>=8?{x:i,y:e.y-12-t.height,side:`above`}:{x:r(e.x+e.width-t.width-12,n.width-t.width),y:r(e.y+e.height-t.height-12,n.height-t.height),side:`inside`}}function Il(e,t,n=6){let r=Math.max(0,e.x-n),i=Math.max(0,e.y-n);return{x:r,y:i,width:Math.min(t.width,e.x+e.width+n)-r,height:Math.min(t.height,e.y+e.height+n)-i}}function Ll({root:e,onDone:t}){let{t:n}=v(),[a,o]=(0,r.useState)(0),[s,c]=(0,r.useState)(null),l=(0,r.useRef)(null),[u]=(0,r.useState)(()=>Pl.filter(t=>e.current?.querySelector(t.target))),d=u[a];(0,r.useLayoutEffect)(()=>{let t=e.current;if(!t||!d)return;let n=()=>{let e=t.querySelector(d.target);if(!e)return;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),i={width:n.width,height:n.height},a=Il({x:r.left-n.left,y:r.top-n.top,width:r.width,height:r.height},i),o=l.current?.getBoundingClientRect(),s=Fl(a,{width:o?.width??320,height:o?.height??150},i);c({hole:a,place:s})};t.querySelector(d.target)?.scrollIntoView?.({block:`nearest`}),n();let r=requestAnimationFrame(n),i=typeof ResizeObserver==`function`?new ResizeObserver(n):null;return i?.observe(t),()=>{cancelAnimationFrame(r),i?.disconnect()}},[a,d]);let f=()=>a+1<u.length?o(a+1):t(),p=()=>o(Math.max(0,a-1));return(0,r.useEffect)(()=>{let e=e=>{if(e.key===`Escape`)t();else if(e.key===`ArrowRight`||e.key===`Enter`)f();else if(e.key===`ArrowLeft`)p();else if(e.key!==` `)return;e.preventDefault(),e.stopImmediatePropagation()};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)}),(0,r.useEffect)(()=>{d||t()},[d]),d?(0,i.jsxs)(`div`,{className:`aha-tour`,role:`dialog`,"aria-modal":`true`,"aria-label":n(`tourLabel`),children:[s?(0,i.jsx)(`div`,{className:`aha-tourHole`,style:{left:s.hole.x,top:s.hole.y,width:s.hole.width,height:s.hole.height}}):null,(0,i.jsxs)(`div`,{ref:l,className:`aha-tourCard`,"data-side":s?.place.side,style:s?{left:s.place.x,top:s.place.y}:{visibility:`hidden`},children:[(0,i.jsx)(`b`,{children:n(d.title)}),(0,i.jsx)(`p`,{children:n(d.text)}),(0,i.jsxs)(`div`,{className:`aha-tourActions`,children:[(0,i.jsxs)(`span`,{className:`aha-hint`,children:[a+1,` / `,u.length]}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,"data-size":`sm`,onClick:t,children:n(`tourSkip`)}),a>0?(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,onClick:p,children:n(`tourBack`)}):null,(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,"data-size":`sm`,autoFocus:!0,onClick:f,children:a+1<u.length?n(`tourNext`):n(`tourStart`)})]})]})]}):null}function Rl({label:e}){return(0,i.jsxs)(`span`,{className:`aha-row`,style:{gap:8},children:[(0,i.jsx)(`span`,{className:`aha-spinner`}),e?(0,i.jsx)(`span`,{className:`aha-hint`,children:e}):null]})}function zl({value:e}){return(0,i.jsx)(`div`,{className:`aha-progress`,children:(0,i.jsx)(`div`,{style:{width:`${Math.max(0,Math.min(100,e))}%`}})})}function Bl({progress:e,label:t,onCancel:n}){let{t:r}=v(),a=e?.total?Math.round(e.done/e.total*100):0;return(0,i.jsxs)(`div`,{className:`aha-col`,style:{gap:6},children:[(0,i.jsx)(Rl,{label:t}),e?.total?(0,i.jsx)(zl,{value:a}):null,n?(0,i.jsxs)(`div`,{className:`aha-row`,children:[(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,"data-size":`sm`,onClick:n,children:r(`cancel`)}),(0,i.jsx)(`span`,{className:`aha-hint`,children:r(`keepsRunning`)})]}):null]})}function Vl({title:e,onClose:t,children:n,footer:r,width:a}){return(0,i.jsx)(`div`,{className:`aha-modalBack`,onMouseDown:e=>{e.target===e.currentTarget&&t?.()},children:(0,i.jsxs)(`div`,{className:`aha-modal`,role:`dialog`,"aria-label":e,style:a?{width:`min(${a}px,100%)`}:void 0,children:[e?(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsx)(`h3`,{className:`aha-cardTitle`,children:e}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,"data-size":`sm`,onClick:t,"aria-label":`close`,children:`✕`})]}):null,n,r?(0,i.jsx)(`div`,{className:`aha-row`,style:{justifyContent:`flex-end`},children:r}):null]})})}function Hl({text:e,onConfirm:t,onCancel:n,danger:r=!1}){let{t:a}=v();return(0,i.jsx)(Vl,{title:a(`confirm`),onClose:n,footer:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,onClick:n,children:a(`cancel`)}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":r?`danger`:`primary`,onClick:t,children:a(`confirm`)})]}),children:(0,i.jsx)(`p`,{children:e})})}function Ul(e,t){let n=String(t?.code??``).replace(/^aha-tutor\//u,``),r=`err_${n}`;return n&&e(r)!==r?e(r):e(`errorGeneric`,{message:t?.message??String(t)})}function Wl({error:e,style:t,reveal:n=!1}){let{t:a}=v(),o=(0,r.useRef)(null);return(0,r.useEffect)(()=>{n&&e&&o.current?.scrollIntoView?.({block:`nearest`})},[n,e]),e?(0,i.jsx)(`div`,{ref:o,className:`aha-error`,role:`alert`,style:t,title:e.message??void 0,children:Ul(a,e)}):null}function Gl({children:e}){return(0,i.jsx)(`div`,{className:`aha-empty`,children:e})}function Kl(){let{api:e}=v(),[t,n]=(0,r.useState)(null),[i,a]=(0,r.useState)(null),[o,s]=(0,r.useState)(null),[c,l]=(0,r.useState)(null);async function d(t){l(t?.job?.id??null);try{return await e.follow(t,{onProgress:s})}finally{l(null),s(null)}}async function f(t){try{let e=await fetch(new URL(`api/aha-tutor/upload?name=${encodeURIComponent(t.name)}`,document.baseURI),{method:`POST`,credentials:`same-origin`,headers:{"content-type":t.type||`application/octet-stream`},body:t});if(e.status!==404){let t=await e.json();if(!t?.ok)throw new u(t?.error?.code??`failed`,t?.error?.message??`Upload failed`);return(await d(t.value)).material}}catch(e){if(e?.message!==`Failed to fetch`)throw e}let n=await p(t);return(await d(await e.call(`material/upload`,{name:t.name,base64:n}))).material}async function m(e){let t=[];a(null);for(let r of e){n(r.name);try{t.push(await f(r))}catch(e){if(e?.code===`cancelled`)break;a(e)}}return n(null),t}async function h(t){n(t),a(null);try{return[(await d(await e.call(`material/url`,{url:t}))).material]}catch(e){return e?.code!==`cancelled`&&a(e),[]}finally{n(null)}}return{upload:m,addUrl:h,busy:t,error:i,progress:o,cancel:c?()=>e.cancel(c):null}}function ql(e,t,n){return n?.label===`recognizing`&&n.total?e(`readingPictures`,{done:n.done,total:n.total,name:t}):n?.label===`summarizing`?e(`summarizingMaterial`,{name:t}):`${e(`reading`)} ${t}`}function Jl({onAdded:e,compact:t=!1}){let{t:n}=v(),a=(0,r.useRef)(null),[o,s]=(0,r.useState)(``),[c,l]=(0,r.useState)(!1),{upload:u,addUrl:d,busy:f,error:p,progress:m,cancel:h}=Kl(),g=async t=>{let n=await u([...t]);n.length&&e?.(n)};return(0,i.jsxs)(`div`,{className:`aha-col`,children:[(0,i.jsxs)(`div`,{className:`aha-empty`,style:{padding:t?14:24,borderColor:c?`var(--aha-brand)`:void 0,cursor:`pointer`},onClick:()=>a.current?.click(),onDragOver:e=>{e.preventDefault(),l(!0)},onDragLeave:()=>l(!1),onDrop:e=>{e.preventDefault(),l(!1),g(e.dataTransfer.files)},children:[(0,i.jsxs)(`div`,{className:`aha-row`,style:{justifyContent:`center`},children:[(0,i.jsx)(ut,{name:`upload`}),n(`dropHere`)]}),(0,i.jsx)(`input`,{ref:a,type:`file`,multiple:!0,accept:`.pdf,.docx,.pptx,.md,.markdown,.txt,.csv,.json,.tex,.py,.js,.ts,.html,.png,.jpg,.jpeg,.webp,.gif`,hidden:!0,onChange:e=>{g(e.currentTarget.files),e.currentTarget.value=``}})]}),(0,i.jsxs)(`form`,{className:`aha-row`,onSubmit:async t=>{if(t.preventDefault(),!o.trim())return;let n=await d(o.trim());n.length&&(s(``),e?.(n))},children:[(0,i.jsx)(`input`,{className:`aha-input`,style:{flex:1},value:o,placeholder:n(`urlPlaceholder`),onChange:e=>s(e.currentTarget.value)}),(0,i.jsxs)(`button`,{type:`submit`,className:`aha-btn`,disabled:!o.trim()||!!f,children:[(0,i.jsx)(ut,{name:`link`}),n(`addUrl`)]})]}),f?(0,i.jsxs)(`div`,{className:`aha-row`,style:{gap:8},children:[(0,i.jsx)(Rl,{label:ql(n,f,m)}),h?(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,"data-kind":`ghost`,onClick:h,children:n(`cancel`)}):null]}):null,(0,i.jsx)(Wl,{error:p})]})}function Yl({selected:e,onChange:t,onClose:n,exclude:r=[],max:a=8}){let{api:o,t:s}=v(),c=y(()=>o.call(`material/list`),[]),l=n=>t(e.includes(n)?e.filter(e=>e!==n):[...e,n].slice(0,a));return(0,i.jsxs)(Vl,{title:s(`pickMaterials`),onClose:n,width:640,footer:(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,onClick:n,children:s(`confirm`)}),children:[(0,i.jsx)(Jl,{compact:!0,onAdded:n=>{c.reload(),t([...e,...n.map(e=>e.id)].slice(0,a))}}),c.loading&&!c.value?(0,i.jsx)(Rl,{label:s(`loading`)}):null,(0,i.jsx)(`div`,{className:`aha-col`,style:{gap:6,maxHeight:320,overflow:`auto`},children:(c.value??[]).filter(e=>!r.includes(e.id)).map(t=>(0,i.jsxs)(`label`,{className:`aha-option`,style:{flexDirection:`row`,alignItems:`center`,gap:10},children:[(0,i.jsx)(`input`,{type:`checkbox`,checked:e.includes(t.id),onChange:()=>l(t.id)}),(0,i.jsxs)(`span`,{className:`aha-col`,style:{gap:0},children:[(0,i.jsx)(`b`,{children:t.title}),(0,i.jsx)(`small`,{children:Xl(t,s)})]})]},t.id))})]})}function Xl(e,t){let n=[e.kind.toUpperCase()];e.pages&&n.push(t(`pages`,{count:e.pages})),e.slides&&n.push(t(`slides`,{count:e.slides}));let r=e.ocr?.read??0;return r&&e.kind===`image`?n.push(e.chars?t(`readPhoto`):t(`photoNoText`)):r?n.push(e.pages?t(`readScanPages`,{count:r}):t(`readPictures`,{count:r})):e.kind===`image`&&n.push(t(`imageNeedsVision`)),Zl(e,t).length&&n.push(t(`readPartly`)),n.join(` · `)}function Zl(e,t){let n=e.ocr;if(!n)return[];let r=[],i=!!e.pages;if(n.unread&&r.push(t(i?`unreadPages`:`unreadPictures`,{count:n.unread})),n.failed?.length){let a=[...new Set(n.failed.map(e=>e.page??e.slide??e.picture))].join(t(`listJoin`)),o=t(e.kind===`image`?`failedPhoto`:i?`failedPages`:e.slides?`failedSlides`:`failedPictures`,{list:a});r.push(n.reason?t(`failedWhy`,{what:o,reason:Ul(t,{code:n.reason})}):t(`failedRetry`,{what:o}))}return n.left&&r.push(t(i?`leftPages`:`leftPictures`,{count:n.left})),r}function Ql({sources:e}){return(0,i.jsx)(`ol`,{className:`aha-sourceList`,children:(e??[]).filter(e=>/^https?:\/\//iu.test(String(e?.url??``))).map(e=>(0,i.jsxs)(`li`,{children:[(0,i.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,children:e.title||e.url}),(0,i.jsxs)(`span`,{className:`aha-hint`,children:[` · `,new URL(e.url).hostname]}),e.snippet?(0,i.jsx)(`p`,{className:`aha-hint`,children:e.snippet}):null]},e.url))})}function $l({title:e,emoji:t}){return e?(0,i.jsxs)(`span`,{className:`aha-hint`,title:e,children:[` · `,t?`${t} `:``,ke(e)]}):null}function eu({value:e,stage:t,label:n}){let r=t===`none`?0:Math.round((Number(e)||0)/20),a=n?t===`none`?n:`${n} · ${Math.round(e??0)}%`:`${Math.round(e??0)}%`;return(0,i.jsx)(`span`,{className:`aha-meter`,title:a,"aria-label":a,role:`img`,"data-stage":t,children:[0,1,2,3,4].map(e=>(0,i.jsx)(`i`,{"data-on":e<r},e))})}function tu(e){return navigator.clipboard?.writeText(e).catch(()=>void 0)}let nu=Object.freeze([`choice`,`multi`,`blank`,`number`,`order`]),ru=/[!-~]/gu;function iu(e){return String(e??``).normalize(`NFKC`).replace(ru,e=>String.fromCharCode(e.charCodeAt(0)-65248)).toLowerCase().replace(/[\s ]+/gu,` `).replace(/^[\s.,;:!?'"`,。;:!?、“”‘’]+|[\s.,;:!?'"`,。;:!?、“”‘’]+$/gu,``).trim()}function au(e){if(typeof e==`number`)return e;let t=iu(e).replace(/,/gu,``).replace(/\s/gu,``),n=/^(-?\d+(?:\.\d+)?)\/(\d+(?:\.\d+)?)$/u.exec(t);if(n)return Number(n[1])/Number(n[2]);let r=/^(-?\d+(?:\.\d+)?)%$/u.exec(t);if(r)return Number(r[1])/100;let i=Number(t);return Number.isFinite(i)?i:NaN}function ou(e,t){if(!e||!nu.includes(e.kind))return{score:0,correct:!1,gradable:!1};if(e.kind===`choice`){let n=String(t??``)===String(e.answer??``);return{score:+!!n,correct:n,gradable:!0}}if(e.kind===`multi`){let n=new Set((Array.isArray(e.answer)?e.answer:[e.answer]).map(String)),r=new Set((Array.isArray(t)?t:[]).map(String));if(!n.size)return{score:0,correct:!1,gradable:!1};let i=0,a=0;for(let e of r)n.has(e)?i+=1:a+=1;let o=Math.max(0,(i-a)/n.size),s=i===n.size&&a===0;return{score:cu(o),correct:s,gradable:!0}}if(e.kind===`order`){let n=(Array.isArray(e.answer)?e.answer:[]).map(String),r=(Array.isArray(t)?t:[]).map(String);if(!n.length)return{score:0,correct:!1,gradable:!1};let i=0;return n.forEach((e,t)=>{r[t]===e&&(i+=1)}),{score:cu(i/n.length),correct:i===n.length,gradable:!0}}if(e.kind===`number`){let n=au(e.answer),r=au(t);if(!Number.isFinite(n))return{score:0,correct:!1,gradable:!1};if(!Number.isFinite(r))return{score:0,correct:!1,gradable:!0};let i=Number.isFinite(Number(e.tolerance))&&Number(e.tolerance)>=0?Number(e.tolerance):Math.max(1e-9,Math.abs(n)*.01),a=Math.abs(r-n)<=i;return{score:+!!a,correct:a,gradable:!0}}let n=(Array.isArray(e.answer)?e.answer:[e.answer]).map(iu).filter(Boolean);if(!n.length)return{score:0,correct:!1,gradable:!1};let r=iu(t),i=n.includes(r);if(i)return{score:1,correct:i,gradable:!0};let a=au(t),o=n.map(au).filter(Number.isFinite);return Number.isFinite(a)&&o.some(e=>Math.abs(e-a)<=Math.max(1e-9,Math.abs(e)*.001))?{score:1,correct:!0,gradable:!0}:{score:0,correct:!1,gradable:!0}}function su(e,t){return e.kind===`choice`?`chose ${String(t).toUpperCase()}: ${(e.options?.find(e=>e.id===t)?.text??``).slice(0,50)}`:e.kind===`number`||e.kind===`blank`?`answered ${String(t).slice(0,40)}`:`wrong`}function cu(e){return Math.round(e*100)/100}let lu=Object.freeze({wrong:`itemCheck_wrong`,unclear:`itemCheck_unclear`,misgraded:`itemCheck_misgraded`,right:`itemCheck_right`});function uu({courseId:e,lessonId:t,unitId:n,deckId:r}={},i){return i?.id?i.context?i.context.source??null:r?{kind:`deck`,deckId:r,itemId:i.id}:e&&n?{kind:`quiz`,courseId:e,unitId:n,itemId:i.id}:e&&t?{kind:`practice`,courseId:e,lessonId:t,itemId:i.id}:null:null}let du=(e,t=160)=>{let n=[...String(e??``).replace(/\s+/gu,` `).trim()];return n.length>t?`${n.slice(0,t).join(``)}…`:n.join(``)};function fu(e,t=e?.answer){return e.kind===`choice`?(t=>{let n=e.options?.find(e=>e.id===t);return n?`${t.toUpperCase()}. ${n.text}`:String(t??``).toUpperCase()})(t):e.kind===`multi`?(Array.isArray(t)?t:[]).map(e=>String(e).toUpperCase()).join(`, `):e.kind===`order`?(Array.isArray(t)?t:[]).map(t=>e.options?.find(e=>e.id===t)?.text??t).join(` → `):e.kind===`number`?`${t}${e.unit?` ${e.unit}`:``}`:e.kind===`blank`?(Array.isArray(t)?t:[t]).join(` / `):du(t)}function pu(e,t){let n=t?.fixed?.was;if(!n)return[];let r=[];n.prompt!==void 0&&r.push(e(`fixedPart_prompt`,{text:du(n.prompt)||`—`}));for(let[t,i]of Object.entries(n.options??{}))r.push(e(`fixedPart_option`,{id:t.toUpperCase(),text:du(i,80)}));if(n.answer!==void 0){let i=t.options?.map(e=>({...e,text:n.options?.[e.id]??e.text}));r.push(e(`fixedPart_answer`,{text:n.answer===null?`—`:fu({...t,options:i,unit:n.unit??t.unit},n.answer)}))}return n.unit!==void 0&&n.answer===void 0&&r.push(e(`fixedPart_unit`,{text:n.unit||`—`})),n.tolerance!==void 0&&r.push(e(`fixedPart_tolerance`,{text:n.tolerance??`—`})),n.explanation!==void 0&&r.push(e(`fixedPart_explanation`,{text:du(n.explanation)||`—`})),n.hints!==void 0&&r.push(e(`fixedPart_hints`,{text:du((n.hints??[]).join(` / `))||`—`})),n.rubric!==void 0&&r.push(e(`fixedPart_rubric`,{text:du((n.rubric??[]).join(` / `))||`—`})),n.figure&&r.push(e(`fixedPart_figure`)),r}function mu(e){return{score:Number(e?.score)||0,correct:e?.correct===!0,partial:e?.partial===!0,feedback:e?.feedback??``,wrongStep:e?.wrongStep??``,fix:e?.fix??``}}function hu(e,t,n){return{status:`done`,note:e?.note??``,verdict:t?.verdict??`right`,summary:t?.summary??``,explanation:t?.explanation??``,item:t?.item??e?.item??null,result:t?.result?{...n,...t.result,regraded:!0}:e?.result??null,earlier:(e?.earlier??0)+(Number(t?.earlier)||0)}}function gu(e,t,n){return e.map(e=>e.index===t?{...e,...n,index:t,regraded:!0}:e)}function _u(e,{index:t,verdict:n,regraded:r=!1,earlier:i=0,message:a}){return a===void 0?`${e(`itemCheckDone`,{n:t+1,verdict:e(lu[n]??lu.right)})}${r?e(`itemCheckRegraded`):``}${i?e(`itemCheckEarlier`,{count:i}):``}`:e(`itemCheckFailedNotice`,{n:t+1,message:a})}function vu({text:e,compact:t=!1,streaming:n=!1,className:o=``}){let{t:s}=v(),c=(0,r.useMemo)(()=>({code:{copyLabel:s(`copyCode`),copiedLabel:s(`copied`)},footnotes:s(`footnotes`)}),[s]);return(0,i.jsx)(`div`,{className:o?`aha-markdown ${o}`:`aha-markdown`,children:(0,i.jsx)(a.MarkdownText,{text:String(e??``),labels:c,streaming:n,variant:t?`compact`:`body`})})}let yu=16e3,bu={NotAllowedError:{code:`mic-denied`},SecurityError:{code:`mic-denied`},NotFoundError:{code:`mic-missing`},OverconstrainedError:{code:`mic-missing`},NotReadableError:{code:`mic-busy`},AbortError:{code:`mic-busy`}},xu={code:`mic-unsupported`},Su={code:`speech-audio`};function Cu({code:e,device:t}){return Object.assign(Error(e),{name:`RecordingError`,code:e},t?{device:t}:{})}function wu(){try{let e=JSON.parse(window.localStorage.getItem(`dsh.voice-input.microphone`)??`null`);if(typeof e?.id==`string`&&e.id&&typeof e.label==`string`)return{id:e.id,label:e.label.slice(0,120)}}catch{}return null}function Tu(e){let t=new Uint8Array(44+e.length*2),n=new DataView(t.buffer),r=(e,n)=>{for(let r=0;r<4;r+=1)t[e+r]=n.charCodeAt(r)};r(0,`RIFF`),n.setUint32(4,36+e.length*2,!0),r(8,`WAVE`),r(12,`fmt `),n.setUint32(16,16,!0),n.setUint16(20,1,!0),n.setUint16(22,1,!0),n.setUint32(24,yu,!0),n.setUint32(28,yu*2,!0),n.setUint16(32,2,!0),n.setUint16(34,16,!0),r(36,`data`),n.setUint32(40,e.length*2,!0);for(let t=0;t<e.length;t+=1){let r=Math.max(-1,Math.min(1,Number(e[t])||0));n.setInt16(44+t*2,Math.round(r<0?r*32768:r*32767),!0)}return t}async function Eu(e,t){let n=new(globalThis.AudioContext??globalThis.webkitAudioContext);try{let r=await n.decodeAudioData(await e.arrayBuffer()),i=Math.max(1,Math.floor(Math.min(r.duration,t)*yu)),a=new OfflineAudioContext(1,i,yu),o=a.createBufferSource();return o.buffer=r,o.connect(a.destination),o.start(),Tu((await a.startRendering()).getChannelData(0))}finally{n.close?.()?.catch?.(()=>void 0)}}function Du(e){let t=``;for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return btoa(t)}function Ou({maxSeconds:e=120,onLimit:t}={}){let n=null,r=null,i=[],a=null,o=0,s=!1,c=()=>{clearTimeout(a);for(let e of n?.getTracks?.()??[])e.stop();n=null};async function l(){if(!globalThis.navigator?.mediaDevices?.getUserMedia||typeof MediaRecorder!=`function`)throw Cu(xu);let l=wu();try{n=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,noiseSuppression:!0,...l?{deviceId:{exact:l.id}}:{}}})}catch(e){throw l&&(e?.name===`NotFoundError`||e?.name===`OverconstrainedError`)?Cu({code:`mic-chosen-missing`,device:l.label}):Cu(bu[e?.name]??xu)}if(s){c();return}i=[],r=new MediaRecorder(n),r.ondataavailable=e=>{e.data?.size&&i.push(e.data)},r.start(250),o=performance.now(),a=setTimeout(()=>t?.(),e*1e3)}function u(){return new Promise((t,n)=>{let a=r;if(r=null,!a||a.state===`inactive`){c(),n(Cu(Su));return}a.onstop=async()=>{c();try{t(await Eu(new Blob(i,{type:a.mimeType||`audio/webm`}),e))}catch{n(Cu(Su))}},a.stop()})}function d(){s=!0;let e=r;r=null,i=[],e&&e.state!==`inactive`&&(e.onstop=null,e.stop()),c()}return{start:l,stop:u,cancel:d,elapsed:()=>o?(performance.now()-o)/1e3:0}}function ku(e){for(let t=e?.parentElement;t;t=t.parentElement)if(getComputedStyle(t).overflowX!==`visible`)return t;return null}function Au(e){let t=ku(e);if(!t)return 0;e.style.width=``,e.style.transform=``;let n=t.getBoundingClientRect();e.style.width=`${Math.min(e.getBoundingClientRect().width,n.width-16)}px`;let r=e.getBoundingClientRect(),i=r.left<n.left+8?n.left+8-r.left:Math.min(0,n.right-8-r.right);return i&&(e.style.transform=`translateX(${Math.round(i)}px)`),i}function ju(e){Au(e);let t=ku(e);if(!t||typeof ResizeObserver!=`function`)return()=>void 0;let n=new ResizeObserver(()=>Au(e));return n.observe(t),()=>n.disconnect()}function Mu(e,{reducedMotion:t=Nu()}={}){let n=e?.closest?.(`.aha-main`);if(!n||n.scrollHeight<=n.clientHeight)return!1;let r=e.getBoundingClientRect().top-n.getBoundingClientRect().top-12;return Math.abs(r)<1?!1:(n.scrollTo({top:Math.max(0,n.scrollTop+r),behavior:t?`auto`:`smooth`}),!0)}function Nu(){return globalThis.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches===!0}let Pu=e=>(e?.key===`v`||e?.key===`V`)&&!e.ctrlKey&&!e.metaKey&&!e.altKey,Fu=e=>!!e?.isContentEditable||/^(input|textarea|select)$/iu.test(String(e?.tagName??``));function Iu(){let e=null,t=e=>e===`starting`||e===`recording`;return{down(n,r){return n===`idle`?(e=r,`start`):(e=null,t(n)?`stop`:null)},up(n,r){if(e===null)return null;let i=r-e;return e=null,i>=350&&t(n)?`stop`:null}}}async function Lu(e,t){try{let e=await fetch(new URL(`api/aha-tutor/speech`,document.baseURI),{method:`POST`,credentials:`same-origin`,headers:{"content-type":`audio/wav`},body:t});if(e.status!==404){let t=await e.json();if(!t?.ok)throw new u(t?.error?.code??`speech-failed`,t?.error?.message??`Speech recognition failed`);return t.value}}catch(e){if(e?.message!==`Failed to fetch`)throw e}return e.call(`speech/transcribe`,{base64:Du(t)})}let Ru=e=>`${Math.floor(e/60)}:${String(e%60).padStart(2,`0`)}`;function zu(e,t){return t?.code===`mic-chosen-missing`&&t.device?e(`micChosenMissing`,{name:t.device}):Ul(e,t)}let Bu=(0,r.forwardRef)(function({onText:e,onStart:t,disabled:n=!1,keyHint:a=``},o){let{api:s,t:c}=v(),[l,u]=(0,r.useState)(null),[d,f]=(0,r.useState)(`idle`),[p,m]=(0,r.useState)(0),[h,g]=(0,r.useState)(null),[_,y]=(0,r.useState)(()=>wu()?.label??``),b=(0,r.useRef)(null),x=(0,r.useRef)(null),S=(0,r.useRef)(null),C=(0,r.useRef)(`idle`),w=(0,r.useRef)(!1),T=(0,r.useRef)(null);T.current??=Iu();let E=e=>{C.current=e,f(e)};(0,r.useLayoutEffect)(()=>h&&x.current?ju(x.current):void 0,[h]);async function D(){let e;try{e=await s.call(`speech/status`)}catch{e={state:`off`}}return u(e),e}(0,r.useEffect)(()=>(D(),()=>b.current?.cancel()),[]),(0,r.useEffect)(()=>{if(d!==`recording`)return;let e=setInterval(()=>m(Math.floor(b.current?.elapsed()??0)),250);return()=>clearInterval(e)},[d]);async function O(){let t=b.current;if(t){b.current=null,E(`working`);try{let{text:n}=await Lu(s,await t.stop());e?.(n)}catch(e){g({text:Ul(c,e),error:!0}),/speech-(off|unprepared)$/u.test(String(e?.code??``))&&D()}finally{E(`idle`)}}}async function k(){g(null),w.current=!1,E(`starting`);let e=l?.state===`ready`?l:await D();if(e.state!==`ready`){E(`idle`),g({text:c(`voice_${e.state}`)});return}t?.();let n=Ou({maxSeconds:e.maxSeconds??120,onLimit:()=>{O()}});b.current=n,m(0);try{await n.start(),E(`recording`),w.current&&O()}catch(e){b.current=null,E(`idle`),g({text:zu(c,e),error:!0})}}function A(){C.current===`starting`?w.current=!0:C.current===`recording`&&O()}function ee(){C.current===`recording`?O():C.current===`idle`&&k()}(0,r.useImperativeHandle)(o,()=>({press(e){if(n&&C.current===`idle`)return;let t=T.current.down(C.current,e);t===`start`?(S.current?.scrollIntoView?.({block:`nearest`}),k()):t===`stop`&&A()},release(e){T.current.up(C.current,e)===`stop`&&A()}}));let te=l!==null&&l.state!==`ready`,j=d===`recording`,ne=j?c(`voiceStop`):te?c(`voiceSetup`):_?c(`voiceAskWith`,{name:_}):c(`voiceAsk`);return(0,i.jsxs)(`span`,{className:`aha-mic`,children:[(0,i.jsxs)(`button`,{ref:S,type:`button`,className:`aha-btn aha-micBtn`,"data-state":d,"data-unavailable":te?`true`:void 0,"aria-pressed":j,"aria-label":c(j?`voiceStop`:`voiceAsk`),title:a?`${ne}\n${a}`:ne,disabled:n&&d===`idle`||d===`starting`||d===`working`,onClick:ee,onPointerEnter:()=>y(wu()?.label??``),children:[d===`working`?(0,i.jsx)(`span`,{className:`aha-spinner`}):(0,i.jsx)(ut,{name:j?`stop`:`mic`,size:16}),j?(0,i.jsx)(`span`,{className:`aha-micTime`,children:Ru(p)}):d===`working`?(0,i.jsx)(`span`,{className:`aha-micTime`,children:c(`voiceWorking`)}):null]}),h?(0,i.jsxs)(`span`,{ref:x,className:`aha-micNote`,role:`status`,"data-error":h.error?`true`:void 0,children:[h.text,(0,i.jsx)(`button`,{type:`button`,className:`aha-micClose`,"aria-label":c(`close`),onClick:()=>g(null),children:`×`})]}):null]})}),Vu=[[`sure`,`confSure`],[`unsure`,`confUnsure`],[`guess`,`confGuess`]];function Hu({item:e,language:t,onResult:n,onContinue:a,continueLabel:o,askConfidence:s=!0,compact:c=!1,keyboard:l=!1,onChallenge:u,check:d=null}){let{api:f,t:p}=v(),m=d?.item??e,[h,g]=(0,r.useState)(m.kind===`multi`||m.kind===`order`?[]:``),[_,y]=(0,r.useState)(null),[b,x]=(0,r.useState)(0),[S,C]=(0,r.useState)(null),[w,T]=(0,r.useState)(!1),[E,D]=(0,r.useState)(null),[O,k]=(0,r.useState)(!1),[A,ee]=(0,r.useState)(null),te=(0,r.useRef)(Date.now()),j=S&&d?.result?d.result:S;(0,r.useEffect)(()=>{g(e.kind===`multi`||e.kind===`order`?e.kind===`order`?e.options.map(e=>e.id):[]:``),y(null),x(0),C(null),D(null),k(!1),ee(null),te.current=Date.now()},[e]);let ne=m.kind===`multi`?h.length>0:m.kind===`order`||String(h).trim()!==``,re=ne&&(!s||_);async function ie(){if(!re||j||w)return;let e=Date.now()-te.current,r;if(m.kind===`short`||m.kind===`work`){T(!0),D(null);try{let e=await f.call(`lesson/grade`,{item:{kind:m.kind,prompt:m.prompt,answer:m.answer,rubric:m.rubric},response:h,language:t});r={score:e.score,correct:e.verdict===`correct`,partial:e.verdict===`partial`,feedback:e.feedback,errorTag:e.errorTag,misconception:e.misconception},m.kind===`work`&&Object.assign(r,{wrongStep:e.wrongStep??``,why:e.why??``,fix:e.fix??``})}catch(e){D(e),T(!1);return}T(!1)}else{let e=ou(m,h);r={score:e.score,correct:e.correct,partial:!e.correct&&e.score>0,errorTag:e.correct?``:su(m,h)}}let i={...r,response:typeof h==`string`?h:void 0,given:h,confidence:_??void 0,timeMs:e,hintsUsed:b};C(i),n?.(i)}function ae(e){if(e?.preventDefault(),A===null)return;let t=A.trim();ee(null),u?.(t)}let oe=e=>g(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),se=(0,r.useRef)(null);se.current={result:j,ready:re,answered:ne,confidence:_,hints:b,submit:ie,toggle:oe,onContinue:a},(0,r.useEffect)(()=>{if(!l)return;let e=e=>{if(e.defaultPrevented||e.metaKey||e.ctrlKey||e.altKey||e.isComposing)return;let t=se.current,n=e.target,r=n instanceof HTMLElement&&(/^(input|textarea|select)$/iu.test(n.tagName)||n.isContentEditable);if(e.key===`Enter`){if(r)return;t.result?t.onContinue&&(e.preventDefault(),t.onContinue()):t.ready?(e.preventDefault(),t.submit()):t.answered&&s&&!t.confidence&&k(!0);return}if(!(r||t.result))if(/^[1-9]$/u.test(e.key)&&(m.kind===`choice`||m.kind===`multi`)){let n=m.options[Number(e.key)-1];if(!n)return;e.preventDefault(),m.kind===`multi`?t.toggle(n.id):g(n.id)}else(e.key===`h`||e.key===`H`)&&t.hints<(m.hints?.length??0)&&(e.preventDefault(),x(e=>e+1))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[l,m,s]);let ce=(e,t)=>g(n=>{let r=[...n],i=e+t;return i<0||i>=r.length?n:([r[e],r[i]]=[r[i],r[e]],r)}),le=e=>{if(j)return(Array.isArray(m.answer)?m.answer:[m.answer]).includes(e.id)?`right`:(Array.isArray(h)?h.includes(e.id):h===e.id)?`wrong`:void 0},ue=m.fixed?pu(p,m):[],de=ue.length?`${p(`fixedWasItem`)}\n${ue.join(`
|
|
267
|
+
`)}),e.caption?(0,i.jsx)(`div`,{className:`aha-figCaption`,children:e.caption}):null]});break}case`anim`:p=c?(0,i.jsx)(vl,{op:e,label:l}):(0,i.jsx)(gl,{op:e,reveal:t,theme:s});break;default:p=null}let m=e.fixed&&d&&t>=1?d(e):null;return(0,i.jsxs)(`div`,{ref:o,className:`aha-op`,"data-t":e.t,"data-aside":r?`true`:void 0,"data-now":a?`true`:void 0,"data-op":e.id,children:[p,f,m?(0,i.jsxs)(`span`,{className:`aha-fixed`,title:m.title,children:[`✎ `,m.label]}):null]})}function bl({target:e,active:t,stage:n,scale:a=1,scrolls:o=!1}){let[s,c]=(0,r.useState)(null);return(0,r.useLayoutEffect)(()=>{let r=e?.current,i=n?.current;if(!t||!r||!i){c(e=>e===null?e:null);return}let s=r.getBoundingClientRect(),l=i.getBoundingClientRect(),u=r.querySelector(`.aha-op-math`),d=u?[]:r.querySelectorAll(`span,strong,mark,li,td,pre`),f=d[d.length-1]?.getBoundingClientRect(),p=f&&f.width?f.right:s.left+s.width*t.progress,m=f&&f.height?f.bottom-4*a:s.top+s.height/2;if(u?.dataset.pen){let[e,t]=u.dataset.pen.split(` `).map(Number),n=u.getBoundingClientRect();p=n.left+e*a,m=n.top+(t-4)*a}let h={left:Math.round((p-l.left)/a+(o?i.scrollLeft:0)),top:Math.round((m-l.top)/a+(o?i.scrollTop:0)),glide:!u};c(e=>e&&e.left===h.left&&e.top===h.top&&e.glide===h.glide?e:h)}),s?(0,i.jsxs)(`svg`,{className:`aha-pencil`,style:{left:s.left,top:s.top},"data-glide":s.glide,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:[(0,i.jsx)(`path`,{d:`M3 21l3.5-1 11-11-2.5-2.5-11 11L3 21z`,fill:`var(--pencil)`,stroke:`var(--ink)`,strokeWidth:`1.2`,strokeLinejoin:`round`}),(0,i.jsx)(`path`,{d:`M14.5 6.5l2.5 2.5 2-2a1.77 1.77 0 0 0-2.5-2.5l-2 2z`,fill:`var(--accent)`,stroke:`var(--ink)`,strokeWidth:`1.2`})]}):null}let xl=new Set([`p`,`h`,`list`,`note`,`math`,`title`]);function Sl({page:e,title:t,board:n,activeRef:r}){let{reveal:a,marks:o,nowIds:s,opMeta:c,activeOp:l,theme:u,onInteract:d,fixedNote:f}=n,p=t?a(t.id):1;return(0,i.jsxs)(i.Fragment,{children:[e.title&&p>0?(0,i.jsx)(`h2`,{className:`aha-boardTitle`,children:(0,i.jsx)(`span`,{children:(0,i.jsx)(pl,{text:e.title,reveal:p})})}):null,(0,i.jsx)(`div`,{className:`aha-cols`,children:e.columns.map((e,t)=>(0,i.jsx)(`div`,{className:`aha-colBody`,children:e.map(({op:e})=>{let t=a(e.id);if(t<=0)return null;let n=l?.id===e.id&&t<1;return(0,i.jsx)(yl,{op:e,reveal:t,marks:o.get(e.id)??[],aside:c.get(e.id)?.aside,now:s.has(e.id),opRef:n?r:void 0,theme:u,onInteract:d,fixedNote:f},e.id)})},t))})]})}function Cl(e,t,n){let{reveal:r,marks:i,nowIds:a}=n,o=[t?`t${Math.round(r(t.id)*1e3)}`:``];for(let t of e.columns)for(let{op:e}of t){let t=Math.round(r(e.id)*1e3);t<=0||o.push(`${e.id}:${t}${a.has(e.id)?`*`:``}${(i.get(e.id)??[]).map(e=>`/${e.id}:${Math.round(e.reveal*1e3)}`).join(``)}`)}return o.join(` `)}let wl=(0,r.memo)(function({index:e,page:t,title:n,board:r,activeRef:a,label:o}){return(0,i.jsx)(`section`,{className:`aha-frame`,"data-frame":e,"aria-label":o,children:(0,i.jsx)(Sl,{page:t,title:n,board:r,activeRef:a})})},(e,t)=>e.signature===t.signature&&e.page===t.page&&e.activeRef===t.activeRef&&e.board.theme===t.board.theme&&e.label===t.label);function Tl({board:e,layout:t,position:n,activePage:a,pencil:o}){let{activeOp:s}=e,[c,l]=(0,r.useState)(null);(0,r.useEffect)(()=>{l(null)},[a]);let u=Math.min(t.pages.length-1,c??a),d=t.pages[u],f=(0,r.useRef)(null),p=(0,r.useRef)(null);(0,r.useEffect)(()=>{let e=f.current,t=s?e?.querySelector(`[data-op="${s.id}"]`):null;if(!e||!t)return;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();n.bottom>r.bottom-24?e.scrollTo({top:e.scrollTop+n.bottom-r.bottom+56,behavior:`smooth`}):n.top<r.top+8&&e.scrollTo({top:Math.max(0,e.scrollTop-(r.top-n.top)-24),behavior:`smooth`})},[s?`${s.id}:${Math.round((n?.progress??0)*4)}`:``,u]);let m=t.pages.map((e,t)=>t).filter(e=>e<=Math.max(a,c??0)||!n);return(0,i.jsxs)(i.Fragment,{children:[m.length>1?(0,i.jsx)(`div`,{className:`aha-pager`,children:m.map(e=>(0,i.jsx)(`button`,{type:`button`,"data-active":e===u,onClick:()=>l(e),children:e+1},e))}):null,(0,i.jsxs)(`div`,{className:`aha-boardScroll`,ref:f,children:[d?(0,i.jsx)(Sl,{page:d,title:e.titles.get(u),board:e,activeRef:p}):null,(0,i.jsx)(bl,{target:p,stage:f,scrolls:!0,active:o})]})]})}function El({board:e,layout:t,position:n,activePage:a,pencil:o}){let{t:s}=v(),{activeOp:c}=e,l=(0,r.useRef)(null),u=(0,r.useRef)(null),d=(0,r.useRef)(null),[f,p]=(0,r.useState)({width:0,height:0}),[m,h]=(0,r.useState)({x:16,y:16,k:1,animate:!1}),[g,_]=(0,r.useState)(!0),[y,b]=(0,r.useState)(!1),x=(0,r.useRef)({camera:m,size:f,pointers:new Map,drag:null}),S=(0,r.useRef)(-1);x.current.camera=m,x.current.size=f,(0,r.useLayoutEffect)(()=>{let e=l.current;if(!e)return;let t=()=>p(t=>t.width===e.clientWidth&&t.height===e.clientHeight?t:{width:e.clientWidth,height:e.clientHeight});t();let n=typeof ResizeObserver==`function`?new ResizeObserver(t):null;return n?.observe(e),()=>n?.disconnect()},[]);let C=Math.max(240,f.width-32),w=()=>({width:u.current?.offsetWidth??C,height:u.current?.offsetHeight??0}),T=(e,{animate:t=!1,manual:n=!1}={})=>{n&&_(!1),h(n=>({...gc(typeof e==`function`?e(n):e,x.current.size,w()),animate:t}))};(0,r.useEffect)(()=>{let e=l.current;if(!e)return;let t=t=>{t.preventDefault();let n=e.getBoundingClientRect(),r=_c(t,n.height);t.ctrlKey||t.metaKey?T(e=>pc(e,t.clientX-n.left,t.clientY-n.top,vc(r.y)),{manual:!0}):T(e=>({...e,x:e.x-(t.shiftKey?r.y:r.x),y:e.y-(t.shiftKey?0:r.y)}),{manual:!0})};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[]);let E=e=>{e.pointerType===`mouse`&&e.button!==0||e.target.closest?.(`button,a,input,textarea,select,iframe,.aha-canvasBar`)||(x.current.pointers.set(e.pointerId,{x:e.clientX,y:e.clientY}),x.current.drag||(x.current.drag={x:e.clientX,y:e.clientY,moved:!1}),l.current?.setPointerCapture?.(e.pointerId))},D=e=>{let{pointers:t,drag:n}=x.current,r=t.get(e.pointerId);if(!r)return;let i={x:e.clientX,y:e.clientY};if(t.size===1){if(!n.moved&&Math.hypot(i.x-n.x,i.y-n.y)<4)return;n.moved=!0,b(!0),t.set(e.pointerId,i),T(e=>({...e,x:e.x+i.x-r.x,y:e.y+i.y-r.y}),{manual:!0});return}let a=[...t.entries()].find(([t])=>t!==e.pointerId)?.[1];if(t.set(e.pointerId,i),!a)return;let o=l.current.getBoundingClientRect(),s={x:(r.x+a.x)/2,y:(r.y+a.y)/2,d:Math.hypot(r.x-a.x,r.y-a.y)},c={x:(i.x+a.x)/2,y:(i.y+a.y)/2,d:Math.hypot(i.x-a.x,i.y-a.y)};n.moved=!0,T(e=>{let t=pc(e,s.x-o.left,s.y-o.top,c.d/Math.max(1,s.d));return{...t,x:t.x+c.x-s.x,y:t.y+c.y-s.y}},{manual:!0})},O=e=>{x.current.pointers.delete(e.pointerId),x.current.pointers.size||(x.current.drag=null,b(!1))},k=(e,t)=>T(mc(x.current.size,e,{margin:16,maxZoom:t}),{animate:!0,manual:!0}),A=e=>{let t=e.target.closest?.(`.aha-frame`);t&&k({x:t.offsetLeft,y:t.offsetTop,width:t.offsetWidth,height:t.offsetHeight})},ee=e=>T(t=>pc(t,x.current.size.width/2,x.current.size.height/2,e),{animate:!0,manual:!0}),te=()=>k({x:0,y:0,...w()},1),j=()=>T(e=>({...pc(e,x.current.size.width/2,x.current.size.height/2,1/e.k),x:16}),{animate:!0,manual:!0});(0,r.useLayoutEffect)(()=>{if(!g||!n||!f.height)return;let e=u.current?.querySelector(`[data-frame="${a}"]`);if(!e)return;let t=c?.t===`mark`?c.ref:c?.id,r=e.querySelectorAll(`[data-op]`),i=t?u.current.querySelector(`[data-op="${t}"]`):c?null:r[r.length-1]??null,o=e.offsetTop;for(let t=i;t&&t!==e;t=t.offsetParent)o+=t.offsetTop;let s=i?.offsetHeight??0,l=S.current!==a;S.current=a,h(t=>{let n=t.k===1&&t.x===16?t:{x:16,y:t.y,k:1},r=n.y;return(l||!i)&&(r+=16-(r+e.offsetTop)),i&&(r+=hc(x.current.size,{top:r+o,height:s})),r===t.y&&n===t?t:{...n,y:r,animate:!0}})},[c?`${c.id}:${Math.round((n?.progress??0)*4)}`:`page:${a}`,a,g,f.width,f.height]);let ne=t.pages.map((e,t)=>t).filter(e=>!n||e<=a);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`div`,{ref:l,className:`aha-canvas`,"data-panning":y?`true`:void 0,onPointerDown:E,onPointerMove:D,onPointerUp:O,onPointerCancel:O,onDoubleClick:A,children:(0,i.jsxs)(`div`,{ref:u,className:`aha-canvasWorld`,style:{width:C,transform:`translate(${m.x}px, ${m.y}px) scale(${m.k})`,transition:m.animate?`transform .45s ease`:`none`},children:[ne.map(n=>(0,i.jsx)(wl,{index:n,page:t.pages[n],title:e.titles.get(n),board:e,signature:Cl(t.pages[n],e.titles.get(n),e),activeRef:n===a?d:null,label:s(`canvasPage`,{n:n+1})},n)),(0,i.jsx)(bl,{target:d,stage:u,scale:m.k,active:o})]})}),(0,i.jsxs)(`div`,{className:`aha-canvasBar`,role:`toolbar`,"aria-label":s(`canvasTools`),title:s(`canvasHelp`),children:[!g&&n?(0,i.jsx)(`button`,{type:`button`,className:`aha-canvasFollow`,onClick:()=>_(!0),children:s(`canvasFollow`)}):null,(0,i.jsx)(`button`,{type:`button`,"aria-label":s(`canvasZoomOut`),title:s(`canvasZoomOut`),onClick:()=>ee(1/dc),children:`−`}),(0,i.jsxs)(`button`,{type:`button`,className:`aha-canvasZoom`,title:s(`canvasZoomReset`),onClick:j,children:[Math.round(m.k*100),`%`]}),(0,i.jsx)(`button`,{type:`button`,"aria-label":s(`canvasZoomIn`),title:s(`canvasZoomIn`),onClick:()=>ee(dc),children:`+`}),(0,i.jsx)(`button`,{type:`button`,title:s(`canvasFit`),onClick:te,children:s(`canvasFitShort`)})]})]})}function Dl({steps:e,position:t,theme:n=`light`,font:a=`hand`,buffering:o=!1,bufferingLabel:s=``,view:c=`canvas`,onInteract:l}){let{t:u}=v(),d=(0,r.useMemo)(()=>ll(e),[e]),f=(0,r.useMemo)(()=>a===`hand`?dl(e):``,[e,a]);(0,r.useEffect)(()=>{if(!(!f||typeof document>`u`||!document.fonts?.load))for(let e of[`Aha Hand Latin`,`Aha Hand`])document.fonts.load(`20px '${e}'`,f).catch(()=>void 0)},[f]);let p=(0,r.useMemo)(()=>{let t=new Map;return e.forEach((e,n)=>e.ops.forEach((r,i)=>t.set(r.id,{stepIndex:n,opIndex:i,aside:e.aside===!0}))),t},[e]),m=(0,r.useMemo)(()=>{let t=new Map;for(let n of e)for(let e of n.ops)if(e.t===`title`){let n=d.where.get(e.id);n&&!t.has(n.page)&&t.set(n.page,e)}return t},[e,d]),h=t&&e[t.index]?.ops[t.op],g=h?d.where.get(h.id)?.page??0:t?kl(d,e,t):0,_=e=>{let n=p.get(e);return n?fl(n.stepIndex,n.opIndex,t):0},y=new Map;e.forEach(e=>e.ops.forEach(e=>{if(e.t!==`mark`)return;let t=_(e.id);if(t<=0)return;let n=y.get(e.ref)??[];n.push({id:e.id,style:e.style,reveal:t}),y.set(e.ref,n)}));let b={reveal:_,marks:y,nowIds:new Set(t?.now??[]),opMeta:p,activeOp:h,theme:n,titles:m,onInteract:l,fixedNote:e=>({label:u(`fixed`),title:u(`fixedWas`,{was:e.fixed.was})})},x=h&&t&&t.progress<1&&xl.has(h.t)?t:null;return(0,i.jsxs)(`div`,{className:`aha-board`,"data-theme":n,"data-font":a,"data-view":c===`pages`?`pages`:`canvas`,children:[(0,i.jsx)(c===`pages`?Tl:El,{board:b,layout:d,position:t,activePage:g,pencil:x}),o?(0,i.jsxs)(`div`,{className:`aha-buffering`,children:[(0,i.jsx)(`span`,{className:`aha-spinner`}),s]}):null]})}function Ol({steps:e,title:t=``,theme:n=`light`,font:a=`hand`,footer:o={},animationLabel:s=``,fixedLabel:c=``}){let l=(0,r.useMemo)(()=>ll(e),[e]),u=(0,r.useMemo)(()=>new Set(e.flatMap(e=>e.aside?e.ops.map(e=>e.id):[])),[e]),d=(0,r.useMemo)(()=>{let t=new Map;for(let n of e)for(let e of n.ops)e.t===`mark`&&t.set(e.ref,[...t.get(e.ref)??[],{id:e.id,style:e.style,reveal:1}]);return t},[e]),f=l.pages.filter(e=>e.columns.some(e=>e.length));return f.map((e,r)=>{let l=e.title||(r===0?t:``);return(0,i.jsxs)(`div`,{className:`aha-board aha-exportPage`,"data-theme":n,"data-font":a,"data-sheet":r,children:[l?(0,i.jsx)(`h2`,{className:`aha-boardTitle`,children:(0,i.jsx)(`span`,{children:(0,i.jsx)(pl,{text:l})})}):null,(0,i.jsx)(`div`,{className:`aha-cols`,children:e.columns.map((e,t)=>(0,i.jsx)(`div`,{className:`aha-colBody`,children:e.map(({op:e})=>(0,i.jsx)(yl,{op:e,reveal:1,marks:d.get(e.id)??[],aside:u.has(e.id),now:!1,theme:n,still:!0,animationLabel:s,fixedNote:c?()=>({label:c}):void 0},e.id))},t))}),(0,i.jsxs)(`div`,{className:`aha-exportFoot`,children:[(0,i.jsx)(`span`,{children:o.left??``}),(0,i.jsx)(`span`,{children:[o.right,`${r+1} / ${f.length}`].filter(Boolean).join(` · `)})]})]},r)})}function kl(e,t,n){let r=0;return t.forEach((t,i)=>t.ops.forEach((t,a)=>{fl(i,a,n)>0&&(r=Math.max(r,e.where.get(t.id)?.page??0))})),r}function Al({speech:e,onChange:t,onNarration:n,now:r=()=>performance.now(),frame:i,cancelFrame:a,startIndex:o=0}){let s=i??(e=>requestAnimationFrame(e)),c=a??(e=>cancelAnimationFrame(e)),l=[],u=!1,d=1,f=null,p=null,m=new Set,h={index:Math.max(0,o),op:0,progress:0,sentence:0,status:`idle`},g=()=>{if(!p?.synced||h.status!==`playing`&&h.status!==`paused`)return[];let e=Math.max(0,p.sentences.length-1);return p.step.ops.filter((t,n)=>n<=h.op&&Math.min(t.at,e)===h.sentence).map(e=>e.t===`mark`?e.ref:e.id)},_=()=>({...h,total:l.length,complete:u,rate:d,step:l[h.index]??null,now:g()}),v=()=>t?.(_());function y(){f!==null&&c(f),f=null}function b(){y(),e?.cancel?.();let t=l[h.index];if(!t){h.status=u?`ended`:`buffering`,v();return}h.op=0,h.progress=0,h.sentence=0,h.status=`playing`;let i=He(t,{rate:d}),a=ol(t.say).map(rl),o=!!t.say&&t.ops.some(e=>Number.isInteger(e.at));p={step:t,timing:i,startedAt:r(),elapsedBefore:0,speechDone:!t.say,silentUntil:null,token:{},sentences:a,exactSentence:!1,synced:o,written:0,lastTime:0,finishAt:null};let s=p.token;t.say&&((e?.speak(rl(t.say),{rate:d,sentences:a,onSentence:e=>{!p||p.token!==s||(p.exactSentence=!0,h.sentence!==e&&(h.sentence=e,v()))}})??{done:Promise.resolve({silent:!0})}).done.then(e=>{!p||p.token!==s||(e?.silent||e?.error?p.silentUntil=ze(t.say,d)*.8:p.speechDone=!0,n?.(e))}),e?.prefetch?.(rl(l[h.index+1]?.say??``))),v(),C()}function x(e){let t=p?.sentences??[];if(t.length<2)return 0;if(p.speechDone)return t.length-1;let n=ze(p.step.say,d),r=t.map(e=>[...e].length),i=r.reduce((e,t)=>e+t,0)||1,a=0;for(let t=0;t<r.length;t+=1)if(a+=r[t],e<a/i*n)return t;return t.length-1}function S(){return p?p.elapsedBefore+(h.status===`playing`?r()-p.startedAt:0):0}function C(){f=s(T)}function w(e,t,n){if(!p.synced)return e;let r=Math.max(0,e-p.lastTime);p.lastTime=e;let i=Math.max(0,p.sentences.length-1),a=p.speechDone?1/0:t,o=0,s=0;for(;o<n.length&&Math.min(p.step.ops[o].at,i)<=a;)s+=n[o],o+=1;return p.written=Math.min(p.written+r,s),p.written}function T(){if(f=null,h.status!==`playing`||!p)return;let e=S(),t=p.timing.writeMs;p.silentUntil!==null&&e>=p.silentUntil&&(p.speechDone=!0);let n=p.exactSentence?h.sentence:x(e),r=w(e,n,t),i=0,a=t.length,o=1;for(let e=0;e<t.length;e+=1){if(r<i+t[e]){a=e,o=t[e]?(r-i)/t[e]:1;break}i+=t[e]}let s=a!==h.op||Math.abs(o-h.progress)>.002||n!==h.sentence;if(h.op=a,h.sentence=n,h.progress=Math.min(1,Math.max(0,o)),a>=t.length&&p.speechDone&&(p.finishAt??=p.synced?e+450:i+450,e>=p.finishAt)){E();return}s&&v(),C()}function E(){let e=l[h.index];if(h.op=e?.ops.length??0,h.progress=1,e?.check&&!m.has(e.check.id)){h.status=`check`,v();return}D()}function D(){h.index+=1,b()}return{get state(){return _()},setSteps(e,{done:t=!1}={}){l=e,u=t,h.status===`buffering`&&l[h.index]?b():(h.status===`buffering`&&u&&(h.status=`ended`),v())},play(){if(h.status!==`playing`){if(h.status===`paused`&&p){h.status=`playing`,p.startedAt=r(),e?.resume?.(),v(),C();return}h.status===`ended`&&(h.index=0),h.status!==`check`&&b()}},pause(){h.status!==`playing`||!p||(p.elapsedBefore=S(),h.status=`paused`,y(),e?.pause?.(),v())},toggle(){h.status===`playing`?this.pause():this.play()},next(){let t=l[h.index];h.status===`check`&&t?.check&&m.add(t.check.id),t&&(y(),e?.cancel?.(),D())},prev(){y(),e?.cancel?.();let t=h.op===0&&h.progress<.05;h.index=Math.max(0,Math.min(l.length-1,t?h.index-1:h.index)),b()},seek(t){y(),e?.cancel?.(),h.index=Math.min(Math.max(0,t),Math.max(0,l.length)),b()},answer(e){m.add(e),h.status===`check`&&D()},setRate(t){let n=Math.min(2,Math.max(.5,Number(t)||1));if(p&&h.status===`playing`){let e=S(),t=d/n;p.elapsedBefore=e*t,p.startedAt=r(),p.timing=He(p.step,{rate:n}),p.written*=t,p.lastTime=p.elapsedBefore,p.finishAt=null}d=n,e?.setRate?.(n),v()},insertAfterCurrent(e){if(!e?.length)return l;let t=Math.min(l.length,h.index+1);return l=[...l.slice(0,t),...e,...l.slice(t)],v(),l},dispose(){y(),e?.cancel?.(),p=null}}}function jl(e,t,n,r=!1){if(!n)return[];if(!e.some(e=>Number.isInteger(e.goal)))return null;if(r)return Array(n).fill(`done`);let i=Array(n).fill(-1);e.forEach((e,t)=>{Number.isInteger(e.goal)&&e.goal<n&&(i[e.goal]=Math.max(i[e.goal],t))});let a=e[t]?.goal;return i.map((e,n)=>a===n?`current`:e>=0&&t>e?`done`:`todo`)}function Ml(e,t,n=[]){let r=[],i=e=>[`question`,`correction`,`challenge`].includes(e.kind)?e.kind:`reexplain`,a=new Set,o=e=>n.find(t=>e.startsWith(`${t.id}_`));e.forEach((e,n)=>{if(!(n>t)){if(e.aside){let t=o(e.id);t&&!a.has(t.id)&&(a.add(t.id),r.push({key:`${t.id}:ask`,kind:i(t),text:t.label,stepIndex:n,aside:!0}))}e.say&&r.push({key:e.id,kind:`say`,text:e.say,stepIndex:n,aside:e.aside===!0})}});for(let e of n)e.streaming&&!e.steps.length&&r.push({key:`${e.id}:ask`,kind:i(e),text:e.label,stepIndex:-1,aside:!0,pending:!0});return r}function Nl(e,t,n=null){let r=Math.min(t,e.length-1);for(;r>0&&e[r]?.aside;)--r;let i=e[r]?.id;return i?n&&e.findIndex(e=>e.id===n)>=r?n:i:n}let Pl=Object.freeze([{target:`.aha-stage`,title:`tourBoardTitle`,text:`tourBoard`},{target:`.aha-controls`,title:`tourControlsTitle`,text:`tourControls`},{target:`[data-tour=raise]`,title:`tourRaiseTitle`,text:`tourRaise`},{target:`[data-tour=reexplain]`,title:`tourReexplainTitle`,text:`tourReexplain`},{target:`[data-tour=challenge]`,title:`tourChallengeTitle`,text:`tourChallenge`},{target:`.aha-panel`,title:`tourPanelTitle`,text:`tourPanel`}]);function Fl(e,t,n){let r=(e,t)=>Math.max(8,Math.min(e,t-8)),i=r(e.x,n.width-t.width);return e.y+e.height+12+t.height<=n.height-8?{x:i,y:e.y+e.height+12,side:`below`}:e.y-12-t.height>=8?{x:i,y:e.y-12-t.height,side:`above`}:{x:r(e.x+e.width-t.width-12,n.width-t.width),y:r(e.y+e.height-t.height-12,n.height-t.height),side:`inside`}}function Il(e,t,n=6){let r=Math.max(0,e.x-n),i=Math.max(0,e.y-n);return{x:r,y:i,width:Math.min(t.width,e.x+e.width+n)-r,height:Math.min(t.height,e.y+e.height+n)-i}}function Ll({root:e,onDone:t}){let{t:n}=v(),[a,o]=(0,r.useState)(0),[s,c]=(0,r.useState)(null),l=(0,r.useRef)(null),[u]=(0,r.useState)(()=>Pl.filter(t=>e.current?.querySelector(t.target))),d=u[a];(0,r.useLayoutEffect)(()=>{let t=e.current;if(!t||!d)return;let n=()=>{let e=t.querySelector(d.target);if(!e)return;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),i={width:n.width,height:n.height},a=Il({x:r.left-n.left,y:r.top-n.top,width:r.width,height:r.height},i),o=l.current?.getBoundingClientRect(),s=Fl(a,{width:o?.width??320,height:o?.height??150},i);c({hole:a,place:s})};t.querySelector(d.target)?.scrollIntoView?.({block:`nearest`}),n();let r=requestAnimationFrame(n),i=typeof ResizeObserver==`function`?new ResizeObserver(n):null;return i?.observe(t),()=>{cancelAnimationFrame(r),i?.disconnect()}},[a,d]);let f=()=>a+1<u.length?o(a+1):t(),p=()=>o(Math.max(0,a-1));return(0,r.useEffect)(()=>{let e=e=>{if(e.key===`Escape`)t();else if(e.key===`ArrowRight`||e.key===`Enter`)f();else if(e.key===`ArrowLeft`)p();else if(e.key!==` `)return;e.preventDefault(),e.stopImmediatePropagation()};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)}),(0,r.useEffect)(()=>{d||t()},[d]),d?(0,i.jsxs)(`div`,{className:`aha-tour`,role:`dialog`,"aria-modal":`true`,"aria-label":n(`tourLabel`),children:[s?(0,i.jsx)(`div`,{className:`aha-tourHole`,style:{left:s.hole.x,top:s.hole.y,width:s.hole.width,height:s.hole.height}}):null,(0,i.jsxs)(`div`,{ref:l,className:`aha-tourCard`,"data-side":s?.place.side,style:s?{left:s.place.x,top:s.place.y}:{visibility:`hidden`},children:[(0,i.jsx)(`b`,{children:n(d.title)}),(0,i.jsx)(`p`,{children:n(d.text)}),(0,i.jsxs)(`div`,{className:`aha-tourActions`,children:[(0,i.jsxs)(`span`,{className:`aha-hint`,children:[a+1,` / `,u.length]}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,"data-size":`sm`,onClick:t,children:n(`tourSkip`)}),a>0?(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,onClick:p,children:n(`tourBack`)}):null,(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,"data-size":`sm`,autoFocus:!0,onClick:f,children:a+1<u.length?n(`tourNext`):n(`tourStart`)})]})]})]}):null}function Rl({label:e}){return(0,i.jsxs)(`span`,{className:`aha-row`,style:{gap:8},children:[(0,i.jsx)(`span`,{className:`aha-spinner`}),e?(0,i.jsx)(`span`,{className:`aha-hint`,children:e}):null]})}function zl({value:e}){return(0,i.jsx)(`div`,{className:`aha-progress`,children:(0,i.jsx)(`div`,{style:{width:`${Math.max(0,Math.min(100,e))}%`}})})}function Bl({progress:e,label:t,detail:n,onCancel:r}){let{t:a}=v(),o=e?.total?Math.round(e.done/e.total*100):0;return(0,i.jsxs)(`div`,{className:`aha-col`,style:{gap:6},children:[(0,i.jsx)(Rl,{label:t}),n?(0,i.jsx)(`span`,{className:`aha-hint`,children:n}):e?.total?(0,i.jsx)(zl,{value:o}):null,r?(0,i.jsxs)(`div`,{className:`aha-row`,children:[(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,"data-size":`sm`,onClick:r,children:a(`cancel`)}),(0,i.jsx)(`span`,{className:`aha-hint`,children:a(`keepsRunning`)})]}):null]})}function Vl({title:e,onClose:t,children:n,footer:r,width:a}){return(0,i.jsx)(`div`,{className:`aha-modalBack`,onMouseDown:e=>{e.target===e.currentTarget&&t?.()},children:(0,i.jsxs)(`div`,{className:`aha-modal`,role:`dialog`,"aria-label":e,style:a?{width:`min(${a}px,100%)`}:void 0,children:[e?(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsx)(`h3`,{className:`aha-cardTitle`,children:e}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,"data-size":`sm`,onClick:t,"aria-label":`close`,children:`✕`})]}):null,n,r?(0,i.jsx)(`div`,{className:`aha-row`,style:{justifyContent:`flex-end`},children:r}):null]})})}function Hl({text:e,onConfirm:t,onCancel:n,danger:r=!1}){let{t:a}=v();return(0,i.jsx)(Vl,{title:a(`confirm`),onClose:n,footer:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,onClick:n,children:a(`cancel`)}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":r?`danger`:`primary`,onClick:t,children:a(`confirm`)})]}),children:(0,i.jsx)(`p`,{children:e})})}function Ul(e,t){let n=String(t?.code??``).replace(/^aha-tutor\//u,``),r=`err_${n}`;return n&&e(r)!==r?e(r):e(`errorGeneric`,{message:t?.message??String(t)})}function Wl({error:e,style:t,reveal:n=!1}){let{t:a}=v(),o=(0,r.useRef)(null);return(0,r.useEffect)(()=>{n&&e&&o.current?.scrollIntoView?.({block:`nearest`})},[n,e]),e?(0,i.jsx)(`div`,{ref:o,className:`aha-error`,role:`alert`,style:t,title:e.message??void 0,children:Ul(a,e)}):null}function Gl({children:e}){return(0,i.jsx)(`div`,{className:`aha-empty`,children:e})}function Kl(){let{api:e}=v(),[t,n]=(0,r.useState)(null),[i,a]=(0,r.useState)(null),[o,s]=(0,r.useState)(null),[c,l]=(0,r.useState)(null);async function d(t){l(t?.job?.id??null);try{return await e.follow(t,{onProgress:s})}finally{l(null),s(null)}}async function f(t){try{let e=await fetch(new URL(`api/aha-tutor/upload?name=${encodeURIComponent(t.name)}`,document.baseURI),{method:`POST`,credentials:`same-origin`,headers:{"content-type":t.type||`application/octet-stream`},body:t});if(e.status!==404){let t=await e.json();if(!t?.ok)throw new u(t?.error?.code??`failed`,t?.error?.message??`Upload failed`);return(await d(t.value)).material}}catch(e){if(e?.message!==`Failed to fetch`)throw e}let n=await p(t);return(await d(await e.call(`material/upload`,{name:t.name,base64:n}))).material}async function m(e){let t=[];a(null);for(let r of e){n(r.name);try{t.push(await f(r))}catch(e){if(e?.code===`cancelled`)break;a(e)}}return n(null),t}async function h(t){n(t),a(null);try{return[(await d(await e.call(`material/url`,{url:t}))).material]}catch(e){return e?.code!==`cancelled`&&a(e),[]}finally{n(null)}}return{upload:m,addUrl:h,busy:t,error:i,progress:o,cancel:c?()=>e.cancel(c):null}}function ql(e,t,n){return n?.label===`recognizing`&&n.total?e(`readingPictures`,{done:n.done,total:n.total,name:t}):n?.label===`summarizing`?e(`summarizingMaterial`,{name:t}):`${e(`reading`)} ${t}`}function Jl({onAdded:e,compact:t=!1}){let{t:n}=v(),a=(0,r.useRef)(null),[o,s]=(0,r.useState)(``),[c,l]=(0,r.useState)(!1),{upload:u,addUrl:d,busy:f,error:p,progress:m,cancel:h}=Kl(),g=async t=>{let n=await u([...t]);n.length&&e?.(n)};return(0,i.jsxs)(`div`,{className:`aha-col`,children:[(0,i.jsxs)(`div`,{className:`aha-empty`,style:{padding:t?14:24,borderColor:c?`var(--aha-brand)`:void 0,cursor:`pointer`},onClick:()=>a.current?.click(),onDragOver:e=>{e.preventDefault(),l(!0)},onDragLeave:()=>l(!1),onDrop:e=>{e.preventDefault(),l(!1),g(e.dataTransfer.files)},children:[(0,i.jsxs)(`div`,{className:`aha-row`,style:{justifyContent:`center`},children:[(0,i.jsx)(ut,{name:`upload`}),n(`dropHere`)]}),(0,i.jsx)(`input`,{ref:a,type:`file`,multiple:!0,accept:`.pdf,.docx,.pptx,.md,.markdown,.txt,.csv,.json,.tex,.py,.js,.ts,.html,.png,.jpg,.jpeg,.webp,.gif`,hidden:!0,onChange:e=>{g(e.currentTarget.files),e.currentTarget.value=``}})]}),(0,i.jsxs)(`form`,{className:`aha-row`,onSubmit:async t=>{if(t.preventDefault(),!o.trim())return;let n=await d(o.trim());n.length&&(s(``),e?.(n))},children:[(0,i.jsx)(`input`,{className:`aha-input`,style:{flex:1},value:o,placeholder:n(`urlPlaceholder`),onChange:e=>s(e.currentTarget.value)}),(0,i.jsxs)(`button`,{type:`submit`,className:`aha-btn`,disabled:!o.trim()||!!f,children:[(0,i.jsx)(ut,{name:`link`}),n(`addUrl`)]})]}),f?(0,i.jsxs)(`div`,{className:`aha-row`,style:{gap:8},children:[(0,i.jsx)(Rl,{label:ql(n,f,m)}),h?(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,"data-kind":`ghost`,onClick:h,children:n(`cancel`)}):null]}):null,(0,i.jsx)(Wl,{error:p})]})}function Yl({selected:e,onChange:t,onClose:n,exclude:r=[],max:a=8}){let{api:o,t:s}=v(),c=y(()=>o.call(`material/list`),[]),l=n=>t(e.includes(n)?e.filter(e=>e!==n):[...e,n].slice(0,a));return(0,i.jsxs)(Vl,{title:s(`pickMaterials`),onClose:n,width:640,footer:(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,onClick:n,children:s(`confirm`)}),children:[(0,i.jsx)(Jl,{compact:!0,onAdded:n=>{c.reload(),t([...e,...n.map(e=>e.id)].slice(0,a))}}),c.loading&&!c.value?(0,i.jsx)(Rl,{label:s(`loading`)}):null,(0,i.jsx)(`div`,{className:`aha-col`,style:{gap:6,maxHeight:320,overflow:`auto`},children:(c.value??[]).filter(e=>!r.includes(e.id)).map(t=>(0,i.jsxs)(`label`,{className:`aha-option`,style:{flexDirection:`row`,alignItems:`center`,gap:10},children:[(0,i.jsx)(`input`,{type:`checkbox`,checked:e.includes(t.id),onChange:()=>l(t.id)}),(0,i.jsxs)(`span`,{className:`aha-col`,style:{gap:0},children:[(0,i.jsx)(`b`,{children:t.title}),(0,i.jsx)(`small`,{children:Xl(t,s)})]})]},t.id))})]})}function Xl(e,t){let n=[e.kind.toUpperCase()];e.pages&&n.push(t(`pages`,{count:e.pages})),e.slides&&n.push(t(`slides`,{count:e.slides}));let r=e.ocr?.read??0;return r&&e.kind===`image`?n.push(e.chars?t(`readPhoto`):t(`photoNoText`)):r?n.push(e.pages?t(`readScanPages`,{count:r}):t(`readPictures`,{count:r})):e.kind===`image`&&n.push(t(`imageNeedsVision`)),Zl(e,t).length&&n.push(t(`readPartly`)),n.join(` · `)}function Zl(e,t){let n=e.ocr;if(!n)return[];let r=[],i=!!e.pages;if(n.unread&&r.push(t(i?`unreadPages`:`unreadPictures`,{count:n.unread})),n.failed?.length){let a=[...new Set(n.failed.map(e=>e.page??e.slide??e.picture))].join(t(`listJoin`)),o=t(e.kind===`image`?`failedPhoto`:i?`failedPages`:e.slides?`failedSlides`:`failedPictures`,{list:a});r.push(n.reason?t(`failedWhy`,{what:o,reason:Ul(t,{code:n.reason})}):t(`failedRetry`,{what:o}))}return n.left&&r.push(t(i?`leftPages`:`leftPictures`,{count:n.left})),r}function Ql({sources:e}){return(0,i.jsx)(`ol`,{className:`aha-sourceList`,children:(e??[]).filter(e=>/^https?:\/\//iu.test(String(e?.url??``))).map(e=>(0,i.jsxs)(`li`,{children:[(0,i.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,children:e.title||e.url}),(0,i.jsxs)(`span`,{className:`aha-hint`,children:[` · `,new URL(e.url).hostname]}),e.snippet?(0,i.jsx)(`p`,{className:`aha-hint`,children:e.snippet}):null]},e.url))})}function $l({title:e,emoji:t}){return e?(0,i.jsxs)(`span`,{className:`aha-hint`,title:e,children:[` · `,t?`${t} `:``,ke(e)]}):null}function eu({value:e,stage:t,label:n}){let r=t===`none`?0:Math.round((Number(e)||0)/20),a=n?t===`none`?n:`${n} · ${Math.round(e??0)}%`:`${Math.round(e??0)}%`;return(0,i.jsx)(`span`,{className:`aha-meter`,title:a,"aria-label":a,role:`img`,"data-stage":t,children:[0,1,2,3,4].map(e=>(0,i.jsx)(`i`,{"data-on":e<r},e))})}function tu(e){return navigator.clipboard?.writeText(e).catch(()=>void 0)}let nu=Object.freeze([`choice`,`multi`,`blank`,`number`,`order`]),ru=/[!-~]/gu;function iu(e){return String(e??``).normalize(`NFKC`).replace(ru,e=>String.fromCharCode(e.charCodeAt(0)-65248)).toLowerCase().replace(/[\s ]+/gu,` `).replace(/^[\s.,;:!?'"`,。;:!?、“”‘’]+|[\s.,;:!?'"`,。;:!?、“”‘’]+$/gu,``).trim()}function au(e){if(typeof e==`number`)return e;let t=iu(e).replace(/,/gu,``).replace(/\s/gu,``),n=/^(-?\d+(?:\.\d+)?)\/(\d+(?:\.\d+)?)$/u.exec(t);if(n)return Number(n[1])/Number(n[2]);let r=/^(-?\d+(?:\.\d+)?)%$/u.exec(t);if(r)return Number(r[1])/100;let i=Number(t);return Number.isFinite(i)?i:NaN}function ou(e,t){if(!e||!nu.includes(e.kind))return{score:0,correct:!1,gradable:!1};if(e.kind===`choice`){let n=String(t??``)===String(e.answer??``);return{score:+!!n,correct:n,gradable:!0}}if(e.kind===`multi`){let n=new Set((Array.isArray(e.answer)?e.answer:[e.answer]).map(String)),r=new Set((Array.isArray(t)?t:[]).map(String));if(!n.size)return{score:0,correct:!1,gradable:!1};let i=0,a=0;for(let e of r)n.has(e)?i+=1:a+=1;let o=Math.max(0,(i-a)/n.size),s=i===n.size&&a===0;return{score:cu(o),correct:s,gradable:!0}}if(e.kind===`order`){let n=(Array.isArray(e.answer)?e.answer:[]).map(String),r=(Array.isArray(t)?t:[]).map(String);if(!n.length)return{score:0,correct:!1,gradable:!1};let i=0;return n.forEach((e,t)=>{r[t]===e&&(i+=1)}),{score:cu(i/n.length),correct:i===n.length,gradable:!0}}if(e.kind===`number`){let n=au(e.answer),r=au(t);if(!Number.isFinite(n))return{score:0,correct:!1,gradable:!1};if(!Number.isFinite(r))return{score:0,correct:!1,gradable:!0};let i=Number.isFinite(Number(e.tolerance))&&Number(e.tolerance)>=0?Number(e.tolerance):Math.max(1e-9,Math.abs(n)*.01),a=Math.abs(r-n)<=i;return{score:+!!a,correct:a,gradable:!0}}let n=(Array.isArray(e.answer)?e.answer:[e.answer]).map(iu).filter(Boolean);if(!n.length)return{score:0,correct:!1,gradable:!1};let r=iu(t),i=n.includes(r);if(i)return{score:1,correct:i,gradable:!0};let a=au(t),o=n.map(au).filter(Number.isFinite);return Number.isFinite(a)&&o.some(e=>Math.abs(e-a)<=Math.max(1e-9,Math.abs(e)*.001))?{score:1,correct:!0,gradable:!0}:{score:0,correct:!1,gradable:!0}}function su(e,t){return e.kind===`choice`?`chose ${String(t).toUpperCase()}: ${(e.options?.find(e=>e.id===t)?.text??``).slice(0,50)}`:e.kind===`number`||e.kind===`blank`?`answered ${String(t).slice(0,40)}`:`wrong`}function cu(e){return Math.round(e*100)/100}let lu=Object.freeze({wrong:`itemCheck_wrong`,unclear:`itemCheck_unclear`,misgraded:`itemCheck_misgraded`,right:`itemCheck_right`});function uu({courseId:e,lessonId:t,unitId:n,deckId:r}={},i){return i?.id?i.context?i.context.source??null:r?{kind:`deck`,deckId:r,itemId:i.id}:e&&n?{kind:`quiz`,courseId:e,unitId:n,itemId:i.id}:e&&t?{kind:`practice`,courseId:e,lessonId:t,itemId:i.id}:null:null}let du=(e,t=160)=>{let n=[...String(e??``).replace(/\s+/gu,` `).trim()];return n.length>t?`${n.slice(0,t).join(``)}…`:n.join(``)};function fu(e,t=e?.answer){return e.kind===`choice`?(t=>{let n=e.options?.find(e=>e.id===t);return n?`${t.toUpperCase()}. ${n.text}`:String(t??``).toUpperCase()})(t):e.kind===`multi`?(Array.isArray(t)?t:[]).map(e=>String(e).toUpperCase()).join(`, `):e.kind===`order`?(Array.isArray(t)?t:[]).map(t=>e.options?.find(e=>e.id===t)?.text??t).join(` → `):e.kind===`number`?`${t}${e.unit?` ${e.unit}`:``}`:e.kind===`blank`?(Array.isArray(t)?t:[t]).join(` / `):du(t)}function pu(e,t){let n=t?.fixed?.was;if(!n)return[];let r=[];n.prompt!==void 0&&r.push(e(`fixedPart_prompt`,{text:du(n.prompt)||`—`}));for(let[t,i]of Object.entries(n.options??{}))r.push(e(`fixedPart_option`,{id:t.toUpperCase(),text:du(i,80)}));if(n.answer!==void 0){let i=t.options?.map(e=>({...e,text:n.options?.[e.id]??e.text}));r.push(e(`fixedPart_answer`,{text:n.answer===null?`—`:fu({...t,options:i,unit:n.unit??t.unit},n.answer)}))}return n.unit!==void 0&&n.answer===void 0&&r.push(e(`fixedPart_unit`,{text:n.unit||`—`})),n.tolerance!==void 0&&r.push(e(`fixedPart_tolerance`,{text:n.tolerance??`—`})),n.explanation!==void 0&&r.push(e(`fixedPart_explanation`,{text:du(n.explanation)||`—`})),n.hints!==void 0&&r.push(e(`fixedPart_hints`,{text:du((n.hints??[]).join(` / `))||`—`})),n.rubric!==void 0&&r.push(e(`fixedPart_rubric`,{text:du((n.rubric??[]).join(` / `))||`—`})),n.figure&&r.push(e(`fixedPart_figure`)),r}function mu(e){return{score:Number(e?.score)||0,correct:e?.correct===!0,partial:e?.partial===!0,feedback:e?.feedback??``,wrongStep:e?.wrongStep??``,fix:e?.fix??``}}function hu(e,t,n){return{status:`done`,note:e?.note??``,verdict:t?.verdict??`right`,summary:t?.summary??``,explanation:t?.explanation??``,item:t?.item??e?.item??null,result:t?.result?{...n,...t.result,regraded:!0}:e?.result??null,earlier:(e?.earlier??0)+(Number(t?.earlier)||0)}}function gu(e,t,n){return e.map(e=>e.index===t?{...e,...n,index:t,regraded:!0}:e)}function _u(e,{index:t,verdict:n,regraded:r=!1,earlier:i=0,message:a}){return a===void 0?`${e(`itemCheckDone`,{n:t+1,verdict:e(lu[n]??lu.right)})}${r?e(`itemCheckRegraded`):``}${i?e(`itemCheckEarlier`,{count:i}):``}`:e(`itemCheckFailedNotice`,{n:t+1,message:a})}function vu({text:e,compact:t=!1,streaming:n=!1,className:o=``}){let{t:s}=v(),c=(0,r.useMemo)(()=>({code:{copyLabel:s(`copyCode`),copiedLabel:s(`copied`)},footnotes:s(`footnotes`)}),[s]);return(0,i.jsx)(`div`,{className:o?`aha-markdown ${o}`:`aha-markdown`,children:(0,i.jsx)(a.MarkdownText,{text:String(e??``),labels:c,streaming:n,variant:t?`compact`:`body`})})}let yu=16e3,bu={NotAllowedError:{code:`mic-denied`},SecurityError:{code:`mic-denied`},NotFoundError:{code:`mic-missing`},OverconstrainedError:{code:`mic-missing`},NotReadableError:{code:`mic-busy`},AbortError:{code:`mic-busy`}},xu={code:`mic-unsupported`},Su={code:`speech-audio`};function Cu({code:e,device:t}){return Object.assign(Error(e),{name:`RecordingError`,code:e},t?{device:t}:{})}function wu(){try{let e=JSON.parse(window.localStorage.getItem(`dsh.voice-input.microphone`)??`null`);if(typeof e?.id==`string`&&e.id&&typeof e.label==`string`)return{id:e.id,label:e.label.slice(0,120)}}catch{}return null}function Tu(e){let t=new Uint8Array(44+e.length*2),n=new DataView(t.buffer),r=(e,n)=>{for(let r=0;r<4;r+=1)t[e+r]=n.charCodeAt(r)};r(0,`RIFF`),n.setUint32(4,36+e.length*2,!0),r(8,`WAVE`),r(12,`fmt `),n.setUint32(16,16,!0),n.setUint16(20,1,!0),n.setUint16(22,1,!0),n.setUint32(24,yu,!0),n.setUint32(28,yu*2,!0),n.setUint16(32,2,!0),n.setUint16(34,16,!0),r(36,`data`),n.setUint32(40,e.length*2,!0);for(let t=0;t<e.length;t+=1){let r=Math.max(-1,Math.min(1,Number(e[t])||0));n.setInt16(44+t*2,Math.round(r<0?r*32768:r*32767),!0)}return t}async function Eu(e,t){let n=new(globalThis.AudioContext??globalThis.webkitAudioContext);try{let r=await n.decodeAudioData(await e.arrayBuffer()),i=Math.max(1,Math.floor(Math.min(r.duration,t)*yu)),a=new OfflineAudioContext(1,i,yu),o=a.createBufferSource();return o.buffer=r,o.connect(a.destination),o.start(),Tu((await a.startRendering()).getChannelData(0))}finally{n.close?.()?.catch?.(()=>void 0)}}function Du(e){let t=``;for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return btoa(t)}function Ou({maxSeconds:e=120,onLimit:t}={}){let n=null,r=null,i=[],a=null,o=0,s=!1,c=()=>{clearTimeout(a);for(let e of n?.getTracks?.()??[])e.stop();n=null};async function l(){if(!globalThis.navigator?.mediaDevices?.getUserMedia||typeof MediaRecorder!=`function`)throw Cu(xu);let l=wu();try{n=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,noiseSuppression:!0,...l?{deviceId:{exact:l.id}}:{}}})}catch(e){throw l&&(e?.name===`NotFoundError`||e?.name===`OverconstrainedError`)?Cu({code:`mic-chosen-missing`,device:l.label}):Cu(bu[e?.name]??xu)}if(s){c();return}i=[],r=new MediaRecorder(n),r.ondataavailable=e=>{e.data?.size&&i.push(e.data)},r.start(250),o=performance.now(),a=setTimeout(()=>t?.(),e*1e3)}function u(){return new Promise((t,n)=>{let a=r;if(r=null,!a||a.state===`inactive`){c(),n(Cu(Su));return}a.onstop=async()=>{c();try{t(await Eu(new Blob(i,{type:a.mimeType||`audio/webm`}),e))}catch{n(Cu(Su))}},a.stop()})}function d(){s=!0;let e=r;r=null,i=[],e&&e.state!==`inactive`&&(e.onstop=null,e.stop()),c()}return{start:l,stop:u,cancel:d,elapsed:()=>o?(performance.now()-o)/1e3:0}}function ku(e){for(let t=e?.parentElement;t;t=t.parentElement)if(getComputedStyle(t).overflowX!==`visible`)return t;return null}function Au(e){let t=ku(e);if(!t)return 0;e.style.width=``,e.style.transform=``;let n=t.getBoundingClientRect();e.style.width=`${Math.min(e.getBoundingClientRect().width,n.width-16)}px`;let r=e.getBoundingClientRect(),i=r.left<n.left+8?n.left+8-r.left:Math.min(0,n.right-8-r.right);return i&&(e.style.transform=`translateX(${Math.round(i)}px)`),i}function ju(e){Au(e);let t=ku(e);if(!t||typeof ResizeObserver!=`function`)return()=>void 0;let n=new ResizeObserver(()=>Au(e));return n.observe(t),()=>n.disconnect()}function Mu(e,{reducedMotion:t=Nu()}={}){let n=e?.closest?.(`.aha-main`);if(!n||n.scrollHeight<=n.clientHeight)return!1;let r=e.getBoundingClientRect().top-n.getBoundingClientRect().top-12;return Math.abs(r)<1?!1:(n.scrollTo({top:Math.max(0,n.scrollTop+r),behavior:t?`auto`:`smooth`}),!0)}function Nu(){return globalThis.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches===!0}let Pu=e=>(e?.key===`v`||e?.key===`V`)&&!e.ctrlKey&&!e.metaKey&&!e.altKey,Fu=e=>!!e?.isContentEditable||/^(input|textarea|select)$/iu.test(String(e?.tagName??``));function Iu(){let e=null,t=e=>e===`starting`||e===`recording`;return{down(n,r){return n===`idle`?(e=r,`start`):(e=null,t(n)?`stop`:null)},up(n,r){if(e===null)return null;let i=r-e;return e=null,i>=350&&t(n)?`stop`:null}}}async function Lu(e,t){try{let e=await fetch(new URL(`api/aha-tutor/speech`,document.baseURI),{method:`POST`,credentials:`same-origin`,headers:{"content-type":`audio/wav`},body:t});if(e.status!==404){let t=await e.json();if(!t?.ok)throw new u(t?.error?.code??`speech-failed`,t?.error?.message??`Speech recognition failed`);return t.value}}catch(e){if(e?.message!==`Failed to fetch`)throw e}return e.call(`speech/transcribe`,{base64:Du(t)})}let Ru=e=>`${Math.floor(e/60)}:${String(e%60).padStart(2,`0`)}`;function zu(e,t){return t?.code===`mic-chosen-missing`&&t.device?e(`micChosenMissing`,{name:t.device}):Ul(e,t)}let Bu=(0,r.forwardRef)(function({onText:e,onStart:t,disabled:n=!1,keyHint:a=``},o){let{api:s,t:c}=v(),[l,u]=(0,r.useState)(null),[d,f]=(0,r.useState)(`idle`),[p,m]=(0,r.useState)(0),[h,g]=(0,r.useState)(null),[_,y]=(0,r.useState)(()=>wu()?.label??``),b=(0,r.useRef)(null),x=(0,r.useRef)(null),S=(0,r.useRef)(null),C=(0,r.useRef)(`idle`),w=(0,r.useRef)(!1),T=(0,r.useRef)(null);T.current??=Iu();let E=e=>{C.current=e,f(e)};(0,r.useLayoutEffect)(()=>h&&x.current?ju(x.current):void 0,[h]);async function D(){let e;try{e=await s.call(`speech/status`)}catch{e={state:`off`}}return u(e),e}(0,r.useEffect)(()=>(D(),()=>b.current?.cancel()),[]),(0,r.useEffect)(()=>{if(d!==`recording`)return;let e=setInterval(()=>m(Math.floor(b.current?.elapsed()??0)),250);return()=>clearInterval(e)},[d]);async function O(){let t=b.current;if(t){b.current=null,E(`working`);try{let{text:n}=await Lu(s,await t.stop());e?.(n)}catch(e){g({text:Ul(c,e),error:!0}),/speech-(off|unprepared)$/u.test(String(e?.code??``))&&D()}finally{E(`idle`)}}}async function k(){g(null),w.current=!1,E(`starting`);let e=l?.state===`ready`?l:await D();if(e.state!==`ready`){E(`idle`),g({text:c(`voice_${e.state}`)});return}t?.();let n=Ou({maxSeconds:e.maxSeconds??120,onLimit:()=>{O()}});b.current=n,m(0);try{await n.start(),E(`recording`),w.current&&O()}catch(e){b.current=null,E(`idle`),g({text:zu(c,e),error:!0})}}function A(){C.current===`starting`?w.current=!0:C.current===`recording`&&O()}function ee(){C.current===`recording`?O():C.current===`idle`&&k()}(0,r.useImperativeHandle)(o,()=>({press(e){if(n&&C.current===`idle`)return;let t=T.current.down(C.current,e);t===`start`?(S.current?.scrollIntoView?.({block:`nearest`}),k()):t===`stop`&&A()},release(e){T.current.up(C.current,e)===`stop`&&A()}}));let te=l!==null&&l.state!==`ready`,j=d===`recording`,ne=j?c(`voiceStop`):te?c(`voiceSetup`):_?c(`voiceAskWith`,{name:_}):c(`voiceAsk`);return(0,i.jsxs)(`span`,{className:`aha-mic`,children:[(0,i.jsxs)(`button`,{ref:S,type:`button`,className:`aha-btn aha-micBtn`,"data-state":d,"data-unavailable":te?`true`:void 0,"aria-pressed":j,"aria-label":c(j?`voiceStop`:`voiceAsk`),title:a?`${ne}\n${a}`:ne,disabled:n&&d===`idle`||d===`starting`||d===`working`,onClick:ee,onPointerEnter:()=>y(wu()?.label??``),children:[d===`working`?(0,i.jsx)(`span`,{className:`aha-spinner`}):(0,i.jsx)(ut,{name:j?`stop`:`mic`,size:16}),j?(0,i.jsx)(`span`,{className:`aha-micTime`,children:Ru(p)}):d===`working`?(0,i.jsx)(`span`,{className:`aha-micTime`,children:c(`voiceWorking`)}):null]}),h?(0,i.jsxs)(`span`,{ref:x,className:`aha-micNote`,role:`status`,"data-error":h.error?`true`:void 0,children:[h.text,(0,i.jsx)(`button`,{type:`button`,className:`aha-micClose`,"aria-label":c(`close`),onClick:()=>g(null),children:`×`})]}):null]})}),Vu=[[`sure`,`confSure`],[`unsure`,`confUnsure`],[`guess`,`confGuess`]];function Hu({item:e,language:t,onResult:n,onContinue:a,continueLabel:o,askConfidence:s=!0,compact:c=!1,keyboard:l=!1,onChallenge:u,check:d=null}){let{api:f,t:p}=v(),m=d?.item??e,[h,g]=(0,r.useState)(m.kind===`multi`||m.kind===`order`?[]:``),[_,y]=(0,r.useState)(null),[b,x]=(0,r.useState)(0),[S,C]=(0,r.useState)(null),[w,T]=(0,r.useState)(!1),[E,D]=(0,r.useState)(null),[O,k]=(0,r.useState)(!1),[A,ee]=(0,r.useState)(null),te=(0,r.useRef)(Date.now()),j=S&&d?.result?d.result:S;(0,r.useEffect)(()=>{g(e.kind===`multi`||e.kind===`order`?e.kind===`order`?e.options.map(e=>e.id):[]:``),y(null),x(0),C(null),D(null),k(!1),ee(null),te.current=Date.now()},[e]);let ne=m.kind===`multi`?h.length>0:m.kind===`order`||String(h).trim()!==``,re=ne&&(!s||_);async function ie(){if(!re||j||w)return;let e=Date.now()-te.current,r;if(m.kind===`short`||m.kind===`work`){T(!0),D(null);try{let e=await f.call(`lesson/grade`,{item:{kind:m.kind,prompt:m.prompt,answer:m.answer,rubric:m.rubric},response:h,language:t});r={score:e.score,correct:e.verdict===`correct`,partial:e.verdict===`partial`,feedback:e.feedback,errorTag:e.errorTag,misconception:e.misconception},m.kind===`work`&&Object.assign(r,{wrongStep:e.wrongStep??``,why:e.why??``,fix:e.fix??``})}catch(e){D(e),T(!1);return}T(!1)}else{let e=ou(m,h);r={score:e.score,correct:e.correct,partial:!e.correct&&e.score>0,errorTag:e.correct?``:su(m,h)}}let i={...r,response:typeof h==`string`?h:void 0,given:h,confidence:_??void 0,timeMs:e,hintsUsed:b};C(i),n?.(i)}function ae(e){if(e?.preventDefault(),A===null)return;let t=A.trim();ee(null),u?.(t)}let oe=e=>g(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),se=(0,r.useRef)(null);se.current={result:j,ready:re,answered:ne,confidence:_,hints:b,submit:ie,toggle:oe,onContinue:a},(0,r.useEffect)(()=>{if(!l)return;let e=e=>{if(e.defaultPrevented||e.metaKey||e.ctrlKey||e.altKey||e.isComposing)return;let t=se.current,n=e.target,r=n instanceof HTMLElement&&(/^(input|textarea|select)$/iu.test(n.tagName)||n.isContentEditable);if(e.key===`Enter`){if(r)return;t.result?t.onContinue&&(e.preventDefault(),t.onContinue()):t.ready?(e.preventDefault(),t.submit()):t.answered&&s&&!t.confidence&&k(!0);return}if(!(r||t.result))if(/^[1-9]$/u.test(e.key)&&(m.kind===`choice`||m.kind===`multi`)){let n=m.options[Number(e.key)-1];if(!n)return;e.preventDefault(),m.kind===`multi`?t.toggle(n.id):g(n.id)}else(e.key===`h`||e.key===`H`)&&t.hints<(m.hints?.length??0)&&(e.preventDefault(),x(e=>e+1))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[l,m,s]);let ce=(e,t)=>g(n=>{let r=[...n],i=e+t;return i<0||i>=r.length?n:([r[e],r[i]]=[r[i],r[e]],r)}),le=e=>{if(j)return(Array.isArray(m.answer)?m.answer:[m.answer]).includes(e.id)?`right`:(Array.isArray(h)?h.includes(e.id):h===e.id)?`wrong`:void 0},ue=m.fixed?pu(p,m):[],de=ue.length?`${p(`fixedWasItem`)}\n${ue.join(`
|
|
268
268
|
`)}`:``;return(0,i.jsxs)(`div`,{className:`aha-col`,style:{gap:c?8:12},children:[m.fixed?(0,i.jsx)(`div`,{children:(0,i.jsxs)(`span`,{className:`aha-itemFixed`,tabIndex:0,title:de,"aria-label":`${p(`fixed`)}. ${de}`,children:[`✎ `,p(`fixed`)]})}):null,(0,i.jsx)(vu,{text:m.prompt,compact:!0,className:`aha-itemPrompt`}),m.svg?(0,i.jsx)(Uu,{svg:m.svg}):m.plot?(0,i.jsx)(Uu,{plot:m.plot}):null,m.kind===`multi`?(0,i.jsx)(`span`,{className:`aha-hint`,children:p(`pickSeveral`)}):null,m.kind===`choice`||m.kind===`multi`?(0,i.jsx)(`div`,{className:`aha-col aha-options`,style:{gap:6},"data-grid":m.options.every(e=>e.text.length<=22),children:m.options.map(e=>{let t=m.kind===`multi`?h.includes(e.id):h===e.id,n=le(e);return(0,i.jsx)(`button`,{type:`button`,className:`aha-option`,"data-active":t,disabled:!!j,style:n===`right`?{borderColor:`var(--aha-ok)`}:n===`wrong`?{borderColor:`var(--aha-bad)`}:void 0,onClick:()=>m.kind===`multi`?oe(e.id):g(e.id),children:(0,i.jsxs)(`span`,{className:`aha-row`,style:{gap:8,flexWrap:`nowrap`},children:[(0,i.jsxs)(`b`,{children:[e.id.toUpperCase(),`.`]}),(0,i.jsx)(vu,{text:e.text,compact:!0})]})},e.id)})}):null,m.kind===`order`?(0,i.jsx)(`div`,{className:`aha-col`,style:{gap:6},children:h.map((e,t)=>(0,i.jsxs)(`div`,{className:`aha-option`,style:{flexDirection:`row`,alignItems:`center`,gap:8},children:[(0,i.jsx)(`span`,{style:{flex:1},children:(0,i.jsx)(vu,{text:m.options.find(t=>t.id===e)?.text??e,compact:!0})}),j?null:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,"data-kind":`ghost`,onClick:()=>ce(t,-1),"aria-label":p(`moveUp`),children:`↑`}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,"data-kind":`ghost`,onClick:()=>ce(t,1),"aria-label":p(`moveDown`),children:`↓`})]})]},e))}):null,m.kind===`blank`||m.kind===`number`?(0,i.jsxs)(`div`,{className:`aha-row`,children:[(0,i.jsx)(`input`,{className:`aha-input`,style:{maxWidth:360},value:h,disabled:!!j,placeholder:p(`yourAnswer`),inputMode:m.kind===`number`?`decimal`:void 0,onChange:e=>g(e.currentTarget.value),onKeyDown:e=>{e.key===`Enter`&&ie()}}),m.unit?(0,i.jsx)(`span`,{className:`aha-hint`,children:m.unit}):null]}):null,m.kind===`short`?(0,i.jsx)(`textarea`,{className:`aha-textarea`,value:h,disabled:!!j,placeholder:p(`yourAnswer`),onChange:e=>g(e.currentTarget.value)}):null,m.kind===`work`?(0,i.jsxs)(`div`,{className:`aha-col`,style:{gap:6},children:[(0,i.jsx)(`textarea`,{className:`aha-textarea aha-work`,rows:6,value:h,disabled:!!j,placeholder:p(`workPlaceholder`),onChange:e=>g(e.currentTarget.value)}),!j&&/\$[^$\n]+\$/u.test(h)?(0,i.jsx)(`div`,{className:`aha-workPreview`,"aria-label":p(`workPreview`),children:h.split(`
|
|
269
|
-
`).filter(e=>e.trim()).map((e,t)=>(0,i.jsx)(vu,{text:e,compact:!0},t))}):null]}):null,m.hints?.length&&!j?(0,i.jsxs)(`div`,{className:`aha-col`,style:{gap:4},children:[m.hints.slice(0,b).map((e,t)=>(0,i.jsxs)(`div`,{className:`aha-hint`,children:[`💡 `,e]},t)),b<m.hints.length?(0,i.jsx)(`div`,{children:(0,i.jsxs)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,"data-kind":`ghost`,onClick:()=>x(e=>e+1),children:[p(`hint`),` (`,b+1,`/`,m.hints.length,`)`]})}):null]}):null,s&&!j?(0,i.jsxs)(`div`,{className:`aha-row aha-confidence`,style:{gap:6},"data-nudge":O&&!_?`true`:void 0,children:[(0,i.jsx)(`span`,{className:`aha-hint`,children:p(`confidence`)}),Vu.map(([e,t])=>(0,i.jsx)(`button`,{type:`button`,className:`aha-chip`,"data-active":_===e,onClick:()=>{y(e),k(!1)},children:p(t)},e))]}):null,(0,i.jsx)(Wl,{error:E}),j?(0,i.jsxs)(`div`,{className:`aha-feedback`,"data-ok":j.correct?`true`:j.partial?void 0:`false`,children:[(0,i.jsxs)(`b`,{children:[j.correct?p(`correct`):j.partial?p(`partial`):p(`incorrect`),j.regraded?p(`regraded`):``]}),j.feedback?(0,i.jsx)(vu,{text:j.feedback,compact:!0}):null,m.explanation?(0,i.jsx)(vu,{text:m.explanation,compact:!0}):null,j.wrongStep?(0,i.jsxs)(`div`,{className:`aha-wrongStep`,children:[(0,i.jsx)(`span`,{className:`aha-hint`,children:p(`wrongStep`)}),(0,i.jsx)(vu,{text:j.wrongStep,compact:!0}),j.fix?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`span`,{className:`aha-hint`,children:p(`fixedStep`)}),(0,i.jsx)(vu,{text:j.fix,compact:!0})]}):null]}):null,m.kind!==`short`&&m.kind!==`work`&&!j.correct?(0,i.jsx)(`div`,{className:`aha-hint`,children:Wu(m)}):null,u&&A===null&&d?.status!==`checking`?(0,i.jsxs)(`button`,{type:`button`,className:`aha-itemFlag`,onClick:()=>ee(``),children:[`🧐 `,p(`itemChallenge`)]}):null]}):null,j&&A!==null?(0,i.jsxs)(`form`,{className:`aha-challengeBox aha-itemChallenge`,onSubmit:ae,children:[(0,i.jsx)(`b`,{children:p(`itemChallengeTitle`)}),(0,i.jsx)(`textarea`,{className:`aha-textarea`,rows:2,autoFocus:!0,value:A,placeholder:p(`itemChallengePlaceholder`),onChange:e=>{let t=e.currentTarget.value;ee(e=>e===null?e:t)},onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&ae(e),e.key===`Escape`&&ee(null)}}),(0,i.jsxs)(`div`,{className:`aha-challengeActions`,children:[(0,i.jsx)(Bu,{onText:e=>ee(t=>t===null?t:t.trim()?`${t.trimEnd()} ${e}`:e)}),(0,i.jsx)(`span`,{className:`aha-challengeHint`,children:p(`itemChallengeHint`)}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,onClick:()=>ee(null),children:p(`cancel`)}),(0,i.jsx)(`button`,{type:`submit`,className:`aha-btn`,"data-kind":`primary`,children:p(`challengeSend`)})]})]}):null,j&&d?(0,i.jsxs)(`div`,{className:`aha-itemCheck`,"data-verdict":d.status===`done`?d.verdict:void 0,role:`status`,children:[(0,i.jsx)(`span`,{className:`aha-hint`,children:p(`itemCheckTitle`)}),d.status===`checking`?(0,i.jsxs)(`span`,{className:`aha-row`,style:{gap:6},children:[(0,i.jsx)(`span`,{className:`aha-spinner`}),p(`itemChecking`)]}):null,d.status===`done`?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`b`,{children:p(lu[d.verdict]??lu.right)}),d.summary?(0,i.jsx)(vu,{text:d.summary,compact:!0}):null,d.explanation?(0,i.jsx)(vu,{text:d.explanation,compact:!0}):null,d.earlier?(0,i.jsx)(`span`,{className:`aha-hint`,children:p(`itemCheckEarlier`,{count:d.earlier}).trim()}):null]}):null,d.status===`failed`?(0,i.jsxs)(`div`,{className:`aha-row`,style:{gap:6},children:[(0,i.jsx)(Wl,{error:d.error}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,onClick:()=>u?.(d.note??``),children:p(`retry`)})]}):null]}):null,(0,i.jsxs)(`div`,{className:`aha-row aha-itemActions`,children:[j?null:(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,disabled:!re||w,onClick:ie,children:w?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`span`,{className:`aha-spinner`}),p(`grading`)]}):p(`submit`)}),j&&a?(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,onClick:a,children:o??p(`continue`)}):null,!j&&a?(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,onClick:a,children:p(`skip`)}):null]})]})}function Uu({svg:e,plot:t}){let n=(0,r.useMemo)(()=>lc(t?nc(t):e),[e,t]);return n?(0,i.jsx)(`div`,{className:`aha-itemFigure`,dangerouslySetInnerHTML:{__html:n}}):null}function Wu(e){return e.kind===`choice`?`✔ ${e.answer.toUpperCase()}. ${e.options.find(t=>t.id===e.answer)?.text??``}`:e.kind===`multi`?`✔ ${e.answer.map(e=>e.toUpperCase()).join(`, `)}`:e.kind===`order`?`✔ ${e.answer.map(t=>e.options.find(e=>e.id===t)?.text??t).join(` → `)}`:e.kind===`number`?`✔ ${e.answer}${e.unit?` ${e.unit}`:``}`:e.kind===`blank`?`✔ ${e.answer.join(` / `)}`:``}let Gu=[[`thinking`,`prepThinking`],[`writing`,`prepWriting`]];function Ku(e){if(!((e?.thinking??0)>0))return null;let t=Gu.findIndex(([t])=>t===e.phase);return Gu.map(([e,n],r)=>({name:e,key:n,state:r<t?`done`:r===t?`now`:`next`}))}function qu({prep:e,label:t,first:n,hand:a=!0}){let{t:o}=v(),[s,c]=(0,r.useState)(()=>performance.now());(0,r.useEffect)(()=>{if(!n)return;let e=setInterval(()=>c(performance.now()),1e3);return()=>clearInterval(e)},[n]);let l=e.phase??`starting`,u=n?Ku(e):null,d=Math.max(0,Math.round(((e.elapsedMs??0)+s-(e.receivedAt??s))/1e3));return(0,i.jsxs)(`div`,{className:`aha-prep`,role:`status`,"aria-live":`polite`,children:[(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsxs)(`span`,{className:`aha-row`,style:{gap:8,flexWrap:`nowrap`},children:[(0,i.jsx)(`span`,{className:`aha-spinner`}),(0,i.jsx)(`b`,{children:t})]}),n?(0,i.jsx)(`span`,{className:`aha-hint`,children:o(`prepSeconds`,{seconds:d})}):null]}),u?(0,i.jsx)(`ol`,{className:`aha-prepStages`,children:u.map(e=>(0,i.jsx)(`li`,{"data-state":e.state,children:o(e.key)},e.name))}):null,(0,i.jsx)(`div`,{className:`aha-prepNow`,children:l===`writing`?(0,i.jsxs)(i.Fragment,{children:[o(`prepStep`,{n:(e.steps??0)+1}),e.current?(0,i.jsxs)(i.Fragment,{children:[`:`,(0,i.jsx)(`span`,{className:`aha-prepHint`,"data-hand":a?`true`:void 0,children:(0,i.jsx)(pl,{text:e.current})})]}):`…`]}):l===`thinking`?o(`prepThinkingDetail`,{chars:(e.thinking??0).toLocaleString()}):o(`prepStarting`)}),l===`writing`?(0,i.jsx)(`div`,{className:`aha-hint`,children:o(`prepCounts`,{steps:e.steps??0,chars:(e.chars??0).toLocaleString()})}):null]})}let Ju=[.75,1,1.25,1.5,2],Yu=[[`analogy`,`styleAnalogy`],[`visual`,`styleVisual`],[`example`,`styleExample`],[`simpler`,`styleSimpler`],[`deeper`,`styleDeeper`]];function Xu({id:e,kind:t,label:n,anchorId:r,steps:i=[],streaming:a=!1,serverId:o}){return{id:e,kind:t,label:n,anchorId:r,streaming:a,serverId:o,steps:ul(i,`${e}_`).map(e=>({...e,anchorId:r}))}}let Zu=e=>{let t=[...String(e??``).replace(/\s+/gu,` `).trim()];return t.length>28?`${t.slice(0,28).join(``)}…`:t.join(``)};function Qu({scope:e,title:t,crumb:n,steps:a=[],stream:o=null,asides:s=[],objectives:c=[],language:l,startIndex:u=0,autoplay:d=!0,onPosition:p,onEnded:m,onStreamDone:h,header:g,stageClass:_,recordChecks:y=!0,reveal:b,tour:x=!0,talkKey:T=!0}){let{api:E,t:D,speech:O,settings:k,dsh:A}=v(),ee=w(),te=k.boardTheme===`dark`||k.boardTheme!==`light`&&ee?`dark`:`light`,j=e=>D(Yu.find(([t])=>t===e)?.[1]??`reexplain`),ne=e=>e?D(`correctionOf`,{tag:e}):D(`correction`),re=(e,t)=>[e||D(`challengeLabel`),t?D(`challenge_${t}`):``].filter(Boolean).join(` · `),[ie,ae]=(0,r.useState)(a),[oe,se]=(0,r.useState)(()=>s.map(e=>Xu({id:e.id,kind:e.kind,label:e.kind===`question`?e.question:e.kind===`correction`?ne(e.errorTag):e.kind===`challenge`?re(e.note,e.verdict):D(`reexplainedAs`,{style:j(e.style)}),anchorId:e.anchorStepId,steps:e.steps??[],serverId:e.id}))),ce=(0,r.useRef)([]),[le,ue]=C(`classPanel`,!0),[de,fe]=C(`classTourSeen`,!1),[pe,me]=(0,r.useState)(!1),he=x&&!de,ge=(0,r.useRef)(null),_e=(0,r.useRef)(null),ve=(0,r.useRef)(null),ye=(0,r.useRef)(null),be=(0,r.useRef)(!1),xe=(0,r.useRef)(null),[Se,Ce]=(0,r.useState)(!o),[we,Te]=(0,r.useState)(null),[Ee,De]=(0,r.useState)(!0),[Oe,ke]=(0,r.useState)(!1),[Ae,je]=(0,r.useState)(null),Me=(0,r.useRef)({failures:0,down:!1}),[Ne,Pe]=(0,r.useState)(!1),[Fe,Ie]=(0,r.useState)(``),[Le,Re]=(0,r.useState)(null),[ze,Be]=(0,r.useState)(null),[Ve,He]=(0,r.useState)(null),Ue=(0,r.useRef)(new Set),[We,Ge]=(0,r.useState)(!1),[Ke,qe]=(0,r.useState)(null),[Je,Ye]=(0,r.useState)(null),Xe=(0,r.useRef)(0),Ze=(0,r.useRef)(null);Ze.current||=new AbortController,(0,r.useEffect)(()=>()=>Ze.current.abort(),[]),(0,r.useEffect)(()=>{Mu(ge.current)},[b]);let M=(0,r.useMemo)(()=>{let e=[];for(let t of ie){e.push(t);for(let n of oe)n.anchorId===t.id&&e.push(...n.steps)}return e},[ie,oe]),Qe=(0,r.useMemo)(()=>{let e=oe.find(e=>e.streaming),t=e?M.findIndex(t=>t.id===e.anchorId):-1;if(t<0)return null;let n=t+1;for(;n<M.length&&M[n].aside;)n+=1;return n},[M,oe]),$e=(0,r.useMemo)(()=>Qe===null?M:M.slice(0,Qe),[M,Qe]),et=(0,r.useRef)(null);et.current=e=>{if(Me.current.down)return;let t=tt(Me.current.failures,e);Me.current.failures=t.failures,t.stop&&(Me.current.down=!0,O.configure({engine:`off`}),je({engine:k.voiceEngine??`browser`,...t.stop,dismissed:!1}))};let N=(0,r.useMemo)(()=>{let e=ie[Math.min(u,ie.length-1)]?.id,t=e?M.findIndex(t=>t.id===e):-1;return Al({speech:O,onChange:Te,onNarration:e=>et.current(e),startIndex:t>=0?t:u})},[O]);(0,r.useEffect)(()=>()=>N.dispose(),[N]),(0,r.useEffect)(()=>{N.setSteps($e,{done:Se&&Qe===null})},[N,$e,Se,Qe]);let nt=Oe||Ae?`off`:k.voiceEngine??`browser`;(0,r.useEffect)(()=>{O.configure({engine:nt,voiceId:k.voiceId||void 0,language:l})},[O,nt,k.voiceId,l]),(0,r.useEffect)(()=>{N.setRate(k.voiceRate??1)},[N,k.voiceRate]);let[rt,it]=(0,r.useState)(null);(0,r.useEffect)(()=>{if(!o)return;let e=new AbortController;return Ce(!1),E.follow({job:o},{signal:e.signal,onPartial:e=>ae(t=>{let n=new Set(t.map(e=>e.id)),r=e.filter(e=>!n.has(e.id));return r.length?[...t,...r]:t}),onPreview:(e,t)=>it(e?.phase?{...e,elapsedMs:t?.elapsedMs??0,receivedAt:performance.now()}:null)}).then(e=>{let t=e?.board??e?.item?.board??e;t?.steps?.length&&ae(ce.current.length?bt(t.steps,ce.current).steps:t.steps),it(null),Ce(!0),h?.(e)}).catch(t=>{e.signal.aborted||(it(null),Ye(t),Ce(!0))}),()=>e.abort()},[o]);let at=(0,r.useRef)(!1);(0,r.useEffect)(()=>{!d||at.current||!M.length||he||(at.current=!0,N.play())},[M.length,d,N,he]),(0,r.useEffect)(()=>{he&&M.length&&me(!0)},[he,M.length>0]);let ot=()=>{me(!1),fe(!0)},st=we?.index??0,[lt,ut]=(0,r.useState)(null);(0,r.useEffect)(()=>{ut(e=>Nl(M,st,e))},[st,M]);let dt=Math.max(0,M.findIndex(e=>e.id===lt)),ft=we?.status===`ended`&&Se,pt=(0,r.useRef)(!1);(0,r.useEffect)(()=>{ft&&!pt.current&&(pt.current=!0,m?.()),ft||(pt.current=!1)},[ft]),(0,r.useEffect)(()=>{let e=e=>{Fu(e.target)||(e.key===` `?(e.preventDefault(),N.toggle()):e.key===`ArrowRight`?N.next():e.key===`ArrowLeft`?N.prev():T&&!pe&&Pu(e)&&!e.repeat&&(e.preventDefault(),ve.current?ve.current.press(e.timeStamp):(ye.current={down:e.timeStamp,up:null},ue(!0))))},t=e=>{!T||!Pu(e)||(ye.current?ye.current.up=e.timeStamp:ve.current?.release(e.timeStamp))};return window.addEventListener(`keydown`,e),window.addEventListener(`keyup`,t),()=>{window.removeEventListener(`keydown`,e),window.removeEventListener(`keyup`,t)}},[N,T,pe]),(0,r.useEffect)(()=>{let e=ye.current;!le||!e||!ve.current||(ye.current=null,ve.current.press(e.down),e.up!==null&&ve.current.release(e.up))},[le]);let mt=(0,r.useCallback)(e=>{for(let t=Math.min(e,M.length-1);t>=0;--t)if(!M[t]?.aside)return M[t]?.id;return ie[0]?.id},[M,ie]),ht=(0,r.useCallback)(e=>{let t=Math.max(0,Math.min(e,M.length-1)),n=M[t]?.aside?mt(t):M[t]?.id;return Math.max(0,ie.findIndex(e=>e.id===n))},[M,ie,mt]);(0,r.useEffect)(()=>{we&&p?.(ht(st))},[st]),(0,r.useEffect)(()=>{if(!Le)return;let e=$e.findIndex(e=>e.id===Le);if(e>=0){Re(null);let{index:t,status:n}=N.state;(t!==e||n!==`playing`)&&N.seek(e)}},[$e,Le,N]);async function gt({endpoint:t,payload:n,kind:r,label:i,anchorIndex:a,onStarted:s,onAdded:c,onFailed:l,onResult:u}){let d=mt(a);Xe.current+=1;let p=`a${Xe.current}`,m=Ze.current.signal,h=!1,g=e=>{let t=Xu({id:p,kind:r,label:i,anchorId:d,steps:e,streaming:!0});se(e=>e.map(e=>e.id===p?{...e,steps:t.steps}:e)),!h&&t.steps.length&&(h=!0,Pe(!1),Re(t.steps[0].id))},_=!1;Ye(null);try{let{job:l}=await E.call(t,{...n,scope:f(e,o),stepIndex:ht(a),anchorStepId:d});s?.(),se(e=>[...e,Xu({id:p,kind:r,label:i,anchorId:d,streaming:!0})]),_=!0,c?.(p);let h=[],v=await E.follow({job:l},{signal:m,onPartial:e=>{h.push(...e),g([...h])}});g(v?.steps?.length?v.steps:h),se(e=>e.map(e=>e.id===p?{...e,streaming:!1,serverId:v?.aside?.id}:e)),Pe(!1),u?.(v,p)}catch(e){if(m.aborted)return;se(e=>e.flatMap(e=>e.id===p?e.steps.length?[{...e,streaming:!1}]:[]:[e])),Pe(!1),r===`question`&&!h&&Ie(e=>e||i),_||l?.(),Ye(e)}}async function _t(e){e?.preventDefault();let t=Fe.trim();t&&(be.current&&_e.current?.blur(),be.current=!1,N.pause(),Pe(`answering`),await gt({endpoint:`lesson/ask`,payload:{question:t},kind:`question`,label:t,anchorIndex:st,onStarted:()=>Ie(``)}))}async function vt(e){Ge(!1),N.pause(),Pe(`reexplaining`),await gt({endpoint:`lesson/reexplain`,payload:{style:e},kind:`reexplain`,label:D(`reexplainedAs`,{style:j(e)}),anchorIndex:Math.max(0,Math.min(st,M.length-1))})}async function yt(e,t){Pe(`correcting`),await gt({endpoint:`lesson/correct`,payload:{item:{prompt:e.prompt,answer:e.answer},response:t.response,grade:{feedback:t.feedback,errorTag:t.errorTag,wrongStep:t.wrongStep,why:t.why,fix:t.fix}},kind:`correction`,label:ne(t.errorTag),anchorIndex:st,onAdded:t=>He({checkId:e.id,asideId:t}),onFailed:()=>N.answer(e.id)})}(0,r.useEffect)(()=>{!Ve||!oe.some(e=>e.id===Ve.asideId)||(He(null),N.answer(Ve.checkId))},[oe,Ve,N]);function St(e){N.pause(),Ge(!1),qe({index:Math.max(0,Math.min(e,M.length-1)),note:``})}function Ct(t){let n=M[t];if(!n?.aside)return n?{stepId:n.id}:null;let r=oe.find(e=>n.id.startsWith(`${e.id}_`));return!r||r.streaming?null:r.serverId&&e.kind===`lesson`?{stepId:n.id.slice(r.id.length+1),asideId:r.serverId}:{step:{id:n.id,say:n.say,ops:n.ops.map(({fixed:e,...t})=>t)}}}async function wt(e){if(e?.preventDefault(),!Ke)return;let t=Ct(Ke.index),n=Ke.note.trim();qe(null),t&&(N.pause(),Pe(`checking`),await gt({endpoint:`lesson/challenge`,payload:{target:t,note:n},kind:`challenge`,label:re(n),anchorIndex:st,onResult:(e,t)=>{se(r=>r.map(r=>r.id===t?{...r,label:re(n,e?.verdict)}:r));let r=Array.isArray(e?.fixes)?e.fixes:[];r.length&&(e.target?.main?(ce.current.push(...r),ae(e=>bt(e,r).steps)):e.target?.asideId?se(t=>t.map(t=>t.serverId===e.target.asideId?{...t,steps:bt(t.steps,xt(r,`${t.id}_`)).steps}:t)):se(e=>e.map(e=>({...e,steps:bt(e.steps,r).steps}))))}}))}function Tt(){N.pause(),ue(!0),setTimeout(()=>_e.current?.focus(),0)}let Et=ht(st),Dt=(0,r.useMemo)(()=>jl(ie,Et,c.length,we?.status===`ended`&&Se),[ie,Et,c.length,we?.status,Se]),Ot=(0,r.useMemo)(()=>Ml(M,Math.max(dt,st),oe),[M,dt,st,oe]);(0,r.useEffect)(()=>{let e=xe.current;e&&(e.scrollTop=e.scrollHeight)},[Ot.length,le]);let kt=we?.step,At=we?.status===`check`?kt?.check:null,jt=(0,r.useMemo)(()=>ol(kt?.say),[kt?.say]),Mt=jt[Math.min(we?.sentence??0,jt.length-1)]??``;function Nt(t){Be({checkId:At?.id,result:t}),!(!y||e.kind!==`lesson`)&&E.call(`lesson/record`,{courseId:e.courseId,lessonId:e.lessonId,conceptIds:At?.conceptIds??[],evidence:{kind:`check`,score:t.score,confidence:t.confidence,hintsUsed:t.hintsUsed,timeMs:t.timeMs,expectedMs:4e4,errorTag:t.errorTag},...kt?.id&&!kt.aside?{source:{kind:`check`,courseId:e.courseId,lessonId:e.lessonId,stepId:kt.id},response:t.given??t.response??``}:{}}).catch(()=>void 0)}let Pt=we?.status??`idle`,P=(Pt===`buffering`||!M.length&&!Se)&&!Je,Ft=M.length+ +!Se,It=oe.find(e=>e.streaming),Lt=Ne===`answering`||It?.kind===`question`?D(`answering`):Ne===`correcting`||It?.kind===`correction`?D(`correcting`):Ne===`checking`||It?.kind===`challenge`&&!It.steps.length?D(`checkingStep`):Ne===`reexplaining`||It?D(`generating`):M.length?D(`bufferingLesson`):D(`preparingLesson`),Rt=S(P&&!Ne&&!It&&!Se,3e3)&&!!rt,zt=Dt?Dt.filter(e=>e===`done`).length:0,Bt=!!It||!!Ne,Vt=At?.kind===`work`&&ze?.checkId===At.id&&!ze.result.correct&&!!ze.result.response?.trim();function Ht(){if(At){if(Vt){if(Ue.current.has(At.id))return;Ue.current.add(At.id),yt(At,ze.result);return}N.answer(At.id)}}function Ut({replay:e}){Me.current={failures:0,down:!1},je(null),ke(!1),O.configure({engine:k.voiceEngine??`browser`}),e&&(Pt===`playing`||Pt===`paused`)&&N.seek(st)}let Wt=Oe||!!Ae,Gt=!Ae||Ae.dismissed?null:Ae.engine===`cloud`?D(`voiceDownCloud`,{reason:Ul(D,Ae)}):D(`voiceDownSystem`,{reason:Ul(D,Ae)});return(0,i.jsxs)(`div`,{ref:ge,className:`aha-class`,"data-panel":le?`open`:`closed`,children:[(0,i.jsxs)(`div`,{className:`aha-classBar`,children:[(0,i.jsxs)(`div`,{className:`aha-col`,style:{gap:0},children:[n?(0,i.jsx)(`span`,{className:`aha-crumb`,children:n}):null,(0,i.jsx)(`span`,{className:`aha-cardTitle`,children:t})]}),(0,i.jsxs)(`div`,{className:`aha-row`,children:[x?(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,"data-size":`sm`,title:D(`tourReplay`),"aria-label":D(`tourReplay`),onClick:()=>{N.pause(),me(!0)},children:`?`}):null,typeof g==`function`?g({steps:M}):g]})]}),(0,i.jsxs)(`div`,{className:`aha-classBody`,children:[(0,i.jsxs)(`div`,{className:`aha-classMain`,children:[(0,i.jsxs)(`div`,{className:`aha-stage ${_??``}`,children:[(0,i.jsx)(Dl,{steps:M,position:we?{index:we.index,op:we.op,progress:we.progress,now:we.now}:{index:0,op:0,progress:0},theme:te,font:k.boardFont===`standard`?`standard`:`hand`,view:k.boardView===`pages`?`pages`:`canvas`,buffering:(P||!!Ne)&&!Rt,bufferingLabel:Lt,onInteract:()=>N.pause()}),Rt?(0,i.jsx)(qu,{prep:rt,label:Lt,first:!M.length,hand:k.boardFont!==`standard`}):null,At?(0,i.jsxs)(`div`,{className:`aha-checkCard`,children:[(0,i.jsx)(`div`,{className:`aha-spread`,children:(0,i.jsx)(`b`,{children:D(`checkTitle`)})}),(0,i.jsx)(Hu,{item:At,language:l,onResult:Nt,onContinue:Ht,continueLabel:Vt?D(`seeCorrection`):void 0,keyboard:!0})]}):null]}),Ee&&Mt?(0,i.jsx)(`div`,{className:`aha-caption`,children:(0,i.jsx)(pl,{text:Mt})}):(0,i.jsx)(`div`,{className:`aha-caption`}),(0,i.jsx)(Wl,{error:Je,style:{textAlign:`center`}}),Ke?(0,i.jsxs)(`form`,{className:`aha-challengeBox`,onSubmit:wt,children:[(0,i.jsx)(`b`,{children:Ke.index===st?D(`challengeTitle`):D(`challengeTitleStep`,{n:Ke.index+1,text:Zu(M[Ke.index]?.say)})}),(0,i.jsx)(`textarea`,{className:`aha-textarea`,rows:2,autoFocus:!0,value:Ke.note,placeholder:D(`challengePlaceholder`),onChange:e=>{let t=e.currentTarget.value;qe(e=>e&&{...e,note:t})},onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&wt(e),e.key===`Escape`&&qe(null)}}),(0,i.jsxs)(`div`,{className:`aha-challengeActions`,children:[(0,i.jsx)(Bu,{onStart:()=>N.pause(),onText:e=>qe(t=>t&&{...t,note:t.note.trim()?`${t.note.trimEnd()} ${e}`:e})}),(0,i.jsx)(`span`,{className:`aha-challengeHint`,children:D(`challengeHint`)}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,onClick:()=>qe(null),children:D(`cancel`)}),(0,i.jsx)(`button`,{type:`submit`,className:`aha-btn`,"data-kind":`primary`,disabled:!Ct(Ke.index),children:D(`challengeSend`)})]})]}):null,Gt?(0,i.jsxs)(`div`,{className:`aha-voiceNote`,role:`status`,children:[(0,i.jsxs)(`span`,{className:`aha-voiceNoteText`,children:[`🔇 `,Gt]}),(0,i.jsxs)(`span`,{className:`aha-voiceNoteActions`,children:[(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,onClick:()=>Ut({replay:!0}),children:D(`retry`)}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,"data-kind":`ghost`,onClick:()=>ct(A,`settings`),children:D(`openSettings`)}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,"data-kind":`ghost`,onClick:()=>je(e=>e&&{...e,dismissed:!0}),title:D(`close`),"aria-label":D(`close`),children:`×`})]})]}):null,(0,i.jsxs)(`div`,{className:`aha-controls`,children:[(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,onClick:()=>N.prev(),title:D(`prevStep`),"aria-label":D(`prevStep`),children:`⏮`}),(0,i.jsxs)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,onClick:()=>N.toggle(),disabled:!M.length,"aria-label":D(Pt===`playing`?`pause`:`play`),children:[Pt===`playing`?`⏸`:`▶`,` `,D(Pt===`playing`?`pause`:`play`)]}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,onClick:()=>N.next(),title:D(`nextStep`),"aria-label":D(`nextStep`),children:`⏭`}),(0,i.jsx)(`span`,{className:`aha-tag`,children:D(`stepOf`,{current:Math.min(st+1,Math.max(1,M.length)),total:Math.max(Ft,1)})}),(0,i.jsx)(`select`,{className:`aha-select`,style:{width:`auto`},value:we?.rate??1,onChange:e=>N.setRate(Number(e.currentTarget.value)),"aria-label":D(`speed`),children:Ju.map(e=>(0,i.jsxs)(`option`,{value:e,children:[e,`×`]},e))}),(0,i.jsx)(`button`,{type:`button`,className:`aha-chip`,"data-active":!Wt,onClick:()=>Ae?Ut({replay:!1}):ke(e=>!e),children:Wt?`🔇 ${D(`voiceOff`)}`:`🔊 ${D(`voiceOn`)}`}),(0,i.jsxs)(`button`,{type:`button`,className:`aha-chip`,"data-active":Ee,onClick:()=>De(e=>!e),children:[`CC `,D(`captions`)]}),(0,i.jsxs)(`button`,{type:`button`,className:`aha-chip`,"data-tour":`raise`,onClick:Tt,disabled:!M.length,title:T?D(`raiseHandKey`):void 0,children:[`✋ `,D(`raiseHand`)]}),(0,i.jsxs)(`span`,{style:{position:`relative`},children:[(0,i.jsxs)(`button`,{type:`button`,className:`aha-chip`,"data-tour":`reexplain`,onClick:()=>Ge(e=>!e),disabled:!M.length,children:[`🔄 `,D(`reexplain`)]}),We?(0,i.jsx)(`div`,{className:`aha-card`,style:{position:`absolute`,bottom:`110%`,left:0,zIndex:10,padding:6,gap:2,minWidth:140},children:Yu.map(([e,t])=>(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,style:{justifyContent:`flex-start`},onClick:()=>vt(e),children:D(t)},e))}):null]}),(0,i.jsxs)(`button`,{type:`button`,className:`aha-chip`,"data-tour":`challenge`,"aria-expanded":!!Ke,onClick:()=>Ke?qe(null):St(st),disabled:!M.length||Bt,children:[`🧐 `,D(`challenge`)]}),le?null:(0,i.jsxs)(`button`,{type:`button`,className:`aha-chip`,"aria-expanded":!1,onClick:()=>ue(!0),children:[`📋 `,D(`showPanel`)]})]})]}),le?(0,i.jsxs)(`aside`,{className:`aha-panel`,"aria-label":D(`panelTitle`),children:[(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsx)(`b`,{children:c.length?D(`lessonGoals`):D(`transcript`)}),(0,i.jsxs)(`span`,{className:`aha-row`,style:{gap:6},children:[c.length&&Dt?(0,i.jsxs)(`span`,{className:`aha-tag`,children:[zt,`/`,c.length]}):null,(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,"data-size":`sm`,onClick:()=>ue(!1),title:D(`hidePanel`),"aria-label":D(`hidePanel`),children:`›`})]})]}),c.length?(0,i.jsx)(`ol`,{className:`aha-goals`,children:c.map((e,t)=>(0,i.jsxs)(`li`,{"data-state":Dt?.[t]??`plain`,children:[(0,i.jsx)(`span`,{className:`aha-goalMark`,"aria-hidden":`true`,children:Dt?.[t]===`done`?`✓`:t+1}),(0,i.jsx)(`span`,{children:e})]},t))}):null,c.length?(0,i.jsx)(`b`,{className:`aha-panelHead`,children:D(`transcript`)}):null,(0,i.jsx)(`div`,{ref:xe,className:`aha-transcript`,role:`list`,children:Ot.map(e=>(0,i.jsxs)(`div`,{role:`listitem`,className:`aha-lineRow`,"data-aside":e.aside?`true`:void 0,children:[(0,i.jsxs)(`button`,{type:`button`,className:`aha-line`,"data-kind":e.kind,"data-current":e.stepIndex===st?`true`:void 0,disabled:e.stepIndex<0,onClick:()=>N.seek(e.stepIndex),children:[e.kind===`question`?(0,i.jsx)(`span`,{className:`aha-lineTag`,children:`✋`}):e.kind===`reexplain`?(0,i.jsx)(`span`,{className:`aha-lineTag`,children:`🔄`}):e.kind===`correction`?(0,i.jsx)(`span`,{className:`aha-lineTag`,children:`✏️`}):e.kind===`challenge`?(0,i.jsx)(`span`,{className:`aha-lineTag`,children:`🧐`}):null,(0,i.jsx)(`span`,{className:`aha-lineText`,children:(0,i.jsx)(pl,{text:e.text})}),e.pending?(0,i.jsx)(Rl,{}):null]}),e.kind===`say`&&e.stepIndex>=0&&!Bt?(0,i.jsx)(`button`,{type:`button`,className:`aha-lineFlag`,title:D(`challenge`),"aria-label":D(`challengeStep`,{n:e.stepIndex+1}),onClick:()=>St(e.stepIndex),children:D(`challengeLine`)}):null]},e.key))}),(0,i.jsxs)(`form`,{className:`aha-askBox`,onSubmit:_t,children:[(0,i.jsx)(`textarea`,{ref:_e,className:`aha-textarea`,rows:2,value:Fe,placeholder:D(`askPlaceholder`),disabled:!M.length,onChange:e=>Ie(e.currentTarget.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing?_t(e):e.key===`Escape`&&e.currentTarget.blur()}}),(0,i.jsxs)(`div`,{className:`aha-askActions`,children:[(0,i.jsx)(Bu,{ref:ve,disabled:!M.length,keyHint:T?D(`talkKeyHint`):``,onStart:()=>N.pause(),onText:e=>{be.current=!0,Ie(t=>t.trim()?`${t.trimEnd()} ${e}`:e),_e.current?.focus()}}),(0,i.jsx)(`button`,{type:`submit`,className:`aha-btn`,"data-kind":`primary`,disabled:!Fe.trim()||Bt,children:D(`ask`)})]})]})]}):null]}),pe?(0,i.jsx)(Ll,{root:ge,onDone:ot}):null]})}let $u=[[`explain`,`modeExplain`,`💡`],[`solve`,`modeSolve`,`🧮`],[`visualize`,`modeVisualize`,`📈`]];function ed({draftMode:e,draftRequest:t,draftMaterials:n,token:a}){let{api:o,t:s}=v(),c=y(()=>o.call(`items/list`,{kind:`assist`}),[]),[l,u]=(0,r.useState)($u.some(([t])=>t===e)?e:`explain`),[d,f]=(0,r.useState)(t??``),[p,m]=(0,r.useState)(Array.isArray(n)?n:[]),[h,g]=(0,r.useState)(!1),[_,b]=(0,r.useState)(null),[S,C]=(0,r.useState)(null),w=x(a);async function T(e=d){let t=e.trim();if(!t)return;C(null);let n=_?.threadId??E(`thd`);_?.stream&&!_.done&&o.cancel(_.stream);try{let{job:e}=await o.call(`assist/ask`,{mode:l,request:t,materialIds:p,threadId:_?.threadId,newThreadId:_?.threadId?void 0:n});b(r=>({threadId:n,turn:r?r.turn+1:0,stream:e,done:!1,steps:[],title:t.slice(0,80),language:void 0,key:`${n}:${Date.now()}`})),f(``)}catch(e){C(e)}}(0,r.useEffect)(()=>{w&&t&&T(t)},[]);async function D(e){C(null);try{let{item:t}=await o.call(`items/get`,{kind:`assist`,id:e}),n=t.turns.length-1;b({threadId:t.id,turn:n,stream:null,steps:t.turns[n]?.board?.steps??[],title:t.turns[n]?.request??t.title,language:t.language,key:`${t.id}:${n}:open`,opened:Date.now()})}catch(e){C(e)}}return(0,i.jsxs)(`div`,{className:`aha-page`,"data-wide":`true`,children:[(0,i.jsxs)(`div`,{className:`aha-split`,children:[(0,i.jsxs)(`div`,{className:`aha-col`,style:{minHeight:0},children:[_?(0,i.jsx)(Qu,{scope:{kind:`thread`,id:_.threadId,turn:_.turn},title:_.title,steps:_.steps,stream:_.stream,language:_.language,recordChecks:!1,reveal:_.opened,onStreamDone:e=>{b(t=>t?.stream?.id===_.stream?.id?{...t,done:!0,turn:Number.isInteger(e?.turn)?e.turn:t.turn}:t),c.reload()}},_.key):(0,i.jsxs)(`div`,{className:`aha-col`,style:{gap:4},children:[(0,i.jsx)(`h2`,{className:`aha-title`,children:s(`assistTitle`)}),(0,i.jsx)(`p`,{className:`aha-hint`,children:s(`assistHint`)})]}),(0,i.jsxs)(`div`,{className:`aha-composer`,children:[(0,i.jsx)(`div`,{className:`aha-row`,style:{gap:6},children:$u.map(([e,t,n])=>(0,i.jsxs)(`button`,{type:`button`,className:`aha-chip`,"data-active":l===e,onClick:()=>u(e),children:[n,` `,s(t)]},e))}),(0,i.jsx)(`textarea`,{value:d,placeholder:s(_?`followUp`:`assistPlaceholder`),onChange:e=>f(e.currentTarget.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&T()}}),(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,onClick:()=>g(!0),children:p.length?s(`attached`,{count:p.length}):s(`attach`)}),(0,i.jsxs)(`div`,{className:`aha-row`,children:[_?(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,onClick:()=>b(null),children:s(`newThread`)}):null,(0,i.jsx)(Bu,{onText:e=>f(t=>t.trim()?`${t.trimEnd()} ${e}`:e)}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,disabled:!d.trim(),onClick:()=>T(),children:s(`ask`)})]})]})]}),(0,i.jsx)(Wl,{error:S})]}),(0,i.jsxs)(`aside`,{className:`aha-col`,style:{minHeight:0,overflow:`auto`},children:[(0,i.jsx)(`h3`,{className:`aha-cardTitle`,children:s(`history`)}),c.loading&&!c.value?(0,i.jsx)(Rl,{}):(c.value??[]).map(e=>(0,i.jsxs)(`button`,{type:`button`,className:`aha-option`,onClick:()=>D(e.id),children:[(0,i.jsx)(`b`,{children:e.title}),(0,i.jsx)(`small`,{children:new Date(e.updatedAt).toLocaleString()})]},e.id))]})]}),h?(0,i.jsx)(Yl,{selected:p,onChange:m,onClose:()=>g(!1)}):null]})}Object.freeze({pInit:.2,pTransit:.15,pSlip:.1,pGuess:.2}),Object.freeze([{id:`struggling`,min:0},{id:`learning`,min:.4},{id:`proficient`,min:.7},{id:`mastered`,min:.9}]);let td=(e,t,n)=>Math.min(n,Math.max(t,e));function nd(e){return Math.round(td(Number(e?.pKnown)||0,0,1)*100)}Object.freeze([`none`,`weak`,`learning`,`proficient`,`mastered`]);function rd(e){return!e||!e.attempts&&!e.history?.length?`none`:id(nd(e))}function id(e){let t=Number(e);return Number.isFinite(t)?t>=90?`mastered`:t>=70?`proficient`:t>=40?`learning`:`weak`:`none`}let ad=Object.freeze({none:`stageNone`,weak:`stageWeak`,learning:`stageLearning`,proficient:`stageProficient`,mastered:`stageMastered`});function od(e){let t=e.filter(Boolean),n=t.length?t.reduce((e,t)=>e+(Number(t.score)||0),0)/t.length:0,r=0,i=0;for(let e of t)r=e.correct?r+1:0,i=Math.max(i,r);return{answered:t.length,correct:t.filter(e=>e.correct).length,accuracy:n,stars:n>=.9?3:n>=.6?2:1,streak:r,bestStreak:i}}function sd(e,{lessonId:t,unitId:n,nextLessonId:r}={}){let i=e?.action;return i===`remediate`?t?{kind:`relearn`,lessonId:t}:{kind:`review`}:i===`review`?{kind:`review`}:i===`challenge`&&n?{kind:`quiz`,unitId:n}:r?{kind:`next`,lessonId:r}:{kind:`course`}}function cd(e,t){let n=(e.concepts??[]).map(e=>t?.concepts?.[e.id]);if(!n.some(e=>rd(e)!==`none`))return{stage:`none`,percent:0};let r=Math.round(n.reduce((e,t)=>e+nd(t??{pKnown:.2}),0)/n.length);return{stage:id(r),percent:r}}function ld(e,t,{now:n=Date.now()}={}){let r=Ne(e),i=Object.entries(t?.reviews??{}).filter(([e,t])=>r.has(e)&&Date.parse(t?.dueAt)<=n).length;if(i)return{kind:`review`,count:i};let a=[...r.values()].map(e=>({concept:e,state:t?.concepts?.[e.id]})).filter(e=>rd(e.state)===`weak`).sort((e,t)=>e.state.pKnown-t.state.pKnown)[0];if(a)return{kind:`practice`,lessonId:a.concept.lessonId,concept:a.concept.name};let o=Ie(e,t);return o?{kind:`lesson`,lessonId:o.lesson.id,title:o.lesson.title}:{kind:`done`,unitId:e.units?.at(-1)?.id??null}}let ud=[[`outline`,`tabOutline`],[`practice`,`tabPractice`],[`sheets`,`tabSheets`],[`cards`,`tabCards`],[`projects`,`tabProjects`],[`progress`,`tabProgress`]];function dd({courseId:e,tab:t=`outline`}){let{api:n,t:a,navigate:o,toast:s}=v(),c=y(()=>n.call(`course/get`,{courseId:e}),[e]),[l,u]=(0,r.useState)(t),[d,f]=(0,r.useState)(!1),[p,m]=(0,r.useState)(!1),[g,_]=(0,r.useState)(!1),b=c.value?.course,x=c.value?.progress,S=(0,r.useMemo)(()=>b?.units?Fe(b,x):null,[b,x]),C=(0,r.useMemo)(()=>b?.units?Ie(b,x):null,[b,x]),w=(0,r.useMemo)(()=>b?.units?ld(b,x):null,[b,x]);if(c.loading&&!c.value)return(0,i.jsx)(`div`,{className:`aha-page`,children:(0,i.jsx)(Rl,{label:a(`loading`)})});if(!b)return(0,i.jsx)(`div`,{className:`aha-page`,children:(0,i.jsx)(Wl,{error:c.error})});if(b.status!==`ready`)return o(`craft`,{courseId:e},{replace:!0}),null;let T=e=>nd(x?.concepts?.[e]??{pKnown:.2}),E=e=>x?.lessons?.[e]?.status??`new`;async function D(t){m(!1);try{let r=await n.call(`course/export`,{courseId:e,includeProgress:t});h(r.fileName,r.json)}catch(e){s(Ul(a,e))}}return(0,i.jsxs)(`div`,{className:`aha-page`,children:[(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsxs)(`div`,{className:`aha-col`,style:{gap:4,flex:1,minWidth:260},children:[(0,i.jsxs)(`div`,{className:`aha-row`,style:{flexWrap:`nowrap`},children:[(0,i.jsx)(`span`,{style:{fontSize:30},children:b.emoji}),(0,i.jsx)(`h2`,{className:`aha-title`,children:b.title})]}),b.subtitle?(0,i.jsx)(`p`,{className:`aha-subtitle`,children:b.subtitle}):null,S?(0,i.jsxs)(`div`,{className:`aha-col`,style:{gap:4,maxWidth:480},children:[(0,i.jsx)(zl,{value:S.percent}),(0,i.jsxs)(`span`,{className:`aha-hint`,children:[a(`lessonsCount`,S),` · `,a(`minutesLeft`,{minutes:S.minutesLeft})]})]}):null]}),(0,i.jsxs)(`div`,{className:`aha-row`,style:{position:`relative`},children:[C?(0,i.jsxs)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,onClick:()=>o(`lesson`,{courseId:e,lessonId:C.lesson.id}),children:[(0,i.jsx)(ut,{name:`play`,size:14}),a(`continueLearning`)]}):null,(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,onClick:()=>f(e=>!e),children:`⋯`}),d?(0,i.jsxs)(`div`,{className:`aha-card`,style:{position:`absolute`,right:0,top:`110%`,zIndex:20,padding:6,gap:2,minWidth:180},onMouseLeave:()=>f(!1),children:[(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,style:{justifyContent:`flex-start`},onClick:()=>{f(!1),o(`craft`,{courseId:e,edit:!0})},children:a(`editOutline`)}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,style:{justifyContent:`flex-start`},onClick:()=>{f(!1),o(`craft`,{courseId:e,edit:!0,add:!0})},children:a(`addMaterials`)}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,style:{justifyContent:`flex-start`},onClick:()=>{f(!1),m(!0)},children:a(`exportPack`)}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,style:{justifyContent:`flex-start`},onClick:async()=>{f(!1),await n.call(`course/update`,{courseId:e,archived:!b.archived}),c.reload()},children:b.archived?a(`unarchive`):a(`archive`)}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,style:{justifyContent:`flex-start`,color:`var(--aha-bad)`},onClick:()=>{f(!1),_(!0)},children:a(`deleteCourse`)})]}):null]})]}),w?(0,i.jsx)(fd,{step:w,courseId:e}):null,(0,i.jsx)(`div`,{className:`aha-tabs`,children:ud.map(([e,t])=>(0,i.jsx)(`button`,{type:`button`,className:`aha-tab`,"data-active":l===e,onClick:()=>u(e),children:a(t)},e))}),l===`outline`?(0,i.jsx)(`div`,{className:`aha-tree`,children:b.units.map((t,n)=>(0,i.jsxs)(`div`,{className:`aha-unit`,children:[(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsxs)(`b`,{children:[a(`unitN`,{n:n+1}),` · `,t.title]}),(0,i.jsxs)(`span`,{className:`aha-row`,style:{gap:4},children:[(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,"data-kind":`ghost`,onClick:()=>o(`sheet`,{courseId:e,unitId:t.id}),children:a(`unitSheet`)}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,"data-kind":`ghost`,onClick:()=>o(`practice`,{courseId:e,unitId:t.id}),children:a(`unitQuiz`)})]})]}),t.summary?(0,i.jsx)(`p`,{className:`aha-hint`,children:t.summary}):null,t.lectures.map((t,n)=>(0,i.jsxs)(`div`,{className:`aha-lecture`,children:[(0,i.jsxs)(`div`,{className:`aha-hint`,style:{fontWeight:600},children:[a(`lectureN`,{n:n+1}),` · `,t.title]}),t.lessons.map(t=>(0,i.jsxs)(`div`,{className:`aha-lesson`,children:[(0,i.jsx)(`span`,{className:`aha-dot`,"data-state":E(t.id)}),(0,i.jsx)(`span`,{style:{flex:1,cursor:`pointer`},onClick:()=>o(`lesson`,{courseId:e,lessonId:t.id}),title:t.summary,children:t.title}),t.kind===`remedial`?(0,i.jsx)(`span`,{className:`aha-tag`,children:a(`remedial`)}):null,t.depth?(0,i.jsx)(`span`,{className:`aha-depth`,"data-depth":t.depth,title:a(`depthTitle`),children:a(`depth_${t.depth}`)}):null,(0,i.jsx)(`span`,{className:`aha-hint`,children:a(`estMinutes`,{minutes:t.estMinutes})}),(0,i.jsx)(pd,{lesson:t,progress:x}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,onClick:()=>o(`lesson`,{courseId:e,lessonId:t.id}),children:a(`learn`)}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,"data-kind":`ghost`,onClick:()=>o(`practice`,{courseId:e,lessonId:t.id}),children:a(`practice`)})]},t.id))]},t.id))]},t.id))}):null,l===`outline`&&b.sources?.length?(0,i.jsxs)(`section`,{className:`aha-card`,children:[(0,i.jsx)(`b`,{children:a(`courseSources`)}),(0,i.jsx)(Ql,{sources:b.sources})]}):null,l===`practice`?(0,i.jsxs)(`div`,{className:`aha-col`,children:[(0,i.jsx)(`div`,{className:`aha-row`,children:(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,onClick:()=>o(`practice`,{courseId:e,review:!0}),children:a(`startReview`)})}),b.units.map((t,n)=>(0,i.jsxs)(`div`,{className:`aha-card`,children:[(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsxs)(`b`,{children:[a(`unitN`,{n:n+1}),` · `,t.title]}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,onClick:()=>o(`practice`,{courseId:e,unitId:t.id}),children:a(`unitQuiz`)})]}),(0,i.jsx)(`div`,{className:`aha-row`,style:{gap:6},children:t.lectures.flatMap(e=>e.lessons).map(t=>(0,i.jsx)(`button`,{type:`button`,className:`aha-chip`,onClick:()=>o(`practice`,{courseId:e,lessonId:t.id}),children:t.title},t.id))})]},t.id))]}):null,l===`sheets`?(0,i.jsx)(`div`,{className:`aha-grid`,children:b.units.map((t,n)=>(0,i.jsxs)(`div`,{className:`aha-card`,"data-click":`true`,onClick:()=>o(`sheet`,{courseId:e,unitId:t.id}),children:[(0,i.jsx)(`span`,{className:`aha-hint`,children:a(`unitN`,{n:n+1})}),(0,i.jsx)(`b`,{children:t.title}),(0,i.jsx)(`span`,{className:`aha-tag`,children:c.value.ready.sheets.includes(t.id)?a(`open`):a(`generate`)})]},t.id))}):null,l===`cards`?(0,i.jsxs)(`div`,{className:`aha-card`,children:[(0,i.jsx)(`p`,{children:a(`cardsTitle`)}),(0,i.jsx)(`div`,{className:`aha-row`,children:(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,onClick:()=>o(`cards`,{courseId:e}),children:a(`open`)})})]}):null,l===`projects`?b.projects?.length?(0,i.jsx)(`div`,{className:`aha-grid`,children:b.projects.map(t=>(0,i.jsxs)(`div`,{className:`aha-card`,"data-click":`true`,onClick:()=>o(`project`,{courseId:e,projectId:t.id}),children:[(0,i.jsx)(`b`,{children:t.title}),(0,i.jsx)(`p`,{className:`aha-hint`,children:t.brief.slice(0,160)}),(0,i.jsx)(`span`,{className:`aha-tag`,children:x?.projects?.[t.id]?.status===`passed`?`✔`:t.kind})]},t.id))}):(0,i.jsx)(Gl,{children:a(`empty`)}):null,l===`progress`?(0,i.jsxs)(`div`,{className:`aha-card`,children:[(0,i.jsx)(`b`,{children:a(`conceptMastery`)}),(0,i.jsx)(`div`,{className:`aha-col`,style:{gap:4},children:Ae(b).flatMap(({lesson:e})=>e.concepts.map(t=>({concept:t,lesson:e}))).map(({concept:e,lesson:t})=>{let n=x?.concepts?.[e.id],r=rd(n);return(0,i.jsxs)(`div`,{className:`aha-spread`,style:{padding:`3px 0`,borderBottom:`1px solid var(--aha-border)`},children:[(0,i.jsxs)(`span`,{children:[e.name,` `,(0,i.jsxs)(`span`,{className:`aha-hint`,children:[`· `,t.title]})]}),(0,i.jsxs)(`span`,{className:`aha-row`,style:{gap:8},children:[n?.misconceptions?.length?(0,i.jsxs)(`span`,{className:`aha-tag`,title:n.misconceptions.join(`
|
|
270
|
-
`),children:[`⚠ `,n.misconceptions.length]}):null,(0,i.jsx)(`span`,{className:`aha-level`,"data-level":r,children:a(ad[r])}),(0,i.jsx)(eu,{value:T(e.id),stage:r,label:a(ad[r])}),(0,i.jsx)(`span`,{className:`aha-hint`,style:{width:36,textAlign:`right`},children:r===`none`?`—`:`${T(e.id)}%`})]})]},e.id)})})]}):null,p?(0,i.jsx)(Vl,{title:a(`exportPack`),onClose:()=>m(!1),footer:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,onClick:()=>D(!1),children:a(`exportPack`)}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,onClick:()=>D(!0),children:a(`exportWithProgress`)})]}),children:(0,i.jsx)(`p`,{className:`aha-hint`,children:b.title})}):null,g?(0,i.jsx)(Hl,{danger:!0,text:a(`deleteConfirm`,{title:b.title}),onCancel:()=>_(!1),onConfirm:async()=>{await n.call(`course/remove`,{courseId:e}),o(`courses`,{},{replace:!0})}}):null]})}function fd({step:e,courseId:t}){let{t:n,navigate:r}=v(),a={review:[n(`nextStepReview`,{count:e.count}),n(`startReview`),()=>r(`practice`,{courseId:t,review:!0})],practice:[n(`nextStepWeak`,{concept:e.concept}),n(`practiceThis`),()=>r(`practice`,{courseId:t,lessonId:e.lessonId})],lesson:[n(`nextStepLesson`,{title:e.title}),n(`continueLearning`),()=>r(`lesson`,{courseId:t,lessonId:e.lessonId})],done:[n(`nextStepDone`),n(`unitQuiz`),e.unitId?()=>r(`practice`,{courseId:t,unitId:e.unitId}):null]}[e.kind];if(!a)return null;let[o,s,c]=a;return(0,i.jsxs)(`div`,{className:`aha-card aha-nextStep`,"data-kind":e.kind,children:[(0,i.jsxs)(`div`,{className:`aha-col`,style:{gap:2,flex:1,minWidth:200},children:[(0,i.jsx)(`span`,{className:`aha-hint`,children:n(`nextStepTitle`)}),(0,i.jsx)(`b`,{children:o})]}),c?(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,onClick:c,children:s}):null]})}function pd({lesson:e,progress:t}){let{t:n}=v(),{stage:r,percent:a}=cd(e,t);return(0,i.jsx)(eu,{value:a,stage:r,label:n(ad[r])})}let md=[[`all`,`filterAll`],[`active`,`filterActive`],[`done`,`filterDone`],[`archived`,`filterArchived`]];function hd(){let{api:e,t,navigate:n,toast:a}=v(),o=y(()=>e.call(`course/list`),[]),[s,c]=(0,r.useState)(`all`),[l,u]=(0,r.useState)(``),[d,f]=(0,r.useState)(null),p=(0,r.useRef)(null),m=(o.value??[]).filter(e=>s===`archived`?e.archived:e.archived?!1:s===`active`?e.status!==`ready`||e.progress.percent<100:s!==`done`||e.status===`ready`&&e.progress.percent>=100).filter(e=>!l.trim()||`${e.title} ${e.subtitle}`.toLowerCase().includes(l.trim().toLowerCase()));async function h(r){f(null);try{let i=await r.text(),o=await e.call(`course/import`,{json:i});a(t(`courseReady`)),n(`course`,{courseId:o.id})}catch(e){f(e)}}return(0,i.jsxs)(`div`,{className:`aha-page`,children:[(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsx)(`h2`,{className:`aha-title`,children:t(`coursesTitle`)}),(0,i.jsxs)(`div`,{className:`aha-row`,children:[(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,onClick:()=>p.current?.click(),children:t(`importPack`)}),(0,i.jsxs)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,onClick:()=>n(`home`),children:[`+ `,t(`modeCourse`)]}),(0,i.jsx)(`input`,{ref:p,type:`file`,accept:`.json,application/json`,hidden:!0,onChange:e=>{let t=e.currentTarget.files?.[0];t&&h(t),e.currentTarget.value=``}})]})]}),(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsx)(`div`,{className:`aha-row`,style:{gap:6},children:md.map(([e,n])=>(0,i.jsx)(`button`,{type:`button`,className:`aha-chip`,"data-active":s===e,onClick:()=>c(e),children:t(n)},e))}),(0,i.jsx)(`input`,{className:`aha-input`,style:{maxWidth:260},value:l,placeholder:t(`searchCourses`),onChange:e=>u(e.currentTarget.value)})]}),(0,i.jsx)(Wl,{error:d??o.error}),o.loading&&!o.value?(0,i.jsx)(Rl,{label:t(`loading`)}):m.length?(0,i.jsx)(`div`,{className:`aha-grid`,children:m.map(e=>(0,i.jsxs)(`div`,{className:`aha-card`,"data-click":`true`,onClick:()=>n(e.status===`ready`?`course`:`craft`,{courseId:e.id}),children:[(0,i.jsxs)(`div`,{className:`aha-row`,style:{flexWrap:`nowrap`},children:[(0,i.jsx)(`span`,{style:{fontSize:26},children:e.emoji}),(0,i.jsx)(`span`,{className:`aha-cardTitle`,children:e.title})]}),e.subtitle?(0,i.jsx)(`p`,{className:`aha-hint`,children:e.subtitle}):null,e.status===`ready`?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(zl,{value:e.progress.percent}),(0,i.jsxs)(`span`,{className:`aha-hint`,children:[t(`lessonsCount`,e.progress),e.next?` · ${t(`nextUp`,{title:e.next.title})}`:``]})]}):(0,i.jsx)(`span`,{className:`aha-tag`,children:e.status===`intake`?t(`statusIntake`):t(`statusBlueprint`)})]},e.id))}):(0,i.jsx)(Gl,{children:t(`noCourses`)})]})}let gd=Object.freeze([{maxWidth:210,font:16,line:22,padX:16,padY:11},{maxWidth:220,font:14.5,line:20,padX:14,padY:9},{maxWidth:210,font:13.5,line:19,padX:12,padY:8},{maxWidth:250,font:13.5,line:19,padX:12,padY:7}]),_d=Object.freeze({x:56,y:10,unit:18,meta:20}),vd=/[⺀-]/u;function yd(e,t){let n=0;for(let r of String(e??``))n+=vd.test(r)?t:r===` `?t*.3:t*.58;return n}function bd(e,t,n){let r=gd[t],i=r.maxWidth-r.padX*2-12,a=yd(e,r.font),o=Math.max(1,Math.ceil(a/i));return{w:Math.ceil(Math.min(r.maxWidth,Math.max(56,a+r.padX*2+12))),h:Math.ceil(o*r.line+r.padY*2+(n?_d.meta:0))}}function xd(e){let t=[],n=[],r={key:`root`,title:e?.title??``,children:(e?.units??[]).map(e=>({key:e.key,title:e.title,children:(e.lectures??[]).map(e=>({key:e.key,title:e.title,children:(e.lessons??[]).map(e=>({key:e.key,title:e.title,meta:e.meta??null,children:[]}))}))}))},i=new Map,a=[0,0,0,0],o=(e,t)=>{let n=bd(e.title,t,!!e.meta);i.set(e,n),a[t]=Math.max(a[t],n.w);for(let n of e.children)o(n,t+1)};o(r,0);let s=[0];for(let e=1;e<4;e+=1)s[e]=s[e-1]+a[e-1]+_d.x;let c=0,l=[-1/0,-1/0,-1/0,-1/0],u=`root`,d=(e,r)=>{let{w:a,h:o}=i.get(e),f;if(!e.children.length)f=c+o/2,c+=o+_d.y;else{let t=e.children.map((e,t)=>(r===0&&t>0&&(c+=_d.unit),d(e,r+1)));f=(t[0].centre+t[t.length-1].centre)/2;for(let t of e.children)n.push({from:e.key,to:t.key})}let p=f-o/2;return p<l[r]+_d.y&&(p=l[r]+_d.y),l[r]=p+o,c=Math.max(c,p+o+_d.y),t.push({key:e.key,level:r,x:s[r],y:p,w:a,h:o,title:e.title,meta:e.meta??null}),(e.key!==`root`||!e.children.length)&&(u=Sd(e)),{centre:p+o/2}};d(r,0);let f=Math.max(...t.map(e=>e.x+e.w)),p=Math.max(...t.map(e=>e.y+e.h)),m=new Map,h=0,g=e=>{m.set(e.key,h++),e.children.forEach(g)};return g(r),t.sort((e,t)=>m.get(e.key)-m.get(t.key)),{nodes:t,links:n,width:f,height:p,last:u}}function Sd(e){let t=e;for(;t.children.length;)t=t.children[t.children.length-1];return t.key}function Cd(e,t=``){return{title:e?.title||t,units:(e?.units??[]).map((e,t)=>({key:`u${t}`,title:e.title,lectures:(e.lectures??[]).map((e,n)=>({key:`u${t}.${n}`,title:e.title||`…`,lessons:(e.lessons??[]).map((e,r)=>({key:`u${t}.${n}.${r}`,title:typeof e==`string`?e:e?.title??``}))}))}))}}function wd(e,t){let n=e.x+e.w,r=e.y+e.h/2,i=t.x,a=t.y+t.h/2,o=(n+i)/2;return`M${n} ${r} C${o} ${r} ${o} ${a} ${i} ${a}`}function Td({tree:e,live:t=!1,onPick:n,renderMeta:a}){let{t:o}=v(),s=(0,r.useMemo)(()=>xd(e),[e]),c=(0,r.useMemo)(()=>new Map(s.nodes.map(e=>[e.key,e])),[s]),l=(0,r.useRef)(null),[u,d]=(0,r.useState)({width:0,height:0}),[f,p]=(0,r.useState)({x:20,y:20,k:1,animate:!1}),[m,h]=(0,r.useState)(!0),g=(0,r.useRef)({size:u,map:s,pointers:new Map,drag:null});g.current.size=u,g.current.map=s,(0,r.useLayoutEffect)(()=>{let e=l.current;if(!e)return;let t=()=>d(t=>t.width===e.clientWidth&&t.height===e.clientHeight?t:{width:e.clientWidth,height:e.clientHeight});t();let n=typeof ResizeObserver==`function`?new ResizeObserver(t):null;return n?.observe(e),()=>n?.disconnect()},[]);let _=()=>({width:g.current.map.width,height:g.current.map.height}),y=(e,{animate:t=!1,manual:n=!1}={})=>{n&&h(!1),p(n=>({...gc(typeof e==`function`?e(n):e,g.current.size,_(),60),animate:t}))},b=(e=!0)=>y(mc(g.current.size,{x:0,y:-30,width:_().width,height:_().height+30},{margin:20,maxZoom:1}),{animate:e});(0,r.useLayoutEffect)(()=>{if(!u.width||!u.height)return;if(!t){b(!1);return}if(!m)return;let e=c.get(s.last);e&&p(t=>{let n=Math.min(1,Math.max(.55,(u.width-40)/Math.max(1,s.width))),r=Math.min(20,u.width-20-(e.x+e.w)*n),i=(e.y+e.h)*n,a=Math.min(50,u.height-40-i);return t.k===n&&t.x===r&&t.y===a?t:{x:r,y:a,k:n,animate:!0}})},[s,t,m,u.width,u.height]),(0,r.useEffect)(()=>{let e=l.current;if(!e)return;let t=t=>{t.preventDefault();let n=e.getBoundingClientRect(),r=_c(t,n.height);t.ctrlKey||t.metaKey?y(e=>pc(e,t.clientX-n.left,t.clientY-n.top,vc(r.y)),{manual:!0}):y(e=>({...e,x:e.x-(t.shiftKey?r.y:r.x),y:e.y-(t.shiftKey?0:r.y)}),{manual:!0})};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[]);let x=e=>{e.pointerType===`mouse`&&e.button!==0||e.target.closest?.(`.aha-mapBar`)||(g.current.pointers.set(e.pointerId,{x:e.clientX,y:e.clientY}),g.current.drag||(g.current.drag={x:e.clientX,y:e.clientY,moved:!1}))},S=e=>{let{pointers:t,drag:n}=g.current,r=t.get(e.pointerId);if(!r||!n)return;let i={x:e.clientX,y:e.clientY};if(t.size===1){if(!n.moved&&Math.hypot(i.x-n.x,i.y-n.y)<5)return;n.moved||l.current?.setPointerCapture?.(e.pointerId),n.moved=!0,t.set(e.pointerId,i),y(e=>({...e,x:e.x+i.x-r.x,y:e.y+i.y-r.y}),{manual:!0});return}let a=[...t.entries()].find(([t])=>t!==e.pointerId)?.[1];if(t.set(e.pointerId,i),!a)return;let o=l.current.getBoundingClientRect(),s={x:(r.x+a.x)/2,y:(r.y+a.y)/2,d:Math.hypot(r.x-a.x,r.y-a.y)},c={x:(i.x+a.x)/2,y:(i.y+a.y)/2,d:Math.hypot(i.x-a.x,i.y-a.y)};n.moved=!0,y(e=>{let t=pc(e,s.x-o.left,s.y-o.top,c.d/Math.max(1,s.d));return{...t,x:t.x+c.x-s.x,y:t.y+c.y-s.y}},{manual:!0})},C=e=>{let t=g.current.drag?.moved;if(g.current.pointers.delete(e.pointerId),g.current.pointers.size||(g.current.drag=null),!t&&n){let t=e.target.closest?.(`[data-pick]`)?.dataset.pick;t&&n(t)}},w=e=>y(t=>pc(t,g.current.size.width/2,g.current.size.height/2,e),{animate:!0,manual:!0});return(0,i.jsxs)(`div`,{className:`aha-map`,children:[(0,i.jsx)(`div`,{ref:l,className:`aha-mapView`,onPointerDown:x,onPointerMove:S,onPointerUp:C,onPointerCancel:C,onDoubleClick:()=>b(),children:(0,i.jsxs)(`div`,{className:`aha-mapWorld`,style:{width:s.width,height:s.height,transform:`translate(${f.x}px, ${f.y}px) scale(${f.k})`,transition:f.animate?`transform .45s ease`:`none`},children:[(0,i.jsx)(`svg`,{className:`aha-mapLinks`,width:s.width,height:s.height,"aria-hidden":`true`,children:s.links.map(e=>{let t=c.get(e.from),n=c.get(e.to);return t&&n?(0,i.jsx)(`path`,{d:wd(t,n)},`${e.from}>${e.to}`):null})}),s.nodes.map(e=>(0,i.jsxs)(`div`,{className:`aha-mapNode`,"data-level":e.level,"data-pick":n&&e.level===3?e.key:void 0,style:{left:e.x,top:e.y,width:e.w,minHeight:e.h},title:n&&e.level===3?o(`mapPick`):void 0,children:[(0,i.jsx)(`span`,{className:`aha-mapTitle`,children:e.title}),e.meta&&a?(0,i.jsx)(`span`,{className:`aha-mapMeta`,children:a(e.meta)}):null]},e.key))]})}),(0,i.jsxs)(`div`,{className:`aha-mapBar`,role:`toolbar`,"aria-label":o(`mapTools`),children:[t&&!m?(0,i.jsx)(`button`,{type:`button`,className:`aha-mapFollow`,onClick:()=>h(!0),children:o(`mapFollow`)}):null,(0,i.jsx)(`button`,{type:`button`,"aria-label":o(`canvasZoomOut`),title:o(`canvasZoomOut`),onClick:()=>w(1/dc),children:`−`}),(0,i.jsxs)(`button`,{type:`button`,className:`aha-mapZoom`,title:o(`canvasZoomReset`),onClick:()=>y(e=>({...pc(e,g.current.size.width/2,g.current.size.height/2,1/e.k)}),{animate:!0,manual:!0}),children:[Math.round(f.k*100),`%`]}),(0,i.jsx)(`button`,{type:`button`,"aria-label":o(`canvasZoomIn`),title:o(`canvasZoomIn`),onClick:()=>w(dc),children:`+`}),(0,i.jsx)(`button`,{type:`button`,title:o(`canvasFit`),onClick:()=>{h(!1),b()},children:o(`canvasFitShort`)})]})]})}let Ed=[[`intensive`,`paceIntensive`,`paceIntensiveHint`],[`balanced`,`paceBalanced`,`paceBalancedHint`],[`relaxed`,`paceRelaxed`,`paceRelaxedHint`]],Dd=[[`auto`,`sizeAuto`,`sizeAutoHint`],[`short`,`sizeShort`,`sizeShortHint`],[`standard`,`sizeStandard`,`sizeStandardHint`],[`full`,`sizeFull`,`sizeFullHint`]],Od=[60,120,180,300,420,600];function kd({jobId:e,courseId:t,edit:n=!1,add:a=!1}){let{api:o,t:s,navigate:c}=v(),[l,u]=(0,r.useState)(null),[d,f]=(0,r.useState)(`questions`);return(0,r.useEffect)(()=>{if(!e||t)return;let n=new AbortController;return o.follow({job:{id:e,status:`running`}},{signal:n.signal,onProgress:e=>f(e?.label===`research`?`research`:`questions`)}).then(e=>c(`craft`,{courseId:e.courseId},{replace:!0})).catch(e=>{n.signal.aborted||u(e)}),()=>n.abort()},[e,t]),t?(0,i.jsx)(Ad,{courseId:t,edit:n,add:a}):(0,i.jsxs)(`div`,{className:`aha-page`,children:[(0,i.jsx)(`h2`,{className:`aha-title`,children:s(`craftQuestionsTitle`)}),l?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(Wl,{error:l}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,onClick:()=>c(`home`),children:s(`back`)})]}):(0,i.jsx)(Rl,{label:s(d===`research`?`researching`:`thinkingQuestions`)})]})}function Ad({courseId:e,edit:t,add:n}){let{api:a,t:o,navigate:s}=v(),c=y(()=>a.call(`course/get`,{courseId:e}),[e]),l=b(),u=c.value?.course;return(0,r.useEffect)(()=>{let e=c.value?.jobs?.questions??c.value?.jobs?.blueprint??c.value?.jobs?.confirm;!e||l.running||l.run(null,null,{existing:e}).then(()=>c.reload()).catch(()=>void 0)},[c.value]),(0,r.useEffect)(()=>{u?.status===`ready`&&!l.running&&!t&&s(`course`,{courseId:e},{replace:!0})},[u?.status]),c.loading&&!c.value?(0,i.jsx)(`div`,{className:`aha-page`,children:(0,i.jsx)(Rl,{label:o(`loading`)})}):c.error&&!c.value?(0,i.jsx)(`div`,{className:`aha-page`,children:(0,i.jsx)(Wl,{error:c.error})}):u?u.status===`intake`?(0,i.jsx)(jd,{course:u,intake:c.value.intake,job:l,onDone:()=>c.reload()}):(0,i.jsx)(Ld,{course:u,proposal:c.value.proposal,progress:c.value.progress,boards:c.value.ready?.boards??[],job:l,onChange:()=>c.reload(),adding:n}):null}function jd({course:e,intake:t,job:n,onDone:a}){let{t:o}=v(),s=t?.questionnaire?.questions??[],[c,l]=(0,r.useState)({}),[u,d]=(0,r.useState)(`balanced`),[f,p]=(0,r.useState)(`auto`),[m,h]=(0,r.useState)(180),[g,_]=(0,r.useState)(``),y=(e,t)=>l(n=>{let r=n[e.id]??{choice:[],other:``},i=e.multi?r.choice.includes(t)?r.choice.filter(e=>e!==t):[...r.choice,t]:[t];return{...n,[e.id]:{...r,choice:i}}});async function b(){try{await n.run(`course/intake`,{courseId:e.id,answers:c,timeline:u,size:f,weeklyMinutes:m,deadline:g||void 0}),a()}catch{}}return n.running?n.progress?.label===`questions`?(0,i.jsxs)(`div`,{className:`aha-page`,children:[(0,i.jsx)(`h2`,{className:`aha-title`,children:e.goal}),(0,i.jsx)(Bl,{progress:n.progress,label:o(`thinkingQuestions`),onCancel:n.cancel})]}):(0,i.jsx)(Nd,{course:e,job:n,research:t?.research}):(0,i.jsxs)(`div`,{className:`aha-page`,children:[(0,i.jsxs)(`div`,{className:`aha-col`,style:{gap:4},children:[(0,i.jsx)(`h2`,{className:`aha-title`,children:o(`craftQuestionsTitle`)}),(0,i.jsx)(`p`,{className:`aha-subtitle`,children:e.goal}),(0,i.jsx)(`p`,{className:`aha-hint`,children:o(`craftQuestionsHint`)}),t?.research?(0,i.jsx)(Md,{research:t.research}):null]}),s.map((e,t)=>(0,i.jsxs)(`section`,{className:`aha-card`,children:[(0,i.jsxs)(`div`,{className:`aha-cardTitle`,children:[t+1,`. `,e.prompt]}),(0,i.jsx)(`div`,{className:`aha-grid`,style:{gridTemplateColumns:`repeat(auto-fill,minmax(220px,1fr))`},children:e.options.map(t=>(0,i.jsxs)(`button`,{type:`button`,className:`aha-option`,"data-active":c[e.id]?.choice?.includes(t.id)??!1,onClick:()=>y(e,t.id),children:[(0,i.jsx)(`b`,{children:t.label}),t.detail?(0,i.jsx)(`small`,{children:t.detail}):null]},t.id))}),(0,i.jsx)(`input`,{className:`aha-input`,placeholder:o(`craftOther`),value:c[e.id]?.other??``,onChange:t=>{let n=t.currentTarget.value;l(t=>({...t,[e.id]:{choice:t[e.id]?.choice??[],other:n}}))}})]},e.id)),(0,i.jsxs)(`section`,{className:`aha-card`,children:[(0,i.jsx)(`div`,{className:`aha-cardTitle`,children:o(`craftSize`)}),(0,i.jsx)(`div`,{className:`aha-grid`,style:{gridTemplateColumns:`repeat(auto-fill,minmax(180px,1fr))`},children:Dd.map(([e,t,n])=>(0,i.jsxs)(`button`,{type:`button`,className:`aha-option`,"data-active":f===e,onClick:()=>p(e),children:[(0,i.jsx)(`b`,{children:o(t)}),(0,i.jsx)(`small`,{children:o(n)})]},e))})]}),(0,i.jsxs)(`section`,{className:`aha-card`,children:[(0,i.jsx)(`div`,{className:`aha-cardTitle`,children:o(`craftPace`)}),(0,i.jsx)(`div`,{className:`aha-grid`,style:{gridTemplateColumns:`repeat(auto-fill,minmax(200px,1fr))`},children:Ed.map(([e,t,n])=>(0,i.jsxs)(`button`,{type:`button`,className:`aha-option`,"data-active":u===e,onClick:()=>d(e),children:[(0,i.jsx)(`b`,{children:o(t)}),(0,i.jsx)(`small`,{children:o(n)})]},e))}),(0,i.jsxs)(`div`,{className:`aha-row`,children:[(0,i.jsxs)(`label`,{className:`aha-label`,style:{flex:1,minWidth:220},children:[o(`weeklyMinutes`),(0,i.jsx)(`select`,{className:`aha-select`,value:m,onChange:e=>h(Number(e.currentTarget.value)),children:Od.map(e=>(0,i.jsx)(`option`,{value:e,children:o(`minutesUnit`,{minutes:e})},e))})]}),(0,i.jsxs)(`label`,{className:`aha-label`,style:{flex:1,minWidth:220},children:[o(`deadline`),(0,i.jsx)(`input`,{className:`aha-input`,type:`date`,value:g,onChange:e=>_(e.currentTarget.value)})]})]})]}),(0,i.jsx)(Wl,{error:n.error}),(0,i.jsx)(`div`,{className:`aha-row`,children:(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,onClick:b,children:o(`makeBlueprint`)})})]})}function Md({research:e}){let{t}=v();return e.skipped?(0,i.jsx)(`p`,{className:`aha-hint`,children:t(`researchSkipped`,{reason:t(`researchSkipped_${e.skipped}`)})}):(0,i.jsxs)(`details`,{className:`aha-sources`,children:[(0,i.jsx)(`summary`,{children:t(`researchFound`,{count:e.sources.length})}),(0,i.jsx)(Ql,{sources:e.sources})]})}function Nd({course:e,job:t,research:n}){let{t:a}=v(),o=t.preview?.units??[],s=(0,r.useMemo)(()=>Cd(t.preview,e.goal),[t.preview,e.goal]),c=o.reduce((e,t)=>e+t.lectures.reduce((e,t)=>e+t.lessons.length,0),0),l=t.progress?.label===`materials`?`materials`:o.length?`lessons`:`units`,u=[...n?.sources?.length?[[`research`,a(`buildResearch`,{count:n.sources.length})]]:[],[`answers`,a(`buildAnswers`)],...e.materialIds?.length?[[`materials`,a(`buildMaterials`)]]:[],[`units`,a(`buildUnits`)],[`lessons`,c?a(`buildLessonsSoFar`,{count:c}):a(`buildLessons`)]],d=u.findIndex(([e])=>e===l);return(0,i.jsxs)(`div`,{className:`aha-page`,children:[(0,i.jsxs)(`div`,{className:`aha-col`,style:{gap:4},children:[(0,i.jsx)(`h2`,{className:`aha-title`,children:t.preview?.title||e.goal}),(0,i.jsxs)(`p`,{className:`aha-hint`,children:[a(`designingBlueprint`),` `,a(`keepsRunning`)]})]}),(0,i.jsx)(`ol`,{className:`aha-buildLog`,children:u.map(([e,t],n)=>(0,i.jsxs)(`li`,{"data-state":n<d?`done`:n===d?`current`:`todo`,children:[(0,i.jsx)(`span`,{className:`aha-buildMark`,"aria-hidden":`true`,children:n<d?`✓`:n===d?(0,i.jsx)(`span`,{className:`aha-spinner`}):``}),(0,i.jsx)(`span`,{children:t})]},e))}),o.length?(0,i.jsx)(Td,{tree:s,live:!0}):null,(0,i.jsx)(`div`,{className:`aha-row`,children:(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,onClick:t.cancel,children:a(`cancel`)})})]})}function Pd(e){return JSON.parse(JSON.stringify(e??[]))}function Fd(e,t,n){let r=[...e],i=t+n;return i<0||i>=r.length?e:([r[t],r[i]]=[r[i],r[t]],r)}function Id({course:e,job:t,onDone:n,onClose:a}){let{api:o,t:s}=v(),c=y(()=>o.call(`material/list`),[]),[l,u]=(0,r.useState)([]),[d,f]=(0,r.useState)(!1),[p,m]=(0,r.useState)(``),h=new Map((c.value??[]).map(e=>[e.id,e.title]));async function g(){try{await t.run(`course/add-materials`,{courseId:e.id,materialIds:l,instruction:p.trim()}),n()}catch{}}return(0,i.jsxs)(`section`,{className:`aha-card aha-addMaterials`,children:[(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsx)(`b`,{children:s(`addMaterialsTitle`)}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,"data-size":`sm`,onClick:a,children:s(`cancel`)})]}),(0,i.jsx)(`p`,{className:`aha-hint`,children:s(`addMaterialsHint`)}),(0,i.jsxs)(`div`,{className:`aha-row`,style:{gap:6},children:[l.map(e=>(0,i.jsx)(`span`,{className:`aha-tag`,children:h.get(e)??`…`},e)),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,onClick:()=>{c.reload(),f(!0)},children:l.length?s(`changeMaterials`):s(`pickMaterials`)})]}),(0,i.jsx)(`input`,{className:`aha-input`,value:p,placeholder:s(`addMaterialsPlaceholder`),"aria-label":s(`addMaterialsPlaceholder`),onChange:e=>m(e.currentTarget.value)}),(0,i.jsx)(`div`,{className:`aha-row`,children:(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,disabled:!l.length,onClick:g,children:s(`addMaterialsSend`)})}),d?(0,i.jsx)(Yl,{selected:l,max:12,exclude:e.materialIds??[],onChange:e=>{u(e),c.reload()},onClose:()=>f(!1)}):null]})}function Ld({course:e,proposal:t,progress:n,boards:a,job:o,onChange:s,adding:c=!1}){let{api:l,t:u,toast:d,navigate:f}=v(),p=e.status===`ready`,[m,h]=(0,r.useState)(()=>Pd(e.units)),[g,_]=(0,r.useState)(e.title),[y,x]=(0,r.useState)(!1),[S,C]=(0,r.useState)(``),[w,T]=(0,r.useState)(!1),[E,D]=(0,r.useState)(null),[O,k]=(0,r.useState)(null),[A,ee]=(0,r.useState)(null),[te,j]=(0,r.useState)(null),[ne,re]=(0,r.useState)(p?`list`:`map`),[ie,ae]=(0,r.useState)(c),[oe,se]=(0,r.useState)(null),ce=(0,r.useRef)(null),le=b();(0,r.useEffect)(()=>{h(Pd(e.units)),_(e.title),x(!1)},[e]);let ue=e=>{h(t=>{let n=Pd(t);return e(n),n.filter(e=>e.lectures.length).map(e=>({...e,lectures:e.lectures.filter(e=>e.lessons.length)}))}),x(!0)},de=(0,r.useMemo)(()=>m.reduce((e,t)=>e+t.lectures.reduce((e,t)=>e+t.lessons.length,0),0),[m]),fe=(0,r.useMemo)(()=>m.reduce((e,t)=>e+t.lectures.reduce((e,t)=>e+t.lessons.reduce((e,t)=>e+(t.estMinutes||15),0),0),0),[m]),pe=(0,r.useMemo)(()=>t?.blueprint?.units?je(e,t.blueprint):null,[e,t]),me=e=>!!e.id&&((n?.lessons?.[e.id]?.status??`new`)!==`new`||a.includes(e.id)),he=!!pe||!!te,ge=(0,r.useMemo)(()=>({title:g,units:m.map((e,t)=>({key:`u${t}`,title:e.title,lectures:e.lectures.map((e,n)=>({key:`u${t}.${n}`,title:e.title,lessons:e.lessons.map((e,r)=>({key:`u${t}.${n}.${r}`,title:e.title,meta:{depth:e.depth,minutes:e.estMinutes}}))}))}))}),[m,g]),_e=e=>(0,i.jsxs)(i.Fragment,{children:[e.depth?(0,i.jsx)(`span`,{className:`aha-depth`,"data-depth":e.depth,children:u(`depth_${e.depth}`)}):null,(0,i.jsx)(`span`,{children:u(`estMinutes`,{minutes:e.minutes})})]});(0,r.useEffect)(()=>{if(!oe||ne!==`list`)return;let e=ce.current?.querySelector(`[data-path="${oe}"]`);e?.scrollIntoView({block:`center`,behavior:`smooth`}),e?.querySelector(`input`)?.focus({preventScroll:!0});let t=setTimeout(()=>se(null),1700);return()=>clearTimeout(t)},[oe,ne]);async function ve(){T(!0),D(null);try{return await l.call(`course/save-blueprint`,{courseId:e.id,blueprint:{...e,title:g,units:m}}),x(!1),d(u(`saved`)),s(),!0}catch(e){return D(e),!1}finally{T(!1)}}async function ye(t,n){t?.preventDefault();let r=n??S.trim();if(r&&!(y&&!await ve()))try{await o.run(`course/revise`,{courseId:e.id,instruction:r}),C(``),s()}catch{}}async function be(t,n){D(null);try{await l.call(t,{courseId:e.id}),n&&d(n),s()}catch(e){D(e)}}async function xe(t,n,r,i){ee(null);let a=m[t],o=a.lectures[n];j(`${t}.${n}.${r}`);try{let s=await le.run(`course/rework-lesson`,{courseId:e.id,lesson:o.lessons[r],unitTitle:a.title,lectureTitle:o.title,mode:i});ue(e=>{e[t].lectures[n].lessons.splice(r,1,...s.lessons)}),d(u(i===`split`?`splitDone`:`deepenDone`))}catch{}finally{j(null)}}async function Se(){if(!(y&&!await ve()))try{await o.run(`course/confirm`,{courseId:e.id}),s()}catch{}}async function Ce(){y&&!await ve()||f(`course`,{courseId:e.id})}if(o.running){let t=o.progress?.label===`practice`||o.progress?.label===`projects`?u(`confirming`,{done:o.progress.done,total:o.progress.total}):o.progress?.done?u(`revisingSoFar`,{count:o.progress.done}):u(`revising`);return(0,i.jsxs)(`div`,{className:`aha-page`,children:[(0,i.jsxs)(`h2`,{className:`aha-title`,children:[e.emoji,` `,e.title]}),(0,i.jsx)(Bl,{progress:o.progress,label:t,onCancel:o.cancel})]})}let we=(e,t)=>k({text:e,run:t});return(0,i.jsxs)(`div`,{className:`aha-page`,children:[(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsxs)(`div`,{className:`aha-col`,style:{gap:4,flex:1},children:[(0,i.jsx)(`span`,{className:`aha-hint`,children:u(p?`editOutline`:`blueprintTitle`)}),(0,i.jsxs)(`div`,{className:`aha-row`,style:{flexWrap:`nowrap`},children:[(0,i.jsx)(`span`,{style:{fontSize:28},children:e.emoji}),(0,i.jsx)(`input`,{className:`aha-input aha-title`,style:{border:`none`,padding:`2px 4px`},value:g,disabled:he,onChange:e=>{_(e.currentTarget.value),x(!0)}})]}),e.subtitle?(0,i.jsx)(`p`,{className:`aha-subtitle`,children:e.subtitle}):null,(0,i.jsxs)(`p`,{className:`aha-hint`,children:[u(`lessonsCount`,{done:0,total:de}),` · `,u(`minutesLeft`,{minutes:fe})]})]}),(0,i.jsxs)(`div`,{className:`aha-row`,children:[y?(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,disabled:w||he,onClick:ve,children:u(`saveEdits`)}):null,p?(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,disabled:w||he,onClick:Ce,children:u(y?`saveAndBack`:`backToCourse`)}):(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,disabled:he,onClick:Se,children:u(`confirmCourse`)})]})]}),e.summary?(0,i.jsx)(`p`,{children:e.summary}):null,pe?(0,i.jsxs)(`section`,{className:`aha-card aha-proposal`,children:[(0,i.jsxs)(`div`,{className:`aha-col`,style:{gap:2},children:[(0,i.jsx)(`b`,{children:u(`proposalTitle`)}),t.materials?.length?(0,i.jsx)(`span`,{className:`aha-hint`,children:u(`proposalMaterials`,{titles:t.materials.map(e=>`《${e.title}》`).join(``)})}):null,t.instruction?(0,i.jsxs)(`span`,{className:`aha-hint`,children:[`“`,t.instruction,`”`]}):null]}),Me(pe)?(0,i.jsx)(`p`,{className:`aha-hint`,children:u(`proposalNoChange`)}):(0,i.jsxs)(`ul`,{className:`aha-diff`,children:[pe.title?(0,i.jsxs)(`li`,{"data-kind":`renamed`,children:[(0,i.jsx)(`span`,{className:`aha-diffTag`,children:u(`diffRenamed`)}),pe.title.from,` → `,pe.title.to]}):null,pe.unitsAdded.map((e,t)=>(0,i.jsxs)(`li`,{"data-kind":`added`,children:[(0,i.jsx)(`span`,{className:`aha-diffTag`,children:u(`diffAdded`)}),u(`diffUnit`,{title:e})]},`ua${t}`)),pe.unitsRemoved.map((e,t)=>(0,i.jsxs)(`li`,{"data-kind":`removed`,children:[(0,i.jsx)(`span`,{className:`aha-diffTag`,children:u(`diffRemoved`)}),u(`diffUnit`,{title:e})]},`ur${t}`)),pe.added.map((e,t)=>(0,i.jsxs)(`li`,{"data-kind":`added`,children:[(0,i.jsx)(`span`,{className:`aha-diffTag`,children:u(`diffAdded`)}),e.title,(0,i.jsxs)(`span`,{className:`aha-hint`,children:[` · `,e.unit]})]},`a${t}`)),pe.removed.map((e,t)=>(0,i.jsxs)(`li`,{"data-kind":`removed`,children:[(0,i.jsx)(`span`,{className:`aha-diffTag`,children:u(`diffRemoved`)}),e.title,(0,i.jsxs)(`span`,{className:`aha-hint`,children:[` · `,e.unit]})]},`r${t}`)),pe.renamed.map((e,t)=>(0,i.jsxs)(`li`,{"data-kind":`renamed`,children:[(0,i.jsx)(`span`,{className:`aha-diffTag`,children:u(`diffRenamed`)}),e.from,` → `,e.to]},`n${t}`)),pe.changed.map((e,t)=>(0,i.jsxs)(`li`,{"data-kind":`changed`,children:[(0,i.jsx)(`span`,{className:`aha-diffTag`,children:u(`diffChanged`)}),e.title,(0,i.jsxs)(`span`,{className:`aha-hint`,children:[` · `,e.unit]})]},`c${t}`))]}),(0,i.jsxs)(`div`,{className:`aha-row`,children:[(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,onClick:()=>be(`course/proposal-apply`,u(`proposalApplied`)),children:u(`applyProposal`)}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,onClick:()=>be(`course/proposal-discard`),children:u(`discardProposal`)})]})]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`p`,{className:`aha-hint`,children:u(`blueprintHint`)}),(0,i.jsxs)(`form`,{className:`aha-row`,onSubmit:ye,children:[(0,i.jsx)(`input`,{className:`aha-input`,style:{flex:1},value:S,placeholder:u(`revisePlaceholder`),onChange:e=>C(e.currentTarget.value),"aria-label":u(`reviseLabel`)}),(0,i.jsx)(`button`,{type:`submit`,className:`aha-btn`,disabled:!S.trim()||he,children:u(`revise`)}),p?(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,disabled:he,onClick:()=>ye(null,u(`extendInstruction`)),children:u(`extendCourse`)}):null,(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,disabled:he,"aria-expanded":ie,onClick:()=>ae(e=>!e),children:u(`addMaterials`)})]}),ie?(0,i.jsx)(Id,{course:e,job:o,onClose:()=>ae(!1),onDone:()=>{ae(!1),s()}}):null]}),(0,i.jsx)(Wl,{error:E??o.error??le.error}),(0,i.jsxs)(`div`,{className:`aha-viewToggle`,role:`group`,"aria-label":u(`outlineView`),children:[(0,i.jsx)(`button`,{type:`button`,"aria-pressed":ne===`list`,onClick:()=>re(`list`),children:u(`viewList`)}),(0,i.jsx)(`button`,{type:`button`,"aria-pressed":ne===`map`,onClick:()=>re(`map`),children:u(`viewMap`)})]}),ne===`map`?(0,i.jsx)(Td,{tree:ge,renderMeta:_e,onPick:e=>{se(e),re(`list`)}}):(0,i.jsxs)(`fieldset`,{ref:ce,className:`aha-tree`,disabled:he,children:[m.map((e,t)=>(0,i.jsxs)(`div`,{className:`aha-unit`,children:[(0,i.jsxs)(`div`,{className:`aha-lesson`,style:{fontWeight:650},children:[(0,i.jsx)(`span`,{className:`aha-tag`,children:u(`unitN`,{n:t+1})}),(0,i.jsx)(`input`,{value:e.title,onChange:e=>{let n=e.currentTarget.value;ue(e=>{e[t].title=n})}}),(0,i.jsx)(Rd,{onUp:()=>ue(e=>{e.splice(0,e.length,...Fd(e,t,-1))}),onDown:()=>ue(e=>{e.splice(0,e.length,...Fd(e,t,1))}),onRemove:()=>we(u(`confirmRemoveUnit`,{title:e.title}),()=>ue(e=>{e.splice(t,1)}))})]}),e.lectures.map((e,n)=>(0,i.jsxs)(`div`,{className:`aha-lecture`,children:[(0,i.jsxs)(`div`,{className:`aha-lesson`,style:{fontWeight:600},children:[(0,i.jsx)(`span`,{className:`aha-hint`,children:u(`lectureN`,{n:n+1})}),(0,i.jsx)(`input`,{value:e.title,onChange:e=>{let r=e.currentTarget.value;ue(e=>{e[t].lectures[n].title=r})}}),(0,i.jsx)(Rd,{onUp:()=>ue(e=>{let r=e[t].lectures;r.splice(0,r.length,...Fd(r,n,-1))}),onDown:()=>ue(e=>{let r=e[t].lectures;r.splice(0,r.length,...Fd(r,n,1))}),onRemove:()=>we(u(`confirmRemoveLecture`,{title:e.title}),()=>ue(e=>{e[t].lectures.splice(n,1)}))})]}),e.lessons.map((e,r)=>{let a=`${t}.${n}.${r}`,o=()=>ue(e=>{e[t].lectures[n].lessons.splice(r,1)});return(0,i.jsxs)(`div`,{className:`aha-lesson`,"data-path":`u${a}`,"data-flash":oe===`u${a}`?`true`:void 0,children:[(0,i.jsx)(`span`,{className:`aha-dot`}),(0,i.jsx)(`input`,{value:e.title,title:e.summary,onChange:e=>{let i=e.currentTarget.value;ue(e=>{e[t].lectures[n].lessons[r].title=i})}}),(0,i.jsxs)(`select`,{className:`aha-depthSelect`,"data-depth":e.depth||void 0,value:e.depth??``,title:u(`depthTitle`),"aria-label":u(`depthTitle`),onChange:e=>{let i=e.currentTarget.value;ue(e=>{let a=e[t].lectures[n].lessons[r];i?a.depth=i:delete a.depth})},children:[(0,i.jsx)(`option`,{value:``,children:u(`depthNone`)}),Oe.map(e=>(0,i.jsx)(`option`,{value:e,children:u(`depth_${e}`)},e))]}),(0,i.jsx)(`span`,{className:`aha-hint`,children:u(`estMinutes`,{minutes:e.estMinutes})}),te===a?(0,i.jsx)(Rl,{}):me(e)?null:(0,i.jsxs)(`span`,{className:`aha-menuAnchor`,children:[(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,"data-size":`sm`,title:u(`reworkLesson`),"aria-label":u(`reworkLesson`),"aria-expanded":A===a,onClick:()=>ee(e=>e===a?null:a),children:`✦`}),A===a?(0,i.jsxs)(`div`,{className:`aha-card aha-menu`,onMouseLeave:()=>ee(null),children:[(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,onClick:()=>xe(t,n,r,`split`),children:u(`splitLesson`)}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,onClick:()=>xe(t,n,r,`deepen`),children:u(`deepenLesson`)})]}):null]}),(0,i.jsx)(Rd,{onUp:()=>ue(e=>{let i=e[t].lectures[n].lessons;i.splice(0,i.length,...Fd(i,r,-1))}),onDown:()=>ue(e=>{let i=e[t].lectures[n].lessons;i.splice(0,i.length,...Fd(i,r,1))}),onRemove:()=>me(e)?we(u(`confirmRemoveStarted`,{title:e.title}),o):o()})]},e.id??r)}),(0,i.jsx)(`div`,{children:(0,i.jsxs)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,"data-size":`sm`,onClick:()=>ue(e=>{e[t].lectures[n].lessons.push({title:u(`untitled`),objectives:[],concepts:[],estMinutes:15})}),children:[`+ `,u(`addLesson`)]})})]},e.id??n)),(0,i.jsx)(`div`,{children:(0,i.jsxs)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,"data-size":`sm`,onClick:()=>ue(e=>{e[t].lectures.push({title:u(`untitled`),lessons:[{title:u(`untitled`),objectives:[],concepts:[],estMinutes:15}]})}),children:[`+ `,u(`addLecture`)]})})]},e.id??t)),(0,i.jsx)(`div`,{children:(0,i.jsxs)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,onClick:()=>ue(e=>{e.push({title:u(`untitled`),objectives:[],lectures:[{title:u(`untitled`),lessons:[{title:u(`untitled`),objectives:[],concepts:[],estMinutes:15}]}]})}),children:[`+ `,u(`addUnit`)]})})]}),e.projects?.length?(0,i.jsxs)(`section`,{className:`aha-col`,children:[(0,i.jsx)(`h3`,{className:`aha-cardTitle`,children:u(`projects`)}),(0,i.jsx)(`div`,{className:`aha-grid`,children:e.projects.map(e=>(0,i.jsxs)(`div`,{className:`aha-card`,children:[(0,i.jsx)(`b`,{children:e.title}),(0,i.jsx)(`p`,{className:`aha-hint`,children:e.brief})]},e.id))})]}):null,O?(0,i.jsx)(Hl,{danger:!0,text:O.text,onConfirm:()=>{O.run(),k(null)},onCancel:()=>k(null)}):null]})}function Rd({onUp:e,onDown:t,onRemove:n}){let{t:r}=v();return(0,i.jsxs)(`span`,{className:`aha-row`,style:{gap:2,flexWrap:`nowrap`},children:[(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,"data-size":`sm`,onClick:e,title:r(`moveUp`),"aria-label":r(`moveUp`),children:`↑`}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,"data-size":`sm`,onClick:t,title:r(`moveDown`),"aria-label":r(`moveDown`),children:`↓`}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,"data-size":`sm`,onClick:n,title:r(`remove`),"aria-label":r(`remove`),children:`✕`})]})}function zd({courseId:e,lessonId:t}){let{api:n,t:a,navigate:o}=v(),s=b(),[c,l]=(0,r.useState)(null),[u,d]=(0,r.useState)(null),f=async r=>{d(null);try{let i=await n.call(`lesson/handout`,{courseId:e,lessonId:t,force:r});l(i.job?(await s.run(null,null,{existing:i.job})).handout:i.handout)}catch(e){d(e)}};(0,r.useEffect)(()=>{f(!1)},[e,t]);let p=()=>{for(let e of document.querySelectorAll(`.aha-handout details`))e.open=!0;window.print()},m=(0,i.jsxs)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,onClick:()=>o(`lesson`,{courseId:e,lessonId:t}),children:[`← `,a(`backToLesson`)]});return u?(0,i.jsxs)(`div`,{className:`aha-page`,children:[(0,i.jsx)(Wl,{error:u}),(0,i.jsx)(`div`,{className:`aha-row`,children:m})]}):c?(0,i.jsxs)(`div`,{className:`aha-page`,style:{maxWidth:860},children:[(0,i.jsxs)(`div`,{className:`aha-spread aha-noprint`,children:[m,(0,i.jsxs)(`div`,{className:`aha-row`,children:[(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,onClick:p,children:a(`print`)}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,onClick:()=>{l(null),f(!0)},children:a(`regenerate`)})]})]}),(0,i.jsxs)(`article`,{className:`aha-printable aha-handout`,children:[(0,i.jsxs)(`header`,{children:[(0,i.jsx)(`span`,{className:`aha-hint`,children:a(`handout`)}),(0,i.jsx)(`h2`,{children:c.title}),c.summary?(0,i.jsx)(`p`,{className:`aha-handoutSummary`,children:(0,i.jsx)(pl,{text:c.summary})}):null]}),(0,i.jsxs)(`section`,{children:[(0,i.jsx)(`h3`,{children:a(`handoutPoints`)}),(0,i.jsx)(`ol`,{className:`aha-handoutPoints`,children:c.points.map((e,t)=>(0,i.jsxs)(`li`,{children:[(0,i.jsx)(`b`,{children:(0,i.jsx)(pl,{text:e.title})}),e.oneLine?(0,i.jsx)(`div`,{className:`aha-handoutOneLine`,children:(0,i.jsx)(pl,{text:e.oneLine})}):null,e.detail?(0,i.jsx)(`div`,{className:`aha-hint`,children:(0,i.jsx)(pl,{text:e.detail})}):null]},t))})]}),c.example?(0,i.jsxs)(`section`,{children:[(0,i.jsx)(`h3`,{children:a(`handoutExample`)}),(0,i.jsx)(`p`,{children:(0,i.jsx)(pl,{text:c.example.problem})}),(0,i.jsx)(`ol`,{className:`aha-handoutSteps`,children:c.example.steps.map((e,t)=>(0,i.jsx)(`li`,{children:(0,i.jsx)(pl,{text:e})},t))}),c.example.answer?(0,i.jsxs)(`div`,{className:`aha-handoutAnswer`,children:[(0,i.jsx)(`b`,{children:a(`handoutAnswer`)}),` `,(0,i.jsx)(pl,{text:c.example.answer})]}):null]}):null,c.mistakes.length?(0,i.jsxs)(`section`,{children:[(0,i.jsx)(`h3`,{children:a(`handoutMistakes`)}),(0,i.jsx)(`ul`,{className:`aha-handoutMistakes`,children:c.mistakes.map((e,t)=>(0,i.jsxs)(`li`,{children:[(0,i.jsx)(`span`,{"data-wrong":`true`,children:(0,i.jsx)(pl,{text:e.mistake})}),e.fix?(0,i.jsxs)(`span`,{children:[`→ `,(0,i.jsx)(pl,{text:e.fix})]}):null]},t))})]}):null,c.glossary.length?(0,i.jsxs)(`section`,{children:[(0,i.jsx)(`h3`,{children:a(`handoutGlossary`)}),(0,i.jsx)(`dl`,{className:`aha-handoutGlossary`,children:c.glossary.map((e,t)=>(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`dt`,{children:(0,i.jsx)(pl,{text:e.term})}),(0,i.jsx)(`dd`,{children:(0,i.jsx)(pl,{text:e.meaning})})]},t))})]}):null,c.questions.length?(0,i.jsxs)(`section`,{children:[(0,i.jsx)(`h3`,{children:a(`handoutQuestions`)}),(0,i.jsx)(`ol`,{className:`aha-handoutQuestions`,children:c.questions.map((e,t)=>(0,i.jsxs)(`li`,{children:[(0,i.jsx)(pl,{text:e.question}),e.answer?(0,i.jsxs)(`details`,{children:[(0,i.jsx)(`summary`,{children:a(`handoutAnswer`)}),(0,i.jsx)(pl,{text:e.answer})]}):null]},t))})]}):null]})]}):(0,i.jsx)(`div`,{className:`aha-page`,children:(0,i.jsx)(Bl,{progress:s.progress,label:a(`handoutMaking`),onCancel:s.running?s.cancel:void 0})})}function Bd({item:e,day:t,today:n,onToggle:r}){let{t:a,navigate:o}=v(),s=e.kind!==`exam`&&t<=n,c=e.checked===`auto`;return(0,i.jsxs)(`div`,{className:`aha-planItem`,"data-checked":e.checked?`true`:void 0,children:[s?(0,i.jsx)(`input`,{type:`checkbox`,className:`aha-check`,checked:!!e.checked,disabled:c,title:c?a(`checkedAuto`):void 0,"aria-label":e.checked?a(`unmarkDone`):a(`markDone`),onChange:()=>r?.(e,t)}):null,(0,i.jsx)(`span`,{className:`aha-tag`,children:e.kind===`lesson`?a(`lessonItem`):e.kind===`review`?a(`reviewItem`):a(`examItem`)}),(0,i.jsxs)(`span`,{className:`aha-planTitle`,children:[e.title,(0,i.jsx)($l,{title:e.courseTitle,emoji:e.courseEmoji})]}),e.minutes?(0,i.jsx)(`span`,{className:`aha-hint`,children:a(`minutesUnit`,{minutes:e.minutes})}):null,e.kind===`lesson`&&!e.checked?(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,onClick:()=>o(`lesson`,{courseId:e.courseId,lessonId:e.refId}),children:a(`learn`)}):null,e.kind===`review`&&!e.checked&&t===n?(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,onClick:()=>o(`practice`,{courseId:e.courseId??void 0,review:!0}),children:a(`review`)}):null]})}function Vd(e,t,n,r){return t.checked===`manual`?e.call(`plan/uncheck`,{today:r,day:n,refId:t.refId}):e.call(`plan/check`,{today:r,day:n,item:t})}function Hd(e){let t=e instanceof Date?e:new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function Ud(e){let t=/^(\d{4})-(\d{2})-(\d{2})$/u.exec(String(e));if(!t)throw TypeError(`invalid day "${e}"`);return new Date(Number(t[1]),Number(t[2])-1,Number(t[3]))}let Wd=[[`course`,`modeCourse`,`🎓`],[`explain`,`modeExplain`,`💡`],[`solve`,`modeSolve`,`🧮`],[`visualize`,`modeVisualize`,`📈`],[`digest`,`modeDigest`,`📚`],[`short`,`modeShort`,`🎬`]];function Gd(){let{api:e,t,navigate:n,toast:a}=v(),[o,s]=(0,r.useState)(`course`),[c,l]=C(`craftWeb`,!0),[u,d]=(0,r.useState)(null),[f,p]=(0,r.useState)(``),[m,h]=(0,r.useState)([]),[g,_]=(0,r.useState)(!1),[b,x]=(0,r.useState)(!1),[S,w]=(0,r.useState)(null),T=y(()=>e.call(`course/list`),[]),E=y(()=>e.call(`plan/get`,{today:Hd(new Date)}),[]),D=y(()=>e.call(`samples/list`),[]),O=u??(!m.length&&c);function k(){d(!O),m.length||l(!O)}async function A(t=!1){let r=f.trim();if(w(null),o===`course`){if(!r&&!m.length)return;x(!0);try{let{job:i}=await e.call(`course/start`,{goal:r,materialIds:m,quick:t,web:O});n(`craft`,{jobId:i.id})}catch(e){w(e)}finally{x(!1)}return}if(o===`digest`){if(!m.length){_(!0);return}n(`item`,{kind:`digest`,materialId:m[0]});return}if(o===`short`){let e=/^https?:\/\//iu.test(r);n(`shorts`,{draftTopic:e?``:r,draftUrl:e?r:``,token:Date.now().toString(36)});return}r&&n(`assist`,{draftMode:o,draftRequest:r,draftMaterials:m,token:Date.now().toString(36)})}let ee=(T.value??[]).filter(e=>e.status===`ready`&&!e.archived&&e.progress.percent<100).slice(0,3),te=(T.value??[]).filter(e=>e.status!==`ready`&&!e.archived).slice(0,2),j=E.value?.today??[],ne=Hd(new Date);async function re(t,n){try{E.setValue(await Vd(e,t,n,ne))}catch(e){w(e)}}return(0,i.jsxs)(`div`,{className:`aha-page`,children:[(0,i.jsxs)(`section`,{className:`aha-hero`,children:[(0,i.jsx)(`div`,{className:`aha-heroTitle`,children:t(`heroTitle`)}),(0,i.jsx)(`p`,{className:`aha-subtitle`,children:t(`heroHint`)}),(0,i.jsxs)(`div`,{className:`aha-composer`,children:[(0,i.jsx)(`textarea`,{value:f,placeholder:t(`heroPlaceholder`),onChange:e=>p(e.currentTarget.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&A()}}),(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsxs)(`div`,{className:`aha-row`,style:{gap:6},children:[(0,i.jsxs)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,onClick:()=>_(!0),children:[(0,i.jsx)(ut,{name:`plus`,size:15}),m.length?t(`attached`,{count:m.length}):t(`attach`)]}),o===`course`?(0,i.jsxs)(`button`,{type:`button`,className:`aha-chip`,"data-active":O,"aria-pressed":O,onClick:k,title:t(`webResearchHint`),children:[`🌐 `,t(`webResearch`)]}):null]}),(0,i.jsxs)(`div`,{className:`aha-row`,style:{gap:6},children:[o===`course`?(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,disabled:b,onClick:()=>A(!0),children:t(`quickStart`)}):null,(0,i.jsxs)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,disabled:b||!f.trim()&&!m.length,onClick:()=>A(!1),children:[b?(0,i.jsx)(`span`,{className:`aha-spinner`}):null,t(`start`)]})]})]})]}),(0,i.jsx)(`div`,{className:`aha-row`,style:{gap:8},children:Wd.map(([e,n,r])=>(0,i.jsxs)(`button`,{type:`button`,className:`aha-chip`,"data-active":o===e,onClick:()=>s(e),children:[r,` `,t(n)]},e))}),(0,i.jsx)(Wl,{error:S})]}),ee.length||te.length?(0,i.jsxs)(`section`,{className:`aha-col`,children:[(0,i.jsx)(`h3`,{className:`aha-cardTitle`,children:t(`continueLearning`)}),(0,i.jsx)(`div`,{className:`aha-grid`,children:[...te,...ee].map(e=>(0,i.jsxs)(`div`,{className:`aha-card`,"data-click":`true`,onClick:()=>n(e.status===`ready`?`course`:`craft`,{courseId:e.id}),children:[(0,i.jsxs)(`div`,{className:`aha-row`,children:[(0,i.jsx)(`span`,{style:{fontSize:24},children:e.emoji}),(0,i.jsx)(`span`,{className:`aha-cardTitle`,children:e.title})]}),e.status===`ready`?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(zl,{value:e.progress.percent}),(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsx)(`span`,{className:`aha-hint`,children:t(`lessonsCount`,e.progress)}),e.next?(0,i.jsx)(`span`,{className:`aha-hint`,children:t(`nextUp`,{title:e.next.title})}):null]}),e.next?(0,i.jsxs)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,onClick:t=>{t.stopPropagation(),n(`lesson`,{courseId:e.id,lessonId:e.next.lessonId})},children:[(0,i.jsx)(ut,{name:`play`,size:14}),t(`continueLearning`)]}):null]}):(0,i.jsx)(`span`,{className:`aha-tag`,children:e.status===`intake`?t(`statusIntake`):t(`statusBlueprint`)})]},e.id))})]}):null,(0,i.jsxs)(`section`,{className:`aha-col`,children:[(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsx)(`h3`,{className:`aha-cardTitle`,children:t(`todayPlan`)}),(0,i.jsxs)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,"data-size":`sm`,onClick:()=>n(`plan`),children:[t(`navPlan`),` →`]})]}),E.loading&&!E.value?(0,i.jsx)(Rl,{}):j.length?(0,i.jsx)(`div`,{className:`aha-col`,style:{gap:6},children:j.map(e=>(0,i.jsx)(`div`,{className:`aha-card`,style:{padding:`6px 14px`},children:(0,i.jsx)(Bd,{item:e,day:ne,today:ne,onToggle:re})},`${e.kind}:${e.refId}`))}):(0,i.jsx)(Gl,{children:t(`noPlanToday`)})]}),D.value?.length?(0,i.jsxs)(`section`,{className:`aha-col`,children:[(0,i.jsx)(`h3`,{className:`aha-cardTitle`,children:t(`sampleCourses`)}),(0,i.jsx)(`p`,{className:`aha-hint`,children:t(`sampleHint`)}),(0,i.jsx)(`div`,{className:`aha-grid`,children:D.value.map(r=>(0,i.jsxs)(`div`,{className:`aha-card`,children:[(0,i.jsxs)(`div`,{className:`aha-row`,children:[(0,i.jsx)(`span`,{style:{fontSize:24},children:r.emoji}),(0,i.jsx)(`span`,{className:`aha-cardTitle`,children:r.title})]}),(0,i.jsx)(`p`,{className:`aha-hint`,children:r.subtitle}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,onClick:async()=>{try{let i=await e.call(`samples/import`,{id:r.id});a(t(`courseReady`)),n(`course`,{courseId:i.id})}catch(e){a(Ul(t,e))}},children:t(`importSample`)})]},r.id))})]}):null,g?(0,i.jsx)(Yl,{selected:m,onChange:h,onClose:()=>_(!1)}):null]})}let Kd=`http://www.w3.org/2000/svg`,qd=new Set([`SCRIPT`,`STYLE`,`TEMPLATE`,`IFRAME`,`BUTTON`,`INPUT`,`TEXTAREA`,`SELECT`]),Jd=[`Top`,`Right`,`Bottom`,`Left`],Yd=[`fill`,`fill-opacity`,`fill-rule`,`stroke`,`stroke-width`,`stroke-opacity`,`stroke-dasharray`,`stroke-dashoffset`,`stroke-linecap`,`stroke-linejoin`,`stroke-miterlimit`,`opacity`,`font-family`,`font-size`,`font-style`,`font-weight`,`text-anchor`,`dominant-baseline`],Xd=typeof Intl<`u`&&typeof Intl.Segmenter==`function`?new Intl.Segmenter(void 0,{granularity:`grapheme`}):null;function Zd(e){if(Xd)return Array.from(Xd.segment(e),e=>({index:e.index,text:e.segment}));let t=[],n=0;for(let r of e)t.push({index:n,text:r}),n+=r.length;return t}function Qd(e){if(!e||e===`transparent`||e===`none`)return!1;let t=/^(?:rgba?|hsla?|color|lab|lch|oklab|oklch)\((.*)\)$/u.exec(e.trim());if(!t)return!0;let n=t[1],r=n.includes(`/`)?n.split(`/`).pop():n.split(`,`).length===4?n.split(`,`).pop():null;return r===null||Number.parseFloat(r)>0}function $d(e){if(!e||!e.startsWith(`linear-gradient(`))return[];let t=e.slice(16);if(/^\s*(?:to\s+(?!bottom)|-?[\d.]+(?:deg|turn|rad))/u.test(t)&&!/^\s*180deg/u.test(t))return[];let n=[...t.matchAll(/((?:rgba?|hsla?|color|oklab|oklch|lab|lch)\([^)]*\)|transparent|#[0-9a-f]{3,8})\s+(-?[\d.]+)%/giu)].map(e=>({color:e[1],at:Number.parseFloat(e[2])/100})),r=[];for(let e=0;e+1<n.length;e+=1){let[t,i]=[n[e],n[e+1]];t.color===i.color&&Qd(t.color)&&i.at>t.at&&r.push({color:t.color,from:Math.max(0,t.at),to:Math.min(1,i.at)})}return r}function ef(e,t,n){let[r,i=r]=String(e||`0`).trim().split(/\s+/u),a=(e,t)=>e.endsWith(`%`)?Number.parseFloat(e)/100*t:Number.parseFloat(e)||0;return{x:a(r,t),y:a(i,n)}}function tf(e,t,n){let r=[e.borderTopLeftRadius,e.borderTopRightRadius,e.borderBottomRightRadius,e.borderBottomLeftRadius].map(e=>ef(e,t,n));return r.some(e=>e.x>0&&e.y>0)?r:null}function nf(e){return`${e.fontStyle.startsWith(`oblique`)?`italic`:e.fontStyle} ${e.fontWeight} ${e.fontSize} ${e.fontFamily}`}function rf(e,t){if(!e)return t;if(!t)return e;let n=Math.max(e.x,t.x),r=Math.max(e.y,t.y);return{x:n,y:r,w:Math.max(0,Math.min(e.x+e.w,t.x+t.w)-n),h:Math.max(0,Math.min(e.y+e.h,t.y+t.h)-r)}}function af(e,t){let n=Math.min(e.x,t.x),r=Math.min(e.y,t.y);return{x:n,y:r,w:Math.max(e.x+e.w,t.x+t.w)-n,h:Math.max(e.y+e.h,t.y+t.h)-r}}function of(e,t){return e===`dashed`?[t*3,t*2.2]:e===`dotted`?[.01,t*2]:null}async function sf(e,{timeoutMs:t=1e4}={}){e.offsetHeight,await new Promise(e=>{setTimeout(e,50)});let n=document.fonts;if(!n)return;let r=(e.textContent??``).slice(0,2e4),i=[`Aha Hand Latin`,`Aha Hand`].map(e=>n.load?.(`20px '${e}'`,r).catch(()=>void 0));await Promise.race([Promise.all([...i,n.ready]),new Promise(e=>{setTimeout(e,t)})])}function cf(e){for(let t of e.querySelectorAll(`.aha-op-math`))xc(t);for(let t of e.querySelectorAll(`.aha-op-table`)){let e=t.closest(`.aha-op`)?.clientWidth??0;if(!e||t.offsetWidth<=e+1)continue;let n=e/t.offsetWidth,r=getComputedStyle(t);t.style.fontSize=`${Math.max(10,(Number.parseFloat(r.fontSize)||16)*n)}px`,t.style.lineHeight=`${Math.max(14,(Number.parseFloat(r.lineHeight)||24)*n)}px`}}function lf(e,{scale:t=2}={}){let n=e.getBoundingClientRect(),r=[],i=new Map,a=document.createElement(`canvas`).getContext(`2d`),o=document.createRange(),s=e=>({x:e.left-n.left,y:e.top-n.top,w:e.width,h:e.height}),c=e=>{let t=i.get(e);if(!t){a.font=e;let n=a.measureText(`Hg`),r=Number.parseFloat(/([\d.]+)px/u.exec(e)?.[1]??`16`);t={ascent:Number.isFinite(n.fontBoundingBoxAscent)?n.fontBoundingBoxAscent:r*.8,descent:Number.isFinite(n.fontBoundingBoxDescent)?n.fontBoundingBoxDescent:r*.2},i.set(e,t)}return t},l=getComputedStyle(e);r.push({kind:`paper`,w:n.width,h:n.height,paper:l.getPropertyValue(`--paper`).trim()||l.backgroundColor,dot:l.getPropertyValue(`--grid`).trim()});let u=(e,t)=>{let i=e.data;if(!i||!/\S/u.test(i))return;let a=getComputedStyle(e.parentElement);if(!Qd(a.color))return;let s=nf(a),{ascent:l}=c(s),u=null,d=()=>{u&&/\S/u.test(u.text)&&r.push({kind:`text`,text:u.text,x:u.x,y:u.top+l,font:s,color:a.color,alpha:t.alpha,clip:t.clip}),u=null};for(let t of Zd(i)){if(t.text===`
|
|
271
|
-
`||t.text===`\r`||t.text===` `){d();continue}o.setStart(e,t.index),o.setEnd(e,t.index+t.text.length);let r=o.getClientRects(),i=r[r.length-1];if(!i||i.width<=0){/\s/u.test(t.text)||d();continue}let a=i.left-n.left,s=i.top-n.top;u&&Math.abs(s-u.top)<1&&Math.abs(a-u.right)<1?(u.text+=t.text,u.right=a+i.width):(d(),u={text:t.text,x:a,top:s,right:a+i.width})}d()},d=(e,t,n,i,a)=>{let o=t.backgroundColor,c
|
|
269
|
+
`).filter(e=>e.trim()).map((e,t)=>(0,i.jsx)(vu,{text:e,compact:!0},t))}):null]}):null,m.hints?.length&&!j?(0,i.jsxs)(`div`,{className:`aha-col`,style:{gap:4},children:[m.hints.slice(0,b).map((e,t)=>(0,i.jsxs)(`div`,{className:`aha-hint`,children:[`💡 `,e]},t)),b<m.hints.length?(0,i.jsx)(`div`,{children:(0,i.jsxs)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,"data-kind":`ghost`,onClick:()=>x(e=>e+1),children:[p(`hint`),` (`,b+1,`/`,m.hints.length,`)`]})}):null]}):null,s&&!j?(0,i.jsxs)(`div`,{className:`aha-row aha-confidence`,style:{gap:6},"data-nudge":O&&!_?`true`:void 0,children:[(0,i.jsx)(`span`,{className:`aha-hint`,children:p(`confidence`)}),Vu.map(([e,t])=>(0,i.jsx)(`button`,{type:`button`,className:`aha-chip`,"data-active":_===e,onClick:()=>{y(e),k(!1)},children:p(t)},e))]}):null,(0,i.jsx)(Wl,{error:E}),j?(0,i.jsxs)(`div`,{className:`aha-feedback`,"data-ok":j.correct?`true`:j.partial?void 0:`false`,children:[(0,i.jsxs)(`b`,{children:[j.correct?p(`correct`):j.partial?p(`partial`):p(`incorrect`),j.regraded?p(`regraded`):``]}),j.feedback?(0,i.jsx)(vu,{text:j.feedback,compact:!0}):null,m.explanation?(0,i.jsx)(vu,{text:m.explanation,compact:!0}):null,j.wrongStep?(0,i.jsxs)(`div`,{className:`aha-wrongStep`,children:[(0,i.jsx)(`span`,{className:`aha-hint`,children:p(`wrongStep`)}),(0,i.jsx)(vu,{text:j.wrongStep,compact:!0}),j.fix?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`span`,{className:`aha-hint`,children:p(`fixedStep`)}),(0,i.jsx)(vu,{text:j.fix,compact:!0})]}):null]}):null,m.kind!==`short`&&m.kind!==`work`&&!j.correct?(0,i.jsx)(`div`,{className:`aha-hint`,children:Wu(m)}):null,u&&A===null&&d?.status!==`checking`?(0,i.jsxs)(`button`,{type:`button`,className:`aha-itemFlag`,onClick:()=>ee(``),children:[`🧐 `,p(`itemChallenge`)]}):null]}):null,j&&A!==null?(0,i.jsxs)(`form`,{className:`aha-challengeBox aha-itemChallenge`,onSubmit:ae,children:[(0,i.jsx)(`b`,{children:p(`itemChallengeTitle`)}),(0,i.jsx)(`textarea`,{className:`aha-textarea`,rows:2,autoFocus:!0,value:A,placeholder:p(`itemChallengePlaceholder`),onChange:e=>{let t=e.currentTarget.value;ee(e=>e===null?e:t)},onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&ae(e),e.key===`Escape`&&ee(null)}}),(0,i.jsxs)(`div`,{className:`aha-challengeActions`,children:[(0,i.jsx)(Bu,{onText:e=>ee(t=>t===null?t:t.trim()?`${t.trimEnd()} ${e}`:e)}),(0,i.jsx)(`span`,{className:`aha-challengeHint`,children:p(`itemChallengeHint`)}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,onClick:()=>ee(null),children:p(`cancel`)}),(0,i.jsx)(`button`,{type:`submit`,className:`aha-btn`,"data-kind":`primary`,children:p(`challengeSend`)})]})]}):null,j&&d?(0,i.jsxs)(`div`,{className:`aha-itemCheck`,"data-verdict":d.status===`done`?d.verdict:void 0,role:`status`,children:[(0,i.jsx)(`span`,{className:`aha-hint`,children:p(`itemCheckTitle`)}),d.status===`checking`?(0,i.jsxs)(`span`,{className:`aha-row`,style:{gap:6},children:[(0,i.jsx)(`span`,{className:`aha-spinner`}),p(`itemChecking`)]}):null,d.status===`done`?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`b`,{children:p(lu[d.verdict]??lu.right)}),d.summary?(0,i.jsx)(vu,{text:d.summary,compact:!0}):null,d.explanation?(0,i.jsx)(vu,{text:d.explanation,compact:!0}):null,d.earlier?(0,i.jsx)(`span`,{className:`aha-hint`,children:p(`itemCheckEarlier`,{count:d.earlier}).trim()}):null]}):null,d.status===`failed`?(0,i.jsxs)(`div`,{className:`aha-row`,style:{gap:6},children:[(0,i.jsx)(Wl,{error:d.error}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,onClick:()=>u?.(d.note??``),children:p(`retry`)})]}):null]}):null,(0,i.jsxs)(`div`,{className:`aha-row aha-itemActions`,children:[j?null:(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,disabled:!re||w,onClick:ie,children:w?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`span`,{className:`aha-spinner`}),p(`grading`)]}):p(`submit`)}),j&&a?(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,onClick:a,children:o??p(`continue`)}):null,!j&&a?(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,onClick:a,children:p(`skip`)}):null]})]})}function Uu({svg:e,plot:t}){let n=(0,r.useMemo)(()=>lc(t?nc(t):e),[e,t]);return n?(0,i.jsx)(`div`,{className:`aha-itemFigure`,dangerouslySetInnerHTML:{__html:n}}):null}function Wu(e){return e.kind===`choice`?`✔ ${e.answer.toUpperCase()}. ${e.options.find(t=>t.id===e.answer)?.text??``}`:e.kind===`multi`?`✔ ${e.answer.map(e=>e.toUpperCase()).join(`, `)}`:e.kind===`order`?`✔ ${e.answer.map(t=>e.options.find(e=>e.id===t)?.text??t).join(` → `)}`:e.kind===`number`?`✔ ${e.answer}${e.unit?` ${e.unit}`:``}`:e.kind===`blank`?`✔ ${e.answer.join(` / `)}`:``}let Gu=[[`thinking`,`prepThinking`],[`writing`,`prepWriting`]];function Ku(e){if(!((e?.thinking??0)>0))return null;let t=Gu.findIndex(([t])=>t===e.phase);return Gu.map(([e,n],r)=>({name:e,key:n,state:r<t?`done`:r===t?`now`:`next`}))}function qu({prep:e,label:t,first:n,hand:a=!0}){let{t:o}=v(),[s,c]=(0,r.useState)(()=>performance.now());(0,r.useEffect)(()=>{if(!n)return;let e=setInterval(()=>c(performance.now()),1e3);return()=>clearInterval(e)},[n]);let l=e.phase??`starting`,u=n?Ku(e):null,d=Math.max(0,Math.round(((e.elapsedMs??0)+s-(e.receivedAt??s))/1e3));return(0,i.jsxs)(`div`,{className:`aha-prep`,role:`status`,"aria-live":`polite`,children:[(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsxs)(`span`,{className:`aha-row`,style:{gap:8,flexWrap:`nowrap`},children:[(0,i.jsx)(`span`,{className:`aha-spinner`}),(0,i.jsx)(`b`,{children:t})]}),n?(0,i.jsx)(`span`,{className:`aha-hint`,children:o(`prepSeconds`,{seconds:d})}):null]}),u?(0,i.jsx)(`ol`,{className:`aha-prepStages`,children:u.map(e=>(0,i.jsx)(`li`,{"data-state":e.state,children:o(e.key)},e.name))}):null,(0,i.jsx)(`div`,{className:`aha-prepNow`,children:l===`writing`?(0,i.jsxs)(i.Fragment,{children:[o(`prepStep`,{n:(e.steps??0)+1}),e.current?(0,i.jsxs)(i.Fragment,{children:[`:`,(0,i.jsx)(`span`,{className:`aha-prepHint`,"data-hand":a?`true`:void 0,children:(0,i.jsx)(pl,{text:e.current})})]}):`…`]}):l===`thinking`?o(`prepThinkingDetail`,{chars:(e.thinking??0).toLocaleString()}):o(`prepStarting`)}),l===`writing`?(0,i.jsx)(`div`,{className:`aha-hint`,children:o(`prepCounts`,{steps:e.steps??0,chars:(e.chars??0).toLocaleString()})}):null]})}let Ju=[.75,1,1.25,1.5,2],Yu=[[`analogy`,`styleAnalogy`],[`visual`,`styleVisual`],[`example`,`styleExample`],[`simpler`,`styleSimpler`],[`deeper`,`styleDeeper`]];function Xu({id:e,kind:t,label:n,anchorId:r,steps:i=[],streaming:a=!1,serverId:o}){return{id:e,kind:t,label:n,anchorId:r,streaming:a,serverId:o,steps:ul(i,`${e}_`).map(e=>({...e,anchorId:r}))}}let Zu=e=>{let t=[...String(e??``).replace(/\s+/gu,` `).trim()];return t.length>28?`${t.slice(0,28).join(``)}…`:t.join(``)};function Qu({scope:e,title:t,crumb:n,steps:a=[],stream:o=null,asides:s=[],objectives:c=[],language:l,startIndex:u=0,autoplay:d=!0,onPosition:p,onEnded:m,onStreamDone:h,header:g,stageClass:_,recordChecks:y=!0,reveal:b,tour:x=!0,talkKey:T=!0}){let{api:E,t:D,speech:O,settings:k,dsh:A}=v(),ee=w(),te=k.boardTheme===`dark`||k.boardTheme!==`light`&&ee?`dark`:`light`,j=e=>D(Yu.find(([t])=>t===e)?.[1]??`reexplain`),ne=e=>e?D(`correctionOf`,{tag:e}):D(`correction`),re=(e,t)=>[e||D(`challengeLabel`),t?D(`challenge_${t}`):``].filter(Boolean).join(` · `),[ie,ae]=(0,r.useState)(a),[oe,se]=(0,r.useState)(()=>s.map(e=>Xu({id:e.id,kind:e.kind,label:e.kind===`question`?e.question:e.kind===`correction`?ne(e.errorTag):e.kind===`challenge`?re(e.note,e.verdict):D(`reexplainedAs`,{style:j(e.style)}),anchorId:e.anchorStepId,steps:e.steps??[],serverId:e.id}))),ce=(0,r.useRef)([]),[le,ue]=C(`classPanel`,!0),[de,fe]=C(`classTourSeen`,!1),[pe,me]=(0,r.useState)(!1),he=x&&!de,ge=(0,r.useRef)(null),_e=(0,r.useRef)(null),ve=(0,r.useRef)(null),ye=(0,r.useRef)(null),be=(0,r.useRef)(!1),xe=(0,r.useRef)(null),[Se,Ce]=(0,r.useState)(!o),[we,Te]=(0,r.useState)(null),[Ee,De]=(0,r.useState)(!0),[Oe,ke]=(0,r.useState)(!1),[Ae,je]=(0,r.useState)(null),Me=(0,r.useRef)({failures:0,down:!1}),[Ne,Pe]=(0,r.useState)(!1),[Fe,Ie]=(0,r.useState)(``),[Le,Re]=(0,r.useState)(null),[ze,Be]=(0,r.useState)(null),[Ve,He]=(0,r.useState)(null),Ue=(0,r.useRef)(new Set),[We,Ge]=(0,r.useState)(!1),[Ke,qe]=(0,r.useState)(null),[Je,Ye]=(0,r.useState)(null),Xe=(0,r.useRef)(0),Ze=(0,r.useRef)(null);Ze.current||=new AbortController,(0,r.useEffect)(()=>()=>Ze.current.abort(),[]),(0,r.useEffect)(()=>{Mu(ge.current)},[b]);let M=(0,r.useMemo)(()=>{let e=[];for(let t of ie){e.push(t);for(let n of oe)n.anchorId===t.id&&e.push(...n.steps)}return e},[ie,oe]),Qe=(0,r.useMemo)(()=>{let e=oe.find(e=>e.streaming),t=e?M.findIndex(t=>t.id===e.anchorId):-1;if(t<0)return null;let n=t+1;for(;n<M.length&&M[n].aside;)n+=1;return n},[M,oe]),$e=(0,r.useMemo)(()=>Qe===null?M:M.slice(0,Qe),[M,Qe]),et=(0,r.useRef)(null);et.current=e=>{if(Me.current.down)return;let t=tt(Me.current.failures,e);Me.current.failures=t.failures,t.stop&&(Me.current.down=!0,O.configure({engine:`off`}),je({engine:k.voiceEngine??`browser`,...t.stop,dismissed:!1}))};let N=(0,r.useMemo)(()=>{let e=ie[Math.min(u,ie.length-1)]?.id,t=e?M.findIndex(t=>t.id===e):-1;return Al({speech:O,onChange:Te,onNarration:e=>et.current(e),startIndex:t>=0?t:u})},[O]);(0,r.useEffect)(()=>()=>N.dispose(),[N]),(0,r.useEffect)(()=>{N.setSteps($e,{done:Se&&Qe===null})},[N,$e,Se,Qe]);let nt=Oe||Ae?`off`:k.voiceEngine??`browser`;(0,r.useEffect)(()=>{O.configure({engine:nt,voiceId:k.voiceId||void 0,language:l})},[O,nt,k.voiceId,l]),(0,r.useEffect)(()=>{N.setRate(k.voiceRate??1)},[N,k.voiceRate]);let[rt,it]=(0,r.useState)(null);(0,r.useEffect)(()=>{if(!o)return;let e=new AbortController;return Ce(!1),E.follow({job:o},{signal:e.signal,onPartial:e=>ae(t=>{let n=new Set(t.map(e=>e.id)),r=e.filter(e=>!n.has(e.id));return r.length?[...t,...r]:t}),onPreview:(e,t)=>it(e?.phase?{...e,elapsedMs:t?.elapsedMs??0,receivedAt:performance.now()}:null)}).then(e=>{let t=e?.board??e?.item?.board??e;t?.steps?.length&&ae(ce.current.length?bt(t.steps,ce.current).steps:t.steps),it(null),Ce(!0),h?.(e)}).catch(t=>{e.signal.aborted||(it(null),Ye(t),Ce(!0))}),()=>e.abort()},[o]);let at=(0,r.useRef)(!1);(0,r.useEffect)(()=>{!d||at.current||!M.length||he||(at.current=!0,N.play())},[M.length,d,N,he]),(0,r.useEffect)(()=>{he&&M.length&&me(!0)},[he,M.length>0]);let ot=()=>{me(!1),fe(!0)},st=we?.index??0,[lt,ut]=(0,r.useState)(null);(0,r.useEffect)(()=>{ut(e=>Nl(M,st,e))},[st,M]);let dt=Math.max(0,M.findIndex(e=>e.id===lt)),ft=we?.status===`ended`&&Se,pt=(0,r.useRef)(!1);(0,r.useEffect)(()=>{ft&&!pt.current&&(pt.current=!0,m?.()),ft||(pt.current=!1)},[ft]),(0,r.useEffect)(()=>{let e=e=>{Fu(e.target)||(e.key===` `?(e.preventDefault(),N.toggle()):e.key===`ArrowRight`?N.next():e.key===`ArrowLeft`?N.prev():T&&!pe&&Pu(e)&&!e.repeat&&(e.preventDefault(),ve.current?ve.current.press(e.timeStamp):(ye.current={down:e.timeStamp,up:null},ue(!0))))},t=e=>{!T||!Pu(e)||(ye.current?ye.current.up=e.timeStamp:ve.current?.release(e.timeStamp))};return window.addEventListener(`keydown`,e),window.addEventListener(`keyup`,t),()=>{window.removeEventListener(`keydown`,e),window.removeEventListener(`keyup`,t)}},[N,T,pe]),(0,r.useEffect)(()=>{let e=ye.current;!le||!e||!ve.current||(ye.current=null,ve.current.press(e.down),e.up!==null&&ve.current.release(e.up))},[le]);let mt=(0,r.useCallback)(e=>{for(let t=Math.min(e,M.length-1);t>=0;--t)if(!M[t]?.aside)return M[t]?.id;return ie[0]?.id},[M,ie]),ht=(0,r.useCallback)(e=>{let t=Math.max(0,Math.min(e,M.length-1)),n=M[t]?.aside?mt(t):M[t]?.id;return Math.max(0,ie.findIndex(e=>e.id===n))},[M,ie,mt]);(0,r.useEffect)(()=>{we&&p?.(ht(st))},[st]),(0,r.useEffect)(()=>{if(!Le)return;let e=$e.findIndex(e=>e.id===Le);if(e>=0){Re(null);let{index:t,status:n}=N.state;(t!==e||n!==`playing`)&&N.seek(e)}},[$e,Le,N]);async function gt({endpoint:t,payload:n,kind:r,label:i,anchorIndex:a,onStarted:s,onAdded:c,onFailed:l,onResult:u}){let d=mt(a);Xe.current+=1;let p=`a${Xe.current}`,m=Ze.current.signal,h=!1,g=e=>{let t=Xu({id:p,kind:r,label:i,anchorId:d,steps:e,streaming:!0});se(e=>e.map(e=>e.id===p?{...e,steps:t.steps}:e)),!h&&t.steps.length&&(h=!0,Pe(!1),Re(t.steps[0].id))},_=!1;Ye(null);try{let{job:l}=await E.call(t,{...n,scope:f(e,o),stepIndex:ht(a),anchorStepId:d});s?.(),se(e=>[...e,Xu({id:p,kind:r,label:i,anchorId:d,streaming:!0})]),_=!0,c?.(p);let h=[],v=await E.follow({job:l},{signal:m,onPartial:e=>{h.push(...e),g([...h])}});g(v?.steps?.length?v.steps:h),se(e=>e.map(e=>e.id===p?{...e,streaming:!1,serverId:v?.aside?.id}:e)),Pe(!1),u?.(v,p)}catch(e){if(m.aborted)return;se(e=>e.flatMap(e=>e.id===p?e.steps.length?[{...e,streaming:!1}]:[]:[e])),Pe(!1),r===`question`&&!h&&Ie(e=>e||i),_||l?.(),Ye(e)}}async function _t(e){e?.preventDefault();let t=Fe.trim();t&&(be.current&&_e.current?.blur(),be.current=!1,N.pause(),Pe(`answering`),await gt({endpoint:`lesson/ask`,payload:{question:t},kind:`question`,label:t,anchorIndex:st,onStarted:()=>Ie(``)}))}async function vt(e){Ge(!1),N.pause(),Pe(`reexplaining`),await gt({endpoint:`lesson/reexplain`,payload:{style:e},kind:`reexplain`,label:D(`reexplainedAs`,{style:j(e)}),anchorIndex:Math.max(0,Math.min(st,M.length-1))})}async function yt(e,t){Pe(`correcting`),await gt({endpoint:`lesson/correct`,payload:{item:{prompt:e.prompt,answer:e.answer},response:t.response,grade:{feedback:t.feedback,errorTag:t.errorTag,wrongStep:t.wrongStep,why:t.why,fix:t.fix}},kind:`correction`,label:ne(t.errorTag),anchorIndex:st,onAdded:t=>He({checkId:e.id,asideId:t}),onFailed:()=>N.answer(e.id)})}(0,r.useEffect)(()=>{!Ve||!oe.some(e=>e.id===Ve.asideId)||(He(null),N.answer(Ve.checkId))},[oe,Ve,N]);function St(e){N.pause(),Ge(!1),qe({index:Math.max(0,Math.min(e,M.length-1)),note:``})}function Ct(t){let n=M[t];if(!n?.aside)return n?{stepId:n.id}:null;let r=oe.find(e=>n.id.startsWith(`${e.id}_`));return!r||r.streaming?null:r.serverId&&e.kind===`lesson`?{stepId:n.id.slice(r.id.length+1),asideId:r.serverId}:{step:{id:n.id,say:n.say,ops:n.ops.map(({fixed:e,...t})=>t)}}}async function wt(e){if(e?.preventDefault(),!Ke)return;let t=Ct(Ke.index),n=Ke.note.trim();qe(null),t&&(N.pause(),Pe(`checking`),await gt({endpoint:`lesson/challenge`,payload:{target:t,note:n},kind:`challenge`,label:re(n),anchorIndex:st,onResult:(e,t)=>{se(r=>r.map(r=>r.id===t?{...r,label:re(n,e?.verdict)}:r));let r=Array.isArray(e?.fixes)?e.fixes:[];r.length&&(e.target?.main?(ce.current.push(...r),ae(e=>bt(e,r).steps)):e.target?.asideId?se(t=>t.map(t=>t.serverId===e.target.asideId?{...t,steps:bt(t.steps,xt(r,`${t.id}_`)).steps}:t)):se(e=>e.map(e=>({...e,steps:bt(e.steps,r).steps}))))}}))}function Tt(){N.pause(),ue(!0),setTimeout(()=>_e.current?.focus(),0)}let Et=ht(st),Dt=(0,r.useMemo)(()=>jl(ie,Et,c.length,we?.status===`ended`&&Se),[ie,Et,c.length,we?.status,Se]),Ot=(0,r.useMemo)(()=>Ml(M,Math.max(dt,st),oe),[M,dt,st,oe]);(0,r.useEffect)(()=>{let e=xe.current;e&&(e.scrollTop=e.scrollHeight)},[Ot.length,le]);let kt=we?.step,At=we?.status===`check`?kt?.check:null,jt=(0,r.useMemo)(()=>ol(kt?.say),[kt?.say]),Mt=jt[Math.min(we?.sentence??0,jt.length-1)]??``;function Nt(t){Be({checkId:At?.id,result:t}),!(!y||e.kind!==`lesson`)&&E.call(`lesson/record`,{courseId:e.courseId,lessonId:e.lessonId,conceptIds:At?.conceptIds??[],evidence:{kind:`check`,score:t.score,confidence:t.confidence,hintsUsed:t.hintsUsed,timeMs:t.timeMs,expectedMs:4e4,errorTag:t.errorTag},...kt?.id&&!kt.aside?{source:{kind:`check`,courseId:e.courseId,lessonId:e.lessonId,stepId:kt.id},response:t.given??t.response??``}:{}}).catch(()=>void 0)}let Pt=we?.status??`idle`,P=(Pt===`buffering`||!M.length&&!Se)&&!Je,Ft=M.length+ +!Se,It=oe.find(e=>e.streaming),Lt=Ne===`answering`||It?.kind===`question`?D(`answering`):Ne===`correcting`||It?.kind===`correction`?D(`correcting`):Ne===`checking`||It?.kind===`challenge`&&!It.steps.length?D(`checkingStep`):Ne===`reexplaining`||It?D(`generating`):M.length?D(`bufferingLesson`):D(`preparingLesson`),Rt=S(P&&!Ne&&!It&&!Se,3e3)&&!!rt,zt=Dt?Dt.filter(e=>e===`done`).length:0,Bt=!!It||!!Ne,Vt=At?.kind===`work`&&ze?.checkId===At.id&&!ze.result.correct&&!!ze.result.response?.trim();function Ht(){if(At){if(Vt){if(Ue.current.has(At.id))return;Ue.current.add(At.id),yt(At,ze.result);return}N.answer(At.id)}}function Ut({replay:e}){Me.current={failures:0,down:!1},je(null),ke(!1),O.configure({engine:k.voiceEngine??`browser`}),e&&(Pt===`playing`||Pt===`paused`)&&N.seek(st)}let Wt=Oe||!!Ae,Gt=!Ae||Ae.dismissed?null:Ae.engine===`cloud`?D(`voiceDownCloud`,{reason:Ul(D,Ae)}):D(`voiceDownSystem`,{reason:Ul(D,Ae)});return(0,i.jsxs)(`div`,{ref:ge,className:`aha-class`,"data-panel":le?`open`:`closed`,children:[(0,i.jsxs)(`div`,{className:`aha-classBar`,children:[(0,i.jsxs)(`div`,{className:`aha-col`,style:{gap:0},children:[n?(0,i.jsx)(`span`,{className:`aha-crumb`,children:n}):null,(0,i.jsx)(`span`,{className:`aha-cardTitle`,children:t})]}),(0,i.jsxs)(`div`,{className:`aha-row`,children:[x?(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,"data-size":`sm`,title:D(`tourReplay`),"aria-label":D(`tourReplay`),onClick:()=>{N.pause(),me(!0)},children:`?`}):null,typeof g==`function`?g({steps:M}):g]})]}),(0,i.jsxs)(`div`,{className:`aha-classBody`,children:[(0,i.jsxs)(`div`,{className:`aha-classMain`,children:[(0,i.jsxs)(`div`,{className:`aha-stage ${_??``}`,children:[(0,i.jsx)(Dl,{steps:M,position:we?{index:we.index,op:we.op,progress:we.progress,now:we.now}:{index:0,op:0,progress:0},theme:te,font:k.boardFont===`standard`?`standard`:`hand`,view:k.boardView===`pages`?`pages`:`canvas`,buffering:(P||!!Ne)&&!Rt,bufferingLabel:Lt,onInteract:()=>N.pause()}),Rt?(0,i.jsx)(qu,{prep:rt,label:Lt,first:!M.length,hand:k.boardFont!==`standard`}):null,At?(0,i.jsxs)(`div`,{className:`aha-checkCard`,children:[(0,i.jsx)(`div`,{className:`aha-spread`,children:(0,i.jsx)(`b`,{children:D(`checkTitle`)})}),(0,i.jsx)(Hu,{item:At,language:l,onResult:Nt,onContinue:Ht,continueLabel:Vt?D(`seeCorrection`):void 0,keyboard:!0})]}):null]}),Ee&&Mt?(0,i.jsx)(`div`,{className:`aha-caption`,children:(0,i.jsx)(pl,{text:Mt})}):(0,i.jsx)(`div`,{className:`aha-caption`}),(0,i.jsx)(Wl,{error:Je,style:{textAlign:`center`}}),Ke?(0,i.jsxs)(`form`,{className:`aha-challengeBox`,onSubmit:wt,children:[(0,i.jsx)(`b`,{children:Ke.index===st?D(`challengeTitle`):D(`challengeTitleStep`,{n:Ke.index+1,text:Zu(M[Ke.index]?.say)})}),(0,i.jsx)(`textarea`,{className:`aha-textarea`,rows:2,autoFocus:!0,value:Ke.note,placeholder:D(`challengePlaceholder`),onChange:e=>{let t=e.currentTarget.value;qe(e=>e&&{...e,note:t})},onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&wt(e),e.key===`Escape`&&qe(null)}}),(0,i.jsxs)(`div`,{className:`aha-challengeActions`,children:[(0,i.jsx)(Bu,{onStart:()=>N.pause(),onText:e=>qe(t=>t&&{...t,note:t.note.trim()?`${t.note.trimEnd()} ${e}`:e})}),(0,i.jsx)(`span`,{className:`aha-challengeHint`,children:D(`challengeHint`)}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,onClick:()=>qe(null),children:D(`cancel`)}),(0,i.jsx)(`button`,{type:`submit`,className:`aha-btn`,"data-kind":`primary`,disabled:!Ct(Ke.index),children:D(`challengeSend`)})]})]}):null,Gt?(0,i.jsxs)(`div`,{className:`aha-voiceNote`,role:`status`,children:[(0,i.jsxs)(`span`,{className:`aha-voiceNoteText`,children:[`🔇 `,Gt]}),(0,i.jsxs)(`span`,{className:`aha-voiceNoteActions`,children:[(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,onClick:()=>Ut({replay:!0}),children:D(`retry`)}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,"data-kind":`ghost`,onClick:()=>ct(A,`settings`),children:D(`openSettings`)}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,"data-kind":`ghost`,onClick:()=>je(e=>e&&{...e,dismissed:!0}),title:D(`close`),"aria-label":D(`close`),children:`×`})]})]}):null,(0,i.jsxs)(`div`,{className:`aha-controls`,children:[(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,onClick:()=>N.prev(),title:D(`prevStep`),"aria-label":D(`prevStep`),children:`⏮`}),(0,i.jsxs)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,onClick:()=>N.toggle(),disabled:!M.length,"aria-label":D(Pt===`playing`?`pause`:`play`),children:[Pt===`playing`?`⏸`:`▶`,` `,D(Pt===`playing`?`pause`:`play`)]}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,onClick:()=>N.next(),title:D(`nextStep`),"aria-label":D(`nextStep`),children:`⏭`}),(0,i.jsx)(`span`,{className:`aha-tag`,children:D(`stepOf`,{current:Math.min(st+1,Math.max(1,M.length)),total:Math.max(Ft,1)})}),(0,i.jsx)(`select`,{className:`aha-select`,style:{width:`auto`},value:we?.rate??1,onChange:e=>N.setRate(Number(e.currentTarget.value)),"aria-label":D(`speed`),children:Ju.map(e=>(0,i.jsxs)(`option`,{value:e,children:[e,`×`]},e))}),(0,i.jsx)(`button`,{type:`button`,className:`aha-chip`,"data-active":!Wt,onClick:()=>Ae?Ut({replay:!1}):ke(e=>!e),children:Wt?`🔇 ${D(`voiceOff`)}`:`🔊 ${D(`voiceOn`)}`}),(0,i.jsxs)(`button`,{type:`button`,className:`aha-chip`,"data-active":Ee,onClick:()=>De(e=>!e),children:[`CC `,D(`captions`)]}),(0,i.jsxs)(`button`,{type:`button`,className:`aha-chip`,"data-tour":`raise`,onClick:Tt,disabled:!M.length,title:T?D(`raiseHandKey`):void 0,children:[`✋ `,D(`raiseHand`)]}),(0,i.jsxs)(`span`,{style:{position:`relative`},children:[(0,i.jsxs)(`button`,{type:`button`,className:`aha-chip`,"data-tour":`reexplain`,onClick:()=>Ge(e=>!e),disabled:!M.length,children:[`🔄 `,D(`reexplain`)]}),We?(0,i.jsx)(`div`,{className:`aha-card`,style:{position:`absolute`,bottom:`110%`,left:0,zIndex:10,padding:6,gap:2,minWidth:140},children:Yu.map(([e,t])=>(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,style:{justifyContent:`flex-start`},onClick:()=>vt(e),children:D(t)},e))}):null]}),(0,i.jsxs)(`button`,{type:`button`,className:`aha-chip`,"data-tour":`challenge`,"aria-expanded":!!Ke,onClick:()=>Ke?qe(null):St(st),disabled:!M.length||Bt,children:[`🧐 `,D(`challenge`)]}),le?null:(0,i.jsxs)(`button`,{type:`button`,className:`aha-chip`,"aria-expanded":!1,onClick:()=>ue(!0),children:[`📋 `,D(`showPanel`)]})]})]}),le?(0,i.jsxs)(`aside`,{className:`aha-panel`,"aria-label":D(`panelTitle`),children:[(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsx)(`b`,{children:c.length?D(`lessonGoals`):D(`transcript`)}),(0,i.jsxs)(`span`,{className:`aha-row`,style:{gap:6},children:[c.length&&Dt?(0,i.jsxs)(`span`,{className:`aha-tag`,children:[zt,`/`,c.length]}):null,(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,"data-size":`sm`,onClick:()=>ue(!1),title:D(`hidePanel`),"aria-label":D(`hidePanel`),children:`›`})]})]}),c.length?(0,i.jsx)(`ol`,{className:`aha-goals`,children:c.map((e,t)=>(0,i.jsxs)(`li`,{"data-state":Dt?.[t]??`plain`,children:[(0,i.jsx)(`span`,{className:`aha-goalMark`,"aria-hidden":`true`,children:Dt?.[t]===`done`?`✓`:t+1}),(0,i.jsx)(`span`,{children:e})]},t))}):null,c.length?(0,i.jsx)(`b`,{className:`aha-panelHead`,children:D(`transcript`)}):null,(0,i.jsx)(`div`,{ref:xe,className:`aha-transcript`,role:`list`,children:Ot.map(e=>(0,i.jsxs)(`div`,{role:`listitem`,className:`aha-lineRow`,"data-aside":e.aside?`true`:void 0,children:[(0,i.jsxs)(`button`,{type:`button`,className:`aha-line`,"data-kind":e.kind,"data-current":e.stepIndex===st?`true`:void 0,disabled:e.stepIndex<0,onClick:()=>N.seek(e.stepIndex),children:[e.kind===`question`?(0,i.jsx)(`span`,{className:`aha-lineTag`,children:`✋`}):e.kind===`reexplain`?(0,i.jsx)(`span`,{className:`aha-lineTag`,children:`🔄`}):e.kind===`correction`?(0,i.jsx)(`span`,{className:`aha-lineTag`,children:`✏️`}):e.kind===`challenge`?(0,i.jsx)(`span`,{className:`aha-lineTag`,children:`🧐`}):null,(0,i.jsx)(`span`,{className:`aha-lineText`,children:(0,i.jsx)(pl,{text:e.text})}),e.pending?(0,i.jsx)(Rl,{}):null]}),e.kind===`say`&&e.stepIndex>=0&&!Bt?(0,i.jsx)(`button`,{type:`button`,className:`aha-lineFlag`,title:D(`challenge`),"aria-label":D(`challengeStep`,{n:e.stepIndex+1}),onClick:()=>St(e.stepIndex),children:D(`challengeLine`)}):null]},e.key))}),(0,i.jsxs)(`form`,{className:`aha-askBox`,onSubmit:_t,children:[(0,i.jsx)(`textarea`,{ref:_e,className:`aha-textarea`,rows:2,value:Fe,placeholder:D(`askPlaceholder`),disabled:!M.length,onChange:e=>Ie(e.currentTarget.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing?_t(e):e.key===`Escape`&&e.currentTarget.blur()}}),(0,i.jsxs)(`div`,{className:`aha-askActions`,children:[(0,i.jsx)(Bu,{ref:ve,disabled:!M.length,keyHint:T?D(`talkKeyHint`):``,onStart:()=>N.pause(),onText:e=>{be.current=!0,Ie(t=>t.trim()?`${t.trimEnd()} ${e}`:e),_e.current?.focus()}}),(0,i.jsx)(`button`,{type:`submit`,className:`aha-btn`,"data-kind":`primary`,disabled:!Fe.trim()||Bt,children:D(`ask`)})]})]})]}):null]}),pe?(0,i.jsx)(Ll,{root:ge,onDone:ot}):null]})}let $u=[[`explain`,`modeExplain`,`💡`],[`solve`,`modeSolve`,`🧮`],[`visualize`,`modeVisualize`,`📈`]];function ed({draftMode:e,draftRequest:t,draftMaterials:n,token:a}){let{api:o,t:s}=v(),c=y(()=>o.call(`items/list`,{kind:`assist`}),[]),[l,u]=(0,r.useState)($u.some(([t])=>t===e)?e:`explain`),[d,f]=(0,r.useState)(t??``),[p,m]=(0,r.useState)(Array.isArray(n)?n:[]),[h,g]=(0,r.useState)(!1),[_,b]=(0,r.useState)(null),[S,C]=(0,r.useState)(null),w=x(a);async function T(e=d){let t=e.trim();if(!t)return;C(null);let n=_?.threadId??E(`thd`);_?.stream&&!_.done&&o.cancel(_.stream);try{let{job:e}=await o.call(`assist/ask`,{mode:l,request:t,materialIds:p,threadId:_?.threadId,newThreadId:_?.threadId?void 0:n});b(r=>({threadId:n,turn:r?r.turn+1:0,stream:e,done:!1,steps:[],title:t.slice(0,80),language:void 0,key:`${n}:${Date.now()}`})),f(``)}catch(e){C(e)}}(0,r.useEffect)(()=>{w&&t&&T(t)},[]);async function D(e){C(null);try{let{item:t}=await o.call(`items/get`,{kind:`assist`,id:e}),n=t.turns.length-1;b({threadId:t.id,turn:n,stream:null,steps:t.turns[n]?.board?.steps??[],title:t.turns[n]?.request??t.title,language:t.language,key:`${t.id}:${n}:open`,opened:Date.now()})}catch(e){C(e)}}return(0,i.jsxs)(`div`,{className:`aha-page`,"data-wide":`true`,children:[(0,i.jsxs)(`div`,{className:`aha-split`,children:[(0,i.jsxs)(`div`,{className:`aha-col`,style:{minHeight:0},children:[_?(0,i.jsx)(Qu,{scope:{kind:`thread`,id:_.threadId,turn:_.turn},title:_.title,steps:_.steps,stream:_.stream,language:_.language,recordChecks:!1,reveal:_.opened,onStreamDone:e=>{b(t=>t?.stream?.id===_.stream?.id?{...t,done:!0,turn:Number.isInteger(e?.turn)?e.turn:t.turn}:t),c.reload()}},_.key):(0,i.jsxs)(`div`,{className:`aha-col`,style:{gap:4},children:[(0,i.jsx)(`h2`,{className:`aha-title`,children:s(`assistTitle`)}),(0,i.jsx)(`p`,{className:`aha-hint`,children:s(`assistHint`)})]}),(0,i.jsxs)(`div`,{className:`aha-composer`,children:[(0,i.jsx)(`div`,{className:`aha-row`,style:{gap:6},children:$u.map(([e,t,n])=>(0,i.jsxs)(`button`,{type:`button`,className:`aha-chip`,"data-active":l===e,onClick:()=>u(e),children:[n,` `,s(t)]},e))}),(0,i.jsx)(`textarea`,{value:d,placeholder:s(_?`followUp`:`assistPlaceholder`),onChange:e=>f(e.currentTarget.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&T()}}),(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,onClick:()=>g(!0),children:p.length?s(`attached`,{count:p.length}):s(`attach`)}),(0,i.jsxs)(`div`,{className:`aha-row`,children:[_?(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,onClick:()=>b(null),children:s(`newThread`)}):null,(0,i.jsx)(Bu,{onText:e=>f(t=>t.trim()?`${t.trimEnd()} ${e}`:e)}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,disabled:!d.trim(),onClick:()=>T(),children:s(`ask`)})]})]})]}),(0,i.jsx)(Wl,{error:S})]}),(0,i.jsxs)(`aside`,{className:`aha-col`,style:{minHeight:0,overflow:`auto`},children:[(0,i.jsx)(`h3`,{className:`aha-cardTitle`,children:s(`history`)}),c.loading&&!c.value?(0,i.jsx)(Rl,{}):(c.value??[]).map(e=>(0,i.jsxs)(`button`,{type:`button`,className:`aha-option`,onClick:()=>D(e.id),children:[(0,i.jsx)(`b`,{children:e.title}),(0,i.jsx)(`small`,{children:new Date(e.updatedAt).toLocaleString()})]},e.id))]})]}),h?(0,i.jsx)(Yl,{selected:p,onChange:m,onClose:()=>g(!1)}):null]})}Object.freeze({pInit:.2,pTransit:.15,pSlip:.1,pGuess:.2}),Object.freeze([{id:`struggling`,min:0},{id:`learning`,min:.4},{id:`proficient`,min:.7},{id:`mastered`,min:.9}]);let td=(e,t,n)=>Math.min(n,Math.max(t,e));function nd(e){return Math.round(td(Number(e?.pKnown)||0,0,1)*100)}Object.freeze([`none`,`weak`,`learning`,`proficient`,`mastered`]);function rd(e){return!e||!e.attempts&&!e.history?.length?`none`:id(nd(e))}function id(e){let t=Number(e);return Number.isFinite(t)?t>=90?`mastered`:t>=70?`proficient`:t>=40?`learning`:`weak`:`none`}let ad=Object.freeze({none:`stageNone`,weak:`stageWeak`,learning:`stageLearning`,proficient:`stageProficient`,mastered:`stageMastered`});function od(e){let t=e.filter(Boolean),n=t.length?t.reduce((e,t)=>e+(Number(t.score)||0),0)/t.length:0,r=0,i=0;for(let e of t)r=e.correct?r+1:0,i=Math.max(i,r);return{answered:t.length,correct:t.filter(e=>e.correct).length,accuracy:n,stars:n>=.9?3:n>=.6?2:1,streak:r,bestStreak:i}}function sd(e,{lessonId:t,unitId:n,nextLessonId:r}={}){let i=e?.action;return i===`remediate`?t?{kind:`relearn`,lessonId:t}:{kind:`review`}:i===`review`?{kind:`review`}:i===`challenge`&&n?{kind:`quiz`,unitId:n}:r?{kind:`next`,lessonId:r}:{kind:`course`}}function cd(e,t){let n=(e.concepts??[]).map(e=>t?.concepts?.[e.id]);if(!n.some(e=>rd(e)!==`none`))return{stage:`none`,percent:0};let r=Math.round(n.reduce((e,t)=>e+nd(t??{pKnown:.2}),0)/n.length);return{stage:id(r),percent:r}}function ld(e,t,{now:n=Date.now()}={}){let r=Ne(e),i=Object.entries(t?.reviews??{}).filter(([e,t])=>r.has(e)&&Date.parse(t?.dueAt)<=n).length;if(i)return{kind:`review`,count:i};let a=[...r.values()].map(e=>({concept:e,state:t?.concepts?.[e.id]})).filter(e=>rd(e.state)===`weak`).sort((e,t)=>e.state.pKnown-t.state.pKnown)[0];if(a)return{kind:`practice`,lessonId:a.concept.lessonId,concept:a.concept.name};let o=Ie(e,t);return o?{kind:`lesson`,lessonId:o.lesson.id,title:o.lesson.title}:{kind:`done`,unitId:e.units?.at(-1)?.id??null}}let ud=[[`outline`,`tabOutline`],[`practice`,`tabPractice`],[`sheets`,`tabSheets`],[`projects`,`tabProjects`],[`progress`,`tabProgress`]];function dd({courseId:e,tab:t=`outline`}){let{api:n,t:a,navigate:o,toast:s}=v(),c=y(()=>n.call(`course/get`,{courseId:e}),[e]),[l,u]=(0,r.useState)(t===`cards`?`practice`:t),[d,f]=(0,r.useState)(!1),[p,m]=(0,r.useState)(!1),[g,_]=(0,r.useState)(!1),b=c.value?.course,x=c.value?.progress,S=c.value?.ready?.cards,C=(0,r.useMemo)(()=>b?.units?Fe(b,x):null,[b,x]),w=(0,r.useMemo)(()=>b?.units?Ie(b,x):null,[b,x]),T=(0,r.useMemo)(()=>b?.units?ld(b,x):null,[b,x]);if(c.loading&&!c.value)return(0,i.jsx)(`div`,{className:`aha-page`,children:(0,i.jsx)(Rl,{label:a(`loading`)})});if(!b)return(0,i.jsx)(`div`,{className:`aha-page`,children:(0,i.jsx)(Wl,{error:c.error})});if(b.status!==`ready`)return o(`craft`,{courseId:e},{replace:!0}),null;let E=e=>nd(x?.concepts?.[e]??{pKnown:.2}),D=e=>x?.lessons?.[e]?.status??`new`;async function O(t){m(!1);try{let r=await n.call(`course/export`,{courseId:e,includeProgress:t});h(r.fileName,r.json)}catch(e){s(Ul(a,e))}}return(0,i.jsxs)(`div`,{className:`aha-page`,children:[(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsxs)(`div`,{className:`aha-col`,style:{gap:4,flex:1,minWidth:`min(260px, 100%)`},children:[(0,i.jsxs)(`div`,{className:`aha-row`,style:{flexWrap:`nowrap`},children:[(0,i.jsx)(`span`,{style:{fontSize:30},children:b.emoji}),(0,i.jsx)(`h2`,{className:`aha-title`,children:b.title})]}),b.subtitle?(0,i.jsx)(`p`,{className:`aha-subtitle`,children:b.subtitle}):null,C?(0,i.jsxs)(`div`,{className:`aha-col`,style:{gap:4,maxWidth:480},children:[(0,i.jsx)(zl,{value:C.percent}),(0,i.jsxs)(`span`,{className:`aha-hint`,children:[a(`lessonsCount`,C),` · `,a(`minutesLeft`,{minutes:C.minutesLeft})]})]}):null]}),(0,i.jsxs)(`div`,{className:`aha-row`,style:{position:`relative`},children:[w?(0,i.jsxs)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,onClick:()=>o(`lesson`,{courseId:e,lessonId:w.lesson.id}),children:[(0,i.jsx)(ut,{name:`play`,size:14}),a(`continueLearning`)]}):null,(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,onClick:()=>f(e=>!e),children:`⋯`}),d?(0,i.jsxs)(`div`,{className:`aha-card`,style:{position:`absolute`,right:0,top:`110%`,zIndex:20,padding:6,gap:2,minWidth:180},onMouseLeave:()=>f(!1),children:[(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,style:{justifyContent:`flex-start`},onClick:()=>{f(!1),o(`craft`,{courseId:e,edit:!0})},children:a(`editOutline`)}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,style:{justifyContent:`flex-start`},onClick:()=>{f(!1),o(`craft`,{courseId:e,edit:!0,add:!0})},children:a(`addMaterials`)}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,style:{justifyContent:`flex-start`},onClick:()=>{f(!1),m(!0)},children:a(`exportPack`)}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,style:{justifyContent:`flex-start`},onClick:async()=>{f(!1),await n.call(`course/update`,{courseId:e,archived:!b.archived}),c.reload()},children:b.archived?a(`unarchive`):a(`archive`)}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,style:{justifyContent:`flex-start`,color:`var(--aha-bad)`},onClick:()=>{f(!1),_(!0)},children:a(`deleteCourse`)})]}):null]})]}),T?(0,i.jsx)(fd,{step:T,courseId:e}):null,(0,i.jsx)(`div`,{className:`aha-tabs`,children:ud.map(([e,t])=>(0,i.jsx)(`button`,{type:`button`,className:`aha-tab`,"data-active":l===e,onClick:()=>u(e),children:a(t)},e))}),l===`outline`?(0,i.jsx)(`div`,{className:`aha-tree`,children:b.units.map((t,n)=>(0,i.jsxs)(`div`,{className:`aha-unit`,children:[(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsxs)(`b`,{children:[a(`unitN`,{n:n+1}),` · `,t.title]}),(0,i.jsxs)(`span`,{className:`aha-row`,style:{gap:4},children:[(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,"data-kind":`ghost`,onClick:()=>o(`sheet`,{courseId:e,unitId:t.id}),children:a(`unitSheet`)}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,"data-kind":`ghost`,onClick:()=>o(`practice`,{courseId:e,unitId:t.id}),children:a(`unitQuiz`)}),(0,i.jsx)(pd,{courseId:e,unitId:t.id,status:S?.units?.[t.id],ghost:!0})]})]}),t.summary?(0,i.jsx)(`p`,{className:`aha-hint`,children:t.summary}):null,t.lectures.map((t,n)=>(0,i.jsxs)(`div`,{className:`aha-lecture`,children:[(0,i.jsxs)(`div`,{className:`aha-hint`,style:{fontWeight:600},children:[a(`lectureN`,{n:n+1}),` · `,t.title]}),t.lessons.map(t=>(0,i.jsxs)(`div`,{className:`aha-lesson`,children:[(0,i.jsx)(`span`,{className:`aha-dot`,"data-state":D(t.id)}),(0,i.jsx)(`span`,{style:{flex:1,cursor:`pointer`},onClick:()=>o(`lesson`,{courseId:e,lessonId:t.id}),title:t.summary,children:t.title}),t.kind===`remedial`?(0,i.jsx)(`span`,{className:`aha-tag`,children:a(`remedial`)}):null,t.depth?(0,i.jsx)(`span`,{className:`aha-depth`,"data-depth":t.depth,title:a(`depthTitle`),children:a(`depth_${t.depth}`)}):null,(0,i.jsx)(`span`,{className:`aha-hint`,children:a(`estMinutes`,{minutes:t.estMinutes})}),(0,i.jsx)(md,{lesson:t,progress:x}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,onClick:()=>o(`lesson`,{courseId:e,lessonId:t.id}),children:a(`learn`)}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,"data-kind":`ghost`,onClick:()=>o(`practice`,{courseId:e,lessonId:t.id}),children:a(`practice`)})]},t.id))]},t.id))]},t.id))}):null,l===`outline`&&b.sources?.length?(0,i.jsxs)(`section`,{className:`aha-card`,children:[(0,i.jsx)(`b`,{children:a(`courseSources`)}),(0,i.jsx)(Ql,{sources:b.sources})]}):null,l===`practice`?(0,i.jsxs)(`div`,{className:`aha-col`,children:[(0,i.jsxs)(`div`,{className:`aha-row`,children:[(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,onClick:()=>o(`practice`,{courseId:e,review:!0}),children:a(`startReview`)}),S?.decks?(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,disabled:!S.review,onClick:()=>o(`cards`,{courseId:e}),children:S.review?a(`cardReviewDue`,{count:S.review}):a(`cardReviewNone`)}):null]}),b.units.map((t,n)=>(0,i.jsxs)(`div`,{className:`aha-card`,children:[(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsxs)(`b`,{children:[a(`unitN`,{n:n+1}),` · `,t.title]}),(0,i.jsxs)(`span`,{className:`aha-row`,style:{gap:4},children:[(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,onClick:()=>o(`practice`,{courseId:e,unitId:t.id}),children:a(`unitQuiz`)}),(0,i.jsx)(pd,{courseId:e,unitId:t.id,status:S?.units?.[t.id]})]})]}),(0,i.jsx)(`div`,{className:`aha-row`,style:{gap:6},children:t.lectures.flatMap(e=>e.lessons).map(t=>(0,i.jsx)(`button`,{type:`button`,className:`aha-chip`,onClick:()=>o(`practice`,{courseId:e,lessonId:t.id}),children:t.title},t.id))})]},t.id))]}):null,l===`sheets`?(0,i.jsx)(`div`,{className:`aha-grid`,children:b.units.map((t,n)=>(0,i.jsxs)(`div`,{className:`aha-card`,"data-click":`true`,onClick:()=>o(`sheet`,{courseId:e,unitId:t.id}),children:[(0,i.jsx)(`span`,{className:`aha-hint`,children:a(`unitN`,{n:n+1})}),(0,i.jsx)(`b`,{children:t.title}),(0,i.jsx)(`span`,{className:`aha-tag`,children:c.value.ready.sheets.includes(t.id)?a(`open`):a(`generate`)})]},t.id))}):null,l===`projects`?b.projects?.length?(0,i.jsx)(`div`,{className:`aha-grid`,children:b.projects.map(t=>(0,i.jsxs)(`div`,{className:`aha-card`,"data-click":`true`,onClick:()=>o(`project`,{courseId:e,projectId:t.id}),children:[(0,i.jsx)(`b`,{children:t.title}),(0,i.jsx)(`p`,{className:`aha-hint`,children:t.brief.slice(0,160)}),(0,i.jsx)(`span`,{className:`aha-tag`,children:x?.projects?.[t.id]?.status===`passed`?`✔`:t.kind})]},t.id))}):(0,i.jsx)(Gl,{children:a(`empty`)}):null,l===`progress`?(0,i.jsxs)(`div`,{className:`aha-card`,children:[(0,i.jsx)(`b`,{children:a(`conceptMastery`)}),(0,i.jsx)(`div`,{className:`aha-col`,style:{gap:4},children:Ae(b).flatMap(({lesson:e})=>e.concepts.map(t=>({concept:t,lesson:e}))).map(({concept:e,lesson:t})=>{let n=x?.concepts?.[e.id],r=rd(n);return(0,i.jsxs)(`div`,{className:`aha-spread`,style:{padding:`3px 0`,borderBottom:`1px solid var(--aha-border)`},children:[(0,i.jsxs)(`span`,{children:[e.name,` `,(0,i.jsxs)(`span`,{className:`aha-hint`,children:[`· `,t.title]})]}),(0,i.jsxs)(`span`,{className:`aha-row`,style:{gap:8},children:[n?.misconceptions?.length?(0,i.jsxs)(`span`,{className:`aha-tag`,title:n.misconceptions.join(`
|
|
270
|
+
`),children:[`⚠ `,n.misconceptions.length]}):null,(0,i.jsx)(`span`,{className:`aha-level`,"data-level":r,children:a(ad[r])}),(0,i.jsx)(eu,{value:E(e.id),stage:r,label:a(ad[r])}),(0,i.jsx)(`span`,{className:`aha-hint`,style:{width:36,textAlign:`right`},children:r===`none`?`—`:`${E(e.id)}%`})]})]},e.id)})})]}):null,p?(0,i.jsx)(Vl,{title:a(`exportPack`),onClose:()=>m(!1),footer:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,onClick:()=>O(!1),children:a(`exportPack`)}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,onClick:()=>O(!0),children:a(`exportWithProgress`)})]}),children:(0,i.jsx)(`p`,{className:`aha-hint`,children:b.title})}):null,g?(0,i.jsx)(Hl,{danger:!0,text:a(`deleteConfirm`,{title:b.title}),onCancel:()=>_(!1),onConfirm:async()=>{await n.call(`course/remove`,{courseId:e}),o(`courses`,{},{replace:!0})}}):null]})}function fd({step:e,courseId:t}){let{t:n,navigate:r}=v(),a={review:[n(`nextStepReview`,{count:e.count}),n(`startReview`),()=>r(`practice`,{courseId:t,review:!0})],practice:[n(`nextStepWeak`,{concept:e.concept}),n(`practiceThis`),()=>r(`practice`,{courseId:t,lessonId:e.lessonId})],lesson:[n(`nextStepLesson`,{title:e.title}),n(`continueLearning`),()=>r(`lesson`,{courseId:t,lessonId:e.lessonId})],done:[n(`nextStepDone`),n(`unitQuiz`),e.unitId?()=>r(`practice`,{courseId:t,unitId:e.unitId}):null]}[e.kind];if(!a)return null;let[o,s,c]=a;return(0,i.jsxs)(`div`,{className:`aha-card aha-nextStep`,"data-kind":e.kind,children:[(0,i.jsxs)(`div`,{className:`aha-col`,style:{gap:2,flex:1,minWidth:200},children:[(0,i.jsx)(`span`,{className:`aha-hint`,children:n(`nextStepTitle`)}),(0,i.jsx)(`b`,{children:o})]}),c?(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,onClick:c,children:s}):null]})}function pd({courseId:e,unitId:t,status:n,ghost:r=!1}){let{t:a,navigate:o}=v(),s=n?.due??0;return(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,"data-kind":r?`ghost`:void 0,title:s?a(`unitCardsDueTitle`,{count:s}):void 0,onClick:()=>o(`cards`,{courseId:e,unitId:t}),children:s?a(`unitCardsDue`,{count:s}):a(`unitCards`)})}function md({lesson:e,progress:t}){let{t:n}=v(),{stage:r,percent:a}=cd(e,t);return(0,i.jsx)(eu,{value:a,stage:r,label:n(ad[r])})}let hd=[[`all`,`filterAll`],[`active`,`filterActive`],[`done`,`filterDone`],[`archived`,`filterArchived`]];function gd(){let{api:e,t,navigate:n,toast:a}=v(),o=y(()=>e.call(`course/list`),[]),[s,c]=(0,r.useState)(`all`),[l,u]=(0,r.useState)(``),[d,f]=(0,r.useState)(null),p=(0,r.useRef)(null),m=(o.value??[]).filter(e=>s===`archived`?e.archived:e.archived?!1:s===`active`?e.status!==`ready`||e.progress.percent<100:s!==`done`||e.status===`ready`&&e.progress.percent>=100).filter(e=>!l.trim()||`${e.title} ${e.subtitle}`.toLowerCase().includes(l.trim().toLowerCase()));async function h(r){f(null);try{let i=await r.text(),o=await e.call(`course/import`,{json:i});a(t(`courseReady`)),n(`course`,{courseId:o.id})}catch(e){f(e)}}return(0,i.jsxs)(`div`,{className:`aha-page`,children:[(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsx)(`h2`,{className:`aha-title`,children:t(`coursesTitle`)}),(0,i.jsxs)(`div`,{className:`aha-row`,children:[(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,onClick:()=>p.current?.click(),children:t(`importPack`)}),(0,i.jsxs)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,onClick:()=>n(`home`),children:[`+ `,t(`modeCourse`)]}),(0,i.jsx)(`input`,{ref:p,type:`file`,accept:`.json,application/json`,hidden:!0,onChange:e=>{let t=e.currentTarget.files?.[0];t&&h(t),e.currentTarget.value=``}})]})]}),(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsx)(`div`,{className:`aha-row`,style:{gap:6},children:hd.map(([e,n])=>(0,i.jsx)(`button`,{type:`button`,className:`aha-chip`,"data-active":s===e,onClick:()=>c(e),children:t(n)},e))}),(0,i.jsx)(`input`,{className:`aha-input`,style:{maxWidth:260},value:l,placeholder:t(`searchCourses`),onChange:e=>u(e.currentTarget.value)})]}),(0,i.jsx)(Wl,{error:d??o.error}),o.loading&&!o.value?(0,i.jsx)(Rl,{label:t(`loading`)}):m.length?(0,i.jsx)(`div`,{className:`aha-grid`,children:m.map(e=>(0,i.jsxs)(`div`,{className:`aha-card`,"data-click":`true`,onClick:()=>n(e.status===`ready`?`course`:`craft`,{courseId:e.id}),children:[(0,i.jsxs)(`div`,{className:`aha-row`,style:{flexWrap:`nowrap`},children:[(0,i.jsx)(`span`,{style:{fontSize:26},children:e.emoji}),(0,i.jsx)(`span`,{className:`aha-cardTitle`,children:e.title})]}),e.subtitle?(0,i.jsx)(`p`,{className:`aha-hint`,children:e.subtitle}):null,e.status===`ready`?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(zl,{value:e.progress.percent}),(0,i.jsxs)(`span`,{className:`aha-hint`,children:[t(`lessonsCount`,e.progress),e.next?` · ${t(`nextUp`,{title:e.next.title})}`:``]})]}):(0,i.jsx)(`span`,{className:`aha-tag`,children:e.status===`intake`?t(`statusIntake`):t(`statusBlueprint`)})]},e.id))}):(0,i.jsx)(Gl,{children:t(`noCourses`)})]})}let _d=Object.freeze([{maxWidth:210,font:16,line:22,padX:16,padY:11},{maxWidth:220,font:14.5,line:20,padX:14,padY:9},{maxWidth:210,font:13.5,line:19,padX:12,padY:8},{maxWidth:250,font:13.5,line:19,padX:12,padY:7}]),vd=Object.freeze({x:56,y:10,unit:18,meta:20}),yd=/[⺀-]/u;function bd(e,t){let n=0;for(let r of String(e??``))n+=yd.test(r)?t:r===` `?t*.3:t*.58;return n}function xd(e,t,n){let r=_d[t],i=r.maxWidth-r.padX*2-12,a=bd(e,r.font),o=Math.max(1,Math.ceil(a/i));return{w:Math.ceil(Math.min(r.maxWidth,Math.max(56,a+r.padX*2+12))),h:Math.ceil(o*r.line+r.padY*2+(n?vd.meta:0))}}function Sd(e){let t=[],n=[],r={key:`root`,title:e?.title??``,children:(e?.units??[]).map(e=>({key:e.key,title:e.title,children:(e.lectures??[]).map(e=>({key:e.key,title:e.title,children:(e.lessons??[]).map(e=>({key:e.key,title:e.title,meta:e.meta??null,children:[]}))}))}))},i=new Map,a=[0,0,0,0],o=(e,t)=>{let n=xd(e.title,t,!!e.meta);i.set(e,n),a[t]=Math.max(a[t],n.w);for(let n of e.children)o(n,t+1)};o(r,0);let s=[0];for(let e=1;e<4;e+=1)s[e]=s[e-1]+a[e-1]+vd.x;let c=0,l=[-1/0,-1/0,-1/0,-1/0],u=`root`,d=(e,r)=>{let{w:a,h:o}=i.get(e),f;if(!e.children.length)f=c+o/2,c+=o+vd.y;else{let t=e.children.map((e,t)=>(r===0&&t>0&&(c+=vd.unit),d(e,r+1)));f=(t[0].centre+t[t.length-1].centre)/2;for(let t of e.children)n.push({from:e.key,to:t.key})}let p=f-o/2;return p<l[r]+vd.y&&(p=l[r]+vd.y),l[r]=p+o,c=Math.max(c,p+o+vd.y),t.push({key:e.key,level:r,x:s[r],y:p,w:a,h:o,title:e.title,meta:e.meta??null}),(e.key!==`root`||!e.children.length)&&(u=Cd(e)),{centre:p+o/2}};d(r,0);let f=Math.max(...t.map(e=>e.x+e.w)),p=Math.max(...t.map(e=>e.y+e.h)),m=new Map,h=0,g=e=>{m.set(e.key,h++),e.children.forEach(g)};return g(r),t.sort((e,t)=>m.get(e.key)-m.get(t.key)),{nodes:t,links:n,width:f,height:p,last:u}}function Cd(e){let t=e;for(;t.children.length;)t=t.children[t.children.length-1];return t.key}function wd(e,t=``){return{title:e?.title||t,units:(e?.units??[]).map((e,t)=>({key:`u${t}`,title:e.title,lectures:(e.lectures??[]).map((e,n)=>({key:`u${t}.${n}`,title:e.title||`…`,lessons:(e.lessons??[]).map((e,r)=>({key:`u${t}.${n}.${r}`,title:typeof e==`string`?e:e?.title??``}))}))}))}}function Td(e,t){let n=e.x+e.w,r=e.y+e.h/2,i=t.x,a=t.y+t.h/2,o=(n+i)/2;return`M${n} ${r} C${o} ${r} ${o} ${a} ${i} ${a}`}function Ed({tree:e,live:t=!1,onPick:n,renderMeta:a}){let{t:o}=v(),s=(0,r.useMemo)(()=>Sd(e),[e]),c=(0,r.useMemo)(()=>new Map(s.nodes.map(e=>[e.key,e])),[s]),l=(0,r.useRef)(null),[u,d]=(0,r.useState)({width:0,height:0}),[f,p]=(0,r.useState)({x:20,y:20,k:1,animate:!1}),[m,h]=(0,r.useState)(!0),g=(0,r.useRef)({size:u,map:s,pointers:new Map,drag:null});g.current.size=u,g.current.map=s,(0,r.useLayoutEffect)(()=>{let e=l.current;if(!e)return;let t=()=>d(t=>t.width===e.clientWidth&&t.height===e.clientHeight?t:{width:e.clientWidth,height:e.clientHeight});t();let n=typeof ResizeObserver==`function`?new ResizeObserver(t):null;return n?.observe(e),()=>n?.disconnect()},[]);let _=()=>({width:g.current.map.width,height:g.current.map.height}),y=(e,{animate:t=!1,manual:n=!1}={})=>{n&&h(!1),p(n=>({...gc(typeof e==`function`?e(n):e,g.current.size,_(),60),animate:t}))},b=(e=!0)=>y(mc(g.current.size,{x:0,y:-30,width:_().width,height:_().height+30},{margin:20,maxZoom:1}),{animate:e});(0,r.useLayoutEffect)(()=>{if(!u.width||!u.height)return;if(!t){b(!1);return}if(!m)return;let e=c.get(s.last);e&&p(t=>{let n=Math.min(1,Math.max(.55,(u.width-40)/Math.max(1,s.width))),r=Math.min(20,u.width-20-(e.x+e.w)*n),i=(e.y+e.h)*n,a=Math.min(50,u.height-40-i);return t.k===n&&t.x===r&&t.y===a?t:{x:r,y:a,k:n,animate:!0}})},[s,t,m,u.width,u.height]),(0,r.useEffect)(()=>{let e=l.current;if(!e)return;let t=t=>{t.preventDefault();let n=e.getBoundingClientRect(),r=_c(t,n.height);t.ctrlKey||t.metaKey?y(e=>pc(e,t.clientX-n.left,t.clientY-n.top,vc(r.y)),{manual:!0}):y(e=>({...e,x:e.x-(t.shiftKey?r.y:r.x),y:e.y-(t.shiftKey?0:r.y)}),{manual:!0})};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[]);let x=e=>{e.pointerType===`mouse`&&e.button!==0||e.target.closest?.(`.aha-mapBar`)||(g.current.pointers.set(e.pointerId,{x:e.clientX,y:e.clientY}),g.current.drag||(g.current.drag={x:e.clientX,y:e.clientY,moved:!1}))},S=e=>{let{pointers:t,drag:n}=g.current,r=t.get(e.pointerId);if(!r||!n)return;let i={x:e.clientX,y:e.clientY};if(t.size===1){if(!n.moved&&Math.hypot(i.x-n.x,i.y-n.y)<5)return;n.moved||l.current?.setPointerCapture?.(e.pointerId),n.moved=!0,t.set(e.pointerId,i),y(e=>({...e,x:e.x+i.x-r.x,y:e.y+i.y-r.y}),{manual:!0});return}let a=[...t.entries()].find(([t])=>t!==e.pointerId)?.[1];if(t.set(e.pointerId,i),!a)return;let o=l.current.getBoundingClientRect(),s={x:(r.x+a.x)/2,y:(r.y+a.y)/2,d:Math.hypot(r.x-a.x,r.y-a.y)},c={x:(i.x+a.x)/2,y:(i.y+a.y)/2,d:Math.hypot(i.x-a.x,i.y-a.y)};n.moved=!0,y(e=>{let t=pc(e,s.x-o.left,s.y-o.top,c.d/Math.max(1,s.d));return{...t,x:t.x+c.x-s.x,y:t.y+c.y-s.y}},{manual:!0})},C=e=>{let t=g.current.drag?.moved;if(g.current.pointers.delete(e.pointerId),g.current.pointers.size||(g.current.drag=null),!t&&n){let t=e.target.closest?.(`[data-pick]`)?.dataset.pick;t&&n(t)}},w=e=>y(t=>pc(t,g.current.size.width/2,g.current.size.height/2,e),{animate:!0,manual:!0});return(0,i.jsxs)(`div`,{className:`aha-map`,children:[(0,i.jsx)(`div`,{ref:l,className:`aha-mapView`,onPointerDown:x,onPointerMove:S,onPointerUp:C,onPointerCancel:C,onDoubleClick:()=>b(),children:(0,i.jsxs)(`div`,{className:`aha-mapWorld`,style:{width:s.width,height:s.height,transform:`translate(${f.x}px, ${f.y}px) scale(${f.k})`,transition:f.animate?`transform .45s ease`:`none`},children:[(0,i.jsx)(`svg`,{className:`aha-mapLinks`,width:s.width,height:s.height,"aria-hidden":`true`,children:s.links.map(e=>{let t=c.get(e.from),n=c.get(e.to);return t&&n?(0,i.jsx)(`path`,{d:Td(t,n)},`${e.from}>${e.to}`):null})}),s.nodes.map(e=>(0,i.jsxs)(`div`,{className:`aha-mapNode`,"data-level":e.level,"data-pick":n&&e.level===3?e.key:void 0,style:{left:e.x,top:e.y,width:e.w,minHeight:e.h},title:n&&e.level===3?o(`mapPick`):void 0,children:[(0,i.jsx)(`span`,{className:`aha-mapTitle`,children:e.title}),e.meta&&a?(0,i.jsx)(`span`,{className:`aha-mapMeta`,children:a(e.meta)}):null]},e.key))]})}),(0,i.jsxs)(`div`,{className:`aha-mapBar`,role:`toolbar`,"aria-label":o(`mapTools`),children:[t&&!m?(0,i.jsx)(`button`,{type:`button`,className:`aha-mapFollow`,onClick:()=>h(!0),children:o(`mapFollow`)}):null,(0,i.jsx)(`button`,{type:`button`,"aria-label":o(`canvasZoomOut`),title:o(`canvasZoomOut`),onClick:()=>w(1/dc),children:`−`}),(0,i.jsxs)(`button`,{type:`button`,className:`aha-mapZoom`,title:o(`canvasZoomReset`),onClick:()=>y(e=>({...pc(e,g.current.size.width/2,g.current.size.height/2,1/e.k)}),{animate:!0,manual:!0}),children:[Math.round(f.k*100),`%`]}),(0,i.jsx)(`button`,{type:`button`,"aria-label":o(`canvasZoomIn`),title:o(`canvasZoomIn`),onClick:()=>w(dc),children:`+`}),(0,i.jsx)(`button`,{type:`button`,title:o(`canvasFit`),onClick:()=>{h(!1),b()},children:o(`canvasFitShort`)})]})]})}let Dd=[[`intensive`,`paceIntensive`,`paceIntensiveHint`],[`balanced`,`paceBalanced`,`paceBalancedHint`],[`relaxed`,`paceRelaxed`,`paceRelaxedHint`]],Od=[[`auto`,`sizeAuto`,`sizeAutoHint`],[`short`,`sizeShort`,`sizeShortHint`],[`standard`,`sizeStandard`,`sizeStandardHint`],[`full`,`sizeFull`,`sizeFullHint`]],kd=[60,120,180,300,420,600];function Ad({jobId:e,courseId:t,edit:n=!1,add:a=!1}){let{api:o,t:s,navigate:c}=v(),[l,u]=(0,r.useState)(null),[d,f]=(0,r.useState)(`questions`);return(0,r.useEffect)(()=>{if(!e||t)return;let n=new AbortController;return o.follow({job:{id:e,status:`running`}},{signal:n.signal,onProgress:e=>f(e?.label===`research`?`research`:`questions`)}).then(e=>c(`craft`,{courseId:e.courseId},{replace:!0})).catch(e=>{n.signal.aborted||u(e)}),()=>n.abort()},[e,t]),t?(0,i.jsx)(jd,{courseId:t,edit:n,add:a}):(0,i.jsxs)(`div`,{className:`aha-page`,children:[(0,i.jsx)(`h2`,{className:`aha-title`,children:s(`craftQuestionsTitle`)}),l?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(Wl,{error:l}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,onClick:()=>c(`home`),children:s(`back`)})]}):(0,i.jsx)(Rl,{label:s(d===`research`?`researching`:`thinkingQuestions`)})]})}function jd({courseId:e,edit:t,add:n}){let{api:a,t:o,navigate:s}=v(),c=y(()=>a.call(`course/get`,{courseId:e}),[e]),l=b(),u=c.value?.course;return(0,r.useEffect)(()=>{let e=c.value?.jobs?.questions??c.value?.jobs?.blueprint??c.value?.jobs?.confirm;!e||l.running||l.run(null,null,{existing:e}).then(()=>c.reload()).catch(()=>void 0)},[c.value]),(0,r.useEffect)(()=>{u?.status===`ready`&&!l.running&&!t&&s(`course`,{courseId:e},{replace:!0})},[u?.status]),c.loading&&!c.value?(0,i.jsx)(`div`,{className:`aha-page`,children:(0,i.jsx)(Rl,{label:o(`loading`)})}):c.error&&!c.value?(0,i.jsx)(`div`,{className:`aha-page`,children:(0,i.jsx)(Wl,{error:c.error})}):u?u.status===`intake`?(0,i.jsx)(Md,{course:u,intake:c.value.intake,job:l,onDone:()=>c.reload()}):(0,i.jsx)(Rd,{course:u,proposal:c.value.proposal,progress:c.value.progress,boards:c.value.ready?.boards??[],job:l,onChange:()=>c.reload(),adding:n}):null}function Md({course:e,intake:t,job:n,onDone:a}){let{t:o}=v(),s=t?.questionnaire?.questions??[],[c,l]=(0,r.useState)({}),[u,d]=(0,r.useState)(`balanced`),[f,p]=(0,r.useState)(`auto`),[m,h]=(0,r.useState)(180),[g,_]=(0,r.useState)(``),y=(e,t)=>l(n=>{let r=n[e.id]??{choice:[],other:``},i=e.multi?r.choice.includes(t)?r.choice.filter(e=>e!==t):[...r.choice,t]:[t];return{...n,[e.id]:{...r,choice:i}}});async function b(){try{await n.run(`course/intake`,{courseId:e.id,answers:c,timeline:u,size:f,weeklyMinutes:m,deadline:g||void 0}),a()}catch{}}return n.running?n.progress?.label===`questions`?(0,i.jsxs)(`div`,{className:`aha-page`,children:[(0,i.jsx)(`h2`,{className:`aha-title`,children:e.goal}),(0,i.jsx)(Bl,{progress:n.progress,label:o(`thinkingQuestions`),onCancel:n.cancel})]}):(0,i.jsx)(Pd,{course:e,job:n,research:t?.research}):(0,i.jsxs)(`div`,{className:`aha-page`,children:[(0,i.jsxs)(`div`,{className:`aha-col`,style:{gap:4},children:[(0,i.jsx)(`h2`,{className:`aha-title`,children:o(`craftQuestionsTitle`)}),(0,i.jsx)(`p`,{className:`aha-subtitle`,children:e.goal}),(0,i.jsx)(`p`,{className:`aha-hint`,children:o(`craftQuestionsHint`)}),t?.research?(0,i.jsx)(Nd,{research:t.research}):null]}),s.map((e,t)=>(0,i.jsxs)(`section`,{className:`aha-card`,children:[(0,i.jsxs)(`div`,{className:`aha-cardTitle`,children:[t+1,`. `,e.prompt]}),(0,i.jsx)(`div`,{className:`aha-grid`,style:{gridTemplateColumns:`repeat(auto-fill,minmax(220px,1fr))`},children:e.options.map(t=>(0,i.jsxs)(`button`,{type:`button`,className:`aha-option`,"data-active":c[e.id]?.choice?.includes(t.id)??!1,onClick:()=>y(e,t.id),children:[(0,i.jsx)(`b`,{children:t.label}),t.detail?(0,i.jsx)(`small`,{children:t.detail}):null]},t.id))}),(0,i.jsx)(`input`,{className:`aha-input`,placeholder:o(`craftOther`),value:c[e.id]?.other??``,onChange:t=>{let n=t.currentTarget.value;l(t=>({...t,[e.id]:{choice:t[e.id]?.choice??[],other:n}}))}})]},e.id)),(0,i.jsxs)(`section`,{className:`aha-card`,children:[(0,i.jsx)(`div`,{className:`aha-cardTitle`,children:o(`craftSize`)}),(0,i.jsx)(`div`,{className:`aha-grid`,style:{gridTemplateColumns:`repeat(auto-fill,minmax(180px,1fr))`},children:Od.map(([e,t,n])=>(0,i.jsxs)(`button`,{type:`button`,className:`aha-option`,"data-active":f===e,onClick:()=>p(e),children:[(0,i.jsx)(`b`,{children:o(t)}),(0,i.jsx)(`small`,{children:o(n)})]},e))})]}),(0,i.jsxs)(`section`,{className:`aha-card`,children:[(0,i.jsx)(`div`,{className:`aha-cardTitle`,children:o(`craftPace`)}),(0,i.jsx)(`div`,{className:`aha-grid`,style:{gridTemplateColumns:`repeat(auto-fill,minmax(200px,1fr))`},children:Dd.map(([e,t,n])=>(0,i.jsxs)(`button`,{type:`button`,className:`aha-option`,"data-active":u===e,onClick:()=>d(e),children:[(0,i.jsx)(`b`,{children:o(t)}),(0,i.jsx)(`small`,{children:o(n)})]},e))}),(0,i.jsxs)(`div`,{className:`aha-row`,children:[(0,i.jsxs)(`label`,{className:`aha-label`,style:{flex:1,minWidth:220},children:[o(`weeklyMinutes`),(0,i.jsx)(`select`,{className:`aha-select`,value:m,onChange:e=>h(Number(e.currentTarget.value)),children:kd.map(e=>(0,i.jsx)(`option`,{value:e,children:o(`minutesUnit`,{minutes:e})},e))})]}),(0,i.jsxs)(`label`,{className:`aha-label`,style:{flex:1,minWidth:220},children:[o(`deadline`),(0,i.jsx)(`input`,{className:`aha-input`,type:`date`,value:g,onChange:e=>_(e.currentTarget.value)})]})]})]}),(0,i.jsx)(Wl,{error:n.error}),(0,i.jsx)(`div`,{className:`aha-row`,children:(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,onClick:b,children:o(`makeBlueprint`)})})]})}function Nd({research:e}){let{t}=v();return e.skipped?(0,i.jsx)(`p`,{className:`aha-hint`,children:t(`researchSkipped`,{reason:t(`researchSkipped_${e.skipped}`)})}):(0,i.jsxs)(`details`,{className:`aha-sources`,children:[(0,i.jsx)(`summary`,{children:t(`researchFound`,{count:e.sources.length})}),(0,i.jsx)(Ql,{sources:e.sources})]})}function Pd({course:e,job:t,research:n}){let{t:a}=v(),o=t.preview?.units??[],s=(0,r.useMemo)(()=>wd(t.preview,e.goal),[t.preview,e.goal]),c=o.reduce((e,t)=>e+t.lectures.reduce((e,t)=>e+t.lessons.length,0),0),l=t.progress?.label===`materials`?`materials`:o.length?`lessons`:`units`,u=[...n?.sources?.length?[[`research`,a(`buildResearch`,{count:n.sources.length})]]:[],[`answers`,a(`buildAnswers`)],...e.materialIds?.length?[[`materials`,a(`buildMaterials`)]]:[],[`units`,a(`buildUnits`)],[`lessons`,c?a(`buildLessonsSoFar`,{count:c}):a(`buildLessons`)]],d=u.findIndex(([e])=>e===l);return(0,i.jsxs)(`div`,{className:`aha-page`,children:[(0,i.jsxs)(`div`,{className:`aha-col`,style:{gap:4},children:[(0,i.jsx)(`h2`,{className:`aha-title`,children:t.preview?.title||e.goal}),(0,i.jsxs)(`p`,{className:`aha-hint`,children:[a(`designingBlueprint`),` `,a(`keepsRunning`)]})]}),(0,i.jsx)(`ol`,{className:`aha-buildLog`,children:u.map(([e,t],n)=>(0,i.jsxs)(`li`,{"data-state":n<d?`done`:n===d?`current`:`todo`,children:[(0,i.jsx)(`span`,{className:`aha-buildMark`,"aria-hidden":`true`,children:n<d?`✓`:n===d?(0,i.jsx)(`span`,{className:`aha-spinner`}):``}),(0,i.jsx)(`span`,{children:t})]},e))}),o.length?(0,i.jsx)(Ed,{tree:s,live:!0}):null,(0,i.jsx)(`div`,{className:`aha-row`,children:(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,onClick:t.cancel,children:a(`cancel`)})})]})}function Fd(e){return JSON.parse(JSON.stringify(e??[]))}function Id(e,t,n){let r=[...e],i=t+n;return i<0||i>=r.length?e:([r[t],r[i]]=[r[i],r[t]],r)}function Ld({course:e,job:t,onDone:n,onClose:a}){let{api:o,t:s}=v(),c=y(()=>o.call(`material/list`),[]),[l,u]=(0,r.useState)([]),[d,f]=(0,r.useState)(!1),[p,m]=(0,r.useState)(``),h=new Map((c.value??[]).map(e=>[e.id,e.title]));async function g(){try{await t.run(`course/add-materials`,{courseId:e.id,materialIds:l,instruction:p.trim()}),n()}catch{}}return(0,i.jsxs)(`section`,{className:`aha-card aha-addMaterials`,children:[(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsx)(`b`,{children:s(`addMaterialsTitle`)}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,"data-size":`sm`,onClick:a,children:s(`cancel`)})]}),(0,i.jsx)(`p`,{className:`aha-hint`,children:s(`addMaterialsHint`)}),(0,i.jsxs)(`div`,{className:`aha-row`,style:{gap:6},children:[l.map(e=>(0,i.jsx)(`span`,{className:`aha-tag`,children:h.get(e)??`…`},e)),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,onClick:()=>{c.reload(),f(!0)},children:l.length?s(`changeMaterials`):s(`pickMaterials`)})]}),(0,i.jsx)(`input`,{className:`aha-input`,value:p,placeholder:s(`addMaterialsPlaceholder`),"aria-label":s(`addMaterialsPlaceholder`),onChange:e=>m(e.currentTarget.value)}),(0,i.jsx)(`div`,{className:`aha-row`,children:(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,disabled:!l.length,onClick:g,children:s(`addMaterialsSend`)})}),d?(0,i.jsx)(Yl,{selected:l,max:12,exclude:e.materialIds??[],onChange:e=>{u(e),c.reload()},onClose:()=>f(!1)}):null]})}function Rd({course:e,proposal:t,progress:n,boards:a,job:o,onChange:s,adding:c=!1}){let{api:l,t:u,toast:d,navigate:f}=v(),p=e.status===`ready`,[m,h]=(0,r.useState)(()=>Fd(e.units)),[g,_]=(0,r.useState)(e.title),[y,x]=(0,r.useState)(!1),[S,C]=(0,r.useState)(``),[w,T]=(0,r.useState)(!1),[E,D]=(0,r.useState)(null),[O,k]=(0,r.useState)(null),[A,ee]=(0,r.useState)(null),[te,j]=(0,r.useState)(null),[ne,re]=(0,r.useState)(p?`list`:`map`),[ie,ae]=(0,r.useState)(c),[oe,se]=(0,r.useState)(null),ce=(0,r.useRef)(null),le=b();(0,r.useEffect)(()=>{h(Fd(e.units)),_(e.title),x(!1)},[e]);let ue=e=>{h(t=>{let n=Fd(t);return e(n),n.filter(e=>e.lectures.length).map(e=>({...e,lectures:e.lectures.filter(e=>e.lessons.length)}))}),x(!0)},de=(0,r.useMemo)(()=>m.reduce((e,t)=>e+t.lectures.reduce((e,t)=>e+t.lessons.length,0),0),[m]),fe=(0,r.useMemo)(()=>m.reduce((e,t)=>e+t.lectures.reduce((e,t)=>e+t.lessons.reduce((e,t)=>e+(t.estMinutes||15),0),0),0),[m]),pe=(0,r.useMemo)(()=>t?.blueprint?.units?je(e,t.blueprint):null,[e,t]),me=e=>!!e.id&&((n?.lessons?.[e.id]?.status??`new`)!==`new`||a.includes(e.id)),he=!!pe||!!te,ge=(0,r.useMemo)(()=>({title:g,units:m.map((e,t)=>({key:`u${t}`,title:e.title,lectures:e.lectures.map((e,n)=>({key:`u${t}.${n}`,title:e.title,lessons:e.lessons.map((e,r)=>({key:`u${t}.${n}.${r}`,title:e.title,meta:{depth:e.depth,minutes:e.estMinutes}}))}))}))}),[m,g]),_e=e=>(0,i.jsxs)(i.Fragment,{children:[e.depth?(0,i.jsx)(`span`,{className:`aha-depth`,"data-depth":e.depth,children:u(`depth_${e.depth}`)}):null,(0,i.jsx)(`span`,{children:u(`estMinutes`,{minutes:e.minutes})})]});(0,r.useEffect)(()=>{if(!oe||ne!==`list`)return;let e=ce.current?.querySelector(`[data-path="${oe}"]`);e?.scrollIntoView({block:`center`,behavior:`smooth`}),e?.querySelector(`input`)?.focus({preventScroll:!0});let t=setTimeout(()=>se(null),1700);return()=>clearTimeout(t)},[oe,ne]);async function ve(){T(!0),D(null);try{return await l.call(`course/save-blueprint`,{courseId:e.id,blueprint:{...e,title:g,units:m}}),x(!1),d(u(`saved`)),s(),!0}catch(e){return D(e),!1}finally{T(!1)}}async function ye(t,n){t?.preventDefault();let r=n??S.trim();if(r&&!(y&&!await ve()))try{await o.run(`course/revise`,{courseId:e.id,instruction:r}),C(``),s()}catch{}}async function be(t,n){D(null);try{await l.call(t,{courseId:e.id}),n&&d(n),s()}catch(e){D(e)}}async function xe(t,n,r,i){ee(null);let a=m[t],o=a.lectures[n];j(`${t}.${n}.${r}`);try{let s=await le.run(`course/rework-lesson`,{courseId:e.id,lesson:o.lessons[r],unitTitle:a.title,lectureTitle:o.title,mode:i});ue(e=>{e[t].lectures[n].lessons.splice(r,1,...s.lessons)}),d(u(i===`split`?`splitDone`:`deepenDone`))}catch{}finally{j(null)}}async function Se(){if(!(y&&!await ve()))try{await o.run(`course/confirm`,{courseId:e.id}),s()}catch{}}async function Ce(){y&&!await ve()||f(`course`,{courseId:e.id})}if(o.running){let t=o.progress?.label===`practice`||o.progress?.label===`projects`?u(`confirming`,{done:o.progress.done,total:o.progress.total}):o.progress?.done?u(`revisingSoFar`,{count:o.progress.done}):u(`revising`);return(0,i.jsxs)(`div`,{className:`aha-page`,children:[(0,i.jsxs)(`h2`,{className:`aha-title`,children:[e.emoji,` `,e.title]}),(0,i.jsx)(Bl,{progress:o.progress,label:t,onCancel:o.cancel})]})}let we=(e,t)=>k({text:e,run:t});return(0,i.jsxs)(`div`,{className:`aha-page`,children:[(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsxs)(`div`,{className:`aha-col`,style:{gap:4,flex:1},children:[(0,i.jsx)(`span`,{className:`aha-hint`,children:u(p?`editOutline`:`blueprintTitle`)}),(0,i.jsxs)(`div`,{className:`aha-row`,style:{flexWrap:`nowrap`},children:[(0,i.jsx)(`span`,{style:{fontSize:28},children:e.emoji}),(0,i.jsx)(`input`,{className:`aha-input aha-title`,style:{border:`none`,padding:`2px 4px`},value:g,disabled:he,onChange:e=>{_(e.currentTarget.value),x(!0)}})]}),e.subtitle?(0,i.jsx)(`p`,{className:`aha-subtitle`,children:e.subtitle}):null,(0,i.jsxs)(`p`,{className:`aha-hint`,children:[u(`lessonsCount`,{done:0,total:de}),` · `,u(`minutesLeft`,{minutes:fe})]})]}),(0,i.jsxs)(`div`,{className:`aha-row`,children:[y?(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,disabled:w||he,onClick:ve,children:u(`saveEdits`)}):null,p?(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,disabled:w||he,onClick:Ce,children:u(y?`saveAndBack`:`backToCourse`)}):(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,disabled:he,onClick:Se,children:u(`confirmCourse`)})]})]}),e.summary?(0,i.jsx)(`p`,{children:e.summary}):null,pe?(0,i.jsxs)(`section`,{className:`aha-card aha-proposal`,children:[(0,i.jsxs)(`div`,{className:`aha-col`,style:{gap:2},children:[(0,i.jsx)(`b`,{children:u(`proposalTitle`)}),t.materials?.length?(0,i.jsx)(`span`,{className:`aha-hint`,children:u(`proposalMaterials`,{titles:t.materials.map(e=>`《${e.title}》`).join(``)})}):null,t.instruction?(0,i.jsxs)(`span`,{className:`aha-hint`,children:[`“`,t.instruction,`”`]}):null]}),Me(pe)?(0,i.jsx)(`p`,{className:`aha-hint`,children:u(`proposalNoChange`)}):(0,i.jsxs)(`ul`,{className:`aha-diff`,children:[pe.title?(0,i.jsxs)(`li`,{"data-kind":`renamed`,children:[(0,i.jsx)(`span`,{className:`aha-diffTag`,children:u(`diffRenamed`)}),pe.title.from,` → `,pe.title.to]}):null,pe.unitsAdded.map((e,t)=>(0,i.jsxs)(`li`,{"data-kind":`added`,children:[(0,i.jsx)(`span`,{className:`aha-diffTag`,children:u(`diffAdded`)}),u(`diffUnit`,{title:e})]},`ua${t}`)),pe.unitsRemoved.map((e,t)=>(0,i.jsxs)(`li`,{"data-kind":`removed`,children:[(0,i.jsx)(`span`,{className:`aha-diffTag`,children:u(`diffRemoved`)}),u(`diffUnit`,{title:e})]},`ur${t}`)),pe.added.map((e,t)=>(0,i.jsxs)(`li`,{"data-kind":`added`,children:[(0,i.jsx)(`span`,{className:`aha-diffTag`,children:u(`diffAdded`)}),e.title,(0,i.jsxs)(`span`,{className:`aha-hint`,children:[` · `,e.unit]})]},`a${t}`)),pe.removed.map((e,t)=>(0,i.jsxs)(`li`,{"data-kind":`removed`,children:[(0,i.jsx)(`span`,{className:`aha-diffTag`,children:u(`diffRemoved`)}),e.title,(0,i.jsxs)(`span`,{className:`aha-hint`,children:[` · `,e.unit]})]},`r${t}`)),pe.renamed.map((e,t)=>(0,i.jsxs)(`li`,{"data-kind":`renamed`,children:[(0,i.jsx)(`span`,{className:`aha-diffTag`,children:u(`diffRenamed`)}),e.from,` → `,e.to]},`n${t}`)),pe.changed.map((e,t)=>(0,i.jsxs)(`li`,{"data-kind":`changed`,children:[(0,i.jsx)(`span`,{className:`aha-diffTag`,children:u(`diffChanged`)}),e.title,(0,i.jsxs)(`span`,{className:`aha-hint`,children:[` · `,e.unit]})]},`c${t}`))]}),(0,i.jsxs)(`div`,{className:`aha-row`,children:[(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,onClick:()=>be(`course/proposal-apply`,u(`proposalApplied`)),children:u(`applyProposal`)}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,onClick:()=>be(`course/proposal-discard`),children:u(`discardProposal`)})]})]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`p`,{className:`aha-hint`,children:u(`blueprintHint`)}),(0,i.jsxs)(`form`,{className:`aha-row`,onSubmit:ye,children:[(0,i.jsx)(`input`,{className:`aha-input`,style:{flex:1},value:S,placeholder:u(`revisePlaceholder`),onChange:e=>C(e.currentTarget.value),"aria-label":u(`reviseLabel`)}),(0,i.jsx)(`button`,{type:`submit`,className:`aha-btn`,disabled:!S.trim()||he,children:u(`revise`)}),p?(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,disabled:he,onClick:()=>ye(null,u(`extendInstruction`)),children:u(`extendCourse`)}):null,(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,disabled:he,"aria-expanded":ie,onClick:()=>ae(e=>!e),children:u(`addMaterials`)})]}),ie?(0,i.jsx)(Ld,{course:e,job:o,onClose:()=>ae(!1),onDone:()=>{ae(!1),s()}}):null]}),(0,i.jsx)(Wl,{error:E??o.error??le.error}),(0,i.jsxs)(`div`,{className:`aha-viewToggle`,role:`group`,"aria-label":u(`outlineView`),children:[(0,i.jsx)(`button`,{type:`button`,"aria-pressed":ne===`list`,onClick:()=>re(`list`),children:u(`viewList`)}),(0,i.jsx)(`button`,{type:`button`,"aria-pressed":ne===`map`,onClick:()=>re(`map`),children:u(`viewMap`)})]}),ne===`map`?(0,i.jsx)(Ed,{tree:ge,renderMeta:_e,onPick:e=>{se(e),re(`list`)}}):(0,i.jsxs)(`fieldset`,{ref:ce,className:`aha-tree`,disabled:he,children:[m.map((e,t)=>(0,i.jsxs)(`div`,{className:`aha-unit`,children:[(0,i.jsxs)(`div`,{className:`aha-lesson`,style:{fontWeight:650},children:[(0,i.jsx)(`span`,{className:`aha-tag`,children:u(`unitN`,{n:t+1})}),(0,i.jsx)(`input`,{value:e.title,onChange:e=>{let n=e.currentTarget.value;ue(e=>{e[t].title=n})}}),(0,i.jsx)(zd,{onUp:()=>ue(e=>{e.splice(0,e.length,...Id(e,t,-1))}),onDown:()=>ue(e=>{e.splice(0,e.length,...Id(e,t,1))}),onRemove:()=>we(u(`confirmRemoveUnit`,{title:e.title}),()=>ue(e=>{e.splice(t,1)}))})]}),e.lectures.map((e,n)=>(0,i.jsxs)(`div`,{className:`aha-lecture`,children:[(0,i.jsxs)(`div`,{className:`aha-lesson`,style:{fontWeight:600},children:[(0,i.jsx)(`span`,{className:`aha-hint`,children:u(`lectureN`,{n:n+1})}),(0,i.jsx)(`input`,{value:e.title,onChange:e=>{let r=e.currentTarget.value;ue(e=>{e[t].lectures[n].title=r})}}),(0,i.jsx)(zd,{onUp:()=>ue(e=>{let r=e[t].lectures;r.splice(0,r.length,...Id(r,n,-1))}),onDown:()=>ue(e=>{let r=e[t].lectures;r.splice(0,r.length,...Id(r,n,1))}),onRemove:()=>we(u(`confirmRemoveLecture`,{title:e.title}),()=>ue(e=>{e[t].lectures.splice(n,1)}))})]}),e.lessons.map((e,r)=>{let a=`${t}.${n}.${r}`,o=()=>ue(e=>{e[t].lectures[n].lessons.splice(r,1)});return(0,i.jsxs)(`div`,{className:`aha-lesson`,"data-path":`u${a}`,"data-flash":oe===`u${a}`?`true`:void 0,children:[(0,i.jsx)(`span`,{className:`aha-dot`}),(0,i.jsx)(`input`,{value:e.title,title:e.summary,onChange:e=>{let i=e.currentTarget.value;ue(e=>{e[t].lectures[n].lessons[r].title=i})}}),(0,i.jsxs)(`select`,{className:`aha-depthSelect`,"data-depth":e.depth||void 0,value:e.depth??``,title:u(`depthTitle`),"aria-label":u(`depthTitle`),onChange:e=>{let i=e.currentTarget.value;ue(e=>{let a=e[t].lectures[n].lessons[r];i?a.depth=i:delete a.depth})},children:[(0,i.jsx)(`option`,{value:``,children:u(`depthNone`)}),Oe.map(e=>(0,i.jsx)(`option`,{value:e,children:u(`depth_${e}`)},e))]}),(0,i.jsx)(`span`,{className:`aha-hint`,children:u(`estMinutes`,{minutes:e.estMinutes})}),te===a?(0,i.jsx)(Rl,{}):me(e)?null:(0,i.jsxs)(`span`,{className:`aha-menuAnchor`,children:[(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,"data-size":`sm`,title:u(`reworkLesson`),"aria-label":u(`reworkLesson`),"aria-expanded":A===a,onClick:()=>ee(e=>e===a?null:a),children:`✦`}),A===a?(0,i.jsxs)(`div`,{className:`aha-card aha-menu`,onMouseLeave:()=>ee(null),children:[(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,onClick:()=>xe(t,n,r,`split`),children:u(`splitLesson`)}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,onClick:()=>xe(t,n,r,`deepen`),children:u(`deepenLesson`)})]}):null]}),(0,i.jsx)(zd,{onUp:()=>ue(e=>{let i=e[t].lectures[n].lessons;i.splice(0,i.length,...Id(i,r,-1))}),onDown:()=>ue(e=>{let i=e[t].lectures[n].lessons;i.splice(0,i.length,...Id(i,r,1))}),onRemove:()=>me(e)?we(u(`confirmRemoveStarted`,{title:e.title}),o):o()})]},e.id??r)}),(0,i.jsx)(`div`,{children:(0,i.jsxs)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,"data-size":`sm`,onClick:()=>ue(e=>{e[t].lectures[n].lessons.push({title:u(`untitled`),objectives:[],concepts:[],estMinutes:15})}),children:[`+ `,u(`addLesson`)]})})]},e.id??n)),(0,i.jsx)(`div`,{children:(0,i.jsxs)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,"data-size":`sm`,onClick:()=>ue(e=>{e[t].lectures.push({title:u(`untitled`),lessons:[{title:u(`untitled`),objectives:[],concepts:[],estMinutes:15}]})}),children:[`+ `,u(`addLecture`)]})})]},e.id??t)),(0,i.jsx)(`div`,{children:(0,i.jsxs)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,onClick:()=>ue(e=>{e.push({title:u(`untitled`),objectives:[],lectures:[{title:u(`untitled`),lessons:[{title:u(`untitled`),objectives:[],concepts:[],estMinutes:15}]}]})}),children:[`+ `,u(`addUnit`)]})})]}),e.projects?.length?(0,i.jsxs)(`section`,{className:`aha-col`,children:[(0,i.jsx)(`h3`,{className:`aha-cardTitle`,children:u(`projects`)}),(0,i.jsx)(`div`,{className:`aha-grid`,children:e.projects.map(e=>(0,i.jsxs)(`div`,{className:`aha-card`,children:[(0,i.jsx)(`b`,{children:e.title}),(0,i.jsx)(`p`,{className:`aha-hint`,children:e.brief})]},e.id))})]}):null,O?(0,i.jsx)(Hl,{danger:!0,text:O.text,onConfirm:()=>{O.run(),k(null)},onCancel:()=>k(null)}):null]})}function zd({onUp:e,onDown:t,onRemove:n}){let{t:r}=v();return(0,i.jsxs)(`span`,{className:`aha-row`,style:{gap:2,flexWrap:`nowrap`},children:[(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,"data-size":`sm`,onClick:e,title:r(`moveUp`),"aria-label":r(`moveUp`),children:`↑`}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,"data-size":`sm`,onClick:t,title:r(`moveDown`),"aria-label":r(`moveDown`),children:`↓`}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,"data-size":`sm`,onClick:n,title:r(`remove`),"aria-label":r(`remove`),children:`✕`})]})}function Bd({courseId:e,lessonId:t}){let{api:n,t:a,navigate:o}=v(),s=b(),[c,l]=(0,r.useState)(null),[u,d]=(0,r.useState)(null),f=async r=>{d(null);try{let i=await n.call(`lesson/handout`,{courseId:e,lessonId:t,force:r});l(i.job?(await s.run(null,null,{existing:i.job})).handout:i.handout)}catch(e){d(e)}};(0,r.useEffect)(()=>{f(!1)},[e,t]);let p=()=>{for(let e of document.querySelectorAll(`.aha-handout details`))e.open=!0;window.print()},m=(0,i.jsxs)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,onClick:()=>o(`lesson`,{courseId:e,lessonId:t}),children:[`← `,a(`backToLesson`)]});return u?(0,i.jsxs)(`div`,{className:`aha-page`,children:[(0,i.jsx)(Wl,{error:u}),(0,i.jsx)(`div`,{className:`aha-row`,children:m})]}):c?(0,i.jsxs)(`div`,{className:`aha-page`,style:{maxWidth:860},children:[(0,i.jsxs)(`div`,{className:`aha-spread aha-noprint`,children:[m,(0,i.jsxs)(`div`,{className:`aha-row`,children:[(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,onClick:p,children:a(`print`)}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,onClick:()=>{l(null),f(!0)},children:a(`regenerate`)})]})]}),(0,i.jsxs)(`article`,{className:`aha-printable aha-handout`,children:[(0,i.jsxs)(`header`,{children:[(0,i.jsx)(`span`,{className:`aha-hint`,children:a(`handout`)}),(0,i.jsx)(`h2`,{children:c.title}),c.summary?(0,i.jsx)(`p`,{className:`aha-handoutSummary`,children:(0,i.jsx)(pl,{text:c.summary})}):null]}),(0,i.jsxs)(`section`,{children:[(0,i.jsx)(`h3`,{children:a(`handoutPoints`)}),(0,i.jsx)(`ol`,{className:`aha-handoutPoints`,children:c.points.map((e,t)=>(0,i.jsxs)(`li`,{children:[(0,i.jsx)(`b`,{children:(0,i.jsx)(pl,{text:e.title})}),e.oneLine?(0,i.jsx)(`div`,{className:`aha-handoutOneLine`,children:(0,i.jsx)(pl,{text:e.oneLine})}):null,e.detail?(0,i.jsx)(`div`,{className:`aha-hint`,children:(0,i.jsx)(pl,{text:e.detail})}):null]},t))})]}),c.example?(0,i.jsxs)(`section`,{children:[(0,i.jsx)(`h3`,{children:a(`handoutExample`)}),(0,i.jsx)(`p`,{children:(0,i.jsx)(pl,{text:c.example.problem})}),(0,i.jsx)(`ol`,{className:`aha-handoutSteps`,children:c.example.steps.map((e,t)=>(0,i.jsx)(`li`,{children:(0,i.jsx)(pl,{text:e})},t))}),c.example.answer?(0,i.jsxs)(`div`,{className:`aha-handoutAnswer`,children:[(0,i.jsx)(`b`,{children:a(`handoutAnswer`)}),` `,(0,i.jsx)(pl,{text:c.example.answer})]}):null]}):null,c.mistakes.length?(0,i.jsxs)(`section`,{children:[(0,i.jsx)(`h3`,{children:a(`handoutMistakes`)}),(0,i.jsx)(`ul`,{className:`aha-handoutMistakes`,children:c.mistakes.map((e,t)=>(0,i.jsxs)(`li`,{children:[(0,i.jsx)(`span`,{"data-wrong":`true`,children:(0,i.jsx)(pl,{text:e.mistake})}),e.fix?(0,i.jsxs)(`span`,{children:[`→ `,(0,i.jsx)(pl,{text:e.fix})]}):null]},t))})]}):null,c.glossary.length?(0,i.jsxs)(`section`,{children:[(0,i.jsx)(`h3`,{children:a(`handoutGlossary`)}),(0,i.jsx)(`dl`,{className:`aha-handoutGlossary`,children:c.glossary.map((e,t)=>(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`dt`,{children:(0,i.jsx)(pl,{text:e.term})}),(0,i.jsx)(`dd`,{children:(0,i.jsx)(pl,{text:e.meaning})})]},t))})]}):null,c.questions.length?(0,i.jsxs)(`section`,{children:[(0,i.jsx)(`h3`,{children:a(`handoutQuestions`)}),(0,i.jsx)(`ol`,{className:`aha-handoutQuestions`,children:c.questions.map((e,t)=>(0,i.jsxs)(`li`,{children:[(0,i.jsx)(pl,{text:e.question}),e.answer?(0,i.jsxs)(`details`,{children:[(0,i.jsx)(`summary`,{children:a(`handoutAnswer`)}),(0,i.jsx)(pl,{text:e.answer})]}):null]},t))})]}):null]})]}):(0,i.jsx)(`div`,{className:`aha-page`,children:(0,i.jsx)(Bl,{progress:s.progress,label:a(`handoutMaking`),onCancel:s.running?s.cancel:void 0})})}function Vd({item:e,day:t,today:n,onToggle:r}){let{t:a,navigate:o}=v(),s=e.kind!==`exam`&&t<=n,c=e.checked===`auto`;return(0,i.jsxs)(`div`,{className:`aha-planItem`,"data-checked":e.checked?`true`:void 0,children:[s?(0,i.jsx)(`input`,{type:`checkbox`,className:`aha-check`,checked:!!e.checked,disabled:c,title:c?a(`checkedAuto`):void 0,"aria-label":e.checked?a(`unmarkDone`):a(`markDone`),onChange:()=>r?.(e,t)}):null,(0,i.jsx)(`span`,{className:`aha-tag`,children:e.kind===`lesson`?a(`lessonItem`):e.kind===`review`?a(`reviewItem`):a(`examItem`)}),(0,i.jsxs)(`span`,{className:`aha-planTitle`,children:[e.title,(0,i.jsx)($l,{title:e.courseTitle,emoji:e.courseEmoji})]}),e.minutes?(0,i.jsx)(`span`,{className:`aha-hint`,children:a(`minutesUnit`,{minutes:e.minutes})}):null,e.kind===`lesson`&&!e.checked?(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,onClick:()=>o(`lesson`,{courseId:e.courseId,lessonId:e.refId}),children:a(`learn`)}):null,e.kind===`review`&&!e.checked&&t===n?(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,onClick:()=>o(`practice`,{courseId:e.courseId??void 0,review:!0}),children:a(`review`)}):null]})}function Hd(e,t,n,r){return t.checked===`manual`?e.call(`plan/uncheck`,{today:r,day:n,refId:t.refId}):e.call(`plan/check`,{today:r,day:n,item:t})}function Ud(e){let t=e instanceof Date?e:new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function Wd(e){let t=/^(\d{4})-(\d{2})-(\d{2})$/u.exec(String(e));if(!t)throw TypeError(`invalid day "${e}"`);return new Date(Number(t[1]),Number(t[2])-1,Number(t[3]))}let Gd=[[`course`,`modeCourse`,`🎓`],[`explain`,`modeExplain`,`💡`],[`solve`,`modeSolve`,`🧮`],[`visualize`,`modeVisualize`,`📈`],[`digest`,`modeDigest`,`📚`],[`short`,`modeShort`,`🎬`]];function Kd(){let{api:e,t,navigate:n,toast:a}=v(),[o,s]=(0,r.useState)(`course`),[c,l]=C(`craftWeb`,!0),[u,d]=(0,r.useState)(null),[f,p]=(0,r.useState)(``),[m,h]=(0,r.useState)([]),[g,_]=(0,r.useState)(!1),[b,x]=(0,r.useState)(!1),[S,w]=(0,r.useState)(null),T=y(()=>e.call(`course/list`),[]),E=y(()=>e.call(`plan/get`,{today:Ud(new Date)}),[]),D=y(()=>e.call(`samples/list`),[]),O=u??(!m.length&&c);function k(){d(!O),m.length||l(!O)}async function A(t=!1){let r=f.trim();if(w(null),o===`course`){if(!r&&!m.length)return;x(!0);try{let{job:i}=await e.call(`course/start`,{goal:r,materialIds:m,quick:t,web:O});n(`craft`,{jobId:i.id})}catch(e){w(e)}finally{x(!1)}return}if(o===`digest`){if(!m.length){_(!0);return}n(`item`,{kind:`digest`,materialId:m[0]});return}if(o===`short`){let e=/^https?:\/\//iu.test(r);n(`shorts`,{draftTopic:e?``:r,draftUrl:e?r:``,token:Date.now().toString(36)});return}r&&n(`assist`,{draftMode:o,draftRequest:r,draftMaterials:m,token:Date.now().toString(36)})}let ee=(T.value??[]).filter(e=>e.status===`ready`&&!e.archived&&e.progress.percent<100).slice(0,3),te=(T.value??[]).filter(e=>e.status!==`ready`&&!e.archived).slice(0,2),j=E.value?.today??[],ne=Ud(new Date);async function re(t,n){try{E.setValue(await Hd(e,t,n,ne))}catch(e){w(e)}}return(0,i.jsxs)(`div`,{className:`aha-page`,children:[(0,i.jsxs)(`section`,{className:`aha-hero`,children:[(0,i.jsx)(`div`,{className:`aha-heroTitle`,children:t(`heroTitle`)}),(0,i.jsx)(`p`,{className:`aha-subtitle`,children:t(`heroHint`)}),(0,i.jsxs)(`div`,{className:`aha-composer`,children:[(0,i.jsx)(`textarea`,{value:f,placeholder:t(`heroPlaceholder`),onChange:e=>p(e.currentTarget.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&A()}}),(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsxs)(`div`,{className:`aha-row`,style:{gap:6},children:[(0,i.jsxs)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,onClick:()=>_(!0),children:[(0,i.jsx)(ut,{name:`plus`,size:15}),m.length?t(`attached`,{count:m.length}):t(`attach`)]}),o===`course`?(0,i.jsxs)(`button`,{type:`button`,className:`aha-chip`,"data-active":O,"aria-pressed":O,onClick:k,title:t(`webResearchHint`),children:[`🌐 `,t(`webResearch`)]}):null]}),(0,i.jsxs)(`div`,{className:`aha-row`,style:{gap:6},children:[o===`course`?(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,disabled:b,onClick:()=>A(!0),children:t(`quickStart`)}):null,(0,i.jsxs)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,disabled:b||!f.trim()&&!m.length,onClick:()=>A(!1),children:[b?(0,i.jsx)(`span`,{className:`aha-spinner`}):null,t(`start`)]})]})]})]}),(0,i.jsx)(`div`,{className:`aha-row`,style:{gap:8},children:Gd.map(([e,n,r])=>(0,i.jsxs)(`button`,{type:`button`,className:`aha-chip`,"data-active":o===e,onClick:()=>s(e),children:[r,` `,t(n)]},e))}),(0,i.jsx)(Wl,{error:S})]}),ee.length||te.length?(0,i.jsxs)(`section`,{className:`aha-col`,children:[(0,i.jsx)(`h3`,{className:`aha-cardTitle`,children:t(`continueLearning`)}),(0,i.jsx)(`div`,{className:`aha-grid`,children:[...te,...ee].map(e=>(0,i.jsxs)(`div`,{className:`aha-card`,"data-click":`true`,onClick:()=>n(e.status===`ready`?`course`:`craft`,{courseId:e.id}),children:[(0,i.jsxs)(`div`,{className:`aha-row`,children:[(0,i.jsx)(`span`,{style:{fontSize:24},children:e.emoji}),(0,i.jsx)(`span`,{className:`aha-cardTitle`,children:e.title})]}),e.status===`ready`?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(zl,{value:e.progress.percent}),(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsx)(`span`,{className:`aha-hint`,children:t(`lessonsCount`,e.progress)}),e.next?(0,i.jsx)(`span`,{className:`aha-hint`,children:t(`nextUp`,{title:e.next.title})}):null]}),e.next?(0,i.jsxs)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,onClick:t=>{t.stopPropagation(),n(`lesson`,{courseId:e.id,lessonId:e.next.lessonId})},children:[(0,i.jsx)(ut,{name:`play`,size:14}),t(`continueLearning`)]}):null]}):(0,i.jsx)(`span`,{className:`aha-tag`,children:e.status===`intake`?t(`statusIntake`):t(`statusBlueprint`)})]},e.id))})]}):null,(0,i.jsxs)(`section`,{className:`aha-col`,children:[(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsx)(`h3`,{className:`aha-cardTitle`,children:t(`todayPlan`)}),(0,i.jsxs)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,"data-size":`sm`,onClick:()=>n(`plan`),children:[t(`navPlan`),` →`]})]}),E.loading&&!E.value?(0,i.jsx)(Rl,{}):j.length?(0,i.jsx)(`div`,{className:`aha-col`,style:{gap:6},children:j.map(e=>(0,i.jsx)(`div`,{className:`aha-card`,style:{padding:`6px 14px`},children:(0,i.jsx)(Vd,{item:e,day:ne,today:ne,onToggle:re})},`${e.kind}:${e.refId}`))}):(0,i.jsx)(Gl,{children:t(`noPlanToday`)})]}),D.value?.length?(0,i.jsxs)(`section`,{className:`aha-col`,children:[(0,i.jsx)(`h3`,{className:`aha-cardTitle`,children:t(`sampleCourses`)}),(0,i.jsx)(`p`,{className:`aha-hint`,children:t(`sampleHint`)}),(0,i.jsx)(`div`,{className:`aha-grid`,children:D.value.map(r=>(0,i.jsxs)(`div`,{className:`aha-card`,children:[(0,i.jsxs)(`div`,{className:`aha-row`,children:[(0,i.jsx)(`span`,{style:{fontSize:24},children:r.emoji}),(0,i.jsx)(`span`,{className:`aha-cardTitle`,children:r.title})]}),(0,i.jsx)(`p`,{className:`aha-hint`,children:r.subtitle}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,onClick:async()=>{try{let i=await e.call(`samples/import`,{id:r.id});a(t(`courseReady`)),n(`course`,{courseId:i.id})}catch(e){a(Ul(t,e))}},children:t(`importSample`)})]},r.id))})]}):null,g?(0,i.jsx)(Yl,{selected:m,onChange:h,onClose:()=>_(!1)}):null]})}let qd=`http://www.w3.org/2000/svg`,Jd=new Set([`SCRIPT`,`STYLE`,`TEMPLATE`,`IFRAME`,`BUTTON`,`INPUT`,`TEXTAREA`,`SELECT`]),Yd=[`Top`,`Right`,`Bottom`,`Left`],Xd=[`fill`,`fill-opacity`,`fill-rule`,`stroke`,`stroke-width`,`stroke-opacity`,`stroke-dasharray`,`stroke-dashoffset`,`stroke-linecap`,`stroke-linejoin`,`stroke-miterlimit`,`opacity`,`font-family`,`font-size`,`font-style`,`font-weight`,`text-anchor`,`dominant-baseline`],Zd=typeof Intl<`u`&&typeof Intl.Segmenter==`function`?new Intl.Segmenter(void 0,{granularity:`grapheme`}):null;function Qd(e){if(Zd)return Array.from(Zd.segment(e),e=>({index:e.index,text:e.segment}));let t=[],n=0;for(let r of e)t.push({index:n,text:r}),n+=r.length;return t}function $d(e){if(!e||e===`transparent`||e===`none`)return!1;let t=/^(?:rgba?|hsla?|color|lab|lch|oklab|oklch)\((.*)\)$/u.exec(e.trim());if(!t)return!0;let n=t[1],r=n.includes(`/`)?n.split(`/`).pop():n.split(`,`).length===4?n.split(`,`).pop():null;return r===null||Number.parseFloat(r)>0}function ef(e){if(!e||!e.startsWith(`linear-gradient(`))return[];let t=e.slice(16);if(/^\s*(?:to\s+(?!bottom)|-?[\d.]+(?:deg|turn|rad))/u.test(t)&&!/^\s*180deg/u.test(t))return[];let n=[...t.matchAll(/((?:rgba?|hsla?|color|oklab|oklch|lab|lch)\([^)]*\)|transparent|#[0-9a-f]{3,8})\s+(-?[\d.]+)%/giu)].map(e=>({color:e[1],at:Number.parseFloat(e[2])/100})),r=[];for(let e=0;e+1<n.length;e+=1){let[t,i]=[n[e],n[e+1]];t.color===i.color&&$d(t.color)&&i.at>t.at&&r.push({color:t.color,from:Math.max(0,t.at),to:Math.min(1,i.at)})}return r}function tf(e,t,n){let[r,i=r]=String(e||`0`).trim().split(/\s+/u),a=(e,t)=>e.endsWith(`%`)?Number.parseFloat(e)/100*t:Number.parseFloat(e)||0;return{x:a(r,t),y:a(i,n)}}function nf(e,t,n){let r=[e.borderTopLeftRadius,e.borderTopRightRadius,e.borderBottomRightRadius,e.borderBottomLeftRadius].map(e=>tf(e,t,n));return r.some(e=>e.x>0&&e.y>0)?r:null}function rf(e){return`${e.fontStyle.startsWith(`oblique`)?`italic`:e.fontStyle} ${e.fontWeight} ${e.fontSize} ${e.fontFamily}`}function af(e,t){if(!e)return t;if(!t)return e;let n=Math.max(e.x,t.x),r=Math.max(e.y,t.y);return{x:n,y:r,w:Math.max(0,Math.min(e.x+e.w,t.x+t.w)-n),h:Math.max(0,Math.min(e.y+e.h,t.y+t.h)-r)}}function of(e,t){let n=Math.min(e.x,t.x),r=Math.min(e.y,t.y);return{x:n,y:r,w:Math.max(e.x+e.w,t.x+t.w)-n,h:Math.max(e.y+e.h,t.y+t.h)-r}}function sf(e,t){return e===`dashed`?[t*3,t*2.2]:e===`dotted`?[.01,t*2]:null}async function cf(e,{timeoutMs:t=1e4}={}){e.offsetHeight,await new Promise(e=>{setTimeout(e,50)});let n=document.fonts;if(!n)return;let r=(e.textContent??``).slice(0,2e4),i=[`Aha Hand Latin`,`Aha Hand`].map(e=>n.load?.(`20px '${e}'`,r).catch(()=>void 0));await Promise.race([Promise.all([...i,n.ready]),new Promise(e=>{setTimeout(e,t)})])}function lf(e){for(let t of e.querySelectorAll(`.aha-op-math`))xc(t);for(let t of e.querySelectorAll(`.aha-op-table`)){let e=t.closest(`.aha-op`)?.clientWidth??0;if(!e||t.offsetWidth<=e+1)continue;let n=e/t.offsetWidth,r=getComputedStyle(t);t.style.fontSize=`${Math.max(10,(Number.parseFloat(r.fontSize)||16)*n)}px`,t.style.lineHeight=`${Math.max(14,(Number.parseFloat(r.lineHeight)||24)*n)}px`}}function uf(e,{scale:t=2}={}){let n=e.getBoundingClientRect(),r=[],i=new Map,a=document.createElement(`canvas`).getContext(`2d`),o=document.createRange(),s=e=>({x:e.left-n.left,y:e.top-n.top,w:e.width,h:e.height}),c=e=>{let t=i.get(e);if(!t){a.font=e;let n=a.measureText(`Hg`),r=Number.parseFloat(/([\d.]+)px/u.exec(e)?.[1]??`16`);t={ascent:Number.isFinite(n.fontBoundingBoxAscent)?n.fontBoundingBoxAscent:r*.8,descent:Number.isFinite(n.fontBoundingBoxDescent)?n.fontBoundingBoxDescent:r*.2},i.set(e,t)}return t},l=getComputedStyle(e);r.push({kind:`paper`,w:n.width,h:n.height,paper:l.getPropertyValue(`--paper`).trim()||l.backgroundColor,dot:l.getPropertyValue(`--grid`).trim()});let u=(e,t)=>{let i=e.data;if(!i||!/\S/u.test(i))return;let a=getComputedStyle(e.parentElement);if(!$d(a.color))return;let s=rf(a),{ascent:l}=c(s),u=null,d=()=>{u&&/\S/u.test(u.text)&&r.push({kind:`text`,text:u.text,x:u.x,y:u.top+l,font:s,color:a.color,alpha:t.alpha,clip:t.clip}),u=null};for(let t of Qd(i)){if(t.text===`
|
|
271
|
+
`||t.text===`\r`||t.text===` `){d();continue}o.setStart(e,t.index),o.setEnd(e,t.index+t.text.length);let r=o.getClientRects(),i=r[r.length-1];if(!i||i.width<=0){/\s/u.test(t.text)||d();continue}let a=i.left-n.left,s=i.top-n.top;u&&Math.abs(s-u.top)<1&&Math.abs(a-u.right)<1?(u.text+=t.text,u.right=a+i.width):(d(),u={text:t.text,x:a,top:s,right:a+i.width})}d()},d=(e,t,n,i,a)=>{let o=t.backgroundColor,c=ef(t.backgroundImage);for(let e of n){let n=s(e);$d(o)&&r.push({kind:`fill`,box:n,color:o,radius:nf(t,n.w,n.h),alpha:i,clip:a});for(let e of c)r.push({kind:`fill`,box:{x:n.x,y:n.y+n.h*e.from,w:n.w,h:n.h*(e.to-e.from)},color:e.color,alpha:i,clip:a})}let l=Yd.map(e=>({width:Number.parseFloat(t[`border${e}Width`])||0,style:t[`border${e}Style`],color:t[`border${e}Color`]})),u=l.map(e=>e.width>0&&e.style!==`none`&&e.style!==`hidden`&&$d(e.color));if(!u.some(Boolean))return;let d=(e.tagName===`TD`||e.tagName===`TH`)&&t.borderCollapse===`collapse`,f=!d&&u.every(Boolean)&&l.every(e=>e.width===l[0].width&&e.style===l[0].style&&e.color===l[0].color);for(let e of n){let n=s(e);if(f){let e=l[0].width,o=nf(t,n.w,n.h)?.map(t=>({x:Math.max(0,t.x-e/2),y:Math.max(0,t.y-e/2)}))??null;r.push({kind:`stroke`,box:{x:n.x+e/2,y:n.y+e/2,w:Math.max(0,n.w-e),h:Math.max(0,n.h-e)},width:e,color:l[0].color,dash:sf(l[0].style,e),radius:o,alpha:i,clip:a});continue}l.forEach((e,t)=>{if(!u[t])return;let o=d?0:e.width/2,s=[[n.x,n.y+o,n.x+n.w,n.y+o],[n.x+n.w-o,n.y,n.x+n.w-o,n.y+n.h],[n.x,n.y+n.h-o,n.x+n.w,n.y+n.h-o],[n.x+o,n.y,n.x+o,n.y+n.h]][t];r.push({kind:`line`,points:s,width:e.width,color:e.color,dash:sf(e.style,e.width),alpha:i,clip:a})})}},f=(e,t,n,i)=>{let a=e.parentElement;if(!a||t.listStyleType===`none`||t.display!==`list-item`)return;let o=rf(t),{ascent:l,descent:u}=c(o),d=Number.parseFloat(t.fontSize)||16,f=Number.parseFloat(t.lineHeight)||(l+u)*1.2,p=s(e.getBoundingClientRect()),m=[...a.children].filter(e=>e.tagName===`LI`),h=a.tagName===`OL`?`${m.indexOf(e)+(Number(a.getAttribute(`start`))||1)}.`:`•`;r.push({kind:`text`,text:h,align:`right`,x:p.x-d*.4,y:p.y+(Number.parseFloat(t.paddingTop)||0)+(f-l-u)/2+l,font:o,color:t.color,alpha:n,clip:i})},p=(e,i,a,o)=>{let l=e.getBoundingClientRect(),u=s(l),d=i.overflow===`visible`||i.overflowX===`visible`;if(d)try{let t=e.getBBox(),r=e.getScreenCTM();if(r&&(t.width||t.height)){let e=[[t.x,t.y],[t.x+t.width,t.y],[t.x,t.y+t.height],[t.x+t.width,t.y+t.height]].map(([e,t])=>[r.a*e+r.c*t+r.e-n.left,r.b*e+r.d*t+r.f-n.top]),i=e.map(e=>e[0]),a=e.map(e=>e[1]);u=of(u,{x:Math.min(...i)-4,y:Math.min(...a)-4,w:Math.max(...i)-Math.min(...i)+8,h:Math.max(...a)-Math.min(...a)+8})}}catch{}if(u=af(u,o??{x:0,y:0,w:n.width,h:n.height}),u.w<.5||u.h<.5)return;let f=[],p=e.cloneNode(!0),m=(e,t)=>{let r=getComputedStyle(e),i=Xd.map(e=>[e,r.getPropertyValue(e)]).filter(([,e])=>e&&!e.includes(`url(`));r.display===`none`&&i.push([`display`,`none`]),r.visibility===`hidden`&&i.push([`visibility`,`hidden`]),t.setAttribute(`style`,i.map(([e,t])=>`${e}:${t}`).join(`;`));let s=e.tagName.toLowerCase();if((s===`text`||s===`tspan`)&&![...e.children].length&&/\S/u.test(e.textContent??``)){let i=e.getScreenCTM?.(),s=i&&Math.abs(i.b)<.001&&Math.abs(i.c)<.001&&i.a>0,l=r.fill;if(s&&$d(l)&&!l.includes(`url(`)&&!$d(r.stroke)&&r.display!==`none`&&r.visibility!==`hidden`){let s=e.getBoundingClientRect(),u=(Number.parseFloat(r.fontSize)||16)*i.d,d=`${r.fontStyle.startsWith(`oblique`)?`italic`:r.fontStyle} ${r.fontWeight} ${u}px ${r.fontFamily}`,p=(Number.parseFloat(r.fillOpacity)||1)*(Number.parseFloat(r.opacity)||1);f.push({kind:`text`,text:e.textContent.replace(/\s+/gu,` `).trim(),x:s.left-n.left,y:s.top-n.top+c(d).ascent,font:d,color:l,alpha:a*p,clip:o}),t.setAttribute(`style`,`${t.getAttribute(`style`)};visibility:hidden`)}}let l=[...e.children],u=[...t.children];l.forEach((e,t)=>{u[t]&&m(e,u[t])})};m(e,p),p.setAttribute(`x`,String(l.left-n.left-u.x)),p.setAttribute(`y`,String(l.top-n.top-u.y)),p.setAttribute(`width`,String(l.width)),p.setAttribute(`height`,String(l.height)),d&&p.setAttribute(`overflow`,`visible`);let h=new XMLSerializer().serializeToString(p),g=`<svg xmlns="${qd}" width="${Math.ceil(u.w*t)}" height="${Math.ceil(u.h*t)}" viewBox="0 0 ${u.w} ${u.h}" preserveAspectRatio="none">${h}</svg>`;r.push({kind:`image`,markup:g,box:u,alpha:a,clip:null}),r.push(...f)},m=(e,t)=>{if(Jd.has(e.tagName)||e.classList.contains(`katex-mathml`))return;let n=getComputedStyle(e);if(n.display===`none`||n.visibility===`hidden`||n.visibility===`collapse`)return;let r=t.alpha*(Number.parseFloat(n.opacity)||0);if(r<=.01)return;if(e.namespaceURI===qd){e.tagName.toLowerCase()===`svg`&&p(e,n,r,t.clip);return}d(e,n,[...e.getClientRects()].filter(e=>e.width>0&&e.height>0),r,t.clip),e.tagName===`LI`&&f(e,n,r,t.clip);let i=n.overflowX!==`visible`||n.overflowY!==`visible`;h(e,{alpha:r,clip:i?af(t.clip,s(e.getBoundingClientRect())):t.clip})},h=(e,t)=>{for(let n of e.childNodes)n.nodeType===Node.TEXT_NODE?u(n,t):n.nodeType===Node.ELEMENT_NODE&&m(n,t)};return h(e,{alpha:1,clip:null}),o.detach?.(),{width:Math.ceil(n.width),height:Math.ceil(n.height),ops:r}}async function df(e){return await Promise.all(e.ops.map(async e=>{if(e.kind!==`image`)return;let t=new Image;t.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e.markup)}`;try{await t.decode(),e.image=t}catch{e.image=null}})),e}function ff(e,t,n){e.beginPath(),n&&e.roundRect?e.roundRect(t.x,t.y,t.w,t.h,n):e.rect(t.x,t.y,t.w,t.h)}let pf={paper(e,t){if(e.fillStyle=t.paper||`#fdfcf8`,e.fillRect(0,0,t.w,t.h),t.dot){e.fillStyle=t.dot,e.beginPath();for(let n=22/2;n<t.w;n+=22)for(let r=22/2;r<t.h;r+=22)e.moveTo(n+1.1,r),e.arc(n,r,1.1,0,Math.PI*2);e.fill()}},fill(e,t){e.fillStyle=t.color,ff(e,t.box,t.radius),e.fill()},stroke(e,t){e.strokeStyle=t.color,e.lineWidth=t.width,t.dash&&(e.setLineDash(t.dash),e.lineCap=t.dash[0]<.1?`round`:`butt`),ff(e,t.box,t.radius),e.stroke()},line(e,t){e.strokeStyle=t.color,e.lineWidth=t.width,t.dash&&(e.setLineDash(t.dash),e.lineCap=t.dash[0]<.1?`round`:`butt`),e.beginPath(),e.moveTo(t.points[0],t.points[1]),e.lineTo(t.points[2],t.points[3]),e.stroke()},text(e,t){e.font=t.font,e.fillStyle=t.color,e.textBaseline=`alphabetic`,e.textAlign=t.align??`left`,e.fillText(t.text,t.x,t.y)},image(e,t){t.image&&e.drawImage(t.image,t.box.x,t.box.y,t.box.w,t.box.h)}};function mf(e,t=2){let n=document.createElement(`canvas`);n.width=Math.max(1,Math.round(e.width*t)),n.height=Math.max(1,Math.round(e.height*t));let r=n.getContext(`2d`);r.scale(t,t);for(let t of e.ops)r.save(),r.globalAlpha=Math.min(1,t.alpha??1),t.clip&&(r.beginPath(),r.rect(t.clip.x,t.clip.y,t.clip.w,t.clip.h),r.clip()),pf[t.kind]?.(r,t),r.restore();return n}function hf(e){let t=`FEFF`;for(let n of String(e??``)){let e=n.codePointAt(0),r=e>65535?[55296+(e-65536>>10),56320+(e-65536&1023)]:[e];for(let e of r)t+=e.toString(16).toUpperCase().padStart(4,`0`)}return`<${t}>`}function gf(e){let t=e=>String(e).padStart(2,`0`);return`(D:${e.getUTCFullYear()}${t(e.getUTCMonth()+1)}${t(e.getUTCDate())}${t(e.getUTCHours())}${t(e.getUTCMinutes())}${t(e.getUTCSeconds())}Z)`}let _f=e=>String(Math.round(e*.75*100)/100);function vf(e,{title:t=``,creator:n=``,date:r=new Date}={}){let i=new TextEncoder,a=[],o=[],s=0,c=e=>{let t=typeof e==`string`?i.encode(e):e;a.push(t),s+=t.length},l=(e,...t)=>{o[e]=s,c(`${e} 0 obj\n`);for(let e of t)c(e);c(`
|
|
272
272
|
endobj
|
|
273
273
|
`)};c(`%PDF-1.4
|
|
274
|
-
`),c(new Uint8Array([37,226,227,207,211,10]));let u=e=>4+e*3;l(1,`<< /Type /Catalog /Pages 2 0 R >>`),l(2,`<< /Type /Pages /Kids [${e.map((e,t)=>`${u(t)} 0 R`).join(` `)}] /Count ${e.length} >>`),l(3,`<< /Title ${
|
|
274
|
+
`),c(new Uint8Array([37,226,227,207,211,10]));let u=e=>4+e*3;l(1,`<< /Type /Catalog /Pages 2 0 R >>`),l(2,`<< /Type /Pages /Kids [${e.map((e,t)=>`${u(t)} 0 R`).join(` `)}] /Count ${e.length} >>`),l(3,`<< /Title ${hf(t)} /Creator ${hf(n)} /Producer ${hf(n)} /CreationDate ${gf(r)} >>`),e.forEach((e,t)=>{let n=u(t),r=_f(e.width),i=_f(e.height);l(n,`<< /Type /Page /Parent 2 0 R /MediaBox [0 0 ${r} ${i}] /Resources << /XObject << /P${t} ${n+2} 0 R >> >> /Contents ${n+1} 0 R >>`);let a=`q ${r} 0 0 ${i} 0 0 cm /P${t} Do Q`;l(n+1,`<< /Length ${a.length} >>\nstream\n`,a,`
|
|
275
275
|
endstream`);let{image:o}=e;l(n+2,`<< /Type /XObject /Subtype /Image /Width ${o.width} /Height ${o.height} /ColorSpace /DeviceRGB /BitsPerComponent 8 /Filter /${o.filter} /Length ${o.data.length} >>\nstream\n`,o.data,`
|
|
276
|
-
endstream`)});let d=4+e.length*3,f=s;c(`xref\n0 ${d}\n0000000000 65535 f \n`);for(let e=1;e<d;e+=1)c(`${String(o[e]).padStart(10,`0`)} 00000 n \n`);c(`trailer\n<< /Size ${d} /Root 1 0 R /Info 3 0 R >>\nstartxref\n${f}\n%%EOF\n`);let p=new Uint8Array(s),m=0;for(let e of a)p.set(e,m),m+=e.length;return p}async function vf(e){let t=new Blob([e]).stream().pipeThrough(new CompressionStream(`deflate`));return new Uint8Array(await new Response(t).arrayBuffer())}async function yf(e){let{width:t,height:n}=e;if(typeof CompressionStream==`function`){let{data:r}=e.getContext(`2d`).getImageData(0,0,t,n),i=new Uint8Array(t*n*3);for(let e=0,t=0;e<r.length;e+=4,t+=3)i[t]=r[e],i[t+1]=r[e+1],i[t+2]=r[e+2];return{width:t,height:n,filter:`FlateDecode`,data:await vf(i)}}let r=await new Promise(t=>{e.toBlob(t,`image/jpeg`,.92)});if(!r)throw Error(`image encoding failed`);return{width:t,height:n,filter:`DCTDecode`,data:new Uint8Array(await r.arrayBuffer())}}let bf=null;function xf(e){if(!bf){bf=new Uint32Array(256);for(let e=0;e<256;e+=1){let t=e;for(let e=0;e<8;e+=1)t=t&1?3988292384^t>>>1:t>>>1;bf[e]=t>>>0}}let t=4294967295;for(let n of e)t=bf[(t^n)&255]^t>>>8;return(t^4294967295)>>>0}function Sf(e){return{time:e.getHours()<<11|e.getMinutes()<<5|Math.floor(e.getSeconds()/2),day:Math.max(0,e.getFullYear()-1980)<<9|e.getMonth()+1<<5|e.getDate()}}function Cf(e,t=new Date){let n=new TextEncoder,{time:r,day:i}=Sf(t),a=[],o=[],s=0;for(let t of e){let e=n.encode(t.name),c=xf(t.data),l=t.data.length,u=new DataView(new ArrayBuffer(30));u.setUint32(0,67324752,!0),u.setUint16(4,20,!0),u.setUint16(6,2048,!0),u.setUint16(8,0,!0),u.setUint16(10,r,!0),u.setUint16(12,i,!0),u.setUint32(14,c,!0),u.setUint32(18,l,!0),u.setUint32(22,l,!0),u.setUint16(26,e.length,!0),u.setUint16(28,0,!0),a.push(new Uint8Array(u.buffer),e,t.data);let d=new DataView(new ArrayBuffer(46));d.setUint32(0,33639248,!0),d.setUint16(4,20,!0),d.setUint16(6,20,!0),d.setUint16(8,2048,!0),d.setUint16(10,0,!0),d.setUint16(12,r,!0),d.setUint16(14,i,!0),d.setUint32(16,c,!0),d.setUint32(20,l,!0),d.setUint32(24,l,!0),d.setUint16(28,e.length,!0),d.setUint32(42,s,!0),o.push(new Uint8Array(d.buffer),e),s+=30+e.length+l}let c=o.reduce((e,t)=>e+t.length,0),l=new DataView(new ArrayBuffer(22));l.setUint32(0,101010256,!0),l.setUint16(8,e.length,!0),l.setUint16(10,e.length,!0),l.setUint32(12,c,!0),l.setUint32(16,s,!0);let u=[...a,...o,new Uint8Array(l.buffer)],d=new Uint8Array(u.reduce((e,t)=>e+t.length,0)),f=0;for(let e of u)d.set(e,f),f+=e.length;return d}function wf(e){return new Promise((t,n)=>{e.toBlob(e=>e?t(e):n(Error(`image encoding failed`)),`image/png`)})}function Tf({steps:e,title:t,kind:n=`ghost`}){let{t:a,settings:s,toast:c}=v(),l=w(),[u,d]=(0,r.useState)(!1),[f,p]=(0,r.useState)(null),_=(0,r.useRef)(null),y=(0,r.useRef)(null),b=s.boardTheme===`dark`||s.boardTheme!==`light`&&l?`dark`:`light`,x=s.boardFont===`standard`?`standard`:`hand`,S=m(t);function C(n){if(d(!1),!(!e?.length||f)){if(n===`md`){h(`${S}.md`,Ue({title:t,steps:e}),`text/markdown`);return}p({id:Date.now(),format:n,done:0,total:0})}}function T(){y.current&&(y.current.cancelled=!0),y.current=null,p(null)}async function E(e,n){let r=_.current;if(!r)throw Error(`pages missing`);await sf(r),cf(r);let i=[...r.querySelectorAll(`[data-sheet]`)];p(e=>e&&{...e,total:i.length});let o=[];for(let[t,r]of i.entries()){if(n.cancelled)return;let i=await uf(lf(r,{scale:2})),a=pf(i,2);o.push(e===`pdf`?{width:i.width,height:i.height,image:await yf(a)}:await wf(a)),p(e=>e&&{...e,done:t+1})}if(!(n.cancelled||!o.length))if(e===`pdf`)g(`${S}.pdf`,new Blob([_f(o,{title:t,creator:`${a(`appName`)} · ${a(`appTagline`)}`})],{type:`application/pdf`}));else if(o.length===1)g(`${S}.png`,o[0]);else{let e=await Promise.all(o.map(async(e,t)=>({name:`${S}-${String(t+1).padStart(2,`0`)}.png`,data:new Uint8Array(await e.arrayBuffer())})));g(`${S}.zip`,new Blob([Cf(e)],{type:`application/zip`}))}}return(0,r.useEffect)(()=>{if(!f)return;let e={cancelled:!1};return y.current=e,E(f.format,e).catch(()=>{e.cancelled||c(a(`exportFailed`))}).finally(()=>{y.current===e&&(y.current=null,p(null))}),()=>{e.cancelled=!0}},[f?.id]),(0,i.jsxs)(`span`,{className:`aha-menuAnchor`,children:[f?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(Rl,{label:a(`exportingBoard`,{done:f.done,total:f.total||`…`})}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":n??void 0,"data-size":`sm`,onClick:T,children:a(`cancel`)})]}):(0,i.jsxs)(`button`,{type:`button`,className:`aha-btn`,"data-kind":n??void 0,"data-size":`sm`,disabled:!e?.length,"aria-haspopup":`menu`,"aria-expanded":u,onClick:()=>d(e=>!e),children:[a(`exportBoard`),` ▾`]}),u?(0,i.jsxs)(`div`,{className:`aha-card aha-menu`,role:`menu`,onMouseLeave:()=>d(!1),children:[(0,i.jsx)(`button`,{type:`button`,role:`menuitem`,className:`aha-btn`,"data-kind":`ghost`,onClick:()=>C(`pdf`),children:a(`exportPdf`)}),(0,i.jsx)(`button`,{type:`button`,role:`menuitem`,className:`aha-btn`,"data-kind":`ghost`,onClick:()=>C(`png`),children:a(`exportPng`)}),(0,i.jsx)(`button`,{type:`button`,role:`menuitem`,className:`aha-btn`,"data-kind":`ghost`,onClick:()=>C(`md`),children:a(`exportMarkdown`)})]}):null,f?(0,o.createPortal)((0,i.jsx)(`div`,{ref:_,className:`aha-exportPages`,"aria-hidden":`true`,children:(0,i.jsx)(Ol,{steps:e,title:t,theme:b,font:x,footer:{left:t,right:`${a(`appName`)} · ${a(`appTagline`)}`},animationLabel:a(`animationStill`),fixedLabel:a(`fixed`)})}),document.body):null]})}let Ef=Object.freeze([Object.freeze({family:`Aha Hand Latin`,file:`caveat-latin-d0b7b931.woff2`,bytes:48836,unicodeRange:`U+0,U+D,U+20-7E,U+A0-FF,U+131,U+152-153,U+20AC,U+2122`}),Object.freeze({family:`Aha Hand`,file:`wenkai-gb-0-88f1a875.woff2`,bytes:93632,unicodeRange:`U+20-7E,U+A0-AC,U+AE-FF,U+101,U+113,U+11B,U+12B,U+14D,U+16B,U+1CE,U+1D0,U+1D2,U+1D4,U+1D6,U+1D8,U+1DA,U+1DC,U+2C7,U+2C9,U+391-3A1,U+3A3-3A9,U+3B1-3C1,U+3C3-3C9,U+401,U+410-44F,U+451,U+2010-2016,U+2018-2022,U+2025-2027,U+2030-2037,U+2039-203F,U+2042,U+2044,U+2047-2049,U+2051-2052,U+205A,U+205D,U+2100-2101,U+2103,U+2105-2106,U+2109-210A,U+210E-210F,U+2113,U+2116-2117,U+211E,U+2120-2122,U+2126-2127,U+2129-212B,U+212E,U+2132,U+2135,U+213B,U+2141-2144,U+214B,U+214D-214E,U+2150-218B,U+2190-2199,U+21B6-21B9,U+21C4-21C6,U+21CB-21D0,U+21D2,U+21D4,U+21E6-21EA,U+21F5,U+2200-220D,U+220F,U+2211-2213,U+2215-2216,U+2219-2220,U+2223-2230,U+2234-2237,U+223C-223E,U+2242-2243,U+2245,U+2248,U+224B-224C,U+2251-2253,U+225C,U+2260-2262,U+2264-226B,U+226E-226F,U+2272-2273,U+2276-2277,U+2282-228B,U+2295-2299,U+229C-229E,U+22A0,U+22A2-22A5,U+22BF-22C5,U+22DA-22DB,U+22EE-22F1,U+2312,U+2460-249F,U+2500-25AB,U+25B1-25B3,U+25B6-25B7,U+25BC-25BD,U+25C0-25C1,U+25C6-25C7,U+25C9-25CC,U+25CE-25D3,U+25E2-25E6,U+25EF,U+25FB-25FC,U+2605-2606,U+2640,U+2642,U+3000-302D,U+3030,U+3033-303F,U+3041-3093,U+30A1-30F6,U+30FB,U+3105-3129,U+3220-3229,U+FF01-FF5E,U+FFE0-FFE1,U+FFE3,U+FFE5`}),Object.freeze({family:`Aha Hand`,file:`wenkai-gb-1-78a38e72.woff2`,bytes:315108,unicodeRange:`U+4E01,U+4E0D,U+4E11,U+4E19,U+4E1B-4E1C,U+4E22,U+4E2A,U+4E30,U+4E32,U+4E39,U+4E4E-4E4F,U+4E56,U+4E58,U+4E8C,U+4E92,U+4EA4-4EA5,U+4EA7-4EA8,U+4EC7,U+4ECE,U+4ED3,U+4ED8,U+4EE3,U+4EF6-4EF7,U+4EFD,U+4EFF,U+4F0E-4F10,U+4F19-4F1A,U+4F20,U+4F2F-4F30,U+4F34,U+4F43,U+4F46,U+4F4E,U+4F55,U+4F5B,U+4F70,U+4F73,U+4F88,U+4F97,U+4F9B,U+4FA7,U+4FAF,U+4FBF,U+4FC3-4FC4,U+4FD8,U+4FDD,U+4FED,U+4FEF,U+4FFA,U+500D,U+5012,U+5019,U+5021,U+5047,U+5065,U+507F,U+5085,U+508D,U+50A3,U+50A8,U+50AC,U+50B2,U+50F5,U+513F,U+5145,U+5149,U+5151,U+515A,U+515C,U+516B-516C,U+5171,U+5173,U+5175,U+5178,U+517C,U+5180,U+5188,U+518C,U+51A0,U+51AC,U+51AF-51B0,U+51B2,U+51BB,U+51CB,U+51CF,U+51D1,U+51E0-51E1,U+51E4,U+51F0,U+51F3,U+51F9-51FB,U+51FD,U+5200-5201,U+5206,U+5212,U+521A-521B,U+521D,U+522B,U+522E,U+5230,U+523A,U+523D,U+5241-5242,U+5250-5251,U+5265,U+526A,U+526F,U+5272,U+529E-52A0,U+52A8,U+52C3,U+52FE,U+5305-5306,U+5316-5317,U+5319,U+5320,U+532A,U+5349-534A,U+534E,U+5351,U+5355,U+535A,U+535C,U+535E,U+5373,U+5382,U+5384,U+5395,U+539A,U+53A8,U+53C2,U+53C9-53CA,U+53CD,U+53D1,U+53D8,U+53E0,U+53E4,U+53ED-53EE,U+53F7,U+53FC,U+5403-5404,U+5408-540A,U+540E,U+5420,U+5426-5429,U+542B,U+5435,U+5439,U+543C,U+5446,U+5448,U+544A,U+5475,U+547C,U+548C,U+5490,U+5495,U+54C0,U+54C4,U+54C6,U+54C8,U+54CE,U+54D7,U+54E5,U+54FA,U+54FC,U+5507,U+5509,U+5524,U+552C,U+5531,U+554A,U+5561,U+5589-558A,U+5598,U+559D,U+5609,U+560E,U+5632,U+563F,U+5676,U+568E,U+56DE,U+56E4,U+56F1,U+56FA,U+56FD,U+572D,U+5730,U+573A,U+573E,U+574A,U+574F,U+575A,U+575D,U+575F,U+5782,U+579B,U+57A2,U+57AB,U+57C2-57C3,U+57CE,U+57E0,U+57FA,U+5806,U+5815,U+5821,U+5824,U+5835,U+58A9,U+58C1,U+58D5,U+58F6,U+5904,U+5907,U+590D,U+591A,U+591F,U+5927,U+592B,U+592F,U+5939-593A,U+5949,U+594B,U+5954,U+5956,U+5960,U+5965,U+5978,U+597D,U+5987,U+5992-5993,U+59A8,U+59D1,U+59DC,U+59EC,U+5A25,U+5A5A,U+5AC1,U+5AC9,U+5AE1,U+5B58,U+5B63-5B64,U+5B69,U+5B75,U+5B89,U+5B8F,U+5B98,U+5B9A,U+5B9D,U+5BA0,U+5BA6,U+5BAB,U+5BB3,U+5BB6,U+5BBE,U+5BC2,U+5BC4,U+5BCC,U+5BD2,U+5BDF,U+5BE1,U+5BF8-5BF9,U+5BFC,U+5C01,U+5C06,U+5C14,U+5C16,U+5C18,U+5C1D,U+5C3A,U+5C42,U+5C94,U+5C97,U+5C9B,U+5CB8,U+5CE8,U+5CF0,U+5D07,U+5D14,U+5D29,U+5DDD,U+5DE2,U+5DE5,U+5DE9,U+5DEE,U+5DF1,U+5DF4,U+5E01,U+5E03,U+5E06,U+5E1B,U+5E1D,U+5E26,U+5E2E,U+5E38,U+5E45,U+5E4C,U+5E62,U+5E72,U+5E76,U+5E7B,U+5E7F,U+5E87,U+5E8A,U+5E95,U+5E97,U+5E9A,U+5E9C,U+5E9F,U+5EA6,U+5EFA,U+5F0A,U+5F13,U+5F17-5F18,U+5F1B,U+5F1F,U+5F27,U+5F39,U+5F52-5F53,U+5F69-5F6A,U+5F6C,U+5F7B-5F7C,U+5F85,U+5F88,U+5F8A,U+5F97,U+5FB7,U+5FBD,U+5FC5,U+5FCC,U+5FF1,U+5FFD,U+5FFF-6000,U+6016,U+6020,U+6025,U+602A,U+604D,U+6052,U+6062,U+6068-6069,U+606B,U+606D,U+6076,U+608D,U+6094,U+60A3,U+60B2,U+60B8,U+60BC,U+60D1,U+60E0,U+60E6,U+60E8-60E9,U+60EB,U+60ED-60F0,U+60F6,U+6101,U+611F,U+6124,U+6148,U+614C,U+6167,U+618B,U+61A8,U+61BE,U+61C2,U+61CA,U+6208,U+6210,U+6216,U+6233-6234,U+6237,U+623F,U+6241,U+624D,U+6252-6253,U+626E-626F,U+6273,U+6276,U+627C,U+627F-6280,U+6284,U+628A,U+6296,U+629A,U+62A4-62A5,U+62B1,U+62B5,U+62BD,U+62C2,U+62C5-62C6,U+62CC,U+62D0,U+62D4,U+62DC,U+62E3,U+62E8,U+62F1,U+6301-6302,U+6309,U+6321,U+6324-6325,U+6328,U+632B,U+634C-634D,U+6355,U+6361-6363,U+6376,U+6382,U+6387,U+6389,U+63A3,U+63AA,U+63B8,U+63BA,U+63D2,U+63E3,U+6400-6401,U+640F-6410,U+6413,U+641E,U+642C-642D,U+643D,U+6446,U+6448,U+6467,U+6491,U+64A4,U+64AD-64AE,U+64BC,U+64CD,U+64E6,U+6539,U+653B,U+653E,U+6545,U+654C,U+6556,U+655D-655E,U+6562,U+6566,U+6577,U+658C,U+6591,U+6597,U+65A5,U+65A7,U+65AD,U+65B9,U+65E2,U+65E6,U+65F1,U+6602,U+660C,U+660F,U+6625,U+6643,U+6666,U+6668,U+6697,U+66B4,U+66F4,U+66F9,U+670D,U+671D,U+672C,U+6735,U+673A,U+6746,U+6750-6751,U+675C,U+6760,U+676D,U+676F,U+677F,U+6781,U+6784,U+679C,U+67AB,U+67B6-67B7,U+67C4,U+67CF,U+67D1,U+67DC,U+67E5,U+67EC,U+67F4,U+6807,U+680B,U+6838-6839,U+683C,U+6842,U+6848,U+6853,U+6863,U+6868,U+6886,U+6897,U+68C0,U+68CD,U+68D2,U+68D8,U+68FA,U+6912,U+693D,U+693F,U+695A,U+6982,U+699C,U+69D0,U+69DB,U+69FD,U+6A0A,U+6A2A,U+6A59,U+6A71,U+6B21-6B22,U+6B4C,U+6B64-6B65,U+6B79,U+6B7C,U+6B86,U+6B8B,U+6BB5,U+6BBF,U+6BC1,U+6BD2,U+6BD4-6BD6,U+6BD9,U+6BEB,U+6C1B,U+6C1F,U+6C26,U+6C28,U+6C2E,U+6C47,U+6C49,U+6C57,U+6C5E-6C60,U+6C72,U+6C7E,U+6C89,U+6C9F,U+6CA7,U+6CAA,U+6CB3,U+6CB8,U+6CBD,U+6CCA,U+6CD5,U+6CDB,U+6CE2,U+6CF5,U+6D1E,U+6D2A,U+6D31,U+6D3B,U+6D46-6D47,U+6D4B,U+6D4E,U+6D51,U+6D69,U+6D6E,U+6D77,U+6DA3-6DA4,U+6DA7,U+6DAA,U+6DB5,U+6DB8,U+6DC0,U+6DE1,U+6DEC,U+6DEE,U+6DF3,U+6DF7,U+6E10,U+6E21,U+6E24,U+6E2F,U+6E56,U+6E85,U+6E89,U+6EC1,U+6EC7,U+6ED1,U+6EDA,U+6EE8,U+6EF4,U+6F6E,U+6F84,U+6F88,U+6FB3,U+6FC0,U+6FD2,U+704C,U+706B,U+706F-7070,U+707F,U+708A,U+7092,U+70B3,U+70B9,U+70BD,U+70D8,U+70E6,U+70E9,U+70FD,U+710A,U+7115,U+7119-711A,U+7126,U+714C,U+714E,U+71AC,U+7206,U+7231,U+7236,U+7238-7239,U+7248,U+728A,U+72AF,U+72C4,U+72C8,U+72D0,U+72D7,U+72E0,U+72EC,U+7316,U+731C,U+7334,U+733E,U+73AF,U+73BB,U+73D0,U+73ED,U+745A,U+7470,U+74DC,U+74E3,U+74F7,U+7518,U+752B,U+752D,U+7532,U+7535,U+7538,U+753B,U+7545,U+756A,U+7574,U+7578,U+7586,U+7599,U+75A4,U+75AE-75AF,U+75B5,U+75BE,U+75C5,U+75D5,U+75D8,U+75EA,U+75F4,U+75F9,U+7601,U+7629-762A,U+764C,U+7678,U+767B,U+767D-767E,U+7684,U+7687,U+768B,U+7691,U+76CE,U+76D1-76D2,U+76D6-76D7,U+76EF,U+76FE,U+7763,U+776C,U+7779,U+7785,U+77AA,U+77D7,U+77ED-77EE,U+77FE,U+7840,U+7845,U+7877,U+7889,U+788D,U+7891,U+7898,U+789F,U+78A7,U+78B1,U+78B4,U+78C1,U+78C5,U+78CB,U+78FA,U+7901,U+796D,U+7977-7978,U+798F,U+79BE,U+79C6,U+79C9,U+79E4,U+79EF-79F0,U+79FD,U+7A0B,U+7A17,U+7A20,U+7A3B-7A3D,U+7A3F,U+7A7F,U+7A97,U+7A9C,U+7AEF,U+7AFF,U+7B06,U+7B14,U+7B1B,U+7B26,U+7B28,U+7B2C,U+7B3A,U+7B49,U+7B4F,U+7B54,U+7B56,U+7B79,U+7B80,U+7B8D,U+7B94-7B95,U+7BA1,U+7BAD,U+7BD9,U+7BE1,U+7C07,U+7C27,U+7C3F,U+7C4D,U+7C89,U+7C97,U+7CAA,U+7CB9,U+7CCA,U+7CD5,U+7CD9,U+7E41,U+7EA2,U+7EA7,U+7EAA,U+7EAF,U+7EB2,U+7EB7,U+7EBA,U+7ECA,U+7ED1,U+7ED8-7ED9,U+7EE7,U+7EE9,U+7EF0,U+7EF7-7EF8,U+7F04,U+7F09,U+7F0E,U+7F13-7F14,U+7F16,U+7F1A,U+7F1D,U+7F20,U+7F38,U+7F50,U+7F55,U+7F5A,U+7F62,U+7F94,U+7FB9,U+7FC5,U+7FDF-7FE0,U+7FF0-7FF1,U+7FFB,U+800C,U+8015,U+8017,U+8019,U+8033,U+803B,U+803D,U+803F,U+806A,U+808C,U+809A-809B,U+809D,U+80A0-80A1,U+80A4-80A5,U+80A9-80AA,U+80AE,U+80BA,U+80C6,U+80CC,U+80DE,U+80E1,U+80F3,U+80F6,U+80FA,U+8106,U+810A,U+8116,U+812F,U+8150-8151,U+8179,U+8180,U+818A,U+818F,U+8198,U+81C2,U+81E3,U+81ED,U+822A,U+822C,U+8230-8231,U+8235-8236,U+8239,U+8270,U+827E,U+82AC-82AD,U+82B1,U+82B3,U+82CD,U+82DE-82DF,U+82EF,U+8303,U+8327-8328,U+832C,U+8336,U+8349,U+8350,U+8352,U+835A,U+8361,U+8364,U+8377,U+83B7,U+83C7,U+83CF,U+83DC,U+83E0,U+83F2,U+845B,U+8463,U+846B,U+8471,U+8482,U+848B,U+84D6,U+84DF,U+8521,U+853C-853D,U+8549,U+8584,U+85CF,U+85E9,U+864E,U+866B,U+8679,U+868C,U+8695,U+86CA-86CB,U+86D4,U+86E4,U+86FE,U+8702,U+8749,U+8757,U+8774,U+8776,U+8822,U+8861,U+8865,U+8868,U+886C,U+8884,U+888B,U+88AB,U+88B1,U+88C1,U+88F9,U+8902,U+8910,U+8912,U+8986,U+89C1-89C2,U+89C4,U+89E6,U+8BA1-8BA3,U+8BA5,U+8BB0,U+8BB2-8BB3,U+8BB9,U+8BBD,U+8BBF,U+8BCD,U+8BDA,U+8BDD-8BDE,U+8BE1,U+8BE5,U+8BE7,U+8BF2,U+8BFB,U+8BFD,U+8C03,U+8C0D-8C0E,U+8C17,U+8C24,U+8C37,U+8C41,U+8C46,U+8C62,U+8C6A,U+8C79-8C7A,U+8C89,U+8D1D,U+8D1F,U+8D21-8D22,U+8D25,U+8D27,U+8D29,U+8D2C-8D2D,U+8D2F-8D31,U+8D35,U+8D37,U+8D39-8D3A,U+8D3E-8D3F,U+8D4B-8D4C,U+8D50,U+8D63-8D64,U+8D6B,U+8D74,U+8D76,U+8D81,U+8D85,U+8DCB-8DCC,U+8DDF,U+8DEA,U+8DF5,U+8DFA,U+8E0C,U+8E29,U+8E48,U+8E66,U+8E6C-8E6D,U+8E72,U+8E7F,U+8E87,U+8EAC,U+8EB2,U+8F66,U+8F68,U+8F70,U+8F85,U+8F88-8F8A,U+8F90-8F91,U+8F9C,U+8F9E-8F9F,U+8FA8-8FA9,U+8FAB,U+8FB0,U+8FB9,U+8FBE,U+8FC7,U+8FD4,U+8FD8,U+8FDF,U+8FEA,U+8FED,U+8FF8-8FF9,U+9012,U+9017,U+901B,U+901E,U+9022,U+902E,U+903C,U+9041,U+904D,U+904F,U+9053,U+907F,U+9093,U+90A6,U+90AF,U+90CA,U+90DD,U+90E8,U+90ED,U+90F4,U+90F8,U+90FD,U+9102,U+9119,U+915A,U+9163,U+916C,U+9171,U+9187,U+918B,U+91C7,U+91DC,U+9274,U+9489,U+9492-9493,U+9499,U+949D-949E,U+94A1-94A2,U+94A9,U+94B5,U+94BE,U+94C2,U+94EC,U+94F2,U+9504-9505,U+950B,U+9519,U+9524,U+952D-952E,U+953B,U+9540,U+9550-9551,U+957F,U+95ED,U+95EF,U+95F4,U+95FA,U+9600-9602,U+9610,U+961C,U+961F,U+9632,U+963F,U+9644-9645,U+9648,U+964D,U+965B,U+9661,U+9664,U+9694,U+9698,U+96C6-96C7,U+96CC,U+96CF,U+96D5,U+96F9,U+970D,U+9738,U+975B,U+975E,U+9769,U+9776,U+978D,U+97AD,U+97E9,U+9876,U+987E-987F,U+9881,U+988A,U+989D,U+98A0,U+98A4,U+98CE,U+98DE,U+9910,U+9965,U+996D,U+996F,U+9971,U+9975,U+997C,U+997F,U+9986,U+998B,U+9A70,U+9A73,U+9A7E,U+9A84,U+9A87,U+9A8B,U+9AA8,U+9AB8,U+9AD8,U+9B3C,U+9B42,U+9C8D,U+9CD6,U+9E21,U+9E3D,U+9E3F,U+9E45,U+9E64,U+9EC4,U+9ED1,U+9F0E,U+9F13,U+9F3B,U+9F7F,U+9F9A,U+9F9F`}),Object.freeze({family:`Aha Hand`,file:`wenkai-gb-2-2a649892.woff2`,bytes:317648,unicodeRange:`U+4E03,U+4E09-4E0A,U+4E14,U+4E16,U+4E18,U+4E24,U+4E27,U+4E34,U+4E3D-4E3E,U+4E43,U+4E45,U+4E48,U+4E50,U+4E52-4E54,U+4E5D-4E5E,U+4E70-4E71,U+4E73,U+4E7E,U+4E86,U+4E8B,U+4E8F,U+4E95,U+4EA2,U+4EA9,U+4EAC,U+4EAE,U+4EB2,U+4EBA,U+4EC0-4EC1,U+4EC5-4EC6,U+4ECA-4ECB,U+4ECD,U+4ED1,U+4ED5,U+4EDF,U+4EE4,U+4EEC,U+4EFB,U+4F01,U+4F1E,U+4F24,U+4F26,U+4F36,U+4F38,U+4F60,U+4F69,U+4F6C,U+4F7F,U+4F8B,U+4F8D,U+4FA3,U+4FA5,U+4FA8-4FA9,U+4FB5,U+4FCA,U+4FCF-4FD0,U+4FE9,U+4FF1,U+5014,U+501F,U+5026,U+502A,U+503E,U+504F,U+5076,U+5080,U+5088,U+50BB,U+50DA,U+50E7,U+50FB,U+5112,U+5121,U+514B,U+514D,U+5162,U+5165,U+5168,U+516D,U+5170,U+5176-5177,U+5185,U+5189,U+5192,U+5195,U+5197,U+519B-519C,U+51B3,U+51B5,U+51B7,U+51C0,U+51C4,U+51C9,U+51CC,U+51DB,U+51DD,U+51ED,U+51EF,U+5203,U+5207,U+520A,U+5217-5218,U+5220,U+5224,U+5228-5229,U+5238-5239,U+523B,U+524D,U+5256,U+5267,U+5269,U+527F,U+5288,U+529B,U+529D,U+52A3,U+52AA-52AB,U+52B1-52B3,U+52BF,U+52C9,U+52D2,U+52D8,U+52DF,U+52E4,U+52FA,U+5321,U+5339-533A,U+533F,U+5341,U+5343,U+5347,U+5356-5357,U+5361-5362,U+5364,U+536F,U+5374-5375,U+5377,U+537F,U+5386,U+5389,U+5398,U+53A9,U+53BB,U+53C1,U+53D6-53D7,U+53DB,U+53E3,U+53E5-53E6,U+53EB,U+53EF,U+53F2,U+540D,U+540F,U+5415,U+5417,U+541B,U+541D,U+542D,U+542F,U+5450,U+5455,U+545B,U+5462,U+5478,U+547B,U+547D,U+5480,U+5486,U+548E,U+5496,U+5499,U+54AF,U+54B3,U+54C1,U+54E6,U+54E8-54EA,U+54ED,U+552E,U+5543,U+5546,U+5564-5566,U+556A,U+556E,U+5580,U+5584,U+5587,U+55B7,U+55D3,U+55DC,U+561B,U+5668,U+566C,U+56B7,U+56BC,U+56CA,U+56DA,U+56F0,U+5703,U+5708,U+5723,U+5747,U+574E,U+5751,U+5757,U+5761,U+5764,U+576A,U+576F,U+5777,U+5783-5784,U+5792,U+57A6,U+57AE,U+57CB,U+57D4,U+57F9,U+5811,U+582A,U+585E,U+5883,U+5892-5893,U+5899,U+58A8,U+58E4,U+58EB-58EC,U+58F0,U+58F3,U+5931,U+5938,U+5947-5948,U+594E,U+5951,U+5962,U+5973-5974,U+5976,U+5982,U+5988,U+598A,U+5999,U+59AE,U+59B9,U+59BB,U+59C6,U+59CB,U+59D0,U+59E5,U+5A04,U+5A07,U+5A18,U+5A1C,U+5A1F-5A20,U+5A29,U+5A36,U+5A46,U+5A6A,U+5A76,U+5A92,U+5A9A,U+5AC2,U+5AE9,U+5B54,U+5B5F,U+5B6A,U+5B7A,U+5B7D,U+5B81,U+5B88,U+5B9E,U+5BA1-5BA2,U+5BA4,U+5BB9,U+5BBD,U+5BC6-5BC7,U+5BD0,U+5BDD-5BDE,U+5BE5,U+5BFF,U+5C04,U+5C11,U+5C1A,U+5C31,U+5C38,U+5C3C-5C3D,U+5C3F-5C41,U+5C45,U+5C48,U+5C4A,U+5C4E-5C4F,U+5C61,U+5C65,U+5C71,U+5C82,U+5CAD,U+5CBF,U+5CE6,U+5CED,U+5CFB,U+5D0E,U+5D4C,U+5DE7-5DE8,U+5DFE,U+5E02,U+5E08,U+5E15,U+5E18,U+5E3D,U+5E42,U+5E55,U+5E73-5E74,U+5E86,U+5E90,U+5E93,U+5E99,U+5E9E,U+5EB7,U+5EC9-5ECA,U+5ED3,U+5ED6,U+5F00,U+5F03-5F04,U+5F0F,U+5F25,U+5F31,U+5F3A,U+5F55,U+5F6D,U+5F84,U+5F8B,U+5F98,U+5FCD,U+5FD9,U+5FEB,U+5FF5,U+6012,U+6015,U+601C,U+602F,U+6043,U+604B,U+6050,U+6070,U+6073,U+607C,U+6084,U+60A8,U+60AF,U+60C5,U+60CA,U+60E7,U+60F9,U+6127,U+614E,U+6151,U+6155,U+6162,U+6168,U+6177,U+61D2,U+61E6,U+620E,U+6212,U+621A,U+622A,U+622E,U+6247,U+624B,U+6251,U+6254,U+625B,U+6263,U+6266,U+6269,U+626B,U+626D,U+6270,U+6279,U+6289,U+6297,U+629B,U+62A0-62A2,U+62A8,U+62AB,U+62B9,U+62BF,U+62C7-62C9,U+62CD-62CE,U+62D2,U+62D8,U+62DF,U+62E2,U+62E6-62E7,U+62EC-62ED,U+62F3,U+62F7,U+62FC,U+62FE-62FF,U+630E,U+631B,U+6320,U+632A,U+6346,U+634E-6350,U+635E,U+6367,U+636E,U+6377,U+637B,U+6388,U+6390,U+6392,U+6398,U+63A0,U+63A5,U+63A7,U+63B3,U+63C9,U+63CF,U+63E9-63EA,U+63ED,U+63FD,U+6402,U+6405,U+6414,U+6444,U+6469,U+6478-6479,U+6482,U+6485,U+6487,U+6492,U+64A9,U+64AC,U+64B5,U+64C2,U+64C5,U+64CE,U+64D2,U+6500,U+6518,U+652B,U+6536,U+654F,U+6551,U+6559,U+655B,U+6563,U+656C,U+6572,U+6599,U+65A4,U+65BD,U+65C1,U+65C5,U+65D7,U+65E5,U+65E7,U+65F6-65F7,U+6606,U+660E,U+6627,U+662F,U+664B-664C,U+6652,U+666E-666F,U+6674,U+6676,U+667E,U+6696,U+66AE,U+66DD,U+66F2,U+66FC,U+670B,U+6717,U+671F,U+6728,U+672B,U+6734,U+6740,U+6743,U+6749,U+674E,U+6765,U+6770,U+6797,U+679A,U+67AA,U+67AF,U+67D0,U+67D2-67D4,U+67E0,U+67EF,U+67F3,U+67FF,U+680F,U+6816-6817,U+6846,U+6851,U+6854,U+6865,U+6881,U+6885,U+68A2,U+68A6,U+68A8,U+68C9,U+68CB,U+68DA,U+68EE,U+68F1,U+68F5,U+695E,U+6977,U+697C,U+6994,U+69B4,U+69B7,U+6A21,U+6A47,U+6AAC,U+6B20,U+6B27,U+6B3A,U+6B3E,U+6B49,U+6B67,U+6BB4,U+6BCD,U+6BCF,U+6BD7,U+6BDB,U+6C0F,U+6C11,U+6C13-6C14,U+6C16,U+6C22,U+6C2F-6C30,U+6C42,U+6C55,U+6C5D,U+6C7D,U+6C81,U+6C88,U+6C8F,U+6C99,U+6C9B,U+6CA1,U+6CA4-6CA6,U+6CAB,U+6CAE,U+6CC5,U+6CC9,U+6CCC,U+6CDE,U+6CE1,U+6CE3,U+6CE5,U+6CEA,U+6CFC,U+6D01,U+6D12,U+6D1B,U+6D25,U+6D3D-6D3E,U+6D41,U+6D45,U+6D53,U+6D5A,U+6D66,U+6D6A,U+6D78,U+6D85,U+6D89,U+6D9D,U+6D9F,U+6DA6,U+6DA9,U+6DCB,U+6DD6,U+6DF1,U+6E05,U+6E17,U+6E20,U+6E34,U+6E3A,U+6E43,U+6E7F,U+6E83,U+6E9C,U+6EB6,U+6EBA,U+6EE1,U+6EE4-6EE6,U+6F02,U+6F06,U+6F0F,U+6F13,U+6F20,U+6F2B,U+6F58,U+6F5C,U+6F5E,U+6F66,U+6F8E,U+6F9C,U+7011,U+706D,U+7075,U+7078,U+7089,U+7094-7095,U+70AC,U+70AE-70AF,U+70BC,U+70C2,U+70C8,U+70D9,U+70E4,U+70E7,U+70EC-70ED,U+70F9,U+7136,U+715E,U+7164,U+717D,U+7194,U+71C3,U+71CE,U+722C,U+7235,U+7247,U+724C,U+725B,U+725F,U+7261-7262,U+7267,U+7272,U+7275,U+7281,U+72AC,U+72C2,U+72D9,U+72DE,U+72E1,U+72EE,U+72F8,U+72FC,U+730E,U+731B,U+732B,U+7387,U+7396,U+739B,U+73AB,U+73B2,U+73CA,U+7403,U+7405-7406,U+7409,U+7433-7436,U+743C,U+745E-745F,U+7483,U+74E2,U+74E4,U+74F6,U+751A,U+751F,U+7525,U+7533,U+7537,U+754C,U+7554,U+7559,U+7565-7566,U+7597,U+759A,U+759F,U+75A5,U+75B2,U+75BD,U+75C9-75CA,U+75DE,U+75E2,U+7624,U+7638,U+7686,U+76AE,U+76BF,U+76C6,U+76D4,U+76D8,U+76DB,U+76DF,U+76EE,U+76F2,U+76FC,U+7701,U+7709,U+770B,U+7720,U+772F,U+7736-7737,U+775B,U+7766,U+776B,U+7784,U+7792,U+77A5,U+77A7,U+77DB,U+77E2,U+77E9,U+77EB,U+77F3,U+77FF,U+7801-7802,U+780C-780D,U+7812,U+7830,U+7834,U+7837,U+783E,U+786B,U+786E,U+787C,U+788C,U+78B0,U+78BE,U+78CA,U+78D0,U+78D5,U+78E8,U+78F7,U+793A,U+793C,U+793E,U+7941,U+7948,U+795E,U+7968,U+7981,U+7984,U+79BB,U+79BD,U+79CB,U+79D1-79D2,U+79D8,U+79E6,U+79F8,U+7A0D,U+7A46,U+7A76-7A77,U+7A7A,U+7A83,U+7A8D,U+7A96,U+7A98,U+7A9F,U+7AA5,U+7ABF,U+7ACB,U+7ADE-7ADF,U+7AE3,U+7AED,U+7B3C,U+7B4B,U+7B50,U+7B5B,U+7B77,U+7B7E,U+7BA9,U+7BC7,U+7BD3,U+7BEE,U+7BF1,U+7BF7,U+7C73,U+7C7B,U+7C92,U+7C95,U+7CAE,U+7CB1,U+7CB3,U+7CBE,U+7CDC,U+7CE0,U+7CEF,U+7D27,U+7D2F,U+7EA0,U+7EAB,U+7EB1,U+7EB3,U+7EB6,U+7EBD,U+7EC3,U+7EC5,U+7ECD,U+7ECF,U+7ED2-7ED3,U+7ED5,U+7EDC-7EDE,U+7EE2,U+7EF3,U+7EF5,U+7EFF,U+7F05-7F06,U+7F15,U+7F2E,U+7F34,U+7F3A,U+7F57,U+7F8C,U+7F8E,U+7F9A,U+7FA4,U+7FD8,U+8001,U+8003,U+8010,U+802A,U+8042,U+804A-804B,U+8054,U+8058,U+805A,U+8089,U+808B,U+80AF,U+80BE,U+80D6,U+80DA,U+80DC,U+80EF,U+80FD,U+8109,U+8110-8111,U+8113,U+811A,U+8138,U+813E,U+814A,U+8154,U+816E,U+817B,U+819C,U+81A8,U+81B3,U+81FC,U+8205,U+820C-820D,U+826F,U+8272,U+8282,U+828D,U+8292,U+82A5-82A6,U+82B9,U+82D7,U+82DB,U+82E5-82E6,U+82EB,U+82F9,U+8302,U+8304-8305,U+830E,U+832B,U+8338-8339,U+8346,U+8354,U+8363,U+8386,U+8389,U+838E,U+83AB,U+83B1-83B2,U+83BD,U+83CA,U+83CC,U+83E9,U+83F1,U+840C-840D,U+841D,U+8428,U+843D,U+8461,U+8475,U+8499,U+84B2,U+84C9,U+84DD,U+84EC,U+8511,U+8513,U+852B,U+8537,U+854A,U+857E,U+85C9,U+85D0,U+85D5,U+8611,U+864F-8651,U+8671,U+8680,U+8682,U+86C6-86C7,U+86EE,U+871C,U+8721,U+878D,U+879F,U+87BA,U+8815,U+8857,U+886B,U+888D,U+88C2,U+88D9,U+88E4,U+88F3-88F4,U+88F8,U+8925,U+895F,U+89C5-89C6,U+89C8-89C9,U+89D2,U+89E3,U+8A93,U+8B66,U+8B6C,U+8BA4,U+8BA9,U+8BAB,U+8BBA,U+8BBE,U+8BC0,U+8BC4,U+8BC6,U+8BD5,U+8BD7,U+8BEB,U+8BF7,U+8BFA,U+8BFE,U+8C05,U+8C0B,U+8C1C,U+8C26,U+8C28-8C29,U+8C2C,U+8C30-8C31,U+8C34,U+8C8C,U+8D2B,U+8D38,U+8D41-8D42,U+8D4A,U+8D4F,U+8D54,U+8D56,U+8D5B,U+8D61,U+8D66,U+8D77,U+8D8B,U+8DA3,U+8DB4,U+8DD1,U+8DDD,U+8DE8,U+8DEF,U+8E1E,U+8EAB,U+8EAF,U+8F6E-8F6F,U+8F7B,U+8F7F,U+8F83,U+8F86,U+8FA3,U+8FB1,U+8FBD,U+8FC1,U+8FC4,U+8FC8,U+8FD1,U+8FDB,U+8FDE,U+8FEB,U+8FF7,U+9002,U+9006,U+901D,U+903B,U+9063,U+90A3,U+90B1,U+90B5,U+90BB,U+90CE,U+90E1,U+914B,U+914D,U+9152,U+916A,U+9175-9177,U+917F,U+919A-919B,U+91CA,U+91CC,U+91CF,U+91D1,U+948E,U+94A0,U+94A6-94A7,U+94AE,U+94B1,U+94B3,U+94C3,U+94C5-94C6,U+94DD,U+94ED,U+94F0,U+94FA,U+94FE,U+9510,U+951A,U+9523,U+9526,U+952F-9530,U+9539,U+9541,U+954A,U+954D,U+955C,U+9563,U+956D,U+9570,U+95E8,U+95EA,U+95F0,U+95F7,U+95F9,U+95FD,U+9611,U+9614,U+962E,U+9636,U+9646-9647,U+964B-964C,U+9655,U+966A,U+9675,U+9686,U+96B6,U+96BE,U+96C0,U+96F6-96F7,U+9709,U+9713,U+9716,U+9732,U+9739,U+9752,U+9756,U+9759,U+9760-9762,U+9773,U+9798,U+97A0,U+97E7,U+97ED,U+97F6,U+9877,U+9885-9888,U+9891,U+9897,U+98A7,U+98D8,U+98DF,U+9970,U+9976,U+997A,U+9981,U+9988,U+998F,U+9992,U+9996,U+9A6C,U+9A71,U+9A74,U+9A76,U+9A79,U+9A82,U+9A86,U+9A8F,U+9A91,U+9A97,U+9A9A,U+9AA1,U+9B41,U+9B44,U+9B54,U+9C81,U+9CA4,U+9CB8,U+9CC3,U+9CDE,U+9E1F,U+9E23,U+9E25,U+9E43,U+9E4A,U+9E4F,U+9E7F,U+9E93,U+9EA6,U+9EBB,U+9ECE,U+9ED4,U+9ED8,U+9F50,U+9F84,U+9F8B,U+9F99`}),Object.freeze({family:`Aha Hand`,file:`wenkai-gb-3-6949c050.woff2`,bytes:311704,unicodeRange:`U+4E00,U+4E07-4E08,U+4E0B,U+4E0E,U+4E13,U+4E1A,U+4E1D,U+4E25,U+4E2B,U+4E2D,U+4E38,U+4E3A-4E3B,U+4E49,U+4E4B-4E4D,U+4E59,U+4E5F-4E61,U+4E66,U+4E88-4E89,U+4E8E,U+4E91,U+4E94,U+4E9A-4E9B,U+4EA1,U+4EA6,U+4EAB,U+4EAD,U+4EBF,U+4ED4,U+4ED6-4ED7,U+4ED9,U+4EE5,U+4EEA,U+4EF0,U+4EF2,U+4F0A,U+4F0D,U+4F11,U+4F17-4F18,U+4F1F,U+4F2A,U+4F3A,U+4F3C,U+4F4D,U+4F4F-4F51,U+4F53,U+4F59,U+4F5C,U+4F63,U+4F6F,U+4F84,U+4F9D,U+4FA0,U+4FA6,U+4FAE,U+4FD7,U+4FDE,U+4FE1,U+4FEE,U+5018,U+501A,U+503A,U+503C,U+505A,U+505C,U+5077,U+50CF,U+50F3,U+5141,U+5143-5144,U+5146,U+5148,U+5154,U+5174,U+5179,U+517B,U+517D,U+518D,U+5199,U+51A4,U+51B6,U+51C6,U+51F6,U+51F8,U+51FF,U+5211,U+5219,U+5236-5237,U+5243,U+524A,U+5254,U+52A1,U+52A9,U+52C7,U+52CB,U+52FF-5300,U+5308,U+531D,U+5323,U+533B,U+5348,U+534F,U+5352-5353,U+5360,U+5367,U+536B,U+5370-5371,U+5378,U+5385,U+538B-538C,U+539F,U+53A2,U+53A6,U+53BF,U+53C8,U+53CB-53CC,U+53D4,U+53D9,U+53EA,U+53EC,U+53F0,U+53F3,U+53F6,U+53F8-53F9,U+5401,U+540C,U+5410-5411,U+5413,U+541E-541F,U+542C,U+542E,U+5431,U+5434,U+5438,U+543B,U+543E,U+5440,U+5458,U+545C,U+5468,U+5473,U+548B,U+548F,U+5492,U+54A8,U+54AC,U+54B1,U+54B8,U+54BD,U+54C7,U+54C9,U+54CD,U+54D1,U+54DF,U+54EE,U+54F2,U+5501,U+5506,U+5510,U+552F,U+553E,U+5544,U+5578,U+557C,U+5582,U+559C,U+55A7,U+55B3,U+55BB,U+55C5,U+55E1,U+55E3,U+55FD,U+5618,U+5631,U+5634,U+5636,U+563B,U+564E,U+566A,U+568F,U+56A3,U+56DB,U+56E0,U+56E2,U+56ED,U+56F4,U+56FE,U+5706,U+571F,U+5728,U+5740,U+574D,U+5750,U+575B,U+575E,U+5760,U+5766,U+578B,U+57A3,U+57DF,U+5802,U+5830,U+584C,U+5851,U+5854,U+5858,U+586B,U+5885,U+589E-589F,U+58EE,U+58F9,U+590F,U+5915-5916,U+591C,U+5929-592A,U+592E,U+5934,U+5937,U+5944,U+594F,U+5957,U+5979,U+5984,U+5986,U+5996,U+59A5,U+59D3-59D4,U+59DA,U+59E8,U+59FB,U+59FF,U+5A01,U+5A03,U+5A31,U+5A49,U+5A74,U+5A7F,U+5AB3,U+5ACC,U+5B50,U+5B55,U+5B57,U+5B59,U+5B5C-5B5D,U+5B66,U+5B70,U+5B83,U+5B85,U+5B87,U+5B8B-5B8C,U+5B97,U+5B99,U+5B9B-5B9C,U+5BA3,U+5BAA,U+5BB0,U+5BB4-5BB5,U+5BBF,U+5BC5,U+5BD3,U+5BE8,U+5BFA-5BFB,U+5C09-5C0A,U+5C0F,U+5C24,U+5C27,U+5C39,U+5C3E,U+5C49,U+5C4B,U+5C51,U+5C55,U+5C5E,U+5C60,U+5C6F,U+5C79,U+5C7F,U+5C81,U+5CA9,U+5CB3,U+5CD9,U+5CE1,U+5CEA,U+5D16,U+5D2D,U+5DCD,U+5DDE,U+5DE1,U+5DE6,U+5DEB,U+5DF2-5DF3,U+5DF7,U+5E05,U+5E0C,U+5E10,U+5E16,U+5E1A,U+5E1C,U+5E27,U+5E2D,U+5E78,U+5E7C-5E7D,U+5E84,U+5E8F,U+5E94,U+5EA7,U+5EAD,U+5EB6,U+5EB8,U+5EF6-5EF7,U+5F02,U+5F15,U+5F20,U+5F26,U+5F2F,U+5F5D,U+5F62,U+5F64,U+5F66,U+5F70-5F71,U+5F79,U+5F80-5F81,U+5F90,U+5F92,U+5FA1,U+5FAA,U+5FAE,U+5FC3,U+5FC6,U+5FD7-5FD8,U+5FE0,U+5FE7,U+5FFB,U+6001-6002,U+600E,U+6014,U+601D,U+6027-6028,U+603B,U+6055,U+6064,U+606C,U+606F,U+607F,U+6089,U+609F-60A0,U+60A6,U+60AC,U+60CB,U+60D5,U+60DC,U+60DF,U+60F3,U+60FA,U+6108-6109,U+610F,U+611A,U+613F,U+6170,U+618E,U+61C8,U+620A,U+620C-620D,U+620F,U+6211,U+6218,U+6240,U+624E,U+6258,U+6267,U+626C,U+627E,U+6291-6293,U+6295,U+6298,U+62AC,U+62BC,U+62C4,U+62D3,U+62D6,U+62D9,U+62DB,U+62E5,U+62E9,U+62EF,U+62F4,U+62FD,U+6307,U+6311,U+6316,U+631A,U+631D-631F,U+6323,U+632F,U+633A,U+633D,U+6342,U+6345,U+6349,U+635F,U+6380,U+638C,U+638F,U+6396,U+63A2,U+63A8-63A9,U+63B7,U+63CD,U+63D0,U+63D6,U+63E1,U+63F4,U+641C,U+642A,U+643A,U+6447,U+644A,U+6454,U+6458,U+6495,U+649E,U+64B0,U+64DE,U+6512,U+652F,U+653F,U+6548,U+6570,U+6574,U+6587,U+658B,U+659C,U+659F,U+65A1,U+65A9,U+65AF-65B0,U+65CB,U+65CF,U+65E0,U+65E8-65E9,U+65EC-65ED,U+65FA,U+6613-6614,U+661F-6620,U+6628,U+662D,U+663C,U+663E,U+6653,U+6655,U+665A,U+6664,U+6670,U+667A,U+6682,U+6687,U+6691,U+66D9,U+66F0,U+66F3,U+66FE-6700,U+6708-6709,U+6714,U+671B,U+672A,U+672D,U+672F,U+6731,U+673D,U+6742,U+674F,U+6756,U+675F,U+6761,U+6768,U+677E,U+6789,U+6790,U+6795,U+679D,U+67A2-67A3,U+67DE,U+67F1,U+6805,U+6808,U+6811,U+6813,U+6821,U+682A,U+6837,U+683D,U+6843,U+6845,U+684C,U+6850,U+6869,U+6876,U+68A7,U+68AD,U+68AF-68B0,U+68B3,U+68D5,U+68E0,U+6905,U+690D-690E,U+692D,U+6930,U+6954,U+6986,U+69A8,U+6A1F,U+6A31,U+6A61,U+6A80,U+6A84,U+6B23,U+6B32,U+6B47,U+6B62-6B63,U+6B66,U+6B6A,U+6B7B,U+6B83,U+6B89-6B8A,U+6B96,U+6BB7,U+6BC5,U+6BCB,U+6BE1,U+6BEF,U+6C27,U+6C34,U+6C38,U+6C40-6C41,U+6C50,U+6C5B,U+6C61,U+6C64,U+6C6A,U+6C70,U+6C79,U+6C82-6C83,U+6CB9,U+6CBB-6CBC,U+6CBE-6CBF,U+6CC4,U+6CE8,U+6CF0,U+6CF3,U+6CFB,U+6CFD,U+6D0B,U+6D17,U+6D32,U+6D3C,U+6D4A,U+6D59,U+6D74,U+6D82,U+6D88,U+6D8C,U+6D8E,U+6D95,U+6D9B,U+6DA1,U+6DA8,U+6DAF,U+6DB2,U+6DC4,U+6DC6,U+6DCC,U+6DD1,U+6DD8,U+6DE4,U+6DEB,U+6DF9,U+6DFB,U+6E0A,U+6E0D,U+6E14,U+6E1D,U+6E23,U+6E29,U+6E2D,U+6E38,U+6E4D,U+6E58,U+6E5B,U+6E7E,U+6E90,U+6EA2,U+6EAA,U+6EAF,U+6ECB,U+6ED3-6ED4,U+6EDE,U+6EE9,U+6F14,U+6F31,U+6F33,U+6F3E,U+6F4D,U+6F6D,U+6FA1,U+7076,U+707C,U+707E,U+708E,U+7099,U+70AD,U+70B8,U+70C1,U+70C3,U+70DB,U+70DF,U+70EB,U+70EF,U+70F7,U+7109,U+7130,U+7167,U+716E,U+7184,U+718A,U+718F,U+7199,U+719F,U+71D5,U+71E5,U+722A,U+7237,U+723D,U+7259,U+7269,U+7279-727A,U+7280,U+72B6,U+72B9,U+72ED,U+72F0-72F1,U+7329-732A,U+732E,U+733F,U+736D,U+7384,U+7389,U+738B,U+73A9,U+73B0,U+73CD,U+73E0,U+7410,U+7422,U+7476,U+74E6,U+74EE,U+7504,U+751C,U+7528-7529,U+7530-7531,U+754F,U+755C,U+758F,U+7591,U+75A1,U+75AB,U+75B9,U+75BC,U+75C7-75C8,U+75D2,U+75D4,U+75DB,U+75F0,U+761F,U+7626,U+762B,U+7634,U+7663,U+7682,U+7696,U+76B1,U+76C2,U+76C5,U+76C8,U+76CA,U+76CF-76D0,U+76F4,U+76F8,U+771F,U+7728-7729,U+773A,U+773C,U+7740-7741,U+7761,U+778E,U+77A9,U+77AC,U+77B3,U+77BB,U+77E3,U+77E5,U+77FD,U+7814,U+7816,U+781A,U+7827,U+7838,U+7852,U+7855,U+785D,U+786C,U+788E,U+7897,U+78B3,U+7956,U+795D,U+795F,U+7965,U+79B9,U+79C0-79C1,U+79C3,U+79CD,U+79DF,U+79E7,U+79E9,U+79FB,U+7A00,U+7A0E,U+7A1A,U+7A33,U+7A57,U+7A74,U+7A81,U+7A84,U+7A91-7A92,U+7A9D,U+7AD6,U+7AD9,U+7AE0,U+7AE5,U+7AF9,U+7B0B,U+7B11,U+7B51-7B52,U+7B97,U+7BB1,U+7BC6,U+7C7D,U+7C98,U+7C9F,U+7CA4-7CA5,U+7CD6,U+7CDF,U+7CFB,U+7D0A,U+7D20,U+7D22,U+7D2B,U+7D6E,U+7E82,U+7EA4,U+7EA6,U+7EAC,U+7EB5,U+7EB8-7EB9,U+7EBF,U+7EC4,U+7EC6-7EC8,U+7ECE,U+7EDA,U+7EDF,U+7EE3,U+7EE5-7EE6,U+7EEA,U+7EED,U+7EF4,U+7EFC-7EFD,U+7F00,U+7F18,U+7F28-7F29,U+7F51,U+7F69-7F6A,U+7F6E,U+7F72,U+7F8A,U+7F9E,U+7FA1,U+7FBD,U+7FC1,U+7FCC,U+7FD4,U+7FFC,U+8000,U+8005,U+800D,U+8018,U+8036,U+8038,U+804C,U+8083-8084,U+8086-8087,U+8096,U+8098,U+80A2,U+80B2,U+80BF-80C1,U+80C3,U+80CE,U+80F0,U+80F8,U+8102,U+810F,U+8131,U+8146,U+814B,U+8155,U+8165,U+8170,U+817A,U+817E-817F,U+819B,U+819D,U+81C0,U+81C3,U+81C6,U+81EA,U+81F3-81F4,U+81FB,U+8200,U+8206,U+8212,U+8214,U+821C,U+821E-821F,U+8237,U+8247,U+8258,U+8273,U+827A,U+828B,U+829C-829D,U+82AF,U+82BD,U+82C7,U+82CF,U+82D1,U+82D4,U+82F1,U+8301,U+8335,U+8367,U+836B,U+836F,U+83B9,U+8404,U+840E,U+8424-8425,U+8427,U+8457,U+846C,U+849C,U+84B8,U+84C4,U+84D1,U+8517,U+851A,U+852C,U+8574,U+859B,U+85AA,U+85AF,U+85E4,U+85FB,U+8638,U+865A,U+865E,U+867D-867E,U+8681,U+868A,U+869C,U+86A4,U+86C0,U+86D9,U+86DB,U+86F0,U+86F9,U+8700,U+8712,U+8715,U+8717-8718,U+8747,U+874E,U+87F9,U+8840,U+8845,U+884C-884D,U+8854,U+8859,U+8863,U+8870,U+8877,U+8881,U+8892,U+8896,U+889C,U+88AD,U+88C5,U+88D4-88D5,U+892A,U+8944,U+897F,U+8981,U+8A00,U+8A79,U+8A89-8A8A,U+8BA8,U+8BAD-8BAF,U+8BB6,U+8BB8,U+8BBC,U+8BC1,U+8BC5,U+8BC8-8BCA,U+8BCC,U+8BD1,U+8BDB,U+8BE2-8BE3,U+8BE6,U+8BEC-8BED,U+8BEF,U+8BF1,U+8BF4-8BF5,U+8BF8,U+8C01,U+8C06,U+8C08,U+8C0A,U+8C10,U+8C13,U+8C1A,U+8C22-8C23,U+8C2D,U+8C4C,U+8C61,U+8C6B,U+8D1E,U+8D23-8D24,U+8D26,U+8D28,U+8D2A,U+8D2E,U+8D34,U+8D3C,U+8D43-8D44,U+8D4E,U+8D58,U+8D5A,U+8D5E,U+8D60,U+8D62,U+8D70,U+8D75,U+8D8A,U+8D9F,U+8DB3,U+8DBE,U+8DC3,U+8DF3,U+8E0A,U+8E0F,U+8E22,U+8E2A,U+8E44,U+8E4B,U+8E81,U+8EBA,U+8F67,U+8F69,U+8F6C,U+8F74,U+8F7D,U+8F93,U+8F95-8F97,U+8F99,U+8F9B,U+8FC2,U+8FC5,U+8FCE,U+8FD0,U+8FD9,U+8FDC-8FDD,U+8FE2,U+8FF0,U+8FFD,U+9000-9001,U+9003,U+9009-900A,U+900F-9010,U+9014,U+901A,U+901F-9020,U+9038,U+903E,U+9042,U+9047,U+9057,U+9065,U+906D-906E,U+9075,U+9080,U+9091,U+90A2,U+90AA,U+90AE,U+90B9,U+90C1,U+90D1,U+90E7,U+9149,U+914C,U+9157,U+915D-915E,U+9165,U+916E,U+9178,U+9189,U+9192,U+91C9,U+91CD-91CE,U+9488,U+949F,U+94A5,U+94A8,U+94BB,U+94C0-94C1,U+94DC,U+94E1,U+94E3,U+94F1,U+94F6,U+94F8,U+9500-9501,U+9508,U+950C,U+9511,U+9517,U+9521,U+9525,U+9528,U+9547,U+9576,U+95EE,U+95F2,U+95F8,U+95FB,U+9605,U+9609,U+960E,U+9633-9635,U+963B,U+9640,U+9650,U+9662,U+9668-9669,U+9676-9677,U+9685,U+968B,U+968F-9690,U+9699,U+969C,U+96A7,U+96C1,U+96C4-96C5,U+96CD,U+96E8,U+96EA,U+96FE,U+9700,U+9704,U+9707,U+971C,U+971E,U+9774,U+978B,U+97E6,U+97F3,U+97F5,U+9875,U+9879-987B,U+987D,U+9882,U+9884,U+9890,U+9893,U+9896,U+9898,U+989C,U+996E,U+9972,U+9985,U+9999,U+9A6D-9A6F,U+9A7B-9A7C,U+9A8C,U+9AA4,U+9AD3,U+9B03,U+9B4F,U+9C7C,U+9C9C,U+9E26,U+9E2D,U+9E2F,U+9E33,U+9E35,U+9E70,U+9ECD,U+9F20`}),Object.freeze({family:`Aha Hand`,file:`wenkai-gb-4-375dc3b3.woff2`,bytes:257596,unicodeRange:`U+4E0C,U+4E10,U+4E15,U+4E1E,U+4E28,U+4E36,U+4E3F,U+4E47,U+4E5C,U+4E69,U+4E8D,U+4E93,U+4E98,U+4E9F-4EA0,U+4EB3,U+4EB5,U+4EBB,U+4EC2-4EC4,U+4EC9,U+4EDD-4EDE,U+4EE1,U+4EE8,U+4EEB,U+4EF3,U+4EF5,U+4F09,U+4F1B,U+4F22,U+4F25,U+4F27,U+4F2B,U+4F32,U+4F3D,U+4F57-4F58,U+4F5A,U+4F5D-4F5F,U+4F64-4F65,U+4F67,U+4F74,U+4F76,U+4F7B-4F7C,U+4F7E,U+4F83,U+4F89,U+4F8F,U+4F91,U+4F94,U+4FAA,U+4FAC,U+4FC5,U+4FCE,U+4FD1,U+4FDA,U+4FDC,U+4FDF,U+4FE3,U+4FE6,U+4FE8,U+4FEA,U+4FF3,U+4FF8,U+4FFE,U+500C,U+500F,U+501C,U+5025,U+5028-5029,U+502C-502E,U+5043,U+5048,U+504C,U+504E,U+5055,U+506C,U+507B,U+507E,U+50A5,U+50A7,U+50A9,U+50BA,U+50D6,U+50E6,U+50EC-50EE,U+5106-5107,U+510B,U+5140,U+5155-5156,U+516E,U+5181-5182,U+5196,U+51A2,U+51A5,U+51AB,U+51B1,U+51BC-51BD,U+51C7,U+51EB,U+51F5,U+51FC,U+5202,U+5208,U+520D-520E,U+522D,U+5233,U+523F-5240,U+524C,U+525C,U+525E,U+5261,U+527D,U+5281-5282,U+5290,U+5293,U+52A2,U+52AC-52AD,U+52BE,U+52D0,U+52D6,U+52F0,U+52F9,U+530D,U+530F-5310,U+5315,U+531A,U+5326,U+532E,U+533E,U+5345,U+535F,U+5363,U+5366,U+5369,U+536E,U+537A,U+538D,U+539D,U+53A3,U+53A5,U+53AE,U+53B6,U+53DF,U+53E8-53E9,U+53F1,U+53F5,U+53FB,U+53FD,U+5406,U+5412,U+5416,U+5421,U+5423,U+5432,U+5443,U+544B,U+5452-5454,U+5456-5457,U+5459,U+5464,U+5466,U+5471-5472,U+5476-5477,U+5482,U+5484,U+5494,U+549A-549B,U+549D,U+54A3-54A4,U+54A6-54A7,U+54A9-54AA,U+54AD,U+54B4,U+54BB,U+54BF,U+54C2,U+54CC,U+54CF-54D0,U+54D2-54D5,U+54D9-54DA,U+54DC-54DE,U+54E7,U+54F3,U+54FD,U+54FF,U+550F,U+5511,U+5514,U+551B,U+5520,U+5522-5523,U+5527,U+552A,U+5530,U+5533,U+5537,U+553C,U+553F,U+5541,U+5549,U+5550,U+5555-5556,U+555C,U+5567,U+556C-556D,U+5575-5577,U+557B,U+557E,U+5581,U+5583,U+5588,U+558B,U+558F,U+5591,U+5594,U+5599,U+559F,U+55B1,U+55B5,U+55B9,U+55BD-55BE,U+55C4,U+55C9,U+55CC-55CD,U+55D1-55D2,U+55D4,U+55D6,U+55DD,U+55DF,U+55E4-55E6,U+55E8,U+55EA-55EC,U+55EF,U+55F2-55F3,U+55F5,U+55F7,U+55FE,U+5600-5601,U+5608,U+560C,U+560F,U+561E-561F,U+5623-5624,U+5627,U+562C-562D,U+5639,U+564C-564D,U+5654,U+5657-5659,U+565C,U+5662,U+5664,U+5669,U+566B,U+5671,U+567B-567C,U+5685-5686,U+5693,U+56AF,U+56D4,U+56D7,U+56DD,U+56DF,U+56E1,U+56EB,U+56F5,U+56F9,U+56FF,U+5704,U+5709-570A,U+571C,U+5729-572A,U+572C,U+572E-572F,U+5733,U+5739,U+573B,U+5742,U+574C,U+575C,U+5768-5769,U+576B,U+576D,U+5773,U+5776,U+577B-577C,U+5785-5786,U+578C,U+5793,U+57A0-57A1,U+57A4,U+57A7,U+57A9,U+57AD,U+57B2,U+57B4,U+57B8,U+57CF,U+57D2,U+57D5,U+57D8-57DA,U+57DD,U+57E4,U+57ED,U+57EF,U+57F4,U+57F8,U+57FD,U+5800,U+5807,U+580B,U+580D,U+5819,U+581E,U+5820,U+5844,U+5865,U+586C,U+587E,U+5880-5881,U+5889,U+589A,U+58BC,U+58C5,U+58D1,U+5902,U+5914,U+5919,U+5924-5925,U+592D,U+593C,U+5941-5942,U+5955,U+5958,U+595A,U+5B34,U+5B5B,U+5B6C,U+5C22,U+5C25,U+5C2C,U+5C34,U+5C7A,U+5C88,U+5C8C-5C8D,U+5C90-5C91,U+5C96,U+5C98-5C9A,U+5C9C,U+5CA2-5CA3,U+5CAB-5CAC,U+5CB1,U+5CB5,U+5CB7,U+5CBD,U+5CC1,U+5CC4,U+5CCB,U+5CD2,U+5CE4-5CE5,U+5D02-5D03,U+5D06,U+5D1B,U+5D1E,U+5D24,U+5D26-5D27,U+5D2E,U+5D34,U+5D3D-5D3E,U+5D4A-5D4B,U+5D58,U+5D5B,U+5D5D,U+5D69,U+5D6B-5D6C,U+5D6F,U+5D74,U+5D82,U+5D99,U+5D9D,U+5DB7,U+5DC5,U+5DEF,U+5DFD,U+5E0F,U+5E11,U+5E14,U+5E19,U+5E31,U+5E37,U+5E3B-5E3C,U+5E44,U+5E54,U+5E5B,U+5E5E,U+5E61,U+5E80,U+5E8B,U+5E91,U+5E96,U+5EA0,U+5EA5,U+5EB3,U+5EB5,U+5EB9,U+5EBE,U+5ED1-5ED2,U+5EDB,U+5EE8,U+5EEA,U+5EF4,U+5EFE-5EFF,U+5F01,U+5F08,U+5F0B,U+5F11,U+5F61,U+5F73,U+5F77,U+5F82,U+5F87,U+5F89,U+5F8C,U+5F95,U+5F99,U+5F9C,U+5FA8,U+5FAD,U+5FB5,U+5FBC,U+5FD2,U+61FF,U+624C,U+626A,U+629F,U+62BB,U+62CA,U+62D7,U+62DA,U+62EE,U+62F6,U+6322,U+6339,U+6343,U+634B,U+6369,U+636D,U+6371,U+637A,U+638A,U+638E,U+63AC-63AE,U+63B4,U+63BC,U+63BE,U+63C4,U+63C6,U+63CE,U+63DE,U+63E0,U+63F2,U+63F6,U+63F8,U+63FF,U+640B-640C,U+641B,U+6420-6421,U+6426,U+6441,U+6445,U+6452,U+645E,U+646D,U+647A,U+6484,U+6496,U+6499,U+64B7-64B8,U+64BA,U+64C0,U+64D0,U+64D7,U+64E2,U+64E4,U+6509,U+6525,U+652E,U+6538,U+6BD3,U+6C10,U+6C3D,U+6C46,U+71EE,U+723B,U+72AD,U+72B0,U+72B4,U+72B7-72B8,U+72C1,U+72C3,U+72CD-72CE,U+72D2,U+72E8-72E9,U+72EF,U+72F2-72F4,U+72F7,U+72FA-72FB,U+7301,U+7303,U+730A,U+7313,U+7315,U+7317,U+731D-731E,U+7321-7322,U+7325,U+732C,U+7331,U+7338-7339,U+734D,U+7350,U+7357,U+7360,U+736C,U+736F,U+737E,U+750D,U+7519,U+755A,U+777E,U+77A2,U+77CD,U+7980,U+79BA,U+7C74,U+7F54,U+7FB8,U+8037,U+80E4,U+8114,U+81BA,U+821B,U+8279,U+827D,U+827F,U+8284,U+8288,U+828A,U+828E-828F,U+8291,U+8297-8299,U+829F,U+82A1,U+82A4,U+82A8-82AB,U+82AE,U+82B0,U+82B4,U+82B7-82B8,U+82BE,U+82C1,U+82C4,U+82C8,U+82CA-82CC,U+82CE,U+82D2-82D3,U+82D5,U+82D8,U+82DC,U+82E0-82E1,U+82E3-82E4,U+82F4,U+82F7,U+82FB,U+8306-8309,U+830C,U+830F,U+8311,U+8314-8315,U+8317,U+831A-831C,U+832D,U+832F,U+8331,U+8333-8334,U+833A,U+833C,U+8340,U+8343,U+8347,U+834F,U+8351,U+835B-835C,U+835E-8360,U+8365-8366,U+8368-836A,U+836C-836E,U+8378,U+837B-837D,U+8385,U+8392-8393,U+8398,U+839B-839C,U+839E,U+83A0,U+83A8-83AA,U+83B0,U+83B3-83B4,U+83B6,U+83B8,U+83BA,U+83BC,U+83C0-83C1,U+83C5,U+83D4,U+83D6,U+83D8,U+83DD,U+83DF,U+83E1,U+83E5,U+83EA,U+83F0,U+83F8-83F9,U+83FD,U+8401,U+8403,U+8406,U+840B,U+840F,U+8411,U+8418,U+841C,U+8426,U+8431,U+8438,U+843C,U+8446,U+8451,U+8459-845A,U+845C,U+8469,U+846D,U+8473,U+8476,U+8478,U+847A,U+8487-8489,U+848C,U+848E,U+8497,U+84A1,U+84AF,U+84B4,U+84B9-84BA,U+84BD,U+84BF,U+84C1,U+84CA,U+84CD,U+84D0,U+84D3,U+84E0,U+84E3,U+84E5-84E6,U+84F0,U+84FC,U+84FF,U+850C,U+851F,U+8538-853B,U+8543,U+8548,U+8556,U+8559,U+855E,U+8564,U+8568,U+8572,U+8579-857B,U+8585,U+8587,U+858F,U+859C,U+85A4,U+85A8,U+85AE,U+85B0,U+85B7,U+85B9,U+85C1,U+85D3,U+85DC,U+85FF,U+8605,U+8616,U+8627,U+8629,U+863C,U+8803,U+8862,U+886E,U+88A4,U+88D2,U+8A07,U+8BA0,U+8BA6-8BA7,U+8BAA,U+8BB4-8BB5,U+8BB7,U+8BC2-8BC3,U+8BCB,U+8BCE-8BCF,U+8BD2-8BD4,U+8BD6,U+8BD8-8BD9,U+8BDC,U+8BDF-8BE0,U+8BE4,U+8BE8-8BE9,U+8BEE,U+8BF0,U+8BF3,U+8BF6,U+8BF9,U+8BFC,U+8BFF-8C00,U+8C02,U+8C04,U+8C07,U+8C0C,U+8C0F,U+8C11-8C12,U+8C14-8C16,U+8C18-8C19,U+8C1B,U+8C1D,U+8C1F-8C21,U+8C25,U+8C27,U+8C2A-8C2B,U+8C2E-8C2F,U+8C32-8C33,U+8C35-8C36,U+8C73,U+8D53,U+8D5C-8D5D,U+8F94,U+9097,U+9099,U+909B,U+909D,U+90A1,U+90AC,U+90B0,U+90B3-90B4,U+90B6,U+90B8,U+90BA,U+90BE,U+90C4-90C5,U+90C7,U+90CF-90D0,U+90D3,U+90D7,U+90DB-90DC,U+90E2,U+90E6,U+90EB,U+90EF,U+90FE,U+9104,U+911E,U+9122-9123,U+912F,U+9131,U+9139,U+9143,U+9146,U+961D,U+9621-9622,U+962A,U+9631,U+963C-963D,U+9642,U+9649,U+9654,U+965F,U+9667,U+966C,U+9672,U+9674,U+9688,U+968D,U+9697,U+96B0,U+9765,U+98E7,U+9963,U+9967-996C,U+9974,U+9977,U+997D,U+9980,U+9984,U+9987,U+998A,U+998D,U+9990-9991,U+9993-9995,U+9997-9998,U+99A8,U+9B2F,U+9B32,U+9EC9,U+9F10,U+9F17,U+9F19,U+9FA0`}),Object.freeze({family:`Aha Hand`,file:`wenkai-gb-5-d0359bbc.woff2`,bytes:278908,unicodeRange:`U+4E2C,U+5216,U+54AB,U+584D,U+5981,U+5983,U+598D,U+5997,U+599E,U+59A3-59A4,U+59A9-59AB,U+59AF,U+59B2,U+59BE,U+59CA,U+59D2,U+59D7-59D8,U+59DD,U+59E3,U+59F9,U+5A05-5A06,U+5A08-5A09,U+5A0C,U+5A11,U+5A13,U+5A23,U+5A32,U+5A34,U+5A3C,U+5A40,U+5A4A,U+5A55,U+5A62,U+5A67,U+5A75,U+5A77,U+5A7A,U+5A9B,U+5AAA,U+5AB2,U+5AB5,U+5AB8,U+5ABE,U+5AD2,U+5AD4,U+5AD6,U+5AD8,U+5ADC,U+5AE0,U+5AE3,U+5AE6,U+5AEB,U+5AF1,U+5B09,U+5B16-5B17,U+5B32,U+5B37,U+5B40,U+5B51,U+5B53,U+5B5A,U+5B62,U+5B65,U+5B71,U+5B73,U+5B80,U+5B84,U+5B93,U+5B95,U+5BA5,U+5BB8,U+5BE4,U+5BEE,U+5BF0,U+5C15,U+5C1C,U+5C3B,U+5C50,U+5C59,U+5C63,U+5C66,U+5C6E,U+5DDB,U+5E7A,U+5F29-5F2A,U+5F2D,U+5F3C,U+5F40,U+5F50,U+5F56-5F58,U+5FC4,U+5FC9,U+5FCF-5FD1,U+5FD6,U+5FDD,U+5FE1,U+5FE4,U+5FEA,U+5FED-5FEE,U+5FF8,U+5FFE,U+6003-6006,U+600A,U+600D,U+600F,U+6019,U+601B,U+6021,U+6026,U+6029,U+602B,U+6035,U+603C,U+603F,U+6041-6042,U+6059-605A,U+605D,U+6063,U+6067,U+606A,U+6078-607B,U+607D,U+6083,U+608C,U+6092,U+6096,U+609A-609B,U+609D,U+60AB,U+60AD,U+60B1,U+60B4,U+60BB,U+60C6,U+60D8,U+60DA,U+60DD,U+60EC,U+60F4,U+6100,U+6106,U+610D-610E,U+6115,U+6120,U+6123,U+6126,U+612B,U+614A,U+615D,U+6175,U+6194,U+619D,U+61A7,U+61A9,U+61AC,U+61B7,U+61CB,U+61D1,U+61D4,U+61F5,U+6206,U+620B,U+6215,U+6217,U+621B,U+621F,U+6221-6222,U+6224-6225,U+622C,U+623D-623E,U+6243,U+6248-6249,U+6308,U+6332,U+63B0,U+6434,U+643F,U+64D8,U+6534-6535,U+6555,U+656B,U+6590,U+6593,U+65AB,U+65BC,U+65C3-65C4,U+65C6,U+65CC,U+65CE,U+65D2,U+65D6,U+65EE-65F0,U+6600,U+6603,U+660A,U+6615,U+6619,U+661D,U+6631,U+6634-6636,U+6641,U+664F,U+6654,U+6656-6657,U+665F,U+6661,U+6677,U+6684,U+668C,U+669D,U+66A7,U+66B9,U+66BE,U+66DB-66DC,U+66E6,U+66E9,U+66F7,U+670A,U+6710,U+6715,U+6726,U+6748,U+674C,U+6753,U+675E,U+6769-676A,U+6772-6773,U+6775,U+6777,U+677C,U+6787,U+678B,U+6798,U+679E,U+67A5,U+67A7-67A8,U+67AD,U+67B0,U+67B3,U+67B5,U+67B8,U+67C1,U+67C3,U+67D8-67DA,U+67DD,U+67E2,U+67E9,U+67F0,U+67FD,U+6800,U+6809-680A,U+680C,U+680E,U+681D,U+6829,U+6832-6833,U+683E,U+6840-6841,U+6844,U+6849-684A,U+684E,U+6855,U+6860-6862,U+6864,U+6866-6867,U+686B,U+6874,U+6877,U+6883,U+688F,U+6893,U+68B5,U+68C2,U+68E3,U+68F0,U+68F9,U+68FC,U+6901,U+690B,U+6910,U+691F-6920,U+6924,U+6934,U+6939,U+6942,U+6957,U+695D,U+6960,U+6963,U+6966,U+696B,U+696E,U+6971,U+6978-6979,U+6980,U+6984,U+6987-6989,U+698D,U+6995,U+6998,U+699B,U+69A7,U+69AB,U+69AD,U+69B1,U+69BB,U+69C1,U+69CA,U+69CC,U+69CE,U+69D4,U+69DF-69E0,U+69ED,U+69F2,U+69FF,U+6A17-6A18,U+6A28,U+6A2F,U+6A35,U+6A3D-6A3E,U+6A44,U+6A50,U+6A58,U+6A5B,U+6A65,U+6A79,U+6A7C,U+6A8E,U+6A90-6A91,U+6A97,U+6AA0,U+6AA9,U+6AAB,U+6B24,U+6B37,U+6B39,U+6B43,U+6B46,U+6B59,U+6B81-6B82,U+6B84,U+6B87,U+6B8D,U+6B92-6B93,U+6B9A-6B9B,U+6BA1,U+6BAA,U+6BB3,U+6BC2,U+6BEA,U+6BF3,U+6BF5,U+6BF9,U+6BFD,U+6C05-6C07,U+6C0D,U+6C15,U+6C18-6C1A,U+6C21,U+6C24,U+6C29-6C2A,U+6C32,U+6C35,U+6C4A,U+6C54,U+6C5C,U+6C68-6C69,U+6C74,U+6C76,U+6C85-6C86,U+6C8C,U+6C90,U+6C93-6C94,U+6CA3,U+6CA9,U+6CAD,U+6CB1-6CB2,U+6CD0,U+6CD3-6CD4,U+6CD6-6CD7,U+6CE0,U+6CEB,U+6CEE-6CEF,U+6CF1,U+6CF6-6CF8,U+6CFA,U+6CFE,U+6D04,U+6D07,U+6D0C,U+6D0E,U+6D19-6D1A,U+6D27,U+6D2B,U+6D2E,U+6D33,U+6D35,U+6D39,U+6D43,U+6D48,U+6D4D,U+6D4F,U+6D52,U+6D54,U+6D5C,U+6D5E,U+6D60,U+6D63,U+6D6F,U+6D7C,U+6D91,U+6D93-6D94,U+6D9E,U+6DA0,U+6DAB,U+6DAE,U+6DBF,U+6DC5,U+6DC7,U+6DD9,U+6DDD-6DDE,U+6DE0,U+6DE6,U+6DFC,U+6E0C,U+6E0E,U+6E11,U+6E16,U+6E1A,U+6E25,U+6E2B,U+6E32,U+6E44,U+6E4E,U+6E53-6E54,U+6E5F,U+6E6B,U+6E6E,U+6E86,U+6E8F,U+6E98,U+6E9F,U+6EA5,U+6EA7,U+6EB1-6EB2,U+6EB4,U+6EB7,U+6EBB,U+6EBD,U+6EC2,U+6ECF,U+6ED5,U+6ED7,U+6EDF-6EE0,U+6EE2,U+6EF9,U+6F09,U+6F15,U+6F24,U+6F29-6F2A,U+6F2D,U+6F2F,U+6F36,U+6F46-6F47,U+6F4B,U+6F62,U+6F72,U+6F74,U+6F78,U+6F7A,U+6F7C,U+6F89,U+6F8C-6F8D,U+6FA7,U+6FB6,U+6FB9,U+6FC2,U+6FC9,U+6FD1,U+6FDE,U+6FE0-6FE1,U+6FEE-6FEF,U+701A-701B,U+7023,U+7035,U+7039,U+704F,U+705E,U+706C,U+7080,U+7085,U+7096,U+709C-709D,U+70AB,U+70B1,U+70B7,U+70BB,U+70C0,U+70CA,U+70E8,U+7110,U+7113,U+7116,U+7118,U+712F,U+7131,U+7145,U+714A,U+715C,U+7166,U+7168,U+7172-7173,U+7178,U+717A,U+7198,U+71A0,U+71A8,U+71B3,U+71B5,U+71B9,U+71D4,U+71E0,U+71E7,U+71F9,U+721D,U+7228,U+7230,U+723F,U+724D,U+7252,U+7256,U+725D,U+7266,U+726E-726F,U+727E-727F,U+7284,U+728B,U+728D,U+728F,U+7292,U+729F,U+7337,U+7352,U+738E,U+7391,U+739F,U+73A2,U+73AE,U+73B3,U+73B7,U+73BA,U+73C0,U+73C2,U+73C8-73C9,U+73CF,U+73D1,U+73D9,U+73DE,U+73E5,U+73E7,U+73E9,U+73F2,U+740A,U+740F,U+741A-741B,U+7425-7426,U+7428,U+742A,U+742C,U+742E,U+7430,U+7441,U+7455,U+7457,U+7459,U+745B-745C,U+746D,U+7477,U+747E,U+7480-7481,U+7487,U+748B,U+748E,U+7490,U+749C,U+749E,U+74A7-74A9,U+74BA,U+74D2,U+74EF,U+74F4,U+74FF,U+750F,U+7511,U+7513,U+752F,U+753E,U+757F,U+77F6,U+77F8,U+7800,U+7809,U+7811,U+7817-7818,U+781C-781D,U+782D,U+793B,U+7940,U+7946,U+7949,U+7953,U+7957,U+795A-795C,U+7960,U+7962,U+7967,U+796F,U+797A,U+7985,U+798A,U+799A,U+79A7,U+79B3,U+7E9F,U+7EA1,U+7EA3,U+7EA5,U+7EA8-7EA9,U+7EAD,U+7EB0,U+7EBE,U+7EC0-7EC2,U+7EC9,U+7ECB-7ECC,U+7ED0,U+7ED4,U+7ED7,U+7EDB,U+7EE0-7EE1,U+7EE8,U+7EEB,U+7EEE-7EEF,U+7EF1-7EF2,U+7EF6,U+7EFA-7EFB,U+7EFE,U+7F01-7F03,U+7F07-7F08,U+7F0B-7F0D,U+7F0F,U+7F11-7F12,U+7F17,U+7F19,U+7F1B-7F1C,U+7F1F,U+7F21-7F27,U+7F2A-7F2D,U+7F2F-7F33,U+7F35,U+7FBC,U+8004,U+8006,U+807F-8080,U+8093,U+809C,U+809F,U+80AB,U+80AD,U+80B1,U+80B4,U+80B7,U+80BC-80BD,U+80C2,U+80C4,U+80CD,U+80D7,U+80D9,U+80DB,U+80DD,U+80E7-80ED,U+80F1-80F2,U+80F4,U+80FC,U+810D-810E,U+8112,U+8118,U+811E,U+812C,U+8132,U+8136,U+8148,U+814C,U+8153,U+8159-815A,U+8160,U+8167,U+8169,U+816D,U+8171,U+8174,U+817C-817D,U+8182,U+8188,U+8191,U+81A3,U+81A6,U+81AA,U+81BB,U+81C1,U+81CA,U+81CC,U+81E7,U+8274,U+8662,U+8930,U+89C7,U+89CA-89CC,U+89CE-89D1,U+89F3,U+8B07,U+8C5A,U+8D32-8D33,U+8D36,U+8D3B,U+8D3D,U+8D40,U+8D45-8D49,U+8D4D,U+8D55,U+8D59,U+8E47,U+8ECE,U+8F6B,U+8F6D,U+8F71-8F73,U+8F75-8F7A,U+8F7C,U+8F7E,U+8F81-8F82,U+8F84,U+8F87,U+8F8B,U+8F8D-8F8F,U+8F98,U+8F9A,U+8FB6,U+8FD3,U+8FD5,U+8FE4-8FE6,U+8FE8-8FE9,U+8FEE,U+8FF3,U+9004-9005,U+900B,U+900D,U+9011,U+9016,U+9021,U+9026,U+902D,U+902F,U+9035-9036,U+9044,U+9050-9052,U+9058,U+905B,U+9062,U+9068,U+9074,U+907D,U+9082-9083,U+9088,U+908B,U+9095,U+95E9,U+95EB,U+95F1,U+95F3,U+95F5-95F6,U+95FC,U+95FE,U+9603-9604,U+9606,U+9608,U+960A-960D,U+960F,U+9612,U+9615-9617,U+9619-961A,U+96B3,U+97EA-97EC,U+987C,U+98D1-98D3,U+98D5,U+98D9-98DA,U+9A75,U+9A77-9A78,U+9A7A,U+9A7D,U+9A7F-9A81,U+9A85,U+9A88,U+9A8A,U+9A90,U+9A92-9A93,U+9A96,U+9A98,U+9A9B-9AA0,U+9AA2-9AA3,U+9AA5,U+9AA7,U+9B3B,U+9F51`}),Object.freeze({family:`Aha Hand`,file:`wenkai-gb-6-a238b41c.woff2`,bytes:307604,unicodeRange:`U+5D47,U+6549,U+659B,U+66A8,U+74DE,U+74E0,U+752C,U+753A,U+7540,U+7548,U+754B,U+754E,U+755B,U+7572,U+7579,U+7583,U+758B,U+7592,U+7594,U+7596,U+759D,U+75A0,U+75A3,U+75AC,U+75B0-75B1,U+75B3-75B4,U+75B8,U+75C2-75C4,U+75CD,U+75D6,U+75E3-75E4,U+75E6-75E8,U+75EB,U+75F1,U+75FC,U+75FF-7600,U+7603,U+7605,U+760A,U+760C,U+7610,U+7615,U+7617-7619,U+761B,U+7620,U+7622,U+7625,U+762D,U+7630,U+7633,U+7635,U+763C,U+763E-7640,U+7643,U+764D,U+7654,U+7656,U+765C,U+765E,U+766B,U+766F,U+7688,U+768E,U+7693,U+7699,U+76A4,U+76B2,U+76B4,U+76CD,U+76E5,U+76F1,U+76F9,U+7704,U+7707-7708,U+770D,U+7719-771A,U+7722,U+7726,U+772D,U+7735,U+7738,U+7743,U+7747,U+7750-7751,U+775A,U+7762,U+7765,U+7768,U+777D,U+777F-7780,U+778C-778D,U+7791,U+779F-77A0,U+77B0,U+77B5,U+77BD,U+77BF,U+77DC,U+77E7,U+77EC,U+781F,U+7823,U+7825-7826,U+7829,U+782C,U+7839-783C,U+7847,U+784C,U+784E,U+7850,U+7856-7857,U+786A,U+786D,U+7887,U+7893,U+789A-789C,U+78A1,U+78A3,U+78A5,U+78B2,U+78B9,U+78C9,U+78D4,U+78D9,U+78EC,U+78F2,U+78F4,U+7905,U+7913,U+791E,U+7924,U+7934,U+79D5,U+79E3,U+79EB,U+79ED,U+7A02-7A03,U+7A06,U+7A14,U+7A1E,U+7A23,U+7A37,U+7A39,U+7A51,U+7A70,U+7A78-7A79,U+7A80,U+7A86,U+7A88,U+7A95,U+7AA0,U+7AA6,U+7AA8,U+7AAC-7AAD,U+7AB3,U+7AE6,U+7AFA,U+7AFD,U+7B03-7B04,U+7B08,U+7B0A,U+7B0F,U+7B15,U+7B19,U+7B1E,U+7B20,U+7B24-7B25,U+7B2A-7B2B,U+7B2E,U+7B31,U+7B33,U+7B38,U+7B3E,U+7B45,U+7B47,U+7B4C,U+7B58,U+7B5A,U+7B5D,U+7B60,U+7B62,U+7B6E,U+7B71-7B72,U+7B75,U+7B7B,U+7B85,U+7B90,U+7B9C-7B9D,U+7BA2,U+7BA6-7BA8,U+7BAA-7BAC,U+7BB4,U+7BB8,U+7BC1,U+7BCC,U+7BD1,U+7BDA,U+7BDD,U+7BE5-7BE6,U+7BEA,U+7BFC,U+7BFE,U+7C0B-7C0C,U+7C0F,U+7C16,U+7C1F,U+7C26,U+7C2A,U+7C38,U+7C40-7C41,U+7C7C,U+7C91,U+7C9C-7C9E,U+7CA2,U+7CB2,U+7CBC-7CBD,U+7CC1,U+7CC5,U+7CC7-7CC8,U+7CCC-7CCD,U+7CD7,U+7CE8,U+7CF8,U+7D77,U+7DA6,U+7DAE,U+7E3B,U+7E47,U+7E9B,U+7F36,U+7F42,U+7F44-7F45,U+7F58,U+7F5F,U+7F61,U+7F68,U+7F71,U+7F74,U+7F79,U+7F7E,U+7F81,U+7F9D,U+7F9F,U+7FA7,U+7FAF-7FB0,U+7FB2,U+7FBF,U+7FCA,U+7FCE,U+7FD5,U+7FE1,U+7FE5-7FE6,U+7FE9,U+7FEE,U+7FF3,U+800B,U+8012,U+8014,U+8016,U+801C,U+8020,U+8022,U+8025-8029,U+8031,U+8035,U+8043,U+8046,U+804D,U+8052,U+8069,U+8071,U+80E5,U+81EC,U+81FE,U+8201-8202,U+8204,U+8210,U+8221-8223,U+8228,U+822B,U+822D,U+822F,U+8233-8234,U+8238,U+823B,U+823E,U+8244,U+8249,U+824B,U+824F,U+825A,U+825F,U+8268,U+826E,U+864D,U+8654,U+866C,U+866E,U+867A-867C,U+867F,U+868B,U+868D,U+8693,U+869D,U+86A3,U+86A7-86AA,U+86AC,U+86AF-86B1,U+86B4-86B6,U+86BA,U+86C4,U+86C9,U+86CE-86D1,U+86D8,U+86DE-86DF,U+86E9,U+86ED,U+86F1-86F4,U+86F8,U+8703,U+8707-870A,U+870D,U+8713,U+871A,U+871E,U+8722-8723,U+8725,U+8729,U+872E,U+8731,U+8734,U+8737,U+873B,U+873E-873F,U+8748,U+874C,U+8753,U+8759,U+8760,U+8763-8765,U+876E,U+8770,U+877B-877E,U+8782-8783,U+8785,U+8788,U+878B,U+8793,U+8797,U+87A8,U+87AB-87AD,U+87AF,U+87B3,U+87B5,U+87BD,U+87C0,U+87C6,U+87CA-87CB,U+87D1-87D3,U+87DB,U+87E0,U+87E5,U+87EA,U+87EE,U+87FE,U+880A,U+8813,U+8816,U+881B,U+8821,U+8832,U+8839,U+883C,U+8844,U+8864,U+8869,U+8872,U+887D-887F,U+8882,U+8885,U+8888,U+88A2,U+88B7,U+88BC,U+88C6,U+88C9,U+88CE,U+88D8,U+88DF,U+88E2-88E3,U+88E5,U+88E8,U+88F0-88F1,U+88FC,U+88FE,U+890A,U+8913,U+8919-891B,U+8921,U+892B,U+8934,U+8936,U+8941,U+895E,U+8966,U+897B,U+8983,U+89D6,U+89DA,U+89DC,U+89DE,U+89E5,U+89EB,U+89EF,U+8A3E,U+8A48,U+8B26,U+8C47,U+8C49,U+8C55,U+8C78,U+8C82,U+8C85,U+8C8A,U+8C94,U+8C98,U+8D67,U+8D6D,U+8D73,U+8D84,U+8D91,U+8D94,U+8DB1,U+8DB5,U+8DB8,U+8DBA,U+8DBC,U+8DBF,U+8DC4,U+8DC6,U+8DCE-8DCF,U+8DD6-8DD7,U+8DDA-8DDB,U+8DDE,U+8DE3-8DE4,U+8DEB-8DEC,U+8DF7-8DF9,U+8DFB,U+8DFD,U+8E05,U+8E09,U+8E14,U+8E1D,U+8E1F,U+8E23,U+8E2C,U+8E2E-8E2F,U+8E31,U+8E35,U+8E39-8E3A,U+8E3D,U+8E40-8E42,U+8E49-8E4A,U+8E51-8E52,U+8E59,U+8E69,U+8E6F-8E70,U+8E74,U+8E76,U+8E7C,U+8E85,U+8E8F-8E90,U+8E94,U+8E9C,U+8E9E,U+914A,U+914E-9150,U+9161-9162,U+9164,U+9169,U+916F-9170,U+9172,U+9174,U+9179,U+917D-917E,U+9185,U+918C-918D,U+9190-9191,U+91A2-91A3,U+91AA,U+91AD-91AF,U+91B4-91B5,U+91BA,U+928E,U+92AE,U+92C8,U+933E,U+936A,U+938F,U+93CA,U+93D6,U+943E,U+946B,U+9485-9487,U+948A-948D,U+948F-9490,U+9494-9495,U+9497,U+949A-949C,U+94A3-94A4,U+94AA-94AD,U+94AF-94B0,U+94B2,U+94B4,U+94B6-94BA,U+94BC-94BD,U+94BF,U+94C4,U+94C8-94CE,U+94D0-94D2,U+94D5-94D9,U+94DB,U+94DE-94E0,U+94E2,U+94E4-94E5,U+94E7-94EB,U+94EE-94EF,U+94F3-94F5,U+94F7,U+94F9,U+94FC-94FD,U+94FF,U+9502-9503,U+9506-9507,U+9509-950A,U+950D-950F,U+9512-9516,U+9518,U+951B,U+951D-951F,U+9522,U+9529-952C,U+9531-9532,U+9534-9538,U+953A,U+953C,U+953E-953F,U+9542,U+9544-9546,U+9549,U+954C,U+954E-954F,U+9552-9554,U+9556-9559,U+955B,U+955D-955F,U+9561-9562,U+9564-956C,U+956F,U+9571-9573,U+96B9,U+96BC-96BD,U+96C9,U+96CE,U+96D2,U+96E0,U+96E9,U+96EF,U+96F3,U+9701,U+9706,U+9708,U+970E-970F,U+972A,U+972D,U+9730,U+973E,U+9753,U+977C,U+9785,U+9791-9792,U+9794,U+97A3,U+97AB,U+97AF,U+97B2,U+97B4,U+9878,U+9880,U+9883,U+9889,U+988C-988D,U+988F,U+9894,U+989A-989B,U+989E-989F,U+98A1-98A2,U+98A5-98A6,U+98E8,U+990D,U+992E,U+9954-9955,U+99A5,U+9AB0-9AB1,U+9AB6-9AB7,U+9ABA,U+9ABC,U+9AC0-9AC2,U+9AC5,U+9ACB-9ACC,U+9AD1,U+9ADF,U+9AE1,U+9AE6,U+9AEB,U+9AED,U+9AEF,U+9AF9,U+9AFB,U+9B08,U+9B0F,U+9B13,U+9B1F,U+9B23,U+9B43,U+9B45,U+9B47-9B49,U+9B4D,U+9B51,U+9C7F,U+9C82,U+9C85-9C88,U+9C8B,U+9C8E,U+9C90-9C92,U+9C94-9C95,U+9C9A-9C9B,U+9C9E-9CA3,U+9CA5-9CA9,U+9CAB,U+9CAD-9CAE,U+9CB0-9CB7,U+9CBA-9CBD,U+9CC4-9CC7,U+9CCA-9CD0,U+9CD3-9CD5,U+9CD7-9CD9,U+9CDC-9CDD,U+9CDF,U+9CE2,U+9E20,U+9E22,U+9E28-9E2C,U+9E31-9E32,U+9E36-9E3A,U+9E3E,U+9E41-9E42,U+9E44,U+9E46-9E49,U+9E4B-9E4C,U+9E4E,U+9E51,U+9E55,U+9E57-9E58,U+9E5A-9E5C,U+9E5E,U+9E63,U+9E66-9E6D,U+9E71,U+9E73,U+9E7E,U+9E82,U+9E87-9E88,U+9E8B,U+9E92,U+9E9D,U+9E9F,U+9EB4,U+9EB8,U+9EBD-9EBE,U+9ECF,U+9EDB-9EDD,U+9EDF-9EE0,U+9EE2,U+9EE5,U+9EE7,U+9EE9-9EEA,U+9EEF,U+9EF9,U+9EFB-9EFC,U+9EFE,U+9F0B,U+9F0D,U+9F22,U+9F2C,U+9F2F,U+9F37,U+9F39,U+9F3D-9F3E,U+9F44,U+9F80,U+9F83,U+9F85-9F8A,U+9F8C,U+9F9B`})]),Df=`'Aha Hand Latin','Aha Hand','Segoe Print','Ink Free','Bradley Hand','Chalkboard SE','Noteworthy','Comic Sans MS','LXGW WenKai','Kaiti SC','STKaiti','KaiTi','楷体',cursive`,Of=Ef.map(e=>`@font-face{font-family:'${e.family}';font-style:normal;font-weight:400;font-display:swap;src:url('api/aha-tutor/font?f=${e.file}') format('woff2');unicode-range:${e.unicodeRange}}`).join(`
|
|
277
|
-
`),$=e=>`calc(${e}*var(--aha-px))`,
|
|
276
|
+
endstream`)});let d=4+e.length*3,f=s;c(`xref\n0 ${d}\n0000000000 65535 f \n`);for(let e=1;e<d;e+=1)c(`${String(o[e]).padStart(10,`0`)} 00000 n \n`);c(`trailer\n<< /Size ${d} /Root 1 0 R /Info 3 0 R >>\nstartxref\n${f}\n%%EOF\n`);let p=new Uint8Array(s),m=0;for(let e of a)p.set(e,m),m+=e.length;return p}async function yf(e){let t=new Blob([e]).stream().pipeThrough(new CompressionStream(`deflate`));return new Uint8Array(await new Response(t).arrayBuffer())}async function bf(e){let{width:t,height:n}=e;if(typeof CompressionStream==`function`){let{data:r}=e.getContext(`2d`).getImageData(0,0,t,n),i=new Uint8Array(t*n*3);for(let e=0,t=0;e<r.length;e+=4,t+=3)i[t]=r[e],i[t+1]=r[e+1],i[t+2]=r[e+2];return{width:t,height:n,filter:`FlateDecode`,data:await yf(i)}}let r=await new Promise(t=>{e.toBlob(t,`image/jpeg`,.92)});if(!r)throw Error(`image encoding failed`);return{width:t,height:n,filter:`DCTDecode`,data:new Uint8Array(await r.arrayBuffer())}}let xf=null;function Sf(e){if(!xf){xf=new Uint32Array(256);for(let e=0;e<256;e+=1){let t=e;for(let e=0;e<8;e+=1)t=t&1?3988292384^t>>>1:t>>>1;xf[e]=t>>>0}}let t=4294967295;for(let n of e)t=xf[(t^n)&255]^t>>>8;return(t^4294967295)>>>0}function Cf(e){return{time:e.getHours()<<11|e.getMinutes()<<5|Math.floor(e.getSeconds()/2),day:Math.max(0,e.getFullYear()-1980)<<9|e.getMonth()+1<<5|e.getDate()}}function wf(e,t=new Date){let n=new TextEncoder,{time:r,day:i}=Cf(t),a=[],o=[],s=0;for(let t of e){let e=n.encode(t.name),c=Sf(t.data),l=t.data.length,u=new DataView(new ArrayBuffer(30));u.setUint32(0,67324752,!0),u.setUint16(4,20,!0),u.setUint16(6,2048,!0),u.setUint16(8,0,!0),u.setUint16(10,r,!0),u.setUint16(12,i,!0),u.setUint32(14,c,!0),u.setUint32(18,l,!0),u.setUint32(22,l,!0),u.setUint16(26,e.length,!0),u.setUint16(28,0,!0),a.push(new Uint8Array(u.buffer),e,t.data);let d=new DataView(new ArrayBuffer(46));d.setUint32(0,33639248,!0),d.setUint16(4,20,!0),d.setUint16(6,20,!0),d.setUint16(8,2048,!0),d.setUint16(10,0,!0),d.setUint16(12,r,!0),d.setUint16(14,i,!0),d.setUint32(16,c,!0),d.setUint32(20,l,!0),d.setUint32(24,l,!0),d.setUint16(28,e.length,!0),d.setUint32(42,s,!0),o.push(new Uint8Array(d.buffer),e),s+=30+e.length+l}let c=o.reduce((e,t)=>e+t.length,0),l=new DataView(new ArrayBuffer(22));l.setUint32(0,101010256,!0),l.setUint16(8,e.length,!0),l.setUint16(10,e.length,!0),l.setUint32(12,c,!0),l.setUint32(16,s,!0);let u=[...a,...o,new Uint8Array(l.buffer)],d=new Uint8Array(u.reduce((e,t)=>e+t.length,0)),f=0;for(let e of u)d.set(e,f),f+=e.length;return d}function Tf(e){return new Promise((t,n)=>{e.toBlob(e=>e?t(e):n(Error(`image encoding failed`)),`image/png`)})}function Ef({steps:e,title:t,kind:n=`ghost`}){let{t:a,settings:s,toast:c}=v(),l=w(),[u,d]=(0,r.useState)(!1),[f,p]=(0,r.useState)(null),_=(0,r.useRef)(null),y=(0,r.useRef)(null),b=s.boardTheme===`dark`||s.boardTheme!==`light`&&l?`dark`:`light`,x=s.boardFont===`standard`?`standard`:`hand`,S=m(t);function C(n){if(d(!1),!(!e?.length||f)){if(n===`md`){h(`${S}.md`,Ue({title:t,steps:e}),`text/markdown`);return}p({id:Date.now(),format:n,done:0,total:0})}}function T(){y.current&&(y.current.cancelled=!0),y.current=null,p(null)}async function E(e,n){let r=_.current;if(!r)throw Error(`pages missing`);await cf(r),lf(r);let i=[...r.querySelectorAll(`[data-sheet]`)];p(e=>e&&{...e,total:i.length});let o=[];for(let[t,r]of i.entries()){if(n.cancelled)return;let i=await df(uf(r,{scale:2})),a=mf(i,2);o.push(e===`pdf`?{width:i.width,height:i.height,image:await bf(a)}:await Tf(a)),p(e=>e&&{...e,done:t+1})}if(!(n.cancelled||!o.length))if(e===`pdf`)g(`${S}.pdf`,new Blob([vf(o,{title:t,creator:`${a(`appName`)} · ${a(`appTagline`)}`})],{type:`application/pdf`}));else if(o.length===1)g(`${S}.png`,o[0]);else{let e=await Promise.all(o.map(async(e,t)=>({name:`${S}-${String(t+1).padStart(2,`0`)}.png`,data:new Uint8Array(await e.arrayBuffer())})));g(`${S}.zip`,new Blob([wf(e)],{type:`application/zip`}))}}return(0,r.useEffect)(()=>{if(!f)return;let e={cancelled:!1};return y.current=e,E(f.format,e).catch(()=>{e.cancelled||c(a(`exportFailed`))}).finally(()=>{y.current===e&&(y.current=null,p(null))}),()=>{e.cancelled=!0}},[f?.id]),(0,i.jsxs)(`span`,{className:`aha-menuAnchor`,children:[f?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(Rl,{label:a(`exportingBoard`,{done:f.done,total:f.total||`…`})}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":n??void 0,"data-size":`sm`,onClick:T,children:a(`cancel`)})]}):(0,i.jsxs)(`button`,{type:`button`,className:`aha-btn`,"data-kind":n??void 0,"data-size":`sm`,disabled:!e?.length,"aria-haspopup":`menu`,"aria-expanded":u,onClick:()=>d(e=>!e),children:[a(`exportBoard`),` ▾`]}),u?(0,i.jsxs)(`div`,{className:`aha-card aha-menu`,role:`menu`,onMouseLeave:()=>d(!1),children:[(0,i.jsx)(`button`,{type:`button`,role:`menuitem`,className:`aha-btn`,"data-kind":`ghost`,onClick:()=>C(`pdf`),children:a(`exportPdf`)}),(0,i.jsx)(`button`,{type:`button`,role:`menuitem`,className:`aha-btn`,"data-kind":`ghost`,onClick:()=>C(`png`),children:a(`exportPng`)}),(0,i.jsx)(`button`,{type:`button`,role:`menuitem`,className:`aha-btn`,"data-kind":`ghost`,onClick:()=>C(`md`),children:a(`exportMarkdown`)})]}):null,f?(0,o.createPortal)((0,i.jsx)(`div`,{ref:_,className:`aha-exportPages`,"aria-hidden":`true`,children:(0,i.jsx)(Ol,{steps:e,title:t,theme:b,font:x,footer:{left:t,right:`${a(`appName`)} · ${a(`appTagline`)}`},animationLabel:a(`animationStill`),fixedLabel:a(`fixed`)})}),document.body):null]})}let Df=Object.freeze([Object.freeze({family:`Aha Hand Latin`,file:`caveat-latin-d0b7b931.woff2`,bytes:48836,unicodeRange:`U+0,U+D,U+20-7E,U+A0-FF,U+131,U+152-153,U+20AC,U+2122`}),Object.freeze({family:`Aha Hand`,file:`wenkai-gb-0-88f1a875.woff2`,bytes:93632,unicodeRange:`U+20-7E,U+A0-AC,U+AE-FF,U+101,U+113,U+11B,U+12B,U+14D,U+16B,U+1CE,U+1D0,U+1D2,U+1D4,U+1D6,U+1D8,U+1DA,U+1DC,U+2C7,U+2C9,U+391-3A1,U+3A3-3A9,U+3B1-3C1,U+3C3-3C9,U+401,U+410-44F,U+451,U+2010-2016,U+2018-2022,U+2025-2027,U+2030-2037,U+2039-203F,U+2042,U+2044,U+2047-2049,U+2051-2052,U+205A,U+205D,U+2100-2101,U+2103,U+2105-2106,U+2109-210A,U+210E-210F,U+2113,U+2116-2117,U+211E,U+2120-2122,U+2126-2127,U+2129-212B,U+212E,U+2132,U+2135,U+213B,U+2141-2144,U+214B,U+214D-214E,U+2150-218B,U+2190-2199,U+21B6-21B9,U+21C4-21C6,U+21CB-21D0,U+21D2,U+21D4,U+21E6-21EA,U+21F5,U+2200-220D,U+220F,U+2211-2213,U+2215-2216,U+2219-2220,U+2223-2230,U+2234-2237,U+223C-223E,U+2242-2243,U+2245,U+2248,U+224B-224C,U+2251-2253,U+225C,U+2260-2262,U+2264-226B,U+226E-226F,U+2272-2273,U+2276-2277,U+2282-228B,U+2295-2299,U+229C-229E,U+22A0,U+22A2-22A5,U+22BF-22C5,U+22DA-22DB,U+22EE-22F1,U+2312,U+2460-249F,U+2500-25AB,U+25B1-25B3,U+25B6-25B7,U+25BC-25BD,U+25C0-25C1,U+25C6-25C7,U+25C9-25CC,U+25CE-25D3,U+25E2-25E6,U+25EF,U+25FB-25FC,U+2605-2606,U+2640,U+2642,U+3000-302D,U+3030,U+3033-303F,U+3041-3093,U+30A1-30F6,U+30FB,U+3105-3129,U+3220-3229,U+FF01-FF5E,U+FFE0-FFE1,U+FFE3,U+FFE5`}),Object.freeze({family:`Aha Hand`,file:`wenkai-gb-1-78a38e72.woff2`,bytes:315108,unicodeRange:`U+4E01,U+4E0D,U+4E11,U+4E19,U+4E1B-4E1C,U+4E22,U+4E2A,U+4E30,U+4E32,U+4E39,U+4E4E-4E4F,U+4E56,U+4E58,U+4E8C,U+4E92,U+4EA4-4EA5,U+4EA7-4EA8,U+4EC7,U+4ECE,U+4ED3,U+4ED8,U+4EE3,U+4EF6-4EF7,U+4EFD,U+4EFF,U+4F0E-4F10,U+4F19-4F1A,U+4F20,U+4F2F-4F30,U+4F34,U+4F43,U+4F46,U+4F4E,U+4F55,U+4F5B,U+4F70,U+4F73,U+4F88,U+4F97,U+4F9B,U+4FA7,U+4FAF,U+4FBF,U+4FC3-4FC4,U+4FD8,U+4FDD,U+4FED,U+4FEF,U+4FFA,U+500D,U+5012,U+5019,U+5021,U+5047,U+5065,U+507F,U+5085,U+508D,U+50A3,U+50A8,U+50AC,U+50B2,U+50F5,U+513F,U+5145,U+5149,U+5151,U+515A,U+515C,U+516B-516C,U+5171,U+5173,U+5175,U+5178,U+517C,U+5180,U+5188,U+518C,U+51A0,U+51AC,U+51AF-51B0,U+51B2,U+51BB,U+51CB,U+51CF,U+51D1,U+51E0-51E1,U+51E4,U+51F0,U+51F3,U+51F9-51FB,U+51FD,U+5200-5201,U+5206,U+5212,U+521A-521B,U+521D,U+522B,U+522E,U+5230,U+523A,U+523D,U+5241-5242,U+5250-5251,U+5265,U+526A,U+526F,U+5272,U+529E-52A0,U+52A8,U+52C3,U+52FE,U+5305-5306,U+5316-5317,U+5319,U+5320,U+532A,U+5349-534A,U+534E,U+5351,U+5355,U+535A,U+535C,U+535E,U+5373,U+5382,U+5384,U+5395,U+539A,U+53A8,U+53C2,U+53C9-53CA,U+53CD,U+53D1,U+53D8,U+53E0,U+53E4,U+53ED-53EE,U+53F7,U+53FC,U+5403-5404,U+5408-540A,U+540E,U+5420,U+5426-5429,U+542B,U+5435,U+5439,U+543C,U+5446,U+5448,U+544A,U+5475,U+547C,U+548C,U+5490,U+5495,U+54C0,U+54C4,U+54C6,U+54C8,U+54CE,U+54D7,U+54E5,U+54FA,U+54FC,U+5507,U+5509,U+5524,U+552C,U+5531,U+554A,U+5561,U+5589-558A,U+5598,U+559D,U+5609,U+560E,U+5632,U+563F,U+5676,U+568E,U+56DE,U+56E4,U+56F1,U+56FA,U+56FD,U+572D,U+5730,U+573A,U+573E,U+574A,U+574F,U+575A,U+575D,U+575F,U+5782,U+579B,U+57A2,U+57AB,U+57C2-57C3,U+57CE,U+57E0,U+57FA,U+5806,U+5815,U+5821,U+5824,U+5835,U+58A9,U+58C1,U+58D5,U+58F6,U+5904,U+5907,U+590D,U+591A,U+591F,U+5927,U+592B,U+592F,U+5939-593A,U+5949,U+594B,U+5954,U+5956,U+5960,U+5965,U+5978,U+597D,U+5987,U+5992-5993,U+59A8,U+59D1,U+59DC,U+59EC,U+5A25,U+5A5A,U+5AC1,U+5AC9,U+5AE1,U+5B58,U+5B63-5B64,U+5B69,U+5B75,U+5B89,U+5B8F,U+5B98,U+5B9A,U+5B9D,U+5BA0,U+5BA6,U+5BAB,U+5BB3,U+5BB6,U+5BBE,U+5BC2,U+5BC4,U+5BCC,U+5BD2,U+5BDF,U+5BE1,U+5BF8-5BF9,U+5BFC,U+5C01,U+5C06,U+5C14,U+5C16,U+5C18,U+5C1D,U+5C3A,U+5C42,U+5C94,U+5C97,U+5C9B,U+5CB8,U+5CE8,U+5CF0,U+5D07,U+5D14,U+5D29,U+5DDD,U+5DE2,U+5DE5,U+5DE9,U+5DEE,U+5DF1,U+5DF4,U+5E01,U+5E03,U+5E06,U+5E1B,U+5E1D,U+5E26,U+5E2E,U+5E38,U+5E45,U+5E4C,U+5E62,U+5E72,U+5E76,U+5E7B,U+5E7F,U+5E87,U+5E8A,U+5E95,U+5E97,U+5E9A,U+5E9C,U+5E9F,U+5EA6,U+5EFA,U+5F0A,U+5F13,U+5F17-5F18,U+5F1B,U+5F1F,U+5F27,U+5F39,U+5F52-5F53,U+5F69-5F6A,U+5F6C,U+5F7B-5F7C,U+5F85,U+5F88,U+5F8A,U+5F97,U+5FB7,U+5FBD,U+5FC5,U+5FCC,U+5FF1,U+5FFD,U+5FFF-6000,U+6016,U+6020,U+6025,U+602A,U+604D,U+6052,U+6062,U+6068-6069,U+606B,U+606D,U+6076,U+608D,U+6094,U+60A3,U+60B2,U+60B8,U+60BC,U+60D1,U+60E0,U+60E6,U+60E8-60E9,U+60EB,U+60ED-60F0,U+60F6,U+6101,U+611F,U+6124,U+6148,U+614C,U+6167,U+618B,U+61A8,U+61BE,U+61C2,U+61CA,U+6208,U+6210,U+6216,U+6233-6234,U+6237,U+623F,U+6241,U+624D,U+6252-6253,U+626E-626F,U+6273,U+6276,U+627C,U+627F-6280,U+6284,U+628A,U+6296,U+629A,U+62A4-62A5,U+62B1,U+62B5,U+62BD,U+62C2,U+62C5-62C6,U+62CC,U+62D0,U+62D4,U+62DC,U+62E3,U+62E8,U+62F1,U+6301-6302,U+6309,U+6321,U+6324-6325,U+6328,U+632B,U+634C-634D,U+6355,U+6361-6363,U+6376,U+6382,U+6387,U+6389,U+63A3,U+63AA,U+63B8,U+63BA,U+63D2,U+63E3,U+6400-6401,U+640F-6410,U+6413,U+641E,U+642C-642D,U+643D,U+6446,U+6448,U+6467,U+6491,U+64A4,U+64AD-64AE,U+64BC,U+64CD,U+64E6,U+6539,U+653B,U+653E,U+6545,U+654C,U+6556,U+655D-655E,U+6562,U+6566,U+6577,U+658C,U+6591,U+6597,U+65A5,U+65A7,U+65AD,U+65B9,U+65E2,U+65E6,U+65F1,U+6602,U+660C,U+660F,U+6625,U+6643,U+6666,U+6668,U+6697,U+66B4,U+66F4,U+66F9,U+670D,U+671D,U+672C,U+6735,U+673A,U+6746,U+6750-6751,U+675C,U+6760,U+676D,U+676F,U+677F,U+6781,U+6784,U+679C,U+67AB,U+67B6-67B7,U+67C4,U+67CF,U+67D1,U+67DC,U+67E5,U+67EC,U+67F4,U+6807,U+680B,U+6838-6839,U+683C,U+6842,U+6848,U+6853,U+6863,U+6868,U+6886,U+6897,U+68C0,U+68CD,U+68D2,U+68D8,U+68FA,U+6912,U+693D,U+693F,U+695A,U+6982,U+699C,U+69D0,U+69DB,U+69FD,U+6A0A,U+6A2A,U+6A59,U+6A71,U+6B21-6B22,U+6B4C,U+6B64-6B65,U+6B79,U+6B7C,U+6B86,U+6B8B,U+6BB5,U+6BBF,U+6BC1,U+6BD2,U+6BD4-6BD6,U+6BD9,U+6BEB,U+6C1B,U+6C1F,U+6C26,U+6C28,U+6C2E,U+6C47,U+6C49,U+6C57,U+6C5E-6C60,U+6C72,U+6C7E,U+6C89,U+6C9F,U+6CA7,U+6CAA,U+6CB3,U+6CB8,U+6CBD,U+6CCA,U+6CD5,U+6CDB,U+6CE2,U+6CF5,U+6D1E,U+6D2A,U+6D31,U+6D3B,U+6D46-6D47,U+6D4B,U+6D4E,U+6D51,U+6D69,U+6D6E,U+6D77,U+6DA3-6DA4,U+6DA7,U+6DAA,U+6DB5,U+6DB8,U+6DC0,U+6DE1,U+6DEC,U+6DEE,U+6DF3,U+6DF7,U+6E10,U+6E21,U+6E24,U+6E2F,U+6E56,U+6E85,U+6E89,U+6EC1,U+6EC7,U+6ED1,U+6EDA,U+6EE8,U+6EF4,U+6F6E,U+6F84,U+6F88,U+6FB3,U+6FC0,U+6FD2,U+704C,U+706B,U+706F-7070,U+707F,U+708A,U+7092,U+70B3,U+70B9,U+70BD,U+70D8,U+70E6,U+70E9,U+70FD,U+710A,U+7115,U+7119-711A,U+7126,U+714C,U+714E,U+71AC,U+7206,U+7231,U+7236,U+7238-7239,U+7248,U+728A,U+72AF,U+72C4,U+72C8,U+72D0,U+72D7,U+72E0,U+72EC,U+7316,U+731C,U+7334,U+733E,U+73AF,U+73BB,U+73D0,U+73ED,U+745A,U+7470,U+74DC,U+74E3,U+74F7,U+7518,U+752B,U+752D,U+7532,U+7535,U+7538,U+753B,U+7545,U+756A,U+7574,U+7578,U+7586,U+7599,U+75A4,U+75AE-75AF,U+75B5,U+75BE,U+75C5,U+75D5,U+75D8,U+75EA,U+75F4,U+75F9,U+7601,U+7629-762A,U+764C,U+7678,U+767B,U+767D-767E,U+7684,U+7687,U+768B,U+7691,U+76CE,U+76D1-76D2,U+76D6-76D7,U+76EF,U+76FE,U+7763,U+776C,U+7779,U+7785,U+77AA,U+77D7,U+77ED-77EE,U+77FE,U+7840,U+7845,U+7877,U+7889,U+788D,U+7891,U+7898,U+789F,U+78A7,U+78B1,U+78B4,U+78C1,U+78C5,U+78CB,U+78FA,U+7901,U+796D,U+7977-7978,U+798F,U+79BE,U+79C6,U+79C9,U+79E4,U+79EF-79F0,U+79FD,U+7A0B,U+7A17,U+7A20,U+7A3B-7A3D,U+7A3F,U+7A7F,U+7A97,U+7A9C,U+7AEF,U+7AFF,U+7B06,U+7B14,U+7B1B,U+7B26,U+7B28,U+7B2C,U+7B3A,U+7B49,U+7B4F,U+7B54,U+7B56,U+7B79,U+7B80,U+7B8D,U+7B94-7B95,U+7BA1,U+7BAD,U+7BD9,U+7BE1,U+7C07,U+7C27,U+7C3F,U+7C4D,U+7C89,U+7C97,U+7CAA,U+7CB9,U+7CCA,U+7CD5,U+7CD9,U+7E41,U+7EA2,U+7EA7,U+7EAA,U+7EAF,U+7EB2,U+7EB7,U+7EBA,U+7ECA,U+7ED1,U+7ED8-7ED9,U+7EE7,U+7EE9,U+7EF0,U+7EF7-7EF8,U+7F04,U+7F09,U+7F0E,U+7F13-7F14,U+7F16,U+7F1A,U+7F1D,U+7F20,U+7F38,U+7F50,U+7F55,U+7F5A,U+7F62,U+7F94,U+7FB9,U+7FC5,U+7FDF-7FE0,U+7FF0-7FF1,U+7FFB,U+800C,U+8015,U+8017,U+8019,U+8033,U+803B,U+803D,U+803F,U+806A,U+808C,U+809A-809B,U+809D,U+80A0-80A1,U+80A4-80A5,U+80A9-80AA,U+80AE,U+80BA,U+80C6,U+80CC,U+80DE,U+80E1,U+80F3,U+80F6,U+80FA,U+8106,U+810A,U+8116,U+812F,U+8150-8151,U+8179,U+8180,U+818A,U+818F,U+8198,U+81C2,U+81E3,U+81ED,U+822A,U+822C,U+8230-8231,U+8235-8236,U+8239,U+8270,U+827E,U+82AC-82AD,U+82B1,U+82B3,U+82CD,U+82DE-82DF,U+82EF,U+8303,U+8327-8328,U+832C,U+8336,U+8349,U+8350,U+8352,U+835A,U+8361,U+8364,U+8377,U+83B7,U+83C7,U+83CF,U+83DC,U+83E0,U+83F2,U+845B,U+8463,U+846B,U+8471,U+8482,U+848B,U+84D6,U+84DF,U+8521,U+853C-853D,U+8549,U+8584,U+85CF,U+85E9,U+864E,U+866B,U+8679,U+868C,U+8695,U+86CA-86CB,U+86D4,U+86E4,U+86FE,U+8702,U+8749,U+8757,U+8774,U+8776,U+8822,U+8861,U+8865,U+8868,U+886C,U+8884,U+888B,U+88AB,U+88B1,U+88C1,U+88F9,U+8902,U+8910,U+8912,U+8986,U+89C1-89C2,U+89C4,U+89E6,U+8BA1-8BA3,U+8BA5,U+8BB0,U+8BB2-8BB3,U+8BB9,U+8BBD,U+8BBF,U+8BCD,U+8BDA,U+8BDD-8BDE,U+8BE1,U+8BE5,U+8BE7,U+8BF2,U+8BFB,U+8BFD,U+8C03,U+8C0D-8C0E,U+8C17,U+8C24,U+8C37,U+8C41,U+8C46,U+8C62,U+8C6A,U+8C79-8C7A,U+8C89,U+8D1D,U+8D1F,U+8D21-8D22,U+8D25,U+8D27,U+8D29,U+8D2C-8D2D,U+8D2F-8D31,U+8D35,U+8D37,U+8D39-8D3A,U+8D3E-8D3F,U+8D4B-8D4C,U+8D50,U+8D63-8D64,U+8D6B,U+8D74,U+8D76,U+8D81,U+8D85,U+8DCB-8DCC,U+8DDF,U+8DEA,U+8DF5,U+8DFA,U+8E0C,U+8E29,U+8E48,U+8E66,U+8E6C-8E6D,U+8E72,U+8E7F,U+8E87,U+8EAC,U+8EB2,U+8F66,U+8F68,U+8F70,U+8F85,U+8F88-8F8A,U+8F90-8F91,U+8F9C,U+8F9E-8F9F,U+8FA8-8FA9,U+8FAB,U+8FB0,U+8FB9,U+8FBE,U+8FC7,U+8FD4,U+8FD8,U+8FDF,U+8FEA,U+8FED,U+8FF8-8FF9,U+9012,U+9017,U+901B,U+901E,U+9022,U+902E,U+903C,U+9041,U+904D,U+904F,U+9053,U+907F,U+9093,U+90A6,U+90AF,U+90CA,U+90DD,U+90E8,U+90ED,U+90F4,U+90F8,U+90FD,U+9102,U+9119,U+915A,U+9163,U+916C,U+9171,U+9187,U+918B,U+91C7,U+91DC,U+9274,U+9489,U+9492-9493,U+9499,U+949D-949E,U+94A1-94A2,U+94A9,U+94B5,U+94BE,U+94C2,U+94EC,U+94F2,U+9504-9505,U+950B,U+9519,U+9524,U+952D-952E,U+953B,U+9540,U+9550-9551,U+957F,U+95ED,U+95EF,U+95F4,U+95FA,U+9600-9602,U+9610,U+961C,U+961F,U+9632,U+963F,U+9644-9645,U+9648,U+964D,U+965B,U+9661,U+9664,U+9694,U+9698,U+96C6-96C7,U+96CC,U+96CF,U+96D5,U+96F9,U+970D,U+9738,U+975B,U+975E,U+9769,U+9776,U+978D,U+97AD,U+97E9,U+9876,U+987E-987F,U+9881,U+988A,U+989D,U+98A0,U+98A4,U+98CE,U+98DE,U+9910,U+9965,U+996D,U+996F,U+9971,U+9975,U+997C,U+997F,U+9986,U+998B,U+9A70,U+9A73,U+9A7E,U+9A84,U+9A87,U+9A8B,U+9AA8,U+9AB8,U+9AD8,U+9B3C,U+9B42,U+9C8D,U+9CD6,U+9E21,U+9E3D,U+9E3F,U+9E45,U+9E64,U+9EC4,U+9ED1,U+9F0E,U+9F13,U+9F3B,U+9F7F,U+9F9A,U+9F9F`}),Object.freeze({family:`Aha Hand`,file:`wenkai-gb-2-2a649892.woff2`,bytes:317648,unicodeRange:`U+4E03,U+4E09-4E0A,U+4E14,U+4E16,U+4E18,U+4E24,U+4E27,U+4E34,U+4E3D-4E3E,U+4E43,U+4E45,U+4E48,U+4E50,U+4E52-4E54,U+4E5D-4E5E,U+4E70-4E71,U+4E73,U+4E7E,U+4E86,U+4E8B,U+4E8F,U+4E95,U+4EA2,U+4EA9,U+4EAC,U+4EAE,U+4EB2,U+4EBA,U+4EC0-4EC1,U+4EC5-4EC6,U+4ECA-4ECB,U+4ECD,U+4ED1,U+4ED5,U+4EDF,U+4EE4,U+4EEC,U+4EFB,U+4F01,U+4F1E,U+4F24,U+4F26,U+4F36,U+4F38,U+4F60,U+4F69,U+4F6C,U+4F7F,U+4F8B,U+4F8D,U+4FA3,U+4FA5,U+4FA8-4FA9,U+4FB5,U+4FCA,U+4FCF-4FD0,U+4FE9,U+4FF1,U+5014,U+501F,U+5026,U+502A,U+503E,U+504F,U+5076,U+5080,U+5088,U+50BB,U+50DA,U+50E7,U+50FB,U+5112,U+5121,U+514B,U+514D,U+5162,U+5165,U+5168,U+516D,U+5170,U+5176-5177,U+5185,U+5189,U+5192,U+5195,U+5197,U+519B-519C,U+51B3,U+51B5,U+51B7,U+51C0,U+51C4,U+51C9,U+51CC,U+51DB,U+51DD,U+51ED,U+51EF,U+5203,U+5207,U+520A,U+5217-5218,U+5220,U+5224,U+5228-5229,U+5238-5239,U+523B,U+524D,U+5256,U+5267,U+5269,U+527F,U+5288,U+529B,U+529D,U+52A3,U+52AA-52AB,U+52B1-52B3,U+52BF,U+52C9,U+52D2,U+52D8,U+52DF,U+52E4,U+52FA,U+5321,U+5339-533A,U+533F,U+5341,U+5343,U+5347,U+5356-5357,U+5361-5362,U+5364,U+536F,U+5374-5375,U+5377,U+537F,U+5386,U+5389,U+5398,U+53A9,U+53BB,U+53C1,U+53D6-53D7,U+53DB,U+53E3,U+53E5-53E6,U+53EB,U+53EF,U+53F2,U+540D,U+540F,U+5415,U+5417,U+541B,U+541D,U+542D,U+542F,U+5450,U+5455,U+545B,U+5462,U+5478,U+547B,U+547D,U+5480,U+5486,U+548E,U+5496,U+5499,U+54AF,U+54B3,U+54C1,U+54E6,U+54E8-54EA,U+54ED,U+552E,U+5543,U+5546,U+5564-5566,U+556A,U+556E,U+5580,U+5584,U+5587,U+55B7,U+55D3,U+55DC,U+561B,U+5668,U+566C,U+56B7,U+56BC,U+56CA,U+56DA,U+56F0,U+5703,U+5708,U+5723,U+5747,U+574E,U+5751,U+5757,U+5761,U+5764,U+576A,U+576F,U+5777,U+5783-5784,U+5792,U+57A6,U+57AE,U+57CB,U+57D4,U+57F9,U+5811,U+582A,U+585E,U+5883,U+5892-5893,U+5899,U+58A8,U+58E4,U+58EB-58EC,U+58F0,U+58F3,U+5931,U+5938,U+5947-5948,U+594E,U+5951,U+5962,U+5973-5974,U+5976,U+5982,U+5988,U+598A,U+5999,U+59AE,U+59B9,U+59BB,U+59C6,U+59CB,U+59D0,U+59E5,U+5A04,U+5A07,U+5A18,U+5A1C,U+5A1F-5A20,U+5A29,U+5A36,U+5A46,U+5A6A,U+5A76,U+5A92,U+5A9A,U+5AC2,U+5AE9,U+5B54,U+5B5F,U+5B6A,U+5B7A,U+5B7D,U+5B81,U+5B88,U+5B9E,U+5BA1-5BA2,U+5BA4,U+5BB9,U+5BBD,U+5BC6-5BC7,U+5BD0,U+5BDD-5BDE,U+5BE5,U+5BFF,U+5C04,U+5C11,U+5C1A,U+5C31,U+5C38,U+5C3C-5C3D,U+5C3F-5C41,U+5C45,U+5C48,U+5C4A,U+5C4E-5C4F,U+5C61,U+5C65,U+5C71,U+5C82,U+5CAD,U+5CBF,U+5CE6,U+5CED,U+5CFB,U+5D0E,U+5D4C,U+5DE7-5DE8,U+5DFE,U+5E02,U+5E08,U+5E15,U+5E18,U+5E3D,U+5E42,U+5E55,U+5E73-5E74,U+5E86,U+5E90,U+5E93,U+5E99,U+5E9E,U+5EB7,U+5EC9-5ECA,U+5ED3,U+5ED6,U+5F00,U+5F03-5F04,U+5F0F,U+5F25,U+5F31,U+5F3A,U+5F55,U+5F6D,U+5F84,U+5F8B,U+5F98,U+5FCD,U+5FD9,U+5FEB,U+5FF5,U+6012,U+6015,U+601C,U+602F,U+6043,U+604B,U+6050,U+6070,U+6073,U+607C,U+6084,U+60A8,U+60AF,U+60C5,U+60CA,U+60E7,U+60F9,U+6127,U+614E,U+6151,U+6155,U+6162,U+6168,U+6177,U+61D2,U+61E6,U+620E,U+6212,U+621A,U+622A,U+622E,U+6247,U+624B,U+6251,U+6254,U+625B,U+6263,U+6266,U+6269,U+626B,U+626D,U+6270,U+6279,U+6289,U+6297,U+629B,U+62A0-62A2,U+62A8,U+62AB,U+62B9,U+62BF,U+62C7-62C9,U+62CD-62CE,U+62D2,U+62D8,U+62DF,U+62E2,U+62E6-62E7,U+62EC-62ED,U+62F3,U+62F7,U+62FC,U+62FE-62FF,U+630E,U+631B,U+6320,U+632A,U+6346,U+634E-6350,U+635E,U+6367,U+636E,U+6377,U+637B,U+6388,U+6390,U+6392,U+6398,U+63A0,U+63A5,U+63A7,U+63B3,U+63C9,U+63CF,U+63E9-63EA,U+63ED,U+63FD,U+6402,U+6405,U+6414,U+6444,U+6469,U+6478-6479,U+6482,U+6485,U+6487,U+6492,U+64A9,U+64AC,U+64B5,U+64C2,U+64C5,U+64CE,U+64D2,U+6500,U+6518,U+652B,U+6536,U+654F,U+6551,U+6559,U+655B,U+6563,U+656C,U+6572,U+6599,U+65A4,U+65BD,U+65C1,U+65C5,U+65D7,U+65E5,U+65E7,U+65F6-65F7,U+6606,U+660E,U+6627,U+662F,U+664B-664C,U+6652,U+666E-666F,U+6674,U+6676,U+667E,U+6696,U+66AE,U+66DD,U+66F2,U+66FC,U+670B,U+6717,U+671F,U+6728,U+672B,U+6734,U+6740,U+6743,U+6749,U+674E,U+6765,U+6770,U+6797,U+679A,U+67AA,U+67AF,U+67D0,U+67D2-67D4,U+67E0,U+67EF,U+67F3,U+67FF,U+680F,U+6816-6817,U+6846,U+6851,U+6854,U+6865,U+6881,U+6885,U+68A2,U+68A6,U+68A8,U+68C9,U+68CB,U+68DA,U+68EE,U+68F1,U+68F5,U+695E,U+6977,U+697C,U+6994,U+69B4,U+69B7,U+6A21,U+6A47,U+6AAC,U+6B20,U+6B27,U+6B3A,U+6B3E,U+6B49,U+6B67,U+6BB4,U+6BCD,U+6BCF,U+6BD7,U+6BDB,U+6C0F,U+6C11,U+6C13-6C14,U+6C16,U+6C22,U+6C2F-6C30,U+6C42,U+6C55,U+6C5D,U+6C7D,U+6C81,U+6C88,U+6C8F,U+6C99,U+6C9B,U+6CA1,U+6CA4-6CA6,U+6CAB,U+6CAE,U+6CC5,U+6CC9,U+6CCC,U+6CDE,U+6CE1,U+6CE3,U+6CE5,U+6CEA,U+6CFC,U+6D01,U+6D12,U+6D1B,U+6D25,U+6D3D-6D3E,U+6D41,U+6D45,U+6D53,U+6D5A,U+6D66,U+6D6A,U+6D78,U+6D85,U+6D89,U+6D9D,U+6D9F,U+6DA6,U+6DA9,U+6DCB,U+6DD6,U+6DF1,U+6E05,U+6E17,U+6E20,U+6E34,U+6E3A,U+6E43,U+6E7F,U+6E83,U+6E9C,U+6EB6,U+6EBA,U+6EE1,U+6EE4-6EE6,U+6F02,U+6F06,U+6F0F,U+6F13,U+6F20,U+6F2B,U+6F58,U+6F5C,U+6F5E,U+6F66,U+6F8E,U+6F9C,U+7011,U+706D,U+7075,U+7078,U+7089,U+7094-7095,U+70AC,U+70AE-70AF,U+70BC,U+70C2,U+70C8,U+70D9,U+70E4,U+70E7,U+70EC-70ED,U+70F9,U+7136,U+715E,U+7164,U+717D,U+7194,U+71C3,U+71CE,U+722C,U+7235,U+7247,U+724C,U+725B,U+725F,U+7261-7262,U+7267,U+7272,U+7275,U+7281,U+72AC,U+72C2,U+72D9,U+72DE,U+72E1,U+72EE,U+72F8,U+72FC,U+730E,U+731B,U+732B,U+7387,U+7396,U+739B,U+73AB,U+73B2,U+73CA,U+7403,U+7405-7406,U+7409,U+7433-7436,U+743C,U+745E-745F,U+7483,U+74E2,U+74E4,U+74F6,U+751A,U+751F,U+7525,U+7533,U+7537,U+754C,U+7554,U+7559,U+7565-7566,U+7597,U+759A,U+759F,U+75A5,U+75B2,U+75BD,U+75C9-75CA,U+75DE,U+75E2,U+7624,U+7638,U+7686,U+76AE,U+76BF,U+76C6,U+76D4,U+76D8,U+76DB,U+76DF,U+76EE,U+76F2,U+76FC,U+7701,U+7709,U+770B,U+7720,U+772F,U+7736-7737,U+775B,U+7766,U+776B,U+7784,U+7792,U+77A5,U+77A7,U+77DB,U+77E2,U+77E9,U+77EB,U+77F3,U+77FF,U+7801-7802,U+780C-780D,U+7812,U+7830,U+7834,U+7837,U+783E,U+786B,U+786E,U+787C,U+788C,U+78B0,U+78BE,U+78CA,U+78D0,U+78D5,U+78E8,U+78F7,U+793A,U+793C,U+793E,U+7941,U+7948,U+795E,U+7968,U+7981,U+7984,U+79BB,U+79BD,U+79CB,U+79D1-79D2,U+79D8,U+79E6,U+79F8,U+7A0D,U+7A46,U+7A76-7A77,U+7A7A,U+7A83,U+7A8D,U+7A96,U+7A98,U+7A9F,U+7AA5,U+7ABF,U+7ACB,U+7ADE-7ADF,U+7AE3,U+7AED,U+7B3C,U+7B4B,U+7B50,U+7B5B,U+7B77,U+7B7E,U+7BA9,U+7BC7,U+7BD3,U+7BEE,U+7BF1,U+7BF7,U+7C73,U+7C7B,U+7C92,U+7C95,U+7CAE,U+7CB1,U+7CB3,U+7CBE,U+7CDC,U+7CE0,U+7CEF,U+7D27,U+7D2F,U+7EA0,U+7EAB,U+7EB1,U+7EB3,U+7EB6,U+7EBD,U+7EC3,U+7EC5,U+7ECD,U+7ECF,U+7ED2-7ED3,U+7ED5,U+7EDC-7EDE,U+7EE2,U+7EF3,U+7EF5,U+7EFF,U+7F05-7F06,U+7F15,U+7F2E,U+7F34,U+7F3A,U+7F57,U+7F8C,U+7F8E,U+7F9A,U+7FA4,U+7FD8,U+8001,U+8003,U+8010,U+802A,U+8042,U+804A-804B,U+8054,U+8058,U+805A,U+8089,U+808B,U+80AF,U+80BE,U+80D6,U+80DA,U+80DC,U+80EF,U+80FD,U+8109,U+8110-8111,U+8113,U+811A,U+8138,U+813E,U+814A,U+8154,U+816E,U+817B,U+819C,U+81A8,U+81B3,U+81FC,U+8205,U+820C-820D,U+826F,U+8272,U+8282,U+828D,U+8292,U+82A5-82A6,U+82B9,U+82D7,U+82DB,U+82E5-82E6,U+82EB,U+82F9,U+8302,U+8304-8305,U+830E,U+832B,U+8338-8339,U+8346,U+8354,U+8363,U+8386,U+8389,U+838E,U+83AB,U+83B1-83B2,U+83BD,U+83CA,U+83CC,U+83E9,U+83F1,U+840C-840D,U+841D,U+8428,U+843D,U+8461,U+8475,U+8499,U+84B2,U+84C9,U+84DD,U+84EC,U+8511,U+8513,U+852B,U+8537,U+854A,U+857E,U+85C9,U+85D0,U+85D5,U+8611,U+864F-8651,U+8671,U+8680,U+8682,U+86C6-86C7,U+86EE,U+871C,U+8721,U+878D,U+879F,U+87BA,U+8815,U+8857,U+886B,U+888D,U+88C2,U+88D9,U+88E4,U+88F3-88F4,U+88F8,U+8925,U+895F,U+89C5-89C6,U+89C8-89C9,U+89D2,U+89E3,U+8A93,U+8B66,U+8B6C,U+8BA4,U+8BA9,U+8BAB,U+8BBA,U+8BBE,U+8BC0,U+8BC4,U+8BC6,U+8BD5,U+8BD7,U+8BEB,U+8BF7,U+8BFA,U+8BFE,U+8C05,U+8C0B,U+8C1C,U+8C26,U+8C28-8C29,U+8C2C,U+8C30-8C31,U+8C34,U+8C8C,U+8D2B,U+8D38,U+8D41-8D42,U+8D4A,U+8D4F,U+8D54,U+8D56,U+8D5B,U+8D61,U+8D66,U+8D77,U+8D8B,U+8DA3,U+8DB4,U+8DD1,U+8DDD,U+8DE8,U+8DEF,U+8E1E,U+8EAB,U+8EAF,U+8F6E-8F6F,U+8F7B,U+8F7F,U+8F83,U+8F86,U+8FA3,U+8FB1,U+8FBD,U+8FC1,U+8FC4,U+8FC8,U+8FD1,U+8FDB,U+8FDE,U+8FEB,U+8FF7,U+9002,U+9006,U+901D,U+903B,U+9063,U+90A3,U+90B1,U+90B5,U+90BB,U+90CE,U+90E1,U+914B,U+914D,U+9152,U+916A,U+9175-9177,U+917F,U+919A-919B,U+91CA,U+91CC,U+91CF,U+91D1,U+948E,U+94A0,U+94A6-94A7,U+94AE,U+94B1,U+94B3,U+94C3,U+94C5-94C6,U+94DD,U+94ED,U+94F0,U+94FA,U+94FE,U+9510,U+951A,U+9523,U+9526,U+952F-9530,U+9539,U+9541,U+954A,U+954D,U+955C,U+9563,U+956D,U+9570,U+95E8,U+95EA,U+95F0,U+95F7,U+95F9,U+95FD,U+9611,U+9614,U+962E,U+9636,U+9646-9647,U+964B-964C,U+9655,U+966A,U+9675,U+9686,U+96B6,U+96BE,U+96C0,U+96F6-96F7,U+9709,U+9713,U+9716,U+9732,U+9739,U+9752,U+9756,U+9759,U+9760-9762,U+9773,U+9798,U+97A0,U+97E7,U+97ED,U+97F6,U+9877,U+9885-9888,U+9891,U+9897,U+98A7,U+98D8,U+98DF,U+9970,U+9976,U+997A,U+9981,U+9988,U+998F,U+9992,U+9996,U+9A6C,U+9A71,U+9A74,U+9A76,U+9A79,U+9A82,U+9A86,U+9A8F,U+9A91,U+9A97,U+9A9A,U+9AA1,U+9B41,U+9B44,U+9B54,U+9C81,U+9CA4,U+9CB8,U+9CC3,U+9CDE,U+9E1F,U+9E23,U+9E25,U+9E43,U+9E4A,U+9E4F,U+9E7F,U+9E93,U+9EA6,U+9EBB,U+9ECE,U+9ED4,U+9ED8,U+9F50,U+9F84,U+9F8B,U+9F99`}),Object.freeze({family:`Aha Hand`,file:`wenkai-gb-3-6949c050.woff2`,bytes:311704,unicodeRange:`U+4E00,U+4E07-4E08,U+4E0B,U+4E0E,U+4E13,U+4E1A,U+4E1D,U+4E25,U+4E2B,U+4E2D,U+4E38,U+4E3A-4E3B,U+4E49,U+4E4B-4E4D,U+4E59,U+4E5F-4E61,U+4E66,U+4E88-4E89,U+4E8E,U+4E91,U+4E94,U+4E9A-4E9B,U+4EA1,U+4EA6,U+4EAB,U+4EAD,U+4EBF,U+4ED4,U+4ED6-4ED7,U+4ED9,U+4EE5,U+4EEA,U+4EF0,U+4EF2,U+4F0A,U+4F0D,U+4F11,U+4F17-4F18,U+4F1F,U+4F2A,U+4F3A,U+4F3C,U+4F4D,U+4F4F-4F51,U+4F53,U+4F59,U+4F5C,U+4F63,U+4F6F,U+4F84,U+4F9D,U+4FA0,U+4FA6,U+4FAE,U+4FD7,U+4FDE,U+4FE1,U+4FEE,U+5018,U+501A,U+503A,U+503C,U+505A,U+505C,U+5077,U+50CF,U+50F3,U+5141,U+5143-5144,U+5146,U+5148,U+5154,U+5174,U+5179,U+517B,U+517D,U+518D,U+5199,U+51A4,U+51B6,U+51C6,U+51F6,U+51F8,U+51FF,U+5211,U+5219,U+5236-5237,U+5243,U+524A,U+5254,U+52A1,U+52A9,U+52C7,U+52CB,U+52FF-5300,U+5308,U+531D,U+5323,U+533B,U+5348,U+534F,U+5352-5353,U+5360,U+5367,U+536B,U+5370-5371,U+5378,U+5385,U+538B-538C,U+539F,U+53A2,U+53A6,U+53BF,U+53C8,U+53CB-53CC,U+53D4,U+53D9,U+53EA,U+53EC,U+53F0,U+53F3,U+53F6,U+53F8-53F9,U+5401,U+540C,U+5410-5411,U+5413,U+541E-541F,U+542C,U+542E,U+5431,U+5434,U+5438,U+543B,U+543E,U+5440,U+5458,U+545C,U+5468,U+5473,U+548B,U+548F,U+5492,U+54A8,U+54AC,U+54B1,U+54B8,U+54BD,U+54C7,U+54C9,U+54CD,U+54D1,U+54DF,U+54EE,U+54F2,U+5501,U+5506,U+5510,U+552F,U+553E,U+5544,U+5578,U+557C,U+5582,U+559C,U+55A7,U+55B3,U+55BB,U+55C5,U+55E1,U+55E3,U+55FD,U+5618,U+5631,U+5634,U+5636,U+563B,U+564E,U+566A,U+568F,U+56A3,U+56DB,U+56E0,U+56E2,U+56ED,U+56F4,U+56FE,U+5706,U+571F,U+5728,U+5740,U+574D,U+5750,U+575B,U+575E,U+5760,U+5766,U+578B,U+57A3,U+57DF,U+5802,U+5830,U+584C,U+5851,U+5854,U+5858,U+586B,U+5885,U+589E-589F,U+58EE,U+58F9,U+590F,U+5915-5916,U+591C,U+5929-592A,U+592E,U+5934,U+5937,U+5944,U+594F,U+5957,U+5979,U+5984,U+5986,U+5996,U+59A5,U+59D3-59D4,U+59DA,U+59E8,U+59FB,U+59FF,U+5A01,U+5A03,U+5A31,U+5A49,U+5A74,U+5A7F,U+5AB3,U+5ACC,U+5B50,U+5B55,U+5B57,U+5B59,U+5B5C-5B5D,U+5B66,U+5B70,U+5B83,U+5B85,U+5B87,U+5B8B-5B8C,U+5B97,U+5B99,U+5B9B-5B9C,U+5BA3,U+5BAA,U+5BB0,U+5BB4-5BB5,U+5BBF,U+5BC5,U+5BD3,U+5BE8,U+5BFA-5BFB,U+5C09-5C0A,U+5C0F,U+5C24,U+5C27,U+5C39,U+5C3E,U+5C49,U+5C4B,U+5C51,U+5C55,U+5C5E,U+5C60,U+5C6F,U+5C79,U+5C7F,U+5C81,U+5CA9,U+5CB3,U+5CD9,U+5CE1,U+5CEA,U+5D16,U+5D2D,U+5DCD,U+5DDE,U+5DE1,U+5DE6,U+5DEB,U+5DF2-5DF3,U+5DF7,U+5E05,U+5E0C,U+5E10,U+5E16,U+5E1A,U+5E1C,U+5E27,U+5E2D,U+5E78,U+5E7C-5E7D,U+5E84,U+5E8F,U+5E94,U+5EA7,U+5EAD,U+5EB6,U+5EB8,U+5EF6-5EF7,U+5F02,U+5F15,U+5F20,U+5F26,U+5F2F,U+5F5D,U+5F62,U+5F64,U+5F66,U+5F70-5F71,U+5F79,U+5F80-5F81,U+5F90,U+5F92,U+5FA1,U+5FAA,U+5FAE,U+5FC3,U+5FC6,U+5FD7-5FD8,U+5FE0,U+5FE7,U+5FFB,U+6001-6002,U+600E,U+6014,U+601D,U+6027-6028,U+603B,U+6055,U+6064,U+606C,U+606F,U+607F,U+6089,U+609F-60A0,U+60A6,U+60AC,U+60CB,U+60D5,U+60DC,U+60DF,U+60F3,U+60FA,U+6108-6109,U+610F,U+611A,U+613F,U+6170,U+618E,U+61C8,U+620A,U+620C-620D,U+620F,U+6211,U+6218,U+6240,U+624E,U+6258,U+6267,U+626C,U+627E,U+6291-6293,U+6295,U+6298,U+62AC,U+62BC,U+62C4,U+62D3,U+62D6,U+62D9,U+62DB,U+62E5,U+62E9,U+62EF,U+62F4,U+62FD,U+6307,U+6311,U+6316,U+631A,U+631D-631F,U+6323,U+632F,U+633A,U+633D,U+6342,U+6345,U+6349,U+635F,U+6380,U+638C,U+638F,U+6396,U+63A2,U+63A8-63A9,U+63B7,U+63CD,U+63D0,U+63D6,U+63E1,U+63F4,U+641C,U+642A,U+643A,U+6447,U+644A,U+6454,U+6458,U+6495,U+649E,U+64B0,U+64DE,U+6512,U+652F,U+653F,U+6548,U+6570,U+6574,U+6587,U+658B,U+659C,U+659F,U+65A1,U+65A9,U+65AF-65B0,U+65CB,U+65CF,U+65E0,U+65E8-65E9,U+65EC-65ED,U+65FA,U+6613-6614,U+661F-6620,U+6628,U+662D,U+663C,U+663E,U+6653,U+6655,U+665A,U+6664,U+6670,U+667A,U+6682,U+6687,U+6691,U+66D9,U+66F0,U+66F3,U+66FE-6700,U+6708-6709,U+6714,U+671B,U+672A,U+672D,U+672F,U+6731,U+673D,U+6742,U+674F,U+6756,U+675F,U+6761,U+6768,U+677E,U+6789,U+6790,U+6795,U+679D,U+67A2-67A3,U+67DE,U+67F1,U+6805,U+6808,U+6811,U+6813,U+6821,U+682A,U+6837,U+683D,U+6843,U+6845,U+684C,U+6850,U+6869,U+6876,U+68A7,U+68AD,U+68AF-68B0,U+68B3,U+68D5,U+68E0,U+6905,U+690D-690E,U+692D,U+6930,U+6954,U+6986,U+69A8,U+6A1F,U+6A31,U+6A61,U+6A80,U+6A84,U+6B23,U+6B32,U+6B47,U+6B62-6B63,U+6B66,U+6B6A,U+6B7B,U+6B83,U+6B89-6B8A,U+6B96,U+6BB7,U+6BC5,U+6BCB,U+6BE1,U+6BEF,U+6C27,U+6C34,U+6C38,U+6C40-6C41,U+6C50,U+6C5B,U+6C61,U+6C64,U+6C6A,U+6C70,U+6C79,U+6C82-6C83,U+6CB9,U+6CBB-6CBC,U+6CBE-6CBF,U+6CC4,U+6CE8,U+6CF0,U+6CF3,U+6CFB,U+6CFD,U+6D0B,U+6D17,U+6D32,U+6D3C,U+6D4A,U+6D59,U+6D74,U+6D82,U+6D88,U+6D8C,U+6D8E,U+6D95,U+6D9B,U+6DA1,U+6DA8,U+6DAF,U+6DB2,U+6DC4,U+6DC6,U+6DCC,U+6DD1,U+6DD8,U+6DE4,U+6DEB,U+6DF9,U+6DFB,U+6E0A,U+6E0D,U+6E14,U+6E1D,U+6E23,U+6E29,U+6E2D,U+6E38,U+6E4D,U+6E58,U+6E5B,U+6E7E,U+6E90,U+6EA2,U+6EAA,U+6EAF,U+6ECB,U+6ED3-6ED4,U+6EDE,U+6EE9,U+6F14,U+6F31,U+6F33,U+6F3E,U+6F4D,U+6F6D,U+6FA1,U+7076,U+707C,U+707E,U+708E,U+7099,U+70AD,U+70B8,U+70C1,U+70C3,U+70DB,U+70DF,U+70EB,U+70EF,U+70F7,U+7109,U+7130,U+7167,U+716E,U+7184,U+718A,U+718F,U+7199,U+719F,U+71D5,U+71E5,U+722A,U+7237,U+723D,U+7259,U+7269,U+7279-727A,U+7280,U+72B6,U+72B9,U+72ED,U+72F0-72F1,U+7329-732A,U+732E,U+733F,U+736D,U+7384,U+7389,U+738B,U+73A9,U+73B0,U+73CD,U+73E0,U+7410,U+7422,U+7476,U+74E6,U+74EE,U+7504,U+751C,U+7528-7529,U+7530-7531,U+754F,U+755C,U+758F,U+7591,U+75A1,U+75AB,U+75B9,U+75BC,U+75C7-75C8,U+75D2,U+75D4,U+75DB,U+75F0,U+761F,U+7626,U+762B,U+7634,U+7663,U+7682,U+7696,U+76B1,U+76C2,U+76C5,U+76C8,U+76CA,U+76CF-76D0,U+76F4,U+76F8,U+771F,U+7728-7729,U+773A,U+773C,U+7740-7741,U+7761,U+778E,U+77A9,U+77AC,U+77B3,U+77BB,U+77E3,U+77E5,U+77FD,U+7814,U+7816,U+781A,U+7827,U+7838,U+7852,U+7855,U+785D,U+786C,U+788E,U+7897,U+78B3,U+7956,U+795D,U+795F,U+7965,U+79B9,U+79C0-79C1,U+79C3,U+79CD,U+79DF,U+79E7,U+79E9,U+79FB,U+7A00,U+7A0E,U+7A1A,U+7A33,U+7A57,U+7A74,U+7A81,U+7A84,U+7A91-7A92,U+7A9D,U+7AD6,U+7AD9,U+7AE0,U+7AE5,U+7AF9,U+7B0B,U+7B11,U+7B51-7B52,U+7B97,U+7BB1,U+7BC6,U+7C7D,U+7C98,U+7C9F,U+7CA4-7CA5,U+7CD6,U+7CDF,U+7CFB,U+7D0A,U+7D20,U+7D22,U+7D2B,U+7D6E,U+7E82,U+7EA4,U+7EA6,U+7EAC,U+7EB5,U+7EB8-7EB9,U+7EBF,U+7EC4,U+7EC6-7EC8,U+7ECE,U+7EDA,U+7EDF,U+7EE3,U+7EE5-7EE6,U+7EEA,U+7EED,U+7EF4,U+7EFC-7EFD,U+7F00,U+7F18,U+7F28-7F29,U+7F51,U+7F69-7F6A,U+7F6E,U+7F72,U+7F8A,U+7F9E,U+7FA1,U+7FBD,U+7FC1,U+7FCC,U+7FD4,U+7FFC,U+8000,U+8005,U+800D,U+8018,U+8036,U+8038,U+804C,U+8083-8084,U+8086-8087,U+8096,U+8098,U+80A2,U+80B2,U+80BF-80C1,U+80C3,U+80CE,U+80F0,U+80F8,U+8102,U+810F,U+8131,U+8146,U+814B,U+8155,U+8165,U+8170,U+817A,U+817E-817F,U+819B,U+819D,U+81C0,U+81C3,U+81C6,U+81EA,U+81F3-81F4,U+81FB,U+8200,U+8206,U+8212,U+8214,U+821C,U+821E-821F,U+8237,U+8247,U+8258,U+8273,U+827A,U+828B,U+829C-829D,U+82AF,U+82BD,U+82C7,U+82CF,U+82D1,U+82D4,U+82F1,U+8301,U+8335,U+8367,U+836B,U+836F,U+83B9,U+8404,U+840E,U+8424-8425,U+8427,U+8457,U+846C,U+849C,U+84B8,U+84C4,U+84D1,U+8517,U+851A,U+852C,U+8574,U+859B,U+85AA,U+85AF,U+85E4,U+85FB,U+8638,U+865A,U+865E,U+867D-867E,U+8681,U+868A,U+869C,U+86A4,U+86C0,U+86D9,U+86DB,U+86F0,U+86F9,U+8700,U+8712,U+8715,U+8717-8718,U+8747,U+874E,U+87F9,U+8840,U+8845,U+884C-884D,U+8854,U+8859,U+8863,U+8870,U+8877,U+8881,U+8892,U+8896,U+889C,U+88AD,U+88C5,U+88D4-88D5,U+892A,U+8944,U+897F,U+8981,U+8A00,U+8A79,U+8A89-8A8A,U+8BA8,U+8BAD-8BAF,U+8BB6,U+8BB8,U+8BBC,U+8BC1,U+8BC5,U+8BC8-8BCA,U+8BCC,U+8BD1,U+8BDB,U+8BE2-8BE3,U+8BE6,U+8BEC-8BED,U+8BEF,U+8BF1,U+8BF4-8BF5,U+8BF8,U+8C01,U+8C06,U+8C08,U+8C0A,U+8C10,U+8C13,U+8C1A,U+8C22-8C23,U+8C2D,U+8C4C,U+8C61,U+8C6B,U+8D1E,U+8D23-8D24,U+8D26,U+8D28,U+8D2A,U+8D2E,U+8D34,U+8D3C,U+8D43-8D44,U+8D4E,U+8D58,U+8D5A,U+8D5E,U+8D60,U+8D62,U+8D70,U+8D75,U+8D8A,U+8D9F,U+8DB3,U+8DBE,U+8DC3,U+8DF3,U+8E0A,U+8E0F,U+8E22,U+8E2A,U+8E44,U+8E4B,U+8E81,U+8EBA,U+8F67,U+8F69,U+8F6C,U+8F74,U+8F7D,U+8F93,U+8F95-8F97,U+8F99,U+8F9B,U+8FC2,U+8FC5,U+8FCE,U+8FD0,U+8FD9,U+8FDC-8FDD,U+8FE2,U+8FF0,U+8FFD,U+9000-9001,U+9003,U+9009-900A,U+900F-9010,U+9014,U+901A,U+901F-9020,U+9038,U+903E,U+9042,U+9047,U+9057,U+9065,U+906D-906E,U+9075,U+9080,U+9091,U+90A2,U+90AA,U+90AE,U+90B9,U+90C1,U+90D1,U+90E7,U+9149,U+914C,U+9157,U+915D-915E,U+9165,U+916E,U+9178,U+9189,U+9192,U+91C9,U+91CD-91CE,U+9488,U+949F,U+94A5,U+94A8,U+94BB,U+94C0-94C1,U+94DC,U+94E1,U+94E3,U+94F1,U+94F6,U+94F8,U+9500-9501,U+9508,U+950C,U+9511,U+9517,U+9521,U+9525,U+9528,U+9547,U+9576,U+95EE,U+95F2,U+95F8,U+95FB,U+9605,U+9609,U+960E,U+9633-9635,U+963B,U+9640,U+9650,U+9662,U+9668-9669,U+9676-9677,U+9685,U+968B,U+968F-9690,U+9699,U+969C,U+96A7,U+96C1,U+96C4-96C5,U+96CD,U+96E8,U+96EA,U+96FE,U+9700,U+9704,U+9707,U+971C,U+971E,U+9774,U+978B,U+97E6,U+97F3,U+97F5,U+9875,U+9879-987B,U+987D,U+9882,U+9884,U+9890,U+9893,U+9896,U+9898,U+989C,U+996E,U+9972,U+9985,U+9999,U+9A6D-9A6F,U+9A7B-9A7C,U+9A8C,U+9AA4,U+9AD3,U+9B03,U+9B4F,U+9C7C,U+9C9C,U+9E26,U+9E2D,U+9E2F,U+9E33,U+9E35,U+9E70,U+9ECD,U+9F20`}),Object.freeze({family:`Aha Hand`,file:`wenkai-gb-4-375dc3b3.woff2`,bytes:257596,unicodeRange:`U+4E0C,U+4E10,U+4E15,U+4E1E,U+4E28,U+4E36,U+4E3F,U+4E47,U+4E5C,U+4E69,U+4E8D,U+4E93,U+4E98,U+4E9F-4EA0,U+4EB3,U+4EB5,U+4EBB,U+4EC2-4EC4,U+4EC9,U+4EDD-4EDE,U+4EE1,U+4EE8,U+4EEB,U+4EF3,U+4EF5,U+4F09,U+4F1B,U+4F22,U+4F25,U+4F27,U+4F2B,U+4F32,U+4F3D,U+4F57-4F58,U+4F5A,U+4F5D-4F5F,U+4F64-4F65,U+4F67,U+4F74,U+4F76,U+4F7B-4F7C,U+4F7E,U+4F83,U+4F89,U+4F8F,U+4F91,U+4F94,U+4FAA,U+4FAC,U+4FC5,U+4FCE,U+4FD1,U+4FDA,U+4FDC,U+4FDF,U+4FE3,U+4FE6,U+4FE8,U+4FEA,U+4FF3,U+4FF8,U+4FFE,U+500C,U+500F,U+501C,U+5025,U+5028-5029,U+502C-502E,U+5043,U+5048,U+504C,U+504E,U+5055,U+506C,U+507B,U+507E,U+50A5,U+50A7,U+50A9,U+50BA,U+50D6,U+50E6,U+50EC-50EE,U+5106-5107,U+510B,U+5140,U+5155-5156,U+516E,U+5181-5182,U+5196,U+51A2,U+51A5,U+51AB,U+51B1,U+51BC-51BD,U+51C7,U+51EB,U+51F5,U+51FC,U+5202,U+5208,U+520D-520E,U+522D,U+5233,U+523F-5240,U+524C,U+525C,U+525E,U+5261,U+527D,U+5281-5282,U+5290,U+5293,U+52A2,U+52AC-52AD,U+52BE,U+52D0,U+52D6,U+52F0,U+52F9,U+530D,U+530F-5310,U+5315,U+531A,U+5326,U+532E,U+533E,U+5345,U+535F,U+5363,U+5366,U+5369,U+536E,U+537A,U+538D,U+539D,U+53A3,U+53A5,U+53AE,U+53B6,U+53DF,U+53E8-53E9,U+53F1,U+53F5,U+53FB,U+53FD,U+5406,U+5412,U+5416,U+5421,U+5423,U+5432,U+5443,U+544B,U+5452-5454,U+5456-5457,U+5459,U+5464,U+5466,U+5471-5472,U+5476-5477,U+5482,U+5484,U+5494,U+549A-549B,U+549D,U+54A3-54A4,U+54A6-54A7,U+54A9-54AA,U+54AD,U+54B4,U+54BB,U+54BF,U+54C2,U+54CC,U+54CF-54D0,U+54D2-54D5,U+54D9-54DA,U+54DC-54DE,U+54E7,U+54F3,U+54FD,U+54FF,U+550F,U+5511,U+5514,U+551B,U+5520,U+5522-5523,U+5527,U+552A,U+5530,U+5533,U+5537,U+553C,U+553F,U+5541,U+5549,U+5550,U+5555-5556,U+555C,U+5567,U+556C-556D,U+5575-5577,U+557B,U+557E,U+5581,U+5583,U+5588,U+558B,U+558F,U+5591,U+5594,U+5599,U+559F,U+55B1,U+55B5,U+55B9,U+55BD-55BE,U+55C4,U+55C9,U+55CC-55CD,U+55D1-55D2,U+55D4,U+55D6,U+55DD,U+55DF,U+55E4-55E6,U+55E8,U+55EA-55EC,U+55EF,U+55F2-55F3,U+55F5,U+55F7,U+55FE,U+5600-5601,U+5608,U+560C,U+560F,U+561E-561F,U+5623-5624,U+5627,U+562C-562D,U+5639,U+564C-564D,U+5654,U+5657-5659,U+565C,U+5662,U+5664,U+5669,U+566B,U+5671,U+567B-567C,U+5685-5686,U+5693,U+56AF,U+56D4,U+56D7,U+56DD,U+56DF,U+56E1,U+56EB,U+56F5,U+56F9,U+56FF,U+5704,U+5709-570A,U+571C,U+5729-572A,U+572C,U+572E-572F,U+5733,U+5739,U+573B,U+5742,U+574C,U+575C,U+5768-5769,U+576B,U+576D,U+5773,U+5776,U+577B-577C,U+5785-5786,U+578C,U+5793,U+57A0-57A1,U+57A4,U+57A7,U+57A9,U+57AD,U+57B2,U+57B4,U+57B8,U+57CF,U+57D2,U+57D5,U+57D8-57DA,U+57DD,U+57E4,U+57ED,U+57EF,U+57F4,U+57F8,U+57FD,U+5800,U+5807,U+580B,U+580D,U+5819,U+581E,U+5820,U+5844,U+5865,U+586C,U+587E,U+5880-5881,U+5889,U+589A,U+58BC,U+58C5,U+58D1,U+5902,U+5914,U+5919,U+5924-5925,U+592D,U+593C,U+5941-5942,U+5955,U+5958,U+595A,U+5B34,U+5B5B,U+5B6C,U+5C22,U+5C25,U+5C2C,U+5C34,U+5C7A,U+5C88,U+5C8C-5C8D,U+5C90-5C91,U+5C96,U+5C98-5C9A,U+5C9C,U+5CA2-5CA3,U+5CAB-5CAC,U+5CB1,U+5CB5,U+5CB7,U+5CBD,U+5CC1,U+5CC4,U+5CCB,U+5CD2,U+5CE4-5CE5,U+5D02-5D03,U+5D06,U+5D1B,U+5D1E,U+5D24,U+5D26-5D27,U+5D2E,U+5D34,U+5D3D-5D3E,U+5D4A-5D4B,U+5D58,U+5D5B,U+5D5D,U+5D69,U+5D6B-5D6C,U+5D6F,U+5D74,U+5D82,U+5D99,U+5D9D,U+5DB7,U+5DC5,U+5DEF,U+5DFD,U+5E0F,U+5E11,U+5E14,U+5E19,U+5E31,U+5E37,U+5E3B-5E3C,U+5E44,U+5E54,U+5E5B,U+5E5E,U+5E61,U+5E80,U+5E8B,U+5E91,U+5E96,U+5EA0,U+5EA5,U+5EB3,U+5EB5,U+5EB9,U+5EBE,U+5ED1-5ED2,U+5EDB,U+5EE8,U+5EEA,U+5EF4,U+5EFE-5EFF,U+5F01,U+5F08,U+5F0B,U+5F11,U+5F61,U+5F73,U+5F77,U+5F82,U+5F87,U+5F89,U+5F8C,U+5F95,U+5F99,U+5F9C,U+5FA8,U+5FAD,U+5FB5,U+5FBC,U+5FD2,U+61FF,U+624C,U+626A,U+629F,U+62BB,U+62CA,U+62D7,U+62DA,U+62EE,U+62F6,U+6322,U+6339,U+6343,U+634B,U+6369,U+636D,U+6371,U+637A,U+638A,U+638E,U+63AC-63AE,U+63B4,U+63BC,U+63BE,U+63C4,U+63C6,U+63CE,U+63DE,U+63E0,U+63F2,U+63F6,U+63F8,U+63FF,U+640B-640C,U+641B,U+6420-6421,U+6426,U+6441,U+6445,U+6452,U+645E,U+646D,U+647A,U+6484,U+6496,U+6499,U+64B7-64B8,U+64BA,U+64C0,U+64D0,U+64D7,U+64E2,U+64E4,U+6509,U+6525,U+652E,U+6538,U+6BD3,U+6C10,U+6C3D,U+6C46,U+71EE,U+723B,U+72AD,U+72B0,U+72B4,U+72B7-72B8,U+72C1,U+72C3,U+72CD-72CE,U+72D2,U+72E8-72E9,U+72EF,U+72F2-72F4,U+72F7,U+72FA-72FB,U+7301,U+7303,U+730A,U+7313,U+7315,U+7317,U+731D-731E,U+7321-7322,U+7325,U+732C,U+7331,U+7338-7339,U+734D,U+7350,U+7357,U+7360,U+736C,U+736F,U+737E,U+750D,U+7519,U+755A,U+777E,U+77A2,U+77CD,U+7980,U+79BA,U+7C74,U+7F54,U+7FB8,U+8037,U+80E4,U+8114,U+81BA,U+821B,U+8279,U+827D,U+827F,U+8284,U+8288,U+828A,U+828E-828F,U+8291,U+8297-8299,U+829F,U+82A1,U+82A4,U+82A8-82AB,U+82AE,U+82B0,U+82B4,U+82B7-82B8,U+82BE,U+82C1,U+82C4,U+82C8,U+82CA-82CC,U+82CE,U+82D2-82D3,U+82D5,U+82D8,U+82DC,U+82E0-82E1,U+82E3-82E4,U+82F4,U+82F7,U+82FB,U+8306-8309,U+830C,U+830F,U+8311,U+8314-8315,U+8317,U+831A-831C,U+832D,U+832F,U+8331,U+8333-8334,U+833A,U+833C,U+8340,U+8343,U+8347,U+834F,U+8351,U+835B-835C,U+835E-8360,U+8365-8366,U+8368-836A,U+836C-836E,U+8378,U+837B-837D,U+8385,U+8392-8393,U+8398,U+839B-839C,U+839E,U+83A0,U+83A8-83AA,U+83B0,U+83B3-83B4,U+83B6,U+83B8,U+83BA,U+83BC,U+83C0-83C1,U+83C5,U+83D4,U+83D6,U+83D8,U+83DD,U+83DF,U+83E1,U+83E5,U+83EA,U+83F0,U+83F8-83F9,U+83FD,U+8401,U+8403,U+8406,U+840B,U+840F,U+8411,U+8418,U+841C,U+8426,U+8431,U+8438,U+843C,U+8446,U+8451,U+8459-845A,U+845C,U+8469,U+846D,U+8473,U+8476,U+8478,U+847A,U+8487-8489,U+848C,U+848E,U+8497,U+84A1,U+84AF,U+84B4,U+84B9-84BA,U+84BD,U+84BF,U+84C1,U+84CA,U+84CD,U+84D0,U+84D3,U+84E0,U+84E3,U+84E5-84E6,U+84F0,U+84FC,U+84FF,U+850C,U+851F,U+8538-853B,U+8543,U+8548,U+8556,U+8559,U+855E,U+8564,U+8568,U+8572,U+8579-857B,U+8585,U+8587,U+858F,U+859C,U+85A4,U+85A8,U+85AE,U+85B0,U+85B7,U+85B9,U+85C1,U+85D3,U+85DC,U+85FF,U+8605,U+8616,U+8627,U+8629,U+863C,U+8803,U+8862,U+886E,U+88A4,U+88D2,U+8A07,U+8BA0,U+8BA6-8BA7,U+8BAA,U+8BB4-8BB5,U+8BB7,U+8BC2-8BC3,U+8BCB,U+8BCE-8BCF,U+8BD2-8BD4,U+8BD6,U+8BD8-8BD9,U+8BDC,U+8BDF-8BE0,U+8BE4,U+8BE8-8BE9,U+8BEE,U+8BF0,U+8BF3,U+8BF6,U+8BF9,U+8BFC,U+8BFF-8C00,U+8C02,U+8C04,U+8C07,U+8C0C,U+8C0F,U+8C11-8C12,U+8C14-8C16,U+8C18-8C19,U+8C1B,U+8C1D,U+8C1F-8C21,U+8C25,U+8C27,U+8C2A-8C2B,U+8C2E-8C2F,U+8C32-8C33,U+8C35-8C36,U+8C73,U+8D53,U+8D5C-8D5D,U+8F94,U+9097,U+9099,U+909B,U+909D,U+90A1,U+90AC,U+90B0,U+90B3-90B4,U+90B6,U+90B8,U+90BA,U+90BE,U+90C4-90C5,U+90C7,U+90CF-90D0,U+90D3,U+90D7,U+90DB-90DC,U+90E2,U+90E6,U+90EB,U+90EF,U+90FE,U+9104,U+911E,U+9122-9123,U+912F,U+9131,U+9139,U+9143,U+9146,U+961D,U+9621-9622,U+962A,U+9631,U+963C-963D,U+9642,U+9649,U+9654,U+965F,U+9667,U+966C,U+9672,U+9674,U+9688,U+968D,U+9697,U+96B0,U+9765,U+98E7,U+9963,U+9967-996C,U+9974,U+9977,U+997D,U+9980,U+9984,U+9987,U+998A,U+998D,U+9990-9991,U+9993-9995,U+9997-9998,U+99A8,U+9B2F,U+9B32,U+9EC9,U+9F10,U+9F17,U+9F19,U+9FA0`}),Object.freeze({family:`Aha Hand`,file:`wenkai-gb-5-d0359bbc.woff2`,bytes:278908,unicodeRange:`U+4E2C,U+5216,U+54AB,U+584D,U+5981,U+5983,U+598D,U+5997,U+599E,U+59A3-59A4,U+59A9-59AB,U+59AF,U+59B2,U+59BE,U+59CA,U+59D2,U+59D7-59D8,U+59DD,U+59E3,U+59F9,U+5A05-5A06,U+5A08-5A09,U+5A0C,U+5A11,U+5A13,U+5A23,U+5A32,U+5A34,U+5A3C,U+5A40,U+5A4A,U+5A55,U+5A62,U+5A67,U+5A75,U+5A77,U+5A7A,U+5A9B,U+5AAA,U+5AB2,U+5AB5,U+5AB8,U+5ABE,U+5AD2,U+5AD4,U+5AD6,U+5AD8,U+5ADC,U+5AE0,U+5AE3,U+5AE6,U+5AEB,U+5AF1,U+5B09,U+5B16-5B17,U+5B32,U+5B37,U+5B40,U+5B51,U+5B53,U+5B5A,U+5B62,U+5B65,U+5B71,U+5B73,U+5B80,U+5B84,U+5B93,U+5B95,U+5BA5,U+5BB8,U+5BE4,U+5BEE,U+5BF0,U+5C15,U+5C1C,U+5C3B,U+5C50,U+5C59,U+5C63,U+5C66,U+5C6E,U+5DDB,U+5E7A,U+5F29-5F2A,U+5F2D,U+5F3C,U+5F40,U+5F50,U+5F56-5F58,U+5FC4,U+5FC9,U+5FCF-5FD1,U+5FD6,U+5FDD,U+5FE1,U+5FE4,U+5FEA,U+5FED-5FEE,U+5FF8,U+5FFE,U+6003-6006,U+600A,U+600D,U+600F,U+6019,U+601B,U+6021,U+6026,U+6029,U+602B,U+6035,U+603C,U+603F,U+6041-6042,U+6059-605A,U+605D,U+6063,U+6067,U+606A,U+6078-607B,U+607D,U+6083,U+608C,U+6092,U+6096,U+609A-609B,U+609D,U+60AB,U+60AD,U+60B1,U+60B4,U+60BB,U+60C6,U+60D8,U+60DA,U+60DD,U+60EC,U+60F4,U+6100,U+6106,U+610D-610E,U+6115,U+6120,U+6123,U+6126,U+612B,U+614A,U+615D,U+6175,U+6194,U+619D,U+61A7,U+61A9,U+61AC,U+61B7,U+61CB,U+61D1,U+61D4,U+61F5,U+6206,U+620B,U+6215,U+6217,U+621B,U+621F,U+6221-6222,U+6224-6225,U+622C,U+623D-623E,U+6243,U+6248-6249,U+6308,U+6332,U+63B0,U+6434,U+643F,U+64D8,U+6534-6535,U+6555,U+656B,U+6590,U+6593,U+65AB,U+65BC,U+65C3-65C4,U+65C6,U+65CC,U+65CE,U+65D2,U+65D6,U+65EE-65F0,U+6600,U+6603,U+660A,U+6615,U+6619,U+661D,U+6631,U+6634-6636,U+6641,U+664F,U+6654,U+6656-6657,U+665F,U+6661,U+6677,U+6684,U+668C,U+669D,U+66A7,U+66B9,U+66BE,U+66DB-66DC,U+66E6,U+66E9,U+66F7,U+670A,U+6710,U+6715,U+6726,U+6748,U+674C,U+6753,U+675E,U+6769-676A,U+6772-6773,U+6775,U+6777,U+677C,U+6787,U+678B,U+6798,U+679E,U+67A5,U+67A7-67A8,U+67AD,U+67B0,U+67B3,U+67B5,U+67B8,U+67C1,U+67C3,U+67D8-67DA,U+67DD,U+67E2,U+67E9,U+67F0,U+67FD,U+6800,U+6809-680A,U+680C,U+680E,U+681D,U+6829,U+6832-6833,U+683E,U+6840-6841,U+6844,U+6849-684A,U+684E,U+6855,U+6860-6862,U+6864,U+6866-6867,U+686B,U+6874,U+6877,U+6883,U+688F,U+6893,U+68B5,U+68C2,U+68E3,U+68F0,U+68F9,U+68FC,U+6901,U+690B,U+6910,U+691F-6920,U+6924,U+6934,U+6939,U+6942,U+6957,U+695D,U+6960,U+6963,U+6966,U+696B,U+696E,U+6971,U+6978-6979,U+6980,U+6984,U+6987-6989,U+698D,U+6995,U+6998,U+699B,U+69A7,U+69AB,U+69AD,U+69B1,U+69BB,U+69C1,U+69CA,U+69CC,U+69CE,U+69D4,U+69DF-69E0,U+69ED,U+69F2,U+69FF,U+6A17-6A18,U+6A28,U+6A2F,U+6A35,U+6A3D-6A3E,U+6A44,U+6A50,U+6A58,U+6A5B,U+6A65,U+6A79,U+6A7C,U+6A8E,U+6A90-6A91,U+6A97,U+6AA0,U+6AA9,U+6AAB,U+6B24,U+6B37,U+6B39,U+6B43,U+6B46,U+6B59,U+6B81-6B82,U+6B84,U+6B87,U+6B8D,U+6B92-6B93,U+6B9A-6B9B,U+6BA1,U+6BAA,U+6BB3,U+6BC2,U+6BEA,U+6BF3,U+6BF5,U+6BF9,U+6BFD,U+6C05-6C07,U+6C0D,U+6C15,U+6C18-6C1A,U+6C21,U+6C24,U+6C29-6C2A,U+6C32,U+6C35,U+6C4A,U+6C54,U+6C5C,U+6C68-6C69,U+6C74,U+6C76,U+6C85-6C86,U+6C8C,U+6C90,U+6C93-6C94,U+6CA3,U+6CA9,U+6CAD,U+6CB1-6CB2,U+6CD0,U+6CD3-6CD4,U+6CD6-6CD7,U+6CE0,U+6CEB,U+6CEE-6CEF,U+6CF1,U+6CF6-6CF8,U+6CFA,U+6CFE,U+6D04,U+6D07,U+6D0C,U+6D0E,U+6D19-6D1A,U+6D27,U+6D2B,U+6D2E,U+6D33,U+6D35,U+6D39,U+6D43,U+6D48,U+6D4D,U+6D4F,U+6D52,U+6D54,U+6D5C,U+6D5E,U+6D60,U+6D63,U+6D6F,U+6D7C,U+6D91,U+6D93-6D94,U+6D9E,U+6DA0,U+6DAB,U+6DAE,U+6DBF,U+6DC5,U+6DC7,U+6DD9,U+6DDD-6DDE,U+6DE0,U+6DE6,U+6DFC,U+6E0C,U+6E0E,U+6E11,U+6E16,U+6E1A,U+6E25,U+6E2B,U+6E32,U+6E44,U+6E4E,U+6E53-6E54,U+6E5F,U+6E6B,U+6E6E,U+6E86,U+6E8F,U+6E98,U+6E9F,U+6EA5,U+6EA7,U+6EB1-6EB2,U+6EB4,U+6EB7,U+6EBB,U+6EBD,U+6EC2,U+6ECF,U+6ED5,U+6ED7,U+6EDF-6EE0,U+6EE2,U+6EF9,U+6F09,U+6F15,U+6F24,U+6F29-6F2A,U+6F2D,U+6F2F,U+6F36,U+6F46-6F47,U+6F4B,U+6F62,U+6F72,U+6F74,U+6F78,U+6F7A,U+6F7C,U+6F89,U+6F8C-6F8D,U+6FA7,U+6FB6,U+6FB9,U+6FC2,U+6FC9,U+6FD1,U+6FDE,U+6FE0-6FE1,U+6FEE-6FEF,U+701A-701B,U+7023,U+7035,U+7039,U+704F,U+705E,U+706C,U+7080,U+7085,U+7096,U+709C-709D,U+70AB,U+70B1,U+70B7,U+70BB,U+70C0,U+70CA,U+70E8,U+7110,U+7113,U+7116,U+7118,U+712F,U+7131,U+7145,U+714A,U+715C,U+7166,U+7168,U+7172-7173,U+7178,U+717A,U+7198,U+71A0,U+71A8,U+71B3,U+71B5,U+71B9,U+71D4,U+71E0,U+71E7,U+71F9,U+721D,U+7228,U+7230,U+723F,U+724D,U+7252,U+7256,U+725D,U+7266,U+726E-726F,U+727E-727F,U+7284,U+728B,U+728D,U+728F,U+7292,U+729F,U+7337,U+7352,U+738E,U+7391,U+739F,U+73A2,U+73AE,U+73B3,U+73B7,U+73BA,U+73C0,U+73C2,U+73C8-73C9,U+73CF,U+73D1,U+73D9,U+73DE,U+73E5,U+73E7,U+73E9,U+73F2,U+740A,U+740F,U+741A-741B,U+7425-7426,U+7428,U+742A,U+742C,U+742E,U+7430,U+7441,U+7455,U+7457,U+7459,U+745B-745C,U+746D,U+7477,U+747E,U+7480-7481,U+7487,U+748B,U+748E,U+7490,U+749C,U+749E,U+74A7-74A9,U+74BA,U+74D2,U+74EF,U+74F4,U+74FF,U+750F,U+7511,U+7513,U+752F,U+753E,U+757F,U+77F6,U+77F8,U+7800,U+7809,U+7811,U+7817-7818,U+781C-781D,U+782D,U+793B,U+7940,U+7946,U+7949,U+7953,U+7957,U+795A-795C,U+7960,U+7962,U+7967,U+796F,U+797A,U+7985,U+798A,U+799A,U+79A7,U+79B3,U+7E9F,U+7EA1,U+7EA3,U+7EA5,U+7EA8-7EA9,U+7EAD,U+7EB0,U+7EBE,U+7EC0-7EC2,U+7EC9,U+7ECB-7ECC,U+7ED0,U+7ED4,U+7ED7,U+7EDB,U+7EE0-7EE1,U+7EE8,U+7EEB,U+7EEE-7EEF,U+7EF1-7EF2,U+7EF6,U+7EFA-7EFB,U+7EFE,U+7F01-7F03,U+7F07-7F08,U+7F0B-7F0D,U+7F0F,U+7F11-7F12,U+7F17,U+7F19,U+7F1B-7F1C,U+7F1F,U+7F21-7F27,U+7F2A-7F2D,U+7F2F-7F33,U+7F35,U+7FBC,U+8004,U+8006,U+807F-8080,U+8093,U+809C,U+809F,U+80AB,U+80AD,U+80B1,U+80B4,U+80B7,U+80BC-80BD,U+80C2,U+80C4,U+80CD,U+80D7,U+80D9,U+80DB,U+80DD,U+80E7-80ED,U+80F1-80F2,U+80F4,U+80FC,U+810D-810E,U+8112,U+8118,U+811E,U+812C,U+8132,U+8136,U+8148,U+814C,U+8153,U+8159-815A,U+8160,U+8167,U+8169,U+816D,U+8171,U+8174,U+817C-817D,U+8182,U+8188,U+8191,U+81A3,U+81A6,U+81AA,U+81BB,U+81C1,U+81CA,U+81CC,U+81E7,U+8274,U+8662,U+8930,U+89C7,U+89CA-89CC,U+89CE-89D1,U+89F3,U+8B07,U+8C5A,U+8D32-8D33,U+8D36,U+8D3B,U+8D3D,U+8D40,U+8D45-8D49,U+8D4D,U+8D55,U+8D59,U+8E47,U+8ECE,U+8F6B,U+8F6D,U+8F71-8F73,U+8F75-8F7A,U+8F7C,U+8F7E,U+8F81-8F82,U+8F84,U+8F87,U+8F8B,U+8F8D-8F8F,U+8F98,U+8F9A,U+8FB6,U+8FD3,U+8FD5,U+8FE4-8FE6,U+8FE8-8FE9,U+8FEE,U+8FF3,U+9004-9005,U+900B,U+900D,U+9011,U+9016,U+9021,U+9026,U+902D,U+902F,U+9035-9036,U+9044,U+9050-9052,U+9058,U+905B,U+9062,U+9068,U+9074,U+907D,U+9082-9083,U+9088,U+908B,U+9095,U+95E9,U+95EB,U+95F1,U+95F3,U+95F5-95F6,U+95FC,U+95FE,U+9603-9604,U+9606,U+9608,U+960A-960D,U+960F,U+9612,U+9615-9617,U+9619-961A,U+96B3,U+97EA-97EC,U+987C,U+98D1-98D3,U+98D5,U+98D9-98DA,U+9A75,U+9A77-9A78,U+9A7A,U+9A7D,U+9A7F-9A81,U+9A85,U+9A88,U+9A8A,U+9A90,U+9A92-9A93,U+9A96,U+9A98,U+9A9B-9AA0,U+9AA2-9AA3,U+9AA5,U+9AA7,U+9B3B,U+9F51`}),Object.freeze({family:`Aha Hand`,file:`wenkai-gb-6-a238b41c.woff2`,bytes:307604,unicodeRange:`U+5D47,U+6549,U+659B,U+66A8,U+74DE,U+74E0,U+752C,U+753A,U+7540,U+7548,U+754B,U+754E,U+755B,U+7572,U+7579,U+7583,U+758B,U+7592,U+7594,U+7596,U+759D,U+75A0,U+75A3,U+75AC,U+75B0-75B1,U+75B3-75B4,U+75B8,U+75C2-75C4,U+75CD,U+75D6,U+75E3-75E4,U+75E6-75E8,U+75EB,U+75F1,U+75FC,U+75FF-7600,U+7603,U+7605,U+760A,U+760C,U+7610,U+7615,U+7617-7619,U+761B,U+7620,U+7622,U+7625,U+762D,U+7630,U+7633,U+7635,U+763C,U+763E-7640,U+7643,U+764D,U+7654,U+7656,U+765C,U+765E,U+766B,U+766F,U+7688,U+768E,U+7693,U+7699,U+76A4,U+76B2,U+76B4,U+76CD,U+76E5,U+76F1,U+76F9,U+7704,U+7707-7708,U+770D,U+7719-771A,U+7722,U+7726,U+772D,U+7735,U+7738,U+7743,U+7747,U+7750-7751,U+775A,U+7762,U+7765,U+7768,U+777D,U+777F-7780,U+778C-778D,U+7791,U+779F-77A0,U+77B0,U+77B5,U+77BD,U+77BF,U+77DC,U+77E7,U+77EC,U+781F,U+7823,U+7825-7826,U+7829,U+782C,U+7839-783C,U+7847,U+784C,U+784E,U+7850,U+7856-7857,U+786A,U+786D,U+7887,U+7893,U+789A-789C,U+78A1,U+78A3,U+78A5,U+78B2,U+78B9,U+78C9,U+78D4,U+78D9,U+78EC,U+78F2,U+78F4,U+7905,U+7913,U+791E,U+7924,U+7934,U+79D5,U+79E3,U+79EB,U+79ED,U+7A02-7A03,U+7A06,U+7A14,U+7A1E,U+7A23,U+7A37,U+7A39,U+7A51,U+7A70,U+7A78-7A79,U+7A80,U+7A86,U+7A88,U+7A95,U+7AA0,U+7AA6,U+7AA8,U+7AAC-7AAD,U+7AB3,U+7AE6,U+7AFA,U+7AFD,U+7B03-7B04,U+7B08,U+7B0A,U+7B0F,U+7B15,U+7B19,U+7B1E,U+7B20,U+7B24-7B25,U+7B2A-7B2B,U+7B2E,U+7B31,U+7B33,U+7B38,U+7B3E,U+7B45,U+7B47,U+7B4C,U+7B58,U+7B5A,U+7B5D,U+7B60,U+7B62,U+7B6E,U+7B71-7B72,U+7B75,U+7B7B,U+7B85,U+7B90,U+7B9C-7B9D,U+7BA2,U+7BA6-7BA8,U+7BAA-7BAC,U+7BB4,U+7BB8,U+7BC1,U+7BCC,U+7BD1,U+7BDA,U+7BDD,U+7BE5-7BE6,U+7BEA,U+7BFC,U+7BFE,U+7C0B-7C0C,U+7C0F,U+7C16,U+7C1F,U+7C26,U+7C2A,U+7C38,U+7C40-7C41,U+7C7C,U+7C91,U+7C9C-7C9E,U+7CA2,U+7CB2,U+7CBC-7CBD,U+7CC1,U+7CC5,U+7CC7-7CC8,U+7CCC-7CCD,U+7CD7,U+7CE8,U+7CF8,U+7D77,U+7DA6,U+7DAE,U+7E3B,U+7E47,U+7E9B,U+7F36,U+7F42,U+7F44-7F45,U+7F58,U+7F5F,U+7F61,U+7F68,U+7F71,U+7F74,U+7F79,U+7F7E,U+7F81,U+7F9D,U+7F9F,U+7FA7,U+7FAF-7FB0,U+7FB2,U+7FBF,U+7FCA,U+7FCE,U+7FD5,U+7FE1,U+7FE5-7FE6,U+7FE9,U+7FEE,U+7FF3,U+800B,U+8012,U+8014,U+8016,U+801C,U+8020,U+8022,U+8025-8029,U+8031,U+8035,U+8043,U+8046,U+804D,U+8052,U+8069,U+8071,U+80E5,U+81EC,U+81FE,U+8201-8202,U+8204,U+8210,U+8221-8223,U+8228,U+822B,U+822D,U+822F,U+8233-8234,U+8238,U+823B,U+823E,U+8244,U+8249,U+824B,U+824F,U+825A,U+825F,U+8268,U+826E,U+864D,U+8654,U+866C,U+866E,U+867A-867C,U+867F,U+868B,U+868D,U+8693,U+869D,U+86A3,U+86A7-86AA,U+86AC,U+86AF-86B1,U+86B4-86B6,U+86BA,U+86C4,U+86C9,U+86CE-86D1,U+86D8,U+86DE-86DF,U+86E9,U+86ED,U+86F1-86F4,U+86F8,U+8703,U+8707-870A,U+870D,U+8713,U+871A,U+871E,U+8722-8723,U+8725,U+8729,U+872E,U+8731,U+8734,U+8737,U+873B,U+873E-873F,U+8748,U+874C,U+8753,U+8759,U+8760,U+8763-8765,U+876E,U+8770,U+877B-877E,U+8782-8783,U+8785,U+8788,U+878B,U+8793,U+8797,U+87A8,U+87AB-87AD,U+87AF,U+87B3,U+87B5,U+87BD,U+87C0,U+87C6,U+87CA-87CB,U+87D1-87D3,U+87DB,U+87E0,U+87E5,U+87EA,U+87EE,U+87FE,U+880A,U+8813,U+8816,U+881B,U+8821,U+8832,U+8839,U+883C,U+8844,U+8864,U+8869,U+8872,U+887D-887F,U+8882,U+8885,U+8888,U+88A2,U+88B7,U+88BC,U+88C6,U+88C9,U+88CE,U+88D8,U+88DF,U+88E2-88E3,U+88E5,U+88E8,U+88F0-88F1,U+88FC,U+88FE,U+890A,U+8913,U+8919-891B,U+8921,U+892B,U+8934,U+8936,U+8941,U+895E,U+8966,U+897B,U+8983,U+89D6,U+89DA,U+89DC,U+89DE,U+89E5,U+89EB,U+89EF,U+8A3E,U+8A48,U+8B26,U+8C47,U+8C49,U+8C55,U+8C78,U+8C82,U+8C85,U+8C8A,U+8C94,U+8C98,U+8D67,U+8D6D,U+8D73,U+8D84,U+8D91,U+8D94,U+8DB1,U+8DB5,U+8DB8,U+8DBA,U+8DBC,U+8DBF,U+8DC4,U+8DC6,U+8DCE-8DCF,U+8DD6-8DD7,U+8DDA-8DDB,U+8DDE,U+8DE3-8DE4,U+8DEB-8DEC,U+8DF7-8DF9,U+8DFB,U+8DFD,U+8E05,U+8E09,U+8E14,U+8E1D,U+8E1F,U+8E23,U+8E2C,U+8E2E-8E2F,U+8E31,U+8E35,U+8E39-8E3A,U+8E3D,U+8E40-8E42,U+8E49-8E4A,U+8E51-8E52,U+8E59,U+8E69,U+8E6F-8E70,U+8E74,U+8E76,U+8E7C,U+8E85,U+8E8F-8E90,U+8E94,U+8E9C,U+8E9E,U+914A,U+914E-9150,U+9161-9162,U+9164,U+9169,U+916F-9170,U+9172,U+9174,U+9179,U+917D-917E,U+9185,U+918C-918D,U+9190-9191,U+91A2-91A3,U+91AA,U+91AD-91AF,U+91B4-91B5,U+91BA,U+928E,U+92AE,U+92C8,U+933E,U+936A,U+938F,U+93CA,U+93D6,U+943E,U+946B,U+9485-9487,U+948A-948D,U+948F-9490,U+9494-9495,U+9497,U+949A-949C,U+94A3-94A4,U+94AA-94AD,U+94AF-94B0,U+94B2,U+94B4,U+94B6-94BA,U+94BC-94BD,U+94BF,U+94C4,U+94C8-94CE,U+94D0-94D2,U+94D5-94D9,U+94DB,U+94DE-94E0,U+94E2,U+94E4-94E5,U+94E7-94EB,U+94EE-94EF,U+94F3-94F5,U+94F7,U+94F9,U+94FC-94FD,U+94FF,U+9502-9503,U+9506-9507,U+9509-950A,U+950D-950F,U+9512-9516,U+9518,U+951B,U+951D-951F,U+9522,U+9529-952C,U+9531-9532,U+9534-9538,U+953A,U+953C,U+953E-953F,U+9542,U+9544-9546,U+9549,U+954C,U+954E-954F,U+9552-9554,U+9556-9559,U+955B,U+955D-955F,U+9561-9562,U+9564-956C,U+956F,U+9571-9573,U+96B9,U+96BC-96BD,U+96C9,U+96CE,U+96D2,U+96E0,U+96E9,U+96EF,U+96F3,U+9701,U+9706,U+9708,U+970E-970F,U+972A,U+972D,U+9730,U+973E,U+9753,U+977C,U+9785,U+9791-9792,U+9794,U+97A3,U+97AB,U+97AF,U+97B2,U+97B4,U+9878,U+9880,U+9883,U+9889,U+988C-988D,U+988F,U+9894,U+989A-989B,U+989E-989F,U+98A1-98A2,U+98A5-98A6,U+98E8,U+990D,U+992E,U+9954-9955,U+99A5,U+9AB0-9AB1,U+9AB6-9AB7,U+9ABA,U+9ABC,U+9AC0-9AC2,U+9AC5,U+9ACB-9ACC,U+9AD1,U+9ADF,U+9AE1,U+9AE6,U+9AEB,U+9AED,U+9AEF,U+9AF9,U+9AFB,U+9B08,U+9B0F,U+9B13,U+9B1F,U+9B23,U+9B43,U+9B45,U+9B47-9B49,U+9B4D,U+9B51,U+9C7F,U+9C82,U+9C85-9C88,U+9C8B,U+9C8E,U+9C90-9C92,U+9C94-9C95,U+9C9A-9C9B,U+9C9E-9CA3,U+9CA5-9CA9,U+9CAB,U+9CAD-9CAE,U+9CB0-9CB7,U+9CBA-9CBD,U+9CC4-9CC7,U+9CCA-9CD0,U+9CD3-9CD5,U+9CD7-9CD9,U+9CDC-9CDD,U+9CDF,U+9CE2,U+9E20,U+9E22,U+9E28-9E2C,U+9E31-9E32,U+9E36-9E3A,U+9E3E,U+9E41-9E42,U+9E44,U+9E46-9E49,U+9E4B-9E4C,U+9E4E,U+9E51,U+9E55,U+9E57-9E58,U+9E5A-9E5C,U+9E5E,U+9E63,U+9E66-9E6D,U+9E71,U+9E73,U+9E7E,U+9E82,U+9E87-9E88,U+9E8B,U+9E92,U+9E9D,U+9E9F,U+9EB4,U+9EB8,U+9EBD-9EBE,U+9ECF,U+9EDB-9EDD,U+9EDF-9EE0,U+9EE2,U+9EE5,U+9EE7,U+9EE9-9EEA,U+9EEF,U+9EF9,U+9EFB-9EFC,U+9EFE,U+9F0B,U+9F0D,U+9F22,U+9F2C,U+9F2F,U+9F37,U+9F39,U+9F3D-9F3E,U+9F44,U+9F80,U+9F83,U+9F85-9F8A,U+9F8C,U+9F9B`})]),Of=`'Aha Hand Latin','Aha Hand','Segoe Print','Ink Free','Bradley Hand','Chalkboard SE','Noteworthy','Comic Sans MS','LXGW WenKai','Kaiti SC','STKaiti','KaiTi','楷体',cursive`,kf=Df.map(e=>`@font-face{font-family:'${e.family}';font-style:normal;font-weight:400;font-display:swap;src:url('api/aha-tutor/font?f=${e.file}') format('woff2');unicode-range:${e.unicodeRange}}`).join(`
|
|
277
|
+
`),$=e=>`calc(${e}*var(--aha-px))`,Af=`${kf}
|
|
278
278
|
.aha{container-type:inline-size;container-name:aha;--aha-text-scale:1;--aha-px:calc(var(--dsh-content-font-size,14px)/14*var(--aha-text-scale));--aha-gap:12px;--aha-radius:var(--dsw-radius-md,12px);--aha-text:var(--dsw-alias-label-primary,#1f2328);--aha-muted:var(--dsw-alias-label-tertiary,#6b7280);--aha-dim:var(--dsw-alias-label-caption,#9ca3af);--aha-border:var(--dsw-alias-border-l2,#e5e7eb);--aha-bg:var(--dsw-alias-bg-base,#fafafa);--aha-surface:var(--dsw-alias-bg-layer-1,#fff);--aha-soft:var(--dsw-alias-bg-module-platform,#f4f5f7);--aha-hover:var(--dsw-alias-interactive-bg-hover,rgba(0,0,0,.05));--aha-brand:var(--dsw-alias-state-business-primary,#3b6cf6);--aha-primary-bg:var(--dsw-alias-brand-primary,#111);--aha-primary-fg:var(--dsw-alias-label-primary-inverted,#fff);--aha-ok:var(--dsw-alias-state-success-primary,#1f9d55);--aha-bad:var(--dsw-alias-state-error-primary,#d64545);
|
|
279
279
|
position:relative;display:flex;flex:1 1 auto;height:100%;min-height:0;overflow:hidden;background:var(--aha-bg);color:var(--aha-text);font-size:${$(15)};line-height:1.6;box-sizing:border-box}
|
|
280
280
|
.aha[data-text=large]{--aha-text-scale:1.15}
|
|
@@ -598,7 +598,7 @@ a.aha-btn{text-decoration:none}
|
|
|
598
598
|
|
|
599
599
|
/* ── the board ─────────────────────────────────────────────────────────── */
|
|
600
600
|
.aha-board{--desk:#ecebe4;--ink:#23262f;--ink-soft:#4a4f5c;--head:#1f4fb8;--marker:rgba(255,214,79,.62);--accent:#d64545;--accent2:#2f9e6e;--paper:#fdfcf8;--grid:rgba(40,50,80,.05);--note:#fff7da;--note-line:#e9c45a;--pencil:#c98a2c;
|
|
601
|
-
position:relative;flex:1 1 auto;min-height:0;container-type:inline-size;container-name:board;background:var(--paper);background-image:radial-gradient(var(--grid) 1px,transparent 1.2px);background-size:22px 22px;color:var(--ink);font-family:${
|
|
601
|
+
position:relative;flex:1 1 auto;min-height:0;container-type:inline-size;container-name:board;background:var(--paper);background-image:radial-gradient(var(--grid) 1px,transparent 1.2px);background-size:22px 22px;color:var(--ink);font-family:${Of};overflow:hidden}
|
|
602
602
|
.aha-board[data-font=standard]{font-family:inherit}
|
|
603
603
|
.aha-board[data-theme=dark]{--desk:#141a17;--ink:#ecebe4;--ink-soft:#c9c8bf;--head:#9cc2ff;--marker:rgba(214,178,58,.45);--accent:#ff8a80;--accent2:#7fd6a8;--paper:#1d2622;--grid:rgba(255,255,255,.05);--note:#2a3530;--note-line:#8f7a2f;--pencil:#e7c27a}
|
|
604
604
|
.aha-boardScroll{position:absolute;inset:0;overflow:auto;padding:22px 30px 40px}
|
|
@@ -666,7 +666,7 @@ a.aha-btn{text-decoration:none}
|
|
|
666
666
|
.aha-prepStages li[data-state=done]::before{content:'✓';background:var(--aha-ok)}
|
|
667
667
|
.aha-prepNow{font-size:${$(15)};line-height:${$(23.5)}}
|
|
668
668
|
.aha-prepHint{font-size:${$(16)}}
|
|
669
|
-
.aha-prepHint[data-hand=true]{font-family:${
|
|
669
|
+
.aha-prepHint[data-hand=true]{font-family:${Of};font-size:${$(17)}}
|
|
670
670
|
.aha-buffering{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:max-content;max-width:calc(100% - 28px);display:flex;align-items:center;gap:10px;padding:10px 16px;border-radius:12px;background:var(--aha-surface);border:1px solid var(--aha-border);color:var(--aha-text);font-family:inherit;z-index:4}
|
|
671
671
|
@container board (max-width:640px){.aha-cols{grid-template-columns:1fr}.aha-boardScroll{padding:16px}.aha-frame{padding:16px}}
|
|
672
672
|
/* The canvas view: every page as a frame on a desk that pans and zooms. */
|
|
@@ -710,13 +710,13 @@ a.aha-btn{text-decoration:none}
|
|
|
710
710
|
.aha-flash[data-flipped=true] .aha-flashInner{transform:rotateY(180deg)}
|
|
711
711
|
.aha-flashFace{grid-area:1/1;min-width:0;backface-visibility:hidden;display:flex;align-items:center;justify-content:center;text-align:center;padding:26px;border:1px solid var(--aha-border);border-radius:16px;background:var(--aha-surface);font-size:${$(22)};line-height:1.5}
|
|
712
712
|
.aha-flashBack{transform:rotateY(180deg)}
|
|
713
|
-
`,
|
|
714
|
-
`)){let t=``,a=i.match(/[ -鿿가--]|[^\s -鿿가--]+|\s+/gu)??[];for(let i of a){let a=t+i;if(e.measureText(a).width>n&&t.trim()&&!
|
|
715
|
-
`):rl(f.text),552-(f.t===`note`?28:0)),i=Math.round(t*1.42);u(r.length*i+(f.t===`note`?22:0),{...d,kind:`text`,size:t,weight:f.t===`h`?700:400,lines:r,lineHeight:i,color:f.t===`h`?n.head:n.ink,center:f.t===`math`,note:f.t===`note`,marker:f.t===`h`});continue}let p=f.t===`chart`?Pt(f):f.t===`plot`?nc(f):f.t===`svg`?lc(f.svg):f.t===`anim`&&f.poster?lc(f.poster):``,m=p?await Bf(
|
|
716
|
-
`).slice(0,14);u(e.length*24+20,{...d,kind:`code`,lines:e});continue}f.t===`anim`&&u(90,{...d,kind:`text`,size:22,weight:400,lines:[`▶ ${f.caption||`animation`}`],lineHeight:32,color:n.soft,note:!0})}}return{items:i,pages:a}}function Hf(e,t){e.fillStyle=t.paper,e.fillRect(0,0,Af,720),e.fillStyle=t.dot;for(let t=12;t<Af;t+=24)for(let n=12;n<720;n+=24)e.fillRect(t,n,1.6,1.6)}function Uf(e,t,n,r){e.save(),e.translate(t,n),e.rotate(-.6),e.fillStyle=r.pencil,e.fillRect(0,-5,34,10),e.fillStyle=r.accent,e.fillRect(34,-5,7,10),e.beginPath(),e.moveTo(0,-5),e.lineTo(-10,0),e.lineTo(0,5),e.closePath(),e.fillStyle=r.ink,e.fill(),e.restore()}function Wf(e,t,n,r){if(t.kind!==`title`){if(t.kind===`text`){e.font=Ff(t.size,t.weight),e.textBaseline=`top`,t.note&&(e.fillStyle=r.note,e.strokeStyle=r.noteLine,e.lineWidth=2,e.beginPath(),e.roundRect?.(t.x,t.y,552,t.h,12),e.fill(),e.stroke());let i=t.lines.reduce((e,t)=>e+[...t].length,0),a=Math.floor(i*n),o=null;t.lines.forEach((n,i)=>{if(a<=0)return;let s=[...n],c=s.slice(0,a).join(``);a-=s.length;let l=e.measureText(c).width,u=t.center?t.x+(552-e.measureText(n).width)/2:t.x+(t.note?14:0),d=t.y+(t.note?11:0)+i*t.lineHeight;t.marker&&(e.fillStyle=r.marker,e.fillRect(u-2,d+t.size*.62,l+4,t.size*.38)),e.fillStyle=t.color,e.fillText(c,u,d),o={x:u+l,y:d+t.size}}),o&&n<1&&Uf(e,o.x,o.y,r);return}if(t.kind===`image`){e.save(),e.beginPath(),e.rect(t.x,t.y,t.w*n,t.imageH),e.clip(),e.drawImage(t.image,t.x,t.y,t.w,t.imageH),e.restore(),t.caption&&n>=1&&(e.font=Ff(18),e.fillStyle=r.soft,e.textBaseline=`top`,e.fillText(t.caption,t.x,t.y+t.imageH+6)),n<1&&Uf(e,t.x+t.w*n,t.y+t.imageH/2,r);return}if(t.kind===`table`){let i=t.rows.slice(0,Math.max(1,Math.ceil(t.rows.length*n))),a=Math.max(...t.rows.map(e=>e.length)),o=552/Math.max(1,a);e.font=Ff(19),e.textBaseline=`middle`,e.strokeStyle=r.soft,e.lineWidth=1.4,i.forEach((n,i)=>{n.forEach((n,a)=>{let s=t.x+a*o,c=t.y+i*34;e.strokeRect(s,c,o,34),e.fillStyle=i===0?r.head:r.ink;let l=rl(n);for(;l.length>1&&e.measureText(l).width>o-12;)l=`${l.slice(0,-2)}…`;e.fillText(l,s+6,c+17)})});return}t.kind===`code`&&(e.fillStyle=`rgba(0,0,0,0.06)`,e.fillRect(t.x,t.y,552,t.h),e.font=`17px ui-monospace,SFMono-Regular,Menlo,Consolas,monospace`,e.fillStyle=r.ink,e.textBaseline=`top`,t.lines.slice(0,Math.ceil(t.lines.length*n)).forEach((n,r)=>e.fillText(n.slice(0,60),t.x+10,t.y+10+r*24)))}}function Gf(e,t){if(!t)return;e.font=`500 25px ${Pf}`;let n=Rf(e,t,Af-200).slice(-2),r=n.length*34+24;e.fillStyle=`rgba(15,18,24,0.72)`,e.beginPath(),e.roundRect?.(80,720-r-18,Af-160,r,14),e.fill(),e.fillStyle=`#ffffff`,e.textBaseline=`top`,n.forEach((t,n)=>e.fillText(t,(Af-e.measureText(t).width)/2,720-r-6+n*34))}function Kf(e,t,n){e.font=`600 17px ${Pf}`,e.fillStyle=n.soft,e.globalAlpha=.65,e.textBaseline=`top`,e.fillText(t,Af-e.measureText(t).width-26,22),e.globalAlpha=1}function qf(e,t,n){if(!e.say||!e.ops.length||!e.ops.some(e=>Number.isInteger(e.at)))return null;let r=ol(e.say).map(e=>[...rl(e)].length),i=r.reduce((e,t)=>e+t,0)||1,a=0,o=r.map(e=>{let t=a/i*n;return a+=e,t}),s=Math.max(0,r.length-1),c=0;return e.ops.map((e,n)=>{let r=Math.max(c,o[Math.min(e.at??0,s)]??0);return c=r+t[n],r})}async function Jf({steps:e,title:t,fetchAudio:n,watermark:r,theme:i=`light`,font:a=`hand`,onProgress:o,signal:s}){if(!Mf())throw Error(`unsupported`);if(Pf=a===`standard`?getComputedStyle(document.body).fontFamily||`system-ui,sans-serif`:Df,a!==`standard`&&document.fonts?.load){let t=`${dl(e)}${e.map(e=>rl(e.say)).join(``)}`,n=Promise.all([`Aha Hand Latin`,`Aha Hand`].map(e=>document.fonts.load(`25px '${e}'`,t))).catch(()=>void 0);await Promise.race([n,new Promise(e=>{setTimeout(e,8e3)})])}let c=jf[i]??jf.light,l=document.createElement(`canvas`);l.width=Af,l.height=720;let u=l.getContext(`2d`),{items:d,pages:f}=await Vf(u,e,c,i),p=null,m=[];if(n){p=new AudioContext;for(let[t,r]of e.entries()){if(s?.throwIfAborted(),o?.({phase:`audio`,done:t,total:e.length}),!r.say){m.push(null);continue}try{let e=await n(rl(r.say)),t=e.blob?await e.blob.arrayBuffer():Uint8Array.from(atob(e.base64),e=>e.charCodeAt(0)).buffer;m.push(await p.decodeAudioData(t))}catch{m.push(null)}}}let h=[],g=700;for(let[t,n]of e.entries()){let e=m[t]?m[t].duration*1e3:ze(n.say),r=He(n,{speechMs:e}),i=qf(n,r.writeMs,e),a=i?Math.max(r.durationMs,i.at(-1)+r.writeMs.at(-1)+350):r.durationMs;h.push({start:g,end:g+a,writes:r.writeMs,starts:i}),g+=a}let _=g+1500,v=t=>{let n=h.findIndex(e=>t<e.end);if(n<0)return{index:e.length,op:0,progress:1};let r=h[n],i=Math.max(0,t-r.start);if(r.starts){for(let e=0;e<r.writes.length;e+=1){let t=r.starts[e];if(i<t)return{index:n,op:e,progress:0};if(i<t+r.writes[e])return{index:n,op:e,progress:(i-t)/Math.max(1,r.writes[e])}}return{index:n,op:r.writes.length,progress:1}}let a=0;for(let e=0;e<r.writes.length;e+=1){if(i<a+r.writes[e])return{index:n,op:e,progress:(i-a)/Math.max(1,r.writes[e])};a+=r.writes[e]}return{index:n,op:r.writes.length,progress:1}},y=n=>{let i=v(n),a=e=>e.stepIndex<i.index?1:e.stepIndex>i.index?0:e.opIndex<i.op?1:e.opIndex>i.op?0:i.progress,o=d.filter(e=>a(e)>0),s=o.length?Math.max(...o.map(e=>e.page)):0;Hf(u,c);let l=f[s]?.title||(s===0||f[s]?.inherits?t:``);if(l){u.font=Ff(40,700),u.textBaseline=`top`;let e=u.measureText(l).width;u.fillStyle=c.marker,u.fillRect(60,74,e+8,18),u.fillStyle=c.head,u.fillText(l,64,52)}for(let e of o)e.page===s&&Wf(u,e,a(e),c);Gf(u,i.index<e.length?rl(e[i.index].say):``),r&&Kf(u,r,c)};y(0);let b=l.captureStream(30),x=0;if(p){await p.resume();let e=p.createMediaStreamDestination();x=p.currentTime+.4,m.forEach((t,n)=>{if(!t)return;let r=p.createBufferSource();r.buffer=t,r.connect(e),r.start(x+h[n].start/1e3)});for(let t of e.stream.getAudioTracks())b.addTrack(t)}let S=Nf(),C=new MediaRecorder(b,{...S?{mimeType:S}:{},videoBitsPerSecond:4e6}),w=[];C.ondataavailable=e=>{e.data?.size&&w.push(e.data)};let T=new Promise(e=>{C.onstop=e});C.start(1e3);let E=performance.now(),D=()=>p?(p.currentTime-x)*1e3:performance.now()-E;await new Promise((e,t)=>{let n=()=>{if(s?.aborted){t(s.reason??Error(`cancelled`));return}let r=D();y(Math.max(0,r)),o?.({phase:`record`,done:Math.min(_,Math.max(0,r)),total:_}),r>=_?e():requestAnimationFrame(n)};requestAnimationFrame(n)}).finally(()=>{C.state!==`inactive`&&C.stop()}),await T;for(let e of b.getTracks())e.stop();return await p?.close().catch(()=>void 0),new Blob(w,{type:S||`video/webm`})}function Yf(){let{api:e,t,settings:n,toast:i}=v(),a=w(),[o,s]=(0,r.useState)(null),c=(0,r.useRef)(null);(0,r.useEffect)(()=>()=>c.current?.abort(),[]);async function l({steps:r,title:l}){if(!r?.length||o)return;if(!Mf()){i(t(`exportUnsupported`));return}let u=new AbortController;c.current=u,s({percent:0});try{let i=await Jf({steps:r,title:l,theme:n.boardTheme===`dark`||n.boardTheme!==`light`&&a?`dark`:`light`,font:n.boardFont===`standard`?`standard`:`hand`,watermark:`${t(`appName`)} · ${t(`appTagline`)}`,fetchAudio:n.voiceEngine===`cloud`?t=>at(e,t):null,signal:u.signal,onProgress:e=>s({percent:Math.round(e.done/Math.max(1,e.total)*100),phase:e.phase})});g(`${m(l)}.webm`,i)}catch(e){u.signal.aborted||i(e.message===`unsupported`?t(`exportUnsupported`):e?.code?Ul(t,e):t(`exportFailed`))}finally{s(null)}}return{exporting:o,start:l,cancel:()=>c.current?.abort(),cloud:n.voiceEngine===`cloud`}}function Xf({courseId:e,lessonId:t}){let{api:n,t:a,navigate:o}=v(),s=y(()=>n.call(`lesson/get`,{courseId:e,lessonId:t}),[e,t]),[c,l]=(0,r.useState)(null),[u,d]=(0,r.useState)(null),[f,p]=(0,r.useState)(!1),[m,h]=(0,r.useState)(0),g=(0,r.useRef)(null),_=Yf();if((0,r.useEffect)(()=>{if(!s.value)return;if(s.value.board&&m===0){l({steps:s.value.board.steps,stream:null});return}let r=!0;return n.call(`lesson/prepare`,{courseId:e,lessonId:t,force:m>0}).then(e=>{r&&l(e.board?{steps:e.board.steps,stream:null}:{steps:[],stream:e.job})}).catch(e=>{r&&d(e)}),()=>{r=!1}},[s.value,m]),(0,r.useEffect)(()=>()=>clearTimeout(g.current),[]),s.loading&&!s.value)return(0,i.jsx)(`div`,{className:`aha-page`,children:(0,i.jsx)(Rl,{label:a(`loading`)})});if(!s.value)return(0,i.jsx)(`div`,{className:`aha-page`,children:(0,i.jsx)(Wl,{error:s.error})});let{lesson:b,unit:x,lecture:S,language:C,state:w}=s.value,T=w?.status===`learning`?Math.max(0,w.stepIndex??0):0;return(0,i.jsxs)(`div`,{className:`aha-page`,"data-wide":`true`,children:[u?(0,i.jsx)(Wl,{error:u}):null,c?(0,i.jsx)(Qu,{scope:{kind:`lesson`,courseId:e,lessonId:t},title:b.title,crumb:`${x.title} · ${S.title}`,steps:c.steps,stream:c.stream,asides:m===0?s.value.asides??[]:[],objectives:b.objectives??[],language:C,startIndex:c.stream?0:T,onPosition:r=>{clearTimeout(g.current),g.current=setTimeout(()=>{n.call(`lesson/position`,{courseId:e,lessonId:t,stepIndex:r}).catch(()=>void 0)},800)},onEnded:()=>p(!0),onStreamDone:e=>{e?.board?.steps?.length&&l(t=>({...t,steps:e.board.steps}))},header:({steps:n})=>(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,"data-size":`sm`,onClick:()=>o(`course`,{courseId:e}),children:[`← `,a(`backToCourse`)]}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,"data-size":`sm`,onClick:()=>o(`practice`,{courseId:e,lessonId:t}),children:a(`practice`)}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,"data-size":`sm`,disabled:!n.length,title:a(`handoutHint`),onClick:()=>o(`handout`,{courseId:e,lessonId:t}),children:a(`handout`)}),(0,i.jsx)(Tf,{steps:n,title:b.title}),_.exporting?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(Rl,{label:a(`exporting`,{percent:_.exporting.percent})}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,"data-size":`sm`,onClick:_.cancel,children:a(`cancel`)})]}):(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,"data-size":`sm`,disabled:!c.steps.length,title:_.cloud?``:a(`exportNeedsCloud`),onClick:()=>_.start({steps:c.steps,title:b.title}),children:a(`exportVideo`)}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,"data-size":`sm`,onClick:()=>{l(null),p(!1),h(e=>e+1)},children:a(`regenerateLesson`)})]})},`${m}`):(0,i.jsx)(Rl,{label:a(`preparingLesson`)}),f?(0,i.jsx)(Zf,{courseId:e,lessonId:t,onClose:()=>p(!1)}):null]})}function Zf({courseId:e,lessonId:t,onClose:n}){let{api:a,t:o,navigate:s}=v(),[c,l]=(0,r.useState)(null),[u,d]=(0,r.useState)(null),[f,p]=(0,r.useState)(!1),[m,h]=(0,r.useState)(null);async function g(n){l(n),p(!0);try{d(await a.call(`lesson/complete`,{courseId:e,lessonId:t,selfRating:n}))}catch(e){h(e)}finally{p(!1)}}return(0,i.jsxs)(Vl,{title:o(`lessonDone`),onClose:n,children:[u?(0,i.jsxs)(`div`,{className:`aha-col`,children:[u.inserted?(0,i.jsx)(`div`,{className:`aha-feedback`,children:o(`remedialAdded`,{title:u.inserted.title})}):null,u.recommendation?.action===`challenge`?(0,i.jsx)(`div`,{className:`aha-feedback`,"data-ok":`true`,children:o(`challengeNote`)}):null,(0,i.jsxs)(`div`,{className:`aha-row`,children:[u.next?(0,i.jsxs)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,onClick:()=>s(`lesson`,{courseId:e,lessonId:u.next.id},{replace:!0}),children:[o(`nextLesson`),`: `,u.next.title]}):null,(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,onClick:()=>s(`practice`,{courseId:e,lessonId:t}),children:o(`doPractice`)}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,onClick:()=>s(`handout`,{courseId:e,lessonId:t}),children:o(`handoutOfLesson`)}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,onClick:()=>s(`course`,{courseId:e},{replace:!0}),children:o(`backToCourse`)})]})]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`p`,{children:o(`selfRate`)}),(0,i.jsx)(`div`,{className:`aha-row`,children:[[1,`rate1`],[2,``],[3,`rate3`],[4,``],[5,`rate5`]].map(([e,t])=>(0,i.jsxs)(`button`,{type:`button`,className:`aha-chip`,"data-active":c===e,disabled:f,onClick:()=>g(e),children:[e,t?` · ${o(t)}`:``]},e))}),f?(0,i.jsx)(Rl,{}):null]}),(0,i.jsx)(Wl,{error:m})]})}let Qf=e=>e.replace(/[.*+?^${}()|[\]\\]/gu,`\\$&`);function $f({text:e,query:t}){let n=[...new Set(t.split(/\s+/u).filter(Boolean))].sort((e,t)=>t.length-e.length);if(!n.length)return e;let a=RegExp(`(${n.map(Qf).join(`|`)})`,`giu`);return e.split(a).map((e,t)=>t%2?(0,i.jsx)(`mark`,{children:e},t):(0,i.jsx)(r.Fragment,{children:e},t))}function ep(){let{api:e,t,navigate:n,toast:a}=v(),o=y(()=>e.call(`material/list`),[]),[s,c]=(0,r.useState)(null),[l,u]=(0,r.useState)(null),[d,f]=(0,r.useState)(null),[p,m]=(0,r.useState)(``),[h,g]=(0,r.useState)(null),[_,b]=(0,r.useState)(!1),[x,S]=(0,r.useState)(null);async function C(t){t?.preventDefault();let n=p.trim();if(n){b(!0),u(null);try{let{results:t}=await e.call(`material/search`,{query:n});g({query:n,results:t})}catch(e){u(e)}finally{b(!1)}}}(0,r.useEffect)(()=>{if(!x)return;document.querySelector(`[data-material="${x}"]`)?.scrollIntoView({block:`center`,behavior:`smooth`});let e=setTimeout(()=>S(null),1700);return()=>clearTimeout(e)},[x]);let w=p.trim().toLowerCase(),T=(o.value??[]).filter(e=>h||!w||e.title.toLowerCase().includes(w)||(e.brief?.topics??[]).some(e=>e.toLowerCase().includes(w))||(e.brief?.summary??``).toLowerCase().includes(w));async function E(r,i){c(`${r}:${i.id}`),u(null);try{if(r===`course`){let{job:t}=await e.call(`course/start`,{goal:i.brief?.suggestedGoal??``,materialIds:[i.id]});n(`craft`,{jobId:t.id});return}let o={sheet:`studio/sheet`,cards:`studio/cards`,notes:`studio/notes`,quiz:`studio/quiz`}[r],s=await e.run(o,{materialIds:[i.id]});a(t(`saved`)),r===`sheet`?n(`sheet`,{sheetId:s.item.id}):r===`cards`?n(`cards`,{deckId:s.item.id}):r===`notes`?n(`item`,{kind:`notes`,id:s.item.id}):n(`item`,{kind:`quiz`,id:s.item.id})}catch(e){u(e)}finally{c(null)}}return(0,i.jsxs)(`div`,{className:`aha-page`,children:[(0,i.jsxs)(`div`,{className:`aha-col`,style:{gap:4},children:[(0,i.jsx)(`h2`,{className:`aha-title`,children:t(`materialsTitle`)}),(0,i.jsx)(`p`,{className:`aha-hint`,children:t(`materialsHint`)})]}),(0,i.jsx)(Jl,{onAdded:()=>o.reload()}),(o.value??[]).length?(0,i.jsxs)(`form`,{className:`aha-row aha-librarySearch`,onSubmit:C,role:`search`,children:[(0,i.jsx)(`input`,{className:`aha-input`,type:`search`,value:p,placeholder:t(`librarySearch`),"aria-label":t(`librarySearch`),onChange:e=>{m(e.currentTarget.value),g(null)}}),(0,i.jsxs)(`button`,{type:`submit`,className:`aha-btn`,disabled:!p.trim()||_,children:[_?(0,i.jsx)(`span`,{className:`aha-spinner`}):null,t(`librarySearchText`)]})]}):null,h?(0,i.jsxs)(`section`,{className:`aha-card aha-libraryHits`,"aria-live":`polite`,children:[(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsx)(`b`,{children:h.results.length?t(`libraryFound`,{count:h.results.length}):t(`libraryNotFound`,{query:h.query})}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,"data-size":`sm`,onClick:()=>{g(null),m(``)},children:t(`close`)})]}),h.results.map((e,n)=>(0,i.jsxs)(`button`,{type:`button`,className:`aha-libraryHit`,onClick:()=>S(e.materialId),children:[(0,i.jsxs)(`span`,{className:`aha-libraryHitWhere`,children:[(0,i.jsx)(`b`,{children:e.title}),e.page?` · ${t(`pageN`,{page:e.page})}`:e.slide?` · ${t(`slideN`,{slide:e.slide})}`:``]}),(0,i.jsx)(`span`,{className:`aha-libraryHitText`,children:(0,i.jsx)($f,{text:e.snippet,query:h.query})})]},n))]}):null,(0,i.jsx)(Wl,{error:l??o.error}),o.loading&&!o.value?(0,i.jsx)(Rl,{label:t(`loading`)}):T.length?(0,i.jsx)(`div`,{className:`aha-col`,children:T.map(e=>(0,i.jsxs)(`div`,{className:`aha-card`,"data-material":e.id,"data-flash":x===e.id?`true`:void 0,children:[(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsxs)(`div`,{className:`aha-col`,style:{gap:2},children:[(0,i.jsx)(`b`,{children:e.title}),(0,i.jsx)(`span`,{className:`aha-hint`,children:Xl(e,t)})]}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,"data-size":`sm`,onClick:()=>f(e),children:t(`delete`)})]}),Zl(e,t).map(e=>(0,i.jsx)(`p`,{className:`aha-hint aha-readingNote`,children:e},e)),e.brief?.summary?(0,i.jsx)(`p`,{className:`aha-hint`,children:e.brief.summary}):null,e.brief?.topics?.length?(0,i.jsx)(`div`,{className:`aha-row`,style:{gap:4},children:e.brief.topics.slice(0,10).map(e=>(0,i.jsx)(`span`,{className:`aha-tag`,children:e},e))}):null,e.kind!==`image`||e.chars>0?(0,i.jsxs)(`div`,{className:`aha-row`,style:{gap:6},children:[[[`course`,`makeCourse`],[`sheet`,`makeSheet`],[`cards`,`makeCards`],[`notes`,`makeNotes`],[`quiz`,`makeQuiz`]].map(([n,r])=>(0,i.jsxs)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,"data-kind":n===`course`?`primary`:void 0,disabled:!!s,onClick:()=>E(n,e),children:[s===`${n}:${e.id}`?(0,i.jsx)(`span`,{className:`aha-spinner`}):null,t(r)]},n)),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,onClick:()=>n(`item`,{kind:`digest`,materialId:e.id}),children:t(`digest`)})]}):(0,i.jsx)(`p`,{className:`aha-hint`,children:t(`imageNeedsVision`)})]},e.id))}):(0,i.jsx)(Gl,{children:(o.value??[]).length?t(`libraryNoTitleMatch`):t(`noMaterials`)}),d?(0,i.jsx)(Hl,{danger:!0,text:`${t(`delete`)}「${d.title}」?`,onCancel:()=>f(null),onConfirm:async()=>{await e.call(`material/remove`,{id:d.id}),f(null),o.reload()}}):null]})}let tp=[60,120,180,240,300,420,600,900];function np(){let{api:e,t,navigate:n}=v(),a=y(()=>e.call(`plan/get`,{today:Hd(new Date)}),[]),o=y(()=>e.call(`review/session`),[]),s=y(()=>e.call(`course/list`),[]),[c,l]=(0,r.useState)(300),[u,d]=(0,r.useState)([1,2,3,4,5,6,0]),[f,p]=(0,r.useState)({title:``,day:``,courseId:``}),[m,h]=(0,r.useState)(null),g=t(`weekdays`).split(`,`),_=Hd(new Date),[b,x]=(0,r.useState)(_);(0,r.useEffect)(()=>{a.value&&(l(a.value.settings.weeklyMinutes),d(a.value.settings.studyDays))},[a.value?.settings]);async function S(){h(null);try{a.setValue(await e.call(`plan/settings`,{weeklyMinutes:c,studyDays:u}))}catch(e){h(e)}}async function C(t){if(t.preventDefault(),!(!f.title.trim()||!f.day))try{a.setValue(await e.call(`plan/add-exam`,{...f,courseId:f.courseId||void 0})),p({title:``,day:``,courseId:``})}catch(e){h(e)}}async function w(t,n){h(null);try{a.setValue(await Vd(e,t,n,_))}catch(e){h(e)}}let T=e=>s.value?.find(t=>t.id===e)?.title??``,E=a.value?.calendar??[],D=E.find(e=>e.day===b)?.items??[];return(0,i.jsxs)(`div`,{className:`aha-page`,children:[(0,i.jsxs)(`div`,{className:`aha-col`,style:{gap:4},children:[(0,i.jsx)(`h2`,{className:`aha-title`,children:t(`planTitle`)}),(0,i.jsx)(`p`,{className:`aha-hint`,children:t(`planHint`)})]}),(0,i.jsx)(`section`,{className:`aha-card`,children:(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsx)(`b`,{children:o.value?.items?.length?t(`reviewDue`,{count:o.value.items.length}):t(`nothingToReview`)}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,disabled:!o.value?.items?.length,onClick:()=>n(`practice`,{review:!0}),children:t(`startReview`)})]})}),(0,i.jsxs)(`section`,{className:`aha-card`,children:[(0,i.jsxs)(`div`,{className:`aha-row`,children:[(0,i.jsxs)(`label`,{className:`aha-label`,style:{minWidth:200},children:[t(`weeklyMinutes`),(0,i.jsx)(`select`,{className:`aha-select`,value:c,onChange:e=>l(Number(e.currentTarget.value)),children:tp.map(e=>(0,i.jsx)(`option`,{value:e,children:t(`minutesUnit`,{minutes:e})},e))})]}),(0,i.jsxs)(`div`,{className:`aha-label`,children:[t(`studyDays`),(0,i.jsx)(`div`,{className:`aha-row`,style:{gap:4},children:[1,2,3,4,5,6,0].map(e=>(0,i.jsx)(`button`,{type:`button`,className:`aha-chip`,"data-active":u.includes(e),onClick:()=>d(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),children:g[e]},e))})]}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,onClick:S,children:t(`savePlan`)})]}),(a.value?.plan.warnings??[]).filter(e=>e.kind===`deadline-at-risk`).map(e=>(0,i.jsx)(`div`,{className:`aha-feedback`,"data-ok":`false`,children:t(`deadlineRisk`,{course:T(e.courseId),finish:e.finishDay,deadline:e.deadline,minutes:e.neededWeeklyMinutes})},e.courseId))]}),(0,i.jsxs)(`section`,{className:`aha-card`,children:[(0,i.jsx)(`b`,{children:t(`exams`)}),(a.value?.exams??[]).map(n=>(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsxs)(`span`,{children:[n.title,` · `,n.day,n.courseId?` · ${T(n.courseId)}`:``]}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,"data-size":`sm`,onClick:async()=>a.setValue(await e.call(`plan/remove-exam`,{id:n.id})),children:t(`delete`)})]},n.id)),(0,i.jsxs)(`form`,{className:`aha-row`,onSubmit:C,children:[(0,i.jsx)(`input`,{className:`aha-input`,style:{flex:2,minWidth:160},placeholder:t(`examTitle`),value:f.title,onChange:e=>p({...f,title:e.currentTarget.value})}),(0,i.jsx)(`input`,{className:`aha-input`,style:{flex:1,minWidth:140},type:`date`,value:f.day,onChange:e=>p({...f,day:e.currentTarget.value})}),(0,i.jsxs)(`select`,{className:`aha-select`,style:{flex:1,minWidth:140},value:f.courseId,onChange:e=>p({...f,courseId:e.currentTarget.value}),children:[(0,i.jsx)(`option`,{value:``,children:`—`}),(s.value??[]).filter(e=>e.status===`ready`).map(e=>(0,i.jsx)(`option`,{value:e.id,children:e.title},e.id))]}),(0,i.jsx)(`button`,{type:`submit`,className:`aha-btn`,children:t(`addExam`)})]})]}),(0,i.jsx)(Wl,{error:m??a.error}),a.loading&&!a.value?(0,i.jsx)(Rl,{label:t(`loading`)}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(ap,{days:E,today:_,selected:b,onSelect:x,weekdayNames:g}),(0,i.jsxs)(`section`,{className:`aha-card`,children:[(0,i.jsxs)(`b`,{children:[b===_?`${t(`today`)} · `:``,t(`dayLabel`,{month:Ud(b).getMonth()+1,day:Ud(b).getDate(),weekday:g[Ud(b).getDay()]})]}),D.length?D.map(e=>(0,i.jsx)(Bd,{item:e,day:b,today:_,onToggle:w},`${e.kind}:${e.refId}`)):(0,i.jsx)(`p`,{className:`aha-hint`,children:t(b===_?`noPlanToday`:`dayEmpty`)})]})]})]})}let rp=e=>String(e).padStart(2,`0`),ip=(e,t)=>{let n=Ud(`${e}-01`);return n.setMonth(n.getMonth()+t),`${n.getFullYear()}-${rp(n.getMonth()+1)}`};function ap({days:e,today:t,selected:n,onSelect:a,weekdayNames:o}){let{t:s}=v(),[c,l]=(0,r.useState)(t.slice(0,7)),u=(0,r.useMemo)(()=>new Map(e.map(e=>[e.day,e.items])),[e]),d=Ud(`${c}-01`),f=new Date(d.getFullYear(),d.getMonth()+1,0).getDate(),p=[...Array((d.getDay()+6)%7).fill(null),...Array.from({length:f},(e,t)=>`${c}-${rp(t+1)}`)];return(0,i.jsxs)(`section`,{className:`aha-card aha-calendar`,children:[(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,"data-size":`sm`,onClick:()=>l(e=>ip(e,-1)),"aria-label":s(`prevMonth`),children:`‹`}),(0,i.jsx)(`b`,{children:s(`monthLabel`,{year:d.getFullYear(),month:d.getMonth()+1})}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,"data-size":`sm`,onClick:()=>l(e=>ip(e,1)),"aria-label":s(`nextMonth`),children:`›`})]}),(0,i.jsxs)(`div`,{className:`aha-calGrid`,children:[[1,2,3,4,5,6,0].map(e=>(0,i.jsx)(`span`,{className:`aha-calHead`,children:o[e]},e)),p.map((e,r)=>{if(!e)return(0,i.jsx)(`span`,{},`gap${r}`);let o=u.get(e)??[],s=o.length>0&&o.every(e=>e.kind===`exam`||e.checked);return(0,i.jsxs)(`button`,{type:`button`,className:`aha-calDay`,"data-today":e===t?`true`:void 0,"data-selected":e===n?`true`:void 0,"data-past":e<t?`true`:void 0,onClick:()=>a(e),children:[(0,i.jsxs)(`span`,{className:`aha-calNum`,children:[Number(e.slice(8)),s?` ✓`:``]}),o.slice(0,3).map(e=>(0,i.jsx)(`span`,{className:`aha-calItem`,"data-kind":e.kind,"data-checked":e.checked?`true`:void 0,children:e.title},`${e.kind}:${e.refId}`)),o.length>3?(0,i.jsxs)(`span`,{className:`aha-calMore`,children:[`+`,o.length-3]}):null]},e)})]})]})}let op=[[`goals`,`goals`],[`strengths`,`strengthsLabel`],[`weaknesses`,`weaknesses`]];function sp(){let{api:e,t,toast:n}=v(),a=y(()=>e.call(`profile/get`),[]),[o,s]=(0,r.useState)(null),[c,l]=(0,r.useState)(!1),[u,d]=(0,r.useState)(null);(0,r.useEffect)(()=>{a.value&&s({name:a.value.name??``,background:a.value.background,goals:a.value.goals.join(`
|
|
713
|
+
`,jf=1280,Mf={light:{paper:`#fdfcf8`,dot:`rgba(40,50,80,0.07)`,ink:`#23262f`,soft:`#4a4f5c`,head:`#1f4fb8`,marker:`rgba(255,214,79,0.62)`,accent:`#d64545`,note:`#fff7da`,noteLine:`#e9c45a`,pencil:`#c98a2c`},dark:{paper:`#1d2622`,dot:`rgba(255,255,255,0.06)`,ink:`#ecebe4`,soft:`#c9c8bf`,head:`#9cc2ff`,marker:`rgba(214,178,58,0.45)`,accent:`#ff8a80`,note:`#2a3530`,noteLine:`#8f7a2f`,pencil:`#e7c27a`}};function Nf(){return typeof MediaRecorder==`function`&&typeof document.createElement(`canvas`).captureStream==`function`}function Pf(){for(let e of[`video/webm;codecs=vp9,opus`,`video/webm;codecs=vp8,opus`,`video/webm`])if(MediaRecorder.isTypeSupported?.(e))return e;return``}let Ff=Of;function If(e,t=400){return`${t} ${e}px ${Ff}`}let Lf=/^[,。、;:!?)」』”’》〉】〕…‥·,.;:!?)\]}%]/u,Rf=/[(「『“‘《〈【〔(\[{]$/u;function zf(e,t,n){let r=[];for(let i of String(t).split(`
|
|
714
|
+
`)){let t=``,a=i.match(/[ -鿿가--]|[^\s -鿿가--]+|\s+/gu)??[];for(let i of a){let a=t+i;if(e.measureText(a).width>n&&t.trim()&&!Lf.test(i)){let e=``;Rf.test(t)&&t.length>1&&(e=t.slice(-1),t=t.slice(0,-1)),r.push(t.trimEnd()),t=(e+i).trimStart()}else t=a}r.push(t.trimEnd())}return r}function Bf(e,t,n){if(!e)return e;let r=n===`dark`?`[stroke="#2b2b2b"],[stroke="#23262f"]{stroke:${t.ink}}[fill="#2b2b2b"],[fill="#23262f"]{fill:${t.ink}}`:``,i=`<style>svg{color:${t.ink}}text:not([fill]){fill:${t.ink}}${r}</style>`;return e.replace(/<svg\b[^>]*>/iu,e=>e.endsWith(`/>`)?e:`${e}${i}`)}function Vf(e){return new Promise(t=>{if(!e){t(null);return}let n=new Image;n.onload=()=>t(n),n.onerror=()=>t(null),n.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`})}async function Hf(e,t,n,r){let i=[],a=[{title:``}],o=0,s=132,c=()=>64+o*600,l=()=>{if(o===0)o=1;else{let e=a[a.length-1];a.push({title:e.title,inherits:e.inherits??a.length===1}),o=0}s=132},u=(e,t)=>{s>132&&s+e>602&&l(),i.push({...t,page:a.length-1,x:c(),y:s,h:e}),s+=e+14};for(let[c,d]of t.entries())for(let[t,f]of d.ops.entries()){let d={op:f,stepIndex:c,opIndex:t};if(f.t===`page`){i.some(e=>e.page===a.length-1)?(a.push({title:f.title??``}),o=0,s=132):a[a.length-1].title=f.title??``;continue}if(f.t===`col`){l();continue}if(f.t===`mark`)continue;if(f.t===`title`){i.some(e=>e.page===a.length-1)?(a.push({title:f.text}),o=0,s=132):a[a.length-1].title=f.text,i.push({...d,page:a.length-1,kind:`title`,text:rl(f.text)});continue}if(f.t===`h`||f.t===`p`||f.t===`note`||f.t===`math`||f.t===`list`){let t=f.t===`h`?31:f.t===`math`?28:25;e.font=If(t,f.t===`h`?700:400);let r=zf(e,f.t===`math`?f.text||nl(f.tex):f.t===`list`?f.items.map((e,t)=>`${f.ordered?`${t+1}.`:`•`} ${rl(e)}`).join(`
|
|
715
|
+
`):rl(f.text),552-(f.t===`note`?28:0)),i=Math.round(t*1.42);u(r.length*i+(f.t===`note`?22:0),{...d,kind:`text`,size:t,weight:f.t===`h`?700:400,lines:r,lineHeight:i,color:f.t===`h`?n.head:n.ink,center:f.t===`math`,note:f.t===`note`,marker:f.t===`h`});continue}let p=f.t===`chart`?Pt(f):f.t===`plot`?nc(f):f.t===`svg`?lc(f.svg):f.t===`anim`&&f.poster?lc(f.poster):``,m=p?await Vf(Bf(p,n,r)):null;if(m){let e=m.naturalHeight/Math.max(1,m.naturalWidth)||.62,t=Math.min(552,m.naturalWidth||552),n=Math.min(300,t*e);u(n+(f.caption?30:0),{...d,kind:`image`,image:m,w:n/e,imageH:n,caption:f.caption??``});continue}if(!(f.t===`svg`||f.t===`chart`||f.t===`plot`)){if(f.t===`table`){let e=[f.head,...f.rows].filter(e=>e.length).slice(0,10);u(e.length*34+6,{...d,kind:`table`,rows:e});continue}if(f.t===`code`){let e=f.code.split(`
|
|
716
|
+
`).slice(0,14);u(e.length*24+20,{...d,kind:`code`,lines:e});continue}f.t===`anim`&&u(90,{...d,kind:`text`,size:22,weight:400,lines:[`▶ ${f.caption||`animation`}`],lineHeight:32,color:n.soft,note:!0})}}return{items:i,pages:a}}function Uf(e,t){e.fillStyle=t.paper,e.fillRect(0,0,jf,720),e.fillStyle=t.dot;for(let t=12;t<jf;t+=24)for(let n=12;n<720;n+=24)e.fillRect(t,n,1.6,1.6)}function Wf(e,t,n,r){e.save(),e.translate(t,n),e.rotate(-.6),e.fillStyle=r.pencil,e.fillRect(0,-5,34,10),e.fillStyle=r.accent,e.fillRect(34,-5,7,10),e.beginPath(),e.moveTo(0,-5),e.lineTo(-10,0),e.lineTo(0,5),e.closePath(),e.fillStyle=r.ink,e.fill(),e.restore()}function Gf(e,t,n,r){if(t.kind!==`title`){if(t.kind===`text`){e.font=If(t.size,t.weight),e.textBaseline=`top`,t.note&&(e.fillStyle=r.note,e.strokeStyle=r.noteLine,e.lineWidth=2,e.beginPath(),e.roundRect?.(t.x,t.y,552,t.h,12),e.fill(),e.stroke());let i=t.lines.reduce((e,t)=>e+[...t].length,0),a=Math.floor(i*n),o=null;t.lines.forEach((n,i)=>{if(a<=0)return;let s=[...n],c=s.slice(0,a).join(``);a-=s.length;let l=e.measureText(c).width,u=t.center?t.x+(552-e.measureText(n).width)/2:t.x+(t.note?14:0),d=t.y+(t.note?11:0)+i*t.lineHeight;t.marker&&(e.fillStyle=r.marker,e.fillRect(u-2,d+t.size*.62,l+4,t.size*.38)),e.fillStyle=t.color,e.fillText(c,u,d),o={x:u+l,y:d+t.size}}),o&&n<1&&Wf(e,o.x,o.y,r);return}if(t.kind===`image`){e.save(),e.beginPath(),e.rect(t.x,t.y,t.w*n,t.imageH),e.clip(),e.drawImage(t.image,t.x,t.y,t.w,t.imageH),e.restore(),t.caption&&n>=1&&(e.font=If(18),e.fillStyle=r.soft,e.textBaseline=`top`,e.fillText(t.caption,t.x,t.y+t.imageH+6)),n<1&&Wf(e,t.x+t.w*n,t.y+t.imageH/2,r);return}if(t.kind===`table`){let i=t.rows.slice(0,Math.max(1,Math.ceil(t.rows.length*n))),a=Math.max(...t.rows.map(e=>e.length)),o=552/Math.max(1,a);e.font=If(19),e.textBaseline=`middle`,e.strokeStyle=r.soft,e.lineWidth=1.4,i.forEach((n,i)=>{n.forEach((n,a)=>{let s=t.x+a*o,c=t.y+i*34;e.strokeRect(s,c,o,34),e.fillStyle=i===0?r.head:r.ink;let l=rl(n);for(;l.length>1&&e.measureText(l).width>o-12;)l=`${l.slice(0,-2)}…`;e.fillText(l,s+6,c+17)})});return}t.kind===`code`&&(e.fillStyle=`rgba(0,0,0,0.06)`,e.fillRect(t.x,t.y,552,t.h),e.font=`17px ui-monospace,SFMono-Regular,Menlo,Consolas,monospace`,e.fillStyle=r.ink,e.textBaseline=`top`,t.lines.slice(0,Math.ceil(t.lines.length*n)).forEach((n,r)=>e.fillText(n.slice(0,60),t.x+10,t.y+10+r*24)))}}function Kf(e,t){if(!t)return;e.font=`500 25px ${Ff}`;let n=zf(e,t,jf-200).slice(-2),r=n.length*34+24;e.fillStyle=`rgba(15,18,24,0.72)`,e.beginPath(),e.roundRect?.(80,720-r-18,jf-160,r,14),e.fill(),e.fillStyle=`#ffffff`,e.textBaseline=`top`,n.forEach((t,n)=>e.fillText(t,(jf-e.measureText(t).width)/2,720-r-6+n*34))}function qf(e,t,n){e.font=`600 17px ${Ff}`,e.fillStyle=n.soft,e.globalAlpha=.65,e.textBaseline=`top`,e.fillText(t,jf-e.measureText(t).width-26,22),e.globalAlpha=1}function Jf(e,t,n){if(!e.say||!e.ops.length||!e.ops.some(e=>Number.isInteger(e.at)))return null;let r=ol(e.say).map(e=>[...rl(e)].length),i=r.reduce((e,t)=>e+t,0)||1,a=0,o=r.map(e=>{let t=a/i*n;return a+=e,t}),s=Math.max(0,r.length-1),c=0;return e.ops.map((e,n)=>{let r=Math.max(c,o[Math.min(e.at??0,s)]??0);return c=r+t[n],r})}async function Yf({steps:e,title:t,fetchAudio:n,watermark:r,theme:i=`light`,font:a=`hand`,onProgress:o,signal:s}){if(!Nf())throw Error(`unsupported`);if(Ff=a===`standard`?getComputedStyle(document.body).fontFamily||`system-ui,sans-serif`:Of,a!==`standard`&&document.fonts?.load){let t=`${dl(e)}${e.map(e=>rl(e.say)).join(``)}`,n=Promise.all([`Aha Hand Latin`,`Aha Hand`].map(e=>document.fonts.load(`25px '${e}'`,t))).catch(()=>void 0);await Promise.race([n,new Promise(e=>{setTimeout(e,8e3)})])}let c=Mf[i]??Mf.light,l=document.createElement(`canvas`);l.width=jf,l.height=720;let u=l.getContext(`2d`),{items:d,pages:f}=await Hf(u,e,c,i),p=null,m=[];if(n){p=new AudioContext;for(let[t,r]of e.entries()){if(s?.throwIfAborted(),o?.({phase:`audio`,done:t,total:e.length}),!r.say){m.push(null);continue}try{let e=await n(rl(r.say)),t=e.blob?await e.blob.arrayBuffer():Uint8Array.from(atob(e.base64),e=>e.charCodeAt(0)).buffer;m.push(await p.decodeAudioData(t))}catch{m.push(null)}}}let h=[],g=700;for(let[t,n]of e.entries()){let e=m[t]?m[t].duration*1e3:ze(n.say),r=He(n,{speechMs:e}),i=Jf(n,r.writeMs,e),a=i?Math.max(r.durationMs,i.at(-1)+r.writeMs.at(-1)+350):r.durationMs;h.push({start:g,end:g+a,writes:r.writeMs,starts:i}),g+=a}let _=g+1500,v=t=>{let n=h.findIndex(e=>t<e.end);if(n<0)return{index:e.length,op:0,progress:1};let r=h[n],i=Math.max(0,t-r.start);if(r.starts){for(let e=0;e<r.writes.length;e+=1){let t=r.starts[e];if(i<t)return{index:n,op:e,progress:0};if(i<t+r.writes[e])return{index:n,op:e,progress:(i-t)/Math.max(1,r.writes[e])}}return{index:n,op:r.writes.length,progress:1}}let a=0;for(let e=0;e<r.writes.length;e+=1){if(i<a+r.writes[e])return{index:n,op:e,progress:(i-a)/Math.max(1,r.writes[e])};a+=r.writes[e]}return{index:n,op:r.writes.length,progress:1}},y=n=>{let i=v(n),a=e=>e.stepIndex<i.index?1:e.stepIndex>i.index?0:e.opIndex<i.op?1:e.opIndex>i.op?0:i.progress,o=d.filter(e=>a(e)>0),s=o.length?Math.max(...o.map(e=>e.page)):0;Uf(u,c);let l=f[s]?.title||(s===0||f[s]?.inherits?t:``);if(l){u.font=If(40,700),u.textBaseline=`top`;let e=u.measureText(l).width;u.fillStyle=c.marker,u.fillRect(60,74,e+8,18),u.fillStyle=c.head,u.fillText(l,64,52)}for(let e of o)e.page===s&&Gf(u,e,a(e),c);Kf(u,i.index<e.length?rl(e[i.index].say):``),r&&qf(u,r,c)};y(0);let b=l.captureStream(30),x=0;if(p){await p.resume();let e=p.createMediaStreamDestination();x=p.currentTime+.4,m.forEach((t,n)=>{if(!t)return;let r=p.createBufferSource();r.buffer=t,r.connect(e),r.start(x+h[n].start/1e3)});for(let t of e.stream.getAudioTracks())b.addTrack(t)}let S=Pf(),C=new MediaRecorder(b,{...S?{mimeType:S}:{},videoBitsPerSecond:4e6}),w=[];C.ondataavailable=e=>{e.data?.size&&w.push(e.data)};let T=new Promise(e=>{C.onstop=e});C.start(1e3);let E=performance.now(),D=()=>p?(p.currentTime-x)*1e3:performance.now()-E;await new Promise((e,t)=>{let n=()=>{if(s?.aborted){t(s.reason??Error(`cancelled`));return}let r=D();y(Math.max(0,r)),o?.({phase:`record`,done:Math.min(_,Math.max(0,r)),total:_}),r>=_?e():requestAnimationFrame(n)};requestAnimationFrame(n)}).finally(()=>{C.state!==`inactive`&&C.stop()}),await T;for(let e of b.getTracks())e.stop();return await p?.close().catch(()=>void 0),new Blob(w,{type:S||`video/webm`})}function Xf(){let{api:e,t,settings:n,toast:i}=v(),a=w(),[o,s]=(0,r.useState)(null),c=(0,r.useRef)(null);(0,r.useEffect)(()=>()=>c.current?.abort(),[]);async function l({steps:r,title:l}){if(!r?.length||o)return;if(!Nf()){i(t(`exportUnsupported`));return}let u=new AbortController;c.current=u,s({percent:0});try{let i=await Yf({steps:r,title:l,theme:n.boardTheme===`dark`||n.boardTheme!==`light`&&a?`dark`:`light`,font:n.boardFont===`standard`?`standard`:`hand`,watermark:`${t(`appName`)} · ${t(`appTagline`)}`,fetchAudio:n.voiceEngine===`cloud`?t=>at(e,t):null,signal:u.signal,onProgress:e=>s({percent:Math.round(e.done/Math.max(1,e.total)*100),phase:e.phase})});g(`${m(l)}.webm`,i)}catch(e){u.signal.aborted||i(e.message===`unsupported`?t(`exportUnsupported`):e?.code?Ul(t,e):t(`exportFailed`))}finally{s(null)}}return{exporting:o,start:l,cancel:()=>c.current?.abort(),cloud:n.voiceEngine===`cloud`}}function Zf({courseId:e,lessonId:t}){let{api:n,t:a,navigate:o}=v(),s=y(()=>n.call(`lesson/get`,{courseId:e,lessonId:t}),[e,t]),[c,l]=(0,r.useState)(null),[u,d]=(0,r.useState)(null),[f,p]=(0,r.useState)(!1),[m,h]=(0,r.useState)(0),g=(0,r.useRef)(null),_=Xf();if((0,r.useEffect)(()=>{if(!s.value)return;if(s.value.board&&m===0){l({steps:s.value.board.steps,stream:null});return}let r=!0;return n.call(`lesson/prepare`,{courseId:e,lessonId:t,force:m>0}).then(e=>{r&&l(e.board?{steps:e.board.steps,stream:null}:{steps:[],stream:e.job})}).catch(e=>{r&&d(e)}),()=>{r=!1}},[s.value,m]),(0,r.useEffect)(()=>()=>clearTimeout(g.current),[]),s.loading&&!s.value)return(0,i.jsx)(`div`,{className:`aha-page`,children:(0,i.jsx)(Rl,{label:a(`loading`)})});if(!s.value)return(0,i.jsx)(`div`,{className:`aha-page`,children:(0,i.jsx)(Wl,{error:s.error})});let{lesson:b,unit:x,lecture:S,language:C,state:w}=s.value,T=w?.status===`learning`?Math.max(0,w.stepIndex??0):0;return(0,i.jsxs)(`div`,{className:`aha-page`,"data-wide":`true`,children:[u?(0,i.jsx)(Wl,{error:u}):null,c?(0,i.jsx)(Qu,{scope:{kind:`lesson`,courseId:e,lessonId:t},title:b.title,crumb:`${x.title} · ${S.title}`,steps:c.steps,stream:c.stream,asides:m===0?s.value.asides??[]:[],objectives:b.objectives??[],language:C,startIndex:c.stream?0:T,onPosition:r=>{clearTimeout(g.current),g.current=setTimeout(()=>{n.call(`lesson/position`,{courseId:e,lessonId:t,stepIndex:r}).catch(()=>void 0)},800)},onEnded:()=>p(!0),onStreamDone:e=>{e?.board?.steps?.length&&l(t=>({...t,steps:e.board.steps}))},header:({steps:n})=>(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,"data-size":`sm`,onClick:()=>o(`course`,{courseId:e}),children:[`← `,a(`backToCourse`)]}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,"data-size":`sm`,onClick:()=>o(`practice`,{courseId:e,lessonId:t}),children:a(`practice`)}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,"data-size":`sm`,disabled:!n.length,title:a(`handoutHint`),onClick:()=>o(`handout`,{courseId:e,lessonId:t}),children:a(`handout`)}),(0,i.jsx)(Ef,{steps:n,title:b.title}),_.exporting?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(Rl,{label:a(`exporting`,{percent:_.exporting.percent})}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,"data-size":`sm`,onClick:_.cancel,children:a(`cancel`)})]}):(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,"data-size":`sm`,disabled:!c.steps.length,title:_.cloud?``:a(`exportNeedsCloud`),onClick:()=>_.start({steps:c.steps,title:b.title}),children:a(`exportVideo`)}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,"data-size":`sm`,onClick:()=>{l(null),p(!1),h(e=>e+1)},children:a(`regenerateLesson`)})]})},`${m}`):(0,i.jsx)(Rl,{label:a(`preparingLesson`)}),f?(0,i.jsx)(Qf,{courseId:e,lessonId:t,onClose:()=>p(!1)}):null]})}function Qf({courseId:e,lessonId:t,onClose:n}){let{api:a,t:o,navigate:s}=v(),[c,l]=(0,r.useState)(null),[u,d]=(0,r.useState)(null),[f,p]=(0,r.useState)(!1),[m,h]=(0,r.useState)(null);async function g(n){l(n),p(!0);try{d(await a.call(`lesson/complete`,{courseId:e,lessonId:t,selfRating:n}))}catch(e){h(e)}finally{p(!1)}}return(0,i.jsxs)(Vl,{title:o(`lessonDone`),onClose:n,children:[u?(0,i.jsxs)(`div`,{className:`aha-col`,children:[u.inserted?(0,i.jsx)(`div`,{className:`aha-feedback`,children:o(`remedialAdded`,{title:u.inserted.title})}):null,u.recommendation?.action===`challenge`?(0,i.jsx)(`div`,{className:`aha-feedback`,"data-ok":`true`,children:o(`challengeNote`)}):null,(0,i.jsxs)(`div`,{className:`aha-row`,children:[u.next?(0,i.jsxs)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,onClick:()=>s(`lesson`,{courseId:e,lessonId:u.next.id},{replace:!0}),children:[o(`nextLesson`),`: `,u.next.title]}):null,(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,onClick:()=>s(`practice`,{courseId:e,lessonId:t}),children:o(`doPractice`)}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,onClick:()=>s(`handout`,{courseId:e,lessonId:t}),children:o(`handoutOfLesson`)}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,onClick:()=>s(`course`,{courseId:e},{replace:!0}),children:o(`backToCourse`)})]})]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`p`,{children:o(`selfRate`)}),(0,i.jsx)(`div`,{className:`aha-row`,children:[[1,`rate1`],[2,``],[3,`rate3`],[4,``],[5,`rate5`]].map(([e,t])=>(0,i.jsxs)(`button`,{type:`button`,className:`aha-chip`,"data-active":c===e,disabled:f,onClick:()=>g(e),children:[e,t?` · ${o(t)}`:``]},e))}),f?(0,i.jsx)(Rl,{}):null]}),(0,i.jsx)(Wl,{error:m})]})}let $f=e=>e.replace(/[.*+?^${}()|[\]\\]/gu,`\\$&`);function ep({text:e,query:t}){let n=[...new Set(t.split(/\s+/u).filter(Boolean))].sort((e,t)=>t.length-e.length);if(!n.length)return e;let a=RegExp(`(${n.map($f).join(`|`)})`,`giu`);return e.split(a).map((e,t)=>t%2?(0,i.jsx)(`mark`,{children:e},t):(0,i.jsx)(r.Fragment,{children:e},t))}function tp(){let{api:e,t,navigate:n,toast:a}=v(),o=y(()=>e.call(`material/list`),[]),[s,c]=(0,r.useState)(null),[l,u]=(0,r.useState)(null),[d,f]=(0,r.useState)(null),[p,m]=(0,r.useState)(``),[h,g]=(0,r.useState)(null),[_,b]=(0,r.useState)(!1),[x,S]=(0,r.useState)(null);async function C(t){t?.preventDefault();let n=p.trim();if(n){b(!0),u(null);try{let{results:t}=await e.call(`material/search`,{query:n});g({query:n,results:t})}catch(e){u(e)}finally{b(!1)}}}(0,r.useEffect)(()=>{if(!x)return;document.querySelector(`[data-material="${x}"]`)?.scrollIntoView({block:`center`,behavior:`smooth`});let e=setTimeout(()=>S(null),1700);return()=>clearTimeout(e)},[x]);let w=p.trim().toLowerCase(),T=(o.value??[]).filter(e=>h||!w||e.title.toLowerCase().includes(w)||(e.brief?.topics??[]).some(e=>e.toLowerCase().includes(w))||(e.brief?.summary??``).toLowerCase().includes(w));async function E(r,i){c(`${r}:${i.id}`),u(null);try{if(r===`course`){let{job:t}=await e.call(`course/start`,{goal:i.brief?.suggestedGoal??``,materialIds:[i.id]});n(`craft`,{jobId:t.id});return}let o={sheet:`studio/sheet`,cards:`studio/cards`,notes:`studio/notes`,quiz:`studio/quiz`}[r],s=await e.run(o,{materialIds:[i.id]});a(t(`saved`)),r===`sheet`?n(`sheet`,{sheetId:s.item.id}):r===`cards`?n(`cards`,{deckId:s.item.id}):r===`notes`?n(`item`,{kind:`notes`,id:s.item.id}):n(`item`,{kind:`quiz`,id:s.item.id})}catch(e){u(e)}finally{c(null)}}return(0,i.jsxs)(`div`,{className:`aha-page`,children:[(0,i.jsxs)(`div`,{className:`aha-col`,style:{gap:4},children:[(0,i.jsx)(`h2`,{className:`aha-title`,children:t(`materialsTitle`)}),(0,i.jsx)(`p`,{className:`aha-hint`,children:t(`materialsHint`)})]}),(0,i.jsx)(Jl,{onAdded:()=>o.reload()}),(o.value??[]).length?(0,i.jsxs)(`form`,{className:`aha-row aha-librarySearch`,onSubmit:C,role:`search`,children:[(0,i.jsx)(`input`,{className:`aha-input`,type:`search`,value:p,placeholder:t(`librarySearch`),"aria-label":t(`librarySearch`),onChange:e=>{m(e.currentTarget.value),g(null)}}),(0,i.jsxs)(`button`,{type:`submit`,className:`aha-btn`,disabled:!p.trim()||_,children:[_?(0,i.jsx)(`span`,{className:`aha-spinner`}):null,t(`librarySearchText`)]})]}):null,h?(0,i.jsxs)(`section`,{className:`aha-card aha-libraryHits`,"aria-live":`polite`,children:[(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsx)(`b`,{children:h.results.length?t(`libraryFound`,{count:h.results.length}):t(`libraryNotFound`,{query:h.query})}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,"data-size":`sm`,onClick:()=>{g(null),m(``)},children:t(`close`)})]}),h.results.map((e,n)=>(0,i.jsxs)(`button`,{type:`button`,className:`aha-libraryHit`,onClick:()=>S(e.materialId),children:[(0,i.jsxs)(`span`,{className:`aha-libraryHitWhere`,children:[(0,i.jsx)(`b`,{children:e.title}),e.page?` · ${t(`pageN`,{page:e.page})}`:e.slide?` · ${t(`slideN`,{slide:e.slide})}`:``]}),(0,i.jsx)(`span`,{className:`aha-libraryHitText`,children:(0,i.jsx)(ep,{text:e.snippet,query:h.query})})]},n))]}):null,(0,i.jsx)(Wl,{error:l??o.error}),o.loading&&!o.value?(0,i.jsx)(Rl,{label:t(`loading`)}):T.length?(0,i.jsx)(`div`,{className:`aha-col`,children:T.map(e=>(0,i.jsxs)(`div`,{className:`aha-card`,"data-material":e.id,"data-flash":x===e.id?`true`:void 0,children:[(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsxs)(`div`,{className:`aha-col`,style:{gap:2},children:[(0,i.jsx)(`b`,{children:e.title}),(0,i.jsx)(`span`,{className:`aha-hint`,children:Xl(e,t)})]}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,"data-size":`sm`,onClick:()=>f(e),children:t(`delete`)})]}),Zl(e,t).map(e=>(0,i.jsx)(`p`,{className:`aha-hint aha-readingNote`,children:e},e)),e.brief?.summary?(0,i.jsx)(`p`,{className:`aha-hint`,children:e.brief.summary}):null,e.brief?.topics?.length?(0,i.jsx)(`div`,{className:`aha-row`,style:{gap:4},children:e.brief.topics.slice(0,10).map(e=>(0,i.jsx)(`span`,{className:`aha-tag`,children:e},e))}):null,e.kind!==`image`||e.chars>0?(0,i.jsxs)(`div`,{className:`aha-row`,style:{gap:6},children:[[[`course`,`makeCourse`],[`sheet`,`makeSheet`],[`cards`,`makeCards`],[`notes`,`makeNotes`],[`quiz`,`makeQuiz`]].map(([n,r])=>(0,i.jsxs)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,"data-kind":n===`course`?`primary`:void 0,disabled:!!s,onClick:()=>E(n,e),children:[s===`${n}:${e.id}`?(0,i.jsx)(`span`,{className:`aha-spinner`}):null,t(r)]},n)),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,onClick:()=>n(`item`,{kind:`digest`,materialId:e.id}),children:t(`digest`)})]}):(0,i.jsx)(`p`,{className:`aha-hint`,children:t(`imageNeedsVision`)})]},e.id))}):(0,i.jsx)(Gl,{children:(o.value??[]).length?t(`libraryNoTitleMatch`):t(`noMaterials`)}),d?(0,i.jsx)(Hl,{danger:!0,text:`${t(`delete`)}「${d.title}」?`,onCancel:()=>f(null),onConfirm:async()=>{await e.call(`material/remove`,{id:d.id}),f(null),o.reload()}}):null]})}let np=[60,120,180,240,300,420,600,900];function rp(){let{api:e,t,navigate:n}=v(),a=y(()=>e.call(`plan/get`,{today:Ud(new Date)}),[]),o=y(()=>e.call(`review/session`),[]),s=y(()=>e.call(`course/list`),[]),[c,l]=(0,r.useState)(300),[u,d]=(0,r.useState)([1,2,3,4,5,6,0]),[f,p]=(0,r.useState)({title:``,day:``,courseId:``}),[m,h]=(0,r.useState)(null),g=t(`weekdays`).split(`,`),_=Ud(new Date),[b,x]=(0,r.useState)(_);(0,r.useEffect)(()=>{a.value&&(l(a.value.settings.weeklyMinutes),d(a.value.settings.studyDays))},[a.value?.settings]);async function S(){h(null);try{a.setValue(await e.call(`plan/settings`,{weeklyMinutes:c,studyDays:u}))}catch(e){h(e)}}async function C(t){if(t.preventDefault(),!(!f.title.trim()||!f.day))try{a.setValue(await e.call(`plan/add-exam`,{...f,courseId:f.courseId||void 0})),p({title:``,day:``,courseId:``})}catch(e){h(e)}}async function w(t,n){h(null);try{a.setValue(await Hd(e,t,n,_))}catch(e){h(e)}}let T=e=>s.value?.find(t=>t.id===e)?.title??``,E=a.value?.calendar??[],D=E.find(e=>e.day===b)?.items??[];return(0,i.jsxs)(`div`,{className:`aha-page`,children:[(0,i.jsxs)(`div`,{className:`aha-col`,style:{gap:4},children:[(0,i.jsx)(`h2`,{className:`aha-title`,children:t(`planTitle`)}),(0,i.jsx)(`p`,{className:`aha-hint`,children:t(`planHint`)})]}),(0,i.jsx)(`section`,{className:`aha-card`,children:(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsx)(`b`,{children:o.value?.items?.length?t(`reviewDue`,{count:o.value.items.length}):t(`nothingToReview`)}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,disabled:!o.value?.items?.length,onClick:()=>n(`practice`,{review:!0}),children:t(`startReview`)})]})}),(0,i.jsxs)(`section`,{className:`aha-card`,children:[(0,i.jsxs)(`div`,{className:`aha-row`,children:[(0,i.jsxs)(`label`,{className:`aha-label`,style:{minWidth:200},children:[t(`weeklyMinutes`),(0,i.jsx)(`select`,{className:`aha-select`,value:c,onChange:e=>l(Number(e.currentTarget.value)),children:np.map(e=>(0,i.jsx)(`option`,{value:e,children:t(`minutesUnit`,{minutes:e})},e))})]}),(0,i.jsxs)(`div`,{className:`aha-label`,children:[t(`studyDays`),(0,i.jsx)(`div`,{className:`aha-row`,style:{gap:4},children:[1,2,3,4,5,6,0].map(e=>(0,i.jsx)(`button`,{type:`button`,className:`aha-chip`,"data-active":u.includes(e),onClick:()=>d(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),children:g[e]},e))})]}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,onClick:S,children:t(`savePlan`)})]}),(a.value?.plan.warnings??[]).filter(e=>e.kind===`deadline-at-risk`).map(e=>(0,i.jsx)(`div`,{className:`aha-feedback`,"data-ok":`false`,children:t(`deadlineRisk`,{course:T(e.courseId),finish:e.finishDay,deadline:e.deadline,minutes:e.neededWeeklyMinutes})},e.courseId))]}),(0,i.jsxs)(`section`,{className:`aha-card`,children:[(0,i.jsx)(`b`,{children:t(`exams`)}),(a.value?.exams??[]).map(n=>(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsxs)(`span`,{children:[n.title,` · `,n.day,n.courseId?` · ${T(n.courseId)}`:``]}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,"data-size":`sm`,onClick:async()=>a.setValue(await e.call(`plan/remove-exam`,{id:n.id})),children:t(`delete`)})]},n.id)),(0,i.jsxs)(`form`,{className:`aha-row`,onSubmit:C,children:[(0,i.jsx)(`input`,{className:`aha-input`,style:{flex:2,minWidth:160},placeholder:t(`examTitle`),value:f.title,onChange:e=>p({...f,title:e.currentTarget.value})}),(0,i.jsx)(`input`,{className:`aha-input`,style:{flex:1,minWidth:140},type:`date`,value:f.day,onChange:e=>p({...f,day:e.currentTarget.value})}),(0,i.jsxs)(`select`,{className:`aha-select`,style:{flex:1,minWidth:140},value:f.courseId,onChange:e=>p({...f,courseId:e.currentTarget.value}),children:[(0,i.jsx)(`option`,{value:``,children:`—`}),(s.value??[]).filter(e=>e.status===`ready`).map(e=>(0,i.jsx)(`option`,{value:e.id,children:e.title},e.id))]}),(0,i.jsx)(`button`,{type:`submit`,className:`aha-btn`,children:t(`addExam`)})]})]}),(0,i.jsx)(Wl,{error:m??a.error}),a.loading&&!a.value?(0,i.jsx)(Rl,{label:t(`loading`)}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(op,{days:E,today:_,selected:b,onSelect:x,weekdayNames:g}),(0,i.jsxs)(`section`,{className:`aha-card`,children:[(0,i.jsxs)(`b`,{children:[b===_?`${t(`today`)} · `:``,t(`dayLabel`,{month:Wd(b).getMonth()+1,day:Wd(b).getDate(),weekday:g[Wd(b).getDay()]})]}),D.length?D.map(e=>(0,i.jsx)(Vd,{item:e,day:b,today:_,onToggle:w},`${e.kind}:${e.refId}`)):(0,i.jsx)(`p`,{className:`aha-hint`,children:t(b===_?`noPlanToday`:`dayEmpty`)})]})]})]})}let ip=e=>String(e).padStart(2,`0`),ap=(e,t)=>{let n=Wd(`${e}-01`);return n.setMonth(n.getMonth()+t),`${n.getFullYear()}-${ip(n.getMonth()+1)}`};function op({days:e,today:t,selected:n,onSelect:a,weekdayNames:o}){let{t:s}=v(),[c,l]=(0,r.useState)(t.slice(0,7)),u=(0,r.useMemo)(()=>new Map(e.map(e=>[e.day,e.items])),[e]),d=Wd(`${c}-01`),f=new Date(d.getFullYear(),d.getMonth()+1,0).getDate(),p=[...Array((d.getDay()+6)%7).fill(null),...Array.from({length:f},(e,t)=>`${c}-${ip(t+1)}`)];return(0,i.jsxs)(`section`,{className:`aha-card aha-calendar`,children:[(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,"data-size":`sm`,onClick:()=>l(e=>ap(e,-1)),"aria-label":s(`prevMonth`),children:`‹`}),(0,i.jsx)(`b`,{children:s(`monthLabel`,{year:d.getFullYear(),month:d.getMonth()+1})}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,"data-size":`sm`,onClick:()=>l(e=>ap(e,1)),"aria-label":s(`nextMonth`),children:`›`})]}),(0,i.jsxs)(`div`,{className:`aha-calGrid`,children:[[1,2,3,4,5,6,0].map(e=>(0,i.jsx)(`span`,{className:`aha-calHead`,children:o[e]},e)),p.map((e,r)=>{if(!e)return(0,i.jsx)(`span`,{},`gap${r}`);let o=u.get(e)??[],s=o.length>0&&o.every(e=>e.kind===`exam`||e.checked);return(0,i.jsxs)(`button`,{type:`button`,className:`aha-calDay`,"data-today":e===t?`true`:void 0,"data-selected":e===n?`true`:void 0,"data-past":e<t?`true`:void 0,onClick:()=>a(e),children:[(0,i.jsxs)(`span`,{className:`aha-calNum`,children:[Number(e.slice(8)),s?` ✓`:``]}),o.slice(0,3).map(e=>(0,i.jsx)(`span`,{className:`aha-calItem`,"data-kind":e.kind,"data-checked":e.checked?`true`:void 0,children:e.title},`${e.kind}:${e.refId}`)),o.length>3?(0,i.jsxs)(`span`,{className:`aha-calMore`,children:[`+`,o.length-3]}):null]},e)})]})]})}let sp=[[`goals`,`goals`],[`strengths`,`strengthsLabel`],[`weaknesses`,`weaknesses`]];function cp(){let{api:e,t,toast:n}=v(),a=y(()=>e.call(`profile/get`),[]),[o,s]=(0,r.useState)(null),[c,l]=(0,r.useState)(!1),[u,d]=(0,r.useState)(null);(0,r.useEffect)(()=>{a.value&&s({name:a.value.name??``,background:a.value.background,goals:a.value.goals.join(`
|
|
717
717
|
`),strengths:a.value.strengths.join(`
|
|
718
718
|
`),weaknesses:a.value.weaknesses.join(`
|
|
719
719
|
`),style:a.value.preferences?.style??``})},[a.value]);async function f(){d(null);try{let r=e=>e.split(`
|
|
720
|
-
`).map(e=>e.trim()).filter(Boolean);a.setValue(await e.call(`profile/save`,{name:o.name.trim(),background:o.background,goals:r(o.goals),strengths:r(o.strengths),weaknesses:r(o.weaknesses),preferences:{...a.value.preferences,style:o.style}})),n(t(`saved`))}catch(e){d(e)}}return o?(0,i.jsxs)(`div`,{className:`aha-page`,style:{maxWidth:820},children:[(0,i.jsxs)(`div`,{className:`aha-col`,style:{gap:4},children:[(0,i.jsx)(`h2`,{className:`aha-title`,children:t(`profileTitle`)}),(0,i.jsx)(`p`,{className:`aha-hint`,children:t(`profileHint`)})]}),(0,i.jsxs)(`section`,{className:`aha-card`,children:[(0,i.jsxs)(`label`,{className:`aha-label`,children:[t(`profileName`),` `,(0,i.jsxs)(`span`,{className:`aha-hint`,children:[`(`,t(`profileNameHint`),`)`]}),(0,i.jsx)(`input`,{className:`aha-input`,maxLength:20,value:o.name,placeholder:t(`profileNamePlaceholder`),onChange:e=>s({...o,name:e.currentTarget.value})})]}),(0,i.jsxs)(`label`,{className:`aha-label`,children:[t(`background`),(0,i.jsx)(`textarea`,{className:`aha-textarea`,value:o.background,onChange:e=>s({...o,background:e.currentTarget.value})})]}),op.map(([e,n])=>(0,i.jsxs)(`label`,{className:`aha-label`,children:[t(n),` `,(0,i.jsxs)(`span`,{className:`aha-hint`,children:[`(`,t(`onePerLine`),`)`]}),(0,i.jsx)(`textarea`,{className:`aha-textarea`,value:o[e],onChange:t=>s({...o,[e]:t.currentTarget.value})})]},e)),(0,i.jsxs)(`label`,{className:`aha-label`,children:[t(`learningStyle`),(0,i.jsx)(`input`,{className:`aha-input`,value:o.style,onChange:e=>s({...o,style:e.currentTarget.value})})]}),(0,i.jsxs)(`div`,{className:`aha-row`,children:[(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,onClick:f,children:t(`save`)}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`danger`,onClick:()=>l(!0),children:t(`clearProfile`)})]}),(0,i.jsx)(Wl,{error:u})]}),a.value.notes?.length?(0,i.jsxs)(`section`,{className:`aha-card`,children:[(0,i.jsx)(`b`,{children:t(`memoryNotes`)}),a.value.notes.map(n=>(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsx)(`span`,{children:n.text}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,"data-size":`sm`,onClick:async()=>a.setValue(await e.call(`profile/remove-note`,{id:n.id})),children:t(`delete`)})]},n.id))]}):null,(0,i.jsx)(`p`,{className:`aha-hint`,children:t(`privacyNote`)}),c?(0,i.jsx)(Hl,{danger:!0,text:t(`clearProfileConfirm`),onCancel:()=>l(!1),onConfirm:async()=>{a.setValue(await e.call(`profile/clear`)),l(!1)}}):null]}):(0,i.jsx)(`div`,{className:`aha-page`,children:(0,i.jsx)(Rl,{label:t(`loading`)})})}function cp({courseId:e,projectId:t}){let{api:n,t:a,dsh:o,toast:s}=v(),c=y(()=>n.call(`project/get`,{courseId:e,projectId:t}),[e,t]),l=b(),[u,d]=(0,r.useState)(``),[f,p]=(0,r.useState)(!0),[m,h]=(0,r.useState)(null),[g,_]=(0,r.useState)(!1),[x,S]=(0,r.useState)(null);if(c.loading&&!c.value)return(0,i.jsx)(`div`,{className:`aha-page`,children:(0,i.jsx)(Rl,{label:a(`loading`)})});if(!c.value)return(0,i.jsx)(`div`,{className:`aha-page`,children:(0,i.jsx)(Wl,{error:c.error})});let{project:C,submissions:w}=c.value,T=m?.path??c.value.workspace;async function E(){_(!0),S(null);try{let r=await n.call(`project/open`,{courseId:e,projectId:t});h(r);let i=await o.openWorkspace(r.path,r.prompt).catch(()=>!1);s(i?a(`workspaceSession`):a(`workspaceReady`,{path:r.path}))}catch(e){S(e)}finally{_(!1)}}async function D(){try{await l.run(`project/submit`,{courseId:e,projectId:t,notes:u,includeWorkspace:f}),d(``),c.reload()}catch{}}return(0,i.jsxs)(`div`,{className:`aha-page`,style:{maxWidth:900},children:[(0,i.jsx)(`h2`,{className:`aha-title`,children:C.title}),(0,i.jsxs)(`section`,{className:`aha-card`,children:[(0,i.jsx)(`b`,{children:a(`projectBrief`)}),(0,i.jsx)(vu,{text:C.brief})]}),C.milestones?.length?(0,i.jsxs)(`section`,{className:`aha-card`,children:[(0,i.jsx)(`b`,{children:a(`milestones`)}),(0,i.jsx)(`ol`,{style:{margin:0,paddingLeft:20},children:C.milestones.map(e=>(0,i.jsxs)(`li`,{children:[(0,i.jsx)(`b`,{children:e.title}),e.detail?(0,i.jsx)(`div`,{className:`aha-hint`,children:e.detail}):null]},e.id))})]}):null,C.rubric?.length?(0,i.jsxs)(`section`,{className:`aha-card`,children:[(0,i.jsx)(`b`,{children:a(`rubric`)}),C.rubric.map(e=>(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsxs)(`span`,{children:[e.criterion,e.detail?(0,i.jsxs)(`span`,{className:`aha-hint`,children:[` · `,e.detail]}):null]}),(0,i.jsx)(`span`,{className:`aha-tag`,children:e.points})]},e.id))]}):null,(0,i.jsxs)(`section`,{className:`aha-card`,children:[(0,i.jsxs)(`div`,{className:`aha-row`,children:[(0,i.jsxs)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,disabled:g,onClick:E,children:[(0,i.jsx)(ut,{name:`folder`,size:15}),a(g?`openingWorkspace`:`openWorkspace`)]}),T?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`code`,{className:`aha-hint`,style:{overflowWrap:`anywhere`},children:T}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,"data-kind":`ghost`,onClick:()=>{tu(T),s(a(`copied`))},children:a(`copyPath`)})]}):null]}),(0,i.jsx)(`p`,{className:`aha-hint`,children:a(`workspaceManual`)}),(0,i.jsx)(Wl,{error:x})]}),(0,i.jsxs)(`section`,{className:`aha-card`,children:[(0,i.jsx)(`b`,{children:a(`submitProject`)}),(0,i.jsx)(`textarea`,{className:`aha-textarea`,value:u,placeholder:a(`submitNotes`),onChange:e=>d(e.currentTarget.value)}),(0,i.jsxs)(`label`,{className:`aha-row`,style:{gap:6},children:[(0,i.jsx)(`input`,{type:`checkbox`,checked:f,onChange:e=>p(e.currentTarget.checked)}),a(`includeFiles`)]}),l.running?(0,i.jsx)(Bl,{progress:l.progress,label:a(`reviewing`),onCancel:l.cancel}):(0,i.jsx)(`div`,{children:(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,disabled:!u.trim()&&!f,onClick:D,children:a(`submitProject`)})}),(0,i.jsx)(Wl,{error:l.error})]}),w.length?(0,i.jsxs)(`section`,{className:`aha-col`,children:[(0,i.jsx)(`h3`,{className:`aha-cardTitle`,children:a(`submissions`)}),[...w].reverse().map((e,t)=>(0,i.jsxs)(`div`,{className:`aha-card`,children:[(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsx)(`b`,{children:a(`reviewTotal`,{total:e.review.total,max:e.review.max})}),(0,i.jsx)(`span`,{className:`aha-hint`,children:new Date(e.at).toLocaleString()})]}),e.review.summary?(0,i.jsx)(vu,{text:e.review.summary,compact:!0}):null,e.review.scores.map(e=>(0,i.jsxs)(`div`,{className:`aha-spread`,style:{alignItems:`flex-start`},children:[(0,i.jsxs)(`span`,{children:[(0,i.jsx)(`b`,{children:e.criterion}),(0,i.jsx)(`div`,{className:`aha-hint`,children:e.comment})]}),(0,i.jsxs)(`span`,{className:`aha-tag`,children:[e.points,`/`,e.max]})]},e.criterionId)),e.review.strengths?.length?(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`b`,{children:a(`strengths`)}),(0,i.jsx)(`ul`,{style:{margin:0},children:e.review.strengths.map((e,t)=>(0,i.jsx)(`li`,{children:e},t))})]}):null,e.review.nextSteps?.length?(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`b`,{children:a(`nextSteps`)}),(0,i.jsx)(`ul`,{style:{margin:0},children:e.review.nextSteps.map((e,t)=>(0,i.jsx)(`li`,{children:e},t))})]}):null]},t))]}):null]})}let lp=[[`openai`,`providerOpenai`],[`volcengine`,`providerVolcengine`],[`minimax`,`providerMinimax`],[`azure`,`providerAzure`]],up=[[`standard`,`textStandard`],[`large`,`textLarge`],[`larger`,`textLarger`]];function dp(){let{api:e,t,settings:n,settingsSaved:a,setVoiceId:o,speech:s,language:c}=v(),l=y(()=>e.call(`models/list`),[]),[d,f]=(0,r.useState)(null),p=e=>d?.area===e?d.failure:null,[m,h]=(0,r.useState)(()=>Ye()),[g,_]=(0,r.useState)(``),[b,x]=(0,r.useState)(!1);(0,r.useEffect)(()=>Xe(h),[]);async function S(e,t){f(null);try{await t()}catch(t){f({area:e,failure:t})}}let C=(0,r.useRef)(Promise.resolve()),w=(t,n)=>{let r=S(t,async()=>{await e.call(`settings/save`,{settings:n}),await a()});return C.current=C.current.then(()=>r),r},T=(e,t)=>e&&t?`${e}::${t}`:``,E=(e,t)=>{let[n=``,r=``]=t?t.split(`::`):[];w(`models`,{[`${e}Provider`]:n,[`${e}Model`]:r})},D=(0,r.useMemo)(()=>(l.value??[]).map(e=>({value:`${e.provider}::${e.model}`,label:`${e.providerName} · ${e.name}${e.images?` 🖼`:``}`})),[l.value]),O=c===`zh`?`zh-CN`:`en`,k=m.filter(e=>e.lang.toLowerCase().startsWith(O.split(`-`)[0])),A=n.ttsProvider??`openai`,ee=(n.fields?.[A]??[]).filter(e=>!e.secret),te=n.tts?.[A]??{};async function j(){f(null),x(!0);try{await C.current,s.configure({engine:n.voiceEngine??`browser`,voiceId:n.voiceId||void 0,language:O,rate:n.voiceRate??1});let e=await s.speak(t(`testSentence`),{rate:n.voiceRate??1}).done;e?.error&&f({area:`test`,failure:new u(e.code??`speech`,e.error)})}finally{x(!1)}}return n.voiceEngine?(0,i.jsxs)(`div`,{className:`aha-page`,style:{maxWidth:820},children:[(0,i.jsx)(`h2`,{className:`aha-title`,children:t(`settingsTitle`)}),(0,i.jsxs)(`section`,{className:`aha-card`,children:[(0,i.jsx)(`b`,{children:t(`textSize`)}),(0,i.jsx)(`div`,{className:`aha-row`,style:{gap:6},children:up.map(([e,r])=>(0,i.jsx)(`button`,{type:`button`,className:`aha-chip`,"data-active":(n.textSize??`standard`)===e,onClick:()=>w(`text`,{textSize:e}),children:t(r)},e))}),(0,i.jsx)(`p`,{className:`aha-hint`,children:t(`textSizeHint`)}),(0,i.jsx)(Wl,{error:p(`text`),reveal:!0})]}),(0,i.jsxs)(`section`,{className:`aha-card`,children:[(0,i.jsx)(`b`,{children:t(`modelsTitle`)}),(0,i.jsx)(`p`,{className:`aha-hint`,children:t(`modelsHint`)}),[[`teach`,`teachModel`],[`quick`,`quickModel`]].map(([e,r])=>(0,i.jsxs)(`label`,{className:`aha-label`,children:[t(r),(0,i.jsxs)(`select`,{className:`aha-select`,value:T(n[`${e}Provider`],n[`${e}Model`]),onChange:t=>E(e,t.currentTarget.value),children:[(0,i.jsx)(`option`,{value:``,children:t(`followDefault`)}),D.map(e=>(0,i.jsx)(`option`,{value:e.value,children:e.label},e.value))]})]},e)),l.loading?(0,i.jsx)(Rl,{}):null,(0,i.jsx)(Wl,{error:p(`models`),reveal:!0})]}),(0,i.jsxs)(`section`,{className:`aha-card`,children:[(0,i.jsx)(`b`,{children:t(`voiceTitle`)}),(0,i.jsx)(`div`,{className:`aha-row`,style:{gap:6},children:[[`browser`,`engineBrowser`],[`cloud`,`engineCloud`],[`off`,`engineOff`]].map(([e,r])=>(0,i.jsx)(`button`,{type:`button`,className:`aha-chip`,"data-active":n.voiceEngine===e,onClick:()=>w(`engine`,{voiceEngine:e}),children:t(r)},e))}),(0,i.jsxs)(`label`,{className:`aha-label`,children:[t(`voiceRate`),` · `,n.voiceRate??1,`×`,(0,i.jsx)(`input`,{type:`range`,min:`0.5`,max:`2`,step:`0.05`,value:n.voiceRate??1,onChange:e=>w(`engine`,{voiceRate:Number(e.currentTarget.value)})})]}),(0,i.jsx)(Wl,{error:p(`engine`),reveal:!0}),n.voiceEngine===`browser`?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(`label`,{className:`aha-label`,children:[t(`browserVoice`),(0,i.jsxs)(`select`,{className:`aha-select`,value:n.voiceId??``,onChange:e=>o(e.currentTarget.value),children:[(0,i.jsxs)(`option`,{value:``,children:[t(`autoVoice`),Ze(O)?` (${Ze(O).name})`:``]}),(k.length?k:m).map(e=>(0,i.jsxs)(`option`,{value:e.id,children:[e.name,` · `,e.lang,e.local?``:` ☁`]},e.id))]})]}),Je()&&!k.length?(0,i.jsx)(`p`,{className:`aha-hint`,children:t(`noVoiceForLanguage`)}):null]}):null,n.voiceEngine===`cloud`?(0,i.jsxs)(`div`,{className:`aha-col`,children:[(0,i.jsxs)(`label`,{className:`aha-label`,children:[t(`cloudProvider`),(0,i.jsx)(`select`,{className:`aha-select`,value:A,onChange:e=>w(`cloud`,{ttsProvider:e.currentTarget.value}),children:lp.map(([e,n])=>(0,i.jsx)(`option`,{value:e,children:t(n)},e))})]}),ee.map(e=>(0,i.jsxs)(`label`,{className:`aha-label`,children:[t(`field_${e.key}`),(0,i.jsx)(`input`,{className:`aha-input`,defaultValue:te[e.key]??``,onBlur:t=>{let n=t.currentTarget.value.trim();n!==(te[e.key]??``)&&w(`cloud`,{tts:{[A]:{[e.key]:n}}})}},`${A}:${e.key}:${te[e.key]??``}`)]},e.key)),(0,i.jsx)(Wl,{error:p(`cloud`),reveal:!0}),(0,i.jsxs)(`label`,{className:`aha-label`,children:[t(`field_apiKey`),` · `,(0,i.jsx)(`span`,{className:n.keys?.[A]?`aha-ok`:`aha-hint`,children:n.keys?.[A]?t(`keySaved`):t(`keyMissing`)}),(0,i.jsxs)(`div`,{className:`aha-row`,children:[(0,i.jsx)(`input`,{className:`aha-input`,style:{flex:1},type:`password`,autoComplete:`off`,spellCheck:!1,value:g,onChange:e=>_(e.currentTarget.value)}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,disabled:!g.trim(),onClick:()=>S(`key`,async()=>{await e.call(`settings/set-key`,{provider:A,key:g.trim()}),_(``),await a()}),children:t(`saveKey`)}),n.keys?.[A]?(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,onClick:()=>S(`key`,async()=>{await e.call(`settings/clear-key`,{provider:A}),await a()}),children:t(`clearKey`)}):null]})]}),(0,i.jsx)(Wl,{error:p(`key`),reveal:!0})]}):null,(0,i.jsx)(`div`,{children:(0,i.jsxs)(`button`,{type:`button`,className:`aha-btn`,disabled:b||n.voiceEngine===`off`,onClick:j,children:[b?(0,i.jsx)(`span`,{className:`aha-spinner`}):`🔊`,` `,t(`testVoice`)]})}),(0,i.jsx)(Wl,{error:p(`test`),reveal:!0})]}),(0,i.jsxs)(`section`,{className:`aha-card`,children:[(0,i.jsx)(`b`,{children:t(`boardTheme`)}),(0,i.jsx)(`div`,{className:`aha-row`,style:{gap:6},children:[[`auto`,`themeAuto`],[`light`,`themeLight`],[`dark`,`themeDark`]].map(([e,r])=>(0,i.jsx)(`button`,{type:`button`,className:`aha-chip`,"data-active":(n.boardTheme??`auto`)===e,onClick:()=>w(`board`,{boardTheme:e}),children:t(r)},e))}),(0,i.jsx)(`b`,{children:t(`boardFont`)}),(0,i.jsx)(`div`,{className:`aha-row`,style:{gap:6},children:[[`hand`,`fontHand`],[`standard`,`fontStandard`]].map(([e,r])=>(0,i.jsx)(`button`,{type:`button`,className:`aha-chip`,"data-active":(n.boardFont??`hand`)===e,onClick:()=>w(`board`,{boardFont:e}),style:e===`hand`?{fontFamily:Df}:void 0,children:t(r)},e))}),(0,i.jsx)(`b`,{children:t(`boardView`)}),(0,i.jsx)(`div`,{className:`aha-row`,style:{gap:6},children:[[`canvas`,`viewCanvas`],[`pages`,`viewPages`]].map(([e,r])=>(0,i.jsx)(`button`,{type:`button`,className:`aha-chip`,"data-active":(n.boardView??`canvas`)===e,onClick:()=>w(`board`,{boardView:e}),children:t(r)},e))}),(0,i.jsx)(`p`,{className:`aha-hint`,children:t(`boardViewHint`)}),(0,i.jsx)(Wl,{error:p(`board`),reveal:!0})]}),(0,i.jsx)(fp,{}),(0,i.jsx)(`p`,{className:`aha-hint`,children:t(`privacyNote`)})]}):(0,i.jsx)(`div`,{className:`aha-page`,children:(0,i.jsx)(Rl,{label:t(`loading`)})})}function fp(){let{api:e,t}=v(),[n,a]=(0,r.useState)(null),[o,s]=(0,r.useState)(!0),[c,l]=(0,r.useState)(!1),[u,d]=(0,r.useState)(!1),[f,p]=(0,r.useState)(null),[m,h]=(0,r.useState)(!1),g=t=>{s(!0),l(!1),e.call(`plugin/version`,{force:t}).then(a).catch(()=>l(!0)).finally(()=>s(!1))};(0,r.useEffect)(()=>{g(!1)},[]);async function _(){d(!0),h(!1);try{p(await e.call(`plugin/update`))}catch{h(!0)}finally{d(!1)}}let y=n?.install?.kind;return(0,i.jsxs)(`section`,{className:`aha-card`,children:[(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsx)(`b`,{children:t(`versionTitle`)}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,disabled:o||u,onClick:()=>g(!0),children:t(o?`versionChecking`:`versionCheck`)})]}),c?(0,i.jsx)(`p`,{className:`aha-error`,children:t(`versionFailed`)}):null,n?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsx)(`span`,{children:t(`versionCurrent`)}),(0,i.jsxs)(`span`,{className:`aha-hint`,children:[`v`,n.current]})]}),(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsx)(`span`,{children:t(`versionLatest`)}),(0,i.jsx)(`span`,{className:`aha-hint`,children:n.latest?`v${n.latest}`:`—`})]}),f?null:(0,i.jsx)(`p`,{className:n.latestUnknown?`aha-error`:`aha-hint`,children:n.latestUnknown?t(`versionFailed`):n.updateAvailable?t(`versionAvailable`,{version:n.latest}):t(`versionUpToDate`)}),!f&&n.updateAvailable&&y===`npm`?(0,i.jsx)(`div`,{children:(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,disabled:u,onClick:_,children:t(u?`versionUpdating`:`versionUpdate`)})}):null,y===`link`?(0,i.jsx)(`p`,{className:`aha-hint`,children:t(`versionLinked`)}):null,n.updateAvailable&&y===`unknown`?(0,i.jsx)(`p`,{className:`aha-hint`,children:t(`versionManual`,{version:n.latest})}):null]}):null,m?(0,i.jsx)(`p`,{className:`aha-error`,children:t(`versionUpdateFailed`)}):null,f?.pending?(0,i.jsx)(`p`,{className:`aha-hint`,children:typeof f.availableAt==`number`?t(`versionPendingUntil`,{version:f.version,time:new Date(f.availableAt).toLocaleString()}):t(`versionPending`,{version:f.version})}):null,f&&!f.pending?(0,i.jsx)(`div`,{className:`aha-feedback`,"data-ok":`true`,children:t(`versionUpdated`,{version:f.version})}):null]})}function pp({draftTopic:e,draftUrl:t,token:n}){let{api:a,t:o}=v(),s=y(()=>a.call(`items/list`,{kind:`shorts`}),[]),[c,l]=(0,r.useState)(e??``),[u,d]=(0,r.useState)(t??``),[f,p]=(0,r.useState)(null),[m,h]=(0,r.useState)(null),g=Yf(),_=x(n);async function b(){if(!c.trim()&&!u.trim())return;h(null);let e=E(`sht`);try{let{job:t}=await a.call(`short/make`,{topic:c,url:u,newId:e});p({id:e,title:c||u,steps:[],stream:t,key:`${e}:new`})}catch(e){h(e)}}(0,r.useEffect)(()=>{_&&(e||t)&&b()},[]);async function S(e){try{let{item:t}=await a.call(`items/get`,{kind:`shorts`,id:e});p({id:t.id,title:t.title,steps:t.board.steps,stream:null,language:t.language,key:`${t.id}:open`,opened:Date.now()})}catch(e){h(e)}}return(0,i.jsx)(`div`,{className:`aha-page`,"data-wide":`true`,children:(0,i.jsxs)(`div`,{className:`aha-split`,children:[(0,i.jsxs)(`div`,{className:`aha-col`,style:{minHeight:0},children:[(0,i.jsxs)(`div`,{className:`aha-col`,style:{gap:4},children:[(0,i.jsx)(`h2`,{className:`aha-title`,children:o(`shortsTitle`)}),(0,i.jsx)(`p`,{className:`aha-hint`,children:o(`shortsHint`)})]}),(0,i.jsxs)(`div`,{className:`aha-row`,children:[(0,i.jsx)(`input`,{className:`aha-input`,style:{flex:2,minWidth:220},value:c,placeholder:o(`topicPlaceholder`),onChange:e=>l(e.currentTarget.value)}),(0,i.jsx)(`input`,{className:`aha-input`,style:{flex:1,minWidth:180},value:u,placeholder:o(`urlPlaceholder`),onChange:e=>d(e.currentTarget.value)}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,disabled:!c.trim()&&!u.trim(),onClick:b,children:o(`makeShort`)})]}),(0,i.jsx)(Wl,{error:m}),f?(0,i.jsx)(Qu,{scope:{kind:`short`,id:f.id},title:f.title,steps:f.steps,stream:f.stream,language:f.language,recordChecks:!1,reveal:f.opened,onStreamDone:e=>{p(t=>({...t,steps:e?.item?.board?.steps??t.steps,title:e?.item?.title??t.title,stream:null})),s.reload()},header:({steps:e})=>(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(Tf,{steps:e,title:f.title,kind:null}),g.exporting?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(Rl,{label:o(`exporting`,{percent:g.exporting.percent})}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,onClick:g.cancel,children:o(`cancel`)})]}):(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,disabled:!f.steps.length,onClick:()=>g.start({steps:f.steps,title:f.title}),children:o(`exportVideo`)})]})},f.key):null,f&&!g.cloud?(0,i.jsx)(`p`,{className:`aha-hint`,children:o(`exportNeedsCloud`)}):null]}),(0,i.jsxs)(`aside`,{className:`aha-col`,style:{minHeight:0,overflow:`auto`},children:[(0,i.jsx)(`h3`,{className:`aha-cardTitle`,children:o(`history`)}),s.loading&&!s.value?(0,i.jsx)(Rl,{}):(s.value??[]).length?s.value.map(e=>(0,i.jsxs)(`div`,{className:`aha-option`,style:{cursor:`pointer`},onClick:()=>S(e.id),children:[(0,i.jsx)(`b`,{children:e.title}),(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsx)(`small`,{children:new Date(e.createdAt).toLocaleString()}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,"data-size":`sm`,onClick:async t=>{t.stopPropagation(),await a.call(`items/remove`,{kind:`shorts`,id:e.id}),s.reload()},children:o(`delete`)})]})]},e.id)):(0,i.jsx)(Gl,{children:o(`empty`)})]})]})})}let mp=[[`sheet`,`makeSheet`,`studio/sheet`],[`cards`,`makeCards`,`studio/cards`],[`notes`,`makeNotes`,`studio/notes`],[`quiz`,`makeQuiz`,`studio/quiz`]];function hp(){let{api:e,t,navigate:n}=v(),a=y(()=>e.call(`items/list`,{kind:`sheets`}),[]),o=y(()=>e.call(`items/list`,{kind:`decks`}),[]),[s,c]=(0,r.useState)([]),[l,u]=(0,r.useState)(!1),[d,f]=(0,r.useState)(``),[p,m]=(0,r.useState)(null),[h,g]=(0,r.useState)(null);async function _(t,n){if(!s.length){u(!0);return}m(t),g(null);try{b((await e.run(n,{materialIds:s,focus:d})).item)}catch(e){g(e)}finally{m(null)}}function b(e){e.kind===`cheatsheet`?n(`sheet`,{sheetId:e.id}):e.kind===`notes`?n(`item`,{kind:`notes`,id:e.id}):e.kind===`cards`?n(`cards`,{deckId:e.id}):n(`item`,{kind:`quiz`,id:e.id})}async function x(t,n){await e.call(`items/remove`,{kind:t,id:n}),t===`sheets`?a.reload():o.reload()}let S=(e,n,r)=>(0,i.jsxs)(`section`,{className:`aha-col`,children:[(0,i.jsx)(`h3`,{className:`aha-cardTitle`,children:e}),n.loading&&!n.value?(0,i.jsx)(Rl,{}):(n.value??[]).length?(0,i.jsx)(`div`,{className:`aha-grid`,children:n.value.map(e=>(0,i.jsxs)(`div`,{className:`aha-card`,"data-click":`true`,onClick:()=>b(e),children:[(0,i.jsx)(`span`,{className:`aha-tag`,children:e.kind===`cheatsheet`?t(`sheets`):e.kind===`notes`?t(`notes`):e.kind===`cards`?t(`decks`):t(`quizzes`)}),(0,i.jsx)(`b`,{children:e.title}),(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsx)(`span`,{className:`aha-hint`,children:new Date(e.updatedAt).toLocaleDateString()}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,"data-size":`sm`,onClick:t=>{t.stopPropagation(),x(r,e.id)},children:t(`delete`)})]})]},e.id))}):(0,i.jsx)(Gl,{children:t(`empty`)})]});return(0,i.jsxs)(`div`,{className:`aha-page`,children:[(0,i.jsxs)(`div`,{className:`aha-col`,style:{gap:4},children:[(0,i.jsx)(`h2`,{className:`aha-title`,children:t(`studioTitle`)}),(0,i.jsx)(`p`,{className:`aha-hint`,children:t(`studioHint`)})]}),(0,i.jsxs)(`section`,{className:`aha-card`,children:[(0,i.jsxs)(`div`,{className:`aha-row`,children:[(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,onClick:()=>u(!0),children:s.length?t(`attached`,{count:s.length}):t(`pickMaterials`)}),(0,i.jsx)(`input`,{className:`aha-input`,style:{flex:1,minWidth:220},value:d,placeholder:t(`focusPlaceholder`),onChange:e=>f(e.currentTarget.value)})]}),(0,i.jsx)(`div`,{className:`aha-row`,children:mp.map(([e,n,r])=>(0,i.jsxs)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,disabled:!!p,onClick:()=>_(e,r),children:[p===e?(0,i.jsx)(`span`,{className:`aha-spinner`}):null,t(n)]},e))}),p?(0,i.jsx)(Rl,{label:t(`generating`)}):null,(0,i.jsx)(Wl,{error:h})]}),S(`${t(`sheets`)} · ${t(`notes`)}`,a,`sheets`),S(`${t(`decks`)} · ${t(`quizzes`)}`,o,`decks`),l?(0,i.jsx)(Yl,{selected:s,onChange:c,onClose:()=>u(!1)}):null]})}Object.freeze([`again`,`hard`,`good`,`easy`]),Object.freeze({again:1,hard:3,good:4,easy:5});function gp(e,t=Date.now()){return Date.parse(e?.dueAt??0)<=t}function _p(e,t=Date.now()){return(e||[]).filter(e=>gp(e,t)).sort((e,t)=>Date.parse(e.dueAt)-Date.parse(t.dueAt))}function vp({courseId:e,lessonId:t,unitId:n,review:a,deckId:o}){let{api:s,t:c,navigate:l}=v(),d=b(),[f,p]=(0,r.useState)(null),[m,h]=(0,r.useState)(null),[g,_]=(0,r.useState)(0),[y,x]=(0,r.useState)([]),[S,C]=(0,r.useState)(0),[w,T]=(0,r.useState)(null),[E,D]=(0,r.useState)({}),[O,k]=(0,r.useState)(null),[A,ee]=(0,r.useState)({}),[te,j]=(0,r.useState)([]),ne=(0,r.useRef)(new Map),re=(0,r.useRef)(0),ie=(0,r.useRef)(0),ae=(0,r.useRef)({index:0,results:[]});ae.current={index:g,results:y},(0,r.useEffect)(()=>{let r=!0;return(async()=>{try{if(e&&!o&&s.call(`course/get`,{courseId:e}).then(e=>{r&&T(e)}).catch(()=>void 0),a){let t=await s.call(`review/session`,e?{courseId:e}:{});r&&p({title:c(`review`),items:t.items.map(e=>({...e.item,context:e})),language:void 0});return}if(o){let{item:e}=await s.call(`items/get`,{kind:`decks`,id:o});r&&p({title:e.title,items:e.items??[],language:e.language});return}let i=n?`unit/quiz`:`lesson/practice`,l=n?{courseId:e,unitId:n}:{courseId:e,lessonId:t},f=await s.call(i,l),m=f.job?await d.run(null,null,{existing:f.job}):f,h=(m.quiz??m.sets?.[t]??m.practice)?.items??[];if(!h.length&&!n)throw new u(`bad-output`,`No practice items came back`);let g=t?await s.call(`lesson/get`,{courseId:e,lessonId:t}):null;r&&p({title:g?.lesson.title??c(`unitQuiz`),items:h,language:g?.language})}catch(e){r&&h(e)}})(),()=>{r=!1}},[e,t,n,a,o,S]);let oe=f?.items[g],se=r=>{let i=g;x(e=>[...e,{...r,index:i}]);let a=oe?.context?.courseId??e;!a||o||ne.current.set(i,s.call(`lesson/record`,{courseId:a,lessonId:oe?.context?.lessonId??t,conceptIds:oe?.conceptIds??[],evidence:{kind:n?`quiz`:`practice`,score:r.score,confidence:r.confidence,hintsUsed:r.hintsUsed,timeMs:r.timeMs,expectedMs:6e4,errorTag:r.errorTag},source:uu({courseId:e,lessonId:t,unitId:n},oe),response:r.given??r.response??``}).then(e=>(e?.mastery&&D(t=>({...t,...e.mastery})),e?.recommendation&&k(e.recommendation),e?.evidenceId??null)).catch(()=>null))},ce=(0,r.useMemo)(()=>od(y),[y]);function le(e,t){ie.current+=1;let n=ie.current;j(r=>[...r.slice(-2),{key:n,text:e,retry:t}])}let ue=e=>j(t=>t.filter(t=>t.key!==e));async function de(r,i){let a=f?.items[r],l=ae.current.results.find(e=>e.index===r),u=uu({courseId:e,lessonId:t,unitId:n,deckId:o},a);if(!l||!u)return;let d=re.current;ee(e=>({...e,[r]:{...e[r],status:`checking`,note:i,error:null}}));try{let e=await(ne.current.get(r)??null),t=await s.run(`item/challenge`,{source:u,response:l.given??l.response??``,shown:mu(l),...e?{evidenceId:e}:{},note:i});if(re.current!==d){t?.item&&p(e=>e&&{...e,items:e.items.map((e,n)=>n===r?t.item:e)});return}ee(e=>({...e,[r]:hu(e[r],t,ae.current.results.find(e=>e.index===r))})),t?.result&&x(e=>gu(e,r,t.result)),t?.mastery&&D(e=>({...e,...t.mastery})),t?.recommendation&&k(t.recommendation),ae.current.index!==r&&le(_u(c,{index:r,verdict:t?.verdict,regraded:!!t?.result,earlier:t?.earlier??0}))}catch(e){if(re.current!==d)return;ee(t=>({...t,[r]:{...t[r],status:`failed`,note:i,error:e}})),ae.current.index!==r&&le(_u(c,{index:r,message:Ul(c,e)}),()=>de(r,i))}}function fe(){re.current+=1,p(e=>({...e,items:e.items.map((e,t)=>A[t]?.item??e)})),ee({}),j([]),ne.current=new Map,_(0),x([]),k(null)}if(m)return(0,i.jsxs)(`div`,{className:`aha-page`,children:[(0,i.jsx)(Wl,{error:m}),(0,i.jsx)(`div`,{children:(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,onClick:()=>{h(null),C(e=>e+1)},children:c(`retry`)})})]});if(!f)return(0,i.jsx)(`div`,{className:`aha-page`,children:(0,i.jsx)(Bl,{progress:d.progress,label:c(`makingPractice`),onCancel:d.running?d.cancel:void 0})});if(!f.items.length)return(0,i.jsx)(`div`,{className:`aha-page`,children:(0,i.jsx)(Gl,{children:c(a?`nothingToReview`:`empty`)})});let pe=g>=f.items.length;return(0,i.jsxs)(`div`,{className:`aha-page`,style:{maxWidth:760},children:[(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsx)(`h2`,{className:`aha-title`,children:f.title}),(0,i.jsxs)(`span`,{className:`aha-row`,style:{gap:6},children:[!pe&&ce.streak>=2?(0,i.jsx)(`span`,{className:`aha-tag aha-streak`,children:c(`streakCount`,{count:ce.streak})}):null,(0,i.jsxs)(`span`,{className:`aha-tag`,children:[Math.min(g+1,f.items.length),`/`,f.items.length]})]})]}),te.map(e=>(0,i.jsxs)(`div`,{className:`aha-itemNotice`,role:`status`,children:[(0,i.jsxs)(`span`,{className:`aha-itemNoticeText`,children:[`🧐 `,e.text]}),e.retry?(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,onClick:()=>{ue(e.key),e.retry()},children:c(`retry`)}):null,(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,"data-size":`sm`,"aria-label":c(`close`),onClick:()=>ue(e.key),children:`×`})]},e.key)),oe?.context?(0,i.jsxs)(`p`,{className:`aha-hint`,children:[oe.context.courseTitle,` · `,oe.context.conceptName]}):null,pe?(0,i.jsx)(yp,{set:f,stats:ce,context:w,after:E,recommendation:O,courseId:e,lessonId:t,unitId:n,onRetry:fe}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`div`,{className:`aha-card`,children:(0,i.jsx)(Hu,{item:oe,language:f.language,onResult:se,onContinue:()=>_(e=>e+1),continueLabel:g+1<f.items.length?c(`continue`):c(`confirm`),keyboard:!0,onChallenge:uu({courseId:e,lessonId:t,unitId:n,deckId:o},oe)?e=>de(g,e):void 0,check:A[g]??null},`${g}`)}),(0,i.jsx)(`p`,{className:`aha-hint`,children:c(`keysHint`)})]})]})}function yp({set:e,stats:t,context:n,after:a,recommendation:o,courseId:s,lessonId:c,unitId:l,onRetry:u}){let{t:d,navigate:f}=v(),p=n?.course,m=n?.progress,h=(0,r.useMemo)(()=>{let t=p?Ne(p):new Map;return[...new Set(e.items.flatMap(e=>e.conceptIds??[]))].filter(e=>a[e]!==void 0).map(n=>({id:n,name:t.get(n)?.name??e.items.find(e=>e.context?.conceptId===n)?.context?.conceptName??n,before:m?rd(m.concepts?.[n]):null,after:id(a[n]),percent:a[n]}))},[e,p,m,a]),g=(0,r.useMemo)(()=>{if(!p)return null;let e=Ae(p),t=c?e.find(e=>e.lesson.id===c):null,n=t?Le(p,c)?.lesson.id:l?e.find((t,n)=>n>e.findLastIndex(e=>e.unit.id===l))?.lesson.id:null;return sd(o,{lessonId:c,unitId:t?.unit.id??null,nextLessonId:n??Ie(p,m)?.lesson.id})},[p,m,o,c,l]),_={relearn:()=>f(`lesson`,{courseId:s,lessonId:g.lessonId}),review:()=>f(`practice`,{courseId:s,review:!0}),quiz:()=>f(`practice`,{courseId:s,unitId:g.unitId}),next:()=>f(`lesson`,{courseId:s,lessonId:g.lessonId}),course:()=>f(`course`,{courseId:s})},y=g?d({relearn:`nextRelearn`,review:`nextReview`,quiz:`nextQuiz`,next:`nextLessonStep`,course:`nextCourse`}[g.kind]):``,b=g?d({relearn:`relearnLesson`,review:`reviewCourse`,quiz:`unitQuiz`,next:`nextLesson`,course:`backToCourse`}[g.kind]):``;return(0,i.jsxs)(`div`,{className:`aha-card aha-summary`,children:[(0,i.jsxs)(`div`,{className:`aha-stars`,role:`img`,"aria-label":d(`starsLabel`,{count:t.stars}),children:[`★`.repeat(t.stars),(0,i.jsx)(`span`,{children:`★`.repeat(3-t.stars)})]}),(0,i.jsx)(`b`,{children:d(`practiceDone`,{correct:t.correct,total:e.items.length})}),(0,i.jsxs)(`div`,{className:`aha-row aha-summaryStats`,children:[(0,i.jsxs)(`span`,{children:[(0,i.jsxs)(`b`,{children:[Math.round(t.accuracy*100),`%`]}),d(`accuracy`)]}),(0,i.jsxs)(`span`,{children:[(0,i.jsx)(`b`,{children:t.bestStreak}),d(`bestStreak`)]})]}),h.length?(0,i.jsxs)(`div`,{className:`aha-col`,style:{gap:4},children:[(0,i.jsx)(`span`,{className:`aha-hint`,children:d(`masteryChange`)}),h.map(e=>(0,i.jsxs)(`div`,{className:`aha-row aha-conceptMove`,children:[(0,i.jsx)(`span`,{style:{flex:1,minWidth:120},children:e.name}),e.before?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`span`,{className:`aha-level`,"data-level":e.before,children:d(ad[e.before])}),(0,i.jsx)(`span`,{"aria-hidden":`true`,children:`→`})]}):null,(0,i.jsx)(`span`,{className:`aha-level`,"data-level":e.after,children:d(ad[e.after])}),(0,i.jsxs)(`span`,{className:`aha-hint`,children:[e.percent,`%`]})]},e.id))]}):null,g&&s?(0,i.jsx)(`p`,{children:y}):null,(0,i.jsxs)(`div`,{className:`aha-row`,children:[g&&s?(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,onClick:_[g.kind],children:b}):null,(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,onClick:u,children:d(`retry`)}),s&&g?.kind!==`course`?(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,onClick:_.course,children:d(`backToCourse`)}):null]})]})}function bp({courseId:e,deckId:t}){let{api:n,t:a}=v(),o=b(),[s,c]=(0,r.useState)(null),[l,u]=(0,r.useState)(null),[d,f]=(0,r.useState)(!1),[p,m]=(0,r.useState)(null);(0,r.useEffect)(()=>{let r=!0;return(async()=>{try{let i;if(t)i=(await n.call(`items/get`,{kind:`decks`,id:t})).item;else{let t=await n.call(`course/cards`,{courseId:e});i=t.job?(await o.run(null,null,{existing:t.job})).deck:t.deck}if(!r)return;c(i);let a=Date.now(),s=_p(Object.values(i.srs??{}),a).map(e=>e.id),l=i.cards.filter(e=>!i.srs?.[e.id]).map(e=>e.id);m([...s,...l].slice(0,40))}catch(e){r&&u(e)}})(),()=>{r=!1}},[e,t]);let h=(0,r.useMemo)(()=>s?.cards.find(e=>e.id===p?.[0]),[s,p]);async function g(r){if(h){f(!1),m(e=>{let t=e.slice(1);return r===`again`?[...t,h.id]:t});try{t?await n.call(`items/card-review`,{id:t,cardId:h.id,grade:r}):await n.call(`course/card-review`,{courseId:e,cardId:h.id,grade:r})}catch{}}}return l?(0,i.jsx)(`div`,{className:`aha-page`,children:(0,i.jsx)(Wl,{error:l})}):!s||!p?(0,i.jsx)(`div`,{className:`aha-page`,children:(0,i.jsx)(Bl,{progress:o.progress,label:a(`makingCards`),onCancel:o.running?o.cancel:void 0})}):(0,i.jsxs)(`div`,{className:`aha-page`,style:{maxWidth:720},children:[(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsx)(`h2`,{className:`aha-title`,children:a(`cardsTitle`)}),(0,i.jsx)(`span`,{className:`aha-tag`,children:a(`cardsDue`,{count:p.length})})]}),h?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`div`,{className:`aha-flash`,"data-flipped":d,onClick:()=>f(e=>!e),role:`button`,tabIndex:0,onKeyDown:e=>{(e.key===` `||e.key===`Enter`)&&f(e=>!e)},children:(0,i.jsxs)(`div`,{className:`aha-flashInner`,children:[(0,i.jsx)(`div`,{className:`aha-flashFace`,children:(0,i.jsx)(vu,{text:h.front})}),(0,i.jsx)(`div`,{className:`aha-flashFace aha-flashBack`,children:(0,i.jsx)(vu,{text:h.back})})]})}),(0,i.jsxs)(`p`,{className:`aha-hint`,style:{textAlign:`center`},children:[h.tag?`${h.tag} · `:``,a(`flip`)]}),d?(0,i.jsx)(`div`,{className:`aha-row`,style:{justifyContent:`center`},children:[[`again`,`again`],[`hard`,`hard`],[`good`,`good`],[`easy`,`easy`]].map(([e,t])=>(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":e===`good`?`primary`:void 0,onClick:()=>g(e),children:a(t)},e))}):null]}):(0,i.jsx)(Gl,{children:a(`cardsDone`)})]})}function xp({courseId:e,unitId:t,sheetId:n}){let{api:a,t:o,toast:s}=v(),c=b(),[l,u]=(0,r.useState)(null),[d,f]=(0,r.useState)(null),[p,m]=(0,r.useState)(null),h=async r=>{f(null);try{let i;if(n)i=(await a.call(`items/get`,{kind:`sheets`,id:n})).item.sheet;else{let n=await a.call(`unit/sheet`,{courseId:e,unitId:t,force:r});i=n.job?(await c.run(null,null,{existing:n.job})).sheet:n.sheet}u(i),m(i.layout)}catch(e){f(e)}};(0,r.useEffect)(()=>{h(!1)},[e,t,n]);let g=r=>{let i={...p,...r};m(i),(n?a.call(`items/sheet-layout`,{id:n,layout:i}):a.call(`unit/sheet-layout`,{courseId:e,unitId:t,layout:i})).catch(e=>s(Ul(o,e)))};if(d)return(0,i.jsx)(`div`,{className:`aha-page`,children:(0,i.jsx)(Wl,{error:d})});if(!l||!p)return(0,i.jsx)(`div`,{className:`aha-page`,children:(0,i.jsx)(Bl,{progress:c.progress,label:o(`makingSheet`),onCancel:c.running?c.cancel:void 0})});let _=p.order.map(e=>l.sections.find(t=>t.id===e)).filter(Boolean),y=new Set(p.hidden??[]);return(0,i.jsxs)(`div`,{className:`aha-page`,style:{maxWidth:1200},children:[(0,i.jsxs)(`div`,{className:`aha-spread aha-noprint`,children:[(0,i.jsx)(`h2`,{className:`aha-title`,children:l.title||o(`sheetTitle`)}),(0,i.jsxs)(`div`,{className:`aha-row`,children:[(0,i.jsxs)(`label`,{className:`aha-row`,style:{gap:6},children:[o(`columns`),(0,i.jsx)(`select`,{className:`aha-select`,style:{width:`auto`},value:p.columns,onChange:e=>g({columns:Number(e.currentTarget.value)}),children:[1,2,3,4].map(e=>(0,i.jsx)(`option`,{value:e,children:e},e))})]}),(0,i.jsxs)(`label`,{className:`aha-row`,style:{gap:6},children:[o(`fontSize`),(0,i.jsx)(`select`,{className:`aha-select`,style:{width:`auto`},value:p.fontSize,onChange:e=>g({fontSize:Number(e.currentTarget.value)}),children:[9,10,11,12,13,14,16].map(e=>(0,i.jsx)(`option`,{value:e,children:e},e))})]}),(0,i.jsxs)(`label`,{className:`aha-row`,style:{gap:6},children:[(0,i.jsx)(`input`,{type:`checkbox`,checked:p.highlight,onChange:e=>g({highlight:e.currentTarget.checked})}),o(`highlight`)]}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,onClick:()=>window.print(),children:o(`print`)}),n?null:(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,onClick:()=>{u(null),h(!0)},children:o(`regenerate`)})]})]}),(0,i.jsx)(`div`,{className:`aha-row aha-noprint`,style:{gap:6},children:_.map((e,t)=>(0,i.jsxs)(`span`,{className:`aha-chip`,"data-active":!y.has(e.id),children:[(0,i.jsx)(`span`,{onClick:()=>g({hidden:y.has(e.id)?[...y].filter(t=>t!==e.id):[...y,e.id]}),children:e.title}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,"data-size":`sm`,onClick:()=>{let t=[...p.order],n=t.indexOf(e.id);n>0&&([t[n-1],t[n]]=[t[n],t[n-1]]),g({order:t})},disabled:t===0,children:`↑`})]},e.id))}),(0,i.jsx)(`div`,{className:`aha-printable`,children:(0,i.jsx)(`div`,{className:`aha-sheet`,"data-highlight":p.highlight,style:{columnCount:p.columns,"--sheet-size":`${p.fontSize}px`},children:_.filter(e=>!y.has(e.id)).map(e=>(0,i.jsxs)(`div`,{className:`aha-sheetSection`,children:[(0,i.jsx)(`h4`,{children:e.title}),e.items.map((e,t)=>(0,i.jsxs)(`div`,{className:`aha-sheetItem`,"data-kind":e.kind,children:[e.title?(0,i.jsxs)(`b`,{children:[e.title,`:`]}):null,e.text?(0,i.jsx)(vu,{text:e.text,compact:!0}):null,e.tex?(0,i.jsx)(Ks,{tex:e.tex}):null,e.cite?(0,i.jsxs)(`span`,{className:`aha-cite`,children:[`(p.`,e.cite.page,e.cite.source?` · ${e.cite.source}`:``,`)`]}):null]},t)),e.related?.length?(0,i.jsxs)(`div`,{className:`aha-cite`,children:[`↔ `,e.related.join(` · `)]}):null]},e.id))})})]})}function Sp({kind:e,id:t,materialId:n}){let{api:a,t:o}=v(),s=b(),[c,l]=(0,r.useState)(null),[u,d]=(0,r.useState)(null),[f,p]=(0,r.useState)(0);if((0,r.useEffect)(()=>{let r=!0;return(async()=>{try{if(e===`digest`){let{material:e}=await a.call(`material/get`,{id:n}),t=f===0?e.digest:null;if(!t){let e=await a.call(`material/digest`,{id:n});t=(await s.run(null,null,{existing:e.job})).material.digest}r&&l({title:e.title,digest:t});return}let{item:i}=await a.call(`items/get`,{kind:`sheets`,id:t});r&&l({title:i.title,markdown:i.markdown})}catch(e){r&&d(e)}})(),()=>{r=!1}},[e,t,n,f]),e===`quiz`)return(0,i.jsx)(vp,{deckId:t});if(u)return(0,i.jsx)(`div`,{className:`aha-page`,children:(0,i.jsx)(Wl,{error:u})});if(!c){let e=s.progress;return(0,i.jsx)(`div`,{className:`aha-page`,children:(0,i.jsx)(Bl,{progress:e,label:e?.label===`reading`?o(`digestReading`,{done:e.done,total:Math.max(1,e.total-1)}):e?.label===`writing`?o(`digestWriting`):o(`generating`),onCancel:s.running?s.cancel:void 0})})}if(c.markdown!==void 0)return(0,i.jsxs)(`div`,{className:`aha-page`,style:{maxWidth:860},children:[(0,i.jsx)(`h2`,{className:`aha-title`,children:c.title}),(0,i.jsx)(`div`,{className:`aha-card`,children:(0,i.jsx)(vu,{text:c.markdown})})]});let m=c.digest;return(0,i.jsxs)(`div`,{className:`aha-page`,style:{maxWidth:900},children:[(0,i.jsxs)(`h2`,{className:`aha-title`,children:[o(`digestTitle`),` · `,c.title]}),m.missing?.length?(0,i.jsxs)(`div`,{className:`aha-row`,children:[(0,i.jsx)(`span`,{className:`aha-error`,children:o(`digestMissing`,{count:m.missing.length,parts:m.missing.join(`, `)})}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,onClick:()=>{l(null),p(e=>e+1)},children:o(`redigest`)})]}):null,(0,i.jsxs)(`section`,{className:`aha-card`,children:[(0,i.jsx)(`b`,{children:o(`overview`)}),(0,i.jsx)(vu,{text:m.overview})]}),m.structure?.length?(0,i.jsxs)(`section`,{className:`aha-card`,children:[(0,i.jsx)(`b`,{children:o(`structure`)}),m.structure.map((e,t)=>(0,i.jsxs)(`div`,{className:`aha-col`,style:{gap:2},children:[(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`b`,{children:e.heading}),/\d/u.test(e.pages??``)?(0,i.jsxs)(`span`,{className:`aha-cite`,children:[`(p.`,e.pages,`)`]}):null]}),(0,i.jsx)(`ul`,{style:{margin:0},children:e.points.map((e,t)=>(0,i.jsx)(`li`,{children:(0,i.jsx)(vu,{text:e,compact:!0})},t))})]},t))]}):null,m.keyIdeas?.length?(0,i.jsxs)(`section`,{className:`aha-card`,children:[(0,i.jsx)(`b`,{children:o(`keyIdeas`)}),(0,i.jsx)(`ul`,{style:{margin:0},children:m.keyIdeas.map((e,t)=>(0,i.jsx)(`li`,{children:(0,i.jsx)(vu,{text:e,compact:!0})},t))})]}):null,m.arguments?.length?(0,i.jsxs)(`section`,{className:`aha-card`,children:[(0,i.jsx)(`b`,{children:o(`arguments`)}),m.arguments.map((e,t)=>(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`b`,{children:e.claim}),/\d/u.test(e.page??``)?(0,i.jsxs)(`span`,{className:`aha-cite`,children:[`(p.`,e.page,`)`]}):null,(0,i.jsx)(`p`,{className:`aha-hint`,children:e.support})]},t))]}):null,m.glossary?.length?(0,i.jsxs)(`section`,{className:`aha-card`,children:[(0,i.jsx)(`b`,{children:o(`glossary`)}),m.glossary.map((e,t)=>(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`b`,{children:e.term}),`:`,e.meaning]},t))]}):null,m.questions?.length?(0,i.jsxs)(`section`,{className:`aha-card`,children:[(0,i.jsx)(`b`,{children:o(`discussion`)}),(0,i.jsx)(`ol`,{style:{margin:0},children:m.questions.map((e,t)=>(0,i.jsx)(`li`,{children:e},t))})]}):null]})}let Cp=[[`home`,`navHome`,`home`],[`courses`,`navCourses`,`courses`],[`assist`,`navAssist`,`assist`],[`materials`,`navMaterials`,`library`],[`studio`,`navStudio`,`studio`],[`shorts`,`navShorts`,`shorts`],[`plan`,`navPlan`,`plan`],[`profile`,`navProfile`,`profile`],[`settings`,`navSettings`,`settings`],[`about`,`navAbout`,`heart`]],wp={home:Gd,courses:hd,craft:kd,handout:zd,course:dd,lesson:Xf,practice:vp,cards:bp,sheet:xp,item:Sp,project:cp,materials:ep,studio:hp,assist:ed,shorts:pp,plan:np,profile:sp,settings:dp,about:vt},Tp={craft:`courses`,course:`courses`,lesson:`courses`,handout:`courses`,practice:`courses`,project:`courses`,cards:`studio`,sheet:`studio`,item:`studio`};function Ep(e){let[t,n]=(0,r.useState)(0);return(0,i.jsx)(s,{onError:st,fallback:({error:t})=>(0,i.jsx)(`div`,{className:`aha`,children:(0,i.jsx)(`main`,{className:`aha-main`,children:(0,i.jsx)(l,{t:e.t,error:t,onHome:()=>n(e=>e+1)})})}),children:(0,i.jsx)(Dp,{...e})},t)}function Dp({rpc:e,t,language:n,dsh:a}){let{route:o,setRoute:c,crashed:u}=ot(),d=(0,r.useRef)([]),f=(0,r.useCallback)((e,t={},{replace:n=!1}={})=>{c(r=>(n||(d.current.push(r),d.current.length>40&&d.current.shift()),{screen:e,params:t}))},[c]),p=(0,r.useCallback)(()=>{let e=d.current.pop();c(e??{screen:`home`,params:{}})},[c]);(0,r.useEffect)(()=>{let e=e=>{let t=e.detail;t?.screen&&wp[t.screen]&&f(t.screen,t.params??{})};return window.addEventListener(nt,e),()=>window.removeEventListener(nt,e)},[f]);let{value:m,toastText:h,textSize:g}=it({rpc:e,t,language:n,dsh:a,navigate:f,back:p}),v=Op(dt.includes(o.screen)),y=wp[o.screen]??Gd,b=Tp[o.screen]??o.screen,x=e=>{d.current=[],c({screen:e,params:{}})};return(0,i.jsx)(_.Provider,{value:m,children:(0,i.jsxs)(`div`,{className:`aha`,ref:v.root,"data-nav":v.state,"data-text":g,children:[(0,i.jsxs)(`nav`,{className:`aha-nav`,"aria-label":t(`appName`),onScroll:v.hideTip,children:[(0,i.jsxs)(`div`,{className:`aha-brand`,children:[(0,i.jsx)(ut,{name:`logo`,size:24}),(0,i.jsxs)(`span`,{children:[t(`appName`),(0,i.jsx)(`small`,{children:t(`appTagline`)})]})]}),Cp.map(([e,n,r])=>(0,i.jsxs)(`button`,{type:`button`,className:`aha-navItem`,"data-active":b===e,onClick:()=>{v.close(),x(e)},"aria-label":t(n),...v.tipFor(t(n)),children:[(0,i.jsx)(ut,{name:r,size:17}),(0,i.jsx)(`span`,{children:t(n)})]},e)),(0,i.jsxs)(`button`,{type:`button`,className:`aha-navItem aha-navFold`,"aria-expanded":v.state!==`folded`,"aria-label":v.state===`folded`?t(`navUnfold`):t(`navFold`),onClick:v.fold,...v.tipFor(t(`navUnfold`)),children:[(0,i.jsx)(ut,{name:v.state===`folded`?`unfold`:`fold`,size:17}),(0,i.jsx)(`span`,{children:t(`navFold`)})]})]}),v.state===`peek`?(0,i.jsx)(`div`,{className:`aha-navShade`,onClick:v.close}):null,v.tip?(0,i.jsx)(`div`,{className:`aha-navTip`,role:`tooltip`,style:{top:v.tip.top,left:v.tip.left},children:v.tip.label}):null,(0,i.jsx)(`main`,{className:`aha-main`,children:(0,i.jsx)(s,{resetKey:o,onError:u,fallback:({error:e})=>(0,i.jsx)(l,{t,error:e,onRetry:()=>c(e=>({...e})),onHome:()=>x(`home`)}),children:(0,i.jsx)(y,{...o.params},`${o.screen}:${JSON.stringify(o.params)}`)})}),h?(0,i.jsx)(`div`,{className:`aha-toast`,role:`status`,children:h}):null]})})}function Op(e){let[t,n]=C(`nav`,`open`),[i,a]=(0,r.useState)(!1),[o,s]=(0,r.useState)(!1),[c,l]=(0,r.useState)(null),u=(0,r.useRef)(null);(0,r.useLayoutEffect)(()=>{let e=u.current;if(!e)return;let t=()=>a(e.getBoundingClientRect().width<640);if(t(),typeof ResizeObserver!=`function`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]),(0,r.useEffect)(()=>s(!1),[i,e]);let d=ft({choice:t,narrow:i,inClass:e,peek:o});(0,r.useEffect)(()=>{if(l(null),d!==`peek`)return;let e=e=>{e.key===`Escape`&&s(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[d]);let f=(e,t)=>{d===`folded`&&u.current&&l({label:t,...mt(e.getBoundingClientRect(),u.current.getBoundingClientRect())})},p=()=>l(null);return{root:u,state:d,tip:c,hideTip:p,fold(){let r=pt({choice:t,narrow:i,inClass:e,peek:o});n(r.choice),s(r.peek)},close:()=>s(!1),tipFor:e=>({onMouseEnter:t=>f(t.currentTarget,e),onMouseLeave:p,onFocus:t=>{t.currentTarget.matches(`:focus-visible`)&&f(t.currentTarget,e)},onBlur:p})}}function kp({useTabInfo:e,rpc:t,t:n,language:r,dsh:a}){let{tab:o}=e(),c=o?.navigation?.params??null,{value:u,textSize:d}=it({rpc:t,t:n,language:r,dsh:a});return(0,i.jsx)(_.Provider,{value:u,children:(0,i.jsx)(`div`,{className:`aha aha-boardTab`,"data-text":d,style:{height:`100%`,overflow:`auto`,padding:`10px 12px`},children:c?.threadId?(0,i.jsx)(s,{fallback:({error:e,retry:t})=>(0,i.jsx)(l,{t:n,error:e,place:`tab`,onRetry:t}),children:(0,i.jsx)(Ap,{threadId:c.threadId,jobId:c.jobId})},`${c.threadId}:${o.navigation.revision??0}`):(0,i.jsx)(`p`,{className:`aha-hint`,children:n(`openBoard`)})})})}function Ap({threadId:e,jobId:t}){let{api:n,t:a}=v(),[o,s]=(0,r.useState)(null);return(0,r.useEffect)(()=>{let r=!0;return(async()=>{let i=t?await n.call(`job/get`,{id:t}).catch(()=>null):null;if(i&&i.status===`running`){r&&s({stream:i,steps:[],title:``});return}try{let{item:t}=await n.call(`items/get`,{kind:`assist`,id:e}),i=t.turns.at(-1);r&&s({stream:null,steps:i?.board?.steps??[],title:t.title,language:t.language,turn:t.turns.length-1})}catch(e){r&&s({error:e})}})(),()=>{r=!1}},[e,t]),o?o.error?(0,i.jsx)(`p`,{className:`aha-error`,children:Ul(a,o.error)}):(0,i.jsx)(Qu,{scope:{kind:`thread`,id:e,turn:o.turn??0},title:o.title||a(`boardSession`),steps:o.steps,stream:o.stream,language:o.language,recordChecks:!1,tour:!1,talkKey:!1}):(0,i.jsx)(Rl,{label:a(`loading`)})}function jp({rpc:e,t,language:n,dsh:r}){return it({rpc:e,t,language:n,dsh:r}).value}function Mp(e){return e?.meta&&typeof e.meta==`object`?e.meta:null}function Np(e){let t=jp(e);return(0,i.jsx)(_.Provider,{value:t,children:(0,i.jsx)(`div`,{className:`aha aha-card`,"data-text":`dsh`,style:{height:`auto`,display:`flex`,flexDirection:`column`,gap:8,margin:`6px 0`,padding:`10px 12px`},children:(0,i.jsx)(s,{fallback:({error:t,retry:n})=>(0,i.jsx)(l,{t:e.t,error:t,place:`card`,onRetry:n}),children:(0,i.jsx)(Pp,{...e})})})})}function Pp({toolName:e,phase:t,block:n,dsh:a,inputActions:o,t:s,callId:c}){let l=Mp(n),u=n?.args?.text?.(`topic`)??n?.args?.text?.(`goal`)??``,d=t!==`result`,f=t===`result`&&n?.isError;return(0,r.useEffect)(()=>{if(e!==`aha_whiteboard`||t!==`result`||!l?.threadId)return;let r=typeof n?.time!=`number`||Date.now()-n.time<12e4,i=`aha-tutor:opened:${c}`;try{if(!r||window.sessionStorage.getItem(i))return;window.sessionStorage.setItem(i,`1`)}catch{if(!r)return}a.openBoardTab({threadId:l.threadId,jobId:l.jobId})},[e,t,l?.threadId]),f?(0,i.jsx)(`span`,{className:`aha-error`,children:s(`errorGeneric`,{message:(n.content??[]).map(e=>e.text??``).join(` `).slice(0,200)})}):e===`aha_whiteboard`?(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsxs)(`span`,{className:`aha-row`,style:{gap:8},children:[d?(0,i.jsx)(`span`,{className:`aha-spinner`}):`🧑🏫`,(0,i.jsx)(`b`,{children:s(`toolBoardTitle`)}),(0,i.jsx)(`span`,{className:`aha-hint`,children:l?.title??u})]}),l?.threadId?(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,onClick:()=>a.openBoardTab({threadId:l.threadId,jobId:l.jobId}),children:s(`openBoard`)}):null]}):e===`aha_quiz`?d||!l?.items?(0,i.jsxs)(`span`,{className:`aha-row`,children:[(0,i.jsx)(`span`,{className:`aha-spinner`}),s(`makingPractice`)]}):(0,i.jsx)(Fp,{items:l.items,topic:l.topic,inputActions:o}):e===`aha_course`?(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsxs)(`span`,{className:`aha-row`,style:{gap:8},children:[d?(0,i.jsx)(`span`,{className:`aha-spinner`}):`🎓`,(0,i.jsx)(`b`,{children:s(`modeCourse`)}),(0,i.jsx)(`span`,{className:`aha-hint`,children:l?.goal??u})]}),l?.courseId?(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,onClick:()=>ct(a,`craft`,{courseId:l.courseId}),children:s(`open`)}):null]}):e===`aha_cheatsheet`?(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsxs)(`span`,{className:`aha-row`,style:{gap:8},children:[d?(0,i.jsx)(`span`,{className:`aha-spinner`}):`📄`,(0,i.jsx)(`b`,{children:s(`sheetTitle`)}),(0,i.jsx)(`span`,{className:`aha-hint`,children:l?.title??u})]}),l?.sheetId?(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,onClick:()=>ct(a,`sheet`,{sheetId:l.sheetId}),children:s(`open`)}):null]}):(0,i.jsxs)(`span`,{className:`aha-hint`,children:[d?(0,i.jsx)(`span`,{className:`aha-spinner`}):`🧠`,` `,s(`navProfile`)]})}function Fp({items:e,topic:t,inputActions:n}){let{t:a,language:o}=v(),[s,c]=(0,r.useState)(0),[l,u]=(0,r.useState)([]),d=e[s],f=(0,r.useMemo)(()=>l.map((e,t)=>`${t+1}. ${e.correct?`✔`:e.partial?`◐`:`✘`} ${e.answer}`).join(`
|
|
721
|
-
`),[l]);if(!d){let r=l.filter(e=>e.correct).length;return(0,i.jsxs)(`div`,{className:`aha-col`,children:[(0,i.jsx)(`b`,{children:a(`practiceDone`,{correct:r,total:e.length})}),n?.setDraft?(0,i.jsx)(`div`,{children:(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,"data-size":`sm`,onClick:()=>n.setDraft(`${t??``} ${a(`practiceDone`,{correct:r,total:e.length})}\n${f}`),children:a(`submit`)})}):null]})}return(0,i.jsxs)(`div`,{className:`aha-col`,children:[(0,i.jsxs)(`span`,{className:`aha-hint`,children:[a(`checkTitle`),` · `,s+1,`/`,e.length]}),(0,i.jsx)(Hu,{item:d,language:o===`zh`?`zh-CN`:`en`,compact:!0,onResult:e=>u(t=>[...t,{...e,answer:d.prompt.slice(0,60)}]),onContinue:()=>c(e=>e+1)},s)]})}let Ip=`ahaTutor`,Lp={appName:`开窍`,appTagline:`AI 私人老师`,navHome:`首页`,navCourses:`我的课程`,navMaterials:`资料库`,navStudio:`学习工具`,navAssist:`即时答疑`,navShorts:`讲解短片`,navPlan:`学习计划`,navProfile:`我的画像`,navSettings:`设置`,navAbout:`关于作者`,navFold:`收起`,navUnfold:`展开`,heroTitle:`今天想把什么弄懂?`,heroHint:`说出你想学的东西,或者丢一本教材进来。我会先了解你,再为你量身做一门课,在白板上一步步讲给你听。`,heroPlaceholder:`比如:三周内搞懂线性代数里的特征值|把这份讲义变成一门课|量子隧穿到底是怎么回事`,modeCourse:`定制一门课`,modeExplain:`讲个概念`,modeSolve:`陪我解题`,modeVisualize:`画出来看看`,modeDigest:`消化长文档`,modeShort:`两分钟短片`,attach:`添加资料`,attached:`已附 {count} 份资料`,start:`开始`,quickStart:`跳过提问,直接出课`,continueLearning:`继续学习`,todayPlan:`今天的安排`,noPlanToday:`今天没有安排,去建一门课或者休息一下吧。`,recentWork:`最近做的`,sampleCourses:`示例课程`,sampleHint:`不花 token 也能先体验白板课堂。`,importSample:`加入我的课程`,coursesTitle:`我的课程`,filterAll:`全部`,filterActive:`学习中`,filterDone:`已学完`,filterArchived:`已归档`,searchCourses:`搜索课程`,noCourses:`还没有课程。回到首页,告诉我你想学什么。`,importPack:`导入课程包`,lessonsCount:`{done}/{total} 讲`,minutesLeft:`还剩约 {minutes} 分钟`,statusIntake:`待回答问题`,statusBlueprint:`待确认蓝图`,statusReady:`可以学习`,nextUp:`下一讲:{title}`,craftQuestionsTitle:`先认识一下你`,craftQuestionsHint:`回答几个问题,课程会按你的情况来设计。拿不准的可以跳过。`,craftOther:`其他(自己写)`,craftPace:`学习节奏`,paceIntensive:`冲刺`,paceIntensiveHint:`约 6 周,抓重点`,paceBalanced:`稳步`,paceBalancedHint:`约 3 个月,基础 + 练习 + 项目`,paceRelaxed:`不设期限`,paceRelaxedHint:`慢慢来,挖得更深`,weeklyMinutes:`每周大约能学多久`,minutesUnit:`{minutes} 分钟`,deadline:`截止日期(可选)`,makeBlueprint:`生成课程蓝图`,thinkingQuestions:`正在想该问你什么…`,designingBlueprint:`正在设计课程蓝图…`,blueprintTitle:`课程蓝图`,blueprintHint:`这是为你设计的课程结构。可以直接改标题、删减或调整顺序,也可以用一句话让我改。`,reviseLabel:`用一句话修改`,revisePlaceholder:`比如:多加一些编程实战;第二单元讲浅一点;去掉第 3 讲`,revise:`修改`,revising:`正在修改…`,addLesson:`加一讲`,addLecture:`加一章`,addUnit:`加一个单元`,moveUp:`上移`,moveDown:`下移`,remove:`删除`,projects:`实战项目`,confirmCourse:`确认,生成整门课`,confirming:`正在准备练习和项目… {done}/{total}`,courseReady:`课程已就绪`,unitN:`第 {n} 单元`,lectureN:`第 {n} 章`,estMinutes:`{minutes} 分钟`,saveEdits:`保存修改`,saved:`已保存`,tabOutline:`大纲`,tabPractice:`练习与测验`,tabSheets:`速查表`,tabCards:`闪卡`,tabProjects:`项目`,tabProgress:`进度`,learn:`学习`,practice:`练习`,review:`复习`,remedial:`巩固`,exportPack:`导出课程包`,exportWithProgress:`连同我的学习进度`,rename:`重命名`,archive:`归档`,unarchive:`取消归档`,deleteCourse:`删除课程`,deleteConfirm:`删除后无法恢复。确定删除「{title}」吗?`,cancel:`取消`,confirm:`确定`,close:`关闭`,back:`返回`,retry:`重试`,generate:`生成`,regenerate:`重新生成`,generating:`正在生成…`,open:`打开`,unitQuiz:`单元测验`,unitSheet:`单元速查表`,mastery:`掌握度`,conceptMastery:`知识点掌握情况`,preparingLesson:`老师正在备课…`,bufferingLesson:`下一部分马上写好…`,play:`播放`,pause:`暂停`,prevStep:`上一步`,nextStep:`下一步`,speed:`语速`,voiceOn:`声音开`,voiceOff:`静音`,voiceDownCloud:`云端语音用不了:{reason}这节课先静音往下讲。`,voiceDownSystem:`朗读用不了:{reason}这节课先静音往下讲。`,openSettings:`去设置`,captions:`字幕`,raiseHand:`举手提问`,askPlaceholder:`哪里没听懂?直接问`,ask:`提问`,answering:`老师在想怎么回答…`,reexplain:`换个讲法`,styleAnalogy:`打个比方`,styleVisual:`画图讲`,styleExample:`举个例子`,styleSimpler:`讲简单点`,styleDeeper:`讲深一点`,stepOf:`第 {current}/{total} 步`,checkTitle:`小测一下`,confidence:`你有多确定?`,pickSeveral:`多选题:选出所有正确的选项。`,confSure:`很确定`,confUnsure:`有点犹豫`,confGuess:`猜的`,submit:`提交`,correct:`答对了`,incorrect:`不太对`,partial:`部分正确`,continue:`继续`,skip:`跳过`,hint:`提示`,yourAnswer:`你的答案`,grading:`老师在批改…`,lessonDone:`这一讲讲完了`,selfRate:`你觉得自己掌握得怎么样?`,rate1:`没懂`,rate3:`一般`,rate5:`很清楚`,nextLesson:`下一讲`,doPractice:`去做练习`,backToCourse:`回到课程`,remedialAdded:`我给你加了一节巩固课:{title}`,challengeNote:`这部分你掌握得很好,接下来会讲得更深一些。`,replay:`重新讲一遍`,regenerateLesson:`重新备课`,exportBoard:`导出板书`,practiceTitle:`练习`,check:`检查答案`,checked:`已检查`,score:`得分 {score}`,practiceDone:`本组练习完成:答对 {correct}/{total}`,showExplanation:`看解析`,makingPractice:`正在出题…`,cardsTitle:`闪卡`,cardsDue:`待复习 {count} 张`,flip:`点击翻面`,again:`忘了`,hard:`困难`,good:`记得`,easy:`简单`,cardsDone:`这一轮复习完成了!`,makingCards:`正在制作闪卡…`,sheetTitle:`速查表`,columns:`列数`,fontSize:`字号`,highlight:`高亮重点`,print:`打印`,hideSection:`隐藏`,showSection:`显示`,makingSheet:`正在整理速查表…`,projectBrief:`项目说明`,milestones:`里程碑`,rubric:`评分标准`,openWorkspace:`打开项目工作区`,openingWorkspace:`正在准备项目文件夹…`,workspaceReady:`项目文件夹在:{path}`,workspaceSession:`已在 DSH 中打开项目会话`,workspaceManual:`在 DSH 里把这个文件夹添加为工作区,就能让编程 Agent 陪你完成项目。`,copyPath:`复制路径`,submitProject:`提交作品`,submitNotes:`写点说明(做了什么、遇到的问题)`,includeFiles:`同时提交项目文件夹里的文件`,reviewing:`老师在看你的作品…`,reviewTotal:`总分 {total}/{max}`,strengths:`做得好的地方`,nextSteps:`可以改进的地方`,submissions:`历次提交`,materialsTitle:`资料库`,materialsHint:`上传教材、讲义、论文或网页,用来建课、做速查表和闪卡,讲课时也会引用原文页码。`,uploadFiles:`上传文件`,dropHere:`把文件拖到这里(PDF、Word、PPT、Markdown、文本、图片)`,addUrl:`添加网页`,urlPlaceholder:`https://…`,reading:`正在读取…`,pages:`{count} 页`,slides:`{count} 张幻灯片`,makeCourse:`用它建课`,makeSheet:`速查表`,makeCards:`闪卡`,makeNotes:`笔记`,makeQuiz:`测验`,digest:`消化`,digestTitle:`文档消化`,overview:`概要`,structure:`结构`,keyIdeas:`核心观点`,arguments:`论点与论据`,glossary:`术语表`,discussion:`值得思考的问题`,imageNeedsVision:`图片需要支持识图的模型才能读取。`,readingPictures:`正在识别图片里的文字 {done}/{total}:{name}`,summarizingMaterial:`正在整理要点:{name}`,readScanPages:`已识别 {count} 页扫描页`,readPictures:`已识别 {count} 张图片里的字`,readPhoto:`已识别图中文字`,photoNoText:`图里没有读到文字`,readPartly:`有些内容没读到`,listJoin:`、`,unreadPages:`有 {count} 页没有文字层(扫描页或整页图片):当前模型看不了图,这些页没有读到。在开窍设置里换一个带 🖼 的模型,再重新上传。`,unreadPictures:`有 {count} 张图片里的字没有读到:当前模型看不了图。在开窍设置里换一个带 🖼 的模型,再重新上传。`,failedPages:`第 {list} 页没有识别出来`,failedSlides:`第 {list} 张幻灯片没有识别出来`,failedPictures:`第 {list} 张图片没有识别出来`,failedPhoto:`图里的字没有识别出来`,failedWhy:`{what}:{reason}`,failedRetry:`{what},重新上传可以再试。`,leftPages:`后面还有 {count} 页没有识别:一个文件最多识别 200 页,可以把文件拆开再上传。`,leftPictures:`后面还有 {count} 张图片没有识别:一个文件最多识别 200 张。`,noMaterials:`资料库是空的。`,studioTitle:`学习工具`,studioHint:`用资料库里的资料一键生成学习材料。`,pickMaterials:`选择资料`,sheets:`速查表`,notes:`笔记`,decks:`闪卡组`,quizzes:`测验`,focusPlaceholder:`重点(可选),比如:期中考试范围第 3–6 章`,assistTitle:`即时答疑`,assistHint:`不用建课,有问题直接问。老师会在白板上讲给你听。`,assistPlaceholder:`想问什么?可以贴题目、概念或附上资料`,followUp:`继续追问`,history:`历史记录`,newThread:`新的问题`,shortsTitle:`讲解短片`,shortsHint:`输入一个主题或贴一个网址,生成一段约两分钟、能分享的白板讲解。`,topicPlaceholder:`比如:为什么天空是蓝色的`,makeShort:`生成短片`,exportVideo:`导出视频`,exporting:`正在录制视频…{percent}%`,exportNeedsCloud:`浏览器语音无法录进视频,导出的视频会带字幕但没有声音。在设置里配置云端语音即可导出有声版。`,exportUnsupported:`当前环境不支持导出视频。`,planTitle:`学习计划`,planHint:`根据你所有在学的课程、每周时间和截止日期自动排课,并留出复习时间。`,studyDays:`学习日`,weekdays:`日,一,二,三,四,五,六`,exams:`考试与截止日期`,addExam:`添加`,examTitle:`名称`,examDay:`日期`,deadlineRisk:`「{course}」按现在的节奏会在 {finish} 学完,晚于截止日期 {deadline}。建议每周提高到约 {minutes} 分钟。`,startReview:`开始复习`,reviewDue:`有 {count} 个知识点该复习了`,nothingToReview:`暂时没有要复习的内容。`,savePlan:`保存`,lessonItem:`学习`,reviewItem:`复习`,examItem:`考试`,today:`今天`,profileTitle:`我的画像`,profileHint:`老师会记住这些信息,让每门课都更贴合你。你可以随时修改或清空。`,background:`背景`,goals:`目标`,strengthsLabel:`擅长`,weaknesses:`薄弱点`,learningStyle:`喜欢的讲解方式`,memoryNotes:`老师的备忘`,clearProfile:`清空画像`,clearProfileConfirm:`清空后老师会忘记你的背景和偏好。确定吗?`,onePerLine:`每行一条`,settingsTitle:`设置`,modelsTitle:`模型`,teachModel:`出课与讲课`,quickModel:`批改与问答`,followDefault:`跟随 DSH 默认模型`,modelsHint:`讲课质量主要取决于「出课与讲课」模型;批改和课堂提问可以用更快的模型。带 🖼 的模型能看图,扫描件、照片和图片里的字靠它识别。`,voiceTitle:`语音讲解`,engine:`语音来源`,engineBrowser:`系统语音(免费)`,engineCloud:`云端语音`,engineOff:`不朗读`,browserVoice:`系统音色`,autoVoice:`自动选择`,noVoiceForLanguage:`没有找到适合当前语言的系统音色。可以在系统设置里安装中文语音,或改用云端语音。`,cloudProvider:`云端服务`,providerOpenai:`OpenAI 兼容接口`,providerVolcengine:`火山引擎(豆包语音)`,providerMinimax:`MiniMax`,providerAzure:`Azure 语音`,field_baseUrl:`接口地址`,field_model:`模型`,field_voice:`音色`,field_appId:`App ID`,field_cluster:`Cluster`,field_groupId:`Group ID`,field_region:`区域`,field_apiKey:`密钥`,keySaved:`已保存密钥`,keyMissing:`未保存密钥`,saveKey:`保存密钥`,clearKey:`清除密钥`,testVoice:`试听`,testSentence:`你好,我是你的私人老师。我们一起把难的东西弄懂。`,voiceRate:`默认语速`,boardTheme:`白板外观`,themeAuto:`跟随系统`,themeLight:`白板`,themeDark:`黑板`,versionTitle:`插件版本`,versionCurrent:`当前版本`,versionLatest:`最新版本`,versionCheck:`检查更新`,versionChecking:`正在检查…`,versionFailed:`无法检查最新版本。`,versionUpToDate:`已是最新版本。`,versionAvailable:`发现新版本 v{version}。`,versionLinked:`当前是本地开发安装,请在插件仓库拉取最新代码并重新构建。`,versionManual:`没找到这个插件所在的 profile,请到 DSH 插件页按精确版本安装:dsh-aha-tutor@{version}。`,versionUpdate:`更新插件`,versionUpdating:`正在更新…`,versionUpdateFailed:`更新失败,请稍后重试,或到 DSH 插件页按精确版本手动安装。`,versionPending:`v{version} 刚发布不久,DSH 的 pnpm 要等过了发布冷却期才会安装,请稍后再试。`,versionPendingUntil:`v{version} 刚发布不久,DSH 的 pnpm 要等过了发布冷却期才会安装,{time} 之后可以更新。`,versionUpdated:`已更新到 v{version}。请完全退出并重新打开 DSH 桌面版,新版本才会生效(只刷新页面不够)。`,privacyNote:`课程、进度和资料都只保存在这台电脑的 DSH 数据目录里。`,aboutTitle:`关于作者`,aboutRole:`「开窍 · AI 私人老师」的作者`,aboutIntro:`开窍免费开源,赞赏全凭心意。如果它帮你弄懂了某个卡了很久的知识点,欢迎扫码支持,让小窍继续长大。`,aboutRepo:`GitHub 仓库`,aboutIssues:`问题反馈`,aboutSupport:`支持作者`,aboutWechat:`微信赞赏`,aboutAlipay:`支付宝`,aboutScan:`用手机扫一扫上面的码`,errorGeneric:`出了点问题:{message}`,crashPage:`这一页出了点问题,没能显示出来。`,crashPageHint:`可以重试一次,或者先回到首页。`,crashPart:`这部分内容出了点问题,没能显示出来。`,backHome:`回到首页`,loading:`加载中…`,empty:`这里还什么都没有。`,copied:`已复制`,minutes:`分钟`,untitled:`未命名`,delete:`删除`,edit:`编辑`,save:`保存`,all:`全部`,mode:`模式`,boardSession:`白板讲解`,toolBoardTitle:`老师在白板上讲解`,openBoard:`打开白板`,panelLabel:`开窍 · AI 私人老师`,copyCode:`复制`,footnotes:`脚注`,"err_llm-auth":`模型未登录或密钥无效,请在 DSH 设置里检查模型服务。`,"err_llm-quota":`模型额度不足或请求太频繁,稍后再试。`,"err_llm-context":`资料太长,超出了模型的上下文。少选一些资料,或换一个上下文更大的模型。`,"err_llm-unavailable":`所选模型不可用,请在开窍设置里换一个模型。`,"err_llm-timeout":`模型响应超时,请重试。`,"err_bad-output":`模型这次没给出可用的结果,请重试,或在设置里换一个更强的模型。`,boardView:`板书视图`,viewCanvas:`画布`,viewPages:`分页`,boardViewHint:`画布:整讲的板书从上到下排在一张画布上,可以拖动、缩放,讲课时自动跟着老师写的地方。分页:一次看一页,用右上角的页码翻页。`,canvasTools:`画布缩放`,canvasHelp:`拖动或滚动来移动,按住 Ctrl/⌘ 滚动或双指捏合来缩放,双击某一页放大到这一页`,canvasZoomIn:`放大`,canvasZoomOut:`缩小`,canvasZoomReset:`回到 100%(铺满宽度)`,canvasFit:`看全貌:缩小到能看到所有页`,canvasFitShort:`全貌`,canvasFollow:`回到老师这里`,canvasPage:`第 {n} 页`,voiceAsk:`说出问题`,voiceAskWith:`说出问题(麦克风:{name})`,voiceStop:`停止录音`,talkKeyHint:`快捷键:按住 V 说话,松开结束;也可以按一下 V 开始,说完再按一下。`,raiseHandKey:`暂停讲课,在提问框里提问。也可以直接按住 V 说出问题。`,voiceSetup:`语音提问需要先在 DSH 里启用「语音输入」`,voiceWorking:`识别中…`,voice_off:`语音提问用的是 DSH 的实验功能「语音输入」:在 DSH 的插件管理里启用「语音输入」,在它的详情里点「下载并准备」,准备好后再点这里。`,voice_unprepared:`语音识别模型还没准备好:在 DSH 插件管理的「语音输入」详情里点「下载并准备」(约 240 MB),准备好后再点这里。`,voice_preparing:`语音识别模型正在准备,好了以后再点这里。进度在 DSH 插件管理的「语音输入」详情里。`,voice_failed:`语音识别模型没有准备成功:到 DSH 插件管理的「语音输入」详情里重试。`,"err_speech-off":`DSH 的「语音输入」没有启用:在 DSH 的插件管理里启用它并下载准备模型。`,"err_speech-unprepared":`语音识别模型还没准备好:在 DSH 插件管理的「语音输入」详情里点「下载并准备」。`,"err_speech-audio":`这段录音没法读取,请再录一次。`,"err_speech-too-long":`录音太长了,一次最多 2 分钟。`,"err_speech-failed":`语音识别出错了,请再试一次。`,"err_speech-empty":`没听到说话,请离麦克风近一点再说一次。`,"err_mic-denied":`没有麦克风权限:请在浏览器或系统设置里允许 DSH 使用麦克风。`,"err_mic-missing":`没有找到麦克风。`,"err_mic-chosen-missing":`DSH「语音输入」里选的麦克风现在用不了:插上它,或到 DSH 插件管理的「语音输入」详情里换一个。`,micChosenMissing:`DSH「语音输入」里选的麦克风「{name}」现在用不了:插上它,或到 DSH 插件管理的「语音输入」详情里换一个。`,"err_mic-busy":`麦克风正被别的程序占用。`,"err_mic-unsupported":`这里没法录音。`,prepThinking:`构思`,prepWriting:`写板书`,prepStarting:`正在联系模型…`,prepThinkingDetail:`老师在想这一讲怎么讲,已构思 {chars} 字`,prepStep:`正在写第 {n} 步`,prepCounts:`已写好 {steps} 步 · 共 {chars} 字`,prepSeconds:`已用 {seconds} 秒`,dayLabel:`{month} 月 {day} 日 · 周{weekday}`,exportPdf:`PDF 文档(一页一张板书)`,exportPng:`PNG 图片(每页一张)`,exportMarkdown:`Markdown 文本`,exportingBoard:`正在导出板书…{done}/{total}`,animationStill:`动画(在课堂里播放)`,monthLabel:`{year} 年 {month} 月`,prevMonth:`上个月`,nextMonth:`下个月`,markDone:`标记为已完成`,unmarkDone:`取消完成`,checkedAuto:`已在课程里完成`,dayEmpty:`这天没有安排。`,webResearch:`联网查资料`,webResearchHint:`建课前先用 DSH 的网页搜索查一查这个主题,出题和设计课程时参考`,researching:`正在联网查资料…`,researchFound:`参考了 {count} 个网上来源`,researchSkipped:`未联网检索:{reason}`,"researchSkipped_no-credential":`DSH 还没有配置 DeepSeek 密钥,网页搜索要用它`,researchSkipped_unavailable:`这个 DSH 没有可用的网页搜索`,researchSkipped_failed:`搜索出错了`,researchSkipped_empty:`没有搜到合适的资料`,courseSources:`参考来源`,buildResearch:`参考 {count} 个网上来源`,"err_llm-empty":`模型这次没有返回内容,请重试。如果一直这样,可以在开窍设置里换一个模型。`,"err_llm-failed":`调用模型出错了,请稍后重试。`,nextStepTitle:`下一步`,nextStepReview:`有 {count} 个知识点到了复习的时候`,nextStepWeak:`「{concept}」还比较薄弱,先练一练`,nextStepLesson:`接着学「{title}」`,nextStepDone:`这门课都学完了,做一次单元测验检验一下吧`,practiceThis:`练习这一讲`,streakCount:`连对 {count}`,keysHint:`键盘:1–4 选择 · Enter 提交或继续 · H 看提示`,starsLabel:`{count} 颗星`,accuracy:`正确率`,bestStreak:`最长连对`,masteryChange:`这一轮之后的掌握程度`,stageNone:`未开始`,stageWeak:`薄弱`,stageLearning:`学习中`,stageProficient:`熟练`,stageMastered:`掌握`,nextRelearn:`有几个点还没吃透,回到这一讲再听一遍会更稳。`,nextReview:`基本会了,但还不够牢,复习一轮会记得更久。`,nextQuiz:`掌握得很扎实,可以挑战单元测验了。`,nextLessonStep:`可以继续往下学了。`,nextCourse:`这一部分练完了。`,relearnLesson:`回到这一讲`,reviewCourse:`复习这门课`,editOutline:`编辑课程大纲`,saveAndBack:`保存并返回`,extendCourse:`让老师续写一个单元`,extendInstruction:`在课程最后再加一个单元:承接已有内容,往前推进一步,保持同样的难度梯度;已有的单元保持不变。`,proposalTitle:`老师的修改建议`,proposalNoChange:`这次修改没有改动任何一讲。`,applyProposal:`应用修改`,discardProposal:`放弃`,proposalApplied:`已应用修改`,diffAdded:`新增`,diffRemoved:`删除`,diffRenamed:`改名`,diffChanged:`调整`,diffUnit:`单元「{title}」`,reworkLesson:`让老师改这一讲`,splitLesson:`拆成两讲`,deepenLesson:`讲深一些`,splitDone:`已拆成两讲,记得保存`,deepenDone:`已改得更深,记得保存`,confirmRemoveUnit:`删除单元「{title}」和其中所有的课?`,confirmRemoveLecture:`删除「{title}」和其中所有的课?`,confirmRemoveStarted:`「{title}」已经开始学了,删除后这一讲的板书和进度都不再显示。确定删除?`,craftSize:`课程规模`,sizeAuto:`让老师决定`,sizeAutoHint:`按你的目标定,一个小问题可能只要一两讲`,sizeShort:`精简`,sizeShortHint:`3–8 讲,抓住最关键的部分`,sizeStandard:`标准`,sizeStandardHint:`10–20 讲,基础、练习加一个应用项目`,sizeFull:`完整`,sizeFullHint:`25–45 讲,系统深入,留出拓展的空间`,buildAnswers:`整理你的回答`,buildMaterials:`阅读你的资料`,buildUnits:`规划单元`,buildLessons:`写每一讲`,buildLessonsSoFar:`写每一讲:已写好 {count} 讲`,workPlaceholder:`一步一行写出你的过程,公式写在 $…$ 里,例如 $x^2+6x+9=(x+3)^2$`,workPreview:`公式预览`,wrongStep:`出错的一步`,fixedStep:`应该写成`,correction:`订正`,correctionOf:`订正:{tag}`,correcting:`老师在板上订正…`,seeCorrection:`看老师订正`,handout:`讲义`,handoutHint:`把这一讲整理成一页可打印的讲义`,handoutOfLesson:`本讲讲义`,handoutMaking:`老师在把这一讲整理成讲义…`,handoutPoints:`要点`,handoutExample:`例题`,handoutMistakes:`常见错误`,handoutGlossary:`术语表`,handoutQuestions:`自测`,handoutAnswer:`答案`,backToLesson:`回到这一讲`,addMaterials:`补充资料`,addMaterialsTitle:`给这门课补充资料`,addMaterialsHint:`选几份资料(也可以现在上传),老师会看看它们讲了什么,给出怎么改大纲的建议;你应用之后才生效,学过的讲保留进度,以后讲课也会引用这些资料。`,addMaterialsPlaceholder:`想让老师怎么用这些资料(可以不填),比如:重点补上第 5 章的例题`,addMaterialsSend:`请老师看看怎么加`,changeMaterials:`改选资料`,proposalMaterials:`补充资料:{titles}`,librarySearch:`找资料:输入标题或主题即时筛选,回车在正文里搜`,librarySearchText:`搜正文`,libraryFound:`正文里找到 {count} 处`,libraryNotFound:`正文里没找到「{query}」`,libraryNoTitleMatch:`没有标题或主题对得上的资料,按回车可以在正文里搜。`,pageN:`第 {page} 页`,slideN:`第 {slide} 张`,tourLabel:`课堂导览`,tourReplay:`课堂导览`,tourSkip:`跳过`,tourBack:`上一步`,tourNext:`下一步`,tourStart:`开始上课`,tourBoardTitle:`老师在这块黑板上讲`,tourBoard:`老师边讲边写。拖动或滚动可以移动板书,按住 Ctrl(Mac 上是 ⌘)滚动可以缩放,右上角的「全貌」能看到整讲。`,tourControlsTitle:`播放和节奏`,tourControls:`播放、暂停、上一步、下一步和语速都在这里,按空格也能暂停;字幕和声音可以随时开关。`,tourRaiseTitle:`有问题就举手`,tourRaise:`点「举手提问」,或者直接在提问框里写。也可以说出来:点麦克风,或者按住 V 键说话,松开后问题就进了提问框。老师答完会接着讲。`,tourReexplainTitle:`这一步没听懂`,tourReexplain:`点「换个讲法」,让老师打个比方、画图、举个例子,或者讲简单点、讲深一点。`,tourChallengeTitle:`觉得讲错了`,tourChallenge:`点「这一步不对?」,老师会先仔细核对;真错了会当场改正,并把这一讲一起改好。`,tourPanelTitle:`课堂要点和讲解记录`,tourPanel:`这里能看到这一讲的要点讲到了哪儿;老师说过的话都在讲解记录里,点一条就回到那里。`,outlineView:`大纲的显示方式`,viewList:`列表`,viewMap:`导图`,mapTools:`导图工具`,mapFollow:`回到最新`,mapPick:`到列表里编辑这一讲`,depthTitle:`这一讲的讲法`,depthNone:`不限`,depth_intuition:`直观理解`,depth_definition:`定义概念`,depth_derivation:`推导证明`,depth_application:`动手应用`,depth_extension:`深入拓展`,profileName:`怎么称呼你`,profileNameHint:`老师开课时会这样叫你一次,可以不填`,profileNamePlaceholder:`比如:小明`,challenge:`这一步不对?`,challengeLabel:`这一步不对?`,challengeTitle:`这一步哪里不对?(可以不填)`,challengeTitleStep:`第 {n} 步哪里不对?(可以不填)「{text}」`,challengePlaceholder:`比如:5 cm 是不是应该换成 0.05 m?`,challengeHint:`老师会先仔细算一遍,要等十几秒到半分钟。`,challengeSend:`请老师核对`,challengeLine:`不对?`,challengeStep:`第 {n} 步不对?`,checkingStep:`老师在仔细核对这一步…`,challenge_wrong:`确实有错,已更正`,challenge_right:`核对过,没有错`,challenge_unclear:`要看约定`,fixed:`已更正`,fixedWas:`原来写的是:{was}`,itemChallenge:`这题有问题?`,itemChallengeTitle:`这题哪里不对?(可以不填)`,itemChallengePlaceholder:`比如:我觉得 B 也对;或者:答案的单位是不是错了?`,itemChallengeHint:`老师会先仔细算一遍,要等几秒到半分钟,你可以先做下一题。`,itemChecking:`老师在仔细核对这道题…`,itemCheckTitle:`老师核对`,itemCheck_wrong:`确实有错,已更正`,itemCheck_unclear:`题目没说清楚,已补充`,itemCheck_misgraded:`判分有误,已重新判`,itemCheck_right:`核对过,没有错`,regraded:`(重新判过)`,itemCheckDone:`第 {n} 题核对完了:{verdict}。`,itemCheckRegraded:`已按核对结果重新判分。`,itemCheckEarlier:`这道题你之前还答过 {count} 次,也按改好的题重新判了。`,itemCheckFailedNotice:`第 {n} 题没核对成功:{message}`,fixedWasItem:`原来写的:`,fixedPart_prompt:`题目:{text}`,fixedPart_option:`选项 {id}:{text}`,fixedPart_answer:`答案:{text}`,fixedPart_unit:`单位:{text}`,fixedPart_tolerance:`允许误差:{text}`,fixedPart_explanation:`解析:{text}`,fixedPart_hints:`提示:{text}`,fixedPart_rubric:`评分要点:{text}`,fixedPart_figure:`图也重画了`,lessonGoals:`课堂要点`,transcript:`讲解记录`,showPanel:`讲解记录`,hidePanel:`收起侧栏`,panelTitle:`课堂侧栏`,boardFont:`板书字体`,fontHand:`手写体`,fontStandard:`标准体`,textSize:`文字大小`,textStandard:`标准`,textLarge:`大`,textLarger:`特大`,textSizeHint:`开窍里的文字一起变大,马上生效。板书和思维导图用它们自己的缩放按钮;DSH「设置 → 通用设置 → 字号大小」也会让这里的文字跟着变。`,digestMissing:`有 {count} 部分没读成功({parts}),下面的结果不含这些内容。`,redigest:`重新消化`,revisingSoFar:`正在修改…已写好 {count} 节课`,"err_bad-url":`这个网址不能导入:只支持公开网站的 http 或 https 地址,不支持本机、局域网和带账号密码的地址。`,err_network:`网页打不开或加载超时,请检查网址后重试。`,err_http:`网页返回了错误,没能导入。`,blueprintSoFar:`正在设计课程蓝图…已写好 {count} 节课`,reexplainedAs:`换个讲法:{style}`,digestReading:`正在通读全文:已读 {done}/{total} 部分`,digestWriting:`正在汇总全文要点`,keepsRunning:`可以先离开这一页,生成会在后台继续。`,err_cancelled:`已取消。`,courseCreatedInChat:`课程「{title}」已创建,可以在「开窍」里继续。`,err_failed:`出了点问题,请稍后再试。`,err_invalid:`这个请求没法处理。请刷新页面后再试;如果还是这样,请退出并重新打开 DSH。`,"err_not-found":`找不到这项内容,它可能已经被删除了。`,err_forbidden:`没有权限做这件事。`,"err_unknown-endpoint":`插件刚更新过,请退出并重新打开 DSH 后再试。`,err_aborted:`上传中断了,请重试。`,err_connection:`连不上 DSH,请确认它还开着,然后重试。`,err_missing:`这项任务找不到了,可能是 DSH 重启过,请重试。`,"err_llm-missing":`还没有可用的模型,请先在 DSH 设置里配置一个模型服务。`,"err_no-board":`板书还没写好,等第一步出来再试。`,"err_empty-question":`先写下你的问题。`,"err_empty-goal":`先说说你想学什么,或者添加一份资料。`,"err_empty-change":`先写下你想怎么改。`,"err_no-blueprint":`还没有课程蓝图,请先生成蓝图。`,"err_no-proposal":`没有待确认的修改,它可能已经应用或放弃了。`,"err_bad-pack":`这个文件不是能导入的课程包。`,"err_pack-too-large":`这个课程包太大了,导入不了。`,"err_pack-too-new":`这个课程包是新版开窍导出的,请先更新插件再导入。`,"err_nothing-to-review":`还没有可以评阅的内容:先写几句说明,或在项目文件夹里做些修改。`,"err_cannot-tick":`只能勾选今天或之前的学习项。`,"err_exam-incomplete":`考试需要填写名称和日期。`,"err_no-material":`先选至少一份资料。`,"err_material-no-text":`所选资料里没有可读的文字,图片和扫描版 PDF 读不出文字。`,"err_empty-topic":`先写下一个主题,或者填一个网址。`,"err_no-credentials":`这个 DSH 配置里用不了凭据存储,没法保存密钥。`,"err_bad-key":`密钥格式不对:应为 8–1024 个英文字母、数字或符号,不能有空格。`,err_unsupported:`不支持这种文件。可以上传 PDF、Word、PowerPoint、图片,或 .md、.txt、.csv 这类文本文件。`,"err_old-office":`不支持旧版 .doc/.ppt 文件,请另存为 .docx/.pptx 后再上传。`,err_encrypted:`这个 PDF 有密码保护,请先去掉密码再上传。`,err_unreadable:`这个文件读不出来,可能已经损坏,可以重新导出一份再试。`,"err_no-text":`这个文件里没有读到文字。`,"err_scan-needs-vision":`这是扫描版,没有能直接读取的文字。要识别里面的字,请在开窍设置里选一个带 🖼(能看图)的模型,比如 DeepSeek-V4.1-Flash,再重新上传。`,"err_pictures-need-vision":`这个文件里的内容都是图片。要识别图里的字,请在开窍设置里选一个带 🖼(能看图)的模型,比如 DeepSeek-V4.1-Flash,再重新上传。`,"err_llm-no-vision":`当前模型看不了图片。请在开窍设置里换一个带 🖼 的模型。`,"err_image-unusable":`这张图片没能交给模型。`,err_empty:`这个文件是空的。`,"err_too-large":`文件超过 60 MB,太大了,可以拆成几份再上传。`,"err_image-too-large":`图片要小于 10 MB。`,"err_page-too-large":`这个网页太大了,导入不了。`,"err_page-no-text":`这个网页上没有读到正文。`,"err_tts-address":`语音服务地址不对:要填完整的 https 网址(只有本机地址可以用 http),不能带账号密码。`,"err_tts-app-id":`火山引擎语音需要填写 App ID。`,"err_tts-azure":`Azure 的区域或音色名称不对,请照 Azure 门户里的写法填写。`,"err_tts-config":`语音服务的设置不完整,请在设置里检查。`,"err_tts-network":`连不上语音服务,请检查网络和服务地址。`,"err_tts-stalled":`语音服务一直没有回应,请检查服务是否在运行、地址是否正确。`,"err_tts-timeout":`语音服务响应超时,请稍后再试。`,"err_tts-too-large":`语音服务返回的音频太大了。`,"err_tts-auth":`语音服务拒绝了密钥,请检查密钥是否正确。`,"err_tts-no-key":`还没有保存这个语音服务的密钥,请先在设置里填写。`,"err_tts-rate-limit":`语音服务请求太频繁,请稍后再试。`,"err_tts-server":`语音服务出错了,请稍后再试。`,"err_tts-request":`语音服务拒绝了这次请求,请检查音色等设置。`,"err_tts-empty":`没有要朗读的文字。`,"err_tts-response":`语音服务没有返回可用的音频,请稍后再试,或换一个音色。`,"err_tts-failed":`语音合成失败了,请稍后再试。`,"err_no-materials":`先选至少一份资料。`,"err_materials-known":`这些资料已经是这门课的了。`,"err_materials-full":`一门课最多关联 12 份资料,这门课已经满了。`,err_speech:`朗读没有成功,可以换一个系统音色,或者改用云端语音。`,"err_speech-stalled":`系统语音卡住了,没有出声。`,err_playback:`音频没能播放,请再试一次。`,exportFailed:`导出没有成功,请再试一次。`},Rp={appName:`Aha`,appTagline:`your AI tutor`,navHome:`Home`,navCourses:`My courses`,navMaterials:`Library`,navStudio:`Study tools`,navAssist:`Ask anything`,navShorts:`Explainer shorts`,navPlan:`Study plan`,navProfile:`My profile`,navSettings:`Settings`,navAbout:`About the author`,navFold:`Collapse`,navUnfold:`Expand`,heroTitle:`What do you want to finally understand today?`,heroHint:`Tell me what you want to learn, or drop in a textbook. I will get to know you, build a course around you, and teach it step by step on the whiteboard.`,heroPlaceholder:`e.g. Get eigenvalues in three weeks | Turn these lecture notes into a course | How does quantum tunneling actually work?`,modeCourse:`Build a course`,modeExplain:`Explain a concept`,modeSolve:`Solve with me`,modeVisualize:`Show me visually`,modeDigest:`Digest a long read`,modeShort:`Two-minute short`,attach:`Add material`,attached:`{count} material(s) attached`,start:`Start`,quickStart:`Skip questions, build now`,continueLearning:`Continue learning`,todayPlan:`Today`,noPlanToday:`Nothing planned today. Start a course or take a break.`,recentWork:`Recent`,sampleCourses:`Sample courses`,sampleHint:`Try the whiteboard classroom without spending tokens.`,importSample:`Add to my courses`,coursesTitle:`My courses`,filterAll:`All`,filterActive:`In progress`,filterDone:`Completed`,filterArchived:`Archived`,searchCourses:`Search courses`,noCourses:`No courses yet. Go to Home and tell me what you want to learn.`,importPack:`Import course pack`,lessonsCount:`{done}/{total} lessons`,minutesLeft:`about {minutes} min left`,statusIntake:`Questions pending`,statusBlueprint:`Blueprint to confirm`,statusReady:`Ready`,nextUp:`Next: {title}`,craftQuestionsTitle:`Let me get to know you`,craftQuestionsHint:`A few answers let me shape the course around you. Skip anything you are unsure about.`,craftOther:`Other (write your own)`,craftPace:`Pace`,paceIntensive:`Sprint`,paceIntensiveHint:`~6 weeks, essentials first`,paceBalanced:`Steady`,paceBalancedHint:`~3 months, foundations + practice + project`,paceRelaxed:`No deadline`,paceRelaxedHint:`Take your time, go deeper`,weeklyMinutes:`Time per week`,minutesUnit:`{minutes} min`,deadline:`Deadline (optional)`,makeBlueprint:`Design my course`,thinkingQuestions:`Thinking about what to ask you…`,designingBlueprint:`Designing your course blueprint…`,blueprintTitle:`Course blueprint`,blueprintHint:`Here is the course I designed for you. Edit titles, remove or reorder anything, or tell me what to change.`,reviseLabel:`Change it in one sentence`,revisePlaceholder:`e.g. More hands-on coding; make unit 2 lighter; drop lesson 3`,revise:`Revise`,revising:`Revising…`,addLesson:`Add lesson`,addLecture:`Add chapter`,addUnit:`Add unit`,moveUp:`Move up`,moveDown:`Move down`,remove:`Remove`,projects:`Projects`,confirmCourse:`Confirm and build the course`,confirming:`Preparing practice and projects… {done}/{total}`,courseReady:`Your course is ready`,unitN:`Unit {n}`,lectureN:`Chapter {n}`,estMinutes:`{minutes} min`,saveEdits:`Save changes`,saved:`Saved`,tabOutline:`Outline`,tabPractice:`Practice & quizzes`,tabSheets:`Cheat sheets`,tabCards:`Flashcards`,tabProjects:`Projects`,tabProgress:`Progress`,learn:`Learn`,practice:`Practice`,review:`Review`,remedial:`Revisit`,exportPack:`Export course pack`,exportWithProgress:`Include my progress`,rename:`Rename`,archive:`Archive`,unarchive:`Unarchive`,deleteCourse:`Delete course`,deleteConfirm:`This cannot be undone. Delete "{title}"?`,cancel:`Cancel`,confirm:`Confirm`,close:`Close`,back:`Back`,retry:`Retry`,generate:`Generate`,regenerate:`Regenerate`,generating:`Generating…`,open:`Open`,unitQuiz:`Unit quiz`,unitSheet:`Unit cheat sheet`,mastery:`Mastery`,conceptMastery:`Concept mastery`,preparingLesson:`Your tutor is preparing the lesson…`,bufferingLesson:`Writing the next part…`,play:`Play`,pause:`Pause`,prevStep:`Previous step`,nextStep:`Next step`,speed:`Speed`,voiceOn:`Sound on`,voiceOff:`Muted`,voiceDownCloud:`The cloud voice is not working: {reason} This lesson goes on without sound.`,voiceDownSystem:`The system voice is not working: {reason} This lesson goes on without sound.`,openSettings:`Settings`,captions:`Captions`,raiseHand:`Raise hand`,askPlaceholder:`What was unclear? Just ask`,ask:`Ask`,answering:`Thinking about your question…`,reexplain:`Explain differently`,styleAnalogy:`With an analogy`,styleVisual:`With a drawing`,styleExample:`With an example`,styleSimpler:`More simply`,styleDeeper:`In more depth`,stepOf:`Step {current}/{total}`,checkTitle:`Quick check`,confidence:`How sure are you?`,pickSeveral:`Select all that apply.`,confSure:`Sure`,confUnsure:`Not quite`,confGuess:`Guessing`,submit:`Submit`,correct:`Correct`,incorrect:`Not quite`,partial:`Partly right`,continue:`Continue`,skip:`Skip`,hint:`Hint`,yourAnswer:`Your answer`,grading:`Grading…`,lessonDone:`Lesson complete`,selfRate:`How well do you feel you got it?`,rate1:`Lost`,rate3:`Okay`,rate5:`Crystal clear`,nextLesson:`Next lesson`,doPractice:`Practice`,backToCourse:`Back to course`,remedialAdded:`I added a revisit lesson for you: {title}`,challengeNote:`You have this down; the next lessons will go deeper.`,replay:`Replay lesson`,regenerateLesson:`Re-prepare lesson`,exportBoard:`Export board`,practiceTitle:`Practice`,check:`Check`,checked:`Checked`,score:`Score {score}`,practiceDone:`Set complete: {correct}/{total} correct`,showExplanation:`Explanation`,makingPractice:`Writing practice…`,cardsTitle:`Flashcards`,cardsDue:`{count} due`,flip:`Click to flip`,again:`Again`,hard:`Hard`,good:`Good`,easy:`Easy`,cardsDone:`Review round complete!`,makingCards:`Making flashcards…`,sheetTitle:`Cheat sheet`,columns:`Columns`,fontSize:`Font size`,highlight:`Highlight key items`,print:`Print`,hideSection:`Hide`,showSection:`Show`,makingSheet:`Compiling the cheat sheet…`,projectBrief:`Brief`,milestones:`Milestones`,rubric:`Rubric`,openWorkspace:`Open project workspace`,openingWorkspace:`Preparing the project folder…`,workspaceReady:`Project folder: {path}`,workspaceSession:`Opened a project session in DSH`,workspaceManual:`Add this folder as a workspace in DSH and a coding agent can help you build it.`,copyPath:`Copy path`,submitProject:`Submit work`,submitNotes:`Notes (what you built, what was hard)`,includeFiles:`Include the files in the project folder`,reviewing:`Reviewing your work…`,reviewTotal:`Total {total}/{max}`,strengths:`What went well`,nextSteps:`What to improve`,submissions:`Submissions`,materialsTitle:`Library`,materialsHint:`Upload textbooks, notes, papers or web pages to build courses, cheat sheets and flashcards. Lessons cite their pages.`,uploadFiles:`Upload files`,dropHere:`Drop files here (PDF, Word, PowerPoint, Markdown, text, images)`,addUrl:`Add web page`,urlPlaceholder:`https://…`,reading:`Reading…`,pages:`{count} pages`,slides:`{count} slides`,makeCourse:`Build a course`,makeSheet:`Cheat sheet`,makeCards:`Flashcards`,makeNotes:`Notes`,makeQuiz:`Quiz`,digest:`Digest`,digestTitle:`Digest`,overview:`Overview`,structure:`Structure`,keyIdeas:`Key ideas`,arguments:`Claims and evidence`,glossary:`Glossary`,discussion:`Questions worth asking`,imageNeedsVision:`Images need a vision-capable model.`,readingPictures:`Reading the text in pictures {done}/{total}: {name}`,summarizingMaterial:`Summing up {name}`,readScanPages:`{count} scanned pages read`,readPictures:`Text read from {count} pictures`,readPhoto:`Text in the picture read`,photoNoText:`No text found in the picture`,readPartly:`Some parts were not read`,listJoin:`, `,unreadPages:`{count} pages have no text layer (scans or full-page pictures), and the current model cannot see images, so they were not read. Pick a model marked 🖼 in Aha settings and upload the file again.`,unreadPictures:`The text in {count} pictures was not read: the current model cannot see images. Pick a model marked 🖼 in Aha settings and upload the file again.`,failedPages:`Page {list} could not be read`,failedSlides:`Slide {list} could not be read`,failedPictures:`Picture {list} could not be read`,failedPhoto:`The text in this picture could not be read`,failedWhy:`{what}: {reason}`,failedRetry:`{what}. Uploading it again may help.`,leftPages:`{count} more pages were not read: at most 200 pages of a file are read. Split the file and upload the parts.`,leftPictures:`{count} more pictures were not read: at most 200 pictures of a file are read.`,noMaterials:`Your library is empty.`,studioTitle:`Study tools`,studioHint:`Turn library materials into study aids in one click.`,pickMaterials:`Pick materials`,sheets:`Cheat sheets`,notes:`Notes`,decks:`Flashcard decks`,quizzes:`Quizzes`,focusPlaceholder:`Focus (optional), e.g. midterm scope chapters 3–6`,assistTitle:`Ask anything`,assistHint:`No course needed. Ask, and your tutor explains it on the whiteboard.`,assistPlaceholder:`What do you want to know? Paste a problem, a concept, or attach material`,followUp:`Follow up`,history:`History`,newThread:`New question`,shortsTitle:`Explainer shorts`,shortsHint:`Give a topic or a link and get a shareable two-minute whiteboard explainer.`,topicPlaceholder:`e.g. Why is the sky blue?`,makeShort:`Make short`,exportVideo:`Export video`,exporting:`Recording video… {percent}%`,exportNeedsCloud:`System voices cannot be recorded, so the video will have captions but no sound. Set up a cloud voice in Settings to export with narration.`,exportUnsupported:`Video export is not supported here.`,planTitle:`Study plan`,planHint:`Built from all your active courses, your weekly time and deadlines, with room for reviews.`,studyDays:`Study days`,weekdays:`Sun,Mon,Tue,Wed,Thu,Fri,Sat`,exams:`Exams and deadlines`,addExam:`Add`,examTitle:`Title`,examDay:`Date`,deadlineRisk:`At this pace "{course}" ends on {finish}, after its deadline {deadline}. Try about {minutes} minutes a week.`,startReview:`Start review`,reviewDue:`{count} concept(s) due for review`,nothingToReview:`Nothing to review right now.`,savePlan:`Save`,lessonItem:`Lesson`,reviewItem:`Review`,examItem:`Exam`,today:`Today`,profileTitle:`My profile`,profileHint:`Your tutor remembers this to fit every course to you. Edit or clear it anytime.`,background:`Background`,goals:`Goals`,strengthsLabel:`Strengths`,weaknesses:`Weak spots`,learningStyle:`How I like things explained`,memoryNotes:`Tutor notes`,clearProfile:`Clear profile`,clearProfileConfirm:`Your tutor will forget your background and preferences. Continue?`,onePerLine:`One per line`,settingsTitle:`Settings`,modelsTitle:`Models`,teachModel:`Course design & teaching`,quickModel:`Grading & questions`,followDefault:`Follow the DSH default model`,modelsHint:`Lesson quality depends mostly on the teaching model; grading and in-class questions can use a faster one. Models marked 🖼 can see images: they read the text in scans, photos and pictures.`,voiceTitle:`Narration`,engine:`Voice source`,engineBrowser:`System voice (free)`,engineCloud:`Cloud voice`,engineOff:`Silent`,browserVoice:`System voice`,autoVoice:`Automatic`,noVoiceForLanguage:`No system voice found for this language. Install one in your OS settings or use a cloud voice.`,cloudProvider:`Cloud service`,providerOpenai:`OpenAI-compatible API`,providerVolcengine:`Volcengine (Doubao)`,providerMinimax:`MiniMax`,providerAzure:`Azure Speech`,field_baseUrl:`API address`,field_model:`Model`,field_voice:`Voice`,field_appId:`App ID`,field_cluster:`Cluster`,field_groupId:`Group ID`,field_region:`Region`,field_apiKey:`Key`,keySaved:`Key saved`,keyMissing:`No key saved`,saveKey:`Save key`,clearKey:`Remove key`,testVoice:`Test`,testSentence:`Hi, I am your tutor. Let us make the hard things make sense.`,voiceRate:`Default speed`,boardTheme:`Board look`,themeAuto:`Follow system`,themeLight:`Whiteboard`,themeDark:`Chalkboard`,versionTitle:`Plugin version`,versionCurrent:`Current`,versionLatest:`Latest`,versionCheck:`Check for updates`,versionChecking:`Checking…`,versionFailed:`Could not check the latest version.`,versionUpToDate:`You are on the latest version.`,versionAvailable:`Version v{version} is available.`,versionLinked:`Installed from a local checkout; pull and rebuild the plugin repository to update.`,versionManual:`Could not find the profile that owns this plugin. Install the exact version from the DSH Plugins page: dsh-aha-tutor@{version}.`,versionUpdate:`Update plugin`,versionUpdating:`Updating…`,versionUpdateFailed:`The update failed. Try again later, or install the exact version from the DSH Plugins page.`,versionPending:`v{version} was published recently; DSH’s pnpm installs it once its release cooldown passes. Try again later.`,versionPendingUntil:`v{version} was published recently; DSH’s pnpm installs it once its release cooldown passes, after {time}.`,versionUpdated:`Updated to v{version}. Quit and reopen the DSH desktop app for it to take effect (refreshing the page is not enough).`,privacyNote:`Courses, progress and materials are stored only in DSH’s data folder on this computer.`,aboutTitle:`About the author`,aboutRole:`Author of Aha Tutor (开窍)`,aboutIntro:`Aha Tutor is free and open source, and tips are entirely optional. If it helped something finally click for you, a tip keeps Qiao growing.`,aboutRepo:`GitHub repository`,aboutIssues:`Report a problem`,aboutSupport:`Support the author`,aboutWechat:`WeChat`,aboutAlipay:`Alipay`,aboutScan:`Scan a code with your phone`,errorGeneric:`Something went wrong: {message}`,crashPage:`This page ran into a problem and could not be shown.`,crashPageHint:`Try again, or go back to the home page.`,crashPart:`This part ran into a problem and could not be shown.`,backHome:`Back to home`,loading:`Loading…`,empty:`Nothing here yet.`,copied:`Copied`,minutes:`min`,untitled:`Untitled`,delete:`Delete`,edit:`Edit`,save:`Save`,all:`All`,mode:`Mode`,boardSession:`Whiteboard`,toolBoardTitle:`Explaining on the whiteboard`,openBoard:`Open whiteboard`,panelLabel:`Aha · AI tutor`,copyCode:`Copy`,footnotes:`Footnotes`,"err_llm-auth":`The model is not signed in or its key is invalid. Check the model provider in DSH settings.`,"err_llm-quota":`The model quota is used up or requests are too frequent. Try again later.`,"err_llm-context":`The material is too long for this model. Pick fewer materials or a model with a larger context.`,"err_llm-unavailable":`The selected model is not available. Pick another one in Aha settings.`,"err_llm-timeout":`The model took too long. Try again.`,"err_bad-output":`The model did not return a usable result this time. Try again or pick a stronger model in settings.`,boardView:`Board view`,viewCanvas:`Canvas`,viewPages:`Pages`,boardViewHint:`Canvas: the whole lesson’s pages, top to bottom on one canvas you can drag and zoom, following the teacher’s writing during the lesson. Pages: one page at a time, turned with the page numbers at the top right.`,canvasTools:`Canvas zoom`,canvasHelp:`Drag or scroll to move, hold Ctrl/⌘ and scroll or pinch to zoom, double-click a page to fit it`,canvasZoomIn:`Zoom in`,canvasZoomOut:`Zoom out`,canvasZoomReset:`Back to 100% (full width)`,canvasFit:`Show everything: zoom out to see every page`,canvasFitShort:`All`,canvasFollow:`Back to the teacher`,canvasPage:`Page {n}`,voiceAsk:`Ask by voice`,voiceAskWith:`Ask by voice (microphone: {name})`,voiceStop:`Stop recording`,talkKeyHint:`Shortcut: hold V while you speak and let go to finish, or tap V, speak, and tap it again.`,raiseHandKey:`Pause the lesson and ask in the question box. You can also hold V and say it.`,voiceSetup:`Voice questions need Voice input enabled in DSH`,voiceWorking:`Recognizing…`,voice_off:`Voice questions use DSH’s experimental Voice input: enable Voice input in DSH’s Plugins page, choose Download and prepare in its details, then click here again.`,voice_unprepared:`The speech recognizer is not set up yet: choose Download and prepare in Voice input’s details on DSH’s Plugins page (about 240 MB), then click here again.`,voice_preparing:`The speech recognizer is being set up; click here again when it is ready. Voice input’s details on DSH’s Plugins page show the progress.`,voice_failed:`Setting up the speech recognizer failed: retry it in Voice input’s details on DSH’s Plugins page.`,"err_speech-off":`Voice input is not enabled in DSH: enable it in DSH’s Plugins page and set up its model.`,"err_speech-unprepared":`The speech recognizer is not ready: choose Download and prepare in Voice input’s details on DSH’s Plugins page.`,"err_speech-audio":`The recording could not be read. Record it again.`,"err_speech-too-long":`The recording is too long; it can be at most 2 minutes.`,"err_speech-failed":`Speech recognition failed. Try again.`,"err_speech-empty":`No speech was heard. Move closer to the microphone and try again.`,"err_mic-denied":`Microphone access was refused: allow DSH to use the microphone in your browser or system settings.`,"err_mic-missing":`No microphone was found.`,"err_mic-chosen-missing":`The microphone chosen in DSH’s Voice input is not available: plug it in, or choose another in Voice input’s details on DSH’s Plugins page.`,micChosenMissing:`The microphone chosen in DSH’s Voice input, “{name}”, is not available: plug it in, or choose another in Voice input’s details on DSH’s Plugins page.`,"err_mic-busy":`The microphone is in use by another program.`,"err_mic-unsupported":`Recording is not possible here.`,prepThinking:`Planning`,prepWriting:`Writing the board`,prepStarting:`Reaching the model…`,prepThinkingDetail:`Thinking the lesson through ({chars} characters so far)`,prepStep:`Writing step {n}`,prepCounts:`{steps} steps ready · {chars} characters`,prepSeconds:`{seconds}s so far`,dayLabel:`{weekday}, {month}/{day}`,exportPdf:`PDF (one board page per page)`,exportPng:`PNG images (one per page)`,exportMarkdown:`Markdown text`,exportingBoard:`Exporting the board… {done}/{total}`,animationStill:`Animation (plays in the lesson)`,monthLabel:`{month}/{year}`,prevMonth:`Previous month`,nextMonth:`Next month`,markDone:`Mark as done`,unmarkDone:`Mark as not done`,checkedAuto:`Done in the course`,dayEmpty:`Nothing planned for this day.`,webResearch:`Search the web first`,webResearchHint:`Before designing the course, look the subject up with DSH web search and use what it finds`,researching:`Searching the web…`,researchFound:`Drew on {count} web sources`,researchSkipped:`No web search: {reason}`,"researchSkipped_no-credential":`DSH has no DeepSeek key, which its web search needs`,researchSkipped_unavailable:`web search is not available in this DSH`,researchSkipped_failed:`the search failed`,researchSkipped_empty:`nothing useful came up`,courseSources:`Sources`,buildResearch:`Using {count} web sources`,"err_llm-empty":`The model returned nothing this time. Try again, or pick another model in Aha settings if it keeps happening.`,"err_llm-failed":`The model call failed. Try again in a moment.`,nextStepTitle:`Next step`,nextStepReview:`{count} concepts are due for review`,nextStepWeak:`“{concept}” is still weak; practise it first`,nextStepLesson:`Continue with “{title}”`,nextStepDone:`You have finished the course; check yourself with a unit quiz`,practiceThis:`Practise this lesson`,streakCount:`{count} in a row`,keysHint:`Keyboard: 1–4 to choose · Enter to submit or continue · H for a hint`,starsLabel:`{count} stars`,accuracy:`accuracy`,bestStreak:`best streak`,masteryChange:`Mastery after this round`,stageNone:`Not started`,stageWeak:`Weak`,stageLearning:`Learning`,stageProficient:`Proficient`,stageMastered:`Mastered`,nextRelearn:`A few points have not landed yet; going through the lesson again will help.`,nextReview:`You mostly have it, but it is not solid yet; a review round will make it stick.`,nextQuiz:`This is solid; you are ready for the unit quiz.`,nextLessonStep:`You are ready to move on.`,nextCourse:`This part is done.`,relearnLesson:`Back to the lesson`,reviewCourse:`Review this course`,editOutline:`Edit outline`,saveAndBack:`Save and go back`,extendCourse:`Ask for one more unit`,extendInstruction:`Add one more unit at the end that builds on what the course covers and takes the next step at the same gradient; leave the existing units unchanged.`,proposalTitle:`Proposed changes`,proposalNoChange:`This revision changes no lessons.`,applyProposal:`Apply changes`,discardProposal:`Discard`,proposalApplied:`Changes applied`,diffAdded:`Added`,diffRemoved:`Removed`,diffRenamed:`Renamed`,diffChanged:`Changed`,diffUnit:`Unit “{title}”`,reworkLesson:`Rework this lesson`,splitLesson:`Split in two`,deepenLesson:`Go deeper`,splitDone:`Split in two; remember to save`,deepenDone:`Made deeper; remember to save`,confirmRemoveUnit:`Remove the unit “{title}” and all its lessons?`,confirmRemoveLecture:`Remove “{title}” and all its lessons?`,confirmRemoveStarted:`“{title}” has been started; its board and progress will no longer show. Remove it?`,craftSize:`Course size`,sizeAuto:`Let the teacher decide`,sizeAutoHint:`Sized to your goal; a small question may need only a lesson or two`,sizeShort:`Short`,sizeShortHint:`3–8 lessons on what matters most`,sizeStandard:`Standard`,sizeStandardHint:`10–20 lessons: foundations, practice and an applied project`,sizeFull:`Full`,sizeFullHint:`25–45 lessons, thorough, with room to go deeper`,buildAnswers:`Going through your answers`,buildMaterials:`Reading your materials`,buildUnits:`Planning the units`,buildLessons:`Writing the lessons`,buildLessonsSoFar:`Writing the lessons: {count} so far`,workPlaceholder:`Write one step per line and put math inside $…$, e.g. $x^2+6x+9=(x+3)^2$`,workPreview:`Preview`,wrongStep:`Where it went wrong`,fixedStep:`It should read`,correction:`Correction`,correctionOf:`Correction: {tag}`,correcting:`Correcting it on the board…`,seeCorrection:`See the correction`,handout:`Handout`,handoutHint:`A one-page printable handout of this lesson`,handoutOfLesson:`Handout of this lesson`,handoutMaking:`Writing the handout…`,handoutPoints:`Key points`,handoutExample:`Worked example`,handoutMistakes:`Common mistakes`,handoutGlossary:`Glossary`,handoutQuestions:`Check yourself`,handoutAnswer:`Answer`,backToLesson:`Back to the lesson`,addMaterials:`Add materials`,addMaterialsTitle:`Add materials to this course`,addMaterialsHint:`Choose some materials (or upload them now). The teacher reads what they cover and proposes changes to the outline; nothing changes until you apply them, lessons you have started keep their progress, and later lessons cite the materials.`,addMaterialsPlaceholder:`How should the teacher use them? (optional) For example: add the worked examples from chapter 5`,addMaterialsSend:`Ask the teacher how to add them`,changeMaterials:`Change materials`,proposalMaterials:`From the added materials: {titles}`,librarySearch:`Find: type to filter by title or topic, press Enter to search the text`,librarySearchText:`Search text`,libraryFound:`{count} passages in the text`,libraryNotFound:`Nothing in the text matches “{query}”`,libraryNoTitleMatch:`No title or topic matches. Press Enter to search the text.`,pageN:`p. {page}`,slideN:`slide {slide}`,tourLabel:`Classroom tour`,tourReplay:`Classroom tour`,tourSkip:`Skip`,tourBack:`Back`,tourNext:`Next`,tourStart:`Start the lesson`,tourBoardTitle:`The teacher writes here`,tourBoard:`The board fills up as the teacher talks. Drag or scroll to move around it, hold Ctrl (⌘ on a Mac) and scroll to zoom, and use All in the top right to see the whole lesson.`,tourControlsTitle:`Play and pace`,tourControls:`Play, pause, the previous and next step and the speed are here; Space pauses too. Captions and sound can be switched at any time.`,tourRaiseTitle:`Raise your hand`,tourRaise:`Choose Raise hand, or type in the question box. You can also say it: click the microphone, or hold V while you speak and let go to put the question in the box. The teacher answers, then carries on.`,tourReexplainTitle:`Lost at this step?`,tourReexplain:`Choose Explain differently for an analogy, a drawing, an example, a simpler or a deeper take.`,tourChallengeTitle:`Spotted a mistake?`,tourChallenge:`Choose Is this step wrong? The teacher checks it carefully first; a real mistake is corrected there and fixed in the lesson.`,tourPanelTitle:`Goals and transcript`,tourPanel:`See how far the lesson's goals have come; everything said is in the transcript, and choosing a line goes back to it.`,outlineView:`How the outline is shown`,viewList:`List`,viewMap:`Map`,mapTools:`Map tools`,mapFollow:`Back to the newest`,mapPick:`Edit this lesson in the list`,depthTitle:`How this lesson treats its idea`,depthNone:`Any`,depth_intuition:`Intuition`,depth_definition:`Definition`,depth_derivation:`Derivation`,depth_application:`Application`,depth_extension:`Extension`,profileName:`What should the tutor call you?`,profileNameHint:`said once when a lesson opens; optional`,profileNamePlaceholder:`For example: Sam`,challenge:`Is this step wrong?`,challengeLabel:`Is this step wrong?`,challengeTitle:`What looks wrong in this step? (optional)`,challengeTitleStep:`What looks wrong in step {n}? (optional) “{text}”`,challengePlaceholder:`For example: shouldn’t 5 cm be 0.05 m?`,challengeHint:`The teacher works it through again first, which takes a few seconds to half a minute.`,challengeSend:`Ask the teacher to check`,challengeLine:`Wrong?`,challengeStep:`Is step {n} wrong?`,checkingStep:`Checking this step carefully…`,challenge_wrong:`It was wrong, now corrected`,challenge_right:`Checked: it is right`,challenge_unclear:`Depends on the convention`,fixed:`Corrected`,fixedWas:`It said: {was}`,itemChallenge:`Something wrong with this question?`,itemChallengeTitle:`What looks wrong? (optional)`,itemChallengePlaceholder:`For example: I think B is right too, or: is the unit in the answer wrong?`,itemChallengeHint:`The teacher works it through first, which takes a few seconds to half a minute. You can go on meanwhile.`,itemChecking:`Checking this question carefully…`,itemCheckTitle:`Teacher’s check`,itemCheck_wrong:`It was wrong, now corrected`,itemCheck_unclear:`It was unclear, now spelled out`,itemCheck_misgraded:`It was graded wrongly, now regraded`,itemCheck_right:`Checked: it is right`,regraded:` (regraded)`,itemCheckDone:`Question {n} checked: {verdict}.`,itemCheckRegraded:` Your answer was graded again.`,itemCheckEarlier:` Earlier answers to this question graded again too: {count}.`,itemCheckFailedNotice:`Question {n} could not be checked: {message}`,fixedWasItem:`Before the fix:`,fixedPart_prompt:`Question: {text}`,fixedPart_option:`Option {id}: {text}`,fixedPart_answer:`Answer: {text}`,fixedPart_unit:`Unit: {text}`,fixedPart_tolerance:`Tolerance: {text}`,fixedPart_explanation:`Explanation: {text}`,fixedPart_hints:`Hints: {text}`,fixedPart_rubric:`Rubric: {text}`,fixedPart_figure:`The figure was redrawn`,lessonGoals:`Lesson goals`,transcript:`Transcript`,showPanel:`Transcript`,hidePanel:`Hide the side panel`,panelTitle:`Lesson side panel`,boardFont:`Board font`,fontHand:`Handwriting`,fontStandard:`Standard`,textSize:`Text size`,textStandard:`Standard`,textLarge:`Large`,textLarger:`Extra large`,textSizeHint:`Enlarges all of Aha Tutor’s text, right away. The board and the mind map have their own zoom buttons; DSH’s Settings → General → Font size changes the text here too.`,digestMissing:`{count} part(s) could not be read ({parts}); the digest below leaves them out.`,redigest:`Digest again`,revisingSoFar:`Revising… {count} lessons so far`,"err_bad-url":`This address cannot be imported: only public http or https sites are supported, not this computer, the local network or addresses with credentials.`,err_network:`The page could not be loaded or took too long. Check the address and try again.`,err_http:`The page returned an error and could not be imported.`,blueprintSoFar:`Designing your course blueprint… {count} lessons so far`,reexplainedAs:`Re-explained: {style}`,digestReading:`Reading the whole document: {done} of {total} parts read`,digestWriting:`Combining the notes into one digest`,keepsRunning:`You can leave this page; it keeps going in the background.`,err_cancelled:`Cancelled.`,courseCreatedInChat:`Created the course "{title}". Continue it in Aha.`,err_failed:`Something went wrong. Try again in a moment.`,err_invalid:`This request could not be handled. Reload the page and try again; if it keeps happening, quit and reopen DSH.`,"err_not-found":`This item could not be found. It may have been deleted.`,err_forbidden:`You are not allowed to do this.`,"err_unknown-endpoint":`The plugin was just updated. Quit and reopen DSH, then try again.`,err_aborted:`The upload was interrupted. Try again.`,err_connection:`Could not reach DSH. Make sure it is still open, then try again.`,err_missing:`The task was lost, perhaps because DSH restarted. Try again.`,"err_llm-missing":`No model is available yet. Set up a model provider in DSH settings first.`,"err_no-board":`The board is not written yet. Try again once its first step is up.`,"err_empty-question":`Type your question first.`,"err_empty-goal":`Tell me what you want to learn, or add some material.`,"err_empty-change":`Describe the change you want first.`,"err_no-blueprint":`There is no course blueprint yet. Generate one first.`,"err_no-proposal":`There is no proposed change. It may have been applied or discarded already.`,"err_bad-pack":`This file is not a course pack that can be imported.`,"err_pack-too-large":`This course pack is too large to import.`,"err_pack-too-new":`This course pack comes from a newer version of Aha. Update the plugin, then import it.`,"err_nothing-to-review":`Nothing to review yet: write a note or work in the project folder first.`,"err_cannot-tick":`Only study items on today or an earlier day can be ticked.`,"err_exam-incomplete":`An exam needs a title and a date.`,"err_no-material":`Pick at least one material first.`,"err_material-no-text":`The selected material has no readable text. Images and scanned PDFs cannot be read as text.`,"err_empty-topic":`Give a topic or a web address first.`,"err_no-credentials":`DSH credentials are not available in this profile, so the key cannot be saved.`,"err_bad-key":`The key looks wrong: use 8–1024 letters, digits or symbols with no spaces.`,err_unsupported:`This file type is not supported. Upload a PDF, Word or PowerPoint file, an image, or a text file such as .md, .txt or .csv.`,"err_old-office":`Old .doc/.ppt files are not supported. Save them as .docx/.pptx and upload again.`,err_encrypted:`This PDF is password protected. Remove the password and upload it again.`,err_unreadable:`This file could not be read. It may be damaged; export it again and retry.`,"err_no-text":`No text was found in this file.`,"err_scan-needs-vision":`This is a scan, with no text to read directly. To read the text in it, pick a model marked 🖼 (it can see images) in Aha settings, such as DeepSeek-V4.1-Flash, and upload it again.`,"err_pictures-need-vision":`Everything in this file is pictures. To read the text in them, pick a model marked 🖼 (it can see images) in Aha settings, such as DeepSeek-V4.1-Flash, and upload it again.`,"err_llm-no-vision":`The current model cannot see images. Pick a model marked 🖼 in Aha settings.`,"err_image-unusable":`This picture could not be given to the model.`,err_empty:`This file is empty.`,"err_too-large":`The file is larger than 60 MB. Split it into smaller parts and upload them.`,"err_image-too-large":`Images must be smaller than 10 MB.`,"err_page-too-large":`This page is too large to import.`,"err_page-no-text":`No readable text was found on this page.`,"err_tts-address":`The speech service address is wrong: use a full https address (http only for this computer) without a user name or password.`,"err_tts-app-id":`Volcengine speech needs an App ID.`,"err_tts-azure":`The Azure region or voice name is not valid. Enter it as the Azure portal shows it.`,"err_tts-config":`The speech service settings are incomplete. Check them in settings.`,"err_tts-network":`Could not reach the speech service. Check the network and the service address.`,"err_tts-stalled":`The speech service is not responding. Check that it is running and that its address is right.`,"err_tts-timeout":`The speech service took too long. Try again later.`,"err_tts-too-large":`The speech service returned too much audio.`,"err_tts-auth":`The speech service rejected the key. Check that it is correct.`,"err_tts-no-key":`No key is saved for this speech service. Add it in settings first.`,"err_tts-rate-limit":`The speech service is limiting requests. Try again later.`,"err_tts-server":`The speech service had an error. Try again later.`,"err_tts-request":`The speech service refused the request. Check the voice and other settings.`,"err_tts-empty":`There is nothing to read aloud.`,"err_tts-response":`The speech service returned no usable audio. Try again later or pick another voice.`,"err_tts-failed":`Speech synthesis failed. Try again later.`,"err_no-materials":`Choose at least one material first.`,"err_materials-known":`These materials are already part of this course.`,"err_materials-full":`A course can use at most 12 materials, and this one has them all.`,err_speech:`Reading aloud did not work. Try another system voice, or switch to a cloud voice.`,"err_speech-stalled":`The system voice got stuck and made no sound.`,err_playback:`The audio could not be played. Try again.`,exportFailed:`The export did not finish. Try again.`},zp=[`slots`,`locale`,`connection`],Bp=`aha-tutor`,Vp=`dsh-aha-tutor/board`,Hp=`ahaTutorBoard`,Up=[`aha_whiteboard`,`aha_quiz`,`aha_course`,`aha_cheatsheet`,`aha_learner`];function Wp({size:e}){return(0,i.jsx)(ut,{name:`logo`,size:e})}function Gp({rpc:e,t,language:n,dsh:r}){return(0,i.jsx)(Ep,{rpc:e,t,language:n(),dsh:r})}function Kp(e){e.effect(()=>e.locale.register(Ip,{zh:Lp,en:Rp}),`aha-tutor: copy`),e.effect(()=>{let e=document.createElement(`style`);return e.dataset.plugin=`dsh-aha-tutor`,e.textContent=kf,document.head.append(e),()=>e.remove()},`aha-tutor: style`);let t=e.locale.bind(Ip),n=e.get(`connection`).rpc,r=()=>String(e.locale.getLocale?.()?.active??`zh`).startsWith(`zh`)?`zh`:`en`,i=Object.freeze({selectPanel:()=>e.get(`layout`)?.selectPanel?.(Bp),async openWorkspace(t,n){let r=e.get(`workspaces`),i=e.get(`uiWorkspace`);if(typeof r?.create!=`function`||typeof i?.startSession!=`function`)return!1;let a=await r.create({path:t});return i.startSession(a.workspaceId,{prompt:n,clearPreviousDraft:!0}),!0},openBoardTab(t){let n=e.get(`sidebarRight`);if(typeof n?.openTab!=`function`)return!1;try{return n.openTab(Hp,{params:t}),!0}catch{return!1}}});e.slots.inject(`main`,()=>e.slots.register({name:`main`,key:Bp,locale:Ip,inject:()=>({rpc:n,language:r,dsh:i})},Gp)),e.slots.inject(`sidebar.panellist`,()=>e.slots.register({name:`sidebar.panellist`,id:Bp,order:20,locale:Ip,label:()=>t(`panelLabel`)},Wp)),e.inject([`sidebarRightTabs`],e=>{e.effect(()=>e.sidebarRightTabs.register({id:Vp,kind:Hp,title:()=>t(`boardSession`),keepMounted:!0}),`aha-tutor: board tab`)}),e.slots.inject(`sidebar.right.pane.tab`,()=>e.slots.register({name:`sidebar.right.pane.tab`,key:Vp,locale:Ip,inject:()=>({rpc:n,language:r(),dsh:i})},kp));for(let t of Up)e.slots.inject(`tool.call.toolview`,()=>e.slots.register({name:`tool.call.toolview`,key:t,locale:Ip,inject:()=>({rpc:n,language:r(),dsh:i})},Np))}return n.apply=Kp,n.inject=zp,t.exports}});
|
|
720
|
+
`).map(e=>e.trim()).filter(Boolean);a.setValue(await e.call(`profile/save`,{name:o.name.trim(),background:o.background,goals:r(o.goals),strengths:r(o.strengths),weaknesses:r(o.weaknesses),preferences:{...a.value.preferences,style:o.style}})),n(t(`saved`))}catch(e){d(e)}}return o?(0,i.jsxs)(`div`,{className:`aha-page`,style:{maxWidth:820},children:[(0,i.jsxs)(`div`,{className:`aha-col`,style:{gap:4},children:[(0,i.jsx)(`h2`,{className:`aha-title`,children:t(`profileTitle`)}),(0,i.jsx)(`p`,{className:`aha-hint`,children:t(`profileHint`)})]}),(0,i.jsxs)(`section`,{className:`aha-card`,children:[(0,i.jsxs)(`label`,{className:`aha-label`,children:[t(`profileName`),` `,(0,i.jsxs)(`span`,{className:`aha-hint`,children:[`(`,t(`profileNameHint`),`)`]}),(0,i.jsx)(`input`,{className:`aha-input`,maxLength:20,value:o.name,placeholder:t(`profileNamePlaceholder`),onChange:e=>s({...o,name:e.currentTarget.value})})]}),(0,i.jsxs)(`label`,{className:`aha-label`,children:[t(`background`),(0,i.jsx)(`textarea`,{className:`aha-textarea`,value:o.background,onChange:e=>s({...o,background:e.currentTarget.value})})]}),sp.map(([e,n])=>(0,i.jsxs)(`label`,{className:`aha-label`,children:[t(n),` `,(0,i.jsxs)(`span`,{className:`aha-hint`,children:[`(`,t(`onePerLine`),`)`]}),(0,i.jsx)(`textarea`,{className:`aha-textarea`,value:o[e],onChange:t=>s({...o,[e]:t.currentTarget.value})})]},e)),(0,i.jsxs)(`label`,{className:`aha-label`,children:[t(`learningStyle`),(0,i.jsx)(`input`,{className:`aha-input`,value:o.style,onChange:e=>s({...o,style:e.currentTarget.value})})]}),(0,i.jsxs)(`div`,{className:`aha-row`,children:[(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,onClick:f,children:t(`save`)}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`danger`,onClick:()=>l(!0),children:t(`clearProfile`)})]}),(0,i.jsx)(Wl,{error:u})]}),a.value.notes?.length?(0,i.jsxs)(`section`,{className:`aha-card`,children:[(0,i.jsx)(`b`,{children:t(`memoryNotes`)}),a.value.notes.map(n=>(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsx)(`span`,{children:n.text}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,"data-size":`sm`,onClick:async()=>a.setValue(await e.call(`profile/remove-note`,{id:n.id})),children:t(`delete`)})]},n.id))]}):null,(0,i.jsx)(`p`,{className:`aha-hint`,children:t(`privacyNote`)}),c?(0,i.jsx)(Hl,{danger:!0,text:t(`clearProfileConfirm`),onCancel:()=>l(!1),onConfirm:async()=>{a.setValue(await e.call(`profile/clear`)),l(!1)}}):null]}):(0,i.jsx)(`div`,{className:`aha-page`,children:(0,i.jsx)(Rl,{label:t(`loading`)})})}function lp({courseId:e,projectId:t}){let{api:n,t:a,dsh:o,toast:s}=v(),c=y(()=>n.call(`project/get`,{courseId:e,projectId:t}),[e,t]),l=b(),[u,d]=(0,r.useState)(``),[f,p]=(0,r.useState)(!0),[m,h]=(0,r.useState)(null),[g,_]=(0,r.useState)(!1),[x,S]=(0,r.useState)(null);if(c.loading&&!c.value)return(0,i.jsx)(`div`,{className:`aha-page`,children:(0,i.jsx)(Rl,{label:a(`loading`)})});if(!c.value)return(0,i.jsx)(`div`,{className:`aha-page`,children:(0,i.jsx)(Wl,{error:c.error})});let{project:C,submissions:w}=c.value,T=m?.path??c.value.workspace;async function E(){_(!0),S(null);try{let r=await n.call(`project/open`,{courseId:e,projectId:t});h(r);let i=await o.openWorkspace(r.path,r.prompt).catch(()=>!1);s(i?a(`workspaceSession`):a(`workspaceReady`,{path:r.path}))}catch(e){S(e)}finally{_(!1)}}async function D(){try{await l.run(`project/submit`,{courseId:e,projectId:t,notes:u,includeWorkspace:f}),d(``),c.reload()}catch{}}return(0,i.jsxs)(`div`,{className:`aha-page`,style:{maxWidth:900},children:[(0,i.jsx)(`h2`,{className:`aha-title`,children:C.title}),(0,i.jsxs)(`section`,{className:`aha-card`,children:[(0,i.jsx)(`b`,{children:a(`projectBrief`)}),(0,i.jsx)(vu,{text:C.brief})]}),C.milestones?.length?(0,i.jsxs)(`section`,{className:`aha-card`,children:[(0,i.jsx)(`b`,{children:a(`milestones`)}),(0,i.jsx)(`ol`,{style:{margin:0,paddingLeft:20},children:C.milestones.map(e=>(0,i.jsxs)(`li`,{children:[(0,i.jsx)(`b`,{children:e.title}),e.detail?(0,i.jsx)(`div`,{className:`aha-hint`,children:e.detail}):null]},e.id))})]}):null,C.rubric?.length?(0,i.jsxs)(`section`,{className:`aha-card`,children:[(0,i.jsx)(`b`,{children:a(`rubric`)}),C.rubric.map(e=>(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsxs)(`span`,{children:[e.criterion,e.detail?(0,i.jsxs)(`span`,{className:`aha-hint`,children:[` · `,e.detail]}):null]}),(0,i.jsx)(`span`,{className:`aha-tag`,children:e.points})]},e.id))]}):null,(0,i.jsxs)(`section`,{className:`aha-card`,children:[(0,i.jsxs)(`div`,{className:`aha-row`,children:[(0,i.jsxs)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,disabled:g,onClick:E,children:[(0,i.jsx)(ut,{name:`folder`,size:15}),a(g?`openingWorkspace`:`openWorkspace`)]}),T?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`code`,{className:`aha-hint`,style:{overflowWrap:`anywhere`},children:T}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,"data-kind":`ghost`,onClick:()=>{tu(T),s(a(`copied`))},children:a(`copyPath`)})]}):null]}),(0,i.jsx)(`p`,{className:`aha-hint`,children:a(`workspaceManual`)}),(0,i.jsx)(Wl,{error:x})]}),(0,i.jsxs)(`section`,{className:`aha-card`,children:[(0,i.jsx)(`b`,{children:a(`submitProject`)}),(0,i.jsx)(`textarea`,{className:`aha-textarea`,value:u,placeholder:a(`submitNotes`),onChange:e=>d(e.currentTarget.value)}),(0,i.jsxs)(`label`,{className:`aha-row`,style:{gap:6},children:[(0,i.jsx)(`input`,{type:`checkbox`,checked:f,onChange:e=>p(e.currentTarget.checked)}),a(`includeFiles`)]}),l.running?(0,i.jsx)(Bl,{progress:l.progress,label:a(`reviewing`),onCancel:l.cancel}):(0,i.jsx)(`div`,{children:(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,disabled:!u.trim()&&!f,onClick:D,children:a(`submitProject`)})}),(0,i.jsx)(Wl,{error:l.error})]}),w.length?(0,i.jsxs)(`section`,{className:`aha-col`,children:[(0,i.jsx)(`h3`,{className:`aha-cardTitle`,children:a(`submissions`)}),[...w].reverse().map((e,t)=>(0,i.jsxs)(`div`,{className:`aha-card`,children:[(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsx)(`b`,{children:a(`reviewTotal`,{total:e.review.total,max:e.review.max})}),(0,i.jsx)(`span`,{className:`aha-hint`,children:new Date(e.at).toLocaleString()})]}),e.review.summary?(0,i.jsx)(vu,{text:e.review.summary,compact:!0}):null,e.review.scores.map(e=>(0,i.jsxs)(`div`,{className:`aha-spread`,style:{alignItems:`flex-start`},children:[(0,i.jsxs)(`span`,{children:[(0,i.jsx)(`b`,{children:e.criterion}),(0,i.jsx)(`div`,{className:`aha-hint`,children:e.comment})]}),(0,i.jsxs)(`span`,{className:`aha-tag`,children:[e.points,`/`,e.max]})]},e.criterionId)),e.review.strengths?.length?(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`b`,{children:a(`strengths`)}),(0,i.jsx)(`ul`,{style:{margin:0},children:e.review.strengths.map((e,t)=>(0,i.jsx)(`li`,{children:e},t))})]}):null,e.review.nextSteps?.length?(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`b`,{children:a(`nextSteps`)}),(0,i.jsx)(`ul`,{style:{margin:0},children:e.review.nextSteps.map((e,t)=>(0,i.jsx)(`li`,{children:e},t))})]}):null]},t))]}):null]})}let up=[[`openai`,`providerOpenai`],[`volcengine`,`providerVolcengine`],[`minimax`,`providerMinimax`],[`azure`,`providerAzure`]],dp=[[`standard`,`textStandard`],[`large`,`textLarge`],[`larger`,`textLarger`]];function fp(){let{api:e,t,settings:n,settingsSaved:a,setVoiceId:o,speech:s,language:c}=v(),l=y(()=>e.call(`models/list`),[]),[d,f]=(0,r.useState)(null),p=e=>d?.area===e?d.failure:null,[m,h]=(0,r.useState)(()=>Ye()),[g,_]=(0,r.useState)(``),[b,x]=(0,r.useState)(!1);(0,r.useEffect)(()=>Xe(h),[]);async function S(e,t){f(null);try{await t()}catch(t){f({area:e,failure:t})}}let C=(0,r.useRef)(Promise.resolve()),w=(t,n)=>{let r=S(t,async()=>{await e.call(`settings/save`,{settings:n}),await a()});return C.current=C.current.then(()=>r),r},T=(e,t)=>e&&t?`${e}::${t}`:``,E=(e,t)=>{let[n=``,r=``]=t?t.split(`::`):[];w(`models`,{[`${e}Provider`]:n,[`${e}Model`]:r})},D=(0,r.useMemo)(()=>(l.value??[]).map(e=>({value:`${e.provider}::${e.model}`,label:`${e.providerName} · ${e.name}${e.images?` 🖼`:``}`})),[l.value]),O=c===`zh`?`zh-CN`:`en`,k=m.filter(e=>e.lang.toLowerCase().startsWith(O.split(`-`)[0])),A=n.ttsProvider??`openai`,ee=(n.fields?.[A]??[]).filter(e=>!e.secret),te=n.tts?.[A]??{};async function j(){f(null),x(!0);try{await C.current,s.configure({engine:n.voiceEngine??`browser`,voiceId:n.voiceId||void 0,language:O,rate:n.voiceRate??1});let e=await s.speak(t(`testSentence`),{rate:n.voiceRate??1}).done;e?.error&&f({area:`test`,failure:new u(e.code??`speech`,e.error)})}finally{x(!1)}}return n.voiceEngine?(0,i.jsxs)(`div`,{className:`aha-page`,style:{maxWidth:820},children:[(0,i.jsx)(`h2`,{className:`aha-title`,children:t(`settingsTitle`)}),(0,i.jsxs)(`section`,{className:`aha-card`,children:[(0,i.jsx)(`b`,{children:t(`textSize`)}),(0,i.jsx)(`div`,{className:`aha-row`,style:{gap:6},children:dp.map(([e,r])=>(0,i.jsx)(`button`,{type:`button`,className:`aha-chip`,"data-active":(n.textSize??`standard`)===e,onClick:()=>w(`text`,{textSize:e}),children:t(r)},e))}),(0,i.jsx)(`p`,{className:`aha-hint`,children:t(`textSizeHint`)}),(0,i.jsx)(Wl,{error:p(`text`),reveal:!0})]}),(0,i.jsxs)(`section`,{className:`aha-card`,children:[(0,i.jsx)(`b`,{children:t(`modelsTitle`)}),(0,i.jsx)(`p`,{className:`aha-hint`,children:t(`modelsHint`)}),[[`teach`,`teachModel`],[`quick`,`quickModel`]].map(([e,r])=>(0,i.jsxs)(`label`,{className:`aha-label`,children:[t(r),(0,i.jsxs)(`select`,{className:`aha-select`,value:T(n[`${e}Provider`],n[`${e}Model`]),onChange:t=>E(e,t.currentTarget.value),children:[(0,i.jsx)(`option`,{value:``,children:t(`followDefault`)}),D.map(e=>(0,i.jsx)(`option`,{value:e.value,children:e.label},e.value))]})]},e)),l.loading?(0,i.jsx)(Rl,{}):null,(0,i.jsx)(Wl,{error:p(`models`),reveal:!0})]}),(0,i.jsxs)(`section`,{className:`aha-card`,children:[(0,i.jsx)(`b`,{children:t(`voiceTitle`)}),(0,i.jsx)(`div`,{className:`aha-row`,style:{gap:6},children:[[`browser`,`engineBrowser`],[`cloud`,`engineCloud`],[`off`,`engineOff`]].map(([e,r])=>(0,i.jsx)(`button`,{type:`button`,className:`aha-chip`,"data-active":n.voiceEngine===e,onClick:()=>w(`engine`,{voiceEngine:e}),children:t(r)},e))}),(0,i.jsxs)(`label`,{className:`aha-label`,children:[t(`voiceRate`),` · `,n.voiceRate??1,`×`,(0,i.jsx)(`input`,{type:`range`,min:`0.5`,max:`2`,step:`0.05`,value:n.voiceRate??1,onChange:e=>w(`engine`,{voiceRate:Number(e.currentTarget.value)})})]}),(0,i.jsx)(Wl,{error:p(`engine`),reveal:!0}),n.voiceEngine===`browser`?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(`label`,{className:`aha-label`,children:[t(`browserVoice`),(0,i.jsxs)(`select`,{className:`aha-select`,value:n.voiceId??``,onChange:e=>o(e.currentTarget.value),children:[(0,i.jsxs)(`option`,{value:``,children:[t(`autoVoice`),Ze(O)?` (${Ze(O).name})`:``]}),(k.length?k:m).map(e=>(0,i.jsxs)(`option`,{value:e.id,children:[e.name,` · `,e.lang,e.local?``:` ☁`]},e.id))]})]}),Je()&&!k.length?(0,i.jsx)(`p`,{className:`aha-hint`,children:t(`noVoiceForLanguage`)}):null]}):null,n.voiceEngine===`cloud`?(0,i.jsxs)(`div`,{className:`aha-col`,children:[(0,i.jsxs)(`label`,{className:`aha-label`,children:[t(`cloudProvider`),(0,i.jsx)(`select`,{className:`aha-select`,value:A,onChange:e=>w(`cloud`,{ttsProvider:e.currentTarget.value}),children:up.map(([e,n])=>(0,i.jsx)(`option`,{value:e,children:t(n)},e))})]}),ee.map(e=>(0,i.jsxs)(`label`,{className:`aha-label`,children:[t(`field_${e.key}`),(0,i.jsx)(`input`,{className:`aha-input`,defaultValue:te[e.key]??``,onBlur:t=>{let n=t.currentTarget.value.trim();n!==(te[e.key]??``)&&w(`cloud`,{tts:{[A]:{[e.key]:n}}})}},`${A}:${e.key}:${te[e.key]??``}`)]},e.key)),(0,i.jsx)(Wl,{error:p(`cloud`),reveal:!0}),(0,i.jsxs)(`label`,{className:`aha-label`,children:[t(`field_apiKey`),` · `,(0,i.jsx)(`span`,{className:n.keys?.[A]?`aha-ok`:`aha-hint`,children:n.keys?.[A]?t(`keySaved`):t(`keyMissing`)}),(0,i.jsxs)(`div`,{className:`aha-row`,children:[(0,i.jsx)(`input`,{className:`aha-input`,style:{flex:1},type:`password`,autoComplete:`off`,spellCheck:!1,value:g,onChange:e=>_(e.currentTarget.value)}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,disabled:!g.trim(),onClick:()=>S(`key`,async()=>{await e.call(`settings/set-key`,{provider:A,key:g.trim()}),_(``),await a()}),children:t(`saveKey`)}),n.keys?.[A]?(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,onClick:()=>S(`key`,async()=>{await e.call(`settings/clear-key`,{provider:A}),await a()}),children:t(`clearKey`)}):null]})]}),(0,i.jsx)(Wl,{error:p(`key`),reveal:!0})]}):null,(0,i.jsx)(`div`,{children:(0,i.jsxs)(`button`,{type:`button`,className:`aha-btn`,disabled:b||n.voiceEngine===`off`,onClick:j,children:[b?(0,i.jsx)(`span`,{className:`aha-spinner`}):`🔊`,` `,t(`testVoice`)]})}),(0,i.jsx)(Wl,{error:p(`test`),reveal:!0})]}),(0,i.jsxs)(`section`,{className:`aha-card`,children:[(0,i.jsx)(`b`,{children:t(`boardTheme`)}),(0,i.jsx)(`div`,{className:`aha-row`,style:{gap:6},children:[[`auto`,`themeAuto`],[`light`,`themeLight`],[`dark`,`themeDark`]].map(([e,r])=>(0,i.jsx)(`button`,{type:`button`,className:`aha-chip`,"data-active":(n.boardTheme??`auto`)===e,onClick:()=>w(`board`,{boardTheme:e}),children:t(r)},e))}),(0,i.jsx)(`b`,{children:t(`boardFont`)}),(0,i.jsx)(`div`,{className:`aha-row`,style:{gap:6},children:[[`hand`,`fontHand`],[`standard`,`fontStandard`]].map(([e,r])=>(0,i.jsx)(`button`,{type:`button`,className:`aha-chip`,"data-active":(n.boardFont??`hand`)===e,onClick:()=>w(`board`,{boardFont:e}),style:e===`hand`?{fontFamily:Of}:void 0,children:t(r)},e))}),(0,i.jsx)(`b`,{children:t(`boardView`)}),(0,i.jsx)(`div`,{className:`aha-row`,style:{gap:6},children:[[`canvas`,`viewCanvas`],[`pages`,`viewPages`]].map(([e,r])=>(0,i.jsx)(`button`,{type:`button`,className:`aha-chip`,"data-active":(n.boardView??`canvas`)===e,onClick:()=>w(`board`,{boardView:e}),children:t(r)},e))}),(0,i.jsx)(`p`,{className:`aha-hint`,children:t(`boardViewHint`)}),(0,i.jsx)(Wl,{error:p(`board`),reveal:!0})]}),(0,i.jsx)(pp,{}),(0,i.jsx)(`p`,{className:`aha-hint`,children:t(`privacyNote`)})]}):(0,i.jsx)(`div`,{className:`aha-page`,children:(0,i.jsx)(Rl,{label:t(`loading`)})})}function pp(){let{api:e,t}=v(),[n,a]=(0,r.useState)(null),[o,s]=(0,r.useState)(!0),[c,l]=(0,r.useState)(!1),[u,d]=(0,r.useState)(!1),[f,p]=(0,r.useState)(null),[m,h]=(0,r.useState)(!1),g=t=>{s(!0),l(!1),e.call(`plugin/version`,{force:t}).then(a).catch(()=>l(!0)).finally(()=>s(!1))};(0,r.useEffect)(()=>{g(!1)},[]);async function _(){d(!0),h(!1);try{p(await e.call(`plugin/update`))}catch{h(!0)}finally{d(!1)}}let y=n?.install?.kind;return(0,i.jsxs)(`section`,{className:`aha-card`,children:[(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsx)(`b`,{children:t(`versionTitle`)}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,disabled:o||u,onClick:()=>g(!0),children:t(o?`versionChecking`:`versionCheck`)})]}),c?(0,i.jsx)(`p`,{className:`aha-error`,children:t(`versionFailed`)}):null,n?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsx)(`span`,{children:t(`versionCurrent`)}),(0,i.jsxs)(`span`,{className:`aha-hint`,children:[`v`,n.current]})]}),(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsx)(`span`,{children:t(`versionLatest`)}),(0,i.jsx)(`span`,{className:`aha-hint`,children:n.latest?`v${n.latest}`:`—`})]}),f?null:(0,i.jsx)(`p`,{className:n.latestUnknown?`aha-error`:`aha-hint`,children:n.latestUnknown?t(`versionFailed`):n.updateAvailable?t(`versionAvailable`,{version:n.latest}):t(`versionUpToDate`)}),!f&&n.updateAvailable&&y===`npm`?(0,i.jsx)(`div`,{children:(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,disabled:u,onClick:_,children:t(u?`versionUpdating`:`versionUpdate`)})}):null,y===`link`?(0,i.jsx)(`p`,{className:`aha-hint`,children:t(`versionLinked`)}):null,n.updateAvailable&&y===`unknown`?(0,i.jsx)(`p`,{className:`aha-hint`,children:t(`versionManual`,{version:n.latest})}):null]}):null,m?(0,i.jsx)(`p`,{className:`aha-error`,children:t(`versionUpdateFailed`)}):null,f?.pending?(0,i.jsx)(`p`,{className:`aha-hint`,children:typeof f.availableAt==`number`?t(`versionPendingUntil`,{version:f.version,time:new Date(f.availableAt).toLocaleString()}):t(`versionPending`,{version:f.version})}):null,f&&!f.pending?(0,i.jsx)(`div`,{className:`aha-feedback`,"data-ok":`true`,children:t(`versionUpdated`,{version:f.version})}):null]})}function mp({draftTopic:e,draftUrl:t,token:n}){let{api:a,t:o}=v(),s=y(()=>a.call(`items/list`,{kind:`shorts`}),[]),[c,l]=(0,r.useState)(e??``),[u,d]=(0,r.useState)(t??``),[f,p]=(0,r.useState)(null),[m,h]=(0,r.useState)(null),g=Xf(),_=x(n);async function b(){if(!c.trim()&&!u.trim())return;h(null);let e=E(`sht`);try{let{job:t}=await a.call(`short/make`,{topic:c,url:u,newId:e});p({id:e,title:c||u,steps:[],stream:t,key:`${e}:new`})}catch(e){h(e)}}(0,r.useEffect)(()=>{_&&(e||t)&&b()},[]);async function S(e){try{let{item:t}=await a.call(`items/get`,{kind:`shorts`,id:e});p({id:t.id,title:t.title,steps:t.board.steps,stream:null,language:t.language,key:`${t.id}:open`,opened:Date.now()})}catch(e){h(e)}}return(0,i.jsx)(`div`,{className:`aha-page`,"data-wide":`true`,children:(0,i.jsxs)(`div`,{className:`aha-split`,children:[(0,i.jsxs)(`div`,{className:`aha-col`,style:{minHeight:0},children:[(0,i.jsxs)(`div`,{className:`aha-col`,style:{gap:4},children:[(0,i.jsx)(`h2`,{className:`aha-title`,children:o(`shortsTitle`)}),(0,i.jsx)(`p`,{className:`aha-hint`,children:o(`shortsHint`)})]}),(0,i.jsxs)(`div`,{className:`aha-row`,children:[(0,i.jsx)(`input`,{className:`aha-input`,style:{flex:2,minWidth:220},value:c,placeholder:o(`topicPlaceholder`),onChange:e=>l(e.currentTarget.value)}),(0,i.jsx)(`input`,{className:`aha-input`,style:{flex:1,minWidth:180},value:u,placeholder:o(`urlPlaceholder`),onChange:e=>d(e.currentTarget.value)}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,disabled:!c.trim()&&!u.trim(),onClick:b,children:o(`makeShort`)})]}),(0,i.jsx)(Wl,{error:m}),f?(0,i.jsx)(Qu,{scope:{kind:`short`,id:f.id},title:f.title,steps:f.steps,stream:f.stream,language:f.language,recordChecks:!1,reveal:f.opened,onStreamDone:e=>{p(t=>({...t,steps:e?.item?.board?.steps??t.steps,title:e?.item?.title??t.title,stream:null})),s.reload()},header:({steps:e})=>(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(Ef,{steps:e,title:f.title,kind:null}),g.exporting?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(Rl,{label:o(`exporting`,{percent:g.exporting.percent})}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,onClick:g.cancel,children:o(`cancel`)})]}):(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,disabled:!f.steps.length,onClick:()=>g.start({steps:f.steps,title:f.title}),children:o(`exportVideo`)})]})},f.key):null,f&&!g.cloud?(0,i.jsx)(`p`,{className:`aha-hint`,children:o(`exportNeedsCloud`)}):null]}),(0,i.jsxs)(`aside`,{className:`aha-col`,style:{minHeight:0,overflow:`auto`},children:[(0,i.jsx)(`h3`,{className:`aha-cardTitle`,children:o(`history`)}),s.loading&&!s.value?(0,i.jsx)(Rl,{}):(s.value??[]).length?s.value.map(e=>(0,i.jsxs)(`div`,{className:`aha-option`,style:{cursor:`pointer`},onClick:()=>S(e.id),children:[(0,i.jsx)(`b`,{children:e.title}),(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsx)(`small`,{children:new Date(e.createdAt).toLocaleString()}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,"data-size":`sm`,onClick:async t=>{t.stopPropagation(),await a.call(`items/remove`,{kind:`shorts`,id:e.id}),s.reload()},children:o(`delete`)})]})]},e.id)):(0,i.jsx)(Gl,{children:o(`empty`)})]})]})})}let hp=[[`sheet`,`makeSheet`,`studio/sheet`],[`cards`,`makeCards`,`studio/cards`],[`notes`,`makeNotes`,`studio/notes`],[`quiz`,`makeQuiz`,`studio/quiz`]];function gp(){let{api:e,t,navigate:n}=v(),a=y(()=>e.call(`items/list`,{kind:`sheets`}),[]),o=y(()=>e.call(`items/list`,{kind:`decks`}),[]),[s,c]=(0,r.useState)([]),[l,u]=(0,r.useState)(!1),[d,f]=(0,r.useState)(``),[p,m]=(0,r.useState)(null),[h,g]=(0,r.useState)(null);async function _(t,n){if(!s.length){u(!0);return}m(t),g(null);try{b((await e.run(n,{materialIds:s,focus:d})).item)}catch(e){g(e)}finally{m(null)}}function b(e){e.kind===`cheatsheet`?n(`sheet`,{sheetId:e.id}):e.kind===`notes`?n(`item`,{kind:`notes`,id:e.id}):e.kind===`cards`?n(`cards`,{deckId:e.id}):n(`item`,{kind:`quiz`,id:e.id})}async function x(t,n){await e.call(`items/remove`,{kind:t,id:n}),t===`sheets`?a.reload():o.reload()}let S=(e,n,r)=>(0,i.jsxs)(`section`,{className:`aha-col`,children:[(0,i.jsx)(`h3`,{className:`aha-cardTitle`,children:e}),n.loading&&!n.value?(0,i.jsx)(Rl,{}):(n.value??[]).length?(0,i.jsx)(`div`,{className:`aha-grid`,children:n.value.map(e=>(0,i.jsxs)(`div`,{className:`aha-card`,"data-click":`true`,onClick:()=>b(e),children:[(0,i.jsx)(`span`,{className:`aha-tag`,children:e.kind===`cheatsheet`?t(`sheets`):e.kind===`notes`?t(`notes`):e.kind===`cards`?t(`decks`):t(`quizzes`)}),(0,i.jsx)(`b`,{children:e.title}),(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsx)(`span`,{className:`aha-hint`,children:new Date(e.updatedAt).toLocaleDateString()}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,"data-size":`sm`,onClick:t=>{t.stopPropagation(),x(r,e.id)},children:t(`delete`)})]})]},e.id))}):(0,i.jsx)(Gl,{children:t(`empty`)})]});return(0,i.jsxs)(`div`,{className:`aha-page`,children:[(0,i.jsxs)(`div`,{className:`aha-col`,style:{gap:4},children:[(0,i.jsx)(`h2`,{className:`aha-title`,children:t(`studioTitle`)}),(0,i.jsx)(`p`,{className:`aha-hint`,children:t(`studioHint`)})]}),(0,i.jsxs)(`section`,{className:`aha-card`,children:[(0,i.jsxs)(`div`,{className:`aha-row`,children:[(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,onClick:()=>u(!0),children:s.length?t(`attached`,{count:s.length}):t(`pickMaterials`)}),(0,i.jsx)(`input`,{className:`aha-input`,style:{flex:1,minWidth:220},value:d,placeholder:t(`focusPlaceholder`),onChange:e=>f(e.currentTarget.value)})]}),(0,i.jsx)(`div`,{className:`aha-row`,children:hp.map(([e,n,r])=>(0,i.jsxs)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,disabled:!!p,onClick:()=>_(e,r),children:[p===e?(0,i.jsx)(`span`,{className:`aha-spinner`}):null,t(n)]},e))}),p?(0,i.jsx)(Rl,{label:t(`generating`)}):null,(0,i.jsx)(Wl,{error:h})]}),S(`${t(`sheets`)} · ${t(`notes`)}`,a,`sheets`),S(`${t(`decks`)} · ${t(`quizzes`)}`,o,`decks`),l?(0,i.jsx)(Yl,{selected:s,onChange:c,onClose:()=>u(!1)}):null]})}Object.freeze([`again`,`hard`,`good`,`easy`]),Object.freeze({again:1,hard:3,good:4,easy:5});function _p(e,t=Date.now()){return Date.parse(e?.dueAt??0)<=t}function vp(e,t=Date.now()){return(e||[]).filter(e=>_p(e,t)).sort((e,t)=>Date.parse(e.dueAt)-Date.parse(t.dueAt))}function yp({courseId:e,lessonId:t,unitId:n,review:a,deckId:o}){let{api:s,t:c,navigate:l}=v(),d=b(),[f,p]=(0,r.useState)(null),[m,h]=(0,r.useState)(null),[g,_]=(0,r.useState)(0),[y,x]=(0,r.useState)([]),[S,C]=(0,r.useState)(0),[w,T]=(0,r.useState)(null),[E,D]=(0,r.useState)({}),[O,k]=(0,r.useState)(null),[A,ee]=(0,r.useState)({}),[te,j]=(0,r.useState)([]),ne=(0,r.useRef)(new Map),re=(0,r.useRef)(0),ie=(0,r.useRef)(!1),ae=(0,r.useRef)(0),oe=(0,r.useRef)({index:0,results:[]});oe.current={index:g,results:y},(0,r.useEffect)(()=>{let r=!0;return(async()=>{let i=!!n&&ie.current;ie.current=!1;try{if(e&&!o&&s.call(`course/get`,{courseId:e}).then(e=>{r&&T(e)}).catch(()=>void 0),a){let t=await s.call(`review/session`,e?{courseId:e}:{});r&&p({title:c(`review`),items:t.items.map(e=>({...e.item,context:e})),language:void 0});return}if(o){let{item:e}=await s.call(`items/get`,{kind:`decks`,id:o});r&&p({title:e.title,items:e.items??[],language:e.language});return}let l=n?`unit/quiz`:`lesson/practice`,f=n?{courseId:e,unitId:n,...i?{force:!0}:{}}:{courseId:e,lessonId:t},m=await s.call(l,f),h=m.job?await d.run(null,null,{existing:m.job}):m,g=(h.quiz??h.sets?.[t]??h.practice)?.items??[];if(!g.length&&!n)throw new u(`bad-output`,`No practice items came back`);let _=t?await s.call(`lesson/get`,{courseId:e,lessonId:t}):null;r&&p({title:_?.lesson.title??c(`unitQuiz`),items:g,language:_?.language})}catch(e){i&&(ie.current=!0),r&&h(e)}})(),()=>{r=!1}},[e,t,n,a,o,S]);let se=f?.items[g],ce=r=>{let i=g;x(e=>[...e,{...r,index:i}]);let a=se?.context?.courseId??e;!a||o||ne.current.set(i,s.call(`lesson/record`,{courseId:a,lessonId:se?.context?.lessonId??t,conceptIds:se?.conceptIds??[],evidence:{kind:n?`quiz`:`practice`,score:r.score,confidence:r.confidence,hintsUsed:r.hintsUsed,timeMs:r.timeMs,expectedMs:6e4,errorTag:r.errorTag},source:uu({courseId:e,lessonId:t,unitId:n},se),response:r.given??r.response??``}).then(e=>(e?.mastery&&D(t=>({...t,...e.mastery})),e?.recommendation&&k(e.recommendation),e?.evidenceId??null)).catch(()=>null))},le=(0,r.useMemo)(()=>od(y),[y]);function ue(e,t){ae.current+=1;let n=ae.current;j(r=>[...r.slice(-2),{key:n,text:e,retry:t}])}let de=e=>j(t=>t.filter(t=>t.key!==e));async function fe(r,i){let a=f?.items[r],l=oe.current.results.find(e=>e.index===r),u=uu({courseId:e,lessonId:t,unitId:n,deckId:o},a);if(!l||!u)return;let d=re.current;ee(e=>({...e,[r]:{...e[r],status:`checking`,note:i,error:null}}));try{let e=await(ne.current.get(r)??null),t=await s.run(`item/challenge`,{source:u,response:l.given??l.response??``,shown:mu(l),...e?{evidenceId:e}:{},note:i});if(re.current!==d){t?.item&&p(e=>e&&{...e,items:e.items.map((e,n)=>n===r?t.item:e)});return}ee(e=>({...e,[r]:hu(e[r],t,oe.current.results.find(e=>e.index===r))})),t?.result&&x(e=>gu(e,r,t.result)),t?.mastery&&D(e=>({...e,...t.mastery})),t?.recommendation&&k(t.recommendation),oe.current.index!==r&&ue(_u(c,{index:r,verdict:t?.verdict,regraded:!!t?.result,earlier:t?.earlier??0}))}catch(e){if(re.current!==d)return;ee(t=>({...t,[r]:{...t[r],status:`failed`,note:i,error:e}})),oe.current.index!==r&&ue(_u(c,{index:r,message:Ul(c,e)}),()=>fe(r,i))}}function pe(){re.current+=1,p(e=>({...e,items:e.items.map((e,t)=>A[t]?.item??e)})),ee({}),j([]),ne.current=new Map,_(0),x([]),k(null)}function me(){pe(),p(null),D({}),ie.current=!0,C(e=>e+1)}if(m)return(0,i.jsxs)(`div`,{className:`aha-page`,children:[(0,i.jsx)(Wl,{error:m}),(0,i.jsx)(`div`,{children:(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,onClick:()=>{h(null),C(e=>e+1)},children:c(`retry`)})})]});if(!f){let e=n&&d.progress?.label===`writing`?c(`quizWriting`,{count:d.progress.done}):null;return(0,i.jsx)(`div`,{className:`aha-page`,children:(0,i.jsx)(Bl,{progress:d.progress,label:c(n?`makingQuiz`:`makingPractice`),detail:e,onCancel:d.running?d.cancel:void 0})})}if(!f.items.length)return(0,i.jsx)(`div`,{className:`aha-page`,children:(0,i.jsx)(Gl,{children:c(a?`nothingToReview`:`empty`)})});let he=g>=f.items.length;return(0,i.jsxs)(`div`,{className:`aha-page`,style:{maxWidth:760},children:[(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsx)(`h2`,{className:`aha-title`,children:f.title}),(0,i.jsxs)(`span`,{className:`aha-row`,style:{gap:6},children:[!he&&le.streak>=2?(0,i.jsx)(`span`,{className:`aha-tag aha-streak`,children:c(`streakCount`,{count:le.streak})}):null,(0,i.jsxs)(`span`,{className:`aha-tag`,children:[Math.min(g+1,f.items.length),`/`,f.items.length]})]})]}),te.map(e=>(0,i.jsxs)(`div`,{className:`aha-itemNotice`,role:`status`,children:[(0,i.jsxs)(`span`,{className:`aha-itemNoticeText`,children:[`🧐 `,e.text]}),e.retry?(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,onClick:()=>{de(e.key),e.retry()},children:c(`retry`)}):null,(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,"data-size":`sm`,"aria-label":c(`close`),onClick:()=>de(e.key),children:`×`})]},e.key)),se?.context?(0,i.jsxs)(`p`,{className:`aha-hint`,children:[se.context.courseTitle,` · `,se.context.conceptName]}):null,he?(0,i.jsx)(bp,{set:f,stats:le,context:w,after:E,recommendation:O,courseId:e,lessonId:t,unitId:n,onRetry:pe,onNewSet:n&&!a&&!o?me:void 0}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`div`,{className:`aha-card`,children:(0,i.jsx)(Hu,{item:se,language:f.language,onResult:ce,onContinue:()=>_(e=>e+1),continueLabel:g+1<f.items.length?c(`continue`):c(`confirm`),keyboard:!0,onChallenge:uu({courseId:e,lessonId:t,unitId:n,deckId:o},se)?e=>fe(g,e):void 0,check:A[g]??null},`${g}`)}),(0,i.jsx)(`p`,{className:`aha-hint`,children:c(`keysHint`)})]})]})}function bp({set:e,stats:t,context:n,after:a,recommendation:o,courseId:s,lessonId:c,unitId:l,onRetry:u,onNewSet:d}){let{t:f,navigate:p}=v(),m=n?.course,h=n?.progress,g=(0,r.useMemo)(()=>{let t=m?Ne(m):new Map;return[...new Set(e.items.flatMap(e=>e.conceptIds??[]))].filter(e=>a[e]!==void 0).map(n=>({id:n,name:t.get(n)?.name??e.items.find(e=>e.context?.conceptId===n)?.context?.conceptName??n,before:h?rd(h.concepts?.[n]):null,after:id(a[n]),percent:a[n]}))},[e,m,h,a]),_=(0,r.useMemo)(()=>{if(!m)return null;let e=Ae(m),t=c?e.find(e=>e.lesson.id===c):null,n=t?Le(m,c)?.lesson.id:l?e.find((t,n)=>n>e.findLastIndex(e=>e.unit.id===l))?.lesson.id:null;return sd(o,{lessonId:c,unitId:t?.unit.id??null,nextLessonId:n??Ie(m,h)?.lesson.id})},[m,h,o,c,l]),y={relearn:()=>p(`lesson`,{courseId:s,lessonId:_.lessonId}),review:()=>p(`practice`,{courseId:s,review:!0}),quiz:()=>p(`practice`,{courseId:s,unitId:_.unitId}),next:()=>p(`lesson`,{courseId:s,lessonId:_.lessonId}),course:()=>p(`course`,{courseId:s})},b=_?f({relearn:`nextRelearn`,review:`nextReview`,quiz:`nextQuiz`,next:`nextLessonStep`,course:`nextCourse`}[_.kind]):``,x=_?f({relearn:`relearnLesson`,review:`reviewCourse`,quiz:`unitQuiz`,next:`nextLesson`,course:`backToCourse`}[_.kind]):``;return(0,i.jsxs)(`div`,{className:`aha-card aha-summary`,children:[(0,i.jsxs)(`div`,{className:`aha-stars`,role:`img`,"aria-label":f(`starsLabel`,{count:t.stars}),children:[`★`.repeat(t.stars),(0,i.jsx)(`span`,{children:`★`.repeat(3-t.stars)})]}),(0,i.jsx)(`b`,{children:f(`practiceDone`,{correct:t.correct,total:e.items.length})}),(0,i.jsxs)(`div`,{className:`aha-row aha-summaryStats`,children:[(0,i.jsxs)(`span`,{children:[(0,i.jsxs)(`b`,{children:[Math.round(t.accuracy*100),`%`]}),f(`accuracy`)]}),(0,i.jsxs)(`span`,{children:[(0,i.jsx)(`b`,{children:t.bestStreak}),f(`bestStreak`)]})]}),g.length?(0,i.jsxs)(`div`,{className:`aha-col`,style:{gap:4},children:[(0,i.jsx)(`span`,{className:`aha-hint`,children:f(`masteryChange`)}),g.map(e=>(0,i.jsxs)(`div`,{className:`aha-row aha-conceptMove`,children:[(0,i.jsx)(`span`,{style:{flex:1,minWidth:120},children:e.name}),e.before?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`span`,{className:`aha-level`,"data-level":e.before,children:f(ad[e.before])}),(0,i.jsx)(`span`,{"aria-hidden":`true`,children:`→`})]}):null,(0,i.jsx)(`span`,{className:`aha-level`,"data-level":e.after,children:f(ad[e.after])}),(0,i.jsxs)(`span`,{className:`aha-hint`,children:[e.percent,`%`]})]},e.id))]}):null,_&&s?(0,i.jsx)(`p`,{children:b}):null,(0,i.jsxs)(`div`,{className:`aha-row`,children:[_&&s?(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,onClick:y[_.kind],children:x}):null,(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,onClick:u,children:f(`retry`)}),d?(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,onClick:d,children:f(`newQuizSet`)}):null,s&&_?.kind!==`course`?(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,onClick:y.course,children:f(`backToCourse`)}):null]})]})}function xp({courseId:e,unitId:t,deckId:n}){let{api:a,t:o}=v(),s=b(),[c,l]=(0,r.useState)(null),[u,d]=(0,r.useState)(null),[f,p]=(0,r.useState)(!1),[m,h]=(0,r.useState)(null);(0,r.useEffect)(()=>{let r=!0;return(async()=>{try{let i;if(n){let{item:e}=await a.call(`items/get`,{kind:`decks`,id:n});i={title:o(`cardsTitle`),cards:e.cards,order:Cp(e).slice(0,40)}}else if(t){let n=await a.call(`unit/cards`,{courseId:e,unitId:t}),{deck:r,unit:c}=n.job?await s.run(null,null,{existing:n.job}):n;i={title:`${o(`unitN`,{n:c.n})} · ${c.title}`,kicker:o(`unitCards`),cards:r.cards.map(e=>({...e,unitId:t})),order:Cp({...r,unitId:t}),total:r.cards.length}}else{let{cards:t}=await a.call(`course/card-session`,{courseId:e});i={title:o(`cardReview`),cards:t,order:t.map(Sp)}}if(!r)return;l({...i,cards:i.cards.map(e=>({...e,key:Sp(e)}))}),h(i.order)}catch(e){r&&d(e)}})(),()=>{r=!1}},[e,t,n]);let g=(0,r.useMemo)(()=>c?.cards.find(e=>e.key===m?.[0]),[c,m]);async function _(t){if(g){p(!1),h(e=>{let n=e.slice(1);return t===`again`?[...n,g.key]:n});try{n?await a.call(`items/card-review`,{id:n,cardId:g.id,grade:t}):await a.call(`course/card-review`,{courseId:e,...g.unitId?{unitId:g.unitId}:{},cardId:g.id,grade:t})}catch{}}}if(u)return(0,i.jsx)(`div`,{className:`aha-page`,children:(0,i.jsx)(Wl,{error:u})});if(!c||!m){let e=s.progress?.label===`writing`?o(`cardsWriting`,{count:s.progress.done}):null;return(0,i.jsx)(`div`,{className:`aha-page`,children:(0,i.jsx)(Bl,{progress:s.progress,label:o(t?`makingUnitCards`:`makingCards`),detail:e,onCancel:s.running?s.cancel:void 0})})}let y=g?.unit?`${o(`unitN`,{n:g.unit.n})} · ${g.unit.title}`:``;return(0,i.jsxs)(`div`,{className:`aha-page`,style:{maxWidth:720},children:[(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsxs)(`div`,{className:`aha-col`,style:{gap:2,minWidth:0},children:[c.kicker?(0,i.jsx)(`span`,{className:`aha-hint`,children:c.kicker}):null,(0,i.jsx)(`h2`,{className:`aha-title`,children:c.title})]}),(0,i.jsxs)(`span`,{className:`aha-row`,style:{gap:6},children:[(0,i.jsx)(`span`,{className:`aha-tag`,children:o(`cardsDue`,{count:m.length})}),c.total?(0,i.jsx)(`span`,{className:`aha-tag`,children:o(`cardsTotal`,{count:c.total})}):null]})]}),g?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`div`,{className:`aha-flash`,"data-flipped":f,onClick:()=>p(e=>!e),role:`button`,tabIndex:0,onKeyDown:e=>{(e.key===` `||e.key===`Enter`)&&p(e=>!e)},children:(0,i.jsxs)(`div`,{className:`aha-flashInner`,children:[(0,i.jsx)(`div`,{className:`aha-flashFace`,children:(0,i.jsx)(vu,{text:g.front})}),(0,i.jsx)(`div`,{className:`aha-flashFace aha-flashBack`,children:(0,i.jsx)(vu,{text:g.back})})]})}),(0,i.jsx)(`p`,{className:`aha-hint`,style:{textAlign:`center`},children:[y,g.tag,o(`flip`)].filter(Boolean).join(` · `)}),f?(0,i.jsx)(`div`,{className:`aha-row`,style:{justifyContent:`center`},children:[[`again`,`again`],[`hard`,`hard`],[`good`,`good`],[`easy`,`easy`]].map(([e,t])=>(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":e===`good`?`primary`:void 0,onClick:()=>_(e),children:o(t)},e))}):null]}):(0,i.jsx)(Gl,{children:c.cards.length?o(`cardsDone`):o(`cardReviewEmpty`)})]})}let Sp=e=>`${e.unitId??``}:${e.id}`;function Cp(e){let t=e.unitId??null,n=e=>Sp({unitId:t,id:e}),r=vp(Object.values(e.srs??{}),Date.now()).map(e=>e.id).filter(t=>e.cards.some(e=>e.id===t)),i=e.cards.filter(t=>!e.srs?.[t.id]).map(e=>e.id);return[...r,...i].map(n)}function wp({courseId:e,unitId:t,sheetId:n}){let{api:a,t:o,toast:s}=v(),c=b(),[l,u]=(0,r.useState)(null),[d,f]=(0,r.useState)(null),[p,m]=(0,r.useState)(null),h=async r=>{f(null);try{let i;if(n)i=(await a.call(`items/get`,{kind:`sheets`,id:n})).item.sheet;else{let n=await a.call(`unit/sheet`,{courseId:e,unitId:t,force:r});i=n.job?(await c.run(null,null,{existing:n.job})).sheet:n.sheet}u(i),m(i.layout)}catch(e){f(e)}};(0,r.useEffect)(()=>{h(!1)},[e,t,n]);let g=r=>{let i={...p,...r};m(i),(n?a.call(`items/sheet-layout`,{id:n,layout:i}):a.call(`unit/sheet-layout`,{courseId:e,unitId:t,layout:i})).catch(e=>s(Ul(o,e)))};if(d)return(0,i.jsx)(`div`,{className:`aha-page`,children:(0,i.jsx)(Wl,{error:d})});if(!l||!p)return(0,i.jsx)(`div`,{className:`aha-page`,children:(0,i.jsx)(Bl,{progress:c.progress,label:o(`makingSheet`),onCancel:c.running?c.cancel:void 0})});let _=p.order.map(e=>l.sections.find(t=>t.id===e)).filter(Boolean),y=new Set(p.hidden??[]);return(0,i.jsxs)(`div`,{className:`aha-page`,style:{maxWidth:1200},children:[(0,i.jsxs)(`div`,{className:`aha-spread aha-noprint`,children:[(0,i.jsx)(`h2`,{className:`aha-title`,children:l.title||o(`sheetTitle`)}),(0,i.jsxs)(`div`,{className:`aha-row`,children:[(0,i.jsxs)(`label`,{className:`aha-row`,style:{gap:6},children:[o(`columns`),(0,i.jsx)(`select`,{className:`aha-select`,style:{width:`auto`},value:p.columns,onChange:e=>g({columns:Number(e.currentTarget.value)}),children:[1,2,3,4].map(e=>(0,i.jsx)(`option`,{value:e,children:e},e))})]}),(0,i.jsxs)(`label`,{className:`aha-row`,style:{gap:6},children:[o(`fontSize`),(0,i.jsx)(`select`,{className:`aha-select`,style:{width:`auto`},value:p.fontSize,onChange:e=>g({fontSize:Number(e.currentTarget.value)}),children:[9,10,11,12,13,14,16].map(e=>(0,i.jsx)(`option`,{value:e,children:e},e))})]}),(0,i.jsxs)(`label`,{className:`aha-row`,style:{gap:6},children:[(0,i.jsx)(`input`,{type:`checkbox`,checked:p.highlight,onChange:e=>g({highlight:e.currentTarget.checked})}),o(`highlight`)]}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,onClick:()=>window.print(),children:o(`print`)}),n?null:(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,onClick:()=>{u(null),h(!0)},children:o(`regenerate`)})]})]}),(0,i.jsx)(`div`,{className:`aha-row aha-noprint`,style:{gap:6},children:_.map((e,t)=>(0,i.jsxs)(`span`,{className:`aha-chip`,"data-active":!y.has(e.id),children:[(0,i.jsx)(`span`,{onClick:()=>g({hidden:y.has(e.id)?[...y].filter(t=>t!==e.id):[...y,e.id]}),children:e.title}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`ghost`,"data-size":`sm`,onClick:()=>{let t=[...p.order],n=t.indexOf(e.id);n>0&&([t[n-1],t[n]]=[t[n],t[n-1]]),g({order:t})},disabled:t===0,children:`↑`})]},e.id))}),(0,i.jsx)(`div`,{className:`aha-printable`,children:(0,i.jsx)(`div`,{className:`aha-sheet`,"data-highlight":p.highlight,style:{columnCount:p.columns,"--sheet-size":`${p.fontSize}px`},children:_.filter(e=>!y.has(e.id)).map(e=>(0,i.jsxs)(`div`,{className:`aha-sheetSection`,children:[(0,i.jsx)(`h4`,{children:e.title}),e.items.map((e,t)=>(0,i.jsxs)(`div`,{className:`aha-sheetItem`,"data-kind":e.kind,children:[e.title?(0,i.jsxs)(`b`,{children:[e.title,`:`]}):null,e.text?(0,i.jsx)(vu,{text:e.text,compact:!0}):null,e.tex?(0,i.jsx)(Ks,{tex:e.tex}):null,e.cite?(0,i.jsxs)(`span`,{className:`aha-cite`,children:[`(p.`,e.cite.page,e.cite.source?` · ${e.cite.source}`:``,`)`]}):null]},t)),e.related?.length?(0,i.jsxs)(`div`,{className:`aha-cite`,children:[`↔ `,e.related.join(` · `)]}):null]},e.id))})})]})}function Tp({kind:e,id:t,materialId:n}){let{api:a,t:o}=v(),s=b(),[c,l]=(0,r.useState)(null),[u,d]=(0,r.useState)(null),[f,p]=(0,r.useState)(0);if((0,r.useEffect)(()=>{let r=!0;return(async()=>{try{if(e===`digest`){let{material:e}=await a.call(`material/get`,{id:n}),t=f===0?e.digest:null;if(!t){let e=await a.call(`material/digest`,{id:n});t=(await s.run(null,null,{existing:e.job})).material.digest}r&&l({title:e.title,digest:t});return}let{item:i}=await a.call(`items/get`,{kind:`sheets`,id:t});r&&l({title:i.title,markdown:i.markdown})}catch(e){r&&d(e)}})(),()=>{r=!1}},[e,t,n,f]),e===`quiz`)return(0,i.jsx)(yp,{deckId:t});if(u)return(0,i.jsx)(`div`,{className:`aha-page`,children:(0,i.jsx)(Wl,{error:u})});if(!c){let e=s.progress;return(0,i.jsx)(`div`,{className:`aha-page`,children:(0,i.jsx)(Bl,{progress:e,label:e?.label===`reading`?o(`digestReading`,{done:e.done,total:Math.max(1,e.total-1)}):e?.label===`writing`?o(`digestWriting`):o(`generating`),onCancel:s.running?s.cancel:void 0})})}if(c.markdown!==void 0)return(0,i.jsxs)(`div`,{className:`aha-page`,style:{maxWidth:860},children:[(0,i.jsx)(`h2`,{className:`aha-title`,children:c.title}),(0,i.jsx)(`div`,{className:`aha-card`,children:(0,i.jsx)(vu,{text:c.markdown})})]});let m=c.digest;return(0,i.jsxs)(`div`,{className:`aha-page`,style:{maxWidth:900},children:[(0,i.jsxs)(`h2`,{className:`aha-title`,children:[o(`digestTitle`),` · `,c.title]}),m.missing?.length?(0,i.jsxs)(`div`,{className:`aha-row`,children:[(0,i.jsx)(`span`,{className:`aha-error`,children:o(`digestMissing`,{count:m.missing.length,parts:m.missing.join(`, `)})}),(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,onClick:()=>{l(null),p(e=>e+1)},children:o(`redigest`)})]}):null,(0,i.jsxs)(`section`,{className:`aha-card`,children:[(0,i.jsx)(`b`,{children:o(`overview`)}),(0,i.jsx)(vu,{text:m.overview})]}),m.structure?.length?(0,i.jsxs)(`section`,{className:`aha-card`,children:[(0,i.jsx)(`b`,{children:o(`structure`)}),m.structure.map((e,t)=>(0,i.jsxs)(`div`,{className:`aha-col`,style:{gap:2},children:[(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`b`,{children:e.heading}),/\d/u.test(e.pages??``)?(0,i.jsxs)(`span`,{className:`aha-cite`,children:[`(p.`,e.pages,`)`]}):null]}),(0,i.jsx)(`ul`,{style:{margin:0},children:e.points.map((e,t)=>(0,i.jsx)(`li`,{children:(0,i.jsx)(vu,{text:e,compact:!0})},t))})]},t))]}):null,m.keyIdeas?.length?(0,i.jsxs)(`section`,{className:`aha-card`,children:[(0,i.jsx)(`b`,{children:o(`keyIdeas`)}),(0,i.jsx)(`ul`,{style:{margin:0},children:m.keyIdeas.map((e,t)=>(0,i.jsx)(`li`,{children:(0,i.jsx)(vu,{text:e,compact:!0})},t))})]}):null,m.arguments?.length?(0,i.jsxs)(`section`,{className:`aha-card`,children:[(0,i.jsx)(`b`,{children:o(`arguments`)}),m.arguments.map((e,t)=>(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`b`,{children:e.claim}),/\d/u.test(e.page??``)?(0,i.jsxs)(`span`,{className:`aha-cite`,children:[`(p.`,e.page,`)`]}):null,(0,i.jsx)(`p`,{className:`aha-hint`,children:e.support})]},t))]}):null,m.glossary?.length?(0,i.jsxs)(`section`,{className:`aha-card`,children:[(0,i.jsx)(`b`,{children:o(`glossary`)}),m.glossary.map((e,t)=>(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`b`,{children:e.term}),`:`,e.meaning]},t))]}):null,m.questions?.length?(0,i.jsxs)(`section`,{className:`aha-card`,children:[(0,i.jsx)(`b`,{children:o(`discussion`)}),(0,i.jsx)(`ol`,{style:{margin:0},children:m.questions.map((e,t)=>(0,i.jsx)(`li`,{children:e},t))})]}):null]})}let Ep=[[`home`,`navHome`,`home`],[`courses`,`navCourses`,`courses`],[`assist`,`navAssist`,`assist`],[`materials`,`navMaterials`,`library`],[`studio`,`navStudio`,`studio`],[`shorts`,`navShorts`,`shorts`],[`plan`,`navPlan`,`plan`],[`profile`,`navProfile`,`profile`],[`settings`,`navSettings`,`settings`],[`about`,`navAbout`,`heart`]],Dp={home:Kd,courses:gd,craft:Ad,handout:Bd,course:dd,lesson:Zf,practice:yp,cards:xp,sheet:wp,item:Tp,project:lp,materials:tp,studio:gp,assist:ed,shorts:mp,plan:rp,profile:cp,settings:fp,about:vt},Op={craft:`courses`,course:`courses`,lesson:`courses`,handout:`courses`,practice:`courses`,project:`courses`,cards:`studio`,sheet:`studio`,item:`studio`},kp=e=>e.params?.courseId&&[`cards`,`sheet`].includes(e.screen)?`courses`:Op[e.screen]??e.screen;function Ap(e){let[t,n]=(0,r.useState)(0);return(0,i.jsx)(s,{onError:st,fallback:({error:t})=>(0,i.jsx)(`div`,{className:`aha`,children:(0,i.jsx)(`main`,{className:`aha-main`,children:(0,i.jsx)(l,{t:e.t,error:t,onHome:()=>n(e=>e+1)})})}),children:(0,i.jsx)(jp,{...e})},t)}function jp({rpc:e,t,language:n,dsh:a}){let{route:o,setRoute:c,crashed:u}=ot(),d=(0,r.useRef)([]),f=(0,r.useCallback)((e,t={},{replace:n=!1}={})=>{c(r=>(n||(d.current.push(r),d.current.length>40&&d.current.shift()),{screen:e,params:t}))},[c]),p=(0,r.useCallback)(()=>{let e=d.current.pop();c(e??{screen:`home`,params:{}})},[c]);(0,r.useEffect)(()=>{let e=e=>{let t=e.detail;t?.screen&&Dp[t.screen]&&f(t.screen,t.params??{})};return window.addEventListener(nt,e),()=>window.removeEventListener(nt,e)},[f]);let{value:m,toastText:h,textSize:g}=it({rpc:e,t,language:n,dsh:a,navigate:f,back:p}),v=Mp(dt.includes(o.screen)),y=Dp[o.screen]??Kd,b=kp(o),x=e=>{d.current=[],c({screen:e,params:{}})};return(0,i.jsx)(_.Provider,{value:m,children:(0,i.jsxs)(`div`,{className:`aha`,ref:v.root,"data-nav":v.state,"data-text":g,children:[(0,i.jsxs)(`nav`,{className:`aha-nav`,"aria-label":t(`appName`),onScroll:v.hideTip,children:[(0,i.jsxs)(`div`,{className:`aha-brand`,children:[(0,i.jsx)(ut,{name:`logo`,size:24}),(0,i.jsxs)(`span`,{children:[t(`appName`),(0,i.jsx)(`small`,{children:t(`appTagline`)})]})]}),Ep.map(([e,n,r])=>(0,i.jsxs)(`button`,{type:`button`,className:`aha-navItem`,"data-active":b===e,onClick:()=>{v.close(),x(e)},"aria-label":t(n),...v.tipFor(t(n)),children:[(0,i.jsx)(ut,{name:r,size:17}),(0,i.jsx)(`span`,{children:t(n)})]},e)),(0,i.jsxs)(`button`,{type:`button`,className:`aha-navItem aha-navFold`,"aria-expanded":v.state!==`folded`,"aria-label":v.state===`folded`?t(`navUnfold`):t(`navFold`),onClick:v.fold,...v.tipFor(t(`navUnfold`)),children:[(0,i.jsx)(ut,{name:v.state===`folded`?`unfold`:`fold`,size:17}),(0,i.jsx)(`span`,{children:t(`navFold`)})]})]}),v.state===`peek`?(0,i.jsx)(`div`,{className:`aha-navShade`,onClick:v.close}):null,v.tip?(0,i.jsx)(`div`,{className:`aha-navTip`,role:`tooltip`,style:{top:v.tip.top,left:v.tip.left},children:v.tip.label}):null,(0,i.jsx)(`main`,{className:`aha-main`,children:(0,i.jsx)(s,{resetKey:o,onError:u,fallback:({error:e})=>(0,i.jsx)(l,{t,error:e,onRetry:()=>c(e=>({...e})),onHome:()=>x(`home`)}),children:(0,i.jsx)(y,{...o.params},`${o.screen}:${JSON.stringify(o.params)}`)})}),h?(0,i.jsx)(`div`,{className:`aha-toast`,role:`status`,children:h}):null]})})}function Mp(e){let[t,n]=C(`nav`,`open`),[i,a]=(0,r.useState)(!1),[o,s]=(0,r.useState)(!1),[c,l]=(0,r.useState)(null),u=(0,r.useRef)(null);(0,r.useLayoutEffect)(()=>{let e=u.current;if(!e)return;let t=()=>a(e.getBoundingClientRect().width<640);if(t(),typeof ResizeObserver!=`function`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]),(0,r.useEffect)(()=>s(!1),[i,e]);let d=ft({choice:t,narrow:i,inClass:e,peek:o});(0,r.useEffect)(()=>{if(l(null),d!==`peek`)return;let e=e=>{e.key===`Escape`&&s(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[d]);let f=(e,t)=>{d===`folded`&&u.current&&l({label:t,...mt(e.getBoundingClientRect(),u.current.getBoundingClientRect())})},p=()=>l(null);return{root:u,state:d,tip:c,hideTip:p,fold(){let r=pt({choice:t,narrow:i,inClass:e,peek:o});n(r.choice),s(r.peek)},close:()=>s(!1),tipFor:e=>({onMouseEnter:t=>f(t.currentTarget,e),onMouseLeave:p,onFocus:t=>{t.currentTarget.matches(`:focus-visible`)&&f(t.currentTarget,e)},onBlur:p})}}function Np({useTabInfo:e,rpc:t,t:n,language:r,dsh:a}){let{tab:o}=e(),c=o?.navigation?.params??null,{value:u,textSize:d}=it({rpc:t,t:n,language:r,dsh:a});return(0,i.jsx)(_.Provider,{value:u,children:(0,i.jsx)(`div`,{className:`aha aha-boardTab`,"data-text":d,style:{height:`100%`,overflow:`auto`,padding:`10px 12px`},children:c?.threadId?(0,i.jsx)(s,{fallback:({error:e,retry:t})=>(0,i.jsx)(l,{t:n,error:e,place:`tab`,onRetry:t}),children:(0,i.jsx)(Pp,{threadId:c.threadId,jobId:c.jobId})},`${c.threadId}:${o.navigation.revision??0}`):(0,i.jsx)(`p`,{className:`aha-hint`,children:n(`openBoard`)})})})}function Pp({threadId:e,jobId:t}){let{api:n,t:a}=v(),[o,s]=(0,r.useState)(null);return(0,r.useEffect)(()=>{let r=!0;return(async()=>{let i=t?await n.call(`job/get`,{id:t}).catch(()=>null):null;if(i&&i.status===`running`){r&&s({stream:i,steps:[],title:``});return}try{let{item:t}=await n.call(`items/get`,{kind:`assist`,id:e}),i=t.turns.at(-1);r&&s({stream:null,steps:i?.board?.steps??[],title:t.title,language:t.language,turn:t.turns.length-1})}catch(e){r&&s({error:e})}})(),()=>{r=!1}},[e,t]),o?o.error?(0,i.jsx)(`p`,{className:`aha-error`,children:Ul(a,o.error)}):(0,i.jsx)(Qu,{scope:{kind:`thread`,id:e,turn:o.turn??0},title:o.title||a(`boardSession`),steps:o.steps,stream:o.stream,language:o.language,recordChecks:!1,tour:!1,talkKey:!1}):(0,i.jsx)(Rl,{label:a(`loading`)})}function Fp({rpc:e,t,language:n,dsh:r}){return it({rpc:e,t,language:n,dsh:r}).value}function Ip(e){return e?.meta&&typeof e.meta==`object`?e.meta:null}function Lp(e){let t=Fp(e);return(0,i.jsx)(_.Provider,{value:t,children:(0,i.jsx)(`div`,{className:`aha aha-card`,"data-text":`dsh`,style:{height:`auto`,display:`flex`,flexDirection:`column`,gap:8,margin:`6px 0`,padding:`10px 12px`},children:(0,i.jsx)(s,{fallback:({error:t,retry:n})=>(0,i.jsx)(l,{t:e.t,error:t,place:`card`,onRetry:n}),children:(0,i.jsx)(Rp,{...e})})})})}function Rp({toolName:e,phase:t,block:n,dsh:a,inputActions:o,t:s,callId:c}){let l=Ip(n),u=n?.args?.text?.(`topic`)??n?.args?.text?.(`goal`)??``,d=t!==`result`,f=t===`result`&&n?.isError;return(0,r.useEffect)(()=>{if(e!==`aha_whiteboard`||t!==`result`||!l?.threadId)return;let r=typeof n?.time!=`number`||Date.now()-n.time<12e4,i=`aha-tutor:opened:${c}`;try{if(!r||window.sessionStorage.getItem(i))return;window.sessionStorage.setItem(i,`1`)}catch{if(!r)return}a.openBoardTab({threadId:l.threadId,jobId:l.jobId})},[e,t,l?.threadId]),f?(0,i.jsx)(`span`,{className:`aha-error`,children:s(`errorGeneric`,{message:(n.content??[]).map(e=>e.text??``).join(` `).slice(0,200)})}):e===`aha_whiteboard`?(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsxs)(`span`,{className:`aha-row`,style:{gap:8},children:[d?(0,i.jsx)(`span`,{className:`aha-spinner`}):`🧑🏫`,(0,i.jsx)(`b`,{children:s(`toolBoardTitle`)}),(0,i.jsx)(`span`,{className:`aha-hint`,children:l?.title??u})]}),l?.threadId?(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,onClick:()=>a.openBoardTab({threadId:l.threadId,jobId:l.jobId}),children:s(`openBoard`)}):null]}):e===`aha_quiz`?d||!l?.items?(0,i.jsxs)(`span`,{className:`aha-row`,children:[(0,i.jsx)(`span`,{className:`aha-spinner`}),s(`makingPractice`)]}):(0,i.jsx)(zp,{items:l.items,topic:l.topic,inputActions:o}):e===`aha_course`?(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsxs)(`span`,{className:`aha-row`,style:{gap:8},children:[d?(0,i.jsx)(`span`,{className:`aha-spinner`}):`🎓`,(0,i.jsx)(`b`,{children:s(`modeCourse`)}),(0,i.jsx)(`span`,{className:`aha-hint`,children:l?.goal??u})]}),l?.courseId?(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,onClick:()=>ct(a,`craft`,{courseId:l.courseId}),children:s(`open`)}):null]}):e===`aha_cheatsheet`?(0,i.jsxs)(`div`,{className:`aha-spread`,children:[(0,i.jsxs)(`span`,{className:`aha-row`,style:{gap:8},children:[d?(0,i.jsx)(`span`,{className:`aha-spinner`}):`📄`,(0,i.jsx)(`b`,{children:s(`sheetTitle`)}),(0,i.jsx)(`span`,{className:`aha-hint`,children:l?.title??u})]}),l?.sheetId?(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-size":`sm`,onClick:()=>ct(a,`sheet`,{sheetId:l.sheetId}),children:s(`open`)}):null]}):(0,i.jsxs)(`span`,{className:`aha-hint`,children:[d?(0,i.jsx)(`span`,{className:`aha-spinner`}):`🧠`,` `,s(`navProfile`)]})}function zp({items:e,topic:t,inputActions:n}){let{t:a,language:o}=v(),[s,c]=(0,r.useState)(0),[l,u]=(0,r.useState)([]),d=e[s],f=(0,r.useMemo)(()=>l.map((e,t)=>`${t+1}. ${e.correct?`✔`:e.partial?`◐`:`✘`} ${e.answer}`).join(`
|
|
721
|
+
`),[l]);if(!d){let r=l.filter(e=>e.correct).length;return(0,i.jsxs)(`div`,{className:`aha-col`,children:[(0,i.jsx)(`b`,{children:a(`practiceDone`,{correct:r,total:e.length})}),n?.setDraft?(0,i.jsx)(`div`,{children:(0,i.jsx)(`button`,{type:`button`,className:`aha-btn`,"data-kind":`primary`,"data-size":`sm`,onClick:()=>n.setDraft(`${t??``} ${a(`practiceDone`,{correct:r,total:e.length})}\n${f}`),children:a(`submit`)})}):null]})}return(0,i.jsxs)(`div`,{className:`aha-col`,children:[(0,i.jsxs)(`span`,{className:`aha-hint`,children:[a(`checkTitle`),` · `,s+1,`/`,e.length]}),(0,i.jsx)(Hu,{item:d,language:o===`zh`?`zh-CN`:`en`,compact:!0,onResult:e=>u(t=>[...t,{...e,answer:d.prompt.slice(0,60)}]),onContinue:()=>c(e=>e+1)},s)]})}let Bp=`ahaTutor`,Vp={appName:`开窍`,appTagline:`AI 私人老师`,navHome:`首页`,navCourses:`我的课程`,navMaterials:`资料库`,navStudio:`学习工具`,navAssist:`即时答疑`,navShorts:`讲解短片`,navPlan:`学习计划`,navProfile:`我的画像`,navSettings:`设置`,navAbout:`关于作者`,navFold:`收起`,navUnfold:`展开`,heroTitle:`今天想把什么弄懂?`,heroHint:`说出你想学的东西,或者丢一本教材进来。我会先了解你,再为你量身做一门课,在白板上一步步讲给你听。`,heroPlaceholder:`比如:三周内搞懂线性代数里的特征值|把这份讲义变成一门课|量子隧穿到底是怎么回事`,modeCourse:`定制一门课`,modeExplain:`讲个概念`,modeSolve:`陪我解题`,modeVisualize:`画出来看看`,modeDigest:`消化长文档`,modeShort:`两分钟短片`,attach:`添加资料`,attached:`已附 {count} 份资料`,start:`开始`,quickStart:`跳过提问,直接出课`,continueLearning:`继续学习`,todayPlan:`今天的安排`,noPlanToday:`今天没有安排,去建一门课或者休息一下吧。`,recentWork:`最近做的`,sampleCourses:`示例课程`,sampleHint:`不花 token 也能先体验白板课堂。`,importSample:`加入我的课程`,coursesTitle:`我的课程`,filterAll:`全部`,filterActive:`学习中`,filterDone:`已学完`,filterArchived:`已归档`,searchCourses:`搜索课程`,noCourses:`还没有课程。回到首页,告诉我你想学什么。`,importPack:`导入课程包`,lessonsCount:`{done}/{total} 讲`,minutesLeft:`还剩约 {minutes} 分钟`,statusIntake:`待回答问题`,statusBlueprint:`待确认蓝图`,statusReady:`可以学习`,nextUp:`下一讲:{title}`,craftQuestionsTitle:`先认识一下你`,craftQuestionsHint:`回答几个问题,课程会按你的情况来设计。拿不准的可以跳过。`,craftOther:`其他(自己写)`,craftPace:`学习节奏`,paceIntensive:`冲刺`,paceIntensiveHint:`约 6 周,抓重点`,paceBalanced:`稳步`,paceBalancedHint:`约 3 个月,基础 + 练习 + 项目`,paceRelaxed:`不设期限`,paceRelaxedHint:`慢慢来,挖得更深`,weeklyMinutes:`每周大约能学多久`,minutesUnit:`{minutes} 分钟`,deadline:`截止日期(可选)`,makeBlueprint:`生成课程蓝图`,thinkingQuestions:`正在想该问你什么…`,designingBlueprint:`正在设计课程蓝图…`,blueprintTitle:`课程蓝图`,blueprintHint:`这是为你设计的课程结构。可以直接改标题、删减或调整顺序,也可以用一句话让我改。`,reviseLabel:`用一句话修改`,revisePlaceholder:`比如:多加一些编程实战;第二单元讲浅一点;去掉第 3 讲`,revise:`修改`,revising:`正在修改…`,addLesson:`加一讲`,addLecture:`加一章`,addUnit:`加一个单元`,moveUp:`上移`,moveDown:`下移`,remove:`删除`,projects:`实战项目`,confirmCourse:`确认,生成整门课`,confirming:`正在准备练习和项目… {done}/{total}`,courseReady:`课程已就绪`,unitN:`第 {n} 单元`,lectureN:`第 {n} 章`,estMinutes:`{minutes} 分钟`,saveEdits:`保存修改`,saved:`已保存`,tabOutline:`大纲`,tabPractice:`练习、测验与闪卡`,tabSheets:`速查表`,tabProjects:`项目`,tabProgress:`进度`,learn:`学习`,practice:`练习`,review:`复习`,remedial:`巩固`,exportPack:`导出课程包`,exportWithProgress:`连同我的学习进度`,rename:`重命名`,archive:`归档`,unarchive:`取消归档`,deleteCourse:`删除课程`,deleteConfirm:`删除后无法恢复。确定删除「{title}」吗?`,cancel:`取消`,confirm:`确定`,close:`关闭`,back:`返回`,retry:`重试`,generate:`生成`,regenerate:`重新生成`,generating:`正在生成…`,open:`打开`,unitQuiz:`单元测验`,unitSheet:`单元速查表`,unitCards:`单元闪卡`,unitCardsDue:`单元闪卡 · {count}`,unitCardsDueTitle:`{count} 张到期`,mastery:`掌握度`,conceptMastery:`知识点掌握情况`,preparingLesson:`老师正在备课…`,bufferingLesson:`下一部分马上写好…`,play:`播放`,pause:`暂停`,prevStep:`上一步`,nextStep:`下一步`,speed:`语速`,voiceOn:`声音开`,voiceOff:`静音`,voiceDownCloud:`云端语音用不了:{reason}这节课先静音往下讲。`,voiceDownSystem:`朗读用不了:{reason}这节课先静音往下讲。`,openSettings:`去设置`,captions:`字幕`,raiseHand:`举手提问`,askPlaceholder:`哪里没听懂?直接问`,ask:`提问`,answering:`老师在想怎么回答…`,reexplain:`换个讲法`,styleAnalogy:`打个比方`,styleVisual:`画图讲`,styleExample:`举个例子`,styleSimpler:`讲简单点`,styleDeeper:`讲深一点`,stepOf:`第 {current}/{total} 步`,checkTitle:`小测一下`,confidence:`你有多确定?`,pickSeveral:`多选题:选出所有正确的选项。`,confSure:`很确定`,confUnsure:`有点犹豫`,confGuess:`猜的`,submit:`提交`,correct:`答对了`,incorrect:`不太对`,partial:`部分正确`,continue:`继续`,skip:`跳过`,hint:`提示`,yourAnswer:`你的答案`,grading:`老师在批改…`,lessonDone:`这一讲讲完了`,selfRate:`你觉得自己掌握得怎么样?`,rate1:`没懂`,rate3:`一般`,rate5:`很清楚`,nextLesson:`下一讲`,doPractice:`去做练习`,backToCourse:`回到课程`,remedialAdded:`我给你加了一节巩固课:{title}`,challengeNote:`这部分你掌握得很好,接下来会讲得更深一些。`,replay:`重新讲一遍`,regenerateLesson:`重新备课`,exportBoard:`导出板书`,practiceTitle:`练习`,check:`检查答案`,checked:`已检查`,score:`得分 {score}`,practiceDone:`本组练习完成:答对 {correct}/{total}`,showExplanation:`看解析`,makingPractice:`正在出题…`,makingQuiz:`正在出单元测验,题量按这个单元的知识点来定,可能要一两分钟…`,quizWriting:`已出 {count} 题`,newQuizSet:`换一套新题`,cardsTitle:`闪卡`,cardsDue:`待复习 {count} 张`,cardsTotal:`共 {count} 张`,flip:`点击翻面`,again:`忘了`,hard:`困难`,good:`记得`,easy:`简单`,cardsDone:`这一轮复习完成了!`,makingCards:`正在制作闪卡…`,makingUnitCards:`正在制作这个单元的闪卡,张数按知识点来定…`,cardsWriting:`已写好 {count} 张`,cardReview:`闪卡复习`,cardReviewDue:`闪卡复习 · {count} 张到期`,cardReviewNone:`闪卡复习 · 暂无到期`,cardReviewEmpty:`现在没有到期的闪卡。打开各单元的「单元闪卡」学新卡片。`,sheetTitle:`速查表`,columns:`列数`,fontSize:`字号`,highlight:`高亮重点`,print:`打印`,hideSection:`隐藏`,showSection:`显示`,makingSheet:`正在整理速查表…`,projectBrief:`项目说明`,milestones:`里程碑`,rubric:`评分标准`,openWorkspace:`打开项目工作区`,openingWorkspace:`正在准备项目文件夹…`,workspaceReady:`项目文件夹在:{path}`,workspaceSession:`已在 DSH 中打开项目会话`,workspaceManual:`在 DSH 里把这个文件夹添加为工作区,就能让编程 Agent 陪你完成项目。`,copyPath:`复制路径`,submitProject:`提交作品`,submitNotes:`写点说明(做了什么、遇到的问题)`,includeFiles:`同时提交项目文件夹里的文件`,reviewing:`老师在看你的作品…`,reviewTotal:`总分 {total}/{max}`,strengths:`做得好的地方`,nextSteps:`可以改进的地方`,submissions:`历次提交`,materialsTitle:`资料库`,materialsHint:`上传教材、讲义、论文或网页,用来建课、做速查表和闪卡,讲课时也会引用原文页码。`,uploadFiles:`上传文件`,dropHere:`把文件拖到这里(PDF、Word、PPT、Markdown、文本、图片)`,addUrl:`添加网页`,urlPlaceholder:`https://…`,reading:`正在读取…`,pages:`{count} 页`,slides:`{count} 张幻灯片`,makeCourse:`用它建课`,makeSheet:`速查表`,makeCards:`闪卡`,makeNotes:`笔记`,makeQuiz:`测验`,digest:`消化`,digestTitle:`文档消化`,overview:`概要`,structure:`结构`,keyIdeas:`核心观点`,arguments:`论点与论据`,glossary:`术语表`,discussion:`值得思考的问题`,imageNeedsVision:`图片需要支持识图的模型才能读取。`,readingPictures:`正在识别图片里的文字 {done}/{total}:{name}`,summarizingMaterial:`正在整理要点:{name}`,readScanPages:`已识别 {count} 页扫描页`,readPictures:`已识别 {count} 张图片里的字`,readPhoto:`已识别图中文字`,photoNoText:`图里没有读到文字`,readPartly:`有些内容没读到`,listJoin:`、`,unreadPages:`有 {count} 页没有文字层(扫描页或整页图片):当前模型看不了图,这些页没有读到。在开窍设置里换一个带 🖼 的模型,再重新上传。`,unreadPictures:`有 {count} 张图片里的字没有读到:当前模型看不了图。在开窍设置里换一个带 🖼 的模型,再重新上传。`,failedPages:`第 {list} 页没有识别出来`,failedSlides:`第 {list} 张幻灯片没有识别出来`,failedPictures:`第 {list} 张图片没有识别出来`,failedPhoto:`图里的字没有识别出来`,failedWhy:`{what}:{reason}`,failedRetry:`{what},重新上传可以再试。`,leftPages:`后面还有 {count} 页没有识别:一个文件最多识别 200 页,可以把文件拆开再上传。`,leftPictures:`后面还有 {count} 张图片没有识别:一个文件最多识别 200 张。`,noMaterials:`资料库是空的。`,studioTitle:`学习工具`,studioHint:`用资料库里的资料一键生成学习材料。`,pickMaterials:`选择资料`,sheets:`速查表`,notes:`笔记`,decks:`闪卡组`,quizzes:`测验`,focusPlaceholder:`重点(可选),比如:期中考试范围第 3–6 章`,assistTitle:`即时答疑`,assistHint:`不用建课,有问题直接问。老师会在白板上讲给你听。`,assistPlaceholder:`想问什么?可以贴题目、概念或附上资料`,followUp:`继续追问`,history:`历史记录`,newThread:`新的问题`,shortsTitle:`讲解短片`,shortsHint:`输入一个主题或贴一个网址,生成一段约两分钟、能分享的白板讲解。`,topicPlaceholder:`比如:为什么天空是蓝色的`,makeShort:`生成短片`,exportVideo:`导出视频`,exporting:`正在录制视频…{percent}%`,exportNeedsCloud:`浏览器语音无法录进视频,导出的视频会带字幕但没有声音。在设置里配置云端语音即可导出有声版。`,exportUnsupported:`当前环境不支持导出视频。`,planTitle:`学习计划`,planHint:`根据你所有在学的课程、每周时间和截止日期自动排课,并留出复习时间。`,studyDays:`学习日`,weekdays:`日,一,二,三,四,五,六`,exams:`考试与截止日期`,addExam:`添加`,examTitle:`名称`,examDay:`日期`,deadlineRisk:`「{course}」按现在的节奏会在 {finish} 学完,晚于截止日期 {deadline}。建议每周提高到约 {minutes} 分钟。`,startReview:`开始复习`,reviewDue:`有 {count} 个知识点该复习了`,nothingToReview:`暂时没有要复习的内容。`,savePlan:`保存`,lessonItem:`学习`,reviewItem:`复习`,examItem:`考试`,today:`今天`,profileTitle:`我的画像`,profileHint:`老师会记住这些信息,让每门课都更贴合你。你可以随时修改或清空。`,background:`背景`,goals:`目标`,strengthsLabel:`擅长`,weaknesses:`薄弱点`,learningStyle:`喜欢的讲解方式`,memoryNotes:`老师的备忘`,clearProfile:`清空画像`,clearProfileConfirm:`清空后老师会忘记你的背景和偏好。确定吗?`,onePerLine:`每行一条`,settingsTitle:`设置`,modelsTitle:`模型`,teachModel:`出课与讲课`,quickModel:`批改与问答`,followDefault:`跟随 DSH 默认模型`,modelsHint:`讲课质量主要取决于「出课与讲课」模型;批改和课堂提问可以用更快的模型。带 🖼 的模型能看图,扫描件、照片和图片里的字靠它识别。`,voiceTitle:`语音讲解`,engine:`语音来源`,engineBrowser:`系统语音(免费)`,engineCloud:`云端语音`,engineOff:`不朗读`,browserVoice:`系统音色`,autoVoice:`自动选择`,noVoiceForLanguage:`没有找到适合当前语言的系统音色。可以在系统设置里安装中文语音,或改用云端语音。`,cloudProvider:`云端服务`,providerOpenai:`OpenAI 兼容接口`,providerVolcengine:`火山引擎(豆包语音)`,providerMinimax:`MiniMax`,providerAzure:`Azure 语音`,field_baseUrl:`接口地址`,field_model:`模型`,field_voice:`音色`,field_appId:`App ID`,field_cluster:`Cluster`,field_groupId:`Group ID`,field_region:`区域`,field_apiKey:`密钥`,keySaved:`已保存密钥`,keyMissing:`未保存密钥`,saveKey:`保存密钥`,clearKey:`清除密钥`,testVoice:`试听`,testSentence:`你好,我是你的私人老师。我们一起把难的东西弄懂。`,voiceRate:`默认语速`,boardTheme:`白板外观`,themeAuto:`跟随系统`,themeLight:`白板`,themeDark:`黑板`,versionTitle:`插件版本`,versionCurrent:`当前版本`,versionLatest:`最新版本`,versionCheck:`检查更新`,versionChecking:`正在检查…`,versionFailed:`无法检查最新版本。`,versionUpToDate:`已是最新版本。`,versionAvailable:`发现新版本 v{version}。`,versionLinked:`当前是本地开发安装,请在插件仓库拉取最新代码并重新构建。`,versionManual:`没找到这个插件所在的 profile,请到 DSH 插件页按精确版本安装:dsh-aha-tutor@{version}。`,versionUpdate:`更新插件`,versionUpdating:`正在更新…`,versionUpdateFailed:`更新失败,请稍后重试,或到 DSH 插件页按精确版本手动安装。`,versionPending:`v{version} 刚发布不久,DSH 的 pnpm 要等过了发布冷却期才会安装,请稍后再试。`,versionPendingUntil:`v{version} 刚发布不久,DSH 的 pnpm 要等过了发布冷却期才会安装,{time} 之后可以更新。`,versionUpdated:`已更新到 v{version}。请完全退出并重新打开 DSH 桌面版,新版本才会生效(只刷新页面不够)。`,privacyNote:`课程、进度和资料都只保存在这台电脑的 DSH 数据目录里。`,aboutTitle:`关于作者`,aboutRole:`「开窍 · AI 私人老师」的作者`,aboutIntro:`开窍免费开源,赞赏全凭心意。如果它帮你弄懂了某个卡了很久的知识点,欢迎扫码支持,让小窍继续长大。`,aboutRepo:`GitHub 仓库`,aboutIssues:`问题反馈`,aboutSupport:`支持作者`,aboutWechat:`微信赞赏`,aboutAlipay:`支付宝`,aboutScan:`用手机扫一扫上面的码`,errorGeneric:`出了点问题:{message}`,crashPage:`这一页出了点问题,没能显示出来。`,crashPageHint:`可以重试一次,或者先回到首页。`,crashPart:`这部分内容出了点问题,没能显示出来。`,backHome:`回到首页`,loading:`加载中…`,empty:`这里还什么都没有。`,copied:`已复制`,minutes:`分钟`,untitled:`未命名`,delete:`删除`,edit:`编辑`,save:`保存`,all:`全部`,mode:`模式`,boardSession:`白板讲解`,toolBoardTitle:`老师在白板上讲解`,openBoard:`打开白板`,panelLabel:`开窍 · AI 私人老师`,copyCode:`复制`,footnotes:`脚注`,"err_llm-auth":`模型未登录或密钥无效,请在 DSH 设置里检查模型服务。`,"err_llm-quota":`模型额度不足或请求太频繁,稍后再试。`,"err_llm-context":`资料太长,超出了模型的上下文。少选一些资料,或换一个上下文更大的模型。`,"err_llm-unavailable":`所选模型不可用,请在开窍设置里换一个模型。`,"err_llm-timeout":`模型响应超时,请重试。`,"err_bad-output":`模型这次没给出可用的结果,请重试,或在设置里换一个更强的模型。`,boardView:`板书视图`,viewCanvas:`画布`,viewPages:`分页`,boardViewHint:`画布:整讲的板书从上到下排在一张画布上,可以拖动、缩放,讲课时自动跟着老师写的地方。分页:一次看一页,用右上角的页码翻页。`,canvasTools:`画布缩放`,canvasHelp:`拖动或滚动来移动,按住 Ctrl/⌘ 滚动或双指捏合来缩放,双击某一页放大到这一页`,canvasZoomIn:`放大`,canvasZoomOut:`缩小`,canvasZoomReset:`回到 100%(铺满宽度)`,canvasFit:`看全貌:缩小到能看到所有页`,canvasFitShort:`全貌`,canvasFollow:`回到老师这里`,canvasPage:`第 {n} 页`,voiceAsk:`说出问题`,voiceAskWith:`说出问题(麦克风:{name})`,voiceStop:`停止录音`,talkKeyHint:`快捷键:按住 V 说话,松开结束;也可以按一下 V 开始,说完再按一下。`,raiseHandKey:`暂停讲课,在提问框里提问。也可以直接按住 V 说出问题。`,voiceSetup:`语音提问需要先在 DSH 里启用「语音输入」`,voiceWorking:`识别中…`,voice_off:`语音提问用的是 DSH 的实验功能「语音输入」:在 DSH 的插件管理里启用「语音输入」,在它的详情里点「下载并准备」,准备好后再点这里。`,voice_unprepared:`语音识别模型还没准备好:在 DSH 插件管理的「语音输入」详情里点「下载并准备」(约 240 MB),准备好后再点这里。`,voice_preparing:`语音识别模型正在准备,好了以后再点这里。进度在 DSH 插件管理的「语音输入」详情里。`,voice_failed:`语音识别模型没有准备成功:到 DSH 插件管理的「语音输入」详情里重试。`,"err_speech-off":`DSH 的「语音输入」没有启用:在 DSH 的插件管理里启用它并下载准备模型。`,"err_speech-unprepared":`语音识别模型还没准备好:在 DSH 插件管理的「语音输入」详情里点「下载并准备」。`,"err_speech-audio":`这段录音没法读取,请再录一次。`,"err_speech-too-long":`录音太长了,一次最多 2 分钟。`,"err_speech-failed":`语音识别出错了,请再试一次。`,"err_speech-empty":`没听到说话,请离麦克风近一点再说一次。`,"err_mic-denied":`没有麦克风权限:请在浏览器或系统设置里允许 DSH 使用麦克风。`,"err_mic-missing":`没有找到麦克风。`,"err_mic-chosen-missing":`DSH「语音输入」里选的麦克风现在用不了:插上它,或到 DSH 插件管理的「语音输入」详情里换一个。`,micChosenMissing:`DSH「语音输入」里选的麦克风「{name}」现在用不了:插上它,或到 DSH 插件管理的「语音输入」详情里换一个。`,"err_mic-busy":`麦克风正被别的程序占用。`,"err_mic-unsupported":`这里没法录音。`,prepThinking:`构思`,prepWriting:`写板书`,prepStarting:`正在联系模型…`,prepThinkingDetail:`老师在想这一讲怎么讲,已构思 {chars} 字`,prepStep:`正在写第 {n} 步`,prepCounts:`已写好 {steps} 步 · 共 {chars} 字`,prepSeconds:`已用 {seconds} 秒`,dayLabel:`{month} 月 {day} 日 · 周{weekday}`,exportPdf:`PDF 文档(一页一张板书)`,exportPng:`PNG 图片(每页一张)`,exportMarkdown:`Markdown 文本`,exportingBoard:`正在导出板书…{done}/{total}`,animationStill:`动画(在课堂里播放)`,monthLabel:`{year} 年 {month} 月`,prevMonth:`上个月`,nextMonth:`下个月`,markDone:`标记为已完成`,unmarkDone:`取消完成`,checkedAuto:`已在课程里完成`,dayEmpty:`这天没有安排。`,webResearch:`联网查资料`,webResearchHint:`建课前先用 DSH 的网页搜索查一查这个主题,出题和设计课程时参考`,researching:`正在联网查资料…`,researchFound:`参考了 {count} 个网上来源`,researchSkipped:`未联网检索:{reason}`,"researchSkipped_no-credential":`DSH 还没有配置 DeepSeek 密钥,网页搜索要用它`,researchSkipped_unavailable:`这个 DSH 没有可用的网页搜索`,researchSkipped_failed:`搜索出错了`,researchSkipped_empty:`没有搜到合适的资料`,courseSources:`参考来源`,buildResearch:`参考 {count} 个网上来源`,"err_llm-empty":`模型这次没有返回内容,请重试。如果一直这样,可以在开窍设置里换一个模型。`,"err_llm-failed":`调用模型出错了,请稍后重试。`,nextStepTitle:`下一步`,nextStepReview:`有 {count} 个知识点到了复习的时候`,nextStepWeak:`「{concept}」还比较薄弱,先练一练`,nextStepLesson:`接着学「{title}」`,nextStepDone:`这门课都学完了,做一次单元测验检验一下吧`,practiceThis:`练习这一讲`,streakCount:`连对 {count}`,keysHint:`键盘:1–4 选择 · Enter 提交或继续 · H 看提示`,starsLabel:`{count} 颗星`,accuracy:`正确率`,bestStreak:`最长连对`,masteryChange:`这一轮之后的掌握程度`,stageNone:`未开始`,stageWeak:`薄弱`,stageLearning:`学习中`,stageProficient:`熟练`,stageMastered:`掌握`,nextRelearn:`有几个点还没吃透,回到这一讲再听一遍会更稳。`,nextReview:`基本会了,但还不够牢,复习一轮会记得更久。`,nextQuiz:`掌握得很扎实,可以挑战单元测验了。`,nextLessonStep:`可以继续往下学了。`,nextCourse:`这一部分练完了。`,relearnLesson:`回到这一讲`,reviewCourse:`复习这门课`,editOutline:`编辑课程大纲`,saveAndBack:`保存并返回`,extendCourse:`让老师续写一个单元`,extendInstruction:`在课程最后再加一个单元:承接已有内容,往前推进一步,保持同样的难度梯度;已有的单元保持不变。`,proposalTitle:`老师的修改建议`,proposalNoChange:`这次修改没有改动任何一讲。`,applyProposal:`应用修改`,discardProposal:`放弃`,proposalApplied:`已应用修改`,diffAdded:`新增`,diffRemoved:`删除`,diffRenamed:`改名`,diffChanged:`调整`,diffUnit:`单元「{title}」`,reworkLesson:`让老师改这一讲`,splitLesson:`拆成两讲`,deepenLesson:`讲深一些`,splitDone:`已拆成两讲,记得保存`,deepenDone:`已改得更深,记得保存`,confirmRemoveUnit:`删除单元「{title}」和其中所有的课?`,confirmRemoveLecture:`删除「{title}」和其中所有的课?`,confirmRemoveStarted:`「{title}」已经开始学了,删除后这一讲的板书和进度都不再显示。确定删除?`,craftSize:`课程规模`,sizeAuto:`让老师决定`,sizeAutoHint:`按你的目标定,一个小问题可能只要一两讲`,sizeShort:`精简`,sizeShortHint:`3–8 讲,抓住最关键的部分`,sizeStandard:`标准`,sizeStandardHint:`10–20 讲,基础、练习加一个应用项目`,sizeFull:`完整`,sizeFullHint:`25–45 讲,系统深入,留出拓展的空间`,buildAnswers:`整理你的回答`,buildMaterials:`阅读你的资料`,buildUnits:`规划单元`,buildLessons:`写每一讲`,buildLessonsSoFar:`写每一讲:已写好 {count} 讲`,workPlaceholder:`一步一行写出你的过程,公式写在 $…$ 里,例如 $x^2+6x+9=(x+3)^2$`,workPreview:`公式预览`,wrongStep:`出错的一步`,fixedStep:`应该写成`,correction:`订正`,correctionOf:`订正:{tag}`,correcting:`老师在板上订正…`,seeCorrection:`看老师订正`,handout:`讲义`,handoutHint:`把这一讲整理成一页可打印的讲义`,handoutOfLesson:`本讲讲义`,handoutMaking:`老师在把这一讲整理成讲义…`,handoutPoints:`要点`,handoutExample:`例题`,handoutMistakes:`常见错误`,handoutGlossary:`术语表`,handoutQuestions:`自测`,handoutAnswer:`答案`,backToLesson:`回到这一讲`,addMaterials:`补充资料`,addMaterialsTitle:`给这门课补充资料`,addMaterialsHint:`选几份资料(也可以现在上传),老师会看看它们讲了什么,给出怎么改大纲的建议;你应用之后才生效,学过的讲保留进度,以后讲课也会引用这些资料。`,addMaterialsPlaceholder:`想让老师怎么用这些资料(可以不填),比如:重点补上第 5 章的例题`,addMaterialsSend:`请老师看看怎么加`,changeMaterials:`改选资料`,proposalMaterials:`补充资料:{titles}`,librarySearch:`找资料:输入标题或主题即时筛选,回车在正文里搜`,librarySearchText:`搜正文`,libraryFound:`正文里找到 {count} 处`,libraryNotFound:`正文里没找到「{query}」`,libraryNoTitleMatch:`没有标题或主题对得上的资料,按回车可以在正文里搜。`,pageN:`第 {page} 页`,slideN:`第 {slide} 张`,tourLabel:`课堂导览`,tourReplay:`课堂导览`,tourSkip:`跳过`,tourBack:`上一步`,tourNext:`下一步`,tourStart:`开始上课`,tourBoardTitle:`老师在这块黑板上讲`,tourBoard:`老师边讲边写。拖动或滚动可以移动板书,按住 Ctrl(Mac 上是 ⌘)滚动可以缩放,右上角的「全貌」能看到整讲。`,tourControlsTitle:`播放和节奏`,tourControls:`播放、暂停、上一步、下一步和语速都在这里,按空格也能暂停;字幕和声音可以随时开关。`,tourRaiseTitle:`有问题就举手`,tourRaise:`点「举手提问」,或者直接在提问框里写。也可以说出来:点麦克风,或者按住 V 键说话,松开后问题就进了提问框。老师答完会接着讲。`,tourReexplainTitle:`这一步没听懂`,tourReexplain:`点「换个讲法」,让老师打个比方、画图、举个例子,或者讲简单点、讲深一点。`,tourChallengeTitle:`觉得讲错了`,tourChallenge:`点「这一步不对?」,老师会先仔细核对;真错了会当场改正,并把这一讲一起改好。`,tourPanelTitle:`课堂要点和讲解记录`,tourPanel:`这里能看到这一讲的要点讲到了哪儿;老师说过的话都在讲解记录里,点一条就回到那里。`,outlineView:`大纲的显示方式`,viewList:`列表`,viewMap:`导图`,mapTools:`导图工具`,mapFollow:`回到最新`,mapPick:`到列表里编辑这一讲`,depthTitle:`这一讲的讲法`,depthNone:`不限`,depth_intuition:`直观理解`,depth_definition:`定义概念`,depth_derivation:`推导证明`,depth_application:`动手应用`,depth_extension:`深入拓展`,profileName:`怎么称呼你`,profileNameHint:`老师开课时会这样叫你一次,可以不填`,profileNamePlaceholder:`比如:小明`,challenge:`这一步不对?`,challengeLabel:`这一步不对?`,challengeTitle:`这一步哪里不对?(可以不填)`,challengeTitleStep:`第 {n} 步哪里不对?(可以不填)「{text}」`,challengePlaceholder:`比如:5 cm 是不是应该换成 0.05 m?`,challengeHint:`老师会先仔细算一遍,要等十几秒到半分钟。`,challengeSend:`请老师核对`,challengeLine:`不对?`,challengeStep:`第 {n} 步不对?`,checkingStep:`老师在仔细核对这一步…`,challenge_wrong:`确实有错,已更正`,challenge_right:`核对过,没有错`,challenge_unclear:`要看约定`,fixed:`已更正`,fixedWas:`原来写的是:{was}`,itemChallenge:`这题有问题?`,itemChallengeTitle:`这题哪里不对?(可以不填)`,itemChallengePlaceholder:`比如:我觉得 B 也对;或者:答案的单位是不是错了?`,itemChallengeHint:`老师会先仔细算一遍,要等几秒到半分钟,你可以先做下一题。`,itemChecking:`老师在仔细核对这道题…`,itemCheckTitle:`老师核对`,itemCheck_wrong:`确实有错,已更正`,itemCheck_unclear:`题目没说清楚,已补充`,itemCheck_misgraded:`判分有误,已重新判`,itemCheck_right:`核对过,没有错`,regraded:`(重新判过)`,itemCheckDone:`第 {n} 题核对完了:{verdict}。`,itemCheckRegraded:`已按核对结果重新判分。`,itemCheckEarlier:`这道题你之前还答过 {count} 次,也按改好的题重新判了。`,itemCheckFailedNotice:`第 {n} 题没核对成功:{message}`,fixedWasItem:`原来写的:`,fixedPart_prompt:`题目:{text}`,fixedPart_option:`选项 {id}:{text}`,fixedPart_answer:`答案:{text}`,fixedPart_unit:`单位:{text}`,fixedPart_tolerance:`允许误差:{text}`,fixedPart_explanation:`解析:{text}`,fixedPart_hints:`提示:{text}`,fixedPart_rubric:`评分要点:{text}`,fixedPart_figure:`图也重画了`,lessonGoals:`课堂要点`,transcript:`讲解记录`,showPanel:`讲解记录`,hidePanel:`收起侧栏`,panelTitle:`课堂侧栏`,boardFont:`板书字体`,fontHand:`手写体`,fontStandard:`标准体`,textSize:`文字大小`,textStandard:`标准`,textLarge:`大`,textLarger:`特大`,textSizeHint:`开窍里的文字一起变大,马上生效。板书和思维导图用它们自己的缩放按钮;DSH「设置 → 通用设置 → 字号大小」也会让这里的文字跟着变。`,digestMissing:`有 {count} 部分没读成功({parts}),下面的结果不含这些内容。`,redigest:`重新消化`,revisingSoFar:`正在修改…已写好 {count} 节课`,"err_bad-url":`这个网址不能导入:只支持公开网站的 http 或 https 地址,不支持本机、局域网和带账号密码的地址。`,err_network:`网页打不开或加载超时,请检查网址后重试。`,err_http:`网页返回了错误,没能导入。`,blueprintSoFar:`正在设计课程蓝图…已写好 {count} 节课`,reexplainedAs:`换个讲法:{style}`,digestReading:`正在通读全文:已读 {done}/{total} 部分`,digestWriting:`正在汇总全文要点`,keepsRunning:`可以先离开这一页,生成会在后台继续。`,err_cancelled:`已取消。`,courseCreatedInChat:`课程「{title}」已创建,可以在「开窍」里继续。`,err_failed:`出了点问题,请稍后再试。`,err_invalid:`这个请求没法处理。请刷新页面后再试;如果还是这样,请退出并重新打开 DSH。`,"err_not-found":`找不到这项内容,它可能已经被删除了。`,err_forbidden:`没有权限做这件事。`,"err_unknown-endpoint":`插件刚更新过,请退出并重新打开 DSH 后再试。`,err_aborted:`上传中断了,请重试。`,err_connection:`连不上 DSH,请确认它还开着,然后重试。`,err_missing:`这项任务找不到了,可能是 DSH 重启过,请重试。`,"err_llm-missing":`还没有可用的模型,请先在 DSH 设置里配置一个模型服务。`,"err_no-board":`板书还没写好,等第一步出来再试。`,"err_empty-question":`先写下你的问题。`,"err_empty-goal":`先说说你想学什么,或者添加一份资料。`,"err_empty-change":`先写下你想怎么改。`,"err_no-blueprint":`还没有课程蓝图,请先生成蓝图。`,"err_no-proposal":`没有待确认的修改,它可能已经应用或放弃了。`,"err_bad-pack":`这个文件不是能导入的课程包。`,"err_pack-too-large":`这个课程包太大了,导入不了。`,"err_pack-too-new":`这个课程包是新版开窍导出的,请先更新插件再导入。`,"err_nothing-to-review":`还没有可以评阅的内容:先写几句说明,或在项目文件夹里做些修改。`,"err_cannot-tick":`只能勾选今天或之前的学习项。`,"err_exam-incomplete":`考试需要填写名称和日期。`,"err_no-material":`先选至少一份资料。`,"err_material-no-text":`所选资料里没有可读的文字,图片和扫描版 PDF 读不出文字。`,"err_empty-topic":`先写下一个主题,或者填一个网址。`,"err_no-credentials":`这个 DSH 配置里用不了凭据存储,没法保存密钥。`,"err_bad-key":`密钥格式不对:应为 8–1024 个英文字母、数字或符号,不能有空格。`,err_unsupported:`不支持这种文件。可以上传 PDF、Word、PowerPoint、图片,或 .md、.txt、.csv 这类文本文件。`,"err_old-office":`不支持旧版 .doc/.ppt 文件,请另存为 .docx/.pptx 后再上传。`,err_encrypted:`这个 PDF 有密码保护,请先去掉密码再上传。`,err_unreadable:`这个文件读不出来,可能已经损坏,可以重新导出一份再试。`,"err_no-text":`这个文件里没有读到文字。`,"err_scan-needs-vision":`这是扫描版,没有能直接读取的文字。要识别里面的字,请在开窍设置里选一个带 🖼(能看图)的模型,比如 DeepSeek-V4.1-Flash,再重新上传。`,"err_pictures-need-vision":`这个文件里的内容都是图片。要识别图里的字,请在开窍设置里选一个带 🖼(能看图)的模型,比如 DeepSeek-V4.1-Flash,再重新上传。`,"err_llm-no-vision":`当前模型看不了图片。请在开窍设置里换一个带 🖼 的模型。`,"err_image-unusable":`这张图片没能交给模型。`,err_empty:`这个文件是空的。`,"err_too-large":`文件超过 200 MB,太大了,可以拆成几份再上传。`,"err_image-too-large":`图片要小于 10 MB。`,"err_page-too-large":`这个网页太大了,导入不了。`,"err_page-no-text":`这个网页上没有读到正文。`,"err_tts-address":`语音服务地址不对:要填完整的 https 网址(只有本机地址可以用 http),不能带账号密码。`,"err_tts-app-id":`火山引擎语音需要填写 App ID。`,"err_tts-azure":`Azure 的区域或音色名称不对,请照 Azure 门户里的写法填写。`,"err_tts-config":`语音服务的设置不完整,请在设置里检查。`,"err_tts-network":`连不上语音服务,请检查网络和服务地址。`,"err_tts-stalled":`语音服务一直没有回应,请检查服务是否在运行、地址是否正确。`,"err_tts-timeout":`语音服务响应超时,请稍后再试。`,"err_tts-too-large":`语音服务返回的音频太大了。`,"err_tts-auth":`语音服务拒绝了密钥,请检查密钥是否正确。`,"err_tts-no-key":`还没有保存这个语音服务的密钥,请先在设置里填写。`,"err_tts-rate-limit":`语音服务请求太频繁,请稍后再试。`,"err_tts-server":`语音服务出错了,请稍后再试。`,"err_tts-request":`语音服务拒绝了这次请求,请检查音色等设置。`,"err_tts-empty":`没有要朗读的文字。`,"err_tts-response":`语音服务没有返回可用的音频,请稍后再试,或换一个音色。`,"err_tts-failed":`语音合成失败了,请稍后再试。`,"err_no-materials":`先选至少一份资料。`,"err_materials-known":`这些资料已经是这门课的了。`,"err_materials-full":`一门课最多关联 12 份资料,这门课已经满了。`,err_speech:`朗读没有成功,可以换一个系统音色,或者改用云端语音。`,"err_speech-stalled":`系统语音卡住了,没有出声。`,err_playback:`音频没能播放,请再试一次。`,exportFailed:`导出没有成功,请再试一次。`},Hp={appName:`Aha`,appTagline:`your AI tutor`,navHome:`Home`,navCourses:`My courses`,navMaterials:`Library`,navStudio:`Study tools`,navAssist:`Ask anything`,navShorts:`Explainer shorts`,navPlan:`Study plan`,navProfile:`My profile`,navSettings:`Settings`,navAbout:`About the author`,navFold:`Collapse`,navUnfold:`Expand`,heroTitle:`What do you want to finally understand today?`,heroHint:`Tell me what you want to learn, or drop in a textbook. I will get to know you, build a course around you, and teach it step by step on the whiteboard.`,heroPlaceholder:`e.g. Get eigenvalues in three weeks | Turn these lecture notes into a course | How does quantum tunneling actually work?`,modeCourse:`Build a course`,modeExplain:`Explain a concept`,modeSolve:`Solve with me`,modeVisualize:`Show me visually`,modeDigest:`Digest a long read`,modeShort:`Two-minute short`,attach:`Add material`,attached:`{count} material(s) attached`,start:`Start`,quickStart:`Skip questions, build now`,continueLearning:`Continue learning`,todayPlan:`Today`,noPlanToday:`Nothing planned today. Start a course or take a break.`,recentWork:`Recent`,sampleCourses:`Sample courses`,sampleHint:`Try the whiteboard classroom without spending tokens.`,importSample:`Add to my courses`,coursesTitle:`My courses`,filterAll:`All`,filterActive:`In progress`,filterDone:`Completed`,filterArchived:`Archived`,searchCourses:`Search courses`,noCourses:`No courses yet. Go to Home and tell me what you want to learn.`,importPack:`Import course pack`,lessonsCount:`{done}/{total} lessons`,minutesLeft:`about {minutes} min left`,statusIntake:`Questions pending`,statusBlueprint:`Blueprint to confirm`,statusReady:`Ready`,nextUp:`Next: {title}`,craftQuestionsTitle:`Let me get to know you`,craftQuestionsHint:`A few answers let me shape the course around you. Skip anything you are unsure about.`,craftOther:`Other (write your own)`,craftPace:`Pace`,paceIntensive:`Sprint`,paceIntensiveHint:`~6 weeks, essentials first`,paceBalanced:`Steady`,paceBalancedHint:`~3 months, foundations + practice + project`,paceRelaxed:`No deadline`,paceRelaxedHint:`Take your time, go deeper`,weeklyMinutes:`Time per week`,minutesUnit:`{minutes} min`,deadline:`Deadline (optional)`,makeBlueprint:`Design my course`,thinkingQuestions:`Thinking about what to ask you…`,designingBlueprint:`Designing your course blueprint…`,blueprintTitle:`Course blueprint`,blueprintHint:`Here is the course I designed for you. Edit titles, remove or reorder anything, or tell me what to change.`,reviseLabel:`Change it in one sentence`,revisePlaceholder:`e.g. More hands-on coding; make unit 2 lighter; drop lesson 3`,revise:`Revise`,revising:`Revising…`,addLesson:`Add lesson`,addLecture:`Add chapter`,addUnit:`Add unit`,moveUp:`Move up`,moveDown:`Move down`,remove:`Remove`,projects:`Projects`,confirmCourse:`Confirm and build the course`,confirming:`Preparing practice and projects… {done}/{total}`,courseReady:`Your course is ready`,unitN:`Unit {n}`,lectureN:`Chapter {n}`,estMinutes:`{minutes} min`,saveEdits:`Save changes`,saved:`Saved`,tabOutline:`Outline`,tabPractice:`Practice, quizzes & flashcards`,tabSheets:`Cheat sheets`,tabProjects:`Projects`,tabProgress:`Progress`,learn:`Learn`,practice:`Practice`,review:`Review`,remedial:`Revisit`,exportPack:`Export course pack`,exportWithProgress:`Include my progress`,rename:`Rename`,archive:`Archive`,unarchive:`Unarchive`,deleteCourse:`Delete course`,deleteConfirm:`This cannot be undone. Delete "{title}"?`,cancel:`Cancel`,confirm:`Confirm`,close:`Close`,back:`Back`,retry:`Retry`,generate:`Generate`,regenerate:`Regenerate`,generating:`Generating…`,open:`Open`,unitQuiz:`Unit quiz`,unitSheet:`Unit cheat sheet`,unitCards:`Unit flashcards`,unitCardsDue:`Unit flashcards · {count}`,unitCardsDueTitle:`{count} due`,mastery:`Mastery`,conceptMastery:`Concept mastery`,preparingLesson:`Your tutor is preparing the lesson…`,bufferingLesson:`Writing the next part…`,play:`Play`,pause:`Pause`,prevStep:`Previous step`,nextStep:`Next step`,speed:`Speed`,voiceOn:`Sound on`,voiceOff:`Muted`,voiceDownCloud:`The cloud voice is not working: {reason} This lesson goes on without sound.`,voiceDownSystem:`The system voice is not working: {reason} This lesson goes on without sound.`,openSettings:`Settings`,captions:`Captions`,raiseHand:`Raise hand`,askPlaceholder:`What was unclear? Just ask`,ask:`Ask`,answering:`Thinking about your question…`,reexplain:`Explain differently`,styleAnalogy:`With an analogy`,styleVisual:`With a drawing`,styleExample:`With an example`,styleSimpler:`More simply`,styleDeeper:`In more depth`,stepOf:`Step {current}/{total}`,checkTitle:`Quick check`,confidence:`How sure are you?`,pickSeveral:`Select all that apply.`,confSure:`Sure`,confUnsure:`Not quite`,confGuess:`Guessing`,submit:`Submit`,correct:`Correct`,incorrect:`Not quite`,partial:`Partly right`,continue:`Continue`,skip:`Skip`,hint:`Hint`,yourAnswer:`Your answer`,grading:`Grading…`,lessonDone:`Lesson complete`,selfRate:`How well do you feel you got it?`,rate1:`Lost`,rate3:`Okay`,rate5:`Crystal clear`,nextLesson:`Next lesson`,doPractice:`Practice`,backToCourse:`Back to course`,remedialAdded:`I added a revisit lesson for you: {title}`,challengeNote:`You have this down; the next lessons will go deeper.`,replay:`Replay lesson`,regenerateLesson:`Re-prepare lesson`,exportBoard:`Export board`,practiceTitle:`Practice`,check:`Check`,checked:`Checked`,score:`Score {score}`,practiceDone:`Set complete: {correct}/{total} correct`,showExplanation:`Explanation`,makingPractice:`Writing practice…`,makingQuiz:`Writing the unit quiz. Its length follows the unit's concepts, so this can take a minute or two…`,quizWriting:`{count} questions written`,newQuizSet:`New set of questions`,cardsTitle:`Flashcards`,cardsDue:`{count} due`,cardsTotal:`{count} in all`,flip:`Click to flip`,again:`Again`,hard:`Hard`,good:`Good`,easy:`Easy`,cardsDone:`Review round complete!`,makingCards:`Making flashcards…`,makingUnitCards:`Making this unit's flashcards; their number follows its concepts…`,cardsWriting:`{count} cards written`,cardReview:`Flashcard review`,cardReviewDue:`Flashcard review · {count} due`,cardReviewNone:`Flashcard review · none due`,cardReviewEmpty:`No flashcards are due. Open a unit's flashcards to learn new ones.`,sheetTitle:`Cheat sheet`,columns:`Columns`,fontSize:`Font size`,highlight:`Highlight key items`,print:`Print`,hideSection:`Hide`,showSection:`Show`,makingSheet:`Compiling the cheat sheet…`,projectBrief:`Brief`,milestones:`Milestones`,rubric:`Rubric`,openWorkspace:`Open project workspace`,openingWorkspace:`Preparing the project folder…`,workspaceReady:`Project folder: {path}`,workspaceSession:`Opened a project session in DSH`,workspaceManual:`Add this folder as a workspace in DSH and a coding agent can help you build it.`,copyPath:`Copy path`,submitProject:`Submit work`,submitNotes:`Notes (what you built, what was hard)`,includeFiles:`Include the files in the project folder`,reviewing:`Reviewing your work…`,reviewTotal:`Total {total}/{max}`,strengths:`What went well`,nextSteps:`What to improve`,submissions:`Submissions`,materialsTitle:`Library`,materialsHint:`Upload textbooks, notes, papers or web pages to build courses, cheat sheets and flashcards. Lessons cite their pages.`,uploadFiles:`Upload files`,dropHere:`Drop files here (PDF, Word, PowerPoint, Markdown, text, images)`,addUrl:`Add web page`,urlPlaceholder:`https://…`,reading:`Reading…`,pages:`{count} pages`,slides:`{count} slides`,makeCourse:`Build a course`,makeSheet:`Cheat sheet`,makeCards:`Flashcards`,makeNotes:`Notes`,makeQuiz:`Quiz`,digest:`Digest`,digestTitle:`Digest`,overview:`Overview`,structure:`Structure`,keyIdeas:`Key ideas`,arguments:`Claims and evidence`,glossary:`Glossary`,discussion:`Questions worth asking`,imageNeedsVision:`Images need a vision-capable model.`,readingPictures:`Reading the text in pictures {done}/{total}: {name}`,summarizingMaterial:`Summing up {name}`,readScanPages:`{count} scanned pages read`,readPictures:`Text read from {count} pictures`,readPhoto:`Text in the picture read`,photoNoText:`No text found in the picture`,readPartly:`Some parts were not read`,listJoin:`, `,unreadPages:`{count} pages have no text layer (scans or full-page pictures), and the current model cannot see images, so they were not read. Pick a model marked 🖼 in Aha settings and upload the file again.`,unreadPictures:`The text in {count} pictures was not read: the current model cannot see images. Pick a model marked 🖼 in Aha settings and upload the file again.`,failedPages:`Page {list} could not be read`,failedSlides:`Slide {list} could not be read`,failedPictures:`Picture {list} could not be read`,failedPhoto:`The text in this picture could not be read`,failedWhy:`{what}: {reason}`,failedRetry:`{what}. Uploading it again may help.`,leftPages:`{count} more pages were not read: at most 200 pages of a file are read. Split the file and upload the parts.`,leftPictures:`{count} more pictures were not read: at most 200 pictures of a file are read.`,noMaterials:`Your library is empty.`,studioTitle:`Study tools`,studioHint:`Turn library materials into study aids in one click.`,pickMaterials:`Pick materials`,sheets:`Cheat sheets`,notes:`Notes`,decks:`Flashcard decks`,quizzes:`Quizzes`,focusPlaceholder:`Focus (optional), e.g. midterm scope chapters 3–6`,assistTitle:`Ask anything`,assistHint:`No course needed. Ask, and your tutor explains it on the whiteboard.`,assistPlaceholder:`What do you want to know? Paste a problem, a concept, or attach material`,followUp:`Follow up`,history:`History`,newThread:`New question`,shortsTitle:`Explainer shorts`,shortsHint:`Give a topic or a link and get a shareable two-minute whiteboard explainer.`,topicPlaceholder:`e.g. Why is the sky blue?`,makeShort:`Make short`,exportVideo:`Export video`,exporting:`Recording video… {percent}%`,exportNeedsCloud:`System voices cannot be recorded, so the video will have captions but no sound. Set up a cloud voice in Settings to export with narration.`,exportUnsupported:`Video export is not supported here.`,planTitle:`Study plan`,planHint:`Built from all your active courses, your weekly time and deadlines, with room for reviews.`,studyDays:`Study days`,weekdays:`Sun,Mon,Tue,Wed,Thu,Fri,Sat`,exams:`Exams and deadlines`,addExam:`Add`,examTitle:`Title`,examDay:`Date`,deadlineRisk:`At this pace "{course}" ends on {finish}, after its deadline {deadline}. Try about {minutes} minutes a week.`,startReview:`Start review`,reviewDue:`{count} concept(s) due for review`,nothingToReview:`Nothing to review right now.`,savePlan:`Save`,lessonItem:`Lesson`,reviewItem:`Review`,examItem:`Exam`,today:`Today`,profileTitle:`My profile`,profileHint:`Your tutor remembers this to fit every course to you. Edit or clear it anytime.`,background:`Background`,goals:`Goals`,strengthsLabel:`Strengths`,weaknesses:`Weak spots`,learningStyle:`How I like things explained`,memoryNotes:`Tutor notes`,clearProfile:`Clear profile`,clearProfileConfirm:`Your tutor will forget your background and preferences. Continue?`,onePerLine:`One per line`,settingsTitle:`Settings`,modelsTitle:`Models`,teachModel:`Course design & teaching`,quickModel:`Grading & questions`,followDefault:`Follow the DSH default model`,modelsHint:`Lesson quality depends mostly on the teaching model; grading and in-class questions can use a faster one. Models marked 🖼 can see images: they read the text in scans, photos and pictures.`,voiceTitle:`Narration`,engine:`Voice source`,engineBrowser:`System voice (free)`,engineCloud:`Cloud voice`,engineOff:`Silent`,browserVoice:`System voice`,autoVoice:`Automatic`,noVoiceForLanguage:`No system voice found for this language. Install one in your OS settings or use a cloud voice.`,cloudProvider:`Cloud service`,providerOpenai:`OpenAI-compatible API`,providerVolcengine:`Volcengine (Doubao)`,providerMinimax:`MiniMax`,providerAzure:`Azure Speech`,field_baseUrl:`API address`,field_model:`Model`,field_voice:`Voice`,field_appId:`App ID`,field_cluster:`Cluster`,field_groupId:`Group ID`,field_region:`Region`,field_apiKey:`Key`,keySaved:`Key saved`,keyMissing:`No key saved`,saveKey:`Save key`,clearKey:`Remove key`,testVoice:`Test`,testSentence:`Hi, I am your tutor. Let us make the hard things make sense.`,voiceRate:`Default speed`,boardTheme:`Board look`,themeAuto:`Follow system`,themeLight:`Whiteboard`,themeDark:`Chalkboard`,versionTitle:`Plugin version`,versionCurrent:`Current`,versionLatest:`Latest`,versionCheck:`Check for updates`,versionChecking:`Checking…`,versionFailed:`Could not check the latest version.`,versionUpToDate:`You are on the latest version.`,versionAvailable:`Version v{version} is available.`,versionLinked:`Installed from a local checkout; pull and rebuild the plugin repository to update.`,versionManual:`Could not find the profile that owns this plugin. Install the exact version from the DSH Plugins page: dsh-aha-tutor@{version}.`,versionUpdate:`Update plugin`,versionUpdating:`Updating…`,versionUpdateFailed:`The update failed. Try again later, or install the exact version from the DSH Plugins page.`,versionPending:`v{version} was published recently; DSH’s pnpm installs it once its release cooldown passes. Try again later.`,versionPendingUntil:`v{version} was published recently; DSH’s pnpm installs it once its release cooldown passes, after {time}.`,versionUpdated:`Updated to v{version}. Quit and reopen the DSH desktop app for it to take effect (refreshing the page is not enough).`,privacyNote:`Courses, progress and materials are stored only in DSH’s data folder on this computer.`,aboutTitle:`About the author`,aboutRole:`Author of Aha Tutor (开窍)`,aboutIntro:`Aha Tutor is free and open source, and tips are entirely optional. If it helped something finally click for you, a tip keeps Qiao growing.`,aboutRepo:`GitHub repository`,aboutIssues:`Report a problem`,aboutSupport:`Support the author`,aboutWechat:`WeChat`,aboutAlipay:`Alipay`,aboutScan:`Scan a code with your phone`,errorGeneric:`Something went wrong: {message}`,crashPage:`This page ran into a problem and could not be shown.`,crashPageHint:`Try again, or go back to the home page.`,crashPart:`This part ran into a problem and could not be shown.`,backHome:`Back to home`,loading:`Loading…`,empty:`Nothing here yet.`,copied:`Copied`,minutes:`min`,untitled:`Untitled`,delete:`Delete`,edit:`Edit`,save:`Save`,all:`All`,mode:`Mode`,boardSession:`Whiteboard`,toolBoardTitle:`Explaining on the whiteboard`,openBoard:`Open whiteboard`,panelLabel:`Aha · AI tutor`,copyCode:`Copy`,footnotes:`Footnotes`,"err_llm-auth":`The model is not signed in or its key is invalid. Check the model provider in DSH settings.`,"err_llm-quota":`The model quota is used up or requests are too frequent. Try again later.`,"err_llm-context":`The material is too long for this model. Pick fewer materials or a model with a larger context.`,"err_llm-unavailable":`The selected model is not available. Pick another one in Aha settings.`,"err_llm-timeout":`The model took too long. Try again.`,"err_bad-output":`The model did not return a usable result this time. Try again or pick a stronger model in settings.`,boardView:`Board view`,viewCanvas:`Canvas`,viewPages:`Pages`,boardViewHint:`Canvas: the whole lesson’s pages, top to bottom on one canvas you can drag and zoom, following the teacher’s writing during the lesson. Pages: one page at a time, turned with the page numbers at the top right.`,canvasTools:`Canvas zoom`,canvasHelp:`Drag or scroll to move, hold Ctrl/⌘ and scroll or pinch to zoom, double-click a page to fit it`,canvasZoomIn:`Zoom in`,canvasZoomOut:`Zoom out`,canvasZoomReset:`Back to 100% (full width)`,canvasFit:`Show everything: zoom out to see every page`,canvasFitShort:`All`,canvasFollow:`Back to the teacher`,canvasPage:`Page {n}`,voiceAsk:`Ask by voice`,voiceAskWith:`Ask by voice (microphone: {name})`,voiceStop:`Stop recording`,talkKeyHint:`Shortcut: hold V while you speak and let go to finish, or tap V, speak, and tap it again.`,raiseHandKey:`Pause the lesson and ask in the question box. You can also hold V and say it.`,voiceSetup:`Voice questions need Voice input enabled in DSH`,voiceWorking:`Recognizing…`,voice_off:`Voice questions use DSH’s experimental Voice input: enable Voice input in DSH’s Plugins page, choose Download and prepare in its details, then click here again.`,voice_unprepared:`The speech recognizer is not set up yet: choose Download and prepare in Voice input’s details on DSH’s Plugins page (about 240 MB), then click here again.`,voice_preparing:`The speech recognizer is being set up; click here again when it is ready. Voice input’s details on DSH’s Plugins page show the progress.`,voice_failed:`Setting up the speech recognizer failed: retry it in Voice input’s details on DSH’s Plugins page.`,"err_speech-off":`Voice input is not enabled in DSH: enable it in DSH’s Plugins page and set up its model.`,"err_speech-unprepared":`The speech recognizer is not ready: choose Download and prepare in Voice input’s details on DSH’s Plugins page.`,"err_speech-audio":`The recording could not be read. Record it again.`,"err_speech-too-long":`The recording is too long; it can be at most 2 minutes.`,"err_speech-failed":`Speech recognition failed. Try again.`,"err_speech-empty":`No speech was heard. Move closer to the microphone and try again.`,"err_mic-denied":`Microphone access was refused: allow DSH to use the microphone in your browser or system settings.`,"err_mic-missing":`No microphone was found.`,"err_mic-chosen-missing":`The microphone chosen in DSH’s Voice input is not available: plug it in, or choose another in Voice input’s details on DSH’s Plugins page.`,micChosenMissing:`The microphone chosen in DSH’s Voice input, “{name}”, is not available: plug it in, or choose another in Voice input’s details on DSH’s Plugins page.`,"err_mic-busy":`The microphone is in use by another program.`,"err_mic-unsupported":`Recording is not possible here.`,prepThinking:`Planning`,prepWriting:`Writing the board`,prepStarting:`Reaching the model…`,prepThinkingDetail:`Thinking the lesson through ({chars} characters so far)`,prepStep:`Writing step {n}`,prepCounts:`{steps} steps ready · {chars} characters`,prepSeconds:`{seconds}s so far`,dayLabel:`{weekday}, {month}/{day}`,exportPdf:`PDF (one board page per page)`,exportPng:`PNG images (one per page)`,exportMarkdown:`Markdown text`,exportingBoard:`Exporting the board… {done}/{total}`,animationStill:`Animation (plays in the lesson)`,monthLabel:`{month}/{year}`,prevMonth:`Previous month`,nextMonth:`Next month`,markDone:`Mark as done`,unmarkDone:`Mark as not done`,checkedAuto:`Done in the course`,dayEmpty:`Nothing planned for this day.`,webResearch:`Search the web first`,webResearchHint:`Before designing the course, look the subject up with DSH web search and use what it finds`,researching:`Searching the web…`,researchFound:`Drew on {count} web sources`,researchSkipped:`No web search: {reason}`,"researchSkipped_no-credential":`DSH has no DeepSeek key, which its web search needs`,researchSkipped_unavailable:`web search is not available in this DSH`,researchSkipped_failed:`the search failed`,researchSkipped_empty:`nothing useful came up`,courseSources:`Sources`,buildResearch:`Using {count} web sources`,"err_llm-empty":`The model returned nothing this time. Try again, or pick another model in Aha settings if it keeps happening.`,"err_llm-failed":`The model call failed. Try again in a moment.`,nextStepTitle:`Next step`,nextStepReview:`{count} concepts are due for review`,nextStepWeak:`“{concept}” is still weak; practise it first`,nextStepLesson:`Continue with “{title}”`,nextStepDone:`You have finished the course; check yourself with a unit quiz`,practiceThis:`Practise this lesson`,streakCount:`{count} in a row`,keysHint:`Keyboard: 1–4 to choose · Enter to submit or continue · H for a hint`,starsLabel:`{count} stars`,accuracy:`accuracy`,bestStreak:`best streak`,masteryChange:`Mastery after this round`,stageNone:`Not started`,stageWeak:`Weak`,stageLearning:`Learning`,stageProficient:`Proficient`,stageMastered:`Mastered`,nextRelearn:`A few points have not landed yet; going through the lesson again will help.`,nextReview:`You mostly have it, but it is not solid yet; a review round will make it stick.`,nextQuiz:`This is solid; you are ready for the unit quiz.`,nextLessonStep:`You are ready to move on.`,nextCourse:`This part is done.`,relearnLesson:`Back to the lesson`,reviewCourse:`Review this course`,editOutline:`Edit outline`,saveAndBack:`Save and go back`,extendCourse:`Ask for one more unit`,extendInstruction:`Add one more unit at the end that builds on what the course covers and takes the next step at the same gradient; leave the existing units unchanged.`,proposalTitle:`Proposed changes`,proposalNoChange:`This revision changes no lessons.`,applyProposal:`Apply changes`,discardProposal:`Discard`,proposalApplied:`Changes applied`,diffAdded:`Added`,diffRemoved:`Removed`,diffRenamed:`Renamed`,diffChanged:`Changed`,diffUnit:`Unit “{title}”`,reworkLesson:`Rework this lesson`,splitLesson:`Split in two`,deepenLesson:`Go deeper`,splitDone:`Split in two; remember to save`,deepenDone:`Made deeper; remember to save`,confirmRemoveUnit:`Remove the unit “{title}” and all its lessons?`,confirmRemoveLecture:`Remove “{title}” and all its lessons?`,confirmRemoveStarted:`“{title}” has been started; its board and progress will no longer show. Remove it?`,craftSize:`Course size`,sizeAuto:`Let the teacher decide`,sizeAutoHint:`Sized to your goal; a small question may need only a lesson or two`,sizeShort:`Short`,sizeShortHint:`3–8 lessons on what matters most`,sizeStandard:`Standard`,sizeStandardHint:`10–20 lessons: foundations, practice and an applied project`,sizeFull:`Full`,sizeFullHint:`25–45 lessons, thorough, with room to go deeper`,buildAnswers:`Going through your answers`,buildMaterials:`Reading your materials`,buildUnits:`Planning the units`,buildLessons:`Writing the lessons`,buildLessonsSoFar:`Writing the lessons: {count} so far`,workPlaceholder:`Write one step per line and put math inside $…$, e.g. $x^2+6x+9=(x+3)^2$`,workPreview:`Preview`,wrongStep:`Where it went wrong`,fixedStep:`It should read`,correction:`Correction`,correctionOf:`Correction: {tag}`,correcting:`Correcting it on the board…`,seeCorrection:`See the correction`,handout:`Handout`,handoutHint:`A one-page printable handout of this lesson`,handoutOfLesson:`Handout of this lesson`,handoutMaking:`Writing the handout…`,handoutPoints:`Key points`,handoutExample:`Worked example`,handoutMistakes:`Common mistakes`,handoutGlossary:`Glossary`,handoutQuestions:`Check yourself`,handoutAnswer:`Answer`,backToLesson:`Back to the lesson`,addMaterials:`Add materials`,addMaterialsTitle:`Add materials to this course`,addMaterialsHint:`Choose some materials (or upload them now). The teacher reads what they cover and proposes changes to the outline; nothing changes until you apply them, lessons you have started keep their progress, and later lessons cite the materials.`,addMaterialsPlaceholder:`How should the teacher use them? (optional) For example: add the worked examples from chapter 5`,addMaterialsSend:`Ask the teacher how to add them`,changeMaterials:`Change materials`,proposalMaterials:`From the added materials: {titles}`,librarySearch:`Find: type to filter by title or topic, press Enter to search the text`,librarySearchText:`Search text`,libraryFound:`{count} passages in the text`,libraryNotFound:`Nothing in the text matches “{query}”`,libraryNoTitleMatch:`No title or topic matches. Press Enter to search the text.`,pageN:`p. {page}`,slideN:`slide {slide}`,tourLabel:`Classroom tour`,tourReplay:`Classroom tour`,tourSkip:`Skip`,tourBack:`Back`,tourNext:`Next`,tourStart:`Start the lesson`,tourBoardTitle:`The teacher writes here`,tourBoard:`The board fills up as the teacher talks. Drag or scroll to move around it, hold Ctrl (⌘ on a Mac) and scroll to zoom, and use All in the top right to see the whole lesson.`,tourControlsTitle:`Play and pace`,tourControls:`Play, pause, the previous and next step and the speed are here; Space pauses too. Captions and sound can be switched at any time.`,tourRaiseTitle:`Raise your hand`,tourRaise:`Choose Raise hand, or type in the question box. You can also say it: click the microphone, or hold V while you speak and let go to put the question in the box. The teacher answers, then carries on.`,tourReexplainTitle:`Lost at this step?`,tourReexplain:`Choose Explain differently for an analogy, a drawing, an example, a simpler or a deeper take.`,tourChallengeTitle:`Spotted a mistake?`,tourChallenge:`Choose Is this step wrong? The teacher checks it carefully first; a real mistake is corrected there and fixed in the lesson.`,tourPanelTitle:`Goals and transcript`,tourPanel:`See how far the lesson's goals have come; everything said is in the transcript, and choosing a line goes back to it.`,outlineView:`How the outline is shown`,viewList:`List`,viewMap:`Map`,mapTools:`Map tools`,mapFollow:`Back to the newest`,mapPick:`Edit this lesson in the list`,depthTitle:`How this lesson treats its idea`,depthNone:`Any`,depth_intuition:`Intuition`,depth_definition:`Definition`,depth_derivation:`Derivation`,depth_application:`Application`,depth_extension:`Extension`,profileName:`What should the tutor call you?`,profileNameHint:`said once when a lesson opens; optional`,profileNamePlaceholder:`For example: Sam`,challenge:`Is this step wrong?`,challengeLabel:`Is this step wrong?`,challengeTitle:`What looks wrong in this step? (optional)`,challengeTitleStep:`What looks wrong in step {n}? (optional) “{text}”`,challengePlaceholder:`For example: shouldn’t 5 cm be 0.05 m?`,challengeHint:`The teacher works it through again first, which takes a few seconds to half a minute.`,challengeSend:`Ask the teacher to check`,challengeLine:`Wrong?`,challengeStep:`Is step {n} wrong?`,checkingStep:`Checking this step carefully…`,challenge_wrong:`It was wrong, now corrected`,challenge_right:`Checked: it is right`,challenge_unclear:`Depends on the convention`,fixed:`Corrected`,fixedWas:`It said: {was}`,itemChallenge:`Something wrong with this question?`,itemChallengeTitle:`What looks wrong? (optional)`,itemChallengePlaceholder:`For example: I think B is right too, or: is the unit in the answer wrong?`,itemChallengeHint:`The teacher works it through first, which takes a few seconds to half a minute. You can go on meanwhile.`,itemChecking:`Checking this question carefully…`,itemCheckTitle:`Teacher’s check`,itemCheck_wrong:`It was wrong, now corrected`,itemCheck_unclear:`It was unclear, now spelled out`,itemCheck_misgraded:`It was graded wrongly, now regraded`,itemCheck_right:`Checked: it is right`,regraded:` (regraded)`,itemCheckDone:`Question {n} checked: {verdict}.`,itemCheckRegraded:` Your answer was graded again.`,itemCheckEarlier:` Earlier answers to this question graded again too: {count}.`,itemCheckFailedNotice:`Question {n} could not be checked: {message}`,fixedWasItem:`Before the fix:`,fixedPart_prompt:`Question: {text}`,fixedPart_option:`Option {id}: {text}`,fixedPart_answer:`Answer: {text}`,fixedPart_unit:`Unit: {text}`,fixedPart_tolerance:`Tolerance: {text}`,fixedPart_explanation:`Explanation: {text}`,fixedPart_hints:`Hints: {text}`,fixedPart_rubric:`Rubric: {text}`,fixedPart_figure:`The figure was redrawn`,lessonGoals:`Lesson goals`,transcript:`Transcript`,showPanel:`Transcript`,hidePanel:`Hide the side panel`,panelTitle:`Lesson side panel`,boardFont:`Board font`,fontHand:`Handwriting`,fontStandard:`Standard`,textSize:`Text size`,textStandard:`Standard`,textLarge:`Large`,textLarger:`Extra large`,textSizeHint:`Enlarges all of Aha Tutor’s text, right away. The board and the mind map have their own zoom buttons; DSH’s Settings → General → Font size changes the text here too.`,digestMissing:`{count} part(s) could not be read ({parts}); the digest below leaves them out.`,redigest:`Digest again`,revisingSoFar:`Revising… {count} lessons so far`,"err_bad-url":`This address cannot be imported: only public http or https sites are supported, not this computer, the local network or addresses with credentials.`,err_network:`The page could not be loaded or took too long. Check the address and try again.`,err_http:`The page returned an error and could not be imported.`,blueprintSoFar:`Designing your course blueprint… {count} lessons so far`,reexplainedAs:`Re-explained: {style}`,digestReading:`Reading the whole document: {done} of {total} parts read`,digestWriting:`Combining the notes into one digest`,keepsRunning:`You can leave this page; it keeps going in the background.`,err_cancelled:`Cancelled.`,courseCreatedInChat:`Created the course "{title}". Continue it in Aha.`,err_failed:`Something went wrong. Try again in a moment.`,err_invalid:`This request could not be handled. Reload the page and try again; if it keeps happening, quit and reopen DSH.`,"err_not-found":`This item could not be found. It may have been deleted.`,err_forbidden:`You are not allowed to do this.`,"err_unknown-endpoint":`The plugin was just updated. Quit and reopen DSH, then try again.`,err_aborted:`The upload was interrupted. Try again.`,err_connection:`Could not reach DSH. Make sure it is still open, then try again.`,err_missing:`The task was lost, perhaps because DSH restarted. Try again.`,"err_llm-missing":`No model is available yet. Set up a model provider in DSH settings first.`,"err_no-board":`The board is not written yet. Try again once its first step is up.`,"err_empty-question":`Type your question first.`,"err_empty-goal":`Tell me what you want to learn, or add some material.`,"err_empty-change":`Describe the change you want first.`,"err_no-blueprint":`There is no course blueprint yet. Generate one first.`,"err_no-proposal":`There is no proposed change. It may have been applied or discarded already.`,"err_bad-pack":`This file is not a course pack that can be imported.`,"err_pack-too-large":`This course pack is too large to import.`,"err_pack-too-new":`This course pack comes from a newer version of Aha. Update the plugin, then import it.`,"err_nothing-to-review":`Nothing to review yet: write a note or work in the project folder first.`,"err_cannot-tick":`Only study items on today or an earlier day can be ticked.`,"err_exam-incomplete":`An exam needs a title and a date.`,"err_no-material":`Pick at least one material first.`,"err_material-no-text":`The selected material has no readable text. Images and scanned PDFs cannot be read as text.`,"err_empty-topic":`Give a topic or a web address first.`,"err_no-credentials":`DSH credentials are not available in this profile, so the key cannot be saved.`,"err_bad-key":`The key looks wrong: use 8–1024 letters, digits or symbols with no spaces.`,err_unsupported:`This file type is not supported. Upload a PDF, Word or PowerPoint file, an image, or a text file such as .md, .txt or .csv.`,"err_old-office":`Old .doc/.ppt files are not supported. Save them as .docx/.pptx and upload again.`,err_encrypted:`This PDF is password protected. Remove the password and upload it again.`,err_unreadable:`This file could not be read. It may be damaged; export it again and retry.`,"err_no-text":`No text was found in this file.`,"err_scan-needs-vision":`This is a scan, with no text to read directly. To read the text in it, pick a model marked 🖼 (it can see images) in Aha settings, such as DeepSeek-V4.1-Flash, and upload it again.`,"err_pictures-need-vision":`Everything in this file is pictures. To read the text in them, pick a model marked 🖼 (it can see images) in Aha settings, such as DeepSeek-V4.1-Flash, and upload it again.`,"err_llm-no-vision":`The current model cannot see images. Pick a model marked 🖼 in Aha settings.`,"err_image-unusable":`This picture could not be given to the model.`,err_empty:`This file is empty.`,"err_too-large":`The file is larger than 200 MB. Split it into smaller parts and upload them.`,"err_image-too-large":`Images must be smaller than 10 MB.`,"err_page-too-large":`This page is too large to import.`,"err_page-no-text":`No readable text was found on this page.`,"err_tts-address":`The speech service address is wrong: use a full https address (http only for this computer) without a user name or password.`,"err_tts-app-id":`Volcengine speech needs an App ID.`,"err_tts-azure":`The Azure region or voice name is not valid. Enter it as the Azure portal shows it.`,"err_tts-config":`The speech service settings are incomplete. Check them in settings.`,"err_tts-network":`Could not reach the speech service. Check the network and the service address.`,"err_tts-stalled":`The speech service is not responding. Check that it is running and that its address is right.`,"err_tts-timeout":`The speech service took too long. Try again later.`,"err_tts-too-large":`The speech service returned too much audio.`,"err_tts-auth":`The speech service rejected the key. Check that it is correct.`,"err_tts-no-key":`No key is saved for this speech service. Add it in settings first.`,"err_tts-rate-limit":`The speech service is limiting requests. Try again later.`,"err_tts-server":`The speech service had an error. Try again later.`,"err_tts-request":`The speech service refused the request. Check the voice and other settings.`,"err_tts-empty":`There is nothing to read aloud.`,"err_tts-response":`The speech service returned no usable audio. Try again later or pick another voice.`,"err_tts-failed":`Speech synthesis failed. Try again later.`,"err_no-materials":`Choose at least one material first.`,"err_materials-known":`These materials are already part of this course.`,"err_materials-full":`A course can use at most 12 materials, and this one has them all.`,err_speech:`Reading aloud did not work. Try another system voice, or switch to a cloud voice.`,"err_speech-stalled":`The system voice got stuck and made no sound.`,err_playback:`The audio could not be played. Try again.`,exportFailed:`The export did not finish. Try again.`},Up=[`slots`,`locale`,`connection`],Wp=`aha-tutor`,Gp=`dsh-aha-tutor/board`,Kp=`ahaTutorBoard`,qp=[`aha_whiteboard`,`aha_quiz`,`aha_course`,`aha_cheatsheet`,`aha_learner`];function Jp({size:e}){return(0,i.jsx)(ut,{name:`logo`,size:e})}function Yp({rpc:e,t,language:n,dsh:r}){return(0,i.jsx)(Ap,{rpc:e,t,language:n(),dsh:r})}function Xp(e){e.effect(()=>e.locale.register(Bp,{zh:Vp,en:Hp}),`aha-tutor: copy`),e.effect(()=>{let e=document.createElement(`style`);return e.dataset.plugin=`dsh-aha-tutor`,e.textContent=Af,document.head.append(e),()=>e.remove()},`aha-tutor: style`);let t=e.locale.bind(Bp),n=e.get(`connection`).rpc,r=()=>String(e.locale.getLocale?.()?.active??`zh`).startsWith(`zh`)?`zh`:`en`,i=Object.freeze({selectPanel:()=>e.get(`layout`)?.selectPanel?.(Wp),async openWorkspace(t,n){let r=e.get(`workspaces`),i=e.get(`uiWorkspace`);if(typeof r?.create!=`function`||typeof i?.startSession!=`function`)return!1;let a=await r.create({path:t});return i.startSession(a.workspaceId,{prompt:n,clearPreviousDraft:!0}),!0},openBoardTab(t){let n=e.get(`sidebarRight`);if(typeof n?.openTab!=`function`)return!1;try{return n.openTab(Kp,{params:t}),!0}catch{return!1}}});e.slots.inject(`main`,()=>e.slots.register({name:`main`,key:Wp,locale:Bp,inject:()=>({rpc:n,language:r,dsh:i})},Yp)),e.slots.inject(`sidebar.panellist`,()=>e.slots.register({name:`sidebar.panellist`,id:Wp,order:20,locale:Bp,label:()=>t(`panelLabel`)},Jp)),e.inject([`sidebarRightTabs`],e=>{e.effect(()=>e.sidebarRightTabs.register({id:Gp,kind:Kp,title:()=>t(`boardSession`),keepMounted:!0}),`aha-tutor: board tab`)}),e.slots.inject(`sidebar.right.pane.tab`,()=>e.slots.register({name:`sidebar.right.pane.tab`,key:Gp,locale:Bp,inject:()=>({rpc:n,language:r(),dsh:i})},Np));for(let t of qp)e.slots.inject(`tool.call.toolview`,()=>e.slots.register({name:`tool.call.toolview`,key:t,locale:Bp,inject:()=>({rpc:n,language:r(),dsh:i})},Lp))}return n.apply=Xp,n.inject=Up,t.exports}});
|
|
722
722
|
//# sourceMappingURL=client.js.map
|