wrong-notebook 2026.11.4-4 → 2026.11.4-5
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/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/api/analyze/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/figure/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/fix-latex/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/geogebra/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/reanswer/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/retag/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/svg-animation/narration/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/svg-animation/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/route.js.nft.json +1 -1
- package/.next/server/app/api/exams/[id]/questions/[questionId]/regenerate/route.js.nft.json +1 -1
- package/.next/server/app/api/exams/[id]/results/route.js.nft.json +1 -1
- package/.next/server/app/api/exams/[id]/retry/route.js.nft.json +1 -1
- package/.next/server/app/api/exams/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/exams/route.js.nft.json +1 -1
- package/.next/server/app/api/geogebra-analyze/route.js.nft.json +1 -1
- package/.next/server/app/api/import/route.js.nft.json +1 -1
- package/.next/server/app/api/import-batches/[id]/confirm-all/route.js.nft.json +1 -1
- package/.next/server/app/api/import-batches/[id]/fix-text/route.js.nft.json +1 -1
- package/.next/server/app/api/import-batches/[id]/read/route.js.nft.json +1 -1
- package/.next/server/app/api/import-batches/[id]/retry/route.js.nft.json +1 -1
- package/.next/server/app/api/import-batches/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/import-batches/[id]/start/route.js.nft.json +1 -1
- package/.next/server/app/api/import-batches/route.js.nft.json +1 -1
- package/.next/server/app/api/import-tasks/[id]/confirm/route.js.nft.json +1 -1
- package/.next/server/app/api/import-tasks/[id]/read/route.js.nft.json +1 -1
- package/.next/server/app/api/import-tasks/[id]/retry/route.js.nft.json +1 -1
- package/.next/server/app/api/import-tasks/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/import-tasks/route.js.nft.json +1 -1
- package/.next/server/app/api/notebooks/[id]/retag/route.js.nft.json +1 -1
- package/.next/server/app/api/openclaw/batch-upload/route.js.nft.json +1 -1
- package/.next/server/app/api/practice/generate/route.js.nft.json +1 -1
- package/.next/server/app/api/reanswer/route.js.nft.json +1 -1
- package/.next/server/app/api/tasks/route.js.nft.json +1 -1
- package/.next/server/app/api/tts/batch/route.js.nft.json +1 -1
- package/.next/server/app/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/page.js.nft.json +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/chunks/_0i58-g30ox5-8._.js +1 -1
- package/.next/server/chunks/ssr/src_app_exams_[id]_page_tsx_0xcjflkgkwzgd._.js +1 -1
- package/.next/server/chunks/ssr/src_app_page_tsx_1chiuahujsxm1._.js +1 -1
- package/.next/server/chunks/ssr/src_components_exam_exam-figure-scale-bar_tsx_1dxk6lzvp_d28._.js +1 -1
- package/.next/server/middleware-build-manifest.js +3 -3
- package/.next/server/pages/500.html +1 -1
- package/.next/static/chunks/{1y0cjudvnz4la.js → 02lw0b8i38sj3.js} +1 -1
- package/.next/static/chunks/1yg8trzska8uv.js +1 -0
- package/.next/static/chunks/{10hk15u8jc7o1.js → 3fj_icg91t5ar.js} +1 -1
- package/package.json +1 -1
- package/prisma/seed.db +0 -0
- package/.next/static/chunks/2acga0__tn9yl.js +0 -1
- /package/.next/static/{bFQJMw9c1NJ6NSOY8pN2N → isKicFguXFifPUwKaqFfK}/_buildManifest.js +0 -0
- /package/.next/static/{bFQJMw9c1NJ6NSOY8pN2N → isKicFguXFifPUwKaqFfK}/_clientMiddlewareManifest.js +0 -0
- /package/.next/static/{bFQJMw9c1NJ6NSOY8pN2N → isKicFguXFifPUwKaqFfK}/_ssgManifest.js +0 -0
|
@@ -3,4 +3,4 @@ $$
|
|
|
3
3
|
${i}
|
|
4
4
|
$$
|
|
5
5
|
`:`$${i}$`:eI},...t,image:u},c={relationships:i.relationships,files:i.files,mathCollector:s},m=new ev(i.numbering,i.styles),f=(function(e,t,r,n){let i=e.getElementsByTagNameNS(e4,"body")[0];if(!i)return[];let a=[],s=e=>{for(let i of Array.from(e.childNodes))if(i.nodeType===i.ELEMENT_NODE&&i.namespaceURI===e4)if("p"===i.localName){let e=eL(i,r,n),s=t.resolveNumPr(i),o=s?t.paragraphNumber(s[0],s[1]):null,l=o?.trim()??"",u=/[.、.。::)))]\s*$/.test(l),d=l?u?l:`${l} `:"";a.push(`${d}${e}`)}else if("tbl"===i.localName)for(let e of Array.from(i.getElementsByTagNameNS(e4,"tr"))){let t=function e(t,r={},n={relationships:{},files:{}}){let i=[];for(let a of Array.from(t.childNodes))a.nodeType===a.ELEMENT_NODE&&e$(a,ek,"tc")&&i.push((function(t,r={},n={relationships:{},files:{}}){let i=[];for(let a of Array.from(t.childNodes))if(a.nodeType===a.ELEMENT_NODE){if(e$(a,ek,"p")){let e=eL(a,r,n);e.trim()&&i.push(e)}else if(e$(a,ek,"tbl"))for(let t of function(t,r={},n={relationships:{},files:{}}){let i=[];for(let a of Array.from(t.childNodes))a.nodeType===a.ELEMENT_NODE&&e$(a,ek,"tr")&&i.push(e(a,r,n));return i}(a,r,n))t.trim()&&i.push(t)}return i.join(" ")})(a,r,n).trim());return i.join(" ")}(e,r,n);t.trim()&&a.push(t)}else"sdt"===i.localName&&s(i)};return s(i),a})(i.document,m,d,c).join("\n"),g=(0,ex.J)(f,r),h=[];if(g.ignored.length>0&&h.push((n=g.ignored.length,`IGNORED_PARAGRAPHS:${n}`)),g.detected||1!==g.questions.length||h.push("SINGLE_QUESTION"),s.unsupported.size>0){let e=Array.from(s.unsupported).slice(0,10).join(",");h.push(`MATH_UNSUPPORTED:${e}`)}if(s.oleCount>0&&h.push(`OLE_EQUATION:${s.oleCount}`),o.unsupported.size>0){let e=Array.from(o.unsupported).slice(0,10).join(",");h.push(`IMAGE_UNSUPPORTED:${e}`)}let p=eh(g.questions.map(e=>{var t;let r,n,i,a;return t=o.images,r=[e.text,e.material,e.answer,e.analysis],n=[],i=r.map(e=>{let r;if(!e)return e;let{text:i,usedIndexes:a}=(r=[],{text:e.replace(/⟦IMG:(\d+)⟧/g,(e,n)=>{let i=parseInt(n,10);return i>=0&&i<t.length&&!r.includes(i)&&r.push(i),"[图片]"}),usedIndexes:r});return n.push(...a),i}),a=Array.from(new Set(n)).sort((e,t)=>e-t).filter(e=>e<t.length).map(e=>({dataUrl:t[e]})),{...e,text:i[0]??e.text,material:i[1]??e.material,answer:i[2]??e.answer,analysis:i[3]??e.analysis,...a.length>0?{images:a}:{}}}).map(e8));return{questions:p.questions,errors:p.errors,warnings:[...h,...p.warnings]}}let e7="option_",e9=["A","B","C","D","E","F"],te={题干:"text",题目:"text",题目内容:"text",题目文本:"text",question:"text",text:"text",stem:"text",材料:"material",阅读材料:"material",material:"material",大题:"section",题型分组:"section",section:"section",题号:"label",序号:"label",no:"label",label:"label",number:"label",答案:"answer",参考答案:"answer",正确答案:"answer",answer:"answer",解析:"analysis",答案解析:"analysis",分析:"analysis",详解:"analysis",analysis:"analysis",explanation:"analysis",知识点:"knowledgePoints",考点:"knowledgePoints",knowledge:"knowledgePoints",knowledgepoints:"knowledgePoints",tags:"knowledgePoints",难度:"difficultyStars",难度星级:"difficultyStars",difficulty:"difficultyStars",difficultystars:"difficultyStars",错答:"wrongAnswer",我的答案:"wrongAnswer",学生答案:"wrongAnswer",wronganswer:"wrongAnswer",学科:"subject",科目:"subject",subject:"subject",年级:"gradeSemester",年级学期:"gradeSemester",grade:"gradeSemester",gradesemester:"gradeSemester",来源:"source",出处:"source",source:"source",题型:"questionType",type:"questionType",questiontype:"questionType"};function tt(e){return null==e?"":"string"==typeof e?e:"number"==typeof e?(Number.isInteger(e),String(e)):"boolean"==typeof e?e?"TRUE":"FALSE":e instanceof Date?e.toISOString().slice(0,10):String(e)}function tr(e,t,r){for(let n=0;n<e.length;n++)if(e[n].field===r)return tt(t[n]).trim();return""}function tn(e,t){let r=[],n=[];if(!e||0===e.length)return{questions:[],errors:[{index:-1,reason:"EMPTY_TABLE"}],warnings:r};let i=-1,a=null,s=Math.min(5,e.length);for(let t=0;t<s;t++){let r=function(e){let t=[],r=!1;for(let n of e){let e=String(n),i=function(e){let t=e.trim().toLowerCase();return(t=(t=t.replace(/[ ]/g,"")).replace(/[A-Za-z0-9]/g,e=>{let t=e.charCodeAt(0);return t>=65281&&t<=65374?String.fromCharCode(t-65248):e})).replace(/[\s ]+/g,"")}(e);if(!i)continue;let a=te[i];if(a){"text"===a&&(r=!0),t.push({field:a,rawName:e});continue}let s=function(e){let t=e.match(/^(?:选项|选择|choice|option)([a-f])$/);return t?e9.indexOf(t[1].toUpperCase()):/^[a-f]$/.test(e)?e9.indexOf(e.toUpperCase()):null}(i);if(null!==s&&s<6){t.push({field:`${e7}${s}`,rawName:e});continue}t.push({field:"unknown",rawName:e})}return r?t:null}(e[t].map(e=>tt(e)));if(r){i=t,a=r;break}}if(-1===i||!a)return{questions:[],errors:[{index:-1,reason:"TEXT_COLUMN_NOT_FOUND"}],warnings:r};for(let e of a.filter(e=>"unknown"===e.field))r.push(`UNKNOWN_COLUMN:${e.rawName}`);let o=-1;for(let e of a)"string"==typeof e.field&&e.field.startsWith(e7)&&(o=Math.max(o,Number(e.field.slice(e7.length))));let l=[];for(let r=i+1;r<e.length;r++){let s=e[r];if(s.every(e=>""===tt(e).trim()))continue;let o=tr(a,s,"text");if(!o){n.push({index:r-i-1,reason:`TEXT_REQUIRED:row=${r-i}`});continue}let u={text:o},d=tr(a,s,"material");d&&(u.material=d);let c=tr(a,s,"section");c?u.section=c:t&&(u.section=t);let m=tr(a,s,"label");m&&(u.label=m);let f=tr(a,s,"answer");f&&(u.answer=f);let g=tr(a,s,"analysis");g&&(u.analysis=g);let h=tr(a,s,"knowledgePoints");h&&(u.knowledgePoints=h.split(/[、,,;;]/).map(e=>e.trim()).filter(Boolean));let p=tr(a,s,"difficultyStars");if(p){let e=function(e){let t=e.trim();if(!t)return null;let r=t.match(/^([★☆]+)$/);if(r){let e=r[1].split("").filter(e=>"★"===e).length;return e>=1&&e<=5?e:null}let n=Number(t);if(!Number.isNaN(n))return n>=1&&n<=5&&Number.isInteger(n)?n:n>=0&&n<=1?n>=.8?1:n>=.6?2:n>=.4?3:n>=.2?4:5:null;return({易:1,较易:2,容易:1,中等:3,中:3,较难:4,难:5,困难:5})[t]??null}(p);null!==e&&(u.difficultyStars=e)}let x=tr(a,s,"wrongAnswer");x&&(u.wrongAnswer=x);let N=tr(a,s,"subject");N&&(u.subject=N);let y=tr(a,s,"gradeSemester");y&&(u.gradeSemester=y);let w=tr(a,s,"source");w&&(u.source=w);let b=tr(a,s,"questionType");b&&(u.questionType=b);let S=function(e,t){let r=[];for(let n=0;n<e.length;n++){let i=e[n].field;if("string"==typeof i&&i.startsWith(e7)){let e=Number(i.slice(e7.length)),a=tt(t[n]).trim();a&&(r[e]=a)}}return r.filter(e=>void 0!==e&&""!==e)}(a,s);if(S.length>0){let e=S.map((e,t)=>{let r=e9[t]??String(t+1);return`${r}.${e}`});u.text=`${o}
|
|
6
|
-
${e.join("\n")}`}l.push({raw:u,index:r-i-1})}let u=eh({format:ei,version:1,questions:l.map(e=>e.raw)}),d=[...n,...u.errors.map(e=>{let t=l[e.index];return{index:t?t.index:e.index,reason:e.reason}})].sort((e,t)=>e.index-t.index);return{questions:u.questions,errors:d,warnings:[...r,...u.warnings]}}async function ti(t){let{default:r}=await e.A(84955),n=await r(t),i=[],a=[],s=[],o=0;for(let e of n){let t=e.data;if(!t||0===t.length)continue;let r=t.some(e=>e.map(e=>String(e??"").trim().toLowerCase()).some(e=>{let t=e.replace(/[\s ]+/g,"");return"section"===t||"大题"===t||"题型分组"===t})),l=tn(t,n.length>1&&!r?e.sheet:void 0);for(let e of l.errors)a.push({index:-1===e.index?-1:e.index+o,reason:e.reason});s.push(...l.warnings.map(t=>`[${e.sheet}] ${t}`)),i.push(...l.questions),o+=l.questions.length}return{questions:i,errors:a,warnings:s}}let ta=/^[\s\-–—·..]*\d{1,4}[\s\-–—·..]*$/;function ts(e){return e.replace(/\uFB00/g,"ff").replace(/\uFB01/g,"fi").replace(/\uFB02/g,"fl").replace(/\uFB03/g,"ffi").replace(/\uFB04/g,"ffl").replace(/\u00A0/g," ").replace(/\u3000/g," ")}function to(e){let t=e.trim();if(!t)return null;if(ta.test(t))return{key:"",isPageNumberOnly:!0};let r=t.replace(/\d+/g,"").trim();return r?{key:r,isPageNumberOnly:!1}:null}function tl(e){if(!e)return!1;let t=e.charCodeAt(0);return t>=11904&&t<=40959||t>=63744&&t<=64255||t>=12288&&t<=12351||t>=65280&&t<=65519}let tu=null;function td(){return tu||(tu=(async()=>{let t=await e.A(825834);return t.GlobalWorkerOptions.workerSrc=new e.U(e.r(979463)).toString(),t})()),tu}function tc(e){let t={text:e.text};return e.material&&(t.material=e.material),e.section&&(t.section=e.section),e.label&&(t.label=e.label),e.answer&&(t.answer=e.answer),e.analysis&&(t.analysis=e.analysis),e.knowledgePoints?.length&&(t.knowledgePoints=e.knowledgePoints),null!==e.difficultyStars&&void 0!==e.difficultyStars&&(t.difficultyStars=e.difficultyStars),e.wrongAnswer&&(t.wrongAnswer=e.wrongAnswer),e.questionType&&(t.questionType=e.questionType),t}async function tm(e,t={}){var r;let n,i=t.pdfjs??await td(),a=new Uint8Array(e);try{n=await i.getDocument(t.standardFontDataUrl?{data:a,standardFontDataUrl:t.standardFontDataUrl,verbosity:0}:{data:a}).promise}catch(e){if("PasswordException"===(e instanceof Error?e.name:""))return{questions:[],errors:[{index:-1,reason:"PDF_ENCRYPTED"}],warnings:[]};return{questions:[],errors:[{index:-1,reason:"INVALID_PDF"}],warnings:[]}}let s=[],o=[],l=0,u=0,d=[];try{l=n.numPages;for(let e=1;e<=l;e++){let t=await n.getPage(e),r=t.getViewport({scale:1});o.push({width:r.width,height:r.height});let i=await t.getTextContent(),a=0;for(let t of i.items){if(!("str"in t))continue;let r=ts(t.str);if(!r.trim())continue;let[n,,,,i,o]=t.transform,l=Math.abs(n)||1;s.push({str:r,x:i,y:o,width:t.width*l,height:t.height,page:e});let d=r.trim().length;a+=d,u+=d}d.push(a)}}catch(t){let e=t instanceof Error?t.name:"";if("PasswordException"===e)return{questions:[],errors:[{index:-1,reason:"PDF_ENCRYPTED"}],warnings:[]};return{questions:[],errors:[{index:-1,reason:"INVALID_PDF"}],warnings:[]}}finally{try{await n.cleanup()}catch{}}if(0===l||u/Math.max(l,1)<20)return{questions:[],errors:[{index:-1,reason:"PDF_NO_TEXT_LAYER"}],warnings:[`PAGES:${l}`]};let c=(function(e,t){let r=e.map(e=>({...e,str:ts(e.str)})).filter(e=>e.str.trim().length>0),n=function(e,t){let r=new Map;for(let t of e){let e=r.get(t.page)??[];e.push(t),r.set(t.page,e)}let n=[];for(let[e,i]of r){let r=t.find((t,r)=>r+1===e),a=r?.height??0,s=[...i].sort((e,t)=>e.y-t.y||e.x-t.x),o=[];for(let e of s){let t=o[o.length-1],r=t?.[t.length-1],n=.5*Math.max(e.height,r?.height??0);t&&r&&Math.abs(e.y-r.y)<=n?t.push(e):o.push([e])}for(let t of o){t.sort((e,t)=>e.x-t.x);let r="",i=null;for(let e of t)i&&(!(e.x-(i.x+i.width)>.15*Math.max(e.height,i.height,1))||r.endsWith(" ")||e.str.startsWith(" ")||tl(r[r.length-1])||tl(e.str[0])||(r+=" ")),r+=e.str,i=e;let s=t.reduce((e,t)=>Math.max(e,t.height),0),o=t.reduce((e,t)=>e+t.y,0)/t.length;n.push({text:r.trimEnd(),x:t[0].x,yTop:a-o+s,height:s,page:e})}}return n}(r,t),i=function(e,t){let r=new Map,n=new Map;for(let t of e){let e=n.get(t.page)??[];e.push(t),n.set(t.page,e)}for(let[e,i]of n){let n=t.find((t,r)=>r+1===e);if(!n||n.width<=0)continue;let a=n.width/2,s=.06*n.width,o=i.filter(e=>e.x+e.width<=a+s).reduce((e,t)=>e+t.str.trim().length,0),l=i.filter(e=>e.x>=a-s).reduce((e,t)=>e+t.str.trim().length,0),u=o+l;!(u<1)&&!i.some(e=>e.x<a+s&&e.x+e.width>a-s)&&o>=.25*u&&l>=.25*u&&r.set(e,{width:n.width,height:n.height})}return r}(r,t),a=function(e,t){let r=[...new Set(e.map(e=>e.page))].filter(e=>e>=1);if(0===r.length)return[];let n=Math.max(2,Math.ceil(.5*(t.length||r.length))),i=new Map;for(let r of e){let e=t.find((e,t)=>t+1===r.page),n=e?.height??0;if(n<=0)continue;let a=r.yTop<=.15*n,s=r.yTop>=.92*n;if(!a&&!s||r.text.length>100)continue;let o=to(r.text);if(!o)continue;let l=`${a?"H":"F"}:${o.key}:${o.isPageNumberOnly?"#":"*"}`,u=i.get(l);u?(u.pages.add(r.page),u.minYTop=Math.min(u.minYTop,r.yTop),u.maxYTopBottom=Math.max(u.maxYTopBottom,r.yTop)):i.set(l,{key:o.key,pages:new Set([r.page]),isPageNumberOnly:o.isPageNumberOnly,minYTop:r.yTop,maxYTopBottom:r.yTop})}return[...i.values()].filter(e=>e.pages.size>=n)}(n,t),s=new Set;for(let e of a)for(let t of n){if(t.page<1||!e.pages.has(t.page))continue;let r=to(t.text);r?.key===e.key&&(!e.isPageNumberOnly||r.isPageNumberOnly)&&t.yTop>=e.minYTop&&t.yTop<=e.maxYTopBottom&&s.add(t)}return n.filter(e=>!s.has(e)).sort((e,t)=>e.page-t.page||e.yTop-t.yTop||e.x-t.x).map(e=>{let t=i.get(e.page);if(!t)return e;let r=t.width/2;return{...e,yTop:e.x>=r?e.yTop+t.height:e.yTop}}).sort((e,t)=>e.page-t.page||e.yTop-t.yTop||e.x-t.x)})(s,o).map(e=>e.text).join("\n"),m=(0,ex.J)(c,t.splitOptions),f=[`PAGES:${l}`],g=d.filter(e=>0===e).length;g>0&&f.push(`EMPTY_PAGES:${g}`),m.ignored.length>0&&f.push((r=m.ignored.length,`IGNORED_PARAGRAPHS:${r}`)),m.detected||1!==m.questions.length||f.push("SINGLE_QUESTION");let h=eh(m.questions.map(tc));return{questions:h.questions,errors:h.errors,warnings:[...f,...h.warnings]}}let tf={maxLength:ex.f,maxQuestions:ex.k},tg={maxLength:ex.f,maxQuestions:ex.k},th={json:e=>ep(e.buffer),docx:e=>e3(e.buffer,{},tf),xlsx:e=>ti(e.buffer),csv:async function(e){let t,{text:r}=(0,R.n)(e.buffer),{rows:n}=(t=function(e){let t=e.split(/\r?\n/,1)[0]??"",r=",",n=0;for(let e of[",",";"," "]){let i=t.split(e).length-1;i>n&&(n=i,r=e)}return r}(r),{rows:function(e,t){let r=[],n=[],i="",a=!1,s=0;for(65279===e.charCodeAt(0)&&(s=1);s<e.length;){let o=e[s];if(a){'"'===o?'"'===e[s+1]?(i+='"',s+=2):(a=!1,s+=1):(i+=o,s+=1);continue}if('"'===o&&""===i){a=!0,s+=1;continue}if(o===t){n.push(i),i="",s+=1;continue}if("\r"===o){"\n"===e[s+1]&&(s+=1),n.push(i),i="",r.push(n),n=[],s+=1;continue}if("\n"===o){n.push(i),i="",r.push(n),n=[],s+=1;continue}i+=o,s+=1}return(""!==i||n.length>0)&&(n.push(i),r.push(n)),r.filter(e=>e.some(e=>""!==e.trim()))}(r,t),delimiter:t});return tn(n)},pdf:e=>tm(e.buffer,{splitOptions:tg})};function tp(){let e=(e,t)=>{let r=document.createElement("canvas");return r.width=e,r.height=t,r},t=(e,t,r)=>{e.fillStyle="#ffffff",e.fillRect(0,0,t,r)},r=(e,t)=>e.toDataURL("image/jpeg",t),n=e=>Math.floor(3*e.slice(e.indexOf(",")+1).length/4);return{async renderComposite(i,a){let s=e(a.canvasWidth,a.canvasHeight),o=s.getContext("2d");if(!o)throw Error("CANVAS_UNSUPPORTED");t(o,a.canvasWidth,a.canvasHeight),o.imageSmoothingEnabled=!0,o.imageSmoothingQuality="high";for(let e=0;e<i.length;e++){let t=a.placements[e];o.drawImage(i[e].source,0,0,i[e].width,i[e].height,0,t.y,t.width,t.height)}let l=r(s,.85),u=1;for(;n(l)>1048576&&u>.1;){u*=.85;let n=Math.max(1,Math.round(a.canvasWidth*u)),s=Math.max(1,Math.round(a.canvasHeight*u)),o=e(n,s),d=o.getContext("2d");if(!d)throw Error("CANVAS_UNSUPPORTED");t(d,n,s),d.imageSmoothingEnabled=!0,d.imageSmoothingQuality="high";for(let e=0;e<i.length;e++){let t=a.placements[e];d.drawImage(i[e].source,0,0,i[e].width,i[e].height,0,Math.round(t.y*u),Math.round(t.width*u),Math.round(t.height*u))}l=r(o,.85)}return l},async renderSingle(i,a,s){let o=function(e,t,r=1600){let n=Math.max(e,t);if(n<=r)return{width:e,height:t};let i=r/n;return{width:Math.max(1,Math.round(e*i)),height:Math.max(1,Math.round(t*i))}}(i.width,i.height,a),l=e(o.width,o.height),u=l.getContext("2d");if(!u)throw Error("CANVAS_UNSUPPORTED");t(u,o.width,o.height),u.imageSmoothingEnabled=!0,u.imageSmoothingQuality="high",u.drawImage(i.source,0,0,i.width,i.height,0,0,o.width,o.height);let d=r(l,.85),c=1;for(;n(d)>s&&c>.1;){c*=.85;let n=Math.max(1,Math.round(o.width*c)),a=Math.max(1,Math.round(o.height*c)),s=e(n,a),l=s.getContext("2d");if(!l)throw Error("CANVAS_UNSUPPORTED");t(l,n,a),l.imageSmoothingEnabled=!0,l.imageSmoothingQuality="high",l.drawImage(i.source,0,0,i.width,i.height,0,0,n,a),d=r(s,.85)}return d}}}async function tx(e,t=tp()){if(0===e.length)throw Error("NO_IMAGES");if(1===e.length)return t.renderSingle(e[0],1600,1048576);let r=function(e,t=16){let r=e.map(t=>{var r,n,i;return r=t.width,n=t.height,i=Math.max(...e.map(e=>e.width)),r<=0?{width:i,height:0}:{width:i,height:Math.max(1,Math.round(i/r*n))}}),{width:n,height:i}=function(e,t=16){return 0===e.length?{width:0,height:0}:{width:Math.max(...e.map(e=>e.width)),height:e.reduce((e,t)=>e+t.height,0)+t*(e.length-1)}}(r,t),a=function(e,t=16){let r=[],n=0;for(let i of e)r.push(n),n+=i.height+t;return r}(r,t);return{canvasWidth:n,canvasHeight:i,placements:r.map((e,t)=>({...e,y:a[t]}))}}(e.map(e=>({width:e.width,height:e.height})));return t.renderComposite(e,r)}async function tN(e){let t=atob(e.slice(e.indexOf(",")+1)),r=new Uint8Array(t.length);for(let e=0;e<t.length;e++)r[e]=t.charCodeAt(e);return createImageBitmap(new Blob([r],{type:e.slice(5,e.indexOf(";"))}))}async function ty(e){let t=await tN(e);return{source:t,width:t.width,height:t.height}}let tw=["subject","gradeSemester","source","figureSvg","extensions"],tb={subject:{zh:"学科",en:"subject"},gradeSemester:{zh:"年级学期",en:"gradeSemester"},source:{zh:"来源",en:"source"},figureSvg:{zh:"配图 SVG",en:"figureSvg"},extensions:{zh:"扩展字段",en:"extensions"}};async function tS(e,t={}){let{renderer:r,decodeFn:n,onProgress:i}=t,a=e.length,s=0,o=[];for(let t of e){let e={text:t.text,material:t.material??null,section:t.section??null,label:t.label??null,answer:t.answer??null,analysis:t.analysis??null,knowledgePoints:t.knowledgePoints?.length?t.knowledgePoints:null,difficultyStars:t.difficultyStars??null,wrongAnswer:t.wrongAnswer??null,questionType:t.questionType??null};if(t.images?.length&&r&&n)try{let i=await Promise.all(t.images.map(e=>n(e.dataUrl)));e.image=await tx(i,r)}catch{e.image=null}o.push(e),s+=1,i?.(s,a)}return o}let tv={UNKNOWN_COLUMN:{zh:e=>`未识别的列「${e}」,该列内容已忽略`,en:e=>`Unrecognized column "${e}"; its content was ignored`},IGNORED_PARAGRAPHS:{zh:e=>`${e} 个段落未计入题目(标题、说明等)`,en:e=>`${e} paragraph(s) not counted as questions (titles, notes, etc.)`},TEXT_REQUIRED:{zh:e=>e.startsWith("row=")?`第 ${e.slice(4)} 行缺少题干`:"缺少题干",en:e=>e.startsWith("row=")?`Row ${e.slice(4)} is missing question text`:"Question text is required"}},tT={INVALID_JSON:{zh:"不是合法的 JSON 文件,请检查文件内容",en:"Not a valid JSON file; please check the file content"},INVALID_DOCX:{zh:"无法读取该 Word 文件,文件可能已损坏或不是 .docx 格式",en:"Cannot read this Word file; it may be corrupted or not a .docx file"},LEGACY_DOC_NOT_SUPPORTED:{zh:"旧版 .doc 格式暂不支持,请在 Word 中另存为 .docx 后再导入",en:"Legacy .doc is not supported; please save it as .docx in Word and import again"},TEXT_COLUMN_NOT_FOUND:{zh:"未找到「题干」列,请使用题库模板或检查表头",en:'No "question text" column found; please use the question template or check the header row'},EMPTY_TABLE:{zh:"表格为空,没有可导入的题目",en:"The table is empty; there are no questions to import"},QUESTIONS_REQUIRED:{zh:"文件中没有题目(questions 为空)",en:"The file contains no questions (questions is empty)"},INVALID_QUESTION_SHAPE:{zh:"题目格式不正确(questions 应为题目数组)",en:'Invalid question format ("questions" should be an array of questions)'},PDF_NO_TEXT_LAYER:{zh:"这是扫描版 PDF(没有文字层),可在下方选择页码范围转为图片,由 AI 识别分题导入",en:"This is a scanned PDF (no text layer). You can select a page range below to convert it to images and import with AI recognition."},PDF_ENCRYPTED:{zh:"这是加密 PDF,暂不支持导入,请先去除密码后重试",en:"This PDF is password-protected and cannot be imported; please remove the password and try again"},INVALID_PDF:{zh:"无法读取该 PDF 文件,文件可能已损坏或不是有效的 PDF",en:"Cannot read this PDF file; it may be corrupted or not a valid PDF"}},tE={TEXT_REQUIRED:{zh:"缺少题干,已跳过",en:"Missing question text; skipped"},TEXT_TOO_LONG:{zh:"题干过长,已跳过",en:"Question text is too long; skipped"},MATERIAL_TOO_LONG:{zh:"公共材料过长,该题已跳过",en:"Shared material is too long; question skipped"},SECTION_TOO_LONG:{zh:"大题标题过长,该题已跳过",en:"Section title is too long; question skipped"},LABEL_TOO_LONG:{zh:"题号过长,该题已跳过",en:"Label is too long; question skipped"},ANSWER_TOO_LONG:{zh:"答案过长,该题已跳过",en:"Answer is too long; question skipped"},ANALYSIS_TOO_LONG:{zh:"解析过长,该题已跳过",en:"Analysis is too long; question skipped"},INVALID_DIFFICULTY:{zh:"难度值无效(应为 1~5),该题已跳过",en:"Invalid difficulty (should be 1–5); question skipped"},WRONG_ANSWER_TOO_LONG:{zh:"错答内容过长,该题已跳过",en:"Wrong answer is too long; question skipped"},SUBJECT_TOO_LONG:{zh:"学科字段过长,该题已跳过",en:"Subject is too long; question skipped"},GRADE_SEMESTER_TOO_LONG:{zh:"年级学期字段过长,该题已跳过",en:"Grade/semester is too long; question skipped"},SOURCE_TOO_LONG:{zh:"来源字段过长,该题已跳过",en:"Source is too long; question skipped"},QUESTION_TYPE_TOO_LONG:{zh:"题型字段过长,该题已跳过",en:"Question type is too long; question skipped"},KNOWLEDGE_POINT_TOO_LONG:{zh:"知识点过长,该题已跳过",en:"Knowledge point is too long; question skipped"},TOO_MANY_KNOWLEDGE_POINTS:{zh:"知识点数量超过上限,该题已跳过",en:"Too many knowledge points; question skipped"},INVALID_IMAGE_DATA_URL:{zh:"图片数据无效,该题已跳过",en:"Invalid image data; question skipped"},IMAGE_TOO_LARGE:{zh:"图片过大,该题已跳过",en:"Image is too large; question skipped"},TOO_MANY_IMAGES:{zh:"图片数量超过上限,该题已跳过",en:"Too many images; question skipped"},FIGURE_SVG_TOO_LONG:{zh:"配图 SVG 过长,该题已跳过",en:"Figure SVG is too long; question skipped"},INVALID_QUESTION_SHAPE:{zh:"题目格式不正确,该题已跳过",en:"Invalid question shape; skipped"}},tA={MISSING_FORMAT:{zh:"文件缺少 format 字段,已按题目交换格式解析",en:'The file is missing the "format" field; parsed as the question exchange format'},UNKNOWN_FORMAT:{zh:"format 字段不是已知的题目交换格式,已尝试按 v1 解析",en:'The "format" field is not the known exchange format; tried parsing as v1'},MISSING_VERSION:{zh:"文件缺少 version 字段,已按 v1 解析",en:'The file is missing the "version" field; parsed as v1'},UNSUPPORTED_VERSION:{zh:"文件版本高于当前支持的 v1,已按 v1 宽松规则解析",en:"The file version is newer than the supported v1; parsed with v1 tolerant rules"},TOO_MANY_QUESTIONS:{zh:"题目数量超过文件上限,超出部分已截断",en:"Question count exceeds the per-file limit; the rest was truncated"},SINGLE_QUESTION:{zh:"只识别出一道题;如果文件里有多道题,请检查题号格式",en:"Only one question was recognized; if the file has more, check the question numbering"}},tk={UNKNOWN_COLUMN:{zh:e=>`未识别的列「${e}」,该列内容已忽略`,en:e=>`Unrecognized column "${e}"; its content was ignored`},IGNORED_PARAGRAPHS:{zh:e=>`${e} 个段落未计入题目(标题、说明等)`,en:e=>`${e} paragraph(s) not counted as questions (titles, notes, etc.)`},IMAGE_UNSUPPORTED:{zh:e=>`以下格式的图片暂不支持导入,已跳过:${e}`,en:e=>`Image format(s) not supported, skipped: ${e}`},OLE_EQUATION:{zh:e=>`${e} 个 MathType 公式对象按图片导入`,en:e=>`${e} MathType equation object(s) imported as image(s)`},MATH_UNSUPPORTED:{zh:e=>`部分 OMML 结构未识别:${e}`,en:e=>`Some OMML structures not recognized: ${e}`},PAGES:{zh:e=>`共 ${e} 页`,en:e=>`${e} page${"1"===e?"":"s"} in total`},EMPTY_PAGES:{zh:e=>`其中 ${e} 页没有文字内容(空白页或纯图片页),未计入题目`,en:e=>`${e} page${"1"===e?" has":"s have"} no text content (blank or image-only) and were not counted as questions`}};var tj=e.i(682638),tO=e.i(119472);async function tI(e,t,r={}){let n=r.createBatch??tO.v,i=[],a=[];for(let s=0;s<e.length;s++){let o=e[s];try{let e=await n({source:"image",imageBase64:o.dataUrl,imageInfo:{sourceType:"pdf-page",sourceBytes:o.bytes,sourceWidth:o.width,sourceHeight:o.height,outputWidth:o.width,outputHeight:o.height,outputBytes:o.bytes,quality:void 0},language:t.language,subjectId:t.notebookId,targetSubjectId:t.notebookId});i.push({pageNumber:o.pageNumber,batch:e})}catch(e){a.push({pageNumber:o.pageNumber,error:e})}r.onProgress?.(s+1,e.length)}return{successes:i,failures:a}}async function t_(e,t,r){let n=await td();return Q(await n.getDocument({data:new Uint8Array(e)}).promise,{pages:t,onProgress:r})}function tP({defaultNotebookId:e}){let{t:i,language:a}=(0,b.b)(),[s,o]=(0,r.useState)(e??""),{phase:l,handleFile:u,handleConfirm:d,handleReset:c,handleScannedPdfConfirm:f}=function({language:e,notebookId:t,texts:i,scannedPdfDeps:a}){let s=(0,n.useRouter)(),[o,l]=(0,r.useState)({kind:"pick"}),u=async()=>{let r;if("summary"!==o.kind)return;if(!t)return void j.c.error(i.notebookRequired);if(o.summary.total>tj.e)return void j.c.error(i.tooManyQuestions.replace("{max}",String(tj.e)));l({kind:"creating",fileName:o.fileName,batchCount:Math.ceil(o.summary.total/60)});let n=o.result.questions.some(e=>e.images?.length);try{if(n){let e=tp();r=await tS(o.result.questions,{renderer:e,decodeFn:ty,onProgress:(e,t)=>{l({kind:"processingImages",fileName:o.fileName,done:e,total:t})}})}else r=await tS(o.result.questions)}catch(e){D.V.error("[FileImport]","Process images failed",{error:(0,q.Z)(e)}),j.c.error(i.parseFailed),l({kind:"summary",fileName:o.fileName,fileType:o.fileType,result:o.result,summary:o.summary});return}l({kind:"creating",fileName:o.fileName,batchCount:Math.ceil(o.summary.total/60)});try{let{batches:n,failures:a}=await (0,tj.r)(r,{language:e,subjectId:t,targetSubjectId:t,origin:{fileName:o.fileName,format:o.fileType.key}});for(let e of(n.length>0&&(j.c.success(i.batchesCreated.replace("{count}",String(n.length))),s.push(1===n.length?`/import-batches/${n[0].id}`:"/import-batches")),a))j.c.error(i.batchFailed.replace("{index}",String(e.index+1)).replace("{error}",(0,q.Z)(e.error)));0===n.length&&a.length>0&&l({kind:"summary",fileName:o.fileName,fileType:o.fileType,result:o.result,summary:o.summary})}catch(e){D.V.error("[FileImport]","Create batches failed",{error:(0,q.Z)(e)}),j.c.error((0,q.Z)(e)),l({kind:"summary",fileName:o.fileName,fileType:o.fileType,result:o.result,summary:o.summary})}},d=async r=>{let n;if("scanned-pdf"!==o.kind)return;if(!t)return void j.c.error(i.notebookRequired);let{fileName:u,buffer:d}=o;l({kind:"rendering-pdf",fileName:u,rendered:0,total:r.length});try{n=a?.renderPages?await a.renderPages(d,r,(e,t)=>{l({kind:"rendering-pdf",fileName:u,rendered:e,total:t})}):await t_(d,r,(e,t)=>{l({kind:"rendering-pdf",fileName:u,rendered:e,total:t})})}catch(e){D.V.error("[FileImport]","Render scanned PDF failed",{error:(0,q.Z)(e)}),j.c.error(i.pdfRenderFailed),l({kind:"scanned-pdf",fileName:u,buffer:d,pageCount:o.pageCount});return}l({kind:"creating-pdf-batches",fileName:u,created:0,total:n.length});let c=a?.createBatches??tI,{successes:m,failures:f}=await c(n,{language:e,notebookId:t},{onProgress:(e,t)=>{l({kind:"creating-pdf-batches",fileName:u,created:e,total:t})}});for(let e of f){var g;(g=e.error,g?.status===429)?j.c.error(i.pdfQuotaExceeded.replace("{page}",String(e.pageNumber))):j.c.error(i.pdfPageFailed.replace("{page}",String(e.pageNumber)).replace("{error}",(0,q.Z)(e.error)))}m.length>0?(j.c.success(i.batchesCreated.replace("{count}",String(m.length))),s.push(1===m.length?`/import-batches/${m[0].batch.id}`:"/import-batches")):l({kind:"scanned-pdf",fileName:u,buffer:d,pageCount:o.pageCount})};return{phase:o,handleFile:async(t,r)=>{var n;let a,s,o,u,d,c=th[r.key]??null;if(!c)return void j.c.error(i.unsupportedType);l({kind:"parsing",fileName:t.name});try{s=await t.arrayBuffer(),a=await c({name:t.name,buffer:s})}catch(e){D.V.error("[FileImport]","Parse file failed",{error:(0,q.Z)(e)}),j.c.error(i.parseFailed),l({kind:"pick"});return}let m=(o=(n=a).errors.slice().sort((e,t)=>e.index-t.index).slice(0,5).map(t=>({index:t.index,message:function(e,t){let r=e.indexOf(":"),n=-1===r?e:e.slice(0,r),i=-1===r?"":e.slice(r+1);if(i&&tv[n])return tv[n][t](i);let a=tE[n]??tT[n];return a?a[t]:"zh"===t?`未知错误(${e})`:`Unknown error (${e})`}(t.reason,e)})),u=n.warnings.map(t=>(function(e,t){let r,n=e.match(/^(\[[^\]]*\])\s*(.*)$/),i=n?n[1]:"",a=n?n[2]:e,s=a.indexOf(":"),o=-1===s?a:a.slice(0,s),l=-1===s?"":a.slice(s+1);if(l&&tk[o])r=tk[o][t](l);else{let e=tA[o];r=e?e[t]:"zh"===t?`未知警告(${a})`:`Unknown warning (${a})`}return i?`${i} ${r}`:r})(t,e)),d=function(e){let t=new Map;for(let r of tw){let n=0;for(let t of e)(function(e,t){let r=e[t];return null!=r&&("string"==typeof r?r.trim().length>0:Array.isArray(r)?r.length>0:Object.keys(r).length>0)})(t,r)&&(n+=1);n>0&&t.set(r,n)}return Array.from(t.entries()).map(([e,t])=>({field:e,count:t}))}(n.questions),{total:n.questions.length,importable:n.questions.length,errorCount:n.errors.length,warningCount:n.warnings.length,errors:o,warnings:u,ignoredFields:d,ignoredFieldTexts:d.map(({field:t,count:r})=>{let n=tb[t][e];return"zh"===e?`${n}(${r} 题)`:`${n} (${r} question${r>1?"s":""})`})});if(D.V.info("[FileImport]","File parsed",{fileName:t.name,type:r.key,total:m.total,errors:m.errorCount,warnings:m.warningCount}),0===m.total){if("pdf"===r.key&&a.errors.some(e=>"PDF_NO_TEXT_LAYER"===e.reason)){let e=function(e){for(let t of e.warnings)if(t.startsWith("PAGES:")){let e=Number.parseInt(t.slice(6),10);return Number.isFinite(e)?e:null}return null}(a)??0;l({kind:"scanned-pdf",fileName:t.name,buffer:s,pageCount:e});return}let e=m.errors[0]?.message;j.c.error(e??i.noQuestions),l({kind:"pick"});return}l({kind:"summary",fileName:t.name,fileType:r,result:a,summary:m})},handleConfirm:u,handleReset:()=>l({kind:"pick"}),handleScannedPdfConfirm:d}}({language:"en"===a?"en":"zh",notebookId:s,texts:i.fileImport});return(0,t.jsx)(m.N,{className:"rounded-2xl","data-testid":"file-import-panel",children:(0,t.jsxs)(m.O,{className:"space-y-4 p-6",children:[(0,t.jsxs)("div",{className:"mb-2 flex items-center gap-2 text-muted-foreground",children:[(0,t.jsx)(I.f,{className:"h-5 w-5"}),(0,t.jsx)("span",{className:"text-sm font-medium",children:i.fileImport.title})]}),(0,t.jsx)(t$,{phase:l,notebookId:s,onNotebookChange:o,onFile:u,onConfirm:d,onReset:c,onScannedPdfConfirm:f})]})})}function t$({phase:e,notebookId:r,onNotebookChange:n,onFile:i,onConfirm:a,onReset:s,onScannedPdfConfirm:o}){switch(e.kind){case"parsing":return(0,t.jsx)(P,{textKey:"parsing",fileName:e.fileName});case"processingImages":return(0,t.jsx)(_,{fileName:e.fileName,done:e.done,total:e.total});case"creating":return(0,t.jsx)(P,{textKey:"creating",batchCount:e.batchCount});case"rendering-pdf":return(0,t.jsx)(P,{textKey:"rendering-pdf",rendered:e.rendered,total:e.total});case"creating-pdf-batches":return(0,t.jsx)(P,{textKey:"creating-pdf-batches",rendered:e.created,total:e.total});case"scanned-pdf":return(0,t.jsx)(Y,{fileName:e.fileName,pageCount:e.pageCount,notebookId:r,onNotebookChange:n,onConfirm:o,onReset:s});case"summary":return(0,t.jsx)(G,{fileName:e.fileName,summary:e.summary,notebookId:r,onNotebookChange:n,onConfirm:a,onReset:s});default:return(0,t.jsx)(F,{onFile:i})}}var tC=e.i(522016),tM=e.i(217255),tL=e.i(856423),tD=e.i(975153),tq=e.i(218964),tR=e.i(697886);let tz=()=>()=>{};function tU({href:e,icon:r,label:n,value:i}){return(0,t.jsxs)(tC.default,{href:e,className:"rounded-xl bg-white/15 px-4 py-3 backdrop-blur-sm transition-colors hover:bg-white/20",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-white/75",children:[(0,t.jsx)(r,{className:"h-3.5 w-3.5 shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:n})]}),(0,t.jsx)("div",{className:"mt-1 text-2xl font-bold tabular-nums",children:i??"–"})]})}function tF({notebookCount:e,itemCount:n,dueCount:i,targetNotebook:a}){let{t:s,language:o}=(0,b.b)(),{data:l}=(0,tM.useSession)(),u=(0,r.useSyncExternalStore)(tz,()=>new Date().getHours(),()=>null),d=null===u?s.common.welcome.replace(/[,,\s]+$/,""):u<12?s.home.greetingMorning:u<18?s.home.greetingAfternoon:s.home.greetingEvening,c=l?.user?.name||l?.user?.email||"";return(0,t.jsxs)("section",{className:"relative overflow-hidden rounded-2xl bg-gradient-to-br from-indigo-600 via-indigo-500 to-violet-500 p-5 text-white shadow-lg shadow-indigo-500/20 md:p-7",children:[(0,t.jsx)("div",{className:"pointer-events-none absolute -right-10 -top-12 h-44 w-44 rounded-full bg-white/10 blur-2xl"}),(0,t.jsx)("div",{className:"pointer-events-none absolute -bottom-16 right-24 h-40 w-40 rounded-full bg-fuchsia-300/20 blur-2xl"}),(0,t.jsxs)("div",{className:"relative flex flex-col gap-5 md:flex-row md:items-end md:justify-between",children:[(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsxs)("h1",{className:"text-xl font-bold tracking-tight md:text-2xl",children:[d,c&&`${"zh"===o?",":", "}${c}`]}),(0,t.jsx)("p",{className:"max-w-md text-sm text-white/80",children:s.home.heroSubtitle}),a&&(0,t.jsxs)("p",{className:"inline-flex items-center gap-1.5 rounded-full bg-white/15 px-3 py-1 text-xs font-medium",children:[(0,t.jsx)(tR.f,{className:"h-3.5 w-3.5"}),s.home.targetNotebook.replace("{name}",a)]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-3 gap-3 md:w-96",children:[(0,t.jsx)(tU,{href:"/notebooks",icon:tL.f,label:s.home.notebookCount,value:e}),(0,t.jsx)(tU,{href:"/notebooks",icon:tq.f,label:s.home.itemCount,value:n}),(0,t.jsx)(tU,{href:"/review",icon:tD.f,label:s.home.dueCount,value:i})]})]})]})}var tG=e.i(12130),tB=e.i(430634),tV=e.i(576019),tH=e.i(847483),tW=e.i(497346),tQ=e.i(717448),tY=e.i(798469),tK=e.i(86963),tX=e.i(956738),tZ=e.i(185592),tJ=e.i(41931),t0=e.i(35209),t1=e.i(598053),t2=e.i(315092);function t4(){let{t:e}=(0,b.b)();(0,t0.f)(e.pageTitle.home);let a=(0,n.useSearchParams)().get("notebook"),[s,m]=(0,r.useState)([]),[f,g]=(0,r.useState)(null),[h,p]=(0,r.useState)("image"),x=a?s.find(e=>e.id===a):void 0,N=(0,t1.f)({logPrefix:"[Home]",analyzeSubjectId:a,importSubjectId:a,textNotebook:x&&{id:x.id,name:x.name}});(0,r.useEffect)(()=>{tJ.k.get("/api/notebooks").then(e=>m(e)).catch(e=>D.V.error("[Home]","Failed to fetch notebooks",{error:e})),tJ.k.get("/api/review/due?pageSize=1").then(e=>g(e.total)).catch(e=>D.V.error("[Home]","Failed to fetch due reviews",{error:e}))},[]);let y=async e=>{N.setAnalysisStep("saving"),await N.saveQuestion({...e,wrongAnswerText:e.wrongAnswerText||null,mistakeAnalysis:e.mistakeAnalysis||null,mistakeStatus:e.mistakeStatus||"unknown",originalImageUrl:""}),N.setAnalysisStep("idle")},w=s.reduce((e,t)=>e+(t._count?.errorItems||0),0),S=[{value:"image",icon:i.f,label:e.app?.uploadImage||"Take Photo"},{value:"text",icon:u.f,label:e.app?.manualInput||"Manual Input"},{value:"file",icon:o,label:e.app?.fileImport||"Import File"},{value:"direct",icon:l.f,label:e.app?.directInput||"Manual Entry"}];return(0,t.jsxs)("main",{className:"min-h-screen",children:[(0,t.jsx)(tX.f,{status:N.analysisStep,completed:N.completedStages}),(0,t.jsxs)("div",{className:`mx-auto space-y-6 px-4 py-6 md:px-8 md:py-8 ${"review"===N.step?"max-w-6xl":"max-w-4xl"}`,children:[(0,t.jsx)(tW.f,{message:N.saveError,onDismiss:N.dismissSaveError}),"upload"===N.step&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(tF,{notebookCount:s.length,itemCount:w,dueCount:f,targetNotebook:a?x?.name:void 0}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)(tZ.f,{options:S,value:h,onChange:p}),N.pendingTask&&(0,t.jsx)(tV.f,{task:N.pendingTask,onRefresh:N.refreshPendingTask,onDismiss:N.dismissPendingTask}),N.lastImported&&(0,t.jsx)(tB.f,{imported:N.lastImported,onDismiss:N.dismissImported}),N.batchImages?(0,t.jsx)(d.f,{images:N.batchImages,subjectId:a,onClose:N.closeBatch}):"image"===h?(0,t.jsxs)(t.Fragment,{children:[N.parts.length>0&&(0,t.jsx)(tH.f,{parts:N.parts.map(e=>e.dataUrl),busy:N.isBusy,onFinish:()=>void N.finishParts(),onDiscard:N.discardParts}),(0,t.jsx)(tY.f,{onImageSelect:N.selectImage,isAnalyzing:N.isBusy})]}):"text"===h?(0,t.jsx)(tQ.f,{onSubmit:N.submitText,isAnalyzing:N.isBusy,defaultNotebookName:x?.name,onCreateBatch:N.createTextBatch,creatingBatch:N.creatingBatch,onSwitchToFileImport:()=>p("file")}):"file"===h?(0,t.jsx)(tP,{defaultNotebookId:a||void 0}):(0,t.jsx)(O,{onSubmit:y,defaultNotebookId:a||void 0,defaultNotebookName:x?.name,isSaving:"saving"===N.analysisStep})]})]}),N.croppingImage&&(0,t.jsx)(tG.f,{imageSrc:N.croppingImage,open:N.isCropperOpen,onClose:N.closeCropper,onRegionsSelected:N.cropRegions,allowMulti:0===N.parts.length,onAutoSplit:0===N.parts.length?N.autoSplitImage:void 0,onAddPart:N.parts.length<t2.u-1?N.addPart:void 0,partCount:N.parts.length}),"review"===N.step&&N.parsedData&&(0,t.jsx)(c.f,{initialData:N.parsedData,onSave:N.saveReviewed,onCancel:N.cancelReview,imagePreview:N.currentImage,initialSubjectId:a||void 0,aiTimeout:N.aiTimeout})]})]})}e.s(["default",0,function(){return(0,t.jsx)(r.Suspense,{fallback:(0,t.jsx)(tK.f,{}),children:(0,t.jsx)(t4,{})})}],952683)}]);
|
|
6
|
+
${e.join("\n")}`}l.push({raw:u,index:r-i-1})}let u=eh({format:ei,version:1,questions:l.map(e=>e.raw)}),d=[...n,...u.errors.map(e=>{let t=l[e.index];return{index:t?t.index:e.index,reason:e.reason}})].sort((e,t)=>e.index-t.index);return{questions:u.questions,errors:d,warnings:[...r,...u.warnings]}}async function ti(t){let{default:r}=await e.A(84955),n=await r(t),i=[],a=[],s=[],o=0;for(let e of n){let t=e.data;if(!t||0===t.length)continue;let r=t.some(e=>e.map(e=>String(e??"").trim().toLowerCase()).some(e=>{let t=e.replace(/[\s ]+/g,"");return"section"===t||"大题"===t||"题型分组"===t})),l=tn(t,n.length>1&&!r?e.sheet:void 0);for(let e of l.errors)a.push({index:-1===e.index?-1:e.index+o,reason:e.reason});s.push(...l.warnings.map(t=>`[${e.sheet}] ${t}`)),i.push(...l.questions),o+=l.questions.length}return{questions:i,errors:a,warnings:s}}let ta=/^[\s\-–—·..]*\d{1,4}[\s\-–—·..]*$/;function ts(e){return e.replace(/\uFB00/g,"ff").replace(/\uFB01/g,"fi").replace(/\uFB02/g,"fl").replace(/\uFB03/g,"ffi").replace(/\uFB04/g,"ffl").replace(/\u00A0/g," ").replace(/\u3000/g," ")}function to(e){let t=e.trim();if(!t)return null;if(ta.test(t))return{key:"",isPageNumberOnly:!0};let r=t.replace(/\d+/g,"").trim();return r?{key:r,isPageNumberOnly:!1}:null}function tl(e){if(!e)return!1;let t=e.charCodeAt(0);return t>=11904&&t<=40959||t>=63744&&t<=64255||t>=12288&&t<=12351||t>=65280&&t<=65519}let tu=null;function td(){return tu||(tu=(async()=>{let t=await e.A(825834);return t.GlobalWorkerOptions.workerSrc=new e.U(e.r(979463)).toString(),t})()),tu}function tc(e){let t={text:e.text};return e.material&&(t.material=e.material),e.section&&(t.section=e.section),e.label&&(t.label=e.label),e.answer&&(t.answer=e.answer),e.analysis&&(t.analysis=e.analysis),e.knowledgePoints?.length&&(t.knowledgePoints=e.knowledgePoints),null!==e.difficultyStars&&void 0!==e.difficultyStars&&(t.difficultyStars=e.difficultyStars),e.wrongAnswer&&(t.wrongAnswer=e.wrongAnswer),e.questionType&&(t.questionType=e.questionType),t}async function tm(e,t={}){var r;let n,i=t.pdfjs??await td(),a=new Uint8Array(e.slice(0));try{n=await i.getDocument(t.standardFontDataUrl?{data:a,standardFontDataUrl:t.standardFontDataUrl,verbosity:0}:{data:a}).promise}catch(e){if("PasswordException"===(e instanceof Error?e.name:""))return{questions:[],errors:[{index:-1,reason:"PDF_ENCRYPTED"}],warnings:[]};return{questions:[],errors:[{index:-1,reason:"INVALID_PDF"}],warnings:[]}}let s=[],o=[],l=0,u=0,d=[];try{l=n.numPages;for(let e=1;e<=l;e++){let t=await n.getPage(e),r=t.getViewport({scale:1});o.push({width:r.width,height:r.height});let i=await t.getTextContent(),a=0;for(let t of i.items){if(!("str"in t))continue;let r=ts(t.str);if(!r.trim())continue;let[n,,,,i,o]=t.transform,l=Math.abs(n)||1;s.push({str:r,x:i,y:o,width:t.width*l,height:t.height,page:e});let d=r.trim().length;a+=d,u+=d}d.push(a)}}catch(t){let e=t instanceof Error?t.name:"";if("PasswordException"===e)return{questions:[],errors:[{index:-1,reason:"PDF_ENCRYPTED"}],warnings:[]};return{questions:[],errors:[{index:-1,reason:"INVALID_PDF"}],warnings:[]}}finally{try{await n.cleanup()}catch{}}if(0===l||u/Math.max(l,1)<20)return{questions:[],errors:[{index:-1,reason:"PDF_NO_TEXT_LAYER"}],warnings:[`PAGES:${l}`]};let c=(function(e,t){let r=e.map(e=>({...e,str:ts(e.str)})).filter(e=>e.str.trim().length>0),n=function(e,t){let r=new Map;for(let t of e){let e=r.get(t.page)??[];e.push(t),r.set(t.page,e)}let n=[];for(let[e,i]of r){let r=t.find((t,r)=>r+1===e),a=r?.height??0,s=[...i].sort((e,t)=>e.y-t.y||e.x-t.x),o=[];for(let e of s){let t=o[o.length-1],r=t?.[t.length-1],n=.5*Math.max(e.height,r?.height??0);t&&r&&Math.abs(e.y-r.y)<=n?t.push(e):o.push([e])}for(let t of o){t.sort((e,t)=>e.x-t.x);let r="",i=null;for(let e of t)i&&(!(e.x-(i.x+i.width)>.15*Math.max(e.height,i.height,1))||r.endsWith(" ")||e.str.startsWith(" ")||tl(r[r.length-1])||tl(e.str[0])||(r+=" ")),r+=e.str,i=e;let s=t.reduce((e,t)=>Math.max(e,t.height),0),o=t.reduce((e,t)=>e+t.y,0)/t.length;n.push({text:r.trimEnd(),x:t[0].x,yTop:a-o+s,height:s,page:e})}}return n}(r,t),i=function(e,t){let r=new Map,n=new Map;for(let t of e){let e=n.get(t.page)??[];e.push(t),n.set(t.page,e)}for(let[e,i]of n){let n=t.find((t,r)=>r+1===e);if(!n||n.width<=0)continue;let a=n.width/2,s=.06*n.width,o=i.filter(e=>e.x+e.width<=a+s).reduce((e,t)=>e+t.str.trim().length,0),l=i.filter(e=>e.x>=a-s).reduce((e,t)=>e+t.str.trim().length,0),u=o+l;!(u<1)&&!i.some(e=>e.x<a+s&&e.x+e.width>a-s)&&o>=.25*u&&l>=.25*u&&r.set(e,{width:n.width,height:n.height})}return r}(r,t),a=function(e,t){let r=[...new Set(e.map(e=>e.page))].filter(e=>e>=1);if(0===r.length)return[];let n=Math.max(2,Math.ceil(.5*(t.length||r.length))),i=new Map;for(let r of e){let e=t.find((e,t)=>t+1===r.page),n=e?.height??0;if(n<=0)continue;let a=r.yTop<=.15*n,s=r.yTop>=.92*n;if(!a&&!s||r.text.length>100)continue;let o=to(r.text);if(!o)continue;let l=`${a?"H":"F"}:${o.key}:${o.isPageNumberOnly?"#":"*"}`,u=i.get(l);u?(u.pages.add(r.page),u.minYTop=Math.min(u.minYTop,r.yTop),u.maxYTopBottom=Math.max(u.maxYTopBottom,r.yTop)):i.set(l,{key:o.key,pages:new Set([r.page]),isPageNumberOnly:o.isPageNumberOnly,minYTop:r.yTop,maxYTopBottom:r.yTop})}return[...i.values()].filter(e=>e.pages.size>=n)}(n,t),s=new Set;for(let e of a)for(let t of n){if(t.page<1||!e.pages.has(t.page))continue;let r=to(t.text);r?.key===e.key&&(!e.isPageNumberOnly||r.isPageNumberOnly)&&t.yTop>=e.minYTop&&t.yTop<=e.maxYTopBottom&&s.add(t)}return n.filter(e=>!s.has(e)).sort((e,t)=>e.page-t.page||e.yTop-t.yTop||e.x-t.x).map(e=>{let t=i.get(e.page);if(!t)return e;let r=t.width/2;return{...e,yTop:e.x>=r?e.yTop+t.height:e.yTop}}).sort((e,t)=>e.page-t.page||e.yTop-t.yTop||e.x-t.x)})(s,o).map(e=>e.text).join("\n"),m=(0,ex.J)(c,t.splitOptions),f=[`PAGES:${l}`],g=d.filter(e=>0===e).length;g>0&&f.push(`EMPTY_PAGES:${g}`),m.ignored.length>0&&f.push((r=m.ignored.length,`IGNORED_PARAGRAPHS:${r}`)),m.detected||1!==m.questions.length||f.push("SINGLE_QUESTION");let h=eh(m.questions.map(tc));return{questions:h.questions,errors:h.errors,warnings:[...f,...h.warnings]}}let tf={maxLength:ex.f,maxQuestions:ex.k},tg={maxLength:ex.f,maxQuestions:ex.k},th={json:e=>ep(e.buffer),docx:e=>e3(e.buffer,{},tf),xlsx:e=>ti(e.buffer),csv:async function(e){let t,{text:r}=(0,R.n)(e.buffer),{rows:n}=(t=function(e){let t=e.split(/\r?\n/,1)[0]??"",r=",",n=0;for(let e of[",",";"," "]){let i=t.split(e).length-1;i>n&&(n=i,r=e)}return r}(r),{rows:function(e,t){let r=[],n=[],i="",a=!1,s=0;for(65279===e.charCodeAt(0)&&(s=1);s<e.length;){let o=e[s];if(a){'"'===o?'"'===e[s+1]?(i+='"',s+=2):(a=!1,s+=1):(i+=o,s+=1);continue}if('"'===o&&""===i){a=!0,s+=1;continue}if(o===t){n.push(i),i="",s+=1;continue}if("\r"===o){"\n"===e[s+1]&&(s+=1),n.push(i),i="",r.push(n),n=[],s+=1;continue}if("\n"===o){n.push(i),i="",r.push(n),n=[],s+=1;continue}i+=o,s+=1}return(""!==i||n.length>0)&&(n.push(i),r.push(n)),r.filter(e=>e.some(e=>""!==e.trim()))}(r,t),delimiter:t});return tn(n)},pdf:e=>tm(e.buffer,{splitOptions:tg})};function tp(){let e=(e,t)=>{let r=document.createElement("canvas");return r.width=e,r.height=t,r},t=(e,t,r)=>{e.fillStyle="#ffffff",e.fillRect(0,0,t,r)},r=(e,t)=>e.toDataURL("image/jpeg",t),n=e=>Math.floor(3*e.slice(e.indexOf(",")+1).length/4);return{async renderComposite(i,a){let s=e(a.canvasWidth,a.canvasHeight),o=s.getContext("2d");if(!o)throw Error("CANVAS_UNSUPPORTED");t(o,a.canvasWidth,a.canvasHeight),o.imageSmoothingEnabled=!0,o.imageSmoothingQuality="high";for(let e=0;e<i.length;e++){let t=a.placements[e];o.drawImage(i[e].source,0,0,i[e].width,i[e].height,0,t.y,t.width,t.height)}let l=r(s,.85),u=1;for(;n(l)>1048576&&u>.1;){u*=.85;let n=Math.max(1,Math.round(a.canvasWidth*u)),s=Math.max(1,Math.round(a.canvasHeight*u)),o=e(n,s),d=o.getContext("2d");if(!d)throw Error("CANVAS_UNSUPPORTED");t(d,n,s),d.imageSmoothingEnabled=!0,d.imageSmoothingQuality="high";for(let e=0;e<i.length;e++){let t=a.placements[e];d.drawImage(i[e].source,0,0,i[e].width,i[e].height,0,Math.round(t.y*u),Math.round(t.width*u),Math.round(t.height*u))}l=r(o,.85)}return l},async renderSingle(i,a,s){let o=function(e,t,r=1600){let n=Math.max(e,t);if(n<=r)return{width:e,height:t};let i=r/n;return{width:Math.max(1,Math.round(e*i)),height:Math.max(1,Math.round(t*i))}}(i.width,i.height,a),l=e(o.width,o.height),u=l.getContext("2d");if(!u)throw Error("CANVAS_UNSUPPORTED");t(u,o.width,o.height),u.imageSmoothingEnabled=!0,u.imageSmoothingQuality="high",u.drawImage(i.source,0,0,i.width,i.height,0,0,o.width,o.height);let d=r(l,.85),c=1;for(;n(d)>s&&c>.1;){c*=.85;let n=Math.max(1,Math.round(o.width*c)),a=Math.max(1,Math.round(o.height*c)),s=e(n,a),l=s.getContext("2d");if(!l)throw Error("CANVAS_UNSUPPORTED");t(l,n,a),l.imageSmoothingEnabled=!0,l.imageSmoothingQuality="high",l.drawImage(i.source,0,0,i.width,i.height,0,0,n,a),d=r(s,.85)}return d}}}async function tx(e,t=tp()){if(0===e.length)throw Error("NO_IMAGES");if(1===e.length)return t.renderSingle(e[0],1600,1048576);let r=function(e,t=16){let r=e.map(t=>{var r,n,i;return r=t.width,n=t.height,i=Math.max(...e.map(e=>e.width)),r<=0?{width:i,height:0}:{width:i,height:Math.max(1,Math.round(i/r*n))}}),{width:n,height:i}=function(e,t=16){return 0===e.length?{width:0,height:0}:{width:Math.max(...e.map(e=>e.width)),height:e.reduce((e,t)=>e+t.height,0)+t*(e.length-1)}}(r,t),a=function(e,t=16){let r=[],n=0;for(let i of e)r.push(n),n+=i.height+t;return r}(r,t);return{canvasWidth:n,canvasHeight:i,placements:r.map((e,t)=>({...e,y:a[t]}))}}(e.map(e=>({width:e.width,height:e.height})));return t.renderComposite(e,r)}async function tN(e){let t=atob(e.slice(e.indexOf(",")+1)),r=new Uint8Array(t.length);for(let e=0;e<t.length;e++)r[e]=t.charCodeAt(e);return createImageBitmap(new Blob([r],{type:e.slice(5,e.indexOf(";"))}))}async function ty(e){let t=await tN(e);return{source:t,width:t.width,height:t.height}}let tw=["subject","gradeSemester","source","figureSvg","extensions"],tb={subject:{zh:"学科",en:"subject"},gradeSemester:{zh:"年级学期",en:"gradeSemester"},source:{zh:"来源",en:"source"},figureSvg:{zh:"配图 SVG",en:"figureSvg"},extensions:{zh:"扩展字段",en:"extensions"}};async function tS(e,t={}){let{renderer:r,decodeFn:n,onProgress:i}=t,a=e.length,s=0,o=[];for(let t of e){let e={text:t.text,material:t.material??null,section:t.section??null,label:t.label??null,answer:t.answer??null,analysis:t.analysis??null,knowledgePoints:t.knowledgePoints?.length?t.knowledgePoints:null,difficultyStars:t.difficultyStars??null,wrongAnswer:t.wrongAnswer??null,questionType:t.questionType??null};if(t.images?.length&&r&&n)try{let i=await Promise.all(t.images.map(e=>n(e.dataUrl)));e.image=await tx(i,r)}catch{e.image=null}o.push(e),s+=1,i?.(s,a)}return o}let tv={UNKNOWN_COLUMN:{zh:e=>`未识别的列「${e}」,该列内容已忽略`,en:e=>`Unrecognized column "${e}"; its content was ignored`},IGNORED_PARAGRAPHS:{zh:e=>`${e} 个段落未计入题目(标题、说明等)`,en:e=>`${e} paragraph(s) not counted as questions (titles, notes, etc.)`},TEXT_REQUIRED:{zh:e=>e.startsWith("row=")?`第 ${e.slice(4)} 行缺少题干`:"缺少题干",en:e=>e.startsWith("row=")?`Row ${e.slice(4)} is missing question text`:"Question text is required"}},tT={INVALID_JSON:{zh:"不是合法的 JSON 文件,请检查文件内容",en:"Not a valid JSON file; please check the file content"},INVALID_DOCX:{zh:"无法读取该 Word 文件,文件可能已损坏或不是 .docx 格式",en:"Cannot read this Word file; it may be corrupted or not a .docx file"},LEGACY_DOC_NOT_SUPPORTED:{zh:"旧版 .doc 格式暂不支持,请在 Word 中另存为 .docx 后再导入",en:"Legacy .doc is not supported; please save it as .docx in Word and import again"},TEXT_COLUMN_NOT_FOUND:{zh:"未找到「题干」列,请使用题库模板或检查表头",en:'No "question text" column found; please use the question template or check the header row'},EMPTY_TABLE:{zh:"表格为空,没有可导入的题目",en:"The table is empty; there are no questions to import"},QUESTIONS_REQUIRED:{zh:"文件中没有题目(questions 为空)",en:"The file contains no questions (questions is empty)"},INVALID_QUESTION_SHAPE:{zh:"题目格式不正确(questions 应为题目数组)",en:'Invalid question format ("questions" should be an array of questions)'},PDF_NO_TEXT_LAYER:{zh:"这是扫描版 PDF(没有文字层),可在下方选择页码范围转为图片,由 AI 识别分题导入",en:"This is a scanned PDF (no text layer). You can select a page range below to convert it to images and import with AI recognition."},PDF_ENCRYPTED:{zh:"这是加密 PDF,暂不支持导入,请先去除密码后重试",en:"This PDF is password-protected and cannot be imported; please remove the password and try again"},INVALID_PDF:{zh:"无法读取该 PDF 文件,文件可能已损坏或不是有效的 PDF",en:"Cannot read this PDF file; it may be corrupted or not a valid PDF"}},tE={TEXT_REQUIRED:{zh:"缺少题干,已跳过",en:"Missing question text; skipped"},TEXT_TOO_LONG:{zh:"题干过长,已跳过",en:"Question text is too long; skipped"},MATERIAL_TOO_LONG:{zh:"公共材料过长,该题已跳过",en:"Shared material is too long; question skipped"},SECTION_TOO_LONG:{zh:"大题标题过长,该题已跳过",en:"Section title is too long; question skipped"},LABEL_TOO_LONG:{zh:"题号过长,该题已跳过",en:"Label is too long; question skipped"},ANSWER_TOO_LONG:{zh:"答案过长,该题已跳过",en:"Answer is too long; question skipped"},ANALYSIS_TOO_LONG:{zh:"解析过长,该题已跳过",en:"Analysis is too long; question skipped"},INVALID_DIFFICULTY:{zh:"难度值无效(应为 1~5),该题已跳过",en:"Invalid difficulty (should be 1–5); question skipped"},WRONG_ANSWER_TOO_LONG:{zh:"错答内容过长,该题已跳过",en:"Wrong answer is too long; question skipped"},SUBJECT_TOO_LONG:{zh:"学科字段过长,该题已跳过",en:"Subject is too long; question skipped"},GRADE_SEMESTER_TOO_LONG:{zh:"年级学期字段过长,该题已跳过",en:"Grade/semester is too long; question skipped"},SOURCE_TOO_LONG:{zh:"来源字段过长,该题已跳过",en:"Source is too long; question skipped"},QUESTION_TYPE_TOO_LONG:{zh:"题型字段过长,该题已跳过",en:"Question type is too long; question skipped"},KNOWLEDGE_POINT_TOO_LONG:{zh:"知识点过长,该题已跳过",en:"Knowledge point is too long; question skipped"},TOO_MANY_KNOWLEDGE_POINTS:{zh:"知识点数量超过上限,该题已跳过",en:"Too many knowledge points; question skipped"},INVALID_IMAGE_DATA_URL:{zh:"图片数据无效,该题已跳过",en:"Invalid image data; question skipped"},IMAGE_TOO_LARGE:{zh:"图片过大,该题已跳过",en:"Image is too large; question skipped"},TOO_MANY_IMAGES:{zh:"图片数量超过上限,该题已跳过",en:"Too many images; question skipped"},FIGURE_SVG_TOO_LONG:{zh:"配图 SVG 过长,该题已跳过",en:"Figure SVG is too long; question skipped"},INVALID_QUESTION_SHAPE:{zh:"题目格式不正确,该题已跳过",en:"Invalid question shape; skipped"}},tA={MISSING_FORMAT:{zh:"文件缺少 format 字段,已按题目交换格式解析",en:'The file is missing the "format" field; parsed as the question exchange format'},UNKNOWN_FORMAT:{zh:"format 字段不是已知的题目交换格式,已尝试按 v1 解析",en:'The "format" field is not the known exchange format; tried parsing as v1'},MISSING_VERSION:{zh:"文件缺少 version 字段,已按 v1 解析",en:'The file is missing the "version" field; parsed as v1'},UNSUPPORTED_VERSION:{zh:"文件版本高于当前支持的 v1,已按 v1 宽松规则解析",en:"The file version is newer than the supported v1; parsed with v1 tolerant rules"},TOO_MANY_QUESTIONS:{zh:"题目数量超过文件上限,超出部分已截断",en:"Question count exceeds the per-file limit; the rest was truncated"},SINGLE_QUESTION:{zh:"只识别出一道题;如果文件里有多道题,请检查题号格式",en:"Only one question was recognized; if the file has more, check the question numbering"}},tk={UNKNOWN_COLUMN:{zh:e=>`未识别的列「${e}」,该列内容已忽略`,en:e=>`Unrecognized column "${e}"; its content was ignored`},IGNORED_PARAGRAPHS:{zh:e=>`${e} 个段落未计入题目(标题、说明等)`,en:e=>`${e} paragraph(s) not counted as questions (titles, notes, etc.)`},IMAGE_UNSUPPORTED:{zh:e=>`以下格式的图片暂不支持导入,已跳过:${e}`,en:e=>`Image format(s) not supported, skipped: ${e}`},OLE_EQUATION:{zh:e=>`${e} 个 MathType 公式对象按图片导入`,en:e=>`${e} MathType equation object(s) imported as image(s)`},MATH_UNSUPPORTED:{zh:e=>`部分 OMML 结构未识别:${e}`,en:e=>`Some OMML structures not recognized: ${e}`},PAGES:{zh:e=>`共 ${e} 页`,en:e=>`${e} page${"1"===e?"":"s"} in total`},EMPTY_PAGES:{zh:e=>`其中 ${e} 页没有文字内容(空白页或纯图片页),未计入题目`,en:e=>`${e} page${"1"===e?" has":"s have"} no text content (blank or image-only) and were not counted as questions`}};var tj=e.i(682638),tO=e.i(119472);async function tI(e,t,r={}){let n=r.createBatch??tO.v,i=[],a=[];for(let s=0;s<e.length;s++){let o=e[s];try{let e=await n({source:"image",imageBase64:o.dataUrl,imageInfo:{sourceType:"pdf-page",sourceBytes:o.bytes,sourceWidth:o.width,sourceHeight:o.height,outputWidth:o.width,outputHeight:o.height,outputBytes:o.bytes,quality:void 0},language:t.language,subjectId:t.notebookId,targetSubjectId:t.notebookId});i.push({pageNumber:o.pageNumber,batch:e})}catch(e){a.push({pageNumber:o.pageNumber,error:e})}r.onProgress?.(s+1,e.length)}return{successes:i,failures:a}}async function t_(e,t,r){let n=await td();return Q(await n.getDocument({data:new Uint8Array(e.slice(0))}).promise,{pages:t,onProgress:r})}function tP({defaultNotebookId:e}){let{t:i,language:a}=(0,b.b)(),[s,o]=(0,r.useState)(e??""),{phase:l,handleFile:u,handleConfirm:d,handleReset:c,handleScannedPdfConfirm:f}=function({language:e,notebookId:t,texts:i,scannedPdfDeps:a}){let s=(0,n.useRouter)(),[o,l]=(0,r.useState)({kind:"pick"}),u=async()=>{let r;if("summary"!==o.kind)return;if(!t)return void j.c.error(i.notebookRequired);if(o.summary.total>tj.e)return void j.c.error(i.tooManyQuestions.replace("{max}",String(tj.e)));l({kind:"creating",fileName:o.fileName,batchCount:Math.ceil(o.summary.total/60)});let n=o.result.questions.some(e=>e.images?.length);try{if(n){let e=tp();r=await tS(o.result.questions,{renderer:e,decodeFn:ty,onProgress:(e,t)=>{l({kind:"processingImages",fileName:o.fileName,done:e,total:t})}})}else r=await tS(o.result.questions)}catch(e){D.V.error("[FileImport]","Process images failed",{error:(0,q.Z)(e)}),j.c.error(i.parseFailed),l({kind:"summary",fileName:o.fileName,fileType:o.fileType,result:o.result,summary:o.summary});return}l({kind:"creating",fileName:o.fileName,batchCount:Math.ceil(o.summary.total/60)});try{let{batches:n,failures:a}=await (0,tj.r)(r,{language:e,subjectId:t,targetSubjectId:t,origin:{fileName:o.fileName,format:o.fileType.key}});for(let e of(n.length>0&&(j.c.success(i.batchesCreated.replace("{count}",String(n.length))),s.push(1===n.length?`/import-batches/${n[0].id}`:"/import-tasks")),a))j.c.error(i.batchFailed.replace("{index}",String(e.index+1)).replace("{error}",(0,q.Z)(e.error)));0===n.length&&a.length>0&&l({kind:"summary",fileName:o.fileName,fileType:o.fileType,result:o.result,summary:o.summary})}catch(e){D.V.error("[FileImport]","Create batches failed",{error:(0,q.Z)(e)}),j.c.error((0,q.Z)(e)),l({kind:"summary",fileName:o.fileName,fileType:o.fileType,result:o.result,summary:o.summary})}},d=async r=>{let n;if("scanned-pdf"!==o.kind)return;if(!t)return void j.c.error(i.notebookRequired);let{fileName:u,buffer:d}=o;l({kind:"rendering-pdf",fileName:u,rendered:0,total:r.length});try{n=a?.renderPages?await a.renderPages(d,r,(e,t)=>{l({kind:"rendering-pdf",fileName:u,rendered:e,total:t})}):await t_(d,r,(e,t)=>{l({kind:"rendering-pdf",fileName:u,rendered:e,total:t})})}catch(e){D.V.error("[FileImport]","Render scanned PDF failed",{error:(0,q.Z)(e)}),j.c.error(i.pdfRenderFailed),l({kind:"scanned-pdf",fileName:u,buffer:d,pageCount:o.pageCount});return}l({kind:"creating-pdf-batches",fileName:u,created:0,total:n.length});let c=a?.createBatches??tI,{successes:m,failures:f}=await c(n,{language:e,notebookId:t},{onProgress:(e,t)=>{l({kind:"creating-pdf-batches",fileName:u,created:e,total:t})}});for(let e of f){var g;(g=e.error,g?.status===429)?j.c.error(i.pdfQuotaExceeded.replace("{page}",String(e.pageNumber))):j.c.error(i.pdfPageFailed.replace("{page}",String(e.pageNumber)).replace("{error}",(0,q.Z)(e.error)))}m.length>0?(j.c.success(i.batchesCreated.replace("{count}",String(m.length))),s.push(1===m.length?`/import-batches/${m[0].batch.id}`:"/import-tasks")):l({kind:"scanned-pdf",fileName:u,buffer:d,pageCount:o.pageCount})};return{phase:o,handleFile:async(t,r)=>{var n;let a,s,o,u,d,c=th[r.key]??null;if(!c)return void j.c.error(i.unsupportedType);l({kind:"parsing",fileName:t.name});try{s=await t.arrayBuffer(),a=await c({name:t.name,buffer:s})}catch(e){D.V.error("[FileImport]","Parse file failed",{error:(0,q.Z)(e)}),j.c.error(i.parseFailed),l({kind:"pick"});return}let m=(o=(n=a).errors.slice().sort((e,t)=>e.index-t.index).slice(0,5).map(t=>({index:t.index,message:function(e,t){let r=e.indexOf(":"),n=-1===r?e:e.slice(0,r),i=-1===r?"":e.slice(r+1);if(i&&tv[n])return tv[n][t](i);let a=tE[n]??tT[n];return a?a[t]:"zh"===t?`未知错误(${e})`:`Unknown error (${e})`}(t.reason,e)})),u=n.warnings.map(t=>(function(e,t){let r,n=e.match(/^(\[[^\]]*\])\s*(.*)$/),i=n?n[1]:"",a=n?n[2]:e,s=a.indexOf(":"),o=-1===s?a:a.slice(0,s),l=-1===s?"":a.slice(s+1);if(l&&tk[o])r=tk[o][t](l);else{let e=tA[o];r=e?e[t]:"zh"===t?`未知警告(${a})`:`Unknown warning (${a})`}return i?`${i} ${r}`:r})(t,e)),d=function(e){let t=new Map;for(let r of tw){let n=0;for(let t of e)(function(e,t){let r=e[t];return null!=r&&("string"==typeof r?r.trim().length>0:Array.isArray(r)?r.length>0:Object.keys(r).length>0)})(t,r)&&(n+=1);n>0&&t.set(r,n)}return Array.from(t.entries()).map(([e,t])=>({field:e,count:t}))}(n.questions),{total:n.questions.length,importable:n.questions.length,errorCount:n.errors.length,warningCount:n.warnings.length,errors:o,warnings:u,ignoredFields:d,ignoredFieldTexts:d.map(({field:t,count:r})=>{let n=tb[t][e];return"zh"===e?`${n}(${r} 题)`:`${n} (${r} question${r>1?"s":""})`})});if(D.V.info("[FileImport]","File parsed",{fileName:t.name,type:r.key,total:m.total,errors:m.errorCount,warnings:m.warningCount}),0===m.total){if("pdf"===r.key&&a.errors.some(e=>"PDF_NO_TEXT_LAYER"===e.reason)){let e=function(e){for(let t of e.warnings)if(t.startsWith("PAGES:")){let e=Number.parseInt(t.slice(6),10);return Number.isFinite(e)?e:null}return null}(a)??0;l({kind:"scanned-pdf",fileName:t.name,buffer:s,pageCount:e});return}let e=m.errors[0]?.message;j.c.error(e??i.noQuestions),l({kind:"pick"});return}l({kind:"summary",fileName:t.name,fileType:r,result:a,summary:m})},handleConfirm:u,handleReset:()=>l({kind:"pick"}),handleScannedPdfConfirm:d}}({language:"en"===a?"en":"zh",notebookId:s,texts:i.fileImport});return(0,t.jsx)(m.N,{className:"rounded-2xl","data-testid":"file-import-panel",children:(0,t.jsxs)(m.O,{className:"space-y-4 p-6",children:[(0,t.jsxs)("div",{className:"mb-2 flex items-center gap-2 text-muted-foreground",children:[(0,t.jsx)(I.f,{className:"h-5 w-5"}),(0,t.jsx)("span",{className:"text-sm font-medium",children:i.fileImport.title})]}),(0,t.jsx)(t$,{phase:l,notebookId:s,onNotebookChange:o,onFile:u,onConfirm:d,onReset:c,onScannedPdfConfirm:f})]})})}function t$({phase:e,notebookId:r,onNotebookChange:n,onFile:i,onConfirm:a,onReset:s,onScannedPdfConfirm:o}){switch(e.kind){case"parsing":return(0,t.jsx)(P,{textKey:"parsing",fileName:e.fileName});case"processingImages":return(0,t.jsx)(_,{fileName:e.fileName,done:e.done,total:e.total});case"creating":return(0,t.jsx)(P,{textKey:"creating",batchCount:e.batchCount});case"rendering-pdf":return(0,t.jsx)(P,{textKey:"rendering-pdf",rendered:e.rendered,total:e.total});case"creating-pdf-batches":return(0,t.jsx)(P,{textKey:"creating-pdf-batches",rendered:e.created,total:e.total});case"scanned-pdf":return(0,t.jsx)(Y,{fileName:e.fileName,pageCount:e.pageCount,notebookId:r,onNotebookChange:n,onConfirm:o,onReset:s});case"summary":return(0,t.jsx)(G,{fileName:e.fileName,summary:e.summary,notebookId:r,onNotebookChange:n,onConfirm:a,onReset:s});default:return(0,t.jsx)(F,{onFile:i})}}var tC=e.i(522016),tM=e.i(217255),tL=e.i(856423),tD=e.i(975153),tq=e.i(218964),tR=e.i(697886);let tz=()=>()=>{};function tU({href:e,icon:r,label:n,value:i}){return(0,t.jsxs)(tC.default,{href:e,className:"rounded-xl bg-white/15 px-4 py-3 backdrop-blur-sm transition-colors hover:bg-white/20",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-white/75",children:[(0,t.jsx)(r,{className:"h-3.5 w-3.5 shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:n})]}),(0,t.jsx)("div",{className:"mt-1 text-2xl font-bold tabular-nums",children:i??"–"})]})}function tF({notebookCount:e,itemCount:n,dueCount:i,targetNotebook:a}){let{t:s,language:o}=(0,b.b)(),{data:l}=(0,tM.useSession)(),u=(0,r.useSyncExternalStore)(tz,()=>new Date().getHours(),()=>null),d=null===u?s.common.welcome.replace(/[,,\s]+$/,""):u<12?s.home.greetingMorning:u<18?s.home.greetingAfternoon:s.home.greetingEvening,c=l?.user?.name||l?.user?.email||"";return(0,t.jsxs)("section",{className:"relative overflow-hidden rounded-2xl bg-gradient-to-br from-indigo-600 via-indigo-500 to-violet-500 p-5 text-white shadow-lg shadow-indigo-500/20 md:p-7",children:[(0,t.jsx)("div",{className:"pointer-events-none absolute -right-10 -top-12 h-44 w-44 rounded-full bg-white/10 blur-2xl"}),(0,t.jsx)("div",{className:"pointer-events-none absolute -bottom-16 right-24 h-40 w-40 rounded-full bg-fuchsia-300/20 blur-2xl"}),(0,t.jsxs)("div",{className:"relative flex flex-col gap-5 md:flex-row md:items-end md:justify-between",children:[(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsxs)("h1",{className:"text-xl font-bold tracking-tight md:text-2xl",children:[d,c&&`${"zh"===o?",":", "}${c}`]}),(0,t.jsx)("p",{className:"max-w-md text-sm text-white/80",children:s.home.heroSubtitle}),a&&(0,t.jsxs)("p",{className:"inline-flex items-center gap-1.5 rounded-full bg-white/15 px-3 py-1 text-xs font-medium",children:[(0,t.jsx)(tR.f,{className:"h-3.5 w-3.5"}),s.home.targetNotebook.replace("{name}",a)]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-3 gap-3 md:w-96",children:[(0,t.jsx)(tU,{href:"/notebooks",icon:tL.f,label:s.home.notebookCount,value:e}),(0,t.jsx)(tU,{href:"/notebooks",icon:tq.f,label:s.home.itemCount,value:n}),(0,t.jsx)(tU,{href:"/review",icon:tD.f,label:s.home.dueCount,value:i})]})]})]})}var tG=e.i(12130),tB=e.i(430634),tV=e.i(576019),tH=e.i(847483),tW=e.i(497346),tQ=e.i(717448),tY=e.i(798469),tK=e.i(86963),tX=e.i(956738),tZ=e.i(185592),tJ=e.i(41931),t0=e.i(35209),t1=e.i(598053),t2=e.i(315092);function t4(){let{t:e}=(0,b.b)();(0,t0.f)(e.pageTitle.home);let a=(0,n.useSearchParams)().get("notebook"),[s,m]=(0,r.useState)([]),[f,g]=(0,r.useState)(null),[h,p]=(0,r.useState)("image"),x=a?s.find(e=>e.id===a):void 0,N=(0,t1.f)({logPrefix:"[Home]",analyzeSubjectId:a,importSubjectId:a,textNotebook:x&&{id:x.id,name:x.name}});(0,r.useEffect)(()=>{tJ.k.get("/api/notebooks").then(e=>m(e)).catch(e=>D.V.error("[Home]","Failed to fetch notebooks",{error:e})),tJ.k.get("/api/review/due?pageSize=1").then(e=>g(e.total)).catch(e=>D.V.error("[Home]","Failed to fetch due reviews",{error:e}))},[]);let y=async e=>{N.setAnalysisStep("saving"),await N.saveQuestion({...e,wrongAnswerText:e.wrongAnswerText||null,mistakeAnalysis:e.mistakeAnalysis||null,mistakeStatus:e.mistakeStatus||"unknown",originalImageUrl:""}),N.setAnalysisStep("idle")},w=s.reduce((e,t)=>e+(t._count?.errorItems||0),0),S=[{value:"image",icon:i.f,label:e.app?.uploadImage||"Take Photo"},{value:"text",icon:u.f,label:e.app?.manualInput||"Manual Input"},{value:"file",icon:o,label:e.app?.fileImport||"Import File"},{value:"direct",icon:l.f,label:e.app?.directInput||"Manual Entry"}];return(0,t.jsxs)("main",{className:"min-h-screen",children:[(0,t.jsx)(tX.f,{status:N.analysisStep,completed:N.completedStages}),(0,t.jsxs)("div",{className:`mx-auto space-y-6 px-4 py-6 md:px-8 md:py-8 ${"review"===N.step?"max-w-6xl":"max-w-4xl"}`,children:[(0,t.jsx)(tW.f,{message:N.saveError,onDismiss:N.dismissSaveError}),"upload"===N.step&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(tF,{notebookCount:s.length,itemCount:w,dueCount:f,targetNotebook:a?x?.name:void 0}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)(tZ.f,{options:S,value:h,onChange:p}),N.pendingTask&&(0,t.jsx)(tV.f,{task:N.pendingTask,onRefresh:N.refreshPendingTask,onDismiss:N.dismissPendingTask}),N.lastImported&&(0,t.jsx)(tB.f,{imported:N.lastImported,onDismiss:N.dismissImported}),N.batchImages?(0,t.jsx)(d.f,{images:N.batchImages,subjectId:a,onClose:N.closeBatch}):"image"===h?(0,t.jsxs)(t.Fragment,{children:[N.parts.length>0&&(0,t.jsx)(tH.f,{parts:N.parts.map(e=>e.dataUrl),busy:N.isBusy,onFinish:()=>void N.finishParts(),onDiscard:N.discardParts}),(0,t.jsx)(tY.f,{onImageSelect:N.selectImage,isAnalyzing:N.isBusy})]}):"text"===h?(0,t.jsx)(tQ.f,{onSubmit:N.submitText,isAnalyzing:N.isBusy,defaultNotebookName:x?.name,onCreateBatch:N.createTextBatch,creatingBatch:N.creatingBatch,onSwitchToFileImport:()=>p("file")}):"file"===h?(0,t.jsx)(tP,{defaultNotebookId:a||void 0}):(0,t.jsx)(O,{onSubmit:y,defaultNotebookId:a||void 0,defaultNotebookName:x?.name,isSaving:"saving"===N.analysisStep})]})]}),N.croppingImage&&(0,t.jsx)(tG.f,{imageSrc:N.croppingImage,open:N.isCropperOpen,onClose:N.closeCropper,onRegionsSelected:N.cropRegions,allowMulti:0===N.parts.length,onAutoSplit:0===N.parts.length?N.autoSplitImage:void 0,onAddPart:N.parts.length<t2.u-1?N.addPart:void 0,partCount:N.parts.length}),"review"===N.step&&N.parsedData&&(0,t.jsx)(c.f,{initialData:N.parsedData,onSave:N.saveReviewed,onCancel:N.cancelReview,imagePreview:N.currentImage,initialSubjectId:a||void 0,aiTimeout:N.aiTimeout})]})]})}e.s(["default",0,function(){return(0,t.jsx)(r.Suspense,{fallback:(0,t.jsx)(tK.f,{}),children:(0,t.jsx)(t4,{})})}],952683)}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(()=>{"use strict";(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,711241,e=>{var t=e.i(456420);let a={name:"arrow-left",size:24,node:[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],711241)},576248,e=>{var t=e.i(456420);let a={name:"circle-question-mark",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],aliases:["help-circle","circle-help"]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],576248)},77043,e=>{var t=e.i(456420);let a={name:"printer",size:24,node:[["path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2",key:"143wyd"}],["path",{d:"M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6",key:"1itne7"}],["rect",{x:"6",y:"14",width:"12",height:"8",rx:"1",key:"1ue0tg"}]]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],77043)},856522,e=>{var t=e.i(456420);let a={name:"save",size:24,node:[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],856522)},328623,e=>{var t=e.i(456420);let a={name:"sparkles",size:24,node:[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],aliases:["stars"]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],328623)},591124,e=>{var t=e.i(843476),a=e.i(271645),r=e.i(522016),s=e.i(618566),l=e.i(215519),i=e.i(306831),n=e.i(456420);let o={name:"clipboard-check",size:24,node:[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m9 14 2 2 4-4",key:"df797q"}]]};o.node;let c=(0,n.f)(o);var d=e.i(632781),u=e.i(77043),m=e.i(395925),x=e.i(856522),f=e.i(759659),h=e.i(487486),g=e.i(519455),p=e.i(793479),b=e.i(590546),y=e.i(86963),v=e.i(339023),j=e.i(663661),k=e.i(257428),N=e.i(716327),w=e.i(456539),S=e.i(263676),C=e.i(515288),_=e.i(511445),I=e.i(991686),q=e.i(393733),R=e.i(149704),$=e.i(520732),z=e.i(741120),T=e.i(931454),M=e.i(111110),F=e.i(41931),A=e.i(201276),E=e.i(294114);function V({paperId:e,paperMode:r,question:s,onDone:l}){let{t:i,language:n}=(0,M.b)(),[o,c]=(0,a.useState)(null),u="original"!==r&&0===s.attempts.length&&!!s.errorItemId&&"pending"!==s.status,m="ready"===s.status&&!!s.questionText?.trim();if(!u&&!m)return null;let x=async t=>{let a="question"===t?i.exam.regenerateQuestionConfirm:i.exam.regenerateAnswerConfirm;if(await (0,E.u)(a)){c(t);try{let a=await F.k.post(`/api/exams/${e}/questions/${s.id}/regenerate`,{mode:t,language:n},{timeout:6e5,recoverable:!0});l(a)}catch(r){let e=r?.data?.message||"",a=i.errors[e];A.V.error("[ExamRegenerate]","Failed to regenerate exam question",{mode:t,code:e}),E.c.error("HAS_RESULTS"===e?i.exam.regenerateHasResults:"string"==typeof a?a:i.exam.regenerateFailed)}finally{c(null)}}};return(0,t.jsxs)("div",{className:"flex flex-wrap gap-1",children:[u&&(0,t.jsxs)(g.f,{variant:"ghost",size:"sm",onClick:()=>x("question"),disabled:null!==o,children:["question"===o?(0,t.jsx)(d.f,{className:"mr-1 h-4 w-4 animate-spin"}):(0,t.jsx)(z.f,{className:"mr-1 h-4 w-4"}),"question"===o?i.exam.regenerating:i.exam.regenerateQuestion]}),m&&(0,t.jsxs)(g.f,{variant:"ghost",size:"sm",onClick:()=>x("answer"),disabled:null!==o,children:["answer"===o?(0,t.jsx)(d.f,{className:"mr-1 h-4 w-4 animate-spin"}):(0,t.jsx)(T.f,{className:"mr-1 h-4 w-4"}),"answer"===o?i.exam.regenerating:i.exam.regenerateAnswer]})]})}var D=e.i(763896);function H({questionId:e,score:r,disabled:s,onSave:l}){let{t:i}=(0,M.b)(),[n,o]=(0,a.useState)(null),[c,d]=(0,a.useState)(!1),u=n??(null!==r?String(r):""),m=u.trim(),x=""===m?null:(0,D.H)(Number(m)),f=""===m||null!==x,h=x!==r,g=async()=>{if(!f||!h||c){if(null!==n&&!f)return;o(null);return}d(!0);try{await l(e,x),o(null)}catch(e){A.V.error("[ExamQuestionScore]","保存单题分值失败",{error:e}),E.c.error(i.exam.saveQuestionScoreFailed)}finally{d(!1)}};return(0,t.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,t.jsx)("label",{className:"text-xs text-muted-foreground",htmlFor:`exam-score-${e}`,children:i.exam.questionScore}),(0,t.jsx)(p.f,{id:`exam-score-${e}`,type:"number",min:.1,max:D.D,step:.1,value:u,disabled:c||s,"aria-invalid":!f,placeholder:i.exam.questionScorePlaceholder,title:i.exam.questionScoreHint,onChange:e=>o(e.target.value),onBlur:()=>void g(),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),g())},className:"h-7 w-20 text-sm"})]})}function P({paperId:e,paperMode:s,question:n,displayNumber:o,editingResult:c,onResultChange:u,onDeleteAttempt:m,onRegenerated:x,previewFigureScale:f,previewFigureAlign:g,onSaveFigureScale:p,onSaveScore:b}){let{t:y}=(0,M.b)(),{timeZone:v}=(0,l.M)(),[j,k]=(0,a.useState)(!1),z=void 0!==c,T=(()=>{if(!n.error)return"";if("SOURCE_DELETED"===n.error)return y.exam.sourceDeleted;let e=n.error.split(":")[0].trim(),t=y.errors[e];return"string"==typeof t?t:n.error})();return(0,t.jsx)(C.N,{children:(0,t.jsxs)(C.O,{className:"space-y-3 pt-4",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[(0,t.jsxs)("span",{className:"font-semibold",children:[o??n.order,"."]}),n.errorItemId?(0,t.jsxs)(r.default,{href:`/error-items/${n.errorItemId}`,className:"font-mono text-xs text-primary hover:underline",children:[y.exam.source," ",n.sourceShortId]}):(0,t.jsxs)("span",{className:"font-mono text-xs text-muted-foreground",children:[n.sourceShortId," · ",y.exam.sourceDeleted]}),n.notebookName&&(0,t.jsx)(h.f,{variant:"secondary",children:n.notebookName}),b&&(0,t.jsx)("span",{className:"ml-auto",children:(0,t.jsx)(H,{questionId:n.id,score:n.score??null,disabled:z,onSave:b})})]}),n.attempts.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:n.attempts.map((e,a)=>(0,t.jsxs)(h.f,{variant:"outline",className:`gap-1 font-normal ${I.x[e.result]||""}`,children:[(0,t.jsx)("span",{children:y.exam.attemptLabel.replace("{n}",String(a+1))}),(0,t.jsx)("span",{className:"tabular-nums",children:(0,i.r)(e.createdAt,"MM-dd",v)}),(0,t.jsx)("span",{className:"font-semibold",children:y.mastery.results[e.result]}),z&&m&&(0,t.jsx)("button",{type:"button","aria-label":y.mastery.deleteRecord,className:"-mr-1 rounded hover:bg-black/10",onClick:()=>m(e.id),children:(0,t.jsx)(S.X,{className:"h-3 w-3"})})]},e.id))}),"pending"===n.status&&(0,t.jsxs)("p",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,t.jsx)(d.f,{className:"h-4 w-4 animate-spin"}),y.exam.questionPending]}),"failed"===n.status&&(0,t.jsxs)("p",{className:"text-sm text-destructive",children:[y.exam.questionFailed,T?`${y.common.colon}${T}`:""]}),"ready"===n.status&&n.questionText&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(_.f,{content:n.questionText}),p?(0,t.jsx)($.f,{svg:n.figureSvg,scale:n.figureScale,align:n.figureAlign,previewScaleOverride:f,previewAlignOverride:g,onSave:(e,t)=>p(n.id,e,t)},`${n.id}-${n.figureScale??100}-${n.figureAlign??"center"}`):(0,t.jsx)(R.f,{svg:n.figureSvg,scale:f??n.figureScale,align:g??n.figureAlign}),(0,t.jsxs)("button",{type:"button",className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground",onClick:()=>k(!j),children:[j?(0,t.jsx)(w.f,{className:"h-3 w-3"}):(0,t.jsx)(N.f,{className:"h-3 w-3"}),y.exam.showAnswer]}),j&&(0,t.jsxs)("div",{className:"space-y-2 rounded-md bg-muted/40 p-3",children:[n.answerText&&(0,t.jsx)(_.f,{content:n.answerText,className:"font-semibold"}),n.analysis&&(0,t.jsx)(_.f,{content:n.analysis})]})]}),!z&&x&&(0,t.jsx)(V,{paperId:e,paperMode:s,question:n,onDone:x}),z&&"ready"===n.status&&n.errorItemId&&u&&(0,t.jsx)(q.f,{value:c,onChange:u,size:"sm"})]})})}function X({scores:e,disabled:r,onSave:s}){let{t:l}=(0,M.b)(),i=e.filter(e=>"number"==typeof e),n=i.length===e.length&&new Set(i).size<=1,o=n?i[0]??null:null,[c,d]=(0,a.useState)(null),[u,m]=(0,a.useState)(!1);if(0===e.length)return null;let x=c??(null!==o?String(o):""),f=""===x.trim()?null:(0,D.H)(Number(x)),h=""===x.trim()||null!==f,b=null!==c&&(f??null)!==o,y=async e=>{if(e.preventDefault(),h&&b&&!u){m(!0);try{await s(f),d(null),E.c.success(l.common.messages.saveSuccess)}catch(e){A.V.error("[ExamScoreBar]","统一保存试卷分值失败",{error:e}),E.c.error(l.exam.saveQuestionScoreFailed)}finally{m(!1)}}};return(0,t.jsxs)("form",{onSubmit:y,className:"flex flex-wrap items-center gap-2 rounded-md border bg-background p-3 text-sm",children:[(0,t.jsx)("span",{className:"font-medium",children:l.exam.uniformScore}),(0,t.jsx)(p.f,{type:"number",min:.1,max:D.D,step:.1,value:x,disabled:u||r,"aria-invalid":!h,"aria-label":l.exam.uniformScore,placeholder:l.exam.questionScorePlaceholder,onChange:e=>d(e.target.value),className:"h-8 w-24"}),(0,t.jsx)(g.f,{type:"submit",size:"sm",disabled:u||r||!b||!h,children:u?l.common.progress.saving:l.common.save}),null!==o&&!n&&(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:l.exam.totalScoreUnscored.replace("{count}",String(e.length-i.length))}),(0,t.jsx)("p",{className:"w-full text-xs text-muted-foreground",children:l.exam.uniformScoreHint}),!h&&(0,t.jsx)("p",{className:"w-full text-xs text-destructive",children:l.exam.questionScoreInvalid})]})}var U=e.i(336653);function B({section:e}){let{t:a}=(0,M.b)(),r=null!==e.scoreTotal?a.exam.sectionSummaryScored.replace("{count}",String(e.count)).replace("{total}",String(e.scoreTotal)):a.exam.sectionSummary.replace("{count}",String(e.count));return(0,t.jsxs)("div",{className:"flex flex-wrap items-baseline gap-x-3 gap-y-1 border-b pb-2 pt-4",children:[(0,t.jsx)("h2",{className:"text-base font-bold",children:e.title}),(0,t.jsxs)("span",{className:"text-sm text-muted-foreground",children:[r,null!==e.scoreTotal&&e.unscored>0&&(0,t.jsxs)("span",{children:["(",a.exam.sectionSummaryUnscored.replace("{count}",String(e.unscored)),")"]})]})]})}function O({paperId:e,paperMode:a,sections:r,draft:s,onResultChange:l,onDeleteAttempt:i,onRegenerated:n,uniformPreview:o,onSaveFigureScale:c,onSaveScore:d}){let u=r=>(0,t.jsx)(P,{paperId:e,paperMode:a,question:r.question,displayNumber:r.displayNumber,editingResult:s?s[r.question.id]??null:void 0,onResultChange:e=>l(r.question.id,e),onDeleteAttempt:i,onRegenerated:n,previewFigureScale:o.scale,previewFigureAlign:o.align,onSaveFigureScale:c,onSaveScore:d},r.question.id);return(0,t.jsx)("div",{className:"space-y-3",children:r.map(e=>(0,t.jsxs)("section",{className:"space-y-3",children:[(0,t.jsx)(B,{section:e}),e.items.map(u)]},e.title))})}function L({paperId:e,paperMode:a,groupByType:r,questions:s,draft:l,onResultChange:i,onDeleteAttempt:n,onRegenerated:o,uniformPreview:c,onSaveFigureScale:d,onSaveScore:u,onSaveUniformScore:m,onSaveGroupByType:x}){let{t:f,language:h}=(0,M.b)(),g=r?(0,U.f)(s,h):null;return(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-x-6 gap-y-2",children:[(0,t.jsx)(X,{scores:s.map(e=>e.score??null),disabled:!!l,onSave:m}),(0,t.jsxs)("label",{className:"flex items-center gap-2 text-sm",title:f.exam.groupByTypeHint,children:[(0,t.jsx)(k.f,{checked:r,disabled:!!l,onCheckedChange:e=>void x(!0===e)}),f.exam.groupByType]})]}),g?(0,t.jsx)(O,{paperId:e,paperMode:a,sections:g,draft:l,onResultChange:i,onDeleteAttempt:n,onRegenerated:o,uniformPreview:c,onSaveFigureScale:d,onSaveScore:u}):s.map(r=>(0,t.jsx)(P,{paperId:e,paperMode:a,question:r,editingResult:l?l[r.id]??null:void 0,onResultChange:e=>i(r.id,e),onDeleteAttempt:n,onRegenerated:o,previewFigureScale:c.scale,previewFigureAlign:c.align,onSaveFigureScale:d,onSaveScore:u},r.id))]})}var K=e.i(35209);e.s(["default",0,function(){let{timeZone:e}=(0,l.M)(),n=(0,s.useParams)(),o=(0,s.useRouter)(),{t:k,language:N}=(0,M.b)(),w=n.id,[S,C]=(0,a.useState)(null);(0,K.f)(k.exam.title,S?.title);let[_,I]=(0,a.useState)(!1),[q,R]=(0,a.useState)(null),[$,z]=(0,a.useState)((0,i.r)(new Date,"yyyy-MM-dd",e)),[T,A]=(0,a.useState)(!1),[V,H]=(0,a.useState)(null),[P,X]=(0,a.useState)({scale:null,align:null}),U=(0,a.useCallback)(async()=>{try{C(await F.k.get(`/api/exams/${w}`))}catch{I(!0)}},[w]);if((0,a.useEffect)(()=>{U()},[U]),(0,a.useEffect)(()=>{if(S?.status!=="generating")return;let e=setTimeout(U,3e3);return()=>clearTimeout(e)},[S,U]),_)return(0,t.jsx)("div",{className:"p-8 text-center",children:k.exam.notFound});if(!S)return(0,t.jsx)(y.f,{label:k.common.loading});let B=S.questions.filter(e=>"ready"===e.status).length,O=S.questions.some(e=>e.attempts.length>0),Q=S.questions.some(e=>"failed"===e.status),W=S.questions.filter(e=>"ready"===e.status&&e.errorItemId),G=S.questions.filter(e=>"ready"===e.status&&!!e.figureSvg),Y=q?W.filter(e=>q[e.id]).length:0,J=async()=>{if(q&&0!==Y){A(!0),H(null);try{await F.k.post(`/api/exams/${S.id}/results`,{takenAt:(0,i.$)($,e),results:W.filter(e=>q[e.id]).map(e=>({questionId:e.id,result:q[e.id]}))}),R(null),H(k.exam.resultsSaved),await U()}catch{H(k.exam.resultsSaveFailed)}finally{A(!1)}}},Z=async e=>{if(await (0,E.u)(k.mastery.deleteRecordConfirm,{destructive:!0}))try{await F.k.delete(`/api/practice/record/${e}`),await U()}catch{H(k.mastery.deleteRecordFailed)}},ee=async()=>{await F.k.post(`/api/exams/${S.id}/retry`,{language:N}),await U()},et=async()=>{await (0,E.u)(k.exam.deleteConfirm,{destructive:!0})&&(await F.k.delete(`/api/exams/${S.id}`),o.push("/exams"))},ea=async(e,t,a)=>{await F.k.patch(`/api/exams/${S.id}`,{questionId:e,figureScale:t,figureAlign:a}),C(r=>r?{...r,questions:r.questions.map(r=>r.id===e?{...r,figureScale:t,figureAlign:a}:r)}:r)},er=async e=>{await F.k.patch(`/api/exams/${S.id}`,e),C(t=>t?{...t,questions:t.questions.map(t=>({...t,...e}))}:t)},es=async(e,t)=>{await F.k.patch(`/api/exams/${S.id}`,{questionId:e,score:t}),C(a=>a?{...a,questions:a.questions.map(a=>a.id===e?{...a,score:t}:a)}:a)},el=async e=>{await F.k.patch(`/api/exams/${S.id}`,{score:e}),C(t=>t?{...t,questions:t.questions.map(t=>({...t,score:e}))}:t)},ei=async e=>{await F.k.patch(`/api/exams/${S.id}`,{groupByType:e}),C(t=>t?{...t,groupByType:e}:t)},en=(0,D.n)(S.questions.filter(e=>"ready"===e.status).map(e=>e.score??null));return(0,t.jsx)("main",{className:"mx-auto min-h-screen max-w-6xl px-4 py-6 md:px-8 md:py-8",children:(0,t.jsxs)("div",{className:"space-y-6 pb-24",children:[(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsx)(b.f,{fallbackUrl:"/exams",className:"-ml-2 shrink-0"}),(0,t.jsxs)("div",{className:"flex-1 min-w-0 space-y-2",children:[(0,t.jsx)("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight break-words",children:S.title}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-sm text-muted-foreground",children:[(0,t.jsx)(j.f,{status:S.status,recorded:O}),"original"===S.mode&&(0,t.jsx)(h.f,{variant:"secondary",children:k.exam.modes.original}),(0,t.jsx)("span",{children:k.exam.progress.replace("{ready}",String(B)).replace("{total}",String(S.questions.length))}),null!==en.total&&(0,t.jsxs)("span",{children:[k.exam.totalScore.replace("{total}",(0,D.s)(en.total)),en.unscored>0&&(0,t.jsxs)("span",{className:"text-xs",children:["(",k.exam.totalScoreUnscored.replace("{count}",String(en.unscored)),")"]})]}),(0,t.jsx)("span",{children:(0,i.r)(S.createdAt,"yyyy-MM-dd HH:mm",e)})]})]})]}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsx)(r.default,{href:`/exams/${S.id}/print`,children:(0,t.jsxs)(g.f,{variant:"outline",size:"sm",disabled:0===B,children:[(0,t.jsx)(u.f,{className:"mr-2 h-4 w-4"}),k.exam.print]})}),!q&&W.length>0&&(0,t.jsxs)(g.f,{size:"sm",onClick:()=>{H(null),R({}),z((0,i.r)(new Date,"yyyy-MM-dd",e))},children:[(0,t.jsx)(c,{className:"mr-2 h-4 w-4"}),k.exam.recordResults]}),Q&&"generating"!==S.status&&(0,t.jsxs)(g.f,{variant:"outline",size:"sm",onClick:ee,children:[(0,t.jsx)(m.f,{className:"mr-2 h-4 w-4"}),k.exam.retryFailed]}),(0,t.jsxs)(g.f,{variant:"ghost",size:"sm",onClick:et,className:"text-red-600 dark:text-red-400 hover:text-red-700 dark:hover:text-red-300 hover:bg-red-50 dark:hover:bg-red-950/40 sm:ml-auto",children:[(0,t.jsx)(f.f,{className:"mr-2 h-4 w-4"}),k.exam.delete]})]}),S.questions.length<S.requestedCount&&(0,t.jsx)("p",{className:"rounded-md border border-amber-200 dark:border-amber-900 bg-amber-50 dark:bg-amber-950/40 p-3 text-sm text-amber-800 dark:text-amber-200",children:k.exam.fewerThanRequested.replaceAll("{actual}",String(S.questions.length))}),V&&(0,t.jsx)("p",{className:"rounded-md border p-3 text-sm",children:V}),q&&(0,t.jsxs)("div",{className:"space-y-2 rounded-md border bg-muted/30 p-3",children:[(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2",children:[(0,t.jsx)("label",{htmlFor:"exam-taken-at",className:"text-sm font-medium",children:k.exam.takenAt}),(0,t.jsx)(p.f,{id:"exam-taken-at",type:"date",value:$,onChange:e=>z(e.target.value),className:"sm:w-48"})]}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:k.exam.recordHint})]}),G.length>0&&(0,t.jsx)(v.f,{scales:G.map(e=>e.figureScale),aligns:G.map(e=>e.figureAlign),onPreviewChange:X,onSave:er}),(0,t.jsx)(L,{paperId:S.id,paperMode:S.mode,groupByType:S.groupByType,questions:S.questions,draft:q,onResultChange:(e,t)=>R(a=>a?{...a,[e]:t}:a),onDeleteAttempt:Z,onRegenerated:U,uniformPreview:P,onSaveFigureScale:ea,onSaveScore:es,onSaveUniformScore:el,onSaveGroupByType:ei}),q&&(0,t.jsx)("div",{className:"fixed inset-x-0 bottom-16 z-30 border-t bg-background/95 p-3 backdrop-blur md:bottom-0",children:(0,t.jsxs)("div",{className:"max-w-4xl mx-auto flex items-center justify-end gap-2",children:[0===Y&&(0,t.jsx)("span",{className:"mr-auto text-xs text-muted-foreground",children:k.exam.noResultSelected}),(0,t.jsx)(g.f,{variant:"outline",onClick:()=>R(null),disabled:T,children:k.exam.cancel}),(0,t.jsxs)(g.f,{onClick:J,disabled:T||!$||0===Y,children:[T?(0,t.jsx)(d.f,{className:"mr-2 h-4 w-4 animate-spin"}):(0,t.jsx)(x.f,{className:"mr-2 h-4 w-4"}),k.exam.saveResults]})]})})]})})}],591124)},520732,e=>{var t=e.i(843476),a=e.i(271645),r=e.i(149704),s=e.i(519455),l=e.i(793479),i=e.i(111110),n=e.i(294114),o=e.i(184110),c=e.i(201276);e.s(["f",0,function({svg:e,scale:d,align:u,previewScaleOverride:m,previewAlignOverride:x,onSave:f}){let{t:h}=(0,i.b)(),g=(0,a.useId)(),p=(0,o.V)(d),b=(0,o.o)(u),[y,v]=(0,a.useState)(null),[j,k]=(0,a.useState)(null),[N,w]=(0,a.useState)(!1),S=y??String(p),C=""!==S.trim()&&(0,o.x)(Number(S)),_=C?Number(S):p,I=j??b,q=m??_,R=x??I,$=null!==y&&(!C||Number(S)!==p)||null!==j&&j!==b;if(!e)return null;let z=async e=>{if(e.preventDefault(),C&&$&&!N){w(!0);try{await f(_,I),v(null),k(null),n.c.success(h.common.messages.saveSuccess)}catch(e){c.V.error("[FigureScale]","保存配图比例失败",{error:e}),n.c.error(h.common.messages.saveFailed)}finally{w(!1)}}};return(0,t.jsxs)("div",{children:[(0,t.jsx)(r.f,{svg:e,scale:q,align:R}),(0,t.jsxs)("form",{onSubmit:z,className:"figure-scale-editor-controls space-y-2 rounded-md border p-3 print:hidden",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[(0,t.jsx)("label",{htmlFor:g,children:h.figure.scale}),(0,t.jsx)(l.f,{id:g,type:"number",min:o._,max:o.a,step:1,value:S,disabled:N,"aria-describedby":`${g}-hint`,"aria-invalid":!C,onChange:e=>v(e.target.value),className:"h-8 w-20"}),(0,t.jsx)("span",{children:"%"}),(0,t.jsx)(s.f,{type:"button",variant:"outline",size:"sm",disabled:N||C&&_===o.n,onClick:()=>v(String(o.n)),children:h.figure.resetScale}),(0,t.jsxs)("div",{role:"group","aria-label":h.figure.align,className:"inline-flex items-center gap-1",children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:h.figure.align}),o.j.map(e=>(0,t.jsx)(s.f,{type:"button",variant:I===e?"default":"outline",size:"sm",disabled:N,"aria-pressed":I===e,onClick:()=>k(e===b?null:e),children:h.figure.aligns[e]},e))]}),(0,t.jsx)(s.f,{type:"submit",size:"sm",disabled:N||!$||!C,children:N?h.common.progress.saving:h.common.save}),$&&(0,t.jsx)(s.f,{type:"button",variant:"ghost",size:"sm",disabled:N,onClick:()=>{v(null),k(null)},children:h.common.cancel})]}),(0,t.jsx)("input",{type:"range",min:o._,max:o.a,step:1,value:_,disabled:N,"aria-label":h.figure.scaleSlider,"aria-describedby":`${g}-hint`,onChange:e=>v(e.target.value),className:"block h-6 w-full max-w-sm accent-primary"}),(0,t.jsx)("p",{id:`${g}-hint`,className:"text-xs text-muted-foreground",children:h.figure.scaleHint})]})]})}])},339023,763896,336653,e=>{var t=e.i(843476),a=e.i(271645),r=e.i(519455),s=e.i(793479),l=e.i(111110),i=e.i(294114),n=e.i(184110),o=e.i(201276);function c(e){let t=0,a=0;for(let r of e)"number"==typeof r&&Number.isFinite(r)&&(t+=1,a+=r);return{scored:t,unscored:e.length-t,total:t>0?Math.round(10*a)/10:null}}e.s(["f",0,function({scales:e,aligns:c,onPreviewChange:d,onSave:u}){let{t:m}=(0,l.b)(),x=(0,a.useId)(),f=e.map(n.V),h=new Set(f).size<=1,g=f[0]??n.n,p=(c??e.map(()=>n.E)).map(n.o),b=new Set(p).size<=1,y=p[0]??n.E,[v,j]=(0,a.useState)(null),[k,N]=(0,a.useState)(null),[w,S]=(0,a.useState)(!1);if(0===e.length)return null;let C=v??String(g),_=""!==C.trim()&&(0,n.x)(Number(C)),I=_?Number(C):g,q=k??y,R=null!==v||null!==k,$=null!==v?!_||!h||Number(C)!==g:!R&&!h,z=null!==k?!b||k!==y:!R&&!b,T=$||z,M=(e,t)=>{let a=null!==e&&""!==e.trim()&&(0,n.x)(Number(e))?Number(e):null;d?.({scale:a,align:t})},F=e=>{j(e),M(e,k)},A=async e=>{if(e.preventDefault(),_&&T&&!w){S(!0);try{let e={};null===v&&(R||h)||(e.figureScale=I),null===k&&(R||b)||(e.figureAlign=q),await u(e),j(null),N(null),d?.({scale:null,align:null}),i.c.success(m.common.messages.saveSuccess)}catch(e){o.V.error("[ExamFigureScale]","统一保存试卷配图设置失败",{error:e}),i.c.error(m.common.messages.saveFailed)}finally{S(!1)}}};return(0,t.jsxs)("form",{onSubmit:A,className:"figure-scale-editor-controls w-full space-y-2 rounded-md border bg-background p-3 print:hidden",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[(0,t.jsx)("label",{htmlFor:x,className:"font-medium",children:m.exam.uniformFigureScale}),(0,t.jsx)(s.f,{id:x,type:"number",min:n._,max:n.a,step:1,value:C,disabled:w,"aria-describedby":`${x}-hint`,"aria-invalid":!_,onChange:e=>F(e.target.value),className:"h-8 w-20"}),(0,t.jsx)("span",{children:"%"}),(0,t.jsx)(r.f,{type:"button",variant:"outline",size:"sm",disabled:w||h&&_&&I===n.n,onClick:()=>F(String(n.n)),children:m.figure.resetScale}),(0,t.jsxs)("div",{role:"group","aria-label":m.exam.uniformFigureAlign,className:"inline-flex items-center gap-1",children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:m.exam.uniformFigureAlign}),n.j.map(e=>(0,t.jsx)(r.f,{type:"button",variant:q===e&&(null!==k||b)?"default":"outline",size:"sm",disabled:w,"aria-pressed":q===e&&(null!==k||b),onClick:()=>{var t;N(t=b&&e===y?null:e),M(v,t)},children:m.figure.aligns[e]},e))]}),(0,t.jsx)(r.f,{type:"submit",size:"sm",disabled:w||!T||!_,children:w?m.common.progress.saving:m.common.save}),R&&(0,t.jsx)(r.f,{type:"button",variant:"ghost",size:"sm",disabled:w,onClick:()=>{j(null),N(null),d?.({scale:null,align:null})},children:m.common.cancel})]}),(0,t.jsx)("input",{type:"range",min:n._,max:n.a,step:1,value:I,disabled:w,"aria-label":m.exam.uniformFigureScaleSlider,"aria-describedby":`${x}-hint`,onChange:e=>F(e.target.value),className:"block h-6 w-full max-w-sm accent-primary"}),(0,t.jsx)("p",{id:`${x}-hint`,className:"text-xs text-muted-foreground",children:m.exam.uniformFigureScaleHint})]})}],339023),e.s(["D",0,1e3,"s",0,function(e){return Number.isInteger(e)?String(e):e.toFixed(1)},"H",0,function(e){return null===e||"number"!=typeof e||!Number.isFinite(e)||e<.001||e>1e3||Math.abs(10*e-Math.round(10*e))>1e-6?null:Math.round(10*e)/10},"n",0,c],763896);var d=e.i(401280);let u=["一","二","三","四","五","六","七","八","九","十","十一","十二","十三","十四","十五","十六","十七","十八","十九","二十"],m=["I","II","III","IV","V","VI","VII","VIII","IX","X","XI","XII","XIII","XIV","XV","XVI","XVII","XVIII","XIX","XX"];e.s(["f",0,function(e,t){let a=new Map;for(let e of d.V)a.set(e,[]);for(let t of[...e].sort((e,t)=>e.order-t.order))a.get(function(e){let t=e.questionType??e.errorItemQuestionType??null;return d.V.includes(t??"")?t:"other"}(t)).push(t);let r=[],s=1,l=0;for(let e of d.V){let i=a.get(e);if(0===i.length)continue;let n=c(i.map(e=>e.score??null));r.push({type:"other"===e?null:e,title:function(e,t,a){let r="zh"===a?d.H[e]:d.u[e];return"zh"===a?`${u[t]}、${r}`:`Part ${m[t]}. ${r}`}(e,l,t),items:i.map(e=>({question:e,displayNumber:s++})),count:i.length,scoreTotal:n.total,unscored:n.unscored}),l+=1}return r}],336653)},663661,e=>{var t=e.i(843476),a=e.i(487486),r=e.i(111110);let s={generating:"bg-blue-100 dark:bg-blue-900/40 text-blue-700 dark:text-blue-300 border-blue-200 dark:border-blue-900",ready:"bg-indigo-100 dark:bg-indigo-900/40 text-indigo-700 dark:text-indigo-300 border-indigo-200 dark:border-indigo-900",partial:"bg-amber-100 dark:bg-amber-900/40 text-amber-700 dark:text-amber-300 border-amber-200 dark:border-amber-900",failed:"bg-red-100 dark:bg-red-900/40 text-red-700 dark:text-red-300 border-red-200 dark:border-red-900",completed:"bg-green-100 dark:bg-green-900/40 text-green-700 dark:text-green-300 border-green-200 dark:border-green-900"};e.s(["f",0,function({status:e,recorded:l}){let{t:i}=(0,r.b)(),n=l&&("ready"===e||"partial"===e)?"completed":e;return(0,t.jsx)(a.f,{variant:"outline",className:s[n],children:i.exam.status[n]})}])},991686,931454,e=>{var t=e.i(843476),a=e.i(271645),r=e.i(522016),s=e.i(215519),l=e.i(306831),i=e.i(716327),n=e.i(456539),o=e.i(632781),c=e.i(77071),d=e.i(328623),u=e.i(759659),m=e.i(487486),x=e.i(519455),f=e.i(515288),h=e.i(511445),g=e.i(856522),p=e.i(793479),b=e.i(393733),y=e.i(111110),v=e.i(41931);function j({errorItemId:e,onSaved:r,onCancel:i}){let{t:n}=(0,y.b)(),{timeZone:c}=(0,s.M)(),d=(0,l.r)(new Date,"yyyy-MM-dd",c),[u,m]=(0,a.useState)(null),[f,h]=(0,a.useState)(d),[k,N]=(0,a.useState)(!1),[w,S]=(0,a.useState)(null),C=async()=>{if(u&&f){N(!0),S(null);try{await v.k.post("/api/practice/record",{errorItemId:e,result:u,source:"manual",takenAt:(0,l.$)(f,c)}),r()}catch{S(n.mastery.resultSaveFailed)}finally{N(!1)}}};return(0,t.jsxs)("div",{className:"space-y-3 rounded-md border bg-muted/30 p-3",children:[(0,t.jsx)(b.f,{value:u,onChange:m,disabled:k}),(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2",children:[(0,t.jsx)("label",{htmlFor:`practice-date-${e}`,className:"text-sm font-medium",children:n.mastery.recordDate}),(0,t.jsx)(p.f,{id:`practice-date-${e}`,type:"date",value:f,max:d,onChange:e=>h(e.target.value),className:"sm:w-48"}),(0,t.jsxs)("div",{className:"flex gap-2 sm:ml-auto",children:[(0,t.jsx)(x.f,{variant:"outline",size:"sm",onClick:i,disabled:k,className:"flex-1 sm:flex-none",children:n.exam.cancel}),(0,t.jsxs)(x.f,{size:"sm",onClick:C,disabled:k||!u||!f,className:"flex-1 sm:flex-none",children:[k?(0,t.jsx)(o.f,{className:"mr-2 h-4 w-4 animate-spin"}):(0,t.jsx)(g.f,{className:"mr-2 h-4 w-4"}),n.mastery.saveResult]})]})]}),w&&(0,t.jsx)("p",{className:"text-sm text-destructive",children:w})]})}var k=e.i(149704),N=e.i(294114),w=e.i(905110);let S={correct:"bg-green-100 dark:bg-green-900/40 text-green-700 dark:text-green-300 border-green-200 dark:border-green-900",wrong:"bg-red-100 dark:bg-red-900/40 text-red-700 dark:text-red-300 border-red-200 dark:border-red-900",not_attempted:"bg-amber-100 dark:bg-amber-900/40 text-amber-700 dark:text-amber-300 border-amber-200 dark:border-amber-900"};e.s(["K",0,function({errorItemId:e,onMasteryStatusChange:g}){let{timeZone:p}=(0,s.M)(),{t:b}=(0,y.b)(),[C,_]=(0,a.useState)(null),[I,q]=(0,a.useState)(null),[R,$]=(0,a.useState)(0),[z,T]=(0,a.useState)(!1),M=(0,a.useCallback)(()=>{v.k.get(`/api/error-items/${e}/practice-records`).then(e=>{_(e),g?.(e.masteryStatus)}).catch(()=>void 0)},[e,g]);(0,a.useEffect)(M,[M]);let F=()=>{$(0),M()},A=async e=>{if(await (0,N.u)(b.mastery.deleteRecordConfirm,{destructive:!0}))try{await v.k.delete(`/api/practice/record/${e}`),F()}catch{N.c.error(b.mastery.deleteRecordFailed)}},E=C?.records[0],V=!!E&&(!C?.masteryEvaluatedAt||new Date(E.createdAt)>new Date(C.masteryEvaluatedAt));if((0,a.useEffect)(()=>{if(!V||R>=20)return;let e=setTimeout(()=>{$(e=>e+1),M()},4e3);return()=>clearTimeout(e)},[V,R,M]),!C)return null;let D=C.masteryProbability,H=null===D?null:Math.round(100*D),P=null===H?"":(0,w.m)(D,C.masteryThreshold)?"bg-green-500":H>=30?"bg-amber-500":"bg-red-500",X=b.practice.difficulty;return(0,t.jsxs)(f.N,{children:[(0,t.jsx)(f.Y,{children:(0,t.jsxs)(f.v,{className:"flex items-center gap-2 text-base",children:[(0,t.jsx)(d.f,{className:"h-4 w-4 text-primary"}),b.mastery.probability]})}),(0,t.jsxs)(f.O,{className:"space-y-4",children:[null===H?(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:V?b.mastery.pending:b.mastery.notEvaluated}):(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-baseline justify-between gap-2",children:[(0,t.jsxs)("span",{className:"text-3xl font-bold",children:[H,"%"]}),(0,t.jsxs)("span",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[V&&(0,t.jsx)(o.f,{className:"h-3 w-3 animate-spin"}),(0,t.jsx)(m.f,{variant:"outline",children:"ai"===C.masterySource?b.mastery.aiEvaluated:b.mastery.estimated})]})]}),(0,t.jsx)("div",{className:"h-2 w-full rounded-full bg-muted overflow-hidden",children:(0,t.jsx)("div",{className:`h-full ${P} transition-all`,style:{width:`${H}%`}})}),C.masteryReason&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:C.masteryReason}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:b.mastery.thresholdHint.replace("{threshold}",String(C.masteryThreshold))})]}),(0,t.jsxs)("div",{className:"space-y-2 border-t pt-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsx)("h4",{className:"text-sm font-semibold",children:b.mastery.history}),!z&&(0,t.jsxs)(x.f,{variant:"outline",size:"sm",onClick:()=>T(!0),children:[(0,t.jsx)(c.f,{className:"mr-1 h-4 w-4"}),b.mastery.addRecord]})]}),z&&(0,t.jsx)(j,{errorItemId:e,onCancel:()=>T(!1),onSaved:()=>{T(!1),F()}}),0===C.records.length?(0,t.jsx)("p",{className:"text-sm text-muted-foreground italic",children:b.mastery.noHistory}):(0,t.jsx)("ul",{className:"divide-y rounded-md border",children:C.records.map(e=>(0,t.jsxs)("li",{className:"p-3 text-sm space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-start gap-2",children:[(0,t.jsxs)("button",{type:"button",className:"flex min-w-0 flex-1 flex-wrap items-center gap-2 text-left",onClick:()=>q(I===e.id?null:e.id),children:[(0,t.jsx)("span",{className:"text-muted-foreground tabular-nums",children:(0,l.r)(e.createdAt,"yyyy-MM-dd HH:mm",p)}),(0,t.jsx)(m.f,{variant:"outline",className:S[e.result]||"",children:b.mastery.results[e.result]||e.result}),e.difficulty&&(0,t.jsx)(m.f,{variant:"secondary",children:X[e.difficulty]||e.difficulty}),(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:e.exam?`${b.mastery.sources.exam} \xb7 ${e.exam.title}`:b.mastery.sources[e.source]||b.mastery.sources.practice}),e.questionText&&(0,t.jsx)("span",{className:"ml-auto text-muted-foreground",children:I===e.id?(0,t.jsx)(n.f,{className:"h-4 w-4"}):(0,t.jsx)(i.f,{className:"h-4 w-4"})})]}),(0,t.jsx)("button",{type:"button","aria-label":b.mastery.deleteRecord,title:b.mastery.deleteRecord,className:"shrink-0 rounded p-1 text-muted-foreground hover:bg-red-50 dark:hover:bg-red-950/40 hover:text-red-600 dark:hover:text-red-400",onClick:()=>A(e.id),children:(0,t.jsx)(u.f,{className:"h-4 w-4"})})]}),I===e.id&&e.questionText&&(0,t.jsxs)("div",{className:"space-y-2 rounded-md bg-muted/40 p-3",children:[(0,t.jsx)(h.f,{content:e.questionText}),(0,t.jsx)(k.f,{svg:e.figureSvg}),e.wrongAnswerText&&(0,t.jsxs)("div",{className:"border-t pt-2",children:[(0,t.jsx)("p",{className:"mb-1 font-medium",children:b.editor.wrongAnswerText}),(0,t.jsx)(h.f,{content:e.wrongAnswerText})]}),e.mistakeAnalysis&&(0,t.jsxs)("div",{className:"border-t pt-2",children:[(0,t.jsx)("p",{className:"mb-1 font-medium",children:b.editor.mistakeAnalysis}),(0,t.jsx)(h.f,{content:e.mistakeAnalysis})]}),e.originalImageUrl&&(0,t.jsx)("img",{src:e.originalImageUrl,alt:b.editor.wrongAnswerText,className:"max-h-96 max-w-full rounded object-contain"}),e.answerText&&(0,t.jsx)("div",{className:"border-t pt-2",children:(0,t.jsx)(h.f,{content:e.answerText,className:"font-semibold"})}),e.exam&&(0,t.jsx)(r.default,{href:`/exams/${e.exam.paperId}`,className:"text-xs text-primary hover:underline",children:e.exam.title})]})]},e.id))})]})]})]})},"x",0,S],991686);var C=e.i(534693);e.s(["f",()=>C.f],931454)},393733,e=>{var t=e.i(843476),a=e.i(548161),r=e.i(576248),s=e.i(583967),l=e.i(111110);let i=[{value:"correct",icon:a.f,active:"border-green-600 bg-green-50 dark:bg-green-950/40 text-green-700 dark:text-green-300"},{value:"wrong",icon:s.f,active:"border-red-600 bg-red-50 dark:bg-red-950/40 text-red-700 dark:text-red-300"},{value:"not_attempted",icon:r.f,active:"border-amber-600 bg-amber-50 dark:bg-amber-950/40 text-amber-700 dark:text-amber-300"}];e.s(["f",0,function({value:e,onChange:a,disabled:r,size:s="md"}){let{t:n}=(0,l.b)(),o="sm"===s?"px-2 py-1 text-xs":"px-3 py-2 text-sm";return(0,t.jsx)("div",{className:"grid grid-cols-3 gap-2",role:"radiogroup",children:i.map(({value:l,icon:i,active:c})=>(0,t.jsxs)("button",{type:"button",role:"radio","aria-checked":e===l,disabled:r,onClick:()=>a(l),className:`flex items-center justify-center gap-1 rounded-md border font-medium transition-colors disabled:opacity-60 ${o} ${e===l?c:"border-input hover:bg-muted"}`,children:[(0,t.jsx)(i,{className:"sm"===s?"h-3 w-3":"h-4 w-4"}),n.mastery.results[l]]},l))})}])},149704,e=>{var t=e.i(843476),a=e.i(111110),r=e.i(398019),s=e.i(184110),l=e.i(975157);let i={left:"mr-auto",center:"mx-auto",right:"ml-auto"};e.s(["f",0,function({svg:e,scale:n,align:o,className:c}){let{t:d}=(0,a.b)();if(!e)return null;let u=(0,s.V)(n),m=(0,s.o)(o);return(0,t.jsx)("figure",{className:(0,l.f)("question-figure my-3",c),children:(0,t.jsx)("img",{src:(0,r.d)(e),alt:d.figure.alt,className:(0,l.f)(i[m],"block h-auto max-w-full rounded border bg-white p-2"),style:{..."left"===m?{marginLeft:0,marginRight:"auto"}:"right"===m?{marginLeft:"auto",marginRight:0}:{},maxHeight:360,zoom:u/100,maxWidth:`${Math.min(u,100)}%`}})})}])},590546,e=>{var t=e.i(843476),a=e.i(618566),r=e.i(519455),s=e.i(711241);e.s(["f",0,function({fallbackUrl:e,className:l}){let i=(0,a.useRouter)();return(0,t.jsx)(r.f,{variant:"ghost",size:"icon",onClick:()=>{i.push(e)},className:l,children:(0,t.jsx)(s.f,{className:"h-5 w-5"})})}])},257428,e=>{var t=e.i(843476),a=e.i(271645),r=e.i(820783),s=e.i(30030),l=e.i(981140),i=e.i(369340),n=e.i(635804),o=e.i(296626),c=e.i(248425),d=Object.defineProperty,u=(e,t)=>d(e,"name",{value:t,configurable:!0}),m="Checkbox",[x,f]=(0,s.f)(m),[h,g]=x(m);function p(e){let{__scopeCheckbox:r,checked:s,children:l,defaultChecked:n,disabled:o,form:c,name:d,onCheckedChange:u,required:x,value:f="on",internal_do_not_use_render:g}=e,[p,b]=(0,i.f)({prop:s,defaultProp:n??!1,onChange:u,caller:m}),[y,v]=a.useState(null),[j,w]=a.useState(null),[S,C]=a.useState(null),_=!y||!!c||!!y.closest("form"),I={checked:p,disabled:o,setChecked:b,control:y,setControl:v,name:d,form:c,value:f,userClick:S,onUserClick:C,required:x,defaultChecked:!N(n)&&n,isFormControl:_,bubbleInput:j,setBubbleInput:w};return(0,t.jsx)(h,{scope:r,...I,children:k(g)?g(I):l})}u(p,"CheckboxProvider");var b=a.forwardRef(u(function({__scopeCheckbox:e,onKeyDown:s,onClick:i,...n},o){let{control:d,value:m,disabled:x,checked:f,required:h,setControl:p,setChecked:b,onUserClick:y,isFormControl:v,bubbleInput:j}=g("CheckboxTrigger",e),k=(0,r.f)(o,p),S=a.useRef(f);return a.useEffect(()=>{let e=d?.form;if(e){let t=u(()=>b(S.current),"reset");return e.addEventListener("reset",t),()=>e.removeEventListener("reset",t)}},[d,b]),(0,t.jsx)(c.V.button,{type:"button",role:"checkbox","aria-checked":N(f)?"mixed":f,"aria-required":h,"data-state":w(f),"data-disabled":x?"":void 0,disabled:x,value:m,...n,ref:k,onKeyDown:(0,l.f)(s,e=>{"Enter"===e.key&&e.preventDefault()}),onClick:(0,l.f)(i,e=>{let t=e.isPropagationStopped();y({requestedChecked:!!N(f)||!f,hasConsumerStoppedPropagation:t}),b(e=>!!N(e)||!e),j&&v&&!t&&e.stopPropagation()})})},"CheckboxTrigger")),y=a.forwardRef(u(function(e,a){let{__scopeCheckbox:r,name:s,checked:l,defaultChecked:i,required:n,disabled:o,value:c,onCheckedChange:d,form:u,...m}=e;return(0,t.jsx)(p,{__scopeCheckbox:r,checked:l,defaultChecked:i,disabled:o,required:n,onCheckedChange:d,name:s,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(b,{...m,ref:a,__scopeCheckbox:r}),e&&(0,t.jsx)(j,{__scopeCheckbox:r})]})})},"Checkbox")),v=a.forwardRef(u(function(e,a){let{__scopeCheckbox:r,forceMount:s,...l}=e,i=g("CheckboxIndicator",r);return(0,t.jsx)(o.f,{present:s||N(i.checked)||!0===i.checked,children:(0,t.jsx)(c.V.span,{"data-state":w(i.checked),"data-disabled":i.disabled?"":void 0,...l,ref:a,style:{pointerEvents:"none",...e.style}})})},"CheckboxIndicator")),j=a.forwardRef(u(function({__scopeCheckbox:e,onClick:s,...i},o){let{control:d,userClick:u,checked:m,defaultChecked:x,required:f,disabled:h,name:p,value:b,form:y,bubbleInput:v,setBubbleInput:j}=g("CheckboxBubbleInput",e),k=(0,r.f)(o,j),w=(0,n.f)(d),S=a.useRef(!1),C=a.useRef(m),_=a.useRef(u),I=a.useRef(null);a.useEffect(()=>{if(!v)return;let e=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked").set;if(!e)return;let t=C.current!==m;C.current=m;let a=null!==u&&u!==_.current;if(_.current=u,a)I.current=t?null:u,t&&(v.indeterminate=N(m),e.call(v,!N(m)&&m)),v.dispatchEvent(new Event("click",{bubbles:!u.hasConsumerStoppedPropagation}));else if(t){let t=I.current;I.current=null;let a=t?.requestedChecked===m;S.current=!0,v.indeterminate=N(m),e.call(v,!N(m)&&m),v.dispatchEvent(new Event("click",{bubbles:!(a&&t.hasConsumerStoppedPropagation)})),S.current=!1}},[v,m,u]);let q=a.useRef(!N(m)&&m);return(0,t.jsx)(c.V.input,{type:"checkbox","aria-hidden":!0,defaultChecked:x??q.current,required:f,disabled:h,name:p,value:b,form:y,...i,tabIndex:-1,ref:k,onClick:(0,l.f)(s,e=>{S.current&&e.stopPropagation()}),style:{...i.style,...w,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"CheckboxBubbleInput"));function k(e){return"function"==typeof e}function N(e){return"indeterminate"===e}function w(e){return N(e)?"indeterminate":e?"checked":"unchecked"}u(k,"isFunction"),u(N,"isIndeterminate"),u(w,"getState");var S=e.i(689664),C=e.i(975157);let _=a.forwardRef(({className:e,...a},r)=>(0,t.jsx)(y,{ref:r,className:(0,C.f)("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...a,children:(0,t.jsx)(v,{className:(0,C.f)("flex items-center justify-center text-current"),children:(0,t.jsx)(S.f,{className:"h-4 w-4"})})}));_.displayName=y.displayName,e.s(["f",0,_],257428)},86963,e=>{var t=e.i(843476),a=e.i(632781);e.s(["f",0,function({label:e}){return(0,t.jsxs)("div",{className:"flex min-h-[50vh] flex-col items-center justify-center gap-3 text-muted-foreground",children:[(0,t.jsx)(a.f,{className:"h-7 w-7 animate-spin text-primary"}),e&&(0,t.jsx)("p",{className:"text-sm",children:e})]})}])},184110,e=>{let t=["left","center","right"],a="center";function r(e){return"number"==typeof e&&Number.isInteger(e)&&e>=10&&e<=200}e.s(["E",0,a,"n",0,100,"j",0,t,"a",0,200,"_",0,10,"x",0,r,"o",0,function(e){return"string"==typeof e&&t.includes(e)?e:a},"V",0,function(e){return r(e)?e:100}])},398019,e=>{e.s(["K",0,1e5,"d",0,function(e){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`}])},35209,e=>{var t=e.i(271645),a=e.i(111110);e.s(["f",0,function(...e){let{t:r}=(0,a.b)(),s=[r.pageTitle.base,...e.map(e=>"string"==typeof e?e.trim():"").filter(e=>e.length>0)].join("-");(0,t.useEffect)(()=>{document.title=s},[s])}])},401280,e=>{let t={single_choice:"single_choice",singlechoice:"single_choice","single choice":"single_choice","single-choice":"single_choice",multiple_choice:"multiple_choice",multiplechoice:"multiple_choice","multiple choice":"multiple_choice","multiple-choice":"multiple_choice",multichoice:"multiple_choice","multi choice":"multiple_choice",true_false:"true_false",truefalse:"true_false","true/false":"true_false","true false":"true_false","true-false":"true_false","true / false":"true_false",fill_blank:"fill_blank",fillblank:"fill_blank","fill in the blank":"fill_blank","fill-in-the-blank":"fill_blank",fillintheblank:"fill_blank",calculation:"calculation",solution:"solution",reading:"reading",cloze:"cloze",writing:"writing",other:"other",选择题:"single_choice",单项选择:"single_choice",单选:"single_choice",单选题:"single_choice",不定项:"multiple_choice",不定项选择:"multiple_choice",多项选择:"multiple_choice",多选:"multiple_choice",多选题:"multiple_choice",判断:"true_false",判断题:"true_false",是非:"true_false",是非题:"true_false",填空:"fill_blank",填空题:"fill_blank",口算:"calculation",计算:"calculation",计算题:"calculation",解答:"solution",解答题:"solution",应用:"solution",应用题:"solution",证明:"solution",证明题:"solution",简答:"solution",简答题:"solution",阅读:"reading",阅读理解:"reading",完形:"cloze",完形填空:"cloze",作文:"writing",写作:"writing",书面表达:"writing",其他:"other"};e.s(["O",0,"__none__","V",0,["single_choice","multiple_choice","true_false","fill_blank","calculation","solution","reading","cloze","writing","other"],"u",0,{single_choice:"Single Choice",multiple_choice:"Multiple Choice",true_false:"True / False",fill_blank:"Fill in the Blank",calculation:"Calculation",solution:"Solution",reading:"Reading Comprehension",cloze:"Cloze",writing:"Writing",other:"Other"},"H",0,{single_choice:"单选题",multiple_choice:"多选题",true_false:"判断题",fill_blank:"填空题",calculation:"计算题",solution:"解答题",reading:"阅读理解",cloze:"完形填空",writing:"写作",other:"其他"},"P",0,function(e){if("string"!=typeof e)return null;let a=e.trim().toLowerCase();return a?t[a]??null:null}])}])})();
|
|
@@ -35,4 +35,4 @@
|
|
|
35
35
|
${t}
|
|
36
36
|
</body>
|
|
37
37
|
</html>
|
|
38
|
-
`}(j.title,t.outerHTML,"en"===w?"en":"zh-CN"),a=URL.createObjectURL(new Blob([n],{type:"text/html;charset=utf-8"})),i=document.createElement("a");i.href=a,e=j.title,i.download=`${e.replace(/[\\/:*?"<>|\s]+/g,"_").slice(0,80)||"exam"}.html`,i.click(),URL.revokeObjectURL(a)},children:[(0,t.jsx)(i.f,{className:"mr-2 h-4 w-4"}),b.exam.downloadHtml]}),(0,t.jsxs)(l.f,{size:"sm",onClick:()=>window.print(),children:[(0,t.jsx)(s.f,{className:"mr-2 h-4 w-4"}),b.exam.printNow]})]}),"auto"===S&&(0,t.jsx)("p",{className:"w-full text-xs text-muted-foreground",children:b.exam.answerSpaceAutoHint}),P&&(0,t.jsx)("p",{className:"w-full text-xs text-destructive",children:b.exam.answerSpaceSaveFailed}),E<j.questions.length&&(0,t.jsx)("p",{className:"w-full text-xs text-muted-foreground",children:b.exam.notReadyHint}),V.length>0&&(0,t.jsx)(u.f,{scales:V.map(e=>e.figureScale),aligns:V.map(e=>e.figureAlign),onPreviewChange:z,onSave:L})]})}),(0,t.jsx)(_,{ref:q,paper:j,includeAnswers:y,answerSpace:S,customSpaces:R,uniformPreview:I,onSaveFigureScale:M,onChangeCustomSpace:$})]})}],580685)},520732,e=>{var t=e.i(843476),n=e.i(271645),a=e.i(149704),i=e.i(519455),s=e.i(793479),l=e.i(111110),r=e.i(294114),o=e.i(184110),c=e.i(201276);e.s(["f",0,function({svg:e,scale:u,align:m,previewScaleOverride:d,previewAlignOverride:f,onSave:x}){let{t:h}=(0,l.b)(),p=(0,n.useId)(),g=(0,o.V)(u),b=(0,o.o)(m),[w,j]=(0,n.useState)(null),[v,y]=(0,n.useState)(null),[k,S]=(0,n.useState)(!1),_=w??String(g),N=""!==_.trim()&&(0,o.x)(Number(_)),C=N?Number(_):g,I=v??b,z=d??C,q=f??I,T=null!==w&&(!N||Number(_)!==g)||null!==v&&v!==b;if(!e)return null;let A=async e=>{if(e.preventDefault(),N&&T&&!k){S(!0);try{await x(C,I),j(null),y(null),r.c.success(h.common.messages.saveSuccess)}catch(e){c.V.error("[FigureScale]","保存配图比例失败",{error:e}),r.c.error(h.common.messages.saveFailed)}finally{S(!1)}}};return(0,t.jsxs)("div",{children:[(0,t.jsx)(a.f,{svg:e,scale:z,align:q}),(0,t.jsxs)("form",{onSubmit:A,className:"figure-scale-editor-controls space-y-2 rounded-md border p-3 print:hidden",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[(0,t.jsx)("label",{htmlFor:p,children:h.figure.scale}),(0,t.jsx)(s.f,{id:p,type:"number",min:o._,max:o.a,step:1,value:_,disabled:k,"aria-describedby":`${p}-hint`,"aria-invalid":!N,onChange:e=>j(e.target.value),className:"h-8 w-20"}),(0,t.jsx)("span",{children:"%"}),(0,t.jsx)(i.f,{type:"button",variant:"outline",size:"sm",disabled:k||N&&C===o.n,onClick:()=>j(String(o.n)),children:h.figure.resetScale}),(0,t.jsxs)("div",{role:"group","aria-label":h.figure.align,className:"inline-flex items-center gap-1",children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:h.figure.align}),o.j.map(e=>(0,t.jsx)(i.f,{type:"button",variant:I===e?"default":"outline",size:"sm",disabled:k,"aria-pressed":I===e,onClick:()=>y(e===b?null:e),children:h.figure.aligns[e]},e))]}),(0,t.jsx)(i.f,{type:"submit",size:"sm",disabled:k||!T||!N,children:k?h.common.progress.saving:h.common.save}),T&&(0,t.jsx)(i.f,{type:"button",variant:"ghost",size:"sm",disabled:k,onClick:()=>{j(null),y(null)},children:h.common.cancel})]}),(0,t.jsx)("input",{type:"range",min:o._,max:o.a,step:1,value:C,disabled:k,"aria-label":h.figure.scaleSlider,"aria-describedby":`${p}-hint`,onChange:e=>j(e.target.value),className:"block h-6 w-full max-w-sm accent-primary"}),(0,t.jsx)("p",{id:`${p}-hint`,className:"text-xs text-muted-foreground",children:h.figure.scaleHint})]})]})}])},339023,763896,336653,e=>{var t=e.i(843476),n=e.i(271645),a=e.i(519455),i=e.i(793479),s=e.i(111110),l=e.i(294114),r=e.i(184110),o=e.i(201276);function c(e){let t=0,n=0;for(let a of e)"number"==typeof a&&Number.isFinite(a)&&(t+=1,n+=a);return{scored:t,unscored:e.length-t,total:t>0?Math.round(10*n)/10:null}}e.s(["f",0,function({scales:e,aligns:c,onPreviewChange:u,onSave:m}){let{t:d}=(0,s.b)(),f=(0,n.useId)(),x=e.map(r.V),h=new Set(x).size<=1,p=x[0]??r.n,g=(c??e.map(()=>r.E)).map(r.o),b=new Set(g).size<=1,w=g[0]??r.E,[j,v]=(0,n.useState)(null),[y,k]=(0,n.useState)(null),[S,_]=(0,n.useState)(!1);if(0===e.length)return null;let N=j??String(p),C=""!==N.trim()&&(0,r.x)(Number(N)),I=C?Number(N):p,z=y??w,q=null!==j||null!==y,T=null!==j?!C||!h||Number(N)!==p:!q&&!h,A=null!==y?!b||y!==w:!q&&!b,R=T||A,$=(e,t)=>{let n=null!==e&&""!==e.trim()&&(0,r.x)(Number(e))?Number(e):null;u?.({scale:n,align:t})},F=e=>{v(e),$(e,y)},P=async e=>{if(e.preventDefault(),C&&R&&!S){_(!0);try{let e={};null===j&&(q||h)||(e.figureScale=I),null===y&&(q||b)||(e.figureAlign=z),await m(e),v(null),k(null),u?.({scale:null,align:null}),l.c.success(d.common.messages.saveSuccess)}catch(e){o.V.error("[ExamFigureScale]","统一保存试卷配图设置失败",{error:e}),l.c.error(d.common.messages.saveFailed)}finally{_(!1)}}};return(0,t.jsxs)("form",{onSubmit:P,className:"figure-scale-editor-controls w-full space-y-2 rounded-md border bg-background p-3 print:hidden",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[(0,t.jsx)("label",{htmlFor:f,className:"font-medium",children:d.exam.uniformFigureScale}),(0,t.jsx)(i.f,{id:f,type:"number",min:r._,max:r.a,step:1,value:N,disabled:S,"aria-describedby":`${f}-hint`,"aria-invalid":!C,onChange:e=>F(e.target.value),className:"h-8 w-20"}),(0,t.jsx)("span",{children:"%"}),(0,t.jsx)(a.f,{type:"button",variant:"outline",size:"sm",disabled:S||h&&C&&I===r.n,onClick:()=>F(String(r.n)),children:d.figure.resetScale}),(0,t.jsxs)("div",{role:"group","aria-label":d.exam.uniformFigureAlign,className:"inline-flex items-center gap-1",children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:d.exam.uniformFigureAlign}),r.j.map(e=>(0,t.jsx)(a.f,{type:"button",variant:z===e&&(null!==y||b)?"default":"outline",size:"sm",disabled:S,"aria-pressed":z===e&&(null!==y||b),onClick:()=>{var t;k(t=b&&e===w?null:e),$(j,t)},children:d.figure.aligns[e]},e))]}),(0,t.jsx)(a.f,{type:"submit",size:"sm",disabled:S||!R||!C,children:S?d.common.progress.saving:d.common.save}),q&&(0,t.jsx)(a.f,{type:"button",variant:"ghost",size:"sm",disabled:S,onClick:()=>{v(null),k(null),u?.({scale:null,align:null})},children:d.common.cancel})]}),(0,t.jsx)("input",{type:"range",min:r._,max:r.a,step:1,value:I,disabled:S,"aria-label":d.exam.uniformFigureScaleSlider,"aria-describedby":`${f}-hint`,onChange:e=>F(e.target.value),className:"block h-6 w-full max-w-sm accent-primary"}),(0,t.jsx)("p",{id:`${f}-hint`,className:"text-xs text-muted-foreground",children:d.exam.uniformFigureScaleHint})]})}],339023),e.s(["D",0,1e3,"W",0,.001,"s",0,function(e){return Number.isInteger(e)?String(e):e.toFixed(1)},"H",0,function(e){return null===e||"number"!=typeof e||!Number.isFinite(e)||e<.001||e>1e3||Math.abs(10*e-Math.round(10*e))>1e-6?null:Math.round(10*e)/10},"n",0,c],763896);var u=e.i(401280);let m=["一","二","三","四","五","六","七","八","九","十","十一","十二","十三","十四","十五","十六","十七","十八","十九","二十"],d=["I","II","III","IV","V","VI","VII","VIII","IX","X","XI","XII","XIII","XIV","XV","XVI","XVII","XVIII","XIX","XX"];e.s(["f",0,function(e,t){let n=new Map;for(let e of u.V)n.set(e,[]);for(let t of[...e].sort((e,t)=>e.order-t.order))n.get(function(e){let t=e.questionType??e.errorItemQuestionType??null;return u.V.includes(t??"")?t:"other"}(t)).push(t);let a=[],i=1,s=0;for(let e of u.V){let l=n.get(e);if(0===l.length)continue;let r=c(l.map(e=>e.score??null));a.push({type:"other"===e?null:e,title:function(e,t,n){let a="zh"===n?u.H[e]:u.u[e];return"zh"===n?`${m[t]}、${a}`:`Part ${d[t]}. ${a}`}(e,s,t),items:l.map(e=>({question:e,displayNumber:i++})),count:l.length,scoreTotal:r.total,unscored:r.unscored}),s+=1}return a}],336653)},84583,e=>{var t=e.i(843476),n=e.i(519455),a=e.i(111110),i=e.i(122330);e.s(["f",0,function({effectivePx:e,isCustom:s,onChange:l,onReset:r}){let{t:o}=(0,a.b)(),c=(0,i.O)(e);return(0,t.jsxs)("div",{className:"answer-space-controls print:hidden flex flex-wrap items-center gap-2 text-xs text-muted-foreground mt-2 pt-1",children:[(0,t.jsxs)("span",{children:[o.exam.questionAnswerSpace,": ",c,"px"]}),(0,t.jsx)(n.f,{type:"button",variant:"outline",size:"sm",className:"h-6 px-2 text-xs","aria-label":o.exam.decreaseAnswerSpace,disabled:c<=i.r,onClick:()=>l((0,i.O)(c-i.W)),children:"-"}),(0,t.jsx)("input",{type:"range",min:i.r,max:i.R,step:10,value:c,"aria-label":o.exam.questionAnswerSpaceSlider,onChange:e=>l((0,i.O)(Number(e.target.value))),className:"w-24 sm:w-32 accent-primary"}),(0,t.jsx)(n.f,{type:"button",variant:"outline",size:"sm",className:"h-6 px-2 text-xs","aria-label":o.exam.increaseAnswerSpace,disabled:c>=i.R,onClick:()=>l((0,i.O)(c+i.W)),children:"+"}),s&&(0,t.jsx)(n.f,{type:"button",variant:"ghost",size:"sm",className:"h-6 px-2 text-xs",onClick:r,children:o.exam.resetQuestionAnswerSpace})]})}])},149704,e=>{var t=e.i(843476),n=e.i(111110),a=e.i(398019),i=e.i(184110),s=e.i(975157);let l={left:"mr-auto",center:"mx-auto",right:"ml-auto"};e.s(["f",0,function({svg:e,scale:r,align:o,className:c}){let{t:u}=(0,n.b)();if(!e)return null;let m=(0,i.V)(r),d=(0,i.o)(o);return(0,t.jsx)("figure",{className:(0,s.f)("question-figure my-3",c),children:(0,t.jsx)("img",{src:(0,a.d)(e),alt:u.figure.alt,className:(0,s.f)(l[d],"block h-auto max-w-full rounded border bg-white p-2"),style:{..."left"===d?{marginLeft:0,marginRight:"auto"}:"right"===d?{marginLeft:"auto",marginRight:0}:{},maxHeight:360,zoom:m/100,maxWidth:`${Math.min(m,100)}%`}})})}])},590546,e=>{var t=e.i(843476),n=e.i(618566),a=e.i(519455),i=e.i(711241);e.s(["f",0,function({fallbackUrl:e,className:s}){let l=(0,n.useRouter)();return(0,t.jsx)(a.f,{variant:"ghost",size:"icon",onClick:()=>{l.push(e)},className:s,children:(0,t.jsx)(i.f,{className:"h-5 w-5"})})}])},257428,e=>{var t=e.i(843476),n=e.i(271645),a=e.i(820783),i=e.i(30030),s=e.i(981140),l=e.i(369340),r=e.i(635804),o=e.i(296626),c=e.i(248425),u=Object.defineProperty,m=(e,t)=>u(e,"name",{value:t,configurable:!0}),d="Checkbox",[f,x]=(0,i.f)(d),[h,p]=f(d);function g(e){let{__scopeCheckbox:a,checked:i,children:s,defaultChecked:r,disabled:o,form:c,name:u,onCheckedChange:m,required:f,value:x="on",internal_do_not_use_render:p}=e,[g,b]=(0,l.f)({prop:i,defaultProp:r??!1,onChange:m,caller:d}),[w,j]=n.useState(null),[v,S]=n.useState(null),[_,N]=n.useState(null),C=!w||!!c||!!w.closest("form"),I={checked:g,disabled:o,setChecked:b,control:w,setControl:j,name:u,form:c,value:x,userClick:_,onUserClick:N,required:f,defaultChecked:!k(r)&&r,isFormControl:C,bubbleInput:v,setBubbleInput:S};return(0,t.jsx)(h,{scope:a,...I,children:y(p)?p(I):s})}m(g,"CheckboxProvider");var b=n.forwardRef(m(function({__scopeCheckbox:e,onKeyDown:i,onClick:l,...r},o){let{control:u,value:d,disabled:f,checked:x,required:h,setControl:g,setChecked:b,onUserClick:w,isFormControl:j,bubbleInput:v}=p("CheckboxTrigger",e),y=(0,a.f)(o,g),_=n.useRef(x);return n.useEffect(()=>{let e=u?.form;if(e){let t=m(()=>b(_.current),"reset");return e.addEventListener("reset",t),()=>e.removeEventListener("reset",t)}},[u,b]),(0,t.jsx)(c.V.button,{type:"button",role:"checkbox","aria-checked":k(x)?"mixed":x,"aria-required":h,"data-state":S(x),"data-disabled":f?"":void 0,disabled:f,value:d,...r,ref:y,onKeyDown:(0,s.f)(i,e=>{"Enter"===e.key&&e.preventDefault()}),onClick:(0,s.f)(l,e=>{let t=e.isPropagationStopped();w({requestedChecked:!!k(x)||!x,hasConsumerStoppedPropagation:t}),b(e=>!!k(e)||!e),v&&j&&!t&&e.stopPropagation()})})},"CheckboxTrigger")),w=n.forwardRef(m(function(e,n){let{__scopeCheckbox:a,name:i,checked:s,defaultChecked:l,required:r,disabled:o,value:c,onCheckedChange:u,form:m,...d}=e;return(0,t.jsx)(g,{__scopeCheckbox:a,checked:s,defaultChecked:l,disabled:o,required:r,onCheckedChange:u,name:i,form:m,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(b,{...d,ref:n,__scopeCheckbox:a}),e&&(0,t.jsx)(v,{__scopeCheckbox:a})]})})},"Checkbox")),j=n.forwardRef(m(function(e,n){let{__scopeCheckbox:a,forceMount:i,...s}=e,l=p("CheckboxIndicator",a);return(0,t.jsx)(o.f,{present:i||k(l.checked)||!0===l.checked,children:(0,t.jsx)(c.V.span,{"data-state":S(l.checked),"data-disabled":l.disabled?"":void 0,...s,ref:n,style:{pointerEvents:"none",...e.style}})})},"CheckboxIndicator")),v=n.forwardRef(m(function({__scopeCheckbox:e,onClick:i,...l},o){let{control:u,userClick:m,checked:d,defaultChecked:f,required:x,disabled:h,name:g,value:b,form:w,bubbleInput:j,setBubbleInput:v}=p("CheckboxBubbleInput",e),y=(0,a.f)(o,v),S=(0,r.f)(u),_=n.useRef(!1),N=n.useRef(d),C=n.useRef(m),I=n.useRef(null);n.useEffect(()=>{if(!j)return;let e=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked").set;if(!e)return;let t=N.current!==d;N.current=d;let n=null!==m&&m!==C.current;if(C.current=m,n)I.current=t?null:m,t&&(j.indeterminate=k(d),e.call(j,!k(d)&&d)),j.dispatchEvent(new Event("click",{bubbles:!m.hasConsumerStoppedPropagation}));else if(t){let t=I.current;I.current=null;let n=t?.requestedChecked===d;_.current=!0,j.indeterminate=k(d),e.call(j,!k(d)&&d),j.dispatchEvent(new Event("click",{bubbles:!(n&&t.hasConsumerStoppedPropagation)})),_.current=!1}},[j,d,m]);let z=n.useRef(!k(d)&&d);return(0,t.jsx)(c.V.input,{type:"checkbox","aria-hidden":!0,defaultChecked:f??z.current,required:x,disabled:h,name:g,value:b,form:w,...l,tabIndex:-1,ref:y,onClick:(0,s.f)(i,e=>{_.current&&e.stopPropagation()}),style:{...l.style,...S,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"CheckboxBubbleInput"));function y(e){return"function"==typeof e}function k(e){return"indeterminate"===e}function S(e){return k(e)?"indeterminate":e?"checked":"unchecked"}m(y,"isFunction"),m(k,"isIndeterminate"),m(S,"getState");var _=e.i(689664),N=e.i(975157);let C=n.forwardRef(({className:e,...n},a)=>(0,t.jsx)(w,{ref:a,className:(0,N.f)("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...n,children:(0,t.jsx)(j,{className:(0,N.f)("flex items-center justify-center text-current"),children:(0,t.jsx)(_.f,{className:"h-4 w-4"})})}));C.displayName=w.displayName,e.s(["f",0,C],257428)},122330,e=>{let t=["auto","none","small","medium","large"],n={none:0,small:60,medium:120,large:240},a={choice:12,judgment:12,fill:16,solution:240};function i(e){return Number.isFinite(e)?Math.min(600,Math.max(0,Math.round(e))):0}let s=/(?:(?:^|[\s*+\-))::。??;;,,_])([A-D])\s*[..::]|(?:^|\s{2,}|[))::。??])([A-D])\s*、|[((]([A-D])[))])/gm,l=/判断(?:下列|以下|正误|对错|题)|对的(?:打|画)|错的(?:打|画)|true\s*(?:or|\/)\s*false/i,r=/_{2,}|(?:\\_){2,}|\\underline|\\rule\b|\\hspace\b|(\s*)|【\s*】|\[\s+\]|(?<![A-Za-z0-9_])\(\s*\)|[==]\s*[。??]?\s*$|填空/,o=/求证|证明[::,,]|写出(?:解题|计算|推导|推理)?过程|解答下列|试说明理由|请说明理由/,c=/(\s*(\d{1,2})\s*)/g,u=/(?:^|[\n。;;::??!!]\s*)\(\s*(\d{1,2})\s*\)/g;function m(e){let t=new Set;for(let n of e.matchAll(c))t.add(n[1]);for(let n of e.matchAll(u))t.add(n[1]);return Math.max(1,t.size)}e.s(["p",0,"exam-print-answer-space","W",0,20,"q",0,"auto","R",0,600,"r",0,0,"O",0,i,"I",0,function(e){return"string"==typeof e&&t.includes(e)},"T",0,function(e){return"number"!=typeof e||!Number.isInteger(e)||e<0||e>600?null:e},"z",0,function(e,t,c){let u;if("number"==typeof c&&Number.isFinite(c))return i(c);if("auto"!==e)return n[e];let d=(u=new Set(Array.from(t.matchAll(s),e=>e[1]??e[2]??e[3]))).has("A")&&u.has("B")&&u.has("C")?"choice":l.test(t)?"judgment":m(t)>1||o.test(t)?"solution":r.test(t)?"fill":"solution";if("solution"!==d)return a[d];let f=(m(t)-1)*120;return Math.min(560,a.solution+f)}])},184110,e=>{let t=["left","center","right"],n="center";function a(e){return"number"==typeof e&&Number.isInteger(e)&&e>=10&&e<=200}e.s(["E",0,n,"n",0,100,"j",0,t,"a",0,200,"_",0,10,"x",0,a,"o",0,function(e){return"string"==typeof e&&t.includes(e)?e:n},"V",0,function(e){return a(e)?e:100}])},398019,e=>{e.s(["K",0,1e5,"d",0,function(e){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`}])},442861,e=>{var t=e.i(271645),n=e.i(122330),a=e.i(201276);e.s(["f",0,function(e,i){let[s,l]=(0,t.useState)({}),[r,o]=(0,t.useState)(!1),c=(0,t.useRef)(new Map),u=(0,t.useRef)(null),m=(0,t.useRef)(i);(0,t.useEffect)(()=>{m.current=i},[i]);let d=(0,t.useMemo)(()=>{let t={};for(let a of e){let e=a.id in s?s[a.id]:(0,n.T)(a.answerSpacePx);"number"==typeof e&&(t[a.id]=e)}return t},[e,s]),f=(0,t.useCallback)(()=>{if(u.current&&(clearTimeout(u.current),u.current=null),0===c.current.size)return;let e=Array.from(c.current,([e,t])=>({id:e,answerSpacePx:t}));c.current.clear(),m.current(e).then(()=>o(!1)).catch(e=>{o(!0),a.V.error("[AnswerSpace]","Failed to save answer space",{error:e})})},[]);(0,t.useEffect)(()=>f,[f]);let x=(0,t.useCallback)((e,t)=>{if(0!==e.length){for(let{id:t,answerSpacePx:n}of(l(t=>{let n={...t};for(let{id:t,answerSpacePx:a}of e)n[t]=a;return n}),e))c.current.set(t,n);if(t)return void f();u.current&&clearTimeout(u.current),u.current=setTimeout(f,600)}},[f]),h=(0,t.useCallback)((e,t)=>{x([{id:e,answerSpacePx:t}],null===t)},[x]),p=(0,t.useCallback)(()=>{x(Object.keys(d).map(e=>({id:e,answerSpacePx:null})),!0)},[d,x]);return{customSpaces:d,setSpace:h,resetAll:p,saveFailed:r}}])},35209,e=>{var t=e.i(271645),n=e.i(111110);e.s(["f",0,function(...e){let{t:a}=(0,n.b)(),i=[a.pageTitle.base,...e.map(e=>"string"==typeof e?e.trim():"").filter(e=>e.length>0)].join("-");(0,t.useEffect)(()=>{document.title=i},[i])}])},401280,e=>{let t={single_choice:"single_choice",singlechoice:"single_choice","single choice":"single_choice","single-choice":"single_choice",multiple_choice:"multiple_choice",multiplechoice:"multiple_choice","multiple choice":"multiple_choice","multiple-choice":"multiple_choice",multichoice:"multiple_choice","multi choice":"multiple_choice",true_false:"true_false",truefalse:"true_false","true/false":"true_false","true false":"true_false","true-false":"true_false","true / false":"true_false",fill_blank:"fill_blank",fillblank:"fill_blank","fill in the blank":"fill_blank","fill-in-the-blank":"fill_blank",fillintheblank:"fill_blank",calculation:"calculation",solution:"solution",reading:"reading",cloze:"cloze",writing:"writing",other:"other",选择题:"single_choice",单项选择:"single_choice",单选:"single_choice",单选题:"single_choice",不定项:"multiple_choice",不定项选择:"multiple_choice",多项选择:"multiple_choice",多选:"multiple_choice",多选题:"multiple_choice",判断:"true_false",判断题:"true_false",是非:"true_false",是非题:"true_false",填空:"fill_blank",填空题:"fill_blank",口算:"calculation",计算:"calculation",计算题:"calculation",解答:"solution",解答题:"solution",应用:"solution",应用题:"solution",证明:"solution",证明题:"solution",简答:"solution",简答题:"solution",阅读:"reading",阅读理解:"reading",完形:"cloze",完形填空:"cloze",作文:"writing",写作:"writing",书面表达:"writing",其他:"other"};e.s(["O",0,"__none__","V",0,["single_choice","multiple_choice","true_false","fill_blank","calculation","solution","reading","cloze","writing","other"],"u",0,{single_choice:"Single Choice",multiple_choice:"Multiple Choice",true_false:"True / False",fill_blank:"Fill in the Blank",calculation:"Calculation",solution:"Solution",reading:"Reading Comprehension",cloze:"Cloze",writing:"Writing",other:"Other"},"H",0,{single_choice:"单选题",multiple_choice:"多选题",true_false:"判断题",fill_blank:"填空题",calculation:"计算题",solution:"解答题",reading:"阅读理解",cloze:"完形填空",writing:"写作",other:"其他"},"P",0,function(e){if("string"!=typeof e)return null;let n=e.trim().toLowerCase();return n?t[n]??null:null}])}])})();
|
|
38
|
+
`}(j.title,t.outerHTML,"en"===w?"en":"zh-CN"),a=URL.createObjectURL(new Blob([n],{type:"text/html;charset=utf-8"})),i=document.createElement("a");i.href=a,e=j.title,i.download=`${e.replace(/[\\/:*?"<>|\s]+/g,"_").slice(0,80)||"exam"}.html`,i.click(),URL.revokeObjectURL(a)},children:[(0,t.jsx)(i.f,{className:"mr-2 h-4 w-4"}),b.exam.downloadHtml]}),(0,t.jsxs)(l.f,{size:"sm",onClick:()=>window.print(),children:[(0,t.jsx)(s.f,{className:"mr-2 h-4 w-4"}),b.exam.printNow]})]}),"auto"===S&&(0,t.jsx)("p",{className:"w-full text-xs text-muted-foreground",children:b.exam.answerSpaceAutoHint}),P&&(0,t.jsx)("p",{className:"w-full text-xs text-destructive",children:b.exam.answerSpaceSaveFailed}),E<j.questions.length&&(0,t.jsx)("p",{className:"w-full text-xs text-muted-foreground",children:b.exam.notReadyHint}),V.length>0&&(0,t.jsx)(u.f,{scales:V.map(e=>e.figureScale),aligns:V.map(e=>e.figureAlign),onPreviewChange:z,onSave:L})]})}),(0,t.jsx)(_,{ref:q,paper:j,includeAnswers:y,answerSpace:S,customSpaces:R,uniformPreview:I,onSaveFigureScale:M,onChangeCustomSpace:$})]})}],580685)},520732,e=>{var t=e.i(843476),n=e.i(271645),a=e.i(149704),i=e.i(519455),s=e.i(793479),l=e.i(111110),r=e.i(294114),o=e.i(184110),c=e.i(201276);e.s(["f",0,function({svg:e,scale:u,align:m,previewScaleOverride:d,previewAlignOverride:f,onSave:x}){let{t:h}=(0,l.b)(),p=(0,n.useId)(),g=(0,o.V)(u),b=(0,o.o)(m),[w,j]=(0,n.useState)(null),[v,y]=(0,n.useState)(null),[k,S]=(0,n.useState)(!1),_=w??String(g),N=""!==_.trim()&&(0,o.x)(Number(_)),C=N?Number(_):g,I=v??b,z=d??C,q=f??I,T=null!==w&&(!N||Number(_)!==g)||null!==v&&v!==b;if(!e)return null;let A=async e=>{if(e.preventDefault(),N&&T&&!k){S(!0);try{await x(C,I),j(null),y(null),r.c.success(h.common.messages.saveSuccess)}catch(e){c.V.error("[FigureScale]","保存配图比例失败",{error:e}),r.c.error(h.common.messages.saveFailed)}finally{S(!1)}}};return(0,t.jsxs)("div",{children:[(0,t.jsx)(a.f,{svg:e,scale:z,align:q}),(0,t.jsxs)("form",{onSubmit:A,className:"figure-scale-editor-controls space-y-2 rounded-md border p-3 print:hidden",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[(0,t.jsx)("label",{htmlFor:p,children:h.figure.scale}),(0,t.jsx)(s.f,{id:p,type:"number",min:o._,max:o.a,step:1,value:_,disabled:k,"aria-describedby":`${p}-hint`,"aria-invalid":!N,onChange:e=>j(e.target.value),className:"h-8 w-20"}),(0,t.jsx)("span",{children:"%"}),(0,t.jsx)(i.f,{type:"button",variant:"outline",size:"sm",disabled:k||N&&C===o.n,onClick:()=>j(String(o.n)),children:h.figure.resetScale}),(0,t.jsxs)("div",{role:"group","aria-label":h.figure.align,className:"inline-flex items-center gap-1",children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:h.figure.align}),o.j.map(e=>(0,t.jsx)(i.f,{type:"button",variant:I===e?"default":"outline",size:"sm",disabled:k,"aria-pressed":I===e,onClick:()=>y(e===b?null:e),children:h.figure.aligns[e]},e))]}),(0,t.jsx)(i.f,{type:"submit",size:"sm",disabled:k||!T||!N,children:k?h.common.progress.saving:h.common.save}),T&&(0,t.jsx)(i.f,{type:"button",variant:"ghost",size:"sm",disabled:k,onClick:()=>{j(null),y(null)},children:h.common.cancel})]}),(0,t.jsx)("input",{type:"range",min:o._,max:o.a,step:1,value:C,disabled:k,"aria-label":h.figure.scaleSlider,"aria-describedby":`${p}-hint`,onChange:e=>j(e.target.value),className:"block h-6 w-full max-w-sm accent-primary"}),(0,t.jsx)("p",{id:`${p}-hint`,className:"text-xs text-muted-foreground",children:h.figure.scaleHint})]})]})}])},339023,763896,336653,e=>{var t=e.i(843476),n=e.i(271645),a=e.i(519455),i=e.i(793479),s=e.i(111110),l=e.i(294114),r=e.i(184110),o=e.i(201276);function c(e){let t=0,n=0;for(let a of e)"number"==typeof a&&Number.isFinite(a)&&(t+=1,n+=a);return{scored:t,unscored:e.length-t,total:t>0?Math.round(10*n)/10:null}}e.s(["f",0,function({scales:e,aligns:c,onPreviewChange:u,onSave:m}){let{t:d}=(0,s.b)(),f=(0,n.useId)(),x=e.map(r.V),h=new Set(x).size<=1,p=x[0]??r.n,g=(c??e.map(()=>r.E)).map(r.o),b=new Set(g).size<=1,w=g[0]??r.E,[j,v]=(0,n.useState)(null),[y,k]=(0,n.useState)(null),[S,_]=(0,n.useState)(!1);if(0===e.length)return null;let N=j??String(p),C=""!==N.trim()&&(0,r.x)(Number(N)),I=C?Number(N):p,z=y??w,q=null!==j||null!==y,T=null!==j?!C||!h||Number(N)!==p:!q&&!h,A=null!==y?!b||y!==w:!q&&!b,R=T||A,$=(e,t)=>{let n=null!==e&&""!==e.trim()&&(0,r.x)(Number(e))?Number(e):null;u?.({scale:n,align:t})},F=e=>{v(e),$(e,y)},P=async e=>{if(e.preventDefault(),C&&R&&!S){_(!0);try{let e={};null===j&&(q||h)||(e.figureScale=I),null===y&&(q||b)||(e.figureAlign=z),await m(e),v(null),k(null),u?.({scale:null,align:null}),l.c.success(d.common.messages.saveSuccess)}catch(e){o.V.error("[ExamFigureScale]","统一保存试卷配图设置失败",{error:e}),l.c.error(d.common.messages.saveFailed)}finally{_(!1)}}};return(0,t.jsxs)("form",{onSubmit:P,className:"figure-scale-editor-controls w-full space-y-2 rounded-md border bg-background p-3 print:hidden",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[(0,t.jsx)("label",{htmlFor:f,className:"font-medium",children:d.exam.uniformFigureScale}),(0,t.jsx)(i.f,{id:f,type:"number",min:r._,max:r.a,step:1,value:N,disabled:S,"aria-describedby":`${f}-hint`,"aria-invalid":!C,onChange:e=>F(e.target.value),className:"h-8 w-20"}),(0,t.jsx)("span",{children:"%"}),(0,t.jsx)(a.f,{type:"button",variant:"outline",size:"sm",disabled:S||h&&C&&I===r.n,onClick:()=>F(String(r.n)),children:d.figure.resetScale}),(0,t.jsxs)("div",{role:"group","aria-label":d.exam.uniformFigureAlign,className:"inline-flex items-center gap-1",children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:d.exam.uniformFigureAlign}),r.j.map(e=>(0,t.jsx)(a.f,{type:"button",variant:z===e&&(null!==y||b)?"default":"outline",size:"sm",disabled:S,"aria-pressed":z===e&&(null!==y||b),onClick:()=>{var t;k(t=b&&e===w?null:e),$(j,t)},children:d.figure.aligns[e]},e))]}),(0,t.jsx)(a.f,{type:"submit",size:"sm",disabled:S||!R||!C,children:S?d.common.progress.saving:d.common.save}),q&&(0,t.jsx)(a.f,{type:"button",variant:"ghost",size:"sm",disabled:S,onClick:()=>{v(null),k(null),u?.({scale:null,align:null})},children:d.common.cancel})]}),(0,t.jsx)("input",{type:"range",min:r._,max:r.a,step:1,value:I,disabled:S,"aria-label":d.exam.uniformFigureScaleSlider,"aria-describedby":`${f}-hint`,onChange:e=>F(e.target.value),className:"block h-6 w-full max-w-sm accent-primary"}),(0,t.jsx)("p",{id:`${f}-hint`,className:"text-xs text-muted-foreground",children:d.exam.uniformFigureScaleHint})]})}],339023),e.s(["D",0,1e3,"s",0,function(e){return Number.isInteger(e)?String(e):e.toFixed(1)},"H",0,function(e){return null===e||"number"!=typeof e||!Number.isFinite(e)||e<.001||e>1e3||Math.abs(10*e-Math.round(10*e))>1e-6?null:Math.round(10*e)/10},"n",0,c],763896);var u=e.i(401280);let m=["一","二","三","四","五","六","七","八","九","十","十一","十二","十三","十四","十五","十六","十七","十八","十九","二十"],d=["I","II","III","IV","V","VI","VII","VIII","IX","X","XI","XII","XIII","XIV","XV","XVI","XVII","XVIII","XIX","XX"];e.s(["f",0,function(e,t){let n=new Map;for(let e of u.V)n.set(e,[]);for(let t of[...e].sort((e,t)=>e.order-t.order))n.get(function(e){let t=e.questionType??e.errorItemQuestionType??null;return u.V.includes(t??"")?t:"other"}(t)).push(t);let a=[],i=1,s=0;for(let e of u.V){let l=n.get(e);if(0===l.length)continue;let r=c(l.map(e=>e.score??null));a.push({type:"other"===e?null:e,title:function(e,t,n){let a="zh"===n?u.H[e]:u.u[e];return"zh"===n?`${m[t]}、${a}`:`Part ${d[t]}. ${a}`}(e,s,t),items:l.map(e=>({question:e,displayNumber:i++})),count:l.length,scoreTotal:r.total,unscored:r.unscored}),s+=1}return a}],336653)},84583,e=>{var t=e.i(843476),n=e.i(519455),a=e.i(111110),i=e.i(122330);e.s(["f",0,function({effectivePx:e,isCustom:s,onChange:l,onReset:r}){let{t:o}=(0,a.b)(),c=(0,i.O)(e);return(0,t.jsxs)("div",{className:"answer-space-controls print:hidden flex flex-wrap items-center gap-2 text-xs text-muted-foreground mt-2 pt-1",children:[(0,t.jsxs)("span",{children:[o.exam.questionAnswerSpace,": ",c,"px"]}),(0,t.jsx)(n.f,{type:"button",variant:"outline",size:"sm",className:"h-6 px-2 text-xs","aria-label":o.exam.decreaseAnswerSpace,disabled:c<=i.r,onClick:()=>l((0,i.O)(c-i.W)),children:"-"}),(0,t.jsx)("input",{type:"range",min:i.r,max:i.R,step:10,value:c,"aria-label":o.exam.questionAnswerSpaceSlider,onChange:e=>l((0,i.O)(Number(e.target.value))),className:"w-24 sm:w-32 accent-primary"}),(0,t.jsx)(n.f,{type:"button",variant:"outline",size:"sm",className:"h-6 px-2 text-xs","aria-label":o.exam.increaseAnswerSpace,disabled:c>=i.R,onClick:()=>l((0,i.O)(c+i.W)),children:"+"}),s&&(0,t.jsx)(n.f,{type:"button",variant:"ghost",size:"sm",className:"h-6 px-2 text-xs",onClick:r,children:o.exam.resetQuestionAnswerSpace})]})}])},149704,e=>{var t=e.i(843476),n=e.i(111110),a=e.i(398019),i=e.i(184110),s=e.i(975157);let l={left:"mr-auto",center:"mx-auto",right:"ml-auto"};e.s(["f",0,function({svg:e,scale:r,align:o,className:c}){let{t:u}=(0,n.b)();if(!e)return null;let m=(0,i.V)(r),d=(0,i.o)(o);return(0,t.jsx)("figure",{className:(0,s.f)("question-figure my-3",c),children:(0,t.jsx)("img",{src:(0,a.d)(e),alt:u.figure.alt,className:(0,s.f)(l[d],"block h-auto max-w-full rounded border bg-white p-2"),style:{..."left"===d?{marginLeft:0,marginRight:"auto"}:"right"===d?{marginLeft:"auto",marginRight:0}:{},maxHeight:360,zoom:m/100,maxWidth:`${Math.min(m,100)}%`}})})}])},590546,e=>{var t=e.i(843476),n=e.i(618566),a=e.i(519455),i=e.i(711241);e.s(["f",0,function({fallbackUrl:e,className:s}){let l=(0,n.useRouter)();return(0,t.jsx)(a.f,{variant:"ghost",size:"icon",onClick:()=>{l.push(e)},className:s,children:(0,t.jsx)(i.f,{className:"h-5 w-5"})})}])},257428,e=>{var t=e.i(843476),n=e.i(271645),a=e.i(820783),i=e.i(30030),s=e.i(981140),l=e.i(369340),r=e.i(635804),o=e.i(296626),c=e.i(248425),u=Object.defineProperty,m=(e,t)=>u(e,"name",{value:t,configurable:!0}),d="Checkbox",[f,x]=(0,i.f)(d),[h,p]=f(d);function g(e){let{__scopeCheckbox:a,checked:i,children:s,defaultChecked:r,disabled:o,form:c,name:u,onCheckedChange:m,required:f,value:x="on",internal_do_not_use_render:p}=e,[g,b]=(0,l.f)({prop:i,defaultProp:r??!1,onChange:m,caller:d}),[w,j]=n.useState(null),[v,S]=n.useState(null),[_,N]=n.useState(null),C=!w||!!c||!!w.closest("form"),I={checked:g,disabled:o,setChecked:b,control:w,setControl:j,name:u,form:c,value:x,userClick:_,onUserClick:N,required:f,defaultChecked:!k(r)&&r,isFormControl:C,bubbleInput:v,setBubbleInput:S};return(0,t.jsx)(h,{scope:a,...I,children:y(p)?p(I):s})}m(g,"CheckboxProvider");var b=n.forwardRef(m(function({__scopeCheckbox:e,onKeyDown:i,onClick:l,...r},o){let{control:u,value:d,disabled:f,checked:x,required:h,setControl:g,setChecked:b,onUserClick:w,isFormControl:j,bubbleInput:v}=p("CheckboxTrigger",e),y=(0,a.f)(o,g),_=n.useRef(x);return n.useEffect(()=>{let e=u?.form;if(e){let t=m(()=>b(_.current),"reset");return e.addEventListener("reset",t),()=>e.removeEventListener("reset",t)}},[u,b]),(0,t.jsx)(c.V.button,{type:"button",role:"checkbox","aria-checked":k(x)?"mixed":x,"aria-required":h,"data-state":S(x),"data-disabled":f?"":void 0,disabled:f,value:d,...r,ref:y,onKeyDown:(0,s.f)(i,e=>{"Enter"===e.key&&e.preventDefault()}),onClick:(0,s.f)(l,e=>{let t=e.isPropagationStopped();w({requestedChecked:!!k(x)||!x,hasConsumerStoppedPropagation:t}),b(e=>!!k(e)||!e),v&&j&&!t&&e.stopPropagation()})})},"CheckboxTrigger")),w=n.forwardRef(m(function(e,n){let{__scopeCheckbox:a,name:i,checked:s,defaultChecked:l,required:r,disabled:o,value:c,onCheckedChange:u,form:m,...d}=e;return(0,t.jsx)(g,{__scopeCheckbox:a,checked:s,defaultChecked:l,disabled:o,required:r,onCheckedChange:u,name:i,form:m,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(b,{...d,ref:n,__scopeCheckbox:a}),e&&(0,t.jsx)(v,{__scopeCheckbox:a})]})})},"Checkbox")),j=n.forwardRef(m(function(e,n){let{__scopeCheckbox:a,forceMount:i,...s}=e,l=p("CheckboxIndicator",a);return(0,t.jsx)(o.f,{present:i||k(l.checked)||!0===l.checked,children:(0,t.jsx)(c.V.span,{"data-state":S(l.checked),"data-disabled":l.disabled?"":void 0,...s,ref:n,style:{pointerEvents:"none",...e.style}})})},"CheckboxIndicator")),v=n.forwardRef(m(function({__scopeCheckbox:e,onClick:i,...l},o){let{control:u,userClick:m,checked:d,defaultChecked:f,required:x,disabled:h,name:g,value:b,form:w,bubbleInput:j,setBubbleInput:v}=p("CheckboxBubbleInput",e),y=(0,a.f)(o,v),S=(0,r.f)(u),_=n.useRef(!1),N=n.useRef(d),C=n.useRef(m),I=n.useRef(null);n.useEffect(()=>{if(!j)return;let e=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked").set;if(!e)return;let t=N.current!==d;N.current=d;let n=null!==m&&m!==C.current;if(C.current=m,n)I.current=t?null:m,t&&(j.indeterminate=k(d),e.call(j,!k(d)&&d)),j.dispatchEvent(new Event("click",{bubbles:!m.hasConsumerStoppedPropagation}));else if(t){let t=I.current;I.current=null;let n=t?.requestedChecked===d;_.current=!0,j.indeterminate=k(d),e.call(j,!k(d)&&d),j.dispatchEvent(new Event("click",{bubbles:!(n&&t.hasConsumerStoppedPropagation)})),_.current=!1}},[j,d,m]);let z=n.useRef(!k(d)&&d);return(0,t.jsx)(c.V.input,{type:"checkbox","aria-hidden":!0,defaultChecked:f??z.current,required:x,disabled:h,name:g,value:b,form:w,...l,tabIndex:-1,ref:y,onClick:(0,s.f)(i,e=>{_.current&&e.stopPropagation()}),style:{...l.style,...S,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"CheckboxBubbleInput"));function y(e){return"function"==typeof e}function k(e){return"indeterminate"===e}function S(e){return k(e)?"indeterminate":e?"checked":"unchecked"}m(y,"isFunction"),m(k,"isIndeterminate"),m(S,"getState");var _=e.i(689664),N=e.i(975157);let C=n.forwardRef(({className:e,...n},a)=>(0,t.jsx)(w,{ref:a,className:(0,N.f)("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...n,children:(0,t.jsx)(j,{className:(0,N.f)("flex items-center justify-center text-current"),children:(0,t.jsx)(_.f,{className:"h-4 w-4"})})}));C.displayName=w.displayName,e.s(["f",0,C],257428)},122330,e=>{let t=["auto","none","small","medium","large"],n={none:0,small:60,medium:120,large:240},a={choice:12,judgment:12,fill:16,solution:240};function i(e){return Number.isFinite(e)?Math.min(600,Math.max(0,Math.round(e))):0}let s=/(?:(?:^|[\s*+\-))::。??;;,,_])([A-D])\s*[..::]|(?:^|\s{2,}|[))::。??])([A-D])\s*、|[((]([A-D])[))])/gm,l=/判断(?:下列|以下|正误|对错|题)|对的(?:打|画)|错的(?:打|画)|true\s*(?:or|\/)\s*false/i,r=/_{2,}|(?:\\_){2,}|\\underline|\\rule\b|\\hspace\b|(\s*)|【\s*】|\[\s+\]|(?<![A-Za-z0-9_])\(\s*\)|[==]\s*[。??]?\s*$|填空/,o=/求证|证明[::,,]|写出(?:解题|计算|推导|推理)?过程|解答下列|试说明理由|请说明理由/,c=/(\s*(\d{1,2})\s*)/g,u=/(?:^|[\n。;;::??!!]\s*)\(\s*(\d{1,2})\s*\)/g;function m(e){let t=new Set;for(let n of e.matchAll(c))t.add(n[1]);for(let n of e.matchAll(u))t.add(n[1]);return Math.max(1,t.size)}e.s(["p",0,"exam-print-answer-space","W",0,20,"q",0,"auto","R",0,600,"r",0,0,"O",0,i,"I",0,function(e){return"string"==typeof e&&t.includes(e)},"T",0,function(e){return"number"!=typeof e||!Number.isInteger(e)||e<0||e>600?null:e},"z",0,function(e,t,c){let u;if("number"==typeof c&&Number.isFinite(c))return i(c);if("auto"!==e)return n[e];let d=(u=new Set(Array.from(t.matchAll(s),e=>e[1]??e[2]??e[3]))).has("A")&&u.has("B")&&u.has("C")?"choice":l.test(t)?"judgment":m(t)>1||o.test(t)?"solution":r.test(t)?"fill":"solution";if("solution"!==d)return a[d];let f=(m(t)-1)*120;return Math.min(560,a.solution+f)}])},184110,e=>{let t=["left","center","right"],n="center";function a(e){return"number"==typeof e&&Number.isInteger(e)&&e>=10&&e<=200}e.s(["E",0,n,"n",0,100,"j",0,t,"a",0,200,"_",0,10,"x",0,a,"o",0,function(e){return"string"==typeof e&&t.includes(e)?e:n},"V",0,function(e){return a(e)?e:100}])},398019,e=>{e.s(["K",0,1e5,"d",0,function(e){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`}])},442861,e=>{var t=e.i(271645),n=e.i(122330),a=e.i(201276);e.s(["f",0,function(e,i){let[s,l]=(0,t.useState)({}),[r,o]=(0,t.useState)(!1),c=(0,t.useRef)(new Map),u=(0,t.useRef)(null),m=(0,t.useRef)(i);(0,t.useEffect)(()=>{m.current=i},[i]);let d=(0,t.useMemo)(()=>{let t={};for(let a of e){let e=a.id in s?s[a.id]:(0,n.T)(a.answerSpacePx);"number"==typeof e&&(t[a.id]=e)}return t},[e,s]),f=(0,t.useCallback)(()=>{if(u.current&&(clearTimeout(u.current),u.current=null),0===c.current.size)return;let e=Array.from(c.current,([e,t])=>({id:e,answerSpacePx:t}));c.current.clear(),m.current(e).then(()=>o(!1)).catch(e=>{o(!0),a.V.error("[AnswerSpace]","Failed to save answer space",{error:e})})},[]);(0,t.useEffect)(()=>f,[f]);let x=(0,t.useCallback)((e,t)=>{if(0!==e.length){for(let{id:t,answerSpacePx:n}of(l(t=>{let n={...t};for(let{id:t,answerSpacePx:a}of e)n[t]=a;return n}),e))c.current.set(t,n);if(t)return void f();u.current&&clearTimeout(u.current),u.current=setTimeout(f,600)}},[f]),h=(0,t.useCallback)((e,t)=>{x([{id:e,answerSpacePx:t}],null===t)},[x]),p=(0,t.useCallback)(()=>{x(Object.keys(d).map(e=>({id:e,answerSpacePx:null})),!0)},[d,x]);return{customSpaces:d,setSpace:h,resetAll:p,saveFailed:r}}])},35209,e=>{var t=e.i(271645),n=e.i(111110);e.s(["f",0,function(...e){let{t:a}=(0,n.b)(),i=[a.pageTitle.base,...e.map(e=>"string"==typeof e?e.trim():"").filter(e=>e.length>0)].join("-");(0,t.useEffect)(()=>{document.title=i},[i])}])},401280,e=>{let t={single_choice:"single_choice",singlechoice:"single_choice","single choice":"single_choice","single-choice":"single_choice",multiple_choice:"multiple_choice",multiplechoice:"multiple_choice","multiple choice":"multiple_choice","multiple-choice":"multiple_choice",multichoice:"multiple_choice","multi choice":"multiple_choice",true_false:"true_false",truefalse:"true_false","true/false":"true_false","true false":"true_false","true-false":"true_false","true / false":"true_false",fill_blank:"fill_blank",fillblank:"fill_blank","fill in the blank":"fill_blank","fill-in-the-blank":"fill_blank",fillintheblank:"fill_blank",calculation:"calculation",solution:"solution",reading:"reading",cloze:"cloze",writing:"writing",other:"other",选择题:"single_choice",单项选择:"single_choice",单选:"single_choice",单选题:"single_choice",不定项:"multiple_choice",不定项选择:"multiple_choice",多项选择:"multiple_choice",多选:"multiple_choice",多选题:"multiple_choice",判断:"true_false",判断题:"true_false",是非:"true_false",是非题:"true_false",填空:"fill_blank",填空题:"fill_blank",口算:"calculation",计算:"calculation",计算题:"calculation",解答:"solution",解答题:"solution",应用:"solution",应用题:"solution",证明:"solution",证明题:"solution",简答:"solution",简答题:"solution",阅读:"reading",阅读理解:"reading",完形:"cloze",完形填空:"cloze",作文:"writing",写作:"writing",书面表达:"writing",其他:"other"};e.s(["O",0,"__none__","V",0,["single_choice","multiple_choice","true_false","fill_blank","calculation","solution","reading","cloze","writing","other"],"u",0,{single_choice:"Single Choice",multiple_choice:"Multiple Choice",true_false:"True / False",fill_blank:"Fill in the Blank",calculation:"Calculation",solution:"Solution",reading:"Reading Comprehension",cloze:"Cloze",writing:"Writing",other:"Other"},"H",0,{single_choice:"单选题",multiple_choice:"多选题",true_false:"判断题",fill_blank:"填空题",calculation:"计算题",solution:"解答题",reading:"阅读理解",cloze:"完形填空",writing:"写作",other:"其他"},"P",0,function(e){if("string"!=typeof e)return null;let n=e.trim().toLowerCase();return n?t[n]??null:null}])}])})();
|
package/package.json
CHANGED
package/prisma/seed.db
CHANGED
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(()=>{"use strict";(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,711241,e=>{var t=e.i(456420);let a={name:"arrow-left",size:24,node:[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],711241)},576248,e=>{var t=e.i(456420);let a={name:"circle-question-mark",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],aliases:["help-circle","circle-help"]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],576248)},77043,e=>{var t=e.i(456420);let a={name:"printer",size:24,node:[["path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2",key:"143wyd"}],["path",{d:"M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6",key:"1itne7"}],["rect",{x:"6",y:"14",width:"12",height:"8",rx:"1",key:"1ue0tg"}]]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],77043)},856522,e=>{var t=e.i(456420);let a={name:"save",size:24,node:[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],856522)},328623,e=>{var t=e.i(456420);let a={name:"sparkles",size:24,node:[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],aliases:["stars"]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],328623)},591124,e=>{var t=e.i(843476),a=e.i(271645),r=e.i(522016),s=e.i(618566),l=e.i(215519),i=e.i(306831),n=e.i(456420);let o={name:"clipboard-check",size:24,node:[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m9 14 2 2 4-4",key:"df797q"}]]};o.node;let c=(0,n.f)(o);var d=e.i(632781),u=e.i(77043),m=e.i(395925),x=e.i(856522),f=e.i(759659),h=e.i(487486),g=e.i(519455),p=e.i(793479),b=e.i(590546),y=e.i(86963),v=e.i(339023),j=e.i(663661),k=e.i(257428),N=e.i(716327),w=e.i(456539),S=e.i(263676),C=e.i(515288),_=e.i(511445),I=e.i(991686),q=e.i(393733),R=e.i(149704),$=e.i(520732),z=e.i(741120),T=e.i(931454),M=e.i(111110),F=e.i(41931),A=e.i(201276),E=e.i(294114);function V({paperId:e,paperMode:r,question:s,onDone:l}){let{t:i,language:n}=(0,M.b)(),[o,c]=(0,a.useState)(null),u="original"!==r&&0===s.attempts.length&&!!s.errorItemId&&"pending"!==s.status,m="ready"===s.status&&!!s.questionText?.trim();if(!u&&!m)return null;let x=async t=>{let a="question"===t?i.exam.regenerateQuestionConfirm:i.exam.regenerateAnswerConfirm;if(await (0,E.u)(a)){c(t);try{let a=await F.k.post(`/api/exams/${e}/questions/${s.id}/regenerate`,{mode:t,language:n},{timeout:6e5,recoverable:!0});l(a)}catch(r){let e=r?.data?.message||"",a=i.errors[e];A.V.error("[ExamRegenerate]","Failed to regenerate exam question",{mode:t,code:e}),E.c.error("HAS_RESULTS"===e?i.exam.regenerateHasResults:"string"==typeof a?a:i.exam.regenerateFailed)}finally{c(null)}}};return(0,t.jsxs)("div",{className:"flex flex-wrap gap-1",children:[u&&(0,t.jsxs)(g.f,{variant:"ghost",size:"sm",onClick:()=>x("question"),disabled:null!==o,children:["question"===o?(0,t.jsx)(d.f,{className:"mr-1 h-4 w-4 animate-spin"}):(0,t.jsx)(z.f,{className:"mr-1 h-4 w-4"}),"question"===o?i.exam.regenerating:i.exam.regenerateQuestion]}),m&&(0,t.jsxs)(g.f,{variant:"ghost",size:"sm",onClick:()=>x("answer"),disabled:null!==o,children:["answer"===o?(0,t.jsx)(d.f,{className:"mr-1 h-4 w-4 animate-spin"}):(0,t.jsx)(T.f,{className:"mr-1 h-4 w-4"}),"answer"===o?i.exam.regenerating:i.exam.regenerateAnswer]})]})}var D=e.i(763896);function H({questionId:e,score:r,disabled:s,onSave:l}){let{t:i}=(0,M.b)(),[n,o]=(0,a.useState)(null),[c,d]=(0,a.useState)(!1),u=n??(null!==r?String(r):""),m=u.trim(),x=""===m?null:(0,D.H)(Number(m)),f=""===m||null!==x,h=x!==r,g=async()=>{if(!f||!h||c){if(null!==n&&!f)return;o(null);return}d(!0);try{await l(e,x),o(null)}catch(e){A.V.error("[ExamQuestionScore]","保存单题分值失败",{error:e}),E.c.error(i.exam.saveQuestionScoreFailed)}finally{d(!1)}};return(0,t.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,t.jsx)("label",{className:"text-xs text-muted-foreground",htmlFor:`exam-score-${e}`,children:i.exam.questionScore}),(0,t.jsx)(p.f,{id:`exam-score-${e}`,type:"number",min:D.W,max:D.D,step:.5,value:u,disabled:c||s,"aria-invalid":!f,placeholder:i.exam.questionScorePlaceholder,title:i.exam.questionScoreHint,onChange:e=>o(e.target.value),onBlur:()=>void g(),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),g())},className:"h-7 w-20 text-sm"})]})}function P({paperId:e,paperMode:s,question:n,displayNumber:o,editingResult:c,onResultChange:u,onDeleteAttempt:m,onRegenerated:x,previewFigureScale:f,previewFigureAlign:g,onSaveFigureScale:p,onSaveScore:b}){let{t:y}=(0,M.b)(),{timeZone:v}=(0,l.M)(),[j,k]=(0,a.useState)(!1),z=void 0!==c,T=(()=>{if(!n.error)return"";if("SOURCE_DELETED"===n.error)return y.exam.sourceDeleted;let e=n.error.split(":")[0].trim(),t=y.errors[e];return"string"==typeof t?t:n.error})();return(0,t.jsx)(C.N,{children:(0,t.jsxs)(C.O,{className:"space-y-3 pt-4",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[(0,t.jsxs)("span",{className:"font-semibold",children:[o??n.order,"."]}),n.errorItemId?(0,t.jsxs)(r.default,{href:`/error-items/${n.errorItemId}`,className:"font-mono text-xs text-primary hover:underline",children:[y.exam.source," ",n.sourceShortId]}):(0,t.jsxs)("span",{className:"font-mono text-xs text-muted-foreground",children:[n.sourceShortId," · ",y.exam.sourceDeleted]}),n.notebookName&&(0,t.jsx)(h.f,{variant:"secondary",children:n.notebookName}),b&&(0,t.jsx)("span",{className:"ml-auto",children:(0,t.jsx)(H,{questionId:n.id,score:n.score??null,disabled:z,onSave:b})})]}),n.attempts.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:n.attempts.map((e,a)=>(0,t.jsxs)(h.f,{variant:"outline",className:`gap-1 font-normal ${I.x[e.result]||""}`,children:[(0,t.jsx)("span",{children:y.exam.attemptLabel.replace("{n}",String(a+1))}),(0,t.jsx)("span",{className:"tabular-nums",children:(0,i.r)(e.createdAt,"MM-dd",v)}),(0,t.jsx)("span",{className:"font-semibold",children:y.mastery.results[e.result]}),z&&m&&(0,t.jsx)("button",{type:"button","aria-label":y.mastery.deleteRecord,className:"-mr-1 rounded hover:bg-black/10",onClick:()=>m(e.id),children:(0,t.jsx)(S.X,{className:"h-3 w-3"})})]},e.id))}),"pending"===n.status&&(0,t.jsxs)("p",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,t.jsx)(d.f,{className:"h-4 w-4 animate-spin"}),y.exam.questionPending]}),"failed"===n.status&&(0,t.jsxs)("p",{className:"text-sm text-destructive",children:[y.exam.questionFailed,T?`${y.common.colon}${T}`:""]}),"ready"===n.status&&n.questionText&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(_.f,{content:n.questionText}),p?(0,t.jsx)($.f,{svg:n.figureSvg,scale:n.figureScale,align:n.figureAlign,previewScaleOverride:f,previewAlignOverride:g,onSave:(e,t)=>p(n.id,e,t)},`${n.id}-${n.figureScale??100}-${n.figureAlign??"center"}`):(0,t.jsx)(R.f,{svg:n.figureSvg,scale:f??n.figureScale,align:g??n.figureAlign}),(0,t.jsxs)("button",{type:"button",className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground",onClick:()=>k(!j),children:[j?(0,t.jsx)(w.f,{className:"h-3 w-3"}):(0,t.jsx)(N.f,{className:"h-3 w-3"}),y.exam.showAnswer]}),j&&(0,t.jsxs)("div",{className:"space-y-2 rounded-md bg-muted/40 p-3",children:[n.answerText&&(0,t.jsx)(_.f,{content:n.answerText,className:"font-semibold"}),n.analysis&&(0,t.jsx)(_.f,{content:n.analysis})]})]}),!z&&x&&(0,t.jsx)(V,{paperId:e,paperMode:s,question:n,onDone:x}),z&&"ready"===n.status&&n.errorItemId&&u&&(0,t.jsx)(q.f,{value:c,onChange:u,size:"sm"})]})})}function X({scores:e,disabled:r,onSave:s}){let{t:l}=(0,M.b)(),i=e.filter(e=>"number"==typeof e),n=i.length===e.length&&new Set(i).size<=1,o=n?i[0]??null:null,[c,d]=(0,a.useState)(null),[u,m]=(0,a.useState)(!1);if(0===e.length)return null;let x=c??(null!==o?String(o):""),f=""===x.trim()?null:(0,D.H)(Number(x)),h=""===x.trim()||null!==f,b=null!==c&&(f??null)!==o,y=async e=>{if(e.preventDefault(),h&&b&&!u){m(!0);try{await s(f),d(null),E.c.success(l.common.messages.saveSuccess)}catch(e){A.V.error("[ExamScoreBar]","统一保存试卷分值失败",{error:e}),E.c.error(l.exam.saveQuestionScoreFailed)}finally{m(!1)}}};return(0,t.jsxs)("form",{onSubmit:y,className:"flex flex-wrap items-center gap-2 rounded-md border bg-background p-3 text-sm",children:[(0,t.jsx)("span",{className:"font-medium",children:l.exam.uniformScore}),(0,t.jsx)(p.f,{type:"number",min:D.W,max:D.D,step:.5,value:x,disabled:u||r,"aria-invalid":!h,"aria-label":l.exam.uniformScore,placeholder:l.exam.questionScorePlaceholder,onChange:e=>d(e.target.value),className:"h-8 w-24"}),(0,t.jsx)(g.f,{type:"submit",size:"sm",disabled:u||r||!b||!h,children:u?l.common.progress.saving:l.common.save}),null!==o&&!n&&(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:l.exam.totalScoreUnscored.replace("{count}",String(e.length-i.length))}),(0,t.jsx)("p",{className:"w-full text-xs text-muted-foreground",children:l.exam.uniformScoreHint}),!h&&(0,t.jsx)("p",{className:"w-full text-xs text-destructive",children:l.exam.questionScoreInvalid})]})}var U=e.i(336653);function B({section:e}){let{t:a}=(0,M.b)(),r=null!==e.scoreTotal?a.exam.sectionSummaryScored.replace("{count}",String(e.count)).replace("{total}",String(e.scoreTotal)):a.exam.sectionSummary.replace("{count}",String(e.count));return(0,t.jsxs)("div",{className:"flex flex-wrap items-baseline gap-x-3 gap-y-1 border-b pb-2 pt-4",children:[(0,t.jsx)("h2",{className:"text-base font-bold",children:e.title}),(0,t.jsxs)("span",{className:"text-sm text-muted-foreground",children:[r,null!==e.scoreTotal&&e.unscored>0&&(0,t.jsxs)("span",{children:["(",a.exam.sectionSummaryUnscored.replace("{count}",String(e.unscored)),")"]})]})]})}function O({paperId:e,paperMode:a,sections:r,draft:s,onResultChange:l,onDeleteAttempt:i,onRegenerated:n,uniformPreview:o,onSaveFigureScale:c,onSaveScore:d}){let u=r=>(0,t.jsx)(P,{paperId:e,paperMode:a,question:r.question,displayNumber:r.displayNumber,editingResult:s?s[r.question.id]??null:void 0,onResultChange:e=>l(r.question.id,e),onDeleteAttempt:i,onRegenerated:n,previewFigureScale:o.scale,previewFigureAlign:o.align,onSaveFigureScale:c,onSaveScore:d},r.question.id);return(0,t.jsx)("div",{className:"space-y-3",children:r.map(e=>(0,t.jsxs)("section",{className:"space-y-3",children:[(0,t.jsx)(B,{section:e}),e.items.map(u)]},e.title))})}function L({paperId:e,paperMode:a,groupByType:r,questions:s,draft:l,onResultChange:i,onDeleteAttempt:n,onRegenerated:o,uniformPreview:c,onSaveFigureScale:d,onSaveScore:u,onSaveUniformScore:m,onSaveGroupByType:x}){let{t:f,language:h}=(0,M.b)(),g=r?(0,U.f)(s,h):null;return(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-x-6 gap-y-2",children:[(0,t.jsx)(X,{scores:s.map(e=>e.score??null),disabled:!!l,onSave:m}),(0,t.jsxs)("label",{className:"flex items-center gap-2 text-sm",title:f.exam.groupByTypeHint,children:[(0,t.jsx)(k.f,{checked:r,disabled:!!l,onCheckedChange:e=>void x(!0===e)}),f.exam.groupByType]})]}),g?(0,t.jsx)(O,{paperId:e,paperMode:a,sections:g,draft:l,onResultChange:i,onDeleteAttempt:n,onRegenerated:o,uniformPreview:c,onSaveFigureScale:d,onSaveScore:u}):s.map(r=>(0,t.jsx)(P,{paperId:e,paperMode:a,question:r,editingResult:l?l[r.id]??null:void 0,onResultChange:e=>i(r.id,e),onDeleteAttempt:n,onRegenerated:o,previewFigureScale:c.scale,previewFigureAlign:c.align,onSaveFigureScale:d,onSaveScore:u},r.id))]})}var K=e.i(35209);e.s(["default",0,function(){let{timeZone:e}=(0,l.M)(),n=(0,s.useParams)(),o=(0,s.useRouter)(),{t:k,language:N}=(0,M.b)(),w=n.id,[S,C]=(0,a.useState)(null);(0,K.f)(k.exam.title,S?.title);let[_,I]=(0,a.useState)(!1),[q,R]=(0,a.useState)(null),[$,z]=(0,a.useState)((0,i.r)(new Date,"yyyy-MM-dd",e)),[T,A]=(0,a.useState)(!1),[V,H]=(0,a.useState)(null),[P,X]=(0,a.useState)({scale:null,align:null}),U=(0,a.useCallback)(async()=>{try{C(await F.k.get(`/api/exams/${w}`))}catch{I(!0)}},[w]);if((0,a.useEffect)(()=>{U()},[U]),(0,a.useEffect)(()=>{if(S?.status!=="generating")return;let e=setTimeout(U,3e3);return()=>clearTimeout(e)},[S,U]),_)return(0,t.jsx)("div",{className:"p-8 text-center",children:k.exam.notFound});if(!S)return(0,t.jsx)(y.f,{label:k.common.loading});let B=S.questions.filter(e=>"ready"===e.status).length,O=S.questions.some(e=>e.attempts.length>0),Q=S.questions.some(e=>"failed"===e.status),W=S.questions.filter(e=>"ready"===e.status&&e.errorItemId),G=S.questions.filter(e=>"ready"===e.status&&!!e.figureSvg),Y=q?W.filter(e=>q[e.id]).length:0,J=async()=>{if(q&&0!==Y){A(!0),H(null);try{await F.k.post(`/api/exams/${S.id}/results`,{takenAt:(0,i.$)($,e),results:W.filter(e=>q[e.id]).map(e=>({questionId:e.id,result:q[e.id]}))}),R(null),H(k.exam.resultsSaved),await U()}catch{H(k.exam.resultsSaveFailed)}finally{A(!1)}}},Z=async e=>{if(await (0,E.u)(k.mastery.deleteRecordConfirm,{destructive:!0}))try{await F.k.delete(`/api/practice/record/${e}`),await U()}catch{H(k.mastery.deleteRecordFailed)}},ee=async()=>{await F.k.post(`/api/exams/${S.id}/retry`,{language:N}),await U()},et=async()=>{await (0,E.u)(k.exam.deleteConfirm,{destructive:!0})&&(await F.k.delete(`/api/exams/${S.id}`),o.push("/exams"))},ea=async(e,t,a)=>{await F.k.patch(`/api/exams/${S.id}`,{questionId:e,figureScale:t,figureAlign:a}),C(r=>r?{...r,questions:r.questions.map(r=>r.id===e?{...r,figureScale:t,figureAlign:a}:r)}:r)},er=async e=>{await F.k.patch(`/api/exams/${S.id}`,e),C(t=>t?{...t,questions:t.questions.map(t=>({...t,...e}))}:t)},es=async(e,t)=>{await F.k.patch(`/api/exams/${S.id}`,{questionId:e,score:t}),C(a=>a?{...a,questions:a.questions.map(a=>a.id===e?{...a,score:t}:a)}:a)},el=async e=>{await F.k.patch(`/api/exams/${S.id}`,{score:e}),C(t=>t?{...t,questions:t.questions.map(t=>({...t,score:e}))}:t)},ei=async e=>{await F.k.patch(`/api/exams/${S.id}`,{groupByType:e}),C(t=>t?{...t,groupByType:e}:t)},en=(0,D.n)(S.questions.filter(e=>"ready"===e.status).map(e=>e.score??null));return(0,t.jsx)("main",{className:"mx-auto min-h-screen max-w-6xl px-4 py-6 md:px-8 md:py-8",children:(0,t.jsxs)("div",{className:"space-y-6 pb-24",children:[(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsx)(b.f,{fallbackUrl:"/exams",className:"-ml-2 shrink-0"}),(0,t.jsxs)("div",{className:"flex-1 min-w-0 space-y-2",children:[(0,t.jsx)("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight break-words",children:S.title}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-sm text-muted-foreground",children:[(0,t.jsx)(j.f,{status:S.status,recorded:O}),"original"===S.mode&&(0,t.jsx)(h.f,{variant:"secondary",children:k.exam.modes.original}),(0,t.jsx)("span",{children:k.exam.progress.replace("{ready}",String(B)).replace("{total}",String(S.questions.length))}),null!==en.total&&(0,t.jsxs)("span",{children:[k.exam.totalScore.replace("{total}",(0,D.s)(en.total)),en.unscored>0&&(0,t.jsxs)("span",{className:"text-xs",children:["(",k.exam.totalScoreUnscored.replace("{count}",String(en.unscored)),")"]})]}),(0,t.jsx)("span",{children:(0,i.r)(S.createdAt,"yyyy-MM-dd HH:mm",e)})]})]})]}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsx)(r.default,{href:`/exams/${S.id}/print`,children:(0,t.jsxs)(g.f,{variant:"outline",size:"sm",disabled:0===B,children:[(0,t.jsx)(u.f,{className:"mr-2 h-4 w-4"}),k.exam.print]})}),!q&&W.length>0&&(0,t.jsxs)(g.f,{size:"sm",onClick:()=>{H(null),R({}),z((0,i.r)(new Date,"yyyy-MM-dd",e))},children:[(0,t.jsx)(c,{className:"mr-2 h-4 w-4"}),k.exam.recordResults]}),Q&&"generating"!==S.status&&(0,t.jsxs)(g.f,{variant:"outline",size:"sm",onClick:ee,children:[(0,t.jsx)(m.f,{className:"mr-2 h-4 w-4"}),k.exam.retryFailed]}),(0,t.jsxs)(g.f,{variant:"ghost",size:"sm",onClick:et,className:"text-red-600 dark:text-red-400 hover:text-red-700 dark:hover:text-red-300 hover:bg-red-50 dark:hover:bg-red-950/40 sm:ml-auto",children:[(0,t.jsx)(f.f,{className:"mr-2 h-4 w-4"}),k.exam.delete]})]}),S.questions.length<S.requestedCount&&(0,t.jsx)("p",{className:"rounded-md border border-amber-200 dark:border-amber-900 bg-amber-50 dark:bg-amber-950/40 p-3 text-sm text-amber-800 dark:text-amber-200",children:k.exam.fewerThanRequested.replaceAll("{actual}",String(S.questions.length))}),V&&(0,t.jsx)("p",{className:"rounded-md border p-3 text-sm",children:V}),q&&(0,t.jsxs)("div",{className:"space-y-2 rounded-md border bg-muted/30 p-3",children:[(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2",children:[(0,t.jsx)("label",{htmlFor:"exam-taken-at",className:"text-sm font-medium",children:k.exam.takenAt}),(0,t.jsx)(p.f,{id:"exam-taken-at",type:"date",value:$,onChange:e=>z(e.target.value),className:"sm:w-48"})]}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:k.exam.recordHint})]}),G.length>0&&(0,t.jsx)(v.f,{scales:G.map(e=>e.figureScale),aligns:G.map(e=>e.figureAlign),onPreviewChange:X,onSave:er}),(0,t.jsx)(L,{paperId:S.id,paperMode:S.mode,groupByType:S.groupByType,questions:S.questions,draft:q,onResultChange:(e,t)=>R(a=>a?{...a,[e]:t}:a),onDeleteAttempt:Z,onRegenerated:U,uniformPreview:P,onSaveFigureScale:ea,onSaveScore:es,onSaveUniformScore:el,onSaveGroupByType:ei}),q&&(0,t.jsx)("div",{className:"fixed inset-x-0 bottom-16 z-30 border-t bg-background/95 p-3 backdrop-blur md:bottom-0",children:(0,t.jsxs)("div",{className:"max-w-4xl mx-auto flex items-center justify-end gap-2",children:[0===Y&&(0,t.jsx)("span",{className:"mr-auto text-xs text-muted-foreground",children:k.exam.noResultSelected}),(0,t.jsx)(g.f,{variant:"outline",onClick:()=>R(null),disabled:T,children:k.exam.cancel}),(0,t.jsxs)(g.f,{onClick:J,disabled:T||!$||0===Y,children:[T?(0,t.jsx)(d.f,{className:"mr-2 h-4 w-4 animate-spin"}):(0,t.jsx)(x.f,{className:"mr-2 h-4 w-4"}),k.exam.saveResults]})]})})]})})}],591124)},520732,e=>{var t=e.i(843476),a=e.i(271645),r=e.i(149704),s=e.i(519455),l=e.i(793479),i=e.i(111110),n=e.i(294114),o=e.i(184110),c=e.i(201276);e.s(["f",0,function({svg:e,scale:d,align:u,previewScaleOverride:m,previewAlignOverride:x,onSave:f}){let{t:h}=(0,i.b)(),g=(0,a.useId)(),p=(0,o.V)(d),b=(0,o.o)(u),[y,v]=(0,a.useState)(null),[j,k]=(0,a.useState)(null),[N,w]=(0,a.useState)(!1),S=y??String(p),C=""!==S.trim()&&(0,o.x)(Number(S)),_=C?Number(S):p,I=j??b,q=m??_,R=x??I,$=null!==y&&(!C||Number(S)!==p)||null!==j&&j!==b;if(!e)return null;let z=async e=>{if(e.preventDefault(),C&&$&&!N){w(!0);try{await f(_,I),v(null),k(null),n.c.success(h.common.messages.saveSuccess)}catch(e){c.V.error("[FigureScale]","保存配图比例失败",{error:e}),n.c.error(h.common.messages.saveFailed)}finally{w(!1)}}};return(0,t.jsxs)("div",{children:[(0,t.jsx)(r.f,{svg:e,scale:q,align:R}),(0,t.jsxs)("form",{onSubmit:z,className:"figure-scale-editor-controls space-y-2 rounded-md border p-3 print:hidden",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[(0,t.jsx)("label",{htmlFor:g,children:h.figure.scale}),(0,t.jsx)(l.f,{id:g,type:"number",min:o._,max:o.a,step:1,value:S,disabled:N,"aria-describedby":`${g}-hint`,"aria-invalid":!C,onChange:e=>v(e.target.value),className:"h-8 w-20"}),(0,t.jsx)("span",{children:"%"}),(0,t.jsx)(s.f,{type:"button",variant:"outline",size:"sm",disabled:N||C&&_===o.n,onClick:()=>v(String(o.n)),children:h.figure.resetScale}),(0,t.jsxs)("div",{role:"group","aria-label":h.figure.align,className:"inline-flex items-center gap-1",children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:h.figure.align}),o.j.map(e=>(0,t.jsx)(s.f,{type:"button",variant:I===e?"default":"outline",size:"sm",disabled:N,"aria-pressed":I===e,onClick:()=>k(e===b?null:e),children:h.figure.aligns[e]},e))]}),(0,t.jsx)(s.f,{type:"submit",size:"sm",disabled:N||!$||!C,children:N?h.common.progress.saving:h.common.save}),$&&(0,t.jsx)(s.f,{type:"button",variant:"ghost",size:"sm",disabled:N,onClick:()=>{v(null),k(null)},children:h.common.cancel})]}),(0,t.jsx)("input",{type:"range",min:o._,max:o.a,step:1,value:_,disabled:N,"aria-label":h.figure.scaleSlider,"aria-describedby":`${g}-hint`,onChange:e=>v(e.target.value),className:"block h-6 w-full max-w-sm accent-primary"}),(0,t.jsx)("p",{id:`${g}-hint`,className:"text-xs text-muted-foreground",children:h.figure.scaleHint})]})]})}])},339023,763896,336653,e=>{var t=e.i(843476),a=e.i(271645),r=e.i(519455),s=e.i(793479),l=e.i(111110),i=e.i(294114),n=e.i(184110),o=e.i(201276);function c(e){let t=0,a=0;for(let r of e)"number"==typeof r&&Number.isFinite(r)&&(t+=1,a+=r);return{scored:t,unscored:e.length-t,total:t>0?Math.round(10*a)/10:null}}e.s(["f",0,function({scales:e,aligns:c,onPreviewChange:d,onSave:u}){let{t:m}=(0,l.b)(),x=(0,a.useId)(),f=e.map(n.V),h=new Set(f).size<=1,g=f[0]??n.n,p=(c??e.map(()=>n.E)).map(n.o),b=new Set(p).size<=1,y=p[0]??n.E,[v,j]=(0,a.useState)(null),[k,N]=(0,a.useState)(null),[w,S]=(0,a.useState)(!1);if(0===e.length)return null;let C=v??String(g),_=""!==C.trim()&&(0,n.x)(Number(C)),I=_?Number(C):g,q=k??y,R=null!==v||null!==k,$=null!==v?!_||!h||Number(C)!==g:!R&&!h,z=null!==k?!b||k!==y:!R&&!b,T=$||z,M=(e,t)=>{let a=null!==e&&""!==e.trim()&&(0,n.x)(Number(e))?Number(e):null;d?.({scale:a,align:t})},F=e=>{j(e),M(e,k)},A=async e=>{if(e.preventDefault(),_&&T&&!w){S(!0);try{let e={};null===v&&(R||h)||(e.figureScale=I),null===k&&(R||b)||(e.figureAlign=q),await u(e),j(null),N(null),d?.({scale:null,align:null}),i.c.success(m.common.messages.saveSuccess)}catch(e){o.V.error("[ExamFigureScale]","统一保存试卷配图设置失败",{error:e}),i.c.error(m.common.messages.saveFailed)}finally{S(!1)}}};return(0,t.jsxs)("form",{onSubmit:A,className:"figure-scale-editor-controls w-full space-y-2 rounded-md border bg-background p-3 print:hidden",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[(0,t.jsx)("label",{htmlFor:x,className:"font-medium",children:m.exam.uniformFigureScale}),(0,t.jsx)(s.f,{id:x,type:"number",min:n._,max:n.a,step:1,value:C,disabled:w,"aria-describedby":`${x}-hint`,"aria-invalid":!_,onChange:e=>F(e.target.value),className:"h-8 w-20"}),(0,t.jsx)("span",{children:"%"}),(0,t.jsx)(r.f,{type:"button",variant:"outline",size:"sm",disabled:w||h&&_&&I===n.n,onClick:()=>F(String(n.n)),children:m.figure.resetScale}),(0,t.jsxs)("div",{role:"group","aria-label":m.exam.uniformFigureAlign,className:"inline-flex items-center gap-1",children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:m.exam.uniformFigureAlign}),n.j.map(e=>(0,t.jsx)(r.f,{type:"button",variant:q===e&&(null!==k||b)?"default":"outline",size:"sm",disabled:w,"aria-pressed":q===e&&(null!==k||b),onClick:()=>{var t;N(t=b&&e===y?null:e),M(v,t)},children:m.figure.aligns[e]},e))]}),(0,t.jsx)(r.f,{type:"submit",size:"sm",disabled:w||!T||!_,children:w?m.common.progress.saving:m.common.save}),R&&(0,t.jsx)(r.f,{type:"button",variant:"ghost",size:"sm",disabled:w,onClick:()=>{j(null),N(null),d?.({scale:null,align:null})},children:m.common.cancel})]}),(0,t.jsx)("input",{type:"range",min:n._,max:n.a,step:1,value:I,disabled:w,"aria-label":m.exam.uniformFigureScaleSlider,"aria-describedby":`${x}-hint`,onChange:e=>F(e.target.value),className:"block h-6 w-full max-w-sm accent-primary"}),(0,t.jsx)("p",{id:`${x}-hint`,className:"text-xs text-muted-foreground",children:m.exam.uniformFigureScaleHint})]})}],339023),e.s(["D",0,1e3,"W",0,.001,"s",0,function(e){return Number.isInteger(e)?String(e):e.toFixed(1)},"H",0,function(e){return null===e||"number"!=typeof e||!Number.isFinite(e)||e<.001||e>1e3||Math.abs(10*e-Math.round(10*e))>1e-6?null:Math.round(10*e)/10},"n",0,c],763896);var d=e.i(401280);let u=["一","二","三","四","五","六","七","八","九","十","十一","十二","十三","十四","十五","十六","十七","十八","十九","二十"],m=["I","II","III","IV","V","VI","VII","VIII","IX","X","XI","XII","XIII","XIV","XV","XVI","XVII","XVIII","XIX","XX"];e.s(["f",0,function(e,t){let a=new Map;for(let e of d.V)a.set(e,[]);for(let t of[...e].sort((e,t)=>e.order-t.order))a.get(function(e){let t=e.questionType??e.errorItemQuestionType??null;return d.V.includes(t??"")?t:"other"}(t)).push(t);let r=[],s=1,l=0;for(let e of d.V){let i=a.get(e);if(0===i.length)continue;let n=c(i.map(e=>e.score??null));r.push({type:"other"===e?null:e,title:function(e,t,a){let r="zh"===a?d.H[e]:d.u[e];return"zh"===a?`${u[t]}、${r}`:`Part ${m[t]}. ${r}`}(e,l,t),items:i.map(e=>({question:e,displayNumber:s++})),count:i.length,scoreTotal:n.total,unscored:n.unscored}),l+=1}return r}],336653)},663661,e=>{var t=e.i(843476),a=e.i(487486),r=e.i(111110);let s={generating:"bg-blue-100 dark:bg-blue-900/40 text-blue-700 dark:text-blue-300 border-blue-200 dark:border-blue-900",ready:"bg-indigo-100 dark:bg-indigo-900/40 text-indigo-700 dark:text-indigo-300 border-indigo-200 dark:border-indigo-900",partial:"bg-amber-100 dark:bg-amber-900/40 text-amber-700 dark:text-amber-300 border-amber-200 dark:border-amber-900",failed:"bg-red-100 dark:bg-red-900/40 text-red-700 dark:text-red-300 border-red-200 dark:border-red-900",completed:"bg-green-100 dark:bg-green-900/40 text-green-700 dark:text-green-300 border-green-200 dark:border-green-900"};e.s(["f",0,function({status:e,recorded:l}){let{t:i}=(0,r.b)(),n=l&&("ready"===e||"partial"===e)?"completed":e;return(0,t.jsx)(a.f,{variant:"outline",className:s[n],children:i.exam.status[n]})}])},991686,931454,e=>{var t=e.i(843476),a=e.i(271645),r=e.i(522016),s=e.i(215519),l=e.i(306831),i=e.i(716327),n=e.i(456539),o=e.i(632781),c=e.i(77071),d=e.i(328623),u=e.i(759659),m=e.i(487486),x=e.i(519455),f=e.i(515288),h=e.i(511445),g=e.i(856522),p=e.i(793479),b=e.i(393733),y=e.i(111110),v=e.i(41931);function j({errorItemId:e,onSaved:r,onCancel:i}){let{t:n}=(0,y.b)(),{timeZone:c}=(0,s.M)(),d=(0,l.r)(new Date,"yyyy-MM-dd",c),[u,m]=(0,a.useState)(null),[f,h]=(0,a.useState)(d),[k,N]=(0,a.useState)(!1),[w,S]=(0,a.useState)(null),C=async()=>{if(u&&f){N(!0),S(null);try{await v.k.post("/api/practice/record",{errorItemId:e,result:u,source:"manual",takenAt:(0,l.$)(f,c)}),r()}catch{S(n.mastery.resultSaveFailed)}finally{N(!1)}}};return(0,t.jsxs)("div",{className:"space-y-3 rounded-md border bg-muted/30 p-3",children:[(0,t.jsx)(b.f,{value:u,onChange:m,disabled:k}),(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2",children:[(0,t.jsx)("label",{htmlFor:`practice-date-${e}`,className:"text-sm font-medium",children:n.mastery.recordDate}),(0,t.jsx)(p.f,{id:`practice-date-${e}`,type:"date",value:f,max:d,onChange:e=>h(e.target.value),className:"sm:w-48"}),(0,t.jsxs)("div",{className:"flex gap-2 sm:ml-auto",children:[(0,t.jsx)(x.f,{variant:"outline",size:"sm",onClick:i,disabled:k,className:"flex-1 sm:flex-none",children:n.exam.cancel}),(0,t.jsxs)(x.f,{size:"sm",onClick:C,disabled:k||!u||!f,className:"flex-1 sm:flex-none",children:[k?(0,t.jsx)(o.f,{className:"mr-2 h-4 w-4 animate-spin"}):(0,t.jsx)(g.f,{className:"mr-2 h-4 w-4"}),n.mastery.saveResult]})]})]}),w&&(0,t.jsx)("p",{className:"text-sm text-destructive",children:w})]})}var k=e.i(149704),N=e.i(294114),w=e.i(905110);let S={correct:"bg-green-100 dark:bg-green-900/40 text-green-700 dark:text-green-300 border-green-200 dark:border-green-900",wrong:"bg-red-100 dark:bg-red-900/40 text-red-700 dark:text-red-300 border-red-200 dark:border-red-900",not_attempted:"bg-amber-100 dark:bg-amber-900/40 text-amber-700 dark:text-amber-300 border-amber-200 dark:border-amber-900"};e.s(["K",0,function({errorItemId:e,onMasteryStatusChange:g}){let{timeZone:p}=(0,s.M)(),{t:b}=(0,y.b)(),[C,_]=(0,a.useState)(null),[I,q]=(0,a.useState)(null),[R,$]=(0,a.useState)(0),[z,T]=(0,a.useState)(!1),M=(0,a.useCallback)(()=>{v.k.get(`/api/error-items/${e}/practice-records`).then(e=>{_(e),g?.(e.masteryStatus)}).catch(()=>void 0)},[e,g]);(0,a.useEffect)(M,[M]);let F=()=>{$(0),M()},A=async e=>{if(await (0,N.u)(b.mastery.deleteRecordConfirm,{destructive:!0}))try{await v.k.delete(`/api/practice/record/${e}`),F()}catch{N.c.error(b.mastery.deleteRecordFailed)}},E=C?.records[0],V=!!E&&(!C?.masteryEvaluatedAt||new Date(E.createdAt)>new Date(C.masteryEvaluatedAt));if((0,a.useEffect)(()=>{if(!V||R>=20)return;let e=setTimeout(()=>{$(e=>e+1),M()},4e3);return()=>clearTimeout(e)},[V,R,M]),!C)return null;let D=C.masteryProbability,H=null===D?null:Math.round(100*D),P=null===H?"":(0,w.m)(D,C.masteryThreshold)?"bg-green-500":H>=30?"bg-amber-500":"bg-red-500",X=b.practice.difficulty;return(0,t.jsxs)(f.N,{children:[(0,t.jsx)(f.Y,{children:(0,t.jsxs)(f.v,{className:"flex items-center gap-2 text-base",children:[(0,t.jsx)(d.f,{className:"h-4 w-4 text-primary"}),b.mastery.probability]})}),(0,t.jsxs)(f.O,{className:"space-y-4",children:[null===H?(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:V?b.mastery.pending:b.mastery.notEvaluated}):(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-baseline justify-between gap-2",children:[(0,t.jsxs)("span",{className:"text-3xl font-bold",children:[H,"%"]}),(0,t.jsxs)("span",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[V&&(0,t.jsx)(o.f,{className:"h-3 w-3 animate-spin"}),(0,t.jsx)(m.f,{variant:"outline",children:"ai"===C.masterySource?b.mastery.aiEvaluated:b.mastery.estimated})]})]}),(0,t.jsx)("div",{className:"h-2 w-full rounded-full bg-muted overflow-hidden",children:(0,t.jsx)("div",{className:`h-full ${P} transition-all`,style:{width:`${H}%`}})}),C.masteryReason&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:C.masteryReason}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:b.mastery.thresholdHint.replace("{threshold}",String(C.masteryThreshold))})]}),(0,t.jsxs)("div",{className:"space-y-2 border-t pt-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsx)("h4",{className:"text-sm font-semibold",children:b.mastery.history}),!z&&(0,t.jsxs)(x.f,{variant:"outline",size:"sm",onClick:()=>T(!0),children:[(0,t.jsx)(c.f,{className:"mr-1 h-4 w-4"}),b.mastery.addRecord]})]}),z&&(0,t.jsx)(j,{errorItemId:e,onCancel:()=>T(!1),onSaved:()=>{T(!1),F()}}),0===C.records.length?(0,t.jsx)("p",{className:"text-sm text-muted-foreground italic",children:b.mastery.noHistory}):(0,t.jsx)("ul",{className:"divide-y rounded-md border",children:C.records.map(e=>(0,t.jsxs)("li",{className:"p-3 text-sm space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-start gap-2",children:[(0,t.jsxs)("button",{type:"button",className:"flex min-w-0 flex-1 flex-wrap items-center gap-2 text-left",onClick:()=>q(I===e.id?null:e.id),children:[(0,t.jsx)("span",{className:"text-muted-foreground tabular-nums",children:(0,l.r)(e.createdAt,"yyyy-MM-dd HH:mm",p)}),(0,t.jsx)(m.f,{variant:"outline",className:S[e.result]||"",children:b.mastery.results[e.result]||e.result}),e.difficulty&&(0,t.jsx)(m.f,{variant:"secondary",children:X[e.difficulty]||e.difficulty}),(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:e.exam?`${b.mastery.sources.exam} \xb7 ${e.exam.title}`:b.mastery.sources[e.source]||b.mastery.sources.practice}),e.questionText&&(0,t.jsx)("span",{className:"ml-auto text-muted-foreground",children:I===e.id?(0,t.jsx)(n.f,{className:"h-4 w-4"}):(0,t.jsx)(i.f,{className:"h-4 w-4"})})]}),(0,t.jsx)("button",{type:"button","aria-label":b.mastery.deleteRecord,title:b.mastery.deleteRecord,className:"shrink-0 rounded p-1 text-muted-foreground hover:bg-red-50 dark:hover:bg-red-950/40 hover:text-red-600 dark:hover:text-red-400",onClick:()=>A(e.id),children:(0,t.jsx)(u.f,{className:"h-4 w-4"})})]}),I===e.id&&e.questionText&&(0,t.jsxs)("div",{className:"space-y-2 rounded-md bg-muted/40 p-3",children:[(0,t.jsx)(h.f,{content:e.questionText}),(0,t.jsx)(k.f,{svg:e.figureSvg}),e.wrongAnswerText&&(0,t.jsxs)("div",{className:"border-t pt-2",children:[(0,t.jsx)("p",{className:"mb-1 font-medium",children:b.editor.wrongAnswerText}),(0,t.jsx)(h.f,{content:e.wrongAnswerText})]}),e.mistakeAnalysis&&(0,t.jsxs)("div",{className:"border-t pt-2",children:[(0,t.jsx)("p",{className:"mb-1 font-medium",children:b.editor.mistakeAnalysis}),(0,t.jsx)(h.f,{content:e.mistakeAnalysis})]}),e.originalImageUrl&&(0,t.jsx)("img",{src:e.originalImageUrl,alt:b.editor.wrongAnswerText,className:"max-h-96 max-w-full rounded object-contain"}),e.answerText&&(0,t.jsx)("div",{className:"border-t pt-2",children:(0,t.jsx)(h.f,{content:e.answerText,className:"font-semibold"})}),e.exam&&(0,t.jsx)(r.default,{href:`/exams/${e.exam.paperId}`,className:"text-xs text-primary hover:underline",children:e.exam.title})]})]},e.id))})]})]})]})},"x",0,S],991686);var C=e.i(534693);e.s(["f",()=>C.f],931454)},393733,e=>{var t=e.i(843476),a=e.i(548161),r=e.i(576248),s=e.i(583967),l=e.i(111110);let i=[{value:"correct",icon:a.f,active:"border-green-600 bg-green-50 dark:bg-green-950/40 text-green-700 dark:text-green-300"},{value:"wrong",icon:s.f,active:"border-red-600 bg-red-50 dark:bg-red-950/40 text-red-700 dark:text-red-300"},{value:"not_attempted",icon:r.f,active:"border-amber-600 bg-amber-50 dark:bg-amber-950/40 text-amber-700 dark:text-amber-300"}];e.s(["f",0,function({value:e,onChange:a,disabled:r,size:s="md"}){let{t:n}=(0,l.b)(),o="sm"===s?"px-2 py-1 text-xs":"px-3 py-2 text-sm";return(0,t.jsx)("div",{className:"grid grid-cols-3 gap-2",role:"radiogroup",children:i.map(({value:l,icon:i,active:c})=>(0,t.jsxs)("button",{type:"button",role:"radio","aria-checked":e===l,disabled:r,onClick:()=>a(l),className:`flex items-center justify-center gap-1 rounded-md border font-medium transition-colors disabled:opacity-60 ${o} ${e===l?c:"border-input hover:bg-muted"}`,children:[(0,t.jsx)(i,{className:"sm"===s?"h-3 w-3":"h-4 w-4"}),n.mastery.results[l]]},l))})}])},149704,e=>{var t=e.i(843476),a=e.i(111110),r=e.i(398019),s=e.i(184110),l=e.i(975157);let i={left:"mr-auto",center:"mx-auto",right:"ml-auto"};e.s(["f",0,function({svg:e,scale:n,align:o,className:c}){let{t:d}=(0,a.b)();if(!e)return null;let u=(0,s.V)(n),m=(0,s.o)(o);return(0,t.jsx)("figure",{className:(0,l.f)("question-figure my-3",c),children:(0,t.jsx)("img",{src:(0,r.d)(e),alt:d.figure.alt,className:(0,l.f)(i[m],"block h-auto max-w-full rounded border bg-white p-2"),style:{..."left"===m?{marginLeft:0,marginRight:"auto"}:"right"===m?{marginLeft:"auto",marginRight:0}:{},maxHeight:360,zoom:u/100,maxWidth:`${Math.min(u,100)}%`}})})}])},590546,e=>{var t=e.i(843476),a=e.i(618566),r=e.i(519455),s=e.i(711241);e.s(["f",0,function({fallbackUrl:e,className:l}){let i=(0,a.useRouter)();return(0,t.jsx)(r.f,{variant:"ghost",size:"icon",onClick:()=>{i.push(e)},className:l,children:(0,t.jsx)(s.f,{className:"h-5 w-5"})})}])},257428,e=>{var t=e.i(843476),a=e.i(271645),r=e.i(820783),s=e.i(30030),l=e.i(981140),i=e.i(369340),n=e.i(635804),o=e.i(296626),c=e.i(248425),d=Object.defineProperty,u=(e,t)=>d(e,"name",{value:t,configurable:!0}),m="Checkbox",[x,f]=(0,s.f)(m),[h,g]=x(m);function p(e){let{__scopeCheckbox:r,checked:s,children:l,defaultChecked:n,disabled:o,form:c,name:d,onCheckedChange:u,required:x,value:f="on",internal_do_not_use_render:g}=e,[p,b]=(0,i.f)({prop:s,defaultProp:n??!1,onChange:u,caller:m}),[y,v]=a.useState(null),[j,w]=a.useState(null),[S,C]=a.useState(null),_=!y||!!c||!!y.closest("form"),I={checked:p,disabled:o,setChecked:b,control:y,setControl:v,name:d,form:c,value:f,userClick:S,onUserClick:C,required:x,defaultChecked:!N(n)&&n,isFormControl:_,bubbleInput:j,setBubbleInput:w};return(0,t.jsx)(h,{scope:r,...I,children:k(g)?g(I):l})}u(p,"CheckboxProvider");var b=a.forwardRef(u(function({__scopeCheckbox:e,onKeyDown:s,onClick:i,...n},o){let{control:d,value:m,disabled:x,checked:f,required:h,setControl:p,setChecked:b,onUserClick:y,isFormControl:v,bubbleInput:j}=g("CheckboxTrigger",e),k=(0,r.f)(o,p),S=a.useRef(f);return a.useEffect(()=>{let e=d?.form;if(e){let t=u(()=>b(S.current),"reset");return e.addEventListener("reset",t),()=>e.removeEventListener("reset",t)}},[d,b]),(0,t.jsx)(c.V.button,{type:"button",role:"checkbox","aria-checked":N(f)?"mixed":f,"aria-required":h,"data-state":w(f),"data-disabled":x?"":void 0,disabled:x,value:m,...n,ref:k,onKeyDown:(0,l.f)(s,e=>{"Enter"===e.key&&e.preventDefault()}),onClick:(0,l.f)(i,e=>{let t=e.isPropagationStopped();y({requestedChecked:!!N(f)||!f,hasConsumerStoppedPropagation:t}),b(e=>!!N(e)||!e),j&&v&&!t&&e.stopPropagation()})})},"CheckboxTrigger")),y=a.forwardRef(u(function(e,a){let{__scopeCheckbox:r,name:s,checked:l,defaultChecked:i,required:n,disabled:o,value:c,onCheckedChange:d,form:u,...m}=e;return(0,t.jsx)(p,{__scopeCheckbox:r,checked:l,defaultChecked:i,disabled:o,required:n,onCheckedChange:d,name:s,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(b,{...m,ref:a,__scopeCheckbox:r}),e&&(0,t.jsx)(j,{__scopeCheckbox:r})]})})},"Checkbox")),v=a.forwardRef(u(function(e,a){let{__scopeCheckbox:r,forceMount:s,...l}=e,i=g("CheckboxIndicator",r);return(0,t.jsx)(o.f,{present:s||N(i.checked)||!0===i.checked,children:(0,t.jsx)(c.V.span,{"data-state":w(i.checked),"data-disabled":i.disabled?"":void 0,...l,ref:a,style:{pointerEvents:"none",...e.style}})})},"CheckboxIndicator")),j=a.forwardRef(u(function({__scopeCheckbox:e,onClick:s,...i},o){let{control:d,userClick:u,checked:m,defaultChecked:x,required:f,disabled:h,name:p,value:b,form:y,bubbleInput:v,setBubbleInput:j}=g("CheckboxBubbleInput",e),k=(0,r.f)(o,j),w=(0,n.f)(d),S=a.useRef(!1),C=a.useRef(m),_=a.useRef(u),I=a.useRef(null);a.useEffect(()=>{if(!v)return;let e=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked").set;if(!e)return;let t=C.current!==m;C.current=m;let a=null!==u&&u!==_.current;if(_.current=u,a)I.current=t?null:u,t&&(v.indeterminate=N(m),e.call(v,!N(m)&&m)),v.dispatchEvent(new Event("click",{bubbles:!u.hasConsumerStoppedPropagation}));else if(t){let t=I.current;I.current=null;let a=t?.requestedChecked===m;S.current=!0,v.indeterminate=N(m),e.call(v,!N(m)&&m),v.dispatchEvent(new Event("click",{bubbles:!(a&&t.hasConsumerStoppedPropagation)})),S.current=!1}},[v,m,u]);let q=a.useRef(!N(m)&&m);return(0,t.jsx)(c.V.input,{type:"checkbox","aria-hidden":!0,defaultChecked:x??q.current,required:f,disabled:h,name:p,value:b,form:y,...i,tabIndex:-1,ref:k,onClick:(0,l.f)(s,e=>{S.current&&e.stopPropagation()}),style:{...i.style,...w,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"CheckboxBubbleInput"));function k(e){return"function"==typeof e}function N(e){return"indeterminate"===e}function w(e){return N(e)?"indeterminate":e?"checked":"unchecked"}u(k,"isFunction"),u(N,"isIndeterminate"),u(w,"getState");var S=e.i(689664),C=e.i(975157);let _=a.forwardRef(({className:e,...a},r)=>(0,t.jsx)(y,{ref:r,className:(0,C.f)("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...a,children:(0,t.jsx)(v,{className:(0,C.f)("flex items-center justify-center text-current"),children:(0,t.jsx)(S.f,{className:"h-4 w-4"})})}));_.displayName=y.displayName,e.s(["f",0,_],257428)},86963,e=>{var t=e.i(843476),a=e.i(632781);e.s(["f",0,function({label:e}){return(0,t.jsxs)("div",{className:"flex min-h-[50vh] flex-col items-center justify-center gap-3 text-muted-foreground",children:[(0,t.jsx)(a.f,{className:"h-7 w-7 animate-spin text-primary"}),e&&(0,t.jsx)("p",{className:"text-sm",children:e})]})}])},184110,e=>{let t=["left","center","right"],a="center";function r(e){return"number"==typeof e&&Number.isInteger(e)&&e>=10&&e<=200}e.s(["E",0,a,"n",0,100,"j",0,t,"a",0,200,"_",0,10,"x",0,r,"o",0,function(e){return"string"==typeof e&&t.includes(e)?e:a},"V",0,function(e){return r(e)?e:100}])},398019,e=>{e.s(["K",0,1e5,"d",0,function(e){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`}])},35209,e=>{var t=e.i(271645),a=e.i(111110);e.s(["f",0,function(...e){let{t:r}=(0,a.b)(),s=[r.pageTitle.base,...e.map(e=>"string"==typeof e?e.trim():"").filter(e=>e.length>0)].join("-");(0,t.useEffect)(()=>{document.title=s},[s])}])},401280,e=>{let t={single_choice:"single_choice",singlechoice:"single_choice","single choice":"single_choice","single-choice":"single_choice",multiple_choice:"multiple_choice",multiplechoice:"multiple_choice","multiple choice":"multiple_choice","multiple-choice":"multiple_choice",multichoice:"multiple_choice","multi choice":"multiple_choice",true_false:"true_false",truefalse:"true_false","true/false":"true_false","true false":"true_false","true-false":"true_false","true / false":"true_false",fill_blank:"fill_blank",fillblank:"fill_blank","fill in the blank":"fill_blank","fill-in-the-blank":"fill_blank",fillintheblank:"fill_blank",calculation:"calculation",solution:"solution",reading:"reading",cloze:"cloze",writing:"writing",other:"other",选择题:"single_choice",单项选择:"single_choice",单选:"single_choice",单选题:"single_choice",不定项:"multiple_choice",不定项选择:"multiple_choice",多项选择:"multiple_choice",多选:"multiple_choice",多选题:"multiple_choice",判断:"true_false",判断题:"true_false",是非:"true_false",是非题:"true_false",填空:"fill_blank",填空题:"fill_blank",口算:"calculation",计算:"calculation",计算题:"calculation",解答:"solution",解答题:"solution",应用:"solution",应用题:"solution",证明:"solution",证明题:"solution",简答:"solution",简答题:"solution",阅读:"reading",阅读理解:"reading",完形:"cloze",完形填空:"cloze",作文:"writing",写作:"writing",书面表达:"writing",其他:"other"};e.s(["O",0,"__none__","V",0,["single_choice","multiple_choice","true_false","fill_blank","calculation","solution","reading","cloze","writing","other"],"u",0,{single_choice:"Single Choice",multiple_choice:"Multiple Choice",true_false:"True / False",fill_blank:"Fill in the Blank",calculation:"Calculation",solution:"Solution",reading:"Reading Comprehension",cloze:"Cloze",writing:"Writing",other:"Other"},"H",0,{single_choice:"单选题",multiple_choice:"多选题",true_false:"判断题",fill_blank:"填空题",calculation:"计算题",solution:"解答题",reading:"阅读理解",cloze:"完形填空",writing:"写作",other:"其他"},"P",0,function(e){if("string"!=typeof e)return null;let a=e.trim().toLowerCase();return a?t[a]??null:null}])}])})();
|
|
File without changes
|
/package/.next/static/{bFQJMw9c1NJ6NSOY8pN2N → isKicFguXFifPUwKaqFfK}/_clientMiddlewareManifest.js
RENAMED
|
File without changes
|
|
File without changes
|