PageSourceSearch

https://tokenstocks.ai/assets/CourseView-D-mcswZZ.js

js tokenstocks.ai collected 2026-10-05 15:25:24 UTC 54,856 bytes, 60 lines download raw bytes

1import{c as Q,r,j as e,C as y,v as me,y as R,B as w,ae as Pe,x as Ne,a as ee,af as ve,ag as ye,n as xe,ah as Ee,w as Re,Z as Oe,ac as ue,ad as he,ai as Fe,U as _e,s as we,h as oe,L as He,aj as Be,ak as Ce,k as Qe,f as Ue,l as de,H as qe,T as Ve,al as Ae,q as Je,a9 as $e,G as Ke,E as Ge,am as We}from"./index-CT3mG8No.js";import{S as Xe}from"./SEOFooter-ChKYDnbu.js";import{T as Ie}from"./timer-hF13M3Ad.js";import{R as ke,T as De}from"./textarea-CrN_Hc0e.js";import{L as pe}from"./lightbulb-DIiM8qE_.js";import{T as Ye}from"./thumbs-up-CNC_HQ1x.js";import{T as Ze}from"./trash-2-BGwCMA8T.js";import{D as ze}from"./download-Cfh60q84.js";import{F as ge}from"./flame-BIEOP9Uk.js";import{P as es}from"./pause-DUE6GJhl.js";import{A as fe}from"./arrow-left-C0WNe__n.js";import{L as ss}from"./layers-CPOp1srd.js";import"./twitter-CEJiaCmz.js";import"./mail-qvsh7bQ8.js";/**
2 * @license lucide-react v0.462.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const Te=Q("Bookmark",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]]);/**
7 * @license lucide-react v0.462.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const ts=Q("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
12 * @license lucide-react v0.462.0 - ISC
13 *
14 * This source code is licensed under the ISC license.
15 * See the LICENSE file in the root directory of this source tree.
16 */const as=Q("Flag",[["path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z",key:"i9b6wo"}],["line",{x1:"4",x2:"4",y1:"22",y2:"15",key:"1cm3nv"}]]);/**
17 * @license lucide-react v0.462.0 - ISC
18 *
19 * This source code is licensed under the ISC license.
20 * See the LICENSE file in the root directory of this source tree.
21 */const rs=Q("Headphones",[["path",{d:"M3 14h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-7a9 9 0 0 1 18 0v7a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3",key:"1xhozi"}]]);/**
22 * @license lucide-react v0.462.0 - ISC
23 *
24 * This source code is licensed under the ISC license.
25 * See the LICENSE file in the root directory of this source tree.
26 */const ns=Q("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/**
27 * @license lucide-react v0.462.0 - ISC
28 *
29 * This source code is licensed under the ISC license.
30 * See the LICENSE file in the root directory of this source tree.
31 */const Me=Q("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/**
32 * @license lucide-react v0.462.0 - ISC
33 *
34 * This source code is licensed under the ISC license.
35 * See the LICENSE file in the root directory of this source tree.
36 */const ls=Q("SkipBack",[["polygon",{points:"19 20 9 12 19 4 19 20",key:"o2sva"}],["line",{x1:"5",x2:"5",y1:"19",y2:"5",key:"1ocqjk"}]]);/**
37 * @license lucide-react v0.462.0 - ISC
38 *
39 * This source code is licensed under the ISC license.
40 * See the LICENSE file in the root directory of this source tree.
41 */const is=Q("SkipForward",[["polygon",{points:"5 4 15 12 5 20 5 4",key:"16p6eg"}],["line",{x1:"19",x2:"19",y1:"5",y2:"19",key:"futhcm"}]]);/**
42 * @license lucide-react v0.462.0 - ISC
43 *
44 * This source code is licensed under the ISC license.
45 * See the LICENSE file in the root directory of this source tree.
46 */const cs=Q("StickyNote",[["path",{d:"M16 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8Z",key:"qazsjp"}],["path",{d:"M15 3v4a2 2 0 0 0 2 2h4",key:"40519r"}]]);/**
47 * @license lucide-react v0.462.0 - ISC
48 *
49 * This source code is licensed under the ISC license.
50 * See the LICENSE file in the root directory of this source tree.
51 */const os=Q("Volume2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]);/**
52 * @license lucide-react v0.462.0 - ISC
53 *
54 * This source code is licensed under the ISC license.
55 * See the LICENSE file in the root directory of this source tree.
56 */const ds=Q("VolumeX",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]]),ms=[{value:"guessing",label:"Guessing",icon:e.jsx(as,{className:"h-3 w-3"}),color:"bg-rose-500/20 text-rose-400 border-rose-500/30"},{value:"somewhat",label:"Somewhat Sure",icon:e.jsx(Re,{className:"h-3 w-3"}
56),color:"bg-amber-500/20 text-amber-400 border-amber-500/30"},{value:"confident",label:"Confident",icon:e.jsx(Ye,{className:"h-3 w-3"}),color:"bg-blue-500/20 text-blue-400 border-blue-500/30"},{value:"certain",label:"Certain",icon:e.jsx(Oe,{className:"h-3 w-3"}),color:"bg-emerald-500/20 text-emerald-400 border-emerald-500/30"}];function xs({questions:n,moduleTitle:l,moduleId:a,onComplete:j,requireMastery:x=!0,masteryThreshold:h=70}){const[s,d]=r.useState("intro"),[o,p]=r.useState(0),[u,k]=r.useState({}),[v,$]=r.useState({}),[A,S]=r.useState(new Set),[N,C]=r.useState(!1),[D,O]=r.useState(0),[P,g]=r.useState(0),[z,se]=r.useState(!1),I=n[o],B=u[o]!==void 0,G=u[o]===(I==null?void 0:I.correctIndex),te=60;r.useEffect(()=>{if(!z||s!=="answering")return;const c=setInterval(()=>{g(t=>t<=1?(B||k(m=>({...m,[o]:-1})),C(!0),0):t-1)},1e3);return()=>clearInterval(c)},[z,s,o,B]);const f=r.useMemo(()=>{const c=n.filter((K,Y)=>u[Y]===K.correctIndex).length,t=n.length,m=Math.round(c/t*100),M=Math.round((Date.now()-D)/1e3),L=n.filter((K,Y)=>u[Y]===K.correctIndex&&(v[Y]==="confident"||v[Y]==="certain")).length,T=Object.values(v).filter(K=>K==="confident"||K==="certain").length,re=T>0?Math.round(L/T*100):0;let U,q,V;m>=90?(U="A+",q="text-emerald-400",V="Outstanding! You've demonstrated mastery of this material."):m>=80?(U="A",q="text-emerald-400",V="Excellent work! Strong understanding demonstrated."):m>=70?(U="B",q="text-blue-400",V="Good job! Review the flagged concepts for complete mastery."):m>=60?(U="C",q="text-amber-400",V="Passing score. Consider revisiting the material."):m>=50?(U="D",q="text-orange-400",V="Below mastery threshold. Re-read the module content."):(U="F",q="text-rose-400",V="Additional study required. Review all sections carefully.");const ce=m>=h;return{correct:c,total:t,percentage:m,grade:U,gradeColor:q,message:V,timeSpent:M,calibration:re,passed:ce}},[n,u,v,D,h]),W=r.useCallback(c=>{se(c),d("answering"),O(Date.now()),c&&g(te)},[]),J=c=>{s==="completed"||N||k(t=>({...t,[o]:c}))},le=()=>{B&&C(!0)},ae=()=>{C(!1),o<n.length-1?(p(c=>c+1),z&&g(te)):(d("completed"),j==null||j(f.correct,f.total,f.timeSpent))},X=()=>{k({}),$({}),S(new Set),p(0),d("intro"),C(!1)},F=()=>{S(c=>{const t=new Set(c);return t.has(o)?t.delete(o):t.add(o),t})};return n.length===0?null:s==="intro"?e.jsx(y,{className:"p-6 border-primary/30 bg-gradient-to-br from-primary/5 to-transparent",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-full bg-primary/20 flex items-center justify-center",children:e.jsx(me,{className:"h-8 w-8 text-primary"})}),e.jsx("h3",{className:"text-xl font-bold mb-2",children:"Knowledge Assessment"}),l&&e.jsx("p",{className:"text-muted-foreground mb-1",children:l}),e.jsxs("p",{className:"text-sm text-muted-foreground mb-6",children:[n.length," questions • ",x?`${h}% required to pass`:"Practice mode"]}),e.jsxs(y,{className:"p-4 mb-6 bg-muted/30 text-left",children:[e.jsx("h4",{className:"font-semibold text-sm mb-2",children:"Assessment Features"}),e.jsxs("ul",{className:"space-y-1 text-sm text-muted-foreground",children:[e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(R,{className:"h-3 w-3 text-emerald-500"})," Instant feedback with explanations"]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(R,{className:"h-3 w-3 text-emerald-500"})," Confidence calibration tracking"]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(R,{className:"h-3 w-3 text-emerald-500"})," Bookmark questions for review"]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(R,{className:"h-3 w-3 text-emerald-500"})," Detailed performance analytics"]})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 justify-center",children:[e.jsxs(w,{variant:"outline",onClick:()=>W(!1),className:"flex-1",children:[e.jsx(me,{className:"h-4 w-4 mr-2"}),"Practice Mode"]}),e.jsxs(w,{onClick:()=>W(!0),className:"flex-1",children:[e.jsx(Ie,{className:"h-4 w-4 mr-2"}),"Timed Assessment (",te,"s/question)"]})]})]})}):s==="completed"?e.jsx(y,{className:"p-6 border-primary/30 bg-gradient-to-br from-primary/5 to-transparent",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:`w-20 h-20 mx-auto mb-4 rounded-full flex items-center justify-center ${f.passed?"bg-emerald-500/20":"bg-rose-500/20"}`,children:f.passed?e.jsx(Pe,{className:"h-10 w-10 text-emerald-400"}):e.jsx(Ne,{className:"h-10 w-10 text-rose-400"})}),e.jsx("h3",{className:"text-2xl font-bold mb-2",children:f.passed?"Assessment Passed!":"Assessment Complete"}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3 mb-6",children:[e.jsxs(y,{className:"p-3 bg-muted/30",children:[e.jsxs("p",{className:"text-2xl font-bold text-primary",children:[f.correct,"/",f.total]}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Correct"})]}),e.jsxs(y,{className:"p-3 bg-muted/30",children:[e.jsxs("p",{className:`text-2xl font-bold ${f.gradeColor}`,children:[f.percentage,"%"]}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Score"})]}),e.jsxs(y,{className:"p-3 bg-muted/30",children:[e.jsx("p",{className:`text-2xl font-bold ${f.gradeColor}`,children:f.grade}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Grade"})]}),e.jsxs(y,{className:"p-3 bg-muted/30",children:[e.jsxs("p",{className:"text-2xl font-bold text-blue-400",children:[f.calibration,"%"]}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Calibration"})]})]}),e.jsxs(y,{className:`p-4 mb-6 ${f.passed?"bg-emerald-500/10 border-emerald-500/30":"bg-amber-500/10 border-amber-500/30"}`,children:[e.jsx("p",{className:`font-medium text-sm ${f.passed?"text-emerald-400":"text-amber-400"}`,children:f.message}),f.calibration>0&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:["Confidence calibration: ",f.calibration,"% of confident answers were correct"]})]}),A.size>0&&e.jsxs(y,{className:"p-4 mb-6 bg-amber-500/10 border-amber-500/30 text-left",children:[e.jsxs("h4",{className:"font-semibold text-sm text-amber-400 mb-2 flex items-center gap-2",children:[e.jsx(Te,{className:"h-4 w-4"}),"Flagged for Review (",A.size,")"]}),e.jsx("ul",{className:"text-sm text-muted-foreground space-y-1",children:Array.from(A).map(c=>e.jsxs("li",{children:["Q",c+1,": ",n[c].topic||n[c].question.slice(0,50),"..."]},c))})]}),e.jsxs("p",{className:"text-xs text-muted-foreground mb-6",children:["Time spent: ",Math.floor(f.timeSpent/60),"m ",f.timeSpent%60,"s • Avg: ",Math.round(f.timeSpent/n.length),"s/question"]}),e.jsxs("div",{className:"flex flex-wrap gap-3 justify-center",children:[e.jsxs(w,{variant:"outline",onClick:()=>{d("reviewing"),p(0),C(!0)},children:[e.jsx(Ne,{className:"h-4 w-4 mr-2"}),"Review Answers"]}),e.jsxs(w,{onClick:X,children:[e.jsx(ke,{className:"h-4 w-4 mr-2"}),f.passed?"Retake Quiz":"Try Again"]})]}),!f.passed&&x&&e.jsxs("p",{className:"text-xs text-rose-400 mt-4",children:["You need ",h,"% to unlock the next module. Current: ",f.percentage,"%"]})]})}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[e.jsxs("h2",{className:"text-lg font-bold flex items-center gap-2",children:[e.jsx(me,{className:"h-5 w-5 text-primary"}),s==="reviewing"?"Review Mode":"Knowledge Assessment"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[z&&s==="answering"&&!N&&e.jsxs(ee,{variant:P<15?"destructive":"outline",className:"font-mono",children:[e.jsx(Ie,{className:"h-3 w-3 mr-1"}),P,"s"]}),e.jsxs(ee,{variant:"outline",className:"bg-primary/10",children:[o+1," / ",n.length]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(ve,{value:(o+(N?1:0))/n.length*100,className:"h-2"}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[e.jsxs("span",{children:[Math.round((o+(N?1:0))/n.length*100),"% Complete"]}),A.size>0&&e.jsxs("span",{className:"text-amber-400",children:[A.size," bookmarked"]})]})]}),e.jsxs(y,{className:"p-5",children:[e.jsxs("div",{className:"flex items-start justify-between mb-4 gap-2",children:[e.jsxs("div",{className:"flex-1",children:[I.topic&&e.jsx(ee,{variant:"outline",className:"mb-2 text-[10px]",children:I.topic}),e.jsxs("p",{className:"text-base font-semibold leading-relaxed",children:["Q",o+1,". ",I.question]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[I.difficulty&&e.jsx(ee,{className:`text-[10px] ${I.difficulty==="easy"?"bg-emerald-500/20 text-emerald-400":I.difficulty==="medium"?"bg-amber-500/20 text-amber-400":"bg-rose-500/20 text-rose-400"}`,children:I.difficulty}),e.jsx(w,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:F,children:e.jsx(Te,{className:`h-4 w-4 ${A.has(o)?"fill-amber-400 text-amber-400":""}`})})]})]}),e.jsx("div",{className:"space-y-2 mb-4",children:I.options.map((c,t)=>{const m=u[o]===t,M=t===I.correctIndex,L=N;let T="bg-muted/30 border-border/50 hover:bg-muted/50 hover:border-primary/30";return L?M?T="bg-emerald-500/20 border-emerald-500/50":m&&!M?T="bg-rose-500/20 border-rose-500/50":T="bg-muted/20 border-border/30 opacity-60":m&&(T="bg-primary/20 border-primary/50 ring-1 ring-primary/30"),e.jsxs("button",{onClick:()=>!L&&J(t),disabled:L,className:`w-full text-left px-4 py-3 rounded-lg border transition-all flex items-center gap-3 ${T}`,children:[e.jsx("span",{className:`w-7 h-7 rounded-full border flex items-center justify-center text-sm font-medium shrink-0 ${L&&M?"bg-emerald-500 border-emerald-500 text-white":L&&m&&!M?"bg-rose-500 border-rose-500 text-white":m?"bg-primary border-primary text-primary-foreground":"border-muted-foreground
56/30"}`,children:L?M?e.jsx(R,{className:"h-4 w-4"}):m?e.jsx(ye,{className:"h-4 w-4"}):String.fromCharCode(65+t):String.fromCharCode(65+t)}),e.jsx("span",{className:"flex-1 text-sm",children:c})]},t)})}),B&&!N&&s==="answering"&&e.jsxs("div",{className:"mb-4",children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"How confident are you?"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:ms.map(c=>e.jsxs("button",{onClick:()=>$(t=>({...t,[o]:c.value})),className:`px-3 py-1.5 rounded-full text-xs border flex items-center gap-1.5 transition-all ${v[o]===c.value?c.color:"bg-muted/30 border-border/50 hover:border-primary/30"}`,children:[c.icon,c.label]},c.value))})]}),B&&!N&&s==="answering"&&e.jsxs(w,{onClick:le,className:"w-full",children:["Confirm Answer",e.jsx(xe,{className:"h-4 w-4 ml-1"})]}),N&&e.jsx(y,{className:`p-4 ${G?"bg-emerald-500/10 border-emerald-500/30":"bg-amber-500/10 border-amber-500/30"}`,children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(pe,{className:`h-5 w-5 mt-0.5 shrink-0 ${G?"text-emerald-400":"text-amber-400"}`}),e.jsxs("div",{children:[e.jsx("p",{className:`font-semibold text-sm mb-1 ${G?"text-emerald-400":"text-amber-400"}`,children:u[o]===-1?"Time's up!":G?"Correct!":"Incorrect"}),e.jsx("p",{className:"text-sm text-foreground/80",children:I.explanation})]})]})})]}),N&&e.jsxs("div",{className:"flex justify-between",children:[s==="reviewing"&&o>0&&e.jsx(w,{variant:"outline",onClick:()=>p(c=>c-1),children:"Previous"}),e.jsx("div",{className:"ml-auto",children:s==="reviewing"?o<n.length-1?e.jsxs(w,{onClick:()=>p(c=>c+1),children:["Next ",e.jsx(xe,{className:"h-4 w-4 ml-1"})]}):e.jsxs(w,{onClick:X,children:[e.jsx(ke,{className:"h-4 w-4 mr-2"})," Retake"]}):e.jsx(w,{onClick:ae,children:o<n.length-1?e.jsxs(e.Fragment,{children:["Next Question ",e.jsx(xe,{className:"h-4 w-4 ml-1"})]}):e.jsxs(e.Fragment,{children:[e.jsx(Ee,{className:"h-4 w-4 mr-2"})," See Results"]})})})]}),s==="answering"&&Object.keys(u).filter(c=>N||parseInt(c)<o).length>0&&e.jsxs("div",{className:"flex items-center justify-center gap-4 text-xs text-muted-foreground pt-2",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(R,{className:"h-3 w-3 text-emerald-500"}),Object.entries(u).filter(([c])=>parseInt(c)<o).filter(([c,t])=>{var m;return t===((m=n[parseInt(c)])==null?void 0:m.correctIndex)}).length]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ye,{className:"h-3 w-3 text-rose-500"}),Object.entries(u).filter(([c])=>parseInt(c)<o).filter(([c,t])=>{var m;return t!==((m=n[parseInt(c)])==null?void 0:m.correctIndex)}).length]})]})]})}function us({question:n,options:l,correctIndex:a,explanation:j,topic:x,sectionTitle:h}){const[s,d]=r.useState(!1),[o,p]=r.useState(null),[u,k]=r.useState(!1),v=o===a,$=N=>{u||p(N)},A=()=>{o!==null&&k(!0)},S=()=>{p(null),k(!1)};return e.jsxs(y,{className:"border-blue-500/30 bg-blue-500/5 my-6 overflow-hidden",children:[e.jsxs("button",{onClick:()=>d(!s),className:"w-full p-4 flex items-center justify-between hover:bg-blue-500/10 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-blue-500/20",children:e.jsx(me,{className:"h-4 w-4 text-blue-400"})}),e.jsxs("div",{className:"text-left",children:[e.jsx("p",{className:"text-sm font-semibold text-blue-400",children:"Quick Knowledge Check"}),x&&e.jsx("p",{className:"text-xs text-muted-foreground",children:x})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[u&&e.jsx(ee,{className:v?"bg-emerald-500/20 text-emerald-400":"bg-rose-500/20 text-rose-400",children:v?"Correct!":"Review Needed"}),s?e.jsx(ue,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(he,{className:"h-4 w-4 text-muted-foreground"})]})]}),s&&e.jsxs("div",{className:"px-4 pb-4 space-y-4",children:[e.jsx("p",{className:"text-sm font-medium",children:n}),e.jsx("div",{className:"space-y-2",children:l.map((N,C)=>{const D=o===C,O=C===a;let P="border-border/50 hover:border-blue-500/50 hover:bg-blue-500/5";return u?O?P="border-emerald-500/50 bg-emerald-500/10":D&&!O?P="border-rose-500/50 bg-rose-500/10":P="border-border/30 opacity-50":D&&(P="border-blue-500/50 bg-blue-500/10 ring-1 ring-blue-500/30"),e.jsxs("button",{onClick:()=>$(C),disabled:u,className:`w-full text-left px-3 py-2 rounded-lg border text-sm transition-all flex items-center gap-2 ${P}`,children:[e.jsx("span",{className:`w-5 h-5 rounded-full border flex items-center justify-center text-xs font-medium shrink-0 ${u&&O?"bg-emerald-500 border-emerald-500 text-white":u&&D&&!O?"bg-rose-500 border-rose-500 text-white":D?"bg-blue-500 border-blue-500 text-white":"border-muted-foreground
56/30"}`,children:u?O?e.jsx(R,{className:"h-3 w-3"}):D?e.jsx(ye,{className:"h-3 w-3"}):String.fromCharCode(65+C):String.fromCharCode(65+C)}),e.jsx("span",{children:N})]},C)})}),!u&&o!==null&&e.jsx(w,{size:"sm",onClick:A,className:"w-full",children:"Check Answer"}),u&&e.jsx(y,{className:`p-3 ${v?"bg-emerald-500/10 border-emerald-500/30":"bg-amber-500/10 border-amber-500/30"}`,children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(pe,{className:`h-4 w-4 mt-0.5 shrink-0 ${v?"text-emerald-400":"text-amber-400"}`}),e.jsx("p",{className:"text-xs text-foreground/80",children:j})]})}),u&&e.jsx(w,{size:"sm",variant:"ghost",onClick:S,className:"w-full text-muted-foreground",children:"Try Again"})]})]})}function hs({question:n,context:l,sampleResponses:a,moduleId:j,promptId:x}){const[h,s]=r.useState(!1),[d,o]=r.useState(""),[p,u]=r.useState(!1),[k,v]=r.useState(!1);r.useState(()=>{if(j&&x){const A=localStorage.getItem(`discussion-${j}-${x}`);A&&(o(A),u(!0))}});const $=()=>{j&&x&&d.trim()&&(localStorage.setItem(`discussion-${j}-${x}`,d),u(!0))};return e.jsxs(y,{className:"border-purple-500/30 bg-purple-500/5 my-6 overflow-hidden",children:[e.jsxs("button",{onClick:()=>s(!h),className:"w-full p-4 flex items-center justify-between hover:bg-purple-500/10 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-purple-500/20",children:e.jsx(Fe,{className:"h-4 w-4 text-purple-400"})}),e.jsxs("div",{className:"text-left",children:[e.jsx("p",{className:"text-sm font-semibold text-purple-400",children:"Case Discussion"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"HBS-Style Critical Thinking Exercise"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[p&&e.jsxs(ee,{className:"bg-emerald-500/20 text-emerald-400 text-[10px]",children:[e.jsx(R,{className:"h-3 w-3 mr-1"}),"Saved"]}),h?e.jsx(ue,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(he,{className:"h-4 w-4 text-muted-foreground"})]})]}),h&&e.jsxs("div",{className:"px-4 pb-4 space-y-4",children:[l&&e.jsx(y,{className:"p-3 bg-muted/30",children:e.jsx("p",{className:"text-xs text-muted-foreground italic",children:l})}),e.jsx("div",{className:"border-l-2 border-purple-500 pl-4",children:e.jsx("p",{className:"text-sm font-medium",children:n})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(De,{placeholder:"Write your analysis and reasoning here. Consider multiple perspectives and support your argument with evidence from the material...",value:d,onChange:A=>{o(A.target.value),u(!1)},className:"min-h-[120px] text-sm bg-background/50"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("p",{className:"text-xs text-muted-foreground",children:[d.length," characters • ",d.split(/\s+/).filter(Boolean).length," words"]}),e.jsxs(w,{size:"sm",onClick:$,disabled:!d.trim()||p,children:[e.jsx(Me,{className:"h-3 w-3 mr-1"}),p?"Saved":"Save Response"]})]})]}),a&&a.length>0&&e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>v(!k),className:"flex items-center gap-2 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[e.jsx(_e,{className:"h-3 w-3"}),"View example perspectives (",a.length,")",k?e.jsx(ue,{className:"h-3 w-3"}):e.jsx(he,{className:"h-3 w-3"})]}),k&&e.jsx("div",{className:"mt-3 space-y-3",children:a.map((A,S)=>e.jsx(y,{className:"p-3 bg-muted/20 border-muted/30",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(pe,{className:"h-4 w-4 text-amber-400 mt-0.5 shrink-0"}),e.jsxs("div",{children:[e.jsxs("p",{className:"text-[10px] text-amber-400 font-medium mb-1",children:["Perspective ",S+1]}),e.jsx("p",{className:"text-xs text-foreground/80",children:A})]})]})},S))})]})]})]})}function ps({moduleId:n,moduleTitle:l,courseSlug:a}){const[j,x]=r.useState(!1),[h,s]=r.useState(""),[d,o]=r.useState(!0),[p,u]=r.useState(null),k=`notes-${a}-${n}`;r.useEffect(()=>{const S=localStorage.getItem(k);if(S){const N=JSON.parse(S);s(N.content||""),u(N.savedAt?new Date(N.savedAt):null)}},[k]);const v=()=>{localStorage.setItem(k,JSON.stringify({content:h,savedAt:new Date().toISOString(),moduleTitle:l})),o(!0),u(new Date)},$=()=>{confirm("Clear all notes for this module?")&&(s(""),localStorage.removeItem(k),u(null))},A=()=>{const S=new Blob([`# ${l}
57
58${h}`],{type:"text/markdown"}),N=URL.createObjectURL(S),C=document.createElement("a");C.href=N,C.download=`${l.replace(/\s+/g,"-").toLowerCase()}-notes.md`,C.click(),URL.revokeObjectURL(N)};return e.jsxs(y,{className:"border-amber-500/30 bg-amber-500/5 overflow-hidden",children:[e.jsxs("button",{onClick:()=>x(!j),className:"w-full p-3 flex items-center justify-between hover:bg-amber-500/10 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(cs,{className:"h-4 w-4 text-amber-400"}),e.jsx("span",{className:"text-sm font-medium text-amber-400",children:"My Notes"}),h.length>0&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",h.split(/\s+/).filter(
58Boolean).length," words)"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[!d&&e.jsx("span",{className:"text-xs text-amber-400",children:"Unsaved"}),d&&h.length>0&&e.jsx(R,{className:"h-3 w-3 text-emerald-500"}),j?e.jsx(ue,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(he,{className:"h-4 w-4 text-muted-foreground"})]})]}),j&&e.jsxs("div",{className:"px-3 pb-3 space-y-3",children:[e.jsx(De,{placeholder:"Take notes as you learn. Capture key insights, questions, and personal reflections...",value:h,onChange:S=>{s(S.target.value),o(!1)},className:"min-h-[150px] text-sm bg-background/50 resize-y"}),e.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:p&&e.jsxs("span",{children:["Last saved: ",p.toLocaleTimeString()]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[h.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs(w,{size:"sm",variant:"ghost",onClick:$,className:"text-muted-foreground h-8",children:[e.jsx(Ze,{className:"h-3 w-3 mr-1"}),"Clear"]}),e.jsxs(w,{size:"sm",variant:"ghost",onClick:A,className:"text-muted-foreground h-8",children:[e.jsx(ze,{className:"h-3 w-3 mr-1"}),"Export"]})]}),e.jsxs(w,{size:"sm",onClick:v,disabled:d||!h.trim(),className:"h-8",children:[e.jsx(Me,{className:"h-3 w-3 mr-1"}),"Save"]})]})]})]})]})}function gs({compact:n=!1}){const[l,a]=r.useState({currentStreak:0,longestStreak:0,lastActiveDate:"",weekActivity:Array(7).fill(!1),totalDaysActive:0});r.useEffect(()=>{const d=localStorage.getItem("learning-streak-data"),o=new Date().toDateString();if(d){const p=JSON.parse(d),u=new Date(p.lastActiveDate),k=Math.floor((Date.now()-u.getTime())/864e5);if(k===0)a(p);else if(k===1){const v={currentStreak:p.currentStreak+1,longestStreak:Math.max(p.longestStreak,p.currentStreak+1),lastActiveDate:o,weekActivity:[...p.weekActivity.slice(1),!0],totalDaysActive:p.totalDaysActive+1};localStorage.setItem("learning-streak-data",JSON.stringify(v)),a(v)}else{const v={currentStreak:1,longestStreak:p.longestStreak,lastActiveDate:o,weekActivity:[...Array(6).fill(!1),!0],totalDaysActive:p.totalDaysActive+1};localStorage.setItem("learning-streak-data",JSON.stringify(v)),a(v)}}else{const p={currentStreak:1,longestStreak:1,lastActiveDate:o,weekActivity:[...Array(6).fill(!1),!0],totalDaysActive:1};localStorage.setItem("learning-streak-data",JSON.stringify(p)),a(p)}},[]);const j=["M","T","W","T","F","S","S"],h=[7,14,30,60,100].find(d=>d>l.currentStreak)||100,s=l.currentStreak/h*100;return n?e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-lg bg-orange-500/10 border border-orange-500/30",children:[e.jsx(ge,{className:`h-4 w-4 ${l.currentStreak>0?"text-orange-400 animate-pulse":"text-muted-foreground"}`}),e.jsx("span",{className:"text-sm font-bold text-orange-400",children:l.currentStreak}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"day streak"})]}):e.jsxs(y,{className:"p-4 border-orange-500/20 bg-gradient-to-br from-orange-500/5 to-transparent",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"p-2 rounded-lg bg-orange-500/20",children:e.jsx(ge,{className:`h-5 w-5 ${l.currentStreak>0?"text-orange-400 animate-pulse":"text-muted-foreground"}`})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold text-orange-400",children:l.currentStreak}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Day Streak"})]})]}),e.jsxs("div",{className:"text-right",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Best: ",l.longestStreak," days"]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Total: ",l.totalDaysActive," days"]})]})]}),e.jsx("div",{className:"flex items-center justify-between mb-4",children:j.map((d,o)=>e.jsxs("div",{className:"flex flex-col items-center gap-1",children:[e.jsx("span",{className:"text-[10px] text-muted-foreground",children:d}),e.jsx("div",{className:`w-6 h-6 rounded-full flex items-center justify-center ${l.weekActivity[o]?"bg-orange-500/30 border border-orange-500/50":"bg-muted/30 border border-border/50"}`,children:l.weekActivity[o]&&e.jsx(ge,{className:"h-3 w-3 text-orange-400"})})]},o))}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex justify-between text-xs",children:[e.jsx("span",{className:"text-muted-foreground",children:"Next milestone"}),e.jsxs("span",{className:"text-orange-400",children:[h," days"]})]}),e.jsx(ve,{value:s,className:"h-2 bg-orange-500/20"}),e.jsxs("p",{className:"text-[10px] text-muted-foreground text-center",children:[h-l.currentStreak," days to go!"]})]})]})}function je(n){let l=2166136261;for(let a=0;a<n.length;a++)l^=n.charCodeAt(a),l=l*16777619>>>0;return l.toString(16).padStart(8,"0")}function be(n,l){var j,x;const a=[`Welcome to ${n}.`];return l!=null&&l.introduction&&a.push(l.introduction),(j=l==null?void 0:l.learningObjectives)!=null&&j.length&&(a.push("In this module, you will learn:"),l.learningObjectives.forEac
58h((h,s)=>{a.push(`${s+1}. ${h}`)})),(x=l==null?void 0:l.mainContent)!=null&&x.length&&l.mainContent.forEach(h=>{var s;a.push(`
59${h.sectionTitle}.`),a.push(h.content),(s=h.keyPoints)!=null&&s.length&&(a.push("Key points to remember:"),h.keyPoints.forEach(d=>a.push(`• ${d}`))),h.example&&a.push(`For example: ${h.example}`)}),l!=null&&l.summary&&a.push(`
60In summary: ${l.summary}`),a.push("Thank you for listening. Continue to the quiz to test your knowledge."),a.join(" ").replace(/\s+/g," ").trim()}const fs="https://imupgitrulufnuisoknl.supabase.co/storage/v1/object/public/module-audio";function js({moduleId:n,moduleTitle:l,moduleContent:a}){const[j,x]=r.useState("idle"),[h,s]=r.useState(!1),[d,o]=r.useState(null),[p,u]=r.useState(0),[k,v]=r.useState(0),[$,A]=r.useState(1),[S,N]=r.useState(!1),[C,D]=r.useState(1),[O,P]=r.useState(null),g=r.useRef(null),z=r.useCallback(()=>{const t=be(l,a),m=je(t);return`audio_${n}_${m}.mp3`},[n,l,a]),se=r.useCallback(()=>{const t=z();return`${fs}/${t}`},[z]),I=r.useCallback(()=>{if(g.current)return g.current;const t=new Audio;return t.preload="auto",t.crossOrigin="anonymous",t.setAttribute("playsinline","true"),t.setAttribute("webkit-playsinline","true"),t.playsInline=!0,t.addEventListener("loadedmetadata",()=>v(t.duration)),t.addEventListener("ended",()=>{s(!1),u(0)}),t.addEventListener("error",()=>{console.log("[AudioPlayer] Audio not in CDN, will generate on play")}),t.addEventListener("play",()=>s(!0)),t.addEventListener("pause",()=>s(!1)),t.addEventListener("timeupdate",()=>u(t.currentTime)),g.current=t,t},[]);r.useEffect(()=>{(async()=>{x("checking");const m=localStorage.getItem(`audio-url-${n}`),M=localStorage.getItem(`audio-hash-${n}`),L=je(be(l,a));if(m&&M===L)try{if((await fetch(m,{method:"HEAD"})).ok){o(m),x("ready");return}}catch{}const T=se();try{if((await fetch(T,{method:"HEAD"})).ok){o(T),x("ready"),localStorage.setItem(`audio-url-${n}`,T),localStorage.setItem(`audio-hash-${n}`,L),console.log("[AudioPlayer] CDN HIT:",T);return}}catch{}x("idle"),console.log("[AudioPlayer] CDN MISS - will generate on play")})()},[n,l,a,se]),r.useEffect(()=>()=>{g.current&&(g.current.pause(),g.current.src="")},[]),r.useEffect(()=>{!d||!g.current||(g.current.src=d,g.current.volume=S?0:$,g.current.playbackRate=C,g.current.load())},[d,$,S,C]);const B=r.useCallback(async()=>{x("generating"),P(null);try{const{data:t,error:m}=await we.functions.invoke("generate-module-audio",{body:{moduleId:n,title:l,content:a,checkOnly:!1}});if(m)throw m;if(!t.success)throw new Error(t.error||"Failed to generate audio");if(t.audioUrl){const M=je(be(l,a));return o(t.audioUrl),x("ready"),localStorage.setItem(`audio-url-${n}`,t.audioUrl),localStorage.setItem(`audio-hash-${n}`,M),oe.success("Audio generated - now cached for instant playback"),t.audioUrl}}catch(t){console.error("[AudioPlayer] Generation error:",t),P((t==null?void 0:t.message)||"Failed to generate audio"),x("error"),oe.error("Failed to generate audio")}return null},[n,l,a]),G=r.useCallback(async()=>{const t=I();if(!d&&j!=="generating"){const m=await B();if(m&&t){t.src=m,t.load();try{await t.play()}catch{oe.error("Tap again to play")}}return}if(!(!t||!d))if(t.src!==d&&(t.src=d,t.load()),h)t.pause();else try{await t.play()}catch{t.load(),oe.error("Tap again to start")}},[d,h,j,B,I]),te=r.useCallback(t=>{g.current&&(g.current.currentTime=t[0],u(t[0]))},[]),f=r.useCallback(t=>{A(t[0]),N(t[0]===0),g.current&&(g.current.volume=t[0])},[]),W=r.useCallback(()=>{const t=!S;N(t),g.current&&(g.current.volume=t?0:$)},[S,$]),J=r.useCallback(t=>{if(g.current){const m=Math.max(0,Math.min(g.current.currentTime+t,k));g.current.currentTime=m,u(m)}},[k]),le=r.useCallback(()=>{const t=[.75,1,1.25,1.5,2],m=t[(t.indexOf(C)+1)%t.length];D(m),g.current&&(g.current.playbackRate=m)},[C]),ae=r.useCallback(()=>{g.current&&(g.current.currentTime=0,u(0))},[]),X=t=>`${Math.floor(t/60)}:${Math.floor(t%60).toString().padStart(2,"0")}`,F=j==="ready"&&d,c=j==="checking"||j==="generating";return e.jsxs("div",{className:"bg-card/50 border border-border/50 rounded-lg p-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(rs,{className:"h-4 w-4 text-primary"}),e.jsx("span",{className:"text-sm font-medium",children:"Audio Lesson"}),F&&e.jsx("span",{className:"text-[10px] text-emerald-400 bg-emerald-500/10 px-1.5 py-0.5 rounded",children:"CDN"})]}),O&&e.jsx("span",{className:"text-xs text-destructive",children:O})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(w,{size:"sm",variant:"outline",onClick:()=>J(-10),disabled:!F||c,className:"h-10 w-10 p-0 touch-manipulation",children:e.jsx(ls,{className:"h-4 w-4"})}
60),e.jsx(w,{size:"sm",onClick:G,disabled:c,className:"h-12 w-12 p-0 rounded-full touch-manipulation active:scale-95 transition-transform",children:c?e.jsx(He,{className:"h-5 w-5 animate-spin"}):h?e.jsx(es,{className:"h-5 w-5"}):e.jsx(Be,{className:"h-5 w-5 ml-0.5"})}),e.jsx(w,{size:"sm",variant:"outline",onClick:()=>J(10),disabled:!F||c,className:"h-10 w-10 p-0 touch-manipulation",children:e.jsx(is,{className:"h-4 w-4"})}),e.jsx(w,{size:"sm",variant:"ghost",onClick:ae,disabled:!F||c,className:"h-10 w-10 p-0 touch-manipulation",children:e.jsx(ke,{className:"h-4 w-4"})}),e.jsxs(w,{size:"sm",variant:"ghost",onClick:le,disabled:!F||c,className:"h-10 px-3 text-xs font-mono touch-manipulation",children:[C,"x"]}),d&&e.jsx("a",{href:d,download:`${l}.mp3`,className:"ml-auto",children:e.jsxs(w,{size:"sm",className:"h-10 px-4 touch-manipulation bg-gradient-to-r from-primary to-primary/80 hover:from-primary/90 hover:to-primary/70 text-primary-foreground font-medium shadow-lg shadow-primary/25 border border-primary/20 gap-2",children:[e.jsx(ze,{className:"h-4 w-4"}),e.jsx("span",{className:"text-xs",children:"Play on device"})]})})]}),F&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ce,{value:[p],max:k||100,step:.1,onValueChange:te,className:"w-full touch-manipulation [&_[role=slider]]:h-5 [&_[role=slider]]:w-5"}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:X(p)}),e.jsx("span",{children:X(k)})]})]}),e.jsxs("div",{className:"hidden sm:flex items-center gap-2",children:[e.jsx(w,{size:"sm",variant:"ghost",onClick:W,className:"h-8 w-8 p-0",children:S||$===0?e.jsx(ds,{className:"h-4 w-4"}):e.jsx(os,{className:"h-4 w-4"})}),e.jsx(Ce,{value:[S?0:$],max:1,step:.01,onValueChange:f,className:"w-24"})]}),j==="idle"&&e.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Tap play to generate audio"}),j==="checking"&&e.jsx("p",{className:"text-xs text-muted-foreground text-center animate-pulse",children:"Checking CDN..."}),j==="generating"&&e.jsx("p",{className:"text-xs text-muted-foreground text-center animate-pulse",children:"Generating audio..."}),F&&e.jsx("p",{className:"text-xs text-emerald-400/70 text-center",children:"✓ Streaming from CDN (zero compute)"})]})}const bs={beginner:"bg-emerald-500/20 text-emerald-400 border-emerald-500/30",intermediate:"bg-amber-500/20 text-amber-400 border-amber-500/30",advanced:"bg-orange-500/20 text-orange-400 border-orange-500/30",expert:"bg-rose-500/20 text-rose-400 border-rose-500/30"};function Ls(){var ae,X,F,c,t,m,M,L,T,re,U,q,V,ce,K,Y,Se;const{courseSlug:n,moduleSlug:l}=Qe(),[a,j]=r.useState(null),[x,h]=r.useState([]),[s,d]=r.useState(null),[o,p]=r.useState(!0),[u,k]=r.useState(new Set),[v,$]=r.useState(new Set),[A]=r.useState(!0),S=70;r.useEffect(()=>{(async()=>{if(!n)return;const{data:b,error:E}=await we.from("learning_courses").select("*").eq("slug",n).single();if(E||!b){p(!1);return}j(b);const{data:_}=await we.from("course_modules").select("*").eq("course_id",b.id).order("module_order",{ascending:!0});if(_){const ne=_.map(ie=>({...ie,content:ie.content,linked_concepts:ie.linked_concepts||[]}));h(ne);const Le=l?ne.find(ie=>ie.slug===l):ne[0];d(Le||null)}const H=localStorage.getItem(`course-progress-${n}`);H&&k(new Set(JSON.parse(H)));const Z=localStorage.getItem(`course-quizzes-${n}`);Z&&$(new Set(JSON.parse(Z))),p(!1)})()},[n,l]);const N=()=>{if(!s||!n)return;const i=new Set(u).add(s.id);k(i),localStorage.setItem(`course-progress-${n}`,JSON.stringify([...i]))},C=i=>{if(!n)return;const b=new Set(v).add(i);$(b),localStorage.setItem(`course-quizzes-${n}`,JSON.stringify([...b]))},D=i=>{var _,H;if(!A||i===0)return!1;const b=x[i-1];return b?((H=(_=b.content)==null?void 0:_.quiz)==null?void 0:H.length)>0&&!v.has(b.id):!1},O=()=>{if(!s)return;const i=x.findIndex(b=>b.id===s.id);i<x.length-1&&!D(i+1)&&(N(),d(x[i+1]),window.scrollTo({top:0,behavior:"smooth"}))},P=()=>{if(!s)return;const i=x.findIndex(b=>b.id===s.id);i>0&&(d(x[i-1]),window.scrollTo({top:0,behavior:"smooth"}))},g=x.length>0?u.size/x.length*100:0,z=s?x.findIndex(i=>i.id===s.id):0,se=D(z+1);if(o)return e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-4",children:[e.jsx("div",{className:"w-10 h-10 border-2 border-primary border-t-transparent roun
60ded-full animate-spin"}),e.jsx("p",{className:"text-muted-foreground font-mono text-sm",children:"Loading course..."})]})});if(!a)return e.jsx("div",{className:"min-h-screen bg-background",children:e.jsxs("div",{className:"container mx-auto px-4 py-16 text-center",children:[e.jsx(Ue,{className:"h-16 w-16 text-muted-foreground mx-auto mb-4"}),e.jsx("h1",{className:"text-2xl font-bold mb-4",children:"Course Not Found"}),e.jsx(de,{to:"/learn",children:e.jsxs(w,{variant:"outline",children:[e.jsx(fe,{className:"h-4 w-4 mr-2"}),"Back to Courses"]})})]})});const I={"@context":"https://schema.org","@type":"Course",name:a.title,description:a.description,provider:{"@type":"Organization",name:"TokenStocks.Ai",url:"https://tokenstocks.ai",logo:{"@type":"ImageObject",url:"https://tokenstocks.ai/logo.png"}},educationalLevel:a.difficulty,numberOfCredits:x.length,hasCourseInstance:{"@type":"CourseInstance",courseMode:"online",duration:`PT${a.estimated_hours}H`,courseWorkload:`PT${a.estimated_hours}H`},url:`https://tokenstocks.ai/learn/${a.slug}`,inLanguage:"en",isAccessibleForFree:!0,courseCode:a.slug,about:{"@type":"Thing",name:((ae=a.category)==null?void 0:ae.replace(/-/g," "))||"Trading"},hasPart:x.map((i,b)=>({"@type":"LearningResource",name:i.title,description:i.summary,position:b+1,url:`https://tokenstocks.ai/learn/${a.slug}/${i.slug}`,timeRequired:`PT${i.estimated_minutes}M`,learningResourceType:"lesson"}))},B=s?{"@context":"https://schema.org","@type":"LearningResource",name:s.title,description:s.summary,learningResourceType:"lesson",educationalLevel:a.difficulty,timeRequired:`PT${s.estimated_minutes}M`,isPartOf:{"@type":"Course",name:a.title,url:`https://tokenstocks.ai/learn/${a.slug}`},url:`https://tokenstocks.ai/learn/${a.slug}/${s.slug}`,inLanguage:"en",isAccessibleForFree:!0,teaches:(X=s.key_concepts)==null?void 0:X.join(", "),position:z+1}:null,G={"@context":"https://schema.org","@type":"BreadcrumbList",itemListElement:[{"@type":"ListItem",position:1,name:"Home",item:"https://tokenstocks.ai"},{"@type":"ListItem",position:2,name:"Learn",item:"https://tokenstocks.ai/learn"},{"@type":"ListItem",position:3,name:a.title,item:`https://tokenstocks.ai/learn/${a.slug}`},...s?[{"@type":"ListItem",position:4,name:s.title,item:`https://tokenstocks.ai/learn/${a.slug}/${s.slug}`}]:[]]},te={"@context":"https://schema.org","@type":"FAQPage",mainEntity:[{"@type":"Question",name:`What will I learn in ${a.title}
60?`,acceptedAnswer:{"@type":"Answer",text:a.description}},{"@type":"Question",name:"How long does this course take to complete?",acceptedAnswer:{"@type":"Answer",text:`This course takes approximately ${a.estimated_hours} hours to complete across ${x.length} modules.`}},{"@type":"Question",name:"Is this course free?",acceptedAnswer:{"@type":"Answer",text:"Yes, all courses on TokenStocks.Ai are completely free. We believe in democratizing trading education."}}]},f=s?`${s.title} - ${a.title} | TokenStocks Learn`:`${a.title} - Trading Course | TokenStocks Learn`,W=(s==null?void 0:s.summary)||a.description,J=`https://tokenstocks.ai/learn/${a.slug}${s?`/${s.slug}`:""}`,le=((F=s==null?void 0:s.key_concepts)==null?void 0:F.join(", "))||`${a.category}, trading course, ${a.difficulty} trading, tokenized stocks`;return e.jsxs("div",{className:"min-h-screen bg-background flex flex-col",children:[e.jsxs(qe,{children:[e.jsx("title",{children:f}),e.jsx("meta",{name:"description",content:W}),e.jsx("meta",{name:"keywords",content:le}),e.jsx("link",{rel:"canonical",href:J}),e.jsx("meta",{name:"robots",content:"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1"}),e.jsx("meta",{name:"googlebot",content:"index, follow, max-snippet:-1, max-image-preview:large"}),e.jsx("meta",{name:"bingbot",content:"index, follow, max-snippet:-1, max-image-preview:large"}),e.jsx("html",{lang:"en"}),e.jsx("meta",{property:"og:locale",content:"en_US"}),e.jsx("link",{rel:"alternate",hrefLang:"en",href:J}),e.jsx("link",{rel:"alternate",hrefLang:"x-default",href:J}),e.jsx("meta",{property:"og:title",content:f}),e.jsx("meta",{property:"og:description",content:W}),e.jsx("meta",{property:"og:type",content:"article"}),e.jsx("meta",{property:"og:url",content:J}),e.jsx("meta",{property:"og:image",content:"https://tokenstocks.ai/og-learn.png"}),e.jsx("meta",{property:"og:image:width",content:"1200"}),e.jsx("meta",{property:"og:image:height",content:"630"}),e.jsx("meta",{property:"og:image:alt",content:f}),e.jsx("meta",{property:"og:site_name",content:"TokenStocks.Ai"}),e.jsx("meta",{name:"twitter:card",content:"summary_large_image"}),e.jsx("meta",{name:"twitter:site",content:"@TokenStocksAi"}),e.jsx("meta",{name:"twitter:creator",content:"@TokenStocksAi"}),e.jsx("meta",{name:"twitter:title",content:f}),e.jsx("meta",{name:"twitter:description",content:W}),e.jsx("meta",{name:"twitter:image",content:"https://tokenstocks.ai/og-learn.png"}),e.jsx("meta",{name:"twitter:label1",content:"Duration"}),e.jsx("meta",{name:"twitter:data1",content:s?`${s.estimated_minutes} min`:`${a.estimated_hours} hours`}),e.jsx("meta",{name:"twitter:label2",content:"Level"}),e.jsx("meta",{name:"twitter:data2",content:a.difficulty}),e.jsx("link",{rel:"preconnect",href:"https://tokenstocks.ai"}),e.jsx("link",{rel:"dns-prefetch",href:"https://tokenstocks.ai"}),e.jsx("script",{type:"application/ld+json",children:JSON.stringify(I)}),B&&e.jsx("script",{type:"application/ld+json",children:JSON.stringify(B)}),e.jsx("script",{type:"application/ld+json",children:JSON.stringify(G)}),e.jsx("script",{type:"application/ld+json",children:JSON.stringify(te)})]}),e.jsx("header",{className:"border-b border-border/50 bg-card/50 backdrop-blur-sm sticky top-0 z-50",children:e.jsx("div",{className:"container mx-auto px-4 py-3",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(de,{to:"/learn",className:"flex items-center gap-2 text-muted-foreground hover:text-foreground",children:[e.jsx(fe,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline text-sm",children:"Back"})]}),e.jsx("div",{className:"h-4 w-px bg-border"}),e.jsxs(de,{to:"/",className:"flex items-center gap-2",children:[e.jsx(Ve,{className:"h-5 w-5 text-primary"}),e.jsx("span",{className:"font-mono font-bold text-sm hidden md:block",children:"AgentQuants"})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(gs,{compact:!0}),e.jsxs("div",{className:"hidden md:flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(ve,{value:g,className:"w-20 h-2"}),e.jsxs("span",{children:[Math.round(g),"%"]})]}),e.jsx(ee,{className:`${bs[a.difficulty]} border text-[10px]`,children:(c=a.difficulty)==null?void 0:c.toUpperCase()})]})]})})}),e.jsxs("div",{className:"flex flex-1",children:[e.jsx("aside",{className:"hidden lg:block w-72 border-r border-border/50 bg-card/30",children:e.jsxs("div",{className:"sticky top-16 p-4 max-h-[calc(100vh-4rem)] overflow-y-auto",children:[e.jsx("h2",{className:"font-bold text-sm mb-4 text-muted-foreground uppercase tracking-wider",children:"Modules"}),e.jsx("nav",{className:"space-y-1",children:x.map((i,b)=>{var Z,ne;const E=D(b),_=v.has(i.id),H=((ne=(Z=i.content)==null?void 0:Z.quiz)==null?void 0:ne.length)>0;return e.jsxs("button",{onClick:()=>!E&&d(i),disabled:E,className:`w-full flex items-start gap-3 px-3 py-2.5 text-sm rounded-lg transition-all text-left ${(s==null?void 0:s.id)===i.id?"bg-primary/10 text-primary border border-primary/30":E?"opacity-50 cursor-not-allowed":"hover:bg-muted/50 text-muted-foreground hover:text-foreground"}
60`,children:[e.jsx("div",{className:"mt-0.5",children:E?e.jsx(Ae,{className:"h-4 w-4 text-muted-foreground"}):u.has(i.id)?e.jsx(R,{className:"h-4 w-4 text-emerald-500"}):H&&_?e.jsx(R,{className:"h-4 w-4 text-blue-500"}):e.jsx(ts,{className:"h-4 w-4"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["Module ",b+1]}),e.jsx("p",{className:"font-medium line-clamp-2",children:i.title}),E&&e.jsx("p",{className:"text-[10px] text-amber-400 mt-1",children:"Pass previous quiz to unlock"})]})]},i.id)})})]})}),e.jsx("main",{className:"flex-1 min-w-0",children:s?e.jsxs("article",{className:"max-w-4xl mx-auto px-4 py-8",children:[e.jsxs("div",{className:"mb-8",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground mb-2",children:[e.jsx(ss,{className:"h-4 w-4"}),"Module ",z+1," of ",x.length,e.jsx("span",{className:"mx-2",children:"•"}),e.jsx(Je,{className:"h-4 w-4"}),s.estimated_minutes," min"]}),e.jsx("h1",{className:"text-3xl md:text-4xl font-bold mb-4",children:s.title}),e.jsx("p",{className:"text-lg text-muted-foreground",children:s.summary})]}),e.jsx("div",{className:"mb-6",children:e.jsx(js,{moduleId:s.id,moduleTitle:s.title,moduleContent:s.content})}),e.jsx("div",{className:"mb-6",children:e.jsx(ps,{moduleId:s.id,moduleTitle:s.title,courseSlug:n||""})}),((t=s.key_concepts)==null?void 0:t.length)>0&&e.jsx("div",{className:"flex flex-wrap gap-2 mb-8",children:s.key_concepts.map((i,b)=>e.jsx(ee,{variant:"outline",className:"bg-primary/5",children:i},b))}),((m=s.content)==null?void 0:m.introduction)&&e.jsx(y,{className:"p-6 mb-8 bg-primary/5 border-primary/20",children:e.jsx("p",{className:"text-foreground/90 leading-relaxed",children:s.content.introduction})}),((M=s.content)==null?void 0:M.visualDescription)&&e.jsx(y,{className:"p-4 mb-8 bg-gradient-to-r from-blue-500/10 to-purple-500/10 border-blue-500/20",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-blue-500/20",children:e.jsx($e,{className:"h-5 w-5 text-blue-400"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-sm text-blue-400 mb-1",children:"Visual Framework"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s.content.visualDescription})]})]})}),((T=(L=s.content)==null?void 0:L.learningObjectives)==null?void 0:T.length)>0&&e.jsxs("div",{className:"mb-10",children:[e.jsxs("h2",{className:"text-xl font-bold mb-4 flex items-center gap-2",children:[e.jsx(Ne,{className:"h-5 w-5 text-primary"}),"Learning Objectives"]}),e.jsx("ul",{className:"space-y-2",children:s.content.learningObjectives.map((i,b)=>e.jsxs("li",{className:"flex items-start gap-3",children:[e.jsx(R,{className:"h-5 w-5 text-emerald-500 mt-0.5 flex-shrink-0"}),e.jsx("span",{children:i})]},b))})]}),(U=(re=s.content)==null?void 0:re.mainContent)==null?void 0:U.map((i,b)=>{var E;return e.jsxs("div",{className:"mb-10",children:[e.jsx("h2",{className:"text-2xl font-bold mb-4 border-b border-border/50 pb-3",children:i.sectionTitle}),e.jsx("p",{className:"text-foreground/80 leading-relaxed mb-4 whitespace-pre-line",children:i.content}),((E=i.keyPoints)==null?void 0:E.length)>0&&e.jsxs(y,{className:"p-4 bg-muted/30 mb-4",children:[e.jsx("h4",{className:"font-semibold mb-2 text-sm text-primary",children:"Key Points"}),e.jsx("ul",{className:"space-y-1",children:i.keyPoints.map((_,H)=>e.jsxs("li",{className:"flex items-start gap-2 text-sm",children:[e.jsx(xe,{className:"h-4 w-4 text-primary mt-0.5 flex-shrink-0"}),e.jsx("span",{children:_})]},H))})]}),i.example&&e.jsxs(y,{className:"p-4 bg-amber-500/10 border-amber-500/30 mb-4",children:[e.jsxs("h4",{className:"font-semibold mb-2 text-sm text-amber-400 flex items-center gap-2",children:[e.jsx(pe,{className:"h-4 w-4"}),"Real-World Example"]}),e.jsx("p",{className:"text-sm text-foreground/80",children:i.example})]}),i.visualNote&&e.jsx(y,{className:"p-3 bg-blue-500/5 border-blue-500/20 mb-4",children:e.jsxs("div",{className:"flex items-center gap-2 text-xs text-blue-400",children:[e.jsx(ns,{className:"h-4 w-4"}),e.jsx("span",{className:"font-medium",children:"Visual Note:"}),e.jsx("span",{className:"text-muted-foreground",children:i.visualNote})]})}),i.knowledgeCheck&&e.jsx(us,{question:i.knowledgeCheck.question,options:i.knowledgeCheck.options,correctIndex:i.knowledgeCheck.correctIndex,explanation:i.knowledgeCheck.explanation,topic:i.sectionTitle})]},b)}),((q=s.content)==null?void 0:q.discussionPrompt)&&e.jsx(hs,{question:s.content.discu
60ssionPrompt.question,context:s.content.discussionPrompt.context,sampleResponses:s.content.discussionPrompt.sampleResponses,moduleId:s.id,promptId:"main"}),((V=s.content)==null?void 0:V.practicalApplication)&&e.jsxs(y,{className:"p-6 mb-10 border-emerald-500/30 bg-emerald-500/5",children:[e.jsxs("h2",{className:"text-xl font-bold mb-4 flex items-center gap-2 text-emerald-400",children:[e.jsx(Ke,{className:"h-5 w-5"}),"Case Study: Practical Application"]}),s.content.practicalApplication.scenario&&e.jsxs("div",{className:"mb-4",children:[e.jsx("h4",{className:"font-semibold text-sm mb-2",children:"Scenario"}),e.jsx("p",{className:"text-foreground/80",children:s.content.practicalApplication.scenario})]}),s.content.practicalApplication.walkthrough&&e.jsxs("div",{className:"mb-4",children:[e.jsx("h4",{className:"font-semibold text-sm mb-2",children:"Step-by-Step Analysis"}),e.jsx("p",{className:"text-foreground/80 whitespace-pre-line",children:s.content.practicalApplication.walkthrough})]}),s.content.practicalApplication.quantitativeExample&&e.jsxs(y,{className:"p-4 bg-primary/10 border-primary/20",children:[e.jsxs("h4",{className:"font-semibold text-sm mb-2 text-primary flex items-center gap-2",children:[e.jsx($e,{className:"h-4 w-4"}),"Quantitative Analysis"]}),e.jsx("p",{className:"text-sm text-foreground/80 font-mono",children:s.content.practicalApplication.quantitativeExample})]})]}),((K=(ce=s.content)==null?void 0:ce.quiz)==null?void 0:K.length)>0&&e.jsx("div",{className:"mb-10",children:e.jsx(xs,{questions:s.content.quiz,moduleTitle:s.title,moduleId:s.id,requireMastery:A&&z<x.length-1,masteryThreshold:S,onComplete:(i,b,E)=>{const _=Math.round(i/b*100);if(n){const H=localStorage.getItem(`course-scores-${n}`),Z=H?JSON.parse(H):[];Z.push({moduleId:s.id,score:_,time:E,date:new Date().toISOString()}),localStorage.setItem(`course-scores-${n}`,JSON.stringify(Z)),localStorage.setItem(`course-lastAccess-${n}`,new Date().toISOString())}_>=S&&(C(s.id),N())}})}),((Y=s.linked_concepts)==null?void 0:Y.length)>0&&e.jsxs("div",{className:"mb-10",children:[e.jsxs("h2",{className:"text-xl font-bold mb-4 flex items-center gap-2",children:[e.jsx(Ge,{className:"h-5 w-5 text-primary"}),"Related Concepts"]}),e.jsx("div",{className:"grid gap-3 sm:grid-cols-2",children:s.linked_concepts.map((i,b)=>e.jsx(y,{className:"p-4 hover:border-primary/50 transition-all",children:i.relatedCourseSlug?e.jsxs(de,{to:`/learn/${i.relatedCourseSlug}`,className:"block",children:[e.jsx("h4",{className:"font-semibold text-primary mb-1",children:i.term}),e.jsx("p",{className:"text-sm text-muted-foreground",children:i.description})]}):e.jsxs(e.Fragment,{children:[e.jsx("h4",{className:"font-semibold mb-1",children:i.term}),e.jsx("p",{className:"text-sm text-muted-foreground",children:i.description})]})},b))})]}),((Se=s.content)==null?void 0:Se.summary)&&e.jsxs(y,{className:"p-6 mb-8 bg-muted/30",children:[e.jsx("h2",{className:"font-bold mb-2",children:"Module Summary"}),e.jsx("p",{className:"text-foreground/80",children:s.content.summary})]}),e.jsxs("div",{className:"flex items-center justify-between pt-8 border-t border-border/50",children:[e.jsxs(w,{variant:"outline",onClick:P,disabled:z===0,children:[e.jsx(fe,{className:"h-4 w-4 mr-2"}),"Previous"]}),z<x.length-1?e.jsx(w,{onClick:O,disabled:se,children:se?e.jsxs(e.Fragment,{children:[e.jsx(Ae,{className:"h-4 w-4 mr-2"}),"Pass Quiz to Continue"]}):e.jsxs(e.Fragment,{children:["Next Module",e.jsx(We,{className:"h-4 w-4 ml-2"})]})}):e.jsxs(w,{onClick:N,className:"bg-emerald-600 hover:bg-emerald-700",children:[e.jsx(R,{className:"h-4 w-4 mr-2"}),"Complete Course"]})]})]}):e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("p",{className:"text-muted-foreground",children:"Select a module to begin"})})})]}),e.jsx(Xe,{})]})}export{Ls as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.