openlearn-next 0.4.1 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/dist/assets/{BatchPickerModal-DCDKZsrS.js → BatchPickerModal-BpWu0Lil.js} +1 -1
  2. package/dist/assets/{ClassesView-COk1pTlX.js → ClassesView-KbHEqJto.js} +1 -1
  3. package/dist/assets/{ClassroomCountdownWidget-CHUvYSrT.js → ClassroomCountdownWidget-96WFRO9A.js} +1 -1
  4. package/dist/assets/{CloudDriveModal-DY7BSVJN.js → CloudDriveModal-DEQ1nkNk.js} +1 -1
  5. package/dist/assets/{CourseManagement-DA1m3Div.js → CourseManagement-D3ZpxY0l.js} +1 -1
  6. package/dist/assets/{CourseWizardModal-yDZpcltW.js → CourseWizardModal-Ck_-M8pk.js} +1 -1
  7. package/dist/assets/{Dashboard-QTNgTjoi.js → Dashboard-CYbpbofV.js} +1 -1
  8. package/dist/assets/{ExportWeightModal-Cq3BaikE.js → ExportWeightModal-DW2bu9Zz.js} +1 -1
  9. package/dist/assets/{HelpView-DY4CA5VA.js → HelpView-CtzdqhBq.js} +1 -1
  10. package/dist/assets/{ImportLessonsModal-DzeCcQOI.js → ImportLessonsModal-jBuIK453.js} +1 -1
  11. package/dist/assets/{InteractiveCoursewareViewer-D5py6E0c.js → InteractiveCoursewareViewer-Bj7ahXMs.js} +1 -1
  12. package/dist/assets/{InteractiveWhiteboard-D5YKM1I6.js → InteractiveWhiteboard-B7JcJvDu.js} +1 -1
  13. package/dist/assets/{LazyCourseware-DWCx60AO.js → LazyCourseware-CuiPxhDg.js} +2 -2
  14. package/dist/assets/{LazyWhiteboard-CFn-1ATp.js → LazyWhiteboard-BJwCEZAU.js} +2 -2
  15. package/dist/assets/{LessonEditorView-CfvhQfzG.js → LessonEditorView-DFrOp2qp.js} +1 -1
  16. package/dist/assets/{LiveClassroomView-CB_0PN1X.js → LiveClassroomView-BZ5nGee3.js} +1 -1
  17. package/dist/assets/{NotificationDetailModal-DBg7UPZh.js → NotificationDetailModal-Baqnc5pU.js} +1 -1
  18. package/dist/assets/{PluginView-wozVlSXQ.js → PluginView-CCbIuZ24.js} +1 -1
  19. package/dist/assets/{QuizGeneratorModal-DnW-ff7D.js → QuizGeneratorModal-BBEDssp7.js} +1 -1
  20. package/dist/assets/{StudentAssignmentView-tQiAv5Xn.js → StudentAssignmentView-DgIjUsXz.js} +1 -1
  21. package/dist/assets/{StudentLessonView-DRwhbGoU.js → StudentLessonView-CBJbI5x6.js} +1 -1
  22. package/dist/assets/{StudentPreviewModal-BQ_a7sQY.js → StudentPreviewModal-Bh8OZs0t.js} +1 -1
  23. package/dist/assets/{StudentView-XBaWzGO3.js → StudentView--uGxc5TJ.js} +2 -2
  24. package/dist/assets/{SystemResourceLibraryModal-Bcak0WSz.js → SystemResourceLibraryModal-BVCclcqA.js} +1 -1
  25. package/dist/assets/{TeacherView-961tBSMT.js → TeacherView-D4Zsc0eZ.js} +2 -2
  26. package/dist/assets/{index-BQF_s4QO.js → index-BKBCBKvy.js} +29 -29
  27. package/dist/index.html +1 -1
  28. package/dist/server.cjs +87 -16
  29. package/package.json +1 -1
@@ -1 +1 @@
1
- import{j as e}from"./vendor-react-B0t7H3hh.js";import{m as p}from"./index-BQF_s4QO.js";import"./vendor-utils-m0Urvtws.js";import"./vendor-icons-BRmhY6fg.js";import"./vendor-pdf-D7rGevI1.js";import"./vendor-motion-BFAPOs-b.js";import"./vendor-pptx-C5-U7ieS.js";import"./vendor-charts-qLbgF1eL.js";function w({batchPicker:o,setBatchPicker:t,batchPickerLesson:l,setBatchPickerLesson:a,batchPickerDate:i,setBatchPickerDate:n,batchPickerTargetClass:d,setBatchPickerTargetClass:c,lessons:x,classes:u,expandedClassId:m,confirmBatchPicker:h,lang:r}){return o?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(p.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},className:"bg-white border text-gray-900 border-gray-200 rounded-2xl shadow-2xl w-full max-w-md flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"p-4 border-b border-gray-100 flex items-center justify-between bg-gray-50/80",children:[e.jsx("h2",{className:"font-bold text-gray-800 text-base",children:o==="schedule"?r==="zh"?"批量排课":"Batch Schedule":o==="lockedLesson"?r==="zh"?"批量设置锁定课程":"Batch Lock Lesson":r==="zh"?"批量转班":"Batch Transfer"}),e.jsx("button",{onClick:()=>t(null),className:"text-gray-400 hover:text-gray-600 text-lg font-bold p-1 hover:bg-gray-200 rounded",children:"×"})]}),e.jsxs("div",{className:"p-5 space-y-4",children:[(o==="schedule"||o==="lockedLesson")&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-xs font-semibold text-gray-600",children:r==="zh"?"选择课程":"Select Lesson"}),e.jsxs("select",{value:l,onChange:s=>a(s.target.value),className:"w-full border border-gray-200 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500",children:[e.jsx("option",{value:"",children:r==="zh"?"— 请选择 —":"— Select —"}),x.map(s=>e.jsx("option",{value:s.id,children:s.title},s.id))]})]}),o==="schedule"&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-xs font-semibold text-gray-600",children:r==="zh"?"上课日期":"Schedule Date"}),e.jsx("input",{type:"date",value:i,onChange:s=>n(s.target.value),className:"w-full border border-gray-200 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500"})]}),o==="transfer"&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-xs font-semibold text-gray-600",children:r==="zh"?"选择目标班级":"Select Target Class"}),e.jsxs("select",{value:d,onChange:s=>c(s.target.value),className:"w-full border border-gray-200 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500",children:[e.jsx("option",{value:"",children:r==="zh"?"— 请选择 —":"— Select —"}),u.filter(s=>s.id!==m).map(s=>e.jsx("option",{value:s.id,children:s.name},s.id))]})]})]}),e.jsxs("div",{className:"p-4 border-t border-gray-100 flex justify-end gap-2",children:[e.jsx("button",{onClick:()=>t(null),className:"px-4 py-2 text-sm rounded-lg border border-gray-200 text-gray-600 hover:bg-gray-100 cursor-pointer",children:r==="zh"?"取消":"Cancel"}),e.jsx("button",{onClick:h,className:"px-4 py-2 text-sm rounded-lg bg-indigo-600 text-white hover:bg-indigo-700 cursor-pointer",children:r==="zh"?"确认":"Confirm"})]})]})}):null}export{w as BatchPickerModal};
1
+ import{j as e}from"./vendor-react-B0t7H3hh.js";import{m as p}from"./index-BKBCBKvy.js";import"./vendor-utils-m0Urvtws.js";import"./vendor-icons-BRmhY6fg.js";import"./vendor-pdf-D7rGevI1.js";import"./vendor-motion-BFAPOs-b.js";import"./vendor-pptx-C5-U7ieS.js";import"./vendor-charts-qLbgF1eL.js";function w({batchPicker:o,setBatchPicker:t,batchPickerLesson:l,setBatchPickerLesson:a,batchPickerDate:i,setBatchPickerDate:n,batchPickerTargetClass:d,setBatchPickerTargetClass:c,lessons:x,classes:u,expandedClassId:m,confirmBatchPicker:h,lang:r}){return o?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(p.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},className:"bg-white border text-gray-900 border-gray-200 rounded-2xl shadow-2xl w-full max-w-md flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"p-4 border-b border-gray-100 flex items-center justify-between bg-gray-50/80",children:[e.jsx("h2",{className:"font-bold text-gray-800 text-base",children:o==="schedule"?r==="zh"?"批量排课":"Batch Schedule":o==="lockedLesson"?r==="zh"?"批量设置锁定课程":"Batch Lock Lesson":r==="zh"?"批量转班":"Batch Transfer"}),e.jsx("button",{onClick:()=>t(null),className:"text-gray-400 hover:text-gray-600 text-lg font-bold p-1 hover:bg-gray-200 rounded",children:"×"})]}),e.jsxs("div",{className:"p-5 space-y-4",children:[(o==="schedule"||o==="lockedLesson")&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-xs font-semibold text-gray-600",children:r==="zh"?"选择课程":"Select Lesson"}),e.jsxs("select",{value:l,onChange:s=>a(s.target.value),className:"w-full border border-gray-200 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500",children:[e.jsx("option",{value:"",children:r==="zh"?"— 请选择 —":"— Select —"}),x.map(s=>e.jsx("option",{value:s.id,children:s.title},s.id))]})]}),o==="schedule"&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-xs font-semibold text-gray-600",children:r==="zh"?"上课日期":"Schedule Date"}),e.jsx("input",{type:"date",value:i,onChange:s=>n(s.target.value),className:"w-full border border-gray-200 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500"})]}),o==="transfer"&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-xs font-semibold text-gray-600",children:r==="zh"?"选择目标班级":"Select Target Class"}),e.jsxs("select",{value:d,onChange:s=>c(s.target.value),className:"w-full border border-gray-200 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500",children:[e.jsx("option",{value:"",children:r==="zh"?"— 请选择 —":"— Select —"}),u.filter(s=>s.id!==m).map(s=>e.jsx("option",{value:s.id,children:s.name},s.id))]})]})]}),e.jsxs("div",{className:"p-4 border-t border-gray-100 flex justify-end gap-2",children:[e.jsx("button",{onClick:()=>t(null),className:"px-4 py-2 text-sm rounded-lg border border-gray-200 text-gray-600 hover:bg-gray-100 cursor-pointer",children:r==="zh"?"取消":"Cancel"}),e.jsx("button",{onClick:h,className:"px-4 py-2 text-sm rounded-lg bg-indigo-600 text-white hover:bg-indigo-700 cursor-pointer",children:r==="zh"?"确认":"Confirm"})]})]})}):null}export{w as BatchPickerModal};
@@ -1,4 +1,4 @@
1
- import{j as e,r as D}from"./vendor-react-B0t7H3hh.js";import{i as ze,E as de,A as Qe,m as fe}from"./index-BQF_s4QO.js";import{b as me,N as re,U as te,B as se,q as Se,w as ie,ai as X,ah as oe,r as Ce,F as ce,a3 as Je,f as le,aq as qe,e as ae,am as je,ap as Ke,z as Y,C as ne,ar as Ye,_ as xe,D as Z,a5 as De,aM as Xe,at as Ze,aQ as ke,by as et,L as tt,bB as st,bL as at,bM as nt,bN as rt,bO as it,bP as lt,bQ as Re,bR as dt,bS as ot,bz as ct,T as he,bT as xt,i as ve,bU as ht,bt as mt,G as ut,ay as gt,d as Oe,aF as bt,X as ye,S as We,y as pt,j as Ee,aD as Ne,n as we}from"./vendor-icons-BRmhY6fg.js";import{a as ue,A as ft,C as Ae,X as ge,Y as be,T as pe,b as Pe,e as jt,L as vt,c as yt,B as Be,f as Fe}from"./vendor-charts-qLbgF1eL.js";import"./vendor-utils-m0Urvtws.js";import"./vendor-pdf-D7rGevI1.js";import"./vendor-motion-BFAPOs-b.js";import"./vendor-pptx-C5-U7ieS.js";function Le(t,a="en"){const n=(t||"").toLowerCase().trim();return n==="present"?a==="zh"?"出勤":"Present":n==="late"?a==="zh"?"迟到":"Late":n==="absent"?a==="zh"?"缺勤":"Absent":a==="zh"?"未记录":"Unrecorded"}function Ie(t,a="en"){if(!t||t<=0)return a==="zh"?"未记录":"N/A";try{const n=new Date(t);if(isNaN(n.getTime()))return a==="zh"?"未记录":"N/A";const s=i=>String(i).padStart(2,"0");return`${n.getFullYear()}-${s(n.getMonth()+1)}-${s(n.getDate())} ${s(n.getHours())}:${s(n.getMinutes())}:${s(n.getSeconds())}`}catch{return a==="zh"?"未记录":"N/A"}}function _e(t,a){const n=new Blob(["\uFEFF"+a],{type:"text/csv;charset=utf-8;"});if(typeof window<"u"){const s=typeof URL.createObjectURL=="function"?URL.createObjectURL(n):"",i=document.createElement("a");s?i.setAttribute("href",s):i.setAttribute("href","data:text/csv;charset=utf-8,\uFEFF"+encodeURIComponent(a)),i.setAttribute("download",t),i.style.visibility="hidden",document.body.appendChild(i),i.click(),document.body.removeChild(i),s&&typeof URL.revokeObjectURL=="function"&&URL.revokeObjectURL(s)}}function $e(t){const{className:a,schedule:n,students:s,attendanceRecords:i,lang:r="en"}=t,g=i||[],N=[],w=new Set;return s.forEach(z=>{w.add(z.id);const j=g.find(b=>b.student_id===z.id);N.push({className:a,scheduleId:n.id,scheduledDate:n.scheduled_date||"-",lessonTitle:n.lesson_title||"Untitled Lesson",studentId:z.id,studentName:z.name||z.id,studentEmail:z.email||"",status:Le(j?.status,r),checkInTime:Ie(j?.recorded_at,r)})}),g.forEach(z=>{w.has(z.student_id)||(w.add(z.student_id),N.push({className:a,scheduleId:n.id,scheduledDate:n.scheduled_date||"-",lessonTitle:n.lesson_title||"Untitled Lesson",studentId:z.student_id,studentName:z.student_name||z.student_id,studentEmail:"",status:Le(z.status,r),checkInTime:Ie(z.recorded_at,r)}))}),N}function Nt(t){const{className:a,schedule:n,students:s,attendanceRecords:i,lang:r="en"}=t,g=$e({className:a,schedule:n,students:s,attendanceRecords:i,lang:r}),w=[r==="zh"?["班级名称","排课日期","课程主题","学生姓名","学生邮箱","出勤状态","签到时间","学生ID","排课ID"]:["Class Name","Scheduled Date","Lesson Title","Student Name","Student Email","Attendance Status","Check-in Time","Student ID","Schedule ID"]];g.forEach(c=>{w.push([c.className,c.scheduledDate,c.lessonTitle,c.studentName,c.studentEmail,c.status,c.checkInTime,c.studentId,c.scheduleId])});const z=w.map(c=>c.map(ze).join(",")).join(`
1
+ import{j as e,r as D}from"./vendor-react-B0t7H3hh.js";import{i as ze,E as de,A as Qe,m as fe}from"./index-BKBCBKvy.js";import{b as me,N as re,U as te,B as se,q as Se,w as ie,ai as X,ah as oe,r as Ce,F as ce,a3 as Je,f as le,aq as qe,e as ae,am as je,ap as Ke,z as Y,C as ne,ar as Ye,_ as xe,D as Z,a5 as De,aM as Xe,at as Ze,aQ as ke,by as et,L as tt,bB as st,bL as at,bM as nt,bN as rt,bO as it,bP as lt,bQ as Re,bR as dt,bS as ot,bz as ct,T as he,bT as xt,i as ve,bU as ht,bt as mt,G as ut,ay as gt,d as Oe,aF as bt,X as ye,S as We,y as pt,j as Ee,aD as Ne,n as we}from"./vendor-icons-BRmhY6fg.js";import{a as ue,A as ft,C as Ae,X as ge,Y as be,T as pe,b as Pe,e as jt,L as vt,c as yt,B as Be,f as Fe}from"./vendor-charts-qLbgF1eL.js";import"./vendor-utils-m0Urvtws.js";import"./vendor-pdf-D7rGevI1.js";import"./vendor-motion-BFAPOs-b.js";import"./vendor-pptx-C5-U7ieS.js";function Le(t,a="en"){const n=(t||"").toLowerCase().trim();return n==="present"?a==="zh"?"出勤":"Present":n==="late"?a==="zh"?"迟到":"Late":n==="absent"?a==="zh"?"缺勤":"Absent":a==="zh"?"未记录":"Unrecorded"}function Ie(t,a="en"){if(!t||t<=0)return a==="zh"?"未记录":"N/A";try{const n=new Date(t);if(isNaN(n.getTime()))return a==="zh"?"未记录":"N/A";const s=i=>String(i).padStart(2,"0");return`${n.getFullYear()}-${s(n.getMonth()+1)}-${s(n.getDate())} ${s(n.getHours())}:${s(n.getMinutes())}:${s(n.getSeconds())}`}catch{return a==="zh"?"未记录":"N/A"}}function _e(t,a){const n=new Blob(["\uFEFF"+a],{type:"text/csv;charset=utf-8;"});if(typeof window<"u"){const s=typeof URL.createObjectURL=="function"?URL.createObjectURL(n):"",i=document.createElement("a");s?i.setAttribute("href",s):i.setAttribute("href","data:text/csv;charset=utf-8,\uFEFF"+encodeURIComponent(a)),i.setAttribute("download",t),i.style.visibility="hidden",document.body.appendChild(i),i.click(),document.body.removeChild(i),s&&typeof URL.revokeObjectURL=="function"&&URL.revokeObjectURL(s)}}function $e(t){const{className:a,schedule:n,students:s,attendanceRecords:i,lang:r="en"}=t,g=i||[],N=[],w=new Set;return s.forEach(z=>{w.add(z.id);const j=g.find(b=>b.student_id===z.id);N.push({className:a,scheduleId:n.id,scheduledDate:n.scheduled_date||"-",lessonTitle:n.lesson_title||"Untitled Lesson",studentId:z.id,studentName:z.name||z.id,studentEmail:z.email||"",status:Le(j?.status,r),checkInTime:Ie(j?.recorded_at,r)})}),g.forEach(z=>{w.has(z.student_id)||(w.add(z.student_id),N.push({className:a,scheduleId:n.id,scheduledDate:n.scheduled_date||"-",lessonTitle:n.lesson_title||"Untitled Lesson",studentId:z.student_id,studentName:z.student_name||z.student_id,studentEmail:"",status:Le(z.status,r),checkInTime:Ie(z.recorded_at,r)}))}),N}function Nt(t){const{className:a,schedule:n,students:s,attendanceRecords:i,lang:r="en"}=t,g=$e({className:a,schedule:n,students:s,attendanceRecords:i,lang:r}),w=[r==="zh"?["班级名称","排课日期","课程主题","学生姓名","学生邮箱","出勤状态","签到时间","学生ID","排课ID"]:["Class Name","Scheduled Date","Lesson Title","Student Name","Student Email","Attendance Status","Check-in Time","Student ID","Schedule ID"]];g.forEach(c=>{w.push([c.className,c.scheduledDate,c.lessonTitle,c.studentName,c.studentEmail,c.status,c.checkInTime,c.studentId,c.scheduleId])});const z=w.map(c=>c.map(ze).join(",")).join(`
2
2
  `),j=a.replace(/[^a-zA-Z0-9_\-\u4e00-\u9fa5]/g,"_"),b=(n.lesson_title||"schedule").replace(/[^a-zA-Z0-9_\-\u4e00-\u9fa5]/g,"_"),P=n.scheduled_date||new Date().toISOString().split("T")[0],k=`${j}_${b}_${P}_attendance.csv`;_e(k,z)}async function He(t,a,n){const s={...a},i=t.filter(r=>!s[r]);return i.length===0||await Promise.all(i.map(async r=>{try{if(n)await n(r);else{const g=await fetch(`/api/schedules/${r}/attendance`);if(g.ok){const N=await g.json();s[r]=N}}}catch(g){console.warn(`Failed to fetch attendance for schedule ${r}:`,g)}})),s}async function Ue(t){const{classInfo:a,schedules:n,students:s,scheduleAttendanceMap:i,lang:r="en",fetchScheduleAttendance:g}=t;if(!n||n.length===0){const l=r==="zh"?`班级 "${a.name}" 暂无排课记录。`:`No scheduled classes available for "${a.name}".`;alert(l);return}const N=n.map(l=>l.id),w=await He(N,i,g),j=[r==="zh"?["班级名称","排课日期","课程主题","学生姓名","学生邮箱","出勤状态","签到时间","学生ID","排课ID"]:["Class Name","Scheduled Date","Lesson Title","Student Name","Student Email","Attendance Status","Check-in Time","Student ID","Schedule ID"]];[...n].sort((l,f)=>(l.scheduled_date||"").localeCompare(f.scheduled_date||"")).forEach(l=>{const f=w[l.id]||i[l.id]||[];$e({className:a.name,schedule:l,students:s,attendanceRecords:f,lang:r}).forEach(S=>{j.push([S.className,S.scheduledDate,S.lessonTitle,S.studentName,S.studentEmail,S.status,S.checkInTime,S.studentId,S.scheduleId])})});const P=j.map(l=>l.map(ze).join(",")).join(`
3
3
  `),k=a.name.replace(/[^a-zA-Z0-9_\-\u4e00-\u9fa5]/g,"_"),c=new Date().toISOString().split("T")[0],L=`${k}_attendance_report_${c}.csv`;_e(L,P)}async function wt(t){const{classes:a,classSchedulesMap:n,classStudentsMap:s,scheduleAttendanceMap:i,lang:r="en",fetchScheduleAttendance:g}=t,N=[];if(a.forEach(c=>{(n[c.id]||[]).forEach(l=>N.push(l.id))}),N.length===0){alert(r==="zh"?"未找到任何排课记录,暂无可导出的考勤数据。":"No scheduled classes found. No attendance data to export.");return}const w=await He(N,i,g),j=[r==="zh"?["班级名称","排课日期","课程主题","学生姓名","学生邮箱","出勤状态","签到时间","学生ID","排课ID"]:["Class Name","Scheduled Date","Lesson Title","Student Name","Student Email","Attendance Status","Check-in Time","Student ID","Schedule ID"]];a.forEach(c=>{const L=n[c.id]||[],l=s[c.id]||[];[...L].sort((v,S)=>(v.scheduled_date||"").localeCompare(S.scheduled_date||"")).forEach(v=>{const S=w[v.id]||i[v.id]||[];$e({className:c.name,schedule:v,students:l,attendanceRecords:S,lang:r}).forEach(_=>{j.push([_.className,_.scheduledDate,_.lessonTitle,_.studentName,_.studentEmail,_.status,_.checkInTime,_.studentId,_.scheduleId])})})});const b=j.map(c=>c.map(ze).join(",")).join(`
4
4
  `),k=`All_Classes_Attendance_Report_${new Date().toISOString().split("T")[0]}.csv`;_e(k,b)}function zt({cls:t,lang:a,isExpanded:n,batchMode:s,selectedClassIds:i,setExpandedClassId:r,setSelectedStudentIds:g,toggleClassSelection:N,fetchClassStudents:w,fetchClassProgress:z,fetchClassDashboard:j,fetchClassSchedules:b}){const P=()=>{r(t.id),g(new Set),w(t.id),z(t.id),j(t.id),b(t.id)};return e.jsxs("div",{className:`p-2 flex items-center justify-between ${s?"cursor-pointer hover:bg-amber-50/60":"cursor-pointer hover:bg-gray-50"}`,onClick:()=>{if(s){N(t.id);return}n?r(null):P()},children:[e.jsxs("div",{className:"flex items-center gap-2",children:[s&&e.jsx("input",{type:"checkbox",className:"shrink-0 accent-amber-500",checked:i.has(t.id),onChange:()=>N(t.id),onClick:k=>k.stopPropagation()}),e.jsx("button",{type:"button",onClick:k=>{k.stopPropagation(),n?r(null):P()},className:"text-gray-400 hover:text-gray-600 shrink-0",children:n?e.jsx(me,{size:14}):e.jsx(re,{size:14})}),e.jsx("div",{className:`text-sm font-medium ${s&&i.has(t.id)?"text-amber-700":"text-gray-800"}`,children:t.name})]}),e.jsxs("div",{className:"flex items-center gap-3 text-xs text-gray-500 shrink-0",children:[e.jsxs("span",{className:"flex items-center gap-1",title:a==="zh"?"学生人数":"Students",children:[e.jsx(te,{size:13,className:"text-gray-400"}),t.student_count??0]}),e.jsxs("span",{className:"flex items-center gap-1",title:a==="zh"?"课程数量":"Courses",children:[e.jsx(se,{size:13,className:"text-gray-400"}),t.course_count??0]}),e.jsxs("span",{className:"flex items-center gap-1",title:a==="zh"?"作业数量":"Assignments",children:[e.jsx(Se,{size:13,className:"text-gray-400"}),t.assignment_count??0]})]})]})}function St({cls:t,lang:a,fetchClasses:n}){return e.jsxs("div",{className:"mb-4 bg-gradient-to-r from-indigo-50/70 to-violet-50/70 p-3.5 rounded-2xl border border-indigo-150/40 shadow-xs flex flex-col sm:flex-row sm:items-center justify-between gap-3 font-sans text-left",onClick:s=>s.stopPropagation(),children:[e.jsxs("div",{className:"space-y-1 text-left",children:[e.jsxs("div",{className:"flex items-center gap-1.5 justify-start",children:[e.jsx("span",{className:"inline-block w-2 h-2 rounded-full bg-indigo-500 animate-pulse shrink-0"}),e.jsx("span",{className:"text-xs font-black text-indigo-950 uppercase tracking-wider",children:a==="zh"?"临时班级密码 (支持学生快速一键密码登录)":"Temporary Class Passcode"})]}),e.jsx("p",{className:"text-xs text-indigo-600/80 font-semibold leading-relaxed text-left block",children:a==="zh"?"开始课堂后,全班学生均可使用此特定临时密码统一安全登录,无需强制输入个人自设密码。":"Once set, any pupil in this class can use this temporary passcode to log in directly."})]}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0 justify-end",children:[e.jsx("input",{id:`class-passcode-${t.id}`,type:"text",value:t.class_passcode||"",onChange:async s=>{const i=s.target.value;await fetch(`/api/classes/${t.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({class_passcode:i})}),await n()},placeholder:a==="zh"?"暂未设定 / 留空禁用":"Disabled / Enter code",className:"border border-indigo-200/80 rounded-xl text-xs px-2.5 py-1.5 w-36 text-center bg-white focus:outline-none focus:ring-2 focus:ring-indigo-500 font-mono font-bold text-gray-800 focus:border-transparent transition-all",onClick:s=>s.stopPropagation()}),e.jsx("button",{onClick:async s=>{s.stopPropagation();const i=Math.floor(1e3+Math.random()*9e3).toString();await fetch(`/api/classes/${t.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({class_passcode:i})}),await n()},className:"bg-indigo-600 hover:bg-indigo-700 text-white rounded-xl text-xs p-2 py-1.5 font-black shadow-xs transition-all hover:shadow-sm cursor-pointer shrink-0",title:a==="zh"?"随机生成班级密码":"Generate random passcode",children:a==="zh"?"随机生成":"Random Gen"}),t.class_passcode&&e.jsx("button",{onClick:async s=>{s.stopPropagation(),await fetch(`/api/classes/${t.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({class_passcode:null})}),await n()},className:"bg-slate-200 hover:bg-slate-300 text-slate-700 rounded-xl text-xs p-2 py-1.5 font-bold shadow-xs transition-colors cursor-pointer shrink-0",title:a==="zh"?"清除临时密码":"Clear temporary passcode",children:a==="zh"?"清除":"Clear"})]})]})}function Ct({cls:t,lang:a,classActiveTabs:n,setClassActiveTabs:s}){return e.jsxs("div",{className:"flex items-center gap-1 bg-slate-100 p-1 rounded-xl mb-4 max-w-md border border-slate-200/40",onClick:i=>i.stopPropagation(),children:[e.jsxs("button",{onClick:i=>{i.stopPropagation(),s(r=>({...r,[t.id]:"students"}))},className:`flex-1 py-1.5 px-3 rounded-lg text-xs font-semibold flex items-center justify-center gap-1.5 transition-all duration-200 cursor-pointer ${(n[t.id]||"students")==="students"?"bg-white text-indigo-600 shadow-xs font-bold border border-slate-200/50":"text-slate-500 hover:text-slate-800 hover:bg-white/40"}`,children:[e.jsx(te,{size:12}),e.jsx("span",{children:a==="zh"?"学生名单":"Students"})]}),e.jsxs("button",{onClick:i=>{i.stopPropagation(),s(r=>({...r,[t.id]:"assignments"}))},className:`flex-1 py-1.5 px-3 rounded-lg text-xs font-semibold flex items-center justify-center gap-1.5 transition-all duration-200 cursor-pointer ${(n[t.id]||"students")==="assignments"?"bg-white text-indigo-600 shadow-xs font-bold border border-slate-200/50":"text-slate-500 hover:text-slate-800 hover:bg-white/40"}`,children:[e.jsx(ie,{size:12}),e.jsx("span",{children:a==="zh"?"作业成绩":"Assignments"})]}),e.jsxs("button",{onClick:i=>{i.stopPropagation(),s(r=>({...r,[t.id]:"schedules"}))},className:`flex-1 py-1.5 px-3 rounded-lg text-xs font-semibold flex items-center justify-center gap-1.5 transition-all duration-200 cursor-pointer ${(n[t.id]||"students")==="schedules"?"bg-white text-indigo-600 shadow-xs font-bold border border-slate-200/50":"text-slate-500 hover:text-slate-800 hover:bg-white/40"}`,children:[e.jsx(X,{size:12}),e.jsx("span",{children:a==="zh"?"课表考勤":"Attendance"})]}),e.jsxs("button",{onClick:i=>{i.stopPropagation(),s(r=>({...r,[t.id]:"grades"}))},className:`flex-1 py-1.5 px-3 rounded-lg text-xs font-semibold flex items-center justify-center gap-1.5 transition-all duration-200 cursor-pointer ${(n[t.id]||"students")==="grades"?"bg-white text-indigo-600 shadow-xs font-bold border border-slate-200/50":"text-slate-500 hover:text-slate-800 hover:bg-white/40"}`,children:[e.jsx(Se,{size:12}),e.jsx("span",{children:a==="zh"?"学期总评":"Grades"})]}),e.jsx(de,{slot:"class.tab",slotProps:{renderType:"button",classId:t.id,lang:a,classActiveTab:n[t.id]||"students",setClassActiveTab:i=>s(r=>({...r,[t.id]:i}))}})]})}function kt({schedules:t=[],progress:a=[],lang:n="en"}){const s=D.useMemo(()=>!t||t.length===0?[]:[...t].sort((g,N)=>new Date(g.scheduled_date).getTime()-new Date(N.scheduled_date).getTime()).map((g,N)=>{const w=a.find(P=>P.lesson_id===g.lesson_id),z=w?Math.round(w.average_progress):0,j=new Date(g.scheduled_date),b=isNaN(j.getTime())?g.scheduled_date:j.toLocaleDateString(n==="zh"?"zh-CN":"en-US",{month:"short",day:"numeric"});return{id:g.id,index:N+1,lessonId:g.lesson_id,lessonTitle:g.lesson_title||g.title||`Lesson ${N+1}`,scheduledDate:g.scheduled_date,dateLabel:b,progress:z}}),[t,a,n]),i=D.useMemo(()=>{if(s.length===0)return{avgProg:0,completedCount:0,pendingCount:0,activeCount:0};const g=s.reduce((b,P)=>b+P.progress,0),N=Math.round(g/s.length),w=s.filter(b=>b.progress>=90).length,z=s.filter(b=>b.progress>0&&b.progress<90).length,j=s.filter(b=>b.progress===0).length;return{avgProg:N,completedCount:w,pendingCount:j,activeCount:z}},[s]),r={title:n==="zh"?"学期排课进度看板":"Scheduled Lessons Progress",subtitle:n==="zh"?"班级在全学期已规划课程中的平均学习进度曲线":"Class average completion progress across the semester's scheduled lessons",averageProgress:n==="zh"?"平均课程总进度":"Average Class Progress",completedLessons:n==="zh"?"已通关课程":"Completed Lessons",activeLessons:n==="zh"?"进行中课程":"Lessons In-Progress",pendingLessons:n==="zh"?"未开始课程":"Not Started",timeline:n==="zh"?"排课进度时间轴":"Lesson Progress Timeline",over90:n==="zh"?"通关基准线 (90%)":"Completion Benchmark (90%)",averageLine:n==="zh"?"平均进度线":"Class Average Line",emptyTitle:n==="zh"?"暂无排课进度":"No Scheduled Progress Data",emptyDesc:n==="zh"?"该班级尚未规划任何课程。请在下方【日程安排与考勤】中指派具体的微课及日期,随后此处的实时进度图表便会随学生学习进程同步渲染。":'No schedules have been defined for this class yet. Assign lessons under the "Schedule & Attendance" panel below to begin visualizing your student group progress trajectory.',detailsLabel:n==="zh"?"第 {idx} 节课: {title}":"Session #{idx}: {title}"};return t.length===0?e.jsx("div",{className:"bg-white border border-gray-150 rounded-xl p-6 shadow-sm font-sans",children:e.jsxs("div",{className:"max-w-md mx-auto text-center py-6",children:[e.jsx("div",{className:"inline-flex p-3 bg-pink-50 text-pink-600 rounded-full mb-3",children:e.jsx(ie,{className:"w-6 h-6 animate-pulse"})}),e.jsx("h4",{className:"font-bold text-gray-800 text-sm",children:r.emptyTitle}),e.jsx("p",{className:"text-gray-500 text-xs mt-2 leading-relaxed",children:r.emptyDesc})]})}):e.jsxs("div",{className:"bg-white border border-gray-150 rounded-xl shadow-xs overflow-hidden flex flex-col font-sans",id:"scheduled-lessons-progress-container",children:[e.jsx("div",{className:"p-4 border-b border-gray-100 bg-gray-50/50 flex flex-col sm:flex-row sm:items-center justify-between gap-3",children:e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsx("div",{className:"p-2 bg-pink-50 text-pink-600 rounded-lg shrink-0",children:e.jsx(oe,{size:16})}),e.jsxs("div",{children:[e.jsxs("h4",{className:"font-bold text-gray-800 text-sm flex items-center gap-1.5 flex-wrap",children:[e.jsx("span",{children:r.title}),e.jsxs("span",{className:"inline-flex items-center gap-1 bg-pink-50 text-pink-700 border border-pink-100 rounded-full px-2 py-0.5 text-xs font-bold",children:[e.jsx("span",{className:"w-1 h-1 rounded-full bg-pink-500 animate-ping"}),n==="zh"?"实时同步":"Live Sync"]})]}),e.jsx("p",{className:"text-gray-400 text-xs mt-0.5 leading-relaxed",children:r.subtitle})]})]})}),e.jsxs("div",{className:"px-4 py-3 border-b border-gray-100 bg-white grid grid-cols-2 sm:grid-cols-4 gap-2.5",children:[e.jsxs("div",{className:"bg-pink-50/20 border border-pink-100/40 p-2.5 rounded-lg flex items-center gap-2",children:[e.jsx("div",{className:"p-2 bg-pink-50 text-pink-600 rounded-md shrink-0",children:e.jsx(ie,{size:14})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-xs font-bold text-gray-400 uppercase tracking-wider truncate",children:r.averageProgress}),e.jsxs("div",{className:"text-xs font-bold text-gray-800 font-mono mt-0.5",children:[i.avgProg,"%"]})]})]}),e.jsxs("div",{className:"bg-emerald-50/20 border border-emerald-100/40 p-2.5 rounded-lg flex items-center gap-2",children:[e.jsx("div",{className:"p-2 bg-emerald-50 text-emerald-600 rounded-md shrink-0",children:e.jsx(Ce,{size:14})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-xs font-bold text-gray-400 uppercase tracking-wider truncate",children:r.completedLessons}),e.jsxs("div",{className:"text-xs font-bold text-gray-800 font-mono mt-0.5",children:[i.completedCount," / ",s.length]})]})]}),e.jsxs("div",{className:"bg-yellow-50/20 border border-yellow-100/30 p-2.5 rounded-lg flex items-center gap-2",children:[e.jsx("div",{className:"p-2 bg-yellow-50 text-yellow-600 rounded-md shrink-0",children:e.jsx(ce,{size:14})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-xs font-bold text-gray-400 uppercase tracking-wider truncate",children:r.activeLessons}),e.jsx("div",{className:"text-xs font-bold text-gray-800 font-mono mt-0.5",children:i.activeCount})]})]}),e.jsxs("div",{className:"bg-slate-50/30 border border-slate-100/60 p-2.5 rounded-lg flex items-center gap-2",children:[e.jsx("div",{className:"p-2 bg-slate-50 text-slate-500 rounded-md shrink-0",children:e.jsx(se,{size:14})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-xs font-bold text-gray-400 uppercase tracking-wider truncate",children:r.pendingLessons}),e.jsx("div",{className:"text-xs font-bold text-gray-800 font-mono mt-0.5",children:i.pendingCount})]})]})]}),e.jsxs("div",{className:"p-4 space-y-4",children:[e.jsxs("div",{className:"text-xs font-bold text-pink-900 flex items-center gap-1",children:[e.jsx(X,{size:11,className:"text-pink-500"}),e.jsx("span",{children:r.timeline})]}),e.jsx("div",{className:"h-44 w-full bg-slate-50/30 border border-slate-100 p-2 rounded-lg relative",children:e.jsx(ue,{width:"100%",height:"100%",children:e.jsxs(ft,{data:s,margin:{top:10,right:10,left:-24,bottom:0},children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"progressGrad",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"5%",stopColor:"#ec4899",stopOpacity:.25}),e.jsx("stop",{offset:"95%",stopColor:"#ec4899",stopOpacity:0})]})}),e.jsx(Ae,{strokeDasharray:"3 3",vertical:!1,stroke:"#f1f5f9"}),e.jsx(ge,{dataKey:"dateLabel",tick:{fontSize:12,fill:"#64748b",fontWeight:"bold"},axisLine:{stroke:"#e2e8f0"},tickLine:!1}),e.jsx(be,{domain:[0,100],tick:{fontSize:12,fill:"#64748b",fontWeight:"bold"},axisLine:{stroke:"#e2e8f0"},tickLine:!1}),e.jsx(pe,{content:({active:g,payload:N})=>{if(g&&N&&N.length){const w=N[0].payload;return e.jsxs("div",{className:"p-2.5 bg-white border border-pink-100 rounded-lg shadow-md max-w-[220px]",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-gray-100 pb-1.5 mb-1.5",children:[e.jsx("span",{className:"text-xs text-gray-400 font-bold font-mono",children:w.scheduledDate}),e.jsxs("span",{className:"inline-flex items-center bg-pink-50 text-pink-700 px-1.5 py-0.5 rounded-full text-xs font-extrabold font-mono border border-pink-100",children:[w.progress,"%"]})]}),e.jsx("p",{className:"text-xs font-bold text-gray-800 leading-tight",children:r.detailsLabel.replace("{idx}",w.index).replace("{title}",w.lessonTitle)})]})}return null}}),e.jsx(Pe,{y:90,stroke:"#10b981",strokeWidth:1,strokeDasharray:"3 3",label:{value:r.over90,fill:"#10b981",fontSize:12,fontWeight:"bold",position:"top",offset:2}}),e.jsx(Pe,{y:i.avgProg,stroke:"#ec4899",strokeWidth:1,strokeDasharray:"2 2",label:{value:`${r.averageLine} (${i.avgProg}%)`,fill:"#ec4899",fontSize:12,fontWeight:"semibold",position:"bottom",offset:2}}),e.jsx(jt,{type:"monotone",dataKey:"progress",stroke:"#ec4899",strokeWidth:2,fillOpacity:1,fill:"url(#progressGrad)",dot:{r:3,stroke:"#ffffff",strokeWidth:1.5,fill:"#ec4899"},activeDot:{r:5,stroke:"#ffffff",strokeWidth:1.5,fill:"#f43f5e"}})]})})})]})]})}function At({students:t=[],assignments:a=[],performance:n=[],lang:s="en"}){const[i,r]=D.useState(()=>t.length>=2?[t[0].id,t[1].id]:t.map(c=>c.id)),[g,N]=D.useState("running_average"),w=["#6366f1","#f43f5e","#10b981","#0ea5e9","#f59e0b","#8b5cf6","#ec4899","#14b8a6"],{chartData:z,comparedStudentSummary:j,chronologicalAssignments:b}=D.useMemo(()=>{const c=[...a].sort((m,_)=>(m.created_at||0)-(_.created_at||0)),L=t.filter(m=>i.includes(m.id)),l={},f={};L.forEach(m=>{l[m.id]=0,f[m.id]=0});const v=c.map((m,_)=>{const I={name:m.title.replace("MCQ Evaluation: ","").replace("评估: ",""),fullName:m.title,index:_+1};return L.forEach($=>{const Q=n.find(p=>p.student_id===$.id&&p.assignment_id===m.id&&p.submission_status==="graded"&&typeof p.score=="number"&&p.score!==null);if(Q&&Q.score!==null){const p=Number(Q.score);l[$.id]+=p,f[$.id]+=1;const T=Math.round(l[$.id]/f[$.id]*10)/10;I[`raw_${$.id}`]=p,I[`avg_${$.id}`]=T}else I[`raw_${$.id}`]=null,I[`avg_${$.id}`]=f[$.id]>0?Math.round(l[$.id]/f[$.id]*10)/10:null}),I}),S=L.map((m,_)=>{const I=c.map(W=>n.find(J=>J.student_id===m.id&&J.assignment_id===W.id&&J.submission_status==="graded"&&typeof J.score=="number"&&J.score!==null)).filter(W=>W&&W.score!==null).map(W=>Number(W.score)),$=I.length,Q=$>0?I[0]:0,p=$>0?I[$-1]:0,T=v.map(W=>W[`avg_${m.id}`]).filter(W=>typeof W=="number"&&W!==null),O=T.length>0?T[0]:0,G=T.length>0?T[T.length-1]:0,V=Math.round((G-O)*10)/10,q=$>0?Math.max(...I):0;return{id:m.id,name:m.name,color:w[_%w.length],totalItems:$,startingScore:Q,currentScore:p,startingAvg:O,finalAvg:G,netGrowth:V,peak:q}});return{chartData:v.filter(m=>L.some(_=>m[`avg_${_.id}`]!==null||m[`raw_${_.id}`]!==null)),comparedStudentSummary:S,chronologicalAssignments:c}},[t,a,n,i]),P=c=>{r(L=>L.includes(c)?L.filter(l=>l!==c):[...L,c])},k={panelTitle:s==="zh"?"多生学力成长对比透视":"Student Performance & Growth Comparison",panelSub:s==="zh"?"选择多位学生,跨作业维度水平比对单次得分或累积移动平均线,分析班级成长差值":"Select two or more pupils to synthesize comparative academic curves over coursework timelines",metricSelect:s==="zh"?"对比数据:":"Metric:",noStudentsMsg:s==="zh"?"请选择至少两位学生以生成比对坐标系":"Please select at least two students to visualize academic trends",metricsTableTitle:s==="zh"?"学术轨迹成长对比数据":"Trajectory Growth Metrics Summary",tableNet:s==="zh"?"成长趋势净值":"Net Growth Trend",insufficientData:s==="zh"?"当前班级数据不满足比对条件。请录入多名学生及作业评分后再作比对。":"Insufficient dataset. Please enroll multiple student evaluations to configure comparing nodes."};return t.length===0||a.length===0?e.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl p-6 text-center shadow-xs font-sans",children:[e.jsx(Je,{className:"w-8 h-8 text-indigo-500 mx-auto mb-2 animate-bounce"}),e.jsx("p",{className:"text-gray-550 text-xs font-medium leading-relaxed",children:k.insufficientData})]}):e.jsxs("div",{className:"bg-white border border-gray-200 rounded-2xl shadow-xs overflow-hidden flex flex-col font-sans mt-2 mb-6",id:"student-growth-compare-card",children:[e.jsxs("div",{className:"p-4 border-b border-gray-100 bg-linear-to-r from-indigo-50/10 via-white to-sky-50/10 flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsx("div",{className:"p-2 bg-indigo-50 text-indigo-600 rounded-xl mt-0.5",children:e.jsx(te,{size:18,className:"stroke-[2.5]"})}),e.jsxs("div",{children:[e.jsxs("h4",{className:"font-extrabold text-gray-900 text-sm flex items-center gap-1.5 flex-wrap",children:[e.jsx("span",{children:k.panelTitle}),e.jsxs("span",{className:"inline-flex items-center gap-0.5 bg-indigo-100 text-indigo-800 border border-indigo-200/50 rounded-full px-2 py-0.5 text-xs font-black uppercase",children:[e.jsx(le,{size:8,className:"animate-spin text-indigo-600"}),s==="zh"?"多维透视":"Cohort Analytics"]})]}),e.jsx("p",{className:"text-gray-500 text-xs mt-0.5 leading-relaxed",children:k.panelSub})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 mt-2 border-t border-gray-100/60 pt-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs font-extrabold text-gray-400 uppercase tracking-wider",children:k.metricSelect}),e.jsxs("div",{className:"inline-flex bg-gray-100 p-0.5 rounded-lg border border-gray-200/55 shadow-3xs select-none",children:[e.jsxs("button",{type:"button",onClick:()=>N("running_average"),className:`px-3 py-1 text-xs font-bold rounded-md transition-all cursor-pointer flex items-center gap-1 ${g==="running_average"?"bg-white text-indigo-700 shadow-xs border-indigo-50 font-extrabold":"text-gray-500 hover:text-gray-800"}`,children:[e.jsx(oe,{size:11}),e.jsx("span",{children:s==="zh"?"累积成长轨迹":"Running Trajectory"})]}),e.jsxs("button",{type:"button",onClick:()=>N("raw_score"),className:`px-3 py-1 text-xs font-bold rounded-md transition-all cursor-pointer flex items-center gap-1 ${g==="raw_score"?"bg-white text-indigo-700 shadow-xs border-indigo-50 font-extrabold":"text-gray-500 hover:text-gray-800"}`,children:[e.jsx(qe,{size:11}),e.jsx("span",{children:s==="zh"?"单次作业得分":"Syllabus Scores"})]})]})]}),e.jsx("div",{className:"text-xs text-indigo-600/75 italic bg-indigo-50/50 px-2 py-1 rounded-md border border-indigo-100/30",children:g==="running_average"?s==="zh"?"💡 呈现从第一次作业后开始的平均学力,能更好地平滑单次测验失常":"💡 Cumulative average line provides an overview of consistency while eliminating single test noise":s==="zh"?"💡 呈现每次作业的评估分数波动,能捕捉近期的突破和退步":"💡 Raw scores show performance on individual assignments, highlighting highlights and deviations"})]})]}),e.jsxs("div",{className:"p-4 grid grid-cols-1 lg:grid-cols-4 gap-5",children:[e.jsxs("div",{className:"lg:col-span-1 bg-slate-50/50 rounded-xl border border-slate-150 p-3 flex flex-col justify-between max-h-[340px] overflow-hidden",children:[e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsx("span",{className:"text-xs font-black uppercase text-slate-400 tracking-wider mb-2 block select-none",children:s==="zh"?"参比学生选单":"Active Pupil List"}),e.jsx("div",{className:"flex-1 overflow-y-auto space-y-1.5 pr-0.5",id:"enrolled-pupils-compare-checklist",children:t.map((c,L)=>{const l=i.includes(c.id),f=w[L%w.length];return e.jsx("button",{type:"button",onClick:()=>P(c.id),className:`w-full flex items-center justify-between text-left p-2 rounded-xl border transition-all text-xs cursor-pointer select-none ${l?"bg-white border-gray-200/80 shadow-3xs font-bold ring-1 ring-slate-100/50":"bg-transparent border-transparent text-gray-500 hover:bg-slate-100/60"}`,children:e.jsxs("div",{className:"flex items-center gap-2 truncate pr-2",children:[e.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center border text-xs text-white shrink-0 font-extrabold",style:{backgroundColor:l?f:"#e2e8f0",borderColor:l?f:"#cbd5e1"},children:l?e.jsx(ae,{size:11,className:"stroke-[3]"}):c.name.charAt(0)}),e.jsxs("div",{className:"truncate",children:[e.jsx("div",{className:"truncate font-bold text-gray-800 text-xs",children:c.name}),c.email&&e.jsx("div",{className:"text-xs text-gray-400 truncate",children:c.email})]})]})},c.id)})})]}),e.jsxs("div",{className:"mt-3 pt-2.5 border-t border-slate-200/70 text-xs text-slate-400 leading-normal flex items-center gap-1",children:[e.jsx(ie,{size:12,className:"text-indigo-400"}),e.jsx("span",{children:s==="zh"?"勾选即可实时载入/移除比对":"Toggle checkboxes to real-time update"})]})]}),e.jsx("div",{className:"lg:col-span-3 flex flex-col justify-between",id:"compare-canvas-holder",children:i.length<2?e.jsx("div",{className:"h-[250px] flex items-center justify-center border border-dashed border-gray-200 bg-gray-50/50 rounded-xl p-6",children:e.jsxs("div",{className:"max-w-xs text-center",children:[e.jsx(te,{size:24,className:"text-indigo-300 mx-auto mb-2 animate-bounce"}),e.jsx("p",{className:"text-gray-500 text-xs font-semibold leading-relaxed",children:k.noStudentsMsg})]})}):e.jsx("div",{className:"h-[250px] w-full relative bg-slate-50/15 border border-slate-100 p-2.5 rounded-2xl shadow-3xs",children:e.jsx(ue,{width:"100%",height:"100%",children:e.jsxs(vt,{data:z,margin:{top:15,right:15,left:-22,bottom:5},children:[e.jsx(Ae,{strokeDasharray:"3 3",stroke:"#f1f5f9",vertical:!1}),e.jsx(ge,{dataKey:"name",tick:{fontSize:12,fill:"#64748b",fontWeight:"bold"},axisLine:{stroke:"#e2e8f0"},tickLine:!1}),e.jsx(be,{domain:[0,100],tick:{fontSize:12,fill:"#64748b",fontWeight:"bold"},axisLine:{stroke:"#e2e8f0"},tickLine:!1}),e.jsx(pe,{content:({active:c,payload:L,label:l})=>c&&L&&L.length?e.jsxs("div",{className:"p-3 bg-white/95 border border-gray-150 rounded-xl shadow-xl max-w-[280px] font-sans text-xs",children:[e.jsxs("div",{className:"font-extrabold text-slate-800 leading-tight mb-2 border-b border-gray-100 pb-1.5 flex items-center justify-between",children:[e.jsx("span",{className:"truncate max-w-[180px]",children:l}),e.jsx("span",{className:"text-xs bg-slate-100 text-slate-500 px-1.5 py-0.5 rounded font-bold uppercase shrink-0",children:"Evaluated Item"})]}),e.jsx("div",{className:"space-y-1.5",children:L.map(f=>{const v=f.dataKey.split("_")[1],S=t.find(m=>m.id===v);return S?e.jsxs("div",{className:"flex items-center justify-between gap-4 font-sans text-xs",children:[e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{backgroundColor:f.stroke}}),e.jsx("span",{className:"font-semibold text-gray-700 truncate",children:S.name})]}),e.jsxs("span",{className:"font-black font-mono",style:{color:f.stroke},children:[f.value,"%"]})]},f.dataKey):null})})]}):null}),j.map(c=>{const L=g==="running_average"?`avg_${c.id}`:`raw_${c.id}`;return e.jsx(yt,{type:"monotone",name:c.name,dataKey:L,stroke:c.color,strokeWidth:g==="running_average"?3.5:2.5,dot:{r:3,stroke:"#ffffff",strokeWidth:1.5,fill:c.color},activeDot:{r:5,stroke:"#ffffff",strokeWidth:2,fill:c.color},animationDuration:1e3,connectNulls:!0},c.id)})]})})})})]}),i.length>=2&&j.length>0&&e.jsxs("div",{className:"px-4 pb-4 border-t border-gray-100 pt-3",children:[e.jsxs("div",{className:"text-xs font-black uppercase text-slate-400 tracking-wider mb-2.5 select-none flex items-center gap-1",children:[e.jsx(je,{size:12,className:"text-indigo-500"}),e.jsx("span",{children:k.metricsTableTitle})]}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-4 gap-3",children:j.map(c=>{const L=c.netGrowth>1,l=c.netGrowth<-1;return e.jsxs("div",{className:"p-3 bg-slate-50/50 border border-slate-100 rounded-xl flex flex-col justify-between",style:{borderLeft:`3px solid ${c.color}`},children:[e.jsxs("div",{className:"flex justify-between items-start gap-1",children:[e.jsx("span",{className:"text-xs font-extrabold text-slate-800 truncate",title:c.name,children:c.name}),e.jsxs("span",{className:"text-xs text-gray-400 font-mono font-bold",children:[c.totalItems," ",s==="zh"?"个样本":"graded"]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 mt-2 pt-2 border-t border-slate-100/60 select-none",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-xs text-gray-400 uppercase font-black",children:s==="zh"?"基础/当前均分":"Base/Live Avg"}),e.jsxs("div",{className:"text-xs font-bold font-mono text-slate-700 mt-0.5",children:[c.startingAvg,"% → ",c.finalAvg,"%"]})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("span",{className:"text-xs text-gray-400 uppercase font-black",children:k.tableNet}),e.jsxs("div",{className:"flex items-center justify-end gap-0.5 mt-0.5",children:[e.jsxs("span",{className:`text-xs font-black font-mono ${L?"text-emerald-600":l?"text-red-500":"text-slate-600"}`,children:[c.netGrowth>0?`+${c.netGrowth}`:c.netGrowth,"%"]}),L&&e.jsx(oe,{size:11,className:"text-emerald-500 shrink-0"}),l&&e.jsx(Ke,{size:11,className:"text-red-400 shrink-0"})]})]})]}),e.jsxs("div",{className:"mt-2 text-xs bg-white p-1 rounded border border-slate-150 flex items-center justify-between font-mono select-none",children:[e.jsx("span",{className:"text-gray-400 font-bold",children:s==="zh"?"评估最值":"Peak Score"}),e.jsxs("span",{className:"font-extrabold text-indigo-700",children:[c.peak,"%"]})]})]},c.id)})})]})]})}function _t({classId:t,lang:a="en"}){const[n,s]=D.useState([]),[i,r]=D.useState(!0),[g,N]=D.useState(null),[w,z]=D.useState("heatmap"),[j,b]=D.useState(null),P=D.useMemo(()=>n.length===0?null:[...n].sort((l,f)=>l.attendanceRate-f.attendanceRate)[0],[n]),k=D.useMemo(()=>{const l=new Date,f=new Date;f.setDate(l.getDate()-34);const v=f.getDay(),S=v===0?6:v-1;f.setDate(f.getDate()-S);const m=[],_=new Date(f),I=new Date(l),$=I.getDay(),Q=$===0?0:7-$;for(I.setDate(I.getDate()+Q);_<=I;){const p=_.toISOString().split("T")[0],T=n.find(O=>O.date===p);m.push({dateStr:p,dayOfMonth:_.getDate(),monthName:_.toLocaleDateString(a==="zh"?"zh-CN":"en-US",{month:"short"}),isToday:p===l.toISOString().split("T")[0],isFuture:_>l,dayOfWeek:_.getDay(),match:T}),_.setDate(_.getDate()+1)}return m},[n,a]);D.useEffect(()=>{if(n&&n.length>0&&k&&k.length>0){const l=[...n].sort((f,v)=>f.attendanceRate-v.attendanceRate)[0];if(l){const f=k.find(v=>v.dateStr===l.date);f&&b(f)}}},[n,k]),D.useEffect(()=>{let l=!0;return(async()=>{r(!0),N(null);try{const v=await fetch(`/api/classes/${t}/attendance-summary`);if(!v.ok)throw new Error(`Error: ${v.status} ${v.statusText}`);const S=await v.json();l&&s(S)}catch(v){l&&N(v.message||"Failed to loaded attendance summary")}finally{l&&r(!1)}})(),()=>{l=!1}},[t]);const c=D.useMemo(()=>{if(n.length===0)return{avgRate:0,totalPresent:0,totalLate:0,totalAbsent:0,totalSchedules:0};let l=0,f=0,v=0,S=0;return n.forEach(m=>{l+=m.attendanceRate,f+=m.present,v+=m.late,S+=m.absent}),{avgRate:Math.round(l/n.length),totalPresent:f,totalLate:v,totalAbsent:S,totalSchedules:n.length}},[n]);if(i)return e.jsxs("div",{className:"bg-white border border-gray-100 rounded-xl p-6 shadow-sm flex flex-col items-center justify-center min-h-[220px]",children:[e.jsx(Y,{className:"animate-spin text-indigo-500 mb-2",size:24}),e.jsx("span",{className:"text-xs text-gray-400 font-sans",children:a==="zh"?"正在加载出勤分析数据...":"Loading attendance analytics..."})]});if(g)return e.jsxs("div",{className:"bg-white border border-red-100 rounded-xl p-6 shadow-sm flex flex-col items-center justify-center min-h-[220px]",children:[e.jsx(ne,{className:"text-red-500 mb-2",size:24}),e.jsx("span",{className:"text-xs text-red-600 font-sans text-center",children:a==="zh"?`无法加载出勤分析: ${g}`:`Failed to load attendance analysis: ${g}`})]});if(n.length===0)return e.jsxs("div",{className:"bg-white border border-gray-100 rounded-xl p-6 shadow-sm flex flex-col items-center justify-center min-h-[220px] select-none text-center",children:[e.jsx(X,{className:"text-gray-300 mb-2",size:28}),e.jsx("span",{className:"text-xs font-semibold text-gray-500 font-sans block mb-1",children:a==="zh"?"近30天内没有出勤记录":"No Attendance Records in Last 30 Days"}),e.jsx("span",{className:"text-xs text-gray-400 max-w-sm",children:a==="zh"?"在新日程安排中为学生记录出勤后,统计数据将自动在此处生成。":"Attendance stats will generate automatically once you schedule lessons and register student statuses."})]});const L=n.map(l=>{try{const f=new Date(l.date);if(isNaN(f.getTime()))return{...l,displayDate:l.date};const v=f.getDate(),S=f.toLocaleDateString(a==="zh"?"zh-CN":"en-US",{month:"short"});return{...l,displayDate:a==="zh"?`${S}${v}日`:`${S} ${v}`}}catch{return{...l,displayDate:l.date}}});return e.jsxs("div",{className:"bg-white border border-gray-100 rounded-xl p-4 shadow-sm flex flex-col gap-4 font-sans",children:[e.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-3 border-b border-gray-100 pb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"p-2 bg-indigo-50 text-indigo-600 rounded-lg",children:e.jsx(Ce,{size:16})}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-gray-800",children:a==="zh"?"近30天班级出勤率分析":"30-Day Class Attendance Rates"}),e.jsx("p",{className:"text-xs text-gray-400",children:a==="zh"?"基于最近30天内的课程日程和已记录的出勤状态":"Based on scheduled lessons and submitted attendance records"})]})]}),e.jsxs("div",{className:"flex items-center gap-4 bg-gray-50/50 p-1.5 px-3 rounded-lg border border-gray-100/60 text-xs text-gray-600",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxs("span",{className:"text-xs text-gray-400 uppercase font-bold tracking-wider",children:[a==="zh"?"平均率":"Avg Rate",":"]}),e.jsxs("span",{className:`font-black ${c.avgRate>=90?"text-green-600":c.avgRate>=75?"text-amber-500":"text-red-500"}`,children:[c.avgRate,"%"]})]}),e.jsx("div",{className:"h-3 w-[1px] bg-gray-200"}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxs("span",{className:"text-xs text-gray-400 uppercase font-bold tracking-wider",children:[a==="zh"?"总课时":"Schedules",":"]}),e.jsx("span",{className:"font-extrabold text-slate-800",children:c.totalSchedules})]})]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-2 bg-gray-50/50 p-2 rounded-lg border border-gray-100/50 text-center text-xs",children:[e.jsxs("div",{className:"flex flex-col items-center py-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-green-600 mb-0.5",children:[e.jsx("span",{className:"w-1.5 h-1.5 bg-green-500 rounded-full animate-ping"}),e.jsx("span",{className:"font-semibold text-xs",children:a==="zh"?"已到":"Present"})]}),e.jsx("div",{className:"text-sm font-bold text-gray-800",children:c.totalPresent})]}),e.jsxs("div",{className:"flex flex-col items-center py-1 border-x border-gray-100",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-amber-500 mb-0.5",children:[e.jsx("span",{className:"w-1.5 h-1.5 bg-amber-400 rounded-full"}),e.jsx("span",{className:"font-semibold text-xs",children:a==="zh"?"迟到":"Late"})]}),e.jsx("div",{className:"text-sm font-bold text-gray-800",children:c.totalLate})]}),e.jsxs("div",{className:"flex flex-col items-center py-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-red-500 mb-0.5",children:[e.jsx("span",{className:"w-1.5 h-1.5 bg-red-400 rounded-full"}),e.jsx("span",{className:"font-semibold text-xs",children:a==="zh"?"缺勤":"Absent"})]}),e.jsx("div",{className:"text-sm font-bold text-gray-800",children:c.totalAbsent})]})]}),e.jsxs("div",{className:"flex bg-slate-100 p-0.5 rounded-lg self-start shrink-0",children:[e.jsxs("button",{type:"button",onClick:()=>z("heatmap"),className:`px-3 py-1.5 text-xs font-black rounded-md transition-all cursor-pointer flex items-center gap-1.5 ${w==="heatmap"?"bg-white text-indigo-700 shadow-md font-bold":"text-gray-500 hover:text-gray-850"}`,children:[e.jsx(X,{size:13}),a==="zh"?"出勤日历热力图":"Calendar Heatmap"]}),e.jsxs("button",{type:"button",onClick:()=>z("chart"),className:`px-3 py-1.5 text-xs font-black rounded-md transition-all cursor-pointer flex items-center gap-1.5 ${w==="chart"?"bg-white text-indigo-700 shadow-md font-bold":"text-gray-500 hover:text-gray-850"}`,children:[e.jsx(oe,{size:13}),a==="zh"?"到课趋势柱状图":"Trend Chart"]})]}),w==="heatmap"?e.jsxs("div",{className:"flex flex-col gap-4 animate-fade-in text-gray-800",children:[P&&P.attendanceRate<80&&e.jsxs("div",{className:"p-3 bg-rose-50 border border-rose-100 rounded-xl flex items-start gap-2.5 text-xs text-rose-850",children:[e.jsx(ne,{size:16,className:"text-rose-500 mt-0.5 shrink-0 animate-bounce"}),e.jsxs("div",{className:"text-left",children:[e.jsx("span",{className:"font-extrabold block",children:a==="zh"?"检测到低出勤率周期预警":"Problematic Low Attendance Period Detected"}),e.jsx("p",{className:"mt-0.5 text-xs text-rose-700/90 leading-relaxed",children:a==="zh"?`班级在 ${P.date}(课程: 《${P.lessonTitle}》)到课率处于低谷(仅为 ${P.attendanceRate}%)。请留意可能存在影响出勤的外部因素或教学周期瓶颈。`:`Check-in density dropped to a critical low of ${P.attendanceRate}% on ${P.date} for lesson: "${P.lessonTitle}". Keep track of potential class milestones or periodic patterns.`})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 text-xs text-gray-500 bg-slate-50/50 px-3 py-2 rounded-lg border border-gray-100/50",children:[e.jsx("span",{className:"font-semibold",children:a==="zh"?"出勤率梯度图例:":"Attendance Rate Intensity:"}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"w-3 h-3 rounded bg-emerald-500 block"}),e.jsx("span",{children:a==="zh"?"极佳 (≥90%)":"Excellent (≥90%)"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"w-3 h-3 rounded bg-amber-500 block"}),e.jsx("span",{children:a==="zh"?"黄牌警告 (75%-89%)":"Warning (75%-89%)"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"w-3 h-3 rounded bg-rose-500 block"}),e.jsx("span",{children:a==="zh"?"严重偏低 (<75%)":"Critical (<75%)"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"w-3 h-3 rounded bg-slate-100 border border-slate-200 block"}),e.jsx("span",{children:a==="zh"?"未排课":"No Class"})]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-12 gap-5 items-start",children:[e.jsxs("div",{className:"md:col-span-7 bg-white border border-gray-100 p-4 rounded-xl shadow-2xs",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3 border-b border-gray-50 pb-2",children:[e.jsx("span",{className:"text-xs font-black text-slate-400 uppercase tracking-widest block",children:a==="zh"?"35天教学周期考勤热度":"5-Week Sequential Heatmap"}),e.jsx("span",{className:"text-xs text-gray-400 font-mono",children:"Mon-Sun Matrix"})]}),e.jsxs("div",{className:"grid grid-cols-7 gap-1.5 sm:gap-2",children:[(a==="zh"?["一","二","三","四","五","六","日"]:["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]).map(l=>e.jsx("div",{className:"text-center text-xs font-black text-slate-400 py-1 uppercase tracking-wider font-sans",children:l},l)),k.map(l=>{let f="bg-slate-50 border border-slate-150 text-gray-400 cursor-default hover:bg-slate-100/50",v=null;l.isFuture?f="bg-slate-50/20 text-slate-300 opacity-40 border border-dashed border-slate-100 cursor-not-allowed":l.match&&(v=l.match.attendanceRate,v>=90?f="bg-emerald-500 hover:bg-emerald-600 text-white font-extrabold cursor-pointer border border-transparent":v>=75?f="bg-amber-500 hover:bg-amber-600 text-white font-extrabold cursor-pointer border border-transparent":f="bg-rose-500 hover:bg-rose-600 text-white font-extrabold cursor-pointer border border-transparent");const m=j&&j.dateStr===l.dateStr?"ring-2 ring-indigo-600 ring-offset-2 scale-105 z-10 shadow-md":l.isToday?"ring-2 ring-slate-800 ring-offset-1 z-10":"";return e.jsxs("button",{type:"button",onClick:()=>{l.isFuture||b(l)},disabled:l.isFuture,className:`relative aspect-square rounded-lg flex flex-col items-center justify-center p-1 transition-all group shrink-0 ${f} ${m}`,title:l.match?`${l.dateStr}: ${l.match.lessonTitle} (${v}%)`:`${l.dateStr}`,children:[e.jsx("span",{className:"text-xs font-bold select-none",children:l.dayOfMonth}),l.dayOfMonth===1&&e.jsx("span",{className:"absolute -top-1.5 -right-1 bg-indigo-700 text-white text-xs font-black tracking-widest uppercase px-1 rounded shadow-xs scale-90",children:l.monthName}),l.match&&e.jsxs("div",{className:"pointer-events-none absolute bottom-full left-1/2 -translate-x-1/2 mb-2 w-48 bg-slate-950 text-white p-2 text-xs leading-relaxed rounded-xl shadow-2xl opacity-0 scale-95 group-hover:opacity-100 group-hover:scale-100 group-hover:-translate-y-0.5 transition-all duration-150 z-50 block",children:[e.jsx("div",{className:"font-extrabold border-b border-slate-850 pb-1 mb-1 truncate text-left",children:l.match.lessonTitle}),e.jsxs("div",{className:"flex justify-between font-mono gap-1 text-xs",children:[e.jsxs("span",{className:"text-slate-400",children:[a==="zh"?"日期":"Date",":"]}),e.jsx("span",{className:"font-bold",children:l.dateStr})]}),e.jsxs("div",{className:"flex justify-between font-mono gap-1 text-xs",children:[e.jsxs("span",{className:"text-slate-400",children:[a==="zh"?"实到人数":"Present",":"]}),e.jsx("span",{className:"font-extrabold text-emerald-300",children:l.match.present})]}),e.jsxs("div",{className:"flex justify-between font-mono gap-1 text-xs",children:[e.jsxs("span",{className:"text-slate-400",children:[a==="zh"?"迟到人数":"Late",":"]}),e.jsx("span",{className:"font-extrabold text-amber-300",children:l.match.late})]}),e.jsxs("div",{className:"flex justify-between font-mono gap-1 text-xs",children:[e.jsxs("span",{className:"text-slate-400",children:[a==="zh"?"未到人数":"Absent",":"]}),e.jsx("span",{className:"font-extrabold text-rose-300",children:l.match.absent})]}),e.jsxs("div",{className:"text-center font-bold font-mono text-xs text-indigo-300 pt-1 border-t border-slate-800 mt-1",children:[a==="zh"?"到课比率:":"Access density:"," ",v,"%"]}),e.jsx("div",{className:"absolute top-full left-1/2 -translate-x-1/2 -mt-1 border-[4px] border-transparent border-t-slate-950"})]})]},l.dateStr)})]})]}),e.jsx("div",{className:"md:col-span-5 bg-slate-50 border border-gray-200 p-4 rounded-xl min-h-[210px] flex flex-col justify-between",children:j?e.jsxs("div",{className:"text-left flex-1 flex flex-col justify-between h-full space-y-3",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-xs font-black text-slate-400 uppercase tracking-widest block mb-1",children:a==="zh"?"日期考勤指数详情":"Acreage Diagnostic Center"}),e.jsxs("h5",{className:"text-xs font-black text-gray-800 flex items-center gap-1.5 justify-start",children:[e.jsx(X,{size:13,className:"text-indigo-650"}),j.dateStr," ",j.isToday?`(${a==="zh"?"今天":"Today"})`:""]})]}),j.match?e.jsxs("div",{className:"space-y-3 flex-1 flex flex-col justify-between",children:[e.jsxs("div",{className:"bg-white border border-gray-150 p-2.5 rounded-lg text-left",children:[e.jsx("span",{className:"text-xs font-bold text-gray-400 block uppercase",children:a==="zh"?"讲授课目":"Subject of Instruction"}),e.jsx("p",{className:"text-xs font-extrabold text-indigo-900 line-clamp-2 mt-0.5",title:j.match.lessonTitle,children:j.match.lessonTitle})]}),e.jsxs("div",{className:"flex items-center gap-4 py-1.5",children:[e.jsxs("div",{className:"relative flex items-center justify-center shrink-0",children:[e.jsxs("svg",{className:"w-14 h-14 transform -rotate-90",children:[e.jsx("circle",{cx:"28",cy:"28",r:"23",className:"stroke-gray-200 fill-none",strokeWidth:"3.5"}),e.jsx("circle",{cx:"28",cy:"28",r:"23",className:`fill-none transition-all duration-300 ${j.match.attendanceRate>=90?"stroke-emerald-500":j.match.attendanceRate>=75?"stroke-amber-500":"stroke-rose-500"}`,strokeWidth:"4",strokeDasharray:`${2*Math.PI*23}`,strokeDashoffset:`${2*Math.PI*23*(1-j.match.attendanceRate/100)}`,strokeLinecap:"round"})]}),e.jsxs("span",{className:"absolute text-xs font-black font-mono text-gray-800",children:[j.match.attendanceRate,"%"]})]}),e.jsxs("div",{className:"text-left space-y-0.5",children:[e.jsx("span",{className:"text-xs font-bold text-gray-400 block uppercase",children:a==="zh"?"考勤宏观评估":"Check-in Diagnostics"}),e.jsx("span",{className:`text-xs font-extrabold block ${j.match.attendanceRate>=90?"text-emerald-600":j.match.attendanceRate>=75?"text-amber-500":"text-rose-600"}`,children:j.match.attendanceRate>=90?a==="zh"?"出勤情况极好":"Excellent Check-in":j.match.attendanceRate>=75?a==="zh"?"出勤尚可但有波动":"Moderate Attendance":a==="zh"?"出勤率严重偏低":"Low Attendance Alert"})]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-1.5 text-center",children:[e.jsxs("div",{className:"bg-white border border-gray-150 p-1.5 rounded-lg",children:[e.jsx("span",{className:"text-xs font-bold text-emerald-600 block uppercase",children:a==="zh"?"到席":"In Class"}),e.jsx("span",{className:"text-xs font-mono font-extrabold text-slate-800",children:j.match.present})]}),e.jsxs("div",{className:"bg-white border border-gray-150 p-1.5 rounded-lg",children:[e.jsx("span",{className:"text-xs font-bold text-amber-500 block uppercase",children:a==="zh"?"迟到":"Late"}),e.jsx("span",{className:"text-xs font-mono font-extrabold text-slate-800",children:j.match.late})]}),e.jsxs("div",{className:"bg-white border border-gray-150 p-1.5 rounded-lg",children:[e.jsx("span",{className:"text-xs font-bold text-rose-500 block uppercase",children:a==="zh"?"缺席":"Absent"}),e.jsx("span",{className:"text-xs font-mono font-extrabold text-slate-800",children:j.match.absent})]})]})]}):e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center py-6 text-slate-400 text-center gap-1 select-none font-sans",children:[e.jsx(ne,{size:24,className:"text-slate-300"}),e.jsx("span",{className:"font-bold text-slate-500 text-xs",children:a==="zh"?"当天没有排课计划":"No Lesson Scheduled"}),e.jsx("span",{className:"text-xs max-w-[180px] text-gray-400",children:a==="zh"?"本日期无分配的课程安排及签到表。":"No instruction maps were recorded on this period."})]})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-slate-400 text-center h-full select-none gap-2 font-sans",children:[e.jsx(X,{size:28,className:"text-indigo-400 animate-pulse"}),e.jsx("span",{className:"font-bold text-slate-600 text-xs",children:a==="zh"?"请点击考勤方块":"Select a Cell to Inspect"}),e.jsx("span",{className:"text-xs text-gray-400 max-w-[180px] leading-relaxed",children:a==="zh"?"在左侧历史视窗中轻点日期,可瞬间深度解读班级应出席名册及课题明细。":"Click any of the heat blocks to audit lesson stats and classroom ratios."})]})})]})]}):e.jsx("div",{className:"h-44 w-full font-sans select-none animate-fade-in",children:e.jsx(ue,{width:"100%",height:"100%",children:e.jsxs(Be,{data:L,margin:{top:10,right:10,left:-25,bottom:0},children:[e.jsx(Ae,{strokeDasharray:"3 3",vertical:!1,stroke:"#f0f0f0"}),e.jsx(ge,{dataKey:"displayDate",tick:{fontSize:12,fill:"#9ca3af"},axisLine:{stroke:"#e5e7eb"},tickLine:!1}),e.jsx(be,{domain:[0,100],tickFormatter:l=>`${l}%`,tick:{fontSize:12,fill:"#9ca3af"},axisLine:!1,tickLine:!1}),e.jsx(pe,{cursor:{fill:"#f3f4f6",opacity:.6},content:({active:l,payload:f})=>{if(l&&f&&f.length){const v=f[0].payload;return e.jsxs("div",{className:"bg-white border border-gray-150 p-2.5 rounded-xl shadow-xl font-sans text-xs flex flex-col gap-1.5",children:[e.jsxs("div",{className:"font-bold text-gray-800 border-b border-gray-150 pb-1 mb-1 flex items-center justify-between gap-4",children:[e.jsx("span",{className:"max-w-[130px] truncate",title:v.lessonTitle,children:v.lessonTitle}),e.jsx("span",{className:"text-xs text-gray-400 font-mono normal-case",children:v.date})]}),e.jsxs("div",{className:"flex justify-between gap-4 text-gray-600",children:[e.jsxs("span",{className:"flex items-center gap-1 text-gray-400",children:[e.jsx(te,{size:11})," ",a==="zh"?"总注册学生":"Total Students",":"]}),e.jsx("span",{className:"font-bold text-slate-700",children:v.total})]}),e.jsxs("div",{className:"flex justify-between gap-4 text-emerald-600",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-500"})," ",a==="zh"?"实到人数":"Present",":"]}),e.jsx("span",{className:"font-semibold",children:v.present})]}),e.jsxs("div",{className:"flex justify-between gap-4 text-amber-500",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400"})," ",a==="zh"?"迟到人数":"Late",":"]}),e.jsx("span",{className:"font-semibold",children:v.late})]}),e.jsxs("div",{className:"flex justify-between gap-4 text-red-500",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-red-400"})," ",a==="zh"?"未到人数":"Absent",":"]}),e.jsx("span",{className:"font-semibold",children:v.absent})]}),e.jsxs("div",{className:"flex justify-between gap-4 text-indigo-600 border-t border-gray-100 pt-1.5 mt-1 font-bold",children:[e.jsxs("span",{children:[a==="zh"?"单次出勤率":"Attendance Rate",":"]}),e.jsxs("span",{children:[v.attendanceRate,"%"]})]})]})}return null}}),e.jsx(Fe,{dataKey:"attendanceRate",fill:"#6366f1",radius:[4,4,0,0],maxBarSize:28})]})})})]})}function $t(t){const{cls:a,lang:n,cStudents:s,classProgressMap:i,classSchedulesMap:r,classDashboardMap:g}=t;return e.jsxs("div",{className:"space-y-4",children:[i[a.id]&&i[a.id].length>0&&e.jsxs("div",{className:"mb-4 bg-white p-2 border border-gray-100 rounded shadow-sm",children:[e.jsxs("div",{className:"text-xs font-medium text-gray-500 mb-2 flex items-center gap-1",children:[e.jsx(Ye,{size:12})," Class Avg Completion"]}),e.jsx("div",{className:"h-32 w-full",children:e.jsx(ue,{width:"100%",height:"100%",children:e.jsxs(Be,{data:i[a.id],children:[e.jsx(ge,{dataKey:"lesson_title",hide:!0}),e.jsx(be,{domain:[0,100],hide:!0}),e.jsx(pe,{contentStyle:{fontSize:"12px",padding:"4px",borderRadius:"4px"},formatter:N=>[`${Math.round(N)}%`,"Average"]}),e.jsx(Fe,{dataKey:"average_progress",fill:"#6366f1",radius:[2,2,0,0]})]})})})]}),e.jsx("div",{className:"mb-4",children:e.jsx(kt,{schedules:r[a.id]||[],progress:i[a.id]||[],lang:n})}),e.jsx("div",{className:"mb-4",children:e.jsx(_t,{classId:a.id,lang:n})}),g[a.id]&&e.jsx(At,{students:s,assignments:g[a.id].assignments||[],performance:g[a.id].performance||[],lang:n})]})}function Tt(t){const{cls:a,lang:n,cStudents:s,activeSubmissionFilter:i,classDashboardMap:r,assignmentSortOrder:g,setAssignmentSortOrder:N,lessons:w,isGeneratingPDFReport:z,handleGeneratePDFReport:j,setExportClassId:b,setExportClassName:P,setQuizzesWeight:k,setAssignmentsWeight:c,setCustomCategoryOverrides:L,setIsExportWeightModalOpen:l,isGeneratingAssignment:f,setQuizGeneratorClassId:v,setQuizGenMode:S,setQuizGenSelectedLessonId:m,setQuizGenTopic:_,setSuggestedObjectives:I,setSuggestedQuestions:$,setIsQuizGeneratorOpen:Q,setClassSubmissionFilters:p,setActiveStudentId:T,setSelectedAssignment:O,setStudentViewStatus:G,setActiveRole:V,isGrading:q,setIsGrading:W,fetchClassDashboard:J,get30DayAverageWarning:ee}=t,H=r[a.id]?.recentSubmissions||[],M=r[a.id]?.performance||[],x=(()=>{if(i==="all")return H;if(i==="submitted")return H.filter(h=>h.status==="submitted");if(i==="graded")return H.filter(h=>h.status==="graded");if(i==="pending"){const h=H.filter(A=>A.status==="submitted"),R=M.filter(A=>!A.submission_status||A.submission_status===null).map(A=>({assignment_id:A.assignment_id,assignment_title:A.assignment_title,student_id:A.student_id,student_name:A.student_name,content:n==="zh"?"尚未提交此作业":"Has not submitted this assignment yet",status:"pending_student"}));return[...h,...R]}return H})();return e.jsxs("div",{className:"mb-4 bg-white p-3 rounded-xl border border-slate-100 shadow-xs",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3 border-b border-gray-200 pb-2",children:[e.jsxs("div",{className:"text-xs font-semibold text-gray-700 flex items-center gap-1",children:[e.jsx(ie,{size:14,className:"text-indigo-500"})," Class Dashboard"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[r[a.id]&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{id:`generate-pdf-btn-${a.id}`,disabled:z[a.id],onClick:h=>{h.stopPropagation(),j(a.id,a.name)},className:"text-white hover:bg-emerald-750 bg-emerald-600 hover:bg-emerald-700 transition-all font-semibold rounded px-2.5 py-1 text-xs items-center flex gap-1.5 shadow-sm cursor-pointer font-sans disabled:opacity-50",children:[z[a.id]?e.jsx(Y,{size:10,className:"animate-spin"}):e.jsx(xe,{size:10}),e.jsx("span",{children:n==="zh"?"下载班级 PDF 报告":"Download Class PDF Report"})]}),e.jsxs("button",{id:`export-grades-btn-${a.id}`,onClick:h=>{h.stopPropagation(),b(a.id),P(a.name),k(40),c(60),L({}),l(!0)},className:"text-slate-700 hover:text-slate-900 border border-gray-300 bg-white hover:bg-gray-100 transition-all font-semibold rounded px-2 py-1 text-xs items-center flex gap-1 shadow-sm cursor-pointer font-sans",children:[e.jsx(Z,{size:10})," ",n==="zh"?"选项与导出":"Export Grades"]})]}),e.jsxs("button",{disabled:f===a.id,onClick:async h=>{h.stopPropagation(),v(a.id),S("scan_lesson"),w.length>0?m(w[0].id):m(""),_(""),I([]),$([]),Q(!0)},className:"text-white bg-indigo-500 hover:bg-indigo-600 px-2 py-1 rounded text-xs items-center flex gap-1 shadow-sm disabled:opacity-50",children:[f===a.id?e.jsx(Y,{size:10,className:"animate-spin"}):e.jsx(De,{size:10})," ","Generate AI Quiz"]})]})]}),r[a.id]?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("div",{className:"text-xs font-medium text-gray-500 uppercase tracking-wider",children:n==="zh"?"班级作业与测验":"Class Assignments & Quizzes"}),e.jsxs("div",{className:"flex items-center gap-1.5 bg-white border border-gray-200 px-2 py-1 rounded-lg shadow-sm",children:[e.jsx("span",{className:"text-xs font-bold text-gray-400 uppercase tracking-wider",children:n==="zh"?"排序:":"Sort:"}),e.jsxs("select",{value:g,onChange:h=>N(h.target.value),className:"bg-transparent border-0 text-xs text-gray-750 font-bold focus:outline-none focus:ring-0 p-0 cursor-pointer outline-none font-sans",id:"assignment-sort-select",children:[e.jsx("option",{value:"dueDate",children:n==="zh"?"截止日期":"Due Date"}),e.jsx("option",{value:"status",children:n==="zh"?"评分状态":"Status (Graded/Pending)"}),e.jsx("option",{value:"avgScore",children:n==="zh"?"平均分":"Average Score"})]})]})]}),e.jsxs("div",{className:"grid gap-2 grid-cols-2",children:[r[a.id].assignments&&(()=>{const h=r[a.id]?.assignments||[],R=r[a.id]?.performance||[];return h.map(u=>{const C=R.filter(K=>K.assignment_id===u.id);C.length;const E=C.filter(K=>K.submission_status==="submitted").length,d=C.filter(K=>K.submission_status==="graded").length;let y="pending",F=n==="zh"?"未提交":"No Submissions";E>0?(y="pending",F=n==="zh"?"待评分":"Pending Grading"):d>0&&(y="graded",F=n==="zh"?"已评分":"Graded");const B=C.filter(K=>K.score!==null&&K.score!==void 0).map(K=>Number(K.score)),U=B.length>0?Math.round(B.reduce((K,Ve)=>K+Ve,0)/B.length):null,Te=u.created_at+10080*60*1e3;return{...u,dueDateTimestamp:Te,status:y,statusLabel:F,avgScore:U,pendingGradingCount:E,gradedCount:d}}).sort((u,C)=>{if(g==="dueDate")return u.dueDateTimestamp-C.dueDateTimestamp;if(g==="status")return u.status===C.status?C.dueDateTimestamp-u.dueDateTimestamp:u.status==="pending"?-1:1;if(g==="avgScore"){const E=u.avgScore!==null?u.avgScore:-1;return(C.avgScore!==null?C.avgScore:-1)-E}return 0}).map(u=>e.jsxs("div",{className:"bg-white p-3 rounded-xl border border-gray-150 hover:border-indigo-200 shadow-sm text-xs cursor-pointer hover:shadow transition-all flex flex-col justify-between",children:[e.jsxs("div",{className:"flex items-start justify-between gap-1.5 mb-1.5",children:[e.jsx("div",{className:"font-semibold text-gray-800 line-clamp-1 flex-1 font-sans",title:u.title,children:u.title}),e.jsx("span",{className:`px-1.5 py-0.5 rounded text-xs font-bold shrink-0 border uppercase tracking-wider font-sans ${u.status==="graded"?"bg-emerald-50 text-emerald-700 border-emerald-100":u.pendingGradingCount>0?"bg-amber-50 text-amber-700 border-amber-100":"bg-gray-50 text-gray-500 border-gray-100"}`,children:u.statusLabel})]}),e.jsx("div",{className:"text-gray-500 text-xs line-clamp-2 leading-normal mb-2.5 font-sans",children:u.description||u.content}),e.jsxs("div",{className:"flex items-center justify-between border-t border-gray-55 pt-2 mt-auto gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 font-sans",children:[e.jsxs("span",{className:"text-xs text-gray-400 font-medium",children:[n==="zh"?"截止: ":"Due: ",e.jsx("span",{className:"text-gray-600 font-semibold",children:new Date(u.dueDateTimestamp).toLocaleDateString(n==="zh"?"zh-CN":"en-US",{month:"short",day:"numeric"})})]}),u.avgScore!==null&&e.jsxs("span",{className:"inline-flex items-center gap-0.5 bg-indigo-50 text-indigo-700 border border-indigo-100 px-1.5 py-0.5 rounded text-xs font-bold",children:[n==="zh"?"均分":"Avg",": ",u.avgScore,"%"]})]}),e.jsxs("button",{onClick:async C=>{if(C.stopPropagation(),s.length===0)return alert("No students in class to submit!");const E=s[Math.floor(Math.random()*s.length)],d=window.prompt(`Simulate student '${E.name}' submitting:`);d&&(await fetch(`/api/assignments/${u.id}/submissions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({studentId:E.id,content:d})})).ok&&await J(a.id)},className:"text-xs text-indigo-600 border border-indigo-200 hover:border-indigo-300 hover:bg-indigo-50/50 bg-white px-2 py-0.5 rounded font-bold flex items-center gap-1 cursor-pointer transition-all shrink-0 font-sans",children:[e.jsx(Xe,{size:8})," ",n==="zh"?"模拟":"Simulate"]})]})]},u.id))})(),r[a.id].assignments.length===0&&e.jsx("div",{className:"text-xs text-gray-400 italic",children:"No assignments yet."})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-2 mb-2 border-b border-gray-100 pb-1.5 pt-1",children:[e.jsxs("div",{className:"text-xs font-bold text-gray-500 uppercase tracking-wider flex items-center gap-1",children:[e.jsx(X,{size:11,className:"text-gray-400"}),n==="zh"?"近期作业提交":"Recent Submissions"]}),e.jsx("div",{className:"flex items-center gap-1 bg-gray-50 p-0.5 rounded-lg border border-gray-200",children:["all","submitted","graded","pending"].map(h=>{const R=i===h,A=(()=>{if(h==="all")return H.length;if(h==="submitted")return H.filter(u=>u.status==="submitted").length;if(h==="graded")return H.filter(u=>u.status==="graded").length;if(h==="pending"){const u=H.filter(E=>E.status==="submitted").length,C=M.filter(E=>!E.submission_status||E.submission_status===null).length;return u+C}return 0})(),o={all:n==="zh"?"全部":"All",submitted:n==="zh"?"待评分":"Submitted",graded:n==="zh"?"已完成":"Graded",pending:n==="zh"?"待完成":"Pending"}[h];return e.jsxs("button",{onClick:u=>{u.stopPropagation(),p(C=>({...C,[a.id]:h}))},className:`px-2 py-0.5 rounded-md text-xs font-semibold transition-all cursor-pointer flex items-center gap-1 font-sans ${R?"bg-white shadow-sm text-indigo-600 border border-indigo-100":"text-gray-500 hover:text-gray-700 hover:bg-gray-100 border border-transparent"}`,children:[e.jsx("span",{children:o}),e.jsx("span",{className:`px-1 py-0.1 ml-0.5 rounded-full text-xs leading-tight ${R?"bg-indigo-50 text-indigo-600 font-bold":"bg-gray-200/60 text-gray-400 font-medium"}`,children:A})]},h)})})]}),e.jsxs("div",{className:"flex flex-col gap-1.5 max-h-56 overflow-y-auto pr-1",children:[x.map((h,R)=>e.jsxs("div",{className:"bg-white p-2 border border-gray-150 rounded-lg text-xs flex justify-between items-center group hover:border-gray-300 transition-colors shadow-none mt-0.5",children:[e.jsxs("div",{className:"flex-1 min-w-0 pr-2",children:[e.jsxs("div",{className:"font-semibold text-gray-800 truncate flex items-center gap-1.5",children:[e.jsx("span",{className:"max-w-[110px] truncate",children:h.student_name}),e.jsx("span",{className:"text-xs text-gray-400 font-normal",children:"in"}),e.jsx("span",{className:"truncate text-gray-500 max-w-[130px]",title:h.assignment_title,children:h.assignment_title})]}),e.jsx("div",{className:"text-xs text-gray-500 truncate italic mt-0.5",children:h.status==="pending_student"?e.jsxs("span",{className:"text-amber-500 font-medium flex items-center gap-1",children:[e.jsx(ce,{size:10,className:"animate-pulse"}),h.content]}):`"${h.content}"`})]}),e.jsxs("div",{className:"shrink-0 flex items-center justify-end gap-1.5",children:[h.status!=="pending_student"&&e.jsxs("button",{onClick:()=>{T(h.student_id),O({id:h.assignment_id,title:h.assignment_title,student_id:h.student_id,student_name:h.student_name,submission_status:h.status,score:h.score,feedback:h.feedback,content:h.question_content}),G("assignment"),V("student")},className:"text-indigo-600 bg-indigo-50 hover:bg-indigo-100 px-2 py-1 rounded-md text-xs flex items-center gap-1 shadow-none font-bold border border-indigo-100 hover:border-indigo-200 transition-all cursor-pointer",children:[e.jsx(Ze,{size:9})," Live Canvas"]}),h.status==="graded"?e.jsxs("span",{className:`px-1.5 py-0.5 rounded text-xs font-medium ${h.score>=85?"bg-green-100 text-green-700 border border-green-200":h.score>=70?"bg-indigo-100 text-indigo-700 border border-indigo-200":"bg-yellow-105 text-yellow-700 border border-yellow-250"}`,children:[h.score,"%"]}):e.jsxs("button",{disabled:q[`${h.assignment_id}-${h.student_id}`],onClick:async()=>{W(A=>({...A,[`${h.assignment_id}-${h.student_id}`]:!0}));try{(await fetch(`/api/assignments/${h.assignment_id}/submissions/${h.student_id}/grade`,{method:"POST"})).ok&&await J(a.id)}finally{W(A=>({...A,[`${h.assignment_id}-${h.student_id}`]:!1}))}},className:"text-white bg-green-500 hover:bg-green-600 px-2 py-1 rounded-md text-xs flex items-center gap-1 shadow-sm font-bold border border-green-600 hover:border-green-700 hover:-translate-y-0.1 transition-all disabled:opacity-50 cursor-pointer",children:[q[`${h.assignment_id}-${h.student_id}`]?e.jsx(Y,{size:10,className:"animate-spin"}):e.jsx(De,{size:10})," ",n==="zh"?"评分":"Grade"]})]})]},h.status==="pending_student"?`${h.assignment_id}-${h.student_id}-pending-${R}`:`${h.assignment_id}-${h.student_id}-${R}`)),x.length===0&&e.jsx("div",{className:"text-xs text-gray-400 italic p-4 text-center bg-gray-50 border border-dashed border-gray-200 rounded-lg select-none",children:n==="zh"?"该筛选下暂无可展示的作业项目。":"No submissions under this filter."})]})]}),r[a.id].assignments.length>0&&s.length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-medium text-gray-500 mb-1 uppercase tracking-wider",children:"Class Performance Heatmap"}),e.jsx("div",{className:"overflow-x-auto border border-gray-200 rounded",children:e.jsxs("table",{className:"w-full text-xs text-left bg-white",children:[e.jsx("thead",{className:"bg-gray-50 sticky top-0",children:e.jsxs("tr",{children:[e.jsx("th",{className:"p-2 border-b border-r border-gray-200 font-medium whitespace-nowrap text-gray-600",children:"Student"}),r[a.id].assignments.map(h=>e.jsx("th",{className:"p-2 border-b border-r border-gray-200 font-medium truncate max-w-[80px]",title:h.title,children:h.title},h.id))]})}),e.jsx("tbody",{children:s.map(h=>e.jsxs("tr",{className:"border-b border-gray-100 last:border-b-0",children:[e.jsx("td",{className:"p-2 border-r border-gray-100 font-medium text-gray-700 whitespace-nowrap truncate max-w-[160px]",children:e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"truncate",title:h.name,children:h.name}),(()=>{const R=ee(h.id,a.id);return R!==null?e.jsxs("span",{className:"inline-flex items-center gap-0.5 bg-red-50 text-red-700 border border-red-200 px-1 py-0.5 rounded text-xs font-bold animate-pulse",title:n==="zh"?`30天平均成绩已降至60%以下 (${R}%)`:`30-day average has dropped below 60% (${R}%)`,children:[e.jsx(ke,{size:10,className:"text-red-500"}),R,"%"]}):null})()]})}),r[a.id].assignments.map(R=>{const A=r[a.id].performance.find(C=>C.assignment_id===R.id&&C.student_id===h.id);let o="bg-gray-50",u="-";return A&&A.score!==null?(u=A.score.toString(),A.score>=90?o="bg-green-100 text-green-800 font-medium":A.score>=70?o="bg-green-50 text-green-700":A.score>=50?o="bg-yellow-50 text-yellow-700":o="bg-red-50 text-red-700"):A&&A.submission_status==="submitted"&&(u="Wait",o="bg-blue-50 text-blue-500 text-xs"),e.jsx("td",{className:`p-2 border-r border-gray-100 text-center relative group/cell ${o}`,children:(()=>{const E=A&&A.graded_at?new Date(A.graded_at).toLocaleString(n==="zh"?"zh-CN":"en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"";return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-center gap-0.5 select-none font-sans",children:[e.jsx("span",{children:u}),A&&A.score!==null&&e.jsx("span",{className:"w-1 h-1 rounded-full bg-emerald-500 shrink-0 inline-block animate-pulse"})]}),A&&A.score!==null&&e.jsxs("div",{className:"absolute bottom-full mb-1.5 left-1/2 -translate-x-1/2 hidden group-hover/cell:block bg-gray-900 border border-gray-800 text-white text-xs p-2.5 rounded-xl shadow-2xl z-30 w-44 pointer-events-none text-left leading-normal font-sans font-normal normal-case",children:[e.jsxs("div",{className:"font-bold text-xs mb-1 text-emerald-400 flex items-center gap-1",children:[e.jsx(Ce,{size:11,className:"shrink-0"}),n==="zh"?"已完成评分":"Graded & Evaluated"]}),E&&e.jsxs("div",{className:"text-gray-300 flex items-center gap-1 font-semibold text-xs mb-1",children:[e.jsx(ce,{size:10,className:"shrink-0 text-indigo-400"}),e.jsx("span",{children:n==="zh"?`时间: ${E}`:`Graded: ${E}`})]}),A.feedback&&e.jsxs("div",{className:"text-gray-200 mt-1 pt-1 border-t border-gray-800 line-clamp-3 text-xs italic",children:['"',A.feedback,'"']}),e.jsx("div",{className:"absolute top-full left-1/2 -translate-x-1/2 -mt-1 border-4 border-transparent border-t-gray-900"})]})]})})()},R.id)})]},h.id))})]})})]})]}):e.jsx("div",{className:"flex justify-center p-4 text-gray-400",children:e.jsx(Y,{size:16,className:"animate-spin"})})]})}function Dt(t){const{cls:a,lang:n,cStudents:s,newScheduleDate:i,setNewScheduleDate:r,newScheduleLessonId:g,setNewScheduleLessonId:N,lessons:w,fetchClassSchedules:z,classSchedulesMap:j,expandedScheduleId:b,setExpandedScheduleId:P,fetchScheduleAttendance:k,scheduleAttendanceMap:c,get30DayAverageWarning:L}=t,[l,f]=D.useState(!1),v=async()=>{const m=j[a.id]||[];if(m.length!==0){f(!0);try{await Ue({classInfo:a,schedules:m,students:s,scheduleAttendanceMap:c,lang:n,fetchScheduleAttendance:k})}finally{f(!1)}}},S=async m=>{let _=c[m.id];if(!_)try{const I=await fetch(`/api/schedules/${m.id}/attendance`);I.ok&&(_=await I.json(),k(m.id))}catch(I){console.warn("Failed to fetch schedule attendance:",I)}Nt({className:a.name,schedule:m,students:s,attendanceRecords:_||[],lang:n})};return e.jsxs("div",{className:"mb-4 bg-white p-3 rounded-xl border border-slate-100 shadow-xs",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3 border-b border-gray-200 pb-2",children:[e.jsxs("div",{className:"text-xs font-semibold text-gray-700 flex items-center gap-1",children:[e.jsx(X,{size:14,className:"text-pink-500"})," Schedule & Attendance"]}),(j[a.id]||[]).length>0&&e.jsxs("button",{type:"button",id:`export-attendance-btn-${a.id}`,onClick:v,disabled:l,className:"flex items-center gap-1 px-2.5 py-1 text-xs bg-emerald-50 text-emerald-700 hover:bg-emerald-100 border border-emerald-200 rounded-lg font-medium transition-colors cursor-pointer disabled:opacity-50",title:n==="zh"?"导出此班级所有排课的学生考勤报表 (CSV)":"Export all student attendance records for this class (CSV)",children:[l?e.jsx(Y,{size:12,className:"animate-spin"}):e.jsx(Z,{size:12}),e.jsx("span",{children:n==="zh"?"导出考勤报表 (CSV)":"Export Attendance (CSV)"})]})]}),e.jsxs("div",{className:"mb-3 flex gap-2 items-center",children:[e.jsx("input",{title:"Schedule Date",type:"date",className:"border border-slate-200 hover:border-slate-300 rounded-lg text-xs p-1.5 flex-1 bg-white focus:outline-hidden focus:ring-1 focus:ring-indigo-500 text-gray-750 transition-all font-sans",value:i,onChange:m=>r(m.target.value),onClick:m=>m.stopPropagation()}),e.jsxs("select",{title:"Schedule Lesson",className:"border border-slate-200 hover:border-slate-300 rounded-lg text-xs p-1.5 flex-1 bg-white focus:outline-hidden focus:ring-1 focus:ring-indigo-500 text-gray-750 transition-all font-sans cursor-pointer",value:g,onChange:m=>N(m.target.value),onClick:m=>m.stopPropagation(),children:[e.jsx("option",{value:"",children:"Select Lesson..."}),w.map(m=>e.jsx("option",{value:m.id,children:m.title},m.id))]}),e.jsx("button",{className:"bg-pink-500 hover:bg-pink-600 text-white p-1 px-2 rounded text-xs disabled:opacity-50 flex items-center gap-1",disabled:!i||!g,onClick:async m=>{m.stopPropagation(),(await fetch(`/api/classes/${a.id}/schedules`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({lessonId:g,scheduledDate:i})})).ok&&(r(""),N(""),await z(a.id))},children:"Schedule"})]}),e.jsx("div",{className:"flex flex-col gap-2",children:(j[a.id]||[]).length===0?e.jsx("div",{className:"text-xs text-gray-400 italic",children:"No schedules yet."}):j[a.id].map(m=>{const _=b===m.id,I=c[m.id]||[];return e.jsxs("div",{className:"bg-white border border-slate-100/90 rounded-xl shadow-xs hover:shadow-sm transition-all overflow-hidden mb-2",children:[e.jsxs("div",{className:"p-2 flex justify-between items-center cursor-pointer hover:bg-gray-50",onClick:()=>{_?P(null):(P(m.id),k(m.id))},children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[_?e.jsx(me,{size:14,className:"text-gray-400"}):e.jsx(re,{size:14,className:"text-gray-400"}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"font-semibold text-gray-800",children:m.lesson_title}),e.jsxs("span",{className:"text-xs text-gray-500 flex items-center gap-1",children:[e.jsx(X,{size:10})," ",m.scheduled_date]})]})]}),e.jsxs("button",{type:"button",id:`export-schedule-btn-${m.id}`,onClick:$=>{$.stopPropagation(),S(m)},className:"flex items-center gap-1 px-2 py-1 text-xs text-slate-600 hover:text-emerald-700 hover:bg-emerald-50 border border-slate-200 hover:border-emerald-200 rounded-md transition-colors cursor-pointer shrink-0",title:n==="zh"?`导出 "${m.lesson_title}" 考勤表 (CSV)`:`Export attendance for "${m.lesson_title}" (CSV)`,children:[e.jsx(Z,{size:11}),e.jsx("span",{className:"hidden sm:inline",children:n==="zh"?"导出CSV":"Export CSV"})]})]}),_&&e.jsxs("div",{className:"border-t border-gray-100 p-2 bg-gray-50/50",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("div",{className:"text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Attendance Check-in"}),e.jsxs("button",{type:"button",id:`export-expanded-schedule-btn-${m.id}`,onClick:$=>{$.stopPropagation(),S(m)},className:"flex items-center gap-1 px-2 py-0.5 text-xs text-emerald-700 bg-emerald-50 hover:bg-emerald-100 border border-emerald-200 rounded transition-colors cursor-pointer",title:n==="zh"?"导出此排课考勤表 (CSV)":"Export this schedule's attendance records (CSV)",children:[e.jsx(Z,{size:11}),e.jsx("span",{children:n==="zh"?"导出考勤 (CSV)":"Export CSV"})]})]}),e.jsxs("div",{className:"grid gap-1",children:[s.map($=>{const Q=I.find(p=>p.student_id===$.id);return e.jsxs("div",{className:"flex items-center justify-between text-xs bg-white p-1 rounded border border-gray-200",children:[e.jsxs("div",{className:"flex items-center gap-1.5 truncate max-w-[150px]",children:[e.jsx("span",{className:"font-medium text-gray-700 truncate",title:$.name,children:$.name}),(()=>{const p=L($.id,a.id);return p!==null?e.jsxs("span",{className:"inline-flex items-center gap-0.5 bg-red-50 text-red-700 border border-red-200 px-1 py-0.5 rounded text-xs font-bold animate-pulse",title:n==="zh"?`30天平均成绩已降至60%以下 (${p}%)`:`30-day average has dropped below 60% (${p}%)`,children:[e.jsx(ke,{size:10,className:"text-red-500"}),p,"%"]}):null})()]}),e.jsx("div",{className:"flex gap-1 shrink-0",children:["present","late","absent"].map(p=>e.jsx("button",{onClick:async T=>{T.stopPropagation(),(await fetch(`/api/schedules/${m.id}/attendance`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({studentId:$.id,status:p})})).ok&&k(m.id)},className:`px-1.5 py-0.5 rounded text-xs capitalize border transition-all cursor-pointer ${Q?.status===p?p==="present"?"bg-green-50 border-green-200 text-green-700 font-medium":p==="late"?"bg-yellow-50 border-yellow-200 text-yellow-700 font-medium":"bg-red-50 border-red-200 text-red-700 font-medium":"bg-slate-50 border-slate-100/70 text-slate-400 hover:bg-slate-100"}`,children:p},p))})]},$.id)}),s.length===0&&e.jsx("div",{className:"text-xs italic text-gray-400",children:"No students to check in."})]})]})]},m.id)})})]})}const Me={zh:[{key:"General",label:"日常备忘",color:"bg-emerald-50 text-emerald-700 border-emerald-250 hover:bg-emerald-100",icon:"Bookmark"},{key:"Academic",label:"学术表现",color:"bg-blue-50 text-blue-700 border-blue-250 hover:bg-blue-100",icon:"GraduationCap"},{key:"Behavioral",label:"行为状态",color:"bg-purple-50 text-purple-700 border-purple-250 hover:bg-purple-100",icon:"Brain"},{key:"SpecialCare",label:"特别关注",color:"bg-rose-50 text-rose-700 border-rose-250 hover:bg-rose-100",icon:"AlertCircle"}],en:[{key:"General",label:"General",color:"bg-emerald-50 text-emerald-700 border-emerald-250 hover:bg-emerald-100",icon:"Bookmark"},{key:"Academic",label:"Academic",color:"bg-blue-50 text-blue-700 border-blue-250 hover:bg-blue-100",icon:"GraduationCap"},{key:"Behavioral",label:"Behavioral",color:"bg-purple-50 text-purple-700 border-purple-250 hover:bg-purple-100",icon:"Brain"},{key:"SpecialCare",label:"Special Care",color:"bg-rose-50 text-rose-700 border-rose-250 hover:bg-rose-100",icon:"AlertCircle"}]},Et=(t,a=12)=>{switch(t){case"GraduationCap":return e.jsx(ut,{size:a});case"Brain":return e.jsx(mt,{size:a});case"AlertCircle":return e.jsx(ne,{size:a});default:return e.jsx(ht,{size:a})}},Ge={zh:[{title:"📋 学术表现观察",content:`<div><strong>【学术表现观察 (Academic Observation)】</strong></div>
@@ -1,2 +1,2 @@
1
- import{r as l,j as e}from"./vendor-react-B0t7H3hh.js";import{l as ue,E as X}from"./index-BQF_s4QO.js";import{Y as Z,ax as ae,Z as me,ab as xe,D as pe,r as he,F as ie,f as ce,a0 as fe,U as be,aO as ge,V as H,I as ee,ac as we,e as te,bB as je,b as ye,Q as se,W as J,R as ne,ad as ve}from"./vendor-icons-BRmhY6fg.js";import{a as Ne,B as ze,C as Ce,X as ke,Y as Re,T as Se,f as Ae,g as Te,i as Ee}from"./vendor-charts-qLbgF1eL.js";function Pe(s={}){const{serverUrl:a,autoConnect:N=!0}=s,m=l.useRef(null),z=l.useRef(!1),g=l.useRef([]);l.useEffect(()=>{if(!N)return;const j=ue(a||window.location.origin,{transports:["websocket","polling"]});return m.current=j,j.on("connect",()=>{z.current=!0}),j.on("disconnect",()=>{z.current=!1}),()=>{g.current.forEach(({event:y,handler:T})=>{j.off(y,T)}),g.current=[],j.disconnect(),m.current=null}},[N,a]);const A=l.useCallback((j,y)=>{const T=m.current;return T?(T.on(j,y),g.current.push({event:j,handler:y}),()=>{T.off(j,y),g.current=g.current.filter(h=>h.event!==j||h.handler!==y)}):()=>{}},[]),r=l.useCallback((j,...y)=>{m.current?.emit(j,...y)},[]);return{socket:m.current,on:A,emit:r,connected:z.current}}const re=["#F59E0B","#6366F1","#10B981","#3B82F6","#0EA5E9"];function Qe({lang:s="zh",lessonId:a,classId:N,lessons:m=[],classes:z=[],schedules:g=[],students:A=[],addToast:r,className:j="",compact:y=!1,allowSimulation:T=!1}){const[h,F]=l.useState(a||""),[C,Y]=l.useState("score"),[U,G]=l.useState(!1),[I,W]=l.useState(!1),[k,V]=l.useState([]),[$,O]=l.useState({totalParticipants:0,totalResponses:0,averageScore:0}),[D,P]=l.useState(null);l.useEffect(()=>{a&&a!==h&&F(a)},[a]),l.useEffect(()=>{if(!h&&m.length>0){const t=new Date().toISOString().split("T")[0],x=g.find(d=>d.scheduled_date===t);F(x?.lesson_id||m[0].id)}},[h,m,g]);const{on:_}=Pe(),R=l.useCallback(async t=>{const x=t||h;if(x){G(!0);try{const d=await fetch(`/api/classroom/sessions/${x}/top-performers?limit=5`);if(d.ok){const v=await d.json();if(v.success&&Array.isArray(v.topPerformers)&&v.topPerformers.length>0)V(v.topPerformers),v.summary&&O(v.summary);else{const b=await fetch("/api/classroom/top-performers?limit=5");if(b.ok){const u=await b.json();if(u.success&&u.topPerformers?.length>0){V(u.topPerformers),u.summary&&O(u.summary);return}}V([]),O({totalParticipants:0,totalResponses:0,averageScore:0})}}}catch(d){console.warn("[TopPerformersWidget] fetch failed:",d)}finally{G(!1)}}},[h]);l.useEffect(()=>{h&&R(h)},[h,R]),l.useEffect(()=>{if(!_)return;const t=b=>{P(Date.now()),!(!b||b.lessonId&&b.lessonId!==h)&&(V(u=>{const q=b.studentId||b.id,n=b.studentName||A.find(f=>f.id===q)?.name||`Student ${String(q).slice(-4)}`,i=Number(b.score)||0,o=b.isCorrect?1:0,c=u.findIndex(f=>f.studentId===q);let p;if(c>=0){const f=u[c],w=f.totalQuizzesAnswered+1,S=f.correctCount+o,K=f.cumulativeScore+i,le=Math.round(S/w*100),de={...f,cumulativeScore:K,totalQuizzesAnswered:w,correctCount:S,accuracy:le,lastSubmittedAt:Date.now()};p=[...u],p[c]=de}else{const f={rank:99,studentId:q,studentName:n,cumulativeScore:i,totalQuizzesAnswered:1,correctCount:o,accuracy:o?100:0,avgTimeSpentMs:b.time_spent_ms||8e3,lastSubmittedAt:Date.now()};p=[...u,f]}return p.sort((f,w)=>w.cumulativeScore-f.cumulativeScore||w.accuracy-f.accuracy||w.correctCount-f.correctCount),p.slice(0,5).map((f,w)=>({...f,rank:w+1}))}),O(u=>({...u,totalResponses:u.totalResponses+1})))},x=_("whiteboard-quiz-answered",t),d=_("quiz.answered",t),v=_("classroom:quiz_response_received",t);return()=>{typeof x=="function"&&x(),typeof d=="function"&&d(),typeof v=="function"&&v()}},[_,h,A]);const L=async()=>{if(h){W(!0);try{(await fetch(`/api/classroom/sessions/${h}/simulate-quiz-responses`,{method:"POST",headers:{"Content-Type":"application/json"}})).ok&&(r?.(s==="zh"?"🎯 实时答题模拟成功":"🎯 Quiz Simulation Success",s==="zh"?"已为 8 位学生生成随堂测验提交,实时成绩榜单已即时重排!":"Generated simulated live quiz submissions. Top performers updated!","success"),await R(h))}catch(t){console.error("Failed to simulate quiz responses:",t)}finally{W(!1)}}},Q=t=>{r?.(s==="zh"?"🏆 表扬已送达":"🏆 Praise Sent",s==="zh"?`已向榜首学生 [${t.studentName}] 发送课堂「随堂之星」荣誉勋章与鼓励!`:`Sent "Quiz Star" honor medal to top performer [${t.studentName}]!`,"success")},B=()=>{const t=["Rank","Student ID","Student Name","Cumulative Score","Answered","Correct","Accuracy %"],x=k.map(u=>[u.rank,u.studentId,u.studentName,u.cumulativeScore,u.totalQuizzesAnswered,u.correctCount,`${u.accuracy}%`]),d="data:text/csv;charset=utf-8,\uFEFF"+[t.join(","),...x.map(u=>u.join(","))].join(`
1
+ import{r as l,j as e}from"./vendor-react-B0t7H3hh.js";import{l as ue,E as X}from"./index-BKBCBKvy.js";import{Y as Z,ax as ae,Z as me,ab as xe,D as pe,r as he,F as ie,f as ce,a0 as fe,U as be,aO as ge,V as H,I as ee,ac as we,e as te,bB as je,b as ye,Q as se,W as J,R as ne,ad as ve}from"./vendor-icons-BRmhY6fg.js";import{a as Ne,B as ze,C as Ce,X as ke,Y as Re,T as Se,f as Ae,g as Te,i as Ee}from"./vendor-charts-qLbgF1eL.js";function Pe(s={}){const{serverUrl:a,autoConnect:N=!0}=s,m=l.useRef(null),z=l.useRef(!1),g=l.useRef([]);l.useEffect(()=>{if(!N)return;const j=ue(a||window.location.origin,{transports:["websocket","polling"]});return m.current=j,j.on("connect",()=>{z.current=!0}),j.on("disconnect",()=>{z.current=!1}),()=>{g.current.forEach(({event:y,handler:T})=>{j.off(y,T)}),g.current=[],j.disconnect(),m.current=null}},[N,a]);const A=l.useCallback((j,y)=>{const T=m.current;return T?(T.on(j,y),g.current.push({event:j,handler:y}),()=>{T.off(j,y),g.current=g.current.filter(h=>h.event!==j||h.handler!==y)}):()=>{}},[]),r=l.useCallback((j,...y)=>{m.current?.emit(j,...y)},[]);return{socket:m.current,on:A,emit:r,connected:z.current}}const re=["#F59E0B","#6366F1","#10B981","#3B82F6","#0EA5E9"];function Qe({lang:s="zh",lessonId:a,classId:N,lessons:m=[],classes:z=[],schedules:g=[],students:A=[],addToast:r,className:j="",compact:y=!1,allowSimulation:T=!1}){const[h,F]=l.useState(a||""),[C,Y]=l.useState("score"),[U,G]=l.useState(!1),[I,W]=l.useState(!1),[k,V]=l.useState([]),[$,O]=l.useState({totalParticipants:0,totalResponses:0,averageScore:0}),[D,P]=l.useState(null);l.useEffect(()=>{a&&a!==h&&F(a)},[a]),l.useEffect(()=>{if(!h&&m.length>0){const t=new Date().toISOString().split("T")[0],x=g.find(d=>d.scheduled_date===t);F(x?.lesson_id||m[0].id)}},[h,m,g]);const{on:_}=Pe(),R=l.useCallback(async t=>{const x=t||h;if(x){G(!0);try{const d=await fetch(`/api/classroom/sessions/${x}/top-performers?limit=5`);if(d.ok){const v=await d.json();if(v.success&&Array.isArray(v.topPerformers)&&v.topPerformers.length>0)V(v.topPerformers),v.summary&&O(v.summary);else{const b=await fetch("/api/classroom/top-performers?limit=5");if(b.ok){const u=await b.json();if(u.success&&u.topPerformers?.length>0){V(u.topPerformers),u.summary&&O(u.summary);return}}V([]),O({totalParticipants:0,totalResponses:0,averageScore:0})}}}catch(d){console.warn("[TopPerformersWidget] fetch failed:",d)}finally{G(!1)}}},[h]);l.useEffect(()=>{h&&R(h)},[h,R]),l.useEffect(()=>{if(!_)return;const t=b=>{P(Date.now()),!(!b||b.lessonId&&b.lessonId!==h)&&(V(u=>{const q=b.studentId||b.id,n=b.studentName||A.find(f=>f.id===q)?.name||`Student ${String(q).slice(-4)}`,i=Number(b.score)||0,o=b.isCorrect?1:0,c=u.findIndex(f=>f.studentId===q);let p;if(c>=0){const f=u[c],w=f.totalQuizzesAnswered+1,S=f.correctCount+o,K=f.cumulativeScore+i,le=Math.round(S/w*100),de={...f,cumulativeScore:K,totalQuizzesAnswered:w,correctCount:S,accuracy:le,lastSubmittedAt:Date.now()};p=[...u],p[c]=de}else{const f={rank:99,studentId:q,studentName:n,cumulativeScore:i,totalQuizzesAnswered:1,correctCount:o,accuracy:o?100:0,avgTimeSpentMs:b.time_spent_ms||8e3,lastSubmittedAt:Date.now()};p=[...u,f]}return p.sort((f,w)=>w.cumulativeScore-f.cumulativeScore||w.accuracy-f.accuracy||w.correctCount-f.correctCount),p.slice(0,5).map((f,w)=>({...f,rank:w+1}))}),O(u=>({...u,totalResponses:u.totalResponses+1})))},x=_("whiteboard-quiz-answered",t),d=_("quiz.answered",t),v=_("classroom:quiz_response_received",t);return()=>{typeof x=="function"&&x(),typeof d=="function"&&d(),typeof v=="function"&&v()}},[_,h,A]);const L=async()=>{if(h){W(!0);try{(await fetch(`/api/classroom/sessions/${h}/simulate-quiz-responses`,{method:"POST",headers:{"Content-Type":"application/json"}})).ok&&(r?.(s==="zh"?"🎯 实时答题模拟成功":"🎯 Quiz Simulation Success",s==="zh"?"已为 8 位学生生成随堂测验提交,实时成绩榜单已即时重排!":"Generated simulated live quiz submissions. Top performers updated!","success"),await R(h))}catch(t){console.error("Failed to simulate quiz responses:",t)}finally{W(!1)}}},Q=t=>{r?.(s==="zh"?"🏆 表扬已送达":"🏆 Praise Sent",s==="zh"?`已向榜首学生 [${t.studentName}] 发送课堂「随堂之星」荣誉勋章与鼓励!`:`Sent "Quiz Star" honor medal to top performer [${t.studentName}]!`,"success")},B=()=>{const t=["Rank","Student ID","Student Name","Cumulative Score","Answered","Correct","Accuracy %"],x=k.map(u=>[u.rank,u.studentId,u.studentName,u.cumulativeScore,u.totalQuizzesAnswered,u.correctCount,`${u.accuracy}%`]),d="data:text/csv;charset=utf-8,\uFEFF"+[t.join(","),...x.map(u=>u.join(","))].join(`
2
2
  `),v=encodeURI(d),b=document.createElement("a");b.setAttribute("href",v),b.setAttribute("download",`top_performers_quiz_${h||"class"}.csv`),document.body.appendChild(b),b.click(),document.body.removeChild(b),r?.(s==="zh"?"📥 导出成功":"📥 Exported",s==="zh"?"随堂测验 Top 5 榜单数据已导出为 CSV 文件。":"Top 5 performers exported to CSV.","info")},M=l.useMemo(()=>k.map(t=>{const x=t.studentName.length>8?`${t.studentName.slice(0,7)}…`:t.studentName;return{rank:t.rank,name:x,fullName:t.studentName,studentId:t.studentId,score:t.cumulativeScore,accuracy:t.accuracy,count:t.totalQuizzesAnswered,correctCount:t.correctCount,avgTimeSec:(t.avgTimeSpentMs/1e3).toFixed(1),chartValue:C==="score"?t.cumulativeScore:C==="accuracy"?t.accuracy:t.totalQuizzesAnswered}}),[k,C]),E=l.useMemo(()=>m.find(t=>t.id===h)?.title||h||"Classroom Session",[m,h]);return e.jsxs("div",{id:"top-performers-widget","data-testid":"top-performers-widget",className:`bg-surface border border-theme rounded-2xl p-5 shadow-sm transition-all relative flex flex-col gap-4 ${j}`,children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 pb-3 border-b border-theme/60",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-amber-500/10 text-amber-500 flex items-center justify-center font-bold shadow-xs",children:e.jsx(Z,{size:20,className:"text-amber-500 animate-bounce"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"text-base font-bold text-main tracking-tight",children:s==="zh"?"随堂测验优秀榜 (Top 5 Performers)":"Live Quiz Top 5 Performers"}),D&&e.jsxs("span",{className:"flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-semibold bg-emerald-50 text-emerald-700 dark:bg-emerald-950/40 dark:text-emerald-400 border border-emerald-200 dark:border-emerald-800 animate-pulse",children:[e.jsx(ae,{size:10,className:"animate-spin text-emerald-500"}),e.jsx("span",{children:s==="zh"?"实时作答同步中":"Live Sync"})]})]}),e.jsx("p",{className:"text-xs text-muted mt-0.5",children:s==="zh"?"基于课堂互动白板随堂测试累计得分与答题正确率智能聚合":"Aggregated from cumulative scores and accuracy in live quiz responses"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[m.length>0&&e.jsx("select",{value:h,onChange:t=>F(t.target.value),className:"bg-surface-secondary border border-theme text-xs rounded-lg px-2.5 py-1.5 text-main outline-none focus:ring-1 focus:ring-primary-theme cursor-pointer max-w-[160px] truncate",title:E,children:m.map(t=>e.jsx("option",{value:t.id,children:t.title},t.id))}),e.jsxs("div",{className:"bg-surface-secondary p-0.5 rounded-lg flex items-center border border-theme text-xs",children:[e.jsx("button",{onClick:()=>Y("score"),className:`px-2 py-1 rounded-md font-medium transition-all ${C==="score"?"bg-surface text-primary-theme shadow-xs font-bold":"text-muted hover:text-main"}`,title:s==="zh"?"按累计得分排序":"By Cumulative Score",children:s==="zh"?"累计得分":"Score"}),e.jsx("button",{onClick:()=>Y("accuracy"),className:`px-2 py-1 rounded-md font-medium transition-all ${C==="accuracy"?"bg-surface text-primary-theme shadow-xs font-bold":"text-muted hover:text-main"}`,title:s==="zh"?"按正确率排序":"By Accuracy",children:s==="zh"?"正确率":"Accuracy"}),e.jsx("button",{onClick:()=>Y("count"),className:`px-2 py-1 rounded-md font-medium transition-all ${C==="count"?"bg-surface text-primary-theme shadow-xs font-bold":"text-muted hover:text-main"}`,title:s==="zh"?"按答题题次排序":"By Quiz Count",children:s==="zh"?"题次":"Count"})]}),T&&e.jsxs("button",{onClick:L,disabled:I,className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-xs font-bold bg-amber-50 text-amber-700 dark:bg-amber-950/40 dark:text-amber-400 border border-amber-200 dark:border-amber-800 hover:bg-amber-100 transition-colors cursor-pointer shadow-xs disabled:opacity-50",title:s==="zh"?"模拟学生实时答题":"Simulate Quiz Responses",children:[e.jsx(me,{size:12,className:I?"animate-spin text-amber-600":"text-amber-600"}),e.jsx("span",{className:"hidden sm:inline",children:s==="zh"?"模拟答题":"Simulate"})]}),e.jsx("button",{onClick:()=>R(h),disabled:U,className:"p-1.5 rounded-lg border border-theme bg-surface hover:bg-surface-secondary text-muted hover:text-main transition-colors cursor-pointer shadow-xs disabled:opacity-50",title:s==="zh"?"刷新榜单数据":"Refresh rankings",children:e.jsx(xe,{size:14,className:U?"animate-spin text-primary-theme":""})}),e.jsx("button",{onClick:B,disabled:k.length===0,className:"p-1.5 rounded-lg border border-theme bg-surface hover:bg-surface-secondary text-muted hover:text-main transition-colors cursor-pointer shadow-xs disabled:opacity-40",title:s==="zh"?"导出 Top 5 榜单 CSV":"Export CSV",children:e.jsx(pe,{size:14})})]})]}),k.length===0?e.jsxs("div",{className:"p-8 rounded-xl border border-dashed border-theme bg-surface-secondary/20 flex flex-col items-center justify-center text-center gap-2",children:[e.jsx(Z,{size:28,className:"text-muted/60"}),e.jsx("p",{className:"text-sm font-semibold text-main",children:s==="zh"?"暂无随堂作答数据":"No Quiz Responses Yet"}),e.jsx("p",{className:"text-xs text-muted max-w-sm",children:s==="zh"?"学生开始作答随堂测验或白板互动题后,实时榜单与答题数据将自动刷新呈现。":"Rankings and visual distribution will appear here once students submit answers."})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:k.slice(0,3).map(t=>{const x=t.rank===1,d=t.rank===2;t.rank;const v=x?"border-amber-400/50 bg-amber-500/5":d?"border-indigo-400/40 bg-indigo-500/5":"border-emerald-400/40 bg-emerald-500/5",b=x?"bg-amber-500 text-white":d?"bg-indigo-500 text-white":"bg-emerald-500 text-white",u=x?"🥇":d?"🥈":"🥉";return e.jsxs("div",{"data-testid":"top-performers-item",className:`p-3.5 rounded-xl border ${v} flex flex-col justify-between gap-3 relative transition-all hover:shadow-sm`,children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:`w-8 h-8 rounded-lg flex items-center justify-center font-extrabold text-sm shadow-xs ${b}`,children:u}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-main leading-tight truncate max-w-[130px]",children:t.studentName}),e.jsxs("span",{className:"text-xs text-muted flex items-center gap-1 mt-0.5",children:[e.jsx(he,{size:11,className:"text-emerald-500"}),t.correctCount,"/",t.totalQuizzesAnswered," ",s==="zh"?"题全对":"correct"]})]})]}),e.jsxs("div",{className:"text-right",children:[e.jsxs("div",{className:"text-base font-extrabold text-main font-mono",children:[t.cumulativeScore," ",e.jsx("span",{className:"text-xs font-normal text-muted",children:s==="zh"?"分":"pts"})]}),e.jsxs("span",{className:"text-xs font-semibold px-1.5 py-0.2 rounded bg-surface border border-theme text-primary-theme",children:[t.accuracy,"% ",s==="zh"?"正确率":"acc"]})]})]}),e.jsxs("div",{className:"flex items-center justify-between text-xs text-muted pt-2 border-t border-theme/40",children:[e.jsxs("span",{className:"flex items-center gap-1 font-mono",children:[e.jsx(ie,{size:11})," ",(t.avgTimeSpentMs/1e3).toFixed(1),"s ",s==="zh"?"均速":"avg"]}),x&&e.jsxs("button",{onClick:()=>Q(t),className:"flex items-center gap-1 text-xs font-semibold text-amber-600 hover:text-amber-700 dark:text-amber-400 hover:underline cursor-pointer",title:s==="zh"?"一键表扬榜首":"Praise top performer",children:[e.jsx(ce,{size:11})," ",s==="zh"?"一键表扬":"Praise"]})]})]},t.studentId)})}),e.jsxs("div",{className:"bg-surface-secondary/40 border border-theme rounded-xl p-4 flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs text-muted px-1",children:[e.jsxs("span",{className:"font-semibold text-main flex items-center gap-1.5",children:[e.jsx(fe,{size:14,className:"text-primary-theme"}),s==="zh"?`Top 5 答题得分可视化分布 (${C==="score"?"累计得分":C==="accuracy"?"正确率%":"答题数"})`:`Top 5 Visual Distribution (${C.toUpperCase()})`]}),e.jsx("span",{className:"text-xs text-muted font-mono",children:s==="zh"?`全班平均得分: ${$.averageScore} 分 | 参与人次: ${$.totalResponses}`:`Class Avg: ${$.averageScore} pts | Responses: ${$.totalResponses}`})]}),e.jsx("div",{"data-testid":"top-performers-chart",className:"w-full h-56 pt-2",children:e.jsx(Ne,{width:"100%",height:"100%",children:e.jsxs(ze,{data:M,layout:"vertical",margin:{top:8,right:36,left:10,bottom:8},children:[e.jsx(Ce,{strokeDasharray:"3 3",horizontal:!1,stroke:"currentColor",className:"text-theme/40"}),e.jsx(ke,{type:"number",domain:[0,C==="accuracy"?100:"auto"],tick:{fontSize:11,fill:"currentColor"},className:"text-muted",unit:C==="accuracy"?"%":""}),e.jsx(Re,{type:"category",dataKey:"name",tick:{fontSize:12,fill:"currentColor",fontWeight:600},className:"text-main",width:85}),e.jsx(Se,{content:({active:t,payload:x})=>{if(t&&x&&x.length){const d=x[0].payload;return e.jsxs("div",{className:"bg-surface border border-theme p-3 rounded-xl shadow-lg text-xs flex flex-col gap-1.5 min-w-[180px] z-50",children:[e.jsx("div",{className:"flex items-center justify-between font-bold text-main border-b border-theme/60 pb-1",children:e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsxs("span",{className:"w-5 h-5 rounded-full bg-primary-theme/10 text-primary-theme flex items-center justify-center font-mono",children:["#",d.rank]}),d.fullName]})}),e.jsxs("div",{className:"grid grid-cols-2 gap-x-2 gap-y-1 text-muted pt-1",children:[e.jsx("span",{children:s==="zh"?"累计得分:":"Total Score:"}),e.jsxs("span",{className:"font-bold text-main font-mono text-right",children:[d.score," 分"]}),e.jsx("span",{children:s==="zh"?"正确率:":"Accuracy:"}),e.jsxs("span",{className:"font-bold text-emerald-600 dark:text-emerald-400 font-mono text-right",children:[d.accuracy,"%"]}),e.jsx("span",{children:s==="zh"?"答对题次:":"Correct Count:"}),e.jsxs("span",{className:"font-mono text-right",children:[d.correctCount," / ",d.count," 题"]}),e.jsx("span",{children:s==="zh"?"平均答题速度:":"Avg Speed:"}),e.jsxs("span",{className:"font-mono text-right",children:[d.avgTimeSec," 秒"]})]})]})}return null}}),e.jsxs(Ae,{dataKey:"chartValue",radius:[0,6,6,0],barSize:22,children:[M.map((t,x)=>e.jsx(Te,{fill:re[x%re.length]},`cell-${t.studentId}-${x}`)),e.jsx(Ee,{dataKey:"chartValue",position:"right",formatter:t=>C==="accuracy"?`${t}%`:C==="score"?`${t}分`:`${t}题`,className:"fill-main text-xs font-bold font-mono"})]})]})})})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-2 text-xs text-muted pt-1",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(be,{size:12,className:"text-primary-theme"}),s==="zh"?"统计口径: 课中互动测验与答题器":"Scope: Live interactive quizzes & clickers"]}),e.jsx("span",{className:"hidden sm:inline text-theme",children:"•"}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ge,{size:12,className:"text-amber-500"}),s==="zh"?"实时随堂竞赛积分制":"Gamified Live Quiz Points"]})]}),e.jsx("div",{className:"flex items-center gap-2",children:k.length>0&&e.jsx("span",{className:"text-xs text-muted font-medium",children:s==="zh"?`榜首: ${k[0].studentName} (${k[0].cumulativeScore}分)`:`Leader: ${k[0].studentName} (${k[0].cumulativeScore} pts)`})})]})]})}const oe=[{id:"1m",label:"1 分钟快速提问",duration:60,icon:"⚡"},{id:"3m",label:"3 分钟温故知新",duration:180,icon:"📖"},{id:"5m",label:"5 分钟随堂小测",duration:300,icon:"📝"},{id:"10m",label:"10 分钟小组研讨",duration:600,icon:"👥"},{id:"15m",label:"15 分钟探究实验",duration:900,icon:"🔬"},{id:"25m",label:"25 分钟番茄专注",duration:1500,icon:"🍅"},{id:"45m",label:"45 分钟完整自习",duration:2700,icon:"⏱️"}],$e=["📝 随堂小测","👥 小组研讨","🎯 专注练习","⚡ 限时答题","📖 课前预热","💬 自由提问"];function De(){try{const s=window.AudioContext||window.webkitAudioContext;if(!s)return;const a=new s,N=a.currentTime,m=a.createOscillator(),z=a.createGain();m.type="sine",m.frequency.setValueAtTime(523.25,N),m.frequency.exponentialRampToValueAtTime(783.99,N+.25),z.gain.setValueAtTime(.3,N),z.gain.exponentialRampToValueAtTime(.001,N+.8),m.connect(z),z.connect(a.destination),m.start(N),m.stop(N+.8);const g=a.createOscillator(),A=a.createGain();g.type="triangle",g.frequency.setValueAtTime(659.25,N+.15),g.frequency.exponentialRampToValueAtTime(1046.5,N+.4),A.gain.setValueAtTime(.2,N+.15),A.gain.exponentialRampToValueAtTime(.001,N+1.2),g.connect(A),A.connect(a.destination),g.start(N+.15),g.stop(N+1.2)}catch{}}function Fe({lessonId:s,lang:a="zh",compact:N=!1,syncChannel:m,onlineStudentCount:z=0,onTimeRemainingChange:g,className:A=""}){const[r,j]=l.useState({lessonId:s,totalDuration:300,timeRemaining:300,isRunning:!1,isPaused:!1,label:a==="zh"?"📝 随堂小测":"📝 In-Class Quiz",endsAt:null,updatedAt:Date.now()}),[y,T]=l.useState(!0),[h,F]=l.useState(!1),[C,Y]=l.useState("5"),[U,G]=l.useState(!1),[I,W]=l.useState(""),[k,V]=l.useState(!1),[$,O]=l.useState([]),D=l.useRef(null),P=l.useRef(r);P.current=r;const _=l.useCallback(async()=>{if(!s)return;const n=`openlearn_classroom_countdown_${s}`;try{const i=localStorage.getItem(n);if(i){const o=JSON.parse(i);if(o&&typeof o.timeRemaining=="number"){if(o.isRunning&&o.endsAt){const c=Date.now(),p=Math.max(0,Math.round((o.endsAt-c)/1e3));o.timeRemaining=p,p===0&&(o.isRunning=!1,o.isPaused=!1,o.endsAt=null)}j(o)}}}catch{}try{const i=await fetch(`/api/classroom/sessions/${s}/countdown`);if(i.ok){const o=await i.json();o.success&&o.countdown&&j(c=>{const p=o.countdown;return p.totalDuration>0||p.isRunning?p:c})}}catch{}},[s]);l.useEffect(()=>{_()},[_]);const R=l.useCallback(n=>{if(j(n),s)try{localStorage.setItem(`openlearn_classroom_countdown_${s}`,JSON.stringify(n))}catch{}g?.(n.timeRemaining,n.isRunning),m&&m.broadcastCountdown(n),s&&fetch(`/api/classroom/sessions/${s}/countdown`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:n.isRunning?"start":n.isPaused?"pause":"set",duration:n.totalDuration,label:n.label})}).catch(()=>{});try{window.dispatchEvent(new CustomEvent("openlearn:countdown:updated",{detail:n}))}catch{}},[s,g,m]);l.useEffect(()=>(r.isRunning&&r.endsAt?D.current=setInterval(()=>{const n=P.current;if(!n.isRunning||!n.endsAt)return;const i=Date.now(),o=Math.max(0,Math.round((n.endsAt-i)/1e3));if(o!==n.timeRemaining){const c={...n,timeRemaining:o,updatedAt:i};if(o<=0){c.isRunning=!1,c.isPaused=!1,c.endsAt=null,y&&De();try{window.dispatchEvent(new CustomEvent("openlearn:countdown:expired",{detail:{lessonId:s,label:n.label,totalDuration:n.totalDuration}}))}catch{}}j(c),g?.(c.timeRemaining,c.isRunning),m?.broadcastCountdown(c);try{window.dispatchEvent(new CustomEvent("openlearn:countdown:tick",{detail:{timeRemaining:c.timeRemaining,totalDuration:c.totalDuration}}))}catch{}}},500):D.current&&(clearInterval(D.current),D.current=null),()=>{D.current&&clearInterval(D.current)}),[r.isRunning,r.endsAt,y,s,g,m]);const L=(n,i)=>{const o=Date.now(),c=n>0?n:r.totalDuration||300,p=i||r.label,f={lessonId:s,totalDuration:c,timeRemaining:c,isRunning:!0,isPaused:!1,label:p,endsAt:o+c*1e3,updatedAt:o};R(f);try{window.dispatchEvent(new CustomEvent("openlearn:countdown:started",{detail:f}))}catch{}},Q=()=>{const n=Date.now(),i=P.current,o=i.endsAt?Math.max(0,Math.round((i.endsAt-n)/1e3)):i.timeRemaining,c={...i,timeRemaining:o,isRunning:!1,isPaused:!0,endsAt:null,updatedAt:n};R(c);try{window.dispatchEvent(new CustomEvent("openlearn:countdown:paused",{detail:c}))}catch{}},B=()=>{const n=Date.now(),i=P.current,o=i.timeRemaining>0?i.timeRemaining:i.totalDuration||300,c={...i,timeRemaining:o,isRunning:!0,isPaused:!1,endsAt:n+o*1e3,updatedAt:n};R(c);try{window.dispatchEvent(new CustomEvent("openlearn:countdown:resumed",{detail:c}))}catch{}},M=()=>{const n=Date.now(),i=P.current,o={...i,timeRemaining:i.totalDuration||300,isRunning:!1,isPaused:!1,endsAt:null,updatedAt:n};R(o);try{window.dispatchEvent(new CustomEvent("openlearn:countdown:reset",{detail:o}))}catch{}},E=n=>{const i=Date.now(),o=P.current,c=Math.max(0,o.timeRemaining+n),p=Math.max(o.totalDuration,c),f={...o,totalDuration:p,timeRemaining:c,endsAt:o.isRunning?i+c*1e3:null,updatedAt:i};R(f)};l.useEffect(()=>{const n={getState:()=>P.current,start:(w,S)=>L(w,S),pause:()=>Q(),resume:()=>B(),reset:()=>M(),addTime:w=>E(w),registerPreset:w=>{O(S=>S.some(K=>K.id===w.id)?S:[...S,w])},getPresets:()=>[...oe,...$]};window.__openlearn_countdown=n;const i=w=>{const{duration:S,label:K}=w.detail||{};L(S||300,K)},o=()=>Q(),c=()=>B(),p=()=>M(),f=w=>{const{seconds:S}=w.detail||{};E(S||60)};return window.addEventListener("openlearn:countdown:trigger_start",i),window.addEventListener("openlearn:countdown:trigger_pause",o),window.addEventListener("openlearn:countdown:trigger_resume",c),window.addEventListener("openlearn:countdown:trigger_reset",p),window.addEventListener("openlearn:countdown:trigger_add_time",f),()=>{window.removeEventListener("openlearn:countdown:trigger_start",i),window.removeEventListener("openlearn:countdown:trigger_pause",o),window.removeEventListener("openlearn:countdown:trigger_resume",c),window.removeEventListener("openlearn:countdown:trigger_reset",p),window.removeEventListener("openlearn:countdown:trigger_add_time",f)}},[$]);const t=n=>{const i=Math.floor(n/60),o=n%60,c=p=>p.toString().padStart(2,"0");return`${c(i)}:${c(o)}`},x=r.totalDuration>0?Math.min(100,Math.max(0,r.timeRemaining/r.totalDuration*100)):0,d=r.timeRemaining>0&&r.timeRemaining<=60,v=r.timeRemaining>60&&r.timeRemaining<=180,b=d?"text-rose-500":v?"text-amber-500":"text-primary-theme",u=d?"bg-rose-500":v?"bg-amber-500":"bg-primary-theme",q=[...oe,...$];return e.jsxs("div",{id:"classroom-countdown-widget",className:`bg-surface-secondary border border-theme rounded-2xl p-3.5 flex flex-col gap-2.5 shadow-sm transition-all ${A}`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-1 select-none",children:[e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[e.jsx("span",{className:"p-1 rounded-lg bg-primary-theme/10 text-primary-theme shrink-0",children:e.jsx(ie,{size:13,className:r.isRunning?"animate-spin":"",style:{animationDuration:"6s"}})}),e.jsxs("div",{className:"flex flex-col min-w-0",children:[e.jsx("span",{className:"text-xs font-black uppercase tracking-wider text-main truncate flex items-center gap-1",children:a==="zh"?"课堂倒计时":"Classroom Countdown"}),e.jsxs("div",{className:"flex items-center gap-1 text-[10px] text-muted",children:[e.jsx(ae,{size:9,className:r.isRunning?"text-emerald-500 animate-pulse":"text-muted"}),e.jsx("span",{children:r.isRunning?a==="zh"?`实时广播中 (${z}人)`:`Broadcasting (${z})`:a==="zh"?"就绪":"Ready"})]})]})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[e.jsx("button",{type:"button",onClick:()=>T(!y),className:`p-1 rounded-md text-xs transition-colors cursor-pointer border border-theme ${y?"text-primary-theme bg-surface":"text-muted bg-surface/50"}`,title:y?a==="zh"?"提示音已开启":"Sound On":a==="zh"?"提示音已静音":"Muted",children:y?e.jsx(H,{size:12}):e.jsx(ee,{size:12})}),e.jsx("button",{type:"button",onClick:()=>F(!0),className:"p-1 rounded-md text-xs text-muted hover:text-main bg-surface hover:bg-surface-secondary transition-colors cursor-pointer border border-theme",title:a==="zh"?"展台大屏全屏投放":"Projector Mode",children:e.jsx(we,{size:12})})]})]}),e.jsxs("div",{className:"relative",children:[k?e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("input",{type:"text",value:I,onChange:n=>W(n.target.value),placeholder:"输入任务名称...",className:"flex-1 px-2 py-0.5 text-xs bg-surface border border-theme rounded-md text-main focus:outline-hidden focus:ring-1 focus:ring-primary-theme",autoFocus:!0}),e.jsx("button",{type:"button",onClick:()=>{I.trim()&&R({...r,label:I.trim()}),V(!1)},className:"p-1 rounded bg-primary-theme text-white text-xs cursor-pointer",children:e.jsx(te,{size:11})})]}):e.jsxs("div",{className:"flex items-center justify-between gap-1",children:[e.jsxs("button",{type:"button",onClick:()=>G(!U),className:"flex items-center gap-1 text-[11px] font-semibold text-muted hover:text-main px-1.5 py-0.5 rounded-md hover:bg-surface transition-colors cursor-pointer border border-transparent hover:border-theme truncate",title:"切换任务类型",children:[e.jsx(je,{size:10,className:"shrink-0 text-primary-theme"}),e.jsx("span",{className:"truncate",children:r.label}),e.jsx(ye,{size:10,className:"shrink-0 opacity-60"})]}),e.jsx("button",{type:"button",onClick:()=>{W(r.label),V(!0)},className:"text-[10px] text-muted hover:text-primary-theme underline cursor-pointer shrink-0",children:a==="zh"?"自定义":"Custom"})]}),U&&e.jsx("div",{className:"absolute left-0 top-full mt-1 w-full bg-surface border border-theme rounded-xl shadow-lg p-1.5 z-30 flex flex-col gap-0.5",children:$e.map(n=>e.jsxs("button",{type:"button",onClick:()=>{R({...r,label:n}),G(!1)},className:`text-left px-2 py-1 text-xs rounded-lg transition-colors cursor-pointer flex items-center justify-between ${r.label===n?"bg-primary-theme/10 text-primary-theme font-bold":"text-main hover:bg-surface-secondary"}`,children:[e.jsx("span",{children:n}),r.label===n&&e.jsx(te,{size:10})]},n))})]}),e.jsxs("div",{className:"flex flex-col items-center justify-center p-3 bg-surface border border-theme rounded-xl relative overflow-hidden",children:[e.jsx("div",{className:"absolute top-0 left-0 right-0 h-1 bg-surface-secondary overflow-hidden",children:e.jsx("div",{className:`h-full transition-all duration-500 ${u}`,style:{width:`${x}%`}})}),e.jsx("div",{id:"classroom-countdown-digits",className:`text-3xl font-black font-mono tracking-widest transition-colors ${d?"animate-pulse text-rose-500":b}`,children:t(r.timeRemaining)}),e.jsx("span",{className:"text-[10px] font-semibold text-muted mt-0.5",children:r.timeRemaining===0?a==="zh"?"⏰ 时间到!建议点评总结":"⏰ Time is up!":`${a==="zh"?"总设时长":"Total"}: ${t(r.totalDuration)}`})]}),e.jsxs("div",{className:"flex items-center gap-1.5 w-full",children:[r.isRunning?e.jsxs("button",{type:"button",id:"classroom-countdown-pause-btn",onClick:Q,className:"flex-1 py-1.5 px-3 rounded-xl bg-amber-500 hover:bg-amber-600 text-white text-xs font-bold transition-all shadow-sm flex items-center justify-center gap-1.5 cursor-pointer",children:[e.jsx(se,{size:12}),e.jsx("span",{children:a==="zh"?"暂停计时":"Pause"})]}):r.isPaused?e.jsxs("button",{type:"button",id:"classroom-countdown-resume-btn",onClick:B,className:"flex-1 py-1.5 px-3 rounded-xl bg-emerald-600 hover:bg-emerald-700 text-white text-xs font-bold transition-all shadow-sm flex items-center justify-center gap-1.5 cursor-pointer",children:[e.jsx(J,{size:12}),e.jsx("span",{children:a==="zh"?"继续计时":"Resume"})]}):e.jsxs("button",{type:"button",id:"classroom-countdown-start-btn",onClick:()=>L(r.totalDuration||300),className:"flex-1 py-1.5 px-3 rounded-xl bg-primary-theme hover:opacity-90 text-white text-xs font-bold transition-all shadow-sm flex items-center justify-center gap-1.5 cursor-pointer",children:[e.jsx(J,{size:12}),e.jsx("span",{children:a==="zh"?"开始倒计时":"Start"})]}),e.jsxs("button",{type:"button",id:"classroom-countdown-reset-btn",onClick:M,className:"p-1.5 px-2.5 rounded-xl bg-surface hover:bg-surface-secondary border border-theme text-xs font-bold text-muted hover:text-main transition-colors flex items-center justify-center gap-1 cursor-pointer",title:a==="zh"?"重置计时":"Reset",children:[e.jsx(ne,{size:12}),e.jsx("span",{className:"sr-only",children:"重置"})]})]}),e.jsxs("div",{className:"flex items-center justify-between gap-1 pt-1 border-t border-theme/60",children:[e.jsx("span",{className:"text-[10px] text-muted font-medium",children:a==="zh"?"快速调整:":"Adjust:"}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{type:"button",onClick:()=>E(-60),disabled:r.timeRemaining<=60,className:"px-1.5 py-0.5 rounded-md bg-surface hover:bg-surface-secondary border border-theme text-[11px] font-bold text-muted hover:text-main disabled:opacity-40 transition-colors cursor-pointer",title:"减去1分钟",children:"-1m"}),e.jsx("button",{type:"button",onClick:()=>E(60),className:"px-1.5 py-0.5 rounded-md bg-surface hover:bg-surface-secondary border border-theme text-[11px] font-bold text-muted hover:text-main transition-colors cursor-pointer",title:"增加1分钟",children:"+1m"}),e.jsx("button",{type:"button",onClick:()=>E(300),className:"px-1.5 py-0.5 rounded-md bg-surface hover:bg-surface-secondary border border-theme text-[11px] font-bold text-primary-theme hover:bg-primary-theme/10 transition-colors cursor-pointer",title:"增加5分钟",children:"+5m"})]})]}),e.jsxs("div",{className:"flex flex-col gap-1 pt-1",children:[e.jsx("span",{className:"text-[10px] text-muted font-semibold uppercase tracking-wider",children:a==="zh"?"预设时长":"Presets"}),e.jsx("div",{className:"flex flex-wrap gap-1",children:q.map(n=>e.jsxs("button",{type:"button",onClick:()=>L(n.duration,n.label),className:`px-1.5 py-0.5 rounded-lg text-[10px] font-bold transition-all cursor-pointer border ${r.totalDuration===n.duration&&r.isRunning?"bg-primary-theme text-white border-primary-theme":"bg-surface hover:bg-surface-secondary text-main border-theme"}`,title:n.label,children:[e.jsx("span",{children:n.icon||"⏱️"})," ",n.duration/60,"m"]},n.id))})]}),e.jsx(X,{slot:"classroom.countdown.action",slotProps:{countdown:r,onStart:L,onPause:Q,onReset:M,onAddTime:E,lang:a}}),e.jsx(X,{slot:"classroom.countdown.widget",slotProps:{countdown:r,lang:a}}),h&&e.jsxs("div",{id:"classroom-countdown-projector-modal",className:"fixed inset-0 z-50 bg-black/85 backdrop-blur-md flex flex-col items-center justify-center p-6 select-none animate-in fade-in duration-200",children:[e.jsxs("div",{className:"absolute top-6 right-6 flex items-center gap-3",children:[e.jsx("button",{type:"button",onClick:()=>T(!y),className:"p-2.5 rounded-xl bg-white/10 hover:bg-white/20 text-white transition-colors cursor-pointer",children:y?e.jsx(H,{size:20}):e.jsx(ee,{size:20})}),e.jsx("button",{type:"button",onClick:()=>F(!1),className:"p-2.5 rounded-xl bg-white/10 hover:bg-white/20 text-white transition-colors cursor-pointer",children:e.jsx(ve,{size:20})})]}),e.jsxs("div",{className:"flex flex-col items-center gap-6 max-w-2xl w-full",children:[e.jsxs("div",{className:"flex items-center gap-2 px-4 py-1.5 rounded-full bg-white/10 border border-white/20 text-white text-sm font-bold",children:[e.jsx(ce,{size:16,className:"text-amber-300"}),e.jsx("span",{children:r.label}),e.jsx("span",{className:"text-xs text-white/60 ml-2",children:a==="zh"?`全班 ${z} 位学生正在同步`:`${z} students connected`})]}),e.jsx("div",{className:`text-8xl md:text-9xl font-black font-mono tracking-widest drop-shadow-2xl transition-all ${d?"text-rose-500 animate-pulse":v?"text-amber-400":"text-emerald-400"}`,children:t(r.timeRemaining)}),e.jsx("div",{className:"w-full h-3 bg-white/10 rounded-full overflow-hidden border border-white/20 shadow-inner",children:e.jsx("div",{className:`h-full transition-all duration-500 ${d?"bg-rose-500":v?"bg-amber-400":"bg-emerald-400"}`,style:{width:`${x}%`}})}),e.jsxs("div",{className:"flex items-center gap-4 mt-2",children:[r.isRunning?e.jsxs("button",{type:"button",onClick:Q,className:"px-8 py-3 rounded-2xl bg-amber-500 hover:bg-amber-600 text-white font-bold text-lg transition-transform active:scale-95 shadow-xl flex items-center gap-2 cursor-pointer",children:[e.jsx(se,{size:20}),e.jsx("span",{children:a==="zh"?"暂停":"Pause"})]}):r.isPaused?e.jsxs("button",{type:"button",onClick:B,className:"px-8 py-3 rounded-2xl bg-emerald-500 hover:bg-emerald-600 text-white font-bold text-lg transition-transform active:scale-95 shadow-xl flex items-center gap-2 cursor-pointer",children:[e.jsx(J,{size:20}),e.jsx("span",{children:a==="zh"?"继续":"Resume"})]}):e.jsxs("button",{type:"button",onClick:()=>L(r.totalDuration||300),className:"px-8 py-3 rounded-2xl bg-primary-theme hover:opacity-90 text-white font-bold text-lg transition-transform active:scale-95 shadow-xl flex items-center gap-2 cursor-pointer",children:[e.jsx(J,{size:20}),e.jsx("span",{children:a==="zh"?"开始":"Start"})]}),e.jsx("button",{type:"button",onClick:()=>E(60),className:"px-5 py-3 rounded-2xl bg-white/10 hover:bg-white/20 text-white font-bold text-base transition-colors cursor-pointer border border-white/20",children:"+1 分钟"}),e.jsx("button",{type:"button",onClick:()=>E(300),className:"px-5 py-3 rounded-2xl bg-white/10 hover:bg-white/20 text-white font-bold text-base transition-colors cursor-pointer border border-white/20",children:"+5 分钟"}),e.jsx("button",{type:"button",onClick:M,className:"p-3 rounded-2xl bg-white/10 hover:bg-white/20 text-white font-bold transition-colors cursor-pointer border border-white/20",title:"重置",children:e.jsx(ne,{size:20})})]})]})]})]})}export{Fe as C,Qe as T,Pe as u};
@@ -1 +1 @@
1
- import{j as e}from"./vendor-react-B0t7H3hh.js";import{L as o}from"./LazyCourseware-DWCx60AO.js";import{aC as a,N as x,X as c,aA as d}from"./vendor-icons-BRmhY6fg.js";import{M as m}from"./index-BQF_s4QO.js";import"./vendor-utils-m0Urvtws.js";import"./vendor-pdf-D7rGevI1.js";import"./vendor-motion-BFAPOs-b.js";import"./vendor-pptx-C5-U7ieS.js";import"./vendor-charts-qLbgF1eL.js";function g({vfsNodes:r,currentVfsParent:n,setCurrentVfsParent:t,cloudDrivePreviewNode:l,setCloudDrivePreviewNode:i}){return e.jsxs("div",{className:"flex-1 flex overflow-hidden min-h-0",children:[e.jsxs("div",{className:"w-64 border-r border-gray-100 flex flex-col bg-gray-50 shrink-0",children:[e.jsx("div",{className:"p-3 border-b border-gray-200 flex items-center gap-2",children:e.jsxs("button",{onClick:()=>{t(null),i(null)},className:`text-sm font-medium w-full text-left flex items-center gap-2 p-2 rounded cursor-pointer ${n===null?"bg-indigo-100 text-indigo-800 font-bold":"text-gray-600 hover:bg-gray-200"}`,children:[e.jsx(a,{size:16})," Data Root"]})}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-2",children:[n&&e.jsxs("button",{onClick:()=>t(null),className:"flex items-center gap-2 p-2 text-xs text-indigo-600 w-full hover:bg-gray-200 rounded mb-2 font-medium cursor-pointer",children:[e.jsx(x,{className:"rotate-180",size:14})," Back to Root"]}),e.jsx("div",{className:"text-xs uppercase font-semibold text-gray-400 px-2 py-1 mb-1",children:"Current Path Nodes"}),r.filter(s=>s.type==="dir").map(s=>e.jsxs("button",{onClick:()=>{t(s.id),i(null)},className:"w-full text-left p-2 rounded text-sm text-gray-700 hover:bg-gray-200 flex items-center gap-2 group mb-1 cursor-pointer",children:[e.jsx(a,{size:14,className:"text-indigo-400 group-hover:text-indigo-600"}),e.jsx("span",{className:"truncate",children:s.name})]},s.id))]})]}),e.jsx("div",{className:"flex-1 flex flex-col bg-white overflow-hidden min-w-0",children:l?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 gap-2 shrink-0",children:[e.jsx("button",{onClick:()=>i(null),className:"text-gray-500 hover:text-gray-700 cursor-pointer",children:e.jsx(c,{size:16})}),e.jsxs("span",{className:"text-sm font-medium text-gray-700",children:["Previewing: ",l.name]})]}),l.name.endsWith(".html")||l.name.endsWith(".htm")||l.content?.includes("<html")?e.jsx("div",{className:"flex-1 relative bg-gray-50",children:e.jsx(o,{coursewareId:l.id})}):e.jsx("div",{className:"flex-1 overflow-y-auto p-6 bg-white prose prose-sm max-w-none",children:e.jsx(m,{children:l.content})})]}):e.jsx("div",{className:"flex-1 p-6 overflow-y-auto",children:e.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:[r.length===0&&e.jsx("div",{className:"col-span-full h-32 flex items-center justify-center text-sm text-gray-400 italic",children:"This directory is empty."}),r.map(s=>e.jsxs("div",{onClick:()=>{s.type==="dir"?t(s.id):i({id:s.id,name:s.name,content:s.content||"*(Empty file)*"})},className:"border border-gray-200 hover:border-indigo-300 hover:shadow-md cursor-pointer rounded-xl p-4 flex flex-col gap-3 transition-all bg-white",children:[e.jsx("div",{className:"p-3 rounded-xl w-12 h-12 flex items-center justify-center shrink-0 shadow-sm bg-gray-50 border border-gray-100",children:s.type==="dir"?e.jsx(a,{size:24,className:"text-indigo-500"}):e.jsx(d,{size:24,className:"text-gray-500"})}),e.jsx("div",{className:"text-sm font-medium text-gray-800 break-words",children:s.name})]},s.id))]})})})]})}function w(r){return r.isOpen?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-5xl h-[85vh] flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"p-4 border-b border-gray-100 flex items-center justify-between bg-gray-50/80 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(a,{size:20,className:"text-indigo-600"}),e.jsx("h2",{className:"font-semibold text-gray-800 text-lg",children:"Cloud Course Resource Browser"})]}),e.jsx("button",{onClick:r.onClose,className:"text-gray-400 hover:text-gray-600 font-bold p-1 hover:bg-gray-200 rounded transition-colors cursor-pointer",children:"×"})]}),e.jsx(g,{...r})]})}):null}export{w as CloudDriveModal,g as CloudDrivePanel};
1
+ import{j as e}from"./vendor-react-B0t7H3hh.js";import{L as o}from"./LazyCourseware-CuiPxhDg.js";import{aC as a,N as x,X as c,aA as d}from"./vendor-icons-BRmhY6fg.js";import{M as m}from"./index-BKBCBKvy.js";import"./vendor-utils-m0Urvtws.js";import"./vendor-pdf-D7rGevI1.js";import"./vendor-motion-BFAPOs-b.js";import"./vendor-pptx-C5-U7ieS.js";import"./vendor-charts-qLbgF1eL.js";function g({vfsNodes:r,currentVfsParent:n,setCurrentVfsParent:t,cloudDrivePreviewNode:l,setCloudDrivePreviewNode:i}){return e.jsxs("div",{className:"flex-1 flex overflow-hidden min-h-0",children:[e.jsxs("div",{className:"w-64 border-r border-gray-100 flex flex-col bg-gray-50 shrink-0",children:[e.jsx("div",{className:"p-3 border-b border-gray-200 flex items-center gap-2",children:e.jsxs("button",{onClick:()=>{t(null),i(null)},className:`text-sm font-medium w-full text-left flex items-center gap-2 p-2 rounded cursor-pointer ${n===null?"bg-indigo-100 text-indigo-800 font-bold":"text-gray-600 hover:bg-gray-200"}`,children:[e.jsx(a,{size:16})," Data Root"]})}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-2",children:[n&&e.jsxs("button",{onClick:()=>t(null),className:"flex items-center gap-2 p-2 text-xs text-indigo-600 w-full hover:bg-gray-200 rounded mb-2 font-medium cursor-pointer",children:[e.jsx(x,{className:"rotate-180",size:14})," Back to Root"]}),e.jsx("div",{className:"text-xs uppercase font-semibold text-gray-400 px-2 py-1 mb-1",children:"Current Path Nodes"}),r.filter(s=>s.type==="dir").map(s=>e.jsxs("button",{onClick:()=>{t(s.id),i(null)},className:"w-full text-left p-2 rounded text-sm text-gray-700 hover:bg-gray-200 flex items-center gap-2 group mb-1 cursor-pointer",children:[e.jsx(a,{size:14,className:"text-indigo-400 group-hover:text-indigo-600"}),e.jsx("span",{className:"truncate",children:s.name})]},s.id))]})]}),e.jsx("div",{className:"flex-1 flex flex-col bg-white overflow-hidden min-w-0",children:l?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 gap-2 shrink-0",children:[e.jsx("button",{onClick:()=>i(null),className:"text-gray-500 hover:text-gray-700 cursor-pointer",children:e.jsx(c,{size:16})}),e.jsxs("span",{className:"text-sm font-medium text-gray-700",children:["Previewing: ",l.name]})]}),l.name.endsWith(".html")||l.name.endsWith(".htm")||l.content?.includes("<html")?e.jsx("div",{className:"flex-1 relative bg-gray-50",children:e.jsx(o,{coursewareId:l.id})}):e.jsx("div",{className:"flex-1 overflow-y-auto p-6 bg-white prose prose-sm max-w-none",children:e.jsx(m,{children:l.content})})]}):e.jsx("div",{className:"flex-1 p-6 overflow-y-auto",children:e.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:[r.length===0&&e.jsx("div",{className:"col-span-full h-32 flex items-center justify-center text-sm text-gray-400 italic",children:"This directory is empty."}),r.map(s=>e.jsxs("div",{onClick:()=>{s.type==="dir"?t(s.id):i({id:s.id,name:s.name,content:s.content||"*(Empty file)*"})},className:"border border-gray-200 hover:border-indigo-300 hover:shadow-md cursor-pointer rounded-xl p-4 flex flex-col gap-3 transition-all bg-white",children:[e.jsx("div",{className:"p-3 rounded-xl w-12 h-12 flex items-center justify-center shrink-0 shadow-sm bg-gray-50 border border-gray-100",children:s.type==="dir"?e.jsx(a,{size:24,className:"text-indigo-500"}):e.jsx(d,{size:24,className:"text-gray-500"})}),e.jsx("div",{className:"text-sm font-medium text-gray-800 break-words",children:s.name})]},s.id))]})})})]})}function w(r){return r.isOpen?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-5xl h-[85vh] flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"p-4 border-b border-gray-100 flex items-center justify-between bg-gray-50/80 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(a,{size:20,className:"text-indigo-600"}),e.jsx("h2",{className:"font-semibold text-gray-800 text-lg",children:"Cloud Course Resource Browser"})]}),e.jsx("button",{onClick:r.onClose,className:"text-gray-400 hover:text-gray-600 font-bold p-1 hover:bg-gray-200 rounded transition-colors cursor-pointer",children:"×"})]}),e.jsx(g,{...r})]})}):null}export{w as CloudDriveModal,g as CloudDrivePanel};
@@ -1 +1 @@
1
- import{r as i,j as e}from"./vendor-react-B0t7H3hh.js";import{a as G,M as H}from"./index-BQF_s4QO.js";import{B as y,d as Y,n as D,aF as _,X as Q,bI as ee,U as $,bJ as te,bK as se,b0 as re,E as ie,j as ae,T as A,a4 as oe,z as M}from"./vendor-icons-BRmhY6fg.js";import"./vendor-utils-m0Urvtws.js";import"./vendor-pdf-D7rGevI1.js";import"./vendor-motion-BFAPOs-b.js";import"./vendor-pptx-C5-U7ieS.js";import"./vendor-charts-qLbgF1eL.js";function be({lang:s,session:I,lessons:d,lessonsSearchQuery:m,setLessonsSearchQuery:h,lessonsSortOrder:L,setLessonsSortOrder:T,filteredLessons:u,onOpenImportLessons:E,onOpenCourseWizard:f,onViewCourse:j,onDeleteCourse:F,onCopyCourse:O,filterEnrollment:N,setFilterEnrollment:R,filterHasContent:v,setFilterHasContent:U,filterThisMonth:w,setFilterThisMonth:B,copyingLessonId:V}){const P=G(t=>t.session),r=I||P,W=r?.username==="admin"||r?.userId==="usr_admin"||r?.role==="administrator"||r?.subRole==="administrator",[b,Z]=i.useState(!1),[a,g]=i.useState(null),[o,n]=i.useState(null),[z,C]=i.useState(!1),[J,k]=i.useState(!1),[c,S]=i.useState(null),K=t=>{navigator.clipboard.writeText(t).then(()=>{S(t),setTimeout(()=>S(null),1500)})},X=async t=>{g(t),n(null),k(!0);try{const x=await fetch(`/api/lessons/${t.id}/stats`);if(x.ok){const l=await x.json();n(l)}}catch{n({whiteboardCount:0,scheduleCount:0,enrollmentCount:0,assignmentCount:0})}finally{k(!1)}},q=async()=>{if(a){C(!0);try{await F(a.id),g(null),n(null)}finally{C(!1)}}};return e.jsxs("div",{className:"flex-1 flex flex-col gap-6 h-full overflow-y-auto",children:[e.jsxs("div",{className:"flex-1 bg-white border border-gray-200 rounded-xl shadow-sm flex flex-col min-h-0",children:[e.jsxs("div",{className:"p-4 border-b border-gray-100 flex items-center justify-between shrink-0",children:[e.jsxs("h3",{className:"font-medium text-gray-700 flex items-center gap-2",children:[e.jsx(y,{size:16,className:"text-gray-400"}),s==="zh"?"课程与教学环节管理 (SQLite)":"Courses & Lessons Management"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{id:"import-lessons-csv-btn",onClick:E,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs bg-indigo-50 hover:bg-indigo-100 text-indigo-700 border border-indigo-200 font-semibold rounded-lg shadow-3xs transition-all hover:shadow-xs hover:-translate-y-0.5 cursor-pointer",children:[e.jsx(Y,{size:14}),s==="zh"?"批量导入课程 (CSV)":"Import Lessons (CSV)"]}),e.jsxs("button",{id:"add-course-wizard-btn",onClick:f,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs bg-indigo-600 hover:bg-indigo-700 text-white font-semibold rounded-lg shadow-sm transition-all hover:shadow-md hover:-translate-y-0.5 cursor-pointer",children:[e.jsx(D,{size:14}),s==="zh"?"手动添加课程 (向导)":"Add Course Wizard"]})]})]}),d.length>0&&e.jsxs("div",{className:"px-5 py-3.5 border-b border-gray-100 bg-gray-50/50 flex flex-col sm:flex-row items-center justify-between gap-3 shrink-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-3 w-full sm:w-auto",children:[e.jsxs("div",{className:"relative w-full sm:w-64",children:[e.jsx("span",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none text-gray-400",children:e.jsx(_,{size:14})}),e.jsx("input",{type:"text",placeholder:"Search courses by title...",value:m,onChange:t=>h(t.target.value),className:"w-full pl-9 pr-8 py-1.5 text-xs bg-white border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 text-gray-800 shadow-sm"}),m&&e.jsx("button",{onClick:()=>h(""),className:"absolute inset-y-0 right-0 flex items-center pr-2.5 text-gray-400 hover:text-gray-600",children:e.jsx(Q,{size:12,className:"bg-gray-100 hover:bg-gray-200 rounded-full p-0.5"})})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-xs font-bold text-gray-400 uppercase tracking-wider",children:s==="zh"?"排序方式:":"Sort by:"}),e.jsxs("select",{value:L,onChange:t=>T(t.target.value),className:"bg-white border border-gray-200 text-xs text-gray-755 font-bold px-2.5 py-1.5 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 shadow-sm",id:"courses-sort-select",children:[e.jsx("option",{value:"recent",children:s==="zh"?"最新创建":"Most Recent"}),e.jsx("option",{value:"alphabetical",children:s==="zh"?"按名称 (A-Z)":"Alphabetical (A-Z)"}),e.jsx("option",{value:"enrollment",children:s==="zh"?"学生选课人次":"Student Enrollment Count"})]})]})]}),e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs("button",{onClick:()=>Z(!b),className:`px-2 py-1 text-xs font-bold rounded-md border transition-all cursor-pointer ${b?"bg-indigo-600 text-white border-indigo-600 shadow-2xs":"bg-white text-gray-600 border-gray-200 hover:border-gray-300"}`,title:s==="zh"?"只看我创建的课程":"Only show courses created by me",children:[e.jsx(ee,{size:11,className:"inline mr-0.5 -mt-0.5"}),s==="zh"?"我的备课":"My Courses"]}),e.jsxs("button",{onClick:()=>R(!N),className:`px-2 py-1 text-xs font-bold rounded-md border transition-all cursor-pointer ${N?"bg-emerald-50 text-emerald-700 border-emerald-200":"bg-white text-gray-500 border-gray-200 hover:border-gray-300"}`,children:[e.jsx($,{size:11,className:"inline mr-0.5 -mt-0.5"}),s==="zh"?"有人选":"Enrolled"]}),e.jsxs("button",{onClick:()=>U(!v),className:`px-2 py-1 text-xs font-bold rounded-md border transition-all cursor-pointer ${v?"bg-indigo-50 text-indigo-700 border-indigo-200":"bg-white text-gray-500 border-gray-200 hover:border-gray-300"}`,children:[e.jsx(y,{size:11,className:"inline mr-0.5 -mt-0.5"}),s==="zh"?"有内容":"Has Content"]}),e.jsx("button",{onClick:()=>B(!w),className:`px-2 py-1 text-xs font-bold rounded-md border transition-all cursor-pointer ${w?"bg-amber-50 text-amber-700 border-amber-200":"bg-white text-gray-500 border-gray-200 hover:border-gray-300"}`,children:s==="zh"?"本月":"This Month"})]}),e.jsxs("div",{className:"text-xs font-semibold text-gray-500",children:["Found ",e.jsx("span",{className:"text-indigo-650 font-bold",children:u.length})," of"," ",e.jsx("span",{className:"text-gray-700 font-bold",children:d.length})," course",d.length===1?"":"s"]})]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:d.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-gray-400 min-h-[300px]",children:[e.jsx(y,{size:48,className:"mb-4 opacity-30 text-indigo-500"}),e.jsx("h3",{className:"text-lg font-bold text-gray-800",children:s==="zh"?"暂无可用课程":"No Courses Available"}),e.jsx("p",{className:"mt-2 text-sm text-gray-500 text-center max-w-xs",children:s==="zh"?"系统中暂未部署任何课程。请通过下方按钮启动添加向导指南。":"There are no courses active in the system yet. Build your first curriculum!"}),e.jsxs("button",{id:"empty-add-course-btn",onClick:f,className:"mt-5 flex items-center gap-2 px-5 py-2.5 bg-indigo-600 hover:bg-indigo-700 text-white font-bold rounded-xl shadow-md transition-all cursor-pointer",children:[e.jsx(D,{size:16}),s==="zh"?"使用向导指南来创建新课程":"Create Course via Wizard"]})]}):u.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center h-full py-12 text-gray-450 text-center",children:[e.jsx(_,{size:44,className:"mb-3 opacity-30 text-gray-450"}),e.jsxs("h4",{className:"font-semibold text-gray-700 text-sm",children:['No Courses Match "',m,'"']}),e.jsx("p",{className:"text-xs text-gray-500 mt-1 max-w-xs",children:"Double-check the spelling or try searching for another curriculum keyword."}),e.jsx("button",{onClick:()=>h(""),className:"mt-3 text-xs bg-indigo-50 hover:bg-indigo-100 text-indigo-700 border border-indigo-200 font-semibold px-3 py-1.5 rounded-lg transition-colors",children:"Clear Search Filter"})]}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4",children:u.filter(t=>b?!t.creator_id||t.creator_id===r?.userId||t.creator_id===r?.username:!0).map(t=>{const x=V===t.id,l=!t.creator_id||t.creator_id===r?.userId||t.creator_id===r?.username,p=W||l;return e.jsxs("div",{className:`border border-gray-200 hover:border-indigo-300 rounded-xl p-4 flex flex-col bg-gray-50/50 hover:shadow-md transition-all ${x?"opacity-60 pointer-events-none":""}`,children:[e.jsxs("div",{className:"flex items-center justify-between mb-2 gap-2",children:[e.jsx("div",{className:"font-semibold text-gray-800 text-lg truncate cursor-pointer hover:text-indigo-600 transition-colors",title:t.title,onClick:()=>j(t.id),children:t.title}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[t.creator_name?e.jsxs("span",{className:`text-xs font-medium px-1.5 py-0.5 rounded border flex items-center gap-0.5 ${l?"bg-indigo-50 text-indigo-700 border-indigo-200 font-semibold":"bg-slate-100 text-slate-600 border-slate-200"}`,title:s==="zh"?`创建教师: ${t.creator_name}`:`Created by: ${t.creator_name}`,children:[l?"👑 ":"👤 ",t.creator_name]}):null,e.jsxs("span",{className:"inline-flex items-center gap-1 bg-indigo-50 text-indigo-700 px-1.5 py-0.5 border border-indigo-100 rounded text-xs font-bold",children:[e.jsx($,{size:10,className:"text-indigo-500"}),t.enrollment_count||0]})]})]}),e.jsx("div",{className:"text-sm text-gray-500 line-clamp-3 mb-4 flex-1",children:e.jsx(H,{children:t.content})}),e.jsxs("div",{className:"flex justify-between items-center mt-auto",children:[e.jsxs("button",{onClick:()=>K(t.id),className:`flex items-center gap-1 text-xs rounded px-1.5 py-0.5 transition-all cursor-pointer ${c===t.id?"text-emerald-600 bg-emerald-50 border border-emerald-200":"text-gray-400 hover:text-indigo-600 hover:bg-indigo-50 border border-transparent"}`,title:c===t.id?s==="zh"?"已复制!":"Copied!":s==="zh"?"复制课程 ID":"Copy Course ID",children:[c===t.id?e.jsx(te,{size:12}):e.jsx(se,{size:12}),e.jsx("span",{className:"font-mono",children:c===t.id?s==="zh"?"已复制!":"Copied!":`${t.id.substring(0,8)}…`})]}),e.jsxs("div",{className:"flex items-center gap-0.5",children:[e.jsx("button",{onClick:()=>j(t.id),className:"p-1.5 text-gray-400 hover:text-indigo-600 hover:bg-indigo-50 rounded transition-colors cursor-pointer",title:p?s==="zh"?"查看与编辑":"View & Edit":s==="zh"?"查看只读 (他人课程)":"View Read-Only",children:p?e.jsx(re,{size:15}):e.jsx(ie,{size:15})}),e.jsx("button",{onClick:()=>O(t.id),className:"p-1.5 text-gray-400 hover:text-emerald-600 hover:bg-emerald-50 rounded transition-colors cursor-pointer",title:s==="zh"?"克隆为我的备课":"Clone Course",children:e.jsx(ae,{size:14})}),p?e.jsx("button",{onClick:()=>X(t),className:"p-1.5 text-gray-400 hover:text-red-600 hover:bg-red-50 rounded transition-colors cursor-pointer",title:s==="zh"?"删除课程":"Delete Course",children:e.jsx(A,{size:14})}):e.jsx("span",{className:"p-1.5 text-gray-300 cursor-not-allowed",title:s==="zh"?"仅创建教师或管理员可删除":"Only creator or admin can delete",children:e.jsx(A,{size:14})})]})]})]},t.id)})})})]}),a&&e.jsx("div",{className:"fixed inset-0 bg-black/40 backdrop-blur-[2px] flex items-center justify-center z-[9999] p-4",children:e.jsxs("div",{className:"bg-white rounded-xl shadow-2xl max-w-md w-full border border-gray-100 overflow-hidden",children:[e.jsxs("div",{className:"px-5 py-4 border-b border-gray-100 bg-red-50 flex items-center gap-2",children:[e.jsx(oe,{size:18,className:"text-red-600"}),e.jsx("h3",{className:"font-bold text-red-800 text-sm",children:s==="zh"?"确认删除课程":"Confirm Course Deletion"})]}),e.jsxs("div",{className:"p-5 space-y-3",children:[e.jsx("p",{className:"text-sm text-gray-700",children:s==="zh"?e.jsxs(e.Fragment,{children:["确定要删除课程 ",e.jsx("span",{className:"font-bold text-red-600",children:a.title})," 吗?"]}):e.jsxs(e.Fragment,{children:["Are you sure you want to delete ",e.jsx("span",{className:"font-bold text-red-600",children:a.title}),"?"]})}),e.jsx("p",{className:"text-xs text-red-600 font-medium",children:s==="zh"?"此操作不可撤销,将删除课程的所有关联数据。":"This action is irreversible and will delete all associated data."}),J?e.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500 py-2",children:[e.jsx(M,{size:14,className:"animate-spin"}),s==="zh"?"正在统计关联数据...":"Counting related data..."]}):o?e.jsxs("div",{className:"bg-gray-50 rounded-lg p-3 space-y-1.5 text-xs",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-gray-600",children:s==="zh"?"白板元素":"Whiteboard Elements"}),e.jsx("span",{className:"font-bold text-gray-800",children:o.whiteboardCount})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-gray-600",children:s==="zh"?"排课记录":"Schedules"}),e.jsx("span",{className:"font-bold text-gray-800",children:o.scheduleCount})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-gray-600",children:s==="zh"?"选课学生":"Enrollments"}),e.jsx("span",{className:"font-bold text-gray-800",children:o.enrollmentCount})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-gray-600",children:s==="zh"?"作业任务":"Assignments"}),e.jsx("span",{className:"font-bold text-gray-800",children:o.assignmentCount})]})]}):null]}),e.jsxs("div",{className:"px-5 py-3 border-t border-gray-100 bg-gray-50 flex justify-end gap-2",children:[e.jsx("button",{onClick:()=>{g(null),n(null)},className:"px-4 py-2 text-xs font-medium text-gray-600 hover:bg-gray-100 border border-gray-200 rounded-lg transition-colors cursor-pointer",children:s==="zh"?"取消":"Cancel"}),e.jsxs("button",{onClick:q,disabled:z,className:"px-4 py-2 text-xs font-bold text-white bg-red-600 hover:bg-red-700 rounded-lg transition-colors cursor-pointer disabled:opacity-50 flex items-center gap-1.5",children:[z&&e.jsx(M,{size:12,className:"animate-spin"}),s==="zh"?"确认删除":"Confirm Delete"]})]})]})})]})}export{be as CourseManagement};
1
+ import{r as i,j as e}from"./vendor-react-B0t7H3hh.js";import{a as G,M as H}from"./index-BKBCBKvy.js";import{B as y,d as Y,n as D,aF as _,X as Q,bI as ee,U as $,bJ as te,bK as se,b0 as re,E as ie,j as ae,T as A,a4 as oe,z as M}from"./vendor-icons-BRmhY6fg.js";import"./vendor-utils-m0Urvtws.js";import"./vendor-pdf-D7rGevI1.js";import"./vendor-motion-BFAPOs-b.js";import"./vendor-pptx-C5-U7ieS.js";import"./vendor-charts-qLbgF1eL.js";function be({lang:s,session:I,lessons:d,lessonsSearchQuery:m,setLessonsSearchQuery:h,lessonsSortOrder:L,setLessonsSortOrder:T,filteredLessons:u,onOpenImportLessons:E,onOpenCourseWizard:f,onViewCourse:j,onDeleteCourse:F,onCopyCourse:O,filterEnrollment:N,setFilterEnrollment:R,filterHasContent:v,setFilterHasContent:U,filterThisMonth:w,setFilterThisMonth:B,copyingLessonId:V}){const P=G(t=>t.session),r=I||P,W=r?.username==="admin"||r?.userId==="usr_admin"||r?.role==="administrator"||r?.subRole==="administrator",[b,Z]=i.useState(!1),[a,g]=i.useState(null),[o,n]=i.useState(null),[z,C]=i.useState(!1),[J,k]=i.useState(!1),[c,S]=i.useState(null),K=t=>{navigator.clipboard.writeText(t).then(()=>{S(t),setTimeout(()=>S(null),1500)})},X=async t=>{g(t),n(null),k(!0);try{const x=await fetch(`/api/lessons/${t.id}/stats`);if(x.ok){const l=await x.json();n(l)}}catch{n({whiteboardCount:0,scheduleCount:0,enrollmentCount:0,assignmentCount:0})}finally{k(!1)}},q=async()=>{if(a){C(!0);try{await F(a.id),g(null),n(null)}finally{C(!1)}}};return e.jsxs("div",{className:"flex-1 flex flex-col gap-6 h-full overflow-y-auto",children:[e.jsxs("div",{className:"flex-1 bg-white border border-gray-200 rounded-xl shadow-sm flex flex-col min-h-0",children:[e.jsxs("div",{className:"p-4 border-b border-gray-100 flex items-center justify-between shrink-0",children:[e.jsxs("h3",{className:"font-medium text-gray-700 flex items-center gap-2",children:[e.jsx(y,{size:16,className:"text-gray-400"}),s==="zh"?"课程与教学环节管理 (SQLite)":"Courses & Lessons Management"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{id:"import-lessons-csv-btn",onClick:E,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs bg-indigo-50 hover:bg-indigo-100 text-indigo-700 border border-indigo-200 font-semibold rounded-lg shadow-3xs transition-all hover:shadow-xs hover:-translate-y-0.5 cursor-pointer",children:[e.jsx(Y,{size:14}),s==="zh"?"批量导入课程 (CSV)":"Import Lessons (CSV)"]}),e.jsxs("button",{id:"add-course-wizard-btn",onClick:f,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs bg-indigo-600 hover:bg-indigo-700 text-white font-semibold rounded-lg shadow-sm transition-all hover:shadow-md hover:-translate-y-0.5 cursor-pointer",children:[e.jsx(D,{size:14}),s==="zh"?"手动添加课程 (向导)":"Add Course Wizard"]})]})]}),d.length>0&&e.jsxs("div",{className:"px-5 py-3.5 border-b border-gray-100 bg-gray-50/50 flex flex-col sm:flex-row items-center justify-between gap-3 shrink-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-3 w-full sm:w-auto",children:[e.jsxs("div",{className:"relative w-full sm:w-64",children:[e.jsx("span",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none text-gray-400",children:e.jsx(_,{size:14})}),e.jsx("input",{type:"text",placeholder:"Search courses by title...",value:m,onChange:t=>h(t.target.value),className:"w-full pl-9 pr-8 py-1.5 text-xs bg-white border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 text-gray-800 shadow-sm"}),m&&e.jsx("button",{onClick:()=>h(""),className:"absolute inset-y-0 right-0 flex items-center pr-2.5 text-gray-400 hover:text-gray-600",children:e.jsx(Q,{size:12,className:"bg-gray-100 hover:bg-gray-200 rounded-full p-0.5"})})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-xs font-bold text-gray-400 uppercase tracking-wider",children:s==="zh"?"排序方式:":"Sort by:"}),e.jsxs("select",{value:L,onChange:t=>T(t.target.value),className:"bg-white border border-gray-200 text-xs text-gray-755 font-bold px-2.5 py-1.5 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 shadow-sm",id:"courses-sort-select",children:[e.jsx("option",{value:"recent",children:s==="zh"?"最新创建":"Most Recent"}),e.jsx("option",{value:"alphabetical",children:s==="zh"?"按名称 (A-Z)":"Alphabetical (A-Z)"}),e.jsx("option",{value:"enrollment",children:s==="zh"?"学生选课人次":"Student Enrollment Count"})]})]})]}),e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs("button",{onClick:()=>Z(!b),className:`px-2 py-1 text-xs font-bold rounded-md border transition-all cursor-pointer ${b?"bg-indigo-600 text-white border-indigo-600 shadow-2xs":"bg-white text-gray-600 border-gray-200 hover:border-gray-300"}`,title:s==="zh"?"只看我创建的课程":"Only show courses created by me",children:[e.jsx(ee,{size:11,className:"inline mr-0.5 -mt-0.5"}),s==="zh"?"我的备课":"My Courses"]}),e.jsxs("button",{onClick:()=>R(!N),className:`px-2 py-1 text-xs font-bold rounded-md border transition-all cursor-pointer ${N?"bg-emerald-50 text-emerald-700 border-emerald-200":"bg-white text-gray-500 border-gray-200 hover:border-gray-300"}`,children:[e.jsx($,{size:11,className:"inline mr-0.5 -mt-0.5"}),s==="zh"?"有人选":"Enrolled"]}),e.jsxs("button",{onClick:()=>U(!v),className:`px-2 py-1 text-xs font-bold rounded-md border transition-all cursor-pointer ${v?"bg-indigo-50 text-indigo-700 border-indigo-200":"bg-white text-gray-500 border-gray-200 hover:border-gray-300"}`,children:[e.jsx(y,{size:11,className:"inline mr-0.5 -mt-0.5"}),s==="zh"?"有内容":"Has Content"]}),e.jsx("button",{onClick:()=>B(!w),className:`px-2 py-1 text-xs font-bold rounded-md border transition-all cursor-pointer ${w?"bg-amber-50 text-amber-700 border-amber-200":"bg-white text-gray-500 border-gray-200 hover:border-gray-300"}`,children:s==="zh"?"本月":"This Month"})]}),e.jsxs("div",{className:"text-xs font-semibold text-gray-500",children:["Found ",e.jsx("span",{className:"text-indigo-650 font-bold",children:u.length})," of"," ",e.jsx("span",{className:"text-gray-700 font-bold",children:d.length})," course",d.length===1?"":"s"]})]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:d.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-gray-400 min-h-[300px]",children:[e.jsx(y,{size:48,className:"mb-4 opacity-30 text-indigo-500"}),e.jsx("h3",{className:"text-lg font-bold text-gray-800",children:s==="zh"?"暂无可用课程":"No Courses Available"}),e.jsx("p",{className:"mt-2 text-sm text-gray-500 text-center max-w-xs",children:s==="zh"?"系统中暂未部署任何课程。请通过下方按钮启动添加向导指南。":"There are no courses active in the system yet. Build your first curriculum!"}),e.jsxs("button",{id:"empty-add-course-btn",onClick:f,className:"mt-5 flex items-center gap-2 px-5 py-2.5 bg-indigo-600 hover:bg-indigo-700 text-white font-bold rounded-xl shadow-md transition-all cursor-pointer",children:[e.jsx(D,{size:16}),s==="zh"?"使用向导指南来创建新课程":"Create Course via Wizard"]})]}):u.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center h-full py-12 text-gray-450 text-center",children:[e.jsx(_,{size:44,className:"mb-3 opacity-30 text-gray-450"}),e.jsxs("h4",{className:"font-semibold text-gray-700 text-sm",children:['No Courses Match "',m,'"']}),e.jsx("p",{className:"text-xs text-gray-500 mt-1 max-w-xs",children:"Double-check the spelling or try searching for another curriculum keyword."}),e.jsx("button",{onClick:()=>h(""),className:"mt-3 text-xs bg-indigo-50 hover:bg-indigo-100 text-indigo-700 border border-indigo-200 font-semibold px-3 py-1.5 rounded-lg transition-colors",children:"Clear Search Filter"})]}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4",children:u.filter(t=>b?!t.creator_id||t.creator_id===r?.userId||t.creator_id===r?.username:!0).map(t=>{const x=V===t.id,l=!t.creator_id||t.creator_id===r?.userId||t.creator_id===r?.username,p=W||l;return e.jsxs("div",{className:`border border-gray-200 hover:border-indigo-300 rounded-xl p-4 flex flex-col bg-gray-50/50 hover:shadow-md transition-all ${x?"opacity-60 pointer-events-none":""}`,children:[e.jsxs("div",{className:"flex items-center justify-between mb-2 gap-2",children:[e.jsx("div",{className:"font-semibold text-gray-800 text-lg truncate cursor-pointer hover:text-indigo-600 transition-colors",title:t.title,onClick:()=>j(t.id),children:t.title}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[t.creator_name?e.jsxs("span",{className:`text-xs font-medium px-1.5 py-0.5 rounded border flex items-center gap-0.5 ${l?"bg-indigo-50 text-indigo-700 border-indigo-200 font-semibold":"bg-slate-100 text-slate-600 border-slate-200"}`,title:s==="zh"?`创建教师: ${t.creator_name}`:`Created by: ${t.creator_name}`,children:[l?"👑 ":"👤 ",t.creator_name]}):null,e.jsxs("span",{className:"inline-flex items-center gap-1 bg-indigo-50 text-indigo-700 px-1.5 py-0.5 border border-indigo-100 rounded text-xs font-bold",children:[e.jsx($,{size:10,className:"text-indigo-500"}),t.enrollment_count||0]})]})]}),e.jsx("div",{className:"text-sm text-gray-500 line-clamp-3 mb-4 flex-1",children:e.jsx(H,{children:t.content})}),e.jsxs("div",{className:"flex justify-between items-center mt-auto",children:[e.jsxs("button",{onClick:()=>K(t.id),className:`flex items-center gap-1 text-xs rounded px-1.5 py-0.5 transition-all cursor-pointer ${c===t.id?"text-emerald-600 bg-emerald-50 border border-emerald-200":"text-gray-400 hover:text-indigo-600 hover:bg-indigo-50 border border-transparent"}`,title:c===t.id?s==="zh"?"已复制!":"Copied!":s==="zh"?"复制课程 ID":"Copy Course ID",children:[c===t.id?e.jsx(te,{size:12}):e.jsx(se,{size:12}),e.jsx("span",{className:"font-mono",children:c===t.id?s==="zh"?"已复制!":"Copied!":`${t.id.substring(0,8)}…`})]}),e.jsxs("div",{className:"flex items-center gap-0.5",children:[e.jsx("button",{onClick:()=>j(t.id),className:"p-1.5 text-gray-400 hover:text-indigo-600 hover:bg-indigo-50 rounded transition-colors cursor-pointer",title:p?s==="zh"?"查看与编辑":"View & Edit":s==="zh"?"查看只读 (他人课程)":"View Read-Only",children:p?e.jsx(re,{size:15}):e.jsx(ie,{size:15})}),e.jsx("button",{onClick:()=>O(t.id),className:"p-1.5 text-gray-400 hover:text-emerald-600 hover:bg-emerald-50 rounded transition-colors cursor-pointer",title:s==="zh"?"克隆为我的备课":"Clone Course",children:e.jsx(ae,{size:14})}),p?e.jsx("button",{onClick:()=>X(t),className:"p-1.5 text-gray-400 hover:text-red-600 hover:bg-red-50 rounded transition-colors cursor-pointer",title:s==="zh"?"删除课程":"Delete Course",children:e.jsx(A,{size:14})}):e.jsx("span",{className:"p-1.5 text-gray-300 cursor-not-allowed",title:s==="zh"?"仅创建教师或管理员可删除":"Only creator or admin can delete",children:e.jsx(A,{size:14})})]})]})]},t.id)})})})]}),a&&e.jsx("div",{className:"fixed inset-0 bg-black/40 backdrop-blur-[2px] flex items-center justify-center z-[9999] p-4",children:e.jsxs("div",{className:"bg-white rounded-xl shadow-2xl max-w-md w-full border border-gray-100 overflow-hidden",children:[e.jsxs("div",{className:"px-5 py-4 border-b border-gray-100 bg-red-50 flex items-center gap-2",children:[e.jsx(oe,{size:18,className:"text-red-600"}),e.jsx("h3",{className:"font-bold text-red-800 text-sm",children:s==="zh"?"确认删除课程":"Confirm Course Deletion"})]}),e.jsxs("div",{className:"p-5 space-y-3",children:[e.jsx("p",{className:"text-sm text-gray-700",children:s==="zh"?e.jsxs(e.Fragment,{children:["确定要删除课程 ",e.jsx("span",{className:"font-bold text-red-600",children:a.title})," 吗?"]}):e.jsxs(e.Fragment,{children:["Are you sure you want to delete ",e.jsx("span",{className:"font-bold text-red-600",children:a.title}),"?"]})}),e.jsx("p",{className:"text-xs text-red-600 font-medium",children:s==="zh"?"此操作不可撤销,将删除课程的所有关联数据。":"This action is irreversible and will delete all associated data."}),J?e.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500 py-2",children:[e.jsx(M,{size:14,className:"animate-spin"}),s==="zh"?"正在统计关联数据...":"Counting related data..."]}):o?e.jsxs("div",{className:"bg-gray-50 rounded-lg p-3 space-y-1.5 text-xs",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-gray-600",children:s==="zh"?"白板元素":"Whiteboard Elements"}),e.jsx("span",{className:"font-bold text-gray-800",children:o.whiteboardCount})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-gray-600",children:s==="zh"?"排课记录":"Schedules"}),e.jsx("span",{className:"font-bold text-gray-800",children:o.scheduleCount})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-gray-600",children:s==="zh"?"选课学生":"Enrollments"}),e.jsx("span",{className:"font-bold text-gray-800",children:o.enrollmentCount})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-gray-600",children:s==="zh"?"作业任务":"Assignments"}),e.jsx("span",{className:"font-bold text-gray-800",children:o.assignmentCount})]})]}):null]}),e.jsxs("div",{className:"px-5 py-3 border-t border-gray-100 bg-gray-50 flex justify-end gap-2",children:[e.jsx("button",{onClick:()=>{g(null),n(null)},className:"px-4 py-2 text-xs font-medium text-gray-600 hover:bg-gray-100 border border-gray-200 rounded-lg transition-colors cursor-pointer",children:s==="zh"?"取消":"Cancel"}),e.jsxs("button",{onClick:q,disabled:z,className:"px-4 py-2 text-xs font-bold text-white bg-red-600 hover:bg-red-700 rounded-lg transition-colors cursor-pointer disabled:opacity-50 flex items-center gap-1.5",children:[z&&e.jsx(M,{size:12,className:"animate-spin"}),s==="zh"?"确认删除":"Confirm Delete"]})]})]})})]})}export{be as CourseManagement};