openlearn-next 0.2.2 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/dist/assets/AdminDirectoryView-Cai0cQqi.js +1 -0
  2. package/dist/assets/BatchPickerModal-CKQyeY6R.js +1 -0
  3. package/dist/assets/ClassesView-Cxgfcrx1.js +19 -0
  4. package/dist/assets/CloudDriveModal-DgDurUBT.js +1 -0
  5. package/dist/assets/ComputerLabView-CUCO2VIV.js +1 -0
  6. package/dist/assets/CourseManagement-DSCOjuIC.js +1 -0
  7. package/dist/assets/CourseWizardModal-B3QnFxvj.js +3 -0
  8. package/dist/assets/CoursewareHubPanel-CAaf22Qm.js +1 -0
  9. package/dist/assets/Dashboard-BnF7YAQi.js +8 -0
  10. package/dist/assets/ExportWeightModal-BlS2auLs.js +1 -0
  11. package/dist/assets/HelpTour-ZgEkRnin.js +1 -0
  12. package/dist/assets/HelpView-BP581QYZ.js +204 -0
  13. package/dist/assets/ImportLessonsModal-BZZRDBRU.js +1 -0
  14. package/dist/assets/ImportModal-mkWuDoAN.js +1 -0
  15. package/dist/assets/InteractiveCoursewareViewer-EIRNulEo.js +1 -0
  16. package/dist/assets/InteractiveWhiteboard-D360IHbP.js +102 -0
  17. package/dist/assets/LazyCourseware-qE4CY67E.js +1 -0
  18. package/dist/assets/LazyWhiteboard-B5JmqHZ5.js +2 -0
  19. package/dist/assets/LessonEditorView-C0czhtmf.js +1 -0
  20. package/dist/assets/LiveClassroomView-CrTY3jhP.js +1 -0
  21. package/dist/assets/NotificationDetailModal-dndFrE7p.js +1 -0
  22. package/dist/assets/PluginView-QS2b6nSF.js +65 -0
  23. package/dist/assets/ProcessLogsModal-8mVp07ic.js +1 -0
  24. package/dist/assets/QuizGeneratorModal-DpTFYbVJ.js +1 -0
  25. package/dist/assets/StudentAssignmentView-YxVJ5wkl.js +1 -0
  26. package/dist/assets/StudentLessonView-D1gYdLM1.js +1 -0
  27. package/dist/assets/StudentPreviewModal-CG8bgUeI.js +1 -0
  28. package/dist/assets/StudentView-CmSL3cDw.js +1 -0
  29. package/dist/assets/SystemResourceLibraryModal-Dnh7F5Vm.js +1 -0
  30. package/dist/assets/TeacherView-BqXb0izg.js +2 -0
  31. package/dist/assets/TimetableView-zce3okQn.js +6 -0
  32. package/dist/assets/index-BrEBeWAQ.js +14 -0
  33. package/dist/assets/index-BxA9vp--.js +129 -0
  34. package/dist/assets/index-CATki2cp.css +1 -0
  35. package/dist/assets/index-Cq_aKTfc.js +1 -0
  36. package/dist/assets/{index.es-D071ILbD.js → index.es-DZ6UeYE-.js} +2 -2
  37. package/dist/assets/vendor-charts-B7ViBL9w.js +71 -0
  38. package/dist/assets/vendor-icons-BvCtGbt1.js +8221 -0
  39. package/dist/assets/vendor-konva-CzxOmTv9.js +49 -0
  40. package/dist/assets/vendor-motion-Dz5URUo4.js +9 -0
  41. package/dist/assets/vendor-pdf-CVyNPGVr.js +191 -0
  42. package/dist/assets/{vendor-pptx-CJ3I-KT0.js → vendor-pptx-B0hlo0eh.js} +1 -1
  43. package/dist/assets/vendor-react-0Lg0vA-4.js +49 -0
  44. package/dist/assets/vendor-utils-4FcTwKPj.js +1 -0
  45. package/dist/index.html +2 -3
  46. package/dist/server.cjs +164 -46
  47. package/package.json +1 -1
  48. package/dist/assets/courseware-CL7gjXZj.js +0 -1
  49. package/dist/assets/index-4xDvXGZ_.js +0 -682
  50. package/dist/assets/index-CaJDJGky.css +0 -1
  51. package/dist/assets/vendor-html2canvas-B0tyYwQk.js +0 -22
  52. package/dist/assets/vendor-konva-GivUq6dt.js +0 -89
  53. package/dist/assets/whiteboard-Dp8tFXTO.js +0 -8343
  54. /package/dist/assets/{purify.es-V6uLfjnH.js → vendor-content-V6uLfjnH.js} +0 -0
@@ -0,0 +1 @@
1
+ import{j as e}from"./vendor-react-0Lg0vA-4.js";import{L as k}from"./LazyWhiteboard-B5JmqHZ5.js";import{L as C}from"./LazyCourseware-qE4CY67E.js";import{m as z}from"./vendor-motion-Dz5URUo4.js";import{J as L,X as P,p as S,a7 as g,a8 as f,Z as $,a9 as E,h as T}from"./vendor-icons-BvCtGbt1.js";import{M as F}from"./index-BrEBeWAQ.js";import"./vendor-pdf-CVyNPGVr.js";function B(p){const{isLessonPreviewVisible:b,setIsLessonPreviewVisible:u,lessons:o,selectedLesson:t,previewFullscreenPanel:r,setPreviewFullscreenPanel:d,previewLessonTab:a,setPreviewLessonTab:c,activeRole:y,elements:w,activeSegmentId:j,setActiveSegmentId:v,fetchElements:i,currentVfsParent:N,setCurrentVfsParent:x,vfsNodes:l,previewSelectedCourseware:m,setPreviewSelectedCourseware:h}=p;return e.jsx(e.Fragment,{children:b&&e.jsx("div",{className:"fixed inset-0 bg-gray-900/60 backdrop-blur-sm flex items-center justify-center p-4 md:p-6 z-[60] overflow-hidden text-gray-850",children:e.jsxs(z.div,{initial:{opacity:0,scale:.96},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.96},className:"bg-white border text-gray-900 border-gray-200 rounded-2xl shadow-2xl w-full max-w-7xl h-[90vh] flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"p-4 border-b border-gray-100 flex items-center justify-between bg-indigo-50/70 shrink-0 select-none",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"bg-indigo-600 text-white p-2 rounded-lg shadow-sm",children:e.jsx(L,{size:18})}),e.jsxs("div",{children:[e.jsx("h2",{className:"font-bold text-gray-900 text-base flex items-center gap-2",children:"学生视角预览 (Student Perspective Preview)"}),e.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:["正在预览课程: ",e.jsx("span",{className:"font-semibold text-gray-700",children:o.find(s=>s.id===t)?.title})," • 演示同步与交互"]})]})]}),e.jsxs("button",{onClick:()=>u(!1),className:"px-3.5 py-1.5 bg-gray-100 hover:bg-gray-200 text-gray-600 hover:text-gray-800 text-xs font-semibold rounded-lg shadow-sm transition-all cursor-pointer flex items-center gap-1 border border-gray-200",children:[e.jsx(P,{size:14})," 退出预览"]})]}),e.jsxs("div",{className:"flex-1 flex min-h-0 bg-slate-50/50 p-4 gap-4",children:[e.jsxs("div",{className:`${r==="left"?"w-full":"w-1/3"} bg-white border border-gray-200 rounded-xl p-4 flex flex-col min-h-0 shadow-sm ${r==="right"?"hidden":""} transition-all duration-300`,children:[e.jsxs("div",{className:"text-xs font-bold uppercase tracking-wider text-gray-400 mb-3 border-b border-gray-100 pb-2 flex items-center justify-between shrink-0 select-none",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(S,{size:14,className:"text-indigo-500"})," Lesson Content (课程内容)"]}),e.jsx("button",{onClick:()=>d(s=>s==="left"?"none":"left"),className:"p-1 hover:bg-gray-100 text-gray-400 hover:text-gray-700 rounded transition-colors cursor-pointer flex items-center gap-1",title:r==="left"?"退出全屏":"全屏",children:r==="left"?e.jsxs(e.Fragment,{children:[e.jsx(g,{size:13}),e.jsx("span",{className:"text-[10px] font-medium",children:"退出全屏"})]}):e.jsxs(e.Fragment,{children:[e.jsx(f,{size:13}),e.jsx("span",{className:"text-[10px] font-medium",children:"全屏"})]})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto prose prose-sm prose-indigo max-w-none text-gray-700 pr-1",children:e.jsx(F,{children:o.find(s=>s.id===t)?.content||""})})]}),e.jsxs("div",{className:`${r==="right"?"w-full flex-grow":"flex-1"} bg-white border border-gray-200 rounded-xl p-4 flex flex-col min-h-0 shadow-sm ${r==="left"?"hidden":""} transition-all duration-300`,children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-gray-100 pb-3 mb-3 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("button",{onClick:()=>c("whiteboard"),className:`px-3 py-1.5 text-xs font-semibold rounded-lg transition-all cursor-pointer ${a==="whiteboard"?"bg-indigo-600 text-white shadow-sm":"text-gray-500 hover:bg-gray-100"}`,children:"Interactive Whiteboard"}),e.jsx("button",{onClick:()=>c("courseware"),className:`px-3 py-1.5 text-xs font-semibold rounded-lg transition-all cursor-pointer ${a==="courseware"?"bg-indigo-600 text-white shadow-sm":"text-gray-500 hover:bg-gray-100"}`,children:"Cloud Apps Viewer"})]}),e.jsx("button",{onClick:()=>d(s=>s==="right"?"none":"right"),className:"p-1 hover:bg-gray-100 text-gray-400 hover:text-gray-700 rounded transition-colors cursor-pointer flex items-center gap-1",title:r==="right"?"退出全屏":"全屏",children:r==="right"?e.jsxs(e.Fragment,{children:[e.jsx(g,{size:13}),e.jsx("span",{className:"text-[10px] font-medium",children:"退出全屏"})]}):e.jsxs(e.Fragment,{children:[e.jsx(f,{size:13}),e.jsx("span",{className:"text-[10px] font-medium",children:"全屏"})]})})]}),e.jsx("div",{className:"flex-grow flex-1 min-h-0 flex flex-col h-full relative",children:a==="whiteboard"?e.jsx("div",{className:"flex-grow flex-1 min-h-0 w-full h-full relative rounded-lg overflow-hidden border border-gray-100 flex flex-col",children:e.jsx(k,{lessonId:t,userRole:y,elements:w,activeSegmentId:j,onSegmentSync:s=>v(s),onElementAdd:async(s,n)=>{await fetch(`/api/lessons/${t}/whiteboard`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:s,data:n})}),i(t)},onElementUpdate:async(s,n)=>{await fetch(`/api/lessons/${t}/whiteboard/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:n})}),i(t)},onElementDelete:async s=>{await fetch(`/api/lessons/${t}/whiteboard/${s}`,{method:"DELETE"}),i(t)},onClearBoard:async()=>{await fetch(`/api/lessons/${t}/whiteboard`,{method:"DELETE"}),i(t)},onRefresh:()=>i(t)})}):e.jsxs("div",{className:"flex-grow flex-1 flex gap-4 min-h-0 w-full h-full",children:[e.jsxs("div",{className:"w-52 flex-shrink-0 bg-gray-50 border border-gray-250/70 rounded-xl p-3 flex flex-col min-h-0 h-full animate-none",children:[e.jsx("h4",{className:"text-xs font-bold uppercase tracking-wider text-gray-550 mb-2 border-b border-gray-200 pb-2",children:"Cloud Apps"}),e.jsxs("div",{className:"flex-1 overflow-y-auto space-y-1",children:[N!==null&&e.jsxs("button",{onClick:()=>x(null),className:"flex items-center gap-1 p-1.5 text-xs text-indigo-600 w-full hover:bg-gray-255 hover:bg-gray-200 rounded-lg mb-1 font-semibold",children:[e.jsx($,{className:"rotate-180",size:14})," Back to Root"]}),l.filter(s=>s.type==="dir").map(s=>e.jsxs("button",{onClick:()=>x(s.id),className:"w-full text-left p-1.5 rounded-lg text-xs text-gray-700 hover:bg-gray-250 hover:bg-gray-200 flex items-center gap-2 group truncate cursor-pointer font-medium",title:s.name,children:[e.jsx(E,{size:14,className:"text-indigo-400 shrink-0 group-hover:text-indigo-600"}),e.jsx("span",{className:"truncate",children:s.name})]},s.id)),l.filter(s=>s.type==="file"&&(s.name.endsWith(".html")||s.name.endsWith(".htm")||s.content?.includes("<html"))).length===0?e.jsx("div",{className:"text-xs text-center text-gray-400 italic py-4",children:"No interactive HTML apps found."}):l.filter(s=>s.type==="file"&&(s.name.endsWith(".html")||s.name.endsWith(".htm")||s.content?.includes("<html"))).map(s=>e.jsxs("button",{onClick:()=>h(s.id),className:`w-full text-left p-2 rounded-lg text-xs flex items-center gap-2 truncate transition-colors cursor-pointer font-medium ${m===s.id?"bg-indigo-100 text-indigo-700 font-semibold shadow-xs":"text-gray-600 hover:bg-gray-100"}`,title:s.name,children:[e.jsx(T,{size:14,className:"shrink-0 text-indigo-500"}),e.jsx("span",{className:"truncate",children:s.name})]},s.id))]}),e.jsx("div",{className:"mt-2 text-[10px] text-gray-400 leading-tight",children:"Note: Showing HTML courseware from current OS drive directory."})]}),e.jsx("div",{className:"flex-1 relative bg-white border border-gray-100 rounded-xl overflow-hidden min-h-0 h-full shadow-inner flex flex-col",children:e.jsx(C,{coursewareId:m,onClose:()=>h(null)})})]})})]})]})]})})})}export{B as StudentPreviewModal};
@@ -0,0 +1 @@
1
+ import{_ as se}from"./vendor-pdf-CVyNPGVr.js";import{j as e,R as Z,r as w}from"./vendor-react-0Lg0vA-4.js";import{a as T,b as ge,A as pe,m as fe}from"./vendor-motion-Dz5URUo4.js";import{f as U,x as be,p as re,y as q,i as H,z as $,E as ae,J as ue,N as ne,C as le,g as ie,O as oe,m as R,Q as je,R as ye,Y as ve,Z as ee,_ as Ne,$ as we,t as de,d as ke,w as Se,e as ze,a0 as Ce,U as Ae,l as te}from"./vendor-icons-BvCtGbt1.js";import{a as B,L as J,C as F,X as E,Y as W,T as I,b as O,c as Q,A as Le,d as De,B as _e,e as Te}from"./vendor-charts-B7ViBL9w.js";import{E as Pe}from"./index-BxA9vp--.js";import"./vendor-utils-4FcTwKPj.js";function Ge(h){const{students:t,activeStudentId:n}=h;return e.jsxs("div",{className:"flex items-center gap-4 border-b border-gray-200 pb-4",children:[e.jsx("div",{className:"h-16 w-16 bg-indigo-600 rounded-full flex items-center justify-center text-white text-2xl font-bold shadow-lg",children:t.find(b=>b.id===n)?.name.charAt(0).toUpperCase()}),e.jsxs("div",{children:[e.jsxs("h2",{className:"text-2xl font-bold text-gray-800",children:["Welcome, ",t.find(b=>b.id===n)?.name]}),e.jsx("p",{className:"text-gray-500",children:"Here is your learning summary."})]})]})}function $e(h){const{studentDashboardData:t,readNotifications:n,setReadNotifications:b,activeStudentId:a,addToast:k,lang:c}=h,z=(t?.rollcalls||[]).filter(v=>!n.has(v.id));return z.length===0?null:e.jsx("div",{className:"space-y-4",children:z.map(v=>e.jsxs(T.div,{initial:{scale:.95,opacity:0},animate:{scale:1,opacity:1},className:"bg-amber-500 rounded-2xl p-6 text-white shadow-xl relative overflow-hidden",children:[e.jsx("div",{className:"absolute -right-10 -bottom-10 w-40 h-40 bg-white/10 rounded-full blur-2xl animate-pulse"}),e.jsx("div",{className:"absolute -left-10 -top-10 w-32 h-32 bg-yellow-300/20 rounded-full blur-xl"}),e.jsxs("div",{className:"flex flex-col md:flex-row items-center justify-between gap-4 relative z-10",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"p-3 bg-white/20 backdrop-blur-md rounded-xl animate-bounce shrink-0",children:e.jsx(U,{className:"h-6 w-6 text-yellow-100"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-bold tracking-tight",children:c==="zh"?"⚡️ 闪电提问点名中,请立即回应!":"⚡️ Active Classroom Roll Call Alarm!"}),e.jsx("p",{className:"text-yellow-50 text-sm mt-1 max-w-xl font-medium",children:c==="zh"?`您刚才在课程"${v.lesson_title||"课堂"}"中被老师随机选中。大屏已同步闪烁您的姓名,请点击右侧按钮确认专注参与!`:`You have been randomly selected by the teacher in lesson "${v.lesson_title||"Class"}". Please click the button to confirm your presence and active attention!`})]})]}),e.jsxs("button",{onClick:async()=>{try{await fetch(`/api/students/${a}/read_notifications`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({notificationId:v.id})}),b(j=>{const S=new Set(j);return S.add(v.id),S}),k(c==="zh"?"已确认参与状态":"Presence confirmed",c==="zh"?"成功!已安全同步并确认在线。":"Successfully synchronized and confirmed active presence.","success")}catch(j){console.error("Failed to acknowledge rollcall",j)}},className:"px-5 py-2.5 bg-slate-900 hover:bg-slate-800 text-white font-bold text-xs uppercase tracking-wider rounded-xl shadow-lg ring-2 ring-white/20 active:scale-95 transition-all flex items-center gap-2 cursor-pointer shrink-0",children:[e.jsx(be,{size:14}),e.jsx("span",{children:c==="zh"?"🙋‍♂️ 我已就位 / 确认听讲":"🙋‍♂️ Present & Alert"})]})]})]},v.id))})}function Me(h){const{progress:t,setSelectedLesson:n,setStudentViewStatus:b}=h;return e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 shadow-sm flex flex-col",children:[e.jsxs("div",{className:"p-4 border-b border-gray-100 flex items-center gap-2",children:[e.jsx(re,{size:18,className:"text-teal-500"}),e.jsx("h3",{className:"font-semibold text-gray-800",children:"My Independent Courses"})]}),e.jsx("div",{className:"p-4",children:t&&t.length===0?e.jsx("div",{className:"text-center p-8 text-gray-400 italic text-sm",children:"No courses assigned yet."}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:t?.map(a=>e.jsxs("div",{className:"flex flex-col p-4 rounded-xl border border-gray-100 bg-gray-50 hover:border-teal-200 hover:shadow-sm transition-all focus:outline-none",children:[e.jsxs("div",{className:"flex justify-between items-start mb-3",children:[e.jsx("div",{className:"font-semibold text-gray-800 text-lg",children:a.lesson_title}),a.completed===1&&e.jsx("span",{className:"bg-green-100 text-green-800 text-[10px] px-1.5 py-0.5 rounded uppercase font-bold",children:"Completed"})]}),e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("div",{className:"flex-1 h-2 bg-gray-200 rounded-full overflow-hidden shrink-0",children:e.jsx("div",{className:`h-full ${a.progress_percent===100?"bg-green-500":"bg-teal-500"}`,style:{width:`${a.progress_percent}%`}})}),e.jsxs("span",{className:"text-xs text-gray-500 font-medium shrink-0",children:[a.progress_percent,"%"]})]}),e.jsx("button",{onClick:()=>{n(a.lesson_id),b("lesson")},className:"w-full flex justify-center items-center gap-2 bg-teal-500 hover:bg-teal-600 text-white px-4 py-2 rounded-lg text-sm font-semibold shadow-sm transition-colors mt-auto",children:a.progress_percent===0?e.jsxs(e.Fragment,{children:[e.jsx(q,{size:16})," Start Learning"]}):e.jsxs(e.Fragment,{children:[e.jsx(q,{size:16})," Continue"]})})]},a.lesson_id))})})]})}function V({value:h,duration:t=1}){const[n,b]=Z.useState(0);return Z.useEffect(()=>{const a=ge(n,h,{duration:t,ease:"easeOut",onUpdate:k=>b(Math.round(k))});return()=>a.stop()},[h,t]),e.jsx(e.Fragment,{children:n})}function Re(h){const{studentDashboardData:t}=h;return e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[e.jsxs(T.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.4,delay:.05},className:"bg-white p-4 rounded-xl border border-gray-200 shadow-sm flex flex-col items-center justify-center hover:border-indigo-300 hover:shadow-md transition-all duration-300",children:[e.jsx("span",{className:"text-3xl font-bold text-indigo-600",children:e.jsx(V,{value:t.classes?.length||0})}),e.jsx("span",{className:"text-sm font-medium text-gray-500 mt-1 uppercase tracking-wider text-center select-none",children:"Enrolled Classes"})]}),e.jsxs(T.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.4,delay:.1},className:"bg-white p-4 rounded-xl border border-gray-200 shadow-sm flex flex-col items-center justify-center hover:border-teal-300 hover:shadow-md transition-all duration-300",children:[e.jsx("span",{className:"text-3xl font-bold text-teal-600",children:e.jsx(V,{value:t.assignments?.filter(n=>n.submission_status==="graded").length||0})}),e.jsx("span",{className:"text-sm font-medium text-gray-500 mt-1 uppercase tracking-wider text-center select-none",children:"Completed Assignments"})]}),e.jsxs(T.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.4,delay:.15},className:"bg-white p-4 rounded-xl border border-gray-200 shadow-sm flex flex-col items-center justify-center hover:border-amber-300 hover:shadow-md transition-all duration-300",children:[e.jsx("span",{className:"text-3xl font-bold text-amber-500",children:e.jsx(V,{value:t.assignments?.filter(n=>!n.submission_status).length||0})}),e.jsx("span",{className:"text-sm font-medium text-gray-500 mt-1 uppercase tracking-wider text-center select-none",children:"Pending Assignments"})]}),e.jsxs(T.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.4,delay:.2},className:"bg-white p-4 rounded-xl border border-gray-200 shadow-sm flex flex-col items-center justify-center hover:border-pink-300 hover:shadow-md transition-all duration-300",children:[e.jsx("span",{className:"text-3xl font-bold text-pink-600",children:e.jsx(V,{value:t.schedules?.length||0})}),e.jsx("span",{className:"text-sm font-medium text-gray-500 mt-1 uppercase tracking-wider text-center select-none",children:"Upcoming Lessons"})]})]})}function Fe({assignments:h=[],lang:t="en"}){const[n,b]=w.useState("all"),[a,k]=w.useState("monotone"),[c,g]=w.useState(!0),[z,v]=w.useState(!0),[j,S]=w.useState(!0),l=w.useMemo(()=>h.filter(r=>r.submission_status==="graded"&&typeof r.score=="number"&&r.score!==null).map(r=>({...r,resolvedScore:r.score,eventTime:r.submitted_at||r.created_at||Date.now()})).sort((r,u)=>r.eventTime-u.eventTime),[h]),N=w.useMemo(()=>{const r=new Map;return l.forEach(u=>{u.class_name&&r.set(u.class_name,u.class_name)}),Array.from(r.values())},[l]),i=w.useMemo(()=>n==="all"?l:l.filter(r=>r.class_name===n),[l,n]),d=w.useMemo(()=>i.map((r,u)=>{const s=r.eventTime?new Date(r.eventTime):null,m=s?s.toLocaleDateString(t==="zh"?"zh-CN":"en-US",{month:"short",day:"numeric"}):`${t==="zh"?"测验":"Quiz"} #${u+1}`,y=s?s.toLocaleDateString(t==="zh"?"zh-CN":"en-US",{year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit"}):"N/A";return{id:r.id,index:u+1,title:r.title.replace("MCQ Evaluation: ","").replace("评估: ",""),fullTitle:r.title,score:r.resolvedScore,className:r.class_name,dateLabel:m,fullDateLabel:y,feedback:r.feedback||(t==="zh"?"优秀!继续加油。":"Excellent work! Keep it up.")}}),[i,t]),p=w.useMemo(()=>{if(d.length===0)return{average:0,highest:0,lowest:0,total:0,passingCount:0,passRate:0};const r=d.map(o=>o.score),u=r.reduce((o,L)=>o+L,0),s=Math.round(u/r.length),m=Math.max(...r),y=Math.min(...r),C=r.length,A=r.filter(o=>o>=60).length,D=Math.round(A/C*100);return{average:s,highest:m,lowest:y,total:C,passingCount:A,passRate:D}},[d]),x={title:t==="zh"?"学期成绩表现趋势":"Semester Grade Performance Trend",subtitle:t==="zh"?"全学期已评分测验与交互式作业的 chronological 成绩趋势分析":"Chronological grade analysis of graded quizzes and assignments across the semester",classFilter:t==="zh"?"选择班级:":"Class Filter:",allClasses:t==="zh"?"全部班级":"All Classes",chartStyle:t==="zh"?"曲线样式:":"Line Smoothing:",monotone:t==="zh"?"平滑曲线":"Smooth",linear:t==="zh"?"折线":"Straight",averageScore:t==="zh"?"已选平均成绩":"Selected Average",highestScore:t==="zh"?"最高成绩":"Highest Grade",lowestScore:t==="zh"?"最低成绩":"Lowest Grade",passRate:t==="zh"?"及格率":"Passing Rate",gradedCount:t==="zh"?"评阅作业数":"Graded Works",passingBenchmark:t==="zh"?"及格线 (60%)":"Passing Benchmark (60%)",emptyTitle:t==="zh"?"无学期评阅成绩":"No Graded Academic Data Only",emptyDesc:t==="zh"?"当前学期尚未有已评分的测验。当物理、历史或数学老师评估并评定你的白板作业或选择题测试后,由于底层的自适应评估引擎同步,此处会自动渲染出成绩波动趋势。":"You do not have any graded assignments or quizzes yet in this semester. Once teachers complete grading your interactive assignments, your chronological performance trajectory line will outline your academic development.",referenceLines:t==="zh"?"显示辅助线:":"Toggle Reference Lines:",avgLineLabel:t==="zh"?"选区平均":"Current Avg",gridLines:t==="zh"?"网格":"Grid",averageLine:t==="zh"?"平均成绩线":"Average Line",passLine:t==="zh"?"及格基准线":"Passing Benchmark",feedbackTitle:t==="zh"?"名师评语批注:":"Teacher Feedback Remark:"};return l.length===0?e.jsx("div",{className:"bg-white border border-gray-200 rounded-2xl p-8 shadow-sm hover:shadow-md transition-all",children:e.jsxs("div",{className:"max-w-md mx-auto text-center py-8",children:[e.jsx("div",{className:"inline-flex p-3.5 bg-indigo-50 text-indigo-600 rounded-full mb-4",children:e.jsx(H,{className:"w-7 h-7 animate-pulse"})}),e.jsx("h3",{className:"font-bold text-gray-800 text-lg",children:x.emptyTitle}),e.jsx("p",{className:"text-gray-500 text-xs mt-3 leading-relaxed",children:x.emptyDesc})]})}):e.jsxs("div",{className:"bg-white border border-gray-200 rounded-2xl shadow-sm hover:shadow-md transition-all overflow-hidden flex flex-col font-sans",id:"semester-grade-trend-container",children:[e.jsxs("div",{className:"p-5 border-b border-gray-100 bg-gray-50/50 flex flex-col md:flex-row md:items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"p-2.5 bg-indigo-50 text-indigo-600 rounded-xl mt-0.5 shadow-sm",children:e.jsx($,{size:20,className:"stroke-[2.5]"})}),e.jsxs("div",{children:[e.jsxs("h3",{className:"font-extrabold text-gray-900 text-base flex items-center gap-2",children:[e.jsx("span",{children:x.title}),e.jsxs("span",{className:"inline-flex items-center gap-0.5 bg-emerald-50 text-emerald-700 border border-emerald-100 rounded-full px-2 py-0.5 text-[9px] font-bold",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-500 animate-pulse"}),t==="zh"?"学期分析":"Semester Trend"]})]}),e.jsx("p",{className:"text-gray-500 text-xs mt-0.5",children:x.subtitle})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs("span",{className:"text-xs font-bold text-gray-500 flex items-center gap-1",children:[e.jsx(ae,{size:12,className:"text-gray-400"}),x.classFilter]}),e.jsxs("select",{value:n,onChange:r=>b(r.target.value),className:"bg-white border border-gray-200 text-xs text-gray-700 rounded-lg px-2.5 py-1.5 shadow-2xs focus:outline-none focus:ring-1 focus:ring-indigo-500 font-semibold",id:"class-filter-select",children:[e.jsx("option",{value:"all",children:x.allClasses}),N.map((r,u)=>e.jsx("option",{value:r,children:r},u))]})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs("span",{className:"text-xs font-bold text-gray-500 flex items-center gap-1",children:[e.jsx(ue,{size:12,className:"text-gray-400"}),x.chartStyle]}),e.jsxs("div",{className:"inline-flex border border-gray-200 rounded-lg p-0.5 bg-white shadow-2xs",children:[e.jsx("button",{onClick:()=>k("monotone"),className:`px-2 py-1 text-[10px] font-bold rounded-md transition-all ${a==="monotone"?"bg-indigo-600 text-white":"text-gray-500 hover:text-gray-800"}`,children:x.monotone}),e.jsx("button",{onClick:()=>k("linear"),className:`px-2 py-1 text-[10px] font-bold rounded-md transition-all ${a==="linear"?"bg-indigo-600 text-white":"text-gray-500 hover:text-gray-800"}`,children:x.linear})]})]})]})]}),e.jsxs("div",{className:"px-5 py-4 border-b border-gray-100 bg-white grid grid-cols-2 md:grid-cols-5 gap-3.5",children:[e.jsxs("div",{className:"bg-indigo-50/20 border border-indigo-100/40 p-3.5 rounded-xl flex items-center gap-3",children:[e.jsx("div",{className:"p-2.5 bg-indigo-50 text-indigo-600 rounded-lg shadow-2xs",children:e.jsx($,{size:16})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-wider",children:x.averageScore}),e.jsxs("div",{className:"text-base font-extrabold text-indigo-950 font-mono mt-0.5",children:[p.average,"%"]})]})]}),e.jsxs("div",{className:"bg-emerald-50/20 border border-emerald-100/40 p-3.5 rounded-xl flex items-center gap-3",children:[e.jsx("div",{className:"p-2.5 bg-emerald-50 text-emerald-600 rounded-lg shadow-2xs",children:e.jsx(ne,{size:16})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-wider",children:x.highestScore}),e.jsxs("div",{className:"text-base font-extrabold text-emerald-950 font-mono mt-0.5",children:[p.highest,"%"]})]})]}),e.jsxs("div",{className:"bg-rose-50/20 border border-rose-100/40 p-3.5 rounded-xl flex items-center gap-3",children:[e.jsx("div",{className:"p-2.5 bg-rose-50 text-rose-600 rounded-lg shadow-2xs",children:e.jsx(le,{size:16})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-wider",children:x.lowestScore}),e.jsxs("div",{className:"text-base font-extrabold text-rose-950 font-mono mt-0.5",children:[p.lowest,"%"]})]})]}),e.jsxs("div",{className:"bg-amber-50/15 border border-amber-100/40 p-3.5 rounded-xl flex items-center gap-3",children:[e.jsx("div",{className:"p-2.5 bg-amber-50 text-amber-600 rounded-lg shadow-2xs",children:e.jsx(ie,{size:16})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-wider",children:x.passRate}),e.jsxs("div",{className:"text-base font-extrabold text-amber-950 font-mono mt-0.5",children:[p.passRate,"%"]})]})]}),e.jsxs("div",{className:"bg-sky-50/20 border border-sky-100/40 p-3.5 rounded-xl flex items-center gap-3 col-span-2 md:col-span-1",children:[e.jsx("div",{className:"p-2.5 bg-sky-50 text-sky-600 rounded-lg shadow-2xs",children:e.jsx(re,{size:16})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-wider",children:x.gradedCount}),e.jsx("div",{className:"text-base font-extrabold text-sky-950 font-mono mt-0.5",children:p.total})]})]})]}),e.jsxs("div",{className:"p-5 grid grid-cols-1 lg:grid-cols-12 gap-6 items-stretch",children:[e.jsxs("div",{className:"lg:col-span-9 flex flex-col justify-between",id:"semester-grade-chart-wrapper",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 mb-3",children:[e.jsxs("div",{className:"text-xs font-bold text-indigo-900 flex items-center gap-1",children:[e.jsx(oe,{size:13,className:"text-indigo-500"}),e.jsx("span",{children:t==="zh"?"学期表现时间轴(按提交时间排序)":"Academic Performance Timeline (Chronological)"})]}),e.jsxs("div",{className:"flex items-center gap-3 text-[11px] text-gray-600 font-semibold self-end",children:[e.jsx("span",{className:"text-gray-400 text-[10px] uppercase font-bold",children:x.referenceLines}),e.jsxs("label",{className:"flex items-center gap-1 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:z,onChange:r=>v(r.target.checked),className:"rounded border-gray-300 text-indigo-600 focus:ring-indigo-500"}),e.jsx("span",{children:x.gridLines})]}),e.jsxs("label",{className:"flex items-center gap-1 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:z,onChange:r=>v(r.target.checked),className:"rounded border-gray-300 text-indigo-600 focus:ring-indigo-500"}),e.jsx("span",{children:x.averageLine})]}),e.jsxs("label",{className:"flex items-center gap-1 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:j,onChange:r=>S(r.target.checked),className:"rounded border-gray-300 text-indigo-600 focus:ring-indigo-500"}),e.jsx("span",{children:x.passLine})]})]})]}),e.jsx("div",{className:"h-[280px] w-full bg-slate-50/30 border border-slate-100 p-2.5 rounded-xl shadow-2xs relative",children:d.length===0?e.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-xs text-gray-400 italic",children:t==="zh"?"无该筛选条件下的成绩数据":"No grade data available for this selection"}):e.jsx(B,{width:"100%",height:"100%",children:e.jsxs(J,{data:d,margin:{top:15,right:15,left:-22,bottom:5},children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"lineColorGrad",x1:"0",y1:"0",x2:"1",y2:"0",children:[e.jsx("stop",{offset:"0%",stopColor:"#4f46e5"}),e.jsx("stop",{offset:"50%",stopColor:"#8b5cf6"}),e.jsx("stop",{offset:"100%",stopColor:"#ec4899"})]})}),c&&e.jsx(F,{strokeDasharray:"3 3",vertical:!1,stroke:"#f1f5f9"}),e.jsx(E,{dataKey:"dateLabel",tick:{fontSize:9,fill:"#64748b",fontWeight:"bold"},axisLine:{stroke:"#e2e8f0"},tickLine:!1}),e.jsx(W,{domain:[0,100],tick:{fontSize:9,fill:"#64748b",fontWeight:"bold"},axisLine:{stroke:"#e2e8f0"},tickLine:!1}),e.jsx(I,{content:({active:r,payload:u})=>{if(r&&u&&u.length){const s=u[0].payload;return e.jsxs("div",{className:"p-3.5 bg-white/95 border border-indigo-100 rounded-xl shadow-xl max-w-[270px] backdrop-blur-xs transition-all ring-4 ring-indigo-550/10",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-gray-100 pb-1.5 mb-1.5",children:[e.jsxs("span",{className:"text-[9px] text-gray-450 font-extrabold uppercase font-mono",children:["Quiz #",s.index," · ",s.className]}),e.jsxs("span",{className:"inline-flex items-center bg-indigo-50 text-indigo-700 px-2 py-0.5 rounded-full text-[10px] font-extrabold font-mono border border-indigo-100 shadow-2xs",children:[s.score,"%"]})]}),e.jsx("p",{className:"text-xs font-black text-slate-800 leading-snug",children:s.fullTitle}),e.jsx("p",{className:"text-[10px] text-slate-400 mt-1 leading-normal font-medium",children:s.fullDateLabel}),e.jsxs("div",{className:"mt-2 bg-gradient-to-r from-violet-50/50 to-indigo-50/40 p-2 rounded-lg border border-violet-100/50",children:[e.jsx("span",{className:"text-[9px] font-black text-violet-850 uppercase block tracking-wider mb-0.5",children:x.feedbackTitle}),e.jsxs("p",{className:"text-[10px] text-slate-700 italic font-sans leading-normal",children:['"',s.feedback,'"']})]})]})}return null}}),j&&e.jsx(O,{y:60,stroke:"#f43f5e",strokeWidth:1,strokeDasharray:"4 4",label:{value:x.passingBenchmark,fill:"#f43f5e",fontSize:8,fontWeight:"bold",position:"top",offset:3}}),z&&p.total>0&&e.jsx(O,{y:p.average,stroke:"#4f46e5",strokeWidth:1,strokeDasharray:"3 3",label:{value:`${x.avgLineLabel} (${p.average}%)`,fill:"#4f46e5",fontSize:8,fontWeight:"bold",position:"bottom",offset:3}}),e.jsx(Q,{type:a,dataKey:"score",stroke:"url(#lineColorGrad)",strokeWidth:3,dot:{r:5,stroke:"#ffffff",strokeWidth:2,fill:"#4f46e5"},activeDot:{r:7,stroke:"#ffffff",strokeWidth:2,fill:"#ec4899"},animationDuration:1e3})]})})})]}),e.jsx("div",{className:"lg:col-span-3 flex flex-col justify-between border-t border-gray-100 lg:border-t-0 lg:border-l lg:border-gray-100 pt-5 lg:pt-0 lg:pl-5",children:e.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[e.jsx("div",{className:"text-xs font-extrabold uppercase text-gray-450 tracking-wider mb-3",children:t==="zh"?"成绩优异榜":"Semester Milestones"}),e.jsx("div",{className:"space-y-2.5 overflow-y-auto max-h-[265px] pr-1 scrollbar-thin",children:d.length===0?e.jsx("div",{className:"text-center p-6 text-xs text-gray-400 italic",children:t==="zh"?"没有评分记录":"No milestone records"}):[...d].sort((r,u)=>u.score-r.score).slice(0,4).map((r,u)=>{const s=u===0;return e.jsxs("div",{className:`p-2.5 rounded-xl border flex items-center justify-between gap-3 transition-colors ${s?"border-yellow-200 bg-yellow-50/35 hover:bg-yellow-50/50":r.score>=80?"border-emerald-100 bg-emerald-50/20 hover:bg-emerald-50/35":"border-slate-100 bg-slate-50/30 hover:bg-slate-50/60"}`,children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[e.jsx("span",{className:"text-[8px] font-extrabold px-1.5 py-0.5 rounded uppercase font-mono leading-none tracking-wider bg-white shadow-3xs text-slate-500",children:s?"🏆 TOP":`#${u+1}`}),e.jsx("span",{className:"text-[9px] text-indigo-600 font-bold max-w-[80px] truncate",title:r.className,children:r.className})]}),e.jsx("h5",{className:"font-extrabold text-[10.5px] text-slate-800 leading-snug truncate mt-1",title:r.fullTitle,children:r.title})]}),e.jsxs("div",{className:`px-2 py-1 rounded-lg border font-mono font-bold text-center text-xs shrink-0 shadow-3xs bg-white ${r.score>=85?"text-emerald-700 border-emerald-150":r.score>=60?"text-indigo-700 border-indigo-150":"text-rose-700 border-rose-150"}`,children:[r.score,"%"]})]},r.id)})}),p.total>0&&e.jsx("div",{className:"mt-4 p-3 bg-gradient-to-r from-indigo-500/10 to-purple-500/10 rounded-2xl border border-indigo-100/50 text-[10px] text-slate-700 leading-relaxed font-medium",children:t==="zh"?e.jsxs(e.Fragment,{children:["在本学期中,你已完成了 ",e.jsx("span",{className:"font-bold text-indigo-805 font-mono",children:p.total})," 次正式学习质量评测。全科平均通过率为 ",e.jsxs("span",{className:"font-bold text-emerald-700 font-mono",children:[p.passRate,"%"]}),"。建议继续针对得分低于 60% 的章节进行自主微课回顾和重新作答。"]}):e.jsxs(e.Fragment,{children:["You participated in ",e.jsx("span",{className:"font-bold text-indigo-805 font-mono",children:p.total})," scholastic assessments this semester with an average competency score of ",e.jsxs("span",{className:"font-bold text-indigo-700 font-mono",children:[p.average,"%"]}),". Your grade profile shows an active rate of ",e.jsxs("span",{className:"font-bold text-teal-700 font-mono",children:[p.passRate,"%"]})," above passing grade threshold."]})})]})})]})]})}function Ee({assignments:h=[],lang:t="en"}){const[n,b]=w.useState("3months"),[a,k]=w.useState("all"),[c,g]=w.useState(!0),[z,v]=w.useState(!0),{filteredAssignments:j,dateRangeLabel:S,stats:l}=w.useMemo(()=>{const i=h.filter(f=>f.submission_status==="graded"&&typeof f.score=="number"&&f.score!==null).map(f=>{const _=f.score,M=f.graded_at||f.submitted_at||f.created_at||Date.now();return{...f,resolvedScore:_,actionTime:M}}).sort((f,_)=>f.actionTime-_.actionTime),d=Date.now(),p=2160*60*60*1e3,x=d-p;let r=i;a!=="all"&&(r=i.filter(f=>f.class_name===a));const u=n==="3months"?r.filter(f=>f.actionTime>=x):r,s=new Date(x).toLocaleDateString(t==="zh"?"zh-CN":"en-US",{month:"short",day:"numeric",year:"numeric"}),m=new Date(d).toLocaleDateString(t==="zh"?"zh-CN":"en-US",{month:"short",day:"numeric",year:"numeric"}),y=t==="zh"?`学段范围: ${s} 至 ${m} (最近 90 天)`:`Date Range: ${s} to ${m} (Last 90 Days)`,C=u.map((f,_)=>{const M=new Date(f.actionTime),K=M.toLocaleDateString(t==="zh"?"zh-CN":"en-US",{month:"short",day:"numeric"}),Y=M.toLocaleDateString(t==="zh"?"zh-CN":"en-US",{year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit"});return{id:f.id,index:_+1,title:f.title.replace("MCQ Evaluation: ","").replace("评估: ",""),fullTitle:f.title,score:f.resolvedScore,className:f.class_name,dateLabel:K,fullDateLabel:Y,feedback:f.feedback||(t==="zh"?"无":"No comments provided"),gradedAtStr:f.graded_at?new Date(f.graded_at).toLocaleString(t==="zh"?"zh-CN":"en-US"):""}}),A=C.map(f=>f.score),D=A.reduce((f,_)=>f+_,0),o=A.length>0?Math.round(D/A.length):0,L=A.length>0?Math.max(...A):0,P=A.length,G=A.filter(f=>f>=60).length;return{filteredAssignments:C,dateRangeLabel:y,stats:{average:o,highest:L,total:P,passing:G}}},[h,n,a,t]),N=w.useMemo(()=>{const i=new Set;return h.forEach(d=>{d.submission_status==="graded"&&d.class_name&&i.add(d.class_name)}),Array.from(i)},[h]);return e.jsxs("div",{className:"bg-white border border-gray-200 rounded-2xl shadow-sm hover:shadow-md transition-all overflow-hidden flex flex-col font-sans mb-6",id:"three-months-performance-line-chart",children:[e.jsxs("div",{className:"p-5 border-b border-gray-100 bg-linear-to-r from-rose-50/20 via-white to-pink-50/15 flex flex-col md:flex-row md:items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"p-2.5 bg-rose-50 text-rose-600 rounded-xl mt-0.5 shadow-xs",children:e.jsx(R,{size:20,className:"stroke-[2.5]"})}),e.jsxs("div",{children:[e.jsxs("h3",{className:"font-extrabold text-gray-950 text-base flex items-center gap-2",children:[e.jsx("span",{children:t==="zh"?"近3个月作业成绩分析":"Recent 3-Month Progress Chart"}),e.jsx("span",{className:"inline-flex items-center gap-0.5 bg-rose-50 text-rose-700 border border-rose-100 rounded-full px-2 py-0.5 text-[9px] font-bold",children:t==="zh"?"90天回顾":"90 Days Review"})]}),e.jsx("p",{className:"text-gray-500 text-xs mt-0.5",children:S})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs("span",{className:"text-xs font-bold text-gray-500 flex items-center gap-1",children:[e.jsx(je,{size:12,className:"text-gray-400"}),t==="zh"?"过滤范围:":"Scope:"]}),e.jsxs("div",{className:"inline-flex border border-gray-200 rounded-lg p-0.5 bg-white shadow-2xs",children:[e.jsx("button",{onClick:()=>b("3months"),className:`px-2.5 py-1 text-[10px] font-bold rounded-md transition-all cursor-pointer ${n==="3months"?"bg-rose-600 text-white":"text-gray-500 hover:text-gray-800"}`,children:t==="zh"?"近 3 个月":"Last 3 Months"}),e.jsx("button",{onClick:()=>b("all"),className:`px-2.5 py-1 text-[10px] font-bold rounded-md transition-all cursor-pointer ${n==="all"?"bg-rose-600 text-white":"text-gray-500 hover:text-gray-800"}`,children:t==="zh"?"全部记录":"All Graded"})]})]}),N.length>0&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs("span",{className:"text-xs font-bold text-gray-500 flex items-center gap-1",children:[e.jsx(ae,{size:12,className:"text-gray-400"}),t==="zh"?"班级:":"Class:"]}),e.jsxs("select",{value:a,onChange:i=>k(i.target.value),className:"bg-white border border-gray-200 text-xs text-gray-700 rounded-lg px-2 py-1 focus:outline-none focus:ring-1 focus:ring-rose-500 font-semibold shadow-2xs",children:[e.jsx("option",{value:"all",children:t==="zh"?"全部班级":"All Classes"}),N.map((i,d)=>e.jsx("option",{value:i,children:i},d))]})]})]})]}),e.jsxs("div",{className:"px-5 py-3.5 border-b border-gray-100 bg-white grid grid-cols-2 md:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"p-3 bg-rose-50/10 rounded-xl border border-rose-100/30 flex flex-col",children:[e.jsx("span",{className:"text-[10px] font-bold text-gray-450 uppercase tracking-wider",children:t==="zh"?"平均成绩":"Avg. Score"}),e.jsxs("span",{className:"text-xl font-extrabold text-rose-950 font-mono mt-0.5",children:[l.average,"%"]})]}),e.jsxs("div",{className:"p-3 bg-amber-50/10 rounded-xl border border-amber-100/30 flex flex-col",children:[e.jsx("span",{className:"text-[10px] font-bold text-gray-450 uppercase tracking-wider",children:t==="zh"?"最高分数":"Peak Score"}),e.jsxs("span",{className:"text-xl font-extrabold text-amber-950 font-mono mt-0.5",children:[l.highest,"%"]})]}),e.jsxs("div",{className:"p-3 bg-indigo-50/10 rounded-xl border border-indigo-100/30 flex flex-col",children:[e.jsx("span",{className:"text-[10px] font-bold text-gray-450 uppercase tracking-wider",children:t==="zh"?"作业评阅数":"Graded Count"}),e.jsx("span",{className:"text-xl font-extrabold text-indigo-950 font-mono mt-0.5",children:l.total})]}),e.jsxs("div",{className:"p-3 bg-emerald-50/10 rounded-xl border border-emerald-100/30 flex flex-col",children:[e.jsx("span",{className:"text-[10px] font-bold text-gray-450 uppercase tracking-wider",children:t==="zh"?"及格件数":"Passing Works"}),e.jsx("span",{className:"text-xl font-extrabold text-emerald-950 font-mono mt-0.5",children:l.passing})]})]}),e.jsx("div",{className:"p-5",children:j.length===0?e.jsxs("div",{className:"text-center py-10 bg-slate-50/50 rounded-xl border border-dashed border-slate-200",children:[e.jsx(le,{size:28,className:"mx-auto text-slate-300 mb-2"}),e.jsx("h4",{className:"text-gray-800 text-xs font-bold",children:t==="zh"?"近3个月没有已评分的作业记录":"No Graded Submissions in the past 3 months"}),e.jsx("p",{className:"text-gray-400 text-[10px] mt-1 px-4 max-w-sm mx-auto",children:t==="zh"?"暂无符合检索时间窗的评语或测验成绩。您可以点击“全部记录”进行查询,或交办新作业让名师或AI进行极速评分。":'No performance updates were logged during this period. Try switching to "All Graded" to see historic trends, or complete pending tasks now!'})]}):e.jsx("div",{className:"h-[240px] w-full relative",children:e.jsx(B,{width:"100%",height:"100%",children:e.jsxs(J,{data:j,margin:{top:15,right:15,left:-22,bottom:5},children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"roseLineGrad",x1:"0",y1:"0",x2:"1",y2:"0",children:[e.jsx("stop",{offset:"0%",stopColor:"#f43f5e"}),e.jsx("stop",{offset:"60%",stopColor:"#ec4899"}),e.jsx("stop",{offset:"100%",stopColor:"#d946ef"})]})}),c&&e.jsx(F,{strokeDasharray:"3 3",vertical:!1,stroke:"#f1f5f9"}),e.jsx(E,{dataKey:"dateLabel",tick:{fontSize:9,fill:"#64748b",fontWeight:"bold"},axisLine:{stroke:"#e2e8f0"},tickLine:!1}),e.jsx(W,{domain:[0,100],tick:{fontSize:9,fill:"#64748b",fontWeight:"bold"},axisLine:{stroke:"#e2e8f0"},tickLine:!1}),e.jsx(I,{content:({active:i,payload:d})=>{if(i&&d&&d.length){const p=d[0].payload;return e.jsxs("div",{className:"p-3 bg-white/95 border border-rose-100 rounded-xl shadow-xl max-w-[260px] backdrop-blur-xs font-sans",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-gray-100 pb-1 mb-1 border-opacity-50",children:[e.jsx("span",{className:"text-[9px] text-gray-400 font-bold uppercase font-mono",children:p.className}),e.jsxs("span",{className:"inline-flex items-center bg-rose-50 text-rose-700 px-2 py-0.5 rounded-full text-[10px] font-bold font-mono border border-rose-100",children:[p.score,"%"]})]}),e.jsx("p",{className:"text-xs font-bold text-slate-800 leading-snug",children:p.fullTitle}),e.jsx("p",{className:"text-[9px] text-slate-400 mt-1",children:p.fullDateLabel}),p.gradedAtStr&&e.jsx("p",{className:"text-[9px] text-rose-500 font-mono mt-0.5",children:t==="zh"?`测评时间: ${p.gradedAtStr}`:`Reviewed: ${p.gradedAtStr}`}),p.feedback&&e.jsxs("div",{className:"mt-2 bg-rose-50/40 p-1.5 rounded border border-rose-100/50",children:[e.jsx("span",{className:"text-[8px] font-bold text-rose-800 uppercase block tracking-wider mb-0.5",children:t==="zh"?"随堂反馈意见":"FEEDBACK"}),e.jsxs("p",{className:"text-[10px] text-slate-600 italic",children:['"',p.feedback,'"']})]})]})}return null}}),z&&l.total>0&&e.jsx(O,{y:l.average,stroke:"#db2777",strokeWidth:1.2,strokeDasharray:"4 4",label:{value:t==="zh"?`近期平均 (${l.average}%)`:`Recent Avg (${l.average}%)`,fill:"#db2777",fontSize:8,fontWeight:"bold",position:"top",offset:3}}),e.jsx(Q,{type:"monotone",dataKey:"score",stroke:"url(#roseLineGrad)",strokeWidth:3.5,dot:{r:5,stroke:"#ffffff",strokeWidth:2,fill:"#ec4899"},activeDot:{r:7,stroke:"#ffffff",strokeWidth:2,fill:"#f43f5e"}})]})})})})]})}function We({assignments:h=[],lang:t="en"}){const[n,b]=w.useState("all"),[a,k]=w.useState(!0),[c,g]=w.useState(!0),{trajectoryData:z,availableClasses:v,stats:j,trendDirection:S}=w.useMemo(()=>{const N=h.filter(o=>o.submission_status==="graded"&&typeof o.score=="number"&&o.score!==null).map(o=>{const L=o.score,P=o.graded_at||o.submitted_at||o.created_at||Date.now();return{...o,resolvedScore:L,timeVal:P}}).sort((o,L)=>o.timeVal-L.timeVal),i=new Set;N.forEach(o=>{o.class_name&&i.add(o.class_name)});const d=n==="all"?N:N.filter(o=>o.class_name===n);let p=0;const x=d.map((o,L)=>{p+=o.resolvedScore;const P=Math.round(p/(L+1)*10)/10,G=new Date(o.timeVal),f=G.toLocaleDateString(t==="zh"?"zh-CN":"en-US",{month:"short",day:"numeric"}),_=G.toLocaleDateString(t==="zh"?"zh-CN":"en-US",{year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit"});return{id:o.id,index:L+1,title:o.title.replace("MCQ Evaluation: ","").replace("评估: ",""),fullTitle:o.title,score:o.resolvedScore,runningAverage:P,className:o.class_name,dateLabel:f,fullDateLabel:_,feedback:o.feedback||""}}),r=x.length,u=r>0?x[0].runningAverage:0,s=r>0?x[r-1].runningAverage:0,m=Math.round((s-u)*10)/10;let y="stable";m>1.5?y="upward":m<-1.5&&(y="downward");const C=x.map(o=>o.runningAverage),A=C.length>0?Math.max(...C):0,D=C.length>0?Math.min(...C):0;return{trajectoryData:x,availableClasses:Array.from(i),stats:{startingAvg:u,currentAvg:s,growthPercentage:m,peakAvg:A,valleyAvg:D,totalGraded:r},trendDirection:y}},[h,n,t]),l={title:t==="zh"?"学术成长轨迹与平均分演变":"Academic Growth & Cumulative Average Trajectory",subtitle:t==="zh"?"追踪在校作业评分的累积移动平均线,体现核心学力成长趋势":"Tracks cumulative moving average of evaluated coursework to outline long-term proficiency",classFilter:t==="zh"?"班级:":"Class:",allClasses:t==="zh"?"全学科":"All Subjects",statsStart:t==="zh"?"起始基准分":"Base Score",statsCurrent:t==="zh"?"当前累积平均":"Cumulative Avg",statsNet:t==="zh"?"学术增长劲头":"Net Trajectory",statsPeak:t==="zh"?"累积峰值高度":"Trajectory Peak",emptyTitle:t==="zh"?"待评阅作业以构建成长曲线":"Awaiting Data for Growth Map",emptyDesc:t==="zh"?"当你的作业通过评阅且录入成绩后,成长轨迹分析引擎将自动计算每次评分后的全局累积分,从而绘制出能体现学习毅力与知识掌握成熟度的进展曲线。":"Once your work receives evaluations, our trajectory motor calculates a progressive running average to render a true representation of your academic journey.",layerIndividual:t==="zh"?"显示单项原始成绩":"Show Single Assignment Scores",trajLabel:t==="zh"?"学术成长轨迹 (累积平均)":"Academic Growth (Running Avg)",rawLabel:t==="zh"?"单次作业得分":"Single Work Score",recommendationTitle:t==="zh"?"自适应成长评估与建议":"Adaptive Progress Evaluation"};return z.length===0?e.jsx("div",{className:"bg-white border border-gray-200 rounded-2xl p-6 shadow-xs hover:shadow-md transition-all font-sans mb-6",children:e.jsxs("div",{className:"max-w-md mx-auto text-center py-6",children:[e.jsx("div",{className:"inline-flex p-3 bg-rose-50 text-rose-500 rounded-full mb-3",children:e.jsx(ye,{className:"w-6 h-6 animate-spin text-rose-600"})}),e.jsx("h3",{className:"font-extrabold text-gray-900 text-sm",children:l.emptyTitle}),e.jsx("p",{className:"text-gray-400 text-xs mt-2 leading-relaxed",children:l.emptyDesc})]})}):e.jsxs("div",{className:"bg-white border border-gray-200 rounded-2xl shadow-sm hover:shadow-md transition-all overflow-hidden flex flex-col font-sans mb-6",id:"academic-growth-trajectory-card",children:[e.jsxs("div",{className:"p-5 border-b border-gray-100 bg-linear-to-r from-emerald-50/10 via-white to-teal-50/10 flex flex-col md:flex-row md:items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"p-2.5 bg-emerald-50 text-emerald-600 rounded-xl mt-0.5 shadow-2xs",children:e.jsx($,{size:20,className:"stroke-[2.5]"})}),e.jsxs("div",{children:[e.jsxs("h3",{className:"font-extrabold text-gray-950 text-base flex items-center gap-1.5",children:[e.jsx("span",{children:l.title}),e.jsxs("span",{className:"inline-flex items-center gap-1 bg-emerald-555 bg-emerald-100 text-emerald-800 border border-emerald-200/50 rounded-full px-2 py-0.5 text-[9px] font-black uppercase",children:[e.jsx(U,{size:8,className:"animate-spin text-emerald-600"}),t==="zh"?"能力演进":"Trajectory"]})]}),e.jsx("p",{className:"text-gray-500 text-xs mt-0.5",children:l.subtitle})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3 self-center",children:[v.length>0&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-xs font-bold text-gray-500",children:l.classFilter}),e.jsxs("select",{value:n,onChange:N=>b(N.target.value),className:"bg-white border border-gray-200 text-xs text-gray-700 font-bold rounded-lg px-2.5 py-1.5 focus:outline-none focus:ring-1 focus:ring-emerald-500 shadow-2xs",children:[e.jsx("option",{value:"all",children:l.allClasses}),v.map((N,i)=>e.jsx("option",{value:N,children:N},i))]})]}),e.jsxs("button",{onClick:()=>k(!a),className:`px-3 py-1.5 text-[10px] font-bold rounded-lg border flex items-center gap-1.5 cursor-pointer transition-all ${a?"bg-emerald-50 border-emerald-200 text-emerald-700 font-bold":"bg-white border-gray-200 text-gray-500 hover:text-gray-700"}`,children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${a?"bg-emerald-500 animate-pulse":"bg-gray-300"}`}),l.layerIndividual]})]})]}),e.jsxs("div",{className:"px-5 py-3.5 border-b border-gray-100 bg-linear-to-b from-gray-50/30 to-white grid grid-cols-2 md:grid-cols-4 gap-4 select-none",children:[e.jsxs("div",{className:"p-3 bg-white hover:bg-slate-50 border border-gray-100 rounded-xl shadow-3xs flex flex-col justify-center",children:[e.jsx("span",{className:"text-[9px] font-bold text-gray-400 uppercase tracking-wider",children:l.statsStart}),e.jsxs("span",{className:"text-lg font-black text-slate-800 font-mono mt-0.5",children:[j.startingAvg,"%"]})]}),e.jsxs("div",{className:"p-3 bg-white hover:bg-slate-50 border border-gray-100 rounded-xl shadow-3xs flex flex-col justify-center",children:[e.jsx("span",{className:"text-[9px] font-bold text-gray-400 uppercase tracking-wider",children:l.statsCurrent}),e.jsxs("span",{className:"text-lg font-black text-emerald-800 font-mono mt-0.5",children:[j.currentAvg,"%"]})]}),e.jsxs("div",{className:"p-3 bg-white hover:bg-slate-50 border border-gray-100 rounded-xl shadow-3xs flex flex-col justify-center",children:[e.jsx("span",{className:"text-[9px] font-bold text-gray-400 uppercase tracking-wider",children:l.statsNet}),e.jsxs("div",{className:"flex items-center gap-1 mt-0.5",children:[e.jsxs("span",{className:`text-lg font-black font-mono ${j.growthPercentage>=0?"text-emerald-600":"text-red-500"}`,children:[j.growthPercentage>=0?`+${j.growthPercentage}`:j.growthPercentage,"%"]}),j.growthPercentage>0&&e.jsx($,{size:14,className:"text-emerald-500 shrink-0"}),j.growthPercentage<0&&e.jsx(ve,{size:14,className:"text-red-400 shrink-0"})]})]}),e.jsxs("div",{className:"p-3 bg-white hover:bg-slate-50 border border-gray-100 rounded-xl shadow-3xs flex flex-col justify-center",children:[e.jsx("span",{className:"text-[9px] font-bold text-gray-400 uppercase tracking-wider",children:l.statsPeak}),e.jsxs("span",{className:"text-lg font-black text-rose-800 font-mono mt-0.5",children:[j.peakAvg,"%"]})]})]}),e.jsxs("div",{className:"p-5 grid grid-cols-1 lg:grid-cols-12 gap-6 items-stretch",children:[e.jsx("div",{className:"lg:col-span-9 flex flex-col justify-between",id:"growth-canvas-container",children:e.jsx("div",{className:"h-[250px] w-full relative bg-slate-50/20 border border-slate-100 p-2 rounded-xl",children:e.jsx(B,{width:"100%",height:"100%",children:e.jsxs(J,{data:z,margin:{top:15,right:15,left:-22,bottom:5},children:[e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:"growthGrad",x1:"0",y1:"0",x2:"1",y2:"0",children:[e.jsx("stop",{offset:"0%",stopColor:"#10b981"}),e.jsx("stop",{offset:"50%",stopColor:"#06b6d4"}),e.jsx("stop",{offset:"100%",stopColor:"#3b82f6"})]}),e.jsxs("linearGradient",{id:"scoreAuxGrad",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"#94a3b8"}),e.jsx("stop",{offset:"100%",stopColor:"#cbd5e1"})]})]}),c&&e.jsx(F,{strokeDasharray:"3 3",vertical:!1,stroke:"#f1f5f9"}),e.jsx(E,{dataKey:"dateLabel",tick:{fontSize:9,fill:"#64748b",fontWeight:"bold"},axisLine:{stroke:"#e2e8f0"},tickLine:!1}),e.jsx(W,{domain:[0,100],tick:{fontSize:9,fill:"#64748b",fontWeight:"bold"},axisLine:{stroke:"#e2e8f0"},tickLine:!1}),e.jsx(I,{content:({active:N,payload:i})=>{if(N&&i&&i.length){const d=i[0].payload;return e.jsxs("div",{className:"p-3.5 bg-white/95 border border-emerald-100 rounded-xl shadow-xl max-w-[270px] backdrop-blur-xs font-sans",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-slate-100 pb-1.5 mb-1.5",children:[e.jsx("span",{className:"text-[8px] text-slate-400 font-extrabold uppercase font-mono",children:d.className}),e.jsxs("span",{className:"bg-emerald-50 text-emerald-800 px-2 py-0.5 rounded-full text-[10px] font-black border border-emerald-100 font-mono",children:[d.runningAverage,"% Avg"]})]}),e.jsx("p",{className:"text-xs font-black text-slate-800 leading-tight",children:d.fullTitle}),e.jsx("p",{className:"text-[10px] text-slate-400 mt-1",children:d.fullDateLabel}),e.jsxs("div",{className:"mt-2.5 pt-2 border-t border-slate-100 grid grid-cols-2 gap-1.5",children:[e.jsxs("div",{className:"bg-slate-50 p-1 rounded border border-slate-100 text-center",children:[e.jsx("span",{className:"block text-[8px] text-gray-400 uppercase font-black",children:t==="zh"?"当次得分":"SESS SCORE"}),e.jsxs("span",{className:"text-[11px] font-bold font-mono text-indigo-700",children:[d.score,"%"]})]}),e.jsxs("div",{className:"bg-emerald-50/50 p-1 rounded border border-emerald-100/50 text-center",children:[e.jsx("span",{className:"block text-[8px] text-emerald-600 uppercase font-black",children:t==="zh"?"累积移动平均":"RUNNING AVG"}),e.jsxs("span",{className:"text-[11px] font-black font-mono text-emerald-800",children:[d.runningAverage,"%"]})]})]}),d.feedback&&e.jsx("div",{className:"mt-2 bg-emerald-50/20 p-1.5 rounded-lg border border-emerald-100/30",children:e.jsxs("p",{className:"text-[9px] text-emerald-800 italic truncate font-sans",children:['"',d.feedback,'"']})})]})}return null}}),e.jsx(Q,{type:"monotone",name:l.trajLabel,dataKey:"runningAverage",stroke:"url(#growthGrad)",strokeWidth:4.5,dot:{r:4,stroke:"#ffffff",strokeWidth:2,fill:"#06b6d4"},activeDot:{r:6,stroke:"#ffffff",strokeWidth:2.5,fill:"#10b981"},animationDuration:1200}),a&&e.jsx(Q,{type:"monotone",name:l.rawLabel,dataKey:"score",stroke:"url(#scoreAuxGrad)",strokeWidth:1.5,strokeDasharray:"4 3",dot:{r:3,stroke:"#f8fafc",strokeWidth:1,fill:"#94a3b8"},activeDot:{r:4,stroke:"#ffffff",strokeWidth:2,fill:"#475569"},animationDuration:800,opacity:.65})]})})})}),e.jsx("div",{className:"lg:col-span-3 flex flex-col justify-between border-t lg:border-t-0 lg:border-l border-gray-100 pt-5 lg:pt-0 lg:pl-5 min-w-0",children:e.jsxs("div",{className:"flex flex-col h-full justify-between",children:[e.jsxs("div",{children:[e.jsxs("span",{className:"text-[9px] font-extrabold uppercase text-gray-400 tracking-wider flex items-center gap-1 mb-2.5",children:[e.jsx(U,{size:11,className:"text-emerald-500 shrink-0"}),l.recommendationTitle]}),e.jsxs("div",{className:"p-4 rounded-xl border border-dashed border-gray-200 bg-linear-to-b from-white to-gray-50/30",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2 font-black text-xs",children:[S==="upward"&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-emerald-500 shrink-0 animate-ping"}),e.jsx("span",{className:"text-emerald-700",children:t==="zh"?"学术成长极强":"Excellent Growth"})]}),S==="stable"&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-indigo-400 shrink-0"}),e.jsx("span",{className:"text-indigo-700",children:t==="zh"?"平稳巩固上升":"Steady Progress"})]}),S==="downward"&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-rose-400 shrink-0 shadow-lg animate-pulse"}),e.jsx("span",{className:"text-rose-700",children:t==="zh"?"关注诊断警示":"Diagnostic Alert"})]})]}),e.jsx("p",{className:"text-[11px] text-gray-650 leading-relaxed font-sans",children:t==="zh"?e.jsxs(e.Fragment,{children:[S==="upward"&&"你的学术成长曲线呈现出非常健康的向上拉升趋势!这表明随着上课次数的增加,你的整体知识体系越来越巩固,学习耐力和答题准确率已经取得了决定性突破。",S==="stable"&&"累积分数轨迹进入成熟的常态化稳定期。这反映出你表现相当均衡稳定。建议在保持住基础大盘的同时,试着探索更具挑战性的选拔赛或是高阶人工智能随堂测验来寻找新的学术突破。",S==="downward"&&"近期累积平均分受某几次偶发失常作业的影响,增长势头有所受挫。请无需气馁,建议你到作业区查看教师留下的批注建议,利用微课复习针对差错进行重新作答。"]}):e.jsxs(e.Fragment,{children:[S==="upward"&&"Your academic trajectory maps a highly competent upward lift. This strongly correlates with refined endurance, improved error resolution over consecutive modules, and a progressive understanding of core material.",S==="stable"&&"Your running average sits in an equilibrium band. Your output exhibits solid consistency. Start aiming for advanced peer reviews or high-level AI topics to challenge your plateau and break into the higher bracket.",S==="downward"&&"The moving average shows a slight descent due to standard deviations in recent assignments. Review the feedback timeline to recalibrate your core subjects and raise your general competency."]})})]})]}),e.jsxs("div",{className:"mt-4 pt-3.5 border-t border-gray-100 space-y-2 select-none",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[10px] font-bold text-gray-450",children:[e.jsx(ee,{size:10,className:"text-emerald-500"}),e.jsxs("span",{children:[t==="zh"?"总评测样本数: ":"Assessments count: ",e.jsx("span",{className:"text-slate-800 font-mono",children:j.totalGraded})]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-[10px] font-bold text-gray-450",children:[e.jsx(ee,{size:10,className:"text-emerald-500"}),e.jsxs("span",{children:[t==="zh"?"学力波动幅度: ":"Fluctuation envelope: ",e.jsxs("span",{className:"text-slate-800 font-mono",children:[(j.peakAvg-j.valleyAvg).toFixed(1),"%"]})]})]})]})]})})]})]})}function Ie({assignments:h}){const[t,n]=w.useState("area"),[b,a]=w.useState(null),k=(h||[]).filter(s=>s.submission_status==="graded").sort((s,m)=>(s.submitted_at||0)-(m.submitted_at||0));if(k.length===0)return e.jsx("div",{className:"bg-white border border-gray-200 rounded-xl p-8 hover:shadow-md transition-all",children:e.jsxs("div",{className:"max-w-md mx-auto text-center py-6",children:[e.jsx("div",{className:"inline-flex p-3 bg-indigo-50 text-indigo-600 rounded-full mb-3",children:e.jsx(H,{className:"w-6 h-6 animate-pulse"})}),e.jsx("h3",{className:"font-semibold text-gray-800 text-base",children:"Graded Performance Timeline"}),e.jsx("p",{className:"text-gray-500 text-xs mt-2 leading-relaxed",children:"Your interactive learning timeline and performance chart will generate automatically here once teachers grade your MCQ quizzes or interactive submissions. Complete more tasks to build your historical growth profile!"})]})});const c=k.map(s=>s.score||0),g=Math.max(...c),z=Math.round(c.reduce((s,m)=>s+m,0)/c.length),v=k.length,j=k.filter(s=>(s.score||0)>=70).length,S=Math.round(j/v*100);let l="Solidly Consistent",N="Maintaining stable grades",i=0,d="text-blue-700 border-blue-200 bg-blue-50/50";if(c.length>=2){const s=Math.ceil(c.length/2),m=c.slice(0,s),y=c.slice(c.length%2===0?s:s-1),C=m.reduce((D,o)=>D+o,0)/m.length,A=y.reduce((D,o)=>D+o,0)/y.length;i=Math.round(A-C),i>15?(l="Stellar Acceleration",N=`Surging upward by +${i}%!`,d="text-green-800 border-green-300 bg-green-55/60 animate-bounce"):i>3?(l="Steadily Improving",N=`Gained a +${i}% grade boost`,d="text-emerald-700 border-emerald-200 bg-emerald-50/70"):i<-10?(l="Support Recommended",N=`Recent grades dropped by ${i}%`,d="text-rose-700 border-rose-200 bg-rose-50/70"):i<-3?(l="Needs Targeted Review",N=`Slight dip of ${i}% noticed`,d="text-amber-700 border-amber-200 bg-amber-50/70"):(l="Solidly Consistent",N="Maintaining very stable performance",d="text-indigo-700 border-indigo-200 bg-indigo-50/70")}const p=k.map((s,m)=>({index:m,id:s.id,title:s.title.replace("MCQ Evaluation: ","").substring(0,20)+(s.title.length>20?"...":""),fullTitle:s.title,score:s.score||0,className:s.class_name,dateStr:s.submitted_at?new Date(s.submitted_at).toLocaleDateString(void 0,{month:"short",day:"numeric"}):`Quiz #${m+1}`,fullDate:s.submitted_at?new Date(s.submitted_at).toLocaleDateString(void 0,{month:"long",day:"numeric",year:"numeric"}):"N/A",feedback:s.feedback||"Excellent execution!",gradedAt:s.graded_at?new Date(s.graded_at).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):""})),x=b!==null?b:p.length-1,r=p[x];k[x];const u=s=>s>=90?{bg:"bg-green-50 text-green-700 border-green-200",text:"text-green-600",ring:"ring-green-400"}:s>=75?{bg:"bg-blue-50 text-blue-700 border-blue-200",text:"text-blue-600",ring:"ring-blue-400"}:s>=60?{bg:"bg-amber-50 text-amber-700 border-amber-200",text:"text-amber-600",ring:"ring-amber-400"}:{bg:"bg-red-50 text-red-700 border-red-200",text:"text-red-600",ring:"ring-red-400"};return e.jsxs("div",{className:"bg-white border border-gray-200 rounded-2xl shadow-sm overflow-hidden flex flex-col font-sans",children:[e.jsxs("div",{className:"p-4 sm:p-5 border-b border-gray-100 flex flex-col sm:flex-row sm:items-center justify-between gap-3 bg-gray-50/50",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-indigo-50 text-indigo-650 rounded-lg",children:e.jsx($,{size:18,className:"animate-pulse"})}),e.jsxs("div",{children:[e.jsxs("h3",{className:"font-bold text-gray-800 text-sm sm:text-base flex items-center gap-1.5",children:[e.jsx("span",{children:"Performance Analytics & Historical Growth Timeline"}),e.jsxs("span",{className:"text-[10px] bg-indigo-100 text-indigo-800 font-bold px-1.5 py-0.5 rounded-full inline-flex items-center gap-1",children:[e.jsx(U,{size:8})," Auto-Updated"]})]}),e.jsx("p",{className:"text-gray-500 text-xs",children:"Track chronological objective proficiency across classes"})]})]}),e.jsxs("div",{className:"flex items-center gap-1.5 bg-white p-1 rounded-lg border border-gray-200 self-start sm:self-center",children:[e.jsxs("button",{onClick:()=>n("area"),className:`px-2.5 py-1 text-xs font-semibold rounded-md transition-all flex items-center gap-1 ${t==="area"?"bg-indigo-600 text-white shadow-sm":"text-gray-600 hover:bg-gray-100"}`,children:[e.jsx(Ne,{size:12}),e.jsx("span",{children:"Trend Area"})]}),e.jsxs("button",{onClick:()=>n("bar"),className:`px-2.5 py-1 text-xs font-semibold rounded-md transition-all flex items-center gap-1 ${t==="bar"?"bg-indigo-600 text-white shadow-sm":"text-gray-600 hover:bg-gray-100"}`,children:[e.jsx(we,{size:12}),e.jsx("span",{children:"Bars"})]})]})]}),e.jsxs("div",{className:"p-4 sm:p-6 space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"p-3 bg-indigo-50/40 rounded-xl border border-indigo-100/60 flex items-center gap-2.5",children:[e.jsx("div",{className:"p-2 rounded-lg bg-indigo-100 text-indigo-600",children:e.jsx($,{size:16})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] uppercase font-bold text-gray-400 tracking-wider",children:"Average"}),e.jsxs("div",{className:"text-lg font-bold text-indigo-950 font-mono",children:[z,"%"]})]})]}),e.jsxs("div",{className:"p-3 bg-emerald-50/40 rounded-xl border border-emerald-100/60 flex items-center gap-2.5",children:[e.jsx("div",{className:"p-2 rounded-lg bg-emerald-100 text-emerald-600",children:e.jsx(ne,{size:16})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] uppercase font-bold text-gray-400 tracking-wider",children:"Highest Score"}),e.jsxs("div",{className:"text-lg font-bold text-emerald-950 font-mono",children:[g,"%"]})]})]}),e.jsxs("div",{className:"p-3 bg-cyan-50/40 rounded-xl border border-cyan-100/60 flex items-center gap-2.5",children:[e.jsx("div",{className:"p-2 rounded-lg bg-cyan-100 text-cyan-600",children:e.jsx(H,{size:16})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] uppercase font-bold text-gray-400 tracking-wider",children:"Completed"}),e.jsxs("div",{className:"text-lg font-bold text-cyan-950 font-mono",children:[v," Quizzes"]})]})]}),e.jsxs("div",{className:"p-3 bg-amber-50/40 rounded-xl border border-amber-100/60 flex items-center gap-2.5",children:[e.jsx("div",{className:"p-2 rounded-lg bg-amber-100 text-amber-600",children:e.jsx(de,{size:16})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] uppercase font-bold text-gray-400 tracking-wider",children:"Passing Rate"}),e.jsxs("div",{className:"text-lg font-bold text-amber-950 font-mono",children:[S,"%"]})]})]})]}),c.length>=2&&e.jsxs("div",{className:`p-4 rounded-xl border flex flex-col md:flex-row md:items-center justify-between gap-4 transition-all ${d}`,children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-white/95 text-indigo-650 shrink-0 border border-indigo-100 shadow-xs",children:e.jsx($,{size:18,className:i>0?"text-emerald-600 animate-pulse":"text-indigo-600"})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] uppercase font-bold tracking-wider opacity-75",children:"Learning Curve & Trajectory"}),e.jsxs("h4",{className:"text-sm font-extrabold mt-0.5 flex items-center gap-2 text-slate-900",children:[e.jsx("span",{children:l}),i!==0&&e.jsx("span",{className:`inline-flex items-center text-[10px] px-2 py-0.5 rounded-full font-bold ${i>0?"bg-emerald-100/80 text-emerald-850 border border-emerald-250":"bg-rose-100/80 text-rose-850 border border-rose-250"}`,children:i>0?`▲ +${i}% Growth`:`▼ ${i}% Drop`})]}),e.jsx("p",{className:"text-xs text-slate-600 mt-1 leading-snug",children:N})]})]}),e.jsxs("div",{className:"text-[11px] font-semibold px-3 py-2 bg-white/95 rounded-lg shadow-3xs border border-slate-100 text-slate-700 md:self-center",children:[e.jsx("div",{className:"text-slate-400 font-bold uppercase text-[8px] mb-0.5 tracking-wider",children:"Growth Comparison"}),e.jsxs("span",{className:"font-bold text-indigo-900",children:[Math.round(c.slice(0,Math.ceil(c.length/2)).reduce((s,m)=>s+m,0)/Math.ceil(c.length/2)),"%"]})," Earliest Avg",e.jsx("span",{className:"text-slate-400 mx-1",children:"→"}),e.jsxs("span",{className:"font-bold text-emerald-700",children:[Math.round(c.slice(Math.ceil(c.length/2)).reduce((s,m)=>s+m,0)/c.slice(Math.ceil(c.length/2)).length)||c[c.length-1],"%"]})," Recent Avg"]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-12 gap-6 min-h-0",children:[e.jsxs("div",{className:"lg:col-span-8 flex flex-col justify-between",children:[e.jsx("div",{className:"mb-2 text-xs font-semibold uppercase text-gray-400 tracking-wider",children:"Chronological Progress Chart"}),e.jsx("div",{className:"h-[250px] w-full mt-3",children:e.jsx(B,{width:"100%",height:"100%",children:t==="area"?e.jsxs(Le,{data:p,margin:{top:10,right:10,left:-20,bottom:5},onClick:s=>{s&&typeof s.activeTooltipIndex=="number"&&a(s.activeTooltipIndex)},children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"scoreColorGrad",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"5%",stopColor:"#4f46e5",stopOpacity:.25}),e.jsx("stop",{offset:"95%",stopColor:"#4f46e5",stopOpacity:.01})]})}),e.jsx(F,{strokeDasharray:"3 3",vertical:!1,stroke:"#f1f5f9"}),e.jsx(E,{dataKey:"dateStr",tick:{fontSize:10,fill:"#64748b"},axisLine:!1,tickLine:!1}),e.jsx(W,{domain:[0,100],tick:{fontSize:10,fill:"#64748b"},axisLine:!1,tickLine:!1}),e.jsx(I,{cursor:{stroke:"#e2e8f0",strokeWidth:1},content:({active:s,payload:m})=>{if(s&&m&&m.length){const y=m[0].payload,C=x===y.index;return e.jsxs("div",{className:`p-3 bg-white border rounded-xl shadow-xl border-gray-100 max-w-xs transition-all ${C?"ring-2 ring-indigo-500":""}`,children:[e.jsx("p",{className:"text-[10px] text-gray-400 font-bold uppercase",children:y.fullDate}),e.jsx("p",{className:"text-xs font-bold text-gray-800 leading-snug mt-0.5",children:y.fullTitle}),e.jsxs("div",{className:"flex items-center justify-between gap-4 mt-2",children:[e.jsx("span",{className:"text-[10px] text-gray-500 bg-gray-50 border px-1.5 py-0.5 rounded font-medium",children:y.className}),e.jsxs("span",{className:"text-xs font-bold text-indigo-600 font-mono",children:[y.score,"%"]})]}),e.jsx("p",{className:"text-[9px] text-gray-400 italic mt-1 bg-gray-50 p-1 rounded",children:"Click node to pin details below"})]})}return null}}),e.jsx(O,{y:70,stroke:"#cbd5e1",strokeDasharray:"4 4",label:{value:"Passing Benchmark (70%)",fill:"#94a3b8",fontSize:9,position:"top"}}),e.jsx(De,{type:"monotone",dataKey:"score",stroke:"#4f46e5",strokeWidth:2.5,fillOpacity:1,fill:"url(#scoreColorGrad)",activeDot:{r:6,fill:"#4f46e5",stroke:"#fff",strokeWidth:2}})]}):e.jsxs(_e,{data:p,margin:{top:10,right:10,left:-20,bottom:5},onClick:s=>{s&&typeof s.activeTooltipIndex=="number"&&a(s.activeTooltipIndex)},children:[e.jsx(F,{strokeDasharray:"3 3",vertical:!1,stroke:"#f1f5f9"}),e.jsx(E,{dataKey:"dateStr",tick:{fontSize:10,fill:"#64748b"},axisLine:!1,tickLine:!1}),e.jsx(W,{domain:[0,100],tick:{fontSize:10,fill:"#64748b"},axisLine:!1,tickLine:!1}),e.jsx(I,{cursor:{fill:"rgba(79, 70, 229, 0.04)"},content:({active:s,payload:m})=>{if(s&&m&&m.length){const y=m[0].payload;return e.jsxs("div",{className:"p-3 bg-white border border-gray-150 rounded-xl shadow-xl max-w-xs",children:[e.jsx("p",{className:"text-[10px] text-gray-400 font-bold uppercase",children:y.fullDate}),e.jsx("p",{className:"text-xs font-bold text-gray-800 leading-snug mt-0.5",children:y.fullTitle}),e.jsxs("div",{className:"flex items-center justify-between gap-4 mt-2",children:[e.jsx("span",{className:"text-[10px] text-gray-500 bg-gray-50 border px-1.5 py-0.5 rounded font-medium",children:y.className}),e.jsxs("span",{className:"text-xs font-bold text-indigo-600 font-mono",children:[y.score,"%"]})]})]})}return null}}),e.jsx(O,{y:70,stroke:"#cbd5e1",strokeDasharray:"4 4",label:{value:"Benchmark",fill:"#94a3b8",fontSize:9}}),e.jsx(Te,{dataKey:"score",fill:"#4f46e5",radius:[4,4,0,0],maxBarSize:45})]})})}),e.jsxs("div",{className:"mt-4 p-3 bg-gray-50 rounded-xl border border-gray-150 text-xs",children:[e.jsxs("div",{className:"flex justify-between items-center mb-1",children:[e.jsxs("span",{className:"font-semibold text-gray-650 flex items-center gap-1",children:[e.jsx(ke,{size:12}),e.jsx("span",{children:"Selected Node Objective Grade Evaluation:"})]}),e.jsxs("span",{className:"text-[9px] font-mono text-gray-400 font-semibold uppercase",children:["Quiz ",x+1," of ",v]})]}),e.jsxs("div",{className:"flex items-start justify-between gap-3 mt-1.5",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"font-bold text-gray-850 leading-relaxed text-xs",children:r.fullTitle}),e.jsxs("p",{className:"text-[10px] text-gray-500 leading-normal flex items-center flex-wrap gap-1.5",children:[e.jsxs("span",{children:[r.className," · Submitted on ",r.fullDate]}),r.gradedAt&&e.jsxs("span",{className:"inline-flex items-center gap-0.5 text-emerald-650 bg-emerald-50 px-1.5 py-0.5 rounded border border-emerald-100 font-medium",children:[e.jsx(R,{size:10})," Graded: ",r.gradedAt]})]})]}),e.jsxs("div",{className:`px-2.5 py-1 rounded-lg border font-mono font-bold text-center shrink-0 ${u(r.score).bg}`,children:[e.jsx("div",{className:"text-[8px] uppercase tracking-wider font-bold opacity-75",children:"Score"}),e.jsxs("div",{className:"text-sm font-black leading-none",children:[r.score,"%"]})]})]})]})]}),e.jsxs("div",{className:"lg:col-span-4 flex flex-col",children:[e.jsxs("div",{className:"mb-2 text-xs font-semibold uppercase text-gray-400 tracking-wider flex items-center justify-between",children:[e.jsx("span",{children:"Interactive Evaluation Log"}),e.jsx("span",{className:"text-[9px] lowercase bg-amber-50 text-amber-700 px-1 py-0.5 rounded border border-amber-100 font-mono",children:"recent first"})]}),e.jsx("div",{className:"flex-1 overflow-y-auto max-h-[300px] lg:max-h-[340px] pr-1.5 space-y-3 scrollbar-thin mt-3",children:e.jsx(pe,{initial:!1,children:[...p].reverse().map(s=>{const m=x===s.index,y=u(s.score);return e.jsxs(fe.div,{onClick:()=>a(s.index),whileHover:{scale:1.01},className:`p-3 rounded-xl border cursor-pointer transition-all ${m?"border-indigo-600 bg-indigo-50/20 ring-2 ring-indigo-100/50 shadow-sm":"border-gray-150 hover:border-gray-300 bg-white hover:bg-gray-50/50"}`,children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[e.jsxs("span",{className:"text-[10px] font-bold text-gray-400 font-mono uppercase",children:["#",s.index+1]}),e.jsx("span",{className:"text-[9px] text-gray-500 font-medium font-sans",children:s.dateStr}),e.jsx("span",{className:"text-[9px] font-bold text-indigo-700 px-1.5 py-0.5 bg-indigo-50 rounded bg-indigo-50/50 ml-auto border border-indigo-100",children:s.className})]}),e.jsx("h4",{className:"font-bold text-xs text-gray-800 leading-snug line-clamp-1 py-0.5",children:s.fullTitle})]}),e.jsxs("div",{className:`px-1.5 py-0.5 rounded font-bold font-mono text-[10px] border shrink-0 ${y.bg}`,children:[s.score,"%"]})]}),e.jsx("div",{className:`text-[10px] text-gray-500 mt-2 bg-gray-50/80 p-1.5 rounded-lg border border-gray-100 ${m?"block":"line-clamp-1"}`,children:e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("div",{className:"flex items-start gap-1",children:[e.jsx(Se,{size:10,className:"text-teal-600 shrink-0 mt-0.5"}),e.jsxs("span",{className:"leading-snug text-slate-700 italic",children:['"',s.feedback,'"']})]}),s.gradedAt&&m&&e.jsxs("div",{className:"text-[9px] text-gray-400 mt-1 flex items-center justify-end gap-0.5 font-mono italic border-t border-gray-250/50 pt-1",children:[e.jsx(R,{size:9})," Graded: ",s.gradedAt]})]})})]},s.id)})})})]})]})]})]})}function Oe(h){const{assignments:t,lang:n}=h;return e.jsxs(e.Fragment,{children:[e.jsx(T.div,{initial:{opacity:0,y:15},animate:{opacity:1,y:0},transition:{duration:.5,delay:.1,ease:"easeOut"},children:e.jsx(Fe,{assignments:t,lang:n})}),e.jsx(T.div,{initial:{opacity:0,y:15},animate:{opacity:1,y:0},transition:{duration:.5,delay:.2,ease:"easeOut"},children:e.jsx(Ee,{assignments:t,lang:n})}),e.jsx(T.div,{initial:{opacity:0,y:15},animate:{opacity:1,y:0},transition:{duration:.5,delay:.25,ease:"easeOut"},children:e.jsx(We,{assignments:t,lang:n})}),e.jsx(T.div,{initial:{opacity:0,y:15},animate:{opacity:1,y:0},transition:{duration:.5,delay:.3,ease:"easeOut"},children:e.jsx(Ie,{assignments:t})})]})}function Ve(h){const{schedules:t,setSelectedLesson:n,setStudentViewStatus:b}=h;return e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 shadow-sm flex flex-col",children:[e.jsxs("div",{className:"p-4 border-b border-gray-100 flex items-center gap-2",children:[e.jsx(oe,{size:18,className:"text-pink-500"}),e.jsx("h3",{className:"font-semibold text-gray-800",children:"My Schedule"})]}),e.jsx("div",{className:"p-4 flex-1",children:t.length===0?e.jsx("div",{className:"text-center p-8 text-gray-400 italic text-sm",children:"No upcoming classes."}):e.jsx("div",{className:"space-y-3",children:t.map(a=>e.jsxs("div",{className:"flex flex-col p-3 rounded-lg border border-pink-100 bg-pink-50/30",children:[e.jsxs("div",{className:"flex justify-between items-start mb-2",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold text-gray-800",children:a.lesson_title}),e.jsx("div",{className:"text-xs text-gray-500",children:a.class_name})]}),e.jsx("div",{className:"bg-pink-100 text-pink-700 px-2 py-1 inline-block rounded text-xs font-bold font-mono tracking-tight",children:a.scheduled_date})]}),e.jsxs("div",{className:"flex justify-between items-end mt-2",children:[a.attendance_status?e.jsxs("div",{className:"text-xs text-gray-600 font-medium",children:["Attendance: ",e.jsx("span",{className:`uppercase font-bold ${a.attendance_status==="present"?"text-green-600":a.attendance_status==="late"?"text-amber-600":"text-red-600"}`,children:a.attendance_status})]}):e.jsx("div",{className:"text-xs text-gray-400 italic",children:"Attendance not yet recorded."}),e.jsxs("button",{onClick:()=>{n(a.lesson_id),b("lesson")},className:"flex items-center gap-1 bg-pink-500 hover:bg-pink-600 text-white px-3 py-1.5 rounded text-xs font-semibold shadow-sm transition-colors",children:[e.jsx(q,{size:14})," Join Class"]})]})]},a.id))})})]})}function Ue(h){const{assignments:t,setSelectedAssignment:n,setStudentViewStatus:b,setQuizStudentAnswers:a,setSubAssignmentTab:k,lang:c}=h;return e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 shadow-sm flex flex-col",children:[e.jsxs("div",{className:"p-4 border-b border-gray-100 flex items-center gap-2",children:[e.jsx(ze,{size:18,className:"text-indigo-500"}),e.jsx("h3",{className:"font-semibold text-gray-800",children:"My Assignments"})]}),e.jsx("div",{className:"p-4 flex-1",children:t.length===0?e.jsx("div",{className:"text-center p-8 text-gray-400 italic text-sm",children:"No assignments given."}):e.jsx("div",{className:"space-y-3",children:t.map(g=>e.jsxs("div",{className:"flex flex-col p-3 rounded-lg border border-gray-100 bg-gray-50 hover:bg-gray-100 transition-colors",children:[e.jsxs("div",{className:"flex justify-between items-start mb-1",children:[e.jsx("div",{className:"font-semibold text-indigo-900",children:g.title}),!g.submission_status&&e.jsx("span",{className:"bg-amber-100 text-amber-800 text-[10px] px-1.5 py-0.5 rounded uppercase font-bold",children:"Pending"}),g.submission_status==="submitted"&&e.jsx("span",{className:"bg-blue-100 text-blue-800 text-[10px] px-1.5 py-0.5 rounded uppercase font-bold",children:"Awaiting Grade"}),g.submission_status==="graded"&&e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0 relative group/ast-badge",children:[g.graded_at&&e.jsxs("div",{className:"text-gray-400 hover:text-indigo-600 transition-colors cursor-help p-0.5",children:[e.jsx(R,{size:11}),e.jsxs("div",{className:"absolute right-0 bottom-full mb-1.5 hidden group-hover/ast-badge:block bg-gray-900 text-white text-[10px] p-2 rounded-xl shadow-xl z-25 whitespace-nowrap font-sans font-normal normal-case",children:[c==="zh"?`评审反馈时间: ${new Date(g.graded_at).toLocaleString("zh-CN",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}`:`Feedback Hour: ${new Date(g.graded_at).toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}`,e.jsx("div",{className:"absolute top-full right-2 -mt-1 border-4 border-transparent border-t-gray-900"})]})]}),e.jsxs("span",{className:"bg-green-100 text-green-800 text-[10px] px-1.5 py-0.5 rounded uppercase font-bold text-center",children:["Score: ",g.score,"%"]})]})]}),e.jsxs("div",{className:"text-xs text-gray-500 mb-2",children:[g.class_name," · ",e.jsx("span",{className:"text-gray-400 italic",children:g.content})]}),g.submission_status==="graded"&&g.feedback&&e.jsxs("div",{className:"mt-2 bg-green-50 p-2.5 rounded-lg border border-green-100 flex flex-col gap-1 text-xs text-green-800",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-green-100/50 pb-1 mb-0.5",children:[e.jsxs("div",{className:"flex items-center gap-1 font-semibold",children:[e.jsx(ie,{size:13,className:"shrink-0 text-green-600"}),e.jsx("span",{children:c==="zh"?"教师评审意见":"Teacher Feedback"})]}),g.graded_at&&e.jsxs("div",{className:"flex items-center gap-1 text-[9px] text-green-600 font-mono bg-white/70 px-1.5 py-0.5 rounded border border-green-100/50 relative group/ast-time cursor-help",children:[e.jsx(R,{size:10,className:"inline"}),e.jsx("span",{children:new Date(g.graded_at).toLocaleDateString(c==="zh"?"zh-CN":"en-US",{month:"short",day:"numeric"})}),e.jsxs("div",{className:"absolute right-0 bottom-full mb-1.5 hidden group-hover/ast-time:block bg-gray-900 text-white text-[10px] p-2 rounded-lg shadow-xl z-20 whitespace-nowrap font-sans font-normal text-left",children:[c==="zh"?`评审反馈于: ${new Date(g.graded_at).toLocaleString("zh-CN")}`:`Feedback provided on: ${new Date(g.graded_at).toLocaleString("en-US")}`,e.jsx("div",{className:"absolute top-full right-3 -mt-1 border-4 border-transparent border-t-gray-900"})]})]})]}),e.jsx("span",{className:"leading-snug bg-green-50/20 rounded p-1 text-xs text-gray-700 whitespace-pre-wrap",children:g.feedback})]}),!g.submission_status&&e.jsx("div",{className:"mt-2 text-right flex items-center justify-end gap-2",children:e.jsxs("button",{onClick:()=>{n(g),b("assignment"),a({}),k("quiz")},className:"px-3 py-1.5 bg-indigo-100 text-indigo-700 hover:bg-indigo-200 text-xs rounded shadow-sm focus:outline-none transition-colors font-medium flex items-center gap-1.5",children:[e.jsx(Ce,{size:14})," Open Canvas"]})}),g.submission_status&&e.jsx("div",{className:"mt-2 text-right",children:e.jsxs("button",{onClick:()=>{if(n(g),b("assignment"),k("quiz"),g.submission_content)try{a(JSON.parse(g.submission_content))}catch{a({})}else a({})},className:"px-3 py-1.5 bg-gray-100 text-gray-700 hover:bg-gray-200 text-xs rounded shadow-sm focus:outline-none transition-colors font-medium flex items-center gap-1.5 ml-auto",children:[e.jsx(de,{size:14})," View Submission"]})})]},g.id))})})]})}function Qe(h){const{students:t,activeStudentId:n,studentDashboardData:b,readNotifications:a,setReadNotifications:k,addToast:c,lang:g,setSelectedLesson:z,setStudentViewStatus:v,setSelectedAssignment:j,setQuizStudentAnswers:S,setSubAssignmentTab:l}=h;return e.jsxs("div",{className:"space-y-8",children:[e.jsx(Ge,{students:t,activeStudentId:n}),e.jsx($e,{studentDashboardData:b,readNotifications:a,setReadNotifications:k,activeStudentId:n,addToast:c,lang:g}),e.jsx(Me,{progress:b.progress,setSelectedLesson:z,setStudentViewStatus:v}),e.jsx(Re,{studentDashboardData:b}),e.jsx(Oe,{assignments:b.assignments,lang:g}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsx(Ve,{schedules:b.schedules,setSelectedLesson:z,setStudentViewStatus:v}),e.jsx(Ue,{assignments:b.assignments,setSelectedAssignment:j,setStudentViewStatus:v,setQuizStudentAnswers:S,setSubAssignmentTab:l,lang:g}),e.jsx(Pe,{slot:"student.view",slotProps:{studentId:n}})]})]})}const Be=w.lazy(()=>se(()=>import("./StudentLessonView-D1gYdLM1.js"),[]).then(h=>({default:h.StudentLessonView}))),Ke=w.lazy(()=>se(()=>import("./StudentAssignmentView-YxVJ5wkl.js"),[]).then(h=>({default:h.StudentAssignmentView})));function tt(h){const{students:t,activeStudentId:n,studentViewStatus:b,studentDashboardData:a,readNotifications:k,setReadNotifications:c,addToast:g,lang:z,setSelectedLesson:v,setStudentViewStatus:j,setSelectedAssignment:S,setQuizStudentAnswers:l,setSubAssignmentTab:N,lessons:i,selectedLesson:d,studentFullscreenPanel:p,setStudentFullscreenPanel:x,timelineSegments:r,activeSegmentId:u,setActiveSegmentId:s,localProgressPercent:m,setLocalProgressPercent:y,updateStudentProgress:C,isStudentLessonContentCollapsed:A,setIsStudentLessonContentCollapsed:D,studentLessonTab:o,setStudentLessonTab:L,elements:P,activeRole:G,fetchElements:f,currentVfsParent:_,setCurrentVfsParent:M,vfsNodes:K,studentSelectedCourseware:Y,setStudentSelectedCourseware:ce,selectedAssignment:X,quizStudentAnswers:xe,submitQuizAssignment:me,subAssignmentTab:he}=h;return e.jsx("div",{className:"flex-1 p-6 overflow-y-auto w-full max-w-full space-y-6",children:n?a?e.jsx(w.Suspense,{fallback:e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center min-h-[400px] text-slate-400 gap-3",children:[e.jsx(te,{className:"w-8 h-8 animate-spin text-indigo-500"}),e.jsx("span",{className:"text-sm font-medium",children:"加载内容中..."})]}),children:b==="lesson"?e.jsx(Be,{students:t,activeStudentId:n,setStudentViewStatus:j,setSelectedLesson:v,lessons:i,selectedLesson:d,studentFullscreenPanel:p,setStudentFullscreenPanel:x,timelineSegments:r,lang:z,activeSegmentId:u,setActiveSegmentId:s,localProgressPercent:m,setLocalProgressPercent:y,updateStudentProgress:C,isStudentLessonContentCollapsed:A,setIsStudentLessonContentCollapsed:D,studentLessonTab:o,setStudentLessonTab:L,elements:P,activeRole:G,fetchElements:f,currentVfsParent:_,setCurrentVfsParent:M,vfsNodes:K,studentSelectedCourseware:Y,setStudentSelectedCourseware:ce,addToast:g}):b==="assignment"&&X?e.jsx(Ke,{selectedAssignment:X,setStudentViewStatus:j,setSelectedAssignment:S,quizStudentAnswers:xe,submitQuizAssignment:me,subAssignmentTab:he,setSubAssignmentTab:N,setQuizStudentAnswers:l,elements:P,activeRole:G,activeStudentId:n,fetchElements:f}):e.jsx(Qe,{students:t,activeStudentId:n,studentDashboardData:a,readNotifications:k,setReadNotifications:c,addToast:g,lang:z,setSelectedLesson:v,setStudentViewStatus:j,setSelectedAssignment:S,setQuizStudentAnswers:l,setSubAssignmentTab:N})}):e.jsx("div",{className:"flex items-center justify-center h-full text-gray-400",children:e.jsx(te,{size:32,className:"animate-spin"})}):e.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl p-12 text-center text-gray-500 flex flex-col items-center justify-center",children:[e.jsx(Ae,{size:48,className:"text-gray-300 mb-4"}),e.jsx("h3",{className:"text-lg font-medium text-gray-700",children:"No Student Selected"}),e.jsx("p",{className:"mt-2 text-sm",children:"Please select a student from the top navigation bar to view their dashboard."})]})})}export{tt as StudentView};
@@ -0,0 +1 @@
1
+ import{j as e}from"./vendor-react-0Lg0vA-4.js";import{CloudDrivePanel as T}from"./CloudDriveModal-DgDurUBT.js";import{h,a9 as D,aa as $}from"./vendor-icons-BvCtGbt1.js";import"./LazyCourseware-qE4CY67E.js";import"./vendor-pdf-CVyNPGVr.js";import"./index-BrEBeWAQ.js";function H(b){const{isSystemResourceLibraryOpen:y,setIsSystemResourceLibraryOpen:v,lang:s,systemResourceTab:d,setSystemResourceTab:p,selectedLibraryResourceId:o,setSelectedLibraryResourceId:c,vfsNodes:N,currentVfsParent:j,setCurrentVfsParent:w,cloudDrivePreviewNode:k,setCloudDrivePreviewNode:R,loadingLibraryResources:f,libraryResources:g,fetchLibraryResources:x}=b;return e.jsx(e.Fragment,{children:y&&e.jsx("div",{className:"fixed inset-0 bg-gray-900/40 backdrop-blur-sm flex items-center justify-center p-6 z-50",children:e.jsxs("div",{className:"bg-white border text-gray-900 border-gray-200 rounded-2xl shadow-2xl w-full max-w-6xl h-[85vh] flex flex-col overflow-hidden animate-in fade-in zoom-in-95 duration-150",children:[e.jsxs("div",{className:"p-4 border-b border-gray-100 flex items-center justify-between bg-gray-50/80 shrink-0 flex-wrap gap-2",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[e.jsx(h,{size:20,className:"text-emerald-500 animate-pulse"}),e.jsx("h2",{className:"font-semibold text-gray-800 text-lg",children:s==="zh"?"系统资源库与应用商城":"System Resource Library"}),e.jsxs("div",{className:"flex items-center gap-1 bg-slate-200/80 p-0.5 rounded-xl border border-slate-300/60 shadow-3xs ml-2",children:[e.jsxs("button",{onClick:()=>p("system"),className:`px-3 py-1 text-xs font-bold rounded-lg transition-all flex items-center gap-1.5 cursor-pointer ${d==="system"?"bg-white text-emerald-800 shadow-2xs font-extrabold":"text-slate-600 hover:text-slate-900"}`,children:[e.jsx(h,{size:13,className:"text-emerald-500"}),e.jsx("span",{children:s==="zh"?"互动课件与系统资源":"System Resources"})]}),e.jsxs("button",{onClick:()=>p("cloud"),className:`px-3 py-1 text-xs font-bold rounded-lg transition-all flex items-center gap-1.5 cursor-pointer ${d==="cloud"?"bg-white text-indigo-800 shadow-2xs font-extrabold":"text-slate-600 hover:text-slate-900"}`,children:[e.jsx(D,{size:13,className:"text-indigo-500"}),e.jsx("span",{children:s==="zh"?"云端课程资源 (Cloud Drive)":"Cloud Course Resource"})]})]})]}),e.jsx("button",{onClick:()=>{v(!1),c(null)},className:"text-gray-400 hover:text-gray-600 font-bold p-1 overflow-hidden hover:bg-gray-200 rounded transition-colors text-lg inline-flex items-center justify-center w-8 h-8 cursor-pointer",children:"×"})]}),d==="cloud"?e.jsx(T,{vfsNodes:N,currentVfsParent:j,setCurrentVfsParent:w,cloudDrivePreviewNode:k,setCloudDrivePreviewNode:R}):e.jsxs("div",{className:"flex-1 flex overflow-hidden min-h-0",children:[e.jsxs("div",{className:"w-80 border-r border-gray-100 bg-slate-50 flex flex-col shrink-0",children:[e.jsxs("div",{className:"p-4 border-b border-gray-200 bg-white space-y-2",children:[e.jsx("span",{className:"block text-xs font-semibold text-gray-500 uppercase tracking-wider mb-1",children:s==="zh"?"上传新资源":"Upload New Resource"}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("label",{className:"flex flex-col items-center justify-center p-3 bg-slate-50 hover:bg-indigo-50 border border-dashed border-gray-300 hover:border-indigo-400 rounded-xl cursor-pointer text-center transition-all group",children:[e.jsx("span",{className:"text-lg mb-1 group-hover:scale-110 transition-transform",children:"📄"}),e.jsx("span",{className:"font-bold text-indigo-600 text-[10px] break-all leading-tight",children:s==="zh"?"单HTML文件":"Single HTML"}),e.jsx("input",{type:"file",accept:".html,.htm",className:"hidden",onChange:async t=>{const r=t.target.files?.[0];if(!r)return;const i=new FileReader;i.onload=async n=>{const a=n.target?.result;try{(await fetch("/api/resources",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:r.name,type:"html",content:a})})).ok&&x()}catch(l){console.error("Library upload failed:",l)}},i.readAsText(r)}})]}),e.jsxs("label",{className:"flex flex-col items-center justify-center p-3 bg-slate-50 hover:bg-teal-50 border border-dashed border-gray-300 hover:border-teal-400 rounded-xl cursor-pointer text-center transition-all group",children:[e.jsx("span",{className:"text-lg mb-1 group-hover:scale-110 transition-transform",children:"📁"}),e.jsx("span",{className:"font-bold text-teal-600 text-[10px] break-all leading-tight",children:s==="zh"?"完整文件夹":"Directory Folder"}),e.jsx("input",{type:"file",webkitdirectory:"",directory:"",multiple:!0,className:"hidden",onChange:async t=>{const r=t.target.files;if(!r||r.length===0)return;const i=[];let n="";for(let a=0;a<r.length;a++){const l=r[a],u=l.webkitRelativePath||l.name;n||(n=u.split("/")[0]||"library_resource");const z=l.name.split(".").pop()?.toLowerCase(),C=["png","jpg","jpeg","gif","webp","ico"].includes(z||"");await new Promise(L=>{const m=new FileReader;m.onload=S=>{const P=S.target?.result;i.push({path:u,content:P}),L()},C?m.readAsDataURL(l):m.readAsText(l)})}try{(await fetch("/api/resources",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:n,type:"folder",content:JSON.stringify(i)})})).ok&&x()}catch(a){console.error("Folder upload failed:",a)}}})]})]})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:[e.jsx("span",{className:"block text-[10px] font-bold text-gray-400 uppercase tracking-widest pl-1",children:s==="zh"?"当前已存储的资源":"Stored Resources"}),f&&e.jsx("div",{className:"text-center py-8 text-xs text-slate-400",children:"Loading resources..."}),!f&&g.length===0&&e.jsx("div",{className:"text-center py-12 text-xs text-slate-400 italic",children:s==="zh"?"暂无资源,支持拖入或上传文件。":"No resources in library. Upload some above!"}),g.map(t=>{const r=o===t.id;return e.jsxs("div",{onClick:()=>c(t.id),className:`p-2.5 rounded-xl border flex justify-between items-center cursor-pointer transition-all ${r?"bg-indigo-50 border-indigo-200 shadow-xs":"bg-white border-slate-100 hover:border-slate-200 hover:shadow-2xs"}`,children:[e.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[e.jsx("span",{className:"text-base select-none",children:t.type==="folder"?"📁":"📄"}),e.jsxs("div",{className:"text-left min-w-0",children:[e.jsx("div",{className:"text-xs font-semibold text-gray-700 truncate font-sans",title:t.name,children:t.name}),e.jsxs("div",{className:"text-[9px] text-gray-400 mt-0.5 font-mono",children:[new Date(t.created_at).toLocaleDateString()," • ",t.id]})]})]}),e.jsx("button",{onClick:async i=>{i.stopPropagation(),confirm(s==="zh"?`确认删除资源 [${t.name}] 吗?`:`Delete resource [${t.name}]?`)&&(await fetch(`/api/resources/${t.id}`,{method:"DELETE"}),o===t.id&&c(null),x())},className:"p-1 hover:bg-red-50 text-slate-400 hover:text-red-500 rounded-md transition-colors cursor-pointer",title:"Delete",children:e.jsx($,{size:12,className:"shrink-0"})})]},t.id)})]})]}),e.jsx("div",{className:"flex-1 bg-white flex flex-col min-w-0",children:o?e.jsxs("div",{className:"flex-1 flex flex-col h-full min-h-0",children:[e.jsxs("div",{className:"p-3 border-b border-gray-100 bg-gray-50 flex items-center justify-between shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-bold text-gray-700 text-sm",children:s==="zh"?"交互沙箱应用预览:":"Sandbox Live Preview:"}),e.jsxs("span",{className:"text-xs bg-slate-200/70 text-slate-700 px-2 py-0.5 rounded font-mono",children:["/api/resources/",o,"/"]})]}),e.jsx("button",{onClick:()=>c(null),className:"text-xs text-indigo-600 hover:text-indigo-800 font-medium cursor-pointer",children:s==="zh"?"关闭预览":"Close Preview"})]}),e.jsx("div",{className:"flex-1 relative bg-slate-100/50",children:e.jsx("iframe",{src:`/api/resources/${o}/`,sandbox:"allow-scripts",className:"w-full h-full border-none bg-white font-sans",title:"Interactive Resource Preview"})})]}):e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center p-6 text-gray-400 bg-slate-50/50",children:[e.jsx(h,{size:48,className:"text-gray-300 mb-3 opacity-60"}),e.jsx("p",{className:"text-sm font-semibold text-gray-600",children:s==="zh"?"未选择资源进行预览":"No Resource Selected"}),e.jsx("p",{className:"text-xs text-center text-gray-400 mt-1 max-w-sm",children:s==="zh"?"请在左侧列表中点击选择要预览/管理的 HTML 单文件或完整 applet 文件夹,右侧即可进行沙箱实时运行。":"Click any resource in the list on the left to preview its interactive live sandbox iframe here."})]})})]})]})})})}export{H as SystemResourceLibraryModal};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CATki2cp.css"])))=>i.map(i=>d[i]);
2
+ import{_ as d}from"./vendor-pdf-CVyNPGVr.js";import{j as e,r as a}from"./vendor-react-0Lg0vA-4.js";import{u as j,a as v,E as ee,D as te}from"./index-BxA9vp--.js";import{a1 as se,a2 as ie,p as ne,P as oe,U as re,O as le,d as ae,j as y,S as de,s as ce,m as ue,l as xe}from"./vendor-icons-BvCtGbt1.js";import"./vendor-utils-4FcTwKPj.js";import"./vendor-motion-Dz5URUo4.js";import"./vendor-charts-B7ViBL9w.js";const me=t=>{if(t.status==="cancelled"||t.status==="holiday")return!1;if(!t.time_slot)return!0;try{const l=t.time_slot.split("-");if(l.length<2)return!0;const n=l[1].trim(),[s,i]=n.split(":").map(Number),o=new Date,r=o.getHours(),u=o.getMinutes();return!(r>s||r===s&&u>=i)}catch{return!0}};function he({mainNavCollapsed:t,setMainNavCollapsed:l,teacherTab:n,setTeacherTab:s,lang:i,session:o,todaySchedules:r}){const p=j(c=>c.extensionPoints).get("teacher.tab")||[];return v(c=>c.siteInfo),e.jsxs("div",{id:"navigation_sidebar",className:`${t?"w-16":"w-16 md:w-64"} bg-white border-r border-gray-200 flex flex-col transition-all duration-300`,children:[e.jsxs("div",{className:`p-2 flex border-b border-gray-150/60 ${t?"justify-center":"justify-between items-center px-4"} min-h-[48px] shrink-0`,children:[!t&&e.jsx("span",{className:"hidden md:inline text-[11px] font-black tracking-widest text-slate-400 uppercase select-none",children:i==="zh"?"系统导航":"NAVIGATION"}),e.jsx("button",{onClick:()=>l(!t),className:"p-1.5 rounded-lg hover:bg-slate-100 text-gray-500 hover:text-indigo-600 transition-colors cursor-pointer flex items-center justify-center shrink-0",title:t?i==="zh"?"展开导航":"Expand Sidebar":i==="zh"?"折叠导航":"Collapse Sidebar",children:t?e.jsx(se,{size:18}):e.jsx(ie,{size:18})})]}),e.jsxs("div",{className:`p-2 ${t?"md:p-2":"md:p-4"} flex flex-col gap-3 overflow-y-auto flex-1`,children:[e.jsx(g,{label:i==="zh"?"教学工具":"TEACHING",mainNavCollapsed:t}),e.jsx(m,{icon:ne,label:i==="zh"?"课程管理":"Courses",tab:"courses",teacherTab:n,setTeacherTab:s,mainNavCollapsed:t}),e.jsx(m,{icon:oe,label:i==="zh"?"互动课堂":"Live Class",tab:"live_class",teacherTab:n,setTeacherTab:s,mainNavCollapsed:t,highlight:!0}),e.jsx(m,{icon:re,label:i==="zh"?"班级管理":"Classes & Students",tab:"classes",teacherTab:n,setTeacherTab:s,mainNavCollapsed:t}),e.jsx(g,{label:i==="zh"?"系统管理":"SYSTEM MANAGEMENT",mainNavCollapsed:t}),e.jsx(m,{icon:le,label:i==="zh"?"课表管理":"Timetable Routine",tab:"timetable",teacherTab:n,setTeacherTab:s,mainNavCollapsed:t}),e.jsx(m,{icon:ae,label:i==="zh"?"机房管理":"Computer Lab Seating",tab:"computer_labs",teacherTab:n,setTeacherTab:s,mainNavCollapsed:t}),e.jsx(m,{icon:y,label:i==="zh"?"插件中心":"App Store / Plugins",tab:"plugins",teacherTab:n,setTeacherTab:s,mainNavCollapsed:t}),o?.subRole==="administrator"&&e.jsxs("button",{onClick:()=>s("admin_directory"),id:"nav_btn_admin_directory",className:`flex items-center gap-3 p-3 transition-colors text-sm font-medium text-indigo-700 hover:bg-indigo-50 border border-slate-200/50 rounded-xl ${n==="admin_directory"?"bg-indigo-50/70 border-indigo-200":"bg-slate-50/50"} ${t?"justify-center px-2":""}`,title:i==="zh"?"管理后台":"⭐ Admin Center",children:[e.jsx(de,{size:20,className:"shrink-0 text-indigo-600 animate-pulse"}),e.jsx("span",{className:t?"hidden":"hidden md:block font-bold text-indigo-850",children:i==="zh"?"管理后台":"⭐ Admin Center"})]}),p.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(g,{label:i==="zh"?"扩展应用":"EXTENSIONS",mainNavCollapsed:t}),e.jsx(ee,{slot:"teacher.tab",slotProps:{renderType:"button",mainNavCollapsed:t,teacherTab:n,setTeacherTab:s}})]}),e.jsx(g,{label:i==="zh"?"帮助与支持":"HELP & SUPPORT",mainNavCollapsed:t}),e.jsx(m,{icon:ce,label:i==="zh"?"帮助文档":"System Commands / Help",tab:"help",teacherTab:n,setTeacherTab:s,mainNavCollapsed:t})]}),(()=>{const c=r.filter(me),h=c.length;return t||r.length===0?null:e.jsxs("div",{className:"mt-auto p-3 m-3 bg-indigo-50/55 rounded-xl border border-indigo-105 hidden md:block select-none shadow-3xs",id:"today_schedule_sidebar_panel",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-bold text-indigo-700 mb-1.5",children:[e.jsx(ue,{size:12,className:"text-indigo-600 animate-pulse shrink-0"}),i==="zh"?"本堂余课":"Classes Remaining"]}),e.jsx("div",{className:"text-[11px] text-gray-500 mb-2",children:i==="zh"?`今天还有 ${h} 节课面授`:`${h} more classes left today`}),c.length>0&&e.jsx("div",{className:"max-h-[140px] overflow-y-auto space-y-1 pr-1",children:c.map(x=>e.jsxs("div",{className:"text-[10px] p-1.5 bg-white rounded border border-indigo-100/60 shadow-3xs hover:border-indigo-200 transition-colors",children:[e.jsx("div",{className:"font-bold text-gray-750 truncate",title:x.lesson_title,children:x.lesson_title}),e.jsxs("div",{className:"text-[9px] text-gray-450 truncate flex justify-between mt-0.5",children:[e.jsx("span",{className:"font-medium text-slate-500 truncate max-w-[60px]",children:x.class_name}),e.jsx("span",{className:"font-mono text-indigo-700 font-semibold",children:x.time_slot})]})]},x.id))})]})})()]})}function g({label:t,mainNavCollapsed:l}){return l?e.jsx("div",{className:"h-px bg-gray-200 my-1 w-full"}):e.jsx("div",{className:"px-3 pt-2 text-[10px] font-bold text-slate-400 tracking-wider uppercase hidden md:block select-none",children:t})}function m({icon:t,label:l,tab:n,teacherTab:s,setTeacherTab:i,mainNavCollapsed:o,highlight:r}){const u=s===n;return e.jsxs("button",{onClick:()=>i(n),id:`nav_btn_${n}`,className:`flex items-center gap-3 p-3 transition-colors text-sm font-medium rounded-xl ${u?"bg-indigo-50 text-indigo-700 font-bold"+(r?" shadow-sm border border-indigo-100":""):"text-gray-600 hover:bg-gray-50"} ${o?"justify-center px-2":""}`,title:l,children:[e.jsx(t,{size:20,className:`shrink-0 ${r&&!u?"text-indigo-550":""}`}),e.jsx("span",{className:o?"hidden":"hidden md:block",children:l})]})}function fe({component:t}){const l=t;return e.jsx(l,{renderType:"panel"})}function pe({activeNavPlugin:t}){const l=j(r=>r.extensionPoints),n=v(r=>r.lang),s=l.get("teacher.tab")||[],i=t||(s.length>0?s[0].pluginId:null),o=s.find(r=>r.pluginId===i);return e.jsx("div",{className:"flex-1 flex flex-col min-h-0",children:e.jsx("div",{className:"flex-1 overflow-auto",children:o?.component?e.jsx(fe,{component:o.component}):o&&typeof o.render=="function"?e.jsx(te,{ext:o,slot:"teacher.tab",slotProps:{renderType:"panel"}}):e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsxs("div",{className:"text-center",children:[e.jsx(y,{size:48,className:"mx-auto text-gray-300 mb-3"}),e.jsx("p",{className:"text-sm text-gray-400 font-medium",children:n==="zh"?"此插件未提供页面组件":"This plugin has no page component"}),e.jsx("p",{className:"text-xs text-gray-300 mt-1",children:n==="zh"?"插件已注册导航条目,但未提供对应的界面渲染逻辑。":"The plugin registered a navigation entry but did not provide a render component."})]})})})})}const ge=a.lazy(()=>d(()=>import("./Dashboard-BnF7YAQi.js"),__vite__mapDeps([0])).then(t=>({default:t.Dashboard}))),be=a.lazy(()=>d(()=>import("./LessonEditorView-C0czhtmf.js"),__vite__mapDeps([0])).then(t=>({default:t.LessonEditorView}))),_e=a.lazy(()=>d(()=>import("./LiveClassroomView-CrTY3jhP.js"),__vite__mapDeps([0])).then(t=>({default:t.LiveClassroomView}))),je=a.lazy(()=>d(()=>import("./PluginView-QS2b6nSF.js"),__vite__mapDeps([0])).then(t=>({default:t.PluginView}))),ve=a.lazy(()=>d(()=>import("./CourseManagement-DSCOjuIC.js"),[]).then(t=>({default:t.CourseManagement}))),ye=a.lazy(()=>d(()=>import("./ClassesView-Cxgfcrx1.js"),[]).then(t=>({default:t.ClassesView}))),we=a.lazy(()=>d(()=>import("./TimetableView-zce3okQn.js"),[]).then(t=>({default:t.TimetableView}))),ze=a.lazy(()=>d(()=>import("./AdminDirectoryView-Cai0cQqi.js"),[]).then(t=>({default:t.AdminDirectoryView}))),Ee=a.lazy(()=>d(()=>import("./ComputerLabView-CUCO2VIV.js"),[]).then(t=>({default:t.ComputerLabView}))),Se=a.lazy(()=>d(()=>import("./HelpView-BP581QYZ.js"),__vite__mapDeps([0])).then(t=>({default:t.HelpView})));function Re(t){const{mainNavCollapsed:l,setMainNavCollapsed:n,teacherTab:s,setTeacherTab:i,lang:o,session:r,todaySchedules:u,socketRef:p,setShowCoursewareHub:c,selectedLesson:h,setSelectedLesson:x,classStudentsMap:w,lessons:b,classes:_,plugins:z,timelineSegments:E,activeSegmentId:S,setActiveSegmentId:P,liveClassSelectedClassId:f,setLiveClassSelectedClassId:L,liveClassIsActive:A,setLiveClassIsActive:N,liveClassTimeRemaining:V,setLiveClassTimeRemaining:C,liveClassFeed:I,setLiveClassFeed:R,liveClassAcknowledgedMap:k,setLiveClassAcknowledgedMap:D,elements:O,fetchElements:M,addToast:T,onlineStudentIds:H,activeStudentLessons:$,liveClassStudentProgress:U,fetchStudents:G,fetchClassStudents:F,activeRole:B,setActiveRole:Q,onRefresh:W,computerLabs:X,fetchTodaySchedules:Y,fetchRegisteredCommands:q,registeredCommands:J}=t;return e.jsxs("div",{className:"flex-1 overflow-hidden flex bg-gray-50",children:[e.jsx(he,{mainNavCollapsed:l,setMainNavCollapsed:n,teacherTab:s,setTeacherTab:i,lang:o,session:r,todaySchedules:u}),e.jsxs("div",{className:"flex-1 p-6 overflow-hidden flex gap-6 relative",children:[["dashboard","lesson_editor","live_class","plugins","courses","classes","timetable","admin_directory","help","computer_labs"].includes(s)?null:e.jsx(pe,{activeNavPlugin:s.includes("/")?s.split("/")[0]:null}),e.jsx(a.Suspense,{fallback:e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center min-h-[400px] text-slate-400 gap-3",children:[e.jsx(xe,{className:"w-8 h-8 animate-spin text-indigo-500"}),e.jsx("span",{className:"text-sm font-medium",children:"加载视图中..."})]}),children:s==="dashboard"?e.jsx(ge,{...t}):s==="lesson_editor"?e.jsx(be,{...t}):s==="live_class"?e.jsx("div",{className:"flex-grow flex-1 flex flex-col min-h-0 min-w-0",children:e.jsx(_e,{selectedLesson:h,setSelectedLesson:x,lessons:b,classes:_,students:f?w[f]||[]:[],plugins:z,lang:o,timelineSegments:E,activeSegmentId:S,setActiveSegmentId:P,liveClassSelectedClassId:f,setLiveClassSelectedClassId:L,liveClassIsActive:A,setLiveClassIsActive:N,liveClassTimeRemaining:V,setLiveClassTimeRemaining:C,liveClassFeed:I,setLiveClassFeed:R,liveClassAcknowledgedMap:k,setLiveClassAcknowledgedMap:D,elements:O,fetchElements:M,fetchStudents:async()=>{await G(),f&&await F(f)},addToast:T,onlineStudentIds:H,activeStudentLessons:$,liveClassStudentProgress:U,onPingStudent:(K,Z)=>{p.current&&p.current.emit("teacher-ping-student",{studentId:K,lessonId:h,message:Z})},onOpenCoursewareHub:()=>c(!0),activeRole:B,setActiveRole:Q})}):s==="plugins"?e.jsx(je,{...t}):s==="courses"?e.jsx(ve,{...t}):s==="classes"?e.jsx(ye,{...t}):s==="timetable"?e.jsx(we,{classes:_,lessons:b,lang:o,onSchedulesUpdated:Y}):s==="admin_directory"?e.jsx(ze,{...t}):s==="computer_labs"?e.jsx(Ee,{computerLabs:X,onRefresh:W,lang:o}):s==="help"?e.jsx(Se,{registeredCommands:J,onRefresh:q}):null})]})]})}export{Re as TeacherView};
@@ -0,0 +1,6 @@
1
+ import{j as e,r as c}from"./vendor-react-0Lg0vA-4.js";import{E as qt,aT as Zt,aU as Ue,aL as Xt,ad as Qt,X as be,a6 as mt,l as Ie,aV as De,aW as Te,aa as dt,a2 as es,Z as ts,f as Ae,m as ct,a4 as ss,aX as xt,a3 as ls,C as rs,aY as as,aZ as os,J as is,a_ as ht,af as ns,g as Be,x as ds,O as cs}from"./vendor-icons-BvCtGbt1.js";const xs=l=>{const b=[];for(let r=0;r<7;r++){const N=new Date(l.getTime()+r*24*60*60*1e3),T=N.getFullYear(),v=String(N.getMonth()+1).padStart(2,"0"),I=String(N.getDate()).padStart(2,"0");b.push(`${T}-${v}-${I}`)}return b},ut=l=>{if(!l)return!1;const b=l.match(/^(\d{1,2}):(\d{2})/);return b?parseInt(b[1],10)>=12:!1},hs=({lang:l,viewMode:b,setViewMode:r,selectedClassId:N,setSelectedClassId:T,statusFilter:v,setStatusFilter:I,searchQuery:G,setSearchQuery:B,classes:P,getClassDisplayName:U,loading:C,filteredSchedules:E,currentWeekMonday:X,setCurrentWeekMonday:O,showWeekend:ae,setShowWeekend:Q,dateOverrides:L,setDateOverrides:J,setOverridingDateKey:F,setOverrideMode:k,setOverrideTargetDow:ie,setOverrideTargetDate:ee,openEditModal:xe,handleDeleteSchedule:he,getDayOfWeekIndex:$,getMonday:ne,getWeekRangeString:p,setFormClassId:W,setFormLessonId:te,setFormDate:ve,setFormStatus:Y,setFormNotes:de,setIsAddOpen:se})=>{const M=[{key:1,label:l==="zh"?"周一 (Mon)":"Mon"},{key:2,label:l==="zh"?"周二 (Tue)":"Tue"},{key:3,label:l==="zh"?"周三 (Wed)":"Wed"},{key:4,label:l==="zh"?"周四 (Thu)":"Thu"},{key:5,label:l==="zh"?"周五 (Fri)":"Fri"},{key:6,label:l==="zh"?"周六 (Sat)":"Sat"},{key:7,label:l==="zh"?"周日 (Sun)":"Sun"}],le=xs(X),K=a=>{const x=a.status==="cancelled"||a.status==="holiday";let h="border-l-green-500 bg-green-50/5 hover:bg-green-50/10 hover:border-l-green-600";return a.status==="cancelled"?h="border-l-red-500 bg-red-50/5 hover:bg-red-50/10 hover:border-l-red-600":a.status==="holiday"?h="border-l-amber-500 bg-amber-50/5 hover:bg-amber-50/10 hover:border-l-amber-600":a.status==="swap"&&(h="border-l-blue-500 bg-blue-50/5 hover:bg-blue-50/10 hover:border-l-blue-600"),e.jsxs("div",{className:`p-2.5 rounded-xl border border-slate-150 border-l-4 ${h} transition-all hover:shadow-xs relative group flex flex-col justify-between min-h-[85px]`,children:[e.jsxs("div",{children:[e.jsxs("div",{className:"text-[9px] font-mono text-slate-500 mb-1 font-bold flex justify-between items-center",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ct,{size:11,className:"text-slate-400"}),a.time_slot||(l==="zh"?"全天":"All-day")]}),b==="cycle"&&e.jsx("span",{className:"text-[8px] text-slate-400 font-sans font-normal bg-slate-100 px-1 py-0.5 rounded-sm",children:a.scheduled_date})]}),e.jsx("div",{className:`font-extrabold text-sm text-slate-805 tracking-tight leading-snug mt-1 ${x?"line-through opacity-60 text-slate-400":""}`,title:a.lesson_title||"",children:a.class_name}),a.notes&&e.jsxs("div",{className:"text-[9px] text-amber-600 font-medium mt-1 truncate",title:a.notes,children:["📌 ",a.notes]})]}),e.jsxs("div",{className:"flex items-center justify-between mt-2.5 pt-2 border-t border-slate-100/50",children:[e.jsx("span",{className:`inline-block text-[8px] px-1.5 py-0.5 rounded-full font-bold uppercase tracking-wide border ${a.status==="cancelled"?"bg-red-50 border-red-100 text-red-600":a.status==="holiday"?"bg-amber-50 border-amber-100 text-amber-600":a.status==="swap"?"bg-blue-50 border-blue-100 text-blue-600":"bg-green-50 border-green-100 text-green-600"}`,children:a.status==="cancelled"?l==="zh"?"停课":"Cancelled":a.status==="holiday"?l==="zh"?"假期":"Holiday":a.status==="swap"?l==="zh"?"代课":"Swapped":l==="zh"?"正常":"Active"}),e.jsxs("div",{className:"flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[e.jsx("button",{onClick:()=>xe(a),className:"text-slate-400 hover:text-indigo-600 hover:bg-indigo-50 p-1 rounded-md transition-colors cursor-pointer",title:l==="zh"?"微调":"Edit",children:e.jsx(Te,{size:11})}),e.jsx("button",{onClick:()=>he(a.id,a.class_id,a.isRepeating,a.scheduled_date),className:"text-slate-400 hover:text-red-600 hover:bg-red-50 p-1 rounded-md transition-colors cursor-pointer",title:l==="zh"?"删除":"Delete",children:e.jsx(dt,{size:11})})]})]})]},a.id)},Pe=(a,x)=>{if(a===x){const f=E.filter(g=>g.scheduled_date===x);if(f.length>0)return f;const j=$(x),D=E.filter(g=>$(g.scheduled_date)===j&&g.scheduled_date<=x),y={};return D.forEach(g=>{const H=`${g.class_id}_${g.time_slot||"all-day"}`;y[H]||(y[H]={...g,scheduled_date:x,isRepeating:!0})}),Object.values(y)}let h=[];if(a.startsWith("dow-")){const f=parseInt(a.split("-")[1],10),j=E.filter(y=>$(y.scheduled_date)===f&&y.scheduled_date<=x),D={};j.forEach(y=>{const g=`${y.class_id}_${y.time_slot||"all-day"}`;D[g]||(D[g]={...y,scheduled_date:x,isRepeating:!0})}),h=Object.values(D)}else{const f=E.filter(j=>j.scheduled_date===a);if(f.length>0)h=f.map(j=>({...j,scheduled_date:x,isRepeating:!0}));else{const j=$(a),D=E.filter(g=>$(g.scheduled_date)===j&&g.scheduled_date<=a),y={};D.forEach(g=>{const H=`${g.class_id}_${g.time_slot||"all-day"}`;y[H]||(y[H]={...g,scheduled_date:x,isRepeating:!0})}),h=Object.values(y)}}const S=E.filter(f=>f.scheduled_date===x);if(S.length>0){const f=[...h];return S.forEach(j=>{const D=`${j.class_id}_${j.time_slot||"all-day"}`,y=f.findIndex(g=>`${g.class_id}_${g.time_slot||"all-day"}`===D);y!==-1?f[y]=j:j.status!=="cancelled"&&j.status!=="holiday"&&f.push(j)}),f}return h},ue=M.map((a,x)=>{const h=le[x],S=L[h]||h,f=Pe(S,h);return f.sort((j,D)=>(j.time_slot||"").localeCompare(D.time_slot||"")),{...a,dateStr:h,displayLabel:l==="zh"?`${a.label.split(" ")[0]} (${h.substring(5)})`:`${a.label} (${h.substring(5)})`,schedules:f}}),re=M.map(a=>{const x=le[a.key-1],h=E.filter(S=>$(S.scheduled_date)===a.key);return h.sort((S,f)=>(S.time_slot||"").localeCompare(f.time_slot||"")),{...a,dateStr:x,displayLabel:a.label,schedules:h}}),V=(b==="week"?ue:re).filter(a=>b==="week"&&!ae?a.key!==6&&a.key!==7:!0);return e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"bg-slate-50 border border-slate-200/50 p-3 rounded-xl flex flex-wrap gap-3 items-center justify-between",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("span",{className:"text-xs font-bold text-gray-500 flex items-center gap-1",children:[e.jsx(qt,{size:13}),l==="zh"?"筛选:":"Filters:"]}),e.jsxs("div",{className:"flex bg-slate-200/70 p-0.5 rounded-lg border border-slate-300/30 shadow-xs mr-2 shrink-0",children:[e.jsxs("button",{onClick:()=>r("week"),className:`px-2.5 py-1 rounded-lg text-[10px] font-bold transition-all flex items-center gap-1 ${b==="week"?"bg-white text-indigo-700 shadow-xs":"text-gray-500 hover:text-gray-800"}`,children:[e.jsx(Zt,{size:11}),l==="zh"?"周课表":"Week View"]}),e.jsxs("button",{onClick:()=>r("cycle"),className:`px-2.5 py-1 rounded-lg text-[10px] font-bold transition-all flex items-center gap-1 ${b==="cycle"?"bg-white text-indigo-700 shadow-xs":"text-gray-500 hover:text-gray-800"}`,children:[e.jsx(Ue,{size:11}),l==="zh"?"星期总览":"Cycle View"]}),e.jsxs("button",{onClick:()=>r("list"),className:`px-2.5 py-1 rounded-lg text-[10px] font-bold transition-all flex items-center gap-1 ${b==="list"?"bg-white text-indigo-700 shadow-xs":"text-gray-500 hover:text-gray-800"}`,children:[e.jsx(Xt,{size:11}),l==="zh"?"列表":"List View"]})]}),e.jsxs("select",{id:"timetable_class_select",title:"Select Class",className:"bg-white border border-gray-200 rounded-lg text-xs py-1.5 px-2 text-gray-700 focus:outline-hidden focus:ring-1 focus:ring-indigo-500 font-sans cursor-pointer",value:N,onChange:a=>T(a.target.value),children:[e.jsx("option",{value:"all",children:l==="zh"?"所有班级 (All Classes)":"All Classes"}),P.map(a=>e.jsx("option",{value:a.id,children:U(a.name)},a.id))]}),e.jsxs("select",{id:"timetable_status_select",title:"Select Status",className:"bg-white border border-gray-200 rounded-lg text-xs py-1.5 px-2 text-gray-700 focus:outline-hidden focus:ring-1 focus:ring-indigo-500 font-sans cursor-pointer",value:v,onChange:a=>I(a.target.value),children:[e.jsx("option",{value:"all",children:l==="zh"?"所有状态 (All Status)":"All Status"}),e.jsx("option",{value:"scheduled",children:l==="zh"?"正常上课 (Scheduled)":"Scheduled"}),e.jsx("option",{value:"cancelled",children:l==="zh"?"停课 (Cancelled)":"Cancelled"}),e.jsx("option",{value:"holiday",children:l==="zh"?"假期调休 (Holiday)":"Holiday"}),e.jsx("option",{value:"swap",children:l==="zh"?"代课换课 (Swapped)":"Swapped"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-1 max-w-xs min-w-[200px]",children:[e.jsxs("div",{className:"relative w-full",children:[e.jsx(Qt,{className:"absolute left-2.5 top-2 text-gray-400",size:14}),e.jsx("input",{type:"text",placeholder:l==="zh"?"检索课程标题, 班级, 备注...":"Search title, class, notes...",className:"w-full bg-white border border-gray-200 rounded-lg pl-8 pr-2.5 py-1.5 text-xs text-gray-700 focus:outline-hidden focus:ring-1 focus:ring-indigo-500",value:G,onChange:a=>B(a.target.value)}),G&&e.jsx("button",{onClick:()=>B(""),className:"absolute right-2.5 top-2 text-gray-400 hover:text-gray-600",children:e.jsx(be,{size:14})})]}),e.jsxs("button",{onClick:()=>{W(P[0]?.id||""),te(""),ve(new Date().toISOString().split("T")[0]),Y("scheduled"),de(""),se(!0)},className:"bg-indigo-600 hover:bg-indigo-700 text-white font-semibold text-xs py-1.5 px-3 rounded-lg flex items-center gap-1 shadow-sm shrink-0 cursor-pointer transition-all",children:[e.jsx(mt,{size:14}),l==="zh"?"排定课时":"Schedule Class"]})]})]}),C?e.jsxs("div",{className:"flex flex-col items-center justify-center py-20 text-indigo-500",children:[e.jsx(Ie,{className:"animate-spin mb-2",size:32}),e.jsx("span",{className:"text-xs font-semibold",children:l==="zh"?"查询数据中...":"Accessing SQLite Database..."})]}):E.length===0?e.jsxs("div",{className:"text-center py-16 bg-slate-50/50 border border-dashed rounded-xl border-slate-200 flex flex-col items-center",children:[e.jsx(De,{className:"text-gray-300 mb-2",size:40}),e.jsx("p",{className:"text-gray-500 text-sm font-semibold",children:l==="zh"?"暂未匹配到对应的课次安排数据":"No schedules match your filters"}),e.jsx("p",{className:"text-gray-400 text-xs mt-1",children:l==="zh"?"您可以点击右上角“排定课时”为班级新增课程。":"Try adding a new entry using the schedule button above."})]}):b==="list"?e.jsx("div",{className:"border border-slate-200 rounded-xl overflow-hidden shadow-2xs",children:e.jsxs("table",{className:"w-full text-left border-collapse table-auto text-sm bg-white",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-slate-50 border-b border-slate-200 text-gray-600 font-semibold text-xs",children:[e.jsx("th",{className:"p-3 w-[15%]",children:l==="zh"?"上课日期":"Date"}),e.jsx("th",{className:"p-3 w-[15%]",children:l==="zh"?"具体时间段":"Time Slot"}),e.jsx("th",{className:"p-3 w-[20%]",children:l==="zh"?"关联班级":"Class"}),e.jsx("th",{className:"p-3 w-[25%]",children:l==="zh"?"授课内容主题":"Lesson Topic"}),e.jsx("th",{className:"p-3 w-[10%] text-center",children:l==="zh"?"日常状态":"Status"}),e.jsx("th",{className:"p-3 w-[15%] text-right",children:l==="zh"?"教务微调":"Actions"})]})}),e.jsx("tbody",{className:"divide-y divide-slate-150",children:E.map(a=>{const x=a.status==="cancelled"||a.status==="holiday";return e.jsxs("tr",{className:`hover:bg-slate-50/80 transition-colors ${x?"bg-red-50/10 text-gray-400":"text-gray-700"}`,children:[e.jsx("td",{className:"p-3 font-semibold text-xs",children:e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(De,{size:13,className:"text-slate-400"}),a.scheduled_date]})}),e.jsx("td",{className:"p-3 font-mono text-xs text-indigo-750",children:a.time_slot||e.jsx("span",{className:"text-[10px] text-gray-300 italic",children:l==="zh"?"全天":"All-day"})}),e.jsx("td",{className:"p-3 text-xs",children:e.jsx("span",{className:"bg-slate-100 text-slate-800 px-2 py-1 rounded-md border border-slate-250 font-medium",children:a.class_name})}),e.jsx("td",{className:"p-3",children:e.jsxs("div",{className:"flex flex-col leading-snug",children:[e.jsx("span",{className:`font-semibold ${x?"line-through opacity-70":""}`,children:a.lesson_title}),a.notes&&e.jsxs("span",{className:`text-[10px] italic mt-0.5 ${a.status==="holiday"?"text-amber-600 font-medium":a.status==="cancelled"?"text-red-500 font-medium":"text-slate-400"}`,children:["📌 ",a.notes]})]})}),e.jsx("td",{className:"p-3 text-center",children:e.jsx("span",{className:`inline-block text-[10px] px-2 py-0.5 rounded-full font-bold uppercase tracking-wide border ${a.status==="cancelled"?"bg-red-100 border-red-200 text-red-700":a.status==="holiday"?"bg-amber-100 border-amber-200 text-amber-700":a.status==="swap"?"bg-blue-100 border-blue-200 text-blue-700":"bg-green-100 border-green-200 text-green-700"}`,children:a.status==="cancelled"?l==="zh"?"停课":"Cancelled":a.status==="holiday"?l==="zh"?"假期调休":"Holiday":a.status==="swap"?l==="zh"?"换代课":"Swapped":l==="zh"?"正常上课":"Active"})}),e.jsx("td",{className:"p-3 text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-1.5",children:[e.jsx("button",{onClick:()=>xe(a),className:"text-slate-500 hover:text-indigo-600 hover:bg-indigo-50 p-1.5 rounded transition-colors cursor-pointer",title:l==="zh"?"调整此节课排课 (换课/换时间/写备注)":"Adjust this class (Swap/Edit)",children:e.jsx(Te,{size:13})}),e.jsx("button",{onClick:()=>he(a.id,a.class_id),className:"text-slate-500 hover:text-red-600 hover:bg-red-50 p-1.5 rounded transition-colors cursor-pointer",title:l==="zh"?"永久删除该课课表":"Delete schedule",children:e.jsx(dt,{size:13})})]})})]},a.id)})})]})}):e.jsxs("div",{className:"flex flex-col gap-4",children:[b==="week"&&e.jsxs("div",{className:"flex flex-col md:flex-row items-center justify-between bg-indigo-50/40 border border-indigo-100/60 p-3 rounded-xl gap-3 shadow-2xs",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>O(a=>new Date(a.getTime()-10080*60*1e3)),className:"p-1.5 rounded-lg hover:bg-indigo-100 hover:text-indigo-700 text-indigo-600 transition-all cursor-pointer border border-indigo-200/50 bg-white shadow-2xs flex items-center justify-center",title:l==="zh"?"上一周":"Previous Week",children:e.jsx(es,{size:16})}),e.jsx("button",{onClick:()=>O(ne(new Date)),className:"px-3 py-1.5 rounded-lg hover:bg-indigo-100 hover:text-indigo-700 text-indigo-600 transition-all cursor-pointer text-xs font-bold border border-indigo-200/50 bg-white shadow-2xs",children:l==="zh"?"本周":"This Week"}),e.jsx("button",{onClick:()=>O(a=>new Date(a.getTime()+10080*60*1e3)),className:"p-1.5 rounded-lg hover:bg-indigo-100 hover:text-indigo-700 text-indigo-600 transition-all cursor-pointer border border-indigo-200/50 bg-white shadow-2xs flex items-center justify-center",title:l==="zh"?"下一周":"Next Week",children:e.jsx(ts,{size:16})})]}),e.jsxs("div",{className:"text-sm font-bold text-indigo-900 flex items-center gap-2",children:[e.jsx(De,{size:16,className:"text-indigo-500"}),e.jsx("span",{children:p(X)})]}),e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-indigo-700 font-semibold",children:l==="zh"?"跳转日期:":"Go to Date:"}),e.jsx("input",{type:"date",title:"Go to Date",className:"bg-white border border-indigo-200 rounded-lg text-xs py-1 px-2 text-indigo-950 focus:outline-hidden focus:ring-1 focus:ring-indigo-500 font-sans cursor-pointer",onChange:a=>{a.target.value&&O(ne(new Date(a.target.value)))}})]}),e.jsx("div",{className:"flex items-center gap-2 border-l border-indigo-150 pl-3",children:e.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-indigo-700 font-semibold cursor-pointer select-none",children:[e.jsx("input",{type:"checkbox",checked:ae,onChange:a=>Q(a.target.checked),className:"w-3.5 h-3.5 text-indigo-600 border-indigo-300 rounded-sm focus:ring-indigo-500 focus:outline-hidden cursor-pointer"}),l==="zh"?"显示周末":"Show Weekend"]})})]})]}),e.jsx("div",{className:"w-full overflow-x-auto pb-2",children:e.jsxs("div",{className:"flex flex-col gap-4 min-w-[1050px]",children:[e.jsx("div",{className:`grid ${V.length===5?"grid-cols-5":"grid-cols-7"} gap-4`,children:V.map(a=>e.jsxs("div",{className:"bg-slate-50 border border-slate-200/50 rounded-xl p-3 text-center flex flex-col items-center justify-center gap-1 relative group/col",children:[e.jsxs("div",{className:"flex items-center justify-center gap-1.5 w-full",children:[e.jsx("span",{className:"font-extrabold text-xs text-indigo-700 uppercase tracking-wider",children:a.displayLabel}),b==="week"&&e.jsx("button",{onClick:()=>{const x=L[a.dateStr]||"";F(a.dateStr),x.startsWith("dow-")?(k("dow"),ie(x.split("-")[1]),ee("")):x?(k("date"),ee(x),ie("")):(k("dow"),ie(""),ee(""))},className:"text-slate-400 hover:text-indigo-600 p-0.5 rounded-md hover:bg-slate-200/50 transition-all opacity-0 group-hover/col:opacity-100 focus:opacity-100 cursor-pointer flex items-center justify-center",title:l==="zh"?"临时切换显示日期":"Temporarily switch date",children:e.jsx(Te,{size:10})})]}),b==="week"&&L[a.dateStr]&&(()=>{const x=L[a.dateStr];let h="";if(x.startsWith("dow-")){const S=parseInt(x.split("-")[1],10);h=l==="zh"?`常规${["","周一","周二","周三","周四","周五","周六","周日"][S]}`:`Regular ${["","Mon","Tue","Wed","Thu","Fri","Sat","Sun"][S]}`}else h=x.substring(5);return e.jsxs("div",{className:"flex items-center gap-1 bg-amber-50 border border-amber-200 text-amber-700 text-[9px] px-1.5 py-0.5 rounded-md font-semibold select-none shadow-3xs animate-fade-in",children:[e.jsxs("span",{children:["🔄 ",h]}),e.jsx("button",{onClick:()=>{const S={...L};delete S[a.dateStr],J(S)},className:"hover:text-red-600 hover:bg-amber-100 rounded-sm p-px flex items-center justify-center cursor-pointer",title:l==="zh"?"恢复原日期课程":"Reset to original",children:e.jsx(be,{size:8})})]})})()]},`header-${a.key}`))}),e.jsxs("div",{className:"bg-slate-50/30 border border-slate-200/50 rounded-2xl p-3 flex flex-col gap-2.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-[9px] font-bold text-sky-600 bg-sky-50 px-2 py-0.5 rounded-lg w-fit select-none border border-sky-100/60 shadow-3xs",children:[e.jsx(Ae,{size:10,className:"animate-pulse"}),l==="zh"?"上午课程 (AM)":"Morning (AM)"]}),e.jsx("div",{className:`grid ${V.length===5?"grid-cols-5":"grid-cols-7"} gap-4`,children:V.map(a=>{const x=a.schedules.filter(h=>!ut(h.time_slot));return e.jsx("div",{className:"flex flex-col gap-2 bg-white/40 p-2.5 rounded-xl border border-dashed border-slate-200/60 min-h-[160px] justify-start",children:x.length===0?e.jsx("div",{className:"flex-1 flex items-center justify-center text-[10px] text-slate-350 italic text-center p-3 border border-dashed border-slate-150 rounded-xl bg-white/30 select-none",children:l==="zh"?"无课":"Free"}):x.map(h=>K(h))},`morning-col-${a.key}`)})})]}),e.jsxs("div",{className:"relative my-2 flex items-center justify-center",children:[e.jsx("div",{className:"absolute inset-0 flex items-center","aria-hidden":"true",children:e.jsx("div",{className:"w-full border-t-2 border-dashed border-slate-200/80"})}),e.jsxs("div",{className:"relative flex justify-center text-[9px] font-extrabold uppercase tracking-wider text-slate-400 bg-white px-4 py-1.5 rounded-full border border-slate-200/60 shadow-3xs",children:["☕ ",l==="zh"?"午休时间 / Midday Break":"Lunch Break"]})]}),e.jsxs("div",{className:"bg-slate-50/30 border border-slate-200/50 rounded-2xl p-3 flex flex-col gap-2.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-[9px] font-bold text-amber-600 bg-amber-50 px-2 py-0.5 rounded-lg w-fit select-none border border-amber-100/60 shadow-3xs",children:[e.jsx(ct,{size:10}),l==="zh"?"下午课程 (PM)":"Afternoon (PM)"]}),e.jsx("div",{className:`grid ${V.length===5?"grid-cols-5":"grid-cols-7"} gap-4`,children:V.map(a=>{const x=a.schedules.filter(h=>ut(h.time_slot));return e.jsx("div",{className:"flex flex-col gap-2 bg-white/40 p-2.5 rounded-xl border border-dashed border-slate-200/60 min-h-[160px] justify-start",children:x.length===0?e.jsx("div",{className:"flex-1 flex items-center justify-center text-[10px] text-slate-350 italic text-center p-3 border border-dashed border-slate-150 rounded-xl bg-white/30 select-none",children:l==="zh"?"无课":"Free"}):x.map(h=>K(h))},`afternoon-col-${a.key}`)})})]})]})})]})]})},us=({lang:l,holStartDate:b,setHolStartDate:r,holEndDate:N,setHolEndDate:T,holType:v,setHolType:I,holNotes:G,setHolNotes:B,handleBatchHolidayAdjustment:P,loading:U})=>e.jsxs("div",{className:"max-w-2xl mx-auto bg-slate-50/50 border border-slate-200 rounded-2xl p-6 shadow-3xs",children:[e.jsxs("h2",{className:"text-base font-bold text-slate-800 flex items-center gap-2 border-b border-slate-200 pb-3 mb-4",children:[e.jsx(Ae,{className:"text-amber-500 shrink-0",size:18}),l==="zh"?"批量节假日调休排班":"Holiday / Cancellation Scheduler"]}),e.jsx("p",{className:"text-xs text-gray-500 mb-5",children:l==="zh"?"此工具能快速把选定日期范围内的课程一键设为“假期调休”或“统一停课”,避免讲师依次手动调整,极大提高教务效率。":"Instantly cancel or exclude classes falling within a holiday or default break period."}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-semibold text-gray-700 mb-1.5",children:l==="zh"?"开始日期 *":"Start Date *"}),e.jsx("input",{type:"date",className:"w-full border border-gray-200 rounded-lg text-xs p-2.5 bg-white focus:outline-hidden focus:ring-1 focus:ring-indigo-500 transition-all font-sans text-gray-750",value:b,onChange:C=>r(C.target.value)})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-semibold text-gray-700 mb-1.5",children:l==="zh"?"结束日期 *":"End Date *"}),e.jsx("input",{type:"date",className:"w-full border border-gray-200 rounded-lg text-xs p-2.5 bg-white focus:outline-hidden focus:ring-1 focus:ring-indigo-500 transition-all font-sans text-gray-750",value:N,onChange:C=>T(C.target.value)})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-semibold text-gray-700 mb-1.5",children:l==="zh"?"调整状态标签":"Target Status"}),e.jsxs("div",{className:"flex gap-4",children:[e.jsxs("label",{className:"flex items-center gap-2 text-xs font-medium text-slate-700 cursor-pointer",children:[e.jsx("input",{type:"radio",name:"holType",checked:v==="holiday",onChange:()=>I("holiday"),className:"accent-indigo-600 cursor-pointer"}),"🏝️ ",l==="zh"?"假期调休 (Holiday)":"Holiday Exclusion"]}),e.jsxs("label",{className:"flex items-center gap-2 text-xs font-medium text-slate-700 cursor-pointer",children:[e.jsx("input",{type:"radio",name:"holType",checked:v==="cancelled",onChange:()=>I("cancelled"),className:"accent-red-600 cursor-pointer"}),"🛑 ",l==="zh"?"异常停课 (Cancelled)":"Suspicious Cancellation"]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-semibold text-gray-700 mb-1.5",children:l==="zh"?"假日说明 / 停课备注":"Exclusion Note / Reason"}),e.jsx("input",{type:"text",placeholder:l==="zh"?"例: 国庆节假期停课调休 / 因极寒气象全市停课":"e.g., National Day break / weather closures",className:"w-full border border-gray-200 rounded-lg text-xs p-2.5 bg-white focus:outline-hidden focus:ring-1 focus:ring-indigo-500 transition-all",value:G,onChange:C=>B(C.target.value)})]}),e.jsxs("button",{onClick:P,disabled:U,className:"w-full bg-slate-800 hover:bg-slate-900 text-white font-bold text-xs py-2.5 rounded-xl cursor-pointer transition-all flex items-center justify-center gap-1.5 shadow-sm disabled:opacity-50",children:[U?e.jsx(Ie,{className:"animate-spin",size:14}):e.jsx(Ue,{size:14}),l==="zh"?"一键更新该周期课表":"Execute Batch Holiday Updates"]})]})]}),ms=({lang:l,classes:b,getClassDisplayName:r,handleExportCSV:N,handleExportJSON:T,importClassId:v,setImportClassId:I,csvText:G,setCsvText:B,importMessage:P,handleImportData:U})=>e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:[e.jsxs("div",{className:"bg-slate-50/50 border border-slate-200 rounded-xl p-5 flex flex-col justify-between",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-bold text-gray-800 flex items-center gap-2 border-b border-slate-100 pb-2.5 mb-3",children:[e.jsx(ss,{className:"text-green-600",size:16}),l==="zh"?"导出系统课表":"Export Timetables"]}),e.jsx("p",{className:"text-xs text-gray-500 mb-4 leading-relaxed",children:l==="zh"?"把系统中当前排定的所有班级课表一键备份成标准 CSV 或 JSON 文件。您可以使用 Excel 便捷编辑修改后再导入回来。":"Download the compiled records from SQLite memory db into standard JSON or CSV sheet formats."})]}),e.jsxs("div",{className:"flex gap-2.5 mt-4",children:[e.jsxs("button",{onClick:N,className:"flex-1 bg-white hover:bg-slate-50 text-slate-800 border border-slate-250 font-bold text-xs py-2 rounded-lg cursor-pointer transition-all flex justify-center items-center gap-1",children:[e.jsx(xt,{className:"text-green-600",size:13}),l==="zh"?"导出为 Excel CSV":"Export CSV Sheet"]}),e.jsxs("button",{onClick:T,className:"flex-1 bg-white hover:bg-slate-50 text-slate-800 border border-slate-250 font-bold text-xs py-2 rounded-lg cursor-pointer transition-all flex justify-center items-center gap-1",children:[e.jsx(xt,{className:"text-amber-500",size:13}),l==="zh"?"导出为 JSON 树":"Export JSON Data"]})]})]}),e.jsxs("div",{className:"bg-slate-50/50 border border-slate-200 rounded-xl p-5 flex flex-col gap-3",children:[e.jsxs("h3",{className:"text-sm font-bold text-gray-800 flex items-center gap-2 border-b border-slate-100 pb-2.5",children:[e.jsx(ls,{className:"text-indigo-600",size:16}),l==="zh"?"导入课表流程":"Import New Schedule"]}),e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] uppercase font-bold text-gray-500 mb-1",children:l==="zh"?"分配排定给哪一个班级 *":"Target Class to load schedules *"}),e.jsxs("select",{id:"import_class_select",title:"Import Target Class",className:"w-full bg-white border border-gray-200 rounded-lg text-xs p-2 text-gray-750 cursor-pointer focus:outline-hidden",value:v,onChange:C=>I(C.target.value),children:[e.jsx("option",{value:"",children:l==="zh"?"选择班级...":"Select Class..."}),b.map(C=>e.jsx("option",{value:C.id,children:r(C.name)},C.id))]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] uppercase font-bold text-gray-500 mb-1",children:l==="zh"?"粘贴 CSV 数据内容":"Paste CSV data rows"}),e.jsx("textarea",{rows:4,placeholder:l==="zh"?`date,lesson_id,time_slot,status,notes
2
+ 2026-06-15,les-1,09:00 - 10:30,scheduled,首节授课
3
+ 2026-06-16,les-2,10:45 - 12:15,holiday,假期放假停课`:`date,lesson_id,time_slot,status,notes
4
+ 2026-06-15,les-1,09:00 - 10:30,scheduled,First Class`,className:"w-full bg-white border border-gray-250 text-xs p-2 rounded-lg font-mono placeholder:text-gray-350 focus:outline-hidden",value:G,onChange:C=>B(C.target.value)}),e.jsx("span",{className:"text-[10px] text-gray-400 mt-1 block",children:l==="zh"?"首行必须为属性列(支持:date, lesson_id, time_slot, status, notes)。支持复制 JSON 树粘贴直接解析。":"Ensure first line consists of column keys (date, lesson_id, time_slots)."})]}),P&&e.jsxs("div",{className:`p-2.5 rounded-lg text-xs border flex items-center gap-1.5 ${P.type==="error"?"bg-red-50 border-red-200 text-red-700":"bg-green-50 border-green-200 text-green-700"}`,children:[e.jsx(rs,{size:14}),e.jsx("span",{children:P.text})]}),e.jsxs("button",{onClick:U,className:"w-full bg-indigo-600 hover:bg-indigo-700 text-white font-bold text-xs py-2 rounded-lg cursor-pointer transition-all flex items-center justify-center gap-1 shadow-xs",children:[e.jsx(mt,{size:13}),l==="zh"?"开始解析并安全导入":"Execute Schema Check & Upload"]})]})]})]}),ps=({lang:l,ocrProviderId:b,setOcrProviderId:r,aiProviders:N,ocrFileInputRef:T,handleOcrDrop:v,handleOcrImageSelect:I,ocrImagePreview:G,setOcrImagePreview:B,setOcrImageBase64:P,setOcrEntries:U,setOcrMessage:C,setOcrSelectedEntries:E,ocrImageBase64:X,ocrLoading:O,handleOcrRecognize:ae,ocrProgressStatus:Q,ocrProgress:L,ocrMessage:J,ocrEntries:F,ocrSelectedEntries:k,toggleAllOcrEntries:ie,toggleOcrEntry:ee,dayNames:xe,findMatchedClass:he,handleOcrImport:$,ocrImporting:ne})=>e.jsxs("div",{className:"flex flex-col gap-5",children:[e.jsxs("div",{className:"bg-slate-50/50 border border-slate-200 rounded-2xl p-5",children:[e.jsxs("h2",{className:"text-base font-bold text-slate-800 flex items-center gap-2 border-b border-slate-200 pb-3 mb-4",children:[e.jsx(as,{className:"text-violet-500 shrink-0",size:18}),l==="zh"?"第一步:上传课表图片":"Step 1: Upload Timetable Image"]}),e.jsx("p",{className:"text-xs text-gray-500 mb-4 leading-relaxed",children:l==="zh"?"拍照或截图您的纸质/电子课表,AI 将自动识别课程信息并生成结构化数据。支持 PNG、JPG 格式,建议图片清晰、文字可辨。":"Upload a photo or screenshot of your timetable. AI will automatically recognize class information and generate structured data."}),e.jsxs("div",{className:"mb-4 p-3 bg-white rounded-xl border border-slate-200",children:[e.jsxs("label",{className:"block text-xs font-semibold text-gray-700 mb-1.5 flex items-center gap-1.5",children:[e.jsx(Ae,{size:12,className:"text-violet-500"}),l==="zh"?"AI 识别引擎":"AI Recognition Engine"]}),e.jsxs("select",{title:"OCR AI Provider",className:"w-full bg-slate-50 border border-gray-200 rounded-lg text-xs p-2.5 text-gray-750 cursor-pointer focus:outline-hidden focus:ring-1 focus:ring-violet-500",value:b,onChange:p=>r(p.target.value),children:[e.jsx("option",{value:"",children:l==="zh"?"默认 (Gemini)":"Default (Gemini)"}),N.map(p=>e.jsxs("option",{value:p.id,children:[p.name," (",p.model_name,")"]},p.id))]}),e.jsx("span",{className:"text-[10px] text-gray-400 mt-1 block",children:l==="zh"?"选择用于识别课表图片的 AI 模型。需要支持图片输入的模型(如 GPT-4o、Gemini 等)。":"Choose the AI model for timetable recognition. Must support vision/image input."})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[e.jsxs("div",{className:"flex-1 border-2 border-dashed border-slate-300 rounded-xl p-6 flex flex-col items-center justify-center gap-3 cursor-pointer hover:border-violet-400 hover:bg-violet-50/30 transition-all group",onClick:()=>T.current?.click(),onDragOver:p=>{p.preventDefault(),p.stopPropagation()},onDrop:v,children:[e.jsx("input",{ref:T,type:"file",accept:"image/png,image/jpeg,image/jpg,image/webp",className:"hidden",onChange:I}),e.jsx(os,{className:"text-slate-400 group-hover:text-violet-500 transition-colors",size:36}),e.jsx("span",{className:"text-xs font-semibold text-slate-500 group-hover:text-violet-600 transition-colors",children:l==="zh"?"点击选择、拖拽图片至此处 或 Ctrl+V 粘贴截图":"Click, drag & drop, or Ctrl+V to paste screenshot"}),e.jsx("span",{className:"text-[10px] text-slate-400",children:l==="zh"?"支持 PNG / JPG / JPEG / WebP,最大 20MB":"Supports PNG / JPG / JPEG / WebP, max 20MB"})]}),G&&e.jsxs("div",{className:"flex-1 relative rounded-xl overflow-hidden border border-slate-200 bg-white shadow-sm",children:[e.jsx("img",{src:G,alt:"Timetable preview",className:"w-full h-full object-contain max-h-[280px]"}),e.jsx("button",{onClick:p=>{p.stopPropagation(),B(null),P(null),U([]),C(null),E(new Set),T.current&&(T.current.value="")},className:"absolute top-2 right-2 bg-black/50 hover:bg-black/70 text-white p-1.5 rounded-lg transition-colors cursor-pointer",title:l==="zh"?"移除图片":"Remove image",children:e.jsx(be,{size:14})}),e.jsxs("div",{className:"absolute bottom-2 left-2 bg-black/50 text-white text-[10px] px-2 py-1 rounded-lg flex items-center gap-1",children:[e.jsx(is,{size:10}),l==="zh"?"课表预览":"Preview"]})]})]}),e.jsx("button",{onClick:ae,disabled:!X||O,className:"mt-4 w-full bg-violet-600 hover:bg-violet-700 disabled:bg-slate-300 text-white font-bold text-xs py-2.5 rounded-xl cursor-pointer transition-all flex items-center justify-center gap-2 shadow-sm disabled:cursor-not-allowed",children:O?e.jsxs(e.Fragment,{children:[e.jsx(Ie,{className:"animate-spin",size:14}),l==="zh"?"AI 识别中,请稍候...":"AI recognizing..."]}):e.jsxs(e.Fragment,{children:[e.jsx(ht,{size:14}),l==="zh"?"开始 AI 智能识别":"Start AI Recognition"]})})]}),O&&e.jsxs("div",{className:"bg-slate-50 border border-slate-200 rounded-xl p-3.5 space-y-2.5 animate-in fade-in duration-200 text-left",children:[e.jsxs("div",{className:"flex justify-between items-center text-xs",children:[e.jsx("span",{className:"font-semibold text-slate-700",children:Q}),e.jsxs("span",{className:"font-mono font-bold text-indigo-600",children:[L,"%"]})]}),e.jsx("div",{className:"w-full h-2 bg-slate-200 rounded-full overflow-hidden shrink-0",children:e.jsx("div",{className:"h-full bg-gradient-to-r from-violet-500 to-indigo-600 transition-all duration-300 rounded-full",style:{width:`${L}%`}})})]}),J&&e.jsxs("div",{className:`p-3 rounded-xl text-xs border flex items-start gap-2 ${J.type==="error"?"bg-red-50 border-red-200 text-red-700":J.type==="success"?"bg-green-50 border-green-200 text-green-700":"bg-blue-50 border-blue-200 text-blue-700"}`,children:[J.type==="error"?e.jsx(ns,{size:14,className:"shrink-0 mt-0.5"}):J.type==="success"?e.jsx(Be,{size:14,className:"shrink-0 mt-0.5"}):e.jsx(ht,{size:14,className:"shrink-0 mt-0.5 animate-pulse"}),e.jsx("span",{children:J.text})]}),F.length>0&&e.jsxs("div",{className:"bg-slate-50/50 border border-slate-200 rounded-2xl p-5",children:[e.jsxs("h2",{className:"text-base font-bold text-slate-800 flex items-center gap-2 border-b border-slate-200 pb-3 mb-4",children:[e.jsx(Be,{className:"text-emerald-500 shrink-0",size:18}),l==="zh"?"第二步:审核识别结果":"Step 2: Review Recognized Entries"]}),e.jsx("p",{className:"text-xs text-gray-500 mb-3",children:l==="zh"?"以下是 AI 从课表图片中识别出的课程安排,请勾选需要导入的条目。":"Below are the class entries recognized by AI. Select the ones you want to import."}),e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("label",{className:"flex items-center gap-2 text-xs font-medium text-slate-700 cursor-pointer select-none",children:[e.jsx("input",{type:"checkbox",checked:k.size===F.length,onChange:ie,className:"accent-violet-600 cursor-pointer rounded"}),l==="zh"?`全选 (${k.size}/${F.length})`:`Select All (${k.size}/${F.length})`]}),e.jsx("span",{className:"text-[10px] text-slate-400",children:l==="zh"?"取消勾选可排除不需要导入的条目":"Uncheck to exclude entries from import"})]}),e.jsx("div",{className:"border border-slate-200 rounded-xl overflow-hidden shadow-2xs",children:e.jsxs("table",{className:"w-full text-left border-collapse table-auto text-xs bg-white",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-slate-50 border-b border-slate-200 text-gray-600 font-semibold text-[10px] uppercase tracking-wide",children:[e.jsx("th",{className:"p-2.5 w-[40px] text-center",children:"✓"}),e.jsx("th",{className:"p-2.5",children:l==="zh"?"星期":"Day"}),e.jsx("th",{className:"p-2.5",children:l==="zh"?"节次":"Period"}),e.jsx("th",{className:"p-2.5",children:l==="zh"?"班级":"Class"}),e.jsx("th",{className:"p-2.5",children:l==="zh"?"科目":"Subject"}),e.jsx("th",{className:"p-2.5",children:l==="zh"?"时间段":"Time"}),e.jsx("th",{className:"p-2.5",children:l==="zh"?"教室":"Room"}),e.jsx("th",{className:"p-2.5",children:l==="zh"?"教师":"Teacher"})]})}),e.jsx("tbody",{className:"divide-y divide-slate-100",children:F.map((p,W)=>e.jsxs("tr",{className:`hover:bg-violet-50/30 transition-colors cursor-pointer ${k.has(W)?"bg-violet-50/20":"opacity-50"}`,onClick:()=>ee(W),children:[e.jsx("td",{className:"p-2.5 text-center",children:e.jsx("input",{type:"checkbox",checked:k.has(W),onChange:()=>ee(W),onClick:te=>te.stopPropagation(),className:"accent-violet-600 cursor-pointer"})}),e.jsx("td",{className:"p-2.5 font-medium",children:e.jsx("span",{className:"inline-block bg-indigo-100 text-indigo-700 px-1.5 py-0.5 rounded-md text-[10px] font-bold",children:xe[p.dayOfWeek]||`Day${p.dayOfWeek}`})}),e.jsx("td",{className:"p-2.5",children:e.jsx("span",{className:"inline-block bg-slate-100 text-slate-700 px-1.5 py-0.5 rounded-md text-[10px] font-bold",children:l==="zh"?`第${p.periodNumber}节`:`P${p.periodNumber}`})}),e.jsx("td",{className:"p-2.5 font-semibold text-slate-800",children:p.className||"-"}),e.jsx("td",{className:"p-2.5",children:e.jsx("span",{className:"inline-block bg-amber-100 text-amber-800 px-1.5 py-0.5 rounded-md text-[10px] font-bold",children:p.subject||"-"})}),e.jsx("td",{className:"p-2.5 font-mono text-slate-600",children:p.timeSlot||"-"}),e.jsx("td",{className:"p-2.5 text-slate-600",children:p.location||"-"}),e.jsx("td",{className:"p-2.5 text-slate-600",children:p.teacherName||"-"})]},W))})]})})]}),F.length>0&&e.jsxs("div",{className:"bg-slate-50/50 border border-slate-200 rounded-2xl p-5",children:[e.jsxs("h2",{className:"text-base font-bold text-slate-800 flex items-center gap-2 border-b border-slate-200 pb-3 mb-4",children:[e.jsx(Be,{className:"text-emerald-500 shrink-0",size:18}),l==="zh"?"第三步:确认导入日程":"Step 3: Confirm Import"]}),(()=>{const p=new Date,W=p.getDay(),te=p.getDate()-W+(W===0?-6:1),Y=new Date(p.setDate(te)).toISOString().split("T")[0],de=F.filter((le,K)=>k.has(K)),se=new Set;let M=0;return de.forEach(le=>{he(le.className||"")?M++:le.className&&se.add(le.className.trim())}),e.jsxs("div",{className:"flex flex-col gap-4 mb-4",children:[e.jsxs("div",{className:"p-3.5 bg-indigo-50 border border-indigo-100 rounded-xl text-xs leading-relaxed",children:[e.jsxs("div",{className:"font-semibold text-indigo-900 flex items-center gap-1.5 mb-1.5",children:[e.jsx(Ae,{size:14,className:"text-indigo-600 animate-pulse"}),l==="zh"?"智能自动匹配规则":"Intelligent Auto-Mapping"]}),e.jsxs("div",{className:"text-gray-650 space-y-1",children:[e.jsxs("div",{children:["• ",l==="zh"?`本周起始日期(周一):${Y}`:`Week Start Date (Monday): ${Y}`]}),e.jsxs("div",{children:["• ",l==="zh"?"班级匹配:系统将根据识别到的班级名称自动导入至系统中对应班级。若班级不存在,将自动创建。":"Class Matching: System will automatically import entries into matched classes or create new classes on the fly."]})]})]}),e.jsxs("div",{className:"text-xs",children:[e.jsx("div",{className:"font-semibold text-gray-700",children:l==="zh"?`已选择 ${de.length} 条记录,其中 ${M} 条可直接匹配到系统班级。`:`${de.length} entries selected, ${M} matched existing classes.`}),se.size>0&&e.jsxs("div",{className:"mt-2 p-2.5 bg-violet-50 border border-violet-200 text-violet-800 rounded-lg leading-relaxed",children:["💡 ",l==="zh"?`以下识别出的班级在系统中暂不存在,导入时将自动创建:${Array.from(se).join(", ")}`:`The following recognized classes do not exist and will be automatically created on import: ${Array.from(se).join(", ")}.`]})]})]})})(),e.jsx("button",{onClick:$,disabled:ne||k.size===0,className:"w-full bg-emerald-600 hover:bg-emerald-700 disabled:bg-slate-300 text-white font-bold text-xs py-2.5 rounded-xl cursor-pointer transition-all flex items-center justify-center gap-2 shadow-sm disabled:cursor-not-allowed",children:ne?e.jsxs(e.Fragment,{children:[e.jsx(Ie,{className:"animate-spin",size:14}),l==="zh"?"正在导入...":"Importing..."]}):e.jsxs(e.Fragment,{children:[e.jsx(ds,{size:14}),l==="zh"?`确认导入选中的 ${k.size} 条课程`:`Import ${k.size} Selected Entries`]})})]})]}),bs=({classes:l,lessons:b,lang:r,onSchedulesUpdated:N,onClassesUpdated:T})=>{const[v,I]=c.useState("view"),[G,B]=c.useState("week"),P=t=>{const s=new Date(t.getTime()),n=s.getDay(),i=s.getDate()-n+(n===0?-6:1),o=new Date(s.setDate(i));return o.setHours(0,0,0,0),o},[U,C]=c.useState(()=>P(new Date)),E=t=>{const s=new Date(t.getTime()+5184e5),n=i=>{const o=i.getFullYear(),d=String(i.getMonth()+1).padStart(2,"0"),u=String(i.getDate()).padStart(2,"0");return`${o}-${d}-${u}`};return`${n(t)} ~ ${n(s)}`},[X,O]=c.useState(null),[ae,Q]=c.useState(""),[L,J]=c.useState("dow"),[F,k]=c.useState(""),[ie,ee]=c.useState({}),[xe,he]=c.useState(!1),[$,ne]=c.useState("all"),[p,W]=c.useState(""),[te,ve]=c.useState("all"),[Y,de]=c.useState([]),[se,M]=c.useState(!1),[le,K]=c.useState(!1),[Pe,ue]=c.useState(!1),[re,V]=c.useState(null),[a,x]=c.useState(""),[h,S]=c.useState(""),[f,j]=c.useState(""),[D,y]=c.useState("09:00 - 10:30"),[g,H]=c.useState("scheduled"),[we,fe]=c.useState(""),[Ee,Ye]=c.useState(""),[Oe,pt]=c.useState(""),[bt,ze]=c.useState(null),[ge,Ke]=c.useState(""),[je,qe]=c.useState(""),[ye,ft]=c.useState("holiday"),[Ze,Xe]=c.useState(""),[gt,Le]=c.useState(null),[Fe,Re]=c.useState(null),[jt,Qe]=c.useState(!1),[yt,Se]=c.useState(0),[Nt,me]=c.useState(""),[Ce,Ne]=c.useState([]),[vt,A]=c.useState(null),[fs,gs]=c.useState(""),[js,ys]=c.useState(""),[wt,Je]=c.useState(!1),[ke,ce]=c.useState(new Set),zt=c.useRef(null),[St,et]=c.useState([]),[tt,Ct]=c.useState(""),st=["08:00 - 09:30","09:45 - 11:15","11:30 - 13:00","13:30 - 15:00","15:15 - 16:45","19:00 - 20:30"],lt=c.useRef(""),rt=c.useRef(""),kt=t=>{try{const s=t.split("-");if(s.length<3)return 1;const n=parseInt(s[0],10),i=parseInt(s[1],10)-1,o=parseInt(s[2],10),u=new Date(n,i,o).getDay();return u===0?7:u}catch{return 1}},oe=async()=>{M(!0);try{let t=[];if($==="all"){const s=await fetch("/api/schedules");s.ok&&(t=await s.json())}else{const s=l.find(n=>n.id===$);if(s){const n=await fetch(`/api/classes/${s.id}/schedules`);n.ok&&(t=await n.json(),t.forEach(i=>{i.class_name=s.name}))}}t.sort((s,n)=>{const i=n.scheduled_date.localeCompare(s.scheduled_date);return i!==0?i:(s.time_slot||"").localeCompare(n.time_slot||"")}),de(t)}catch(t){console.error(t)}finally{M(!1)}};c.useEffect(()=>{const t=l.map(i=>`${i.id}:${i.name}`).join(","),s=t!==lt.current,n=$!==rt.current;l.length>0&&(s||n)&&(lt.current=t,rt.current=$,oe())},[$,l]),c.useEffect(()=>{fetch("/api/ai-providers").then(t=>t.ok?t.json():[]).then(t=>et(Array.isArray(t)?t:[])).catch(()=>et([]))},[]);const $t=async t=>{if(t.preventDefault(),!a||!f){alert(r==="zh"?"请填写所有必填字段":"Please fill all required fields");return}try{const s=await fetch(`/api/classes/${a}/schedules`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({lessonId:h,scheduledDate:f,timeSlot:D,status:g,notes:we})});if(s.ok)K(!1),x(""),S(""),j(""),fe(""),H("scheduled"),oe(),N();else{const n=await s.json();alert(n.error||"Failed to schedule")}}catch(s){alert(s.message)}},_t=async t=>{if(t.preventDefault(),!!re)try{const s=re.isRepeating,n=s?`/api/classes/${re.class_id}/schedules`:`/api/classes/${re.class_id}/schedules/${re.id}`,o=await fetch(n,{method:s?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({lessonId:h,scheduledDate:f,timeSlot:D,status:g,notes:we})});if(o.ok)ue(!1),V(null),oe(),N();else{const d=await o.json();alert(d.error||"Failed to update schedule")}}catch(s){alert(s.message)}},Dt=async(t,s,n,i)=>{if(n&&i){if(!confirm(r==="zh"?"该课程是由上周循环生成的。您确定要取消(停课)本周这一天的课程安排吗?":"This is a repeating class. Do you want to cancel (set to Cancelled) this class for this week?"))return;try{const u=Y.find(w=>w.id===t);(await fetch(`/api/classes/${s}/schedules`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({lessonId:u?.lesson_id||"",scheduledDate:i,timeSlot:u?.time_slot||"",status:"cancelled",notes:r==="zh"?"循环排课取消":"Repeating schedule cancelled"})})).ok?(oe(),N()):alert("Cancel failed")}catch(u){alert(u.message)}return}if(confirm(r==="zh"?"您确定要完全删除该条课表排课记录吗?关联的考勤记录也将一并清除!":"Are you sure you want to completely delete this schedule record? Associated attendance logs will be cleared as well!"))try{(await fetch(`/api/classes/${s}/schedules/${t}`,{method:"DELETE"})).ok?(oe(),N()):alert("Delete failed")}catch(d){alert(d.message)}},Tt=t=>{V(t),x(t.class_id),S(t.lesson_id),j(t.scheduled_date),y(t.time_slot||"09:00 - 10:30"),H(t.status||"scheduled"),fe(t.notes||""),ue(!0)},It=async()=>{if(!ge||!je){alert(r==="zh"?"请选择开始日期和结束日期":"Please select both start and end dates");return}const t=Y.filter(i=>{const o=i.scheduled_date;return o>=ge&&o<=je&&i.status!==ye});if(t.length===0){alert(r==="zh"?"在此日期范围内没有找到可调整的研究课表记录!":"No schedules found in the selected date range to adjust!");return}const s=r==="zh"?`此操作将会把 ${ge} 到 ${je} 之间的共 ${t.length} 个课时记录一键标记为 [${ye==="holiday"?"假日停课":"异常停课"}]。确认执行吗?`:`This will mark ${t.length} active classes between ${ge} and ${je} as [${ye}]. Continue?`;if(!confirm||!confirm(s))return;M(!0);let n=0;try{for(const i of t)(await fetch(`/api/classes/${i.class_id}/schedules/${i.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({lessonId:i.lesson_id,scheduledDate:i.scheduled_date,timeSlot:i.time_slot,status:ye,notes:Ze||(r==="zh"?"假期统一调休":"Holiday adjustments")})})).ok&&n++;alert(r==="zh"?`调整成功!共更新 ${n} 个课表安排。`:`Success! Updated ${n} entries.`),Ke(""),qe(""),Xe(""),oe(),N()}catch(i){alert(i.message)}finally{M(!1)}},We=t=>{if(!t.type.startsWith("image/")){A({type:"error",text:r==="zh"?"请选择图片文件(PNG, JPG, JPEG)":"Please select an image file (PNG, JPG, JPEG)"});return}if(t.size>20*1024*1024){A({type:"error",text:r==="zh"?"图片大小不能超过 20MB":"Image size must be under 20MB"});return}const s=new FileReader;s.onload=n=>{const i=n.target?.result;Le(i),Re(i),Ne([]),A(null),ce(new Set)},s.readAsDataURL(t)},At=t=>{const s=t.target.files?.[0];s&&We(s)},Pt=t=>{const s=t.clipboardData?.items;if(s){for(let n=0;n<s.length;n++)if(s[n].type.startsWith("image/")){t.preventDefault();const i=s[n].getAsFile();i&&We(i);return}}},Et=t=>{t.preventDefault(),t.stopPropagation();const s=t.dataTransfer?.files?.[0];s&&s.type.startsWith("image/")&&We(s)};c.useEffect(()=>{if(v!=="ocr_import")return;const t=s=>Pt(s);return document.addEventListener("paste",t),()=>document.removeEventListener("paste",t)},[v,r]);const Ot=async()=>{if(!Fe){A({type:"error",text:r==="zh"?"请先上传课表图片":"Please upload a timetable image first"});return}Qe(!0),Se(0),me(r==="zh"?"📤 正在上传并优化图像...":"📤 Uploading and optimizing image..."),A({type:"info",text:r==="zh"?"🔍 AI 正在分析课表图片,请稍候...":"🔍 AI is analyzing the timetable image, please wait..."}),Ne([]);let t=0;const s=setInterval(()=>{t+=Math.random()*6+1,t>=95&&(t=95,clearInterval(s)),Se(Math.round(t)),t<20?me(r==="zh"?"📤 正在上传并优化图像...":"📤 Uploading and optimizing image..."):t<50?me(r==="zh"?"🧠 AI 正在分析表格排版与单元格...":"🧠 AI analyzing table layout..."):t<75?me(r==="zh"?"📝 提取课程、班级及教师信息...":"📝 Extracting lesson and teacher info..."):me(r==="zh"?"🔮 正在进行最终数据格式校验...":"🔮 Verifying data formats...")},400);try{const n=await fetch("/api/timetable/ocr",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({imageBase64:Fe,lang:r,providerId:tt||void 0})}),i=await n.text();let o;try{o=JSON.parse(i)}catch{throw new Error(r==="zh"?`服务端返回了无效响应: ${i.substring(0,150)}`:`Server returned invalid response: ${i.substring(0,150)}`)}if(!n.ok||!o.success)throw new Error(o.error||"OCR recognition failed");clearInterval(s),Se(100),me(r==="zh"?"✅ 识别成功,正在载入结果...":"✅ Recognition complete, loading results..."),o.entries&&o.entries.length>0?(Ne(o.entries),ce(new Set(o.entries.map((d,u)=>u))),A({type:"success",text:r==="zh"?`✅ 识别成功!共检测到 ${o.entries.length} 节课程安排,请审核后导入。`:`✅ Success! Detected ${o.entries.length} class entries. Review and import below.`})):A({type:"error",text:r==="zh"?"未能从图片中识别出课程信息,请尝试更清晰的图片。":"No class entries detected. Try a clearer image."})}catch(n){clearInterval(s),Se(0),A({type:"error",text:`${r==="zh"?"AI 识别失败:":"OCR Failed: "}${n.message}`})}finally{Qe(!1)}},Lt=(t,s)=>{if(!s)return"";try{const n=new Date(s);let i=Number(t);isNaN(i)&&typeof t=="string"&&(t.includes("一")||t.includes("1")||t.includes("Mon")?i=1:t.includes("二")||t.includes("2")||t.includes("Tue")?i=2:t.includes("三")||t.includes("3")||t.includes("Wed")?i=3:t.includes("四")||t.includes("4")||t.includes("Thu")?i=4:t.includes("五")||t.includes("5")||t.includes("Fri")?i=5:t.includes("六")||t.includes("6")||t.includes("Sat")?i=6:(t.includes("日")||t.includes("天")||t.includes("7")||t.includes("Sun"))&&(i=7)),(isNaN(i)||i<1||i>7)&&(i=1);const o=i-1,d=new Date(n);return d.setDate(n.getDate()+o),d.toISOString().split("T")[0]}catch(n){return console.error("Failed to convert day of week to date:",n),s}},at=t=>{if(!t)return null;const s=t.replace(/\s+/g,"").trim(),n=s.match(/(\d+)(?:班)?\)?$/)||s.match(/\((\d+)\)/);if(!n)return null;const i=n[1];let o="",d=0;if(s.startsWith("高")?(o="高",s.includes("一")||s.includes("1")?d=1:s.includes("二")||s.includes("2")?d=2:(s.includes("三")||s.includes("3"))&&(d=3)):s.startsWith("初")?(o="初",s.includes("一")||s.includes("1")?d=1:s.includes("二")||s.includes("2")?d=2:(s.includes("三")||s.includes("3"))&&(d=3)):s.startsWith("七")||s.startsWith("7")?(o="初",d=1):s.startsWith("八")||s.startsWith("8")?(o="初",d=2):s.startsWith("九")||s.startsWith("9")?(o="初",d=3):s.startsWith("小")?(o="小",s.includes("一")||s.includes("1")?d=1:s.includes("二")||s.includes("2")?d=2:s.includes("三")||s.includes("3")?d=3:s.includes("四")||s.includes("4")?d=4:s.includes("五")||s.includes("5")?d=5:(s.includes("六")||s.includes("6"))&&(d=6)):s.startsWith("一")||s.startsWith("1")?(o="小",d=1):s.startsWith("二")||s.startsWith("2")?(o="小",d=2):s.startsWith("三")||s.startsWith("3")?(o="小",d=3):s.startsWith("四")||s.startsWith("4")?(o="小",d=4):s.startsWith("五")||s.startsWith("5")?(o="小",d=5):(s.startsWith("六")||s.startsWith("6"))&&(o="小",d=6),!o||d===0)return null;const u=new Date,R=u.getFullYear(),pe=(u.getMonth()+1>=9?R:R-1)-(d-1);return`${o}${pe}级${i}班`},Ft=t=>{if(!t)return null;const s=t.match(/^(初|高|小|小学)(\d{4})级(\d+)班$/);if(!s)return null;const n=s[1],i=parseInt(s[2],10),o=s[3],d=new Date,u=d.getFullYear(),R=d.getMonth()+1;let w=u-i;if(R>=9&&(w+=1),w<1)return r==="zh"?"未开学":"Not Started";if(w>(n==="高"||n==="初"?3:6))return r==="zh"?"已毕业":"Graduated";const q=r==="zh"&&["","一","二","三","四","五","六","七","八","九","十"][w]||w.toString();return`${n}${q}(${o})`},Ge=t=>{const s=Ft(t);return s?`${t} (${s})`:t},Me=t=>{if(!t)return null;const s=t.replace(/\s+/g,"").toLowerCase();let n=l.find(i=>{if(!i||!i.name)return!1;const o=i.name.replace(/\s+/g,"").toLowerCase();return o===s||o.includes(s)||s.includes(o)});if(!n){const i=s.replace(/[^0-9a-zA-Z\u4e00-\u9fa5]/g,"");n=l.find(o=>{if(!o||!o.name)return!1;const d=o.name.replace(/\s+/g,"").toLowerCase().replace(/[^0-9a-zA-Z\u4e00-\u9fa5]/g,"");return d===i||d.includes(i)||i.includes(d)})}return n||null},Rt=async()=>{try{if(ke.size===0){A({type:"error",text:r==="zh"?"请至少选择一条课程记录":"Please select at least one entry"});return}const t={1:"08:00 - 08:40",2:"08:50 - 09:30",3:"10:00 - 10:40",4:"10:50 - 11:30",5:"11:40 - 12:15",6:"14:20 - 15:00",7:"15:10 - 15:50",8:"16:20 - 17:00",9:"19:00 - 20:30"},s=new Date,n=s.getDay(),i=s.getDate()-n+(n===0?-6:1),d=new Date(s.setDate(i)).toISOString().split("T")[0];Je(!0),A(null);const u=Ce.filter((m,_)=>ke.has(_)),R=new Set;u.forEach(m=>{if(m.className){const _=at(m.className)||m.className.trim();Me(_)||R.add(_)}});const w={};R.size>0&&(await Promise.all(Array.from(R).map(async m=>{try{const _=await fetch("/api/classes",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:m,description:"OCR自动生成规范班级"})});if(_.ok){const Z=await _.json();Z.success&&Z.id&&(w[m]=Z.id)}}catch(_){console.error(`Failed to dynamically create class ${m}:`,_)}})),T&&T());const z={},pe=new Set;u.forEach(m=>{const _=Lt(m.dayOfWeek||1,d),Z=m.timeSlot||t[m.periodNumber]||"09:00 - 10:30",$e=m.className?at(m.className)||m.className.trim():"",it=Me($e),_e=it?it.id:$e?w[$e]:null;if(!_e){m.className&&pe.add(m.className);return}const Ut=b.find(Yt=>{const He=Yt.title.toLowerCase(),nt=$e.toLowerCase(),Kt=(m.subject||"").toLowerCase();return He.includes(nt)||He.includes(Kt)||nt.includes(He)});z[_e]||(z[_e]=[]),z[_e].push({lessonId:Ut?.id||"",scheduledDate:_,timeSlot:Z,status:"scheduled",notes:`${m.className||""} ${m.subject||""} ${m.location?"教室:"+m.location:""} ${m.teacherName?"教师:"+m.teacherName:""}`.trim()})});const q=Object.keys(z);if(q.length===0){A({type:"error",text:r==="zh"?"无法导入:没有解析出任何有效的班级名称。":"Could not match or create any classes for import."}),Je(!1);return}let Ve=0;await Promise.all(q.map(async m=>{const _=await fetch(`/api/classes/${m}/schedules/batch`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({schedules:z[m]})});if(_.ok){const Z=await _.json();Ve+=Z.count||0}else{const Z=await _.json().catch(()=>({}));throw new Error(Z.error||`Failed to import schedules for class ${m}`)}})),Ne([]),ce(new Set),Le(null),Re(null);let ot=r==="zh"?`🎉 导入成功!共写入 ${Ve} 节课时安排。`:`🎉 Import successful! Saved ${Ve} schedule entries.`;if(R.size>0){const m=Array.from(R).filter(_=>w[_]);m.length>0&&(ot+=r==="zh"?`(自动创建并规范了新班级:${m.join(", ")})`:` (Automatically created classes: ${m.join(", ")})`)}A({type:"success",text:ot}),oe(),N()}catch(t){console.error("OCR Import Error:",t),alert(`${r==="zh"?"导入出错提示:":"Import error alert: "}${t.message}`),A({type:"error",text:`${r==="zh"?"导入失败:":"Import failed: "}${t.message}`})}finally{Je(!1)}},Jt=t=>{ce(s=>{const n=new Set(s);return n.has(t)?n.delete(t):n.add(t),n})},Wt=()=>{ke.size===Ce.length?ce(new Set):ce(new Set(Ce.map((t,s)=>s)))},Gt=r==="zh"?["","周一","周二","周三","周四","周五","周六","周日"]:["","Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Mt=()=>{const t=["Date","Class Name","Lesson Title","Time Slot","Status","Notes","Class ID","Lesson ID"],s=Y.map(d=>[d.scheduled_date,d.class_name||"",d.lesson_title||"",d.time_slot||"",d.status||"scheduled",d.notes||"",d.class_id,d.lesson_id]),n="data:text/csv;charset=utf-8,"+[t.join(","),...s.map(d=>d.map(u=>`"${String(u).replace(/"/g,'""')}"`).join(","))].join(`
5
+ `),i=encodeURI(n),o=document.createElement("a");o.setAttribute("href",i),o.setAttribute("download",`timetable_export_${new Date().toISOString().split("T")[0]}.csv`),document.body.appendChild(o),o.click(),document.body.removeChild(o)},Vt=()=>{const t="data:text/json;charset=utf-8,"+encodeURIComponent(JSON.stringify(Y,null,2)),s=document.createElement("a");s.setAttribute("href",t),s.setAttribute("download",`timetable_export_${new Date().toISOString().split("T")[0]}.json`),document.body.appendChild(s),s.click(),document.body.removeChild(s)},Ht=async()=>{if(!Oe){ze({type:"error",text:r==="zh"?"请先选择需要导入的班级!":"Please select a Class first!"});return}if(!Ee.trim()){ze({type:"error",text:r==="zh"?"请在框中输入或粘贴数据内容":"Please paste formatting data content!"});return}try{let t=[];const s=Ee.trim();if(s.startsWith("[")){const o=JSON.parse(s);t=Array.isArray(o)?o:[o]}else{const o=s.split(`
6
+ `).map(u=>u.trim()).filter(Boolean);if(o.length<=1)throw new Error(r==="zh"?"CSV 数据行不足(必须包含表头与内容行)":"Insufficient CSV rows!");const d=o[0].split(",").map(u=>u.trim().toLowerCase().replace(/"/g,""));for(let u=1;u<o.length;u++){const R=o[u].split(",").map(z=>z.trim().replace(/"/g,"")),w={};d.forEach((z,pe)=>{const q=R[pe];z==="date"||z==="scheduled_date"?w.scheduledDate=q:z==="lesson_id"||z==="lesson id"||z==="lesson"?w.lessonId=q:z==="time_slot"||z==="time slot"||z==="time"?w.timeSlot=q:z==="status"?w.status=q:(z==="notes"||z==="note")&&(w.notes=q)}),w.scheduledDate&&t.push(w)}}if(t.length===0)throw new Error(r==="zh"?"未解析到合法的课时数据记录。请保证包含日期字段!":"No valid schedules parsed. Date is required!");const n=t.map(o=>{const d=o.lessonId?b.find(u=>u.id===o.lessonId||u.title.toLowerCase()===o.lessonId.toLowerCase()):null;return{lessonId:d?d.id:"",scheduledDate:o.scheduledDate,timeSlot:o.timeSlot||"09:00 - 10:30",status:o.status||"scheduled",notes:o.notes||""}}),i=await fetch(`/api/classes/${Oe}/schedules/batch`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({schedules:n})});if(i.ok){const o=await i.json();ze({type:"success",text:r==="zh"?`👍 导入成功!共写入 ${o.count} 节课时安排至所选班级。`:`Success! Imported ${o.count} schedules layout.`}),Ye(""),oe(),N()}else{const o=await i.json();throw new Error(o.error||"Batch insert error")}}catch(t){ze({type:"error",text:`${r==="zh"?"导入失败: ":"Import failed: "}${t.message}`})}},Bt=Y.filter(t=>{if($!=="all"&&t.class_id!==$||te!=="all"&&t.status!==te)return!1;if(p.trim()){const s=p.toLowerCase(),n=(t.lesson_title||"").toLowerCase().includes(s),i=(t.class_name||"").toLowerCase().includes(s),o=(t.notes||"").toLowerCase().includes(s);return n||i||o}return!0});return e.jsxs("div",{className:"flex-1 flex flex-col min-h-0 bg-white rounded-2xl border border-gray-200 overflow-hidden shadow-sm font-sans",id:"timetable_manager_container",children:[e.jsxs("div",{className:"p-4 border-b border-gray-100 bg-gray-50/50 flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 shrink-0",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-xl font-bold text-gray-800 flex items-center gap-2",children:[e.jsx(cs,{className:"text-indigo-600 animate-pulse",size:22}),r==="zh"?"班级课表中心 & 动态调整":"Timetable Center & Adjustments"]}),e.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:r==="zh"?"统一管理日常排课,支持节假日批量停课、讲师临时换课、换班及 CSV 导入导出。":"Orchestrate routines schedules, holidays exclusions, and instructors swapping items."})]}),e.jsxs("div",{className:"flex bg-gray-100 p-1 rounded-xl shrink-0 self-start sm:self-auto shadow-inner border border-slate-200/50",children:[e.jsx("button",{onClick:()=>I("view"),className:`px-3 py-1.5 rounded-lg text-xs font-semibold tracking-wide transition-all ${v==="view"?"bg-white text-indigo-700 shadow-sm":"text-gray-500 hover:text-gray-800"}`,children:r==="zh"?"🗓️ 课表看板":"Schedule Grid"}),e.jsx("button",{onClick:()=>I("adjust"),className:`px-3 py-1.5 rounded-lg text-xs font-semibold tracking-wide transition-all ${v==="adjust"?"bg-white text-indigo-700 shadow-sm":"text-gray-500 hover:text-gray-800"}`,children:r==="zh"?"🛠️ 临时调休调课":"Holiday Adjusts"}),e.jsx("button",{onClick:()=>I("import_export"),className:`px-3 py-1.5 rounded-lg text-xs font-semibold tracking-wide transition-all ${v==="import_export"?"bg-white text-indigo-700 shadow-sm":"text-gray-500 hover:text-gray-800"}`,children:r==="zh"?"📥 快速导入导出":"Import / Export"}),e.jsx("button",{onClick:()=>I("ocr_import"),className:`px-3 py-1.5 rounded-lg text-xs font-semibold tracking-wide transition-all ${v==="ocr_import"?"bg-white text-indigo-700 shadow-sm":"text-gray-500 hover:text-gray-800"}`,children:r==="zh"?"📷 AI 图片识课":"AI Image OCR"})]})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[v==="view"&&e.jsx(hs,{lang:r,viewMode:G,setViewMode:B,selectedClassId:$,setSelectedClassId:ne,statusFilter:te,setStatusFilter:ve,searchQuery:p,setSearchQuery:W,classes:l,getClassDisplayName:Ge,loading:se,filteredSchedules:Bt,currentWeekMonday:U,setCurrentWeekMonday:C,showWeekend:xe,setShowWeekend:he,dateOverrides:ie,setDateOverrides:ee,setOverridingDateKey:O,setOverrideMode:J,setOverrideTargetDow:k,setOverrideTargetDate:Q,openEditModal:Tt,handleDeleteSchedule:Dt,getDayOfWeekIndex:kt,getMonday:P,getWeekRangeString:E,setFormClassId:x,setFormLessonId:S,setFormDate:j,setFormStatus:H,setFormNotes:fe,setIsAddOpen:K}),v==="adjust"&&e.jsx(us,{lang:r,holStartDate:ge,setHolStartDate:Ke,holEndDate:je,setHolEndDate:qe,holType:ye,setHolType:ft,holNotes:Ze,setHolNotes:Xe,handleBatchHolidayAdjustment:It,loading:se}),v==="import_export"&&e.jsx(ms,{lang:r,classes:l,getClassDisplayName:Ge,handleExportCSV:Mt,handleExportJSON:Vt,importClassId:Oe,setImportClassId:pt,csvText:Ee,setCsvText:Ye,importMessage:bt,handleImportData:Ht}),v==="ocr_import"&&e.jsx(ps,{lang:r,ocrProviderId:tt,setOcrProviderId:Ct,aiProviders:St,ocrFileInputRef:zt,handleOcrDrop:Et,handleOcrImageSelect:At,ocrImagePreview:gt,setOcrImagePreview:Le,setOcrImageBase64:Re,setOcrEntries:Ne,setOcrMessage:A,setOcrSelectedEntries:ce,ocrImageBase64:Fe,ocrLoading:jt,handleOcrRecognize:Ot,ocrProgressStatus:Nt,ocrProgress:yt,ocrMessage:vt,ocrEntries:Ce,ocrSelectedEntries:ke,toggleAllOcrEntries:Wt,toggleOcrEntry:Jt,dayNames:Gt,findMatchedClass:Me,handleOcrImport:Rt,ocrImporting:wt})]}),le&&e.jsx("div",{className:"fixed inset-0 z-55 bg-black/40 backdrop-blur-xs flex items-center justify-center p-4",children:e.jsxs("div",{className:"bg-white border border-slate-200 shadow-2xl rounded-2xl w-full max-w-md overflow-hidden animate-in fade-in zoom-in duration-150",children:[e.jsxs("div",{className:"p-4 bg-slate-50 border-b border-slate-100 flex items-center justify-between",children:[e.jsxs("h3",{className:"font-bold text-gray-800 flex items-center gap-1.5 text-sm xl:text-base",children:[e.jsx(De,{className:"text-indigo-600",size:18}),r==="zh"?"为班级排排定课次":"Arrange Timetable Scheduled"]}),e.jsx("button",{onClick:()=>K(!1),className:"text-gray-400 hover:text-gray-600 p-1 rounded-full hover:bg-gray-150 transition-colors",children:e.jsx(be,{size:16})})]}),e.jsxs("form",{onSubmit:$t,className:"p-4 space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-semibold text-gray-700 mb-1",children:r==="zh"?"选择对应上课班级 *":"Target Class *"}),e.jsxs("select",{title:"Form Class ID",className:"w-full border border-gray-250 text-xs p-2 rounded-lg bg-white select-none cursor-pointer focus:outline-hidden",value:a,onChange:t=>x(t.target.value),required:!0,children:[e.jsx("option",{value:"",children:r==="zh"?"请选择班级...":"Select Class..."}),l.map(t=>e.jsx("option",{value:t.id,children:Ge(t.name)},t.id))]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-semibold text-gray-700 mb-1",children:r==="zh"?"对应授课课题 / 课时 (可空,上课时自选)":"Syllabus Lesson (Optional, select during class)"}),e.jsxs("select",{title:"Form Lesson ID",className:"w-full border border-gray-250 text-xs p-2 rounded-lg bg-white select-none cursor-pointer focus:outline-hidden rounded-lg",value:h,onChange:t=>S(t.target.value),children:[e.jsx("option",{value:"",children:r==="zh"?"暂不设定内容 (上课时自由选择)":"No fixed content (select during class)"}),b.map(t=>e.jsx("option",{value:t.id,children:t.title},t.id))]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-semibold text-gray-700 mb-1",children:r==="zh"?"公历排定日期 *":"Scheduled Date *"}),e.jsx("input",{type:"date",className:"w-full border border-gray-250 text-xs p-2 rounded-lg bg-white focus:outline-hidden",value:f,onChange:t=>j(t.target.value),required:!0})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-semibold text-gray-700 mb-1",children:r==="zh"?"日常状态":"Daily Status"}),e.jsxs("select",{title:"Form Status",className:"w-full border border-gray-250 text-xs p-2 rounded-lg bg-white cursor-pointer focus:outline-hidden",value:g,onChange:t=>H(t.target.value),children:[e.jsx("option",{value:"scheduled",children:r==="zh"?"正常授课":"Scheduled"}),e.jsx("option",{value:"cancelled",children:r==="zh"?"停课":"Cancelled"}),e.jsx("option",{value:"holiday",children:r==="zh"?"假期调休":"Holiday"}),e.jsx("option",{value:"swap",children:r==="zh"?"临时授课/换课":"Swapped"})]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-semibold text-gray-700 mb-1",children:r==="zh"?"具体上课时间段":"Class Period / Time Slot"}),e.jsxs("div",{className:"flex gap-1.5 items-center",children:[e.jsx("input",{type:"text",className:"flex-1 border border-gray-200 rounded-lg text-xs p-2 bg-white text-gray-750 focus:outline-hidden",value:D,onChange:t=>y(t.target.value),placeholder:"e.g. 09:00 - 10:30"}),e.jsxs("select",{title:"Preset Time Slot",className:"border border-gray-250 text-xs p-2 rounded-lg bg-white cursor-pointer focus:outline-hidden",onChange:t=>{t.target.value&&y(t.target.value)},children:[e.jsx("option",{value:"",children:r==="zh"?"建议课时...":"Presets..."}),st.map(t=>e.jsx("option",{value:t,children:t},t))]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-semibold text-gray-700 mb-1",children:r==="zh"?"调课备注说明":"Schedule Notes"}),e.jsx("input",{type:"text",placeholder:r==="zh"?"例如:节假日补课、更替老师讲义,不填则无":"e.g. Substitute instructor lesson outline",className:"w-full border border-gray-250 text-xs p-2 rounded-lg bg-white focus:outline-hidden",value:we,onChange:t=>fe(t.target.value)})]}),e.jsxs("div",{className:"flex justify-end gap-2 border-t border-slate-100 pt-3 mt-4",children:[e.jsx("button",{type:"button",onClick:()=>K(!1),className:"px-3 py-1.5 rounded-lg border text-xs font-medium text-gray-500 hover:bg-gray-150 transition-colors",children:r==="zh"?"取消":"Cancel"}),e.jsx("button",{type:"submit",className:"px-4 py-1.5 rounded-lg bg-indigo-600 hover:bg-indigo-700 text-white text-xs font-bold shadow-sm transition-colors",children:r==="zh"?"排定并发布":"Publish & Save"})]})]})]})}),Pe&&re&&e.jsx("div",{className:"fixed inset-0 z-55 bg-black/40 backdrop-blur-xs flex items-center justify-center p-4",children:e.jsxs("div",{className:"bg-white border border-slate-200 shadow-2xl rounded-2xl w-full max-w-md overflow-hidden animate-in fade-in zoom-in duration-150",children:[e.jsxs("div",{className:"p-4 bg-slate-50 border-b border-slate-100 flex items-center justify-between",children:[e.jsxs("h3",{className:"font-bold text-gray-800 flex items-center gap-1.5 text-sm xl:text-base",children:[e.jsx(Te,{className:"text-indigo-600",size:18}),r==="zh"?"微调/临时变动排课记录":"Custom Adjust Schedule"]}),e.jsx("button",{onClick:()=>{ue(!1),V(null)},className:"text-gray-400 hover:text-gray-600 p-1 rounded-full hover:bg-gray-150 transition-colors",children:e.jsx(be,{size:16})})]}),e.jsxs("form",{onSubmit:_t,className:"p-4 space-y-4",children:[e.jsxs("div",{className:"p-2.5 bg-indigo-50 border border-indigo-100 rounded-lg text-xs leading-5",children:[e.jsx("div",{className:"font-semibold text-indigo-850",children:r==="zh"?"提示:课表的临时变动将实时更新至今日课程气泡及学生白板客户端。":"Changes will load instantly on students whiteboards and dashboards."}),e.jsxs("div",{className:"text-gray-600 mt-1",children:[r==="zh"?"目标班级:":"Target Class: "," ",e.jsx("span",{className:"font-bold",children:re.class_name})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-semibold text-gray-700 mb-1",children:r==="zh"?"换课:关联授课主体 (可空,上课时自选)":"Swap Topic / Lesson (Optional, select during class)"}),e.jsxs("select",{id:"edit_lesson_select",title:"Edit Lesson",className:"w-full border border-gray-250 text-xs p-2 rounded-lg bg-white select-none cursor-pointer focus:outline-hidden rounded-lg",value:h,onChange:t=>S(t.target.value),children:[e.jsx("option",{value:"",children:r==="zh"?"暂不设定内容 (上课时自由选择)":"No fixed content (select during class)"}),b.map(t=>e.jsx("option",{value:t.id,children:t.title},t.id))]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-semibold text-gray-700 mb-1",children:r==="zh"?"换时间:上课日期 *":"Scheduled Date *"}),e.jsx("input",{type:"date",className:"w-full border border-gray-250 text-xs p-2 rounded-lg bg-white focus:outline-hidden",value:f,onChange:t=>j(t.target.value),required:!0})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-semibold text-gray-700 mb-1",children:r==="zh"?"临时教务状态":"Ad-hoc Status"}),e.jsxs("select",{id:"edit_status_select",title:"Edit Status",className:"w-full border border-gray-250 text-xs p-2 rounded-lg bg-white cursor-pointer focus:outline-hidden",value:g,onChange:t=>H(t.target.value),children:[e.jsx("option",{value:"scheduled",children:r==="zh"?"正常授课 (Scheduled)":"Scheduled"}),e.jsx("option",{value:"cancelled",children:r==="zh"?"临时停课 (Cancelled)":"Cancelled"}),e.jsx("option",{value:"holiday",children:r==="zh"?"节日假期 (Holiday)":"Holiday"}),e.jsx("option",{value:"swap",children:r==="zh"?"换课/代授课 (Swapped)":"Swapped"})]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-semibold text-gray-700 mb-1",children:r==="zh"?"具体上课时段":"Class Time Slot"}),e.jsxs("div",{className:"flex gap-1.5 items-center",children:[e.jsx("input",{type:"text",className:"flex-1 border border-gray-200 rounded-lg text-xs p-2 bg-white text-gray-750 focus:outline-hidden",value:D,onChange:t=>y(t.target.value),placeholder:"e.g. 09:00 - 10:30"}),e.jsxs("select",{title:"Edit Preset Time",className:"border border-gray-250 text-xs p-2 rounded-lg bg-white cursor-pointer focus:outline-hidden",onChange:t=>{t.target.value&&y(t.target.value)},children:[e.jsx("option",{value:"",children:r==="zh"?"建议时段...":"Presets..."}),st.map(t=>e.jsx("option",{value:t,children:t},t))]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-semibold text-gray-700 mb-1",children:r==="zh"?"微调备注(说明换课/放假原因)":"Notes/Adjustments Reason"}),e.jsx("input",{type:"text",placeholder:r==="zh"?"例:国庆假停课 / 本课更替为第二节":"Explain reasons of ad-hoc swaps",className:"w-full border border-gray-250 text-xs p-2 rounded-lg bg-white focus:outline-hidden",value:we,onChange:t=>fe(t.target.value)})]}),e.jsxs("div",{className:"flex justify-end gap-2 border-t border-slate-100 pt-3 mt-4",children:[e.jsx("button",{type:"button",onClick:()=>{ue(!1),V(null)},className:"px-3 py-1.5 rounded-lg border text-xs font-medium text-gray-500 hover:bg-gray-150 transition-colors",children:r==="zh"?"取消":"Cancel"}),e.jsx("button",{type:"submit",className:"px-4 py-1.5 rounded-lg bg-indigo-600 hover:bg-indigo-700 text-white text-xs font-bold shadow-sm transition-colors",children:r==="zh"?"保存调整":"Apply Adjustment"})]})]})]})}),X&&e.jsx("div",{className:"fixed inset-0 bg-slate-900/40 backdrop-blur-xs flex items-center justify-center z-50 p-4",children:e.jsxs("div",{className:"bg-white rounded-2xl border border-slate-200 shadow-2xl max-w-sm w-full p-5 flex flex-col gap-4 animate-in fade-in zoom-in duration-150",children:[e.jsxs("div",{className:"flex items-center justify-between pb-2 border-b border-slate-100",children:[e.jsxs("h3",{className:"font-bold text-sm text-slate-800 flex items-center gap-1.5",children:[e.jsx(Ue,{size:16,className:"text-amber-500"}),r==="zh"?"临时切换显示课程日期":"Temporarily Override Date"]}),e.jsx("button",{onClick:()=>{O(null),Q(""),k("")},className:"text-slate-400 hover:text-slate-600 hover:bg-slate-50 p-1 rounded-lg transition-colors cursor-pointer",children:e.jsx(be,{size:16})})]}),e.jsxs("div",{className:"text-xs text-slate-500 leading-relaxed",children:[e.jsx("p",{children:r==="zh"?`您正在设置 [${X}] 的课程显示。`:`You are overriding schedules displayed for [${X}].`}),e.jsx("p",{className:"mt-1",children:r==="zh"?"您可以将某一个日期的课临时指定为星期几的常规课表,或者指定为系统内的任意其他具体日期课程。":"Specify a day of the week or another target date to temporarily view its lessons."})]}),e.jsxs("div",{className:"flex bg-slate-100 p-1 rounded-xl",children:[e.jsx("button",{type:"button",onClick:()=>J("dow"),className:`flex-1 text-center py-1.5 text-xs font-bold rounded-lg transition-all cursor-pointer ${L==="dow"?"bg-white text-indigo-700 shadow-3xs":"text-slate-500 hover:text-slate-700"}`,children:r==="zh"?"常规星期几":"Day of Week"}),e.jsx("button",{type:"button",onClick:()=>J("date"),className:`flex-1 text-center py-1.5 text-xs font-bold rounded-lg transition-all cursor-pointer ${L==="date"?"bg-white text-indigo-700 shadow-3xs":"text-slate-500 hover:text-slate-700"}`,children:r==="zh"?"具体日期":"Specific Date"})]}),L==="dow"?e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-semibold text-slate-700 mb-1.5",children:r==="zh"?"选择常规星期几 *":"Select Day of Week *"}),e.jsxs("select",{value:F,onChange:t=>k(t.target.value),className:"w-full border border-gray-250 rounded-lg text-xs p-2.5 bg-white focus:outline-hidden focus:ring-1 focus:ring-indigo-500 transition-all font-sans text-gray-750 cursor-pointer",children:[e.jsx("option",{value:"",children:r==="zh"?"-- 请选择星期 --":"-- Select Day --"}),e.jsx("option",{value:"1",children:r==="zh"?"星期一":"Monday"}),e.jsx("option",{value:"2",children:r==="zh"?"星期二":"Tuesday"}),e.jsx("option",{value:"3",children:r==="zh"?"星期三":"Wednesday"}),e.jsx("option",{value:"4",children:r==="zh"?"星期四":"Thursday"}),e.jsx("option",{value:"5",children:r==="zh"?"星期五":"Friday"}),e.jsx("option",{value:"6",children:r==="zh"?"星期六":"Saturday"}),e.jsx("option",{value:"7",children:r==="zh"?"星期日":"Sunday"})]})]}):e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-semibold text-slate-700 mb-1.5",children:r==="zh"?"选择具体日期 *":"Select Target Date *"}),e.jsx("input",{type:"date",className:"w-full border border-gray-250 rounded-lg text-xs p-2.5 bg-white focus:outline-hidden focus:ring-1 focus:ring-indigo-500 transition-all font-sans text-gray-750 cursor-pointer",value:ae,onChange:t=>Q(t.target.value)})]}),e.jsxs("div",{className:"flex gap-2 justify-end pt-2 border-t border-slate-100",children:[e.jsx("button",{onClick:()=>{O(null),Q(""),k("")},className:"px-3.5 py-2 rounded-lg text-xs font-bold text-slate-500 bg-slate-100 hover:bg-slate-200/80 transition-all cursor-pointer",children:r==="zh"?"取消":"Cancel"}),e.jsx("button",{onClick:()=>{let t="";if(L==="dow"){if(!F){alert(r==="zh"?"请选择星期几":"Please select a day of the week");return}t=`dow-${F}`}else{if(!ae){alert(r==="zh"?"请选择一个日期":"Please select a date");return}t=ae}ee(s=>({...s,[X]:t})),O(null),Q(""),k("")},className:"px-3.5 py-2 rounded-lg text-xs font-bold text-white bg-indigo-600 hover:bg-indigo-700 shadow-sm transition-all cursor-pointer",children:r==="zh"?"应用切换":"Apply Switch"})]})]})})]})};function ws({classes:l,lessons:b,lang:r,onSchedulesUpdated:N}){return e.jsx("div",{className:"flex-1 overflow-hidden flex flex-col bg-white",id:"teacher_timetable_tab_panel",children:e.jsx(bs,{classes:l,lessons:b,lang:r,onSchedulesUpdated:N})})}export{ws as TimetableView};