wrong-notebook 2026.11.5-3 → 2026.11.6
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/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +3 -3
- package/.next/prerender-manifest.json +3 -3
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/api/analyze/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/figure/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/fix-latex/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/geogebra/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/reanswer/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/retag/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/svg-animation/narration/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/svg-animation/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/route.js.nft.json +1 -1
- package/.next/server/app/api/exams/[id]/questions/[questionId]/regenerate/route.js.nft.json +1 -1
- package/.next/server/app/api/exams/[id]/results/route.js.nft.json +1 -1
- package/.next/server/app/api/exams/[id]/retry/route.js.nft.json +1 -1
- package/.next/server/app/api/exams/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/exams/route.js.nft.json +1 -1
- package/.next/server/app/api/geogebra-analyze/route.js.nft.json +1 -1
- package/.next/server/app/api/import/route.js.nft.json +1 -1
- package/.next/server/app/api/import-batches/[id]/confirm-all/route.js.nft.json +1 -1
- package/.next/server/app/api/import-batches/[id]/fix-text/route.js.nft.json +1 -1
- package/.next/server/app/api/import-batches/[id]/read/route.js.nft.json +1 -1
- package/.next/server/app/api/import-batches/[id]/retry/route.js.nft.json +1 -1
- package/.next/server/app/api/import-batches/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/import-batches/[id]/start/route.js.nft.json +1 -1
- package/.next/server/app/api/import-batches/route.js.nft.json +1 -1
- package/.next/server/app/api/import-tasks/[id]/confirm/route.js.nft.json +1 -1
- package/.next/server/app/api/import-tasks/[id]/read/route.js.nft.json +1 -1
- package/.next/server/app/api/import-tasks/[id]/retry/route.js.nft.json +1 -1
- package/.next/server/app/api/import-tasks/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/import-tasks/route.js.nft.json +1 -1
- package/.next/server/app/api/notebooks/[id]/retag/route.js.nft.json +1 -1
- package/.next/server/app/api/openclaw/batch-upload/route.js.nft.json +1 -1
- package/.next/server/app/api/practice/generate/route.js.nft.json +1 -1
- package/.next/server/app/api/reanswer/route.js.nft.json +1 -1
- package/.next/server/app/api/tasks/route.js.nft.json +1 -1
- package/.next/server/app/api/tts/batch/route.js.nft.json +1 -1
- package/.next/server/app/error-items/[id]/page.js.nft.json +1 -1
- package/.next/server/app/error-items/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/exams/page.js.nft.json +1 -1
- package/.next/server/app/exams/page_client-reference-manifest.js +1 -1
- package/.next/server/app/notebooks/[id]/add/page.js.nft.json +1 -1
- package/.next/server/app/notebooks/[id]/add/page_client-reference-manifest.js +1 -1
- package/.next/server/app/page.js.nft.json +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__09g6pf6gfjb-i._.js +3 -0
- package/.next/server/chunks/ssr/{[root-of-the-server]__0te5kr0_7nmrv._.js → [root-of-the-server]__1t2h6rz1x-gwk._.js} +2 -2
- package/.next/server/chunks/ssr/[root-of-the-server]__1vj6th0gehszy._.js +3 -0
- package/.next/server/chunks/ssr/_0oo8k-upgx7hb._.js +3 -0
- package/.next/server/chunks/ssr/_117fl8dk5qci2._.js +4 -0
- package/.next/server/chunks/ssr/_1x-_hs_sw5z1x._.js +3 -0
- package/.next/server/chunks/ssr/node_modules_1fwhuynv-5kcg._.js +3 -0
- package/.next/server/chunks/ssr/{node_modules_heic-to_dist_csp_heic-to_0mr1-2rg_ae47.js → node_modules_heic-to_dist_csp_heic-to_1klwivk06jo8p.js} +1 -1
- package/.next/server/chunks/ssr/src_0atwwo6buvs3b._.js +3 -0
- package/.next/server/chunks/ssr/src_app_exams_page_tsx_17_d4_gy2i1ds._.js +1 -1
- package/.next/server/chunks/ssr/src_app_notebooks_[id]_add_page_tsx_179tow1ql6vc_._.js +1 -1
- package/.next/server/chunks/ssr/src_app_page_tsx_1chiuahujsxm1._.js +1 -1
- package/.next/server/chunks/ssr/src_components_image-cropper_tsx_0pcp8-ifruyx-._.js +1 -1
- package/.next/server/middleware-build-manifest.js +3 -3
- package/.next/server/pages/500.html +1 -1
- package/.next/server/preview-props.json +3 -3
- package/.next/server/server-reference-manifest.js +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/static/chunks/0xze-7xwdgel2.js +8 -0
- package/.next/static/chunks/16c0c5ykflqpn.js +1 -0
- package/.next/static/chunks/1qb_yt4hvopfn.js +8 -0
- package/.next/static/chunks/1ziwji7xw98fj.js +9 -0
- package/.next/static/chunks/25jnmrgxyy1tx.js +1 -0
- package/.next/static/chunks/3_wki8y0qb28v.js +1 -0
- package/.next/static/chunks/{1q3saz647fqri.js → 3ios-g8cm_1vz.js} +1 -1
- package/package.json +1 -1
- package/prisma/seed.db +0 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__0uezowk-9l0x4._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__12jk2bmesr4gc._.js +0 -3
- package/.next/server/chunks/ssr/_127aw5h992s9d._.js +0 -4
- package/.next/server/chunks/ssr/_1t-o815u40ng2._.js +0 -3
- package/.next/server/chunks/ssr/node_modules_1m0t7n1f8dlgz._.js +0 -3
- package/.next/server/chunks/ssr/node_modules_heic-to_dist_csp_heic-to_1m3ywmnbpcnde.js +0 -3
- package/.next/server/chunks/ssr/src_1nbi4yrww3r1m._.js +0 -3
- package/.next/static/chunks/0gu34v572tj7o.js +0 -1
- package/.next/static/chunks/0lnx4h7lv4ev5.js +0 -16
- package/.next/static/chunks/2bk5f71d5ke2y.js +0 -1
- package/.next/static/chunks/2lhxk-8dpncxq.js +0 -1
- package/.next/static/chunks/2n2hvugnmgoy3.js +0 -16
- package/.next/static/chunks/3_w-p8241f5rv.js +0 -1
- /package/.next/static/{T6hfqhqpSQ_GF78vCYl3P → vv9z38w24wHWYLUAbjtdk}/_buildManifest.js +0 -0
- /package/.next/static/{T6hfqhqpSQ_GF78vCYl3P → vv9z38w24wHWYLUAbjtdk}/_clientMiddlewareManifest.js +0 -0
- /package/.next/static/{T6hfqhqpSQ_GF78vCYl3P → vv9z38w24wHWYLUAbjtdk}/_ssgManifest.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(()=>{"use strict";(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,711241,e=>{var t=e.i(456420);let l={name:"arrow-left",size:24,node:[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]};l.node;let i=(0,t.f)(l);e.s(["f",0,i],711241)},952801,e=>{var t=e.i(843476),l=e.i(271645),i=e.i(522016),a=e.i(215519),s=e.i(306831),r=e.i(226091),n=e.i(77071),c=e.i(519455),o=e.i(515288),d=e.i(912505),u=e.i(393842),m=e.i(86963),x=e.i(618566),h=e.i(632781),p=e.i(994533),f=e.i(257428),g=e.i(793479),b=e.i(110204),j=e.i(699375),y=e.i(574041),v=e.i(111110);let N=["generate","original"];function k({value:e,onChange:l}){let{t:i}=(0,v.b)();return(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(b.f,{children:i.exam.modeLabel}),(0,t.jsx)("div",{className:"grid grid-cols-2 gap-1 rounded-md bg-muted p-1 sm:max-w-sm",role:"group","aria-label":i.exam.modeLabel,children:N.map(a=>(0,t.jsx)("button",{type:"button","aria-pressed":e===a,onClick:()=>l(a),className:`rounded px-2 py-1.5 text-sm transition-colors ${e===a?"bg-background shadow-sm font-medium":"text-muted-foreground"}`,children:i.exam.modes[a]},a))}),"original"===e&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:i.exam.originalHint})]})}var _=e.i(41931);let w=["unmastered","mastered","all"],C=["least_practiced","random"],S=["generate","original"],E=["easy","medium","hard","harder"],R={mode:"generate",scope:"unmastered",pickRule:"least_practiced",count:10,difficulty:"medium"};function L(e,t,l){return"string"==typeof t&&e.includes(t)?t:l}function O(e){return Math.min(50,Math.max(1,Math.round(e)))}function T(e){let t;if(!e)return{...R};try{t=JSON.parse(e)}catch{return{...R}}if(!t||"object"!=typeof t)return{...R};let l=t;return{mode:L(S,l.mode,R.mode),scope:L(w,l.scope,R.scope),pickRule:L(C,l.pickRule,R.pickRule),count:"number"==typeof l.count&&Number.isFinite(l.count)?O(l.count):R.count,difficulty:L(E,l.difficulty,R.difficulty)}}function $(e){return JSON.stringify(e)}var M=e.i(470279),A=e.i(804536),z=e.i(401280);function F(){let{t:e,language:i}=(0,v.b)(),a=(0,x.useRouter)(),[s,r]=(0,l.useState)([]),[n,d]=(0,l.useState)([]),[u,m]=(0,l.useState)([]),[N,S]=(0,l.useState)([]),[R,L]=(0,l.useState)([]),[F,H]=(0,A.x)("exam-form-preferences",T,$),{scope:q,pickRule:D,count:P,difficulty:U,mode:I}=F,B=e=>H({...F,...e}),[K,V]=(0,l.useState)(""),[J,Q]=(0,l.useState)(!1),[X,G]=(0,l.useState)(!1),[W,Y]=(0,l.useState)(null),[Z,ee]=(0,l.useState)(null),{groups:et,loading:el}=(0,M.f)();(0,l.useEffect)(()=>{_.k.get("/api/notebooks").then(e=>{r(e),1===e.length&&d([e[0].id])}).catch(()=>r([]))},[]);let ei=e=>{L(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},ea=async t=>{if(t.preventDefault(),0===n.length)return void Y(e.exam.noNotebook);G(!0),Y(null),ee(null);try{let t=await _.k.post("/api/exams",{subjectIds:n,tagNames:u,paperLevelIds:N.length>0?N:void 0,questionTypes:R.length>0?R.map(e=>e===z.O?"none":e):void 0,scope:q,pickRule:D,count:P,difficulty:"original"===I?void 0:U,mode:I,title:K.trim()||void 0,language:i,parallel:J||void 0});t.papers&&t.papers.length>1?ee(e.exam.parallelCreated):"PARALLEL_NOT_ENOUGH"===t.warning?ee(e.exam.parallelNotEnough):"PARALLEL_B_QUOTA_EXCEEDED"===t.error&&ee(e.exam.parallelQuotaExceeded),a.push(`/exams/${t.id}`)}catch(t){Y("NO_SOURCE_ITEMS"===t?.data?.message?e.exam.noSource:e.common.messages?.saveFailed||"Failed"),G(!1)}},es=e.practice.difficulty;return(0,t.jsxs)(o.N,{children:[(0,t.jsx)(o.Y,{children:(0,t.jsx)(o.v,{className:"text-lg",children:e.exam.createTitle})}),(0,t.jsx)(o.O,{children:(0,t.jsxs)("form",{onSubmit:ea,className:"space-y-5",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)(b.f,{children:e.exam.notebooks}),s.length>1&&(0,t.jsx)("button",{type:"button",className:"text-xs text-primary hover:underline",onClick:()=>d(n.length===s.length?[]:s.map(e=>e.id)),children:e.exam.selectAll})]}),(0,t.jsx)("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-2",children:s.map(e=>(0,t.jsxs)("label",{className:"flex items-center gap-2 rounded-md border p-2 text-sm cursor-pointer hover:bg-muted/50",children:[(0,t.jsx)(f.f,{checked:n.includes(e.id),onCheckedChange:()=>{var t;return t=e.id,void d(e=>e.includes(t)?e.filter(e=>e!==t):[...e,t])}}),(0,t.jsx)("span",{className:"truncate",children:e.name}),(0,t.jsx)("span",{className:"ml-auto text-xs text-muted-foreground",children:e._count?.errorItems??""})]},e.id))})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(b.f,{children:e.exam.tags}),(0,t.jsx)(y.f,{value:u,onChange:m,placeholder:e.exam.tagsPlaceholder})]}),!el&&et.filter(e=>e.isActive).length>0&&(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(b.f,{children:e.filter.paperLevel}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:et.filter(e=>e.isActive).map(e=>(0,t.jsx)("button",{type:"button",onClick:()=>{var t;return t=e.id,void S(e=>e.includes(t)?e.filter(e=>e!==t):[...e,t])},className:`rounded-full border px-3 py-1.5 text-sm transition-colors ${N.includes(e.id)?"border-primary bg-primary text-primary-foreground":"border-input bg-background hover:bg-muted"}`,children:e.name},e.id))})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(b.f,{children:e.questionType.label}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[z.V.map(l=>(0,t.jsx)("button",{type:"button",onClick:()=>ei(l),className:`rounded-full border px-3 py-1.5 text-sm transition-colors ${R.includes(l)?"border-primary bg-primary text-primary-foreground":"border-input bg-background hover:bg-muted"}`,children:e.questionType.names[l]||l},l)),(0,t.jsx)("button",{type:"button",onClick:()=>ei(z.O),className:`rounded-full border px-3 py-1.5 text-sm transition-colors ${R.includes(z.O)?"border-primary bg-primary text-primary-foreground":"border-input bg-background hover:bg-muted"}`,children:e.questionType.notSet})]}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:e.exam.questionTypesHint})]}),(0,t.jsx)(k,{value:I,onChange:e=>B({mode:e})}),(0,t.jsxs)("div",{className:`grid gap-4 ${"generate"===I?"sm:grid-cols-3":"sm:grid-cols-2"}`,children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(b.f,{children:e.exam.scope}),(0,t.jsx)("div",{className:"grid grid-cols-3 gap-1 rounded-md bg-muted p-1",children:w.map(l=>(0,t.jsx)("button",{type:"button",onClick:()=>B({scope:l}),className:`rounded px-2 py-1.5 text-sm transition-colors ${q===l?"bg-background shadow-sm font-medium":"text-muted-foreground"}`,children:e.exam.scopes[l]},l))})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(b.f,{htmlFor:"exam-count",children:e.exam.count}),(0,t.jsx)(g.f,{id:"exam-count",type:"number",min:1,max:50,value:P,onChange:e=>B({count:O(parseInt(e.target.value,10)||1)})})]}),"generate"===I&&(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(b.f,{htmlFor:"exam-difficulty",children:e.exam.difficulty}),(0,t.jsx)("select",{id:"exam-difficulty",value:U,onChange:e=>B({difficulty:e.target.value}),className:"h-9 w-full rounded-md border bg-background px-3 text-sm",children:E.map(e=>(0,t.jsx)("option",{value:e,children:es[e]},e))})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(b.f,{children:e.exam.pickRule}),(0,t.jsx)("div",{className:"grid grid-cols-2 gap-1 rounded-md bg-muted p-1 sm:max-w-sm",children:C.map(l=>(0,t.jsx)("button",{type:"button",onClick:()=>B({pickRule:l}),className:`rounded px-2 py-1.5 text-sm transition-colors ${D===l?"bg-background shadow-sm font-medium":"text-muted-foreground"}`,children:e.exam.pickRules[l]},l))}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:e.exam.pickRuleHints[D]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,t.jsx)(b.f,{htmlFor:"exam-parallel",children:e.exam.parallelLabel}),(0,t.jsx)(j.f,{id:"exam-parallel",checked:J,onCheckedChange:Q})]}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:e.exam.parallelHint})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(b.f,{htmlFor:"exam-title",children:e.exam.titleLabel}),(0,t.jsx)(g.f,{id:"exam-title",value:K,maxLength:100,onChange:e=>V(e.target.value)})]}),W&&(0,t.jsx)("p",{className:"text-sm text-destructive",children:W}),Z&&(0,t.jsx)("p",{className:"text-sm text-primary",children:Z}),(0,t.jsxs)(c.f,{type:"submit",disabled:X,className:"w-full sm:w-auto",children:[X?(0,t.jsx)(h.f,{className:"mr-2 h-4 w-4 animate-spin"}):(0,t.jsx)(p.f,{className:"mr-2 h-4 w-4"}),X?e.exam.creating:"original"===I?e.exam.createOriginal:e.exam.generate]})]})})]})}var H=e.i(663661),q=e.i(487486),D=e.i(35209);e.s(["default",0,function(){let{timeZone:e}=(0,a.M)(),{t:x}=(0,v.b)();(0,D.f)(x.exam.title);let[h,p]=(0,l.useState)(null),[f,g]=(0,l.useState)(!1);(0,l.useEffect)(()=>{_.k.get("/api/exams").then(e=>{p(e),0===e.length&&g(!0)}).catch(()=>p([]))},[]);let b=x.practice.difficulty;return(0,t.jsx)("main",{className:"mx-auto min-h-screen max-w-6xl px-4 py-6 md:px-8 md:py-8",children:(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsx)(u.f,{title:x.exam.title,description:x.exam.subtitle,actions:!f&&(0,t.jsxs)(c.f,{onClick:()=>g(!0),"aria-label":x.exam.create,children:[(0,t.jsx)(n.f,{className:"h-4 w-4"}),(0,t.jsx)("span",{className:"hidden sm:inline",children:x.exam.create})]})}),f&&(0,t.jsx)(F,{}),(0,t.jsxs)("section",{className:"space-y-3",children:[(0,t.jsx)("h2",{className:"text-lg font-semibold",children:x.exam.list}),null===h?(0,t.jsx)(m.f,{}):0===h.length?(0,t.jsx)(d.f,{icon:r.f,title:x.exam.empty,className:"py-10"}):(0,t.jsx)("div",{className:"grid gap-3 md:grid-cols-2",children:h.map(l=>(0,t.jsx)(i.default,{href:`/exams/${l.id}`,children:(0,t.jsx)(o.N,{className:"h-full rounded-2xl transition-all hover:-translate-y-0.5 hover:border-primary/40 hover:shadow-md",children:(0,t.jsxs)(o.O,{className:"space-y-2 pt-4",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,t.jsxs)("span",{className:"flex items-center gap-2 font-medium",children:[(0,t.jsx)(r.f,{className:"h-4 w-4 shrink-0 text-primary"}),l.title]}),(0,t.jsx)(H.f,{status:l.status,recorded:l.recordedCount>0})]}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-x-3 gap-y-1 text-xs text-muted-foreground",children:[(0,t.jsx)("span",{children:(0,s.r)(l.createdAt,"yyyy-MM-dd HH:mm",e)}),(0,t.jsx)("span",{children:x.exam.questionCount.replace("{count}",String(l.questionCount))}),(0,t.jsx)("span",{children:x.exam.scopes[l.scope]}),"original"===l.mode?(0,t.jsx)(q.f,{variant:"secondary",children:x.exam.modes.original}):(0,t.jsx)("span",{children:b[l.difficulty]||l.difficulty}),(0,t.jsx)("span",{children:l.recordedCount>0?x.exam.recorded:x.exam.notRecorded})]})]})})},l.id))})]})]})})}],952801)},663661,e=>{var t=e.i(843476),l=e.i(487486),i=e.i(111110);let a={generating:"bg-blue-100 dark:bg-blue-900/40 text-blue-700 dark:text-blue-300 border-blue-200 dark:border-blue-900",ready:"bg-indigo-100 dark:bg-indigo-900/40 text-indigo-700 dark:text-indigo-300 border-indigo-200 dark:border-indigo-900",partial:"bg-amber-100 dark:bg-amber-900/40 text-amber-700 dark:text-amber-300 border-amber-200 dark:border-amber-900",failed:"bg-red-100 dark:bg-red-900/40 text-red-700 dark:text-red-300 border-red-200 dark:border-red-900",completed:"bg-green-100 dark:bg-green-900/40 text-green-700 dark:text-green-300 border-green-200 dark:border-green-900"};e.s(["f",0,function({status:e,recorded:s}){let{t:r}=(0,i.b)(),n=s&&("ready"===e||"partial"===e)?"completed":e;return(0,t.jsx)(l.f,{variant:"outline",className:a[n],children:r.exam.status[n]})}])},574041,e=>{var t=e.i(843476),l=e.i(271645),i=e.i(263676),a=e.i(487486),s=e.i(793479),r=e.i(41931),n=e.i(201276);e.s(["f",0,function({value:e=[],onChange:c,placeholder:o="Enter tags...",className:d="",enterHint:u,subject:m,gradeStage:x}){let[h,p]=(0,l.useState)(""),[f,g]=(0,l.useState)([]),[b,j]=(0,l.useState)(!1),[y,v]=(0,l.useState)(0),N=(0,l.useRef)(null),k=(0,l.useRef)(null),_=(0,l.useCallback)(async t=>{try{let l=new URLSearchParams({q:t});m&&l.append("subject",m),x&&l.append("stage",x);let i=((await r.k.get(`/api/tags/suggestions?${l.toString()}`)).suggestions||[]).filter(t=>!e.includes(t));g(i.slice(0,20)),j(i.length>0),v(0)}catch(e){n.V.error("[TagInput]","Failed to fetch suggestions",{error:e})}},[m,x,e]);(0,l.useEffect)(()=>{h.trim()&&_(h)},[h,_]);let w=t=>{t.trim()&&!e.includes(t.trim())&&(c([...e,t.trim()]),p(""),g([]),j(!1),v(0))},C=t=>{c(e.filter(e=>e!==t))};return(0,l.useEffect)(()=>{let e=e=>{!k.current||k.current.contains(e.target)||N.current?.contains(e.target)||j(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),(0,t.jsxs)("div",{className:`relative ${d}`,children:[(0,t.jsxs)("div",{className:"flex flex-wrap gap-2 p-2 border rounded-lg bg-background min-h-[42px]",children:[e.map(e=>(0,t.jsxs)(a.f,{variant:"secondary",className:"flex items-center gap-1 px-2 py-1",children:[e,(0,t.jsx)("button",{type:"button",onClick:()=>C(e),className:"hover:text-destructive ml-1",children:(0,t.jsx)(i.X,{className:"h-3 w-3"})})]},e)),(0,t.jsx)(s.f,{ref:N,type:"text",value:h,onChange:e=>{p(e.target.value),e.target.value.trim()||(g([]),j(!1))},onKeyDown:t=>{"Enter"===t.key?(t.preventDefault(),y>=0&&f[y]?w(f[y]):h.trim()&&w(h)):"ArrowDown"===t.key?(t.preventDefault(),v(e=>Math.min(e+1,f.length-1))):"ArrowUp"===t.key?(t.preventDefault(),v(e=>Math.max(e-1,0))):"Escape"===t.key?(j(!1),v(0)):"Backspace"===t.key&&!h&&e.length>0&&C(e[e.length-1])},onFocus:()=>{f.length>0&&j(!0)},placeholder:0===e.length?o:"",className:"flex-1 min-w-[120px] border-none focus-visible:ring-0 focus-visible:ring-offset-0 h-8 px-0"})]}),b&&f.length>0&&(0,t.jsx)("div",{ref:k,className:"absolute z-50 w-full mt-1 bg-popover border rounded-md shadow-md max-h-48 overflow-y-auto",children:f.map((e,l)=>(0,t.jsx)("div",{className:`px-3 py-2 cursor-pointer hover:bg-accent ${l===y?"bg-accent":""}`,onClick:()=>w(e),onMouseEnter:()=>v(l),children:e},e))}),h&&!b&&(0,t.jsx)("div",{className:"text-xs text-muted-foreground mt-1",children:u?`${u} "${h}"`:`Press Enter to create "${h}"`})]})}])},590546,e=>{var t=e.i(843476),l=e.i(618566),i=e.i(519455),a=e.i(711241);e.s(["f",0,function({fallbackUrl:e,className:s}){let r=(0,l.useRouter)();return(0,t.jsx)(i.f,{variant:"ghost",size:"icon",onClick:()=>{r.push(e)},className:s,children:(0,t.jsx)(a.f,{className:"h-5 w-5"})})}])},912505,e=>{var t=e.i(843476),l=e.i(975157);e.s(["f",0,function({icon:e,title:i,description:a,action:s,className:r}){return(0,t.jsxs)("div",{className:(0,l.f)("flex flex-col items-center justify-center rounded-2xl border border-dashed bg-card/50 px-6 py-14 text-center",r),children:[(0,t.jsx)("div",{className:"mb-4 flex h-14 w-14 items-center justify-center rounded-2xl bg-accent text-accent-foreground",children:(0,t.jsx)(e,{className:"h-7 w-7"})}),(0,t.jsx)("p",{className:"font-medium",children:i}),a&&(0,t.jsx)("p",{className:"mt-1 max-w-sm text-sm text-muted-foreground",children:a}),s&&(0,t.jsx)("div",{className:"mt-5",children:s})]})}])},393842,e=>{var t=e.i(843476),l=e.i(590546),i=e.i(975157);e.s(["f",0,function({title:e,description:a,backHref:s,actions:r,titleAddon:n,className:c}){return(0,t.jsxs)("div",{className:(0,i.f)("flex items-start gap-3",c),children:[s&&(0,t.jsx)(l.f,{fallbackUrl:s,className:"-ml-2 shrink-0"}),(0,t.jsxs)("div",{className:"min-w-0 flex-1 space-y-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)("h1",{className:"truncate text-2xl font-bold tracking-tight sm:text-3xl",children:e}),n]}),a&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground sm:text-base",children:a})]}),r&&(0,t.jsx)("div",{className:"flex shrink-0 items-center gap-2",children:r})]})}])},86963,e=>{var t=e.i(843476),l=e.i(632781);e.s(["f",0,function({label:e}){return(0,t.jsxs)("div",{className:"flex min-h-[50vh] flex-col items-center justify-center gap-3 text-muted-foreground",children:[(0,t.jsx)(l.f,{className:"h-7 w-7 animate-spin text-primary"}),e&&(0,t.jsx)("p",{className:"text-sm",children:e})]})}])},804536,e=>{var t=e.i(271645);let l=new Map,i=new Set;function a(e){return i.add(e),window.addEventListener("storage",e),()=>{i.delete(e),window.removeEventListener("storage",e)}}function s(e,s,r){let n=(0,t.useSyncExternalStore)(a,()=>(function(e){if(l.has(e))return l.get(e)??null;try{return window.localStorage.getItem(e)}catch{return null}})(e),()=>null);return[(0,t.useMemo)(()=>s(n),[s,n]),(0,t.useCallback)(t=>(function(e,t){try{window.localStorage.setItem(e,t),l.delete(e)}catch{l.set(e,t)}i.forEach(e=>e())})(e,r(t)),[e,r])]}let r=e=>e;e.s(["y",0,function(e,l,i){return s(e,(0,t.useCallback)(e=>l.includes(e??"")?e:i,[l,i]),r)},"x",0,s])},35209,e=>{var t=e.i(271645),l=e.i(111110);e.s(["f",0,function(...e){let{t:i}=(0,l.b)(),a=[i.pageTitle.base,...e.map(e=>"string"==typeof e?e.trim():"").filter(e=>e.length>0)].join("-");(0,t.useEffect)(()=>{document.title=a},[a])}])},401280,e=>{let t={single_choice:"single_choice",singlechoice:"single_choice","single choice":"single_choice","single-choice":"single_choice",multiple_choice:"multiple_choice",multiplechoice:"multiple_choice","multiple choice":"multiple_choice","multiple-choice":"multiple_choice",multichoice:"multiple_choice","multi choice":"multiple_choice",true_false:"true_false",truefalse:"true_false","true/false":"true_false","true false":"true_false","true-false":"true_false","true / false":"true_false",fill_blank:"fill_blank",fillblank:"fill_blank","fill in the blank":"fill_blank","fill-in-the-blank":"fill_blank",fillintheblank:"fill_blank",calculation:"calculation",solution:"solution",reading:"reading",cloze:"cloze",writing:"writing",other:"other",选择题:"single_choice",单项选择:"single_choice",单选:"single_choice",单选题:"single_choice",不定项:"multiple_choice",不定项选择:"multiple_choice",多项选择:"multiple_choice",多选:"multiple_choice",多选题:"multiple_choice",判断:"true_false",判断题:"true_false",是非:"true_false",是非题:"true_false",填空:"fill_blank",填空题:"fill_blank",口算:"calculation",计算:"calculation",计算题:"calculation",解答:"solution",解答题:"solution",应用:"solution",应用题:"solution",证明:"solution",证明题:"solution",简答:"solution",简答题:"solution",阅读:"reading",阅读理解:"reading",完形:"cloze",完形填空:"cloze",作文:"writing",写作:"writing",书面表达:"writing",其他:"other"};e.s(["O",0,"__none__","V",0,["single_choice","multiple_choice","true_false","fill_blank","calculation","solution","reading","cloze","writing","other"],"u",0,{single_choice:"Single Choice",multiple_choice:"Multiple Choice",true_false:"True / False",fill_blank:"Fill in the Blank",calculation:"Calculation",solution:"Solution",reading:"Reading Comprehension",cloze:"Cloze",writing:"Writing",other:"Other"},"H",0,{single_choice:"单选题",multiple_choice:"多选题",true_false:"判断题",fill_blank:"填空题",calculation:"计算题",solution:"解答题",reading:"阅读理解",cloze:"完形填空",writing:"写作",other:"其他"},"P",0,function(e){if("string"!=typeof e)return null;let l=e.trim().toLowerCase();return l?t[l]??null:null}])}])})();
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
(()=>{"use strict";(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,328623,e=>{var t=e.i(456420);let n={name:"sparkles",size:24,node:[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],aliases:["stars"]};n.node;let i=(0,t.f)(n);e.s(["f",0,i],328623)},232660,e=>{var t=e.i(271645),n={x:0,y:0,width:0,height:0,unit:"px"},i=(e,t,n)=>Math.min(Math.max(e,t),n),r=(e,t)=>e===t||e.width===t.width&&e.height===t.height&&e.x===t.x&&e.y===t.y&&e.unit===t.unit;function a(e,t,i){return"%"===e.unit?{...n,...e,unit:"%"}:{unit:"%",x:e.x?e.x/t*100:0,y:e.y?e.y/i*100:0,width:e.width?e.width/t*100:0,height:e.height?e.height/i*100:0}}function l(e,t,i){return e.unit&&"px"!==e.unit?{unit:"px",x:e.x?e.x*t/100:0,y:e.y?e.y*i/100:0,width:e.width?e.width*t/100:0,height:e.height?e.height*i/100:0}:{...n,...e,unit:"px"}}function o(e,t,n,i,r,a=0,l=0,s=i,h=r){let c={...e},u=Math.min(a,i),d=Math.min(l,r),m=Math.min(s,i),g=Math.min(h,r);t&&(t>1?(d=(u=l?l*t:u)/t,m=s*t):(u=(d=a?a/t:d)*t,g=h/t)),c.y<0&&(c.height=Math.max(c.height+c.y,d),c.y=0),c.x<0&&(c.width=Math.max(c.width+c.x,u),c.x=0);let p=i-(c.x+c.width);p<0&&(c.x=Math.min(c.x,i-u),c.width+=p);let f=r-(c.y+c.height);if(f<0&&(c.y=Math.min(c.y,r-d),c.height+=f),c.width<u&&(("sw"===n||"nw"==n)&&(c.x-=u-c.width),c.width=u),c.height<d&&(("nw"===n||"ne"==n)&&(c.y-=d-c.height),c.height=d),c.width>m&&(("sw"===n||"nw"==n)&&(c.x-=m-c.width),c.width=m),c.height>g&&(("nw"===n||"ne"==n)&&(c.y-=g-c.height),c.height=g),t){let e=c.width/c.height;if(e<t){let e=Math.max(c.width/t,d);("nw"===n||"ne"==n)&&(c.y-=e-c.height),c.height=e}else if(e>t){let e=Math.max(c.height*t,u);("sw"===n||"nw"==n)&&(c.x-=e-c.width),c.width=e}}return c}var s={capture:!0,passive:!1},h=0,c=class e extends t.PureComponent{static xOrds=["e","w"];static yOrds=["n","s"];static xyOrds=["nw","ne","se","sw"];static nudgeStep=1;static nudgeStepMedium=10;static nudgeStepLarge=100;static defaultProps={ariaLabels:{cropArea:"Use the arrow keys to move the crop selection area",nwDragHandle:"Use the arrow keys to move the north west drag handle to change the crop selection area",nDragHandle:"Use the up and down arrow keys to move the north drag handle to change the crop selection area",neDragHandle:"Use the arrow keys to move the north east drag handle to change the crop selection area",eDragHandle:"Use the up and down arrow keys to move the east drag handle to change the crop selection area",seDragHandle:"Use the arrow keys to move the south east drag handle to change the crop selection area",sDragHandle:"Use the up and down arrow keys to move the south drag handle to change the crop selection area",swDragHandle:"Use the arrow keys to move the south west drag handle to change the crop selection area",wDragHandle:"Use the up and down arrow keys to move the west drag handle to change the crop selection area"}};get document(){return document}docMoveBound=!1;mouseDownOnCrop=!1;dragStarted=!1;evData={startClientX:0,startClientY:0,startCropX:0,startCropY:0,clientX:0,clientY:0,isResize:!0};componentRef=(0,t.createRef)();mediaRef=(0,t.createRef)();resizeObserver;initChangeCalled=!1;instanceId=`rc-${h++}`;state={cropIsActive:!1,newCropIsBeingDrawn:!1};getBox(){let e=this.mediaRef.current;if(!e)return{x:0,y:0,width:0,height:0};let{x:t,y:n,width:i,height:r}=e.getBoundingClientRect();return{x:t,y:n,width:i,height:r}}componentDidUpdate(e){let{crop:t,onComplete:n}=this.props;if(n&&!e.crop&&t){let{width:e,height:i}=this.getBox();e&&i&&n(l(t,e,i),a(t,e,i))}}componentWillUnmount(){this.resizeObserver&&this.resizeObserver.disconnect(),this.unbindDocMove()}bindDocMove(){this.docMoveBound||=(this.document.addEventListener("pointermove",this.onDocPointerMove,s),this.document.addEventListener("pointerup",this.onDocPointerDone,s),this.document.addEventListener("pointercancel",this.onDocPointerDone,s),!0)}unbindDocMove(){this.docMoveBound&&=(this.document.removeEventListener("pointermove",this.onDocPointerMove,s),this.document.removeEventListener("pointerup",this.onDocPointerDone,s),this.document.removeEventListener("pointercancel",this.onDocPointerDone,s),!1)}onCropPointerDown=e=>{let{crop:t,disabled:n}=this.props,i=this.getBox();if(!t)return;let r=l(t,i.width,i.height);if(n)return;e.cancelable&&e.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});let a=e.target.dataset.ord,o=e.clientX,s=e.clientY,h=r.x,c=r.y;if(a){let t=e.clientX-i.x,n=e.clientY-i.y,l=0,u=0;"ne"===a||"e"==a?(l=t-(r.x+r.width),u=n-r.y,h=r.x,c=r.y+r.height):"se"===a||"s"===a?(l=t-(r.x+r.width),u=n-(r.y+r.height),h=r.x,c=r.y):"sw"===a||"w"==a?(l=t-r.x,u=n-(r.y+r.height),h=r.x+r.width,c=r.y):("nw"===a||"n"==a)&&(l=t-r.x,u=n-r.y,h=r.x+r.width,c=r.y+r.height),o=h+i.x+l,s=c+i.y+u}this.evData={startClientX:o,startClientY:s,startCropX:h,startCropY:c,clientX:e.clientX,clientY:e.clientY,isResize:!!a,ord:a},this.mouseDownOnCrop=!0,this.setState({cropIsActive:!0})};onComponentPointerDown=e=>{let{crop:t,disabled:n,locked:i,keepSelection:r,onChange:o}=this.props,s=this.getBox();if(n||i||r&&t)return;e.cancelable&&e.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});let h=e.clientX-s.x,c=e.clientY-s.y,u={unit:"px",x:h,y:c,width:0,height:0};this.evData={startClientX:e.clientX,startClientY:e.clientY,startCropX:h,startCropY:c,clientX:e.clientX,clientY:e.clientY,isResize:!0},this.mouseDownOnCrop=!0,o(l(u,s.width,s.height),a(u,s.width,s.height)),this.setState({cropIsActive:!0,newCropIsBeingDrawn:!0})};onDocPointerMove=e=>{let t,{crop:n,disabled:i,onChange:o,onDragStart:s}=this.props,h=this.getBox();if(i||!n||!this.mouseDownOnCrop)return;e.cancelable&&e.preventDefault(),this.dragStarted||(this.dragStarted=!0,s&&s(e));let{evData:c}=this;c.clientX=e.clientX,c.clientY=e.clientY,r(n,t=c.isResize?this.resizeCrop():this.dragCrop())||o(l(t,h.width,h.height),a(t,h.width,h.height))};onComponentKeyDown=t=>{let{crop:n,disabled:r,onChange:o,onComplete:s}=this.props;if(r)return;let h=t.key,c=!1;if(!n)return;let u=this.getBox(),d=this.makePixelCrop(u),m=(navigator.platform.match("Mac")?t.metaKey:t.ctrlKey)?e.nudgeStepLarge:t.shiftKey?e.nudgeStepMedium:e.nudgeStep;if("ArrowLeft"===h?(d.x-=m,c=!0):"ArrowRight"===h?(d.x+=m,c=!0):"ArrowUp"===h?(d.y-=m,c=!0):"ArrowDown"===h&&(d.y+=m,c=!0),c){t.cancelable&&t.preventDefault(),d.x=i(d.x,0,u.width-d.width),d.y=i(d.y,0,u.height-d.height);let e=l(d,u.width,u.height),n=a(d,u.width,u.height);o(e,n),s&&s(e,n)}};onHandlerKeyDown=(t,n)=>{var i,s;let h,{aspect:c=0,crop:u,disabled:d,minWidth:m=0,minHeight:g=0,maxWidth:p,maxHeight:f,onChange:w,onComplete:x}=this.props,y=this.getBox();if(d||!u||"ArrowUp"!==t.key&&"ArrowDown"!==t.key&&"ArrowLeft"!==t.key&&"ArrowRight"!==t.key)return;t.stopPropagation(),t.preventDefault();let b=(navigator.platform.match("Mac")?t.metaKey:t.ctrlKey)?e.nudgeStepLarge:t.shiftKey?e.nudgeStepMedium:e.nudgeStep,v=o((i=l(u,y.width,y.height),s=t.key,h={...i},"ArrowLeft"===s?"nw"===n?(h.x-=b,h.y-=b,h.width+=b,h.height+=b):"w"===n?(h.x-=b,h.width+=b):"sw"===n?(h.x-=b,h.width+=b,h.height+=b):"ne"===n?(h.y+=b,h.width-=b,h.height-=b):"e"===n?h.width-=b:"se"===n&&(h.width-=b,h.height-=b):"ArrowRight"===s&&("nw"===n?(h.x+=b,h.y+=b,h.width-=b,h.height-=b):"w"===n?(h.x+=b,h.width-=b):"sw"===n?(h.x+=b,h.width-=b,h.height-=b):"ne"===n?(h.y-=b,h.width+=b,h.height+=b):"e"===n?h.width+=b:"se"===n&&(h.width+=b,h.height+=b)),"ArrowUp"===s?"nw"===n?(h.x-=b,h.y-=b,h.width+=b,h.height+=b):"n"===n?(h.y-=b,h.height+=b):"ne"===n?(h.y-=b,h.width+=b,h.height+=b):"sw"===n?(h.x+=b,h.width-=b,h.height-=b):"s"===n?h.height-=b:"se"===n&&(h.width-=b,h.height-=b):"ArrowDown"===s&&("nw"===n?(h.x+=b,h.y+=b,h.width-=b,h.height-=b):"n"===n?(h.y+=b,h.height-=b):"ne"===n?(h.y+=b,h.width-=b,h.height-=b):"sw"===n?(h.x-=b,h.width+=b,h.height+=b):"s"===n?h.height+=b:"se"===n&&(h.width+=b,h.height+=b)),h),c,n,y.width,y.height,m,g,p,f);if(!r(u,v)){let e=a(v,y.width,y.height);w(v,e),x&&x(v,e)}};onDocPointerDone=e=>{let{crop:t,disabled:n,onComplete:i,onDragEnd:r}=this.props,o=this.getBox();this.unbindDocMove(),!(n||!t)&&this.mouseDownOnCrop&&(this.mouseDownOnCrop=!1,this.dragStarted=!1,r&&r(e),i&&i(l(t,o.width,o.height),a(t,o.width,o.height)),this.setState({cropIsActive:!1,newCropIsBeingDrawn:!1}))};onDragFocus=()=>{this.componentRef.current?.scrollTo(0,0)};getCropStyle(){let{crop:e}=this.props;if(e)return{top:`${e.y}${e.unit}`,left:`${e.x}${e.unit}`,width:`${e.width}${e.unit}`,height:`${e.height}${e.unit}`}}dragCrop(){let{evData:e}=this,t=this.getBox(),n=this.makePixelCrop(t),r=e.clientX-e.startClientX,a=e.clientY-e.startClientY;return n.x=i(e.startCropX+r,0,t.width-n.width),n.y=i(e.startCropY+a,0,t.height-n.height),n}getPointRegion(e,t,n,i){let{evData:r}=this,a=r.clientX-e.x,l=r.clientY-e.y,o;return o=i&&t?"nw"===t||"n"===t||"ne"===t:l<r.startCropY,(n&&t?"nw"===t||"w"===t||"sw"===t:a<r.startCropX)?o?"nw":"sw":o?"ne":"se"}resolveMinDimensions(e,t,n=0,i=0){let r=Math.min(n,e.width),a=Math.min(i,e.height);return t&&(r||a)?t>1?r?[r,r/t]:[a*t,a]:a?[a*t,a]:[r,r/t]:[r,a]}resizeCrop(){let{evData:t}=this,{aspect:n=0,maxWidth:r,maxHeight:a}=this.props,l=this.getBox(),[s,h]=this.resolveMinDimensions(l,n,this.props.minWidth,this.props.minHeight),c=this.makePixelCrop(l),u=this.getPointRegion(l,t.ord,s,h),d=t.ord||u,m=t.clientX-t.startClientX,g=t.clientY-t.startClientY;(s&&"nw"===d||"w"===d||"sw"===d)&&(m=Math.min(m,-s)),(h&&"nw"===d||"n"===d||"ne"===d)&&(g=Math.min(g,-h));let p={unit:"px",x:0,y:0,width:0,height:0};"ne"===u?(p.x=t.startCropX,p.width=m,n?p.height=p.width/n:p.height=Math.abs(g),p.y=t.startCropY-p.height):"se"===u?(p.x=t.startCropX,p.y=t.startCropY,p.width=m,n?p.height=p.width/n:p.height=g):"sw"===u?(p.x=t.startCropX+m,p.y=t.startCropY,p.width=Math.abs(m),n?p.height=p.width/n:p.height=g):"nw"===u&&(p.x=t.startCropX+m,p.width=Math.abs(m),n?(p.height=p.width/n,p.y=t.startCropY-p.height):(p.height=Math.abs(g),p.y=t.startCropY+g));let f=o(p,n,u,l.width,l.height,s,h,r,a);return n||e.xyOrds.indexOf(d)>-1?c=f:e.xOrds.indexOf(d)>-1?(c.x=f.x,c.width=f.width):e.yOrds.indexOf(d)>-1&&(c.y=f.y,c.height=f.height),c.x=i(c.x,0,l.width-c.width),c.y=i(c.y,0,l.height-c.height),c}renderCropSelection(){let{ariaLabels:n=e.defaultProps.ariaLabels,disabled:i,locked:r,renderSelectionAddon:a,ruleOfThirds:l,crop:o}=this.props,s=this.getCropStyle();if(o)return t.default.createElement("div",{style:s,className:"ReactCrop__crop-selection",onPointerDown:this.onCropPointerDown,"aria-label":n.cropArea,tabIndex:0,onKeyDown:this.onComponentKeyDown,role:"group"},!i&&!r&&t.default.createElement("div",{className:"ReactCrop__drag-elements",onFocus:this.onDragFocus},t.default.createElement("div",{className:"ReactCrop__drag-bar ord-n","data-ord":"n"}),t.default.createElement("div",{className:"ReactCrop__drag-bar ord-e","data-ord":"e"}),t.default.createElement("div",{className:"ReactCrop__drag-bar ord-s","data-ord":"s"}),t.default.createElement("div",{className:"ReactCrop__drag-bar ord-w","data-ord":"w"}),t.default.createElement("div",{className:"ReactCrop__drag-handle ord-nw","data-ord":"nw",tabIndex:0,"aria-label":n.nwDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"nw"),role:"button"}),t.default.createElement("div",{className:"ReactCrop__drag-handle ord-n","data-ord":"n",tabIndex:0,"aria-label":n.nDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"n"),role:"button"}),t.default.createElement("div",{className:"ReactCrop__drag-handle ord-ne","data-ord":"ne",tabIndex:0,"aria-label":n.neDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"ne"),role:"button"}),t.default.createElement("div",{className:"ReactCrop__drag-handle ord-e","data-ord":"e",tabIndex:0,"aria-label":n.eDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"e"),role:"button"}),t.default.createElement("div",{className:"ReactCrop__drag-handle ord-se","data-ord":"se",tabIndex:0,"aria-label":n.seDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"se"),role:"button"}),t.default.createElement("div",{className:"ReactCrop__drag-handle ord-s","data-ord":"s",tabIndex:0,"aria-label":n.sDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"s"),role:"button"}),t.default.createElement("div",{className:"ReactCrop__drag-handle ord-sw","data-ord":"sw",tabIndex:0,"aria-label":n.swDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"sw"),role:"button"}),t.default.createElement("div",{className:"ReactCrop__drag-handle ord-w","data-ord":"w",tabIndex:0,"aria-label":n.wDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"w"),role:"button"})),a&&t.default.createElement("div",{className:"ReactCrop__selection-addon",onPointerDown:e=>e.stopPropagation()},a(this.state)),l&&t.default.createElement(t.default.Fragment,null,t.default.createElement("div",{className:"ReactCrop__rule-of-thirds-hz"}),t.default.createElement("div",{className:"ReactCrop__rule-of-thirds-vt"})))}makePixelCrop(e){return l({...n,...this.props.crop||{}},e.width,e.height)}render(){let{aspect:e,children:n,circularCrop:i,className:r,crop:a,disabled:l,locked:o,style:s,ruleOfThirds:h}=this.props,{cropIsActive:c,newCropIsBeingDrawn:u}=this.state,d=a?this.renderCropSelection():null,m=((...e)=>e.filter(e=>e&&"string"==typeof e).join(" "))("ReactCrop",r,c&&"ReactCrop--active",l&&"ReactCrop--disabled",o&&"ReactCrop--locked",u&&"ReactCrop--new-crop",a&&e&&"ReactCrop--fixed-aspect",a&&i&&"ReactCrop--circular-crop",a&&h&&"ReactCrop--rule-of-thirds",!this.dragStarted&&a&&!a.width&&!a.height&&"ReactCrop--invisible-crop",i&&"ReactCrop--no-animate");return t.default.createElement("div",{ref:this.componentRef,className:m,style:s},t.default.createElement("div",{ref:this.mediaRef,className:"ReactCrop__child-wrapper",onPointerDown:this.onComponentPointerDown},n),a?t.default.createElement("svg",{className:"ReactCrop__crop-mask",width:"100%",height:"100%"},t.default.createElement("defs",null,t.default.createElement("mask",{id:`hole-${this.instanceId}`},t.default.createElement("rect",{width:"100%",height:"100%",fill:"white"}),i?t.default.createElement("ellipse",{cx:`${a.x+a.width/2}${a.unit}`,cy:`${a.y+a.height/2}${a.unit}`,rx:`${a.width/2}${a.unit}`,ry:`${a.height/2}${a.unit}`,fill:"black"}):t.default.createElement("rect",{x:`${a.x}${a.unit}`,y:`${a.y}${a.unit}`,width:`${a.width}${a.unit}`,height:`${a.height}${a.unit}`,fill:"black"}))),t.default.createElement("rect",{fill:"black",fillOpacity:.5,width:"100%",height:"100%",mask:`url(#hole-${this.instanceId})`})):void 0,d)}};e.s(["f",0,c])},12130,271945,e=>{var t=e.i(843476),n=e.i(271645),i=e.i(232660),r=e.i(519455),a=e.i(776639),l=e.i(263676),o=e.i(111110);async function s(e,t){let{naturalWidth:n,naturalHeight:i}=e;return Promise.all(t.map(t=>new Promise((r,a)=>{let l=document.createElement("canvas"),o=Math.round(t.x*n),s=Math.round(t.y*i);l.width=Math.max(1,Math.round(t.width*n)),l.height=Math.max(1,Math.round(t.height*i));let h=l.getContext("2d");h?(h.drawImage(e,o,s,l.width,l.height,0,0,l.width,l.height),l.toBlob(e=>e?r(e):a(Error("Canvas is empty")),"image/jpeg",.95)):a(Error("Canvas is not supported"))})))}let h={maxHeight:"65vh",maxWidth:"100%",objectFit:"contain"},c=(0,n.forwardRef)(function({imageSrc:e,regions:i,onChange:r,imageStyle:a=h,onImageLoad:s},c){let{t:u}=(0,o.b)(),d=(0,n.useRef)(null),m=(0,n.useRef)(null),[g,p]=(0,n.useState)(null),f=e=>{let t=d.current.getBoundingClientRect();return{x:(e.clientX-t.left)/t.width,y:(e.clientY-t.top)/t.height}},w=()=>{g&&g.width>=.02&&g.height>=.02&&r([...i,g]),m.current=null,p(null)},x=e=>({left:`${100*e.x}%`,top:`${100*e.y}%`,width:`${100*e.width}%`,height:`${100*e.height}%`});return(0,t.jsxs)("div",{className:"relative inline-block select-none",children:[(0,t.jsx)("img",{ref:c,src:e,alt:"",draggable:!1,style:a,onLoad:s,className:"block"}),(0,t.jsxs)("div",{ref:d,className:"absolute inset-0 cursor-crosshair",style:{touchAction:"none"},onPointerDown:e=>{0===e.button&&(d.current?.setPointerCapture(e.pointerId),m.current=f(e),p(null))},onPointerMove:e=>{var t,n,i,r;let a,l,o;if(!m.current)return;let s=f(e);p((t=m.current.x,n=m.current.y,i=s.x,r=s.y,l=(a=e=>Math.min(1,Math.max(0,e)))(Math.min(t,i)),o=a(Math.min(n,r)),{x:l,y:o,width:a(Math.max(t,i))-l,height:a(Math.max(n,r))-o}))},onPointerUp:w,onPointerCancel:w,children:[i.map((e,n)=>(0,t.jsxs)("div",{className:"absolute border-2 border-sky-400 bg-sky-400/15",style:x(e),children:[(0,t.jsx)("span",{className:"absolute left-0 top-0 bg-sky-500 px-1.5 text-xs font-bold text-white",children:n+1}),(0,t.jsx)("button",{type:"button",className:"absolute -right-3 -top-3 flex h-6 w-6 items-center justify-center rounded-full bg-red-500 text-white shadow","aria-label":u.batchImport.removeRegion.replace("{index}",String(n+1)),onPointerDown:e=>e.stopPropagation(),onClick:()=>r(i.filter((e,t)=>t!==n)),children:(0,t.jsx)(l.X,{className:"h-3 w-3"})})]},n)),g&&(0,t.jsx)("div",{className:"absolute border-2 border-dashed border-yellow-300 bg-yellow-300/10",style:x(g)})]})]})});var u=e.i(456420);let d={name:"zoom-in",size:24,node:[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]};d.node;let m=(0,u.f)(d),g={name:"zoom-out",size:24,node:[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]};g.node;let p=(0,u.f)(g);function f({zoom:e,onZoomIn:n,onZoomOut:i,onReset:r}){let{t:a}=(0,o.b)(),l="outline-none focus-visible:ring-2 focus-visible:ring-white/70",s=`flex h-9 w-9 items-center justify-center rounded-full text-white transition-colors hover:bg-white/20 disabled:opacity-40 disabled:hover:bg-transparent ${l}`;return(0,t.jsxs)("div",{className:"flex items-center gap-0.5 rounded-full bg-black/60 p-1 shadow-lg backdrop-blur-sm",children:[(0,t.jsx)("button",{type:"button",className:s,onClick:i,disabled:e<=1,"aria-label":a.common.cropper.zoomOut,title:a.common.cropper.zoomOut,children:(0,t.jsx)(p,{className:"h-4 w-4"})}),(0,t.jsxs)("button",{type:"button",className:`h-9 min-w-14 rounded-full px-2 text-center text-xs font-medium tabular-nums text-white hover:bg-white/20 ${l}`,onClick:r,"aria-label":a.common.cropper.resetZoom,title:a.common.cropper.resetZoom,children:[Math.round(100*e),"%"]}),(0,t.jsx)("button",{type:"button",className:s,onClick:n,disabled:e>=5,"aria-label":a.common.cropper.zoomIn,title:a.common.cropper.zoomIn,children:(0,t.jsx)(m,{className:"h-4 w-4"})})]})}var w=e.i(201276),x=e.i(804536);let y="image-cropper-mode",b=["single","auto","multi"];e.s(["U",0,b,"p",0,y,"S",0,["image","text","file","direct"],"c",0,"question-input-mode","k",0,["image","text"]],271945);let v={single:{maxHeight:"70vh",maxWidth:"100%",objectFit:"contain"},auto:{maxHeight:"65vh",maxWidth:"100%",objectFit:"contain"},multi:{maxHeight:"65vh",maxWidth:"100%",objectFit:"contain"}};e.s(["f",0,function({imageSrc:e,open:l,onClose:h,onCropComplete:u,onMultiCropComplete:d,onRegionsSelected:m,allowMulti:g=!0,onAutoSplit:p,onAddPart:C,partCount:k=0}){let{t:M}=(0,o.b)(),D=/^(blob:|data:image\/)/i.test(e)?e:void 0,[E,_]=(0,n.useState)(),j=(0,n.useRef)(null),[R,I]=(0,x.y)(y,b,"single"),S=["single",...p?["auto"]:[],...d||m&&g?["multi"]:[]],N=S.includes(R)?R:"single",{containerRef:$,zoom:P,imageStyle:L,measureImage:A,zoomIn:H,zoomOut:O,reset:U}=function(e){let[t,i]=(0,n.useState)(null),r=(0,n.useRef)(null),a=(0,n.useCallback)(e=>{r.current=e,i(e)},[]),[l,o]=(0,n.useState)(1),s=(0,n.useRef)(1),[h,c]=(0,n.useState)(null),u=(0,n.useRef)(null),d=(0,n.useRef)(!1),m=(0,n.useCallback)((e,t,n)=>{let i=r.current,a=s.current,l=Math.min(5,Math.max(1,e));if(!i||l===a)return;if(1===a){let e=i.querySelector("img");e&&c(e.clientWidth)}let h=i.getBoundingClientRect(),d=(t??h.left+h.width/2)-h.left,m=(n??h.top+h.height/2)-h.top;u.current={viewX:d,viewY:m,contentX:i.scrollLeft+d,contentY:i.scrollTop+m,ratio:l/a},s.current=l,o(l)},[]);(0,n.useLayoutEffect)(()=>{let e=r.current,t=u.current;e&&t&&(e.scrollLeft=t.contentX*t.ratio-t.viewX,e.scrollTop=t.contentY*t.ratio-t.viewY,u.current=null)},[l]),(0,n.useEffect)(()=>{if(!t)return;let e=e=>{e.preventDefault(),m(s.current*Math.exp(-(.0015*e.deltaY)),e.clientX,e.clientY)},n=null,i=e=>{let[t,n]=[e[0],e[1]];return{distance:Math.hypot(t.clientX-n.clientX,t.clientY-n.clientY),centerX:(t.clientX+n.clientX)/2,centerY:(t.clientY+n.clientY)/2}},r=e=>{2===e.touches.length&&(n={distance:i(e.touches).distance,zoom:s.current},d.current=!0)},a=e=>{if(!n||2!==e.touches.length)return;e.preventDefault();let{distance:t,centerX:r,centerY:a}=i(e.touches);n.distance>0&&m(n.zoom*(t/n.distance),r,a)},l=e=>{e.touches.length<2&&(n=null,d.current=!1)},o=e=>{d.current&&e.stopPropagation()};return t.addEventListener("wheel",e,{passive:!1}),t.addEventListener("touchstart",r,{passive:!0}),t.addEventListener("touchmove",a,{passive:!1}),t.addEventListener("touchend",l),t.addEventListener("touchcancel",l),t.addEventListener("pointermove",o,{capture:!0}),()=>{t.removeEventListener("wheel",e),t.removeEventListener("touchstart",r),t.removeEventListener("touchmove",a),t.removeEventListener("touchend",l),t.removeEventListener("touchcancel",l),t.removeEventListener("pointermove",o,{capture:!0})}},[t,m]);let g=(0,n.useCallback)(e=>{e&&1===s.current&&c(e.clientWidth)},[]),p=(0,n.useCallback)(()=>m(1.25*s.current),[m]),f=(0,n.useCallback)(()=>m(s.current/1.25),[m]),w=(0,n.useCallback)(()=>{s.current=1,u.current=null,o(1)},[]),x=1!==l&&h?{...e,width:h*l,height:"auto",maxWidth:"none",maxHeight:"none"}:e;return{containerRef:a,zoom:l,imageStyle:x,measureImage:g,zoomIn:p,zoomOut:f,reset:w}}(v[N]);(0,n.useEffect)(()=>{U()},[e,U]);let[X,Y]=(0,n.useState)({src:e,regions:[]}),B=X.src===e?X.regions:[],T=t=>Y({src:e,regions:t}),z=(0,n.useRef)(null),K={single:M.batchImport.singleMode,auto:M.batchImport.autoMode,multi:M.batchImport.multiMode},F=async()=>{if(0!==B.length){if(m){m(B,!0),T([]);return}if(z.current&&d)try{d(await s(z.current,B)),T([])}catch(e){w.V.error("[ImageCropper]","Multi-image crop failed",{error:e})}}},q=()=>E&&E.width>0&&E.height>0?{x:E.x/100,y:E.y/100,width:E.width/100,height:E.height/100}:{x:0,y:0,width:1,height:1},W=async()=>{let e=q();if("auto"===N&&p)return void p(e);if(m)return void m([e],!1);if(j.current&&u)try{let[t]=await s(j.current,[e]);u(t)}catch(e){w.V.error("[ImageCropper]","Crop failed",{error:e})}};return(0,t.jsx)(a.N,{open:l,onOpenChange:e=>!e&&h(),children:(0,t.jsxs)(a.d,{className:"max-w-3xl h-[90vh] flex flex-col p-0 gap-0",children:[(0,t.jsx)(a.s,{className:"p-4 border-b shrink-0",children:(0,t.jsx)(a.F,{children:M.common.cropper?.title||"Crop Image"})}),(0,t.jsxs)("div",{className:"relative min-h-0 flex-1 bg-black",children:[(0,t.jsx)("div",{ref:$,className:"flex h-full w-full overflow-auto p-4",children:(0,t.jsx)("div",{className:"m-auto",children:"multi"===N?(0,t.jsx)(c,{ref:z,imageSrc:D,regions:B,onChange:T,imageStyle:L,onImageLoad:e=>A(e.currentTarget)}):(0,t.jsx)(i.f,{crop:E,onChange:(e,t)=>_(t),children:(0,t.jsx)("img",{ref:j,alt:"Crop me",src:D,onLoad:function(e){_({unit:"%",x:0,y:0,width:100,height:100}),A(e.currentTarget)},style:L})})})}),(0,t.jsx)("div",{className:"absolute right-3 top-3",children:(0,t.jsx)(f,{zoom:P,onZoomIn:H,onZoomOut:O,onReset:U})})]}),(0,t.jsxs)("div",{className:"p-4 border-t bg-background shrink-0 space-y-3",children:[S.length>1&&(0,t.jsx)("div",{className:`grid gap-1 rounded-md bg-muted p-1 ${3===S.length?"grid-cols-3 sm:w-[28rem]":"grid-cols-2 sm:w-80"}`,children:S.map(e=>(0,t.jsx)("button",{type:"button","aria-pressed":N===e,onClick:()=>{U(),I(e)},className:`rounded px-2 py-1.5 text-sm font-medium transition-colors ${N===e?"bg-background shadow-sm":"text-muted-foreground"}`,children:K[e]},e))}),(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row sm:justify-between sm:items-center gap-3",children:[(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:"multi"===N?`${M.batchImport.hint} ${M.batchImport.regionCount.replace("{count}",String(B.length))}`:"auto"===N?M.batchImport.autoHint:k>0?M.upload.parts.cropHint.replace("{n}",String(k+1)):M.common.cropper?.hint||"💡 Drag to adjust crop area"}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2 justify-end",children:["multi"===N&&B.length>0&&(0,t.jsx)(r.f,{variant:"ghost",onClick:()=>T([]),children:M.batchImport.clear}),(0,t.jsx)(r.f,{variant:"outline",onClick:h,children:M.common.cancel||"Cancel"}),"multi"===N?(0,t.jsx)(r.f,{onClick:F,disabled:0===B.length,children:M.batchImport.start.replace("{count}",String(B.length))}):(0,t.jsxs)(t.Fragment,{children:["single"===N&&C&&(0,t.jsx)(r.f,{variant:"secondary",onClick:()=>C(q()),"data-testid":"crop-add-part",children:M.upload.parts.addNext}),(0,t.jsx)(r.f,{onClick:W,children:"auto"===N?M.batchImport.autoStart:k>0?M.upload.parts.confirm.replace("{count}",String(k+1)):M.common.confirm||"Confirm"})]})]})]})]})]})})}],12130)},574041,e=>{var t=e.i(843476),n=e.i(271645),i=e.i(263676),r=e.i(487486),a=e.i(793479),l=e.i(41931),o=e.i(201276);e.s(["f",0,function({value:e=[],onChange:s,placeholder:h="Enter tags...",className:c="",enterHint:u,subject:d,gradeStage:m}){let[g,p]=(0,n.useState)(""),[f,w]=(0,n.useState)([]),[x,y]=(0,n.useState)(!1),[b,v]=(0,n.useState)(0),C=(0,n.useRef)(null),k=(0,n.useRef)(null),M=(0,n.useCallback)(async t=>{try{let n=new URLSearchParams({q:t});d&&n.append("subject",d),m&&n.append("stage",m);let i=((await l.k.get(`/api/tags/suggestions?${n.toString()}`)).suggestions||[]).filter(t=>!e.includes(t));w(i.slice(0,20)),y(i.length>0),v(0)}catch(e){o.V.error("[TagInput]","Failed to fetch suggestions",{error:e})}},[d,m,e]);(0,n.useEffect)(()=>{g.trim()&&M(g)},[g,M]);let D=t=>{t.trim()&&!e.includes(t.trim())&&(s([...e,t.trim()]),p(""),w([]),y(!1),v(0))},E=t=>{s(e.filter(e=>e!==t))};return(0,n.useEffect)(()=>{let e=e=>{!k.current||k.current.contains(e.target)||C.current?.contains(e.target)||y(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),(0,t.jsxs)("div",{className:`relative ${c}`,children:[(0,t.jsxs)("div",{className:"flex flex-wrap gap-2 p-2 border rounded-lg bg-background min-h-[42px]",children:[e.map(e=>(0,t.jsxs)(r.f,{variant:"secondary",className:"flex items-center gap-1 px-2 py-1",children:[e,(0,t.jsx)("button",{type:"button",onClick:()=>E(e),className:"hover:text-destructive ml-1",children:(0,t.jsx)(i.X,{className:"h-3 w-3"})})]},e)),(0,t.jsx)(a.f,{ref:C,type:"text",value:g,onChange:e=>{p(e.target.value),e.target.value.trim()||(w([]),y(!1))},onKeyDown:t=>{"Enter"===t.key?(t.preventDefault(),b>=0&&f[b]?D(f[b]):g.trim()&&D(g)):"ArrowDown"===t.key?(t.preventDefault(),v(e=>Math.min(e+1,f.length-1))):"ArrowUp"===t.key?(t.preventDefault(),v(e=>Math.max(e-1,0))):"Escape"===t.key?(y(!1),v(0)):"Backspace"===t.key&&!g&&e.length>0&&E(e[e.length-1])},onFocus:()=>{f.length>0&&y(!0)},placeholder:0===e.length?h:"",className:"flex-1 min-w-[120px] border-none focus-visible:ring-0 focus-visible:ring-offset-0 h-8 px-0"})]}),x&&f.length>0&&(0,t.jsx)("div",{ref:k,className:"absolute z-50 w-full mt-1 bg-popover border rounded-md shadow-md max-h-48 overflow-y-auto",children:f.map((e,n)=>(0,t.jsx)("div",{className:`px-3 py-2 cursor-pointer hover:bg-accent ${n===b?"bg-accent":""}`,onClick:()=>D(e),onMouseEnter:()=>v(n),children:e},e))}),g&&!x&&(0,t.jsx)("div",{className:"text-xs text-muted-foreground mt-1",children:u?`${u} "${g}"`:`Press Enter to create "${g}"`})]})}])},185592,e=>{var t=e.i(843476),n=e.i(975157);e.s(["f",0,function({options:e,value:i,onChange:r,className:a}){return(0,t.jsx)("div",{className:(0,n.f)("grid gap-1 rounded-xl bg-muted p-1",a),style:{gridTemplateColumns:`repeat(${e.length}, minmax(0, 1fr))`},role:"tablist",children:e.map(({value:e,label:a,icon:l})=>{let o=e===i;return(0,t.jsxs)("button",{type:"button",role:"tab","aria-selected":o,className:(0,n.f)("flex items-center justify-center gap-1.5 rounded-lg px-2 py-2.5 text-sm font-medium transition-all",o?"bg-card text-primary shadow-sm":"text-muted-foreground hover:text-foreground"),onClick:()=>r(e),children:[l&&(0,t.jsx)(l,{className:"h-4 w-4 shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:a})]},e)})})}])},804536,e=>{var t=e.i(271645);let n=new Map,i=new Set;function r(e){return i.add(e),window.addEventListener("storage",e),()=>{i.delete(e),window.removeEventListener("storage",e)}}function a(e,a,l){let o=(0,t.useSyncExternalStore)(r,()=>(function(e){if(n.has(e))return n.get(e)??null;try{return window.localStorage.getItem(e)}catch{return null}})(e),()=>null);return[(0,t.useMemo)(()=>a(o),[a,o]),(0,t.useCallback)(t=>(function(e,t){try{window.localStorage.setItem(e,t),n.delete(e)}catch{n.set(e,t)}i.forEach(e=>e())})(e,l(t)),[e,l])]}let l=e=>e;e.s(["y",0,function(e,n,i){return a(e,(0,t.useCallback)(e=>n.includes(e??"")?e:i,[n,i]),l)},"x",0,a])},213761,e=>{let t={maxLongEdge:4096,maxPixels:4915200,maxBytes:1572864,startQuality:.9,minQuality:.8};class n extends Error{code;format;constructor(e,t,n){super(e,void 0===n?void 0:{cause:n}),this.code=e,this.format=t,this.name="ImageDecodeError"}}let i=new Set(["heic","heix","heim","heis","hevc","hevx","hevm","hevs"]),r=new Set(["mif1","msf1","mif2"]),a=new Set(["avif","avis"]);function l(e,n,i=t){let r=Math.min(1,i.maxLongEdge/Math.max(e,n),Math.sqrt(i.maxPixels/Math.max(1,e*n)));return{width:Math.max(1,Math.floor(e*r)),height:Math.max(1,Math.floor(n*r)),scale:r}}async function o(e){let t,n;if("function"==typeof createImageBitmap)try{return await createImageBitmap(e,{imageOrientation:"from-image"})}catch{}let i=await (t=URL.createObjectURL(e),(n=new Image).decoding="async",new Promise((e,i)=>{n.onload=()=>e(n),n.onerror=()=>i(Error("IMAGE_ELEMENT_DECODE_FAILED")),n.src=t}).finally(()=>URL.revokeObjectURL(t)));if(!i.naturalWidth||!i.naturalHeight)throw Error("IMAGE_EMPTY");return i}async function s(t){let{heicTo:n}=await e.A(462684);return n({blob:t,type:"image/jpeg",quality:.95})}function h(e,t){return new Promise((n,i)=>{e.toBlob(e=>e?n(e):i(Error("CANVAS_EMPTY")),"image/jpeg",t)})}function c(e,t,n,i,r,a,l){let o,s=((o=document.createElement("canvas")).width=a,o.height=l,o),h=s.getContext("2d");if(!h)throw Error("CANVAS_UNSUPPORTED");return h.fillStyle="#ffffff",h.fillRect(0,0,a,l),h.imageSmoothingEnabled=!0,h.imageSmoothingQuality="high",h.drawImage(e,t,n,i,r,0,0,a,l),s}async function u(e,t){var u;let d,m=performance.now(),g=await e.arrayBuffer(),p=performance.now()-m,f=function(e){let t=(t,n)=>String.fromCharCode(...e.subarray(t,n));if(e.length>=3&&255===e[0]&&216===e[1]&&255===e[2])return"jpeg";if(e.length>=8&&137===e[0]&&"PNG"===t(1,4))return"png";if(e.length>=12&&"RIFF"===t(0,4)&&"WEBP"===t(8,12))return"webp";if(e.length>=6&&("GIF87a"===t(0,6)||"GIF89a"===t(0,6)))return"gif";if(e.length>=2&&"BM"===t(0,2))return"bmp";if(e.length>=12&&"ftyp"===t(4,8)){let n=Math.min(e.length,(e[0]<<24|e[1]<<16|e[2]<<8|e[3])>>>0||e.length),l=[t(8,12)];for(let e=16;e+4<=n;e+=4)l.push(t(e,e+4));if(l.some(e=>i.has(e)))return"heic";if(l.some(e=>a.has(e)))return"avif";if(l.some(e=>r.has(e)))return"heic"}return"unknown"}(new Uint8Array(g,0,Math.min(g.byteLength,64))),w=e.type||"",x=performance.now(),y="native",b=new Blob([g],{type:w||"application/octet-stream"});try{d=await o(b)}catch(e){if("heic"!==f)throw new n("unknown"===f?"UNSUPPORTED_IMAGE":"IMAGE_DECODE_FAILED",f,e);t?.();try{d=await o(await s(b)),y="heic"}catch(e){throw new n("HEIC_DECODE_FAILED",f,e)}}let{width:v,height:C}=(u=d)instanceof HTMLImageElement?{width:u.naturalWidth,height:u.naturalHeight}:{width:u.width,height:u.height};if(!v||!C)throw new n("IMAGE_DECODE_FAILED",f);let k=l(v,C,{maxLongEdge:1600,maxPixels:1/0}),M=await h(c(d,0,0,v,C,k.width,k.height),.85),D=URL.createObjectURL(M),E=performance.now()-x;return{source:d,width:v,height:C,format:f,decoder:y,previewUrl:D,sourceType:w,sourceBytes:e.size,timings:{read:Math.round(p),convert:Math.round(E)},dispose:()=>{URL.revokeObjectURL(D),d instanceof HTMLImageElement||d.close()}}}let d={x:0,y:0,width:1,height:1};async function m(e,n=d,i=t){var r;let a=performance.now(),o=e=>Math.min(1,Math.max(0,e)),s=Math.round(o(n.x)*e.width),u=Math.round(o(n.y)*e.height),g=Math.max(1,Math.min(e.width-s,Math.round(o(n.width)*e.width))),p=Math.max(1,Math.min(e.height-u,Math.round(o(n.height)*e.height))),f=l(g,p,i),w=c(e.source,s,u,g,p,f.width,f.height),x=performance.now()-a,y=performance.now(),b=i.startQuality,v=await h(w,b);for(let t=0;v.size>i.maxBytes&&t<12;t++)b-.05>=i.minQuality-1e-9?b=Math.round((b-.05)*100)/100:(f={width:Math.max(1,Math.floor(.85*f.width)),height:Math.max(1,Math.floor(.85*f.height)),scale:.85*f.scale},w=c(e.source,s,u,g,p,f.width,f.height)),v=await h(w,b);return{dataUrl:await (r=v,new Promise((e,t)=>{let n=new FileReader;n.onload=()=>e(n.result),n.onerror=()=>t(n.error??Error("READ_FAILED")),n.readAsDataURL(r)})),width:f.width,height:f.height,bytes:v.size,quality:b,timings:{crop:Math.round(x),compress:Math.round(performance.now()-y)}}}e.s(["K",0,t,"o",0,n,"N",0,function(e,t){return{sourceType:e.sourceType||e.format,sourceBytes:e.sourceBytes,sourceWidth:e.width,sourceHeight:e.height,outputWidth:t.width,outputHeight:t.height,outputBytes:t.bytes,decoder:e.decoder,quality:t.quality}},"p",0,u,"X",0,m])},499930,e=>{var t=e.i(213761);function n(e,t=.008){let i=Math.max(0,e.x-t),r=Math.max(0,e.y-t);return{x:i,y:r,width:Math.min(1,e.x+e.width+t)-i,height:Math.min(1,e.y+e.height+t)-r}}async function i(e){let t=new Image;if(t.decoding="async",t.src=e,await t.decode(),!t.naturalWidth||!t.naturalHeight)throw Error("IMAGE_EMPTY");return t}async function r(e,n){let i=function(e,t=16,n=!1){let i=Math.max(...e.map(e=>e.width)),r=0,a=e.map(e=>{let a=n?i/e.width:e.scale??1,l={x:0,y:r,width:Math.round(e.width*a),height:Math.round(e.height*a)};return r+=l.height+t,l});return{width:Math.max(...a.map(e=>e.width)),height:r-t,rects:a}}(e.map(e=>({width:e.sw,height:e.sh,scale:e.scale})),16,n),r=document.createElement("canvas");r.width=i.width,r.height=i.height;let a=r.getContext("2d");if(!a)throw Error("CANVAS_UNSUPPORTED");a.fillStyle="#ffffff",a.fillRect(0,0,r.width,r.height),e.forEach((e,t)=>{let n=i.rects[t];a.drawImage(e.source,e.sx,e.sy,e.sw,e.sh,n.x,n.y,n.width,n.height)});let l=await createImageBitmap(r);try{return await (0,t.X)({source:l,width:r.width,height:r.height})}finally{l.close()}}async function a(e,i){let a=e.naturalWidth,l=e.naturalHeight,o=i.map(e=>n(e));return 1===o.length?(0,t.X)({source:e,width:a,height:l},o[0]):r(o.map(t=>({source:e,sx:Math.round(t.x*a),sy:Math.round(t.y*l),sw:Math.max(1,Math.round(t.width*a)),sh:Math.max(1,Math.round(t.height*l))})),!1)}async function l(e){return r((await Promise.all(e.map(i))).map(e=>({source:e,sx:0,sy:0,sw:e.naturalWidth,sh:e.naturalHeight})),!0)}async function o(e,t,i){let a=e.naturalWidth,l=e.naturalHeight,o=i.width/a,s=t.map(e=>n(e)).map(t=>({source:e,sx:Math.round(t.x*a),sy:Math.round(t.y*l),sw:Math.max(1,Math.round(t.width*a)),sh:Math.max(1,Math.round(t.height*l)),scale:o}));return s.push({source:i.source,sx:0,sy:0,sw:i.width,sh:i.height}),r(s,!1)}e.s(["y",0,i,"k",0,o,"M",0,a,"v",0,l])},119472,e=>{var t=e.i(41931),n=e.i(127175);async function i(e){let t;for(let n=0;n<3;n++)try{return await e()}catch(e){if(t=e,!function(e){let t=e?.status;return void 0===t||408===t||502===t||503===t||504===t}(e)||2===n)break;await new Promise(e=>setTimeout(e,1e3*(n+1)))}throw t}async function r(e,a=(0,n.c)()){let{batch:l}=await i(()=>t.k.post("/api/import-batches",{...e,clientRequestId:a,subjectId:e.subjectId||void 0,targetSubjectId:e.targetSubjectId||void 0,paperLevel:e.paperLevel||void 0,items:e.items?.map(e=>({...e})),origin:e.origin},{timeout:12e4}));return(0,n.P)(),l}async function a(e,n={}){let i=n.image?"?include=image":"",{batch:r}=await t.k.get(`/api/import-batches/${encodeURIComponent(e)}${i}`);return r}async function l(e,n,i){let{batch:r}=await t.k.patch(`/api/import-batches/${encodeURIComponent(e)}`,{version:n,draft:i});return r}async function o(e,r,a,l){let{batch:o}=await i(()=>t.k.post(`/api/import-batches/${encodeURIComponent(e)}/start`,{version:r,images:a,analysis:l},{timeout:12e4}));return(0,n.P)(),o}async function s(e){let{batch:i}=await t.k.post(`/api/import-batches/${encodeURIComponent(e)}/retry`,{});return(0,n.P)(),i}async function h(e){let i=await t.k.post(`/api/import-batches/${encodeURIComponent(e)}/confirm-all`,{});return(0,n.P)(),i}async function c(e){await t.k.delete(`/api/import-batches/${encodeURIComponent(e)}`),(0,n.P)()}async function u(e){await t.k.post(`/api/import-batches/${encodeURIComponent(e)}/read`,{}),(0,n.P)()}async function d(e,n,i){return t.k.post(`/api/import-batches/${encodeURIComponent(e)}/fix-text`,{items:n},{timeout:6e5,recoverable:!0,requestId:i})}e.s(["J",0,h,"n",0,function(e){return e?.status===409?e.data?.details?.batch??null:null},"v",0,r,"o",0,c,"w",0,a,"$",0,d,"f",0,u,"s",0,s,"S",0,l,"g",0,o])},25197,e=>{var t=e.i(41931);function n(e){return e.trim()?e:""}async function i(){try{return!!(await t.k.get("/api/user")).confirmBeforeImport}catch{return!1}}async function r(e,i){let r=await t.k.post("/api/error-items",{questionText:e.questionText,answerText:n(e.answerText),analysis:n(e.analysis),wrongAnswerText:e.wrongAnswerText||null,mistakeAnalysis:e.mistakeAnalysis||null,mistakeStatus:e.mistakeStatus||"unknown",knowledgePoints:e.knowledgePoints||[],difficultyStars:e.difficultyStars??null,recognizedGradeSemester:e.gradeSemester??null,hasFigure:e.hasFigure??!1,figureSvg:e.figureSvg??null,questionType:e.questionType??null,subjectId:i.subjectId||void 0,subjectName:i.subjectId?void 0:e.subject,originalImageUrl:i.imageUrl||"",paperLevel:i.paperLevel||void 0});return{id:r.id,shortId:r.shortId??null,subjectId:r.subjectId??null,notebookName:r.subject?.name??null,duplicate:r.duplicate}}e.i(201276),e.s(["x",0,i,"a",0,r],25197)},825624,e=>{let t=/^[\s ]+/,n="一二三四五六七八九十",i=[{family:"dot",pattern:/^(\d{1,3})\s*(?:.|\.(?!\d))\s*/},{family:"comma",pattern:/^(\d{1,3})\s*[、,,](?!\d)\s*/},{family:"paren",pattern:/^(\d{1,3})\s*[))]\s*/},{family:"colon",pattern:/^(\d{1,3})\s*[::](?!\d)\s*/},{family:"ti",pattern:/^第\s*(\d{1,3}|[一二三四五六七八九十]{1,3})\s*题\s*[..、::]?\s*/},{family:"example",pattern:/^(?:例题?|练习|习题)\s*(\d{1,3})\s*[..、::]?\s*/},{family:"q",pattern:/^(?:Q|Question|Problem|Exercise)\s*(\d{1,3})\s*[..::)]?\s+/i},{family:"cn",pattern:/^([一二三四五六七八九十]{1,3})\s*[、..]\s*/}];function r(e){let r=e.replace(t,"");for(let{family:e,pattern:t}of i){let i=r.match(t);if(!i||r.length<=i[0].length)continue;let a=function(e){if(/^\d+$/.test(e))return Number(e);if("十"===e)return 10;let t=e.indexOf("十");return -1===t?n.indexOf(e)+1:10*(0===t?1:n.indexOf(e[0])+1)+(t===e.length-1?0:n.indexOf(e[t+1])+1)}(i[1]);if(Number.isFinite(a)&&!(a<=0))return{value:a,family:e,prefixLength:i[0].length,label:i[1]}}return null}function a(e){let n=e.split("\n"),i=n[0]?.replace(t,"")??"",a=r(i);return a&&"cn"!==a.family&&(n[0]=i.slice(a.prefixLength)),n.join("\n")}function l(e){let t=[];for(let n of e)(n||0!==t.length&&""!==t[t.length-1])&&t.push(n);for(;t.length>0&&""===t[t.length-1];)t.pop();return t.join("\n")}let o=/(姓名|班级|学号|日期|得分|分数|评分|考号|座位号|家长签字|用时|Name\s*[::_]|Class\s*[::_]|Date\s*[::_]|Score\s*[::_])|_{3,}|共\s*\d+\s*(道|题|小题)|做完|答案(见|在)|最后一页|满分\s*\d+\s*分/i,s=/(阅读|材料|短文|文章|选文|诗歌|古诗|文言文|下[面列]的?(表格|图表|统计|信息)|根据.{0,20}(回答|完成)|passage|read the|according to the)/i,h=/^(参考答案|答案与解析|答案|Answers?|Answer Key)\s*[::]?$/i,c=/^(第[一二三四五六七八九十]+(部分|大题|节)|(Part|Section)\s+[A-Z0-9IVX]+\b)/i,u=/(选择|填空|判断|计算|解答|应用|解决问题|操作|作图|阅读|写作|作文|综合|口算|听力|单项|完形|题)/,d=/(\d{1,3})\s*[~~\-—–至到]\s*(\d{1,3})\s*(?:小?题|questions?)/i,m=/(小问|小题|下列问题|以下问题|下列各题|下面各题|完成下列|回答下列|回答以下|following questions|answer the following)/i;function g(e){let t=[],n=[];for(let i of e)i?n.push(i):n.length&&(t.push(n.join("\n")),n=[]);return n.length&&t.push(n.join("\n")),t}function p(e,t=[]){let n=e.trim();return!(!n||n.length>12||/[。!?!?,,、;;::..()()【】\[\]{}]$/.test(n)||/\d/.test(n)||/[。!?!?;;,,]/.test(n))&&!!(/(篇|章|节|部分|组)$/.test(n)||/^(Part|Section)\s+[A-Z0-9]+$/i.test(n))&&(!t.length||t.some(e=>{let t=r(e);return null!==t&&1===t.value}))}function f(e,t){let n=[];for(let i=0;i<e.length;i++){let r=e[i],a=[r];for(let n=i+1;n<e.length;n++){let i=e[n],l=a[a.length-1];if(i.family!==r.family)continue;let o=1===i.value&&[...t].some(e=>e>l.line&&e<i.line);(i.value===l.value+1||o)&&a.push(i)}a.length>n.length&&(n=a)}return n}function w(e,t,n){return!!c.test(e)||!!t&&"cn"===t.family&&"cn"!==n&&null!==n&&(e.length<=40||u.test(e.slice(0,20)))}function x(e,t,n,i,r){for(let a=e-1;a>=0;a--)if(t[a]){if(r.has(a)||w(t[a],n[a],i)||p(t[a]))return t[a];break}return null}function y(e){let t=e.match(d);if(!t)return null;let n=Number(t[1]),i=Number(t[2]);return n<=i?{from:n,to:i}:null}let b={answer:/^(?:【\s*(?:参考答案|答案)\s*】|(?:参考答案|答案)\s*[::]|Answer\s*[::])\s*(.*)$/i,analysis:/^(?:【\s*(?:解析|分析|详解|解答|点评)\s*】|(?:解析|分析|详解|解答|点评)\s*[::])\s*(.*)$/,knowledge:/^(?:【\s*(?:知识点|考点)\s*】|(?:知识点|考点)\s*[::])\s*(.*)$/,difficulty:/^(?:【\s*难度\s*】|难度\s*[::])\s*(.*)$/,questionType:/^(?:【\s*题型\s*】|题型\s*[::])\s*(.*)$/,wrongAnswer:/^(?:【\s*错答\s*】|我的答案\s*[::]|学生答案\s*[::])\s*(.*)$/},v={易:1,较易:2,中等:3,较难:4,难:5};function C(e){return e.split(/[、,,;;]/).map(e=>e.trim()).filter(Boolean)}function k(e){let t={answer:[],analysis:[],knowledge:[],difficulty:[],questionType:[],wrongAnswer:[]},n=[],i=null;for(let r of e){let e=null;for(let n of Object.keys(b)){let a=r.match(b[n]);if(!a)continue;e=n,i=n;let l=a[1].trim();l&&t[n].push(l);break}e||(i&&r.trim()?t[i].push(r.trim()):n.push(r))}let r={},a=t.answer.join("\n").trim();a&&(r.answer=a);let o=t.analysis.join("\n").trim();o&&(r.analysis=o);let s=t.knowledge.flatMap(C);s.length&&(r.knowledgePoints=s);let h=t.difficulty.join(" ").trim(),c=h?function(e){let t=e.trim();if(!t)return null;let n=t.match(/^(\d{1,2})\s*(?:星|级)?$/);if(n){let e=Number(n[1]);return e>=1&&e<=5?e:null}if(/^[★☆]{1,5}$/.test(t)){let e=(t.match(/★/g)??[]).length;return e>=1?e:null}return t in v?v[t]:null}(h):null;null!==c&&(r.difficultyStars=c);let u=t.questionType.join(" ").trim();u&&(r.questionType=u);let d=t.wrongAnswer.join("\n").trim();return d&&(r.wrongAnswer=d),{text:l(n),fields:r}}let M=/^(\d{1,3})\s*[..、,,)]\s*(\S[\s\S]*)$/,D=/^(\d{1,3})\s*[~~—–-]\s*(\d{1,3})\s*[::..、]?\s*([A-Za-z]+)$/;function E(e){let t=e.trim();if(!t)return null;let n=function(e){let t=e.trim().match(D);if(!t)return null;let n=Number(t[1]),i=Number(t[2]),r=t[3];if(!Number.isFinite(n)||!Number.isFinite(i)||n<=0||i<=n||i-n+1>60)return null;let a=i-n+1;return r.length!==a?null:Array.from({length:a},(e,t)=>({label:String(n+t),text:r[t]}))}(t);if(n)return n;let i=function(e){let t=e.trim(),n=[];for(let e of t.matchAll(/(\d{1,3})\s*[..、,,;;]\s*/g)){let i=e.index??0,r=t[i+e[0].length];r&&/\d/.test(r)||n.push({index:i,label:e[1],afterIndex:i+e[0].length})}if(n.length<2)return null;for(let e=1;e<n.length;e++)if(Number(n[e].label)<=Number(n[e-1].label))return null;let i=[];for(let e=0;e<n.length;e++){let r=n[e].afterIndex,a=e+1<n.length?n[e+1].index:t.length,l=t.slice(r,a).trim().replace(/[;;]+$/,"").trim();if(!l||l.length>30||/[。!?!?]/.test(l))return null;i.push({label:n[e].label,text:l})}return i}(t);if(i)return i.map(e=>({label:e.label??"",text:e.text})).filter(e=>e.label);let r=t.match(M);if(!r)return null;let a=Number(r[1]);return!Number.isFinite(a)||a<=0?null:[{label:r[1],text:r[2].trim()}]}function _(e){let t=e.match(/^(.*?)(?:【?\s*(?:解析|分析|详解|解答|点评)\s*】?\s*[::])([\s\S]*)$/);if(t){let n=t[1].replace(/^(?:【?\s*(?:参考答案|答案)\s*】?\s*[::])\s*/,"").trim(),i=t[2].trim();return i?{answer:n,analysis:i}:{answer:e.trim()}}return{answer:e.replace(/^(?:【?\s*(?:参考答案|答案)\s*】?\s*[::])\s*/,"").trim()||e.trim()}}function j(e,t){let n=[],i=!1;for(let r of e){let e={value:!1},a=[];for(let n of r.split("\n")){let i=n.trim()?E(n):null;if(!i){n.trim()&&a.push(n);continue}let r=!1;for(let l of i){let i=t.find(e=>e.label===l.label);if(!i){a.push(n);break}r=!0,e.value=!0;let o=_(l.text);o.answer&&!i.answer&&(i.answer=o.answer),o.analysis&&(i.analysis=i.analysis?`${i.analysis}
|
|
2
|
+
${o.analysis}`:o.analysis)}!r&&!a.includes(n)&&n.trim()&&!a.includes(n)&&a.push(n)}i=i||e.value,e.value?a.length&&n.push(a.join("\n")):n.push(r)}return[n,i]}e.s(["k",0,2e3,"f",0,1e6,"S",0,60,"i",0,2e4,"J",0,function(e,n={}){let i,u,b=void 0===n.maxLength?2e4:Math.min(Math.max(n.maxLength,1e3),1e6),v=void 0===n.maxQuestions?60:Math.min(Math.max(n.maxQuestions,2),2e3),C=e.length>b,M=e.slice(0,b).replace(/\r\n?/g,"\n").split("\n").map(e=>e.replace(t,"").replace(/[\s ]+$/,"")),D=M.map(e=>e?r(e):null),R=M.length;for(let e=0;e<M.length;e++)if(h.test(M[e])){R=e;break}let I=[],S=[];for(let e=0;e<R;e++){let t=D[e];t&&("cn"===t.family?S:I).push({...t,line:e})}let N=new Set;for(let e=0;e<R;e++)(c.test(M[e])||D[e]?.family==="cn"||p(M[e],M.slice(e+1,e+5)))&&N.add(e);let $=[],P=f(I,N);if(P.length<2){let e=f(S,new Set);e.length>=2&&($=[{chain:e,sectionHeading:null}])}else $=function(e,t,n,i){if(e.length<2)return[];let r=e[0].family,a=[0];for(let t=1;t<e.length;t++)1===e[t].value&&a.push(t);if(a.length<2){let a=x(e[0].line,t,n,r,i);return null!==a?[{chain:e,sectionHeading:a}]:[]}let l=[];for(let o=0;o<a.length;o++){let s=a[o],h=o+1<a.length?a[o+1]:e.length,c=e.slice(s,h),u=0===o?x(e[0].line,t,n,r,i):function(e,t,n,i,r,a){for(let l=e+1;l<t;l++)if(n[l]&&(a.has(l)||w(n[l],i[l],r)||p(n[l])))return n[l];return null}(e[s-1].line,e[s].line,t,n,r,i);if(null===u&&o>0){l[l.length-1].chain.push(...c);continue}l.push({chain:c,sectionHeading:u})}return l.filter(e=>e.chain.length>0)}(P,M,D,N);let L=$.length?$.flatMap(e=>e.chain):P,A=l(M.slice(0,R)),H=R<M.length?g(M.slice(R)):[],O=(u=r(M[L[0]?.line??0]??""))?u.label:null,U=e=>({questions:A?[{label:O,text:A,material:null,section:null,lineRange:{from:0,to:R}}]:[],ignored:H,detected:!1,ambiguous:e,candidateCount:e?L.length:+!!A,overflow:0,tooLong:C});if(L.length<2){if(!A)return U(!1);let e=k(A.split("\n")),t=U(!1);if(t.questions.length>0&&Object.keys(e.fields).length>0&&(t.questions[0]={...t.questions[0],text:a(e.text),...e.fields}),t.questions.length>0&&H.length){let[e,n]=j(H,t.questions);t.ignored=e,n||(t.ignored=H)}return t}let X=L[0].family;if(!n.forceNumbered&&function(e,t,n,i){let r=null;for(let a=t-1;a>=0;a--)if(e[a]){r=w(e[a],i[a],n)?null:e[a];break}return!(!r||o.test(r)||d.test(r))&&("paren"===n?r.length>=15||/[。?!?!::,,;;]$/.test(r):/[::]$/.test(r)&&m.test(r))}(M,L[0].line,X,D)){let e=U(!0);if(e.questions.length>0&&A){let t=k(A.split("\n"));Object.keys(t.fields).length>0&&(e.questions[0]={...e.questions[0],text:a(t.text),...t.fields})}return e}let Y=new Set(L.map(e=>e.line)),B=[],T=[],z=null,K=[],F=[],q=(e,t)=>{for(let n of g(e))(!o.test(n)||!(n.length<80))&&(s.test(n)||n.length>=80&&/[。!?.!?;;]/.test(n))?K.push({text:n,range:y(n)}):t?B.push(n):z&&!T.some(e=>e.section===z)?z=`${z}
|
|
3
|
+
${n}`:B.push(n)},W=L[0].line,G=[];for(let e=0;e<W;e++)M[e]&&(w(M[e],D[e],X)||p(M[e],M.slice(e+1,e+5)))?(q(G.splice(0),!0),z=M[e],F=[]):G.push(M[e]);q(G,!0);let Q=$.length>1,V=e=>{if(!Q)return -1;let t=0;for(let n=0;n<$.length;n++)if(e<(t+=$[n].chain.length))return n;return $.length-1};for(let e=0;e<L.length;e++){let t=L[e].line,n=e+1<L.length?L[e+1].line:R,i=V(e);if(Q&&i>=0){let e=$[i].sectionHeading;null!==e&&(z=e,F=[])}K.length&&(F=[...F.filter(e=>e.range),...K],K=[]);let r=n,o=null;for(let e=t+1;e<n;e++)if(M[e]&&!Y.has(e)&&w(M[e],D[e],X)){r=e,o=M[e];break}let h=M.slice(t,r),c=g(h),u=[];for(;c.length>1&&s.test(c[c.length-1].slice(0,30));)u.unshift(c.pop());let d=u.length?c.join("\n"):l(h),m=L[e].value,p=F.filter(e=>!e.range||m>=e.range.from&&m<=e.range.to),f=k(a(d).split("\n"));for(let i of(T.push({label:L[e].label,text:f.text,material:p.length?p.map(e=>e.text).join("\n\n"):null,section:z,lineRange:{from:t,to:n},...f.fields}),u))K.push({text:i,range:y(i)});null!==o&&(z=o,F=[],q(M.slice(r+1,n),!1))}if(Q&&H.length){let e=$.map(e=>e.sectionHeading).filter(e=>null!==e),t=H.join("\n");i=e.some(e=>t.includes(e))?function(e,t,n){let i=[],r=0,a=t.map(e=>{let t=n.slice(r,r+e.chain.length);return r+=e.chain.length,t}),l=-1;for(let r of e){let e=r.split("\n"),o=[],s=!1;for(let i of e){let e=i.trim();if(!e){o.push(i);continue}let r=t.findIndex(t=>t.sectionHeading&&e.includes(t.sectionHeading));if(r>=0){l=r;continue}let h=E(e);if(!h){o.push(i);continue}let c=l>=0?a[l]:n,u=!1;for(let e of h){let t=c.find(t=>t.label===e.label);if(!t){o.push(i);break}u=!0,s=!0;let n=_(e.text);n.answer&&!t.answer&&(t.answer=n.answer),n.analysis&&(t.analysis=t.analysis?`${t.analysis}
|
|
4
|
+
${n.analysis}`:n.analysis)}u||o.includes(i)||o.push(i)}s?o.length&&i.push(o.join("\n")):i.push(r)}return i}(H,$,T):H}else i=j(H,T)[0];let Z=T.slice(v);return{questions:T.slice(0,v),ignored:[...B,...i,...Z.map(e=>{var t;let n,i,r,a;return n=(t=e).text.trim(),r=(i=t.material?.trim())?`${i}
|
|
5
|
+
|
|
6
|
+
${n}`:n,a=[],(t.answer?.trim()&&a.push(`参考答案:${t.answer.trim()}`),t.analysis?.trim()&&a.push(`参考解析:${t.analysis.trim()}`),t.wrongAnswer?.trim()&&a.push(`学生作答:${t.wrongAnswer.trim()}`),a.length)?`${r}
|
|
7
|
+
|
|
8
|
+
${a.join("\n\n")}`:r})],detected:!0,ambiguous:!1,candidateCount:T.length,overflow:Z.length,tooLong:C}}])},401280,e=>{let t={single_choice:"single_choice",singlechoice:"single_choice","single choice":"single_choice","single-choice":"single_choice",multiple_choice:"multiple_choice",multiplechoice:"multiple_choice","multiple choice":"multiple_choice","multiple-choice":"multiple_choice",multichoice:"multiple_choice","multi choice":"multiple_choice",true_false:"true_false",truefalse:"true_false","true/false":"true_false","true false":"true_false","true-false":"true_false","true / false":"true_false",fill_blank:"fill_blank",fillblank:"fill_blank","fill in the blank":"fill_blank","fill-in-the-blank":"fill_blank",fillintheblank:"fill_blank",calculation:"calculation",solution:"solution",reading:"reading",cloze:"cloze",writing:"writing",other:"other",选择题:"single_choice",单项选择:"single_choice",单选:"single_choice",单选题:"single_choice",不定项:"multiple_choice",不定项选择:"multiple_choice",多项选择:"multiple_choice",多选:"multiple_choice",多选题:"multiple_choice",判断:"true_false",判断题:"true_false",是非:"true_false",是非题:"true_false",填空:"fill_blank",填空题:"fill_blank",口算:"calculation",计算:"calculation",计算题:"calculation",解答:"solution",解答题:"solution",应用:"solution",应用题:"solution",证明:"solution",证明题:"solution",简答:"solution",简答题:"solution",阅读:"reading",阅读理解:"reading",完形:"cloze",完形填空:"cloze",作文:"writing",写作:"writing",书面表达:"writing",其他:"other"};e.s(["O",0,"__none__","V",0,["single_choice","multiple_choice","true_false","fill_blank","calculation","solution","reading","cloze","writing","other"],"u",0,{single_choice:"Single Choice",multiple_choice:"Multiple Choice",true_false:"True / False",fill_blank:"Fill in the Blank",calculation:"Calculation",solution:"Solution",reading:"Reading Comprehension",cloze:"Cloze",writing:"Writing",other:"Other"},"H",0,{single_choice:"单选题",multiple_choice:"多选题",true_false:"判断题",fill_blank:"填空题",calculation:"计算题",solution:"解答题",reading:"阅读理解",cloze:"完形填空",writing:"写作",other:"其他"},"P",0,function(e){if("string"!=typeof e)return null;let n=e.trim().toLowerCase();return n?t[n]??null:null}])}])})();
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
(()=>{"use strict";(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,314381,3198,e=>{var t=e.i(456420);let s={name:"box",size:24,node:[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]};s.node;let r=(0,t.f)(s);e.s(["f",0,r],314381);var a=e.i(843476),i=e.i(271645),n=e.i(632781);let l={name:"maximize-2",size:24,node:[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]};l.node;let o=(0,t.f)(l),d={name:"minimize-2",size:24,node:[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]]};d.node;let c=(0,t.f)(d);var u=e.i(395925),m=e.i(741120),f=e.i(759659),x=e.i(519455),h=e.i(111110),g=e.i(294114),p=e.i(201276),v=e.i(113381);let j=null;function y(e,t,s){let r=e?.firstElementChild;r&&(r.style.width="100%",r.style.height=`${s}px`,t?.setSize(e?.offsetWidth||r.offsetWidth||800,s))}function w(e,t){let s=(0,v.L)(e,t);for(let e of s)p.V.warn("[GGB]","命令执行失败",{...e});return s.map(e=>e.command+":"+e.message).join("\n")||void 0}e.s(["f",0,function({commands:e,height:t=700,showToolBar:s=!1,showAlgebraInput:r=!1,showMenuBar:l=!1,className:d="",onRegenerate:b,onDelete:N}){let{t:k}=(0,h.b)(),S=(0,i.useRef)(null),T=(0,i.useRef)(null),A=(0,i.useRef)(void 0),E=(0,i.useId)(),I=(0,i.useRef)(`ggb-${E.replace(/[^a-zA-Z0-9_-]/g,"")}`),[C,_]=(0,i.useState)(!0),[R,V]=(0,i.useState)(null),[O,z]=(0,i.useState)(!0),[$,M]=(0,i.useState)(!1),[L,G]=(0,i.useState)(!1),P=(0,i.useMemo)(()=>(0,v.i)(e),[e]);(0,i.useEffect)(()=>{if(0===P.length)return;let e=!1,a=I.current,i=S.current;return(j||(j=new Promise((e,t)=>{if(window.GGBApplet)return void e();let s=document.createElement("script");s.src="https://www.geogebra.org/apps/deployggb.js",s.async=!0,s.onload=()=>e(),s.onerror=()=>{j=null,t(Error("Failed to load GeoGebra"))},document.head.appendChild(s)}))).then(()=>{if(e)return;let n=window.GGBApplet;if(!n){V(k.geogebra.notLoaded),_(!1);return}if(i){i.innerHTML=`<div id="${a}" style="width:100%;height:${t}px"></div>`;try{new n({appName:"classic",width:"100%",height:t,showToolBar:s,showAlgebraInput:r,showMenuBar:l,showResetIcon:!0,enableRightClick:!0,enableShiftDragZoom:!0,language:"zh",appletOnLoad:s=>{e||(T.current=s,y(i,s,t),A.current=w(s,P),_(!1))}},!0).inject(a)}catch(t){p.V.error("[GGB]","Init failed",{error:t}),e||(V(k.geogebra.initFailed),_(!1))}}}).catch(t=>{p.V.error("[GGB]","Script load failed",{error:t}),e||(V(k.geogebra.scriptFailed),_(!1))}),()=>{e=!0;try{let e=T.current;e?.remove&&e.remove()}catch(e){p.V.warn("[GGB]","Cleanup failed",{error:e})}T.current=null,i&&(i.innerHTML="")}},[P,s,r,l]),(0,i.useEffect)(()=>{y(S.current,T.current,O?700:t)},[O,t]);let q=(0,i.useCallback)(()=>{let e=T.current;if(e)try{e.resetConstruction(),setTimeout(()=>{T.current&&(A.current=w(T.current,P))},300)}catch(e){p.V.warn("[GGB]","Reset failed",{error:e})}},[P]),U=(0,i.useCallback)(async()=>{if(b&&!$){M(!0);try{await b(A.current)}finally{M(!1)}}},[b,$]),F=(0,i.useCallback)(async()=>{if(N&&!L&&await (0,g.u)(k.geogebra.confirmDelete,{destructive:!0})){G(!0);try{await N()}catch{g.c.error(k.geogebra.deleteFailed)}finally{G(!1)}}},[N,L,k]);return 0===P.length?null:(0,a.jsxs)("div",{className:`relative rounded-lg border bg-card ${d}`,children:[(0,a.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 border-b bg-muted/30",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:k.geogebra.title}),C&&(0,a.jsx)(n.f,{className:"h-3 w-3 animate-spin text-muted-foreground"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[b&&(0,a.jsxs)(x.f,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs gap-1",onClick:U,title:k.geogebra.regenerate,disabled:$||C,children:[$?(0,a.jsx)(n.f,{className:"h-3.5 w-3.5 animate-spin"}):(0,a.jsx)(m.f,{className:"h-3.5 w-3.5"}),(0,a.jsx)("span",{children:k.geogebra.regenerate})]}),N&&(0,a.jsxs)(x.f,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs gap-1 text-destructive hover:text-destructive",onClick:F,title:k.geogebra.delete,disabled:L||$,children:[L?(0,a.jsx)(n.f,{className:"h-3.5 w-3.5 animate-spin"}):(0,a.jsx)(f.f,{className:"h-3.5 w-3.5"}),(0,a.jsx)("span",{children:k.geogebra.delete})]}),(0,a.jsx)(x.f,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:q,title:k.geogebra.reset,disabled:C,children:(0,a.jsx)(u.f,{className:"h-3.5 w-3.5"})}),(0,a.jsx)(x.f,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>z(e=>!e),title:O?k.geogebra.shrink:k.geogebra.enlarge,children:O?(0,a.jsx)(c,{className:"h-3.5 w-3.5"}):(0,a.jsx)(o,{className:"h-3.5 w-3.5"})})]})]}),(0,a.jsx)("div",{ref:S,style:{width:"100%"}}),C&&(0,a.jsx)("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-background/80 rounded-b-lg",style:{top:37},children:(0,a.jsxs)("div",{className:"flex flex-col items-center gap-2",children:[(0,a.jsx)(n.f,{className:"h-6 w-6 animate-spin text-primary"}),(0,a.jsx)("span",{className:"text-sm text-muted-foreground",children:k.geogebra.loading})]})}),R&&(0,a.jsx)("div",{className:"flex items-center justify-center text-sm text-destructive",style:{minHeight:t},children:R})]})}],3198)},615568,168148,e=>{var t=e.i(456420);let s={name:"pencil-line",size:24,node:[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]]};s.node;let r=(0,t.f)(s);e.s(["f",0,r],615568);var a=e.i(843476),i=e.i(271645),n=e.i(30030),l=e.i(248425),o=Object.defineProperty,d=(e,t)=>o(e,"name",{value:t,configurable:!0}),c="Progress",[u,m]=(0,n.f)(c),[f,x]=u(c),h=i.forwardRef(d(function(e,t){let{__scopeProgress:s,value:r=null,max:i,getValueLabel:n=p,...o}=e;(i||0===i)&&!y(i)&&console.error(b(`${i}`,"Progress"));let d=y(i)?i:100;null===r||w(r,d)||console.error(N(`${r}`,"Progress"));let c=w(r,d)?r:null,u=j(c)?n(c,d):void 0;return(0,a.jsx)(f,{scope:s,value:c,max:d,children:(0,a.jsx)(l.V.div,{"aria-valuemax":d,"aria-valuemin":0,"aria-valuenow":j(c)?c:void 0,"aria-valuetext":u,role:"progressbar","data-state":v(c,d),"data-value":c??void 0,"data-max":d,...o,ref:t})})},"Progress")),g=i.forwardRef(d(function(e,t){let{__scopeProgress:s,...r}=e,i=x("ProgressIndicator",s);return(0,a.jsx)(l.V.div,{"data-state":v(i.value,i.max),"data-value":i.value??void 0,"data-max":i.max,...r,ref:t})},"ProgressIndicator"));function p(e,t){return`${Math.round(e/t*100)}%`}function v(e,t){return null==e?"indeterminate":e===t?"complete":"loading"}function j(e){return"number"==typeof e}function y(e){return j(e)&&!isNaN(e)&&e>0}function w(e,t){return j(e)&&!isNaN(e)&&e<=t&&e>=0}function b(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`100\`.`}function N(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be:
|
|
2
|
+
- a positive number
|
|
3
|
+
- less than the value passed to \`max\` (or 100 if no \`max\` prop is set)
|
|
4
|
+
- \`null\` or \`undefined\` if the progress is indeterminate.
|
|
5
|
+
|
|
6
|
+
Defaulting to \`null\`.`}d(p,"defaultGetValueLabel"),d(v,"getProgressState"),d(j,"isNumber"),d(y,"isValidMaxNumber"),d(w,"isValidValueNumber"),d(b,"getInvalidMaxError"),d(N,"getInvalidValueError");var k=e.i(975157);let S=i.forwardRef(({className:e,value:t,...s},r)=>(0,a.jsx)(h,{ref:r,value:t,className:(0,k.f)("relative h-4 w-full overflow-hidden rounded-full bg-secondary",e),...s,children:(0,a.jsx)(g,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));S.displayName=h.displayName,e.s(["f",0,S],168148)},856522,e=>{var t=e.i(456420);let s={name:"save",size:24,node:[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]};s.node;let r=(0,t.f)(s);e.s(["f",0,r],856522)},786563,e=>{var t=e.i(456420);let s={name:"star",size:24,node:[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]};s.node;let r=(0,t.f)(s);e.s(["f",0,r],786563)},866531,497346,183444,e=>{var t=e.i(843476),s=e.i(271645),r=e.i(632781),a=e.i(741120),i=e.i(856522),n=e.i(314381),l=e.i(3198),o=e.i(519455),d=e.i(111110),c=e.i(41931),u=e.i(294114),m=e.i(201276);function f({data:e,onChange:a}){let{t:i}=(0,d.b)(),[x,h]=(0,s.useState)(!1),[g,p]=(0,s.useState)(null),v=async()=>{if(!e.questionText.trim())return void u.c.warning(i.editor.enterQuestionFirst||"Please enter question text first");if(!e.answerText.trim())return void u.c.warning(i.geogebra.answerRequired);h(!0),p(null);try{let t=await c.k.post("/api/geogebra-analyze",{questionText:e.questionText,answerText:e.answerText,analysis:e.analysis},{timeout:18e4,recoverable:!0});t.suitable&&t.commands&&t.commands.length>0?a({geogebraCommands:JSON.stringify(t.commands)}):p(t.description||i.geogebra.notSuitable)}catch(e){m.V.error("[CorrectionEditor]","GeoGebra analysis failed",{error:e}),p(i.geogebra.analyzeFailed)}finally{h(!1)}};return e.geogebraCommands?(0,t.jsx)(l.f,{commands:e.geogebraCommands,height:350,onRegenerate:v,onDelete:async()=>a({geogebraCommands:void 0})}):e.questionText.trim()&&e.answerText.trim()?(0,t.jsxs)("div",{className:"rounded-lg border border-dashed p-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,t.jsx)(n.f,{className:"h-4 w-4"}),(0,t.jsx)("span",{children:i.geogebra.title})]}),(0,t.jsx)(o.f,{variant:"outline",size:"sm",onClick:v,disabled:x,children:x?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(r.f,{className:"mr-2 h-4 w-4 animate-spin"}),i.geogebra.analyzing]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.f,{className:"mr-2 h-4 w-4"}),i.geogebra.generate]})})]}),g&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground mt-2",children:g}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground mt-2",children:i.geogebra.hint})]}):null}var x=e.i(469937),h=e.i(28342),g=e.i(438465),p=e.i(674166),v=e.i(110204),j=e.i(967489),y=e.i(401280);function w({data:e,paperLevel:s,onChange:r}){let{t:a}=(0,d.b)();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(v.f,{children:a.editor.selectNotebook||"Select Notebook"}),(0,t.jsx)(g.f,{value:e.subjectId,onChange:e=>r({subjectId:e})})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(v.f,{children:a.questionType.label||"Question Type"}),(0,t.jsxs)(j.d,{value:e.questionType||"",onValueChange:e=>r({questionType:e===y.O?null:e}),children:[(0,t.jsx)(j.P,{children:(0,t.jsx)(j.U,{placeholder:a.questionType.notSet||"Not set"})}),(0,t.jsxs)(j.r,{children:[(0,t.jsx)(j.T,{value:y.O,children:a.questionType.clear||"Clear"}),y.V.map(e=>(0,t.jsx)(j.T,{value:e,children:a.questionType.names?.[e]||e},e))]})]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(v.f,{htmlFor:"correction-grade-semester",children:a.editor.gradeSemester||"Grade/Semester"}),(0,t.jsx)(h.f,{id:"correction-grade-semester",value:e.gradeSemester||"",onChange:e=>r({gradeSemester:e})})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(v.f,{children:a.editor.paperLevel||"Paper Level"}),(0,t.jsx)(p.f,{value:s,onChange:e=>r({paperLevel:e})})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(v.f,{children:a.difficulty.label}),(0,t.jsx)("div",{children:(0,t.jsx)(x.f,{size:"md",value:e.difficultyStars,onChange:e=>r({difficultyStars:e})})})]})]})}var b=e.i(141176),N=e.i(515288);function k({data:e,onChange:s}){let{t:r}=(0,d.b)();return(0,t.jsxs)(N.N,{children:[(0,t.jsx)(N.Y,{children:(0,t.jsx)(N.v,{children:r.editor.mistakeAnalysisTitle||"Mistake Analysis"})}),(0,t.jsxs)(N.O,{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(v.f,{children:r.editor.mistakeStatus||"Attempt Status"}),(0,t.jsxs)(j.d,{value:e.mistakeStatus||"unknown",onValueChange:e=>s({mistakeStatus:e}),children:[(0,t.jsx)(j.P,{children:(0,t.jsx)(j.U,{})}),(0,t.jsxs)(j.r,{children:[(0,t.jsx)(j.T,{value:"not_attempted",children:r.editor.mistakeStatuses?.notAttempted||"Not attempted"}),(0,t.jsx)(j.T,{value:"wrong_attempt",children:r.editor.mistakeStatuses?.wrongAttempt||"Wrong attempt"}),(0,t.jsx)(j.T,{value:"unknown",children:r.editor.mistakeStatuses?.unknown||"Unknown"})]})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(v.f,{children:r.editor.wrongAnswerText||"Wrong Answer / Work"}),(0,t.jsx)(b.f,{value:e.wrongAnswerText||"",onChange:t=>s({wrongAnswerText:t,mistakeStatus:t.trim()?"wrong_attempt":e.mistakeStatus}),className:"min-h-[100px] font-mono text-sm",placeholder:r.editor.wrongAnswerPlaceholder||"Leave blank if no wrong answer is visible"})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(v.f,{children:r.editor.mistakeAnalysis||"Mistake Cause Analysis"}),(0,t.jsx)(b.f,{value:e.mistakeAnalysis||"",onChange:e=>s({mistakeAnalysis:e}),className:"min-h-[140px] font-mono text-sm",placeholder:r.editor.mistakeAnalysisPlaceholder||"Explain where and why the mistake happened"})]})]})]})}var S=e.i(511445),T=e.i(149704);function A({title:e,children:s,className:r}){return(0,t.jsxs)(N.N,{children:[(0,t.jsx)(N.Y,{children:(0,t.jsx)(N.v,{children:e})}),(0,t.jsx)(N.O,{className:r,children:s})]})}function E({data:e,children:s}){let{t:r}=(0,d.b)(),a={wrong_attempt:r.editor.mistakeStatuses?.wrongAttempt||"Wrong attempt",not_attempted:r.editor.mistakeStatuses?.notAttempted||"Not attempted",unknown:r.editor.mistakeStatuses?.unknown||"Unknown"};return(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)(A,{title:r.editor.preview?.question||"Question Preview",children:[(0,t.jsx)(S.f,{content:e.questionText}),(0,t.jsx)(T.f,{svg:e.figureSvg})]}),s,(0,t.jsx)(A,{title:r.editor.preview?.answer||"Answer Preview",children:(0,t.jsx)(S.f,{content:e.answerText})}),(0,t.jsx)(A,{title:r.editor.preview?.analysis||"Analysis Preview",children:(0,t.jsx)(S.f,{content:e.analysis})}),(0,t.jsxs)(A,{title:r.editor.preview?.mistakeAnalysis||"Mistake Analysis Preview",className:"space-y-3 text-sm",children:[(0,t.jsxs)("div",{className:"text-muted-foreground",children:[r.editor.mistakeStatus||"Attempt Status",r.common.colon,a[e.mistakeStatus]??a.unknown]}),e.wrongAnswerText&&(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"font-medium mb-1",children:r.editor.wrongAnswerText||"Wrong Answer / Work"}),(0,t.jsx)(S.f,{content:e.wrongAnswerText})]}),e.mistakeAnalysis&&(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"font-medium mb-1",children:r.editor.mistakeAnalysis||"Mistake Cause Analysis"}),(0,t.jsx)(S.f,{content:e.mistakeAnalysis})]})]})]})}var I=e.i(574041),C=e.i(215519),_=e.i(306831);e.i(676167);var R=e.i(597138),V=e.i(991722),O=e.i(470279),z=e.i(303163);e.s(["f",0,function({initialData:e,onSave:n,onCancel:l,imagePreview:x,initialSubjectId:h,aiTimeout:g}){let{timeZone:p}=(0,C.M)(),{t:j,language:y}=(0,d.b)(),S=e=>e.trim()?e:"",[T,A]=(0,s.useState)({...e,answerText:S(e.answerText),analysis:S(e.analysis),wrongAnswerText:e.wrongAnswerText||"",mistakeAnalysis:e.mistakeAnalysis||"",mistakeStatus:e.mistakeStatus||"unknown",subjectId:h,gradeSemester:e.gradeSemester||""}),$=(0,s.useRef)(!1),M=e=>{"gradeSemester"in e&&($.current=!0),A(t=>({...t,...e}))},{groups:L}=(0,O.f)(),G=(()=>{if(T.paperLevel)return T.paperLevel;let e="number"==typeof T.difficultyStars&&T.difficultyStars>=4?"b":"a";return L.find(t=>t.key===e&&t.isActive)?.id||""})(),P=T.paperLevel??G,[q,U]=(0,s.useState)(!1),[F,H]=(0,s.useState)(!1),[D,Q]=(0,s.useState)(!1),[B,W]=(0,s.useState)(void 0),[Z,J]=(0,s.useState)([]);(0,s.useEffect)(()=>{c.k.get("/api/notebooks").then(J).catch(e=>m.V.error("[CorrectionEditor]","Failed to fetch notebooks",{error:e})),c.k.get("/api/user").then(e=>{if(Q(!!e?.enableGeogebra),e){let t=function(e,t=_.J){return"ai"===e.gradeRecognitionMode?null:e.fixedGradeSemester?e.fixedGradeSemester:e.educationStage&&e.enrollmentYear?function(e,t,s=new Date,r="en",a=_.J){let i=(0,_.c)(s,a),n=i.getFullYear(),l=i.getMonth()+1,o=n-t,d="2nd";l>=9?(o+=1,d="1st"):d=l<2?"1st":"2nd";let c="zh"===r,u=c?"1st"===d?"上期":"下期":"1st"===d?"1st Semester":"2nd Semester",m=(c?{primary:["一年级","二年级","三年级","四年级","五年级","六年级"],junior_high:["初一","初二","初三"],senior_high:["高一","高二","高三"],university:["大一","大二","大三","大四"]}:{primary:["Grade 1","Grade 2","Grade 3","Grade 4","Grade 5","Grade 6"],junior_high:["Junior High Grade 1","Junior High Grade 2","Junior High Grade 3"],senior_high:["Senior High Grade 1","Senior High Grade 2","Senior High Grade 3"],university:["Freshman","Sophomore","Junior","Senior"]})[e]||[],f=`${o}`;if(f=o>0&&o<=m.length?m[o-1]:o>m.length?c?"已毕业":"Graduated":c?"学前":"Pre-school",!c)return`${f}, ${u}`;{let e="1st"===d?"上":"下";return`${f}${e}`}}(e.educationStage,e.enrollmentYear,new Date,"zh",t):null}(e,p);A(e=>e.gradeSemester||$.current?e:{...e,gradeSemester:t||""}),W(e.educationStage||void 0)}}).catch(e=>m.V.error("[CorrectionEditor]","Failed to fetch user info for grade calculation",{error:e}))},[y,p]);let Y=async()=>{if(!T.questionText.trim())return void u.c.warning(j.editor.enterQuestionFirst||"Please enter question text first");U(!0);try{let e=function({questionText:e,language:t,subject:s,imagePreview:r,gradeSemester:a,subjectId:i}){let n={questionText:e,language:t,subject:s};return r&&(n.imageBase64=r),a&&(n.gradeSemester=a),i&&(n.subjectId=i),n}({questionText:T.questionText,language:y,subject:T.subject,imagePreview:x,gradeSemester:T.gradeSemester??void 0,subjectId:T.subjectId});m.V.info("[Reanswer]",e.imageBase64?"Sending image + text (image available for mistake analysis)":"Sending text only (no image available)",{timeout:g});let t=await c.k.post("/api/reanswer",e,{timeout:g||18e4,recoverable:!0});A(e=>({...e,answerText:t.answerText,analysis:t.analysis,knowledgePoints:t.knowledgePoints,wrongAnswerText:t.wrongAnswerText||"",mistakeAnalysis:t.mistakeAnalysis||"",mistakeStatus:(0,V.x)(t.mistakeStatus,t.wrongAnswerText),difficultyStars:t.difficultyStars??e.difficultyStars,questionType:t.questionType??e.questionType})),u.c.success(j.editor.reanswerSuccess||"✅ Answer and analysis updated!")}catch(r){let e,t,s;m.V.error("[CorrectionEditor]","Reanswer failed",{error:r}),u.c.error((e=(0,z.d)(r)||"",s=(t=j.errors?.reanswer||{}).default||"Reanswer failed",e.includes("AI_AUTH_ERROR")?t.authError||j.errors?.AI_AUTH_ERROR||s:e.includes("AI_CONNECTION_FAILED")?t.connectionFailed||j.errors?.AI_CONNECTION_FAILED||s:e.includes("AI_RESPONSE_ERROR")&&(t.responseError||j.errors?.AI_RESPONSE_ERROR)||s))}finally{U(!1)}},K=async()=>{if(!T.subjectId)return void u.c.warning(j.editor.messages?.selectNotebook||"Please select a notebook");if(!F){H(!0);try{await n({...T,paperLevel:P,mistakeStatus:(0,V.x)(T.mistakeStatus,T.wrongAnswerText)})}finally{H(!1)}}},X=j.editor.placeholder||"Supports Markdown and LaTeX...",ee=(0,R.f)(Z.find(e=>e.id===T.subjectId)?.name||null)||(0,R.f)(T.subject||null)||void 0;return(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("h2",{className:"text-2xl font-bold",children:j.editor.title}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(o.f,{variant:"outline",onClick:l,children:j.editor.cancel}),(0,t.jsxs)(o.f,{onClick:K,disabled:F,children:[F?(0,t.jsx)(r.f,{className:"mr-2 h-4 w-4 animate-spin"}):(0,t.jsx)(i.f,{className:"mr-2 h-4 w-4"}),F?j.common?.pleaseWait||"Please wait...":j.editor.save]})]})]}),(0,t.jsxs)("div",{className:"grid gap-6 lg:grid-cols-2",children:[(0,t.jsxs)("div",{className:"space-y-6",children:[x&&(0,t.jsx)(N.N,{children:(0,t.jsx)(N.O,{className:"p-4",children:(0,t.jsx)("img",{src:x,alt:"Original",className:"w-full rounded-md"})})}),(0,t.jsx)(w,{data:T,paperLevel:P,onChange:M}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(v.f,{children:j.editor.question}),(0,t.jsx)(b.f,{value:T.questionText,onChange:e=>M({questionText:e}),className:"min-h-[150px] font-mono text-sm",placeholder:X}),(0,t.jsx)(o.f,{variant:"default",size:"sm",onClick:Y,disabled:q||!T.questionText.trim(),className:"w-full bg-gradient-to-r from-indigo-600 to-violet-500 hover:from-indigo-700 hover:to-violet-600 text-white font-medium",children:q?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(r.f,{className:"mr-2 h-4 w-4 animate-spin"}),j.editor.reanswering||"AI solving..."]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(a.f,{className:"mr-2 h-4 w-4"}),j.editor.reanswer||"🔄 Reanswer (based on corrected question)"]})}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:j.editor.reanswerHint||"💡 If the question was misrecognized, correct it and click to regenerate answer"})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(v.f,{children:j.editor.tags}),(0,t.jsx)(I.f,{value:T.knowledgePoints,onChange:e=>M({knowledgePoints:e}),placeholder:j.editor.tagsPlaceholder||"Enter knowledge tags...",enterHint:j.editor.createTagHint,subject:ee,gradeStage:B}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:j.editor.tagsHint||"💡 Tag suggestions will appear as you type"})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(v.f,{children:j.editor.answer}),(0,t.jsx)(b.f,{value:T.answerText,onChange:e=>M({answerText:e}),className:"min-h-[100px] font-mono text-sm",placeholder:X})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(v.f,{children:j.editor.analysis}),(0,t.jsx)(b.f,{value:T.analysis,onChange:e=>M({analysis:e}),className:"min-h-[200px] font-mono text-sm",placeholder:X})]}),(0,t.jsx)(k,{data:T,onChange:M})]}),(0,t.jsx)(E,{data:T,children:D&&(0,t.jsx)(f,{data:T,onChange:M})})]})]})}],866531);var $=e.i(853138),M=e.i(263676);e.s(["f",0,function({message:e,onDismiss:s}){let{t:r}=(0,d.b)();return e?(0,t.jsxs)("div",{role:"alert",className:"flex items-start gap-3 rounded-xl border border-destructive/30 bg-destructive/5 p-4 text-sm text-destructive",children:[(0,t.jsx)($.f,{"aria-hidden":"true",className:"mt-0.5 h-4 w-4 shrink-0"}),(0,t.jsx)("p",{className:"min-w-0 flex-1 whitespace-pre-line break-words leading-relaxed",children:e}),(0,t.jsx)("button",{type:"button",onClick:s,"aria-label":r.common.close,className:"shrink-0 rounded p-1 hover:bg-destructive/10",children:(0,t.jsx)(M.X,{"aria-hidden":"true",className:"h-4 w-4"})})]}):null}],497346);var L=e.i(618566),G=e.i(707212);function P(e){return"object"!=typeof e||null===e||Array.isArray(e)?void 0:e}function q(e,t){if("string"!=typeof e||!/^(QUESTION_SAVE_|AI_)[A-Z_]+$/.test(e))return;let s=t.errors[e];return"string"==typeof s?s:void 0}e.s(["f",0,function(e){let{t}=(0,d.b)(),r=(0,L.useRouter)(),[a,i]=(0,s.useState)(null),n=async(s,a,n=!0)=>{i(null);try{let e=await s();return u.c.success(e.duplicate?t.importFlow.duplicate:t.common.messages.saveSuccess),n&&(e.duplicate?r.push(`/error-items/${e.id}`):a&&r.push(`/notebooks/${a}`)),!0}catch(r){m.V.error(e,"Save failed",{errorMessage:(0,z.d)(r)??(0,z.Z)(r)});let s=function(e,t){let s=P(e),r=P(s?.data),a="number"==typeof s?.status?s.status:void 0,i=(0,z.d)(e),n=q(i,t)??q(r?.code,t),l={400:t.errors.QUESTION_SAVE_INVALID_INPUT,401:t.errors.QUESTION_SAVE_UNAUTHORIZED,403:t.errors.QUESTION_SAVE_FORBIDDEN,408:t.errors.QUESTION_SAVE_TIMEOUT,409:t.errors.QUESTION_SAVE_CONFLICT,413:t.errors.QUESTION_SAVE_TOO_LARGE,429:t.errors.QUESTION_SAVE_RATE_LIMITED,502:t.errors.QUESTION_SAVE_SERVER_UNAVAILABLE,503:t.errors.QUESTION_SAVE_SERVER_UNAVAILABLE,504:t.errors.QUESTION_SAVE_TIMEOUT},o=n??(a?l[a]:void 0)??t.errors.QUESTION_SAVE_FAILED;!a&&(e instanceof TypeError||/fetch|network|load failed/i.test((0,z.Z)(e)))&&(o=t.errors.QUESTION_SAVE_NETWORK_ERROR);let d=P(r?.details);if("QUESTION_SAVE_GRADE_FAILED"===i){let e=q(d?.reason,t);e&&(o+=`
|
|
7
|
+
${e}`)}return 400===a&&(o+=(function(e,t){if(!Array.isArray(e))return[];let s={questionText:t.editor.question,answerText:t.editor.answer,analysis:t.editor.analysis,wrongAnswerText:t.editor.wrongAnswerText,mistakeAnalysis:t.editor.mistakeAnalysis,knowledgePoints:t.editor.tags,subjectId:t.editor.selectNotebook,gradeSemester:t.editor.gradeSemester,paperLevel:t.editor.paperLevel};return e.slice(0,3).flatMap(e=>{let r=P(e),a=r?.path,i=Array.isArray(a)&&"string"==typeof a[0]?s[a[0]]:void 0;if(!i)return[];let n=r?.maximum,l=t.questionSave.invalidField;return r?.code==="too_big"&&"number"==typeof n&&Number.isSafeInteger(n)&&n>=0&&(l="array"===r.origin?t.questionSave.tooMany:t.questionSave.tooLong),[l.replace("{field}",i).replace("{maximum}",String(n))]})})(r?.details,t).map(e=>`
|
|
8
|
+
${e}`).join("")),"string"==typeof d?.databaseCode&&/^P\d{4}$/.test(d.databaseCode)&&(o+=`
|
|
9
|
+
${t.questionSave.databaseCode.replace("{code}",d.databaseCode)}`),a&&(o+=` (HTTP ${a})`),o}(r,t);return i(s),(0,G.t)((0,z.d)(r))||u.c.error(s),!1}};return{saveError:a,setSaveError:i,dismissSaveError:()=>i(null),run:n}}],183444)},469937,e=>{var t=e.i(843476),s=e.i(786563),r=e.i(111110),a=e.i(975157);let i=[1,2,3,4,5];e.s(["f",0,function({value:e,onChange:n,disabled:l,size:o="sm",showUnrated:d=!0,className:c}){let{t:u}=(0,r.b)(),m=e??0,f="sm"===o?"h-3.5 w-3.5":"h-5 w-5",x=m?u.difficulty.starsLabel.replace("{n}",String(m)):u.difficulty.unrated;return n?(0,t.jsxs)("span",{className:(0,a.f)("inline-flex items-center gap-0.5",c),role:"group","aria-label":`${u.difficulty.label}${u.common.colon}${x}`,title:u.difficulty.clearHint,children:[i.map(e=>(0,t.jsx)("button",{type:"button",disabled:l,onClick:()=>n(e===m?null:e),"aria-label":u.difficulty.setStars.replace("{n}",String(e)),"aria-pressed":e<=m,className:"rounded p-0.5 hover:bg-muted disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:(0,t.jsx)(s.f,{className:(0,a.f)(f,e<=m?"fill-amber-400 text-amber-400":"text-muted-foreground/40")})},e)),!m&&d&&(0,t.jsx)("span",{className:"ml-1 text-xs text-muted-foreground",children:u.difficulty.unrated})]}):m?(0,t.jsx)("span",{className:(0,a.f)("inline-flex items-center",c),role:"img","aria-label":`${u.difficulty.label}${u.common.colon}${x}`,title:x,children:i.map(e=>(0,t.jsx)(s.f,{className:(0,a.f)(f,e<=m?"fill-amber-400 text-amber-400":"text-muted-foreground/30"),"aria-hidden":!0},e))}):d?(0,t.jsx)("span",{className:(0,a.f)("text-xs text-muted-foreground",c),children:u.difficulty.unrated}):null}])},731335,532377,339501,e=>{var t=e.i(843476),s=e.i(399847),r=e.i(551757),a=e.i(456420);let i={name:"clock-3",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6h4",key:"135r8i"}]]};i.node;let n=(0,a.f)(i);var l=e.i(632781),o=e.i(615568),d=e.i(487486),c=e.i(519455),u=e.i(168148),m=e.i(111110),f=e.i(215519),x=e.i(306831);let h=["read","convert","crop","compress","upload"],g=["receive","analyze","save"];function p(e){if(!Number.isFinite(e)||e<0)return"-";if(e<1e3)return`${Math.round(e)}ms`;let t=e/1e3;if(t<60)return`${t.toFixed(+(t<10))}s`;let s=Math.round(t);return`${Math.floor(s/60)}:${String(s%60).padStart(2,"0")}`}var v=e.i(975157);let j={analyzing:50,saving:90},y={analyzing:l.f,saving:l.f,review:o.f,saved:r.f,failed:s.f};e.s(["f",0,function({task:e,now:s,onReview:r,onViewItem:a,onRetry:i,onDiscard:l}){let{t:o}=(0,m.b)(),{timeZone:w}=(0,f.M)(),b=y[e.status],N="analyzing"===e.status||"saving"===e.status,k=o.errors,S=e.error?"string"==typeof k[e.error]?k[e.error]:e.error:null,T=function(e){let t=[];for(let s of h){let r=e?.client?.[s];"number"==typeof r&&t.push({stage:s,ms:r})}for(let s of g){let r=e?.server?.[s];"number"==typeof r&&t.push({stage:s,ms:r})}return t}(e.timings),A=N&&s?s-Date.parse(e.createdAt):null;return(0,t.jsxs)("div",{className:(0,v.f)("space-y-2 rounded-lg border p-3 text-sm",e.unread&&"border-primary/50 bg-primary/5"),"data-testid":"import-task-card","data-status":e.status,children:[(0,t.jsxs)("div",{className:"flex items-start gap-2",children:[(0,t.jsx)(b,{className:(0,v.f)("mt-0.5 h-4 w-4 shrink-0",N&&"animate-spin text-primary","saved"===e.status&&"text-green-600","failed"===e.status&&"text-destructive","review"===e.status&&"text-primary")}),(0,t.jsxs)("div",{className:"min-w-0 flex-1 space-y-1",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)("span",{className:"font-medium",children:o.importTasks.status[e.status]}),(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:o.importTasks.mode[e.mode]}),e.unread&&(0,t.jsx)(d.f,{children:o.importTasks.unread})]}),N&&(0,t.jsx)(u.f,{value:j[e.status],"aria-label":o.importTasks.stageEstimate,"aria-valuetext":o.common.progress.estimated.replace("{percent}",String(j[e.status])),className:"h-1.5"}),e.excerpt&&(0,t.jsx)("p",{className:"break-words text-muted-foreground",children:e.excerpt}),"saved"===e.status&&!e.errorItemId&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:o.importTasks.itemDeleted}),"saved"===e.status&&e.errorItemId&&(0,t.jsx)("p",{className:"text-xs text-green-700 dark:text-green-300",children:e.duplicate?o.importTasks.duplicateSaved:o.importTasks.savedTo.replace("{notebook}",e.notebookName||"-").replace("{id}",e.errorItemShortId||"-")}),S&&(0,t.jsx)("p",{className:"text-xs text-destructive",children:S}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground",children:[(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsx)(n,{className:"h-3 w-3"}),o.importTasks.createdAt.replace("{time}",(0,x.r)(e.createdAt,"MM-dd HH:mm",w))]}),null!==A&&(0,t.jsx)("span",{children:o.importTasks.elapsed.replace("{time}",p(A))}),e.attempts>1&&(0,t.jsx)("span",{children:o.importTasks.attempts.replace("{count}",String(e.attempts))})]}),T.length>0&&(0,t.jsx)("ul",{className:"flex flex-wrap gap-x-3 gap-y-1 text-xs text-muted-foreground tabular-nums","aria-label":"timings",children:T.map(({stage:e,ms:s})=>(0,t.jsxs)("li",{children:[o.importTasks.timings[e]," ",p(s)]},e))})]})]}),(0,t.jsxs)("div",{className:"flex flex-wrap justify-end gap-2",children:["review"===e.status&&r&&(0,t.jsx)(c.f,{size:"sm",onClick:r,children:o.importTasks.continueReview}),"saved"===e.status&&e.errorItemId&&a&&(0,t.jsx)(c.f,{size:"sm",variant:"outline",onClick:a,children:o.importTasks.viewItem}),"failed"===e.status&&i&&(0,t.jsx)(c.f,{size:"sm",onClick:i,children:o.importTasks.retry}),"saving"!==e.status&&"saved"!==e.status&&l&&(0,t.jsx)(c.f,{size:"sm",variant:"ghost",onClick:l,children:o.importTasks.discard})]})]})}],731335);var w=e.i(618566),b=e.i(767077),N=e.i(294114),k=e.i(201276),S=e.i(127175);e.s(["f",0,function(e){let{t}=(0,m.b)(),s=(0,w.useRouter)(),r=e=>{e.unread&&(0,S.N)(e.id).catch(e=>k.V.warn("[ImportTasks]","Mark read failed",{error:e}))};return{openReview:e=>{r(e),s.push(`/import-tasks/${e.id}`)},viewItem:e=>{e.errorItemId&&(r(e),s.push(`/error-items/${e.errorItemId}`))},markRead:r,retry:async s=>{try{await (0,S.R)(s.id),N.c.info(t.importTasks.retried)}catch(e){N.c.error((0,b.f)(e,t))}e?.()},discard:async s=>{if(!await (0,N.u)(t.importTasks.discardConfirm))return!1;let r=!1;try{await (0,S.x)(s.id),N.c.success(t.importTasks.discarded),r=!0}catch(e){N.c.error((0,b.f)(e,t))}return e?.(),r}}}],532377);var T=e.i(271645);e.s(["f",0,function(e,t=1e3){let[s,r]=(0,T.useState)(()=>Date.now());return(0,T.useEffect)(()=>{if(!e)return;let s=setInterval(()=>r(Date.now()),t);return()=>clearInterval(s)},[e,t]),s}],339501)},141176,e=>{var t=e.i(843476),s=e.i(271645),r=e.i(456420);let a={name:"code-xml",size:24,node:[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],aliases:["code-2"]};a.node;let i=(0,r.f)(a);var n=e.i(772382),l=e.i(511445),o=e.i(624687),d=e.i(111110),c=e.i(975157);e.s(["f",0,function({value:e,onChange:r,className:a,...u}){let{t:m}=(0,d.b)(),[f,x]=(0,s.useState)("source"),h=(0,s.useId)(),g=[{mode:"source",label:m.markdownEditor.source,icon:i},{mode:"preview",label:m.markdownEditor.preview,icon:n.f}];return(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("div",{role:"tablist","aria-label":m.markdownEditor.modeLabel,className:"flex justify-end",children:(0,t.jsx)("div",{className:"inline-flex rounded-md border bg-muted/40 p-0.5",children:g.map(({mode:e,label:s,icon:r})=>(0,t.jsxs)("button",{type:"button",role:"tab","aria-selected":f===e,"aria-controls":h,onClick:()=>x(e),className:(0,c.f)("flex items-center gap-1 rounded px-2.5 py-1 text-xs transition-colors",f===e?"bg-background font-medium shadow-sm":"text-muted-foreground hover:text-foreground"),children:[(0,t.jsx)(r,{className:"h-3.5 w-3.5"}),s]},e))})}),(0,t.jsx)("div",{id:h,role:"tabpanel",children:"source"===f?(0,t.jsx)(o.f,{value:e,onChange:e=>r(e.target.value),className:a,...u}):(0,t.jsx)("div",{className:"min-h-24 cursor-text rounded-md border bg-muted/20 px-3 py-2",onDoubleClick:()=>x("source"),title:m.markdownEditor.doubleClickToEdit,children:e.trim()?(0,t.jsx)(l.f,{content:e}):(0,t.jsx)("p",{className:"text-sm italic text-muted-foreground",children:m.markdownEditor.empty})})})]})}],141176)},438465,674166,e=>{var t=e.i(843476),s=e.i(271645),r=e.i(967489),a=e.i(856423),i=e.i(41931),n=e.i(201276),l=e.i(111110);e.s(["f",0,function({value:e,onChange:o,className:d}){let[c,u]=(0,s.useState)([]),{t:m}=(0,l.b)();return(0,s.useEffect)(()=>{(async()=>{try{let e=await i.k.get("/api/notebooks");u(e)}catch(e){n.V.error("[NotebookSelector]","Failed to fetch notebooks",{error:e})}})()},[]),(0,t.jsxs)(r.d,{value:e,onValueChange:o,children:[(0,t.jsx)(r.P,{className:d,children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(a.f,{className:"h-4 w-4 text-muted-foreground"}),(0,t.jsx)(r.U,{placeholder:m.notebooks?.selector?.placeholder||"Select Notebook"})]})}),(0,t.jsx)(r.r,{children:0===c.length?(0,t.jsx)("div",{className:"p-2 text-sm text-muted-foreground text-center",children:m.notebooks?.selector?.empty||"No notebooks available"}):c.map(e=>(0,t.jsx)(r.T,{value:e.id,children:e.name},e.id))})]})}],438465);var o=e.i(470279);e.s(["f",0,function({value:e,onChange:s,disabled:a}){let{groups:i,loading:n}=(0,o.f)(),l=i.filter(e=>e.isActive);return(0,t.jsxs)(r.d,{value:e,onValueChange:s,disabled:a||n,children:[(0,t.jsx)(r.P,{children:(0,t.jsx)(r.U,{placeholder:"选择卷别"})}),(0,t.jsx)(r.r,{children:l.map(e=>(0,t.jsx)(r.T,{value:e.id,children:e.name},e.id))})]})}],674166)},149704,e=>{var t=e.i(843476),s=e.i(111110),r=e.i(398019),a=e.i(184110),i=e.i(975157);let n={left:"mr-auto",center:"mx-auto",right:"ml-auto"};e.s(["f",0,function({svg:e,scale:l,align:o,className:d}){let{t:c}=(0,s.b)();if(!e)return null;let u=(0,a.V)(l),m=(0,a.o)(o);return(0,t.jsx)("figure",{className:(0,i.f)("question-figure my-3",d),children:(0,t.jsx)("img",{src:(0,r.d)(e),alt:c.figure.alt,className:(0,i.f)(n[m],"block h-auto max-w-full rounded border bg-white p-2"),style:{..."left"===m?{marginLeft:0,marginRight:"auto"}:"right"===m?{marginLeft:"auto",marginRight:0}:{},maxHeight:360,zoom:u/100,maxWidth:`${Math.min(u,100)}%`}})})}])},184110,e=>{let t=["left","center","right"],s="center";function r(e){return"number"==typeof e&&Number.isInteger(e)&&e>=10&&e<=200}e.s(["E",0,s,"n",0,100,"j",0,t,"a",0,200,"_",0,10,"x",0,r,"o",0,function(e){return"string"==typeof e&&t.includes(e)?e:s},"V",0,function(e){return r(e)?e:100}])},398019,e=>{e.s(["K",0,1e5,"d",0,function(e){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`}])},767077,e=>{var t=e.i(303163);e.s(["f",0,function(e,s){let r=s.common?.messages?.analysisFailed||"Analysis failed, please try again",a=(0,t.d)(e);if(a){let e=s.errors??{};if(!(a in e))return a;let t=e[a];return"string"==typeof t?t:r}let i=(0,t.Z)(e);if(i.includes("fetch")||i.includes("network"))return s.errors?.AI_CONNECTION_FAILED||"网络连接失败";if("object"==typeof e&&null!==e&&"data"in e&&"string"==typeof e.data){let t="status"in e&&"number"==typeof e.status?e.status:"Error";return`${r} (${t})`}return r}])},991722,e=>{function t(e){return"not_attempted"===e||"wrong_attempt"===e||"unknown"===e?e:"unknown"}e.s(["i",0,function(e,s="zh"){return("en"===s?{not_attempted:"Not attempted",wrong_attempt:"Wrong attempt",unknown:"Unknown"}:{not_attempted:"不会做",wrong_attempt:"做错了",unknown:"未判断"})[t(e)]},"h",0,t,"x",0,function(e,s){return(s||"").trim()?"wrong_attempt":t(e)}])},597138,e=>{e.i(306831),e.s(["f",0,function(e){if(!e)return null;let t=e.toLowerCase();return t.includes("math")||t.includes("数学")?"math":t.includes("physics")||t.includes("物理")?"physics":t.includes("chemistry")||t.includes("化学")?"chemistry":t.includes("biology")||t.includes("生物")?"biology":t.includes("english")||t.includes("英语")?"english":t.includes("chinese")||t.includes("语文")?"chinese":t.includes("history")||t.includes("历史")?"history":t.includes("geography")||t.includes("地理")?"geography":t.includes("politics")||t.includes("政治")?"politics":null}])}])})();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(()=>{"use strict";(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,314381,3198,e=>{var t=e.i(456420);let i={name:"box",size:24,node:[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]};i.node;let n=(0,t.f)(i);e.s(["f",0,n],314381);var r=e.i(843476),a=e.i(271645),o=e.i(632781);let l={name:"maximize-2",size:24,node:[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]};l.node;let s=(0,t.f)(l),c={name:"minimize-2",size:24,node:[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]]};c.node;let h=(0,t.f)(c);var d=e.i(395925),u=e.i(741120),m=e.i(759659),g=e.i(519455),p=e.i(111110),f=e.i(294114),w=e.i(201276),x=e.i(113381);let y=null;function b(e,t,i){let n=e?.firstElementChild;n&&(n.style.width="100%",n.style.height=`${i}px`,t?.setSize(e?.offsetWidth||n.offsetWidth||800,i))}function v(e,t){let i=(0,x.L)(e,t);for(let e of i)w.V.warn("[GGB]","命令执行失败",{...e});return i.map(e=>e.command+":"+e.message).join("\n")||void 0}e.s(["f",0,function({commands:e,height:t=700,showToolBar:i=!1,showAlgebraInput:n=!1,showMenuBar:l=!1,className:c="",onRegenerate:C,onDelete:k}){let{t:j}=(0,p.b)(),D=(0,a.useRef)(null),M=(0,a.useRef)(null),E=(0,a.useRef)(void 0),_=(0,a.useId)(),N=(0,a.useRef)(`ggb-${_.replace(/[^a-zA-Z0-9_-]/g,"")}`),[R,S]=(0,a.useState)(!0),[L,I]=(0,a.useState)(null),[P,z]=(0,a.useState)(!0),[$,H]=(0,a.useState)(!1),[A,B]=(0,a.useState)(!1),Y=(0,a.useMemo)(()=>(0,x.i)(e),[e]);(0,a.useEffect)(()=>{if(0===Y.length)return;let e=!1,r=N.current,a=D.current;return(y||(y=new Promise((e,t)=>{if(window.GGBApplet)return void e();let i=document.createElement("script");i.src="https://www.geogebra.org/apps/deployggb.js",i.async=!0,i.onload=()=>e(),i.onerror=()=>{y=null,t(Error("Failed to load GeoGebra"))},document.head.appendChild(i)}))).then(()=>{if(e)return;let o=window.GGBApplet;if(!o){I(j.geogebra.notLoaded),S(!1);return}if(a){a.innerHTML=`<div id="${r}" style="width:100%;height:${t}px"></div>`;try{new o({appName:"classic",width:"100%",height:t,showToolBar:i,showAlgebraInput:n,showMenuBar:l,showResetIcon:!0,enableRightClick:!0,enableShiftDragZoom:!0,language:"zh",appletOnLoad:i=>{e||(M.current=i,b(a,i,t),E.current=v(i,Y),S(!1))}},!0).inject(r)}catch(t){w.V.error("[GGB]","Init failed",{error:t}),e||(I(j.geogebra.initFailed),S(!1))}}}).catch(t=>{w.V.error("[GGB]","Script load failed",{error:t}),e||(I(j.geogebra.scriptFailed),S(!1))}),()=>{e=!0;try{let e=M.current;e?.remove&&e.remove()}catch(e){w.V.warn("[GGB]","Cleanup failed",{error:e})}M.current=null,a&&(a.innerHTML="")}},[Y,i,n,l]),(0,a.useEffect)(()=>{b(D.current,M.current,P?700:t)},[P,t]);let O=(0,a.useCallback)(()=>{let e=M.current;if(e)try{e.resetConstruction(),setTimeout(()=>{M.current&&(E.current=v(M.current,Y))},300)}catch(e){w.V.warn("[GGB]","Reset failed",{error:e})}},[Y]),X=(0,a.useCallback)(async()=>{if(C&&!$){H(!0);try{await C(E.current)}finally{H(!1)}}},[C,$]),U=(0,a.useCallback)(async()=>{if(k&&!A&&await (0,f.u)(j.geogebra.confirmDelete,{destructive:!0})){B(!0);try{await k()}catch{f.c.error(j.geogebra.deleteFailed)}finally{B(!1)}}},[k,A,j]);return 0===Y.length?null:(0,r.jsxs)("div",{className:`relative rounded-lg border bg-card ${c}`,children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 border-b bg-muted/30",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:j.geogebra.title}),R&&(0,r.jsx)(o.f,{className:"h-3 w-3 animate-spin text-muted-foreground"})]}),(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[C&&(0,r.jsxs)(g.f,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs gap-1",onClick:X,title:j.geogebra.regenerate,disabled:$||R,children:[$?(0,r.jsx)(o.f,{className:"h-3.5 w-3.5 animate-spin"}):(0,r.jsx)(u.f,{className:"h-3.5 w-3.5"}),(0,r.jsx)("span",{children:j.geogebra.regenerate})]}),k&&(0,r.jsxs)(g.f,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs gap-1 text-destructive hover:text-destructive",onClick:U,title:j.geogebra.delete,disabled:A||$,children:[A?(0,r.jsx)(o.f,{className:"h-3.5 w-3.5 animate-spin"}):(0,r.jsx)(m.f,{className:"h-3.5 w-3.5"}),(0,r.jsx)("span",{children:j.geogebra.delete})]}),(0,r.jsx)(g.f,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:O,title:j.geogebra.reset,disabled:R,children:(0,r.jsx)(d.f,{className:"h-3.5 w-3.5"})}),(0,r.jsx)(g.f,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>z(e=>!e),title:P?j.geogebra.shrink:j.geogebra.enlarge,children:P?(0,r.jsx)(h,{className:"h-3.5 w-3.5"}):(0,r.jsx)(s,{className:"h-3.5 w-3.5"})})]})]}),(0,r.jsx)("div",{ref:D,style:{width:"100%"}}),R&&(0,r.jsx)("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-background/80 rounded-b-lg",style:{top:37},children:(0,r.jsxs)("div",{className:"flex flex-col items-center gap-2",children:[(0,r.jsx)(o.f,{className:"h-6 w-6 animate-spin text-primary"}),(0,r.jsx)("span",{className:"text-sm text-muted-foreground",children:j.geogebra.loading})]})}),L&&(0,r.jsx)("div",{className:"flex items-center justify-center text-sm text-destructive",style:{minHeight:t},children:L})]})}],3198)},856522,e=>{var t=e.i(456420);let i={name:"save",size:24,node:[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]};i.node;let n=(0,t.f)(i);e.s(["f",0,n],856522)},328623,e=>{var t=e.i(456420);let i={name:"sparkles",size:24,node:[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],aliases:["stars"]};i.node;let n=(0,t.f)(i);e.s(["f",0,n],328623)},786563,e=>{var t=e.i(456420);let i={name:"star",size:24,node:[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]};i.node;let n=(0,t.f)(i);e.s(["f",0,n],786563)},232660,e=>{var t=e.i(271645),i={x:0,y:0,width:0,height:0,unit:"px"},n=(e,t,i)=>Math.min(Math.max(e,t),i),r=(e,t)=>e===t||e.width===t.width&&e.height===t.height&&e.x===t.x&&e.y===t.y&&e.unit===t.unit;function a(e,t,n){return"%"===e.unit?{...i,...e,unit:"%"}:{unit:"%",x:e.x?e.x/t*100:0,y:e.y?e.y/n*100:0,width:e.width?e.width/t*100:0,height:e.height?e.height/n*100:0}}function o(e,t,n){return e.unit&&"px"!==e.unit?{unit:"px",x:e.x?e.x*t/100:0,y:e.y?e.y*n/100:0,width:e.width?e.width*t/100:0,height:e.height?e.height*n/100:0}:{...i,...e,unit:"px"}}function l(e,t,i,n,r,a=0,o=0,s=n,c=r){let h={...e},d=Math.min(a,n),u=Math.min(o,r),m=Math.min(s,n),g=Math.min(c,r);t&&(t>1?(u=(d=o?o*t:d)/t,m=s*t):(d=(u=a?a/t:u)*t,g=c/t)),h.y<0&&(h.height=Math.max(h.height+h.y,u),h.y=0),h.x<0&&(h.width=Math.max(h.width+h.x,d),h.x=0);let p=n-(h.x+h.width);p<0&&(h.x=Math.min(h.x,n-d),h.width+=p);let f=r-(h.y+h.height);if(f<0&&(h.y=Math.min(h.y,r-u),h.height+=f),h.width<d&&(("sw"===i||"nw"==i)&&(h.x-=d-h.width),h.width=d),h.height<u&&(("nw"===i||"ne"==i)&&(h.y-=u-h.height),h.height=u),h.width>m&&(("sw"===i||"nw"==i)&&(h.x-=m-h.width),h.width=m),h.height>g&&(("nw"===i||"ne"==i)&&(h.y-=g-h.height),h.height=g),t){let e=h.width/h.height;if(e<t){let e=Math.max(h.width/t,u);("nw"===i||"ne"==i)&&(h.y-=e-h.height),h.height=e}else if(e>t){let e=Math.max(h.height*t,d);("sw"===i||"nw"==i)&&(h.x-=e-h.width),h.width=e}}return h}var s={capture:!0,passive:!1},c=0,h=class e extends t.PureComponent{static xOrds=["e","w"];static yOrds=["n","s"];static xyOrds=["nw","ne","se","sw"];static nudgeStep=1;static nudgeStepMedium=10;static nudgeStepLarge=100;static defaultProps={ariaLabels:{cropArea:"Use the arrow keys to move the crop selection area",nwDragHandle:"Use the arrow keys to move the north west drag handle to change the crop selection area",nDragHandle:"Use the up and down arrow keys to move the north drag handle to change the crop selection area",neDragHandle:"Use the arrow keys to move the north east drag handle to change the crop selection area",eDragHandle:"Use the up and down arrow keys to move the east drag handle to change the crop selection area",seDragHandle:"Use the arrow keys to move the south east drag handle to change the crop selection area",sDragHandle:"Use the up and down arrow keys to move the south drag handle to change the crop selection area",swDragHandle:"Use the arrow keys to move the south west drag handle to change the crop selection area",wDragHandle:"Use the up and down arrow keys to move the west drag handle to change the crop selection area"}};get document(){return document}docMoveBound=!1;mouseDownOnCrop=!1;dragStarted=!1;evData={startClientX:0,startClientY:0,startCropX:0,startCropY:0,clientX:0,clientY:0,isResize:!0};componentRef=(0,t.createRef)();mediaRef=(0,t.createRef)();resizeObserver;initChangeCalled=!1;instanceId=`rc-${c++}`;state={cropIsActive:!1,newCropIsBeingDrawn:!1};getBox(){let e=this.mediaRef.current;if(!e)return{x:0,y:0,width:0,height:0};let{x:t,y:i,width:n,height:r}=e.getBoundingClientRect();return{x:t,y:i,width:n,height:r}}componentDidUpdate(e){let{crop:t,onComplete:i}=this.props;if(i&&!e.crop&&t){let{width:e,height:n}=this.getBox();e&&n&&i(o(t,e,n),a(t,e,n))}}componentWillUnmount(){this.resizeObserver&&this.resizeObserver.disconnect(),this.unbindDocMove()}bindDocMove(){this.docMoveBound||=(this.document.addEventListener("pointermove",this.onDocPointerMove,s),this.document.addEventListener("pointerup",this.onDocPointerDone,s),this.document.addEventListener("pointercancel",this.onDocPointerDone,s),!0)}unbindDocMove(){this.docMoveBound&&=(this.document.removeEventListener("pointermove",this.onDocPointerMove,s),this.document.removeEventListener("pointerup",this.onDocPointerDone,s),this.document.removeEventListener("pointercancel",this.onDocPointerDone,s),!1)}onCropPointerDown=e=>{let{crop:t,disabled:i}=this.props,n=this.getBox();if(!t)return;let r=o(t,n.width,n.height);if(i)return;e.cancelable&&e.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});let a=e.target.dataset.ord,l=e.clientX,s=e.clientY,c=r.x,h=r.y;if(a){let t=e.clientX-n.x,i=e.clientY-n.y,o=0,d=0;"ne"===a||"e"==a?(o=t-(r.x+r.width),d=i-r.y,c=r.x,h=r.y+r.height):"se"===a||"s"===a?(o=t-(r.x+r.width),d=i-(r.y+r.height),c=r.x,h=r.y):"sw"===a||"w"==a?(o=t-r.x,d=i-(r.y+r.height),c=r.x+r.width,h=r.y):("nw"===a||"n"==a)&&(o=t-r.x,d=i-r.y,c=r.x+r.width,h=r.y+r.height),l=c+n.x+o,s=h+n.y+d}this.evData={startClientX:l,startClientY:s,startCropX:c,startCropY:h,clientX:e.clientX,clientY:e.clientY,isResize:!!a,ord:a},this.mouseDownOnCrop=!0,this.setState({cropIsActive:!0})};onComponentPointerDown=e=>{let{crop:t,disabled:i,locked:n,keepSelection:r,onChange:l}=this.props,s=this.getBox();if(i||n||r&&t)return;e.cancelable&&e.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});let c=e.clientX-s.x,h=e.clientY-s.y,d={unit:"px",x:c,y:h,width:0,height:0};this.evData={startClientX:e.clientX,startClientY:e.clientY,startCropX:c,startCropY:h,clientX:e.clientX,clientY:e.clientY,isResize:!0},this.mouseDownOnCrop=!0,l(o(d,s.width,s.height),a(d,s.width,s.height)),this.setState({cropIsActive:!0,newCropIsBeingDrawn:!0})};onDocPointerMove=e=>{let t,{crop:i,disabled:n,onChange:l,onDragStart:s}=this.props,c=this.getBox();if(n||!i||!this.mouseDownOnCrop)return;e.cancelable&&e.preventDefault(),this.dragStarted||(this.dragStarted=!0,s&&s(e));let{evData:h}=this;h.clientX=e.clientX,h.clientY=e.clientY,r(i,t=h.isResize?this.resizeCrop():this.dragCrop())||l(o(t,c.width,c.height),a(t,c.width,c.height))};onComponentKeyDown=t=>{let{crop:i,disabled:r,onChange:l,onComplete:s}=this.props;if(r)return;let c=t.key,h=!1;if(!i)return;let d=this.getBox(),u=this.makePixelCrop(d),m=(navigator.platform.match("Mac")?t.metaKey:t.ctrlKey)?e.nudgeStepLarge:t.shiftKey?e.nudgeStepMedium:e.nudgeStep;if("ArrowLeft"===c?(u.x-=m,h=!0):"ArrowRight"===c?(u.x+=m,h=!0):"ArrowUp"===c?(u.y-=m,h=!0):"ArrowDown"===c&&(u.y+=m,h=!0),h){t.cancelable&&t.preventDefault(),u.x=n(u.x,0,d.width-u.width),u.y=n(u.y,0,d.height-u.height);let e=o(u,d.width,d.height),i=a(u,d.width,d.height);l(e,i),s&&s(e,i)}};onHandlerKeyDown=(t,i)=>{var n,s;let c,{aspect:h=0,crop:d,disabled:u,minWidth:m=0,minHeight:g=0,maxWidth:p,maxHeight:f,onChange:w,onComplete:x}=this.props,y=this.getBox();if(u||!d||"ArrowUp"!==t.key&&"ArrowDown"!==t.key&&"ArrowLeft"!==t.key&&"ArrowRight"!==t.key)return;t.stopPropagation(),t.preventDefault();let b=(navigator.platform.match("Mac")?t.metaKey:t.ctrlKey)?e.nudgeStepLarge:t.shiftKey?e.nudgeStepMedium:e.nudgeStep,v=l((n=o(d,y.width,y.height),s=t.key,c={...n},"ArrowLeft"===s?"nw"===i?(c.x-=b,c.y-=b,c.width+=b,c.height+=b):"w"===i?(c.x-=b,c.width+=b):"sw"===i?(c.x-=b,c.width+=b,c.height+=b):"ne"===i?(c.y+=b,c.width-=b,c.height-=b):"e"===i?c.width-=b:"se"===i&&(c.width-=b,c.height-=b):"ArrowRight"===s&&("nw"===i?(c.x+=b,c.y+=b,c.width-=b,c.height-=b):"w"===i?(c.x+=b,c.width-=b):"sw"===i?(c.x+=b,c.width-=b,c.height-=b):"ne"===i?(c.y-=b,c.width+=b,c.height+=b):"e"===i?c.width+=b:"se"===i&&(c.width+=b,c.height+=b)),"ArrowUp"===s?"nw"===i?(c.x-=b,c.y-=b,c.width+=b,c.height+=b):"n"===i?(c.y-=b,c.height+=b):"ne"===i?(c.y-=b,c.width+=b,c.height+=b):"sw"===i?(c.x+=b,c.width-=b,c.height-=b):"s"===i?c.height-=b:"se"===i&&(c.width-=b,c.height-=b):"ArrowDown"===s&&("nw"===i?(c.x+=b,c.y+=b,c.width-=b,c.height-=b):"n"===i?(c.y+=b,c.height-=b):"ne"===i?(c.y+=b,c.width-=b,c.height-=b):"sw"===i?(c.x-=b,c.width+=b,c.height+=b):"s"===i?c.height+=b:"se"===i&&(c.width+=b,c.height+=b)),c),h,i,y.width,y.height,m,g,p,f);if(!r(d,v)){let e=a(v,y.width,y.height);w(v,e),x&&x(v,e)}};onDocPointerDone=e=>{let{crop:t,disabled:i,onComplete:n,onDragEnd:r}=this.props,l=this.getBox();this.unbindDocMove(),!(i||!t)&&this.mouseDownOnCrop&&(this.mouseDownOnCrop=!1,this.dragStarted=!1,r&&r(e),n&&n(o(t,l.width,l.height),a(t,l.width,l.height)),this.setState({cropIsActive:!1,newCropIsBeingDrawn:!1}))};onDragFocus=()=>{this.componentRef.current?.scrollTo(0,0)};getCropStyle(){let{crop:e}=this.props;if(e)return{top:`${e.y}${e.unit}`,left:`${e.x}${e.unit}`,width:`${e.width}${e.unit}`,height:`${e.height}${e.unit}`}}dragCrop(){let{evData:e}=this,t=this.getBox(),i=this.makePixelCrop(t),r=e.clientX-e.startClientX,a=e.clientY-e.startClientY;return i.x=n(e.startCropX+r,0,t.width-i.width),i.y=n(e.startCropY+a,0,t.height-i.height),i}getPointRegion(e,t,i,n){let{evData:r}=this,a=r.clientX-e.x,o=r.clientY-e.y,l;return l=n&&t?"nw"===t||"n"===t||"ne"===t:o<r.startCropY,(i&&t?"nw"===t||"w"===t||"sw"===t:a<r.startCropX)?l?"nw":"sw":l?"ne":"se"}resolveMinDimensions(e,t,i=0,n=0){let r=Math.min(i,e.width),a=Math.min(n,e.height);return t&&(r||a)?t>1?r?[r,r/t]:[a*t,a]:a?[a*t,a]:[r,r/t]:[r,a]}resizeCrop(){let{evData:t}=this,{aspect:i=0,maxWidth:r,maxHeight:a}=this.props,o=this.getBox(),[s,c]=this.resolveMinDimensions(o,i,this.props.minWidth,this.props.minHeight),h=this.makePixelCrop(o),d=this.getPointRegion(o,t.ord,s,c),u=t.ord||d,m=t.clientX-t.startClientX,g=t.clientY-t.startClientY;(s&&"nw"===u||"w"===u||"sw"===u)&&(m=Math.min(m,-s)),(c&&"nw"===u||"n"===u||"ne"===u)&&(g=Math.min(g,-c));let p={unit:"px",x:0,y:0,width:0,height:0};"ne"===d?(p.x=t.startCropX,p.width=m,i?p.height=p.width/i:p.height=Math.abs(g),p.y=t.startCropY-p.height):"se"===d?(p.x=t.startCropX,p.y=t.startCropY,p.width=m,i?p.height=p.width/i:p.height=g):"sw"===d?(p.x=t.startCropX+m,p.y=t.startCropY,p.width=Math.abs(m),i?p.height=p.width/i:p.height=g):"nw"===d&&(p.x=t.startCropX+m,p.width=Math.abs(m),i?(p.height=p.width/i,p.y=t.startCropY-p.height):(p.height=Math.abs(g),p.y=t.startCropY+g));let f=l(p,i,d,o.width,o.height,s,c,r,a);return i||e.xyOrds.indexOf(u)>-1?h=f:e.xOrds.indexOf(u)>-1?(h.x=f.x,h.width=f.width):e.yOrds.indexOf(u)>-1&&(h.y=f.y,h.height=f.height),h.x=n(h.x,0,o.width-h.width),h.y=n(h.y,0,o.height-h.height),h}renderCropSelection(){let{ariaLabels:i=e.defaultProps.ariaLabels,disabled:n,locked:r,renderSelectionAddon:a,ruleOfThirds:o,crop:l}=this.props,s=this.getCropStyle();if(l)return t.default.createElement("div",{style:s,className:"ReactCrop__crop-selection",onPointerDown:this.onCropPointerDown,"aria-label":i.cropArea,tabIndex:0,onKeyDown:this.onComponentKeyDown,role:"group"},!n&&!r&&t.default.createElement("div",{className:"ReactCrop__drag-elements",onFocus:this.onDragFocus},t.default.createElement("div",{className:"ReactCrop__drag-bar ord-n","data-ord":"n"}),t.default.createElement("div",{className:"ReactCrop__drag-bar ord-e","data-ord":"e"}),t.default.createElement("div",{className:"ReactCrop__drag-bar ord-s","data-ord":"s"}),t.default.createElement("div",{className:"ReactCrop__drag-bar ord-w","data-ord":"w"}),t.default.createElement("div",{className:"ReactCrop__drag-handle ord-nw","data-ord":"nw",tabIndex:0,"aria-label":i.nwDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"nw"),role:"button"}),t.default.createElement("div",{className:"ReactCrop__drag-handle ord-n","data-ord":"n",tabIndex:0,"aria-label":i.nDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"n"),role:"button"}),t.default.createElement("div",{className:"ReactCrop__drag-handle ord-ne","data-ord":"ne",tabIndex:0,"aria-label":i.neDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"ne"),role:"button"}),t.default.createElement("div",{className:"ReactCrop__drag-handle ord-e","data-ord":"e",tabIndex:0,"aria-label":i.eDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"e"),role:"button"}),t.default.createElement("div",{className:"ReactCrop__drag-handle ord-se","data-ord":"se",tabIndex:0,"aria-label":i.seDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"se"),role:"button"}),t.default.createElement("div",{className:"ReactCrop__drag-handle ord-s","data-ord":"s",tabIndex:0,"aria-label":i.sDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"s"),role:"button"}),t.default.createElement("div",{className:"ReactCrop__drag-handle ord-sw","data-ord":"sw",tabIndex:0,"aria-label":i.swDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"sw"),role:"button"}),t.default.createElement("div",{className:"ReactCrop__drag-handle ord-w","data-ord":"w",tabIndex:0,"aria-label":i.wDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"w"),role:"button"})),a&&t.default.createElement("div",{className:"ReactCrop__selection-addon",onPointerDown:e=>e.stopPropagation()},a(this.state)),o&&t.default.createElement(t.default.Fragment,null,t.default.createElement("div",{className:"ReactCrop__rule-of-thirds-hz"}),t.default.createElement("div",{className:"ReactCrop__rule-of-thirds-vt"})))}makePixelCrop(e){return o({...i,...this.props.crop||{}},e.width,e.height)}render(){let{aspect:e,children:i,circularCrop:n,className:r,crop:a,disabled:o,locked:l,style:s,ruleOfThirds:c}=this.props,{cropIsActive:h,newCropIsBeingDrawn:d}=this.state,u=a?this.renderCropSelection():null,m=((...e)=>e.filter(e=>e&&"string"==typeof e).join(" "))("ReactCrop",r,h&&"ReactCrop--active",o&&"ReactCrop--disabled",l&&"ReactCrop--locked",d&&"ReactCrop--new-crop",a&&e&&"ReactCrop--fixed-aspect",a&&n&&"ReactCrop--circular-crop",a&&c&&"ReactCrop--rule-of-thirds",!this.dragStarted&&a&&!a.width&&!a.height&&"ReactCrop--invisible-crop",n&&"ReactCrop--no-animate");return t.default.createElement("div",{ref:this.componentRef,className:m,style:s},t.default.createElement("div",{ref:this.mediaRef,className:"ReactCrop__child-wrapper",onPointerDown:this.onComponentPointerDown},i),a?t.default.createElement("svg",{className:"ReactCrop__crop-mask",width:"100%",height:"100%"},t.default.createElement("defs",null,t.default.createElement("mask",{id:`hole-${this.instanceId}`},t.default.createElement("rect",{width:"100%",height:"100%",fill:"white"}),n?t.default.createElement("ellipse",{cx:`${a.x+a.width/2}${a.unit}`,cy:`${a.y+a.height/2}${a.unit}`,rx:`${a.width/2}${a.unit}`,ry:`${a.height/2}${a.unit}`,fill:"black"}):t.default.createElement("rect",{x:`${a.x}${a.unit}`,y:`${a.y}${a.unit}`,width:`${a.width}${a.unit}`,height:`${a.height}${a.unit}`,fill:"black"}))),t.default.createElement("rect",{fill:"black",fillOpacity:.5,width:"100%",height:"100%",mask:`url(#hole-${this.instanceId})`})):void 0,u)}};e.s(["f",0,h])},469937,e=>{var t=e.i(843476),i=e.i(786563),n=e.i(111110),r=e.i(975157);let a=[1,2,3,4,5];e.s(["f",0,function({value:e,onChange:o,disabled:l,size:s="sm",showUnrated:c=!0,className:h}){let{t:d}=(0,n.b)(),u=e??0,m="sm"===s?"h-3.5 w-3.5":"h-5 w-5",g=u?d.difficulty.starsLabel.replace("{n}",String(u)):d.difficulty.unrated;return o?(0,t.jsxs)("span",{className:(0,r.f)("inline-flex items-center gap-0.5",h),role:"group","aria-label":`${d.difficulty.label}${d.common.colon}${g}`,title:d.difficulty.clearHint,children:[a.map(e=>(0,t.jsx)("button",{type:"button",disabled:l,onClick:()=>o(e===u?null:e),"aria-label":d.difficulty.setStars.replace("{n}",String(e)),"aria-pressed":e<=u,className:"rounded p-0.5 hover:bg-muted disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:(0,t.jsx)(i.f,{className:(0,r.f)(m,e<=u?"fill-amber-400 text-amber-400":"text-muted-foreground/40")})},e)),!u&&c&&(0,t.jsx)("span",{className:"ml-1 text-xs text-muted-foreground",children:d.difficulty.unrated})]}):u?(0,t.jsx)("span",{className:(0,r.f)("inline-flex items-center",h),role:"img","aria-label":`${d.difficulty.label}${d.common.colon}${g}`,title:g,children:a.map(e=>(0,t.jsx)(i.f,{className:(0,r.f)(m,e<=u?"fill-amber-400 text-amber-400":"text-muted-foreground/30"),"aria-hidden":!0},e))}):c?(0,t.jsx)("span",{className:(0,r.f)("text-xs text-muted-foreground",h),children:d.difficulty.unrated}):null}])},12130,271945,e=>{var t=e.i(843476),i=e.i(271645),n=e.i(232660),r=e.i(519455),a=e.i(776639),o=e.i(263676),l=e.i(111110);async function s(e,t){let{naturalWidth:i,naturalHeight:n}=e;return Promise.all(t.map(t=>new Promise((r,a)=>{let o=document.createElement("canvas"),l=Math.round(t.x*i),s=Math.round(t.y*n);o.width=Math.max(1,Math.round(t.width*i)),o.height=Math.max(1,Math.round(t.height*n));let c=o.getContext("2d");c?(c.drawImage(e,l,s,o.width,o.height,0,0,o.width,o.height),o.toBlob(e=>e?r(e):a(Error("Canvas is empty")),"image/jpeg",.95)):a(Error("Canvas is not supported"))})))}let c={maxHeight:"65vh",maxWidth:"100%",objectFit:"contain"},h=(0,i.forwardRef)(function({imageSrc:e,regions:n,onChange:r,imageStyle:a=c,onImageLoad:s},h){let{t:d}=(0,l.b)(),u=(0,i.useRef)(null),m=(0,i.useRef)(null),[g,p]=(0,i.useState)(null),f=e=>{let t=u.current.getBoundingClientRect();return{x:(e.clientX-t.left)/t.width,y:(e.clientY-t.top)/t.height}},w=()=>{g&&g.width>=.02&&g.height>=.02&&r([...n,g]),m.current=null,p(null)},x=e=>({left:`${100*e.x}%`,top:`${100*e.y}%`,width:`${100*e.width}%`,height:`${100*e.height}%`});return(0,t.jsxs)("div",{className:"relative inline-block select-none",children:[(0,t.jsx)("img",{ref:h,src:e,alt:"",draggable:!1,style:a,onLoad:s,className:"block"}),(0,t.jsxs)("div",{ref:u,className:"absolute inset-0 cursor-crosshair",style:{touchAction:"none"},onPointerDown:e=>{0===e.button&&(u.current?.setPointerCapture(e.pointerId),m.current=f(e),p(null))},onPointerMove:e=>{var t,i,n,r;let a,o,l;if(!m.current)return;let s=f(e);p((t=m.current.x,i=m.current.y,n=s.x,r=s.y,o=(a=e=>Math.min(1,Math.max(0,e)))(Math.min(t,n)),l=a(Math.min(i,r)),{x:o,y:l,width:a(Math.max(t,n))-o,height:a(Math.max(i,r))-l}))},onPointerUp:w,onPointerCancel:w,children:[n.map((e,i)=>(0,t.jsxs)("div",{className:"absolute border-2 border-sky-400 bg-sky-400/15",style:x(e),children:[(0,t.jsx)("span",{className:"absolute left-0 top-0 bg-sky-500 px-1.5 text-xs font-bold text-white",children:i+1}),(0,t.jsx)("button",{type:"button",className:"absolute -right-3 -top-3 flex h-6 w-6 items-center justify-center rounded-full bg-red-500 text-white shadow","aria-label":d.batchImport.removeRegion.replace("{index}",String(i+1)),onPointerDown:e=>e.stopPropagation(),onClick:()=>r(n.filter((e,t)=>t!==i)),children:(0,t.jsx)(o.X,{className:"h-3 w-3"})})]},i)),g&&(0,t.jsx)("div",{className:"absolute border-2 border-dashed border-yellow-300 bg-yellow-300/10",style:x(g)})]})]})});var d=e.i(456420);let u={name:"zoom-in",size:24,node:[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]};u.node;let m=(0,d.f)(u),g={name:"zoom-out",size:24,node:[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]};g.node;let p=(0,d.f)(g);function f({zoom:e,onZoomIn:i,onZoomOut:n,onReset:r}){let{t:a}=(0,l.b)(),o="outline-none focus-visible:ring-2 focus-visible:ring-white/70",s=`flex h-9 w-9 items-center justify-center rounded-full text-white transition-colors hover:bg-white/20 disabled:opacity-40 disabled:hover:bg-transparent ${o}`;return(0,t.jsxs)("div",{className:"flex items-center gap-0.5 rounded-full bg-black/60 p-1 shadow-lg backdrop-blur-sm",children:[(0,t.jsx)("button",{type:"button",className:s,onClick:n,disabled:e<=1,"aria-label":a.common.cropper.zoomOut,title:a.common.cropper.zoomOut,children:(0,t.jsx)(p,{className:"h-4 w-4"})}),(0,t.jsxs)("button",{type:"button",className:`h-9 min-w-14 rounded-full px-2 text-center text-xs font-medium tabular-nums text-white hover:bg-white/20 ${o}`,onClick:r,"aria-label":a.common.cropper.resetZoom,title:a.common.cropper.resetZoom,children:[Math.round(100*e),"%"]}),(0,t.jsx)("button",{type:"button",className:s,onClick:i,disabled:e>=5,"aria-label":a.common.cropper.zoomIn,title:a.common.cropper.zoomIn,children:(0,t.jsx)(m,{className:"h-4 w-4"})})]})}var w=e.i(201276),x=e.i(804536);let y="image-cropper-mode",b=["single","auto","multi"];e.s(["U",0,b,"p",0,y,"S",0,["image","text","file","direct"],"c",0,"question-input-mode","k",0,["image","text"]],271945);let v={single:{maxHeight:"70vh",maxWidth:"100%",objectFit:"contain"},auto:{maxHeight:"65vh",maxWidth:"100%",objectFit:"contain"},multi:{maxHeight:"65vh",maxWidth:"100%",objectFit:"contain"}};e.s(["f",0,function({imageSrc:e,open:o,onClose:c,onCropComplete:d,onMultiCropComplete:u,onRegionsSelected:m,allowMulti:g=!0,onAutoSplit:p,onAddPart:C,partCount:k=0}){let{t:j}=(0,l.b)(),D=/^(blob:|data:image\/)/i.test(e)?e:void 0,[M,E]=(0,i.useState)(),_=(0,i.useRef)(null),[N,R]=(0,x.y)(y,b,"single"),S=["single",...p?["auto"]:[],...u||m&&g?["multi"]:[]],L=S.includes(N)?N:"single",{containerRef:I,zoom:P,imageStyle:z,measureImage:$,zoomIn:H,zoomOut:A,reset:B}=function(e){let[t,n]=(0,i.useState)(null),r=(0,i.useRef)(null),a=(0,i.useCallback)(e=>{r.current=e,n(e)},[]),[o,l]=(0,i.useState)(1),s=(0,i.useRef)(1),[c,h]=(0,i.useState)(null),d=(0,i.useRef)(null),u=(0,i.useRef)(!1),m=(0,i.useCallback)((e,t,i)=>{let n=r.current,a=s.current,o=Math.min(5,Math.max(1,e));if(!n||o===a)return;if(1===a){let e=n.querySelector("img");e&&h(e.clientWidth)}let c=n.getBoundingClientRect(),u=(t??c.left+c.width/2)-c.left,m=(i??c.top+c.height/2)-c.top;d.current={viewX:u,viewY:m,contentX:n.scrollLeft+u,contentY:n.scrollTop+m,ratio:o/a},s.current=o,l(o)},[]);(0,i.useLayoutEffect)(()=>{let e=r.current,t=d.current;e&&t&&(e.scrollLeft=t.contentX*t.ratio-t.viewX,e.scrollTop=t.contentY*t.ratio-t.viewY,d.current=null)},[o]),(0,i.useEffect)(()=>{if(!t)return;let e=e=>{e.preventDefault(),m(s.current*Math.exp(-(.0015*e.deltaY)),e.clientX,e.clientY)},i=null,n=e=>{let[t,i]=[e[0],e[1]];return{distance:Math.hypot(t.clientX-i.clientX,t.clientY-i.clientY),centerX:(t.clientX+i.clientX)/2,centerY:(t.clientY+i.clientY)/2}},r=e=>{2===e.touches.length&&(i={distance:n(e.touches).distance,zoom:s.current},u.current=!0)},a=e=>{if(!i||2!==e.touches.length)return;e.preventDefault();let{distance:t,centerX:r,centerY:a}=n(e.touches);i.distance>0&&m(i.zoom*(t/i.distance),r,a)},o=e=>{e.touches.length<2&&(i=null,u.current=!1)},l=e=>{u.current&&e.stopPropagation()};return t.addEventListener("wheel",e,{passive:!1}),t.addEventListener("touchstart",r,{passive:!0}),t.addEventListener("touchmove",a,{passive:!1}),t.addEventListener("touchend",o),t.addEventListener("touchcancel",o),t.addEventListener("pointermove",l,{capture:!0}),()=>{t.removeEventListener("wheel",e),t.removeEventListener("touchstart",r),t.removeEventListener("touchmove",a),t.removeEventListener("touchend",o),t.removeEventListener("touchcancel",o),t.removeEventListener("pointermove",l,{capture:!0})}},[t,m]);let g=(0,i.useCallback)(e=>{e&&1===s.current&&h(e.clientWidth)},[]),p=(0,i.useCallback)(()=>m(1.25*s.current),[m]),f=(0,i.useCallback)(()=>m(s.current/1.25),[m]),w=(0,i.useCallback)(()=>{s.current=1,d.current=null,l(1)},[]),x=1!==o&&c?{...e,width:c*o,height:"auto",maxWidth:"none",maxHeight:"none"}:e;return{containerRef:a,zoom:o,imageStyle:x,measureImage:g,zoomIn:p,zoomOut:f,reset:w}}(v[L]);(0,i.useEffect)(()=>{B()},[e,B]);let[Y,O]=(0,i.useState)({src:e,regions:[]}),X=Y.src===e?Y.regions:[],U=t=>O({src:e,regions:t}),K=(0,i.useRef)(null),F={single:j.batchImport.singleMode,auto:j.batchImport.autoMode,multi:j.batchImport.multiMode},T=async()=>{if(0!==X.length){if(m){m(X,!0),U([]);return}if(K.current&&u)try{u(await s(K.current,X)),U([])}catch(e){w.V.error("[ImageCropper]","Multi-image crop failed",{error:e})}}},G=()=>M&&M.width>0&&M.height>0?{x:M.x/100,y:M.y/100,width:M.width/100,height:M.height/100}:{x:0,y:0,width:1,height:1},W=async()=>{let e=G();if("auto"===L&&p)return void p(e);if(m)return void m([e],!1);if(_.current&&d)try{let[t]=await s(_.current,[e]);d(t)}catch(e){w.V.error("[ImageCropper]","Crop failed",{error:e})}};return(0,t.jsx)(a.N,{open:o,onOpenChange:e=>!e&&c(),children:(0,t.jsxs)(a.d,{className:"max-w-3xl h-[90vh] flex flex-col p-0 gap-0",children:[(0,t.jsx)(a.s,{className:"p-4 border-b shrink-0",children:(0,t.jsx)(a.F,{children:j.common.cropper?.title||"Crop Image"})}),(0,t.jsxs)("div",{className:"relative min-h-0 flex-1 bg-black",children:[(0,t.jsx)("div",{ref:I,className:"flex h-full w-full overflow-auto p-4",children:(0,t.jsx)("div",{className:"m-auto",children:"multi"===L?(0,t.jsx)(h,{ref:K,imageSrc:D,regions:X,onChange:U,imageStyle:z,onImageLoad:e=>$(e.currentTarget)}):(0,t.jsx)(n.f,{crop:M,onChange:(e,t)=>E(t),children:(0,t.jsx)("img",{ref:_,alt:"Crop me",src:D,onLoad:function(e){E({unit:"%",x:0,y:0,width:100,height:100}),$(e.currentTarget)},style:z})})})}),(0,t.jsx)("div",{className:"absolute right-3 top-3",children:(0,t.jsx)(f,{zoom:P,onZoomIn:H,onZoomOut:A,onReset:B})})]}),(0,t.jsxs)("div",{className:"p-4 border-t bg-background shrink-0 space-y-3",children:[S.length>1&&(0,t.jsx)("div",{className:`grid gap-1 rounded-md bg-muted p-1 ${3===S.length?"grid-cols-3 sm:w-[28rem]":"grid-cols-2 sm:w-80"}`,children:S.map(e=>(0,t.jsx)("button",{type:"button","aria-pressed":L===e,onClick:()=>{B(),R(e)},className:`rounded px-2 py-1.5 text-sm font-medium transition-colors ${L===e?"bg-background shadow-sm":"text-muted-foreground"}`,children:F[e]},e))}),(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row sm:justify-between sm:items-center gap-3",children:[(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:"multi"===L?`${j.batchImport.hint} ${j.batchImport.regionCount.replace("{count}",String(X.length))}`:"auto"===L?j.batchImport.autoHint:k>0?j.upload.parts.cropHint.replace("{n}",String(k+1)):j.common.cropper?.hint||"💡 Drag to adjust crop area"}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2 justify-end",children:["multi"===L&&X.length>0&&(0,t.jsx)(r.f,{variant:"ghost",onClick:()=>U([]),children:j.batchImport.clear}),(0,t.jsx)(r.f,{variant:"outline",onClick:c,children:j.common.cancel||"Cancel"}),"multi"===L?(0,t.jsx)(r.f,{onClick:T,disabled:0===X.length,children:j.batchImport.start.replace("{count}",String(X.length))}):(0,t.jsxs)(t.Fragment,{children:["single"===L&&C&&(0,t.jsx)(r.f,{variant:"secondary",onClick:()=>C(G()),"data-testid":"crop-add-part",children:j.upload.parts.addNext}),(0,t.jsx)(r.f,{onClick:W,children:"auto"===L?j.batchImport.autoStart:k>0?j.upload.parts.confirm.replace("{count}",String(k+1)):j.common.confirm||"Confirm"})]})]})]})]})]})})}],12130)},141176,e=>{var t=e.i(843476),i=e.i(271645),n=e.i(456420);let r={name:"code-xml",size:24,node:[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],aliases:["code-2"]};r.node;let a=(0,n.f)(r);var o=e.i(772382),l=e.i(511445),s=e.i(624687),c=e.i(111110),h=e.i(975157);e.s(["f",0,function({value:e,onChange:n,className:r,...d}){let{t:u}=(0,c.b)(),[m,g]=(0,i.useState)("source"),p=(0,i.useId)(),f=[{mode:"source",label:u.markdownEditor.source,icon:a},{mode:"preview",label:u.markdownEditor.preview,icon:o.f}];return(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("div",{role:"tablist","aria-label":u.markdownEditor.modeLabel,className:"flex justify-end",children:(0,t.jsx)("div",{className:"inline-flex rounded-md border bg-muted/40 p-0.5",children:f.map(({mode:e,label:i,icon:n})=>(0,t.jsxs)("button",{type:"button",role:"tab","aria-selected":m===e,"aria-controls":p,onClick:()=>g(e),className:(0,h.f)("flex items-center gap-1 rounded px-2.5 py-1 text-xs transition-colors",m===e?"bg-background font-medium shadow-sm":"text-muted-foreground hover:text-foreground"),children:[(0,t.jsx)(n,{className:"h-3.5 w-3.5"}),i]},e))})}),(0,t.jsx)("div",{id:p,role:"tabpanel",children:"source"===m?(0,t.jsx)(s.f,{value:e,onChange:e=>n(e.target.value),className:r,...d}):(0,t.jsx)("div",{className:"min-h-24 cursor-text rounded-md border bg-muted/20 px-3 py-2",onDoubleClick:()=>g("source"),title:u.markdownEditor.doubleClickToEdit,children:e.trim()?(0,t.jsx)(l.f,{content:e}):(0,t.jsx)("p",{className:"text-sm italic text-muted-foreground",children:u.markdownEditor.empty})})})]})}],141176)},438465,674166,e=>{var t=e.i(843476),i=e.i(271645),n=e.i(967489),r=e.i(856423),a=e.i(41931),o=e.i(201276),l=e.i(111110);e.s(["f",0,function({value:e,onChange:s,className:c}){let[h,d]=(0,i.useState)([]),{t:u}=(0,l.b)();return(0,i.useEffect)(()=>{(async()=>{try{let e=await a.k.get("/api/notebooks");d(e)}catch(e){o.V.error("[NotebookSelector]","Failed to fetch notebooks",{error:e})}})()},[]),(0,t.jsxs)(n.d,{value:e,onValueChange:s,children:[(0,t.jsx)(n.P,{className:c,children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(r.f,{className:"h-4 w-4 text-muted-foreground"}),(0,t.jsx)(n.U,{placeholder:u.notebooks?.selector?.placeholder||"Select Notebook"})]})}),(0,t.jsx)(n.r,{children:0===h.length?(0,t.jsx)("div",{className:"p-2 text-sm text-muted-foreground text-center",children:u.notebooks?.selector?.empty||"No notebooks available"}):h.map(e=>(0,t.jsx)(n.T,{value:e.id,children:e.name},e.id))})]})}],438465);var s=e.i(470279);e.s(["f",0,function({value:e,onChange:i,disabled:r}){let{groups:a,loading:o}=(0,s.f)(),l=a.filter(e=>e.isActive);return(0,t.jsxs)(n.d,{value:e,onValueChange:i,disabled:r||o,children:[(0,t.jsx)(n.P,{children:(0,t.jsx)(n.U,{placeholder:"选择卷别"})}),(0,t.jsx)(n.r,{children:l.map(e=>(0,t.jsx)(n.T,{value:e.id,children:e.name},e.id))})]})}],674166)},149704,e=>{var t=e.i(843476),i=e.i(111110),n=e.i(398019),r=e.i(184110),a=e.i(975157);let o={left:"mr-auto",center:"mx-auto",right:"ml-auto"};e.s(["f",0,function({svg:e,scale:l,align:s,className:c}){let{t:h}=(0,i.b)();if(!e)return null;let d=(0,r.V)(l),u=(0,r.o)(s);return(0,t.jsx)("figure",{className:(0,a.f)("question-figure my-3",c),children:(0,t.jsx)("img",{src:(0,n.d)(e),alt:h.figure.alt,className:(0,a.f)(o[u],"block h-auto max-w-full rounded border bg-white p-2"),style:{..."left"===u?{marginLeft:0,marginRight:"auto"}:"right"===u?{marginLeft:"auto",marginRight:0}:{},maxHeight:360,zoom:d/100,maxWidth:`${Math.min(d,100)}%`}})})}])},574041,e=>{var t=e.i(843476),i=e.i(271645),n=e.i(263676),r=e.i(487486),a=e.i(793479),o=e.i(41931),l=e.i(201276);e.s(["f",0,function({value:e=[],onChange:s,placeholder:c="Enter tags...",className:h="",enterHint:d,subject:u,gradeStage:m}){let[g,p]=(0,i.useState)(""),[f,w]=(0,i.useState)([]),[x,y]=(0,i.useState)(!1),[b,v]=(0,i.useState)(0),C=(0,i.useRef)(null),k=(0,i.useRef)(null),j=(0,i.useCallback)(async t=>{try{let i=new URLSearchParams({q:t});u&&i.append("subject",u),m&&i.append("stage",m);let n=((await o.k.get(`/api/tags/suggestions?${i.toString()}`)).suggestions||[]).filter(t=>!e.includes(t));w(n.slice(0,20)),y(n.length>0),v(0)}catch(e){l.V.error("[TagInput]","Failed to fetch suggestions",{error:e})}},[u,m,e]);(0,i.useEffect)(()=>{g.trim()&&j(g)},[g,j]);let D=t=>{t.trim()&&!e.includes(t.trim())&&(s([...e,t.trim()]),p(""),w([]),y(!1),v(0))},M=t=>{s(e.filter(e=>e!==t))};return(0,i.useEffect)(()=>{let e=e=>{!k.current||k.current.contains(e.target)||C.current?.contains(e.target)||y(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),(0,t.jsxs)("div",{className:`relative ${h}`,children:[(0,t.jsxs)("div",{className:"flex flex-wrap gap-2 p-2 border rounded-lg bg-background min-h-[42px]",children:[e.map(e=>(0,t.jsxs)(r.f,{variant:"secondary",className:"flex items-center gap-1 px-2 py-1",children:[e,(0,t.jsx)("button",{type:"button",onClick:()=>M(e),className:"hover:text-destructive ml-1",children:(0,t.jsx)(n.X,{className:"h-3 w-3"})})]},e)),(0,t.jsx)(a.f,{ref:C,type:"text",value:g,onChange:e=>{p(e.target.value),e.target.value.trim()||(w([]),y(!1))},onKeyDown:t=>{"Enter"===t.key?(t.preventDefault(),b>=0&&f[b]?D(f[b]):g.trim()&&D(g)):"ArrowDown"===t.key?(t.preventDefault(),v(e=>Math.min(e+1,f.length-1))):"ArrowUp"===t.key?(t.preventDefault(),v(e=>Math.max(e-1,0))):"Escape"===t.key?(y(!1),v(0)):"Backspace"===t.key&&!g&&e.length>0&&M(e[e.length-1])},onFocus:()=>{f.length>0&&y(!0)},placeholder:0===e.length?c:"",className:"flex-1 min-w-[120px] border-none focus-visible:ring-0 focus-visible:ring-offset-0 h-8 px-0"})]}),x&&f.length>0&&(0,t.jsx)("div",{ref:k,className:"absolute z-50 w-full mt-1 bg-popover border rounded-md shadow-md max-h-48 overflow-y-auto",children:f.map((e,i)=>(0,t.jsx)("div",{className:`px-3 py-2 cursor-pointer hover:bg-accent ${i===b?"bg-accent":""}`,onClick:()=>D(e),onMouseEnter:()=>v(i),children:e},e))}),g&&!x&&(0,t.jsx)("div",{className:"text-xs text-muted-foreground mt-1",children:d?`${d} "${g}"`:`Press Enter to create "${g}"`})]})}])},184110,e=>{let t=["left","center","right"],i="center";function n(e){return"number"==typeof e&&Number.isInteger(e)&&e>=10&&e<=200}e.s(["E",0,i,"n",0,100,"j",0,t,"a",0,200,"_",0,10,"x",0,n,"o",0,function(e){return"string"==typeof e&&t.includes(e)?e:i},"V",0,function(e){return n(e)?e:100}])},398019,e=>{e.s(["K",0,1e5,"d",0,function(e){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`}])},804536,e=>{var t=e.i(271645);let i=new Map,n=new Set;function r(e){return n.add(e),window.addEventListener("storage",e),()=>{n.delete(e),window.removeEventListener("storage",e)}}function a(e,a,o){let l=(0,t.useSyncExternalStore)(r,()=>(function(e){if(i.has(e))return i.get(e)??null;try{return window.localStorage.getItem(e)}catch{return null}})(e),()=>null);return[(0,t.useMemo)(()=>a(l),[a,l]),(0,t.useCallback)(t=>(function(e,t){try{window.localStorage.setItem(e,t),i.delete(e)}catch{i.set(e,t)}n.forEach(e=>e())})(e,o(t)),[e,o])]}let o=e=>e;e.s(["y",0,function(e,i,n){return a(e,(0,t.useCallback)(e=>i.includes(e??"")?e:n,[i,n]),o)},"x",0,a])},213761,e=>{let t={maxLongEdge:4096,maxPixels:4915200,maxBytes:1572864,startQuality:.9,minQuality:.8};class i extends Error{code;format;constructor(e,t,i){super(e,void 0===i?void 0:{cause:i}),this.code=e,this.format=t,this.name="ImageDecodeError"}}let n=new Set(["heic","heix","heim","heis","hevc","hevx","hevm","hevs"]),r=new Set(["mif1","msf1","mif2"]),a=new Set(["avif","avis"]);function o(e,i,n=t){let r=Math.min(1,n.maxLongEdge/Math.max(e,i),Math.sqrt(n.maxPixels/Math.max(1,e*i)));return{width:Math.max(1,Math.floor(e*r)),height:Math.max(1,Math.floor(i*r)),scale:r}}async function l(e){let t,i;if("function"==typeof createImageBitmap)try{return await createImageBitmap(e,{imageOrientation:"from-image"})}catch{}let n=await (t=URL.createObjectURL(e),(i=new Image).decoding="async",new Promise((e,n)=>{i.onload=()=>e(i),i.onerror=()=>n(Error("IMAGE_ELEMENT_DECODE_FAILED")),i.src=t}).finally(()=>URL.revokeObjectURL(t)));if(!n.naturalWidth||!n.naturalHeight)throw Error("IMAGE_EMPTY");return n}async function s(t){let{heicTo:i}=await e.A(462684);return i({blob:t,type:"image/jpeg",quality:.95})}function c(e,t){return new Promise((i,n)=>{e.toBlob(e=>e?i(e):n(Error("CANVAS_EMPTY")),"image/jpeg",t)})}function h(e,t,i,n,r,a,o){let l,s=((l=document.createElement("canvas")).width=a,l.height=o,l),c=s.getContext("2d");if(!c)throw Error("CANVAS_UNSUPPORTED");return c.fillStyle="#ffffff",c.fillRect(0,0,a,o),c.imageSmoothingEnabled=!0,c.imageSmoothingQuality="high",c.drawImage(e,t,i,n,r,0,0,a,o),s}async function d(e,t){var d;let u,m=performance.now(),g=await e.arrayBuffer(),p=performance.now()-m,f=function(e){let t=(t,i)=>String.fromCharCode(...e.subarray(t,i));if(e.length>=3&&255===e[0]&&216===e[1]&&255===e[2])return"jpeg";if(e.length>=8&&137===e[0]&&"PNG"===t(1,4))return"png";if(e.length>=12&&"RIFF"===t(0,4)&&"WEBP"===t(8,12))return"webp";if(e.length>=6&&("GIF87a"===t(0,6)||"GIF89a"===t(0,6)))return"gif";if(e.length>=2&&"BM"===t(0,2))return"bmp";if(e.length>=12&&"ftyp"===t(4,8)){let i=Math.min(e.length,(e[0]<<24|e[1]<<16|e[2]<<8|e[3])>>>0||e.length),o=[t(8,12)];for(let e=16;e+4<=i;e+=4)o.push(t(e,e+4));if(o.some(e=>n.has(e)))return"heic";if(o.some(e=>a.has(e)))return"avif";if(o.some(e=>r.has(e)))return"heic"}return"unknown"}(new Uint8Array(g,0,Math.min(g.byteLength,64))),w=e.type||"",x=performance.now(),y="native",b=new Blob([g],{type:w||"application/octet-stream"});try{u=await l(b)}catch(e){if("heic"!==f)throw new i("unknown"===f?"UNSUPPORTED_IMAGE":"IMAGE_DECODE_FAILED",f,e);t?.();try{u=await l(await s(b)),y="heic"}catch(e){throw new i("HEIC_DECODE_FAILED",f,e)}}let{width:v,height:C}=(d=u)instanceof HTMLImageElement?{width:d.naturalWidth,height:d.naturalHeight}:{width:d.width,height:d.height};if(!v||!C)throw new i("IMAGE_DECODE_FAILED",f);let k=o(v,C,{maxLongEdge:1600,maxPixels:1/0}),j=await c(h(u,0,0,v,C,k.width,k.height),.85),D=URL.createObjectURL(j),M=performance.now()-x;return{source:u,width:v,height:C,format:f,decoder:y,previewUrl:D,sourceType:w,sourceBytes:e.size,timings:{read:Math.round(p),convert:Math.round(M)},dispose:()=>{URL.revokeObjectURL(D),u instanceof HTMLImageElement||u.close()}}}let u={x:0,y:0,width:1,height:1};async function m(e,i=u,n=t){var r;let a=performance.now(),l=e=>Math.min(1,Math.max(0,e)),s=Math.round(l(i.x)*e.width),d=Math.round(l(i.y)*e.height),g=Math.max(1,Math.min(e.width-s,Math.round(l(i.width)*e.width))),p=Math.max(1,Math.min(e.height-d,Math.round(l(i.height)*e.height))),f=o(g,p,n),w=h(e.source,s,d,g,p,f.width,f.height),x=performance.now()-a,y=performance.now(),b=n.startQuality,v=await c(w,b);for(let t=0;v.size>n.maxBytes&&t<12;t++)b-.05>=n.minQuality-1e-9?b=Math.round((b-.05)*100)/100:(f={width:Math.max(1,Math.floor(.85*f.width)),height:Math.max(1,Math.floor(.85*f.height)),scale:.85*f.scale},w=h(e.source,s,d,g,p,f.width,f.height)),v=await c(w,b);return{dataUrl:await (r=v,new Promise((e,t)=>{let i=new FileReader;i.onload=()=>e(i.result),i.onerror=()=>t(i.error??Error("READ_FAILED")),i.readAsDataURL(r)})),width:f.width,height:f.height,bytes:v.size,quality:b,timings:{crop:Math.round(x),compress:Math.round(performance.now()-y)}}}e.s(["K",0,t,"o",0,i,"N",0,function(e,t){return{sourceType:e.sourceType||e.format,sourceBytes:e.sourceBytes,sourceWidth:e.width,sourceHeight:e.height,outputWidth:t.width,outputHeight:t.height,outputBytes:t.bytes,decoder:e.decoder,quality:t.quality}},"p",0,d,"X",0,m])},991722,e=>{function t(e){return"not_attempted"===e||"wrong_attempt"===e||"unknown"===e?e:"unknown"}e.s(["i",0,function(e,i="zh"){return("en"===i?{not_attempted:"Not attempted",wrong_attempt:"Wrong attempt",unknown:"Unknown"}:{not_attempted:"不会做",wrong_attempt:"做错了",unknown:"未判断"})[t(e)]},"h",0,t,"x",0,function(e,i){return(i||"").trim()?"wrong_attempt":t(e)}])},401280,e=>{let t={single_choice:"single_choice",singlechoice:"single_choice","single choice":"single_choice","single-choice":"single_choice",multiple_choice:"multiple_choice",multiplechoice:"multiple_choice","multiple choice":"multiple_choice","multiple-choice":"multiple_choice",multichoice:"multiple_choice","multi choice":"multiple_choice",true_false:"true_false",truefalse:"true_false","true/false":"true_false","true false":"true_false","true-false":"true_false","true / false":"true_false",fill_blank:"fill_blank",fillblank:"fill_blank","fill in the blank":"fill_blank","fill-in-the-blank":"fill_blank",fillintheblank:"fill_blank",calculation:"calculation",solution:"solution",reading:"reading",cloze:"cloze",writing:"writing",other:"other",选择题:"single_choice",单项选择:"single_choice",单选:"single_choice",单选题:"single_choice",不定项:"multiple_choice",不定项选择:"multiple_choice",多项选择:"multiple_choice",多选:"multiple_choice",多选题:"multiple_choice",判断:"true_false",判断题:"true_false",是非:"true_false",是非题:"true_false",填空:"fill_blank",填空题:"fill_blank",口算:"calculation",计算:"calculation",计算题:"calculation",解答:"solution",解答题:"solution",应用:"solution",应用题:"solution",证明:"solution",证明题:"solution",简答:"solution",简答题:"solution",阅读:"reading",阅读理解:"reading",完形:"cloze",完形填空:"cloze",作文:"writing",写作:"writing",书面表达:"writing",其他:"other"};e.s(["O",0,"__none__","V",0,["single_choice","multiple_choice","true_false","fill_blank","calculation","solution","reading","cloze","writing","other"],"u",0,{single_choice:"Single Choice",multiple_choice:"Multiple Choice",true_false:"True / False",fill_blank:"Fill in the Blank",calculation:"Calculation",solution:"Solution",reading:"Reading Comprehension",cloze:"Cloze",writing:"Writing",other:"Other"},"H",0,{single_choice:"单选题",multiple_choice:"多选题",true_false:"判断题",fill_blank:"填空题",calculation:"计算题",solution:"解答题",reading:"阅读理解",cloze:"完形填空",writing:"写作",other:"其他"},"P",0,function(e){if("string"!=typeof e)return null;let i=e.trim().toLowerCase();return i?t[i]??null:null}])},597138,e=>{e.i(306831),e.s(["f",0,function(e){if(!e)return null;let t=e.toLowerCase();return t.includes("math")||t.includes("数学")?"math":t.includes("physics")||t.includes("物理")?"physics":t.includes("chemistry")||t.includes("化学")?"chemistry":t.includes("biology")||t.includes("生物")?"biology":t.includes("english")||t.includes("英语")?"english":t.includes("chinese")||t.includes("语文")?"chinese":t.includes("history")||t.includes("历史")?"history":t.includes("geography")||t.includes("地理")?"geography":t.includes("politics")||t.includes("政治")?"politics":null}])}])})();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,[711241,e=>{var a=e.i(456420);let s={name:"arrow-left",size:24,node:[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]};s.node;let t=(0,a.f)(s);e.s(["f",0,t],711241)},399847,e=>{var a=e.i(456420);let s={name:"circle-alert",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],aliases:["alert-circle"]};s.node;let t=(0,a.f)(s);e.s(["f",0,t],399847)},13285,e=>{var a=e.i(456420);let s={name:"layers",size:24,node:[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],aliases:["layers-3"]};s.node;let t=(0,a.f)(s);e.s(["f",0,t],13285)},813572,e=>{var a=e.i(843476),s=e.i(271645),t=e.i(618566),i=e.i(518515),n=e.i(328623),l=e.i(747819),r=e.i(866531),o=e.i(12130),c=e.i(430634),d=e.i(576019),m=e.i(847483),p=e.i(497346),u=e.i(717448),f=e.i(798469),x=e.i(393842),h=e.i(956738),g=e.i(185592),j=e.i(111110),k=e.i(41931),v=e.i(201276),y=e.i(35209),b=e.i(598053),I=e.i(315092),N=e.i(804536),S=e.i(271945);e.s(["default",0,function(){let e=(0,t.useParams)(),T=(0,t.useRouter)(),w=e.id,{t:P}=(0,j.b)(),[C,z]=(0,s.useState)(null);(0,y.f)(P.notebooks.title,C?.name,P.pageTitle.addError);let[A,B]=(0,N.y)(S.c,S.k,"image"),R=(0,b.f)({logPrefix:"[AddErrorItem]",analyzeSubjectId:w,importSubjectId:w,textNotebook:{id:w,name:C?.name||""},fixedSubjectId:w});return((0,s.useEffect)(()=>{k.k.get(`/api/notebooks/${w}`).then(e=>z(e)).catch(e=>{v.V.error("[AddErrorItem]","Failed to fetch notebook",{error:e}),T.push("/notebooks")})},[w,T]),C)?(0,a.jsxs)("main",{className:"min-h-screen",children:[(0,a.jsx)(h.f,{status:R.analysisStep,completed:R.completedStages}),(0,a.jsxs)("div",{className:`mx-auto space-y-6 px-4 py-6 md:px-8 md:py-8 ${"review"===R.step?"max-w-6xl":"max-w-4xl"}`,children:[(0,a.jsx)(p.f,{message:R.saveError,onDismiss:R.dismissSaveError}),(0,a.jsx)(x.f,{backHref:`/notebooks/${w}`,title:P.app.addError,description:C.name}),"upload"===R.step&&(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)(g.f,{options:[{value:"image",icon:i.f,label:P.app?.uploadImage||"Take Photo"},{value:"text",icon:n.f,label:P.app?.manualInput||"Manual Input"}],value:A,onChange:B}),R.pendingTask&&(0,a.jsx)(d.f,{task:R.pendingTask,onRefresh:R.refreshPendingTask,onDismiss:R.dismissPendingTask}),R.lastImported&&(0,a.jsx)(c.f,{imported:R.lastImported,onDismiss:R.dismissImported}),R.batchImages?(0,a.jsx)(l.f,{images:R.batchImages,subjectId:w,onClose:R.closeBatch}):"image"===A?(0,a.jsxs)(a.Fragment,{children:[R.parts.length>0&&(0,a.jsx)(m.f,{parts:R.parts.map(e=>e.dataUrl),busy:R.isBusy,onFinish:()=>void R.finishParts(),onDiscard:R.discardParts}),(0,a.jsx)(f.f,{onImageSelect:R.selectImage,isAnalyzing:R.isBusy})]}):(0,a.jsx)(u.f,{onSubmit:R.submitText,isAnalyzing:R.isBusy,defaultNotebookName:C.name,onCreateBatch:R.createTextBatch,creatingBatch:R.creatingBatch})]}),"review"===R.step&&R.parsedData&&(0,a.jsx)(r.f,{initialData:R.parsedData,imagePreview:R.currentImage,onSave:R.saveReviewed,onCancel:R.cancelReview,initialSubjectId:w,aiTimeout:R.aiTimeout})]}),(0,a.jsx)(o.f,{imageSrc:R.croppingImage||"",open:R.isCropperOpen,onClose:R.closeCropper,onRegionsSelected:R.cropRegions,allowMulti:0===R.parts.length,onAutoSplit:0===R.parts.length?R.autoSplitImage:void 0,onAddPart:R.parts.length<I.u-1?R.addPart:void 0,partCount:R.parts.length})]}):(0,a.jsx)("div",{className:"min-h-screen flex items-center justify-center",children:(0,a.jsx)("p",{className:"text-muted-foreground",children:P.common.loading})})}])},590546,e=>{var a=e.i(843476),s=e.i(618566),t=e.i(519455),i=e.i(711241);e.s(["f",0,function({fallbackUrl:e,className:n}){let l=(0,s.useRouter)();return(0,a.jsx)(t.f,{variant:"ghost",size:"icon",onClick:()=>{l.push(e)},className:n,children:(0,a.jsx)(i.f,{className:"h-5 w-5"})})}])},393842,e=>{var a=e.i(843476),s=e.i(590546),t=e.i(975157);e.s(["f",0,function({title:e,description:i,backHref:n,actions:l,titleAddon:r,className:o}){return(0,a.jsxs)("div",{className:(0,t.f)("flex items-start gap-3",o),children:[n&&(0,a.jsx)(s.f,{fallbackUrl:n,className:"-ml-2 shrink-0"}),(0,a.jsxs)("div",{className:"min-w-0 flex-1 space-y-1",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("h1",{className:"truncate text-2xl font-bold tracking-tight sm:text-3xl",children:e}),r]}),i&&(0,a.jsx)("p",{className:"text-sm text-muted-foreground sm:text-base",children:i})]}),l&&(0,a.jsx)("div",{className:"flex shrink-0 items-center gap-2",children:l})]})}])},35209,e=>{var a=e.i(271645),s=e.i(111110);e.s(["f",0,function(...e){let{t}=(0,s.b)(),i=[t.pageTitle.base,...e.map(e=>"string"==typeof e?e.trim():"").filter(e=>e.length>0)].join("-");(0,a.useEffect)(()=>{document.title=i},[i])}])}],462684,e=>{e.v(a=>Promise.all(["static/chunks/2hh64gi4pmlk2.js"].map(a=>e.l(a))).then(()=>a(506175)))}]);
|