wrong-notebook 2026.11.3-2 → 2026.11.3
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.nft.json +1 -1
- package/.next/server/app/api/exams/[id]/questions/[questionId]/regenerate/route.js.nft.json +1 -1
- package/.next/server/app/api/exams/[id]/results/route.js.nft.json +1 -1
- package/.next/server/app/api/exams/[id]/retry/route.js.nft.json +1 -1
- package/.next/server/app/api/exams/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/exams/route.js.nft.json +1 -1
- package/.next/server/app/api/geogebra-analyze/route.js.nft.json +1 -1
- package/.next/server/app/api/import/route.js.nft.json +1 -1
- package/.next/server/app/api/import-batches/[id]/confirm-all/route.js.nft.json +1 -1
- package/.next/server/app/api/import-batches/[id]/fix-text/route.js.nft.json +1 -1
- package/.next/server/app/api/import-batches/[id]/read/route.js.nft.json +1 -1
- package/.next/server/app/api/import-batches/[id]/retry/route.js.nft.json +1 -1
- package/.next/server/app/api/import-batches/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/import-batches/[id]/start/route.js.nft.json +1 -1
- package/.next/server/app/api/import-batches/route.js.nft.json +1 -1
- package/.next/server/app/api/import-tasks/[id]/confirm/route.js.nft.json +1 -1
- package/.next/server/app/api/import-tasks/[id]/read/route.js.nft.json +1 -1
- package/.next/server/app/api/import-tasks/[id]/retry/route.js.nft.json +1 -1
- package/.next/server/app/api/import-tasks/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/import-tasks/route.js.nft.json +1 -1
- package/.next/server/app/api/notebooks/[id]/retag/route.js.nft.json +1 -1
- package/.next/server/app/api/openclaw/batch-upload/route.js.nft.json +1 -1
- package/.next/server/app/api/practice/generate/route.js.nft.json +1 -1
- package/.next/server/app/api/reanswer/route.js.nft.json +1 -1
- package/.next/server/app/api/tasks/route.js.nft.json +1 -1
- package/.next/server/app/api/tts/batch/route.js.nft.json +1 -1
- package/.next/server/app/error-items/[id]/page.js.nft.json +1 -1
- package/.next/server/app/error-items/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/exams/[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/import-batches/[id]/page.js.nft.json +1 -1
- package/.next/server/app/import-batches/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/import-tasks/[id]/page.js.nft.json +1 -1
- package/.next/server/app/import-tasks/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/import-tasks/page.js.nft.json +1 -1
- package/.next/server/app/import-tasks/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/ssr/{[root-of-the-server]__1mrj6vygoasvv._.js → [root-of-the-server]__0q_1ml4ix5ftb._.js} +1 -1
- package/.next/server/chunks/ssr/{_0ks-0g-tu__3m._.js → _1j21wzv797ipf._.js} +1 -1
- package/.next/server/chunks/ssr/_1qgg_ll5hkjaf._.js +1 -1
- package/.next/server/chunks/ssr/_1ujx-n3muyaxs._.js +1 -1
- package/.next/server/chunks/ssr/_1ux6eqqkupo6v._.js +1 -1
- package/.next/server/chunks/ssr/{node_modules_0b0fwrqs9v-g1._.js → node_modules_1-mokx4fe30es._.js} +1 -1
- package/.next/server/chunks/ssr/src_app_import-batches_[id]_page_tsx_0mhg_vriwmkkw._.js +1 -1
- package/.next/server/chunks/ssr/src_app_notebooks_[id]_add_page_tsx_179tow1ql6vc_._.js +1 -1
- package/.next/server/chunks/ssr/src_app_page_tsx_1chiuahujsxm1._.js +1 -1
- package/.next/server/chunks/ssr/src_components_image-cropper_tsx_0pcp8-ifruyx-._.js +1 -1
- package/.next/server/chunks/ssr/src_lib_0-wirad5ziskp._.js +6 -0
- package/.next/server/chunks/ssr/src_lib_1vv0-aje_e-zh._.js +6 -0
- 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/{2467o8uezj--l.js → 0-hqh6zs3hidn.js} +5 -5
- package/.next/static/chunks/02xikk3wlibg1.js +1 -0
- package/.next/static/chunks/{289znh7431pug.js → 0455_qx26n4sc.js} +1 -1
- package/.next/static/chunks/0_0cdw71x2r9p.js +1 -0
- package/.next/static/chunks/0y5zywo-ll2w3.js +1 -0
- package/.next/static/chunks/1ppadg8s8wyf0.js +1 -0
- package/.next/static/chunks/1v3rj6mh3f3-l.js +1 -0
- package/.next/static/chunks/1ywx2_e5apnra.js +12 -0
- package/.next/static/chunks/25_80i03m2bsy.css +3 -0
- package/.next/static/chunks/2e4yhd7hvrn4n.js +1 -0
- package/.next/static/chunks/2qqyq-iqkv_oa.js +9 -0
- package/.next/static/chunks/{3wr-25ch-9chk.js → 3u2qw-orhi1q3.js} +1 -1
- package/package.json +1 -1
- package/prisma/seed.db +0 -0
- package/.next/server/chunks/ssr/src_lib_question-split_text_ts_0h4uz23xrlybm._.js +0 -6
- package/.next/static/chunks/0_ar7dth9hybc.js +0 -1
- package/.next/static/chunks/1d0ltu2dk4a0v.js +0 -1
- package/.next/static/chunks/1hwk1kmheoccm.js +0 -9
- package/.next/static/chunks/1qj8u6q02qbty.js +0 -1
- package/.next/static/chunks/1rvm9ttct-w2q.css +0 -3
- package/.next/static/chunks/2q9dw_3pa6om0.js +0 -12
- package/.next/static/chunks/344kc1rli8fy-.js +0 -1
- package/.next/static/chunks/3lsj4waqfw7eq.js +0 -1
- /package/.next/static/{vcaSyuwRLyplMa8bkQEcE → rhXQeIgvoLtutrDHSq6bR}/_buildManifest.js +0 -0
- /package/.next/static/{vcaSyuwRLyplMa8bkQEcE → rhXQeIgvoLtutrDHSq6bR}/_clientMiddlewareManifest.js +0 -0
- /package/.next/static/{vcaSyuwRLyplMa8bkQEcE → rhXQeIgvoLtutrDHSq6bR}/_ssgManifest.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{"use strict";(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,314381,3198,e=>{var t=e.i(456420);let r={name:"box",size:24,node:[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]};r.node;let n=(0,t.f)(r);e.s(["f",0,n],314381);var i=e.i(843476),a=e.i(271645),o=e.i(632781);let s={name:"maximize-2",size:24,node:[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]};s.node;let l=(0,t.f)(s),h={name:"minimize-2",size:24,node:[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]]};h.node;let c=(0,t.f)(h);var d=e.i(395925),u=e.i(741120),m=e.i(759659),g=e.i(519455),p=e.i(111110),f=e.i(294114),w=e.i(201276),x=e.i(113381);let y=null;function b(e,t,r){let n=e?.firstElementChild;n&&(n.style.width="100%",n.style.height=`${r}px`,t?.setSize(e?.offsetWidth||n.offsetWidth||800,r))}function v(e,t){let r=(0,x.L)(e,t);for(let e of r)w.V.warn("[GGB]","命令执行失败",{...e});return r.map(e=>e.command+":"+e.message).join("\n")||void 0}e.s(["f",0,function({commands:e,height:t=700,showToolBar:r=!1,showAlgebraInput:n=!1,showMenuBar:s=!1,className:h="",onRegenerate:C,onDelete:j}){let{t:k}=(0,p.b)(),D=(0,a.useRef)(null),M=(0,a.useRef)(null),E=(0,a.useRef)(void 0),N=(0,a.useId)(),R=(0,a.useRef)(`ggb-${N.replace(/[^a-zA-Z0-9_-]/g,"")}`),[S,L]=(0,a.useState)(!0),[I,_]=(0,a.useState)(null),[P,$]=(0,a.useState)(!0),[H,A]=(0,a.useState)(!1),[z,B]=(0,a.useState)(!1),Y=(0,a.useMemo)(()=>(0,x.i)(e),[e]);(0,a.useEffect)(()=>{if(0===Y.length)return;let e=!1,i=R.current,a=D.current;return(y||(y=new Promise((e,t)=>{if(window.GGBApplet)return void e();let r=document.createElement("script");r.src="https://www.geogebra.org/apps/deployggb.js",r.async=!0,r.onload=()=>e(),r.onerror=()=>{y=null,t(Error("Failed to load GeoGebra"))},document.head.appendChild(r)}))).then(()=>{if(e)return;let o=window.GGBApplet;if(!o){_(k.geogebra.notLoaded),L(!1);return}if(a){a.innerHTML=`<div id="${i}" style="width:100%;height:${t}px"></div>`;try{new o({appName:"classic",width:"100%",height:t,showToolBar:r,showAlgebraInput:n,showMenuBar:s,showResetIcon:!0,enableRightClick:!0,enableShiftDragZoom:!0,language:"zh",appletOnLoad:r=>{e||(M.current=r,b(a,r,t),E.current=v(r,Y),L(!1))}},!0).inject(i)}catch(t){w.V.error("[GGB]","Init failed",{error:t}),e||(_(k.geogebra.initFailed),L(!1))}}}).catch(t=>{w.V.error("[GGB]","Script load failed",{error:t}),e||(_(k.geogebra.scriptFailed),L(!1))}),()=>{e=!0;try{let e=M.current;e?.remove&&e.remove()}catch(e){w.V.warn("[GGB]","Cleanup failed",{error:e})}M.current=null,a&&(a.innerHTML="")}},[Y,r,n,s]),(0,a.useEffect)(()=>{b(D.current,M.current,P?700:t)},[P,t]);let X=(0,a.useCallback)(()=>{let e=M.current;if(e)try{e.resetConstruction(),setTimeout(()=>{M.current&&(E.current=v(M.current,Y))},300)}catch(e){w.V.warn("[GGB]","Reset failed",{error:e})}},[Y]),O=(0,a.useCallback)(async()=>{if(C&&!H){A(!0);try{await C(E.current)}finally{A(!1)}}},[C,H]),U=(0,a.useCallback)(async()=>{if(j&&!z&&await (0,f.u)(k.geogebra.confirmDelete,{destructive:!0})){B(!0);try{await j()}catch{f.c.error(k.geogebra.deleteFailed)}finally{B(!1)}}},[j,z,k]);return 0===Y.length?null:(0,i.jsxs)("div",{className:`relative rounded-lg border bg-card ${h}`,children:[(0,i.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 border-b bg-muted/30",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:k.geogebra.title}),S&&(0,i.jsx)(o.f,{className:"h-3 w-3 animate-spin text-muted-foreground"})]}),(0,i.jsxs)("div",{className:"flex items-center gap-1",children:[C&&(0,i.jsxs)(g.f,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs gap-1",onClick:O,title:k.geogebra.regenerate,disabled:H||S,children:[H?(0,i.jsx)(o.f,{className:"h-3.5 w-3.5 animate-spin"}):(0,i.jsx)(u.f,{className:"h-3.5 w-3.5"}),(0,i.jsx)("span",{children:k.geogebra.regenerate})]}),j&&(0,i.jsxs)(g.f,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs gap-1 text-destructive hover:text-destructive",onClick:U,title:k.geogebra.delete,disabled:z||H,children:[z?(0,i.jsx)(o.f,{className:"h-3.5 w-3.5 animate-spin"}):(0,i.jsx)(m.f,{className:"h-3.5 w-3.5"}),(0,i.jsx)("span",{children:k.geogebra.delete})]}),(0,i.jsx)(g.f,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:X,title:k.geogebra.reset,disabled:S,children:(0,i.jsx)(d.f,{className:"h-3.5 w-3.5"})}),(0,i.jsx)(g.f,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>$(e=>!e),title:P?k.geogebra.shrink:k.geogebra.enlarge,children:P?(0,i.jsx)(c,{className:"h-3.5 w-3.5"}):(0,i.jsx)(l,{className:"h-3.5 w-3.5"})})]})]}),(0,i.jsx)("div",{ref:D,style:{width:"100%"}}),S&&(0,i.jsx)("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-background/80 rounded-b-lg",style:{top:37},children:(0,i.jsxs)("div",{className:"flex flex-col items-center gap-2",children:[(0,i.jsx)(o.f,{className:"h-6 w-6 animate-spin text-primary"}),(0,i.jsx)("span",{className:"text-sm text-muted-foreground",children:k.geogebra.loading})]})}),I&&(0,i.jsx)("div",{className:"flex items-center justify-center text-sm text-destructive",style:{minHeight:t},children:I})]})}],3198)},856522,e=>{var t=e.i(456420);let r={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"}]]};r.node;let n=(0,t.f)(r);e.s(["f",0,n],856522)},328623,e=>{var t=e.i(456420);let r={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"]};r.node;let n=(0,t.f)(r);e.s(["f",0,n],328623)},232660,213761,e=>{var t=e.i(271645),r={x:0,y:0,width:0,height:0,unit:"px"},n=(e,t,r)=>Math.min(Math.max(e,t),r),i=(e,t)=>e===t||e.width===t.width&&e.height===t.height&&e.x===t.x&&e.y===t.y&&e.unit===t.unit;function a(e,t,n){return"%"===e.unit?{...r,...e,unit:"%"}:{unit:"%",x:e.x?e.x/t*100:0,y:e.y?e.y/n*100:0,width:e.width?e.width/t*100:0,height:e.height?e.height/n*100:0}}function o(e,t,n){return e.unit&&"px"!==e.unit?{unit:"px",x:e.x?e.x*t/100:0,y:e.y?e.y*n/100:0,width:e.width?e.width*t/100:0,height:e.height?e.height*n/100:0}:{...r,...e,unit:"px"}}function s(e,t,r,n,i,a=0,o=0,l=n,h=i){let c={...e},d=Math.min(a,n),u=Math.min(o,i),m=Math.min(l,n),g=Math.min(h,i);t&&(t>1?(u=(d=o?o*t:d)/t,m=l*t):(d=(u=a?a/t:u)*t,g=h/t)),c.y<0&&(c.height=Math.max(c.height+c.y,u),c.y=0),c.x<0&&(c.width=Math.max(c.width+c.x,d),c.x=0);let p=n-(c.x+c.width);p<0&&(c.x=Math.min(c.x,n-d),c.width+=p);let f=i-(c.y+c.height);if(f<0&&(c.y=Math.min(c.y,i-u),c.height+=f),c.width<d&&(("sw"===r||"nw"==r)&&(c.x-=d-c.width),c.width=d),c.height<u&&(("nw"===r||"ne"==r)&&(c.y-=u-c.height),c.height=u),c.width>m&&(("sw"===r||"nw"==r)&&(c.x-=m-c.width),c.width=m),c.height>g&&(("nw"===r||"ne"==r)&&(c.y-=g-c.height),c.height=g),t){let e=c.width/c.height;if(e<t){let e=Math.max(c.width/t,u);("nw"===r||"ne"==r)&&(c.y-=e-c.height),c.height=e}else if(e>t){let e=Math.max(c.height*t,d);("sw"===r||"nw"==r)&&(c.x-=e-c.width),c.width=e}}return c}var l={capture:!0,passive:!1},h=0,c=class e extends t.PureComponent{static xOrds=["e","w"];static yOrds=["n","s"];static xyOrds=["nw","ne","se","sw"];static nudgeStep=1;static nudgeStepMedium=10;static nudgeStepLarge=100;static defaultProps={ariaLabels:{cropArea:"Use the arrow keys to move the crop selection area",nwDragHandle:"Use the arrow keys to move the north west drag handle to change the crop selection area",nDragHandle:"Use the up and down arrow keys to move the north drag handle to change the crop selection area",neDragHandle:"Use the arrow keys to move the north east drag handle to change the crop selection area",eDragHandle:"Use the up and down arrow keys to move the east drag handle to change the crop selection area",seDragHandle:"Use the arrow keys to move the south east drag handle to change the crop selection area",sDragHandle:"Use the up and down arrow keys to move the south drag handle to change the crop selection area",swDragHandle:"Use the arrow keys to move the south west drag handle to change the crop selection area",wDragHandle:"Use the up and down arrow keys to move the west drag handle to change the crop selection area"}};get document(){return document}docMoveBound=!1;mouseDownOnCrop=!1;dragStarted=!1;evData={startClientX:0,startClientY:0,startCropX:0,startCropY:0,clientX:0,clientY:0,isResize:!0};componentRef=(0,t.createRef)();mediaRef=(0,t.createRef)();resizeObserver;initChangeCalled=!1;instanceId=`rc-${h++}`;state={cropIsActive:!1,newCropIsBeingDrawn:!1};getBox(){let e=this.mediaRef.current;if(!e)return{x:0,y:0,width:0,height:0};let{x:t,y:r,width:n,height:i}=e.getBoundingClientRect();return{x:t,y:r,width:n,height:i}}componentDidUpdate(e){let{crop:t,onComplete:r}=this.props;if(r&&!e.crop&&t){let{width:e,height:n}=this.getBox();e&&n&&r(o(t,e,n),a(t,e,n))}}componentWillUnmount(){this.resizeObserver&&this.resizeObserver.disconnect(),this.unbindDocMove()}bindDocMove(){this.docMoveBound||=(this.document.addEventListener("pointermove",this.onDocPointerMove,l),this.document.addEventListener("pointerup",this.onDocPointerDone,l),this.document.addEventListener("pointercancel",this.onDocPointerDone,l),!0)}unbindDocMove(){this.docMoveBound&&=(this.document.removeEventListener("pointermove",this.onDocPointerMove,l),this.document.removeEventListener("pointerup",this.onDocPointerDone,l),this.document.removeEventListener("pointercancel",this.onDocPointerDone,l),!1)}onCropPointerDown=e=>{let{crop:t,disabled:r}=this.props,n=this.getBox();if(!t)return;let i=o(t,n.width,n.height);if(r)return;e.cancelable&&e.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});let a=e.target.dataset.ord,s=e.clientX,l=e.clientY,h=i.x,c=i.y;if(a){let t=e.clientX-n.x,r=e.clientY-n.y,o=0,d=0;"ne"===a||"e"==a?(o=t-(i.x+i.width),d=r-i.y,h=i.x,c=i.y+i.height):"se"===a||"s"===a?(o=t-(i.x+i.width),d=r-(i.y+i.height),h=i.x,c=i.y):"sw"===a||"w"==a?(o=t-i.x,d=r-(i.y+i.height),h=i.x+i.width,c=i.y):("nw"===a||"n"==a)&&(o=t-i.x,d=r-i.y,h=i.x+i.width,c=i.y+i.height),s=h+n.x+o,l=c+n.y+d}this.evData={startClientX:s,startClientY:l,startCropX:h,startCropY:c,clientX:e.clientX,clientY:e.clientY,isResize:!!a,ord:a},this.mouseDownOnCrop=!0,this.setState({cropIsActive:!0})};onComponentPointerDown=e=>{let{crop:t,disabled:r,locked:n,keepSelection:i,onChange:s}=this.props,l=this.getBox();if(r||n||i&&t)return;e.cancelable&&e.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});let h=e.clientX-l.x,c=e.clientY-l.y,d={unit:"px",x:h,y:c,width:0,height:0};this.evData={startClientX:e.clientX,startClientY:e.clientY,startCropX:h,startCropY:c,clientX:e.clientX,clientY:e.clientY,isResize:!0},this.mouseDownOnCrop=!0,s(o(d,l.width,l.height),a(d,l.width,l.height)),this.setState({cropIsActive:!0,newCropIsBeingDrawn:!0})};onDocPointerMove=e=>{let t,{crop:r,disabled:n,onChange:s,onDragStart:l}=this.props,h=this.getBox();if(n||!r||!this.mouseDownOnCrop)return;e.cancelable&&e.preventDefault(),this.dragStarted||(this.dragStarted=!0,l&&l(e));let{evData:c}=this;c.clientX=e.clientX,c.clientY=e.clientY,i(r,t=c.isResize?this.resizeCrop():this.dragCrop())||s(o(t,h.width,h.height),a(t,h.width,h.height))};onComponentKeyDown=t=>{let{crop:r,disabled:i,onChange:s,onComplete:l}=this.props;if(i)return;let h=t.key,c=!1;if(!r)return;let d=this.getBox(),u=this.makePixelCrop(d),m=(navigator.platform.match("Mac")?t.metaKey:t.ctrlKey)?e.nudgeStepLarge:t.shiftKey?e.nudgeStepMedium:e.nudgeStep;if("ArrowLeft"===h?(u.x-=m,c=!0):"ArrowRight"===h?(u.x+=m,c=!0):"ArrowUp"===h?(u.y-=m,c=!0):"ArrowDown"===h&&(u.y+=m,c=!0),c){t.cancelable&&t.preventDefault(),u.x=n(u.x,0,d.width-u.width),u.y=n(u.y,0,d.height-u.height);let e=o(u,d.width,d.height),r=a(u,d.width,d.height);s(e,r),l&&l(e,r)}};onHandlerKeyDown=(t,r)=>{var n,l;let h,{aspect:c=0,crop:d,disabled:u,minWidth:m=0,minHeight:g=0,maxWidth:p,maxHeight:f,onChange:w,onComplete:x}=this.props,y=this.getBox();if(u||!d||"ArrowUp"!==t.key&&"ArrowDown"!==t.key&&"ArrowLeft"!==t.key&&"ArrowRight"!==t.key)return;t.stopPropagation(),t.preventDefault();let b=(navigator.platform.match("Mac")?t.metaKey:t.ctrlKey)?e.nudgeStepLarge:t.shiftKey?e.nudgeStepMedium:e.nudgeStep,v=s((n=o(d,y.width,y.height),l=t.key,h={...n},"ArrowLeft"===l?"nw"===r?(h.x-=b,h.y-=b,h.width+=b,h.height+=b):"w"===r?(h.x-=b,h.width+=b):"sw"===r?(h.x-=b,h.width+=b,h.height+=b):"ne"===r?(h.y+=b,h.width-=b,h.height-=b):"e"===r?h.width-=b:"se"===r&&(h.width-=b,h.height-=b):"ArrowRight"===l&&("nw"===r?(h.x+=b,h.y+=b,h.width-=b,h.height-=b):"w"===r?(h.x+=b,h.width-=b):"sw"===r?(h.x+=b,h.width-=b,h.height-=b):"ne"===r?(h.y-=b,h.width+=b,h.height+=b):"e"===r?h.width+=b:"se"===r&&(h.width+=b,h.height+=b)),"ArrowUp"===l?"nw"===r?(h.x-=b,h.y-=b,h.width+=b,h.height+=b):"n"===r?(h.y-=b,h.height+=b):"ne"===r?(h.y-=b,h.width+=b,h.height+=b):"sw"===r?(h.x+=b,h.width-=b,h.height-=b):"s"===r?h.height-=b:"se"===r&&(h.width-=b,h.height-=b):"ArrowDown"===l&&("nw"===r?(h.x+=b,h.y+=b,h.width-=b,h.height-=b):"n"===r?(h.y+=b,h.height-=b):"ne"===r?(h.y+=b,h.width-=b,h.height-=b):"sw"===r?(h.x-=b,h.width+=b,h.height+=b):"s"===r?h.height+=b:"se"===r&&(h.width+=b,h.height+=b)),h),c,r,y.width,y.height,m,g,p,f);if(!i(d,v)){let e=a(v,y.width,y.height);w(v,e),x&&x(v,e)}};onDocPointerDone=e=>{let{crop:t,disabled:r,onComplete:n,onDragEnd:i}=this.props,s=this.getBox();this.unbindDocMove(),!(r||!t)&&this.mouseDownOnCrop&&(this.mouseDownOnCrop=!1,this.dragStarted=!1,i&&i(e),n&&n(o(t,s.width,s.height),a(t,s.width,s.height)),this.setState({cropIsActive:!1,newCropIsBeingDrawn:!1}))};onDragFocus=()=>{this.componentRef.current?.scrollTo(0,0)};getCropStyle(){let{crop:e}=this.props;if(e)return{top:`${e.y}${e.unit}`,left:`${e.x}${e.unit}`,width:`${e.width}${e.unit}`,height:`${e.height}${e.unit}`}}dragCrop(){let{evData:e}=this,t=this.getBox(),r=this.makePixelCrop(t),i=e.clientX-e.startClientX,a=e.clientY-e.startClientY;return r.x=n(e.startCropX+i,0,t.width-r.width),r.y=n(e.startCropY+a,0,t.height-r.height),r}getPointRegion(e,t,r,n){let{evData:i}=this,a=i.clientX-e.x,o=i.clientY-e.y,s;return s=n&&t?"nw"===t||"n"===t||"ne"===t:o<i.startCropY,(r&&t?"nw"===t||"w"===t||"sw"===t:a<i.startCropX)?s?"nw":"sw":s?"ne":"se"}resolveMinDimensions(e,t,r=0,n=0){let i=Math.min(r,e.width),a=Math.min(n,e.height);return t&&(i||a)?t>1?i?[i,i/t]:[a*t,a]:a?[a*t,a]:[i,i/t]:[i,a]}resizeCrop(){let{evData:t}=this,{aspect:r=0,maxWidth:i,maxHeight:a}=this.props,o=this.getBox(),[l,h]=this.resolveMinDimensions(o,r,this.props.minWidth,this.props.minHeight),c=this.makePixelCrop(o),d=this.getPointRegion(o,t.ord,l,h),u=t.ord||d,m=t.clientX-t.startClientX,g=t.clientY-t.startClientY;(l&&"nw"===u||"w"===u||"sw"===u)&&(m=Math.min(m,-l)),(h&&"nw"===u||"n"===u||"ne"===u)&&(g=Math.min(g,-h));let p={unit:"px",x:0,y:0,width:0,height:0};"ne"===d?(p.x=t.startCropX,p.width=m,r?p.height=p.width/r:p.height=Math.abs(g),p.y=t.startCropY-p.height):"se"===d?(p.x=t.startCropX,p.y=t.startCropY,p.width=m,r?p.height=p.width/r:p.height=g):"sw"===d?(p.x=t.startCropX+m,p.y=t.startCropY,p.width=Math.abs(m),r?p.height=p.width/r:p.height=g):"nw"===d&&(p.x=t.startCropX+m,p.width=Math.abs(m),r?(p.height=p.width/r,p.y=t.startCropY-p.height):(p.height=Math.abs(g),p.y=t.startCropY+g));let f=s(p,r,d,o.width,o.height,l,h,i,a);return r||e.xyOrds.indexOf(u)>-1?c=f:e.xOrds.indexOf(u)>-1?(c.x=f.x,c.width=f.width):e.yOrds.indexOf(u)>-1&&(c.y=f.y,c.height=f.height),c.x=n(c.x,0,o.width-c.width),c.y=n(c.y,0,o.height-c.height),c}renderCropSelection(){let{ariaLabels:r=e.defaultProps.ariaLabels,disabled:n,locked:i,renderSelectionAddon:a,ruleOfThirds:o,crop:s}=this.props,l=this.getCropStyle();if(s)return t.default.createElement("div",{style:l,className:"ReactCrop__crop-selection",onPointerDown:this.onCropPointerDown,"aria-label":r.cropArea,tabIndex:0,onKeyDown:this.onComponentKeyDown,role:"group"},!n&&!i&&t.default.createElement("div",{className:"ReactCrop__drag-elements",onFocus:this.onDragFocus},t.default.createElement("div",{className:"ReactCrop__drag-bar ord-n","data-ord":"n"}),t.default.createElement("div",{className:"ReactCrop__drag-bar ord-e","data-ord":"e"}),t.default.createElement("div",{className:"ReactCrop__drag-bar ord-s","data-ord":"s"}),t.default.createElement("div",{className:"ReactCrop__drag-bar ord-w","data-ord":"w"}),t.default.createElement("div",{className:"ReactCrop__drag-handle ord-nw","data-ord":"nw",tabIndex:0,"aria-label":r.nwDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"nw"),role:"button"}),t.default.createElement("div",{className:"ReactCrop__drag-handle ord-n","data-ord":"n",tabIndex:0,"aria-label":r.nDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"n"),role:"button"}),t.default.createElement("div",{className:"ReactCrop__drag-handle ord-ne","data-ord":"ne",tabIndex:0,"aria-label":r.neDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"ne"),role:"button"}),t.default.createElement("div",{className:"ReactCrop__drag-handle ord-e","data-ord":"e",tabIndex:0,"aria-label":r.eDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"e"),role:"button"}),t.default.createElement("div",{className:"ReactCrop__drag-handle ord-se","data-ord":"se",tabIndex:0,"aria-label":r.seDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"se"),role:"button"}),t.default.createElement("div",{className:"ReactCrop__drag-handle ord-s","data-ord":"s",tabIndex:0,"aria-label":r.sDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"s"),role:"button"}),t.default.createElement("div",{className:"ReactCrop__drag-handle ord-sw","data-ord":"sw",tabIndex:0,"aria-label":r.swDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"sw"),role:"button"}),t.default.createElement("div",{className:"ReactCrop__drag-handle ord-w","data-ord":"w",tabIndex:0,"aria-label":r.wDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"w"),role:"button"})),a&&t.default.createElement("div",{className:"ReactCrop__selection-addon",onPointerDown:e=>e.stopPropagation()},a(this.state)),o&&t.default.createElement(t.default.Fragment,null,t.default.createElement("div",{className:"ReactCrop__rule-of-thirds-hz"}),t.default.createElement("div",{className:"ReactCrop__rule-of-thirds-vt"})))}makePixelCrop(e){return o({...r,...this.props.crop||{}},e.width,e.height)}render(){let{aspect:e,children:r,circularCrop:n,className:i,crop:a,disabled:o,locked:s,style:l,ruleOfThirds:h}=this.props,{cropIsActive:c,newCropIsBeingDrawn:d}=this.state,u=a?this.renderCropSelection():null,m=((...e)=>e.filter(e=>e&&"string"==typeof e).join(" "))("ReactCrop",i,c&&"ReactCrop--active",o&&"ReactCrop--disabled",s&&"ReactCrop--locked",d&&"ReactCrop--new-crop",a&&e&&"ReactCrop--fixed-aspect",a&&n&&"ReactCrop--circular-crop",a&&h&&"ReactCrop--rule-of-thirds",!this.dragStarted&&a&&!a.width&&!a.height&&"ReactCrop--invisible-crop",n&&"ReactCrop--no-animate");return t.default.createElement("div",{ref:this.componentRef,className:m,style:l},t.default.createElement("div",{ref:this.mediaRef,className:"ReactCrop__child-wrapper",onPointerDown:this.onComponentPointerDown},r),a?t.default.createElement("svg",{className:"ReactCrop__crop-mask",width:"100%",height:"100%"},t.default.createElement("defs",null,t.default.createElement("mask",{id:`hole-${this.instanceId}`},t.default.createElement("rect",{width:"100%",height:"100%",fill:"white"}),n?t.default.createElement("ellipse",{cx:`${a.x+a.width/2}${a.unit}`,cy:`${a.y+a.height/2}${a.unit}`,rx:`${a.width/2}${a.unit}`,ry:`${a.height/2}${a.unit}`,fill:"black"}):t.default.createElement("rect",{x:`${a.x}${a.unit}`,y:`${a.y}${a.unit}`,width:`${a.width}${a.unit}`,height:`${a.height}${a.unit}`,fill:"black"}))),t.default.createElement("rect",{fill:"black",fillOpacity:.5,width:"100%",height:"100%",mask:`url(#hole-${this.instanceId})`})):void 0,u)}};e.s(["f",0,c],232660);let d={maxLongEdge:4096,maxPixels:4915200,maxBytes:1572864,startQuality:.9,minQuality:.8};class u extends Error{code;format;constructor(e,t,r){super(e,void 0===r?void 0:{cause:r}),this.code=e,this.format=t,this.name="ImageDecodeError"}}let m=new Set(["heic","heix","heim","heis","hevc","hevx","hevm","hevs"]),g=new Set(["mif1","msf1","mif2"]),p=new Set(["avif","avis"]);function f(e,t,r=d){let n=Math.min(1,r.maxLongEdge/Math.max(e,t),Math.sqrt(r.maxPixels/Math.max(1,e*t)));return{width:Math.max(1,Math.floor(e*n)),height:Math.max(1,Math.floor(t*n)),scale:n}}async function w(e){let t,r;if("function"==typeof createImageBitmap)try{return await createImageBitmap(e,{imageOrientation:"from-image"})}catch{}let n=await (t=URL.createObjectURL(e),(r=new Image).decoding="async",new Promise((e,n)=>{r.onload=()=>e(r),r.onerror=()=>n(Error("IMAGE_ELEMENT_DECODE_FAILED")),r.src=t}).finally(()=>URL.revokeObjectURL(t)));if(!n.naturalWidth||!n.naturalHeight)throw Error("IMAGE_EMPTY");return n}async function x(t){let{heicTo:r}=await e.A(462684);return r({blob:t,type:"image/jpeg",quality:.95})}function y(e,t){return new Promise((r,n)=>{e.toBlob(e=>e?r(e):n(Error("CANVAS_EMPTY")),"image/jpeg",t)})}function b(e,t,r,n,i,a,o){let s,l=((s=document.createElement("canvas")).width=a,s.height=o,s),h=l.getContext("2d");if(!h)throw Error("CANVAS_UNSUPPORTED");return h.fillStyle="#ffffff",h.fillRect(0,0,a,o),h.imageSmoothingEnabled=!0,h.imageSmoothingQuality="high",h.drawImage(e,t,r,n,i,0,0,a,o),l}async function v(e,t){var r;let n,i=performance.now(),a=await e.arrayBuffer(),o=performance.now()-i,s=function(e){let t=(t,r)=>String.fromCharCode(...e.subarray(t,r));if(e.length>=3&&255===e[0]&&216===e[1]&&255===e[2])return"jpeg";if(e.length>=8&&137===e[0]&&"PNG"===t(1,4))return"png";if(e.length>=12&&"RIFF"===t(0,4)&&"WEBP"===t(8,12))return"webp";if(e.length>=6&&("GIF87a"===t(0,6)||"GIF89a"===t(0,6)))return"gif";if(e.length>=2&&"BM"===t(0,2))return"bmp";if(e.length>=12&&"ftyp"===t(4,8)){let r=Math.min(e.length,(e[0]<<24|e[1]<<16|e[2]<<8|e[3])>>>0||e.length),n=[t(8,12)];for(let e=16;e+4<=r;e+=4)n.push(t(e,e+4));if(n.some(e=>m.has(e)))return"heic";if(n.some(e=>p.has(e)))return"avif";if(n.some(e=>g.has(e)))return"heic"}return"unknown"}(new Uint8Array(a,0,Math.min(a.byteLength,64))),l=e.type||"",h=performance.now(),c="native",d=new Blob([a],{type:l||"application/octet-stream"});try{n=await w(d)}catch(e){if("heic"!==s)throw new u("unknown"===s?"UNSUPPORTED_IMAGE":"IMAGE_DECODE_FAILED",s,e);t?.();try{n=await w(await x(d)),c="heic"}catch(e){throw new u("HEIC_DECODE_FAILED",s,e)}}let{width:v,height:C}=(r=n)instanceof HTMLImageElement?{width:r.naturalWidth,height:r.naturalHeight}:{width:r.width,height:r.height};if(!v||!C)throw new u("IMAGE_DECODE_FAILED",s);let j=f(v,C,{maxLongEdge:1600,maxPixels:1/0}),k=await y(b(n,0,0,v,C,j.width,j.height),.85),D=URL.createObjectURL(k),M=performance.now()-h;return{source:n,width:v,height:C,format:s,decoder:c,previewUrl:D,sourceType:l,sourceBytes:e.size,timings:{read:Math.round(o),convert:Math.round(M)},dispose:()=>{URL.revokeObjectURL(D),n instanceof HTMLImageElement||n.close()}}}let C={x:0,y:0,width:1,height:1};async function j(e,t=C,r=d){var n;let i=performance.now(),a=e=>Math.min(1,Math.max(0,e)),o=Math.round(a(t.x)*e.width),s=Math.round(a(t.y)*e.height),l=Math.max(1,Math.min(e.width-o,Math.round(a(t.width)*e.width))),h=Math.max(1,Math.min(e.height-s,Math.round(a(t.height)*e.height))),c=f(l,h,r),u=b(e.source,o,s,l,h,c.width,c.height),m=performance.now()-i,g=performance.now(),p=r.startQuality,w=await y(u,p);for(let t=0;w.size>r.maxBytes&&t<12;t++)p-.05>=r.minQuality-1e-9?p=Math.round((p-.05)*100)/100:(c={width:Math.max(1,Math.floor(.85*c.width)),height:Math.max(1,Math.floor(.85*c.height)),scale:.85*c.scale},u=b(e.source,o,s,l,h,c.width,c.height)),w=await y(u,p);return{dataUrl:await (n=w,new Promise((e,t)=>{let r=new FileReader;r.onload=()=>e(r.result),r.onerror=()=>t(r.error??Error("READ_FAILED")),r.readAsDataURL(n)})),width:c.width,height:c.height,bytes:w.size,quality:p,timings:{crop:Math.round(m),compress:Math.round(performance.now()-g)}}}e.s(["o",0,u,"N",0,function(e,t){return{sourceType:e.sourceType||e.format,sourceBytes:e.sourceBytes,sourceWidth:e.width,sourceHeight:e.height,outputWidth:t.width,outputHeight:t.height,outputBytes:t.bytes,decoder:e.decoder,quality:t.quality}},"p",0,v,"X",0,j],213761)},469937,62825,e=>{var t=e.i(843476),r=e.i(456420);let n={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"}]]};n.node;let i=(0,r.f)(n);var a=e.i(111110),o=e.i(975157);let s=[1,2,3,4,5];function l(e){return"not_attempted"===e||"wrong_attempt"===e||"unknown"===e?e:"unknown"}e.s(["f",0,function({value:e,onChange:r,disabled:n,size:l="sm",showUnrated:h=!0,className:c}){let{t:d}=(0,a.b)(),u=e??0,m="sm"===l?"h-3.5 w-3.5":"h-5 w-5",g=u?d.difficulty.starsLabel.replace("{n}",String(u)):d.difficulty.unrated;return r?(0,t.jsxs)("span",{className:(0,o.f)("inline-flex items-center gap-0.5",c),role:"group","aria-label":`${d.difficulty.label}${d.common.colon}${g}`,title:d.difficulty.clearHint,children:[s.map(e=>(0,t.jsx)("button",{type:"button",disabled:n,onClick:()=>r(e===u?null:e),"aria-label":d.difficulty.setStars.replace("{n}",String(e)),"aria-pressed":e<=u,className:"rounded p-0.5 hover:bg-muted disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:(0,t.jsx)(i,{className:(0,o.f)(m,e<=u?"fill-amber-400 text-amber-400":"text-muted-foreground/40")})},e)),!u&&h&&(0,t.jsx)("span",{className:"ml-1 text-xs text-muted-foreground",children:d.difficulty.unrated})]}):u?(0,t.jsx)("span",{className:(0,o.f)("inline-flex items-center",c),role:"img","aria-label":`${d.difficulty.label}${d.common.colon}${g}`,title:g,children:s.map(e=>(0,t.jsx)(i,{className:(0,o.f)(m,e<=u?"fill-amber-400 text-amber-400":"text-muted-foreground/30"),"aria-hidden":!0},e))}):h?(0,t.jsx)("span",{className:(0,o.f)("text-xs text-muted-foreground",c),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:"未判断"})[l(e)]},"h",0,l,"x",0,function(e,t){return(t||"").trim()?"wrong_attempt":l(e)}],62825)},12130,e=>{var t=e.i(843476),r=e.i(271645),n=e.i(232660),i=e.i(519455),a=e.i(776639),o=e.i(263676),s=e.i(111110);async function l(e,t){let{naturalWidth:r,naturalHeight:n}=e;return Promise.all(t.map(t=>new Promise((i,a)=>{let o=document.createElement("canvas"),s=Math.round(t.x*r),l=Math.round(t.y*n);o.width=Math.max(1,Math.round(t.width*r)),o.height=Math.max(1,Math.round(t.height*n));let h=o.getContext("2d");h?(h.drawImage(e,s,l,o.width,o.height,0,0,o.width,o.height),o.toBlob(e=>e?i(e):a(Error("Canvas is empty")),"image/jpeg",.95)):a(Error("Canvas is not supported"))})))}let h={maxHeight:"65vh",maxWidth:"100%",objectFit:"contain"},c=(0,r.forwardRef)(function({imageSrc:e,regions:n,onChange:i,imageStyle:a=h,onImageLoad:l},c){let{t:d}=(0,s.b)(),u=(0,r.useRef)(null),m=(0,r.useRef)(null),[g,p]=(0,r.useState)(null),f=e=>{let t=u.current.getBoundingClientRect();return{x:(e.clientX-t.left)/t.width,y:(e.clientY-t.top)/t.height}},w=()=>{g&&g.width>=.02&&g.height>=.02&&i([...n,g]),m.current=null,p(null)},x=e=>({left:`${100*e.x}%`,top:`${100*e.y}%`,width:`${100*e.width}%`,height:`${100*e.height}%`});return(0,t.jsxs)("div",{className:"relative inline-block select-none",children:[(0,t.jsx)("img",{ref:c,src:e,alt:"",draggable:!1,style:a,onLoad:l,className:"block"}),(0,t.jsxs)("div",{ref:u,className:"absolute inset-0 cursor-crosshair",style:{touchAction:"none"},onPointerDown:e=>{0===e.button&&(u.current?.setPointerCapture(e.pointerId),m.current=f(e),p(null))},onPointerMove:e=>{var t,r,n,i;let a,o,s;if(!m.current)return;let l=f(e);p((t=m.current.x,r=m.current.y,n=l.x,i=l.y,o=(a=e=>Math.min(1,Math.max(0,e)))(Math.min(t,n)),s=a(Math.min(r,i)),{x:o,y:s,width:a(Math.max(t,n))-o,height:a(Math.max(r,i))-s}))},onPointerUp:w,onPointerCancel:w,children:[n.map((e,r)=>(0,t.jsxs)("div",{className:"absolute border-2 border-sky-400 bg-sky-400/15",style:x(e),children:[(0,t.jsx)("span",{className:"absolute left-0 top-0 bg-sky-500 px-1.5 text-xs font-bold text-white",children:r+1}),(0,t.jsx)("button",{type:"button",className:"absolute -right-3 -top-3 flex h-6 w-6 items-center justify-center rounded-full bg-red-500 text-white shadow","aria-label":d.batchImport.removeRegion.replace("{index}",String(r+1)),onPointerDown:e=>e.stopPropagation(),onClick:()=>i(n.filter((e,t)=>t!==r)),children:(0,t.jsx)(o.X,{className:"h-3 w-3"})})]},r)),g&&(0,t.jsx)("div",{className:"absolute border-2 border-dashed border-yellow-300 bg-yellow-300/10",style:x(g)})]})]})});var d=e.i(456420);let u={name:"zoom-in",size:24,node:[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]};u.node;let m=(0,d.f)(u),g={name:"zoom-out",size:24,node:[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]};g.node;let p=(0,d.f)(g);function f({zoom:e,onZoomIn:r,onZoomOut:n,onReset:i}){let{t:a}=(0,s.b)(),o="outline-none focus-visible:ring-2 focus-visible:ring-white/70",l=`flex h-9 w-9 items-center justify-center rounded-full text-white transition-colors hover:bg-white/20 disabled:opacity-40 disabled:hover:bg-transparent ${o}`;return(0,t.jsxs)("div",{className:"flex items-center gap-0.5 rounded-full bg-black/60 p-1 shadow-lg backdrop-blur-sm",children:[(0,t.jsx)("button",{type:"button",className:l,onClick:n,disabled:e<=1,"aria-label":a.common.cropper.zoomOut,title:a.common.cropper.zoomOut,children:(0,t.jsx)(p,{className:"h-4 w-4"})}),(0,t.jsxs)("button",{type:"button",className:`h-9 min-w-14 rounded-full px-2 text-center text-xs font-medium tabular-nums text-white hover:bg-white/20 ${o}`,onClick:i,"aria-label":a.common.cropper.resetZoom,title:a.common.cropper.resetZoom,children:[Math.round(100*e),"%"]}),(0,t.jsx)("button",{type:"button",className:l,onClick:r,disabled:e>=5,"aria-label":a.common.cropper.zoomIn,title:a.common.cropper.zoomIn,children:(0,t.jsx)(m,{className:"h-4 w-4"})})]})}var w=e.i(201276);let x={single:{maxHeight:"70vh",maxWidth:"100%",objectFit:"contain"},auto:{maxHeight:"65vh",maxWidth:"100%",objectFit:"contain"},multi:{maxHeight:"65vh",maxWidth:"100%",objectFit:"contain"}};e.s(["f",0,function({imageSrc:e,open:o,onClose:h,onCropComplete:d,onMultiCropComplete:u,onRegionsSelected:m,allowMulti:g=!0,onAutoSplit:p}){let{t:y}=(0,s.b)(),b=/^(blob:|data:image\/)/i.test(e)?e:void 0,[v,C]=(0,r.useState)(),j=(0,r.useRef)(null),[k,D]=(0,r.useState)("single"),{containerRef:M,zoom:E,imageStyle:N,measureImage:R,zoomIn:S,zoomOut:L,reset:I}=function(e){let[t,n]=(0,r.useState)(null),i=(0,r.useRef)(null),a=(0,r.useCallback)(e=>{i.current=e,n(e)},[]),[o,s]=(0,r.useState)(1),l=(0,r.useRef)(1),[h,c]=(0,r.useState)(null),d=(0,r.useRef)(null),u=(0,r.useRef)(!1),m=(0,r.useCallback)((e,t,r)=>{let n=i.current,a=l.current,o=Math.min(5,Math.max(1,e));if(!n||o===a)return;if(1===a){let e=n.querySelector("img");e&&c(e.clientWidth)}let h=n.getBoundingClientRect(),u=(t??h.left+h.width/2)-h.left,m=(r??h.top+h.height/2)-h.top;d.current={viewX:u,viewY:m,contentX:n.scrollLeft+u,contentY:n.scrollTop+m,ratio:o/a},l.current=o,s(o)},[]);(0,r.useLayoutEffect)(()=>{let e=i.current,t=d.current;e&&t&&(e.scrollLeft=t.contentX*t.ratio-t.viewX,e.scrollTop=t.contentY*t.ratio-t.viewY,d.current=null)},[o]),(0,r.useEffect)(()=>{if(!t)return;let e=e=>{e.preventDefault(),m(l.current*Math.exp(-(.0015*e.deltaY)),e.clientX,e.clientY)},r=null,n=e=>{let[t,r]=[e[0],e[1]];return{distance:Math.hypot(t.clientX-r.clientX,t.clientY-r.clientY),centerX:(t.clientX+r.clientX)/2,centerY:(t.clientY+r.clientY)/2}},i=e=>{2===e.touches.length&&(r={distance:n(e.touches).distance,zoom:l.current},u.current=!0)},a=e=>{if(!r||2!==e.touches.length)return;e.preventDefault();let{distance:t,centerX:i,centerY:a}=n(e.touches);r.distance>0&&m(r.zoom*(t/r.distance),i,a)},o=e=>{e.touches.length<2&&(r=null,u.current=!1)},s=e=>{u.current&&e.stopPropagation()};return t.addEventListener("wheel",e,{passive:!1}),t.addEventListener("touchstart",i,{passive:!0}),t.addEventListener("touchmove",a,{passive:!1}),t.addEventListener("touchend",o),t.addEventListener("touchcancel",o),t.addEventListener("pointermove",s,{capture:!0}),()=>{t.removeEventListener("wheel",e),t.removeEventListener("touchstart",i),t.removeEventListener("touchmove",a),t.removeEventListener("touchend",o),t.removeEventListener("touchcancel",o),t.removeEventListener("pointermove",s,{capture:!0})}},[t,m]);let g=(0,r.useCallback)(e=>{e&&1===l.current&&c(e.clientWidth)},[]),p=(0,r.useCallback)(()=>m(1.25*l.current),[m]),f=(0,r.useCallback)(()=>m(l.current/1.25),[m]),w=(0,r.useCallback)(()=>{l.current=1,d.current=null,s(1)},[]),x=1!==o&&h?{...e,width:h*o,height:"auto",maxWidth:"none",maxHeight:"none"}:e;return{containerRef:a,zoom:o,imageStyle:x,measureImage:g,zoomIn:p,zoomOut:f,reset:w}}(x[k]);(0,r.useEffect)(()=>{I()},[e,I]);let[_,P]=(0,r.useState)({src:e,regions:[]}),$=_.src===e?_.regions:[],H=t=>P({src:e,regions:t}),A=(0,r.useRef)(null),z=["single",...p?["auto"]:[],...u||m&&g?["multi"]:[]],B={single:y.batchImport.singleMode,auto:y.batchImport.autoMode,multi:y.batchImport.multiMode},Y=async()=>{if(0!==$.length){if(m){m($,!0),H([]);return}if(A.current&&u)try{u(await l(A.current,$)),H([])}catch(e){w.V.error("[ImageCropper]","Multi-image crop failed",{error:e})}}},X=async()=>{let e=v&&v.width>0&&v.height>0?{x:v.x/100,y:v.y/100,width:v.width/100,height:v.height/100}:{x:0,y:0,width:1,height:1};if("auto"===k&&p)return void p(e);if(m)return void m([e],!1);if(j.current&&d)try{let[t]=await l(j.current,[e]);d(t)}catch(e){w.V.error("[ImageCropper]","Crop failed",{error:e})}};return(0,t.jsx)(a.N,{open:o,onOpenChange:e=>!e&&h(),children:(0,t.jsxs)(a.d,{className:"max-w-3xl h-[90vh] flex flex-col p-0 gap-0",children:[(0,t.jsx)(a.s,{className:"p-4 border-b shrink-0",children:(0,t.jsx)(a.F,{children:y.common.cropper?.title||"Crop Image"})}),(0,t.jsxs)("div",{className:"relative min-h-0 flex-1 bg-black",children:[(0,t.jsx)("div",{ref:M,className:"flex h-full w-full overflow-auto p-4",children:(0,t.jsx)("div",{className:"m-auto",children:"multi"===k?(0,t.jsx)(c,{ref:A,imageSrc:b,regions:$,onChange:H,imageStyle:N,onImageLoad:e=>R(e.currentTarget)}):(0,t.jsx)(n.f,{crop:v,onChange:(e,t)=>C(t),children:(0,t.jsx)("img",{ref:j,alt:"Crop me",src:b,onLoad:function(e){C({unit:"%",x:0,y:0,width:100,height:100}),R(e.currentTarget)},style:N})})})}),(0,t.jsx)("div",{className:"absolute right-3 top-3",children:(0,t.jsx)(f,{zoom:E,onZoomIn:S,onZoomOut:L,onReset:I})})]}),(0,t.jsxs)("div",{className:"p-4 border-t bg-background shrink-0 space-y-3",children:[z.length>1&&(0,t.jsx)("div",{className:`grid gap-1 rounded-md bg-muted p-1 ${3===z.length?"grid-cols-3 sm:w-[28rem]":"grid-cols-2 sm:w-80"}`,children:z.map(e=>(0,t.jsx)("button",{type:"button","aria-pressed":k===e,onClick:()=>{I(),D(e)},className:`rounded px-2 py-1.5 text-sm font-medium transition-colors ${k===e?"bg-background shadow-sm":"text-muted-foreground"}`,children:B[e]},e))}),(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row sm:justify-between sm:items-center gap-3",children:[(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:"multi"===k?`${y.batchImport.hint} ${y.batchImport.regionCount.replace("{count}",String($.length))}`:"auto"===k?y.batchImport.autoHint:y.common.cropper?.hint||"💡 Drag to adjust crop area"}),(0,t.jsxs)("div",{className:"flex gap-2 justify-end",children:["multi"===k&&$.length>0&&(0,t.jsx)(i.f,{variant:"ghost",onClick:()=>H([]),children:y.batchImport.clear}),(0,t.jsx)(i.f,{variant:"outline",onClick:h,children:y.common.cancel||"Cancel"}),"multi"===k?(0,t.jsx)(i.f,{onClick:Y,disabled:0===$.length,children:y.batchImport.start.replace("{count}",String($.length))}):(0,t.jsx)(i.f,{onClick:X,children:"auto"===k?y.batchImport.autoStart:y.common.confirm||"Confirm"})]})]})]})]})})}],12130)},141176,e=>{var t=e.i(843476),r=e.i(271645),n=e.i(456420);let i={name:"code-xml",size:24,node:[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],aliases:["code-2"]};i.node;let a=(0,n.f)(i);var o=e.i(772382),s=e.i(511445),l=e.i(624687),h=e.i(111110),c=e.i(975157);e.s(["f",0,function({value:e,onChange:n,className:i,...d}){let{t:u}=(0,h.b)(),[m,g]=(0,r.useState)("source"),p=(0,r.useId)(),f=[{mode:"source",label:u.markdownEditor.source,icon:a},{mode:"preview",label:u.markdownEditor.preview,icon:o.f}];return(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("div",{role:"tablist","aria-label":u.markdownEditor.modeLabel,className:"flex justify-end",children:(0,t.jsx)("div",{className:"inline-flex rounded-md border bg-muted/40 p-0.5",children:f.map(({mode:e,label:r,icon:n})=>(0,t.jsxs)("button",{type:"button",role:"tab","aria-selected":m===e,"aria-controls":p,onClick:()=>g(e),className:(0,c.f)("flex items-center gap-1 rounded px-2.5 py-1 text-xs transition-colors",m===e?"bg-background font-medium shadow-sm":"text-muted-foreground hover:text-foreground"),children:[(0,t.jsx)(n,{className:"h-3.5 w-3.5"}),r]},e))})}),(0,t.jsx)("div",{id:p,role:"tabpanel",children:"source"===m?(0,t.jsx)(l.f,{value:e,onChange:e=>n(e.target.value),className:i,...d}):(0,t.jsx)("div",{className:"min-h-24 cursor-text rounded-md border bg-muted/20 px-3 py-2",onDoubleClick:()=>g("source"),title:u.markdownEditor.doubleClickToEdit,children:e.trim()?(0,t.jsx)(s.f,{content:e}):(0,t.jsx)("p",{className:"text-sm italic text-muted-foreground",children:u.markdownEditor.empty})})})]})}],141176)},438465,674166,e=>{var t=e.i(843476),r=e.i(271645),n=e.i(967489),i=e.i(856423),a=e.i(41931),o=e.i(201276),s=e.i(111110);e.s(["f",0,function({value:e,onChange:l,className:h}){let[c,d]=(0,r.useState)([]),{t:u}=(0,s.b)();return(0,r.useEffect)(()=>{(async()=>{try{let e=await a.k.get("/api/notebooks");d(e)}catch(e){o.V.error("[NotebookSelector]","Failed to fetch notebooks",{error:e})}})()},[]),(0,t.jsxs)(n.d,{value:e,onValueChange:l,children:[(0,t.jsx)(n.P,{className:h,children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(i.f,{className:"h-4 w-4 text-muted-foreground"}),(0,t.jsx)(n.U,{placeholder:u.notebooks?.selector?.placeholder||"Select Notebook"})]})}),(0,t.jsx)(n.r,{children:0===c.length?(0,t.jsx)("div",{className:"p-2 text-sm text-muted-foreground text-center",children:u.notebooks?.selector?.empty||"No notebooks available"}):c.map(e=>(0,t.jsx)(n.T,{value:e.id,children:e.name},e.id))})]})}],438465);var l=e.i(664030);e.s(["f",0,function({value:e,onChange:r,disabled:i}){let{groups:a,loading:o}=(0,l.f)(),s=a.filter(e=>e.isActive);return(0,t.jsxs)(n.d,{value:e,onValueChange:r,disabled:i||o,children:[(0,t.jsx)(n.P,{children:(0,t.jsx)(n.U,{placeholder:"选择卷别"})}),(0,t.jsx)(n.r,{children:s.map(e=>(0,t.jsx)(n.T,{value:e.id,children:e.name},e.id))})]})}],674166)},149704,e=>{var t=e.i(843476),r=e.i(111110),n=e.i(398019),i=e.i(184110),a=e.i(975157);let o={left:"mr-auto",center:"mx-auto",right:"ml-auto"};e.s(["f",0,function({svg:e,scale:s,align:l,className:h}){let{t:c}=(0,r.b)();if(!e)return null;let d=(0,i.V)(s),u=(0,i.o)(l);return(0,t.jsx)("figure",{className:(0,a.f)("question-figure my-3",h),children:(0,t.jsx)("img",{src:(0,n.f)(e),alt:c.figure.alt,className:(0,a.f)(o[u],"block h-auto max-w-full rounded border bg-white p-2"),style:{..."left"===u?{marginLeft:0,marginRight:"auto"}:"right"===u?{marginLeft:"auto",marginRight:0}:{},maxHeight:360,zoom:d/100,maxWidth:`${Math.min(d,100)}%`}})})}])},574041,e=>{var t=e.i(843476),r=e.i(271645),n=e.i(263676),i=e.i(487486),a=e.i(793479),o=e.i(41931),s=e.i(201276);e.s(["f",0,function({value:e=[],onChange:l,placeholder:h="Enter tags...",className:c="",enterHint:d,subject:u,gradeStage:m}){let[g,p]=(0,r.useState)(""),[f,w]=(0,r.useState)([]),[x,y]=(0,r.useState)(!1),[b,v]=(0,r.useState)(0),C=(0,r.useRef)(null),j=(0,r.useRef)(null),k=(0,r.useCallback)(async t=>{try{let r=new URLSearchParams({q:t});u&&r.append("subject",u),m&&r.append("stage",m);let n=((await o.k.get(`/api/tags/suggestions?${r.toString()}`)).suggestions||[]).filter(t=>!e.includes(t));w(n.slice(0,20)),y(n.length>0),v(0)}catch(e){s.V.error("[TagInput]","Failed to fetch suggestions",{error:e})}},[u,m,e]);(0,r.useEffect)(()=>{g.trim()&&k(g)},[g,k]);let D=t=>{t.trim()&&!e.includes(t.trim())&&(l([...e,t.trim()]),p(""),w([]),y(!1),v(0))},M=t=>{l(e.filter(e=>e!==t))};return(0,r.useEffect)(()=>{let e=e=>{!j.current||j.current.contains(e.target)||C.current?.contains(e.target)||y(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),(0,t.jsxs)("div",{className:`relative ${c}`,children:[(0,t.jsxs)("div",{className:"flex flex-wrap gap-2 p-2 border rounded-lg bg-background min-h-[42px]",children:[e.map(e=>(0,t.jsxs)(i.f,{variant:"secondary",className:"flex items-center gap-1 px-2 py-1",children:[e,(0,t.jsx)("button",{type:"button",onClick:()=>M(e),className:"hover:text-destructive ml-1",children:(0,t.jsx)(n.X,{className:"h-3 w-3"})})]},e)),(0,t.jsx)(a.f,{ref:C,type:"text",value:g,onChange:e=>{p(e.target.value),e.target.value.trim()||(w([]),y(!1))},onKeyDown:t=>{"Enter"===t.key?(t.preventDefault(),b>=0&&f[b]?D(f[b]):g.trim()&&D(g)):"ArrowDown"===t.key?(t.preventDefault(),v(e=>Math.min(e+1,f.length-1))):"ArrowUp"===t.key?(t.preventDefault(),v(e=>Math.max(e-1,0))):"Escape"===t.key?(y(!1),v(0)):"Backspace"===t.key&&!g&&e.length>0&&M(e[e.length-1])},onFocus:()=>{f.length>0&&y(!0)},placeholder:0===e.length?h:"",className:"flex-1 min-w-[120px] border-none focus-visible:ring-0 focus-visible:ring-offset-0 h-8 px-0"})]}),x&&f.length>0&&(0,t.jsx)("div",{ref:j,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,r)=>(0,t.jsx)("div",{className:`px-3 py-2 cursor-pointer hover:bg-accent ${r===b?"bg-accent":""}`,onClick:()=>D(e),onMouseEnter:()=>v(r),children:e},e))}),g&&!x&&(0,t.jsx)("div",{className:"text-xs text-muted-foreground mt-1",children:d?`${d} "${g}"`:`Press Enter to create "${g}"`})]})}])},184110,e=>{let t=["left","center","right"],r="center";function n(e){return"number"==typeof e&&Number.isInteger(e)&&e>=10&&e<=200}e.s(["E",0,r,"n",0,100,"j",0,t,"a",0,200,"_",0,10,"x",0,n,"o",0,function(e){return"string"==typeof e&&t.includes(e)?e:r},"V",0,function(e){return n(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}])}])})();
|
|
1
|
+
(()=>{"use strict";(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,314381,3198,e=>{var t=e.i(456420);let r={name:"box",size:24,node:[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]};r.node;let n=(0,t.f)(r);e.s(["f",0,n],314381);var i=e.i(843476),a=e.i(271645),o=e.i(632781);let s={name:"maximize-2",size:24,node:[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]};s.node;let l=(0,t.f)(s),h={name:"minimize-2",size:24,node:[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]]};h.node;let c=(0,t.f)(h);var d=e.i(395925),u=e.i(741120),m=e.i(759659),g=e.i(519455),p=e.i(111110),f=e.i(294114),w=e.i(201276),x=e.i(113381);let y=null;function b(e,t,r){let n=e?.firstElementChild;n&&(n.style.width="100%",n.style.height=`${r}px`,t?.setSize(e?.offsetWidth||n.offsetWidth||800,r))}function v(e,t){let r=(0,x.L)(e,t);for(let e of r)w.V.warn("[GGB]","命令执行失败",{...e});return r.map(e=>e.command+":"+e.message).join("\n")||void 0}e.s(["f",0,function({commands:e,height:t=700,showToolBar:r=!1,showAlgebraInput:n=!1,showMenuBar:s=!1,className:h="",onRegenerate:C,onDelete:j}){let{t:k}=(0,p.b)(),D=(0,a.useRef)(null),M=(0,a.useRef)(null),E=(0,a.useRef)(void 0),N=(0,a.useId)(),R=(0,a.useRef)(`ggb-${N.replace(/[^a-zA-Z0-9_-]/g,"")}`),[S,L]=(0,a.useState)(!0),[I,_]=(0,a.useState)(null),[P,$]=(0,a.useState)(!0),[H,A]=(0,a.useState)(!1),[z,B]=(0,a.useState)(!1),Y=(0,a.useMemo)(()=>(0,x.i)(e),[e]);(0,a.useEffect)(()=>{if(0===Y.length)return;let e=!1,i=R.current,a=D.current;return(y||(y=new Promise((e,t)=>{if(window.GGBApplet)return void e();let r=document.createElement("script");r.src="https://www.geogebra.org/apps/deployggb.js",r.async=!0,r.onload=()=>e(),r.onerror=()=>{y=null,t(Error("Failed to load GeoGebra"))},document.head.appendChild(r)}))).then(()=>{if(e)return;let o=window.GGBApplet;if(!o){_(k.geogebra.notLoaded),L(!1);return}if(a){a.innerHTML=`<div id="${i}" style="width:100%;height:${t}px"></div>`;try{new o({appName:"classic",width:"100%",height:t,showToolBar:r,showAlgebraInput:n,showMenuBar:s,showResetIcon:!0,enableRightClick:!0,enableShiftDragZoom:!0,language:"zh",appletOnLoad:r=>{e||(M.current=r,b(a,r,t),E.current=v(r,Y),L(!1))}},!0).inject(i)}catch(t){w.V.error("[GGB]","Init failed",{error:t}),e||(_(k.geogebra.initFailed),L(!1))}}}).catch(t=>{w.V.error("[GGB]","Script load failed",{error:t}),e||(_(k.geogebra.scriptFailed),L(!1))}),()=>{e=!0;try{let e=M.current;e?.remove&&e.remove()}catch(e){w.V.warn("[GGB]","Cleanup failed",{error:e})}M.current=null,a&&(a.innerHTML="")}},[Y,r,n,s]),(0,a.useEffect)(()=>{b(D.current,M.current,P?700:t)},[P,t]);let X=(0,a.useCallback)(()=>{let e=M.current;if(e)try{e.resetConstruction(),setTimeout(()=>{M.current&&(E.current=v(M.current,Y))},300)}catch(e){w.V.warn("[GGB]","Reset failed",{error:e})}},[Y]),O=(0,a.useCallback)(async()=>{if(C&&!H){A(!0);try{await C(E.current)}finally{A(!1)}}},[C,H]),U=(0,a.useCallback)(async()=>{if(j&&!z&&await (0,f.u)(k.geogebra.confirmDelete,{destructive:!0})){B(!0);try{await j()}catch{f.c.error(k.geogebra.deleteFailed)}finally{B(!1)}}},[j,z,k]);return 0===Y.length?null:(0,i.jsxs)("div",{className:`relative rounded-lg border bg-card ${h}`,children:[(0,i.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 border-b bg-muted/30",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:k.geogebra.title}),S&&(0,i.jsx)(o.f,{className:"h-3 w-3 animate-spin text-muted-foreground"})]}),(0,i.jsxs)("div",{className:"flex items-center gap-1",children:[C&&(0,i.jsxs)(g.f,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs gap-1",onClick:O,title:k.geogebra.regenerate,disabled:H||S,children:[H?(0,i.jsx)(o.f,{className:"h-3.5 w-3.5 animate-spin"}):(0,i.jsx)(u.f,{className:"h-3.5 w-3.5"}),(0,i.jsx)("span",{children:k.geogebra.regenerate})]}),j&&(0,i.jsxs)(g.f,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs gap-1 text-destructive hover:text-destructive",onClick:U,title:k.geogebra.delete,disabled:z||H,children:[z?(0,i.jsx)(o.f,{className:"h-3.5 w-3.5 animate-spin"}):(0,i.jsx)(m.f,{className:"h-3.5 w-3.5"}),(0,i.jsx)("span",{children:k.geogebra.delete})]}),(0,i.jsx)(g.f,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:X,title:k.geogebra.reset,disabled:S,children:(0,i.jsx)(d.f,{className:"h-3.5 w-3.5"})}),(0,i.jsx)(g.f,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>$(e=>!e),title:P?k.geogebra.shrink:k.geogebra.enlarge,children:P?(0,i.jsx)(c,{className:"h-3.5 w-3.5"}):(0,i.jsx)(l,{className:"h-3.5 w-3.5"})})]})]}),(0,i.jsx)("div",{ref:D,style:{width:"100%"}}),S&&(0,i.jsx)("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-background/80 rounded-b-lg",style:{top:37},children:(0,i.jsxs)("div",{className:"flex flex-col items-center gap-2",children:[(0,i.jsx)(o.f,{className:"h-6 w-6 animate-spin text-primary"}),(0,i.jsx)("span",{className:"text-sm text-muted-foreground",children:k.geogebra.loading})]})}),I&&(0,i.jsx)("div",{className:"flex items-center justify-center text-sm text-destructive",style:{minHeight:t},children:I})]})}],3198)},856522,e=>{var t=e.i(456420);let r={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"}]]};r.node;let n=(0,t.f)(r);e.s(["f",0,n],856522)},328623,e=>{var t=e.i(456420);let r={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"]};r.node;let n=(0,t.f)(r);e.s(["f",0,n],328623)},232660,213761,e=>{var t=e.i(271645),r={x:0,y:0,width:0,height:0,unit:"px"},n=(e,t,r)=>Math.min(Math.max(e,t),r),i=(e,t)=>e===t||e.width===t.width&&e.height===t.height&&e.x===t.x&&e.y===t.y&&e.unit===t.unit;function a(e,t,n){return"%"===e.unit?{...r,...e,unit:"%"}:{unit:"%",x:e.x?e.x/t*100:0,y:e.y?e.y/n*100:0,width:e.width?e.width/t*100:0,height:e.height?e.height/n*100:0}}function o(e,t,n){return e.unit&&"px"!==e.unit?{unit:"px",x:e.x?e.x*t/100:0,y:e.y?e.y*n/100:0,width:e.width?e.width*t/100:0,height:e.height?e.height*n/100:0}:{...r,...e,unit:"px"}}function s(e,t,r,n,i,a=0,o=0,l=n,h=i){let c={...e},d=Math.min(a,n),u=Math.min(o,i),m=Math.min(l,n),g=Math.min(h,i);t&&(t>1?(u=(d=o?o*t:d)/t,m=l*t):(d=(u=a?a/t:u)*t,g=h/t)),c.y<0&&(c.height=Math.max(c.height+c.y,u),c.y=0),c.x<0&&(c.width=Math.max(c.width+c.x,d),c.x=0);let p=n-(c.x+c.width);p<0&&(c.x=Math.min(c.x,n-d),c.width+=p);let f=i-(c.y+c.height);if(f<0&&(c.y=Math.min(c.y,i-u),c.height+=f),c.width<d&&(("sw"===r||"nw"==r)&&(c.x-=d-c.width),c.width=d),c.height<u&&(("nw"===r||"ne"==r)&&(c.y-=u-c.height),c.height=u),c.width>m&&(("sw"===r||"nw"==r)&&(c.x-=m-c.width),c.width=m),c.height>g&&(("nw"===r||"ne"==r)&&(c.y-=g-c.height),c.height=g),t){let e=c.width/c.height;if(e<t){let e=Math.max(c.width/t,u);("nw"===r||"ne"==r)&&(c.y-=e-c.height),c.height=e}else if(e>t){let e=Math.max(c.height*t,d);("sw"===r||"nw"==r)&&(c.x-=e-c.width),c.width=e}}return c}var l={capture:!0,passive:!1},h=0,c=class e extends t.PureComponent{static xOrds=["e","w"];static yOrds=["n","s"];static xyOrds=["nw","ne","se","sw"];static nudgeStep=1;static nudgeStepMedium=10;static nudgeStepLarge=100;static defaultProps={ariaLabels:{cropArea:"Use the arrow keys to move the crop selection area",nwDragHandle:"Use the arrow keys to move the north west drag handle to change the crop selection area",nDragHandle:"Use the up and down arrow keys to move the north drag handle to change the crop selection area",neDragHandle:"Use the arrow keys to move the north east drag handle to change the crop selection area",eDragHandle:"Use the up and down arrow keys to move the east drag handle to change the crop selection area",seDragHandle:"Use the arrow keys to move the south east drag handle to change the crop selection area",sDragHandle:"Use the up and down arrow keys to move the south drag handle to change the crop selection area",swDragHandle:"Use the arrow keys to move the south west drag handle to change the crop selection area",wDragHandle:"Use the up and down arrow keys to move the west drag handle to change the crop selection area"}};get document(){return document}docMoveBound=!1;mouseDownOnCrop=!1;dragStarted=!1;evData={startClientX:0,startClientY:0,startCropX:0,startCropY:0,clientX:0,clientY:0,isResize:!0};componentRef=(0,t.createRef)();mediaRef=(0,t.createRef)();resizeObserver;initChangeCalled=!1;instanceId=`rc-${h++}`;state={cropIsActive:!1,newCropIsBeingDrawn:!1};getBox(){let e=this.mediaRef.current;if(!e)return{x:0,y:0,width:0,height:0};let{x:t,y:r,width:n,height:i}=e.getBoundingClientRect();return{x:t,y:r,width:n,height:i}}componentDidUpdate(e){let{crop:t,onComplete:r}=this.props;if(r&&!e.crop&&t){let{width:e,height:n}=this.getBox();e&&n&&r(o(t,e,n),a(t,e,n))}}componentWillUnmount(){this.resizeObserver&&this.resizeObserver.disconnect(),this.unbindDocMove()}bindDocMove(){this.docMoveBound||=(this.document.addEventListener("pointermove",this.onDocPointerMove,l),this.document.addEventListener("pointerup",this.onDocPointerDone,l),this.document.addEventListener("pointercancel",this.onDocPointerDone,l),!0)}unbindDocMove(){this.docMoveBound&&=(this.document.removeEventListener("pointermove",this.onDocPointerMove,l),this.document.removeEventListener("pointerup",this.onDocPointerDone,l),this.document.removeEventListener("pointercancel",this.onDocPointerDone,l),!1)}onCropPointerDown=e=>{let{crop:t,disabled:r}=this.props,n=this.getBox();if(!t)return;let i=o(t,n.width,n.height);if(r)return;e.cancelable&&e.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});let a=e.target.dataset.ord,s=e.clientX,l=e.clientY,h=i.x,c=i.y;if(a){let t=e.clientX-n.x,r=e.clientY-n.y,o=0,d=0;"ne"===a||"e"==a?(o=t-(i.x+i.width),d=r-i.y,h=i.x,c=i.y+i.height):"se"===a||"s"===a?(o=t-(i.x+i.width),d=r-(i.y+i.height),h=i.x,c=i.y):"sw"===a||"w"==a?(o=t-i.x,d=r-(i.y+i.height),h=i.x+i.width,c=i.y):("nw"===a||"n"==a)&&(o=t-i.x,d=r-i.y,h=i.x+i.width,c=i.y+i.height),s=h+n.x+o,l=c+n.y+d}this.evData={startClientX:s,startClientY:l,startCropX:h,startCropY:c,clientX:e.clientX,clientY:e.clientY,isResize:!!a,ord:a},this.mouseDownOnCrop=!0,this.setState({cropIsActive:!0})};onComponentPointerDown=e=>{let{crop:t,disabled:r,locked:n,keepSelection:i,onChange:s}=this.props,l=this.getBox();if(r||n||i&&t)return;e.cancelable&&e.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});let h=e.clientX-l.x,c=e.clientY-l.y,d={unit:"px",x:h,y:c,width:0,height:0};this.evData={startClientX:e.clientX,startClientY:e.clientY,startCropX:h,startCropY:c,clientX:e.clientX,clientY:e.clientY,isResize:!0},this.mouseDownOnCrop=!0,s(o(d,l.width,l.height),a(d,l.width,l.height)),this.setState({cropIsActive:!0,newCropIsBeingDrawn:!0})};onDocPointerMove=e=>{let t,{crop:r,disabled:n,onChange:s,onDragStart:l}=this.props,h=this.getBox();if(n||!r||!this.mouseDownOnCrop)return;e.cancelable&&e.preventDefault(),this.dragStarted||(this.dragStarted=!0,l&&l(e));let{evData:c}=this;c.clientX=e.clientX,c.clientY=e.clientY,i(r,t=c.isResize?this.resizeCrop():this.dragCrop())||s(o(t,h.width,h.height),a(t,h.width,h.height))};onComponentKeyDown=t=>{let{crop:r,disabled:i,onChange:s,onComplete:l}=this.props;if(i)return;let h=t.key,c=!1;if(!r)return;let d=this.getBox(),u=this.makePixelCrop(d),m=(navigator.platform.match("Mac")?t.metaKey:t.ctrlKey)?e.nudgeStepLarge:t.shiftKey?e.nudgeStepMedium:e.nudgeStep;if("ArrowLeft"===h?(u.x-=m,c=!0):"ArrowRight"===h?(u.x+=m,c=!0):"ArrowUp"===h?(u.y-=m,c=!0):"ArrowDown"===h&&(u.y+=m,c=!0),c){t.cancelable&&t.preventDefault(),u.x=n(u.x,0,d.width-u.width),u.y=n(u.y,0,d.height-u.height);let e=o(u,d.width,d.height),r=a(u,d.width,d.height);s(e,r),l&&l(e,r)}};onHandlerKeyDown=(t,r)=>{var n,l;let h,{aspect:c=0,crop:d,disabled:u,minWidth:m=0,minHeight:g=0,maxWidth:p,maxHeight:f,onChange:w,onComplete:x}=this.props,y=this.getBox();if(u||!d||"ArrowUp"!==t.key&&"ArrowDown"!==t.key&&"ArrowLeft"!==t.key&&"ArrowRight"!==t.key)return;t.stopPropagation(),t.preventDefault();let b=(navigator.platform.match("Mac")?t.metaKey:t.ctrlKey)?e.nudgeStepLarge:t.shiftKey?e.nudgeStepMedium:e.nudgeStep,v=s((n=o(d,y.width,y.height),l=t.key,h={...n},"ArrowLeft"===l?"nw"===r?(h.x-=b,h.y-=b,h.width+=b,h.height+=b):"w"===r?(h.x-=b,h.width+=b):"sw"===r?(h.x-=b,h.width+=b,h.height+=b):"ne"===r?(h.y+=b,h.width-=b,h.height-=b):"e"===r?h.width-=b:"se"===r&&(h.width-=b,h.height-=b):"ArrowRight"===l&&("nw"===r?(h.x+=b,h.y+=b,h.width-=b,h.height-=b):"w"===r?(h.x+=b,h.width-=b):"sw"===r?(h.x+=b,h.width-=b,h.height-=b):"ne"===r?(h.y-=b,h.width+=b,h.height+=b):"e"===r?h.width+=b:"se"===r&&(h.width+=b,h.height+=b)),"ArrowUp"===l?"nw"===r?(h.x-=b,h.y-=b,h.width+=b,h.height+=b):"n"===r?(h.y-=b,h.height+=b):"ne"===r?(h.y-=b,h.width+=b,h.height+=b):"sw"===r?(h.x+=b,h.width-=b,h.height-=b):"s"===r?h.height-=b:"se"===r&&(h.width-=b,h.height-=b):"ArrowDown"===l&&("nw"===r?(h.x+=b,h.y+=b,h.width-=b,h.height-=b):"n"===r?(h.y+=b,h.height-=b):"ne"===r?(h.y+=b,h.width-=b,h.height-=b):"sw"===r?(h.x-=b,h.width+=b,h.height+=b):"s"===r?h.height+=b:"se"===r&&(h.width+=b,h.height+=b)),h),c,r,y.width,y.height,m,g,p,f);if(!i(d,v)){let e=a(v,y.width,y.height);w(v,e),x&&x(v,e)}};onDocPointerDone=e=>{let{crop:t,disabled:r,onComplete:n,onDragEnd:i}=this.props,s=this.getBox();this.unbindDocMove(),!(r||!t)&&this.mouseDownOnCrop&&(this.mouseDownOnCrop=!1,this.dragStarted=!1,i&&i(e),n&&n(o(t,s.width,s.height),a(t,s.width,s.height)),this.setState({cropIsActive:!1,newCropIsBeingDrawn:!1}))};onDragFocus=()=>{this.componentRef.current?.scrollTo(0,0)};getCropStyle(){let{crop:e}=this.props;if(e)return{top:`${e.y}${e.unit}`,left:`${e.x}${e.unit}`,width:`${e.width}${e.unit}`,height:`${e.height}${e.unit}`}}dragCrop(){let{evData:e}=this,t=this.getBox(),r=this.makePixelCrop(t),i=e.clientX-e.startClientX,a=e.clientY-e.startClientY;return r.x=n(e.startCropX+i,0,t.width-r.width),r.y=n(e.startCropY+a,0,t.height-r.height),r}getPointRegion(e,t,r,n){let{evData:i}=this,a=i.clientX-e.x,o=i.clientY-e.y,s;return s=n&&t?"nw"===t||"n"===t||"ne"===t:o<i.startCropY,(r&&t?"nw"===t||"w"===t||"sw"===t:a<i.startCropX)?s?"nw":"sw":s?"ne":"se"}resolveMinDimensions(e,t,r=0,n=0){let i=Math.min(r,e.width),a=Math.min(n,e.height);return t&&(i||a)?t>1?i?[i,i/t]:[a*t,a]:a?[a*t,a]:[i,i/t]:[i,a]}resizeCrop(){let{evData:t}=this,{aspect:r=0,maxWidth:i,maxHeight:a}=this.props,o=this.getBox(),[l,h]=this.resolveMinDimensions(o,r,this.props.minWidth,this.props.minHeight),c=this.makePixelCrop(o),d=this.getPointRegion(o,t.ord,l,h),u=t.ord||d,m=t.clientX-t.startClientX,g=t.clientY-t.startClientY;(l&&"nw"===u||"w"===u||"sw"===u)&&(m=Math.min(m,-l)),(h&&"nw"===u||"n"===u||"ne"===u)&&(g=Math.min(g,-h));let p={unit:"px",x:0,y:0,width:0,height:0};"ne"===d?(p.x=t.startCropX,p.width=m,r?p.height=p.width/r:p.height=Math.abs(g),p.y=t.startCropY-p.height):"se"===d?(p.x=t.startCropX,p.y=t.startCropY,p.width=m,r?p.height=p.width/r:p.height=g):"sw"===d?(p.x=t.startCropX+m,p.y=t.startCropY,p.width=Math.abs(m),r?p.height=p.width/r:p.height=g):"nw"===d&&(p.x=t.startCropX+m,p.width=Math.abs(m),r?(p.height=p.width/r,p.y=t.startCropY-p.height):(p.height=Math.abs(g),p.y=t.startCropY+g));let f=s(p,r,d,o.width,o.height,l,h,i,a);return r||e.xyOrds.indexOf(u)>-1?c=f:e.xOrds.indexOf(u)>-1?(c.x=f.x,c.width=f.width):e.yOrds.indexOf(u)>-1&&(c.y=f.y,c.height=f.height),c.x=n(c.x,0,o.width-c.width),c.y=n(c.y,0,o.height-c.height),c}renderCropSelection(){let{ariaLabels:r=e.defaultProps.ariaLabels,disabled:n,locked:i,renderSelectionAddon:a,ruleOfThirds:o,crop:s}=this.props,l=this.getCropStyle();if(s)return t.default.createElement("div",{style:l,className:"ReactCrop__crop-selection",onPointerDown:this.onCropPointerDown,"aria-label":r.cropArea,tabIndex:0,onKeyDown:this.onComponentKeyDown,role:"group"},!n&&!i&&t.default.createElement("div",{className:"ReactCrop__drag-elements",onFocus:this.onDragFocus},t.default.createElement("div",{className:"ReactCrop__drag-bar ord-n","data-ord":"n"}),t.default.createElement("div",{className:"ReactCrop__drag-bar ord-e","data-ord":"e"}),t.default.createElement("div",{className:"ReactCrop__drag-bar ord-s","data-ord":"s"}),t.default.createElement("div",{className:"ReactCrop__drag-bar ord-w","data-ord":"w"}),t.default.createElement("div",{className:"ReactCrop__drag-handle ord-nw","data-ord":"nw",tabIndex:0,"aria-label":r.nwDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"nw"),role:"button"}),t.default.createElement("div",{className:"ReactCrop__drag-handle ord-n","data-ord":"n",tabIndex:0,"aria-label":r.nDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"n"),role:"button"}),t.default.createElement("div",{className:"ReactCrop__drag-handle ord-ne","data-ord":"ne",tabIndex:0,"aria-label":r.neDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"ne"),role:"button"}),t.default.createElement("div",{className:"ReactCrop__drag-handle ord-e","data-ord":"e",tabIndex:0,"aria-label":r.eDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"e"),role:"button"}),t.default.createElement("div",{className:"ReactCrop__drag-handle ord-se","data-ord":"se",tabIndex:0,"aria-label":r.seDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"se"),role:"button"}),t.default.createElement("div",{className:"ReactCrop__drag-handle ord-s","data-ord":"s",tabIndex:0,"aria-label":r.sDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"s"),role:"button"}),t.default.createElement("div",{className:"ReactCrop__drag-handle ord-sw","data-ord":"sw",tabIndex:0,"aria-label":r.swDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"sw"),role:"button"}),t.default.createElement("div",{className:"ReactCrop__drag-handle ord-w","data-ord":"w",tabIndex:0,"aria-label":r.wDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"w"),role:"button"})),a&&t.default.createElement("div",{className:"ReactCrop__selection-addon",onPointerDown:e=>e.stopPropagation()},a(this.state)),o&&t.default.createElement(t.default.Fragment,null,t.default.createElement("div",{className:"ReactCrop__rule-of-thirds-hz"}),t.default.createElement("div",{className:"ReactCrop__rule-of-thirds-vt"})))}makePixelCrop(e){return o({...r,...this.props.crop||{}},e.width,e.height)}render(){let{aspect:e,children:r,circularCrop:n,className:i,crop:a,disabled:o,locked:s,style:l,ruleOfThirds:h}=this.props,{cropIsActive:c,newCropIsBeingDrawn:d}=this.state,u=a?this.renderCropSelection():null,m=((...e)=>e.filter(e=>e&&"string"==typeof e).join(" "))("ReactCrop",i,c&&"ReactCrop--active",o&&"ReactCrop--disabled",s&&"ReactCrop--locked",d&&"ReactCrop--new-crop",a&&e&&"ReactCrop--fixed-aspect",a&&n&&"ReactCrop--circular-crop",a&&h&&"ReactCrop--rule-of-thirds",!this.dragStarted&&a&&!a.width&&!a.height&&"ReactCrop--invisible-crop",n&&"ReactCrop--no-animate");return t.default.createElement("div",{ref:this.componentRef,className:m,style:l},t.default.createElement("div",{ref:this.mediaRef,className:"ReactCrop__child-wrapper",onPointerDown:this.onComponentPointerDown},r),a?t.default.createElement("svg",{className:"ReactCrop__crop-mask",width:"100%",height:"100%"},t.default.createElement("defs",null,t.default.createElement("mask",{id:`hole-${this.instanceId}`},t.default.createElement("rect",{width:"100%",height:"100%",fill:"white"}),n?t.default.createElement("ellipse",{cx:`${a.x+a.width/2}${a.unit}`,cy:`${a.y+a.height/2}${a.unit}`,rx:`${a.width/2}${a.unit}`,ry:`${a.height/2}${a.unit}`,fill:"black"}):t.default.createElement("rect",{x:`${a.x}${a.unit}`,y:`${a.y}${a.unit}`,width:`${a.width}${a.unit}`,height:`${a.height}${a.unit}`,fill:"black"}))),t.default.createElement("rect",{fill:"black",fillOpacity:.5,width:"100%",height:"100%",mask:`url(#hole-${this.instanceId})`})):void 0,u)}};e.s(["f",0,c],232660);let d={maxLongEdge:4096,maxPixels:4915200,maxBytes:1572864,startQuality:.9,minQuality:.8};class u extends Error{code;format;constructor(e,t,r){super(e,void 0===r?void 0:{cause:r}),this.code=e,this.format=t,this.name="ImageDecodeError"}}let m=new Set(["heic","heix","heim","heis","hevc","hevx","hevm","hevs"]),g=new Set(["mif1","msf1","mif2"]),p=new Set(["avif","avis"]);function f(e,t,r=d){let n=Math.min(1,r.maxLongEdge/Math.max(e,t),Math.sqrt(r.maxPixels/Math.max(1,e*t)));return{width:Math.max(1,Math.floor(e*n)),height:Math.max(1,Math.floor(t*n)),scale:n}}async function w(e){let t,r;if("function"==typeof createImageBitmap)try{return await createImageBitmap(e,{imageOrientation:"from-image"})}catch{}let n=await (t=URL.createObjectURL(e),(r=new Image).decoding="async",new Promise((e,n)=>{r.onload=()=>e(r),r.onerror=()=>n(Error("IMAGE_ELEMENT_DECODE_FAILED")),r.src=t}).finally(()=>URL.revokeObjectURL(t)));if(!n.naturalWidth||!n.naturalHeight)throw Error("IMAGE_EMPTY");return n}async function x(t){let{heicTo:r}=await e.A(462684);return r({blob:t,type:"image/jpeg",quality:.95})}function y(e,t){return new Promise((r,n)=>{e.toBlob(e=>e?r(e):n(Error("CANVAS_EMPTY")),"image/jpeg",t)})}function b(e,t,r,n,i,a,o){let s,l=((s=document.createElement("canvas")).width=a,s.height=o,s),h=l.getContext("2d");if(!h)throw Error("CANVAS_UNSUPPORTED");return h.fillStyle="#ffffff",h.fillRect(0,0,a,o),h.imageSmoothingEnabled=!0,h.imageSmoothingQuality="high",h.drawImage(e,t,r,n,i,0,0,a,o),l}async function v(e,t){var r;let n,i=performance.now(),a=await e.arrayBuffer(),o=performance.now()-i,s=function(e){let t=(t,r)=>String.fromCharCode(...e.subarray(t,r));if(e.length>=3&&255===e[0]&&216===e[1]&&255===e[2])return"jpeg";if(e.length>=8&&137===e[0]&&"PNG"===t(1,4))return"png";if(e.length>=12&&"RIFF"===t(0,4)&&"WEBP"===t(8,12))return"webp";if(e.length>=6&&("GIF87a"===t(0,6)||"GIF89a"===t(0,6)))return"gif";if(e.length>=2&&"BM"===t(0,2))return"bmp";if(e.length>=12&&"ftyp"===t(4,8)){let r=Math.min(e.length,(e[0]<<24|e[1]<<16|e[2]<<8|e[3])>>>0||e.length),n=[t(8,12)];for(let e=16;e+4<=r;e+=4)n.push(t(e,e+4));if(n.some(e=>m.has(e)))return"heic";if(n.some(e=>p.has(e)))return"avif";if(n.some(e=>g.has(e)))return"heic"}return"unknown"}(new Uint8Array(a,0,Math.min(a.byteLength,64))),l=e.type||"",h=performance.now(),c="native",d=new Blob([a],{type:l||"application/octet-stream"});try{n=await w(d)}catch(e){if("heic"!==s)throw new u("unknown"===s?"UNSUPPORTED_IMAGE":"IMAGE_DECODE_FAILED",s,e);t?.();try{n=await w(await x(d)),c="heic"}catch(e){throw new u("HEIC_DECODE_FAILED",s,e)}}let{width:v,height:C}=(r=n)instanceof HTMLImageElement?{width:r.naturalWidth,height:r.naturalHeight}:{width:r.width,height:r.height};if(!v||!C)throw new u("IMAGE_DECODE_FAILED",s);let j=f(v,C,{maxLongEdge:1600,maxPixels:1/0}),k=await y(b(n,0,0,v,C,j.width,j.height),.85),D=URL.createObjectURL(k),M=performance.now()-h;return{source:n,width:v,height:C,format:s,decoder:c,previewUrl:D,sourceType:l,sourceBytes:e.size,timings:{read:Math.round(o),convert:Math.round(M)},dispose:()=>{URL.revokeObjectURL(D),n instanceof HTMLImageElement||n.close()}}}let C={x:0,y:0,width:1,height:1};async function j(e,t=C,r=d){var n;let i=performance.now(),a=e=>Math.min(1,Math.max(0,e)),o=Math.round(a(t.x)*e.width),s=Math.round(a(t.y)*e.height),l=Math.max(1,Math.min(e.width-o,Math.round(a(t.width)*e.width))),h=Math.max(1,Math.min(e.height-s,Math.round(a(t.height)*e.height))),c=f(l,h,r),u=b(e.source,o,s,l,h,c.width,c.height),m=performance.now()-i,g=performance.now(),p=r.startQuality,w=await y(u,p);for(let t=0;w.size>r.maxBytes&&t<12;t++)p-.05>=r.minQuality-1e-9?p=Math.round((p-.05)*100)/100:(c={width:Math.max(1,Math.floor(.85*c.width)),height:Math.max(1,Math.floor(.85*c.height)),scale:.85*c.scale},u=b(e.source,o,s,l,h,c.width,c.height)),w=await y(u,p);return{dataUrl:await (n=w,new Promise((e,t)=>{let r=new FileReader;r.onload=()=>e(r.result),r.onerror=()=>t(r.error??Error("READ_FAILED")),r.readAsDataURL(n)})),width:c.width,height:c.height,bytes:w.size,quality:p,timings:{crop:Math.round(m),compress:Math.round(performance.now()-g)}}}e.s(["o",0,u,"N",0,function(e,t){return{sourceType:e.sourceType||e.format,sourceBytes:e.sourceBytes,sourceWidth:e.width,sourceHeight:e.height,outputWidth:t.width,outputHeight:t.height,outputBytes:t.bytes,decoder:e.decoder,quality:t.quality}},"p",0,v,"X",0,j],213761)},469937,62825,e=>{var t=e.i(843476),r=e.i(456420);let n={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"}]]};n.node;let i=(0,r.f)(n);var a=e.i(111110),o=e.i(975157);let s=[1,2,3,4,5];function l(e){return"not_attempted"===e||"wrong_attempt"===e||"unknown"===e?e:"unknown"}e.s(["f",0,function({value:e,onChange:r,disabled:n,size:l="sm",showUnrated:h=!0,className:c}){let{t:d}=(0,a.b)(),u=e??0,m="sm"===l?"h-3.5 w-3.5":"h-5 w-5",g=u?d.difficulty.starsLabel.replace("{n}",String(u)):d.difficulty.unrated;return r?(0,t.jsxs)("span",{className:(0,o.f)("inline-flex items-center gap-0.5",c),role:"group","aria-label":`${d.difficulty.label}${d.common.colon}${g}`,title:d.difficulty.clearHint,children:[s.map(e=>(0,t.jsx)("button",{type:"button",disabled:n,onClick:()=>r(e===u?null:e),"aria-label":d.difficulty.setStars.replace("{n}",String(e)),"aria-pressed":e<=u,className:"rounded p-0.5 hover:bg-muted disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:(0,t.jsx)(i,{className:(0,o.f)(m,e<=u?"fill-amber-400 text-amber-400":"text-muted-foreground/40")})},e)),!u&&h&&(0,t.jsx)("span",{className:"ml-1 text-xs text-muted-foreground",children:d.difficulty.unrated})]}):u?(0,t.jsx)("span",{className:(0,o.f)("inline-flex items-center",c),role:"img","aria-label":`${d.difficulty.label}${d.common.colon}${g}`,title:g,children:s.map(e=>(0,t.jsx)(i,{className:(0,o.f)(m,e<=u?"fill-amber-400 text-amber-400":"text-muted-foreground/30"),"aria-hidden":!0},e))}):h?(0,t.jsx)("span",{className:(0,o.f)("text-xs text-muted-foreground",c),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:"未判断"})[l(e)]},"h",0,l,"x",0,function(e,t){return(t||"").trim()?"wrong_attempt":l(e)}],62825)},12130,e=>{var t=e.i(843476),r=e.i(271645),n=e.i(232660),i=e.i(519455),a=e.i(776639),o=e.i(263676),s=e.i(111110);async function l(e,t){let{naturalWidth:r,naturalHeight:n}=e;return Promise.all(t.map(t=>new Promise((i,a)=>{let o=document.createElement("canvas"),s=Math.round(t.x*r),l=Math.round(t.y*n);o.width=Math.max(1,Math.round(t.width*r)),o.height=Math.max(1,Math.round(t.height*n));let h=o.getContext("2d");h?(h.drawImage(e,s,l,o.width,o.height,0,0,o.width,o.height),o.toBlob(e=>e?i(e):a(Error("Canvas is empty")),"image/jpeg",.95)):a(Error("Canvas is not supported"))})))}let h={maxHeight:"65vh",maxWidth:"100%",objectFit:"contain"},c=(0,r.forwardRef)(function({imageSrc:e,regions:n,onChange:i,imageStyle:a=h,onImageLoad:l},c){let{t:d}=(0,s.b)(),u=(0,r.useRef)(null),m=(0,r.useRef)(null),[g,p]=(0,r.useState)(null),f=e=>{let t=u.current.getBoundingClientRect();return{x:(e.clientX-t.left)/t.width,y:(e.clientY-t.top)/t.height}},w=()=>{g&&g.width>=.02&&g.height>=.02&&i([...n,g]),m.current=null,p(null)},x=e=>({left:`${100*e.x}%`,top:`${100*e.y}%`,width:`${100*e.width}%`,height:`${100*e.height}%`});return(0,t.jsxs)("div",{className:"relative inline-block select-none",children:[(0,t.jsx)("img",{ref:c,src:e,alt:"",draggable:!1,style:a,onLoad:l,className:"block"}),(0,t.jsxs)("div",{ref:u,className:"absolute inset-0 cursor-crosshair",style:{touchAction:"none"},onPointerDown:e=>{0===e.button&&(u.current?.setPointerCapture(e.pointerId),m.current=f(e),p(null))},onPointerMove:e=>{var t,r,n,i;let a,o,s;if(!m.current)return;let l=f(e);p((t=m.current.x,r=m.current.y,n=l.x,i=l.y,o=(a=e=>Math.min(1,Math.max(0,e)))(Math.min(t,n)),s=a(Math.min(r,i)),{x:o,y:s,width:a(Math.max(t,n))-o,height:a(Math.max(r,i))-s}))},onPointerUp:w,onPointerCancel:w,children:[n.map((e,r)=>(0,t.jsxs)("div",{className:"absolute border-2 border-sky-400 bg-sky-400/15",style:x(e),children:[(0,t.jsx)("span",{className:"absolute left-0 top-0 bg-sky-500 px-1.5 text-xs font-bold text-white",children:r+1}),(0,t.jsx)("button",{type:"button",className:"absolute -right-3 -top-3 flex h-6 w-6 items-center justify-center rounded-full bg-red-500 text-white shadow","aria-label":d.batchImport.removeRegion.replace("{index}",String(r+1)),onPointerDown:e=>e.stopPropagation(),onClick:()=>i(n.filter((e,t)=>t!==r)),children:(0,t.jsx)(o.X,{className:"h-3 w-3"})})]},r)),g&&(0,t.jsx)("div",{className:"absolute border-2 border-dashed border-yellow-300 bg-yellow-300/10",style:x(g)})]})]})});var d=e.i(456420);let u={name:"zoom-in",size:24,node:[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]};u.node;let m=(0,d.f)(u),g={name:"zoom-out",size:24,node:[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]};g.node;let p=(0,d.f)(g);function f({zoom:e,onZoomIn:r,onZoomOut:n,onReset:i}){let{t:a}=(0,s.b)(),o="outline-none focus-visible:ring-2 focus-visible:ring-white/70",l=`flex h-9 w-9 items-center justify-center rounded-full text-white transition-colors hover:bg-white/20 disabled:opacity-40 disabled:hover:bg-transparent ${o}`;return(0,t.jsxs)("div",{className:"flex items-center gap-0.5 rounded-full bg-black/60 p-1 shadow-lg backdrop-blur-sm",children:[(0,t.jsx)("button",{type:"button",className:l,onClick:n,disabled:e<=1,"aria-label":a.common.cropper.zoomOut,title:a.common.cropper.zoomOut,children:(0,t.jsx)(p,{className:"h-4 w-4"})}),(0,t.jsxs)("button",{type:"button",className:`h-9 min-w-14 rounded-full px-2 text-center text-xs font-medium tabular-nums text-white hover:bg-white/20 ${o}`,onClick:i,"aria-label":a.common.cropper.resetZoom,title:a.common.cropper.resetZoom,children:[Math.round(100*e),"%"]}),(0,t.jsx)("button",{type:"button",className:l,onClick:r,disabled:e>=5,"aria-label":a.common.cropper.zoomIn,title:a.common.cropper.zoomIn,children:(0,t.jsx)(m,{className:"h-4 w-4"})})]})}var w=e.i(201276);let x={single:{maxHeight:"70vh",maxWidth:"100%",objectFit:"contain"},auto:{maxHeight:"65vh",maxWidth:"100%",objectFit:"contain"},multi:{maxHeight:"65vh",maxWidth:"100%",objectFit:"contain"}};e.s(["f",0,function({imageSrc:e,open:o,onClose:h,onCropComplete:d,onMultiCropComplete:u,onRegionsSelected:m,allowMulti:g=!0,onAutoSplit:p,onAddPart:y,partCount:b=0}){let{t:v}=(0,s.b)(),C=/^(blob:|data:image\/)/i.test(e)?e:void 0,[j,k]=(0,r.useState)(),D=(0,r.useRef)(null),[M,E]=(0,r.useState)("single"),{containerRef:N,zoom:R,imageStyle:S,measureImage:L,zoomIn:I,zoomOut:_,reset:P}=function(e){let[t,n]=(0,r.useState)(null),i=(0,r.useRef)(null),a=(0,r.useCallback)(e=>{i.current=e,n(e)},[]),[o,s]=(0,r.useState)(1),l=(0,r.useRef)(1),[h,c]=(0,r.useState)(null),d=(0,r.useRef)(null),u=(0,r.useRef)(!1),m=(0,r.useCallback)((e,t,r)=>{let n=i.current,a=l.current,o=Math.min(5,Math.max(1,e));if(!n||o===a)return;if(1===a){let e=n.querySelector("img");e&&c(e.clientWidth)}let h=n.getBoundingClientRect(),u=(t??h.left+h.width/2)-h.left,m=(r??h.top+h.height/2)-h.top;d.current={viewX:u,viewY:m,contentX:n.scrollLeft+u,contentY:n.scrollTop+m,ratio:o/a},l.current=o,s(o)},[]);(0,r.useLayoutEffect)(()=>{let e=i.current,t=d.current;e&&t&&(e.scrollLeft=t.contentX*t.ratio-t.viewX,e.scrollTop=t.contentY*t.ratio-t.viewY,d.current=null)},[o]),(0,r.useEffect)(()=>{if(!t)return;let e=e=>{e.preventDefault(),m(l.current*Math.exp(-(.0015*e.deltaY)),e.clientX,e.clientY)},r=null,n=e=>{let[t,r]=[e[0],e[1]];return{distance:Math.hypot(t.clientX-r.clientX,t.clientY-r.clientY),centerX:(t.clientX+r.clientX)/2,centerY:(t.clientY+r.clientY)/2}},i=e=>{2===e.touches.length&&(r={distance:n(e.touches).distance,zoom:l.current},u.current=!0)},a=e=>{if(!r||2!==e.touches.length)return;e.preventDefault();let{distance:t,centerX:i,centerY:a}=n(e.touches);r.distance>0&&m(r.zoom*(t/r.distance),i,a)},o=e=>{e.touches.length<2&&(r=null,u.current=!1)},s=e=>{u.current&&e.stopPropagation()};return t.addEventListener("wheel",e,{passive:!1}),t.addEventListener("touchstart",i,{passive:!0}),t.addEventListener("touchmove",a,{passive:!1}),t.addEventListener("touchend",o),t.addEventListener("touchcancel",o),t.addEventListener("pointermove",s,{capture:!0}),()=>{t.removeEventListener("wheel",e),t.removeEventListener("touchstart",i),t.removeEventListener("touchmove",a),t.removeEventListener("touchend",o),t.removeEventListener("touchcancel",o),t.removeEventListener("pointermove",s,{capture:!0})}},[t,m]);let g=(0,r.useCallback)(e=>{e&&1===l.current&&c(e.clientWidth)},[]),p=(0,r.useCallback)(()=>m(1.25*l.current),[m]),f=(0,r.useCallback)(()=>m(l.current/1.25),[m]),w=(0,r.useCallback)(()=>{l.current=1,d.current=null,s(1)},[]),x=1!==o&&h?{...e,width:h*o,height:"auto",maxWidth:"none",maxHeight:"none"}:e;return{containerRef:a,zoom:o,imageStyle:x,measureImage:g,zoomIn:p,zoomOut:f,reset:w}}(x[M]);(0,r.useEffect)(()=>{P()},[e,P]);let[$,H]=(0,r.useState)({src:e,regions:[]}),A=$.src===e?$.regions:[],z=t=>H({src:e,regions:t}),B=(0,r.useRef)(null),Y=["single",...p?["auto"]:[],...u||m&&g?["multi"]:[]],X={single:v.batchImport.singleMode,auto:v.batchImport.autoMode,multi:v.batchImport.multiMode},O=async()=>{if(0!==A.length){if(m){m(A,!0),z([]);return}if(B.current&&u)try{u(await l(B.current,A)),z([])}catch(e){w.V.error("[ImageCropper]","Multi-image crop failed",{error:e})}}},U=()=>j&&j.width>0&&j.height>0?{x:j.x/100,y:j.y/100,width:j.width/100,height:j.height/100}:{x:0,y:0,width:1,height:1},K=async()=>{let e=U();if("auto"===M&&p)return void p(e);if(m)return void m([e],!1);if(D.current&&d)try{let[t]=await l(D.current,[e]);d(t)}catch(e){w.V.error("[ImageCropper]","Crop failed",{error:e})}};return(0,t.jsx)(a.N,{open:o,onOpenChange:e=>!e&&h(),children:(0,t.jsxs)(a.d,{className:"max-w-3xl h-[90vh] flex flex-col p-0 gap-0",children:[(0,t.jsx)(a.s,{className:"p-4 border-b shrink-0",children:(0,t.jsx)(a.F,{children:v.common.cropper?.title||"Crop Image"})}),(0,t.jsxs)("div",{className:"relative min-h-0 flex-1 bg-black",children:[(0,t.jsx)("div",{ref:N,className:"flex h-full w-full overflow-auto p-4",children:(0,t.jsx)("div",{className:"m-auto",children:"multi"===M?(0,t.jsx)(c,{ref:B,imageSrc:C,regions:A,onChange:z,imageStyle:S,onImageLoad:e=>L(e.currentTarget)}):(0,t.jsx)(n.f,{crop:j,onChange:(e,t)=>k(t),children:(0,t.jsx)("img",{ref:D,alt:"Crop me",src:C,onLoad:function(e){k({unit:"%",x:0,y:0,width:100,height:100}),L(e.currentTarget)},style:S})})})}),(0,t.jsx)("div",{className:"absolute right-3 top-3",children:(0,t.jsx)(f,{zoom:R,onZoomIn:I,onZoomOut:_,onReset:P})})]}),(0,t.jsxs)("div",{className:"p-4 border-t bg-background shrink-0 space-y-3",children:[Y.length>1&&(0,t.jsx)("div",{className:`grid gap-1 rounded-md bg-muted p-1 ${3===Y.length?"grid-cols-3 sm:w-[28rem]":"grid-cols-2 sm:w-80"}`,children:Y.map(e=>(0,t.jsx)("button",{type:"button","aria-pressed":M===e,onClick:()=>{P(),E(e)},className:`rounded px-2 py-1.5 text-sm font-medium transition-colors ${M===e?"bg-background shadow-sm":"text-muted-foreground"}`,children:X[e]},e))}),(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row sm:justify-between sm:items-center gap-3",children:[(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:"multi"===M?`${v.batchImport.hint} ${v.batchImport.regionCount.replace("{count}",String(A.length))}`:"auto"===M?v.batchImport.autoHint:b>0?v.upload.parts.cropHint.replace("{n}",String(b+1)):v.common.cropper?.hint||"💡 Drag to adjust crop area"}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2 justify-end",children:["multi"===M&&A.length>0&&(0,t.jsx)(i.f,{variant:"ghost",onClick:()=>z([]),children:v.batchImport.clear}),(0,t.jsx)(i.f,{variant:"outline",onClick:h,children:v.common.cancel||"Cancel"}),"multi"===M?(0,t.jsx)(i.f,{onClick:O,disabled:0===A.length,children:v.batchImport.start.replace("{count}",String(A.length))}):(0,t.jsxs)(t.Fragment,{children:["single"===M&&y&&(0,t.jsx)(i.f,{variant:"secondary",onClick:()=>y(U()),"data-testid":"crop-add-part",children:v.upload.parts.addNext}),(0,t.jsx)(i.f,{onClick:K,children:"auto"===M?v.batchImport.autoStart:b>0?v.upload.parts.confirm.replace("{count}",String(b+1)):v.common.confirm||"Confirm"})]})]})]})]})]})})}],12130)},141176,e=>{var t=e.i(843476),r=e.i(271645),n=e.i(456420);let i={name:"code-xml",size:24,node:[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],aliases:["code-2"]};i.node;let a=(0,n.f)(i);var o=e.i(772382),s=e.i(511445),l=e.i(624687),h=e.i(111110),c=e.i(975157);e.s(["f",0,function({value:e,onChange:n,className:i,...d}){let{t:u}=(0,h.b)(),[m,g]=(0,r.useState)("source"),p=(0,r.useId)(),f=[{mode:"source",label:u.markdownEditor.source,icon:a},{mode:"preview",label:u.markdownEditor.preview,icon:o.f}];return(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("div",{role:"tablist","aria-label":u.markdownEditor.modeLabel,className:"flex justify-end",children:(0,t.jsx)("div",{className:"inline-flex rounded-md border bg-muted/40 p-0.5",children:f.map(({mode:e,label:r,icon:n})=>(0,t.jsxs)("button",{type:"button",role:"tab","aria-selected":m===e,"aria-controls":p,onClick:()=>g(e),className:(0,c.f)("flex items-center gap-1 rounded px-2.5 py-1 text-xs transition-colors",m===e?"bg-background font-medium shadow-sm":"text-muted-foreground hover:text-foreground"),children:[(0,t.jsx)(n,{className:"h-3.5 w-3.5"}),r]},e))})}),(0,t.jsx)("div",{id:p,role:"tabpanel",children:"source"===m?(0,t.jsx)(l.f,{value:e,onChange:e=>n(e.target.value),className:i,...d}):(0,t.jsx)("div",{className:"min-h-24 cursor-text rounded-md border bg-muted/20 px-3 py-2",onDoubleClick:()=>g("source"),title:u.markdownEditor.doubleClickToEdit,children:e.trim()?(0,t.jsx)(s.f,{content:e}):(0,t.jsx)("p",{className:"text-sm italic text-muted-foreground",children:u.markdownEditor.empty})})})]})}],141176)},438465,674166,e=>{var t=e.i(843476),r=e.i(271645),n=e.i(967489),i=e.i(856423),a=e.i(41931),o=e.i(201276),s=e.i(111110);e.s(["f",0,function({value:e,onChange:l,className:h}){let[c,d]=(0,r.useState)([]),{t:u}=(0,s.b)();return(0,r.useEffect)(()=>{(async()=>{try{let e=await a.k.get("/api/notebooks");d(e)}catch(e){o.V.error("[NotebookSelector]","Failed to fetch notebooks",{error:e})}})()},[]),(0,t.jsxs)(n.d,{value:e,onValueChange:l,children:[(0,t.jsx)(n.P,{className:h,children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(i.f,{className:"h-4 w-4 text-muted-foreground"}),(0,t.jsx)(n.U,{placeholder:u.notebooks?.selector?.placeholder||"Select Notebook"})]})}),(0,t.jsx)(n.r,{children:0===c.length?(0,t.jsx)("div",{className:"p-2 text-sm text-muted-foreground text-center",children:u.notebooks?.selector?.empty||"No notebooks available"}):c.map(e=>(0,t.jsx)(n.T,{value:e.id,children:e.name},e.id))})]})}],438465);var l=e.i(664030);e.s(["f",0,function({value:e,onChange:r,disabled:i}){let{groups:a,loading:o}=(0,l.f)(),s=a.filter(e=>e.isActive);return(0,t.jsxs)(n.d,{value:e,onValueChange:r,disabled:i||o,children:[(0,t.jsx)(n.P,{children:(0,t.jsx)(n.U,{placeholder:"选择卷别"})}),(0,t.jsx)(n.r,{children:s.map(e=>(0,t.jsx)(n.T,{value:e.id,children:e.name},e.id))})]})}],674166)},149704,e=>{var t=e.i(843476),r=e.i(111110),n=e.i(398019),i=e.i(184110),a=e.i(975157);let o={left:"mr-auto",center:"mx-auto",right:"ml-auto"};e.s(["f",0,function({svg:e,scale:s,align:l,className:h}){let{t:c}=(0,r.b)();if(!e)return null;let d=(0,i.V)(s),u=(0,i.o)(l);return(0,t.jsx)("figure",{className:(0,a.f)("question-figure my-3",h),children:(0,t.jsx)("img",{src:(0,n.f)(e),alt:c.figure.alt,className:(0,a.f)(o[u],"block h-auto max-w-full rounded border bg-white p-2"),style:{..."left"===u?{marginLeft:0,marginRight:"auto"}:"right"===u?{marginLeft:"auto",marginRight:0}:{},maxHeight:360,zoom:d/100,maxWidth:`${Math.min(d,100)}%`}})})}])},574041,e=>{var t=e.i(843476),r=e.i(271645),n=e.i(263676),i=e.i(487486),a=e.i(793479),o=e.i(41931),s=e.i(201276);e.s(["f",0,function({value:e=[],onChange:l,placeholder:h="Enter tags...",className:c="",enterHint:d,subject:u,gradeStage:m}){let[g,p]=(0,r.useState)(""),[f,w]=(0,r.useState)([]),[x,y]=(0,r.useState)(!1),[b,v]=(0,r.useState)(0),C=(0,r.useRef)(null),j=(0,r.useRef)(null),k=(0,r.useCallback)(async t=>{try{let r=new URLSearchParams({q:t});u&&r.append("subject",u),m&&r.append("stage",m);let n=((await o.k.get(`/api/tags/suggestions?${r.toString()}`)).suggestions||[]).filter(t=>!e.includes(t));w(n.slice(0,20)),y(n.length>0),v(0)}catch(e){s.V.error("[TagInput]","Failed to fetch suggestions",{error:e})}},[u,m,e]);(0,r.useEffect)(()=>{g.trim()&&k(g)},[g,k]);let D=t=>{t.trim()&&!e.includes(t.trim())&&(l([...e,t.trim()]),p(""),w([]),y(!1),v(0))},M=t=>{l(e.filter(e=>e!==t))};return(0,r.useEffect)(()=>{let e=e=>{!j.current||j.current.contains(e.target)||C.current?.contains(e.target)||y(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),(0,t.jsxs)("div",{className:`relative ${c}`,children:[(0,t.jsxs)("div",{className:"flex flex-wrap gap-2 p-2 border rounded-lg bg-background min-h-[42px]",children:[e.map(e=>(0,t.jsxs)(i.f,{variant:"secondary",className:"flex items-center gap-1 px-2 py-1",children:[e,(0,t.jsx)("button",{type:"button",onClick:()=>M(e),className:"hover:text-destructive ml-1",children:(0,t.jsx)(n.X,{className:"h-3 w-3"})})]},e)),(0,t.jsx)(a.f,{ref:C,type:"text",value:g,onChange:e=>{p(e.target.value),e.target.value.trim()||(w([]),y(!1))},onKeyDown:t=>{"Enter"===t.key?(t.preventDefault(),b>=0&&f[b]?D(f[b]):g.trim()&&D(g)):"ArrowDown"===t.key?(t.preventDefault(),v(e=>Math.min(e+1,f.length-1))):"ArrowUp"===t.key?(t.preventDefault(),v(e=>Math.max(e-1,0))):"Escape"===t.key?(y(!1),v(0)):"Backspace"===t.key&&!g&&e.length>0&&M(e[e.length-1])},onFocus:()=>{f.length>0&&y(!0)},placeholder:0===e.length?h:"",className:"flex-1 min-w-[120px] border-none focus-visible:ring-0 focus-visible:ring-offset-0 h-8 px-0"})]}),x&&f.length>0&&(0,t.jsx)("div",{ref:j,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,r)=>(0,t.jsx)("div",{className:`px-3 py-2 cursor-pointer hover:bg-accent ${r===b?"bg-accent":""}`,onClick:()=>D(e),onMouseEnter:()=>v(r),children:e},e))}),g&&!x&&(0,t.jsx)("div",{className:"text-xs text-muted-foreground mt-1",children:d?`${d} "${g}"`:`Press Enter to create "${g}"`})]})}])},184110,e=>{let t=["left","center","right"],r="center";function n(e){return"number"==typeof e&&Number.isInteger(e)&&e>=10&&e<=200}e.s(["E",0,r,"n",0,100,"j",0,t,"a",0,200,"_",0,10,"x",0,n,"o",0,function(e){return"string"==typeof e&&t.includes(e)?e:r},"V",0,function(e){return n(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}])}])})();
|