github-actions[bot] commited on
Commit
c8cbbb1
ยท
1 Parent(s): bec7a68

๐Ÿš€ Auto-deploy frontend from GitHub (99641d0)

Browse files
This view is limited to 50 files because it contains too many changes. ย  See raw diff
Files changed (50) hide show
  1. assets/AIChatPage-CzCeFujm.js +0 -2
  2. assets/AdminDashboard-BmyikugA.js +0 -63
  3. assets/AvatarShop-BirEYu2M.js +0 -16
  4. assets/ChatMarkdown-B34PtYCE.js +0 -2
  5. assets/CompetencyRadarChart-BfcP7xrw.js +0 -2
  6. assets/CompositeAvatar-DMpjm5UY.js +0 -1
  7. assets/ConfirmModal-DGrnpObD.js +0 -1
  8. assets/DashboardAvatar-CHVNq8nF.js +0 -1
  9. assets/DashboardAvatar-CK5sUmxI.js +1 -0
  10. assets/DiagnosticAssessmentModal-C541tkg_.js +0 -1
  11. assets/FloatingAITutor-DkH3KrR1.js +0 -7
  12. assets/GradesPage-m1qiGDtC.js +0 -2
  13. assets/HeroBanner-BdiQHNd9.js +0 -7
  14. assets/LeaderboardPage-jsrBZaI7.js +0 -8
  15. assets/LearningPath-B_MkUEk2.js +0 -1
  16. assets/LoginPage-mXOi2OPh.js +0 -1
  17. assets/LogoutActionButton-FS5OGZjL.js +0 -16
  18. assets/MathAnswerInput-DNG5LFL4.js +0 -1
  19. assets/ModuleFolderCard-CoKTURyN.js +0 -1
  20. assets/ModulesPage-y4YivjOd.js +0 -0
  21. assets/NotificationCenter-DGhehaGL.js +0 -6
  22. assets/ProfileModal-D3hk8uuj.js +0 -16
  23. assets/QuizBattlePage-BbGkD7O9.js +0 -21
  24. assets/RewardsModal-HRePzoUo.js +0 -1
  25. assets/RightSidebar-Dfek3lmU.js +0 -1
  26. assets/ScientificCalculator-wlhyNBDf.js +0 -30
  27. assets/SearchBar-ldiC0sUv.js +0 -1
  28. assets/SettingsModal-C-nK3nbS.js +0 -11
  29. assets/Sidebar-xBQ3Qnyw.js +0 -1
  30. assets/SupplementalBanner-dklPrubU.js +0 -1
  31. assets/TeacherDashboard-D8avlB5m.js +0 -0
  32. assets/XPNotification-4si_K5GL.js +0 -1
  33. assets/apiService-axx1LHMk.js +0 -6
  34. assets/automationService-DNyauqGd.js +0 -1
  35. assets/avatarData-BW_TX0b4.js +0 -1
  36. assets/award-oJTbc9W5.js +0 -6
  37. assets/bell-CbSbac2W.js +0 -6
  38. assets/book-open-BH50GByv.js +0 -6
  39. assets/brain-CPvGdgWE.js +0 -6
  40. assets/button-BpeUVhBo.js +0 -1
  41. assets/calendar-BJ8oE6yW.js +0 -6
  42. assets/chart-column-D5mAWcRx.js +0 -6
  43. assets/chatService-BXbCYY4-.js +1 -0
  44. assets/chatService-LsXGqjoV.js +0 -1
  45. assets/check-BACdUlFL.js +0 -6
  46. assets/chevron-right-COMox1Xb.js +0 -6
  47. assets/chevron-up-Bfmq3Clw.js +0 -11
  48. assets/circle-alert-CBefjicJ.js +0 -6
  49. assets/circle-check-big-0Gzyt_f3.js +0 -6
  50. assets/circle-help-BmjHdT5a.js +0 -6
assets/AIChatPage-CzCeFujm.js DELETED
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/apiService-axx1LHMk.js","assets/index-D4nJsLyx.js","assets/vendor-react-Dexh7fmo.js","assets/vendor-firebase-auth-COrkgW0P.js","assets/vendor-firebase-core-DQ-pMjxd.js","assets/vendor-firebase-firestore-BML5nJHm.js","assets/vendor-firebase-storage-BOeKE_0n.js","assets/vendor-firebase-analytics-CCo6E2f7.js","assets/index-CR2i2gnI.css"])))=>i.map(i=>d[i]);
2
- import{y as B,_ as F,e as N,m as k}from"./index-D4nJsLyx.js";import{r,j as e}from"./vendor-react-Dexh7fmo.js";import{B as $}from"./button-BpeUVhBo.js";import{I as S}from"./input-DBkKXOmF.js";import z from"./ChatMarkdown-B34PtYCE.js";import{P as O}from"./plus-BxxucBR0.js";import{S as H}from"./search-Do6u3pFt.js";import{T as Y}from"./trash-2-BoXE_mye.js";import{S as D}from"./send-NQY-QTkN.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-firestore-BML5nJHm.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";import"./vendor-radix-BRdei-zg.js";import"./clsx-B-dksMZM.js";import"./utils-BQQgILNW.js";import"./vendor-markdown-C5ikSDMA.js";const ie=()=>{const{sessions:C,activeSessionId:a,isLoading:l,loadingSessionId:I,setActiveSessionId:i,createNewSession:u,sendMessage:A,deleteSession:L,getActiveSession:T}=B(),[d,_]=r.useState(""),[o,f]=r.useState(""),[b,y]=r.useState(!1),c=r.useRef(null),x=r.useRef(!0),m=r.useRef(!1),n=T(),h=n?.messages||[],M=h.some(t=>t.sender==="ai"&&t.id.startsWith("stream-")),g=l&&a===I&&!M,j=(t="auto")=>{const s=c.current;s&&s.scrollTo({top:s.scrollHeight,behavior:t})},P=()=>{const t=c.current;return t?t.scrollHeight-t.scrollTop-t.clientHeight<=120:!0},E=()=>{x.current=P()};r.useEffect(()=>{F(async()=>{const{warmupBackend:t}=await import("./apiService-axx1LHMk.js");return{warmupBackend:t}},__vite__mapDeps([0,1,2,3,4,5,6,7,8])).then(({warmupBackend:t})=>{t()}).catch(t=>{console.warn("AI chat warmup skipped:",t)})},[]),r.useEffect(()=>{if(!x.current)return;const t=window.requestAnimationFrame(()=>j("auto"));return()=>window.cancelAnimationFrame(t)},[h,g]),r.useEffect(()=>{x.current=!0,j("auto")},[a]);const v=async()=>{if(!(!o.trim()||l||b||m.current)){m.current=!0,y(!0);try{let t=a;t||(t=u(),i(t));const s=o.trim();f(""),await A(t,s)}finally{m.current=!1,y(!1)}}},w=()=>{const t=u();i(t)},R=(t,s)=>{s.stopPropagation(),L(t)},p=C.filter(t=>t.title.toLowerCase().includes(d.toLowerCase())||t.preview.toLowerCase().includes(d.toLowerCase()));return e.jsxs("div",{className:"h-full min-h-0 overflow-hidden flex gap-4 px-4 sm:px-6 xl:px-10 py-6",children:[e.jsxs("div",{className:"w-80 min-h-0 flex flex-col bg-[#f7f9fc] rounded-3xl border border-[#dde3eb] overflow-hidden",children:[e.jsxs("div",{className:"p-4 border-b border-[#dde3eb] flex-shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("div",{className:"w-12 h-12 bg-gradient-to-r from-sky-600 to-sky-500 rounded-2xl flex items-center justify-center",children:e.jsx("img",{src:"/avatar/avatar_icon.png",alt:"AI Tutor",className:"w-10 h-10 object-contain drop-shadow-md"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-bold font-display text-[#0a1628]",children:"L.O.L.I."}),e.jsx("p",{className:"text-[10px] text-[#5a6578]",children:"Your AI Math Tutor"})]})]}),e.jsxs("button",{onClick:w,className:"w-full bg-gradient-to-r from-sky-600 to-sky-500 hover:from-sky-700 hover:to-sky-600 text-white px-4 py-3 rounded-xl text-sm font-bold transition-all shadow-md hover:shadow-lg flex items-center justify-center gap-2",children:[e.jsx(O,{size:18}),"New Chat"]}),e.jsxs("div",{className:"relative mt-3",children:[e.jsx(H,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500",size:14}),e.jsx(S,{type:"text",placeholder:"Search conversations...",value:d,onChange:t=>_(t.target.value),className:"w-full pl-9 pr-3 py-2 text-xs rounded-xl border-[#dde3eb] focus:border-sky-600 focus:ring-2 focus:ring-sky-100"})]})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:[e.jsx("div",{className:"flex items-center justify-between mb-2 px-2",children:e.jsxs("span",{className:"text-xs font-bold text-[#5a6578]",children:[p.length," Conversations"]})}),e.jsx(N,{children:p.map(t=>e.jsxs(k.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},onClick:()=>i(t.id),className:`group p-3 rounded-2xl cursor-pointer transition-all duration-200 border relative ${a===t.id?"bg-sky-50 border-sky-200 shadow-sm":"bg-[#edf1f7] border-transparent hover:bg-[#dde3eb] hover:border-[#dde3eb]"}`,children:[e.jsxs("div",{className:"flex items-start justify-between mb-1",children:[e.jsx("h3",{className:`text-xs font-bold mb-0.5 pr-6 line-clamp-1 ${a===t.id?"text-sky-700":"text-[#0a1628]"}`,children:t.title}),e.jsx("button",{onClick:s=>R(t.id,s),className:"absolute top-2 right-2 p-1.5 rounded-lg opacity-0 group-hover:opacity-100 hover:bg-red-100 text-slate-500 hover:text-red-600 transition-all",children:e.jsx(Y,{size:12})})]}),e.jsx("p",{className:"text-[10px] text-[#5a6578] mb-2 line-clamp-2",children:t.preview}),e.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[e.jsx("span",{className:"text-slate-500",children:t.date}),e.jsxs("span",{className:`px-2 py-0.5 rounded-full ${a===t.id?"bg-sky-100 text-sky-600":"bg-[#dde3eb] text-[#5a6578]"}`,children:[t.messageCount," msgs"]})]})]},t.id))}),p.length===0&&e.jsxs("div",{className:"text-center py-8",children:[e.jsx("img",{src:"/avatar/avatar_icon.png",alt:"AI Tutor",className:"w-16 h-16 object-contain mx-auto mb-2 opacity-60 drop-shadow-sm grayscale contrast-50"}),e.jsx("p",{className:"text-sm text-slate-500",children:"No conversations found"}),e.jsx("p",{className:"text-xs text-slate-500/60 mt-1",children:"Start a new chat!"})]})]})]}),e.jsx("div",{className:"flex-1 min-h-0 flex flex-col bg-[#f7f9fc] rounded-3xl border border-[#dde3eb] overflow-hidden",children:a?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"p-4 border-b border-[#dde3eb] flex items-center justify-between flex-shrink-0",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"font-bold font-display text-[#0a1628]",children:n?.title}),e.jsx("p",{className:"text-xs text-[#5a6578]",children:n?.date})]}),e.jsx("div",{className:"flex items-center gap-2",children:n?.topics.map((t,s)=>e.jsx("span",{className:"px-3 py-1 bg-sky-50 text-sky-600 text-xs font-bold rounded-lg",children:t},s))})]}),e.jsxs("div",{ref:c,onScroll:E,className:"flex-1 overflow-y-auto overscroll-contain p-6 space-y-4 bg-[#edf1f7] min-h-0",children:[e.jsx(N,{children:h.map(t=>e.jsx(k.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${t.sender==="user"?"justify-end":"justify-start"}`,children:e.jsxs("div",{className:`max-w-[70%] rounded-2xl px-5 py-3 ${t.sender==="user"?"bg-gradient-to-r from-sky-600 to-sky-500 text-white":"bg-white text-[#0a1628] shadow-md border border-[#dde3eb]"}`,children:[t.sender==="user"?e.jsx("p",{className:"text-sm whitespace-pre-wrap leading-relaxed",children:t.text}):e.jsx(z,{children:t.text}),e.jsx("p",{className:`text-[10px] mt-1.5 ${t.sender==="user"?"text-sky-200":"text-slate-500"}`,children:t.timestamp})]})},t.id))}),g&&e.jsx("div",{className:"flex justify-start",children:e.jsx("div",{className:"bg-white text-[#0a1628] shadow-md border border-[#dde3eb] rounded-2xl px-5 py-3 max-w-[70%]",children:e.jsxs("div",{className:"flex gap-1",children:[e.jsx("div",{className:"w-2 h-2 bg-sky-400 rounded-full animate-bounce"}),e.jsx("div",{className:"w-2 h-2 bg-sky-400 rounded-full animate-bounce [animation-delay:150ms]"}),e.jsx("div",{className:"w-2 h-2 bg-sky-400 rounded-full animate-bounce [animation-delay:300ms]"})]})})})]}),e.jsx("div",{className:"p-4 border-t border-[#dde3eb] bg-white flex-shrink-0",children:e.jsxs("div",{className:"flex gap-3",children:[e.jsx(S,{type:"text",value:o,onChange:t=>f(t.target.value),onKeyPress:t=>t.key==="Enter"&&v(),placeholder:"Ask me anything about math...",className:"flex-1 px-5 py-3 rounded-xl border-[#dde3eb] focus:border-sky-600 focus:ring-2 focus:ring-sky-100 text-sm"}),e.jsx($,{onClick:v,disabled:!o.trim()||l||b,className:"px-6 bg-gradient-to-r from-sky-600 to-sky-500 hover:from-sky-700 hover:to-sky-600 text-white rounded-xl transition-all disabled:opacity-50 disabled:cursor-not-allowed shadow-md hover:shadow-lg",children:e.jsx(D,{size:18})})]})})]}):e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center p-8 text-center",children:[e.jsx("div",{className:"w-24 h-24 bg-gradient-to-r from-sky-100 to-cyan-100 rounded-3xl flex items-center justify-center mb-6",children:e.jsx("img",{src:"/avatar/avatar_icon.png",alt:"AI Tutor",className:"w-20 h-20 object-contain drop-shadow-lg"})}),e.jsx("h2",{className:"text-2xl font-bold font-display text-[#0a1628] mb-1",children:"Welcome to L.O.L.I."}),e.jsx("p",{className:"text-sky-600 text-sm font-bold tracking-wide uppercase mb-4",children:"Logical Operations & Learning Intelligence"}),e.jsx("p",{className:"text-[#5a6578] mb-6 max-w-md",children:"Your personal AI math tutor is here to help! Start a new conversation or select one from the sidebar."}),e.jsx("button",{onClick:w,className:"px-6 py-3 bg-gradient-to-r from-sky-600 to-sky-500 hover:from-sky-700 hover:to-sky-600 text-white rounded-xl font-bold shadow-lg hover:shadow-xl transition-all",children:"Start Your First Chat"}),e.jsx("div",{className:"mt-8 grid grid-cols-3 gap-4 max-w-2xl",children:["Algebra","Geometry","Calculus"].map(t=>e.jsxs("div",{className:"p-4 bg-[#edf1f7] rounded-xl border border-[#dde3eb]",children:[e.jsx("p",{className:"text-sm font-bold text-[#0a1628]",children:t}),e.jsxs("p",{className:"text-xs text-[#5a6578] mt-1",children:["Get help with ",t.toLowerCase()]})]},t))})]})})]})};export{ie as default};
 
 
 
assets/AdminDashboard-BmyikugA.js DELETED
@@ -1,63 +0,0 @@
1
- import{j as e,r as x}from"./vendor-react-Dexh7fmo.js";import Qe from"./Sidebar-xBQ3Qnyw.js";import Ne from"./ConfirmModal-DGrnpObD.js";import{B as E}from"./button-BpeUVhBo.js";import{I as R}from"./input-DBkKXOmF.js";import{R as Je,C as Ke,a as Ze,T as Ye,D as et,P as tt,O as st,b as at,I as lt,F as rt}from"./vendor-radix-BRdei-zg.js";import{c as G}from"./utils-BQQgILNW.js";import{X as nt}from"./x-BONnp2RF.js";import{S as V,a as H,b as W,c as X,d as A}from"./select-Co4o1EaI.js";import{f as $,e as z,q as ne,o as ie,l as Pe,w as it,u as Le,a as J,d as ce,m as we,c as Re}from"./vendor-firebase-firestore-BML5nJHm.js";import{c as B,d as M,u as Se,t as T,m as L,T as be,Z as Ie,D as ct,f as dt,h as ot,F as xt}from"./index-D4nJsLyx.js";import{R as ke,F as mt,V as ht,I as ae,D as ee}from"./video-CS-NQBfT.js";import{P as Ee}from"./plus-BxxucBR0.js";import{L as F}from"./loader-circle-J8Mwbkkw.js";import{C as ut}from"./circle-check-big-0Gzyt_f3.js";import{P as Te}from"./pen-line-Vok2l3fc.js";import{T as je}from"./trash-2-BoXE_mye.js";import{S as Ae}from"./search-Do6u3pFt.js";import{U as de}from"./users-HMf2sdE3.js";import{B as O}from"./book-open-BH50GByv.js";import{C as pt}from"./circle-help-BmjHdT5a.js";import{C as ve}from"./calendar-BJ8oE6yW.js";import{C as le}from"./circle-alert-CBefjicJ.js";import{S as Z}from"./shield-L33jkK5w.js";import{E as gt}from"./eye-DXdRafOv.js";import{S as ft}from"./LogoutActionButton-FS5OGZjL.js";import{B as bt}from"./bell-CbSbac2W.js";import{G as jt}from"./globe-BMa4SWkV.js";import{S as vt}from"./save-Og8yP5Yb.js";import{G as Ce}from"./graduation-cap-Df8fGPxp.js";import{T as $e}from"./target-D7SVtf3g.js";import{C as yt}from"./clock-DUJO-a50.js";import{A as re}from"./award-oJTbc9W5.js";import{B as Nt}from"./brain-CPvGdgWE.js";import{F as wt,T as St}from"./trending-down-CqEkjFA9.js";import{D as kt}from"./download-PWUf0XJa.js";import{C as ye}from"./chart-column-D5mAWcRx.js";import{a as At}from"./chevron-up-Bfmq3Clw.js";import{M as Ct}from"./minus-oFhmD2--.js";import{T as Dt}from"./trending-up-D-vj8Gbq.js";import"./chevron-right-COMox1Xb.js";import"./message-square-DSAS4TVL.js";import"./swords-8_KH18p7.js";import"./trophy-C2nVcZnb.js";import"./shirt-BMZy0pq4.js";import"./log-out-BqGKt-tT.js";import"./clsx-B-dksMZM.js";import"./check-BACdUlFL.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";/**
2
- * @license lucide-react v0.487.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 Tt=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],Me=B("activity",Tt);/**
7
- * @license lucide-react v0.487.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 Mt=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]],zt=B("ban",Mt);/**
12
- * @license lucide-react v0.487.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 Pt=[["path",{d:"M10 2v8l3-3 3 3V2",key:"sqw3rj"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}]],Lt=B("book-marked",Pt);/**
17
- * @license lucide-react v0.487.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 Rt=[["path",{d:"M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z",key:"pzmjnu"}],["path",{d:"M21.21 15.89A10 10 0 1 1 8 2.83",key:"k2fpak"}]],It=B("chart-pie",Rt);/**
22
- * @license lucide-react v0.487.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 Et=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]],$t=B("grid-3x3",Et);/**
27
- * @license lucide-react v0.487.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 Ut=[["path",{d:"M14 22v-4a2 2 0 1 0-4 0v4",key:"hhkicm"}],["path",{d:"m18 10 3.447 1.724a1 1 0 0 1 .553.894V20a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-7.382a1 1 0 0 1 .553-.894L6 10",key:"1xqip1"}],["path",{d:"M18 5v17",key:"1sw6gf"}],["path",{d:"m4 6 7.106-3.553a2 2 0 0 1 1.788 0L20 6",key:"9d2mlk"}],["path",{d:"M6 5v17",key:"1xfsm0"}],["circle",{cx:"12",cy:"9",r:"2",key:"1092wv"}]],Ft=B("school",Ut);/**
32
- * @license lucide-react v0.487.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 Bt=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],Ot=B("server",Bt);/**
37
- * @license lucide-react v0.487.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 Gt=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],_t=B("square-pen",Gt);/**
42
- * @license lucide-react v0.487.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 qt=[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]],Vt=B("type",qt);/**
47
- * @license lucide-react v0.487.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 Ht=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["polyline",{points:"16 11 18 13 22 9",key:"1pwet4"}]],Wt=B("user-check",Ht);function Ue({...t}){return e.jsx(Je,{"data-slot":"dialog",...t})}function Xt({...t}){return e.jsx(tt,{"data-slot":"dialog-portal",...t})}function Qt({className:t,...a}){return e.jsx(st,{"data-slot":"dialog-overlay",className:G("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...a})}function Fe({className:t,children:a,...i}){return e.jsxs(Xt,{"data-slot":"dialog-portal",children:[e.jsx(Qt,{}),e.jsxs(Ke,{"data-slot":"dialog-content",className:G("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",t),...i,children:[a,e.jsxs(Ze,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[e.jsx(nt,{}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Be({className:t,...a}){return e.jsx("div",{"data-slot":"dialog-header",className:G("flex flex-col gap-2 text-center sm:text-left",t),...a})}function Oe({className:t,...a}){return e.jsx("div",{"data-slot":"dialog-footer",className:G("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...a})}function Ge({className:t,...a}){return e.jsx(Ye,{"data-slot":"dialog-title",className:G("text-lg leading-none font-semibold",t),...a})}function _e({className:t,...a}){return e.jsx(et,{"data-slot":"dialog-description",className:G("text-muted-foreground text-sm",t),...a})}function Jt(t){return t?t.charAt(0).toUpperCase()+t.slice(1):"Student"}function Kt(t){if(t.role==="student"){const a=t.grade||"",i=t.section||"";return[a,i].filter(Boolean).join(" - ")||"Student"}return t.role==="teacher"?t.department||"Mathematics":t.role==="admin"?t.department||"System":""}function Zt(t){if(!t||!t.toDate)return"Never";const a=t.toDate(),s=new Date().getTime()-a.getTime(),c=Math.floor(s/6e4);if(c<1)return"Just now";if(c<60)return`${c} minute${c!==1?"s":""} ago`;const d=Math.floor(c/60);if(d<24)return`${d} hour${d!==1?"s":""} ago`;const p=Math.floor(d/24);return p<7?`${p} day${p!==1?"s":""} ago`:a.toLocaleDateString()}function qe(t){if(!t||!t.toDate)return new Date().toISOString().replace("T"," ").slice(0,19);const a=t.toDate();return`${a.getFullYear()}-${String(a.getMonth()+1).padStart(2,"0")}-${String(a.getDate()).padStart(2,"0")} ${String(a.getHours()).padStart(2,"0")}:${String(a.getMinutes()).padStart(2,"0")}:${String(a.getSeconds()).padStart(2,"0")}`}function Yt(){return qe({toDate:()=>new Date})}async function es(){try{const t=ne(z(M,"users"),ie("createdAt","desc"));return(await $(t)).docs.map(i=>{const s=i.data();return{id:i.id,name:s.name||"Unknown",email:s.email||"",role:Jt(s.role),status:s.status||"Active",department:Kt(s),grade:s.grade||"",section:s.section||"",classSection:[s.grade||"",s.section||""].filter(Boolean).join(" - "),lrn:s.lrn||"",photo:s.photo||s.photoURL||"",lastLogin:Zt(s.lastLogin)}})}catch(t){return console.error("[adminService] getAllUsers error:",t),[]}}async function ze(t,a){const i=ce(M,"users",t),s={updatedAt:J()};if(a.name!==void 0&&(s.name=a.name),a.email!==void 0&&(s.email=a.email),a.status!==void 0&&(s.status=a.status),a.role!==void 0&&(s.role=a.role.toLowerCase()),a.department!==void 0&&(s.department=a.department,a.role?.toLowerCase()==="student"&&(s.grade=a.department)),a.grade!==void 0&&(s.grade=a.grade),a.section!==void 0&&(s.section=a.section),a.lrn!==void 0&&(s.lrn=a.lrn),s.grade||s.section){const c=s.grade||"",d=s.section||"";s.classSectionId=[c,d].filter(Boolean).join("_").replace(/\s+/g,"_").toLowerCase()}await Le(i,s)}async function ts(t){await Re(ce(M,"users",t))}async function ss(t,a,i,s,c){const d=i.toLowerCase(),p={email:t,name:a,role:d,status:"Active",department:s,photo:`https://ui-avatars.com/api/?name=${encodeURIComponent(a)}&background=0d9488&color=fff`,createdAt:J(),updatedAt:J()};if(d==="student"){const f=c?.grade||s||"Grade 11",o=c?.section||"Section A";Object.assign(p,{lrn:c?.lrn||`${Date.now()}`.slice(-12).padStart(12,"0"),grade:f,section:o,classSectionId:[f,o].join("_").replace(/\s+/g,"_").toLowerCase(),level:1,currentXP:0,totalXP:0,streak:0,atRiskSubjects:[],hasTakenDiagnostic:!1})}else d==="teacher"?Object.assign(p,{teacherId:`TCH-${Date.now()}`,subject:"Mathematics",yearsOfExperience:"0",qualification:"",students:[]}):d==="admin"&&Object.assign(p,{adminId:`ADM-${Date.now()}`,position:"Administrator"});return(await we(z(M,"users"),p)).id}async function Ve(){try{const t=ne(z(M,"auditLogs"),ie("timestampRaw","desc"),Pe(100));return(await $(t)).docs.map(i=>{const s=i.data();return{id:i.id,severity:s.severity||"Info",timestamp:s.timestamp||qe(s.timestampRaw),user:s.user||{name:"System",role:"Admin",avatar:null},action:s.action||"",category:s.category||"System",details:s.details||""}})}catch(t){return console.error("[adminService] getAuditLogs error:",t),[]}}async function Q(t,a,i,s,c){await we(z(M,"auditLogs"),{severity:i,timestamp:Yt(),timestampRaw:J(),user:c,action:t,category:a,details:s})}async function as(){try{const t=ne(z(M,"modules"),ie("createdAt","desc"));return(await $(t)).docs.map(i=>{const s=i.data(),c=s.createdAt;return{id:i.id,title:s.title||"",subject:s.subject||"",type:s.type||"Video",difficulty:s.difficulty||"Beginner",status:s.status||"Draft",assigned:s.assigned||0,created:s.created||(c?.toDate?.()?.toLocaleDateString()??"")}})}catch(t){return console.error("[adminService] getModules error:",t),[]}}async function ls(t){return(await we(z(M,"modules"),{...t,createdAt:J(),updatedAt:J()})).id}async function rs(t,a){await Le(ce(M,"modules",t),{...a,updatedAt:J()})}async function ns(t){await Re(ce(M,"modules",t))}async function is(){try{const t=await $(z(M,"users"));let a=0,i=0,s=0;t.docs.forEach(j=>{const f=j.data();f.role==="student"&&(a++,f.overallRisk==="High"&&s++),f.role==="teacher"&&f.status!=="Inactive"&&i++});let c=0;try{c=(await $(z(M,"classrooms"))).size}catch{}let d=0;try{d=(await $(z(M,"xpActivities"))).size}catch{}let p=0;try{const j=await $(z(M,"progress")),f=[];j.docs.forEach(o=>{const u=o.data();typeof u.averageScore=="number"&&f.push(u.averageScore)}),p=f.length>0?Math.round(f.reduce((o,u)=>o+u,0)/f.length):0}catch{}return{totalStudents:a,activeTeachers:i,totalClasses:c,atRiskStudents:s,avgPerformance:p,aiPredictions:d}}catch(t){return console.error("[adminService] getDashboardStats error:",t),{totalStudents:0,activeTeachers:0,totalClasses:0,atRiskStudents:0,avgPerformance:0,aiPredictions:0}}}async function cs(t=3){try{const a=ne(z(M,"users"),it("role","==","student"),ie("level","desc"),Pe(t));return(await $(a)).docs.map(s=>{const c=s.data(),d=c.level||1,p=c.currentXP||0,j=Math.min(100,d*8+Math.round(p/100));return{id:s.id,name:c.name||"Student",avatar:c.photo||c.photoURL||`https://ui-avatars.com/api/?name=${encodeURIComponent(c.name||"S")}&background=0d9488&color=fff`,class:c.grade||"Math",performance:j,level:d}})}catch(a){return console.error("[adminService] getTopPerformers error:",a),[]}}async function ds(){try{const t=await $(z(M,"users"));let a=0,i=0,s=0,c=0,d=0;t.docs.forEach(f=>{const o=f.data();o.role==="student"&&(a++,o.overallRisk==="High"&&s++,o.streak>0&&d++,c+=o.totalXP||0),o.role==="teacher"&&i++});let p=0;try{p=(await $(z(M,"achievements"))).size}catch{}let j=0;try{j=(await $(z(M,"chatSessions"))).size}catch{}return{totalActiveUsers:a+i,totalStudents:a,totalTeachers:i,atRiskStudents:s,achievementsUnlocked:p,totalXPEarned:c,activeStreaks:d,aiTutorSessions:j}}catch(t){return console.error("[adminService] getAnalyticsSummary error:",t),{totalActiveUsers:0,totalStudents:0,totalTeachers:0,atRiskStudents:0,achievementsUnlocked:0,totalXPEarned:0,activeStreaks:0,aiTutorSessions:0}}}const os=()=>{const{userProfile:t}=Se(),[a,i]=x.useState([]),[s,c]=x.useState(!0),[d,p]=x.useState(!1),[j,f]=x.useState(!1),[o,u]=x.useState(""),[C,b]=x.useState("All Types"),[S,g]=x.useState("All Status"),[v,y]=x.useState(!1),[I,N]=x.useState(!1),[h,r]=x.useState(null),[w,D]=x.useState(null),[m,k]=x.useState({title:"",subject:"",type:"Video",difficulty:"Beginner",status:"Draft",assigned:0,created:new Date().toLocaleDateString()}),U=x.useCallback(async()=>{c(!0);try{const n=await as();i(n)}catch{T.error("Failed to load modules")}finally{c(!1)}},[]);x.useEffect(()=>{U()},[U]);const _=()=>{D(null),k({title:"",subject:"",type:"Video",difficulty:"Beginner",status:"Draft",assigned:0,created:new Date().toLocaleDateString()}),y(!0)},oe=n=>{D(n),k({title:n.title,subject:n.subject,type:n.type,difficulty:n.difficulty,status:n.status,assigned:n.assigned,created:n.created}),y(!0)},xe=async()=>{if(!m.title.trim()||!m.subject.trim()){T.error("Title and subject are required");return}p(!0);try{w?(await rs(w.id,m),await Q("Module Updated","Content","Info",`Updated module: "${m.title}"`,{name:t?.name||"Admin",role:"Admin",avatar:t?.photo||null}),T.success("Module updated")):(await ls(m),await Q("Module Created","Content","Info",`Created new module: "${m.title}" (${m.subject})`,{name:t?.name||"Admin",role:"Admin",avatar:t?.photo||null}),T.success("Module created")),await U(),y(!1)}catch{T.error("Failed to save module")}finally{p(!1)}},me=n=>{r(n),N(!0)},he=async()=>{if(!(!h||j)){f(!0);try{await ns(h.id),await Q("Module Deleted","Content","Warning",`Deleted module: "${h.title}"`,{name:t?.name||"Admin",role:"Admin",avatar:t?.photo||null}),T.success("Module deleted"),i(n=>n.filter(ge=>ge.id!==h.id)),N(!1),r(null)}catch{T.error("Failed to delete module")}finally{f(!1)}}},ue=a.length,te=a.filter(n=>n.status==="Published").length,pe=a.filter(n=>n.status==="Draft").length,l=a.filter(n=>n.status==="Archived").length,P=n=>{switch(n){case"Published":return"bg-green-100 text-green-700 border-green-200";case"Draft":return"bg-rose-100 text-rose-700 border-rose-200";case"Archived":return"bg-[#edf1f7] text-[#0a1628] border-[#dde3eb]";default:return"bg-[#edf1f7] text-[#0a1628]"}},K=n=>{switch(n){case"Beginner":return"bg-sky-50 text-sky-700";case"Intermediate":return"bg-sky-50 text-sky-700";case"Advanced":return"bg-sky-50 text-sky-700";default:return"bg-[#edf1f7] text-[#0a1628]"}},q=n=>{switch(n){case"Video":return e.jsx(ht,{size:16,className:"text-sky-600"});case"Quiz":return e.jsx(pt,{size:16,className:"text-teal-600"});default:return e.jsx(mt,{size:16,className:"text-[#5a6578]"})}},He=n=>{switch(n){case"Video":return"bg-sky-100 text-sky-700";case"Quiz":return"bg-teal-100 text-teal-700";default:return"bg-[#edf1f7] text-[#0a1628]"}},De=a.filter(n=>{const ge=n.title.toLowerCase().includes(o.toLowerCase())||n.subject.toLowerCase().includes(o.toLowerCase()),We=C==="All Types"||n.type===C,Xe=S==="All Status"||n.status===S;return ge&&We&&Xe});return e.jsxs(L.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"space-y-6",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("h2",{className:"text-lg font-bold text-[#0a1628]",children:"Content Management"}),e.jsx("p",{className:"text-sm text-[#5a6578]",children:"Manage learning modules, templates, and educational content"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs(E,{variant:"outline",className:"gap-2 border-[#dde3eb] hover:bg-[#edf1f7]",onClick:U,children:[e.jsx(ke,{size:16}),"Refresh"]}),e.jsxs(E,{className:"gap-2 bg-sky-600 hover:bg-sky-700 text-white",onClick:_,children:[e.jsx(Ee,{size:16}),"Create Module"]})]}),s?e.jsx("div",{className:"flex items-center justify-center h-24",children:e.jsx(F,{size:24,className:"animate-spin text-sky-500"})}):null,e.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[e.jsxs("div",{className:"bg-white p-4 rounded-xl border border-[#dde3eb] shadow-sm",children:[e.jsx("p",{className:"text-xs font-bold text-[#5a6578] mb-1",children:"Total Modules"}),e.jsx("p",{className:"text-2xl font-bold text-[#0a1628]",children:ue})]}),e.jsx("div",{className:"bg-white p-4 rounded-xl border border-[#dde3eb] shadow-sm flex items-center justify-between",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(ut,{size:14,className:"text-green-500"}),e.jsx("p",{className:"text-xs font-bold text-[#5a6578]",children:"Published"})]}),e.jsx("p",{className:"text-2xl font-bold text-[#0a1628]",children:te})]})}),e.jsx("div",{className:"bg-white p-4 rounded-xl border border-[#dde3eb] shadow-sm flex items-center justify-between",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(Te,{size:14,className:"text-rose-500"}),e.jsx("p",{className:"text-xs font-bold text-[#5a6578]",children:"Drafts"})]}),e.jsx("p",{className:"text-2xl font-bold text-[#0a1628]",children:pe})]})}),e.jsx("div",{className:"bg-white p-4 rounded-xl border border-[#dde3eb] shadow-sm flex items-center justify-between",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(je,{size:14,className:"text-slate-500"}),e.jsx("p",{className:"text-xs font-bold text-[#5a6578]",children:"Archived"})]}),e.jsx("p",{className:"text-2xl font-bold text-[#0a1628]",children:l})]})})]}),e.jsxs("div",{className:"bg-white p-4 rounded-xl border border-[#dde3eb] shadow-sm space-y-4",children:[e.jsxs("div",{className:"relative",children:[e.jsx(Ae,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500",size:18}),e.jsx(R,{type:"text",placeholder:"Search modules by title or topic...",className:"pl-10 bg-[#edf1f7] border-[#dde3eb]",value:o,onChange:n=>u(n.target.value)})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("select",{className:"px-3 py-2 rounded-lg border border-[#dde3eb] bg-white text-sm font-medium text-[#5a6578] focus:outline-none focus:ring-2 focus:ring-sky-500/20",value:C,onChange:n=>b(n.target.value),children:[e.jsx("option",{children:"All Types"}),e.jsx("option",{children:"Video"}),e.jsx("option",{children:"Quiz"}),e.jsx("option",{children:"Document"})]}),e.jsxs("select",{className:"px-3 py-2 rounded-lg border border-[#dde3eb] bg-white text-sm font-medium text-[#5a6578] focus:outline-none focus:ring-2 focus:ring-sky-500/20",value:S,onChange:n=>g(n.target.value),children:[e.jsx("option",{children:"All Status"}),e.jsx("option",{children:"Published"}),e.jsx("option",{children:"Draft"}),e.jsx("option",{children:"Archived"})]})]})]}),e.jsxs("div",{className:"bg-white rounded-xl border border-[#dde3eb] shadow-sm overflow-hidden",children:[e.jsxs("table",{className:"w-full text-left border-collapse",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-[#edf1f7] border-b border-[#dde3eb]",children:[e.jsx("th",{className:"p-4 w-10",children:e.jsx("input",{type:"checkbox",className:"rounded border-[#dde3eb] text-sky-600 focus:ring-sky-500"})}),e.jsx("th",{className:"p-4 text-xs font-bold text-[#5a6578] uppercase tracking-wider",children:"Module"}),e.jsx("th",{className:"p-4 text-xs font-bold text-[#5a6578] uppercase tracking-wider",children:"Type"}),e.jsx("th",{className:"p-4 text-xs font-bold text-[#5a6578] uppercase tracking-wider",children:"Difficulty"}),e.jsx("th",{className:"p-4 text-xs font-bold text-[#5a6578] uppercase tracking-wider",children:"Status"}),e.jsx("th",{className:"p-4 text-xs font-bold text-[#5a6578] uppercase tracking-wider",children:"Assigned"}),e.jsx("th",{className:"p-4 text-xs font-bold text-[#5a6578] uppercase tracking-wider",children:"Created"}),e.jsx("th",{className:"p-4 text-xs font-bold text-[#5a6578] uppercase tracking-wider text-right",children:"Actions"})]})}),e.jsx("tbody",{className:"divide-y divide-[#dde3eb]",children:De.map(n=>e.jsxs("tr",{className:"hover:bg-[#edf1f7] transition-colors group",children:[e.jsx("td",{className:"p-4",children:e.jsx("input",{type:"checkbox",className:"rounded border-[#dde3eb] text-sky-600 focus:ring-sky-500"})}),e.jsx("td",{className:"p-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`w-8 h-8 rounded-lg flex items-center justify-center ${n.type==="Video"?"bg-sky-100 text-sky-600":n.type==="Quiz"?"bg-teal-100 text-teal-600":"bg-[#edf1f7] text-[#5a6578]"}`,children:q(n.type)}),e.jsxs("div",{children:[e.jsx("p",{className:"font-bold text-[#0a1628] text-sm",children:n.title}),e.jsx("p",{className:"text-xs text-[#5a6578]",children:n.subject})]})]})}),e.jsx("td",{className:"p-4",children:e.jsx("span",{className:`px-2 py-1 rounded text-xs font-bold ${He(n.type)}`,children:n.type})}),e.jsx("td",{className:"p-4",children:e.jsx("span",{className:`px-2 py-1 rounded text-xs font-bold ${K(n.difficulty)}`,children:n.difficulty})}),e.jsx("td",{className:"p-4",children:e.jsx("span",{className:`px-2 py-1 rounded-full text-xs font-bold border ${P(n.status)}`,children:n.status})}),e.jsx("td",{className:"p-4",children:e.jsxs("div",{className:"flex items-center gap-1 text-[#5a6578] text-sm",children:[e.jsx(de,{size:14}),e.jsx("span",{children:n.assigned})]})}),e.jsx("td",{className:"p-4 text-sm text-[#5a6578]",children:n.created}),e.jsx("td",{className:"p-4 text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-2 opacity-0 group-hover:opacity-100 transition-opacity",children:[e.jsx("button",{onClick:()=>oe(n),className:"p-2 hover:bg-[#dde3eb] rounded-lg text-[#5a6578] hover:text-sky-600 transition-colors",children:e.jsx(Te,{size:16})}),e.jsx("button",{onClick:()=>me(n),className:"p-2 hover:bg-red-50 rounded-lg text-[#5a6578] hover:text-red-600 transition-colors",children:e.jsx(je,{size:16})})]})})]},n.id))})]}),De.length===0&&!s&&e.jsxs("div",{className:"p-12 text-center text-[#5a6578]",children:[e.jsx(O,{size:48,className:"mx-auto mb-4 text-slate-500"}),e.jsx("p",{className:"font-medium",children:"No modules found"}),e.jsx("p",{className:"text-sm",children:a.length===0?"Create your first module to get started":"Try adjusting your search or filters"})]})]}),e.jsx(Ue,{open:v,onOpenChange:y,children:e.jsxs(Fe,{className:"sm:max-w-[480px]",children:[e.jsxs(Be,{children:[e.jsx(Ge,{children:w?"Edit Module":"Create New Module"}),e.jsx(_e,{children:w?"Update module details below.":"Fill in the details to create a new learning module."})]}),e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[e.jsx("label",{className:"text-right text-sm font-medium text-[#0a1628]",children:"Title"}),e.jsx(R,{value:m.title,onChange:n=>k({...m,title:n.target.value}),placeholder:"Module title",className:"col-span-3"})]}),e.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[e.jsx("label",{className:"text-right text-sm font-medium text-[#0a1628]",children:"Subject"}),e.jsx(R,{value:m.subject,onChange:n=>k({...m,subject:n.target.value}),placeholder:"e.g. Algebra, Calculus",className:"col-span-3"})]}),e.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[e.jsx("label",{className:"text-right text-sm font-medium text-[#0a1628]",children:"Type"}),e.jsx("div",{className:"col-span-3",children:e.jsxs(V,{value:m.type,onValueChange:n=>k({...m,type:n}),children:[e.jsx(H,{children:e.jsx(W,{})}),e.jsxs(X,{children:[e.jsx(A,{value:"Video",children:"Video"}),e.jsx(A,{value:"Quiz",children:"Quiz"}),e.jsx(A,{value:"Document",children:"Document"})]})]})})]}),e.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[e.jsx("label",{className:"text-right text-sm font-medium text-[#0a1628]",children:"Difficulty"}),e.jsx("div",{className:"col-span-3",children:e.jsxs(V,{value:m.difficulty,onValueChange:n=>k({...m,difficulty:n}),children:[e.jsx(H,{children:e.jsx(W,{})}),e.jsxs(X,{children:[e.jsx(A,{value:"Beginner",children:"Beginner"}),e.jsx(A,{value:"Intermediate",children:"Intermediate"}),e.jsx(A,{value:"Advanced",children:"Advanced"}),e.jsx(A,{value:"N/A",children:"N/A"})]})]})})]}),e.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[e.jsx("label",{className:"text-right text-sm font-medium text-[#0a1628]",children:"Status"}),e.jsx("div",{className:"col-span-3",children:e.jsxs(V,{value:m.status,onValueChange:n=>k({...m,status:n}),children:[e.jsx(H,{children:e.jsx(W,{})}),e.jsxs(X,{children:[e.jsx(A,{value:"Draft",children:"Draft"}),e.jsx(A,{value:"Published",children:"Published"}),e.jsx(A,{value:"Archived",children:"Archived"})]})]})})]})]}),e.jsxs(Oe,{children:[e.jsx(E,{variant:"outline",onClick:()=>y(!1),disabled:d,children:"Cancel"}),e.jsxs(E,{onClick:xe,className:"bg-sky-600 hover:bg-sky-700 text-white",disabled:d,children:[d?e.jsx(F,{size:16,className:"animate-spin mr-2"}):null,w?"Save Changes":"Create Module"]})]})]})}),e.jsx(Ne,{isOpen:I,onClose:()=>{j||(N(!1),r(null))},onConfirm:he,title:"Delete Module?",message:h?`Delete "${h.title}"? This cannot be undone.`:"Delete this module? This cannot be undone.",confirmText:j?"Deleting...":"Delete",cancelText:"Cancel",type:"danger",icon:"delete"})]})},xs=()=>{const[t,a]=x.useState([]),[i,s]=x.useState(!0),[c,d]=x.useState(""),[p,j]=x.useState("All Categories"),[f,o]=x.useState("All Severity"),[u,C]=x.useState("All Roles"),b=x.useCallback(async()=>{s(!0);try{const r=await Ve();a(r)}catch{T.error("Failed to load audit logs")}finally{s(!1)}},[]);x.useEffect(()=>{b()},[b]);const S=t.filter(r=>r.severity==="Info").length,g=t.filter(r=>r.severity==="Warning").length,v=t.filter(r=>r.severity==="Error"||r.severity==="Critical").length,y=r=>{switch(r){case"Info":return e.jsx(ae,{size:16,className:"text-sky-600"});case"Warning":return e.jsx(be,{size:16,className:"text-rose-600"});case"Error":return e.jsx(le,{size:16,className:"text-red-600"});case"Critical":return e.jsx(le,{size:16,className:"text-red-600"});default:return e.jsx(ae,{size:16,className:"text-[#5a6578]"})}},I=r=>{switch(r){case"Info":return"bg-sky-100 text-sky-700 border-sky-200";case"Warning":return"bg-rose-100 text-rose-700 border-rose-200";case"Error":return"bg-red-100 text-red-700 border-red-200";case"Critical":return"bg-red-100 text-red-700 border-red-200 ring-2 ring-red-500";default:return"bg-[#edf1f7] text-[#0a1628] border-[#dde3eb]"}},N=r=>{switch(r){case"Auth":return"bg-sky-100 text-sky-700";case"Data":return"bg-rose-100 text-rose-700";case"User":return"bg-sky-100 text-sky-700";case"System":return"bg-[#edf1f7] text-[#0a1628]";case"Content":return"bg-green-100 text-green-700";default:return"bg-[#edf1f7] text-[#0a1628]"}},h=t.filter(r=>{const w=r.action.toLowerCase().includes(c.toLowerCase())||r.details.toLowerCase().includes(c.toLowerCase())||r.user.name.toLowerCase().includes(c.toLowerCase()),D=p==="All Categories"||r.category===p,m=f==="All Severity"||r.severity===f,k=u==="All Roles"||r.user.role===u;return w&&D&&m&&k});return e.jsxs(L.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"space-y-6",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("h2",{className:"text-lg font-bold text-[#0a1628]",children:"Audit Log"}),e.jsx("p",{className:"text-sm text-[#5a6578]",children:"System activity monitoring and security events"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"bg-white px-3 py-2 rounded-xl border border-[#dde3eb] flex items-center gap-2 text-[#5a6578] text-sm font-medium",children:[e.jsx(ve,{size:16}),e.jsx("span",{children:"Last 100 events"})]}),e.jsxs(E,{variant:"outline",className:"gap-2 border-[#dde3eb] hover:bg-[#edf1f7]",onClick:b,children:[e.jsx(ke,{size:16}),"Refresh"]})]}),i?e.jsx("div",{className:"flex items-center justify-center h-24",children:e.jsx(F,{size:24,className:"animate-spin text-sky-500"})}):null,e.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[e.jsxs("div",{className:"bg-white p-4 rounded-xl border border-[#dde3eb] shadow-sm",children:[e.jsx("p",{className:"text-xs font-bold text-[#5a6578] mb-1",children:"Total Events"}),e.jsx("p",{className:"text-2xl font-bold text-[#0a1628]",children:t.length})]}),e.jsxs("div",{className:"bg-white p-4 rounded-xl border border-sky-200 shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(ae,{size:14,className:"text-sky-600"}),e.jsx("p",{className:"text-xs font-bold text-[#5a6578]",children:"Info"})]}),e.jsx("p",{className:"text-2xl font-bold text-sky-600",children:S})]}),e.jsxs("div",{className:"bg-white p-4 rounded-xl border border-rose-200 shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(be,{size:14,className:"text-rose-600"}),e.jsx("p",{className:"text-xs font-bold text-[#5a6578]",children:"Warnings"})]}),e.jsx("p",{className:"text-2xl font-bold text-rose-600",children:g})]}),e.jsxs("div",{className:"bg-white p-4 rounded-xl border border-red-200 shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(le,{size:14,className:"text-red-600"}),e.jsx("p",{className:"text-xs font-bold text-[#5a6578]",children:"Errors"})]}),e.jsx("p",{className:"text-2xl font-bold text-red-600",children:v})]})]}),e.jsxs("div",{className:"bg-white p-4 rounded-xl border border-[#dde3eb] shadow-sm space-y-4",children:[e.jsxs("div",{className:"relative",children:[e.jsx(Ae,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500",size:18}),e.jsx(R,{type:"text",placeholder:"Search by user, action, or details...",className:"pl-10 bg-[#edf1f7] border-[#dde3eb]",value:c,onChange:r=>d(r.target.value)})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("select",{className:"px-3 py-2 rounded-lg border border-[#dde3eb] bg-white text-sm font-medium text-[#5a6578] focus:outline-none focus:ring-2 focus:ring-sky-500/20",value:p,onChange:r=>j(r.target.value),children:[e.jsx("option",{children:"All Categories"}),e.jsx("option",{children:"Auth"}),e.jsx("option",{children:"Data"}),e.jsx("option",{children:"User"}),e.jsx("option",{children:"System"}),e.jsx("option",{children:"Content"})]}),e.jsxs("select",{className:"px-3 py-2 rounded-lg border border-[#dde3eb] bg-white text-sm font-medium text-[#5a6578] focus:outline-none focus:ring-2 focus:ring-sky-500/20",value:f,onChange:r=>o(r.target.value),children:[e.jsx("option",{children:"All Severity"}),e.jsx("option",{children:"Info"}),e.jsx("option",{children:"Warning"}),e.jsx("option",{children:"Error"}),e.jsx("option",{children:"Critical"})]}),e.jsxs("select",{className:"px-3 py-2 rounded-lg border border-[#dde3eb] bg-white text-sm font-medium text-[#5a6578] focus:outline-none focus:ring-2 focus:ring-sky-500/20",value:u,onChange:r=>C(r.target.value),children:[e.jsx("option",{children:"All Roles"}),e.jsx("option",{children:"Admin"}),e.jsx("option",{children:"Teacher"}),e.jsx("option",{children:"Student"})]})]})]}),e.jsxs("div",{className:"bg-white rounded-xl border border-[#dde3eb] shadow-sm overflow-hidden",children:[e.jsxs("table",{className:"w-full text-left border-collapse",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-[#edf1f7] border-b border-[#dde3eb]",children:[e.jsx("th",{className:"p-4 text-xs font-bold text-[#5a6578] uppercase tracking-wider",children:"Severity"}),e.jsx("th",{className:"p-4 text-xs font-bold text-[#5a6578] uppercase tracking-wider",children:"Timestamp"}),e.jsx("th",{className:"p-4 text-xs font-bold text-[#5a6578] uppercase tracking-wider",children:"User"}),e.jsx("th",{className:"p-4 text-xs font-bold text-[#5a6578] uppercase tracking-wider",children:"Action"}),e.jsx("th",{className:"p-4 text-xs font-bold text-[#5a6578] uppercase tracking-wider",children:"Category"}),e.jsx("th",{className:"p-4 text-xs font-bold text-[#5a6578] uppercase tracking-wider",children:"Details"}),e.jsx("th",{className:"p-4 text-xs font-bold text-[#5a6578] uppercase tracking-wider text-right",children:"View"})]})}),e.jsx("tbody",{className:"divide-y divide-[#dde3eb]",children:h.map(r=>e.jsxs("tr",{className:"hover:bg-[#edf1f7] transition-colors",children:[e.jsx("td",{className:"p-4",children:e.jsxs("div",{className:`inline-flex items-center gap-2 px-3 py-1 rounded-full text-xs font-bold border ${I(r.severity)}`,children:[y(r.severity),r.severity]})}),e.jsx("td",{className:"p-4",children:e.jsxs("div",{className:"flex items-center gap-2 text-[#5a6578] text-sm",children:[e.jsx("div",{className:"p-1 bg-[#edf1f7] rounded",children:e.jsx(ve,{size:12})}),r.timestamp]})}),e.jsx("td",{className:"p-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[r.user.avatar?e.jsx("img",{src:r.user.avatar,alt:r.user.name,className:"w-8 h-8 rounded-full object-cover"}):e.jsx("div",{className:"w-8 h-8 bg-sky-100 rounded-full flex items-center justify-center",children:e.jsx(Z,{size:16,className:"text-sky-600"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-bold text-[#0a1628] text-sm",children:r.user.name}),e.jsx("p",{className:"text-xs text-[#5a6578]",children:r.user.role})]})]})}),e.jsx("td",{className:"p-4",children:e.jsx("p",{className:"font-medium text-[#0a1628] text-sm",children:r.action})}),e.jsx("td",{className:"p-4",children:e.jsx("span",{className:`px-2 py-1 rounded text-xs font-bold ${N(r.category)}`,children:r.category})}),e.jsx("td",{className:"p-4 text-sm text-[#5a6578] max-w-xs truncate",title:r.details,children:r.details}),e.jsx("td",{className:"p-4 text-right",children:e.jsx("button",{className:"p-2 hover:bg-[#dde3eb] rounded-lg text-slate-500 hover:text-sky-600 transition-colors",children:e.jsx(gt,{size:16})})})]},r.id))})]}),h.length===0&&!i&&e.jsxs("div",{className:"p-12 text-center text-[#5a6578]",children:[e.jsx(Z,{size:48,className:"mx-auto mb-4 text-slate-500"}),e.jsx("p",{className:"font-medium",children:"No logs found"}),e.jsx("p",{className:"text-sm",children:t.length===0?"Audit events will appear here as actions are performed":"Try adjusting your search or filters"})]})]})]})},ms=()=>JSON.parse(JSON.stringify(ct)),hs=()=>{const{userProfile:t}=Se(),[a,i]=x.useState("General"),[s,c]=x.useState(ms()),[d,p]=x.useState(!1),[j,f]=x.useState(!1),o=[{id:"General",label:"General",icon:ft},{id:"Security",label:"Security",icon:Z},{id:"AI Features",label:"AI Features",icon:Ie},{id:"Academic",label:"Academic",icon:O},{id:"Notifications",label:"Notifications",icon:bt},{id:"Backup & Data",label:"Backup & Data",icon:ee}];x.useEffect(()=>{(async()=>{if(t?.uid){p(!0);try{const S=await dt(t.uid);c(S)}catch(S){console.error("Failed loading admin settings:",S),T.error("Failed to load admin settings")}finally{p(!1)}}})()},[t?.uid]);const u=b=>{c(S=>({...S,adminPanel:{...S.adminPanel,...b}}))},C=async()=>{if(t?.uid){f(!0);try{const b=await ot(t.uid,s);c(b),T.success("Admin settings updated")}catch(b){console.error("Failed saving admin settings:",b),T.error("Failed to save admin settings")}finally{f(!1)}}};return e.jsx(L.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"space-y-6",children:e.jsxs("div",{className:"grid grid-cols-12 gap-6",children:[e.jsx("div",{className:"col-span-12 md:col-span-3",children:e.jsx("div",{className:"bg-white rounded-xl shadow-sm border border-[#dde3eb] overflow-hidden",children:e.jsx("nav",{className:"flex flex-col py-2",children:o.map(b=>{const S=b.icon,g=a===b.id;return e.jsxs("button",{onClick:()=>i(b.id),className:`flex items-center gap-3 px-4 py-3 text-sm font-medium transition-all relative ${g?"text-sky-600 bg-sky-50/50":"text-[#5a6578] hover:bg-[#edf1f7] hover:text-[#0a1628]"}`,children:[g&&e.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-1 bg-sky-600 rounded-r-full"}),e.jsx(S,{size:18,className:g?"text-sky-600":"text-slate-500"}),b.label]},b.id)})})})}),e.jsx("div",{className:"col-span-12 md:col-span-9",children:e.jsx(L.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.2},className:"space-y-6",children:e.jsx("div",{className:"bg-white rounded-xl shadow-sm border border-[#dde3eb] p-6",children:d?e.jsx("p",{className:"text-sm text-[#5a6578]",children:"Loading settings..."}):e.jsxs(e.Fragment,{children:[a==="General"&&e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-sm font-medium text-[#0a1628]",children:"Site Name"}),e.jsx(R,{value:s.adminPanel.siteName,onChange:b=>u({siteName:b.target.value}),className:"bg-white"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-sm font-medium text-[#0a1628]",children:"Site Description"}),e.jsx("textarea",{className:"w-full min-h-[80px] px-3 py-2 rounded-xl border border-[#dde3eb] bg-white text-sm focus:outline-none focus:ring-2 focus:ring-sky-500/20 placeholder:text-slate-500 resize-none",value:s.adminPanel.siteDescription,onChange:b=>u({siteDescription:b.target.value})})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-sm font-medium text-[#0a1628]",children:"Default Language"}),e.jsxs("div",{className:"relative",children:[e.jsxs("select",{value:s.adminPanel.defaultLanguage,onChange:b=>u({defaultLanguage:b.target.value}),className:"w-full px-3 py-2 rounded-xl border border-[#dde3eb] bg-white text-sm appearance-none focus:outline-none focus:ring-2 focus:ring-sky-500/20",children:[e.jsx("option",{children:"English"}),e.jsx("option",{children:"Spanish"}),e.jsx("option",{children:"French"}),e.jsx("option",{children:"German"})]}),e.jsx(jt,{size:16,className:"absolute right-3 top-1/2 -translate-y-1/2 text-slate-500 pointer-events-none"})]})]}),e.jsxs("div",{className:"mt-6 p-4 bg-red-50 border border-red-100 rounded-xl flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"p-2 bg-white rounded-lg text-red-600 shadow-sm border border-red-100",children:e.jsx(Ot,{size:18})}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-red-900",children:"Maintenance Mode"}),e.jsx("p",{className:"text-xs text-red-700 mt-0.5",children:"Temporarily disable access for non-admins"})]})]}),e.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[e.jsx("input",{type:"checkbox",className:"sr-only peer",checked:s.adminPanel.maintenanceMode,onChange:()=>u({maintenanceMode:!s.adminPanel.maintenanceMode})}),e.jsx("div",{className:"w-11 h-6 bg-[#dde3eb] peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-red-300 rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-[#dde3eb] after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-red-600"})]})]})]}),a==="Security"&&e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"flex items-center justify-between py-3 border-b border-[#dde3eb]",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628]",children:"Enforce Strong Passwords"}),e.jsx("p",{className:"text-xs text-slate-500",children:"Require stronger passwords for all users"})]}),e.jsx("input",{type:"checkbox",checked:s.adminPanel.enforceStrongPasswords,onChange:()=>u({enforceStrongPasswords:!s.adminPanel.enforceStrongPasswords})})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-sm font-medium text-[#0a1628]",children:"Session Timeout (minutes)"}),e.jsx(R,{type:"number",value:s.adminPanel.sessionTimeoutMinutes,onChange:b=>u({sessionTimeoutMinutes:Number(b.target.value||0)}),className:"max-w-xs"})]})]}),a==="AI Features"&&e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"flex items-center justify-between py-3 border-b border-[#dde3eb]",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628]",children:"AI Tutor"}),e.jsx("p",{className:"text-xs text-slate-500",children:"Enable AI tutoring experience"})]}),e.jsx("input",{type:"checkbox",checked:s.adminPanel.aiTutorEnabled,onChange:()=>u({aiTutorEnabled:!s.adminPanel.aiTutorEnabled})})]}),e.jsxs("div",{className:"flex items-center justify-between py-3 border-b border-[#dde3eb]",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628]",children:"Auto Recommendations"}),e.jsx("p",{className:"text-xs text-slate-500",children:"Enable AI-generated recommendations"})]}),e.jsx("input",{type:"checkbox",checked:s.adminPanel.aiAutoRecommendations,onChange:()=>u({aiAutoRecommendations:!s.adminPanel.aiAutoRecommendations})})]}),e.jsxs("div",{className:"flex items-center justify-between py-3 border-b border-[#dde3eb]",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628]",children:"Risk Alerts"}),e.jsx("p",{className:"text-xs text-slate-500",children:"Send proactive risk alerts for at-risk learners"})]}),e.jsx("input",{type:"checkbox",checked:s.adminPanel.aiRiskAlertsEnabled,onChange:()=>u({aiRiskAlertsEnabled:!s.adminPanel.aiRiskAlertsEnabled})})]})]}),a==="Academic"&&e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-sm font-medium text-[#0a1628]",children:"Grading Scale"}),e.jsxs("div",{className:"relative max-w-xs",children:[e.jsxs("select",{value:s.adminPanel.gradingScale,onChange:b=>u({gradingScale:b.target.value}),className:"w-full px-3 py-2 rounded-xl border border-[#dde3eb] bg-white text-sm appearance-none focus:outline-none focus:ring-2 focus:ring-sky-500/20",children:[e.jsx("option",{value:"percentage",children:"Percentage"}),e.jsx("option",{value:"gpa",children:"GPA"})]}),e.jsx(Vt,{size:16,className:"absolute right-3 top-1/2 -translate-y-1/2 text-slate-500 pointer-events-none"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-sm font-medium text-[#0a1628]",children:"Passing Grade"}),e.jsx(R,{type:"number",value:s.adminPanel.passingGrade,onChange:b=>u({passingGrade:Number(b.target.value||0)}),className:"max-w-xs"})]})]}),a==="Notifications"&&e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"flex items-center justify-between py-3 border-b border-[#dde3eb]",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628]",children:"Parent Summary Emails"}),e.jsx("p",{className:"text-xs text-slate-500",children:"Weekly summaries for guardians"})]}),e.jsx("input",{type:"checkbox",checked:s.adminPanel.parentSummaryEmails,onChange:()=>u({parentSummaryEmails:!s.adminPanel.parentSummaryEmails})})]}),e.jsxs("div",{className:"flex items-center justify-between py-3 border-b border-[#dde3eb]",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628]",children:"Teacher Digest Emails"}),e.jsx("p",{className:"text-xs text-slate-500",children:"Daily teacher performance digest"})]}),e.jsx("input",{type:"checkbox",checked:s.adminPanel.teacherDigestEmails,onChange:()=>u({teacherDigestEmails:!s.adminPanel.teacherDigestEmails})})]}),e.jsxs("div",{className:"flex items-center justify-between py-3 border-b border-[#dde3eb]",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628]",children:"Weekly Platform Report"}),e.jsx("p",{className:"text-xs text-slate-500",children:"System report for administrators"})]}),e.jsx("input",{type:"checkbox",checked:s.adminPanel.weeklyPlatformReport,onChange:()=>u({weeklyPlatformReport:!s.adminPanel.weeklyPlatformReport})})]})]}),a==="Backup & Data"&&e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"flex items-center justify-between py-3 border-b border-[#dde3eb]",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628]",children:"Automatic Backups"}),e.jsx("p",{className:"text-xs text-slate-500",children:"Create scheduled backups of platform data"})]}),e.jsx("input",{type:"checkbox",checked:s.adminPanel.autoBackupEnabled,onChange:()=>u({autoBackupEnabled:!s.adminPanel.autoBackupEnabled})})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-sm font-medium text-[#0a1628]",children:"Backup Frequency"}),e.jsxs("select",{value:s.adminPanel.backupFrequency,onChange:b=>u({backupFrequency:b.target.value}),className:"w-full max-w-xs px-3 py-2 rounded-xl border border-[#dde3eb] bg-white text-sm appearance-none focus:outline-none focus:ring-2 focus:ring-sky-500/20",children:[e.jsx("option",{value:"daily",children:"Daily"}),e.jsx("option",{value:"weekly",children:"Weekly"}),e.jsx("option",{value:"monthly",children:"Monthly"})]})]})]}),e.jsx("div",{className:"mt-8 pt-6 border-t border-[#dde3eb] flex justify-end",children:e.jsxs(E,{className:"bg-sky-600 hover:bg-sky-700 text-white gap-2",onClick:C,disabled:j,children:[e.jsx(vt,{size:16}),j?"Saving...":"Save Changes"]})})]})})})})]})})};function us({className:t,...a}){return e.jsx(at,{"data-slot":"avatar",className:G("relative flex size-10 shrink-0 overflow-hidden rounded-full",t),...a})}function ps({className:t,...a}){return e.jsx(lt,{"data-slot":"avatar-image",className:G("aspect-square size-full",t),...a})}function gs({className:t,...a}){return e.jsx(rt,{"data-slot":"avatar-fallback",className:G("bg-muted flex size-full items-center justify-center rounded-full",t),...a})}const fs=()=>{const{userProfile:t}=Se(),[a,i]=x.useState([]),[s,c]=x.useState(!0),[d,p]=x.useState(!1),[j,f]=x.useState(!1),[o,u]=x.useState(""),[C,b]=x.useState("All Roles"),[S,g]=x.useState("All Status"),[v,y]=x.useState(!1),[I,N]=x.useState(!1),[h,r]=x.useState(null),[w,D]=x.useState(null),[m,k]=x.useState({name:"",email:"",role:"Student",status:"Active",department:"",grade:"Grade 11",section:"Section A",lrn:""}),U=x.useCallback(async()=>{c(!0);try{const l=await es();i(l)}catch{T.error("Failed to load users")}finally{c(!1)}},[]);x.useEffect(()=>{U()},[U]);const _=()=>{D(null),k({name:"",email:"",role:"Student",status:"Active",department:"",grade:"Grade 11",section:"Section A",lrn:""}),y(!0)},oe=l=>{D(l),k({name:l.name,email:l.email,role:l.role,status:l.status,department:l.department,grade:l.grade||"Grade 11",section:l.section||"Section A",lrn:l.lrn||""}),y(!0)},xe=async()=>{if(!m.name.trim()||!m.email.trim()){T.error("Name and email are required");return}p(!0);try{w?(await ze(w.id,m),await Q("User Updated","User","Info",`Updated user: ${m.name} (${m.email})`,{name:t?.name||"Admin",role:"Admin",avatar:t?.photo||null}),T.success("User updated successfully")):(await ss(m.email,m.name,m.role,m.role==="Student"?m.grade:m.department,m.role==="Student"?{grade:m.grade,section:m.section,lrn:m.lrn}:void 0),await Q("Created New User","User","Info",`Created new ${m.role.toLowerCase()} account: ${m.name} (${m.email})`,{name:t?.name||"Admin",role:"Admin",avatar:t?.photo||null}),T.success("User created successfully")),await U(),y(!1)}catch(l){T.error(l instanceof Error?l.message:"Failed to save user")}finally{p(!1)}},me=(l,P)=>{r({id:l,name:P}),N(!0)},he=async()=>{if(!(!h||j)){f(!0);try{await ts(h.id),await Q("User Deleted","User","Warning",`Deleted user account: ${h.name}`,{name:t?.name||"Admin",role:"Admin",avatar:t?.photo||null}),T.success("User deleted"),i(l=>l.filter(P=>P.id!==h.id)),N(!1),r(null)}catch{T.error("Failed to delete user")}finally{f(!1)}}},ue=async l=>{const P=l.status==="Active"?"Inactive":"Active";try{await ze(l.id,{status:P}),await Q("User Status Changed","User","Warning",`${P==="Active"?"Activated":"Deactivated"} user: ${l.email}`,{name:t?.name||"Admin",role:"Admin",avatar:t?.photo||null}),T.success(`User ${P==="Active"?"activated":"deactivated"}`),i(K=>K.map(q=>q.id===l.id?{...q,status:P}:q))}catch{T.error("Failed to update user status")}},te=a.filter(l=>{const P=l.name.toLowerCase().includes(o.toLowerCase())||l.email.toLowerCase().includes(o.toLowerCase()),K=C==="All Roles"||l.role===C,q=S==="All Status"||l.status===S;return P&&K&&q}),pe=[{label:"Total Users",value:a.length,color:"text-[#0a1628]"},{label:"Active",value:a.filter(l=>l.status==="Active").length,color:"text-green-600"},{label:"Admins",value:a.filter(l=>l.role==="Admin").length,color:"text-sky-600"},{label:"Teachers",value:a.filter(l=>l.role==="Teacher").length,color:"text-sky-600"},{label:"Students",value:a.filter(l=>l.role==="Student").length,color:"text-emerald-600"}];return e.jsxs("div",{className:"space-y-6",children:[s?e.jsx("div",{className:"flex items-center justify-center h-32",children:e.jsx(F,{size:28,className:"animate-spin text-sky-500"})}):null,e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-5 gap-4",children:pe.map((l,P)=>e.jsxs("div",{className:"bg-white p-4 rounded-xl border border-[#dde3eb] shadow-sm",children:[e.jsx("h3",{className:`text-2xl font-bold ${l.color}`,children:l.value}),e.jsx("p",{className:"text-sm text-[#5a6578]",children:l.label})]},P))}),e.jsxs("div",{className:"bg-white p-4 rounded-xl border border-[#dde3eb] shadow-sm space-y-4",children:[e.jsxs("div",{className:"relative",children:[e.jsx(Ae,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500",size:18}),e.jsx(R,{placeholder:"Search users by name or email...",className:"pl-10 bg-[#edf1f7] border-[#dde3eb]",value:o,onChange:l=>u(l.target.value)})]}),e.jsxs("div",{className:"flex flex-col md:flex-row justify-between gap-4",children:[e.jsxs("div",{className:"flex gap-3",children:[e.jsxs(V,{value:C,onValueChange:b,children:[e.jsx(H,{className:"w-[140px] bg-[#edf1f7] border-[#dde3eb]",children:e.jsx(W,{placeholder:"All Roles"})}),e.jsxs(X,{children:[e.jsx(A,{value:"All Roles",children:"All Roles"}),e.jsx(A,{value:"Admin",children:"Admin"}),e.jsx(A,{value:"Teacher",children:"Teacher"}),e.jsx(A,{value:"Student",children:"Student"})]})]}),e.jsxs(V,{value:S,onValueChange:g,children:[e.jsx(H,{className:"w-[140px] bg-[#edf1f7] border-[#dde3eb]",children:e.jsx(W,{placeholder:"All Status"})}),e.jsxs(X,{children:[e.jsx(A,{value:"All Status",children:"All Status"}),e.jsx(A,{value:"Active",children:"Active"}),e.jsx(A,{value:"Inactive",children:"Inactive"})]})]})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs(E,{variant:"outline",className:"gap-2 border-[#dde3eb] text-[#5a6578]",onClick:U,children:[e.jsx(ke,{size:16}),"Refresh"]}),e.jsxs(E,{className:"gap-2 bg-sky-500 hover:bg-sky-600 text-white",onClick:_,children:[e.jsx(Ee,{size:16}),"Add User"]})]})]})]}),e.jsx("div",{className:"bg-white rounded-xl border border-[#dde3eb] shadow-sm overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm text-left",children:[e.jsx("thead",{className:"text-xs text-[#5a6578] uppercase bg-[#edf1f7] border-b border-[#dde3eb]",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-4 font-semibold",children:"User"}),e.jsx("th",{className:"px-6 py-4 font-semibold",children:"Role"}),e.jsx("th",{className:"px-6 py-4 font-semibold",children:"Status"}),e.jsx("th",{className:"px-6 py-4 font-semibold",children:"Class/Department"}),e.jsx("th",{className:"px-6 py-4 font-semibold",children:"Last Login"}),e.jsx("th",{className:"px-6 py-4 font-semibold text-right",children:"Actions"})]})}),e.jsx("tbody",{className:"divide-y divide-[#dde3eb]",children:te.length>0?te.map(l=>e.jsxs("tr",{className:"hover:bg-[#edf1f7]/50 transition-colors",children:[e.jsx("td",{className:"px-6 py-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs(us,{children:[e.jsx(ps,{src:l.photo}),e.jsx(gs,{children:l.name.charAt(0)})]}),e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold text-[#0a1628]",children:l.name}),e.jsx("p",{className:"text-xs text-[#5a6578]",children:l.email})]})]})}),e.jsx("td",{className:"px-6 py-4",children:e.jsxs("div",{className:"flex items-center gap-1.5",children:[l.role==="Admin"&&e.jsx(Z,{size:14,className:"text-sky-600"}),l.role==="Teacher"&&e.jsx(Ce,{size:14,className:"text-sky-600"}),l.role==="Student"&&e.jsx(Ft,{size:14,className:"text-emerald-600"}),e.jsx("span",{className:`
52
- font-medium text-xs px-2 py-0.5 rounded-full
53
- ${l.role==="Admin"?"bg-sky-100 text-sky-700":""}
54
- ${l.role==="Teacher"?"bg-sky-100 text-sky-700":""}
55
- ${l.role==="Student"?"bg-emerald-100 text-emerald-700":""}
56
- `,children:l.role})]})}),e.jsx("td",{className:"px-6 py-4",children:e.jsxs("span",{className:`
57
- inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium border
58
- ${l.status==="Active"?"bg-green-50 text-green-700 border-green-200":"bg-[#edf1f7] text-[#5a6578] border-[#dde3eb]"}
59
- `,children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${l.status==="Active"?"bg-green-500":"bg-[#a8a5b3]"}`}),l.status]})}),e.jsx("td",{className:"px-6 py-4 text-[#5a6578]",children:l.role==="Student"&&l.classSection||l.department}),e.jsx("td",{className:"px-6 py-4 text-[#5a6578]",children:l.lastLogin}),e.jsx("td",{className:"px-6 py-4 text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx("button",{onClick:()=>oe(l),className:"p-1.5 text-slate-500 hover:text-sky-600 hover:bg-sky-50 rounded-lg transition-colors",children:e.jsx(_t,{size:16})}),e.jsx("button",{onClick:()=>ue(l),className:`p-1.5 rounded-lg transition-colors ${l.status==="Active"?"text-slate-500 hover:text-orange-600 hover:bg-orange-50":"text-orange-500 hover:text-green-600 hover:bg-green-50"}`,title:l.status==="Active"?"Deactivate User":"Activate User",children:l.status==="Active"?e.jsx(zt,{size:16}):e.jsx(Wt,{size:16})}),e.jsx("button",{onClick:()=>me(l.id,l.name),className:"p-1.5 text-slate-500 hover:text-red-600 hover:bg-red-50 rounded-lg transition-colors",children:e.jsx(je,{size:16})})]})})]},l.id)):e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"px-6 py-12 text-center text-[#5a6578]",children:e.jsxs("div",{className:"flex flex-col items-center gap-3",children:[e.jsx("div",{className:"p-3 bg-[#edf1f7] rounded-full",children:e.jsx(de,{size:24,className:"text-slate-500"})}),e.jsx("p",{children:"No users found matching your filters"})]})})})})]})})}),e.jsx(Ue,{open:v,onOpenChange:y,children:e.jsxs(Fe,{className:"sm:max-w-[425px]",children:[e.jsxs(Be,{children:[e.jsx(Ge,{children:w?"Edit User Access":"Add New User"}),e.jsx(_e,{children:w?"Update user details and manage access permissions.":"Create a new user account and assign roles."})]}),e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[e.jsx("label",{htmlFor:"name",className:"text-right text-sm font-medium text-[#0a1628]",children:"Name"}),e.jsx(R,{id:"name",value:m.name,onChange:l=>k({...m,name:l.target.value}),className:"col-span-3"})]}),e.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[e.jsx("label",{htmlFor:"email",className:"text-right text-sm font-medium text-[#0a1628]",children:"Email"}),e.jsx(R,{id:"email",type:"email",value:m.email,onChange:l=>k({...m,email:l.target.value}),className:"col-span-3"})]}),e.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[e.jsx("label",{htmlFor:"role",className:"text-right text-sm font-medium text-[#0a1628]",children:"Role"}),e.jsx("div",{className:"col-span-3",children:e.jsxs(V,{value:m.role,onValueChange:l=>k({...m,role:l}),children:[e.jsx(H,{children:e.jsx(W,{placeholder:"Select role"})}),e.jsxs(X,{children:[e.jsx(A,{value:"Student",children:"Student"}),e.jsx(A,{value:"Teacher",children:"Teacher"}),e.jsx(A,{value:"Admin",children:"Admin"})]})]})})]}),e.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[e.jsx("label",{htmlFor:"status",className:"text-right text-sm font-medium text-[#0a1628]",children:"Status"}),e.jsx("div",{className:"col-span-3",children:e.jsxs(V,{value:m.status,onValueChange:l=>k({...m,status:l}),children:[e.jsx(H,{children:e.jsx(W,{placeholder:"Select status"})}),e.jsxs(X,{children:[e.jsx(A,{value:"Active",children:"Active"}),e.jsx(A,{value:"Inactive",children:"Inactive"})]})]})})]}),m.role==="Student"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[e.jsx("label",{htmlFor:"lrn",className:"text-right text-sm font-medium text-[#0a1628]",children:"LRN"}),e.jsx(R,{id:"lrn",value:m.lrn,onChange:l=>k({...m,lrn:l.target.value}),placeholder:"12-digit learner reference",className:"col-span-3"})]}),e.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[e.jsx("label",{htmlFor:"grade",className:"text-right text-sm font-medium text-[#0a1628]",children:"Grade"}),e.jsx(R,{id:"grade",value:m.grade,onChange:l=>k({...m,grade:l.target.value}),placeholder:"e.g. Grade 11",className:"col-span-3"})]}),e.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[e.jsx("label",{htmlFor:"section",className:"text-right text-sm font-medium text-[#0a1628]",children:"Section"}),e.jsx(R,{id:"section",value:m.section,onChange:l=>k({...m,section:l.target.value}),placeholder:"e.g. STEM A",className:"col-span-3"})]})]}):e.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[e.jsx("label",{htmlFor:"department",className:"text-right text-sm font-medium text-[#0a1628]",children:"Department"}),e.jsx(R,{id:"department",value:m.department,onChange:l=>k({...m,department:l.target.value}),placeholder:"e.g. Mathematics",className:"col-span-3"})]})]}),e.jsxs(Oe,{children:[e.jsx(E,{variant:"outline",onClick:()=>y(!1),disabled:d,children:"Cancel"}),e.jsxs(E,{onClick:xe,className:"bg-sky-600 hover:bg-sky-700 text-white",disabled:d,children:[d?e.jsx(F,{size:16,className:"animate-spin mr-2"}):null,w?"Save Changes":"Create User"]})]})]})}),e.jsx(Ne,{isOpen:I,onClose:()=>{j||(N(!1),r(null))},onConfirm:he,title:"Delete User?",message:h?`Delete user "${h.name}"? This cannot be undone.`:"Delete this user? This cannot be undone.",confirmText:j?"Deleting...":"Delete",cancelText:"Cancel",type:"danger",icon:"delete"})]})},Y=({icon:t,title:a,subtitle:i})=>e.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 py-10 text-center",children:[e.jsx("div",{className:"w-12 h-12 rounded-full bg-[#edf1f7] flex items-center justify-center",children:t}),e.jsx("p",{className:"text-sm font-semibold text-[#5a6578]",children:a}),i&&e.jsx("p",{className:"text-xs text-[#a0aec0] max-w-xs",children:i})]}),bs=()=>{const[t,a]=x.useState("30d"),[i,s]=x.useState(null),[c,d]=x.useState(!0);x.useEffect(()=>{ds().then(s).catch(console.error).finally(()=>d(!1))},[]);const p={"7d":"Last 7 Days","30d":"Last 30 Days","90d":"Last 90 Days","12m":"Last 12 Months"},j=[{label:"Total Active Users",value:c?null:(i?.totalActiveUsers??0).toLocaleString(),icon:de,color:"from-sky-500 to-blue-600"},{label:"Avg. Completion Rate",value:null,icon:$e,color:"from-teal-500 to-emerald-600"},{label:"Avg. Session Duration",value:null,icon:yt,color:"from-violet-500 to-purple-600"},{label:"At-Risk Students",value:c?null:(i?.atRiskStudents??0).toString(),icon:Me,color:"from-rose-500 to-orange-600"}],f=[{label:"Achievements Unlocked",icon:re,color:"text-rose-600",bg:"bg-rose-50",value:c?null:(i?.achievementsUnlocked??0).toLocaleString()},{label:"XP Earned (Platform)",icon:Ie,color:"text-violet-600",bg:"bg-violet-50",value:c?null:(i?.totalXPEarned??0)>=1e6?`${((i?.totalXPEarned??0)/1e6).toFixed(1)}M`:(i?.totalXPEarned??0)>=1e3?`${Math.round((i?.totalXPEarned??0)/1e3)}K`:(i?.totalXPEarned??0).toLocaleString()},{label:"Active Streaks",icon:xt,color:"text-orange-600",bg:"bg-orange-50",value:c?null:(i?.activeStreaks??0).toLocaleString()},{label:"AI Tutor Sessions",icon:Nt,color:"text-sky-600",bg:"bg-sky-50",value:c?null:(i?.aiTutorSessions??0).toLocaleString()}];return e.jsxs("div",{className:"space-y-6",children:[e.jsxs(L.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{duration:.3},className:"flex items-center justify-between",children:[e.jsx("div",{className:"flex items-center gap-2 bg-white rounded-xl p-1 shadow-sm border border-[#dde3eb]",children:Object.entries(p).map(([o,u])=>e.jsx("button",{onClick:()=>a(o),className:`px-4 py-2 rounded-lg text-sm font-semibold transition-all ${t===o?"bg-sky-600 text-white shadow-sm":"text-[#5a6578] hover:bg-[#edf1f7]"}`,children:u},o))}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(E,{variant:"outline",disabled:!0,className:"px-4 py-2 gap-2 rounded-xl border-[#dde3eb] font-semibold text-sm opacity-50 cursor-not-allowed",children:[e.jsx(wt,{size:16}),"Filters"]}),e.jsxs(E,{variant:"outline",disabled:!0,className:"px-4 py-2 gap-2 rounded-xl border-[#dde3eb] font-semibold text-sm opacity-50 cursor-not-allowed",children:[e.jsx(kt,{size:16}),"Export"]})]})]}),!c&&!i?.totalActiveUsers&&e.jsxs(L.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.35},className:"flex items-center gap-3 bg-rose-50 border border-rose-200 rounded-2xl px-5 py-4",children:[e.jsx(ee,{size:18,className:"text-rose-600 shrink-0"}),e.jsxs("p",{className:"text-sm text-rose-800",children:[e.jsx("span",{className:"font-semibold",children:"Limited analytics data."})," ","KPI cards will populate automatically as students, quizzes, and sessions accumulate in the platform. Chart visualisations require time-series data."]})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-4 gap-4",children:j.map((o,u)=>{const C=o.icon;return e.jsxs(L.div,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{duration:.35,delay:u*.06},className:"bg-white rounded-2xl p-5 shadow-sm border border-[#dde3eb]",children:[e.jsxs("div",{className:"flex items-start justify-between mb-3",children:[e.jsx("div",{className:`w-11 h-11 rounded-xl bg-gradient-to-br ${o.color} flex items-center justify-center shadow-sm`,children:e.jsx(C,{size:20,className:"text-white"})}),e.jsx("div",{className:"w-[120px] h-8 rounded bg-[#f0f3f8]"})]}),c?e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(F,{size:16,className:"animate-spin text-[#a0aec0]"}),e.jsx("div",{className:"w-14 h-6 bg-[#edf1f7] rounded-lg animate-pulse"})]}):o.value!==null?e.jsx("p",{className:"text-2xl font-bold text-[#0a1628] mb-2",children:o.value}):e.jsx("div",{className:"w-16 h-7 bg-[#edf1f7] rounded-lg mb-2"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"text-sm text-[#5a6578] font-medium",children:o.label}),e.jsx("span",{className:"text-xs text-[#a0aec0] font-medium",children:o.value===null?"โ€”":p[t]})]})]},o.label)})}),e.jsxs("div",{className:"grid grid-cols-12 gap-6",children:[e.jsxs(L.div,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{duration:.4,delay:.15},className:"col-span-8 bg-white rounded-2xl p-6 shadow-sm border border-[#dde3eb]",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-bold text-[#0a1628]",children:"Performance Trends"}),e.jsx("p",{className:"text-sm text-[#5a6578]",children:"Average scores โ€” students vs. teacher targets"})]}),e.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-3 h-3 rounded-full bg-sky-300"}),e.jsx("span",{className:"text-[#a0aec0] font-medium",children:"Students"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-3 h-3 rounded-full bg-violet-300"}),e.jsx("span",{className:"text-[#a0aec0] font-medium",children:"Teacher Targets"})]})]})]}),e.jsx(Y,{icon:e.jsx(ye,{size:24,className:"text-[#c2cad8]"}),title:"No performance data yet",subtitle:"Import student and class records to generate trend charts."})]}),e.jsxs(L.div,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{duration:.4,delay:.2},className:"col-span-4 bg-white rounded-2xl p-6 shadow-sm border border-[#dde3eb]",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx("div",{className:"w-10 h-10 bg-violet-100 rounded-xl flex items-center justify-center",children:e.jsx(It,{size:20,className:"text-violet-400"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-bold text-[#0a1628]",children:"Grade Distribution"}),e.jsx("p",{className:"text-xs text-[#5a6578]",children:"All students, current term"})]})]}),e.jsx(Y,{icon:e.jsx(ee,{size:24,className:"text-[#c2cad8]"}),title:"No grade data",subtitle:"Import quiz and assessment results to see grade breakdowns."})]})]}),e.jsxs("div",{className:"grid grid-cols-12 gap-6",children:[e.jsxs(L.div,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{duration:.4,delay:.25},className:"col-span-7 bg-white rounded-2xl p-6 shadow-sm border border-[#dde3eb]",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx("div",{className:"w-10 h-10 bg-sky-100 rounded-xl flex items-center justify-center",children:e.jsx(O,{size:20,className:"text-sky-400"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-bold text-[#0a1628]",children:"Subject Engagement"}),e.jsx("p",{className:"text-xs text-[#5a6578]",children:"Enrollment, completion, and average scores"})]})]}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-[#dde3eb]",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-[#f7f9fc]",children:[e.jsx("th",{className:"text-left text-xs font-semibold text-[#5a6578] px-4 py-3",children:"Subject"}),e.jsx("th",{className:"text-right text-xs font-semibold text-[#5a6578] px-4 py-3",children:"Enrolled"}),e.jsx("th",{className:"text-right text-xs font-semibold text-[#5a6578] px-4 py-3",children:"Completion"}),e.jsx("th",{className:"text-right text-xs font-semibold text-[#5a6578] px-4 py-3",children:"Avg. Score"}),e.jsx("th",{className:"text-left text-xs font-semibold text-[#5a6578] px-4 py-3 w-36",children:"Progress"})]})}),e.jsx("tbody",{children:e.jsx("tr",{children:e.jsx("td",{colSpan:5,className:"px-4 py-10",children:e.jsx(Y,{icon:e.jsx(ee,{size:22,className:"text-[#c2cad8]"}),title:"No subject data available",subtitle:"Import class enrollment records to view subject engagement."})})})})]})})]}),e.jsxs(L.div,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{duration:.4,delay:.3},className:"col-span-5 bg-white rounded-2xl p-6 shadow-sm border border-[#dde3eb]",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx("div",{className:"w-10 h-10 bg-orange-100 rounded-xl flex items-center justify-center",children:e.jsx(ve,{size:20,className:"text-orange-400"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-bold text-[#0a1628]",children:"Weekly Activity"}),e.jsx("p",{className:"text-xs text-[#5a6578]",children:"Sessions per day of week"})]})]}),e.jsx(Y,{icon:e.jsx(Me,{size:24,className:"text-[#c2cad8]"}),title:"No session activity yet",subtitle:"Student logins and session data will appear here after data is imported."})]})]}),e.jsxs("div",{className:"grid grid-cols-12 gap-6",children:[e.jsxs(L.div,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{duration:.4,delay:.35},className:"col-span-5 bg-white rounded-2xl p-6 shadow-sm border border-[#dde3eb]",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx("div",{className:"w-10 h-10 bg-rose-100 rounded-xl flex items-center justify-center",children:e.jsx(re,{size:20,className:"text-rose-400"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-bold text-[#0a1628]",children:"Gamification Overview"}),e.jsx("p",{className:"text-xs text-[#5a6578]",children:"Engagement & motivation metrics"})]})]}),e.jsx("div",{className:"grid grid-cols-2 gap-3",children:f.map(o=>{const u=o.icon;return e.jsxs("div",{className:`${o.bg} border border-[#dde3eb] rounded-xl p-4`,children:[e.jsx(u,{size:20,className:o.color}),c?e.jsx("div",{className:"w-12 h-5 bg-white/60 rounded mt-2 mb-1 animate-pulse"}):o.value!==null?e.jsx("p",{className:"text-lg font-bold text-[#0a1628] mt-2 mb-1",children:o.value}):e.jsx("div",{className:"w-12 h-5 bg-white/60 rounded mt-2 mb-1"}),e.jsx("p",{className:"text-xs text-[#5a6578] font-medium",children:o.label}),!c&&o.value===null&&e.jsx("p",{className:"text-[10px] text-[#a0aec0] mt-1",children:"No data yet"})]},o.label)})})]}),e.jsxs(L.div,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{duration:.4,delay:.4},className:"col-span-7 bg-white rounded-2xl p-6 shadow-sm border border-[#dde3eb]",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx("div",{className:"w-10 h-10 bg-teal-100 rounded-xl flex items-center justify-center",children:e.jsx(Ce,{size:20,className:"text-teal-400"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-bold text-[#0a1628]",children:"Top Performing Classes"}),e.jsx("p",{className:"text-xs text-[#5a6578]",children:"Ranked by average score this term"})]})]}),e.jsx(Y,{icon:e.jsx(ee,{size:24,className:"text-[#c2cad8]"}),title:"No class data yet",subtitle:"Import class and student records to see top performers ranked here."})]})]})]})},se=[{id:"gen-math",name:"Gen Math",shortName:"GM",color:"#3B82F6"},{id:"stats-prob",name:"Stats & Prob",shortName:"SP",color:"#0ea5e9"},{id:"pre-calc",name:"Pre-Calc",shortName:"PC",color:"#F97316"},{id:"basic-calc",name:"Basic Calc",shortName:"BC",color:"#EF4444"}],fe={"gen-math":[{name:"Functions & Relations",unit:"Functions"},{name:"Rational Functions",unit:"Functions"},{name:"Exponential Functions",unit:"Functions"},{name:"Logarithmic Functions",unit:"Functions"},{name:"Simple Interest",unit:"Business Math"},{name:"Compound Interest",unit:"Business Math"},{name:"Annuities",unit:"Business Math"},{name:"Propositions",unit:"Logic"},{name:"Truth Tables",unit:"Logic"}],"stats-prob":[{name:"Random Variables",unit:"Random Variables"},{name:"Probability Distributions",unit:"Random Variables"},{name:"Normal Distribution",unit:"Normal Dist"},{name:"Z-scores",unit:"Normal Dist"},{name:"Sampling Distributions",unit:"Sampling"},{name:"Central Limit Theorem",unit:"Sampling"},{name:"Confidence Intervals",unit:"Estimation"},{name:"Hypothesis Testing",unit:"Testing"},{name:"Correlation",unit:"Regression"}],"pre-calc":[{name:"Parabola",unit:"Conics"},{name:"Ellipse",unit:"Conics"},{name:"Hyperbola",unit:"Conics"},{name:"Arithmetic Seq",unit:"Series"},{name:"Geometric Seq",unit:"Series"},{name:"Math Induction",unit:"Series"},{name:"Trig Functions",unit:"Trigonometry"},{name:"Trig Identities",unit:"Trigonometry"},{name:"Polar Coords",unit:"Trigonometry"}],"basic-calc":[{name:"Limits",unit:"Limits"},{name:"Continuity",unit:"Limits"},{name:"Definition of Deriv.",unit:"Derivatives"},{name:"Diff. Rules",unit:"Derivatives"},{name:"Chain Rule",unit:"Derivatives"},{name:"Related Rates",unit:"Derivatives"},{name:"Optimization",unit:"Derivatives"},{name:"Antiderivatives",unit:"Integration"},{name:"Definite Integrals",unit:"Integration"}]};function js(t){return t>=85?"bg-emerald-500":t>=70?"bg-emerald-300":t>=55?"bg-rose-300":t>=40?"bg-orange-400":t>=20?"bg-red-400":"bg-red-600"}function vs(t){return t>=70||t>=40,"text-white"}const ys=({title:t="Platform-Wide Subject Mastery"})=>{const[a,i]=x.useState(null),[s,c]=x.useState("all"),[d,p]=x.useState([]),[j,f]=x.useState(!0);x.useEffect(()=>{(async()=>{f(!0);try{const v=await $(z(M,"progress")),y={};v.forEach(N=>{const r=N.data().subjects||{};for(const[w,D]of Object.entries(r)){const m=fe[w]||[],k=D?.progress??0;for(const U of m){const _=`${w}::${U.name}`;y[_]||(y[_]={totalMastery:0,count:0}),y[_].totalMastery+=k,y[_].count+=1}}});const I=[];for(const N of se){const h=fe[N.id]||[];for(const r of h){const w=`${N.id}::${r.name}`,D=y[w];I.push({subject:N.id,topic:r.name,mastery:D&&D.count>0?Math.round(D.totalMastery/D.count):0,students:D?.count??0})}}p(I)}catch(v){console.error("[MasteryHeatmap] Error fetching progress data:",v)}finally{f(!1)}})()},[]);const o=s==="all"?se:se.filter(g=>g.id===s),u=d.filter(g=>g.students>0),C=u.length>0?Math.round(u.reduce((g,v)=>g+v.mastery,0)/u.length):0,b=u.length>0?u.reduce((g,v)=>v.mastery<g.mastery?v:g,u[0]):null,S=u.length>0?u.reduce((g,v)=>v.mastery>g.mastery?v:g,u[0]):null;return j?e.jsx("div",{className:"bg-white rounded-3xl p-6 shadow-sm border border-[#dde3eb] flex items-center justify-center min-h-[200px]",children:e.jsxs("div",{className:"flex flex-col items-center gap-3",children:[e.jsx(F,{size:28,className:"text-sky-500 animate-spin"}),e.jsx("p",{className:"text-sm text-[#5a6578]",children:"Loading mastery data..."})]})}):e.jsxs("div",{className:"bg-white rounded-3xl p-6 shadow-sm border border-[#dde3eb]",children:[e.jsxs("div",{className:"flex items-center justify-between mb-5",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-gradient-to-br from-indigo-500 to-sky-500 rounded-xl flex items-center justify-center",children:e.jsx($t,{size:20,className:"text-white"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-bold text-[#0a1628]",children:t}),e.jsxs("p",{className:"text-xs text-[#5a6578]",children:["Aggregated mastery levels across all classes โ€ข ",d.filter(g=>g.students>0).length," tracked combinations"]})]})]}),e.jsxs("div",{className:"relative",children:[e.jsxs("select",{value:s,onChange:g=>c(g.target.value),className:"appearance-none bg-[#edf1f7] border border-[#dde3eb] rounded-lg px-3 py-1.5 pr-8 text-xs font-semibold text-[#5a6578] focus:outline-none focus:ring-2 focus:ring-sky-500/20",children:[e.jsx("option",{value:"all",children:"All Subjects"}),se.map(g=>e.jsx("option",{value:g.id,children:g.name},g.id))]}),e.jsx(At,{size:12,className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-slate-500 pointer-events-none"})]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-3 mb-5",children:[e.jsxs("div",{className:"bg-[#edf1f7] rounded-xl p-3 flex items-center gap-3",children:[e.jsx("div",{className:`w-8 h-8 rounded-lg flex items-center justify-center ${C>=70?"bg-emerald-100":"bg-rose-100"}`,children:e.jsx(Ct,{size:16,className:C>=70?"text-emerald-600":"text-rose-600"})}),e.jsxs("div",{children:[e.jsxs("p",{className:"text-lg font-bold text-[#0a1628]",children:[C,"%"]}),e.jsx("p",{className:"text-[10px] text-[#5a6578] uppercase tracking-wider",children:"Platform Average"})]})]}),e.jsxs("div",{className:"bg-red-50 rounded-xl p-3 flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 bg-red-100 rounded-lg flex items-center justify-center",children:e.jsx(St,{size:16,className:"text-red-600"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-bold text-[#0a1628] truncate",children:b?.topic}),e.jsxs("p",{className:"text-[10px] text-red-600 font-semibold",children:[b?.mastery,"% โ€” Lowest"]})]})]}),e.jsxs("div",{className:"bg-emerald-50 rounded-xl p-3 flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 bg-emerald-100 rounded-lg flex items-center justify-center",children:e.jsx(Dt,{size:16,className:"text-emerald-600"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-bold text-[#0a1628] truncate",children:S?.topic}),e.jsxs("p",{className:"text-[10px] text-emerald-600 font-semibold",children:[S?.mastery,"% โ€” Highest"]})]})]})]}),e.jsx("div",{className:"overflow-x-auto",children:o.map(g=>{const v=fe[g.id]||[],y=d.filter(N=>N.subject===g.id),I=y.length>0?Math.round(y.reduce((N,h)=>N+h.mastery,0)/y.length):0;return e.jsxs("div",{className:"mb-5 last:mb-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("div",{className:"w-3 h-3 rounded-sm",style:{backgroundColor:g.color}}),e.jsx("span",{className:"text-xs font-bold text-[#0a1628]",children:g.name}),e.jsxs("span",{className:"text-[10px] text-slate-500 ml-1",children:["Avg: ",I,"%"]})]}),e.jsxs("div",{className:"grid gap-1",style:{gridTemplateColumns:`repeat(${v.length}, minmax(0, 1fr))`},children:[v.map((N,h)=>e.jsx("div",{className:"text-center",children:e.jsx("p",{className:"text-[9px] text-slate-500 truncate px-0.5 mb-1",title:N.name,children:N.name})},`label-${h}`)),v.map((N,h)=>{const r=y.find(m=>m.topic===N.name),w=r?.mastery||0,D=a?.topic===N.name&&a?.subject===g.id;return e.jsxs(L.div,{onMouseEnter:()=>r&&i(r),onMouseLeave:()=>i(null),whileHover:{scale:1.05},className:`relative h-10 rounded-lg flex items-center justify-center cursor-pointer transition-all ${js(w)} ${D?"ring-2 ring-white shadow-lg z-10":""}`,children:[e.jsxs("span",{className:`text-xs font-bold ${vs(w)}`,children:[w,"%"]}),D&&r&&e.jsxs("div",{className:"absolute bottom-full left-1/2 -translate-x-1/2 mb-2 bg-slate-800 text-white rounded-lg px-3 py-2 text-xs whitespace-nowrap z-20 shadow-xl pointer-events-none",children:[e.jsx("p",{className:"font-bold mb-0.5",children:r.topic}),e.jsxs("p",{children:["Mastery: ",e.jsxs("strong",{children:[r.mastery,"%"]})]}),e.jsxs("p",{children:["Students: ",e.jsx("strong",{children:r.students})]}),e.jsx("div",{className:"absolute bottom-0 left-1/2 -translate-x-1/2 translate-y-full w-0 h-0 border-l-[6px] border-l-transparent border-r-[6px] border-r-transparent border-t-[6px] border-t-slate-800"})]})]},`cell-${h}`)})]})]},g.id)})}),e.jsxs("div",{className:"flex items-center justify-center gap-4 mt-5 pt-4 border-t border-[#dde3eb]",children:[e.jsxs("div",{className:"flex items-center gap-1 text-[10px] text-[#5a6578]",children:[e.jsx(ae,{size:10}),e.jsx("span",{children:"Color scale:"})]}),[{label:"0-19%",color:"bg-red-600"},{label:"20-39%",color:"bg-red-400"},{label:"40-54%",color:"bg-orange-400"},{label:"55-69%",color:"bg-rose-300"},{label:"70-84%",color:"bg-emerald-300"},{label:"85-100%",color:"bg-emerald-500"}].map((g,v)=>e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{className:`w-3 h-3 rounded-sm ${g.color}`}),e.jsx("span",{className:"text-[10px] text-[#5a6578]",children:g.label})]},v))]})]})},Ns=[{id:"gen-math",title:"General Mathematics",icon:O,bg:"bg-[#9956DE]",tags:["Algebra","Fractions","Integers"],level:1,progress:25,isAtRisk:!0},{id:"pre-calc",title:"Pre-Calculus",icon:O,bg:"bg-[#1FA7E1]",tags:["Functions","Limits","Graphs"],level:2,progress:15,isAtRisk:!0},{id:"stats-prob",title:"Statistics & Probability",icon:O,bg:"bg-[#FFB356]",tags:["Probability","Mean/Median"],level:2,progress:40,isAtRisk:!1},{id:"basic-calc",title:"Basic Calculus",icon:O,bg:"bg-[#FB96BB]",tags:["Derivatives","Integrals"],level:3,progress:50,isAtRisk:!1},{id:"adv-math",title:"Advanced Algebra",icon:O,bg:"bg-[#7274ED]",tags:["Math","Logic"],level:4,progress:10,isAtRisk:!0}].slice(0,5),ws=()=>{const t=x.useRef(null),[a,i]=x.useState(0),s=()=>{if(!t.current)return;const{scrollLeft:d,scrollWidth:p,clientWidth:j}=t.current,f=d/(p-j),o=3;let u=Math.round(f*(o-1));u<0&&(u=0),u>=o&&(u=o-1),i(u)},c=d=>{if(!t.current)return;const{scrollWidth:p,clientWidth:j}=t.current,o=(p-j)/2*d;t.current.scrollTo({left:o,behavior:"smooth"}),i(d)};return e.jsxs("div",{className:"bg-white rounded-3xl p-6 shadow-sm border border-[#dde3eb] mb-6",children:[e.jsx("div",{className:"flex items-center justify-between mb-5",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-bold text-[#0a1628] mb-1",children:"Priority Attention Modules"}),e.jsx("p",{className:"text-sm text-[#5a6578]",children:"Highly recommended to be reviewed (lowest performance)."})]})}),e.jsx("div",{className:"relative",children:e.jsx("div",{ref:t,onScroll:s,className:"flex overflow-x-auto snap-x snap-mandatory gap-5 pb-6 hide-scrollbar",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:Ns.map(d=>{const p=d.icon;return e.jsxs("div",{className:`snap-center shrink-0 w-[280px] sm:w-[300px] ${d.bg} rounded-[2rem] p-5 min-h-[290px] relative overflow-hidden transition-all duration-300 flex flex-col group shadow-sm`,children:[e.jsx("div",{className:"absolute -bottom-8 right-[-20%] w-32 h-32 bg-white opacity-10 rounded-full"}),e.jsx("div",{className:"absolute bottom-4 right-12 w-20 h-20 bg-white opacity-10 rounded-full"}),e.jsxs("div",{className:"flex justify-between items-start mb-4 relative z-10",children:[e.jsx("div",{className:"w-12 h-12 rounded-[1rem] bg-white/20 flex flex-shrink-0 items-center justify-center text-white backdrop-blur-sm",children:e.jsx(p,{size:24,className:"opacity-90"})}),e.jsxs("div",{className:"px-4 py-1.5 rounded-full bg-white/20 text-white/90 text-sm font-bold backdrop-blur-sm",children:["Lv ",d.level]})]}),e.jsxs("div",{className:"relative z-10 flex-1",children:[e.jsx("h3",{className:"text-2xl font-display font-black text-white leading-[1.1] mb-3 drop-shadow-sm pr-4 line-clamp-2",children:d.title}),e.jsx("div",{className:"flex flex-wrap gap-2 pb-4",children:d.tags.map(j=>e.jsx("span",{className:"px-3 py-1 rounded-full bg-white/20 text-white text-[13px] font-bold shadow-sm backdrop-blur-sm",children:j},j))})]}),e.jsxs("div",{className:"relative z-10 mt-auto pt-4 flex flex-col gap-2.5",children:[e.jsxs("div",{className:"flex justify-between text-white/90 text-[13px] font-bold",children:[e.jsx("div",{className:"flex items-center gap-1.5",children:e.jsx("span",{children:"Avg Mastery"})}),e.jsxs("span",{children:[d.progress,"%"]})]}),e.jsx("div",{className:"w-full h-2 rounded-full bg-white/30 overflow-hidden shadow-inner mt-1",children:e.jsx("div",{className:"h-full bg-white rounded-full",style:{width:`${d.progress}%`}})}),d.isAtRisk&&e.jsxs("div",{className:"absolute -top-12 right-0 bg-red-500 text-white px-3 py-1 rounded-full text-[11px] font-bold flex items-center gap-1 shadow-lg animate-pulse",children:[e.jsx(be,{size:12})," At Risk"]})]})]},d.id)})})}),e.jsx("div",{className:"flex justify-center items-center gap-2 mt-2",children:[0,1,2].map(d=>e.jsx("button",{onClick:()=>c(d),className:`w-2.5 h-2.5 rounded-full transition-all duration-300 ${a===d?"bg-sky-600 w-6":"bg-sky-200 hover:bg-sky-300"}`,"aria-label":`Go to slide ${d+1}`},d))}),e.jsx("style",{children:`
60
- .hide-scrollbar::-webkit-scrollbar {
61
- display: none;
62
- }
63
- `})]})},Na=({onLogout:t,onOpenProfile:a,onOpenSettings:i})=>{const[s,c]=x.useState("Overview"),[d,p]=x.useState(!1),[j,f]=x.useState(!1),[o,u]=x.useState(null),[C,b]=x.useState([]),[S,g]=x.useState([]),[v,y]=x.useState(!0);x.useEffect(()=>{if(s!=="Overview")return;let h=!1;return y(!0),Promise.all([is(),Ve(),cs(3)]).then(([r,w,D])=>{h||(u(r),b(w.slice(0,4)),g(D))}).catch(console.error).finally(()=>{h||y(!1)}),()=>{h=!0}},[s]);const I=[{label:"Total Students",value:v?"...":(o?.totalStudents??0).toLocaleString(),icon:de,color:"bg-sky-100",iconColor:"text-sky-600"},{label:"Active Teachers",value:v?"...":(o?.activeTeachers??0).toString(),icon:Ce,color:"bg-teal-100",iconColor:"text-teal-600"},{label:"Total Classes",value:v?"...":(o?.totalClasses??0).toString(),icon:O,color:"bg-sky-100",iconColor:"text-sky-600"},{label:"At-Risk Students",value:v?"...":(o?.atRiskStudents??0).toString(),icon:le,color:"bg-red-100",iconColor:"text-red-600"},{label:"Avg Performance",value:v?"...":`${o?.avgPerformance??0}%`,icon:ye,color:"bg-orange-100",iconColor:"text-orange-600"},{label:"AI Interactions",value:v?"...":(o?.aiPredictions??0).toLocaleString(),icon:$e,color:"bg-sky-100",iconColor:"text-sky-600"}],N=h=>h==="Error"||h==="Critical"?{text:"text-red-600",bg:"bg-red-50"}:h==="Warning"?{text:"text-rose-600",bg:"bg-rose-50"}:{text:"text-sky-600",bg:"bg-sky-50"};return e.jsxs("div",{className:"flex h-screen w-full bg-[#edf1f7] overflow-hidden",children:[e.jsx(Qe,{activeTab:s,setActiveTab:c,userRole:"admin",onOpenSettings:i,onLogout:()=>p(!0),sidebarCollapsed:j,setSidebarCollapsed:f}),e.jsxs("div",{className:"flex-1 flex flex-col",children:[e.jsxs("header",{className:"bg-white/80 backdrop-blur-md border-b border-[#dde3eb] px-6 py-3 flex items-center justify-between sticky top-0 z-30",children:[e.jsx("div",{className:"flex items-center gap-4",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"text-xl font-display font-bold text-[#0a1628] leading-tight",children:[s==="Overview"&&"Admin Dashboard",s==="Content"&&"Content",s==="Audit Log"&&"Audit Log",s==="User Management"&&"User Management",s==="Analytics"&&"Analytics",s==="Settings"&&"Settings"]}),e.jsxs("p",{className:"text-xs text-[#5a6578] font-body",children:[s==="Overview"&&"System Overview & Management",s==="Content"&&"Manage platform content",s==="Audit Log"&&"Monitor system activity",s==="User Management"&&"Manage all user accounts",s==="Analytics"&&"Detailed performance metrics",s==="Settings"&&"Configure platform settings"]})]})}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("button",{onClick:a,className:"flex items-center gap-2.5 w-[152px] h-11 shrink-0 bg-[#edf1f7] p-1.5 pr-3 rounded-lg cursor-pointer hover:bg-[#dde3eb] transition-all group",children:[e.jsx("div",{className:"w-8 h-8 bg-gradient-to-br from-sky-600 to-indigo-600 rounded-lg flex items-center justify-center",children:e.jsx(Z,{size:16,className:"text-white"})}),e.jsx("div",{className:"min-w-0 flex-1 text-left",children:e.jsx("p",{className:"text-sm font-semibold text-[#0a1628] leading-none group-hover:text-sky-600 transition-colors truncate",children:"Admin"})})]})})]}),e.jsxs("main",{className:"flex-1 overflow-y-auto p-6",children:[s==="Overview"&&e.jsxs("div",{className:"grid grid-cols-12 gap-6",children:[e.jsxs("div",{className:"col-span-8 space-y-6",children:[e.jsx("div",{className:"grid grid-cols-3 gap-4",children:I.map((h,r)=>{const w=h.icon;return e.jsxs("div",{className:"bg-white rounded-2xl p-5 shadow-sm border border-[#dde3eb] hover:shadow-md transition-all",children:[e.jsx("div",{className:"flex items-start justify-between mb-3",children:e.jsx("div",{className:`w-12 h-12 ${h.color} rounded-xl flex items-center justify-center`,children:e.jsx(w,{size:24,className:h.iconColor})})}),e.jsx("h3",{className:"text-2xl font-bold text-[#0a1628] mb-1",children:v?e.jsx(F,{size:20,className:"animate-spin text-slate-400"}):h.value}),e.jsx("p",{className:"text-sm text-[#5a6578] font-medium",children:h.label})]},r)})}),e.jsxs("div",{className:"bg-white rounded-3xl p-6 shadow-sm border border-[#dde3eb]",children:[e.jsx("div",{className:"flex items-center justify-between mb-6",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-bold text-[#0a1628] mb-1",children:"System Performance Overview"}),e.jsx("p",{className:"text-sm text-[#5a6578]",children:"Last 30 days"})]})}),e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 gap-3",children:[e.jsx(ye,{size:32,className:"text-[#dde3eb]"}),e.jsx("p",{className:"text-sm font-medium text-[#5a6578]",children:"No performance data yet"}),e.jsx("p",{className:"text-xs text-[#a0aec0]",children:"Import class records to populate analytics."})]})]}),e.jsx(ws,{}),e.jsx(ys,{}),e.jsxs("div",{className:"bg-white rounded-3xl p-6 shadow-sm border border-[#dde3eb]",children:[e.jsx("h2",{className:"text-lg font-bold text-[#0a1628] mb-5",children:"Recent System Activity"}),v?e.jsx("div",{className:"flex justify-center py-8",children:e.jsx(F,{className:"animate-spin text-sky-500"})}):C.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-10 gap-3",children:[e.jsx(Lt,{size:28,className:"text-[#dde3eb]"}),e.jsx("p",{className:"text-sm text-[#5a6578]",children:"No audit events yet"})]}):e.jsx("div",{className:"space-y-3",children:C.map(h=>{const r=N(h.severity);return e.jsxs("div",{className:`${r.bg} border border-[#dde3eb] rounded-2xl p-4 flex items-start gap-4`,children:[e.jsx("div",{className:"w-10 h-10 bg-white rounded-xl flex items-center justify-center flex-shrink-0",children:e.jsx(Z,{size:18,className:r.text})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-bold text-[#0a1628] mb-0.5",children:h.action}),e.jsx("p",{className:"text-xs text-[#5a6578] truncate",children:h.details}),e.jsxs("p",{className:"text-xs text-[#5a6578] mt-1",children:[h.timestamp," ยท ",h.user.name]})]})]},h.id)})})]})]}),e.jsxs("div",{className:"col-span-4 space-y-6",children:[e.jsxs("div",{className:"bg-gradient-to-br from-indigo-600 to-sky-600 rounded-3xl p-6 text-white shadow-lg",children:[e.jsx("h2",{className:"text-lg font-bold mb-4",children:"Quick Actions"}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("button",{className:"w-full bg-white/20 hover:bg-white/30 backdrop-blur-sm border border-slate-300 rounded-xl p-3 text-left transition-all",children:[e.jsx("p",{className:"text-sm font-bold",children:"Add New Teacher"}),e.jsx("p",{className:"text-xs text-sky-100",children:"Create teacher account"})]}),e.jsxs("button",{className:"w-full bg-white/20 hover:bg-white/30 backdrop-blur-sm border border-slate-300 rounded-xl p-3 text-left transition-all",children:[e.jsx("p",{className:"text-sm font-bold",children:"Add New Student"}),e.jsx("p",{className:"text-xs text-sky-100",children:"Register new student"})]}),e.jsxs("button",{className:"w-full bg-white/20 hover:bg-white/30 backdrop-blur-sm border border-slate-300 rounded-xl p-3 text-left transition-all",children:[e.jsx("p",{className:"text-sm font-bold",children:"System Settings"}),e.jsx("p",{className:"text-xs text-sky-100",children:"Configure platform"})]}),e.jsxs("button",{className:"w-full bg-white/20 hover:bg-white/30 backdrop-blur-sm border border-slate-300 rounded-xl p-3 text-left transition-all",children:[e.jsx("p",{className:"text-sm font-bold",children:"Generate Report"}),e.jsx("p",{className:"text-xs text-sky-100",children:"Export analytics"})]})]})]}),e.jsxs("div",{className:"bg-white rounded-3xl p-6 shadow-sm border border-[#dde3eb]",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-5",children:[e.jsx("div",{className:"w-10 h-10 bg-rose-100 rounded-xl flex items-center justify-center",children:e.jsx(re,{size:20,className:"text-rose-600"})}),e.jsx("h2",{className:"text-lg font-bold text-[#0a1628]",children:"Top Performers"})]}),v?e.jsx("div",{className:"flex justify-center py-8",children:e.jsx(F,{className:"animate-spin text-sky-500"})}):S.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-10 gap-3",children:[e.jsx(re,{size:28,className:"text-[#dde3eb]"}),e.jsx("p",{className:"text-sm text-[#5a6578]",children:"No student data yet"}),e.jsx("p",{className:"text-xs text-[#a0aec0]",children:"Students will appear here as they progress."})]}):e.jsx("div",{className:"space-y-3",children:S.map((h,r)=>e.jsxs("div",{className:"bg-gradient-to-r from-rose-50 to-orange-50 border border-rose-200 rounded-2xl p-4",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[e.jsxs("div",{className:"relative",children:[e.jsx("img",{src:h.avatar,alt:h.name,className:"w-12 h-12 rounded-xl object-cover"}),e.jsx("span",{className:"absolute -top-1 -right-1 w-6 h-6 bg-rose-500 text-white text-xs font-bold rounded-full flex items-center justify-center",children:r+1})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628]",children:h.name}),e.jsx("p",{className:"text-xs text-[#5a6578]",children:h.class})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"bg-white rounded-xl p-2",children:[e.jsx("p",{className:"text-[10px] text-[#5a6578] mb-1",children:"Performance"}),e.jsxs("p",{className:"text-lg font-bold text-teal-600",children:[h.performance,"%"]})]}),e.jsxs("div",{className:"bg-white rounded-xl p-2",children:[e.jsx("p",{className:"text-[10px] text-[#5a6578] mb-1",children:"Level"}),e.jsx("p",{className:"text-lg font-bold text-sky-600",children:h.level})]})]})]},h.id))})]}),e.jsxs("div",{className:"bg-white rounded-3xl p-6 shadow-sm border border-[#dde3eb]",children:[e.jsx("h2",{className:"text-lg font-bold text-[#0a1628] mb-5",children:"AI Model Status"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm text-[#5a6578]",children:"Prediction Accuracy"}),e.jsx("span",{className:"text-sm font-bold text-[#5a6578]",children:"No data"})]}),e.jsx("div",{className:"h-2 bg-[#edf1f7] rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-[#dde3eb] rounded-full",style:{width:"0%"}})}),e.jsxs("div",{className:"flex items-center justify-between mt-4",children:[e.jsx("span",{className:"text-sm text-[#5a6578]",children:"Model Performance"}),e.jsx("span",{className:"text-sm font-bold text-[#5a6578]",children:"Untrained"})]}),e.jsx("div",{className:"h-2 bg-[#edf1f7] rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-[#dde3eb] rounded-full",style:{width:"0%"}})}),e.jsx("div",{className:"mt-4 p-3 bg-sky-50 border border-sky-200 rounded-xl",children:e.jsxs("p",{className:"text-xs text-sky-800",children:[e.jsx("strong",{children:"Status:"})," Import student data to enable AI predictions."]})})]})]})]})]}),s==="Content"&&e.jsx(os,{}),s==="Audit Log"&&e.jsx(xs,{}),s==="User Management"&&e.jsx(fs,{}),s==="Analytics"&&e.jsx(bs,{}),s==="Settings"&&e.jsx(hs,{})]})]}),e.jsx(Ne,{isOpen:d,onClose:()=>p(!1),onConfirm:t,title:"Logout Confirmation",message:"Are you sure you want to log out? This will end your current session.",confirmText:"Logout",cancelText:"Cancel"})]})};export{Na as default};
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/AvatarShop-BirEYu2M.js DELETED
@@ -1,16 +0,0 @@
1
- import{r as n,j as e}from"./vendor-react-Dexh7fmo.js";import{c as F,L as O,d as V,e as $}from"./vendor-radix-BRdei-zg.js";import{c as k,u as B,i as C,m as d,e as K,J as Y,t as l,K as Z,L as W}from"./index-D4nJsLyx.js";import{T as D,a as G,b as H}from"./tooltip-BV3U-RJu.js";import{C as J}from"./CompositeAvatar-DMpjm5UY.js";import{M}from"./avatarData-BW_TX0b4.js";import{S as E}from"./sparkles-CXUFmaBJ.js";import{L as U}from"./lock-_59co5m5.js";import{S as Q}from"./save-Og8yP5Yb.js";import{S as ee}from"./shirt-BMZy0pq4.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-firestore-BML5nJHm.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";import"./utils-BQQgILNW.js";import"./clsx-B-dksMZM.js";/**
2
- * @license lucide-react v0.487.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=[["path",{d:"M4 16v-2.38C4 11.5 2.97 10.5 3 8c.03-2.72 1.49-6 4.5-6C9.37 2 10 3.8 10 5.5c0 3.11-2 5.66-2 8.68V16a2 2 0 1 1-4 0Z",key:"1dudjm"}],["path",{d:"M20 20v-2.38c0-2.12 1.03-3.12 1-5.62-.03-2.72-1.49-6-4.5-6C14.63 6 14 7.8 14 9.5c0 3.11 2 5.66 2 8.68V20a2 2 0 1 0 4 0Z",key:"l2t8xc"}],["path",{d:"M16 17h4",key:"1dejxt"}],["path",{d:"M4 13h4",key:"1bwh8b"}]],se=k("footprints",te);/**
7
- * @license lucide-react v0.487.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 ae=[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]],re=k("scissors",ae);/**
12
- * @license lucide-react v0.487.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 oe=[["path",{d:"M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z",key:"hou9p0"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}]],N=k("shopping-bag",oe),Ne=({onSaveProfile:P,onNavigateToModules:T})=>{const{userProfile:r,refreshProfile:u}=B(),[x,S]=n.useState({top:r?.avatarLayers?.top||"top_pink",bottom:r?.avatarLayers?.bottom||"",shoes:r?.avatarLayers?.shoes||"",accessory:r?.avatarLayers?.accessory||""}),[h,f]=n.useState(!1),[b,g]=n.useState([]),[_,w]=n.useState(0),[m,p]=n.useState(null),[c,v]=n.useState(null),z=["Wow!","Cute!","I love it!","Perfect!","So cool!","Awesome!"],y=["Gain more XP to buy me more clothes!","Help me get stylish!","Let's earn some XP to unlock more!","I'd love to try on more outfits!","Keep learning to unlock new looks!"];n.useEffect(()=>{if(r&&r.role==="student"){const t=r;g(t.ownedAvatarItems||[]),w(t.currentXP||0)}},[r]),n.useEffect(()=>{if(!c){const t=setInterval(()=>{Math.random()>.6&&v(y[Math.floor(Math.random()*y.length)])},4e3);return()=>clearInterval(t)}},[c,y]),n.useEffect(()=>{if(c){const t=setTimeout(()=>{v(null)},3500);return()=>clearTimeout(t)}},[c]);const A=(t,o)=>{const s=M.find(a=>a.id===o);if(s&&s.price&&s.price>0&&!b.includes(o)){l.error("This item is locked. Purchase it first!");return}S(a=>({...a,[t]:a[t]===o?"":o})),v(z[Math.floor(Math.random()*z.length)])},L=async(t,o,s)=>{if(t.stopPropagation(),!r?.uid){l.error("You must be logged in to purchase items");return}if(b.includes(o)){l.info("You already own this item");return}p(o);try{const a=await Z(r.uid,o,s);a.success?(l.success(a.message||"Item purchased!"),g(j=>[...j,o]),a.currentXP!==void 0&&w(a.currentXP),await u()):l.error(a.message||"Failed to purchase item")}catch(a){console.error("Purchase error:",a),l.error("Error purchasing item")}finally{p(null)}},X=async()=>{if(r?.uid&&m!=="resetting"){p("resetting");try{const t=await Y(r.uid);t.success?(g([]),S({top:"top_pink",bottom:"",shoes:"",accessory:""}),w(t.newXP),l.success(`Purchases reset and XP updated to ${t.newXP}! (Test Mode)`),await u()):l.error("Failed to reset purchases")}catch(t){console.error("Reset error:",t),l.error("Error resetting purchases")}finally{p(null)}}},q=async()=>{if(r?.uid){f(!0);try{await W(r.uid,{avatarLayers:x}),P&&P(x),l.success("Avatar saved successfully"),await u(),f(!1)}catch(t){console.error(t),f(!1)}}},I=[{id:"top",label:"Tops",icon:e.jsx(ee,{size:16})},{id:"bottom",label:"Bottoms",icon:e.jsx(re,{size:16,className:"rotate-90"})},{id:"shoes",label:"Shoes",icon:e.jsx(se,{size:16})},{id:"accessory",label:"Accessories",icon:e.jsx(C,{size:16})}];return e.jsx("div",{className:"h-full w-full flex items-center justify-center p-4 sm:p-6 lg:p-8 overflow-hidden",children:e.jsxs("div",{className:"relative w-full max-w-[1200px] h-[85vh] min-h-[600px] max-h-[850px] rounded-[2rem] p-8 lg:p-12 bg-gradient-to-br from-white via-sky-50/30 to-white border border-slate-200/80 shadow-[0_8px_30px_rgb(0,0,0,0.04)] flex flex-col xl:flex-row gap-12",children:[e.jsxs("div",{className:"absolute inset-0 overflow-hidden rounded-[2rem] pointer-events-none",children:[e.jsx("div",{className:"absolute top-0 left-0 right-0 h-px bg-gradient-to-r from-transparent via-sky-400/30 to-transparent"}),e.jsx("div",{className:"absolute -top-40 -right-40 w-96 h-96 bg-blue-100/40 rounded-full blur-3xl"}),e.jsx("div",{className:"absolute -bottom-40 -left-40 w-96 h-96 bg-purple-100/30 rounded-full blur-3xl"})]}),e.jsxs("div",{className:"flex flex-col h-full relative z-10 w-full xl:w-7/12 mx-auto xl:mx-0",children:[e.jsxs("div",{className:"mb-8 flex flex-col sm:flex-row items-start justify-between gap-6 shrink-0",children:[e.jsxs("div",{className:"pr-4",children:[e.jsxs("h1",{className:"text-4xl md:text-5xl font-display font-black text-[#0a1628] tracking-tight flex flex-wrap items-center gap-3",children:[e.jsx("span",{className:"whitespace-nowrap",children:"Avatar Studio"})," ",e.jsx(E,{className:"text-blue-500 fill-blue-500",size:32})]}),e.jsx("p",{className:"text-slate-500 font-medium text-lg mt-2",children:"Design your perfect learning companion."})]}),e.jsxs("div",{className:"flex items-center gap-4 sm:ml-auto",children:[e.jsx("button",{onClick:X,disabled:m==="resetting",className:"hidden sm:flex self-stretch items-center bg-slate-100 hover:bg-red-50 text-slate-500 hover:text-red-500 px-3 py-2 rounded-2xl font-bold text-xs transition-colors border border-slate-200",children:"Reset (Test)"}),e.jsxs("div",{className:"bg-gradient-to-br from-amber-400 to-orange-500 rounded-2xl px-4 py-3 shadow-lg flex items-center gap-2 h-fit",children:[e.jsx(N,{className:"text-white",size:20}),e.jsxs(D,{children:[e.jsx(G,{asChild:!0,children:e.jsxs("button",{onClick:T,className:"cursor-pointer hover:opacity-90 transition-opacity active:scale-95",children:[e.jsx("p",{className:"text-white text-xs font-bold uppercase tracking-wider",children:"XP Balance"}),e.jsx("p",{className:"text-white text-2xl font-black",children:_})]})}),e.jsx(H,{side:"bottom",className:"bg-slate-900 text-white border border-slate-700",children:"Review more lessons to earn more XP!"})]})]})]})]}),e.jsxs(F,{defaultValue:"top",className:"flex flex-col flex-1 min-h-0",children:[e.jsx(O,{className:"flex flex-nowrap shrink-0 justify-start space-x-2 sm:space-x-4 mb-4 sm:mb-8 bg-white shadow-sm p-1.5 rounded-full border border-slate-100 w-fit overflow-x-auto max-w-full scrollbar-hide",children:I.map(t=>e.jsxs(V,{value:t.id,className:"flex items-center gap-2 px-6 py-2.5 rounded-full font-bold text-sm text-slate-500 hover:bg-slate-50 data-[state=active]:bg-gradient-to-r data-[state=active]:from-blue-600 data-[state=active]:to-sky-500 data-[state=active]:text-white transition-all shadow-sm outline-none whitespace-nowrap",children:[t.icon,t.label]},t.id))}),e.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden min-h-0 pb-6 scrollbar-hide px-2 -mx-2",children:I.map(t=>{const o=M.filter(s=>s.category===t.id);return e.jsx($,{value:t.id,className:"outline-none pt-2 h-full",children:o.length===0?e.jsxs("div",{className:"w-full h-full min-h-[250px] flex flex-col items-center justify-center border-2 border-dashed border-slate-200 rounded-[2rem] bg-slate-50/50 p-8 text-center",children:[e.jsx(C,{size:48,className:"text-slate-300 mb-4 opacity-50"}),e.jsx("h3",{className:"font-bold text-xl text-slate-500 mb-2",children:"Accessories coming soon"}),e.jsx("p",{className:"text-slate-400 text-sm max-w-xs",children:"We're crafting some awesome gear for your avatar! Check back later."})]}):e.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-3 gap-8",children:o.map(s=>{const a=x[t.id]===s.id,j=b.includes(s.id),i=!!(s.price&&s.price>0&&!j);return e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("button",{onClick:()=>!i&&A(t.id,s.id),disabled:i,className:`relative w-full aspect-square rounded-[1.5rem] border-[3px] transition-all flex flex-col items-center justify-center group ${a&&!i?"bg-white border-blue-500 shadow-md scale-[1.02] z-10":i?"bg-slate-50 border-slate-200 opacity-50 cursor-not-allowed":"bg-white border-slate-100 hover:border-sky-300 hover:shadow-lg hover:scale-[1.02] hover:z-10"}`,children:[a&&!i&&e.jsxs("div",{className:"absolute top-2 left-1/2 -translate-x-1/2 px-2 py-1 bg-gradient-to-r from-blue-500 to-sky-400 text-white text-[9px] font-black rounded-full flex items-center gap-1 z-10 whitespace-nowrap",children:["Equipped ",e.jsx(E,{size:9,className:"fill-white"})]}),i&&e.jsx("div",{className:"absolute inset-0 bg-black/20 z-20 flex items-center justify-center rounded-[1.3rem]",children:e.jsx(U,{className:"text-white",size:24})}),e.jsx("img",{src:s.thumbnail,alt:s.name,className:`w-4/5 h-4/5 object-contain transition-transform ${!i&&"group-hover:scale-110"}`,style:{filter:i?"grayscale(70%)":"none"}})]}),e.jsx("p",{className:"text-xs font-bold text-slate-700 text-center line-clamp-2",children:s.name}),i&&e.jsx(d.button,{initial:{opacity:0},animate:{opacity:1},onClick:R=>L(R,s.id,s.price||0),disabled:m===s.id,className:"w-full py-1.5 bg-gradient-to-r from-amber-500 to-orange-500 hover:from-amber-600 hover:to-orange-600 text-white text-[10px] font-bold flex items-center justify-center gap-1.5 rounded-lg shadow-md transition-all disabled:opacity-70",children:m===s.id?e.jsx(d.div,{animate:{rotate:360},transition:{repeat:1/0,duration:1},children:e.jsx(N,{size:11})}):e.jsxs(e.Fragment,{children:[e.jsx(N,{size:11}),s.price," XP"]})})]},s.id)})})},t.id)})})]})]}),e.jsxs("div",{className:"flex flex-col gap-6 relative z-10 w-full xl:w-[450px] shrink-0 xl:self-center",children:[e.jsxs("div",{className:"bg-[#0f1422] rounded-[3rem] overflow-hidden relative shadow-[0_20px_50px_rgba(15,20,34,0.3)] h-[400px] xl:h-[480px] w-full flex items-center justify-center mx-auto border-8 border-slate-800",children:[e.jsx("div",{className:"absolute top-[-10%] left-0 right-0 h-[110%] pointer-events-none mix-blend-screen opacity-70",style:{background:"linear-gradient(to bottom, rgba(255,255,255,0.4) 0%, rgba(255,255,255,0.05) 60%, transparent 100%)",clipPath:"polygon(15% 0, 85% 0, 65% 100%, 35% 100%)"}}),e.jsx("div",{className:"absolute bottom-12 left-1/2 -translate-x-1/2 w-[220px] h-[25px] bg-sky-500/20 blur-xl rounded-full"}),e.jsxs(d.div,{animate:{y:[-8,8,-8]},transition:{repeat:1/0,duration:4,ease:"easeInOut"},className:"relative w-full h-[80%] z-10 flex justify-center items-center",children:[e.jsx(J,{layers:x,className:"w-full h-full absolute inset-0 z-20"}),e.jsx(K,{children:c&&e.jsxs(d.div,{initial:{opacity:0,y:-10,scale:.8},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:10,scale:.8},transition:{duration:.3},className:"absolute -top-24 left-1/2 -translate-x-1/2 z-30 bg-white text-slate-800 px-4 py-2 rounded-full shadow-lg border-2 border-sky-300 whitespace-nowrap font-bold text-sm max-w-xs text-center",children:[c,e.jsx("div",{className:"absolute -bottom-2 left-1/2 -translate-x-1/2 w-0 h-0 border-l-4 border-r-4 border-t-4 border-l-transparent border-r-transparent border-t-white"})]})})]})]}),e.jsxs("button",{onClick:q,disabled:h,className:"w-full max-w-[450px] mx-auto h-[64px] bg-blue-600 hover:bg-blue-500 text-white rounded-2xl font-bold text-lg flex items-center justify-center gap-3 transition-colors shadow-md disabled:opacity-70 disabled:cursor-not-allowed active:scale-[0.98]",children:[h?e.jsx(d.div,{animate:{rotate:360},transition:{repeat:1/0,duration:1,ease:"linear"},children:e.jsx(Q,{size:24,className:"opacity-50"})}):null,h?"Saving...":"Save Profile Avatar"]})]})]})})};export{Ne as default};
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/ChatMarkdown-B34PtYCE.js DELETED
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-markdown-C5ikSDMA.js","assets/vendor-react-Dexh7fmo.js","assets/vendor-markdown-CBmFCdgC.css"])))=>i.map(i=>d[i]);
2
- import{Q as i,_ as c}from"./index-D4nJsLyx.js";import{r as m,j as r}from"./vendor-react-Dexh7fmo.js";import{M as h,r as x,a as y}from"./vendor-markdown-C5ikSDMA.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-firestore-BML5nJHm.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";let a=null;const p=()=>(a||(a=c(()=>import("./vendor-markdown-C5ikSDMA.js").then(l=>l.k),__vite__mapDeps([0,1,2]))),a),v=({children:l})=>{if(m.useEffect(()=>{p()},[]),!l||typeof l!="string")return null;const t=i(l);return r.jsx("div",{className:"chat-markdown",children:r.jsx(h,{remarkPlugins:[y],rehypePlugins:[x],components:{a:({href:e,children:s})=>r.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:underline",children:s}),code:e=>{const{inline:s,className:n,children:o,...d}=e;return r.jsx("code",{className:`${s?"bg-gray-100 dark:bg-gray-800 rounded px-1 py-0.5 text-sm":"block bg-gray-100 dark:bg-gray-900 rounded p-3 overflow-x-auto my-2"} ${n||""}`,...d,children:o})},blockquote:({children:e})=>r.jsx("blockquote",{className:"border-l-4 border-gray-300 dark:border-gray-600 pl-4 italic text-gray-600 dark:text-gray-400 my-2",children:e}),h1:({children:e})=>r.jsx("h1",{className:"text-2xl font-bold my-2",children:e}),h2:({children:e})=>r.jsx("h2",{className:"text-xl font-bold my-2",children:e}),h3:({children:e})=>r.jsx("h3",{className:"text-lg font-bold my-2",children:e}),h4:({children:e})=>r.jsx("h4",{className:"text-base font-bold my-2",children:e}),h5:({children:e})=>r.jsx("h5",{className:"text-sm font-bold my-2",children:e}),h6:({children:e})=>r.jsx("h6",{className:"text-xs font-bold my-2",children:e}),ul:({children:e})=>r.jsx("ul",{className:"list-disc list-inside my-2",children:e}),ol:({children:e})=>r.jsx("ol",{className:"list-decimal list-inside my-2",children:e}),li:({children:e})=>r.jsx("li",{className:"ml-2",children:e}),hr:()=>r.jsx("hr",{className:"my-4 border-t border-gray-300 dark:border-gray-600"}),p:({children:e})=>r.jsx("p",{className:"my-1",children:e})},children:t})})};export{v as default};
 
 
 
assets/CompetencyRadarChart-BfcP7xrw.js DELETED
@@ -1,2 +0,0 @@
1
- import{c as u,g as he,r as A,j as p}from"./vendor-react-Dexh7fmo.js";import{u as it,p as at,m as ot}from"./index-D4nJsLyx.js";import{g as st,s as ke}from"./subjects-DDBtpdiA.js";import{B as ct}from"./brain-CPvGdgWE.js";import{S as lt}from"./sparkles-CXUFmaBJ.js";import{f as b,x as w,y as qe,z as ut,A as We,D as ft,b as B,T as Ke,L as S,E as Ve,d as Ge,e as pt,F as He,H as dt,I as X,J as mt,K as yt,G as ht,M as we,N as vt,O as _e,r as gt,P as bt,R as xt,v as Pt}from"./generateCategoricalChart-CiUYzAvW.js";import{c as N}from"./clsx-B-dksMZM.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-firestore-BML5nJHm.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";import"./trending-up-D-vj8Gbq.js";import"./chart-column-D5mAWcRx.js";var Ot=["points","className","baseLinePoints","connectNulls"];function F(){return F=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},F.apply(this,arguments)}function jt(t,e){if(t==null)return{};var n=kt(t,e),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)r=a[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function kt(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function Ae(t){return Et(t)||At(t)||_t(t)||wt()}function wt(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
2
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _t(t,e){if(t){if(typeof t=="string")return pe(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return pe(t,e)}}function At(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Et(t){if(Array.isArray(t))return pe(t)}function pe(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var Ee=function(e){return e&&e.x===+e.x&&e.y===+e.y},St=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=[[]];return e.forEach(function(r){Ee(r)?n[n.length-1].push(r):n[n.length-1].length>0&&n.push([])}),Ee(e[0])&&n[n.length-1].push(e[0]),n[n.length-1].length<=0&&(n=n.slice(0,-1)),n},V=function(e,n){var r=St(e);n&&(r=[r.reduce(function(a,o){return[].concat(Ae(a),Ae(o))},[])]);var i=r.map(function(a){return a.reduce(function(o,s,c){return"".concat(o).concat(c===0?"M":"L").concat(s.x,",").concat(s.y)},"")}).join("");return r.length===1?"".concat(i,"Z"):i},Nt=function(e,n,r){var i=V(e,r);return"".concat(i.slice(-1)==="Z"?i.slice(0,-1):i,"L").concat(V(n.reverse(),r).slice(1))},Ze=function(e){var n=e.points,r=e.className,i=e.baseLinePoints,a=e.connectNulls,o=jt(e,Ot);if(!n||!n.length)return null;var s=N("recharts-polygon",r);if(i&&i.length){var c=o.stroke&&o.stroke!=="none",d=Nt(n,i,a);return u.createElement("g",{className:s},u.createElement("path",F({},b(o,!0),{fill:d.slice(-1)==="Z"?o.fill:"none",stroke:"none",d})),c?u.createElement("path",F({},b(o,!0),{fill:"none",d:V(n,a)})):null,c?u.createElement("path",F({},b(o,!0),{fill:"none",d:V(i,a)})):null)}var f=V(n,a);return u.createElement("path",F({},b(o,!0),{fill:f.slice(-1)==="Z"?o.fill:"none",className:s,d:f}))},Tt=["cx","cy","innerRadius","outerRadius","gridType","radialLines"];function H(t){"@babel/helpers - typeof";return H=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},H(t)}function $t(t,e){if(t==null)return{};var n=Rt(t,e),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)r=a[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Rt(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function T(){return T=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},T.apply(this,arguments)}function Se(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Z(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Se(Object(n),!0).forEach(function(r){Lt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Se(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Lt(t,e,n){return e=Dt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Dt(t){var e=It(t,"string");return H(e)=="symbol"?e:e+""}function It(t,e){if(H(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(H(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Mt=function(e,n,r,i){var a="";return i.forEach(function(o,s){var c=w(n,r,e,o);s?a+="L ".concat(c.x,",").concat(c.y):a+="M ".concat(c.x,",").concat(c.y)}),a+="Z",a},Ct=function(e){var n=e.cx,r=e.cy,i=e.innerRadius,a=e.outerRadius,o=e.polarAngles,s=e.radialLines;if(!o||!o.length||!s)return null;var c=Z({stroke:"#ccc"},b(e,!1));return u.createElement("g",{className:"recharts-polar-grid-angle"},o.map(function(d){var f=w(n,r,i,d),m=w(n,r,a,d);return u.createElement("line",T({},c,{key:"line-".concat(d),x1:f.x,y1:f.y,x2:m.x,y2:m.y}))}))},Bt=function(e){var n=e.cx,r=e.cy,i=e.radius,a=e.index,o=Z(Z({stroke:"#ccc"},b(e,!1)),{},{fill:"none"});return u.createElement("circle",T({},o,{className:N("recharts-polar-grid-concentric-circle",e.className),key:"circle-".concat(a),cx:n,cy:r,r:i}))},Ft=function(e){var n=e.radius,r=e.index,i=Z(Z({stroke:"#ccc"},b(e,!1)),{},{fill:"none"});return u.createElement("path",T({},i,{className:N("recharts-polar-grid-concentric-polygon",e.className),key:"path-".concat(r),d:Mt(n,e.cx,e.cy,e.polarAngles)}))},zt=function(e){var n=e.polarRadius,r=e.gridType;return!n||!n.length?null:u.createElement("g",{className:"recharts-polar-grid-concentric"},n.map(function(i,a){var o=a;return r==="circle"?u.createElement(Bt,T({key:o},e,{radius:i,index:a})):u.createElement(Ft,T({key:o},e,{radius:i,index:a}))}))},Ue=function(e){var n=e.cx,r=n===void 0?0:n,i=e.cy,a=i===void 0?0:i,o=e.innerRadius,s=o===void 0?0:o,c=e.outerRadius,d=c===void 0?0:c,f=e.gridType,m=f===void 0?"polygon":f,l=e.radialLines,v=l===void 0?!0:l,y=$t(e,Tt);return d<=0?null:u.createElement("g",{className:"recharts-polar-grid"},u.createElement(Ct,T({cx:r,cy:a,innerRadius:s,outerRadius:d,gridType:m,radialLines:v},y)),u.createElement(zt,T({cx:r,cy:a,innerRadius:s,outerRadius:d,gridType:m,radialLines:v},y)))};Ue.displayName="PolarGrid";var ce,Ne;function qt(){if(Ne)return ce;Ne=1;var t=qe(),e=ut(),n=We();function r(i,a){return i&&i.length?t(i,n(a,2),e):void 0}return ce=r,ce}var Wt=qt();const Kt=he(Wt);var le,Te;function Vt(){if(Te)return le;Te=1;var t=qe(),e=We(),n=ft();function r(i,a){return i&&i.length?t(i,e(a,2),n):void 0}return le=r,le}var Gt=Vt();const Ht=he(Gt);var Zt=["cx","cy","angle","ticks","axisLine"],Ut=["ticks","tick","angle","tickFormatter","stroke"];function z(t){"@babel/helpers - typeof";return z=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},z(t)}function G(){return G=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},G.apply(this,arguments)}function $e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function R(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?$e(Object(n),!0).forEach(function(r){ne(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):$e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Re(t,e){if(t==null)return{};var n=Yt(t,e),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)r=a[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Yt(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function Jt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Le(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Je(r.key),r)}}function Xt(t,e,n){return e&&Le(t.prototype,e),n&&Le(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Qt(t,e,n){return e=Q(e),er(t,Ye()?Reflect.construct(e,n||[],Q(t).constructor):e.apply(t,n))}function er(t,e){if(e&&(z(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return tr(t)}function tr(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Ye(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Ye=function(){return!!t})()}function Q(t){return Q=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Q(t)}function rr(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&de(t,e)}function de(t,e){return de=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},de(t,e)}function ne(t,e,n){return e=Je(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Je(t){var e=nr(t,"string");return z(e)=="symbol"?e:e+""}function nr(t,e){if(z(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(z(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var U=(function(t){function e(){return Jt(this,e),Qt(this,e,arguments)}return rr(e,t),Xt(e,[{key:"getTickValueCoord",value:function(r){var i=r.coordinate,a=this.props,o=a.angle,s=a.cx,c=a.cy;return w(s,c,i,o)}},{key:"getTickTextAnchor",value:function(){var r=this.props.orientation,i;switch(r){case"left":i="end";break;case"right":i="start";break;default:i="middle";break}return i}},{key:"getViewBox",value:function(){var r=this.props,i=r.cx,a=r.cy,o=r.angle,s=r.ticks,c=Kt(s,function(f){return f.coordinate||0}),d=Ht(s,function(f){return f.coordinate||0});return{cx:i,cy:a,startAngle:o,endAngle:o,innerRadius:d.coordinate||0,outerRadius:c.coordinate||0}}},{key:"renderAxisLine",value:function(){var r=this.props,i=r.cx,a=r.cy,o=r.angle,s=r.ticks,c=r.axisLine,d=Re(r,Zt),f=s.reduce(function(y,h){return[Math.min(y[0],h.coordinate),Math.max(y[1],h.coordinate)]},[1/0,-1/0]),m=w(i,a,f[0],o),l=w(i,a,f[1],o),v=R(R(R({},b(d,!1)),{},{fill:"none"},b(c,!1)),{},{x1:m.x,y1:m.y,x2:l.x,y2:l.y});return u.createElement("line",G({className:"recharts-polar-radius-axis-line"},v))}},{key:"renderTicks",value:function(){var r=this,i=this.props,a=i.ticks,o=i.tick,s=i.angle,c=i.tickFormatter,d=i.stroke,f=Re(i,Ut),m=this.getTickTextAnchor(),l=b(f,!1),v=b(o,!1),y=a.map(function(h,g){var O=r.getTickValueCoord(h),j=R(R(R(R({textAnchor:m,transform:"rotate(".concat(90-s,", ").concat(O.x,", ").concat(O.y,")")},l),{},{stroke:"none",fill:d},v),{},{index:g},O),{},{payload:h});return u.createElement(S,G({className:N("recharts-polar-radius-axis-tick",Ve(o)),key:"tick-".concat(h.coordinate)},Ge(r.props,h,g)),e.renderTickItem(o,j,c?c(h.value,g):h.value))});return u.createElement(S,{className:"recharts-polar-radius-axis-ticks"},y)}},{key:"render",value:function(){var r=this.props,i=r.ticks,a=r.axisLine,o=r.tick;return!i||!i.length?null:u.createElement(S,{className:N("recharts-polar-radius-axis",this.props.className)},a&&this.renderAxisLine(),o&&this.renderTicks(),pt.renderCallByParent(this.props,this.getViewBox()))}}],[{key:"renderTickItem",value:function(r,i,a){var o;return u.isValidElement(r)?o=u.cloneElement(r,i):B(r)?o=r(i):o=u.createElement(Ke,G({},i,{className:"recharts-polar-radius-axis-tick-value"}),a),o}}])})(A.PureComponent);ne(U,"displayName","PolarRadiusAxis");ne(U,"axisType","radiusAxis");ne(U,"defaultProps",{type:"number",radiusAxisId:0,cx:0,cy:0,angle:0,orientation:"right",stroke:"#ccc",axisLine:!0,tick:!0,tickCount:5,allowDataOverflow:!1,scale:"auto",allowDuplicatedCategory:!0});function q(t){"@babel/helpers - typeof";return q=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},q(t)}function D(){return D=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},D.apply(this,arguments)}function De(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function L(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?De(Object(n),!0).forEach(function(r){ie(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):De(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function ir(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ie(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Qe(r.key),r)}}function ar(t,e,n){return e&&Ie(t.prototype,e),n&&Ie(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function or(t,e,n){return e=ee(e),sr(t,Xe()?Reflect.construct(e,n||[],ee(t).constructor):e.apply(t,n))}function sr(t,e){if(e&&(q(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return cr(t)}function cr(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Xe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Xe=function(){return!!t})()}function ee(t){return ee=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},ee(t)}function lr(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&me(t,e)}function me(t,e){return me=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},me(t,e)}function ie(t,e,n){return e=Qe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Qe(t){var e=ur(t,"string");return q(e)=="symbol"?e:e+""}function ur(t,e){if(q(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(q(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var fr=Math.PI/180,Me=1e-5,Y=(function(t){function e(){return ir(this,e),or(this,e,arguments)}return lr(e,t),ar(e,[{key:"getTickLineCoord",value:function(r){var i=this.props,a=i.cx,o=i.cy,s=i.radius,c=i.orientation,d=i.tickSize,f=d||8,m=w(a,o,s,r.coordinate),l=w(a,o,s+(c==="inner"?-1:1)*f,r.coordinate);return{x1:m.x,y1:m.y,x2:l.x,y2:l.y}}},{key:"getTickTextAnchor",value:function(r){var i=this.props.orientation,a=Math.cos(-r.coordinate*fr),o;return a>Me?o=i==="outer"?"start":"end":a<-Me?o=i==="outer"?"end":"start":o="middle",o}},{key:"renderAxisLine",value:function(){var r=this.props,i=r.cx,a=r.cy,o=r.radius,s=r.axisLine,c=r.axisLineType,d=L(L({},b(this.props,!1)),{},{fill:"none"},b(s,!1));if(c==="circle")return u.createElement(He,D({className:"recharts-polar-angle-axis-line"},d,{cx:i,cy:a,r:o}));var f=this.props.ticks,m=f.map(function(l){return w(i,a,o,l.coordinate)});return u.createElement(Ze,D({className:"recharts-polar-angle-axis-line"},d,{points:m}))}},{key:"renderTicks",value:function(){var r=this,i=this.props,a=i.ticks,o=i.tick,s=i.tickLine,c=i.tickFormatter,d=i.stroke,f=b(this.props,!1),m=b(o,!1),l=L(L({},f),{},{fill:"none"},b(s,!1)),v=a.map(function(y,h){var g=r.getTickLineCoord(y),O=r.getTickTextAnchor(y),j=L(L(L({textAnchor:O},f),{},{stroke:"none",fill:d},m),{},{index:h,payload:y,x:g.x2,y:g.y2});return u.createElement(S,D({className:N("recharts-polar-angle-axis-tick",Ve(o)),key:"tick-".concat(y.coordinate)},Ge(r.props,y,h)),s&&u.createElement("line",D({className:"recharts-polar-angle-axis-tick-line"},l,g)),o&&e.renderTickItem(o,j,c?c(y.value,h):y.value))});return u.createElement(S,{className:"recharts-polar-angle-axis-ticks"},v)}},{key:"render",value:function(){var r=this.props,i=r.ticks,a=r.radius,o=r.axisLine;return a<=0||!i||!i.length?null:u.createElement(S,{className:N("recharts-polar-angle-axis",this.props.className)},o&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(r,i,a){var o;return u.isValidElement(r)?o=u.cloneElement(r,i):B(r)?o=r(i):o=u.createElement(Ke,D({},i,{className:"recharts-polar-angle-axis-tick-value"}),a),o}}])})(A.PureComponent);ie(Y,"displayName","PolarAngleAxis");ie(Y,"axisType","angleAxis");ie(Y,"defaultProps",{type:"category",angleAxisId:0,scale:"auto",cx:0,cy:0,orientation:"outer",axisLine:!0,tickLine:!0,tickSize:8,tick:!0,hide:!1,allowDuplicatedCategory:!0});var ue,Ce;function pr(){if(Ce)return ue;Ce=1;function t(e){return e&&e.length?e[0]:void 0}return ue=t,ue}var fe,Be;function dr(){return Be||(Be=1,fe=pr()),fe}var mr=dr();const yr=he(mr);var hr=["key"];function W(t){"@babel/helpers - typeof";return W=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},W(t)}function vr(t,e){if(t==null)return{};var n=gr(t,e),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)r=a[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function gr(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function te(){return te=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},te.apply(this,arguments)}function Fe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function P(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Fe(Object(n),!0).forEach(function(r){E(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Fe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function br(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ze(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,tt(r.key),r)}}function xr(t,e,n){return e&&ze(t.prototype,e),n&&ze(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Pr(t,e,n){return e=re(e),Or(t,et()?Reflect.construct(e,n||[],re(t).constructor):e.apply(t,n))}function Or(t,e){if(e&&(W(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return jr(t)}function jr(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function et(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(et=function(){return!!t})()}function re(t){return re=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},re(t)}function kr(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ye(t,e)}function ye(t,e){return ye=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},ye(t,e)}function E(t,e,n){return e=tt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function tt(t){var e=wr(t,"string");return W(e)=="symbol"?e:e+""}function wr(t,e){if(W(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(W(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var J=(function(t){function e(){var n;br(this,e);for(var r=arguments.length,i=new Array(r),a=0;a<r;a++)i[a]=arguments[a];return n=Pr(this,e,[].concat(i)),E(n,"state",{isAnimationFinished:!1}),E(n,"handleAnimationEnd",function(){var o=n.props.onAnimationEnd;n.setState({isAnimationFinished:!0}),B(o)&&o()}),E(n,"handleAnimationStart",function(){var o=n.props.onAnimationStart;n.setState({isAnimationFinished:!1}),B(o)&&o()}),E(n,"handleMouseEnter",function(o){var s=n.props.onMouseEnter;s&&s(n.props,o)}),E(n,"handleMouseLeave",function(o){var s=n.props.onMouseLeave;s&&s(n.props,o)}),n}return kr(e,t),xr(e,[{key:"renderDots",value:function(r){var i=this.props,a=i.dot,o=i.dataKey,s=b(this.props,!1),c=b(a,!0),d=r.map(function(f,m){var l=P(P(P({key:"dot-".concat(m),r:3},s),c),{},{dataKey:o,cx:f.x,cy:f.y,index:m,payload:f});return e.renderDotItem(a,l)});return u.createElement(S,{className:"recharts-radar-dots"},d)}},{key:"renderPolygonStatically",value:function(r){var i=this.props,a=i.shape,o=i.dot,s=i.isRange,c=i.baseLinePoints,d=i.connectNulls,f;return u.isValidElement(a)?f=u.cloneElement(a,P(P({},this.props),{},{points:r})):B(a)?f=a(P(P({},this.props),{},{points:r})):f=u.createElement(Ze,te({},b(this.props,!0),{onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave,points:r,baseLinePoints:s?c:null,connectNulls:d})),u.createElement(S,{className:"recharts-radar-polygon"},f,o?this.renderDots(r):null)}},{key:"renderPolygonWithAnimation",value:function(){var r=this,i=this.props,a=i.points,o=i.isAnimationActive,s=i.animationBegin,c=i.animationDuration,d=i.animationEasing,f=i.animationId,m=this.state.prevPoints;return u.createElement(dt,{begin:s,duration:c,isActive:o,easing:d,from:{t:0},to:{t:1},key:"radar-".concat(f),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(l){var v=l.t,y=m&&m.length/a.length,h=a.map(function(g,O){var j=m&&m[Math.floor(O*y)];if(j){var ae=X(j.x,g.x),oe=X(j.y,g.y);return P(P({},g),{},{x:ae(v),y:oe(v)})}var x=X(g.cx,g.x),$=X(g.cy,g.y);return P(P({},g),{},{x:x(v),y:$(v)})});return r.renderPolygonStatically(h)})}},{key:"renderPolygon",value:function(){var r=this.props,i=r.points,a=r.isAnimationActive,o=r.isRange,s=this.state.prevPoints;return a&&i&&i.length&&!o&&(!s||!mt(s,i))?this.renderPolygonWithAnimation():this.renderPolygonStatically(i)}},{key:"render",value:function(){var r=this.props,i=r.hide,a=r.className,o=r.points,s=r.isAnimationActive;if(i||!o||!o.length)return null;var c=this.state.isAnimationFinished,d=N("recharts-radar",a);return u.createElement(S,{className:d},this.renderPolygon(),(!s||c)&&yt.renderCallByParent(this.props,o))}}],[{key:"getDerivedStateFromProps",value:function(r,i){return r.animationId!==i.prevAnimationId?{prevAnimationId:r.animationId,curPoints:r.points,prevPoints:i.curPoints}:r.points!==i.curPoints?{curPoints:r.points}:null}},{key:"renderDotItem",value:function(r,i){var a;if(u.isValidElement(r))a=u.cloneElement(r,i);else if(B(r))a=r(i);else{var o=i.key,s=vr(i,hr);a=u.createElement(He,te({},s,{key:o,className:N("recharts-radar-dot",typeof r!="boolean"?r.className:"")}))}return a}}])})(A.PureComponent);E(J,"displayName","Radar");E(J,"defaultProps",{angleAxisId:0,radiusAxisId:0,hide:!1,activeDot:!0,dot:!1,legendType:"rect",isAnimationActive:!ht.isSsr,animationBegin:0,animationDuration:1500,animationEasing:"ease"});E(J,"getComposedData",function(t){var e=t.radiusAxis,n=t.angleAxis,r=t.displayedData,i=t.dataKey,a=t.bandSize,o=n.cx,s=n.cy,c=!1,d=[],f=n.type!=="number"?a??0:0;r.forEach(function(l,v){var y=we(l,n.dataKey,v),h=we(l,i),g=n.scale(y)+f,O=Array.isArray(h)?vt(h):h,j=_e(O)?void 0:e.scale(O);Array.isArray(h)&&h.length>=2&&(c=!0),d.push(P(P({},w(o,s,j,g)),{},{name:y,value:h,cx:o,cy:s,radius:j,angle:g,payload:l}))});var m=[];return c&&d.forEach(function(l){if(Array.isArray(l.value)){var v=yr(l.value),y=_e(v)?void 0:e.scale(v);m.push(P(P({},l),{},{radius:y},w(o,s,y,l.angle)))}else m.push(l)}),{points:d,isRange:c,baseLinePoints:m}});var _r=gt({chartName:"RadarChart",GraphicalChild:J,axisComponents:[{axisType:"angleAxis",AxisComp:Y},{axisType:"radiusAxis",AxisComp:U}],formatAxisMap:bt,defaultProps:{layout:"centric",startAngle:90,endAngle:-270,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}});const zr=()=>{const{userProfile:t}=it(),[e,n]=A.useState([]),[r,i]=A.useState([]),[a,o]=A.useState("N/A"),[s,c]=A.useState(!0),[d,f]=A.useState(!1),m=["#1FA7E1","#9956DE","#75D06A","#FFB356","#7274ED","#FF8B8B","#6ED1CF","#FB96BB"];return A.useEffect(()=>{if(!t?.uid){c(!1);return}const l=t.role==="student"?t.grade:null,y=st(l)[0]??"gen-math",h=ke.find(x=>x.id===y)?.modules||[],g=new Map;ke.forEach(x=>{x.modules.forEach($=>g.set($.id,x.id))});const O=h.map((x,$)=>({id:x.id,name:x.title.length>15?x.title.substring(0,15).trim()+"...":x.title,color:m[$%m.length]}));i(O);const j=[{key:"progress",label:"Overall Mastery"},{key:"concept",label:"Concept Grasp"},{key:"application",label:"Application"},{key:"engagement",label:"Engagement"},{key:"consistency",label:"Consistency"}],ae=x=>{let $=-1,ve="N/A";const ge=j.map(_=>{const K={metric:_.label,fullMark:100};return h.forEach(k=>{const I=g.get(k.id),M=I?x?.subjects?.[I]?.modulesProgress?.[k.id]:null,be=M?.progress||0,rt=x?.lessons??{},xe=k.lessons.length?k.lessons.reduce((Oe,je)=>{const se=rt?.[je.id]?.progressPercent;if(typeof se=="number"&&Number.isFinite(se))return Oe+Math.max(0,Math.min(100,se));const nt=!!M?.lessonsCompleted?.includes?.(je.id);return Oe+(nt?100:0)},0)/k.lessons.length:0,Pe=k.quizzes.length?(M?.quizzesCompleted?.length||0)/k.quizzes.length*100:0;let C=0;_.key==="progress"?C=be:_.key==="concept"?C=xe:_.key==="application"?C=Pe:_.key==="engagement"?C=Math.min(100,(xe+Pe*2)/1.5):_.key==="consistency"&&(C=Math.min(100,40+be*.6)),K[k.id]=C||0}),K});h.forEach(_=>{let K=0;ge.forEach(I=>{const M=I[_.id];K+=typeof M=="number"?M:0});const k=K/j.length;k>$&&($=k,ve=O.find(I=>I.id===_.id)?.name||"N/A")}),o(ve),n(ge),c(!1)};c(!0);const oe=at(t.uid,x=>{ae(x)});return()=>oe()},[t?.uid]),p.jsxs(ot.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5,ease:[.22,1,.36,1]},className:"relative overflow-hidden bg-white/80 backdrop-blur-xl border border-white/50 shadow-[0_8px_30px_rgb(0,0,0,0.04)] rounded-[2rem] p-6 lg:p-8 isolate group",onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),children:[p.jsx("div",{className:"absolute top-0 right-0 w-64 h-64 bg-violet-400/5 rounded-full blur-3xl -translate-y-1/2 translate-x-1/4"}),p.jsx("div",{className:"absolute bottom-0 left-0 w-48 h-48 bg-rose-400/5 rounded-full blur-3xl translate-y-1/3 -translate-x-1/3"}),p.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between mb-8 relative z-10 gap-4",children:[p.jsxs("div",{children:[p.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[p.jsx("span",{className:"p-2 bg-violet-100 text-violet-600 rounded-xl",children:p.jsx(ct,{size:20,className:"stroke-[2.5]"})}),p.jsx("h3",{className:"text-xl font-display font-extrabold text-[#0a1628] tracking-tight",children:"Competency Matrix"})]}),p.jsx("p",{className:"text-sm text-[#5a6578] font-body ml-12",children:"Your realtime performance across modules"})]}),p.jsxs("div",{className:"flex items-center gap-3 bg-slate-50 border border-slate-100 px-4 py-2 rounded-2xl ml-12 sm:ml-0",children:[p.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-full bg-white shadow-sm border border-slate-100",children:p.jsx(lt,{size:14,className:"text-amber-500"})}),p.jsxs("div",{children:[p.jsx("p",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider",children:"Top Module"}),p.jsx("p",{className:"text-sm font-bold text-slate-700",children:a})]})]})]}),p.jsx("div",{className:"h-[300px] sm:h-[360px] w-full relative z-10",children:s?p.jsx("div",{className:"w-full h-full flex items-center justify-center",children:p.jsxs("div",{className:"flex flex-col items-center gap-3",children:[p.jsx("div",{className:"w-8 h-8 border-4 border-violet-200 border-t-violet-500 rounded-full animate-spin"}),p.jsx("p",{className:"text-sm text-slate-400 font-medium",children:"Analyzing skill vectors..."})]})}):p.jsx(xt,{width:"100%",height:"100%",children:p.jsxs(_r,{cx:"50%",cy:"50%",outerRadius:d?"75%":"70%",data:e,children:[p.jsx(Ue,{stroke:"#e2e8f0",strokeDasharray:"4 4",polarRadius:[20,40,60,80,100]}),p.jsx(Y,{dataKey:"metric",tick:{fill:"#475569",fontSize:12,fontWeight:600,fontFamily:"Inter, sans-serif"}}),p.jsx(U,{angle:90,domain:[0,100],tick:{fill:"#94a3b8",fontSize:10},tickCount:6,axisLine:!1}),r.map(l=>p.jsx(J,{name:l.name,dataKey:l.id,stroke:l.color,strokeWidth:2,fill:l.color,fillOpacity:.35,dot:{r:3,fill:"#fff",stroke:l.color,strokeWidth:2},activeDot:{r:5,fill:l.color,stroke:"#fff",strokeWidth:2},isAnimationActive:!0,animationDuration:1500,animationEasing:"ease-out"},l.id)),p.jsx(Pt,{cursor:!1,content:({active:l,payload:v})=>l&&v&&v.length?p.jsxs("div",{className:"bg-white/95 backdrop-blur shadow-[0_10px_40px_-10px_rgba(0,0,0,0.15)] border border-slate-100 rounded-xl p-4",children:[p.jsx("p",{className:"font-display font-bold text-slate-800 text-sm mb-3",children:v[0].payload.metric}),p.jsx("div",{className:"flex flex-col gap-2",children:v.map(y=>p.jsxs("div",{className:"flex items-center justify-between gap-4",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:y.stroke}}),p.jsx("span",{className:"text-xs font-bold text-slate-600 uppercase tracking-wide truncate max-w-[120px]",title:String(y.name),children:String(y.name)})]}),p.jsxs("span",{className:"text-sm font-black",style:{color:y.stroke},children:[Math.round(y.value),"%"]})]},y.name))})]}):null})]})})}),!s&&r.length>0&&p.jsx("div",{className:"flex flex-wrap justify-center items-center gap-3 md:gap-5 mt-[5px] z-10 relative",children:r.map(l=>p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx("div",{className:"w-2.5 h-2.5 rounded-full",style:{backgroundColor:l.color}}),p.jsx("span",{className:"text-[10px] font-bold text-slate-600 uppercase tracking-widest",children:l.name.length>15?l.name.substring(0,12)+"...":l.name})]},l.id))})]})};export{zr as CompetencyRadarChart};
 
 
 
assets/CompositeAvatar-DMpjm5UY.js DELETED
@@ -1 +0,0 @@
1
- import{j as t}from"./vendor-react-Dexh7fmo.js";import{g as e}from"./avatarData-BW_TX0b4.js";import{m as s}from"./index-D4nJsLyx.js";const g=({layers:a,className:o="w-10 h-10 bg-slate-200 rounded-full",fallbackSrc:m})=>{const n=e(a?.top),i=e(a?.bottom),l=e(a?.shoes),r=e(a?.accessory),c=t.jsx("img",{src:"/avatar/avatar_body_base.png",alt:"base body",className:"absolute inset-0 w-full h-full object-contain z-10"}),u=t.jsxs(s.div,{className:"absolute inset-0 w-full h-full z-50 pointer-events-none",animate:{rotate:[-2,2,-2],y:[0,-3,0]},transition:{repeat:1/0,duration:4,ease:"easeInOut"},style:{originY:.7,originX:.5},children:[t.jsx(s.img,{src:"/avatar/left_horn.png",alt:"left horn",className:"absolute inset-0 w-full h-full object-contain origin-[50%_45%] z-0",animate:{rotate:[-4,4,-4]},transition:{repeat:1/0,duration:4,ease:"easeInOut"}}),t.jsx(s.img,{src:"/avatar/right_horn.png",alt:"right horn",className:"absolute inset-0 w-full h-full object-contain origin-[50%_45%] z-0",animate:{rotate:[4,-4,4]},transition:{repeat:1/0,duration:4,ease:"easeInOut"}}),t.jsx("img",{src:"/avatar/avatar_head_base.png",alt:"head base",className:"absolute inset-0 w-full h-full object-contain z-10"}),t.jsx(s.img,{src:"/avatar/eyes_default.png",alt:"Avatar Eyes",className:"absolute inset-0 w-full h-full object-contain z-10",style:{originY:"50%"},animate:{scaleY:[1,.1,1]},transition:{duration:.2,repeat:1/0,repeatDelay:3.8,ease:"easeInOut"}}),r&&t.jsx("img",{src:r,alt:"accessory",className:"absolute inset-0 w-full h-full object-contain z-20"})]});return!a||!a.top&&!a.bottom&&!a.shoes&&!a.accessory?t.jsxs("div",{className:`relative overflow-hidden ${o}`,children:[c,u]}):t.jsxs("div",{className:`relative overflow-hidden ${o}`,children:[c,i&&t.jsx("img",{src:i,alt:"bottom",className:"absolute inset-0 w-full h-full object-contain z-20"}),l&&t.jsx("img",{src:l,alt:"shoes",className:"absolute inset-0 w-full h-full object-contain z-30"}),n&&t.jsx("img",{src:n,alt:"top",className:"absolute inset-0 w-full h-full object-contain z-40"}),u]})};export{g as C};
 
 
assets/ConfirmModal-DGrnpObD.js DELETED
@@ -1 +0,0 @@
1
- import{j as e}from"./vendor-react-Dexh7fmo.js";import{B as i}from"./button-BpeUVhBo.js";import{e as f,m as r,T as h}from"./index-D4nJsLyx.js";import{X as y}from"./x-BONnp2RF.js";import{T as j}from"./trash-2-BoXE_mye.js";import{L as w}from"./log-out-BqGKt-tT.js";import"./vendor-radix-BRdei-zg.js";import"./clsx-B-dksMZM.js";import"./utils-BQQgILNW.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-firestore-BML5nJHm.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";const O=({isOpen:s,onClose:t,onConfirm:n,title:a,message:l,confirmText:c="Confirm",cancelText:d="Cancel",type:m="warning",icon:x="warning",zIndexClass:g="z-50"})=>{const b=()=>{switch(x){case"logout":return e.jsx(w,{size:32});case"delete":return e.jsx(j,{size:32});case"warning":default:return e.jsx(h,{size:32})}},o=(()=>{switch(m){case"danger":return{iconBg:"bg-red-100",iconColor:"text-red-600",buttonBg:"bg-red-600 hover:bg-red-700",buttonText:"text-white"};case"warning":return{iconBg:"bg-rose-100",iconColor:"text-rose-600",buttonBg:"bg-rose-600 hover:bg-rose-700",buttonText:"text-white"};case"info":default:return{iconBg:"bg-sky-100",iconColor:"text-sky-600",buttonBg:"bg-sky-600 hover:bg-sky-700",buttonText:"text-white"}}})(),p=async()=>{try{await n(),t()}catch{}};return e.jsx(f,{children:s&&e.jsx(e.Fragment,{children:e.jsx(r.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:t,className:`fixed inset-0 bg-black/50 backdrop-blur-sm ${g} flex items-center justify-center p-4`,children:e.jsxs(r.div,{initial:{opacity:0,scale:.9,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.9,y:20},transition:{type:"spring",damping:25,stiffness:300},onClick:u=>u.stopPropagation(),className:"bg-[#f7f9fc] rounded-3xl shadow-2xl max-w-md w-full overflow-hidden border border-[#dde3eb]",children:[e.jsx("button",{onClick:t,className:"absolute top-4 right-4 p-2 text-slate-500 hover:text-[#0a1628] hover:bg-[#dde3eb] rounded-xl transition-colors z-10",children:e.jsx(y,{size:20})}),e.jsxs("div",{className:"p-8 text-center",children:[e.jsx(r.div,{initial:{scale:0},animate:{scale:1},transition:{delay:.1,type:"spring",damping:15},className:`w-20 h-20 ${o.iconBg} rounded-full flex items-center justify-center mx-auto mb-6 ${o.iconColor}`,children:b()}),e.jsx("h2",{className:"text-2xl font-display font-bold text-[#0a1628] mb-3",children:a}),e.jsx("p",{className:"text-[#5a6578] mb-8 leading-relaxed",children:l}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx(i,{onClick:t,variant:"outline",size:"lg",className:"flex-1 h-12 rounded-xl border-[#dde3eb] hover:border-[#d1cec6] hover:bg-[#edf1f7] font-bold",children:d}),e.jsx(i,{onClick:p,size:"lg",className:`flex-1 h-12 rounded-xl font-bold ${o.buttonBg} ${o.buttonText} transition-colors shadow-lg`,children:c})]})]})]})})})})};export{O as default};
 
 
assets/DashboardAvatar-CHVNq8nF.js DELETED
@@ -1 +0,0 @@
1
- import{j as a}from"./vendor-react-Dexh7fmo.js";import{g as e}from"./avatarData-BW_TX0b4.js";import{m as r}from"./index-D4nJsLyx.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-firestore-BML5nJHm.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";const x=({className:l="w-full h-full",layers:s})=>{const t="absolute inset-0 w-full h-full object-contain object-bottom",o=e(s?.top),i=e(s?.bottom),n=e(s?.shoes),c=e(s?.accessory);return a.jsxs("div",{className:`relative flex items-end justify-center ${l}`,children:[a.jsx("img",{src:"/avatar/avatar_body_base.png",alt:"Avatar Body",className:`${t} z-10`}),i&&a.jsx("img",{src:i,alt:"Pants",className:`${t} z-[12]`}),n&&a.jsx("img",{src:n,alt:"Shoes",className:`${t} z-[11]`}),o&&a.jsx("img",{src:o,alt:"Uniform",className:`${t} z-[13]`}),a.jsxs(r.div,{className:"absolute inset-0 w-full h-full z-30",style:{originY:"80%"},animate:{rotate:[-2,2,-2]},transition:{duration:4,ease:"easeInOut",repeat:1/0},children:[a.jsx("img",{src:"/avatar/avatar_head_base.png",alt:"Avatar Head",className:`${t} z-[1]`}),a.jsx(r.img,{src:"/avatar/eyes_default.png",alt:"Avatar Eyes",className:`${t} z-[2]`,style:{originY:"50%"},animate:{scaleY:[1,.1,1]},transition:{duration:.2,repeat:1/0,repeatDelay:3.8,ease:"easeInOut"}}),a.jsxs(r.div,{className:`${t} z-[3]`,style:{originY:"bottom"},animate:{rotate:[1,-1,1]},transition:{duration:3.5,ease:"easeInOut",repeat:1/0},children:[a.jsx("img",{src:"/avatar/left_horn.png",alt:"Left Horn",className:t}),a.jsx("img",{src:"/avatar/right_horn.png",alt:"Right Horn",className:t})]}),c&&a.jsx("img",{src:c,alt:"Accessory",className:`${t} z-[4]`})]})]})};export{x as DashboardAvatar,x as default};
 
 
assets/DashboardAvatar-CK5sUmxI.js ADDED
@@ -0,0 +1 @@
 
 
1
+ import{j as a}from"./vendor-react-CCIuKUIB.js";import{g as e,m as r}from"./index-B36njGvu.js";import"./vendor-firebase-auth-DUGvAaJx.js";import"./vendor-firebase-core-BireMWc7.js";import"./vendor-firebase-firestore-C0C-blIn.js";import"./vendor-firebase-storage-CnCozLgy.js";import"./vendor-firebase-analytics-FE_tmzXh.js";import"./vendor-radix-DkXsqQ-A.js";import"./vendor-markdown-CDZ6ydrN.js";const h=({className:l="w-full h-full",layers:s})=>{const t="absolute inset-0 w-full h-full object-contain object-bottom",i=e(s?.top),o=e(s?.bottom),n=e(s?.shoes),c=e(s?.accessory);return a.jsxs("div",{className:`relative flex items-end justify-center ${l}`,children:[a.jsx("img",{src:"/avatar/avatar_body_base.png",alt:"Avatar Body",className:`${t} z-10`}),o&&a.jsx("img",{src:o,alt:"Pants",className:`${t} z-[12]`}),n&&a.jsx("img",{src:n,alt:"Shoes",className:`${t} z-[11]`}),i&&a.jsx("img",{src:i,alt:"Uniform",className:`${t} z-[13]`}),a.jsxs(r.div,{className:"absolute inset-0 w-full h-full z-30",style:{originY:"80%"},animate:{rotate:[-2,2,-2]},transition:{duration:4,ease:"easeInOut",repeat:1/0},children:[a.jsx("img",{src:"/avatar/avatar_head_base.png",alt:"Avatar Head",className:`${t} z-[1]`}),a.jsx(r.img,{src:"/avatar/eyes_default.png",alt:"Avatar Eyes",className:`${t} z-[2]`,style:{originY:"50%"},animate:{scaleY:[1,.1,1]},transition:{duration:.2,repeat:1/0,repeatDelay:3.8,ease:"easeInOut"}}),a.jsxs(r.div,{className:`${t} z-[3]`,style:{originY:"bottom"},animate:{rotate:[1,-1,1]},transition:{duration:3.5,ease:"easeInOut",repeat:1/0},children:[a.jsx("img",{src:"/avatar/left_horn.png",alt:"Left Horn",className:t}),a.jsx("img",{src:"/avatar/right_horn.png",alt:"Right Horn",className:t})]}),c&&a.jsx("img",{src:c,alt:"Accessory",className:`${t} z-[4]`})]})]})};export{h as DashboardAvatar,h as default};
assets/DiagnosticAssessmentModal-C541tkg_.js DELETED
@@ -1 +0,0 @@
1
- import{r as m,c as z,j as e}from"./vendor-react-Dexh7fmo.js";import{B as E}from"./button-BpeUVhBo.js";import{M as ye}from"./MathAnswerInput-DNG5LFL4.js";import be from"./ScientificCalculator-wlhyNBDf.js";import{triggerDiagnosticCompleted as ge}from"./automationService-DNyauqGd.js";import{m as g,C as T,e as O,T as Q}from"./index-D4nJsLyx.js";import{B as J}from"./brain-CPvGdgWE.js";import{X as Z}from"./x-BONnp2RF.js";import{C as ee}from"./circle-check-big-0Gzyt_f3.js";import{C as ve}from"./chevron-right-COMox1Xb.js";import{C as we}from"./chart-column-D5mAWcRx.js";import{T as je}from"./trending-up-D-vj8Gbq.js";import"./vendor-radix-BRdei-zg.js";import"./clsx-B-dksMZM.js";import"./utils-BQQgILNW.js";import"./apiService-axx1LHMk.js";import"./chevron-up-Bfmq3Clw.js";import"./vendor-firebase-firestore-BML5nJHm.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";const H="iar-v2-deped-g11-core-g12-candidate-shortform",ae=[{id:"iar-fn-01",topicArea:"Functions",gradeLevel:"G11",quarter:1,difficulty:"basic",competencyCode:"M11GM-Ia-2",competencyDescription:"Evaluates a function and solves basic linear expressions.",answerType:"MCQ",depedBasis:"depedPattern",prompt:"Solve for x: 3x - 4 = 17",options:["5","6","7","8"],correctOptionIndex:2,isConfidenceProbe:!1,scorable:!0,estimatedSeconds:35},{id:"iar-fn-02",topicArea:"Functions",gradeLevel:"G11",quarter:1,difficulty:"standard",competencyCode:"M11GM-Ib-5",competencyDescription:"Finds the domain of a rational function.",answerType:"MCQ",depedBasis:"depedPattern",prompt:"What is the domain of f(x) = 5 / (x - 2)?",options:["All real numbers","x > 2","x โ‰  2","x < 2"],correctOptionIndex:2,isConfidenceProbe:!1,scorable:!0,estimatedSeconds:45},{id:"iar-fn-03",topicArea:"Functions",gradeLevel:"G11",quarter:2,difficulty:"standard",competencyCode:"M11GM-Ie-f-1",competencyDescription:"Solves exponential equations in real-life growth contexts.",answerType:"shortAnswerNumeric",depedBasis:"depedPattern",prompt:"A quantity doubles every hour. If it starts at 3, what is the value after 4 hours?",acceptableNumericAnswers:[48],numericTolerance:0,isConfidenceProbe:!1,scorable:!0,estimatedSeconds:55},{id:"iar-fn-04",topicArea:"Functions",gradeLevel:"G11",quarter:2,difficulty:"challenge",competencyCode:"M11GM-Ii-4",competencyDescription:"Determines intercepts and asymptotic behavior of logarithmic functions.",answerType:"MCQ",depedBasis:"depedPattern",prompt:"Which statement is true for f(x) = log(x - 1)?",options:["Domain is all real numbers.","Vertical asymptote is x = 1.","x-intercept is always 0.","Range is x > 1."],correctOptionIndex:1,isConfidenceProbe:!1,scorable:!0,estimatedSeconds:55},{id:"iar-fn-c1",topicArea:"Functions",gradeLevel:"G11",quarter:2,difficulty:"standard",competencyCode:"M11GM-Id-2",competencyDescription:"Determines the inverse of a one-to-one function.",answerType:"shortAnswerNumeric",depedBasis:"depedPattern",prompt:"If f(x) = 2x + 3, what is fโปยน(11)?",acceptableNumericAnswers:[4],numericTolerance:0,isConfidenceProbe:!1,scorable:!0,estimatedSeconds:35},{id:"iar-bm-01",topicArea:"BusinessMath",gradeLevel:"G11",quarter:3,difficulty:"basic",competencyCode:"M11GM-IIa-b-1",competencyDescription:"Computes simple interest and maturity value.",answerType:"shortAnswerNumeric",depedBasis:"depedPattern",prompt:"Find the simple interest on PHP 8,000 at 5% annual rate for 2 years.",acceptableNumericAnswers:[800],numericTolerance:0,isConfidenceProbe:!1,scorable:!0,estimatedSeconds:45},{id:"iar-bm-02",topicArea:"BusinessMath",gradeLevel:"G11",quarter:3,difficulty:"standard",competencyCode:"M11GM-IIa-2",competencyDescription:"Distinguishes simple and compound interest contexts.",answerType:"MCQ",depedBasis:"depedPattern",prompt:"Which statement correctly describes compound interest?",options:["Interest is based only on original principal.","Interest is computed once at maturity.","Interest is computed on principal plus accumulated interest.","Interest is always lower than simple interest."],correctOptionIndex:2,isConfidenceProbe:!1,scorable:!0,estimatedSeconds:45},{id:"iar-bm-03",topicArea:"BusinessMath",gradeLevel:"G11",quarter:3,difficulty:"standard",competencyCode:"M11GM-IIc-d-1",competencyDescription:"Computes annuity future value in basic settings.",answerType:"MCQ",depedBasis:"depedPattern",prompt:"A student saves PHP 1,000 monthly for 6 months with no interest. What is the accumulated amount?",options:["PHP 5,000","PHP 6,000","PHP 7,000","PHP 12,000"],correctOptionIndex:1,isConfidenceProbe:!1,scorable:!0,estimatedSeconds:40},{id:"iar-bm-04",topicArea:"BusinessMath",gradeLevel:"G11",quarter:3,difficulty:"challenge",competencyCode:"M11GM-IIf-3",competencyDescription:"Solves business and consumer loan scenarios.",answerType:"MCQ",depedBasis:"depedPattern",prompt:"A borrower receives PHP 20,000 and repays PHP 22,400 after 1 year. What is the annual simple interest rate?",options:["8%","10%","12%","14%"],correctOptionIndex:2,isConfidenceProbe:!1,scorable:!0,estimatedSeconds:60},{id:"iar-bm-c1",topicArea:"BusinessMath",gradeLevel:"G11",quarter:3,difficulty:"standard",competencyCode:"M11GM-IIc-d-1",competencyDescription:"Finds future value and present value of annuities.",answerType:"shortAnswerNumeric",depedBasis:"depedPattern",prompt:"Without interest, what is the present value of a 12-month annuity paying PHP 500 each month?",acceptableNumericAnswers:[6e3],numericTolerance:0,isConfidenceProbe:!1,scorable:!0,estimatedSeconds:40},{id:"iar-lg-01",topicArea:"Logic",gradeLevel:"G11",quarter:4,difficulty:"basic",competencyCode:"M11GM-IIg-1",competencyDescription:"Identifies and negates propositions.",answerType:"MCQ",depedBasis:"depedPattern",prompt:'If p is "All triangles have three sides," what is not p?',options:["Some triangles have three sides.","No triangle has three sides.","At least one triangle does not have three sides.","All triangles are polygons."],correctOptionIndex:2,isConfidenceProbe:!1,scorable:!0,estimatedSeconds:45},{id:"iar-lg-02",topicArea:"Logic",gradeLevel:"G11",quarter:4,difficulty:"standard",competencyCode:"M11GM-IIh-1",competencyDescription:"Determines truth values of compound propositions.",answerType:"MCQ",depedBasis:"depedPattern",prompt:"When p is true and q is false, what is the truth value of p -> q?",options:["True","False","Cannot be determined","Both true and false"],correctOptionIndex:1,isConfidenceProbe:!1,scorable:!0,estimatedSeconds:40},{id:"iar-lg-03",topicArea:"Logic",gradeLevel:"G11",quarter:4,difficulty:"standard",competencyCode:"M11GM-IIi-1",competencyDescription:"Identifies common reasoning fallacies in short arguments.",answerType:"shortAnswerText",depedBasis:"depedPattern",prompt:'A post says, "Everyone in my class passed because we used this lucky pen." Type the best label for this weak reasoning.',acceptableTextAnswers:["false cause","false causation","post hoc","hasty generalization"],isConfidenceProbe:!1,scorable:!0,estimatedSeconds:60},{id:"iar-lg-04",topicArea:"Logic",gradeLevel:"G11",quarter:4,difficulty:"challenge",competencyCode:"M11GM-IIi-2",competencyDescription:"Determines the validity of categorical syllogisms.",answerType:"MCQ",depedBasis:"depedPattern",prompt:"All squares are rectangles. All rectangles are quadrilaterals. Therefore all squares are quadrilaterals. This argument is:",options:["Valid","Invalid","A fallacy of composition","A contradiction"],correctOptionIndex:0,isConfidenceProbe:!1,scorable:!0,estimatedSeconds:55},{id:"iar-lg-c1",topicArea:"Logic",gradeLevel:"G11",quarter:4,difficulty:"standard",competencyCode:"M11GM-IIj-1",competencyDescription:"Illustrates methods of proof and disproof.",answerType:"MCQ",depedBasis:"depedPattern",prompt:'To prove "if n is even then nยฒ is even," which method is commonly used?',options:["Direct proof","Proof by contradiction only","Survey method","Graph sketch only"],correctOptionIndex:0,isConfidenceProbe:!1,scorable:!0,estimatedSeconds:40}];function Ne(s){return s>=75?"Mastered":s>=40?"NeedsReview":"HighRisk"}function Ce(){return ae.filter(s=>s.depedBasis==="depedPattern"&&!!s.competencyCode)}function ke(s=ae){const n=s.reduce((p,h)=>p+h.estimatedSeconds,0);return Math.round(n/60*10)/10}const te={Functions:"Functions and Graphs",BusinessMath:"Business and Financial Mathematics",Logic:"Logic and Reasoning"},Me={atRiskSubjectIds:[],questionSetVersion:H},x=Ce(),se=s=>s.trim().toLowerCase().replace(/\s+/g," "),re=(s,n)=>{if(!s.scorable)return!1;if(s.answerType==="MCQ")return typeof n=="number"&&n===s.correctOptionIndex;if(s.answerType==="shortAnswerNumeric"){if(typeof n!="string")return!1;const p=Number(n);if(Number.isNaN(p))return!1;const h=s.numericTolerance??0;return(s.acceptableNumericAnswers||[]).some(B=>Math.abs(p-B)<=h)}if(s.answerType==="shortAnswerText"){if(typeof n!="string")return!1;const p=se(n);return(s.acceptableTextAnswers||[]).some(h=>se(h)===p)}return!1},Ae=s=>s==="Mastered"?"text-teal-600 bg-teal-50":s==="NeedsReview"?"text-amber-700 bg-amber-50":"text-red-600 bg-red-50",Ie=s=>s==="NeedsReview"?"Needs Review":s==="HighRisk"?"High Risk":"Mastered",et=({isOpen:s,onClose:n,onComplete:p,lrn:h,gradeLevel:B="Grade 11",workflowMode:ie="iar_only",assessmentType:N="initial_assessment"})=>{const[v,L]=m.useState("intro"),[y,W]=m.useState(0),[ne,_]=m.useState([]),[C,I]=m.useState(""),[w,j]=m.useState(!1),[oe,b]=m.useState(!1),[a,q]=m.useState(null),[u,$]=m.useState(null),[k,V]=m.useState([]),[Se,U]=m.useState(!1);z.useEffect(()=>{s&&(L("intro"),W(0),_([]),I(""),j(!1),b(!1),q(null),$(null),V([]))},[s]),z.useEffect(()=>{if(!s||v!=="test"){b(!1);return}if(y>0||w){b(!1);return}b(!0);const t=window.setTimeout(()=>{b(!1)},2800);return()=>window.clearTimeout(t)},[s,v,y,w]);const ce=()=>{p({status:"skipped",...Me}),n()},R=()=>{n()};z.useEffect(()=>{if(!s)return;const t=i=>{i.key==="Escape"&&R()};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[s]);const le=()=>{L("test")},de=t=>{_(t),I(""),j(!1),y<x.length-1?setTimeout(()=>{W(i=>i+1)},300):pe(t)},K=t=>{const i=[...ne];i[y]=t,de(i)},G=()=>{C.trim()&&K(C.trim())},pe=async t=>{const i=[],S={Functions:{correct:0,total:0},BusinessMath:{correct:0,total:0},Logic:{correct:0,total:0}},fe={Functions:[],BusinessMath:[],Logic:[]},P={};x.forEach((r,c)=>{const l=t[c];if(r.answerType==="confidenceLikert"&&typeof l=="number"&&fe[r.topicArea].push(l+1),!r.scorable)return;const d=re(r,l);S[r.topicArea].total+=1,d&&(S[r.topicArea].correct+=1),P[r.topicArea]||(P[r.topicArea]=[]),P[r.topicArea].push({correct:d,questionId:r.id,difficulty:r.difficulty,gradeLevelTag:r.gradeLevel,quarter:r.quarter,answerType:r.answerType})});const o=Object.keys(S).reduce((r,c)=>{const{correct:l,total:d}=S[c],M=d>0?Math.round(l/d*100):0,A=Ne(M);return A!=="Mastered"&&i.push(c),r[c]={correct:l,total:d,scorePercent:M,classification:A},r},{}),D=x.filter(r=>r.scorable&&r.gradeLevel==="G12Candidate"),xe=D.reduce((r,c)=>{const l=x.findIndex(d=>d.id===c.id);return r+(re(c,t[l])?1:0)},0),F=D.length>0?xe/D.length:1,he={readyForFiniteMath:Object.values(o).filter(r=>r.classification==="Mastered").length/3>=.67&&o.Functions.classification!=="HighRisk"&&o.BusinessMath.classification!=="HighRisk"&&F>=.5,readyForAdvancedStats:o.Logic.classification==="Mastered"&&F>=.67,readyForCalcIntro:o.Functions.classification==="Mastered"&&F>=.67,needsStrongerFunctions:o.Functions.classification!=="Mastered",needsStrongerBusinessMath:o.BusinessMath.classification!=="Mastered"};if(Object.keys(o).sort((r,c)=>{const l=o[r],d=o[c],M=X=>X==="HighRisk"?0:X==="NeedsReview"?1:2,A=M(l.classification)-M(d.classification);return A!==0?A:l.scorePercent-d.scorePercent}),V(i),q(o),$(he),L("results"),h){U(!0);try{const r=Object.keys(o).map(c=>({subject:c,score:o[c].scorePercent}));await ge(h,r,B,P,ie,N),console.log("[OK] Automation: diagnostic pipeline completed")}catch(r){console.error("[WARN] Automation: diagnostic pipeline failed:",r)}finally{U(!1)}}},me=()=>{if(!a||!u){p({status:"completed",atRiskSubjectIds:k,questionSetVersion:H}),n();return}p({status:"completed",atRiskSubjectIds:k,topicScores:{Functions:a.Functions.scorePercent,BusinessMath:a.BusinessMath.scorePercent,Logic:a.Logic.scorePercent},topicClassifications:{Functions:a.Functions.classification,BusinessMath:a.BusinessMath.classification,Logic:a.Logic.classification},priorityTopics:Object.keys(a).sort((t,i)=>a[t].scorePercent-a[i].scorePercent),g12ReadinessIndicators:u,questionSetVersion:H}),n()},f=x[y],Y=Math.round(y/x.length*100),ue=ke(x);return s?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:()=>{R()},children:[e.jsxs(g.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},className:"bg-white rounded-3xl shadow-2xl max-w-2xl w-full flex flex-col max-h-[90vh] pointer-events-auto overflow-hidden relative z-[51]",onClick:t=>t.stopPropagation(),children:[e.jsxs("div",{className:"px-8 py-6 border-b border-[#dde3eb] flex items-center justify-between bg-[#edf1f7] flex-shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-sky-100 rounded-xl flex items-center justify-center text-sky-600",children:e.jsx(J,{size:24})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-bold text-[#0a1628]",children:N==="followup_diagnostic"?"Deep Diagnostic":"Initial Assessment"}),e.jsx("p",{className:"text-sm text-[#5a6578]",children:"Analyze your strengths & weaknesses"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 relative",children:[e.jsxs("div",{className:"relative",children:[e.jsx("button",{onClick:()=>{j(!w),b(!1)},className:`relative w-10 h-10 rounded-xl flex items-center justify-center transition-all duration-200 border-2 ${w?"bg-sky-100 border-sky-300 text-sky-700 shadow-sm":"bg-white border-[#dde3eb] text-slate-500 hover:text-sky-600 hover:border-sky-200 hover:bg-sky-50"}`,title:"Toggle Calculator",children:e.jsx(T,{size:20})}),e.jsx(O,{children:s&&v==="test"&&oe&&!w&&e.jsxs(g.div,{initial:{opacity:0,y:10,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:10,scale:.95},className:"absolute right-0 top-full mt-3 w-[260px] bg-[#0a1628] text-white border border-[#2a3648] rounded-2xl p-4 shadow-2xl z-50 pointer-events-none",children:[e.jsxs("div",{className:"flex gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-sky-500/20 flex items-center justify-center flex-shrink-0",children:e.jsx(T,{size:16,className:"text-sky-400"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-bold text-sm mb-1",children:"Calculator Available"}),e.jsx("p",{className:"text-xs text-slate-300 leading-relaxed",children:"You can freely use the scientific calculator at any time during this quiz."})]})]}),e.jsx("div",{className:"absolute -top-2 right-4 w-4 h-4 bg-[#0a1628] border-l border-t border-[#2a3648] rotate-45 rounded-tl-sm"})]})})]}),e.jsx("button",{onClick:()=>{R()},className:"w-10 h-10 rounded-xl flex items-center justify-center text-slate-500 border-2 border-transparent hover:text-[#5a6578] hover:bg-[#dde3eb] hover:border-[#dde3eb] transition-all",title:"Close assessment",children:e.jsx(Z,{size:20})})]})]}),e.jsx("div",{className:"p-8 overflow-y-auto",children:e.jsxs(O,{mode:"wait",children:[v==="intro"&&e.jsxs(g.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},className:"text-center space-y-6",children:[e.jsx("div",{className:"w-32 h-32 bg-sky-50 rounded-full flex items-center justify-center mx-auto mb-6",children:e.jsx(T,{size:64,className:"text-sky-600"})}),e.jsx("h3",{className:"text-2xl font-bold text-[#0a1628]",children:N==="followup_diagnostic"?"Let's close the gaps":"Welcome to MathPulse AI!"}),e.jsx("p",{className:"text-[#5a6578] max-w-md mx-auto leading-relaxed",children:N==="followup_diagnostic"?"You have pending weak-area checks from your initial assessment. Complete this deep diagnostic to unlock regular modules and practice.":`To personalize your learning path, complete a DepEd competency-based SHS diagnostic (${x.length} items, around ${ue} minutes).`}),e.jsxs("div",{className:"grid grid-cols-2 gap-4 max-w-lg mx-auto text-left",children:[e.jsxs("div",{className:"bg-[#edf1f7] p-4 rounded-xl border border-[#dde3eb]",children:[e.jsxs("div",{className:"flex items-center gap-2 font-bold text-[#0a1628] mb-1",children:[e.jsx(ee,{size:16,className:"text-teal-500"}),"Personalized Path"]}),e.jsx("p",{className:"text-xs text-[#5a6578] pl-6",children:"Get recommendations based on your level."})]}),e.jsxs("div",{className:"bg-[#edf1f7] p-4 rounded-xl border border-[#dde3eb]",children:[e.jsxs("div",{className:"flex items-center gap-2 font-bold text-[#0a1628] mb-1",children:[e.jsx(Q,{size:16,className:"text-rose-500"}),"Identify Risks"]}),e.jsx("p",{className:"text-xs text-[#5a6578] pl-6",children:"Spot areas that need more attention early."})]})]}),e.jsxs("div",{className:"pt-4 space-y-3",children:[e.jsx(E,{onClick:le,className:"bg-gradient-to-r from-sky-600 to-sky-500 hover:from-sky-700 hover:to-sky-600 text-white px-8 py-6 rounded-xl text-lg font-bold shadow-lg shadow-sky-200 w-full max-w-xs mx-auto",children:N==="followup_diagnostic"?"Start Deep Diagnostic":"Start Assessment"}),e.jsx("button",{onClick:()=>{ce()},className:"block mx-auto text-sm text-slate-500 hover:text-[#5a6578] transition-colors font-medium",children:"Skip for now โ†’"})]})]},"intro"),v==="test"&&e.jsxs(g.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},className:"space-y-8",children:[e.jsxs("div",{className:"flex items-center justify-between text-sm font-bold text-[#5a6578] mb-2",children:[e.jsxs("span",{children:["Question ",y+1," of ",x.length]}),e.jsxs("span",{children:[Y,"% Completed"]})]}),e.jsx("div",{className:"h-2 bg-[#edf1f7] rounded-full overflow-hidden mb-8",children:e.jsx(g.div,{className:"h-full bg-sky-600 rounded-full",initial:{width:0},animate:{width:`${Y}%`}})}),e.jsxs("div",{className:"bg-[#edf1f7] p-6 rounded-2xl border border-[#dde3eb] mb-6",children:[e.jsxs("p",{className:"text-xs font-bold uppercase tracking-wide text-slate-500 mb-2",children:[te[f.topicArea]," โ€ข ",f.difficulty]}),e.jsx("h3",{className:"text-xl font-bold text-[#0a1628] leading-relaxed",children:f.prompt})]}),(f.answerType==="MCQ"||f.answerType==="confidenceLikert")&&e.jsx("div",{className:"grid grid-cols-1 gap-3",children:(f.options||[]).map((t,i)=>e.jsxs("button",{onClick:()=>K(i),className:"w-full text-left p-4 rounded-xl border-2 border-[#dde3eb] hover:border-indigo-600 hover:bg-sky-50 transition-all font-medium text-[#0a1628] group flex items-center justify-between",children:[e.jsxs("span",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"w-8 h-8 rounded-lg bg-white border border-[#dde3eb] flex items-center justify-center text-sm font-bold text-[#5a6578] group-hover:border-sky-300 group-hover:text-sky-600",children:String.fromCharCode(65+i)}),t]}),e.jsx(ve,{size:18,className:"opacity-0 group-hover:opacity-100 text-sky-600 transition-opacity"})]},i))}),(f.answerType==="shortAnswerNumeric"||f.answerType==="shortAnswerText")&&e.jsxs("div",{className:"space-y-3",children:[f.answerType==="shortAnswerNumeric"?e.jsx(e.Fragment,{children:e.jsx(ye,{value:C,onChange:I,placeholder:"Type numeric answer",onSubmit:G,onCalculatorOpen:()=>{j(!0),b(!1)}})}):e.jsx("input",{id:"diagnostic-short-answer",name:"diagnostic-short-answer","aria-label":"Short answer response",value:C,onChange:t=>I(t.target.value),onKeyDown:t=>{t.key==="Enter"&&G()},className:"w-full p-4 rounded-xl border-2 border-[#dde3eb] focus:outline-none focus:ring-2 focus:ring-sky-200 focus:border-sky-500",placeholder:"Type short answer"}),e.jsx(E,{onClick:G,disabled:!C.trim(),className:"w-full bg-sky-600 hover:bg-sky-700 text-white py-3 rounded-xl font-bold",children:"Submit Answer"})]})]},"test"),v==="results"&&e.jsxs(g.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},className:"text-center space-y-6",children:[e.jsx("div",{className:"w-24 h-24 bg-teal-100 rounded-full flex items-center justify-center mx-auto mb-4 animate-bounce",children:e.jsx(ee,{size:48,className:"text-teal-600"})}),e.jsx("h3",{className:"text-2xl font-bold text-[#0a1628]",children:"Assessment Completed!"}),e.jsx("p",{className:"text-[#5a6578]",children:"We computed topic-level placement from your IAR responses."}),e.jsxs("div",{className:"bg-[#edf1f7] rounded-2xl p-6 border border-[#dde3eb] text-left space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("div",{className:"w-10 h-10 rounded-[14px] bg-indigo-50 border border-indigo-100 flex items-center justify-center text-indigo-500 shadow-inner",children:e.jsx(we,{size:18,strokeWidth:2.4})}),e.jsx("h4",{className:"font-display font-black text-[22px] text-slate-800 tracking-tight",children:"Topic Analysis"})]}),e.jsx("div",{className:"space-y-3",children:a&&Object.keys(a).map(t=>e.jsxs("div",{className:"flex items-center justify-between p-3 bg-white rounded-xl border border-[#dde3eb]",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-[#0a1628]",children:te[t]}),e.jsxs("p",{className:"text-xs text-slate-500",children:[a[t].correct,"/",a[t].total," correct โ€ข ",a[t].scorePercent,"%"]})]}),e.jsxs("span",{className:`text-xs font-bold px-2 py-1 rounded-lg flex items-center gap-1 ${Ae(a[t].classification)}`,children:[a[t].classification==="Mastered"?e.jsx(je,{size:12}):e.jsx(Q,{size:12}),Ie(a[t].classification)]})]},t))})]}),u&&e.jsxs("div",{className:"bg-sky-50 rounded-2xl p-6 border border-sky-100 text-left space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("div",{className:"w-10 h-10 rounded-[14px] bg-indigo-50 border border-indigo-100 flex items-center justify-center text-indigo-500 shadow-inner",children:e.jsx(J,{size:18,strokeWidth:2.4})}),e.jsx("h4",{className:"font-display font-black text-[22px] text-slate-800 tracking-tight",children:"Grade 12 Readiness Signals"})]}),e.jsx("p",{className:"text-xs text-slate-600",children:"These indicators come from challenge and candidate items only."}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-2 text-xs",children:[e.jsxs("span",{className:`px-2 py-1 rounded-md font-bold ${u.readyForFiniteMath?"bg-teal-50 text-teal-700":"bg-slate-100 text-slate-600"}`,children:["Finite Math: ",u.readyForFiniteMath?"Ready":"Build More"]}),e.jsxs("span",{className:`px-2 py-1 rounded-md font-bold ${u.readyForAdvancedStats?"bg-teal-50 text-teal-700":"bg-slate-100 text-slate-600"}`,children:["Advanced Stats: ",u.readyForAdvancedStats?"Ready":"Build More"]}),e.jsxs("span",{className:`px-2 py-1 rounded-md font-bold ${u.readyForCalcIntro?"bg-teal-50 text-teal-700":"bg-slate-100 text-slate-600"}`,children:["Calculus Intro: ",u.readyForCalcIntro?"Ready":"Build More"]})]})]}),k.length>0&&e.jsxs("div",{className:"flex items-start gap-3 p-4 bg-rose-50 border border-rose-100 rounded-xl text-left",children:[e.jsx("div",{className:"w-10 h-10 rounded-[14px] bg-rose-100 border border-rose-200 flex items-center justify-center text-rose-600 shadow-inner shrink-0",children:e.jsx(Q,{size:18,strokeWidth:2.3})}),e.jsxs("div",{children:[e.jsx("h5",{className:"font-display font-black text-[20px] tracking-tight text-rose-800 leading-none mb-1",children:"Attention Needed"}),e.jsxs("p",{className:"text-rose-700 text-xs mt-1",children:["We flagged ",k.length," topic area",k.length>1?"s":""," for review. In IAR + Diagnostic mode, focused deep diagnostics may launch before full unlock."]})]})]}),e.jsx("div",{className:"pt-4",children:e.jsx(E,{onClick:me,className:"bg-sky-600 hover:bg-sky-700 text-white px-8 py-4 rounded-xl text-lg font-bold w-full",children:"Go to Dashboard"})})]},"results")]})})]}),e.jsx(O,{children:w&&e.jsxs(g.div,{drag:!0,dragMomentum:!1,initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},transition:{type:"spring",damping:25,stiffness:200},style:{position:"absolute",top:"50%",left:"calc(50% + 390px)",y:"-50%"},className:"w-[420px] max-w-[calc(100vw-24px)] bg-white rounded-3xl shadow-2xl border border-slate-200 flex flex-col pointer-events-auto overflow-hidden z-[60]",onClick:t=>t.stopPropagation(),children:[e.jsxs("div",{className:"p-4 border-b border-[#dde3eb] flex items-center justify-between bg-[#edf1f7] flex-shrink-0 cursor-move",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-xl bg-sky-100 flex items-center justify-center text-sky-600",children:e.jsx(T,{size:18})}),e.jsx("h3",{className:"font-bold text-[#0a1628] select-none",children:"Scientific Calc"})]}),e.jsx("button",{onClick:t=>{t.stopPropagation(),j(!1)},className:"w-8 h-8 flex items-center justify-center text-slate-500 hover:text-[#0a1628] hover:bg-[#dde3eb] rounded-lg transition-colors cursor-pointer",title:"Close Calculator",children:e.jsx(Z,{size:16})})]}),e.jsx("div",{className:"p-4 bg-[#f7f9fc]",children:e.jsx(be,{isOpen:!0,onClose:()=>j(!1),inline:!0})})]})})]}):null};export{et as default};
 
 
assets/FloatingAITutor-DkH3KrR1.js DELETED
@@ -1,7 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ChatMarkdown-B34PtYCE.js","assets/index-D4nJsLyx.js","assets/vendor-react-Dexh7fmo.js","assets/vendor-firebase-auth-COrkgW0P.js","assets/vendor-firebase-core-DQ-pMjxd.js","assets/vendor-firebase-firestore-BML5nJHm.js","assets/vendor-firebase-storage-BOeKE_0n.js","assets/vendor-firebase-analytics-CCo6E2f7.js","assets/index-CR2i2gnI.css","assets/vendor-markdown-C5ikSDMA.js","assets/vendor-markdown-CBmFCdgC.css","assets/apiService-axx1LHMk.js"])))=>i.map(i=>d[i]);
2
- import{c as S,y as A,_ as w,m as p,I as M}from"./index-D4nJsLyx.js";import{r as a,j as e}from"./vendor-react-Dexh7fmo.js";import{M as f}from"./minus-oFhmD2--.js";import{X as b}from"./x-BONnp2RF.js";import{S as C}from"./send-NQY-QTkN.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-firestore-BML5nJHm.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";/**
3
- * @license lucide-react v0.487.0 - ISC
4
- *
5
- * This source code is licensed under the ISC license.
6
- * See the LICENSE file in the root directory of this source tree.
7
- */const L=[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]],E=S("maximize-2",L),O=a.lazy(()=>w(()=>import("./ChatMarkdown-B34PtYCE.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10]))),X=({constraintsRef:T,onFullScreen:y})=>{const{activeSessionId:n,setActiveSessionId:g,createNewSession:j,getActiveSession:v,sendMessage:N,isLoading:o}=A(),[s,r]=a.useState(!1),[l,c]=a.useState(()=>typeof window>"u"?!1:window.localStorage.getItem("floating_ai_tutor_minimized")==="1"),[i,d]=a.useState(""),u=a.useRef(null);a.useEffect(()=>{typeof window>"u"||window.localStorage.setItem("floating_ai_tutor_minimized",l?"1":"0")},[l]),a.useEffect(()=>{s&&w(async()=>{const{warmupBackend:t}=await import("./apiService-axx1LHMk.js");return{warmupBackend:t}},__vite__mapDeps([11,1,2,3,4,5,6,7,8])).then(({warmupBackend:t})=>{t()}).catch(t=>{console.warn("Floating tutor warmup skipped:",t)})},[s]),a.useEffect(()=>{if(s&&!n){const t={id:"1",sender:"ai",text:"Hi! I'm your AI math tutor. What would you like to learn about today?",timestamp:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})},z=j(t);g(z)}},[s]);const m=v()?.messages||[],k=()=>{u.current?.scrollIntoView({behavior:"smooth"})};a.useEffect(()=>{k()},[m]);const x=async()=>{if(!i.trim()||!n||o)return;const t=i.trim();d(""),await N(n,t)},I=()=>{y()},h=()=>{r(!1),c(!0)},_=()=>{c(!1)};return e.jsxs("div",{className:"pointer-events-none flex flex-col items-end",children:[e.jsxs("div",{className:`pointer-events-auto mb-4 w-80 bg-[#f7f9fc] rounded-3xl shadow-2xl border border-[#dde3eb] flex flex-col overflow-hidden transition-all duration-300 origin-bottom-right select-none ${s?"opacity-100 scale-100 translate-y-0":"opacity-0 scale-95 translate-y-10 pointer-events-none h-0"}`,style:{maxHeight:s?"32rem":"0"},children:[e.jsxs("div",{className:"bg-gradient-to-r from-sky-600 to-sky-500 p-4 flex items-center justify-between flex-shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-white/20 rounded-xl flex items-center justify-center backdrop-blur-sm",children:e.jsx("img",{src:"/avatar/avatar_icon.png",alt:"AI Tutor",className:"w-9 h-9 object-contain drop-shadow-md"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-white font-bold text-sm",children:"L.O.L.I."}),e.jsxs("p",{className:"text-sky-100 text-[10px] leading-tight",children:["Logical Operations &",e.jsx("br",{}),"Learning Intelligence"]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:I,type:"button","aria-label":"Open fullscreen",className:"p-2 hover:bg-white/20 rounded-lg transition-colors",title:"Open fullscreen",children:e.jsx(E,{size:16,className:"text-white"})}),e.jsx("button",{type:"button","aria-label":"Minimize AI tutor launcher",onClick:h,className:"p-2 hover:bg-white/20 rounded-lg transition-colors",title:"Minimize",children:e.jsx(f,{size:16,className:"text-white"})}),e.jsx("button",{type:"button","aria-label":"Close chat",onClick:()=>r(!1),className:"p-2 hover:bg-white/20 rounded-lg transition-colors",children:e.jsx(b,{size:16,className:"text-white"})})]})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-3 bg-[#edf1f7]",children:[m.map(t=>e.jsx("div",{className:`flex ${t.sender==="user"?"justify-end":"justify-start"}`,children:e.jsxs("div",{className:`max-w-[75%] rounded-2xl px-4 py-2.5 ${t.sender==="user"?"bg-sky-600 text-white":"bg-white text-[#0a1628] shadow-sm border border-[#dde3eb]"}`,children:[t.sender==="user"?e.jsx("p",{className:"text-sm whitespace-pre-wrap",children:t.text}):e.jsx(a.Suspense,{fallback:e.jsx("p",{className:"text-sm whitespace-pre-wrap",children:t.text}),children:e.jsx(O,{children:t.text})}),e.jsx("p",{className:`text-[10px] mt-1 ${t.sender==="user"?"text-sky-200":"text-slate-500"}`,children:t.timestamp})]})},t.id)),o&&e.jsx("div",{className:"flex justify-start",children:e.jsx("div",{className:"bg-white text-[#0a1628] shadow-sm border border-[#dde3eb] rounded-2xl px-4 py-2.5 max-w-[75%]",children:e.jsxs("div",{className:"flex gap-1",children:[e.jsx("div",{className:"w-2 h-2 bg-sky-400 rounded-full animate-bounce"}),e.jsx("div",{className:"w-2 h-2 bg-sky-400 rounded-full animate-bounce [animation-delay:150ms]"}),e.jsx("div",{className:"w-2 h-2 bg-sky-400 rounded-full animate-bounce [animation-delay:300ms]"})]})})}),e.jsx("div",{ref:u})]}),e.jsx("div",{className:"p-4 border-t border-[#dde3eb] bg-white flex-shrink-0",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{id:"ai-tutor-input",name:"ai-tutor-input","aria-label":"Ask AI tutor a question",type:"text",value:i,onChange:t=>d(t.target.value),onKeyPress:t=>t.key==="Enter"&&x(),placeholder:"Ask me anything...",className:"flex-1 px-4 py-2.5 rounded-xl border border-[#dde3eb] focus:outline-none focus:ring-2 focus:ring-sky-500 text-sm bg-[#f7f9fc]"}),e.jsx("button",{type:"button","aria-label":"Send message",onClick:x,className:"p-2.5 bg-sky-600 hover:bg-sky-700 text-white rounded-xl transition-colors disabled:opacity-50 disabled:cursor-not-allowed",disabled:!i.trim()||o,children:e.jsx(C,{size:18})})]})})]}),e.jsx("div",{className:"pointer-events-auto relative self-end",children:l?e.jsx(p.button,{type:"button",onClick:_,whileHover:{scale:1.08},whileTap:{scale:.95},className:"h-9 w-9 rounded-full bg-slate-900/85 text-white shadow-lg ring-1 ring-white/20 backdrop-blur-sm flex items-center justify-center","aria-label":"Restore AI tutor launcher",title:"Show AI tutor",children:e.jsx(M,{size:14})}):e.jsxs("div",{className:"relative group",children:[!s&&e.jsxs("div",{className:"absolute right-full mr-4 top-1/2 -translate-y-1/2 px-4 py-2 bg-slate-800 text-white text-sm rounded-xl opacity-0 group-hover:opacity-100 transition-opacity duration-300 pointer-events-none whitespace-nowrap shadow-xl z-50",children:["Hello! I'm L.O.L.I., how may I help you?",e.jsx("div",{className:"absolute top-1/2 -translate-y-1/2 -right-1 w-3 h-3 bg-slate-800 rotate-45"})]}),!s&&e.jsx("button",{type:"button","aria-label":"Minimize AI tutor launcher",title:"Minimize",onClick:h,className:"absolute -top-2 -left-2 z-10 h-6 w-6 rounded-full bg-white text-slate-700 border border-slate-200 shadow-md hover:bg-slate-100 transition-colors flex items-center justify-center",children:e.jsx(f,{size:12})}),e.jsx(p.button,{type:"button",onClick:()=>r(!s),whileHover:{scale:1.1},whileTap:{scale:.9},className:"w-16 h-16 bg-gradient-to-br from-sky-600 to-sky-500 rounded-xl shadow-2xl flex items-center justify-center text-white hover:shadow-sky-300/50 transition-all","aria-label":s?"Close AI tutor chat":"Open AI tutor chat",children:s?e.jsx(b,{size:28}):e.jsx("img",{src:"/avatar/avatar_icon.png",alt:"AI Tutor",className:"w-14 h-14 object-contain drop-shadow-lg"})})]})})]})};export{X as default};
 
 
 
 
 
 
 
 
assets/GradesPage-m1qiGDtC.js DELETED
@@ -1,2 +0,0 @@
1
- import{r as n,j as e}from"./vendor-react-Dexh7fmo.js";import{B as S}from"./button-BpeUVhBo.js";import{u as $,m as H,g as W}from"./index-D4nJsLyx.js";import{g as V,S as k}from"./subjects-DDBtpdiA.js";import{A as T}from"./award-oJTbc9W5.js";import{T as A}from"./trending-up-D-vj8Gbq.js";import{T as C}from"./target-D7SVtf3g.js";import{C as P}from"./calendar-BJ8oE6yW.js";import{D as _}from"./download-PWUf0XJa.js";import{T as J,F as K}from"./trending-down-CqEkjFA9.js";import{C as X}from"./chevron-right-COMox1Xb.js";import"./vendor-radix-BRdei-zg.js";import"./clsx-B-dksMZM.js";import"./utils-BQQgILNW.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-firestore-BML5nJHm.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";import"./chart-column-D5mAWcRx.js";const je=()=>{const{currentUser:p,userProfile:Q}=$(),[o,u]=n.useState("all"),[f,D]=n.useState("all"),[Y,j]=n.useState(!0),[i,R]=n.useState(null),E=Q?.grade,g=V(E),y=new Set(g);n.useEffect(()=>{(async()=>{if(p){j(!0);try{const s=await W(p.uid);R(s)}catch(s){console.error("Error loading grades:",s)}finally{j(!1)}}})()},[p]);const N=i?.quizAttempts||[],M=i?.totalQuizzesCompleted||0,h=i?.averageScore||0,U=h>0?Math.min(h/25,4).toFixed(2):"0.00",F={"gen-math":"blue","stats-prob":"cyan","pre-calc":"teal","basic-calc":"orange"},b=k.reduce((t,s)=>(t[s.id]={label:s.name,color:F[s.id]||"slate"},t),{}),c=k.filter(t=>y.has(t.id)).map(t=>t.name),v=Object.entries(i?.subjects||{}).filter(([t])=>y.has(t)).map(([t,s])=>{const a=b[t]||{label:t,color:"slate"},d=N.filter(l=>l.quizId?.startsWith(t)),m=d.length>0?Math.round(d.reduce((l,r)=>l+r.score,0)/d.length):Math.round(s.progress);return{subject:a.label,average:m,quizzes:d.length||s.completedModules,color:a.color,trend:"up"}}),G=g.map(t=>{const s=b[t]||{label:t,color:"slate"};return{subject:s.label,average:0,quizzes:0,color:s.color,trend:"up"}}),I=v.length>0?v:G,w=N.sort((t,s)=>new Date(s.completedAt).getTime()-new Date(t.completedAt).getTime()).slice(0,10).map((t,s)=>({id:s+1,title:t.quizId?.replace(/-/g," ").replace(/\b\w/g,a=>a.toUpperCase())||`Quiz ${s+1}`,subject:Object.entries(b).find(([a])=>t.quizId?.startsWith(a))?.[1]?.label||"General",score:t.score,total:100,date:t.completedAt instanceof Date?t.completedAt.toISOString().split("T")[0]:new Date(t.completedAt).toISOString().split("T")[0],type:t.quizId?.includes("practice")?"practice":"module",status:t.score>=60?"passed":"failed"})).filter(t=>c.includes(t.subject)),x={gpa:parseFloat(U),totalQuizzes:M,averageScore:h,trendValue:0},z=w.filter(t=>{if(!c.includes(t.subject))return!1;const s=o==="all"||t.subject===o,a=f==="all"||t.type===f;return s&&a});n.useEffect(()=>{o!=="all"&&(c.includes(o)||u("all"))},[c,o]);const O=()=>{const t=["Quiz","Subject","Type","Score","Date","Status"],s=w.map(r=>[r.title,r.subject,r.type,`${r.score}%`,r.date,r.status]),a=[t,...s].map(r=>r.join(",")).join(`
2
- `),d=new Blob([a],{type:"text/csv;charset=utf-8;"}),m=URL.createObjectURL(d),l=document.createElement("a");l.href=m,l.download=`mathpulse-grades-${new Date().toISOString().split("T")[0]}.csv`,l.click(),URL.revokeObjectURL(m)},L=t=>t>=90?"text-emerald-600 bg-emerald-50":t>=80?"text-sky-600 bg-sky-50":t>=70?"text-rose-600 bg-rose-50":"text-red-600 bg-red-50",B=t=>t>=90?"A":t>=80?"B":t>=70?"C":t>=60?"D":"F";return e.jsxs("div",{className:"space-y-6 px-4 sm:px-6 xl:px-10 py-6 sm:py-8",children:[e.jsxs("div",{className:"bg-gradient-to-br from-white via-sky-50/30 to-white rounded-2xl p-7 card-elevated-lg relative overflow-hidden border border-slate-200/80",children:[e.jsx("div",{className:"absolute top-0 left-0 right-0 h-px bg-gradient-to-r from-transparent via-sky-400/40 to-transparent"}),e.jsx("div",{className:"absolute top-0 right-0 w-48 h-48 bg-sky-100/40 rounded-full -translate-y-1/2 translate-x-1/2"}),e.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[e.jsxs("div",{className:"bg-white rounded-lg p-4 border border-slate-200/80 shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(T,{size:18,className:"text-rose-500"}),e.jsx("span",{className:"text-xs text-slate-500 font-body",children:"Overall GPA"})]}),e.jsx("p",{className:"text-3xl font-display font-bold text-[#0a1628]",children:x.gpa}),e.jsxs("div",{className:"flex items-center gap-1 mt-2",children:[e.jsx(A,{size:14,className:"text-emerald-500"}),e.jsxs("span",{className:"text-xs text-slate-500 font-body",children:["+",x.trendValue,"% this month"]})]})]}),e.jsxs("div",{className:"bg-white rounded-lg p-4 border border-slate-200/80 shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(C,{size:18,className:"text-sky-500"}),e.jsx("span",{className:"text-xs text-slate-500 font-body",children:"Average Score"})]}),e.jsxs("p",{className:"text-3xl font-display font-bold text-[#0a1628]",children:[x.averageScore,"%"]}),e.jsx("p",{className:"text-xs text-slate-500 font-body mt-2",children:"Across all subjects"})]}),e.jsxs("div",{className:"bg-white rounded-lg p-4 border border-slate-200/80 shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(P,{size:18,className:"text-rose-500"}),e.jsx("span",{className:"text-xs text-slate-500 font-body",children:"Total Quizzes"})]}),e.jsx("p",{className:"text-3xl font-display font-bold text-[#0a1628]",children:x.totalQuizzes}),e.jsx("p",{className:"text-xs text-slate-500 font-body mt-2",children:"Completed"})]}),e.jsxs("div",{className:"bg-white rounded-lg p-4 border border-slate-200/80 shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(T,{size:18,className:"text-rose-500"}),e.jsx("span",{className:"text-xs text-slate-500 font-body",children:"Grade Rank"})]}),e.jsx("p",{className:"text-3xl font-display font-bold text-[#0a1628]",children:"Top 15%"}),e.jsx("p",{className:"text-xs text-slate-500 font-body mt-2",children:"In your class"})]})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-[14px] bg-indigo-50 border border-indigo-100 flex items-center justify-center text-indigo-500 shadow-inner",children:e.jsx(C,{size:20,strokeWidth:2.5})}),e.jsx("h2",{className:"font-display font-black text-[24px] text-slate-800 tracking-tight",children:"Subject Performance"})]}),e.jsxs(S,{variant:"outline",size:"sm",className:"rounded-lg font-body border-[#dde3eb] text-[#5a6578]",onClick:O,children:[e.jsx(_,{size:16,className:"mr-2"}),"Export Report"]})]}),e.jsx("div",{className:"grid grid-cols-2 gap-4",children:I.map(t=>e.jsxs(H.div,{whileHover:{scale:1.02},className:"bg-white rounded-xl p-5 border border-[#dde3eb] card-elevated cursor-pointer",children:[e.jsxs("div",{className:"flex items-start justify-between mb-4",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"font-display font-bold text-[#0a1628] mb-1",children:t.subject}),e.jsxs("p",{className:"text-xs text-[#5a6578] font-body",children:[t.quizzes," quizzes completed"]})]}),e.jsx("div",{className:`w-14 h-14 rounded-lg bg-${t.color}-50 flex items-center justify-center`,children:e.jsx("span",{className:`text-xl font-display font-bold text-${t.color}-600`,children:B(t.average)})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"text-3xl font-display font-bold text-[#0a1628]",children:[t.average,"%"]}),e.jsx("p",{className:"text-xs text-[#5a6578] font-body mt-1",children:"Average"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[t.trend==="up"?e.jsx(A,{size:18,className:"text-green-500"}):e.jsx(J,{size:18,className:"text-red-500"}),e.jsx(X,{size:16,className:"text-[#d1cec6]"})]})]})]},t.subject))})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-[14px] bg-indigo-50 border border-indigo-100 flex items-center justify-center text-indigo-500 shadow-inner",children:e.jsx(P,{size:20,strokeWidth:2.5})}),e.jsx("h2",{className:"font-display font-black text-[24px] text-slate-800 tracking-tight",children:"Quiz History"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("select",{value:o,onChange:t=>u(t.target.value),className:"px-3 py-2 border border-[#dde3eb] rounded-lg text-sm font-body bg-white text-[#0a1628]",children:[e.jsx("option",{value:"all",children:"All Subjects"}),c.map(t=>e.jsx("option",{value:t,children:t},t))]}),e.jsxs("select",{value:f,onChange:t=>D(t.target.value),className:"px-3 py-2 border border-[#dde3eb] rounded-lg text-sm font-body bg-white text-[#0a1628]",children:[e.jsx("option",{value:"all",children:"All Types"}),e.jsx("option",{value:"practice",children:"Practice"}),e.jsx("option",{value:"module",children:"Module"})]})]})]}),e.jsxs("div",{className:"bg-white rounded-xl border border-[#dde3eb] card-elevated overflow-hidden",children:[e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{className:"bg-[#f7f9fc] border-b border-[#dde3eb]",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-3 text-left text-[10px] font-body font-semibold text-[#5a6578] uppercase tracking-wider",children:"Quiz"}),e.jsx("th",{className:"px-6 py-3 text-left text-[10px] font-body font-semibold text-[#5a6578] uppercase tracking-wider",children:"Subject"}),e.jsx("th",{className:"px-6 py-3 text-left text-[10px] font-body font-semibold text-[#5a6578] uppercase tracking-wider",children:"Type"}),e.jsx("th",{className:"px-6 py-3 text-left text-[10px] font-body font-semibold text-[#5a6578] uppercase tracking-wider",children:"Score"}),e.jsx("th",{className:"px-6 py-3 text-left text-[10px] font-body font-semibold text-[#5a6578] uppercase tracking-wider",children:"Date"}),e.jsx("th",{className:"px-6 py-3 text-left text-[10px] font-body font-semibold text-[#5a6578] uppercase tracking-wider",children:"Action"})]})}),e.jsx("tbody",{children:z.map(t=>e.jsxs("tr",{className:"border-b border-[#edf1f7] hover:bg-[#f7f9fc] transition-colors",children:[e.jsx("td",{className:"px-6 py-4",children:e.jsx("p",{className:"font-body font-semibold text-[#0a1628] text-sm",children:t.title})}),e.jsx("td",{className:"px-6 py-4",children:e.jsx("span",{className:"text-sm text-[#5a6578] font-body",children:t.subject})}),e.jsx("td",{className:"px-6 py-4",children:e.jsx("span",{className:"px-2.5 py-1 bg-[#edf1f7] text-[#5a6578] text-xs font-body font-semibold rounded-md capitalize",children:t.type})}),e.jsx("td",{className:"px-6 py-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:`px-2.5 py-1 rounded-md text-sm font-body font-semibold ${L(t.score)}`,children:[t.score,"%"]}),e.jsxs("span",{className:"text-xs text-slate-500 font-body",children:["(",t.score,"/",t.total,")"]})]})}),e.jsx("td",{className:"px-6 py-4",children:e.jsx("span",{className:"text-sm text-[#5a6578] font-body",children:t.date})}),e.jsx("td",{className:"px-6 py-4",children:e.jsx(S,{variant:"outline",size:"sm",className:"rounded-lg",children:"Review"})})]},t.id))})]}),z.length===0&&e.jsxs("div",{className:"text-center py-12",children:[e.jsx(K,{size:40,className:"text-[#d1cec6] mx-auto mb-3"}),e.jsx("p",{className:"text-[#5a6578] font-body",children:"No quizzes found with current filters"}),e.jsx("p",{className:"text-xs text-slate-500 font-body mt-1",children:"Try adjusting your filters"})]})]})]})]})};export{je as default};
 
 
 
assets/HeroBanner-BdiQHNd9.js DELETED
@@ -1,7 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DashboardAvatar-CHVNq8nF.js","assets/vendor-react-Dexh7fmo.js","assets/avatarData-BW_TX0b4.js","assets/index-D4nJsLyx.js","assets/vendor-firebase-auth-COrkgW0P.js","assets/vendor-firebase-core-DQ-pMjxd.js","assets/vendor-firebase-firestore-BML5nJHm.js","assets/vendor-firebase-storage-BOeKE_0n.js","assets/vendor-firebase-analytics-CCo6E2f7.js","assets/index-CR2i2gnI.css"])))=>i.map(i=>d[i]);
2
- import{c as x,m as t,Z as c,A as p,_ as b}from"./index-D4nJsLyx.js";import{j as e,r}from"./vendor-react-Dexh7fmo.js";import{B as h}from"./brain-CPvGdgWE.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-firestore-BML5nJHm.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";/**
3
- * @license lucide-react v0.487.0 - ISC
4
- *
5
- * This source code is licensed under the ISC license.
6
- * See the LICENSE file in the root directory of this source tree.
7
- */const g=[["path",{d:"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1fvzgz"}],["path",{d:"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"1kc0my"}],["path",{d:"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8",key:"10h0bg"}],["path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"1s1gnw"}]],u=x("hand",g),v=r.lazy(()=>b(()=>import("./DashboardAvatar-CHVNq8nF.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))),A=({userName:a="Student",userLevel:o=1,avatarLayers:l,onContinueLearning:n,showAssessmentTooltip:i,onOpenAssessment:d})=>{const m=()=>{const s=new Date().getHours();return s<12?"Good Morning":s<18?"Good Afternoon":"Good Evening"};return e.jsxs(t.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.6,ease:[.22,1,.36,1]},className:"relative w-full mt-0 rounded-[2rem] p-6 lg:p-8 bg-gradient-to-br from-white via-sky-50/50 to-white border border-slate-200/80 card-elevated-lg",children:[e.jsxs("div",{className:"absolute inset-0 overflow-hidden rounded-[2rem] pointer-events-none",children:[e.jsx("div",{className:"absolute top-0 left-0 right-0 h-px bg-gradient-to-r from-transparent via-sky-400/50 to-transparent"}),e.jsx("div",{className:"absolute top-0 right-0 w-96 h-96 bg-sky-100/40 rounded-full blur-3xl -translate-y-1/2 translate-x-1/4"}),e.jsx("div",{className:"absolute bottom-0 left-0 w-64 h-64 bg-rose-100/30 rounded-full blur-3xl translate-y-1/2 -translate-x-1/4"}),e.jsx("div",{className:"absolute inset-0 bg-dot-pattern opacity-40"})]}),e.jsx("div",{className:"relative z-10 flex min-h-[140px] lg:min-h-[160px] items-center justify-between gap-6 pb-0",children:e.jsxs("div",{className:"flex-1 min-w-0 pr-40 lg:pr-[280px] py-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("div",{className:"px-3 md:px-4 py-1.5 rounded-full bg-sky-100 border border-sky-200",children:e.jsxs("span",{className:"text-xs md:text-sm font-body font-bold text-sky-700",children:["Level ",o]})}),e.jsxs("div",{className:"px-3 md:px-4 py-1.5 rounded-full bg-rose-50 border border-rose-200",children:[e.jsx(c,{size:14,className:"inline -mt-0.5 text-rose-500 mr-1"}),e.jsx("span",{className:"text-xs md:text-sm font-body font-bold text-rose-700",children:"Active"})]})]}),e.jsxs("h1",{className:"text-xl md:text-2xl lg:text-3xl font-display font-black text-[#0a1628] mb-1.5 tracking-tight leading-[1.1]",children:[m(),", ",a,"! ",e.jsx(u,{size:20,className:"inline -mt-1 ml-1"})]}),e.jsx("p",{className:"text-slate-500 mb-1 text-xs md:text-sm font-body font-bold",children:"Today is a great day to move one step forward in math mastery."}),e.jsx("p",{className:"text-[11px] md:text-xs text-slate-400 font-body mb-4",children:"Focus on your next recommended lesson and keep your momentum."}),e.jsxs(t.button,{onClick:n,whileHover:{scale:1.03},whileTap:{scale:.97},className:"mt-2 bg-gradient-to-r from-purple-600 to-[#9956DE] text-white px-5 py-2 rounded-xl font-body font-bold text-sm shadow-lg shadow-purple-500/20 hover:shadow-purple-500/30 transition-all flex items-center gap-2 group",children:["Continue Learning",e.jsx(p,{size:14,className:"group-hover:translate-x-1 transition-transform"})]})]})}),i&&e.jsx(t.div,{initial:{opacity:0,scale:.9,x:10},animate:{opacity:1,scale:1,x:0},transition:{delay:.5,type:"spring"},onClick:d,className:"absolute hidden md:block right-[150px] lg:right-[250px] bottom-16 lg:bottom-20 z-30 cursor-pointer drop-shadow-lg group",children:e.jsxs("div",{className:"bg-white px-4 py-3 rounded-2xl rounded-br-sm border-2 border-amber-300 relative transition-all group-hover:bg-amber-50 group-hover:border-amber-400 group-hover:-translate-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-amber-500",children:e.jsx(h,{size:16})}),e.jsxs("p",{className:"text-xs lg:text-sm font-bold text-amber-900 leading-tight",children:["Don't forget to take the",e.jsx("br",{}),"Initial Assessment!"]})]}),e.jsx("div",{className:"absolute -right-2 bottom-0 w-4 h-4 bg-white border-2 border-transparent border-r-amber-300 border-b-amber-300 rotate-45 group-hover:bg-amber-50 group-hover:border-r-amber-400 group-hover:border-b-amber-400 transition-colors"})]})}),e.jsx("div",{className:"hidden md:block absolute right-0 lg:right-10 bottom-0 w-[150px] lg:w-[270px] pointer-events-none z-20",style:{clipPath:"inset(-100% -50% 0 -50%)"},children:e.jsx("div",{className:"relative w-full aspect-[4/5] translate-y-[21%] lg:translate-y-[19%] drop-shadow-2xl",children:e.jsx(r.Suspense,{fallback:e.jsx("div",{className:"w-full h-full scale-[1.25] lg:scale-[1.3] origin-bottom"}),children:e.jsx(v,{layers:l,className:"w-full h-full scale-[1.25] lg:scale-[1.3] origin-bottom"})})})})]})};export{A as default};
 
 
 
 
 
 
 
 
assets/LeaderboardPage-jsrBZaI7.js DELETED
@@ -1,8 +0,0 @@
1
- import{r as o,j as e}from"./vendor-react-Dexh7fmo.js";import{c as O,z as R,e as W,m as d,F as B,i as X,u as $,B as H}from"./index-D4nJsLyx.js";import{X as U}from"./x-BONnp2RF.js";import{B as y}from"./book-open-BH50GByv.js";import{T as A}from"./target-D7SVtf3g.js";import{A as k}from"./award-oJTbc9W5.js";import{C as q}from"./clock-DUJO-a50.js";import{T as v}from"./trophy-C2nVcZnb.js";import{T as P}from"./trending-up-D-vj8Gbq.js";import{L as M}from"./loader-circle-J8Mwbkkw.js";import{S as G}from"./star-dumQ9BVG.js";import{U as L}from"./user-CaTzqgOL.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-firestore-BML5nJHm.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";/**
2
- * @license lucide-react v0.487.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 K=[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Q=O("badge-check",K),V=({student:s,onClose:w})=>{const[n,N]=o.useState([]),[h,p]=o.useState(!1);if(o.useEffect(()=>{s?.uid&&(p(!0),R(s.uid).then(N).catch(c=>console.error("Failed to load achievements:",c)).finally(()=>p(!1)))},[s?.uid]),!s)return null;const x={trophy:e.jsx(v,{size:24,className:"text-rose-500"}),flame:e.jsx(B,{size:24,className:"text-orange-500"}),star:e.jsx(G,{size:24,className:"text-rose-400"}),"book-open":e.jsx(y,{size:24,className:"text-sky-600"}),"badge-check":e.jsx(Q,{size:24,className:"text-emerald-600"}),crown:e.jsx(X,{size:24,className:"text-rose-500"}),target:e.jsx(A,{size:24,className:"text-rose-500"})};return e.jsx(W,{children:e.jsxs("div",{className:"fixed inset-0 z-[100] flex items-center justify-center p-4",children:[e.jsx(d.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:w,className:"absolute inset-0 bg-black/50 backdrop-blur-sm"}),e.jsxs(d.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},className:"relative bg-[#f7f9fc] rounded-2xl shadow-2xl border border-[#dde3eb] w-full max-w-2xl max-h-[90vh] overflow-hidden",children:[e.jsxs("div",{className:"bg-gradient-to-r from-sky-600 to-sky-500 p-8 text-white relative overflow-hidden",children:[e.jsx("div",{className:"accent-line absolute top-0 left-0 right-0"}),e.jsx("button",{onClick:w,className:"absolute top-4 right-4 p-2 hover:bg-slate-100 rounded-xl transition-colors z-10",children:e.jsx(U,{size:20})}),e.jsx("div",{className:"relative z-10",children:e.jsxs("div",{className:"flex items-start gap-6",children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"w-24 h-24 bg-white/10 backdrop-blur-sm rounded-2xl flex items-center justify-center text-6xl border border-slate-300",children:s.avatar}),s.isOnline&&e.jsx("div",{className:"absolute -bottom-2 -right-2 w-6 h-6 bg-green-500 rounded-full border-4 border-white"})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h2",{className:"text-3xl font-display font-bold mb-2",children:s.name}),e.jsx("p",{className:"text-slate-500 mb-4",children:s.section}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"bg-slate-100 backdrop-blur-sm rounded-xl px-4 py-2 border border-slate-200",children:[e.jsx("p",{className:"text-xs text-slate-500",children:"Level"}),e.jsx("p",{className:"text-xl font-bold",children:s.level})]}),e.jsxs("div",{className:"bg-slate-100 backdrop-blur-sm rounded-xl px-4 py-2 border border-slate-200",children:[e.jsx("p",{className:"text-xs text-slate-500",children:"Total XP"}),e.jsx("p",{className:"text-xl font-bold",children:s.totalXP})]}),e.jsxs("div",{className:"bg-slate-100 backdrop-blur-sm rounded-xl px-4 py-2 border border-slate-200",children:[e.jsx("p",{className:"text-xs text-slate-500",children:"Streak"}),e.jsxs("p",{className:"text-xl font-bold flex items-center gap-1",children:[e.jsx(B,{size:16,className:"text-orange-300"}),s.currentStreak]})]})]})]})]})}),e.jsx("div",{className:"absolute top-0 right-0 w-64 h-64 bg-sky-500/5 rounded-full -translate-y-1/2 translate-x-1/2"}),e.jsx("div",{className:"absolute bottom-0 left-0 w-48 h-48 bg-rose-500/5 rounded-full translate-y-1/2 -translate-x-1/2"})]}),e.jsxs("div",{className:"p-6 overflow-y-auto max-h-[calc(90vh-320px)]",children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("h3",{className:"font-display font-bold text-lg text-[#0a1628] mb-4",children:"Performance Stats"}),e.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[e.jsxs("div",{className:"bg-white rounded-xl border border-[#dde3eb] p-4 text-center",children:[e.jsx(y,{size:24,className:"text-sky-600 mx-auto mb-2"}),e.jsx("p",{className:"text-2xl font-bold text-[#0a1628]",children:s.stats.quizzesCompleted}),e.jsx("p",{className:"text-xs text-slate-500 mt-1 font-body",children:"Quizzes"})]}),e.jsxs("div",{className:"bg-white rounded-xl border border-[#dde3eb] p-4 text-center",children:[e.jsx(A,{size:24,className:"text-emerald-600 mx-auto mb-2"}),e.jsxs("p",{className:"text-2xl font-bold text-[#0a1628]",children:[s.stats.averageScore,"%"]}),e.jsx("p",{className:"text-xs text-slate-500 mt-1 font-body",children:"Avg Score"})]}),e.jsxs("div",{className:"bg-white rounded-xl border border-[#dde3eb] p-4 text-center",children:[e.jsx(k,{size:24,className:"text-rose-600 mx-auto mb-2"}),e.jsx("p",{className:"text-2xl font-bold text-[#0a1628]",children:s.stats.modulesCompleted}),e.jsx("p",{className:"text-xs text-slate-500 mt-1 font-body",children:"Modules"})]}),e.jsxs("div",{className:"bg-white rounded-xl border border-[#dde3eb] p-4 text-center",children:[e.jsx(q,{size:24,className:"text-rose-600 mx-auto mb-2"}),e.jsx("p",{className:"text-2xl font-bold text-[#0a1628]",children:s.stats.studyHours}),e.jsx("p",{className:"text-xs text-slate-500 mt-1 font-body",children:"Hours"})]})]})]}),e.jsxs("div",{className:"mb-6",children:[e.jsx("h3",{className:"font-display font-bold text-lg text-[#0a1628] mb-4",children:"Rankings"}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsxs("div",{className:"bg-rose-50 border border-rose-200 rounded-xl p-4",children:[e.jsx(v,{size:20,className:"text-rose-600 mb-2"}),e.jsxs("p",{className:"text-2xl font-bold text-rose-900",children:["#",s.rank.global]}),e.jsx("p",{className:"text-xs text-rose-700 mt-1 font-body",children:"School"})]}),e.jsxs("div",{className:"bg-sky-50 border border-sky-200 rounded-xl p-4",children:[e.jsx(v,{size:20,className:"text-sky-600 mb-2"}),e.jsxs("p",{className:"text-2xl font-bold text-sky-900",children:["#",s.rank.section]}),e.jsx("p",{className:"text-xs text-sky-700 mt-1 font-body",children:"Section"})]}),e.jsxs("div",{className:"bg-rose-50 border border-rose-200 rounded-xl p-4",children:[e.jsx(v,{size:20,className:"text-rose-600 mb-2"}),e.jsx("p",{className:"text-2xl font-bold text-rose-900",children:s.rank.change>0?e.jsxs("span",{className:"flex items-center gap-1 text-emerald-600",children:[e.jsx(P,{size:20}),"+",s.rank.change]}):s.rank.change<0?e.jsxs("span",{className:"flex items-center gap-1 text-red-600",children:[e.jsx(P,{size:20,className:"rotate-180"}),s.rank.change]}):"0"}),e.jsx("p",{className:"text-xs text-rose-700 mt-1 font-body",children:"This Week"})]})]})]}),e.jsxs("div",{className:"mb-6",children:[e.jsx("h3",{className:"font-display font-bold text-lg text-[#0a1628] mb-4",children:"Achievements"}),h?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(M,{size:24,className:"text-sky-500 animate-spin"})}):n.length>0?e.jsx("div",{className:"grid grid-cols-3 gap-3",children:n.map(c=>e.jsxs("div",{className:"rounded-xl p-4 text-center transition-all bg-white border-2 border-sky-200",children:[e.jsx("div",{className:"text-3xl mb-2",children:x[c.icon]||e.jsx(k,{size:24,className:"text-slate-500 mx-auto"})}),e.jsx("p",{className:"font-bold text-xs text-[#0a1628] mb-1 font-body",children:c.title}),e.jsx("p",{className:"text-xs text-[#5a6578]",children:c.description})]},c.id))}):e.jsxs("div",{className:"flex flex-col items-center py-8 gap-2",children:[e.jsx(k,{size:32,className:"text-[#d1cec6]"}),e.jsx("p",{className:"text-sm text-[#5a6578] font-body",children:"No achievements unlocked yet"})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-display font-bold text-lg text-[#0a1628] mb-4",children:"Recent Activity"}),e.jsxs("div",{className:"flex flex-col items-center py-8 gap-2",children:[e.jsx(y,{size:32,className:"text-[#d1cec6]"}),e.jsx("p",{className:"text-sm text-[#5a6578] font-body",children:"Activity history coming soon"})]})]})]})]})]})})},fe=({currentUserPhoto:s,onBack:w})=>{const{currentUser:n,userProfile:N}=$(),h=N,[p]=o.useState("section"),[x,c]=o.useState("weekly"),[T,z]=o.useState(null),[I,_]=o.useState(!0),[E,Y]=o.useState([]),b=[h?.grade,h?.section].filter(Boolean).join(" - "),f=["","","","","","","",""];o.useEffect(()=>{(async()=>{if(n){_(!0);try{const a={daily:"week",weekly:"week",all:"all"},l=x==="daily"?"week":x==="all"?"all":"week",g=(await H(n.uid,!1,l,20)).map((r,C)=>({id:r.userId,uid:r.userId,name:r.name,avatar:r.userId===n.uid?s||r.photo||f[C%f.length]:r.photo||f[C%f.length],level:r.level,totalXP:r.xp,currentStreak:0,section:b||"Grade 11 - STEM A",rank:{global:r.rank,section:r.rank,change:0},stats:{quizzesCompleted:0,averageScore:0,modulesCompleted:0,studyHours:0},isOnline:!1,isYou:r.userId===n.uid}));Y(g)}catch(a){console.error("Error loading leaderboard:",a)}finally{_(!1)}}})()},[n,b,x,s]);const m=(()=>{let t=E;if(p==="section"){const l=b||"";l&&(t=t.filter(j=>j.section===l))}const a=t.sort((l,j)=>{const g=p==="section"?"section":"global";return(l.rank[g]||999)-(j.rank[g]||999)});for(;a.length>0&&a.length<3;){const l=a.length+1;a.push({id:`mock-${l}`,uid:`mock-${l}`,name:`Student ${l}`,avatar:"",level:1,totalXP:0,currentStreak:0,section:b||"",rank:{global:l,section:l,change:0},stats:{quizzesCompleted:0,averageScore:0,modulesCompleted:0,studyHours:0},isOnline:!1,isYou:!1})}return a})(),S=m.find(t=>t.isYou)?.rank.section||4,D=Math.max(10,Math.min(99,100-S/Math.max(1,m.length)*100)),i=m.length>=3?m.slice(0,3):[],F=m.length>=3?m.slice(3):[],u=(t,a)=>t?t.startsWith("http")||t.startsWith("data:")?e.jsx("img",{src:t,alt:"Avatar",className:"w-full h-full object-cover rounded-full"}):e.jsx(L,{size:a,className:"text-slate-400 opacity-70"}):e.jsx(L,{size:a,className:"text-slate-400 opacity-70"});return I?e.jsx("div",{className:"flex justify-center items-center h-[500px]",children:e.jsx(M,{className:"w-8 h-8 animate-spin text-purple-600"})}):e.jsxs("div",{className:"w-full min-h-screen relative flex flex-col items-center font-body text-white",children:[e.jsxs("div",{className:"absolute inset-x-[-20px] top-0 bottom-[-50px] z-[-1] pointer-events-none overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(circle_at_50%_100%,#9333ea_0%,#c084fc_40%,transparent_80%)]"}),e.jsx("div",{className:"absolute bottom-0 left-1/2 -translate-x-1/2 w-[250vw] md:w-[200vw] h-[150vh] opacity-75 pointer-events-none",style:{WebkitMaskImage:"radial-gradient(circle at 50% 100%, black 10%, transparent 60%)"},children:e.jsx(d.div,{className:"absolute bottom-0 left-1/2 w-[300vw] h-[300vw] md:w-[200vw] md:h-[200vw]",style:{x:"-50%",originX:.5,originY:1,background:`repeating-conic-gradient(from 0deg at 50% 100%,
7
- rgba(255,255,255,0.7) 0deg, rgba(255,255,255,0.7) 6deg,
8
- transparent 6deg, transparent 12deg)`},animate:{rotate:360},transition:{duration:160,repeat:1/0,ease:"linear"}})}),e.jsx("div",{className:"absolute bottom-0 left-1/2 -translate-x-1/2 w-[150vw] h-[100vh] bg-[radial-gradient(ellipse_at_50%_100%,#7e22ce_10%,transparent_60%)] mix-blend-overlay"})]}),e.jsx("div",{className:"absolute inset-0 bg-math-pattern opacity-[0.03] mix-blend-overlay pointer-events-none z-[-1]",style:{WebkitMaskImage:"linear-gradient(to bottom, transparent, black 15%)"}}),e.jsxs("div",{className:"relative z-10 w-full px-4 sm:px-8 py-4 md:py-6 flex flex-col items-center",children:[e.jsx("div",{className:"w-full flex justify-center items-center mb-4 mt-2",children:e.jsx("h1",{className:"text-3xl md:text-4xl font-display font-bold tracking-wide text-slate-800 drop-shadow-sm",children:"Leaderboard"})}),e.jsx("div",{className:"bg-slate-800/5 backdrop-blur-md rounded-full p-1 flex gap-1 mb-3 shadow-[inset_0_2px_4px_rgba(0,0,0,0.05)] border border-slate-800/10 w-full max-w-[340px]",children:["daily","weekly","all"].map(t=>e.jsx("button",{onClick:()=>c(t),className:`flex-1 py-1.5 rounded-full text-[13px] md:text-sm font-semibold transition-all capitalize inline-flex justify-center items-center ${x===t?"bg-white text-purple-700 shadow-md border border-white/50 backdrop-blur-lg":"text-slate-600 hover:text-purple-700 hover:bg-white/50"}`,children:t==="all"?"All Time":t},t))}),e.jsxs(d.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},className:"w-full max-w-[420px] mb-4 bg-[#FFB356] p-2.5 md:p-3 rounded-full shadow-lg flex items-center gap-3 relative overflow-hidden ring-1 ring-white/20",children:[e.jsx("div",{className:"absolute inset-0 bg-noise opacity-[0.15] mix-blend-overlay pointer-events-none"}),e.jsx("div",{className:"bg-white/25 backdrop-blur-md px-4 py-2 min-w-[60px] rounded-full flex flex-col items-center justify-center shadow-sm z-10 border border-white/20",children:e.jsxs("span",{className:"text-xl md:text-2xl font-display font-bold text-white leading-none",children:["#",S]})}),e.jsx("div",{className:"z-10 flex-1 pr-2 md:pr-4",children:e.jsxs("p",{className:"font-medium text-white/90 text-sm md:text-[15px] leading-snug text-center",children:["You are doing better than ",e.jsxs("span",{className:"font-black text-white drop-shadow-sm",children:[Math.round(D),"%"]})," of other players!"]})})]}),e.jsxs("div",{className:"w-full max-w-[800px] flex items-end justify-center gap-2 md:gap-4 h-[280px] md:h-[310px] relative z-20 mt-8 md:mt-12 mx-auto px-2 sm:px-4 group perspective-1000",children:[e.jsxs(d.div,{initial:{opacity:0,y:40},animate:{opacity:1,y:0},transition:{delay:.15,type:"spring",stiffness:90},className:"flex flex-col items-center relative z-10 w-[28%] sm:w-[30%] max-w-[145px] mx-1 md:mr-2",children:[e.jsxs("div",{className:"flex flex-col items-center mb-2 md:mb-4 relative z-40 w-full",children:[e.jsx("div",{className:"w-14 h-14 md:w-[72px] md:h-[72px] rounded-full border-[3px] border-[#FF8B8B] bg-[#111827] flex items-center justify-center shadow-[0_0_18px_rgba(255,139,139,0.6)] overflow-hidden",children:u(i[1]?.avatar,26)}),e.jsx("h3",{className:"font-semibold text-white mt-1.5 md:mt-2 text-xs md:text-sm drop-shadow-md w-full text-center pb-1 px-1 whitespace-normal break-words leading-tight relative z-50",children:i[1]?.name||"---"})]}),e.jsxs("div",{className:"w-[90%] relative mt-2",children:[e.jsx("div",{className:"w-full h-10 md:h-14 absolute -bottom-5 md:-bottom-7 bg-[#D96C6A] rounded-[50%] shadow-[0_15px_25px_rgba(0,0,0,0.4)] z-0"}),e.jsx("div",{className:"w-full h-[100px] md:h-[130px] bg-[#D96C6A] relative z-10 flex flex-col items-center justify-start overflow-hidden",children:e.jsx("span",{className:"absolute inset-x-0 top-3 flex items-center justify-center text-[60px] md:text-[80px] font-black text-white/10 drop-shadow",children:"2"})}),e.jsx("div",{className:"w-full h-10 md:h-14 absolute -top-5 md:-top-7 bg-[#FF8B8B] rounded-[50%] z-20 shadow-[0_4px_8px_rgba(0,0,0,0.3)] flex flex-col items-center justify-center",children:e.jsxs("div",{className:"text-black/25 font-black text-[18px] md:text-[26px] transform scale-y-75 uppercase tracking-widest pointer-events-none z-30",children:[i[1]?.totalXP||0," XP"]})})]})]}),e.jsxs(d.div,{initial:{opacity:0,y:60},animate:{opacity:1,y:0},transition:{delay:.05,type:"spring",stiffness:100},className:"flex flex-col items-center relative z-30 w-[35%] sm:w-[38%] max-w-[190px]",children:[e.jsxs("div",{className:"flex flex-col items-center mb-3 md:mb-5 relative z-40 w-full",children:[e.jsx(d.div,{animate:{y:[0,-6,0]},transition:{repeat:1/0,duration:2.2,ease:"easeInOut"},className:"mb-[-10px] z-30",children:e.jsx(X,{size:30,className:"text-yellow-300 fill-yellow-300 drop-shadow-[0_0_12px_rgba(250,204,21,0.9)] md:w-9 md:h-9"})}),e.jsx("div",{className:"w-16 h-16 md:w-[86px] md:h-[86px] rounded-full border-[4px] border-[#fde68a] bg-[#111827] flex items-center justify-center shadow-[0_0_24px_rgba(250,204,21,0.6)] overflow-hidden",children:u(i[0]?.avatar,34)}),e.jsx("h3",{className:"font-semibold text-white mt-1.5 md:mt-2 text-sm md:text-base drop-shadow-md w-full text-center pb-1 px-1 whitespace-normal break-words leading-tight relative z-50",children:i[0]?.name||"---"})]}),e.jsxs("div",{className:"w-[95%] relative mt-2",children:[e.jsx("div",{className:"w-full h-12 md:h-16 absolute -bottom-6 md:-bottom-8 bg-[#6F2BAF] rounded-[50%] shadow-[0_20px_30px_rgba(0,0,0,0.5)] z-0"}),e.jsx("div",{className:"w-full h-[140px] md:h-[180px] bg-[#6F2BAF] relative z-10 flex flex-col items-center justify-start overflow-hidden",children:e.jsx("span",{className:"absolute inset-x-0 top-4 flex items-center justify-center text-[80px] md:text-[110px] font-black text-white/10 drop-shadow",children:"1"})}),e.jsx("div",{className:"w-full h-12 md:h-16 absolute -top-6 md:-top-8 bg-[#9956DE] rounded-[50%] z-20 shadow-[0_5px_12px_rgba(0,0,0,0.4)] flex flex-col items-center justify-center",children:e.jsxs("div",{className:"text-black/25 font-black text-[22px] md:text-[32px] transform scale-y-75 uppercase tracking-widest pointer-events-none z-30",children:[i[0]?.totalXP||0," XP"]})})]})]}),e.jsxs(d.div,{initial:{opacity:0,y:40},animate:{opacity:1,y:0},transition:{delay:.25,type:"spring",stiffness:90},className:"flex flex-col items-center relative z-10 w-[28%] sm:w-[30%] max-w-[145px] mx-1 md:ml-2",children:[e.jsxs("div",{className:"flex flex-col items-center mb-2 md:mb-4 relative z-40 w-full",children:[e.jsx("div",{className:"w-14 h-14 md:w-[72px] md:h-[72px] rounded-full border-[3px] border-[#FFB356] bg-[#111827] flex items-center justify-center shadow-[0_0_18px_rgba(255,179,86,0.6)] overflow-hidden",children:u(i[2]?.avatar,26)}),e.jsx("h3",{className:"font-semibold text-white mt-1.5 md:mt-2 text-xs md:text-sm drop-shadow-md w-full text-center pb-1 px-1 whitespace-normal break-words leading-tight relative z-50",children:i[2]?.name||"---"})]}),e.jsxs("div",{className:"w-[90%] relative mt-2",children:[e.jsx("div",{className:"w-full h-10 md:h-14 absolute -bottom-5 md:-bottom-7 bg-[#DE7949] rounded-[50%] shadow-[0_15px_25px_rgba(0,0,0,0.4)] z-0"}),e.jsx("div",{className:"w-full h-[75px] md:h-[100px] bg-[#DE7949] relative z-10 flex flex-col items-center justify-start overflow-hidden",children:e.jsx("span",{className:"absolute inset-x-0 top-1 flex items-center justify-center text-[50px] md:text-[70px] font-black text-white/10 drop-shadow",children:"3"})}),e.jsx("div",{className:"w-full h-10 md:h-14 absolute -top-5 md:-top-7 bg-[#FFB356] rounded-[50%] z-20 shadow-[0_4px_8px_rgba(0,0,0,0.3)] flex flex-col items-center justify-center",children:e.jsxs("div",{className:"text-black/25 font-black text-[16px] md:text-[22px] transform scale-y-75 uppercase tracking-widest pointer-events-none z-30",children:[i[2]?.totalXP||0," XP"]})})]})]})]})]}),e.jsxs("div",{className:"w-full flex-grow relative z-20 pt-6 pb-32 px-4 sm:px-10 flex flex-col items-center mt-[-20px] md:mt-[-40px] bg-white transition-all duration-300 hover:-translate-y-2 rounded-t-[2.5rem] shadow-[0_-15px_50px_rgba(0,0,0,0.2)] hover:shadow-[0_-20px_60px_rgba(0,0,0,0.3)] border-t border-slate-100 min-h-[50vh]",children:[e.jsx("div",{className:"absolute top-[50%] bottom-[-500px] left-0 right-0 bg-white z-[-1]"}),e.jsx("div",{className:"w-12 h-1.5 bg-slate-300/80 rounded-full mb-6 mt-[-10px]"}),e.jsxs("div",{className:"w-full max-w-4xl space-y-3.5",children:[F.map((t,a)=>{const l=t.rank.global||a+4;return e.jsxs(d.div,{initial:{opacity:0,y:15},animate:{opacity:1,y:0},transition:{delay:a*.05+.3},onClick:()=>z(t),className:`flex items-center gap-4 p-3.5 md:p-4 rounded-3xl cursor-pointer bg-white border transition-all duration-300 ${t.isYou?"border-[#8B5CF6]/40 shadow-xl shadow-[#8B5CF6]/20 ring-2 ring-[#8B5CF6]/10":"border-slate-100 shadow-[0_12px_25px_rgba(0,0,0,0.08)] hover:shadow-[0_16px_30px_rgba(0,0,0,0.12)]"}`,children:[e.jsx("div",{className:"w-9 h-9 md:w-11 md:h-11 rounded-full border-2 border-slate-100 bg-white flex items-center justify-center font-display font-bold text-slate-500 shadow-sm text-sm",children:l}),e.jsx("div",{className:"w-11 h-11 md:w-14 md:h-14 bg-slate-100 rounded-full flex items-center justify-center text-xl overflow-hidden shadow-sm relative border-[3px] border-[#F1F5F9]",children:u(t.avatar,24)}),e.jsxs("div",{className:"flex-1 flex justify-between items-center pr-2",children:[e.jsx("div",{children:e.jsxs("h4",{className:"font-display font-bold text-[#1E293B] text-[15px] md:text-lg flex items-center gap-2 tracking-wide",children:[t.name,t.isYou&&e.jsx("span",{className:"text-[9px] uppercase tracking-wider bg-[#8B5CF6] text-white px-1.5 py-0.5 rounded font-bold",children:"You"})]})}),e.jsx("div",{children:e.jsxs("p",{className:"text-[13px] md:text-[15px] font-bold text-slate-500 text-right",children:[t.totalXP," ",e.jsx("span",{className:"text-[10px] text-slate-400 font-normal uppercase",children:"XP"})]})})]})]},t.id)}),F.length===0&&e.jsx("div",{className:"text-center py-12",children:e.jsx("p",{className:"text-slate-400 font-medium",children:"No other participants found in this view."})})]})]}),e.jsx(V,{student:T,onClose:()=>z(null)})]})};export{fe as default};
 
 
 
 
 
 
 
 
 
assets/LearningPath-B_MkUEk2.js DELETED
@@ -1 +0,0 @@
1
- import{r as p,c as h,j as t}from"./vendor-react-Dexh7fmo.js";import{u as S,n as k,o as v,g as w,A as C}from"./index-D4nJsLyx.js";import{g as L,s as M}from"./subjects-DDBtpdiA.js";import{M as A}from"./ModuleFolderCard-CoKTURyN.js";import{B as E}from"./book-open-BH50GByv.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-firestore-BML5nJHm.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";import"./trending-up-D-vj8Gbq.js";import"./chart-column-D5mAWcRx.js";import"./clock-DUJO-a50.js";const H=({onNavigateToModules:c,atRiskSubjects:g=[],priorityTopics:d=[]})=>{const{userProfile:i}=S(),[x,f]=p.useState(null),b=i?.grade,j=L(b),m=M.filter(e=>j.includes(e.id)),l=m.find(e=>e.id==="gen-math")??m[0],a=h.useMemo(()=>{const e=d.length>0?d:g.map(s=>k(s)).filter(s=>s!==null),r=new Set;return e.filter(s=>r.has(s)?!1:(r.add(s),!0))},[d,g]),P=h.useMemo(()=>{const e=l?.modules??[];if(a.length===0)return e;const r=new Map(a.map((s,n)=>[v[s],n]));return[...e].sort((s,n)=>{const o=r.get(s.id)??Number.POSITIVE_INFINITY,N=r.get(n.id)??Number.POSITIVE_INFINITY;return o-N})},[l?.modules,a]);p.useEffect(()=>{i?.uid&&w(i.uid).then(f).catch(console.error)},[i?.uid]);const u=P.slice(0,4).map(e=>{const n=x?.subjects?.[l.id]?.modulesProgress?.[e.id]?.lessonsCompleted?.length||0,o=e.lessons.length>0?Math.round(n/e.lessons.length*100):0;return{...e,progress:o,status:o===100?"Completed":o>0?"In Progress":"Not Started"}}),I=u.some(e=>e.progress>0)?"Continue Learning":"Start Learning";return t.jsxs("div",{children:[t.jsxs("div",{className:"flex justify-between items-center mb-6 px-1",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"w-10 h-10 rounded-[14px] bg-indigo-50 border border-indigo-100 flex items-center justify-center text-indigo-500 shadow-inner",children:t.jsx(E,{size:20,strokeWidth:2.5})}),t.jsx("h2",{className:"font-display font-black text-[24px] text-slate-800 tracking-tight",children:I})]}),t.jsxs("button",{onClick:()=>c?.(),className:"text-primary font-bold text-sm flex items-center gap-1 hover:gap-2 transition-all bg-primary/10 px-4 py-2 rounded-xl hover:bg-primary/20",children:["View All ",t.jsx(C,{size:16})]})]}),t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 xl:grid-cols-4 gap-6",children:u.map((e,r)=>t.jsx(A,{module:e,index:r,onClick:()=>c?.(e.id),isAtRisk:a.length>0,badgeLabel:e.status!=="Not Started"?e.status:void 0},e.id))})]})};export{H as default};
 
 
assets/LoginPage-mXOi2OPh.js DELETED
@@ -1 +0,0 @@
1
- import{r,j as e}from"./vendor-react-Dexh7fmo.js";import{B as Q}from"./button-BpeUVhBo.js";import{I as N}from"./input-DBkKXOmF.js";import{m as s,A as I,s as C,a as K,b as z}from"./index-D4nJsLyx.js";import{S as X}from"./sparkles-CXUFmaBJ.js";import{B as Z}from"./brain-CPvGdgWE.js";import{T as ee}from"./trending-up-D-vj8Gbq.js";import{A as te}from"./award-oJTbc9W5.js";import{U as B}from"./users-HMf2sdE3.js";import{G}from"./graduation-cap-Df8fGPxp.js";import{B as D}from"./book-open-BH50GByv.js";import{M as se}from"./mail-D7el5vSX.js";import{L}from"./lock-_59co5m5.js";import{E as ae}from"./eye-off-BYAdNgqy.js";import{E as re}from"./eye-DXdRafOv.js";import{S as le}from"./shield-check-B_yHzqcC.js";import"./vendor-radix-BRdei-zg.js";import"./clsx-B-dksMZM.js";import"./utils-BQQgILNW.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-firestore-BML5nJHm.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";const ie="/assets/shader-bg-DA7bEbBA.mp4",R=(h,d)=>{const l=h instanceof Error?h.message:d;return l.includes("auth/invalid-credential")||l.includes("auth/wrong-password")||l.includes("auth/user-not-found")?"Invalid email or password. Please check your credentials and try again.":l.includes("auth/email-already-in-use")?"This email is already registered. Please sign in instead.":l.includes("auth/weak-password")?"Password is too weak. It should be at least 6 characters.":l.includes("auth/too-many-requests")?"Access to this account has been temporarily disabled due to many failed login attempts. You can immediately restore it by resetting your password or you can try again later.":l.includes("auth/network-request-failed")?"Network error. Please check your internet connection and try again.":l.includes("Firebase:")||l.includes("auth/")?d:l},Ie=()=>{const h=["Grade 11","Grade 12"],d={"Grade 11":["STEM A","STEM B","ABM A","HUMSS A"],"Grade 12":["STEM A","STEM B","ABM A","HUMSS A"]},l={teacher:["Mathematics","Science","English","Technology","Humanities"]},[b,w]=r.useState(""),[f,k]=r.useState(""),[g,q]=r.useState(!1),[i,S]=r.useState(!1),[v,U]=r.useState(""),[o,A]=r.useState("student"),[m,$]=r.useState("Grade 11"),[y,P]=r.useState(d["Grade 11"][0]),[u,E]=r.useState("Mathematics"),[M,c]=r.useState(!1),[T,n]=r.useState(null),[O,H]=r.useState(!1),j=r.useRef(null);r.useEffect(()=>{j.current&&j.current.play().catch(()=>{})},[]),r.useEffect(()=>{o==="teacher"&&!l.teacher.includes(u)&&E(l.teacher[0])},[u,o]),r.useEffect(()=>{const t=d[m]||[];t.length>0&&!t.includes(y)&&P(t[0])},[m,y]);const Y=[{label:"Student",role:"student",email:"teststudent@school.edu",password:"TestPass123!",icon:G,color:"sky"},{label:"Teacher",role:"teacher",email:"testteacher@school.edu",password:"TestPass123!",icon:D,color:"emerald"},{label:"Admin",role:"admin",email:"testadmin@school.edu",password:"TestPass123!",icon:le,color:"rose"}],_=async(t,a,x)=>{n(null),c(!0),w(t),k(a),A(x),S(!1);try{C(x),await z(t,a)}catch(p){n(R(p,"Demo sign-in failed")),c(!1)}},F=async t=>{t.preventDefault(),n(null),c(!0);try{if(i){if(!v.trim()){n("Please enter your name"),c(!1);return}if(o==="student"&&!m){n("Please select a grade level"),c(!1);return}if(o!=="student"&&!u){n("Please select a department"),c(!1);return}if(o==="admin"){n("Admin account creation is restricted. Please contact an existing administrator."),c(!1);return}C(o),await K(b,f,v,o,o==="student"?{grade:m,section:y}:{department:u})}else await z(b,f)}catch(a){n(R(a,"Authentication failed")),c(!1)}},W=["โˆซ","ฯ€","โˆ‘","ฮ”","โˆž","ฯ†","โˆš","ฮป","ฮธ","โˆ‚"];return e.jsxs("div",{className:"h-screen w-full flex items-center justify-center px-6 overflow-hidden relative",style:{background:"linear-gradient(135deg, #f0f9ff 0%, #f8fafc 30%, #fff1f2 60%, #f0f9ff 100%)"},children:[e.jsx("video",{ref:j,autoPlay:!0,loop:!0,muted:!0,playsInline:!0,onCanPlay:()=>H(!0),className:`absolute inset-0 w-full h-full object-cover transition-opacity duration-1000 ${O?"opacity-40":"opacity-0"}`,src:ie}),e.jsx("div",{className:"absolute inset-0 pointer-events-none",style:{background:"radial-gradient(ellipse at 30% 50%, rgba(240,249,255,0.4) 0%, rgba(248,250,252,0.65) 50%, rgba(255,241,242,0.5) 80%, rgba(248,250,252,0.85) 100%)"}}),e.jsx("div",{className:"absolute top-[-20%] left-[-10%] w-[60%] h-[60%] rounded-full blur-[120px] pointer-events-none",style:{background:"radial-gradient(circle, rgba(14,165,233,0.12) 0%, transparent 70%)"}}),e.jsx("div",{className:"absolute bottom-[-20%] right-[-10%] w-[50%] h-[50%] rounded-full blur-[120px] pointer-events-none",style:{background:"radial-gradient(circle, rgba(244,63,94,0.08) 0%, transparent 70%)"}}),e.jsx("div",{className:"absolute inset-0 pointer-events-none opacity-[0.03]",style:{backgroundImage:"radial-gradient(circle, rgba(15,23,42,0.4) 1px, transparent 1px)",backgroundSize:"24px 24px"}}),W.map((t,a)=>e.jsx(s.span,{className:"absolute text-sky-700/[0.08] font-display select-none pointer-events-none",style:{fontSize:`${20+Math.random()*40}px`,left:`${5+a*9.5}%`,top:`${10+a*8}%`},animate:{y:[0,-30,0],opacity:[.04,.1,.04],rotate:[0,10,0]},transition:{duration:8+a*2,repeat:1/0,ease:"easeInOut",delay:a*.5},children:t},a)),e.jsx("div",{className:"absolute top-0 left-1/4 w-px h-full bg-gradient-to-b from-transparent via-sky-400/15 to-transparent"}),e.jsx("div",{className:"absolute top-0 right-1/3 w-px h-full bg-gradient-to-b from-transparent via-rose-300/10 to-transparent"}),e.jsx("div",{className:"relative z-10 w-full max-w-6xl mx-auto",children:e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8 lg:gap-12 items-center",children:[e.jsxs(s.div,{initial:{opacity:0,x:-40},animate:{opacity:1,x:0},transition:{duration:.8,ease:[.22,1,.36,1]},className:"flex flex-col justify-center space-y-8",children:[e.jsxs(s.div,{className:"flex items-center gap-2.5",children:[e.jsx(s.div,{className:"relative flex items-center justify-center drop-shadow-md",children:e.jsx("img",{src:"/mathpulse_logo.png",alt:"MathPulse AI Logo",className:"w-16 h-16 object-contain flex-shrink-0"})}),e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-display font-extrabold tracking-tight text-slate-900",children:["MathPulse",e.jsx("span",{className:"text-sky-500",children:"AI"})]}),e.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5",children:[e.jsx(X,{size:12,className:"text-rose-500"}),e.jsx("span",{className:"text-xs text-slate-500 font-body font-medium tracking-wide",children:"Powered by Machine Learning"})]})]})]}),e.jsxs(s.div,{className:"space-y-5",initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.2,duration:.8},children:[e.jsxs("h2",{className:"text-4xl lg:text-5xl xl:text-[3.4rem] font-display font-extrabold leading-[1.1] tracking-tight text-slate-900",children:["Transform Your",e.jsx("br",{}),e.jsx("span",{className:"bg-gradient-to-r from-sky-600 via-cyan-500 to-sky-500 bg-clip-text text-transparent",children:"Math Journey"})]}),e.jsx("p",{className:"text-base text-slate-500 leading-relaxed max-w-md font-body",children:"AI-powered predictive system designed to identify at-risk students and provide personalized learning recommendations."})]}),e.jsx("div",{className:"grid grid-cols-3 gap-3",children:[{icon:Z,label:"AI Predictions",desc:"Smart detection",color:"sky"},{icon:ee,label:"Analytics",desc:"Real-time data",color:"rose"},{icon:te,label:"Gamified",desc:"Learn & earn",color:"emerald"}].map((t,a)=>{const x=t.icon,p={sky:"border-sky-200/60 hover:border-sky-300",rose:"border-rose-200/60 hover:border-rose-300",emerald:"border-emerald-200/60 hover:border-emerald-300"},V={sky:"text-sky-600",rose:"text-rose-500",emerald:"text-emerald-600"},J={sky:"bg-sky-100",rose:"bg-rose-100",emerald:"bg-emerald-100"};return e.jsxs(s.div,{className:`bg-white/80 backdrop-blur-xl border ${p[t.color]} rounded-xl p-4 transition-all cursor-pointer group shadow-md shadow-slate-900/[0.04]`,initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.5+a*.1},whileHover:{scale:1.03,y:-4},children:[e.jsx("div",{className:`w-9 h-9 rounded-lg ${J[t.color]} flex items-center justify-center mb-3`,children:e.jsx(x,{size:18,className:V[t.color]})}),e.jsx("h3",{className:"text-sm font-display font-semibold text-slate-800 mb-0.5",children:t.label}),e.jsx("p",{className:"text-xs text-slate-400 font-body",children:t.desc})]},a)})})]}),e.jsx(s.div,{initial:{opacity:0,y:30},animate:{opacity:1,y:0},transition:{duration:.8,delay:.15,ease:[.22,1,.36,1]},className:"relative flex justify-center lg:justify-end",children:e.jsxs("div",{className:"bg-white/85 backdrop-blur-2xl border border-slate-200/60 rounded-2xl p-7 w-full max-w-md relative overflow-hidden shadow-2xl shadow-slate-900/[0.08]",children:[e.jsx("div",{className:"absolute top-0 left-0 right-0 h-[2px] bg-gradient-to-r from-transparent via-sky-500/50 to-transparent"}),e.jsx("div",{className:"absolute -top-20 left-1/2 -translate-x-1/2 w-72 h-36 bg-sky-400/10 rounded-full blur-3xl pointer-events-none"}),e.jsxs("div",{className:"text-center mb-6 relative",children:[e.jsx(s.h3,{className:"text-2xl font-display font-bold text-slate-900 mb-2",initial:{opacity:0},animate:{opacity:1},transition:{delay:.4},children:i?"Create Account":"Welcome Back"}),e.jsx(s.p,{className:"text-sm text-slate-500 font-body",initial:{opacity:0},animate:{opacity:1},transition:{delay:.5},children:i?"Begin your learning journey":"Sign in to continue learning"})]}),e.jsxs("form",{onSubmit:F,className:"space-y-4 mb-5 relative",children:[T&&e.jsx(s.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},className:"bg-rose-50 border border-rose-200 text-rose-600 px-4 py-3 rounded-lg text-sm font-body",children:T}),i&&e.jsxs(s.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-slate-500 mb-2 uppercase tracking-wider",children:"Full Name"}),e.jsxs("div",{className:"relative",children:[e.jsx(B,{size:16,className:"absolute left-4 top-1/2 -translate-y-1/2 text-slate-400"}),e.jsx(N,{type:"text",placeholder:"Your Name",value:v,onChange:t=>U(t.target.value),className:"w-full pl-11 pr-4 py-3 rounded-lg bg-slate-100/70 border-slate-200/80 text-slate-900 placeholder:text-slate-400 focus:border-sky-400 focus:ring-2 focus:ring-sky-400/20 focus:bg-white text-sm font-body transition-all",required:!0})]})]}),i&&e.jsxs(s.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{delay:.45},children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-slate-500 mb-2 uppercase tracking-wider",children:"Account Type"}),e.jsx("div",{className:"grid grid-cols-2 gap-2",children:[{role:"student",label:"Student"},{role:"teacher",label:"Teacher"}].map(t=>{const a=o===t.role;return e.jsx("button",{type:"button",onClick:()=>A(t.role),className:`rounded-lg border px-3 py-2 text-xs font-body font-semibold transition-all ${a?"border-sky-400 bg-sky-50 text-sky-700":"border-slate-200 bg-slate-50 text-slate-500 hover:border-slate-300"}`,children:t.label},t.role)})})]}),i&&o==="student"&&e.jsxs(s.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-slate-500 mb-2 uppercase tracking-wider",children:"Grade Level"}),e.jsxs("div",{className:"relative",children:[e.jsx(G,{size:16,className:"absolute left-4 top-1/2 -translate-y-1/2 text-slate-400"}),e.jsx("select",{value:m,onChange:t=>$(t.target.value),className:"w-full pl-11 pr-4 py-3 rounded-lg bg-slate-100/70 border border-slate-200/80 text-slate-900 focus:border-sky-400 focus:ring-2 focus:ring-sky-400/20 focus:bg-white text-sm font-body transition-all appearance-none",required:!0,children:h.map(t=>e.jsx("option",{value:t,children:t},t))})]})]}),i&&o==="student"&&e.jsxs(s.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-slate-500 mb-2 uppercase tracking-wider",children:"Section"}),e.jsxs("div",{className:"relative",children:[e.jsx(B,{size:16,className:"absolute left-4 top-1/2 -translate-y-1/2 text-slate-400"}),e.jsx("select",{value:y,onChange:t=>P(t.target.value),className:"w-full pl-11 pr-4 py-3 rounded-lg bg-slate-100/70 border border-slate-200/80 text-slate-900 focus:border-sky-400 focus:ring-2 focus:ring-sky-400/20 focus:bg-white text-sm font-body transition-all appearance-none",required:!0,children:(d[m]||[]).map(t=>e.jsx("option",{value:t,children:t},t))})]})]}),i&&o!=="student"&&e.jsxs(s.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-slate-500 mb-2 uppercase tracking-wider",children:"Department"}),e.jsxs("div",{className:"relative",children:[e.jsx(D,{size:16,className:"absolute left-4 top-1/2 -translate-y-1/2 text-slate-400"}),e.jsx("select",{value:u,onChange:t=>E(t.target.value),className:"w-full pl-11 pr-4 py-3 rounded-lg bg-slate-100/70 border border-slate-200/80 text-slate-900 focus:border-sky-400 focus:ring-2 focus:ring-sky-400/20 focus:bg-white text-sm font-body transition-all appearance-none",required:!0,children:l.teacher.map(t=>e.jsx("option",{value:t,children:t},t))})]})]}),e.jsxs(s.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{delay:.5},children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-slate-500 mb-2 uppercase tracking-wider",children:"Email Address"}),e.jsxs("div",{className:"relative",children:[e.jsx(se,{size:16,className:"absolute left-4 top-1/2 -translate-y-1/2 text-slate-400"}),e.jsx(N,{type:"email",placeholder:"your.email@school.edu",value:b,onChange:t=>w(t.target.value),className:"w-full pl-11 pr-4 py-3 rounded-lg bg-slate-100/70 border-slate-200/80 text-slate-900 placeholder:text-slate-400 focus:border-sky-400 focus:ring-2 focus:ring-sky-400/20 focus:bg-white text-sm font-body transition-all",required:!0})]})]}),e.jsxs(s.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{delay:.6},children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-slate-500 mb-2 uppercase tracking-wider",children:"Password"}),e.jsxs("div",{className:"relative",children:[e.jsx(L,{size:16,className:"absolute left-4 top-1/2 -translate-y-1/2 text-slate-400"}),e.jsx(N,{type:g?"text":"password",placeholder:"โ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ข",value:f,onChange:t=>k(t.target.value),className:"w-full pl-11 pr-11 py-3 rounded-lg bg-slate-100/70 border-slate-200/80 text-slate-900 placeholder:text-slate-400 focus:border-sky-400 focus:ring-2 focus:ring-sky-400/20 focus:bg-white text-sm font-body transition-all",required:!0,minLength:6}),e.jsx(s.button,{type:"button",onClick:()=>q(!g),className:"absolute right-3 top-1/2 -translate-y-1/2 text-slate-400 hover:text-slate-600 transition-colors",whileTap:{scale:.9},children:g?e.jsx(ae,{size:16}):e.jsx(re,{size:16})})]})]}),e.jsx(s.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.7},children:e.jsxs(Q,{type:"submit",disabled:M,className:"w-full bg-gradient-to-r from-sky-600 to-sky-500 hover:from-sky-500 hover:to-cyan-400 text-white font-body font-semibold py-3 rounded-xl shadow-lg shadow-sky-600/25 hover:shadow-sky-500/35 hover:scale-[1.01] transition-all text-sm group relative overflow-hidden disabled:opacity-50 disabled:cursor-not-allowed",children:[e.jsx(s.span,{className:"absolute inset-0 bg-gradient-to-r from-white/0 via-white/15 to-white/0",animate:{x:["-100%","100%"]},transition:{duration:3,repeat:1/0,repeatDelay:2}}),e.jsxs("span",{className:"relative flex items-center justify-center gap-2",children:[M?"Please wait...":i?"Create Account":"Sign In",e.jsx(I,{size:16,className:"group-hover:translate-x-1 transition-transform"})]})]})}),e.jsx("div",{className:"text-center",children:e.jsx("button",{type:"button",onClick:()=>{S(!i),n(null)},className:"text-sm text-slate-400 hover:text-sky-500 font-body font-medium transition-colors",children:i?"Already have an account? Sign in":"Don't have an account? Create one"})})]}),!i&&e.jsxs(s.div,{initial:{opacity:0},animate:{opacity:1},transition:{delay:.85},className:"mb-4 relative",children:[e.jsxs("div",{className:"relative flex items-center gap-3 mb-4",children:[e.jsx("div",{className:"flex-1 h-px bg-slate-200"}),e.jsx("span",{className:"text-[10px] font-body font-semibold text-slate-400 uppercase tracking-widest",children:"Quick Demo Access"}),e.jsx("div",{className:"flex-1 h-px bg-slate-200"})]}),e.jsx("div",{className:"flex flex-col gap-2",children:Y.map(t=>{const a=t.icon,x={sky:"bg-sky-100",emerald:"bg-emerald-100",rose:"bg-rose-100"},p={sky:"text-sky-600",emerald:"text-emerald-600",rose:"text-rose-500"};return e.jsxs(s.button,{type:"button",onClick:()=>_(t.email,t.password,t.role),className:"group flex items-center gap-3 w-full px-4 py-2.5 rounded-lg bg-slate-50/80 border border-slate-200/70 hover:border-sky-300 hover:bg-sky-50/80 hover:shadow-sm transition-all text-left",whileHover:{scale:1.01},whileTap:{scale:.99},children:[e.jsx("div",{className:`w-8 h-8 rounded-md flex items-center justify-center shrink-0 ${x[t.color]}`,children:e.jsx(a,{size:15,className:p[t.color]})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("p",{className:"text-xs font-body font-semibold text-slate-700 group-hover:text-sky-600 transition-colors",children:[t.label," Account"]}),e.jsx("p",{className:"text-[10px] text-slate-400 font-body truncate",children:t.email})]}),e.jsx(I,{size:14,className:"text-slate-300 group-hover:text-sky-500 group-hover:translate-x-0.5 transition-all shrink-0"})]},t.label)})})]}),e.jsxs(s.p,{className:"text-xs text-slate-400 text-center mt-4 font-body relative",initial:{opacity:0},animate:{opacity:1},transition:{delay:1},children:[e.jsx(L,{size:10,className:"inline mr-1 -mt-0.5"})," Your data is encrypted and secure"]})]})})]})})]})};export{Ie as default};
 
 
assets/LogoutActionButton-FS5OGZjL.js DELETED
@@ -1,16 +0,0 @@
1
- import{c as a,m as s}from"./index-D4nJsLyx.js";import{j as e}from"./vendor-react-Dexh7fmo.js";import{c as n}from"./utils-BQQgILNW.js";import{L as i}from"./log-out-BqGKt-tT.js";/**
2
- * @license lucide-react v0.487.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 l=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],m=a("chevron-left",l);/**
7
- * @license lucide-react v0.487.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 c=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],f=a("layout-dashboard",c);/**
12
- * @license lucide-react v0.487.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 h=[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],p=a("settings",h),g=({onClick:o,collapsed:t=!1,className:r})=>e.jsxs(s.button,{type:"button",whileTap:{scale:.98},whileHover:{x:2},onClick:o,title:t?"Log Out":void 0,className:n("w-full flex items-center gap-3 px-4 py-3 rounded-2xl text-[#5a6578] font-bold border border-transparent hover:bg-[#dde3eb] hover:border-[#dde3eb] hover:text-[#0a1628] transition-all duration-200 whitespace-nowrap",t&&"justify-center",r),children:[e.jsx(i,{size:18,strokeWidth:1.5,className:"flex-shrink-0"}),!t&&e.jsx("span",{className:"font-body text-xs",children:"Log Out"})]});export{m as C,f as L,p as S,g as a};
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/MathAnswerInput-DNG5LFL4.js DELETED
@@ -1 +0,0 @@
1
- import{r as c,c as y,j as e}from"./vendor-react-Dexh7fmo.js";import{C as P}from"./index-D4nJsLyx.js";const N={0:"โฐ",1:"ยน",2:"ยฒ",3:"ยณ",4:"โด",5:"โต",6:"โถ",7:"โท",8:"โธ",9:"โน"};function S(i){let t=i;return t=t.replace(/sinโปยน/g,"sin<sup>-1</sup>"),t=t.replace(/cosโปยน/g,"cos<sup>-1</sup>"),t=t.replace(/tanโปยน/g,"tan<sup>-1</sup>"),t=t.replace(/โปยน/g,"<sup>-1</sup>"),t=t.replace(/ยฒ/g,"<sup>2</sup>"),t=t.replace(/ยณ/g,"<sup>3</sup>"),t=t.replace(/[โฐยนโดโตโถโทโธโน]/g,d=>`<sup>${{"โฐ":"0","ยน":"1","โด":"4","โต":"5","โถ":"6","โท":"7","โธ":"8","โน":"9"}[d]??d}</sup>`),t=t.replace(/โˆš/g,"โˆš"),t=t.replace(/ฯ€/g,"ฯ€"),t=t.replace(/<(?!\/?(?:sup|sub)\b)[^>]*>/gi,""),t}const R=({value:i,onChange:t,placeholder:d,onCalculatorOpen:h,onSubmit:f})=>{const[b,g]=c.useState(!1),[m,j]=c.useState(null),[w,v]=c.useState({top:0,left:0}),p=c.useRef(null),x=c.useRef(!1),s=c.useCallback(n=>{const o=p.current;if(!o){t(i+n);return}const l=o.selectionStart??i.length,u=o.selectionEnd??i.length,D=i.slice(0,l)+n+i.slice(u);t(D),setTimeout(()=>{o.setSelectionRange(l+n.length,l+n.length),o.focus()},0)},[i,t]),C=c.useCallback(n=>{const o=n.key;if(o==="Enter"){n.preventDefault(),f?.();return}if(o==="^"){x.current=!0,n.preventDefault();return}if(x.current){if(o==="-"){s("โป"),n.preventDefault();return}if(/^[0-9]$/.test(o)&&N[o]){s(N[o]),x.current=!1,n.preventDefault();return}x.current=!1}if(o==="Tab"&&m!==null){s(m),j(null),n.preventDefault();return}setTimeout(()=>{const l=p.current?.value??i;if(l.endsWith("pi"))t(l.slice(0,-2)+"ฯ€"),j(null);else if(l.endsWith("sqrt"))t(l.slice(0,-4)+"โˆš");else if(l.endsWith("sin-1")||l.endsWith("sin^-1")){const u=l.endsWith("sin^-1")?6:5;t(l.slice(0,-u)+"sinโปยน")}else if(l.endsWith("cos-1")||l.endsWith("cos^-1")){const u=l.endsWith("cos^-1")?6:5;t(l.slice(0,-u)+"cosโปยน")}else if(l.endsWith("tan-1")||l.endsWith("tan^-1")){const u=l.endsWith("tan^-1")?6:5;t(l.slice(0,-u)+"tanโปยน")}},0)},[i,t,m,s,f]),a=c.useCallback(()=>{if(p.current){const n=p.current.getBoundingClientRect();v({top:Math.max(20,n.bottom-280),left:Math.max(10,n.left-240)})}},[]),E=c.useCallback(()=>{a(),g(!0)},[a]);y.useEffect(()=>{const n=setTimeout(()=>{a(),g(!0)},50);return()=>clearTimeout(n)},[a]),y.useEffect(()=>{if(b)return window.addEventListener("resize",a),window.addEventListener("scroll",a,!0),()=>{window.removeEventListener("resize",a),window.removeEventListener("scroll",a,!0)}},[b,a]);const T=c.useCallback(()=>{},[]),k=S(i),W=k!==i&&i.length>0,r="bg-slate-100 hover:bg-slate-200 text-[#0a1628] text-sm px-2 py-1 rounded-lg transition-colors";return e.jsxs("div",{className:"relative",children:[b&&e.jsxs("div",{className:"fixed z-[60] bg-white border border-slate-200 rounded-xl shadow-xl px-3 py-3 flex flex-col gap-3 w-[220px] pointer-events-auto",style:{top:w.top,left:w.left},onMouseDown:n=>n.preventDefault(),children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-[#5a6578] uppercase tracking-wider mb-0.5 block",children:"Powers"}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx("button",{type:"button",className:r,title:"Square",onClick:()=>s("ยฒ"),children:"xยฒ"}),e.jsx("button",{type:"button",className:r,title:"Cube",onClick:()=>s("ยณ"),children:"xยณ"}),e.jsx("button",{type:"button",className:r,title:"Power",onClick:()=>s("^"),children:"xโฟ"}),e.jsx("button",{type:"button",className:r,title:"Inverse",onClick:()=>s("โปยน"),children:"xโปยน"}),e.jsx("button",{type:"button",className:r,title:"Square root",onClick:()=>s("โˆš("),children:"โˆš"}),e.jsx("button",{type:"button",className:r,title:"Cube root",onClick:()=>s("โˆ›("),children:"โˆ›"})]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-[#5a6578] uppercase tracking-wider mb-0.5 block",children:"Inverse Trig"}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx("button",{type:"button",className:r,title:"Inverse sine",onClick:()=>s("sinโปยน("),children:"sinโปยน"}),e.jsx("button",{type:"button",className:r,title:"Inverse cosine",onClick:()=>s("cosโปยน("),children:"cosโปยน"}),e.jsx("button",{type:"button",className:r,title:"Inverse tangent",onClick:()=>s("tanโปยน("),children:"tanโปยน"})]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-[#5a6578] uppercase tracking-wider mb-0.5 block",children:"Symbols"}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx("button",{type:"button",className:r,title:"Pi",onClick:()=>s("ฯ€"),children:"ฯ€"}),e.jsx("button",{type:"button",className:r,title:"Euler's number",onClick:()=>s("e"),children:"e"}),e.jsx("button",{type:"button",className:r,title:"Infinity",onClick:()=>s("โˆž"),children:"โˆž"}),e.jsx("button",{type:"button",className:r,title:"Plus-minus",onClick:()=>s("ยฑ"),children:"ยฑ"}),e.jsx("button",{type:"button",className:r,title:"Approximately",onClick:()=>s("โ‰ˆ"),children:"โ‰ˆ"}),e.jsx("button",{type:"button",className:r,title:"Degree",onClick:()=>s("ยฐ"),children:"ยฐ"})]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-[#5a6578] uppercase tracking-wider mb-0.5 block",children:"Other"}),e.jsxs("div",{className:"flex gap-1 items-center",children:[e.jsx("button",{type:"button",className:r,title:"Fraction",onClick:()=>s("(/)"),children:"a/b"}),e.jsx("div",{className:"ml-auto",children:e.jsxs("button",{type:"button",className:"bg-sky-600 hover:bg-rose-500 text-white text-xs px-3 py-1 rounded-lg flex items-center gap-1",onClick:()=>h?.(),children:[e.jsx(P,{size:12}),"Use Calc"]})})]})]})]}),e.jsx("input",{ref:p,id:"math-answer-input",name:"math-answer-input","aria-label":"Math answer input",type:"text",value:i,onChange:n=>t(n.target.value),onKeyDown:C,onFocus:E,onBlur:T,placeholder:d||"Type your answer... use ^ for powers e.g. x^2 for xยฒ",className:"w-full bg-white border border-slate-200 focus:border-sky-500 rounded-xl px-4 py-3 text-[#0a1628] font-mono text-base outline-none transition-colors"}),W&&e.jsx("div",{className:"text-rose-300 text-sm font-mono mt-1",dangerouslySetInnerHTML:{__html:k}})]})};export{R as M};
 
 
assets/ModuleFolderCard-CoKTURyN.js DELETED
@@ -1 +0,0 @@
1
- import{j as e}from"./vendor-react-Dexh7fmo.js";import{m as d,T as n}from"./index-D4nJsLyx.js";import{B as x}from"./book-open-BH50GByv.js";import{C as h}from"./clock-DUJO-a50.js";const r=[{bg:"bg-[#9956DE]",tab:"bg-[#8248c2]",shadow:"shadow-[#9956DE]/30"},{bg:"bg-[#1FA7E1]",tab:"bg-[#198abf]",shadow:"shadow-[#1FA7E1]/30"},{bg:"bg-[#FFB356]",tab:"bg-[#e09841]",shadow:"shadow-[#FFB356]/30"},{bg:"bg-[#FB96BB]",tab:"bg-[#de7b9f]",shadow:"shadow-[#FB96BB]/30"}],g=({module:s,index:l,onClick:o,isAtRisk:i,badgeLabel:t})=>{const a=r[l%r.length];return e.jsxs(d.button,{whileHover:{y:-8},onClick:o,className:"relative text-left rounded-[1.4rem] overflow-visible min-h-[290px] bg-transparent group w-full",children:[e.jsx("div",{className:`absolute top-0 left-4 h-7 w-32 rounded-t-xl shadow-sm transition-colors duration-300 ${a.tab}`}),e.jsxs("div",{className:`relative mt-6 rounded-[1.4rem] p-6 transition-all duration-300 overflow-hidden flex flex-col h-[calc(100%-24px)] ${a.bg} shadow-[0_18px_30px_-20px_rgba(0,0,0,0.45)] group-hover:shadow-[0_24px_40px_-15px_rgba(0,0,0,0.5)]`,children:[e.jsx("div",{className:"absolute top-0 left-0 right-0 h-1.5 mix-blend-overlay bg-white/40"}),e.jsx("div",{className:"absolute -bottom-8 right-[-20%] w-48 h-48 bg-white opacity-10 rounded-full transition-transform duration-500 group-hover:scale-110"}),e.jsx("div",{className:"absolute bottom-4 right-12 w-32 h-32 bg-white opacity-10 rounded-full transition-transform duration-500 group-hover:scale-110 delay-75"}),e.jsxs("div",{className:"relative z-10 flex-1 flex flex-col h-full",children:[e.jsxs("div",{className:"flex items-start justify-between mb-4",children:[e.jsx("span",{className:"px-3 py-1.5 rounded-full bg-white/20 text-white text-[10px] font-black uppercase tracking-wider backdrop-blur-sm shadow-sm border border-white/10",children:"General Mathematics"}),(t||s.status==="Locked")&&e.jsx("span",{className:"px-2.5 py-1 rounded-full bg-black/30 text-white/90 text-[10px] font-black uppercase tracking-wider backdrop-blur-sm",children:t||"Locked"})]}),e.jsx("h3",{className:"text-2xl md:text-[22px] font-display font-black text-white leading-[1.1] mb-2 drop-shadow-sm pr-4 line-clamp-2",children:s.title}),e.jsx("p",{className:"text-white/85 text-sm line-clamp-2 mb-6 font-medium leading-relaxed pr-2",children:s.subtitle||s.description||"Master this module to unlock the next level of your mathematical journey."}),e.jsxs("div",{className:"mt-auto",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-5",children:[e.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1.5 bg-white/20 rounded-xl text-white font-bold text-[13px] backdrop-blur-sm shadow-sm border border-white/10",children:[e.jsx(x,{size:14,className:"opacity-90"})," ",s.totalLessons||s.lessons?.length||0," lessons"]}),e.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1.5 bg-white/20 rounded-xl text-white font-bold text-[13px] backdrop-blur-sm shadow-sm border border-white/10",children:[e.jsx(h,{size:14,className:"opacity-90"})," ",s.totalQuizzes||s.quizzes?.length||0," quizzes"]})]}),e.jsxs("div",{className:"flex justify-between text-white font-bold text-[13px] mb-1.5 drop-shadow-sm",children:[e.jsx("span",{children:"Progress"}),e.jsxs("span",{children:[s.progress>0?s.progress:0,"%"]})]}),e.jsx("div",{className:"w-full h-2.5 rounded-full bg-black/20 overflow-hidden shadow-inner flex-shrink-0",children:e.jsx("div",{className:"h-full bg-white rounded-full transition-all duration-1000 ease-out",style:{width:`${s.progress>0?s.progress:0}%`}})})]}),i&&e.jsxs("div",{className:"absolute -top-3 -right-2 bg-rose-500 text-white px-3 py-1.5 rounded-full text-[11px] font-black uppercase tracking-wider flex items-center gap-1.5 shadow-lg border border-rose-400 animate-pulse",children:[e.jsx(n,{size:12,strokeWidth:3})," Review"]})]})]})]})};export{g as M};
 
 
assets/ModulesPage-y4YivjOd.js DELETED
The diff for this file is too large to render. See raw diff
 
assets/NotificationCenter-DGhehaGL.js DELETED
@@ -1,6 +0,0 @@
1
- import{r as m,j as e}from"./vendor-react-Dexh7fmo.js";import{c as w,u as A,m as o,e as C,j as M,k as z,l as E}from"./index-D4nJsLyx.js";import{B as h}from"./bell-CbSbac2W.js";import{X as R}from"./x-BONnp2RF.js";import{B as T}from"./book-open-BH50GByv.js";import{M as $}from"./message-square-DSAS4TVL.js";import{C as B}from"./circle-alert-CBefjicJ.js";import{T as H}from"./trophy-C2nVcZnb.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-firestore-BML5nJHm.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";/**
2
- * @license lucide-react v0.487.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 I=[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]],S=w("check-check",I),Y=({userRole:q="student"})=>{const{currentUser:l}=A(),[u,x]=m.useState(!1),[r,f]=m.useState([]),[D,p]=m.useState(!1);m.useEffect(()=>{(async()=>{if(l){p(!0);try{const N=(await M(l.uid,20)).map(s=>{let n="info";s.type==="achievement"?n="achievement":s.type==="risk_alert"||s.type==="reminder"?n="alert":s.type==="message"?n="message":n="info";const k=s.createdAt instanceof Date?s.createdAt:new Date(s.createdAt),v=Date.now()-k.getTime(),i=Math.floor(v/6e4);let d;return i<1?d="Just now":i<60?d=`${i} min ago`:i<1440?d=`${Math.floor(i/60)} hours ago`:d=`${Math.floor(i/1440)} days ago`,{id:s.id,type:n,title:s.title,message:s.message,time:d,read:s.read}});f(N)}catch(a){console.error("Error loading notifications:",a)}finally{p(!1)}}})()},[l]);const c=r.filter(t=>!t.read).length,b=()=>{f(r.map(t=>({...t,read:!0}))),l&&z(l.uid).catch(t=>console.error("Error marking all as read:",t))},g=t=>{f(r.map(a=>a.id===t?{...a,read:!0}:a)),E(t).catch(a=>console.error("Error marking as read:",a))},y=t=>{switch(t){case"achievement":return H;case"alert":return B;case"message":return $;case"info":return T;default:return h}},j=t=>{switch(t){case"achievement":return"bg-rose-500/10 text-rose-600";case"alert":return"bg-red-500/10 text-red-600";case"message":return"bg-sky-500/10 text-sky-600";case"info":return"bg-emerald-500/10 text-emerald-600";default:return"bg-[#edf1f7] text-[#5a6578]"}};return e.jsxs("div",{className:"relative",children:[e.jsxs(o.button,{whileHover:{scale:1.05},whileTap:{scale:.95},onClick:()=>x(!u),className:"relative p-3 bg-[#edf1f7] rounded-xl text-[#5a6578] hover:bg-[#dde3eb] transition-colors",children:[e.jsx(h,{size:20}),c>0&&e.jsx(o.span,{initial:{scale:0},animate:{scale:1},className:"absolute -top-1 -right-1 w-5 h-5 bg-sky-600 text-white text-xs font-bold rounded-full flex items-center justify-center",children:c})]}),e.jsx(C,{children:u&&e.jsxs("div",{children:[e.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>x(!1)}),e.jsxs(o.div,{initial:{opacity:0,y:-10,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-10,scale:.95},transition:{duration:.2},className:"absolute right-0 top-full mt-2 w-96 bg-[#f7f9fc] rounded-xl shadow-2xl border border-[#dde3eb] z-50 overflow-hidden",children:[e.jsxs("div",{className:"p-4 border-b border-[#dde3eb] flex items-center justify-between bg-gradient-to-r from-sky-600 to-sky-500",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"font-display font-bold text-white",children:"Notifications"}),e.jsx("p",{className:"text-xs text-sky-100 mt-0.5",children:c>0?`${c} unread`:"All caught up!"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[c>0&&e.jsx(o.button,{whileHover:{scale:1.05},whileTap:{scale:.95},onClick:b,className:"text-xs text-sky-400 hover:text-sky-300 font-bold",children:e.jsx(S,{size:18})}),e.jsx(o.button,{whileHover:{scale:1.05},whileTap:{scale:.95},onClick:()=>x(!1),className:"text-slate-500 hover:text-sky-700",children:e.jsx(R,{size:18})})]})]}),e.jsx("div",{className:"max-h-96 overflow-y-auto",children:r.length===0?e.jsxs("div",{className:"p-8 text-center",children:[e.jsx(h,{size:48,className:"text-[#d1cec6] mx-auto mb-3"}),e.jsx("p",{className:"text-[#5a6578] text-sm font-body",children:"No notifications yet"})]}):e.jsx("div",{children:r.map(t=>{const a=y(t.type);return e.jsx(o.div,{whileHover:{backgroundColor:"rgba(241, 245, 249, 0.5)"},onClick:()=>g(t.id),className:`p-4 border-b border-[#dde3eb] cursor-pointer transition-colors ${t.read?"":"bg-sky-50/40"}`,children:e.jsxs("div",{className:"flex gap-3",children:[e.jsx("div",{className:`w-10 h-10 rounded-xl flex items-center justify-center flex-shrink-0 ${j(t.type)}`,children:e.jsx(a,{size:18})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2 mb-1",children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] line-clamp-1 font-body",children:t.title}),!t.read&&e.jsx("span",{className:"w-2 h-2 bg-sky-600 rounded-full flex-shrink-0 mt-1.5"})]}),e.jsx("p",{className:"text-xs text-[#5a6578] mb-2 line-clamp-2 font-body",children:t.message}),e.jsx("p",{className:"text-xs text-slate-500",children:t.time})]})]})},t.id)})})}),r.length>0&&e.jsx("div",{className:"p-3 border-t border-[#dde3eb] text-center bg-[#edf1f7]",children:e.jsx("button",{className:"text-xs text-sky-600 hover:text-sky-700 font-bold font-body",children:"View All Notifications"})})]})]},"notification-panel")})]})};export{Y as default};
 
 
 
 
 
 
 
assets/ProfileModal-D3hk8uuj.js DELETED
@@ -1,16 +0,0 @@
1
- import{r,j as e}from"./vendor-react-Dexh7fmo.js";import{B as c}from"./button-BpeUVhBo.js";import{I as l}from"./input-DBkKXOmF.js";import{c as u,e as P,m as k,B as A,N as B}from"./index-D4nJsLyx.js";import{C as R}from"./CompositeAvatar-DMpjm5UY.js";import{X as D}from"./x-BONnp2RF.js";import{U as f}from"./users-HMf2sdE3.js";import{M as F}from"./mail-D7el5vSX.js";import{A as b}from"./award-oJTbc9W5.js";import{B as w}from"./book-open-BH50GByv.js";import{C as U}from"./calendar-BJ8oE6yW.js";import{G as _}from"./globe-BMa4SWkV.js";import{S as T}from"./save-Og8yP5Yb.js";import"./vendor-radix-BRdei-zg.js";import"./clsx-B-dksMZM.js";import"./utils-BQQgILNW.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-firestore-BML5nJHm.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";import"./avatarData-BW_TX0b4.js";/**
2
- * @license lucide-react v0.487.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 q=[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",ry:"2",key:"76otgf"}],["path",{d:"M9 22v-4h6v4",key:"r93iot"}],["path",{d:"M8 6h.01",key:"1dz90k"}],["path",{d:"M16 6h.01",key:"1x0f13"}],["path",{d:"M12 6h.01",key:"1vi96p"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 10h.01",key:"1m94wz"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M8 14h.01",key:"6423bh"}]],$=u("building",q);/**
7
- * @license lucide-react v0.487.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 G=[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]],X=u("camera",G);/**
12
- * @license lucide-react v0.487.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 Y=[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]],H=u("phone",Y),fe=({isOpen:o,onClose:i,profileData:p,onSave:z})=>{const[s,t]=r.useState(p),[d,x]=r.useState(!1),[C,g]=r.useState(!1),[m,y]=r.useState([]),[v,j]=r.useState(0);r.useEffect(()=>{if(!o)return;const a=n=>{n.key==="Escape"&&i()};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[o,i]),r.useEffect(()=>{if(!o||s.role!=="student"||!s.uid)return;const a=s.uid;(async()=>{g(!0);try{const[h,S]=await Promise.all([A(void 0,!1,"all",5),B(a)]);y(h),j(S)}catch(h){console.error("Failed to load leaderboard for profile modal:",h),y([]),j(0)}finally{g(!1)}})()},[o,s.role,s.uid]);const L=()=>{const a=["https://images.unsplash.com/photo-1633332755192-727a05c4013d?w=200&h=200&fit=crop","https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?w=200&h=200&fit=crop","https://images.unsplash.com/photo-1494790108377-be9c29b29330?w=200&h=200&fit=crop","https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?w=200&h=200&fit=crop","https://images.unsplash.com/photo-1573497019940-1c28c88b4f3e?w=200&h=200&fit=crop"],n=a[Math.floor(Math.random()*a.length)];t({...s,photo:n})},E=()=>{z(s),x(!1)},M=()=>{t(p),x(!1)},I=a=>{switch(a){case"student":return"bg-sky-100 text-sky-700 border-sky-200";case"teacher":return"bg-rose-100 text-rose-700 border-rose-200";case"admin":return"bg-rose-100 text-rose-700 border-rose-200";default:return"bg-zinc-100 text-zinc-700 border-zinc-200"}},N=m.find(a=>a.userId===s.uid);return e.jsx(P,{children:o&&e.jsxs(e.Fragment,{children:[e.jsx(k.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:i,className:"fixed inset-0 bg-black/50 backdrop-blur-sm z-50"}),e.jsx(k.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{type:"spring",duration:.5},className:"fixed inset-0 z-50 flex items-center justify-center p-4",onClick:a=>a.stopPropagation(),children:e.jsxs("div",{className:"bg-[#f7f9fc] rounded-2xl shadow-2xl w-full max-w-3xl max-h-[90vh] overflow-hidden border border-[#dde3eb]",children:[e.jsxs("div",{className:"bg-gradient-to-r from-sky-600 to-sky-500 p-6 relative overflow-hidden",children:[e.jsx("div",{className:"absolute top-0 left-0 right-0 h-px bg-gradient-to-r from-transparent via-white/30 to-transparent"}),e.jsx("div",{className:"absolute top-0 right-0 w-48 h-48 bg-white/10 rounded-full -mr-24 -mt-24"}),e.jsx("div",{className:"absolute bottom-0 left-0 w-36 h-36 bg-white/5 rounded-full -ml-18 -mb-18"}),e.jsxs("div",{className:"relative z-10 flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("h2",{className:"text-xl font-display font-bold text-white mb-1",children:"Profile Settings"}),e.jsx("p",{className:"text-zinc-400 text-sm font-body",children:"Manage your account information"})]}),e.jsx("button",{onClick:i,className:"text-zinc-500 hover:text-sky-700 hover:bg-slate-100 p-2 rounded-lg transition-all",children:e.jsx(D,{size:20})})]})]}),e.jsxs("div",{className:"overflow-y-auto max-h-[calc(90vh-200px)] p-6 scrollbar-thin scrollbar-thumb-[#d1cec6] scrollbar-track-[#edf1f7]",children:[e.jsxs("div",{className:"flex flex-col items-center mb-8",children:[e.jsxs("div",{className:"relative group",children:[e.jsx(R,{layers:s.avatarLayers,className:"w-28 h-28 rounded-xl bg-[#0B1021] shadow-lg border-2 border-[#dde3eb] ring-4 ring-sky-100",fallbackSrc:s.photo}),d&&e.jsx("button",{onClick:L,className:"absolute inset-0 bg-black/60 rounded-xl flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity z-50",children:e.jsxs("div",{className:"text-center text-white",children:[e.jsx(X,{size:32,className:"mx-auto mb-1"}),e.jsx("span",{className:"text-xs font-bold",children:"Change Photo"})]})})]}),e.jsxs("div",{className:"mt-4 text-center",children:[e.jsx("h3",{className:"text-lg font-display font-bold text-[#0a1628]",children:s.name}),e.jsx("span",{className:`inline-block mt-2 px-3 py-1 rounded-full text-xs font-body font-semibold border ${I(s.role)}`,children:s.role.charAt(0).toUpperCase()+s.role.slice(1)})]})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsxs("h4",{className:"text-sm font-display font-bold text-[#0a1628] mb-4 flex items-center gap-2",children:[e.jsx("div",{className:"w-1 h-4 bg-sky-600 rounded-full"}),"Basic Information"]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-[#5a6578] mb-2 uppercase tracking-wider",children:"Full Name"}),e.jsxs("div",{className:"relative",children:[e.jsx(f,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),e.jsx(l,{value:s.name,onChange:a=>t({...s,name:a.target.value}),disabled:!d,className:"pl-10 bg-white border-[#dde3eb] rounded-lg font-body text-[#0a1628] focus:border-sky-400 focus:ring-sky-400/20 disabled:opacity-100 disabled:cursor-default"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-[#5a6578] mb-2 uppercase tracking-wider",children:"Email Address"}),e.jsxs("div",{className:"relative",children:[e.jsx(F,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),e.jsx(l,{type:"email",value:s.email,onChange:a=>t({...s,email:a.target.value}),disabled:!d,className:"pl-10 bg-white border-[#dde3eb] rounded-lg font-body text-[#0a1628] focus:border-sky-400 focus:ring-sky-400/20 disabled:opacity-100 disabled:cursor-default"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-[#5a6578] mb-2 uppercase tracking-wider",children:"Phone Number"}),e.jsxs("div",{className:"relative",children:[e.jsx(H,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),e.jsx(l,{value:s.phone,onChange:a=>t({...s,phone:a.target.value}),disabled:!d,className:"pl-10 bg-white border-[#dde3eb] rounded-lg font-body text-[#0a1628] focus:border-sky-400 focus:ring-sky-400/20 disabled:opacity-100 disabled:cursor-default"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-[#5a6578] mb-2 uppercase tracking-wider",children:s.role==="student"?"School":s.role==="teacher"?"Department":"Office Location"}),e.jsxs("div",{className:"relative",children:[e.jsx($,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),e.jsx(l,{value:s.school||s.department||s.office||"",onChange:a=>{s.role==="student"?t({...s,school:a.target.value}):s.role==="teacher"?t({...s,department:a.target.value}):t({...s,office:a.target.value})},disabled:!d,className:"pl-10 bg-white border-[#dde3eb] rounded-lg font-body text-[#0a1628] focus:border-sky-400 focus:ring-sky-400/20 disabled:opacity-100 disabled:cursor-default"})]})]})]})]}),s.role==="student"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsxs("h4",{className:"text-sm font-bold text-[#0a1628] mb-4 flex items-center gap-2",children:[e.jsx("div",{className:"w-1 h-4 bg-teal-600 rounded-full"}),"Academic Information"]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"md:col-span-2",children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-[#5a6578] mb-2 uppercase tracking-wider",children:"Learner's Reference Number (LRN)"}),e.jsxs("div",{className:"relative",children:[e.jsx(b,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),e.jsx(l,{value:s.lrn||"",onChange:a=>t({...s,lrn:a.target.value}),disabled:!d,className:"pl-10 bg-[#edf1f7] border-[#dde3eb] rounded-xl disabled:opacity-100 disabled:cursor-default"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-[#5a6578] mb-2 uppercase tracking-wider",children:"Grade Level"}),e.jsxs("div",{className:"relative",children:[e.jsx(w,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),e.jsx(l,{value:s.grade||"",onChange:a=>t({...s,grade:a.target.value}),disabled:!d,className:"pl-10 bg-white border-[#dde3eb] rounded-lg font-body text-[#0a1628] focus:border-sky-400 focus:ring-sky-400/20 disabled:opacity-100 disabled:cursor-default"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-[#5a6578] mb-2 uppercase tracking-wider",children:"Section"}),e.jsxs("div",{className:"relative",children:[e.jsx(f,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),e.jsx(l,{value:s.section||"",onChange:a=>t({...s,section:a.target.value}),disabled:!d,className:"pl-10 bg-white border-[#dde3eb] rounded-lg font-body text-[#0a1628] focus:border-sky-400 focus:ring-sky-400/20 disabled:opacity-100 disabled:cursor-default"})]})]})]})]}),e.jsxs("div",{children:[e.jsxs("h4",{className:"text-sm font-bold text-[#0a1628] mb-4 flex items-center gap-2",children:[e.jsx("div",{className:"w-1 h-4 bg-rose-600 rounded-full"}),"Leaderboard Overview"]}),C?e.jsx("div",{className:"rounded-lg border border-[#dde3eb] bg-white p-4 text-sm font-body text-[#5a6578]",children:"Loading leaderboard data..."}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[e.jsxs("div",{className:"rounded-lg border border-rose-200 bg-rose-50 p-3",children:[e.jsx("p",{className:"text-xs font-body font-semibold text-rose-700 uppercase tracking-wider",children:"Your Rank"}),e.jsx("p",{className:"text-2xl font-display font-bold text-rose-800 mt-1",children:v>0?`#${v}`:"Unranked"})]}),e.jsxs("div",{className:"rounded-lg border border-sky-200 bg-sky-50 p-3",children:[e.jsx("p",{className:"text-xs font-body font-semibold text-sky-700 uppercase tracking-wider",children:"Total XP"}),e.jsx("p",{className:"text-2xl font-display font-bold text-sky-800 mt-1",children:N?.xp??0})]}),e.jsxs("div",{className:"rounded-lg border border-emerald-200 bg-emerald-50 p-3",children:[e.jsx("p",{className:"text-xs font-body font-semibold text-emerald-700 uppercase tracking-wider",children:"Level"}),e.jsx("p",{className:"text-2xl font-display font-bold text-emerald-800 mt-1",children:N?.level??"-"})]})]}),e.jsxs("div",{className:"rounded-lg border border-[#dde3eb] bg-white overflow-hidden",children:[e.jsx("div",{className:"px-4 py-2 border-b border-[#dde3eb] bg-[#f7f9fc]",children:e.jsx("p",{className:"text-xs font-body font-semibold text-[#5a6578] uppercase tracking-wider",children:"Top Students"})}),e.jsx("div",{className:"divide-y divide-[#edf1f7]",children:m.length>0?m.map(a=>e.jsxs("div",{className:"px-4 py-3 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("div",{className:"w-7 h-7 rounded-full bg-[#edf1f7] text-[#0a1628] text-xs font-display font-bold flex items-center justify-center",children:a.rank}),e.jsxs("p",{className:"text-sm font-body font-semibold text-[#0a1628] truncate",children:[a.name,a.userId===s.uid?" (You)":""]})]}),e.jsxs("div",{className:"text-right",children:[e.jsxs("p",{className:"text-sm font-body font-semibold text-[#0a1628]",children:[a.xp," XP"]}),e.jsxs("p",{className:"text-xs font-body text-[#5a6578]",children:["Lv ",a.level]})]})]},a.userId)):e.jsx("div",{className:"px-4 py-6 text-center text-sm font-body text-[#5a6578]",children:"No leaderboard data available yet."})})]})]})]})]}),s.role==="teacher"&&e.jsxs("div",{children:[e.jsxs("h4",{className:"text-sm font-display font-bold text-[#0a1628] mb-4 flex items-center gap-2",children:[e.jsx("div",{className:"w-1 h-4 bg-rose-500 rounded-full"}),"Teaching Information"]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-[#5a6578] mb-2 uppercase tracking-wider",children:"Teacher ID"}),e.jsxs("div",{className:"relative",children:[e.jsx(b,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),e.jsx(l,{value:s.teacherId||"",onChange:a=>t({...s,teacherId:a.target.value}),disabled:!d,className:"pl-10 bg-white border-[#dde3eb] rounded-lg font-body text-[#0a1628] focus:border-sky-400 focus:ring-sky-400/20 disabled:opacity-100 disabled:cursor-default"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-[#5a6578] mb-2 uppercase tracking-wider",children:"Subject/Specialization"}),e.jsxs("div",{className:"relative",children:[e.jsx(w,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),e.jsx(l,{value:s.subject||"",onChange:a=>t({...s,subject:a.target.value}),disabled:!d,className:"pl-10 bg-white border-[#dde3eb] rounded-lg font-body text-[#0a1628] focus:border-sky-400 focus:ring-sky-400/20 disabled:opacity-100 disabled:cursor-default"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-[#5a6578] mb-2 uppercase tracking-wider",children:"Years of Experience"}),e.jsxs("div",{className:"relative",children:[e.jsx(U,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),e.jsx(l,{value:s.yearsOfExperience||"",onChange:a=>t({...s,yearsOfExperience:a.target.value}),disabled:!d,className:"pl-10 bg-white border-[#dde3eb] rounded-lg font-body text-[#0a1628] focus:border-sky-400 focus:ring-sky-400/20 disabled:opacity-100 disabled:cursor-default"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-[#5a6578] mb-2 uppercase tracking-wider",children:"Qualification"}),e.jsxs("div",{className:"relative",children:[e.jsx(b,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),e.jsx(l,{value:s.qualification||"",onChange:a=>t({...s,qualification:a.target.value}),disabled:!d,className:"pl-10 bg-white border-[#dde3eb] rounded-lg font-body text-[#0a1628] focus:border-sky-400 focus:ring-sky-400/20 disabled:opacity-100 disabled:cursor-default"})]})]})]})]}),s.role==="admin"&&e.jsxs("div",{children:[e.jsxs("h4",{className:"text-sm font-display font-bold text-[#0a1628] mb-4 flex items-center gap-2",children:[e.jsx("div",{className:"w-1 h-4 bg-rose-600 rounded-full"}),"Administrative Information"]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-[#5a6578] mb-2 uppercase tracking-wider",children:"Admin ID"}),e.jsxs("div",{className:"relative",children:[e.jsx(b,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),e.jsx(l,{value:s.adminId||"",onChange:a=>t({...s,adminId:a.target.value}),disabled:!d,className:"pl-10 bg-white border-[#dde3eb] rounded-lg font-body text-[#0a1628] focus:border-sky-400 focus:ring-sky-400/20 disabled:opacity-100 disabled:cursor-default"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-[#5a6578] mb-2 uppercase tracking-wider",children:"Position/Title"}),e.jsxs("div",{className:"relative",children:[e.jsx(f,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),e.jsx(l,{value:s.position||"",onChange:a=>t({...s,position:a.target.value}),disabled:!d,className:"pl-10 bg-white border-[#dde3eb] rounded-lg font-body text-[#0a1628] focus:border-sky-400 focus:ring-sky-400/20 disabled:opacity-100 disabled:cursor-default"})]})]}),e.jsxs("div",{className:"md:col-span-2",children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-[#5a6578] mb-2 uppercase tracking-wider",children:"Access Level/Permissions"}),e.jsxs("div",{className:"relative",children:[e.jsx(_,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),e.jsx(l,{value:s.permissions||"",onChange:a=>t({...s,permissions:a.target.value}),disabled:!d,className:"pl-10 bg-white border-[#dde3eb] rounded-lg font-body text-[#0a1628] focus:border-sky-400 focus:ring-sky-400/20 disabled:opacity-100 disabled:cursor-default"})]})]})]})]})]})]}),e.jsx("div",{className:"border-t border-[#dde3eb] p-5 bg-[#edf1f7]",children:e.jsx("div",{className:"flex gap-3 justify-end",children:d?e.jsxs(e.Fragment,{children:[e.jsx(c,{onClick:M,variant:"outline",className:"px-5 py-2 rounded-lg border-[#d1cec6] hover:bg-white font-body font-medium text-[#5a6578]",children:"Cancel"}),e.jsxs(c,{onClick:E,className:"px-5 py-2 rounded-lg bg-sky-600 hover:bg-sky-700 text-white font-body font-semibold flex items-center gap-2",children:[e.jsx(T,{size:16}),"Save Changes"]})]}):e.jsxs(e.Fragment,{children:[e.jsx(c,{onClick:i,variant:"outline",className:"px-5 py-2 rounded-lg border-[#d1cec6] hover:bg-white font-body font-medium text-[#5a6578]",children:"Close"}),e.jsx(c,{onClick:()=>x(!0),className:"px-5 py-2 rounded-lg bg-sky-600 hover:bg-sky-700 text-white font-body font-semibold",children:"Edit Profile"})]})})})]})})]})})};export{fe as default};
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/QuizBattlePage-BbGkD7O9.js DELETED
@@ -1,21 +0,0 @@
1
- import{c as Ee,d as Qe,E as ke,G as Pe,H as B,u as Jt,_ as Yt,m as re,I as ht,i as Kt}from"./index-D4nJsLyx.js";import{j as e,r as l}from"./vendor-react-Dexh7fmo.js";import{g as Zt,s as Xt}from"./subjects-DDBtpdiA.js";import{d as ea,b as ta,w as gt,o as Rt,l as Ye,f as Ke,q as Ze,e as Xe}from"./vendor-firebase-firestore-BML5nJHm.js";import{Y as R,Z as Mt,$ as At,a0 as be,a1 as aa}from"./vendor-firebase-core-DQ-pMjxd.js";import{B as I}from"./button-BpeUVhBo.js";import{c as h}from"./utils-BQQgILNW.js";import{c as sa,L as ra,d as oa,e as na,f as da,g as ia,h as ca}from"./vendor-radix-BRdei-zg.js";import{S as ce,a as le,b as ue,c as me,d as P}from"./select-Co4o1EaI.js";import{I as la}from"./input-DBkKXOmF.js";import{S as Me}from"./switch-eyvBOdtY.js";import{S as X,C as yt}from"./skeleton-BUmMbOVs.js";import{S as jt}from"./swords-8_KH18p7.js";import{U as Ae}from"./users-HMf2sdE3.js";import{C as He}from"./chevron-right-COMox1Xb.js";import{T as ua}from"./target-D7SVtf3g.js";import{C as wt}from"./check-BACdUlFL.js";import{L as Ge}from"./loader-circle-J8Mwbkkw.js";import{T as ma}from"./trophy-C2nVcZnb.js";import{S as xa}from"./sparkles-CXUFmaBJ.js";import{S as fa}from"./shield-check-B_yHzqcC.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";import"./trending-up-D-vj8Gbq.js";import"./chart-column-D5mAWcRx.js";import"./clsx-B-dksMZM.js";import"./chevron-up-Bfmq3Clw.js";/**
2
- * @license lucide-react v0.487.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 ba=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16.5 12",key:"1aq6pp"}]],pa=Ee("clock-3",ba);/**
7
- * @license lucide-react v0.487.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 ha=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],ga=Ee("history",ha);/**
12
- * @license lucide-react v0.487.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 ya=[["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"}]],kt=Ee("volume-2",ya);/**
17
- * @license lucide-react v0.487.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 ja=[["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"}]],vt=Ee("volume-x",ja),wa=15e3,ka="mathpulse.quizBattle.local",Nt="".toLowerCase()==="true",_e=typeof window<"u",qe=()=>_e&&!1,tt=()=>{const a=Pe.currentUser?.uid;return a||"local-student"},Tt=a=>`${ka}.${a}`,ve=a=>{const s={stats:pe(a),history:[],queueStatus:"idle"};if(!_e)return s;try{const r=window.localStorage.getItem(Tt(a));if(!r)return s;const c=JSON.parse(r),i=Array.isArray(c.history)?c.history.map(g=>et(g.matchId||"local-match",g)):[];return{stats:c.stats?{...pe(a),...c.stats,userId:a,updatedAt:ze(c.stats.updatedAt)}:pe(a),history:i,queueStatus:c.queueStatus==="queued"||c.queueStatus==="matched"?c.queueStatus:"idle"}}catch(r){return console.error("Error reading local Quiz Battle fallback store:",r),s}},Qt=(a,s)=>{if(_e)try{window.localStorage.setItem(Tt(a),JSON.stringify(s))}catch(r){console.error("Error writing local Quiz Battle fallback store:",r)}},qt=a=>{const s=a||{},r=typeof s.code=="string"?s.code:"";return r?r.startsWith("functions/")?r.replace("functions/",""):r:""},H=a=>{if(!qe())return!1;const s=qt(a);if(["internal","not-found","unavailable","deadline-exceeded"].includes(s))return!0;const r=a||{},c=(typeof r.message=="string"?r.message:a instanceof Error?a.message:"").toLowerCase();return c?c.includes("cors policy")||c.includes("no access-control-allow-origin")||c.includes("failed to fetch")||c.includes("network error")||c.includes("err_failed"):!1},Te=(a,s)=>Math.floor(Math.random()*(s-a+1))+a,va=(a,s)=>{const r=Math.max(3,a),c=s==="easy"?0:s==="medium"?1:s==="hard"?2:1,i=Te(Math.max(0,r-3-c),r),d=Te(Math.max(0,r-4+c),r),g=Math.min(r,Math.max(0,i)),C=Math.min(r,Math.max(0,d)),y=Math.max(0,Math.min(100,g/r*100+Te(-8,6))),S=Te(1800,6200);return{scoreFor:g,scoreAgainst:C,accuracy:y,averageResponseMs:S}},Na=a=>{const s=tt(),r=ve(s),c=`local-bot-${Date.now()}-${Math.random().toString(16).slice(2,8)}`,i=va(a.rounds,a.botDifficulty),d=i.scoreFor>i.scoreAgainst?"win":i.scoreFor<i.scoreAgainst?"loss":"draw",g=new Date,C={matchId:c,mode:"bot",status:"completed",subjectId:a.subjectId,topicId:a.topicId,difficulty:a.botDifficulty,rounds:a.rounds,timePerQuestionSec:a.timePerQuestionSec,scoreFor:i.scoreFor,scoreAgainst:i.scoreAgainst,outcome:d,accuracy:i.accuracy,averageResponseMs:i.averageResponseMs,bestStreak:r.stats.bestStreak,xpEarned:d==="win"?60:d==="draw"?40:20,opponentName:"Practice Bot",opponentType:"bot",createdAt:g,endedAt:g},y=r.stats.matchesPlayed+1,S=r.stats.wins+(d==="win"?1:0),he=r.stats.losses+(d==="loss"?1:0),z=r.stats.draws+(d==="draw"?1:0),b=d==="win"?r.stats.currentStreak+1:0,A=Math.max(r.stats.bestStreak,b),j={...r.stats,matchesPlayed:y,wins:S,losses:he,draws:z,winRate:y>0?S/y*100:0,averageAccuracy:y>0?(r.stats.averageAccuracy*r.stats.matchesPlayed+i.accuracy)/y:i.accuracy,averageResponseMs:y>0?Math.round((r.stats.averageResponseMs*r.stats.matchesPlayed+i.averageResponseMs)/y):i.averageResponseMs,currentStreak:b,bestStreak:A,favoriteTopicId:a.topicId,leaderboardScore:r.stats.leaderboardScore+C.xpEarned,updatedAt:g};return Qt(s,{stats:j,history:[C,...r.history].slice(0,50),queueStatus:"idle"}),{success:!0,matchId:c,status:"ready",botDifficulty:a.botDifficulty}},zt=a=>{const s=tt(),r=ve(s);Qt(s,{...r,queueStatus:a})},Sa=()=>Math.random().toString(36).slice(2,8).toUpperCase(),at=a=>{const s=tt();return{roomId:`local-room-${Date.now()}`,roomCode:a||Sa(),ownerStudentId:s,participantIds:[s],participantCount:1,status:"waiting",subjectId:"gen-math",topicId:"functions",difficulty:"medium",rounds:5,timePerQuestionSec:30,isOwner:!0}},Et=()=>_e&&!!Pe.currentUser?.uid&&!!ke,Pt=(a,s,r)=>`quizBattlePresence/${a}/${s}/${r}`,Ca=async(a,s)=>{if(!Et()||!s.trim()||!ke)return;const r=Pe.currentUser?.uid;if(!r)return;const c=Mt(ke,Pt(a,s,r));try{await At(c,{studentId:r,scope:a,resourceId:s,online:!0,heartbeatAt:be(),updatedAt:be()}),await aa(c).update({online:!1,updatedAt:be(),disconnectedAt:be()})}catch(i){console.warn("Realtime presence connect failed:",i)}},Ia=async(a,s)=>{if(!Et()||!s.trim()||!ke)return;const r=Pe.currentUser?.uid;if(!r)return;const c=Mt(ke,Pt(a,s,r));try{await At(c,{studentId:r,scope:a,resourceId:s,online:!1,updatedAt:be(),disconnectedAt:be()})}catch(i){console.warn("Realtime presence disconnect failed:",i)}},Q=(a,s)=>{const r=`Unable to continue while ${a}. Please try again.`;if(s instanceof Error&&s.message.startsWith("Timed out while"))return s.message;const c=s||{},i=qt(s),d=typeof c.message=="string"?c.message.trim():"";return i==="unauthenticated"?"Your session has expired. Sign in again before starting a battle.":i==="permission-denied"?"Only student accounts can access Quiz Battle matchmaking.":i==="invalid-argument"?d||"Battle setup is invalid. Review the selected options and try again.":i==="already-exists"?d||"This room is already full. Try another room code.":i==="failed-precondition"?d||"Battle state changed. Please refresh and continue.":i==="unavailable"||i==="internal"||i==="not-found"||i==="deadline-exceeded"?/question generation temporarily unavailable/i.test(d)?d:"Quiz Battle service is temporarily unavailable. Please retry in a moment.":r},M=async(a,s,r=wa)=>{let c;try{return await Promise.race([s,new Promise((i,d)=>{c=setTimeout(()=>{d(new Error(`Timed out while ${a}. Please try again.`))},r)})])}finally{c&&clearTimeout(c)}},ze=a=>{if(!a)return new Date;if(a instanceof Date)return a;if(typeof a=="string"){const s=Date.parse(a);return Number.isNaN(s)?new Date:new Date(s)}if(typeof a=="number")return new Date(a);if(typeof a=="object"){const s=a;if(typeof s.toDate=="function")return s.toDate();if(typeof s.seconds=="number")return new Date(s.seconds*1e3)}return new Date},Ba=()=>({mode:"online",subjectId:"gen-math",topicId:"",difficulty:"medium",rounds:5,timePerQuestionSec:30,queueType:"public_matchmaking",botDifficulty:"medium",adaptiveBot:!1}),Ra=a=>{const s=[];return a.subjectId.trim()||s.push({field:"subjectId",message:"Choose a category before starting."}),a.topicId.trim()||s.push({field:"topicId",message:"Choose a strand or topic before starting."}),(a.rounds<3||a.rounds>20)&&s.push({field:"rounds",message:"Questions must be between 3 and 20."}),(a.timePerQuestionSec<10||a.timePerQuestionSec>180)&&s.push({field:"timePerQuestionSec",message:"Timer must be between 10s and 180s."}),a.mode==="bot"&&a.queueType!=="public_matchmaking"&&s.push({field:"queueType",message:"Bot battles use instant start and do not support private room mode."}),s},pe=a=>({userId:a,matchesPlayed:0,wins:0,losses:0,draws:0,winRate:0,averageAccuracy:0,averageResponseMs:0,bestStreak:0,currentStreak:0,favoriteTopicId:void 0,leaderboardScore:0,updatedAt:new Date}),Ma=async a=>{try{const s=ea(Qe,"studentBattleStats",a),r=await ta(s),c=qe()?ve(a).stats:null;if(!r.exists())return c&&c.matchesPlayed>0?c:pe(a);const i=r.data(),d={...pe(a),...i,userId:a,updatedAt:ze(i.updatedAt)};return c&&c.matchesPlayed>d.matchesPlayed?c:d}catch(s){if(console.error("Error loading battle stats:",s),qe()){const r=ve(a).stats;if(r.matchesPlayed>0)return r}return pe(a)}},et=(a,s)=>({matchId:s.matchId||a,mode:s.mode||"online",status:s.status||"completed",subjectId:s.subjectId||"gen-math",topicId:s.topicId||"unknown-topic",difficulty:s.difficulty||"medium",rounds:s.rounds||0,timePerQuestionSec:s.timePerQuestionSec||0,scoreFor:s.scoreFor||0,scoreAgainst:s.scoreAgainst||0,outcome:s.outcome||"draw",accuracy:s.accuracy||0,averageResponseMs:s.averageResponseMs||0,bestStreak:s.bestStreak||0,xpEarned:s.xpEarned||0,opponentName:s.opponentName||"Unknown opponent",opponentType:s.opponentType||"student",createdAt:ze(s.createdAt),endedAt:ze(s.endedAt)}),Aa=async(a,s={})=>{const r=s.limitCount||25,c=qe()?ve(a).history:[],i=g=>g.filter(y=>!(s.mode&&s.mode!=="all"&&y.mode!==s.mode||s.subjectId&&y.subjectId!==s.subjectId||s.startDate&&y.endedAt<s.startDate||s.endDate&&y.endedAt>s.endDate)).sort((y,S)=>S.endedAt.getTime()-y.endedAt.getTime()).slice(0,r),d=g=>{if(c.length===0)return i(g);const C=new Map;return[...c,...g].forEach(y=>{C.set(y.matchId,y)}),i(Array.from(C.values()))};try{const g=[gt("studentId","==",a),Rt("endedAt","desc"),Ye(r)],y=(await Ke(Ze(Xe(Qe,"quizBattleHistory"),...g))).docs.map(S=>et(S.id,S.data()));return d(y)}catch(g){try{const y=(await Ke(Ze(Xe(Qe,"quizBattleHistory"),gt("studentId","==",a),Ye(r)))).docs.map(S=>et(S.id,S.data())).sort((S,he)=>he.endedAt.getTime()-S.endedAt.getTime());return d(y)}catch(C){return console.error("Error loading battle history:",g,C),i(c)}}},Ta=async a=>{const s=R(B,"quizBattleJoinQueue");try{return(await M("joining Quiz Battle matchmaking queue",s({setup:a}))).data}catch(r){if(H(r))return zt("queued"),{success:!0,status:"queued",queueEntryId:`local-queue-${Date.now()}`};throw new Error(Q("joining Quiz Battle matchmaking queue",r))}},Qa=async()=>{const a=R(B,"quizBattleLeaveQueue");try{return(await M("leaving Quiz Battle matchmaking queue",a({}))).data}catch(s){if(H(s))return zt("idle"),{success:!0,status:"idle"};throw new Error(Q("leaving Quiz Battle matchmaking queue",s))}},qa=async a=>{const s=R(B,"quizBattleCreatePrivateRoom");try{return(await M("creating Quiz Battle private room",s({setup:a}))).data}catch(r){if(H(r))return{success:!0,room:at()};throw new Error(Q("creating Quiz Battle private room",r))}},za=async a=>{const s=R(B,"quizBattleJoinPrivateRoom");try{return(await M("joining Quiz Battle private room",s({roomCode:a}),2e4)).data}catch(r){if(H(r))return{success:!0,room:at(a.trim().toUpperCase()||void 0)};throw new Error(Q("joining Quiz Battle private room",r))}},Ea=async a=>{const s=R(B,"quizBattleGetPrivateRoomState");try{return(await M("loading Quiz Battle private room state",s(a),2e4)).data}catch(r){if(H(r))return{success:!0,room:at(a.roomCode?.trim().toUpperCase()||void 0)};throw new Error(Q("loading Quiz Battle private room state",r))}},Pa=async(a={})=>{const s=R(B,"quizBattleLeavePrivateRoom");try{return(await M("leaving Quiz Battle private room",s(a),2e4)).data}catch(r){if(H(r))return{success:!0,status:"idle"};throw new Error(Q("leaving Quiz Battle private room",r))}},St=async()=>{const a=R(B,"quizBattleResumeSession");try{return(await M("resuming Quiz Battle session",a({}),2e4)).data}catch(s){if(H(s))return{success:!0,sessionType:"idle"};throw new Error(Q("resuming Quiz Battle session",s))}},_a=async(a,s)=>{if(!s.trim())return;const r=R(B,"quizBattleHeartbeat");await Ca(a,s);try{await M("sending Quiz Battle heartbeat",r({scope:a,resourceId:s}),12e3)}catch(c){if(!H(c))throw new Error(Q("sending Quiz Battle heartbeat",c))}},Da=async a=>{const s=R(B,"quizBattleCreateBotMatch");try{return(await M("starting Quiz Battle bot match",s({setup:a}))).data}catch(r){if(H(r))return Na(a);throw new Error(Q("starting Quiz Battle bot match",r))}},La=async a=>{const s=R(B,"quizBattleGetGenerationAudit");return(await M("verifying Quiz Battle generation metadata",s({matchId:a}),2e4)).data},W=async a=>{const s=R(B,"quizBattleStartMatch");try{const c=(await M("starting Quiz Battle match",s({matchId:a}),2e4)).data.match;if(c.mode==="online")try{const i=await La(a);if(console.info("[QUIZ_BATTLE_GENERATION_AUDIT]",i),Nt&&!i.isAiSource)throw new Error(`Quiz Battle generation audit failed: expected AI source, got "${i.questionSetSource||"unknown"}".`)}catch(i){if(i instanceof Error&&i.message.startsWith("Quiz Battle generation audit failed"))throw i;if(console.warn("Quiz Battle generation audit unavailable:",i),Nt)throw new Error("Unable to verify Quiz Battle generation metadata. Please retry in a moment.")}return c}catch(r){throw new Error(Q("starting Quiz Battle match",r))}},Je=async a=>{const s=R(B,"quizBattleGetMatchState");try{return(await M("loading Quiz Battle match state",s({matchId:a}),2e4)).data.match}catch(r){throw new Error(Q("loading Quiz Battle match state",r))}},$a=async a=>{const s=R(B,"quizBattleSubmitAnswer");try{return(await M("submitting Quiz Battle answer",s({...a,idempotencyKey:a.idempotencyKey||`client-${Date.now()}-${Math.random().toString(16).slice(2,8)}`}),2e4)).data}catch(r){throw new Error(Q("submitting Quiz Battle answer",r))}},Fa=async a=>{const s=R(B,"quizBattleRequestRematch");try{return(await M("creating Quiz Battle rematch",s({matchId:a}),2e4)).data}catch(r){throw new Error(Q("creating Quiz Battle rematch",r))}},Oa=async(a=20)=>{try{const s=Ze(Xe(Qe,"studentBattleLeaderboard"),Rt("leaderboardScore","desc"),Ye(a));return(await Ke(s)).docs.map((c,i)=>{const d=c.data();return{userId:d.userId||c.id,displayName:d.displayName||"Student",photo:d.photo,rank:d.rank||i+1,leaderboardScore:d.leaderboardScore||0,winRate:d.winRate||0,bestStreak:d.bestStreak||0}})}catch(s){return console.error("Error loading Quiz Battle leaderboard:",s),[]}};function _({className:a,...s}){return e.jsx("div",{"data-slot":"card",className:h("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border",a),...s})}function F({className:a,...s}){return e.jsx("div",{"data-slot":"card-header",className:h("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 pt-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",a),...s})}function O({className:a,...s}){return e.jsx("h4",{"data-slot":"card-title",className:h("leading-none",a),...s})}function V({className:a,...s}){return e.jsx("p",{"data-slot":"card-description",className:h("text-muted-foreground",a),...s})}function ee({className:a,...s}){return e.jsx("div",{"data-slot":"card-content",className:h("px-6 [&:last-child]:pb-6",a),...s})}function Ua({className:a,...s}){return e.jsx(sa,{"data-slot":"tabs",className:h("flex flex-col gap-2",a),...s})}function Wa({className:a,...s}){return e.jsx(ra,{"data-slot":"tabs-list",className:h("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-xl p-[3px] flex",a),...s})}function xe({className:a,...s}){return e.jsx(oa,{"data-slot":"tabs-trigger",className:h("data-[state=active]:bg-card dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-xl border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",a),...s})}function fe({className:a,...s}){return e.jsx(na,{"data-slot":"tabs-content",className:h("flex-1 outline-none",a),...s})}function Va({...a}){return e.jsx(da,{"data-slot":"collapsible",...a})}function Ha({...a}){return e.jsx(ia,{"data-slot":"collapsible-trigger",...a})}function Ga({...a}){return e.jsx(ca,{"data-slot":"collapsible-content",...a})}const D="border border-border bg-card text-card-foreground shadow-sm dark:border-[#2b3140] dark:bg-[#181d27] dark:text-[#f5f7fb] dark:shadow-[0_12px_24px_rgba(0,0,0,0.22)]",Ct=a=>a<=0?"--":`${(a/1e3).toFixed(2)}s`,It=a=>a==="win"?"Win":a==="loss"?"Loss":"Draw",Ja=(a,s,r)=>Math.max(s,Math.min(r,a)),Ya=a=>{const s=Math.floor(a/60),r=a%60;return`${s}:${String(r).padStart(2,"0")}`},Ka=a=>{const s=a.trim().split(/\s+/).filter(Boolean).slice(0,2);return s.length===0?"ST":s.map(r=>r[0]?.toUpperCase()||"").join("")},Bt=(a,s)=>a?a.eventType==="round_started"?`Round ${a.roundNumber} started.`:a.eventType==="answer_locked"?a.lockedByStudentId&&s&&a.lockedByStudentId===s?`Round ${a.roundNumber}: your answer is locked.`:`Round ${a.roundNumber}: opponent answer locked.`:a.eventType==="round_result"?`Round ${a.roundNumber} resolved.`:"Match completed.":null,Cs=()=>{const{userProfile:a,userRole:s}=Jt(),r=a,[c,i]=l.useState("hub"),[d,g]=l.useState(Ba),[C,y]=l.useState([]),[S,he]=l.useState(!1),[z,b]=l.useState({status:"idle"}),[A,j]=l.useState(!1),[m,w]=l.useState(null),[De,ge]=l.useState(""),[Ne,st]=l.useState(null),[rt,oe]=l.useState(0),[G,ot]=l.useState(()=>typeof window>"u"?!0:window.localStorage.getItem("quiz_battle_sound_enabled")!=="0"),[_t,v]=l.useState("connected"),[ne,Dt]=l.useState("all"),[nt,Le]=l.useState(!0),[J,$e]=l.useState(null),[Fe,Oe]=l.useState([]),[Lt,dt]=l.useState(!1),[it,$t]=l.useState([]),[Se,Ft]=l.useState("alias"),[Ue,Ot]=l.useState(!1),[o,k]=l.useState(null),[Ce,L]=l.useState(null),[Y,ye]=l.useState(!1),[E,je]=l.useState(0),[U,$]=l.useState(!1),[Ie,te]=l.useState(null),ct=l.useRef(""),We=l.useRef(null),de=l.useRef(null),K=l.useRef(0),lt=l.useRef(""),we=l.useRef(0),Z=l.useMemo(()=>{const t=Zt(r?.grade);return Xt.filter(n=>t.includes(n.id))},[r?.grade]),Ut=l.useMemo(()=>(Z.find(n=>n.id===d.subjectId)?.modules||[]).map(n=>({value:n.id,label:n.title})),[Z,d.subjectId]),ae=l.useCallback(t=>{if(!G||typeof window>"u")return;const n=window.AudioContext||window.webkitAudioContext;if(n)try{const f=new n,u=f.createOscillator(),p=f.createGain(),x={tick:{frequency:740,duration:.06,type:"triangle",volume:.035},lock:{frequency:520,duration:.08,type:"square",volume:.04},result:{frequency:660,duration:.1,type:"sine",volume:.045},win:{frequency:920,duration:.18,type:"triangle",volume:.05},loss:{frequency:240,duration:.16,type:"sawtooth",volume:.045}}[t],N=f.currentTime;u.type=x.type,u.frequency.setValueAtTime(x.frequency,N),p.gain.setValueAtTime(1e-4,N),p.gain.exponentialRampToValueAtTime(x.volume,N+.015),p.gain.exponentialRampToValueAtTime(1e-4,N+x.duration),u.connect(p),p.connect(f.destination),u.start(N),u.stop(N+x.duration+.02),window.setTimeout(()=>{f.close()},Math.ceil((x.duration+.06)*1e3))}catch(f){console.debug("Battle tone playback skipped:",f)}},[G]),ut=l.useCallback(async t=>{if(!(!t||typeof window>"u"))try{await window.navigator.clipboard.writeText(t),st(t),window.setTimeout(()=>{st(n=>n===t?null:n)},1600)}catch{b({status:"error",message:"Unable to copy room code automatically. Please copy it manually."})}},[]),ie=l.useCallback(async()=>{if(!r?.uid)return null;const[t,n]=await Promise.all([Ma(r.uid),Aa(r.uid,{mode:ne,limitCount:8})]);return{stats:t,history:n}},[ne,r?.uid]);l.useEffect(()=>{if(Z.length===0)return;const n=Z.some(p=>p.id===d.subjectId)?d.subjectId:Z[0].id,f=Z.find(p=>p.id===n),u=f?.modules?.[0]?.id||"";g(p=>{const T=f?.modules?.some(x=>x.id===p.topicId)?p.topicId:u;return p.subjectId===n&&p.topicId===T?p:{...p,subjectId:n,topicId:T}})},[Z,d.subjectId]),l.useEffect(()=>{if(!r?.uid){$e(null),Oe([]),Le(!1);return}let t=!0;return Le(!0),(async()=>{const f=await ie();t&&(f&&($e(f.stats),Oe(f.history)),Le(!1))})(),()=>{t=!1}},[ie,r?.uid]);const Be=l.useMemo(()=>ne==="all"?Fe:Fe.filter(t=>t.mode===ne),[Fe,ne]),mt=l.useMemo(()=>it.map((t,n)=>{const f=t.rank||n+1,u=t.userId===r?.uid,p=`Student-${t.userId.slice(-4).toUpperCase()}`,T=Se==="full"?t.displayName:Se==="initials"?Ka(t.displayName):p,x=Math.floor(t.leaderboardScore/25)*25,N=Ue||u?`${t.leaderboardScore} pts`:`${x}-${x+24} pts`;return{...t,rank:f,isSelf:u,displayName:T,scoreLabel:N}}),[it,Se,Ue,r?.uid]);l.useEffect(()=>{if(c!=="leaderboard")return;let t=!0;return dt(!0),(async()=>{const f=await Oa(20);t&&($t(f),dt(!1))})(),()=>{t=!1}},[c]);const Re=l.useCallback(async()=>{if(r?.uid)try{const t=await St();if(t.sessionType==="match"&&t.match){let n=t.match;if(t.match.mode==="bot"&&t.match.status==="ready")try{n=await W(t.match.matchId),we.current=0}catch(f){const u=f;j(!1),w(null),k(null),i("setup"),v(typeof window<"u"&&window.navigator.onLine?"connected":"disconnected"),b({status:"error",message:u?.message||"Unable to resume bot battle. Please start a new match."});return}j(!1),w(t.room||null),k(n),i("battle"),v("connected");return}if(t.sessionType==="room"&&t.room){j(!1),w(t.room),k(n=>n?.mode==="bot"?n:null),v("connected");return}if(t.sessionType==="queue"){j(!0),w(null),k(n=>n?.mode==="bot"?n:null),v("connected");return}j(!1),w(null),k(n=>n?.mode==="bot"?n:null),v("connected")}catch(t){console.warn("Quiz Battle session resume failed:",t),v("reconnecting")}},[r?.uid]);l.useEffect(()=>{r?.uid&&Re()},[r?.uid,Re]),l.useEffect(()=>{typeof window>"u"||window.localStorage.setItem("quiz_battle_sound_enabled",G?"1":"0")},[G]),l.useEffect(()=>{if(!(A||m&&(m.status==="waiting"||m.status==="ready"))){oe(0);return}const t=window.setInterval(()=>{oe(n=>n+1)},1e3);return()=>{window.clearInterval(t)}},[A,m?.status,m?.roomId]),l.useEffect(()=>{if(typeof window>"u")return;v(window.navigator.onLine?"connected":"disconnected");const t=()=>{v("reconnecting"),Re()},n=()=>{v("disconnected")};return window.addEventListener("online",t),window.addEventListener("offline",n),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",n)}},[Re]),l.useEffect(()=>{const t=o?.mode==="online"&&(o.status==="ready"||o.status==="in_progress"),n=o?.mode==="bot"&&o.status==="ready",f=!!(m&&(m.status==="waiting"||m.status==="ready"));if(n||(we.current=0),!A&&!f&&!t&&!n)return;let u=!1;const p=async()=>{try{if(o?.mode==="bot"&&o.status==="ready"){const x=await W(o.matchId);if(u)return;k(x),v("connected"),we.current=0,x.status==="in_progress"&&b({status:"queued",message:"Practice bot match started."});return}if(o?.mode==="online"){if(o.status==="ready"){const N=await W(o.matchId);if(u)return;k(N),v("connected"),N.status==="in_progress"&&b({status:"queued",message:"Match started. Round timer is live."});return}const x=await Je(o.matchId);if(u)return;k(x),x.status==="completed"&&(j(!1),w(null)),v("connected");return}if(m?.roomId){const x=await Ea({roomId:m.roomId});if(u)return;if(w(x.room),x.match){const N=await W(x.match.matchId);if(u)return;k(N),w(x.room),j(!1),i("battle"),v("connected"),b({status:"queued",message:N.status==="ready"?"Opponent connected. Waiting for synchronized start...":"Private room match started."})}return}if(A){const x=await St();if(u)return;if(x.sessionType==="match"&&x.match){const N=await W(x.match.matchId);if(u)return;k(N),w(x.room||null),j(!1),i("battle"),v("connected"),b({status:"queued",message:"Opponent found. Preparing synchronized start..."});return}if(x.sessionType==="room"&&x.room){j(!1),w(x.room),v("connected");return}v("connected")}}catch(x){if(!u){if(console.warn("Quiz Battle sync poll failed:",x),o?.mode==="bot"&&o.status==="ready"&&(we.current+=1,we.current>=3)){const N=x;j(!1),w(null),k(null),i("setup"),b({status:"error",message:N?.message||"Unable to start bot battle. Please try again."}),v("disconnected");return}v("reconnecting")}}};p();const T=window.setInterval(()=>{p()},3e3);return()=>{u=!0,window.clearInterval(T)}},[o?.matchId,o?.mode,o?.status,m?.roomId,m?.status,A]);const se=l.useMemo(()=>o?.mode==="online"&&(o.status==="ready"||o.status==="in_progress")?{scope:"match",resourceId:o.matchId}:m&&(m.status==="waiting"||m.status==="ready")?{scope:"room",resourceId:m.roomId}:A&&r?.uid?{scope:"queue",resourceId:r.uid}:null,[o,m,A,r?.uid]);l.useEffect(()=>{if(!se)return;let t=!1;const n=async()=>{try{await _a(se.scope,se.resourceId),t||v("connected")}catch(u){t||(console.warn("Quiz Battle heartbeat failed:",u),v("reconnecting"))}};n();const f=window.setInterval(()=>{n()},8e3);return()=>{t=!0,window.clearInterval(f),Ia(se.scope,se.resourceId)}},[se?.scope,se?.resourceId]),l.useEffect(()=>{if(!o||o.status!=="in_progress"){$(!1),de.current=null,K.current=0;return}de.current=null,K.current=0;const t=o.roundDeadlineAtMs?Math.max(0,Math.ceil((o.roundDeadlineAtMs-Date.now())/1e3)):o.timePerQuestionSec;je(t),L(null),$(!1)},[o?.matchId,o?.status,o?.currentRound,o?.timePerQuestionSec]),l.useEffect(()=>{const t=o?.lifecycle;if(!t?.eventType)return;const n=`${t.eventType}:${t.sequence}`;ct.current!==n&&(ct.current=n,t.eventType==="answer_locked"?ae("lock"):t.eventType==="round_result"&&ae("result"))},[o?.lifecycle?.eventType,o?.lifecycle?.sequence,ae]),l.useEffect(()=>{!o||o.status!=="completed"||lt.current!==o.matchId&&(lt.current=o.matchId,ae(o.outcome==="loss"?"loss":"win"),o.outcome==="win"&&Yt(()=>import("./confetti.module-C94ZD2ww.js"),[]).then(t=>{t.default({particleCount:110,spread:78,origin:{y:.62},ticks:160})}).catch(()=>{}))},[o?.matchId,o?.status,o?.outcome,ae]),l.useEffect(()=>{if(!o||o.status!=="in_progress"||U||Y){We.current=null;return}E<=3&&E>0&&We.current!==E&&(We.current=E,ae("tick"))},[o?.status,E,U,Y,ae]);const Ve=l.useCallback(async t=>{if(!o||o.status!=="in_progress"||U)return;ye(!0);const n=window.setTimeout(()=>{ye(!1),b({status:"error",message:"Submission took too long. Syncing latest match state now..."}),Je(o.matchId).then(f=>{k(f),f.status==="completed"&&(j(!1),w(null))}).catch(()=>{})},12e3);try{const f=o.roundDeadlineAtMs?Ja(o.timePerQuestionSec*1e3-Math.max(0,o.roundDeadlineAtMs-Date.now()),0,o.timePerQuestionSec*1e3):Math.max(0,(o.timePerQuestionSec-E)*1e3),u=await $a({matchId:o.matchId,roundNumber:o.currentRound,selectedOptionIndex:t,responseMs:f});de.current=null,K.current=0,k(u.match),te(u.roundResult),L(null),u.match.mode==="online"&&u.match.status==="in_progress"&&!u.roundResult&&($(!0),b({status:"queued",message:"Answer locked. Waiting for opponent to finish the round..."})),u.match.status==="completed"&&(j(!1),w(null),ie(),b({status:"queued",message:u.completion?`Match finished (${u.completion.outcome.toUpperCase()}) +${u.completion.xpEarned} XP`:"Match finished. Results saved."}))}catch(f){const p=f?.message||"Unable to submit answer right now. Please try again.";if(t===null||p.includes("Round timer elapsed")||p.includes("Expected round")||p.includes("Match is not currently active"))try{const x=await Je(o.matchId),N=x.currentRound!==o.currentRound;if(k(x),L(null),$(!1),N||x.status==="completed"?(de.current=null,K.current=0):t===null&&(K.current=Date.now()+3e3),x.status==="completed"){j(!1),w(null),ie(),b({status:"queued",message:"Match finished. Results synchronized."});return}b({status:"queued",message:"Round timed out. Synced to the latest battle state."});return}catch{}t===null&&(K.current=Date.now()+3e3),b({status:"error",message:p})}finally{window.clearTimeout(n),ye(!1)}},[o,ie,U,E]);l.useEffect(()=>{if(!o||o.status!=="in_progress"||Y||U)return;const t=o.roundDeadlineAtMs?Math.max(0,Math.ceil((o.roundDeadlineAtMs-Date.now())/1e3)):E;if(o.roundDeadlineAtMs&&t!==E&&je(t),Ce===null?t<=1:t<=0){if(de.current===o.currentRound&&Date.now()<K.current)return;de.current=o.currentRound,K.current=Date.now()+3e3,Ve(null);return}const f=window.setTimeout(()=>{o.roundDeadlineAtMs?je(Math.max(0,Math.ceil((o.roundDeadlineAtMs-Date.now())/1e3))):je(u=>Math.max(0,u-1))},1e3);return()=>{window.clearTimeout(f)}},[o,Y,U,E,Ce,Ve]);const Wt=l.useCallback(async()=>{if(!(!o||o.mode!=="bot")){ye(!0),b({status:"validating"});try{const t=await Fa(o.matchId),n=await W(t.matchId);k(n),w(null),j(!1),te(null),L(null),$(!1),i("battle"),b({status:"queued",message:`Rematch ready (${t.botDifficulty}). Good luck!`})}catch(t){b({status:"error",message:t?.message||"Unable to start rematch right now."})}finally{ye(!1)}}},[o]);if(s!=="student")return e.jsx("div",{className:"px-4 sm:px-6 xl:px-10 py-6 sm:py-8",children:e.jsx(_,{className:h(D,"max-w-2xl"),children:e.jsxs(F,{children:[e.jsx(O,{children:"Quiz Battle is student-only"}),e.jsx(V,{className:"text-muted-foreground dark:text-[#aab3c7]",children:"Your account role does not have access to this module."})]})})});const xt=t=>{y([]),b({status:"idle"}),j(!1),w(null),ge(""),k(null),te(null),L(null),$(!1),g(n=>({...n,mode:t,queueType:t==="online"?n.queueType:"public_matchmaking"})),oe(0),i("setup")},ft=t=>{y([]),b({status:"idle"}),j(!1),w(null),ge(""),k(null),te(null),L(null),$(!1),oe(0),g(n=>({...n,mode:t,queueType:t==="online"?n.queueType:"public_matchmaking"}))},bt=async()=>{b({status:"validating"});try{m?.roomId?await Pa({roomId:m.roomId}):await Qa(),j(!1),w(null),k(t=>!t||t.mode!=="online"?t:t.status==="ready"||t.status==="cancelled"?null:t),ge(""),oe(0),b({status:"queued",message:m?.roomId?"Private room cancelled.":"Left matchmaking queue."})}catch(t){b({status:"error",message:t?.message||"Unable to cancel this online session right now. Please try again."})}},Vt=async()=>{b({status:"validating"});const t=Ra(d);if(t.length>0){y(t),b({status:"error",message:"Fix the highlighted setup fields before starting."});return}y([]);try{if(d.mode==="online"){if(d.queueType==="private_room"){const p=De.trim().toUpperCase(),T=p?await za(p):await qa(d);if(j(!1),w(T.room),ge(""),T.match){const x=await W(T.match.matchId);k(x),te(null),L(null),$(!1),i("battle"),b({status:"queued",message:x.status==="ready"?`Room ${T.room.roomCode} linked. Waiting for synchronized start...`:"Private room match started."});return}k(null),b({status:"queued",message:p?"Joined private room. Waiting for opponent...":"Private room created. Share code:"});return}const u=await Ta(d);if(u.status==="matched"&&u.matchId){const p=await W(u.matchId);j(!1),w(null),k(p),te(null),L(null),$(!1),i("battle"),b({status:"queued",message:"Opponent found. Preparing synchronized start..."});return}j(!0),w(null),k(null),oe(0),b({status:"queued",message:"Joined matchmaking queue. Waiting for an opponent..."});return}const n=await Da(d),f=await W(n.matchId);j(!1),w(null),k(f),te(null),L(null),$(!1),je(f.timePerQuestionSec),i("battle"),b({status:"queued",message:`Bot match ${n.matchId.slice(0,8)} live (${n.botDifficulty}).`}),ie().then(u=>{u&&($e(u.stats),Oe(u.history))})}catch(n){j(!1),b({status:"error",message:n?.message||"Unable to start battle. Please try again."})}},q=t=>C.find(n=>n.field===t)?.message,Ht=J?.winRate??0,pt=!!(d.mode==="online"&&m&&(m.status==="waiting"||m.status==="ready")&&(!o||o.status!=="completed")),Gt=!!(A||m&&(m.status==="waiting"||m.status==="ready")&&(!o||o.status==="ready"||o.status==="cancelled"));return e.jsx("div",{className:"h-full flex flex-col px-4 sm:px-6 xl:px-10 py-6 sm:py-8",children:e.jsxs(re.div,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{duration:.24,ease:[.22,1,.36,1]},className:"space-y-6",children:[e.jsxs(_,{className:h(D,"relative overflow-hidden rounded-[20px]"),children:[e.jsx("div",{className:"pointer-events-none absolute inset-0 bg-gradient-to-br from-primary/8 via-primary/4 to-transparent dark:bg-[radial-gradient(circle_at_15%_15%,rgba(140,125,255,0.28),transparent_45%),radial-gradient(circle_at_85%_20%,rgba(121,79,255,0.17),transparent_40%)]"}),e.jsxs(F,{className:"relative z-10 pb-4",children:[e.jsxs(O,{className:"flex items-center gap-2 text-2xl font-black tracking-tight text-foreground dark:text-[#f5f7fb]",children:[e.jsx(jt,{className:"h-5 w-5 text-primary dark:text-[#9e8fff]"}),"Quiz Battle"]}),e.jsx(V,{className:"text-muted-foreground dark:text-[#c4cce0]",children:"Timed student duels with synchronized rounds, instant feedback, and progression rewards."}),e.jsxs("p",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground dark:text-[#9ea8c2]",children:["Connection: ",_t]})]}),e.jsxs(ee,{className:"relative z-10 grid grid-cols-2 md:grid-cols-4 gap-3 pb-6",children:[e.jsxs("div",{className:"rounded-2xl border border-border bg-muted/50 p-3 dark:border-[#30374a] dark:bg-[#11151d]",children:[e.jsx("p",{className:"text-xs text-muted-foreground dark:text-[#9da7bf]",children:"Win Rate"}),e.jsxs("p",{className:"tabular-nums text-lg font-bold text-foreground dark:text-[#f5f7fb]",children:[Ht.toFixed(1),"%"]})]}),e.jsxs("div",{className:"rounded-2xl border border-border bg-muted/50 p-3 dark:border-[#30374a] dark:bg-[#11151d]",children:[e.jsx("p",{className:"text-xs text-muted-foreground dark:text-[#9da7bf]",children:"Matches"}),e.jsx("p",{className:"tabular-nums text-lg font-bold text-foreground dark:text-[#f5f7fb]",children:J?.matchesPlayed||0})]}),e.jsxs("div",{className:"rounded-2xl border border-border bg-muted/50 p-3 dark:border-[#30374a] dark:bg-[#11151d]",children:[e.jsx("p",{className:"text-xs text-muted-foreground dark:text-[#9da7bf]",children:"Best Streak"}),e.jsx("p",{className:"tabular-nums text-lg font-bold text-foreground dark:text-[#f5f7fb]",children:J?.bestStreak||0})]}),e.jsxs("div",{className:"rounded-2xl border border-border bg-muted/50 p-3 dark:border-[#30374a] dark:bg-[#11151d]",children:[e.jsx("p",{className:"text-xs text-muted-foreground dark:text-[#9da7bf]",children:"Avg Response"}),e.jsx("p",{className:"tabular-nums text-lg font-bold text-foreground dark:text-[#f5f7fb]",children:Ct(J?.averageResponseMs||0)})]})]})]}),e.jsxs(Ua,{value:c,onValueChange:t=>i(t),children:[e.jsxs(Wa,{className:"w-full md:w-auto rounded-2xl p-1.5",children:[e.jsx(xe,{value:"hub",className:"rounded-xl",children:"Hub"}),e.jsx(xe,{value:"setup",className:"rounded-xl",children:"Setup"}),e.jsx(xe,{value:"battle",className:"rounded-xl",children:"Battle"}),e.jsx(xe,{value:"history",className:"rounded-xl",children:"History"}),e.jsx(xe,{value:"stats",className:"rounded-xl",children:"My Stats"}),e.jsx(xe,{value:"leaderboard",className:"rounded-xl",children:"Leaderboard"})]}),e.jsx(fe,{value:"hub",className:"mt-5",children:e.jsxs(re.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},exit:{opacity:0,y:-12},className:"space-y-5",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("button",{type:"button",onClick:()=>xt("online"),className:"text-left rounded-[18px] border border-border bg-card p-5 transition-colors hover:border-primary/60 hover:bg-accent/40 dark:border-[#333a4e] dark:bg-[#171d2a] dark:hover:border-[#8c7dff] dark:hover:bg-[#202736]",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2 text-foreground dark:text-[#f5f7fb] font-semibold",children:[e.jsx(Ae,{className:"h-4 w-4 text-primary dark:text-[#9e8fff]"}),"1v1 Online"]}),e.jsx(He,{className:"h-4 w-4 text-muted-foreground dark:text-[#a2abc2]"})]}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground dark:text-[#b3bdd5]",children:"Queue or room-code match with another student."})]}),e.jsxs("button",{type:"button",onClick:()=>xt("bot"),className:"text-left rounded-[18px] border border-border bg-card p-5 transition-colors hover:border-primary/60 hover:bg-accent/40 dark:border-[#333a4e] dark:bg-[#171d2a] dark:hover:border-[#8c7dff] dark:hover:bg-[#202736]",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2 text-foreground dark:text-[#f5f7fb] font-semibold",children:[e.jsx(ht,{className:"h-4 w-4 text-primary dark:text-[#9e8fff]"}),"1v1 vs Bot"]}),e.jsx(He,{className:"h-4 w-4 text-muted-foreground dark:text-[#a2abc2]"})]}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground dark:text-[#b3bdd5]",children:"Instant solo duel with selectable bot difficulty."})]})]}),e.jsxs(_,{className:h(D,"rounded-[18px]"),children:[e.jsx(F,{children:e.jsxs(O,{className:"text-base flex items-center gap-2",children:[e.jsx(ga,{className:"h-4 w-4 text-primary dark:text-[#9e8fff]"})," Recent Matches"]})}),e.jsx(ee,{className:"space-y-2",children:nt?e.jsxs("div",{className:"space-y-2",children:[e.jsx(X,{className:"h-12 w-full rounded-xl bg-muted dark:bg-[#2a3143]"}),e.jsx(X,{className:"h-12 w-full rounded-xl bg-muted dark:bg-[#2a3143]"}),e.jsx(X,{className:"h-12 w-full rounded-xl bg-muted dark:bg-[#2a3143]"})]}):Be.length===0?e.jsx("p",{className:"text-sm text-muted-foreground dark:text-[#a8b2c9]",children:"No battle history yet. Start your first duel."}):Be.slice(0,5).map(t=>e.jsxs("div",{className:"rounded-xl border border-border bg-muted/40 px-3 py-2 flex items-center justify-between dark:border-[#2f3547] dark:bg-[#11151d]",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"text-sm font-semibold text-foreground dark:text-[#f5f7fb]",children:["vs ",t.opponentName]}),e.jsxs("p",{className:"text-xs text-muted-foreground dark:text-[#95a0bb]",children:[t.subjectId," ยท ",t.difficulty]})]}),e.jsxs("div",{className:"text-right",children:[e.jsxs("p",{className:"tabular-nums text-sm font-semibold text-foreground dark:text-[#f5f7fb]",children:[t.scoreFor," - ",t.scoreAgainst]}),e.jsx("p",{className:h("inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium",t.outcome==="win"?"bg-emerald-100 text-emerald-800 dark:bg-emerald-500/15 dark:text-emerald-300":t.outcome==="loss"?"bg-rose-100 text-rose-800 dark:bg-rose-500/15 dark:text-rose-300":"bg-amber-100 text-amber-800 dark:bg-amber-500/15 dark:text-amber-300"),children:It(t.outcome)})]})]},t.matchId))})]})]},"hub")}),e.jsx(fe,{value:"setup",className:"mt-5",children:e.jsx(re.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},exit:{opacity:0,y:-12},className:"space-y-4",children:e.jsxs(_,{className:h(D,"rounded-[18px]"),children:[e.jsxs(F,{children:[e.jsxs(O,{className:"text-base flex items-center gap-2",children:[e.jsx(ua,{className:"h-4 w-4 text-primary dark:text-[#9e8fff]"})," Battle Setup"]}),e.jsx(V,{className:"text-muted-foreground dark:text-[#b2bad0]",children:"Configure a student-safe match and start quickly."})]}),e.jsxs(ee,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-xs font-semibold text-foreground dark:text-[#c7cfe3]",children:"Mode"}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(I,{type:"button",variant:d.mode==="online"?"default":"outline",onClick:()=>ft("online"),className:"h-10 rounded-xl",children:"1v1 Online"}),e.jsx(I,{type:"button",variant:d.mode==="bot"?"default":"outline",onClick:()=>ft("bot"),className:"h-10 rounded-xl",children:"1v1 vs Bot"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-xs font-semibold text-foreground dark:text-[#c7cfe3]",children:"Category"}),e.jsxs(ce,{value:d.subjectId,onValueChange:t=>g(n=>({...n,subjectId:t})),children:[e.jsx(le,{className:h("rounded-xl",q("subjectId")&&"border-rose-400"),children:e.jsx(ue,{placeholder:"Select category"})}),e.jsx(me,{children:Z.map(t=>e.jsx(P,{value:t.id,children:t.title},t.id))})]}),q("subjectId")&&e.jsx("p",{className:"text-xs text-destructive dark:text-rose-300",children:q("subjectId")})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-xs font-semibold text-foreground dark:text-[#c7cfe3]",children:"Strand / Topic Group"}),e.jsxs(ce,{value:d.topicId,onValueChange:t=>g(n=>({...n,topicId:t})),children:[e.jsx(le,{className:h("rounded-xl",q("topicId")&&"border-rose-400"),children:e.jsx(ue,{placeholder:"Select topic group"})}),e.jsx(me,{children:Ut.map(t=>e.jsx(P,{value:t.value,children:t.label},t.value))})]}),q("topicId")&&e.jsx("p",{className:"text-xs text-destructive dark:text-rose-300",children:q("topicId")})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-xs font-semibold text-foreground dark:text-[#c7cfe3]",children:"Difficulty"}),e.jsxs(ce,{value:d.mode==="bot"?d.botDifficulty:d.difficulty,onValueChange:t=>g(n=>n.mode==="bot"?{...n,botDifficulty:t}:{...n,difficulty:t}),children:[e.jsx(le,{className:"rounded-xl",children:e.jsx(ue,{})}),e.jsxs(me,{children:[e.jsx(P,{value:"easy",children:"Easy"}),e.jsx(P,{value:"medium",children:"Medium"}),e.jsx(P,{value:"hard",children:"Hard"}),d.mode==="bot"&&e.jsx(P,{value:"adaptive",children:"Adaptive"})]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-xs font-semibold text-foreground dark:text-[#c7cfe3]",children:"Number of Questions"}),e.jsxs(ce,{value:String(d.rounds),onValueChange:t=>g(n=>({...n,rounds:Number(t)})),children:[e.jsx(le,{className:h("rounded-xl",q("rounds")&&"border-rose-400"),children:e.jsx(ue,{})}),e.jsx(me,{children:[3,5,7,10,12,15].map(t=>e.jsx(P,{value:String(t),children:t},t))})]}),q("rounds")&&e.jsx("p",{className:"text-xs text-destructive dark:text-rose-300",children:q("rounds")})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-xs font-semibold text-foreground dark:text-[#c7cfe3]",children:"Time per Question"}),e.jsxs(ce,{value:String(d.timePerQuestionSec),onValueChange:t=>g(n=>({...n,timePerQuestionSec:Number(t)})),children:[e.jsx(le,{className:h("rounded-xl",q("timePerQuestionSec")&&"border-rose-400"),children:e.jsx(ue,{})}),e.jsx(me,{children:[15,20,30,45,60,90].map(t=>e.jsxs(P,{value:String(t),children:[t," sec"]},t))})]}),q("timePerQuestionSec")&&e.jsx("p",{className:"text-xs text-destructive dark:text-rose-300",children:q("timePerQuestionSec")})]})]}),e.jsxs(Va,{open:S,onOpenChange:he,children:[e.jsx(Ha,{asChild:!0,children:e.jsxs(I,{type:"button",variant:"outline",className:"w-full justify-between rounded-xl",children:["Advanced settings",e.jsx(He,{className:h("h-4 w-4 transition-transform",S&&"rotate-90")})]})}),e.jsxs(Ga,{className:"mt-3 rounded-xl border border-border bg-muted/40 p-3 space-y-3 dark:border-[#2e364a] dark:bg-[#11151d]",children:[d.mode==="online"?e.jsxs("div",{className:"space-y-3",children:[e.jsx("label",{className:"text-xs font-semibold text-foreground dark:text-[#c7cfe3]",children:"Online Match Type"}),e.jsx("div",{className:"grid grid-cols-2 gap-2",children:[{value:"public_matchmaking",label:"Public Queue"},{value:"private_room",label:"Private Room"}].map(t=>e.jsx(I,{type:"button",variant:d.queueType===t.value?"default":"outline",className:"rounded-xl h-9",onClick:()=>g(n=>({...n,queueType:t.value})),children:t.label},t.value))}),d.queueType==="private_room"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-xs font-semibold text-foreground dark:text-[#c7cfe3]",children:"Room Code (optional)"}),e.jsx(la,{value:De,onChange:t=>ge(t.target.value.toUpperCase().replace(/[^A-Z0-9]/g,"").slice(0,6)),placeholder:"Leave blank to create a room",className:"rounded-xl uppercase tracking-[0.15em]",maxLength:6}),e.jsx("div",{className:"rounded-xl border border-amber-300 bg-amber-50 px-3 py-2.5 text-[13px] font-semibold text-amber-900 dark:border-amber-500/40 dark:bg-amber-500/10 dark:text-amber-200",children:"Enter a room code to join an existing battle, or leave it blank to create a new room and share your code."})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"flex items-center justify-between rounded-xl border border-border bg-card p-3 dark:border-[#2f3547] dark:bg-[#171d2a]",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-semibold text-foreground dark:text-[#ecf0fb]",children:"Adaptive Bot"}),e.jsx("p",{className:"text-xs text-muted-foreground dark:text-[#a9b3ca]",children:"Tune response timing and accuracy to your recent trend."})]}),e.jsx(Me,{checked:d.adaptiveBot,onCheckedChange:t=>g(n=>({...n,adaptiveBot:t,botDifficulty:t?"adaptive":n.botDifficulty==="adaptive"?"medium":n.botDifficulty}))})]}),e.jsxs("label",{className:"flex items-center justify-between rounded-xl border border-border bg-card p-3 dark:border-[#2f3547] dark:bg-[#171d2a]",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[G?e.jsx(kt,{className:"h-4 w-4 text-primary dark:text-[#9e8fff]"}):e.jsx(vt,{className:"h-4 w-4 text-muted-foreground"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-semibold text-foreground dark:text-[#ecf0fb]",children:"Battle Sounds"}),e.jsx("p",{className:"text-xs text-muted-foreground dark:text-[#a9b3ca]",children:"Play audio cues for countdowns and results."})]})]}),e.jsx(Me,{checked:G,onCheckedChange:ot})]})]}),d.mode==="online"&&e.jsxs("label",{className:"flex items-center justify-between rounded-xl border border-border bg-card p-3 dark:border-[#2f3547] dark:bg-[#171d2a]",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[G?e.jsx(kt,{className:"h-4 w-4 text-primary dark:text-[#9e8fff]"}):e.jsx(vt,{className:"h-4 w-4 text-muted-foreground"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-semibold text-foreground dark:text-[#ecf0fb]",children:"Battle Sounds"}),e.jsx("p",{className:"text-xs text-muted-foreground dark:text-[#a9b3ca]",children:"Play audio cues for countdowns and results."})]})]}),e.jsx(Me,{checked:G,onCheckedChange:ot})]})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 sm:items-center sm:justify-between",children:[e.jsxs("div",{"aria-live":"polite",className:"min-h-[24px] text-sm text-muted-foreground dark:text-[#b6bfd5]",children:[z.status==="queued"&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[z.message,d.mode==="online"&&d.queueType==="private_room"&&m?.roomCode&&e.jsxs(I,{type:"button",variant:"outline",className:h("h-7 rounded-full border-amber-300/70 bg-amber-100/80 px-3 text-[11px] font-black uppercase tracking-[0.16em] text-amber-900 hover:bg-amber-200 dark:border-amber-500/50 dark:bg-amber-500/15 dark:text-amber-200 dark:hover:bg-amber-500/25",Ne===m.roomCode?"border-emerald-400/80 bg-emerald-100 text-emerald-900 dark:border-emerald-400/70 dark:bg-emerald-500/20 dark:text-emerald-200":null),onClick:()=>void ut(m.roomCode),"aria-label":`Copy room code ${m.roomCode}`,children:[Ne===m.roomCode?e.jsx(wt,{className:"h-3.5 w-3.5"}):e.jsx(yt,{className:"h-3.5 w-3.5"}),m.roomCode]}),(A||pt)&&rt>0&&e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-md bg-primary/10 px-2 py-0.5 text-xs font-semibold text-primary dark:bg-[#8c7dff]/20 dark:text-[#c7c0ff]",children:["Waiting ",Ya(rt)]})]}),z.status==="error"&&e.jsx("span",{className:"text-destructive dark:text-rose-300",children:z.message}),z.status==="validating"&&e.jsxs("span",{className:"inline-flex items-center gap-2 text-foreground dark:text-[#d5dcf0]",children:[e.jsx(Ge,{className:"h-4 w-4 animate-spin"})," Validating setup..."]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[Gt&&e.jsx(I,{type:"button",variant:"outline",onClick:bt,disabled:z.status==="validating",className:"rounded-xl",children:m?"Cancel room":"Leave queue"}),e.jsx(I,{type:"button",onClick:Vt,disabled:z.status==="validating"||A||pt,className:"rounded-xl",children:z.status==="validating"?e.jsxs("span",{className:"inline-flex items-center gap-2",children:[e.jsx(Ge,{className:"h-4 w-4 animate-spin"})," Starting..."]}):d.mode==="online"&&d.queueType==="private_room"?De.trim()?"Join room":"Create room":"Start battle"})]})]})]})]})},"setup")}),e.jsx(fe,{value:"battle",className:"mt-5",children:e.jsx(re.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},exit:{opacity:0,y:-12},className:"space-y-4",children:o?e.jsxs(_,{className:h(D,"rounded-[18px]"),children:[e.jsxs(F,{children:[e.jsxs(O,{className:"text-base flex items-center justify-between gap-3",children:[e.jsxs("span",{className:"inline-flex items-center gap-2",children:[o.mode==="bot"?e.jsx(ht,{className:"h-4 w-4 text-primary dark:text-[#9e8fff]"}):e.jsx(Ae,{className:"h-4 w-4 text-primary dark:text-[#9e8fff]"}),"vs ",o.opponentName]}),e.jsxs("span",{className:"text-sm font-bold tabular-nums",children:[o.scoreFor," - ",o.scoreAgainst]})]}),e.jsx(V,{className:"text-muted-foreground dark:text-[#b2bad0]",children:o.status==="completed"?`Completed in ${o.totalRounds} rounds.`:o.status==="ready"?o.mode==="online"?"Waiting for both players to confirm and start together.":"Finalizing practice bot session start.":`Round ${o.currentRound} of ${o.totalRounds}`}),Bt(o.lifecycle,r?.uid)&&e.jsx("p",{className:"text-xs font-medium text-muted-foreground dark:text-[#9aa4be]",children:Bt(o.lifecycle,r?.uid)})]}),e.jsxs(ee,{className:"space-y-4",children:[o.status==="ready"&&e.jsx("div",{className:"rounded-xl border border-border bg-muted/30 p-3 dark:border-[#2f3547] dark:bg-[#11151d]",children:e.jsx("p",{className:"text-sm font-semibold text-foreground dark:text-[#ecf0fb]",children:o.mode==="online"?"Waiting for both players to lock in start...":"Starting practice bot round..."})}),o.status==="in_progress"&&o.currentQuestion&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"rounded-xl border border-border bg-muted/40 p-3 dark:border-[#2f3547] dark:bg-[#11151d]",children:[e.jsxs("p",{className:"text-xs text-muted-foreground dark:text-[#9aa4be]",children:["Time left: ",e.jsxs("span",{className:"font-semibold tabular-nums",children:[E,"s"]})]}),e.jsx("p",{className:"mt-2 text-sm font-semibold text-foreground dark:text-[#ecf0fb]",children:o.currentQuestion.prompt})]}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:o.currentQuestion.choices.map((t,n)=>e.jsxs(I,{type:"button",variant:Ce===n?"default":"outline",onClick:()=>L(n),disabled:Y||U,className:"h-auto min-h-11 rounded-xl justify-start text-left whitespace-normal",children:[e.jsxs("span",{className:"mr-2 font-semibold",children:[String.fromCharCode(65+n),"."]}),t]},`${o.currentQuestion?.questionId}-${n}`))}),e.jsx("div",{className:"flex justify-end",children:e.jsx(I,{type:"button",onClick:()=>void Ve(Ce),disabled:Y||U,className:"rounded-xl",children:Y?e.jsxs("span",{className:"inline-flex items-center gap-2",children:[e.jsx(Ge,{className:"h-4 w-4 animate-spin"})," Submitting..."]}):U?"Waiting for opponent...":"Lock Answer"})})]}),Ie&&e.jsxs("div",{className:"rounded-xl border border-border bg-muted/30 p-3 dark:border-[#2f3547] dark:bg-[#11151d]",children:[e.jsxs("p",{className:"text-sm font-semibold text-foreground dark:text-[#ecf0fb]",children:["Last round: ",Ie.studentCorrect?"Correct":"Incorrect"," ยท ",o.mode==="bot"?"Bot":"Opponent"," ",Ie.botCorrect?"Correct":"Incorrect"]}),e.jsxs("p",{className:"text-xs text-muted-foreground dark:text-[#9aa4be]",children:["Correct option: ",String.fromCharCode(65+Ie.correctOptionIndex)]})]}),o.status==="completed"&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:h("rounded-2xl border p-4",o.outcome==="win"?"border-emerald-300 bg-emerald-50 dark:border-emerald-400/40 dark:bg-emerald-900/20":o.outcome==="loss"?"border-rose-300 bg-rose-50 dark:border-rose-400/40 dark:bg-rose-900/20":"border-amber-300 bg-amber-50 dark:border-amber-400/40 dark:bg-amber-900/20"),children:[e.jsx("p",{className:"text-lg font-black tracking-wide text-foreground dark:text-[#ecf0fb]",children:o.outcome==="win"?"Victory!":o.outcome==="loss"?"Match Complete":"Draw Match"}),e.jsxs("p",{className:"mt-1 text-sm font-semibold text-foreground dark:text-[#ecf0fb]",children:["Final Score: ",o.scoreFor," - ",o.scoreAgainst]}),e.jsxs("p",{className:"text-xs text-muted-foreground dark:text-[#9aa4be]",children:["XP Earned: +",o.xpEarned||0]})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx(I,{type:"button",variant:"outline",onClick:()=>{w(null),j(!1),i("setup")},className:"rounded-xl",children:"Start New Match"}),o.mode==="bot"&&e.jsx(I,{type:"button",onClick:()=>void Wt(),disabled:Y,className:"rounded-xl",children:"Rematch"})]})]})]})]}):m?e.jsxs(_,{className:h(D,"rounded-[18px]"),children:[e.jsxs(F,{children:[e.jsxs(O,{className:"text-base flex items-center gap-2",children:[e.jsx(Ae,{className:"h-4 w-4 text-primary dark:text-[#9e8fff]"}),"Private Room Lobby"]}),e.jsxs(V,{className:"text-muted-foreground dark:text-[#b2bad0]",children:["Room ",m.roomCode," ยท ",m.participantCount,"/2 students connected."]})]}),e.jsx(ee,{className:"space-y-3",children:e.jsxs("div",{className:"rounded-xl border border-border bg-muted/30 p-3 dark:border-[#2f3547] dark:bg-[#11151d]",children:[e.jsx("p",{className:"text-sm font-semibold text-foreground dark:text-[#ecf0fb]",children:m.status==="ready"?"Opponent connected. Syncing start...":"Waiting for another student to join this room."}),e.jsxs("p",{className:"text-xs text-muted-foreground dark:text-[#9aa4be]",children:["Share room code ",m.roomCode," with your classmate."]}),e.jsxs("div",{className:"mt-3 flex flex-wrap items-center justify-end gap-2",children:[(m.status==="waiting"||m.status==="ready")&&e.jsx(I,{type:"button",variant:"outline",className:"h-8 rounded-lg",onClick:bt,disabled:z.status==="validating",children:"Cancel room"}),e.jsxs(I,{type:"button",variant:"outline",className:"h-8 rounded-lg",onClick:()=>void ut(m.roomCode),children:[Ne===m.roomCode?e.jsx(wt,{className:"h-4 w-4"}):e.jsx(yt,{className:"h-4 w-4"}),Ne===m.roomCode?"Copied":"Copy code"]})]})]})})]}):A?e.jsx(_,{className:h(D,"rounded-[18px]"),children:e.jsxs(F,{children:[e.jsxs(O,{className:"text-base flex items-center gap-2",children:[e.jsx(Ae,{className:"h-4 w-4 text-primary dark:text-[#9e8fff]"}),"Public Matchmaking"]}),e.jsx(V,{className:"text-muted-foreground dark:text-[#b2bad0]",children:"Searching for a student with the same setup..."})]})}):e.jsx(_,{className:h(D,"rounded-[18px]"),children:e.jsxs(F,{children:[e.jsxs(O,{className:"text-base flex items-center gap-2",children:[e.jsx(jt,{className:"h-4 w-4 text-primary dark:text-[#9e8fff]"}),"No active battle"]}),e.jsx(V,{className:"text-muted-foreground dark:text-[#b2bad0]",children:"Start from Setup to create a bot match, private room, or public queue session."})]})})},"battle")}),e.jsx(fe,{value:"history",className:"mt-5",children:e.jsx(re.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},exit:{opacity:0,y:-12},className:"space-y-4",children:e.jsxs(_,{className:h(D,"rounded-[18px]"),children:[e.jsxs(F,{children:[e.jsx(O,{className:"text-base",children:"Match History"}),e.jsx(V,{className:"text-muted-foreground dark:text-[#b2bad0]",children:"Your recent student battles only."})]}),e.jsxs(ee,{className:"space-y-3",children:[e.jsx("div",{className:"flex gap-2",children:[{value:"all",label:"All"},{value:"online",label:"Online"},{value:"bot",label:"Bot"}].map(t=>e.jsx(I,{type:"button",variant:ne===t.value?"default":"outline",onClick:()=>Dt(t.value),className:"rounded-xl h-8 px-3",children:t.label},t.value))}),nt?e.jsxs("div",{className:"space-y-2",children:[e.jsx(X,{className:"h-12 w-full rounded-xl bg-muted dark:bg-[#2a3143]"}),e.jsx(X,{className:"h-12 w-full rounded-xl bg-muted dark:bg-[#2a3143]"})]}):Be.length===0?e.jsx("p",{className:"text-sm text-muted-foreground dark:text-[#a8b2c9]",children:"No matches in this filter yet."}):Be.map(t=>e.jsxs("div",{className:"rounded-xl border border-border bg-muted/40 px-3 py-2 flex items-center justify-between gap-3 dark:border-[#2f3547] dark:bg-[#11151d]",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"text-sm font-semibold text-foreground dark:text-[#f5f7fb]",children:["vs ",t.opponentName]}),e.jsxs("p",{className:"text-xs text-muted-foreground dark:text-[#95a0bb] tabular-nums",children:[t.scoreFor,"-",t.scoreAgainst," ยท ",t.accuracy.toFixed(0),"% ยท +",t.xpEarned," XP"]})]}),e.jsx("span",{className:h("text-xs font-semibold rounded-full px-2.5 py-1 border",t.outcome==="win"?"text-emerald-700 border-emerald-200 bg-emerald-50 dark:text-emerald-300 dark:border-emerald-300/40 dark:bg-emerald-900/20":t.outcome==="loss"?"text-rose-700 border-rose-200 bg-rose-50 dark:text-rose-300 dark:border-rose-300/40 dark:bg-rose-900/20":"text-amber-700 border-amber-200 bg-amber-50 dark:text-amber-300 dark:border-amber-300/40 dark:bg-amber-900/20"),children:It(t.outcome)})]},t.matchId))]})]})},"history")}),e.jsx(fe,{value:"stats",className:"mt-5",children:e.jsx(re.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},exit:{opacity:0,y:-12},className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-4 gap-4",children:[{label:"Wins",value:J?.wins??0,icon:ma},{label:"Current streak",value:J?.currentStreak??0,icon:xa},{label:"Avg accuracy",value:`${(J?.averageAccuracy||0).toFixed(1)}%`,icon:fa},{label:"Avg response",value:Ct(J?.averageResponseMs||0),icon:pa}].map(t=>e.jsx(_,{className:h(D,"rounded-[18px]"),children:e.jsxs(ee,{className:"pt-6",children:[e.jsx("p",{className:"text-xs text-muted-foreground dark:text-[#9da7bf]",children:t.label}),e.jsx("p",{className:"mt-1 tabular-nums text-2xl font-black text-foreground dark:text-[#f5f7fb]",children:t.value}),e.jsx(t.icon,{className:"mt-3 h-4 w-4 text-primary dark:text-[#9e8fff]"})]})},t.label))},"stats")}),e.jsx(fe,{value:"leaderboard",className:"mt-5",children:e.jsx(re.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},exit:{opacity:0,y:-12},children:e.jsxs(_,{className:h(D,"rounded-[18px]"),children:[e.jsxs(F,{children:[e.jsxs(O,{className:"text-base flex items-center gap-2",children:[e.jsx(Kt,{className:"h-4 w-4 text-primary dark:text-[#9e8fff]"})," Student Leaderboard"]}),e.jsx(V,{className:"text-muted-foreground dark:text-[#b2bad0]",children:"Student-only ranking using trusted backend aggregates."})]}),e.jsx(ee,{children:Lt?e.jsxs("div",{className:"space-y-2",children:[e.jsx(X,{className:"h-12 w-full rounded-xl bg-muted dark:bg-[#2a3143]"}),e.jsx(X,{className:"h-12 w-full rounded-xl bg-muted dark:bg-[#2a3143]"}),e.jsx(X,{className:"h-12 w-full rounded-xl bg-muted dark:bg-[#2a3143]"})]}):mt.length===0?e.jsx("p",{className:"text-sm text-muted-foreground dark:text-[#a9b3ca]",children:"No leaderboard entries yet. Finish a battle to place on the board."}):e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-2",children:[e.jsxs("div",{className:"rounded-xl border border-border bg-muted/30 p-2.5 dark:border-[#2f3547] dark:bg-[#11151d]",children:[e.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground dark:text-[#98a2bc]",children:"Name display"}),e.jsxs(ce,{value:Se,onValueChange:t=>Ft(t),children:[e.jsx(le,{className:"mt-1 h-8 rounded-lg",children:e.jsx(ue,{})}),e.jsxs(me,{children:[e.jsx(P,{value:"alias",children:"Alias"}),e.jsx(P,{value:"initials",children:"Initials"}),e.jsx(P,{value:"full",children:"Full name"})]})]})]}),e.jsxs("label",{className:"rounded-xl border border-border bg-muted/30 p-2.5 flex items-center justify-between gap-3 dark:border-[#2f3547] dark:bg-[#11151d]",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground dark:text-[#98a2bc]",children:"Score detail"}),e.jsx("p",{className:"text-xs text-muted-foreground dark:text-[#98a2bc]",children:"Show exact score values"})]}),e.jsx(Me,{checked:Ue,onCheckedChange:Ot})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground dark:text-[#95a0bb]",children:"Privacy mode keeps classmate identities and scores obfuscated by default while preserving your own exact rank and score."}),mt.map(t=>e.jsxs("div",{className:h("rounded-xl border bg-muted/30 px-3 py-2 flex items-center justify-between dark:bg-[#11151d]",t.isSelf?"border-primary/60 dark:border-[#8d7fff]":"border-border dark:border-[#2f3547]"),children:[e.jsxs("div",{children:[e.jsxs("p",{className:"text-sm font-semibold text-foreground dark:text-[#f5f7fb]",children:["#",t.rank," ",t.displayName,t.isSelf?" (You)":""]}),e.jsxs("p",{className:"text-xs text-muted-foreground dark:text-[#95a0bb]",children:["Win rate ",t.winRate.toFixed(1),"% ยท Best streak ",t.bestStreak]})]}),e.jsx("p",{className:"tabular-nums text-sm font-semibold text-foreground dark:text-[#f5f7fb]",children:t.scoreLabel})]},t.userId))]})})]})},"leaderboard")})]})]})})};export{Cs as default};
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/RewardsModal-HRePzoUo.js DELETED
@@ -1 +0,0 @@
1
- import{j as e}from"./vendor-react-Dexh7fmo.js";import{X as h}from"./x-BONnp2RF.js";import{i as o,F as d,Z as f}from"./index-D4nJsLyx.js";import{S as n}from"./star-dumQ9BVG.js";import{T as g}from"./trophy-C2nVcZnb.js";import{T as j}from"./target-D7SVtf3g.js";import{B as u}from"./book-open-BH50GByv.js";import{A as N}from"./award-oJTbc9W5.js";import{C as v}from"./calendar-BJ8oE6yW.js";import{U as w}from"./users-HMf2sdE3.js";import{T as y}from"./trending-up-D-vj8Gbq.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-firestore-BML5nJHm.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";const R=({isOpen:c,onClose:r,userLevel:t,currentXP:i,xpToNextLevel:a,totalXP:x,streak:m})=>{if(!c)return null;const b=[{id:"1",icon:n,title:"First Steps",description:"Complete your first video lesson",unlocked:!0,color:"text-[#9956DE]",bgColor:"bg-[#FB96BB]/20"},{id:"2",icon:g,title:"Quiz Master",description:"Score 100% on any quiz",unlocked:!1,color:"text-slate-500",bgColor:"bg-slate-100"},{id:"3",icon:d,title:"Week Warrior",description:"Maintain a 7-day login streak",progress:2,total:7,unlocked:!1,color:"text-slate-500",bgColor:"bg-slate-100"},{id:"4",icon:j,title:"Practice Makes Perfect",description:"Complete 10 practice sets",progress:2,total:10,unlocked:!1,color:"text-slate-500",bgColor:"bg-slate-100"},{id:"5",icon:u,title:"Knowledge Seeker",description:"Watch 20 video lessons",unlocked:!0,color:"text-[#1FA7E1]",bgColor:"bg-[#6ED1CF]/20"},{id:"6",icon:f,title:"Speed Learner",description:"Complete 5 lessons in one day",unlocked:!0,color:"text-[#FFB356]",bgColor:"bg-[#FFB356]/20"},{id:"7",icon:o,title:"Crown Achiever",description:"Reach Level 10",progress:4,total:10,unlocked:!1,color:"text-slate-500",bgColor:"bg-slate-100"},{id:"8",icon:N,title:"XP Hunter",description:"Earn 1000 XP",unlocked:!0,color:"text-[#7274ED]",bgColor:"bg-[#7274ED]/15"},{id:"9",icon:v,title:"Dedicated Learner",description:"Maintain a 14-day streak",progress:2,total:14,unlocked:!1,color:"text-slate-500",bgColor:"bg-slate-100"},{id:"10",icon:w,title:"Monthly Champion",description:"Maintain a 30-day streak",progress:2,total:30,unlocked:!1,color:"text-slate-500",bgColor:"bg-slate-100"}],p=[{activity:"Complete a video lesson",xp:50},{activity:"Complete exercises",xp:100},{activity:"Perfect quiz score",xp:150},{activity:"Finish a quiz",xp:75},{activity:"Daily login streak",xp:25}];return e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-8",children:[e.jsx("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:r}),e.jsxs("div",{className:"relative bg-[#f7f9fc] rounded-2xl shadow-2xl border border-[#dde3eb] w-full max-w-2xl max-h-[85vh] overflow-hidden",children:[e.jsxs("div",{className:"bg-gradient-to-r from-[#9956DE] via-[#7274ED] to-[#1FA7E1] p-6 text-white relative overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(circle_at_14%_12%,rgba(251,150,187,0.35),transparent_42%),radial-gradient(circle_at_80%_80%,rgba(117,208,106,0.25),transparent_38%)]"}),e.jsxs("div",{className:"flex items-center justify-between mb-4 relative z-10",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-display font-bold",children:"Rewards & Achievements"}),e.jsx("p",{className:"text-white/90 text-sm font-body",children:"Track your learning progress and unlock badges"})]}),e.jsx("button",{onClick:r,className:"text-white/90 hover:text-white hover:bg-white/20 p-2 rounded-xl transition-colors",children:e.jsx(h,{size:24})})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-3 relative z-10",children:[e.jsxs("div",{className:"bg-white/15 backdrop-blur-sm rounded-xl p-4 border border-white/25",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(o,{size:18,className:"text-[#FFB356]"}),e.jsx("span",{className:"text-xs font-medium text-white/90 font-body",children:"Level"})]}),e.jsx("p",{className:"text-2xl font-bold",children:t})]}),e.jsxs("div",{className:"bg-white/15 backdrop-blur-sm rounded-xl p-4 border border-white/25",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(n,{size:18,className:"text-[#6ED1CF]"}),e.jsx("span",{className:"text-xs font-medium text-white/90 font-body",children:"Total XP"})]}),e.jsx("p",{className:"text-2xl font-bold",children:x.toLocaleString()})]}),e.jsxs("div",{className:"bg-white/15 backdrop-blur-sm rounded-xl p-4 border border-white/25",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(d,{size:18,className:"text-[#FF8B8B]"}),e.jsx("span",{className:"text-xs font-medium text-white/90 font-body",children:"Day Streak"})]}),e.jsxs("p",{className:"text-2xl font-bold",children:[m," days"]})]})]}),e.jsxs("div",{className:"mt-4 relative z-10",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsxs("span",{className:"text-sm font-bold text-white font-body",children:["Level ",t]}),e.jsxs("span",{className:"text-sm font-bold text-white font-body",children:["Level ",t+1]})]}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"flex justify-between items-center mb-1",children:e.jsxs("span",{className:"text-xs text-white/90",children:[i," / ",a," XP"]})}),e.jsx("div",{className:"h-3 bg-white/20 rounded-full overflow-hidden border border-white/20",children:e.jsx("div",{className:"h-full bg-gradient-to-r from-[#6ED1CF] via-[#75D06A] to-[#FFB356] rounded-full transition-all duration-500",style:{width:`${i/a*100}%`}})})]})]})]}),e.jsxs("div",{className:"p-6 overflow-y-auto max-h-[calc(85vh-280px)]",children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("h3",{className:"text-lg font-display font-bold text-[#0a1628] mb-4",children:"Achievements"}),e.jsx("div",{className:"grid grid-cols-2 gap-3",children:b.map(s=>{const l=s.icon;return e.jsx("div",{className:`${s.unlocked?"bg-white border-[#9956DE]/25":"bg-[#edf1f7] border-[#dde3eb]"} border-2 rounded-xl p-4 transition-all ${s.unlocked?"shadow-md":"opacity-60"}`,children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:`w-12 h-12 ${s.bgColor} rounded-xl flex items-center justify-center flex-shrink-0`,children:e.jsx(l,{size:24,className:s.color})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("h4",{className:`text-sm font-bold ${s.unlocked?"text-[#0a1628]":"text-slate-500"} font-body`,children:s.title}),s.unlocked&&e.jsx("span",{className:"px-2 py-0.5 bg-[#75D06A] text-white text-[9px] font-bold rounded-full",children:"Unlocked"})]}),e.jsx("p",{className:`text-xs ${s.unlocked?"text-[#5a6578]":"text-slate-500"} mb-2`,children:s.description}),s.progress!==void 0&&s.total!==void 0&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between items-center mb-1",children:[e.jsx("span",{className:"text-[10px] text-slate-500",children:"Progress"}),e.jsxs("span",{className:"text-[10px] font-bold text-[#5a6578]",children:[s.progress," / ",s.total]})]}),e.jsx("div",{className:"h-1.5 bg-[#dde3eb] rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-gradient-to-r from-[#7274ED] to-[#1FA7E1] rounded-full transition-all",style:{width:`${s.progress/s.total*100}%`}})})]})]})]})},s.id)})})]}),e.jsxs("div",{className:"bg-white rounded-xl p-5 border border-[#dde3eb]",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx("div",{className:"w-8 h-8 bg-gradient-to-br from-[#7274ED] to-[#1FA7E1] rounded-lg flex items-center justify-center",children:e.jsx(y,{size:16,className:"text-white"})}),e.jsx("h3",{className:"text-base font-display font-bold text-[#0a1628]",children:"How to Earn XP"})]}),e.jsx("div",{className:"grid grid-cols-2 gap-2",children:p.map((s,l)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-1.5 h-1.5 bg-[#1FA7E1] rounded-full"}),e.jsxs("span",{className:"text-xs text-[#5a6578] font-body",children:[s.activity,":"]}),e.jsxs("span",{className:"text-xs font-bold text-[#7274ED]",children:["+",s.xp," XP"]})]},l))})]})]})]})]})};export{R as default};
 
 
assets/RightSidebar-Dfek3lmU.js DELETED
@@ -1 +0,0 @@
1
- import{r as m,j as e}from"./vendor-react-Dexh7fmo.js";import{e as g,m as r,Z as f,F as p,i as x}from"./index-D4nJsLyx.js";import{C as v}from"./circle-check-big-0Gzyt_f3.js";import{T as j,a as w,b as N}from"./tooltip-BV3U-RJu.js";import{T as y}from"./trophy-C2nVcZnb.js";import{C as h}from"./chevron-right-COMox1Xb.js";import{S as C}from"./star-dumQ9BVG.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-firestore-BML5nJHm.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";import"./vendor-radix-BRdei-zg.js";import"./utils-BQQgILNW.js";import"./clsx-B-dksMZM.js";const b=[{id:1,title:"Daily challenge",subtitle:"Do your plan before 09:00 AM",bgColor:"bg-[#6ED1CF]",orbColor:"bg-[#50B8B6]",avatars:["https://i.pravatar.cc/150?img=1","https://i.pravatar.cc/150?img=5","https://i.pravatar.cc/150?img=8"],extraCount:4,icon:e.jsx(f,{size:24,fill:"currentColor",className:"text-white"})},{id:2,title:"Weekend Warrior",subtitle:"Complete 3 modules this weekend",bgColor:"bg-[#FF8B8B]",orbColor:"bg-[#E06A6A]",avatars:["https://i.pravatar.cc/150?img=12","https://i.pravatar.cc/150?img=32"],extraCount:12,icon:e.jsx(p,{size:24,fill:"currentColor",className:"text-white"})},{id:3,title:"Speed Runner",subtitle:"Finish a quiz in under 5 mins",bgColor:"bg-[#75D06A]",orbColor:"bg-[#58B34D]",avatars:["https://i.pravatar.cc/150?img=44","https://i.pravatar.cc/150?img=55","https://i.pravatar.cc/150?img=68"],extraCount:8,icon:e.jsx(v,{size:24,className:"text-white"})}],_=(o=[])=>{const n=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],i=new Date,l=i.getDay(),a=[];for(let t=0;t<7;t++){const s=new Date(i);s.setDate(i.getDate()-l+t);const c=t===l,d=`${s.getFullYear()}-${String(s.getMonth()+1).padStart(2,"0")}-${String(s.getDate()).padStart(2,"0")}`,u=o.includes(d);a.push({dayName:n[t],dateNumber:s.getDate(),isToday:c,hasDot:u})}return a},k=({streakHistory:o=[]})=>{const[n,i]=m.useState(0),l=_(o);m.useEffect(()=>{const t=setInterval(()=>{i(s=>(s+1)%b.length)},5e3);return()=>clearInterval(t)},[]);const a=b[n];return e.jsxs("div",{className:"bg-white rounded-[24px] p-4 shadow-sm border border-slate-100 flex flex-col gap-6 mt-4 relative overflow-hidden",children:[e.jsx("div",{className:"relative h-[170px] rounded-[-20px] rounded-2xl overflow-hidden cursor-pointer group",children:e.jsx(g,{mode:"wait",children:e.jsxs(r.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},transition:{duration:.3},className:`absolute inset-0 ${a.bgColor} p-5 flex flex-col justify-between overflow-hidden`,children:[e.jsxs("div",{className:"absolute top-4 right-4 flex gap-1 items-center z-20",children:[e.jsx("div",{className:"w-3 h-1.5 rounded-full bg-white/60"}),e.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-white/40"}),e.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-white/40"})]}),e.jsx("div",{className:`absolute -right-4 -top-8 w-36 h-36 rounded-full ${a.orbColor} opacity-90 blur-2xl group-hover:scale-110 transition-transform duration-700 pointer-events-none`}),e.jsx("div",{className:"absolute right-4 bottom-4 w-[52px] h-[52px] rounded-2xl rotate-12 bg-white/20 backdrop-blur-md shadow-sm border border-white/20 group-hover:rotate-45 group-hover:scale-110 transition-transform duration-700 flex items-center justify-center",children:a.icon}),e.jsxs("div",{className:"relative z-10 w-3/4",children:[e.jsx("h3",{className:"font-display font-bold text-[22px] text-white mb-1",children:a.title}),e.jsx("p",{className:"text-[13px] font-medium text-white/80 leading-snug",children:a.subtitle})]}),e.jsxs("div",{className:"flex items-center -space-x-2.5 relative z-10 mt-auto",children:[a.avatars.map((t,s)=>e.jsx("img",{src:t,alt:"User",className:"w-[34px] h-[34px] rounded-full border-2 border-transparent object-cover relative z-[3] z-[2] z-[1]",style:{borderColor:a.bgColor.replace("bg-[","").replace("]","")}},s)),e.jsxs("div",{className:"w-[34px] h-[34px] rounded-full border-2 text-[12px] font-bold flex items-center justify-center text-white relative z-0",style:{backgroundColor:"rgba(0,0,0,0.2)",borderColor:a.bgColor.replace("bg-[","").replace("]","")},children:["+",a.extraCount]})]})]},a.id)})}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-display text-[15px] font-bold text-[#141b2d] mb-4 px-1",children:"Your streak"}),e.jsx("div",{className:"flex justify-between items-center gap-1.5 px-0.5",children:l.map((t,s)=>e.jsxs("div",{className:`flex flex-col items-center pt-2 pb-3 w-[46px] h-[72px] rounded-[24px] border ${t.isToday?"bg-[#12192b] text-white border-transparent shadow-[0_8px_16px_rgba(18,25,43,0.3)] transform -translate-y-1":"bg-white text-slate-400 border-slate-200/80 hover:border-slate-300"} transition-all duration-200 cursor-pointer`,children:[e.jsx("div",{className:"h-1.5 flex items-center justify-center mb-1.5",children:t.hasDot?e.jsx("div",{className:`w-[5px] h-[5px] rounded-full ${t.isToday?"bg-white":"bg-slate-300"}`}):e.jsx("div",{className:`text-[10px] ${t.isToday?"text-white/50":"text-slate-200"} font-bold`,children:"+"})}),e.jsx("span",{className:`text-[11px] font-bold mb-1 ${t.isToday?"text-slate-300":"text-slate-400/80"}`,children:t.dayName}),e.jsx("span",{className:`text-[15px] font-bold leading-none ${t.isToday?"text-white":"text-[#334155]"}`,children:t.dateNumber})]},s))})]})]})},X=({onOpenRewards:o,onOpenLeaderboard:n,onNavigateToModules:i,userLevel:l,currentXP:a,xpToNextLevel:t,streak:s,streakHistory:c=[]})=>{const d=a/t*100;return e.jsxs("div",{className:"space-y-2.5",children:[e.jsxs(r.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{delay:.1,duration:.4,ease:[.22,1,.36,1]},onClick:o,className:"rounded-2xl border border-[#9956DE]/25 cursor-pointer transition-all group relative overflow-hidden bg-gradient-to-br from-[#9956DE] via-[#7274ED] to-[#1FA7E1] hover:shadow-[0_16px_40px_rgba(114,116,237,0.28)] hover:-translate-y-0.5",children:[e.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(circle_at_18%_8%,rgba(251,150,187,0.32),transparent_42%),radial-gradient(circle_at_85%_84%,rgba(117,208,106,0.24),transparent_40%)]"}),e.jsxs("div",{className:"relative z-10 p-3",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-9 h-9 bg-white/20 rounded-xl flex items-center justify-center border border-white/35 backdrop-blur-sm",children:e.jsx(y,{size:16,className:"text-white"})}),e.jsx("h3",{className:"font-display font-bold text-sm text-white tracking-wide",children:"Rewards & Achievements"})]}),e.jsx(h,{size:16,className:"text-white/80 group-hover:text-white group-hover:translate-x-0.5 transition-all"})]}),e.jsxs("div",{className:"flex items-center gap-2.5 mb-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-body px-2 py-1 rounded-md bg-white/14 border border-white/25 text-white",children:[e.jsx(x,{size:12,className:"text-[#FFB356]"}),e.jsxs("span",{className:"font-bold",children:["Lv ",l]})]}),e.jsx("div",{className:"w-px h-3 bg-white/35"}),e.jsxs(j,{children:[e.jsx(w,{asChild:!0,children:e.jsxs("button",{onClick:i,className:"flex items-center gap-1.5 text-xs font-body px-2 py-1 rounded-md bg-white/14 border border-white/25 text-white cursor-pointer hover:bg-white/20 transition-colors active:scale-95",children:[e.jsx(C,{size:12,className:"text-[#6ED1CF]"}),e.jsxs("span",{className:"font-bold",children:[a," XP"]})]})}),e.jsx(N,{side:"top",className:"bg-slate-900 text-white border border-slate-700",children:"Review more lessons to earn more XP!"})]}),e.jsx("div",{className:"w-px h-3 bg-white/35"}),e.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-body px-2 py-1 rounded-md bg-white/14 border border-white/25 text-white",children:[e.jsx(p,{size:12,className:"text-[#FF8B8B]"}),e.jsxs("span",{className:"font-bold",children:[s,"d"]})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between items-center mb-1.5",children:[e.jsxs("span",{className:"text-[11px] font-body text-white/90",children:["Next: Level ",l+1]}),e.jsxs("span",{className:"text-[11px] font-body font-semibold text-white",children:[Math.round(d),"%"]})]}),e.jsx("div",{className:"h-2 bg-white/25 rounded-full overflow-hidden border border-white/20",children:e.jsx(r.div,{initial:{width:0},animate:{width:`${d}%`},transition:{duration:1,ease:"easeOut"},className:"h-full bg-gradient-to-r from-[#6ED1CF] via-[#75D06A] to-[#FFB356] rounded-full"})})]})]})]}),e.jsx(r.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{delay:.2,duration:.4,ease:[.22,1,.36,1]},children:e.jsx(k,{streakHistory:c})}),e.jsxs(r.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{delay:.3,duration:.4,ease:[.22,1,.36,1]},onClick:n,className:"bg-white rounded-xl border border-slate-200/80 hover:shadow-md hover:border-amber-200/60 transition-all group overflow-hidden cursor-pointer",children:[e.jsxs("div",{className:"p-3 border-b border-slate-100 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-7 h-7 bg-amber-50 rounded-lg flex items-center justify-center border border-amber-200/60 transition-colors group-hover:bg-amber-100/50",children:e.jsx(x,{size:14,className:"text-amber-500"})}),e.jsx("h3",{className:"font-display font-bold text-sm text-[#0a1628]",children:"Leaderboards"})]}),e.jsx(h,{size:14,className:"text-slate-400 group-hover:translate-x-0.5 group-hover:text-amber-500 transition-transform"})]}),e.jsxs("div",{className:"pt-8 pb-3 px-2 bg-gradient-to-b from-slate-50/30 to-white flex items-end justify-center gap-1.5 min-h-[170px]",children:[e.jsxs("div",{className:"flex flex-col items-center relative z-10",children:[e.jsxs(r.div,{initial:{y:20,opacity:0},animate:{y:0,opacity:1},transition:{delay:.5},className:"relative mb-2",children:[e.jsx("img",{src:"https://i.pravatar.cc/150?img=33",alt:"You",className:"w-10 h-10 rounded-full border-[3px] border-sky-400 z-10 relative object-cover shadow-sm bg-white"}),e.jsx("div",{className:"absolute -bottom-2 left-1/2 -translate-x-1/2 bg-sky-500 text-white text-[10px] font-bold px-2 py-0.5 rounded-full z-20 shadow-sm",children:"2"})]}),e.jsxs(r.div,{initial:{height:0},animate:{height:"54px"},transition:{delay:.4,duration:.5,ease:"easeOut"},className:"w-[70px] bg-gradient-to-b from-slate-200 to-slate-100 rounded-t-xl rounded-b-md border-t-2 border-slate-50 flex items-center justify-center relative shadow-[inset_0_-4px_6px_rgba(0,0,0,0.05),0_4px_6px_rgba(0,0,0,0.05)]",children:[e.jsx("span",{className:"text-slate-400 font-black text-2xl opacity-40 translate-y-1",children:"2"}),e.jsx("div",{className:"absolute top-0 left-0 right-0 h-1.5 bg-white/70 rounded-t-xl"})]}),e.jsxs("div",{className:"mt-2 text-center",children:[e.jsx("span",{className:"block text-[12px] font-bold text-[#0a1628]",children:"You"}),e.jsx("span",{className:"block text-[10px] text-sky-600 font-bold",children:"2.1k XP"})]})]}),e.jsxs("div",{className:"flex flex-col items-center relative z-20 -mx-2",children:[e.jsxs(r.div,{initial:{y:20,opacity:0},animate:{y:0,opacity:1},transition:{delay:.7},className:"relative mb-2",children:[e.jsx("div",{className:"absolute -top-4 left-1/2 -translate-x-1/2 z-20",children:e.jsx(x,{size:22,className:"text-amber-400 drop-shadow-md mb-1",fill:"#fbbf24",strokeWidth:1.5})}),e.jsx("img",{src:"https://i.pravatar.cc/150?img=68",alt:"Alex",className:"w-[52px] h-[52px] rounded-full border-[3px] border-amber-400 z-10 relative object-cover shadow-md bg-white"}),e.jsx("div",{className:"absolute -bottom-2 left-1/2 -translate-x-1/2 bg-amber-500 text-white text-[10px] font-bold px-2 py-0.5 rounded-full z-20 shadow-sm",children:"1"})]}),e.jsxs(r.div,{initial:{height:0},animate:{height:"74px"},transition:{delay:.6,duration:.5,ease:"easeOut"},className:"w-[78px] bg-gradient-to-b from-amber-100 to-amber-50 rounded-t-xl rounded-b-md border-t-2 border-amber-50 flex items-center justify-center relative shadow-[inset_0_-4px_8px_rgba(251,191,36,0.1),0_6px_8px_rgba(0,0,0,0.05)]",children:[e.jsx("span",{className:"text-amber-400 font-black text-3xl opacity-50 translate-y-1",children:"1"}),e.jsx("div",{className:"absolute top-0 left-0 right-0 h-1.5 bg-white/80 rounded-t-xl"})]}),e.jsxs("div",{className:"mt-2 text-center",children:[e.jsx("span",{className:"block text-[13px] font-black text-[#0a1628]",children:"Alex M."}),e.jsx("span",{className:"block text-[11px] text-amber-600 font-bold",children:"2.4k XP"})]})]}),e.jsxs("div",{className:"flex flex-col items-center relative z-10",children:[e.jsxs(r.div,{initial:{y:20,opacity:0},animate:{y:0,opacity:1},transition:{delay:.6},className:"relative mb-2",children:[e.jsx("img",{src:"https://i.pravatar.cc/150?img=47",alt:"Sarah",className:"w-10 h-10 rounded-full border-[3px] border-orange-400 z-10 relative object-cover shadow-sm bg-white"}),e.jsx("div",{className:"absolute -bottom-2 left-1/2 -translate-x-1/2 bg-orange-500 text-white text-[10px] font-bold px-2 py-0.5 rounded-full z-20 shadow-sm",children:"3"})]}),e.jsxs(r.div,{initial:{height:0},animate:{height:"38px"},transition:{delay:.5,duration:.5,ease:"easeOut"},className:"w-[70px] bg-gradient-to-b from-orange-50 to-slate-50 rounded-t-xl rounded-b-md border-t-2 border-orange-100 flex items-center justify-center relative shadow-[inset_0_-4px_6px_rgba(249,115,22,0.05),0_4px_6px_rgba(0,0,0,0.02)]",children:[e.jsx("span",{className:"text-orange-400/60 font-black text-2xl opacity-60 translate-y-1",children:"3"}),e.jsx("div",{className:"absolute top-0 left-0 right-0 h-1.5 bg-white/70 rounded-t-xl"})]}),e.jsxs("div",{className:"mt-2 text-center",children:[e.jsx("span",{className:"block text-[12px] font-bold text-[#0a1628]",children:"Sarah K."}),e.jsx("span",{className:"block text-[10px] text-orange-600 font-bold",children:"1.9k XP"})]})]})]})]})]})};export{X as default};
 
 
assets/ScientificCalculator-wlhyNBDf.js DELETED
@@ -1,30 +0,0 @@
1
- import{r as c,j as e}from"./vendor-react-Dexh7fmo.js";import{apiService as de}from"./apiService-axx1LHMk.js";import{c as Z,e as U,m as ue}from"./index-D4nJsLyx.js";import{C as fe,a as pe}from"./chevron-up-Bfmq3Clw.js";import{X as be}from"./x-BONnp2RF.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-firestore-BML5nJHm.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";/**
2
- * @license lucide-react v0.487.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 xe=[["circle",{cx:"12",cy:"9",r:"1",key:"124mty"}],["circle",{cx:"19",cy:"9",r:"1",key:"1ruzo2"}],["circle",{cx:"5",cy:"9",r:"1",key:"1a8b28"}],["circle",{cx:"12",cy:"15",r:"1",key:"1e56xg"}],["circle",{cx:"19",cy:"15",r:"1",key:"1a92ep"}],["circle",{cx:"5",cy:"15",r:"1",key:"5r1jwy"}]],me=Z("grip-horizontal",xe);/**
7
- * @license lucide-react v0.487.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 ge=[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]],ve=Z("keyboard",ge);function ye(a){const f=[];let n=0;for(;n<a.length;){const s=a[n];if(s===" "){n++;continue}if(s==="-"){const d=f[f.length-1];if(!d||["+","-","ร—","รท","*","/","%","^","("].includes(d)){const p=a[n+1];if(p&&(/\d/.test(p)||p===".")){let b="-";for(n++;n<a.length&&/[\d.]/.test(a[n]);)b+=a[n],n++;if(n<a.length&&(a[n]==="e"||a[n]==="E")&&n+1<a.length&&/[\d+-]/.test(a[n+1]))for(b+=a[n],n++,(a[n]==="+"||a[n]==="-")&&(b+=a[n],n++);n<a.length&&/\d/.test(a[n]);)b+=a[n],n++;f.push(b);continue}f.push("neg"),n++;continue}}if(/\d/.test(s)||s==="."&&n+1<a.length&&/\d/.test(a[n+1])){let d="";for(;n<a.length&&/[\d.]/.test(a[n]);)d+=a[n],n++;if(n<a.length&&(a[n]==="e"||a[n]==="E")&&n+1<a.length&&/[\d+-]/.test(a[n+1]))for(d+=a[n],n++,(a[n]==="+"||a[n]==="-")&&(d+=a[n],n++);n<a.length&&/\d/.test(a[n]);)d+=a[n],n++;f.push(d);continue}if(/[a-zA-Zฯ€]/.test(s)){let d="";for(;n<a.length&&/[a-zA-Zฯ€โปยน]/.test(a[n]);)d+=a[n],n++;f.push(d);continue}f.push(s),n++}return f}function je(a,f){const n=[],s=[],d={"+":1,"-":1,"ร—":2,"รท":2,"*":2,"/":2,"%":2,"^":4},g=new Set(["^"]),p=new Set(["sin","cos","tan","asin","acos","atan","sinh","cosh","tanh","log","ln","sqrt","cbrt","abs","factorial","nroot","tenPow","ePow","neg"]),b=[];for(let l=0;l<a.length;l++){const u=a[l];if(l>0){const x=b[b.length-1],y=x===")"||x==="ฯ€"||x==="e"||x==="Ans"||/^\d/.test(x),N=u==="("||u==="ฯ€"||u==="e"||u==="Ans"||p.has(u)||/^\d/.test(u);y&&N&&b.push("ร—")}b.push(u)}for(const l of b)if(/^-?[\d.]+([eE][+-]?\d+)?$/.test(l))n.push(l);else if(l==="ฯ€")n.push(String(Math.PI));else if(l==="e"&&!p.has(l))n.push(String(Math.E));else if(l==="Ans")n.push("__ANS__");else if(p.has(l))s.push(l);else if(l==="(")s.push(l);else if(l===")"){for(;s.length&&s[s.length-1]!=="(";)n.push(s.pop());s.pop(),s.length&&p.has(s[s.length-1])&&n.push(s.pop())}else if(l in d){const u=d[l];for(;s.length&&s[s.length-1]!=="("&&s[s.length-1]in d&&(d[s[s.length-1]]>u||d[s[s.length-1]]===u&&!g.has(l));)n.push(s.pop());s.push(l)}for(;s.length;)n.push(s.pop());return n}function we(a){if(a<0||!Number.isInteger(a))return NaN;if(a>170)return 1/0;let f=1;for(let n=2;n<=a;n++)f*=n;return f}function Ne(a){return a*Math.PI/180}function ke(a){return a*180/Math.PI}function Ae(a,f,n){const s=[],d=f==="DEG"?Ne:p=>p,g=f==="DEG"?ke:p=>p;for(const p of a){if(p==="__ANS__"){s.push(n);continue}const b=parseFloat(p);if(!isNaN(b)&&/^-?[\d.]+([eE][+-]?\d+)?$/.test(p)){s.push(b);continue}if(["+","-","ร—","รท","*","/","^","%"].includes(p)){const u=s.pop(),x=s.pop();switch(p){case"+":s.push(x+u);break;case"-":s.push(x-u);break;case"ร—":case"*":s.push(x*u);break;case"รท":case"/":if(u===0){s.push(NaN);break}s.push(x/u);break;case"^":s.push(Math.pow(x,u));break;case"%":s.push(x*u/100);break}continue}const l=s.pop();switch(p){case"sin":s.push(Math.sin(d(l)));break;case"cos":s.push(Math.cos(d(l)));break;case"tan":{const u=d(l);if(Math.abs(Math.cos(u))<1e-15){s.push(NaN);break}s.push(Math.tan(u));break}case"asin":if(l<-1||l>1){s.push(NaN);break}s.push(g(Math.asin(l)));break;case"acos":if(l<-1||l>1){s.push(NaN);break}s.push(g(Math.acos(l)));break;case"atan":s.push(g(Math.atan(l)));break;case"sinh":s.push(Math.sinh(l));break;case"cosh":s.push(Math.cosh(l));break;case"tanh":s.push(Math.tanh(l));break;case"log":s.push(l<=0?NaN:Math.log10(l));break;case"ln":s.push(l<=0?NaN:Math.log(l));break;case"sqrt":s.push(l<0?NaN:Math.sqrt(l));break;case"cbrt":s.push(Math.cbrt(l));break;case"abs":s.push(Math.abs(l));break;case"factorial":s.push(we(l));break;case"tenPow":s.push(Math.pow(10,l));break;case"ePow":s.push(Math.exp(l));break;case"neg":s.push(-l);break;case"nroot":{const u=s.pop();s.push(Math.pow(u,1/l));break}default:s.push(NaN)}}return s.length===1?s[0]:NaN}function Ee(a){let f=0;for(const n of a)n==="("?f++:n===")"&&f--;return a+")".repeat(Math.max(0,f))}function Se(a){if(!isFinite(a))return isNaN(a)?"Math Error":a>0?"โˆž":"-โˆž";if(Number.isInteger(a)&&Math.abs(a)<1e15)return a.toString();if(Math.abs(a)>=1e10||Math.abs(a)<1e-10&&a!==0)return a.toExponential(6);const f=a.toPrecision(10);return parseFloat(f).toString()}function De(a,f,n){try{const s=Ee(a),d=ye(s);if(d.length===0)return"0";const g=je(d,f),p=Ae(g,f,n);return Se(p)}catch{return"Error"}}const Re=({isOpen:a,onClose:f,inline:n=!1})=>{const[s,d]=c.useState(""),[g,p]=c.useState("0"),[b,l]=c.useState(""),[u,x]=c.useState("DEG"),[y,N]=c.useState(!1),[R,T]=c.useState(!1),[k,J]=c.useState(0),[M,Q]=c.useState([]),[O,A]=c.useState(!1),[P,H]=c.useState(!1),[j,E]=c.useState(null),[w,ee]=c.useState(()=>{try{return localStorage.getItem("mathpulse_calc_minimized")==="true"}catch{return!1}}),[V,q]=c.useState(!1),[te,se]=c.useState(!1),C=c.useRef(null),z=c.useRef(null),X=c.useRef(!1),[S,I]=c.useState({x:0,y:0});c.useEffect(()=>{a&&I({x:Math.round((window.innerWidth-380)/2),y:Math.max(20,Math.round((window.innerHeight-600)/2))})},[a]),c.useEffect(()=>{try{localStorage.setItem("mathpulse_calc_minimized",String(w))}catch{}},[w]),c.useEffect(()=>{C.current&&(C.current.scrollLeft=C.current.scrollWidth)},[s]),c.useEffect(()=>{const r=o=>{z.current&&!z.current.contains(o.target)&&q(!1)};return document.addEventListener("mousedown",r),()=>document.removeEventListener("mousedown",r)},[]),c.useEffect(()=>{if(!a)return;const r=o=>{if(!V)return;const t=o.key;if(o.altKey){if(o.preventDefault(),o.shiftKey){if(t==="S"||t==="s"){h("asin");return}if(t==="C"||t==="c"){h("acos");return}if(t==="T"||t==="t"){h("atan");return}}if(t==="s"||t==="S"){h("sin");return}if(t==="c"||t==="C"){h("cos");return}if(t==="t"||t==="T"){h("tan");return}if(t==="l"||t==="L"){h("log");return}if(t==="n"||t==="N"){h("ln");return}if(t==="r"||t==="R"){h("sqrt");return}if(t==="p"||t==="P"){i("ฯ€");return}if(t==="e"||t==="E"){i("e");return}if(t==="2"){i("ยฒ");return}if(t==="3"){i("ยณ");return}if(t==="^"||t==="6"){i("^");return}if(t==="a"||t==="A"){i("Ans");return}if(t==="d"||t==="D"){W();return}return}o.stopPropagation(),/^[0-9.]$/.test(t)?(i(t),o.preventDefault()):t==="+"?(i("+"),o.preventDefault()):t==="-"?(i("-"),o.preventDefault()):t==="*"?(i("ร—"),o.preventDefault()):t==="/"?(i("รท"),o.preventDefault()):t==="%"?(i("%"),o.preventDefault()):t==="("?(i("("),o.preventDefault()):t===")"?(i(")"),o.preventDefault()):t==="^"?(i("^"),o.preventDefault()):t==="Enter"||t==="="?(G(),o.preventDefault()):t==="Backspace"?(_(),o.preventDefault()):(t==="Escape"||t==="Delete")&&(B(),o.preventDefault())};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[a,V,s,k,u]);const i=c.useCallback(r=>{A(!1),E(null),d(o=>o+r)},[]),h=c.useCallback(r=>{A(!1),E(null),d(o=>o+r+"("),N(!1)},[]),_=c.useCallback(()=>{d(r=>r.slice(0,-1)),A(!1)},[]),B=c.useCallback(()=>{d(""),p("0"),l(""),A(!1),E(null)},[]),G=c.useCallback(()=>{if(!s.trim())return;const r=De(s,u,k),o=r==="Error"||r==="Math Error";if(A(o),p(r),!o){const t=parseFloat(r);isNaN(t)||J(t),Q(m=>[...m.slice(-19),{expression:s,result:r}]),l(s+" =")}d("")},[s,u,k]),W=c.useCallback(()=>{x(r=>r==="DEG"?"RAD":"DEG")},[]),ae=c.useCallback(()=>{N(r=>!r),T(!1)},[]),ne=c.useCallback(()=>{T(r=>!r),N(!1)},[]),le=c.useCallback(()=>{i("Ans")},[i]),Y=c.useCallback(()=>{i("ร—10^")},[i]),ie=c.useCallback(async()=>{const r=s.trim()||(M.length>0?M[M.length-1].expression:"");if(r){H(!0);try{const o=r.replace(/ร—/g,"*").replace(/รท/g,"/").replace(/ฯ€/g,"pi").replace(/Ans/g,String(k)).replace(/(\d)\(/g,"$1*(").replace(/\)(\d)/g,")*$1"),t=await de.evaluateExpression(o);E(t)}catch{E({expression:r,result:"Verification unavailable",steps:["Backend unavailable โ€” using client-side result"],simplified:null,latex:null})}finally{H(!1)}}},[s,M,k]),re=[[{label:"SHIFT",action:ae,variant:"shift"},{label:"ALPHA",action:ne,variant:"shift"},{label:u,action:W,variant:"mode"},{label:"โ—€",action:()=>{_()},variant:"mode"},{label:"โ–ถ",action:()=>{i(" ")},variant:"mode"}],[{label:"xยฒ",shiftLabel:"โˆš",action:()=>i("^2"),shiftAction:()=>h("sqrt"),variant:"func"},{label:"xยณ",shiftLabel:"ยณโˆš",action:()=>i("^3"),shiftAction:()=>h("cbrt"),variant:"func"},{label:"xสธ",shiftLabel:"สธโˆšx",action:()=>i("^"),shiftAction:()=>h("nroot"),variant:"func"},{label:"log",shiftLabel:"10หฃ",action:()=>h("log"),shiftAction:()=>h("tenPow"),variant:"func"},{label:"ln",shiftLabel:"eหฃ",action:()=>h("ln"),shiftAction:()=>h("ePow"),variant:"func"}],[{label:"โˆš",shiftLabel:"xยฒ",action:()=>h("sqrt"),shiftAction:()=>i("^2"),variant:"func"},{label:"ยณโˆš",shiftLabel:"xยณ",action:()=>h("cbrt"),shiftAction:()=>i("^3"),variant:"func"},{label:"สธโˆšx",shiftLabel:"xสธ",action:()=>h("nroot"),shiftAction:()=>i("^"),variant:"func"},{label:"sin",shiftLabel:"sinโปยน",action:()=>h("sin"),shiftAction:()=>h("asin"),variant:"func"},{label:"cos",shiftLabel:"cosโปยน",action:()=>h("cos"),shiftAction:()=>h("acos"),variant:"func"}],[{label:"tan",shiftLabel:"tanโปยน",action:()=>h("tan"),shiftAction:()=>h("atan"),variant:"func"},{label:"sinโปยน",shiftLabel:"sinh",action:()=>h("asin"),shiftAction:()=>h("sinh"),variant:"func"},{label:"cosโปยน",shiftLabel:"cosh",action:()=>h("acos"),shiftAction:()=>h("cosh"),variant:"func"},{label:"tanโปยน",shiftLabel:"tanh",action:()=>h("atan"),shiftAction:()=>h("tanh"),variant:"func"},{label:"ฯ€",action:()=>i("ฯ€"),variant:"func"}],[{label:"(",action:()=>i("("),variant:"func"},{label:")",action:()=>i(")"),variant:"func"},{label:"e",action:()=>i("e"),variant:"func"},{label:"EXP",action:Y,variant:"func"},{label:"%",action:()=>i("%"),variant:"func"}],[{label:"7",action:()=>i("7"),variant:"number"},{label:"8",action:()=>i("8"),variant:"number"},{label:"9",action:()=>i("9"),variant:"number"},{label:"DEL",action:_,variant:"del"},{label:"AC",action:B,variant:"del"}],[{label:"4",action:()=>i("4"),variant:"number"},{label:"5",action:()=>i("5"),variant:"number"},{label:"6",action:()=>i("6"),variant:"number"},{label:"ร—",action:()=>i("ร—"),variant:"op"},{label:"รท",action:()=>i("รท"),variant:"op"}],[{label:"1",action:()=>i("1"),variant:"number"},{label:"2",action:()=>i("2"),variant:"number"},{label:"3",action:()=>i("3"),variant:"number"},{label:"+",action:()=>i("+"),variant:"op"},{label:"โˆ’",action:()=>i("-"),variant:"op"}],[{label:"0",action:()=>i("0"),variant:"number"},{label:".",action:()=>i("."),variant:"number"},{label:"ร—10หฃ",action:Y,variant:"func"},{label:"Ans",action:le,variant:"op"},{label:"=",action:G,variant:"equals"}]],oe=(r,o)=>{const t="flex items-center justify-center rounded-2xl font-bold transition-all duration-150 active:scale-95 select-none cursor-pointer touch-manipulation relative overflow-hidden",m="min-h-[56px] text-[16px]",v="min-h-[56px] text-[14px]";switch(r){case"number":return`${t} ${m} bg-white hover:bg-[#edf1f7] text-[#0a1628] border border-[#dde3eb] shadow-sm`;case"op":return`${t} ${m} bg-[#edf1f7] hover:bg-[#dde3eb] text-[#7274ED] border border-[#dde3eb] shadow-sm font-bold`;case"func":return`${t} ${v} bg-[#9956DE] hover:bg-[#8A4DCA] text-white shadow-md shadow-[#9956DE]/20`;case"del":return`${t} ${m} ${o==="AC"?"bg-[#FF8B8B] hover:bg-[#FF7373]":"bg-[#FB96BB] hover:bg-[#FA7DA9]"} text-[#8A1A1A] shadow-md shadow-red-900/10 font-bold border-none`;case"equals":return`${t} ${m} bg-[#1FA7E1] hover:bg-[#1C96CB] text-white shadow-lg shadow-[#1FA7E1]/30 font-bold text-lg`;case"shift":return`${t} ${v} bg-white hover:bg-[#edf1f7] text-[#9956DE] border border-[#dde3eb] shadow-sm font-bold uppercase tracking-wider text-[11px]`;case"mode":return`${t} ${v} bg-white hover:bg-[#edf1f7] text-[#1FA7E1] border border-[#dde3eb] shadow-sm font-bold`;default:return`${t} ${m} bg-slate-100 text-[#0a1628] border border-slate-200`}},ce=c.useCallback(r=>{r.preventDefault(),X.current=!0;const o=r.clientX,t=r.clientY,m=S.x,v=S.y,L=D=>{const $=m+(D.clientX-o),he=v+(D.clientY-t);I({x:$,y:he})},F=D=>{X.current=!1;const $={x:m+(D.clientX-o),y:v+(D.clientY-t)};I($);try{localStorage.setItem("mathpulse_calc_position",JSON.stringify($))}catch{}document.removeEventListener("mousemove",L),document.removeEventListener("mouseup",F)};document.addEventListener("mousemove",L),document.addEventListener("mouseup",F)},[S]);if(!a)return null;const K=e.jsxs("div",{className:"flex flex-col w-full select-none",children:[e.jsxs("div",{className:"bg-white rounded-t-2xl p-4 border border-slate-200 border-b-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{className:`
12
- text-[10px] font-bold px-2 py-0.5 rounded-full
13
- ${u==="DEG"?"bg-rose-500/20 text-rose-400 border border-sky-500/30":"bg-rose-500/20 text-rose-400 border border-rose-500/30"}
14
- `,children:u}),y&&e.jsx("span",{className:"text-[10px] font-bold px-2 py-0.5 rounded-full bg-[#6ED1CF]/30 text-[#1FA7E1] border border-[#1FA7E1]/40 animate-pulse",children:"SHIFT"}),R&&e.jsx("span",{className:"text-[10px] font-bold px-2 py-0.5 rounded-full bg-sky-500/20 text-sky-400 border border-indigo-500/30",children:"ALPHA"}),P&&e.jsx("span",{className:"text-[10px] font-bold px-2 py-0.5 rounded-full bg-sky-500/20 text-sky-400 border border-sky-500/30 animate-pulse",children:"Verifyingโ€ฆ"})]}),e.jsx("div",{ref:C,className:"text-right text-slate-500 text-[14px] font-mono h-6 overflow-x-auto overflow-y-hidden whitespace-nowrap scrollbar-hide",children:b||"ย "}),e.jsx("div",{className:`
15
- text-right font-mono font-bold text-[32px] leading-tight h-10 overflow-hidden whitespace-nowrap
16
- ${O?"text-red-400":"text-[#0a1628]"}
17
- `,children:s||g}),e.jsx(U,{children:j&&e.jsxs(ue.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"mt-2 pt-2 border-t border-slate-300",children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[e.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-sky-400"}),e.jsx("span",{className:"text-[10px] text-rose-400 font-semibold uppercase tracking-wider",children:"SymPy Verified"})]}),e.jsx("p",{className:"text-xs text-slate-500 font-mono",children:j.result}),j.latex&&e.jsxs("p",{className:"text-[10px] text-[#5a6578] font-mono mt-0.5",children:["LaTeX: ",j.latex]}),j.steps.length>1&&e.jsx("div",{className:"mt-1 space-y-0.5",children:j.steps.slice(1).map((r,o)=>e.jsx("p",{className:"text-[10px] text-[#5a6578]",children:r},o))})]})})]}),e.jsxs("button",{onClick:ie,disabled:P,className:`
18
- w-full py-1.5 bg-slate-50 border-x border-slate-200
19
- text-[11px] font-semibold text-rose-600 hover:text-rose-700 hover:bg-slate-100
20
- transition-colors disabled:opacity-50 disabled:cursor-not-allowed
21
- flex items-center justify-center gap-1.5
22
- `,children:[e.jsx("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})}),P?"Verifying with SymPyโ€ฆ":"Verify with SymPy"]}),e.jsx("div",{className:"bg-white rounded-b-2xl p-4 border border-slate-200 border-t-0 space-y-1.5",children:re.map((r,o)=>e.jsx("div",{className:"grid grid-cols-5 gap-1.5",children:r.map((t,m)=>{const v=y&&t.shiftAction,L=v&&t.shiftLabel||t.label,F=v?t.shiftAction:t.action;return e.jsxs("button",{onClick:F,className:`
23
- ${oe(t.variant,t.label)}
24
- ${t.variant==="shift"&&t.label==="SHIFT"&&y?"!bg-[#6ED1CF]/35 !text-[#1FA7E1] ring-2 ring-[#1FA7E1]/35 border-[#1FA7E1]/30":""}
25
- ${t.variant==="shift"&&t.label==="ALPHA"&&R?"!bg-[#7274ED] !text-white ring-2 ring-[#9956DE]/50":""}
26
- ${t.colSpan?`col-span-${t.colSpan}`:""}
27
- ${v&&t.variant==="func"?"!bg-gradient-to-br !from-[#6ED1CF] !to-[#1FA7E1] hover:!from-[#8FE4DA] hover:!to-[#49BDEB] !text-white shadow-md shadow-[#1FA7E1]/20":""}
28
- ${t.variant==="op"&&!["DEL","AC"].includes(t.label)?"bg-gradient-to-br from-[#FFB356] to-[#FF8B8B] !text-white font-bold shadow-md":""}
29
- relative
30
- `,title:t.shiftLabel?`SHIFT: ${t.shiftLabel}`:void 0,children:[t.shiftLabel&&!y&&e.jsx("span",{className:"absolute top-1 right-1 text-[10px] leading-none bg-white/95 text-[#9956DE] font-black px-1.5 py-0.5 rounded-md shadow-sm",children:t.shiftLabel}),e.jsx("span",{className:v?"text-[#EAFBFF]":"",children:L})]},m)})},o))}),te&&e.jsx("div",{className:"bg-slate-50 border-t border-slate-200 text-xs text-slate-500 p-3 rounded-b-2xl",children:e.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[#5a6578]",children:"Alt+S"}),e.jsx("span",{children:"sin("})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[#5a6578]",children:"Alt+Shift+S"}),e.jsx("span",{children:"sinโปยน("})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[#5a6578]",children:"Alt+C"}),e.jsx("span",{children:"cos("})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[#5a6578]",children:"Alt+Shift+C"}),e.jsx("span",{children:"cosโปยน("})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[#5a6578]",children:"Alt+T"}),e.jsx("span",{children:"tan("})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[#5a6578]",children:"Alt+Shift+T"}),e.jsx("span",{children:"tanโปยน("})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[#5a6578]",children:"Alt+L"}),e.jsx("span",{children:"log("})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[#5a6578]",children:"Alt+N"}),e.jsx("span",{children:"ln("})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[#5a6578]",children:"Alt+R"}),e.jsx("span",{children:"โˆš("})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[#5a6578]",children:"Alt+P"}),e.jsx("span",{children:"ฯ€"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[#5a6578]",children:"Alt+E"}),e.jsx("span",{children:"e"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[#5a6578]",children:"Alt+2"}),e.jsx("span",{children:"ยฒ"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[#5a6578]",children:"Alt+3"}),e.jsx("span",{children:"ยณ"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[#5a6578]",children:"Alt+^"}),e.jsx("span",{children:"^"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[#5a6578]",children:"Alt+A"}),e.jsx("span",{children:"Ans"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[#5a6578]",children:"Alt+D"}),e.jsx("span",{children:"DEG/RAD"})]})]})})]});return n?K:e.jsx(U,{children:a&&e.jsxs("div",{ref:z,className:"fixed z-50",style:{top:S.y,left:S.x,width:380},onClick:()=>q(!0),children:[e.jsxs("div",{className:"bg-gradient-to-r from-sky-600 to-sky-500 rounded-t-2xl px-4 py-2.5 flex items-center justify-between",style:{cursor:"move"},onMouseDown:ce,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(me,{size:14,className:"text-white/50"}),e.jsx("h3",{className:"text-white font-bold text-sm",children:"Scientific Calculator"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{onClick:()=>se(r=>!r),className:"p-1.5 rounded-lg hover:bg-slate-200/70 transition-colors",title:"Keyboard shortcuts",children:e.jsx(ve,{size:14,className:"text-white"})}),e.jsx("button",{onClick:()=>ee(!w),className:"p-1.5 rounded-lg hover:bg-slate-200/70 transition-colors",children:w?e.jsx(fe,{size:14,className:"text-white"}):e.jsx(pe,{size:14,className:"text-white"})}),e.jsx("button",{onClick:f,className:"p-1.5 rounded-lg hover:bg-slate-200/70 transition-colors",children:e.jsx(be,{size:14,className:"text-white"})})]})]}),!w&&K,w&&e.jsx("div",{className:"bg-slate-50 rounded-b-2xl p-3 border border-slate-200 border-t-0",children:e.jsx("p",{className:"text-right text-[#0a1628] font-mono font-bold text-lg",children:g})})]})})};export{Re as default};
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/SearchBar-ldiC0sUv.js DELETED
@@ -1 +0,0 @@
1
- import{r as o,j as e}from"./vendor-react-Dexh7fmo.js";import{S as m}from"./search-Do6u3pFt.js";import{m as n,e as C}from"./index-D4nJsLyx.js";import{X as k}from"./x-BONnp2RF.js";import{C as S}from"./clock-DUJO-a50.js";import{B as a}from"./book-open-BH50GByv.js";import{T as c}from"./trending-up-D-vj8Gbq.js";import{U as d}from"./users-HMf2sdE3.js";import{G}from"./graduation-cap-Df8fGPxp.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-firestore-BML5nJHm.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";const K=({placeholder:b="Search anything...",userRole:p="student",onSelect:y})=>{const[i,l]=o.useState(""),[g,r]=o.useState(!1),[x,f]=o.useState([]),u=o.useRef(null),v=()=>p==="student"?[{id:"1",type:"module",title:"General Mathematics",subtitle:"Grade 11 โ€ข Functions & Business Math",icon:a},{id:"2",type:"module",title:"Statistics & Probability",subtitle:"Grade 11 โ€ข Distributions & Testing",icon:a},{id:"3",type:"module",title:"Pre-Calculus",subtitle:"Grade 12 โ€ข Analytic Geometry & Trig",icon:a},{id:"4",type:"module",title:"Basic Calculus",subtitle:"Grade 12 โ€ข Limits & Derivatives",icon:a},{id:"5",type:"page",title:"AI Chat",subtitle:"Get help from AI tutor",icon:c},{id:"6",type:"page",title:"My Progress",subtitle:"View your achievements",icon:c}]:p==="teacher"?[{id:"1",type:"student",title:"Alex Johnson",subtitle:"Grade 11 โ€ข Level 12",icon:d},{id:"2",type:"student",title:"Sarah Williams",subtitle:"Grade 12 โ€ข Level 11",icon:d},{id:"3",type:"module",title:"Gen Math Quiz 5",subtitle:"12 submissions",icon:a},{id:"4",type:"page",title:"Analytics",subtitle:"Class performance overview",icon:c},{id:"5",type:"page",title:"Create Assignment",subtitle:"New homework or quiz",icon:a}]:[{id:"1",type:"teacher",title:"Prof. Anderson",subtitle:"48 students โ€ข Math Dept",icon:G},{id:"2",type:"student",title:"Alex Johnson",subtitle:"Top Performer โ€ข Level 12",icon:d},{id:"3",type:"page",title:"System Settings",subtitle:"Platform configuration",icon:c},{id:"4",type:"page",title:"Reports",subtitle:"Export analytics",icon:a},{id:"5",type:"page",title:"User Management",subtitle:"Manage accounts",icon:d}],w=["Functions and Relations","Normal Distribution","AI Chat"];o.useEffect(()=>{if(i.trim()){const s=v().filter(h=>h.title.toLowerCase().includes(i.toLowerCase())||h.subtitle?.toLowerCase().includes(i.toLowerCase()));f(s)}else f([])},[i]);const j=t=>{l(""),r(!1),y?.(t)},N=()=>{l(""),u.current?.focus()};return o.useEffect(()=>{const t=s=>{s.ctrlKey&&s.key.toLowerCase()==="k"&&(s.preventDefault(),u.current?.focus(),r(!0))};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[]),e.jsxs("div",{className:"relative w-full max-w-xl",children:[e.jsxs("div",{className:"relative",children:[e.jsx(m,{className:"absolute left-3.5 top-1/2 -translate-y-1/2 text-slate-500",size:18}),e.jsx("input",{ref:u,id:"global-search",name:"global-search","aria-label":"Search anything",type:"text",value:i,onChange:t=>l(t.target.value),onFocus:()=>r(!0),placeholder:b,className:"w-full pl-11 pr-24 py-2.5 bg-white border border-[#dde3eb] rounded-lg text-[#0a1628] placeholder-[#a8a5b3] font-body text-sm focus:bg-white focus:border-sky-400 focus:ring-2 focus:ring-sky-400/15 focus:outline-none transition-all"}),e.jsxs("div",{className:"absolute right-2 top-1/2 -translate-y-1/2 flex items-center gap-1",children:[i&&e.jsx(n.button,{initial:{scale:0},animate:{scale:1},exit:{scale:0},whileHover:{scale:1.1},whileTap:{scale:.9},onClick:N,className:"p-1.5 text-slate-500 hover:text-[#5a6578] hover:bg-[#edf1f7] rounded-md transition-colors",children:e.jsx(k,{size:14})}),e.jsx("kbd",{className:"hidden sm:inline-flex px-2 py-0.5 text-[10px] font-body font-semibold text-slate-500 bg-[#edf1f7] border border-[#dde3eb] rounded-md",children:"Ctrl+K"})]})]}),e.jsx(C,{children:g&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>r(!1)}),e.jsx(n.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},className:"absolute top-full left-0 right-0 mt-2 bg-white rounded-xl shadow-lg border border-[#dde3eb] z-50 overflow-hidden max-h-96 overflow-y-auto",children:i.trim()?x.length>0?e.jsxs("div",{className:"p-2",children:[e.jsx("div",{className:"px-3 py-2 text-[10px] font-body font-semibold text-slate-500 uppercase tracking-wider",children:"Results"}),x.map(t=>{const s=t.icon||m;return e.jsxs(n.button,{whileHover:{backgroundColor:"rgba(248, 247, 244, 1)"},onClick:()=>j(t),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-lg text-left transition-colors",children:[e.jsx("div",{className:"w-9 h-9 bg-sky-500/10 rounded-lg flex items-center justify-center text-sky-600 flex-shrink-0",children:e.jsx(s,{size:16})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h4",{className:"text-sm font-body font-semibold text-[#0a1628] truncate",children:t.title}),t.subtitle&&e.jsx("p",{className:"text-xs font-body text-[#5a6578] truncate",children:t.subtitle})]})]},t.id)})]}):e.jsxs("div",{className:"p-8 text-center",children:[e.jsx(m,{size:40,className:"text-[#d1cec6] mx-auto mb-3"}),e.jsx("p",{className:"text-[#5a6578] font-body text-sm",children:"No results found"}),e.jsx("p",{className:"text-slate-500 font-body text-xs mt-1",children:"Try a different search term"})]}):e.jsxs("div",{className:"p-2",children:[e.jsx("div",{className:"px-3 py-2 text-[10px] font-body font-semibold text-slate-500 uppercase tracking-wider",children:"Recent Searches"}),w.map((t,s)=>e.jsxs(n.button,{whileHover:{backgroundColor:"rgba(248, 247, 244, 1)"},onClick:()=>l(t),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-lg text-left transition-colors",children:[e.jsx(S,{size:16,className:"text-slate-500 flex-shrink-0"}),e.jsx("span",{className:"text-sm font-body text-[#0a1628]",children:t})]},s))]})})]})})]})};export{K as default};
 
 
assets/SettingsModal-C-nK3nbS.js DELETED
@@ -1,11 +0,0 @@
1
- import{r as i,j as e}from"./vendor-react-Dexh7fmo.js";import{c as ee,e as be,m as S,D as ue,t as c}from"./index-D4nJsLyx.js";import{B as x}from"./button-BpeUVhBo.js";import{I as l}from"./input-DBkKXOmF.js";import{S as m}from"./switch-eyvBOdtY.js";import W from"./ConfirmModal-DGrnpObD.js";import{U as fe}from"./user-CaTzqgOL.js";import{B as pe}from"./bell-CbSbac2W.js";import{S as ye}from"./shield-L33jkK5w.js";import{G as je}from"./globe-BMa4SWkV.js";import{D as Y}from"./download-PWUf0XJa.js";import{X as Z}from"./x-BONnp2RF.js";import{L as ge}from"./lock-_59co5m5.js";import{C as Ne}from"./clock-DUJO-a50.js";import{T as ve}from"./trash-2-BoXE_mye.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-firestore-BML5nJHm.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";import"./vendor-radix-BRdei-zg.js";import"./clsx-B-dksMZM.js";import"./utils-BQQgILNW.js";import"./log-out-BqGKt-tT.js";/**
2
- * @license lucide-react v0.487.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 we=[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]],ke=ee("palette",we);/**
7
- * @license lucide-react v0.487.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 Ce=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],Se=ee("smartphone",Ce),F=()=>JSON.parse(JSON.stringify(ue)),We=({isOpen:u,onClose:g,profileData:o,onSave:I,settingsData:v,onSaveSettings:L,onApplySettingsPreview:N,onUpdatePassword:E,onExportData:H,onClearCache:O,onDeleteAccount:z,onResetData:w})=>{const[h,te]=i.useState("account"),[a,d]=i.useState({}),[n,U]=i.useState(F()),[P,G]=i.useState(!1),[p,_]=i.useState(!1),[A,Q]=i.useState(!1),[R,V]=i.useState(!1),[y,X]=i.useState(!1),[se,k]=i.useState(!1),[ae,C]=i.useState(!1),[ne,j]=i.useState(!1),[b,B]=i.useState(!1),[J,f]=i.useState(""),T=i.useRef(!1),M=i.useRef(F());i.useEffect(()=>{if(!u){T.current=!1;return}if(T.current)return;T.current=!0;const t=v?JSON.parse(JSON.stringify(v)):F();M.current=t,d({uid:o?.uid,name:o?.name||"",email:o?.email||"",phone:o?.phone||"",photo:o?.photo||"",avatarLayers:o?.avatarLayers,role:o?.role,lrn:o?.lrn||"",grade:o?.grade||"",section:o?.section||"",school:o?.school||"",department:o?.department||"",subject:o?.subject||"",yearsOfExperience:o?.yearsOfExperience||"",qualification:o?.qualification||"",position:o?.position||""}),U(t)},[u,o,v]),i.useEffect(()=>{u&&N?.(n)},[u,n,N]),i.useEffect(()=>{if(!u)return;const t=s=>{s.key==="Escape"&&(N?.(M.current),g())};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[u,g,N,v]);const $=i.useMemo(()=>[{id:"account",label:"Account",icon:fe},{id:"notifications",label:"Notifications",icon:pe},{id:"appearance",label:"Appearance",icon:ke},{id:"privacy",label:"Privacy & Security",icon:ye},{id:"learning",label:"Learning",icon:je},{id:"data",label:"Data & Storage",icon:Y}],[]),r=t=>{U(s=>t(s))},re=async()=>{G(!0);try{I&&await I(a),L&&await L(n),g()}catch(t){console.error("Error saving settings:",t),c.error(t instanceof Error?t.message:"Failed to save settings")}finally{G(!1)}},q=()=>{k(!1),C(!1),j(!1),f(""),N?.(M.current),g()},ie=()=>{!w||p||k(!0)},le=async()=>{if(!(!w||p)){k(!1),_(!0);try{await w(),c.success("Testing data reset completed")}catch(t){console.error("Error resetting testing data:",t),c.error(t instanceof Error?t.message:"Failed to reset testing data")}finally{_(!1)}}},oe=async()=>{if(!E){c.info("Password update is not available in this environment.");return}f(""),j(!0)},K=async()=>{if(!E||b)return;const t=J.trim();if(!t){c.error("Password is required.");return}if(t.length<8){c.error("Password must be at least 8 characters long.");return}B(!0);try{await E(t),c.success("Password updated successfully."),j(!1),f("")}catch(s){console.error("Error updating password:",s),c.error(s instanceof Error?s.message:"Failed to update password")}finally{B(!1)}},ce=()=>{c.info("Two-factor authentication setup is not enabled for this project yet.")},de=async()=>{if(!H||A){c.info("Data export is not available right now.");return}Q(!0);try{await H()}catch(t){console.error("Error exporting data:",t),c.error(t instanceof Error?t.message:"Failed to export data")}finally{Q(!1)}},xe=async()=>{if(!O||R){c.info("Cache clearing is not available right now.");return}V(!0);try{await O()}catch(t){console.error("Error clearing cache:",t),c.error(t instanceof Error?t.message:"Failed to clear cache")}finally{V(!1)}},me=()=>{if(!z||y){c.info("Account deletion is not available right now.");return}C(!0)},he=async()=>{if(!(!z||y)){C(!1),X(!0);try{await z(),g()}catch(t){console.error("Error deleting account:",t),c.error(t instanceof Error?t.message:"Failed to delete account")}finally{X(!1)}}};return u?e.jsx(be,{children:e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"fixed inset-0 z-[100] flex items-center justify-center p-4",children:[e.jsx(S.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:q,className:"absolute inset-0 bg-black/50 backdrop-blur-sm"}),e.jsxs(S.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.2},className:"relative bg-[#f7f9fc] rounded-2xl shadow-2xl border border-[#dde3eb] w-full max-w-4xl max-h-[85vh] overflow-hidden flex",children:[e.jsxs("div",{className:"w-64 bg-slate-50 border-r border-slate-200 p-6 overflow-y-auto",children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("h2",{className:"text-xl font-display font-bold text-[#0a1628]",children:"Settings"}),e.jsx("p",{className:"text-xs text-slate-500 mt-1 font-body",children:"Manage your preferences"})]}),e.jsx("nav",{className:"space-y-1",children:$.map(t=>{const s=t.icon;return e.jsxs("button",{onClick:()=>te(t.id),className:`w-full flex items-center gap-3 px-4 py-3 rounded-xl text-left transition-all ${h===t.id?"bg-sky-50 text-sky-700 shadow-sm":"text-slate-500 hover:bg-slate-100 hover:text-sky-700"}`,children:[e.jsx(s,{size:18}),e.jsx("span",{className:"text-sm font-medium",children:t.label})]},t.id)})})]}),e.jsxs("div",{className:"flex-1 flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-[#dde3eb]",children:[e.jsx("h3",{className:"text-lg font-display font-bold text-[#0a1628]",children:$.find(t=>t.id===h)?.label}),e.jsx("button",{onClick:q,className:"p-2 hover:bg-[#edf1f7] rounded-xl transition-colors",children:e.jsx(Z,{size:20,className:"text-[#5a6578]"})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-6",children:[h==="account"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-bold text-[#5a6578] mb-2 block font-body uppercase tracking-wider text-xs",children:"Full Name"}),e.jsx(l,{type:"text",value:a.name||"",onChange:t=>d(s=>({...s,name:t.target.value})),className:"max-w-md"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-bold text-[#5a6578] mb-2 block font-body uppercase tracking-wider text-xs",children:"Email Address"}),e.jsx(l,{type:"email",value:a.email||"",onChange:t=>d(s=>({...s,email:t.target.value})),className:"max-w-md"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-bold text-[#5a6578] mb-2 block font-body uppercase tracking-wider text-xs",children:"Phone Number"}),e.jsx(l,{type:"tel",value:a.phone||"",onChange:t=>d(s=>({...s,phone:t.target.value})),className:"max-w-md"})]}),a.role==="student"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-bold text-[#5a6578] mb-2 block font-body uppercase tracking-wider text-xs",children:"Learner's Reference Number (LRN)"}),e.jsx(l,{type:"text",value:a.lrn||"",onChange:t=>d(s=>({...s,lrn:t.target.value})),className:"max-w-md"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-bold text-[#5a6578] mb-2 block font-body uppercase tracking-wider text-xs",children:"Grade Level"}),e.jsx(l,{type:"text",value:a.grade||"",onChange:t=>d(s=>({...s,grade:t.target.value})),className:"max-w-md"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-bold text-[#5a6578] mb-2 block font-body uppercase tracking-wider text-xs",children:"Section"}),e.jsx(l,{type:"text",value:a.section||"",onChange:t=>d(s=>({...s,section:t.target.value})),className:"max-w-md"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-bold text-[#5a6578] mb-2 block font-body uppercase tracking-wider text-xs",children:"School"}),e.jsx(l,{type:"text",value:a.school||"",onChange:t=>d(s=>({...s,school:t.target.value})),className:"max-w-md"})]})]}),a.role==="teacher"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-bold text-[#5a6578] mb-2 block font-body uppercase tracking-wider text-xs",children:"Department"}),e.jsx(l,{type:"text",value:a.department||"",onChange:t=>d(s=>({...s,department:t.target.value})),className:"max-w-md"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-bold text-[#5a6578] mb-2 block font-body uppercase tracking-wider text-xs",children:"Subject"}),e.jsx(l,{type:"text",value:a.subject||"",onChange:t=>d(s=>({...s,subject:t.target.value})),className:"max-w-md"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-bold text-[#5a6578] mb-2 block font-body uppercase tracking-wider text-xs",children:"Years of Experience"}),e.jsx(l,{type:"text",value:a.yearsOfExperience||"",onChange:t=>d(s=>({...s,yearsOfExperience:t.target.value})),className:"max-w-md"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-bold text-[#5a6578] mb-2 block font-body uppercase tracking-wider text-xs",children:"Qualification"}),e.jsx(l,{type:"text",value:a.qualification||"",onChange:t=>d(s=>({...s,qualification:t.target.value})),className:"max-w-md"})]})]}),a.role==="admin"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-bold text-[#5a6578] mb-2 block font-body uppercase tracking-wider text-xs",children:"Position"}),e.jsx(l,{type:"text",value:a.position||"",onChange:t=>d(s=>({...s,position:t.target.value})),className:"max-w-md"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-bold text-[#5a6578] mb-2 block font-body uppercase tracking-wider text-xs",children:"Department"}),e.jsx(l,{type:"text",value:a.department||"",onChange:t=>d(s=>({...s,department:t.target.value})),className:"max-w-md"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-bold text-[#5a6578] mb-2 block font-body uppercase tracking-wider text-xs",children:"Role"}),e.jsx(l,{type:"text",value:a.role||"",className:"max-w-md bg-slate-100",disabled:!0})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-bold text-[#5a6578] mb-2 block font-body uppercase tracking-wider text-xs",children:"Change Password"}),e.jsxs(x,{variant:"outline",className:"rounded-xl",onClick:oe,children:[e.jsx(ge,{size:16,className:"mr-2"}),"Update Password"]})]}),e.jsx("div",{className:"pt-4 border-t border-[#dde3eb]",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] font-body",children:"Two-Factor Authentication"}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Add an extra layer of security"})]}),e.jsx(x,{variant:"outline",size:"sm",className:"rounded-xl",onClick:ce,children:"Enable"})]})})]}),h==="notifications"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between py-3 border-b border-[#dde3eb]",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] font-body",children:"Email Notifications"}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Receive updates via email"})]}),e.jsx(m,{checked:n.notifications.emailNotifications,onCheckedChange:t=>r(s=>({...s,notifications:{...s.notifications,emailNotifications:t}}))})]}),e.jsxs("div",{className:"flex items-center justify-between py-3 border-b border-[#dde3eb]",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] font-body",children:"Push Notifications"}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Get notified on your device"})]}),e.jsx(m,{checked:n.notifications.pushNotifications,onCheckedChange:t=>r(s=>({...s,notifications:{...s.notifications,pushNotifications:t}}))})]}),e.jsxs("div",{className:"flex items-center justify-between py-3 border-b border-[#dde3eb]",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] font-body",children:"Sound Effects"}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Play sounds for notifications"})]}),e.jsx(m,{checked:n.notifications.soundEnabled,onCheckedChange:t=>r(s=>({...s,notifications:{...s.notifications,soundEnabled:t}}))})]}),e.jsxs("div",{className:"pt-4",children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] mb-3 font-body",children:"Notification Types"}),e.jsx("div",{className:"space-y-3",children:[{key:"quizReminders",label:"Quiz Reminders"},{key:"newContent",label:"New Content"},{key:"achievements",label:"Achievements"},{key:"streakAlerts",label:"Streak Alerts"},{key:"weeklySummary",label:"Weekly Summary"}].map(t=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("input",{type:"checkbox",checked:n.notifications.notificationTypes[t.key],onChange:s=>r(D=>({...D,notifications:{...D.notifications,notificationTypes:{...D.notifications.notificationTypes,[t.key]:s.target.checked}}})),className:"w-4 h-4 rounded border-[#dde3eb] text-sky-600 focus:ring-sky-500"}),e.jsx("span",{className:"text-sm text-[#0a1628] font-body",children:t.label})]},t.key))})]}),e.jsxs("div",{className:"pt-4 border-t border-[#dde3eb]",children:[e.jsxs("label",{className:"text-sm font-bold text-[#5a6578] mb-2 block font-body uppercase tracking-wider text-xs",children:[e.jsx(Ne,{size:16,className:"inline mr-2"}),"Quiet Hours"]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(l,{type:"time",value:n.notifications.quietHours.start,onChange:t=>r(s=>({...s,notifications:{...s.notifications,quietHours:{...s.notifications.quietHours,start:t.target.value}}})),className:"w-32"}),e.jsx("span",{className:"text-[#5a6578]",children:"to"}),e.jsx(l,{type:"time",value:n.notifications.quietHours.end,onChange:t=>r(s=>({...s,notifications:{...s.notifications,quietHours:{...s.notifications.quietHours,end:t.target.value}}})),className:"w-32"})]}),e.jsx("p",{className:"text-xs text-slate-500 mt-2",children:"No notifications during this time"})]})]}),h==="appearance"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between py-3 border-b border-[#dde3eb]",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] font-body",children:"Dark Mode"}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Smart invert colors like extension dark mode"})]}),e.jsx(m,{checked:n.appearance.darkMode,onCheckedChange:t=>r(s=>({...s,appearance:{...s.appearance,darkMode:t}}))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-bold text-[#5a6578] mb-3 block font-body uppercase tracking-wider text-xs",children:"Font Size"}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("span",{className:"text-xs text-slate-500",children:"Small"}),e.jsx("input",{type:"range",min:"12",max:"20",value:n.appearance.fontSize,onChange:t=>r(s=>({...s,appearance:{...s.appearance,fontSize:Number(t.target.value)}})),className:"flex-1"}),e.jsx("span",{className:"text-xs text-slate-500",children:"Large"})]})]}),e.jsxs("div",{className:"flex items-center justify-between py-3 border-b border-[#dde3eb]",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] font-body",children:"Compact View"}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Show more content on screen"})]}),e.jsx(m,{checked:n.appearance.compactView,onCheckedChange:t=>r(s=>({...s,appearance:{...s.appearance,compactView:t}}))})]}),e.jsxs("div",{className:"flex items-center justify-between py-3 border-b border-[#dde3eb]",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] font-body",children:"Reduce Animations"}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Minimize motion effects"})]}),e.jsx(m,{checked:n.appearance.reduceAnimations,onCheckedChange:t=>r(s=>({...s,appearance:{...s.appearance,reduceAnimations:t}}))})]})]}),h==="privacy"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between py-3 border-b border-[#dde3eb]",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] font-body",children:"Profile Visibility"}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Who can see your profile"})]}),e.jsxs("select",{value:n.privacy.profileVisibility,onChange:t=>r(s=>({...s,privacy:{...s.privacy,profileVisibility:t.target.value}})),className:"px-3 py-2 border border-[#dde3eb] rounded-lg text-sm bg-white text-[#0a1628]",children:[e.jsx("option",{value:"everyone",children:"Everyone"}),e.jsx("option",{value:"students_and_staff",children:"Students and Staff"}),e.jsx("option",{value:"private",children:"Private"})]})]}),e.jsxs("div",{className:"flex items-center justify-between py-3 border-b border-[#dde3eb]",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] font-body",children:"Show Activity Status"}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Let others see when you're online"})]}),e.jsx(m,{checked:n.privacy.showActivityStatus,onCheckedChange:t=>r(s=>({...s,privacy:{...s.privacy,showActivityStatus:t}}))})]}),e.jsxs("div",{className:"flex items-center justify-between py-3 border-b border-[#dde3eb]",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] font-body",children:"Data Sharing"}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Share anonymous usage data"})]}),e.jsx(m,{checked:n.privacy.dataSharing,onCheckedChange:t=>r(s=>({...s,privacy:{...s.privacy,dataSharing:t}}))})]})]}),h==="learning"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-bold text-[#5a6578] mb-2 block font-body uppercase tracking-wider text-xs",children:"Daily XP Goal"}),e.jsx(l,{type:"number",value:n.learning.dailyXpGoal,onChange:t=>r(s=>({...s,learning:{...s.learning,dailyXpGoal:Number(t.target.value||0)}})),className:"max-w-xs"}),e.jsx("p",{className:"text-xs text-slate-500 mt-2",children:"Set your daily learning target"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-bold text-[#5a6578] mb-2 block font-body uppercase tracking-wider text-xs",children:"Preferred Study Time"}),e.jsxs("select",{value:n.learning.preferredStudyTime,onChange:t=>r(s=>({...s,learning:{...s.learning,preferredStudyTime:t.target.value}})),className:"px-3 py-2 border border-[#dde3eb] rounded-lg text-sm w-full max-w-xs bg-white text-[#0a1628]",children:[e.jsx("option",{value:"morning",children:"Morning (6AM - 12PM)"}),e.jsx("option",{value:"afternoon",children:"Afternoon (12PM - 6PM)"}),e.jsx("option",{value:"evening",children:"Evening (6PM - 12AM)"}),e.jsx("option",{value:"night",children:"Night (12AM - 6AM)"})]})]}),e.jsxs("div",{className:"flex items-center justify-between py-3 border-b border-[#dde3eb]",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] font-body",children:"Auto-play Next Lesson"}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Automatically start the next lesson"})]}),e.jsx(m,{checked:n.learning.autoPlayLessons,onCheckedChange:t=>r(s=>({...s,learning:{...s.learning,autoPlayLessons:t}}))})]}),e.jsxs("div",{className:"flex items-center justify-between py-3 border-b border-[#dde3eb]",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] font-body",children:"Show Hints During Quizzes"}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Display helpful hints for questions"})]}),e.jsx(m,{checked:n.learning.showHints,onCheckedChange:t=>r(s=>({...s,learning:{...s.learning,showHints:t}}))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-bold text-[#5a6578] mb-2 block font-body uppercase tracking-wider text-xs",children:"Quiz Difficulty Preference"}),e.jsxs("select",{value:n.learning.quizDifficultyPreference,onChange:t=>r(s=>({...s,learning:{...s.learning,quizDifficultyPreference:t.target.value}})),className:"px-3 py-2 border border-[#dde3eb] rounded-lg text-sm w-full max-w-xs bg-white text-[#0a1628]",children:[e.jsx("option",{value:"adaptive",children:"Adaptive (Recommended)"}),e.jsx("option",{value:"easy",children:"Easy"}),e.jsx("option",{value:"medium",children:"Medium"}),e.jsx("option",{value:"hard",children:"Hard"})]})]}),e.jsxs("div",{className:"pt-4 border-t border-[#dde3eb]",children:[e.jsxs("label",{className:"text-sm font-bold text-[#5a6578] mb-2 block font-body uppercase tracking-wider text-xs",children:[e.jsx(Se,{size:16,className:"inline mr-2"}),"Study Reminders"]}),e.jsx(l,{type:"time",value:n.learning.studyReminderTime,onChange:t=>r(s=>({...s,learning:{...s.learning,studyReminderTime:t.target.value}})),className:"w-32"}),e.jsx("p",{className:"text-xs text-slate-500 mt-2",children:"Daily reminder to study"})]})]}),h==="data"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"p-4 bg-sky-50 border border-sky-200 rounded-xl",children:[e.jsx("h4",{className:"text-sm font-bold text-sky-900 mb-1 font-body",children:"Download Your Data"}),e.jsx("p",{className:"text-xs text-sky-700 mb-3",children:"Export all your learning data and progress"}),e.jsxs(x,{variant:"outline",size:"sm",className:"rounded-xl",onClick:de,disabled:A,children:[e.jsx(Y,{size:16,className:"mr-2"}),A?"Exporting...":"Request Data Export"]})]}),e.jsxs("div",{className:"p-4 bg-white border border-[#dde3eb] rounded-xl",children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] mb-1 font-body",children:"Clear Cache"}),e.jsx("p",{className:"text-xs text-[#5a6578] mb-3",children:"Free up space by clearing cached data"}),e.jsx(x,{variant:"outline",size:"sm",className:"rounded-xl",onClick:xe,disabled:R,children:R?"Clearing...":"Clear Cache"})]}),e.jsxs("div",{className:"p-4 bg-rose-50 border border-rose-200 rounded-xl",children:[e.jsx("h4",{className:"text-sm font-bold text-rose-900 mb-1",children:"Reset Progress"}),e.jsxs("p",{className:"text-xs text-rose-700 mb-3",children:[(a.role||"student")==="student"&&"Reset quizzes, diagnostic state, XP, and learning progress for retesting.",a.role==="teacher"&&"Reset imported records, managed classrooms, and teacher-generated quiz artifacts for retesting.",a.role==="admin"&&"Reset admin testing artifacts like personal audit/content update records for QA loops."]}),e.jsx(x,{variant:"outline",size:"sm",className:"rounded-xl text-rose-700 border-rose-300",disabled:!w||p,onClick:ie,children:p?"Resetting...":"Reset Testing Data"})]}),a.role==="admin"?e.jsxs("div",{className:"p-4 bg-red-50 border border-red-200 rounded-xl",children:[e.jsx("h4",{className:"text-sm font-bold text-red-900 mb-1",children:"Delete Account"}),e.jsx("p",{className:"text-xs text-red-700 mb-3",children:"Permanently delete your account and all data"}),e.jsxs(x,{variant:"outline",size:"sm",className:"rounded-xl text-red-700 border-red-300",onClick:me,disabled:y,children:[e.jsx(ve,{size:16,className:"mr-2"}),y?"Deleting...":"Delete Account"]})]}):e.jsxs("div",{className:"p-4 bg-emerald-50 border border-emerald-200 rounded-xl",children:[e.jsx("h4",{className:"text-sm font-bold text-emerald-900 mb-1 font-body",children:"Protected Account Controls"}),e.jsx("p",{className:"text-xs text-emerald-700",children:"Account deletion is restricted to administrator accounts."})]})]})]}),e.jsxs("div",{className:"p-6 border-t border-[#dde3eb] bg-[#edf1f7] flex items-center justify-between",children:[e.jsx("p",{className:"text-xs text-slate-500 font-body",children:"MathPulse AI v2.1.0"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(x,{variant:"outline",onClick:q,className:"rounded-lg border-[#dde3eb]",disabled:P,children:"Cancel"}),e.jsx(x,{onClick:re,className:"rounded-lg bg-sky-600 hover:bg-sky-700 text-white",disabled:P,children:P?"Saving...":"Save Changes"})]})]})]})]})]}),ne?e.jsx(S.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[130] bg-black/50 backdrop-blur-sm flex items-center justify-center p-4",onClick:()=>{b||(j(!1),f(""))},children:e.jsxs(S.div,{initial:{opacity:0,scale:.95,y:12},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:12},transition:{duration:.2},className:"w-full max-w-md rounded-2xl border border-[#dde3eb] bg-[#f7f9fc] shadow-2xl",onClick:t=>t.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[#dde3eb] px-6 py-4",children:[e.jsx("h4",{className:"text-lg font-display font-bold text-[#0a1628]",children:"Update Password"}),e.jsx("button",{onClick:()=>{b||(j(!1),f(""))},className:"p-2 rounded-xl hover:bg-[#edf1f7] transition-colors","aria-label":"Close password update dialog",children:e.jsx(Z,{size:18,className:"text-[#5a6578]"})})]}),e.jsxs("div",{className:"px-6 py-5 space-y-4",children:[e.jsx("p",{className:"text-sm text-[#5a6578]",children:"Enter a new password with at least 8 characters."}),e.jsx(l,{type:"password",value:J,onChange:t=>f(t.target.value),placeholder:"New password",autoFocus:!0,onKeyDown:t=>{t.key==="Enter"&&(t.preventDefault(),K())},disabled:b}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(x,{variant:"outline",onClick:()=>{b||(j(!1),f(""))},disabled:b,children:"Cancel"}),e.jsx(x,{onClick:K,className:"bg-sky-600 hover:bg-sky-700 text-white",disabled:b,children:b?"Updating...":"Update Password"})]})]})]})}):null,e.jsx(W,{isOpen:se,onClose:()=>{p||k(!1)},onConfirm:le,title:"Reset Testing Data?",message:`Reset ${a.role||"student"} testing data? This action is for QA/demo use and cannot be undone.`,confirmText:p?"Resetting...":"Reset Data",cancelText:"Cancel",type:"warning",icon:"warning",zIndexClass:"z-[130]"}),e.jsx(W,{isOpen:ae,onClose:()=>{y||C(!1)},onConfirm:he,title:"Delete Account?",message:"Delete account permanently? This action cannot be undone.",confirmText:y?"Deleting...":"Delete Account",cancelText:"Cancel",type:"danger",icon:"delete",zIndexClass:"z-[130]"})]})}):null};export{We as default};
 
 
 
 
 
 
 
 
 
 
 
 
assets/Sidebar-xBQ3Qnyw.js DELETED
@@ -1 +0,0 @@
1
- import{r as S,j as e}from"./vendor-react-Dexh7fmo.js";import{C as k,S as C,a as L,L as d}from"./LogoutActionButton-FS5OGZjL.js";import{c as M}from"./utils-BQQgILNW.js";import{m as o}from"./index-D4nJsLyx.js";import{X as A}from"./x-BONnp2RF.js";import{C as z}from"./chevron-right-COMox1Xb.js";import{U as f}from"./users-HMf2sdE3.js";import{B as c}from"./book-open-BH50GByv.js";import{C as u}from"./chart-column-D5mAWcRx.js";import{S as B}from"./shield-L33jkK5w.js";import{M as I}from"./message-square-DSAS4TVL.js";import{G as E}from"./graduation-cap-Df8fGPxp.js";import{S as H}from"./swords-8_KH18p7.js";import{T}from"./trophy-C2nVcZnb.js";import{S as $}from"./shirt-BMZy0pq4.js";import"./log-out-BqGKt-tT.js";import"./clsx-B-dksMZM.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-firestore-BML5nJHm.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";const oe=({activeTab:i,setActiveTab:g,userRole:m="student",onOpenSettings:j,onLogout:b,sidebarCollapsed:a=!1,setSidebarCollapsed:p,mode:v="desktop",onRequestClose:x})=>{const[l,h]=S.useState(!1),r=v==="mobile",s=!r&&a&&!l,y=!r,w=m==="admin"?[{label:"Management",items:[{icon:d,label:"Overview"},{icon:f,label:"User Management"},{icon:c,label:"Content"}]},{label:"Insights",items:[{icon:u,label:"Analytics"},{icon:B,label:"Audit Log"}]}]:m==="teacher"?[{label:"Teaching",items:[{icon:d,label:"Dashboard"},{icon:f,label:"My Students"},{icon:c,label:"Classes"}]},{label:"Insights",items:[{icon:u,label:"Analytics"}]}]:[{label:"Learn",items:[{icon:d,label:"Dashboard"},{icon:c,label:"Modules"},{icon:I,label:"AI Chat"}]},{label:"Progress",items:[{icon:E,label:"Grades",displayLabel:"Assessment"},{icon:H,label:"Quiz Battle",displayLabel:"Quiz Battle"},{icon:T,label:"Leaderboard",displayLabel:"Leadership Board"}]},{label:"Customization",items:[{icon:$,label:"Avatar Studio",displayLabel:"Avatar Studio"}]}];return e.jsxs(o.aside,{initial:!1,animate:r?{width:280}:{width:a&&!l?80:280},transition:{type:"spring",stiffness:360,damping:34},onMouseEnter:()=>y&&a&&h(!0),onMouseLeave:()=>h(!1),className:M("h-full bg-[#f7f9fc] border border-[#dde3eb] shadow-sm flex flex-col",r?"rounded-2xl p-4":"rounded-3xl p-5"),children:[e.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[e.jsxs("div",{className:`mb-8 flex items-center ${s?"justify-center":"justify-between"}`,children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("img",{src:"/mathpulse_logo.png",alt:"MathPulse AI",className:"w-12 h-12 object-contain drop-shadow-md flex-shrink-0"}),(!s||l)&&e.jsx("div",{children:e.jsx("h2",{className:"text-base font-bold font-display text-[#0a1628] whitespace-nowrap",children:"MathPulse AI"})})]}),r&&x&&e.jsx("button",{onClick:x,className:"p-2 hover:bg-[#dde3eb] rounded-lg transition-colors text-[#5a6578]","aria-label":"Close navigation",children:e.jsx(A,{size:20})}),!r&&p&&(!a||l)&&e.jsx(o.button,{whileHover:{scale:1.1},whileTap:{scale:.95},onClick:()=>p(!a),className:"p-2 hover:bg-[#dde3eb] rounded-lg transition-colors text-[#5a6578]","aria-label":a?"Expand sidebar":"Collapse sidebar",title:a?"Expand sidebar":"Collapse sidebar",children:a?e.jsx(z,{size:20}):e.jsx(k,{size:20})})]}),e.jsx("nav",{className:"flex-1 min-h-0 overflow-y-auto space-y-5 pr-1",children:w.map((n,N)=>e.jsxs("div",{children:[s?e.jsx("div",{className:"px-4 mb-2 flex items-center gap-2",children:e.jsx("div",{className:"flex-1 h-[1px] bg-[#dde3eb]"})}):n.label&&e.jsx("p",{className:"px-4 mb-2 text-[10px] font-bold text-[#5a6578] uppercase tracking-widest",children:n.label}),e.jsx("div",{className:"space-y-1",children:n.items.map(t=>e.jsxs(o.button,{whileHover:{x:2},whileTap:{scale:.98},onClick:()=>g(t.label),className:`w-full flex items-center gap-3 px-4 py-3 rounded-2xl cursor-pointer transition-all duration-200 border whitespace-nowrap ${s?"justify-center":""} ${i===t.label?"bg-sky-50 border-sky-200 shadow-sm text-sky-700":"bg-transparent border-transparent text-[#5a6578] hover:bg-[#dde3eb] hover:border-[#dde3eb] hover:text-[#0a1628]"}`,children:[e.jsx(t.icon,{size:18,strokeWidth:i===t.label?2.5:2,className:"flex-shrink-0"}),(!s||l)&&e.jsx("span",{className:"font-body font-bold text-xs",children:t.displayLabel||t.label}),i===t.label&&(!s||l)&&e.jsx(o.div,{layoutId:"sidebar-active-indicator",className:"ml-auto w-2 h-2 rounded-full bg-sky-500",transition:{type:"spring",duration:.4}})]},t.label))})]},N))})]}),e.jsxs("div",{className:"mt-4 space-y-2 border-t border-[#dde3eb] pt-4",children:[e.jsxs(o.button,{whileHover:{x:2},whileTap:{scale:.98},className:`w-full flex items-center gap-3 px-4 py-3 rounded-2xl text-[#5a6578] font-bold border border-transparent hover:bg-[#dde3eb] hover:border-[#dde3eb] hover:text-[#0a1628] transition-all duration-200 whitespace-nowrap ${s?"justify-center":""}`,onClick:j,title:s?"Settings":"",children:[e.jsx(C,{size:18,strokeWidth:2,className:"flex-shrink-0"}),(!s||l)&&e.jsx("span",{className:"font-body text-xs",children:"Settings"})]}),b&&e.jsx("div",{className:"text-[#5a6578]",children:e.jsx(L,{onClick:b,collapsed:s})})]})]})};export{oe as default};
 
 
assets/SupplementalBanner-dklPrubU.js DELETED
@@ -1 +0,0 @@
1
- import{j as e,r as y}from"./vendor-react-Dexh7fmo.js";import{e as j,m as p,T as h}from"./index-D4nJsLyx.js";import{X as v}from"./x-BONnp2RF.js";import{S as w}from"./sparkles-CXUFmaBJ.js";import{C as f}from"./chevron-right-COMox1Xb.js";import{B as g}from"./book-open-BH50GByv.js";import{T as m}from"./trending-up-D-vj8Gbq.js";import{B as x}from"./brain-CPvGdgWE.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-firestore-BML5nJHm.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";const b={"General Mathematics":[{label:"Functions Deep Dive",description:"Interactive review of function types and graphs",icon:e.jsx(m,{size:14})},{label:"Business Math Basics",description:"Simple & compound interest practice",icon:e.jsx(g,{size:14})}],"Statistics and Probability":[{label:"Distribution Visualizer",description:"Explore normal distribution curves",icon:e.jsx(m,{size:14})},{label:"Hypothesis Practice",description:"Step-by-step hypothesis testing",icon:e.jsx(x,{size:14})}],"Pre-Calculus":[{label:"Conic Sections Explorer",description:"Visual parabola, ellipse, hyperbola tool",icon:e.jsx(m,{size:14})},{label:"Trig Identity Practice",description:"Identity verification drill set",icon:e.jsx(x,{size:14})}],"Basic Calculus":[{label:"Limits Visualizer",description:"Graphical approach to limits",icon:e.jsx(m,{size:14})},{label:"Derivative Rules Drill",description:"Practice chain rule & implicit diff",icon:e.jsx(x,{size:14})}]};function u(i){const s=i.toLowerCase();return s==="functions"||s.includes("function")||s==="businessmath"||s.includes("business")||s==="logic"||s.includes("reason")||s.includes("general")||s.includes("gen-math")||s.includes("gen math")?"General Mathematics":s.includes("stat")||s.includes("prob")?"Statistics and Probability":s.includes("pre-calc")||s.includes("pre calc")||s.includes("precalc")?"Pre-Calculus":s.includes("basic")||s.includes("calc")?"Basic Calculus":null}function N(i){const s=i.trim().toLowerCase();return s==="functions"?"Functions and Graphs":s==="businessmath"?"Business and Financial Mathematics":s==="logic"?"Logic and Reasoning":i}const k=({atRiskSubjects:i=[],onAction:s,onDismiss:n})=>{const[l,a]=y.useState(!1);if(l||i.length===0)return null;const r=()=>{a(!0),n?.()};return e.jsx(j,{children:!l&&e.jsx(p.div,{initial:{opacity:0,y:-10,height:0},animate:{opacity:1,y:0,height:"auto"},exit:{opacity:0,y:-10,height:0},className:"overflow-hidden",children:e.jsxs("div",{className:"relative bg-gradient-to-r from-sky-600 via-sky-500 to-sky-600 rounded-2xl p-5 text-white shadow-lg shadow-sky-500/20",children:[e.jsx("button",{onClick:r,className:"absolute top-3 right-3 w-7 h-7 bg-white/20 hover:bg-white/30 rounded-full flex items-center justify-center transition-colors",children:e.jsx(v,{size:14})}),e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"w-12 h-12 bg-white/20 rounded-xl flex items-center justify-center flex-shrink-0",children:e.jsx(w,{size:24})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"font-bold text-lg mb-1",children:"Supplemental Materials Available"}),e.jsx("p",{className:"text-sky-100 text-sm mb-3",children:"Based on your diagnostic assessment, we've identified topics that could use extra practice. Strengthening these areas will improve your overall performance."}),e.jsx("div",{className:"flex flex-wrap gap-2 mb-3",children:i.map(t=>e.jsxs("span",{className:"inline-flex items-center gap-1.5 bg-white/20 backdrop-blur-sm px-3 py-1 rounded-full text-xs font-semibold",children:[e.jsx(h,{size:12}),N(t)]},t))}),e.jsxs("button",{onClick:s,className:"inline-flex items-center gap-2 bg-white text-sky-600 font-bold text-sm px-4 py-2 rounded-xl hover:bg-sky-50 transition-colors",children:["Review Topics",e.jsx(f,{size:16})]})]})]})]})})})},C=({quizSubject:i,atRiskSubjects:s=[]})=>{const n=i?u(i):null;if(!s.some(r=>{const t=u(r);return t&&t===n})||!n)return null;const a=b[n]||[];return e.jsx(p.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},className:"mb-4 overflow-hidden",children:e.jsxs("div",{className:"bg-gradient-to-r from-rose-50 to-orange-50 border border-rose-200 rounded-xl p-3",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[e.jsx(h,{size:14,className:"text-rose-600"}),e.jsxs("span",{className:"text-xs font-bold text-rose-800",children:["Supplemental Focus Area โ€” ",n]})]}),e.jsx("p",{className:"text-xs text-rose-700 mb-2",children:"This topic was flagged in your diagnostic. Take your time and review the explanations carefully."}),a.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5",children:a.slice(0,2).map((r,t)=>e.jsxs("span",{className:"inline-flex items-center gap-1 bg-rose-100 text-rose-700 px-2 py-0.5 rounded-md text-xs font-medium",children:[r.icon,r.label]},t))})]})})},z=({quizSubject:i,quizScore:s=0,atRiskSubjects:n=[],onAction:l})=>{const a=i?u(i):null,r=n.some(c=>{const d=u(c);return d&&d===a});if(s>=70&&!r)return null;const t=a?b[a]||[]:[],o=s<70;return e.jsx(p.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.5},className:"mt-4",children:e.jsx("div",{className:`rounded-2xl p-4 border-2 ${o?"bg-orange-50 border-orange-200":"bg-sky-50 border-sky-200"}`,children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:`w-10 h-10 rounded-xl flex items-center justify-center flex-shrink-0 ${o?"bg-orange-500":"bg-sky-500"}`,children:e.jsx(g,{size:20,className:"text-white"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"font-display font-bold text-[#0a1628] text-sm mb-1",children:o?"Review Recommended":"Supplemental Materials"}),e.jsx("p",{className:"text-xs text-[#5a6578] mb-2",children:o?`You scored ${s}% on this quiz. We recommend reviewing the following resources to strengthen your understanding.`:"This topic was identified as an area for growth. Check out these additional resources."}),t.length>0&&e.jsx("div",{className:"space-y-1.5 mb-3",children:t.map((c,d)=>e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:`w-5 h-5 rounded flex items-center justify-center ${o?"bg-orange-100 text-orange-600":"bg-sky-100 text-sky-600"}`,children:c.icon}),e.jsx("span",{className:"font-medium text-[#0a1628]",children:c.label}),e.jsxs("span",{className:"text-slate-500",children:["โ€” ",c.description]})]},d))}),l&&e.jsxs("button",{onClick:l,className:`inline-flex items-center gap-1.5 text-xs font-bold px-3 py-1.5 rounded-lg transition-colors ${o?"bg-orange-500 hover:bg-orange-600 text-white":"bg-sky-500 hover:bg-sky-600 text-white"}`,children:["Open Practice Center",e.jsx(f,{size:12})]})]})]})})})},I=i=>{switch(i.variant){case"compact":return e.jsx(C,{...i});case"results":return e.jsx(z,{...i});case"full":default:return e.jsx(k,{...i})}};export{I as default};
 
 
assets/TeacherDashboard-D8avlB5m.js DELETED
The diff for this file is too large to render. See raw diff
 
assets/XPNotification-4si_K5GL.js DELETED
@@ -1 +0,0 @@
1
- import{r as l,j as e}from"./vendor-react-Dexh7fmo.js";import{e as n,m as r}from"./index-D4nJsLyx.js";import{S as c}from"./star-dumQ9BVG.js";import{S as m}from"./sparkles-CXUFmaBJ.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-firestore-BML5nJHm.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";const v=({xp:i,message:a,show:t,onComplete:s})=>(l.useEffect(()=>{if(t){const o=setTimeout(()=>{s()},3e3);return()=>clearTimeout(o)}},[t,s]),e.jsx(n,{children:t&&e.jsx(r.div,{initial:{opacity:0,y:-50,scale:.8},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-20,scale:.9},className:"fixed top-8 left-1/2 -translate-x-1/2 z-50",children:e.jsxs("div",{className:"bg-gradient-to-r from-rose-400 via-orange-500 to-rose-500 text-white px-6 py-4 rounded-2xl shadow-2xl border-2 border-rose-300 flex items-center gap-3",children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"w-10 h-10 bg-white/20 rounded-xl flex items-center justify-center",children:e.jsx(c,{size:20,className:"text-white",fill:"currentColor"})}),e.jsx(r.div,{className:"absolute -top-1 -right-1",animate:{rotate:[0,360]},transition:{duration:2,repeat:1/0,ease:"linear"},children:e.jsx(m,{size:16,className:"text-rose-200"})})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-bold",children:a}),e.jsxs("p",{className:"text-2xl font-black",children:["+",i," XP"]})]})]})})}));export{v as default};
 
 
assets/apiService-axx1LHMk.js DELETED
@@ -1,6 +0,0 @@
1
- import{G as B}from"./index-D4nJsLyx.js";import"./vendor-react-Dexh7fmo.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-firestore-BML5nJHm.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";const z=3e4,ce=3,le=1e3;class E extends Error{status;statusText;endpoint;responseBody;retryable;requestId;constructor(t){super(`API Error ${t.status} (${t.statusText}) on ${t.endpoint}: ${t.responseBody}`),this.name="ApiError",this.status=t.status,this.statusText=t.statusText,this.endpoint=t.endpoint,this.responseBody=t.responseBody,this.retryable=t.retryable,this.requestId=t.requestId}}class N extends Error{endpoint;timeoutMs;constructor(t,r){super(`Request to ${t} timed out after ${r}ms`),this.name="ApiTimeoutError",this.endpoint=t,this.timeoutMs=r}}class W extends Error{endpoint;originalError;constructor(t,r){super(`Network error on ${t}: ${r.message}`),this.name="ApiNetworkError",this.endpoint=t,this.originalError=r}}class y extends Error{endpoint;details;constructor(t,r){super(`Validation error before calling ${t}: ${r}`),this.name="ApiValidationError",this.endpoint=t,this.details=r}}const me=new Set([408,429,500,502,503,504]);function fe(e){return me.has(e)}function K(e){const t=`[API ${e.level.toUpperCase()}] ${e.timestamp} ${e.method} ${e.endpoint}`;switch(e.level){case"error":console.error(t,e.message,e.details??"");break;case"warn":console.warn(t,e.message,e.details??"");break;default:console.info(t,e.message,e.details??"")}}function I(e,t,r,a){K({timestamp:new Date().toISOString(),level:"info",endpoint:e,method:t,message:r,details:a})}function Y(e,t,r,a){K({timestamp:new Date().toISOString(),level:"warn",endpoint:e,method:t,message:r,details:a})}function m(e,t,r,a){K({timestamp:new Date().toISOString(),level:"error",endpoint:e,method:t,message:r,details:a})}function pe(e,t,r=z){const a=new AbortController,s=setTimeout(()=>a.abort(),r);return{promise:fetch(e,{...t,signal:a.signal}).finally(()=>clearTimeout(s)),abort:()=>a.abort()}}let he=e=>new Promise(t=>setTimeout(t,e));function ee(e){return he(e)}function ye(e,t=le){const r=t*Math.pow(2,e),a=Math.random()*t;return Math.min(r+a,3e4)}async function te(e,t={},r={}){const{maxRetries:a=ce,timeoutMs:s=z,baseBackoffMs:f=le}=r,d=(t.method??"GET").toUpperCase();let i;for(let n=0;n<=a;n++){const g=Date.now();try{n>0&&I(e,d,`Retry attempt ${n}/${a}`);const{promise:l}=pe(e,t,s),c=await l,w=Date.now()-g;if(c.ok)return I(e,d,`${c.status} in ${w}ms`,{attempt:n}),await c.json();const L=await c.text().catch(()=>"Unable to read response body"),R=fe(c.status),k=new E({status:c.status,statusText:c.statusText,endpoint:e,responseBody:L,retryable:R,requestId:c.headers.get("x-request-id")??void 0});if(m(e,d,`${c.status} ${c.statusText} in ${w}ms`,{attempt:n,responseBody:L.slice(0,500),retryable:R}),!R)throw k;if(c.status===429){const u=c.headers.get("retry-after");if(u){const P=parseInt(u,10);if(!isNaN(P)&&P>0){Y(e,d,`Rate limited. Waiting ${P}s (Retry-After header)`),await ee(P*1e3),i=k;continue}}}i=k}catch(l){const c=Date.now()-g;if(l instanceof E&&!l.retryable)throw l;if(l instanceof DOMException&&l.name==="AbortError"){const w=new N(e,s);m(e,d,`Timeout after ${c}ms`,{attempt:n,timeoutMs:s}),i=w}else if(l instanceof TypeError&&l.message.includes("fetch")){const w=new W(e,l);m(e,d,`Network error after ${c}ms: ${l.message}`,{attempt:n}),i=w}else l instanceof E?i=l:(i=l instanceof Error?l:new Error(String(l)),m(e,d,`Unexpected error: ${i.message}`,{attempt:n}))}if(n<a){const l=ye(n,f);Y(e,d,`Backing off ${Math.round(l)}ms before attempt ${n+1}`,{attempt:n}),await ee(l)}}throw m(e,d,`All ${a+1} attempts failed`),i??new Error(`retryFetch: all ${a+1} attempts failed for ${e}`)}async function x(e,t,r="API call"){try{return{data:await e(),fromFallback:!1}}catch(a){return Y("","",`${r} failed โ€” returning fallback`,{error:a instanceof Error?a.message:String(a)}),{data:t,fromFallback:!0}}}function p(e,t){const r=Object.entries(t).filter(([,a])=>a==null||a==="").map(([a])=>a);if(r.length>0)throw new y(e,`Missing required fields: ${r.join(", ")}`)}function h(e,t,r,a,s){if(typeof r!="number"||isNaN(r)||r<a||r>s)throw new y(e,`${t} must be a number between ${a} and ${s}, got ${r}`)}const U="https://deign86-mathpulse-api-v3test.hf.space",q=(e,t)=>t,de=(e,t)=>t,j=q(void 0,!0),re=q(void 0,!0),ae=q(void 0,!0),se=q(void 0,!0),ne=de(void 0,9e4),H=de(void 0,9e5);let Q=!0,ie=0;const ge=6e4,F={maxRetries:ce,timeoutMs:z,baseBackoffMs:1e3},A={...F,timeoutMs:6e4},Se={...A,maxRetries:1,timeoutMs:45e3,baseBackoffMs:750},V={maxRetries:2,timeoutMs:12e4,baseBackoffMs:2e3},we={maxRetries:0,timeoutMs:8e3,baseBackoffMs:500};let D=null;async function Be(){return D||(D=(async()=>{try{I("/health","GET","Warming up HuggingFace Space...");const e=new AbortController,t=setTimeout(()=>e.abort(),15e3),r=await fetch(`${U}/health`,{method:"GET",signal:e.signal});return clearTimeout(t),r.ok?(I("/health","GET","Backend warm and ready"),!0):(console.warn("[apiService] Backend health check returned",r.status),!1)}catch(e){return console.warn("[apiService] Backend warmup failed (cold start expected):",e),!1}})(),D)}async function o(e,t,r=F){const a=`${U}${e}`,s=t?.method??"GET";I(e,s,"Starting request");const f=async i=>{const n=new Headers(t?.headers??{});!(t?.body instanceof FormData)&&!n.has("Content-Type")&&n.set("Content-Type","application/json");const g=B.currentUser;if(g)try{const l=await g.getIdToken(i);l&&n.set("Authorization",`Bearer ${l}`)}catch(l){m(e,s,"Failed to acquire Firebase ID token",l)}return{...t,headers:n}};let d=await f(!1);try{const i=await te(a,d,r);return I(e,s,"Request succeeded"),i}catch(i){if(i instanceof E&&i.status===401&&B.currentUser)try{I(e,s,"401 received, refreshing Firebase token and retrying once"),d=await f(!0);const n=await te(a,d,r);return I(e,s,"Request succeeded after token refresh"),n}catch(n){throw n instanceof E?m(e,s,`HTTP ${n.status}: ${n.responseBody.slice(0,300)}`):n instanceof N?m(e,s,`Timeout after ${n.timeoutMs}ms`):n instanceof W?m(e,s,`Network error: ${n.originalError.message}`):m(e,s,`Unexpected: ${n instanceof Error?n.message:String(n)}`),n}throw i instanceof E?m(e,s,`HTTP ${i.status}: ${i.responseBody.slice(0,300)}`):i instanceof N?m(e,s,`Timeout after ${i.timeoutMs}ms`):i instanceof W?m(e,s,`Network error: ${i.originalError.message}`):m(e,s,`Unexpected: ${i instanceof Error?i.message:String(i)}`),i}}async function Te(e,t,r=z){const a=`${U}${e}`,s=t?.method??"GET";I(e,s,"Starting blob request");const f=async d=>{const i=new Headers(t?.headers??{}),n=B.currentUser;if(n)try{const c=await n.getIdToken(d);c&&i.set("Authorization",`Bearer ${c}`)}catch(c){m(e,s,"Failed to acquire Firebase ID token",c)}const g=new AbortController,l=setTimeout(()=>g.abort(),r);try{const c=await fetch(a,{...t,headers:i,signal:g.signal});if(!c.ok){const w=await c.text();throw new E({status:c.status,statusText:c.statusText||"Request Failed",endpoint:e,responseBody:w,retryable:c.status>=500||c.status===429})}return await c.blob()}finally{clearTimeout(l)}};try{return await f(!1)}catch(d){if(d instanceof E&&d.status===401&&B.currentUser)return I(e,s,"401 received for blob request, refreshing Firebase token and retrying once"),f(!0);throw d}}const be={response:"Sorry, the AI tutor is temporarily unavailable. Please try again in a moment."},Ie={riskLevel:"Medium",confidence:0,analysis:{labels:[],scores:[]},risk_level:"medium",risk_score:0,top_factors:["Fallback risk response due to temporary service unavailability"]},Ee={learningPath:"Unable to generate a learning path right now. Please try again later."},ke={insight:"Daily insight is temporarily unavailable. Please refresh later."},Ae={expression:"",result:"Error: calculation service unavailable",steps:[],simplified:null,latex:null};function Oe(e){if(typeof e!="object"||e===null)return!1;const t=e;return typeof t.riskLevel=="string"&&typeof t.confidence=="number"}function oe(e){if(typeof e!="object"||e===null)return!1;const t=e;return Array.isArray(t.questions)&&typeof t.totalPoints=="number"}const ve=e=>new Promise(t=>setTimeout(t,e));function Re(e){if(!e)return"Generation task failed without a detailed error.";if(typeof e=="string")return e;if(typeof e=="object"&&e!==null){const t=e;if(typeof t.message=="string")return t.message;try{return JSON.stringify(t)}catch{return"Generation task failed due to an unknown error."}}return String(e)}const b={getImportGroundedRolloutFlags(){return{quizEnabled:j,lessonEnabled:re,feedbackEnabled:ae}},async reportImportGroundedFeedback(e){return ae?o("/api/feedback/import-grounded",{method:"POST",body:JSON.stringify(e)}):{success:!0,stored:!1,warnings:["Import-grounded feedback events are disabled by frontend rollout flag."]}},async health(){return o("/health",void 0,{...F,timeoutMs:1e4})},async chat(e,t,r,a){p("/api/chat",{message:e});const s={message:e,history:t??[],...a?.expectedEndMarker?{expectedEndMarker:a.expectedEndMarker}:{},...a?.completionMode?{completionMode:a.completionMode}:{},...typeof a?.continuationMaxRounds=="number"?{continuationMaxRounds:Math.max(0,Math.floor(a.continuationMaxRounds))}:{}};if(r){const d=new AbortController;let i=null,n=null,g=null;const l=u=>{i||(i=u,d.abort())},c=()=>{n&&(clearTimeout(n),n=null),g&&(clearTimeout(g),g=null)},w=()=>{n&&clearTimeout(n),n=setTimeout(()=>l("idle"),ne)};g=setTimeout(()=>l("total"),H);const L=new Headers({"Content-Type":"application/json"}),R=B.currentUser;if(R)try{const u=await R.getIdToken(!1);u&&L.set("Authorization",`Bearer ${u}`)}catch(u){m("/api/chat/stream","POST","Failed to acquire Firebase ID token",u)}let k=null;try{w();const u=await fetch(`${U}/api/chat/stream`,{method:"POST",headers:L,body:JSON.stringify(s),signal:d.signal});if(!u.ok||!u.body){const $=await u.text().catch(()=>"Unable to read response body");throw new Error(`Streaming request failed (${u.status}): ${$.slice(0,300)}`)}k=u.body.getReader();const P=new TextDecoder;let O="",G="",X=!1;const J=$=>{const v=$.indexOf(`
2
-
3
- `),T=$.indexOf(`\r
4
- \r
5
- `);return v===-1&&T===-1?null:v===-1?{index:T,length:4}:T===-1?{index:v,length:2}:v<T?{index:v,length:2}:{index:T,length:4}};for(;;){const{value:$,done:v}=await k.read();if(v)break;w(),O+=P.decode($,{stream:!0});let T=J(O);for(;T;){const ue=O.slice(0,T.index);O=O.slice(T.index+T.length);let C="message";const Z=[];for(const S of ue.split(/\r?\n/))S.startsWith("event:")?C=S.slice(6).trim():S.startsWith("data:")&&Z.push(S.slice(5).trimStart());if(C==="end")return X=!0,{response:G};const M=Z.join(`
6
- `);if(!M){T=J(O);continue}if(C==="chunk"){let S=M;try{const _=JSON.parse(M);typeof _?.chunk=="string"&&(S=_.chunk)}catch{}S&&(G+=S,r(S),w())}else if(C==="error"){let S="Streaming failed on server.";try{const _=JSON.parse(M);typeof _?.detail=="string"&&_.detail.trim()&&(S=_.detail)}catch{M.trim()&&(S=M.trim())}throw new Error(S)}T=J(O)}}if(X)return{response:G};throw new Error("Stream closed before end event.")}catch(u){throw i==="idle"?new N("/api/chat/stream",ne):i==="total"?new N("/api/chat/stream",H):u instanceof DOMException&&u.name==="AbortError"?new N("/api/chat/stream",H):u}finally{if(c(),k)try{await k.cancel()}catch{}}}return await o("/api/chat",{method:"POST",body:JSON.stringify(s)},Se)},async chatSafe(e,t,r){return x(()=>b.chat(e,t,void 0,r),be,"chat")},async predictRisk(e){p("/api/predict-risk",{engagementScore:e.engagementScore,avgQuizScore:e.avgQuizScore,attendance:e.attendance,assignmentCompletion:e.assignmentCompletion}),h("/api/predict-risk","engagementScore",e.engagementScore,0,100),h("/api/predict-risk","avgQuizScore",e.avgQuizScore,0,100),h("/api/predict-risk","attendance",e.attendance,0,100),h("/api/predict-risk","assignmentCompletion",e.assignmentCompletion,0,100);const t=await o("/api/predict-risk",{method:"POST",body:JSON.stringify(e)});if(!Oe(t))throw m("/api/predict-risk","POST","Invalid response shape",t),new Error("Invalid risk prediction response from server");return t},async predictRiskSafe(e){return x(()=>b.predictRisk(e),Ie,"predictRisk")},async predictRiskBatch(e){if(!Array.isArray(e)||e.length===0)throw new y("/api/predict-risk/batch","students array must not be empty");return o("/api/predict-risk/batch",{method:"POST",body:JSON.stringify({students:e})})},async getLearningPath(e){if(p("/api/learning-path",{weaknesses:e.weaknesses,gradeLevel:e.gradeLevel}),!Array.isArray(e.weaknesses)||e.weaknesses.length===0)throw new y("/api/learning-path","weaknesses must be a non-empty array");return o("/api/learning-path",{method:"POST",body:JSON.stringify(e)},A)},async getLearningPathSafe(e){return x(()=>b.getLearningPath(e),Ee,"getLearningPath")},async getDailyInsight(e){if(!Array.isArray(e.students)||e.students.length===0)throw new y("/api/analytics/daily-insight","students array must not be empty");return o("/api/analytics/daily-insight",{method:"POST",body:JSON.stringify(e)},A)},async getDailyInsightSafe(e){return x(()=>b.getDailyInsight(e),ke,"getDailyInsight")},async getImportedClassOverview(e){if(!e?.forceRefresh&&!Q&&Date.now()<ie)return{success:!0,classSectionId:e?.classSectionId??null,classrooms:[],students:[],warnings:["Imported class overview endpoint is temporarily unavailable. Retrying automatically soon."]};const r=e?.limit??3e3;h("/api/analytics/imported-class-overview","limit",r,1,5e3);const a=new URLSearchParams;a.set("limit",String(r)),e?.classSectionId&&a.set("classSectionId",e.classSectionId);try{return Q=!0,await o(`/api/analytics/imported-class-overview?${a.toString()}`,void 0,we)}catch(s){if(s instanceof E&&s.status===404)return Q=!1,ie=Date.now()+ge,{success:!0,classSectionId:e?.classSectionId??null,classrooms:[],students:[],warnings:["Imported class overview endpoint is unavailable on this backend deployment."]};throw s}},async uploadClassRecords(e,t){const r=Array.isArray(e)?e:[e];if(r.length===0)throw new y("/api/upload/class-records","At least one file is required");if(r.some(s=>!s||s.size===0))throw new y("/api/upload/class-records","All files must be non-empty");if(r.some(s=>s.size>10*1024*1024))throw new y("/api/upload/class-records","One or more files exceed the 10 MB size limit");const a=new FormData;return r.forEach(s=>a.append("files",s)),t?.classSectionId&&a.append("classSectionId",t.classSectionId),t?.className&&a.append("className",t.className),a.append("datasetIntent",t?.datasetIntent??"synthetic_student_records"),o("/api/upload/class-records",{method:"POST",body:a},V)},async previewStudentAccountImport(e,t){if(!e||e.size===0)throw new y("/api/import/student-accounts/preview","A non-empty file is required");if(e.size>10*1024*1024)throw new y("/api/import/student-accounts/preview","File exceeds 10 MB size limit");const r=new FormData;return r.append("file",e),t?.classSectionId&&r.append("classSectionId",t.classSectionId),t?.className&&r.append("className",t.className),t?.defaultGrade&&r.append("defaultGrade",t.defaultGrade),t?.defaultSection&&r.append("defaultSection",t.defaultSection),o("/api/import/student-accounts/preview",{method:"POST",body:r},V)},async commitStudentAccountImport(e){return p("/api/import/student-accounts/commit",{previewToken:e.previewToken}),o("/api/import/student-accounts/commit",{method:"POST",body:JSON.stringify(e)},F)},async getRiskRefreshMonitor(e){const t=e?.limit??10;h("/api/upload/class-records/risk-refresh/recent","limit",t,1,50);const r=new URLSearchParams;return r.set("limit",String(t)),e?.classSectionId&&r.set("classSectionId",e.classSectionId),o(`/api/upload/class-records/risk-refresh/recent?${r.toString()}`)},async getImportGroundedTelemetrySummary(e){const t=e?.days??7,r=e?.limit??5e3;h("/api/feedback/import-grounded/summary","days",t,1,30),h("/api/feedback/import-grounded/summary","limit",r,100,2e4);const a=new URLSearchParams;return a.set("days",String(t)),a.set("limit",String(r)),e?.classSectionId&&a.set("classSectionId",e.classSectionId),o(`/api/feedback/import-grounded/summary?${a.toString()}`)},async getImportGroundedAccessAudit(e){const t=e?.days??7,r=e?.limit??200;h("/api/import-grounded/access-audit","days",t,1,30),h("/api/import-grounded/access-audit","limit",r,1,1e3);const a=new URLSearchParams;return a.set("days",String(t)),a.set("limit",String(r)),a.set("export","json"),e?.classSectionId&&a.set("classSectionId",e.classSectionId),o(`/api/import-grounded/access-audit?${a.toString()}`)},async exportImportGroundedAccessAuditCsv(e){const t=e?.days??7,r=e?.limit??200;h("/api/import-grounded/access-audit","days",t,1,30),h("/api/import-grounded/access-audit","limit",r,1,1e3);const a=new URLSearchParams;return a.set("days",String(t)),a.set("limit",String(r)),a.set("export","csv"),e?.classSectionId&&a.set("classSectionId",e.classSectionId),Te(`/api/import-grounded/access-audit?${a.toString()}`,{method:"GET"},3e4)},async uploadCourseMaterials(e,t){const r=Array.isArray(e)?e:[e];if(r.length===0)throw new y("/api/upload/course-materials","At least one file is required");if(r.some(s=>!s||s.size===0))throw new y("/api/upload/course-materials","All files must be non-empty");if(r.some(s=>s.size>10*1024*1024))throw new y("/api/upload/course-materials","One or more files exceed the 10 MB size limit");const a=new FormData;return r.forEach(s=>a.append("files",s)),t?.classSectionId&&a.append("classSectionId",t.classSectionId),t?.className&&a.append("className",t.className),o("/api/upload/course-materials",{method:"POST",body:a},V)},async getRecentCourseMaterials(e){const t=e?.limit??10;h("/api/upload/course-materials/recent","limit",t,1,50);const r=new URLSearchParams;return r.set("limit",String(t)),e?.classSectionId&&r.set("classSectionId",e.classSectionId),o(`/api/upload/course-materials/recent?${r.toString()}`)},async getCourseMaterialTopics(e){const t=e?.limit??20;h("/api/course-materials/topics","limit",t,1,50);const r=new URLSearchParams;return r.set("limit",String(t)),e?.classSectionId&&r.set("classSectionId",e.classSectionId),e?.materialId&&r.set("materialId",e.materialId),o(`/api/course-materials/topics?${r.toString()}`)},async generateLessonPlan(e){p("/api/lesson/generate",{gradeLevel:e.gradeLevel});const t={...e,preferImportedTopics:re&&(e.preferImportedTopics??!0)};if(se){const r=await b.submitLessonPlanAsync(t),s=(await b.waitForTaskResult(r.taskId,{timeoutMs:24e4,pollIntervalMs:1500})).result;if(!s||typeof s!="object")throw new Error("Lesson generation completed without a valid result payload.");return s}return o("/api/lesson/generate",{method:"POST",body:JSON.stringify(t)},A)},async generateQuiz(e,t){if(p("/api/quiz/generate",{topics:e.topics,gradeLevel:e.gradeLevel}),!Array.isArray(e.topics)||e.topics.length===0)throw new y("/api/quiz/generate","topics must be a non-empty array");const r={...e,preferImportedTopics:j&&(e.preferImportedTopics??!0)};if(se){const s=await b.submitQuizAsync(r);t?.onTaskCreated?.(s.taskId);const d=(await b.waitForTaskResult(s.taskId,{timeoutMs:24e4,pollIntervalMs:1500,onProgress:t?.onProgress})).result;if(!d||typeof d!="object")throw new Error("Quiz generation completed without a valid result payload.");if(!oe(d))throw new Error("Invalid quiz generation response from async task payload.");return d}const a=await o("/api/quiz/generate",{method:"POST",body:JSON.stringify(r)},A);if(!oe(a))throw m("/api/quiz/generate","POST","Invalid response shape",a),new Error("Invalid quiz generation response from server");return a},async previewQuiz(e){p("/api/quiz/preview",{topics:e.topics,gradeLevel:e.gradeLevel});const t={...e,preferImportedTopics:j&&(e.preferImportedTopics??!0)};return o("/api/quiz/preview",{method:"POST",body:JSON.stringify(t)},A)},async submitLessonPlanAsync(e){return o("/api/lesson/generate-async",{method:"POST",body:JSON.stringify(e)},A)},async submitQuizAsync(e){return o("/api/quiz/generate-async",{method:"POST",body:JSON.stringify(e)},A)},async getTaskStatus(e){return p("/api/tasks/{taskId}",{taskId:e}),o(`/api/tasks/${encodeURIComponent(e)}`)},async listTasks(e){const t=new URLSearchParams;e?.limit!=null&&(h("/api/tasks","limit",e.limit,1,200),t.set("limit",String(e.limit))),e?.status&&t.set("status",e.status),e?.includeResults!=null&&t.set("include_results",String(e.includeResults));const r=t.toString();return o(`/api/tasks${r?`?${r}`:""}`)},async cancelTask(e){return p("/api/tasks/{taskId}/cancel",{taskId:e}),o(`/api/tasks/${encodeURIComponent(e)}/cancel`,{method:"POST"})},async waitForTaskResult(e,t){const r=t?.timeoutMs??18e4,a=t?.pollIntervalMs??1500,s=Date.now();for(;Date.now()-s<=r;){const f=await b.getTaskStatus(e);if(t?.onProgress?.(f),f.status==="completed")return f;if(f.status==="failed"||f.status==="cancelled")throw new Error(Re(f.error));await ve(a)}throw new Error(`Async generation task timed out after ${Math.round(r/1e3)} seconds.`)},async getQuizTopics(e){const t=e?`?gradeLevel=${encodeURIComponent(e)}`:"";return o(`/api/quiz/topics${t}`)},async getStudentCompetency(e,t){return p("/api/quiz/student-competency",{studentId:e}),o("/api/quiz/student-competency",{method:"POST",body:JSON.stringify({studentId:e,quizHistory:t})})},async evaluateExpression(e){return p("/api/calculator/evaluate",{expression:e}),o("/api/calculator/evaluate",{method:"POST",body:JSON.stringify({expression:e})})},async evaluateExpressionSafe(e){return x(()=>b.evaluateExpression(e),{...Ae,expression:e},"evaluateExpression")},async automationDiagnosticCompleted(e){return p("/api/automation/diagnostic-completed",{lrn:e.lrn,results:e.results}),o("/api/automation/diagnostic-completed",{method:"POST",body:JSON.stringify(e)})},async automationQuizSubmitted(e){return p("/api/automation/quiz-submitted",{lrn:e.lrn,quizId:e.quizId,subject:e.subject}),o("/api/automation/quiz-submitted",{method:"POST",body:JSON.stringify(e)})},async automationStudentEnrolled(e){return p("/api/automation/student-enrolled",{lrn:e.lrn,name:e.name,email:e.email}),o("/api/automation/student-enrolled",{method:"POST",body:JSON.stringify(e)})},async automationDataImported(e){return p("/api/automation/data-imported",{teacherId:e.teacherId,students:e.students}),o("/api/automation/data-imported",{method:"POST",body:JSON.stringify(e)})},async automationContentUpdated(e){return p("/api/automation/content-updated",{adminId:e.adminId,action:e.action,contentType:e.contentType,contentId:e.contentId}),o("/api/automation/content-updated",{method:"POST",body:JSON.stringify(e)})}};export{E as ApiError,W as ApiNetworkError,N as ApiTimeoutError,y as ApiValidationError,b as apiService,Be as warmupBackend};
 
 
 
 
 
 
 
assets/automationService-DNyauqGd.js DELETED
@@ -1 +0,0 @@
1
- import{m as p,e as r,q as w,w as h,f as z,n as Q,a as i,s as I,d as b,u as A}from"./vendor-firebase-firestore-BML5nJHm.js";import{d as s,O as a,P as $}from"./index-D4nJsLyx.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-react-Dexh7fmo.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";async function T(e){if(!e)return 0;const n=r(s,"deepDiagnosticAssignments"),c=w(n,h("lrn","==",e));return(await z(c)).docs.filter(o=>{const t=o.data().status;return t==="pending"||t==="queued"||t==="in_progress"||t==="expired"}).length}async function k(e,n,c="Grade 11",u,o="iar_only",t="initial_assessment"){if(t==="followup_diagnostic"){const D=r(s,"deepDiagnosticAssignments"),C=w(D,h("lrn","==",e)),d=await z(C);if(!d.empty){const m=Q(s);let g=!1;for(const l of d.docs){const f=l.data().status;(f==="pending"||f==="queued")&&(m.update(l.ref,{status:"in_progress",startedAt:i()}),g=!0)}g&&await m.commit()}}return await I(b(s,"diagnosticResults",e),{lrn:e,results:n,gradeLevel:c,workflowMode:o,assessmentType:t,questionBreakdown:u||null,completedAt:i(),processed:!1,processing:!1}),{success:!0,event:"diagnostic_completed",lrn:e,message:`Diagnostic submitted for ${e}. Processing will begin automatically.`,remedialQuizzesCreated:0,notifications:["Your diagnostic results are being processed. Check back shortly!"]}}async function B(e){return await p(r(s,"quizResults"),{lrn:e.lrn,quizId:e.quizId,subject:e.subject,score:e.score,totalQuestions:e.totalQuestions,correctAnswers:e.correctAnswers,timeSpentSeconds:e.timeSpentSeconds,answers:e.answers||null,submittedAt:i()}),{success:!0,event:"quiz_submitted",lrn:e.lrn,message:`Quiz submitted for ${e.lrn}. Risk recalculation will run automatically.`,remedialQuizzesCreated:0,notifications:[`Quiz result recorded for ${e.subject}.`]}}async function M(e){return await $(e.lrn),await a(e.lrn,"reminder","Welcome to MathPulse AI!","Complete your diagnostic assessment to get started with personalised learning."),e.teacherId&&await a(e.teacherId,"message","New Student Enrolled",`${e.name} has joined. Diagnostic assessment is pending.`),{success:!0,event:"student_enrolled",lrn:e.lrn,message:`Student ${e.name} enrolled and initialised`,remedialQuizzesCreated:0,notifications:[`Welcome ${e.name}! Please complete the diagnostic assessment.`]}}async function U(e){return await p(r(s,"dataImports"),{teacherId:e.teacherId,studentCount:e.students.length,columnMapping:e.columnMapping,importedAt:i(),processed:!1}),await a(e.teacherId,"message","Data Import Processed",`Data import complete โ€” ${e.students.length} student records processed.`),{success:!0,event:"data_imported",message:`Data import processed for ${e.students.length} students`,remedialQuizzesCreated:0,notifications:[`Data import complete โ€” ${e.students.length} student records processed.`]}}async function x(e){const n=b(s,"curriculumContent",e.contentId);return e.action==="delete"?await A(n,{deleted:!0,deletedBy:e.adminId,deletedAt:i(),contentType:e.contentType,subjectId:e.subjectId||null}):await I(n,{contentType:e.contentType,subjectId:e.subjectId||null,details:e.details||null,updatedBy:e.adminId,action:e.action,updatedAt:i()},{merge:!0}),{success:!0,event:"content_updated",message:`Content ${e.action} processed for ${e.contentType}`,remedialQuizzesCreated:0,notifications:[]}}export{T as getPendingDeepDiagnosticCount,x as triggerContentUpdated,U as triggerDataImported,k as triggerDiagnosticCompleted,B as triggerQuizSubmitted,M as triggerStudentEnrolled};
 
 
assets/avatarData-BW_TX0b4.js DELETED
@@ -1 +0,0 @@
1
- const r=[{id:"top_blue",name:"Blue Uniform",category:"top",src:"/avatar/uniform_blue.png",thumbnail:"/avatar/uniform_blue_thumbnail.png",price:0},{id:"top_pink",name:"Pink Uniform",category:"top",src:"/avatar/uniform_pink.png",thumbnail:"/avatar/uniform_pink_thumbnail.png",price:200},{id:"bot_black",name:"Black Pants",category:"bottom",src:"/avatar/pants_black.png",thumbnail:"/avatar/pants_black_thumbnail.png",price:0},{id:"shoe_black",name:"Black Shoes",category:"shoes",src:"/avatar/shoes_black.png",thumbnail:"/avatar/shoes_black_thumbnail.png",price:0},{id:"acc_leaf_clip",name:"Leaf Clip",category:"accessory",src:"/avatar/leaf_clip.png",thumbnail:"/avatar/leaf_clip_thumbnail.png",price:0},{id:"acc_blue_cap",name:"Blue Cap",category:"accessory",src:"/avatar/blue_cap.png",thumbnail:"/avatar/blue_cap_thumbnail.png",price:250},{id:"acc_red_cap",name:"Red Cap",category:"accessory",src:"/avatar/red_cap.png",thumbnail:"/avatar/red_cap_thumbnail.png",price:250},{id:"acc_traffic_cone",name:"Traffic Cone",category:"accessory",src:"/avatar/traffic_cone.png",thumbnail:"/avatar/traffic_cone_thumbnail.png",price:500},{id:"acc_crown",name:"Crown",category:"accessory",src:"/avatar/crown.png",thumbnail:"/avatar/crown_thumbnail.png",price:1e3}],n=a=>{if(a)return r.find(c=>c.id===a)?.src};export{r as M,n as g};
 
 
assets/award-oJTbc9W5.js DELETED
@@ -1,6 +0,0 @@
1
- import{c}from"./index-D4nJsLyx.js";/**
2
- * @license lucide-react v0.487.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 a=[["path",{d:"m15.477 12.89 1.515 8.526a.5.5 0 0 1-.81.47l-3.58-2.687a1 1 0 0 0-1.197 0l-3.586 2.686a.5.5 0 0 1-.81-.469l1.514-8.526",key:"1yiouv"}],["circle",{cx:"12",cy:"8",r:"6",key:"1vp47v"}]],e=c("award",a);export{e as A};
 
 
 
 
 
 
 
assets/bell-CbSbac2W.js DELETED
@@ -1,6 +0,0 @@
1
- import{c as e}from"./index-D4nJsLyx.js";/**
2
- * @license lucide-react v0.487.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 c=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],t=e("bell",c);export{t as B};
 
 
 
 
 
 
 
assets/book-open-BH50GByv.js DELETED
@@ -1,6 +0,0 @@
1
- import{c as o}from"./index-D4nJsLyx.js";/**
2
- * @license lucide-react v0.487.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 a=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],t=o("book-open",a);export{t as B};
 
 
 
 
 
 
 
assets/brain-CPvGdgWE.js DELETED
@@ -1,6 +0,0 @@
1
- import{c as a}from"./index-D4nJsLyx.js";/**
2
- * @license lucide-react v0.487.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 e=[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]],p=a("brain",e);export{p as B};
 
 
 
 
 
 
 
assets/button-BpeUVhBo.js DELETED
@@ -1 +0,0 @@
1
- import{j as y}from"./vendor-react-Dexh7fmo.js";import{z as k}from"./vendor-radix-BRdei-zg.js";import{c as V}from"./clsx-B-dksMZM.js";import{c as p}from"./utils-BQQgILNW.js";const g=n=>typeof n=="boolean"?`${n}`:n===0?"0":n,m=V,j=(n,r)=>e=>{var o;if(r?.variants==null)return m(n,e?.class,e?.className);const{variants:u,defaultVariants:i}=r,b=Object.keys(u).map(t=>{const a=e?.[t],d=i?.[t];if(a===null)return null;const s=g(a)||g(d);return u[t][s]}),v=e&&Object.entries(e).reduce((t,a)=>{let[d,s]=a;return s===void 0||(t[d]=s),t},{}),f=r==null||(o=r.compoundVariants)===null||o===void 0?void 0:o.reduce((t,a)=>{let{class:d,className:s,...h}=a;return Object.entries(h).every(x=>{let[c,l]=x;return Array.isArray(l)?l.includes({...i,...v}[c]):{...i,...v}[c]===l})?[...t,d,s]:t},[]);return m(n,b,f,e?.class,e?.className)},N=j("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background text-foreground hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9 rounded-md"}},defaultVariants:{variant:"default",size:"default"}});function w({className:n,variant:r,size:e,asChild:o=!1,...u}){const i=o?k:"button";return y.jsx(i,{"data-slot":"button",className:p(N({variant:r,size:e,className:n})),...u})}export{w as B};
 
 
assets/calendar-BJ8oE6yW.js DELETED
@@ -1,6 +0,0 @@
1
- import{c as e}from"./index-D4nJsLyx.js";/**
2
- * @license lucide-react v0.487.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 t=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],a=e("calendar",t);export{a as C};
 
 
 
 
 
 
 
assets/chart-column-D5mAWcRx.js DELETED
@@ -1,6 +0,0 @@
1
- import{c as t}from"./index-D4nJsLyx.js";/**
2
- * @license lucide-react v0.487.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 a=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],o=t("chart-column",a);export{o as C};
 
 
 
 
 
 
 
assets/chatService-BXbCYY4-.js ADDED
@@ -0,0 +1 @@
 
 
1
+ import{d as c,c as d,a as g,b as i,s as w,u as p,q as l,w as u,e as y,f as A}from"./vendor-firebase-firestore-C0C-blIn.js";import{d as o}from"./index-B36njGvu.js";import"./vendor-firebase-core-BireMWc7.js";import"./vendor-react-CCIuKUIB.js";import"./vendor-firebase-auth-DUGvAaJx.js";import"./vendor-firebase-storage-CnCozLgy.js";import"./vendor-firebase-analytics-FE_tmzXh.js";import"./vendor-radix-DkXsqQ-A.js";import"./vendor-markdown-CDZ6ydrN.js";const T=async(s,t="New Conversation")=>{try{const e=c(d(o,"chatSessions")),r={id:e.id,userId:s,title:t,messages:[],createdAt:new Date,updatedAt:new Date,isActive:!0};return await w(e,{...r,createdAt:i(),updatedAt:i()}),r}catch(e){throw console.error("Error creating chat session:",e),e}},b=async s=>{try{const t=l(d(o,"chatSessions"),u("userId","==",s),u("isActive","==",!0),y("updatedAt","desc"));return(await A(t)).docs.map(r=>{const a=r.data();return{...a,createdAt:a.createdAt?.toDate()||new Date,updatedAt:a.updatedAt?.toDate()||new Date}})}catch(t){return console.error("Error getting chat sessions:",t),[]}},q=async s=>{try{const t=await g(c(o,"chatSessions",s));if(t.exists()){const e=t.data();return{...e,createdAt:e.createdAt?.toDate()||new Date,updatedAt:e.updatedAt?.toDate()||new Date}}return null}catch(t){return console.error("Error getting chat session:",t),null}},Q=async(s,t,e,r)=>{try{const a=c(d(o,"chatMessages")),n={id:a.id,userId:"",role:t,content:e,timestamp:new Date,...r?{context:r}:{}},h=await g(c(o,"chatSessions",s));h.exists()&&(n.userId=h.data().userId);const m={id:n.id,userId:n.userId,role:n.role,content:n.content,sessionId:s,timestamp:i()};return n.context&&(m.context=n.context),await w(a,m),await p(c(o,"chatSessions",s),{updatedAt:i()}),n}catch(a){throw console.error("Error adding message:",a),a}},R=async s=>{try{const t=l(d(o,"chatMessages"),u("sessionId","==",s),y("timestamp","asc"));return(await A(t)).docs.map(r=>{const a=r.data();return{...a,timestamp:a.timestamp?.toDate()||new Date}})}catch(t){return console.error("Error getting session messages:",t),[]}},B=async(s,t)=>{try{await p(c(o,"chatSessions",s),{title:t,updatedAt:i()})}catch(e){throw console.error("Error updating session title:",e),e}},N=async s=>{try{await p(c(o,"chatSessions",s),{isActive:!1,updatedAt:i()})}catch(t){throw console.error("Error deleting session:",t),t}};export{Q as addMessageToSession,T as createChatSession,N as deleteSession,q as getChatSession,R as getSessionMessages,b as getUserChatSessions,B as updateSessionTitle};
assets/chatService-LsXGqjoV.js DELETED
@@ -1 +0,0 @@
1
- import{d as c,e as d,b as g,a as i,s as w,u as p,q as l,w as u,o as y,f as A}from"./vendor-firebase-firestore-BML5nJHm.js";import{d as o}from"./index-D4nJsLyx.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-react-Dexh7fmo.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";const C=async(s,t="New Conversation")=>{try{const e=c(d(o,"chatSessions")),r={id:e.id,userId:s,title:t,messages:[],createdAt:new Date,updatedAt:new Date,isActive:!0};return await w(e,{...r,createdAt:i(),updatedAt:i()}),r}catch(e){throw console.error("Error creating chat session:",e),e}},M=async s=>{try{const t=l(d(o,"chatSessions"),u("userId","==",s),u("isActive","==",!0),y("updatedAt","desc"));return(await A(t)).docs.map(r=>{const a=r.data();return{...a,createdAt:a.createdAt?.toDate()||new Date,updatedAt:a.updatedAt?.toDate()||new Date}})}catch(t){return console.error("Error getting chat sessions:",t),[]}},T=async s=>{try{const t=await g(c(o,"chatSessions",s));if(t.exists()){const e=t.data();return{...e,createdAt:e.createdAt?.toDate()||new Date,updatedAt:e.updatedAt?.toDate()||new Date}}return null}catch(t){return console.error("Error getting chat session:",t),null}},b=async(s,t,e,r)=>{try{const a=c(d(o,"chatMessages")),n={id:a.id,userId:"",role:t,content:e,timestamp:new Date,...r?{context:r}:{}},h=await g(c(o,"chatSessions",s));h.exists()&&(n.userId=h.data().userId);const m={id:n.id,userId:n.userId,role:n.role,content:n.content,sessionId:s,timestamp:i()};return n.context&&(m.context=n.context),await w(a,m),await p(c(o,"chatSessions",s),{updatedAt:i()}),n}catch(a){throw console.error("Error adding message:",a),a}},q=async s=>{try{const t=l(d(o,"chatMessages"),u("sessionId","==",s),y("timestamp","asc"));return(await A(t)).docs.map(r=>{const a=r.data();return{...a,timestamp:a.timestamp?.toDate()||new Date}})}catch(t){return console.error("Error getting session messages:",t),[]}},Q=async(s,t)=>{try{await p(c(o,"chatSessions",s),{title:t,updatedAt:i()})}catch(e){throw console.error("Error updating session title:",e),e}},R=async s=>{try{await p(c(o,"chatSessions",s),{isActive:!1,updatedAt:i()})}catch(t){throw console.error("Error deleting session:",t),t}};export{b as addMessageToSession,C as createChatSession,R as deleteSession,T as getChatSession,q as getSessionMessages,M as getUserChatSessions,Q as updateSessionTitle};
 
 
assets/check-BACdUlFL.js DELETED
@@ -1,6 +0,0 @@
1
- import{c}from"./index-D4nJsLyx.js";/**
2
- * @license lucide-react v0.487.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 e=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],t=c("check",e);export{t as C};
 
 
 
 
 
 
 
assets/chevron-right-COMox1Xb.js DELETED
@@ -1,6 +0,0 @@
1
- import{c as o}from"./index-D4nJsLyx.js";/**
2
- * @license lucide-react v0.487.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 t=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],e=o("chevron-right",t);export{e as C};
 
 
 
 
 
 
 
assets/chevron-up-Bfmq3Clw.js DELETED
@@ -1,11 +0,0 @@
1
- import{c as o}from"./index-D4nJsLyx.js";/**
2
- * @license lucide-react v0.487.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 n=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],r=o("chevron-down",n);/**
7
- * @license lucide-react v0.487.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 c=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],t=o("chevron-up",c);export{t as C,r as a};
 
 
 
 
 
 
 
 
 
 
 
 
assets/circle-alert-CBefjicJ.js DELETED
@@ -1,6 +0,0 @@
1
- import{c as e}from"./index-D4nJsLyx.js";/**
2
- * @license lucide-react v0.487.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 c=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],y=e("circle-alert",c);export{y as C};
 
 
 
 
 
 
 
assets/circle-check-big-0Gzyt_f3.js DELETED
@@ -1,6 +0,0 @@
1
- import{c}from"./index-D4nJsLyx.js";/**
2
- * @license lucide-react v0.487.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 e=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],t=c("circle-check-big",e);export{t as C};
 
 
 
 
 
 
 
assets/circle-help-BmjHdT5a.js DELETED
@@ -1,6 +0,0 @@
1
- import{c}from"./index-D4nJsLyx.js";/**
2
- * @license lucide-react v0.487.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 e=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],p=c("circle-help",e);export{p as C};