@hydralms/components 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/StudentProfile-BPsZBaJj.cjs +1 -0
- package/dist/{StudentProfile-DeMxdrL3.js → StudentProfile-Cw2p-RZn.js} +577 -579
- package/dist/index.cjs +1 -1
- package/dist/index.js +172 -166
- package/dist/license/index.d.ts +2 -2
- package/dist/license/tiers.d.ts +3 -0
- package/dist/modules.cjs +1 -1
- package/dist/modules.js +111 -110
- package/dist/sections/AdaptiveLearningPath/AdaptiveLearningPath.d.ts +5 -0
- package/dist/sections/AdaptiveLearningPath/path-connector.d.ts +8 -0
- package/dist/sections/AdaptiveLearningPath/path-milestone-marker.d.ts +7 -0
- package/dist/sections/AdaptiveLearningPath/path-node-card.d.ts +10 -0
- package/dist/sections/AdaptiveLearningPath/path-skill-bar.d.ts +8 -0
- package/dist/sections/AdaptiveLearningPath/types.d.ts +136 -0
- package/dist/sections/ContentAuthoringStudio/ContentAuthoringStudio.d.ts +5 -0
- package/dist/sections/ContentAuthoringStudio/block-editor-item.d.ts +14 -0
- package/dist/sections/ContentAuthoringStudio/block-type-picker.d.ts +12 -0
- package/dist/sections/ContentAuthoringStudio/types.d.ts +67 -0
- package/dist/sections/index.d.ts +4 -0
- package/dist/sections.cjs +1 -1
- package/dist/sections.js +1325 -232
- package/dist/withProGate-BJdu1T9Y.cjs +2 -0
- package/dist/withProGate-BvFc7Jwy.js +4975 -0
- package/package.json +24 -7
- package/src/license/index.ts +2 -2
- package/src/license/tiers.ts +12 -2
- package/src/modules/CoursePlayer/CoursePlayer.tsx +3 -1
- package/src/progress/stat-card.tsx +10 -5
- package/src/sections/AdaptiveLearningPath/AdaptiveLearningPath.tsx +251 -0
- package/src/sections/AdaptiveLearningPath/path-connector.tsx +27 -0
- package/src/sections/AdaptiveLearningPath/path-milestone-marker.tsx +50 -0
- package/src/sections/AdaptiveLearningPath/path-node-card.tsx +166 -0
- package/src/sections/AdaptiveLearningPath/path-skill-bar.tsx +49 -0
- package/src/sections/AdaptiveLearningPath/types.ts +159 -0
- package/src/sections/ContentAuthoringStudio/ContentAuthoringStudio.tsx +289 -0
- package/src/sections/ContentAuthoringStudio/block-editor-item.tsx +487 -0
- package/src/sections/ContentAuthoringStudio/block-type-picker.tsx +123 -0
- package/src/sections/ContentAuthoringStudio/types.ts +67 -0
- package/src/sections/ForumBoard/ForumBoard.tsx +8 -6
- package/src/sections/LessonPage/LessonPage.tsx +4 -7
- package/src/sections/index.ts +18 -0
- package/src/video/video-player.tsx +14 -5
- package/dist/StudentProfile-BVfZMbnV.cjs +0 -1
- package/dist/tabs-BsfVo2Bl.cjs +0 -173
- package/dist/tabs-BuY1iNJE.js +0 -22305
- package/dist/withProGate-BWqcKdPM.js +0 -137
- package/dist/withProGate-DX6XqKLp.cjs +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),b=require("lucide-react"),u=require("react"),B=require("class-variance-authority"),ee=require("react-dom"),me=require("@tiptap/react"),Rt=require("@tiptap/starter-kit"),$t=require("@tiptap/extension-placeholder"),Ht=require("@tiptap/extension-underline"),Pt=require("@tiptap/extension-link"),At=require("clsx"),Bt=require("tailwind-merge");function Ut(s){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const r in s)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(s,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>s[r]})}}return t.default=s,Object.freeze(t)}const G=Ut(u);function g(...s){return Bt.twMerge(At.clsx(s))}const ye=B.cva("relative flex w-full items-start gap-3 rounded-lg border p-4 text-sm [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:translate-y-0.5",{variants:{variant:{default:"bg-card text-foreground",destructive:"border-destructive/50 bg-destructive/5 text-destructive [&>svg]:text-destructive",success:"border-success/50 bg-success/5 text-success [&>svg]:text-success",warning:"border-warning/50 bg-warning/5 text-warning [&>svg]:text-warning",info:"border-info/50 bg-info/5 text-info [&>svg]:text-info"}},defaultVariants:{variant:"default"}});function I({className:s,variant:t,...r}){return e.jsx("div",{"data-slot":"alert",role:"alert",className:g(ye({variant:t}),s),...r})}function Ft({className:s,...t}){return e.jsx("div",{"data-slot":"alert-title",className:g("font-medium leading-normal tracking-tight",s),...t})}function L({className:s,...t}){return e.jsx("div",{"data-slot":"alert-description",className:g("text-foreground text-sm [&_p]:leading-relaxed",s),...t})}const Ne=u.memo(function({question:t,sessionAnswers:r,onAnswer:n,readOnly:a=!1,showCorrectAnswers:o=!1,disabled:i=!1}){const[l,c]=u.useState(()=>(r==null?void 0:r.map(f=>f.answerUid))||[]),x=u.useMemo(()=>[...t.answers||[]].sort((f,d)=>f.sequence-d.sequence),[t.answers]),p=f=>{a||i||c(d=>{const m=d.includes(f)?d.filter(v=>v!==f):[...d,f];return n==null||n(m.map(v=>({uid:v}))),m})},h=f=>{var m;if(!o)return"";const d=(m=t.answers)==null?void 0:m.find(v=>v.uid===f);return d!=null&&d.isCorrect?"bg-success/10 border border-success/30 px-2":l.includes(f)&&!(d!=null&&d.isCorrect)?"bg-destructive/10 border border-destructive/30 px-2":""};return e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("div",{dangerouslySetInnerHTML:{__html:t.content}}),e.jsxs("fieldset",{className:"flex flex-col gap-2 border-0 p-0 m-0",children:[e.jsx("legend",{className:"sr-only",children:"Select all correct answers"}),x.map(f=>e.jsx("div",{className:g("rounded-md transition-colors",h(f.uid)),children:e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer py-1 has-[input:disabled]:cursor-default has-[input:disabled]:opacity-60",children:[e.jsx("input",{type:"checkbox",checked:l.includes(f.uid),onChange:()=>p(f.uid),disabled:a||i,className:"accent-primary m-0 shrink-0"}),e.jsx("span",{className:"text-sm",dangerouslySetInnerHTML:{__html:f.content}}),o&&f.isCorrect&&e.jsx("span",{className:"sr-only",children:"(Correct answer)"}),o&&l.includes(f.uid)&&!f.isCorrect&&e.jsx("span",{className:"sr-only",children:"(Your answer — incorrect)"})]})},f.uid))]}),o&&t.explanation&&e.jsx(I,{className:"mt-2",children:e.jsxs(L,{children:[e.jsx("strong",{children:"Explanation:"})," ",e.jsx("span",{dangerouslySetInnerHTML:{__html:t.explanation}})]})})]})}),we=u.memo(function({question:t,sessionAnswers:r,onAnswer:n,readOnly:a=!1,showCorrectAnswers:o=!1,disabled:i=!1}){const[l,c]=u.useState(()=>{var f;return((f=r==null?void 0:r[0])==null?void 0:f.answerUid)||""}),x=u.useMemo(()=>[...t.answers||[]].sort((f,d)=>f.sequence-d.sequence),[t.answers]),p=f=>{a||i||(c(f),n==null||n([{uid:f}]))},h=f=>{var m;if(!o)return"px-2";const d=(m=t.answers)==null?void 0:m.find(v=>v.uid===f);return d!=null&&d.isCorrect?"bg-success/10 border border-success/30 px-2":l===f&&!(d!=null&&d.isCorrect)?"bg-destructive/10 border border-destructive/30 px-2":"px-2"};return e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("div",{dangerouslySetInnerHTML:{__html:t.content}}),e.jsxs("fieldset",{className:"flex flex-col gap-2 border-0 p-0 m-0",children:[e.jsx("legend",{className:"sr-only",children:"Answer choices"}),x.map(f=>e.jsx("div",{className:g("rounded-md transition-colors",h(f.uid)),children:e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer py-1 has-[input:disabled]:cursor-default has-[input:disabled]:opacity-60",children:[e.jsx("input",{type:"radio",name:t.uid,value:f.uid,checked:l===f.uid,onChange:()=>p(f.uid),disabled:a||i,className:"accent-primary m-0 shrink-0"}),e.jsx("span",{dangerouslySetInnerHTML:{__html:f.content}}),o&&f.isCorrect&&e.jsx("span",{className:"sr-only",children:"(Correct answer)"}),o&&l===f.uid&&!f.isCorrect&&e.jsx("span",{className:"sr-only",children:"(Your answer — incorrect)"})]})},f.uid))]}),o&&t.explanation&&e.jsx(I,{className:"mt-2",children:e.jsxs(L,{children:[e.jsx("strong",{children:"Explanation:"})," ",e.jsx("span",{dangerouslySetInnerHTML:{__html:t.explanation}})]})})]})}),Ce=u.memo(function({question:t,sessionAnswers:r,onAnswer:n,readOnly:a=!1,showCorrectAnswers:o=!1,disabled:i=!1}){const[l,c]=u.useState(()=>{var f;return((f=r==null?void 0:r[0])==null?void 0:f.answerUid)||""}),x=u.useMemo(()=>[...t.answers||[]].sort((f,d)=>f.sequence-d.sequence),[t.answers]),p=f=>{a||i||(c(f),n==null||n([{uid:f}]))},h=f=>{var m;if(!o)return"px-2";const d=(m=t.answers)==null?void 0:m.find(v=>v.uid===f);return d!=null&&d.isCorrect?"bg-success/10 border border-success/30 px-2":l===f&&!(d!=null&&d.isCorrect)?"bg-destructive/10 border border-destructive/30 px-2":"px-2"};return e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("div",{dangerouslySetInnerHTML:{__html:t.content}}),e.jsxs("fieldset",{className:"flex flex-col gap-2 border-0 p-0 m-0",children:[e.jsx("legend",{className:"sr-only",children:"True or False"}),x.map(f=>e.jsx("div",{className:g("rounded-md transition-colors",h(f.uid)),children:e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer py-1 has-[input:disabled]:cursor-default has-[input:disabled]:opacity-60",children:[e.jsx("input",{type:"radio",name:t.uid,value:f.uid,checked:l===f.uid,onChange:()=>p(f.uid),disabled:a||i,className:"accent-primary m-0 shrink-0"}),e.jsx("span",{dangerouslySetInnerHTML:{__html:f.content}}),o&&f.isCorrect&&e.jsx("span",{className:"sr-only",children:"(Correct answer)"}),o&&l===f.uid&&!f.isCorrect&&e.jsx("span",{className:"sr-only",children:"(Your answer — incorrect)"})]})},f.uid))]}),o&&t.explanation&&e.jsx(I,{className:"mt-2",children:e.jsxs(L,{children:[e.jsx("strong",{children:"Explanation:"})," ",e.jsx("span",{dangerouslySetInnerHTML:{__html:t.explanation}})]})})]})});function O(s,t){let r;const n=(...a)=>{clearTimeout(r),r=setTimeout(()=>s(...a),t)};return n.cancel=()=>clearTimeout(r),n}function Z({className:s,type:t,...r}){return e.jsx("input",{type:t,"data-slot":"input",className:g("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-sm shadow-xs outline-none transition-[color,box-shadow] file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:opacity-50","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 aria-invalid:border-destructive",s),...r})}const ke=u.memo(function({question:t,sessionAnswers:r,onAnswer:n,readOnly:a=!1,showCorrectAnswers:o=!1,disabled:i=!1}){var m,v,y,k;const l=u.useId(),[c,x]=u.useState(()=>{var S;return((S=r==null?void 0:r[0])==null?void 0:S.content)||""}),p=u.useRef(n);p.current=n;const h=u.useRef(((v=(m=t.answers)==null?void 0:m[0])==null?void 0:v.uid)||"");h.current=((k=(y=t.answers)==null?void 0:y[0])==null?void 0:k.uid)||"";const f=u.useMemo(()=>O(S=>{var C;(C=p.current)==null||C.call(p,[{uid:h.current,content:S}])},300),[]);u.useEffect(()=>()=>f.cancel(),[f]);const d=S=>{const C=S.target.value;x(C),f(C)};return e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("div",{dangerouslySetInnerHTML:{__html:t.content}}),e.jsx("label",{htmlFor:l,className:"sr-only",children:"Your answer"}),e.jsx(Z,{id:l,value:c,onChange:d,placeholder:"Type your answer here...",disabled:a||i}),o&&t.explanation&&e.jsx(I,{className:"mt-1",children:e.jsxs(L,{children:[e.jsx("strong",{children:"Explanation:"})," ",e.jsx("span",{dangerouslySetInnerHTML:{__html:t.explanation}})]})})]})});function A({className:s,orientation:t="horizontal",decorative:r=!0,...n}){return e.jsx("div",{"data-slot":"separator",role:r?"none":"separator","aria-orientation":r?void 0:t,className:g("bg-border shrink-0",t==="horizontal"?"h-px w-full":"h-full w-px",s),...n})}function R({active:s,disabled:t,onClick:r,title:n,children:a}){return e.jsx("button",{type:"button",onClick:r,disabled:t,title:n,"aria-label":n,className:g("inline-flex items-center justify-center rounded-sm p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-50",s&&"bg-muted text-foreground"),children:a})}function Vt({editor:s,variant:t="default"}){function n(){const a=s.getAttributes("link").href,o=window.prompt("Enter URL",a||"https://");o!==null&&(o===""?s.chain().focus().extendMarkRange("link").unsetLink().run():s.chain().focus().extendMarkRange("link").setLink({href:o}).run())}return e.jsxs("div",{className:"flex items-center gap-0.5 border-b border-border px-2 py-1.5",role:"toolbar","aria-label":"Text formatting",children:[e.jsx(R,{active:s.isActive("bold"),onClick:()=>s.chain().focus().toggleBold().run(),title:"Bold",children:e.jsx(b.Bold,{size:16})}),e.jsx(R,{active:s.isActive("italic"),onClick:()=>s.chain().focus().toggleItalic().run(),title:"Italic",children:e.jsx(b.Italic,{size:16})}),e.jsx(R,{active:s.isActive("underline"),onClick:()=>s.chain().focus().toggleUnderline().run(),title:"Underline",children:e.jsx(b.Underline,{size:16})}),e.jsx(A,{orientation:"vertical",className:"mx-1 h-5"}),e.jsx(R,{active:s.isActive("bulletList"),onClick:()=>s.chain().focus().toggleBulletList().run(),title:"Bullet list",children:e.jsx(b.List,{size:16})}),e.jsx(R,{active:s.isActive("orderedList"),onClick:()=>s.chain().focus().toggleOrderedList().run(),title:"Ordered list",children:e.jsx(b.ListOrdered,{size:16})}),e.jsx(A,{orientation:"vertical",className:"mx-1 h-5"}),e.jsx(R,{active:s.isActive("link"),onClick:n,title:"Link",children:e.jsx(b.Link,{size:16})}),t==="default"&&e.jsxs(e.Fragment,{children:[e.jsx(A,{orientation:"vertical",className:"mx-1 h-5"}),e.jsx(R,{active:s.isActive("heading",{level:2}),onClick:()=>s.chain().focus().toggleHeading({level:2}).run(),title:"Heading",children:e.jsx(b.Heading2,{size:16})}),e.jsx(R,{active:s.isActive("blockquote"),onClick:()=>s.chain().focus().toggleBlockquote().run(),title:"Blockquote",children:e.jsx(b.Quote,{size:16})}),e.jsx(R,{active:s.isActive("codeBlock"),onClick:()=>s.chain().focus().toggleCodeBlock().run(),title:"Code block",children:e.jsx(b.Code,{size:16})})]})]})}function Se({value:s="",onChange:t,placeholder:r,readOnly:n=!1,disabled:a=!1,variant:o="default",ariaLabel:i="Rich text editor",className:l,style:c}){const x=me.useEditor({extensions:[Rt,Ht,Pt.configure({openOnClick:!1,HTMLAttributes:{class:"text-primary underline"}}),$t.configure({placeholder:r})],content:s,editable:!n&&!a,editorProps:{attributes:{"aria-label":i,role:"textbox","aria-multiline":"true"}},onUpdate:({editor:p})=>{t==null||t(p.getHTML())}});return u.useEffect(()=>{x&&x.getHTML()!==s&&x.commands.setContent(s,{emitUpdate:!1})},[x,s]),u.useEffect(()=>{x&&x.setEditable(!n&&!a)},[x,n,a]),x?e.jsxs("div",{className:g("rounded-md border border-input bg-transparent text-sm shadow-xs transition-[color,box-shadow]","focus-within:border-ring focus-within:ring-ring/50 focus-within:ring-[3px]",a&&"pointer-events-none opacity-50",l),style:c,children:[!n&&!a&&e.jsx(Vt,{editor:x,variant:o}),e.jsx(me.EditorContent,{editor:x,className:g("px-3 py-2 [&_.tiptap]:min-h-16 [&_.tiptap]:outline-none","[&_.tiptap_p]:mb-1 [&_.tiptap_h2]:text-lg [&_.tiptap_h2]:font-semibold [&_.tiptap_h2]:mb-1","[&_.tiptap_ul]:list-disc [&_.tiptap_ul]:pl-5 [&_.tiptap_ol]:list-decimal [&_.tiptap_ol]:pl-5","[&_.tiptap_blockquote]:border-l-2 [&_.tiptap_blockquote]:border-muted-foreground/30 [&_.tiptap_blockquote]:pl-3 [&_.tiptap_blockquote]:italic","[&_.tiptap_pre]:rounded-md [&_.tiptap_pre]:bg-muted [&_.tiptap_pre]:p-3 [&_.tiptap_pre]:font-mono [&_.tiptap_pre]:text-sm")})]}):null}const Te=u.memo(function({question:t,sessionAnswers:r,onAnswer:n,readOnly:a=!1,disabled:o=!1}){var f,d,m,v;const[i,l]=u.useState(()=>{var y;return((y=r==null?void 0:r[0])==null?void 0:y.content)||""}),c=u.useRef(n);c.current=n;const x=u.useRef(((d=(f=t.answers)==null?void 0:f[0])==null?void 0:d.uid)||t.uid);x.current=((v=(m=t.answers)==null?void 0:m[0])==null?void 0:v.uid)||t.uid;const p=u.useMemo(()=>O(y=>{var k;(k=c.current)==null||k.call(c,[{uid:x.current,content:y}])},500),[]);u.useEffect(()=>()=>p.cancel(),[p]);const h=y=>{l(y),p(y)};return e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("div",{dangerouslySetInnerHTML:{__html:t.content}}),e.jsx(Se,{className:"min-h-30",value:i,onChange:h,placeholder:"Write your response here...",readOnly:a,disabled:o,variant:"default",ariaLabel:"Essay response"})]})}),De=u.memo(function({question:t,sessionAnswers:r,onAnswer:n,readOnly:a=!1,showCorrectAnswers:o=!1,disabled:i=!1}){const l=u.useId(),[c,x]=u.useState(()=>{var y;return((y=r==null?void 0:r[0])==null?void 0:y.content)||""}),p=u.useRef(n);p.current=n;const h=u.useRef(t.uid);h.current=t.uid;const f=u.useMemo(()=>O(y=>{var k;(k=p.current)==null||k.call(p,[{uid:h.current,content:y}])},300),[]);u.useEffect(()=>()=>f.cancel(),[f]);const d=y=>{const k=y.target.value;x(k),f(k)},m=(()=>{if(!o||t.numericAnswer===void 0)return null;if(c==="")return!1;const y=parseFloat(c);if(isNaN(y))return!1;const k=t.numericTolerance??0;return Math.abs(y-t.numericAnswer)<=k})(),v=!o||m===null?"":m?"border-success/50 bg-success/5":"border-destructive/50 bg-destructive/5";return e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("div",{dangerouslySetInnerHTML:{__html:t.content}}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{htmlFor:l,className:"sr-only",children:"Numeric answer"}),e.jsx(Z,{id:l,type:"number",value:c,onChange:d,placeholder:"Enter a number...",disabled:a||i,className:g("max-w-48",v),step:"any"}),t.numericUnit&&e.jsx("span",{className:"text-muted-foreground text-sm",children:t.numericUnit})]}),o&&t.numericAnswer!==void 0&&e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Correct answer: ",t.numericAnswer,(t.numericTolerance??0)>0&&e.jsxs("span",{children:[" (± ",t.numericTolerance,")"]})]}),o&&t.explanation&&e.jsx(I,{className:"mt-1",children:e.jsxs(L,{children:[e.jsx("strong",{children:"Explanation:"})," ",e.jsx("span",{dangerouslySetInnerHTML:{__html:t.explanation}})]})})]})});function _e({items:s,onReorder:t,disabled:r=!1}){const[n,a]=u.useState(null),[o,i]=u.useState(null),l=u.useRef(null),c=u.useCallback(d=>m=>{if(r){m.preventDefault();return}l.current=d,a(d),m.dataTransfer.effectAllowed="move",m.dataTransfer.setData("text/plain",String(d))},[r]),x=u.useCallback(d=>m=>{m.preventDefault(),m.dataTransfer.dropEffect="move",i(d)},[]),p=u.useCallback(d=>m=>{m.preventDefault();const v=l.current;if(v===null||v===d){a(null),i(null);return}const y=[...s],[k]=y.splice(v,1);y.splice(d,0,k),a(null),i(null),t(y)},[s,t]),h=u.useCallback(()=>{a(null),i(null),l.current=null},[]);return{getDragProps:u.useCallback(d=>({draggable:!r,onDragStart:c(d),onDragOver:x(d),onDrop:p(d),onDragEnd:h}),[r,c,x,p,h]),dragIndex:n,dragOverIndex:o}}const Me=u.memo(function({question:t,sessionAnswers:r,onAnswer:n,readOnly:a=!1,showCorrectAnswers:o=!1,disabled:i=!1}){const l=u.useMemo(()=>[...t.answers||[]].sort((C,T)=>C.sequence-T.sequence),[t.answers]),[c,x]=u.useState(""),[p,h]=u.useState(()=>{if(r&&r.length>0){const C=new Map;for(const T of r)C.set(T.answerUid,parseInt(T.content||"0",10));return[...l].sort((T,M)=>(C.get(T.uid)??0)-(C.get(M.uid)??0))}return[...l].sort(()=>Math.random()-.5)}),f=C=>{n==null||n(C.map((T,M)=>({uid:T.uid,content:String(M)})))},d=C=>{h(C),f(C)},m=(C,T)=>{if(a||i||T<0||T>=p.length)return;const M=[...p],[N]=M.splice(C,1);M.splice(T,0,N),h(M),f(M),x(`${N.content.replace(/<[^>]+>/g,"")} moved to position ${T+1} of ${p.length}`)},{getDragProps:v,dragIndex:y,dragOverIndex:k}=_e({items:p,onReorder:d,disabled:a||i}),S=(C,T)=>o?l.findIndex(N=>N.uid===C.uid)===T?"bg-success/10 border-success/30":"bg-destructive/10 border-destructive/30":"";return e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("div",{dangerouslySetInnerHTML:{__html:t.content}}),e.jsx("span",{className:"sr-only","aria-live":"assertive",role:"status",children:c}),e.jsx("div",{className:"flex flex-col gap-1.5",children:p.map((C,T)=>e.jsxs("div",{...v(T),className:g("flex items-center gap-2 rounded-md border px-3 py-2 transition-all select-none",y===T&&"opacity-50",k===T&&y!==T&&"border-t-2 border-t-primary",!(a||i)&&"cursor-grab active:cursor-grabbing",S(C,T)),children:[!(a||i)&&e.jsx(b.GripVertical,{className:"size-4 text-muted-foreground shrink-0"}),e.jsxs("span",{className:"text-sm font-medium text-muted-foreground w-6 shrink-0",children:[T+1,"."]}),e.jsx("span",{className:"flex-1 text-foreground",dangerouslySetInnerHTML:{__html:C.content}}),!(a||i)&&e.jsxs("div",{className:"flex flex-col shrink-0",children:[e.jsx("button",{type:"button",onClick:()=>m(T,T-1),disabled:T===0,className:"p-0.5 text-muted-foreground hover:text-foreground disabled:opacity-30 disabled:cursor-default","aria-label":`Move ${C.content} up`,children:e.jsx(b.ChevronUp,{className:"size-4"})}),e.jsx("button",{type:"button",onClick:()=>m(T,T+1),disabled:T===p.length-1,className:"p-0.5 text-muted-foreground hover:text-foreground disabled:opacity-30 disabled:cursor-default","aria-label":`Move ${C.content} down`,children:e.jsx(b.ChevronDown,{className:"size-4"})})]}),o&&e.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:["(correct: ",l.findIndex(M=>M.uid===C.uid)+1,")"]})]},C.uid))}),o&&t.explanation&&e.jsx(I,{className:"mt-2",children:e.jsxs(L,{children:[e.jsx("strong",{children:"Explanation:"})," ",e.jsx("span",{dangerouslySetInnerHTML:{__html:t.explanation}})]})})]})}),ze=u.memo(function({question:t,sessionAnswers:r,onAnswer:n,readOnly:a=!1,showCorrectAnswers:o=!1,disabled:i=!1}){const l=u.useMemo(()=>[...t.matchingPairs??[]].sort((j,w)=>j.sequence-w.sequence),[t.matchingPairs]),c=u.useMemo(()=>[...l].sort(()=>Math.random()-.5),[l.map(j=>j.uid).join()]),[x,p]=u.useState(()=>{const j=new Map;for(const w of r??[])w.content&&j.set(w.answerUid,w.content);return j}),[h,f]=u.useState(null),[d,m]=u.useState(null),v=u.useCallback(j=>{n==null||n([...j.entries()].map(([w,_])=>({uid:w,content:_})))},[n]),y=(j,w)=>{if(a||i)return;const _=new Map(x);w?_.set(j,w):_.delete(j),p(_),v(_)},k=j=>w=>{if(a||i){w.preventDefault();return}f(j),w.dataTransfer.effectAllowed="link",w.dataTransfer.setData("text/plain",j)},S=j=>w=>{w.preventDefault(),w.dataTransfer.dropEffect="link",m(j)},C=j=>w=>{w.preventDefault(),h&&y(h,j),f(null),m(null)},T=()=>{f(null),m(null)},M=j=>{if(!o)return"";const w=x.get(j);return w?w===j?"bg-success/10 border-success/30":"bg-destructive/10 border-destructive/30":""},N=j=>{for(const[w,_]of x)if(_===j)return w};return e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("div",{dangerouslySetInnerHTML:{__html:t.content}}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider mb-1",children:"Items"}),l.map(j=>e.jsx("div",{draggable:!(a||i),onDragStart:k(j.uid),onDragEnd:T,className:g("rounded-md border px-3 py-2 transition-colors",h===j.uid&&"opacity-50",!(a||i)&&"cursor-grab active:cursor-grabbing",M(j.uid)),children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"flex-1 text-foreground",dangerouslySetInnerHTML:{__html:j.item}}),e.jsxs("select",{"aria-label":`Match for: ${j.item.replace(/<[^>]+>/g,"")}`,value:x.get(j.uid)||"",onChange:w=>y(j.uid,w.target.value),disabled:a||i,className:g("px-2 py-1 rounded border border-border bg-background text-foreground text-sm","disabled:opacity-60 disabled:cursor-default"),children:[e.jsx("option",{value:"",children:"—"}),c.map(w=>e.jsx("option",{value:w.uid,children:w.target.replace(/<[^>]+>/g,"")},w.uid))]})]})},j.uid))]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider mb-1",children:"Targets"}),c.map(j=>{const w=N(j.uid),_=w?l.find(P=>P.uid===w):null;return e.jsxs("div",{onDragOver:S(j.uid),onDrop:C(j.uid),className:g("rounded-md border border-dashed px-3 py-2 transition-colors min-h-10",d===j.uid&&"ring-2 ring-primary",w&&"border-solid"),children:[e.jsx("span",{className:"text-foreground",dangerouslySetInnerHTML:{__html:j.target}}),_&&e.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:"← matched"})]},j.uid)})]})]}),o&&t.explanation&&e.jsx(I,{className:"mt-2",children:e.jsxs(L,{children:[e.jsx("strong",{children:"Explanation:"})," ",e.jsx("span",{dangerouslySetInnerHTML:{__html:t.explanation}})]})})]})});function Ot(s){if(s.shape==="rect"){const[a,o,i,l]=s.coords;return{left:`${a}%`,top:`${o}%`,width:`${i}%`,height:`${l}%`}}const[t,r,n]=s.coords;return{left:`${t-n}%`,top:`${r-n}%`,width:`${n*2}%`,height:`${n*2}%`,borderRadius:"50%"}}const Ie=u.memo(function({question:t,sessionAnswers:r,onAnswer:n,readOnly:a=!1,showCorrectAnswers:o=!1,disabled:i=!1}){const l=t.hotspotMultiSelect??!1,[c,x]=u.useState(()=>{const d=new Set;for(const m of r??[])d.add(m.answerUid);return d}),p=u.useMemo(()=>t.hotspotRegions??[],[t.hotspotRegions]),h=d=>{if(a||i)return;let m;l?(m=new Set(c),m.has(d)?m.delete(d):m.add(d)):m=c.has(d)?new Set:new Set([d]),x(m),n==null||n([...m].map(v=>({uid:v})))},f=d=>{const m=c.has(d.uid);return o?d.isCorrect&&m?"ring-3 ring-success bg-success/20 border-2 border-success":d.isCorrect&&!m?"ring-2 ring-success/50 border-2 border-dashed border-success/50":!d.isCorrect&&m?"ring-3 ring-destructive bg-destructive/20 border-2 border-destructive":"":m?"ring-3 ring-primary bg-primary/20 border-2 border-primary":"hover:bg-primary/10"};return e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("div",{dangerouslySetInnerHTML:{__html:t.content}}),e.jsxs("div",{className:"relative inline-block max-w-full",children:[t.hotspotImageUrl&&e.jsx("img",{src:t.hotspotImageUrl,alt:"Hotspot question image",className:"w-full h-auto rounded-md",draggable:!1}),p.map((d,m)=>e.jsx("button",{type:"button",onClick:()=>h(d.uid),disabled:a||i,"aria-label":d.label||`Region ${m+1}`,"aria-pressed":c.has(d.uid),className:g("absolute transition-all cursor-pointer","disabled:cursor-default","focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",f(d)),style:Ot(d)},d.uid))]}),o&&t.explanation&&e.jsx(I,{className:"mt-2",children:e.jsxs(L,{children:[e.jsx("strong",{children:"Explanation:"})," ",e.jsx("span",{dangerouslySetInnerHTML:{__html:t.explanation}})]})})]})});function Qt(s){const t=[],r=/\{\{blank:([\w-]+)\}\}/g;let n=0,a;for(;(a=r.exec(s))!==null;)a.index>n&&t.push({type:"text",html:s.slice(n,a.index)}),t.push({type:"blank",uid:a[1]}),n=r.lastIndex;return n<s.length&&t.push({type:"text",html:s.slice(n)}),t}const Le=u.memo(function({question:t,sessionAnswers:r,onAnswer:n,readOnly:a=!1,showCorrectAnswers:o=!1,disabled:i=!1}){const l=u.useMemo(()=>{const d=new Map;for(const m of t.inlineBlanks??[])d.set(m.uid,m);return d},[t.inlineBlanks]),[c,x]=u.useState(()=>{const d=new Map;for(const m of r??[])m.content&&d.set(m.answerUid,m.content);return d}),p=u.useMemo(()=>Qt(t.content),[t.content]),h=(d,m)=>{if(a||i)return;const v=new Map(c);v.set(d,m),x(v);const y=[...v.entries()].map(([k,S])=>({uid:k,content:S}));n==null||n(y)},f=d=>{if(!o)return"";const m=l.get(d),v=c.get(d);if(!m||!v)return"";const y=m.options.find(k=>k.isCorrect);return y?v===y.uid?"border-success/50 bg-success/5 text-success":"border-destructive/50 bg-destructive/5 text-destructive":""};return e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("div",{className:"leading-relaxed text-foreground",children:p.map((d,m)=>{if(d.type==="text")return e.jsx("span",{dangerouslySetInnerHTML:{__html:d.html}},m);const v=l.get(d.uid);return v?e.jsxs("select",{"aria-label":`Blank ${v.sequence+1}`,value:c.get(d.uid)||"",onChange:y=>h(d.uid,y.target.value),disabled:a||i,className:g("inline-block mx-1 px-2 py-0.5 rounded border border-border bg-background text-foreground text-sm align-baseline","disabled:opacity-60 disabled:cursor-default",f(d.uid)),children:[e.jsx("option",{value:"",children:"Select..."}),v.options.map(y=>e.jsx("option",{value:y.uid,children:y.content},y.uid))]},d.uid):null})}),o&&t.explanation&&e.jsx(I,{className:"mt-2",children:e.jsxs(L,{children:[e.jsx("strong",{children:"Explanation:"})," ",e.jsx("span",{dangerouslySetInnerHTML:{__html:t.explanation}})]})})]})}),Ee=u.memo(function({question:t,sessionAnswers:r,onAnswer:n,readOnly:a=!1,showCorrectAnswers:o=!1,disabled:i=!1}){const l=t.scenarioQuestions??[],c=u.useRef(new Map),x=u.useMemo(()=>{const h=new Map;for(const f of r??[]){const d=f.answerUid.indexOf("::");if(d===-1)continue;const m=f.answerUid.slice(0,d),v=f.answerUid.slice(d+2),y=h.get(m)??[];y.push({...f,uid:m,answerUid:v}),h.set(m,y)}c.current=new Map;for(const[f,d]of h)c.current.set(f,d.map(m=>({uid:`${f}::${m.answerUid}`,content:m.content})));return h},[r]),p=(h,f)=>{const d=f.map(v=>({uid:`${h}::${v.uid}`,content:v.content}));c.current.set(h,d);const m=[];for(const v of c.current.values())m.push(...v);n==null||n(m)};return e.jsxs("div",{className:"flex flex-col gap-6",children:[e.jsxs("div",{className:g("rounded-lg border border-border bg-muted/30 px-4 py-3","prose prose-sm max-w-none text-foreground"),children:[e.jsx("div",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground mb-2",children:"Scenario"}),e.jsx("div",{dangerouslySetInnerHTML:{__html:t.content}})]}),e.jsx(A,{}),e.jsx("div",{className:"flex flex-col gap-5",children:l.map((h,f)=>e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("span",{className:"text-xs font-medium text-muted-foreground",children:["Part ",String.fromCharCode(65+f)]}),e.jsx(ne,{question:h,sessionAnswers:x.get(h.uid)??[],onAnswer:d=>p(h.uid,d),readOnly:a,showCorrectAnswers:o,disabled:i})]},h.uid))}),o&&t.explanation&&e.jsx(I,{className:"mt-2",children:e.jsxs(L,{children:[e.jsx("strong",{children:"Scenario Explanation:"})," ",e.jsx("span",{dangerouslySetInnerHTML:{__html:t.explanation}})]})})]})});function te({className:s,...t}){return e.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-auto",children:e.jsx("table",{"data-slot":"table",className:g("w-full caption-bottom text-sm",s),...t})})}function se({className:s,...t}){return e.jsx("thead",{"data-slot":"table-header",className:g("[&_tr]:border-b",s),...t})}function re({className:s,...t}){return e.jsx("tbody",{"data-slot":"table-body",className:g("[&_tr:last-child]:border-0",s),...t})}function Re({className:s,...t}){return e.jsx("tfoot",{"data-slot":"table-footer",className:g("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",s),...t})}function F({className:s,...t}){return e.jsx("tr",{"data-slot":"table-row",className:g("border-b border-border transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",s),...t})}function W({className:s,...t}){return e.jsx("th",{"data-slot":"table-head",className:g("text-muted-foreground h-10 px-3 text-left align-middle font-semibold whitespace-nowrap text-sm [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",s),...t})}function U({className:s,...t}){return e.jsx("td",{"data-slot":"table-cell",className:g("px-3 py-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",s),...t})}function $e({className:s,...t}){return e.jsx("caption",{"data-slot":"table-caption",className:g("text-muted-foreground mt-4 text-sm",s),...t})}function Kt(s,t,r){if(s.locked||!s.correctAnswer)return null;if(!r||r.trim()==="")return"empty";if(t.type==="numeric"||t.type==="currency"){const n=parseFloat(r.replace(/,/g,"")),a=parseFloat(s.correctAnswer);if(isNaN(n)||isNaN(a))return"incorrect";const o=s.tolerance??0;return Math.abs(n-a)<=o?"correct":"incorrect"}return r.trim().toLowerCase()===s.correctAnswer.trim().toLowerCase()?"correct":"incorrect"}const He=u.memo(function({question:t,sessionAnswers:r,onAnswer:n,readOnly:a=!1,showCorrectAnswers:o=!1,disabled:i=!1}){const l=t.spreadsheetColumns??[],c=t.spreadsheetRows??[],x=u.useMemo(()=>{const N=new Map;for(const j of l)N.set(j.uid,j);return N},[l]),p=u.useMemo(()=>c.flatMap(N=>N.cells.filter(j=>!j.locked).map(j=>j.uid)),[c]),h=u.useMemo(()=>c.some(N=>N.label!=null),[c]),f=u.useMemo(()=>c.filter(N=>!N.isTotals),[c]),d=u.useMemo(()=>c.filter(N=>N.isTotals),[c]),m=u.useRef(n);m.current=n;const v=u.useMemo(()=>O(N=>{var j;(j=m.current)==null||j.call(m,[...N.entries()].map(([w,_])=>({uid:w,content:_})))},300),[]);u.useEffect(()=>()=>v.cancel(),[v]);const[y,k]=u.useState(()=>{const N=new Map;for(const j of r??[])j.content!==void 0&&N.set(j.answerUid,j.content);for(const j of c)for(const w of j.cells)!w.locked&&!N.has(w.uid)&&N.set(w.uid,w.value??"");return N}),S=(N,j)=>{if(a||i)return;const w=new Map(y);w.set(N,j),k(w),v(w)},C=(N,j)=>{if(j.key!=="Tab")return;const w=p.indexOf(N),_=j.shiftKey?w-1:w+1;if(_<0||_>=p.length)return;j.preventDefault();const P=p[_],D=document.querySelector(`[data-cell-uid="${P}"]`);D==null||D.focus()},T=N=>{const j=x.get(N.columnUid);if(!j)return null;const w=y.get(N.uid)??"",_=o?Kt(N,j,w):null,P=_==="correct"?"bg-success/10 border-l-2 border-l-success/50":_==="incorrect"||_==="empty"?"bg-destructive/10 border-l-2 border-l-destructive/50":"";return N.locked?e.jsx(U,{className:g("px-2 py-1.5 text-sm text-muted-foreground bg-muted/30",j.type!=="text"&&"text-right tabular-nums"),children:N.value??""},N.uid):e.jsxs(U,{className:g("p-0 relative",P),children:[e.jsx(Z,{type:j.type==="numeric"?"number":"text",inputMode:j.type==="currency"?"decimal":void 0,step:j.type==="numeric"?"any":void 0,value:w,onChange:D=>S(N.uid,D.target.value),onKeyDown:D=>C(N.uid,D),disabled:a||i,"data-cell-uid":N.uid,placeholder:j.type==="text"?"":"0.00",className:g("h-8 rounded-none border-0 shadow-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring",j.type!=="text"&&"text-right tabular-nums")}),o&&_!=="correct"&&_!==null&&N.correctAnswer&&e.jsxs("div",{className:"px-2 pb-1 text-xs",children:[e.jsx("span",{className:"text-success",children:N.correctAnswer}),N.formula&&e.jsxs("span",{className:"ml-1 text-muted-foreground/70",children:["(",N.formula,")"]})]})]},N.uid)},M=N=>e.jsxs(F,{className:g(N.isHeader&&"bg-muted/50 font-semibold hover:bg-muted/50"),children:[h&&e.jsx(U,{className:"px-2 py-1.5 font-medium text-sm text-muted-foreground whitespace-nowrap",children:N.label??""}),N.cells.map(T)]},N.uid);return e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx("div",{dangerouslySetInnerHTML:{__html:t.content}}),e.jsx("div",{className:"rounded-md border border-border overflow-auto",children:e.jsxs(te,{children:[e.jsx(se,{children:e.jsxs(F,{className:"hover:bg-transparent",children:[h&&e.jsx(W,{className:"w-auto"}),l.map(N=>e.jsx(W,{style:{width:N.width?`${N.width}rem`:void 0},className:g(N.type!=="text"&&"text-right"),children:N.label},N.uid))]})}),e.jsx(re,{children:f.map(M)}),d.length>0&&e.jsx(Re,{children:d.map(M)})]})}),o&&t.explanation&&e.jsx(I,{className:"mt-1",children:e.jsxs(L,{children:[e.jsx("strong",{children:"Explanation:"})," ",e.jsx("span",{dangerouslySetInnerHTML:{__html:t.explanation}})]})})]})}),ne=u.memo(function(t){switch(t.question.type){case"multiple_choice":return e.jsx(Ne,{...t});case"choice":return e.jsx(we,{...t});case"true_false":return e.jsx(Ce,{...t});case"fill_in_the_blank":return e.jsx(ke,{...t});case"essay":return e.jsx(Te,{...t});case"numeric":return e.jsx(De,{...t});case"ordering":return e.jsx(Me,{...t});case"matching":return e.jsx(ze,{...t});case"hotspot":return e.jsx(Ie,{...t});case"inline_choice":return e.jsx(Le,{...t});case"scenario":return e.jsx(Ee,{...t});case"spreadsheet":return e.jsx(He,{...t});default:return e.jsxs("p",{className:"text-muted-foreground",children:["Question type “",t.question.type,"” is not supported yet."]})}});function X(s,t){var r;switch(s.type){case"choice":case"multiple_choice":case"true_false":{const n=new Set((s.answers??[]).filter(o=>o.isCorrect).map(o=>o.uid)),a=new Set(t.map(o=>o.answerUid));return n.size===0?null:n.size===a.size&&[...n].every(o=>a.has(o))}case"fill_in_the_blank":case"essay":return null;case"ordering":{const n=s.answers??[];return n.length===0?null:[...n].sort((o,i)=>o.sequence-i.sequence).every((o,i)=>{const l=t.find(c=>c.answerUid===o.uid);return(l==null?void 0:l.content)===String(i)})}case"matching":{const n=s.matchingPairs??[];return n.length===0?null:n.every(a=>{const o=t.find(i=>i.answerUid===a.uid);return(o==null?void 0:o.content)===a.uid})}case"numeric":{if(s.numericAnswer===void 0)return null;const n=(r=t[0])==null?void 0:r.content;if(n===void 0||n==="")return!1;const a=parseFloat(n);if(isNaN(a))return!1;const o=s.numericTolerance??0;return Math.abs(a-s.numericAnswer)<=o}case"hotspot":{const n=s.hotspotRegions??[],a=new Set(n.filter(i=>i.isCorrect).map(i=>i.uid));if(a.size===0)return null;const o=new Set(t.map(i=>i.answerUid));return a.size===o.size&&[...a].every(i=>o.has(i))}case"inline_choice":{const n=s.inlineBlanks??[];return n.length===0?null:n.every(a=>{const o=a.options.find(l=>l.isCorrect);if(!o)return!0;const i=t.find(l=>l.answerUid===a.uid);return(i==null?void 0:i.content)===o.uid})}case"spreadsheet":{const n=s.spreadsheetRows??[],a=s.spreadsheetColumns??[],o=new Map(a.map(l=>[l.uid,l])),i=n.flatMap(l=>l.cells.filter(c=>!c.locked&&c.correctAnswer!==void 0));return i.length===0?null:i.every(l=>{var m;const c=t.find(v=>v.answerUid===l.uid),x=((m=c==null?void 0:c.content)==null?void 0:m.trim())??"";if(!x)return!1;const p=o.get(l.columnUid);if(!p||p.type==="text")return x.toLowerCase()===l.correctAnswer.trim().toLowerCase();const h=parseFloat(x.replace(/,/g,"")),f=parseFloat(l.correctAnswer.replace(/,/g,""));if(isNaN(h)||isNaN(f))return!1;const d=l.tolerance??0;return Math.abs(h-f)<=d})}case"scenario":{const n=s.scenarioQuestions??[];if(n.length===0)return null;if((s.scenarioScoringMode??"per_question")==="all_or_nothing"){const o=Pe(t),i=n.map(l=>{const c=o.get(l.uid)??[];return X(l,c)});return i.some(l=>l===null)?null:i.every(l=>l===!0)}return null}default:return null}}function Gt(s,t){let r=0,n=0;for(const i of s){const l=t.filter(x=>x.uid===i.uid);if(i.type==="scenario"&&i.scenarioScoringMode!=="all_or_nothing"){const x=Ae(i,l);for(const[,p]of x)p!==null&&(n++,p&&r++);continue}const c=X(i,l);c!==null&&(n++,c&&r++)}const a=n>0?n:s.length,o=a>0?Math.round(r/a*100):0;return{correct:r,total:a,percentage:o}}function Pe(s){const t=new Map;for(const r of s){const n=r.answerUid.indexOf("::");if(n===-1)continue;const a=r.answerUid.slice(0,n),o=r.answerUid.slice(n+2),i=t.get(a)??[];i.push({...r,answerUid:o}),t.set(a,i)}return t}function Ae(s,t){const r=new Map,n=s.scenarioQuestions??[],a=Pe(t);for(const o of n){const i=a.get(o.uid)??[];r.set(o.uid,X(o,i))}return r}const Be=s=>{if(s<1)return"-";const t=Math.floor(s/3600),r=Math.floor(s%3600/60),n=s%60,a=[];return t>0&&a.push(`${t}h`),r>0&&a.push(`${r}m`),n>0&&a.push(`${n}s`),a.join(" ")},V=s=>{const t=Math.floor(s/3600),r=Math.floor(s%3600/60),n=s%60,a=o=>o.toString().padStart(2,"0");return t>0?`${a(t)}:${a(r)}:${a(n)}`:`${a(r)}:${a(n)}`};function Wt(s,t){return s?{wrapper:"border-destructive/30 bg-destructive/10 text-destructive",bold:!0}:t?{wrapper:"border-warning/30 bg-warning/10 text-warning",bold:!0}:{wrapper:"border-border bg-muted text-muted-foreground",bold:!1}}const Ue=u.memo(function({timeElapsedSeconds:t,timeLimitSeconds:r,variant:n="compact"}){const a=r!=null&&r>0,o=a?Math.max(0,r-t):0,i=a&&o<r*.1,l=a&&o<=60,c=V(a?o:t),x=Wt(l,i);return n==="compact"?e.jsxs("div",{className:g("flex items-center gap-1.5 px-2.5 py-1 rounded-full border",x.wrapper),children:[e.jsx("span",{className:"inline-flex leading-none",children:e.jsx(b.Clock,{size:13})}),e.jsx("span",{className:"text-xs font-semibold font-mono tracking-wide","aria-live":"polite","aria-atomic":"true",children:c})]}):e.jsxs("div",{className:g("flex items-center gap-1.5",x.wrapper),children:[e.jsx("span",{className:"inline-flex leading-none",children:e.jsx(b.Clock,{size:16})}),e.jsxs("span",{className:g("text-sm",x.bold&&"font-semibold"),children:[a?"Time remaining: ":"Time elapsed: ",e.jsx("span",{className:"font-mono font-semibold","aria-live":"polite","aria-atomic":"true",children:c})]})]})}),Yt={current:"bg-primary text-primary-foreground border-primary",flagged:"bg-warning/10 text-warning border-warning/30",answered:"bg-success/10 text-success border-success/30",default:"bg-background text-muted-foreground border-border"},Zt=(s,t)=>s.uid===t?"current":s.isFlagged?"flagged":s.isAnswered?"answered":"default",Fe=u.memo(function({questions:t,currentQuestionUid:r,onNavigate:n,readOnly:a=!1}){const o=i=>{const l=[`Question ${i.sequence+1}`];return i.isFlagged&&l.push("Flagged"),i.isAnswered&&l.push("Answered"),i.isSkipped&&l.push("Skipped"),l.join(" · ")};return e.jsx("div",{className:"flex gap-1",children:t.map(i=>{const l=Zt(i,r);return e.jsx("button",{type:"button",title:o(i),"aria-label":o(i),"aria-current":i.uid===r?"step":void 0,className:g("inline-flex items-center justify-center px-1.5 py-0.5 rounded border text-[11px] leading-tight transition-all duration-150 min-w-5.5",Yt[l],a?"cursor-default":"cursor-pointer hover:shadow-sm hover:-translate-y-px"),onClick:a?void 0:()=>n==null?void 0:n(i.uid),disabled:a,children:e.jsx("span",{className:"font-semibold min-w-3.5 text-center",children:i.sequence+1})},i.uid)})})});function Ve({children:s,...t}){return G.isValidElement(s)?G.cloneElement(s,{...Xt(t,s.props),ref:s.ref}):(G.Children.count(s)>1&&G.Children.only(null),null)}function Xt(s,t){const r={...t};for(const n in t){const a=s[n],o=t[n];n==="style"?r[n]={...a,...o}:n==="className"?r[n]=[a,o].filter(Boolean).join(" "):typeof a=="function"&&typeof o=="function"&&(r[n]=(...i)=>{o(...i),a(...i)})}return{...s,...r}}const Q=B.cva("inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",xs:"h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-xs":"size-6 rounded-md [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function z({className:s,variant:t="default",size:r="default",asChild:n=!1,...a}){const o=n?Ve:"button";return e.jsx(o,{"data-slot":"button",className:g(Q({variant:t,size:r,className:s})),...a})}const Jt=({currentQuestionIndex:s,totalQuestions:t,hasNext:r,hasPrevious:n,onNext:a,onPrevious:o,onSubmit:i,timeElapsedSeconds:l,timeLimitSeconds:c,questions:x,onNavigateToQuestion:p,currentQuestionUid:h,isCompleted:f=!1,isSubmitting:d=!1,readOnly:m=!1})=>{const v=l!=null&&l>=0,y=x&&x.length>0;return e.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-border bg-muted px-2 py-1.5 shadow-sm",children:[e.jsxs(z,{variant:"ghost",size:"icon",className:"size-8 shrink-0 rounded-md",disabled:!n||m,onClick:o,children:[e.jsx(b.ChevronLeft,{size:16}),e.jsx("span",{className:"sr-only",children:"Previous"})]}),!y&&e.jsxs("span",{className:"text-xs font-medium text-muted-foreground whitespace-nowrap",children:[e.jsx("span",{className:"font-bold text-foreground",children:s+1}),e.jsx("span",{className:"mx-0.5",children:"/"}),t]}),y&&e.jsx("div",{className:"min-w-0 flex-1 overflow-x-auto [scrollbar-width:none]",children:e.jsx(Fe,{questions:x,currentQuestionUid:h,onNavigate:p,readOnly:m})}),!y&&e.jsx("div",{className:"flex-1"}),v&&e.jsx(Ue,{timeElapsedSeconds:l,timeLimitSeconds:c}),!r||f?e.jsxs(z,{variant:f?"secondary":"default",size:"sm",className:g("shrink-0 rounded-md",d&&"gap-0"),onClick:i,disabled:m||d,children:[d?"...":f?"Review":"Submit",!d&&e.jsx(b.Send,{size:14})]}):e.jsxs(z,{variant:"ghost",size:"icon",className:"size-8 shrink-0 rounded-md",disabled:!r||m,onClick:a,children:[e.jsx(b.ChevronRight,{size:16}),e.jsx("span",{className:"sr-only",children:"Next"})]})]})},qt=({questionNumber:s,totalQuestions:t,isFlagged:r,onToggleFlag:n,hasMaterials:a=!1,onOpenMaterials:o,readOnly:i=!1})=>e.jsxs("div",{className:"flex items-center justify-between pb-3 border-b border-border",children:[e.jsxs("span",{className:"text-sm font-semibold text-foreground",children:["Question ",s," ",e.jsxs("span",{className:"font-normal text-muted-foreground",children:["of ",t]})]}),!i&&e.jsxs("div",{className:"flex items-center gap-1",children:[a&&o&&e.jsxs(z,{variant:"ghost",size:"sm",className:"gap-1.5 text-muted-foreground hover:text-foreground",onClick:o,children:[e.jsx(b.BookOpen,{size:14}),"Related Material"]}),n&&e.jsx(z,{variant:"ghost",size:"icon",className:g("size-8",r?"text-warning hover:text-warning/80":"text-muted-foreground hover:text-warning"),onClick:n,"aria-label":r?"Unflag question":"Flag question",children:e.jsx(b.Flag,{size:14,fill:r?"currentColor":"none"})})]})]}),Oe=u.createContext(null);function Qe(){const s=u.useContext(Oe);if(!s)throw new Error("Tooltip compound components must be used within <Tooltip>");return s}function Ke({children:s,delayDuration:t=300}){const[r,n]=u.useState(!1),a=u.useRef(null),o=u.useRef(void 0),i=u.useId(),l=u.useCallback(()=>{clearTimeout(o.current),o.current=setTimeout(()=>n(!0),t)},[t]),c=u.useCallback(()=>{clearTimeout(o.current),n(!1)},[]);return e.jsx(Oe.Provider,{value:{open:r,show:l,hide:c,triggerRef:a,tooltipId:i},children:s})}function Ge({children:s}){const{show:t,hide:r,triggerRef:n,tooltipId:a,open:o}=Qe();return u.isValidElement(s)?u.cloneElement(s,{ref:i=>{n.current=i;const l=s.ref;typeof l=="function"?l(i):l&&typeof l=="object"&&(l.current=i)},onMouseEnter:i=>{t();const l=s.props.onMouseEnter;l==null||l(i)},onMouseLeave:i=>{r();const l=s.props.onMouseLeave;l==null||l(i)},onFocus:i=>{t();const l=s.props.onFocus;l==null||l(i)},onBlur:i=>{r();const l=s.props.onBlur;l==null||l(i)},"aria-describedby":o?a:void 0}):s}function We({className:s,sideOffset:t=8,children:r,style:n,...a}){const{open:o,triggerRef:i,tooltipId:l}=Qe(),c=u.useRef(null),[x,p]=u.useState({position:"fixed",top:0,left:0,visibility:"hidden"});return u.useLayoutEffect(()=>{if(!o||!i.current||!c.current)return;const h=i.current.getBoundingClientRect(),f=c.current.getBoundingClientRect();let d=h.top-f.height-t,m=h.left+h.width/2-f.width/2;d<4&&(d=h.bottom+t),m<4&&(m=4),m+f.width>window.innerWidth-4&&(m=window.innerWidth-f.width-4),p({position:"fixed",top:d,left:m,visibility:"visible"})},[o,t,i]),o?ee.createPortal(e.jsx("div",{ref:c,id:l,role:"tooltip","data-slot":"tooltip-content",className:g("bg-primary text-primary-foreground z-50 max-w-60 rounded-md px-2.5 py-1.5 text-xs leading-snug shadow-md animate-in fade-in-0 zoom-in-95",s),style:{...x,...n},...a,children:r}),document.body):null}const Ye=u.createContext(null);function es(){const s=u.useContext(Ye);if(!s)throw new Error("DrawerNavItem must be used within <DrawerNav>");return s}const Ze=u.createContext(null);function H(){const s=u.useContext(Ze);if(!s)throw new Error("Drawer compound components must be used within <Drawer>");return s}const xe=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(", ");function ts(s,t){const r=u.useRef(null);return u.useEffect(()=>{if(!t||!s.current)return;r.current=document.activeElement;const a=s.current.querySelectorAll(xe);return a.length>0&&a[0].focus(),()=>{r.current instanceof HTMLElement&&r.current.focus()}},[t,s]),u.useCallback(a=>{if(a.key!=="Tab"||!s.current)return;const o=Array.from(s.current.querySelectorAll(xe));if(o.length===0)return;const i=o[0],l=o[o.length-1];a.shiftKey&&document.activeElement===i?(a.preventDefault(),l.focus()):!a.shiftKey&&document.activeElement===l&&(a.preventDefault(),i.focus())},[s])}function ss(s){u.useEffect(()=>{if(!s)return;const t=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=t}},[s])}const Xe=B.cva("bg-background fixed inset-y-0 z-50 flex flex-col shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out",{variants:{side:{right:"right-0 border-l data-[state=open]:slide-in-from-right data-[state=closed]:slide-out-to-right",left:"left-0 border-r data-[state=open]:slide-in-from-left data-[state=closed]:slide-out-to-left"},size:{sm:"w-80",default:"w-100",lg:"w-128",xl:"w-160",full:"w-full"}},defaultVariants:{side:"right",size:"default"}});function Je({children:s,open:t,onOpenChange:r,side:n="right"}){const a=u.useId(),o=u.useId(),[i,l]=u.useState(!1);return e.jsx(Ze.Provider,{value:{open:t,onOpenChange:r,side:n,titleId:a,descriptionId:o,hasNav:i,setHasNav:l},children:s})}function rs({className:s,onClick:t,...r}){const{onOpenChange:n}=H();return e.jsx("button",{type:"button","data-slot":"drawer-trigger",className:s,onClick:a=>{n(!0),t==null||t(a)},...r})}function qe({children:s}){return ee.createPortal(s,document.body)}function et({className:s,...t}){const{onOpenChange:r}=H();return e.jsx("div",{"data-slot":"drawer-backdrop",className:g("fixed inset-0 z-50 bg-black/50 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=closed]:animate-out data-[state=closed]:fade-out-0",s),"data-state":"open",onClick:()=>r(!1),...t})}function tt({className:s,children:t,size:r="default",scrollLock:n=!0,...a}){const{open:o,onOpenChange:i,side:l,titleId:c,descriptionId:x,hasNav:p}=H(),h=u.useRef(null),f=ts(h,o);return ss(o&&n),u.useEffect(()=>{if(!o)return;const d=m=>{m.key==="Escape"&&i(!1)};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[o,i]),o?e.jsxs(qe,{children:[e.jsx(et,{}),e.jsx("div",{ref:h,role:"dialog","aria-modal":"true","aria-labelledby":c,"aria-describedby":x,"data-slot":"drawer-content","data-state":"open",className:g(Xe({side:l,size:r}),p&&"flex-row",s),onKeyDown:f,...a,children:t})]}):null}function st({className:s,...t}){return e.jsx("div",{"data-slot":"drawer-header",className:g("flex flex-col gap-1.5 border-b px-6 py-4 shrink-0",s),...t})}function rt({className:s,...t}){return e.jsx("div",{"data-slot":"drawer-body",className:g("flex-1 overflow-y-auto px-6 py-4",s),...t})}function ns({className:s,...t}){return e.jsx("div",{"data-slot":"drawer-footer",className:g("flex items-center gap-2 border-t px-6 py-4 shrink-0",s),...t})}function nt({className:s,...t}){const{titleId:r}=H();return e.jsx("h2",{id:r,"data-slot":"drawer-title",className:g("text-lg font-semibold",s),...t})}function as({className:s,...t}){const{descriptionId:r}=H();return e.jsx("p",{id:r,"data-slot":"drawer-description",className:g("text-muted-foreground text-sm",s),...t})}function at({className:s,children:t,onClick:r,...n}){const{onOpenChange:a}=H();return e.jsx("button",{type:"button","data-slot":"drawer-close",className:g(Q({variant:"ghost",size:"sm"}),s),onClick:o=>{a(!1),r==null||r(o)},...n,children:t??e.jsx(b.X,{className:"h-4 w-4"})})}function os({value:s,onValueChange:t,className:r,children:n,...a}){const{setHasNav:o}=H(),i=u.useRef(null);u.useEffect(()=>(o(!0),()=>o(!1)),[o]);const l=c=>{if(!["ArrowUp","ArrowDown","Home","End"].includes(c.key))return;const x=i.current;if(!x)return;const p=Array.from(x.querySelectorAll('[role="tab"]:not([disabled])')),h=p.indexOf(document.activeElement);if(h===-1)return;c.preventDefault();let f;switch(c.key){case"ArrowDown":f=(h+1)%p.length;break;case"ArrowUp":f=(h-1+p.length)%p.length;break;case"Home":f=0;break;case"End":f=p.length-1;break;default:return}p[f].focus()};return e.jsx(Ye.Provider,{value:{value:s,onValueChange:t},children:e.jsx("nav",{ref:i,role:"tablist","aria-orientation":"vertical","data-slot":"drawer-nav",className:g("flex shrink-0 flex-col items-center gap-1 border-r bg-muted/30 px-1.5 py-2",r),onKeyDown:l,...a,children:n})})}function is({value:s,icon:t,label:r,className:n,...a}){const{value:o,onValueChange:i}=es(),{side:l}=H(),c=o===s;return e.jsxs(Ke,{children:[e.jsx(Ge,{children:e.jsxs("button",{role:"tab",type:"button","aria-selected":c,"aria-label":r,"data-slot":"drawer-nav-item",...c?{"data-active":""}:{},className:g("relative flex cursor-pointer items-center justify-center rounded-md size-9 transition-colors","text-muted-foreground hover:text-foreground hover:bg-accent",c&&"text-foreground bg-accent/50",n),onClick:()=>i(s),...a,children:[c&&e.jsx("span",{"aria-hidden":"true",className:g("absolute top-1 bottom-1 w-0.5 rounded-full bg-primary",l==="left"?"right-0 -mr-1.5":"left-0 -ml-1.5")}),t]})}),e.jsx(We,{children:r})]})}function ls({className:s,...t}){return e.jsx("div",{role:"tabpanel","data-slot":"drawer-viewport",className:g("flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden",s),...t})}const ot=({src:s,poster:t,title:r,autoPlay:n=!1,onPlay:a,onPause:o,onEnded:i,onTimeUpdate:l,readOnly:c=!1,aspectRatio:x="16/9",tracks:p,className:h,style:f})=>{const d=u.useRef(null),m=u.useRef(-1),v=u.useMemo(()=>({aspectRatio:x,...f}),[x,f]),y=u.useMemo(()=>({width:"100%",aspectRatio:x,display:"block"}),[x]),k=u.useCallback(()=>{const S=d.current;if(S&&l){const C=Math.floor(S.currentTime*4)/4;C!==m.current&&(m.current=C,l(S.currentTime,S.duration))}},[l]);return s?c?e.jsxs("div",{className:g("relative overflow-hidden rounded-lg",h),style:v,children:[t?e.jsx("img",{src:t,alt:r||"Video poster",loading:"lazy",className:"w-full h-full object-cover"}):e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-muted",children:e.jsx("div",{className:"flex items-center justify-center size-14 rounded-full bg-black/60",children:e.jsx(b.Play,{size:28,className:"text-white ml-0.5"})})}),t&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/30 transition-opacity",children:e.jsx("div",{className:"flex items-center justify-center size-14 rounded-full bg-black/60",children:e.jsx(b.Play,{size:28,className:"text-white ml-0.5"})})}),r&&e.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-linear-to-t from-black/60 to-transparent p-2",children:e.jsx("span",{className:"text-sm text-white font-medium",children:r})})]}):e.jsxs("div",{className:h,style:f,children:[r&&e.jsx("p",{className:"mb-2 text-sm font-medium",children:r}),e.jsx("div",{className:"rounded-lg overflow-hidden",children:e.jsx("video",{ref:d,src:s,poster:t,controls:!0,preload:"metadata",autoPlay:n,onPlay:a,onPause:o,onEnded:i,onTimeUpdate:k,style:y,children:p==null?void 0:p.map(S=>e.jsx("track",{src:S.src,kind:S.kind,label:S.label,srcLang:S.srcLang,default:S.default},`${S.kind}-${S.srcLang}`))})})]}):e.jsx("div",{className:g("relative overflow-hidden rounded-lg border border-border bg-muted",h),style:v,children:e.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-2",children:[e.jsx("div",{className:"flex items-center justify-center size-12 rounded-full bg-muted-foreground/10",children:e.jsx(b.Video,{size:24})}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"No video source provided"})]})})},it=B.cva("h-full rounded-full transition-all duration-300",{variants:{variant:{default:"bg-primary",success:"bg-success",warning:"bg-warning",info:"bg-info",palette0:"bg-palette-0",palette1:"bg-palette-1",palette2:"bg-palette-2",palette3:"bg-palette-3"},size:{sm:"",default:""}},defaultVariants:{variant:"default",size:"default"}}),cs=B.cva("bg-muted overflow-hidden rounded-full w-full",{variants:{size:{sm:"h-1.5",default:"h-2.5"}},defaultVariants:{size:"default"}});function ds({className:s,value:t=0,max:r=100,variant:n,size:a,...o}){const i=Math.min(100,Math.max(0,t/r*100));return e.jsx("div",{"data-slot":"progress",role:"progressbar","aria-valuenow":t,"aria-valuemin":0,"aria-valuemax":r,className:g(cs({size:a}),s),...o,children:e.jsx("div",{className:it({variant:n,size:a}),style:{width:`${i}%`}})})}const pe={color1:{bg:"bg-palette-0/10",border:"border-palette-0/30",accent:"bg-palette-0/30"},color2:{bg:"bg-palette-1/10",border:"border-palette-1/30",accent:"bg-palette-1/30"},color3:{bg:"bg-palette-2/10",border:"border-palette-2/30",accent:"bg-palette-2/30"},color4:{bg:"bg-palette-3/10",border:"border-palette-3/30",accent:"bg-palette-3/30"},color5:{bg:"bg-info/10",border:"border-info/30",accent:"bg-info/30"},color6:{bg:"bg-success/10",border:"border-success/30",accent:"bg-success/30"}},us={small:{width:280,height:180,fontSize:"0.875rem"},medium:{width:400,height:260,fontSize:"1rem"},large:{width:520,height:340,fontSize:"1.125rem"}},lt=({card:s,isFlipped:t,onFlip:r,readOnly:n=!1,size:a="medium"})=>{const[o,i]=u.useState(!1),l=t!==void 0,c=l?t:o,x=()=>{n||(l||i(v=>!v),r==null||r())},{width:p,height:h,fontSize:f}=us[a],d=pe[s.color]||pe.color1,m=v=>{(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),x())};return e.jsxs("div",{className:"perspective-[1000px]",style:{width:`${p}px`,height:`${h}px`},children:[e.jsx("span",{className:"sr-only","aria-live":"polite",children:c?"Answer revealed":"Question shown"}),e.jsxs("div",{className:g("relative size-full motion-safe:transition-transform motion-safe:duration-500 transform-3d",c&&"transform-[rotateY(180deg)]"),children:[e.jsxs("div",{className:g("absolute inset-0 flex flex-col rounded-lg border backface-hidden",d.bg,d.border,!n&&"cursor-pointer","focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring"),onClick:x,onKeyDown:n?void 0:m,role:"button",tabIndex:n?-1:0,"aria-label":"Flashcard — press Enter to reveal answer",children:[e.jsx("div",{className:"flex flex-1 items-center justify-center p-5 overflow-auto",children:e.jsx("div",{className:"text-center",style:{fontSize:f},dangerouslySetInnerHTML:{__html:s.front}})}),!n&&e.jsxs("div",{className:"flex items-center justify-center gap-1 pb-3 text-muted-foreground",children:[e.jsx(b.RotateCcw,{size:12}),e.jsx("span",{className:"text-xs",children:"Press Enter to flip"})]})]}),e.jsxs("div",{className:g("absolute inset-0 flex flex-col rounded-lg border border-border bg-background backface-hidden transform-[rotateY(180deg)]",!n&&"cursor-pointer","focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring"),onClick:x,onKeyDown:n?void 0:m,role:"button",tabIndex:n?-1:0,"aria-label":"Flashcard answer — press Enter to flip back",children:[e.jsx("div",{className:g("h-1.5 rounded-t-lg",d.accent)}),e.jsx("div",{className:"flex flex-1 items-start justify-center p-5 overflow-auto",children:e.jsx("div",{className:"text-left w-full flashcard-back-content",style:{fontSize:f},dangerouslySetInnerHTML:{__html:s.back}})}),!n&&e.jsxs("div",{className:"flex items-center justify-center gap-1 pb-3 text-muted-foreground",children:[e.jsx(b.RotateCcw,{size:12}),e.jsx("span",{className:"text-xs",children:"Press Enter to flip back"})]})]})]})]})};function ct(s){const t=[...s];for(let r=t.length-1;r>0;r--){const n=Math.floor(Math.random()*(r+1));[t[r],t[n]]=[t[n],t[r]]}return t}const dt=({cards:s,deckName:t,deckDescription:r,currentIndex:n,onNavigate:a,onComplete:o,readOnly:i=!1,showProgress:l=!0,shuffled:c=!1})=>{const x=u.useMemo(()=>c?ct(s):s,[s,c]),[p,h]=u.useState(0),[f,d]=u.useState(!1),m=n!==void 0,v=m?n:p,y=x[v],k=v>0,S=v<x.length-1,C=j=>{d(!1),m?a==null||a(j):h(j)},T=()=>{k&&C(v-1)},M=()=>{S?C(v+1):o==null||o()};if(!x.length)return e.jsx("span",{className:"text-sm text-muted-foreground",children:"No flashcards in this deck."});const N=(v+1)/x.length*100;return e.jsxs("div",{className:"flex flex-col items-center gap-4",children:[(t||r)&&e.jsxs("div",{className:"flex flex-col gap-0.5 text-center",children:[t&&e.jsx("span",{className:"text-lg font-semibold",children:t}),r&&e.jsx("span",{className:"text-sm text-muted-foreground",children:r})]}),y&&e.jsx(lt,{card:y,isFlipped:f,onFlip:()=>d(j=>!j),readOnly:i}),l&&e.jsxs("div",{className:"flex w-full items-center gap-2",children:[e.jsx("div",{className:"flex-1 h-1.5 rounded-full bg-muted overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full bg-primary transition-[width] duration-300",style:{width:`${N}%`}})}),e.jsxs("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:[v+1," of ",x.length]})]}),e.jsxs("div",{className:"flex w-full items-center justify-between gap-3",children:[e.jsxs(z,{variant:"outline",size:"sm",className:"rounded-lg",disabled:!k,onClick:T,children:[e.jsx(b.ChevronLeft,{size:16})," Previous"]}),e.jsxs(z,{size:"sm",className:"rounded-lg",onClick:M,children:[S?"Next":"Finish"," ",e.jsx(b.ChevronRight,{size:16})]})]})]})},q=[.5,.75,1,1.25,1.5,2],ut=u.memo(function({src:t,title:r,onEnded:n,onTimeUpdate:a,className:o,style:i}){const l=u.useRef(null),[c,x]=u.useState(!1),[p,h]=u.useState(!1),[f,d]=u.useState(0),[m,v]=u.useState(0),[y,k]=u.useState(1),S=u.useRef(-1),C=u.useRef(a);C.current=a;const T=u.useCallback(()=>{const D=l.current;D&&(D.paused?D.play():D.pause())},[]),M=u.useCallback(()=>{const D=l.current;D&&(D.muted=!D.muted,h(E=>!E))},[]),N=u.useCallback(()=>{const D=l.current;D&&k(E=>{const $=q.indexOf(E),fe=q[($+1)%q.length];return D.playbackRate=fe,fe})},[]),j=u.useCallback(D=>{const E=l.current;if(!E)return;const $=Number(D.target.value);E.currentTime=$,S.current=Math.floor($*4)/4,d($)},[]),w=u.useCallback(()=>{var $;const D=l.current;if(!D)return;const E=Math.floor(D.currentTime*4)/4;E!==S.current&&(S.current=E,d(D.currentTime),($=C.current)==null||$.call(C,D.currentTime,D.duration))},[]),_=u.useCallback(()=>{const D=l.current;D&&!isNaN(D.duration)&&v(D.duration)},[]),P=m>0?f/m*100:0;return e.jsxs("div",{"data-slot":"audio-player",className:g("rounded-lg border bg-card p-4 space-y-3",o),style:i,children:[r&&e.jsx("p",{className:"text-sm font-medium text-foreground",children:r}),e.jsx("audio",{ref:l,src:t,onPlay:()=>x(!0),onPause:()=>x(!1),onEnded:()=>{x(!1),n==null||n()},onTimeUpdate:w,onLoadedMetadata:_,preload:"metadata"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(z,{variant:"ghost",size:"icon-sm",onClick:T,"aria-label":c?"Pause":"Play",children:c?e.jsx(b.Pause,{className:"size-4"}):e.jsx(b.Play,{className:"size-4"})}),e.jsx("span",{className:"text-xs tabular-nums text-muted-foreground w-12 shrink-0",children:V(Math.floor(f))}),e.jsxs("div",{className:"relative flex-1 h-5 flex items-center",children:[e.jsx("div",{className:"absolute inset-y-0 left-0 flex items-center w-full",children:e.jsx("div",{className:"w-full h-1 rounded-full bg-muted overflow-hidden",children:e.jsx("div",{className:"h-full bg-primary rounded-full transition-[width] duration-100",style:{width:`${P}%`}})})}),e.jsx("input",{type:"range",min:0,max:m||0,step:.1,value:f,onChange:j,className:"absolute inset-0 w-full opacity-0 cursor-pointer","aria-label":"Seek"})]}),e.jsx("span",{className:"text-xs tabular-nums text-muted-foreground w-12 shrink-0 text-right",children:V(Math.floor(m))}),e.jsx(z,{variant:"ghost",size:"icon-xs",onClick:M,"aria-label":p?"Unmute":"Mute",children:p?e.jsx(b.VolumeX,{className:"size-3.5"}):e.jsx(b.Volume2,{className:"size-3.5"})}),e.jsxs("button",{type:"button",onClick:N,className:"text-xs font-medium text-muted-foreground hover:text-foreground transition-colors tabular-nums w-8 text-center","aria-label":`Playback speed ${y}x`,children:[y,"x"]})]})]})}),ft=u.memo(function({code:t,language:r,filename:n,showLineNumbers:a=!1,onCopy:o,className:i,style:l}){const[c,x]=u.useState(!1),p=!!(n||r),h=u.useRef(void 0);u.useEffect(()=>()=>clearTimeout(h.current),[]);const f=u.useCallback(async()=>{try{await navigator.clipboard.writeText(t),x(!0),o==null||o(),clearTimeout(h.current),h.current=setTimeout(()=>x(!1),2e3)}catch{}},[t,o]),d=t.split(`
|
|
2
|
+
`),m=e.jsx(z,{variant:"ghost",size:"icon-xs",onClick:f,"aria-label":c?"Copied":"Copy code",children:c?e.jsx(b.Check,{className:"size-3"}):e.jsx(b.Copy,{className:"size-3"})});return e.jsxs("div",{"data-slot":"code-block",className:g("relative rounded-lg border bg-card overflow-hidden text-sm",i),style:l,children:[p?e.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b bg-muted/50",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(b.FileCode,{className:"size-3.5"}),e.jsx("span",{children:n??r})]}),m]}):e.jsx("div",{className:"absolute top-2 right-2 z-10",children:m}),e.jsx("div",{className:"overflow-x-auto",children:e.jsx("pre",{className:"p-4 m-0",children:e.jsx("code",{className:r?`language-${r}`:void 0,children:a?d.map((v,y)=>e.jsxs("div",{className:"flex",children:[e.jsx("span",{className:"select-none text-muted-foreground/50 w-8 shrink-0 text-right pr-4 tabular-nums",children:y+1}),e.jsx("span",{children:v})]},y)):t})})})]})});function mt({className:s,...t}){return e.jsx("div",{"data-slot":"skeleton",className:g("bg-muted animate-pulse rounded-md",s),...t})}const fs={"16/9":"aspect-video","4/3":"aspect-[4/3]","1/1":"aspect-square"},xt=u.memo(function({src:t,title:r,aspectRatio:n="16/9",allowFullscreen:a=!0,className:o,style:i}){const[l,c]=u.useState(!1);return e.jsxs("div",{"data-slot":"embed-block",className:g("rounded-lg border bg-card overflow-hidden",o),style:i,children:[r&&e.jsx("div",{className:"flex items-center justify-between px-4 py-2 border-b bg-muted/50",children:e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(b.ExternalLink,{className:"size-3.5"}),e.jsx("span",{children:r})]})}),e.jsxs("div",{className:g("relative w-full",fs[n]),children:[!l&&e.jsx(mt,{className:"absolute inset-0 rounded-none"}),e.jsx("iframe",{src:t,title:r??"Embedded content",allowFullScreen:a,onLoad:()=>c(!0),className:"absolute inset-0 w-full h-full border-0",sandbox:"allow-scripts allow-same-origin allow-popups allow-presentation"})]})]})});function ae(s){return s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/(1024*1024)).toFixed(1)} MB`}function ms(s){return s.startsWith("image/")?b.Image:s.startsWith("video/")?b.Film:s.startsWith("audio/")?b.Music:s==="application/pdf"?b.FileText:s==="application/zip"||s==="application/x-rar-compressed"||s==="application/gzip"?b.Archive:b.File}function pt({files:s,onDownload:t,onRemove:r,readOnly:n=!0,className:a,style:o}){return s.length===0?null:e.jsx("div",{className:g("flex flex-col gap-1",a),style:o,children:s.map((i,l)=>{const c=ms(i.type);return e.jsxs("div",{className:"flex items-center gap-3 rounded-md px-2 py-1.5 hover:bg-muted/50 transition-colors",children:[e.jsx("span",{className:"shrink-0 text-muted-foreground",children:e.jsx(c,{size:18})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"text-sm text-foreground block truncate",children:i.name}),e.jsx("span",{className:"text-xs text-muted-foreground",children:ae(i.size)})]}),t&&i.url&&e.jsx(z,{variant:"ghost",size:"sm",className:"shrink-0 h-7 w-7 p-0",onClick:()=>t(i),"aria-label":`Download ${i.name}`,children:e.jsx(b.Download,{size:14})}),!n&&r&&e.jsx(z,{variant:"ghost",size:"sm",className:"shrink-0 h-7 w-7 p-0 text-muted-foreground hover:text-destructive",onClick:()=>r(i),"aria-label":`Remove ${i.name}`,children:e.jsx(b.X,{size:14})})]},`${i.name}-${l}`)})})}const xs={info:{variant:"info",Icon:b.Info},warning:{variant:"warning",Icon:b.AlertTriangle},tip:{variant:"success",Icon:b.Lightbulb}},gt=u.memo(function({block:t,onQuestionAnswer:r,readOnly:n=!1,className:a,style:o}){const i=l=>e.jsx("div",{className:g(a),style:o,children:l});switch(t.type){case"video":return i(e.jsx(ot,{...t.video,readOnly:n}));case"richtext":return i(e.jsx("div",{className:"[&_p]:mb-[1.5em] [&_ul]:pl-[1.5em] [&_ol]:pl-[1.5em]",dangerouslySetInnerHTML:{__html:t.html}}));case"heading":{const l=t.level===1?"h2":t.level===3?"h4":"h3",c=t.level===1?"text-xl":t.level===3?"text-base":"text-lg";return i(e.jsx(l,{className:g(c,"font-semibold m-0"),children:t.text}))}case"image":return i(e.jsxs("figure",{className:"m-0",children:[e.jsx("img",{src:t.src,alt:t.alt??"",loading:"lazy",className:"max-w-full rounded-sm"}),t.caption&&e.jsx("figcaption",{className:"text-xs text-muted-foreground mt-0.5",children:t.caption})]}));case"callout":{const l=xs[t.variant??"info"];return i(e.jsxs(I,{variant:l.variant,children:[e.jsx(l.Icon,{size:20}),e.jsx(L,{children:t.content})]}))}case"question":return i(e.jsx(ne,{question:t.question,onAnswer:l=>r==null?void 0:r(t.question.uid,l.map(c=>({uid:t.question.uid,answerUid:c.uid,content:c.content}))),readOnly:n}));case"flashcards":return i(e.jsx(dt,{cards:t.cards,deckName:t.deckName,readOnly:n}));case"audio":return i(e.jsx(ut,{src:t.src,title:t.title}));case"code":return i(e.jsx(ft,{code:t.code,language:t.language,filename:t.filename,showLineNumbers:t.showLineNumbers}));case"embed":return i(e.jsx(xt,{src:t.src,title:t.title,aspectRatio:t.aspectRatio,allowFullscreen:t.allowFullscreen}));case"table":return i(e.jsxs(te,{children:[t.caption&&e.jsx($e,{children:t.caption}),e.jsx(se,{children:e.jsx(F,{children:t.headers.map((l,c)=>e.jsx(W,{children:l},c))})}),e.jsx(re,{children:t.rows.map((l,c)=>e.jsx(F,{children:l.map((x,p)=>e.jsx(U,{children:x},p))},c))})]}));case"file":return i(e.jsx(pt,{files:t.files,readOnly:!0}));case"divider":return i(e.jsx(A,{}));case"custom":return i(e.jsx(e.Fragment,{children:t.render}));default:return null}});function ps({files:s,onFilesAdded:t,onFileRemove:r,accept:n,maxFiles:a,maxSizeMB:o,disabled:i=!1,label:l="Drag files here or click to browse"}){const c=u.useRef(null),[x,p]=u.useState(!1),h=a!=null&&s.length>=a;function f(d){if(!d)return;let m=Array.from(d);o&&(m=m.filter(v=>v.size<=o*1024*1024)),a&&(m=m.slice(0,a-s.length)),m.length>0&&t(m)}return e.jsxs("div",{children:[e.jsxs("div",{className:g("border-2 border-dashed border-border rounded-md p-8 text-center cursor-pointer transition-all duration-200",x&&"border-primary bg-muted",i&&"cursor-default opacity-50",h&&"cursor-default","focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring"),role:"button",tabIndex:i||h?-1:0,"aria-label":h?`Maximum ${a} files reached`:l,onKeyDown:d=>{var m;(d.key==="Enter"||d.key===" ")&&!i&&!h&&(d.preventDefault(),(m=c.current)==null||m.click())},onDragOver:d=>{d.preventDefault(),!i&&!h&&p(!0)},onDragLeave:()=>p(!1),onDrop:d=>{d.preventDefault(),p(!1),!i&&!h&&f(d.dataTransfer.files)},onClick:()=>{var d;return!i&&!h&&((d=c.current)==null?void 0:d.click())},children:[e.jsx(b.Upload,{size:32,className:"mx-auto mb-2 opacity-50"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:h?`Maximum ${a} files reached`:l}),(n||o)&&e.jsx("span",{className:"text-xs text-muted-foreground mt-1 block",children:[n&&`Accepted: ${n}`,o&&`Max: ${o}MB`].filter(Boolean).join(" · ")})]}),e.jsx("input",{ref:c,type:"file",accept:n,multiple:!a||a>1,hidden:!0,onChange:d=>{f(d.target.files),d.target.value=""}}),s.length>0&&e.jsx("div",{className:"flex flex-col gap-1 mt-2",children:s.map((d,m)=>e.jsxs("div",{className:"flex items-center gap-3 py-1",children:[e.jsx("div",{className:"shrink-0 w-9 flex justify-center text-muted-foreground",children:e.jsx(b.File,{size:18})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"text-sm block truncate",children:d.name}),e.jsx("span",{className:"text-xs text-muted-foreground",children:ae(d.size)})]}),e.jsx(z,{variant:"ghost",size:"icon-xs","aria-label":"Remove file",onClick:()=>r(m),disabled:i,children:e.jsx(b.X,{size:16})})]},`${d.name}-${m}`))})]})}const gs=({open:s,onOpenChange:t,materials:r,questionNumber:n})=>{if(!r.length)return null;const a=n?`Question ${n} — Related Material`:"Related Material";return e.jsx(Je,{open:s,onOpenChange:t,side:"right",children:e.jsxs(tt,{size:"lg",scrollLock:!1,children:[e.jsxs(st,{className:"flex-row items-center justify-between",children:[e.jsx(nt,{children:a}),e.jsx(at,{})]}),e.jsx(rt,{children:e.jsx("div",{className:"space-y-6",children:r.map((o,i)=>e.jsxs("section",{children:[o.label&&e.jsx("h3",{className:"text-sm font-semibold text-foreground mb-3",children:o.label}),e.jsx("div",{className:"space-y-4",children:o.blocks.map((l,c)=>e.jsx(gt,{block:l,readOnly:!0},c))}),i<r.length-1&&e.jsx("div",{className:"border-b border-border mt-6"})]},i))})})]})})},hs={video:b.Video,video_lesson:b.Video,stream:b.PlayCircle,document:b.FileText,pdf:b.FileText,page:b.FileText,quiz:b.HelpCircle,assessment:b.HelpCircle,assignment:b.ClipboardList,discussion:b.MessageSquare,link:b.ExternalLink,url:b.ExternalLink,audio:b.Music,image:b.Image,scorm:b.Code,iframe:b.Code,lesson:b.BookOpen,module:b.BookOpen},ht=({type:s,size:t=18})=>{const r=hs[s]??b.FileText;return e.jsx(r,{size:t})},bt=u.memo(function({item:t,level:r,isActive:n=!1,isCompleted:a=!1,isExpanded:o=!1,hasChildren:i,onToggleExpand:l,onClick:c,showDuration:x=!0,showIcon:p=!0,showProgress:h=!0}){const f=i,d=f?"font-semibold":n?"font-medium":"font-normal";return e.jsxs("div",{className:g("flex items-center gap-2 py-2 pr-3 transition-colors",c&&"cursor-pointer hover:bg-muted",n&&"bg-secondary"),style:{paddingLeft:`${r*20+8}px`},onClick:c?()=>c(t):void 0,role:c?"button":void 0,tabIndex:c?0:void 0,onKeyDown:c?m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),c(t))}:void 0,children:[e.jsx("div",{className:"shrink-0 flex items-center justify-center size-5",children:h&&a?e.jsx("span",{className:"text-success",children:e.jsx(b.CheckCircle2,{size:18})}):p?e.jsx("span",{className:n?"text-primary":"text-muted-foreground",children:e.jsx(ht,{type:t.type,size:16})}):e.jsx("span",{className:"text-muted-foreground",children:e.jsx(b.Circle,{size:16})})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:g("text-sm truncate",n?"text-primary":"text-foreground",d),children:t.name}),x&&t.duration>0&&!f&&e.jsx("div",{className:"text-xs text-muted-foreground mt-0.5",children:Be(t.duration)})]}),i&&e.jsx("button",{className:"inline-flex items-center justify-center rounded-md p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground","aria-label":o?"Collapse":"Expand",onClick:m=>{m.stopPropagation(),l==null||l(t.uid)},children:o?e.jsx(b.ChevronDown,{size:16}):e.jsx(b.ChevronRight,{size:16})})]})}),bs=({items:s,progress:t,activeItemUid:r,onItemClick:n,readOnly:a=!1,showDuration:o=!0,showIcons:i=!0,showProgress:l=!0})=>{const[c,x]=u.useState({}),p=u.useMemo(()=>!t||!l?new Set:new Set(t.filter(m=>m.isCompleted).map(m=>m.resourceUid)),[t,l]),h=u.useCallback(m=>{x(v=>({...v,[m]:!v[m]}))},[]),f=u.useCallback(m=>{n==null||n(m)},[n]);if(!s||s.length===0)return null;const d=(m,v)=>e.jsx("div",{className:"flex flex-col",children:m.map(y=>{var C;const k=!!((C=y.children)!=null&&C.length),S=c[y.uid]||!1;return e.jsxs("div",{children:[e.jsx(bt,{item:y,level:v,isActive:r===y.uid,isCompleted:p.has(y.uid),isExpanded:S,hasChildren:k,onToggleExpand:h,onClick:a?void 0:f,showDuration:o,showIcon:i,showProgress:l}),k&&S&&d(y.children,v+1)]},y.uid)})});return e.jsx("nav",{className:"rounded-lg border border-border overflow-hidden",children:d(s,0)})};function J({className:s,...t}){return e.jsx("div",{"data-slot":"card",className:g("bg-card text-card-foreground rounded-xl border shadow-sm",s),...t})}function vs({className:s,...t}){return e.jsx("div",{"data-slot":"card-header",className:g("flex flex-col gap-1.5 px-6 pt-6 has-data-[slot=card-action]:flex-row has-data-[slot=card-action]:items-center has-data-[slot=card-action]:justify-between",s),...t})}function js({className:s,...t}){return e.jsx("div",{"data-slot":"card-title",className:g("leading-none font-semibold",s),...t})}function ys({className:s,...t}){return e.jsx("div",{"data-slot":"card-description",className:g("text-muted-foreground text-sm",s),...t})}function Ns({className:s,...t}){return e.jsx("div",{"data-slot":"card-action",className:g("col-start-2 row-span-2 row-start-1 self-start justify-self-end",s),...t})}function oe({className:s,...t}){return e.jsx("div",{"data-slot":"card-content",className:g("px-6 pb-6 pt-0",s),...t})}function ws({className:s,...t}){return e.jsx("div",{"data-slot":"card-footer",className:g("flex items-center px-6 pb-6 pt-0",s),...t})}const vt=B.cva("inline-flex items-center justify-center rounded-full border px-2.5 py-0.5 text-xs font-medium whitespace-nowrap transition-colors [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground",secondary:"border-transparent bg-secondary text-secondary-foreground",destructive:"border-transparent bg-destructive text-destructive-foreground",outline:"text-foreground",success:"border-transparent bg-success/15 text-success",warning:"border-transparent bg-warning/15 text-warning",info:"border-transparent bg-info/15 text-info",muted:"border-transparent bg-muted text-muted-foreground",palette0:"border-transparent bg-palette-0/15 text-palette-0",palette1:"border-transparent bg-palette-1/15 text-palette-1",palette2:"border-transparent bg-palette-2/15 text-palette-2",palette3:"border-transparent bg-palette-3/15 text-palette-3"}},defaultVariants:{variant:"default"}});function Y({className:s,variant:t,asChild:r=!1,...n}){const a=r?Ve:"span";return e.jsx(a,{"data-slot":"badge",className:g(vt({variant:t}),s),...n})}const Cs={small:28,medium:36,large:48},ge={student:"Student",instructor:"Instructor",ta:"Teaching Assistant",admin:"Admin"},ks={instructor:"var(--primary)",ta:"var(--palette-0)",admin:"var(--destructive)",student:"var(--muted-foreground)"};function Ss(s){return s.split(" ").filter(Boolean).map(t=>t[0]).slice(0,2).join("").toUpperCase()}function ie({displayName:s,avatarUrl:t,role:r,showRoleBadge:n=!1,size:a="medium",className:o,style:i}){const l=Cs[a],c=l*.4,[x,p]=u.useState(!1),h=n&&r&&r!=="student",f=h?ge[r]??r:void 0;return e.jsxs("div",{className:g("relative inline-flex",o),style:i,title:f,children:[e.jsx("div",{className:"flex items-center justify-center rounded-full bg-muted text-muted-foreground overflow-hidden",style:{width:`${l}px`,height:`${l}px`,fontSize:`${c}px`},children:t&&!x?e.jsx("img",{className:"size-full object-cover",src:t,alt:s,loading:"lazy",onError:()=>p(!0)}):e.jsx("span",{children:Ss(s)})}),h&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"absolute -bottom-0.5 -right-0.5 size-2.5 rounded-full border-2 border-background",style:{background:ks[r]??"var(--muted-foreground)"},"aria-hidden":"true"}),e.jsx("span",{className:"sr-only",children:ge[r]??r})]})]})}function le({value:s,size:t=120,strokeWidth:r=8,label:n,color:a,className:o,style:i}){const l=(t-r)/2,c=2*Math.PI*l,x=c-Math.min(Math.max(s,0),100)/100*c,p=t/2;return e.jsxs("div",{className:g("relative inline-flex",o),style:{width:`${t}px`,height:`${t}px`,...i},children:[e.jsxs("svg",{width:t,height:t,role:"img","aria-label":n??`${Math.round(s)}% progress`,children:[e.jsx("circle",{cx:p,cy:p,r:l,fill:"none",stroke:"currentColor",strokeWidth:r,opacity:.15}),e.jsx("circle",{cx:p,cy:p,r:l,fill:"none",stroke:a??"currentColor",strokeWidth:r,strokeDasharray:c,strokeDashoffset:x,strokeLinecap:"round",transform:`rotate(-90 ${p} ${p})`,style:{transition:"stroke-dashoffset 0.4s ease"}})]}),e.jsx("span",{className:"absolute inset-0 flex items-center justify-center font-bold text-foreground",style:{fontSize:`${t*.2}px`},"aria-hidden":"true",children:n??`${Math.round(s)}%`})]})}const Ts={enrolled:{label:"Enrolled",variant:"default"},completed:{label:"Completed",variant:"success"},available:{label:"Available",variant:"muted"},locked:{label:"Locked",variant:"destructive"}},Ds=u.memo(function({title:t,description:r,thumbnailUrl:n,instructor:a,category:o,progress:i,enrollmentStatus:l="available",studentCount:c,duration:x,onClick:p,onEnroll:h,layout:f="vertical",className:d,style:m}){const v=f==="horizontal",y=Ts[l],k=(l==="enrolled"||l==="completed")&&i!=null,S=l==="locked";function C(T){T.stopPropagation(),h==null||h()}return e.jsx(J,{"data-slot":"course-card",className:g("overflow-hidden transition-colors",p&&"cursor-pointer hover:bg-muted/30",S&&"opacity-70",d),style:m,onClick:p,children:e.jsxs("div",{className:g(v?"flex flex-row":"flex flex-col"),children:[n?e.jsx("div",{className:g("bg-muted bg-cover bg-center shrink-0",v?"w-40 min-h-full":"h-36 w-full"),style:{backgroundImage:`url(${n})`}}):e.jsx("div",{className:g("bg-muted flex items-center justify-center shrink-0",v?"w-40 min-h-full":"h-36 w-full"),children:e.jsx("span",{className:"text-3xl text-muted-foreground/40 font-bold",children:t.charAt(0)})}),e.jsxs(oe,{className:g("flex-1 min-w-0",v?"py-3 px-4":"pt-3 pb-4"),children:[e.jsxs("div",{className:"flex items-start justify-between gap-2 mb-1",children:[e.jsx("h3",{className:"font-semibold text-foreground text-sm leading-tight line-clamp-2",children:t}),k&&e.jsx(le,{value:i,size:32,strokeWidth:3,color:l==="completed"?"var(--success)":"var(--primary)",className:"shrink-0"})]}),r&&e.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2 mb-2",children:r}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap mb-2",children:[o&&e.jsx(Y,{variant:"outline",className:"text-[10px] px-1.5 py-0",children:o}),e.jsxs(Y,{variant:y.variant,className:"text-[10px] px-1.5 py-0",children:[S&&e.jsx(b.Lock,{className:"size-2.5 mr-0.5"}),y.label]})]}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:[a&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ie,{displayName:a.displayName,avatarUrl:a.avatarUrl,size:"small"}),e.jsx("span",{className:"truncate max-w-24",children:a.displayName})]}),x&&e.jsxs("span",{className:"flex items-center gap-0.5",children:[e.jsx(b.Clock,{className:"size-3"}),x]}),c!=null&&e.jsxs("span",{className:"flex items-center gap-0.5",children:[e.jsx(b.Users,{className:"size-3"}),c]})]}),h&&l==="available"&&e.jsx(z,{size:"xs",onClick:C,children:"Enroll"})]})]})]})})});function _s({icon:s,title:t,description:r,action:n,className:a,style:o}){return e.jsxs("div",{className:g("flex flex-col items-center justify-center text-center px-3 py-6",a),style:o,role:"status",children:[s&&e.jsx("div",{className:"mb-2 text-muted-foreground [&>svg]:size-12",children:s}),e.jsx("p",{className:"text-lg font-semibold text-foreground mb-1",children:t}),r&&e.jsx("p",{className:g("text-sm text-muted-foreground max-w-[360px]",n&&"mb-2"),children:r}),n]})}const jt=u.createContext(null);function K(){const s=u.useContext(jt);if(!s)throw new Error("AlertDialog compound components must be used within <AlertDialog>");return s}const he=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(", ");function Ms(s,t){const r=u.useRef(null);return u.useEffect(()=>{if(!t||!s.current)return;r.current=document.activeElement;const a=s.current.querySelectorAll(he);return a.length>0&&a[0].focus(),()=>{r.current instanceof HTMLElement&&r.current.focus()}},[t,s]),u.useCallback(a=>{if(a.key!=="Tab"||!s.current)return;const o=Array.from(s.current.querySelectorAll(he));if(o.length===0)return;const i=o[0],l=o[o.length-1];a.shiftKey&&document.activeElement===i?(a.preventDefault(),l.focus()):!a.shiftKey&&document.activeElement===l&&(a.preventDefault(),i.focus())},[s])}function zs(s){u.useEffect(()=>{if(!s)return;const t=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=t}},[s])}function yt({children:s,open:t,onOpenChange:r}){const n=u.useId(),a=u.useId();return e.jsx(jt.Provider,{value:{open:t,onOpenChange:r,titleId:n,descriptionId:a},children:s})}function Is({className:s,onClick:t,...r}){const{onOpenChange:n}=K();return e.jsx("button",{type:"button","data-slot":"alert-dialog-trigger",className:s,onClick:a=>{n(!0),t==null||t(a)},...r})}function Nt({children:s}){return ee.createPortal(s,document.body)}function wt({className:s,...t}){const{onOpenChange:r}=K();return e.jsx("div",{"data-slot":"alert-dialog-backdrop",className:g("fixed inset-0 z-50 bg-black/50 transition-opacity data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=closed]:animate-out data-[state=closed]:fade-out-0",s),"data-state":"open",onClick:()=>r(!1),...t})}function Ct({className:s,children:t,...r}){const{open:n,onOpenChange:a,titleId:o,descriptionId:i}=K(),l=u.useRef(null),c=Ms(l,n);return zs(n),u.useEffect(()=>{if(!n)return;const x=p=>{p.key==="Escape"&&a(!1)};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[n,a]),n?e.jsxs(Nt,{children:[e.jsx(wt,{}),e.jsx("div",{ref:l,role:"alertdialog","aria-modal":"true","aria-labelledby":o,"aria-describedby":i,"data-slot":"alert-dialog-content","data-state":"open",className:g("bg-background fixed top-1/2 left-1/2 z-50 grid w-full max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 rounded-lg border p-6 shadow-lg transition-all data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",s),onKeyDown:c,...r,children:t})]}):null}function kt({className:s,...t}){return e.jsx("div",{"data-slot":"alert-dialog-header",className:g("flex flex-col gap-2 text-center sm:text-left",s),...t})}function St({className:s,...t}){return e.jsx("div",{"data-slot":"alert-dialog-footer",className:g("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",s),...t})}function Tt({className:s,...t}){const{titleId:r}=K();return e.jsx("h2",{id:r,"data-slot":"alert-dialog-title",className:g("text-lg font-semibold",s),...t})}function Dt({className:s,...t}){const{descriptionId:r}=K();return e.jsx("p",{id:r,"data-slot":"alert-dialog-description",className:g("text-muted-foreground text-sm",s),...t})}function _t({className:s,...t}){return e.jsx("button",{type:"button",className:g(Q(),s),...t})}function Mt({className:s,...t}){return e.jsx("button",{type:"button",className:g(Q({variant:"outline"}),s),...t})}const be={primary:"bg-primary text-primary-foreground hover:bg-primary/90",error:"bg-destructive text-destructive-foreground hover:bg-destructive/90",warning:"bg-warning text-warning-foreground hover:bg-warning/90"};function Ls({open:s,title:t,message:r,confirmLabel:n="Confirm",cancelLabel:a="Cancel",confirmColor:o="primary",onConfirm:i,onCancel:l,isLoading:c=!1}){return e.jsx(yt,{open:s,onOpenChange:x=>!x&&l(),children:e.jsxs(Ct,{children:[e.jsxs(kt,{children:[e.jsx(Tt,{children:t}),typeof r=="string"?e.jsx(Dt,{children:r}):r]}),e.jsxs(St,{children:[e.jsx(Mt,{onClick:l,disabled:c,children:a}),e.jsxs(_t,{className:g(be[o]??be.primary),onClick:i,disabled:c,children:[c&&e.jsx("span",{className:"inline-block size-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),n]})]})]})})}function Es({value:s,onChange:t,placeholder:r="Search...",debounceMs:n=300,fullWidth:a=!1,size:o="small",className:i,style:l}){const[c,x]=u.useState(s),p=u.useRef(t);p.current=t;const h=u.useMemo(()=>O(m=>p.current(m),n),[n]);u.useEffect(()=>()=>h.cancel(),[h]);function f(m){const v=m.target.value;x(v),h(v)}function d(){x(""),t("")}return e.jsx("div",{className:g("w-full",i),style:{...l,width:a?"100%":void 0},children:e.jsxs("div",{className:"flex items-center w-full border border-input rounded-md bg-background transition-colors focus-within:border-ring focus-within:ring-ring/50 focus-within:ring-[3px]",children:[e.jsx("span",{className:"flex items-center justify-center px-2 text-muted-foreground shrink-0",children:e.jsx(b.Search,{size:18})}),e.jsx("input",{className:g("flex-1 border-none outline-none bg-transparent text-foreground text-sm min-w-0 placeholder:text-muted-foreground",o==="medium"?"py-2":"py-1.5"),value:c,onChange:f,placeholder:r}),c&&e.jsx("button",{type:"button",className:"inline-flex items-center justify-center p-0.5 mr-1 rounded-md text-muted-foreground cursor-pointer transition-colors hover:bg-muted hover:text-foreground","aria-label":"Clear search",onClick:d,children:e.jsx(b.X,{size:16})})]})})}const Rs={graded:"green",submitted:"teal",pending:"gray",missing:"red",late:"orange",excused:"gray",draft:"gray",not_started:"gray",resubmit:"orange"},$s={success:"green",error:"red",warning:"orange",info:"teal",default:"gray"},Hs={green:"success",red:"destructive",orange:"warning",gray:"muted",teal:"info"},ve={green:"bg-transparent border-success text-success",red:"bg-transparent border-destructive text-destructive",orange:"bg-transparent border-warning text-warning",gray:"bg-transparent border-border text-muted-foreground",teal:"bg-transparent border-info text-info"},Ps={green:"bg-success text-success-foreground",red:"bg-destructive text-destructive-foreground",orange:"bg-warning text-warning-foreground",teal:"bg-info text-info-foreground"};function As({status:s,colorMap:t,size:r="small",variant:n="filled"}){const a={...Rs};if(t)for(const[x,p]of Object.entries(t))a[x]=$s[p]??p;const o=a[s]??"gray",i=s.replace(/_/g," ").replace(/\b\w/g,x=>x.toUpperCase()),l=Hs[o]??"muted",c=n==="outlined"?ve[o]??ve.gray:Ps[o]??void 0;return e.jsx(Y,{variant:l,className:g(r==="small"?"text-xs px-2 h-5.5":"text-sm px-2.5 h-6.5","leading-none",c),children:i})}const Bs={success:"text-success",destructive:"text-destructive",warning:"text-warning",muted:"text-muted-foreground"};function Us(s){const t=new Date,r=s.getTime()-t.getTime(),n=Math.round(r/(1e3*60*60*24));return n===0?"Due today":n===1?"Due tomorrow":n===-1?"Due yesterday":n>1?`Due in ${n} days`:`${Math.abs(n)} days overdue`}function Fs(s,t){if(t)return"success";const r=new Date,a=(s.getTime()-r.getTime())/(1e3*60*60*24);return a<0?"destructive":a<2?"warning":"muted"}function Vs({dueDate:s,submittedDate:t,showRelative:r=!0,size:n="medium",className:a,style:o}){const i=new Date(s),l=!!t,c=Bs[Fs(i,l)]??"text-muted-foreground",x=n==="small"?14:16;return e.jsxs("div",{className:g("flex items-center gap-1",c,a),style:o,children:[e.jsx("span",{className:"shrink-0 inline-flex",children:l?e.jsx(b.CheckCircle,{size:x}):e.jsx(b.Clock,{size:x})}),e.jsx("span",{className:n==="small"?"text-xs":"text-sm",children:l?`Submitted ${new Date(t).toLocaleDateString()}`:r?Us(i):i.toLocaleDateString()})]})}function Os({steps:s,currentStep:t,orientation:r="horizontal",variant:n="default",className:a,style:o}){const i=r==="horizontal",l=n==="compact",c=l?"w-6 h-6 text-xs":"w-8 h-8 text-sm",x=l?12:16;return e.jsx("div",{className:g("flex",i?"flex-row items-start":"flex-col",a),style:o,children:s.map((p,h)=>{const f=h<t,d=h===t;return e.jsxs("div",{className:g("flex",i?"flex-1 flex-row items-start":"flex-row items-start"),children:[e.jsxs("div",{className:g("flex",i?"flex-col items-center":"flex-row items-start gap-3"),children:[e.jsx("div",{className:g("rounded-full flex items-center justify-center shrink-0 font-semibold transition-colors",c,f&&"bg-primary text-primary-foreground",d&&"border-2 border-primary bg-primary/10 text-primary",!f&&!d&&"border-2 border-border bg-muted text-muted-foreground"),children:f?e.jsx(b.Check,{size:x}):e.jsx("span",{children:h+1})}),e.jsxs("div",{className:g(i?"mt-1.5 text-center":"pt-0.5"),children:[e.jsx("p",{className:g("text-sm font-medium leading-tight",d?"text-foreground":"text-muted-foreground"),children:p.label}),!l&&p.description&&e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:p.description})]})]}),h<s.length-1&&(i?e.jsx("div",{className:g("flex-1 h-0.5 self-center mt-0 mx-2",l?"mt-3":"mt-4",f?"bg-primary":"bg-border")}):e.jsx("div",{className:g("w-0.5 h-6 ml-3.5",l&&"ml-2.5",f?"bg-primary":"bg-border")}))]},h)})})}function Qs(s,t,r){const n=r*2+5;if(t<=n)return Array.from({length:t},(x,p)=>p+1);const a=Math.max(s-r,1),o=Math.min(s+r,t),i=a>2,l=o<t-1;if(!i&&l){const x=r*2+3;return[...Array.from({length:x},(h,f)=>f+1),"ellipsis",t]}if(i&&!l){const x=r*2+3;return[1,"ellipsis",...Array.from({length:x},(h,f)=>t-x+f+1)]}return[1,"ellipsis",...Array.from({length:o-a+1},(x,p)=>a+p),"ellipsis",t]}const Ks=u.memo(function({currentPage:t,totalPages:r,onPageChange:n,siblingCount:a=1,className:o,style:i}){const l=u.useMemo(()=>Qs(t,r,a),[t,r,a]);return r<=1?null:e.jsxs("nav",{"data-slot":"pagination","aria-label":"Pagination",className:g("flex items-center justify-center gap-1",o),style:i,children:[e.jsx(z,{variant:"ghost",size:"icon-sm",onClick:()=>n(t-1),disabled:t<=1,"aria-label":"Previous page",children:e.jsx(b.ChevronLeft,{className:"size-4"})}),l.map((c,x)=>c==="ellipsis"?e.jsxs("span",{className:"flex items-center justify-center size-8 text-xs text-muted-foreground",children:[e.jsx("span",{"aria-hidden":"true",children:"..."}),e.jsx("span",{className:"sr-only",children:"More pages"})]},`ellipsis-${x}`):e.jsx(z,{variant:c===t?"default":"ghost",size:"icon-sm",onClick:()=>n(c),"aria-label":`Page ${c}`,"aria-current":c===t?"page":void 0,children:e.jsx("span",{className:"text-xs",children:c})},c)),e.jsx(z,{variant:"ghost",size:"icon-sm",onClick:()=>n(t+1),disabled:t>=r,"aria-label":"Next page",children:e.jsx(b.ChevronRight,{className:"size-4"})})]})});function Gs({isCorrect:s,explanation:t,onRetry:r,retryLabel:n="Try Again",className:a,style:o}){return e.jsxs(I,{variant:s?"success":"destructive",className:g(a),style:o,children:[e.jsx("span",{className:"shrink-0",children:s?e.jsx(b.CheckCircle,{size:20}):e.jsx(b.XCircle,{size:20})}),e.jsx("div",{className:"flex-1",children:e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{children:[e.jsx("span",{className:"font-semibold",children:s?"Correct!":"Incorrect"}),t&&e.jsx("p",{className:"mt-1 text-foreground",children:t})]}),!s&&r&&e.jsx(z,{variant:"outline",size:"sm",className:"shrink-0",onClick:r,children:n})]})})]})}function Ws({value:s,onChange:t,points:r=5,lowLabel:n="Strongly Disagree",highLabel:a="Strongly Agree",disabled:o=!1,readOnly:i=!1,className:l,style:c}){const x=Array.from({length:r},(h,f)=>f+1),p=!o&&!i;return e.jsxs("div",{className:g("flex flex-col gap-1",l),style:c,children:[e.jsx("div",{className:"flex flex-row",role:"radiogroup",children:x.map(h=>{const f=s===h;return e.jsxs("label",{className:g("flex items-center justify-center border border-border px-1.5 py-2 text-sm transition-colors first:rounded-l-md last:rounded-r-md -ml-px first:ml-0",f?"bg-primary text-primary-foreground border-primary z-10":"bg-background text-foreground",!p&&"opacity-60 cursor-not-allowed",p&&!f&&"cursor-pointer hover:bg-muted"),children:[e.jsx("input",{type:"radio",name:"likert-scale",className:"sr-only",value:h,checked:f,disabled:o,onChange:()=>{p&&t(h)}}),e.jsx("span",{className:"text-sm font-medium",children:h})]},h)})}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:n}),e.jsx("span",{className:"text-xs text-muted-foreground",children:a})]})]})}const Ys={small:18,medium:24,large:32};function Zs({value:s,onChange:t,maxStars:r=5,allowHalf:n=!1,size:a="medium",disabled:o=!1,readOnly:i=!1,className:l,style:c}){const[x,p]=u.useState(null),h=Ys[a],f=x??s,d=!o&&!i;function m(v){d&&t(v)}return e.jsx("div",{className:g("inline-flex gap-0.5",l),style:c,onMouseLeave:()=>d&&p(null),children:Array.from({length:r},(v,y)=>{const k=y+1,S=f>=k,C=n&&!S&&f>=k-.5;return e.jsx("button",{type:"button",className:g("inline-flex items-center justify-center rounded-md border-none bg-transparent p-0",d?"cursor-pointer":"cursor-default",S||C?"text-warning":"text-muted-foreground"),disabled:o,onClick:()=>m(k),onMouseEnter:()=>d&&p(k),"aria-label":`Rate ${k} star${k!==1?"s":""}`,children:e.jsx(b.Star,{size:h,fill:S||C?"currentColor":"none",strokeWidth:1.5,style:C?{clipPath:"inset(0 50% 0 0)"}:void 0})},y)})})}const Xs={small:48,medium:64,large:96},Js={small:"0.75rem",medium:"0.875rem",large:"1rem"},qs={small:"4px",medium:"6px",large:"8px"},er={primary:"var(--primary)",success:"var(--success)",warning:"var(--warning)",destructive:"var(--destructive)"};function tr(s,t){return t==null?"primary":s>=t?"success":s>=t*.7?"warning":"destructive"}function sr({percentage:s,letterGrade:t,variant:r="circular",size:n="medium",passingThreshold:a,showLabel:o=!0,className:i,style:l}){const c=tr(s,a),x=er[c]??"var(--primary)";return r==="linear"?e.jsxs("div",{className:g("flex flex-row items-center gap-1",i),style:l,children:[e.jsx("div",{className:"flex-1 bg-muted rounded-full overflow-hidden",style:{height:qs[n]},role:"progressbar","aria-valuenow":Math.round(s),"aria-valuemin":0,"aria-valuemax":100,"aria-label":`Grade: ${t??`${Math.round(s)}%`}`,children:e.jsx("div",{className:"h-full rounded-full transition-[width] duration-300 ease-in-out",style:{width:`${s}%`,background:x}})}),o&&e.jsx("span",{className:"font-semibold min-w-9",style:{fontSize:Js[n]},children:t??`${Math.round(s)}%`})]}):e.jsx("div",{className:g("inline-flex flex-col items-center",i),style:l,children:e.jsx(le,{value:s,size:Xs[n],strokeWidth:n==="small"?4:6,color:x,label:t??`${Math.round(s)}%`})})}const rr={up:"var(--success)",down:"var(--destructive)",flat:"var(--muted-foreground)"},nr={up:b.TrendingUp,down:b.TrendingDown,flat:b.Minus},ar=u.memo(function({icon:t,label:r,description:n,value:a,subtitle:o,trend:i,accent:l,className:c,style:x}){const p=i?nr[i.direction]:null,h=u.useMemo(()=>({backgroundColor:`color-mix(in oklch, ${l??"var(--primary)"} 10%, transparent)`,color:l??"var(--primary)"}),[l]);return e.jsx(J,{className:g(c),style:x,children:e.jsxs(oe,{className:"p-4",children:[t&&e.jsx("div",{className:"mb-2 w-9 h-9 rounded-lg flex items-center justify-center [&>svg]:size-5",style:h,children:t}),e.jsx("span",{className:"text-sm font-medium text-foreground",children:r}),n&&e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 leading-snug",children:n}),e.jsxs("div",{className:"flex flex-row items-baseline gap-1.5 mt-1",children:[e.jsx("span",{className:"text-3xl font-bold tracking-tight",children:a}),i&&p&&e.jsxs("span",{className:"flex flex-row items-center gap-px",style:{color:rr[i.direction]},children:[e.jsx(p,{size:14}),e.jsxs("span",{className:"text-xs font-semibold",children:[i.value>0?"+":"",i.value,"%"]})]})]}),o&&e.jsx("span",{className:"text-xs text-muted-foreground",children:o})]})})}),or={default:"text-primary",gold:"text-palette-3",silver:"text-muted-foreground",bronze:"text-palette-3/70"};function ir({title:s,description:t,icon:r,earnedDate:n,locked:a=!1,variant:o="default",className:i,style:l}){return e.jsxs(J,{className:g("p-2 text-center",a&&"opacity-60",i),style:l,children:[e.jsx("div",{className:"mx-auto mb-1 w-12 h-12 flex items-center justify-center",children:a?e.jsx(b.Lock,{size:32,className:"text-muted-foreground"}):r??e.jsx(b.Trophy,{size:32,className:or[o]})}),e.jsx("p",{className:"font-semibold text-sm text-foreground",children:s}),t&&e.jsx("p",{className:"text-xs text-muted-foreground",children:t}),n&&!a&&e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:new Date(n).toLocaleDateString()})]})}function lr({currentStreak:s,longestStreak:t,unit:r="days",showLongest:n=!1,className:a,style:o}){return e.jsxs("div",{className:g("flex items-center gap-2",a),style:o,children:[e.jsx(b.Flame,{size:20,className:"text-warning shrink-0"}),e.jsxs("div",{children:[e.jsxs("span",{className:"text-sm font-bold text-foreground",children:[s," ",r]}),n&&t!=null&&e.jsxs("span",{className:"block text-xs text-muted-foreground",children:["Longest: ",t," ",r]})]})]})}function ce(s){const t=new Date(s),n=new Date().getTime()-t.getTime(),a=Math.floor(n/6e4);if(a<1)return"Just now";if(a<60)return`${a}m ago`;const o=Math.floor(a/60);if(o<24)return`${o}h ago`;const i=Math.floor(o/24);return i<7?`${i}d ago`:t.toLocaleDateString()}const cr={lesson_completed:b.BookOpen,quiz_passed:b.CheckCircle,assignment_submitted:b.Send,badge_earned:b.Award};function dr({events:s,limit:t,showLoadMore:r=!1,onLoadMore:n,emptyMessage:a="No recent activity",className:o,style:i}){const l=t?s.slice(0,t):s;return s.length===0?e.jsx("p",{className:g("text-sm text-muted-foreground",o),style:i,children:a}):e.jsxs("div",{className:g("relative",o),style:i,children:[e.jsx("div",{className:"absolute left-3.5 top-0 bottom-0 w-px bg-border"}),l.map(c=>{const x=cr[c.type]??b.Circle;return e.jsxs("div",{className:"relative flex gap-3 pb-4 last:pb-0",children:[e.jsx("div",{className:"relative z-10 shrink-0 w-7 h-7 rounded-full bg-background border border-border flex items-center justify-center",children:c.icon??e.jsx(x,{size:14,className:"text-muted-foreground"})}),e.jsxs("div",{className:"flex-1 min-w-0 pt-0.5",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:c.title}),c.description&&e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:c.description}),e.jsx("span",{className:"text-xs text-muted-foreground",children:ce(c.timestamp)})]})]},c.uid)}),r&&n&&e.jsx("div",{className:"pl-10 pt-1",children:e.jsx(z,{variant:"ghost",size:"sm",onClick:n,children:"Load more"})})]})}const ur={pinned:"var(--warning)",answer:"var(--success)"},fr=u.memo(function({author:t,content:r,createdAt:n,updatedAt:a,actions:o,highlight:i="none",indentLevel:l=0,className:c,style:x}){const p=ur[i];return e.jsx("div",{className:g("rounded-md border border-border p-3",c),style:{marginLeft:l?`calc(${l} * 1rem)`:void 0,...p&&{borderLeftWidth:"3px",borderLeftColor:p},...x},children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ie,{displayName:t.displayName,avatarUrl:t.avatarUrl,role:t.role,size:"medium"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap text-sm",children:[e.jsx("span",{className:"font-semibold",children:t.displayName}),t.role&&t.role!=="student"&&e.jsx("span",{className:"rounded-full bg-primary/10 px-1.5 py-0.5 text-xs font-medium text-primary capitalize",children:t.role}),e.jsx("span",{className:"text-xs text-muted-foreground",children:ce(n)}),a&&e.jsx("span",{className:"text-xs text-muted-foreground italic",children:"(edited)"}),i==="pinned"&&e.jsx(b.Pin,{size:14})]}),e.jsx("div",{className:"mt-1 text-sm [&_p]:mb-1 [&_ul]:list-disc [&_ul]:pl-5 [&_ol]:list-decimal [&_ol]:pl-5 [&_a]:text-primary [&_a]:underline",dangerouslySetInnerHTML:{__html:r}}),o&&e.jsxs(e.Fragment,{children:[e.jsx(A,{className:"my-2"}),e.jsx("div",{className:"flex items-center gap-1",children:o})]})]})]})})}),de="hydra_key_v",mr=300*1e3;function xr(s){try{const t=sessionStorage.getItem(de);if(t){const{result:r,ts:n,key:a}=JSON.parse(t);if(a===s&&Date.now()-n<mr)return r}}catch{}return null}function pr(s,t){try{sessionStorage.setItem(de,JSON.stringify({result:t,ts:Date.now(),key:s}))}catch{}}function je(s){try{const t=sessionStorage.getItem(de);if(t){const{result:r,key:n}=JSON.parse(t);if(n===s&&r==="valid-pro")return"valid-pro"}}catch{}return"invalid"}async function gr(s,t){if(!t)return"skip";if(!s)return"no-key";const r=xr(s);if(r)return r;try{const n=await fetch(`${t}?key=${encodeURIComponent(s)}`,{method:"GET",signal:AbortSignal.timeout(4e3)});if(!n.ok)return je(s);const a=await n.json();let o;return a.valid?a.plan==="pro"||a.plan==="enterprise"?o="valid-pro":o="valid-free":o="invalid",pr(s,o),o}catch{return je(s)}}const ue=u.createContext({plan:"free",isPro:!1});function hr(s){switch(s){case"valid-pro":case"skip":return"pro";case"valid-free":case"no-key":return"free";case"invalid":return"invalid"}}function br({licenseKey:s,validateUrl:t="",children:r}){const[n,a]=u.useState(()=>t?s?"validating":"free":"pro");return u.useEffect(()=>{if(!t){a("pro");return}let o=!1;return gr(s??null,t).then(i=>{o||a(hr(i))}),()=>{o=!0}},[s,t]),e.jsx(ue.Provider,{value:{plan:n,isPro:n==="pro"},children:r})}const zt=u.createContext(null);function It(){const s=u.useContext(zt);if(!s)throw new Error("Tabs compound components must be used within <Tabs>");return s}function vr({value:s,defaultValue:t,onValueChange:r,className:n,...a}){const[o,i]=u.useState(t??""),l=s??o,c=u.useCallback(x=>{s===void 0&&i(x),r==null||r(x)},[s,r]);return e.jsx(zt.Provider,{value:{selectedValue:l,onSelect:c},children:e.jsx("div",{"data-slot":"tabs",className:n,...a})})}function jr({className:s,children:t,...r}){const n=u.useRef(null),a=o=>{if(o.key!=="ArrowLeft"&&o.key!=="ArrowRight")return;const i=n.current;if(!i)return;const l=Array.from(i.querySelectorAll('[role="tab"]:not([disabled])')),c=l.indexOf(document.activeElement);if(c===-1)return;o.preventDefault();const x=o.key==="ArrowRight"?(c+1)%l.length:(c-1+l.length)%l.length;l[x].focus()};return e.jsx("div",{ref:n,role:"tablist","data-slot":"tabs-list",className:g("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",s),onKeyDown:a,...r,children:t})}function yr({value:s,className:t,...r}){const{selectedValue:n,onSelect:a}=It(),o=n===s;return e.jsx("button",{role:"tab",type:"button","data-slot":"tabs-trigger","aria-selected":o,...o?{"data-selected":""}:{},className:g("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium transition-all cursor-pointer disabled:pointer-events-none disabled:opacity-50 data-selected:bg-background data-selected:text-foreground data-selected:shadow-sm",t),onClick:()=>a(s),...r})}function Nr({value:s,className:t,...r}){const{selectedValue:n}=It();return n!==s?null:e.jsx("div",{role:"tabpanel","data-slot":"tabs-content",className:g("pt-2",t),...r})}function Lt(){return u.useContext(ue)}function Et({children:s,feature:t}){return e.jsxs("div",{style:{position:"relative"},children:[s,e.jsxs("a",{href:"https://hydralms.com/pro",target:"_blank",rel:"noopener noreferrer",style:{position:"absolute",bottom:14,right:16,zIndex:9999,display:"flex",alignItems:"center",gap:5,padding:"4px 10px 4px 8px",background:"rgba(0,0,0,0.5)",backdropFilter:"blur(6px)",borderRadius:20,fontFamily:"system-ui, -apple-system, sans-serif",fontSize:11,fontWeight:500,color:"rgba(255,255,255,0.85)",letterSpacing:"0.01em",whiteSpace:"nowrap",lineHeight:1,pointerEvents:"auto",textDecoration:"none"},title:t?`"${t}" is a HydraLMS Pro module`:"Upgrade to HydraLMS Pro",children:[e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",style:{opacity:.8},children:e.jsx("path",{d:"M12 2.69l5.66 5.66a8 8 0 1 1-11.31 0z"})}),"HydraLMS Pro"]})]})}function wr(s,t){const r=n=>{const{isPro:a}=Lt();return a?e.jsx(s,{...n}):e.jsx(Et,{feature:t,children:e.jsx(s,{...n})})};return r.displayName=`ProGated(${t})`,r}exports.AchievementBadge=ir;exports.ActivityTimeline=dr;exports.Alert=I;exports.AlertDescription=L;exports.AlertDialog=yt;exports.AlertDialogAction=_t;exports.AlertDialogBackdrop=wt;exports.AlertDialogCancel=Mt;exports.AlertDialogContent=Ct;exports.AlertDialogDescription=Dt;exports.AlertDialogFooter=St;exports.AlertDialogHeader=kt;exports.AlertDialogPortal=Nt;exports.AlertDialogTitle=Tt;exports.AlertDialogTrigger=Is;exports.AlertTitle=Ft;exports.AssessmentToolbar=Jt;exports.AttachmentList=pt;exports.AudioPlayer=ut;exports.Badge=Y;exports.Button=z;exports.Card=J;exports.CardAction=Ns;exports.CardContent=oe;exports.CardDescription=ys;exports.CardFooter=ws;exports.CardHeader=vs;exports.CardTitle=js;exports.Choice=we;exports.CodeBlock=ft;exports.ConfirmDialog=Ls;exports.ContentBlock=gt;exports.CourseCard=Ds;exports.CurriculumItemRow=bt;exports.CurriculumTree=bs;exports.Drawer=Je;exports.DrawerBackdrop=et;exports.DrawerBody=rt;exports.DrawerClose=at;exports.DrawerContent=tt;exports.DrawerDescription=as;exports.DrawerFooter=ns;exports.DrawerHeader=st;exports.DrawerNav=os;exports.DrawerNavItem=is;exports.DrawerPortal=qe;exports.DrawerTitle=nt;exports.DrawerTrigger=rs;exports.DrawerViewport=ls;exports.DueDateDisplay=Vs;exports.EmbedBlock=xt;exports.EmptyState=_s;exports.Essay=Te;exports.FeedbackBanner=Gs;exports.FileUploadZone=ps;exports.FillInTheBlank=ke;exports.Flashcard=lt;exports.FlashcardDeck=dt;exports.GradeIndicator=sr;exports.Hotspot=Ie;exports.HydraLicenseContext=ue;exports.HydraLicenseProvider=br;exports.InlineChoice=Le;exports.Input=Z;exports.LearningObjectIcon=ht;exports.LikertScale=Ws;exports.Matching=ze;exports.MultipleChoice=Ne;exports.Numeric=De;exports.Ordering=Me;exports.Pagination=Ks;exports.PostCard=fr;exports.ProBadge=Et;exports.Progress=ds;exports.ProgressRing=le;exports.QuestionHeaderBar=qt;exports.QuestionMaterialsDrawer=gs;exports.QuestionNavigator=Fe;exports.QuestionRenderer=ne;exports.RichTextEditor=Se;exports.Scenario=Ee;exports.SearchInput=Es;exports.Separator=A;exports.Skeleton=mt;exports.Spreadsheet=He;exports.StarRating=Zs;exports.StatCard=ar;exports.StatusBadge=As;exports.Stepper=Os;exports.StreakBadge=lr;exports.Table=te;exports.TableBody=re;exports.TableCaption=$e;exports.TableCell=U;exports.TableFooter=Re;exports.TableHead=W;exports.TableHeader=se;exports.TableRow=F;exports.Tabs=vr;exports.TabsContent=Nr;exports.TabsList=jr;exports.TabsTrigger=yr;exports.TimerDisplay=Ue;exports.Tooltip=Ke;exports.TooltipContent=We;exports.TooltipTrigger=Ge;exports.TrueFalse=Ce;exports.UserAvatar=ie;exports.VideoPlayer=ot;exports.alertVariants=ye;exports.badgeVariants=vt;exports.buttonVariants=Q;exports.cn=g;exports.drawerContentVariants=Xe;exports.formatDuration=Be;exports.formatFileSize=ae;exports.formatTimer=V;exports.formatTimestamp=ce;exports.progressVariants=it;exports.scoreAssessment=Gt;exports.scoreQuestion=X;exports.scoreScenarioSubQuestions=Ae;exports.shuffle=ct;exports.useDragReorder=_e;exports.useHydraLicense=Lt;exports.withProGate=wr;
|