@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.
Files changed (47) hide show
  1. package/dist/StudentProfile-BPsZBaJj.cjs +1 -0
  2. package/dist/{StudentProfile-DeMxdrL3.js → StudentProfile-Cw2p-RZn.js} +577 -579
  3. package/dist/index.cjs +1 -1
  4. package/dist/index.js +172 -166
  5. package/dist/license/index.d.ts +2 -2
  6. package/dist/license/tiers.d.ts +3 -0
  7. package/dist/modules.cjs +1 -1
  8. package/dist/modules.js +111 -110
  9. package/dist/sections/AdaptiveLearningPath/AdaptiveLearningPath.d.ts +5 -0
  10. package/dist/sections/AdaptiveLearningPath/path-connector.d.ts +8 -0
  11. package/dist/sections/AdaptiveLearningPath/path-milestone-marker.d.ts +7 -0
  12. package/dist/sections/AdaptiveLearningPath/path-node-card.d.ts +10 -0
  13. package/dist/sections/AdaptiveLearningPath/path-skill-bar.d.ts +8 -0
  14. package/dist/sections/AdaptiveLearningPath/types.d.ts +136 -0
  15. package/dist/sections/ContentAuthoringStudio/ContentAuthoringStudio.d.ts +5 -0
  16. package/dist/sections/ContentAuthoringStudio/block-editor-item.d.ts +14 -0
  17. package/dist/sections/ContentAuthoringStudio/block-type-picker.d.ts +12 -0
  18. package/dist/sections/ContentAuthoringStudio/types.d.ts +67 -0
  19. package/dist/sections/index.d.ts +4 -0
  20. package/dist/sections.cjs +1 -1
  21. package/dist/sections.js +1325 -232
  22. package/dist/withProGate-BJdu1T9Y.cjs +2 -0
  23. package/dist/withProGate-BvFc7Jwy.js +4975 -0
  24. package/package.json +24 -7
  25. package/src/license/index.ts +2 -2
  26. package/src/license/tiers.ts +12 -2
  27. package/src/modules/CoursePlayer/CoursePlayer.tsx +3 -1
  28. package/src/progress/stat-card.tsx +10 -5
  29. package/src/sections/AdaptiveLearningPath/AdaptiveLearningPath.tsx +251 -0
  30. package/src/sections/AdaptiveLearningPath/path-connector.tsx +27 -0
  31. package/src/sections/AdaptiveLearningPath/path-milestone-marker.tsx +50 -0
  32. package/src/sections/AdaptiveLearningPath/path-node-card.tsx +166 -0
  33. package/src/sections/AdaptiveLearningPath/path-skill-bar.tsx +49 -0
  34. package/src/sections/AdaptiveLearningPath/types.ts +159 -0
  35. package/src/sections/ContentAuthoringStudio/ContentAuthoringStudio.tsx +289 -0
  36. package/src/sections/ContentAuthoringStudio/block-editor-item.tsx +487 -0
  37. package/src/sections/ContentAuthoringStudio/block-type-picker.tsx +123 -0
  38. package/src/sections/ContentAuthoringStudio/types.ts +67 -0
  39. package/src/sections/ForumBoard/ForumBoard.tsx +8 -6
  40. package/src/sections/LessonPage/LessonPage.tsx +4 -7
  41. package/src/sections/index.ts +18 -0
  42. package/src/video/video-player.tsx +14 -5
  43. package/dist/StudentProfile-BVfZMbnV.cjs +0 -1
  44. package/dist/tabs-BsfVo2Bl.cjs +0 -173
  45. package/dist/tabs-BuY1iNJE.js +0 -22305
  46. package/dist/withProGate-BWqcKdPM.js +0 -137
  47. package/dist/withProGate-DX6XqKLp.cjs +0 -1
@@ -0,0 +1 @@
1
+ "use strict";const e=require("react/jsx-runtime"),c=require("react"),C=require("lucide-react"),s=require("./withProGate-BJdu1T9Y.cjs"),ae=require("class-variance-authority");function re(t,n,r,d){const j=r.map(a=>({uid:n,answerUid:a.uid,content:a.content})),m=[...t.filter(a=>a.uid!==n),...j];return d==null||d(m),m}function ie({questions:t,initialAnswers:n=[],onAnswerChange:r,questionMaterials:d}){const[j,i]=c.useState(0),[m,a]=c.useState(n),[N,v]=c.useState(new Set),[h,b]=c.useState(!1),g=c.useRef(null),k=c.useRef(!0),y=c.useRef(t);y.current=t;const o=c.useRef(j);o.current=j;const S=c.useRef(r);S.current=r;const z=t[j];c.useEffect(()=>{var l;if(k.current){k.current=!1;return}(l=g.current)==null||l.focus()},[j]);const u=c.useMemo(()=>z?m.filter(l=>l.uid===z.uid):[],[m,z]),L=c.useMemo(()=>(d==null?void 0:d.filter(l=>l.questionUid===(z==null?void 0:z.uid)))??[],[d,z]),p=c.useMemo(()=>t.map((l,f)=>({uid:l.uid,sequence:f,isFlagged:N.has(l.uid),isAnswered:m.some(B=>B.uid===l.uid),isSkipped:!1})),[t,m,N]),A=c.useCallback(l=>{const f=y.current[o.current];f&&a(B=>re(B,f.uid,l,S.current))},[]),x=c.useCallback(l=>{const f=t.findIndex(B=>B.uid===l);f!==-1&&i(f)},[t]),w=c.useCallback(l=>{v(f=>{const B=new Set(f);return B.has(l)?B.delete(l):B.add(l),B})},[]),T=c.useCallback(()=>{i(l=>Math.min(l+1,y.current.length-1))},[]),R=c.useCallback(()=>{i(l=>Math.max(l-1,0))},[]);return{currentIndex:j,currentQuestion:z,sessionAnswers:m,flaggedUids:N,materialsOpen:h,setMaterialsOpen:b,questionAreaRef:g,currentQuestionAnswers:u,currentMaterials:L,navigatorItems:p,handleAnswer:A,handleNavigate:x,handleToggleFlag:w,goNext:T,goPrevious:R,hasNext:j<t.length-1,hasPrevious:j>0}}function H({isLoading:t,error:n,onRetry:r,skeleton:d,loadingClassName:j="space-y-4",className:i,style:m,children:a}){return t?e.jsx("div",{className:s.cn(j,i),style:m,children:d}):n?e.jsx("div",{className:s.cn("py-12",i),style:m,children:e.jsx(s.EmptyState,{icon:e.jsx(C.AlertCircle,{className:"size-10 text-destructive"}),title:"Something went wrong",description:n,action:r?e.jsx(s.Button,{variant:"outline",onClick:r,children:"Retry"}):void 0})}):e.jsx(e.Fragment,{children:a})}function Ne({questions:t,initialAnswers:n=[],onSubmit:r,onAnswerChange:d,timeElapsedSeconds:j,timeLimitSeconds:i,questionMaterials:m,isSubmitting:a=!1,readOnly:N=!1,isLoading:v,error:h,onRetry:b,className:g,style:k}){const{currentIndex:y,currentQuestion:o,sessionAnswers:S,flaggedUids:z,materialsOpen:u,setMaterialsOpen:L,questionAreaRef:p,currentQuestionAnswers:A,currentMaterials:x,navigatorItems:w,handleAnswer:T,handleNavigate:R,handleToggleFlag:l,goNext:f,goPrevious:B,hasNext:M,hasPrevious:_}=ie({questions:t,initialAnswers:n,onAnswerChange:d,questionMaterials:m}),E=c.useRef(S);E.current=S;const P=c.useRef(r);P.current=r;const Q=c.useCallback(()=>{P.current(E.current)},[]),U=c.useRef(o==null?void 0:o.uid);U.current=o==null?void 0:o.uid;const F=c.useCallback(()=>{const I=U.current;I&&l(I)},[l]),D=c.useCallback(()=>L(!0),[L]);return e.jsx(H,{isLoading:v,error:h,onRetry:b,className:g,style:k,skeleton:e.jsxs(e.Fragment,{children:[e.jsx(s.Skeleton,{className:"h-10 w-full"}),e.jsx(s.Skeleton,{className:"h-48 w-full"}),e.jsx(s.Skeleton,{className:"h-12 w-full"})]}),children:e.jsxs("div",{children:[e.jsx(s.AssessmentToolbar,{currentQuestionIndex:y,totalQuestions:t.length,hasNext:M,hasPrevious:_,onNext:f,onPrevious:B,onSubmit:Q,timeElapsedSeconds:j,timeLimitSeconds:i,questions:w,onNavigateToQuestion:R,currentQuestionUid:o==null?void 0:o.uid,isSubmitting:a,readOnly:N}),e.jsxs("span",{className:"sr-only","aria-live":"polite",children:["Question ",y+1," of ",t.length]}),o&&e.jsxs(s.Card,{className:"mt-3",ref:p,tabIndex:-1,children:[e.jsx(s.CardHeader,{className:"pb-0",children:e.jsx(s.QuestionHeaderBar,{questionNumber:y+1,totalQuestions:t.length,isFlagged:z.has(o.uid),onToggleFlag:F,hasMaterials:x.length>0,onOpenMaterials:D,readOnly:N})}),e.jsx(s.CardContent,{children:e.jsx(s.QuestionRenderer,{question:o,sessionAnswers:A,onAnswer:T,readOnly:N})})]}),!N&&e.jsxs("div",{className:"flex items-center justify-between gap-3 mt-3",children:[e.jsxs(s.Button,{variant:"outline",disabled:!_,onClick:B,children:[e.jsx(C.ChevronLeft,{className:"size-4 mr-1"}),"Previous"]}),M?e.jsxs(s.Button,{onClick:f,children:["Next",e.jsx(C.ChevronRight,{className:"size-4 ml-1"})]}):e.jsxs(s.Button,{onClick:Q,disabled:a,children:[a?"Submitting...":"Submit Quiz",!a&&e.jsx(C.Send,{className:"size-4 ml-1"})]})]}),e.jsx(s.QuestionMaterialsDrawer,{open:u,onOpenChange:L,materials:x,questionNumber:y+1})]})})}function ve({video:t,notes:n,layout:r="horizontal",notesPanelWidth:d="340px",notesPanelHeight:j="240px",isLoading:i,error:m,onRetry:a,onComplete:N,className:v,style:h}){const b=r==="horizontal",g=c.useCallback(()=>{var k;(k=t.onEnded)==null||k.call(t),N==null||N()},[t,N]);return e.jsx(H,{isLoading:i,error:m,onRetry:a,className:v,style:h,skeleton:e.jsxs(e.Fragment,{children:[e.jsx(s.Skeleton,{className:"aspect-video w-full rounded-lg"}),n!==void 0&&e.jsx(s.Skeleton,{className:"h-32 w-full rounded-lg"})]}),children:n?e.jsxs("div",{className:s.cn("flex overflow-hidden gap-4",b?"flex-row":"flex-col",v),style:h,children:[e.jsx("div",{className:"flex-1 min-w-0 min-h-0",children:e.jsx(s.VideoPlayer,{...t,onEnded:g})}),e.jsxs(s.Card,{className:s.cn("overflow-auto shrink-0 rounded-none border-0",b?"border-l border-border":"border-t border-border w-full"),style:{width:b?d:void 0,height:b?void 0:j},children:[e.jsx(s.CardHeader,{children:e.jsx(s.CardTitle,{children:"Notes"})}),e.jsx(s.CardContent,{children:typeof n=="string"?e.jsx("span",{className:"text-sm text-foreground",children:n}):n})]})]}):e.jsx("div",{className:v,style:h,children:e.jsx(s.VideoPlayer,{...t,onEnded:g})})})}function be({cards:t,title:n,description:r,shuffled:d=!1,onComplete:j,readOnly:i=!1,isLoading:m,error:a,onRetry:N,className:v,style:h}){const[b,g]=c.useState(!1),k={totalCards:t.length,wasShuffled:d};function y(){g(!0),j==null||j(k)}function o(){g(!1)}return e.jsx(H,{isLoading:m,error:a,onRetry:N,className:v,style:h,skeleton:e.jsxs(e.Fragment,{children:[e.jsx(s.Skeleton,{className:"h-6 w-48"}),e.jsx(s.Skeleton,{className:"h-64 w-full rounded-lg"})]}),children:b?e.jsx("div",{className:s.cn("flex flex-col items-center",v),style:h,children:e.jsx(s.Card,{children:e.jsxs(s.CardContent,{className:"pt-6 text-center flex flex-col items-center gap-2",children:[e.jsx(C.CheckCircle,{size:48,className:"text-success"}),e.jsx("span",{className:"text-xl font-bold text-foreground",children:"Deck complete!"}),n&&e.jsxs("span",{className:"text-muted-foreground",children:["You finished ",e.jsx("strong",{children:n})]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[k.totalCards," card",k.totalCards!==1?"s":""," studied",k.wasShuffled?" (shuffled)":""]}),e.jsx(s.Button,{className:"mt-2",onClick:o,children:"Study Again"})]})})}):e.jsx("div",{className:s.cn("flex flex-col items-center",v),style:h,children:e.jsx(s.FlashcardDeck,{cards:t,deckName:n,deckDescription:r,shuffled:d,showProgress:!0,onComplete:y,readOnly:i})})})}function we({score:t}){const n=t.percentage!==void 0?t.percentage:t.total>0?Math.round(t.correct/t.total*100):0;return e.jsx(s.Card,{className:"mb-3",children:e.jsx(s.CardContent,{className:"pt-6",children:e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsxs("span",{className:"text-2xl font-bold leading-none text-foreground",children:[n,"%"]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[t.correct," of ",t.total," correct"]})]}),t.passed!==void 0&&e.jsx(s.Badge,{variant:t.passed?"success":"destructive",children:t.passed?"Passed":"Failed"}),t.passingScore!==void 0&&e.jsxs("span",{className:"text-sm text-muted-foreground",children:["Passing score: ",t.passingScore,"%"]})]})})})}function X({questions:t,sessionAnswers:n,showCorrectAnswers:r}){const d=c.useMemo(()=>{const j=new Map;for(const i of n){const m=j.get(i.uid);m?m.push(i):j.set(i.uid,[i])}return j},[n]);return e.jsx("div",{className:"flex flex-col gap-3",children:t.map((j,i)=>e.jsxs(s.Card,{className:"overflow-hidden",children:[e.jsx("div",{className:"px-2 py-1 bg-muted",children:e.jsxs("span",{className:"text-xs text-muted-foreground font-semibold",children:["Question ",i+1]})}),e.jsx(s.Separator,{}),e.jsx(s.CardContent,{className:"pt-4 pb-4",children:e.jsx(s.QuestionRenderer,{question:j,sessionAnswers:d.get(j.uid)??[],readOnly:!0,showCorrectAnswers:r})})]},j.uid))})}function Ce(t,n,r,d){const j=new Map(t.map(a=>[a.uid,a])),i=new Set(r.flatMap(a=>a.questionUids)),m=t.filter(a=>!i.has(a.uid));return e.jsxs("div",{className:"flex flex-col gap-4",children:[r.map(a=>{const N=a.questionUids.map(v=>j.get(v)).filter(Boolean);return e.jsxs("div",{children:[e.jsx("span",{className:"uppercase text-xs tracking-wide text-muted-foreground font-semibold",children:a.label}),e.jsx(s.Separator,{className:"mb-2"}),e.jsx(X,{questions:N,sessionAnswers:n,showCorrectAnswers:d})]},a.label)}),m.length>0&&e.jsx("div",{children:e.jsx(X,{questions:m,sessionAnswers:n,showCorrectAnswers:d})})]})}function ke({questions:t,sessionAnswers:n,score:r,questionGroups:d,showCorrectAnswers:j=!0,isLoading:i,error:m,onRetry:a,className:N,style:v}){return i?e.jsxs("div",{className:s.cn("space-y-4",N),style:v,children:[e.jsx(s.Skeleton,{className:"h-16 w-full"}),e.jsx(s.Skeleton,{className:"h-24 w-full"}),e.jsx(s.Skeleton,{className:"h-24 w-full"}),e.jsx(s.Skeleton,{className:"h-24 w-full"})]}):m?e.jsx("div",{className:s.cn("py-12",N),style:v,children:e.jsx(s.EmptyState,{icon:e.jsx(C.AlertCircle,{className:"size-10 text-destructive"}),title:"Something went wrong",description:m,action:a?e.jsx(s.Button,{variant:"outline",onClick:a,children:"Retry"}):void 0})}):e.jsxs("div",{className:s.cn(N),style:v,children:[r&&e.jsx(we,{score:r}),d&&d.length>0?Ce(t,n,d,j):e.jsx(X,{questions:t,sessionAnswers:n,showCorrectAnswers:j})]})}function J(t){const n=[];for(const r of t)!r.children||r.children.length===0?n.push(r.uid):n.push(...J(r.children));return n}function Se({items:t,progress:n,courseTitle:r,activeItemUid:d,onItemClick:j,showOverallProgress:i=!0,showDuration:m=!0,showIcons:a=!0,readOnly:N=!1,isLoading:v,error:h,onRetry:b,className:g,style:k}){const{completedCount:y,totalCount:o,percentage:S}=c.useMemo(()=>{const z=J(t),u=z.length,L=n?z.filter(p=>n.some(A=>A.resourceUid===p&&A.isCompleted)).length:0;return{completedCount:L,totalCount:u,percentage:u>0?Math.round(L/u*100):0}},[t,n]);return v?e.jsxs("div",{className:s.cn("space-y-4",g),style:k,children:[e.jsx(s.Skeleton,{className:"h-6 w-48"}),e.jsx(s.Skeleton,{className:"h-2 w-full"}),e.jsx(s.Skeleton,{className:"h-8 w-full"}),e.jsx(s.Skeleton,{className:"h-8 w-full ml-6"}),e.jsx(s.Skeleton,{className:"h-8 w-full ml-6"}),e.jsx(s.Skeleton,{className:"h-8 w-full"}),e.jsx(s.Skeleton,{className:"h-8 w-full ml-6"}),e.jsx(s.Skeleton,{className:"h-8 w-full"})]}):h?e.jsx("div",{className:s.cn("py-12",g),style:k,children:e.jsx(s.EmptyState,{icon:e.jsx(C.AlertCircle,{className:"size-10 text-destructive"}),title:"Something went wrong",description:h,action:b?e.jsx(s.Button,{variant:"outline",onClick:b,children:"Retry"}):void 0})}):e.jsxs("div",{className:s.cn(g),style:k,children:[(r||i)&&e.jsxs("div",{className:"px-2 pt-2 pb-2",children:[r&&e.jsx("p",{className:s.cn("font-semibold text-sm text-foreground",i&&"mb-1"),children:r}),i&&e.jsxs("div",{children:[e.jsx(s.Progress,{value:S,size:"sm"}),e.jsxs("span",{className:"text-xs text-muted-foreground mt-0.5 block",children:[y," of ",o," completed"]})]})]}),(r||i)&&e.jsx(s.Separator,{}),e.jsx(s.CurriculumTree,{items:t,progress:n,activeItemUid:d,onItemClick:j,readOnly:N,showDuration:m,showIcons:a,showProgress:!0})]})}function ye({questions:t,instantFeedback:n=!0,allowRetry:r=!0,onComplete:d,shuffled:j=!1,readOnly:i=!1,isLoading:m,error:a,onRetry:N,className:v,style:h}){const b=c.useMemo(()=>{const U=t??[];return j?s.shuffle(U):U},[t,j]),[g,k]=c.useState(0),[y,o]=c.useState(new Set),[S,z]=c.useState(new Map),[u,L]=c.useState(new Set),[p,A]=c.useState(null),[x,w]=c.useState(!1),T=c.useRef(null),R=c.useRef(!0);c.useEffect(()=>{var U;if(R.current){R.current=!1;return}(U=T.current)==null||U.focus()},[g]);const l=b[g],f=l?y.has(l.uid):!1;function B(){if(!l||!p)return;const U=(S.get(l.uid)??0)+1;z(I=>new Map(I).set(l.uid,U)),o(I=>new Set(I).add(l.uid));const F=p.map(I=>({uid:l.uid,answerUid:I.uid,content:I.content}));s.scoreQuestion(l,F)===!0&&U===1&&L(I=>new Set(I).add(l.uid))}function M(){l&&(o(U=>{const F=new Set(U);return F.delete(l.uid),F}),A(null))}function _(){if(g<b.length-1)k(U=>U+1),A(null);else{const U={totalQuestions:b.length,correctOnFirstAttempt:u.size,totalAttempts:Array.from(S.values()).reduce((F,D)=>F+D,0)};w(!0),d==null||d(U)}}const E=c.useMemo(()=>!l||!p?[]:p.map(U=>({uid:l.uid,answerUid:U.uid,content:U.content})),[l,p]),P=c.useMemo(()=>l?s.scoreQuestion(l,E)===!0:!1,[l,E]),Q=b.length>0?Math.round(u.size/b.length*100):0;return e.jsx(H,{isLoading:m,error:a,onRetry:N,className:v,style:h,skeleton:e.jsxs(e.Fragment,{children:[e.jsx(s.Skeleton,{className:"h-2 w-full"}),e.jsx(s.Skeleton,{className:"h-48 w-full"})]}),children:x?e.jsx(s.Card,{className:v,style:h,children:e.jsxs(s.CardContent,{className:"pt-6 text-center",children:[e.jsx(C.CheckCircle,{size:48,className:"text-success mx-auto mb-4"}),e.jsx("p",{className:"text-xl font-bold mb-1 text-foreground",children:"Practice Complete!"}),e.jsxs("p",{className:"text-muted-foreground mb-2",children:[u.size," of ",b.length," correct on first attempt (",Q,"%)"]}),e.jsx("div",{className:"flex justify-center",children:e.jsx(s.Button,{variant:"outline",onClick:()=>{k(0),o(new Set),z(new Map),L(new Set),A(null),w(!1)},children:"Practice Again"})})]})}):e.jsxs("div",{className:v,style:h,children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsxs("span",{className:"font-semibold text-sm text-foreground",children:["Question ",g+1," of ",b.length]}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[u.size," correct on first try"]})]}),e.jsx(s.Progress,{value:g+(f?1:0),max:b.length,size:"sm",className:"mb-3"}),e.jsxs("span",{className:"sr-only","aria-live":"polite",children:["Question ",g+1," of ",b.length]}),l&&e.jsx(s.Card,{ref:T,tabIndex:-1,children:e.jsxs(s.CardContent,{className:"pt-6",children:[e.jsx(s.QuestionRenderer,{question:l,sessionAnswers:E,onAnswer:A,readOnly:i||f,showCorrectAnswers:f}),n&&f&&e.jsx(s.FeedbackBanner,{isCorrect:P,explanation:l.explanation,onRetry:r&&!P?M:void 0}),e.jsxs("div",{className:"flex justify-end gap-2 mt-2",children:[!f&&n&&e.jsx(s.Button,{onClick:B,disabled:!p||p.length===0||i,children:"Check Answer"}),(!n||f)&&e.jsx(s.Button,{onClick:_,disabled:i,children:g<b.length-1?"Next Question":"Finish"})]})]})})]})})}function Ae({questions:t=[],initialAnswers:n=[],onSubmit:r,onAnswerChange:d,timeLimitSeconds:j,timeElapsedSeconds:i,autoSubmitOnTimeout:m=!0,timeWarningThreshold:a=300,allowBackNavigation:N=!0,confirmBeforeSubmit:v=!0,examTitle:h,instructions:b,questionMaterials:g,isSubmitting:k=!1,readOnly:y=!1,isLoading:o,error:S,onRetry:z,className:u,style:L}){const{currentIndex:p,currentQuestion:A,sessionAnswers:x,flaggedUids:w,materialsOpen:T,setMaterialsOpen:R,questionAreaRef:l,currentQuestionAnswers:f,currentMaterials:B,navigatorItems:M,handleAnswer:_,handleNavigate:E,handleToggleFlag:P,goNext:Q,goPrevious:U,hasNext:F}=ie({questions:t,initialAnswers:n,onAnswerChange:d,questionMaterials:g}),[D,I]=c.useState(!1),[ce,de]=c.useState(!1),K=c.useRef(!1),q=c.useRef(x);q.current=x;const ee=c.useRef(r);ee.current=r;const se=c.useRef(i);se.current=i;const te=c.useRef(A==null?void 0:A.uid);te.current=A==null?void 0:A.uid;const V=j-i,oe=c.useMemo(()=>M.filter(G=>G.isAnswered).length,[M]),$=c.useCallback(G=>{const ne=q.current,pe=new Set(ne.map(Z=>Z.uid)),ge={timeElapsedSeconds:se.current,wasAutoSubmitted:G,answeredCount:t.filter(Z=>pe.has(Z.uid)).length,totalQuestions:t.length};ee.current(ne,ge)},[t]);c.useEffect(()=>{V<=a&&V>0&&de(!0)},[V,a]),c.useEffect(()=>{m&&V<=0&&!K.current&&(K.current=!0,$(!0))},[V,m,$]);const xe=c.useCallback(()=>{v?I(!0):$(!1)},[v,$]),me=c.useCallback(()=>{N&&U()},[N,U]),ue=c.useCallback(()=>{const G=te.current;G&&P(G)},[P]),he=c.useCallback(()=>R(!0),[R]),je=c.useCallback(()=>{I(!1),$(!1)},[$]),fe=c.useCallback(()=>I(!1),[]);return e.jsx(H,{isLoading:o,error:S,onRetry:z,className:u,style:L,skeleton:e.jsxs(e.Fragment,{children:[e.jsx(s.Skeleton,{className:"h-10 w-full"}),e.jsx(s.Skeleton,{className:"h-48 w-full"}),e.jsx(s.Skeleton,{className:"h-12 w-full"})]}),children:e.jsxs("div",{children:[h&&e.jsx("p",{className:"text-xl font-bold mb-2 text-foreground",children:h}),ce&&V>0&&V<=a&&e.jsx(s.Alert,{variant:"warning",className:"mb-2",children:e.jsxs(s.AlertDescription,{children:[Math.ceil(V/60)," minute",Math.ceil(V/60)!==1?"s":""," remaining"]})}),e.jsx(s.AssessmentToolbar,{currentQuestionIndex:p,totalQuestions:t.length,hasNext:F,hasPrevious:N&&p>0,onNext:Q,onPrevious:me,onSubmit:xe,timeElapsedSeconds:i,timeLimitSeconds:j,questions:M,onNavigateToQuestion:E,currentQuestionUid:A==null?void 0:A.uid,isSubmitting:k,readOnly:y}),b&&p===0&&e.jsx(s.Card,{className:"mt-3",children:e.jsx(s.CardContent,{className:"pt-6",children:b})}),e.jsxs("span",{className:"sr-only","aria-live":"polite",children:["Question ",p+1," of ",t.length]}),A&&e.jsxs(s.Card,{className:"mt-3",ref:l,tabIndex:-1,children:[e.jsx(s.CardHeader,{className:"pb-0",children:e.jsx(s.QuestionHeaderBar,{questionNumber:p+1,totalQuestions:t.length,isFlagged:w.has(A.uid),onToggleFlag:ue,hasMaterials:B.length>0,onOpenMaterials:he,readOnly:y})}),e.jsx(s.CardContent,{children:e.jsx(s.QuestionRenderer,{question:A,sessionAnswers:f,onAnswer:_,readOnly:y})})]}),e.jsx(s.QuestionMaterialsDrawer,{open:T,onOpenChange:R,materials:B,questionNumber:p+1}),e.jsx(s.ConfirmDialog,{open:D,title:"Submit Exam?",message:`You have answered ${oe} of ${t.length} questions. Once submitted, you cannot change your answers.`,confirmLabel:"Submit Exam",cancelLabel:"Continue Exam",confirmColor:"primary",onConfirm:je,onCancel:fe,isLoading:k})]})})}function Te({title:t,description:n,questions:r=[],initialAnswers:d=[],onSubmit:j,onAnswerChange:i,showProgress:m=!0,requireAll:a=!1,submitLabel:N="Submit Survey",isSubmitting:v=!1,readOnly:h=!1,isLoading:b,error:g,onRetry:k,className:y,style:o}){const[S,z]=c.useState(d),u=c.useMemo(()=>{const x=new Set(S.map(w=>w.questionUid));return r.filter(w=>x.has(w.uid)).length},[r,S]),L=!a||u===r.length;function p(x,w){z(T=>{const l=[...T.filter(f=>f.questionUid!==x),{questionUid:x,value:w}];return i==null||i(l),l})}const A=c.useMemo(()=>{const x=new Map;for(const w of S)x.set(w.questionUid,w);return x},[S]);return e.jsx(H,{isLoading:b,error:g,onRetry:k,className:y,style:o,skeleton:e.jsxs(e.Fragment,{children:[e.jsx(s.Skeleton,{className:"h-6 w-48"}),e.jsx(s.Skeleton,{className:"h-2 w-full"}),e.jsx(s.Skeleton,{className:"h-16 w-full"}),e.jsx(s.Skeleton,{className:"h-16 w-full"}),e.jsx(s.Skeleton,{className:"h-16 w-full"})]}),children:e.jsxs("div",{className:y,style:o,children:[e.jsx("p",{className:"text-xl font-bold text-foreground mb-2",children:t}),n&&e.jsx("div",{className:"mb-2 text-muted-foreground text-sm",children:typeof n=="string"?e.jsx("span",{children:n}):n}),m&&e.jsxs("div",{className:"mb-3",children:[e.jsx(s.Progress,{value:u/r.length*100}),e.jsxs("span",{className:"block text-xs text-muted-foreground mt-0.5",children:[u," of ",r.length," answered"]})]}),r.map((x,w)=>{var R,l;const T=A.get(x.uid);return e.jsx(s.Card,{className:"mb-2",children:e.jsxs(s.CardContent,{className:"pt-6",children:[e.jsxs("p",{className:"font-medium text-foreground mb-2",children:[w+1,". ",x.content,x.required&&e.jsx("span",{className:"text-destructive ml-0.5",children:"*"})]}),x.type==="likert"&&e.jsx(s.LikertScale,{value:T?Number(T.value):null,onChange:f=>p(x.uid,f),points:x.scalePoints,lowLabel:(R=x.scaleLabels)==null?void 0:R.low,highLabel:(l=x.scaleLabels)==null?void 0:l.high,readOnly:h}),x.type==="rating"&&e.jsx(s.StarRating,{value:T?Number(T.value):0,onChange:f=>p(x.uid,f),readOnly:h}),x.type==="open_text"&&e.jsx(s.RichTextEditor,{placeholder:"Type your response...",value:(T==null?void 0:T.value)??"",onChange:f=>p(x.uid,f),readOnly:h,className:"min-h-24",variant:"minimal"}),x.type==="choice"&&x.answers&&e.jsx("div",{className:"flex flex-col gap-2",children:x.answers.map(f=>e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer py-1 text-sm text-foreground has-[input:disabled]:cursor-default has-[input:disabled]:opacity-60",children:[e.jsx("input",{type:"radio",className:"accent-primary m-0 shrink-0",name:`survey-q-${x.uid}`,value:f.uid,checked:(T==null?void 0:T.value)===f.uid,onChange:()=>p(x.uid,f.uid),disabled:h}),e.jsx("span",{children:f.content})]},f.uid))}),x.type==="multiple_choice"&&x.answers&&e.jsx("div",{className:"flex flex-col gap-2",children:x.answers.map(f=>{const B=S.filter(M=>M.questionUid===x.uid).map(M=>String(M.value));return e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer py-1 text-sm text-foreground has-[input:disabled]:cursor-default has-[input:disabled]:opacity-60",children:[e.jsx("input",{type:"checkbox",className:"accent-primary m-0 shrink-0",checked:B.includes(f.uid),disabled:h,onChange:M=>{const _=S.filter(P=>P.questionUid===x.uid);let E;M.target.checked?E=[..._,{questionUid:x.uid,value:f.uid}]:E=_.filter(P=>String(P.value)!==f.uid),z(P=>[...P.filter(Q=>Q.questionUid!==x.uid),...E]),i==null||i([...S.filter(P=>P.questionUid!==x.uid),...E])}}),e.jsx("span",{children:f.content})]},f.uid)})})]})},x.uid)}),e.jsx(s.Separator,{className:"my-3"}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("span",{className:"text-sm text-muted-foreground",children:[u," of ",r.length," answered"]}),e.jsx(s.Button,{onClick:()=>j(S),disabled:!L||v||h,children:v?"Submitting...":N})]})]})})}function ze({title:t,blocks:n,isCompleted:r=!1,onMarkComplete:d,onNextLesson:j,nextLessonTitle:i,estimatedDuration:m,showDuration:a=!0,readOnly:N=!1,isLoading:v,error:h,onRetry:b,className:g,style:k}){const[y,o]=c.useState(!1),S=r||y;function z(){o(!0),d==null||d()}return e.jsx(H,{isLoading:v,error:h,onRetry:b,className:g,style:k,skeleton:e.jsxs(e.Fragment,{children:[e.jsx(s.Skeleton,{className:"h-8 w-64"}),e.jsx(s.Skeleton,{className:"h-24 w-full"}),e.jsx(s.Skeleton,{className:"h-16 w-full"}),e.jsx(s.Skeleton,{className:"h-32 w-full"})]}),children:e.jsxs("div",{children:[e.jsxs("div",{className:"mb-3",children:[e.jsx("p",{className:"text-2xl font-bold mb-0.5 text-foreground",children:t}),a&&m!=null&&e.jsxs("div",{className:"flex items-center gap-0.5 text-muted-foreground",children:[e.jsx(C.Clock,{size:16}),e.jsx("span",{className:"text-sm",children:s.formatDuration(m)})]})]}),e.jsx(s.Separator,{className:"mb-3"}),e.jsx("div",{className:"flex flex-col gap-3",children:n!=null&&n.length?n.map((u,L)=>e.jsx(s.ContentBlock,{block:u,readOnly:N},L)):e.jsx(s.EmptyState,{title:"No content yet",description:"This lesson doesn't have any content blocks."})}),e.jsx(s.Card,{className:"mt-4 sticky bottom-0 z-10",children:e.jsx(s.CardContent,{className:"px-4 py-3",children:e.jsxs("div",{className:"flex justify-between items-center",children:[S?e.jsxs("div",{className:"flex items-center gap-1 text-success",children:[e.jsx(C.Check,{size:20}),e.jsx("span",{className:"text-sm font-semibold",children:"Lesson Complete"})]}):e.jsxs(s.Button,{onClick:z,disabled:N,children:[e.jsx(C.Check,{size:18})," Mark Complete"]}),j&&e.jsxs(s.Button,{variant:S?"default":"outline",onClick:j,children:[i?`Next: ${i}`:"Next Lesson"," ",e.jsx(C.ChevronRight,{size:18})]})]})})})]})})}function Be({announcements:t,onMarkRead:n,onSelect:r,showAvatars:d=!0,previewLines:j=3,emptyMessage:i="No announcements yet",readOnly:m=!1,isLoading:a,error:N,onRetry:v,pageSize:h,currentPage:b=1,totalItems:g,onPageChange:k,className:y,style:o}){const[S,z]=c.useState(new Set),u=c.useMemo(()=>{const p=t.filter(x=>x.isPinned),A=t.filter(x=>!x.isPinned);return[...p,...A]},[t]);function L(p){z(x=>{const w=new Set(x);return w.has(p)?w.delete(p):w.add(p),w});const A=t.find(x=>x.uid===p);A&&!A.isRead&&(n==null||n(p))}return a?e.jsx("div",{className:s.cn("space-y-4",y),style:o,children:Array.from({length:3}).map((p,A)=>e.jsxs("div",{className:"flex gap-3 items-start",children:[e.jsx(s.Skeleton,{className:"h-10 w-10 rounded-full shrink-0"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx(s.Skeleton,{className:"h-5 w-48"}),e.jsx(s.Skeleton,{className:"h-4 w-full"}),e.jsx(s.Skeleton,{className:"h-4 w-full"})]})]},A))}):N?e.jsx("div",{className:s.cn("py-12",y),style:o,children:e.jsx(s.EmptyState,{icon:e.jsx(C.AlertCircle,{className:"size-10 text-destructive"}),title:"Something went wrong",description:N,action:v?e.jsx(s.Button,{variant:"outline",onClick:v,children:"Retry"}):void 0})}):u.length===0?e.jsx("div",{className:y,style:o,children:e.jsx(s.EmptyState,{title:i})}):e.jsxs("div",{className:s.cn("flex flex-col gap-2",y),style:o,children:[(k&&h?u.slice((b-1)*h,b*h):u).map(p=>{const A=S.has(p.uid);return e.jsx(s.Card,{className:s.cn(p.isRead&&"opacity-85",r&&"cursor-pointer",p.isPinned&&"border-l-4 border-l-warning"),onClick:()=>r&&!m?r(p):L(p.uid),children:e.jsx(s.CardContent,{className:"py-4",children:e.jsxs("div",{className:"flex gap-1.5 items-start",children:[d&&e.jsx(s.UserAvatar,{displayName:p.author.displayName,avatarUrl:p.author.avatarUrl,role:p.author.role,size:"medium"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1 mb-0.5",children:[p.isPinned&&e.jsx(C.Pin,{size:14}),e.jsx("span",{className:s.cn("text-foreground",p.isRead?"font-normal":"font-semibold"),children:p.title}),!p.isRead&&e.jsx(s.Badge,{variant:"destructive",className:"text-[10px] px-1.5 py-0",children:"New"})]}),e.jsxs("span",{className:"block text-xs text-muted-foreground mb-1",children:[p.author.displayName," · ",s.formatTimestamp(p.createdAt)]}),e.jsx("div",{className:s.cn("text-sm text-foreground [&_p]:mb-2 [&_ul]:list-disc [&_ul]:pl-5 [&_ol]:list-decimal [&_ol]:pl-5",!A&&"line-clamp-(--preview-lines) overflow-hidden"),style:A?void 0:{"--preview-lines":j},dangerouslySetInnerHTML:{__html:p.content}}),!A&&p.content.replace(/<[^>]*>/g,"").length>200&&e.jsx(s.Button,{variant:"link",size:"xs",className:"px-0 mt-0.5 h-auto",onClick:x=>{x.stopPropagation(),L(p.uid)},children:"Read more"})]})]})})},p.uid)}),k&&h&&u.length>0&&e.jsx(s.Pagination,{currentPage:b,totalPages:Math.ceil((g??u.length)/h),onPageChange:k,className:"mt-4"})]})}function O(t){return t.replace(/<[^>]*>/g,"").trim().length===0}function Re({title:t,rootPost:n,replies:r,currentUser:d,onReply:j,onToggleLike:i,onMarkAnswer:m,maxDepth:a=3,allowReplies:N=!0,sortOrder:v="oldest",readOnly:h=!1,isLoading:b,error:g,onRetry:k,className:y,style:o}){const[S,z]=c.useState(null),[u,L]=c.useState(""),p=c.useMemo(()=>{const w=new Map;for(const T of r){const R=T.parentUid??n.uid,l=w.get(R)??[];l.push(T),w.set(R,l)}for(const[,T]of w)T.sort((R,l)=>v==="newest"?new Date(l.createdAt).getTime()-new Date(R.createdAt).getTime():v==="most_liked"?l.likeCount-R.likeCount:new Date(R.createdAt).getTime()-new Date(l.createdAt).getTime());return w},[r,n.uid,v]);if(b)return e.jsxs("div",{className:s.cn("space-y-4",y),style:o,children:[e.jsx(s.Skeleton,{className:"h-7 w-64"}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(s.Skeleton,{className:"h-8 w-8 rounded-full shrink-0"}),e.jsx(s.Skeleton,{className:"h-32 w-full"})]}),Array.from({length:2}).map((w,T)=>e.jsx("div",{className:"ml-8",children:e.jsx(s.Skeleton,{className:"h-20 w-full"})},T))]});if(g)return e.jsx("div",{className:s.cn("py-12",y),style:o,children:e.jsx(s.EmptyState,{icon:e.jsx(C.AlertCircle,{className:"size-10 text-destructive"}),title:"Something went wrong",description:g,action:k?e.jsx(s.Button,{variant:"outline",onClick:k,children:"Retry"}):void 0})});function A(w){O(u)||(j(w,u),L(""),z(null))}function x(w,T){const R=p.get(w.uid)??[],l=Math.min(T,a),f=e.jsxs("div",{className:"flex items-center gap-1",children:[i&&!h&&e.jsxs(s.Tooltip,{children:[e.jsx(s.TooltipTrigger,{children:e.jsxs(s.Button,{variant:"ghost",size:"sm","aria-label":w.isLikedByCurrentUser?"Unlike":"Like",className:s.cn(w.isLikedByCurrentUser&&"text-destructive"),onClick:()=>i(w.uid),children:[e.jsx(C.Heart,{size:14,fill:w.isLikedByCurrentUser?"currentColor":"none"}),w.likeCount>0?w.likeCount:"Like"]})}),e.jsx(s.TooltipContent,{children:w.isLikedByCurrentUser?"Unlike":"Like"})]}),N&&!h&&e.jsxs(s.Tooltip,{children:[e.jsx(s.TooltipTrigger,{children:e.jsxs(s.Button,{variant:"ghost",size:"sm","aria-label":"Reply",onClick:()=>z(w.uid),children:[e.jsx(C.Reply,{size:14}),"Reply"]})}),e.jsx(s.TooltipContent,{children:"Reply"})]}),m&&!h&&d.role!=="student"&&!w.isAnswer&&e.jsxs(s.Tooltip,{children:[e.jsx(s.TooltipTrigger,{children:e.jsxs(s.Button,{variant:"ghost",size:"sm","aria-label":"Mark as answer",className:"text-success",onClick:()=>m(w.uid),children:[e.jsx(C.CheckCircle,{size:14}),"Mark Answer"]})}),e.jsx(s.TooltipContent,{children:"Mark as answer"})]})]});return e.jsxs("div",{children:[e.jsx(s.PostCard,{author:w.author,content:w.content,createdAt:w.createdAt,updatedAt:w.updatedAt,actions:f,highlight:w.isAnswer?"answer":"none",indentLevel:l,className:"mb-2"}),S===w.uid&&e.jsx(s.Card,{className:"mb-2",style:{marginLeft:`${(l+1)*16}px`},children:e.jsxs(s.CardContent,{className:"py-4",children:[e.jsx(s.RichTextEditor,{className:"min-h-15 mb-2",placeholder:"Write a reply...",value:u,onChange:B=>L(B),variant:"minimal"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(s.Button,{size:"sm",onClick:()=>A(w.uid),disabled:O(u),children:"Post Reply"}),e.jsx(s.Button,{variant:"ghost",size:"sm",onClick:()=>{z(null),L("")},children:"Cancel"})]})]})}),R.map(B=>x(B,T+1))]},w.uid)}return e.jsxs("div",{className:y,style:o,children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(C.MessageSquare,{size:20,className:"text-foreground shrink-0"}),e.jsx("span",{className:"text-lg font-semibold text-foreground",children:t}),e.jsxs(s.Badge,{variant:"muted",className:"text-xs",children:[r.length," ",r.length===1?"reply":"replies"]})]}),e.jsx(s.Separator,{className:"mb-2"}),x(n,0)]})}function Le({title:t,instructions:n,dueDate:r,maxScore:d,status:j,submissionTypes:i,existingSubmission:m,fileConstraints:a,onSubmit:N,onSaveDraft:v,grade:h,isSubmitting:b=!1,readOnly:g=!1,isLoading:k,error:y,onRetry:o,className:S,style:z}){const[u,L]=c.useState((m==null?void 0:m.textContent)??""),[p,A]=c.useState((m==null?void 0:m.files)??[]),[x,w]=c.useState((m==null?void 0:m.url)??""),[T,R]=c.useState(i[0]);if(k)return e.jsxs("div",{className:s.cn("space-y-4",S),style:z,children:[e.jsx(s.Skeleton,{className:"h-8 w-64"}),e.jsx(s.Skeleton,{className:"h-6 w-20"}),e.jsx(s.Skeleton,{className:"h-32 w-full"}),e.jsx(s.Skeleton,{className:"h-10 w-32"})]});if(y)return e.jsx("div",{className:s.cn("py-12",S),style:z,children:e.jsx(s.EmptyState,{icon:e.jsx(C.AlertCircle,{className:"size-10 text-destructive"}),title:"Something went wrong",description:y,action:o?e.jsx(s.Button,{variant:"outline",onClick:o,children:"Retry"}):void 0})});const l=!g&&!["submitted","graded"].includes(j);function f(){return{textContent:i.includes("text")?u:void 0,files:i.includes("file")?p:void 0,url:i.includes("url")?x:void 0}}return e.jsxs("div",{className:S,style:z,children:[e.jsx("div",{className:"flex justify-between items-start mb-2",children:e.jsxs("div",{children:[e.jsx("div",{className:"text-xl font-bold text-foreground mb-0.5",children:t}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(s.StatusBadge,{status:j}),r&&e.jsx(s.DueDateDisplay,{dueDate:r,size:"small"}),d!=null&&e.jsxs("span",{className:"text-sm text-muted-foreground",children:[d," points"]})]})]})}),e.jsx(s.Card,{className:"mb-3",children:e.jsxs(s.CardContent,{className:"pt-6",children:[e.jsx("div",{className:"font-semibold text-sm text-foreground mb-1",children:"Instructions"}),e.jsx("div",{className:"text-muted-foreground text-sm",children:typeof n=="string"?e.jsx("span",{children:n}):n})]})}),h&&e.jsx(s.Alert,{variant:"success",className:"mb-3",children:e.jsxs(s.AlertDescription,{children:[e.jsxs("div",{className:"font-semibold text-sm mb-1",children:["Grade: ",h.score,d!=null?` / ${d}`:""]}),h.feedback&&e.jsx("div",{children:h.feedback})]})}),l&&e.jsxs(e.Fragment,{children:[i.length>1?e.jsxs(s.Tabs,{value:T,onValueChange:B=>R(B),children:[e.jsxs(s.TabsList,{children:[i.includes("text")&&e.jsx(s.TabsTrigger,{value:"text",children:"Text"}),i.includes("file")&&e.jsx(s.TabsTrigger,{value:"file",children:"File Upload"}),i.includes("url")&&e.jsx(s.TabsTrigger,{value:"url",children:"URL"})]}),i.includes("text")&&e.jsx(s.TabsContent,{value:"text",children:e.jsx(s.RichTextEditor,{className:"min-h-45",placeholder:"Type your submission...",value:u,onChange:B=>L(B),variant:"default"})}),i.includes("file")&&e.jsx(s.TabsContent,{value:"file",children:e.jsx(s.FileUploadZone,{files:p,onFilesAdded:B=>A(M=>[...M,...B]),onFileRemove:B=>A(M=>M.filter((_,E)=>E!==B)),accept:a==null?void 0:a.acceptedTypes,maxFiles:a==null?void 0:a.maxFiles,maxSizeMB:a==null?void 0:a.maxSizeMB})}),i.includes("url")&&e.jsx(s.TabsContent,{value:"url",children:e.jsx(s.Input,{placeholder:"https://...",value:x,onChange:B=>w(B.target.value)})})]}):e.jsxs(e.Fragment,{children:[i.includes("text")&&e.jsx(s.RichTextEditor,{className:"min-h-45 mb-2",placeholder:"Type your submission...",value:u,onChange:B=>L(B),variant:"default"}),i.includes("file")&&e.jsx("div",{className:"mb-2",children:e.jsx(s.FileUploadZone,{files:p,onFilesAdded:B=>A(M=>[...M,...B]),onFileRemove:B=>A(M=>M.filter((_,E)=>E!==B)),accept:a==null?void 0:a.acceptedTypes,maxFiles:a==null?void 0:a.maxFiles,maxSizeMB:a==null?void 0:a.maxSizeMB})}),i.includes("url")&&e.jsx(s.Input,{className:"mb-2",placeholder:"https://...",value:x,onChange:B=>w(B.target.value)})]}),e.jsx(s.Separator,{className:"my-2"}),e.jsxs("div",{className:"flex gap-2 justify-end",children:[v&&e.jsxs(s.Button,{variant:"outline",onClick:()=>v(f()),disabled:b,children:[e.jsx(C.Save,{size:16}),"Save Draft"]}),e.jsxs(s.Button,{onClick:()=>N(f()),disabled:b,children:[e.jsx(C.Send,{size:16}),b?"Submitting...":"Submit"]})]})]})]})}function W({label:t,field:n,sortField:r,sortDir:d,onSort:j,textAlign:i}){const m=r===n;return e.jsx(s.TableHead,{className:s.cn("cursor-pointer select-none hover:bg-muted",i==="right"&&"text-right"),onClick:()=>j(n),children:e.jsxs("div",{className:s.cn("flex items-center gap-1",i==="right"&&"justify-end"),children:[e.jsx("span",{className:s.cn(m?"text-foreground":"text-muted-foreground"),children:t}),m&&(d==="asc"?e.jsx(C.ArrowUp,{size:14}):e.jsx(C.ArrowDown,{size:14}))]})})}function Ue({items:t,categories:n,overallGrade:r,showWeights:d=!0,showCategoryTotals:j=!0,onItemClick:i,readOnly:m=!1,isLoading:a,error:N,onRetry:v,pageSize:h,currentPage:b=1,totalItems:g,onPageChange:k,className:y,style:o}){const[S,z]=c.useState("dueDate"),[u,L]=c.useState("asc");function p(T){S===T?L(R=>R==="asc"?"desc":"asc"):(z(T),L("asc"))}const A=c.useMemo(()=>{const T=[...t];return T.sort((R,l)=>{let f=0;switch(S){case"name":f=R.name.localeCompare(l.name);break;case"score":f=(R.score??-1)-(l.score??-1);break;case"dueDate":f=(R.dueDate??"").localeCompare(l.dueDate??"");break;case"status":f=R.status.localeCompare(l.status);break}return u==="asc"?f:-f}),T},[t,S,u]),x=c.useMemo(()=>{if(!n||n.length===0)return[{category:null,items:A}];const T=n.map(l=>({category:l,items:A.filter(f=>f.categoryUid===l.uid)})),R=A.filter(l=>!l.categoryUid);return R.length>0&&T.push({category:null,items:R}),T},[A,n]),w=d?5:4;return a?e.jsxs("div",{className:s.cn("space-y-4",y),style:o,children:[e.jsx(s.Skeleton,{className:"h-20 w-full"}),e.jsx(s.Skeleton,{className:"h-10 w-full"}),e.jsx(s.Skeleton,{className:"h-12 w-full"}),e.jsx(s.Skeleton,{className:"h-12 w-full"}),e.jsx(s.Skeleton,{className:"h-12 w-full"}),e.jsx(s.Skeleton,{className:"h-12 w-full"}),e.jsx(s.Skeleton,{className:"h-12 w-full"})]}):N?e.jsx("div",{className:s.cn("py-12",y),style:o,children:e.jsx(s.EmptyState,{icon:e.jsx(C.AlertCircle,{className:"size-10 text-destructive"}),title:"Something went wrong",description:N,action:v?e.jsx(s.Button,{variant:"outline",onClick:v,children:"Retry"}):void 0})}):e.jsxs("div",{className:y,style:o,children:[r&&e.jsx(s.Card,{className:"mb-3",children:e.jsx(s.CardContent,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(s.GradeIndicator,{percentage:r.percentage,letterGrade:r.letterGrade,size:"large",passingThreshold:60}),e.jsxs("div",{children:[e.jsx("div",{className:"text-lg font-semibold text-foreground",children:"Overall Grade"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[r.pointsEarned," / ",r.pointsPossible," points"]})]})]})})}),e.jsx(s.Card,{children:e.jsxs(s.Table,{children:[e.jsx(s.TableHeader,{children:e.jsxs(s.TableRow,{children:[e.jsx(W,{label:"Assignment",field:"name",sortField:S,sortDir:u,onSort:p}),e.jsx(W,{label:"Status",field:"status",sortField:S,sortDir:u,onSort:p}),e.jsx(W,{label:"Due Date",field:"dueDate",sortField:S,sortDir:u,onSort:p}),e.jsx(W,{label:"Score",field:"score",sortField:S,sortDir:u,onSort:p,textAlign:"right"}),d&&e.jsx(s.TableHead,{className:"text-right text-muted-foreground",children:"Weight"})]})}),e.jsx(s.TableBody,{children:x.map((T,R)=>{var l;return e.jsxs(c.Fragment,{children:[T.category&&j&&e.jsx(s.TableRow,{className:"bg-muted hover:bg-muted",children:e.jsx(s.TableCell,{colSpan:w,children:e.jsxs("span",{className:"font-semibold text-sm text-foreground",children:[T.category.name,T.category.weight!=null&&` (${T.category.weight}%)`]})})}),T.items.map(f=>e.jsxs(s.TableRow,{className:s.cn(i&&!m&&"cursor-pointer"),onClick:()=>i&&!m?i(f):void 0,children:[e.jsx(s.TableCell,{children:f.name}),e.jsx(s.TableCell,{children:e.jsx(s.StatusBadge,{status:f.status,size:"small"})}),e.jsx(s.TableCell,{children:f.dueDate?e.jsx(s.DueDateDisplay,{dueDate:f.dueDate,submittedDate:f.submittedDate,size:"small"}):"—"}),e.jsx(s.TableCell,{className:"text-right",children:f.score!=null?e.jsxs("span",{className:"text-sm font-semibold text-foreground",children:[f.score," / ",f.maxScore]}):f.status==="excused"?e.jsx("span",{className:"text-sm text-muted-foreground",children:"Excused"}):e.jsx("span",{className:"text-sm text-muted-foreground",children:"—"})}),d&&e.jsx(s.TableCell,{className:"text-right",children:f.weight!=null?`${f.weight}%`:"—"})]},f.uid))]},((l=T.category)==null?void 0:l.uid)??`ungrouped-${R}`)})})]})}),k&&h&&e.jsx(s.Pagination,{currentPage:b,totalPages:Math.ceil((g??t.length)/h),onPageChange:k,className:"mt-4"})]})}const Me=["var(--palette-0)","var(--palette-1)","var(--palette-2)","var(--palette-3)"],Y=Me.length;function Fe(t){return`palette${(t%Y+Y)%Y}`}function De({overallProgress:t,totalTimeSpent:n,modules:r,recentActivity:d,streak:j,achievements:i,recentActivityLimit:m=5,onModuleClick:a,isLoading:N,error:v,onRetry:h,className:b,style:g}){const k=c.useMemo(()=>r.filter(o=>o.completedItems===o.totalItems).length,[r]),y=c.useMemo(()=>(d==null?void 0:d.map(o=>({uid:o.uid,type:o.type,title:o.description,timestamp:o.timestamp})))??[],[d]);return N?e.jsxs("div",{className:s.cn("space-y-4",b),style:g,children:[e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsx(s.Skeleton,{className:"h-24"}),e.jsx(s.Skeleton,{className:"h-24"}),e.jsx(s.Skeleton,{className:"h-24"})]}),e.jsx(s.Skeleton,{className:"h-32 w-32 rounded-full mx-auto"}),e.jsx(s.Skeleton,{className:"h-8 w-full"}),e.jsx(s.Skeleton,{className:"h-8 w-full"}),e.jsx(s.Skeleton,{className:"h-8 w-full"})]}):v?e.jsx("div",{className:s.cn("py-12",b),style:g,children:e.jsx(s.EmptyState,{icon:e.jsx(C.AlertCircle,{className:"size-10 text-destructive"}),title:"Something went wrong",description:v,action:h?e.jsx(s.Button,{variant:"outline",onClick:h,children:"Retry"}):void 0})}):e.jsxs("div",{className:b,style:g,children:[e.jsxs("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(160px,1fr))] gap-3 mb-4",children:[e.jsx(s.Card,{children:e.jsx(s.CardContent,{className:"p-3 flex justify-center",children:e.jsx(s.ProgressRing,{value:t,size:100})})}),e.jsx(s.StatCard,{icon:e.jsx(C.Clock,{size:24}),label:"Time Spent",description:"Total learning time",value:s.formatDuration(n)}),j&&e.jsx(s.Card,{children:e.jsx(s.CardContent,{className:"p-4 flex items-center",children:e.jsx(s.StreakBadge,{currentStreak:j.currentDays,longestStreak:j.longestDays,showLongest:!0})})}),e.jsx(s.StatCard,{icon:e.jsx(C.BookOpen,{size:24}),label:"Modules",description:"Course progress",value:`${k} / ${r.length}`,subtitle:"completed"})]}),e.jsx(s.Separator,{className:"mb-3"}),e.jsx("p",{className:"text-lg font-semibold mb-2 text-foreground",children:"Module Progress"}),e.jsx("div",{className:"flex flex-col gap-2 mb-4",children:r.map((o,S)=>{const z=o.totalItems>0?o.completedItems/o.totalItems*100:0;return e.jsx(s.Card,{className:s.cn("transition-colors",a&&"cursor-pointer hover:border-primary"),onClick:()=>a==null?void 0:a(o.uid),children:e.jsxs(s.CardContent,{className:"p-3",children:[e.jsxs("div",{className:"flex justify-between items-center mb-0.5",children:[e.jsx("span",{className:"font-semibold text-sm text-foreground",children:o.name}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[o.completedItems," / ",o.totalItems]})]}),e.jsx(s.Progress,{value:z,size:"sm",variant:z>=100?"success":Fe(S)})]})},o.uid)})}),d&&d.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(s.Separator,{className:"mb-3"}),e.jsx("p",{className:"text-lg font-semibold mb-2 text-foreground",children:"Recent Activity"}),e.jsx("div",{className:"mb-4",children:e.jsx(s.ActivityTimeline,{events:y,limit:m})})]}),i&&i.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(s.Separator,{className:"mb-3"}),e.jsx("p",{className:"text-lg font-semibold mb-2 text-foreground",children:"Achievements"}),e.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(140px,1fr))] gap-2",children:i.map(o=>e.jsx(s.AchievementBadge,{title:o.name,description:o.description,icon:o.iconUrl?e.jsx("img",{src:o.iconUrl,alt:o.name,className:"w-12 h-12"}):void 0,earnedDate:o.earnedAt},o.uid))})]})]})}const Ee={classic:{size:40,paths:[{d:"M 2 38 L 2 10 Q 2 2 10 2 L 38 2",strokeWidth:1.5},{d:"M 7 38 L 7 13 Q 7 7 13 7 L 38 7",strokeWidth:.75}],color:"text-warning/50"},modern:null,elegant:{size:32,paths:[{d:"M 0 30 L 0 0 L 30 0",strokeWidth:.5}],dots:[{cx:2.5,cy:2.5,r:1.5}],color:"text-foreground/20"},academic:{size:36,paths:[{d:"M 0 36 L 0 0 L 36 0",strokeWidth:2},{d:"M 5 36 L 5 5 L 36 5",strokeWidth:1}],color:"text-info/35"},minimal:null,bold:{size:20,paths:[],dots:[{cx:5,cy:5,r:5}],color:"text-primary/40"}},Pe=[{key:"tl",pos:"top-3 left-3",transform:void 0},{key:"tr",pos:"top-3 right-3",transform:"scaleX(-1)"},{key:"bl",pos:"bottom-3 left-3",transform:"scaleY(-1)"},{key:"br",pos:"bottom-3 right-3",transform:"scale(-1)"}],Ie={classic:{lineColor:"bg-warning/30",motif:e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",className:"text-warning/50 shrink-0","aria-hidden":"true",children:e.jsx("path",{d:"M6 0 L12 6 L6 12 L0 6 Z",fill:"currentColor"})})},modern:{lineColor:"bg-primary/20",motif:e.jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",className:"text-primary/40 shrink-0","aria-hidden":"true",children:e.jsx("circle",{cx:"4",cy:"4",r:"3",fill:"currentColor"})})},elegant:{lineColor:"bg-foreground/10",motif:e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",className:"text-foreground/15 shrink-0","aria-hidden":"true",children:e.jsx("path",{d:"M5 0 L6 4 L10 5 L6 6 L5 10 L4 6 L0 5 L4 4 Z",fill:"currentColor"})})},academic:{lineColor:"bg-info/25",motif:e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",className:"text-info/40 shrink-0","aria-hidden":"true",children:e.jsx("path",{d:"M4 0 L6 0 L6 4 L10 4 L10 6 L6 6 L6 10 L4 10 L4 6 L0 6 L0 4 L4 4 Z",fill:"currentColor"})})},minimal:{lineColor:"bg-border",motif:null},bold:{lineColor:"bg-primary/40",motif:e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",className:"text-primary/50 shrink-0","aria-hidden":"true",children:e.jsx("rect",{x:"1",y:"1",width:"8",height:"8",fill:"currentColor"})})}},_e={classic:{background:"radial-gradient(ellipse at center, var(--color-warning) 0%, transparent 65%)",opacity:.06},modern:null,elegant:{background:"radial-gradient(ellipse at center, var(--color-foreground) 0%, transparent 70%)",opacity:.03},academic:{background:"radial-gradient(ellipse at center, var(--color-info) 0%, transparent 65%)",opacity:.05},minimal:null,bold:{background:"radial-gradient(ellipse at 30% 50%, var(--color-primary) 0%, transparent 50%), radial-gradient(ellipse at 70% 50%, var(--color-palette-0) 0%, transparent 50%)",opacity:.06}},Qe={classic:"text-warning",modern:"text-primary",elegant:"text-foreground/60",academic:"text-info",minimal:"text-muted-foreground",bold:"text-primary"},He={classic:"uppercase tracking-[4px] text-base font-medium text-foreground/80 font-serif",modern:"uppercase tracking-[3px] text-base font-medium text-primary/80",elegant:"uppercase tracking-[5px] text-sm font-light text-foreground/50",academic:"uppercase tracking-[3px] text-base font-semibold text-info/80",minimal:"uppercase tracking-[2px] text-sm font-normal text-muted-foreground",bold:"uppercase tracking-[3px] text-lg font-black text-primary"},Ve={classic:"text-warning",modern:"text-primary",elegant:"text-foreground/80",academic:"text-info",minimal:"text-foreground",bold:"text-primary"},$e=new Set(["classic","elegant","academic"]),Ge=ae.cva("mx-auto max-w-4xl",{variants:{variant:{classic:"border-[3px] border-double border-warning/50 rounded-lg p-1.5",modern:"rounded-lg",elegant:"border border-foreground/15 rounded-lg p-2.5 dark:border-foreground/10",academic:"border-2 border-info/30 rounded-lg p-1.5",minimal:"rounded-lg",bold:"rounded-lg"}},defaultVariants:{variant:"classic"}}),We=ae.cva("relative text-center p-8 sm:p-12 md:p-16 overflow-hidden",{variants:{variant:{classic:"border border-warning/25 rounded bg-warning/5",modern:"border border-primary/20 rounded-lg bg-linear-to-br from-primary/5 to-primary/8 border-t-[3px] border-t-primary/60",elegant:"border border-foreground/8 rounded bg-linear-to-b from-background to-muted/20 dark:border-foreground/5 dark:to-muted/10",academic:"border border-info/15 rounded bg-info/3",minimal:"border border-border rounded-lg bg-background",bold:"border-[3px] border-primary rounded-lg bg-linear-to-br from-primary/8 to-palette-0/8"}},defaultVariants:{variant:"classic"}});function Oe({variant:t}){const n=Ee[t];return n?e.jsx(e.Fragment,{children:Pe.map(({key:r,pos:d,transform:j})=>{var i;return e.jsxs("svg",{className:s.cn("absolute pointer-events-none",d,n.color),width:n.size,height:n.size,viewBox:`0 0 ${n.size} ${n.size}`,fill:"none",stroke:"currentColor",style:j?{transform:j}:void 0,"aria-hidden":"true",children:[n.paths.map((m,a)=>e.jsx("path",{d:m.d,strokeWidth:m.strokeWidth},a)),(i=n.dots)==null?void 0:i.map((m,a)=>e.jsx("circle",{cx:m.cx,cy:m.cy,r:m.r,fill:"currentColor",stroke:"none"},`d${a}`))]},r)})}):null}function le({variant:t,className:n}){const r=Ie[t];return e.jsxs("div",{className:s.cn("flex items-center justify-center gap-3 my-5 mx-auto max-w-70",n),role:"separator","aria-hidden":"true",children:[e.jsx("span",{className:s.cn("flex-1 h-px",r.lineColor)}),r.motif,e.jsx("span",{className:s.cn("flex-1 h-px",r.lineColor)})]})}function Ze({recipientName:t,courseTitle:n,completionDate:r,organizationName:d,organizationLogo:j,signatory:i,certificateId:m,variant:a="classic",showActions:N=!0,onPrint:v,onDownload:h,isLoading:b,error:g,onRetry:k,className:y,style:o}){const S=c.useMemo(()=>{try{return new Date(r).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}catch{return r}},[r]);function z(){v?v():window.print()}const u=_e[a];return e.jsx(H,{isLoading:b,error:g,onRetry:k,className:y,style:o,skeleton:e.jsx(s.Skeleton,{className:"h-80 w-full rounded-lg border"}),children:e.jsxs("div",{className:y,style:o,children:[e.jsx("div",{className:Ge({variant:a}),children:e.jsxs("div",{className:We({variant:a}),children:[e.jsx(Oe,{variant:a}),u&&e.jsx("div",{className:"absolute inset-0 pointer-events-none rounded-[inherit]",style:u,"aria-hidden":"true"}),e.jsxs("div",{className:"relative",children:[j?e.jsx("img",{src:j,alt:d,className:"h-20 mb-4 mx-auto block"}):e.jsx(C.Award,{size:64,className:s.cn("mx-auto mb-6",Qe[a])}),e.jsx("p",{className:s.cn("mb-2",He[a]),children:"Certificate of Completion"}),e.jsx(le,{variant:a}),e.jsx("p",{className:"text-base text-foreground/70 mb-2",children:"This is to certify that"}),e.jsx("p",{className:s.cn("text-4xl font-bold mb-4 text-foreground",$e.has(a)&&"font-serif"),children:t}),e.jsx("p",{className:"text-base text-foreground/70 mb-2",children:"has successfully completed"}),e.jsx("p",{className:s.cn("text-2xl font-semibold mb-4",Ve[a]),children:n}),e.jsxs("p",{className:"text-base text-foreground/60 mb-6",children:["Issued by ",d," on ",S]}),i&&e.jsxs("div",{className:"mt-6 mb-4",children:[e.jsx(le,{variant:a}),e.jsx("p",{className:"font-semibold text-base text-foreground",children:i.name}),e.jsx("p",{className:"text-sm text-muted-foreground",children:i.title})]}),m&&e.jsxs("span",{className:"block text-xs text-muted-foreground mt-4",children:["Certificate ID: ",m]})]})]})}),N&&e.jsxs("div",{className:"flex justify-center gap-3 mt-6",children:[e.jsxs(s.Button,{variant:"outline",onClick:z,children:[e.jsx(C.Printer,{size:16})," Print"]}),h&&e.jsxs(s.Button,{variant:"outline",onClick:h,children:[e.jsx(C.Download,{size:16})," Download"]})]})]})})}function Ye({criteria:t,selectedLevels:n,totalScore:r,maxScore:d,feedback:j,isLoading:i,error:m,onRetry:a,className:N,style:v}){var b;const h=n&&Object.keys(n).length>0;return i?e.jsxs("div",{className:s.cn("space-y-4",N),style:v,children:[e.jsx(s.Skeleton,{className:"h-10 w-full"}),Array.from({length:3}).map((g,k)=>e.jsx(s.Skeleton,{className:"h-16 w-full"},k))]}):m?e.jsx("div",{className:s.cn("py-12",N),style:v,children:e.jsx(s.EmptyState,{icon:e.jsx(C.AlertCircle,{className:"size-10 text-destructive"}),title:"Something went wrong",description:m,action:a?e.jsx(s.Button,{variant:"outline",onClick:a,children:"Retry"}):void 0})}):e.jsxs("div",{className:s.cn("flex flex-col gap-4",N),style:v,children:[h&&r!==void 0&&d!==void 0&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"Rubric"}),e.jsxs(s.Badge,{variant:r>=d*.7?"success":"destructive",children:[r," / ",d," pts"]})]}),!h&&e.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"Grading Rubric"}),e.jsx(s.Card,{children:e.jsx(s.CardContent,{className:"p-0",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(s.Table,{className:"text-sm",children:[e.jsx(s.TableHeader,{children:e.jsxs(s.TableRow,{className:"bg-muted/50",children:[e.jsx(s.TableHead,{className:"text-left font-medium text-muted-foreground w-1/5",children:"Criterion"}),(b=t[0])==null?void 0:b.levels.map(g=>e.jsxs(s.TableHead,{className:"text-center font-medium text-muted-foreground",children:[e.jsx("div",{children:g.label}),e.jsxs("div",{className:"text-xs font-normal mt-0.5",children:[g.points," pts"]})]},g.uid))]})}),e.jsx(s.TableBody,{children:t.map((g,k)=>{const y=n==null?void 0:n[g.uid];return e.jsxs(s.TableRow,{className:s.cn(k%2===1&&"bg-muted/20"),children:[e.jsxs(s.TableCell,{className:"align-top",children:[e.jsx("div",{className:"font-medium text-foreground",children:g.name}),g.description&&e.jsx("div",{className:"text-xs text-muted-foreground mt-0.5",children:g.description})]}),g.levels.map(o=>{const S=y===o.uid;return e.jsxs(s.TableCell,{className:s.cn("align-top text-center",S&&"bg-primary/10 ring-2 ring-primary/30 ring-inset rounded-sm"),children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:o.description}),S&&e.jsx("div",{className:"mt-1.5 flex justify-center",children:e.jsx(C.CheckCircle2,{className:"size-4 text-primary"})})]},o.uid)})]},g.uid)})})]})})})}),j&&e.jsxs(e.Fragment,{children:[e.jsx(s.Separator,{}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-medium text-foreground mb-1",children:"Instructor Feedback"}),e.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:j})]})]})]})}function Xe({title:t,requirements:n,onRequirementClick:r,isLoading:d,error:j,onRetry:i,className:m,style:a}){const N=c.useMemo(()=>n.filter(h=>h.completed).length,[n]),v=n.length>0?Math.round(N/n.length*100):0;return d?e.jsxs("div",{className:s.cn("space-y-4",m),style:a,children:[e.jsx(s.Skeleton,{className:"h-6 w-48"}),e.jsx(s.Skeleton,{className:"h-2 w-full"}),Array.from({length:4}).map((h,b)=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(s.Skeleton,{className:"h-5 w-5 rounded-full"}),e.jsx(s.Skeleton,{className:"h-4 w-3/4"})]},b))]}):j?e.jsx("div",{className:s.cn("py-12",m),style:a,children:e.jsx(s.EmptyState,{icon:e.jsx(C.AlertCircle,{className:"size-10 text-destructive"}),title:"Something went wrong",description:j,action:i?e.jsx(s.Button,{variant:"outline",onClick:i,children:"Retry"}):void 0})}):e.jsxs("div",{className:s.cn("flex flex-col gap-4",m),style:a,children:[t&&e.jsx("h3",{className:"text-lg font-semibold text-foreground",children:t}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsxs("span",{className:"text-muted-foreground",children:[N," of ",n.length," complete"]}),e.jsxs("span",{className:"font-medium text-foreground",children:[v,"%"]})]}),e.jsx(s.Progress,{value:v})]}),e.jsx("ul",{className:"flex flex-col gap-1",children:n.map(h=>e.jsx("li",{children:e.jsxs("button",{type:"button",className:s.cn("w-full flex items-start gap-3 p-3 rounded-lg text-left transition-colors",h.completed?"bg-success/5":r?"hover:bg-muted/50 cursor-pointer":"cursor-default"),onClick:()=>{!h.completed&&r&&r(h.uid)},disabled:h.completed,children:[h.completed?e.jsx(C.CheckCircle2,{className:"size-5 text-success shrink-0 mt-0.5"}):e.jsx(C.Circle,{className:"size-5 text-muted-foreground shrink-0 mt-0.5"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:s.cn("text-sm font-medium",h.completed?"text-muted-foreground line-through":"text-foreground"),children:h.label}),h.description&&e.jsx("div",{className:"text-xs text-muted-foreground mt-0.5",children:h.description})]}),!h.completed&&r&&e.jsxs("div",{className:"shrink-0 flex items-center gap-1 text-xs text-primary mt-0.5",children:[h.actionLabel&&e.jsx("span",{children:h.actionLabel}),e.jsx(C.ChevronRight,{className:"size-4"})]})]})},h.uid))})]})}const Je={newest:"Newest",oldest:"Oldest",most_replies:"Most Replies",most_liked:"Most Liked"};function Ke({title:t,topics:n,onTopicClick:r,onCreateTopic:d,sortOrder:j="newest",onSortChange:i,searchQuery:m="",onSearchChange:a,readOnly:N,isLoading:v,error:h,onRetry:b,pageSize:g,currentPage:k=1,totalItems:y,onPageChange:o,className:S,style:z}){const[u,L]=c.useState(!1),[p,A]=c.useState(""),[x,w]=c.useState(""),[T,R]=c.useState(m),[l,f]=c.useState(j),B=a!==void 0?m:T,M=i!==void 0?j:l;function _(U){a?a(U):R(U)}function E(){const U=["newest","oldest","most_replies","most_liked"],F=U.indexOf(M),D=U[(F+1)%U.length];i?i(D):f(D)}function P(){!p.trim()||O(x)||(d==null||d(p.trim(),x),A(""),w(""),L(!1))}const Q=c.useMemo(()=>[...n.filter(F=>{var I;if(!B)return!0;const D=B.toLowerCase();return F.title.toLowerCase().includes(D)||((I=F.preview)==null?void 0:I.toLowerCase().includes(D))||F.author.displayName.toLowerCase().includes(D)})].sort((F,D)=>{if(F.isPinned&&!D.isPinned)return-1;if(!F.isPinned&&D.isPinned)return 1;switch(M){case"oldest":return new Date(F.createdAt).getTime()-new Date(D.createdAt).getTime();case"most_replies":return D.replyCount-F.replyCount;case"most_liked":return D.likeCount-F.likeCount;case"newest":default:return new Date(D.createdAt).getTime()-new Date(F.createdAt).getTime()}}),[n,B,M]);return v?e.jsxs("div",{className:s.cn("space-y-4",S),style:z,children:[e.jsx(s.Skeleton,{className:"h-9 w-full"}),Array.from({length:4}).map((U,F)=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(s.Skeleton,{className:"h-8 w-8 rounded-full"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx(s.Skeleton,{className:"h-5 w-64"}),e.jsx(s.Skeleton,{className:"h-4 w-32"})]})]},F))]}):h?e.jsx("div",{className:s.cn("py-12",S),style:z,children:e.jsx(s.EmptyState,{icon:e.jsx(C.AlertCircle,{className:"size-10 text-destructive"}),title:"Something went wrong",description:h,action:b?e.jsx(s.Button,{variant:"outline",onClick:b,children:"Retry"}):void 0})}):e.jsxs("div",{className:s.cn("flex flex-col gap-4",S),style:z,children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[t&&e.jsx("h2",{className:"text-xl font-bold text-foreground",children:t}),!N&&d&&e.jsxs(s.Button,{size:"sm",onClick:()=>L(!u),children:[e.jsx(C.Plus,{className:"size-4 mr-1.5"}),"New Topic"]})]}),e.jsx(s.Separator,{}),u&&e.jsx(s.Card,{children:e.jsxs(s.CardContent,{className:"pt-4 space-y-3",children:[e.jsx(s.Input,{placeholder:"Topic title",value:p,onChange:U=>A(U.target.value)}),e.jsx(s.RichTextEditor,{placeholder:"What would you like to discuss?",value:x,onChange:U=>w(U),variant:"minimal"}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(s.Button,{variant:"outline",size:"sm",onClick:()=>{L(!1),A(""),w("")},children:"Cancel"}),e.jsx(s.Button,{size:"sm",onClick:P,disabled:!p.trim()||O(x),children:"Post Topic"})]})]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex-1",children:e.jsx(s.SearchInput,{value:B,onChange:_,placeholder:"Search topics..."})}),e.jsxs(s.Button,{variant:"outline",size:"sm",onClick:E,children:[e.jsx(C.ArrowUpDown,{className:"size-3.5 mr-1.5"}),Je[M]]})]}),Q.length===0?e.jsx(s.EmptyState,{icon:e.jsx(C.MessageSquare,{className:"size-10 text-muted-foreground"}),title:"No topics found",description:B?"Try a different search term.":"Be the first to start a discussion!"}):e.jsx("div",{className:"flex flex-col gap-2",children:(o&&g?Q.slice((k-1)*g,k*g):Q).map(U=>e.jsx(qe,{topic:U,onClick:r},U.uid))}),o&&g&&Q.length>0&&e.jsx(s.Pagination,{currentPage:k,totalPages:Math.ceil((y??Q.length)/g),onPageChange:o,className:"mt-4"})]})}const qe=c.memo(function({topic:n,onClick:r}){const d=c.useCallback(()=>r(n.uid),[r,n.uid]);return e.jsx("button",{type:"button",className:"w-full text-left",onClick:d,children:e.jsx(s.Card,{className:s.cn("transition-colors hover:bg-muted/30",n.isPinned&&"border-l-2 border-l-warning"),children:e.jsx(s.CardContent,{className:"py-3 px-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(s.UserAvatar,{displayName:n.author.displayName,avatarUrl:n.author.avatarUrl,size:"small"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[e.jsx("span",{className:"font-medium text-foreground text-sm truncate",children:n.title}),n.isPinned&&e.jsx(C.Pin,{className:"size-3 text-warning shrink-0"}),n.isAnswered&&e.jsxs(s.Badge,{variant:"success",className:"text-xs shrink-0",children:[e.jsx(C.CheckCircle2,{className:"size-3 mr-0.5"}),"Answered"]})]}),n.preview&&e.jsx("p",{className:"text-xs text-muted-foreground line-clamp-1",children:n.preview}),e.jsxs("div",{className:"flex items-center gap-3 mt-1.5 text-xs text-muted-foreground",children:[e.jsx("span",{children:n.author.displayName}),e.jsx("span",{children:s.formatTimestamp(n.createdAt)}),e.jsxs(s.Badge,{variant:"muted",className:"gap-0.5 text-xs px-1.5 py-0",children:[e.jsx(C.MessageSquare,{className:"size-3"}),n.replyCount]}),e.jsxs(s.Badge,{variant:"muted",className:"gap-0.5 text-xs px-1.5 py-0",children:[e.jsx(C.Heart,{className:"size-3"}),n.likeCount]})]})]})]})})})})});function es({course:t,prerequisites:n,onEnroll:r,onCancel:d,enrollLabel:j="Enroll Now",isEnrolling:i=!1,isLoading:m,error:a,onRetry:N,className:v,style:h}){const b=Array.isArray(n)&&n.length>0,[g,k]=c.useState("details"),y=c.useMemo(()=>b?[{key:"details",label:"Course Details"},{key:"prerequisites",label:"Prerequisites"},{key:"confirmation",label:"Confirmation"}]:[{key:"details",label:"Course Details"},{key:"confirmation",label:"Confirmation"}],[b]);if(m)return e.jsxs("div",{className:s.cn("space-y-4",v),style:h,children:[e.jsx(s.Skeleton,{className:"h-8 w-48"}),e.jsx(s.Skeleton,{className:"h-48 w-full"}),e.jsx(s.Skeleton,{className:"h-10 w-32"})]});if(a)return e.jsx("div",{className:s.cn("py-12",v),style:h,children:e.jsx(s.EmptyState,{icon:e.jsx(C.AlertCircle,{className:"size-10 text-destructive"}),title:"Something went wrong",description:a,action:N?e.jsx(s.Button,{variant:"outline",onClick:N,children:"Retry"}):void 0})});const o=y.findIndex(x=>x.key===g),S=!b||n.every(x=>x.isMet);function z(){const x=o+1;x<y.length&&k(y[x].key)}function u(){const x=o-1;x>=0&&k(y[x].key)}function L(){return e.jsx(s.Card,{children:e.jsxs(s.CardContent,{className:"pt-6",children:[t.thumbnailUrl?e.jsx("img",{src:t.thumbnailUrl,alt:t.title,className:"w-full h-48 object-cover rounded-lg mb-4"}):e.jsx("div",{className:"w-full h-48 rounded-lg mb-4 bg-muted flex items-center justify-center",children:e.jsx(C.BookOpen,{className:"size-12 text-muted-foreground"})}),e.jsx("h2",{className:"text-xl font-bold text-foreground mb-1",children:t.title}),t.description&&e.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:t.description}),e.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[t.instructor&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(s.UserAvatar,{displayName:t.instructor.displayName,avatarUrl:t.instructor.avatarUrl,size:"small"}),e.jsx("span",{className:"text-sm text-foreground",children:t.instructor.displayName})]}),t.duration&&e.jsxs(s.Badge,{variant:"muted",children:[e.jsx(C.Clock,{className:"size-3 mr-1"}),t.duration]})]}),t.syllabus&&t.syllabus.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(s.Separator,{className:"my-3"}),e.jsx("div",{className:"mb-1 text-sm font-semibold text-foreground",children:"Syllabus"}),e.jsx("ul",{className:"list-disc list-inside space-y-1",children:t.syllabus.map((x,w)=>e.jsx("li",{className:"text-sm text-muted-foreground",children:x},w))})]}),e.jsx(s.Separator,{className:"my-4"}),e.jsxs("div",{className:"flex justify-end gap-2",children:[d&&e.jsx(s.Button,{variant:"outline",onClick:d,children:"Cancel"}),e.jsx(s.Button,{onClick:z,children:"Continue"})]})]})})}function p(){return e.jsx(s.Card,{children:e.jsxs(s.CardContent,{className:"pt-6",children:[e.jsx("h3",{className:"text-lg font-semibold text-foreground mb-3",children:"Prerequisites"}),e.jsx("ul",{className:"space-y-3",children:n.map(x=>e.jsxs("li",{className:"flex items-start gap-2",children:[x.isMet?e.jsx(C.CheckCircle2,{className:"size-4 text-success shrink-0 mt-0.5"}):e.jsx(C.XCircle,{className:"size-4 text-destructive shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("span",{className:"text-sm font-medium text-foreground",children:x.label}),x.description&&e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:x.description})]})]},x.uid))}),e.jsx(s.Separator,{className:"my-4"}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(s.Button,{variant:"outline",onClick:u,children:"Back"}),e.jsx(s.Button,{onClick:z,disabled:!S,children:"Continue"})]})]})})}function A(){return e.jsx(s.Card,{children:e.jsxs(s.CardContent,{className:"pt-6",children:[e.jsx("h3",{className:"text-lg font-semibold text-foreground mb-3",children:"Confirm Enrollment"}),e.jsxs("div",{className:"space-y-2 mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C.BookOpen,{className:"size-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm font-medium text-foreground",children:t.title})]}),t.instructor&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(s.UserAvatar,{displayName:t.instructor.displayName,avatarUrl:t.instructor.avatarUrl,size:"small"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:t.instructor.displayName})]}),t.duration&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C.Clock,{className:"size-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:t.duration})]})]}),b&&e.jsx("div",{className:"mb-3",children:S?e.jsxs(s.Badge,{variant:"success",children:[e.jsx(C.CheckCircle2,{className:"size-3 mr-1"}),"All prerequisites met"]}):e.jsxs(s.Badge,{variant:"warning",children:[e.jsx(C.XCircle,{className:"size-3 mr-1"}),"Some prerequisites not met"]})}),e.jsx(s.Separator,{className:"my-4"}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(s.Button,{variant:"outline",onClick:u,children:"Back"}),e.jsxs(s.Button,{onClick:()=>r(t.uid),disabled:i,children:[i&&e.jsx(C.Loader2,{className:"size-4 mr-1 animate-spin"}),j]})]})]})})}return e.jsxs("div",{className:v,style:h,children:[e.jsx(s.Stepper,{steps:y.map(x=>({label:x.label})),currentStep:o,className:"mb-6"}),g==="details"&&L(),g==="prerequisites"&&p(),g==="confirmation"&&A()]})}function ss({courses:t=[],categories:n,onCourseClick:r,onEnroll:d,viewMode:j="grid",allowViewToggle:i=!0,showSearch:m=!0,emptyMessage:a="No courses found",readOnly:N=!1,isLoading:v,error:h,onRetry:b,pageSize:g,currentPage:k=1,totalItems:y,onPageChange:o,className:S,style:z}){const[u,L]=c.useState(""),[p,A]=c.useState(null),[x,w]=c.useState(j),T=c.useMemo(()=>{let l=t;if(p&&(l=l.filter(f=>f.categoryUid===p)),u.trim()){const f=u.toLowerCase();l=l.filter(B=>{var M,_;return B.title.toLowerCase().includes(f)||((M=B.description)==null?void 0:M.toLowerCase().includes(f))||((_=B.instructor)==null?void 0:_.displayName.toLowerCase().includes(f))})}return l},[t,p,u]);if(v)return e.jsxs("div",{className:s.cn("space-y-4",S),style:z,children:[e.jsx(s.Skeleton,{className:"h-9 w-full"}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:Array.from({length:6}).map((l,f)=>e.jsx(s.Skeleton,{className:"h-64 w-full rounded-lg"},f))})]});if(h)return e.jsx("div",{className:s.cn("py-12",S),style:z,children:e.jsx(s.EmptyState,{icon:e.jsx(C.AlertCircle,{className:"size-10 text-destructive"}),title:"Something went wrong",description:h,action:b?e.jsx(s.Button,{variant:"outline",onClick:b,children:"Retry"}):void 0})});const R=o&&g?T.slice((k-1)*g,k*g):T;return e.jsxs("div",{className:S,style:z,children:[e.jsxs("div",{className:"flex gap-2 items-center mb-2",children:[m&&e.jsx("div",{className:"flex-1 max-w-80",children:e.jsx(s.SearchInput,{value:u,onChange:L,placeholder:"Search courses...",size:"small"})}),i&&e.jsxs("div",{className:"flex gap-0.5",children:[e.jsxs(s.Tooltip,{children:[e.jsx(s.TooltipTrigger,{children:e.jsx(s.Button,{variant:"ghost",size:"icon-xs","aria-label":"Grid view",className:s.cn(x==="grid"&&"text-primary"),onClick:()=>w("grid"),children:e.jsx(C.Grid,{size:18})})}),e.jsx(s.TooltipContent,{children:"Grid view"})]}),e.jsxs(s.Tooltip,{children:[e.jsx(s.TooltipTrigger,{children:e.jsx(s.Button,{variant:"ghost",size:"icon-xs","aria-label":"List view",className:s.cn(x==="list"&&"text-primary"),onClick:()=>w("list"),children:e.jsx(C.List,{size:18})})}),e.jsx(s.TooltipContent,{children:"List view"})]})]})]}),n&&n.length>0&&e.jsx(s.Tabs,{value:p??"all",onValueChange:l=>A(l==="all"?null:l),className:"mb-2",children:e.jsxs(s.TabsList,{children:[e.jsx(s.TabsTrigger,{value:"all",children:"All"}),n.map(l=>e.jsx(s.TabsTrigger,{value:l.uid,children:l.label},l.uid))]})}),T.length===0?e.jsx(s.EmptyState,{icon:e.jsx(C.GraduationCap,{}),title:a,description:"Try adjusting your search or filter."}):x==="grid"?e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:R.map(l=>e.jsx(s.CourseCard,{uid:l.uid,title:l.title,description:l.description,thumbnailUrl:l.thumbnailUrl,instructor:l.instructor,progress:l.progress,enrollmentStatus:l.enrollmentStatus,studentCount:l.studentCount,duration:l.duration,layout:"vertical",onClick:N?void 0:()=>r(l),onEnroll:d&&!N?()=>d(l):void 0,className:s.cn(N&&"opacity-70")},l.uid))}):e.jsx("div",{className:"flex flex-col gap-2",children:R.map(l=>e.jsx(s.CourseCard,{uid:l.uid,title:l.title,description:l.description,thumbnailUrl:l.thumbnailUrl,instructor:l.instructor,progress:l.progress,enrollmentStatus:l.enrollmentStatus,studentCount:l.studentCount,duration:l.duration,layout:"horizontal",onClick:N?void 0:()=>r(l),onEnroll:d&&!N?()=>d(l):void 0,className:s.cn(N&&"opacity-70")},l.uid))}),o&&g&&T.length>0&&e.jsx(s.Pagination,{currentPage:k,totalPages:Math.ceil((y??T.length)/g),onPageChange:o,className:"mt-4"})]})}function ts({student:t,enrolledCourses:n=[],achievements:r=[],certificates:d=[],stats:j,showCourses:i=!0,showAchievements:m=!0,onCourseClick:a,onCertificateClick:N,readOnly:v=!1,isLoading:h,error:b,onRetry:g,className:k,style:y}){const o=n.filter(u=>u.progress>=100),S=[{label:"Enrolled",value:String(n.length),icon:e.jsx(C.BookOpen,{size:24})},{label:"Completed",value:String(o.length),icon:e.jsx(C.GraduationCap,{size:24})}],z=j??S;return e.jsx(H,{isLoading:h,error:b,onRetry:g,className:k,style:y,skeleton:e.jsxs(e.Fragment,{children:[e.jsx(s.Card,{children:e.jsxs(s.CardContent,{className:"p-4 flex items-center gap-4",children:[e.jsx(s.Skeleton,{className:"size-12 rounded-full"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx(s.Skeleton,{className:"h-5 w-40"}),e.jsx(s.Skeleton,{className:"h-4 w-56"})]})]})}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[e.jsx(s.Skeleton,{className:"h-24"}),e.jsx(s.Skeleton,{className:"h-24"}),e.jsx(s.Skeleton,{className:"h-24"}),e.jsx(s.Skeleton,{className:"h-24"})]}),e.jsx(s.Skeleton,{className:"h-8 w-full"}),e.jsx(s.Skeleton,{className:"h-8 w-full"}),e.jsx(s.Skeleton,{className:"h-8 w-full"})]}),children:e.jsxs("div",{className:s.cn("space-y-4",k),style:y,children:[e.jsx(s.Card,{children:e.jsxs(s.CardContent,{className:"p-4 flex items-start gap-4",children:[e.jsx(s.UserAvatar,{displayName:t.displayName,avatarUrl:t.avatarUrl,size:"large"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h2",{className:"text-xl font-bold text-foreground",children:t.displayName}),t.role&&e.jsx(s.Badge,{variant:"secondary",children:t.role})]}),t.email&&e.jsx("p",{className:"text-sm text-muted-foreground",children:t.email}),t.bio&&e.jsx("p",{className:"text-sm text-foreground mt-1",children:t.bio}),t.joinedAt&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-1 flex items-center gap-1",children:[e.jsx(C.Calendar,{size:12}),"Joined ",new Date(t.joinedAt).toLocaleDateString()]})]})]})}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:z.map(u=>e.jsx(s.StatCard,{icon:u.icon,label:u.label,value:u.value},u.label))}),i&&e.jsxs(e.Fragment,{children:[e.jsx(s.Separator,{}),e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("p",{className:"text-lg font-semibold text-foreground",children:"Enrolled Courses"}),e.jsx(s.Badge,{variant:"secondary",children:n.length})]}),n.length>0?e.jsx(s.Card,{children:e.jsx(s.CardContent,{className:"p-0 divide-y divide-border",children:n.map(u=>e.jsxs("div",{className:s.cn("flex items-center gap-3 px-4 py-3 transition-colors",!v&&a&&"cursor-pointer hover:bg-muted/50"),onClick:!v&&a?()=>a(u.uid):void 0,children:[e.jsx(s.ProgressRing,{value:u.progress,size:32,strokeWidth:3}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:u.title}),u.lastAccessedAt&&e.jsx("p",{className:"text-xs text-muted-foreground",children:s.formatTimestamp(u.lastAccessedAt)})]}),e.jsxs("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:[Math.round(u.progress),"%"]})]},u.uid))})}):e.jsx(s.EmptyState,{icon:e.jsx(C.BookOpen,{}),title:"No courses yet",description:"This student has not enrolled in any courses."})]}),m&&e.jsxs(e.Fragment,{children:[e.jsx(s.Separator,{}),e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("p",{className:"text-lg font-semibold text-foreground",children:"Achievements"}),e.jsx(s.Badge,{variant:"secondary",children:r.length})]}),r.length>0?e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-2",children:r.map(u=>e.jsx(s.AchievementBadge,{title:u.name,description:u.description,icon:u.iconUrl?e.jsx("img",{src:u.iconUrl,alt:u.name,className:"w-12 h-12"}):void 0,earnedDate:u.earnedAt},u.uid))}):e.jsx(s.EmptyState,{icon:e.jsx(C.Award,{}),title:"No achievements yet",description:"Achievements will appear here as they are earned."})]}),e.jsx(s.Separator,{}),e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("p",{className:"text-lg font-semibold text-foreground",children:"Certificates"}),e.jsx(s.Badge,{variant:"secondary",children:d.length})]}),d.length>0?e.jsx(s.Card,{children:e.jsx(s.CardContent,{className:"p-0 divide-y divide-border",children:d.map(u=>e.jsxs("div",{className:s.cn("flex items-center gap-3 px-4 py-3 transition-colors",!v&&N&&"cursor-pointer hover:bg-muted/50"),onClick:!v&&N?()=>N(u.uid):void 0,children:[e.jsx("div",{className:"w-9 h-9 rounded-lg bg-primary/10 flex items-center justify-center text-primary",children:e.jsx(C.Award,{size:20})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:u.courseName}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Issued ",new Date(u.issuedAt).toLocaleDateString()]})]}),u.certificateUrl&&!v&&e.jsx(s.Button,{variant:"outline",size:"sm",onClick:L=>{L.stopPropagation(),window.open(u.certificateUrl,"_blank")},children:"View"})]},u.uid))})}):e.jsx(s.EmptyState,{icon:e.jsx(C.GraduationCap,{}),title:"No certificates yet",description:"Certificates will appear here once courses are completed."})]})})}exports.AnnouncementFeed=Be;exports.AssessmentReview=ke;exports.AssignmentSubmission=Le;exports.CertificateViewer=Ze;exports.CourseCatalog=ss;exports.CourseOutline=Se;exports.DiscussionThread=Re;exports.EnrollmentWizard=es;exports.ExamSession=Ae;exports.FlashcardStudySession=be;exports.ForumBoard=Ke;exports.GradebookTable=Ue;exports.LecturePlayer=ve;exports.LessonPage=ze;exports.PracticeQuiz=ye;exports.ProgressDashboard=De;exports.QuizSession=Ne;exports.RequirementsChecklist=Xe;exports.RubricView=Ye;exports.SectionShell=H;exports.StudentProfile=ts;exports.SurveyForm=Te;exports.flattenLeaves=J;exports.mergeSessionAnswers=re;