openlearn-next 0.2.1 → 0.2.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.
@@ -8292,6 +8292,37 @@ The teacher used the virtual whiteboard to ___ classroom active learning slides.
8292
8292
  <script>
8293
8293
  window.__LMS_STUDENT__ = ${JSON.stringify(n)};
8294
8294
  window.__LMS_COURSEWARE__ = ${JSON.stringify(a)};
8295
+ (function() {
8296
+ try {
8297
+ // Override window.postMessage (self-targeting, always works)
8298
+ var origPM = window.postMessage;
8299
+ window.postMessage = function(msg, targetOrigin, transfer) {
8300
+ var origin = (targetOrigin === 'null' || targetOrigin === null) ? '*' : targetOrigin;
8301
+ try { return origPM.call(this, msg, origin, transfer); }
8302
+ catch(err) { if (err.name === 'SyntaxError') return origPM.call(this, msg, '*', transfer); throw err; }
8303
+ };
8304
+ // Shadow window.parent / window.top with Proxy to intercept .postMessage()
8305
+ // Direct assignment (window.parent.postMessage = ...) silently fails on cross-origin WindowProxy
8306
+ function proxyWin(realRef, propName) {
8307
+ try {
8308
+ var safePost = function(msg, targetOrigin, transfer) {
8309
+ var origin = (targetOrigin === 'null' || targetOrigin === null) ? '*' : targetOrigin;
8310
+ try { return realRef.postMessage.call(realRef, msg, origin, transfer); }
8311
+ catch(err) { if (err.name === 'SyntaxError') return realRef.postMessage.call(realRef, msg, '*', transfer); throw err; }
8312
+ };
8313
+ var px = new Proxy(realRef, {
8314
+ get: function(t, p) {
8315
+ if (p === 'postMessage') return safePost;
8316
+ try { var v = t[p]; return typeof v === 'function' ? v.bind(t) : v; } catch(e) { return undefined; }
8317
+ }
8318
+ });
8319
+ Object.defineProperty(window, propName, { get: function() { return px; }, configurable: true });
8320
+ } catch(e) {}
8321
+ }
8322
+ if (window.parent && window.parent !== window) proxyWin(window.parent, 'parent');
8323
+ try { if (window.top && window.top !== window) proxyWin(window.top, 'top'); } catch(e) {}
8324
+ } catch(e) {}
8325
+ })();
8295
8326
  <\/script>
8296
8327
  <script src="/bridge.js"><\/script>
8297
8328
  </head><body>
@@ -8307,6 +8338,6 @@ ${e||""}
8307
8338
  <h2>Interactive Web Courseware</h2>
8308
8339
  <p>可在右侧属性栏中选择本地 ZIP/HTML 部署包。</p>
8309
8340
  </div>`,x:100,y:150,page:c,segmentId:r}),frontendEventBus.publish({id:v7(),type:"whiteboard.element_updated",source:"whiteboard",payload:{lessonId:s},timestamp:Date.now(),correlationId:s})}finally{S(!1)}},className:"p-1.5 rounded-xl text-slate-600 hover:bg-slate-100 transition-all cursor-pointer",title:"插入交互网页课件 (Interactive Courseware)",children:jsxRuntimeExports.jsx(Globe,{size:16})}),jsxRuntimeExports.jsx("div",{className:"w-px h-4 bg-slate-200/80 mx-0.5"}),jsxRuntimeExports.jsx("button",{onClick:async()=>{S(!0);try{await i("rollcall",{title:"随机点名助手",x:120,y:120,page:c,segmentId:r}),frontendEventBus.publish({id:v7(),type:"whiteboard.element_updated",source:"whiteboard",payload:{lessonId:s},timestamp:Date.now(),correlationId:s})}finally{S(!1)}},className:"p-1.5 rounded-xl text-indigo-600 hover:bg-indigo-50 transition-all cursor-pointer flex items-center gap-1 text-xs font-semibold",title:"插入随机点名组件 (Roll Call)",children:jsxRuntimeExports.jsx(UserCheck,{size:15})}),jsxRuntimeExports.jsx("div",{className:"w-px h-4 bg-slate-200/80 mx-0.5"}),jsxRuntimeExports.jsx(ExtensionPointRenderer,{slot:"classroom.tool"}),jsxRuntimeExports.jsx("button",{onClick:async()=>{S(!0);try{(await fetch(`/api/lessons/${s}/ai-tutor`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({elements:h.map(K=>({type:K.type,data:JSON.parse(K.data)}))})})).ok?(frontendEventBus.publish({id:v7(),type:"whiteboard.element_updated",source:"whiteboard",payload:{lessonId:s},timestamp:Date.now(),correlationId:s}),U&&U()):j({type:"alert",title:"AI 辅导提示",message:"无法获取 AI 授课助手的帮助,请稍后再试。",onConfirm:()=>j(null)})}finally{S(!1)}},className:"p-1.5 rounded-xl text-purple-600 hover:bg-purple-50 transition-all cursor-pointer",title:"请求 AI 助教建议 (Ask AI Tutor)",children:jsxRuntimeExports.jsx(WandSparkles,{size:16})}),jsxRuntimeExports.jsx("div",{className:"w-px h-4 bg-slate-200/80 mx-0.5"}),jsxRuntimeExports.jsx("button",{onClick:()=>g(b=>!b),className:`p-1.5 rounded-xl transition-all cursor-pointer ${p?"text-indigo-600 bg-indigo-50/80":"text-slate-400 hover:bg-slate-100"}`,title:p?"关闭网格背景":"开启网格背景",children:jsxRuntimeExports.jsx(Grid3x3,{size:16})}),u&&jsxRuntimeExports.jsxs("button",{onClick:()=>{v(u),o(null)},className:"px-2 py-1 rounded-xl text-rose-600 bg-rose-50 hover:bg-rose-100 border border-rose-200/80 shadow-2xs font-semibold flex items-center gap-1 text-xs transition-all cursor-pointer",title:"删除选中图形",children:[jsxRuntimeExports.jsx(Trash2,{size:13})," 删除"]}),k!=="student"?jsxRuntimeExports.jsx("button",{onClick:R,className:"p-1.5 rounded-xl text-slate-500 hover:text-rose-600 hover:bg-rose-50 transition-all cursor-pointer",title:"清空白板 (Clear Board)",children:jsxRuntimeExports.jsx(Eraser,{size:16})}):jsxRuntimeExports.jsx("button",{onClick:C,className:"p-1.5 rounded-xl text-slate-500 hover:text-amber-600 hover:bg-amber-50 transition-all cursor-pointer",title:"重置白板 (Reset Board)",children:jsxRuntimeExports.jsx(RotateCcw,{size:16})}),w&&jsxRuntimeExports.jsx(LoaderCircle,{size:15,className:"text-indigo-500 animate-spin ml-1"})]}),WhiteboardPageBar=({pages:e,currentPage:t,showPageDrawer:o,setShowPageDrawer:n,editingPageIdx:a,setEditingPageIdx:i,editingPageTitle:c,setEditingPageTitle:r,activeMenuPageIdx:s,setActiveMenuPageIdx:h,safeElements:u,handleSwitchPage:p,handleRenamePage:g,handleDuplicatePage:k,handleMovePage:w,handleDeletePage:S,handleAddPage:R})=>jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:"absolute bottom-3 left-1/2 -translate-x-1/2 z-20 flex items-center gap-1.5 bg-white/95 backdrop-blur-md px-3 py-1.5 rounded-full shadow-lg border border-slate-200/80 font-sans select-none",children:[jsxRuntimeExports.jsxs("button",{onClick:()=>n(!o),className:`p-1.5 rounded-full transition-colors cursor-pointer flex items-center gap-1 text-xs font-medium ${o?"bg-indigo-100 text-indigo-700":"text-slate-600 hover:bg-slate-100"}`,title:"页面大纲与预览 (Pages Outline)",children:[jsxRuntimeExports.jsx(LayoutGrid,{size:15}),jsxRuntimeExports.jsxs("span",{className:"hidden sm:inline text-[11px] font-semibold",children:["大纲 (",e.length,")"]})]}),jsxRuntimeExports.jsx("div",{className:"h-4 w-px bg-slate-200 mx-0.5"}),jsxRuntimeExports.jsx("button",{onClick:()=>p(Math.max(0,t-1)),className:"p-1 hover:bg-slate-100 rounded-full text-slate-600 disabled:opacity-30 disabled:hover:bg-transparent transition-colors cursor-pointer",disabled:t===0,title:"上一页",children:jsxRuntimeExports.jsx(ChevronLeft,{size:16})}),jsxRuntimeExports.jsx("div",{className:"flex items-center gap-1 max-w-[500px] overflow-x-auto no-scrollbar py-0.5",children:e.map((C,v)=>{const j=v===t,F=a===v;return jsxRuntimeExports.jsxs("div",{className:"relative group flex items-center",children:[F?jsxRuntimeExports.jsx("input",{type:"text",autoFocus:!0,value:c,onChange:U=>r(U.target.value),onKeyDown:U=>{U.key==="Enter"&&g(v,c),U.key==="Escape"&&i(null)},onBlur:()=>g(v,c),className:"px-2 py-0.5 text-xs font-bold bg-white border border-indigo-500 rounded-full outline-none w-28 text-slate-800 shadow-2xs"}):jsxRuntimeExports.jsx("button",{onClick:()=>p(v),onDoubleClick:()=>{i(v),r(C.title)},className:`px-3 py-1 rounded-full text-xs font-bold transition-all cursor-pointer flex items-center gap-1 border ${j?"bg-indigo-600 text-white border-indigo-600 shadow-2xs":"text-slate-600 hover:bg-slate-100 hover:text-slate-900 border-transparent"}`,title:"双击重命名",children:jsxRuntimeExports.jsx("span",{className:"truncate max-w-[120px]",children:C.title})}),jsxRuntimeExports.jsx("button",{onClick:U=>{U.stopPropagation(),h(s===v?null:v)},className:`p-0.5 rounded-full hover:bg-black/10 transition-colors ml-[-4px] z-10 ${j?"text-white/80 hover:text-white":"text-slate-400 hover:text-slate-600"}`,title:"页面选项",children:jsxRuntimeExports.jsx(ChevronDown,{size:12})}),s===v&&jsxRuntimeExports.jsxs("div",{className:"absolute bottom-full mb-2 left-1/2 -translate-x-1/2 bg-white rounded-xl shadow-xl border border-slate-100 py-1 w-36 z-50 text-xs font-normal",onClick:U=>U.stopPropagation(),children:[jsxRuntimeExports.jsxs("button",{onClick:()=>{i(v),r(C.title),h(null)},className:"w-full px-3 py-1.5 text-left text-slate-700 hover:bg-indigo-50 hover:text-indigo-600 flex items-center gap-2 cursor-pointer",children:[jsxRuntimeExports.jsx(PenLine,{size:13})," 重命名"]}),jsxRuntimeExports.jsxs("button",{onClick:()=>{k(v),h(null)},className:"w-full px-3 py-1.5 text-left text-slate-700 hover:bg-indigo-50 hover:text-indigo-600 flex items-center gap-2 cursor-pointer",children:[jsxRuntimeExports.jsx(Copy,{size:13})," 复制页面"]}),v>0&&jsxRuntimeExports.jsxs("button",{onClick:()=>{w(v,"left"),h(null)},className:"w-full px-3 py-1.5 text-left text-slate-700 hover:bg-indigo-50 hover:text-indigo-600 flex items-center gap-2 cursor-pointer",children:[jsxRuntimeExports.jsx(ChevronLeft,{size:13})," 向左移动"]}),v<e.length-1&&jsxRuntimeExports.jsxs("button",{onClick:()=>{w(v,"right"),h(null)},className:"w-full px-3 py-1.5 text-left text-slate-700 hover:bg-indigo-50 hover:text-indigo-600 flex items-center gap-2 cursor-pointer",children:[jsxRuntimeExports.jsx(ChevronRight,{size:13})," 向右移动"]}),jsxRuntimeExports.jsx("div",{className:"my-1 border-t border-slate-100"}),jsxRuntimeExports.jsxs("button",{onClick:()=>{S(v),h(null)},className:"w-full px-3 py-1.5 text-left text-red-600 hover:bg-red-50 flex items-center gap-2 cursor-pointer disabled:opacity-30",disabled:e.length<=1,children:[jsxRuntimeExports.jsx(Trash2,{size:13})," 删除页面"]})]})]},C.id||v)})}),jsxRuntimeExports.jsx("button",{onClick:()=>R(),className:"p-1 hover:bg-indigo-50 hover:text-indigo-600 text-slate-400 rounded-full transition-colors cursor-pointer ml-0.5",title:"新建白板页面",children:jsxRuntimeExports.jsx(Plus,{size:16})}),jsxRuntimeExports.jsx("button",{onClick:()=>p(Math.min(e.length-1,t+1)),className:"p-1 hover:bg-slate-100 rounded-full text-slate-600 disabled:opacity-30 disabled:hover:bg-transparent transition-colors cursor-pointer",disabled:t>=e.length-1,title:"下一页",children:jsxRuntimeExports.jsx(ChevronRight,{size:16})})]}),o&&jsxRuntimeExports.jsx("div",{className:"absolute inset-0 bg-slate-900/30 backdrop-blur-xs z-30 flex flex-col justify-end pointer-events-auto font-sans",onClick:()=>n(!1),children:jsxRuntimeExports.jsxs("div",{className:"bg-white/95 backdrop-blur-xl border-t border-slate-200 rounded-t-2xl shadow-2xl p-4 max-h-[70vh] flex flex-col w-full max-w-5xl mx-auto animate-in slide-in-from-bottom duration-200",onClick:C=>C.stopPropagation(),children:[jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between pb-3 border-b border-slate-100 shrink-0",children:[jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntimeExports.jsx(LayoutGrid,{className:"w-5 h-5 text-indigo-600"}),jsxRuntimeExports.jsx("h3",{className:"font-bold text-slate-800 text-sm",children:"白板页面大纲与预览"}),jsxRuntimeExports.jsxs("span",{className:"px-2 py-0.5 bg-indigo-50 text-indigo-600 text-xs rounded-full font-semibold",children:["共 ",e.length," 页"]})]}),jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntimeExports.jsxs("button",{onClick:()=>R(),className:"px-3 py-1.5 bg-indigo-600 hover:bg-indigo-700 text-white rounded-lg text-xs font-semibold flex items-center gap-1.5 transition-colors cursor-pointer shadow-xs",children:[jsxRuntimeExports.jsx(Plus,{size:14})," 新建页面"]}),jsxRuntimeExports.jsx("button",{onClick:()=>n(!1),className:"p-1.5 hover:bg-slate-100 rounded-full text-slate-400 hover:text-slate-600 transition-colors cursor-pointer",children:jsxRuntimeExports.jsx(X,{size:16})})]})]}),jsxRuntimeExports.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-3 py-4 overflow-y-auto max-h-[50vh]",children:e.map((C,v)=>{const j=v===t,F=u.filter(U=>U.type!=="page_meta"&&(()=>{try{const b=JSON.parse(U.data);return(b.page??0)===v||b.pageId===C.id}catch{return v===0}})()).length;return jsxRuntimeExports.jsxs("div",{onClick:()=>{p(v),n(!1)},className:`relative flex flex-col p-3 rounded-xl border-2 transition-all cursor-pointer group bg-white ${j?"border-indigo-600 bg-indigo-50/20 shadow-md ring-2 ring-indigo-500/20":"border-slate-200/80 hover:border-indigo-300 hover:shadow-sm"}`,children:[jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntimeExports.jsxs("span",{className:`text-[11px] font-extrabold px-2 py-0.5 rounded-md ${j?"bg-indigo-600 text-white":"bg-slate-100 text-slate-600"}`,children:["P",v+1]}),j&&jsxRuntimeExports.jsx("span",{className:"text-[10px] font-bold text-indigo-600 bg-indigo-50 px-1.5 py-0.5 rounded",children:"当前激活"})]}),jsxRuntimeExports.jsxs("div",{className:"h-20 bg-slate-50 border border-slate-100 rounded-lg flex flex-col items-center justify-center mb-2 overflow-hidden relative",children:[jsxRuntimeExports.jsx(FileText,{size:24,className:j?"text-indigo-400":"text-slate-300"}),jsxRuntimeExports.jsxs("span",{className:"text-[10px] text-slate-400 font-medium mt-1",children:[F," 个组件/笔画"]})]}),jsxRuntimeExports.jsx("div",{className:"font-bold text-xs text-slate-800 truncate mb-1",title:C.title,children:C.title}),jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between pt-2 border-t border-slate-100 text-slate-400 text-[11px]",onClick:U=>U.stopPropagation(),children:[jsxRuntimeExports.jsx("button",{onClick:()=>{i(v),r(C.title)},className:"hover:text-indigo-600 p-1 rounded hover:bg-slate-100 transition-colors",title:"重命名",children:jsxRuntimeExports.jsx(PenLine,{size:13})}),jsxRuntimeExports.jsx("button",{onClick:()=>k(v),className:"hover:text-indigo-600 p-1 rounded hover:bg-slate-100 transition-colors",title:"复制页面",children:jsxRuntimeExports.jsx(Copy,{size:13})}),v>0&&jsxRuntimeExports.jsx("button",{onClick:()=>w(v,"left"),className:"hover:text-indigo-600 p-1 rounded hover:bg-slate-100 transition-colors",title:"向左移",children:jsxRuntimeExports.jsx(ChevronLeft,{size:13})}),v<e.length-1&&jsxRuntimeExports.jsx("button",{onClick:()=>w(v,"right"),className:"hover:text-indigo-600 p-1 rounded hover:bg-slate-100 transition-colors",title:"向右移",children:jsxRuntimeExports.jsx(ChevronRight,{size:13})}),jsxRuntimeExports.jsx("button",{onClick:()=>S(v),className:"hover:text-red-600 p-1 rounded hover:bg-red-50 transition-colors disabled:opacity-30",disabled:e.length<=1,title:"删除页面",children:jsxRuntimeExports.jsx(Trash2,{size:13})})]})]},C.id||v)})})]})})]}),WhiteboardDialog=({dialog:e,dialogInput:t,setDialogInput:o,setDialog:n})=>e?jsxRuntimeExports.jsx("div",{className:"absolute inset-0 bg-neutral-900/40 backdrop-blur-[2px] flex items-center justify-center z-[9999] p-4 font-sans",children:jsxRuntimeExports.jsxs("div",{className:"bg-white rounded-xl shadow-2xl overflow-hidden max-w-sm w-full border border-gray-100 flex flex-col scale-100 pointer-events-auto",children:[jsxRuntimeExports.jsxs("div",{className:"px-5 py-4 border-b border-gray-150/60 bg-gray-50 flex justify-between items-center shrink-0",children:[jsxRuntimeExports.jsx("h3",{className:"font-bold text-gray-800 text-sm",children:e.title}),jsxRuntimeExports.jsx("button",{onClick:()=>n(null),className:"text-gray-400 hover:text-gray-650 transition-colors text-xl font-light cursor-pointer",children:"×"})]}),jsxRuntimeExports.jsxs("div",{className:"p-5 flex-1 min-h-0",children:[jsxRuntimeExports.jsx("p",{className:"text-xs text-gray-600 leading-relaxed whitespace-pre-wrap mb-4 font-medium",children:e.message}),e.type==="prompt"&&jsxRuntimeExports.jsx("textarea",{value:t,onChange:a=>o(a.target.value),placeholder:e.placeholder,className:"w-full h-32 p-3 border border-gray-300 rounded-lg text-xs font-mono focus:outline-none focus:ring-2 focus:ring-indigo-500 bg-gray-50 focus:bg-white transition-all resize-none font-medium",onPointerDown:a=>a.stopPropagation()})]}),jsxRuntimeExports.jsxs("div",{className:"px-5 py-3 border-t border-gray-100 bg-gray-50 flex justify-end gap-2 text-xs shrink-0",children:[e.type!=="alert"&&jsxRuntimeExports.jsx("button",{onClick:()=>n(null),className:"px-4 py-2 text-gray-500 hover:bg-gray-100 rounded-lg transition-colors font-medium border border-gray-200 cursor-pointer",children:"取消"}),jsxRuntimeExports.jsx("button",{onClick:async()=>{try{await e.onConfirm(t)}catch(a){console.error("Dialog action error:",a)}},className:"px-4 py-2 bg-indigo-600 hover:bg-indigo-700 text-white rounded-lg font-semibold transition-all shadow-sm cursor-pointer",children:"确定"})]})]})}):null,CoursewareEntrySelectorModal=({showEntrySelector:e,setShowEntrySelector:t,zipUploadInfo:o,zipCandidates:n,handlePropsUpdate:a,fetchCoursewares:i})=>!e||!o?null:jsxRuntimeExports.jsx("div",{className:"absolute inset-0 bg-neutral-900/40 backdrop-blur-[2px] flex items-center justify-center z-[9999] p-4 font-sans",children:jsxRuntimeExports.jsxs("div",{className:"bg-white rounded-xl shadow-2xl overflow-hidden max-w-sm w-full border border-gray-100 flex flex-col scale-100 pointer-events-auto",children:[jsxRuntimeExports.jsxs("div",{className:"px-5 py-4 border-b border-gray-150/60 bg-gray-50 flex justify-between items-center shrink-0",children:[jsxRuntimeExports.jsx("h3",{className:"font-bold text-gray-800 text-sm",children:"选择课件入口页面"}),jsxRuntimeExports.jsx("button",{onClick:()=>t(!1),className:"text-gray-400 hover:text-gray-650 transition-colors text-xl font-light cursor-pointer",children:"×"})]}),jsxRuntimeExports.jsxs("div",{className:"p-5 flex-1 min-h-0 space-y-3",children:[jsxRuntimeExports.jsx("p",{className:"text-xs text-gray-600 leading-relaxed font-medium",children:"ZIP压缩包中含有多个HTML文件,请选择一个作为课件入口:"}),jsxRuntimeExports.jsx("div",{className:"max-h-60 overflow-y-auto border border-gray-200 rounded-lg p-2 bg-gray-50 space-y-1",children:n.map(c=>jsxRuntimeExports.jsxs("button",{onClick:async()=>{try{const r=await fetch("/api/courseware/confirm",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({uuid:o.uuid,name:o.name,entry:c})});if(r.ok){const s=await r.json();a({coursewareUuid:s.uuid,resourceId:""}),t(!1),i()}}catch(r){console.error("Failed to confirm entry point:",r)}},className:"w-full text-left p-2 rounded hover:bg-indigo-50 hover:text-indigo-700 text-xs font-semibold font-mono truncate transition-all cursor-pointer",children:["📄 ",c]},c))})]}),jsxRuntimeExports.jsx("div",{className:"px-5 py-3 border-t border-gray-100 bg-gray-50 flex justify-end gap-2 text-xs shrink-0",children:jsxRuntimeExports.jsx("button",{onClick:()=>t(!1),className:"px-4 py-2 text-gray-500 hover:bg-gray-100 rounded-lg transition-colors font-medium border border-gray-200 cursor-pointer",children:"取消"})})]})}),DEFAULT_WHITEBOARD_PAGES=[{id:"page-0",title:"P1 · 引入导入",order:0},{id:"page-1",title:"P2 · 核心讲解",order:1},{id:"page-2",title:"P3 · 互动练习",order:2}],InteractiveWhiteboard=reactExports.forwardRef(({lessonId:e,elements:t,onElementAdd:o,onElementUpdate:n,onElementDelete:a,onClearBoard:i,onRefresh:c,enableAutoAI:r,activeSegmentId:s,onSegmentSync:h,userRole:u="teacher",isEditMode:p=!0},g)=>{const k=Array.isArray(t)?t:[],[w,S]=reactExports.useState("cursor"),[R,C]=reactExports.useState("#facc15"),[v,j]=reactExports.useState(0),[F,U]=reactExports.useState(!0),[b,K]=reactExports.useState(!1),[Z,Y]=reactExports.useState(DEFAULT_WHITEBOARD_PAGES),[oe,H]=reactExports.useState(!1),[E,J]=reactExports.useState(null),[z,A]=reactExports.useState(""),[Q,se]=reactExports.useState(null);reactExports.useEffect(()=>{const l=k.find(d=>d.type==="page_meta");if(l)try{const d=JSON.parse(l.data);Array.isArray(d.pages)&&d.pages.length>0&&Y(d.pages)}catch(d){console.error("Failed to parse whiteboard page_meta:",d)}},[t]);const ge=l=>{const d=k.find(_=>_.type==="page_meta");d&&n?n(d.id,{pages:l}):o&&o("page_meta",{pages:l}),me.current&&me.current.emit("whiteboard-update",{roomId:e,type:"page-meta-update",payload:{pages:l}})},be=l=>{j(l),se(null),me.current&&me.current.emit("whiteboard-update",{roomId:e,type:"page-change",payload:{page:l}})},m=l=>{const d=Z.length,_={id:`page-${Date.now()}-${d}`,title:l||`P${d+1} · 备课页面`,order:d},I=[...Z,_];Y(I),j(d),ge(I),me.current&&me.current.emit("whiteboard-update",{roomId:e,type:"page-change",payload:{page:d}})},_e=(l,d)=>{if(!d.trim()){J(null);return}const _=Z.map((I,$)=>$===l?{...I,title:d.trim()}:I);Y(_),ge(_),J(null),A("")},we=l=>{const d=Z[l];if(!d)return;const _=l+1,I={id:`page-${Date.now()}-${_}`,title:`${d.title} (副本)`,order:_},$=[...Z.slice(0,_),I,...Z.slice(_).map(q=>({...q,order:q.order+1}))];Y($),j(_),ge($),k.filter(q=>q.type!=="page_meta"&&(()=>{try{const G=JSON.parse(q.data);return(G.page??0)===l||G.pageId===d.id}catch{return l===0}})()).forEach(q=>{try{const G=JSON.parse(q.data);o&&o(q.type,{...G,page:_,pageId:I.id,x:(G.x??100)+20,y:(G.y??100)+20})}catch(G){console.error("Failed duplicating page element:",G)}})},f=l=>{if(Z.length<=1){je({title:"无法删除",message:"至少需要保留一个白板页面!",type:"alert"});return}const d=Z[l],_=k.filter($=>$.type!=="page_meta"&&(()=>{try{const N=JSON.parse($.data);return(N.page??0)===l||N.pageId===d.id}catch{return l===0}})()),I=()=>{a&&_.forEach(q=>a(q.id));const $=Z.filter((q,G)=>G!==l).map((q,G)=>({...q,order:G}));Y($);const N=Math.min(v,$.length-1);j(N),ge($)};_.length>0?je({title:"确认删除白板页面",message:`页面 [${d.title}] 包含 ${_.length} 个组件,删除页面将同时清理该页面的组件,是否确定删除?`,type:"confirm",onConfirm:I}):I()},Ce=(l,d)=>{const _=d==="left"?l-1:l+1;if(_<0||_>=Z.length)return;const I=[...Z],$=I[l];I[l]=I[_],I[_]=$,I.forEach((N,q)=>{N.order=q}),Y(I),v===l?j(_):v===_&&j(l),ge(I)},[ie,le]=reactExports.useState(null),[D,W]=reactExports.useState(!1),ce=reactExports.useRef(null),[he,ve]=reactExports.useState({width:0,height:0}),ue=reactExports.useRef(null),[qe,de]=reactExports.useState(!1),me=reactExports.useRef(null),[Qe,We]=reactExports.useState({}),[ut,nt]=reactExports.useState({}),[at,pt]=reactExports.useState({}),[yt,kt]=reactExports.useState({}),[Ge,Ee]=reactExports.useState(null),[L,P]=reactExports.useState(null),V=reactExports.useRef(null),T=reactExports.useRef(null),ne=reactExports.useRef(null),[O,Re]=reactExports.useState(null),te=l=>{u==="teacher"&&Re(l)},[Pe,Fe]=reactExports.useState(null),ae=l=>{u==="teacher"&&Fe(l)},[ze,$e]=reactExports.useState(null),[Te,it]=reactExports.useState(null),Xe=reactExports.useRef(null),[Ct,je]=reactExports.useState(null),[bt,mt]=reactExports.useState(""),[ee,Ae]=reactExports.useState(null),[Ze,ct]=reactExports.useState({}),[Ke,rt]=reactExports.useState({}),[It,Nt]=reactExports.useState([]),[Yt,xt]=reactExports.useState(!1),[St,$t]=reactExports.useState([]),[jt,Pt]=reactExports.useState([]),[At,qt]=reactExports.useState(null),[Rt,gt]=reactExports.useState(!1),dt=async()=>{try{const l=await fetch("/api/courseware");if(l.ok){const d=await l.json();$t(d)}}catch(l){console.error("Error fetching coursewares:",l)}},st=async()=>{try{xt(!0);const l=await fetch("/api/resources");if(l.ok){const d=await l.json();Nt(d)}}catch(l){console.error("Error fetching system resources:",l)}finally{xt(!1)}};reactExports.useEffect(()=>{if(O){const l=k.find(d=>d.id===O);if(l){l.type==="html-applet"&&(st(),dt());try{Ae(JSON.parse(l.data))}catch{Ae({})}}else Ae(null)}else Ae(null)},[O,t]);const Ve=async l=>{const d=k.find(q=>q.id===O);if(!d)return;let _={};try{_=JSON.parse(d.data)}catch{}const I={..._,...l},$=d.data,N=JSON.stringify(I);if($!==N&&(ct(q=>{const G=q[d.id]?[...q[d.id]]:[];return G.length>=30&&G.shift(),G.push($),{...q,[d.id]:G}}),rt(q=>({...q,[d.id]:[]}))),n){de(!0);try{await n(d.id,I),frontendEventBus.publish({id:v7(),type:"whiteboard.element_updated",source:"whiteboard",payload:{lessonId:e},timestamp:Date.now(),correlationId:e}),c&&c()}catch(q){console.error("更新属性失败:",q)}finally{de(!1)}}},zt=async()=>{if(!O)return;const l=k.find(N=>N.id===O);if(!l)return;const d=Ze[O]||[];if(d.length===0)return;const _=d[d.length-1],I=d.slice(0,d.length-1),$=l.data;if(rt(N=>{const q=N[O]?[...N[O]]:[];return q.push($),{...N,[O]:q}}),ct(N=>({...N,[O]:I})),n){de(!0);try{const N=JSON.parse(_);Ae(N),await n(O,N),frontendEventBus.publish({id:v7(),type:"whiteboard.element_updated",source:"whiteboard",payload:{lessonId:e},timestamp:Date.now(),correlationId:e}),c&&c()}catch(N){console.error("撤销修改失败:",N)}finally{de(!1)}}},Et=async()=>{if(!O)return;const l=k.find(N=>N.id===O);if(!l)return;const d=Ke[O]||[];if(d.length===0)return;const _=d[d.length-1],I=d.slice(0,d.length-1),$=l.data;if(ct(N=>{const q=N[O]?[...N[O]]:[];return q.push($),{...N,[O]:q}}),rt(N=>({...N,[O]:I})),n){de(!0);try{const N=JSON.parse(_);Ae(N),await n(O,N),frontendEventBus.publish({id:v7(),type:"whiteboard.element_updated",source:"whiteboard",payload:{lessonId:e},timestamp:Date.now(),correlationId:e}),c&&c()}catch(N){console.error("重做修改失败:",N)}finally{de(!1)}}},fe=(l,d)=>{Ae(_=>_&&{..._,[l]:d})},Ie=(l,d)=>{Ve({[l]:d})},Oe=l=>{Ae(d=>d&&{...d,...l}),Ve(l)},Ue=(l,d)=>{const _=parseFloat(d);isNaN(_)||Ve({[l]:_})},Dt=(l,d)=>{Ae(_=>{if(!_)return _;const I=[..._.options||[]];return I[l]=d,{..._,options:I}})},Ht=(l,d)=>{if(!ee)return;const _=[...ee.options||[]];_[l]=d,Ve({options:_})},Bt=()=>{if(!ee)return;const l=ee.options||[],_="ABCDEFGHIJKLMNOPQRSTUVWXYZ"[l.length]||`Option ${l.length+1}`,I=[...l,`选项 ${_}`];Ae($=>$&&{...$,options:I}),Ve({options:I})},Ft=l=>{if(!ee)return;const d=(ee.options||[]).filter((_,I)=>I!==l);Ae(_=>_&&{..._,options:d}),Ve({options:d})};reactExports.useEffect(()=>{const l=()=>{ae(null)};return window.addEventListener("click",l),()=>window.removeEventListener("click",l)},[]);const Tt=l=>{try{const d=JSON.parse(l.data);if(l.type==="pen"&&d.points){let _=1/0,I=-1/0,$=1/0;for(let N=0;N<d.points.length;N+=2){const q=d.points[N],G=d.points[N+1];q<_&&(_=q),q>I&&(I=q),G<$&&($=G)}return{x:(_+I)/2,y:$-36}}else if(l.type==="rectangle"||l.type==="shape"&&d.shape==="rect"){const _=d.x??0,I=d.y??0,$=d.width??0,N=d.height??0;return{x:_+$/2,y:(N<0?I+N:I)-36}}else if(l.type==="circle"||l.type==="shape"&&d.shape==="circle"){const _=d.x??0,I=d.y??0,$=d.radius??0;return{x:_,y:I-$-36}}else if(l.type==="text"){const _=d.x??0,I=d.y??0;return{x:_+40,y:I-36}}else if(d.x!==void 0&&d.y!==void 0)return{x:d.x+(d.width?d.width/2:150),y:d.y-36}}catch(d){console.error(d)}return null},De=(l,d,_)=>{if(u!=="teacher")return;l.preventDefault();const I=_.x??0,$=_.y??0,N={id:d,currentX:I,currentY:$,startPointerX:l.clientX,startPointerY:l.clientY,data:_};V.current=N,P(N)},He=l=>{},Be=async l=>{},Ye=(l,d,_,I,$,N,q)=>{if(u!=="teacher")return;l.preventDefault(),l.stopPropagation();const G={id:d,corner:_,startX:l.clientX,startY:l.clientY,initialX:I,initialY:$,initialWidth:N,initialHeight:q},pe={id:d,x:I,y:$,width:N,height:q};T.current=G,ne.current=pe,$e(G),it(pe)},et=l=>{},ot=async l=>{};reactExports.useEffect(()=>{if(!L)return;const l=_=>{if(!V.current)return;const I=_.clientX-V.current.startPointerX,$=_.clientY-V.current.startPointerY,N=V.current.data.x??0,q=V.current.data.y??0;V.current.currentX=N+I,V.current.currentY=q+$,P({...V.current})},d=async _=>{if(!V.current)return;const I=V.current.currentX,$=V.current.currentY,N=V.current.id,q=V.current.data;if(V.current=null,P(null),n){de(!0);try{await n(N,{...q,x:I,y:$}),frontendEventBus.publish({id:v7(),type:"whiteboard.element_updated",source:"whiteboard",payload:{lessonId:e},timestamp:Date.now(),correlationId:e})}catch(G){console.error("Drag end update error:",G)}finally{de(!1)}}};return window.addEventListener("pointermove",l),window.addEventListener("pointerup",d),()=>{window.removeEventListener("pointermove",l),window.removeEventListener("pointerup",d)}},[L,n,e]),reactExports.useEffect(()=>{if(!ze||!Te)return;const l=_=>{if(!T.current||!ne.current)return;const I=_.clientX-T.current.startX,$=_.clientY-T.current.startY;let N=T.current.initialX,q=T.current.initialY,G=T.current.initialWidth,pe=T.current.initialHeight;const ke=150,Le=100,{corner:Me}=T.current;if(Me==="bottom-right")G=Math.max(ke,T.current.initialWidth+I),pe=Math.max(Le,T.current.initialHeight+$);else if(Me==="bottom-left"){const M=T.current.initialWidth-I;M>=ke&&(G=M,N=T.current.initialX+I),pe=Math.max(Le,T.current.initialHeight+$)}else if(Me==="top-right"){G=Math.max(ke,T.current.initialWidth+I);const M=T.current.initialHeight-$;M>=Le&&(pe=M,q=T.current.initialY+$)}else if(Me==="top-left"){const M=T.current.initialWidth-I;M>=ke&&(G=M,N=T.current.initialX+I);const B=T.current.initialHeight-$;B>=Le&&(pe=B,q=T.current.initialY+$)}ne.current={id:T.current.id,x:N,y:q,width:G,height:pe},it({...ne.current})},d=async _=>{if(!T.current||!ne.current)return;const{id:I}=T.current,{x:$,y:N,width:q,height:G}=ne.current;T.current=null,ne.current=null,$e(null),it(null);const pe=k.find(ke=>ke.id===I);if(pe&&n)try{const ke=JSON.parse(pe.data);de(!0),await n(I,{...ke,x:$,y:N,width:q,height:G}),frontendEventBus.publish({id:v7(),type:"whiteboard.element_updated",source:"whiteboard",payload:{lessonId:e},timestamp:Date.now(),correlationId:e})}catch(ke){console.error("Resize end update error:",ke)}finally{de(!1)}};return window.addEventListener("pointermove",l),window.addEventListener("pointerup",d),()=>{window.removeEventListener("pointermove",l),window.removeEventListener("pointerup",d)}},[ze,Te,t,n,e]);const Ne=l=>{je({type:"confirm",title:"删除组件",message:"您确定要从白板中删除这个组件或图形吗?该操作不可撤销。",onConfirm:async()=>{de(!0);try{a?await a(l):await fetch(`/api/lessons/${e}/whiteboard/${l}`,{method:"DELETE"}),frontendEventBus.publish({id:v7(),type:"whiteboard.element_updated",source:"whiteboard",payload:{lessonId:e},timestamp:Date.now(),correlationId:e}),c&&c(),te(null)}catch(d){console.error("Delete element failed:",d)}finally{de(!1),je(null)}}})},Vt=()=>{je({type:"confirm",title:"清空白板",message:"您确定要清空画布上的所有组件、图形和线条吗?此操作将永久清空白板且不可逆!",onConfirm:async()=>{de(!0);try{i?await i():await fetch(`/api/lessons/${e}/whiteboard`,{method:"DELETE"}),frontendEventBus.publish({id:v7(),type:"whiteboard.element_updated",source:"whiteboard",payload:{lessonId:e},timestamp:Date.now(),correlationId:e}),c&&c(),te(null)}catch(l){console.error("Clear board failed:",l)}finally{de(!1),je(null)}}})},Ot=()=>{je({type:"confirm",title:"重置白板",message:"您确定要将白板重置为开始上课的状态吗?您在白板上做的所有临时修改都将被重置。",onConfirm:async()=>{de(!0);try{await fetch(`/api/lessons/${e}/whiteboard/reset`,{method:"POST"}),frontendEventBus.publish({id:v7(),type:"whiteboard.element_updated",source:"whiteboard",payload:{lessonId:e},timestamp:Date.now(),correlationId:e}),c&&c(),te(null)}catch(l){console.error("Reset board failed:",l)}finally{de(!1),je(null)}}})};reactExports.useEffect(()=>{const l=d=>{if((d.key==="Delete"||d.key==="Backspace")&&O){const _=d.target;_.tagName!=="INPUT"&&_.tagName!=="TEXTAREA"&&(Ne(O),te(null))}};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[O]);const ft=()=>{Xe.current&&clearTimeout(Xe.current),r&&(Xe.current=setTimeout(async()=>{de(!0);try{(await fetch(`/api/lessons/${e}/ai-tutor`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({elements:k.map(d=>({type:d.type,data:JSON.parse(d.data)}))})})).ok&&(frontendEventBus.publish({id:v7(),type:"whiteboard.element_updated",source:"whiteboard",payload:{lessonId:e},timestamp:Date.now(),correlationId:e}),c&&c())}catch(l){console.error(l)}finally{de(!1)}},6e4))};reactExports.useEffect(()=>(ft(),()=>{Xe.current&&clearTimeout(Xe.current)}),[t]),reactExports.useEffect(()=>{const l=getSocketInstance();me.current=l,l.emit("join-room",e);const d=_=>{_.type==="temp-draw"?We(I=>({...I,[_.userId]:_.payload})):_.type==="temp-end"?We(I=>{const $={...I};return delete $[_.userId],$}):_.type==="refresh"?c&&c():_.type==="segment-change"?h&&_.payload?.segmentId&&h(_.payload.segmentId):_.type==="page-change"?typeof _.payload?.page=="number"&&j(_.payload.page):_.type==="page-meta-update"&&Array.isArray(_.payload?.pages)&&Y(_.payload.pages)};return me.current.on("whiteboard-sync",d),()=>{me.current?.off("whiteboard-sync",d)}},[e,c,h]),reactExports.useEffect(()=>{if(!ue.current)return;const l=new ResizeObserver(_=>{for(let I of _)ue.current&&ve({width:ue.current.offsetWidth,height:ue.current.offsetHeight})});l.observe(ue.current);const d=()=>{ue.current&&ve({width:ue.current.offsetWidth,height:ue.current.offsetHeight})};return d(),window.addEventListener("resize",d),()=>{l.disconnect(),window.removeEventListener("resize",d)}},[]);const Ut=l=>{if(ft(),ae(null),w==="cursor"){l.target===l.target.getStage()&&te(null);return}if(qe)return;W(!0);const d=l.target.getStage().getPointerPosition();w==="pen"?le({type:"pen",points:[d.x,d.y],color:"black"}):w==="highlighter"?le({type:"highlighter",points:[d.x,d.y],color:R}):w==="rect"?le({type:"rectangle",x:d.x,y:d.y,width:0,height:0,stroke:"blue"}):w==="circle"?le({type:"circle",x:d.x,y:d.y,radius:0,stroke:"green"}):w==="text"&&le({type:"text",x:d.x,y:d.y,text:"Click to edit...",fontSize:16,color:"black"})},Wt=l=>{if(!D||!ie)return;const d=l.target.getStage().getPointerPosition();if(ie.type==="pen"||ie.type==="highlighter")le({...ie,points:ie.points.concat([d.x,d.y])});else if(ie.type==="rectangle")le({...ie,width:d.x-ie.x,height:d.y-ie.y});else if(ie.type==="circle"){const _=Math.sqrt(Math.pow(d.x-ie.x,2)+Math.pow(d.y-ie.y,2));le({...ie,radius:_})}},Gt=async()=>{if(!D||!ie)return;W(!1);const l={...ie,page:v,segmentId:s};le(null),de(!0);try{await o(l.type,l),frontendEventBus.publish({id:v7(),type:"whiteboard.element_updated",source:"whiteboard",payload:{lessonId:e},timestamp:Date.now(),correlationId:e})}finally{de(!1)}};reactExports.useEffect(()=>{!me.current||!me.current.id||(ie?me.current.emit("whiteboard-update",{roomId:e,type:"temp-draw",userId:me.current.id,payload:{...ie,page:v,segmentId:s}}):me.current.emit("whiteboard-update",{roomId:e,type:"temp-end",userId:me.current.id}))},[ie,e,v,s]),reactExports.useEffect(()=>{s&&me.current&&me.current.emit("whiteboard-update",{roomId:e,type:"segment-change",payload:{segmentId:s}})},[s,e]);const _t=l=>{if(!l)return null;const d=l.page??0,_=Z[v];return!(l.pageId&&_?.id?l.pageId===_.id:d===v)||s&&l.segmentId&&l.segmentId!==s?null:l.type==="pen"?jsxRuntimeExports.jsx(Line,{points:l.points,stroke:l.color,strokeWidth:4,tension:.5,lineCap:"round",lineJoin:"round"}):l.type==="highlighter"?jsxRuntimeExports.jsx(Line,{points:l.points,stroke:l.color||"#facc15",strokeWidth:18,tension:.5,lineCap:"round",lineJoin:"round",opacity:.5}):l.type==="rectangle"?jsxRuntimeExports.jsx(Rect,{x:l.x,y:l.y,width:l.width,height:l.height,stroke:l.stroke}):l.type==="circle"?jsxRuntimeExports.jsx(Circle$1,{x:l.x,y:l.y,radius:l.radius,stroke:l.stroke}):l.type==="text"?jsxRuntimeExports.jsx(Text,{x:l.x,y:l.y,text:l.text,fontSize:l.fontSize,fill:l.color}):null},Xt=()=>_t(ie?{...ie,page:v,segmentId:s}:null),Zt=()=>Object.values(Qe).map((l,d)=>jsxRuntimeExports.jsx(React.Fragment,{children:_t(l)},d)),Kt=l=>{try{const d=JSON.parse(l.data),_=L?.id===l.id,I=Te?.id===l.id,$=I?Te.x:_?L.currentX:d.x??0,N=I?Te.y:_?L.currentY:d.y??0,q=M=>M==="plugin"?d.width||500:M==="hello-world"?160:M==="quiz"?300:M==="rollcall"?320:M==="assignment"?310:M==="html-applet"||M==="code-sandbox"||M==="math-graph"?400:M==="presentation"?600:300,G=M=>M==="plugin"?d.height||400:M==="hello-world"?64:M==="quiz"?280:M==="rollcall"?310:M==="assignment"?250:M==="html-applet"?300:M==="code-sandbox"?320:M==="math-graph"?350:M==="presentation"?400:300,pe=I?Te.width:d.width??q(l.type),ke=I?Te.height:d.isMinimized?32:d.height??G(l.type),Le=O===l.id,Me=()=>Le?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{className:"absolute -inset-1 border-2 border-indigo-500 rounded-lg pointer-events-none z-50 shadow-md animate-pulse duration-1000 animate-in fade-in"}),jsxRuntimeExports.jsx("div",{className:"absolute -top-1.5 -left-1.5 w-3.5 h-3.5 bg-white border-2 border-indigo-600 rounded-full cursor-nwse-resize z-50 hover:bg-indigo-50 hover:scale-110 transition-transform shadow",onPointerDown:M=>Ye(M,l.id,"top-left",$,N,pe,ke),onPointerMove:et,onPointerUp:ot}),jsxRuntimeExports.jsx("div",{className:"absolute -top-1.5 -right-1.5 w-3.5 h-3.5 bg-white border-2 border-indigo-600 rounded-full cursor-nesw-resize z-50 hover:bg-indigo-50 hover:scale-110 transition-transform shadow",onPointerDown:M=>Ye(M,l.id,"top-right",$,N,pe,ke),onPointerMove:et,onPointerUp:ot}),jsxRuntimeExports.jsx("div",{className:"absolute -bottom-1.5 -left-1.5 w-3.5 h-3.5 bg-white border-2 border-indigo-600 rounded-full cursor-nesw-resize z-50 hover:bg-indigo-50 hover:scale-110 transition-transform shadow",onPointerDown:M=>Ye(M,l.id,"bottom-left",$,N,pe,ke),onPointerMove:et,onPointerUp:ot}),jsxRuntimeExports.jsx("div",{className:"absolute -bottom-1.5 -right-1.5 w-3.5 h-3.5 bg-white border-2 border-indigo-600 rounded-full cursor-nwse-resize z-50 hover:bg-indigo-50 hover:scale-110 transition-transform shadow",onPointerDown:M=>Ye(M,l.id,"bottom-right",$,N,pe,ke),onPointerMove:et,onPointerUp:ot})]}):null;if(l.type==="plugin"){const M=u==="teacher",B=M?d.teacherWidgetId:d.studentWidgetId,ye=M?"teacher.dashboard.widget":"student.view";return jsxRuntimeExports.jsx(Group$1,{children:jsxRuntimeExports.jsx(Html,{divProps:{style:{position:"absolute",top:`${N}px`,left:`${$}px`,pointerEvents:"none",zIndex:Le?20:10}},children:jsxRuntimeExports.jsxs("div",{onPointerDown:xe=>{te(l.id),xe.stopPropagation()},onContextMenu:xe=>{xe.preventDefault(),xe.stopPropagation();const Se=ue.current?.getBoundingClientRect();Se&&ae({x:xe.clientX-Se.left,y:xe.clientY-Se.top,elementId:l.id})},className:"bg-white border border-gray-300 rounded-lg shadow-xl overflow-hidden flex flex-col font-sans text-sm relative",style:{pointerEvents:"auto",width:`${pe}px`,height:`${ke}px`},children:[jsxRuntimeExports.jsxs("div",{className:"bg-indigo-50 text-indigo-750 px-3 py-1.5 flex justify-between items-center text-xs font-semibold border-b border-indigo-150 cursor-move select-none shrink-0",onPointerDown:xe=>De(xe,l.id,d),onPointerMove:He,onPointerUp:Be,children:[jsxRuntimeExports.jsx("span",{children:d.title||"Plugin Component"}),jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntimeExports.jsx("button",{onClick:()=>Ee(l.id),onPointerDown:xe=>xe.stopPropagation(),className:"p-1 hover:bg-slate-200/50 rounded-full text-indigo-650 hover:text-indigo-900 transition-colors cursor-pointer flex items-center justify-center",title:"全屏",children:jsxRuntimeExports.jsx(Maximize2,{size:11})}),jsxRuntimeExports.jsx("button",{onClick:()=>Ne(l.id),onPointerDown:xe=>xe.stopPropagation(),className:"p-1 hover:bg-slate-200/50 rounded-full text-indigo-600 hover:text-red-500 transition-colors cursor-pointer flex items-center justify-center",title:"删除组件",children:jsxRuntimeExports.jsx(Trash2,{size:11})})]})]}),!d.isMinimized&&jsxRuntimeExports.jsx("div",{className:"flex-grow bg-white overflow-auto relative min-h-0 p-2",children:jsxRuntimeExports.jsx(PluginCardRenderer,{pluginId:d.pluginId,slot:ye,widgetId:B,elementId:l.id,lessonId:e})}),!d.isMinimized&&Me()]})})},l.id)}if(l.type==="hello-world")return jsxRuntimeExports.jsx(Group$1,{children:jsxRuntimeExports.jsx(Html,{divProps:{style:{position:"absolute",top:`${N}px`,left:`${$}px`,pointerEvents:"none",zIndex:Le?20:10}},children:jsxRuntimeExports.jsxs("div",{onPointerDown:M=>{te(l.id),M.stopPropagation()},className:"bg-transparent",style:{pointerEvents:"auto",width:`${pe}px`,height:`${ke}px`},children:[jsxRuntimeExports.jsx(HelloWorldWrapper,{elementId:l.id,data:d,onPointerDown:M=>De(M,l.id,d),onPointerMove:He,onPointerUp:Be,onDelete:()=>Ne(l.id),onElementUpdate:n,lessonId:e}),Me()]})})},l.id);if(l.type==="rollcall")return jsxRuntimeExports.jsx(Group$1,{children:jsxRuntimeExports.jsx(Html,{divProps:{style:{position:"absolute",top:`${N}px`,left:`${$}px`,pointerEvents:"none",zIndex:Le?20:10}},children:jsxRuntimeExports.jsxs("div",{onPointerDown:M=>{te(l.id),M.stopPropagation()},onContextMenu:M=>{M.preventDefault(),M.stopPropagation();const B=ue.current?.getBoundingClientRect();B&&ae({x:M.clientX-B.left,y:M.clientY-B.top,elementId:l.id})},className:"bg-transparent",style:{pointerEvents:"auto",width:`${pe}px`,height:`${ke}px`},children:[jsxRuntimeExports.jsx(RollCallWrapper,{elementId:l.id,data:d,onElementUpdate:n,onPointerDown:M=>De(M,l.id,d),onPointerMove:He,onPointerUp:Be,onDelete:()=>Ne(l.id)}),Me()]})})},l.id);if(l.type==="quiz")return null;if(l.type==="assignment")return jsxRuntimeExports.jsx(Group$1,{children:jsxRuntimeExports.jsx(Html,{divProps:{style:{position:"absolute",top:`${N}px`,left:`${$}px`,pointerEvents:"none",zIndex:Le?20:10}},children:jsxRuntimeExports.jsxs("div",{onPointerDown:M=>{te(l.id),M.stopPropagation()},onContextMenu:M=>{M.preventDefault(),M.stopPropagation();const B=ue.current?.getBoundingClientRect();B&&ae({x:M.clientX-B.left,y:M.clientY-B.top,elementId:l.id})},className:"bg-white border border-gray-300 rounded-lg shadow-xl overflow-hidden flex flex-col font-sans text-sm relative select-none",style:{pointerEvents:"auto",width:`${pe}px`,height:`${ke}px`},children:[jsxRuntimeExports.jsxs("div",{className:"bg-orange-50 text-orange-700 px-3 py-1.5 flex justify-between items-center text-xs font-semibold border-b border-orange-100 cursor-move select-none shrink-0",onPointerDown:M=>De(M,l.id,d),onPointerMove:He,onPointerUp:Be,children:[jsxRuntimeExports.jsx("span",{children:"Assignment Upload Task"}),jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntimeExports.jsx("button",{onClick:()=>Ee(l.id),onPointerDown:M=>M.stopPropagation(),className:"p-1 hover:bg-slate-200/50 rounded-full text-orange-600 hover:text-orange-900 transition-colors cursor-pointer flex items-center justify-center",title:"全屏",children:jsxRuntimeExports.jsx(Maximize2,{size:11})}),jsxRuntimeExports.jsx("button",{onClick:async()=>{n&&(await n(l.id,{...d,isMinimized:!d.isMinimized}),frontendEventBus.publish({id:v7(),type:"whiteboard.element_updated",source:"whiteboard",payload:{lessonId:e},timestamp:Date.now(),correlationId:e}))},onPointerDown:M=>M.stopPropagation(),className:"p-1 hover:bg-slate-200/50 rounded-full text-orange-655 hover:text-orange-900 transition-colors cursor-pointer flex items-center justify-center",title:d.isMinimized?"展开组件":"收起组件",children:d.isMinimized?jsxRuntimeExports.jsx(Maximize2,{size:11}):jsxRuntimeExports.jsx(Minimize2,{size:11})}),jsxRuntimeExports.jsx("button",{onClick:()=>Ne(l.id),onPointerDown:M=>M.stopPropagation(),className:"p-1 hover:bg-slate-200/50 rounded-full text-orange-600 hover:text-red-500 transition-colors cursor-pointer flex items-center justify-center",title:"删除组件",children:jsxRuntimeExports.jsx(Trash2,{size:11})})]})]}),!d.isMinimized&&jsxRuntimeExports.jsxs("div",{className:"p-4 text-center flex-1 overflow-y-auto flex flex-col justify-center min-h-0",children:[jsxRuntimeExports.jsx("p",{className:"font-semibold text-gray-800 mb-1 text-xs",children:d.title}),jsxRuntimeExports.jsx("p",{className:"text-xs text-gray-500 mb-3 line-clamp-3",children:d.description}),jsxRuntimeExports.jsx("button",{className:"w-full bg-orange-600 hover:bg-orange-700 text-white font-medium py-1.5 rounded transition-colors text-xs shadow-sm cursor-pointer",onClick:()=>{je({type:"alert",title:"作业文件上传",message:`系统已经成功模拟拉起本地文件选择和上传流程!
8310
- 已准备上传作业: ${d.title??"白板作业"}`,onConfirm:()=>je(null)})},children:"Upload File"})]}),!d.isMinimized&&Me()]})})},l.id);if(l.type==="html-applet")return jsxRuntimeExports.jsx(Group$1,{children:jsxRuntimeExports.jsx(Html,{divProps:{style:{position:"absolute",top:`${N}px`,left:`${$}px`,pointerEvents:"none",zIndex:Le?20:10}},children:jsxRuntimeExports.jsxs("div",{onPointerDown:M=>{te(l.id),M.stopPropagation()},onContextMenu:M=>{M.preventDefault(),M.stopPropagation();const B=ue.current?.getBoundingClientRect();B&&ae({x:M.clientX-B.left,y:M.clientY-B.top,elementId:l.id})},className:"bg-white border border-gray-300 rounded-lg shadow-xl overflow-hidden flex flex-col font-sans text-sm relative",style:{pointerEvents:"auto",width:`${pe}px`,height:`${ke}px`},children:[jsxRuntimeExports.jsxs("div",{className:"bg-gray-100 text-gray-700 px-3 py-1.5 flex justify-between items-center text-xs font-semibold border-b border-gray-200 cursor-move select-none shrink-0",onPointerDown:M=>De(M,l.id,d),onPointerMove:He,onPointerUp:Be,children:[jsxRuntimeExports.jsx("span",{children:"Interactive Courseware"}),jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntimeExports.jsx("button",{onClick:()=>Ee(l.id),onPointerDown:M=>M.stopPropagation(),className:"p-1 hover:bg-slate-200/50 rounded-full text-gray-600 hover:text-gray-900 transition-colors cursor-pointer flex items-center justify-center",title:"全屏",children:jsxRuntimeExports.jsx(Maximize2,{size:11})}),jsxRuntimeExports.jsx("button",{onClick:async()=>{n&&(await n(l.id,{...d,isMinimized:!d.isMinimized}),frontendEventBus.publish({id:v7(),type:"whiteboard.element_updated",source:"whiteboard",payload:{lessonId:e},timestamp:Date.now(),correlationId:e}))},onPointerDown:M=>M.stopPropagation(),className:"p-1 hover:bg-slate-200/50 rounded-full text-gray-650 hover:text-gray-900 transition-colors cursor-pointer flex items-center justify-center",title:d.isMinimized?"展开组件":"收起组件",children:d.isMinimized?jsxRuntimeExports.jsx(Maximize2,{size:11}):jsxRuntimeExports.jsx(Minimize2,{size:11})}),jsxRuntimeExports.jsx("button",{onClick:()=>Ne(l.id),onPointerDown:M=>M.stopPropagation(),className:"p-1 hover:bg-slate-200/50 rounded-full text-gray-650 hover:text-red-500 transition-colors cursor-pointer flex items-center justify-center",title:"删除组件",children:jsxRuntimeExports.jsx(Trash2,{size:11})})]})]}),!d.isMinimized&&jsxRuntimeExports.jsx("div",{className:"flex-1 bg-white overflow-hidden relative min-h-0",children:jsxRuntimeExports.jsx("iframe",{className:"w-full h-full border-none",src:d.coursewareUuid?`/runtime/${d.coursewareUuid}/`:d.resourceId?`/api/resources/${d.resourceId}/`:void 0,srcDoc:d.coursewareUuid||d.resourceId?void 0:wrapSrcDocWithBridge(d.code,e),sandbox:"allow-scripts allow-forms allow-downloads"})}),!d.isMinimized&&Me()]})})},l.id);if(l.type==="pen"){const M=O===l.id;return jsxRuntimeExports.jsx(Line,{id:l.id,points:d.points,stroke:M?"#3b82f6":d.color||"black",strokeWidth:M?6:4,tension:.5,lineCap:"round",lineJoin:"round",draggable:u==="teacher"&&w==="cursor",onClick:B=>{w==="cursor"&&(B.cancelBubble=!0,te(M?null:l.id))},onTap:B=>{w==="cursor"&&(B.cancelBubble=!0,te(M?null:l.id))},onDragEnd:async B=>{const ye=B.target,xe=ye.x(),Se=ye.y();ye.x(0),ye.y(0);const lt=d.points.map((Je,ht)=>ht%2===0?Je+xe:Je+Se);n&&(await n(l.id,{...d,points:lt}),frontendEventBus.publish({id:v7(),type:"whiteboard.element_updated",source:"whiteboard",payload:{lessonId:e},timestamp:Date.now(),correlationId:e}))}},l.id)}if(l.type==="highlighter"){const M=O===l.id;return jsxRuntimeExports.jsx(Line,{id:l.id,points:d.points,stroke:M?"#3b82f6":d.color||"#facc15",strokeWidth:M?24:18,tension:.5,lineCap:"round",lineJoin:"round",opacity:.5,draggable:u==="teacher"&&w==="cursor",onClick:B=>{w==="cursor"&&(B.cancelBubble=!0,te(M?null:l.id))},onTap:B=>{w==="cursor"&&(B.cancelBubble=!0,te(M?null:l.id))},onDragEnd:async B=>{const ye=B.target,xe=ye.x(),Se=ye.y();ye.x(0),ye.y(0);const lt=d.points.map((Je,ht)=>ht%2===0?Je+xe:Je+Se);n&&(await n(l.id,{...d,points:lt}),frontendEventBus.publish({id:v7(),type:"whiteboard.element_updated",source:"whiteboard",payload:{lessonId:e},timestamp:Date.now(),correlationId:e}))}},l.id)}if(l.type==="rectangle"||l.type==="shape"&&d.shape==="rect"){const M=O===l.id;return jsxRuntimeExports.jsx(Rect,{id:l.id,x:d.x,y:d.y,width:d.width,height:d.height,fill:d.fill||"transparent",stroke:M?"#3b82f6":d.stroke||"blue",strokeWidth:M?3:1,draggable:u==="teacher"&&w==="cursor",onClick:B=>{w==="cursor"&&(B.cancelBubble=!0,te(M?null:l.id))},onTap:B=>{w==="cursor"&&(B.cancelBubble=!0,te(M?null:l.id))},onDragEnd:async B=>{const ye=B.target,xe=ye.x(),Se=ye.y();ye.x(0),ye.y(0),n&&(await n(l.id,{...d,x:d.x+xe,y:d.y+Se}),frontendEventBus.publish({id:v7(),type:"whiteboard.element_updated",source:"whiteboard",payload:{lessonId:e},timestamp:Date.now(),correlationId:e}))}},l.id)}if(l.type==="circle"||l.type==="shape"&&d.shape==="circle"){const M=O===l.id;return jsxRuntimeExports.jsx(Circle$1,{id:l.id,x:d.x,y:d.y,radius:d.radius,fill:d.fill||"transparent",stroke:M?"#3b82f6":d.stroke||"green",strokeWidth:M?3:1,draggable:u==="teacher"&&w==="cursor",onClick:B=>{w==="cursor"&&(B.cancelBubble=!0,te(M?null:l.id))},onTap:B=>{w==="cursor"&&(B.cancelBubble=!0,te(M?null:l.id))},onDragEnd:async B=>{const ye=B.target,xe=ye.x(),Se=ye.y();ye.x(0),ye.y(0),n&&(await n(l.id,{...d,x:d.x+xe,y:d.y+Se}),frontendEventBus.publish({id:v7(),type:"whiteboard.element_updated",source:"whiteboard",payload:{lessonId:e},timestamp:Date.now(),correlationId:e}))}},l.id)}if(l.type==="text"){const M=O===l.id;return jsxRuntimeExports.jsx(Text,{id:l.id,x:d.x,y:d.y,text:d.text,fontSize:d.fontSize||16,fill:M?"#3b82f6":d.color||"black",fontStyle:M?"bold":"normal",draggable:u==="teacher"&&w==="cursor",onClick:B=>{w==="cursor"&&(B.cancelBubble=!0,te(M?null:l.id))},onTap:B=>{w==="cursor"&&(B.cancelBubble=!0,te(M?null:l.id))},onDragEnd:async B=>{const ye=B.target,xe=ye.x(),Se=ye.y();ye.x(0),ye.y(0),n&&(await n(l.id,{...d,x:d.x+xe,y:d.y+Se}),frontendEventBus.publish({id:v7(),type:"whiteboard.element_updated",source:"whiteboard",payload:{lessonId:e},timestamp:Date.now(),correlationId:e}))}},l.id)}if(l.type==="code-sandbox")return jsxRuntimeExports.jsx(Group$1,{children:jsxRuntimeExports.jsx(Html,{divProps:{style:{position:"absolute",top:`${N}px`,left:`${$}px`,pointerEvents:"none",zIndex:Le?20:10}},children:jsxRuntimeExports.jsxs("div",{onPointerDown:M=>{te(l.id),M.stopPropagation()},onContextMenu:M=>{M.preventDefault(),M.stopPropagation();const B=ue.current?.getBoundingClientRect();B&&ae({x:M.clientX-B.left,y:M.clientY-B.top,elementId:l.id})},className:"relative rounded-lg shadow-xl",style:{pointerEvents:"auto",width:`${pe}px`,height:`${ke}px`},children:[jsxRuntimeExports.jsx(CodeSandboxWrapper,{elementId:l.id,data:d,onElementUpdate:n?async(M,B)=>{await n(M,B),frontendEventBus.publish({id:v7(),type:"whiteboard.element_updated",source:"whiteboard",payload:{lessonId:e},timestamp:Date.now(),correlationId:e})}:void 0,onPointerDown:M=>De(M,l.id,d),onPointerMove:He,onPointerUp:Be,onDelete:()=>Ne(l.id)}),Me()]})})},l.id);if(l.type==="math-graph")return jsxRuntimeExports.jsx(Group$1,{children:jsxRuntimeExports.jsx(Html,{divProps:{style:{position:"absolute",top:`${N}px`,left:`${$}px`,pointerEvents:"none",zIndex:Le?20:10}},children:jsxRuntimeExports.jsxs("div",{onPointerDown:M=>{te(l.id),M.stopPropagation()},onContextMenu:M=>{M.preventDefault(),M.stopPropagation();const B=ue.current?.getBoundingClientRect();B&&ae({x:M.clientX-B.left,y:M.clientY-B.top,elementId:l.id})},className:"relative rounded-lg shadow-xl",style:{pointerEvents:"auto",width:`${pe}px`,height:`${ke}px`},children:[jsxRuntimeExports.jsx(MathGraphWrapper,{elementId:l.id,data:d,onElementUpdate:n?async(M,B)=>{await n(M,B),frontendEventBus.publish({id:v7(),type:"whiteboard.element_updated",source:"whiteboard",payload:{lessonId:e},timestamp:Date.now(),correlationId:e})}:void 0,onPointerDown:M=>De(M,l.id,d),onPointerMove:He,onPointerUp:Be,onDelete:()=>Ne(l.id)}),Me()]})})},l.id);if(l.type==="presentation")return jsxRuntimeExports.jsx(Group$1,{children:jsxRuntimeExports.jsx(Html,{divProps:{style:{position:"absolute",top:`${N}px`,left:`${$}px`,pointerEvents:"none",zIndex:Le?20:10}},children:jsxRuntimeExports.jsxs("div",{onPointerDown:M=>{te(l.id),M.stopPropagation()},onContextMenu:M=>{M.preventDefault(),M.stopPropagation();const B=ue.current?.getBoundingClientRect();B&&ae({x:M.clientX-B.left,y:M.clientY-B.top,elementId:l.id})},className:"bg-white border border-gray-305 rounded-lg shadow-xl overflow-hidden flex flex-col font-sans text-sm relative select-none",style:{pointerEvents:"auto",width:`${pe}px`,height:`${ke}px`},children:[jsxRuntimeExports.jsxs("div",{className:"bg-purple-100 text-purple-700 px-3 py-1.5 flex justify-between items-center text-xs font-semibold border-b border-purple-200 cursor-move shrink-0",onPointerDown:M=>De(M,l.id,d),onPointerMove:He,onPointerUp:Be,children:[jsxRuntimeExports.jsx("span",{children:"Interactive Presentation"}),jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntimeExports.jsx("button",{onClick:()=>Ee(l.id),onPointerDown:M=>M.stopPropagation(),className:"p-1 hover:bg-slate-200/50 rounded-full text-purple-600 hover:text-purple-900 transition-colors cursor-pointer flex items-center justify-center",title:"全屏",children:jsxRuntimeExports.jsx(Maximize2,{size:11})}),jsxRuntimeExports.jsx("button",{onClick:async()=>{n&&(await n(l.id,{...d,isMinimized:!d.isMinimized}),frontendEventBus.publish({id:v7(),type:"whiteboard.element_updated",source:"whiteboard",payload:{lessonId:e},timestamp:Date.now(),correlationId:e}))},onPointerDown:M=>M.stopPropagation(),className:"p-1 hover:bg-slate-200/50 rounded-full text-purple-650 hover:text-purple-900 transition-colors cursor-pointer flex items-center justify-center",title:d.isMinimized?"展开组件":"收起组件",children:d.isMinimized?jsxRuntimeExports.jsx(Maximize2,{size:11}):jsxRuntimeExports.jsx(Minimize2,{size:11})}),jsxRuntimeExports.jsx("button",{onClick:()=>Ne(l.id),onPointerDown:M=>M.stopPropagation(),className:"p-1 hover:bg-slate-200/50 rounded-full text-purple-600 hover:text-red-500 transition-colors cursor-pointer flex items-center justify-center",title:"删除组件",children:jsxRuntimeExports.jsx(Trash2,{size:11})})]})]}),!d.isMinimized&&jsxRuntimeExports.jsx("div",{className:"flex-1 min-h-0 relative bg-white",style:{pointerEvents:"auto"},children:jsxRuntimeExports.jsx(RevealPresentationWrapper,{elementId:l.id,data:d,userRole:u,onElementUpdate:n?async(M,B)=>{await n(M,B),frontendEventBus.publish({id:v7(),type:"whiteboard.element_updated",source:"whiteboard",payload:{lessonId:e},timestamp:Date.now(),correlationId:e})}:void 0})}),!d.isMinimized&&Me()]})})},l.id)}catch(d){console.error(d)}return null},Mt=l=>{l.preventDefault(),l.dataTransfer.dropEffect="copy",b||K(!0)},Lt=l=>{l.preventDefault(),l.dataTransfer.dropEffect="copy",K(!0)},Jt=l=>{l.preventDefault(),l.currentTarget.contains(l.relatedTarget)||K(!1)},wt=(l,d,_,I)=>{const $={x:_,y:I,page:v,segmentId:s};switch(l){case"code-sandbox":return{...$,code:d.code??"console.log('Hello Sandbox!');"};case"math-graph":return{...$,equation:d.equation??"Math.sin(x)"};case"presentation":return{...$,markdown:d.markdown??`# Title Slide
8341
+ 已准备上传作业: ${d.title??"白板作业"}`,onConfirm:()=>je(null)})},children:"Upload File"})]}),!d.isMinimized&&Me()]})})},l.id);if(l.type==="html-applet")return jsxRuntimeExports.jsx(Group$1,{children:jsxRuntimeExports.jsx(Html,{divProps:{style:{position:"absolute",top:`${N}px`,left:`${$}px`,pointerEvents:"none",zIndex:Le?20:10}},children:jsxRuntimeExports.jsxs("div",{onPointerDown:M=>{te(l.id),M.stopPropagation()},onContextMenu:M=>{M.preventDefault(),M.stopPropagation();const B=ue.current?.getBoundingClientRect();B&&ae({x:M.clientX-B.left,y:M.clientY-B.top,elementId:l.id})},className:"bg-white border border-gray-300 rounded-lg shadow-xl overflow-hidden flex flex-col font-sans text-sm relative",style:{pointerEvents:"auto",width:`${pe}px`,height:`${ke}px`},children:[jsxRuntimeExports.jsxs("div",{className:"bg-gray-100 text-gray-700 px-3 py-1.5 flex justify-between items-center text-xs font-semibold border-b border-gray-200 cursor-move select-none shrink-0",onPointerDown:M=>De(M,l.id,d),onPointerMove:He,onPointerUp:Be,children:[jsxRuntimeExports.jsx("span",{children:"Interactive Courseware"}),jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntimeExports.jsx("button",{onClick:()=>Ee(l.id),onPointerDown:M=>M.stopPropagation(),className:"p-1 hover:bg-slate-200/50 rounded-full text-gray-600 hover:text-gray-900 transition-colors cursor-pointer flex items-center justify-center",title:"全屏",children:jsxRuntimeExports.jsx(Maximize2,{size:11})}),jsxRuntimeExports.jsx("button",{onClick:async()=>{n&&(await n(l.id,{...d,isMinimized:!d.isMinimized}),frontendEventBus.publish({id:v7(),type:"whiteboard.element_updated",source:"whiteboard",payload:{lessonId:e},timestamp:Date.now(),correlationId:e}))},onPointerDown:M=>M.stopPropagation(),className:"p-1 hover:bg-slate-200/50 rounded-full text-gray-650 hover:text-gray-900 transition-colors cursor-pointer flex items-center justify-center",title:d.isMinimized?"展开组件":"收起组件",children:d.isMinimized?jsxRuntimeExports.jsx(Maximize2,{size:11}):jsxRuntimeExports.jsx(Minimize2,{size:11})}),jsxRuntimeExports.jsx("button",{onClick:()=>Ne(l.id),onPointerDown:M=>M.stopPropagation(),className:"p-1 hover:bg-slate-200/50 rounded-full text-gray-650 hover:text-red-500 transition-colors cursor-pointer flex items-center justify-center",title:"删除组件",children:jsxRuntimeExports.jsx(Trash2,{size:11})})]})]}),!d.isMinimized&&jsxRuntimeExports.jsx("div",{className:"flex-1 bg-white overflow-hidden relative min-h-0",children:jsxRuntimeExports.jsx("iframe",{className:"w-full h-full border-none",src:d.coursewareUuid?`/runtime/${d.coursewareUuid}/`:d.resourceId?`/api/resources/${d.resourceId}/`:void 0,srcDoc:d.coursewareUuid||d.resourceId?void 0:wrapSrcDocWithBridge(d.code,e),sandbox:"allow-scripts allow-same-origin allow-forms allow-downloads"})}),!d.isMinimized&&Me()]})})},l.id);if(l.type==="pen"){const M=O===l.id;return jsxRuntimeExports.jsx(Line,{id:l.id,points:d.points,stroke:M?"#3b82f6":d.color||"black",strokeWidth:M?6:4,tension:.5,lineCap:"round",lineJoin:"round",draggable:u==="teacher"&&w==="cursor",onClick:B=>{w==="cursor"&&(B.cancelBubble=!0,te(M?null:l.id))},onTap:B=>{w==="cursor"&&(B.cancelBubble=!0,te(M?null:l.id))},onDragEnd:async B=>{const ye=B.target,xe=ye.x(),Se=ye.y();ye.x(0),ye.y(0);const lt=d.points.map((Je,ht)=>ht%2===0?Je+xe:Je+Se);n&&(await n(l.id,{...d,points:lt}),frontendEventBus.publish({id:v7(),type:"whiteboard.element_updated",source:"whiteboard",payload:{lessonId:e},timestamp:Date.now(),correlationId:e}))}},l.id)}if(l.type==="highlighter"){const M=O===l.id;return jsxRuntimeExports.jsx(Line,{id:l.id,points:d.points,stroke:M?"#3b82f6":d.color||"#facc15",strokeWidth:M?24:18,tension:.5,lineCap:"round",lineJoin:"round",opacity:.5,draggable:u==="teacher"&&w==="cursor",onClick:B=>{w==="cursor"&&(B.cancelBubble=!0,te(M?null:l.id))},onTap:B=>{w==="cursor"&&(B.cancelBubble=!0,te(M?null:l.id))},onDragEnd:async B=>{const ye=B.target,xe=ye.x(),Se=ye.y();ye.x(0),ye.y(0);const lt=d.points.map((Je,ht)=>ht%2===0?Je+xe:Je+Se);n&&(await n(l.id,{...d,points:lt}),frontendEventBus.publish({id:v7(),type:"whiteboard.element_updated",source:"whiteboard",payload:{lessonId:e},timestamp:Date.now(),correlationId:e}))}},l.id)}if(l.type==="rectangle"||l.type==="shape"&&d.shape==="rect"){const M=O===l.id;return jsxRuntimeExports.jsx(Rect,{id:l.id,x:d.x,y:d.y,width:d.width,height:d.height,fill:d.fill||"transparent",stroke:M?"#3b82f6":d.stroke||"blue",strokeWidth:M?3:1,draggable:u==="teacher"&&w==="cursor",onClick:B=>{w==="cursor"&&(B.cancelBubble=!0,te(M?null:l.id))},onTap:B=>{w==="cursor"&&(B.cancelBubble=!0,te(M?null:l.id))},onDragEnd:async B=>{const ye=B.target,xe=ye.x(),Se=ye.y();ye.x(0),ye.y(0),n&&(await n(l.id,{...d,x:d.x+xe,y:d.y+Se}),frontendEventBus.publish({id:v7(),type:"whiteboard.element_updated",source:"whiteboard",payload:{lessonId:e},timestamp:Date.now(),correlationId:e}))}},l.id)}if(l.type==="circle"||l.type==="shape"&&d.shape==="circle"){const M=O===l.id;return jsxRuntimeExports.jsx(Circle$1,{id:l.id,x:d.x,y:d.y,radius:d.radius,fill:d.fill||"transparent",stroke:M?"#3b82f6":d.stroke||"green",strokeWidth:M?3:1,draggable:u==="teacher"&&w==="cursor",onClick:B=>{w==="cursor"&&(B.cancelBubble=!0,te(M?null:l.id))},onTap:B=>{w==="cursor"&&(B.cancelBubble=!0,te(M?null:l.id))},onDragEnd:async B=>{const ye=B.target,xe=ye.x(),Se=ye.y();ye.x(0),ye.y(0),n&&(await n(l.id,{...d,x:d.x+xe,y:d.y+Se}),frontendEventBus.publish({id:v7(),type:"whiteboard.element_updated",source:"whiteboard",payload:{lessonId:e},timestamp:Date.now(),correlationId:e}))}},l.id)}if(l.type==="text"){const M=O===l.id;return jsxRuntimeExports.jsx(Text,{id:l.id,x:d.x,y:d.y,text:d.text,fontSize:d.fontSize||16,fill:M?"#3b82f6":d.color||"black",fontStyle:M?"bold":"normal",draggable:u==="teacher"&&w==="cursor",onClick:B=>{w==="cursor"&&(B.cancelBubble=!0,te(M?null:l.id))},onTap:B=>{w==="cursor"&&(B.cancelBubble=!0,te(M?null:l.id))},onDragEnd:async B=>{const ye=B.target,xe=ye.x(),Se=ye.y();ye.x(0),ye.y(0),n&&(await n(l.id,{...d,x:d.x+xe,y:d.y+Se}),frontendEventBus.publish({id:v7(),type:"whiteboard.element_updated",source:"whiteboard",payload:{lessonId:e},timestamp:Date.now(),correlationId:e}))}},l.id)}if(l.type==="code-sandbox")return jsxRuntimeExports.jsx(Group$1,{children:jsxRuntimeExports.jsx(Html,{divProps:{style:{position:"absolute",top:`${N}px`,left:`${$}px`,pointerEvents:"none",zIndex:Le?20:10}},children:jsxRuntimeExports.jsxs("div",{onPointerDown:M=>{te(l.id),M.stopPropagation()},onContextMenu:M=>{M.preventDefault(),M.stopPropagation();const B=ue.current?.getBoundingClientRect();B&&ae({x:M.clientX-B.left,y:M.clientY-B.top,elementId:l.id})},className:"relative rounded-lg shadow-xl",style:{pointerEvents:"auto",width:`${pe}px`,height:`${ke}px`},children:[jsxRuntimeExports.jsx(CodeSandboxWrapper,{elementId:l.id,data:d,onElementUpdate:n?async(M,B)=>{await n(M,B),frontendEventBus.publish({id:v7(),type:"whiteboard.element_updated",source:"whiteboard",payload:{lessonId:e},timestamp:Date.now(),correlationId:e})}:void 0,onPointerDown:M=>De(M,l.id,d),onPointerMove:He,onPointerUp:Be,onDelete:()=>Ne(l.id)}),Me()]})})},l.id);if(l.type==="math-graph")return jsxRuntimeExports.jsx(Group$1,{children:jsxRuntimeExports.jsx(Html,{divProps:{style:{position:"absolute",top:`${N}px`,left:`${$}px`,pointerEvents:"none",zIndex:Le?20:10}},children:jsxRuntimeExports.jsxs("div",{onPointerDown:M=>{te(l.id),M.stopPropagation()},onContextMenu:M=>{M.preventDefault(),M.stopPropagation();const B=ue.current?.getBoundingClientRect();B&&ae({x:M.clientX-B.left,y:M.clientY-B.top,elementId:l.id})},className:"relative rounded-lg shadow-xl",style:{pointerEvents:"auto",width:`${pe}px`,height:`${ke}px`},children:[jsxRuntimeExports.jsx(MathGraphWrapper,{elementId:l.id,data:d,onElementUpdate:n?async(M,B)=>{await n(M,B),frontendEventBus.publish({id:v7(),type:"whiteboard.element_updated",source:"whiteboard",payload:{lessonId:e},timestamp:Date.now(),correlationId:e})}:void 0,onPointerDown:M=>De(M,l.id,d),onPointerMove:He,onPointerUp:Be,onDelete:()=>Ne(l.id)}),Me()]})})},l.id);if(l.type==="presentation")return jsxRuntimeExports.jsx(Group$1,{children:jsxRuntimeExports.jsx(Html,{divProps:{style:{position:"absolute",top:`${N}px`,left:`${$}px`,pointerEvents:"none",zIndex:Le?20:10}},children:jsxRuntimeExports.jsxs("div",{onPointerDown:M=>{te(l.id),M.stopPropagation()},onContextMenu:M=>{M.preventDefault(),M.stopPropagation();const B=ue.current?.getBoundingClientRect();B&&ae({x:M.clientX-B.left,y:M.clientY-B.top,elementId:l.id})},className:"bg-white border border-gray-305 rounded-lg shadow-xl overflow-hidden flex flex-col font-sans text-sm relative select-none",style:{pointerEvents:"auto",width:`${pe}px`,height:`${ke}px`},children:[jsxRuntimeExports.jsxs("div",{className:"bg-purple-100 text-purple-700 px-3 py-1.5 flex justify-between items-center text-xs font-semibold border-b border-purple-200 cursor-move shrink-0",onPointerDown:M=>De(M,l.id,d),onPointerMove:He,onPointerUp:Be,children:[jsxRuntimeExports.jsx("span",{children:"Interactive Presentation"}),jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntimeExports.jsx("button",{onClick:()=>Ee(l.id),onPointerDown:M=>M.stopPropagation(),className:"p-1 hover:bg-slate-200/50 rounded-full text-purple-600 hover:text-purple-900 transition-colors cursor-pointer flex items-center justify-center",title:"全屏",children:jsxRuntimeExports.jsx(Maximize2,{size:11})}),jsxRuntimeExports.jsx("button",{onClick:async()=>{n&&(await n(l.id,{...d,isMinimized:!d.isMinimized}),frontendEventBus.publish({id:v7(),type:"whiteboard.element_updated",source:"whiteboard",payload:{lessonId:e},timestamp:Date.now(),correlationId:e}))},onPointerDown:M=>M.stopPropagation(),className:"p-1 hover:bg-slate-200/50 rounded-full text-purple-650 hover:text-purple-900 transition-colors cursor-pointer flex items-center justify-center",title:d.isMinimized?"展开组件":"收起组件",children:d.isMinimized?jsxRuntimeExports.jsx(Maximize2,{size:11}):jsxRuntimeExports.jsx(Minimize2,{size:11})}),jsxRuntimeExports.jsx("button",{onClick:()=>Ne(l.id),onPointerDown:M=>M.stopPropagation(),className:"p-1 hover:bg-slate-200/50 rounded-full text-purple-600 hover:text-red-500 transition-colors cursor-pointer flex items-center justify-center",title:"删除组件",children:jsxRuntimeExports.jsx(Trash2,{size:11})})]})]}),!d.isMinimized&&jsxRuntimeExports.jsx("div",{className:"flex-1 min-h-0 relative bg-white",style:{pointerEvents:"auto"},children:jsxRuntimeExports.jsx(RevealPresentationWrapper,{elementId:l.id,data:d,userRole:u,onElementUpdate:n?async(M,B)=>{await n(M,B),frontendEventBus.publish({id:v7(),type:"whiteboard.element_updated",source:"whiteboard",payload:{lessonId:e},timestamp:Date.now(),correlationId:e})}:void 0})}),!d.isMinimized&&Me()]})})},l.id)}catch(d){console.error(d)}return null},Mt=l=>{l.preventDefault(),l.dataTransfer.dropEffect="copy",b||K(!0)},Lt=l=>{l.preventDefault(),l.dataTransfer.dropEffect="copy",K(!0)},Jt=l=>{l.preventDefault(),l.currentTarget.contains(l.relatedTarget)||K(!1)},wt=(l,d,_,I)=>{const $={x:_,y:I,page:v,segmentId:s};switch(l){case"code-sandbox":return{...$,code:d.code??"console.log('Hello Sandbox!');"};case"math-graph":return{...$,equation:d.equation??"Math.sin(x)"};case"presentation":return{...$,markdown:d.markdown??`# Title Slide
8311
8342
  ---
8312
- ## Slide 2`,width:600,height:400,slideX:0,slideY:0};case"quiz":return{...$,question:d.question??"New Quiz",options:Array.isArray(d.options)?d.options:["A","B","C","D"]};case"html-applet":return{...$,code:d.code??""};case"assignment":return{...$,title:d.title??"New Assignment",description:d.description??""};case"hello-world":return $;case"rollcall":return{...$,allStudents:[]};default:return{...$,...d}}},Qt=async(l,d)=>{if(!ue.current)return;const _=ue.current.getBoundingClientRect(),I=Math.round(_.width/2),$=Math.round(_.height/2);de(!0);try{await o(l,wt(l,d,I,$)),frontendEventBus.publish({id:v7(),type:"whiteboard.element_updated",source:"whiteboard",payload:{lessonId:e},timestamp:Date.now(),correlationId:e}),c&&c()}catch(N){console.error("addElementAtCenter error",N)}finally{de(!1)}};reactExports.useImperativeHandle(g,()=>({addElementAtCenter:Qt}));const vt=async l=>{l.preventDefault(),l.stopPropagation();try{let d=l.dataTransfer.getData("application/json");if(d||(d=l.dataTransfer.getData("text/plain")),d||(d=l.dataTransfer.getData("text")),d||(d=l.dataTransfer.getData("Text")),console.log("Whiteboard drop triggered. Payload:",d),!d)return;let _;try{_=JSON.parse(d)}catch(q){console.error("Failed to parse drop JSON payload:",q);return}if(typeof _!="object"||!_)return;if(!ue.current){console.warn("containerRef.current is not loaded on drop");return}const I=ue.current.getBoundingClientRect();let $=l.clientX-I.left,N=l.clientY-I.top;console.log(`Adding whiteboard element of type ${_.type} at (${$}, ${N})`),de(!0);try{await o(_.type,wt(_.type,_,$,N)),frontendEventBus.publish({id:v7(),type:"whiteboard.element_updated",source:"whiteboard",payload:{lessonId:e},timestamp:Date.now(),correlationId:e}),c&&c()}finally{de(!1)}}catch(d){console.error("Drop error",d)}};return jsxRuntimeExports.jsxs("div",{className:"flex-1 flex flex-row min-h-0 overflow-hidden bg-white",children:[jsxRuntimeExports.jsxs("div",{className:"flex-1 flex flex-col min-h-0 bg-white relative min-w-0",onDragOver:Mt,onDragEnter:Lt,onDrop:vt,children:[jsxRuntimeExports.jsx(WhiteboardToolbar,{tool:w,setTool:S,setSelectedShapeId:te,highlighterColor:R,setHighlighterColor:C,onElementAdd:o,currentPage:v,activeSegmentId:s,lessonId:e,safeElements:k,selectedShapeId:O,showGrid:F,setShowGrid:U,userRole:u,isSyncing:qe,setIsSyncing:de,handleClearBoard:Vt,handleResetBoard:Ot,handleElementDelete:Ne,setDialog:je,setDialogInput:mt,onRefresh:c}),jsxRuntimeExports.jsxs("div",{ref:ue,className:"flex-1 bg-slate-50/70 rounded-2xl border border-slate-200/80 relative overflow-hidden w-full mb-14 shadow-inner transition-all",style:{backgroundImage:F?"radial-gradient(#cbd5e1 1.2px, transparent 1.2px)":"none",backgroundSize:"24px 24px",backgroundColor:"#f8fafc"},onDragOver:Mt,onDragEnter:Lt,onDragLeave:Jt,onDrop:async l=>{K(!1),await vt(l)},children:[b&&jsxRuntimeExports.jsxs("div",{className:"absolute inset-0 border-2 border-dashed border-indigo-500 bg-indigo-500/10 backdrop-blur-[2px] rounded-2xl flex flex-col items-center justify-center text-indigo-600 font-bold text-sm z-30 animate-in fade-in pointer-events-none",children:[jsxRuntimeExports.jsx(Plus,{size:32,className:"mb-2 text-indigo-600 animate-bounce"}),jsxRuntimeExports.jsx("span",{children:"释放鼠标将组件放入当前白板页面"})]}),k.filter(l=>{if(l.type==="page_meta")return!1;try{const d=JSON.parse(l.data),_=d.page??0,I=Z[v];return!(!(d.pageId&&I?.id?d.pageId===I.id:_===v)||s&&d.segmentId&&d.segmentId!==s)}catch{return v===0}}).length===0&&!Ge&&jsxRuntimeExports.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center pointer-events-none select-none text-slate-400 p-6 z-0",children:[jsxRuntimeExports.jsx("div",{className:"w-16 h-16 rounded-2xl bg-indigo-50/80 border border-indigo-100/80 flex items-center justify-center mb-3 shadow-2xs",children:jsxRuntimeExports.jsx(Sparkles,{className:"w-7 h-7 text-indigo-500 animate-pulse"})}),jsxRuntimeExports.jsx("p",{className:"font-bold text-sm text-slate-700 mb-1",children:"交互式备课白板"}),jsxRuntimeExports.jsx("p",{className:"text-xs text-slate-400 max-w-sm text-center",children:"从左侧组件库拖拽组件至此处,或使用顶部工具栏插入画笔、几何图形与 AI 助教"})]}),jsxRuntimeExports.jsxs("div",{className:"absolute inset-0 w-full h-full overflow-hidden",children:[he.width>0&&he.height>0&&(Ge?(()=>{const l=k.find(N=>N.id===Ge);if(!l)return Ee(null),null;let d={};try{d=JSON.parse(l.data)}catch{}const _=16,I=he.width-_*2,$=he.height-_*2;return jsxRuntimeExports.jsx("div",{className:"absolute inset-0 z-50 bg-black/60 flex items-center justify-center",style:{pointerEvents:"auto"},children:jsxRuntimeExports.jsxs("div",{className:"relative bg-white rounded-xl shadow-2xl overflow-hidden flex flex-col",style:{width:Math.max(400,I),height:Math.max(300,$)},children:[jsxRuntimeExports.jsxs("div",{className:"bg-indigo-50 text-indigo-700 px-4 py-2 flex justify-between items-center text-sm font-semibold border-b border-indigo-100 shrink-0",children:[jsxRuntimeExports.jsx("span",{children:l.type==="quiz"?"📝 随堂测验":l.type==="timer"?"⏱ 计时器":l.type==="assignment"?"📋 作业":l.type==="code-sandbox"?"💻 代码沙箱":l.type==="html-applet"?"🌐 交互课件":l.type==="rollcall"?"🎲 随机点名":l.type}),jsxRuntimeExports.jsxs("button",{onClick:()=>Ee(null),className:"p-1.5 hover:bg-indigo-200/50 rounded-lg text-indigo-600 hover:text-indigo-900 transition-colors cursor-pointer flex items-center gap-1 text-xs",children:[jsxRuntimeExports.jsx(Minimize2,{size:14})," 退出全屏"]})]}),jsxRuntimeExports.jsxs("div",{className:"flex-1 overflow-auto p-6",children:[l.type==="quiz"&&jsxRuntimeExports.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[jsxRuntimeExports.jsx("h3",{className:"text-xl font-bold text-gray-800",children:d.question}),jsxRuntimeExports.jsx("div",{className:"flex flex-col gap-3",children:(d.options||[]).map((N,q)=>jsxRuntimeExports.jsxs("button",{className:"px-5 py-4 text-left bg-gray-50 border-2 border-gray-200 rounded-xl text-base hover:bg-gray-100 transition-colors",children:[jsxRuntimeExports.jsxs("span",{className:"font-bold text-indigo-600 mr-3",children:["ABCDEFGHIJKLMNOPQRSTUVWXYZ"[q],"."]}),N]},q))}),d.submissions&&Object.keys(d.submissions).length>0&&jsxRuntimeExports.jsx("div",{className:"mt-4 p-4 bg-gray-50 rounded-xl",children:jsxRuntimeExports.jsxs("p",{className:"text-sm font-semibold text-gray-600",children:["提交统计: ",Object.keys(d.submissions).length," 人已作答"]})})]}),l.type==="timer"&&jsxRuntimeExports.jsx("div",{className:"flex items-center justify-center h-full",children:jsxRuntimeExports.jsxs("div",{className:"text-center",children:[jsxRuntimeExports.jsxs("div",{className:"text-8xl font-mono font-bold text-orange-600 mb-4",children:[String(Math.floor((d.remaining??d.duration??60)/60)).padStart(2,"0"),":",String((d.remaining??d.duration??60)%60).padStart(2,"0")]}),jsxRuntimeExports.jsx("p",{className:"text-lg text-gray-500",children:d.label||"计时器"})]})}),l.type==="assignment"&&jsxRuntimeExports.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[jsxRuntimeExports.jsx("h3",{className:"text-xl font-bold text-gray-800",children:d.title}),jsxRuntimeExports.jsx("p",{className:"text-gray-600 text-base whitespace-pre-wrap",children:d.description}),jsxRuntimeExports.jsx("button",{className:"w-full bg-orange-600 hover:bg-orange-700 text-white font-medium py-3 rounded-xl transition-colors text-base shadow-sm cursor-pointer",children:"Upload File"})]}),l.type==="code-sandbox"&&jsxRuntimeExports.jsx("div",{className:"h-full flex flex-col gap-4",children:jsxRuntimeExports.jsx("textarea",{value:d.code||"",readOnly:!0,className:"flex-1 p-4 bg-gray-900 text-green-400 font-mono text-sm rounded-xl resize-none"})}),l.type==="html-applet"&&jsxRuntimeExports.jsx("div",{className:"h-full flex items-center justify-center",children:jsxRuntimeExports.jsxs("div",{className:"text-center text-gray-500",children:[jsxRuntimeExports.jsx(BookOpen,{size:64,className:"mx-auto mb-4 text-indigo-300"}),jsxRuntimeExports.jsx("p",{className:"text-lg font-semibold",children:d.title||"交互课件"}),d.coursewareUuid&&jsxRuntimeExports.jsx("iframe",{src:`/runtime/${d.coursewareUuid}/`,className:"w-full h-[60vh] mt-4 rounded-xl border"})]})}),l.type==="rollcall"&&jsxRuntimeExports.jsx("div",{className:"flex items-center justify-center h-full",children:jsxRuntimeExports.jsxs("div",{className:"text-center",children:[jsxRuntimeExports.jsx("div",{className:"text-6xl font-bold text-indigo-600 mb-4",children:d.selectedStudent||"点击点名"}),jsxRuntimeExports.jsx("p",{className:"text-lg text-gray-500",children:"随机点名"})]})}),!["quiz","timer","assignment","code-sandbox","html-applet","rollcall"].includes(l.type)&&jsxRuntimeExports.jsx("div",{className:"flex items-center justify-center h-full text-gray-400 text-sm",children:"此组件类型暂不支持全屏预览"})]})]})})})():jsxRuntimeExports.jsx(Stage,{width:he.width,height:he.height,onMouseDown:Ut,onMousemove:Wt,onMouseup:Gt,onContextMenu:l=>{l.evt.preventDefault();const d=ue.current?.getBoundingClientRect();if(d){const _=l.evt.clientX-d.left,I=l.evt.clientY-d.top,N=l.target.id();N?(te(N),ae({x:_,y:I,elementId:N})):ae({x:_,y:I})}},ref:ce,className:"w-full h-full cursor-crosshair",children:jsxRuntimeExports.jsxs(Layer,{children:[k.filter(l=>{if(l.type==="page_meta")return!1;try{const d=JSON.parse(l.data),_=d.page??0,I=Z[v];return!(!(d.pageId&&I?.id?d.pageId===I.id:_===v)||s&&d.segmentId&&d.segmentId!==s)}catch{return v===0}}).map(Kt),Xt(),Zt()]})})),O&&(()=>{const l=k.find($=>$.id===O);if(!l)return null;const d=Tt(l);if(!d)return null;const _=Math.max(10,Math.min(he.width-150,d.x-60)),I=Math.max(10,Math.min(he.height-50,d.y));return jsxRuntimeExports.jsxs("div",{style:{left:`${_}px`,top:`${I}px`,pointerEvents:"auto"},className:"absolute bg-white text-gray-800 shadow-xl border border-red-200 rounded-lg py-1 px-2 flex items-center gap-1.5 z-30 animate-in fade-in slide-in-from-bottom-2 duration-150 animate-out fade-out duration-100",children:[jsxRuntimeExports.jsx("span",{className:"text-xs font-semibold px-1 text-gray-500 capitalize select-none",children:l.type}),jsxRuntimeExports.jsx("div",{className:"w-[1px] h-3 bg-gray-200"}),jsxRuntimeExports.jsxs("button",{onClick:()=>{Ne(O),te(null)},className:"flex items-center gap-1 text-xs text-red-600 hover:text-white hover:bg-red-600 px-2 py-0.5 rounded transition-all font-medium cursor-pointer",children:[jsxRuntimeExports.jsx(Trash2,{size:12}),"删除"]})]})})(),Pe&&jsxRuntimeExports.jsx("div",{style:{left:`${Pe.x}px`,top:`${Pe.y}px`,pointerEvents:"auto"},className:"absolute bg-white rounded-lg shadow-2xl border border-gray-200 py-1.5 w-44 z-40 font-sans text-sm animate-in fade-in zoom-in-95 duration-100",onClick:l=>l.stopPropagation(),onContextMenu:l=>l.preventDefault(),children:Pe.elementId?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{className:"px-3 py-1 text-[11px] text-gray-500 font-bold uppercase tracking-wider select-none",children:"组件选项"}),jsxRuntimeExports.jsxs("button",{onClick:()=>{const l=Pe.elementId;l&&(Ne(l),O===l&&te(null)),ae(null)},className:"w-full px-3 py-1.5 flex items-center gap-2 text-left text-red-600 hover:bg-red-50 transition-colors text-xs font-semibold",children:[jsxRuntimeExports.jsx(Trash2,{size:14}),"删除此组件"]})]}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{className:"px-3 py-1 text-[11px] text-gray-400 font-bold uppercase tracking-wider select-none",children:"白板操作"}),jsxRuntimeExports.jsxs("button",{onClick:()=>{S("cursor"),ae(null)},className:`w-full px-3 py-1.5 flex items-center gap-2 text-left text-xs font-medium hover:bg-gray-50 transition-colors ${w==="cursor"?"text-indigo-600":"text-gray-750"}`,children:[jsxRuntimeExports.jsx(MousePointer2,{size:14}),"选择工具 (Cursor)"]}),jsxRuntimeExports.jsxs("button",{onClick:()=>{S("pen"),ae(null)},className:`w-full px-3 py-1.5 flex items-center gap-2 text-left text-xs font-medium hover:bg-gray-50 transition-colors ${w==="pen"?"text-indigo-600":"text-gray-750"}`,children:[jsxRuntimeExports.jsx(PenTool,{size:14}),"画笔工具 (Pen)"]}),jsxRuntimeExports.jsxs("button",{onClick:()=>{S("highlighter"),ae(null)},className:`w-full px-3 py-1.5 flex items-center gap-2 text-left text-xs font-medium hover:bg-gray-50 transition-colors ${w==="highlighter"?"text-indigo-600":"text-gray-750"}`,children:[jsxRuntimeExports.jsx(Highlighter,{size:14}),"高亮荧光笔 (Highlighter)"]}),jsxRuntimeExports.jsxs("button",{onClick:()=>{S("rect"),ae(null)},className:`w-full px-3 py-1.5 flex items-center gap-2 text-left text-xs font-medium hover:bg-gray-50 transition-colors ${w==="rect"?"text-indigo-600":"text-gray-750"}`,children:[jsxRuntimeExports.jsx(Square,{size:14}),"矩形工具 (Rectangle)"]}),jsxRuntimeExports.jsxs("button",{onClick:()=>{S("circle"),ae(null)},className:`w-full px-3 py-1.5 flex items-center gap-2 text-left text-xs font-medium hover:bg-gray-50 transition-colors ${w==="circle"?"text-indigo-600":"text-gray-750"}`,children:[jsxRuntimeExports.jsx(Circle,{size:14}),"圆形工具 (Circle)"]}),jsxRuntimeExports.jsxs("button",{onClick:()=>{S("text"),ae(null)},className:`w-full px-3 py-1.5 flex items-center gap-2 text-left text-xs font-medium hover:bg-gray-50 transition-colors ${w==="text"?"text-indigo-600":"text-gray-750"}`,children:[jsxRuntimeExports.jsx(Type,{size:14}),"文本工具 (Text)"]})]})})]})]}),jsxRuntimeExports.jsx(WhiteboardPageBar,{pages:Z,currentPage:v,showPageDrawer:oe,setShowPageDrawer:H,editingPageIdx:E,setEditingPageIdx:J,editingPageTitle:z,setEditingPageTitle:A,activeMenuPageIdx:Q,setActiveMenuPageIdx:se,safeElements:k,handleSwitchPage:be,handleRenamePage:_e,handleDuplicatePage:we,handleMovePage:Ce,handleDeletePage:f,handleAddPage:m}),jsxRuntimeExports.jsx(WhiteboardDialog,{dialog:Ct,dialogInput:bt,setDialogInput:mt,setDialog:je}),jsxRuntimeExports.jsx(CoursewareEntrySelectorModal,{showEntrySelector:Rt,setShowEntrySelector:gt,zipUploadInfo:At,zipCandidates:jt,handlePropsUpdate:Oe,fetchCoursewares:dt})]}),p&&O&&ee&&(()=>{const l=k.find(d=>d.id===O);return l?jsxRuntimeExports.jsxs("div",{className:"w-80 h-full max-h-full bg-slate-50 border-l border-slate-200 flex flex-col font-sans text-xs select-none shadow-xl shrink-0 z-20 animate-in slide-in-from-right duration-200",onPointerDown:d=>d.stopPropagation(),children:[jsxRuntimeExports.jsxs("div",{className:"px-4 py-3 border-b border-slate-200 bg-white flex justify-between items-center shrink-0",children:[jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntimeExports.jsx(Settings,{size:15,className:"text-slate-500 animate-spin",style:{animationDuration:"6s"}}),jsxRuntimeExports.jsx("span",{className:"font-bold text-slate-800 text-sm",children:"属性编辑器"})]}),jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1.5 font-sans",children:[jsxRuntimeExports.jsxs("button",{onClick:zt,disabled:(Ze[O]||[]).length===0,className:`p-1 rounded-lg transition-all flex items-center justify-center gap-1 border border-transparent select-none cursor-pointer ${(Ze[O]||[]).length===0?"text-slate-350 bg-transparent border-transparent opacity-40 cursor-not-allowed":"text-slate-700 bg-slate-50 hover:bg-slate-100 hover:border-slate-200 active:bg-slate-150"}`,title:"撤销属性修改",children:[jsxRuntimeExports.jsx(Undo2,{size:13}),(Ze[O]||[]).length>0&&jsxRuntimeExports.jsx("span",{className:"text-[10px] font-bold text-slate-500",children:(Ze[O]||[]).length})]}),jsxRuntimeExports.jsxs("button",{onClick:Et,disabled:(Ke[O]||[]).length===0,className:`p-1 rounded-lg transition-all flex items-center justify-center gap-1 border border-transparent select-none cursor-pointer ${(Ke[O]||[]).length===0?"text-slate-350 bg-transparent border-transparent opacity-40 cursor-not-allowed":"text-slate-700 bg-slate-50 hover:bg-slate-100 hover:border-slate-200 active:bg-slate-150"}`,title:"重做属性修改",children:[jsxRuntimeExports.jsx(Redo2,{size:13}),(Ke[O]||[]).length>0&&jsxRuntimeExports.jsx("span",{className:"text-[10px] font-bold text-slate-500",children:(Ke[O]||[]).length})]}),jsxRuntimeExports.jsx("div",{className:"h-4 w-px bg-slate-200 mx-0.5 shrink-0"}),jsxRuntimeExports.jsx("button",{onClick:()=>te(null),className:"text-slate-400 hover:text-slate-650 hover:bg-slate-100 p-1 rounded-full transition-all cursor-pointer",title:"关闭属性编辑器",children:jsxRuntimeExports.jsx(X,{size:15})})]})]}),jsxRuntimeExports.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:[jsxRuntimeExports.jsxs("div",{className:"bg-white p-3 rounded-xl border border-slate-200 shadow-sm space-y-2",children:[jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntimeExports.jsx("span",{className:"text-slate-400 text-[10px] font-bold uppercase tracking-wider",children:"组件类型"}),jsxRuntimeExports.jsx("span",{className:"px-2 py-0.5 bg-indigo-50 text-indigo-650 rounded text-[10px] font-bold uppercase tracking-wider",children:l.type})]}),jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntimeExports.jsx("span",{className:"text-slate-400 text-[10px] font-bold uppercase tracking-wider",children:"组件标识"}),jsxRuntimeExports.jsx("span",{className:"font-mono text-slate-500 text-[10px] truncate max-w-[155px]",title:l.id,children:l.id})]})]}),jsxRuntimeExports.jsxs("div",{className:"bg-white p-3 rounded-xl border border-slate-200 shadow-sm space-y-3",children:[jsxRuntimeExports.jsx("h4",{className:"font-bold text-slate-700 text-xs border-b border-slate-100 pb-1.5 flex items-center gap-1.5",children:"物理定位 & 尺寸"}),jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("label",{className:"block text-[10px] text-slate-400 font-semibold mb-1",children:"X 坐标"}),jsxRuntimeExports.jsx("input",{type:"number",value:Math.round(ee.x??0),onChange:d=>fe("x",parseFloat(d.target.value)||0),onBlur:d=>Ue("x",d.target.value),className:"w-full px-2 py-1.5 border border-slate-200 rounded-lg text-xs font-mono focus:outline-none focus:ring-1 focus:ring-indigo-500"})]}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("label",{className:"block text-[10px] text-slate-400 font-semibold mb-1",children:"Y 坐标"}),jsxRuntimeExports.jsx("input",{type:"number",value:Math.round(ee.y??0),onChange:d=>fe("y",parseFloat(d.target.value)||0),onBlur:d=>Ue("y",d.target.value),className:"w-full px-2 py-1.5 border border-slate-200 rounded-lg text-xs font-mono focus:outline-none focus:ring-1 focus:ring-indigo-500"})]})]}),l.type!=="pen"&&l.type!=="circle"&&jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-2 gap-2 mt-2",children:[jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("label",{className:"block text-[10px] text-slate-400 font-semibold mb-1",children:"宽度 (Width)"}),jsxRuntimeExports.jsx("input",{type:"number",min:"50",value:Math.round(ee.width??300),onChange:d=>fe("width",parseFloat(d.target.value)||50),onBlur:d=>Ue("width",d.target.value),className:"w-full px-2 py-1.5 border border-slate-200 rounded-lg text-xs font-mono focus:outline-none focus:ring-1 focus:ring-indigo-500"})]}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("label",{className:"block text-[10px] text-slate-400 font-semibold mb-1",children:"高度 (Height)"}),jsxRuntimeExports.jsx("input",{type:"number",min:"50",value:Math.round(ee.height??300),onChange:d=>fe("height",parseFloat(d.target.value)||50),onBlur:d=>Ue("height",d.target.value),className:"w-full px-2 py-1.5 border border-slate-200 rounded-lg text-xs font-mono focus:outline-none focus:ring-1 focus:ring-indigo-500"})]})]}),l.type==="circle"&&jsxRuntimeExports.jsxs("div",{className:"mt-2",children:[jsxRuntimeExports.jsx("label",{className:"block text-[10px] text-slate-400 font-semibold mb-1",children:"半径 (Radius)"}),jsxRuntimeExports.jsx("input",{type:"number",min:"5",value:Math.round(ee.radius??50),onChange:d=>fe("radius",parseFloat(d.target.value)||5),onBlur:d=>Ue("radius",d.target.value),className:"w-full px-2 py-1.5 border border-slate-200 rounded-lg text-xs font-mono focus:outline-none focus:ring-1 focus:ring-indigo-500"})]})]}),l.type==="quiz"&&jsxRuntimeExports.jsxs("div",{className:"bg-white p-3 rounded-xl border border-slate-200 shadow-sm space-y-3",children:[jsxRuntimeExports.jsx("h4",{className:"font-bold text-slate-700 text-xs border-b border-slate-100 pb-1.5",children:"随堂测验配置"}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("label",{className:"block text-[10px] text-slate-400 font-semibold mb-1",children:"测验题目 (Question)"}),jsxRuntimeExports.jsx("textarea",{value:ee.question||"",onChange:d=>fe("question",d.target.value),onBlur:d=>Ie("question",d.target.value),className:"w-full h-20 p-2 border border-slate-200 rounded-lg text-xs focus:outline-none focus:ring-1 focus:ring-indigo-500 resize-none font-medium leading-relaxed",placeholder:"编写问题描述..."})]}),(ee.options||[]).length>0&&jsxRuntimeExports.jsxs("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-2.5",children:[jsxRuntimeExports.jsx("label",{className:"block text-[10px] text-amber-700 font-bold mb-1.5",children:"⚠️ 正确答案 (Correct Answer)"}),jsxRuntimeExports.jsxs("select",{value:ee.correctAnswer||"",onChange:d=>{fe("correctAnswer",d.target.value),Ie("correctAnswer",d.target.value)},className:`w-full px-2 py-1.5 border rounded-lg text-xs font-medium focus:outline-none focus:ring-1 focus:ring-amber-500 cursor-pointer ${ee.correctAnswer?"border-green-300 bg-green-50 text-green-800":"border-amber-300 bg-white text-amber-800"}`,children:[jsxRuntimeExports.jsx("option",{value:"",children:"-- 请选择正确答案 --"}),(ee.options||[]).map((d,_)=>jsxRuntimeExports.jsx("option",{value:d,children:d},_))]}),!ee.correctAnswer&&jsxRuntimeExports.jsx("p",{className:"text-[9px] text-amber-600 mt-1",children:"未设置正确答案将无法自动判分"})]}),jsxRuntimeExports.jsxs("div",{className:"space-y-2",children:[jsxRuntimeExports.jsx("label",{className:"block text-[10px] text-slate-400 font-semibold",children:"选项列表 (Options)"}),jsxRuntimeExports.jsx("div",{className:"space-y-1.5 max-h-48 overflow-y-auto pr-1",children:(ee.options||[]).map((d,_)=>{const $="ABCDEFGHIJKLMNOPQRSTUVWXYZ"[_]||_+1;return jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1.5",children:[jsxRuntimeExports.jsx("span",{className:"font-bold text-slate-700 bg-slate-100 rounded px-1.5 py-1 text-center shrink-0 min-w-[22px]",children:$}),jsxRuntimeExports.jsx("input",{type:"text",value:d||"",onChange:N=>Dt(_,N.target.value),onBlur:N=>Ht(_,N.target.value),className:"flex-1 px-2 py-1 border border-slate-200 rounded-lg text-xs font-medium"}),jsxRuntimeExports.jsx("button",{onClick:()=>Ft(_),title:"删除选项",className:"text-slate-400 hover:text-red-500 hover:bg-red-50 p-1 rounded-md shrink-0 transition-colors cursor-pointer",children:jsxRuntimeExports.jsx(Trash2,{size:13})})]},_)})}),jsxRuntimeExports.jsxs("button",{onClick:Bt,className:"w-full mt-2 py-1 bg-slate-100 hover:bg-slate-200 text-slate-600 font-bold border border-slate-200/80 rounded-lg flex items-center justify-center gap-1 hover:text-slate-700 transition-all text-[11px] cursor-pointer",children:[jsxRuntimeExports.jsx(Plus,{size:12})," 添加选项"]})]})]}),l.type==="assignment"&&jsxRuntimeExports.jsxs("div",{className:"bg-white p-3 rounded-xl border border-slate-200 shadow-sm space-y-3",children:[jsxRuntimeExports.jsx("h4",{className:"font-bold text-slate-700 text-xs border-b border-slate-100 pb-1.5",children:"作业选项配置"}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("label",{className:"block text-[10px] text-slate-400 font-semibold mb-1",children:"作业任务标题 (Title)"}),jsxRuntimeExports.jsx("input",{type:"text",value:ee.title||"",onChange:d=>fe("title",d.target.value),onBlur:d=>Ie("title",d.target.value),className:"w-full px-2 py-1.5 border border-slate-200 rounded-lg text-xs font-semibold focus:outline-none focus:ring-1 focus:ring-indigo-500",placeholder:"作业名..."})]}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("label",{className:"block text-[10px] text-slate-400 font-semibold mb-1",children:"详细作业要求描述"}),jsxRuntimeExports.jsx("textarea",{value:ee.description||"",onChange:d=>fe("description",d.target.value),onBlur:d=>Ie("description",d.target.value),className:"w-full h-24 p-2 border border-slate-200 rounded-lg text-xs focus:outline-none focus:ring-1 focus:ring-indigo-500 resize-none font-medium leading-relaxed",placeholder:"请输入详细的作业指南..."})]})]}),(l.type==="code-sandbox"||l.type==="html-applet")&&jsxRuntimeExports.jsxs("div",{className:"bg-white p-3 rounded-xl border border-slate-200 shadow-sm space-y-3",children:[jsxRuntimeExports.jsxs("h4",{className:"font-bold text-slate-700 text-xs border-b border-slate-100 pb-1.5 flex justify-between items-center",children:[jsxRuntimeExports.jsx("span",{children:"动态运行代码定制"}),l.type==="html-applet"&&jsxRuntimeExports.jsx("span",{className:"text-[10px] bg-indigo-50 text-indigo-700 px-1.5 py-0.5 rounded-full font-bold",children:"HTML Applet"})]}),l.type==="html-applet"&&jsxRuntimeExports.jsxs("div",{className:"space-y-3 border-b border-slate-100 pb-3",children:[jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("label",{className:"block text-[10px] text-indigo-600 font-bold mb-1",children:"选择 AI 互动课件 (ZIP/HTML):"}),jsxRuntimeExports.jsxs("select",{value:ee.coursewareUuid||"",onChange:d=>{const _=d.target.value;Oe({coursewareUuid:_,resourceId:""})},className:"w-full text-xs p-2 bg-slate-50 border border-indigo-200 hover:border-indigo-300 rounded-lg text-slate-750 focus:outline-none focus:ring-1 focus:ring-indigo-500 transition-all font-semibold",children:[jsxRuntimeExports.jsx("option",{value:"",children:"-- 使用系统资源或自定义代码 --"}),St.map(d=>jsxRuntimeExports.jsxs("option",{value:d.uuid,children:["📁 [互动课件] ",d.name]},d.id))]})]}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("label",{className:"block text-[10px] text-slate-500 font-bold mb-1",children:"选择已有的系统资源:"}),jsxRuntimeExports.jsxs("select",{value:ee.resourceId||"",onChange:d=>{const _=d.target.value;Oe({resourceId:_,coursewareUuid:""})},className:"w-full text-xs p-2 bg-slate-50 border border-slate-200 hover:border-slate-300 rounded-lg text-slate-750 focus:outline-none focus:ring-1 focus:ring-indigo-500 transition-all font-semibold",children:[jsxRuntimeExports.jsx("option",{value:"",children:"-- 使用互动课件或自定义代码 --"}),It.map(d=>jsxRuntimeExports.jsxs("option",{value:d.id,children:["[",d.type==="folder"?"文件夹":"单HTML","] ",d.name]},d.id))]})]}),jsxRuntimeExports.jsxs("div",{className:"bg-slate-50 p-2.5 rounded-xl border border-slate-100 text-[10px] text-slate-500 space-y-2",children:[jsxRuntimeExports.jsx("span",{className:"font-bold text-slate-600 block",children:"上传资源 (会自动保存到对应库):"}),jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[jsxRuntimeExports.jsxs("label",{className:"col-span-2 flex flex-col items-center justify-center p-2 bg-indigo-50 hover:bg-indigo-100 border border-indigo-200 hover:border-indigo-300 rounded-lg cursor-pointer text-center transition-all",children:[jsxRuntimeExports.jsx("span",{className:"font-bold text-indigo-700 text-[10px]",children:"✨ 上传 AI 互动课件 (.zip/.html)"}),jsxRuntimeExports.jsx("input",{type:"file",accept:".zip,.html,.htm",className:"hidden",onChange:async d=>{const _=d.target.files?.[0];if(!_)return;const I=new FileReader;I.onload=async $=>{const N=$.target?.result;try{const q=await fetch("/api/courseware/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:_.name.replace(/\.[^/.]+$/,""),filename:_.name,base64Data:N})});if(q.ok){const G=await q.json();G.need_select_entry?(Pt(G.candidates),qt({uuid:G.uuid,name:G.name}),gt(!0)):(Oe({coursewareUuid:G.uuid,resourceId:""}),dt())}else{const G=await q.json();alert("上传失败: "+(G.error||q.statusText))}}catch(q){console.error("Courseware upload failed:",q)}},I.readAsDataURL(_)}})]}),jsxRuntimeExports.jsxs("label",{className:"flex flex-col items-center justify-center p-2 bg-white hover:bg-slate-100 border border-slate-200 hover:border-slate-300 rounded-lg cursor-pointer text-center transition-all",children:[jsxRuntimeExports.jsx("span",{className:"font-bold text-slate-600 text-[10px]",children:"📄 上传系统HTML文件"}),jsxRuntimeExports.jsx("input",{type:"file",accept:".html,.htm",className:"hidden",onChange:async d=>{const _=d.target.files?.[0];if(!_)return;const I=new FileReader;I.onload=async $=>{const N=$.target?.result;try{const q=await fetch("/api/resources",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:_.name,type:"html",content:N})});if(q.ok){const G=await q.json();Oe({resourceId:G.id,coursewareUuid:""}),st()}}catch(q){console.error("Upload failed:",q)}},I.readAsText(_)}})]}),jsxRuntimeExports.jsxs("label",{className:"flex flex-col items-center justify-center p-2 bg-white hover:bg-slate-100 border border-slate-200 hover:border-slate-300 rounded-lg cursor-pointer text-center transition-all",children:[jsxRuntimeExports.jsx("span",{className:"font-bold text-slate-600 text-[10px]",children:"📁 上传系统文件夹"}),jsxRuntimeExports.jsx("input",{type:"file",webkitdirectory:"",directory:"",multiple:!0,className:"hidden",onChange:async d=>{const _=d.target.files;if(!_||_.length===0)return;const I=[];let $="";for(let N=0;N<_.length;N++){const q=_[N],G=q.webkitRelativePath||q.name;$||($=G.split("/")[0]||"uploaded_resource");const pe=q.name.split(".").pop()?.toLowerCase(),ke=["png","jpg","jpeg","gif","webp","ico"].includes(pe||"");await new Promise(Le=>{const Me=new FileReader;Me.onload=M=>{const B=M.target?.result;I.push({path:G,content:B}),Le()},ke?Me.readAsDataURL(q):Me.readAsText(q)})}try{const N=await fetch("/api/resources",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:$,type:"folder",content:JSON.stringify(I)})});if(N.ok){const q=await N.json();Oe({resourceId:q.id,coursewareUuid:""}),st()}}catch(N){console.error("Folder upload failed:",N)}}})]})]})]})]}),(!ee.resourceId&&!ee.coursewareUuid||l.type==="code-sandbox")&&jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("label",{className:"block text-[10px] text-slate-400 font-semibold mb-1",children:"沙箱程序代码 (Source Code)"}),jsxRuntimeExports.jsx("textarea",{value:ee.code||"",onChange:d=>fe("code",d.target.value),onBlur:d=>Ie("code",d.target.value),className:"w-full h-48 p-3 border border-slate-300 rounded-lg text-xs font-mono focus:outline-none focus:ring-1 focus:ring-indigo-500 bg-slate-900 text-slate-100 resize-none leading-relaxed",placeholder:"// 编写交互沙箱代码..."})]})]}),l.type==="math-graph"&&jsxRuntimeExports.jsxs("div",{className:"bg-white p-3 rounded-xl border border-slate-200 shadow-sm space-y-3",children:[jsxRuntimeExports.jsx("h4",{className:"font-bold text-slate-700 text-xs border-b border-slate-100 pb-1.5",children:"函数解析拟合"}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("label",{className:"block text-[10px] text-slate-400 font-semibold mb-1",children:"函数表达式 y = f(x)"}),jsxRuntimeExports.jsx("input",{type:"text",value:ee.equation||"",onChange:d=>fe("equation",d.target.value),onBlur:d=>Ie("equation",d.target.value),className:"w-full px-2 py-1.5 border border-slate-200 rounded-lg text-xs font-mono focus:outline-none focus:ring-1 focus:ring-indigo-100"}),jsxRuntimeExports.jsxs("p",{className:"text-[10px] text-slate-400 mt-1 leading-snug",children:["支持标准 JS 表达式。 示例:",jsxRuntimeExports.jsx("br",{}),"• ",jsxRuntimeExports.jsx("code",{className:"bg-slate-100 px-1 rounded",children:"Math.sin(x)"})," 正负弦波形",jsxRuntimeExports.jsx("br",{}),"• ",jsxRuntimeExports.jsx("code",{className:"bg-slate-100 px-1 rounded",children:"Math.cos(x) * x"})," 振幅衰减"]})]})]}),l.type==="presentation"&&jsxRuntimeExports.jsxs("div",{className:"bg-white p-3 rounded-xl border border-slate-200 shadow-sm space-y-3",children:[jsxRuntimeExports.jsx("h4",{className:"font-bold text-slate-700 text-xs border-b border-slate-100 pb-1.5",children:"幻灯片 Markdown 文案"}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("label",{className:"block text-[10px] text-slate-400 font-semibold mb-1",children:"Markdown 源代码"}),jsxRuntimeExports.jsx("textarea",{value:ee.markdown||"",onChange:d=>fe("markdown",d.target.value),onBlur:d=>Ie("markdown",d.target.value),className:"w-full h-64 p-2.5 border border-slate-200 rounded-lg text-xs font-mono focus:outline-none focus:ring-1 focus:ring-indigo-100 resize-none font-medium leading-relaxed bg-slate-50",placeholder:"修改 Markdown 内容..."})]})]}),l.type==="text"&&jsxRuntimeExports.jsxs("div",{className:"bg-white p-3 rounded-xl border border-slate-200 shadow-sm space-y-3",children:[jsxRuntimeExports.jsx("h4",{className:"font-bold text-slate-700 text-xs border-b border-slate-100 pb-1.5",children:"文字属性管理"}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("label",{className:"block text-[10px] text-slate-400 font-semibold mb-1",children:"文本内容"}),jsxRuntimeExports.jsx("input",{type:"text",value:ee.text||"",onChange:d=>fe("text",d.target.value),onBlur:d=>Ie("text",d.target.value),className:"w-full px-2 py-1.5 border border-slate-200 rounded-lg text-xs font-medium focus:outline-none focus:ring-1 focus:ring-indigo-500"})]}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("label",{className:"block text-[10px] text-slate-400 font-semibold mb-1",children:"文字大小 (FontSize)"}),jsxRuntimeExports.jsx("input",{type:"number",min:"10",max:"100",value:ee.fontSize||16,onChange:d=>fe("fontSize",parseInt(d.target.value)||10),onBlur:d=>Ue("fontSize",d.target.value),className:"w-full px-2 py-1.5 border border-slate-200 rounded-lg text-xs font-mono focus:outline-none"})]}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("label",{className:"block text-[10px] text-slate-400 font-semibold mb-1",children:"文字填充颜色"}),jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntimeExports.jsx("input",{type:"color",value:ee.color||"#000000",onChange:d=>fe("color",d.target.value),onBlur:d=>Ie("color",d.target.value),className:"w-8 h-8 rounded border border-slate-200 cursor-pointer shrink-0"}),jsxRuntimeExports.jsx("span",{className:"font-mono text-[11px] text-slate-500",children:ee.color||"#000000"})]})]})]}),(l.type==="rectangle"||l.type==="shape")&&jsxRuntimeExports.jsxs("div",{className:"bg-white p-3 rounded-xl border border-slate-200 shadow-sm space-y-3",children:[jsxRuntimeExports.jsx("h4",{className:"font-bold text-slate-700 text-xs border-b border-slate-100 pb-1.5",children:"矩形样式配置"}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("label",{className:"block text-[10px] text-slate-400 font-semibold mb-1",children:"外边框颜色"}),jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntimeExports.jsx("input",{type:"color",value:ee.stroke||"#000000",onChange:d=>fe("stroke",d.target.value),onBlur:d=>Ie("stroke",d.target.value),className:"w-8 h-8 rounded border border-slate-200 cursor-pointer shrink-0"}),jsxRuntimeExports.jsx("span",{className:"font-mono text-[11px] text-slate-500",children:ee.stroke||"#000000"})]})]})]}),l.type==="circle"&&jsxRuntimeExports.jsxs("div",{className:"bg-white p-3 rounded-xl border border-slate-200 shadow-sm space-y-3",children:[jsxRuntimeExports.jsx("h4",{className:"font-bold text-slate-700 text-xs border-b border-slate-100 pb-1.5",children:"圆形样式配置"}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("label",{className:"block text-[10px] text-slate-400 font-semibold mb-1",children:"外边框颜色"}),jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntimeExports.jsx("input",{type:"color",value:ee.stroke||"#000000",onChange:d=>fe("stroke",d.target.value),onBlur:d=>Ie("stroke",d.target.value),className:"w-8 h-8 rounded border border-slate-200 cursor-pointer shrink-0"}),jsxRuntimeExports.jsx("span",{className:"font-mono text-[11px] text-slate-500",children:ee.stroke||"#000000"})]})]})]}),l.type==="pen"&&jsxRuntimeExports.jsxs("div",{className:"bg-white p-3 rounded-xl border border-slate-200 shadow-sm space-y-3",children:[jsxRuntimeExports.jsx("h4",{className:"font-bold text-slate-700 text-xs border-b border-slate-100 pb-1.5",children:"线条样式配置"}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("label",{className:"block text-[10px] text-slate-400 font-semibold mb-1",children:"折线颜色"}),jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntimeExports.jsx("input",{type:"color",value:ee.color||"#000000",onChange:d=>fe("color",d.target.value),onBlur:d=>Ie("color",d.target.value),className:"w-8 h-8 rounded border border-slate-200 cursor-pointer shrink-0"}),jsxRuntimeExports.jsx("span",{className:"font-mono text-[11px] text-slate-500",children:ee.color||"#000000"})]})]})]}),l.type==="highlighter"&&jsxRuntimeExports.jsxs("div",{className:"bg-white p-3 rounded-xl border border-slate-200 shadow-sm space-y-3",children:[jsxRuntimeExports.jsx("h4",{className:"font-bold text-slate-700 text-xs border-b border-slate-100 pb-1.5",children:"高亮荧光标记 (Highlighter)"}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("label",{className:"block text-[10px] text-slate-400 font-semibold mb-1",children:"荧光笔颜色"}),jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntimeExports.jsx("input",{type:"color",value:ee.color||"#facc15",onChange:d=>fe("color",d.target.value),onBlur:d=>Ie("color",d.target.value),className:"w-8 h-8 rounded border border-slate-200 cursor-pointer shrink-0"}),jsxRuntimeExports.jsx("span",{className:"font-mono text-[11px] text-slate-500",children:ee.color||"#facc15"})]})]})]}),jsxRuntimeExports.jsx("div",{className:"text-[10px] text-slate-400 text-center select-none pt-2 font-medium",children:"提示:属性在失焦或修改时自动同步,多端可见。"})]}),jsxRuntimeExports.jsxs("div",{className:"p-3 border-t border-slate-200 bg-white flex flex-col gap-2 shrink-0",children:[jsxRuntimeExports.jsx("button",{onClick:()=>Ve(ee),disabled:qe,className:"w-full py-2 bg-indigo-600 hover:bg-indigo-700 text-white rounded-lg font-bold transition-all shadow-sm hover:shadow active:scale-[0.98] cursor-pointer flex items-center justify-center gap-1.5 text-xs",children:qe?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(LoaderCircle,{size:13,className:"animate-spin"}),"正在广播同步..."]}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Paintbrush,{size:13}),"应用修改并强制同步"]})}),jsxRuntimeExports.jsxs("button",{onClick:()=>{Ne(O),te(null)},className:"w-full py-2 bg-red-50 hover:bg-red-105 text-red-650 rounded-lg font-semibold transition-all flex items-center justify-center gap-1.5 border border-red-200 cursor-pointer text-xs",children:[jsxRuntimeExports.jsx(Trash2,{size:13}),"删除当前组件"]})]})]}):null})()]})}),InteractiveWhiteboard$1=Object.freeze(Object.defineProperty({__proto__:null,DEFAULT_WHITEBOARD_PAGES,InteractiveWhiteboard},Symbol.toStringTag,{value:"Module"}));export{Pause as $,Activity as A,Bell as B,ChevronDown as C,Database as D,Eye as E,FileText as F,Globe as G,House as H,Users as I,CircleAlert as J,KeyRound as K,LogOut as L,Minimize2 as M,Lock as N,ArrowRight as O,Presentation as P,Play as Q,RefreshCw as R,Sparkles as S,Terminal as T,User as U,ChevronLeft as V,WandSparkles as W,X,createStore as Y,useStore as Z,Clock as _,Maximize2 as a,ScanLine as a$,Trophy as a0,MessagesSquare as a1,Vote as a2,CircleQuestionMark as a3,usePluginHostStore as a4,ShieldAlert as a5,FileCheck as a6,Award as a7,MessageSquare as a8,CircleCheckBig as a9,Settings as aA,Zap as aB,Github as aC,Code as aD,Info$1 as aE,EyeOff as aF,Tag as aG,Bold as aH,Italic as aI,Underline as aJ,Heading1 as aK,Heading2 as aL,List as aM,ListOrdered as aN,Quote as aO,Highlighter as aP,SquareDot as aQ,Bookmark as aR,Brain as aS,LayoutGrid as aT,Grid3x3 as aU,RotateCcw as aV,CalendarDays as aW,Pen as aX,FileSpreadsheet as aY,Camera as aZ,ImagePlus as a_,Star as aa,Timer as ab,TriangleAlert as ac,CirclePlay as ad,TrendingUp as ae,Funnel as af,Calendar as ag,Compass as ah,TrendingDown as ai,ChartLine as aj,ChartNoAxesColumn as ak,FileBadge as al,PenTool as am,ExtensionPointRenderer as an,Command as ao,ArrowLeft as ap,Send as aq,ChevronUp as ar,Blocks as as,Wrench as at,CalendarClock as au,GripVertical as av,ExternalLink as aw,Save as ax,Square as ay,LucideReact as az,LayoutTemplate as b,Server as b0,Layers as b1,Cpu as b2,Monitor as b3,Menu as b4,DOMExtensionWrapper as b5,PanelRightClose as b6,Paperclip as b7,usePluginHost as b8,SocketService as b9,PluginHostProvider as ba,InteractiveWhiteboard$1 as bb,ClipboardList as c,CircleCheck as d,Puzzle as e,Shuffle as f,Search as g,Upload as h,ChartColumn as i,jsxRuntimeExports as j,CircleX as k,Trash2 as l,BookOpen as m,Plus as n,Markdown as o,ChevronRight as p,LoaderCircle as q,Download as r,Check as s,Folder as t,File as u,Settings2 as v,Percent as w,ListFilter as x,GraduationCap as y,Shield as z};
8343
+ ## Slide 2`,width:600,height:400,slideX:0,slideY:0};case"quiz":return{...$,question:d.question??"New Quiz",options:Array.isArray(d.options)?d.options:["A","B","C","D"]};case"html-applet":return{...$,code:d.code??""};case"assignment":return{...$,title:d.title??"New Assignment",description:d.description??""};case"hello-world":return $;case"rollcall":return{...$,allStudents:[]};default:return{...$,...d}}},Qt=async(l,d)=>{if(!ue.current)return;const _=ue.current.getBoundingClientRect(),I=Math.round(_.width/2),$=Math.round(_.height/2);de(!0);try{await o(l,wt(l,d,I,$)),frontendEventBus.publish({id:v7(),type:"whiteboard.element_updated",source:"whiteboard",payload:{lessonId:e},timestamp:Date.now(),correlationId:e}),c&&c()}catch(N){console.error("addElementAtCenter error",N)}finally{de(!1)}};reactExports.useImperativeHandle(g,()=>({addElementAtCenter:Qt}));const vt=async l=>{l.preventDefault(),l.stopPropagation();try{let d=l.dataTransfer.getData("application/json");if(d||(d=l.dataTransfer.getData("text/plain")),d||(d=l.dataTransfer.getData("text")),d||(d=l.dataTransfer.getData("Text")),console.log("Whiteboard drop triggered. Payload:",d),!d)return;let _;try{_=JSON.parse(d)}catch(q){console.error("Failed to parse drop JSON payload:",q);return}if(typeof _!="object"||!_)return;if(!ue.current){console.warn("containerRef.current is not loaded on drop");return}const I=ue.current.getBoundingClientRect();let $=l.clientX-I.left,N=l.clientY-I.top;console.log(`Adding whiteboard element of type ${_.type} at (${$}, ${N})`),de(!0);try{await o(_.type,wt(_.type,_,$,N)),frontendEventBus.publish({id:v7(),type:"whiteboard.element_updated",source:"whiteboard",payload:{lessonId:e},timestamp:Date.now(),correlationId:e}),c&&c()}finally{de(!1)}}catch(d){console.error("Drop error",d)}};return jsxRuntimeExports.jsxs("div",{className:"flex-1 flex flex-row min-h-0 overflow-hidden bg-white",children:[jsxRuntimeExports.jsxs("div",{className:"flex-1 flex flex-col min-h-0 bg-white relative min-w-0",onDragOver:Mt,onDragEnter:Lt,onDrop:vt,children:[jsxRuntimeExports.jsx(WhiteboardToolbar,{tool:w,setTool:S,setSelectedShapeId:te,highlighterColor:R,setHighlighterColor:C,onElementAdd:o,currentPage:v,activeSegmentId:s,lessonId:e,safeElements:k,selectedShapeId:O,showGrid:F,setShowGrid:U,userRole:u,isSyncing:qe,setIsSyncing:de,handleClearBoard:Vt,handleResetBoard:Ot,handleElementDelete:Ne,setDialog:je,setDialogInput:mt,onRefresh:c}),jsxRuntimeExports.jsxs("div",{ref:ue,className:"flex-1 bg-slate-50/70 rounded-2xl border border-slate-200/80 relative overflow-hidden w-full mb-14 shadow-inner transition-all",style:{backgroundImage:F?"radial-gradient(#cbd5e1 1.2px, transparent 1.2px)":"none",backgroundSize:"24px 24px",backgroundColor:"#f8fafc"},onDragOver:Mt,onDragEnter:Lt,onDragLeave:Jt,onDrop:async l=>{K(!1),await vt(l)},children:[b&&jsxRuntimeExports.jsxs("div",{className:"absolute inset-0 border-2 border-dashed border-indigo-500 bg-indigo-500/10 backdrop-blur-[2px] rounded-2xl flex flex-col items-center justify-center text-indigo-600 font-bold text-sm z-30 animate-in fade-in pointer-events-none",children:[jsxRuntimeExports.jsx(Plus,{size:32,className:"mb-2 text-indigo-600 animate-bounce"}),jsxRuntimeExports.jsx("span",{children:"释放鼠标将组件放入当前白板页面"})]}),k.filter(l=>{if(l.type==="page_meta")return!1;try{const d=JSON.parse(l.data),_=d.page??0,I=Z[v];return!(!(d.pageId&&I?.id?d.pageId===I.id:_===v)||s&&d.segmentId&&d.segmentId!==s)}catch{return v===0}}).length===0&&!Ge&&jsxRuntimeExports.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center pointer-events-none select-none text-slate-400 p-6 z-0",children:[jsxRuntimeExports.jsx("div",{className:"w-16 h-16 rounded-2xl bg-indigo-50/80 border border-indigo-100/80 flex items-center justify-center mb-3 shadow-2xs",children:jsxRuntimeExports.jsx(Sparkles,{className:"w-7 h-7 text-indigo-500 animate-pulse"})}),jsxRuntimeExports.jsx("p",{className:"font-bold text-sm text-slate-700 mb-1",children:"交互式备课白板"}),jsxRuntimeExports.jsx("p",{className:"text-xs text-slate-400 max-w-sm text-center",children:"从左侧组件库拖拽组件至此处,或使用顶部工具栏插入画笔、几何图形与 AI 助教"})]}),jsxRuntimeExports.jsxs("div",{className:"absolute inset-0 w-full h-full overflow-hidden",children:[he.width>0&&he.height>0&&(Ge?(()=>{const l=k.find(N=>N.id===Ge);if(!l)return Ee(null),null;let d={};try{d=JSON.parse(l.data)}catch{}const _=16,I=he.width-_*2,$=he.height-_*2;return jsxRuntimeExports.jsx("div",{className:"absolute inset-0 z-50 bg-black/60 flex items-center justify-center",style:{pointerEvents:"auto"},children:jsxRuntimeExports.jsxs("div",{className:"relative bg-white rounded-xl shadow-2xl overflow-hidden flex flex-col",style:{width:Math.max(400,I),height:Math.max(300,$)},children:[jsxRuntimeExports.jsxs("div",{className:"bg-indigo-50 text-indigo-700 px-4 py-2 flex justify-between items-center text-sm font-semibold border-b border-indigo-100 shrink-0",children:[jsxRuntimeExports.jsx("span",{children:l.type==="quiz"?"📝 随堂测验":l.type==="timer"?"⏱ 计时器":l.type==="assignment"?"📋 作业":l.type==="code-sandbox"?"💻 代码沙箱":l.type==="html-applet"?"🌐 交互课件":l.type==="rollcall"?"🎲 随机点名":l.type}),jsxRuntimeExports.jsxs("button",{onClick:()=>Ee(null),className:"p-1.5 hover:bg-indigo-200/50 rounded-lg text-indigo-600 hover:text-indigo-900 transition-colors cursor-pointer flex items-center gap-1 text-xs",children:[jsxRuntimeExports.jsx(Minimize2,{size:14})," 退出全屏"]})]}),jsxRuntimeExports.jsxs("div",{className:"flex-1 overflow-auto p-6",children:[l.type==="quiz"&&jsxRuntimeExports.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[jsxRuntimeExports.jsx("h3",{className:"text-xl font-bold text-gray-800",children:d.question}),jsxRuntimeExports.jsx("div",{className:"flex flex-col gap-3",children:(d.options||[]).map((N,q)=>jsxRuntimeExports.jsxs("button",{className:"px-5 py-4 text-left bg-gray-50 border-2 border-gray-200 rounded-xl text-base hover:bg-gray-100 transition-colors",children:[jsxRuntimeExports.jsxs("span",{className:"font-bold text-indigo-600 mr-3",children:["ABCDEFGHIJKLMNOPQRSTUVWXYZ"[q],"."]}),N]},q))}),d.submissions&&Object.keys(d.submissions).length>0&&jsxRuntimeExports.jsx("div",{className:"mt-4 p-4 bg-gray-50 rounded-xl",children:jsxRuntimeExports.jsxs("p",{className:"text-sm font-semibold text-gray-600",children:["提交统计: ",Object.keys(d.submissions).length," 人已作答"]})})]}),l.type==="timer"&&jsxRuntimeExports.jsx("div",{className:"flex items-center justify-center h-full",children:jsxRuntimeExports.jsxs("div",{className:"text-center",children:[jsxRuntimeExports.jsxs("div",{className:"text-8xl font-mono font-bold text-orange-600 mb-4",children:[String(Math.floor((d.remaining??d.duration??60)/60)).padStart(2,"0"),":",String((d.remaining??d.duration??60)%60).padStart(2,"0")]}),jsxRuntimeExports.jsx("p",{className:"text-lg text-gray-500",children:d.label||"计时器"})]})}),l.type==="assignment"&&jsxRuntimeExports.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[jsxRuntimeExports.jsx("h3",{className:"text-xl font-bold text-gray-800",children:d.title}),jsxRuntimeExports.jsx("p",{className:"text-gray-600 text-base whitespace-pre-wrap",children:d.description}),jsxRuntimeExports.jsx("button",{className:"w-full bg-orange-600 hover:bg-orange-700 text-white font-medium py-3 rounded-xl transition-colors text-base shadow-sm cursor-pointer",children:"Upload File"})]}),l.type==="code-sandbox"&&jsxRuntimeExports.jsx("div",{className:"h-full flex flex-col gap-4",children:jsxRuntimeExports.jsx("textarea",{value:d.code||"",readOnly:!0,className:"flex-1 p-4 bg-gray-900 text-green-400 font-mono text-sm rounded-xl resize-none"})}),l.type==="html-applet"&&jsxRuntimeExports.jsx("div",{className:"h-full flex items-center justify-center",children:jsxRuntimeExports.jsxs("div",{className:"text-center text-gray-500",children:[jsxRuntimeExports.jsx(BookOpen,{size:64,className:"mx-auto mb-4 text-indigo-300"}),jsxRuntimeExports.jsx("p",{className:"text-lg font-semibold",children:d.title||"交互课件"}),d.coursewareUuid&&jsxRuntimeExports.jsx("iframe",{src:`/runtime/${d.coursewareUuid}/`,sandbox:"allow-scripts allow-same-origin allow-forms allow-downloads",className:"w-full h-[60vh] mt-4 rounded-xl border"})]})}),l.type==="rollcall"&&jsxRuntimeExports.jsx("div",{className:"flex items-center justify-center h-full",children:jsxRuntimeExports.jsxs("div",{className:"text-center",children:[jsxRuntimeExports.jsx("div",{className:"text-6xl font-bold text-indigo-600 mb-4",children:d.selectedStudent||"点击点名"}),jsxRuntimeExports.jsx("p",{className:"text-lg text-gray-500",children:"随机点名"})]})}),!["quiz","timer","assignment","code-sandbox","html-applet","rollcall"].includes(l.type)&&jsxRuntimeExports.jsx("div",{className:"flex items-center justify-center h-full text-gray-400 text-sm",children:"此组件类型暂不支持全屏预览"})]})]})})})():jsxRuntimeExports.jsx(Stage,{width:he.width,height:he.height,onMouseDown:Ut,onMousemove:Wt,onMouseup:Gt,onContextMenu:l=>{l.evt.preventDefault();const d=ue.current?.getBoundingClientRect();if(d){const _=l.evt.clientX-d.left,I=l.evt.clientY-d.top,N=l.target.id();N?(te(N),ae({x:_,y:I,elementId:N})):ae({x:_,y:I})}},ref:ce,className:"w-full h-full cursor-crosshair",children:jsxRuntimeExports.jsxs(Layer,{children:[k.filter(l=>{if(l.type==="page_meta")return!1;try{const d=JSON.parse(l.data),_=d.page??0,I=Z[v];return!(!(d.pageId&&I?.id?d.pageId===I.id:_===v)||s&&d.segmentId&&d.segmentId!==s)}catch{return v===0}}).map(Kt),Xt(),Zt()]})})),O&&(()=>{const l=k.find($=>$.id===O);if(!l)return null;const d=Tt(l);if(!d)return null;const _=Math.max(10,Math.min(he.width-150,d.x-60)),I=Math.max(10,Math.min(he.height-50,d.y));return jsxRuntimeExports.jsxs("div",{style:{left:`${_}px`,top:`${I}px`,pointerEvents:"auto"},className:"absolute bg-white text-gray-800 shadow-xl border border-red-200 rounded-lg py-1 px-2 flex items-center gap-1.5 z-30 animate-in fade-in slide-in-from-bottom-2 duration-150 animate-out fade-out duration-100",children:[jsxRuntimeExports.jsx("span",{className:"text-xs font-semibold px-1 text-gray-500 capitalize select-none",children:l.type}),jsxRuntimeExports.jsx("div",{className:"w-[1px] h-3 bg-gray-200"}),jsxRuntimeExports.jsxs("button",{onClick:()=>{Ne(O),te(null)},className:"flex items-center gap-1 text-xs text-red-600 hover:text-white hover:bg-red-600 px-2 py-0.5 rounded transition-all font-medium cursor-pointer",children:[jsxRuntimeExports.jsx(Trash2,{size:12}),"删除"]})]})})(),Pe&&jsxRuntimeExports.jsx("div",{style:{left:`${Pe.x}px`,top:`${Pe.y}px`,pointerEvents:"auto"},className:"absolute bg-white rounded-lg shadow-2xl border border-gray-200 py-1.5 w-44 z-40 font-sans text-sm animate-in fade-in zoom-in-95 duration-100",onClick:l=>l.stopPropagation(),onContextMenu:l=>l.preventDefault(),children:Pe.elementId?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{className:"px-3 py-1 text-[11px] text-gray-500 font-bold uppercase tracking-wider select-none",children:"组件选项"}),jsxRuntimeExports.jsxs("button",{onClick:()=>{const l=Pe.elementId;l&&(Ne(l),O===l&&te(null)),ae(null)},className:"w-full px-3 py-1.5 flex items-center gap-2 text-left text-red-600 hover:bg-red-50 transition-colors text-xs font-semibold",children:[jsxRuntimeExports.jsx(Trash2,{size:14}),"删除此组件"]})]}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{className:"px-3 py-1 text-[11px] text-gray-400 font-bold uppercase tracking-wider select-none",children:"白板操作"}),jsxRuntimeExports.jsxs("button",{onClick:()=>{S("cursor"),ae(null)},className:`w-full px-3 py-1.5 flex items-center gap-2 text-left text-xs font-medium hover:bg-gray-50 transition-colors ${w==="cursor"?"text-indigo-600":"text-gray-750"}`,children:[jsxRuntimeExports.jsx(MousePointer2,{size:14}),"选择工具 (Cursor)"]}),jsxRuntimeExports.jsxs("button",{onClick:()=>{S("pen"),ae(null)},className:`w-full px-3 py-1.5 flex items-center gap-2 text-left text-xs font-medium hover:bg-gray-50 transition-colors ${w==="pen"?"text-indigo-600":"text-gray-750"}`,children:[jsxRuntimeExports.jsx(PenTool,{size:14}),"画笔工具 (Pen)"]}),jsxRuntimeExports.jsxs("button",{onClick:()=>{S("highlighter"),ae(null)},className:`w-full px-3 py-1.5 flex items-center gap-2 text-left text-xs font-medium hover:bg-gray-50 transition-colors ${w==="highlighter"?"text-indigo-600":"text-gray-750"}`,children:[jsxRuntimeExports.jsx(Highlighter,{size:14}),"高亮荧光笔 (Highlighter)"]}),jsxRuntimeExports.jsxs("button",{onClick:()=>{S("rect"),ae(null)},className:`w-full px-3 py-1.5 flex items-center gap-2 text-left text-xs font-medium hover:bg-gray-50 transition-colors ${w==="rect"?"text-indigo-600":"text-gray-750"}`,children:[jsxRuntimeExports.jsx(Square,{size:14}),"矩形工具 (Rectangle)"]}),jsxRuntimeExports.jsxs("button",{onClick:()=>{S("circle"),ae(null)},className:`w-full px-3 py-1.5 flex items-center gap-2 text-left text-xs font-medium hover:bg-gray-50 transition-colors ${w==="circle"?"text-indigo-600":"text-gray-750"}`,children:[jsxRuntimeExports.jsx(Circle,{size:14}),"圆形工具 (Circle)"]}),jsxRuntimeExports.jsxs("button",{onClick:()=>{S("text"),ae(null)},className:`w-full px-3 py-1.5 flex items-center gap-2 text-left text-xs font-medium hover:bg-gray-50 transition-colors ${w==="text"?"text-indigo-600":"text-gray-750"}`,children:[jsxRuntimeExports.jsx(Type,{size:14}),"文本工具 (Text)"]})]})})]})]}),jsxRuntimeExports.jsx(WhiteboardPageBar,{pages:Z,currentPage:v,showPageDrawer:oe,setShowPageDrawer:H,editingPageIdx:E,setEditingPageIdx:J,editingPageTitle:z,setEditingPageTitle:A,activeMenuPageIdx:Q,setActiveMenuPageIdx:se,safeElements:k,handleSwitchPage:be,handleRenamePage:_e,handleDuplicatePage:we,handleMovePage:Ce,handleDeletePage:f,handleAddPage:m}),jsxRuntimeExports.jsx(WhiteboardDialog,{dialog:Ct,dialogInput:bt,setDialogInput:mt,setDialog:je}),jsxRuntimeExports.jsx(CoursewareEntrySelectorModal,{showEntrySelector:Rt,setShowEntrySelector:gt,zipUploadInfo:At,zipCandidates:jt,handlePropsUpdate:Oe,fetchCoursewares:dt})]}),p&&O&&ee&&(()=>{const l=k.find(d=>d.id===O);return l?jsxRuntimeExports.jsxs("div",{className:"w-80 h-full max-h-full bg-slate-50 border-l border-slate-200 flex flex-col font-sans text-xs select-none shadow-xl shrink-0 z-20 animate-in slide-in-from-right duration-200",onPointerDown:d=>d.stopPropagation(),children:[jsxRuntimeExports.jsxs("div",{className:"px-4 py-3 border-b border-slate-200 bg-white flex justify-between items-center shrink-0",children:[jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntimeExports.jsx(Settings,{size:15,className:"text-slate-500 animate-spin",style:{animationDuration:"6s"}}),jsxRuntimeExports.jsx("span",{className:"font-bold text-slate-800 text-sm",children:"属性编辑器"})]}),jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1.5 font-sans",children:[jsxRuntimeExports.jsxs("button",{onClick:zt,disabled:(Ze[O]||[]).length===0,className:`p-1 rounded-lg transition-all flex items-center justify-center gap-1 border border-transparent select-none cursor-pointer ${(Ze[O]||[]).length===0?"text-slate-350 bg-transparent border-transparent opacity-40 cursor-not-allowed":"text-slate-700 bg-slate-50 hover:bg-slate-100 hover:border-slate-200 active:bg-slate-150"}`,title:"撤销属性修改",children:[jsxRuntimeExports.jsx(Undo2,{size:13}),(Ze[O]||[]).length>0&&jsxRuntimeExports.jsx("span",{className:"text-[10px] font-bold text-slate-500",children:(Ze[O]||[]).length})]}),jsxRuntimeExports.jsxs("button",{onClick:Et,disabled:(Ke[O]||[]).length===0,className:`p-1 rounded-lg transition-all flex items-center justify-center gap-1 border border-transparent select-none cursor-pointer ${(Ke[O]||[]).length===0?"text-slate-350 bg-transparent border-transparent opacity-40 cursor-not-allowed":"text-slate-700 bg-slate-50 hover:bg-slate-100 hover:border-slate-200 active:bg-slate-150"}`,title:"重做属性修改",children:[jsxRuntimeExports.jsx(Redo2,{size:13}),(Ke[O]||[]).length>0&&jsxRuntimeExports.jsx("span",{className:"text-[10px] font-bold text-slate-500",children:(Ke[O]||[]).length})]}),jsxRuntimeExports.jsx("div",{className:"h-4 w-px bg-slate-200 mx-0.5 shrink-0"}),jsxRuntimeExports.jsx("button",{onClick:()=>te(null),className:"text-slate-400 hover:text-slate-650 hover:bg-slate-100 p-1 rounded-full transition-all cursor-pointer",title:"关闭属性编辑器",children:jsxRuntimeExports.jsx(X,{size:15})})]})]}),jsxRuntimeExports.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:[jsxRuntimeExports.jsxs("div",{className:"bg-white p-3 rounded-xl border border-slate-200 shadow-sm space-y-2",children:[jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntimeExports.jsx("span",{className:"text-slate-400 text-[10px] font-bold uppercase tracking-wider",children:"组件类型"}),jsxRuntimeExports.jsx("span",{className:"px-2 py-0.5 bg-indigo-50 text-indigo-650 rounded text-[10px] font-bold uppercase tracking-wider",children:l.type})]}),jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntimeExports.jsx("span",{className:"text-slate-400 text-[10px] font-bold uppercase tracking-wider",children:"组件标识"}),jsxRuntimeExports.jsx("span",{className:"font-mono text-slate-500 text-[10px] truncate max-w-[155px]",title:l.id,children:l.id})]})]}),jsxRuntimeExports.jsxs("div",{className:"bg-white p-3 rounded-xl border border-slate-200 shadow-sm space-y-3",children:[jsxRuntimeExports.jsx("h4",{className:"font-bold text-slate-700 text-xs border-b border-slate-100 pb-1.5 flex items-center gap-1.5",children:"物理定位 & 尺寸"}),jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("label",{className:"block text-[10px] text-slate-400 font-semibold mb-1",children:"X 坐标"}),jsxRuntimeExports.jsx("input",{type:"number",value:Math.round(ee.x??0),onChange:d=>fe("x",parseFloat(d.target.value)||0),onBlur:d=>Ue("x",d.target.value),className:"w-full px-2 py-1.5 border border-slate-200 rounded-lg text-xs font-mono focus:outline-none focus:ring-1 focus:ring-indigo-500"})]}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("label",{className:"block text-[10px] text-slate-400 font-semibold mb-1",children:"Y 坐标"}),jsxRuntimeExports.jsx("input",{type:"number",value:Math.round(ee.y??0),onChange:d=>fe("y",parseFloat(d.target.value)||0),onBlur:d=>Ue("y",d.target.value),className:"w-full px-2 py-1.5 border border-slate-200 rounded-lg text-xs font-mono focus:outline-none focus:ring-1 focus:ring-indigo-500"})]})]}),l.type!=="pen"&&l.type!=="circle"&&jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-2 gap-2 mt-2",children:[jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("label",{className:"block text-[10px] text-slate-400 font-semibold mb-1",children:"宽度 (Width)"}),jsxRuntimeExports.jsx("input",{type:"number",min:"50",value:Math.round(ee.width??300),onChange:d=>fe("width",parseFloat(d.target.value)||50),onBlur:d=>Ue("width",d.target.value),className:"w-full px-2 py-1.5 border border-slate-200 rounded-lg text-xs font-mono focus:outline-none focus:ring-1 focus:ring-indigo-500"})]}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("label",{className:"block text-[10px] text-slate-400 font-semibold mb-1",children:"高度 (Height)"}),jsxRuntimeExports.jsx("input",{type:"number",min:"50",value:Math.round(ee.height??300),onChange:d=>fe("height",parseFloat(d.target.value)||50),onBlur:d=>Ue("height",d.target.value),className:"w-full px-2 py-1.5 border border-slate-200 rounded-lg text-xs font-mono focus:outline-none focus:ring-1 focus:ring-indigo-500"})]})]}),l.type==="circle"&&jsxRuntimeExports.jsxs("div",{className:"mt-2",children:[jsxRuntimeExports.jsx("label",{className:"block text-[10px] text-slate-400 font-semibold mb-1",children:"半径 (Radius)"}),jsxRuntimeExports.jsx("input",{type:"number",min:"5",value:Math.round(ee.radius??50),onChange:d=>fe("radius",parseFloat(d.target.value)||5),onBlur:d=>Ue("radius",d.target.value),className:"w-full px-2 py-1.5 border border-slate-200 rounded-lg text-xs font-mono focus:outline-none focus:ring-1 focus:ring-indigo-500"})]})]}),l.type==="quiz"&&jsxRuntimeExports.jsxs("div",{className:"bg-white p-3 rounded-xl border border-slate-200 shadow-sm space-y-3",children:[jsxRuntimeExports.jsx("h4",{className:"font-bold text-slate-700 text-xs border-b border-slate-100 pb-1.5",children:"随堂测验配置"}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("label",{className:"block text-[10px] text-slate-400 font-semibold mb-1",children:"测验题目 (Question)"}),jsxRuntimeExports.jsx("textarea",{value:ee.question||"",onChange:d=>fe("question",d.target.value),onBlur:d=>Ie("question",d.target.value),className:"w-full h-20 p-2 border border-slate-200 rounded-lg text-xs focus:outline-none focus:ring-1 focus:ring-indigo-500 resize-none font-medium leading-relaxed",placeholder:"编写问题描述..."})]}),(ee.options||[]).length>0&&jsxRuntimeExports.jsxs("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-2.5",children:[jsxRuntimeExports.jsx("label",{className:"block text-[10px] text-amber-700 font-bold mb-1.5",children:"⚠️ 正确答案 (Correct Answer)"}),jsxRuntimeExports.jsxs("select",{value:ee.correctAnswer||"",onChange:d=>{fe("correctAnswer",d.target.value),Ie("correctAnswer",d.target.value)},className:`w-full px-2 py-1.5 border rounded-lg text-xs font-medium focus:outline-none focus:ring-1 focus:ring-amber-500 cursor-pointer ${ee.correctAnswer?"border-green-300 bg-green-50 text-green-800":"border-amber-300 bg-white text-amber-800"}`,children:[jsxRuntimeExports.jsx("option",{value:"",children:"-- 请选择正确答案 --"}),(ee.options||[]).map((d,_)=>jsxRuntimeExports.jsx("option",{value:d,children:d},_))]}),!ee.correctAnswer&&jsxRuntimeExports.jsx("p",{className:"text-[9px] text-amber-600 mt-1",children:"未设置正确答案将无法自动判分"})]}),jsxRuntimeExports.jsxs("div",{className:"space-y-2",children:[jsxRuntimeExports.jsx("label",{className:"block text-[10px] text-slate-400 font-semibold",children:"选项列表 (Options)"}),jsxRuntimeExports.jsx("div",{className:"space-y-1.5 max-h-48 overflow-y-auto pr-1",children:(ee.options||[]).map((d,_)=>{const $="ABCDEFGHIJKLMNOPQRSTUVWXYZ"[_]||_+1;return jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1.5",children:[jsxRuntimeExports.jsx("span",{className:"font-bold text-slate-700 bg-slate-100 rounded px-1.5 py-1 text-center shrink-0 min-w-[22px]",children:$}),jsxRuntimeExports.jsx("input",{type:"text",value:d||"",onChange:N=>Dt(_,N.target.value),onBlur:N=>Ht(_,N.target.value),className:"flex-1 px-2 py-1 border border-slate-200 rounded-lg text-xs font-medium"}),jsxRuntimeExports.jsx("button",{onClick:()=>Ft(_),title:"删除选项",className:"text-slate-400 hover:text-red-500 hover:bg-red-50 p-1 rounded-md shrink-0 transition-colors cursor-pointer",children:jsxRuntimeExports.jsx(Trash2,{size:13})})]},_)})}),jsxRuntimeExports.jsxs("button",{onClick:Bt,className:"w-full mt-2 py-1 bg-slate-100 hover:bg-slate-200 text-slate-600 font-bold border border-slate-200/80 rounded-lg flex items-center justify-center gap-1 hover:text-slate-700 transition-all text-[11px] cursor-pointer",children:[jsxRuntimeExports.jsx(Plus,{size:12})," 添加选项"]})]})]}),l.type==="assignment"&&jsxRuntimeExports.jsxs("div",{className:"bg-white p-3 rounded-xl border border-slate-200 shadow-sm space-y-3",children:[jsxRuntimeExports.jsx("h4",{className:"font-bold text-slate-700 text-xs border-b border-slate-100 pb-1.5",children:"作业选项配置"}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("label",{className:"block text-[10px] text-slate-400 font-semibold mb-1",children:"作业任务标题 (Title)"}),jsxRuntimeExports.jsx("input",{type:"text",value:ee.title||"",onChange:d=>fe("title",d.target.value),onBlur:d=>Ie("title",d.target.value),className:"w-full px-2 py-1.5 border border-slate-200 rounded-lg text-xs font-semibold focus:outline-none focus:ring-1 focus:ring-indigo-500",placeholder:"作业名..."})]}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("label",{className:"block text-[10px] text-slate-400 font-semibold mb-1",children:"详细作业要求描述"}),jsxRuntimeExports.jsx("textarea",{value:ee.description||"",onChange:d=>fe("description",d.target.value),onBlur:d=>Ie("description",d.target.value),className:"w-full h-24 p-2 border border-slate-200 rounded-lg text-xs focus:outline-none focus:ring-1 focus:ring-indigo-500 resize-none font-medium leading-relaxed",placeholder:"请输入详细的作业指南..."})]})]}),(l.type==="code-sandbox"||l.type==="html-applet")&&jsxRuntimeExports.jsxs("div",{className:"bg-white p-3 rounded-xl border border-slate-200 shadow-sm space-y-3",children:[jsxRuntimeExports.jsxs("h4",{className:"font-bold text-slate-700 text-xs border-b border-slate-100 pb-1.5 flex justify-between items-center",children:[jsxRuntimeExports.jsx("span",{children:"动态运行代码定制"}),l.type==="html-applet"&&jsxRuntimeExports.jsx("span",{className:"text-[10px] bg-indigo-50 text-indigo-700 px-1.5 py-0.5 rounded-full font-bold",children:"HTML Applet"})]}),l.type==="html-applet"&&jsxRuntimeExports.jsxs("div",{className:"space-y-3 border-b border-slate-100 pb-3",children:[jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("label",{className:"block text-[10px] text-indigo-600 font-bold mb-1",children:"选择 AI 互动课件 (ZIP/HTML):"}),jsxRuntimeExports.jsxs("select",{value:ee.coursewareUuid||"",onChange:d=>{const _=d.target.value;Oe({coursewareUuid:_,resourceId:""})},className:"w-full text-xs p-2 bg-slate-50 border border-indigo-200 hover:border-indigo-300 rounded-lg text-slate-750 focus:outline-none focus:ring-1 focus:ring-indigo-500 transition-all font-semibold",children:[jsxRuntimeExports.jsx("option",{value:"",children:"-- 使用系统资源或自定义代码 --"}),St.map(d=>jsxRuntimeExports.jsxs("option",{value:d.uuid,children:["📁 [互动课件] ",d.name]},d.id))]})]}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("label",{className:"block text-[10px] text-slate-500 font-bold mb-1",children:"选择已有的系统资源:"}),jsxRuntimeExports.jsxs("select",{value:ee.resourceId||"",onChange:d=>{const _=d.target.value;Oe({resourceId:_,coursewareUuid:""})},className:"w-full text-xs p-2 bg-slate-50 border border-slate-200 hover:border-slate-300 rounded-lg text-slate-750 focus:outline-none focus:ring-1 focus:ring-indigo-500 transition-all font-semibold",children:[jsxRuntimeExports.jsx("option",{value:"",children:"-- 使用互动课件或自定义代码 --"}),It.map(d=>jsxRuntimeExports.jsxs("option",{value:d.id,children:["[",d.type==="folder"?"文件夹":"单HTML","] ",d.name]},d.id))]})]}),jsxRuntimeExports.jsxs("div",{className:"bg-slate-50 p-2.5 rounded-xl border border-slate-100 text-[10px] text-slate-500 space-y-2",children:[jsxRuntimeExports.jsx("span",{className:"font-bold text-slate-600 block",children:"上传资源 (会自动保存到对应库):"}),jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[jsxRuntimeExports.jsxs("label",{className:"col-span-2 flex flex-col items-center justify-center p-2 bg-indigo-50 hover:bg-indigo-100 border border-indigo-200 hover:border-indigo-300 rounded-lg cursor-pointer text-center transition-all",children:[jsxRuntimeExports.jsx("span",{className:"font-bold text-indigo-700 text-[10px]",children:"✨ 上传 AI 互动课件 (.zip/.html)"}),jsxRuntimeExports.jsx("input",{type:"file",accept:".zip,.html,.htm",className:"hidden",onChange:async d=>{const _=d.target.files?.[0];if(!_)return;const I=new FileReader;I.onload=async $=>{const N=$.target?.result;try{const q=await fetch("/api/courseware/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:_.name.replace(/\.[^/.]+$/,""),filename:_.name,base64Data:N})});if(q.ok){const G=await q.json();G.need_select_entry?(Pt(G.candidates),qt({uuid:G.uuid,name:G.name}),gt(!0)):(Oe({coursewareUuid:G.uuid,resourceId:""}),dt())}else{const G=await q.json();alert("上传失败: "+(G.error||q.statusText))}}catch(q){console.error("Courseware upload failed:",q)}},I.readAsDataURL(_)}})]}),jsxRuntimeExports.jsxs("label",{className:"flex flex-col items-center justify-center p-2 bg-white hover:bg-slate-100 border border-slate-200 hover:border-slate-300 rounded-lg cursor-pointer text-center transition-all",children:[jsxRuntimeExports.jsx("span",{className:"font-bold text-slate-600 text-[10px]",children:"📄 上传系统HTML文件"}),jsxRuntimeExports.jsx("input",{type:"file",accept:".html,.htm",className:"hidden",onChange:async d=>{const _=d.target.files?.[0];if(!_)return;const I=new FileReader;I.onload=async $=>{const N=$.target?.result;try{const q=await fetch("/api/resources",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:_.name,type:"html",content:N})});if(q.ok){const G=await q.json();Oe({resourceId:G.id,coursewareUuid:""}),st()}}catch(q){console.error("Upload failed:",q)}},I.readAsText(_)}})]}),jsxRuntimeExports.jsxs("label",{className:"flex flex-col items-center justify-center p-2 bg-white hover:bg-slate-100 border border-slate-200 hover:border-slate-300 rounded-lg cursor-pointer text-center transition-all",children:[jsxRuntimeExports.jsx("span",{className:"font-bold text-slate-600 text-[10px]",children:"📁 上传系统文件夹"}),jsxRuntimeExports.jsx("input",{type:"file",webkitdirectory:"",directory:"",multiple:!0,className:"hidden",onChange:async d=>{const _=d.target.files;if(!_||_.length===0)return;const I=[];let $="";for(let N=0;N<_.length;N++){const q=_[N],G=q.webkitRelativePath||q.name;$||($=G.split("/")[0]||"uploaded_resource");const pe=q.name.split(".").pop()?.toLowerCase(),ke=["png","jpg","jpeg","gif","webp","ico"].includes(pe||"");await new Promise(Le=>{const Me=new FileReader;Me.onload=M=>{const B=M.target?.result;I.push({path:G,content:B}),Le()},ke?Me.readAsDataURL(q):Me.readAsText(q)})}try{const N=await fetch("/api/resources",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:$,type:"folder",content:JSON.stringify(I)})});if(N.ok){const q=await N.json();Oe({resourceId:q.id,coursewareUuid:""}),st()}}catch(N){console.error("Folder upload failed:",N)}}})]})]})]})]}),(!ee.resourceId&&!ee.coursewareUuid||l.type==="code-sandbox")&&jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("label",{className:"block text-[10px] text-slate-400 font-semibold mb-1",children:"沙箱程序代码 (Source Code)"}),jsxRuntimeExports.jsx("textarea",{value:ee.code||"",onChange:d=>fe("code",d.target.value),onBlur:d=>Ie("code",d.target.value),className:"w-full h-48 p-3 border border-slate-300 rounded-lg text-xs font-mono focus:outline-none focus:ring-1 focus:ring-indigo-500 bg-slate-900 text-slate-100 resize-none leading-relaxed",placeholder:"// 编写交互沙箱代码..."})]})]}),l.type==="math-graph"&&jsxRuntimeExports.jsxs("div",{className:"bg-white p-3 rounded-xl border border-slate-200 shadow-sm space-y-3",children:[jsxRuntimeExports.jsx("h4",{className:"font-bold text-slate-700 text-xs border-b border-slate-100 pb-1.5",children:"函数解析拟合"}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("label",{className:"block text-[10px] text-slate-400 font-semibold mb-1",children:"函数表达式 y = f(x)"}),jsxRuntimeExports.jsx("input",{type:"text",value:ee.equation||"",onChange:d=>fe("equation",d.target.value),onBlur:d=>Ie("equation",d.target.value),className:"w-full px-2 py-1.5 border border-slate-200 rounded-lg text-xs font-mono focus:outline-none focus:ring-1 focus:ring-indigo-100"}),jsxRuntimeExports.jsxs("p",{className:"text-[10px] text-slate-400 mt-1 leading-snug",children:["支持标准 JS 表达式。 示例:",jsxRuntimeExports.jsx("br",{}),"• ",jsxRuntimeExports.jsx("code",{className:"bg-slate-100 px-1 rounded",children:"Math.sin(x)"})," 正负弦波形",jsxRuntimeExports.jsx("br",{}),"• ",jsxRuntimeExports.jsx("code",{className:"bg-slate-100 px-1 rounded",children:"Math.cos(x) * x"})," 振幅衰减"]})]})]}),l.type==="presentation"&&jsxRuntimeExports.jsxs("div",{className:"bg-white p-3 rounded-xl border border-slate-200 shadow-sm space-y-3",children:[jsxRuntimeExports.jsx("h4",{className:"font-bold text-slate-700 text-xs border-b border-slate-100 pb-1.5",children:"幻灯片 Markdown 文案"}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("label",{className:"block text-[10px] text-slate-400 font-semibold mb-1",children:"Markdown 源代码"}),jsxRuntimeExports.jsx("textarea",{value:ee.markdown||"",onChange:d=>fe("markdown",d.target.value),onBlur:d=>Ie("markdown",d.target.value),className:"w-full h-64 p-2.5 border border-slate-200 rounded-lg text-xs font-mono focus:outline-none focus:ring-1 focus:ring-indigo-100 resize-none font-medium leading-relaxed bg-slate-50",placeholder:"修改 Markdown 内容..."})]})]}),l.type==="text"&&jsxRuntimeExports.jsxs("div",{className:"bg-white p-3 rounded-xl border border-slate-200 shadow-sm space-y-3",children:[jsxRuntimeExports.jsx("h4",{className:"font-bold text-slate-700 text-xs border-b border-slate-100 pb-1.5",children:"文字属性管理"}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("label",{className:"block text-[10px] text-slate-400 font-semibold mb-1",children:"文本内容"}),jsxRuntimeExports.jsx("input",{type:"text",value:ee.text||"",onChange:d=>fe("text",d.target.value),onBlur:d=>Ie("text",d.target.value),className:"w-full px-2 py-1.5 border border-slate-200 rounded-lg text-xs font-medium focus:outline-none focus:ring-1 focus:ring-indigo-500"})]}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("label",{className:"block text-[10px] text-slate-400 font-semibold mb-1",children:"文字大小 (FontSize)"}),jsxRuntimeExports.jsx("input",{type:"number",min:"10",max:"100",value:ee.fontSize||16,onChange:d=>fe("fontSize",parseInt(d.target.value)||10),onBlur:d=>Ue("fontSize",d.target.value),className:"w-full px-2 py-1.5 border border-slate-200 rounded-lg text-xs font-mono focus:outline-none"})]}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("label",{className:"block text-[10px] text-slate-400 font-semibold mb-1",children:"文字填充颜色"}),jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntimeExports.jsx("input",{type:"color",value:ee.color||"#000000",onChange:d=>fe("color",d.target.value),onBlur:d=>Ie("color",d.target.value),className:"w-8 h-8 rounded border border-slate-200 cursor-pointer shrink-0"}),jsxRuntimeExports.jsx("span",{className:"font-mono text-[11px] text-slate-500",children:ee.color||"#000000"})]})]})]}),(l.type==="rectangle"||l.type==="shape")&&jsxRuntimeExports.jsxs("div",{className:"bg-white p-3 rounded-xl border border-slate-200 shadow-sm space-y-3",children:[jsxRuntimeExports.jsx("h4",{className:"font-bold text-slate-700 text-xs border-b border-slate-100 pb-1.5",children:"矩形样式配置"}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("label",{className:"block text-[10px] text-slate-400 font-semibold mb-1",children:"外边框颜色"}),jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntimeExports.jsx("input",{type:"color",value:ee.stroke||"#000000",onChange:d=>fe("stroke",d.target.value),onBlur:d=>Ie("stroke",d.target.value),className:"w-8 h-8 rounded border border-slate-200 cursor-pointer shrink-0"}),jsxRuntimeExports.jsx("span",{className:"font-mono text-[11px] text-slate-500",children:ee.stroke||"#000000"})]})]})]}),l.type==="circle"&&jsxRuntimeExports.jsxs("div",{className:"bg-white p-3 rounded-xl border border-slate-200 shadow-sm space-y-3",children:[jsxRuntimeExports.jsx("h4",{className:"font-bold text-slate-700 text-xs border-b border-slate-100 pb-1.5",children:"圆形样式配置"}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("label",{className:"block text-[10px] text-slate-400 font-semibold mb-1",children:"外边框颜色"}),jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntimeExports.jsx("input",{type:"color",value:ee.stroke||"#000000",onChange:d=>fe("stroke",d.target.value),onBlur:d=>Ie("stroke",d.target.value),className:"w-8 h-8 rounded border border-slate-200 cursor-pointer shrink-0"}),jsxRuntimeExports.jsx("span",{className:"font-mono text-[11px] text-slate-500",children:ee.stroke||"#000000"})]})]})]}),l.type==="pen"&&jsxRuntimeExports.jsxs("div",{className:"bg-white p-3 rounded-xl border border-slate-200 shadow-sm space-y-3",children:[jsxRuntimeExports.jsx("h4",{className:"font-bold text-slate-700 text-xs border-b border-slate-100 pb-1.5",children:"线条样式配置"}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("label",{className:"block text-[10px] text-slate-400 font-semibold mb-1",children:"折线颜色"}),jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntimeExports.jsx("input",{type:"color",value:ee.color||"#000000",onChange:d=>fe("color",d.target.value),onBlur:d=>Ie("color",d.target.value),className:"w-8 h-8 rounded border border-slate-200 cursor-pointer shrink-0"}),jsxRuntimeExports.jsx("span",{className:"font-mono text-[11px] text-slate-500",children:ee.color||"#000000"})]})]})]}),l.type==="highlighter"&&jsxRuntimeExports.jsxs("div",{className:"bg-white p-3 rounded-xl border border-slate-200 shadow-sm space-y-3",children:[jsxRuntimeExports.jsx("h4",{className:"font-bold text-slate-700 text-xs border-b border-slate-100 pb-1.5",children:"高亮荧光标记 (Highlighter)"}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("label",{className:"block text-[10px] text-slate-400 font-semibold mb-1",children:"荧光笔颜色"}),jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntimeExports.jsx("input",{type:"color",value:ee.color||"#facc15",onChange:d=>fe("color",d.target.value),onBlur:d=>Ie("color",d.target.value),className:"w-8 h-8 rounded border border-slate-200 cursor-pointer shrink-0"}),jsxRuntimeExports.jsx("span",{className:"font-mono text-[11px] text-slate-500",children:ee.color||"#facc15"})]})]})]}),jsxRuntimeExports.jsx("div",{className:"text-[10px] text-slate-400 text-center select-none pt-2 font-medium",children:"提示:属性在失焦或修改时自动同步,多端可见。"})]}),jsxRuntimeExports.jsxs("div",{className:"p-3 border-t border-slate-200 bg-white flex flex-col gap-2 shrink-0",children:[jsxRuntimeExports.jsx("button",{onClick:()=>Ve(ee),disabled:qe,className:"w-full py-2 bg-indigo-600 hover:bg-indigo-700 text-white rounded-lg font-bold transition-all shadow-sm hover:shadow active:scale-[0.98] cursor-pointer flex items-center justify-center gap-1.5 text-xs",children:qe?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(LoaderCircle,{size:13,className:"animate-spin"}),"正在广播同步..."]}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Paintbrush,{size:13}),"应用修改并强制同步"]})}),jsxRuntimeExports.jsxs("button",{onClick:()=>{Ne(O),te(null)},className:"w-full py-2 bg-red-50 hover:bg-red-105 text-red-650 rounded-lg font-semibold transition-all flex items-center justify-center gap-1.5 border border-red-200 cursor-pointer text-xs",children:[jsxRuntimeExports.jsx(Trash2,{size:13}),"删除当前组件"]})]})]}):null})()]})}),InteractiveWhiteboard$1=Object.freeze(Object.defineProperty({__proto__:null,DEFAULT_WHITEBOARD_PAGES,InteractiveWhiteboard},Symbol.toStringTag,{value:"Module"}));export{Pause as $,Activity as A,Bell as B,ChevronDown as C,Database as D,Eye as E,FileText as F,Globe as G,House as H,Users as I,CircleAlert as J,KeyRound as K,LogOut as L,Minimize2 as M,Lock as N,ArrowRight as O,Presentation as P,Play as Q,RefreshCw as R,Sparkles as S,Terminal as T,User as U,ChevronLeft as V,WandSparkles as W,X,createStore as Y,useStore as Z,Clock as _,Maximize2 as a,ScanLine as a$,Trophy as a0,MessagesSquare as a1,Vote as a2,CircleQuestionMark as a3,usePluginHostStore as a4,ShieldAlert as a5,FileCheck as a6,Award as a7,MessageSquare as a8,CircleCheckBig as a9,Settings as aA,Zap as aB,Github as aC,Code as aD,Info$1 as aE,EyeOff as aF,Tag as aG,Bold as aH,Italic as aI,Underline as aJ,Heading1 as aK,Heading2 as aL,List as aM,ListOrdered as aN,Quote as aO,Highlighter as aP,SquareDot as aQ,Bookmark as aR,Brain as aS,LayoutGrid as aT,Grid3x3 as aU,RotateCcw as aV,CalendarDays as aW,Pen as aX,FileSpreadsheet as aY,Camera as aZ,ImagePlus as a_,Star as aa,Timer as ab,TriangleAlert as ac,CirclePlay as ad,TrendingUp as ae,Funnel as af,Calendar as ag,Compass as ah,TrendingDown as ai,ChartLine as aj,ChartNoAxesColumn as ak,FileBadge as al,PenTool as am,ExtensionPointRenderer as an,Command as ao,ArrowLeft as ap,Send as aq,ChevronUp as ar,Blocks as as,Wrench as at,CalendarClock as au,GripVertical as av,ExternalLink as aw,Save as ax,Square as ay,LucideReact as az,LayoutTemplate as b,Server as b0,Layers as b1,Cpu as b2,Monitor as b3,Menu as b4,DOMExtensionWrapper as b5,PanelRightClose as b6,Paperclip as b7,usePluginHost as b8,SocketService as b9,PluginHostProvider as ba,InteractiveWhiteboard$1 as bb,ClipboardList as c,CircleCheck as d,Puzzle as e,Shuffle as f,Search as g,Upload as h,ChartColumn as i,jsxRuntimeExports as j,CircleX as k,Trash2 as l,BookOpen as m,Plus as n,Markdown as o,ChevronRight as p,LoaderCircle as q,Download as r,Check as s,Folder as t,File as u,Settings2 as v,Percent as w,ListFilter as x,GraduationCap as y,Shield as z};
package/dist/index.html CHANGED
@@ -15,7 +15,7 @@
15
15
  }
16
16
  }
17
17
  </script>
18
- <script type="module" crossorigin src="/assets/index-zi7zNIte.js"></script>
18
+ <script type="module" crossorigin src="/assets/index-4xDvXGZ_.js"></script>
19
19
  <link rel="stylesheet" crossorigin href="/assets/vendor-reveal-DcQQzuI9.css">
20
20
  <link rel="stylesheet" crossorigin href="/assets/index-CaJDJGky.css">
21
21
  </head>