@mathwiz/ui-components 0.1.14 → 0.1.16

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/dist/index.cjs CHANGED
@@ -728,7 +728,7 @@ Possible parent types: [point,point], [point,number], [point,function]`);return
728
728
  [zustand devtools middleware] Unsupported __setState action format.
729
729
  When using 'store' option in devtools(), the 'state' should have only one key, which is a value of 'store' that was passed in devtools(),
730
730
  and value of this only key should be a state object. Example: { "type": "__setState", "state": { "abc123Store": { "foo": "bar" } } }
731
- `);const C=v.state[l];if(C==null)return;JSON.stringify(n.getState())!==JSON.stringify(C)&&p(C);return}n.dispatchFromDevtools&&typeof n.dispatch=="function"&&n.dispatch(v)});case"DISPATCH":switch(g.payload.type){case"RESET":return p(m),l===void 0?u?.init(n.getState()):u?.init(getTrackedConnectionState(h.name));case"COMMIT":if(l===void 0){u?.init(n.getState());return}return u?.init(getTrackedConnectionState(h.name));case"ROLLBACK":return parseJsonThen(g.state,v=>{if(l===void 0){p(v),u?.init(n.getState());return}p(v[l]),u?.init(getTrackedConnectionState(h.name))});case"JUMP_TO_STATE":case"JUMP_TO_ACTION":return parseJsonThen(g.state,v=>{if(l===void 0){p(v);return}JSON.stringify(n.getState())!==JSON.stringify(v[l])&&p(v[l])});case"IMPORT_STATE":{const{nextLiftedState:v}=g.payload,C=(b=v.computedStates.slice(-1)[0])==null?void 0:b.state;if(!C)return;p(l===void 0?C:C[l]),u?.send(null,v);return}case"PAUSE_RECORDING":return f=!f}return}}),m},devtools=devtoolsImpl,parseJsonThen=(e,t)=>{let r;try{r=JSON.parse(e)}catch(s){console.error("[zustand devtools middleware] Could not parse the received json",s)}r!==void 0&&t(r)},API_BASE_URL="/api/v1/content",MOCK_JWT_TOKEN="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJ1c2VyLTAwMSIsIm5hbWUiOiLlsI_mmI4iLCJsZXZlbCI6NSwiYXZhdGFyIjoiaHR0cHM6Ly9pLnByYXZhdGFyLmNjLzQwP3U9c3R1ZGVudDEiLCJiYWRnZXMiOlsi8J-SoiIsIvCfjZUiLCLwn5KbIl0sImlhdCI6MTY5MTYwMDAwMCwiZXhwIjoxNzIzMTM2MDAwfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",DEFAULT_QUESTION_COUNT=10,INITIAL_SCENE="question",useSessionStore=create()(devtools((e,t)=>({sessionId:null,problems:[],totalProblems:0,currentProblemIndex:0,currentScene:"question",userAnswers:{},submissionResults:{},geometryShapes:{},selectedShapeId:null,geometryMode:"view",loading:!1,error:null,timeSpent:0,startTime:null,sessionComplete:!1,loadQuestions:async(r,s)=>{e({loading:!0,sessionId:r});try{const{gradeLevel:n,unitId:o,lessonId:a,count:l=DEFAULT_QUESTION_COUNT}=s,h=`${API_BASE_URL}/grades/${n}/units/${o}/lessons/${a}/sessions/${r}/questions`,c=await fetch(h,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${MOCK_JWT_TOKEN}`},body:JSON.stringify({count:l})});if(!c.ok)throw new Error(`Failed to load questions: ${c.status} ${c.statusText}`);const d=(await c.json()).questions||[],f={};d.forEach(p=>{p.geometryShapes&&Array.isArray(p.geometryShapes)&&(f[p.problemId]=p.geometryShapes)}),e({problems:d,totalProblems:d.length,currentProblemIndex:0,currentScene:INITIAL_SCENE,geometryShapes:f,loading:!1,error:null,startTime:Date.now()})}catch(n){const o=n instanceof Error?n.message:"Unknown error occurred";throw e({error:o,loading:!1}),n}},goToNextProblem:()=>{const{currentProblemIndex:r,problems:s,currentScene:n}=t();if(n!==INITIAL_SCENE){console.warn("Cannot navigate during review/solve scene");return}r<s.length-1?e({currentProblemIndex:r+1,currentScene:INITIAL_SCENE}):e({sessionComplete:!0})},goToPreviousProblem:()=>{const{currentProblemIndex:r,currentScene:s}=t();s===INITIAL_SCENE&&r>0&&e({currentProblemIndex:r-1,currentScene:INITIAL_SCENE})},goToProblem:r=>{const{problems:s,currentScene:n}=t();n===INITIAL_SCENE&&(r<0||r>=s.length||e({currentProblemIndex:r,currentScene:INITIAL_SCENE}))},switchScene:r=>{e({currentScene:r})},submitAnswer:async(r,s)=>{const{problems:n,currentProblemIndex:o}=t(),a=n[o];e({loading:!0});try{const l=a?.answer.correctAnswer||[],h=s.length>0&&s[0]===l[0],c={userAnswer:s,isCorrect:h,feedback:h?"🎉 Great job! Your answer is correct!":"❌ Sorry, that's not correct."};e(u=>({userAnswers:{...u.userAnswers,[r]:s},submissionResults:{...u.submissionResults,[r]:c},loading:!1,currentScene:h?"review":"solve"}))}catch(l){e({error:l instanceof Error?l.message:"Submission error",loading:!1})}},updateUserAnswer:(r,s)=>{e(n=>({userAnswers:{...n.userAnswers,[r]:s}}))},updateShape:(r,s,n)=>{e(o=>{const l=(o.geometryShapes[r]||[]).map(h=>h.id===s&&h.type==="point"?{...h,position:n}:h);return{geometryShapes:{...o.geometryShapes,[r]:l}}})},selectShape:(r,s)=>{e({selectedShapeId:s})},setGeometryMode:(r,s)=>{e({geometryMode:s})},startTimer:()=>{e({startTime:Date.now()})},stopTimer:()=>{const{startTime:r}=t();if(r){const s=Math.floor((Date.now()-r)/1e3);e(n=>({timeSpent:n.timeSpent+s,startTime:null}))}},reset:()=>{e({sessionId:null,problems:[],totalProblems:0,currentProblemIndex:0,currentScene:INITIAL_SCENE,userAnswers:{},submissionResults:{},geometryShapes:{},selectedShapeId:null,geometryMode:"view",loading:!1,error:null,timeSpent:0,startTime:null,sessionComplete:!1})},getCurrentProblem:()=>{const{problems:r,currentProblemIndex:s}=t();return r[s]||null},getProgress:()=>{const{currentProblemIndex:r,totalProblems:s}=t();return{current:r+1,total:s,percentage:s>0?(r+1)/s*100:0}},getSessionResults:()=>{const{sessionId:r,problems:s,submissionResults:n,timeSpent:o}=t(),a=s.map(h=>({problemId:h.problemId,userAnswer:n[h.problemId]?.userAnswer||[],isCorrect:n[h.problemId]?.isCorrect||!1,timeSpent:0})),l=a.filter(h=>h.isCorrect).length;return{sessionId:r||"",totalProblems:s.length,correctAnswers:l,accuracy:s.length>0?l/s.length:0,timeSpent:o,averageTime:s.length>0?o/s.length:0,answers:a}}}),{name:"MathSessionStore"})),useSessionCalculations=(e,t,r,s,n,o,a)=>{const l=React.useMemo(()=>r==="question",[r]),h=React.useMemo(()=>e<t.length-1,[e,t.length]),c=React.useMemo(()=>e>0,[e]),u=React.useMemo(()=>!s||!n?!1:s.problemType?.includes("geometry")||o&&o[n]&&o[n].length>0?!0:a?.enableMathGraph!==void 0?a.enableMathGraph:!1,[s,n,o,a?.enableMathGraph]);return{canNavigate:l,canGoNext:h,canGoPrevious:c,shouldRenderMathGraph:u}},useGeometryManagement=(e,t,r,s,n)=>{const o=useSessionStore(u=>u.selectShape),a=useSessionStore(u=>u.setGeometryMode),l=React.useMemo(()=>t?s[t]||[]:[],[s,t]);React.useEffect(()=>{if(!t||!r)return;let u="view";switch(e){case"question":u="edit";break;case"solve":case"review":u="view";break;default:u="view"}n!==u&&a(t,u)},[e,t,n,a,r]);const h=React.useCallback(u=>{t&&useSessionStore.setState(d=>({geometryShapes:{...d.geometryShapes,[t]:u}}))},[t]),c=React.useCallback(u=>{if(t){const d=u.length>0?u[0]:null;o(t,d)}},[t,o]);return{currentGeometryShapes:l,geometryMode:n,handleShapeChange:h,handleSelectionChange:c}},useSessionEventHandlers=(e,t,r)=>{const s=useSessionStore(p=>p.updateUserAnswer),n=useSessionStore(p=>p.submitAnswer),o=useSessionStore(p=>p.goToNextProblem),a=useSessionStore(p=>p.goToPreviousProblem),l=useSessionStore(p=>p.goToProblem),h=React.useCallback(p=>{e&&s(e,p)},[e,s]),c=React.useCallback(()=>{e&&r[e]&&n(e,r[e])},[e,r,n]),u=React.useCallback(p=>{o(),p?.(e,t+1)},[o,e,t]),d=React.useCallback(p=>{a(),p?.(e,t-1)},[a,e,t]),f=React.useCallback((p,m)=>{l(p-1),m?.(e,p-1)},[l,e]);return{handleAnswerChange:h,handleSubmit:c,handleNext:u,handlePrevious:d,handlePagination:f}},MathSessionContainer=({config:e={},onSessionComplete:t,onSessionExit:r,onProblemChange:s,className:n="",style:o})=>{const a=useSessionStore(R=>R.problems),l=useSessionStore(R=>R.currentProblemIndex),h=useSessionStore(R=>R.currentScene),c=useSessionStore(R=>R.loading),u=useSessionStore(R=>R.error),d=useSessionStore(R=>R.sessionComplete),f=useSessionStore(R=>R.submissionResults),p=useSessionStore(R=>R.userAnswers),m=useSessionStore(R=>R.geometryShapes),g=useSessionStore(R=>R.geometryMode),b=useSessionStore(R=>R.getSessionResults),v=React.useMemo(()=>a[l]??null,[a,l]),C=React.useMemo(()=>v?.problemId??"",[v]),{canNavigate:x,canGoNext:_,canGoPrevious:y,shouldRenderMathGraph:w}=useSessionCalculations(l,a,h,v,C,m,e),{currentGeometryShapes:E,handleShapeChange:M,handleSelectionChange:G}=useGeometryManagement(h,C,w,m,g),{handleAnswerChange:X,handleSubmit:P,handleNext:$,handlePrevious:k,handlePagination:A}=useSessionEventHandlers(C,l,p);React.useEffect(()=>{if(d&&typeof b=="function"){const R=b();t?.(R)}},[d,b,t]);const B=R=>typeof R=="string"?R:R instanceof Error?R.message:String(R);return c&&a.length===0?jsxRuntimeExports.jsx("div",{className:"flex items-center justify-center p-12","data-testid":"math-session-loading",children:jsxRuntimeExports.jsxs("div",{className:"text-center",children:[jsxRuntimeExports.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600 mx-auto mb-4"}),jsxRuntimeExports.jsx("p",{className:"text-gray-600",children:"Loading questions..."})]})}):u&&u!==null?jsxRuntimeExports.jsx("div",{className:"flex items-center justify-center p-12","data-testid":"math-session-error",children:jsxRuntimeExports.jsxs("div",{className:"text-center text-red-600",children:[jsxRuntimeExports.jsx("p",{className:"text-lg font-semibold mb-2",children:"Error"}),jsxRuntimeExports.jsx("p",{children:B(u)})]})}):v?jsxRuntimeExports.jsxs("div",{className:`flex flex-col max-w-4xl mx-auto p-6 ${n}`,style:o,"data-testid":"math-session-container",role:"region","aria-label":"数学练习会话",children:[jsxRuntimeExports.jsx("div",{className:"mb-6",children:jsxRuntimeExports.jsx(react.Pagination,{total:a.length,page:l+1,onChange:R=>A(R,s),isDisabled:!x,showControls:!1,color:"primary",size:"lg",className:"justify-center"})}),jsxRuntimeExports.jsx(MathCard,{problemData:v,scene:h,submissionResult:f[C],loading:c,error:u?B(u):void 0,value:p[C],onAnswerChange:X,onSubmit:P,onNext:()=>$(s),config:{theme:e.theme??"light",submitButtonText:"提交答案",nextButtonText:h==="solve"?"Got it!":"下一题",showHints:e.enableHints}}),w&&jsxRuntimeExports.jsx("div",{className:"mt-4 w-full max-w-4xl mx-auto","data-testid":"mathgraph-container",children:jsxRuntimeExports.jsx(MathGraph,{shapes:E,mode:g,onShapeChange:M,onSelectionChange:G,showGrid:!0,showAxis:!0,width:800,height:500,boundingBoxOptions:{padding:.5,margin:2,minSize:8}})}),e.showProgress&&jsxRuntimeExports.jsxs("div",{className:"mt-6 flex justify-between items-center",children:[jsxRuntimeExports.jsx("button",{onClick:()=>k(s),disabled:!y,className:"px-4 py-2 text-sm border border-gray-300 rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:"上一题"}),jsxRuntimeExports.jsxs("div",{className:"text-sm text-gray-600",children:[l+1," / ",a.length]}),jsxRuntimeExports.jsx("button",{onClick:()=>$(s),disabled:!_||!x,className:"px-4 py-2 text-sm bg-blue-600 text-white rounded-md hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:"下一题"})]}),r&&jsxRuntimeExports.jsx("div",{className:"mt-4 flex justify-center",children:jsxRuntimeExports.jsx("button",{onClick:r,className:"px-4 py-2 text-sm text-gray-600 hover:text-gray-900 transition-colors",children:"退出练习"})})]}):jsxRuntimeExports.jsx("div",{className:"flex items-center justify-center p-12","data-testid":"math-session-empty",children:jsxRuntimeExports.jsx("p",{className:"text-gray-600",children:"No problems available"})})},MathSessionPage=({sessionId:e,gradeId:t,unitId:r,lessonId:s,userId:n,config:o={},className:a="",onSessionComplete:l,onSessionExit:h})=>{const[c,u]=React.useState({loading:!1,error:null,initialized:!1}),[d,f]=React.useState(0),[p,m]=React.useState(""),g=React.useRef(null),b=React.useRef(null),v=React.useRef(null),C=useSessionStore(M=>M.loadQuestions),x=useSessionStore(M=>M.reset);React.useEffect(()=>{const M=async()=>{try{u(G=>({...G,loading:!0,error:null})),console.log("🎯 MathSessionPage: 开始初始化会话",{sessionId:e,gradeId:t,unitId:r,lessonId:s,userId:n}),await C(e,{gradeLevel:parseInt(t.replace("g",""))||5,unitId:r,lessonId:s,count:o.questionCount||10}),u(G=>({...G,loading:!1,initialized:!0})),console.log("✅ MathSessionPage: 会话初始化完成")}catch(G){const X=G instanceof Error?G.message:"Failed to initialize session";u(P=>({...P,loading:!1,error:X,initialized:!1})),console.error("❌ MathSessionPage: 会话初始化失败",G)}};e&&t&&r&&s&&!c.initialized&&M()},[e,t,r,s,C,o.questionCount,c.initialized,d]),React.useEffect(()=>{c.loading&&!c.initialized?m("正在加载数学练习内容,请稍候..."):c.error?m(`加载失败:${c.error},请点击重试按钮重新加载`):c.initialized&&m("数学练习内容已加载完成,可以开始练习")},[c.loading,c.error,c.initialized]),React.useEffect(()=>{c.initialized&&g.current&&g.current.focus()},[c.initialized]),React.useEffect(()=>{c.error&&v.current&&v.current.focus()},[c.error]),React.useEffect(()=>{c.loading&&b.current&&b.current.focus()},[c.loading]),React.useEffect(()=>()=>{console.log("🧹 MathSessionPage: 清理会话状态"),x()},[x]);const _=React.useCallback(M=>{console.log("🎉 MathSessionPage: 会话完成",M),l?.(M)},[l]),y=React.useCallback(()=>{console.log("🚪 MathSessionPage: 退出会话"),h?.()},[h]),w=React.useCallback((M,G)=>{console.log(`📝 MathSessionPage: 切换到题目 ${G+1}`,M)},[]),E=React.useCallback(M=>{M.key==="Escape"&&(M.preventDefault(),y()),M.key==="Enter"&&c.error&&M.target===v.current&&(M.preventDefault(),u({loading:!1,error:null,initialized:!1}),f(G=>G+1))},[y,c.error]);return c.loading&&!c.initialized?jsxRuntimeExports.jsxs("div",{className:`math-session-page loading ${a}`,"data-testid":"math-session-page",role:"main","aria-label":"数学练习页面",onKeyDown:E,tabIndex:-1,ref:b,children:[jsxRuntimeExports.jsx("div",{"aria-live":"assertive","aria-atomic":"true",className:"sr-only",children:p}),jsxRuntimeExports.jsx("div",{className:"page-loading-container",children:jsxRuntimeExports.jsxs("div",{className:"loading-spinner","data-testid":"page-loading-spinner",role:"status","aria-label":"正在加载练习内容",children:[jsxRuntimeExports.jsx("div",{className:"spinner","aria-hidden":"true"}),jsxRuntimeExports.jsx("p",{className:"loading-text",children:"正在加载练习内容..."})]})})]}):c.error?jsxRuntimeExports.jsxs("div",{className:`math-session-page error ${a}`,"data-testid":"math-session-page",role:"main","aria-label":"数学练习页面 - 错误状态",onKeyDown:E,tabIndex:-1,ref:v,children:[jsxRuntimeExports.jsx("div",{"aria-live":"assertive","aria-atomic":"true",className:"sr-only",children:p}),jsxRuntimeExports.jsxs("div",{className:"error-container",children:[jsxRuntimeExports.jsx("div",{className:"error-icon",role:"img","aria-label":"警告图标",children:"⚠️"}),jsxRuntimeExports.jsx("h3",{className:"error-title",children:"加载失败"}),jsxRuntimeExports.jsx("p",{className:"error-message",children:c.error}),jsxRuntimeExports.jsx("button",{onClick:()=>{u({loading:!1,error:null,initialized:!1}),f(M=>M+1)},className:"retry-button","data-testid":"retry-button","aria-label":"重新加载练习内容",children:"重试"})]})]}):jsxRuntimeExports.jsxs("div",{className:`math-session-page ${a}`,"data-testid":"math-session-page",role:"main","aria-label":"数学练习页面",onKeyDown:E,children:[jsxRuntimeExports.jsx("div",{"aria-live":"polite","aria-atomic":"true",className:"sr-only",children:p}),o.layout?.showHeader&&jsxRuntimeExports.jsx("header",{className:"page-header",role:"banner",children:jsxRuntimeExports.jsxs("div",{className:"header-content",children:[jsxRuntimeExports.jsx("h1",{className:"page-title",children:"数学练习"}),jsxRuntimeExports.jsxs("div",{className:"session-info","aria-label":"会话信息",children:[jsxRuntimeExports.jsxs("span",{className:"session-id",children:["会话: ",e]}),jsxRuntimeExports.jsxs("span",{className:"grade-info",children:["年级: ",t]})]})]})}),jsxRuntimeExports.jsx("main",{className:"page-main",ref:g,tabIndex:-1,"aria-label":"数学练习主要内容区域",children:jsxRuntimeExports.jsx(MathSessionContainer,{config:{showProgress:o.showProgress??!0,enableHints:o.enableHints??!1,autoAdvance:o.autoAdvance??!1,theme:o.theme??"light"},onSessionComplete:_,onSessionExit:y,onProblemChange:w})}),o.layout?.showFooter&&jsxRuntimeExports.jsx("footer",{className:"page-footer",role:"contentinfo",children:jsxRuntimeExports.jsx("div",{className:"footer-content",children:jsxRuntimeExports.jsx("p",{className:"footer-text",children:"© 2024 MathWiz - 小学数学益智教育平台"})})})]})},MathSessionPage$1=React.memo(MathSessionPage),MathCardV2Context=React.createContext(void 0),useDataAdapter=(e,t)=>React.useMemo(()=>{const r=e.scenes?.[t];return{...e,content:r?.content||e.content,layout:r?.layout||e.layout,renderer:r?.renderer||e.renderer}},[e,t]),CardLayout=({children:e,padding:t="16px",shadow:r=!0,border:s=!0,theme:n="light",className:o=""})=>{const a=n==="dark"?"theme-dark":"theme-light",l=r?"shadow-card":"",h=s?"border border-gray-200":"";return jsxRuntimeExports.jsx("div",{className:`mathcard-v2-card ${a} ${l} ${h} ${o}`,style:{padding:t},"data-testid":"mathcard-v2-container",children:e})},GridLayout=({children:e,columns:t,gap:r="16px",responsive:s=!0,className:n=""})=>{const o={display:"grid",gridTemplateColumns:`repeat(${t}, 1fr)`,gap:r},a=s?"mathcard-v2-grid-responsive":"";return jsxRuntimeExports.jsx("div",{style:o,className:`mathcard-v2-grid ${a} ${n}`,"data-testid":"grid-layout",children:e})},FlowLayout=({children:e,direction:t="vertical",gap:r="8px",wrap:s=!1,className:n=""})=>{const o={display:t==="horizontal"?"flex":"block",gap:r,flexWrap:s?"wrap":"nowrap"};return t==="horizontal"&&(o.flexDirection="row"),jsxRuntimeExports.jsx("div",{style:o,className:`mathcard-v2-flow ${n}`,"data-testid":"flow-layout",children:e})},TextContent=({content:e,style:t={},onInteraction:r,className:s=""})=>jsxRuntimeExports.jsx("div",{className:`mathcard-v2-text ${s}`,style:t,onClick:()=>r?.({type:"click",content:e}),"data-testid":"text-content",children:e}),FormulaContent=({parts:e,children:t,displayMode:r=!1,style:s={},className:n=""})=>jsxRuntimeExports.jsx("div",{className:`mathcard-v2-formula ${n}`,style:s,"data-testid":"equation-render",children:jsxRuntimeExports.jsx(EquationRender,{parts:e,children:t,displayMode:r})}),GraphContent=({shapes:e,width:t,height:r,showGrid:s=!0,showAxis:n=!0,onShapeChange:o,className:a=""})=>{const l=React.useRef(null),[h,c]=React.useState({width:600,height:400});React.useEffect(()=>{const d=()=>{if(l.current){const{clientWidth:p,clientHeight:m}=l.current;p>0&&m>0&&c({width:p,height:m})}};d(),window.addEventListener("resize",d);const f=new ResizeObserver(d);return l.current&&f.observe(l.current),()=>{window.removeEventListener("resize",d),f.disconnect()}},[]);const u={width:t?typeof t=="string"?t:`${t}px`:"100%",height:r?typeof r=="string"?r:`${r}px`:"100%"};return jsxRuntimeExports.jsx("div",{ref:l,className:`mathcard-v2-graph ${a}`,style:u,children:jsxRuntimeExports.jsx(MathGraph,{shapes:e,width:h.width,height:h.height,showGrid:s,showAxis:n,onShapeChange:o,mode:"view","data-testid":"mathgraph"})})},isIterable=e=>Symbol.iterator in e,hasIterableEntries=e=>"entries"in e,compareEntries=(e,t)=>{const r=e instanceof Map?e:new Map(e.entries()),s=t instanceof Map?t:new Map(t.entries());if(r.size!==s.size)return!1;for(const[n,o]of r)if(!s.has(n)||!Object.is(o,s.get(n)))return!1;return!0},compareIterables=(e,t)=>{const r=e[Symbol.iterator](),s=t[Symbol.iterator]();let n=r.next(),o=s.next();for(;!n.done&&!o.done;){if(!Object.is(n.value,o.value))return!1;n=r.next(),o=s.next()}return!!n.done&&!!o.done};function shallow(e,t){return Object.is(e,t)?!0:typeof e!="object"||e===null||typeof t!="object"||t===null||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t)?!1:isIterable(e)&&isIterable(t)?hasIterableEntries(e)&&hasIterableEntries(t)?compareEntries(e,t):compareIterables(e,t):compareEntries({entries:()=>Object.entries(e)},{entries:()=>Object.entries(t)})}function useShallow(e){const t=React.useRef(void 0);return r=>{const s=e(r);return shallow(t.current,s)?t.current:t.current=s}}const useHundredChartStore=create((e,t)=>({internalValue:0,isDragging:!1,dragState:{isDragging:!1,startIndex:-1,currentIndex:-1,direction:null},setInternalValue:r=>{e({internalValue:Math.max(0,Math.min(1,r))})},startDrag:r=>{e({isDragging:!0,dragState:{isDragging:!0,startIndex:r,currentIndex:r,direction:null}})},updateDrag:r=>{const{dragState:s}=t();let n=null;if(s.startIndex!==-1&&r!==-1){const o=Math.floor(s.startIndex/10),a=s.startIndex%10,l=Math.floor(r/10),h=r%10;l===o?n=h>a?"ltr":"rtl":h===a&&(n=l>o?"ttb":"btt")}e({dragState:{...s,currentIndex:r,direction:n}})},endDrag:()=>{e({isDragging:!1,dragState:{isDragging:!1,startIndex:-1,currentIndex:-1,direction:null}})},resetDrag:()=>{e({isDragging:!1,dragState:{isDragging:!1,startIndex:-1,currentIndex:-1,direction:null}})}})),useHundredChartValue=()=>useHundredChartStore(useShallow(e=>({internalValue:e.internalValue,setInternalValue:e.setInternalValue}))),useHundredChartDrag=()=>useHundredChartStore(useShallow(e=>({isDragging:e.isDragging,dragState:e.dragState,startDrag:e.startDrag,updateDrag:e.updateDrag,endDrag:e.endDrag,resetDrag:e.resetDrag}))),calculateFilledCells=e=>{const{totalCells:t,fillRatio:r,direction:s,rows:n,cols:o}=e,a=Math.round(t*r),l=[];if(s==="ltr")for(let h=0;h<a;h++)l.push(h);else for(let h=0;h<n;h++)for(let c=0;c<o;c++){const u=h*o+c;l.length<a&&l.push(u)}return{filledCells:l,filledCount:a,actualRatio:a/t}},generateCellData=(e,t,r,s)=>{const n=[];for(let o=0;o<e;o++)for(let a=0;a<t;a++){const l=o*t+a;n.push({index:l,row:o,col:a,filled:s.includes(l),x:a*r,y:o*r})}return n},calculateDragRange=(e,t,r,s,n)=>{if(e===-1||t===-1||!r)return[];const o=Math.floor(e/n),a=e%n,l=Math.floor(t/n),h=t%n,c=[];switch(r){case"ltr":for(let u=a;u<=h;u++)c.push(o*n+u);break;case"rtl":for(let u=a;u>=h;u--)c.push(o*n+u);break;case"ttb":for(let u=o;u<=l;u++)c.push(u*n+a);break;case"btt":for(let u=o;u>=l;u--)c.push(u*n+a);break}return c},calculateValueFromDrag=(e,t)=>Math.max(0,Math.min(1,e.length/t)),validateValue=e=>Math.max(0,Math.min(1,e)),HundredChart=({value:e,defaultValue:t=0,mode:r="readonly",onChange:s,rows:n=10,cols:o=10,cellSize:a=12,fillColor:l="#3b82f6",baseColor:h="#f3f4f6",strokeColor:c="#d1d5db",shadingDirection:u="ltr",hasShadow:d=!0,className:f=""})=>{const{internalValue:p,setInternalValue:m}=useHundredChartValue(),{isDragging:g,dragState:b,startDrag:v,updateDrag:C,endDrag:x}=useHundredChartDrag(),_=e!==void 0,y=_?validateValue(e):p,[w,E]=React.useState(!1);!w&&!_&&(m(validateValue(t)),E(!0));const M=React.useMemo(()=>{const z={totalCells:n*o,fillRatio:y,direction:u,rows:n,cols:o};return calculateFilledCells(z).filledCells},[y,n,o,u]),G=React.useMemo(()=>generateCellData(n,o,a,M),[n,o,a,M]),X=React.useMemo(()=>!g||b.startIndex===-1||b.currentIndex===-1?[]:calculateDragRange(b.startIndex,b.currentIndex,b.direction,n,o),[g,b,n,o]),P=React.useCallback(I=>{if(r!=="edit")return;const z=validateValue((I+1)/(n*o));_||m(z),s?.(z)},[r,n,o,_,s,m]),$=React.useCallback(I=>{r==="edit"&&v(I)},[r,v]),k=React.useCallback(I=>{r!=="edit"||!g||C(I)},[r,g,C]),A=React.useCallback(()=>{if(!(r!=="edit"||!g)){if(X.length>0){const I=calculateValueFromDrag(X,n*o);_||m(I),s?.(I)}x()}},[r,g,X,n,o,_,s,m,x]),B=o*a,R=n*a,U=["hundred-chart-container",`hundred-chart--${r}`,d&&"hundred-chart--has-shadow",f].filter(Boolean).join(" "),V=Math.round(y*100);return jsxRuntimeExports.jsx("div",{className:U,"data-testid":"hundred-chart-container",children:jsxRuntimeExports.jsx("svg",{width:B,height:R,className:"hundred-chart-svg","data-testid":"hundred-chart-svg",role:"img","aria-label":`百格图 - ${V}% 已填充`,children:G.map(I=>{const z=M.includes(I.index),L=X.includes(I.index),O=z||L;return jsxRuntimeExports.jsx("rect",{x:I.x,y:I.y,width:a,height:a,fill:O?l:h,stroke:c,strokeWidth:1,className:"hundred-chart-cell","data-testid":"hundred-chart-cell","data-filled":z,"data-drag":L,"aria-label":`第${I.row+1}行第${I.col+1}列,${O?"已填充":"未填充"}`,tabIndex:r==="edit"?0:-1,onClick:()=>P(I.index),onMouseDown:()=>$(I.index),onMouseEnter:()=>k(I.index),onMouseUp:A,onKeyDown:J=>{r==="edit"&&J.key==="Enter"&&P(I.index)}},I.index)})})})},PlaceValueChart=({headers:e,values:t,colors:r={}})=>{const{headerBg:s="#f1f5f9",valueBg:n="#ffffff",borderColor:o="#e2e8f0"}=r;return e.length!==t.length?(console.warn("PlaceValueChart: headers and values length mismatch"),null):jsxRuntimeExports.jsxs("div",{className:"place-value-chart",style:{display:"inline-block",border:`1px solid ${o}`,borderRadius:"8px",overflow:"hidden",fontFamily:"system-ui, sans-serif",fontSize:"14px",lineHeight:"1.4"},children:[jsxRuntimeExports.jsx("div",{style:{display:"flex",borderBottom:`1px solid ${o}`},children:e.map((a,l)=>jsxRuntimeExports.jsx("div",{style:{flex:1,padding:"8px 12px",backgroundColor:s,fontWeight:"600",textAlign:"center",borderRight:l<e.length-1?`1px solid ${o}`:"none",color:"#1e293b"},children:a},l))}),jsxRuntimeExports.jsx("div",{style:{display:"flex"},children:t.map((a,l)=>jsxRuntimeExports.jsx("div",{style:{flex:1,padding:"12px",backgroundColor:n,textAlign:"center",borderRight:l<t.length-1?`1px solid ${o}`:"none",color:"#0f172a",fontSize:"16px",fontWeight:"500"},children:a},l))})]})},ContentRenderer=({content:e,onInteraction:t})=>{const r=(s,n)=>{const o=`${s.type}-${n}`,a=l=>{t?.(o,l)};switch(s.type){case"text":return jsxRuntimeExports.jsx(TextContent,{content:s.content,style:s.style,onInteraction:a},o);case"formula":const l=s;return jsxRuntimeExports.jsx(FormulaContent,{parts:l.parts||[],displayMode:l.displayMode,style:s.style},o);case"graph":const h=s;return jsxRuntimeExports.jsx(GraphContent,{shapes:h.shapes||[],width:h.width,height:h.height,showGrid:h.showGrid,showAxis:h.showAxis},o);case"hundredGrid":const c=s;return jsxRuntimeExports.jsx(HundredChart,{...c.props},o);case"placeValueChart":const u=s;return jsxRuntimeExports.jsx(PlaceValueChart,{...u.props},o);default:return jsxRuntimeExports.jsx("div",{onClick:()=>a({type:"click"}),children:s.content},o)}};return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:e.map(r)})},MathCardV2=({data:e,scene:t="question",layout:r={type:"card"},renderer:s={mode:"default"},theme:n="light",onContentInteraction:o,className:a="",children:l})=>{const h=useDataAdapter(e,t),c={data:h,scene:t,layout:h.layout||r,renderer:h.renderer||s,theme:n,onContentInteraction:o},u=h.layout||r,d=(()=>{switch(u.type){case"grid":return GridLayout;case"flow":return FlowLayout;case"card":default:return CardLayout}})(),f=(()=>{const p={className:a,theme:n,"data-testid":"mathcard-v2-container"};switch(u.type){case"grid":return{...p,columns:u.columns||2,gap:u.gap||"16px",responsive:u.responsive!==!1};case"flow":return{...p,direction:u.direction||"vertical",gap:u.gap||"16px",wrap:u.wrap!==!1};case"card":default:return{...p,padding:u.padding||"24px",shadow:u.shadow!==!1,border:u.border!==!1}}})();return jsxRuntimeExports.jsx(MathCardV2Context.Provider,{value:c,children:jsxRuntimeExports.jsx(d,{...f,children:l||jsxRuntimeExports.jsx(ContentRenderer,{content:h.content,layout:h.layout||r,onInteraction:o})})})};MathCardV2.CardLayout=CardLayout,MathCardV2.GridLayout=GridLayout,MathCardV2.FlowLayout=FlowLayout,MathCardV2.TextContent=TextContent,MathCardV2.FormulaContent=FormulaContent,MathCardV2.GraphContent=GraphContent,MathCardV2.ContentRenderer=ContentRenderer;const useMathPracticeSessionStore=create(e=>({currentScene:"question",userAnswer:"",isCorrect:null,showAnswerForm:!0,updateUserAnswer:t=>{e({userAnswer:t})},submitAnswer:t=>{const s=t==="35";e({userAnswer:t,isCorrect:s,showAnswerForm:!1,currentScene:s?"success":"explanation"})},nextQuestion:()=>{e({currentScene:"question",userAnswer:"",isCorrect:null,showAnswerForm:!0})},resetSession:()=>{e({currentScene:"question",userAnswer:"",isCorrect:null,showAnswerForm:!0})}})),useCurrentScene=()=>useMathPracticeSessionStore(e=>e.currentScene),useUserAnswer=()=>useMathPracticeSessionStore(e=>e.userAnswer),useAnswerCorrectness=()=>useMathPracticeSessionStore(e=>e.isCorrect),useAnswerFormVisibility=()=>useMathPracticeSessionStore(e=>e.showAnswerForm),useSessionActions=()=>useMathPracticeSessionStore(useShallow(e=>({updateUserAnswer:e.updateUserAnswer,submitAnswer:e.submitAnswer,nextQuestion:e.nextQuestion,resetSession:e.resetSession}))),ReviewModule=({problemData:e,userAnswer:t})=>jsxRuntimeExports.jsxs("div",{className:"border-l-8 border-yellow-400 pl-6",children:[jsxRuntimeExports.jsx("h4",{className:"text-sm font-bold text-yellow-600 uppercase mb-4",children:"复习"}),jsxRuntimeExports.jsxs("div",{className:"text-slate-700",children:[jsxRuntimeExports.jsx("p",{className:"text-xl mb-4",children:e.basicInfo.question}),jsxRuntimeExports.jsx("div",{className:"my-6",children:jsxRuntimeExports.jsx(MathCardV2,{data:{id:"review-problem",grade:e.grade,unit:e.unit,content:e.scenes.question.content},scene:"question",layout:{type:"card"}})}),jsxRuntimeExports.jsxs("p",{className:"mt-4",children:["你的答案: ",jsxRuntimeExports.jsx("span",{className:"font-bold p-1 bg-red-100 rounded",children:t})]})]})]}),RememberModule=({problemData:e})=>{const t=e.scenes?.review?.content||[];return t.length===0?jsxRuntimeExports.jsxs("div",{className:"border-l-8 border-blue-400 pl-6",children:[jsxRuntimeExports.jsx("h4",{className:"text-sm font-bold text-blue-600 uppercase mb-4",children:"记忆"}),jsxRuntimeExports.jsx("div",{className:"text-slate-700 bg-slate-50 p-4 rounded-md",children:jsxRuntimeExports.jsx("p",{className:"text-slate-500",children:"暂无记忆内容"})})]}):jsxRuntimeExports.jsxs("div",{className:"border-l-8 border-blue-400 pl-6",children:[jsxRuntimeExports.jsx("h4",{className:"text-sm font-bold text-blue-600 uppercase mb-4",children:"记忆"}),jsxRuntimeExports.jsx("div",{className:"text-slate-700 bg-slate-50 p-4 rounded-md",children:t.map((r,s)=>{const{type:n,content:o,style:a,parts:l}=r;switch(n){case"text":return jsxRuntimeExports.jsx("p",{className:"mb-2",style:a,children:o},s);case"formula":return jsxRuntimeExports.jsx("div",{className:"mb-4",children:jsxRuntimeExports.jsx(MathCardV2,{data:{id:`formula-${s}`,grade:e.grade,unit:e.unit,content:[{type:"formula",content:o,parts:l||[o]}]},layout:{type:"card"}})},s);default:return jsxRuntimeExports.jsxs("p",{className:"text-slate-500",children:["不支持的内容类型: ",n]},s)}})})]})},ExplanationStep=({step:e,problemData:t,stepNumber:r})=>{const{title:s,description:n,chartConfig:o}=e.content,a=!!o,l=[{type:"text",content:n.replace(/<br>/g,`
732
- `).replace(/<[^>]*>/g,""),style:{fontSize:"1rem",color:"#374151",lineHeight:"1.6"}}];return jsxRuntimeExports.jsxs("div",{className:"mb-8 last:mb-0",children:[jsxRuntimeExports.jsxs("div",{className:"flex items-center mb-4",children:[jsxRuntimeExports.jsx("div",{className:"w-8 h-8 bg-orange-500 text-white rounded-full flex items-center justify-center text-sm font-bold mr-3",children:r}),jsxRuntimeExports.jsx("h5",{className:"text-lg font-semibold text-slate-800",children:s})]}),jsxRuntimeExports.jsxs("div",{className:"space-y-4",children:[jsxRuntimeExports.jsx(MathCardV2,{data:{id:`${e.id}-description`,grade:t.grade,unit:t.unit,content:l},layout:{type:"card",padding:"16px"},className:"bg-slate-50 border border-slate-200"}),a&&jsxRuntimeExports.jsxs("div",{className:"p-4 bg-white rounded-lg border border-slate-200 shadow-sm",children:[jsxRuntimeExports.jsx("h6",{className:"text-sm font-medium text-slate-700 mb-3",children:"图形解释"}),jsxRuntimeExports.jsx(MathGraph,{shapes:o.shapes,width:400,height:300,boundingBox:o.boundingBox,showGrid:o.showGrid||!1,showAxis:o.showAxis||!1,mode:"view",className:"mx-auto"})]})]})]})},SolveModule=({problemData:e})=>{const t=e.explanation&&e.explanation.length>0;return jsxRuntimeExports.jsxs("div",{className:"border-l-8 border-orange-400 pl-6",children:[jsxRuntimeExports.jsx("h4",{className:"text-sm font-bold text-orange-600 uppercase mb-4",children:"解题"}),jsxRuntimeExports.jsxs("div",{className:"text-slate-700 space-y-6",children:[jsxRuntimeExports.jsx(MathCardV2,{data:{id:"solve-steps",grade:e.grade,unit:e.unit,content:e.scenes.solve.content},scene:"solve",layout:{type:"flow",direction:"vertical",gap:"16px"}}),t&&jsxRuntimeExports.jsxs("div",{className:"mt-6",children:[jsxRuntimeExports.jsx("h5",{className:"text-lg font-semibold text-slate-800 mb-4",children:"详细解题步骤"}),jsxRuntimeExports.jsx("div",{className:"space-y-6",children:e.explanation.map((r,s)=>jsxRuntimeExports.jsx(ExplanationStep,{step:r,problemData:e,stepNumber:s+1},r.id))})]})]})]})},QuestionScene=({problemData:e,userAnswer:t,showAnswerForm:r,onAnswerSubmit:s,onAnswerChange:n})=>{const o=l=>{l.preventDefault(),s(t)},a=l=>{n(l)};return jsxRuntimeExports.jsxs("div",{className:"p-6 md:p-8",children:[jsxRuntimeExports.jsx(MathCardV2,{data:{id:e.id,grade:e.grade,unit:e.unit,content:e.scenes.question.content},scene:"question",layout:{type:"card"},className:"mb-6"}),r&&jsxRuntimeExports.jsxs("form",{onSubmit:o,className:"mt-8 flex items-center gap-4",children:[jsxRuntimeExports.jsx("input",{type:"number",value:t,onChange:l=>a(l.target.value),className:"border-2 border-slate-300 rounded-md p-2 text-lg w-24 focus:ring-2 focus:ring-blue-500 focus:border-blue-500",placeholder:"答案",required:!0}),jsxRuntimeExports.jsx("span",{className:"text-lg text-slate-700",children:e.basicInfo.answerUnit||e.basicInfo.areaUnit}),jsxRuntimeExports.jsx("button",{type:"submit",className:"ml-auto bg-green-600 text-white font-bold py-2 px-6 rounded-md hover:bg-green-700 transition-colors",children:"提交"})]})]})},ExplanationScene=({problemData:e,userAnswer:t,onNextQuestion:r})=>jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsxs("div",{className:"p-6 bg-red-50 border-b border-red-200 flex items-center",children:[jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("h3",{className:"text-xl font-bold text-red-800",children:"抱歉,答案不正确..."}),jsxRuntimeExports.jsxs("p",{className:"text-slate-600 mt-1",children:["正确答案是: ",jsxRuntimeExports.jsx("span",{className:"font-bold",children:e.answer.value})]})]}),jsxRuntimeExports.jsx("button",{onClick:r,className:"ml-auto bg-green-600 text-white font-bold py-2 px-6 rounded-md hover:bg-green-700 transition-colors",children:"明白了"})]}),jsxRuntimeExports.jsxs("div",{className:"p-6 md:p-8 space-y-8",children:[jsxRuntimeExports.jsx(ReviewModule,{problemData:e,userAnswer:t}),jsxRuntimeExports.jsx(RememberModule,{problemData:e}),jsxRuntimeExports.jsx(SolveModule,{problemData:e})]}),jsxRuntimeExports.jsx("div",{className:"p-6 text-right border-t border-slate-200",children:jsxRuntimeExports.jsx("button",{onClick:r,className:"bg-green-600 text-white font-bold py-2 px-6 rounded-md hover:bg-green-700 transition-colors",children:"明白了"})})]}),SuccessScene=({problemData:e,onNextQuestion:t})=>jsxRuntimeExports.jsxs("div",{className:"p-8 bg-green-50 text-center",children:[jsxRuntimeExports.jsx("h3",{className:"text-2xl font-bold text-green-800",children:"正确!"}),jsxRuntimeExports.jsx("p",{className:"text-lg text-slate-600 mt-2",children:"你做得很好!"}),jsxRuntimeExports.jsx("div",{className:"mt-6 max-w-md mx-auto",children:jsxRuntimeExports.jsx(MathCardV2,{data:{id:"review-concepts",grade:e.grade,unit:e.unit,content:e.scenes.review.content},scene:"review",layout:{type:"card"}})}),jsxRuntimeExports.jsx("button",{onClick:t,className:"mt-6 bg-green-600 text-white font-bold py-2 px-6 rounded-md hover:bg-green-700 transition-colors",children:"下一题"})]}),id="rectangle-area-003",title="矩形面积计算问题",grade=5,unit="几何与测量",description="计算矩形的面积,理解面积公式 A = l × w 的应用",basicInfo={shape:"rectangle",length:7,width:5,lengthUnit:"码",widthUnit:"码",areaUnit:"平方码",question:"这个矩形的面积是多少?"},content=[{type:"text",content:"What is the area of this rectangle?"}],scenes={question:{content:[{type:"text",content:"What is the area of this rectangle?",style:{fontSize:"1.5rem",color:"#1e293b"}},{type:"graph",content:"矩形图形",shapes:[{id:"pointA",type:"point",position:{x:1,y:1},name:"A",size:4,strokeColor:"#3B82F6"},{id:"pointB",type:"point",position:{x:8,y:1},name:"B",size:4,strokeColor:"#3B82F6"},{id:"pointC",type:"point",position:{x:8,y:6},name:"C",size:4,strokeColor:"#3B82F6"},{id:"pointD",type:"point",position:{x:1,y:6},name:"D",size:4,strokeColor:"#3B82F6"},{id:"rectangle",type:"polygon",vertices:[{$ref:"pointA"},{$ref:"pointB"},{$ref:"pointC"},{$ref:"pointD"}],strokeColor:"#0ea5e9",fillColor:"#7dd3fc",fillOpacity:.3,strokeWidth:2,name:"矩形"},{id:"lengthLabel",type:"text",position:{x:4.5,y:0},content:"7 yd",color:"#475569",fontSize:16},{id:"widthLabel",type:"text",position:{x:9,y:3.5},content:"5 yd",color:"#475569",fontSize:16}],width:400,height:300,boundingBox:[0,8,10,0],showGrid:!1,showAxis:!1}]},solve:{content:[{type:"text",content:"解题步骤:",style:{fontSize:"1.25rem",fontWeight:"bold",color:"#1e293b"}},{type:"text",content:"1. 观察矩形:长度是 7 码,宽度是 5 码",style:{marginTop:"8px"}},{type:"formula",content:"A = l × w",parts:["A = l \\times w"]},{type:"formula",content:"= 7 × 5",parts:["= 7 \\times 5"]},{type:"formula",content:"= 35",parts:["= 35"]},{type:"text",content:"长度和宽度以码为单位,所以面积以平方码为单位",style:{marginTop:"8px"}},{type:"text",content:"最终答案:矩形的面积是 35 平方码",style:{marginTop:"8px",fontWeight:"bold"}}]},review:{content:[{type:"text",content:"核心概念回顾:",style:{fontSize:"1.25rem",fontWeight:"bold",color:"#1e293b"}},{type:"text",content:"矩形面积公式:A = l × w",style:{marginTop:"8px"}},{type:"text",content:"其中 l 是长度,w 是宽度",style:{color:"#64748b"}}]}},explanation=[{id:"exp-step-1",type:"instructionalStep",content:{title:"步骤1:识别矩形的尺寸",description:"观察图形,确定矩形的长度和宽度,并理解尺寸的单位。",chartConfig:{type:"graph",shapes:[{id:"pointA",type:"point",position:{x:1,y:1},name:"A",size:4,strokeColor:"#3B82F6"},{id:"pointB",type:"point",position:{x:8,y:1},name:"B",size:4,strokeColor:"#3B82F6"},{id:"pointC",type:"point",position:{x:8,y:6},name:"C",size:4,strokeColor:"#3B82F6"},{id:"pointD",type:"point",position:{x:1,y:6},name:"D",size:4,strokeColor:"#3B82F6"},{id:"rectangle",type:"polygon",vertices:[{$ref:"pointA"},{$ref:"pointB"},{$ref:"pointC"},{$ref:"pointD"}],strokeColor:"#0ea5e9",fillColor:"#7dd3fc",fillOpacity:.3,strokeWidth:2},{id:"lengthLabel",type:"text",position:{x:4.5,y:0},content:"长度:7 码",color:"#475569",fontSize:14},{id:"widthLabel",type:"text",position:{x:9,y:3.5},content:"宽度:5 码",color:"#475569",fontSize:14}],boundingBox:[0,8,10,0],showGrid:!1,showAxis:!1}}},{id:"exp-step-2",type:"instructionalStep",content:{title:"步骤2:回忆矩形面积公式",description:"复习矩形面积的基本公式:面积 = 长度 × 宽度。",chartConfig:{type:"graph",shapes:[{id:"pointA",type:"point",position:{x:1,y:1},name:"A",size:4,strokeColor:"#3B82F6"},{id:"pointB",type:"point",position:{x:8,y:1},name:"B",size:4,strokeColor:"#3B82F6"},{id:"pointC",type:"point",position:{x:8,y:6},name:"C",size:4,strokeColor:"#3B82F6"},{id:"pointD",type:"point",position:{x:1,y:6},name:"D",size:4,strokeColor:"#3B82F6"},{id:"rectangle",type:"polygon",vertices:[{$ref:"pointA"},{$ref:"pointB"},{$ref:"pointC"},{$ref:"pointD"}],strokeColor:"#0ea5e9",fillColor:"#7dd3fc",fillOpacity:.3,strokeWidth:2},{id:"formulaLabel",type:"text",position:{x:5,y:7},content:"面积公式:A = l × w",color:"#10B981",fontSize:16,fontWeight:"bold"}],boundingBox:[0,8,10,0],showGrid:!1,showAxis:!1}}},{id:"exp-step-3",type:"instructionalStep",content:{title:"步骤3:代入数值计算",description:"将已知的长度和宽度代入公式进行计算。",chartConfig:{type:"graph",shapes:[{id:"pointA",type:"point",position:{x:1,y:1},name:"A",size:4,strokeColor:"#3B82F6"},{id:"pointB",type:"point",position:{x:8,y:1},name:"B",size:4,strokeColor:"#3B82F6"},{id:"pointC",type:"point",position:{x:8,y:6},name:"C",size:4,strokeColor:"#3B82F6"},{id:"pointD",type:"point",position:{x:1,y:6},name:"D",size:4,strokeColor:"#3B82F6"},{id:"rectangle",type:"polygon",vertices:[{$ref:"pointA"},{$ref:"pointB"},{$ref:"pointC"},{$ref:"pointD"}],strokeColor:"#0ea5e9",fillColor:"#7dd3fc",fillOpacity:.3,strokeWidth:2},{id:"calculationLabel",type:"text",position:{x:5,y:7},content:"A = 7 × 5 = 35",color:"#F59E0B",fontSize:16,fontWeight:"bold"}],boundingBox:[0,8,10,0],showGrid:!1,showAxis:!1}}},{id:"exp-step-4",type:"instructionalStep",content:{title:"步骤4:确定面积单位",description:"根据长度和宽度的单位确定面积的单位。",chartConfig:{type:"graph",shapes:[{id:"pointA",type:"point",position:{x:1,y:1},name:"A",size:4,strokeColor:"#3B82F6"},{id:"pointB",type:"point",position:{x:8,y:1},name:"B",size:4,strokeColor:"#3B82F6"},{id:"pointC",type:"point",position:{x:8,y:6},name:"C",size:4,strokeColor:"#3B82F6"},{id:"pointD",type:"point",position:{x:1,y:6},name:"D",size:4,strokeColor:"#3B82F6"},{id:"rectangle",type:"polygon",vertices:[{$ref:"pointA"},{$ref:"pointB"},{$ref:"pointC"},{$ref:"pointD"}],strokeColor:"#0ea5e9",fillColor:"#7dd3fc",fillOpacity:.3,strokeWidth:2},{id:"unitLabel",type:"text",position:{x:5,y:7},content:"长度:码,宽度:码 → 面积:平方码",color:"#8B5CF6",fontSize:14},{id:"finalAnswer",type:"text",position:{x:5,y:7.5},content:"最终答案:35 平方码",color:"#10B981",fontSize:16,fontWeight:"bold"}],boundingBox:[0,8,10,0],showGrid:!1,showAxis:!1}}}],answer={value:35,unit:"平方码",explanation:"矩形的面积是 35 平方码。计算方法:长度 7 码 × 宽度 5 码 = 35 平方码。"},layout={type:"card",padding:"20px"},areaProblemData={id,title,grade,unit,description,basicInfo,content,scenes,explanation,answer,layout},MathPracticeSessionPage=({className:e=""})=>{const t=useCurrentScene(),r=useUserAnswer(),s=useAnswerFormVisibility(),{updateUserAnswer:n,submitAnswer:o,nextQuestion:a}=useSessionActions(),l=React.useMemo(()=>areaProblemData,[]);return jsxRuntimeExports.jsxs("div",{className:`max-w-4xl mx-auto p-4 md:p-8 bg-slate-50 min-h-screen ${e}`,children:[jsxRuntimeExports.jsxs("header",{className:"mb-8",children:[jsxRuntimeExports.jsx("h1",{className:"text-2xl font-bold text-slate-800",children:"数学练习"}),jsxRuntimeExports.jsxs("p",{className:"text-slate-600 mt-2",children:[l.grade,"年级 - ",l.unit]})]}),jsxRuntimeExports.jsxs("main",{className:"bg-white border border-slate-200 rounded-lg shadow-sm",children:[t==="question"&&jsxRuntimeExports.jsx(QuestionScene,{problemData:l,userAnswer:r,showAnswerForm:s,onAnswerSubmit:o,onAnswerChange:n}),t==="explanation"&&jsxRuntimeExports.jsx(ExplanationScene,{problemData:l,userAnswer:r,onNextQuestion:a}),t==="success"&&jsxRuntimeExports.jsx(SuccessScene,{problemData:l,onNextQuestion:a})]})]})},useDecimalNumberRecognitionSessionStore=create(e=>({currentScene:"question",userAnswer:"",isCorrect:null,showAnswerForm:!0,updateUserAnswer:t=>{e({userAnswer:t})},submitAnswer:t=>{const r="0.12",s=t.trim(),n=r.trim();let o=!1;(s===n||s===".12"&&n==="0.12"||s==="0,12"&&n==="0.12")&&(o=!0),e({userAnswer:t,isCorrect:o,showAnswerForm:!1,currentScene:o?"success":"explanation"})},nextQuestion:()=>{e({currentScene:"question",userAnswer:"",isCorrect:null,showAnswerForm:!0})},resetSession:()=>{e({currentScene:"question",userAnswer:"",isCorrect:null,showAnswerForm:!0})}})),useDecimalCurrentScene=()=>useDecimalNumberRecognitionSessionStore(e=>e.currentScene),useDecimalUserAnswer=()=>useDecimalNumberRecognitionSessionStore(e=>e.userAnswer),useDecimalAnswerFormVisibility=()=>useDecimalNumberRecognitionSessionStore(e=>e.showAnswerForm),useDecimalSessionActions=()=>useDecimalNumberRecognitionSessionStore(useShallow(e=>({updateUserAnswer:e.updateUserAnswer,submitAnswer:e.submitAnswer,nextQuestion:e.nextQuestion,resetSession:e.resetSession}))),DecimalNumberExplanationScene=({problemData:e,userAnswer:t,onNextQuestion:r})=>jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsxs("div",{className:"p-6 bg-red-50 border-b border-red-200 flex items-center",children:[jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("h3",{className:"text-xl font-bold text-red-800",children:"抱歉,答案不正确..."}),jsxRuntimeExports.jsxs("p",{className:"text-slate-600 mt-1",children:["正确答案是: ",jsxRuntimeExports.jsx("span",{className:"font-bold",children:e.answer.value})]})]}),jsxRuntimeExports.jsx("button",{onClick:r,className:"ml-auto bg-green-600 text-white font-bold py-2 px-6 rounded-md hover:bg-green-700 transition-colors",children:"明白了"})]}),jsxRuntimeExports.jsxs("div",{className:"p-6 md:p-8 space-y-8",children:[jsxRuntimeExports.jsx(ReviewModule,{problemData:e,userAnswer:t}),jsxRuntimeExports.jsx(SolveModule,{problemData:e})]}),jsxRuntimeExports.jsx("div",{className:"p-6 text-right border-t border-slate-200",children:jsxRuntimeExports.jsx("button",{onClick:r,className:"bg-green-600 text-white font-bold py-2 px-6 rounded-md hover:bg-green-700 transition-colors",children:"明白了"})})]}),decimalNumberRecognitionData={id:"decimal-grid-problem-001",title:"百格图识别小数",grade:4,unit:"小数的认识",description:"通过百格图模型理解百分位和小数的关系。",basicInfo:{question:"What decimal number does the model represent?",answerUnit:""},scenes:{question:{content:[{type:"text",content:"What decimal number does the model represent?",style:{fontSize:"1.5rem",color:"#1e293b",fontWeight:"bold"}},{type:"text",content:"The large square represents 1 whole.",style:{fontSize:"1rem",color:"#475569",marginTop:"4px"}},{type:"hundredGrid",content:"",props:{value:.12,mode:"readonly",rows:10,cols:10,cellSize:12,fillColor:"#a5b4fc",baseColor:"#e2e8f0",strokeColor:"#d1d5db",shadingDirection:"ltr",hasShadow:!0}}]},solve:{content:[{type:"text",content:"解题步骤:",style:{fontSize:"1.25rem",fontWeight:"bold",color:"#1e293b"}},{type:"text",content:'1. 在模型中, 100个小方格中有12个被涂色。这代表 12/100 或者"一百分之十二"。'},{type:"text",content:'2. 你可以使用数位表将"一百分之十二"写作小数。'},{type:"placeValueChart",content:"",props:{headers:["ones (个位)","tenths (十分位)","hundredths (百分位)"],values:["0","1","2"],colors:{headerBg:"#f1f5f9",valueBg:"#ffffff",borderColor:"#e2e8f0"}}},{type:"text",content:"所以, 这个模型代表的小数是 <strong>0.12</strong>。",style:{marginTop:"1rem"}}]},review:{content:[{type:"text",content:"回顾问题:",style:{fontSize:"1.25rem",fontWeight:"bold",color:"#1e293b"}},{type:"text",content:`What decimal number does the model represent?
733
- The large square represents 1 whole.`},{type:"hundredGrid",content:"",props:{value:.12,mode:"readonly",rows:10,cols:10,cellSize:12,fillColor:"#a5b4fc",baseColor:"#e2e8f0",strokeColor:"#d1d5db",shadingDirection:"ltr",hasShadow:!0}}]}},explanation:[],answer:{value:.12,unit:"",explanation:"模型中100个方格有12个被涂色,代表12/100,即0.12。"}},DecimalNumberRecognitionSessionPage=({className:e=""})=>{const t=useDecimalCurrentScene(),r=useDecimalUserAnswer(),s=useDecimalAnswerFormVisibility(),{updateUserAnswer:n,submitAnswer:o,nextQuestion:a}=useDecimalSessionActions(),l=React.useMemo(()=>decimalNumberRecognitionData,[]);return jsxRuntimeExports.jsxs("div",{className:`max-w-4xl mx-auto p-4 md:p-8 bg-slate-50 min-h-screen ${e}`,children:[jsxRuntimeExports.jsxs("header",{className:"mb-8",children:[jsxRuntimeExports.jsx("h1",{className:"text-2xl font-bold text-slate-800",children:"小数认识练习"}),jsxRuntimeExports.jsxs("p",{className:"text-slate-600 mt-2",children:[l.grade,"年级 - ",l.unit]}),jsxRuntimeExports.jsx("p",{className:"text-slate-500 text-sm mt-1",children:"通过百格图模型理解百分位和小数的关系"})]}),jsxRuntimeExports.jsxs("main",{className:"bg-white border border-slate-200 rounded-lg shadow-sm",children:[t==="question"&&jsxRuntimeExports.jsx(QuestionScene,{problemData:l,userAnswer:r,showAnswerForm:s,onAnswerSubmit:o,onAnswerChange:n}),t==="explanation"&&jsxRuntimeExports.jsx(DecimalNumberExplanationScene,{problemData:l,userAnswer:r,onNextQuestion:a}),t==="success"&&jsxRuntimeExports.jsx(SuccessScene,{problemData:l,onNextQuestion:a})]}),jsxRuntimeExports.jsxs("div",{className:"mt-4 text-center text-sm text-slate-500",children:[t==="question"&&"请识别百格图代表的小数",t==="explanation"&&"查看详细解释",t==="success"&&"恭喜!答案正确"]})]})},pointOnLine=(e,t,r)=>({x:e.x+(t.x-e.x)*r,y:e.y+(t.y-e.y)*r}),calculateGamePoints=()=>{const e={x:.5,y:.1,name:"A"},t={x:.1,y:.75,name:"B"},r={x:.9,y:.75,name:"C"},s={...pointOnLine(e,t,1/3),name:"D"},n={...pointOnLine(e,r,1/3),name:"E"},o={...pointOnLine(e,t,2/3),name:"M"},a={...pointOnLine(e,r,2/3),name:"N"},l={...pointOnLine(t,r,1/3),name:"P"},h={...pointOnLine(t,r,2/3),name:"Q"},c={...pointOnLine(s,n,1/3),name:"U"},u={...pointOnLine(s,n,2/3),name:"S"},d={...pointOnLine(o,a,1/3),name:"K"},f={...pointOnLine(o,a,2/3),name:"L"};return{A:e,B:t,C:r,D:s,E:n,M:o,N:a,P:l,Q:h,U:c,S:u,K:d,L:f}},toPixelCoordinates=(e,t,r)=>{const s={};for(const[n,o]of Object.entries(e))s[n]={...o,x:o.x*t,y:o.y*r};return s},isPointInTriangle=(e,t)=>{const[r,s,n]=t,{x:o,y:a}=e,l=(s.y-n.y)*(r.x-n.x)+(n.x-s.x)*(r.y-n.y);if(Math.abs(l)<1e-4)return!1;const h=((s.y-n.y)*(o-n.x)+(n.x-s.x)*(a-n.y))/l,c=((n.y-r.y)*(o-n.x)+(r.x-n.x)*(a-n.y))/l,u=1-h-c;return h>=-.001&&c>=-.001&&u>=-.001},trianglesMatch=(e,t)=>{if(!e||!t||e.length!==3||t.length!==3)return!1;const r=e.map(n=>n.name).sort(),s=t.map(n=>n.name).sort();return r.every((n,o)=>n===s[o])},comparePointArrays=(e,t)=>{if(!e||!t||e.length!==t.length)return!1;const r=e.map(n=>n.name).sort(),s=t.map(n=>n.name).sort();return r.join("")===s.join("")},getBasicLineDefinitions=()=>[{from:"A",to:"B"},{from:"A",to:"C"},{from:"B",to:"C"},{from:"D",to:"E"},{from:"M",to:"N"},{from:"P",to:"Q"},{from:"A",to:"D"},{from:"A",to:"E"},{from:"A",to:"M"},{from:"A",to:"N"},{from:"A",to:"P"},{from:"A",to:"Q"},{from:"D",to:"U"},{from:"U",to:"S"},{from:"S",to:"E"},{from:"M",to:"K"},{from:"K",to:"L"},{from:"L",to:"N"},{from:"B",to:"P"},{from:"P",to:"Q"},{from:"Q",to:"C"}],getBasicGemDefinitions=()=>[{id:"gem_1",vertices:["A","B","P"],points:10,category:"basic"},{id:"gem_2",vertices:["A","P","Q"],points:10,category:"basic"},{id:"gem_3",vertices:["A","Q","C"],points:10,category:"basic"},{id:"gem_4",vertices:["A","B","Q"],points:15,category:"medium"},{id:"gem_5",vertices:["A","P","C"],points:15,category:"medium"},{id:"gem_6",vertices:["A","B","C"],points:20,category:"large"},{id:"gem_7",vertices:["A","D","U"],points:12,category:"ade_small"},{id:"gem_8",vertices:["A","U","S"],points:12,category:"ade_small"},{id:"gem_9",vertices:["A","S","E"],points:12,category:"ade_small"},{id:"gem_10",vertices:["A","D","S"],points:18,category:"ade_medium"},{id:"gem_11",vertices:["A","U","E"],points:18,category:"ade_medium"},{id:"gem_12",vertices:["A","D","E"],points:25,category:"ade_large"},{id:"gem_13",vertices:["A","M","K"],points:14,category:"amn_small"},{id:"gem_14",vertices:["A","K","L"],points:14,category:"amn_small"},{id:"gem_15",vertices:["A","L","N"],points:14,category:"amn_small"},{id:"gem_16",vertices:["A","M","L"],points:20,category:"amn_medium"},{id:"gem_17",vertices:["A","K","N"],points:20,category:"amn_medium"},{id:"gem_18",vertices:["A","M","N"],points:30,category:"amn_large"}],GEOMETRY_CONFIG={TOTAL_GEMS:18,CANVAS_RATIO:4/3,DEFAULT_VIEWBOX:{width:700,height:600},POINT_RADIUS:{default:6,selected:9},TOLERANCE:.001,MIN_TRIANGLE_AREA:.001,COORDINATE_PRECISION:1e-4,BARYCENTRIC_TOLERANCE:-.001},generateMockUserCourseProgress=(e=MOCK_USER_DATA.id)=>{const t=courseData.units.map((n,o)=>{const a=Math.min(100,Math.max(0,o*15+Math.random()*20)),l=Math.floor(n.lessons.length*a/100),h=n.lessons.map((c,u)=>{const d=Math.min(100,Math.max(0,a-u*10+Math.random()*30));return{lessonId:c.id,status:d>=100?"completed":d>0?"in-progress":"not-started",progressPercentage:Math.round(d),lastAccessed:d>0?new Date(Date.now()-Math.random()*7*24*60*60*1e3).toISOString():void 0,timeSpent:d>0?Math.floor(Math.random()*120+10):void 0,score:d>=100?Math.floor(Math.random()*21+80):void 0,attempts:d>0?Math.floor(Math.random()*3+1):void 0}});return{unitId:n.id,userId:e,totalLessons:n.lessons.length,completedLessons:l,progressPercentage:Math.round(a),status:a>=100?"completed":a>0?"in-progress":"not-started",lastAccessed:a>0?new Date(Date.now()-Math.random()*14*24*60*60*1e3).toISOString():void 0,lessons:h}}),r=t.reduce((n,o)=>n+o.progressPercentage,0)/t.length,s=t.filter(n=>n.status==="completed").length;return{courseId:courseData.id,userId:e,totalUnits:t.length,completedUnits:s,progressPercentage:Math.round(r),status:r>=100?"completed":r>0?"in-progress":"not-started",lastAccessed:new Date(Date.now()-Math.random()*3*24*60*60*1e3).toISOString(),units:t}},MOCK_USER_COURSE_PROGRESS=generateMockUserCourseProgress(),getUserCourseProgress=(e,t)=>e===MOCK_USER_DATA.id&&t===courseData.id?MOCK_USER_COURSE_PROGRESS:null,getUserUnitProgress=(e,t,r)=>{const s=getUserCourseProgress(e,t);return s&&s.units.find(n=>n.unitId===r)||null},getUserLessonProgress=(e,t,r,s)=>{const n=getUserUnitProgress(e,t,r);return n&&n.lessons.find(o=>o.lessonId===s)||null},updateUserLessonProgress=(e,t,r,s,n)=>(console.log("Updating lesson progress:",{userId:e,courseId:t,unitId:r,lessonId:s,progress:n}),!0),getUserGradeUnitsNav=(e,t)=>{const r=getUserCourseProgress(e,t);if(!r)return null;const s=courseData.units.map((n,o)=>{const a=r.units.find(l=>l.unitId===n.id);return{unitId:n.id,title:n.title,description:n.description,moduleCategory:n.moduleCategory,estimatedDuration:n.estimatedDuration,totalLessons:n.lessons.length,completedLessons:a?.completedLessons||0,progressPercentage:a?.progressPercentage||0,status:a?.status||"not-started",lastAccessed:a?.lastAccessed,isActive:o===0,route:`/math/grade-${courseData.level}/unit/${n.id}`}});return{userId:e,courseId:courseData.id,courseTitle:courseData.title,courseLevel:courseData.level,totalUnits:s.length,completedUnits:s.filter(n=>n.status==="completed").length,overallProgress:r.progressPercentage,status:r.status,lastAccessed:r.lastAccessed,units:s}},getUnitNavItem=(e,t,r)=>{const s=getUserGradeUnitsNav(e,t);return s&&s.units.find(n=>n.unitId===r)||null},updateUnitActiveStatus=(e,t,r,s)=>(console.log("Updating unit active status:",{userId:e,courseId:t,unitId:r,isActive:s}),!0),MOCK_USER_GRADE_UNITS_NAV=getUserGradeUnitsNav(MOCK_USER_DATA.id,courseData.id),MOCK_USER_GRADE_UNITS_PROGRESS={userId:MOCK_USER_DATA.id,courseId:courseData.id,courseTitle:courseData.title,courseLevel:courseData.level,totalUnits:courseData.units.length,completedUnits:3,overallProgress:45,status:"in-progress",lastAccessed:"2024-01-15T10:30:00Z",units:[{unitId:"unit_1",title:"小数乘法",description:"学习小数乘法的计算方法及应用",moduleCategory:"Arithmetic and Algebra",estimatedDuration:"3周",totalLessons:10,completedLessons:8,progressPercentage:80,status:"completed",lastAccessed:"2024-01-10T14:20:00Z",isActive:!1,route:"/math/grade-5/unit/unit_1",icon:"🔢"},{unitId:"unit_2",title:"小数除法",description:"学习小数除法的计算方法及应用",moduleCategory:"Arithmetic and Algebra",estimatedDuration:"3周",totalLessons:12,completedLessons:6,progressPercentage:50,status:"in-progress",lastAccessed:"2024-01-15T10:30:00Z",isActive:!0,route:"/math/grade-5/unit/unit_2",icon:"➗"},{unitId:"unit_3",title:"简易方程",description:"学习用字母表示数和解简易方程",moduleCategory:"Arithmetic and Algebra",estimatedDuration:"4周",totalLessons:14,completedLessons:2,progressPercentage:14,status:"in-progress",lastAccessed:"2024-01-12T16:45:00Z",isActive:!1,route:"/math/grade-5/unit/unit_3",icon:"📝"},{unitId:"unit_4",title:"多边形的面积",description:"学习平行四边形、三角形、梯形和组合图形的面积计算",moduleCategory:"Graphics and Geometry",estimatedDuration:"3周",totalLessons:12,completedLessons:0,progressPercentage:0,status:"not-started",isActive:!1,route:"/math/grade-5/unit/unit_4",icon:"📐"},{unitId:"unit_5",title:"因数与倍数",description:"学习因数、倍数、质数、合数等概念",moduleCategory:"Arithmetic and Algebra",estimatedDuration:"3周",totalLessons:10,completedLessons:0,progressPercentage:0,status:"not-started",isActive:!1,route:"/math/grade-5/unit/unit_5",icon:"🔢"},{unitId:"unit_6",title:"长方体和正方体",description:"学习长方体和正方体的特征、表面积和体积计算",moduleCategory:"Graphics and Geometry",estimatedDuration:"4周",totalLessons:14,completedLessons:0,progressPercentage:0,status:"not-started",isActive:!1,route:"/math/grade-5/unit/unit_6",icon:"📦"},{unitId:"unit_7",title:"分数的意义和性质",description:"学习分数的意义、性质和约分、通分等方法",moduleCategory:"Arithmetic and Algebra",estimatedDuration:"4周",totalLessons:16,completedLessons:0,progressPercentage:0,status:"not-started",isActive:!1,route:"/math/grade-5/unit/unit_7",icon:"½"},{unitId:"unit_8",title:"分数的加法和减法",description:"学习同分母分数、异分母分数的加法和减法",moduleCategory:"Arithmetic and Algebra",estimatedDuration:"3周",totalLessons:12,completedLessons:0,progressPercentage:0,status:"not-started",isActive:!1,route:"/math/grade-5/unit/unit_8",icon:"➕"},{unitId:"unit_9",title:"折线统计图",description:"学习单式折线统计图和复式折线统计图的认识和制作",moduleCategory:"Probability and Statistics",estimatedDuration:"2周",totalLessons:6,completedLessons:0,progressPercentage:0,status:"not-started",isActive:!1,route:"/math/grade-5/unit/unit_9",icon:"📊"}]},katex_min=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));exports.AbilityAssessmentDashboard=AbilityAssessmentDashboard,exports.AbilityProgressBar=AbilityProgressBar,exports.Button=Button,exports.ContentAccordion=ContentAccordion,exports.DecimalNumberRecognitionSessionPage=DecimalNumberRecognitionSessionPage,exports.ExplanationScene=ExplanationScene,exports.GEOMETRY_CONFIG=GEOMETRY_CONFIG,exports.GradeUnitBrowserPage=GradeUnitBrowserPage,exports.GradeUnitBrowserProvider=GradeUnitBrowserProvider,exports.GraphContainer=GraphContainer,exports.MOCK_USER_COURSE_PROGRESS=MOCK_USER_COURSE_PROGRESS,exports.MOCK_USER_GRADE_UNITS_NAV=MOCK_USER_GRADE_UNITS_NAV,exports.MOCK_USER_GRADE_UNITS_PROGRESS=MOCK_USER_GRADE_UNITS_PROGRESS,exports.MathCard=MathCard,exports.MathCardV2=MathCardV2,exports.MathGraph=MathGraph,exports.MathPracticeSessionPage=MathPracticeSessionPage,exports.MathSessionContainer=MathSessionContainer,exports.MathSessionPage=MathSessionPage$1,exports.MathWizHeader=MathWizHeader$1,exports.PersonalizedAdvicePanel=PersonalizedAdvicePanel,exports.QuestionScene=QuestionScene,exports.RadarChart=RadarChart,exports.RecommendationCard=RecommendationCard,exports.RememberModule=RememberModule,exports.ReviewModule=ReviewModule,exports.Sidebar=Sidebar,exports.SolveModule=SolveModule,exports.Submenu=Submenu,exports.SuccessScene=SuccessScene,exports.UserProfile=UserProfile,exports.calculateBoundingBox=calculateBoundingBox,exports.calculateGamePoints=calculateGamePoints,exports.categoryIcons=categoryIcons,exports.comparePointArrays=comparePointArrays,exports.courseData=courseData,exports.exploreItems=exploreItems,exports.generateMockUserCourseProgress=generateMockUserCourseProgress,exports.getBasicGemDefinitions=getBasicGemDefinitions,exports.getBasicLineDefinitions=getBasicLineDefinitions,exports.getUnitNavItem=getUnitNavItem,exports.getUserCourseProgress=getUserCourseProgress,exports.getUserGradeUnitsNav=getUserGradeUnitsNav,exports.getUserLessonProgress=getUserLessonProgress,exports.getUserUnitProgress=getUserUnitProgress,exports.isPointInTriangle=isPointInTriangle,exports.pointOnLine=pointOnLine,exports.statusColors=statusColors,exports.statusMapping=statusMapping,exports.toPixelCoordinates=toPixelCoordinates,exports.trianglesMatch=trianglesMatch,exports.updateUnitActiveStatus=updateUnitActiveStatus,exports.updateUserLessonProgress=updateUserLessonProgress,exports.useAnswerCorrectness=useAnswerCorrectness,exports.useAnswerFormVisibility=useAnswerFormVisibility,exports.useCurrentScene=useCurrentScene,exports.useDataAdapter=useDataAdapter,exports.useDecimalAnswerFormVisibility=useDecimalAnswerFormVisibility,exports.useDecimalCurrentScene=useDecimalCurrentScene,exports.useDecimalSessionActions=useDecimalSessionActions,exports.useDecimalUserAnswer=useDecimalUserAnswer,exports.useGeometryManagement=useGeometryManagement,exports.useGradeUnitBrowser=useGradeUnitBrowser,exports.useMathPracticeSessionStore=useMathPracticeSessionStore,exports.useSessionActions=useSessionActions,exports.useSessionCalculations=useSessionCalculations,exports.useSessionEventHandlers=useSessionEventHandlers,exports.useSessionStore=useSessionStore,exports.useUserAnswer=useUserAnswer,exports.userData=userData,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})}));
731
+ `);const C=v.state[l];if(C==null)return;JSON.stringify(n.getState())!==JSON.stringify(C)&&p(C);return}n.dispatchFromDevtools&&typeof n.dispatch=="function"&&n.dispatch(v)});case"DISPATCH":switch(g.payload.type){case"RESET":return p(m),l===void 0?u?.init(n.getState()):u?.init(getTrackedConnectionState(h.name));case"COMMIT":if(l===void 0){u?.init(n.getState());return}return u?.init(getTrackedConnectionState(h.name));case"ROLLBACK":return parseJsonThen(g.state,v=>{if(l===void 0){p(v),u?.init(n.getState());return}p(v[l]),u?.init(getTrackedConnectionState(h.name))});case"JUMP_TO_STATE":case"JUMP_TO_ACTION":return parseJsonThen(g.state,v=>{if(l===void 0){p(v);return}JSON.stringify(n.getState())!==JSON.stringify(v[l])&&p(v[l])});case"IMPORT_STATE":{const{nextLiftedState:v}=g.payload,C=(b=v.computedStates.slice(-1)[0])==null?void 0:b.state;if(!C)return;p(l===void 0?C:C[l]),u?.send(null,v);return}case"PAUSE_RECORDING":return f=!f}return}}),m},devtools=devtoolsImpl,parseJsonThen=(e,t)=>{let r;try{r=JSON.parse(e)}catch(s){console.error("[zustand devtools middleware] Could not parse the received json",s)}r!==void 0&&t(r)},API_BASE_URL="/api/v1/content",MOCK_JWT_TOKEN="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJ1c2VyLTAwMSIsIm5hbWUiOiLlsI_mmI4iLCJsZXZlbCI6NSwiYXZhdGFyIjoiaHR0cHM6Ly9pLnByYXZhdGFyLmNjLzQwP3U9c3R1ZGVudDEiLCJiYWRnZXMiOlsi8J-SoiIsIvCfjZUiLCLwn5KbIl0sImlhdCI6MTY5MTYwMDAwMCwiZXhwIjoxNzIzMTM2MDAwfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",DEFAULT_QUESTION_COUNT=10,INITIAL_SCENE="question",useSessionStore=create()(devtools((e,t)=>({sessionId:null,problems:[],totalProblems:0,currentProblemIndex:0,currentScene:"question",userAnswers:{},submissionResults:{},geometryShapes:{},selectedShapeId:null,geometryMode:"view",loading:!1,error:null,timeSpent:0,startTime:null,sessionComplete:!1,loadQuestions:async(r,s)=>{e({loading:!0,sessionId:r});try{const{gradeLevel:n,unitId:o,lessonId:a,count:l=DEFAULT_QUESTION_COUNT}=s,h=`${API_BASE_URL}/grades/${n}/units/${o}/lessons/${a}/sessions/${r}/questions`,c=await fetch(h,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${MOCK_JWT_TOKEN}`},body:JSON.stringify({count:l})});if(!c.ok)throw new Error(`Failed to load questions: ${c.status} ${c.statusText}`);const d=(await c.json()).questions||[],f={};d.forEach(p=>{p.geometryShapes&&Array.isArray(p.geometryShapes)&&(f[p.problemId]=p.geometryShapes)}),e({problems:d,totalProblems:d.length,currentProblemIndex:0,currentScene:INITIAL_SCENE,geometryShapes:f,loading:!1,error:null,startTime:Date.now()})}catch(n){const o=n instanceof Error?n.message:"Unknown error occurred";throw e({error:o,loading:!1}),n}},goToNextProblem:()=>{const{currentProblemIndex:r,problems:s,currentScene:n}=t();if(n!==INITIAL_SCENE){console.warn("Cannot navigate during review/solve scene");return}r<s.length-1?e({currentProblemIndex:r+1,currentScene:INITIAL_SCENE}):e({sessionComplete:!0})},goToPreviousProblem:()=>{const{currentProblemIndex:r,currentScene:s}=t();s===INITIAL_SCENE&&r>0&&e({currentProblemIndex:r-1,currentScene:INITIAL_SCENE})},goToProblem:r=>{const{problems:s,currentScene:n}=t();n===INITIAL_SCENE&&(r<0||r>=s.length||e({currentProblemIndex:r,currentScene:INITIAL_SCENE}))},switchScene:r=>{e({currentScene:r})},submitAnswer:async(r,s)=>{const{problems:n,currentProblemIndex:o}=t(),a=n[o];e({loading:!0});try{const l=a?.answer.correctAnswer||[],h=s.length>0&&s[0]===l[0],c={userAnswer:s,isCorrect:h,feedback:h?"🎉 Great job! Your answer is correct!":"❌ Sorry, that's not correct."};e(u=>({userAnswers:{...u.userAnswers,[r]:s},submissionResults:{...u.submissionResults,[r]:c},loading:!1,currentScene:h?"review":"solve"}))}catch(l){e({error:l instanceof Error?l.message:"Submission error",loading:!1})}},updateUserAnswer:(r,s)=>{e(n=>({userAnswers:{...n.userAnswers,[r]:s}}))},updateShape:(r,s,n)=>{e(o=>{const l=(o.geometryShapes[r]||[]).map(h=>h.id===s&&h.type==="point"?{...h,position:n}:h);return{geometryShapes:{...o.geometryShapes,[r]:l}}})},selectShape:(r,s)=>{e({selectedShapeId:s})},setGeometryMode:(r,s)=>{e({geometryMode:s})},startTimer:()=>{e({startTime:Date.now()})},stopTimer:()=>{const{startTime:r}=t();if(r){const s=Math.floor((Date.now()-r)/1e3);e(n=>({timeSpent:n.timeSpent+s,startTime:null}))}},reset:()=>{e({sessionId:null,problems:[],totalProblems:0,currentProblemIndex:0,currentScene:INITIAL_SCENE,userAnswers:{},submissionResults:{},geometryShapes:{},selectedShapeId:null,geometryMode:"view",loading:!1,error:null,timeSpent:0,startTime:null,sessionComplete:!1})},getCurrentProblem:()=>{const{problems:r,currentProblemIndex:s}=t();return r[s]||null},getProgress:()=>{const{currentProblemIndex:r,totalProblems:s}=t();return{current:r+1,total:s,percentage:s>0?(r+1)/s*100:0}},getSessionResults:()=>{const{sessionId:r,problems:s,submissionResults:n,timeSpent:o}=t(),a=s.map(h=>({problemId:h.problemId,userAnswer:n[h.problemId]?.userAnswer||[],isCorrect:n[h.problemId]?.isCorrect||!1,timeSpent:0})),l=a.filter(h=>h.isCorrect).length;return{sessionId:r||"",totalProblems:s.length,correctAnswers:l,accuracy:s.length>0?l/s.length:0,timeSpent:o,averageTime:s.length>0?o/s.length:0,answers:a}}}),{name:"MathSessionStore"})),useSessionCalculations=(e,t,r,s,n,o,a)=>{const l=React.useMemo(()=>r==="question",[r]),h=React.useMemo(()=>e<t.length-1,[e,t.length]),c=React.useMemo(()=>e>0,[e]),u=React.useMemo(()=>!s||!n?!1:s.problemType?.includes("geometry")||o&&o[n]&&o[n].length>0?!0:a?.enableMathGraph!==void 0?a.enableMathGraph:!1,[s,n,o,a?.enableMathGraph]);return{canNavigate:l,canGoNext:h,canGoPrevious:c,shouldRenderMathGraph:u}},useGeometryManagement=(e,t,r,s,n)=>{const o=useSessionStore(u=>u.selectShape),a=useSessionStore(u=>u.setGeometryMode),l=React.useMemo(()=>t?s[t]||[]:[],[s,t]);React.useEffect(()=>{if(!t||!r)return;let u="view";switch(e){case"question":u="edit";break;case"solve":case"review":u="view";break;default:u="view"}n!==u&&a(t,u)},[e,t,n,a,r]);const h=React.useCallback(u=>{t&&useSessionStore.setState(d=>({geometryShapes:{...d.geometryShapes,[t]:u}}))},[t]),c=React.useCallback(u=>{if(t){const d=u.length>0?u[0]:null;o(t,d)}},[t,o]);return{currentGeometryShapes:l,geometryMode:n,handleShapeChange:h,handleSelectionChange:c}},useSessionEventHandlers=(e,t,r)=>{const s=useSessionStore(p=>p.updateUserAnswer),n=useSessionStore(p=>p.submitAnswer),o=useSessionStore(p=>p.goToNextProblem),a=useSessionStore(p=>p.goToPreviousProblem),l=useSessionStore(p=>p.goToProblem),h=React.useCallback(p=>{e&&s(e,p)},[e,s]),c=React.useCallback(()=>{e&&r[e]&&n(e,r[e])},[e,r,n]),u=React.useCallback(p=>{o(),p?.(e,t+1)},[o,e,t]),d=React.useCallback(p=>{a(),p?.(e,t-1)},[a,e,t]),f=React.useCallback((p,m)=>{l(p-1),m?.(e,p-1)},[l,e]);return{handleAnswerChange:h,handleSubmit:c,handleNext:u,handlePrevious:d,handlePagination:f}},MathSessionContainer=({config:e={},onSessionComplete:t,onSessionExit:r,onProblemChange:s,className:n="",style:o})=>{const a=useSessionStore(R=>R.problems),l=useSessionStore(R=>R.currentProblemIndex),h=useSessionStore(R=>R.currentScene),c=useSessionStore(R=>R.loading),u=useSessionStore(R=>R.error),d=useSessionStore(R=>R.sessionComplete),f=useSessionStore(R=>R.submissionResults),p=useSessionStore(R=>R.userAnswers),m=useSessionStore(R=>R.geometryShapes),g=useSessionStore(R=>R.geometryMode),b=useSessionStore(R=>R.getSessionResults),v=React.useMemo(()=>a[l]??null,[a,l]),C=React.useMemo(()=>v?.problemId??"",[v]),{canNavigate:x,canGoNext:_,canGoPrevious:y,shouldRenderMathGraph:w}=useSessionCalculations(l,a,h,v,C,m,e),{currentGeometryShapes:E,handleShapeChange:M,handleSelectionChange:G}=useGeometryManagement(h,C,w,m,g),{handleAnswerChange:X,handleSubmit:P,handleNext:$,handlePrevious:k,handlePagination:A}=useSessionEventHandlers(C,l,p);React.useEffect(()=>{if(d&&typeof b=="function"){const R=b();t?.(R)}},[d,b,t]);const B=R=>typeof R=="string"?R:R instanceof Error?R.message:String(R);return c&&a.length===0?jsxRuntimeExports.jsx("div",{className:"flex items-center justify-center p-12","data-testid":"math-session-loading",children:jsxRuntimeExports.jsxs("div",{className:"text-center",children:[jsxRuntimeExports.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600 mx-auto mb-4"}),jsxRuntimeExports.jsx("p",{className:"text-gray-600",children:"Loading questions..."})]})}):u&&u!==null?jsxRuntimeExports.jsx("div",{className:"flex items-center justify-center p-12","data-testid":"math-session-error",children:jsxRuntimeExports.jsxs("div",{className:"text-center text-red-600",children:[jsxRuntimeExports.jsx("p",{className:"text-lg font-semibold mb-2",children:"Error"}),jsxRuntimeExports.jsx("p",{children:B(u)})]})}):v?jsxRuntimeExports.jsxs("div",{className:`flex flex-col max-w-4xl mx-auto p-6 ${n}`,style:o,"data-testid":"math-session-container",role:"region","aria-label":"数学练习会话",children:[jsxRuntimeExports.jsx("div",{className:"mb-6",children:jsxRuntimeExports.jsx(react.Pagination,{total:a.length,page:l+1,onChange:R=>A(R,s),isDisabled:!x,showControls:!1,color:"primary",size:"lg",className:"justify-center"})}),jsxRuntimeExports.jsx(MathCard,{problemData:v,scene:h,submissionResult:f[C],loading:c,error:u?B(u):void 0,value:p[C],onAnswerChange:X,onSubmit:P,onNext:()=>$(s),config:{theme:e.theme??"light",submitButtonText:"提交答案",nextButtonText:h==="solve"?"Got it!":"下一题",showHints:e.enableHints}}),w&&jsxRuntimeExports.jsx("div",{className:"mt-4 w-full max-w-4xl mx-auto","data-testid":"mathgraph-container",children:jsxRuntimeExports.jsx(MathGraph,{shapes:E,mode:g,onShapeChange:M,onSelectionChange:G,showGrid:!0,showAxis:!0,width:800,height:500,boundingBoxOptions:{padding:.5,margin:2,minSize:8}})}),e.showProgress&&jsxRuntimeExports.jsxs("div",{className:"mt-6 flex justify-between items-center",children:[jsxRuntimeExports.jsx("button",{onClick:()=>k(s),disabled:!y,className:"px-4 py-2 text-sm border border-gray-300 rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:"上一题"}),jsxRuntimeExports.jsxs("div",{className:"text-sm text-gray-600",children:[l+1," / ",a.length]}),jsxRuntimeExports.jsx("button",{onClick:()=>$(s),disabled:!_||!x,className:"px-4 py-2 text-sm bg-blue-600 text-white rounded-md hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:"下一题"})]}),r&&jsxRuntimeExports.jsx("div",{className:"mt-4 flex justify-center",children:jsxRuntimeExports.jsx("button",{onClick:r,className:"px-4 py-2 text-sm text-gray-600 hover:text-gray-900 transition-colors",children:"退出练习"})})]}):jsxRuntimeExports.jsx("div",{className:"flex items-center justify-center p-12","data-testid":"math-session-empty",children:jsxRuntimeExports.jsx("p",{className:"text-gray-600",children:"No problems available"})})},MathSessionPage=({sessionId:e,gradeId:t,unitId:r,lessonId:s,userId:n,config:o={},className:a="",onSessionComplete:l,onSessionExit:h})=>{const[c,u]=React.useState({loading:!1,error:null,initialized:!1}),[d,f]=React.useState(0),[p,m]=React.useState(""),g=React.useRef(null),b=React.useRef(null),v=React.useRef(null),C=useSessionStore(M=>M.loadQuestions),x=useSessionStore(M=>M.reset);React.useEffect(()=>{const M=async()=>{try{u(G=>({...G,loading:!0,error:null})),console.log("🎯 MathSessionPage: 开始初始化会话",{sessionId:e,gradeId:t,unitId:r,lessonId:s,userId:n}),await C(e,{gradeLevel:parseInt(t.replace("g",""))||5,unitId:r,lessonId:s,count:o.questionCount||10}),u(G=>({...G,loading:!1,initialized:!0})),console.log("✅ MathSessionPage: 会话初始化完成")}catch(G){const X=G instanceof Error?G.message:"Failed to initialize session";u(P=>({...P,loading:!1,error:X,initialized:!1})),console.error("❌ MathSessionPage: 会话初始化失败",G)}};e&&t&&r&&s&&!c.initialized&&M()},[e,t,r,s,C,o.questionCount,c.initialized,d]),React.useEffect(()=>{c.loading&&!c.initialized?m("正在加载数学练习内容,请稍候..."):c.error?m(`加载失败:${c.error},请点击重试按钮重新加载`):c.initialized&&m("数学练习内容已加载完成,可以开始练习")},[c.loading,c.error,c.initialized]),React.useEffect(()=>{c.initialized&&g.current&&g.current.focus()},[c.initialized]),React.useEffect(()=>{c.error&&v.current&&v.current.focus()},[c.error]),React.useEffect(()=>{c.loading&&b.current&&b.current.focus()},[c.loading]),React.useEffect(()=>()=>{console.log("🧹 MathSessionPage: 清理会话状态"),x()},[x]);const _=React.useCallback(M=>{console.log("🎉 MathSessionPage: 会话完成",M),l?.(M)},[l]),y=React.useCallback(()=>{console.log("🚪 MathSessionPage: 退出会话"),h?.()},[h]),w=React.useCallback((M,G)=>{console.log(`📝 MathSessionPage: 切换到题目 ${G+1}`,M)},[]),E=React.useCallback(M=>{M.key==="Escape"&&(M.preventDefault(),y()),M.key==="Enter"&&c.error&&M.target===v.current&&(M.preventDefault(),u({loading:!1,error:null,initialized:!1}),f(G=>G+1))},[y,c.error]);return c.loading&&!c.initialized?jsxRuntimeExports.jsxs("div",{className:`math-session-page loading ${a}`,"data-testid":"math-session-page",role:"main","aria-label":"数学练习页面",onKeyDown:E,tabIndex:-1,ref:b,children:[jsxRuntimeExports.jsx("div",{"aria-live":"assertive","aria-atomic":"true",className:"sr-only",children:p}),jsxRuntimeExports.jsx("div",{className:"page-loading-container",children:jsxRuntimeExports.jsxs("div",{className:"loading-spinner","data-testid":"page-loading-spinner",role:"status","aria-label":"正在加载练习内容",children:[jsxRuntimeExports.jsx("div",{className:"spinner","aria-hidden":"true"}),jsxRuntimeExports.jsx("p",{className:"loading-text",children:"正在加载练习内容..."})]})})]}):c.error?jsxRuntimeExports.jsxs("div",{className:`math-session-page error ${a}`,"data-testid":"math-session-page",role:"main","aria-label":"数学练习页面 - 错误状态",onKeyDown:E,tabIndex:-1,ref:v,children:[jsxRuntimeExports.jsx("div",{"aria-live":"assertive","aria-atomic":"true",className:"sr-only",children:p}),jsxRuntimeExports.jsxs("div",{className:"error-container",children:[jsxRuntimeExports.jsx("div",{className:"error-icon",role:"img","aria-label":"警告图标",children:"⚠️"}),jsxRuntimeExports.jsx("h3",{className:"error-title",children:"加载失败"}),jsxRuntimeExports.jsx("p",{className:"error-message",children:c.error}),jsxRuntimeExports.jsx("button",{onClick:()=>{u({loading:!1,error:null,initialized:!1}),f(M=>M+1)},className:"retry-button","data-testid":"retry-button","aria-label":"重新加载练习内容",children:"重试"})]})]}):jsxRuntimeExports.jsxs("div",{className:`math-session-page ${a}`,"data-testid":"math-session-page",role:"main","aria-label":"数学练习页面",onKeyDown:E,children:[jsxRuntimeExports.jsx("div",{"aria-live":"polite","aria-atomic":"true",className:"sr-only",children:p}),o.layout?.showHeader&&jsxRuntimeExports.jsx("header",{className:"page-header",role:"banner",children:jsxRuntimeExports.jsxs("div",{className:"header-content",children:[jsxRuntimeExports.jsx("h1",{className:"page-title",children:"数学练习"}),jsxRuntimeExports.jsxs("div",{className:"session-info","aria-label":"会话信息",children:[jsxRuntimeExports.jsxs("span",{className:"session-id",children:["会话: ",e]}),jsxRuntimeExports.jsxs("span",{className:"grade-info",children:["年级: ",t]})]})]})}),jsxRuntimeExports.jsx("main",{className:"page-main",ref:g,tabIndex:-1,"aria-label":"数学练习主要内容区域",children:jsxRuntimeExports.jsx(MathSessionContainer,{config:{showProgress:o.showProgress??!0,enableHints:o.enableHints??!1,autoAdvance:o.autoAdvance??!1,theme:o.theme??"light"},onSessionComplete:_,onSessionExit:y,onProblemChange:w})}),o.layout?.showFooter&&jsxRuntimeExports.jsx("footer",{className:"page-footer",role:"contentinfo",children:jsxRuntimeExports.jsx("div",{className:"footer-content",children:jsxRuntimeExports.jsx("p",{className:"footer-text",children:"© 2024 MathWiz - 小学数学益智教育平台"})})})]})},MathSessionPage$1=React.memo(MathSessionPage),MathCardV2Context=React.createContext(void 0),useDataAdapter=(e,t)=>React.useMemo(()=>{const r=e.scenes?.[t];return{...e,content:r?.content||e.content,layout:r?.layout||e.layout,renderer:r?.renderer||e.renderer}},[e,t]),CardLayout=({children:e,padding:t="16px",shadow:r=!0,border:s=!0,theme:n="light",className:o=""})=>{const a=n==="dark"?"theme-dark":"theme-light",l=r?"shadow-card":"",h=s?"border border-gray-200":"";return jsxRuntimeExports.jsx("div",{className:`mathcard-v2-card ${a} ${l} ${h} ${o}`,style:{padding:t},"data-testid":"mathcard-v2-container",children:e})},GridLayout=({children:e,columns:t,gap:r="16px",responsive:s=!0,className:n=""})=>{const o={display:"grid",gridTemplateColumns:`repeat(${t}, 1fr)`,gap:r},a=s?"mathcard-v2-grid-responsive":"";return jsxRuntimeExports.jsx("div",{style:o,className:`mathcard-v2-grid ${a} ${n}`,"data-testid":"grid-layout",children:e})},FlowLayout=({children:e,direction:t="vertical",gap:r="8px",wrap:s=!1,className:n=""})=>{const o={display:t==="horizontal"?"flex":"block",gap:r,flexWrap:s?"wrap":"nowrap"};return t==="horizontal"&&(o.flexDirection="row"),jsxRuntimeExports.jsx("div",{style:o,className:`mathcard-v2-flow ${n}`,"data-testid":"flow-layout",children:e})},TextContent=({content:e,style:t={},onInteraction:r,className:s=""})=>jsxRuntimeExports.jsx("div",{className:`mathcard-v2-text ${s}`,style:t,onClick:()=>r?.({type:"click",content:e}),"data-testid":"text-content",children:e}),FormulaContent=({parts:e,children:t,displayMode:r=!1,style:s={},className:n=""})=>jsxRuntimeExports.jsx("div",{className:`mathcard-v2-formula ${n}`,style:s,"data-testid":"equation-render",children:jsxRuntimeExports.jsx(EquationRender,{parts:e,children:t,displayMode:r})}),GraphContent=({shapes:e,width:t,height:r,showGrid:s=!0,showAxis:n=!0,onShapeChange:o,className:a=""})=>{const l=React.useRef(null),[h,c]=React.useState({width:600,height:400});React.useEffect(()=>{const d=()=>{if(l.current){const{clientWidth:p,clientHeight:m}=l.current;p>0&&m>0&&c({width:p,height:m})}};d(),window.addEventListener("resize",d);const f=new ResizeObserver(d);return l.current&&f.observe(l.current),()=>{window.removeEventListener("resize",d),f.disconnect()}},[]);const u={width:t?typeof t=="string"?t:`${t}px`:"100%",height:r?typeof r=="string"?r:`${r}px`:"100%"};return jsxRuntimeExports.jsx("div",{ref:l,className:`mathcard-v2-graph ${a}`,style:u,children:jsxRuntimeExports.jsx(MathGraph,{shapes:e,width:h.width,height:h.height,showGrid:s,showAxis:n,onShapeChange:o,mode:"view","data-testid":"mathgraph"})})},isIterable=e=>Symbol.iterator in e,hasIterableEntries=e=>"entries"in e,compareEntries=(e,t)=>{const r=e instanceof Map?e:new Map(e.entries()),s=t instanceof Map?t:new Map(t.entries());if(r.size!==s.size)return!1;for(const[n,o]of r)if(!s.has(n)||!Object.is(o,s.get(n)))return!1;return!0},compareIterables=(e,t)=>{const r=e[Symbol.iterator](),s=t[Symbol.iterator]();let n=r.next(),o=s.next();for(;!n.done&&!o.done;){if(!Object.is(n.value,o.value))return!1;n=r.next(),o=s.next()}return!!n.done&&!!o.done};function shallow(e,t){return Object.is(e,t)?!0:typeof e!="object"||e===null||typeof t!="object"||t===null||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t)?!1:isIterable(e)&&isIterable(t)?hasIterableEntries(e)&&hasIterableEntries(t)?compareEntries(e,t):compareIterables(e,t):compareEntries({entries:()=>Object.entries(e)},{entries:()=>Object.entries(t)})}function useShallow(e){const t=React.useRef(void 0);return r=>{const s=e(r);return shallow(t.current,s)?t.current:t.current=s}}const useHundredChartStore=create((e,t)=>({internalValue:0,isDragging:!1,dragState:{isDragging:!1,startIndex:-1,currentIndex:-1,direction:null},setInternalValue:r=>{e({internalValue:Math.max(0,Math.min(1,r))})},startDrag:r=>{e({isDragging:!0,dragState:{isDragging:!0,startIndex:r,currentIndex:r,direction:null}})},updateDrag:r=>{const{dragState:s}=t();let n=null;if(s.startIndex!==-1&&r!==-1){const o=Math.floor(s.startIndex/10),a=s.startIndex%10,l=Math.floor(r/10),h=r%10;l===o?n=h>a?"ltr":"rtl":h===a&&(n=l>o?"ttb":"btt")}e({dragState:{...s,currentIndex:r,direction:n}})},endDrag:()=>{e({isDragging:!1,dragState:{isDragging:!1,startIndex:-1,currentIndex:-1,direction:null}})},resetDrag:()=>{e({isDragging:!1,dragState:{isDragging:!1,startIndex:-1,currentIndex:-1,direction:null}})}})),useHundredChartValue=()=>useHundredChartStore(useShallow(e=>({internalValue:e.internalValue,setInternalValue:e.setInternalValue}))),useHundredChartDrag=()=>useHundredChartStore(useShallow(e=>({isDragging:e.isDragging,dragState:e.dragState,startDrag:e.startDrag,updateDrag:e.updateDrag,endDrag:e.endDrag,resetDrag:e.resetDrag}))),calculateFilledCells=e=>{const{totalCells:t,fillRatio:r,direction:s,rows:n,cols:o}=e,a=Math.round(t*r),l=[];if(s==="ltr")for(let h=0;h<a;h++)l.push(h);else for(let h=0;h<n;h++)for(let c=0;c<o;c++){const u=h*o+c;l.length<a&&l.push(u)}return{filledCells:l,filledCount:a,actualRatio:a/t}},generateCellData=(e,t,r,s)=>{const n=[];for(let o=0;o<e;o++)for(let a=0;a<t;a++){const l=o*t+a;n.push({index:l,row:o,col:a,filled:s.includes(l),x:a*r,y:o*r})}return n},calculateDragRange=(e,t,r,s,n)=>{if(e===-1||t===-1||!r)return[];const o=Math.floor(e/n),a=e%n,l=Math.floor(t/n),h=t%n,c=[];switch(r){case"ltr":for(let u=a;u<=h;u++)c.push(o*n+u);break;case"rtl":for(let u=a;u>=h;u--)c.push(o*n+u);break;case"ttb":for(let u=o;u<=l;u++)c.push(u*n+a);break;case"btt":for(let u=o;u>=l;u--)c.push(u*n+a);break}return c},calculateValueFromDrag=(e,t)=>Math.max(0,Math.min(1,e.length/t)),validateValue=e=>Math.max(0,Math.min(1,e)),HundredChart=({value:e,defaultValue:t=0,mode:r="readonly",onChange:s,rows:n=10,cols:o=10,cellSize:a=12,fillColor:l="#3b82f6",baseColor:h="#f3f4f6",strokeColor:c="#d1d5db",shadingDirection:u="ltr",hasShadow:d=!0,className:f=""})=>{const{internalValue:p,setInternalValue:m}=useHundredChartValue(),{isDragging:g,dragState:b,startDrag:v,updateDrag:C,endDrag:x}=useHundredChartDrag(),_=e!==void 0,y=_?validateValue(e):p,[w,E]=React.useState(!1);!w&&!_&&(m(validateValue(t)),E(!0));const M=React.useMemo(()=>{const z={totalCells:n*o,fillRatio:y,direction:u,rows:n,cols:o};return calculateFilledCells(z).filledCells},[y,n,o,u]),G=React.useMemo(()=>generateCellData(n,o,a,M),[n,o,a,M]),X=React.useMemo(()=>!g||b.startIndex===-1||b.currentIndex===-1?[]:calculateDragRange(b.startIndex,b.currentIndex,b.direction,n,o),[g,b,n,o]),P=React.useCallback(I=>{if(r!=="edit")return;const z=validateValue((I+1)/(n*o));_||m(z),s?.(z)},[r,n,o,_,s,m]),$=React.useCallback(I=>{r==="edit"&&v(I)},[r,v]),k=React.useCallback(I=>{r!=="edit"||!g||C(I)},[r,g,C]),A=React.useCallback(()=>{if(!(r!=="edit"||!g)){if(X.length>0){const I=calculateValueFromDrag(X,n*o);_||m(I),s?.(I)}x()}},[r,g,X,n,o,_,s,m,x]),B=o*a,R=n*a,U=["hundred-chart-container",`hundred-chart--${r}`,d&&"hundred-chart--has-shadow",f].filter(Boolean).join(" "),V=Math.round(y*100);return jsxRuntimeExports.jsx("div",{className:U,"data-testid":"hundred-chart-container",children:jsxRuntimeExports.jsx("svg",{width:B,height:R,className:"hundred-chart-svg","data-testid":"hundred-chart-svg",role:"img","aria-label":`百格图 - ${V}% 已填充`,children:G.map(I=>{const z=M.includes(I.index),L=X.includes(I.index),O=z||L;return jsxRuntimeExports.jsx("rect",{x:I.x,y:I.y,width:a,height:a,fill:O?l:h,stroke:c,strokeWidth:1,className:"hundred-chart-cell","data-testid":"hundred-chart-cell","data-filled":z,"data-drag":L,"aria-label":`第${I.row+1}行第${I.col+1}列,${O?"已填充":"未填充"}`,tabIndex:r==="edit"?0:-1,onClick:()=>P(I.index),onMouseDown:()=>$(I.index),onMouseEnter:()=>k(I.index),onMouseUp:A,onKeyDown:J=>{r==="edit"&&J.key==="Enter"&&P(I.index)}},I.index)})})})},PlaceValueChart=({headers:e,values:t,colors:r={}})=>{const{headerBg:s="#f1f5f9",valueBg:n="#ffffff",borderColor:o="#e2e8f0"}=r;return e.length!==t.length?(console.warn("PlaceValueChart: headers and values length mismatch"),null):jsxRuntimeExports.jsxs("div",{className:"place-value-chart",style:{display:"inline-block",border:`1px solid ${o}`,borderRadius:"8px",overflow:"hidden",fontFamily:"system-ui, sans-serif",fontSize:"14px",lineHeight:"1.4"},children:[jsxRuntimeExports.jsx("div",{style:{display:"flex",borderBottom:`1px solid ${o}`},children:e.map((a,l)=>jsxRuntimeExports.jsx("div",{style:{flex:1,padding:"8px 12px",backgroundColor:s,fontWeight:"600",textAlign:"center",borderRight:l<e.length-1?`1px solid ${o}`:"none",color:"#1e293b"},children:a},l))}),jsxRuntimeExports.jsx("div",{style:{display:"flex"},children:t.map((a,l)=>jsxRuntimeExports.jsx("div",{style:{flex:1,padding:"12px",backgroundColor:n,textAlign:"center",borderRight:l<t.length-1?`1px solid ${o}`:"none",color:"#0f172a",fontSize:"16px",fontWeight:"500"},children:a},l))})]})},ContentRenderer=({content:e,onInteraction:t})=>{const r=(s,n)=>{const o=`${s.type}-${n}`,a=l=>{t?.(o,l)};switch(s.type){case"text":return jsxRuntimeExports.jsx(TextContent,{content:s.content,style:s.style,onInteraction:a},o);case"formula":const l=s;return jsxRuntimeExports.jsx(FormulaContent,{parts:l.parts||[],displayMode:l.displayMode,style:s.style},o);case"graph":const h=s;return jsxRuntimeExports.jsx(GraphContent,{shapes:h.shapes||[],width:h.width,height:h.height,showGrid:h.showGrid,showAxis:h.showAxis},o);case"hundredGrid":const c=s;return jsxRuntimeExports.jsx(HundredChart,{...c.props},o);case"placeValueChart":const u=s;return jsxRuntimeExports.jsx(PlaceValueChart,{...u.props},o);default:return jsxRuntimeExports.jsx("div",{onClick:()=>a({type:"click"}),children:s.content},o)}};return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:e.map(r)})},MathCardV2=({data:e,scene:t="question",layout:r={type:"card"},renderer:s={mode:"default"},theme:n="light",onContentInteraction:o,className:a="",children:l})=>{const h=useDataAdapter(e,t),c={data:h,scene:t,layout:h.layout||r,renderer:h.renderer||s,theme:n,onContentInteraction:o},u=h.layout||r,d=(()=>{switch(u.type){case"grid":return GridLayout;case"flow":return FlowLayout;case"card":default:return CardLayout}})(),f=(()=>{const p={className:a,theme:n,"data-testid":"mathcard-v2-container"};switch(u.type){case"grid":return{...p,columns:u.columns||2,gap:u.gap||"16px",responsive:u.responsive!==!1};case"flow":return{...p,direction:u.direction||"vertical",gap:u.gap||"16px",wrap:u.wrap!==!1};case"card":default:return{...p,padding:u.padding||"24px",shadow:u.shadow!==!1,border:u.border!==!1}}})();return jsxRuntimeExports.jsx(MathCardV2Context.Provider,{value:c,children:jsxRuntimeExports.jsx(d,{...f,children:l||jsxRuntimeExports.jsx(ContentRenderer,{content:h.content,layout:h.layout||r,onInteraction:o})})})};MathCardV2.CardLayout=CardLayout,MathCardV2.GridLayout=GridLayout,MathCardV2.FlowLayout=FlowLayout,MathCardV2.TextContent=TextContent,MathCardV2.FormulaContent=FormulaContent,MathCardV2.GraphContent=GraphContent,MathCardV2.ContentRenderer=ContentRenderer;const validateAnswer=(e,t,r=.1)=>{if(!e.trim())return{isValid:!1,isCorrect:!1,errorMessage:"请输入答案"};const s=parseFloat(e);if(isNaN(s))return{isValid:!1,isCorrect:!1,errorMessage:"请输入有效的数字"};if(s<0)return{isValid:!1,isCorrect:!1,errorMessage:"答案不能为负数"};const o=Math.abs(s-t)<=r;return{isValid:!0,isCorrect:o,errorMessage:o?void 0:"答案不正确,请再试一次"}},useMathPracticeSessionStore=create(e=>({currentScene:"question",userAnswer:"",isCorrect:null,showAnswerForm:!0,problemData:null,validationError:null,setProblemData:t=>{e({problemData:t,currentScene:"question",userAnswer:"",isCorrect:null,showAnswerForm:!0,validationError:null})},updateUserAnswer:t=>{e({userAnswer:t,validationError:null})},submitAnswer:t=>{const r=useMathPracticeSessionStore.getState();if(!r.problemData){e({validationError:"问题数据未加载,请刷新页面重试"});return}const s=r.problemData.answer.value,n=validateAnswer(t,s);if(!n.isValid){e({userAnswer:t,validationError:n.errorMessage||"答案格式错误"});return}e({userAnswer:t,isCorrect:n.isCorrect,showAnswerForm:!1,validationError:null,currentScene:n.isCorrect?"success":"explanation"})},nextQuestion:()=>{e({currentScene:"question",userAnswer:"",isCorrect:null,showAnswerForm:!0,validationError:null})},resetSession:()=>{e({currentScene:"question",userAnswer:"",isCorrect:null,showAnswerForm:!0,validationError:null})}})),useCurrentScene=()=>useMathPracticeSessionStore(e=>e.currentScene),useUserAnswer=()=>useMathPracticeSessionStore(e=>e.userAnswer),useAnswerCorrectness=()=>useMathPracticeSessionStore(e=>e.isCorrect),useAnswerFormVisibility=()=>useMathPracticeSessionStore(e=>e.showAnswerForm),useValidationError=()=>useMathPracticeSessionStore(e=>e.validationError),useProblemData=()=>useMathPracticeSessionStore(e=>e.problemData),useSessionActions=()=>useMathPracticeSessionStore(useShallow(e=>({updateUserAnswer:e.updateUserAnswer,submitAnswer:e.submitAnswer,nextQuestion:e.nextQuestion,resetSession:e.resetSession,setProblemData:e.setProblemData}))),ReviewModule=({problemData:e,userAnswer:t})=>jsxRuntimeExports.jsxs("div",{className:"border-l-8 border-yellow-400 pl-6",children:[jsxRuntimeExports.jsx("h4",{className:"text-sm font-bold text-yellow-600 uppercase mb-4",children:"复习"}),jsxRuntimeExports.jsxs("div",{className:"text-slate-700",children:[jsxRuntimeExports.jsx("p",{className:"text-xl mb-4",children:e.basicInfo.question}),jsxRuntimeExports.jsx("div",{className:"my-6",children:jsxRuntimeExports.jsx(MathCardV2,{data:{id:"review-problem",grade:e.grade,unit:e.unit,content:e.scenes.question.content},scene:"question",layout:{type:"card"}})}),jsxRuntimeExports.jsxs("p",{className:"mt-4",children:["你的答案: ",jsxRuntimeExports.jsx("span",{className:"font-bold p-1 bg-red-100 rounded",children:t})]})]})]}),RememberModule=({problemData:e})=>{const t=e.scenes?.review?.content||[];return t.length===0?jsxRuntimeExports.jsxs("div",{className:"border-l-8 border-blue-400 pl-6",children:[jsxRuntimeExports.jsx("h4",{className:"text-sm font-bold text-blue-600 uppercase mb-4",children:"记忆"}),jsxRuntimeExports.jsx("div",{className:"text-slate-700 bg-slate-50 p-4 rounded-md",children:jsxRuntimeExports.jsx("p",{className:"text-slate-500",children:"暂无记忆内容"})})]}):jsxRuntimeExports.jsxs("div",{className:"border-l-8 border-blue-400 pl-6",children:[jsxRuntimeExports.jsx("h4",{className:"text-sm font-bold text-blue-600 uppercase mb-4",children:"记忆"}),jsxRuntimeExports.jsx("div",{className:"text-slate-700 bg-slate-50 p-4 rounded-md",children:t.map((r,s)=>{const{type:n,content:o,style:a,parts:l}=r;switch(n){case"text":return jsxRuntimeExports.jsx("p",{className:"mb-2",style:a,children:o},s);case"formula":return jsxRuntimeExports.jsx("div",{className:"mb-4",children:jsxRuntimeExports.jsx(MathCardV2,{data:{id:`formula-${s}`,grade:e.grade,unit:e.unit,content:[{type:"formula",content:o,parts:l||[o]}]},layout:{type:"card"}})},s);default:return jsxRuntimeExports.jsxs("p",{className:"text-slate-500",children:["不支持的内容类型: ",n]},s)}})})]})},ExplanationStep=({step:e,problemData:t,stepNumber:r})=>{const{title:s,description:n,chartConfig:o}=e.content,a=!!o,l=[{type:"text",content:n.replace(/<br>/g,`
732
+ `).replace(/<[^>]*>/g,""),style:{fontSize:"1rem",color:"#374151",lineHeight:"1.6"}}];return jsxRuntimeExports.jsxs("div",{className:"mb-8 last:mb-0",children:[jsxRuntimeExports.jsxs("div",{className:"flex items-center mb-4",children:[jsxRuntimeExports.jsx("div",{className:"w-8 h-8 bg-orange-500 text-white rounded-full flex items-center justify-center text-sm font-bold mr-3",children:r}),jsxRuntimeExports.jsx("h5",{className:"text-lg font-semibold text-slate-800",children:s})]}),jsxRuntimeExports.jsxs("div",{className:"space-y-4",children:[jsxRuntimeExports.jsx(MathCardV2,{data:{id:`${e.id}-description`,grade:t.grade,unit:t.unit,content:l},layout:{type:"card",padding:"16px"},className:"bg-slate-50 border border-slate-200"}),a&&jsxRuntimeExports.jsxs("div",{className:"p-4 bg-white rounded-lg border border-slate-200 shadow-sm",children:[jsxRuntimeExports.jsx("h6",{className:"text-sm font-medium text-slate-700 mb-3",children:"图形解释"}),jsxRuntimeExports.jsx(MathGraph,{shapes:o.shapes,width:400,height:300,boundingBox:o.boundingBox,showGrid:o.showGrid||!1,showAxis:o.showAxis||!1,mode:"view",className:"mx-auto"})]})]})]})},SolveModule=({problemData:e})=>{const t=e.explanation&&e.explanation.length>0;return jsxRuntimeExports.jsxs("div",{className:"border-l-8 border-orange-400 pl-6",children:[jsxRuntimeExports.jsx("h4",{className:"text-sm font-bold text-orange-600 uppercase mb-4",children:"解题"}),jsxRuntimeExports.jsxs("div",{className:"text-slate-700 space-y-6",children:[jsxRuntimeExports.jsx(MathCardV2,{data:{id:"solve-steps",grade:e.grade,unit:e.unit,content:e.scenes.solve.content},scene:"solve",layout:{type:"flow",direction:"vertical",gap:"16px"}}),t&&jsxRuntimeExports.jsxs("div",{className:"mt-6",children:[jsxRuntimeExports.jsx("h5",{className:"text-lg font-semibold text-slate-800 mb-4",children:"详细解题步骤"}),jsxRuntimeExports.jsx("div",{className:"space-y-6",children:e.explanation.map((r,s)=>jsxRuntimeExports.jsx(ExplanationStep,{step:r,problemData:e,stepNumber:s+1},r.id))})]})]})]})},QuestionScene=({problemData:e,userAnswer:t,showAnswerForm:r,onAnswerSubmit:s,onAnswerChange:n,validationError:o})=>{const a=h=>{h.preventDefault(),s(t)},l=h=>{n(h)};return jsxRuntimeExports.jsxs("div",{className:"p-6 md:p-8",children:[jsxRuntimeExports.jsx(MathCardV2,{data:{id:e.id,grade:e.grade,unit:e.unit,content:e.scenes.question.content},scene:"question",layout:{type:"card"},className:"mb-6"}),r&&jsxRuntimeExports.jsx("div",{className:"mt-8",children:jsxRuntimeExports.jsxs("form",{onSubmit:a,className:"flex items-center gap-4",children:[jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-2",children:[jsxRuntimeExports.jsx("input",{type:"number",value:t,onChange:h=>l(h.target.value),className:`border-2 rounded-md p-2 text-lg w-24 focus:ring-2 focus:ring-blue-500 focus:border-blue-500 ${o?"border-red-500":"border-slate-300"}`,placeholder:"答案",required:!0}),o&&jsxRuntimeExports.jsx("div",{className:"text-red-500 text-sm font-medium",children:o})]}),jsxRuntimeExports.jsx("span",{className:"text-lg text-slate-700",children:e.basicInfo.answerUnit||e.basicInfo.areaUnit}),jsxRuntimeExports.jsx("button",{type:"submit",className:"ml-auto bg-green-600 text-white font-bold py-2 px-6 rounded-md hover:bg-green-700 transition-colors",children:"提交"})]})})]})},ExplanationScene=({problemData:e,userAnswer:t,onNextQuestion:r})=>jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsxs("div",{className:"p-6 bg-red-50 border-b border-red-200 flex items-center",children:[jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("h3",{className:"text-xl font-bold text-red-800",children:"抱歉,答案不正确..."}),jsxRuntimeExports.jsxs("p",{className:"text-slate-600 mt-1",children:["正确答案是: ",jsxRuntimeExports.jsx("span",{className:"font-bold",children:e.answer.value})]})]}),jsxRuntimeExports.jsx("button",{onClick:r,className:"ml-auto bg-green-600 text-white font-bold py-2 px-6 rounded-md hover:bg-green-700 transition-colors",children:"明白了"})]}),jsxRuntimeExports.jsxs("div",{className:"p-6 md:p-8 space-y-8",children:[jsxRuntimeExports.jsx(ReviewModule,{problemData:e,userAnswer:t}),jsxRuntimeExports.jsx(RememberModule,{problemData:e}),jsxRuntimeExports.jsx(SolveModule,{problemData:e})]}),jsxRuntimeExports.jsx("div",{className:"p-6 text-right border-t border-slate-200",children:jsxRuntimeExports.jsx("button",{onClick:r,className:"bg-green-600 text-white font-bold py-2 px-6 rounded-md hover:bg-green-700 transition-colors",children:"明白了"})})]}),SuccessScene=({problemData:e,onNextQuestion:t})=>jsxRuntimeExports.jsxs("div",{className:"p-8 bg-green-50 text-center",children:[jsxRuntimeExports.jsx("h3",{className:"text-2xl font-bold text-green-800",children:"正确!"}),jsxRuntimeExports.jsx("p",{className:"text-lg text-slate-600 mt-2",children:"你做得很好!"}),jsxRuntimeExports.jsx("div",{className:"mt-6 max-w-md mx-auto",children:jsxRuntimeExports.jsx(MathCardV2,{data:{id:"review-concepts",grade:e.grade,unit:e.unit,content:e.scenes.review.content},scene:"review",layout:{type:"card"}})}),jsxRuntimeExports.jsx("button",{onClick:t,className:"mt-6 bg-green-600 text-white font-bold py-2 px-6 rounded-md hover:bg-green-700 transition-colors",children:"下一题"})]}),id="rectangle-area-003",title="矩形面积计算问题",grade=5,unit="几何与测量",description="计算矩形的面积,理解面积公式 A = l × w 的应用",basicInfo={shape:"rectangle",length:7,width:5,lengthUnit:"码",widthUnit:"码",areaUnit:"平方码",question:"这个矩形的面积是多少?"},content=[{type:"text",content:"What is the area of this rectangle?"}],scenes={question:{content:[{type:"text",content:"What is the area of this rectangle?",style:{fontSize:"1.5rem",color:"#1e293b"}},{type:"graph",content:"矩形图形",shapes:[{id:"pointA",type:"point",position:{x:1,y:1},name:"A",size:4,strokeColor:"#3B82F6"},{id:"pointB",type:"point",position:{x:8,y:1},name:"B",size:4,strokeColor:"#3B82F6"},{id:"pointC",type:"point",position:{x:8,y:6},name:"C",size:4,strokeColor:"#3B82F6"},{id:"pointD",type:"point",position:{x:1,y:6},name:"D",size:4,strokeColor:"#3B82F6"},{id:"rectangle",type:"polygon",vertices:[{$ref:"pointA"},{$ref:"pointB"},{$ref:"pointC"},{$ref:"pointD"}],strokeColor:"#0ea5e9",fillColor:"#7dd3fc",fillOpacity:.3,strokeWidth:2,name:"矩形"},{id:"lengthLabel",type:"text",position:{x:4.5,y:0},content:"7 yd",color:"#475569",fontSize:16},{id:"widthLabel",type:"text",position:{x:9,y:3.5},content:"5 yd",color:"#475569",fontSize:16}],width:400,height:300,boundingBox:[0,8,10,0],showGrid:!1,showAxis:!1}]},solve:{content:[{type:"text",content:"解题步骤:",style:{fontSize:"1.25rem",fontWeight:"bold",color:"#1e293b"}},{type:"text",content:"1. 观察矩形:长度是 7 码,宽度是 5 码",style:{marginTop:"8px"}},{type:"formula",content:"A = l × w",parts:["A = l \\times w"]},{type:"formula",content:"= 7 × 5",parts:["= 7 \\times 5"]},{type:"formula",content:"= 35",parts:["= 35"]},{type:"text",content:"长度和宽度以码为单位,所以面积以平方码为单位",style:{marginTop:"8px"}},{type:"text",content:"最终答案:矩形的面积是 35 平方码",style:{marginTop:"8px",fontWeight:"bold"}}]},review:{content:[{type:"text",content:"核心概念回顾:",style:{fontSize:"1.25rem",fontWeight:"bold",color:"#1e293b"}},{type:"text",content:"矩形面积公式:A = l × w",style:{marginTop:"8px"}},{type:"text",content:"其中 l 是长度,w 是宽度",style:{color:"#64748b"}}]}},explanation=[{id:"exp-step-1",type:"instructionalStep",content:{title:"步骤1:识别矩形的尺寸",description:"观察图形,确定矩形的长度和宽度,并理解尺寸的单位。",chartConfig:{type:"graph",shapes:[{id:"pointA",type:"point",position:{x:1,y:1},name:"A",size:4,strokeColor:"#3B82F6"},{id:"pointB",type:"point",position:{x:8,y:1},name:"B",size:4,strokeColor:"#3B82F6"},{id:"pointC",type:"point",position:{x:8,y:6},name:"C",size:4,strokeColor:"#3B82F6"},{id:"pointD",type:"point",position:{x:1,y:6},name:"D",size:4,strokeColor:"#3B82F6"},{id:"rectangle",type:"polygon",vertices:[{$ref:"pointA"},{$ref:"pointB"},{$ref:"pointC"},{$ref:"pointD"}],strokeColor:"#0ea5e9",fillColor:"#7dd3fc",fillOpacity:.3,strokeWidth:2},{id:"lengthLabel",type:"text",position:{x:4.5,y:0},content:"长度:7 码",color:"#475569",fontSize:14},{id:"widthLabel",type:"text",position:{x:9,y:3.5},content:"宽度:5 码",color:"#475569",fontSize:14}],boundingBox:[0,8,10,0],showGrid:!1,showAxis:!1}}},{id:"exp-step-2",type:"instructionalStep",content:{title:"步骤2:回忆矩形面积公式",description:"复习矩形面积的基本公式:面积 = 长度 × 宽度。",chartConfig:{type:"graph",shapes:[{id:"pointA",type:"point",position:{x:1,y:1},name:"A",size:4,strokeColor:"#3B82F6"},{id:"pointB",type:"point",position:{x:8,y:1},name:"B",size:4,strokeColor:"#3B82F6"},{id:"pointC",type:"point",position:{x:8,y:6},name:"C",size:4,strokeColor:"#3B82F6"},{id:"pointD",type:"point",position:{x:1,y:6},name:"D",size:4,strokeColor:"#3B82F6"},{id:"rectangle",type:"polygon",vertices:[{$ref:"pointA"},{$ref:"pointB"},{$ref:"pointC"},{$ref:"pointD"}],strokeColor:"#0ea5e9",fillColor:"#7dd3fc",fillOpacity:.3,strokeWidth:2},{id:"formulaLabel",type:"text",position:{x:5,y:7},content:"面积公式:A = l × w",color:"#10B981",fontSize:16,fontWeight:"bold"}],boundingBox:[0,8,10,0],showGrid:!1,showAxis:!1}}},{id:"exp-step-3",type:"instructionalStep",content:{title:"步骤3:代入数值计算",description:"将已知的长度和宽度代入公式进行计算。",chartConfig:{type:"graph",shapes:[{id:"pointA",type:"point",position:{x:1,y:1},name:"A",size:4,strokeColor:"#3B82F6"},{id:"pointB",type:"point",position:{x:8,y:1},name:"B",size:4,strokeColor:"#3B82F6"},{id:"pointC",type:"point",position:{x:8,y:6},name:"C",size:4,strokeColor:"#3B82F6"},{id:"pointD",type:"point",position:{x:1,y:6},name:"D",size:4,strokeColor:"#3B82F6"},{id:"rectangle",type:"polygon",vertices:[{$ref:"pointA"},{$ref:"pointB"},{$ref:"pointC"},{$ref:"pointD"}],strokeColor:"#0ea5e9",fillColor:"#7dd3fc",fillOpacity:.3,strokeWidth:2},{id:"calculationLabel",type:"text",position:{x:5,y:7},content:"A = 7 × 5 = 35",color:"#F59E0B",fontSize:16,fontWeight:"bold"}],boundingBox:[0,8,10,0],showGrid:!1,showAxis:!1}}},{id:"exp-step-4",type:"instructionalStep",content:{title:"步骤4:确定面积单位",description:"根据长度和宽度的单位确定面积的单位。",chartConfig:{type:"graph",shapes:[{id:"pointA",type:"point",position:{x:1,y:1},name:"A",size:4,strokeColor:"#3B82F6"},{id:"pointB",type:"point",position:{x:8,y:1},name:"B",size:4,strokeColor:"#3B82F6"},{id:"pointC",type:"point",position:{x:8,y:6},name:"C",size:4,strokeColor:"#3B82F6"},{id:"pointD",type:"point",position:{x:1,y:6},name:"D",size:4,strokeColor:"#3B82F6"},{id:"rectangle",type:"polygon",vertices:[{$ref:"pointA"},{$ref:"pointB"},{$ref:"pointC"},{$ref:"pointD"}],strokeColor:"#0ea5e9",fillColor:"#7dd3fc",fillOpacity:.3,strokeWidth:2},{id:"unitLabel",type:"text",position:{x:5,y:7},content:"长度:码,宽度:码 → 面积:平方码",color:"#8B5CF6",fontSize:14},{id:"finalAnswer",type:"text",position:{x:5,y:7.5},content:"最终答案:35 平方码",color:"#10B981",fontSize:16,fontWeight:"bold"}],boundingBox:[0,8,10,0],showGrid:!1,showAxis:!1}}}],answer={value:35,unit:"平方码",explanation:"矩形的面积是 35 平方码。计算方法:长度 7 码 × 宽度 5 码 = 35 平方码。"},layout={type:"card",padding:"20px"},areaProblemData={id,title,grade,unit,description,basicInfo,content,scenes,explanation,answer,layout},MathPracticeSessionPage=({className:e=""})=>{const t=useCurrentScene(),r=useUserAnswer(),s=useAnswerFormVisibility(),{updateUserAnswer:n,submitAnswer:o,nextQuestion:a}=useSessionActions(),l=React.useMemo(()=>areaProblemData,[]);return jsxRuntimeExports.jsxs("div",{className:`max-w-4xl mx-auto p-4 md:p-8 bg-slate-50 min-h-screen ${e}`,children:[jsxRuntimeExports.jsxs("header",{className:"mb-8",children:[jsxRuntimeExports.jsx("h1",{className:"text-2xl font-bold text-slate-800",children:"数学练习"}),jsxRuntimeExports.jsxs("p",{className:"text-slate-600 mt-2",children:[l.grade,"年级 - ",l.unit]})]}),jsxRuntimeExports.jsxs("main",{className:"bg-white border border-slate-200 rounded-lg shadow-sm",children:[t==="question"&&jsxRuntimeExports.jsx(QuestionScene,{problemData:l,userAnswer:r,showAnswerForm:s,onAnswerSubmit:o,onAnswerChange:n}),t==="explanation"&&jsxRuntimeExports.jsx(ExplanationScene,{problemData:l,userAnswer:r,onNextQuestion:a}),t==="success"&&jsxRuntimeExports.jsx(SuccessScene,{problemData:l,onNextQuestion:a})]})]})},useDecimalNumberRecognitionSessionStore=create(e=>({currentScene:"question",userAnswer:"",isCorrect:null,showAnswerForm:!0,problemData:null,validationError:null,setProblemData:t=>{e({problemData:t,currentScene:"question",userAnswer:"",isCorrect:null,showAnswerForm:!0,validationError:null})},updateUserAnswer:t=>{e({userAnswer:t,validationError:null})},submitAnswer:t=>{const r=useDecimalNumberRecognitionSessionStore.getState();if(!r.problemData){e({validationError:"问题数据未加载,请刷新页面重试"});return}const s=r.problemData.answer.value.toString(),n=t.trim(),o=s.trim();let a=!1;(n===o||n===".12"&&o==="0.12"||n==="0,12"&&o==="0.12")&&(a=!0),e({userAnswer:t,isCorrect:a,showAnswerForm:!1,validationError:null,currentScene:a?"success":"explanation"})},nextQuestion:()=>{e({currentScene:"question",userAnswer:"",isCorrect:null,showAnswerForm:!0,validationError:null})},resetSession:()=>{e({currentScene:"question",userAnswer:"",isCorrect:null,showAnswerForm:!0,validationError:null})}})),useDecimalCurrentScene=()=>useDecimalNumberRecognitionSessionStore(e=>e.currentScene),useDecimalUserAnswer=()=>useDecimalNumberRecognitionSessionStore(e=>e.userAnswer),useDecimalAnswerFormVisibility=()=>useDecimalNumberRecognitionSessionStore(e=>e.showAnswerForm),useDecimalSessionActions=()=>useDecimalNumberRecognitionSessionStore(useShallow(e=>({updateUserAnswer:e.updateUserAnswer,submitAnswer:e.submitAnswer,nextQuestion:e.nextQuestion,resetSession:e.resetSession,setProblemData:e.setProblemData}))),DecimalNumberExplanationScene=({problemData:e,userAnswer:t,onNextQuestion:r})=>jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsxs("div",{className:"p-6 bg-red-50 border-b border-red-200 flex items-center",children:[jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("h3",{className:"text-xl font-bold text-red-800",children:"抱歉,答案不正确..."}),jsxRuntimeExports.jsxs("p",{className:"text-slate-600 mt-1",children:["正确答案是: ",jsxRuntimeExports.jsx("span",{className:"font-bold",children:e.answer.value})]})]}),jsxRuntimeExports.jsx("button",{onClick:r,className:"ml-auto bg-green-600 text-white font-bold py-2 px-6 rounded-md hover:bg-green-700 transition-colors",children:"明白了"})]}),jsxRuntimeExports.jsxs("div",{className:"p-6 md:p-8 space-y-8",children:[jsxRuntimeExports.jsx(ReviewModule,{problemData:e,userAnswer:t}),jsxRuntimeExports.jsx(SolveModule,{problemData:e})]}),jsxRuntimeExports.jsx("div",{className:"p-6 text-right border-t border-slate-200",children:jsxRuntimeExports.jsx("button",{onClick:r,className:"bg-green-600 text-white font-bold py-2 px-6 rounded-md hover:bg-green-700 transition-colors",children:"明白了"})})]}),decimalNumberRecognitionData={id:"decimal-grid-problem-001",title:"百格图识别小数",grade:4,unit:"小数的认识",description:"通过百格图模型理解百分位和小数的关系。",basicInfo:{question:"What decimal number does the model represent?",answerUnit:""},scenes:{question:{content:[{type:"text",content:"What decimal number does the model represent?",style:{fontSize:"1.5rem",color:"#1e293b",fontWeight:"bold"}},{type:"text",content:"The large square represents 1 whole.",style:{fontSize:"1rem",color:"#475569",marginTop:"4px"}},{type:"hundredGrid",content:"",props:{value:.12,mode:"readonly",rows:10,cols:10,cellSize:12,fillColor:"#a5b4fc",baseColor:"#e2e8f0",strokeColor:"#d1d5db",shadingDirection:"ltr",hasShadow:!0}}]},solve:{content:[{type:"text",content:"解题步骤:",style:{fontSize:"1.25rem",fontWeight:"bold",color:"#1e293b"}},{type:"text",content:'1. 在模型中, 100个小方格中有12个被涂色。这代表 12/100 或者"一百分之十二"。'},{type:"text",content:'2. 你可以使用数位表将"一百分之十二"写作小数。'},{type:"placeValueChart",content:"",props:{headers:["ones (个位)","tenths (十分位)","hundredths (百分位)"],values:["0","1","2"],colors:{headerBg:"#f1f5f9",valueBg:"#ffffff",borderColor:"#e2e8f0"}}},{type:"text",content:"所以, 这个模型代表的小数是 <strong>0.12</strong>。",style:{marginTop:"1rem"}}]},review:{content:[{type:"text",content:"回顾问题:",style:{fontSize:"1.25rem",fontWeight:"bold",color:"#1e293b"}},{type:"text",content:`What decimal number does the model represent?
733
+ The large square represents 1 whole.`},{type:"hundredGrid",content:"",props:{value:.12,mode:"readonly",rows:10,cols:10,cellSize:12,fillColor:"#a5b4fc",baseColor:"#e2e8f0",strokeColor:"#d1d5db",shadingDirection:"ltr",hasShadow:!0}}]}},explanation:[],answer:{value:.12,unit:"",explanation:"模型中100个方格有12个被涂色,代表12/100,即0.12。"}},DecimalNumberRecognitionSessionPage=({className:e=""})=>{const t=useDecimalCurrentScene(),r=useDecimalUserAnswer(),s=useDecimalAnswerFormVisibility(),{updateUserAnswer:n,submitAnswer:o,nextQuestion:a}=useDecimalSessionActions(),l=React.useMemo(()=>decimalNumberRecognitionData,[]);return jsxRuntimeExports.jsxs("div",{className:`max-w-4xl mx-auto p-4 md:p-8 bg-slate-50 min-h-screen ${e}`,children:[jsxRuntimeExports.jsxs("header",{className:"mb-8",children:[jsxRuntimeExports.jsx("h1",{className:"text-2xl font-bold text-slate-800",children:"小数认识练习"}),jsxRuntimeExports.jsxs("p",{className:"text-slate-600 mt-2",children:[l.grade,"年级 - ",l.unit]}),jsxRuntimeExports.jsx("p",{className:"text-slate-500 text-sm mt-1",children:"通过百格图模型理解百分位和小数的关系"})]}),jsxRuntimeExports.jsxs("main",{className:"bg-white border border-slate-200 rounded-lg shadow-sm",children:[t==="question"&&jsxRuntimeExports.jsx(QuestionScene,{problemData:l,userAnswer:r,showAnswerForm:s,onAnswerSubmit:o,onAnswerChange:n}),t==="explanation"&&jsxRuntimeExports.jsx(DecimalNumberExplanationScene,{problemData:l,userAnswer:r,onNextQuestion:a}),t==="success"&&jsxRuntimeExports.jsx(SuccessScene,{problemData:l,onNextQuestion:a})]}),jsxRuntimeExports.jsxs("div",{className:"mt-4 text-center text-sm text-slate-500",children:[t==="question"&&"请识别百格图代表的小数",t==="explanation"&&"查看详细解释",t==="success"&&"恭喜!答案正确"]})]})},pointOnLine=(e,t,r)=>({x:e.x+(t.x-e.x)*r,y:e.y+(t.y-e.y)*r}),calculateGamePoints=()=>{const e={x:.5,y:.1,name:"A"},t={x:.1,y:.75,name:"B"},r={x:.9,y:.75,name:"C"},s={...pointOnLine(e,t,1/3),name:"D"},n={...pointOnLine(e,r,1/3),name:"E"},o={...pointOnLine(e,t,2/3),name:"M"},a={...pointOnLine(e,r,2/3),name:"N"},l={...pointOnLine(t,r,1/3),name:"P"},h={...pointOnLine(t,r,2/3),name:"Q"},c={...pointOnLine(s,n,1/3),name:"U"},u={...pointOnLine(s,n,2/3),name:"S"},d={...pointOnLine(o,a,1/3),name:"K"},f={...pointOnLine(o,a,2/3),name:"L"};return{A:e,B:t,C:r,D:s,E:n,M:o,N:a,P:l,Q:h,U:c,S:u,K:d,L:f}},toPixelCoordinates=(e,t,r)=>{const s={};for(const[n,o]of Object.entries(e))s[n]={...o,x:o.x*t,y:o.y*r};return s},isPointInTriangle=(e,t)=>{const[r,s,n]=t,{x:o,y:a}=e,l=(s.y-n.y)*(r.x-n.x)+(n.x-s.x)*(r.y-n.y);if(Math.abs(l)<1e-4)return!1;const h=((s.y-n.y)*(o-n.x)+(n.x-s.x)*(a-n.y))/l,c=((n.y-r.y)*(o-n.x)+(r.x-n.x)*(a-n.y))/l,u=1-h-c;return h>=-.001&&c>=-.001&&u>=-.001},trianglesMatch=(e,t)=>{if(!e||!t||e.length!==3||t.length!==3)return!1;const r=e.map(n=>n.name).sort(),s=t.map(n=>n.name).sort();return r.every((n,o)=>n===s[o])},comparePointArrays=(e,t)=>{if(!e||!t||e.length!==t.length)return!1;const r=e.map(n=>n.name).sort(),s=t.map(n=>n.name).sort();return r.join("")===s.join("")},getBasicLineDefinitions=()=>[{from:"A",to:"B"},{from:"A",to:"C"},{from:"B",to:"C"},{from:"D",to:"E"},{from:"M",to:"N"},{from:"P",to:"Q"},{from:"A",to:"D"},{from:"A",to:"E"},{from:"A",to:"M"},{from:"A",to:"N"},{from:"A",to:"P"},{from:"A",to:"Q"},{from:"D",to:"U"},{from:"U",to:"S"},{from:"S",to:"E"},{from:"M",to:"K"},{from:"K",to:"L"},{from:"L",to:"N"},{from:"B",to:"P"},{from:"P",to:"Q"},{from:"Q",to:"C"}],getBasicGemDefinitions=()=>[{id:"gem_1",vertices:["A","B","P"],points:10,category:"basic"},{id:"gem_2",vertices:["A","P","Q"],points:10,category:"basic"},{id:"gem_3",vertices:["A","Q","C"],points:10,category:"basic"},{id:"gem_4",vertices:["A","B","Q"],points:15,category:"medium"},{id:"gem_5",vertices:["A","P","C"],points:15,category:"medium"},{id:"gem_6",vertices:["A","B","C"],points:20,category:"large"},{id:"gem_7",vertices:["A","D","U"],points:12,category:"ade_small"},{id:"gem_8",vertices:["A","U","S"],points:12,category:"ade_small"},{id:"gem_9",vertices:["A","S","E"],points:12,category:"ade_small"},{id:"gem_10",vertices:["A","D","S"],points:18,category:"ade_medium"},{id:"gem_11",vertices:["A","U","E"],points:18,category:"ade_medium"},{id:"gem_12",vertices:["A","D","E"],points:25,category:"ade_large"},{id:"gem_13",vertices:["A","M","K"],points:14,category:"amn_small"},{id:"gem_14",vertices:["A","K","L"],points:14,category:"amn_small"},{id:"gem_15",vertices:["A","L","N"],points:14,category:"amn_small"},{id:"gem_16",vertices:["A","M","L"],points:20,category:"amn_medium"},{id:"gem_17",vertices:["A","K","N"],points:20,category:"amn_medium"},{id:"gem_18",vertices:["A","M","N"],points:30,category:"amn_large"}],GEOMETRY_CONFIG={TOTAL_GEMS:18,CANVAS_RATIO:4/3,DEFAULT_VIEWBOX:{width:700,height:600},POINT_RADIUS:{default:6,selected:9},TOLERANCE:.001,MIN_TRIANGLE_AREA:.001,COORDINATE_PRECISION:1e-4,BARYCENTRIC_TOLERANCE:-.001},generateMockUserCourseProgress=(e=MOCK_USER_DATA.id)=>{const t=courseData.units.map((n,o)=>{const a=Math.min(100,Math.max(0,o*15+Math.random()*20)),l=Math.floor(n.lessons.length*a/100),h=n.lessons.map((c,u)=>{const d=Math.min(100,Math.max(0,a-u*10+Math.random()*30));return{lessonId:c.id,status:d>=100?"completed":d>0?"in-progress":"not-started",progressPercentage:Math.round(d),lastAccessed:d>0?new Date(Date.now()-Math.random()*7*24*60*60*1e3).toISOString():void 0,timeSpent:d>0?Math.floor(Math.random()*120+10):void 0,score:d>=100?Math.floor(Math.random()*21+80):void 0,attempts:d>0?Math.floor(Math.random()*3+1):void 0}});return{unitId:n.id,userId:e,totalLessons:n.lessons.length,completedLessons:l,progressPercentage:Math.round(a),status:a>=100?"completed":a>0?"in-progress":"not-started",lastAccessed:a>0?new Date(Date.now()-Math.random()*14*24*60*60*1e3).toISOString():void 0,lessons:h}}),r=t.reduce((n,o)=>n+o.progressPercentage,0)/t.length,s=t.filter(n=>n.status==="completed").length;return{courseId:courseData.id,userId:e,totalUnits:t.length,completedUnits:s,progressPercentage:Math.round(r),status:r>=100?"completed":r>0?"in-progress":"not-started",lastAccessed:new Date(Date.now()-Math.random()*3*24*60*60*1e3).toISOString(),units:t}},MOCK_USER_COURSE_PROGRESS=generateMockUserCourseProgress(),getUserCourseProgress=(e,t)=>e===MOCK_USER_DATA.id&&t===courseData.id?MOCK_USER_COURSE_PROGRESS:null,getUserUnitProgress=(e,t,r)=>{const s=getUserCourseProgress(e,t);return s&&s.units.find(n=>n.unitId===r)||null},getUserLessonProgress=(e,t,r,s)=>{const n=getUserUnitProgress(e,t,r);return n&&n.lessons.find(o=>o.lessonId===s)||null},updateUserLessonProgress=(e,t,r,s,n)=>(console.log("Updating lesson progress:",{userId:e,courseId:t,unitId:r,lessonId:s,progress:n}),!0),getUserGradeUnitsNav=(e,t)=>{const r=getUserCourseProgress(e,t);if(!r)return null;const s=courseData.units.map((n,o)=>{const a=r.units.find(l=>l.unitId===n.id);return{unitId:n.id,title:n.title,description:n.description,moduleCategory:n.moduleCategory,estimatedDuration:n.estimatedDuration,totalLessons:n.lessons.length,completedLessons:a?.completedLessons||0,progressPercentage:a?.progressPercentage||0,status:a?.status||"not-started",lastAccessed:a?.lastAccessed,isActive:o===0,route:`/math/grade-${courseData.level}/unit/${n.id}`}});return{userId:e,courseId:courseData.id,courseTitle:courseData.title,courseLevel:courseData.level,totalUnits:s.length,completedUnits:s.filter(n=>n.status==="completed").length,overallProgress:r.progressPercentage,status:r.status,lastAccessed:r.lastAccessed,units:s}},getUnitNavItem=(e,t,r)=>{const s=getUserGradeUnitsNav(e,t);return s&&s.units.find(n=>n.unitId===r)||null},updateUnitActiveStatus=(e,t,r,s)=>(console.log("Updating unit active status:",{userId:e,courseId:t,unitId:r,isActive:s}),!0),MOCK_USER_GRADE_UNITS_NAV=getUserGradeUnitsNav(MOCK_USER_DATA.id,courseData.id),MOCK_USER_GRADE_UNITS_PROGRESS={userId:MOCK_USER_DATA.id,courseId:courseData.id,courseTitle:courseData.title,courseLevel:courseData.level,totalUnits:courseData.units.length,completedUnits:3,overallProgress:45,status:"in-progress",lastAccessed:"2024-01-15T10:30:00Z",units:[{unitId:"unit_1",title:"小数乘法",description:"学习小数乘法的计算方法及应用",moduleCategory:"Arithmetic and Algebra",estimatedDuration:"3周",totalLessons:10,completedLessons:8,progressPercentage:80,status:"completed",lastAccessed:"2024-01-10T14:20:00Z",isActive:!1,route:"/math/grade-5/unit/unit_1",icon:"🔢"},{unitId:"unit_2",title:"小数除法",description:"学习小数除法的计算方法及应用",moduleCategory:"Arithmetic and Algebra",estimatedDuration:"3周",totalLessons:12,completedLessons:6,progressPercentage:50,status:"in-progress",lastAccessed:"2024-01-15T10:30:00Z",isActive:!0,route:"/math/grade-5/unit/unit_2",icon:"➗"},{unitId:"unit_3",title:"简易方程",description:"学习用字母表示数和解简易方程",moduleCategory:"Arithmetic and Algebra",estimatedDuration:"4周",totalLessons:14,completedLessons:2,progressPercentage:14,status:"in-progress",lastAccessed:"2024-01-12T16:45:00Z",isActive:!1,route:"/math/grade-5/unit/unit_3",icon:"📝"},{unitId:"unit_4",title:"多边形的面积",description:"学习平行四边形、三角形、梯形和组合图形的面积计算",moduleCategory:"Graphics and Geometry",estimatedDuration:"3周",totalLessons:12,completedLessons:0,progressPercentage:0,status:"not-started",isActive:!1,route:"/math/grade-5/unit/unit_4",icon:"📐"},{unitId:"unit_5",title:"因数与倍数",description:"学习因数、倍数、质数、合数等概念",moduleCategory:"Arithmetic and Algebra",estimatedDuration:"3周",totalLessons:10,completedLessons:0,progressPercentage:0,status:"not-started",isActive:!1,route:"/math/grade-5/unit/unit_5",icon:"🔢"},{unitId:"unit_6",title:"长方体和正方体",description:"学习长方体和正方体的特征、表面积和体积计算",moduleCategory:"Graphics and Geometry",estimatedDuration:"4周",totalLessons:14,completedLessons:0,progressPercentage:0,status:"not-started",isActive:!1,route:"/math/grade-5/unit/unit_6",icon:"📦"},{unitId:"unit_7",title:"分数的意义和性质",description:"学习分数的意义、性质和约分、通分等方法",moduleCategory:"Arithmetic and Algebra",estimatedDuration:"4周",totalLessons:16,completedLessons:0,progressPercentage:0,status:"not-started",isActive:!1,route:"/math/grade-5/unit/unit_7",icon:"½"},{unitId:"unit_8",title:"分数的加法和减法",description:"学习同分母分数、异分母分数的加法和减法",moduleCategory:"Arithmetic and Algebra",estimatedDuration:"3周",totalLessons:12,completedLessons:0,progressPercentage:0,status:"not-started",isActive:!1,route:"/math/grade-5/unit/unit_8",icon:"➕"},{unitId:"unit_9",title:"折线统计图",description:"学习单式折线统计图和复式折线统计图的认识和制作",moduleCategory:"Probability and Statistics",estimatedDuration:"2周",totalLessons:6,completedLessons:0,progressPercentage:0,status:"not-started",isActive:!1,route:"/math/grade-5/unit/unit_9",icon:"📊"}]},katex_min=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));exports.AbilityAssessmentDashboard=AbilityAssessmentDashboard,exports.AbilityProgressBar=AbilityProgressBar,exports.Button=Button,exports.ContentAccordion=ContentAccordion,exports.DecimalNumberRecognitionSessionPage=DecimalNumberRecognitionSessionPage,exports.ExplanationScene=ExplanationScene,exports.GEOMETRY_CONFIG=GEOMETRY_CONFIG,exports.GradeUnitBrowserPage=GradeUnitBrowserPage,exports.GradeUnitBrowserProvider=GradeUnitBrowserProvider,exports.GraphContainer=GraphContainer,exports.MOCK_USER_COURSE_PROGRESS=MOCK_USER_COURSE_PROGRESS,exports.MOCK_USER_GRADE_UNITS_NAV=MOCK_USER_GRADE_UNITS_NAV,exports.MOCK_USER_GRADE_UNITS_PROGRESS=MOCK_USER_GRADE_UNITS_PROGRESS,exports.MathCard=MathCard,exports.MathCardV2=MathCardV2,exports.MathGraph=MathGraph,exports.MathPracticeSessionPage=MathPracticeSessionPage,exports.MathSessionContainer=MathSessionContainer,exports.MathSessionPage=MathSessionPage$1,exports.MathWizHeader=MathWizHeader$1,exports.PersonalizedAdvicePanel=PersonalizedAdvicePanel,exports.QuestionScene=QuestionScene,exports.RadarChart=RadarChart,exports.RecommendationCard=RecommendationCard,exports.RememberModule=RememberModule,exports.ReviewModule=ReviewModule,exports.Sidebar=Sidebar,exports.SolveModule=SolveModule,exports.Submenu=Submenu,exports.SuccessScene=SuccessScene,exports.UserProfile=UserProfile,exports.calculateBoundingBox=calculateBoundingBox,exports.calculateGamePoints=calculateGamePoints,exports.categoryIcons=categoryIcons,exports.comparePointArrays=comparePointArrays,exports.courseData=courseData,exports.exploreItems=exploreItems,exports.generateMockUserCourseProgress=generateMockUserCourseProgress,exports.getBasicGemDefinitions=getBasicGemDefinitions,exports.getBasicLineDefinitions=getBasicLineDefinitions,exports.getUnitNavItem=getUnitNavItem,exports.getUserCourseProgress=getUserCourseProgress,exports.getUserGradeUnitsNav=getUserGradeUnitsNav,exports.getUserLessonProgress=getUserLessonProgress,exports.getUserUnitProgress=getUserUnitProgress,exports.isPointInTriangle=isPointInTriangle,exports.pointOnLine=pointOnLine,exports.statusColors=statusColors,exports.statusMapping=statusMapping,exports.toPixelCoordinates=toPixelCoordinates,exports.trianglesMatch=trianglesMatch,exports.updateUnitActiveStatus=updateUnitActiveStatus,exports.updateUserLessonProgress=updateUserLessonProgress,exports.useAnswerCorrectness=useAnswerCorrectness,exports.useAnswerFormVisibility=useAnswerFormVisibility,exports.useCurrentScene=useCurrentScene,exports.useDataAdapter=useDataAdapter,exports.useDecimalAnswerFormVisibility=useDecimalAnswerFormVisibility,exports.useDecimalCurrentScene=useDecimalCurrentScene,exports.useDecimalSessionActions=useDecimalSessionActions,exports.useDecimalUserAnswer=useDecimalUserAnswer,exports.useGeometryManagement=useGeometryManagement,exports.useGradeUnitBrowser=useGradeUnitBrowser,exports.useMathPracticeSessionStore=useMathPracticeSessionStore,exports.useProblemData=useProblemData,exports.useSessionActions=useSessionActions,exports.useSessionCalculations=useSessionCalculations,exports.useSessionEventHandlers=useSessionEventHandlers,exports.useSessionStore=useSessionStore,exports.useUserAnswer=useUserAnswer,exports.useValidationError=useValidationError,exports.userData=userData,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})}));
734
734
  //# sourceMappingURL=index.cjs.map