wrong-notebook 2026.11.2-1 → 2026.11.2-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/_not-found/page.js.nft.json +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/admin/page.js.nft.json +1 -1
- package/.next/server/app/admin/page_client-reference-manifest.js +1 -1
- package/.next/server/app/admin/user/[id]/page.js.nft.json +1 -1
- package/.next/server/app/admin/user/[id]/page_client-reference-manifest.js +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 +2 -2
- 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/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/[id]/page.js.nft.json +1 -1
- package/.next/server/app/exams/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/exams/[id]/print/page.js.nft.json +1 -1
- package/.next/server/app/exams/[id]/print/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/initialize/page.js.nft.json +1 -1
- package/.next/server/app/initialize/page_client-reference-manifest.js +1 -1
- package/.next/server/app/login/page.js.nft.json +1 -1
- package/.next/server/app/login/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/notebooks/[id]/page.js.nft.json +1 -1
- package/.next/server/app/notebooks/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/notebooks/page.js.nft.json +1 -1
- package/.next/server/app/notebooks/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/app/practice/page.js.nft.json +1 -1
- package/.next/server/app/practice/page_client-reference-manifest.js +1 -1
- package/.next/server/app/print-preview/page.js.nft.json +1 -1
- package/.next/server/app/print-preview/page_client-reference-manifest.js +1 -1
- package/.next/server/app/register/page.js.nft.json +1 -1
- package/.next/server/app/register/page_client-reference-manifest.js +1 -1
- package/.next/server/app/review/page.js.nft.json +1 -1
- package/.next/server/app/review/page_client-reference-manifest.js +1 -1
- package/.next/server/app/setup/page.js.nft.json +1 -1
- package/.next/server/app/setup/page_client-reference-manifest.js +1 -1
- package/.next/server/app/stats/page.js.nft.json +1 -1
- package/.next/server/app/stats/page_client-reference-manifest.js +1 -1
- package/.next/server/app/tags/page.js.nft.json +1 -1
- package/.next/server/app/tags/page_client-reference-manifest.js +1 -1
- package/.next/server/chunks/{[root-of-the-server]__1xyydo-zlm13-._.js → [root-of-the-server]__00jyo3io99_dn._.js} +2 -2
- package/.next/server/chunks/{[root-of-the-server]__0ibwwrznwebhg._.js → [root-of-the-server]__142g4s902bza-._.js} +1 -1
- package/.next/server/chunks/_1upqhtax8p96-._.js +3 -0
- package/.next/server/chunks/ssr/_0ltqx22v65imo._.js +1 -1
- package/.next/server/chunks/ssr/{_12toteu0ut39i._.js → _10stgw6io7x93._.js} +2 -2
- package/.next/server/chunks/ssr/{_0xsd7dy2sxg53._.js → _1hp7fzio98dms._.js} +1 -1
- package/.next/server/chunks/ssr/_1qgg_ll5hkjaf._.js +5 -2
- package/.next/server/chunks/ssr/_1ux6eqqkupo6v._.js +5 -2
- 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_providers_tsx_09kw-mv3nb6xs._.js +14 -14
- package/.next/server/chunks/ssr/src_lib_api-client_ts_04r2_ex-gua5i._.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/0mp9tvylhyxid.js +1 -0
- package/.next/static/chunks/21v7--q2m3c4_.js +1 -0
- package/.next/static/chunks/22gdddnfj38h6.js +1 -0
- package/.next/static/chunks/2btkflolmab19.css +3 -0
- package/.next/static/chunks/2hjp9cnvepyzy.js +247 -0
- package/.next/static/chunks/3_e_larybjcr5.js +1 -0
- package/.next/static/chunks/3au-yz7ullfnr.js +9 -0
- package/package.json +1 -1
- package/prisma/seed.db +0 -0
- package/.next/server/chunks/_008zx49yrqg5a._.js +0 -3
- package/.next/static/chunks/1iixgyplm7q17.js +0 -247
- package/.next/static/chunks/1rzk5q74nsv73.js +0 -1
- package/.next/static/chunks/1sisl9ld-ag-o.js +0 -6
- package/.next/static/chunks/2e0fqyqddz02g.js +0 -1
- package/.next/static/chunks/2huy9i-dnxshq.js +0 -1
- package/.next/static/chunks/3-7dqhvzmyl4y.css +0 -3
- package/.next/static/chunks/37d6vrdascsro.js +0 -1
- /package/.next/static/{RjcLZuifR9iENqJ77CSYI → jqVIU6HRwaZt62YD8QH_p}/_buildManifest.js +0 -0
- /package/.next/static/{RjcLZuifR9iENqJ77CSYI → jqVIU6HRwaZt62YD8QH_p}/_clientMiddlewareManifest.js +0 -0
- /package/.next/static/{RjcLZuifR9iENqJ77CSYI → jqVIU6HRwaZt62YD8QH_p}/_ssgManifest.js +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(()=>{"use strict";(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,218964,e=>{var t=e.i(456420);let s={name:"list-checks",size:24,node:[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]]};s.node;let a=(0,t.f)(s);e.s(["f",0,a],218964)},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 a=(0,t.f)(s);e.s(["f",0,a],856522)},328623,e=>{var t=e.i(456420);let s={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"]};s.node;let a=(0,t.f)(s);e.s(["f",0,a],328623)},697886,e=>{var t=e.i(456420);let s={name:"target",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]};s.node;let a=(0,t.f)(s);e.s(["f",0,a],697886)},952683,e=>{var t=e.i(843476),s=e.i(271645),a=e.i(618566),i=e.i(518515),n=e.i(325597),l=e.i(328623),r=e.i(747819),o=e.i(866531),c=e.i(515288),d=e.i(519455),u=e.i(624687),m=e.i(110204),h=e.i(856522),x=e.i(632781),p=e.i(772382),f=e.i(7891),f=f,g=e.i(395925),v=e.i(111110),y=e.i(511445),b=e.i(574041),j=e.i(438465),w=e.i(674166),k=e.i(967489),N=e.i(952122),S=e.i(294114);function C({onSubmit:e,defaultNotebookId:a,defaultNotebookName:i,isSaving:l}){let{t:r}=(0,v.b)(),[o,E]=(0,s.useState)(null),[A,T]=(0,s.useState)(""),[I,z]=(0,s.useState)(""),[P,$]=(0,s.useState)(""),[M,H]=(0,s.useState)(""),[q,D]=(0,s.useState)(""),[L,_]=(0,s.useState)("unknown"),[R,B]=(0,s.useState)([]),[F,U]=(0,s.useState)(a||""),[V,K]=(0,s.useState)(""),[W,O]=(0,s.useState)(""),Q=async()=>{if(A.trim()){if(!F)return void S.c.warning(r.editor.messages?.selectNotebook||"Please select a notebook");await e({questionText:A.trim(),answerText:I.trim(),analysis:P.trim(),wrongAnswerText:M.trim(),mistakeAnalysis:q.trim(),mistakeStatus:L,knowledgePoints:R,subjectId:F,gradeSemester:V||void 0,paperLevel:W||void 0})}},G=e=>{(e.ctrlKey||e.metaKey)&&"Enter"===e.key&&(e.preventDefault(),A.trim()&&F&&!l&&Q())},X=[{key:"question",label:r.editor?.question||"Question Text",value:A,setter:T,placeholder:r.directEntry.questionPlaceholder,minHeight:"min-h-[180px]",required:!0},{key:"answer",label:r.editor?.answer||"Answer",value:I,setter:z,placeholder:r.directEntry.answerPlaceholder,minHeight:"min-h-[120px]"},{key:"analysis",label:r.editor?.analysis||"Analysis / Explanation",value:P,setter:$,placeholder:r.directEntry.analysisPlaceholder,minHeight:"min-h-[150px]"},{key:"wrongAnswer",label:r.editor?.wrongAnswerText||"Wrong Answer / Work",value:M,setter:H,placeholder:r.directEntry.wrongAnswerPlaceholder,minHeight:"min-h-[100px]"},{key:"mistakeAnalysis",label:r.editor?.mistakeAnalysis||"Mistake Cause Analysis",value:q,setter:D,placeholder:r.directEntry.mistakeAnalysisPlaceholder,minHeight:"min-h-[100px]"}];return(0,t.jsx)(c.N,{className:"rounded-2xl",children:(0,t.jsxs)(c.O,{className:"p-6 space-y-5",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,t.jsx)(n.f,{className:"h-5 w-5"}),(0,t.jsx)("span",{className:"text-sm font-medium",children:r.directEntry.title})]}),(0,t.jsxs)(d.f,{variant:"ghost",size:"sm",onClick:()=>{T(""),z(""),$(""),H(""),D(""),_("unknown"),B([]),K(""),O("")},disabled:l,className:"text-muted-foreground hover:text-destructive",children:[(0,t.jsx)(g.f,{className:"h-4 w-4 mr-1"}),r.directEntry.reset]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)(m.f,{children:[r.editor?.selectNotebook||"Select Notebook"," *"]}),(0,t.jsx)(j.f,{value:F,onChange:U})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(m.f,{children:r.editor?.gradeSemester||"Grade/Semester"}),(0,t.jsx)("input",{type:"text",value:V,onChange:e=>K(e.target.value),placeholder:r.directEntry.gradeSemesterPlaceholder,className:"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm"})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(m.f,{children:r.editor?.paperLevel||"Paper Level"}),(0,t.jsx)(w.f,{value:W,onChange:O})]})]}),X.map(e=>(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)(m.f,{className:e.required?"text-primary font-semibold":"",children:[e.label," ",e.required&&"*"]}),(0,t.jsx)(d.f,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>E(o===e.key?null:e.key),disabled:!e.value,children:o===e.key?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(f.f,{className:"h-3 w-3 mr-1"}),r.directEntry.edit]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(p.f,{className:"h-3 w-3 mr-1"}),r.directEntry.preview]})})]}),o===e.key?(0,t.jsx)("div",{className:`rounded-md border bg-muted/30 p-4 ${e.minHeight} overflow-auto cursor-pointer`,onClick:()=>E(null),children:(0,t.jsx)(y.f,{content:e.value})}):(0,t.jsx)(u.f,{value:e.value,onChange:t=>e.setter(t.target.value),onKeyDown:G,placeholder:e.placeholder,className:`${e.minHeight} font-mono text-sm resize-y`,disabled:l})]},e.key)),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(m.f,{children:r.editor?.mistakeStatus||"Attempt Status"}),(0,t.jsxs)(k.d,{value:L,onValueChange:e=>_(e),children:[(0,t.jsx)(k.P,{className:"w-[200px]",children:(0,t.jsx)(k.U,{})}),(0,t.jsxs)(k.r,{children:[(0,t.jsx)(k.T,{value:"not_attempted",children:r.editor?.mistakeStatuses?.notAttempted||"Not attempted"}),(0,t.jsx)(k.T,{value:"wrong_attempt",children:r.editor?.mistakeStatuses?.wrongAttempt||"Wrong attempt"}),(0,t.jsx)(k.T,{value:"unknown",children:r.editor?.mistakeStatuses?.unknown||"Unknown"})]})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(m.f,{children:r.editor?.tags||"Knowledge Points (Press Enter to add)"}),(0,t.jsx)(b.f,{value:R,onChange:B,placeholder:r.editor?.tagsPlaceholder||"Enter knowledge tags, select from suggestions...",enterHint:r.editor?.createTagHint,subject:(0,N.f)(i||null)||void 0}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:r.editor?.tagsHint||"💡 Tag suggestions will appear as you type"})]}),(0,t.jsxs)("div",{className:"flex flex-col items-center gap-2 pt-2",children:[(0,t.jsx)(d.f,{onClick:Q,disabled:!A.trim()||!F||l,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",size:"lg",children:l?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(x.f,{className:"mr-2 h-4 w-4 animate-spin"}),r.directEntry.saving]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(h.f,{className:"mr-2 h-4 w-4"}),r.directEntry.save]})}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground text-center",children:r.directEntry.hint})]})]})})}var E=e.i(522016),A=e.i(217255),T=e.i(856423),I=e.i(975153),z=e.i(218964),P=e.i(697886);let $=()=>()=>{};function M({href:e,icon:s,label:a,value:i}){return(0,t.jsxs)(E.default,{href:e,className:"rounded-xl bg-white/15 px-4 py-3 backdrop-blur-sm transition-colors hover:bg-white/20",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-white/75",children:[(0,t.jsx)(s,{className:"h-3.5 w-3.5 shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:a})]}),(0,t.jsx)("div",{className:"mt-1 text-2xl font-bold tabular-nums",children:i??"–"})]})}function H({notebookCount:e,itemCount:a,dueCount:i,targetNotebook:n}){let{t:l,language:r}=(0,v.b)(),{data:o}=(0,A.useSession)(),c=(0,s.useSyncExternalStore)($,()=>new Date().getHours(),()=>null),d=null===c?l.common.welcome.replace(/[,,\s]+$/,""):c<12?l.home.greetingMorning:c<18?l.home.greetingAfternoon:l.home.greetingEvening,u=o?.user?.name||o?.user?.email||"";return(0,t.jsxs)("section",{className:"relative overflow-hidden rounded-2xl bg-gradient-to-br from-indigo-600 via-indigo-500 to-violet-500 p-5 text-white shadow-lg shadow-indigo-500/20 md:p-7",children:[(0,t.jsx)("div",{className:"pointer-events-none absolute -right-10 -top-12 h-44 w-44 rounded-full bg-white/10 blur-2xl"}),(0,t.jsx)("div",{className:"pointer-events-none absolute -bottom-16 right-24 h-40 w-40 rounded-full bg-fuchsia-300/20 blur-2xl"}),(0,t.jsxs)("div",{className:"relative flex flex-col gap-5 md:flex-row md:items-end md:justify-between",children:[(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsxs)("h1",{className:"text-xl font-bold tracking-tight md:text-2xl",children:[d,u&&`${"zh"===r?",":", "}${u}`]}),(0,t.jsx)("p",{className:"max-w-md text-sm text-white/80",children:l.home.heroSubtitle}),n&&(0,t.jsxs)("p",{className:"inline-flex items-center gap-1.5 rounded-full bg-white/15 px-3 py-1 text-xs font-medium",children:[(0,t.jsx)(P.f,{className:"h-3.5 w-3.5"}),l.home.targetNotebook.replace("{name}",n)]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-3 gap-3 md:w-96",children:[(0,t.jsx)(M,{href:"/notebooks",icon:T.f,label:l.home.notebookCount,value:e}),(0,t.jsx)(M,{href:"/notebooks",icon:z.f,label:l.home.itemCount,value:a}),(0,t.jsx)(M,{href:"/review",icon:I.f,label:l.home.dueCount,value:i})]})]})]})}var q=e.i(12130),D=e.i(430634),L=e.i(717448),_=e.i(798469),R=e.i(86963),B=e.i(956738),F=e.i(185592),U=e.i(41931),V=e.i(201276),K=e.i(35209),W=e.i(267275);function O(){let{t:e}=(0,v.b)();(0,K.f)(e.pageTitle.home);let c=(0,a.useSearchParams)().get("notebook"),[d,u]=(0,s.useState)([]),[m,h]=(0,s.useState)(null),[x,p]=(0,s.useState)(null),[f,g]=(0,s.useState)("image"),y=c||m,b=y?d.find(e=>e.id===y):void 0,j=(0,W.f)({logPrefix:"[Home]",analyzeSubjectId:y,importSubjectId:c,textNotebook:b&&{id:b.id,name:b.name},onParsed:e=>{let t=e.subject&&d.find(t=>t.name.includes(e.subject)||e.subject.includes(t.name));t&&h(t.id)}});(0,s.useEffect)(()=>{U.k.get("/api/notebooks").then(e=>u(e)).catch(e=>V.V.error("[Home]","Failed to fetch notebooks",{error:e})),U.k.get("/api/review/due?pageSize=1").then(e=>p(e.total)).catch(e=>V.V.error("[Home]","Failed to fetch due reviews",{error:e}))},[]);let w=async e=>{j.setAnalysisStep("saving"),await j.saveQuestion({...e,wrongAnswerText:e.wrongAnswerText||null,mistakeAnalysis:e.mistakeAnalysis||null,mistakeStatus:e.mistakeStatus||"unknown",originalImageUrl:""}),j.setAnalysisStep("idle")},k=d.reduce((e,t)=>e+(t._count?.errorItems||0),0),N=[{value:"image",icon:i.f,label:e.app?.uploadImage||"Take Photo"},{value:"text",icon:l.f,label:e.app?.manualInput||"Manual Input"},{value:"direct",icon:n.f,label:e.app?.directInput||"Manual Entry"}];return(0,t.jsxs)("main",{className:"min-h-screen",children:[(0,t.jsx)(B.f,{status:j.analysisStep}),(0,t.jsxs)("div",{className:`mx-auto space-y-6 px-4 py-6 md:px-8 md:py-8 ${"review"===j.step?"max-w-6xl":"max-w-4xl"}`,children:["upload"===j.step&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(H,{notebookCount:d.length,itemCount:k,dueCount:x,targetNotebook:c?b?.name:void 0}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)(F.f,{options:N,value:f,onChange:g}),j.lastImported&&(0,t.jsx)(D.f,{imported:j.lastImported,onDismiss:j.dismissImported}),j.batchBlobs?(0,t.jsx)(r.f,{blobs:j.batchBlobs,subjectId:c,timeout:j.aiTimeout,onClose:j.closeBatch}):"image"===f?(0,t.jsx)(_.f,{onImageSelect:j.selectImage,isAnalyzing:j.isBusy}):"text"===f?(0,t.jsx)(L.f,{onSubmit:j.submitText,isAnalyzing:j.isBusy,defaultNotebookName:b?.name}):(0,t.jsx)(C,{onSubmit:w,defaultNotebookId:y||void 0,defaultNotebookName:b?.name,isSaving:"saving"===j.analysisStep})]})]}),j.croppingImage&&(0,t.jsx)(q.f,{imageSrc:j.croppingImage,open:j.isCropperOpen,onClose:j.closeCropper,onCropComplete:j.cropComplete,onMultiCropComplete:j.startBatch}),"review"===j.step&&j.parsedData&&(0,t.jsx)(o.f,{initialData:j.parsedData,onSave:j.saveReviewed,onCancel:j.cancelReview,imagePreview:j.currentImage,initialSubjectId:y||void 0,aiTimeout:j.aiTimeout})]})]})}e.s(["default",0,function(){return(0,t.jsx)(s.Suspense,{fallback:(0,t.jsx)(R.f,{}),children:(0,t.jsx)(O,{})})}],952683)},469937,62825,e=>{var t=e.i(843476),s=e.i(456420);let a={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"}]]};a.node;let i=(0,s.f)(a);var n=e.i(111110),l=e.i(975157);let r=[1,2,3,4,5];function o(e){return"not_attempted"===e||"wrong_attempt"===e||"unknown"===e?e:"unknown"}e.s(["f",0,function({value:e,onChange:s,disabled:a,size:o="sm",showUnrated:c=!0,className:d}){let{t:u}=(0,n.b)(),m=e??0,h="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 s?(0,t.jsxs)("span",{className:(0,l.f)("inline-flex items-center gap-0.5",d),role:"group","aria-label":`${u.difficulty.label}${u.common.colon}${x}`,title:u.difficulty.clearHint,children:[r.map(e=>(0,t.jsx)("button",{type:"button",disabled:a,onClick:()=>s(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)(i,{className:(0,l.f)(h,e<=m?"fill-amber-400 text-amber-400":"text-muted-foreground/40")})},e)),!m&&c&&(0,t.jsx)("span",{className:"ml-1 text-xs text-muted-foreground",children:u.difficulty.unrated})]}):m?(0,t.jsx)("span",{className:(0,l.f)("inline-flex items-center",d),role:"img","aria-label":`${u.difficulty.label}${u.common.colon}${x}`,title:x,children:r.map(e=>(0,t.jsx)(i,{className:(0,l.f)(h,e<=m?"fill-amber-400 text-amber-400":"text-muted-foreground/30"),"aria-hidden":!0},e))}):c?(0,t.jsx)("span",{className:(0,l.f)("text-xs text-muted-foreground",d),children:u.difficulty.unrated}):null}],469937),e.s(["i",0,function(e,t="zh"){return("en"===t?{not_attempted:"Not attempted",wrong_attempt:"Wrong attempt",unknown:"Unknown"}:{not_attempted:"不会做",wrong_attempt:"做错了",unknown:"未判断"})[o(e)]},"h",0,o,"x",0,function(e,t){return(t||"").trim()?"wrong_attempt":o(e)}],62825)},149704,e=>{var t=e.i(843476),s=e.i(111110),a=e.i(398019),i=e.i(184110),n=e.i(975157);let l={left:"mr-auto",center:"mx-auto",right:"ml-auto"};e.s(["f",0,function({svg:e,scale:r,align:o,className:c}){let{t:d}=(0,s.b)();if(!e)return null;let u=(0,i.V)(r),m=(0,i.o)(o);return(0,t.jsx)("figure",{className:(0,n.f)("question-figure my-3",c),children:(0,t.jsx)("img",{src:(0,a.f)(e),alt:d.figure.alt,className:(0,n.f)(l[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)}%`}})})}])},574041,e=>{var t=e.i(843476),s=e.i(271645),a=e.i(263676),i=e.i(487486),n=e.i(793479),l=e.i(41931),r=e.i(201276);e.s(["f",0,function({value:e=[],onChange:o,placeholder:c="Enter tags...",className:d="",enterHint:u,subject:m,gradeStage:h}){let[x,p]=(0,s.useState)(""),[f,g]=(0,s.useState)([]),[v,y]=(0,s.useState)(!1),[b,j]=(0,s.useState)(0),w=(0,s.useRef)(null),k=(0,s.useRef)(null),N=(0,s.useCallback)(async t=>{try{let s=new URLSearchParams({q:t});m&&s.append("subject",m),h&&s.append("stage",h);let a=((await l.k.get(`/api/tags/suggestions?${s.toString()}`)).suggestions||[]).filter(t=>!e.includes(t));g(a.slice(0,20)),y(a.length>0),j(0)}catch(e){r.V.error("[TagInput]","Failed to fetch suggestions",{error:e})}},[m,h,e]);(0,s.useEffect)(()=>{x.trim()&&N(x)},[x,N]);let S=t=>{t.trim()&&!e.includes(t.trim())&&(o([...e,t.trim()]),p(""),g([]),y(!1),j(0))},C=t=>{o(e.filter(e=>e!==t))};return(0,s.useEffect)(()=>{let e=e=>{!k.current||k.current.contains(e.target)||w.current?.contains(e.target)||y(!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)(i.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)(a.X,{className:"h-3 w-3"})})]},e)),(0,t.jsx)(n.f,{ref:w,type:"text",value:x,onChange:e=>{p(e.target.value),e.target.value.trim()||(g([]),y(!1))},onKeyDown:t=>{"Enter"===t.key?(t.preventDefault(),b>=0&&f[b]?S(f[b]):x.trim()&&S(x)):"ArrowDown"===t.key?(t.preventDefault(),j(e=>Math.min(e+1,f.length-1))):"ArrowUp"===t.key?(t.preventDefault(),j(e=>Math.max(e-1,0))):"Escape"===t.key?(y(!1),j(0)):"Backspace"===t.key&&!x&&e.length>0&&C(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"})]}),v&&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,s)=>(0,t.jsx)("div",{className:`px-3 py-2 cursor-pointer hover:bg-accent ${s===b?"bg-accent":""}`,onClick:()=>S(e),onMouseEnter:()=>j(s),children:e},e))}),x&&!v&&(0,t.jsx)("div",{className:"text-xs text-muted-foreground mt-1",children:u?`${u} "${x}"`:`Press Enter to create "${x}"`})]})}])},86963,e=>{var t=e.i(843476),s=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)(s.f,{className:"h-7 w-7 animate-spin text-primary"}),e&&(0,t.jsx)("p",{className:"text-sm",children:e})]})}])},184110,e=>{let t=["left","center","right"],s="center";function a(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,a,"o",0,function(e){return"string"==typeof e&&t.includes(e)?e:s},"V",0,function(e){return a(e)?e:100}])},398019,e=>{e.s(["f",0,function(e){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`}])},952122,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}])},35209,e=>{var t=e.i(271645),s=e.i(111110);e.s(["f",0,function(...e){let{t:a}=(0,s.b)(),i=[a.pageTitle.base,...e.map(e=>"string"==typeof e?e.trim():"").filter(e=>e.length>0)].join("-");(0,t.useEffect)(()=>{document.title=i},[i])}])}])})();
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
(()=>{"use strict";(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,518515,e=>{var t=e.i(456420);let r={name:"camera",size:24,node:[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",key:"18u6gg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]};r.node;let a=(0,t.f)(r);e.s(["f",0,a],518515)},325597,7891,e=>{var t=e.i(456420);let r={name:"pen-line",size:24,node:[["path",{d:"M13 21h8",key:"1jsn5i"}],["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"}]],aliases:["edit-3"]};r.node;let a=(0,t.f)(r);e.s(["f",0,a],7891),e.s(["f",0,a],325597)},747819,364002,866531,430634,e=>{var t=e.i(843476),r=e.i(271645),a=e.i(522016),s=e.i(548161),n=e.i(632781),i=e.i(395925),l=e.i(583967),o=e.i(519455),c=e.i(515288),d=e.i(111110),u=e.i(201276),m=e.i(41931),p=e.i(28928);async function f(){try{return!!(await m.k.get("/api/user")).confirmBeforeImport}catch{return!1}}async function g(e,t){let r=await m.k.post("/api/analyze",{imageBase64:e,language:t.language,subjectId:t.subjectId||void 0},{timeout:t.timeout,recoverable:!0});if(!r||"object"!=typeof r)throw Error("Invalid API response: data is null or not an object");return r}async function h(e,t){let r=await m.k.post("/api/error-items",{questionText:e.questionText,answerText:e.answerText,analysis: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,subjectId:t.subjectId||void 0,subjectName:t.subjectId?void 0:e.subject,originalImageUrl:t.imageUrl||"",paperLevel:t.paperLevel||void 0});return{id:r.id,shortId:r.shortId??null,subjectId:r.subjectId??null,notebookName:r.subject?.name??null,duplicate:r.duplicate}}async function x(e,t){let r=await (0,p.f)(e instanceof File?e:new File([e],"question.jpg",{type:e.type||"image/jpeg"}));t.onStage?.("analyzing");let a=await g(r,t);return t.onStage?.("saving"),h(a,{subjectId:t.subjectId,imageUrl:r,paperLevel:t.paperLevel})}function v({item:e}){let{t:r}=(0,d.b)(),a=r.batchImport.status[e.status];return"success"===e.status?(0,t.jsxs)("span",{className:"flex items-start gap-1 text-green-700 dark:text-green-300",children:[(0,t.jsx)(s.f,{className:"h-4 w-4 shrink-0 mt-0.5"}),e.imported?.duplicate?r.importFlow.duplicate:a]}):"failed"===e.status?(0,t.jsxs)("span",{className:"flex items-center gap-1 text-destructive",children:[(0,t.jsx)(l.f,{className:"h-4 w-4"}),a]}):(0,t.jsxs)("span",{className:"flex items-center gap-1 text-muted-foreground",children:["pending"!==e.status&&(0,t.jsx)(n.f,{className:"h-4 w-4 animate-spin"}),a]})}function y({blob:e}){let a=(0,r.useRef)(null);return(0,r.useEffect)(()=>{let t=URL.createObjectURL(e);return a.current&&(a.current.src=t),()=>URL.revokeObjectURL(t)},[e]),(0,t.jsx)("img",{ref:a,alt:"",className:"h-20 w-20 shrink-0 rounded object-contain bg-muted"})}e.s(["x",0,f,"w",0,x,"a",0,h],364002),e.s(["f",0,function({blobs:e,subjectId:s,timeout:n,onClose:l}){let{t:m,language:p}=(0,d.b)(),[f,g]=(0,r.useState)(()=>e.map(()=>({status:"pending"}))),h=(0,r.useRef)(!1),w=(0,r.useCallback)((e,t)=>{g(r=>r.map((r,a)=>a===e?{...r,...t}:r))},[]),j=(0,r.useCallback)(async t=>{w(t,{status:"analyzing",error:void 0});try{let r=await x(e[t],{language:p,subjectId:s,timeout:n,onStage:e=>w(t,{status:e})});w(t,{status:"success",imported:r})}catch(s){let e=s?.data,r=e?.message||(s instanceof Error?s.message:String(s)),a=m.errors[r];w(t,{status:"failed",error:"string"==typeof a?a:r}),u.V.error("[BatchImport]","Question import failed",{index:t,error:r})}},[e,p,s,n,m.errors,w]),b=(0,r.useCallback)(async e=>{let t=[...e],r=async()=>{for(;t.length>0;)await j(t.shift())};await Promise.all(Array.from({length:Math.min(3,t.length)},r))},[j]);(0,r.useEffect)(()=>{h.current||(h.current=!0,b(e.map((e,t)=>t)))},[e,b]);let k=f.filter(e=>"success"===e.status).length,N=f.flatMap((e,t)=>"failed"===e.status?[t]:[]),S=f.some(e=>"pending"===e.status||"analyzing"===e.status||"saving"===e.status);return(0,t.jsxs)(c.N,{children:[(0,t.jsxs)(c.Y,{className:"flex flex-row items-center justify-between gap-2 space-y-0",children:[(0,t.jsx)(c.v,{className:"text-base",children:m.batchImport.title}),(0,t.jsx)("span",{className:"text-sm text-muted-foreground",children:m.batchImport.summary.replace("{done}",String(k)).replace("{total}",String(f.length)).replace("{failed}",String(N.length))})]}),(0,t.jsxs)(c.O,{className:"space-y-4",children:[(0,t.jsx)("ul",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:f.map((r,s)=>(0,t.jsxs)("li",{className:"flex gap-3 rounded-lg border p-3",children:[(0,t.jsx)(y,{blob:e[s]}),(0,t.jsxs)("div",{className:"min-w-0 flex-1 space-y-1 text-sm",children:[(0,t.jsx)("div",{className:"font-medium",children:m.batchImport.question.replace("{index}",String(s+1))}),(0,t.jsx)(v,{item:r}),"success"===r.status&&r.imported&&(0,t.jsxs)(a.default,{href:`/error-items/${r.imported.id}`,className:"block truncate text-xs text-primary hover:underline",children:[r.imported.notebookName," · ",r.imported.shortId]}),"failed"===r.status&&(0,t.jsxs)(t.Fragment,{children:[r.error&&(0,t.jsx)("p",{className:"line-clamp-2 text-xs text-destructive",children:r.error}),(0,t.jsxs)(o.f,{size:"sm",variant:"outline",className:"h-7",onClick:()=>j(s),children:[(0,t.jsx)(i.f,{className:"mr-1 h-3 w-3"}),m.batchImport.retry]})]})]})]},s))}),(0,t.jsxs)("div",{className:"flex flex-col-reverse sm:flex-row sm:justify-end gap-2",children:[N.length>1&&!S&&(0,t.jsxs)(o.f,{variant:"outline",onClick:()=>b(N),children:[(0,t.jsx)(i.f,{className:"mr-2 h-4 w-4"}),m.batchImport.retryFailed]}),(0,t.jsx)(o.f,{onClick:l,disabled:S,children:m.batchImport.finish})]})]})]})}],747819);var w=e.i(741120),j=e.i(856522),b=e.i(314381),k=e.i(3198),N=e.i(294114);function S({data:e,onChange:a}){let{t:s}=(0,d.b)(),[i,l]=(0,r.useState)(!1),[c,p]=(0,r.useState)(null),f=async()=>{if(!e.questionText.trim())return void N.c.warning(s.editor.enterQuestionFirst||"Please enter question text first");if(!e.answerText.trim())return void N.c.warning(s.geogebra.answerRequired);l(!0),p(null);try{let t=await m.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||s.geogebra.notSuitable)}catch(e){u.V.error("[CorrectionEditor]","GeoGebra analysis failed",{error:e}),p(s.geogebra.analyzeFailed)}finally{l(!1)}};return e.geogebraCommands?(0,t.jsx)(k.f,{commands:e.geogebraCommands,height:350,onRegenerate:f,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)(b.f,{className:"h-4 w-4"}),(0,t.jsx)("span",{children:s.geogebra.title})]}),(0,t.jsx)(o.f,{variant:"outline",size:"sm",onClick:f,disabled:i,children:i?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.f,{className:"mr-2 h-4 w-4 animate-spin"}),s.geogebra.analyzing]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(b.f,{className:"mr-2 h-4 w-4"}),s.geogebra.generate]})})]}),c&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground mt-2",children:c}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground mt-2",children:s.geogebra.hint})]}):null}var A=e.i(469937),D=e.i(28342),E=e.i(438465),T=e.i(674166),C=e.i(110204);function I({data:e,paperLevel:r,onChange:a}){let{t:s}=(0,d.b)();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(C.f,{children:s.editor.selectNotebook||"Select Notebook"}),(0,t.jsx)(E.f,{value:e.subjectId,onChange:e=>a({subjectId: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)(C.f,{htmlFor:"correction-grade-semester",children:s.editor.gradeSemester||"Grade/Semester"}),(0,t.jsx)(D.f,{id:"correction-grade-semester",value:e.gradeSemester||"",onChange:e=>a({gradeSemester:e})})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(C.f,{children:s.editor.paperLevel||"Paper Level"}),(0,t.jsx)(T.f,{value:r,onChange:e=>a({paperLevel:e})})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(C.f,{children:s.difficulty.label}),(0,t.jsx)("div",{children:(0,t.jsx)(A.f,{size:"md",value:e.difficultyStars,onChange:e=>a({difficultyStars:e})})})]})]})}var F=e.i(141176),P=e.i(967489);function R({data:e,onChange:r}){let{t:a}=(0,d.b)();return(0,t.jsxs)(c.N,{children:[(0,t.jsx)(c.Y,{children:(0,t.jsx)(c.v,{children:a.editor.mistakeAnalysisTitle||"Mistake Analysis"})}),(0,t.jsxs)(c.O,{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(C.f,{children:a.editor.mistakeStatus||"Attempt Status"}),(0,t.jsxs)(P.d,{value:e.mistakeStatus||"unknown",onValueChange:e=>r({mistakeStatus:e}),children:[(0,t.jsx)(P.P,{children:(0,t.jsx)(P.U,{})}),(0,t.jsxs)(P.r,{children:[(0,t.jsx)(P.T,{value:"not_attempted",children:a.editor.mistakeStatuses?.notAttempted||"Not attempted"}),(0,t.jsx)(P.T,{value:"wrong_attempt",children:a.editor.mistakeStatuses?.wrongAttempt||"Wrong attempt"}),(0,t.jsx)(P.T,{value:"unknown",children:a.editor.mistakeStatuses?.unknown||"Unknown"})]})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(C.f,{children:a.editor.wrongAnswerText||"Wrong Answer / Work"}),(0,t.jsx)(F.f,{value:e.wrongAnswerText||"",onChange:t=>r({wrongAnswerText:t,mistakeStatus:t.trim()?"wrong_attempt":e.mistakeStatus}),className:"min-h-[100px] font-mono text-sm",placeholder:a.editor.wrongAnswerPlaceholder||"Leave blank if no wrong answer is visible"})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(C.f,{children:a.editor.mistakeAnalysis||"Mistake Cause Analysis"}),(0,t.jsx)(F.f,{value:e.mistakeAnalysis||"",onChange:e=>r({mistakeAnalysis:e}),className:"min-h-[140px] font-mono text-sm",placeholder:a.editor.mistakeAnalysisPlaceholder||"Explain where and why the mistake happened"})]})]})]})}var O=e.i(511445),M=e.i(149704);function z({title:e,children:r,className:a}){return(0,t.jsxs)(c.N,{children:[(0,t.jsx)(c.Y,{children:(0,t.jsx)(c.v,{children:e})}),(0,t.jsx)(c.O,{className:a,children:r})]})}function L({data:e,children:r}){let{t:a}=(0,d.b)(),s={wrong_attempt:a.editor.mistakeStatuses?.wrongAttempt||"Wrong attempt",not_attempted:a.editor.mistakeStatuses?.notAttempted||"Not attempted",unknown:a.editor.mistakeStatuses?.unknown||"Unknown"};return(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)(z,{title:a.editor.preview?.question||"Question Preview",children:[(0,t.jsx)(O.f,{content:e.questionText}),(0,t.jsx)(M.f,{svg:e.figureSvg})]}),r,(0,t.jsx)(z,{title:a.editor.preview?.answer||"Answer Preview",children:(0,t.jsx)(O.f,{content:e.answerText})}),(0,t.jsx)(z,{title:a.editor.preview?.analysis||"Analysis Preview",children:(0,t.jsx)(O.f,{content:e.analysis})}),(0,t.jsxs)(z,{title:a.editor.preview?.mistakeAnalysis||"Mistake Analysis Preview",className:"space-y-3 text-sm",children:[(0,t.jsxs)("div",{className:"text-muted-foreground",children:[a.editor.mistakeStatus||"Attempt Status",a.common.colon,s[e.mistakeStatus]??s.unknown]}),e.wrongAnswerText&&(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"font-medium mb-1",children:a.editor.wrongAnswerText||"Wrong Answer / Work"}),(0,t.jsx)(O.f,{content:e.wrongAnswerText})]}),e.mistakeAnalysis&&(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"font-medium mb-1",children:a.editor.mistakeAnalysis||"Mistake Cause Analysis"}),(0,t.jsx)(O.f,{content:e.mistakeAnalysis})]})]})]})}var $=e.i(574041),G=e.i(215519),U=e.i(306831);e.i(676167);var _=e.i(952122),q=e.i(62825),V=e.i(664030),B=e.i(303163);e.s(["f",0,function({initialData:e,onSave:a,onCancel:s,imagePreview:i,initialSubjectId:l,aiTimeout:p}){let{timeZone:f}=(0,G.M)(),{t:g,language:h}=(0,d.b)(),[x,v]=(0,r.useState)({...e,wrongAnswerText:e.wrongAnswerText||"",mistakeAnalysis:e.mistakeAnalysis||"",mistakeStatus:e.mistakeStatus||"unknown",subjectId:l,gradeSemester:e.gradeSemester||""}),y=(0,r.useRef)(!1),b=e=>{"gradeSemester"in e&&(y.current=!0),v(t=>({...t,...e}))},{groups:k}=(0,V.f)(),A=(()=>{if(x.paperLevel)return x.paperLevel;let e="number"==typeof x.difficultyStars&&x.difficultyStars>=4?"b":"a";return k.find(t=>t.key===e&&t.isActive)?.id||""})(),D=x.paperLevel??A,[E,T]=(0,r.useState)(!1),[P,O]=(0,r.useState)(!1),[M,z]=(0,r.useState)(!1),[H,W]=(0,r.useState)(void 0),[Z,J]=(0,r.useState)([]);(0,r.useEffect)(()=>{m.k.get("/api/notebooks").then(J).catch(e=>u.V.error("[CorrectionEditor]","Failed to fetch notebooks",{error:e})),m.k.get("/api/user").then(e=>{if(z(!!e?.enableGeogebra),e){let t=function(e,t=U.J){return"ai"===e.gradeRecognitionMode?null:e.fixedGradeSemester?e.fixedGradeSemester:e.educationStage&&e.enrollmentYear?function(e,t,r=new Date,a="en",s=U.J){let n=(0,U.c)(r,s),i=n.getFullYear(),l=n.getMonth()+1,o=i-t,c="2nd";l>=9?(o+=1,c="1st"):c=l<2?"1st":"2nd";let d="zh"===a,u=d?"1st"===c?"上期":"下期":"1st"===c?"1st Semester":"2nd Semester",m=(d?{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]||[],p=`${o}`;if(p=o>0&&o<=m.length?m[o-1]:o>m.length?d?"已毕业":"Graduated":d?"学前":"Pre-school",!d)return`${p}, ${u}`;{let e="1st"===c?"上":"下";return`${p}${e}`}}(e.educationStage,e.enrollmentYear,new Date,"zh",t):null}(e,f);v(e=>e.gradeSemester||y.current?e:{...e,gradeSemester:t||""}),W(e.educationStage||void 0)}}).catch(e=>u.V.error("[CorrectionEditor]","Failed to fetch user info for grade calculation",{error:e}))},[h,f]);let K=async()=>{if(!x.questionText.trim())return void N.c.warning(g.editor.enterQuestionFirst||"Please enter question text first");T(!0);try{let e=function({questionText:e,language:t,subject:r,imagePreview:a,gradeSemester:s,subjectId:n}){let i={questionText:e,language:t,subject:r};return a&&(i.imageBase64=a),s&&(i.gradeSemester=s),n&&(i.subjectId=n),i}({questionText:x.questionText,language:h,subject:x.subject,imagePreview:i,gradeSemester:x.gradeSemester??void 0,subjectId:x.subjectId});u.V.info("[Reanswer]",e.imageBase64?"Sending image + text (image available for mistake analysis)":"Sending text only (no image available)",{timeout:p});let t=await m.k.post("/api/reanswer",e,{timeout:p||18e4,recoverable:!0});v(e=>({...e,answerText:t.answerText,analysis:t.analysis,knowledgePoints:t.knowledgePoints,wrongAnswerText:t.wrongAnswerText||"",mistakeAnalysis:t.mistakeAnalysis||"",mistakeStatus:(0,q.x)(t.mistakeStatus,t.wrongAnswerText),difficultyStars:t.difficultyStars??e.difficultyStars})),N.c.success(g.editor.reanswerSuccess||"✅ Answer and analysis updated!")}catch(a){let e,t,r;u.V.error("[CorrectionEditor]","Reanswer failed",{error:a}),N.c.error((e=(0,B.d)(a)||"",r=(t=g.errors?.reanswer||{}).default||"Reanswer failed",e.includes("AI_AUTH_ERROR")?t.authError||g.errors?.AI_AUTH_ERROR||r:e.includes("AI_CONNECTION_FAILED")?t.connectionFailed||g.errors?.AI_CONNECTION_FAILED||r:e.includes("AI_RESPONSE_ERROR")&&(t.responseError||g.errors?.AI_RESPONSE_ERROR)||r))}finally{T(!1)}},Y=async()=>{if(!x.subjectId)return void N.c.warning(g.editor.messages?.selectNotebook||"Please select a notebook");if(!P){O(!0);try{await a({...x,paperLevel:D,mistakeStatus:(0,q.x)(x.mistakeStatus,x.wrongAnswerText)})}finally{O(!1)}}},Q=g.editor.placeholder||"Supports Markdown and LaTeX...",X=(0,_.f)(Z.find(e=>e.id===x.subjectId)?.name||null)||(0,_.f)(x.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:g.editor.title}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(o.f,{variant:"outline",onClick:s,children:g.editor.cancel}),(0,t.jsxs)(o.f,{onClick:Y,disabled:P,children:[P?(0,t.jsx)(n.f,{className:"mr-2 h-4 w-4 animate-spin"}):(0,t.jsx)(j.f,{className:"mr-2 h-4 w-4"}),P?g.common?.pleaseWait||"Please wait...":g.editor.save]})]})]}),(0,t.jsxs)("div",{className:"grid gap-6 lg:grid-cols-2",children:[(0,t.jsxs)("div",{className:"space-y-6",children:[i&&(0,t.jsx)(c.N,{children:(0,t.jsx)(c.O,{className:"p-4",children:(0,t.jsx)("img",{src:i,alt:"Original",className:"w-full rounded-md"})})}),(0,t.jsx)(I,{data:x,paperLevel:D,onChange:b}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(C.f,{children:g.editor.question}),(0,t.jsx)(F.f,{value:x.questionText,onChange:e=>b({questionText:e}),className:"min-h-[150px] font-mono text-sm",placeholder:Q}),(0,t.jsx)(o.f,{variant:"default",size:"sm",onClick:K,disabled:E||!x.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:E?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.f,{className:"mr-2 h-4 w-4 animate-spin"}),g.editor.reanswering||"AI solving..."]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(w.f,{className:"mr-2 h-4 w-4"}),g.editor.reanswer||"🔄 Reanswer (based on corrected question)"]})}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:g.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)(C.f,{children:g.editor.tags}),(0,t.jsx)($.f,{value:x.knowledgePoints,onChange:e=>b({knowledgePoints:e}),placeholder:g.editor.tagsPlaceholder||"Enter knowledge tags...",enterHint:g.editor.createTagHint,subject:X,gradeStage:H}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:g.editor.tagsHint||"💡 Tag suggestions will appear as you type"})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(C.f,{children:g.editor.answer}),(0,t.jsx)(F.f,{value:x.answerText,onChange:e=>b({answerText:e}),className:"min-h-[100px] font-mono text-sm",placeholder:Q})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(C.f,{children:g.editor.analysis}),(0,t.jsx)(F.f,{value:x.analysis,onChange:e=>b({analysis:e}),className:"min-h-[200px] font-mono text-sm",placeholder:Q})]}),(0,t.jsx)(R,{data:x,onChange:b})]}),(0,t.jsx)(L,{data:x,children:M&&(0,t.jsx)(S,{data:x,onChange:b})})]})]})}],866531);var H=e.i(263676);e.s(["f",0,function({imported:e,onDismiss:r}){let{t:n}=(0,d.b)(),i=(e.duplicate?n.importFlow.duplicate:n.importFlow.imported).replace("{notebook}",e.notebookName||"-").replace("{id}",e.shortId||"-");return(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center gap-3 rounded-lg border border-green-300 dark:border-green-800 bg-green-50 dark:bg-green-950/40 p-3 text-sm text-green-800 dark:text-green-200",role:"status",children:[(0,t.jsxs)("span",{className:"flex items-start gap-2 flex-1",children:[(0,t.jsx)(s.f,{className:"h-4 w-4 mt-0.5 shrink-0"}),i]}),(0,t.jsxs)("div",{className:"flex gap-2 shrink-0",children:[(0,t.jsx)(a.default,{href:`/error-items/${e.id}`,children:(0,t.jsx)(o.f,{size:"sm",variant:"outline",className:"bg-background",children:n.importFlow.viewItem})}),(0,t.jsx)(o.f,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:r,"aria-label":n.detail.close,children:(0,t.jsx)(H.X,{className:"h-4 w-4"})})]})]})}],430634)},717448,798469,956738,185592,267275,e=>{var t=e.i(843476),r=e.i(271645),a=e.i(515288),s=e.i(519455),n=e.i(624687),i=e.i(110204),l=e.i(632781),o=e.i(325597),c=e.i(328623),d=e.i(111110);e.s(["f",0,function({onSubmit:e,isAnalyzing:u,defaultNotebookName:m}){let{t:p}=(0,d.b)(),[f,g]=(0,r.useState)(""),h=async()=>{f.trim()&&await e(f.trim())};return(0,t.jsx)(a.N,{className:"rounded-2xl",children:(0,t.jsxs)(a.O,{className:"p-6 space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground mb-2",children:[(0,t.jsx)(o.f,{className:"h-5 w-5"}),(0,t.jsx)("span",{className:"text-sm font-medium",children:p.app?.textInputHint||"Enter question text"})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(i.f,{htmlFor:"question-text",children:p.editor?.question||"Question Text"}),(0,t.jsx)(n.f,{id:"question-text",value:f,onChange:e=>g(e.target.value),onKeyDown:e=>{(e.ctrlKey||e.metaKey)&&"Enter"===e.key&&(e.preventDefault(),f.trim()&&!u&&h())},placeholder:p.app?.textInputPlaceholder||"Paste or type question text here...\nSupports Markdown and LaTeX formulas (e.g. $x^2 + y^2 = 1$)\n\nCtrl+Enter to submit",className:"min-h-[200px] font-mono text-sm resize-y",disabled:u})]}),m&&(0,t.jsxs)("p",{className:"text-xs text-muted-foreground",children:[p.notebooks?.title||"My Notebooks",": ",m]}),(0,t.jsx)(s.f,{onClick:h,disabled:!f.trim()||u,className:"w-full bg-gradient-to-r from-indigo-600 to-violet-500 font-medium text-white hover:from-indigo-700 hover:to-violet-600",size:"lg",children:u?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(l.f,{className:"mr-2 h-4 w-4 animate-spin"}),p.editor?.reanswering||"AI solving..."]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(c.f,{className:"mr-2 h-4 w-4"}),p.app?.aiSolve||"AI Solve"]})}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground text-center",children:p.app?.textInputTip||"After entering the question, AI will automatically solve and generate analysis"})]})})}],717448);let u=new Map([["avif","image/avif"],["bmp","image/bmp"],["css","text/css"],["csv","text/csv"],["doc","application/msword"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["gif","image/gif"],["gz","application/gzip"],["htm","text/html"],["html","text/html"],["ico","image/x-icon"],["jpeg","image/jpeg"],["jpg","image/jpeg"],["js","application/javascript"],["json","application/json"],["md","text/markdown"],["mjs","application/javascript"],["mp3","audio/mpeg"],["mp4","video/mp4"],["ogg","audio/ogg"],["pdf","application/pdf"],["png","image/png"],["ppt","application/powerpoint"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["svg","image/svg+xml"],["tif","image/tiff"],["tiff","image/tiff"],["txt","text/plain"],["wasm","application/wasm"],["wav","audio/x-wav"],["weba","audio/webm"],["webm","video/webm"],["webp","image/webp"],["xls","application/vnd.ms-excel"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xml","application/xml"],["zip","application/zip"]]);var m=class extends Error{constructor(e){super("DataTransferItem is not a file"),this.item=e,this.name="UnexpectedObjectError"}};function p(e,t,r){let{webkitRelativePath:a}=e,s="string"==typeof t?t:"string"==typeof a&&a.length>0?a:`./${e.name}`;return"string"!=typeof e.path&&f(e,"path",s),void 0!==r&&Object.defineProperty(e,"handle",{value:r,writable:!1,configurable:!1,enumerable:!0}),f(e,"relativePath",s),e}function f(e,t,r){Object.defineProperty(e,t,{value:r,writable:!1,configurable:!1,enumerable:!0})}let g=[".DS_Store","Thumbs.db"];async function h(e,{mimeTypes:t=u}={}){return(await x(e)).map(e=>"path"in e?function(e,t=u){let{name:r}=e;if(r&&-1!==r.lastIndexOf(".")&&!e.type){let a=r.split(".").pop().toLowerCase(),s=t.get(a);s&&Object.defineProperty(e,"type",{value:s,writable:!1,configurable:!1,enumerable:!0})}return e}(e,t):e)}async function x(e){var t,r,a;if(v(e)&&v(e.dataTransfer))return w(e.dataTransfer,e.type);if(v(t=e)&&v(t.clipboardData)){let t;return j(((t=b((r=e.clipboardData).items).filter(e=>"file"===e.kind).map(e=>e.getAsFile()).filter(e=>null!==e)).length>0?t:b(r.files)).map(e=>p(e)))}if(v(a=e)&&v(a.target))return b(e.target.files).map(e=>p(e));return Array.isArray(e)&&e.every(e=>"getFile"in e&&"function"==typeof e.getFile)?y(e):[]}function v(e){return"object"==typeof e&&null!==e}async function y(e){return(await Promise.all(e.map(e=>e.getFile()))).map(e=>p(e))}async function w(e,t){let r=b(e.items).filter(e=>"file"===e.kind);return"drop"!==t?r:j(function e(t){let r=[];for(let a of t)Array.isArray(a)?r.push(...e(a)):r.push(a);return r}(await Promise.all(r.map(k))))}function j(e){return e.filter(e=>-1===g.indexOf(e.name))}function b(e){return null===e?[]:Array.from(e)}async function k(e){if("function"!=typeof e.webkitGetAsEntry)return N(e);let t=e.webkitGetAsEntry();if(t?.isDirectory){let r=await S(e);return r?.kind==="directory"?A(r,`/${r.name}`):E(t)}return N(e,t)}async function N(e,t){let r=e.getAsFile(),a=await S(e);if(null!=a){let e=r??await a.getFile();return e.handle=a,p(e)}if(!r)throw new m(e);return p(r,t?.fullPath??void 0)}async function S(e){if(globalThis.isSecureContext&&"function"==typeof e.getAsFileSystemHandle)return e.getAsFileSystemHandle()}async function A(e,t){let r=[];for await(let a of e.values()){let e=`${t}/${a.name}`;if("directory"===a.kind)r.push(...await A(a,e));else{let t=await a.getFile();r.push(p(t,e,a))}}return r}async function D(e){return e.isDirectory?E(e):T(e)}function E(e){let t=e.createReader();return new Promise((e,r)=>{let a=[];!function s(){t.readEntries(async t=>{if(t.length){let e=Promise.all(t.map(D));a.push(e),s()}else try{e(await Promise.all(a))}catch(e){r(e)}},e=>{r(e)})}()})}async function T(e){return new Promise((t,r)=>{e.file(r=>{t(p(r,e.fullPath))},e=>{r(e)})})}let C=function(e,t){if(e&&t){let r=(Array.isArray(t)?t:t.split(",")).filter(e=>""!==e.trim());if(0===r.length)return!0;let a=e.name||"",s=(e.type||"").toLowerCase(),n=s.replace(/\/.*$/,"");return r.some(e=>{let t=e.trim().toLowerCase();return"."===t.charAt(0)?a.toLowerCase().endsWith(t):t.endsWith("/*")?n===t.replace(/\/.*$/,""):s===t})}return!0},I=["KB","MB","GB","TB","PB"];function F(e){if(e<1024)return`${e} ${1===e?"byte":"bytes"}`;let t=e/1024,r=0;for(;t>=1024&&r<I.length-1;)t/=1024,r++;return`${Number(t.toFixed(2))} ${I[r]}`}function P(e){return{code:"file-too-large",message:`File is larger than ${F(e)}`}}function R(e){return{code:"file-too-small",message:`File is smaller than ${F(e)}`}}let O={code:"too-many-files",message:"Too many files"};function M(e,t){let r="application/x-moz-file"===e.type||C(e,t??"")||""===e.type&&"function"==typeof e.getAsFile;return[r,r?null:function(e=""){let t=e.split(","),r=t.length>1?`one of ${t.join(", ")}`:t[0];return{code:"file-invalid-type",message:`File type must be ${r}`}}(t)]}function z(e,t,r){if(L(e.size)){if(L(t)&&L(r)){if(e.size>r)return[!1,P(r)];if(e.size<t)return[!1,R(t)]}else if(L(t)&&e.size<t)return[!1,R(t)];else if(L(r)&&e.size>r)return[!1,P(r)]}return[!0,null]}function L(e){return null!=e}function $(e){return"function"==typeof e.isPropagationStopped?e.isPropagationStopped():void 0!==e.cancelBubble&&e.cancelBubble}function G(e){let t=e.dataTransfer??e.clipboardData;return t?Array.prototype.some.call(t.types,e=>"Files"===e||"application/x-moz-file"===e)||Array.prototype.some.call(t.items??[],U):!!e.target&&!!e.target.files}function U(e){return"object"==typeof e&&null!==e&&"file"===e.kind}function _(e){e.preventDefault()}function q(...e){return(t,...r)=>e.some(e=>(!$(t)&&e&&e(t,...r),$(t)))}function V(e){return Array.isArray(e)?e:"string"==typeof e?[e]:[]}function B(e){if(L(e))return Array.isArray(e)?e.filter(e=>L(e)&&L(e.accept)):[{accept:e}]}function H(e,{omitWildcardMimeTypesWithExtensions:t=!1}={}){if(L(e))return Object.entries(e).reduce((e,[r,a])=>{let s=V(a);return t&&r.endsWith("/*")&&s.some(Z)?e.push(...s):e.push(r,...s),e},[]).filter(e=>W(e)||Z(e)).join(",")}function W(e){return"audio/*"===e||"video/*"===e||"image/*"===e||"text/*"===e||"application/*"===e||/\w+\/[-+.\w]+/g.test(e)}function Z(e){return/^.*\.[\w]+$/.test(e)}(0,r.forwardRef)(({children:e,...a},s)=>{let{open:n,...i}=K(a);return(0,r.useImperativeHandle)(s,()=>({open:n}),[n]),(0,t.jsx)(t.Fragment,{children:e?.({...i,open:n})})}).displayName="Dropzone";let J={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,isDragUnknown:!1,isDragGlobal:!1,isProcessing:!1,acceptedFiles:[],fileRejections:[],dragFileRejections:[]};function K(e={}){let{accept:t,disabled:a=!1,getFilesFromEvent:s=h,maxSize:n=1/0,minSize:i=0,multiple:l=!0,maxFiles:o=0,onDragEnter:c,onDragLeave:d,onDragOver:u,onDrop:m,onDropAccepted:p,onDropRejected:f,onFileDialogCancel:g,onFileDialogOpen:x,useFsAccessApi:v=!1,autoFocus:y=!1,preventDropOnDocument:w=!0,noClick:j=!1,noKeyboard:b=!1,noDrag:k=!1,noDragEventsBubbling:N=!1,noPaste:S=!1,onError:A,validator:D,getErrorMessage:E}=e,T=(0,r.useMemo)(()=>(function(e){let t=B(e);if(!L(t))return;let r={};for(let e of t)for(let[t,a]of Object.entries(e.accept)){let e=r[t]??(r[t]=[]);for(let t of V(a))e.includes(t)||e.push(t)}return r})(t),[t]),C=(0,r.useMemo)(()=>H(T),[T]),I=(0,r.useMemo)(()=>H(T,{omitWildcardMimeTypesWithExtensions:!0}),[T]),F=(0,r.useMemo)(()=>(function(e){let t=B(e);if(!L(t))return;let r=t.map(e=>{let t=Object.entries(e.accept).filter(([e,t])=>{let r=!0;return W(e)||(console.warn(`Skipped "${e}" because it is not a valid MIME type. Check https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types for a list of valid MIME types.`),r=!1),(Array.isArray(t)||"string"==typeof t)&&V(t).every(Z)||(console.warn(`Skipped "${e}" because an invalid file extension was provided.`),r=!1),r}).reduce((e,[t,r])=>(e[t]=V(r),e),{});return{description:L(e.description)&&""!==e.description?e.description:function(e){let t=[],r=Object.keys(e);for(let r of Object.values(e))for(let e of V(r))t.includes(e)||t.push(e);return t.length>0?t.join(", "):r.length>0?r.join(", "):"Files"}(t),accept:t}}).filter(e=>Object.keys(e.accept).length>0);return r.length>0?r:void 0})(t),[t]),P=(0,r.useMemo)(()=>"function"==typeof x?x:Q,[x]),R=(0,r.useMemo)(()=>"function"==typeof g?g:Q,[g]),U=(0,r.useRef)(null),X=(0,r.useRef)(null),[ee,et]=(0,r.useReducer)(Y,J),{isFocused:er,isFileDialogActive:ea}=ee,es=(0,r.useRef)(ea);es.current=ea;let en=(0,r.useRef)(null),ei=(0,r.useCallback)(()=>{en.current?.abort();let e=new AbortController;return en.current=e,et({type:"setProcessing",isProcessing:!0}),e.signal},[]),el=(0,r.useCallback)(e=>{e.aborted||et({type:"setProcessing",isProcessing:!1})},[]);(0,r.useEffect)(()=>()=>en.current?.abort(),[]);let eo=(0,r.useRef)("u">typeof window&&window.isSecureContext&&v&&"showOpenFilePicker"in window),ec=()=>{!eo.current&&ea&&setTimeout(()=>{if(X.current){let{files:e}=X.current;e?.length||(et({type:"closeDialog"}),R())}},300)};(0,r.useEffect)(()=>(window.addEventListener("focus",ec,!1),()=>{window.removeEventListener("focus",ec,!1)}),[X,ea,R,eo]);let ed=(0,r.useRef)([]),eu=(0,r.useRef)([]),em=e=>{U.current&&e.target&&U.current.contains(e.target)&&e.defaultPrevented||(e.preventDefault(),ed.current=[])};(0,r.useEffect)(()=>(w&&(document.addEventListener("dragover",_,!1),document.addEventListener("drop",em,!1)),()=>{w&&(document.removeEventListener("dragover",_),document.removeEventListener("drop",em))}),[U,w]),(0,r.useEffect)(()=>{let e=e=>{e.target&&(eu.current=[...eu.current,e.target]),G(e)&&et({isDragGlobal:!0,type:"setDragGlobal"})},t=e=>{eu.current=eu.current.filter(t=>t!==e.target&&null!==t),eu.current.length>0||et({isDragGlobal:!1,type:"setDragGlobal"})},r=()=>{eu.current=[],et({isDragGlobal:!1,type:"setDragGlobal"})},a=()=>{eu.current=[],et({isDragGlobal:!1,type:"setDragGlobal"})};return document.addEventListener("dragenter",e,!1),document.addEventListener("dragleave",t,!1),document.addEventListener("dragend",r,!1),document.addEventListener("drop",a,!1),()=>{document.removeEventListener("dragenter",e),document.removeEventListener("dragleave",t),document.removeEventListener("dragend",r),document.removeEventListener("drop",a)}},[U]),(0,r.useEffect)(()=>(!a&&y&&U.current&&U.current.focus(),()=>{}),[U,y,a]);let ep=(0,r.useCallback)(e=>{A?A(e):console.error(e)},[A]),ef=(0,r.useCallback)(e=>{e.preventDefault(),e.persist?.(),eE(e),!es.current&&(ed.current=[...ed.current,e.target],G(e)&&Promise.resolve(s(e)).then(t=>{if($(e)&&!N)return;let r=t.length>0?function({files:e,accept:t,minSize:r,maxSize:a,multiple:s,maxFiles:n=0,validator:i,getErrorMessage:l}){let o=[],c=[],d=(e,t)=>l&&"u">typeof File&&t instanceof File?{...e,message:l(e,t)}:e;e.forEach(e=>{let[s,n]=M(e,t),[i,l]=z(e,r,a);s&&i?o.push(e):c.push({file:e,errors:[n,l].filter(e=>null!=e).map(t=>d(t,e))})});let u=s?n>=1?n:1/0:1;return(o.length>u&&o.slice(u).forEach(e=>{c.push({file:e,errors:[d(O,e)]})}),c.length>0)?{verdict:"reject",rejections:c}:{verdict:i?"unknown":"accept",rejections:c}}({files:t,accept:C,minSize:i,maxSize:n,multiple:l,maxFiles:o,validator:D,getErrorMessage:E}):null;et({isDragAccept:r?.verdict==="accept",isDragReject:r?.verdict==="reject",isDragUnknown:r?.verdict==="unknown",isDragActive:!0,dragFileRejections:r?.rejections??[],type:"setDraggedFiles"}),c&&c(e)}).catch(e=>ep(e)))},[s,c,ep,N,C,i,n,l,o,D,E]),eg=(0,r.useCallback)(e=>{if(e.preventDefault(),e.persist?.(),eE(e),es.current)return!1;let t=G(e);if(t&&e.dataTransfer)try{e.dataTransfer.dropEffect="copy"}catch{}return t&&u&&u(e),!1},[u,N]),eh=(0,r.useCallback)(e=>{e.preventDefault(),e.persist?.(),eE(e);let t=ed.current.filter(e=>U.current?.contains(e)),r=t.indexOf(e.target);-1!==r&&t.splice(r,1),ed.current=t,!(t.length>0)&&(et({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1,isDragUnknown:!1,dragFileRejections:[]}),G(e)&&d&&d(e))},[U,d,N]),ex=(0,r.useCallback)(async(e,t,r)=>{let a,s=(e,t)=>E?{...e,message:E(e,t)}:e,c=e=>{let r=[],a=[];e.forEach(({file:e,accepted:t,acceptError:n,sizeMatch:i,sizeError:l,customErrors:o})=>{let c=!o||Array.isArray(o)&&0===o.length;if(t&&i&&c)r.push(e);else{let t=[n,l];o&&(t=t.concat(o)),a.push({file:e,errors:t.filter(e=>null!=e).map(t=>s(t,e))})}});let n=l?o>=1?o:1/0:1;r.length>n&&r.splice(n).forEach(e=>{a.push({file:e,errors:[s(O,e)]})}),et({acceptedFiles:r,fileRejections:a,type:"setFiles"}),m&&m(r,a,t),a.length>0&&f&&f(a,t),r.length>0&&p&&p(r,t)},d=e.map(e=>{let[t,r]=M(e,I),[a,s]=z(e,i,n);return{file:e,accepted:t,acceptError:r,sizeMatch:a,sizeError:s,customErrors:D?D(e):null}});if(!d.some(({customErrors:e})=>null!=e&&"function"==typeof e.then))return void c(d);try{a=await Promise.all(d.map(async({customErrors:e,...t})=>({...t,customErrors:await e})))}catch(e){r.aborted||(el(r),ep(e));return}r.aborted||c(a)},[et,l,I,i,n,o,m,p,f,D,E,ep,el]),ev=(0,r.useCallback)(e=>{if(e.preventDefault(),e.persist?.(),eE(e),ed.current=[],(!es.current||!e.dataTransfer)&&(et({type:"reset"}),G(e))){let t=ei();Promise.resolve(s(e)).then(r=>{if(!t.aborted)return $(e)&&!N?void el(t):ex(r,e,t)}).catch(e=>{t.aborted||(el(t),ep(e))})}},[s,ex,ep,N,ei,el]),ey=(0,r.useCallback)(e=>{if(!G(e))return;e.preventDefault(),e.persist?.(),eE(e);let t=ei();Promise.resolve(s(e)).then(r=>{if(!t.aborted)return $(e)&&!N?void el(t):ex(r,e,t)}).catch(e=>{t.aborted||(el(t),ep(e))})},[s,ex,ep,N,ei,el]),ew=(0,r.useCallback)(()=>{if(eo.current){let e;et({type:"openDialog"}),P(),window.showOpenFilePicker({multiple:l,types:F}).then(t=>(e=ei(),s(t))).then(t=>{if(et({type:"closeDialog"}),!e.aborted)return ex(t,null,e)}).catch(t=>{(e&&el(e),t instanceof DOMException&&("AbortError"===t.name||t.code===t.ABORT_ERR))?(R(t),et({type:"closeDialog"})):t instanceof DOMException&&("SecurityError"===t.name||t.code===t.SECURITY_ERR)||t instanceof DOMException&&"NotAllowedError"===t.name?(eo.current=!1,X.current?(X.current.value="",X.current.click()):ep(Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no <input> was provided."))):ep(t)});return}X.current&&(et({type:"openDialog"}),P(),X.current.value="",X.current.click())},[et,P,R,v,ex,ep,F,l,ei,el]),ej=(0,r.useCallback)(e=>{U.current?.isEqualNode(e.target)&&(" "===e.key||"Enter"===e.key||32===e.keyCode||13===e.keyCode)&&(e.preventDefault(),ew())},[U,ew]),eb=(0,r.useCallback)(()=>{et({type:"focus"})},[]),ek=(0,r.useCallback)(()=>{et({type:"blur"})},[]),eN=(0,r.useCallback)(()=>{j||(function(e=window.navigator.userAgent){return -1!==e.indexOf("MSIE")||-1!==e.indexOf("Trident/")||-1!==e.indexOf("Edge/")}()?setTimeout(ew,0):ew())},[j,ew]),eS=e=>a?null:e,eA=e=>b?null:eS(e),eD=e=>k?null:eS(e),eE=e=>{N&&e.stopPropagation()},eT=(0,r.useMemo)(()=>({refKey:e="ref",role:t,onKeyDown:r,onFocus:s,onBlur:n,onClick:i,onDragEnter:l,onDragOver:o,onDragLeave:c,onDrop:d,onPaste:u,...m}={})=>{let p;return{onKeyDown:eA(q(r,ej)),onFocus:eA(q(s,eb)),onBlur:eA(q(n,ek)),onClick:eS(q(i,eN)),onDragEnter:eD(q(l,ef)),onDragOver:eD(q(o,eg)),onDragLeave:eD(q(c,eh)),onDrop:eD(q(d,ev)),onPaste:(p=q(u,ey),S?null:eS(p)),role:"string"==typeof t&&""!==t?t:"presentation",[e]:U,...!a&&!b?{tabIndex:0}:{},...a?{"aria-disabled":!0}:{},...m}},[U,ej,eb,ek,eN,ef,eg,eh,ev,ey,b,k,S,a]),eC=(0,r.useCallback)(e=>{e.stopPropagation()},[]),eI=(0,r.useMemo)(()=>({refKey:e="ref",onChange:t,onClick:r,...a}={})=>({accept:I,multiple:l,type:"file","aria-label":"file upload",style:{border:0,display:"block",height:0,margin:0,maxWidth:0,opacity:0,overflow:"hidden",padding:0,width:0},onChange:eS(q(t,ev)),onClick:eS(q(r,eC)),tabIndex:-1,[e]:X,...a}),[X,t,l,ev,a]);return{...ee,isFocused:er&&!a,getRootProps:eT,getInputProps:eI,rootRef:U,inputRef:X,open:eS(ew)}}function Y(e,t){switch(t.type){case"focus":return{...e,isFocused:!0};case"blur":return{...e,isFocused:!1};case"openDialog":return{...J,isFileDialogActive:!0};case"closeDialog":return{...e,isFileDialogActive:!1};case"setDraggedFiles":return{...e,isDragActive:t.isDragActive,isDragAccept:t.isDragAccept,isDragReject:t.isDragReject,isDragUnknown:t.isDragUnknown,dragFileRejections:t.dragFileRejections};case"setProcessing":return{...e,isProcessing:t.isProcessing};case"setFiles":return{...e,acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections,dragFileRejections:[],isProcessing:!1,isDragReject:!1,isDragUnknown:!1};case"setDragGlobal":return{...e,isDragGlobal:t.isDragGlobal};case"reset":return{...J};default:return e}}function Q(){}var X=e.i(456420);let ee={name:"cloud-upload",size:24,node:[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]],aliases:["upload-cloud"]};ee.node;let et=(0,X.f)(ee);var er=e.i(446513);let ea={name:"clipboard-paste",size:24,node:[["path",{d:"M11 14h10",key:"1w8e9d"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v1.344",key:"1e62lh"}],["path",{d:"m17 18 4-4-4-4",key:"z2g111"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113",key:"bjbb7m"}],["rect",{x:"8",y:"2",width:"8",height:"4",rx:"1",key:"ublpy"}]]};ea.node;let es=(0,X.f)(ea);var en=e.i(201276),ei=e.i(294114);let el=()=>()=>{};function eo(){return(0,r.useSyncExternalStore)(el,()=>!0,()=>!1)}e.s(["f",0,function({onImageSelect:e,isAnalyzing:n}){let{t:i}=(0,d.b)(),[o,c]=(0,r.useState)(!1),u=eo();(0,r.useEffect)(()=>{"Notification"in window&&"default"===Notification.permission&&Notification.requestPermission()},[]);let{getRootProps:m,getInputProps:p,isDragActive:f}=K({onDrop:(0,r.useCallback)(t=>{let r=t[0];r&&e(r)},[e]),accept:{"image/*":[".jpeg",".jpg",".png"]},maxFiles:1,disabled:n}),g=(0,r.useCallback)(t=>{let r=t.type||"image/png",a=r.split("/")[1]||"png";e(t instanceof File&&t.name?t:new File([t],`clipboard-${Date.now()}.${a}`,{type:r}))},[e]);(0,r.useEffect)(()=>{let e=e=>{if(n)return;let t=e.target;if(t&&(t.isContentEditable||["INPUT","TEXTAREA"].includes(t.tagName)))return;let r=Array.from(e.clipboardData?.items??[]).find(e=>"file"===e.kind&&e.type.startsWith("image/")),a=r?.getAsFile();a&&(e.preventDefault(),g(a))};return window.addEventListener("paste",e),()=>window.removeEventListener("paste",e)},[n,g]);let h=async()=>{if(!(u&&"u">typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.read))return void ei.c.warning(i.upload.pasteNotSupported);try{for(let e of(await navigator.clipboard.read())){let t=e.types.find(e=>e.startsWith("image/"));if(t){let r=await e.getType(t);g(r);return}}ei.c.warning(i.upload.pasteNoImage)}catch(e){en.V.warn("[UploadZone]","Clipboard read failed",{error:e instanceof Error?e.message:String(e)}),e instanceof Error&&"NotAllowedError"===e.name?ei.c.warning(i.upload.pastePermissionDenied):ei.c.error(i.upload.pasteFailed)}},x=()=>u&&"u">typeof navigator&&"mediaDevices"in navigator&&"getDisplayMedia"in navigator.mediaDevices,v=async()=>{if(!x())return void ei.c.warning(i.upload.screenshotNotSupported);c(!0);try{let t;"CaptureController"in window&&(t=new window.CaptureController);let r={video:!0,audio:!1,preferCurrentTab:!1};t&&(r.controller=t);let a=await navigator.mediaDevices.getDisplayMedia(r),[s]=a.getVideoTracks(),n=s.getSettings().displaySurface;if(t&&("browser"===n||"window"===n))try{t.setFocusBehavior("no-focus-change"),en.V.info("[UploadZone]","Screenshot focus behavior set to no-change",void 0,{sendToBackend:!1})}catch(e){en.V.warn("[UploadZone]","Unable to set screenshot focus behavior",{error:e})}let i=document.createElement("video");if(i.srcObject=a,i.muted=!0,i.autoplay=!0,i.playsInline=!0,await new Promise((e,t)=>{i.onloadedmetadata=()=>{i.play().then(()=>{e()}).catch(t)},i.onerror=t}),await new Promise(e=>setTimeout(e,500)),0===i.videoWidth||0===i.videoHeight)throw Error("视频没有有效尺寸");let l=document.createElement("canvas");l.width=i.videoWidth,l.height=i.videoHeight;let o=l.getContext("2d");if(!o)throw Error("无法获取canvas上下文");o.drawImage(i,0,0),a.getTracks().forEach(e=>e.stop()),l.toBlob(t=>{t?(e(new File([t],`screenshot-${Date.now()}.png`,{type:"image/png"})),en.V.info("[UploadZone]","Screenshot captured",void 0,{sendToBackend:!1})):ei.c.error("截图转换失败")},"image/png",1)}catch(e){en.V.error("[UploadZone]","Screenshot failed",{error:e}),e instanceof Error&&("NotAllowedError"===e.name?ei.c.warning(i.upload.screenshotPermissionDenied):ei.c.error(`${i.upload.screenshotFailed}: ${e.message}`))}finally{c(!1)}};return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)(a.N,{...m(),className:`group cursor-pointer rounded-2xl border-2 border-dashed shadow-none transition-all hover:border-primary/60 hover:bg-accent/40 ${f?"border-primary bg-accent/60":"border-border bg-card"}`,children:(0,t.jsxs)(a.O,{className:"flex min-h-[260px] flex-col items-center justify-center space-y-4 py-10 text-center md:min-h-[300px]",children:[(0,t.jsx)("input",{...p()}),(0,t.jsx)("div",{className:"rounded-2xl bg-accent p-4 text-primary transition-transform group-hover:scale-105",children:n?(0,t.jsx)(l.f,{className:"h-10 w-10 animate-spin"}):(0,t.jsx)(et,{className:"h-10 w-10"})}),(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("h3",{className:"text-lg font-semibold",children:n?i.app.analyzing:i.upload.analyze}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:n?i.app.analyzing:i.app.dragDrop}),(0,t.jsx)("p",{className:"mt-2 text-xs text-muted-foreground",children:i.upload.support})]})]})}),(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row sm:flex-wrap items-stretch sm:items-start justify-center gap-4",children:[u&&(0,t.jsxs)("div",{className:"flex flex-col items-center gap-2",children:[(0,t.jsxs)(s.f,{variant:"outline",onClick:h,disabled:n,className:"flex items-center gap-2 w-full sm:w-auto",children:[(0,t.jsx)(es,{className:"h-4 w-4"}),i.upload.paste]}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground text-center",children:i.upload.pasteDesc})]}),x()&&(0,t.jsxs)("div",{className:"flex flex-col items-center gap-2",children:[(0,t.jsxs)(s.f,{variant:"outline",onClick:v,disabled:n||o,className:"flex items-center gap-2 w-full sm:w-auto",children:[o?(0,t.jsx)(l.f,{className:"h-4 w-4 animate-spin"}):(0,t.jsx)(er.f,{className:"h-4 w-4"}),o?i.common.pleaseWait:i.upload.screenshot]}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground text-center",children:i.upload.screenshotDesc})]})]})]})}],798469);var ec=e.i(30030),ed=e.i(248425),eu=Object.defineProperty,em=(e,t)=>eu(e,"name",{value:t,configurable:!0}),ep="Progress",[ef,eg]=(0,ec.f)(ep),[eh,ex]=ef(ep),ev=r.forwardRef(em(function(e,r){let{__scopeProgress:a,value:s=null,max:n,getValueLabel:i=ew,...l}=e;(n||0===n)&&!ek(n)&&console.error(eS(`${n}`,"Progress"));let o=ek(n)?n:100;null===s||eN(s,o)||console.error(eA(`${s}`,"Progress"));let c=eN(s,o)?s:null,d=eb(c)?i(c,o):void 0;return(0,t.jsx)(eh,{scope:a,value:c,max:o,children:(0,t.jsx)(ed.V.div,{"aria-valuemax":o,"aria-valuemin":0,"aria-valuenow":eb(c)?c:void 0,"aria-valuetext":d,role:"progressbar","data-state":ej(c,o),"data-value":c??void 0,"data-max":o,...l,ref:r})})},"Progress")),ey=r.forwardRef(em(function(e,r){let{__scopeProgress:a,...s}=e,n=ex("ProgressIndicator",a);return(0,t.jsx)(ed.V.div,{"data-state":ej(n.value,n.max),"data-value":n.value??void 0,"data-max":n.max,...s,ref:r})},"ProgressIndicator"));function ew(e,t){return`${Math.round(e/t*100)}%`}function ej(e,t){return null==e?"indeterminate":e===t?"complete":"loading"}function eb(e){return"number"==typeof e}function ek(e){return eb(e)&&!isNaN(e)&&e>0}function eN(e,t){return eb(e)&&!isNaN(e)&&e<=t&&e>=0}function eS(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 eA(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\`.`}em(ew,"defaultGetValueLabel"),em(ej,"getProgressState"),em(eb,"isNumber"),em(ek,"isValidMaxNumber"),em(eN,"isValidValueNumber"),em(eS,"getInvalidMaxError"),em(eA,"getInvalidValueError");var eD=e.i(975157);let eE=r.forwardRef(({className:e,value:r,...a},s)=>(0,t.jsx)(ev,{ref:s,value:r,className:(0,eD.f)("relative h-4 w-full overflow-hidden rounded-full bg-secondary",e),...a,children:(0,t.jsx)(ey,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(r||0)}%)`}})}));eE.displayName=ev.displayName;let eT={compressing:10,uploading:20,analyzing:50,processing:85,saving:95};function eC({status:e,message:a,className:s}){let n,{t:i}=(0,d.b)(),[o]=(0,r.useState)(()=>Date.now()),[c,u]=(0,r.useState)(0);(0,r.useEffect)(()=>{let e=setInterval(()=>{u(Math.max(0,Math.floor((Date.now()-o)/1e3)))},1e3);return()=>clearInterval(e)},[o]);let m=eT[e],p=i.common.progress.estimated.replace("{percent}",String(m));return(0,t.jsx)("div",{className:(0,eD.f)("fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm",s),children:(0,t.jsx)("div",{className:"w-full max-w-md p-6 space-y-6 bg-card rounded-lg border shadow-lg mx-4",children:(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center space-y-4 text-center",children:[(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(l.f,{className:"h-12 w-12 animate-spin text-primary"}),(0,t.jsx)("div",{className:"absolute inset-0 flex items-center justify-center"})]}),(0,t.jsxs)("div",{className:"space-y-2 w-full",children:[(0,t.jsx)("h3",{className:"text-lg font-semibold tracking-tight","aria-live":"polite",children:a||i.common.progress[e]}),(0,t.jsx)(eE,{value:m,"aria-label":p,"aria-valuetext":p,className:"h-2 w-full"})]}),(0,t.jsxs)("div",{className:"flex w-full flex-wrap items-center justify-between gap-2 text-sm text-muted-foreground tabular-nums",children:[(0,t.jsx)("span",{children:p}),(0,t.jsx)("span",{role:"timer","aria-live":"off",children:i.common.progress.elapsed.replace("{time}",(n=[Math.floor(c/60)%60,c%60],c>=3600&&n.unshift(Math.floor(c/3600)),n.map(e=>String(e).padStart(2,"0")).join(":")))})]}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:i.common.progress.estimateHint})]})})})}e.s(["f",0,function({status:e,message:r,className:a}){return eo()&&"idle"!==e?(0,t.jsx)(eC,{status:e,message:r,className:a}):null}],956738),e.s(["f",0,function({options:e,value:r,onChange:a,className:s}){return(0,t.jsx)("div",{className:(0,eD.f)("grid gap-1 rounded-xl bg-muted p-1",s),style:{gridTemplateColumns:`repeat(${e.length}, minmax(0, 1fr))`},role:"tablist",children:e.map(({value:e,label:s,icon:n})=>{let i=e===r;return(0,t.jsxs)("button",{type:"button",role:"tab","aria-selected":i,className:(0,eD.f)("flex items-center justify-center gap-1.5 rounded-lg px-2 py-2.5 text-sm font-medium transition-all",i?"bg-card text-primary shadow-sm":"text-muted-foreground hover:text-foreground"),onClick:()=>a(e),children:[n&&(0,t.jsx)(n,{className:"h-4 w-4 shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:s})]},e)})})}],185592);var eI=e.i(618566),eF=e.i(303163);function eP(e,t){let r=t.common?.messages?.analysisFailed||"Analysis failed, please try again",a=(0,eF.d)(e);if(a){let e=t.errors??{};if(!(a in e))return a;let s=e[a];return"string"==typeof s?s:r}let s=(0,eF.Z)(e);if(s.includes("fetch")||s.includes("network"))return t.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}var eR=e.i(41931),eO=e.i(28928),eM=e.i(62825),ez=e.i(364002);e.s(["f",0,function({logPrefix:e,analyzeSubjectId:t,importSubjectId:a,textNotebook:s,fixedSubjectId:n,onParsed:i}){let{t:l,language:o}=(0,d.b)(),c=(0,eI.useRouter)(),[u,m]=(0,r.useState)("upload"),[p,f]=(0,r.useState)("idle"),[g,h]=(0,r.useState)(null),[x,v]=(0,r.useState)(null),[y,w]=(0,r.useState)(null),[j,b]=(0,r.useState)(null),[k,N]=(0,r.useState)(!1),[S,A]=(0,r.useState)(!1),[D,E]=(0,r.useState)(null),[T,C]=(0,r.useState)(null),I=y?.timeouts?.analyze||18e4,F=I+1e4;(0,r.useEffect)(()=>()=>{j&&URL.revokeObjectURL(j)},[j]),(0,r.useEffect)(()=>{(0,ez.x)().then(A),eR.k.get("/api/settings").then(w).catch(t=>en.V.error(e,"Failed to fetch config",{error:t}))},[e]),(0,r.useEffect)(()=>{if("idle"===p)return;let e=setTimeout(()=>{en.V.warn("[Progress]","处理超时,关闭进度提示",{analysisStep:p,safetyTimeout:F}),f("idle")},F);return()=>clearTimeout(e)},[p,F]);let P=async(t,r,s)=>{if(!S){f("saving");let n=await (0,ez.a)(t,{subjectId:a,imageUrl:r,paperLevel:s});E(n),v(null),en.V.info(e,"Imported without review",{id:n.id});return}v(r),h(t),m("review")},R=async r=>{let a=Date.now();en.V.info(e,"Starting analysis flow",{apiTimeout:I,safetyTimeout:F});try{f("compressing");let s=await (0,eO.f)(r);f("analyzing");let n=await eR.k.post("/api/analyze",{imageBase64:s,language:o,subjectId:t||void 0},{timeout:I,recoverable:!0});if(!n||"object"!=typeof n)throw Error("Invalid API response: data is null or not an object");f("processing"),S&&i?.(n),await P(n,s),en.V.info(e,"Analysis completed",{totalDuration:Date.now()-a})}catch(t){en.V.error(e,"Analysis failed",{errorDuration:Date.now()-a,error:(0,eF.Z)(t)}),ei.c.error(eP(t,l))}finally{f("idle")}},O=async t=>{let r=Date.now();en.V.info(e,"Starting text-based analysis",{textLength:t.length});try{f("analyzing");let a=await eR.k.post("/api/reanswer",{questionText:t,language:o,forImport:!0,subject:s?.name,subjectId:s?.id},{timeout:I,recoverable:!0});f("processing"),await P({questionText:t,answerText:a.answerText,analysis:a.analysis,knowledgePoints:a.knowledgePoints||[],wrongAnswerText:a.wrongAnswerText||"",mistakeAnalysis:a.mistakeAnalysis||"",mistakeStatus:(0,eM.h)(a.mistakeStatus),subject:a.subject||"其他",requiresImage:!1,difficultyStars:a.difficultyStars??null,gradeSemester:a.gradeSemester??null},null),en.V.info(e,"Text analysis completed",{totalDuration:Date.now()-r})}catch(t){en.V.error(e,"Text analysis failed",{errorDuration:Date.now()-r,error:(0,eF.Z)(t)}),ei.c.error(eP(t,l))}finally{f("idle")}},M=async t=>{try{let e=await eR.k.post("/api/error-items",t);return ei.c.success(e.duplicate?l.importFlow.duplicate:l.common.messages.saveSuccess),e.duplicate?c.push(`/error-items/${e.id}`):t.subjectId&&c.push(`/notebooks/${t.subjectId}`),!0}catch(t){return en.V.error(e,"Save failed",{errorMessage:(0,eF.d)(t)??(0,eF.Z)(t)}),ei.c.error(l.common?.messages?.saveFailed||"Failed to save"),!1}},z=async e=>{await M({...e,originalImageUrl:x||"",...n?{subjectId:n}:{}})&&(m("upload"),h(null),v(null))};return{step:u,cancelReview:()=>m("upload"),analysisStep:p,setAnalysisStep:f,isBusy:"idle"!==p,parsedData:g,currentImage:x,aiTimeout:I,croppingImage:j,isCropperOpen:k,closeCropper:()=>N(!1),lastImported:D,dismissImported:()=>E(null),batchBlobs:T,closeBatch:()=>C(null),selectImage:e=>{E(null),b(URL.createObjectURL(e)),N(!0)},cropComplete:e=>{N(!1),R(new File([e],"cropped-image.jpg",{type:"image/jpeg"}))},startBatch:e=>{N(!1),E(null),C(e)},submitText:O,saveQuestion:M,saveReviewed:z}}],267275)}])})();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(()=>{"use strict";(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,981140,e=>{var t=Object.defineProperty,r=(e,r)=>t(e,"name",{value:r,configurable:!0}),n=!!("u">typeof window&&window.document&&window.document.createElement);function o(e,t,{checkForDefaultPrevented:n=!0}={}){return r(function(r){if(e?.(r),!1===n||!r||!r.defaultPrevented)return t?.(r)},"handleEvent")}function i(e){if(!n)throw Error("Cannot access document outside of the DOM");return e?.ownerDocument??document}function a(e){return"IFRAME"===e.tagName}r(o,"composeEventHandlers"),r(function(e){if(!n)throw Error("Cannot access window outside of the DOM");return e?.ownerDocument?.defaultView??window},"getOwnerWindow"),r(i,"getOwnerDocument"),r(function e(t,r=!1){let{activeElement:n}=i(t);if(!n?.nodeName)return null;if(a(n)&&n.contentDocument)return e(n.contentDocument.body,r);if(r){let e=n.getAttribute("aria-activedescendant");if(e){let t=i(n).getElementById(e);if(t)return t}}return n},"getActiveElement"),r(a,"isFrame"),e.s(["f",0,o])},705844,e=>{e.s(["f",0,!1])},30030,e=>{var t=e.i(271645),r=e.i(843476),n=Object.defineProperty,o=(e,t)=>n(e,"name",{value:t,configurable:!0});function i(e,n=[]){let s=[];function l(n,i){let a=t.createContext(i);a.displayName=n+"Context";let l=s.length;s=[...s,i];let u=o(n=>{let{scope:o,children:i,...s}=n,u=o?.[e]?.[l]||a,c=t.useMemo(()=>s,Object.values(s));return(0,r.jsx)(u.Provider,{value:c,children:i})},"Provider");function c(r,o,s={}){let{optional:u=!1}=s,f=o?.[e]?.[l]||a,d=t.useContext(f);if(d)return d;if(void 0!==i)return i;if(!u)throw Error(`\`${r}\` must be used within \`${n}\``)}return u.displayName=n+"Provider",o(c,"useContext"),[u,c]}o(l,"createContext");let u=o(()=>{let r=s.map(e=>t.createContext(e));return o(function(n){let o=n?.[e]||r;return t.useMemo(()=>({[`__scope${e}`]:{...n,[e]:o}}),[n,o])},"useScope")},"createScope");return u.scopeName=e,[l,a(u,...n)]}function a(...e){let r=e[0];if(1===e.length)return r;let n=o(()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return o(function(e){let o=n.reduce((t,{useScope:r,scopeName:n})=>{let o=r(e)[`__scope${n}`];return{...t,...o}},{});return t.useMemo(()=>({[`__scope${r.scopeName}`]:o}),[o])},"useComposedScopes")},"createScope");return n.scopeName=r.scopeName,n}o(function(e,n){let i=t.createContext(n);i.displayName=e+"Context";let a=o(e=>{let{children:n,...o}=e,a=t.useMemo(()=>o,Object.values(o));return(0,r.jsx)(i.Provider,{value:a,children:n})},"Provider");function s(r,o={}){let{optional:a=!1}=o,l=t.useContext(i);if(l)return l;if(void 0!==n)return n;if(!a)throw Error(`\`${r}\` must be used within \`${e}\``)}return a.displayName=e+"Provider",o(s,"useContext"),[a,s]},"createContext"),o(i,"createContextScope"),o(a,"composeContextScopes"),e.s(["f",0,i])},296626,e=>{var t=e.i(271645),r=e.i(934620),n=Object.defineProperty,o=(e,t)=>n(e,"name",{value:t,configurable:!0});function i(e,r){return t.useReducer((e,t)=>r[e][t]??e,e)}o(i,"useStateMachine");var a=o(e=>{let{present:r,children:n}=e,o=s(r),i="function"==typeof n?n({present:o.isPresent}):t.Children.only(n),a=u(o.ref,f(i));return"function"==typeof n||o.isPresent?t.cloneElement(i,{ref:a}):null},"Presence");function s(e){let[n,a]=t.useState(),s=t.useRef(null),l=t.useRef(e),u=t.useRef("none"),f=t.useRef(void 0),[d,p]=i(e?"mounted":"unmounted",{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return t.useEffect(()=>{"mounted"===d?(u.current=f.current??c(s.current),f.current=void 0):u.current="none"},[d]),(0,r.f)(()=>{let t=s.current,r=l.current;if(r!==e){let n=u.current,o=c(t);e?(f.current=o,p("MOUNT")):"none"===o||t?.display==="none"?p("UNMOUNT"):r&&n!==o?p("ANIMATION_OUT"):p("UNMOUNT"),l.current=e}},[e,p]),(0,r.f)(()=>{if(n){let e,t=n.ownerDocument.defaultView??window,r=o(r=>{let o=c(s.current).includes(CSS.escape(r.animationName));if(r.target===n&&o&&(p("ANIMATION_END"),!l.current)){let r=n.style.animationFillMode;n.style.animationFillMode="forwards",e=t.setTimeout(()=>{"forwards"===n.style.animationFillMode&&(n.style.animationFillMode=r)})}},"handleAnimationEnd"),i=o(e=>{e.target===n&&(u.current=c(s.current))},"handleAnimationStart");return n.addEventListener("animationstart",i),n.addEventListener("animationcancel",r),n.addEventListener("animationend",r),()=>{t.clearTimeout(e),n.removeEventListener("animationstart",i),n.removeEventListener("animationcancel",r),n.removeEventListener("animationend",r)}}p("ANIMATION_END")},[n,p]),{isPresent:["mounted","unmountSuspended"].includes(d),ref:t.useCallback(e=>{if(e){let t=getComputedStyle(e);s.current=t,f.current=c(t)}else s.current=null;a(e)},[])}}function l(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function u(...e){let r=t.useRef(e);return r.current=e,t.useCallback(e=>{let t=r.current,n=!1,o=t.map(t=>{let r=l(t,e);return n||"function"!=typeof r||(n=!0),r});if(n)return()=>{for(let e=0;e<o.length;e++){let r=o[e];"function"==typeof r?r():l(t[e],null)}}},[])}function c(e){return e?.animationName||"none"}function f(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(r=(t=Object.getOwnPropertyDescriptor(e,"ref")?.get)&&"isReactWarning"in t&&t.isReactWarning)?e.props.ref:e.props.ref||e.ref}o(s,"usePresence"),o(l,"setRef"),o(u,"useStableComposedRefs"),o(c,"getAnimationName"),o(f,"getElementRef"),e.s(["f",0,a])},248425,e=>{var t=e.i(271645),r=e.i(174080),n=e.i(991918),o=e.i(843476),i=Object.defineProperty,a=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,r)=>{let i=(0,n.B)(`Primitive.${r}`),a=t.forwardRef((e,t)=>{let{asChild:n,...a}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,o.jsx)(n?i:r,{...a,ref:t})});return a.displayName=`Primitive.${r}`,{...e,[r]:a}},{});function s(e,t){e&&r.flushSync(()=>e.dispatchEvent(t))}i(s,"name",{value:"dispatchDiscreteCustomEvent",configurable:!0}),e.s(["V",0,a,"u",0,s])},369340,e=>{var t=e.i(271645),r=e.i(705844),n=e.i(934620),o=Object.defineProperty,i=t[" useEffectEvent ".trim().toString()],a=t[" useInsertionEffect ".trim().toString()];function s(e){if("function"==typeof i)return i(e);let r=t.useRef(()=>{throw Error("Cannot call an event handler while rendering.")});return"function"==typeof a?a(()=>{r.current=e}):(0,n.f)(()=>{r.current=e}),t.useMemo(()=>(...e)=>r.current?.(...e),[])}o(s,"name",{value:"useEffectEvent",configurable:!0});var l=Object.defineProperty,u=(e,t)=>l(e,"name",{value:t,configurable:!0}),c=t[" useInsertionEffect ".trim().toString()]||n.f;function f({prop:e,defaultProp:n,onChange:o=u(()=>{},"onChange"),caller:i}){let[a,s,l]=d({defaultProp:n,onChange:o}),c=void 0!==e,m=c?e:a;if(r.f){let r=t.useRef(void 0!==e);t.useEffect(()=>{let e=r.current;if(e!==c){let t=c?"controlled":"uncontrolled";console.warn(`${i} is changing from ${e?"controlled":"uncontrolled"} to ${t}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`)}r.current=c},[c,i])}return[m,t.useCallback(t=>{if(c){let r=p(t)?t(e):t;r!==e&&l.current?.(r)}else s(t)},[c,e,s,l])]}function d({defaultProp:e,onChange:r}){let[n,o]=t.useState(e),i=t.useRef(n),a=t.useRef(r);return c(()=>{a.current=r},[r]),t.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,o,a]}function p(e){return"function"==typeof e}u(f,"useControllableState"),u(d,"useUncontrolledState"),u(p,"isFunction");var m=Symbol("RADIX:SYNC_STATE");u(function(e,n,o,i){let{prop:a,defaultProp:l,onChange:u,caller:c}=n,f=void 0!==a,d=s(u);if(r.f){let e=t.useRef(void 0!==a);t.useEffect(()=>{let t=e.current;if(t!==f){let e=f?"controlled":"uncontrolled";console.warn(`${c} is changing from ${t?"controlled":"uncontrolled"} to ${e}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`)}e.current=f},[f,c])}let p=[{...o,state:l}];i&&p.push(i);let[g,h]=t.useReducer((t,r)=>{if(r.type===m)return{...t,state:r.state};let n=e(t,r);return f&&!Object.is(n.state,t.state)&&d(n.state),n},...p),v=g.state,y=t.useRef(v);t.useEffect(()=>{y.current!==v&&(y.current=v,f||d(v))},[v,y,f]);let b=t.useMemo(()=>void 0!==a?{...g,state:a}:g,[g,a]);return t.useEffect(()=>{f&&!Object.is(a,g.state)&&h({type:m,state:a})},[a,g.state,f]),[b,h]},"useControllableStateReducer"),e.s(["f",0,f],369340)},934620,e=>{var t=e.i(271645),r=globalThis?.document?t.useLayoutEffect:()=>{};e.s(["f",0,r])},635804,e=>{var t=e.i(271645),r=e.i(934620);function n(e){let[n,o]=t.useState(void 0);return(0,r.f)(()=>{if(e){o({width:e.offsetWidth,height:e.offsetHeight});let t=0,r=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;let n=r[0];window.cancelAnimationFrame(t),t=window.requestAnimationFrame(()=>{let t,r;if("borderBoxSize"in n){let e=n.borderBoxSize,o=Array.isArray(e)?e[0]:e;t=o.inlineSize,r=o.blockSize}else t=e.offsetWidth,r=e.offsetHeight;o({width:t,height:r})})});return r.observe(e,{box:"border-box"}),()=>{window.cancelAnimationFrame(t),r.unobserve(e)}}o(void 0)},[e]),n}(0,Object.defineProperty)(n,"name",{value:"useSize",configurable:!0}),e.s(["f",0,n])},689664,e=>{var t=e.i(456420);let r={name:"check",size:24,node:[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]};r.node;let n=(0,t.f)(r);e.s(["f",0,n],689664)},716327,456539,e=>{var t=e.i(456420);let r={name:"chevron-down",size:24,node:[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]};r.node;let n=(0,t.f)(r);e.s(["f",0,n],716327);let o={name:"chevron-up",size:24,node:[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]};o.node;let i=(0,t.f)(o);e.s(["f",0,i],456539)},548161,e=>{var t=e.i(456420);let r={name:"circle-check-big",size:24,node:[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],aliases:["check-circle"]};r.node;let n=(0,t.f)(r);e.s(["f",0,n],548161)},583967,e=>{var t=e.i(456420);let r={name:"circle-x",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],aliases:["x-circle"]};r.node;let n=(0,t.f)(r);e.s(["f",0,n],583967)},632781,e=>{var t=e.i(456420);let r={name:"loader-circle",size:24,node:[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],aliases:["loader-2"]};r.node;let n=(0,t.f)(r);e.s(["f",0,n],632781)},446513,e=>{var t=e.i(456420);let r={name:"monitor",size:24,node:[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]};r.node;let n=(0,t.f)(r);e.s(["f",0,n],446513)},741120,e=>{var t=e.i(456420);let r={name:"refresh-cw",size:24,node:[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]};r.node;let n=(0,t.f)(r);e.s(["f",0,n],741120)},395925,e=>{var t=e.i(456420);let r={name:"rotate-ccw",size:24,node:[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]};r.node;let n=(0,t.f)(r);e.s(["f",0,n],395925)},759659,e=>{var t=e.i(456420);let r={name:"trash",size:24,node:[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],aliases:["trash-2"]};r.node;let n=(0,t.f)(r);e.s(["f",0,n],759659)},263676,e=>{var t=e.i(456420);let r={name:"x",size:24,node:[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]};r.node;let n=(0,t.f)(r);e.s(["X",0,n],263676)},522016,(e,t,r)=>{e.i(247167),Object.defineProperty(r,"__esModule",{value:!0});var n={default:function(){return v},useLinkStatus:function(){return b}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});let i=e.r(190809),a=e.r(843476),s=i._(e.r(271645)),l=e.r(195057),u=e.r(8372),c=e.r(818581),f=e.r(718967),d=e.r(405550),p=e.r(388540),m=e.r(91949),g=e.r(573668),h=e.r(509396);function v(t){var r;let n,o,i,[v,b]=(0,s.useOptimistic)(m.IDLE_LINK_STATUS),w=(0,s.useRef)(null),{href:x,as:E,children:S,prefetch:j=null,passHref:C,replace:N,shallow:P,scroll:O,onClick:R,onMouseEnter:D,onTouchStart:T,legacyBehavior:M=!1,onNavigate:k,transitionTypes:A,ref:_,unstable_dynamicOnHover:I,...L}=t;n=S,M&&("string"==typeof n||"number"==typeof n)&&(n=(0,a.jsx)("a",{children:n}));let $=s.default.useContext(u.AppRouterContext),z=!1!==j,F=!1===j?"none":!0===j?"full":"auto",U="none"!==F?"auto"===F?h.FetchStrategy.PPR:h.FetchStrategy.Full:h.FetchStrategy.PPR,V="string"==typeof(r=E||x)?r:(0,l.formatUrl)(r);if(M){if(n?.$$typeof===Symbol.for("react.lazy"))throw Error("`<Link legacyBehavior>` received a direct child that is either a Server Component, or JSX that was loaded with React.lazy(). This is not supported. Either remove legacyBehavior, or make the direct child a Client Component that renders the Link's `<a>` tag.");o=s.default.Children.only(n)}let B=M?o&&"object"==typeof o&&o.ref:_,W,q=s.default.useCallback(e=>(null!==$&&(w.current=(0,m.mountLinkInstance)(e,V,$,U,z,b,W)),()=>{w.current&&((0,m.unmountLinkForCurrentNavigation)(w.current),w.current=null),(0,m.unmountPrefetchableInstance)(e)}),[z,V,$,U,b,W]),J={ref:(0,c.useMergedRef)(q,B),onClick(t){M||"function"!=typeof R||R(t),M&&o.props&&"function"==typeof o.props.onClick&&o.props.onClick(t),!$||t.defaultPrevented||function(t,r,n,o,i,a,s,l="none"){if("u">typeof window){let u,{nodeName:c}=t.currentTarget;if("A"===c.toUpperCase()&&((u=t.currentTarget.getAttribute("target"))&&"_self"!==u||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||t.nativeEvent&&2===t.nativeEvent.which)||t.currentTarget.hasAttribute("download"))return;if(!(0,g.isLocalURL)(r)){o&&(t.preventDefault(),location.replace(r));return}if(t.preventDefault(),a){let e=!1;if(a({preventDefault:()=>{e=!0}}),e)return}let{navigate:f}=e.r(132916);f(r,o?"replace":"push",!1===i?p.ScrollBehavior.NoScroll:p.ScrollBehavior.Default,n.current,s,l)}}(t,V,w,N,O,k,A,F)},onMouseEnter(e){M||"function"!=typeof D||D(e),M&&o.props&&"function"==typeof o.props.onMouseEnter&&o.props.onMouseEnter(e),$&&z&&(0,m.onNavigationIntent)(e.currentTarget,!0===I)},onTouchStart:function(e){M||"function"!=typeof T||T(e),M&&o.props&&"function"==typeof o.props.onTouchStart&&o.props.onTouchStart(e),$&&z&&(0,m.onNavigationIntent)(e.currentTarget,!0===I)}};return(0,f.isAbsoluteUrl)(V)?J.href=V:M&&!C&&("a"!==o.type||"href"in o.props)||(J.href=(0,d.addBasePath)(V)),i=M?s.default.cloneElement(o,J):(0,a.jsx)("a",{...L,...J,children:n}),(0,a.jsx)(y.Provider,{value:v,children:i})}let y=(0,s.createContext)(m.IDLE_LINK_STATUS),b=()=>(0,s.useContext)(y);("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},818581,(e,t,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"useMergedRef",{enumerable:!0,get:function(){return o}});let n=e.r(271645);function o(e,t){let r=(0,n.useRef)(null),o=(0,n.useRef)(null);return(0,n.useCallback)(n=>{if(null===n){let e=r.current;e&&(r.current=null,e());let t=o.current;t&&(o.current=null,t())}else e&&(r.current=i(e,n)),t&&(o.current=i(t,n))},[e,t])}function i(e,t){if("function"!=typeof e)return e.current=t,()=>{e.current=null};{let r=e(t);return"function"==typeof r?r:()=>e(null)}}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},195057,(e,t,r)=>{e.i(247167),Object.defineProperty(r,"__esModule",{value:!0});var n={formatUrl:function(){return s},formatWithValidation:function(){return u},urlObjectKeys:function(){return l}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});let i=e.r(190809)._(e.r(998183)),a=/https?|ftp|gopher|file/;function s(e){let{auth:t,hostname:r}=e,n=e.protocol||"",o=e.pathname||"",s=e.hash||"",l=e.query||"",u=!1;t=t?encodeURIComponent(t).replace(/%3A/i,":")+"@":"",e.host?u=t+e.host:r&&(u=t+(~r.indexOf(":")?`[${r}]`:r),e.port&&(u+=":"+e.port)),l&&"object"==typeof l&&(l=String(i.urlQueryToSearchParams(l)));let c=e.search||l&&`?${l}`||"";return n&&!n.endsWith(":")&&(n+=":"),e.slashes||(!n||a.test(n))&&!1!==u?(u="//"+(u||""),o&&"/"!==o[0]&&(o="/"+o)):u||(u=""),s&&"#"!==s[0]&&(s="#"+s),c&&"?"!==c[0]&&(c="?"+c),o=o.replace(/[?#]/g,encodeURIComponent),c=c.replace("#","%23"),`${n}${u}${o}${c}${s}`}let l=["auth","hash","host","hostname","href","path","pathname","port","protocol","query","search","slashes"];function u(e){return s(e)}},573668,(e,t,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"isLocalURL",{enumerable:!0,get:function(){return i}});let n=e.r(718967),o=e.r(652817);function i(e){if(!(0,n.isAbsoluteUrl)(e))return!0;try{let t=(0,n.getLocationOrigin)(),r=new URL(e,t);return r.origin===t&&(0,o.hasBasePath)(r.pathname)}catch(e){return!1}}},718967,(e,t,r)=>{e.i(247167),Object.defineProperty(r,"__esModule",{value:!0});var n={DecodeError:function(){return v},MiddlewareNotFoundError:function(){return x},MissingStaticPage:function(){return w},NormalizeError:function(){return y},PageNotFoundError:function(){return b},SP:function(){return g},ST:function(){return h},WEB_VITALS:function(){return i},execOnce:function(){return a},getDisplayName:function(){return f},getLocationOrigin:function(){return u},getURL:function(){return c},isAbsoluteUrl:function(){return l},isResSent:function(){return d},loadGetInitialProps:function(){return m},normalizeRepeatedSlashes:function(){return p},stringifyError:function(){return E}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});let i=["CLS","FCP","INP","LCP","TTFB"];function a(e){let t,r=!1;return(...n)=>(r||(r=!0,t=e(...n)),t)}let s=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,l=e=>{let t=e.charCodeAt(0);return!!(t>=65&&t<=90||t>=97&&t<=122)&&s.test(e)};function u(){let{protocol:e,hostname:t,port:r}=window.location;return`${e}//${t}${r?":"+r:""}`}function c(){let{href:e}=window.location,t=u();return e.substring(t.length)}function f(e){return"string"==typeof e?e:e.displayName||e.name||"Unknown"}function d(e){return e.finished||e.headersSent}function p(e){let t=e.split("?");return t[0].replace(/\\/g,"/").replace(/\/\/+/g,"/")+(t[1]?`?${t.slice(1).join("?")}`:"")}async function m(e,t){let r=t.res||t.ctx&&t.ctx.res;if(!e.getInitialProps)return t.ctx&&t.Component?{pageProps:await m(t.Component,t.ctx)}:{};let n=await e.getInitialProps(t);if(r&&d(r))return n;if(!n)throw Error(`"${f(e)}.getInitialProps()" should resolve to an object. But found "${n}" instead.`);return n}let g="u">typeof performance,h=g&&["mark","measure","getEntriesByName"].every(e=>"function"==typeof performance[e]);class v extends Error{}class y extends Error{}class b extends Error{constructor(e){super(),this.code="ENOENT",this.name="PageNotFoundError",this.message=`Cannot find module for page: ${e}`}}class w extends Error{constructor(e,t){super(),this.message=`Failed to load static file for page: ${e} ${t}`}}class x extends Error{constructor(){super(),this.code="ENOENT",this.message="Cannot find the middleware module"}}function E(e){return JSON.stringify({message:e.message,stack:e.stack})}},28342,676167,e=>{var t=e.i(843476),r=e.i(111110);let n=["一年级","二年级","三年级","四年级","五年级","六年级","初一","初二","初三","高一","高二","高三","大一","大二","大三","大四"],o=n.flatMap(e=>[`${e}上`,`${e}下`]),i={primary:{start:0,end:6},junior_high:{start:6,end:9},senior_high:{start:9,end:12},university:{start:12,end:16}};e.s(["T",0,n,"H",0,o,"c",0,function(e){let t=i[e];return t?n.slice(t.start,t.end):[]},"p",0,function(e){return e.endsWith("上")?{grade:e.slice(0,-1),semester:"上"}:e.endsWith("下")?{grade:e.slice(0,-1),semester:"下"}:null}],676167),e.s(["f",0,function({id:e,value:i,onChange:a,disabled:s}){let{t:l}=(0,r.b)();return(0,t.jsxs)("select",{id:e,value:i,onChange:e=>a(e.target.value),disabled:s,"aria-label":l.editor.gradeSemester,className:"h-10 w-full min-w-0 rounded-md border border-input bg-background px-3 text-sm disabled:opacity-50",children:[(0,t.jsx)("option",{value:"",children:l.common.notSet}),i&&!o.includes(i)&&(0,t.jsx)("option",{value:i,children:i}),n.flatMap((e,r)=>["上","下"].map((n,o)=>(0,t.jsxs)("option",{value:`${e}${n}`,children:[l.gradeSelection.names[r]," · ",0===o?l.gradeSelection.firstSemester:l.gradeSelection.secondSemester]},`${e}${n}`)))]})}],28342)},487486,e=>{var t=e.i(843476),r=e.i(991918),n=e.i(225913),o=e.i(975157);let i=(0,n.f)("inline-flex items-center justify-center rounded-full border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});e.s(["f",0,function({className:e,variant:n,asChild:a=!1,...s}){let l=a?r.M:"span";return(0,t.jsx)(l,{"data-slot":"badge",className:(0,o.f)(i({variant:n}),e),...s})}])},515288,e=>{var t=e.i(843476),r=e.i(975157);e.s(["N",0,function({className:e,...n}){return(0,t.jsx)("div",{"data-slot":"card",className:(0,r.f)("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...n})},"O",0,function({className:e,...n}){return(0,t.jsx)("div",{"data-slot":"card-content",className:(0,r.f)("px-6",e),...n})},"u",0,function({className:e,...n}){return(0,t.jsx)("div",{"data-slot":"card-description",className:(0,r.f)("text-muted-foreground text-sm",e),...n})},"Y",0,function({className:e,...n}){return(0,t.jsx)("div",{"data-slot":"card-header",className:(0,r.f)("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",e),...n})},"v",0,function({className:e,...n}){return(0,t.jsx)("div",{"data-slot":"card-title",className:(0,r.f)("leading-none font-semibold",e),...n})}])},776639,e=>{var t=e.i(843476),r=e.i(271645),n=e.i(981140),o=e.i(820783),i=e.i(30030),a=e.i(610772),s=e.i(369340),l=e.i(726330),u=e.i(765491),c=e.i(774606),f=e.i(296626),d=e.i(248425),p=e.i(303536),m=e.i(934620),g=e.i(985369),h=e.i(186312),v=e.i(991918),y=Object.defineProperty,b=(e,t)=>y(e,"name",{value:t,configurable:!0}),w="Dialog",[x,E]=(0,i.f)(w),[S,j]=x(w),C=b(e=>{let{__scopeDialog:n,children:o,open:i,defaultOpen:l,onOpenChange:c,modal:f=!0}=e,d=r.useRef(null),p=r.useRef(null),{nodes:m,registry:g}=(0,u.D)(),[h,v]=(0,s.f)({prop:i,defaultProp:l??!1,onChange:c,caller:w}),[y,b]=r.useState(0),[x,E]=r.useState(0);return(0,t.jsx)(S,{scope:n,triggerRef:d,contentRef:p,contentId:(0,a.f)(),titleId:(0,a.f)(),descriptionId:(0,a.f)(),titlePresent:y>0,descriptionPresent:x>0,setTitleCount:b,setDescriptionCount:E,open:h,onOpenChange:v,onOpenToggle:r.useCallback(()=>v(e=>!e),[v]),modal:f,branchNodes:m,branchRegistry:g,children:o})},"Dialog"),N=r.forwardRef(b(function(e,r){let{__scopeDialog:i,...a}=e,s=j("DialogTrigger",i),l=(0,o.f)(r,s.triggerRef);return(0,t.jsx)(d.V.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":W(s.open),...a,ref:l,onClick:(0,n.f)(e.onClick,s.onOpenToggle)})},"DialogTrigger")),P="DialogPortal",[O,R]=x(P,{forceMount:void 0}),D=b(e=>{let{__scopeDialog:n,forceMount:o,children:i,container:a}=e,s=j(P,n);return(0,t.jsx)(O,{scope:n,forceMount:o,children:r.Children.map(i,e=>(0,t.jsx)(f.f,{present:o||s.open,children:(0,t.jsx)(c.f,{asChild:!0,container:a,children:e})}))})},"DialogPortal"),T="DialogOverlay",M=r.forwardRef(b(function(e,r){let n=R(T,e.__scopeDialog),{forceMount:o=n.forceMount,...i}=e,a=j(T,e.__scopeDialog);return a.modal?(0,t.jsx)(f.f,{present:o||a.open,children:(0,t.jsx)(A,{...i,ref:r})}):null},"DialogOverlay")),k=(0,v.B)("DialogOverlay.RemoveScroll"),A=r.forwardRef(b(function(e,n){let{__scopeDialog:i,...a}=e,s=j(T,i),u=(0,l.y)(),c=(0,o.f)(n,u);return(0,t.jsx)(g.f,{as:k,allowPinchZoom:!0,shards:r.useMemo(()=>[s.contentRef,...s.branchNodes.map(e=>({current:e}))],[s.contentRef,s.branchNodes]),children:(0,t.jsx)(d.V.div,{"data-state":W(s.open),...a,ref:c,style:{pointerEvents:"auto",...a.style}})})},"DialogOverlayImpl")),_="DialogContent",I=r.forwardRef(b(function(e,r){let n=R(_,e.__scopeDialog),{forceMount:o=n.forceMount,...i}=e,a=j(_,e.__scopeDialog);return(0,t.jsx)(f.f,{present:o||a.open,children:a.modal?(0,t.jsx)(L,{...i,ref:r}):(0,t.jsx)($,{...i,ref:r})})},"DialogContent")),L=r.forwardRef(b(function(e,i){let a=j(_,e.__scopeDialog),s=r.useRef(null),l=(0,o.f)(i,a.contentRef,s);return r.useEffect(()=>{let e=s.current;if(e)return(0,h.f)(e)},[]),(0,t.jsx)(z,{...e,ref:l,trapFocus:a.open,disableOutsidePointerEvents:a.open,onCloseAutoFocus:(0,n.f)(e.onCloseAutoFocus,e=>{e.preventDefault(),a.triggerRef.current?.focus()}),onPointerDownOutside:(0,n.f)(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey;(2===t.button||r)&&e.preventDefault()}),onFocusOutside:(0,n.f)(e.onFocusOutside,e=>e.preventDefault())})},"DialogContentModal")),$=r.forwardRef(b(function(e,n){let o=j(_,e.__scopeDialog),i=r.useRef(!1),a=r.useRef(!1);return(0,t.jsx)(z,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(i.current||o.triggerRef.current?.focus(),t.preventDefault()),i.current=!1,a.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(i.current=!0,"pointerdown"===t.detail.originalEvent.type&&(a.current=!0));let r=t.target;o.triggerRef.current?.contains(r)&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&a.current&&t.preventDefault()}})},"DialogContentNonModal")),z=r.forwardRef(b(function(e,r){let{__scopeDialog:n,trapFocus:o,onOpenAutoFocus:i,onCloseAutoFocus:a,"aria-describedby":s,children:c,...f}=e,d=j(_,n);return(0,p.f)(),(0,t.jsx)(u.l,{registry:d.branchRegistry,children:(0,t.jsx)(u.v,{asChild:!0,loop:!0,trapped:o,branches:d.branchNodes,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,t.jsx)(l.V,{role:"dialog",id:d.contentId,"aria-labelledby":d.titlePresent?d.titleId:void 0,"aria-describedby":d.descriptionPresent?B(s,d.descriptionId):s,"data-state":W(d.open),...f,ref:r,deferPointerDownOutside:!0,onDismiss:()=>d.onOpenChange(!1),children:c})})})},"DialogContentImpl")),F=r.forwardRef(b(function(e,r){let{__scopeDialog:n,...o}=e,i=j("DialogTitle",n),{setTitleCount:a}=i;return(0,m.f)(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,t.jsx)(d.V.h2,{id:i.titleId,...o,ref:r})},"DialogTitle")),U=r.forwardRef(b(function(e,r){let{__scopeDialog:n,...o}=e,i=j("DialogDescription",n),{setDescriptionCount:a}=i;return(0,m.f)(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,t.jsx)(d.V.p,{id:i.descriptionId,...o,ref:r})},"DialogDescription")),V=r.forwardRef(b(function(e,r){let{__scopeDialog:o,...i}=e,a=j("DialogClose",o);return(0,t.jsx)(d.V.button,{type:"button",...i,ref:r,onClick:(0,n.f)(e.onClick,()=>a.onOpenChange(!1))})},"DialogClose"));function B(...e){let t=new Set;for(let r of e)if("string"==typeof r)for(let e of String(r).trim().split(/\s+/))e&&t.add(e);return t.size>0?Array.from(t).join(" "):void 0}function W(e){return e?"open":"closed"}b(B,"concatAriaDescribedby"),b(W,"getState");var q=e.i(263676),J=e.i(975157);let K=r.forwardRef(({className:e,...r},n)=>(0,t.jsx)(M,{ref:n,className:(0,J.f)("fixed inset-0 z-50 bg-black/50 backdrop-blur-[2px] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...r}));K.displayName=M.displayName;let H=r.forwardRef(({className:e,children:r,...n},o)=>(0,t.jsxs)(D,{children:[(0,t.jsx)(K,{}),(0,t.jsxs)(I,{ref:o,onPointerDownOutside:e=>{e.preventDefault()},className:(0,J.f)("fixed left-[50%] top-[50%] z-50 grid w-[calc(100%-2rem)] max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 rounded-2xl border bg-card p-6 shadow-xl duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",e),...n,children:[r,(0,t.jsxs)(V,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[(0,t.jsx)(q.X,{className:"h-4 w-4"}),(0,t.jsx)("span",{className:"sr-only",children:"Close"})]})]})]}));H.displayName=I.displayName;let G=({className:e,...r})=>(0,t.jsx)("div",{className:(0,J.f)("flex flex-col space-y-1.5 text-center sm:text-left",e),...r});G.displayName="DialogHeader";let X=({className:e,...r})=>(0,t.jsx)("div",{className:(0,J.f)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...r});X.displayName="DialogFooter";let Z=r.forwardRef(({className:e,...r},n)=>(0,t.jsx)(F,{ref:n,className:(0,J.f)("text-lg font-semibold leading-none tracking-tight",e),...r}));Z.displayName=F.displayName;let Y=r.forwardRef(({className:e,...r},n)=>(0,t.jsx)(U,{ref:n,className:(0,J.f)("text-sm text-muted-foreground",e),...r}));Y.displayName=U.displayName,e.s(["N",0,C,"d",0,H,"C",0,Y,"c",0,X,"s",0,G,"F",0,Z,"a",0,N],776639)},793479,e=>{var t=e.i(843476),r=e.i(975157);e.s(["f",0,function({className:e,type:n,...o}){return(0,t.jsx)("input",{type:n,"data-slot":"input",className:(0,r.f)("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...o})}])},110204,e=>{var t=e.i(843476),r=e.i(271645),n=e.i(248425),o=Object.defineProperty,i=r.forwardRef(o(function(e,r){return(0,t.jsx)(n.V.label,{...e,ref:r,onMouseDown:t=>{t.target.closest("button, input, select, textarea")||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}})},"name",{value:"Label",configurable:!0})),a=e.i(975157);e.s(["f",0,function({className:e,...r}){return(0,t.jsx)(i,{"data-slot":"label",className:(0,a.f)("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...r})}],110204)},624687,e=>{var t=e.i(843476),r=e.i(975157);e.s(["f",0,function({className:e,...n}){return(0,t.jsx)("textarea",{"data-slot":"textarea",className:(0,r.f)("border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),...n})}])},215519,e=>{var t=e.i(843476),r=e.i(271645),n=e.i(306831);let o=(0,r.createContext)({timeZone:n.J,setTimeZone:()=>void 0});e.s(["n",0,function({children:e,initialTimeZone:i=n.J}){let[a,s]=(0,r.useState)(i);return(0,t.jsx)(o.Provider,{value:{timeZone:a,setTimeZone:s},children:e})},"M",0,function(){return(0,r.useContext)(o)}])},41931,294114,e=>{let t={success:2500,info:3500,warning:4500,error:5e3},r={toasts:[],confirm:null},n=1,o=new Set;function i(e){r=e,o.forEach(e=>e(r))}function a(e){i({...r,toasts:r.toasts.filter(t=>t.id!==e)})}function s(e,o){let s="string"==typeof o?o:String(o??"");if(!s)return;let l=n++;i({...r,toasts:[...r.toasts.slice(-3),{id:l,type:e,message:s}]}),setTimeout(()=>a(l),t[e])}let l={success:e=>s("success",e),error:e=>s("error",e),info:e=>s("info",e),warning:e=>s("warning",e)};e.s(["u",0,function(e,t={}){return 0===o.size?Promise.resolve("function"==typeof window.confirm&&window.confirm(e)):(r.confirm?.resolve(!1),new Promise(o=>{let a=n++;i({...r,confirm:{...t,id:a,message:e,resolve:e=>{r.confirm?.id===a&&i({...r,confirm:null}),o(e)}}})}))},"p",0,a,"M",0,function(e){return o.add(e),e(r),()=>{o.delete(e)}},"c",0,l],294114);var u=e.i(869253);class c extends Error{status;statusText;data;constructor(e,t,r){super(`API Error: ${e} ${t}`),this.status=e,this.statusText=t,this.data=r,this.name="ApiError"}}function f(e){if("object"!=typeof e||null===e||!("code"in e)||"AI_DAILY_LIMIT_EXCEEDED"!==e.code)return;let t="zh";try{"en"===localStorage.getItem("app-language")&&(t="en")}catch{}l.warning(u.f[t].errors.AI_DAILY_LIMIT_EXCEEDED)}let d=e=>new Promise(t=>setTimeout(t,e));async function p(e,t,r){let n=Date.now();for(;Date.now()<t;){let t=null;try{t=await m(`/api/requests/${e}`,{method:"GET",timeout:15e3})}catch(e){if(e instanceof c&&404===e.status&&Date.now()-n>6e3)throw r}if(t?.state==="done"){if(t.status>=200&&t.status<300)return t.body??{};throw 429===t.status&&f(t.body),new c(t.status,"",t.body)}await d(3e3)}throw new c(408,"Request Timeout",{message:"AI_TIMEOUT_ERROR"})}async function m(e,t={}){let r,{params:n,headers:o,timeout:i=6e4,recoverable:a,...s}=t,l=a?(r=new Uint8Array(16),crypto.getRandomValues(r),Array.from(r,e=>e.toString(16).padStart(2,"0")).join("")):null,u=Date.now(),d=e;if(n){let e=new URLSearchParams(n);d+=`?${e.toString()}`}let g=new AbortController,h=setTimeout(()=>g.abort(),i);try{let e=await fetch(d,{headers:{"Content-Type":"application/json",...l?{"X-Request-Id":l}:{},...o},signal:g.signal,...s});if(clearTimeout(h),!e.ok){let t;try{t=await e.json()}catch{t=await e.text()}throw 429===e.status&&f(t),new c(e.status,e.statusText,t)}if(204===e.status)return{};try{return await e.json()}catch{return{}}}catch(e){if(clearTimeout(h),e instanceof Error&&"AbortError"===e.name)throw new c(408,"Request Timeout",{message:"AI_TIMEOUT_ERROR"});if(l&&e instanceof TypeError)return p(l,u+i,e);throw e}}e.s(["a",0,c,"k",0,{get:(e,t)=>m(e,{...t,method:"GET"}),post:(e,t,r)=>m(e,{...r,method:"POST",body:JSON.stringify(t)}),put:(e,t,r)=>m(e,{...r,method:"PUT",body:JSON.stringify(t)}),patch:(e,t,r)=>m(e,{...r,method:"PATCH",body:JSON.stringify(t)}),delete:(e,t)=>m(e,{...t,method:"DELETE"})}],41931)},303163,e=>{e.s(["L",0,function(e){if("object"!=typeof e||null===e||!("data"in e))return;let{data:t}=e;if("object"==typeof t&&null!==t&&"details"in t)return"string"==typeof t.details&&t.details?t.details:void 0},"d",0,function(e){if("object"!=typeof e||null===e||!("data"in e))return;let{data:t}=e;if("object"==typeof t&&null!==t&&"message"in t)return"string"==typeof t.message?t.message:void 0},"Z",0,function(e){return e instanceof Error?e.message:String(e)}])},113381,e=>{var t=e.i(303163);let r=["Line","Segment","Ray","Point","Circle","Ellipse","Hyperbola","Parabola","Polygon","Intersect","Midpoint","PerpendicularLine","Angle","Text","Slider","Locus","Reflect","Translate","Rotate","Vector","UnitVector","OrthogonalVector","Distance","Length","Area","Tangent","Arc","CircularArc","Semicircle","Sequence","Element","If","Sum","Integral","Derivative","Root","Extremum","sin","cos","tan","asin","acos","atan","sqrt","abs","exp","ln","log","floor","ceil","round","min","max"],n=["setCoordSystem","setAxesVisible","setGridVisible","setColor","setLineThickness","setLineStyle","setPointSize","setPointStyle","setLabelVisible","setCaption","setVisible","setFilling","setValue","setFixed","setBackgroundColor"],o=new Map(n.map(e=>[e.toLowerCase(),e])),i=new Set(r.map(e=>e.toLowerCase())),a=/(?:java|vb)script\s*:|[\u0000-\u0008\u000b\u000c\u000e-\u001f]/i;function s(e){if(a.test(e)||/<\s*\/?\s*(?:script|iframe|img|svg|object|embed|html)\b/i.test(e))return!0;for(let t of e.matchAll(/"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'/g))try{let e=u(t[0]);if("string"==typeof e&&(/<\s*\/?\s*[a-z!][^>]*>/i.test(e)||a.test(e)))return!0;if(t[0].startsWith('"'))try{let e=JSON.parse(t[0]);if("string"==typeof e&&(/<\s*\/?\s*[a-z!][^>]*>/i.test(e)||/(?:java|vb)script\s*:/i.test(e)))return!0}catch{}}catch{return!0}return!1}function l(e){if(!e.trim())return[];let t=[],r="",n=!1,o=0,i=0;for(let a=0;a<e.length;a++){let s=e[a];if(r)n?n=!1:"\\"===s?n=!0:s===r&&(r="");else if('"'===s||"'"===s)r=s;else if("["===s)o++;else if("]"===s){if(--o<0)throw Error("参数括号不匹配")}else","===s&&0===o&&(t.push(e.slice(i,a).trim()),i=a+1)}if(r||o||n)throw Error("参数未闭合");return t.push(e.slice(i).trim()),t}function u(e){if(/^[+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?$/i.test(e)){let t=Number(e);if(Number.isFinite(t))return t}if("true"===e||"false"===e)return"true"===e;if(e.startsWith("[")&&e.endsWith("]"))return l(e.slice(1,-1)).map(u);let t=e[0];if(('"'===t||"'"===t)&&e.endsWith(t)){let r=e.slice(1,-1),n="";for(let e=0;e<r.length;e++){if(r[e]===t)throw Error("字符串包含未转义引号");if("\\"!==r[e])n+=r[e];else{let o=r[++e];if(void 0===o)throw Error("字符串转义未闭合");n+="\\"===o||o===t?o:"\\"+o}}return n}if(/^[\p{L}_][\p{L}\p{N}_]*$/u.test(e))return e;throw Error("API 参数必须是字面值")}e.s(["r",0,n,"I",0,r,"i",0,function(e){if(!e?.trim())return[];let t=e.trim();if(t.startsWith("["))try{let e=JSON.parse(t);if(Array.isArray(e))return e.filter(e=>"string"==typeof e&&!!e.trim())}catch{}return t.split("\n").map(e=>e.trim()).filter(e=>e&&!e.startsWith("//"))},"L",0,function(e,r){let n=[],a=new Set;for(let c of r)try{if(s(c))throw Error("命令包含不允许的脚本或标记");if(function(e){let t=e.trim().match(/^(\w+)\s*\(/)?.[1].toLowerCase();return!!t&&o.has(t)}(c)){let t=function(e){let t=e.trim().match(/^(\w+)\s*\(([\s\S]*)\)$/);if(!t)return null;let r=o.get(t[1].toLowerCase());if(!r)return null;try{let e=l(t[2]).map(u);return{m:r,a:e}}catch{return null}}(c),r=t?e[t.m]:void 0;if(!t||"function"!=typeof r)throw Error("API 方法或参数无效");r.apply(e,t.a)}else{if(!function(e,t=new Set){if(!e.trim()||s(e)||/[;`\r\n]/.test(e))return!1;let r=e.replace(/"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'/g,"");if(/["']/.test(r)||/(?:https?:|\b(?:ggbApplet|window|document)\b)/i.test(r)||/\b(?:Execute|RunClickScript|RunUpdateScript|JavaScript|eval|Function|Open|PlaySound|ReadText)\b/i.test(r))return!1;let n=r.match(/^\s*([\p{L}_][\p{L}\p{N}_]*)\s*\([^)]*\)\s*=/u)?.[1];for(let e of r.matchAll(/([\p{L}_][\p{L}\p{N}_]*)\s*[(\[]/gu)){let r=e[1];if(!i.has(r.toLowerCase())&&r!==n&&!t.has(r))return!1}return!0}(c,a))throw Error("指令不在允许范围内");if(!e.evalCommand(c.trim()))throw Error("GeoGebra 未能执行该命令");let t=c.match(/^\s*([\p{L}_][\p{L}\p{N}_]*)\s*\([^)]*\)\s*=/u)?.[1];t&&a.add(t)}}catch(e){n.push({command:c,message:(0,t.Z)(e)})}return n}])},664030,e=>{var t=e.i(271645),r=e.i(41931),n=e.i(201276);let o=null,i=0,a=new Set;e.s(["f",0,function(){let[e,s]=(0,t.useState)(o??[]),[l,u]=(0,t.useState)(!o),[c,f]=(0,t.useState)(null),d=(0,t.useCallback)(async(e=!1)=>{let t=Date.now();if(!e&&o&&t-i<3e4){s(o),u(!1);return}try{u(!0);let e=await r.k.get("/api/paper-groups");o=e,i=t,a.forEach(t=>t(e)),f(null)}catch(e){n.V.error("[usePaperGroups]","Failed to fetch paper groups",{error:e}),f("Failed to load paper groups")}finally{u(!1)}},[]);return(0,t.useEffect)(()=>(a.add(s),d(),()=>{a.delete(s)}),[d]),{groups:e,loading:l,error:c,refetch:(0,t.useCallback)(()=>(o=null,i=0,d(!0)),[d])}}])}])})();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(()=>{"use strict";(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,711241,e=>{var t=e.i(456420);let a={name:"arrow-left",size:24,node:[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]};a.node;let s=(0,t.f)(a);e.s(["f",0,s],711241)},856522,e=>{var t=e.i(456420);let a={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"}]]};a.node;let s=(0,t.f)(a);e.s(["f",0,s],856522)},328623,e=>{var t=e.i(456420);let a={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"]};a.node;let s=(0,t.f)(a);e.s(["f",0,s],328623)},813572,e=>{var t=e.i(843476),a=e.i(271645),s=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),u=e.i(717448),d=e.i(798469),m=e.i(393842),f=e.i(956738),p=e.i(185592),g=e.i(111110),h=e.i(41931),x=e.i(201276),b=e.i(35209),y=e.i(267275);e.s(["default",0,function(){let e=(0,s.useParams)(),v=(0,s.useRouter)(),j=e.id,{t:k}=(0,g.b)(),[w,N]=(0,a.useState)(null);(0,b.f)(k.notebooks.title,w?.name,k.pageTitle.addError);let[C,S]=(0,a.useState)("image"),I=(0,y.f)({logPrefix:"[AddErrorItem]",analyzeSubjectId:j,importSubjectId:j,textNotebook:{id:j,name:w?.name||""},fixedSubjectId:j});return((0,a.useEffect)(()=>{h.k.get(`/api/notebooks/${j}`).then(e=>N(e)).catch(e=>{x.V.error("[AddErrorItem]","Failed to fetch notebook",{error:e}),v.push("/notebooks")})},[j,v]),w)?(0,t.jsxs)("main",{className:"min-h-screen",children:[(0,t.jsx)(f.f,{status:I.analysisStep}),(0,t.jsxs)("div",{className:`mx-auto space-y-6 px-4 py-6 md:px-8 md:py-8 ${"review"===I.step?"max-w-6xl":"max-w-4xl"}`,children:[(0,t.jsx)(m.f,{backHref:`/notebooks/${j}`,title:k.app.addError,description:w.name}),"upload"===I.step&&(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)(p.f,{options:[{value:"image",icon:i.f,label:k.app?.uploadImage||"Take Photo"},{value:"text",icon:n.f,label:k.app?.manualInput||"Manual Input"}],value:C,onChange:S}),I.lastImported&&(0,t.jsx)(c.f,{imported:I.lastImported,onDismiss:I.dismissImported}),I.batchBlobs?(0,t.jsx)(l.f,{blobs:I.batchBlobs,subjectId:j,timeout:I.aiTimeout,onClose:I.closeBatch}):"image"===C?(0,t.jsx)(d.f,{onImageSelect:I.selectImage,isAnalyzing:I.isBusy}):(0,t.jsx)(u.f,{onSubmit:I.submitText,isAnalyzing:I.isBusy,defaultNotebookName:w.name})]}),"review"===I.step&&I.parsedData&&(0,t.jsx)(r.f,{initialData:I.parsedData,imagePreview:I.currentImage,onSave:I.saveReviewed,onCancel:I.cancelReview,initialSubjectId:j,aiTimeout:I.aiTimeout})]}),(0,t.jsx)(o.f,{imageSrc:I.croppingImage||"",open:I.isCropperOpen,onClose:I.closeCropper,onCropComplete:I.cropComplete,onMultiCropComplete:I.startBatch})]}):(0,t.jsx)("div",{className:"min-h-screen flex items-center justify-center",children:(0,t.jsx)("p",{className:"text-muted-foreground",children:k.common.loading})})}])},469937,62825,e=>{var t=e.i(843476),a=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 i=(0,a.f)(s);var n=e.i(111110),l=e.i(975157);let r=[1,2,3,4,5];function o(e){return"not_attempted"===e||"wrong_attempt"===e||"unknown"===e?e:"unknown"}e.s(["f",0,function({value:e,onChange:a,disabled:s,size:o="sm",showUnrated:c=!0,className:u}){let{t:d}=(0,n.b)(),m=e??0,f="sm"===o?"h-3.5 w-3.5":"h-5 w-5",p=m?d.difficulty.starsLabel.replace("{n}",String(m)):d.difficulty.unrated;return a?(0,t.jsxs)("span",{className:(0,l.f)("inline-flex items-center gap-0.5",u),role:"group","aria-label":`${d.difficulty.label}${d.common.colon}${p}`,title:d.difficulty.clearHint,children:[r.map(e=>(0,t.jsx)("button",{type:"button",disabled:s,onClick:()=>a(e===m?null:e),"aria-label":d.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)(i,{className:(0,l.f)(f,e<=m?"fill-amber-400 text-amber-400":"text-muted-foreground/40")})},e)),!m&&c&&(0,t.jsx)("span",{className:"ml-1 text-xs text-muted-foreground",children:d.difficulty.unrated})]}):m?(0,t.jsx)("span",{className:(0,l.f)("inline-flex items-center",u),role:"img","aria-label":`${d.difficulty.label}${d.common.colon}${p}`,title:p,children:r.map(e=>(0,t.jsx)(i,{className:(0,l.f)(f,e<=m?"fill-amber-400 text-amber-400":"text-muted-foreground/30"),"aria-hidden":!0},e))}):c?(0,t.jsx)("span",{className:(0,l.f)("text-xs text-muted-foreground",u),children:d.difficulty.unrated}):null}],469937),e.s(["i",0,function(e,t="zh"){return("en"===t?{not_attempted:"Not attempted",wrong_attempt:"Wrong attempt",unknown:"Unknown"}:{not_attempted:"不会做",wrong_attempt:"做错了",unknown:"未判断"})[o(e)]},"h",0,o,"x",0,function(e,t){return(t||"").trim()?"wrong_attempt":o(e)}],62825)},149704,e=>{var t=e.i(843476),a=e.i(111110),s=e.i(398019),i=e.i(184110),n=e.i(975157);let l={left:"mr-auto",center:"mx-auto",right:"ml-auto"};e.s(["f",0,function({svg:e,scale:r,align:o,className:c}){let{t:u}=(0,a.b)();if(!e)return null;let d=(0,i.V)(r),m=(0,i.o)(o);return(0,t.jsx)("figure",{className:(0,n.f)("question-figure my-3",c),children:(0,t.jsx)("img",{src:(0,s.f)(e),alt:u.figure.alt,className:(0,n.f)(l[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:d/100,maxWidth:`${Math.min(d,100)}%`}})})}])},574041,e=>{var t=e.i(843476),a=e.i(271645),s=e.i(263676),i=e.i(487486),n=e.i(793479),l=e.i(41931),r=e.i(201276);e.s(["f",0,function({value:e=[],onChange:o,placeholder:c="Enter tags...",className:u="",enterHint:d,subject:m,gradeStage:f}){let[p,g]=(0,a.useState)(""),[h,x]=(0,a.useState)([]),[b,y]=(0,a.useState)(!1),[v,j]=(0,a.useState)(0),k=(0,a.useRef)(null),w=(0,a.useRef)(null),N=(0,a.useCallback)(async t=>{try{let a=new URLSearchParams({q:t});m&&a.append("subject",m),f&&a.append("stage",f);let s=((await l.k.get(`/api/tags/suggestions?${a.toString()}`)).suggestions||[]).filter(t=>!e.includes(t));x(s.slice(0,20)),y(s.length>0),j(0)}catch(e){r.V.error("[TagInput]","Failed to fetch suggestions",{error:e})}},[m,f,e]);(0,a.useEffect)(()=>{p.trim()&&N(p)},[p,N]);let C=t=>{t.trim()&&!e.includes(t.trim())&&(o([...e,t.trim()]),g(""),x([]),y(!1),j(0))},S=t=>{o(e.filter(e=>e!==t))};return(0,a.useEffect)(()=>{let e=e=>{!w.current||w.current.contains(e.target)||k.current?.contains(e.target)||y(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),(0,t.jsxs)("div",{className:`relative ${u}`,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)(i.f,{variant:"secondary",className:"flex items-center gap-1 px-2 py-1",children:[e,(0,t.jsx)("button",{type:"button",onClick:()=>S(e),className:"hover:text-destructive ml-1",children:(0,t.jsx)(s.X,{className:"h-3 w-3"})})]},e)),(0,t.jsx)(n.f,{ref:k,type:"text",value:p,onChange:e=>{g(e.target.value),e.target.value.trim()||(x([]),y(!1))},onKeyDown:t=>{"Enter"===t.key?(t.preventDefault(),v>=0&&h[v]?C(h[v]):p.trim()&&C(p)):"ArrowDown"===t.key?(t.preventDefault(),j(e=>Math.min(e+1,h.length-1))):"ArrowUp"===t.key?(t.preventDefault(),j(e=>Math.max(e-1,0))):"Escape"===t.key?(y(!1),j(0)):"Backspace"===t.key&&!p&&e.length>0&&S(e[e.length-1])},onFocus:()=>{h.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"})]}),b&&h.length>0&&(0,t.jsx)("div",{ref:w,className:"absolute z-50 w-full mt-1 bg-popover border rounded-md shadow-md max-h-48 overflow-y-auto",children:h.map((e,a)=>(0,t.jsx)("div",{className:`px-3 py-2 cursor-pointer hover:bg-accent ${a===v?"bg-accent":""}`,onClick:()=>C(e),onMouseEnter:()=>j(a),children:e},e))}),p&&!b&&(0,t.jsx)("div",{className:"text-xs text-muted-foreground mt-1",children:d?`${d} "${p}"`:`Press Enter to create "${p}"`})]})}])},590546,e=>{var t=e.i(843476),a=e.i(618566),s=e.i(519455),i=e.i(711241);e.s(["f",0,function({fallbackUrl:e,className:n}){let l=(0,a.useRouter)();return(0,t.jsx)(s.f,{variant:"ghost",size:"icon",onClick:()=>{l.push(e)},className:n,children:(0,t.jsx)(i.f,{className:"h-5 w-5"})})}])},393842,e=>{var t=e.i(843476),a=e.i(590546),s=e.i(975157);e.s(["f",0,function({title:e,description:i,backHref:n,actions:l,titleAddon:r,className:o}){return(0,t.jsxs)("div",{className:(0,s.f)("flex items-start gap-3",o),children:[n&&(0,t.jsx)(a.f,{fallbackUrl:n,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}),r]}),i&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground sm:text-base",children:i})]}),l&&(0,t.jsx)("div",{className:"flex shrink-0 items-center gap-2",children:l})]})}])},184110,e=>{let t=["left","center","right"],a="center";function s(e){return"number"==typeof e&&Number.isInteger(e)&&e>=10&&e<=200}e.s(["E",0,a,"n",0,100,"j",0,t,"a",0,200,"_",0,10,"x",0,s,"o",0,function(e){return"string"==typeof e&&t.includes(e)?e:a},"V",0,function(e){return s(e)?e:100}])},398019,e=>{e.s(["f",0,function(e){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`}])},952122,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}])},35209,e=>{var t=e.i(271645),a=e.i(111110);e.s(["f",0,function(...e){let{t:s}=(0,a.b)(),i=[s.pageTitle.base,...e.map(e=>"string"==typeof e?e.trim():"").filter(e=>e.length>0)].join("-");(0,t.useEffect)(()=>{document.title=i},[i])}])}])})();
|