diff --git a/assets/AIChatPage-CnRlS68Q.js b/assets/AIChatPage-bzvb0iBg.js similarity index 95% rename from assets/AIChatPage-CnRlS68Q.js rename to assets/AIChatPage-bzvb0iBg.js index c4e980ef2d0d49f5e7588d93aa56a604fa2b3714..ea90c61ef5bacabc084adaeb4fa7ba289aa55f85 100644 --- a/assets/AIChatPage-CnRlS68Q.js +++ b/assets/AIChatPage-bzvb0iBg.js @@ -1,2 +1,2 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/apiService-DnEZVkU5.js","assets/index-CYVpLr_P.js","assets/vendor-react-Dexh7fmo.js","assets/vendor-firebase-auth-COrkgW0P.js","assets/vendor-firebase-core-DQ-pMjxd.js","assets/vendor-firebase-firestore-CkuVbeP5.js","assets/vendor-firebase-storage-BOeKE_0n.js","assets/vendor-firebase-analytics-CCo6E2f7.js","assets/index-CR2i2gnI.css"])))=>i.map(i=>d[i]); -import{z as B,_ as F,e as N,m as k}from"./index-CYVpLr_P.js";import{r,j as e}from"./vendor-react-Dexh7fmo.js";import{B as $}from"./button-CwNFy6cp.js";import{I as S}from"./input-DBkKXOmF.js";import z from"./ChatMarkdown-CaB5Axzm.js";import{P as O}from"./plus-C6Q_7FrB.js";import{S as H}from"./search-CwICt96b.js";import{T as Y}from"./trash-2-D383W6Gx.js";import{S as D}from"./send-DoEjcxSJ.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-firestore-CkuVbeP5.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";import"./vendor-radix-cHXhEj3X.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-DnEZVkU5.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}; +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/apiService-BmjkaPHy.js","assets/index-LyKgWktA.js","assets/vendor-react-Dexh7fmo.js","assets/vendor-firebase-auth-COrkgW0P.js","assets/vendor-firebase-core-DQ-pMjxd.js","assets/vendor-firebase-firestore-CkuVbeP5.js","assets/vendor-firebase-storage-BOeKE_0n.js","assets/vendor-firebase-analytics-CCo6E2f7.js","assets/index-CR2i2gnI.css"])))=>i.map(i=>d[i]); +import{z as B,_ as F,e as N,m as k}from"./index-LyKgWktA.js";import{r,j as e}from"./vendor-react-Dexh7fmo.js";import{B as $}from"./button-CwNFy6cp.js";import{I as S}from"./input-DBkKXOmF.js";import z from"./ChatMarkdown-sXdo6Daw.js";import{P as O}from"./plus-QA9NgyWS.js";import{S as H}from"./search-B1VJAO7p.js";import{T as Y}from"./trash-2-CSbIpBBo.js";import{S as D}from"./send-DdToiTRE.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-firestore-CkuVbeP5.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";import"./vendor-radix-cHXhEj3X.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-BmjkaPHy.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}; diff --git a/assets/AdminDashboard-sWnGnYr4.js b/assets/AdminDashboard-gfXmaPwb.js similarity index 98% rename from assets/AdminDashboard-sWnGnYr4.js rename to assets/AdminDashboard-gfXmaPwb.js index 776b0353bd97ba05dda66694576f95eb243fb948..e4aafc94094b3952e48fa4e9af2c0d4750ed0f16 100644 --- a/assets/AdminDashboard-sWnGnYr4.js +++ b/assets/AdminDashboard-gfXmaPwb.js @@ -1,4 +1,4 @@ -import{r as x,j as e}from"./vendor-react-Dexh7fmo.js";import Qe from"./Sidebar-CLDaRLyZ.js";import ye from"./ConfirmModal-HuY-9h87.js";import{B as E}from"./button-CwNFy6cp.js";import{I as R}from"./input-DBkKXOmF.js";import{R as Ne,D as Pe,a as Le,b as Re,c as Ie,d as Ee,e as Ue,F as Je,V as Ke,I as se,f as Y}from"./dialog-CiirD9az.js";import{S as q,a as V,b as H,c as W,d as A}from"./select-CHi9TA28.js";import{h as U,e as z,q as re,o as ne,l as $e,w as Ze,u as Fe,a as Q,d as ie,k as we,c as Be}from"./vendor-firebase-firestore-CkuVbeP5.js";import{c as B,d as T,u as Se,t as M,m as L,T as fe,Z as Oe,D as Ye,j as et,k as tt,F as st}from"./index-CYVpLr_P.js";import{P as Ge}from"./plus-C6Q_7FrB.js";import{L as F}from"./loader-circle-C8PWHn54.js";import{C as at}from"./circle-check-big-SmheLDZz.js";import{P as Me}from"./pen-line-Dzt-bcp9.js";import{T as be}from"./trash-2-D383W6Gx.js";import{S as ke}from"./search-CwICt96b.js";import{U as ce}from"./users-CQJB3ZBq.js";import{B as O}from"./book-open-BGS5Zqps.js";import{C as lt}from"./circle-help-a8xBzaz5.js";import{C as je}from"./calendar-DsAM31pV.js";import{C as ae}from"./circle-alert-C5Et-bH4.js";import{S as K}from"./shield-B_6hUGZX.js";import{E as rt}from"./eye-D0u-o7Zh.js";import{S as nt}from"./LogoutActionButton-CCToMg4l.js";import{B as it}from"./bell-BQMual5k.js";import{G as ct}from"./globe-D6NgA4sZ.js";import{S as dt}from"./save-B_ytEIW_.js";import{R as ot,I as xt,F as mt}from"./vendor-radix-cHXhEj3X.js";import{c as Ae}from"./utils-BQQgILNW.js";import{G as Ce}from"./graduation-cap-BAW4sid0.js";import{T as _e}from"./target-GUh8ebLY.js";import{C as ht}from"./clock-Cb5jwJte.js";import{A as le}from"./award-C5AZ3Rkn.js";import{B as ut}from"./brain-D0hS_0wy.js";import{F as pt,T as gt}from"./trending-down-HzTmBWMp.js";import{D as ft}from"./download-i6ku6i1B.js";import{C as ve}from"./chart-column-sGYNY-cm.js";import{a as bt}from"./chevron-up-z_1tCiMP.js";import{M as jt}from"./minus-DeGDLvCZ.js";import{T as vt}from"./trending-up-CqFD_DPI.js";import"./tooltip-DqqE-4Wr.js";import"./x-D3HMN9wJ.js";import"./chevron-right-XRktHzwa.js";import"./message-square-c-O8e9VO.js";import"./swords-C8YOZegm.js";import"./trophy-GpbJF7pP.js";import"./shirt-D--nDwDf.js";import"./log-out-B4zHGAON.js";import"./clsx-B-dksMZM.js";import"./check-C1NZdYTy.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";/** +import{r as x,j as e}from"./vendor-react-Dexh7fmo.js";import Qe from"./Sidebar-HVTXyPGL.js";import ye from"./ConfirmModal-FyItBILR.js";import{B as E}from"./button-CwNFy6cp.js";import{I as R}from"./input-DBkKXOmF.js";import{R as Ne,D as Pe,a as Le,b as Re,c as Ie,d as Ee,e as Ue,F as Je,V as Ke,I as se,f as Y}from"./dialog-CPKbo3wM.js";import{S as q,a as V,b as H,c as W,d as A}from"./select-DCrihmc0.js";import{h as U,e as z,q as re,o as ne,l as $e,w as Ze,u as Fe,a as Q,d as ie,k as we,c as Be}from"./vendor-firebase-firestore-CkuVbeP5.js";import{c as B,d as T,u as Se,t as M,m as L,T as fe,Z as Oe,D as Ye,j as et,k as tt,F as st}from"./index-LyKgWktA.js";import{P as Ge}from"./plus-QA9NgyWS.js";import{L as F}from"./loader-circle-Bd75QYdF.js";import{C as at}from"./circle-check-big-Dj73d5Jk.js";import{P as Me}from"./pen-line-Ctg9I-nz.js";import{T as be}from"./trash-2-CSbIpBBo.js";import{S as ke}from"./search-B1VJAO7p.js";import{U as ce}from"./users-CRaf-j4K.js";import{B as O}from"./book-open-BRafwRDJ.js";import{C as lt}from"./circle-help-CD72X8cm.js";import{C as je}from"./calendar-cirmK6YZ.js";import{C as ae}from"./circle-alert-26D7lLL4.js";import{S as K}from"./shield-CcOzg2El.js";import{E as rt}from"./eye-r-ReRrFU.js";import{S as nt}from"./LogoutActionButton-ggTmlIBR.js";import{B as it}from"./bell-EBkVBtCr.js";import{G as ct}from"./globe-CNqTHI-4.js";import{S as dt}from"./save-qazbBcyz.js";import{R as ot,I as xt,F as mt}from"./vendor-radix-cHXhEj3X.js";import{c as Ae}from"./utils-BQQgILNW.js";import{G as Ce}from"./graduation-cap-BajVF1yD.js";import{T as _e}from"./target-CX3SjMvf.js";import{C as ht}from"./clock-8WaO5Ocs.js";import{A as le}from"./award-BQb3QdnO.js";import{B as ut}from"./brain-19xpRLO9.js";import{F as pt,T as gt}from"./trending-down-B4HmNTSb.js";import{D as ft}from"./download-DGfKThZf.js";import{C as ve}from"./chart-column-CAJHtHZ_.js";import{a as bt}from"./chevron-up-CmF1G4Yx.js";import{M as jt}from"./minus-BGOdCLGP.js";import{T as vt}from"./trending-up-DwhUzSCD.js";import"./tooltip-DqqE-4Wr.js";import"./x-CWNywLHU.js";import"./chevron-right-OeSCfsNc.js";import"./message-square-cJcev-mA.js";import"./swords-DBnIhbCe.js";import"./trophy-vkFq3hpl.js";import"./shirt-PgcFQo2K.js";import"./log-out-CI4drKBP.js";import"./clsx-B-dksMZM.js";import"./check-sV5f01n0.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";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/AvatarShop-1kFCJptl.js b/assets/AvatarShop-EpLIaBDr.js similarity index 98% rename from assets/AvatarShop-1kFCJptl.js rename to assets/AvatarShop-EpLIaBDr.js index 54bee1138cfc682a8967fee6d5889e5da28ccfb4..000b94bad361f03d3758397e9840b306bbf2e146 100644 --- a/assets/AvatarShop-1kFCJptl.js +++ b/assets/AvatarShop-EpLIaBDr.js @@ -1,4 +1,4 @@ -import{r as c,j as e}from"./vendor-react-Dexh7fmo.js";import{T as y,b as j,c as n,a as k}from"./tabs-ZKIOrn_p.js";import{B as N}from"./button-CwNFy6cp.js";import{c as i}from"./utils-BQQgILNW.js";import{c as h,u as _,l as S,m as o,t as d,K as T}from"./index-CYVpLr_P.js";import{S as z}from"./shirt-D--nDwDf.js";import{S as A}from"./sparkles-DCodfP-i.js";import{L}from"./loader-circle-C8PWHn54.js";import"./vendor-radix-cHXhEj3X.js";import"./clsx-B-dksMZM.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-firestore-CkuVbeP5.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";/** +import{r as c,j as e}from"./vendor-react-Dexh7fmo.js";import{T as y,b as j,c as n,a as k}from"./tabs-ZKIOrn_p.js";import{B as N}from"./button-CwNFy6cp.js";import{c as i}from"./utils-BQQgILNW.js";import{c as h,u as _,l as S,m as o,t as d,K as T}from"./index-LyKgWktA.js";import{S as z}from"./shirt-PgcFQo2K.js";import{S as A}from"./sparkles-D-fzJUWE.js";import{L}from"./loader-circle-Bd75QYdF.js";import"./vendor-radix-cHXhEj3X.js";import"./clsx-B-dksMZM.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-firestore-CkuVbeP5.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/ChatMarkdown-CaB5Axzm.js b/assets/ChatMarkdown-sXdo6Daw.js similarity index 97% rename from assets/ChatMarkdown-CaB5Axzm.js rename to assets/ChatMarkdown-sXdo6Daw.js index 68ffd46c41e8a71686681bd57d007db7827d70c9..3b5ba48f1b41c3fbff3393eafb121113e8fa2b3d 100644 --- a/assets/ChatMarkdown-CaB5Axzm.js +++ b/assets/ChatMarkdown-sXdo6Daw.js @@ -1,2 +1,2 @@ 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]); -import{P as i,_ as c}from"./index-CYVpLr_P.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-CkuVbeP5.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}; +import{P as i,_ as c}from"./index-LyKgWktA.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-CkuVbeP5.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}; diff --git a/assets/CompetencyRadarChart-Bso8mrwZ.js b/assets/CompetencyRadarChart-D0AVDm8g.js similarity index 98% rename from assets/CompetencyRadarChart-Bso8mrwZ.js rename to assets/CompetencyRadarChart-D0AVDm8g.js index 17935f252e27129bd6945db2892522d3ebec2fce..d8011fb8449f6bc0a6d2d91aba1d14e05491927c 100644 --- a/assets/CompetencyRadarChart-Bso8mrwZ.js +++ b/assets/CompetencyRadarChart-D0AVDm8g.js @@ -1,2 +1,2 @@ -import{c as u,g as he,r as A,j as p}from"./vendor-react-Dexh7fmo.js";import{u as it,q as at,m as ot}from"./index-CYVpLr_P.js";import{g as st,s as ke}from"./subjects-BZyYKoxN.js";import{B as ct}from"./brain-D0hS_0wy.js";import{S as lt}from"./sparkles-DCodfP-i.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-CkuVbeP5.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";import"./trending-up-CqFD_DPI.js";import"./chart-column-sGYNY-cm.js";var Ot=["points","className","baseLinePoints","connectNulls"];function F(){return F=Object.assign?Object.assign.bind():function(t){for(var e=1;e=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. +import{c as u,g as he,r as A,j as p}from"./vendor-react-Dexh7fmo.js";import{u as it,q as at,m as ot}from"./index-LyKgWktA.js";import{g as st,s as ke}from"./subjects-c5kzjeSA.js";import{B as ct}from"./brain-19xpRLO9.js";import{S as lt}from"./sparkles-D-fzJUWE.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-CkuVbeP5.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";import"./trending-up-DwhUzSCD.js";import"./chart-column-CAJHtHZ_.js";var Ot=["points","className","baseLinePoints","connectNulls"];function F(){return F=Object.assign?Object.assign.bind():function(t){for(var e=1;e=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. 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);n0&&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=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=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;nMe?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=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=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}; diff --git a/assets/ConfirmModal-HuY-9h87.js b/assets/ConfirmModal-FyItBILR.js similarity index 93% rename from assets/ConfirmModal-HuY-9h87.js rename to assets/ConfirmModal-FyItBILR.js index cc04f7f8b20714026f9f45c76485e504d9beb93b..0980cfe704c3bc03562e025e4fb25b3b6fc3b7e2 100644 --- a/assets/ConfirmModal-HuY-9h87.js +++ b/assets/ConfirmModal-FyItBILR.js @@ -1 +1 @@ -import{j as e}from"./vendor-react-Dexh7fmo.js";import{B as i}from"./button-CwNFy6cp.js";import{e as f,m as r,T as h}from"./index-CYVpLr_P.js";import{X as y}from"./x-D3HMN9wJ.js";import{T as j}from"./trash-2-D383W6Gx.js";import{L as w}from"./log-out-B4zHGAON.js";import"./vendor-radix-cHXhEj3X.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-CkuVbeP5.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}; +import{j as e}from"./vendor-react-Dexh7fmo.js";import{B as i}from"./button-CwNFy6cp.js";import{e as f,m as r,T as h}from"./index-LyKgWktA.js";import{X as y}from"./x-CWNywLHU.js";import{T as j}from"./trash-2-CSbIpBBo.js";import{L as w}from"./log-out-CI4drKBP.js";import"./vendor-radix-cHXhEj3X.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-CkuVbeP5.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}; diff --git a/assets/DashboardAvatar-yfFLSMWf.js b/assets/DashboardAvatar-BLMd2BGB.js similarity index 96% rename from assets/DashboardAvatar-yfFLSMWf.js rename to assets/DashboardAvatar-BLMd2BGB.js index 3c540375d6cead820e780145a3a964d681ee578e..d3f5efffd6551edaba6c9b7e2b5aa1d5bfa6321c 100644 --- a/assets/DashboardAvatar-yfFLSMWf.js +++ b/assets/DashboardAvatar-BLMd2BGB.js @@ -1 +1 @@ -import{j as a}from"./vendor-react-Dexh7fmo.js";import{g as e}from"./avatarData-DykDiQ_Y.js";import{m as r}from"./index-CYVpLr_P.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-firestore-CkuVbeP5.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}; +import{j as a}from"./vendor-react-Dexh7fmo.js";import{g as e}from"./avatarData-DykDiQ_Y.js";import{m as r}from"./index-LyKgWktA.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-firestore-CkuVbeP5.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}; diff --git a/assets/DiagnosticAssessmentModal-CMBQPpr8.js b/assets/DiagnosticAssessmentModal-Si7Hh1eA.js similarity index 97% rename from assets/DiagnosticAssessmentModal-CMBQPpr8.js rename to assets/DiagnosticAssessmentModal-Si7Hh1eA.js index b4f0e945ed98b37bf18c990903769ed08497153e..9558a475c4209f69bd78ce643f88b4471f407ce9 100644 --- a/assets/DiagnosticAssessmentModal-CMBQPpr8.js +++ b/assets/DiagnosticAssessmentModal-Si7Hh1eA.js @@ -1 +1 @@ -import{r as m,c as z,j as e}from"./vendor-react-Dexh7fmo.js";import{B as E}from"./button-CwNFy6cp.js";import{M as ye}from"./MathAnswerInput-D4H3Op7Z.js";import be from"./ScientificCalculator-vQs43GTt.js";import{triggerDiagnosticCompleted as ge}from"./automationService-BD3AWvKJ.js";import{m as g,C as T,e as O,T as Q}from"./index-CYVpLr_P.js";import{B as J}from"./brain-D0hS_0wy.js";import{X as Z}from"./x-D3HMN9wJ.js";import{C as ee}from"./circle-check-big-SmheLDZz.js";import{C as ve}from"./chevron-right-XRktHzwa.js";import{C as we}from"./chart-column-sGYNY-cm.js";import{T as je}from"./trending-up-CqFD_DPI.js";import"./vendor-radix-cHXhEj3X.js";import"./clsx-B-dksMZM.js";import"./utils-BQQgILNW.js";import"./apiService-DnEZVkU5.js";import"./chevron-up-z_1tCiMP.js";import"./vendor-firebase-firestore-CkuVbeP5.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{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}; +import{r as m,c as z,j as e}from"./vendor-react-Dexh7fmo.js";import{B as E}from"./button-CwNFy6cp.js";import{M as ye}from"./MathAnswerInput-BZkojdgW.js";import be from"./ScientificCalculator-Do4eNBdw.js";import{triggerDiagnosticCompleted as ge}from"./automationService-b2P2XC_p.js";import{m as g,C as T,e as O,T as Q}from"./index-LyKgWktA.js";import{B as J}from"./brain-19xpRLO9.js";import{X as Z}from"./x-CWNywLHU.js";import{C as ee}from"./circle-check-big-Dj73d5Jk.js";import{C as ve}from"./chevron-right-OeSCfsNc.js";import{C as we}from"./chart-column-CAJHtHZ_.js";import{T as je}from"./trending-up-DwhUzSCD.js";import"./vendor-radix-cHXhEj3X.js";import"./clsx-B-dksMZM.js";import"./utils-BQQgILNW.js";import"./apiService-BmjkaPHy.js";import"./chevron-up-CmF1G4Yx.js";import"./vendor-firebase-firestore-CkuVbeP5.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{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}; diff --git a/assets/FloatingAITutor-DPLt7omS.js b/assets/FloatingAITutor-DFhmOqQt.js similarity index 94% rename from assets/FloatingAITutor-DPLt7omS.js rename to assets/FloatingAITutor-DFhmOqQt.js index dcd9eda7ed30c9103943e52c4a689c01b455eb81..4615ad0f4d7b11956f6c1cb109a28396530a46d4 100644 --- a/assets/FloatingAITutor-DPLt7omS.js +++ b/assets/FloatingAITutor-DFhmOqQt.js @@ -1,7 +1,7 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ChatMarkdown-CaB5Axzm.js","assets/index-CYVpLr_P.js","assets/vendor-react-Dexh7fmo.js","assets/vendor-firebase-auth-COrkgW0P.js","assets/vendor-firebase-core-DQ-pMjxd.js","assets/vendor-firebase-firestore-CkuVbeP5.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-DnEZVkU5.js"])))=>i.map(i=>d[i]); -import{c as S,z as A,_ as w,m as p,B as M}from"./index-CYVpLr_P.js";import{r as a,j as e}from"./vendor-react-Dexh7fmo.js";import{M as f}from"./minus-DeGDLvCZ.js";import{X as b}from"./x-D3HMN9wJ.js";import{S as C}from"./send-DoEjcxSJ.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-firestore-CkuVbeP5.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";/** +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ChatMarkdown-sXdo6Daw.js","assets/index-LyKgWktA.js","assets/vendor-react-Dexh7fmo.js","assets/vendor-firebase-auth-COrkgW0P.js","assets/vendor-firebase-core-DQ-pMjxd.js","assets/vendor-firebase-firestore-CkuVbeP5.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-BmjkaPHy.js"])))=>i.map(i=>d[i]); +import{c as S,z as A,_ as w,m as p,B as M}from"./index-LyKgWktA.js";import{r as a,j as e}from"./vendor-react-Dexh7fmo.js";import{M as f}from"./minus-BGOdCLGP.js";import{X as b}from"./x-CWNywLHU.js";import{S as C}from"./send-DdToiTRE.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-firestore-CkuVbeP5.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */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-CaB5Axzm.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-DnEZVkU5.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"})},_=j(t);g(_)}},[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)},z=()=>{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:z,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}; + */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-sXdo6Daw.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-BmjkaPHy.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"})},_=j(t);g(_)}},[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)},z=()=>{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:z,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}; diff --git a/assets/GradesPage-B1r-crcb.js b/assets/GradesPage-CZjSVd52.js similarity index 96% rename from assets/GradesPage-B1r-crcb.js rename to assets/GradesPage-CZjSVd52.js index c9b7a5d8802d63bc82d5f3d71a6632aff740b1b1..a7a8956876a56c5d7859de35b52a906086f907c8 100644 --- a/assets/GradesPage-B1r-crcb.js +++ b/assets/GradesPage-CZjSVd52.js @@ -1,2 +1,2 @@ -import{r as n,j as e}from"./vendor-react-Dexh7fmo.js";import{B as S}from"./button-CwNFy6cp.js";import{u as $,m as H,g as W}from"./index-CYVpLr_P.js";import{g as V,S as k}from"./subjects-BZyYKoxN.js";import{A as T}from"./award-C5AZ3Rkn.js";import{T as A}from"./trending-up-CqFD_DPI.js";import{T as C}from"./target-GUh8ebLY.js";import{C as P}from"./calendar-DsAM31pV.js";import{D as _}from"./download-i6ku6i1B.js";import{T as J,F as K}from"./trending-down-HzTmBWMp.js";import{C as X}from"./chevron-right-XRktHzwa.js";import"./vendor-radix-cHXhEj3X.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-CkuVbeP5.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";import"./chart-column-sGYNY-cm.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(` +import{r as n,j as e}from"./vendor-react-Dexh7fmo.js";import{B as S}from"./button-CwNFy6cp.js";import{u as $,m as H,g as W}from"./index-LyKgWktA.js";import{g as V,S as k}from"./subjects-c5kzjeSA.js";import{A as T}from"./award-BQb3QdnO.js";import{T as A}from"./trending-up-DwhUzSCD.js";import{T as C}from"./target-CX3SjMvf.js";import{C as P}from"./calendar-cirmK6YZ.js";import{D as _}from"./download-DGfKThZf.js";import{T as J,F as K}from"./trending-down-B4HmNTSb.js";import{C as X}from"./chevron-right-OeSCfsNc.js";import"./vendor-radix-cHXhEj3X.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-CkuVbeP5.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";import"./chart-column-CAJHtHZ_.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(` `),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}; diff --git a/assets/HeroBanner-Dml-Sn9K.js b/assets/HeroBanner-nfRGXqul.js similarity index 94% rename from assets/HeroBanner-Dml-Sn9K.js rename to assets/HeroBanner-nfRGXqul.js index 79b4682c37df64ba857cf626fab064a223d4c28d..6cb0a34d2c5ecf1e449fea940a4611223b2cbe80 100644 --- a/assets/HeroBanner-Dml-Sn9K.js +++ b/assets/HeroBanner-nfRGXqul.js @@ -1,7 +1,7 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DashboardAvatar-yfFLSMWf.js","assets/vendor-react-Dexh7fmo.js","assets/avatarData-DykDiQ_Y.js","assets/index-CYVpLr_P.js","assets/vendor-firebase-auth-COrkgW0P.js","assets/vendor-firebase-core-DQ-pMjxd.js","assets/vendor-firebase-firestore-CkuVbeP5.js","assets/vendor-firebase-storage-BOeKE_0n.js","assets/vendor-firebase-analytics-CCo6E2f7.js","assets/index-CR2i2gnI.css"])))=>i.map(i=>d[i]); -import{c as x,m as t,Z as c,A as p,_ as b}from"./index-CYVpLr_P.js";import{j as e,r}from"./vendor-react-Dexh7fmo.js";import{B as h}from"./brain-D0hS_0wy.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-firestore-CkuVbeP5.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";/** +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DashboardAvatar-BLMd2BGB.js","assets/vendor-react-Dexh7fmo.js","assets/avatarData-DykDiQ_Y.js","assets/index-LyKgWktA.js","assets/vendor-firebase-auth-COrkgW0P.js","assets/vendor-firebase-core-DQ-pMjxd.js","assets/vendor-firebase-firestore-CkuVbeP5.js","assets/vendor-firebase-storage-BOeKE_0n.js","assets/vendor-firebase-analytics-CCo6E2f7.js","assets/index-CR2i2gnI.css"])))=>i.map(i=>d[i]); +import{c as x,m as t,Z as c,A as p,_ as b}from"./index-LyKgWktA.js";import{j as e,r}from"./vendor-react-Dexh7fmo.js";import{B as h}from"./brain-19xpRLO9.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-firestore-CkuVbeP5.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */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-yfFLSMWf.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}; + */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-BLMd2BGB.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}; diff --git a/assets/LeaderboardPage-D6ahhKnH.js b/assets/LeaderboardPage-BMdoHzNS.js similarity index 97% rename from assets/LeaderboardPage-D6ahhKnH.js rename to assets/LeaderboardPage-BMdoHzNS.js index c5d2cf0d05c258f55c290beefebe4c8224cb436b..835aaa554ecab4d7e6cd8a0db7c24007c86f4cc5 100644 --- a/assets/LeaderboardPage-D6ahhKnH.js +++ b/assets/LeaderboardPage-BMdoHzNS.js @@ -1,4 +1,4 @@ -import{r as o,j as e}from"./vendor-react-Dexh7fmo.js";import{c as O,E as R,e as W,m as d,F as A,l as X,u as $,G as H}from"./index-CYVpLr_P.js";import{X as U}from"./x-D3HMN9wJ.js";import{B as y}from"./book-open-BGS5Zqps.js";import{T as B}from"./target-GUh8ebLY.js";import{A as k}from"./award-C5AZ3Rkn.js";import{C as q}from"./clock-Cb5jwJte.js";import{T as v}from"./trophy-GpbJF7pP.js";import{T as P}from"./trending-up-CqFD_DPI.js";import{L as M}from"./loader-circle-C8PWHn54.js";import{S as G}from"./star-BOFYd7BG.js";import{U as L}from"./user-D-TTwp40.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-firestore-CkuVbeP5.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";/** +import{r as o,j as e}from"./vendor-react-Dexh7fmo.js";import{c as O,E as R,e as W,m as d,F as A,l as X,u as $,G as H}from"./index-LyKgWktA.js";import{X as U}from"./x-CWNywLHU.js";import{B as y}from"./book-open-BRafwRDJ.js";import{T as B}from"./target-CX3SjMvf.js";import{A as k}from"./award-BQb3QdnO.js";import{C as q}from"./clock-8WaO5Ocs.js";import{T as v}from"./trophy-vkFq3hpl.js";import{T as P}from"./trending-up-DwhUzSCD.js";import{L as M}from"./loader-circle-Bd75QYdF.js";import{S as G}from"./star-BbJSm_XE.js";import{U as L}from"./user-BZgiUM6h.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-firestore-CkuVbeP5.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/LearningPath-BSacbKfT.js b/assets/LearningPath-xhsARrsq.js similarity index 85% rename from assets/LearningPath-BSacbKfT.js rename to assets/LearningPath-xhsARrsq.js index 623df39aa13dd40a1022a88eac12326ac16adbc0..12aac391ba5ad135ec5e8c6c799a8841044c5c9c 100644 --- a/assets/LearningPath-BSacbKfT.js +++ b/assets/LearningPath-xhsARrsq.js @@ -1 +1 @@ -import{r as p,c as h,j as t}from"./vendor-react-Dexh7fmo.js";import{u as S,o as k,p as v,g as w,A as C}from"./index-CYVpLr_P.js";import{g as L,s as M}from"./subjects-BZyYKoxN.js";import{M as A}from"./ModuleFolderCard-Bxgj3UEp.js";import{B as E}from"./book-open-BGS5Zqps.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-firestore-CkuVbeP5.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";import"./trending-up-CqFD_DPI.js";import"./chart-column-sGYNY-cm.js";import"./clock-Cb5jwJte.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,o)=>[v[s],o]));return[...e].sort((s,o)=>{const n=r.get(s.id)??Number.POSITIVE_INFINITY,N=r.get(o.id)??Number.POSITIVE_INFINITY;return n-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 o=x?.subjects?.[l.id]?.modulesProgress?.[e.id]?.lessonsCompleted?.length||0,n=e.lessons.length>0?Math.round(o/e.lessons.length*100):0;return{...e,progress:n,status:n===100?"Completed":n>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}; +import{r as p,c as h,j as t}from"./vendor-react-Dexh7fmo.js";import{u as S,o as k,p as v,g as w,A as C}from"./index-LyKgWktA.js";import{g as L,s as M}from"./subjects-c5kzjeSA.js";import{M as A}from"./ModuleFolderCard-CZJPjlmm.js";import{B as E}from"./book-open-BRafwRDJ.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-firestore-CkuVbeP5.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";import"./trending-up-DwhUzSCD.js";import"./chart-column-CAJHtHZ_.js";import"./clock-8WaO5Ocs.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,o)=>[v[s],o]));return[...e].sort((s,o)=>{const n=r.get(s.id)??Number.POSITIVE_INFINITY,N=r.get(o.id)??Number.POSITIVE_INFINITY;return n-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 o=x?.subjects?.[l.id]?.modulesProgress?.[e.id]?.lessonsCompleted?.length||0,n=e.lessons.length>0?Math.round(o/e.lessons.length*100):0;return{...e,progress:n,status:n===100?"Completed":n>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}; diff --git a/assets/LoginPage-T2QRM5oF.js b/assets/LoginPage-QhJ2yB_c.js similarity index 96% rename from assets/LoginPage-T2QRM5oF.js rename to assets/LoginPage-QhJ2yB_c.js index 8aefed2d547ab2f64789ceacc55f64ee475bbd79..282758b8b1f5c22c351532073719b5d263b804e6 100644 --- a/assets/LoginPage-T2QRM5oF.js +++ b/assets/LoginPage-QhJ2yB_c.js @@ -1 +1 @@ -import{r,j as e}from"./vendor-react-Dexh7fmo.js";import{B as Q}from"./button-CwNFy6cp.js";import{I as N}from"./input-DBkKXOmF.js";import{m as a,A as I,s as C,a as K,b as z}from"./index-CYVpLr_P.js";import{S as X}from"./sparkles-DCodfP-i.js";import{B as Z}from"./brain-D0hS_0wy.js";import{T as ee}from"./trending-up-CqFD_DPI.js";import{A as te}from"./award-C5AZ3Rkn.js";import{U as B}from"./users-CQJB3ZBq.js";import{G}from"./graduation-cap-BAW4sid0.js";import{B as D}from"./book-open-BGS5Zqps.js";import{M as ae}from"./mail-C5ZpVS09.js";import{L}from"./lock-COR_g_Qg.js";import{E as se}from"./eye-off-DAmUDwrX.js";import{E as re}from"./eye-D0u-o7Zh.js";import{S as le}from"./shield-check-CotW-v_m.js";import"./vendor-radix-cHXhEj3X.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-CkuVbeP5.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"]},[y,k]=r.useState(""),[f,w]=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"),[b,P]=r.useState(d["Grade 11"][0]),[u,E]=r.useState("Mathematics"),[M,c]=r.useState(!1),[T,n]=r.useState(null),[$,O]=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(b)&&P(t[0])},[m,b]);const H=[{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"}],Y=async(t,s,p)=>{n(null),c(!0),k(t),w(s),A(p),S(!1);try{C(p),await z(t,s)}catch(x){n(R(x,"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(y,f,v,o,o==="student"?{grade:m,section:b}:{department:u})}else await z(y,f)}catch(s){n(R(s,"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:()=>O(!0),className:`absolute inset-0 w-full h-full object-cover transition-opacity duration-1000 ${$?"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.2) 0%, rgba(248,250,252,0.5) 50%, rgba(255,241,242,0.4) 80%, rgba(248,250,252,0.85) 100%)"}}),e.jsx("div",{className:"absolute top-[10%] left-[-10%] w-[60%] h-[60%] rounded-full blur-[140px] pointer-events-none mix-blend-multiply",style:{background:"radial-gradient(circle, rgba(168,85,247,0.3) 0%, transparent 70%)"}}),e.jsx("div",{className:"absolute bottom-[-10%] right-[-10%] w-[70%] h-[70%] rounded-full blur-[160px] pointer-events-none mix-blend-multiply",style:{background:"radial-gradient(circle, rgba(236,72,153,0.25) 0%, transparent 70%)"}}),e.jsx("div",{className:"absolute top-[40%] left-[40%] w-[40%] h-[40%] rounded-full blur-[120px] pointer-events-none mix-blend-screen",style:{background:"radial-gradient(circle, rgba(56,189,248,0.2) 0%, transparent 70%)"}}),e.jsx("div",{className:"absolute inset-0 pointer-events-none",style:{backgroundImage:"radial-gradient(circle, rgba(15,23,42,0.4) 1px, transparent 1px)",backgroundSize:"24px 24px"}}),W.map((t,s)=>e.jsx(a.span,{className:"absolute text-sky-700/[0.08] font-display select-none pointer-events-none",style:{fontSize:`${20+Math.random()*40}px`,left:`${5+s*9.5}%`,top:`${10+s*8}%`},animate:{y:[0,-30,0],opacity:[.04,.1,.04],rotate:[0,10,0]},transition:{duration:8+s*2,repeat:1/0,ease:"easeInOut",delay:s*.5},children:t},s)),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(a.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(a.div,{className:"flex items-center gap-2.5",children:[e.jsx(a.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.jsx("h1",{className:"text-3xl font-display font-black tracking-tight text-slate-900 bg-clip-text text-transparent bg-gradient-to-r from-purple-600 via-pink-600 to-sky-500",children:"MathPulse"}),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(a.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,s)=>{const p=t.icon,x={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(a.div,{className:`bg-white/80 backdrop-blur-xl border ${x[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+s*.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(p,{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})]},s)})})]}),e.jsx(a.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-3xl p-7 w-full max-w-md relative overflow-hidden shadow-[0_20px_60px_-15px_rgba(168,85,247,0.15)]",children:[e.jsx("div",{className:"absolute top-0 left-0 right-0 h-[3px] bg-gradient-to-r from-purple-500 via-pink-500 to-sky-500"}),e.jsx("div",{className:"absolute -top-40 left-1/2 -translate-x-1/2 w-80 h-80 bg-gradient-to-br from-purple-400/20 to-pink-400/20 rounded-full blur-[60px] pointer-events-none"}),e.jsxs("div",{className:"text-center mb-6 relative",children:[e.jsx(a.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(a.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(a.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(a.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(a.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 s=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 ${s?"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(a.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(a.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:b,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(a.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(a.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(ae,{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:y,onChange:t=>k(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(a.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=>w(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(a.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(se,{size:16}):e.jsx(re,{size:16})})]})]}),e.jsx(a.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-purple-600 to-pink-500 hover:from-purple-500 hover:to-pink-400 text-white font-body font-semibold py-3 rounded-xl shadow-lg shadow-purple-600/25 hover:shadow-pink-500/35 hover:scale-[1.02] transition-all text-sm group relative overflow-hidden disabled:opacity-50 disabled:cursor-not-allowed",children:[e.jsx(a.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(a.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:H.map(t=>{const s=t.icon,p={sky:"bg-sky-100",emerald:"bg-emerald-100",rose:"bg-rose-100"},x={sky:"text-sky-600",emerald:"text-emerald-600",rose:"text-rose-500"};return e.jsxs(a.button,{type:"button",onClick:()=>Y(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 ${p[t.color]}`,children:e.jsx(s,{size:15,className:x[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(a.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}; +import{r,j as e}from"./vendor-react-Dexh7fmo.js";import{B as Q}from"./button-CwNFy6cp.js";import{I as N}from"./input-DBkKXOmF.js";import{m as a,A as I,s as C,a as K,b as z}from"./index-LyKgWktA.js";import{S as X}from"./sparkles-D-fzJUWE.js";import{B as Z}from"./brain-19xpRLO9.js";import{T as ee}from"./trending-up-DwhUzSCD.js";import{A as te}from"./award-BQb3QdnO.js";import{U as B}from"./users-CRaf-j4K.js";import{G}from"./graduation-cap-BajVF1yD.js";import{B as D}from"./book-open-BRafwRDJ.js";import{M as ae}from"./mail-BSFHdQFh.js";import{L}from"./lock-DeaK7IhY.js";import{E as se}from"./eye-off-zFZIYFo3.js";import{E as re}from"./eye-r-ReRrFU.js";import{S as le}from"./shield-check-WLUcWIeq.js";import"./vendor-radix-cHXhEj3X.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-CkuVbeP5.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"]},[y,k]=r.useState(""),[f,w]=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"),[b,P]=r.useState(d["Grade 11"][0]),[u,E]=r.useState("Mathematics"),[M,c]=r.useState(!1),[T,n]=r.useState(null),[$,O]=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(b)&&P(t[0])},[m,b]);const H=[{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"}],Y=async(t,s,p)=>{n(null),c(!0),k(t),w(s),A(p),S(!1);try{C(p),await z(t,s)}catch(x){n(R(x,"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(y,f,v,o,o==="student"?{grade:m,section:b}:{department:u})}else await z(y,f)}catch(s){n(R(s,"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:()=>O(!0),className:`absolute inset-0 w-full h-full object-cover transition-opacity duration-1000 ${$?"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.2) 0%, rgba(248,250,252,0.5) 50%, rgba(255,241,242,0.4) 80%, rgba(248,250,252,0.85) 100%)"}}),e.jsx("div",{className:"absolute top-[10%] left-[-10%] w-[60%] h-[60%] rounded-full blur-[140px] pointer-events-none mix-blend-multiply",style:{background:"radial-gradient(circle, rgba(168,85,247,0.3) 0%, transparent 70%)"}}),e.jsx("div",{className:"absolute bottom-[-10%] right-[-10%] w-[70%] h-[70%] rounded-full blur-[160px] pointer-events-none mix-blend-multiply",style:{background:"radial-gradient(circle, rgba(236,72,153,0.25) 0%, transparent 70%)"}}),e.jsx("div",{className:"absolute top-[40%] left-[40%] w-[40%] h-[40%] rounded-full blur-[120px] pointer-events-none mix-blend-screen",style:{background:"radial-gradient(circle, rgba(56,189,248,0.2) 0%, transparent 70%)"}}),e.jsx("div",{className:"absolute inset-0 pointer-events-none",style:{backgroundImage:"radial-gradient(circle, rgba(15,23,42,0.4) 1px, transparent 1px)",backgroundSize:"24px 24px"}}),W.map((t,s)=>e.jsx(a.span,{className:"absolute text-sky-700/[0.08] font-display select-none pointer-events-none",style:{fontSize:`${20+Math.random()*40}px`,left:`${5+s*9.5}%`,top:`${10+s*8}%`},animate:{y:[0,-30,0],opacity:[.04,.1,.04],rotate:[0,10,0]},transition:{duration:8+s*2,repeat:1/0,ease:"easeInOut",delay:s*.5},children:t},s)),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(a.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(a.div,{className:"flex items-center gap-2.5",children:[e.jsx(a.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.jsx("h1",{className:"text-3xl font-display font-black tracking-tight text-slate-900 bg-clip-text text-transparent bg-gradient-to-r from-purple-600 via-pink-600 to-sky-500",children:"MathPulse"}),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(a.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,s)=>{const p=t.icon,x={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(a.div,{className:`bg-white/80 backdrop-blur-xl border ${x[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+s*.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(p,{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})]},s)})})]}),e.jsx(a.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-3xl p-7 w-full max-w-md relative overflow-hidden shadow-[0_20px_60px_-15px_rgba(168,85,247,0.15)]",children:[e.jsx("div",{className:"absolute top-0 left-0 right-0 h-[3px] bg-gradient-to-r from-purple-500 via-pink-500 to-sky-500"}),e.jsx("div",{className:"absolute -top-40 left-1/2 -translate-x-1/2 w-80 h-80 bg-gradient-to-br from-purple-400/20 to-pink-400/20 rounded-full blur-[60px] pointer-events-none"}),e.jsxs("div",{className:"text-center mb-6 relative",children:[e.jsx(a.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(a.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(a.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(a.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(a.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 s=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 ${s?"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(a.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(a.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:b,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(a.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(a.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(ae,{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:y,onChange:t=>k(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(a.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=>w(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(a.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(se,{size:16}):e.jsx(re,{size:16})})]})]}),e.jsx(a.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-purple-600 to-pink-500 hover:from-purple-500 hover:to-pink-400 text-white font-body font-semibold py-3 rounded-xl shadow-lg shadow-purple-600/25 hover:shadow-pink-500/35 hover:scale-[1.02] transition-all text-sm group relative overflow-hidden disabled:opacity-50 disabled:cursor-not-allowed",children:[e.jsx(a.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(a.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:H.map(t=>{const s=t.icon,p={sky:"bg-sky-100",emerald:"bg-emerald-100",rose:"bg-rose-100"},x={sky:"text-sky-600",emerald:"text-emerald-600",rose:"text-rose-500"};return e.jsxs(a.button,{type:"button",onClick:()=>Y(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 ${p[t.color]}`,children:e.jsx(s,{size:15,className:x[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(a.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}; diff --git a/assets/LogoutActionButton-CCToMg4l.js b/assets/LogoutActionButton-ggTmlIBR.js similarity index 94% rename from assets/LogoutActionButton-CCToMg4l.js rename to assets/LogoutActionButton-ggTmlIBR.js index 593255bee13358184c0893882b19f0c05bc9305f..4ba8748dd45be219998b76705af067ea58460178 100644 --- a/assets/LogoutActionButton-CCToMg4l.js +++ b/assets/LogoutActionButton-ggTmlIBR.js @@ -1,4 +1,4 @@ -import{c as a,m as s}from"./index-CYVpLr_P.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-B4zHGAON.js";/** +import{c as a,m as s}from"./index-LyKgWktA.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-CI4drKBP.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/MathAnswerInput-D4H3Op7Z.js b/assets/MathAnswerInput-BZkojdgW.js similarity index 98% rename from assets/MathAnswerInput-D4H3Op7Z.js rename to assets/MathAnswerInput-BZkojdgW.js index 88a608789c397d0c208538d4cb1e30552149f251..4f18b5954fb2f41976241f779e324e400d2fd083 100644 --- a/assets/MathAnswerInput-D4H3Op7Z.js +++ b/assets/MathAnswerInput-BZkojdgW.js @@ -1 +1 @@ -import{r as c,c as y,j as e}from"./vendor-react-Dexh7fmo.js";import{C as P}from"./index-CYVpLr_P.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-1"),t=t.replace(/cos⁻¹/g,"cos-1"),t=t.replace(/tan⁻¹/g,"tan-1"),t=t.replace(/⁻¹/g,"-1"),t=t.replace(/²/g,"2"),t=t.replace(/³/g,"3"),t=t.replace(/[⁰¹⁴⁵⁶⁷⁸⁹]/g,d=>`${{"⁰":"0","¹":"1","⁴":"4","⁵":"5","⁶":"6","⁷":"7","⁸":"8","⁹":"9"}[d]??d}`),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}; +import{r as c,c as y,j as e}from"./vendor-react-Dexh7fmo.js";import{C as P}from"./index-LyKgWktA.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-1"),t=t.replace(/cos⁻¹/g,"cos-1"),t=t.replace(/tan⁻¹/g,"tan-1"),t=t.replace(/⁻¹/g,"-1"),t=t.replace(/²/g,"2"),t=t.replace(/³/g,"3"),t=t.replace(/[⁰¹⁴⁵⁶⁷⁸⁹]/g,d=>`${{"⁰":"0","¹":"1","⁴":"4","⁵":"5","⁶":"6","⁷":"7","⁸":"8","⁹":"9"}[d]??d}`),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}; diff --git a/assets/ModuleFolderCard-Bxgj3UEp.js b/assets/ModuleFolderCard-CZJPjlmm.js similarity index 96% rename from assets/ModuleFolderCard-Bxgj3UEp.js rename to assets/ModuleFolderCard-CZJPjlmm.js index 06713d5da638909682629ff61ef07ae36ea92655..b4e9cd9ee120dbc81ebfc299b769b78fd7b3047f 100644 --- a/assets/ModuleFolderCard-Bxgj3UEp.js +++ b/assets/ModuleFolderCard-CZJPjlmm.js @@ -1 +1 @@ -import{j as e}from"./vendor-react-Dexh7fmo.js";import{m as d,T as n}from"./index-CYVpLr_P.js";import{B as x}from"./book-open-BGS5Zqps.js";import{C as h}from"./clock-Cb5jwJte.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}; +import{j as e}from"./vendor-react-Dexh7fmo.js";import{m as d,T as n}from"./index-LyKgWktA.js";import{B as x}from"./book-open-BRafwRDJ.js";import{C as h}from"./clock-8WaO5Ocs.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}; diff --git a/assets/ModulesPage-DJAi-xJS.js b/assets/ModulesPage-COuXuHrB.js similarity index 98% rename from assets/ModulesPage-DJAi-xJS.js rename to assets/ModulesPage-COuXuHrB.js index ef95e01b472ff02d6427cf2e6c0c76f2cc944b06..b3d02264c6a4d0da767ca0e204c3c0c142f9f082 100644 --- a/assets/ModulesPage-DJAi-xJS.js +++ b/assets/ModulesPage-COuXuHrB.js @@ -1,4 +1,4 @@ -import{r as l,j as e}from"./vendor-react-Dexh7fmo.js";import{M as we}from"./ModuleFolderCard-Bxgj3UEp.js";import{B as X}from"./button-CwNFy6cp.js";import{I as Oe}from"./input-DBkKXOmF.js";import{c as F,m as p,Z as Ae,F as ae,e as Y,A as Ce,C as pe,u as Se,q as Ze,r as He,v as ze,w as Xe,x as Ue,g as Ye,o as Ke,p as Je,T as et,y as tt}from"./index-CYVpLr_P.js";import{T as H}from"./trophy-GpbJF7pP.js";import{S as je}from"./sparkles-DCodfP-i.js";import{T as Z}from"./target-GUh8ebLY.js";import{A as re}from"./award-C5AZ3Rkn.js";import{S as Te}from"./star-BOFYd7BG.js";import{C as me}from"./check-C1NZdYTy.js";import{X as G}from"./x-D3HMN9wJ.js";import{C as st}from"./circle-help-a8xBzaz5.js";import{a as Me,s as ie,g as at}from"./subjects-BZyYKoxN.js";import{T as he}from"./trending-up-CqFD_DPI.js";import{B as U}from"./book-open-BGS5Zqps.js";import{L as Pe,c as it,a as nt}from"./quizService-DjlH8cxx.js";import{C as se}from"./circle-check-big-SmheLDZz.js";import{L as ve}from"./lock-COR_g_Qg.js";import{C as ne}from"./clock-Cb5jwJte.js";import Ie from"./confetti.module-C94ZD2ww.js";import{triggerQuizSubmitted as rt}from"./automationService-BD3AWvKJ.js";import ot from"./ScientificCalculator-vQs43GTt.js";import{M as lt}from"./MathAnswerInput-D4H3Op7Z.js";import Le from"./SupplementalBanner-DTd5-XUw.js";import{P as ct}from"./pen-line-Dzt-bcp9.js";import{C as dt}from"./chevron-right-XRktHzwa.js";import{S as xt}from"./search-CwICt96b.js";import"./vendor-radix-cHXhEj3X.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-CkuVbeP5.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";import"./chart-column-sGYNY-cm.js";import"./apiService-DnEZVkU5.js";import"./chevron-up-z_1tCiMP.js";import"./brain-D0hS_0wy.js";/** +import{r as l,j as e}from"./vendor-react-Dexh7fmo.js";import{M as we}from"./ModuleFolderCard-CZJPjlmm.js";import{B as X}from"./button-CwNFy6cp.js";import{I as Oe}from"./input-DBkKXOmF.js";import{c as F,m as p,Z as Ae,F as ae,e as Y,A as Ce,C as pe,u as Se,q as Ze,r as He,v as ze,w as Xe,x as Ue,g as Ye,o as Ke,p as Je,T as et,y as tt}from"./index-LyKgWktA.js";import{T as H}from"./trophy-vkFq3hpl.js";import{S as je}from"./sparkles-D-fzJUWE.js";import{T as Z}from"./target-CX3SjMvf.js";import{A as re}from"./award-BQb3QdnO.js";import{S as Te}from"./star-BbJSm_XE.js";import{C as me}from"./check-sV5f01n0.js";import{X as G}from"./x-CWNywLHU.js";import{C as st}from"./circle-help-CD72X8cm.js";import{a as Me,s as ie,g as at}from"./subjects-c5kzjeSA.js";import{T as he}from"./trending-up-DwhUzSCD.js";import{B as U}from"./book-open-BRafwRDJ.js";import{L as Pe,c as it,a as nt}from"./quizService-B3HGgNhs.js";import{C as se}from"./circle-check-big-Dj73d5Jk.js";import{L as ve}from"./lock-DeaK7IhY.js";import{C as ne}from"./clock-8WaO5Ocs.js";import Ie from"./confetti.module-C94ZD2ww.js";import{triggerQuizSubmitted as rt}from"./automationService-b2P2XC_p.js";import ot from"./ScientificCalculator-Do4eNBdw.js";import{M as lt}from"./MathAnswerInput-BZkojdgW.js";import Le from"./SupplementalBanner-DIN86DZO.js";import{P as ct}from"./pen-line-Ctg9I-nz.js";import{C as dt}from"./chevron-right-OeSCfsNc.js";import{S as xt}from"./search-B1VJAO7p.js";import"./vendor-radix-cHXhEj3X.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-CkuVbeP5.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";import"./chart-column-CAJHtHZ_.js";import"./apiService-BmjkaPHy.js";import"./chevron-up-CmF1G4Yx.js";import"./brain-19xpRLO9.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/NotificationCenter-Eg9vwWZd.js b/assets/NotificationCenter-ofzm6YSA.js similarity index 92% rename from assets/NotificationCenter-Eg9vwWZd.js rename to assets/NotificationCenter-ofzm6YSA.js index ff42e12e8b3a7e68a4305006189980c72624be81..027cb420a97cd52d4ca82cb54a2feb046624370f 100644 --- a/assets/NotificationCenter-Eg9vwWZd.js +++ b/assets/NotificationCenter-ofzm6YSA.js @@ -1 +1 @@ -import{r as m,j as e}from"./vendor-react-Dexh7fmo.js";import{u as w,m as o,e as A,n as C,h as z,i as M}from"./index-CYVpLr_P.js";import{B as h}from"./bell-BQMual5k.js";import{C as E}from"./check-check-Rx2AszdF.js";import{X as R}from"./x-D3HMN9wJ.js";import{B as T}from"./book-open-BGS5Zqps.js";import{M as $}from"./message-square-c-O8e9VO.js";import{C as B}from"./circle-alert-C5Et-bH4.js";import{T as H}from"./trophy-GpbJF7pP.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-firestore-CkuVbeP5.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";const W=({userRole:S="student"})=>{const{currentUser:l}=w(),[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 C(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 v=s.createdAt instanceof Date?s.createdAt:new Date(s.createdAt),k=Date.now()-v.getTime(),i=Math.floor(k/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)),M(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(A,{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(E,{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{W as default}; +import{r as m,j as e}from"./vendor-react-Dexh7fmo.js";import{u as w,m as o,e as A,n as C,h as z,i as M}from"./index-LyKgWktA.js";import{B as h}from"./bell-EBkVBtCr.js";import{C as E}from"./check-check-9iSO4G-S.js";import{X as R}from"./x-CWNywLHU.js";import{B as T}from"./book-open-BRafwRDJ.js";import{M as $}from"./message-square-cJcev-mA.js";import{C as B}from"./circle-alert-26D7lLL4.js";import{T as H}from"./trophy-vkFq3hpl.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-firestore-CkuVbeP5.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";const W=({userRole:S="student"})=>{const{currentUser:l}=w(),[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 C(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 v=s.createdAt instanceof Date?s.createdAt:new Date(s.createdAt),k=Date.now()-v.getTime(),i=Math.floor(k/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)),M(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(A,{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(E,{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{W as default}; diff --git a/assets/ProfileModal-B2Fc7DEQ.js b/assets/ProfileModal-C2CHUW-6.js similarity index 97% rename from assets/ProfileModal-B2Fc7DEQ.js rename to assets/ProfileModal-C2CHUW-6.js index 17f54ea6cfb24b87ae4417153ff0bbaf21d91c82..846a23dc90dffcf79e0304404da1403da9baa604 100644 --- a/assets/ProfileModal-B2Fc7DEQ.js +++ b/assets/ProfileModal-C2CHUW-6.js @@ -1,4 +1,4 @@ -import{j as e,r as i}from"./vendor-react-Dexh7fmo.js";import{B as f}from"./button-CwNFy6cp.js";import{I as d}from"./input-DBkKXOmF.js";import{c as v,m as c,e as _,G as A,L as B}from"./index-CYVpLr_P.js";import{g as h}from"./avatarData-DykDiQ_Y.js";import{X as D}from"./x-D3HMN9wJ.js";import{U as j}from"./users-CQJB3ZBq.js";import{M as R}from"./mail-C5ZpVS09.js";import{A as u}from"./award-C5AZ3Rkn.js";import{B as I}from"./book-open-BGS5Zqps.js";import{C as F}from"./calendar-DsAM31pV.js";import{G as U}from"./globe-D6NgA4sZ.js";import{S as Y}from"./save-B_ytEIW_.js";import"./vendor-radix-cHXhEj3X.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-CkuVbeP5.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";/** +import{j as e,r as i}from"./vendor-react-Dexh7fmo.js";import{B as f}from"./button-CwNFy6cp.js";import{I as d}from"./input-DBkKXOmF.js";import{c as v,m as c,e as _,G as A,L as B}from"./index-LyKgWktA.js";import{g as h}from"./avatarData-DykDiQ_Y.js";import{X as D}from"./x-CWNywLHU.js";import{U as j}from"./users-CRaf-j4K.js";import{M as R}from"./mail-BSFHdQFh.js";import{A as u}from"./award-BQb3QdnO.js";import{B as I}from"./book-open-BRafwRDJ.js";import{C as F}from"./calendar-cirmK6YZ.js";import{G as U}from"./globe-CNqTHI-4.js";import{S as Y}from"./save-qazbBcyz.js";import"./vendor-radix-cHXhEj3X.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-CkuVbeP5.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/QuizBattlePage-BJ5HoB2m.js b/assets/QuizBattlePage-3pqx9mUa.js similarity index 95% rename from assets/QuizBattlePage-BJ5HoB2m.js rename to assets/QuizBattlePage-3pqx9mUa.js index eebd7f96bf9aa4fe1eef68b7a777038bfcfadcfc..497c91c8e8031eb403e7a99a86cf39bed9a3a269 100644 --- a/assets/QuizBattlePage-BJ5HoB2m.js +++ b/assets/QuizBattlePage-3pqx9mUa.js @@ -1,4 +1,4 @@ -import{c as De,m as b,d as Re,H as je,I as Te,J as C,u as Ut,_ as Vt,B as ht,l as Gt}from"./index-CYVpLr_P.js";import{r as c,j as e}from"./vendor-react-Dexh7fmo.js";import{c as u}from"./utils-BQQgILNW.js";import{g as Zt,s as Yt}from"./subjects-BZyYKoxN.js";import{d as Xt,b as Jt,w as bt,o as It,l as Xe,h as Je,q as Ke,e as et}from"./vendor-firebase-firestore-CkuVbeP5.js";import{Y as M,Z as At,$ as zt,a0 as fe,a1 as Kt}from"./vendor-firebase-core-DQ-pMjxd.js";import{B as A}from"./button-CwNFy6cp.js";import{T as ea,a as ue}from"./tabs-ZKIOrn_p.js";import{S as me,a as xe,b as pe,c as he,d as Q}from"./select-CHi9TA28.js";import{I as ta}from"./input-DBkKXOmF.js";import{S as ft}from"./switch-aCsENXi7.js";import{S as te,C as gt}from"./skeleton-BQc0_1c8.js";import{S as Ue}from"./swords-C8YOZegm.js";import{S as Ve}from"./star-BOFYd7BG.js";import{T as Ge}from"./trophy-GpbJF7pP.js";import{T as wt}from"./target-GUh8ebLY.js";import{S as vt}from"./sparkles-DCodfP-i.js";import{C as ze}from"./chevron-right-XRktHzwa.js";import{U as Be}from"./users-CQJB3ZBq.js";import{C as yt}from"./check-C1NZdYTy.js";import{L as Ze}from"./loader-circle-C8PWHn54.js";import{S as aa}from"./shield-check-CotW-v_m.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";import"./clsx-B-dksMZM.js";import"./trending-up-CqFD_DPI.js";import"./chart-column-sGYNY-cm.js";import"./vendor-radix-cHXhEj3X.js";import"./chevron-up-z_1tCiMP.js";/** +import{c as De,m as b,d as Re,H as je,I as Te,J as C,u as Ut,_ as Vt,B as ht,l as Gt}from"./index-LyKgWktA.js";import{r as c,j as e}from"./vendor-react-Dexh7fmo.js";import{c as u}from"./utils-BQQgILNW.js";import{g as Zt,s as Yt}from"./subjects-c5kzjeSA.js";import{d as Xt,b as Kt,w as bt,o as It,l as Xe,h as Ke,q as Je,e as et}from"./vendor-firebase-firestore-CkuVbeP5.js";import{Y as M,Z as At,$ as zt,a0 as fe,a1 as Jt}from"./vendor-firebase-core-DQ-pMjxd.js";import{B as A}from"./button-CwNFy6cp.js";import{T as ea,a as ue}from"./tabs-ZKIOrn_p.js";import{S as me,a as xe,b as pe,c as he,d as Q}from"./select-DCrihmc0.js";import{I as ta}from"./input-DBkKXOmF.js";import{S as ft}from"./switch-aCsENXi7.js";import{S as te,C as gt}from"./skeleton-FRDY0mw5.js";import{S as Ue}from"./swords-DBnIhbCe.js";import{S as Ve}from"./star-BbJSm_XE.js";import{T as Ge}from"./trophy-vkFq3hpl.js";import{T as wt}from"./target-CX3SjMvf.js";import{S as vt}from"./sparkles-D-fzJUWE.js";import{C as ze}from"./chevron-right-OeSCfsNc.js";import{U as Be}from"./users-CRaf-j4K.js";import{C as yt}from"./check-sV5f01n0.js";import{L as Ze}from"./loader-circle-Bd75QYdF.js";import{S as aa}from"./shield-check-WLUcWIeq.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";import"./clsx-B-dksMZM.js";import"./trending-up-DwhUzSCD.js";import"./chart-column-CAJHtHZ_.js";import"./vendor-radix-cHXhEj3X.js";import"./chevron-up-CmF1G4Yx.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. @@ -18,5 +18,5 @@ import{c as De,m as b,d as Re,H as je,I as Te,J as C,u as Ut,_ as Vt,B as ht,l a * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ia=[["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"}]],la=De("volume-x",ia),da="/assets/quiz_battle_avatar-vvxcW_MO.png",Ce=({width:a,x:s,delay:r,duration:d})=>{const l=["#9956DE","#7274ED","#1FA7E1","#6ED1CF","#75D06A","#FFB356","#FF8B8B","#FB96BB"],n=l[Math.floor(Math.random()*l.length)],f=Math.floor(Math.random()*10)+1;return e.jsx(b.div,{style:{"--x":`${s}`,"--width":`${a}`,"--aspect-ratio":`${f}`,"--background":`linear-gradient(${n}cc, transparent)`},className:"absolute left-[var(--x)] top-0 [aspect-ratio:1/var(--aspect-ratio)] [background:var(--background)] [width:var(--width)]",initial:{y:"100cqmax",x:"-50%"},animate:{y:"-100%",x:"-50%"},transition:{duration:d,delay:r,repeat:Number.POSITIVE_INFINITY,ease:"linear"}})},ca=({children:a,perspective:s=100,className:r,beamsPerSide:d=6,beamSize:l=4,beamDelayMax:n=1.5,beamDelayMin:f=0,beamDuration:_=4,gridColor:w="rgba(100, 116, 139, 0.08)",...j})=>{const p=c.useCallback(()=>{const I=[],re=Math.floor(100/l)/d;for(let oe=0;oep(),[p]),k=c.useMemo(()=>p(),[p]),m=c.useMemo(()=>p(),[p]),N=c.useMemo(()=>p(),[p]);return e.jsxs("div",{className:u("relative w-full h-full",r),...j,children:[e.jsxs("div",{style:{"--perspective":`${s}px`,"--grid-color":w,"--beam-size":`${l}%`},className:"pointer-events-none absolute inset-0 overflow-hidden [clip-path:inset(0)] [container-type:size] [perspective:var(--perspective)] [transform-style:preserve-3d] -z-10 bg-[#42389d]",children:[e.jsx("div",{className:"absolute [transform-style:preserve-3d] [background-size:var(--beam-size)_var(--beam-size)] [background:linear-gradient(var(--grid-color)_0_1px,_transparent_1px_var(--beam-size))_50%_-0.5px_/var(--beam-size)_var(--beam-size),linear-gradient(90deg,_var(--grid-color)_0_1px,_transparent_1px_var(--beam-size))_50%_50%_/var(--beam-size)_var(--beam-size)] [container-type:inline-size] [height:100cqmax] [transform-origin:50%_0%] [transform:rotateX(-90deg)] [width:100cqi]",children:B.map((I,E)=>e.jsx(Ce,{width:`${l}%`,x:`${I.x*l}%`,delay:I.delay,duration:_},`top-${E}`))}),e.jsx("div",{className:"absolute top-full [transform-style:preserve-3d] [background-size:var(--beam-size)_var(--beam-size)] [background:linear-gradient(var(--grid-color)_0_1px,_transparent_1px_var(--beam-size))_50%_-0.5px_/var(--beam-size)_var(--beam-size),linear-gradient(90deg,_var(--grid-color)_0_1px,_transparent_1px_var(--beam-size))_50%_50%_/var(--beam-size)_var(--beam-size)] [container-type:inline-size] [height:100cqmax] [transform-origin:50%_0%] [transform:rotateX(-90deg)] [width:100cqi]",children:m.map((I,E)=>e.jsx(Ce,{width:`${l}%`,x:`${I.x*l}%`,delay:I.delay,duration:_},`bottom-${E}`))}),e.jsx("div",{className:"absolute left-0 top-0 [transform-style:preserve-3d] [background-size:var(--beam-size)_var(--beam-size)] [background:linear-gradient(var(--grid-color)_0_1px,_transparent_1px_var(--beam-size))_50%_-0.5px_/var(--beam-size)_var(--beam-size),linear-gradient(90deg,_var(--grid-color)_0_1px,_transparent_1px_var(--beam-size))_50%_50%_/var(--beam-size)_var(--beam-size)] [container-type:inline-size] [height:100cqmax] [transform-origin:0%_0%] [transform:rotate(90deg)_rotateX(-90deg)] [width:100cqh]",children:N.map((I,E)=>e.jsx(Ce,{width:`${l}%`,x:`${I.x*l}%`,delay:I.delay,duration:_},`left-${E}`))}),e.jsx("div",{className:"absolute right-0 top-0 [transform-style:preserve-3d] [background-size:var(--beam-size)_var(--beam-size)] [background:linear-gradient(var(--grid-color)_0_1px,_transparent_1px_var(--beam-size))_50%_-0.5px_/var(--beam-size)_var(--beam-size),linear-gradient(90deg,_var(--grid-color)_0_1px,_transparent_1px_var(--beam-size))_50%_50%_/var(--beam-size)_var(--beam-size)] [container-type:inline-size] [height:100cqmax] [width:100cqh] [transform-origin:100%_0%] [transform:rotate(-90deg)_rotateX(-90deg)]",children:k.map((I,E)=>e.jsx(Ce,{width:`${l}%`,x:`${I.x*l}%`,delay:I.delay,duration:_},`right-${E}`))})]}),e.jsx("div",{className:"relative z-10 w-full h-full",children:a})]})},ua=15e3,ma="mathpulse.quizBattle.local",Nt="".toLowerCase()==="true",qe=typeof window<"u",Ee=()=>qe&&!1,at=()=>{const a=Te.currentUser?.uid;return a||"local-student"},Bt=a=>`${ma}.${a}`,ke=a=>{const s={stats:ge(a),history:[],queueStatus:"idle"};if(!qe)return s;try{const r=window.localStorage.getItem(Bt(a));if(!r)return s;const d=JSON.parse(r),l=Array.isArray(d.history)?d.history.map(f=>tt(f.matchId||"local-match",f)):[];return{stats:d.stats?{...ge(a),...d.stats,userId:a,updatedAt:Fe(d.stats.updatedAt)}:ge(a),history:l,queueStatus:d.queueStatus==="queued"||d.queueStatus==="matched"?d.queueStatus:"idle"}}catch(r){return console.error("Error reading local Quiz Battle fallback store:",r),s}},Ct=(a,s)=>{if(qe)try{window.localStorage.setItem(Bt(a),JSON.stringify(s))}catch(r){console.error("Error writing local Quiz Battle fallback store:",r)}},Mt=a=>{const s=a||{},r=typeof s.code=="string"?s.code:"";return r?r.startsWith("functions/")?r.replace("functions/",""):r:""},U=a=>{if(!Ee())return!1;const s=Mt(a);if(["internal","not-found","unavailable","deadline-exceeded"].includes(s))return!0;const r=a||{},d=(typeof r.message=="string"?r.message:a instanceof Error?a.message:"").toLowerCase();return d?d.includes("cors policy")||d.includes("no access-control-allow-origin")||d.includes("failed to fetch")||d.includes("network error")||d.includes("err_failed"):!1},Me=(a,s)=>Math.floor(Math.random()*(s-a+1))+a,xa=(a,s)=>{const r=Math.max(3,a),d=s==="easy"?0:s==="medium"?1:s==="hard"?2:1,l=Me(Math.max(0,r-3-d),r),n=Me(Math.max(0,r-4+d),r),f=Math.min(r,Math.max(0,l)),_=Math.min(r,Math.max(0,n)),w=Math.max(0,Math.min(100,f/r*100+Me(-8,6))),j=Me(1800,6200);return{scoreFor:f,scoreAgainst:_,accuracy:w,averageResponseMs:j}},pa=a=>{const s=at(),r=ke(s),d=`local-bot-${Date.now()}-${Math.random().toString(16).slice(2,8)}`,l=xa(a.rounds,a.botDifficulty),n=l.scoreFor>l.scoreAgainst?"win":l.scoreFor0?j/w*100:0,averageAccuracy:w>0?(r.stats.averageAccuracy*r.stats.matchesPlayed+l.accuracy)/w:l.accuracy,averageResponseMs:w>0?Math.round((r.stats.averageResponseMs*r.stats.matchesPlayed+l.averageResponseMs)/w):l.averageResponseMs,currentStreak:k,bestStreak:m,favoriteTopicId:a.topicId,leaderboardScore:r.stats.leaderboardScore+_.xpEarned,updatedAt:f};return Ct(s,{stats:N,history:[_,...r.history].slice(0,50),queueStatus:"idle"}),{success:!0,matchId:d,status:"ready",botDifficulty:a.botDifficulty}},Rt=a=>{const s=at(),r=ke(s);Ct(s,{...r,queueStatus:a})},ha=()=>Math.random().toString(36).slice(2,8).toUpperCase(),st=a=>{const s=at();return{roomId:`local-room-${Date.now()}`,roomCode:a||ha(),ownerStudentId:s,participantIds:[s],participantCount:1,status:"waiting",subjectId:"gen-math",topicId:"functions",difficulty:"medium",rounds:5,timePerQuestionSec:30,isOwner:!0}},Et=()=>qe&&!!Te.currentUser?.uid&&!!je,Ft=(a,s,r)=>`quizBattlePresence/${a}/${s}/${r}`,ba=async(a,s)=>{if(!Et()||!s.trim()||!je)return;const r=Te.currentUser?.uid;if(!r)return;const d=At(je,Ft(a,s,r));try{await zt(d,{studentId:r,scope:a,resourceId:s,online:!0,heartbeatAt:fe(),updatedAt:fe()}),await Kt(d).update({online:!1,updatedAt:fe(),disconnectedAt:fe()})}catch(l){console.warn("Realtime presence connect failed:",l)}},fa=async(a,s)=>{if(!Et()||!s.trim()||!je)return;const r=Te.currentUser?.uid;if(!r)return;const d=At(je,Ft(a,s,r));try{await zt(d,{studentId:r,scope:a,resourceId:s,online:!1,updatedAt:fe(),disconnectedAt:fe()})}catch(l){console.warn("Realtime presence disconnect failed:",l)}},D=(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 d=s||{},l=Mt(s),n=typeof d.message=="string"?d.message.trim():"";return l==="unauthenticated"?"Your session has expired. Sign in again before starting a battle.":l==="permission-denied"?"Only student accounts can access Quiz Battle matchmaking.":l==="invalid-argument"?n||"Battle setup is invalid. Review the selected options and try again.":l==="already-exists"?n||"This room is already full. Try another room code.":l==="failed-precondition"?n||"Battle state changed. Please refresh and continue.":l==="unavailable"||l==="internal"||l==="not-found"||l==="deadline-exceeded"?/question generation temporarily unavailable/i.test(n)?n:"Quiz Battle service is temporarily unavailable. Please retry in a moment.":r},R=async(a,s,r=ua)=>{let d;try{return await Promise.race([s,new Promise((l,n)=>{d=setTimeout(()=>{n(new Error(`Timed out while ${a}. Please try again.`))},r)})])}finally{d&&clearTimeout(d)}},Fe=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},ga=()=>({mode:"online",subjectId:"gen-math",topicId:"",difficulty:"medium",rounds:5,timePerQuestionSec:30,queueType:"public_matchmaking",botDifficulty:"medium",adaptiveBot:!1}),wa=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},ge=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}),va=async a=>{try{const s=Xt(Re,"studentBattleStats",a),r=await Jt(s),d=Ee()?ke(a).stats:null;if(!r.exists())return d&&d.matchesPlayed>0?d:ge(a);const l=r.data(),n={...ge(a),...l,userId:a,updatedAt:Fe(l.updatedAt)};return d&&d.matchesPlayed>n.matchesPlayed?d:n}catch(s){if(console.error("Error loading battle stats:",s),Ee()){const r=ke(a).stats;if(r.matchesPlayed>0)return r}return ge(a)}},tt=(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:Fe(s.createdAt),endedAt:Fe(s.endedAt)}),ya=async(a,s={})=>{const r=s.limitCount||25,d=Ee()?ke(a).history:[],l=f=>f.filter(w=>!(s.mode&&s.mode!=="all"&&w.mode!==s.mode||s.subjectId&&w.subjectId!==s.subjectId||s.startDate&&w.endedAts.endDate)).sort((w,j)=>j.endedAt.getTime()-w.endedAt.getTime()).slice(0,r),n=f=>{if(d.length===0)return l(f);const _=new Map;return[...d,...f].forEach(w=>{_.set(w.matchId,w)}),l(Array.from(_.values()))};try{const f=[bt("studentId","==",a),It("endedAt","desc"),Xe(r)],w=(await Je(Ke(et(Re,"quizBattleHistory"),...f))).docs.map(j=>tt(j.id,j.data()));return n(w)}catch(f){try{const w=(await Je(Ke(et(Re,"quizBattleHistory"),bt("studentId","==",a),Xe(r)))).docs.map(j=>tt(j.id,j.data())).sort((j,p)=>p.endedAt.getTime()-j.endedAt.getTime());return n(w)}catch(_){return console.error("Error loading battle history:",f,_),l(d)}}},ja=async a=>{const s=M(C,"quizBattleJoinQueue");try{return(await R("joining Quiz Battle matchmaking queue",s({setup:a}))).data}catch(r){if(U(r))return Rt("queued"),{success:!0,status:"queued",queueEntryId:`local-queue-${Date.now()}`};throw new Error(D("joining Quiz Battle matchmaking queue",r))}},ka=async()=>{const a=M(C,"quizBattleLeaveQueue");try{return(await R("leaving Quiz Battle matchmaking queue",a({}))).data}catch(s){if(U(s))return Rt("idle"),{success:!0,status:"idle"};throw new Error(D("leaving Quiz Battle matchmaking queue",s))}},Na=async a=>{const s=M(C,"quizBattleCreatePrivateRoom");try{return(await R("creating Quiz Battle private room",s({setup:a}))).data}catch(r){if(U(r))return{success:!0,room:st()};throw new Error(D("creating Quiz Battle private room",r))}},_a=async a=>{const s=M(C,"quizBattleJoinPrivateRoom");try{return(await R("joining Quiz Battle private room",s({roomCode:a}),2e4)).data}catch(r){if(U(r))return{success:!0,room:st(a.trim().toUpperCase()||void 0)};throw new Error(D("joining Quiz Battle private room",r))}},Sa=async a=>{const s=M(C,"quizBattleGetPrivateRoomState");try{return(await R("loading Quiz Battle private room state",s(a),2e4)).data}catch(r){if(U(r))return{success:!0,room:st(a.roomCode?.trim().toUpperCase()||void 0)};throw new Error(D("loading Quiz Battle private room state",r))}},Ia=async(a={})=>{const s=M(C,"quizBattleLeavePrivateRoom");try{return(await R("leaving Quiz Battle private room",s(a),2e4)).data}catch(r){if(U(r))return{success:!0,status:"idle"};throw new Error(D("leaving Quiz Battle private room",r))}},_t=async()=>{const a=M(C,"quizBattleResumeSession");try{return(await R("resuming Quiz Battle session",a({}),2e4)).data}catch(s){if(U(s))return{success:!0,sessionType:"idle"};throw new Error(D("resuming Quiz Battle session",s))}},Aa=async(a,s)=>{if(!s.trim())return;const r=M(C,"quizBattleHeartbeat");await ba(a,s);try{await R("sending Quiz Battle heartbeat",r({scope:a,resourceId:s}),12e3)}catch(d){if(!U(d))throw new Error(D("sending Quiz Battle heartbeat",d))}},za=async a=>{const s=M(C,"quizBattleCreateBotMatch");try{return(await R("starting Quiz Battle bot match",s({setup:a}))).data}catch(r){if(U(r))return pa(a);throw new Error(D("starting Quiz Battle bot match",r))}},Ba=async a=>{const s=M(C,"quizBattleGetGenerationAudit");return(await R("verifying Quiz Battle generation metadata",s({matchId:a}),2e4)).data},ae=async a=>{const s=M(C,"quizBattleStartMatch");try{const d=(await R("starting Quiz Battle match",s({matchId:a}),2e4)).data.match;if(d.mode==="online")try{const l=await Ba(a);if(console.info("[QUIZ_BATTLE_GENERATION_AUDIT]",l),Nt&&!l.isAiSource)throw new Error(`Quiz Battle generation audit failed: expected AI source, got "${l.questionSetSource||"unknown"}".`)}catch(l){if(l instanceof Error&&l.message.startsWith("Quiz Battle generation audit failed"))throw l;if(console.warn("Quiz Battle generation audit unavailable:",l),Nt)throw new Error("Unable to verify Quiz Battle generation metadata. Please retry in a moment.")}return d}catch(r){throw new Error(D("starting Quiz Battle match",r))}},Ye=async a=>{const s=M(C,"quizBattleGetMatchState");try{return(await R("loading Quiz Battle match state",s({matchId:a}),2e4)).data.match}catch(r){throw new Error(D("loading Quiz Battle match state",r))}},Ca=async a=>{const s=M(C,"quizBattleSubmitAnswer");try{return(await R("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(D("submitting Quiz Battle answer",r))}},Ma=async a=>{const s=M(C,"quizBattleRequestRematch");try{return(await R("creating Quiz Battle rematch",s({matchId:a}),2e4)).data}catch(r){throw new Error(D("creating Quiz Battle rematch",r))}},Ra=async(a=20)=>{try{const s=Ke(et(Re,"studentBattleLeaderboard"),It("leaderboardScore","desc"),Xe(a));return(await Je(s)).docs.map((d,l)=>{const n=d.data();return{userId:n.userId||d.id,displayName:n.displayName||"Student",photo:n.photo,rank:n.rank||l+1,leaderboardScore:n.leaderboardScore||0,winRate:n.winRate||0,bestStreak:n.bestStreak||0}})}catch(s){return console.error("Error loading Quiz Battle leaderboard:",s),[]}};function W({className:a,...s}){return e.jsx("div",{"data-slot":"card",className:u("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border",a),...s})}function Y({className:a,...s}){return e.jsx("div",{"data-slot":"card-header",className:u("@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 X({className:a,...s}){return e.jsx("h4",{"data-slot":"card-title",className:u("leading-none",a),...s})}function se({className:a,...s}){return e.jsx("p",{"data-slot":"card-description",className:u("text-muted-foreground",a),...s})}function be({className:a,...s}){return e.jsx("div",{"data-slot":"card-content",className:u("px-6 [&:last-child]:pb-6",a),...s})}const F="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)]",Ea=a=>a<=0?"--":`${(a/1e3).toFixed(2)}s`,Fa=a=>a==="win"?"Win":a==="loss"?"Loss":"Draw",Da=(a,s,r)=>Math.max(s,Math.min(r,a)),Ta=a=>{const s=Math.floor(a/60),r=a%60;return`${s}:${String(r).padStart(2,"0")}`},qa=a=>{const s=a.trim().split(/\s+/).filter(Boolean).slice(0,2);return s.length===0?"ST":s.map(r=>r[0]?.toUpperCase()||"").join("")},St=(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,hs=()=>{const{userProfile:a,userRole:s}=Ut(),r=a,[d,l]=c.useState("hub"),[n,f]=c.useState(ga),[_,w]=c.useState([]),[j,p]=c.useState({status:"idle"}),[B,k]=c.useState(!1),[m,N]=c.useState(null),[I,E]=c.useState(""),[re,oe]=c.useState(null),[Ne,J]=c.useState(0),[ne,Dt]=c.useState(()=>typeof window>"u"?!0:window.localStorage.getItem("quiz_battle_sound_enabled")!=="0"),[rt,z]=c.useState("connected"),[ie,Tt]=c.useState("all"),[ot,Qe]=c.useState(!0),[L,Pe]=c.useState(null),[Le,Oe]=c.useState([]),[qt,nt]=c.useState(!1),[it,Qt]=c.useState([]),[_e,Pt]=c.useState("alias"),[$e,Lt]=c.useState(!1),[o,S]=c.useState(null),[we,O]=c.useState(null),[V,ve]=c.useState(!1),[q,ye]=c.useState(0),[$,H]=c.useState(!1),[Se,le]=c.useState(null),lt=c.useRef(""),He=c.useRef(null),de=c.useRef(null),G=c.useRef(0),dt=c.useRef(""),Z=c.useMemo(()=>{const t=Zt(r?.grade);return Yt.filter(i=>t.includes(i.id))},[r?.grade]),Ot=c.useMemo(()=>(Z.find(i=>i.id===n.subjectId)?.modules||[]).map(i=>({value:i.id,label:i.title})),[Z,n.subjectId]),K=c.useCallback(t=>{if(!ne||typeof window>"u")return;const i=window.AudioContext||window.webkitAudioContext;if(i)try{const x=new i,h=x.createOscillator(),g=x.createGain(),y={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],P=x.currentTime;h.type=y.type,h.frequency.setValueAtTime(y.frequency,P),g.gain.setValueAtTime(1e-4,P),g.gain.exponentialRampToValueAtTime(y.volume,P+.015),g.gain.exponentialRampToValueAtTime(1e-4,P+y.duration),h.connect(g),g.connect(x.destination),h.start(P),h.stop(P+y.duration+.02),window.setTimeout(()=>{x.close()},Math.ceil((y.duration+.06)*1e3))}catch(x){console.debug("Battle tone playback skipped:",x)}},[ne]),ct=c.useCallback(async t=>{if(!(!t||typeof window>"u"))try{await window.navigator.clipboard.writeText(t),oe(t),window.setTimeout(()=>{oe(i=>i===t?null:i)},1600)}catch{p({status:"error",message:"Unable to copy room code automatically. Please copy it manually."})}},[]),ce=c.useCallback(async()=>{if(!r?.uid)return null;const[t,i]=await Promise.all([va(r.uid),ya(r.uid,{mode:ie,limitCount:8})]);return{stats:t,history:i}},[ie,r?.uid]);c.useEffect(()=>{if(Z.length===0)return;const i=Z.some(g=>g.id===n.subjectId)?n.subjectId:Z[0].id,x=Z.find(g=>g.id===i),h=x?.modules?.[0]?.id||"";f(g=>{const v=x?.modules?.some(y=>y.id===g.topicId)?g.topicId:h;return g.subjectId===i&&g.topicId===v?g:{...g,subjectId:i,topicId:v}})},[Z,n.subjectId]),c.useEffect(()=>{if(!r?.uid){Pe(null),Oe([]),Qe(!1);return}let t=!0;return Qe(!0),(async()=>{const x=await ce();t&&(x&&(Pe(x.stats),Oe(x.history)),Qe(!1))})(),()=>{t=!1}},[ce,r?.uid]);const Ie=c.useMemo(()=>ie==="all"?Le:Le.filter(t=>t.mode===ie),[Le,ie]),ut=c.useMemo(()=>it.map((t,i)=>{const x=t.rank||i+1,h=t.userId===r?.uid,g=`Student-${t.userId.slice(-4).toUpperCase()}`,v=_e==="full"?t.displayName:_e==="initials"?qa(t.displayName):g,y=Math.floor(t.leaderboardScore/25)*25,P=$e||h?`${t.leaderboardScore} pts`:`${y}-${y+24} pts`;return{...t,rank:x,isSelf:h,displayName:v,scoreLabel:P}}),[it,_e,$e,r?.uid]);c.useEffect(()=>{if(d!=="leaderboard"&&d!=="hub")return;let t=!0;return nt(!0),(async()=>{const x=await Ra(20);t&&(Qt(x),nt(!1))})(),()=>{t=!1}},[d]);const Ae=c.useCallback(async()=>{if(r?.uid)try{const t=await _t();if(t.sessionType==="match"&&t.match){k(!1),N(t.room||null),S(t.match),l("battle"),z("connected");return}if(t.sessionType==="room"&&t.room){k(!1),N(t.room),S(i=>i?.mode==="bot"?i:null),z("connected");return}if(t.sessionType==="queue"){k(!0),N(null),S(i=>i?.mode==="bot"?i:null),z("connected");return}k(!1),N(null),S(i=>i?.mode==="bot"?i:null),z("connected")}catch(t){console.warn("Quiz Battle session resume failed:",t),z("reconnecting")}},[r?.uid]);c.useEffect(()=>{r?.uid&&Ae()},[r?.uid,Ae]),c.useEffect(()=>{typeof window>"u"||window.localStorage.setItem("quiz_battle_sound_enabled",ne?"1":"0")},[ne]),c.useEffect(()=>{if(!(B||m&&(m.status==="waiting"||m.status==="ready"))){J(0);return}const t=window.setInterval(()=>{J(i=>i+1)},1e3);return()=>{window.clearInterval(t)}},[B,m?.status,m?.roomId]),c.useEffect(()=>{if(typeof window>"u")return;z(window.navigator.onLine?"connected":"disconnected");const t=()=>{z("reconnecting"),Ae()},i=()=>{z("disconnected")};return window.addEventListener("online",t),window.addEventListener("offline",i),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",i)}},[Ae]),c.useEffect(()=>{const t=o?.mode==="online"&&(o.status==="ready"||o.status==="in_progress"),i=!!(m&&(m.status==="waiting"||m.status==="ready"));if(!B&&!i&&!t)return;let x=!1;const h=async()=>{try{if(o?.mode==="online"){if(o.status==="ready"){const y=await ae(o.matchId);if(x)return;S(y),z("connected"),y.status==="in_progress"&&p({status:"queued",message:"Match started. Round timer is live."});return}const v=await Ye(o.matchId);if(x)return;S(v),v.status==="completed"&&(k(!1),N(null)),z("connected");return}if(m?.roomId){const v=await Sa({roomId:m.roomId});if(x)return;if(N(v.room),v.match){const y=await ae(v.match.matchId);if(x)return;S(y),N(v.room),k(!1),l("battle"),z("connected"),p({status:"queued",message:y.status==="ready"?"Opponent connected. Waiting for synchronized start...":"Private room match started."})}return}if(B){const v=await _t();if(x)return;if(v.sessionType==="match"&&v.match){const y=await ae(v.match.matchId);if(x)return;S(y),N(v.room||null),k(!1),l("battle"),z("connected"),p({status:"queued",message:"Opponent found. Preparing synchronized start..."});return}if(v.sessionType==="room"&&v.room){k(!1),N(v.room),z("connected");return}z("connected")}}catch(v){x||(console.warn("Quiz Battle sync poll failed:",v),z("reconnecting"))}};h();const g=window.setInterval(()=>{h()},3e3);return()=>{x=!0,window.clearInterval(g)}},[o?.matchId,o?.mode,o?.status,m?.roomId,m?.status,B]);const ee=c.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}:B&&r?.uid?{scope:"queue",resourceId:r.uid}:null,[o,m,B,r?.uid]);c.useEffect(()=>{if(!ee)return;let t=!1;const i=async()=>{try{await Aa(ee.scope,ee.resourceId),t||z("connected")}catch(h){t||(console.warn("Quiz Battle heartbeat failed:",h),z("reconnecting"))}};i();const x=window.setInterval(()=>{i()},8e3);return()=>{t=!0,window.clearInterval(x),fa(ee.scope,ee.resourceId)}},[ee?.scope,ee?.resourceId]),c.useEffect(()=>{if(!o||o.status!=="in_progress"){H(!1),de.current=null,G.current=0;return}de.current=null,G.current=0;const t=o.roundDeadlineAtMs?Math.max(0,Math.ceil((o.roundDeadlineAtMs-Date.now())/1e3)):o.timePerQuestionSec;ye(t),O(null),H(!1)},[o?.matchId,o?.status,o?.currentRound,o?.timePerQuestionSec]),c.useEffect(()=>{const t=o?.lifecycle;if(!t?.eventType)return;const i=`${t.eventType}:${t.sequence}`;lt.current!==i&&(lt.current=i,t.eventType==="answer_locked"?K("lock"):t.eventType==="round_result"&&K("result"))},[o?.lifecycle?.eventType,o?.lifecycle?.sequence,K]),c.useEffect(()=>{!o||o.status!=="completed"||dt.current!==o.matchId&&(dt.current=o.matchId,K(o.outcome==="loss"?"loss":"win"),o.outcome==="win"&&Vt(()=>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,K]),c.useEffect(()=>{if(!o||o.status!=="in_progress"||$||V){He.current=null;return}q<=3&&q>0&&He.current!==q&&(He.current=q,K("tick"))},[o?.status,q,$,V,K]);const We=c.useCallback(async t=>{if(!o||o.status!=="in_progress"||$)return;ve(!0);const i=window.setTimeout(()=>{ve(!1),p({status:"error",message:"Submission took too long. Syncing latest match state now..."}),Ye(o.matchId).then(x=>{S(x),x.status==="completed"&&(k(!1),N(null))}).catch(()=>{})},12e3);try{const x=o.roundDeadlineAtMs?Da(o.timePerQuestionSec*1e3-Math.max(0,o.roundDeadlineAtMs-Date.now()),0,o.timePerQuestionSec*1e3):Math.max(0,(o.timePerQuestionSec-q)*1e3),h=await Ca({matchId:o.matchId,roundNumber:o.currentRound,selectedOptionIndex:t,responseMs:x});de.current=null,G.current=0,S(h.match),le(h.roundResult),O(null),h.match.mode==="online"&&h.match.status==="in_progress"&&!h.roundResult&&(H(!0),p({status:"queued",message:"Answer locked. Waiting for opponent to finish the round..."})),h.match.status==="completed"&&(k(!1),N(null),ce(),p({status:"queued",message:h.completion?`Match finished (${h.completion.outcome.toUpperCase()}) +${h.completion.xpEarned} XP`:"Match finished. Results saved."}))}catch(x){const g=x?.message||"Unable to submit answer right now. Please try again.";if(t===null||g.includes("Round timer elapsed")||g.includes("Expected round")||g.includes("Match is not currently active"))try{const y=await Ye(o.matchId),P=y.currentRound!==o.currentRound;if(S(y),O(null),H(!1),P||y.status==="completed"?(de.current=null,G.current=0):t===null&&(G.current=Date.now()+3e3),y.status==="completed"){k(!1),N(null),ce(),p({status:"queued",message:"Match finished. Results synchronized."});return}p({status:"queued",message:"Round timed out. Synced to the latest battle state."});return}catch{}t===null&&(G.current=Date.now()+3e3),p({status:"error",message:g})}finally{window.clearTimeout(i),ve(!1)}},[o,ce,$,q]);c.useEffect(()=>{if(!o||o.status!=="in_progress"||V||$)return;const t=o.roundDeadlineAtMs?Math.max(0,Math.ceil((o.roundDeadlineAtMs-Date.now())/1e3)):q;if(o.roundDeadlineAtMs&&t!==q&&ye(t),we===null?t<=1:t<=0){if(de.current===o.currentRound&&Date.now(){o.roundDeadlineAtMs?ye(Math.max(0,Math.ceil((o.roundDeadlineAtMs-Date.now())/1e3))):ye(h=>Math.max(0,h-1))},1e3);return()=>{window.clearTimeout(x)}},[o,V,$,q,we,We]);const $t=c.useCallback(async()=>{if(!(!o||o.mode!=="bot")){ve(!0),p({status:"validating"});try{const t=await Ma(o.matchId),i=await ae(t.matchId);S(i),N(null),k(!1),le(null),O(null),H(!1),l("battle"),p({status:"queued",message:`Rematch ready (${t.botDifficulty}). Good luck!`})}catch(t){p({status:"error",message:t?.message||"Unable to start rematch right now."})}finally{ve(!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(W,{className:u(F,"max-w-2xl"),children:e.jsxs(Y,{children:[e.jsx(X,{children:"Quiz Battle is student-only"}),e.jsx(se,{className:"text-muted-foreground dark:text-[#aab3c7]",children:"Your account role does not have access to this module."})]})})});const mt=t=>{w([]),p({status:"idle"}),k(!1),N(null),E(""),S(null),le(null),O(null),H(!1),f(i=>({...i,mode:t,queueType:t==="online"?i.queueType:"public_matchmaking"})),J(0),l("setup")},xt=async()=>{p({status:"validating"});try{m?.roomId?await Ia({roomId:m.roomId}):await ka(),k(!1),N(null),S(t=>!t||t.mode!=="online"?t:t.status==="ready"||t.status==="cancelled"?null:t),E(""),J(0),p({status:"queued",message:m?.roomId?"Private room cancelled.":"Left matchmaking queue."})}catch(t){p({status:"error",message:t?.message||"Unable to cancel this online session right now. Please try again."})}},Ht=async()=>{p({status:"validating"});const t=wa(n);if(t.length>0){w(t),p({status:"error",message:"Fix the highlighted setup fields before starting."});return}w([]);try{if(n.mode==="online"){if(n.queueType==="private_room"){const g=I.trim().toUpperCase(),v=g?await _a(g):await Na(n);if(k(!1),N(v.room),E(""),v.match){const y=await ae(v.match.matchId);S(y),le(null),O(null),H(!1),l("battle"),p({status:"queued",message:y.status==="ready"?`Room ${v.room.roomCode} linked. Waiting for synchronized start...`:"Private room match started."});return}S(null),p({status:"queued",message:g?"Joined private room. Waiting for opponent...":"Private room created. Share code:"});return}const h=await ja(n);if(h.status==="matched"&&h.matchId){const g=await ae(h.matchId);k(!1),N(null),S(g),le(null),O(null),H(!1),l("battle"),p({status:"queued",message:"Opponent found. Preparing synchronized start..."});return}k(!0),N(null),S(null),J(0),p({status:"queued",message:"Joined matchmaking queue. Waiting for an opponent..."});return}const i=await za(n),x=await ae(i.matchId);k(!1),N(null),S(x),le(null),O(null),H(!1),ye(x.timePerQuestionSec),l("battle"),p({status:"queued",message:`Bot match ${i.matchId.slice(0,8)} live (${i.botDifficulty}).`}),ce().then(h=>{h&&(Pe(h.stats),Oe(h.history))})}catch(i){k(!1),p({status:"error",message:i?.message||"Unable to start battle. Please try again."})}},T=t=>_.find(i=>i.field===t)?.message;L?.winRate;const pt=!!(n.mode==="online"&&m&&(m.status==="waiting"||m.status==="ready")&&(!o||o.status!=="completed")),Wt=!!(B||m&&(m.status==="waiting"||m.status==="ready")&&(!o||o.status==="ready"||o.status==="cancelled"));return e.jsx(ca,{className:"-mx-3 lg:-mx-4 -mt-3 lg:-mt-4 -mb-8 px-4 sm:px-6 xl:px-10 py-6 sm:py-8 min-h-[calc(100vh-3.5rem)] !w-auto overflow-hidden relative",children:e.jsx("div",{className:"h-full flex flex-col max-w-[1400px] mx-auto w-full",children:e.jsx(b.div,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{duration:.24,ease:[.22,1,.36,1]},className:"space-y-3 lg:space-y-4",children:e.jsxs(ea,{value:d,onValueChange:t=>l(t),children:[e.jsx(ue,{value:"hub",className:"mt-0 outline-none",children:e.jsx(b.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 lg:grid-cols-[1fr_300px] xl:grid-cols-[1fr_320px] gap-6 sm:gap-8 lg:gap-10",children:[e.jsxs("div",{className:"space-y-3 lg:space-y-4",children:[e.jsxs("div",{className:"relative select-none isolate bg-indigo-600 rounded-[2rem] shadow-[0_20px_45px_-15px_rgba(0,0,0,0.3)] shrink-0",children:[e.jsx("div",{className:"absolute inset-0 bg-black/60 pointer-events-none z-0 rounded-[2rem]"}),e.jsx("div",{className:"absolute inset-0 opacity-10 pointer-events-none rounded-[2rem] overflow-hidden",style:{backgroundImage:"repeating-linear-gradient(0deg, transparent, transparent 39px, #ffffff 39px, #ffffff 40px), repeating-linear-gradient(90deg, transparent, transparent 39px, #ffffff 39px, #ffffff 40px)"}}),e.jsx("div",{className:"absolute top-0 right-0 w-[400px] h-[400px] bg-sky-500/20 blur-[100px] rounded-full pointer-events-none"}),e.jsxs("div",{className:"relative z-10 flex flex-col md:flex-row items-center justify-between p-6 lg:p-8 h-full min-h-[140px] lg:min-h-[160px]",children:[e.jsx("div",{className:"flex-1 space-y-3 w-full pr-0 md:pr-[240px] lg:pr-[280px]",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"flex items-center gap-3 text-3xl sm:text-4xl lg:text-[46px] font-black tracking-tight text-white mb-2 sm:mb-4",children:[e.jsx(Ue,{className:"h-8 w-8 sm:h-10 sm:w-10 lg:h-12 lg:w-12 text-[#d1abff]",strokeWidth:2.5}),"Quiz Battle"]}),e.jsx("p",{className:"text-base sm:text-lg lg:text-xl text-white mt-1.5 sm:mt-2 max-w-2xl leading-relaxed",children:"Timed student duels with synchronized rounds, instant feedback, and progression rewards."}),e.jsxs("p",{className:"text-xs lg:text-sm font-semibold uppercase tracking-[0.15em] text-[#8a7fbc] mt-3",children:["Connection: ",e.jsx("span",{className:rt==="connected"?"text-emerald-400":"text-amber-400",children:rt})]})]})}),e.jsx("div",{className:"hidden md:block absolute right-[-5px] lg:right-[-15px] top-0 lg:top-[5px] w-[200px] lg:w-[260px] shrink-0 pointer-events-none z-20",children:e.jsx(b.img,{src:da,alt:"Mascot",className:"w-full h-full object-contain",animate:{y:[0,-24,0],rotate:[-3,3,-3]},transition:{duration:4,repeat:1/0,ease:"easeInOut"}})})]})]}),e.jsxs("div",{className:"pt-4 lg:pt-6",children:[e.jsxs("h2",{className:"flex items-center gap-2 pb-4 text-xl lg:text-2xl font-black tracking-wide uppercase text-white drop-shadow-[0_0_12px_rgba(255,255,255,0.4)]",children:[e.jsx(Ue,{className:"h-6 w-6 lg:h-8 lg:w-8 text-amber-400 drop-shadow-[0_0_8px_rgba(251,191,36,0.9)]"})," BATTLE MODES"]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 lg:gap-6 relative z-10 w-full mb-2",children:[e.jsxs(b.button,{type:"button",onClick:()=>mt("online"),whileHover:{scale:1.025},whileTap:{scale:.98},transition:{type:"spring",stiffness:400,damping:15},className:"w-full h-[205px] sm:h-[245px] lg:h-[265px] bg-[#8A3FD3] rounded-[22px] border-none relative text-left shadow-[0_8px_30px_rgba(138,63,211,0.2)] hover:shadow-[0_12px_45px_rgba(138,63,211,0.4)] block flex-col group",children:[e.jsx("div",{className:"absolute inset-0 rounded-[22px] shadow-[inset_0_6px_15px_rgba(255,255,255,0.4)] pointer-events-none z-40"}),e.jsxs("div",{className:"absolute top-4 -left-4 z-20 w-[100px] h-[40px] opacity-100",children:[e.jsx("svg",{viewBox:"0 0 100 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"w-full h-full block drop-shadow-md",children:e.jsx("path",{d:"M0 0 H94 Q100 0 100 6 V34 Q100 40 94 40 H0 L14 20 Z",fill:"#b91c1c"})}),e.jsx("div",{className:"absolute inset-0 flex items-center justify-end pr-3 font-black text-[13px] text-white tracking-[0.3px] opacity-100",style:{fontFamily:"'Nunito', sans-serif"},children:"VS Player"})]}),e.jsxs("div",{className:"rounded-[22px] overflow-hidden relative isolate h-full flex flex-col justify-end",children:[e.jsx("div",{className:"absolute top-0 -left-[150%] w-[100%] h-full bg-gradient-to-r from-transparent via-white/40 to-transparent -skew-x-12 z-50 pointer-events-none transition-all duration-0 group-hover:duration-[800ms] ease-in-out group-hover:left-[150%]"}),e.jsxs("div",{className:"flex-1 w-full flex items-end justify-center relative pt-2 pointer-events-none",children:[e.jsx("div",{className:"absolute bottom-0 left-0 w-full h-[70px] sm:h-[95px] bg-[#662AA8] rounded-[50%_50%_0_0/100%_100%_0_0] scale-[1.05] z-0"}),e.jsxs("div",{className:"relative z-10 flex items-center justify-center mb-[2px] h-[120px] sm:h-[140px] w-full",children:[e.jsx(b.img,{src:"/avatar/avatar_icon.png",alt:"",className:"h-[120%] sm:h-[125%] object-contain relative z-20 origin-bottom right-[-15px] drop-shadow-[0_12px_15px_rgba(0,0,0,0.3)]",animate:{y:[0,-5,0]},transition:{duration:4,repeat:1/0,ease:"easeInOut"}}),e.jsx(b.div,{className:"relative z-30 flex flex-col items-center mx-[-20px] scale-[1.1]",animate:{scale:[1.1,1.15,1.1]},transition:{duration:2,repeat:1/0,ease:"easeInOut"},children:e.jsxs("span",{className:"font-black italic text-[40px] text-gray-200 tracking-tighter leading-none drop-shadow-[-2px_3px_0px_rgba(0,0,0,0.8)]",style:{WebkitTextStroke:"1.5px #666"},children:[e.jsx("span",{className:"text-gray-300",children:"V"}),e.jsx("span",{className:"text-gray-400",children:"S"})]})}),e.jsx(b.img,{src:"/avatar/avatar_icon.png",alt:"",className:"h-[120%] sm:h-[125%] object-contain relative z-10 scale-x-[-1] origin-bottom left-[-20px] drop-shadow-[0_12px_15px_rgba(0,0,0,0.3)]",animate:{y:[0,-4,0]},transition:{duration:4,repeat:1/0,ease:"easeInOut",delay:.4}})]})]}),e.jsx("div",{className:"relative z-10 w-full px-5 py-3 sm:py-4 text-center bg-[#662AA8]",children:e.jsx("p",{className:"text-[13px] font-bold text-white leading-[1.45]",style:{fontFamily:"'Nunito', sans-serif"},children:"Queue or room-code match with another student."})})]})]}),e.jsxs(b.button,{type:"button",onClick:()=>mt("bot"),whileHover:{scale:1.025},whileTap:{scale:.98},transition:{type:"spring",stiffness:400,damping:15},className:"w-full h-[205px] sm:h-[245px] lg:h-[265px] bg-[#1FA7E1] rounded-[22px] border-none relative text-left shadow-[0_8px_30px_rgba(31,167,225,0.2)] hover:shadow-[0_12px_45px_rgba(31,167,225,0.4)] block flex-col group",children:[e.jsx("div",{className:"absolute inset-0 rounded-[22px] shadow-[inset_0_6px_15px_rgba(255,255,255,0.4)] pointer-events-none z-40"}),e.jsxs("div",{className:"absolute top-4 -left-4 z-20 w-[100px] h-[40px] opacity-100",children:[e.jsx("svg",{viewBox:"0 0 100 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"w-full h-full block drop-shadow-md",children:e.jsx("path",{d:"M0 0 H94 Q100 0 100 6 V34 Q100 40 94 40 H0 L14 20 Z",fill:"#b91c1c"})}),e.jsx("div",{className:"absolute inset-0 flex items-center justify-end pr-3 font-black text-[13px] text-white tracking-[0.3px] opacity-100",style:{fontFamily:"'Nunito', sans-serif"},children:"VS Bot"})]}),e.jsxs("div",{className:"rounded-[22px] overflow-hidden relative isolate h-full flex flex-col justify-end",children:[e.jsx("div",{className:"absolute top-0 -left-[150%] w-[100%] h-full bg-gradient-to-r from-transparent via-white/40 to-transparent -skew-x-12 z-50 pointer-events-none transition-all duration-0 group-hover:duration-[800ms] ease-in-out group-hover:left-[150%]"}),e.jsxs("div",{className:"flex-1 w-full flex items-end justify-center relative pt-2 pointer-events-none",children:[e.jsx("div",{className:"absolute bottom-0 left-0 w-full h-[70px] sm:h-[95px] bg-[#127DA6] rounded-[50%_50%_0_0/100%_100%_0_0] scale-[1.05] z-0"}),e.jsxs("div",{className:"relative z-10 flex items-end justify-center mb-[2px] h-[125px] sm:h-[145px] w-full",children:[e.jsx(b.img,{src:"/avatar/avatar_icon.png",alt:"",className:"absolute opacity-40 blur-[1px] h-full object-contain origin-bottom -translate-x-[45px] sm:-translate-x-[60px] scale-[0.80] sm:scale-[0.85]",animate:{y:[0,-3,0]},transition:{duration:3.5,repeat:1/0,ease:"easeInOut",delay:.3}}),e.jsx(b.img,{src:"/avatar/avatar_icon.png",alt:"",className:"absolute opacity-40 blur-[1px] h-full object-contain origin-bottom translate-x-[45px] sm:translate-x-[60px] scale-[0.80] sm:scale-[0.85]",animate:{y:[0,-3,0]},transition:{duration:3.5,repeat:1/0,ease:"easeInOut",delay:.6}}),e.jsx(b.img,{src:"/avatar/avatar_icon.png",alt:"VS Bot",className:"relative opacity-100 scale-100 h-[105%] sm:h-[115%] object-contain drop-shadow-[0_15px_15px_rgba(0,0,0,0.3)] z-20 origin-bottom",animate:{y:[0,-5,0]},transition:{duration:3.5,repeat:1/0,ease:"easeInOut"}})]})]}),e.jsx("div",{className:"relative z-10 w-full px-5 py-3 sm:py-4 text-center bg-[#127DA6]",children:e.jsx("p",{className:"text-[13px] font-bold text-white leading-[1.45]",style:{fontFamily:"'Nunito', sans-serif"},children:"Instant solo duel with selectable bot difficulty."})})]})]})]})]})]}),e.jsxs("div",{className:"space-y-3 lg:space-y-4 flex flex-col h-full justify-between",children:[e.jsx("div",{onClick:()=>l("leaderboard"),className:"relative w-full h-[155px] sm:h-[165px] cursor-pointer group flex items-end justify-center overflow-visible mt-1 mb-2 scale-[0.75] origin-bottom sm:scale-[0.80] lg:scale-[0.85] lg:origin-center",children:e.jsxs(b.div,{className:"relative w-full h-full flex flex-col items-center justify-end",whileHover:{scale:1.03},whileTap:{scale:.98},children:[e.jsxs("div",{className:"absolute top-[1px] sm:-top-[30px] w-full flex justify-center items-end px-2 z-0",children:[e.jsx(Ve,{strokeWidth:0,fill:"currentColor",className:"w-[35px] h-[35px] text-[#fde047] -rotate-[15deg] -mr-3 mb-1 z-0 drop-shadow-[0_0_15px_rgba(253,224,71,0.6)]"}),e.jsx(b.div,{animate:{y:[-4,4,-4]},transition:{duration:3,repeat:1/0,ease:"easeInOut"},className:"z-10 relative",children:e.jsx(Ve,{strokeWidth:0,fill:"currentColor",className:"w-[60px] h-[60px] text-[#fcd34d] drop-shadow-[0_0_25px_rgba(252,211,77,0.9)]"})}),e.jsx(Ve,{strokeWidth:0,fill:"currentColor",className:"w-[35px] h-[35px] text-[#fde047] rotate-[15deg] -ml-3 mb-1 z-0 drop-shadow-[0_0_15px_rgba(253,224,71,0.6)]"})]}),e.jsx("div",{className:`absolute inset-x-0 bottom-[40px] top-0 z-10 flex flex-col items-center justify-end - filter drop-shadow-[0px_3px_0px_white] drop-shadow-[0px_-3px_0px_white] drop-shadow-[3px_0px_0px_white] drop-shadow-[-3px_0px_0px_white] drop-shadow-[2px_2px_0px_white] drop-shadow-[-2px_-2px_0px_white] drop-shadow-[2px_-2px_0px_white] drop-shadow-[-2px_2px_0px_white]`,children:e.jsxs("div",{className:"flex items-end justify-center z-20 relative px-4",children:[e.jsxs("div",{className:"flex flex-col items-center w-[65px] relative",children:[e.jsx("div",{className:"w-full h-[14px] bg-[#d24b4b] rounded-[2px] relative z-10 -mb-[1px]"}),e.jsxs("div",{className:"w-[85%] h-[50px] bg-[#fe5c5c] rounded-b-[2px] flex flex-col justify-center items-center gap-1.5 pb-1.5",children:[e.jsx("div",{className:"w-6 h-1.5 bg-white rounded-full opacity-95"}),e.jsx("div",{className:"w-6 h-1.5 bg-white rounded-full opacity-95"})]})]}),e.jsxs("div",{className:"flex flex-col items-center w-[75px] -mx-[4px] z-20 relative",children:[e.jsx("div",{className:"w-full h-[18px] bg-[#f2812d] rounded-[2px] relative z-10 -mb-[1px]"}),e.jsxs("div",{className:"w-[85%] h-[75px] bg-[#fa9746] rounded-b-[2px] flex flex-col justify-start items-center pt-4 gap-1.5",children:[e.jsx("div",{className:"w-9 h-1.5 bg-white rounded-full opacity-95"}),e.jsx("div",{className:"w-9 h-1.5 bg-white rounded-full opacity-95"})]})]}),e.jsxs("div",{className:"flex flex-col items-center w-[65px] relative",children:[e.jsx("div",{className:"w-full h-[14px] bg-[#d24b4b] rounded-[2px] relative z-10 -mb-[1px]"}),e.jsxs("div",{className:"w-[85%] h-[50px] bg-[#fe5c5c] rounded-b-[2px] flex flex-col justify-center items-center gap-1.5 pb-1.5",children:[e.jsx("div",{className:"w-6 h-1.5 bg-white rounded-full opacity-95"}),e.jsx("div",{className:"w-6 h-1.5 bg-white rounded-full opacity-95"})]})]})]})}),e.jsx("div",{className:"absolute bottom-2 w-[110%] max-w-[280px] z-30 drop-shadow-2xl",children:e.jsxs("div",{className:"relative w-full h-[52px] flex justify-center items-center",children:[e.jsx("div",{className:"absolute -left-1 top-2 w-[55px] h-[40px] bg-[#8b0d0d] z-0",style:{clipPath:"polygon(100% 0, 100% 100%, 0 100%, 25% 50%, 0 0)"}}),e.jsx("div",{className:"absolute -right-1 top-2 w-[55px] h-[40px] bg-[#8b0d0d] z-0",style:{clipPath:"polygon(0 0, 0 100%, 100% 100%, 75% 50%, 100% 0)"}}),e.jsxs("div",{className:"absolute inset-x-6 top-0 bottom-0 bg-[#b61515] shadow-[inset_0_2px_4px_rgba(255,255,255,0.1),_inset_0_-4px_4px_rgba(0,0,0,0.2)] z-10 flex flex-col items-center justify-center",children:[e.jsx("h3",{className:"text-lg sm:text-xl font-black text-white tracking-widest leading-none drop-shadow-md",style:{fontFamily:"'Nunito', sans-serif"},children:"Hall of Fame"}),e.jsx("span",{className:"text-[9px] sm:text-[10px] font-bold text-white/90 tracking-widest mt-0.5",children:"View Page >"})]})]})})]})}),e.jsxs("div",{className:"relative w-full bg-[#3b3a82] dark:bg-[#2b2b5f] rounded-[24px] overflow-hidden flex flex-col shadow-[0_8px_30px_rgba(59,58,130,0.3)]",children:[e.jsxs("div",{className:"flex flex-row items-end justify-between px-5 pt-4 pb-2 relative z-10",children:[e.jsx("h3",{className:"text-[18px] font-black text-white tracking-wide leading-none drop-shadow-md",style:{fontFamily:"'Nunito', sans-serif"},children:"My Stats"}),e.jsx(A,{variant:"link",className:"text-white/80 hover:text-white p-0 h-auto font-semibold text-[13px] tracking-wide",onClick:()=>l("stats"),children:"View Stats >"})]}),e.jsxs("div",{className:"relative z-10 w-full overflow-hidden pb-4",children:[e.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-6 bg-gradient-to-r from-[#3b3a82] to-transparent z-20 pointer-events-none dark:from-[#2b2b5f]"}),e.jsx("div",{className:"absolute right-0 top-0 bottom-0 w-6 bg-gradient-to-l from-[#3b3a82] to-transparent z-20 pointer-events-none dark:from-[#2b2b5f]"}),e.jsx(b.div,{className:"flex w-max pl-3",animate:{x:["0%","-50%"]},transition:{ease:"linear",duration:15,repeat:1/0},children:[0,1].map(t=>e.jsxs("div",{className:"flex gap-2.5 pr-2.5",children:[e.jsxs("div",{className:"flex-none w-[60px] sm:w-[65px] lg:w-[70px] xl:w-[75px] aspect-square rounded-[12px] bg-[#f0eaff] p-1.5 flex flex-col justify-between relative overflow-hidden group shadow-sm dark:bg-[#d6ccf5]",children:[e.jsx(Ge,{className:"absolute -bottom-1 -right-2 w-6 h-6 sm:w-8 sm:h-8 text-[#a06aec]/10 -rotate-12 transition-transform group-hover:scale-110"}),e.jsx("span",{className:"text-[12px] drop-shadow-sm leading-none",children:"🏆"}),e.jsxs("div",{className:"relative z-10 space-y-[1px]",children:[e.jsxs("h4",{className:"text-[12px] sm:text-[14px] lg:text-[16px] font-black text-[#8f5ae2] leading-none tracking-tight",children:[Math.round(L?.winRate||0)," %"]}),e.jsx("p",{className:"text-[6px] lg:text-[7px] font-extrabold text-[#baa4df] uppercase tracking-wider leading-none",children:"Win Rate"})]})]}),e.jsxs("div",{className:"flex-none w-[60px] sm:w-[65px] lg:w-[70px] xl:w-[75px] aspect-square rounded-[12px] bg-[#e1f5f7] p-1.5 flex flex-col justify-between relative overflow-hidden group shadow-sm dark:bg-[#b0e6eb]",children:[e.jsx(wt,{className:"absolute -bottom-1 -right-2 w-6 h-6 sm:w-8 sm:h-8 text-[#35a8bc]/10 rotate-12 transition-transform group-hover:scale-110"}),e.jsx("span",{className:"text-[12px] drop-shadow-sm leading-none",children:"🎯"}),e.jsxs("div",{className:"relative z-10 space-y-[1px]",children:[e.jsx("h4",{className:"text-[12px] sm:text-[14px] lg:text-[16px] font-black text-[#319ab4] leading-none tracking-tight",children:L?.matchesPlayed||0}),e.jsx("p",{className:"text-[6px] lg:text-[7px] font-extrabold text-[#7eafbe] uppercase tracking-wider leading-none",children:"Matches"})]})]}),e.jsxs("div",{className:"flex-none w-[60px] sm:w-[65px] lg:w-[70px] xl:w-[75px] aspect-square rounded-[12px] bg-[#fef5e7] p-1.5 flex flex-col justify-between relative overflow-hidden group shadow-sm dark:bg-[#f6ebd2]",children:[e.jsx(jt,{className:"absolute -bottom-1 -right-2 w-6 h-6 sm:w-8 sm:h-8 text-[#e87a42]/10 -rotate-12 transition-transform group-hover:scale-110"}),e.jsx("span",{className:"text-[12px] drop-shadow-sm leading-none",children:"⏱️"}),e.jsxs("div",{className:"relative z-10 space-y-[1px]",children:[e.jsxs("h4",{className:"text-[12px] sm:text-[14px] lg:text-[16px] font-black text-[#db734b] leading-none tracking-tight",children:[L?.averageResponseMs?(L.averageResponseMs/1e3).toFixed(1):0,"s"]}),e.jsx("p",{className:"text-[6px] lg:text-[7px] font-extrabold text-[#d2a893] uppercase tracking-wider leading-none whitespace-nowrap",children:"Response"})]})]}),e.jsxs("div",{className:"flex-none w-[60px] sm:w-[65px] lg:w-[70px] xl:w-[75px] aspect-square rounded-[12px] bg-[#fdeceb] p-1.5 flex flex-col justify-between relative overflow-hidden group shadow-sm dark:bg-[#fbd3d3]",children:[e.jsx(vt,{className:"absolute -bottom-1 -right-2 w-6 h-6 sm:w-8 sm:h-8 text-[#df655a]/10 rotate-12 transition-transform group-hover:scale-110"}),e.jsx("span",{className:"text-[12px] drop-shadow-sm leading-none",children:"✨"}),e.jsxs("div",{className:"relative z-10 space-y-[1px]",children:[e.jsx("h4",{className:"text-[12px] sm:text-[14px] lg:text-[16px] font-black text-[#d05c54] leading-none tracking-tight",children:r?.currentXP||0}),e.jsx("p",{className:"text-[6px] lg:text-[7px] font-extrabold text-[#dd9a9a] uppercase tracking-wider leading-none whitespace-nowrap",children:"Total XP"})]})]})]},t))})]})]}),e.jsxs(W,{className:u(F,"rounded-[18px] flex flex-col min-h-[200px]"),children:[e.jsxs(Y,{className:"pb-0 pt-3 px-4 flex flex-row items-center justify-between",children:[e.jsxs(X,{className:"text-[14px] font-black flex items-center gap-2 text-[#2e2b5e] dark:text-[#f5f7fb]",children:[e.jsx(kt,{className:"h-[16px] w-[16px] text-[#2e2b5e] dark:text-[#9e8fff]"})," Match History"]}),e.jsx(A,{variant:"link",size:"sm",className:"h-auto p-0 text-[12px] font-semibold text-muted-foreground dark:text-[#95a0bb] hover:text-primary transition-colors",onClick:()=>l("history"),children:"View All"})]}),e.jsxs(be,{className:"space-y-1.5 px-4 pt-1 pb-3 overflow-y-auto",children:[e.jsx("div",{className:"text-[11px] text-muted-foreground dark:text-[#8b95ad] mb-1.5 leading-relaxed",children:"Your recent student battles only."}),ot?e.jsxs("div",{className:"space-y-2",children:[e.jsx(te,{className:"h-10 w-full rounded-xl bg-muted dark:bg-[#2a3143]"}),e.jsx(te,{className:"h-10 w-full rounded-xl bg-muted dark:bg-[#2a3143]"})]}):Ie.length===0?e.jsx("p",{className:"text-xs text-center text-muted-foreground dark:text-[#a8b2c9] py-2",children:"No battle history yet."}):Ie.slice(0,3).map(t=>{const i=t.outcome==="win",x=t.outcome==="loss",h=t.opponentName.split(" ").map(g=>g[0]).join("").substring(0,2).toUpperCase()||"OP";return e.jsxs("div",{className:"group relative overflow-hidden rounded-[14px] border border-muted-foreground/15 bg-white dark:bg-[#11151d] dark:border-[#2f3547] p-2 shadow-sm transition-all hover:scale-[1.01] hover:shadow-md",children:[e.jsx("div",{className:u("absolute inset-y-0 right-0 w-[55%] pointer-events-none opacity-[0.2] dark:opacity-[0.25] mix-blend-multiply dark:mix-blend-screen transition-all",i?"bg-gradient-to-l from-emerald-500 via-emerald-500/40 to-transparent":x?"bg-gradient-to-l from-rose-500 via-rose-500/40 to-transparent":"bg-gradient-to-l from-amber-400 via-amber-400/40 to-transparent")}),e.jsxs("div",{className:"flex items-center gap-2.5 relative z-10 w-full",children:[e.jsx("div",{className:u("w-9 h-9 rounded-full flex items-center justify-center font-black text-[12px] tracking-wide text-white flex-shrink-0 shadow-inner",i?"bg-[#34d399] dark:bg-[#15803d]":x?"bg-[#fb7185] dark:bg-[#be123c]":"bg-[#fbbf24] dark:bg-[#b45309]"),children:h}),e.jsxs("div",{className:"flex-grow min-w-0 flex flex-col justify-center",children:[e.jsxs("p",{className:"text-[13px] font-extrabold text-[#36326e] dark:text-[#e4e7f1] truncate leading-tight",children:["vs ",t.opponentName]}),e.jsxs("p",{className:"text-[10px] font-bold text-muted-foreground/60 dark:text-[#7f88a3] truncate flex items-center gap-1 mt-0.5",children:[t.subjectId," ",e.jsx("span",{className:"w-1 h-1 rounded-full bg-muted-foreground/30"})," ",t.difficulty||"Medium"," ",e.jsx("span",{className:"w-1 h-1 rounded-full bg-muted-foreground/30"})," ",t.rounds||"5"," rnds"]})]}),e.jsxs("div",{className:"text-right flex flex-col items-end justify-center pl-2 flex-shrink-0",children:[e.jsxs("p",{className:"tabular-nums text-[16px] leading-[1.1] font-black text-[#2e2b5e] dark:text-[#f5f7fb] tracking-tighter",children:[t.scoreFor,e.jsx("span",{className:"text-muted-foreground/40 mx-[1px]",children:"-"}),t.scoreAgainst]}),e.jsx("p",{className:u("text-[9px] font-black uppercase tracking-[0.1em]",i?"text-emerald-500 dark:text-emerald-400":x?"text-rose-500 dark:text-rose-400":"text-amber-500 dark:text-amber-400"),children:t.outcome})]})]})]},t.matchId)})]})]})]})]})},"hub")}),e.jsx(ue,{value:"setup",className:"mt-0 outline-none",children:e.jsxs(b.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},exit:{opacity:0,y:-12},className:"w-full space-y-6",children:[e.jsxs(b.div,{className:u(F,"relative overflow-hidden rounded-[24px] mb-6 shadow-lg",n.mode==="online"?"border-purple-500/20 shadow-[0_0_40px_-10px_rgba(138,63,211,0.2)]":"border-sky-500/20 shadow-[0_0_40px_-10px_rgba(31,167,225,0.2)]"),whileHover:{scale:1.01},transition:{type:"spring",stiffness:300,damping:20},children:[e.jsx("div",{className:u("pointer-events-none absolute inset-0 bg-gradient-to-r",n.mode==="online"?"from-purple-500/20 via-fuchsia-500/10 to-purple-600/5 dark:from-purple-500/20 dark:via-fuchsia-500/10 dark:to-purple-900/10":"from-sky-500/20 via-cyan-500/10 to-sky-600/5 dark:from-sky-500/20 dark:via-cyan-500/10 dark:to-sky-900/10")}),e.jsx(b.div,{className:u("pointer-events-none absolute -top-24 -right-24 h-64 w-64 rounded-full blur-3xl",n.mode==="online"?"bg-purple-400/20":"bg-sky-400/20"),animate:{scale:[1,1.2,1],opacity:[.3,.6,.3]},transition:{duration:5,repeat:1/0,ease:"easeInOut"}}),e.jsx(b.div,{className:u("pointer-events-none absolute -bottom-12 -left-12 h-40 w-40 rounded-full blur-2xl",n.mode==="online"?"bg-fuchsia-400/30":"bg-cyan-400/30"),animate:{scale:[1,1.3,1],opacity:[.2,.5,.2]},transition:{duration:4,repeat:1/0,ease:"easeInOut",delay:1.5}}),e.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0IiBoZWlnaHQ9IjQiPgo8cmVjdCB3aWR0aD0iNCIgaGVpZ2h0PSI0IiBmaWxsPSIjZmZmIiBmaWxsLW9wYWNpdHk9IjAiLz4KPHBhdGggZD0iTTAgMEgxdjFIMHoiIGZpbGw9IiM2MzY2ZjEiIGZpbGwtb3BhY2l0eT0iMC4wNSIvPgo8L3N2Zz4=')] opacity-30 dark:opacity-10 mix-blend-overlay"}),e.jsxs("div",{className:"relative p-6 sm:p-8 md:px-10 flex items-center gap-5 sm:gap-8 z-10",children:[e.jsx(A,{variant:"ghost",onClick:()=>l("hub"),className:u("h-12 w-12 sm:h-14 sm:w-14 p-0 rounded-full hover:scale-105 transition-all backdrop-blur-md shadow-lg shrink-0 flex items-center justify-center group",n.mode==="online"?"bg-white/50 dark:bg-black/40 hover:bg-white/80 dark:hover:bg-black/60 border border-purple-500/30":"bg-white/50 dark:bg-black/40 hover:bg-white/80 dark:hover:bg-black/60 border border-sky-500/30"),children:e.jsx(ze,{className:u("h-6 w-6 sm:h-8 sm:w-8 rotate-180 transition-transform group-hover:-translate-x-0.5",n.mode==="online"?"text-purple-800 dark:text-purple-300":"text-sky-800 dark:text-sky-300")})}),e.jsxs("div",{children:[e.jsxs("h2",{className:u("flex items-center gap-3 text-3xl sm:text-4xl font-black tracking-tight text-transparent bg-clip-text bg-gradient-to-br drop-shadow-sm",n.mode==="online"?"from-purple-600 to-fuchsia-500 dark:from-purple-300 dark:to-fuchsia-200":"from-sky-600 to-cyan-500 dark:from-sky-300 dark:to-cyan-200"),children:[e.jsx(b.div,{animate:{y:[-3,3,-3]},transition:{duration:3,repeat:1/0,ease:"easeInOut"},className:u("p-2 rounded-2xl shadow-inner border",n.mode==="online"?"bg-purple-100 dark:bg-purple-900/50 border-purple-200 dark:border-purple-700/50":"bg-sky-100 dark:bg-sky-900/50 border-sky-200 dark:border-sky-700/50"),children:n.mode==="online"?e.jsx(Be,{className:"h-8 w-8 text-purple-600 dark:text-purple-400 drop-shadow-[0_0_8px_rgba(138,63,211,0.5)]"}):e.jsx(ht,{className:"h-8 w-8 text-sky-600 dark:text-sky-400 drop-shadow-[0_0_8px_rgba(31,167,225,0.5)]"})}),n.mode==="online"?"1v1 Online":"1v1 vs Bot"]}),e.jsx("p",{className:u("text-[10px] sm:text-[12px] font-black uppercase tracking-[0.2em] mt-1.5 drop-shadow-sm",n.mode==="online"?"text-purple-600/80 dark:text-purple-400/80":"text-sky-600/80 dark:text-sky-400/80"),children:n.mode==="online"?"CHALLENGE YOUR SCHOOLMATES AND PROVE YOUR SKILLS.":"CHALLENGE THE AI AND SHARPEN YOUR SKILLS."})]})]})]}),e.jsx("div",{className:"rounded-[24px] border border-white/40 bg-white/85 dark:border-white/10 dark:bg-black/80 backdrop-blur-xl p-5 sm:p-7 shadow-xl",children:e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6 lg:gap-10",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-1.5 group",children:[e.jsx("label",{className:u("text-[11px] font-black uppercase tracking-[0.12em] ml-1",n.mode==="online"?"text-[#8A3FD3] dark:text-[#a35ceb]":"text-[#1FA7E1] dark:text-[#4bc1f2]"),children:"Category"}),e.jsxs(me,{value:n.subjectId,onValueChange:t=>f(i=>({...i,subjectId:t})),children:[e.jsx(xe,{className:u("rounded-xl h-11 border-white/20 bg-white/60 dark:bg-black/50 dark:border-white/10 transition-colors shadow-inner",n.mode==="online"?"hover:border-[#8A3FD3]/50":"hover:border-[#1FA7E1]/50",T("subjectId")&&"border-rose-400"),children:e.jsx(pe,{placeholder:"Select category"})}),e.jsx(he,{className:"rounded-xl backdrop-blur-xl bg-white/90 dark:bg-[#1a1f2e]/90",children:Z.map(t=>e.jsx(Q,{value:t.id,className:"rounded-lg",children:t.title},t.id))})]}),T("subjectId")&&e.jsx("p",{className:"text-xs text-destructive dark:text-rose-300 ml-1",children:T("subjectId")})]}),e.jsxs("div",{className:"space-y-1.5 group",children:[e.jsx("label",{className:u("text-[11px] font-black uppercase tracking-[0.12em] ml-1",n.mode==="online"?"text-[#8A3FD3] dark:text-[#a35ceb]":"text-[#1FA7E1] dark:text-[#4bc1f2]"),children:"Strand / Topic Group"}),e.jsxs(me,{value:n.topicId,onValueChange:t=>f(i=>({...i,topicId:t})),children:[e.jsx(xe,{className:u("rounded-xl h-11 border-white/20 bg-white/60 dark:bg-black/50 dark:border-white/10 transition-colors shadow-inner",n.mode==="online"?"hover:border-[#8A3FD3]/50":"hover:border-[#1FA7E1]/50",T("topicId")&&"border-rose-400"),children:e.jsx(pe,{placeholder:"Select topic group"})}),e.jsx(he,{className:"rounded-xl backdrop-blur-xl bg-white/90 dark:bg-[#1a1f2e]/90",children:Ot.map(t=>e.jsx(Q,{value:t.value,className:"rounded-lg",children:t.label},t.value))})]}),T("topicId")&&e.jsx("p",{className:"text-xs text-destructive dark:text-rose-300 ml-1",children:T("topicId")})]}),e.jsxs("div",{className:"space-y-1.5 group",children:[e.jsx("label",{className:u("text-[11px] font-black uppercase tracking-[0.12em] ml-1",n.mode==="online"?"text-[#8A3FD3] dark:text-[#a35ceb]":"text-[#1FA7E1] dark:text-[#4bc1f2]"),children:n.mode==="online"?"Difficulty":"Bot Difficulty"}),e.jsxs(me,{value:n.mode==="bot"?n.adaptiveBot?"adaptive":n.botDifficulty:n.difficulty,onValueChange:t=>f(i=>i.mode==="bot"?{...i,botDifficulty:t,adaptiveBot:t==="adaptive"}:{...i,difficulty:t}),children:[e.jsx(xe,{className:u("rounded-xl h-11 border-white/20 bg-white/60 dark:bg-black/50 dark:border-white/10 transition-colors shadow-inner",n.mode==="online"?"hover:border-[#8A3FD3]/50":"hover:border-[#1FA7E1]/50"),children:e.jsx(pe,{})}),e.jsxs(he,{className:"rounded-xl backdrop-blur-xl bg-white/90 dark:bg-[#1a1f2e]/90",children:[e.jsx(Q,{value:"easy",className:"rounded-lg",children:"Easy"}),e.jsx(Q,{value:"medium",className:"rounded-lg",children:"Medium"}),e.jsx(Q,{value:"hard",className:"rounded-lg",children:"Hard"}),n.mode==="bot"&&e.jsx(Q,{value:"adaptive",className:"rounded-lg",children:"Adaptive"})]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-1.5 group",children:[e.jsx("label",{className:u("text-[10px] sm:text-[11px] font-black uppercase tracking-[0.12em] ml-1",n.mode==="online"?"text-[#8A3FD3] dark:text-[#a35ceb]":"text-[#1FA7E1] dark:text-[#4bc1f2]"),children:"Questions"}),e.jsxs(me,{value:String(n.rounds),onValueChange:t=>f(i=>({...i,rounds:Number(t)})),children:[e.jsx(xe,{className:u("rounded-xl h-11 border-white/20 bg-white/60 dark:bg-black/50 dark:border-white/10 transition-colors shadow-inner",n.mode==="online"?"hover:border-[#8A3FD3]/50":"hover:border-[#1FA7E1]/50",T("rounds")&&"border-rose-400"),children:e.jsx(pe,{})}),e.jsx(he,{className:"rounded-xl backdrop-blur-xl bg-white/90 dark:bg-[#1a1f2e]/90",children:[3,5,7,10,12,15].map(t=>e.jsx(Q,{value:String(t),className:"rounded-lg",children:t},t))})]}),T("rounds")&&e.jsx("p",{className:"text-xs text-destructive dark:text-rose-300 ml-1",children:T("rounds")})]}),e.jsxs("div",{className:"space-y-1.5 group",children:[e.jsx("label",{className:u("text-[10px] sm:text-[11px] font-black uppercase tracking-[0.12em] ml-1 line-clamp-1",n.mode==="online"?"text-[#8A3FD3] dark:text-[#a35ceb]":"text-[#1FA7E1] dark:text-[#4bc1f2]"),children:"Time / Q"}),e.jsxs(me,{value:String(n.timePerQuestionSec),onValueChange:t=>f(i=>({...i,timePerQuestionSec:Number(t)})),children:[e.jsx(xe,{className:u("rounded-xl h-11 border-white/20 bg-white/60 dark:bg-black/50 dark:border-white/10 transition-colors shadow-inner",n.mode==="online"?"hover:border-[#8A3FD3]/50":"hover:border-[#1FA7E1]/50",T("timePerQuestionSec")&&"border-rose-400"),children:e.jsx(pe,{})}),e.jsx(he,{className:"rounded-xl backdrop-blur-xl bg-white/90 dark:bg-[#1a1f2e]/90",children:[15,20,30,45,60,90].map(t=>e.jsxs(Q,{value:String(t),className:"rounded-lg",children:[t," sec"]},t))})]}),T("timePerQuestionSec")&&e.jsx("p",{className:"text-xs text-destructive dark:text-rose-300 ml-1",children:T("timePerQuestionSec")})]})]})]}),e.jsxs("div",{className:"flex flex-col justify-between space-y-6",children:[e.jsxs("div",{className:"space-y-5",children:[n.mode==="online"&&e.jsxs("div",{className:"space-y-3 rounded-2xl border border-[#8A3FD3]/20 bg-[#8A3FD3]/5 dark:border-[#8A3FD3]/20 p-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-[11px] font-black uppercase tracking-[0.12em] text-[#8A3FD3] dark:text-[#a35ceb] ml-1",children:"Online Match Type"}),e.jsx("div",{className:"grid grid-cols-2 gap-3",children:[{value:"public_matchmaking",label:"Public Queue"},{value:"private_room",label:"Private Room"}].map(t=>e.jsx(A,{type:"button",variant:n.queueType===t.value?"default":"outline",className:u("rounded-xl h-11 transition-all border-none font-bold text-xs",n.queueType===t.value?"bg-[#8A3FD3] hover:bg-[#7b35c0] text-white shadow-md shadow-[#8A3FD3]/30":"bg-white/50 hover:bg-white/80 dark:bg-black/30 dark:hover:bg-black/50 text-[#8A3FD3] dark:text-[#d3a8ff]"),onClick:()=>f(i=>({...i,queueType:t.value})),children:t.label},t.value))})]}),n.queueType==="private_room"&&e.jsxs(b.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},className:"pt-2 space-y-2",children:[e.jsx("label",{className:"text-[11px] font-black uppercase tracking-[0.12em] text-[#8A3FD3] dark:text-[#a35ceb] ml-1",children:"Room Code (optional)"}),e.jsx(ta,{value:I,onChange:t=>E(t.target.value.toUpperCase().replace(/[^A-Z0-9]/g,"").slice(0,6)),placeholder:"Leave blank to create a room",className:"rounded-xl h-12 text-center text-lg uppercase font-bold tracking-[0.25em] border-[#8A3FD3]/30 bg-white/80 dark:bg-black/50 dark:border-[#8A3FD3]/20 focus-visible:ring-[#8A3FD3]/50 shadow-inner",maxLength:6}),e.jsx("div",{className:"rounded-xl border border-[#8A3FD3]/30 bg-[#8A3FD3]/10 px-3 py-3 text-[12px] font-semibold text-[#6620a2] leading-snug dark:border-[#8A3FD3]/30 dark:bg-[#8A3FD3]/10 dark:text-[#d3a8ff]",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("label",{className:u("flex flex-col sm:flex-row sm:items-center justify-between rounded-[16px] border bg-white/50 p-4 transition-colors cursor-pointer shadow-sm dark:bg-black/50 group",n.mode==="online"?"border-[#8A3FD3]/20 hover:bg-[#8A3FD3]/5 dark:border-[#8A3FD3]/20 dark:hover:bg-[#8A3FD3]/10":"border-[#1FA7E1]/20 hover:bg-[#1FA7E1]/5 dark:border-[#1FA7E1]/20 dark:hover:bg-[#1FA7E1]/10"),children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:u("h-11 w-11 rounded-full flex items-center justify-center group-hover:scale-110 transition-transform",n.mode==="online"?"bg-[#8A3FD3]/10 text-[#8A3FD3] dark:text-[#c48bfc]":"bg-[#1FA7E1]/10 text-[#1FA7E1] dark:text-[#7ad8ff]"),children:ne?e.jsx(na,{className:"h-5 w-5"}):e.jsx(la,{className:"h-5 w-5 opacity-60"})}),e.jsxs("div",{className:"mb-3 sm:mb-0",children:[e.jsx("p",{className:"text-sm font-bold text-slate-800 dark:text-slate-200",children:"Battle Sounds"}),e.jsx("p",{className:"text-xs font-medium text-slate-500 dark:text-slate-400",children:"Cues for countdowns and results."})]})]}),e.jsx(ft,{checked:ne,onCheckedChange:Dt})]})]}),e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsxs("div",{"aria-live":"polite",className:"min-h-[24px] text-sm font-medium",children:[j.status==="queued"&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:u("inline-flex items-center gap-1 text-[13px] font-bold px-3 py-1.5 rounded-lg",n.mode==="online"?"text-[#8A3FD3] bg-[#8A3FD3]/10":"text-[#1FA7E1] bg-[#1FA7E1]/10"),children:j.message}),n.mode==="online"&&n.queueType==="private_room"&&m?.roomCode&&e.jsxs(A,{type:"button",variant:"outline",className:u("h-8 rounded-full border-emerald-500/50 bg-emerald-50 px-4 text-xs font-black uppercase tracking-[0.16em] text-emerald-900 shadow-sm hover:bg-emerald-100 hover:scale-105 transition-all dark:border-emerald-500/40 dark:bg-emerald-500/10 dark:text-emerald-300 dark:hover:bg-emerald-500/20",re===m.roomCode&&"scale-105 bg-emerald-200 dark:bg-emerald-500/30"),onClick:()=>void ct(m.roomCode),"aria-label":`Copy room code ${m.roomCode}`,children:[re===m.roomCode?e.jsx(yt,{className:"h-4 w-4"}):e.jsx(gt,{className:"h-4 w-4"}),m.roomCode]}),(B||pt)&&Ne>0&&e.jsxs("span",{className:u("inline-flex items-center gap-1.5 rounded-full px-3 py-1 text-xs font-bold animate-pulse",n.mode==="online"?"bg-[#8A3FD3]/10 text-[#8A3FD3]":"bg-[#1FA7E1]/10 text-[#1FA7E1]"),children:["Waiting ",Ta(Ne)]})]}),j.status==="error"&&e.jsx("span",{className:"inline-flex items-center gap-1.5 text-[13px] font-bold text-rose-600 dark:text-rose-400 bg-rose-50 dark:bg-rose-500/10 px-3 py-1.5 rounded-lg border border-rose-200 dark:border-rose-500/20",children:j.message}),j.status==="validating"&&e.jsxs("span",{className:u("inline-flex items-center gap-2 font-bold px-3 py-1.5 rounded-lg",n.mode==="online"?"text-[#8A3FD3] bg-[#8A3FD3]/10":"text-[#1FA7E1] bg-[#1FA7E1]/10"),children:[e.jsx(Ze,{className:"h-4 w-4 animate-spin"})," Validating..."]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[Wt&&e.jsx(A,{type:"button",variant:"outline",onClick:xt,disabled:j.status==="validating",className:"rounded-xl h-14 flex-1 sm:flex-none border-slate-300 hover:bg-slate-100 dark:border-slate-700 dark:hover:bg-slate-800 font-bold px-6",children:m?"Cancel room":"Leave queue"}),e.jsx(A,{type:"button",onClick:Ht,disabled:j.status==="validating"||B||pt,className:u("rounded-xl h-14 flex-1 px-8 font-black uppercase tracking-wide text-sm shadow-xl hover:scale-[1.02] active:scale-95 transition-all text-white border-0",n.mode==="online"?"bg-[#8A3FD3] hover:bg-[#7b35c0] shadow-[#8A3FD3]/40":"bg-[#1FA7E1] hover:bg-[#1a95c9] shadow-[#1FA7E1]/40"),children:j.status==="validating"?e.jsxs("span",{className:"inline-flex items-center gap-2",children:[e.jsx(Ze,{className:"h-5 w-5 animate-spin"})," Starting..."]}):n.mode==="online"&&n.queueType==="private_room"?I.trim()?"Join Room":"Create Room":"Start Battle"})]})]})]})]})})]},"setup")}),e.jsx(ue,{value:"battle",className:"mt-0 outline-none",children:e.jsx(b.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},exit:{opacity:0,y:-12},className:"space-y-4",children:o?e.jsxs(W,{className:u(F,"rounded-[18px]"),children:[e.jsxs(Y,{children:[e.jsxs(X,{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(Be,{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(se,{className:"text-muted-foreground dark:text-[#b2bad0]",children:o.status==="completed"?`Completed in ${o.totalRounds} rounds.`:o.status==="ready"?"Waiting for both players to confirm and start together.":`Round ${o.currentRound} of ${o.totalRounds}`}),St(o.lifecycle,r?.uid)&&e.jsx("p",{className:"text-xs font-medium text-muted-foreground dark:text-[#9aa4be]",children:St(o.lifecycle,r?.uid)})]}),e.jsxs(be,{className:"space-y-4",children:[o.status==="ready"&&e.jsxs("div",{className:"rounded-xl border border-border bg-muted/30 p-4 dark:border-[#2f3547] dark:bg-[#11151d] flex flex-col gap-3",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...":"Preparing match session..."}),e.jsx(A,{variant:"outline",size:"sm",className:"w-full text-rose-500 border-rose-200 hover:bg-rose-50 dark:border-rose-900 dark:hover:bg-rose-900/30",onClick:()=>{S(null),N(null),k(!1),p({status:"idle"}),l("setup")},children:"Force Cancel"})]}),o.status==="in_progress"&&o.currentQuestion&&e.jsxs(e.Fragment,{children:[e.jsx("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:[q,"s"]})]})}),e.jsx("p",{className:"text-lg font-bold text-foreground dark:text-[#f5f7fb]",children:o.currentQuestion.prompt}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:o.currentQuestion.choices.map((t,i)=>e.jsxs(A,{type:"button",variant:we===i?"default":"outline",onClick:()=>O(i),disabled:V||$,className:u("h-auto min-h-[48px] justify-start text-left font-medium px-4 py-3 rounded-xl whitespace-normal",we===i?"ring-2 ring-primary ring-offset-2 dark:ring-offset-[#0B0F19]":""),children:[e.jsxs("span",{className:"mr-2 font-semibold",children:[String.fromCharCode(65+i),"."]}),t]},i))}),e.jsx("div",{className:"flex justify-end",children:e.jsx(A,{type:"button",onClick:()=>void We(we),disabled:V||$,className:"rounded-xl",children:V?e.jsxs("span",{className:"inline-flex items-center gap-2",children:[e.jsx(Ze,{className:"h-4 w-4 animate-spin"})," Submitting..."]}):$?"Waiting for opponent...":"Lock Answer"})})]}),Se&&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: ",Se.studentCorrect?"Correct":"Incorrect"," · ",o.mode==="bot"?"Bot":"Opponent"," ",Se.botCorrect?"Correct":"Incorrect"]}),e.jsxs("p",{className:"text-xs text-muted-foreground dark:text-[#9aa4be]",children:["Correct option: ",String.fromCharCode(65+Se.correctOptionIndex)]})]}),o.status==="completed"&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:u("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(A,{type:"button",variant:"outline",onClick:()=>{N(null),k(!1),l("setup")},className:"rounded-xl",children:"Start New Match"}),o.mode==="bot"&&e.jsx(A,{type:"button",onClick:()=>void $t(),disabled:V,className:"rounded-xl",children:"Rematch"})]})]})]})]}):m?e.jsxs(W,{className:u(F,"rounded-[18px]"),children:[e.jsxs(Y,{children:[e.jsxs(X,{className:"text-base flex items-center gap-2",children:[e.jsx(Be,{className:"h-4 w-4 text-primary dark:text-[#9e8fff]"}),"Private Room Lobby"]}),e.jsxs(se,{className:"text-muted-foreground dark:text-[#b2bad0]",children:["Room ",m.roomCode," · ",m.participantCount,"/2 students connected."]})]}),e.jsx(be,{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(A,{type:"button",variant:"outline",className:"h-8 rounded-lg",onClick:xt,disabled:j.status==="validating",children:"Cancel room"}),e.jsxs(A,{type:"button",variant:"outline",className:"h-8 rounded-lg",onClick:()=>void ct(m.roomCode),children:[re===m.roomCode?e.jsx(yt,{className:"h-4 w-4"}):e.jsx(gt,{className:"h-4 w-4"}),re===m.roomCode?"Copied":"Copy code"]})]})]})})]}):B?e.jsx(W,{className:u(F,"rounded-[18px]"),children:e.jsxs(Y,{children:[e.jsxs(X,{className:"text-base flex items-center gap-2",children:[e.jsx(Be,{className:"h-4 w-4 text-primary dark:text-[#9e8fff]"}),"Public Matchmaking"]}),e.jsx(se,{className:"text-muted-foreground dark:text-[#b2bad0]",children:"Searching for a student with the same setup..."})]})}):e.jsx(W,{className:u(F,"rounded-[18px]"),children:e.jsxs(Y,{children:[e.jsxs(X,{className:"text-base flex items-center gap-2",children:[e.jsx(Ue,{className:"h-4 w-4 text-primary dark:text-[#9e8fff]"}),"No active battle"]}),e.jsx(se,{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(ue,{value:"history",className:"mt-0 outline-none",children:e.jsxs(b.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},exit:{opacity:0,y:-12},className:"space-y-4",children:[e.jsxs(b.div,{className:u(F,"relative overflow-hidden rounded-[24px] mb-6 border-emerald-500/20 shadow-[0_0_40px_-10px_rgba(16,185,129,0.2)]"),whileHover:{scale:1.01},transition:{type:"spring",stiffness:300,damping:20},children:[e.jsx("div",{className:"pointer-events-none absolute inset-0 bg-gradient-to-r from-emerald-500/20 via-teal-500/10 to-emerald-600/5 dark:from-emerald-500/20 dark:via-teal-500/10 dark:to-teal-900/10"}),e.jsx(b.div,{className:"pointer-events-none absolute -top-24 -right-24 h-64 w-64 rounded-full bg-emerald-400/20 blur-3xl",animate:{scale:[1,1.2,1],opacity:[.3,.6,.3]},transition:{duration:4,repeat:1/0,ease:"easeInOut"}}),e.jsx(b.div,{className:"pointer-events-none absolute -bottom-12 -left-12 h-40 w-40 rounded-full bg-teal-400/20 blur-2xl",animate:{scale:[1,1.3,1],opacity:[.2,.5,.2]},transition:{duration:3,repeat:1/0,ease:"easeInOut",delay:1}}),e.jsx("div",{className:"relative z-10 p-6 sm:p-8 flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4",children:e.jsxs("div",{className:"flex items-center gap-5",children:[e.jsx(A,{variant:"ghost",onClick:()=>l("hub"),className:"h-12 w-12 p-0 rounded-full bg-white/50 dark:bg-black/40 hover:bg-white/80 dark:hover:bg-black/60 hover:scale-105 transition-all backdrop-blur-md border border-emerald-500/30 shadow-[0_0_15px_rgba(16,185,129,0.2)] shrink-0",children:e.jsx(ze,{className:"h-6 w-6 rotate-180 text-emerald-800 dark:text-emerald-300"})}),e.jsxs("div",{children:[e.jsxs("h2",{className:"flex items-center gap-3 text-3xl sm:text-4xl font-black tracking-tight text-transparent bg-clip-text bg-gradient-to-br from-emerald-600 to-teal-500 dark:from-emerald-300 dark:to-teal-200 drop-shadow-sm",children:[e.jsx(b.div,{animate:{rotate:[-5,5,-5]},transition:{duration:4,repeat:1/0,ease:"easeInOut"},className:"bg-emerald-100 dark:bg-emerald-900/50 p-2 rounded-2xl shadow-inner border border-emerald-200 dark:border-emerald-700/50",children:e.jsx(kt,{className:"h-8 w-8 text-emerald-600 dark:text-emerald-400 drop-shadow-[0_0_8px_rgba(16,185,129,0.5)]"})}),"Matches History"]}),e.jsx("p",{className:"text-sm font-bold text-emerald-800/80 dark:text-emerald-100/70 mt-2 tracking-wide uppercase",children:"Review your past duels and track your progress."})]})]})})]}),e.jsxs(W,{className:u(F,"rounded-[18px]"),children:[e.jsxs(Y,{children:[e.jsx(X,{className:"text-base",children:"Match History"}),e.jsx(se,{className:"text-muted-foreground dark:text-[#b2bad0]",children:"Your recent student battles only."})]}),e.jsxs(be,{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(A,{type:"button",variant:ie===t.value?"default":"outline",onClick:()=>Tt(t.value),className:"rounded-xl h-8 px-3",children:t.label},t.value))}),ot?e.jsxs("div",{className:"space-y-2",children:[e.jsx(te,{className:"h-12 w-full rounded-xl bg-muted dark:bg-[#2a3143]"}),e.jsx(te,{className:"h-12 w-full rounded-xl bg-muted dark:bg-[#2a3143]"})]}):Ie.length===0?e.jsx("p",{className:"text-sm text-muted-foreground dark:text-[#a8b2c9]",children:"No matches in this filter yet."}):Ie.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:u("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:Fa(t.outcome)})]},t.matchId))]})]})]},"history")}),e.jsx(ue,{value:"stats",className:"mt-0 outline-none",children:e.jsxs(b.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},exit:{opacity:0,y:-12},className:"space-y-4",children:[e.jsxs(b.div,{className:u(F,"relative overflow-hidden rounded-[24px] mb-6 border-indigo-500/20 shadow-[0_0_40px_-10px_rgba(99,102,241,0.2)]"),whileHover:{scale:1.01},transition:{type:"spring",stiffness:300,damping:20},children:[e.jsx("div",{className:"pointer-events-none absolute inset-0 bg-gradient-to-r from-indigo-500/20 via-purple-500/10 to-indigo-600/5 dark:from-indigo-500/20 dark:via-purple-500/10 dark:to-purple-900/10"}),e.jsx(b.div,{className:"pointer-events-none absolute -top-24 -right-24 h-64 w-64 rounded-full bg-indigo-400/20 blur-3xl",animate:{scale:[1,1.2,1],opacity:[.3,.6,.3]},transition:{duration:5,repeat:1/0,ease:"easeInOut"}}),e.jsx(b.div,{className:"pointer-events-none absolute -bottom-12 -left-12 h-40 w-40 rounded-full bg-purple-400/20 blur-2xl",animate:{scale:[1,1.3,1],opacity:[.2,.5,.2]},transition:{duration:4,repeat:1/0,ease:"easeInOut",delay:1.5}}),e.jsx("div",{className:"relative z-10 p-6 sm:p-8 flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4",children:e.jsxs("div",{className:"flex items-center gap-5",children:[e.jsx(A,{variant:"ghost",onClick:()=>l("hub"),className:"h-12 w-12 p-0 rounded-full bg-white/50 dark:bg-black/40 hover:bg-white/80 dark:hover:bg-black/60 hover:scale-105 transition-all backdrop-blur-md border border-indigo-500/30 shadow-[0_0_15px_rgba(99,102,241,0.2)] shrink-0",children:e.jsx(ze,{className:"h-6 w-6 rotate-180 text-indigo-800 dark:text-indigo-300"})}),e.jsxs("div",{children:[e.jsxs("h2",{className:"flex items-center gap-3 text-3xl sm:text-4xl font-black tracking-tight text-transparent bg-clip-text bg-gradient-to-br from-indigo-600 to-purple-500 dark:from-indigo-300 dark:to-purple-200 drop-shadow-sm",children:[e.jsx(b.div,{animate:{y:[-3,3,-3]},transition:{duration:3,repeat:1/0,ease:"easeInOut"},className:"bg-indigo-100 dark:bg-indigo-900/50 p-2 rounded-2xl shadow-inner border border-indigo-200 dark:border-indigo-700/50",children:e.jsx(wt,{className:"h-8 w-8 text-indigo-600 dark:text-indigo-400 drop-shadow-[0_0_8px_rgba(99,102,241,0.5)]"})}),"My Statistics"]}),e.jsx("p",{className:"text-sm font-bold text-indigo-800/80 dark:text-indigo-100/70 mt-2 tracking-wide uppercase",children:"Analyzing your battlefield performance."})]})]})})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-4 gap-4",children:[{label:"Wins",value:L?.wins??0,icon:Ge},{label:"Current streak",value:L?.currentStreak??0,icon:vt},{label:"Avg accuracy",value:`${(L?.averageAccuracy||0).toFixed(1)}%`,icon:aa},{label:"Avg response",value:Ea(L?.averageResponseMs||0),icon:jt}].map(t=>e.jsx(W,{className:u(F,"rounded-[18px]"),children:e.jsxs(be,{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(ue,{value:"leaderboard",className:"mt-0 outline-none",children:e.jsxs(b.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},exit:{opacity:0,y:-12},className:"space-y-4",children:[e.jsxs(b.div,{className:u(F,"relative overflow-hidden rounded-[24px] mb-6 border-amber-500/20 shadow-[0_0_40px_-10px_rgba(245,158,11,0.2)]"),whileHover:{scale:1.01},transition:{type:"spring",stiffness:300,damping:20},children:[e.jsx("div",{className:"pointer-events-none absolute inset-0 bg-gradient-to-r from-amber-500/20 via-orange-500/10 to-amber-600/5 dark:from-amber-600/20 dark:via-orange-500/10 dark:to-orange-900/10"}),e.jsx(b.div,{className:"pointer-events-none absolute -top-24 -right-24 h-64 w-64 rounded-full bg-amber-400/20 blur-3xl",animate:{scale:[1,1.2,1],opacity:[.3,.6,.3]},transition:{duration:4.5,repeat:1/0,ease:"easeInOut"}}),e.jsx(b.div,{className:"pointer-events-none absolute -bottom-12 -left-12 h-40 w-40 rounded-full bg-orange-400/20 blur-2xl",animate:{scale:[1,1.3,1],opacity:[.2,.5,.2]},transition:{duration:3.5,repeat:1/0,ease:"easeInOut",delay:.5}}),e.jsx("div",{className:"relative z-10 p-6 sm:p-8 flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4",children:e.jsxs("div",{className:"flex items-center gap-5",children:[e.jsx(A,{variant:"ghost",onClick:()=>l("hub"),className:"h-12 w-12 p-0 rounded-full bg-white/50 dark:bg-black/40 hover:bg-white/80 dark:hover:bg-black/60 hover:scale-105 transition-all backdrop-blur-md border border-amber-500/30 shadow-[0_0_15px_rgba(245,158,11,0.2)] shrink-0",children:e.jsx(ze,{className:"h-6 w-6 rotate-180 text-amber-800 dark:text-amber-300"})}),e.jsxs("div",{children:[e.jsxs("h2",{className:"flex items-center gap-3 text-3xl sm:text-4xl font-black tracking-tight text-transparent bg-clip-text bg-gradient-to-br from-amber-600 to-orange-500 dark:from-amber-300 dark:to-orange-200 drop-shadow-sm",children:[e.jsx(b.div,{animate:{scale:[1,1.1,1]},transition:{duration:2,repeat:1/0,ease:"easeInOut"},className:"bg-amber-100 dark:bg-amber-900/50 p-2 rounded-2xl shadow-inner border border-amber-200 dark:border-amber-700/50",children:e.jsx(Ge,{className:"h-8 w-8 text-amber-600 dark:text-amber-400 drop-shadow-[0_0_12px_rgba(245,158,11,0.6)]"})}),"Hall of Fame"]}),e.jsx("p",{className:"text-sm font-bold text-amber-800/80 dark:text-amber-100/70 mt-2 tracking-wide uppercase",children:"The top-ranked minds across the globe."})]})]})})]}),e.jsxs(W,{className:u(F,"rounded-[18px]"),children:[e.jsxs(Y,{children:[e.jsxs(X,{className:"text-base flex items-center gap-2",children:[e.jsx(Gt,{className:"h-4 w-4 text-primary dark:text-[#9e8fff]"})," Hall of Fame"]}),e.jsx(se,{className:"text-muted-foreground dark:text-[#b2bad0]",children:"Student-only ranking using trusted backend aggregates."})]}),e.jsx(be,{children:qt?e.jsxs("div",{className:"space-y-2",children:[e.jsx(te,{className:"h-12 w-full rounded-xl bg-muted dark:bg-[#2a3143]"}),e.jsx(te,{className:"h-12 w-full rounded-xl bg-muted dark:bg-[#2a3143]"}),e.jsx(te,{className:"h-12 w-full rounded-xl bg-muted dark:bg-[#2a3143]"})]}):ut.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(me,{value:_e,onValueChange:t=>Pt(t),children:[e.jsx(xe,{className:"mt-1 h-8 rounded-lg",children:e.jsx(pe,{})}),e.jsxs(he,{children:[e.jsx(Q,{value:"alias",children:"Alias"}),e.jsx(Q,{value:"initials",children:"Initials"}),e.jsx(Q,{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(ft,{checked:$e,onCheckedChange:Lt})]})]}),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."}),ut.map(t=>e.jsxs("div",{className:u("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{hs as default}; + */const ia=[["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"}]],la=De("volume-x",ia),da="/assets/quiz_battle_avatar-yi62KvvC.png",Ce=({width:a,x:s,delay:r,duration:d})=>{const l=["#9956DE","#7274ED","#1FA7E1","#6ED1CF","#75D06A","#FFB356","#FF8B8B","#FB96BB"],n=l[Math.floor(Math.random()*l.length)],f=Math.floor(Math.random()*10)+1;return e.jsx(b.div,{style:{"--x":`${s}`,"--width":`${a}`,"--aspect-ratio":`${f}`,"--background":`linear-gradient(${n}cc, transparent)`},className:"absolute left-[var(--x)] top-0 [aspect-ratio:1/var(--aspect-ratio)] [background:var(--background)] [width:var(--width)]",initial:{y:"100cqmax",x:"-50%"},animate:{y:"-100%",x:"-50%"},transition:{duration:d,delay:r,repeat:Number.POSITIVE_INFINITY,ease:"linear"}})},ca=({children:a,perspective:s=100,className:r,beamsPerSide:d=6,beamSize:l=4,beamDelayMax:n=1.5,beamDelayMin:f=0,beamDuration:_=4,gridColor:w="rgba(100, 116, 139, 0.08)",...j})=>{const p=c.useCallback(()=>{const I=[],re=Math.floor(100/l)/d;for(let oe=0;oep(),[p]),k=c.useMemo(()=>p(),[p]),m=c.useMemo(()=>p(),[p]),N=c.useMemo(()=>p(),[p]);return e.jsxs("div",{className:u("relative w-full h-full",r),...j,children:[e.jsxs("div",{style:{"--perspective":`${s}px`,"--grid-color":w,"--beam-size":`${l}%`},className:"pointer-events-none absolute inset-0 overflow-hidden [clip-path:inset(0)] [container-type:size] [perspective:var(--perspective)] [transform-style:preserve-3d] -z-10 bg-[#42389d]",children:[e.jsx("div",{className:"absolute [transform-style:preserve-3d] [background-size:var(--beam-size)_var(--beam-size)] [background:linear-gradient(var(--grid-color)_0_1px,_transparent_1px_var(--beam-size))_50%_-0.5px_/var(--beam-size)_var(--beam-size),linear-gradient(90deg,_var(--grid-color)_0_1px,_transparent_1px_var(--beam-size))_50%_50%_/var(--beam-size)_var(--beam-size)] [container-type:inline-size] [height:100cqmax] [transform-origin:50%_0%] [transform:rotateX(-90deg)] [width:100cqi]",children:B.map((I,E)=>e.jsx(Ce,{width:`${l}%`,x:`${I.x*l}%`,delay:I.delay,duration:_},`top-${E}`))}),e.jsx("div",{className:"absolute top-full [transform-style:preserve-3d] [background-size:var(--beam-size)_var(--beam-size)] [background:linear-gradient(var(--grid-color)_0_1px,_transparent_1px_var(--beam-size))_50%_-0.5px_/var(--beam-size)_var(--beam-size),linear-gradient(90deg,_var(--grid-color)_0_1px,_transparent_1px_var(--beam-size))_50%_50%_/var(--beam-size)_var(--beam-size)] [container-type:inline-size] [height:100cqmax] [transform-origin:50%_0%] [transform:rotateX(-90deg)] [width:100cqi]",children:m.map((I,E)=>e.jsx(Ce,{width:`${l}%`,x:`${I.x*l}%`,delay:I.delay,duration:_},`bottom-${E}`))}),e.jsx("div",{className:"absolute left-0 top-0 [transform-style:preserve-3d] [background-size:var(--beam-size)_var(--beam-size)] [background:linear-gradient(var(--grid-color)_0_1px,_transparent_1px_var(--beam-size))_50%_-0.5px_/var(--beam-size)_var(--beam-size),linear-gradient(90deg,_var(--grid-color)_0_1px,_transparent_1px_var(--beam-size))_50%_50%_/var(--beam-size)_var(--beam-size)] [container-type:inline-size] [height:100cqmax] [transform-origin:0%_0%] [transform:rotate(90deg)_rotateX(-90deg)] [width:100cqh]",children:N.map((I,E)=>e.jsx(Ce,{width:`${l}%`,x:`${I.x*l}%`,delay:I.delay,duration:_},`left-${E}`))}),e.jsx("div",{className:"absolute right-0 top-0 [transform-style:preserve-3d] [background-size:var(--beam-size)_var(--beam-size)] [background:linear-gradient(var(--grid-color)_0_1px,_transparent_1px_var(--beam-size))_50%_-0.5px_/var(--beam-size)_var(--beam-size),linear-gradient(90deg,_var(--grid-color)_0_1px,_transparent_1px_var(--beam-size))_50%_50%_/var(--beam-size)_var(--beam-size)] [container-type:inline-size] [height:100cqmax] [width:100cqh] [transform-origin:100%_0%] [transform:rotate(-90deg)_rotateX(-90deg)]",children:k.map((I,E)=>e.jsx(Ce,{width:`${l}%`,x:`${I.x*l}%`,delay:I.delay,duration:_},`right-${E}`))})]}),e.jsx("div",{className:"relative z-10 w-full h-full",children:a})]})},ua=15e3,ma="mathpulse.quizBattle.local",Nt="".toLowerCase()==="true",qe=typeof window<"u",Ee=()=>qe&&!1,at=()=>{const a=Te.currentUser?.uid;return a||"local-student"},Bt=a=>`${ma}.${a}`,ke=a=>{const s={stats:ge(a),history:[],queueStatus:"idle"};if(!qe)return s;try{const r=window.localStorage.getItem(Bt(a));if(!r)return s;const d=JSON.parse(r),l=Array.isArray(d.history)?d.history.map(f=>tt(f.matchId||"local-match",f)):[];return{stats:d.stats?{...ge(a),...d.stats,userId:a,updatedAt:Fe(d.stats.updatedAt)}:ge(a),history:l,queueStatus:d.queueStatus==="queued"||d.queueStatus==="matched"?d.queueStatus:"idle"}}catch(r){return console.error("Error reading local Quiz Battle fallback store:",r),s}},Ct=(a,s)=>{if(qe)try{window.localStorage.setItem(Bt(a),JSON.stringify(s))}catch(r){console.error("Error writing local Quiz Battle fallback store:",r)}},Mt=a=>{const s=a||{},r=typeof s.code=="string"?s.code:"";return r?r.startsWith("functions/")?r.replace("functions/",""):r:""},U=a=>{if(!Ee())return!1;const s=Mt(a);if(["internal","not-found","unavailable","deadline-exceeded"].includes(s))return!0;const r=a||{},d=(typeof r.message=="string"?r.message:a instanceof Error?a.message:"").toLowerCase();return d?d.includes("cors policy")||d.includes("no access-control-allow-origin")||d.includes("failed to fetch")||d.includes("network error")||d.includes("err_failed"):!1},Me=(a,s)=>Math.floor(Math.random()*(s-a+1))+a,xa=(a,s)=>{const r=Math.max(3,a),d=s==="easy"?0:s==="medium"?1:s==="hard"?2:1,l=Me(Math.max(0,r-3-d),r),n=Me(Math.max(0,r-4+d),r),f=Math.min(r,Math.max(0,l)),_=Math.min(r,Math.max(0,n)),w=Math.max(0,Math.min(100,f/r*100+Me(-8,6))),j=Me(1800,6200);return{scoreFor:f,scoreAgainst:_,accuracy:w,averageResponseMs:j}},pa=a=>{const s=at(),r=ke(s),d=`local-bot-${Date.now()}-${Math.random().toString(16).slice(2,8)}`,l=xa(a.rounds,a.botDifficulty),n=l.scoreFor>l.scoreAgainst?"win":l.scoreFor0?j/w*100:0,averageAccuracy:w>0?(r.stats.averageAccuracy*r.stats.matchesPlayed+l.accuracy)/w:l.accuracy,averageResponseMs:w>0?Math.round((r.stats.averageResponseMs*r.stats.matchesPlayed+l.averageResponseMs)/w):l.averageResponseMs,currentStreak:k,bestStreak:m,favoriteTopicId:a.topicId,leaderboardScore:r.stats.leaderboardScore+_.xpEarned,updatedAt:f};return Ct(s,{stats:N,history:[_,...r.history].slice(0,50),queueStatus:"idle"}),{success:!0,matchId:d,status:"ready",botDifficulty:a.botDifficulty}},Rt=a=>{const s=at(),r=ke(s);Ct(s,{...r,queueStatus:a})},ha=()=>Math.random().toString(36).slice(2,8).toUpperCase(),st=a=>{const s=at();return{roomId:`local-room-${Date.now()}`,roomCode:a||ha(),ownerStudentId:s,participantIds:[s],participantCount:1,status:"waiting",subjectId:"gen-math",topicId:"functions",difficulty:"medium",rounds:5,timePerQuestionSec:30,isOwner:!0}},Et=()=>qe&&!!Te.currentUser?.uid&&!!je,Ft=(a,s,r)=>`quizBattlePresence/${a}/${s}/${r}`,ba=async(a,s)=>{if(!Et()||!s.trim()||!je)return;const r=Te.currentUser?.uid;if(!r)return;const d=At(je,Ft(a,s,r));try{await zt(d,{studentId:r,scope:a,resourceId:s,online:!0,heartbeatAt:fe(),updatedAt:fe()}),await Jt(d).update({online:!1,updatedAt:fe(),disconnectedAt:fe()})}catch(l){console.warn("Realtime presence connect failed:",l)}},fa=async(a,s)=>{if(!Et()||!s.trim()||!je)return;const r=Te.currentUser?.uid;if(!r)return;const d=At(je,Ft(a,s,r));try{await zt(d,{studentId:r,scope:a,resourceId:s,online:!1,updatedAt:fe(),disconnectedAt:fe()})}catch(l){console.warn("Realtime presence disconnect failed:",l)}},D=(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 d=s||{},l=Mt(s),n=typeof d.message=="string"?d.message.trim():"";return l==="unauthenticated"?"Your session has expired. Sign in again before starting a battle.":l==="permission-denied"?"Only student accounts can access Quiz Battle matchmaking.":l==="invalid-argument"?n||"Battle setup is invalid. Review the selected options and try again.":l==="already-exists"?n||"This room is already full. Try another room code.":l==="failed-precondition"?n||"Battle state changed. Please refresh and continue.":l==="unavailable"||l==="internal"||l==="not-found"||l==="deadline-exceeded"?/question generation temporarily unavailable/i.test(n)?n:"Quiz Battle service is temporarily unavailable. Please retry in a moment.":r},R=async(a,s,r=ua)=>{let d;try{return await Promise.race([s,new Promise((l,n)=>{d=setTimeout(()=>{n(new Error(`Timed out while ${a}. Please try again.`))},r)})])}finally{d&&clearTimeout(d)}},Fe=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},ga=()=>({mode:"online",subjectId:"gen-math",topicId:"",difficulty:"medium",rounds:5,timePerQuestionSec:30,queueType:"public_matchmaking",botDifficulty:"medium",adaptiveBot:!1}),wa=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},ge=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}),va=async a=>{try{const s=Xt(Re,"studentBattleStats",a),r=await Kt(s),d=Ee()?ke(a).stats:null;if(!r.exists())return d&&d.matchesPlayed>0?d:ge(a);const l=r.data(),n={...ge(a),...l,userId:a,updatedAt:Fe(l.updatedAt)};return d&&d.matchesPlayed>n.matchesPlayed?d:n}catch(s){if(console.error("Error loading battle stats:",s),Ee()){const r=ke(a).stats;if(r.matchesPlayed>0)return r}return ge(a)}},tt=(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:Fe(s.createdAt),endedAt:Fe(s.endedAt)}),ya=async(a,s={})=>{const r=s.limitCount||25,d=Ee()?ke(a).history:[],l=f=>f.filter(w=>!(s.mode&&s.mode!=="all"&&w.mode!==s.mode||s.subjectId&&w.subjectId!==s.subjectId||s.startDate&&w.endedAts.endDate)).sort((w,j)=>j.endedAt.getTime()-w.endedAt.getTime()).slice(0,r),n=f=>{if(d.length===0)return l(f);const _=new Map;return[...d,...f].forEach(w=>{_.set(w.matchId,w)}),l(Array.from(_.values()))};try{const f=[bt("studentId","==",a),It("endedAt","desc"),Xe(r)],w=(await Ke(Je(et(Re,"quizBattleHistory"),...f))).docs.map(j=>tt(j.id,j.data()));return n(w)}catch(f){try{const w=(await Ke(Je(et(Re,"quizBattleHistory"),bt("studentId","==",a),Xe(r)))).docs.map(j=>tt(j.id,j.data())).sort((j,p)=>p.endedAt.getTime()-j.endedAt.getTime());return n(w)}catch(_){return console.error("Error loading battle history:",f,_),l(d)}}},ja=async a=>{const s=M(C,"quizBattleJoinQueue");try{return(await R("joining Quiz Battle matchmaking queue",s({setup:a}))).data}catch(r){if(U(r))return Rt("queued"),{success:!0,status:"queued",queueEntryId:`local-queue-${Date.now()}`};throw new Error(D("joining Quiz Battle matchmaking queue",r))}},ka=async()=>{const a=M(C,"quizBattleLeaveQueue");try{return(await R("leaving Quiz Battle matchmaking queue",a({}))).data}catch(s){if(U(s))return Rt("idle"),{success:!0,status:"idle"};throw new Error(D("leaving Quiz Battle matchmaking queue",s))}},Na=async a=>{const s=M(C,"quizBattleCreatePrivateRoom");try{return(await R("creating Quiz Battle private room",s({setup:a}))).data}catch(r){if(U(r))return{success:!0,room:st()};throw new Error(D("creating Quiz Battle private room",r))}},_a=async a=>{const s=M(C,"quizBattleJoinPrivateRoom");try{return(await R("joining Quiz Battle private room",s({roomCode:a}),2e4)).data}catch(r){if(U(r))return{success:!0,room:st(a.trim().toUpperCase()||void 0)};throw new Error(D("joining Quiz Battle private room",r))}},Sa=async a=>{const s=M(C,"quizBattleGetPrivateRoomState");try{return(await R("loading Quiz Battle private room state",s(a),2e4)).data}catch(r){if(U(r))return{success:!0,room:st(a.roomCode?.trim().toUpperCase()||void 0)};throw new Error(D("loading Quiz Battle private room state",r))}},Ia=async(a={})=>{const s=M(C,"quizBattleLeavePrivateRoom");try{return(await R("leaving Quiz Battle private room",s(a),2e4)).data}catch(r){if(U(r))return{success:!0,status:"idle"};throw new Error(D("leaving Quiz Battle private room",r))}},_t=async()=>{const a=M(C,"quizBattleResumeSession");try{return(await R("resuming Quiz Battle session",a({}),2e4)).data}catch(s){if(U(s))return{success:!0,sessionType:"idle"};throw new Error(D("resuming Quiz Battle session",s))}},Aa=async(a,s)=>{if(!s.trim())return;const r=M(C,"quizBattleHeartbeat");await ba(a,s);try{await R("sending Quiz Battle heartbeat",r({scope:a,resourceId:s}),12e3)}catch(d){if(!U(d))throw new Error(D("sending Quiz Battle heartbeat",d))}},za=async a=>{const s=M(C,"quizBattleCreateBotMatch");try{return(await R("starting Quiz Battle bot match",s({setup:a}))).data}catch(r){if(U(r))return pa(a);throw new Error(D("starting Quiz Battle bot match",r))}},Ba=async a=>{const s=M(C,"quizBattleGetGenerationAudit");return(await R("verifying Quiz Battle generation metadata",s({matchId:a}),2e4)).data},ae=async a=>{const s=M(C,"quizBattleStartMatch");try{const d=(await R("starting Quiz Battle match",s({matchId:a}),2e4)).data.match;if(d.mode==="online")try{const l=await Ba(a);if(console.info("[QUIZ_BATTLE_GENERATION_AUDIT]",l),Nt&&!l.isAiSource)throw new Error(`Quiz Battle generation audit failed: expected AI source, got "${l.questionSetSource||"unknown"}".`)}catch(l){if(l instanceof Error&&l.message.startsWith("Quiz Battle generation audit failed"))throw l;if(console.warn("Quiz Battle generation audit unavailable:",l),Nt)throw new Error("Unable to verify Quiz Battle generation metadata. Please retry in a moment.")}return d}catch(r){throw new Error(D("starting Quiz Battle match",r))}},Ye=async a=>{const s=M(C,"quizBattleGetMatchState");try{return(await R("loading Quiz Battle match state",s({matchId:a}),2e4)).data.match}catch(r){throw new Error(D("loading Quiz Battle match state",r))}},Ca=async a=>{const s=M(C,"quizBattleSubmitAnswer");try{return(await R("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(D("submitting Quiz Battle answer",r))}},Ma=async a=>{const s=M(C,"quizBattleRequestRematch");try{return(await R("creating Quiz Battle rematch",s({matchId:a}),2e4)).data}catch(r){throw new Error(D("creating Quiz Battle rematch",r))}},Ra=async(a=20)=>{try{const s=Je(et(Re,"studentBattleLeaderboard"),It("leaderboardScore","desc"),Xe(a));return(await Ke(s)).docs.map((d,l)=>{const n=d.data();return{userId:n.userId||d.id,displayName:n.displayName||"Student",photo:n.photo,rank:n.rank||l+1,leaderboardScore:n.leaderboardScore||0,winRate:n.winRate||0,bestStreak:n.bestStreak||0}})}catch(s){return console.error("Error loading Quiz Battle leaderboard:",s),[]}};function W({className:a,...s}){return e.jsx("div",{"data-slot":"card",className:u("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border",a),...s})}function Y({className:a,...s}){return e.jsx("div",{"data-slot":"card-header",className:u("@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 X({className:a,...s}){return e.jsx("h4",{"data-slot":"card-title",className:u("leading-none",a),...s})}function se({className:a,...s}){return e.jsx("p",{"data-slot":"card-description",className:u("text-muted-foreground",a),...s})}function be({className:a,...s}){return e.jsx("div",{"data-slot":"card-content",className:u("px-6 [&:last-child]:pb-6",a),...s})}const F="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)]",Ea=a=>a<=0?"--":`${(a/1e3).toFixed(2)}s`,Fa=a=>a==="win"?"Win":a==="loss"?"Loss":"Draw",Da=(a,s,r)=>Math.max(s,Math.min(r,a)),Ta=a=>{const s=Math.floor(a/60),r=a%60;return`${s}:${String(r).padStart(2,"0")}`},qa=a=>{const s=a.trim().split(/\s+/).filter(Boolean).slice(0,2);return s.length===0?"ST":s.map(r=>r[0]?.toUpperCase()||"").join("")},St=(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,hs=()=>{const{userProfile:a,userRole:s}=Ut(),r=a,[d,l]=c.useState("hub"),[n,f]=c.useState(ga),[_,w]=c.useState([]),[j,p]=c.useState({status:"idle"}),[B,k]=c.useState(!1),[m,N]=c.useState(null),[I,E]=c.useState(""),[re,oe]=c.useState(null),[Ne,K]=c.useState(0),[ne,Dt]=c.useState(()=>typeof window>"u"?!0:window.localStorage.getItem("quiz_battle_sound_enabled")!=="0"),[rt,z]=c.useState("connected"),[ie,Tt]=c.useState("all"),[ot,Qe]=c.useState(!0),[L,Pe]=c.useState(null),[Le,$e]=c.useState([]),[qt,nt]=c.useState(!1),[it,Qt]=c.useState([]),[_e,Pt]=c.useState("alias"),[Oe,Lt]=c.useState(!1),[o,S]=c.useState(null),[we,$]=c.useState(null),[V,ve]=c.useState(!1),[q,ye]=c.useState(0),[O,H]=c.useState(!1),[Se,le]=c.useState(null),lt=c.useRef(""),He=c.useRef(null),de=c.useRef(null),G=c.useRef(0),dt=c.useRef(""),Z=c.useMemo(()=>{const t=Zt(r?.grade);return Yt.filter(i=>t.includes(i.id))},[r?.grade]),$t=c.useMemo(()=>(Z.find(i=>i.id===n.subjectId)?.modules||[]).map(i=>({value:i.id,label:i.title})),[Z,n.subjectId]),J=c.useCallback(t=>{if(!ne||typeof window>"u")return;const i=window.AudioContext||window.webkitAudioContext;if(i)try{const x=new i,h=x.createOscillator(),g=x.createGain(),y={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],P=x.currentTime;h.type=y.type,h.frequency.setValueAtTime(y.frequency,P),g.gain.setValueAtTime(1e-4,P),g.gain.exponentialRampToValueAtTime(y.volume,P+.015),g.gain.exponentialRampToValueAtTime(1e-4,P+y.duration),h.connect(g),g.connect(x.destination),h.start(P),h.stop(P+y.duration+.02),window.setTimeout(()=>{x.close()},Math.ceil((y.duration+.06)*1e3))}catch(x){console.debug("Battle tone playback skipped:",x)}},[ne]),ct=c.useCallback(async t=>{if(!(!t||typeof window>"u"))try{await window.navigator.clipboard.writeText(t),oe(t),window.setTimeout(()=>{oe(i=>i===t?null:i)},1600)}catch{p({status:"error",message:"Unable to copy room code automatically. Please copy it manually."})}},[]),ce=c.useCallback(async()=>{if(!r?.uid)return null;const[t,i]=await Promise.all([va(r.uid),ya(r.uid,{mode:ie,limitCount:8})]);return{stats:t,history:i}},[ie,r?.uid]);c.useEffect(()=>{if(Z.length===0)return;const i=Z.some(g=>g.id===n.subjectId)?n.subjectId:Z[0].id,x=Z.find(g=>g.id===i),h=x?.modules?.[0]?.id||"";f(g=>{const v=x?.modules?.some(y=>y.id===g.topicId)?g.topicId:h;return g.subjectId===i&&g.topicId===v?g:{...g,subjectId:i,topicId:v}})},[Z,n.subjectId]),c.useEffect(()=>{if(!r?.uid){Pe(null),$e([]),Qe(!1);return}let t=!0;return Qe(!0),(async()=>{const x=await ce();t&&(x&&(Pe(x.stats),$e(x.history)),Qe(!1))})(),()=>{t=!1}},[ce,r?.uid]);const Ie=c.useMemo(()=>ie==="all"?Le:Le.filter(t=>t.mode===ie),[Le,ie]),ut=c.useMemo(()=>it.map((t,i)=>{const x=t.rank||i+1,h=t.userId===r?.uid,g=`Student-${t.userId.slice(-4).toUpperCase()}`,v=_e==="full"?t.displayName:_e==="initials"?qa(t.displayName):g,y=Math.floor(t.leaderboardScore/25)*25,P=Oe||h?`${t.leaderboardScore} pts`:`${y}-${y+24} pts`;return{...t,rank:x,isSelf:h,displayName:v,scoreLabel:P}}),[it,_e,Oe,r?.uid]);c.useEffect(()=>{if(d!=="leaderboard"&&d!=="hub")return;let t=!0;return nt(!0),(async()=>{const x=await Ra(20);t&&(Qt(x),nt(!1))})(),()=>{t=!1}},[d]);const Ae=c.useCallback(async()=>{if(r?.uid)try{const t=await _t();if(t.sessionType==="match"&&t.match){k(!1),N(t.room||null),S(t.match),l("battle"),z("connected");return}if(t.sessionType==="room"&&t.room){k(!1),N(t.room),S(i=>i?.mode==="bot"?i:null),z("connected");return}if(t.sessionType==="queue"){k(!0),N(null),S(i=>i?.mode==="bot"?i:null),z("connected");return}k(!1),N(null),S(i=>i?.mode==="bot"?i:null),z("connected")}catch(t){console.warn("Quiz Battle session resume failed:",t),z("reconnecting")}},[r?.uid]);c.useEffect(()=>{r?.uid&&Ae()},[r?.uid,Ae]),c.useEffect(()=>{typeof window>"u"||window.localStorage.setItem("quiz_battle_sound_enabled",ne?"1":"0")},[ne]),c.useEffect(()=>{if(!(B||m&&(m.status==="waiting"||m.status==="ready"))){K(0);return}const t=window.setInterval(()=>{K(i=>i+1)},1e3);return()=>{window.clearInterval(t)}},[B,m?.status,m?.roomId]),c.useEffect(()=>{if(typeof window>"u")return;z(window.navigator.onLine?"connected":"disconnected");const t=()=>{z("reconnecting"),Ae()},i=()=>{z("disconnected")};return window.addEventListener("online",t),window.addEventListener("offline",i),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",i)}},[Ae]),c.useEffect(()=>{const t=o?.mode==="online"&&(o.status==="ready"||o.status==="in_progress"),i=!!(m&&(m.status==="waiting"||m.status==="ready"));if(!B&&!i&&!t)return;let x=!1;const h=async()=>{try{if(o?.mode==="online"){if(o.status==="ready"){const y=await ae(o.matchId);if(x)return;S(y),z("connected"),y.status==="in_progress"&&p({status:"queued",message:"Match started. Round timer is live."});return}const v=await Ye(o.matchId);if(x)return;S(v),v.status==="completed"&&(k(!1),N(null)),z("connected");return}if(m?.roomId){const v=await Sa({roomId:m.roomId});if(x)return;if(N(v.room),v.match){const y=await ae(v.match.matchId);if(x)return;S(y),N(v.room),k(!1),l("battle"),z("connected"),p({status:"queued",message:y.status==="ready"?"Opponent connected. Waiting for synchronized start...":"Private room match started."})}return}if(B){const v=await _t();if(x)return;if(v.sessionType==="match"&&v.match){const y=await ae(v.match.matchId);if(x)return;S(y),N(v.room||null),k(!1),l("battle"),z("connected"),p({status:"queued",message:"Opponent found. Preparing synchronized start..."});return}if(v.sessionType==="room"&&v.room){k(!1),N(v.room),z("connected");return}z("connected")}}catch(v){x||(console.warn("Quiz Battle sync poll failed:",v),z("reconnecting"))}};h();const g=window.setInterval(()=>{h()},3e3);return()=>{x=!0,window.clearInterval(g)}},[o?.matchId,o?.mode,o?.status,m?.roomId,m?.status,B]);const ee=c.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}:B&&r?.uid?{scope:"queue",resourceId:r.uid}:null,[o,m,B,r?.uid]);c.useEffect(()=>{if(!ee)return;let t=!1;const i=async()=>{try{await Aa(ee.scope,ee.resourceId),t||z("connected")}catch(h){t||(console.warn("Quiz Battle heartbeat failed:",h),z("reconnecting"))}};i();const x=window.setInterval(()=>{i()},8e3);return()=>{t=!0,window.clearInterval(x),fa(ee.scope,ee.resourceId)}},[ee?.scope,ee?.resourceId]),c.useEffect(()=>{if(!o||o.status!=="in_progress"){H(!1),de.current=null,G.current=0;return}de.current=null,G.current=0;const t=o.roundDeadlineAtMs?Math.max(0,Math.ceil((o.roundDeadlineAtMs-Date.now())/1e3)):o.timePerQuestionSec;ye(t),$(null),H(!1)},[o?.matchId,o?.status,o?.currentRound,o?.timePerQuestionSec]),c.useEffect(()=>{const t=o?.lifecycle;if(!t?.eventType)return;const i=`${t.eventType}:${t.sequence}`;lt.current!==i&&(lt.current=i,t.eventType==="answer_locked"?J("lock"):t.eventType==="round_result"&&J("result"))},[o?.lifecycle?.eventType,o?.lifecycle?.sequence,J]),c.useEffect(()=>{!o||o.status!=="completed"||dt.current!==o.matchId&&(dt.current=o.matchId,J(o.outcome==="loss"?"loss":"win"),o.outcome==="win"&&Vt(()=>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,J]),c.useEffect(()=>{if(!o||o.status!=="in_progress"||O||V){He.current=null;return}q<=3&&q>0&&He.current!==q&&(He.current=q,J("tick"))},[o?.status,q,O,V,J]);const We=c.useCallback(async t=>{if(!o||o.status!=="in_progress"||O)return;ve(!0);const i=window.setTimeout(()=>{ve(!1),p({status:"error",message:"Submission took too long. Syncing latest match state now..."}),Ye(o.matchId).then(x=>{S(x),x.status==="completed"&&(k(!1),N(null))}).catch(()=>{})},12e3);try{const x=o.roundDeadlineAtMs?Da(o.timePerQuestionSec*1e3-Math.max(0,o.roundDeadlineAtMs-Date.now()),0,o.timePerQuestionSec*1e3):Math.max(0,(o.timePerQuestionSec-q)*1e3),h=await Ca({matchId:o.matchId,roundNumber:o.currentRound,selectedOptionIndex:t,responseMs:x});de.current=null,G.current=0,S(h.match),le(h.roundResult),$(null),h.match.mode==="online"&&h.match.status==="in_progress"&&!h.roundResult&&(H(!0),p({status:"queued",message:"Answer locked. Waiting for opponent to finish the round..."})),h.match.status==="completed"&&(k(!1),N(null),ce(),p({status:"queued",message:h.completion?`Match finished (${h.completion.outcome.toUpperCase()}) +${h.completion.xpEarned} XP`:"Match finished. Results saved."}))}catch(x){const g=x?.message||"Unable to submit answer right now. Please try again.";if(t===null||g.includes("Round timer elapsed")||g.includes("Expected round")||g.includes("Match is not currently active"))try{const y=await Ye(o.matchId),P=y.currentRound!==o.currentRound;if(S(y),$(null),H(!1),P||y.status==="completed"?(de.current=null,G.current=0):t===null&&(G.current=Date.now()+3e3),y.status==="completed"){k(!1),N(null),ce(),p({status:"queued",message:"Match finished. Results synchronized."});return}p({status:"queued",message:"Round timed out. Synced to the latest battle state."});return}catch{}t===null&&(G.current=Date.now()+3e3),p({status:"error",message:g})}finally{window.clearTimeout(i),ve(!1)}},[o,ce,O,q]);c.useEffect(()=>{if(!o||o.status!=="in_progress"||V||O)return;const t=o.roundDeadlineAtMs?Math.max(0,Math.ceil((o.roundDeadlineAtMs-Date.now())/1e3)):q;if(o.roundDeadlineAtMs&&t!==q&&ye(t),we===null?t<=1:t<=0){if(de.current===o.currentRound&&Date.now(){o.roundDeadlineAtMs?ye(Math.max(0,Math.ceil((o.roundDeadlineAtMs-Date.now())/1e3))):ye(h=>Math.max(0,h-1))},1e3);return()=>{window.clearTimeout(x)}},[o,V,O,q,we,We]);const Ot=c.useCallback(async()=>{if(!(!o||o.mode!=="bot")){ve(!0),p({status:"validating"});try{const t=await Ma(o.matchId),i=await ae(t.matchId);S(i),N(null),k(!1),le(null),$(null),H(!1),l("battle"),p({status:"queued",message:`Rematch ready (${t.botDifficulty}). Good luck!`})}catch(t){p({status:"error",message:t?.message||"Unable to start rematch right now."})}finally{ve(!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(W,{className:u(F,"max-w-2xl"),children:e.jsxs(Y,{children:[e.jsx(X,{children:"Quiz Battle is student-only"}),e.jsx(se,{className:"text-muted-foreground dark:text-[#aab3c7]",children:"Your account role does not have access to this module."})]})})});const mt=t=>{w([]),p({status:"idle"}),k(!1),N(null),E(""),S(null),le(null),$(null),H(!1),f(i=>({...i,mode:t,queueType:t==="online"?i.queueType:"public_matchmaking"})),K(0),l("setup")},xt=async()=>{p({status:"validating"});try{m?.roomId?await Ia({roomId:m.roomId}):await ka(),k(!1),N(null),S(t=>!t||t.mode!=="online"?t:t.status==="ready"||t.status==="cancelled"?null:t),E(""),K(0),p({status:"queued",message:m?.roomId?"Private room cancelled.":"Left matchmaking queue."})}catch(t){p({status:"error",message:t?.message||"Unable to cancel this online session right now. Please try again."})}},Ht=async()=>{p({status:"validating"});const t=wa(n);if(t.length>0){w(t),p({status:"error",message:"Fix the highlighted setup fields before starting."});return}w([]);try{if(n.mode==="online"){if(n.queueType==="private_room"){const g=I.trim().toUpperCase(),v=g?await _a(g):await Na(n);if(k(!1),N(v.room),E(""),v.match){const y=await ae(v.match.matchId);S(y),le(null),$(null),H(!1),l("battle"),p({status:"queued",message:y.status==="ready"?`Room ${v.room.roomCode} linked. Waiting for synchronized start...`:"Private room match started."});return}S(null),p({status:"queued",message:g?"Joined private room. Waiting for opponent...":"Private room created. Share code:"});return}const h=await ja(n);if(h.status==="matched"&&h.matchId){const g=await ae(h.matchId);k(!1),N(null),S(g),le(null),$(null),H(!1),l("battle"),p({status:"queued",message:"Opponent found. Preparing synchronized start..."});return}k(!0),N(null),S(null),K(0),p({status:"queued",message:"Joined matchmaking queue. Waiting for an opponent..."});return}const i=await za(n),x=await ae(i.matchId);k(!1),N(null),S(x),le(null),$(null),H(!1),ye(x.timePerQuestionSec),l("battle"),p({status:"queued",message:`Bot match ${i.matchId.slice(0,8)} live (${i.botDifficulty}).`}),ce().then(h=>{h&&(Pe(h.stats),$e(h.history))})}catch(i){k(!1),p({status:"error",message:i?.message||"Unable to start battle. Please try again."})}},T=t=>_.find(i=>i.field===t)?.message;L?.winRate;const pt=!!(n.mode==="online"&&m&&(m.status==="waiting"||m.status==="ready")&&(!o||o.status!=="completed")),Wt=!!(B||m&&(m.status==="waiting"||m.status==="ready")&&(!o||o.status==="ready"||o.status==="cancelled"));return e.jsx(ca,{className:"-mx-3 lg:-mx-4 -mt-3 lg:-mt-4 -mb-8 px-4 sm:px-6 xl:px-10 py-6 sm:py-8 min-h-[calc(100vh-3.5rem)] !w-auto overflow-hidden relative",children:e.jsx("div",{className:"h-full flex flex-col max-w-[1400px] mx-auto w-full",children:e.jsx(b.div,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{duration:.24,ease:[.22,1,.36,1]},className:"space-y-3 lg:space-y-4",children:e.jsxs(ea,{value:d,onValueChange:t=>l(t),children:[e.jsx(ue,{value:"hub",className:"mt-0 outline-none",children:e.jsx(b.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 lg:grid-cols-[1fr_300px] xl:grid-cols-[1fr_320px] gap-6 sm:gap-8 lg:gap-10",children:[e.jsxs("div",{className:"space-y-3 lg:space-y-4",children:[e.jsxs("div",{className:"relative select-none isolate bg-indigo-600 rounded-[2rem] shadow-[0_20px_45px_-15px_rgba(0,0,0,0.3)] shrink-0",children:[e.jsx("div",{className:"absolute inset-0 bg-black/60 pointer-events-none z-0 rounded-[2rem]"}),e.jsx("div",{className:"absolute inset-0 opacity-10 pointer-events-none rounded-[2rem] overflow-hidden",style:{backgroundImage:"repeating-linear-gradient(0deg, transparent, transparent 39px, #ffffff 39px, #ffffff 40px), repeating-linear-gradient(90deg, transparent, transparent 39px, #ffffff 39px, #ffffff 40px)"}}),e.jsx("div",{className:"absolute top-0 right-0 w-[400px] h-[400px] bg-sky-500/20 blur-[100px] rounded-full pointer-events-none"}),e.jsxs("div",{className:"relative z-10 flex flex-col md:flex-row items-center justify-between p-6 lg:p-8 h-full min-h-[140px] lg:min-h-[160px]",children:[e.jsx("div",{className:"flex-1 space-y-3 w-full pr-0 md:pr-[240px] lg:pr-[280px]",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"flex items-center gap-3 text-3xl sm:text-4xl lg:text-[46px] font-black tracking-tight text-white mb-2 sm:mb-4",children:[e.jsx(Ue,{className:"h-8 w-8 sm:h-10 sm:w-10 lg:h-12 lg:w-12 text-[#d1abff]",strokeWidth:2.5}),"Quiz Battle"]}),e.jsx("p",{className:"text-base sm:text-lg lg:text-xl text-white mt-1.5 sm:mt-2 max-w-2xl leading-relaxed",children:"Timed student duels with synchronized rounds, instant feedback, and progression rewards."}),e.jsxs("p",{className:"text-xs lg:text-sm font-semibold uppercase tracking-[0.15em] text-[#8a7fbc] mt-3",children:["Connection: ",e.jsx("span",{className:rt==="connected"?"text-emerald-400":"text-amber-400",children:rt})]})]})}),e.jsx("div",{className:"hidden md:block absolute right-[-5px] lg:right-[-15px] top-0 lg:top-[5px] w-[200px] lg:w-[260px] shrink-0 pointer-events-none z-20",children:e.jsx(b.img,{src:da,alt:"Mascot",className:"w-full h-full object-contain",animate:{y:[0,-24,0],rotate:[-3,3,-3]},transition:{duration:4,repeat:1/0,ease:"easeInOut"}})})]})]}),e.jsxs("div",{className:"pt-4 lg:pt-6",children:[e.jsxs("h2",{className:"flex items-center gap-2 pb-4 text-xl lg:text-2xl font-black tracking-wide uppercase text-white drop-shadow-[0_0_12px_rgba(255,255,255,0.4)]",children:[e.jsx(Ue,{className:"h-6 w-6 lg:h-8 lg:w-8 text-amber-400 drop-shadow-[0_0_8px_rgba(251,191,36,0.9)]"})," BATTLE MODES"]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 lg:gap-6 relative z-10 w-full mb-2",children:[e.jsxs(b.button,{type:"button",onClick:()=>mt("online"),whileHover:{scale:1.025},whileTap:{scale:.98},transition:{type:"spring",stiffness:400,damping:15},className:"w-full h-[205px] sm:h-[245px] lg:h-[265px] bg-[#8A3FD3] rounded-[22px] border-none relative text-left shadow-[0_8px_30px_rgba(138,63,211,0.2)] hover:shadow-[0_12px_45px_rgba(138,63,211,0.4)] block flex-col group",children:[e.jsx("div",{className:"absolute inset-0 rounded-[22px] shadow-[inset_0_6px_15px_rgba(255,255,255,0.4)] pointer-events-none z-40"}),e.jsxs("div",{className:"absolute top-4 -left-4 z-20 w-[100px] h-[40px] opacity-100",children:[e.jsx("svg",{viewBox:"0 0 100 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"w-full h-full block drop-shadow-md",children:e.jsx("path",{d:"M0 0 H94 Q100 0 100 6 V34 Q100 40 94 40 H0 L14 20 Z",fill:"#b91c1c"})}),e.jsx("div",{className:"absolute inset-0 flex items-center justify-end pr-3 font-black text-[13px] text-white tracking-[0.3px] opacity-100",style:{fontFamily:"'Nunito', sans-serif"},children:"VS Player"})]}),e.jsxs("div",{className:"rounded-[22px] overflow-hidden relative isolate h-full flex flex-col justify-end",children:[e.jsx("div",{className:"absolute top-0 -left-[150%] w-[100%] h-full bg-gradient-to-r from-transparent via-white/40 to-transparent -skew-x-12 z-50 pointer-events-none transition-all duration-0 group-hover:duration-[800ms] ease-in-out group-hover:left-[150%]"}),e.jsxs("div",{className:"flex-1 w-full flex items-end justify-center relative pt-2 pointer-events-none",children:[e.jsx("div",{className:"absolute bottom-0 left-0 w-full h-[70px] sm:h-[95px] bg-[#662AA8] rounded-[50%_50%_0_0/100%_100%_0_0] scale-[1.05] z-0"}),e.jsxs("div",{className:"relative z-10 flex items-center justify-center mb-[2px] h-[120px] sm:h-[140px] w-full",children:[e.jsx(b.img,{src:"/avatar/avatar_icon.png",alt:"",className:"h-[120%] sm:h-[125%] object-contain relative z-20 origin-bottom right-[-15px] drop-shadow-[0_12px_15px_rgba(0,0,0,0.3)]",animate:{y:[0,-5,0]},transition:{duration:4,repeat:1/0,ease:"easeInOut"}}),e.jsx(b.div,{className:"relative z-30 flex flex-col items-center mx-[-20px] scale-[1.1]",animate:{scale:[1.1,1.15,1.1]},transition:{duration:2,repeat:1/0,ease:"easeInOut"},children:e.jsxs("span",{className:"font-black italic text-[40px] text-gray-200 tracking-tighter leading-none drop-shadow-[-2px_3px_0px_rgba(0,0,0,0.8)]",style:{WebkitTextStroke:"1.5px #666"},children:[e.jsx("span",{className:"text-gray-300",children:"V"}),e.jsx("span",{className:"text-gray-400",children:"S"})]})}),e.jsx(b.img,{src:"/avatar/avatar_icon.png",alt:"",className:"h-[120%] sm:h-[125%] object-contain relative z-10 scale-x-[-1] origin-bottom left-[-20px] drop-shadow-[0_12px_15px_rgba(0,0,0,0.3)]",animate:{y:[0,-4,0]},transition:{duration:4,repeat:1/0,ease:"easeInOut",delay:.4}})]})]}),e.jsx("div",{className:"relative z-10 w-full px-5 py-3 sm:py-4 text-center bg-[#662AA8]",children:e.jsx("p",{className:"text-[13px] font-bold text-white leading-[1.45]",style:{fontFamily:"'Nunito', sans-serif"},children:"Queue or room-code match with another student."})})]})]}),e.jsxs(b.button,{type:"button",onClick:()=>mt("bot"),whileHover:{scale:1.025},whileTap:{scale:.98},transition:{type:"spring",stiffness:400,damping:15},className:"w-full h-[205px] sm:h-[245px] lg:h-[265px] bg-[#1FA7E1] rounded-[22px] border-none relative text-left shadow-[0_8px_30px_rgba(31,167,225,0.2)] hover:shadow-[0_12px_45px_rgba(31,167,225,0.4)] block flex-col group",children:[e.jsx("div",{className:"absolute inset-0 rounded-[22px] shadow-[inset_0_6px_15px_rgba(255,255,255,0.4)] pointer-events-none z-40"}),e.jsxs("div",{className:"absolute top-4 -left-4 z-20 w-[100px] h-[40px] opacity-100",children:[e.jsx("svg",{viewBox:"0 0 100 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"w-full h-full block drop-shadow-md",children:e.jsx("path",{d:"M0 0 H94 Q100 0 100 6 V34 Q100 40 94 40 H0 L14 20 Z",fill:"#b91c1c"})}),e.jsx("div",{className:"absolute inset-0 flex items-center justify-end pr-3 font-black text-[13px] text-white tracking-[0.3px] opacity-100",style:{fontFamily:"'Nunito', sans-serif"},children:"VS Bot"})]}),e.jsxs("div",{className:"rounded-[22px] overflow-hidden relative isolate h-full flex flex-col justify-end",children:[e.jsx("div",{className:"absolute top-0 -left-[150%] w-[100%] h-full bg-gradient-to-r from-transparent via-white/40 to-transparent -skew-x-12 z-50 pointer-events-none transition-all duration-0 group-hover:duration-[800ms] ease-in-out group-hover:left-[150%]"}),e.jsxs("div",{className:"flex-1 w-full flex items-end justify-center relative pt-2 pointer-events-none",children:[e.jsx("div",{className:"absolute bottom-0 left-0 w-full h-[70px] sm:h-[95px] bg-[#127DA6] rounded-[50%_50%_0_0/100%_100%_0_0] scale-[1.05] z-0"}),e.jsxs("div",{className:"relative z-10 flex items-end justify-center mb-[2px] h-[125px] sm:h-[145px] w-full",children:[e.jsx(b.img,{src:"/avatar/avatar_icon.png",alt:"",className:"absolute opacity-40 blur-[1px] h-full object-contain origin-bottom -translate-x-[45px] sm:-translate-x-[60px] scale-[0.80] sm:scale-[0.85]",animate:{y:[0,-3,0]},transition:{duration:3.5,repeat:1/0,ease:"easeInOut",delay:.3}}),e.jsx(b.img,{src:"/avatar/avatar_icon.png",alt:"",className:"absolute opacity-40 blur-[1px] h-full object-contain origin-bottom translate-x-[45px] sm:translate-x-[60px] scale-[0.80] sm:scale-[0.85]",animate:{y:[0,-3,0]},transition:{duration:3.5,repeat:1/0,ease:"easeInOut",delay:.6}}),e.jsx(b.img,{src:"/avatar/avatar_icon.png",alt:"VS Bot",className:"relative opacity-100 scale-100 h-[105%] sm:h-[115%] object-contain drop-shadow-[0_15px_15px_rgba(0,0,0,0.3)] z-20 origin-bottom",animate:{y:[0,-5,0]},transition:{duration:3.5,repeat:1/0,ease:"easeInOut"}})]})]}),e.jsx("div",{className:"relative z-10 w-full px-5 py-3 sm:py-4 text-center bg-[#127DA6]",children:e.jsx("p",{className:"text-[13px] font-bold text-white leading-[1.45]",style:{fontFamily:"'Nunito', sans-serif"},children:"Instant solo duel with selectable bot difficulty."})})]})]})]})]})]}),e.jsxs("div",{className:"space-y-3 lg:space-y-4 flex flex-col h-full justify-between",children:[e.jsx("div",{onClick:()=>l("leaderboard"),className:"relative w-full h-[155px] sm:h-[165px] cursor-pointer group flex items-end justify-center overflow-visible mt-1 mb-2 scale-[0.75] origin-bottom sm:scale-[0.80] lg:scale-[0.85] lg:origin-center",children:e.jsxs(b.div,{className:"relative w-full h-full flex flex-col items-center justify-end",whileHover:{scale:1.03},whileTap:{scale:.98},children:[e.jsxs("div",{className:"absolute top-[1px] sm:-top-[30px] w-full flex justify-center items-end px-2 z-0",children:[e.jsx(Ve,{strokeWidth:0,fill:"currentColor",className:"w-[35px] h-[35px] text-[#fde047] -rotate-[15deg] -mr-3 mb-1 z-0 drop-shadow-[0_0_15px_rgba(253,224,71,0.6)]"}),e.jsx(b.div,{animate:{y:[-4,4,-4]},transition:{duration:3,repeat:1/0,ease:"easeInOut"},className:"z-10 relative",children:e.jsx(Ve,{strokeWidth:0,fill:"currentColor",className:"w-[60px] h-[60px] text-[#fcd34d] drop-shadow-[0_0_25px_rgba(252,211,77,0.9)]"})}),e.jsx(Ve,{strokeWidth:0,fill:"currentColor",className:"w-[35px] h-[35px] text-[#fde047] rotate-[15deg] -ml-3 mb-1 z-0 drop-shadow-[0_0_15px_rgba(253,224,71,0.6)]"})]}),e.jsx("div",{className:`absolute inset-x-0 bottom-[40px] top-0 z-10 flex flex-col items-center justify-end + filter drop-shadow-[0px_3px_0px_white] drop-shadow-[0px_-3px_0px_white] drop-shadow-[3px_0px_0px_white] drop-shadow-[-3px_0px_0px_white] drop-shadow-[2px_2px_0px_white] drop-shadow-[-2px_-2px_0px_white] drop-shadow-[2px_-2px_0px_white] drop-shadow-[-2px_2px_0px_white]`,children:e.jsxs("div",{className:"flex items-end justify-center z-20 relative px-4",children:[e.jsxs("div",{className:"flex flex-col items-center w-[65px] relative",children:[e.jsx("div",{className:"w-full h-[14px] bg-[#d24b4b] rounded-[2px] relative z-10 -mb-[1px]"}),e.jsxs("div",{className:"w-[85%] h-[50px] bg-[#fe5c5c] rounded-b-[2px] flex flex-col justify-center items-center gap-1.5 pb-1.5",children:[e.jsx("div",{className:"w-6 h-1.5 bg-white rounded-full opacity-95"}),e.jsx("div",{className:"w-6 h-1.5 bg-white rounded-full opacity-95"})]})]}),e.jsxs("div",{className:"flex flex-col items-center w-[75px] -mx-[4px] z-20 relative",children:[e.jsx("div",{className:"w-full h-[18px] bg-[#f2812d] rounded-[2px] relative z-10 -mb-[1px]"}),e.jsxs("div",{className:"w-[85%] h-[75px] bg-[#fa9746] rounded-b-[2px] flex flex-col justify-start items-center pt-4 gap-1.5",children:[e.jsx("div",{className:"w-9 h-1.5 bg-white rounded-full opacity-95"}),e.jsx("div",{className:"w-9 h-1.5 bg-white rounded-full opacity-95"})]})]}),e.jsxs("div",{className:"flex flex-col items-center w-[65px] relative",children:[e.jsx("div",{className:"w-full h-[14px] bg-[#d24b4b] rounded-[2px] relative z-10 -mb-[1px]"}),e.jsxs("div",{className:"w-[85%] h-[50px] bg-[#fe5c5c] rounded-b-[2px] flex flex-col justify-center items-center gap-1.5 pb-1.5",children:[e.jsx("div",{className:"w-6 h-1.5 bg-white rounded-full opacity-95"}),e.jsx("div",{className:"w-6 h-1.5 bg-white rounded-full opacity-95"})]})]})]})}),e.jsx("div",{className:"absolute bottom-2 w-[110%] max-w-[280px] z-30 drop-shadow-2xl",children:e.jsxs("div",{className:"relative w-full h-[52px] flex justify-center items-center",children:[e.jsx("div",{className:"absolute -left-1 top-2 w-[55px] h-[40px] bg-[#8b0d0d] z-0",style:{clipPath:"polygon(100% 0, 100% 100%, 0 100%, 25% 50%, 0 0)"}}),e.jsx("div",{className:"absolute -right-1 top-2 w-[55px] h-[40px] bg-[#8b0d0d] z-0",style:{clipPath:"polygon(0 0, 0 100%, 100% 100%, 75% 50%, 100% 0)"}}),e.jsxs("div",{className:"absolute inset-x-6 top-0 bottom-0 bg-[#b61515] shadow-[inset_0_2px_4px_rgba(255,255,255,0.1),_inset_0_-4px_4px_rgba(0,0,0,0.2)] z-10 flex flex-col items-center justify-center",children:[e.jsx("h3",{className:"text-lg sm:text-xl font-black text-white tracking-widest leading-none drop-shadow-md",style:{fontFamily:"'Nunito', sans-serif"},children:"Hall of Fame"}),e.jsx("span",{className:"text-[9px] sm:text-[10px] font-bold text-white/90 tracking-widest mt-0.5",children:"View Page >"})]})]})})]})}),e.jsxs("div",{className:"relative w-full bg-[#3b3a82] dark:bg-[#2b2b5f] rounded-[24px] overflow-hidden flex flex-col shadow-[0_8px_30px_rgba(59,58,130,0.3)]",children:[e.jsxs("div",{className:"flex flex-row items-end justify-between px-5 pt-4 pb-2 relative z-10",children:[e.jsx("h3",{className:"text-[18px] font-black text-white tracking-wide leading-none drop-shadow-md",style:{fontFamily:"'Nunito', sans-serif"},children:"My Stats"}),e.jsx(A,{variant:"link",className:"text-white/80 hover:text-white p-0 h-auto font-semibold text-[13px] tracking-wide",onClick:()=>l("stats"),children:"View Stats >"})]}),e.jsxs("div",{className:"relative z-10 w-full overflow-hidden pb-4",children:[e.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-6 bg-gradient-to-r from-[#3b3a82] to-transparent z-20 pointer-events-none dark:from-[#2b2b5f]"}),e.jsx("div",{className:"absolute right-0 top-0 bottom-0 w-6 bg-gradient-to-l from-[#3b3a82] to-transparent z-20 pointer-events-none dark:from-[#2b2b5f]"}),e.jsx(b.div,{className:"flex w-max pl-3",animate:{x:["0%","-50%"]},transition:{ease:"linear",duration:15,repeat:1/0},children:[0,1].map(t=>e.jsxs("div",{className:"flex gap-2.5 pr-2.5",children:[e.jsxs("div",{className:"flex-none w-[60px] sm:w-[65px] lg:w-[70px] xl:w-[75px] aspect-square rounded-[12px] bg-[#f0eaff] p-1.5 flex flex-col justify-between relative overflow-hidden group shadow-sm dark:bg-[#d6ccf5]",children:[e.jsx(Ge,{className:"absolute -bottom-1 -right-2 w-6 h-6 sm:w-8 sm:h-8 text-[#a06aec]/10 -rotate-12 transition-transform group-hover:scale-110"}),e.jsx("span",{className:"text-[12px] drop-shadow-sm leading-none",children:"🏆"}),e.jsxs("div",{className:"relative z-10 space-y-[1px]",children:[e.jsxs("h4",{className:"text-[12px] sm:text-[14px] lg:text-[16px] font-black text-[#8f5ae2] leading-none tracking-tight",children:[Math.round(L?.winRate||0)," %"]}),e.jsx("p",{className:"text-[6px] lg:text-[7px] font-extrabold text-[#baa4df] uppercase tracking-wider leading-none",children:"Win Rate"})]})]}),e.jsxs("div",{className:"flex-none w-[60px] sm:w-[65px] lg:w-[70px] xl:w-[75px] aspect-square rounded-[12px] bg-[#e1f5f7] p-1.5 flex flex-col justify-between relative overflow-hidden group shadow-sm dark:bg-[#b0e6eb]",children:[e.jsx(wt,{className:"absolute -bottom-1 -right-2 w-6 h-6 sm:w-8 sm:h-8 text-[#35a8bc]/10 rotate-12 transition-transform group-hover:scale-110"}),e.jsx("span",{className:"text-[12px] drop-shadow-sm leading-none",children:"🎯"}),e.jsxs("div",{className:"relative z-10 space-y-[1px]",children:[e.jsx("h4",{className:"text-[12px] sm:text-[14px] lg:text-[16px] font-black text-[#319ab4] leading-none tracking-tight",children:L?.matchesPlayed||0}),e.jsx("p",{className:"text-[6px] lg:text-[7px] font-extrabold text-[#7eafbe] uppercase tracking-wider leading-none",children:"Matches"})]})]}),e.jsxs("div",{className:"flex-none w-[60px] sm:w-[65px] lg:w-[70px] xl:w-[75px] aspect-square rounded-[12px] bg-[#fef5e7] p-1.5 flex flex-col justify-between relative overflow-hidden group shadow-sm dark:bg-[#f6ebd2]",children:[e.jsx(jt,{className:"absolute -bottom-1 -right-2 w-6 h-6 sm:w-8 sm:h-8 text-[#e87a42]/10 -rotate-12 transition-transform group-hover:scale-110"}),e.jsx("span",{className:"text-[12px] drop-shadow-sm leading-none",children:"⏱️"}),e.jsxs("div",{className:"relative z-10 space-y-[1px]",children:[e.jsxs("h4",{className:"text-[12px] sm:text-[14px] lg:text-[16px] font-black text-[#db734b] leading-none tracking-tight",children:[L?.averageResponseMs?(L.averageResponseMs/1e3).toFixed(1):0,"s"]}),e.jsx("p",{className:"text-[6px] lg:text-[7px] font-extrabold text-[#d2a893] uppercase tracking-wider leading-none whitespace-nowrap",children:"Response"})]})]}),e.jsxs("div",{className:"flex-none w-[60px] sm:w-[65px] lg:w-[70px] xl:w-[75px] aspect-square rounded-[12px] bg-[#fdeceb] p-1.5 flex flex-col justify-between relative overflow-hidden group shadow-sm dark:bg-[#fbd3d3]",children:[e.jsx(vt,{className:"absolute -bottom-1 -right-2 w-6 h-6 sm:w-8 sm:h-8 text-[#df655a]/10 rotate-12 transition-transform group-hover:scale-110"}),e.jsx("span",{className:"text-[12px] drop-shadow-sm leading-none",children:"✨"}),e.jsxs("div",{className:"relative z-10 space-y-[1px]",children:[e.jsx("h4",{className:"text-[12px] sm:text-[14px] lg:text-[16px] font-black text-[#d05c54] leading-none tracking-tight",children:r?.currentXP||0}),e.jsx("p",{className:"text-[6px] lg:text-[7px] font-extrabold text-[#dd9a9a] uppercase tracking-wider leading-none whitespace-nowrap",children:"Total XP"})]})]})]},t))})]})]}),e.jsxs(W,{className:u(F,"rounded-[18px] flex flex-col min-h-[200px]"),children:[e.jsxs(Y,{className:"pb-0 pt-3 px-4 flex flex-row items-center justify-between",children:[e.jsxs(X,{className:"text-[14px] font-black flex items-center gap-2 text-[#2e2b5e] dark:text-[#f5f7fb]",children:[e.jsx(kt,{className:"h-[16px] w-[16px] text-[#2e2b5e] dark:text-[#9e8fff]"})," Match History"]}),e.jsx(A,{variant:"link",size:"sm",className:"h-auto p-0 text-[12px] font-semibold text-muted-foreground dark:text-[#95a0bb] hover:text-primary transition-colors",onClick:()=>l("history"),children:"View All"})]}),e.jsxs(be,{className:"space-y-1.5 px-4 pt-1 pb-3 overflow-y-auto",children:[e.jsx("div",{className:"text-[11px] text-muted-foreground dark:text-[#8b95ad] mb-1.5 leading-relaxed",children:"Your recent student battles only."}),ot?e.jsxs("div",{className:"space-y-2",children:[e.jsx(te,{className:"h-10 w-full rounded-xl bg-muted dark:bg-[#2a3143]"}),e.jsx(te,{className:"h-10 w-full rounded-xl bg-muted dark:bg-[#2a3143]"})]}):Ie.length===0?e.jsx("p",{className:"text-xs text-center text-muted-foreground dark:text-[#a8b2c9] py-2",children:"No battle history yet."}):Ie.slice(0,3).map(t=>{const i=t.outcome==="win",x=t.outcome==="loss",h=t.opponentName.split(" ").map(g=>g[0]).join("").substring(0,2).toUpperCase()||"OP";return e.jsxs("div",{className:"group relative overflow-hidden rounded-[14px] border border-muted-foreground/15 bg-white dark:bg-[#11151d] dark:border-[#2f3547] p-2 shadow-sm transition-all hover:scale-[1.01] hover:shadow-md",children:[e.jsx("div",{className:u("absolute inset-y-0 right-0 w-[55%] pointer-events-none opacity-[0.2] dark:opacity-[0.25] mix-blend-multiply dark:mix-blend-screen transition-all",i?"bg-gradient-to-l from-emerald-500 via-emerald-500/40 to-transparent":x?"bg-gradient-to-l from-rose-500 via-rose-500/40 to-transparent":"bg-gradient-to-l from-amber-400 via-amber-400/40 to-transparent")}),e.jsxs("div",{className:"flex items-center gap-2.5 relative z-10 w-full",children:[e.jsx("div",{className:u("w-9 h-9 rounded-full flex items-center justify-center font-black text-[12px] tracking-wide text-white flex-shrink-0 shadow-inner",i?"bg-[#34d399] dark:bg-[#15803d]":x?"bg-[#fb7185] dark:bg-[#be123c]":"bg-[#fbbf24] dark:bg-[#b45309]"),children:h}),e.jsxs("div",{className:"flex-grow min-w-0 flex flex-col justify-center",children:[e.jsxs("p",{className:"text-[13px] font-extrabold text-[#36326e] dark:text-[#e4e7f1] truncate leading-tight",children:["vs ",t.opponentName]}),e.jsxs("p",{className:"text-[10px] font-bold text-muted-foreground/60 dark:text-[#7f88a3] truncate flex items-center gap-1 mt-0.5",children:[t.subjectId," ",e.jsx("span",{className:"w-1 h-1 rounded-full bg-muted-foreground/30"})," ",t.difficulty||"Medium"," ",e.jsx("span",{className:"w-1 h-1 rounded-full bg-muted-foreground/30"})," ",t.rounds||"5"," rnds"]})]}),e.jsxs("div",{className:"text-right flex flex-col items-end justify-center pl-2 flex-shrink-0",children:[e.jsxs("p",{className:"tabular-nums text-[16px] leading-[1.1] font-black text-[#2e2b5e] dark:text-[#f5f7fb] tracking-tighter",children:[t.scoreFor,e.jsx("span",{className:"text-muted-foreground/40 mx-[1px]",children:"-"}),t.scoreAgainst]}),e.jsx("p",{className:u("text-[9px] font-black uppercase tracking-[0.1em]",i?"text-emerald-500 dark:text-emerald-400":x?"text-rose-500 dark:text-rose-400":"text-amber-500 dark:text-amber-400"),children:t.outcome})]})]})]},t.matchId)})]})]})]})]})},"hub")}),e.jsx(ue,{value:"setup",className:"mt-0 outline-none",children:e.jsxs(b.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},exit:{opacity:0,y:-12},className:"w-full space-y-6",children:[e.jsxs(b.div,{className:u(F,"relative overflow-hidden rounded-[24px] mb-6 shadow-lg",n.mode==="online"?"border-purple-500/20 shadow-[0_0_40px_-10px_rgba(138,63,211,0.2)]":"border-sky-500/20 shadow-[0_0_40px_-10px_rgba(31,167,225,0.2)]"),whileHover:{scale:1.01},transition:{type:"spring",stiffness:300,damping:20},children:[e.jsx("div",{className:u("pointer-events-none absolute inset-0 bg-gradient-to-r",n.mode==="online"?"from-purple-500/20 via-fuchsia-500/10 to-purple-600/5 dark:from-purple-500/20 dark:via-fuchsia-500/10 dark:to-purple-900/10":"from-sky-500/20 via-cyan-500/10 to-sky-600/5 dark:from-sky-500/20 dark:via-cyan-500/10 dark:to-sky-900/10")}),e.jsx(b.div,{className:u("pointer-events-none absolute -top-24 -right-24 h-64 w-64 rounded-full blur-3xl",n.mode==="online"?"bg-purple-400/20":"bg-sky-400/20"),animate:{scale:[1,1.2,1],opacity:[.3,.6,.3]},transition:{duration:5,repeat:1/0,ease:"easeInOut"}}),e.jsx(b.div,{className:u("pointer-events-none absolute -bottom-12 -left-12 h-40 w-40 rounded-full blur-2xl",n.mode==="online"?"bg-fuchsia-400/30":"bg-cyan-400/30"),animate:{scale:[1,1.3,1],opacity:[.2,.5,.2]},transition:{duration:4,repeat:1/0,ease:"easeInOut",delay:1.5}}),e.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0IiBoZWlnaHQ9IjQiPgo8cmVjdCB3aWR0aD0iNCIgaGVpZ2h0PSI0IiBmaWxsPSIjZmZmIiBmaWxsLW9wYWNpdHk9IjAiLz4KPHBhdGggZD0iTTAgMEgxdjFIMHoiIGZpbGw9IiM2MzY2ZjEiIGZpbGwtb3BhY2l0eT0iMC4wNSIvPgo8L3N2Zz4=')] opacity-30 dark:opacity-10 mix-blend-overlay"}),e.jsxs("div",{className:"relative p-6 sm:p-8 md:px-10 flex items-center gap-5 sm:gap-8 z-10",children:[e.jsx(A,{variant:"ghost",onClick:()=>l("hub"),className:u("h-12 w-12 sm:h-14 sm:w-14 p-0 rounded-full hover:scale-105 transition-all backdrop-blur-md shadow-lg shrink-0 flex items-center justify-center group",n.mode==="online"?"bg-white/50 dark:bg-black/40 hover:bg-white/80 dark:hover:bg-black/60 border border-purple-500/30":"bg-white/50 dark:bg-black/40 hover:bg-white/80 dark:hover:bg-black/60 border border-sky-500/30"),children:e.jsx(ze,{className:u("h-6 w-6 sm:h-8 sm:w-8 rotate-180 transition-transform group-hover:-translate-x-0.5",n.mode==="online"?"text-purple-800 dark:text-purple-300":"text-sky-800 dark:text-sky-300")})}),e.jsxs("div",{children:[e.jsxs("h2",{className:u("flex items-center gap-3 text-3xl sm:text-4xl font-black tracking-tight text-transparent bg-clip-text bg-gradient-to-br drop-shadow-sm",n.mode==="online"?"from-purple-600 to-fuchsia-500 dark:from-purple-300 dark:to-fuchsia-200":"from-sky-600 to-cyan-500 dark:from-sky-300 dark:to-cyan-200"),children:[e.jsx(b.div,{animate:{y:[-3,3,-3]},transition:{duration:3,repeat:1/0,ease:"easeInOut"},className:u("p-2 rounded-2xl shadow-inner border",n.mode==="online"?"bg-purple-100 dark:bg-purple-900/50 border-purple-200 dark:border-purple-700/50":"bg-sky-100 dark:bg-sky-900/50 border-sky-200 dark:border-sky-700/50"),children:n.mode==="online"?e.jsx(Be,{className:"h-8 w-8 text-purple-600 dark:text-purple-400 drop-shadow-[0_0_8px_rgba(138,63,211,0.5)]"}):e.jsx(ht,{className:"h-8 w-8 text-sky-600 dark:text-sky-400 drop-shadow-[0_0_8px_rgba(31,167,225,0.5)]"})}),n.mode==="online"?"1v1 Online":"1v1 vs Bot"]}),e.jsx("p",{className:u("text-[10px] sm:text-[12px] font-black uppercase tracking-[0.2em] mt-1.5 drop-shadow-sm",n.mode==="online"?"text-purple-600/80 dark:text-purple-400/80":"text-sky-600/80 dark:text-sky-400/80"),children:n.mode==="online"?"CHALLENGE YOUR SCHOOLMATES AND PROVE YOUR SKILLS.":"CHALLENGE THE AI AND SHARPEN YOUR SKILLS."})]})]})]}),e.jsx("div",{className:"rounded-[24px] border border-white/40 bg-white/85 dark:border-white/10 dark:bg-black/80 backdrop-blur-xl p-5 sm:p-7 shadow-xl",children:e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6 lg:gap-10",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-1.5 group",children:[e.jsx("label",{className:u("text-[11px] font-black uppercase tracking-[0.12em] ml-1",n.mode==="online"?"text-[#8A3FD3] dark:text-[#a35ceb]":"text-[#1FA7E1] dark:text-[#4bc1f2]"),children:"Category"}),e.jsxs(me,{value:n.subjectId,onValueChange:t=>f(i=>({...i,subjectId:t})),children:[e.jsx(xe,{className:u("rounded-xl h-11 border-white/20 bg-white/60 dark:bg-black/50 dark:border-white/10 transition-colors shadow-inner",n.mode==="online"?"hover:border-[#8A3FD3]/50":"hover:border-[#1FA7E1]/50",T("subjectId")&&"border-rose-400"),children:e.jsx(pe,{placeholder:"Select category"})}),e.jsx(he,{className:"rounded-xl backdrop-blur-xl bg-white/90 dark:bg-[#1a1f2e]/90",children:Z.map(t=>e.jsx(Q,{value:t.id,className:"rounded-lg",children:t.title},t.id))})]}),T("subjectId")&&e.jsx("p",{className:"text-xs text-destructive dark:text-rose-300 ml-1",children:T("subjectId")})]}),e.jsxs("div",{className:"space-y-1.5 group",children:[e.jsx("label",{className:u("text-[11px] font-black uppercase tracking-[0.12em] ml-1",n.mode==="online"?"text-[#8A3FD3] dark:text-[#a35ceb]":"text-[#1FA7E1] dark:text-[#4bc1f2]"),children:"Strand / Topic Group"}),e.jsxs(me,{value:n.topicId,onValueChange:t=>f(i=>({...i,topicId:t})),children:[e.jsx(xe,{className:u("rounded-xl h-11 border-white/20 bg-white/60 dark:bg-black/50 dark:border-white/10 transition-colors shadow-inner",n.mode==="online"?"hover:border-[#8A3FD3]/50":"hover:border-[#1FA7E1]/50",T("topicId")&&"border-rose-400"),children:e.jsx(pe,{placeholder:"Select topic group"})}),e.jsx(he,{className:"rounded-xl backdrop-blur-xl bg-white/90 dark:bg-[#1a1f2e]/90",children:$t.map(t=>e.jsx(Q,{value:t.value,className:"rounded-lg",children:t.label},t.value))})]}),T("topicId")&&e.jsx("p",{className:"text-xs text-destructive dark:text-rose-300 ml-1",children:T("topicId")})]}),e.jsxs("div",{className:"space-y-1.5 group",children:[e.jsx("label",{className:u("text-[11px] font-black uppercase tracking-[0.12em] ml-1",n.mode==="online"?"text-[#8A3FD3] dark:text-[#a35ceb]":"text-[#1FA7E1] dark:text-[#4bc1f2]"),children:n.mode==="online"?"Difficulty":"Bot Difficulty"}),e.jsxs(me,{value:n.mode==="bot"?n.adaptiveBot?"adaptive":n.botDifficulty:n.difficulty,onValueChange:t=>f(i=>i.mode==="bot"?{...i,botDifficulty:t,adaptiveBot:t==="adaptive"}:{...i,difficulty:t}),children:[e.jsx(xe,{className:u("rounded-xl h-11 border-white/20 bg-white/60 dark:bg-black/50 dark:border-white/10 transition-colors shadow-inner",n.mode==="online"?"hover:border-[#8A3FD3]/50":"hover:border-[#1FA7E1]/50"),children:e.jsx(pe,{})}),e.jsxs(he,{className:"rounded-xl backdrop-blur-xl bg-white/90 dark:bg-[#1a1f2e]/90",children:[e.jsx(Q,{value:"easy",className:"rounded-lg",children:"Easy"}),e.jsx(Q,{value:"medium",className:"rounded-lg",children:"Medium"}),e.jsx(Q,{value:"hard",className:"rounded-lg",children:"Hard"}),n.mode==="bot"&&e.jsx(Q,{value:"adaptive",className:"rounded-lg",children:"Adaptive"})]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-1.5 group",children:[e.jsx("label",{className:u("text-[10px] sm:text-[11px] font-black uppercase tracking-[0.12em] ml-1",n.mode==="online"?"text-[#8A3FD3] dark:text-[#a35ceb]":"text-[#1FA7E1] dark:text-[#4bc1f2]"),children:"Questions"}),e.jsxs(me,{value:String(n.rounds),onValueChange:t=>f(i=>({...i,rounds:Number(t)})),children:[e.jsx(xe,{className:u("rounded-xl h-11 border-white/20 bg-white/60 dark:bg-black/50 dark:border-white/10 transition-colors shadow-inner",n.mode==="online"?"hover:border-[#8A3FD3]/50":"hover:border-[#1FA7E1]/50",T("rounds")&&"border-rose-400"),children:e.jsx(pe,{})}),e.jsx(he,{className:"rounded-xl backdrop-blur-xl bg-white/90 dark:bg-[#1a1f2e]/90",children:[3,5,7,10,12,15].map(t=>e.jsx(Q,{value:String(t),className:"rounded-lg",children:t},t))})]}),T("rounds")&&e.jsx("p",{className:"text-xs text-destructive dark:text-rose-300 ml-1",children:T("rounds")})]}),e.jsxs("div",{className:"space-y-1.5 group",children:[e.jsx("label",{className:u("text-[10px] sm:text-[11px] font-black uppercase tracking-[0.12em] ml-1 line-clamp-1",n.mode==="online"?"text-[#8A3FD3] dark:text-[#a35ceb]":"text-[#1FA7E1] dark:text-[#4bc1f2]"),children:"Time / Q"}),e.jsxs(me,{value:String(n.timePerQuestionSec),onValueChange:t=>f(i=>({...i,timePerQuestionSec:Number(t)})),children:[e.jsx(xe,{className:u("rounded-xl h-11 border-white/20 bg-white/60 dark:bg-black/50 dark:border-white/10 transition-colors shadow-inner",n.mode==="online"?"hover:border-[#8A3FD3]/50":"hover:border-[#1FA7E1]/50",T("timePerQuestionSec")&&"border-rose-400"),children:e.jsx(pe,{})}),e.jsx(he,{className:"rounded-xl backdrop-blur-xl bg-white/90 dark:bg-[#1a1f2e]/90",children:[15,20,30,45,60,90].map(t=>e.jsxs(Q,{value:String(t),className:"rounded-lg",children:[t," sec"]},t))})]}),T("timePerQuestionSec")&&e.jsx("p",{className:"text-xs text-destructive dark:text-rose-300 ml-1",children:T("timePerQuestionSec")})]})]})]}),e.jsxs("div",{className:"flex flex-col justify-between space-y-6",children:[e.jsxs("div",{className:"space-y-5",children:[n.mode==="online"&&e.jsxs("div",{className:"space-y-3 rounded-2xl border border-[#8A3FD3]/20 bg-[#8A3FD3]/5 dark:border-[#8A3FD3]/20 p-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-[11px] font-black uppercase tracking-[0.12em] text-[#8A3FD3] dark:text-[#a35ceb] ml-1",children:"Online Match Type"}),e.jsx("div",{className:"grid grid-cols-2 gap-3",children:[{value:"public_matchmaking",label:"Public Queue"},{value:"private_room",label:"Private Room"}].map(t=>e.jsx(A,{type:"button",variant:n.queueType===t.value?"default":"outline",className:u("rounded-xl h-11 transition-all border-none font-bold text-xs",n.queueType===t.value?"bg-[#8A3FD3] hover:bg-[#7b35c0] text-white shadow-md shadow-[#8A3FD3]/30":"bg-white/50 hover:bg-white/80 dark:bg-black/30 dark:hover:bg-black/50 text-[#8A3FD3] dark:text-[#d3a8ff]"),onClick:()=>f(i=>({...i,queueType:t.value})),children:t.label},t.value))})]}),n.queueType==="private_room"&&e.jsxs(b.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},className:"pt-2 space-y-2",children:[e.jsx("label",{className:"text-[11px] font-black uppercase tracking-[0.12em] text-[#8A3FD3] dark:text-[#a35ceb] ml-1",children:"Room Code (optional)"}),e.jsx(ta,{value:I,onChange:t=>E(t.target.value.toUpperCase().replace(/[^A-Z0-9]/g,"").slice(0,6)),placeholder:"Leave blank to create a room",className:"rounded-xl h-12 text-center text-lg uppercase font-bold tracking-[0.25em] border-[#8A3FD3]/30 bg-white/80 dark:bg-black/50 dark:border-[#8A3FD3]/20 focus-visible:ring-[#8A3FD3]/50 shadow-inner",maxLength:6}),e.jsx("div",{className:"rounded-xl border border-[#8A3FD3]/30 bg-[#8A3FD3]/10 px-3 py-3 text-[12px] font-semibold text-[#6620a2] leading-snug dark:border-[#8A3FD3]/30 dark:bg-[#8A3FD3]/10 dark:text-[#d3a8ff]",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("label",{className:u("flex flex-col sm:flex-row sm:items-center justify-between rounded-[16px] border bg-white/50 p-4 transition-colors cursor-pointer shadow-sm dark:bg-black/50 group",n.mode==="online"?"border-[#8A3FD3]/20 hover:bg-[#8A3FD3]/5 dark:border-[#8A3FD3]/20 dark:hover:bg-[#8A3FD3]/10":"border-[#1FA7E1]/20 hover:bg-[#1FA7E1]/5 dark:border-[#1FA7E1]/20 dark:hover:bg-[#1FA7E1]/10"),children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:u("h-11 w-11 rounded-full flex items-center justify-center group-hover:scale-110 transition-transform",n.mode==="online"?"bg-[#8A3FD3]/10 text-[#8A3FD3] dark:text-[#c48bfc]":"bg-[#1FA7E1]/10 text-[#1FA7E1] dark:text-[#7ad8ff]"),children:ne?e.jsx(na,{className:"h-5 w-5"}):e.jsx(la,{className:"h-5 w-5 opacity-60"})}),e.jsxs("div",{className:"mb-3 sm:mb-0",children:[e.jsx("p",{className:"text-sm font-bold text-slate-800 dark:text-slate-200",children:"Battle Sounds"}),e.jsx("p",{className:"text-xs font-medium text-slate-500 dark:text-slate-400",children:"Cues for countdowns and results."})]})]}),e.jsx(ft,{checked:ne,onCheckedChange:Dt})]})]}),e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsxs("div",{"aria-live":"polite",className:"min-h-[24px] text-sm font-medium",children:[j.status==="queued"&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:u("inline-flex items-center gap-1 text-[13px] font-bold px-3 py-1.5 rounded-lg",n.mode==="online"?"text-[#8A3FD3] bg-[#8A3FD3]/10":"text-[#1FA7E1] bg-[#1FA7E1]/10"),children:j.message}),n.mode==="online"&&n.queueType==="private_room"&&m?.roomCode&&e.jsxs(A,{type:"button",variant:"outline",className:u("h-8 rounded-full border-emerald-500/50 bg-emerald-50 px-4 text-xs font-black uppercase tracking-[0.16em] text-emerald-900 shadow-sm hover:bg-emerald-100 hover:scale-105 transition-all dark:border-emerald-500/40 dark:bg-emerald-500/10 dark:text-emerald-300 dark:hover:bg-emerald-500/20",re===m.roomCode&&"scale-105 bg-emerald-200 dark:bg-emerald-500/30"),onClick:()=>void ct(m.roomCode),"aria-label":`Copy room code ${m.roomCode}`,children:[re===m.roomCode?e.jsx(yt,{className:"h-4 w-4"}):e.jsx(gt,{className:"h-4 w-4"}),m.roomCode]}),(B||pt)&&Ne>0&&e.jsxs("span",{className:u("inline-flex items-center gap-1.5 rounded-full px-3 py-1 text-xs font-bold animate-pulse",n.mode==="online"?"bg-[#8A3FD3]/10 text-[#8A3FD3]":"bg-[#1FA7E1]/10 text-[#1FA7E1]"),children:["Waiting ",Ta(Ne)]})]}),j.status==="error"&&e.jsx("span",{className:"inline-flex items-center gap-1.5 text-[13px] font-bold text-rose-600 dark:text-rose-400 bg-rose-50 dark:bg-rose-500/10 px-3 py-1.5 rounded-lg border border-rose-200 dark:border-rose-500/20",children:j.message}),j.status==="validating"&&e.jsxs("span",{className:u("inline-flex items-center gap-2 font-bold px-3 py-1.5 rounded-lg",n.mode==="online"?"text-[#8A3FD3] bg-[#8A3FD3]/10":"text-[#1FA7E1] bg-[#1FA7E1]/10"),children:[e.jsx(Ze,{className:"h-4 w-4 animate-spin"})," Validating..."]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[Wt&&e.jsx(A,{type:"button",variant:"outline",onClick:xt,disabled:j.status==="validating",className:"rounded-xl h-14 flex-1 sm:flex-none border-slate-300 hover:bg-slate-100 dark:border-slate-700 dark:hover:bg-slate-800 font-bold px-6",children:m?"Cancel room":"Leave queue"}),e.jsx(A,{type:"button",onClick:Ht,disabled:j.status==="validating"||B||pt,className:u("rounded-xl h-14 flex-1 px-8 font-black uppercase tracking-wide text-sm shadow-xl hover:scale-[1.02] active:scale-95 transition-all text-white border-0",n.mode==="online"?"bg-[#8A3FD3] hover:bg-[#7b35c0] shadow-[#8A3FD3]/40":"bg-[#1FA7E1] hover:bg-[#1a95c9] shadow-[#1FA7E1]/40"),children:j.status==="validating"?e.jsxs("span",{className:"inline-flex items-center gap-2",children:[e.jsx(Ze,{className:"h-5 w-5 animate-spin"})," Starting..."]}):n.mode==="online"&&n.queueType==="private_room"?I.trim()?"Join Room":"Create Room":"Start Battle"})]})]})]})]})})]},"setup")}),e.jsx(ue,{value:"battle",className:"mt-0 outline-none",children:e.jsx(b.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},exit:{opacity:0,y:-12},className:"space-y-4",children:o?e.jsxs(W,{className:u(F,"rounded-[18px]"),children:[e.jsxs(Y,{children:[e.jsxs(X,{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(Be,{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(se,{className:"text-muted-foreground dark:text-[#b2bad0]",children:o.status==="completed"?`Completed in ${o.totalRounds} rounds.`:o.status==="ready"?"Waiting for both players to confirm and start together.":`Round ${o.currentRound} of ${o.totalRounds}`}),St(o.lifecycle,r?.uid)&&e.jsx("p",{className:"text-xs font-medium text-muted-foreground dark:text-[#9aa4be]",children:St(o.lifecycle,r?.uid)})]}),e.jsxs(be,{className:"space-y-4",children:[o.status==="ready"&&e.jsxs("div",{className:"rounded-xl border border-border bg-muted/30 p-4 dark:border-[#2f3547] dark:bg-[#11151d] flex flex-col gap-3",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...":"Preparing match session..."}),e.jsx(A,{variant:"outline",size:"sm",className:"w-full text-rose-500 border-rose-200 hover:bg-rose-50 dark:border-rose-900 dark:hover:bg-rose-900/30",onClick:()=>{S(null),N(null),k(!1),p({status:"idle"}),l("setup")},children:"Force Cancel"})]}),o.status==="in_progress"&&o.currentQuestion&&e.jsxs(e.Fragment,{children:[e.jsx("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:[q,"s"]})]})}),e.jsx("p",{className:"text-lg font-bold text-foreground dark:text-[#f5f7fb]",children:o.currentQuestion.prompt}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:o.currentQuestion.choices.map((t,i)=>e.jsxs(A,{type:"button",variant:we===i?"default":"outline",onClick:()=>$(i),disabled:V||O,className:u("h-auto min-h-[48px] justify-start text-left font-medium px-4 py-3 rounded-xl whitespace-normal",we===i?"ring-2 ring-primary ring-offset-2 dark:ring-offset-[#0B0F19]":""),children:[e.jsxs("span",{className:"mr-2 font-semibold",children:[String.fromCharCode(65+i),"."]}),t]},i))}),e.jsx("div",{className:"flex justify-end",children:e.jsx(A,{type:"button",onClick:()=>void We(we),disabled:V||O,className:"rounded-xl",children:V?e.jsxs("span",{className:"inline-flex items-center gap-2",children:[e.jsx(Ze,{className:"h-4 w-4 animate-spin"})," Submitting..."]}):O?"Waiting for opponent...":"Lock Answer"})})]}),Se&&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: ",Se.studentCorrect?"Correct":"Incorrect"," · ",o.mode==="bot"?"Bot":"Opponent"," ",Se.botCorrect?"Correct":"Incorrect"]}),e.jsxs("p",{className:"text-xs text-muted-foreground dark:text-[#9aa4be]",children:["Correct option: ",String.fromCharCode(65+Se.correctOptionIndex)]})]}),o.status==="completed"&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:u("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(A,{type:"button",variant:"outline",onClick:()=>{N(null),k(!1),l("setup")},className:"rounded-xl",children:"Start New Match"}),o.mode==="bot"&&e.jsx(A,{type:"button",onClick:()=>void Ot(),disabled:V,className:"rounded-xl",children:"Rematch"})]})]})]})]}):m?e.jsxs(W,{className:u(F,"rounded-[18px]"),children:[e.jsxs(Y,{children:[e.jsxs(X,{className:"text-base flex items-center gap-2",children:[e.jsx(Be,{className:"h-4 w-4 text-primary dark:text-[#9e8fff]"}),"Private Room Lobby"]}),e.jsxs(se,{className:"text-muted-foreground dark:text-[#b2bad0]",children:["Room ",m.roomCode," · ",m.participantCount,"/2 students connected."]})]}),e.jsx(be,{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(A,{type:"button",variant:"outline",className:"h-8 rounded-lg",onClick:xt,disabled:j.status==="validating",children:"Cancel room"}),e.jsxs(A,{type:"button",variant:"outline",className:"h-8 rounded-lg",onClick:()=>void ct(m.roomCode),children:[re===m.roomCode?e.jsx(yt,{className:"h-4 w-4"}):e.jsx(gt,{className:"h-4 w-4"}),re===m.roomCode?"Copied":"Copy code"]})]})]})})]}):B?e.jsx(W,{className:u(F,"rounded-[18px]"),children:e.jsxs(Y,{children:[e.jsxs(X,{className:"text-base flex items-center gap-2",children:[e.jsx(Be,{className:"h-4 w-4 text-primary dark:text-[#9e8fff]"}),"Public Matchmaking"]}),e.jsx(se,{className:"text-muted-foreground dark:text-[#b2bad0]",children:"Searching for a student with the same setup..."})]})}):e.jsx(W,{className:u(F,"rounded-[18px]"),children:e.jsxs(Y,{children:[e.jsxs(X,{className:"text-base flex items-center gap-2",children:[e.jsx(Ue,{className:"h-4 w-4 text-primary dark:text-[#9e8fff]"}),"No active battle"]}),e.jsx(se,{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(ue,{value:"history",className:"mt-0 outline-none",children:e.jsxs(b.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},exit:{opacity:0,y:-12},className:"space-y-4",children:[e.jsxs(b.div,{className:u(F,"relative overflow-hidden rounded-[24px] mb-6 border-emerald-500/20 shadow-[0_0_40px_-10px_rgba(16,185,129,0.2)]"),whileHover:{scale:1.01},transition:{type:"spring",stiffness:300,damping:20},children:[e.jsx("div",{className:"pointer-events-none absolute inset-0 bg-gradient-to-r from-emerald-500/20 via-teal-500/10 to-emerald-600/5 dark:from-emerald-500/20 dark:via-teal-500/10 dark:to-teal-900/10"}),e.jsx(b.div,{className:"pointer-events-none absolute -top-24 -right-24 h-64 w-64 rounded-full bg-emerald-400/20 blur-3xl",animate:{scale:[1,1.2,1],opacity:[.3,.6,.3]},transition:{duration:4,repeat:1/0,ease:"easeInOut"}}),e.jsx(b.div,{className:"pointer-events-none absolute -bottom-12 -left-12 h-40 w-40 rounded-full bg-teal-400/20 blur-2xl",animate:{scale:[1,1.3,1],opacity:[.2,.5,.2]},transition:{duration:3,repeat:1/0,ease:"easeInOut",delay:1}}),e.jsx("div",{className:"relative z-10 p-6 sm:p-8 flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4",children:e.jsxs("div",{className:"flex items-center gap-5",children:[e.jsx(A,{variant:"ghost",onClick:()=>l("hub"),className:"h-12 w-12 p-0 rounded-full bg-white/50 dark:bg-black/40 hover:bg-white/80 dark:hover:bg-black/60 hover:scale-105 transition-all backdrop-blur-md border border-emerald-500/30 shadow-[0_0_15px_rgba(16,185,129,0.2)] shrink-0",children:e.jsx(ze,{className:"h-6 w-6 rotate-180 text-emerald-800 dark:text-emerald-300"})}),e.jsxs("div",{children:[e.jsxs("h2",{className:"flex items-center gap-3 text-3xl sm:text-4xl font-black tracking-tight text-transparent bg-clip-text bg-gradient-to-br from-emerald-600 to-teal-500 dark:from-emerald-300 dark:to-teal-200 drop-shadow-sm",children:[e.jsx(b.div,{animate:{rotate:[-5,5,-5]},transition:{duration:4,repeat:1/0,ease:"easeInOut"},className:"bg-emerald-100 dark:bg-emerald-900/50 p-2 rounded-2xl shadow-inner border border-emerald-200 dark:border-emerald-700/50",children:e.jsx(kt,{className:"h-8 w-8 text-emerald-600 dark:text-emerald-400 drop-shadow-[0_0_8px_rgba(16,185,129,0.5)]"})}),"Matches History"]}),e.jsx("p",{className:"text-sm font-bold text-emerald-800/80 dark:text-emerald-100/70 mt-2 tracking-wide uppercase",children:"Review your past duels and track your progress."})]})]})})]}),e.jsxs(W,{className:u(F,"rounded-[18px]"),children:[e.jsxs(Y,{children:[e.jsx(X,{className:"text-base",children:"Match History"}),e.jsx(se,{className:"text-muted-foreground dark:text-[#b2bad0]",children:"Your recent student battles only."})]}),e.jsxs(be,{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(A,{type:"button",variant:ie===t.value?"default":"outline",onClick:()=>Tt(t.value),className:"rounded-xl h-8 px-3",children:t.label},t.value))}),ot?e.jsxs("div",{className:"space-y-2",children:[e.jsx(te,{className:"h-12 w-full rounded-xl bg-muted dark:bg-[#2a3143]"}),e.jsx(te,{className:"h-12 w-full rounded-xl bg-muted dark:bg-[#2a3143]"})]}):Ie.length===0?e.jsx("p",{className:"text-sm text-muted-foreground dark:text-[#a8b2c9]",children:"No matches in this filter yet."}):Ie.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:u("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:Fa(t.outcome)})]},t.matchId))]})]})]},"history")}),e.jsx(ue,{value:"stats",className:"mt-0 outline-none",children:e.jsxs(b.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},exit:{opacity:0,y:-12},className:"space-y-4",children:[e.jsxs(b.div,{className:u(F,"relative overflow-hidden rounded-[24px] mb-6 border-indigo-500/20 shadow-[0_0_40px_-10px_rgba(99,102,241,0.2)]"),whileHover:{scale:1.01},transition:{type:"spring",stiffness:300,damping:20},children:[e.jsx("div",{className:"pointer-events-none absolute inset-0 bg-gradient-to-r from-indigo-500/20 via-purple-500/10 to-indigo-600/5 dark:from-indigo-500/20 dark:via-purple-500/10 dark:to-purple-900/10"}),e.jsx(b.div,{className:"pointer-events-none absolute -top-24 -right-24 h-64 w-64 rounded-full bg-indigo-400/20 blur-3xl",animate:{scale:[1,1.2,1],opacity:[.3,.6,.3]},transition:{duration:5,repeat:1/0,ease:"easeInOut"}}),e.jsx(b.div,{className:"pointer-events-none absolute -bottom-12 -left-12 h-40 w-40 rounded-full bg-purple-400/20 blur-2xl",animate:{scale:[1,1.3,1],opacity:[.2,.5,.2]},transition:{duration:4,repeat:1/0,ease:"easeInOut",delay:1.5}}),e.jsx("div",{className:"relative z-10 p-6 sm:p-8 flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4",children:e.jsxs("div",{className:"flex items-center gap-5",children:[e.jsx(A,{variant:"ghost",onClick:()=>l("hub"),className:"h-12 w-12 p-0 rounded-full bg-white/50 dark:bg-black/40 hover:bg-white/80 dark:hover:bg-black/60 hover:scale-105 transition-all backdrop-blur-md border border-indigo-500/30 shadow-[0_0_15px_rgba(99,102,241,0.2)] shrink-0",children:e.jsx(ze,{className:"h-6 w-6 rotate-180 text-indigo-800 dark:text-indigo-300"})}),e.jsxs("div",{children:[e.jsxs("h2",{className:"flex items-center gap-3 text-3xl sm:text-4xl font-black tracking-tight text-transparent bg-clip-text bg-gradient-to-br from-indigo-600 to-purple-500 dark:from-indigo-300 dark:to-purple-200 drop-shadow-sm",children:[e.jsx(b.div,{animate:{y:[-3,3,-3]},transition:{duration:3,repeat:1/0,ease:"easeInOut"},className:"bg-indigo-100 dark:bg-indigo-900/50 p-2 rounded-2xl shadow-inner border border-indigo-200 dark:border-indigo-700/50",children:e.jsx(wt,{className:"h-8 w-8 text-indigo-600 dark:text-indigo-400 drop-shadow-[0_0_8px_rgba(99,102,241,0.5)]"})}),"My Statistics"]}),e.jsx("p",{className:"text-sm font-bold text-indigo-800/80 dark:text-indigo-100/70 mt-2 tracking-wide uppercase",children:"Analyzing your battlefield performance."})]})]})})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-4 gap-4",children:[{label:"Wins",value:L?.wins??0,icon:Ge},{label:"Current streak",value:L?.currentStreak??0,icon:vt},{label:"Avg accuracy",value:`${(L?.averageAccuracy||0).toFixed(1)}%`,icon:aa},{label:"Avg response",value:Ea(L?.averageResponseMs||0),icon:jt}].map(t=>e.jsx(W,{className:u(F,"rounded-[18px]"),children:e.jsxs(be,{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(ue,{value:"leaderboard",className:"mt-0 outline-none",children:e.jsxs(b.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},exit:{opacity:0,y:-12},className:"space-y-4",children:[e.jsxs(b.div,{className:u(F,"relative overflow-hidden rounded-[24px] mb-6 border-amber-500/20 shadow-[0_0_40px_-10px_rgba(245,158,11,0.2)]"),whileHover:{scale:1.01},transition:{type:"spring",stiffness:300,damping:20},children:[e.jsx("div",{className:"pointer-events-none absolute inset-0 bg-gradient-to-r from-amber-500/20 via-orange-500/10 to-amber-600/5 dark:from-amber-600/20 dark:via-orange-500/10 dark:to-orange-900/10"}),e.jsx(b.div,{className:"pointer-events-none absolute -top-24 -right-24 h-64 w-64 rounded-full bg-amber-400/20 blur-3xl",animate:{scale:[1,1.2,1],opacity:[.3,.6,.3]},transition:{duration:4.5,repeat:1/0,ease:"easeInOut"}}),e.jsx(b.div,{className:"pointer-events-none absolute -bottom-12 -left-12 h-40 w-40 rounded-full bg-orange-400/20 blur-2xl",animate:{scale:[1,1.3,1],opacity:[.2,.5,.2]},transition:{duration:3.5,repeat:1/0,ease:"easeInOut",delay:.5}}),e.jsx("div",{className:"relative z-10 p-6 sm:p-8 flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4",children:e.jsxs("div",{className:"flex items-center gap-5",children:[e.jsx(A,{variant:"ghost",onClick:()=>l("hub"),className:"h-12 w-12 p-0 rounded-full bg-white/50 dark:bg-black/40 hover:bg-white/80 dark:hover:bg-black/60 hover:scale-105 transition-all backdrop-blur-md border border-amber-500/30 shadow-[0_0_15px_rgba(245,158,11,0.2)] shrink-0",children:e.jsx(ze,{className:"h-6 w-6 rotate-180 text-amber-800 dark:text-amber-300"})}),e.jsxs("div",{children:[e.jsxs("h2",{className:"flex items-center gap-3 text-3xl sm:text-4xl font-black tracking-tight text-transparent bg-clip-text bg-gradient-to-br from-amber-600 to-orange-500 dark:from-amber-300 dark:to-orange-200 drop-shadow-sm",children:[e.jsx(b.div,{animate:{scale:[1,1.1,1]},transition:{duration:2,repeat:1/0,ease:"easeInOut"},className:"bg-amber-100 dark:bg-amber-900/50 p-2 rounded-2xl shadow-inner border border-amber-200 dark:border-amber-700/50",children:e.jsx(Ge,{className:"h-8 w-8 text-amber-600 dark:text-amber-400 drop-shadow-[0_0_12px_rgba(245,158,11,0.6)]"})}),"Hall of Fame"]}),e.jsx("p",{className:"text-sm font-bold text-amber-800/80 dark:text-amber-100/70 mt-2 tracking-wide uppercase",children:"The top-ranked minds across the globe."})]})]})})]}),e.jsxs(W,{className:u(F,"rounded-[18px]"),children:[e.jsxs(Y,{children:[e.jsxs(X,{className:"text-base flex items-center gap-2",children:[e.jsx(Gt,{className:"h-4 w-4 text-primary dark:text-[#9e8fff]"})," Hall of Fame"]}),e.jsx(se,{className:"text-muted-foreground dark:text-[#b2bad0]",children:"Student-only ranking using trusted backend aggregates."})]}),e.jsx(be,{children:qt?e.jsxs("div",{className:"space-y-2",children:[e.jsx(te,{className:"h-12 w-full rounded-xl bg-muted dark:bg-[#2a3143]"}),e.jsx(te,{className:"h-12 w-full rounded-xl bg-muted dark:bg-[#2a3143]"}),e.jsx(te,{className:"h-12 w-full rounded-xl bg-muted dark:bg-[#2a3143]"})]}):ut.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(me,{value:_e,onValueChange:t=>Pt(t),children:[e.jsx(xe,{className:"mt-1 h-8 rounded-lg",children:e.jsx(pe,{})}),e.jsxs(he,{children:[e.jsx(Q,{value:"alias",children:"Alias"}),e.jsx(Q,{value:"initials",children:"Initials"}),e.jsx(Q,{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(ft,{checked:Oe,onCheckedChange:Lt})]})]}),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."}),ut.map(t=>e.jsxs("div",{className:u("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{hs as default}; diff --git a/assets/RewardsModal-BAC0Ze0K.js b/assets/RewardsModal-CsH4qI6T.js similarity index 94% rename from assets/RewardsModal-BAC0Ze0K.js rename to assets/RewardsModal-CsH4qI6T.js index 822791a88d1817a4d346821bf2a1a74d39a9a1cc..eab47d41f7ecb5809213790dcd38e5d917f823ec 100644 --- a/assets/RewardsModal-BAC0Ze0K.js +++ b/assets/RewardsModal-CsH4qI6T.js @@ -1 +1 @@ -import{j as e}from"./vendor-react-Dexh7fmo.js";import{X as h}from"./x-D3HMN9wJ.js";import{l as o,F as d,Z as f}from"./index-CYVpLr_P.js";import{S as n}from"./star-BOFYd7BG.js";import{T as g}from"./trophy-GpbJF7pP.js";import{T as j}from"./target-GUh8ebLY.js";import{B as u}from"./book-open-BGS5Zqps.js";import{A as N}from"./award-C5AZ3Rkn.js";import{C as v}from"./calendar-DsAM31pV.js";import{U as w}from"./users-CQJB3ZBq.js";import{T as y}from"./trending-up-CqFD_DPI.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-firestore-CkuVbeP5.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}; +import{j as e}from"./vendor-react-Dexh7fmo.js";import{X as h}from"./x-CWNywLHU.js";import{l as o,F as d,Z as f}from"./index-LyKgWktA.js";import{S as n}from"./star-BbJSm_XE.js";import{T as g}from"./trophy-vkFq3hpl.js";import{T as j}from"./target-CX3SjMvf.js";import{B as u}from"./book-open-BRafwRDJ.js";import{A as N}from"./award-BQb3QdnO.js";import{C as v}from"./calendar-cirmK6YZ.js";import{U as w}from"./users-CRaf-j4K.js";import{T as y}from"./trending-up-DwhUzSCD.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-firestore-CkuVbeP5.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}; diff --git a/assets/RightSidebar-BHJnYOaW.js b/assets/RightSidebar-c9BUk44H.js similarity index 98% rename from assets/RightSidebar-BHJnYOaW.js rename to assets/RightSidebar-c9BUk44H.js index bc62d783d6ac80ae2b9aa4e52b3f444a79fa6860..2cc60e94fcccafceec1bf5282ed28736e908d7b0 100644 --- a/assets/RightSidebar-BHJnYOaW.js +++ b/assets/RightSidebar-c9BUk44H.js @@ -1 +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,l as x}from"./index-CYVpLr_P.js";import{C as v}from"./circle-check-big-SmheLDZz.js";import{T as j,a as w,b as N}from"./tooltip-DqqE-4Wr.js";import{T as y}from"./trophy-GpbJF7pP.js";import{C as h}from"./chevron-right-XRktHzwa.js";import{S as C}from"./star-BOFYd7BG.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-firestore-CkuVbeP5.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";import"./vendor-radix-cHXhEj3X.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}; +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,l as x}from"./index-LyKgWktA.js";import{C as v}from"./circle-check-big-Dj73d5Jk.js";import{T as j,a as w,b as N}from"./tooltip-DqqE-4Wr.js";import{T as y}from"./trophy-vkFq3hpl.js";import{C as h}from"./chevron-right-OeSCfsNc.js";import{S as C}from"./star-BbJSm_XE.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-firestore-CkuVbeP5.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";import"./vendor-radix-cHXhEj3X.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}; diff --git a/assets/ScientificCalculator-vQs43GTt.js b/assets/ScientificCalculator-Do4eNBdw.js similarity index 99% rename from assets/ScientificCalculator-vQs43GTt.js rename to assets/ScientificCalculator-Do4eNBdw.js index 58d96cb035edf2c76d5bca75afae9a7d43d1d5b5..5c116955fa13cdfeda58fa27c8493487aee860af 100644 --- a/assets/ScientificCalculator-vQs43GTt.js +++ b/assets/ScientificCalculator-Do4eNBdw.js @@ -1,4 +1,4 @@ -import{r as c,j as e}from"./vendor-react-Dexh7fmo.js";import{apiService as de}from"./apiService-DnEZVkU5.js";import{c as Z,e as U,m as ue}from"./index-CYVpLr_P.js";import{C as fe,a as pe}from"./chevron-up-z_1tCiMP.js";import{X as be}from"./x-D3HMN9wJ.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-firestore-CkuVbeP5.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";/** +import{r as c,j as e}from"./vendor-react-Dexh7fmo.js";import{apiService as de}from"./apiService-BmjkaPHy.js";import{c as Z,e as U,m as ue}from"./index-LyKgWktA.js";import{C as fe,a as pe}from"./chevron-up-CmF1G4Yx.js";import{X as be}from"./x-CWNywLHU.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-firestore-CkuVbeP5.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/SearchBar-C7pZQ20f.js b/assets/SearchBar-KL-CbGtm.js similarity index 93% rename from assets/SearchBar-C7pZQ20f.js rename to assets/SearchBar-KL-CbGtm.js index 1507ff9a21855e19833329f7742ff326d030fd05..6b74e2a7a05242b55922a20dcffc5b7fe21dcc01 100644 --- a/assets/SearchBar-C7pZQ20f.js +++ b/assets/SearchBar-KL-CbGtm.js @@ -1 +1 @@ -import{r as o,j as e}from"./vendor-react-Dexh7fmo.js";import{S as m}from"./search-CwICt96b.js";import{m as n,e as C}from"./index-CYVpLr_P.js";import{X as k}from"./x-D3HMN9wJ.js";import{C as S}from"./clock-Cb5jwJte.js";import{B as a}from"./book-open-BGS5Zqps.js";import{T as c}from"./trending-up-CqFD_DPI.js";import{U as d}from"./users-CQJB3ZBq.js";import{G}from"./graduation-cap-BAW4sid0.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-firestore-CkuVbeP5.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}; +import{r as o,j as e}from"./vendor-react-Dexh7fmo.js";import{S as m}from"./search-B1VJAO7p.js";import{m as n,e as C}from"./index-LyKgWktA.js";import{X as k}from"./x-CWNywLHU.js";import{C as S}from"./clock-8WaO5Ocs.js";import{B as a}from"./book-open-BRafwRDJ.js";import{T as c}from"./trending-up-DwhUzSCD.js";import{U as d}from"./users-CRaf-j4K.js";import{G}from"./graduation-cap-BajVF1yD.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-firestore-CkuVbeP5.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}; diff --git a/assets/SettingsModal-ta9Wy9X1.js b/assets/SettingsModal-BnULUpJH.js similarity index 97% rename from assets/SettingsModal-ta9Wy9X1.js rename to assets/SettingsModal-BnULUpJH.js index daab5b897f655eb6a10f8675e2c2c36a7327fa66..ca4620c3b61447d029690a2604a043a13e2d0035 100644 --- a/assets/SettingsModal-ta9Wy9X1.js +++ b/assets/SettingsModal-BnULUpJH.js @@ -1,4 +1,4 @@ -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-CYVpLr_P.js";import{B as x}from"./button-CwNFy6cp.js";import{I as l}from"./input-DBkKXOmF.js";import{S as m}from"./switch-aCsENXi7.js";import W from"./ConfirmModal-HuY-9h87.js";import{U as fe}from"./user-D-TTwp40.js";import{B as pe}from"./bell-BQMual5k.js";import{S as ye}from"./shield-B_6hUGZX.js";import{G as je}from"./globe-D6NgA4sZ.js";import{D as Y}from"./download-i6ku6i1B.js";import{X as Z}from"./x-D3HMN9wJ.js";import{L as ge}from"./lock-COR_g_Qg.js";import{C as Ne}from"./clock-Cb5jwJte.js";import{T as ve}from"./trash-2-D383W6Gx.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-firestore-CkuVbeP5.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";import"./vendor-radix-cHXhEj3X.js";import"./clsx-B-dksMZM.js";import"./utils-BQQgILNW.js";import"./log-out-B4zHGAON.js";/** +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-LyKgWktA.js";import{B as x}from"./button-CwNFy6cp.js";import{I as l}from"./input-DBkKXOmF.js";import{S as m}from"./switch-aCsENXi7.js";import W from"./ConfirmModal-FyItBILR.js";import{U as fe}from"./user-BZgiUM6h.js";import{B as pe}from"./bell-EBkVBtCr.js";import{S as ye}from"./shield-CcOzg2El.js";import{G as je}from"./globe-CNqTHI-4.js";import{D as Y}from"./download-DGfKThZf.js";import{X as Z}from"./x-CWNywLHU.js";import{L as ge}from"./lock-DeaK7IhY.js";import{C as Ne}from"./clock-8WaO5Ocs.js";import{T as ve}from"./trash-2-CSbIpBBo.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-firestore-CkuVbeP5.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";import"./vendor-radix-cHXhEj3X.js";import"./clsx-B-dksMZM.js";import"./utils-BQQgILNW.js";import"./log-out-CI4drKBP.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/Sidebar-CLDaRLyZ.js b/assets/Sidebar-HVTXyPGL.js similarity index 89% rename from assets/Sidebar-CLDaRLyZ.js rename to assets/Sidebar-HVTXyPGL.js index 5e9b75951775e5e91ab1e9aef8f60c92860b427c..8c4362ecaa0f027b9f31524862a3361bba0a4a0e 100644 --- a/assets/Sidebar-CLDaRLyZ.js +++ b/assets/Sidebar-HVTXyPGL.js @@ -1 +1 @@ -import{r as b,j as e}from"./vendor-react-Dexh7fmo.js";import{C as I,S as B,a as O,L as x}from"./LogoutActionButton-CCToMg4l.js";import{c as $}from"./utils-BQQgILNW.js";import{T as w,a as N,b as S}from"./tooltip-DqqE-4Wr.js";import{m as c}from"./index-CYVpLr_P.js";import{X as D}from"./x-D3HMN9wJ.js";import{C as G}from"./chevron-right-XRktHzwa.js";import{U as k}from"./users-CQJB3ZBq.js";import{B as h}from"./book-open-BGS5Zqps.js";import{C as L}from"./chart-column-sGYNY-cm.js";import{S as P}from"./shield-B_6hUGZX.js";import{M as U}from"./message-square-c-O8e9VO.js";import{G as F}from"./graduation-cap-BAW4sid0.js";import{S as Q}from"./swords-C8YOZegm.js";import{T as W}from"./trophy-GpbJF7pP.js";import{S as X}from"./shirt-D--nDwDf.js";import"./log-out-B4zHGAON.js";import"./clsx-B-dksMZM.js";import"./vendor-radix-cHXhEj3X.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-firestore-CkuVbeP5.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";const ue=({activeTab:m,setActiveTab:M,userRole:f="student",onOpenSettings:C,onLogout:u,sidebarCollapsed:o=!1,setSidebarCollapsed:g,mode:T="desktop",onRequestClose:j,forceCollapsed:i=!1})=>{const[A,p]=b.useState(!1),[v,t]=b.useState(null),r=T==="mobile",n=!i&&A,a=!r&&(i||o&&!n),l=a,E=!r&&!i;b.useEffect(()=>{i&&(p(!1),t(null))},[i]),b.useEffect(()=>{l||t(null)},[l]);const z=f==="admin"?[{label:"Management",items:[{icon:x,label:"Overview"},{icon:k,label:"User Management"},{icon:h,label:"Content"}]},{label:"Insights",items:[{icon:L,label:"Analytics"},{icon:P,label:"Audit Log"}]}]:f==="teacher"?[{label:"Teaching",items:[{icon:x,label:"Dashboard"},{icon:k,label:"My Students"},{icon:h,label:"Classes"}]},{label:"Insights",items:[{icon:L,label:"Analytics"}]}]:[{label:"Learn",items:[{icon:x,label:"Dashboard"},{icon:h,label:"Modules"},{icon:U,label:"AI Chat"}]},{label:"Progress",items:[{icon:F,label:"Grades",displayLabel:"Assessment"},{icon:Q,label:"Quiz Battle",displayLabel:"Quiz Battle"},{icon:W,label:"Leaderboard",displayLabel:"Leadership Board"}]},{label:"Customization",items:[{icon:X,label:"Avatar Studio",displayLabel:"Avatar Studio"}]}];return e.jsxs(c.aside,{initial:!1,animate:r?{width:280}:{width:a?80:280},transition:{type:"spring",stiffness:360,damping:34},onMouseEnter:()=>E&&o&&p(!0),onMouseLeave:()=>{p(!1),t(null)},className:$("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 ${a?"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"}),(!a||n)&&e.jsx("div",{children:e.jsx("h2",{className:"text-base font-bold font-display text-[#0a1628] whitespace-nowrap",children:"MathPulse AI"})})]}),r&&j&&e.jsx("button",{onClick:j,className:"p-2 hover:bg-[#dde3eb] rounded-lg transition-colors text-[#5a6578]","aria-label":"Close navigation",children:e.jsx(D,{size:20})}),!r&&!i&&g&&(!o||n)&&e.jsx(c.button,{whileHover:{scale:1.1},whileTap:{scale:.95},onClick:()=>g(!o),className:"p-2 hover:bg-[#dde3eb] rounded-lg transition-colors text-[#5a6578]","aria-label":o?"Expand sidebar":"Collapse sidebar",title:o?"Expand sidebar":"Collapse sidebar",children:o?e.jsx(G,{size:20}):e.jsx(I,{size:20})})]}),e.jsx("nav",{className:"flex-1 min-h-0 overflow-y-auto space-y-5 pr-1",children:z.map((d,H)=>e.jsxs("div",{children:[a?e.jsx("div",{className:"px-4 mb-2 flex items-center gap-2",children:e.jsx("div",{className:"flex-1 h-[1px] bg-[#dde3eb]"})}):d.label&&e.jsx("p",{className:"px-4 mb-2 text-[10px] font-bold text-[#5a6578] uppercase tracking-widest",children:d.label}),e.jsx("div",{className:"space-y-1",children:d.items.map(s=>e.jsxs(w,{open:l&&v===s.label,children:[e.jsx(N,{asChild:!0,children:e.jsxs(c.button,{whileHover:{x:2},whileTap:{scale:.98},onMouseEnter:()=>{l&&t(s.label)},onMouseLeave:()=>{t(y=>y===s.label?null:y)},onFocus:()=>t(null),onClick:()=>M(s.label),className:`w-full flex items-center gap-3 px-4 py-3 rounded-2xl cursor-pointer transition-all duration-200 border whitespace-nowrap ${a?"justify-center":""} ${m===s.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(s.icon,{size:18,strokeWidth:m===s.label?2.5:2,className:"flex-shrink-0"}),(!a||n)&&e.jsx("span",{className:"font-body font-bold text-xs",children:s.displayLabel||s.label}),m===s.label&&(!a||n)&&e.jsx(c.div,{layoutId:"sidebar-active-indicator",className:"ml-auto w-2 h-2 rounded-full bg-sky-500",transition:{type:"spring",duration:.4}})]})}),l&&e.jsx(S,{side:"right",sideOffset:16,className:"font-bold text-xs",children:s.displayLabel||s.label})]},s.label))})]},H))})]}),e.jsxs("div",{className:"mt-4 space-y-2 border-t border-[#dde3eb] pt-4",children:[e.jsxs(w,{open:l&&v==="Settings",children:[e.jsx(N,{asChild:!0,children:e.jsxs(c.button,{whileHover:{x:2},whileTap:{scale:.98},onMouseEnter:()=>{l&&t("Settings")},onMouseLeave:()=>{t(d=>d==="Settings"?null:d)},onFocus:()=>t(null),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 ${a?"justify-center":""}`,onClick:C,children:[e.jsx(B,{size:18,strokeWidth:2,className:"flex-shrink-0"}),(!a||n)&&e.jsx("span",{className:"font-body text-xs",children:"Settings"})]})}),l&&e.jsx(S,{side:"right",sideOffset:16,className:"font-bold text-xs",children:"Settings"})]}),u&&e.jsx("div",{className:"text-[#5a6578]",children:e.jsx(O,{onClick:u,collapsed:a})})]})]})};export{ue as default}; +import{r as b,j as e}from"./vendor-react-Dexh7fmo.js";import{C as I,S as B,a as O,L as x}from"./LogoutActionButton-ggTmlIBR.js";import{c as $}from"./utils-BQQgILNW.js";import{T as w,a as N,b as S}from"./tooltip-DqqE-4Wr.js";import{m as c}from"./index-LyKgWktA.js";import{X as D}from"./x-CWNywLHU.js";import{C as G}from"./chevron-right-OeSCfsNc.js";import{U as k}from"./users-CRaf-j4K.js";import{B as h}from"./book-open-BRafwRDJ.js";import{C as L}from"./chart-column-CAJHtHZ_.js";import{S as P}from"./shield-CcOzg2El.js";import{M as U}from"./message-square-cJcev-mA.js";import{G as F}from"./graduation-cap-BajVF1yD.js";import{S as Q}from"./swords-DBnIhbCe.js";import{T as W}from"./trophy-vkFq3hpl.js";import{S as X}from"./shirt-PgcFQo2K.js";import"./log-out-CI4drKBP.js";import"./clsx-B-dksMZM.js";import"./vendor-radix-cHXhEj3X.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-firestore-CkuVbeP5.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";const ue=({activeTab:m,setActiveTab:M,userRole:f="student",onOpenSettings:C,onLogout:u,sidebarCollapsed:o=!1,setSidebarCollapsed:g,mode:T="desktop",onRequestClose:j,forceCollapsed:i=!1})=>{const[A,p]=b.useState(!1),[v,t]=b.useState(null),r=T==="mobile",n=!i&&A,a=!r&&(i||o&&!n),l=a,E=!r&&!i;b.useEffect(()=>{i&&(p(!1),t(null))},[i]),b.useEffect(()=>{l||t(null)},[l]);const z=f==="admin"?[{label:"Management",items:[{icon:x,label:"Overview"},{icon:k,label:"User Management"},{icon:h,label:"Content"}]},{label:"Insights",items:[{icon:L,label:"Analytics"},{icon:P,label:"Audit Log"}]}]:f==="teacher"?[{label:"Teaching",items:[{icon:x,label:"Dashboard"},{icon:k,label:"My Students"},{icon:h,label:"Classes"}]},{label:"Insights",items:[{icon:L,label:"Analytics"}]}]:[{label:"Learn",items:[{icon:x,label:"Dashboard"},{icon:h,label:"Modules"},{icon:U,label:"AI Chat"}]},{label:"Progress",items:[{icon:F,label:"Grades",displayLabel:"Assessment"},{icon:Q,label:"Quiz Battle",displayLabel:"Quiz Battle"},{icon:W,label:"Leaderboard",displayLabel:"Leadership Board"}]},{label:"Customization",items:[{icon:X,label:"Avatar Studio",displayLabel:"Avatar Studio"}]}];return e.jsxs(c.aside,{initial:!1,animate:r?{width:280}:{width:a?80:280},transition:{type:"spring",stiffness:360,damping:34},onMouseEnter:()=>E&&o&&p(!0),onMouseLeave:()=>{p(!1),t(null)},className:$("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 ${a?"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"}),(!a||n)&&e.jsx("div",{children:e.jsx("h2",{className:"text-base font-bold font-display text-[#0a1628] whitespace-nowrap",children:"MathPulse AI"})})]}),r&&j&&e.jsx("button",{onClick:j,className:"p-2 hover:bg-[#dde3eb] rounded-lg transition-colors text-[#5a6578]","aria-label":"Close navigation",children:e.jsx(D,{size:20})}),!r&&!i&&g&&(!o||n)&&e.jsx(c.button,{whileHover:{scale:1.1},whileTap:{scale:.95},onClick:()=>g(!o),className:"p-2 hover:bg-[#dde3eb] rounded-lg transition-colors text-[#5a6578]","aria-label":o?"Expand sidebar":"Collapse sidebar",title:o?"Expand sidebar":"Collapse sidebar",children:o?e.jsx(G,{size:20}):e.jsx(I,{size:20})})]}),e.jsx("nav",{className:"flex-1 min-h-0 overflow-y-auto space-y-5 pr-1",children:z.map((d,H)=>e.jsxs("div",{children:[a?e.jsx("div",{className:"px-4 mb-2 flex items-center gap-2",children:e.jsx("div",{className:"flex-1 h-[1px] bg-[#dde3eb]"})}):d.label&&e.jsx("p",{className:"px-4 mb-2 text-[10px] font-bold text-[#5a6578] uppercase tracking-widest",children:d.label}),e.jsx("div",{className:"space-y-1",children:d.items.map(s=>e.jsxs(w,{open:l&&v===s.label,children:[e.jsx(N,{asChild:!0,children:e.jsxs(c.button,{whileHover:{x:2},whileTap:{scale:.98},onMouseEnter:()=>{l&&t(s.label)},onMouseLeave:()=>{t(y=>y===s.label?null:y)},onFocus:()=>t(null),onClick:()=>M(s.label),className:`w-full flex items-center gap-3 px-4 py-3 rounded-2xl cursor-pointer transition-all duration-200 border whitespace-nowrap ${a?"justify-center":""} ${m===s.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(s.icon,{size:18,strokeWidth:m===s.label?2.5:2,className:"flex-shrink-0"}),(!a||n)&&e.jsx("span",{className:"font-body font-bold text-xs",children:s.displayLabel||s.label}),m===s.label&&(!a||n)&&e.jsx(c.div,{layoutId:"sidebar-active-indicator",className:"ml-auto w-2 h-2 rounded-full bg-sky-500",transition:{type:"spring",duration:.4}})]})}),l&&e.jsx(S,{side:"right",sideOffset:16,className:"font-bold text-xs",children:s.displayLabel||s.label})]},s.label))})]},H))})]}),e.jsxs("div",{className:"mt-4 space-y-2 border-t border-[#dde3eb] pt-4",children:[e.jsxs(w,{open:l&&v==="Settings",children:[e.jsx(N,{asChild:!0,children:e.jsxs(c.button,{whileHover:{x:2},whileTap:{scale:.98},onMouseEnter:()=>{l&&t("Settings")},onMouseLeave:()=>{t(d=>d==="Settings"?null:d)},onFocus:()=>t(null),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 ${a?"justify-center":""}`,onClick:C,children:[e.jsx(B,{size:18,strokeWidth:2,className:"flex-shrink-0"}),(!a||n)&&e.jsx("span",{className:"font-body text-xs",children:"Settings"})]})}),l&&e.jsx(S,{side:"right",sideOffset:16,className:"font-bold text-xs",children:"Settings"})]}),u&&e.jsx("div",{className:"text-[#5a6578]",children:e.jsx(O,{onClick:u,collapsed:a})})]})]})};export{ue as default}; diff --git a/assets/SupplementalBanner-DTd5-XUw.js b/assets/SupplementalBanner-DIN86DZO.js similarity index 95% rename from assets/SupplementalBanner-DTd5-XUw.js rename to assets/SupplementalBanner-DIN86DZO.js index a61757d5b5e3218081da815a386a3ae00eb59bc5..a893dd90835ec2cd8deab9f5194658ab6d3a106e 100644 --- a/assets/SupplementalBanner-DTd5-XUw.js +++ b/assets/SupplementalBanner-DIN86DZO.js @@ -1 +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-CYVpLr_P.js";import{X as v}from"./x-D3HMN9wJ.js";import{S as w}from"./sparkles-DCodfP-i.js";import{C as f}from"./chevron-right-XRktHzwa.js";import{B as g}from"./book-open-BGS5Zqps.js";import{T as m}from"./trending-up-CqFD_DPI.js";import{B as x}from"./brain-D0hS_0wy.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-firestore-CkuVbeP5.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}; +import{j as e,r as y}from"./vendor-react-Dexh7fmo.js";import{e as j,m as p,T as h}from"./index-LyKgWktA.js";import{X as v}from"./x-CWNywLHU.js";import{S as w}from"./sparkles-D-fzJUWE.js";import{C as f}from"./chevron-right-OeSCfsNc.js";import{B as g}from"./book-open-BRafwRDJ.js";import{T as m}from"./trending-up-DwhUzSCD.js";import{B as x}from"./brain-19xpRLO9.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-firestore-CkuVbeP5.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}; diff --git a/assets/TeacherDashboard-CLV58fUE.js b/assets/TeacherDashboard-CTQJuBtl.js similarity index 99% rename from assets/TeacherDashboard-CLV58fUE.js rename to assets/TeacherDashboard-CTQJuBtl.js index 1dda2fe9733a715cc7c6932d50057abd11bb383a..6667308cb9901663d328f6ecf3ab6ae6febe2eaa 100644 --- a/assets/TeacherDashboard-CLV58fUE.js +++ b/assets/TeacherDashboard-CTQJuBtl.js @@ -1,4 +1,4 @@ -import{r as d,j as e,c as be}from"./vendor-react-Dexh7fmo.js";import{B as ve}from"./button-CwNFy6cp.js";import{I as Ue}from"./input-DBkKXOmF.js";import Vr from"./ConfirmModal-HuY-9h87.js";import{C as St,L as Yr,S as Hr,a as Wr}from"./LogoutActionButton-CCToMg4l.js";import{c as lt,d as ke,e as rt,m as ce,Z as Ka,u as Rt,t as Y,C as Kr,T as yt,g as fa,f as Jr,h as Xr,B as Zr,i as en,M as tn}from"./index-CYVpLr_P.js";import{e as We,q as qe,l as Ja,w as Ve,h as Ze,o as sn,f as Xa,s as Je,d as Fe,u as Xe,b as pt,a as ze,c as an}from"./vendor-firebase-firestore-CkuVbeP5.js";import{apiService as pe,ApiError as Ds}from"./apiService-DnEZVkU5.js";import{G as $s}from"./graduation-cap-BAW4sid0.js";import{X as Dt}from"./x-D3HMN9wJ.js";import{B as Za}from"./brain-D0hS_0wy.js";import{B as es}from"./book-open-BGS5Zqps.js";import{s as pa,f as rn,L as nn,d as on,a as ln,p as cn,b as dn}from"./quizService-DjlH8cxx.js";import{L as Le}from"./loader-circle-C8PWHn54.js";import{E as hs}from"./eye-D0u-o7Zh.js";import{S as zt}from"./send-DoEjcxSJ.js";import{T as er}from"./trash-2-D383W6Gx.js";import{C as Ss}from"./circle-alert-C5Et-bH4.js";import{M as ga}from"./minus-DeGDLvCZ.js";import{P as $t}from"./plus-C6Q_7FrB.js";import{C as Ut}from"./check-C1NZdYTy.js";import{F as Ps,I as qt,R as mn,D as un,a as xn,b as hn,c as fn,d as pn,e as gn,f as bn,V as vn}from"./dialog-CiirD9az.js";import{C as jt}from"./chart-column-sGYNY-cm.js";import{C as yn,S as q}from"./skeleton-BQc0_1c8.js";import{D as Fs}from"./download-i6ku6i1B.js";import{S as jn}from"./sparkles-DCodfP-i.js";import{S as tr}from"./save-B_ytEIW_.js";import{T as Os}from"./trending-up-CqFD_DPI.js";import{U as Yt}from"./users-CQJB3ZBq.js";import{S as ts}from"./search-CwICt96b.js";import{C as Ht,a as nt}from"./chevron-up-z_1tCiMP.js";import{S as ba,g as Nn,G as wn,s as va}from"./subjects-BZyYKoxN.js";import{C as sr}from"./circle-check-big-SmheLDZz.js";import{E as kn}from"./eye-off-DAmUDwrX.js";import{U as ya}from"./user-D-TTwp40.js";import{C as _t}from"./chevron-right-XRktHzwa.js";import{A as Sn}from"./award-C5AZ3Rkn.js";import ar from"./ChatMarkdown-CaB5Axzm.js";import{B as Wt}from"./bell-BQMual5k.js";import{C as Cn}from"./check-check-Rx2AszdF.js";import{C as rr}from"./clock-Cb5jwJte.js";import{M as Tn}from"./message-square-c-O8e9VO.js";import{T as In}from"./trophy-GpbJF7pP.js";import{c as Ln}from"./utils-BQQgILNW.js";import{T as Mn}from"./target-GUh8ebLY.js";import{C as An}from"./calendar-DsAM31pV.js";import{g as En,i as _e,G as zn,a as fs,m as Dn,b as ot,T as $n,s as ps,f as ft,c as ja,L as Na,d as Pn,e as Fn,u as Rs,h as _s,j as On,k as Rn,l as _n,w as wa,n as nr,o as ss,p as Bn,q as Gn,r as Qn,B as Cs,t as Un,R as ka,v as Sa,C as qn}from"./generateCategoricalChart-CiUYzAvW.js";import{c as gt}from"./clsx-B-dksMZM.js";import{P as or}from"./pen-line-Dzt-bcp9.js";import"./vendor-radix-cHXhEj3X.js";import"./log-out-B4zHGAON.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";import"./vendor-markdown-C5ikSDMA.js";/** +import{r as d,j as e,c as be}from"./vendor-react-Dexh7fmo.js";import{B as ve}from"./button-CwNFy6cp.js";import{I as Ue}from"./input-DBkKXOmF.js";import Vr from"./ConfirmModal-FyItBILR.js";import{C as St,L as Yr,S as Hr,a as Wr}from"./LogoutActionButton-ggTmlIBR.js";import{c as lt,d as ke,e as rt,m as ce,Z as Ka,u as Rt,t as Y,C as Kr,T as yt,g as fa,f as Jr,h as Xr,B as Zr,i as en,M as tn}from"./index-LyKgWktA.js";import{e as We,q as qe,l as Ja,w as Ve,h as Ze,o as sn,f as Xa,s as Je,d as Fe,u as Xe,b as pt,a as ze,c as an}from"./vendor-firebase-firestore-CkuVbeP5.js";import{apiService as pe,ApiError as Ds}from"./apiService-BmjkaPHy.js";import{G as $s}from"./graduation-cap-BajVF1yD.js";import{X as Dt}from"./x-CWNywLHU.js";import{B as Za}from"./brain-19xpRLO9.js";import{B as es}from"./book-open-BRafwRDJ.js";import{s as pa,f as rn,L as nn,d as on,a as ln,p as cn,b as dn}from"./quizService-B3HGgNhs.js";import{L as Le}from"./loader-circle-Bd75QYdF.js";import{E as hs}from"./eye-r-ReRrFU.js";import{S as zt}from"./send-DdToiTRE.js";import{T as er}from"./trash-2-CSbIpBBo.js";import{C as Ss}from"./circle-alert-26D7lLL4.js";import{M as ga}from"./minus-BGOdCLGP.js";import{P as $t}from"./plus-QA9NgyWS.js";import{C as Ut}from"./check-sV5f01n0.js";import{F as Ps,I as qt,R as mn,D as un,a as xn,b as hn,c as fn,d as pn,e as gn,f as bn,V as vn}from"./dialog-CPKbo3wM.js";import{C as jt}from"./chart-column-CAJHtHZ_.js";import{C as yn,S as q}from"./skeleton-FRDY0mw5.js";import{D as Fs}from"./download-DGfKThZf.js";import{S as jn}from"./sparkles-D-fzJUWE.js";import{S as tr}from"./save-qazbBcyz.js";import{T as Os}from"./trending-up-DwhUzSCD.js";import{U as Yt}from"./users-CRaf-j4K.js";import{S as ts}from"./search-B1VJAO7p.js";import{C as Ht,a as nt}from"./chevron-up-CmF1G4Yx.js";import{S as ba,g as Nn,G as wn,s as va}from"./subjects-c5kzjeSA.js";import{C as sr}from"./circle-check-big-Dj73d5Jk.js";import{E as kn}from"./eye-off-zFZIYFo3.js";import{U as ya}from"./user-BZgiUM6h.js";import{C as _t}from"./chevron-right-OeSCfsNc.js";import{A as Sn}from"./award-BQb3QdnO.js";import ar from"./ChatMarkdown-sXdo6Daw.js";import{B as Wt}from"./bell-EBkVBtCr.js";import{C as Cn}from"./check-check-9iSO4G-S.js";import{C as rr}from"./clock-8WaO5Ocs.js";import{M as Tn}from"./message-square-cJcev-mA.js";import{T as In}from"./trophy-vkFq3hpl.js";import{c as Ln}from"./utils-BQQgILNW.js";import{T as Mn}from"./target-CX3SjMvf.js";import{C as An}from"./calendar-cirmK6YZ.js";import{g as En,i as _e,G as zn,a as fs,m as Dn,b as ot,T as $n,s as ps,f as ft,c as ja,L as Na,d as Pn,e as Fn,u as Rs,h as _s,j as On,k as Rn,l as _n,w as wa,n as nr,o as ss,p as Bn,q as Gn,r as Qn,B as Cs,t as Un,R as ka,v as Sa,C as qn}from"./generateCategoricalChart-CiUYzAvW.js";import{c as gt}from"./clsx-B-dksMZM.js";import{P as or}from"./pen-line-Ctg9I-nz.js";import"./vendor-radix-cHXhEj3X.js";import"./log-out-CI4drKBP.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-storage-BOeKE_0n.js";import"./vendor-firebase-analytics-CCo6E2f7.js";import"./vendor-markdown-C5ikSDMA.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/XPNotification-BSSwW9a_.js b/assets/XPNotification-CFHzSyP5.js similarity index 91% rename from assets/XPNotification-BSSwW9a_.js rename to assets/XPNotification-CFHzSyP5.js index 04a367b88dd471ce5c278c532928043311daabf4..400ddca1ae8d399dbf8f4c925d3873119b75b3a8 100644 --- a/assets/XPNotification-BSSwW9a_.js +++ b/assets/XPNotification-CFHzSyP5.js @@ -1 +1 @@ -import{r as l,j as e}from"./vendor-react-Dexh7fmo.js";import{e as n,m as r}from"./index-CYVpLr_P.js";import{S as c}from"./star-BOFYd7BG.js";import{S as m}from"./sparkles-DCodfP-i.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-firestore-CkuVbeP5.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}; +import{r as l,j as e}from"./vendor-react-Dexh7fmo.js";import{e as n,m as r}from"./index-LyKgWktA.js";import{S as c}from"./star-BbJSm_XE.js";import{S as m}from"./sparkles-D-fzJUWE.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-firestore-CkuVbeP5.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}; diff --git a/assets/apiService-DnEZVkU5.js b/assets/apiService-BmjkaPHy.js similarity index 99% rename from assets/apiService-DnEZVkU5.js rename to assets/apiService-BmjkaPHy.js index e873f6a0b89cacf361af90682dbf23faf36f08d7..66093ea31fef05a6297a2fb658bbb70e9ee6acba 100644 --- a/assets/apiService-DnEZVkU5.js +++ b/assets/apiService-BmjkaPHy.js @@ -1,4 +1,4 @@ -import{I as B}from"./index-CYVpLr_P.js";import"./vendor-react-Dexh7fmo.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-firestore-CkuVbeP5.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(na==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)||rs)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(` +import{I as B}from"./index-LyKgWktA.js";import"./vendor-react-Dexh7fmo.js";import"./vendor-firebase-auth-COrkgW0P.js";import"./vendor-firebase-core-DQ-pMjxd.js";import"./vendor-firebase-firestore-CkuVbeP5.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(na==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)||rs)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(` `),T=$.indexOf(`\r \r diff --git a/assets/automationService-BD3AWvKJ.js b/assets/automationService-b2P2XC_p.js similarity index 98% rename from assets/automationService-BD3AWvKJ.js rename to assets/automationService-b2P2XC_p.js index b778f8d7ba2eb399f6200f0f11bfc27231b9916d..c395db762dc116b7c186becac3a09896c88c8a9d 100644 --- a/assets/automationService-BD3AWvKJ.js +++ b/assets/automationService-b2P2XC_p.js @@ -1 +1 @@ -import{k as p,e as r,q as w,w as h,h as z,m as Q,a as i,s as I,d as b,u as A}from"./vendor-firebase-firestore-CkuVbeP5.js";import{d as s,N as a,O as $}from"./index-CYVpLr_P.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 k(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 T(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 N(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 U(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{k as getPendingDeepDiagnosticCount,U as triggerContentUpdated,N as triggerDataImported,T as triggerDiagnosticCompleted,B as triggerQuizSubmitted,M as triggerStudentEnrolled}; +import{k as p,e as r,q as w,w as h,h as z,m as Q,a as i,s as I,d as b,u as A}from"./vendor-firebase-firestore-CkuVbeP5.js";import{d as s,N as a,O as $}from"./index-LyKgWktA.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 k(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 T(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 N(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 U(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{k as getPendingDeepDiagnosticCount,U as triggerContentUpdated,N as triggerDataImported,T as triggerDiagnosticCompleted,B as triggerQuizSubmitted,M as triggerStudentEnrolled}; diff --git a/assets/award-C5AZ3Rkn.js b/assets/award-BQb3QdnO.js similarity index 91% rename from assets/award-C5AZ3Rkn.js rename to assets/award-BQb3QdnO.js index 27276d376e6751183cf76e944e7c1a0d7b3dc417..d6546187dd0e9bf91f8ec2d7acdb768f302bb356 100644 --- a/assets/award-C5AZ3Rkn.js +++ b/assets/award-BQb3QdnO.js @@ -1,4 +1,4 @@ -import{c}from"./index-CYVpLr_P.js";/** +import{c}from"./index-LyKgWktA.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/bell-BQMual5k.js b/assets/bell-EBkVBtCr.js similarity index 90% rename from assets/bell-BQMual5k.js rename to assets/bell-EBkVBtCr.js index 09feea1375dc1532df4628325fad9d6375aad5a7..52083718a2d62fd02bf05adad099a9d063643620 100644 --- a/assets/bell-BQMual5k.js +++ b/assets/bell-EBkVBtCr.js @@ -1,4 +1,4 @@ -import{c as e}from"./index-CYVpLr_P.js";/** +import{c as e}from"./index-LyKgWktA.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/book-open-BGS5Zqps.js b/assets/book-open-BRafwRDJ.js similarity index 90% rename from assets/book-open-BGS5Zqps.js rename to assets/book-open-BRafwRDJ.js index 9554f02a77bd85847075163fcad38d118a2264fd..8ddf56df332eda1b8183e8fd6012a889153c4292 100644 --- a/assets/book-open-BGS5Zqps.js +++ b/assets/book-open-BRafwRDJ.js @@ -1,4 +1,4 @@ -import{c as o}from"./index-CYVpLr_P.js";/** +import{c as o}from"./index-LyKgWktA.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/brain-D0hS_0wy.js b/assets/brain-19xpRLO9.js similarity index 95% rename from assets/brain-D0hS_0wy.js rename to assets/brain-19xpRLO9.js index f9751d80b9ad02b062933788ca1a5b0562bb268d..2861d8dc55182df49d7d11fc25f382176a9f8002 100644 --- a/assets/brain-D0hS_0wy.js +++ b/assets/brain-19xpRLO9.js @@ -1,4 +1,4 @@ -import{c as a}from"./index-CYVpLr_P.js";/** +import{c as a}from"./index-LyKgWktA.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/calendar-DsAM31pV.js b/assets/calendar-cirmK6YZ.js similarity index 89% rename from assets/calendar-DsAM31pV.js rename to assets/calendar-cirmK6YZ.js index a297976b1a9770a782cab21452395bdf7d7174b8..86735d11d8320f087520a3d82de7ddddc07b6ed2 100644 --- a/assets/calendar-DsAM31pV.js +++ b/assets/calendar-cirmK6YZ.js @@ -1,4 +1,4 @@ -import{c as e}from"./index-CYVpLr_P.js";/** +import{c as e}from"./index-LyKgWktA.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/chart-column-sGYNY-cm.js b/assets/chart-column-CAJHtHZ_.js similarity index 89% rename from assets/chart-column-sGYNY-cm.js rename to assets/chart-column-CAJHtHZ_.js index e55f891d3bbc5c747e32069d0230582ffa00bf96..3f60b095cf78f6ba8502ac43e610b8dcce0ffcc3 100644 --- a/assets/chart-column-sGYNY-cm.js +++ b/assets/chart-column-CAJHtHZ_.js @@ -1,4 +1,4 @@ -import{c as t}from"./index-CYVpLr_P.js";/** +import{c as t}from"./index-LyKgWktA.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/chatService-I0cWl26r.js b/assets/chatService-CcLfebtv.js similarity index 97% rename from assets/chatService-I0cWl26r.js rename to assets/chatService-CcLfebtv.js index 177c3a6fb76988dc7550f5556f58703dceb17175..69dfc1bdb205445ab26725da334d5dc691710713 100644 --- a/assets/chatService-I0cWl26r.js +++ b/assets/chatService-CcLfebtv.js @@ -1 +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,h as A}from"./vendor-firebase-firestore-CkuVbeP5.js";import{d as o}from"./index-CYVpLr_P.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}; +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,h as A}from"./vendor-firebase-firestore-CkuVbeP5.js";import{d as o}from"./index-LyKgWktA.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}; diff --git a/assets/check-check-Rx2AszdF.js b/assets/check-check-9iSO4G-S.js similarity index 88% rename from assets/check-check-Rx2AszdF.js rename to assets/check-check-9iSO4G-S.js index 95d8c154d7507cefd1d9523d20b9dbeca0f07bda..4844e0a74eb5abf29038b97ea5a98fa3f4b07707 100644 --- a/assets/check-check-Rx2AszdF.js +++ b/assets/check-check-9iSO4G-S.js @@ -1,4 +1,4 @@ -import{c}from"./index-CYVpLr_P.js";/** +import{c}from"./index-LyKgWktA.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/check-C1NZdYTy.js b/assets/check-sV5f01n0.js similarity index 86% rename from assets/check-C1NZdYTy.js rename to assets/check-sV5f01n0.js index 0c0af92fa2ee8e76e5439b6ac7733edbc30479cc..5a56e553b9dac701bdd0dd9a6d056ad7154b9216 100644 --- a/assets/check-C1NZdYTy.js +++ b/assets/check-sV5f01n0.js @@ -1,4 +1,4 @@ -import{c}from"./index-CYVpLr_P.js";/** +import{c}from"./index-LyKgWktA.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/chevron-right-XRktHzwa.js b/assets/chevron-right-OeSCfsNc.js similarity index 85% rename from assets/chevron-right-XRktHzwa.js rename to assets/chevron-right-OeSCfsNc.js index 8f5a2ffd58045b002828d78a0250e7e2cafbc90c..434277ae67f238db994da792bdbbeeb717271b87 100644 --- a/assets/chevron-right-XRktHzwa.js +++ b/assets/chevron-right-OeSCfsNc.js @@ -1,4 +1,4 @@ -import{c as o}from"./index-CYVpLr_P.js";/** +import{c as o}from"./index-LyKgWktA.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/chevron-up-z_1tCiMP.js b/assets/chevron-up-CmF1G4Yx.js similarity index 92% rename from assets/chevron-up-z_1tCiMP.js rename to assets/chevron-up-CmF1G4Yx.js index 3ea60fa798bcf71e9a5b4fef9d53cad7c33d5699..baf368a33b127e704a150fe19da2c7a3df353c64 100644 --- a/assets/chevron-up-z_1tCiMP.js +++ b/assets/chevron-up-CmF1G4Yx.js @@ -1,4 +1,4 @@ -import{c as o}from"./index-CYVpLr_P.js";/** +import{c as o}from"./index-LyKgWktA.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/circle-alert-C5Et-bH4.js b/assets/circle-alert-26D7lLL4.js similarity index 89% rename from assets/circle-alert-C5Et-bH4.js rename to assets/circle-alert-26D7lLL4.js index 3f36c9d2ad556da206d204ebc422d777602882e5..09b14fe0fdb67278c00ecee8072d202238164cd8 100644 --- a/assets/circle-alert-C5Et-bH4.js +++ b/assets/circle-alert-26D7lLL4.js @@ -1,4 +1,4 @@ -import{c as e}from"./index-CYVpLr_P.js";/** +import{c as e}from"./index-LyKgWktA.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/circle-check-big-SmheLDZz.js b/assets/circle-check-big-Dj73d5Jk.js similarity index 89% rename from assets/circle-check-big-SmheLDZz.js rename to assets/circle-check-big-Dj73d5Jk.js index 1e635c638248c2fc2426a0e4ccd2853003d3ad28..2e1118aac7f3fe17246dc53598dedd7b2c772956 100644 --- a/assets/circle-check-big-SmheLDZz.js +++ b/assets/circle-check-big-Dj73d5Jk.js @@ -1,4 +1,4 @@ -import{c}from"./index-CYVpLr_P.js";/** +import{c}from"./index-LyKgWktA.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/circle-help-a8xBzaz5.js b/assets/circle-help-CD72X8cm.js similarity index 90% rename from assets/circle-help-a8xBzaz5.js rename to assets/circle-help-CD72X8cm.js index 50c5d53e914527beefd57a3df39f1853a1832c88..384574a949afb84ef0f064378476684709c31785 100644 --- a/assets/circle-help-a8xBzaz5.js +++ b/assets/circle-help-CD72X8cm.js @@ -1,4 +1,4 @@ -import{c}from"./index-CYVpLr_P.js";/** +import{c}from"./index-LyKgWktA.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/clock-Cb5jwJte.js b/assets/clock-8WaO5Ocs.js similarity index 88% rename from assets/clock-Cb5jwJte.js rename to assets/clock-8WaO5Ocs.js index 1de24f6150ef060f5dc94b70a218521b6dd49b7c..5525232662c6de8819ad9811fe38551556911fce 100644 --- a/assets/clock-Cb5jwJte.js +++ b/assets/clock-8WaO5Ocs.js @@ -1,4 +1,4 @@ -import{c}from"./index-CYVpLr_P.js";/** +import{c}from"./index-LyKgWktA.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/dialog-CiirD9az.js b/assets/dialog-CPKbo3wM.js similarity index 96% rename from assets/dialog-CiirD9az.js rename to assets/dialog-CPKbo3wM.js index 507e554b55c50f849e68346fb2cf5a3a3d8dccf6..9e7d99a282c4720a8ebd15b82c5509e2fe3e6d41 100644 --- a/assets/dialog-CiirD9az.js +++ b/assets/dialog-CPKbo3wM.js @@ -1,4 +1,4 @@ -import{c as s}from"./index-CYVpLr_P.js";import{j as a}from"./vendor-react-Dexh7fmo.js";import{a as i,C as d,b as l,T as r,D as c,P as f,O as p}from"./vendor-radix-cHXhEj3X.js";import{c as o}from"./utils-BQQgILNW.js";import{X as g}from"./x-D3HMN9wJ.js";/** +import{c as s}from"./index-LyKgWktA.js";import{j as a}from"./vendor-react-Dexh7fmo.js";import{a as i,C as d,b as l,T as r,D as c,P as f,O as p}from"./vendor-radix-cHXhEj3X.js";import{c as o}from"./utils-BQQgILNW.js";import{X as g}from"./x-CWNywLHU.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/download-i6ku6i1B.js b/assets/download-DGfKThZf.js similarity index 89% rename from assets/download-i6ku6i1B.js rename to assets/download-DGfKThZf.js index 16b1b2bfad66b40c630c013679524733aba83f2d..51792c882cce520341bb4d0c2acac13cc62f2e60 100644 --- a/assets/download-i6ku6i1B.js +++ b/assets/download-DGfKThZf.js @@ -1,4 +1,4 @@ -import{c as o}from"./index-CYVpLr_P.js";/** +import{c as o}from"./index-LyKgWktA.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/eye-off-DAmUDwrX.js b/assets/eye-off-zFZIYFo3.js similarity index 92% rename from assets/eye-off-DAmUDwrX.js rename to assets/eye-off-zFZIYFo3.js index 9ebddbabcab06ea39cfd74b4195a0922a0daa9d4..713feff1f21a8f8f7ce23cef6d775f7780e62e14 100644 --- a/assets/eye-off-DAmUDwrX.js +++ b/assets/eye-off-zFZIYFo3.js @@ -1,4 +1,4 @@ -import{c as e}from"./index-CYVpLr_P.js";/** +import{c as e}from"./index-LyKgWktA.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/eye-D0u-o7Zh.js b/assets/eye-r-ReRrFU.js similarity index 90% rename from assets/eye-D0u-o7Zh.js rename to assets/eye-r-ReRrFU.js index bc020e414d0f44531e379b2ce4156632ad81aa7c..23046d42e1d533d8b448744f1a1650f8e53359f8 100644 --- a/assets/eye-D0u-o7Zh.js +++ b/assets/eye-r-ReRrFU.js @@ -1,4 +1,4 @@ -import{c}from"./index-CYVpLr_P.js";/** +import{c}from"./index-LyKgWktA.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/globe-D6NgA4sZ.js b/assets/globe-CNqTHI-4.js similarity index 90% rename from assets/globe-D6NgA4sZ.js rename to assets/globe-CNqTHI-4.js index aa18ac3574293189083fdf5b38166ef3d3de48ef..b6d889bce4598321cfb1f2a8ddb2e7cb8b1ddd63 100644 --- a/assets/globe-D6NgA4sZ.js +++ b/assets/globe-CNqTHI-4.js @@ -1,4 +1,4 @@ -import{c}from"./index-CYVpLr_P.js";/** +import{c}from"./index-LyKgWktA.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/graduation-cap-BAW4sid0.js b/assets/graduation-cap-BajVF1yD.js similarity index 91% rename from assets/graduation-cap-BAW4sid0.js rename to assets/graduation-cap-BajVF1yD.js index 1194c4ebceb7097bb2ea139d45ebda7c0f4f748a..42479387623a7b7fbea60e2bfa36c37faefb4539 100644 --- a/assets/graduation-cap-BAW4sid0.js +++ b/assets/graduation-cap-BajVF1yD.js @@ -1,4 +1,4 @@ -import{c as a}from"./index-CYVpLr_P.js";/** +import{c as a}from"./index-LyKgWktA.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/index-CYVpLr_P.js b/assets/index-LyKgWktA.js similarity index 97% rename from assets/index-CYVpLr_P.js rename to assets/index-LyKgWktA.js index 2fa1430183e313aa4469d4659f9b88d5e39eccf5..92abc3adcea200d703733536dd68126c51eb1c67 100644 --- a/assets/index-CYVpLr_P.js +++ b/assets/index-LyKgWktA.js @@ -1,4 +1,4 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/automationService-BD3AWvKJ.js","assets/vendor-firebase-firestore-CkuVbeP5.js","assets/vendor-firebase-core-DQ-pMjxd.js","assets/vendor-react-Dexh7fmo.js","assets/vendor-firebase-auth-COrkgW0P.js","assets/vendor-firebase-storage-BOeKE_0n.js","assets/vendor-firebase-analytics-CCo6E2f7.js","assets/apiService-DnEZVkU5.js","assets/chatService-I0cWl26r.js","assets/LoginPage-T2QRM5oF.js","assets/button-CwNFy6cp.js","assets/vendor-radix-cHXhEj3X.js","assets/clsx-B-dksMZM.js","assets/utils-BQQgILNW.js","assets/input-DBkKXOmF.js","assets/sparkles-DCodfP-i.js","assets/brain-D0hS_0wy.js","assets/trending-up-CqFD_DPI.js","assets/award-C5AZ3Rkn.js","assets/users-CQJB3ZBq.js","assets/graduation-cap-BAW4sid0.js","assets/book-open-BGS5Zqps.js","assets/mail-C5ZpVS09.js","assets/lock-COR_g_Qg.js","assets/eye-off-DAmUDwrX.js","assets/eye-D0u-o7Zh.js","assets/shield-check-CotW-v_m.js","assets/TeacherDashboard-CLV58fUE.js","assets/ConfirmModal-HuY-9h87.js","assets/x-D3HMN9wJ.js","assets/trash-2-D383W6Gx.js","assets/log-out-B4zHGAON.js","assets/LogoutActionButton-CCToMg4l.js","assets/quizService-DjlH8cxx.js","assets/loader-circle-C8PWHn54.js","assets/send-DoEjcxSJ.js","assets/circle-alert-C5Et-bH4.js","assets/minus-DeGDLvCZ.js","assets/plus-C6Q_7FrB.js","assets/check-C1NZdYTy.js","assets/dialog-CiirD9az.js","assets/chart-column-sGYNY-cm.js","assets/skeleton-BQc0_1c8.js","assets/download-i6ku6i1B.js","assets/save-B_ytEIW_.js","assets/search-CwICt96b.js","assets/chevron-up-z_1tCiMP.js","assets/subjects-BZyYKoxN.js","assets/circle-check-big-SmheLDZz.js","assets/user-D-TTwp40.js","assets/chevron-right-XRktHzwa.js","assets/ChatMarkdown-CaB5Axzm.js","assets/vendor-markdown-C5ikSDMA.js","assets/vendor-markdown-CBmFCdgC.css","assets/bell-BQMual5k.js","assets/check-check-Rx2AszdF.js","assets/clock-Cb5jwJte.js","assets/message-square-c-O8e9VO.js","assets/trophy-GpbJF7pP.js","assets/target-GUh8ebLY.js","assets/calendar-DsAM31pV.js","assets/generateCategoricalChart-CiUYzAvW.js","assets/pen-line-Dzt-bcp9.js","assets/AdminDashboard-sWnGnYr4.js","assets/Sidebar-CLDaRLyZ.js","assets/tooltip-DqqE-4Wr.js","assets/shield-B_6hUGZX.js","assets/swords-C8YOZegm.js","assets/shirt-D--nDwDf.js","assets/select-CHi9TA28.js","assets/circle-help-a8xBzaz5.js","assets/globe-D6NgA4sZ.js","assets/trending-down-HzTmBWMp.js","assets/HeroBanner-Dml-Sn9K.js","assets/RightSidebar-BHJnYOaW.js","assets/star-BOFYd7BG.js","assets/XPNotification-BSSwW9a_.js","assets/NotificationCenter-Eg9vwWZd.js","assets/SearchBar-C7pZQ20f.js","assets/SupplementalBanner-DTd5-XUw.js","assets/LearningPath-BSacbKfT.js","assets/ModuleFolderCard-Bxgj3UEp.js","assets/CompetencyRadarChart-Bso8mrwZ.js","assets/ModulesPage-DJAi-xJS.js","assets/confetti.module-C94ZD2ww.js","assets/ScientificCalculator-vQs43GTt.js","assets/MathAnswerInput-D4H3Op7Z.js","assets/AIChatPage-CnRlS68Q.js","assets/GradesPage-B1r-crcb.js","assets/LeaderboardPage-D6ahhKnH.js","assets/QuizBattlePage-BJ5HoB2m.js","assets/tabs-ZKIOrn_p.js","assets/switch-aCsENXi7.js","assets/AvatarShop-1kFCJptl.js","assets/FloatingAITutor-DPLt7omS.js","assets/RewardsModal-BAC0Ze0K.js","assets/ProfileModal-B2Fc7DEQ.js","assets/avatarData-DykDiQ_Y.js","assets/SettingsModal-ta9Wy9X1.js","assets/DiagnosticAssessmentModal-CMBQPpr8.js","assets/testResetService-BCgi1kVA.js","assets/index-BDfnT5_3.css"])))=>i.map(i=>d[i]); +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/automationService-b2P2XC_p.js","assets/vendor-firebase-firestore-CkuVbeP5.js","assets/vendor-firebase-core-DQ-pMjxd.js","assets/vendor-react-Dexh7fmo.js","assets/vendor-firebase-auth-COrkgW0P.js","assets/vendor-firebase-storage-BOeKE_0n.js","assets/vendor-firebase-analytics-CCo6E2f7.js","assets/apiService-BmjkaPHy.js","assets/chatService-CcLfebtv.js","assets/LoginPage-QhJ2yB_c.js","assets/button-CwNFy6cp.js","assets/vendor-radix-cHXhEj3X.js","assets/clsx-B-dksMZM.js","assets/utils-BQQgILNW.js","assets/input-DBkKXOmF.js","assets/sparkles-D-fzJUWE.js","assets/brain-19xpRLO9.js","assets/trending-up-DwhUzSCD.js","assets/award-BQb3QdnO.js","assets/users-CRaf-j4K.js","assets/graduation-cap-BajVF1yD.js","assets/book-open-BRafwRDJ.js","assets/mail-BSFHdQFh.js","assets/lock-DeaK7IhY.js","assets/eye-off-zFZIYFo3.js","assets/eye-r-ReRrFU.js","assets/shield-check-WLUcWIeq.js","assets/TeacherDashboard-CTQJuBtl.js","assets/ConfirmModal-FyItBILR.js","assets/x-CWNywLHU.js","assets/trash-2-CSbIpBBo.js","assets/log-out-CI4drKBP.js","assets/LogoutActionButton-ggTmlIBR.js","assets/quizService-B3HGgNhs.js","assets/loader-circle-Bd75QYdF.js","assets/send-DdToiTRE.js","assets/circle-alert-26D7lLL4.js","assets/minus-BGOdCLGP.js","assets/plus-QA9NgyWS.js","assets/check-sV5f01n0.js","assets/dialog-CPKbo3wM.js","assets/chart-column-CAJHtHZ_.js","assets/skeleton-FRDY0mw5.js","assets/download-DGfKThZf.js","assets/save-qazbBcyz.js","assets/search-B1VJAO7p.js","assets/chevron-up-CmF1G4Yx.js","assets/subjects-c5kzjeSA.js","assets/circle-check-big-Dj73d5Jk.js","assets/user-BZgiUM6h.js","assets/chevron-right-OeSCfsNc.js","assets/ChatMarkdown-sXdo6Daw.js","assets/vendor-markdown-C5ikSDMA.js","assets/vendor-markdown-CBmFCdgC.css","assets/bell-EBkVBtCr.js","assets/check-check-9iSO4G-S.js","assets/clock-8WaO5Ocs.js","assets/message-square-cJcev-mA.js","assets/trophy-vkFq3hpl.js","assets/target-CX3SjMvf.js","assets/calendar-cirmK6YZ.js","assets/generateCategoricalChart-CiUYzAvW.js","assets/pen-line-Ctg9I-nz.js","assets/AdminDashboard-gfXmaPwb.js","assets/Sidebar-HVTXyPGL.js","assets/tooltip-DqqE-4Wr.js","assets/shield-CcOzg2El.js","assets/swords-DBnIhbCe.js","assets/shirt-PgcFQo2K.js","assets/select-DCrihmc0.js","assets/circle-help-CD72X8cm.js","assets/globe-CNqTHI-4.js","assets/trending-down-B4HmNTSb.js","assets/HeroBanner-nfRGXqul.js","assets/RightSidebar-c9BUk44H.js","assets/star-BbJSm_XE.js","assets/XPNotification-CFHzSyP5.js","assets/NotificationCenter-ofzm6YSA.js","assets/SearchBar-KL-CbGtm.js","assets/SupplementalBanner-DIN86DZO.js","assets/LearningPath-xhsARrsq.js","assets/ModuleFolderCard-CZJPjlmm.js","assets/CompetencyRadarChart-D0AVDm8g.js","assets/ModulesPage-COuXuHrB.js","assets/confetti.module-C94ZD2ww.js","assets/ScientificCalculator-Do4eNBdw.js","assets/MathAnswerInput-BZkojdgW.js","assets/AIChatPage-bzvb0iBg.js","assets/GradesPage-CZjSVd52.js","assets/LeaderboardPage-BMdoHzNS.js","assets/QuizBattlePage-3pqx9mUa.js","assets/tabs-ZKIOrn_p.js","assets/switch-aCsENXi7.js","assets/AvatarShop-EpLIaBDr.js","assets/FloatingAITutor-DFhmOqQt.js","assets/RewardsModal-CsH4qI6T.js","assets/ProfileModal-C2CHUW-6.js","assets/avatarData-DykDiQ_Y.js","assets/SettingsModal-BnULUpJH.js","assets/DiagnosticAssessmentModal-Si7Hh1eA.js","assets/testResetService-TwZ9y_Zl.js","assets/index-BDfnT5_3.css"])))=>i.map(i=>d[i]); import{r as h,j as m,c as C,b as Sl,e as Tl}from"./vendor-react-Dexh7fmo.js";import{g as Pl,G as Al,c as El,u as Cl,s as Dl,a as Rl,d as kl,b as Ml,o as Ll}from"./vendor-firebase-auth-COrkgW0P.js";import{R as Il,T as Vl,U as _l,V as jl}from"./vendor-firebase-core-DQ-pMjxd.js";import{g as Nl,d as se,s as He,a as he,b as ke,c as Ol,w as Oe,o as tn,l as nn,q as rt,e as We,f as bo,h as un,u as Bt,i as Fl,j as Fn}from"./vendor-firebase-firestore-CkuVbeP5.js";import{g as Bl}from"./vendor-firebase-storage-BOeKE_0n.js";import{g as $l}from"./vendor-firebase-analytics-CCo6E2f7.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const r of o.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&s(r)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function s(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();const zl="modulepreload",Ul=function(e){return"/"+e},$i={},H=function(t,n,s){let i=Promise.resolve();if(n&&n.length>0){let r=function(u){return Promise.all(u.map(d=>Promise.resolve(d).then(l=>({status:"fulfilled",value:l}),l=>({status:"rejected",reason:l}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),c=a?.nonce||a?.getAttribute("nonce");i=r(n.map(u=>{if(u=Ul(u),u in $i)return;$i[u]=!0;const d=u.endsWith(".css"),l=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${l}`))return;const f=document.createElement("link");if(f.rel=d?"stylesheet":zl,d||(f.as="script"),f.crossOrigin="",f.href=u,c&&f.setAttribute("nonce",c),document.head.appendChild(f),d)return new Promise((p,g)=>{f.addEventListener("load",p),f.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${u}`)))})}))}function o(r){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=r,window.dispatchEvent(a),!a.defaultPrevented)throw r}return i.then(r=>{for(const a of r||[])a.status==="rejected"&&o(a.reason);return t().catch(o)})},ii=h.createContext({});function ri(e){const t=h.useRef(null);return t.current===null&&(t.current=e()),t.current}const xo=typeof window<"u",wo=xo?h.useLayoutEffect:h.useEffect,Gn=h.createContext(null);function oi(e,t){e.indexOf(t)===-1&&e.push(t)}function Bn(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}const Qe=(e,t,n)=>n>t?t:n{};const Je={},So=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function To(e){return typeof e=="object"&&e!==null}const Po=e=>/^0[^.\s]+$/u.test(e);function li(e){let t;return()=>(t===void 0&&(t=e()),t)}const Fe=e=>e,Wl=(e,t)=>n=>t(e(n)),dn=(...e)=>e.reduce(Wl),sn=(e,t,n)=>{const s=t-e;return s===0?1:(n-e)/s};class ci{constructor(){this.subscriptions=[]}add(t){return oi(this.subscriptions,t),()=>Bn(this.subscriptions,t)}notify(t,n,s){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](t,n,s);else for(let o=0;oe*1e3,Ne=e=>e/1e3;function Ao(e,t){return t?e*(1e3/t):0}const Eo=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,Hl=1e-7,ql=12;function Kl(e,t,n,s,i){let o,r,a=0;do r=t+(n-t)/2,o=Eo(r,s,i)-e,o>0?n=r:t=r;while(Math.abs(o)>Hl&&++aKl(o,0,1,e,n);return o=>o===0||o===1?o:Eo(i(o),t,s)}const Co=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Do=e=>t=>1-e(1-t),Ro=fn(.33,1.53,.69,.99),ui=Do(Ro),ko=Co(ui),Mo=e=>(e*=2)<1?.5*ui(e):.5*(2-Math.pow(2,-10*(e-1))),di=e=>1-Math.sin(Math.acos(e)),Lo=Do(di),Io=Co(di),Gl=fn(.42,0,1,1),Xl=fn(0,0,.58,1),Vo=fn(.42,0,.58,1),Yl=e=>Array.isArray(e)&&typeof e[0]!="number",_o=e=>Array.isArray(e)&&typeof e[0]=="number",Ql={linear:Fe,easeIn:Gl,easeInOut:Vo,easeOut:Xl,circIn:di,circInOut:Io,circOut:Lo,backIn:ui,backInOut:ko,backOut:Ro,anticipate:Mo},Zl=e=>typeof e=="string",zi=e=>{if(_o(e)){ai(e.length===4);const[t,n,s,i]=e;return fn(t,n,s,i)}else if(Zl(e))return Ql[e];return e},Sn=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function Jl(e,t){let n=new Set,s=new Set,i=!1,o=!1;const r=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function c(d){r.has(d)&&(u.schedule(d),e()),d(a)}const u={schedule:(d,l=!1,f=!1)=>{const g=f&&i?n:s;return l&&r.add(d),g.has(d)||g.add(d),d},cancel:d=>{s.delete(d),r.delete(d)},process:d=>{if(a=d,i){o=!0;return}i=!0,[n,s]=[s,n],n.forEach(c),n.clear(),i=!1,o&&(o=!1,u.process(d))}};return u}const ec=40;function jo(e,t){let n=!1,s=!0;const i={delta:0,timestamp:0,isProcessing:!1},o=()=>n=!0,r=Sn.reduce((y,b)=>(y[b]=Jl(o),y),{}),{setup:a,read:c,resolveKeyframes:u,preUpdate:d,update:l,preRender:f,render:p,postRender:g}=r,w=()=>{const y=Je.useManualTiming?i.timestamp:performance.now();n=!1,Je.useManualTiming||(i.delta=s?1e3/60:Math.max(Math.min(y-i.timestamp,ec),1)),i.timestamp=y,i.isProcessing=!0,a.process(i),c.process(i),u.process(i),d.process(i),l.process(i),f.process(i),p.process(i),g.process(i),i.isProcessing=!1,n&&t&&(s=!1,e(w))},T=()=>{n=!0,s=!0,i.isProcessing||e(w)};return{schedule:Sn.reduce((y,b)=>{const P=r[b];return y[b]=(S,I=!1,x=!1)=>(n||T(),P.schedule(S,I,x)),y},{}),cancel:y=>{for(let b=0;b(kn===void 0&&Te.set(me.isProcessing||Je.useManualTiming?me.timestamp:performance.now()),kn),set:e=>{kn=e,queueMicrotask(tc)}},No=e=>t=>typeof t=="string"&&t.startsWith(e),Oo=No("--"),nc=No("var(--"),fi=e=>nc(e)?sc.test(e.split("/*")[0].trim()):!1,sc=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function Ui(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}const $t={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},rn={...$t,transform:e=>Qe(0,1,e)},Tn={...$t,default:1},Qt=e=>Math.round(e*1e5)/1e5,hi=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function ic(e){return e==null}const rc=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,pi=(e,t)=>n=>!!(typeof n=="string"&&rc.test(n)&&n.startsWith(e)||t&&!ic(n)&&Object.prototype.hasOwnProperty.call(n,t)),Fo=(e,t,n)=>s=>{if(typeof s!="string")return s;const[i,o,r,a]=s.match(hi);return{[e]:parseFloat(i),[t]:parseFloat(o),[n]:parseFloat(r),alpha:a!==void 0?parseFloat(a):1}},oc=e=>Qe(0,255,e),rs={...$t,transform:e=>Math.round(oc(e))},vt={test:pi("rgb","red"),parse:Fo("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:s=1})=>"rgba("+rs.transform(e)+", "+rs.transform(t)+", "+rs.transform(n)+", "+Qt(rn.transform(s))+")"};function ac(e){let t="",n="",s="",i="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),s=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),s=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,s+=s,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(s,16),alpha:i?parseInt(i,16)/255:1}}const Rs={test:pi("#"),parse:ac,transform:vt.transform},hn=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),st=hn("deg"),Ye=hn("%"),k=hn("px"),lc=hn("vh"),cc=hn("vw"),Wi={...Ye,parse:e=>Ye.parse(e)/100,transform:e=>Ye.transform(e*100)},Lt={test:pi("hsl","hue"),parse:Fo("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:s=1})=>"hsla("+Math.round(e)+", "+Ye.transform(Qt(t))+", "+Ye.transform(Qt(n))+", "+Qt(rn.transform(s))+")"},ce={test:e=>vt.test(e)||Rs.test(e)||Lt.test(e),parse:e=>vt.test(e)?vt.parse(e):Lt.test(e)?Lt.parse(e):Rs.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?vt.transform(e):Lt.transform(e),getAnimatableNone:e=>{const t=ce.parse(e);return t.alpha=0,ce.transform(t)}},uc=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function dc(e){return isNaN(e)&&typeof e=="string"&&(e.match(hi)?.length||0)+(e.match(uc)?.length||0)>0}const Bo="number",$o="color",fc="var",hc="var(",Hi="${}",pc=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function on(e){const t=e.toString(),n=[],s={color:[],number:[],var:[]},i=[];let o=0;const a=t.replace(pc,c=>(ce.test(c)?(s.color.push(o),i.push($o),n.push(ce.parse(c))):c.startsWith(hc)?(s.var.push(o),i.push(fc),n.push(c)):(s.number.push(o),i.push(Bo),n.push(parseFloat(c))),++o,Hi)).split(Hi);return{values:n,split:a,indexes:s,types:i}}function zo(e){return on(e).values}function Uo(e){const{split:t,types:n}=on(e),s=t.length;return i=>{let o="";for(let r=0;rtypeof e=="number"?0:ce.test(e)?ce.getAnimatableNone(e):e;function gc(e){const t=zo(e);return Uo(e)(t.map(mc))}const at={test:dc,parse:zo,createTransformer:Uo,getAnimatableNone:gc};function os(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function yc({hue:e,saturation:t,lightness:n,alpha:s}){e/=360,t/=100,n/=100;let i=0,o=0,r=0;if(!t)i=o=r=n;else{const a=n<.5?n*(1+t):n+t-n*t,c=2*n-a;i=os(c,a,e+1/3),o=os(c,a,e),r=os(c,a,e-1/3)}return{red:Math.round(i*255),green:Math.round(o*255),blue:Math.round(r*255),alpha:s}}function $n(e,t){return n=>n>0?t:e}const Z=(e,t,n)=>e+(t-e)*n,as=(e,t,n)=>{const s=e*e,i=n*(t*t-s)+s;return i<0?0:Math.sqrt(i)},vc=[Rs,vt,Lt],bc=e=>vc.find(t=>t.test(e));function qi(e){const t=bc(e);if(!t)return!1;let n=t.parse(e);return t===Lt&&(n=yc(n)),n}const Ki=(e,t)=>{const n=qi(e),s=qi(t);if(!n||!s)return $n(e,t);const i={...n};return o=>(i.red=as(n.red,s.red,o),i.green=as(n.green,s.green,o),i.blue=as(n.blue,s.blue,o),i.alpha=Z(n.alpha,s.alpha,o),vt.transform(i))},ks=new Set(["none","hidden"]);function xc(e,t){return ks.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function wc(e,t){return n=>Z(e,t,n)}function mi(e){return typeof e=="number"?wc:typeof e=="string"?fi(e)?$n:ce.test(e)?Ki:Pc:Array.isArray(e)?Wo:typeof e=="object"?ce.test(e)?Ki:Sc:$n}function Wo(e,t){const n=[...e],s=n.length,i=e.map((o,r)=>mi(o)(o,t[r]));return o=>{for(let r=0;r{for(const o in s)n[o]=s[o](i);return n}}function Tc(e,t){const n=[],s={color:0,var:0,number:0};for(let i=0;i{const n=at.createTransformer(t),s=on(e),i=on(t);return s.indexes.var.length===i.indexes.var.length&&s.indexes.color.length===i.indexes.color.length&&s.indexes.number.length>=i.indexes.number.length?ks.has(e)&&!i.values.length||ks.has(t)&&!s.values.length?xc(e,t):dn(Wo(Tc(s,i),i.values),n):$n(e,t)};function Ho(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?Z(e,t,n):mi(e)(e,t)}const Ac=e=>{const t=({timestamp:n})=>e(n);return{start:(n=!0)=>Y.update(t,n),stop:()=>ot(t),now:()=>me.isProcessing?me.timestamp:Te.now()}},qo=(e,t,n=10)=>{let s="";const i=Math.max(Math.round(t/n),2);for(let o=0;o=zn?1/0:t}function Ec(e,t=100,n){const s=n({...e,keyframes:[0,t]}),i=Math.min(gi(s),zn);return{type:"keyframes",ease:o=>s.next(i*o).value/t,duration:Ne(i)}}const Cc=5;function Ko(e,t,n){const s=Math.max(t-Cc,0);return Ao(n-e(s),t-s)}const ne={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},ls=.001;function Dc({duration:e=ne.duration,bounce:t=ne.bounce,velocity:n=ne.velocity,mass:s=ne.mass}){let i,o,r=1-t;r=Qe(ne.minDamping,ne.maxDamping,r),e=Qe(ne.minDuration,ne.maxDuration,Ne(e)),r<1?(i=u=>{const d=u*r,l=d*e,f=d-n,p=Ms(u,r),g=Math.exp(-l);return ls-f/p*g},o=u=>{const l=u*r*e,f=l*n+n,p=Math.pow(r,2)*Math.pow(u,2)*e,g=Math.exp(-l),w=Ms(Math.pow(u,2),r);return(-i(u)+ls>0?-1:1)*((f-p)*g)/w}):(i=u=>{const d=Math.exp(-u*e),l=(u-n)*e+1;return-ls+d*l},o=u=>{const d=Math.exp(-u*e),l=(n-u)*(e*e);return d*l});const a=5/e,c=kc(i,o,a);if(e=Ue(e),isNaN(c))return{stiffness:ne.stiffness,damping:ne.damping,duration:e};{const u=Math.pow(c,2)*s;return{stiffness:u,damping:r*2*Math.sqrt(s*u),duration:e}}}const Rc=12;function kc(e,t,n){let s=n;for(let i=1;ie[n]!==void 0)}function Ic(e){let t={velocity:ne.velocity,stiffness:ne.stiffness,damping:ne.damping,mass:ne.mass,isResolvedFromDuration:!1,...e};if(!Gi(e,Lc)&&Gi(e,Mc))if(e.visualDuration){const n=e.visualDuration,s=2*Math.PI/(n*1.2),i=s*s,o=2*Qe(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:ne.mass,stiffness:i,damping:o}}else{const n=Dc(e);t={...t,...n,mass:ne.mass},t.isResolvedFromDuration=!0}return t}function Un(e=ne.visualDuration,t=ne.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:s,restDelta:i}=n;const o=n.keyframes[0],r=n.keyframes[n.keyframes.length-1],a={done:!1,value:o},{stiffness:c,damping:u,mass:d,duration:l,velocity:f,isResolvedFromDuration:p}=Ic({...n,velocity:-Ne(n.velocity||0)}),g=f||0,w=u/(2*Math.sqrt(c*d)),T=r-o,v=Ne(Math.sqrt(c/d)),A=Math.abs(T)<5;s||(s=A?ne.restSpeed.granular:ne.restSpeed.default),i||(i=A?ne.restDelta.granular:ne.restDelta.default);let y;if(w<1){const P=Ms(v,w);y=S=>{const I=Math.exp(-w*v*S);return r-I*((g+w*v*T)/P*Math.sin(P*S)+T*Math.cos(P*S))}}else if(w===1)y=P=>r-Math.exp(-v*P)*(T+(g+v*T)*P);else{const P=v*Math.sqrt(w*w-1);y=S=>{const I=Math.exp(-w*v*S),x=Math.min(P*S,300);return r-I*((g+w*v*T)*Math.sinh(x)+P*T*Math.cosh(x))/P}}const b={calculatedDuration:p&&l||null,next:P=>{const S=y(P);if(p)a.done=P>=l;else{let I=P===0?g:0;w<1&&(I=P===0?Ue(g):Ko(y,P,S));const x=Math.abs(I)<=s,R=Math.abs(r-S)<=i;a.done=x&&R}return a.value=a.done?r:S,a},toString:()=>{const P=Math.min(gi(b),zn),S=qo(I=>b.next(P*I).value,P,30);return P+"ms "+S},toTransition:()=>{}};return b}Un.applyToOptions=e=>{const t=Ec(e,100,Un);return e.ease=t.ease,e.duration=Ue(t.duration),e.type="keyframes",e};function Ls({keyframes:e,velocity:t=0,power:n=.8,timeConstant:s=325,bounceDamping:i=10,bounceStiffness:o=500,modifyTarget:r,min:a,max:c,restDelta:u=.5,restSpeed:d}){const l=e[0],f={done:!1,value:l},p=x=>a!==void 0&&xc,g=x=>a===void 0?c:c===void 0||Math.abs(a-x)-w*Math.exp(-x/s),y=x=>v+A(x),b=x=>{const R=A(x),L=y(x);f.done=Math.abs(R)<=u,f.value=f.done?v:L};let P,S;const I=x=>{p(f.value)&&(P=x,S=Un({keyframes:[f.value,g(f.value)],velocity:Ko(y,x,f.value),damping:i,stiffness:o,restDelta:u,restSpeed:d}))};return I(0),{calculatedDuration:null,next:x=>{let R=!1;return!S&&P===void 0&&(R=!0,b(x),I(x)),P!==void 0&&x>=P?S.next(x-P):(!R&&b(x),f)}}}function Vc(e,t,n){const s=[],i=n||Je.mix||Ho,o=e.length-1;for(let r=0;rt[0];if(o===2&&t[0]===t[1])return()=>t[1];const r=e[0]===e[1];e[0]>e[o-1]&&(e=[...e].reverse(),t=[...t].reverse());const a=Vc(t,s,i),c=a.length,u=d=>{if(r&&d1)for(;lu(Qe(e[0],e[o-1],d)):u}function jc(e,t){const n=e[e.length-1];for(let s=1;s<=t;s++){const i=sn(0,t,s);e.push(Z(n,1,i))}}function Nc(e){const t=[0];return jc(t,e.length-1),t}function Oc(e,t){return e.map(n=>n*t)}function Fc(e,t){return e.map(()=>t||Vo).splice(0,e.length-1)}function Zt({duration:e=300,keyframes:t,times:n,ease:s="easeInOut"}){const i=Yl(s)?s.map(zi):zi(s),o={done:!1,value:t[0]},r=Oc(n&&n.length===t.length?n:Nc(t),e),a=_c(r,t,{ease:Array.isArray(i)?i:Fc(t,i)});return{calculatedDuration:e,next:c=>(o.value=a(c),o.done=c>=e,o)}}const Bc=e=>e!==null;function yi(e,{repeat:t,repeatType:n="loop"},s,i=1){const o=e.filter(Bc),a=i<0||t&&n!=="loop"&&t%2===1?0:o.length-1;return!a||s===void 0?o[a]:s}const $c={decay:Ls,inertia:Ls,tween:Zt,keyframes:Zt,spring:Un};function Go(e){typeof e.type=="string"&&(e.type=$c[e.type])}class vi{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,n){return this.finished.then(t,n)}}const zc=e=>e/100;class bi extends vi{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{const{motionValue:n}=this.options;n&&n.updatedAt!==Te.now()&&this.tick(Te.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause()}initAnimation(){const{options:t}=this;Go(t);const{type:n=Zt,repeat:s=0,repeatDelay:i=0,repeatType:o,velocity:r=0}=t;let{keyframes:a}=t;const c=n||Zt;c!==Zt&&typeof a[0]!="number"&&(this.mixKeyframes=dn(zc,Ho(a[0],a[1])),a=[0,100]);const u=c({...t,keyframes:a});o==="mirror"&&(this.mirroredGenerator=c({...t,keyframes:[...a].reverse(),velocity:-r})),u.calculatedDuration===null&&(u.calculatedDuration=gi(u));const{calculatedDuration:d}=u;this.calculatedDuration=d,this.resolvedDuration=d+i,this.totalDuration=this.resolvedDuration*(s+1)-i,this.generator=u}updateTime(t){const n=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(t,n=!1){const{generator:s,totalDuration:i,mixKeyframes:o,mirroredGenerator:r,resolvedDuration:a,calculatedDuration:c}=this;if(this.startTime===null)return s.next(0);const{delay:u=0,keyframes:d,repeat:l,repeatType:f,repeatDelay:p,type:g,onUpdate:w,finalKeyframe:T}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-i/this.speed,this.startTime)),n?this.currentTime=t:this.updateTime(t);const v=this.currentTime-u*(this.playbackSpeed>=0?1:-1),A=this.playbackSpeed>=0?v<0:v>i;this.currentTime=Math.max(v,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=i);let y=this.currentTime,b=s;if(l){const x=Math.min(this.currentTime,i)/a;let R=Math.floor(x),L=x%1;!L&&x>=1&&(L=1),L===1&&R--,R=Math.min(R,l+1),!!(R%2)&&(f==="reverse"?(L=1-L,p&&(L-=p/a)):f==="mirror"&&(b=r)),y=Qe(0,1,L)*a}const P=A?{done:!1,value:d[0]}:b.next(y);o&&(P.value=o(P.value));let{done:S}=P;!A&&c!==null&&(S=this.playbackSpeed>=0?this.currentTime>=i:this.currentTime<=0);const I=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&S);return I&&g!==Ls&&(P.value=yi(d,this.options,T,this.speed)),w&&w(P.value),I&&this.finish(),P}then(t,n){return this.finished.then(t,n)}get duration(){return Ne(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Ne(t)}get time(){return Ne(this.currentTime)}set time(t){t=Ue(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(t){this.updateTime(Te.now());const n=this.playbackSpeed!==t;this.playbackSpeed=t,n&&(this.time=Ne(this.currentTime))}play(){if(this.isStopped)return;const{driver:t=Ac,startTime:n}=this.options;this.driver||(this.driver=t(i=>this.tick(i))),this.options.onPlay?.();const s=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=s):this.holdTime!==null?this.startTime=s-this.holdTime:this.startTime||(this.startTime=n??s),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(Te.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),t.observe(this)}}function Uc(e){for(let t=1;te*180/Math.PI,Is=e=>{const t=bt(Math.atan2(e[1],e[0]));return Vs(t)},Wc={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:Is,rotateZ:Is,skewX:e=>bt(Math.atan(e[1])),skewY:e=>bt(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},Vs=e=>(e=e%360,e<0&&(e+=360),e),Xi=Is,Yi=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),Qi=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),Hc={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Yi,scaleY:Qi,scale:e=>(Yi(e)+Qi(e))/2,rotateX:e=>Vs(bt(Math.atan2(e[6],e[5]))),rotateY:e=>Vs(bt(Math.atan2(-e[2],e[0]))),rotateZ:Xi,rotate:Xi,skewX:e=>bt(Math.atan(e[4])),skewY:e=>bt(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function _s(e){return e.includes("scale")?1:0}function js(e,t){if(!e||e==="none")return _s(t);const n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let s,i;if(n)s=Hc,i=n;else{const a=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);s=Wc,i=a}if(!i)return _s(t);const o=s[t],r=i[1].split(",").map(Kc);return typeof o=="function"?o(r):r[o]}const qc=(e,t)=>{const{transform:n="none"}=getComputedStyle(e);return js(n,t)};function Kc(e){return parseFloat(e.trim())}const zt=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Ut=new Set(zt),Zi=e=>e===$t||e===k,Gc=new Set(["x","y","z"]),Xc=zt.filter(e=>!Gc.has(e));function Yc(e){const t=[];return Xc.forEach(n=>{const s=e.getValue(n);s!==void 0&&(t.push([n,s.get()]),s.set(n.startsWith("scale")?1:0))}),t}const it={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>js(t,"x"),y:(e,{transform:t})=>js(t,"y")};it.translateX=it.x;it.translateY=it.y;const xt=new Set;let Ns=!1,Os=!1,Fs=!1;function Xo(){if(Os){const e=Array.from(xt).filter(s=>s.needsMeasurement),t=new Set(e.map(s=>s.element)),n=new Map;t.forEach(s=>{const i=Yc(s);i.length&&(n.set(s,i),s.render())}),e.forEach(s=>s.measureInitialState()),t.forEach(s=>{s.render();const i=n.get(s);i&&i.forEach(([o,r])=>{s.getValue(o)?.set(r)})}),e.forEach(s=>s.measureEndState()),e.forEach(s=>{s.suspendedScrollY!==void 0&&window.scrollTo(0,s.suspendedScrollY)})}Os=!1,Ns=!1,xt.forEach(e=>e.complete(Fs)),xt.clear()}function Yo(){xt.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Os=!0)})}function Qc(){Fs=!0,Yo(),Xo(),Fs=!1}class xi{constructor(t,n,s,i,o,r=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=s,this.motionValue=i,this.element=o,this.isAsync=r}scheduleResolve(){this.state="scheduled",this.isAsync?(xt.add(this),Ns||(Ns=!0,Y.read(Yo),Y.resolveKeyframes(Xo))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:s,motionValue:i}=this;if(t[0]===null){const o=i?.get(),r=t[t.length-1];if(o!==void 0)t[0]=o;else if(s&&n){const a=s.readValue(n,r);a!=null&&(t[0]=a)}t[0]===void 0&&(t[0]=r),i&&o===void 0&&i.set(t[0])}Uc(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),xt.delete(this)}cancel(){this.state==="scheduled"&&(xt.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const Zc=e=>e.startsWith("--");function Jc(e,t,n){Zc(t)?e.style.setProperty(t,n):e.style[t]=n}const eu=li(()=>window.ScrollTimeline!==void 0),tu={};function nu(e,t){const n=li(e);return()=>tu[t]??n()}const Qo=nu(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Yt=([e,t,n,s])=>`cubic-bezier(${e}, ${t}, ${n}, ${s})`,Ji={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Yt([0,.65,.55,1]),circOut:Yt([.55,0,1,.45]),backIn:Yt([.31,.01,.66,-.59]),backOut:Yt([.33,1.53,.69,.99])};function Zo(e,t){if(e)return typeof e=="function"?Qo()?qo(e,t):"ease-out":_o(e)?Yt(e):Array.isArray(e)?e.map(n=>Zo(n,t)||Ji.easeOut):Ji[e]}function su(e,t,n,{delay:s=0,duration:i=300,repeat:o=0,repeatType:r="loop",ease:a="easeOut",times:c}={},u=void 0){const d={[t]:n};c&&(d.offset=c);const l=Zo(a,i);Array.isArray(l)&&(d.easing=l);const f={delay:s,duration:i,easing:Array.isArray(l)?"linear":l,fill:"both",iterations:o+1,direction:r==="reverse"?"alternate":"normal"};return u&&(f.pseudoElement=u),e.animate(d,f)}function Jo(e){return typeof e=="function"&&"applyToOptions"in e}function iu({type:e,...t}){return Jo(e)&&Qo()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class ea extends vi{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:n,name:s,keyframes:i,pseudoElement:o,allowFlatten:r=!1,finalKeyframe:a,onComplete:c}=t;this.isPseudoElement=!!o,this.allowFlatten=r,this.options=t,ai(typeof t.type!="string");const u=iu(t);this.animation=su(n,s,i,u,o),u.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!o){const d=yi(i,this.options,a,this.speed);this.updateMotionValue?this.updateMotionValue(d):Jc(n,s,d),this.animation.cancel()}c?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){const t=this.options?.element;!this.isPseudoElement&&t?.isConnected&&this.animation.commitStyles?.()}get duration(){const t=this.animation.effect?.getComputedTiming?.().duration||0;return Ne(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Ne(t)}get time(){return Ne(Number(this.animation.currentTime)||0)}set time(t){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Ue(t)}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:t,observe:n}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,t&&eu()?(this.animation.timeline=t,Fe):n(this)}}const ta={anticipate:Mo,backInOut:ko,circInOut:Io};function ru(e){return e in ta}function ou(e){typeof e.ease=="string"&&ru(e.ease)&&(e.ease=ta[e.ease])}const cs=10;class au extends ea{constructor(t){ou(t),Go(t),super(t),t.startTime!==void 0&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:n,onUpdate:s,onComplete:i,element:o,...r}=this.options;if(!n)return;if(t!==void 0){n.set(t);return}const a=new bi({...r,autoplay:!1}),c=Math.max(cs,Te.now()-this.startTime),u=Qe(0,cs,c-cs);n.setWithVelocity(a.sample(Math.max(0,c-u)).value,a.sample(c).value,u),a.stop()}}const er=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(at.test(e)||e==="0")&&!e.startsWith("url("));function lu(e){const t=e[0];if(e.length===1)return!0;for(let n=0;nObject.hasOwnProperty.call(Element.prototype,"animate"));function fu(e){const{motionValue:t,name:n,repeatDelay:s,repeatType:i,damping:o,type:r}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:u}=t.owner.getProps();return du()&&n&&uu.has(n)&&(n!=="transform"||!u)&&!c&&!s&&i!=="mirror"&&o!==0&&r!=="inertia"}const hu=40;class pu extends vi{constructor({autoplay:t=!0,delay:n=0,type:s="keyframes",repeat:i=0,repeatDelay:o=0,repeatType:r="loop",keyframes:a,name:c,motionValue:u,element:d,...l}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=Te.now();const f={autoplay:t,delay:n,type:s,repeat:i,repeatDelay:o,repeatType:r,name:c,motionValue:u,element:d,...l},p=d?.KeyframeResolver||xi;this.keyframeResolver=new p(a,(g,w,T)=>this.onKeyframesResolved(g,w,f,!T),c,u,d),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(t,n,s,i){this.keyframeResolver=void 0;const{name:o,type:r,velocity:a,delay:c,isHandoff:u,onUpdate:d}=s;this.resolvedAt=Te.now(),cu(t,o,r,a)||((Je.instantAnimations||!c)&&d?.(yi(t,s,n)),t[0]=t[t.length-1],Bs(s),s.repeat=0);const f={startTime:i?this.resolvedAt?this.resolvedAt-this.createdAt>hu?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...s,keyframes:t},p=!u&&fu(f),g=f.motionValue?.owner?.current,w=p?new au({...f,element:g}):new bi(f);w.finished.then(()=>{this.notifyFinished()}).catch(Fe),this.pendingTimeline&&(this.stopTimeline=w.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=w}get finished(){return this._animation?this.animation.finished:this._finished}then(t,n){return this.finished.finally(t).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),Qc()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}function na(e,t,n,s=0,i=1){const o=Array.from(e).sort((u,d)=>u.sortNodePosition(d)).indexOf(t),r=e.size,a=(r-1)*s;return typeof n=="function"?n(o,r):i===1?o*s:a-o*s}const mu=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function gu(e){const t=mu.exec(e);if(!t)return[,];const[,n,s,i]=t;return[`--${n??s}`,i]}function sa(e,t,n=1){const[s,i]=gu(e);if(!s)return;const o=window.getComputedStyle(t).getPropertyValue(s);if(o){const r=o.trim();return So(r)?parseFloat(r):r}return fi(i)?sa(i,t,n+1):i}const yu={type:"spring",stiffness:500,damping:25,restSpeed:10},vu=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),bu={type:"keyframes",duration:.8},xu={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},wu=(e,{keyframes:t})=>t.length>2?bu:Ut.has(e)?e.startsWith("scale")?vu(t[1]):yu:xu,Su=e=>e!==null;function Tu(e,{repeat:t,repeatType:n="loop"},s){const i=e.filter(Su),o=t&&n!=="loop"&&t%2===1?0:i.length-1;return i[o]}function ia(e,t){if(e?.inherit&&t){const{inherit:n,...s}=e;return{...t,...s}}return e}function wi(e,t){const n=e?.[t]??e?.default??e;return n!==e?ia(n,e):n}function Pu({when:e,delay:t,delayChildren:n,staggerChildren:s,staggerDirection:i,repeat:o,repeatType:r,repeatDelay:a,from:c,elapsed:u,...d}){return!!Object.keys(d).length}const Si=(e,t,n,s={},i,o)=>r=>{const a=wi(s,e)||{},c=a.delay||s.delay||0;let{elapsed:u=0}=s;u=u-Ue(c);const d={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...a,delay:-u,onUpdate:f=>{t.set(f),a.onUpdate&&a.onUpdate(f)},onComplete:()=>{r(),a.onComplete&&a.onComplete()},name:e,motionValue:t,element:o?void 0:i};Pu(a)||Object.assign(d,wu(e,d)),d.duration&&(d.duration=Ue(d.duration)),d.repeatDelay&&(d.repeatDelay=Ue(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let l=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(Bs(d),d.delay===0&&(l=!0)),(Je.instantAnimations||Je.skipAnimations||i?.shouldSkipAnimations)&&(l=!0,Bs(d),d.delay=0),d.allowFlatten=!a.type&&!a.ease,l&&!o&&t.get()!==void 0){const f=Tu(d.keyframes,a);if(f!==void 0){Y.update(()=>{d.onUpdate(f),d.onComplete()});return}}return a.isSync?new bi(d):new pu(d)};function tr(e){const t=[{},{}];return e?.values.forEach((n,s)=>{t[0][s]=n.get(),t[1][s]=n.getVelocity()}),t}function Ti(e,t,n,s){if(typeof t=="function"){const[i,o]=tr(s);t=t(n!==void 0?n:e.custom,i,o)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[i,o]=tr(s);t=t(n!==void 0?n:e.custom,i,o)}return t}function Nt(e,t,n){const s=e.getProps();return Ti(s,t,n!==void 0?n:s.custom,e)}const ra=new Set(["width","height","top","left","right","bottom",...zt]),nr=30,Au=e=>!isNaN(parseFloat(e));class Eu{constructor(t,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=s=>{const i=Te.now();if(this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(s),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const o of this.dependents)o.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=Te.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=Au(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new ci);const s=this.events[t].add(n);return t==="change"?()=>{s(),Y.read(()=>{this.events.change.getSize()||this.stop()})}:s}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,n,s){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-s}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=Te.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>nr)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,nr);return Ao(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Ft(e,t){return new Eu(e,t)}const $s=e=>Array.isArray(e);function Cu(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,Ft(n))}function Du(e){return $s(e)?e[e.length-1]||0:e}function Ru(e,t){const n=Nt(e,t);let{transitionEnd:s={},transition:i={},...o}=n||{};o={...o,...s};for(const r in o){const a=Du(o[r]);Cu(e,r,a)}}const xe=e=>!!(e&&e.getVelocity);function ku(e){return!!(xe(e)&&e.add)}function zs(e,t){const n=e.getValue("willChange");if(ku(n))return n.add(t);if(!n&&Je.WillChange){const s=new Je.WillChange("auto");e.addValue("willChange",s),s.add(t)}}function Pi(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const Mu="framerAppearId",oa="data-"+Pi(Mu);function aa(e){return e.props[oa]}function Lu({protectedKeys:e,needsAnimating:t},n){const s=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,s}function la(e,t,{delay:n=0,transitionOverride:s,type:i}={}){let{transition:o,transitionEnd:r,...a}=t;const c=e.getDefaultTransition();o=o?ia(o,c):c;const u=o?.reduceMotion;s&&(o=s);const d=[],l=i&&e.animationState&&e.animationState.getState()[i];for(const f in a){const p=e.getValue(f,e.latestValues[f]??null),g=a[f];if(g===void 0||l&&Lu(l,f))continue;const w={delay:n,...wi(o||{},f)},T=p.get();if(T!==void 0&&!p.isAnimating&&!Array.isArray(g)&&g===T&&!w.velocity)continue;let v=!1;if(window.MotionHandoffAnimation){const b=aa(e);if(b){const P=window.MotionHandoffAnimation(b,f,Y);P!==null&&(w.startTime=P,v=!0)}}zs(e,f);const A=u??e.shouldReduceMotion;p.start(Si(f,p,g,A&&ra.has(f)?{type:!1}:w,e,v));const y=p.animation;y&&d.push(y)}if(r){const f=()=>Y.update(()=>{r&&Ru(e,r)});d.length?Promise.all(d).then(f):f()}return d}function Us(e,t,n={}){const s=Nt(e,t,n.type==="exit"?e.presenceContext?.custom:void 0);let{transition:i=e.getDefaultTransition()||{}}=s||{};n.transitionOverride&&(i=n.transitionOverride);const o=s?()=>Promise.all(la(e,s,n)):()=>Promise.resolve(),r=e.variantChildren&&e.variantChildren.size?(c=0)=>{const{delayChildren:u=0,staggerChildren:d,staggerDirection:l}=i;return Iu(e,t,c,u,d,l,n)}:()=>Promise.resolve(),{when:a}=i;if(a){const[c,u]=a==="beforeChildren"?[o,r]:[r,o];return c().then(()=>u())}else return Promise.all([o(),r(n.delay)])}function Iu(e,t,n=0,s=0,i=0,o=1,r){const a=[];for(const c of e.variantChildren)c.notify("AnimationStart",t),a.push(Us(c,t,{...r,delay:n+(typeof s=="function"?0:s)+na(e.variantChildren,c,s,i,o)}).then(()=>c.notify("AnimationComplete",t)));return Promise.all(a)}function Vu(e,t,n={}){e.notify("AnimationStart",t);let s;if(Array.isArray(t)){const i=t.map(o=>Us(e,o,n));s=Promise.all(i)}else if(typeof t=="string")s=Us(e,t,n);else{const i=typeof t=="function"?Nt(e,t,n.custom):t;s=Promise.all(la(e,i,n))}return s.then(()=>{e.notify("AnimationComplete",t)})}const _u={test:e=>e==="auto",parse:e=>e},ca=e=>t=>t.test(e),ua=[$t,k,Ye,st,cc,lc,_u],sr=e=>ua.find(ca(e));function ju(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||Po(e):!0}const Nu=new Set(["brightness","contrast","saturate","opacity"]);function Ou(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[s]=n.match(hi)||[];if(!s)return e;const i=n.replace(s,"");let o=Nu.has(t)?1:0;return s!==n&&(o*=100),t+"("+o+i+")"}const Fu=/\b([a-z-]*)\(.*?\)/gu,Ws={...at,getAnimatableNone:e=>{const t=e.match(Fu);return t?t.map(Ou).join(" "):e}},ir={...$t,transform:Math.round},Bu={rotate:st,rotateX:st,rotateY:st,rotateZ:st,scale:Tn,scaleX:Tn,scaleY:Tn,scaleZ:Tn,skew:st,skewX:st,skewY:st,distance:k,translateX:k,translateY:k,translateZ:k,x:k,y:k,z:k,perspective:k,transformPerspective:k,opacity:rn,originX:Wi,originY:Wi,originZ:k},Ai={borderWidth:k,borderTopWidth:k,borderRightWidth:k,borderBottomWidth:k,borderLeftWidth:k,borderRadius:k,borderTopLeftRadius:k,borderTopRightRadius:k,borderBottomRightRadius:k,borderBottomLeftRadius:k,width:k,maxWidth:k,height:k,maxHeight:k,top:k,right:k,bottom:k,left:k,inset:k,insetBlock:k,insetBlockStart:k,insetBlockEnd:k,insetInline:k,insetInlineStart:k,insetInlineEnd:k,padding:k,paddingTop:k,paddingRight:k,paddingBottom:k,paddingLeft:k,paddingBlock:k,paddingBlockStart:k,paddingBlockEnd:k,paddingInline:k,paddingInlineStart:k,paddingInlineEnd:k,margin:k,marginTop:k,marginRight:k,marginBottom:k,marginLeft:k,marginBlock:k,marginBlockStart:k,marginBlockEnd:k,marginInline:k,marginInlineStart:k,marginInlineEnd:k,fontSize:k,backgroundPositionX:k,backgroundPositionY:k,...Bu,zIndex:ir,fillOpacity:rn,strokeOpacity:rn,numOctaves:ir},$u={...Ai,color:ce,backgroundColor:ce,outlineColor:ce,fill:ce,stroke:ce,borderColor:ce,borderTopColor:ce,borderRightColor:ce,borderBottomColor:ce,borderLeftColor:ce,filter:Ws,WebkitFilter:Ws},da=e=>$u[e];function fa(e,t){let n=da(e);return n!==Ws&&(n=at),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const zu=new Set(["auto","none","0"]);function Uu(e,t,n){let s=0,i;for(;s{t.getValue(a).set(c)}),this.resolveNoneKeyframes()}}const Hu=new Set(["opacity","clipPath","filter","transform"]);function ha(e,t,n){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e=="string"){let s=document;const i=n?.[e]??s.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e).filter(s=>s!=null)}const pa=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function Hs(e){return To(e)&&"offsetHeight"in e}const{schedule:Ei}=jo(queueMicrotask,!1),ze={x:!1,y:!1};function ma(){return ze.x||ze.y}function qu(e){return e==="x"||e==="y"?ze[e]?null:(ze[e]=!0,()=>{ze[e]=!1}):ze.x||ze.y?null:(ze.x=ze.y=!0,()=>{ze.x=ze.y=!1})}function ga(e,t){const n=ha(e),s=new AbortController,i={passive:!0,...t,signal:s.signal};return[n,i,()=>s.abort()]}function Ku(e){return!(e.pointerType==="touch"||ma())}function Gu(e,t,n={}){const[s,i,o]=ga(e,n);return s.forEach(r=>{let a=!1,c=!1,u;const d=()=>{r.removeEventListener("pointerleave",g)},l=T=>{u&&(u(T),u=void 0),d()},f=T=>{a=!1,window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",f),c&&(c=!1,l(T))},p=()=>{a=!0,window.addEventListener("pointerup",f,i),window.addEventListener("pointercancel",f,i)},g=T=>{if(T.pointerType!=="touch"){if(a){c=!0;return}l(T)}},w=T=>{if(!Ku(T))return;c=!1;const v=t(r,T);typeof v=="function"&&(u=v,r.addEventListener("pointerleave",g,i))};r.addEventListener("pointerenter",w,i),r.addEventListener("pointerdown",p,i)}),o}const ya=(e,t)=>t?e===t?!0:ya(e,t.parentElement):!1,Ci=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,Xu=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Yu(e){return Xu.has(e.tagName)||e.isContentEditable===!0}const Qu=new Set(["INPUT","SELECT","TEXTAREA"]);function Zu(e){return Qu.has(e.tagName)||e.isContentEditable===!0}const Mn=new WeakSet;function rr(e){return t=>{t.key==="Enter"&&e(t)}}function us(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const Ju=(e,t)=>{const n=e.currentTarget;if(!n)return;const s=rr(()=>{if(Mn.has(n))return;us(n,"down");const i=rr(()=>{us(n,"up")}),o=()=>us(n,"cancel");n.addEventListener("keyup",i,t),n.addEventListener("blur",o,t)});n.addEventListener("keydown",s,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",s),t)};function or(e){return Ci(e)&&!ma()}const ar=new WeakSet;function ed(e,t,n={}){const[s,i,o]=ga(e,n),r=a=>{const c=a.currentTarget;if(!or(a)||ar.has(a))return;Mn.add(c),n.stopPropagation&&ar.add(a);const u=t(c,a),d=(p,g)=>{window.removeEventListener("pointerup",l),window.removeEventListener("pointercancel",f),Mn.has(c)&&Mn.delete(c),or(p)&&typeof u=="function"&&u(p,{success:g})},l=p=>{d(p,c===window||c===document||n.useGlobalTarget||ya(c,p.target))},f=p=>{d(p,!1)};window.addEventListener("pointerup",l,i),window.addEventListener("pointercancel",f,i)};return s.forEach(a=>{(n.useGlobalTarget?window:a).addEventListener("pointerdown",r,i),Hs(a)&&(a.addEventListener("focus",u=>Ju(u,i)),!Yu(a)&&!a.hasAttribute("tabindex")&&(a.tabIndex=0))}),o}function Di(e){return To(e)&&"ownerSVGElement"in e}const Ln=new WeakMap;let In;const va=(e,t,n)=>(s,i)=>i&&i[0]?i[0][e+"Size"]:Di(s)&&"getBBox"in s?s.getBBox()[t]:s[n],td=va("inline","width","offsetWidth"),nd=va("block","height","offsetHeight");function sd({target:e,borderBoxSize:t}){Ln.get(e)?.forEach(n=>{n(e,{get width(){return td(e,t)},get height(){return nd(e,t)}})})}function id(e){e.forEach(sd)}function rd(){typeof ResizeObserver>"u"||(In=new ResizeObserver(id))}function od(e,t){In||rd();const n=ha(e);return n.forEach(s=>{let i=Ln.get(s);i||(i=new Set,Ln.set(s,i)),i.add(t),In?.observe(s)}),()=>{n.forEach(s=>{const i=Ln.get(s);i?.delete(t),i?.size||In?.unobserve(s)})}}const Vn=new Set;let It;function ad(){It=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};Vn.forEach(t=>t(e))},window.addEventListener("resize",It)}function ld(e){return Vn.add(e),It||ad(),()=>{Vn.delete(e),!Vn.size&&typeof It=="function"&&(window.removeEventListener("resize",It),It=void 0)}}function lr(e,t){return typeof e=="function"?ld(e):od(e,t)}function cd(e){return Di(e)&&e.tagName==="svg"}const ud=[...ua,ce,at],dd=e=>ud.find(ca(e)),cr=()=>({translate:0,scale:1,origin:0,originPoint:0}),Vt=()=>({x:cr(),y:cr()}),ur=()=>({min:0,max:0}),de=()=>({x:ur(),y:ur()}),fd=new WeakMap;function Xn(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function an(e){return typeof e=="string"||Array.isArray(e)}const Ri=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],ki=["initial",...Ri];function Yn(e){return Xn(e.animate)||ki.some(t=>an(e[t]))}function ba(e){return!!(Yn(e)||e.variants)}function hd(e,t,n){for(const s in t){const i=t[s],o=n[s];if(xe(i))e.addValue(s,i);else if(xe(o))e.addValue(s,Ft(i,{owner:e}));else if(o!==i)if(e.hasValue(s)){const r=e.getValue(s);r.liveStyle===!0?r.jump(i):r.hasAnimated||r.set(i)}else{const r=e.getStaticValue(s);e.addValue(s,Ft(r!==void 0?r:i,{owner:e}))}}for(const s in n)t[s]===void 0&&e.removeValue(s);return t}const qs={current:null},xa={current:!1},pd=typeof window<"u";function md(){if(xa.current=!0,!!pd)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>qs.current=e.matches;e.addEventListener("change",t),t()}else qs.current=!1}const dr=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let Wn={};function wa(e){Wn=e}function gd(){return Wn}class yd{scrapeMotionValuesFromProps(t,n,s){return{}}constructor({parent:t,props:n,presenceContext:s,reducedMotionConfig:i,skipAnimations:o,blockInitialAnimation:r,visualState:a},c={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=xi,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const p=Te.now();this.renderScheduledAtthis.bindToMotionValue(s,n)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(xa.current||md(),this.shouldReduceMotion=qs.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),ot(this.notifyUpdate),ot(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const n=this.features[t];n&&(n.unmount(),n.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,n){if(this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)(),n.accelerate&&Hu.has(t)&&this.current instanceof HTMLElement){const{factory:r,keyframes:a,times:c,ease:u,duration:d}=n.accelerate,l=new ea({element:this.current,name:t,keyframes:a,times:c,ease:u,duration:Ue(d)}),f=r(l);this.valueSubscriptions.set(t,()=>{f(),l.cancel()});return}const s=Ut.has(t);s&&this.onBindTransform&&this.onBindTransform();const i=n.on("change",r=>{this.latestValues[t]=r,this.props.onUpdate&&Y.preRender(this.notifyUpdate),s&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let o;typeof window<"u"&&window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{i(),o&&o(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in Wn){const n=Wn[t];if(!n)continue;const{isEnabled:s,Feature:i}=n;if(!this.features[t]&&i&&s(this.props)&&(this.features[t]=new i(this)),this.features[t]){const o=this.features[t];o.isMounted?o.update():(o.mount(),o.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):de()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let s=0;sn.variantChildren.delete(t)}addValue(t,n){const s=this.values.get(t);n!==s&&(s&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let s=this.values.get(t);return s===void 0&&n!==void 0&&(s=Ft(n===null?void 0:n,{owner:this}),this.addValue(t,s)),s}readValue(t,n){let s=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options);return s!=null&&(typeof s=="string"&&(So(s)||Po(s))?s=parseFloat(s):!dd(s)&&at.test(n)&&(s=fa(t,n)),this.setBaseTarget(t,xe(s)?s.get():s)),xe(s)?s.get():s}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){const{initial:n}=this.props;let s;if(typeof n=="string"||typeof n=="object"){const o=Ti(this.props,n,this.presenceContext?.custom);o&&(s=o[t])}if(n&&s!==void 0)return s;const i=this.getBaseTargetFromProps(this.props,t);return i!==void 0&&!xe(i)?i:this.initialValues[t]!==void 0&&s===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new ci),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}scheduleRenderMicrotask(){Ei.render(this.render)}}class Sa extends yd{constructor(){super(...arguments),this.KeyframeResolver=Wu}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){const s=t.style;return s?s[n]:void 0}removeValueFromRenderState(t,{vars:n,style:s}){delete n[t],delete s[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;xe(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}class ct{constructor(t){this.isMounted=!1,this.node=t}update(){}}function Ta({top:e,left:t,right:n,bottom:s}){return{x:{min:t,max:n},y:{min:e,max:s}}}function vd({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function bd(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),s=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:s.y,right:s.x}}function ds(e){return e===void 0||e===1}function Ks({scale:e,scaleX:t,scaleY:n}){return!ds(e)||!ds(t)||!ds(n)}function yt(e){return Ks(e)||Pa(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function Pa(e){return fr(e.x)||fr(e.y)}function fr(e){return e&&e!=="0%"}function Hn(e,t,n){const s=e-n,i=t*s;return n+i}function hr(e,t,n,s,i){return i!==void 0&&(e=Hn(e,i,s)),Hn(e,n,s)+t}function Gs(e,t=0,n=1,s,i){e.min=hr(e.min,t,n,s,i),e.max=hr(e.max,t,n,s,i)}function Aa(e,{x:t,y:n}){Gs(e.x,t.translate,t.scale,t.originPoint),Gs(e.y,n.translate,n.scale,n.originPoint)}const pr=.999999999999,mr=1.0000000000001;function xd(e,t,n,s=!1){const i=n.length;if(!i)return;t.x=t.y=1;let o,r;for(let a=0;apr&&(t.x=1),t.ypr&&(t.y=1)}function _t(e,t){e.min=e.min+t,e.max=e.max+t}function gr(e,t,n,s,i=.5){const o=Z(e.min,e.max,i);Gs(e,t,n,o,s)}function jt(e,t){gr(e.x,t.x,t.scaleX,t.scale,t.originX),gr(e.y,t.y,t.scaleY,t.scale,t.originY)}function Ea(e,t){return Ta(bd(e.getBoundingClientRect(),t))}function wd(e,t,n){const s=Ea(e,n),{scroll:i}=t;return i&&(_t(s.x,i.offset.x),_t(s.y,i.offset.y)),s}const Sd={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},Td=zt.length;function Pd(e,t,n){let s="",i=!0;for(let o=0;o{if(!t.target)return e;if(typeof e=="string")if(k.test(e))e=parseFloat(e);else return e;const n=yr(e,t.target.x),s=yr(e,t.target.y);return`${n}% ${s}%`}},Ad={correct:(e,{treeScale:t,projectionDelta:n})=>{const s=e,i=at.parse(e);if(i.length>5)return s;const o=at.createTransformer(e),r=typeof i[0]!="number"?1:0,a=n.x.scale*t.x,c=n.y.scale*t.y;i[0+r]/=a,i[1+r]/=c;const u=Z(a,c,.5);return typeof i[2+r]=="number"&&(i[2+r]/=u),typeof i[3+r]=="number"&&(i[3+r]/=u),o(i)}},Xs={borderRadius:{...Gt,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Gt,borderTopRightRadius:Gt,borderBottomLeftRadius:Gt,borderBottomRightRadius:Gt,boxShadow:Ad};function Da(e,{layout:t,layoutId:n}){return Ut.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!Xs[e]||e==="opacity")}function Li(e,t,n){const s=e.style,i=t?.style,o={};if(!s)return o;for(const r in s)(xe(s[r])||i&&xe(i[r])||Da(r,e)||n?.getValue(r)?.liveStyle!==void 0)&&(o[r]=s[r]);return o}function Ed(e){return window.getComputedStyle(e)}class Cd extends Sa{constructor(){super(...arguments),this.type="html",this.renderInstance=Ca}readValueFromInstance(t,n){if(Ut.has(n))return this.projection?.isProjecting?_s(n):qc(t,n);{const s=Ed(t),i=(Oo(n)?s.getPropertyValue(n):s[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(t,{transformPagePoint:n}){return Ea(t,n)}build(t,n,s){Mi(t,n,s.transformTemplate)}scrapeMotionValuesFromProps(t,n,s){return Li(t,n,s)}}const Dd={offset:"stroke-dashoffset",array:"stroke-dasharray"},Rd={offset:"strokeDashoffset",array:"strokeDasharray"};function kd(e,t,n=1,s=0,i=!0){e.pathLength=1;const o=i?Dd:Rd;e[o.offset]=`${-s}`,e[o.array]=`${t} ${n}`}const Md=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function Ra(e,{attrX:t,attrY:n,attrScale:s,pathLength:i,pathSpacing:o=1,pathOffset:r=0,...a},c,u,d){if(Mi(e,a,u),c){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:l,style:f}=e;l.transform&&(f.transform=l.transform,delete l.transform),(f.transform||l.transformOrigin)&&(f.transformOrigin=l.transformOrigin??"50% 50%",delete l.transformOrigin),f.transform&&(f.transformBox=d?.transformBox??"fill-box",delete l.transformBox);for(const p of Md)l[p]!==void 0&&(f[p]=l[p],delete l[p]);t!==void 0&&(l.x=t),n!==void 0&&(l.y=n),s!==void 0&&(l.scale=s),i!==void 0&&kd(l,i,o,r,!1)}const ka=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),Ma=e=>typeof e=="string"&&e.toLowerCase()==="svg";function Ld(e,t,n,s){Ca(e,t,void 0,s);for(const i in t.attrs)e.setAttribute(ka.has(i)?i:Pi(i),t.attrs[i])}function La(e,t,n){const s=Li(e,t,n);for(const i in e)if(xe(e[i])||xe(t[i])){const o=zt.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;s[o]=e[i]}return s}class Id extends Sa{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=de}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(Ut.has(n)){const s=da(n);return s&&s.default||0}return n=ka.has(n)?n:Pi(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,s){return La(t,n,s)}build(t,n,s){Ra(t,n,this.isSVGTag,s.transformTemplate,s.style)}renderInstance(t,n,s,i){Ld(t,n,s,i)}mount(t){this.isSVGTag=Ma(t.tagName),super.mount(t)}}const Vd=ki.length;function Ia(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?Ia(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;nPromise.all(t.map(({animation:n,options:s})=>Vu(e,n,s)))}function Od(e){let t=Nd(e),n=vr(),s=!0;const i=c=>(u,d)=>{const l=Nt(e,d,c==="exit"?e.presenceContext?.custom:void 0);if(l){const{transition:f,transitionEnd:p,...g}=l;u={...u,...g,...p}}return u};function o(c){t=c(e)}function r(c){const{props:u}=e,d=Ia(e.parent)||{},l=[],f=new Set;let p={},g=1/0;for(let T=0;Tg&&b,R=!1;const L=Array.isArray(y)?y:[y];let _=L.reduce(i(v),{});P===!1&&(_={});const{prevResolvedValues:oe={}}=A,J={...oe,..._},ge=V=>{x=!0,f.has(V)&&(R=!0,f.delete(V)),A.needsAnimating[V]=!0;const W=e.getValue(V);W&&(W.liveStyle=!1)};for(const V in J){const W=_[V],ee=oe[V];if(p.hasOwnProperty(V))continue;let G=!1;$s(W)&&$s(ee)?G=!Va(W,ee):G=W!==ee,G?W!=null?ge(V):f.add(V):W!==void 0&&f.has(V)?ge(V):A.protectedKeys[V]=!0}A.prevProp=y,A.prevResolvedValues=_,A.isActive&&(p={...p,..._}),s&&e.blockInitialAnimation&&(x=!1);const Me=S&&I;x&&(!Me||R)&&l.push(...L.map(V=>{const W={type:v};if(typeof V=="string"&&s&&!Me&&e.manuallyAnimateOnMount&&e.parent){const{parent:ee}=e,G=Nt(ee,V);if(ee.enteringChildren&&G){const{delayChildren:Q}=G.transition||{};W.delay=na(ee.enteringChildren,e,Q)}}return{animation:V,options:W}}))}if(f.size){const T={};if(typeof u.initial!="boolean"){const v=Nt(e,Array.isArray(u.initial)?u.initial[0]:u.initial);v&&v.transition&&(T.transition=v.transition)}f.forEach(v=>{const A=e.getBaseTarget(v),y=e.getValue(v);y&&(y.liveStyle=!0),T[v]=A??null}),l.push({animation:T})}let w=!!l.length;return s&&(u.initial===!1||u.initial===u.animate)&&!e.manuallyAnimateOnMount&&(w=!1),s=!1,w?t(l):Promise.resolve()}function a(c,u){if(n[c].isActive===u)return Promise.resolve();e.variantChildren?.forEach(l=>l.animationState?.setActive(c,u)),n[c].isActive=u;const d=r(c);for(const l in n)n[l].protectedKeys={};return d}return{animateChanges:r,setActive:a,setAnimateFunction:o,getState:()=>n,reset:()=>{n=vr()}}}function Fd(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!Va(t,e):!1}function mt(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function vr(){return{animate:mt(!0),whileInView:mt(),whileHover:mt(),whileTap:mt(),whileDrag:mt(),whileFocus:mt(),exit:mt()}}function br(e,t){e.min=t.min,e.max=t.max}function $e(e,t){br(e.x,t.x),br(e.y,t.y)}function xr(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}const _a=1e-4,Bd=1-_a,$d=1+_a,ja=.01,zd=0-ja,Ud=0+ja;function Pe(e){return e.max-e.min}function Wd(e,t,n){return Math.abs(e-t)<=n}function wr(e,t,n,s=.5){e.origin=s,e.originPoint=Z(t.min,t.max,e.origin),e.scale=Pe(n)/Pe(t),e.translate=Z(n.min,n.max,e.origin)-e.originPoint,(e.scale>=Bd&&e.scale<=$d||isNaN(e.scale))&&(e.scale=1),(e.translate>=zd&&e.translate<=Ud||isNaN(e.translate))&&(e.translate=0)}function Jt(e,t,n,s){wr(e.x,t.x,n.x,s?s.originX:void 0),wr(e.y,t.y,n.y,s?s.originY:void 0)}function Sr(e,t,n){e.min=n.min+t.min,e.max=e.min+Pe(t)}function Hd(e,t,n){Sr(e.x,t.x,n.x),Sr(e.y,t.y,n.y)}function Tr(e,t,n){e.min=t.min-n.min,e.max=e.min+Pe(t)}function qn(e,t,n){Tr(e.x,t.x,n.x),Tr(e.y,t.y,n.y)}function Pr(e,t,n,s,i){return e-=t,e=Hn(e,1/n,s),i!==void 0&&(e=Hn(e,1/i,s)),e}function qd(e,t=0,n=1,s=.5,i,o=e,r=e){if(Ye.test(t)&&(t=parseFloat(t),t=Z(r.min,r.max,t/100)-r.min),typeof t!="number")return;let a=Z(o.min,o.max,s);e===o&&(a-=t),e.min=Pr(e.min,t,n,a,i),e.max=Pr(e.max,t,n,a,i)}function Ar(e,t,[n,s,i],o,r){qd(e,t[n],t[s],t[i],t.scale,o,r)}const Kd=["x","scaleX","originX"],Gd=["y","scaleY","originY"];function Er(e,t,n,s){Ar(e.x,t,Kd,n?n.x:void 0,s?s.x:void 0),Ar(e.y,t,Gd,n?n.y:void 0,s?s.y:void 0)}function Cr(e){return e.translate===0&&e.scale===1}function Na(e){return Cr(e.x)&&Cr(e.y)}function Dr(e,t){return e.min===t.min&&e.max===t.max}function Xd(e,t){return Dr(e.x,t.x)&&Dr(e.y,t.y)}function Rr(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function Oa(e,t){return Rr(e.x,t.x)&&Rr(e.y,t.y)}function kr(e){return Pe(e.x)/Pe(e.y)}function Mr(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function Xe(e){return[e("x"),e("y")]}function Yd(e,t,n){let s="";const i=e.x.translate/t.x,o=e.y.translate/t.y,r=n?.z||0;if((i||o||r)&&(s=`translate3d(${i}px, ${o}px, ${r}px) `),(t.x!==1||t.y!==1)&&(s+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:u,rotate:d,rotateX:l,rotateY:f,skewX:p,skewY:g}=n;u&&(s=`perspective(${u}px) ${s}`),d&&(s+=`rotate(${d}deg) `),l&&(s+=`rotateX(${l}deg) `),f&&(s+=`rotateY(${f}deg) `),p&&(s+=`skewX(${p}deg) `),g&&(s+=`skewY(${g}deg) `)}const a=e.x.scale*t.x,c=e.y.scale*t.y;return(a!==1||c!==1)&&(s+=`scale(${a}, ${c})`),s||"none"}const Fa=["TopLeft","TopRight","BottomLeft","BottomRight"],Qd=Fa.length,Lr=e=>typeof e=="string"?parseFloat(e):e,Ir=e=>typeof e=="number"||k.test(e);function Zd(e,t,n,s,i,o){i?(e.opacity=Z(0,n.opacity??1,Jd(s)),e.opacityExit=Z(t.opacity??1,0,ef(s))):o&&(e.opacity=Z(t.opacity??1,n.opacity??1,s));for(let r=0;rst?1:n(sn(e,t,s))}function tf(e,t,n){const s=xe(e)?e:Ft(e);return s.start(Si("",s,t,n)),s.animation}function ln(e,t,n,s={passive:!0}){return e.addEventListener(t,n,s),()=>e.removeEventListener(t,n)}const nf=(e,t)=>e.depth-t.depth;class sf{constructor(){this.children=[],this.isDirty=!1}add(t){oi(this.children,t),this.isDirty=!0}remove(t){Bn(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(nf),this.isDirty=!1,this.children.forEach(t)}}function rf(e,t){const n=Te.now(),s=({timestamp:i})=>{const o=i-n;o>=t&&(ot(s),e(o-t))};return Y.setup(s,!0),()=>ot(s)}function _n(e){return xe(e)?e.get():e}class of{constructor(){this.members=[]}add(t){oi(this.members,t);for(let n=this.members.length-1;n>=0;n--){const s=this.members[n];if(s===t||s===this.lead||s===this.prevLead)continue;const i=s.instance;i&&i.isConnected===!1&&s.isPresent!==!1&&!s.snapshot&&Bn(this.members,s)}t.scheduleRender()}remove(t){if(Bn(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(i=>t===i);if(n===0)return!1;let s;for(let i=n;i>=0;i--){const o=this.members[i],r=o.instance;if(o.isPresent!==!1&&(!r||r.isConnected!==!1)){s=o;break}}return s?(this.promote(s),!0):!1}promote(t,n){const s=this.lead;if(t!==s&&(this.prevLead=s,this.lead=t,t.show(),s)){s.instance&&s.scheduleRender(),t.scheduleRender();const i=s.options.layoutDependency,o=t.options.layoutDependency;if(!(i!==void 0&&o!==void 0&&i===o)){const c=s.instance;c&&c.isConnected===!1&&!s.snapshot||(t.resumeFrom=s,n&&(t.resumeFrom.preserveOpacity=!0),s.snapshot&&(t.snapshot=s.snapshot,t.snapshot.latestValues=s.animationValues||s.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0))}const{crossfade:a}=t.options;a===!1&&s.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:s}=t;n.onExitComplete&&n.onExitComplete(),s&&s.options.onExitComplete&&s.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}const jn={hasAnimatedSinceResize:!0,hasEverUpdated:!1},fs=["","X","Y","Z"],af=1e3;let lf=0;function hs(e,t,n,s){const{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),s&&(s[e]=0))}function $a(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=aa(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:i,layoutId:o}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",Y,!(i||o))}const{parent:s}=e;s&&!s.hasCheckedOptimisedAppear&&$a(s)}function za({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:s,resetTransform:i}){return class{constructor(r={},a=t?.()){this.id=lf++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(df),this.nodes.forEach(mf),this.nodes.forEach(gf),this.nodes.forEach(ff)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=r,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let c=0;cthis.root.updateBlockedByResize=!1;Y.read(()=>{l=window.innerWidth}),e(r,()=>{const p=window.innerWidth;p!==l&&(l=p,this.root.updateBlockedByResize=!0,d&&d(),d=rf(f,250),jn.hasAnimatedSinceResize&&(jn.hasAnimatedSinceResize=!1,this.nodes.forEach(Nr)))})}a&&this.root.registerSharedNode(a,this),this.options.animate!==!1&&u&&(a||c)&&this.addEventListener("didUpdate",({delta:d,hasLayoutChanged:l,hasRelativeLayoutChanged:f,layout:p})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const g=this.options.transition||u.getDefaultTransition()||wf,{onLayoutAnimationStart:w,onLayoutAnimationComplete:T}=u.getProps(),v=!this.targetLayout||!Oa(this.targetLayout,p),A=!l&&f;if(this.options.layoutRoot||this.resumeFrom||A||l&&(v||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const y={...wi(g,"layout"),onPlay:w,onComplete:T};(u.shouldReduceMotion||this.options.layoutRoot)&&(y.delay=0,y.type=!1),this.startAnimation(y),this.setAnimationOrigin(d,A)}else l||Nr(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=p})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const r=this.getStack();r&&r.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),ot(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(yf),this.animationId++)}getTransformTemplate(){const{visualElement:r}=this.options;return r&&r.getProps().transformTemplate}willUpdate(r=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&$a(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!Pe(this.snapshot.measuredBox.x)&&!Pe(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let c=0;c{const P=b/1e3;Or(l.x,r.x,P),Or(l.y,r.y,P),this.setTargetDelta(l),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(qn(f,this.layout.layoutBox,this.relativeParent.layout.layoutBox),bf(this.relativeTarget,this.relativeTargetOrigin,f,P),y&&Xd(this.relativeTarget,y)&&(this.isProjectionDirty=!1),y||(y=de()),$e(y,this.relativeTarget)),w&&(this.animationValues=d,Zd(d,u,this.latestValues,P,A,v)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=P},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(r){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(ot(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Y.update(()=>{jn.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Ft(0)),this.currentAnimation=tf(this.motionValue,[0,1e3],{...r,velocity:0,isSync:!0,onUpdate:a=>{this.mixTargetDelta(a),r.onUpdate&&r.onUpdate(a)},onStop:()=>{},onComplete:()=>{r.onComplete&&r.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const r=this.getStack();r&&r.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(af),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const r=this.getLead();let{targetWithTransforms:a,target:c,layout:u,latestValues:d}=r;if(!(!a||!c||!u)){if(this!==r&&this.layout&&u&&Ua(this.options.animationType,this.layout.layoutBox,u.layoutBox)){c=this.target||de();const l=Pe(this.layout.layoutBox.x);c.x.min=r.target.x.min,c.x.max=c.x.min+l;const f=Pe(this.layout.layoutBox.y);c.y.min=r.target.y.min,c.y.max=c.y.min+f}$e(a,c),jt(a,d),Jt(this.projectionDeltaWithTransform,this.layoutCorrected,a,d)}}registerSharedNode(r,a){this.sharedNodes.has(r)||this.sharedNodes.set(r,new of),this.sharedNodes.get(r).add(a);const u=a.options.initialPromotionConfig;a.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(a):void 0})}isLead(){const r=this.getStack();return r?r.lead===this:!0}getLead(){const{layoutId:r}=this.options;return r?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:r}=this.options;return r?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:r}=this.options;if(r)return this.root.sharedNodes.get(r)}promote({needsReset:r,transition:a,preserveFollowOpacity:c}={}){const u=this.getStack();u&&u.promote(this,c),r&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const r=this.getStack();return r?r.relegate(this):!1}resetSkewAndRotation(){const{visualElement:r}=this.options;if(!r)return;let a=!1;const{latestValues:c}=r;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(a=!0),!a)return;const u={};c.z&&hs("z",r,u,this.animationValues);for(let d=0;dr.currentAnimation?.stop()),this.root.nodes.forEach(_r),this.root.sharedNodes.clear()}}}function cf(e){e.updateLayout()}function uf(e){const t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:s}=e.layout,{animationType:i}=e.options,o=t.source!==e.layout.source;i==="size"?Xe(d=>{const l=o?t.measuredBox[d]:t.layoutBox[d],f=Pe(l);l.min=n[d].min,l.max=l.min+f}):Ua(i,t.layoutBox,n)&&Xe(d=>{const l=o?t.measuredBox[d]:t.layoutBox[d],f=Pe(n[d]);l.max=l.min+f,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[d].max=e.relativeTarget[d].min+f)});const r=Vt();Jt(r,n,t.layoutBox);const a=Vt();o?Jt(a,e.applyTransform(s,!0),t.measuredBox):Jt(a,n,t.layoutBox);const c=!Na(r);let u=!1;if(!e.resumeFrom){const d=e.getClosestProjectingParent();if(d&&!d.resumeFrom){const{snapshot:l,layout:f}=d;if(l&&f){const p=de();qn(p,t.layoutBox,l.layoutBox);const g=de();qn(g,n,f.layoutBox),Oa(p,g)||(u=!0),d.options.layoutRoot&&(e.relativeTarget=g,e.relativeTargetOrigin=p,e.relativeParent=d)}}}e.notifyListeners("didUpdate",{layout:n,snapshot:t,delta:a,layoutDelta:r,hasLayoutChanged:c,hasRelativeLayoutChanged:u})}else if(e.isLead()){const{onExitComplete:n}=e.options;n&&n()}e.options.transition=void 0}function df(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function ff(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function hf(e){e.clearSnapshot()}function _r(e){e.clearMeasurements()}function jr(e){e.isLayoutDirty=!1}function pf(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function Nr(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function mf(e){e.resolveTargetDelta()}function gf(e){e.calcProjection()}function yf(e){e.resetSkewAndRotation()}function vf(e){e.removeLeadSnapshot()}function Or(e,t,n){e.translate=Z(t.translate,0,n),e.scale=Z(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function Fr(e,t,n,s){e.min=Z(t.min,n.min,s),e.max=Z(t.max,n.max,s)}function bf(e,t,n,s){Fr(e.x,t.x,n.x,s),Fr(e.y,t.y,n.y,s)}function xf(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const wf={duration:.45,ease:[.4,0,.1,1]},Br=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),$r=Br("applewebkit/")&&!Br("chrome/")?Math.round:Fe;function zr(e){e.min=$r(e.min),e.max=$r(e.max)}function Sf(e){zr(e.x),zr(e.y)}function Ua(e,t,n){return e==="position"||e==="preserve-aspect"&&!Wd(kr(t),kr(n),.2)}function Tf(e){return e!==e.root&&e.scroll?.wasRoot}const Pf=za({attachResizeListener:(e,t)=>ln(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),ps={current:void 0},Wa=za({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!ps.current){const e=new Pf({});e.mount(window),e.setOptions({layoutScroll:!0}),ps.current=e}return ps.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),Ii=h.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function Ur(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Af(...e){return t=>{let n=!1;const s=e.map(i=>{const o=Ur(i,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let i=0;i{const{width:f,height:p,top:g,left:w,right:T,bottom:v}=c.current;if(t||o===!1||!a.current||!f||!p)return;const A=n==="left"?`left: ${w}`:`right: ${T}`,y=s==="bottom"?`bottom: ${v}`:`top: ${g}`;a.current.dataset.motionPopId=r;const b=document.createElement("style");u&&(b.nonce=u);const P=i??document.head;return P.appendChild(b),b.sheet&&b.sheet.insertRule(` [data-motion-pop-id="${r}"] { position: absolute !important; @@ -67,11 +67,11 @@ import{r as h,j as m,c as C,b as Sl,e as Tl}from"./vendor-react-Dexh7fmo.js";imp * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const sp=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],ip=ut("zap",sp),Xt=({message:e="Loading MathPulse AI..."})=>{const[t,n]=h.useState(!1),s={position:"fixed",inset:0,zIndex:50,display:"flex",alignItems:"center",justifyContent:"center",padding:"1rem",background:"#f7f9fc"},i={width:"min(100%, 24rem)",padding:"2rem",borderRadius:"2rem",border:"1px solid #dde3eb",background:"#ffffff",boxShadow:"0 24px 40px rgba(56, 189, 248, 0.12)",display:"flex",flexDirection:"column",alignItems:"center",gap:"1.5rem"},o={width:"6rem",height:"6rem",borderRadius:"1.5rem",border:"2px solid #ffffff",background:"linear-gradient(135deg, #e0f2fe 0%, #e0e7ff 100%)",boxShadow:"0 12px 24px rgba(15, 23, 42, 0.12)",display:"flex",alignItems:"center",justifyContent:"center"},r={width:"4rem",height:"4rem",objectFit:"contain",filter:"drop-shadow(0 8px 12px rgba(15, 23, 42, 0.2))"},a={marginTop:"0.5rem",display:"flex",alignItems:"center",justifyContent:"center",gap:"0.5rem"},c={width:"1rem",height:"1rem",borderRadius:"999px",border:"2px solid #0284c7",borderTopColor:"transparent"},u={margin:0,fontSize:"1.25rem",fontWeight:700,color:"#0a1628"},d={margin:0,fontSize:"0.875rem",fontWeight:600,color:"#64748b"};return m.jsx("div",{className:"app-loader-screen",style:s,role:"status","aria-live":"polite","aria-busy":"true","aria-label":e,children:m.jsxs(Nn.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},transition:{duration:.4,ease:"easeOut"},className:"app-loader-card",style:i,children:[m.jsxs(Nn.div,{animate:{y:[0,-10,0]},transition:{duration:2,repeat:1/0,ease:"easeInOut"},className:"app-loader-avatar-shell",style:o,children:[m.jsx("img",{src:"/avatar/avatar_icon.png",alt:"Loading...",className:"app-loader-avatar",style:{...r,display:t?"none":"block"},onError:()=>{n(!0)}}),m.jsx(qh,{className:"app-loader-bot-icon",style:{display:t?"block":"none"}})]}),m.jsxs("div",{className:"app-loader-copy",children:[m.jsx("h2",{className:"app-loader-title",style:u,children:"MathPulse AI"}),m.jsxs("div",{className:"app-loader-message-row",style:a,children:[m.jsx(Nn.div,{animate:{rotate:360},transition:{duration:1.5,repeat:1/0,ease:"linear"},className:"app-loader-spinner",style:c}),m.jsx("p",{className:"app-loader-message",style:d,children:e})]})]})]})})},rp=e=>{if(!e||e.includes("your_project")||e.includes("your_database")||e.includes("your_"))return!1;try{const t=new URL(e);return t.protocol!=="https:"?!1:t.hostname.endsWith(".firebaseio.com")||t.hostname.endsWith(".firebasedatabase.app")}catch{return!1}},Zs="".trim(),cn=rp(Zs)?Zs:"";Zs&&!cn&&console.warn("[FIREBASE] VITE_FIREBASE_DATABASE_URL is set but invalid. Expected an https URL ending in .firebaseio.com or .firebasedatabase.app. RTDB presence is disabled.");const Ot={apiKey:"AIzaSyBtKDbf3CoNSJHMX2W-Bfru8qEX2mKm03Y",authDomain:"mathpulse-ai-2026.firebaseapp.com",projectId:"mathpulse-ai-2026",storageBucket:"mathpulse-ai-2026.firebasestorage.app",messagingSenderId:"441656461",appId:"1:441656461:web:68f877c7bdde7065ec2ec4",measurementId:void 0,...cn?{databaseURL:cn}:{}};Ot.apiKey||console.error("[ERROR] Firebase API key is missing! Copy .env.example to .env.local and fill in your values.");console.log("[FIREBASE] Config:",{projectId:Ot.projectId,authDomain:Ot.authDomain,configured:!!Ot.apiKey});const Wt=Il(Ot),lt=Pl(Wt),q=Nl(Wt);Bl(Wt);const op=Vl(Wt),ap="".toLowerCase()==="true";if(ap){const e="127.0.0.1".trim()||"127.0.0.1",t=5001,n=Number.isFinite(t)&&t>0?Math.floor(t):5001;_l(op,e,n),console.log(`[FIREBASE] Functions emulator enabled at ${e}:${n}`)}const mg=cn?jl(Wt,cn):null;typeof window<"u"&&Ot.measurementId&&$l(Wt);new Al;const Js="mathpulse.pendingAuthRole",rl="mathpulse.lastAuthRole",lp=e=>{if(e==="admin")throw new Error("Admin account creation is restricted. Please contact an existing administrator.")},gg=e=>{try{localStorage.setItem(Js,e),localStorage.setItem(rl,e)}catch{}},cp=()=>{try{const e=localStorage.getItem(Js);return localStorage.removeItem(Js),e==="student"||e==="teacher"||e==="admin"?e:null}catch{return null}},up=()=>{try{const e=localStorage.getItem(rl);return e==="student"||e==="teacher"||e==="admin"?e:null}catch{return null}},yg=async(e,t,n,s,i={})=>{try{lp(s);const r=(await El(lt,e,t)).user;return await Cl(r,{displayName:n}),await ol(r,s,i)}catch(o){const r=o;throw console.error("[ERROR] Error signing up:",{code:r.code,message:r.message,fullError:o}),new Error(r.message||"Failed to create account")}},vg=async(e,t)=>{try{console.log("[AUTH] Attempting sign in...",{email:e}),await Dl(lt,e,t),console.log("[OK] Sign in successful, AuthContext will handle profile creation")}catch(n){const s=n;throw console.error("[ERROR] Error signing in:",{code:s.code,message:s.message,fullError:n}),new Error(s.message||"Failed to sign in")}},dp=async()=>{try{await Rl(lt)}catch(e){throw console.error("Error signing out:",e),new Error(e instanceof Error?e.message:"Failed to sign out")}},ol=async(e,t,n)=>{const s=`${Date.now()}`.slice(-12).padStart(12,"0"),i={uid:e.uid,email:e.email||"",name:e.displayName||n.name||"User",role:t,photo:e.photoURL||"",createdAt:he(),updatedAt:he()},o=(()=>{switch(t){case"student":return{lrn:n.lrn||s,grade:n.grade||"Grade 11",section:n.section||"Section A",classSectionId:n.classSectionId||"",adviserTeacherId:n.adviserTeacherId||"",adviserTeacherName:n.adviserTeacherName||"",schoolYear:n.schoolYear||"",school:n.school||"",enrollmentDate:new Date().toISOString().split("T")[0],major:n.major||"General",gpa:n.gpa||"0.00",level:1,currentXP:0,totalXP:0,streak:0,atRiskSubjects:[],hasTakenDiagnostic:!1,iarAssessmentState:"not_started",startingQuarterG11:"Q1",recommendedPace:"normal"};case"teacher":return{teacherId:`TCH-${Date.now()}`,department:n.department||"Mathematics",subject:n.subject||"Mathematics",yearsOfExperience:n.yearsOfExperience||"0",qualification:n.qualification||"",students:[]};case"admin":return{adminId:`ADM-${Date.now()}`,position:n.position||"Administrator",department:n.department||"System"}}})(),r={...i,...o};return await He(se(q,"users",e.uid),r),r},ei=async e=>{try{const t=se(q,"users",e),n=await ke(t);return n.exists()?{...n.data(),uid:n.id}:null}catch(t){return console.error("Error getting user profile:",t),null}},ws=async(e,t)=>{try{const n=await ei(e);if(!n)throw new Error("Profile not found");const s=["name","email","phone","photo","avatarLayers"],i={student:["lrn","grade","section","school","enrollmentDate","major","gpa"],teacher:["department","subject","yearsOfExperience","qualification"],admin:["department","position"]},o=new Set([...s,...i[n.role]]),r={};Object.entries(t).forEach(([c,u])=>{u!==void 0&&o.has(c)&&(r[c]=u)});const a=se(q,"users",e);await He(a,{...r,updatedAt:he()},{merge:!0})}catch(n){throw console.error("Error updating user profile:",n),n}},fp=async e=>{if(!lt.currentUser)throw new Error("No user logged in");await Ml(lt.currentUser,e)},hp=async e=>{if(!lt.currentUser)throw new Error("No user logged in");await kl(lt.currentUser);try{await Ol(se(q,"users",e))}catch(t){console.warn("User auth deleted but profile document cleanup failed:",t)}},al=h.createContext({currentUser:null,userProfile:null,loading:!0,isLoggedIn:!1,userRole:"student",refreshProfile:async()=>{}}),ll=()=>{const e=h.useContext(al);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e},pp=({children:e})=>{const[t,n]=h.useState(null),[s,i]=h.useState(null),[o,r]=h.useState(!0),[a,c]=h.useState("student"),u=f=>{if(!f)return null;const p=f.trim().toLowerCase();return p==="testteacher@school.edu"?"teacher":p==="testadmin@school.edu"?"admin":p==="teststudent@school.edu"?"student":null};h.useEffect(()=>Ll(lt,async p=>{if(r(!0),n(p),p){const g=cp()||up()||u(p.email)||"student",w=g==="admin"?"student":g;let T=await ei(p.uid);if(!T&&p.email){console.log("[WARN] AuthContext: Profile missing, auto-creating...");const v=w,A=p.displayName||"User";try{T=await ol(p,v,{name:A}),console.log("[OK] AuthContext: Profile auto-created:",{role:v,name:A}),v==="student"&&H(async()=>{const{triggerStudentEnrolled:y}=await import("./automationService-BD3AWvKJ.js");return{triggerStudentEnrolled:y}},__vite__mapDeps([0,1,2,3,4,5,6])).then(({triggerStudentEnrolled:y})=>y({lrn:T?.lrn||p.uid,name:A,email:p.email||"",gradeLevel:""})).catch(y=>console.error("[WARN] Automation: enrollment pipeline failed:",y))}catch(y){console.error("[ERROR] AuthContext: Failed to auto-create profile:",y)}}T?(c(T.role),i(T)):(c(w),i({uid:p.uid,email:p.email||"",name:p.displayName||"User",role:w,photo:p.photoURL||"",createdAt:new Date,updatedAt:new Date}))}else c("student"),i(null);r(!1)}),[]);const d=async()=>{if(t){const f=await ei(t.uid);f&&i(f)}},l={currentUser:t,userProfile:s,loading:o,isLoggedIn:!!t,userRole:s?.role||a,refreshProfile:d};return m.jsx(al.Provider,{value:l,children:e})},mp=/(```[\s\S]*?```|`[^`\n]+`)/g,gp=/(\$\$[\s\S]*?\$\$|\$[^$\n]+\$|\\\([\s\S]*?\\\)|\\\[[\s\S]*?\\\])/g,yp=/\\(?:boxed\{[^{}]+\}|frac\{[^{}]+\}\{[^{}]+\}|sqrt\{[^{}]+\}|(?:cdot|times|pm|mp|leq|geq|neq|approx|alpha|beta|gamma|delta|theta|pi|sum|int)(?:_[a-zA-Z0-9]+|_\{[^{}]+\})?(?:\^[a-zA-Z0-9]+|\^\{[^{}]+\})?)/g,vp=/<\s*think\b[^>]*>[\s\S]*?<\s*\/\s*think\s*>/gi,bp=/<\s*\/?\s*think\b[^>]*>/gi,xp=/<\s*\/\s*think\s*>/gi,wp=/<\s*(\/?)\s*think\b([\s\S]*?)>/gi,Sp=/(?:<\s*\/?\s*t(?:h(?:i(?:n(?:k)?)?)?)?)\s*$/i,Tp=/(?:<\s*\/?\s*t(?:h(?:i(?:n(?:k)?)?)?)?)\s*$/i,Pp=/\bfinal\s+answer\s*:|(?:^|\n)\s*#{1,6}\s+\S|(?:^|\n)\s*(?:answer|solution)\s*:|(?:^|\n)\s*here(?:'s| is)\b|(?:^|\n)\s*(?:\d+[.)]|[-*])\s+\S/i,Ap=/^\s*(?:okay|alright|let\s+me|i\s+should|i\s+need\s+to|i\s+will|wait|hmm|maybe|the\s+user\s+asked|let\s+us|let's)\b/i;function cl(e){return e.replace(wp,(t,n,s)=>`<${n?"/":""}think${s}>`)}function Ep(e,t){t.lastIndex=0;let n=-1,s=t.exec(e);for(;s;)n=s.index+s[0].length,s=t.exec(e);return n}function Cp(e){const t=cl(e);if(/<\s*think\b/i.test(t))return"";const n=Ep(t,xp);return n===-1?"":t.slice(n).trim()}function Dp(e){const t=e.replace(/\r\n?/g,` + */const sp=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],ip=ut("zap",sp),Xt=({message:e="Loading MathPulse AI..."})=>{const[t,n]=h.useState(!1),s={position:"fixed",inset:0,zIndex:50,display:"flex",alignItems:"center",justifyContent:"center",padding:"1rem",background:"#f7f9fc"},i={width:"min(100%, 24rem)",padding:"2rem",borderRadius:"2rem",border:"1px solid #dde3eb",background:"#ffffff",boxShadow:"0 24px 40px rgba(56, 189, 248, 0.12)",display:"flex",flexDirection:"column",alignItems:"center",gap:"1.5rem"},o={width:"6rem",height:"6rem",borderRadius:"1.5rem",border:"2px solid #ffffff",background:"linear-gradient(135deg, #e0f2fe 0%, #e0e7ff 100%)",boxShadow:"0 12px 24px rgba(15, 23, 42, 0.12)",display:"flex",alignItems:"center",justifyContent:"center"},r={width:"4rem",height:"4rem",objectFit:"contain",filter:"drop-shadow(0 8px 12px rgba(15, 23, 42, 0.2))"},a={marginTop:"0.5rem",display:"flex",alignItems:"center",justifyContent:"center",gap:"0.5rem"},c={width:"1rem",height:"1rem",borderRadius:"999px",border:"2px solid #0284c7",borderTopColor:"transparent"},u={margin:0,fontSize:"1.25rem",fontWeight:700,color:"#0a1628"},d={margin:0,fontSize:"0.875rem",fontWeight:600,color:"#64748b"};return m.jsx("div",{className:"app-loader-screen",style:s,role:"status","aria-live":"polite","aria-busy":"true","aria-label":e,children:m.jsxs(Nn.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},transition:{duration:.4,ease:"easeOut"},className:"app-loader-card",style:i,children:[m.jsxs(Nn.div,{animate:{y:[0,-10,0]},transition:{duration:2,repeat:1/0,ease:"easeInOut"},className:"app-loader-avatar-shell",style:o,children:[m.jsx("img",{src:"/avatar/avatar_icon.png",alt:"Loading...",className:"app-loader-avatar",style:{...r,display:t?"none":"block"},onError:()=>{n(!0)}}),m.jsx(qh,{className:"app-loader-bot-icon",style:{display:t?"block":"none"}})]}),m.jsxs("div",{className:"app-loader-copy",children:[m.jsx("h2",{className:"app-loader-title",style:u,children:"MathPulse AI"}),m.jsxs("div",{className:"app-loader-message-row",style:a,children:[m.jsx(Nn.div,{animate:{rotate:360},transition:{duration:1.5,repeat:1/0,ease:"linear"},className:"app-loader-spinner",style:c}),m.jsx("p",{className:"app-loader-message",style:d,children:e})]})]})]})})},rp=e=>{if(!e||e.includes("your_project")||e.includes("your_database")||e.includes("your_"))return!1;try{const t=new URL(e);return t.protocol!=="https:"?!1:t.hostname.endsWith(".firebaseio.com")||t.hostname.endsWith(".firebasedatabase.app")}catch{return!1}},Zs="".trim(),cn=rp(Zs)?Zs:"";Zs&&!cn&&console.warn("[FIREBASE] VITE_FIREBASE_DATABASE_URL is set but invalid. Expected an https URL ending in .firebaseio.com or .firebasedatabase.app. RTDB presence is disabled.");const Ot={apiKey:"AIzaSyBtKDbf3CoNSJHMX2W-Bfru8qEX2mKm03Y",authDomain:"mathpulse-ai-2026.firebaseapp.com",projectId:"mathpulse-ai-2026",storageBucket:"mathpulse-ai-2026.firebasestorage.app",messagingSenderId:"441656461",appId:"1:441656461:web:68f877c7bdde7065ec2ec4",measurementId:void 0,...cn?{databaseURL:cn}:{}};Ot.apiKey||console.error("[ERROR] Firebase API key is missing! Copy .env.example to .env.local and fill in your values.");console.log("[FIREBASE] Config:",{projectId:Ot.projectId,authDomain:Ot.authDomain,configured:!!Ot.apiKey});const Wt=Il(Ot),lt=Pl(Wt),q=Nl(Wt);Bl(Wt);const op=Vl(Wt),ap="".toLowerCase()==="true";if(ap){const e="127.0.0.1".trim()||"127.0.0.1",t=5001,n=Number.isFinite(t)&&t>0?Math.floor(t):5001;_l(op,e,n),console.log(`[FIREBASE] Functions emulator enabled at ${e}:${n}`)}const mg=cn?jl(Wt,cn):null;typeof window<"u"&&Ot.measurementId&&$l(Wt);new Al;const Js="mathpulse.pendingAuthRole",rl="mathpulse.lastAuthRole",lp=e=>{if(e==="admin")throw new Error("Admin account creation is restricted. Please contact an existing administrator.")},gg=e=>{try{localStorage.setItem(Js,e),localStorage.setItem(rl,e)}catch{}},cp=()=>{try{const e=localStorage.getItem(Js);return localStorage.removeItem(Js),e==="student"||e==="teacher"||e==="admin"?e:null}catch{return null}},up=()=>{try{const e=localStorage.getItem(rl);return e==="student"||e==="teacher"||e==="admin"?e:null}catch{return null}},yg=async(e,t,n,s,i={})=>{try{lp(s);const r=(await El(lt,e,t)).user;return await Cl(r,{displayName:n}),await ol(r,s,i)}catch(o){const r=o;throw console.error("[ERROR] Error signing up:",{code:r.code,message:r.message,fullError:o}),new Error(r.message||"Failed to create account")}},vg=async(e,t)=>{try{console.log("[AUTH] Attempting sign in...",{email:e}),await Dl(lt,e,t),console.log("[OK] Sign in successful, AuthContext will handle profile creation")}catch(n){const s=n;throw console.error("[ERROR] Error signing in:",{code:s.code,message:s.message,fullError:n}),new Error(s.message||"Failed to sign in")}},dp=async()=>{try{await Rl(lt)}catch(e){throw console.error("Error signing out:",e),new Error(e instanceof Error?e.message:"Failed to sign out")}},ol=async(e,t,n)=>{const s=`${Date.now()}`.slice(-12).padStart(12,"0"),i={uid:e.uid,email:e.email||"",name:e.displayName||n.name||"User",role:t,photo:e.photoURL||"",createdAt:he(),updatedAt:he()},o=(()=>{switch(t){case"student":return{lrn:n.lrn||s,grade:n.grade||"Grade 11",section:n.section||"Section A",classSectionId:n.classSectionId||"",adviserTeacherId:n.adviserTeacherId||"",adviserTeacherName:n.adviserTeacherName||"",schoolYear:n.schoolYear||"",school:n.school||"",enrollmentDate:new Date().toISOString().split("T")[0],major:n.major||"General",gpa:n.gpa||"0.00",level:1,currentXP:0,totalXP:0,streak:0,atRiskSubjects:[],hasTakenDiagnostic:!1,iarAssessmentState:"not_started",startingQuarterG11:"Q1",recommendedPace:"normal"};case"teacher":return{teacherId:`TCH-${Date.now()}`,department:n.department||"Mathematics",subject:n.subject||"Mathematics",yearsOfExperience:n.yearsOfExperience||"0",qualification:n.qualification||"",students:[]};case"admin":return{adminId:`ADM-${Date.now()}`,position:n.position||"Administrator",department:n.department||"System"}}})(),r={...i,...o};return await He(se(q,"users",e.uid),r),r},ei=async e=>{try{const t=se(q,"users",e),n=await ke(t);return n.exists()?{...n.data(),uid:n.id}:null}catch(t){return console.error("Error getting user profile:",t),null}},ws=async(e,t)=>{try{const n=await ei(e);if(!n)throw new Error("Profile not found");const s=["name","email","phone","photo","avatarLayers"],i={student:["lrn","grade","section","school","enrollmentDate","major","gpa"],teacher:["department","subject","yearsOfExperience","qualification"],admin:["department","position"]},o=new Set([...s,...i[n.role]]),r={};Object.entries(t).forEach(([c,u])=>{u!==void 0&&o.has(c)&&(r[c]=u)});const a=se(q,"users",e);await He(a,{...r,updatedAt:he()},{merge:!0})}catch(n){throw console.error("Error updating user profile:",n),n}},fp=async e=>{if(!lt.currentUser)throw new Error("No user logged in");await Ml(lt.currentUser,e)},hp=async e=>{if(!lt.currentUser)throw new Error("No user logged in");await kl(lt.currentUser);try{await Ol(se(q,"users",e))}catch(t){console.warn("User auth deleted but profile document cleanup failed:",t)}},al=h.createContext({currentUser:null,userProfile:null,loading:!0,isLoggedIn:!1,userRole:"student",refreshProfile:async()=>{}}),ll=()=>{const e=h.useContext(al);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e},pp=({children:e})=>{const[t,n]=h.useState(null),[s,i]=h.useState(null),[o,r]=h.useState(!0),[a,c]=h.useState("student"),u=f=>{if(!f)return null;const p=f.trim().toLowerCase();return p==="testteacher@school.edu"?"teacher":p==="testadmin@school.edu"?"admin":p==="teststudent@school.edu"?"student":null};h.useEffect(()=>Ll(lt,async p=>{if(r(!0),n(p),p){const g=cp()||up()||u(p.email)||"student",w=g==="admin"?"student":g;let T=await ei(p.uid);if(!T&&p.email){console.log("[WARN] AuthContext: Profile missing, auto-creating...");const v=w,A=p.displayName||"User";try{T=await ol(p,v,{name:A}),console.log("[OK] AuthContext: Profile auto-created:",{role:v,name:A}),v==="student"&&H(async()=>{const{triggerStudentEnrolled:y}=await import("./automationService-b2P2XC_p.js");return{triggerStudentEnrolled:y}},__vite__mapDeps([0,1,2,3,4,5,6])).then(({triggerStudentEnrolled:y})=>y({lrn:T?.lrn||p.uid,name:A,email:p.email||"",gradeLevel:""})).catch(y=>console.error("[WARN] Automation: enrollment pipeline failed:",y))}catch(y){console.error("[ERROR] AuthContext: Failed to auto-create profile:",y)}}T?(c(T.role),i(T)):(c(w),i({uid:p.uid,email:p.email||"",name:p.displayName||"User",role:w,photo:p.photoURL||"",createdAt:new Date,updatedAt:new Date}))}else c("student"),i(null);r(!1)}),[]);const d=async()=>{if(t){const f=await ei(t.uid);f&&i(f)}},l={currentUser:t,userProfile:s,loading:o,isLoggedIn:!!t,userRole:s?.role||a,refreshProfile:d};return m.jsx(al.Provider,{value:l,children:e})},mp=/(```[\s\S]*?```|`[^`\n]+`)/g,gp=/(\$\$[\s\S]*?\$\$|\$[^$\n]+\$|\\\([\s\S]*?\\\)|\\\[[\s\S]*?\\\])/g,yp=/\\(?:boxed\{[^{}]+\}|frac\{[^{}]+\}\{[^{}]+\}|sqrt\{[^{}]+\}|(?:cdot|times|pm|mp|leq|geq|neq|approx|alpha|beta|gamma|delta|theta|pi|sum|int)(?:_[a-zA-Z0-9]+|_\{[^{}]+\})?(?:\^[a-zA-Z0-9]+|\^\{[^{}]+\})?)/g,vp=/<\s*think\b[^>]*>[\s\S]*?<\s*\/\s*think\s*>/gi,bp=/<\s*\/?\s*think\b[^>]*>/gi,xp=/<\s*\/\s*think\s*>/gi,wp=/<\s*(\/?)\s*think\b([\s\S]*?)>/gi,Sp=/(?:<\s*\/?\s*t(?:h(?:i(?:n(?:k)?)?)?)?)\s*$/i,Tp=/(?:<\s*\/?\s*t(?:h(?:i(?:n(?:k)?)?)?)?)\s*$/i,Pp=/\bfinal\s+answer\s*:|(?:^|\n)\s*#{1,6}\s+\S|(?:^|\n)\s*(?:answer|solution)\s*:|(?:^|\n)\s*here(?:'s| is)\b|(?:^|\n)\s*(?:\d+[.)]|[-*])\s+\S/i,Ap=/^\s*(?:okay|alright|let\s+me|i\s+should|i\s+need\s+to|i\s+will|wait|hmm|maybe|the\s+user\s+asked|let\s+us|let's)\b/i;function cl(e){return e.replace(wp,(t,n,s)=>`<${n?"/":""}think${s}>`)}function Ep(e,t){t.lastIndex=0;let n=-1,s=t.exec(e);for(;s;)n=s.index+s[0].length,s=t.exec(e);return n}function Cp(e){const t=cl(e);if(/<\s*think\b/i.test(t))return"";const n=Ep(t,xp);return n===-1?"":t.slice(n).trim()}function Dp(e){const t=e.replace(/\r\n?/g,` `).trim();if(!t)return"";const n=Pp.exec(t);return n&&typeof n.index=="number"?t.slice(n.index).trim():t.split(` `).map(o=>o.trim()).filter(o=>o&&Ap.test(o)).length>=2?"":t}function ti(e,t={}){if(!e||typeof e!="string")return"";let n=cl(e),s="";for(;n!==s;)s=n,n=n.replace(vp,"");if(!t.preserveUnclosedThinkBlocks){const i=n.toLowerCase(),o=i.lastIndexOf("");o!==-1&&o>r&&(n=n.slice(0,o))}return n=n.replace(bp,""),t.streamingSafeTail&&(n=n.replace(Sp,"").replace(Tp,"")),n}function Rp(e){return ti(e,{streamingSafeTail:!0}).trim()}function je(e){const t=Cp(e);if(t)return t;const n=ti(e,{streamingSafeTail:!0}).trim();if(n)return n;const s=ti(e,{streamingSafeTail:!0,preserveUnclosedThinkBlocks:!0}).trim();return Dp(s)}function kp(e){return e.replace(yp,t=>`$${t}$`)}function Mp(e){return!e||typeof e!="string"?"":je(e).replace(/\r\n?/g,` `).split(mp).map((i,o)=>o%2===1?i:i.replace(/\\\\(?=(?:boxed|frac|sqrt|cdot|times|pm|mp|leq|geq|neq|approx|alpha|beta|gamma|delta|theta|pi|sum|int)\b|[()[\]{}])/g,"\\").replace(/\\n/g,` -`).split(gp).map((c,u)=>u%2===1?c:kp(c)).join("")).join("")}const Lp=80;function Ss(e,t=Lp){if(!e||typeof e!="string")return"";const n=Mp(e).replace(/!\[([^\]]*)\]\([^)]+\)/g,"$1").replace(/\[([^\]]+)\]\(([^)]+)\)/g,"$1").replace(/```(?:[a-zA-Z0-9_-]+\n)?([\s\S]*?)```/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/\$\$([\s\S]+?)\$\$/g,"$1").replace(/\$([^$\n]+)\$/g,"$1").replace(/\\\(([\s\S]+?)\\\)/g,"$1").replace(/\\\[([\s\S]+?)\\\]/g,"$1").replace(/^\s{0,3}#{1,6}\s+/gm,"").replace(/^\s{0,3}>\s?/gm,"").replace(/^\s{0,3}(?:[-*+]|\d+\.)\s+/gm,"").replace(/^\s{0,3}(?:[-*_]\s?){3,}$/gm," ").replace(/\\boxed\{([^{}]+)\}/g,"$1").replace(/\\frac\{([^{}]+)\}\{([^{}]+)\}/g,"$1/$2").replace(/\\sqrt\{([^{}]+)\}/g,"sqrt($1)").replace(/\\(?:cdot|times)/g,"*").replace(/\\(alpha|beta|gamma|delta|theta|pi|sum|int|pm|mp|leq|geq|neq|approx)\b/g,"$1").replace(/\*\*([^*]+)\*\*/g,"$1").replace(/__([^_]+)__/g,"$1").replace(/\*([^*\n]+)\*/g,"$1").replace(/_([^_\n]+)_/g,"$1").replace(/~~([^~]+)~~/g,"$1").replace(/\*{2,}|_{2,}|~{2,}/g,"").replace(/`+/g,"").replace(/\|/g," ").replace(/\s+/g," ").trim();return n.length<=t?n:n.slice(0,t)}const Ip=/^\s*(?:hi|hello|hey|good\s+(?:morning|afternoon|evening))\b/i,Vp=/\b(?:thanks|thank\s+you|thank\s+u|ty)\b/i,ul=["Hi! I am MathPulse, your math tutor. I can help with algebra, geometry, calculus, and more. What math question would you like to try?","Hello! Great to see you. I am here for math topics and step-by-step solutions whenever you are ready."],dl=["You are very welcome. If you want, send another math question and we can work through it together.","Glad I could help. I am here anytime you want to practice more math."],ro=["That topic is outside my math scope, but I would be happy to help with mathematics like algebra, calculus, geometry, trigonometry, or statistics.","I focus on math-only support, so I may not be the best for that request. Share a math question and I will guide you step by step.","I am built for math tutoring, so I can best help with mathematical problems and explanations. If you want, ask me any math question next."],_p=["math","mathematics","algebra","geometry","trigonometry","calculus","statistics","probability","arithmetic","equation","inequality","function","graph","slope","derivative","integral","limit","matrix","determinant","fraction","percentage","ratio","polynomial","quadratic","logarithm","exponent","angle","triangle","circle","perimeter","area","volume","mean","median","mode","standard deviation","solve","simplify","factor","evaluate","compute","calculate"],jp=[/\d+\s*[%+\-*/^=]\s*[-+]?\d*/,/\b(?:sin|cos|tan|cot|sec|csc|log|ln|sqrt)\s*\(?/,/\b(?:differentiate|integrate|derive|proof|prove)\b/,/\b(?:x|y|z)\s*[=+\-*/^]\s*[-+]?\d/],Np=new Set(["go","continue","yes","ok","next","more"]),Op=[/\bshall\s+we\s+continue\b/i,/\b(?:would|do)\s+you\s+like\s+to\s+continue\b/i,/\b(?:want|need)\s+me\s+to\s+continue\b/i,/\bshould\s+(?:i|we)\s+continue\b/i,/\bcontinue\s*\?\s*$/i,/\b(?:ready\s+for|go\s+to)\s+the\s+next\s+step\b/i,/\bnext\s+step(?:s)?\s*\?\s*$/i,/\bkeep\s+going\s*\?\s*$/i],oo="I can continue once I know which math problem you mean. Please share the problem again or tell me which step to continue.";function En(e){return e.length===0?"":e[Math.floor(Math.random()*e.length)]??e[0]}function Fp(e){const t=(e??"").trim().toLowerCase();return t?_p.some(n=>t.includes(n))?!0:jp.some(n=>n.test(t)):!1}function Bp(e){return(e??"").trim().toLowerCase().replace(/\s+/g," ").replace(/[\p{P}]+$/gu,"")}function fl(e){const t=Bp(e);return t?Np.has(t):!1}function ao(e){const t=(e??"").trim();return t?Fp(t)?null:Ip.test(t)?En(ul):Vp.test(t)?En(dl):En(ro):En(ro)}function $p(e){const t=(e?.latestAssistantMessage??"").trim();if(t)return t;const n=e?.history??[];for(let s=n.length-1;s>=0;s-=1){const i=n[s],o=(i?.role??"").toLowerCase(),r=(i?.content??"").trim();if(r&&(o==="assistant"||o==="ai"))return r}return null}function zp(e){const t=$p(e);return t?Op.some(n=>n.test(t)):!1}function Up(e){const t=e?.history??[];for(let n=t.length-1;n>=0;n-=1){const s=t[n],i=(s?.role??"").toLowerCase(),o=(s?.content??"").trim();if(o&&i==="user"&&!fl(o))return o}return null}function Wp(e){return ul.includes(e)||dl.includes(e)}function hl(e,t){const n=ao(e);if(n===null)return null;if(!fl(e))return n;if(zp(t))return null;const s=Up(t);if(!s)return oo;const i=ao(s);return i===null?null:Wp(i)?oo:i}const pl=h.createContext(void 0);let Ts=null,Ps=null;const lo=()=>(Ts||(Ts=H(()=>import("./apiService-DnEZVkU5.js"),__vite__mapDeps([7,3,4,2,1,5,6]))),Ts),gt=()=>(Ps||(Ps=H(()=>import("./chatService-I0cWl26r.js"),__vite__mapDeps([8,1,2,3,4,5,6]))),Ps),Hp=new Set(["go","continue","next","more","yes","ok"]),qp=[/\b(?:end|finish|stop)\s+with(?:\s+the\s+(?:exact\s+)?(?:marker|text))?\s*[:\-]?\s*(["'`]?)([A-Za-z0-9_:\-]{2,96})\1/i,/\b(?:include|append)\s+(?:the\s+)?marker\s*[:\-]?\s*(["'`]?)([A-Za-z0-9_:\-]{2,96})\1/i];function mn(e){if(!e)return null;let t=e.trim();return!t||(t.length>=2&&t[0]===t[t.length-1]&&['"',"'","`"].includes(t[0])&&(t=t.slice(1,-1).trim()),t=t.replace(/[.,;\s]+$/g,""),!t)?null:t.slice(0,120)}function Kp(e){return(e??"").trim().toLowerCase().replace(/\s+/g," ").replace(/[\p{P}]+$/gu,"")}function ml(e){const t=Kp(e);return t?Hp.has(t):!1}function Gp(e){for(let t=e.length-1;t>=0;t-=1){const n=e[t];if(n.role!=="user")continue;const s=(n.content??"").trim();if(s&&!ml(s))return s}return null}function Xp(e){return["Continue the ongoing math explanation for the same user request.","Do not refuse or reset the topic if the request is mathematical.","Original user request:",e].join(` +`).split(gp).map((c,u)=>u%2===1?c:kp(c)).join("")).join("")}const Lp=80;function Ss(e,t=Lp){if(!e||typeof e!="string")return"";const n=Mp(e).replace(/!\[([^\]]*)\]\([^)]+\)/g,"$1").replace(/\[([^\]]+)\]\(([^)]+)\)/g,"$1").replace(/```(?:[a-zA-Z0-9_-]+\n)?([\s\S]*?)```/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/\$\$([\s\S]+?)\$\$/g,"$1").replace(/\$([^$\n]+)\$/g,"$1").replace(/\\\(([\s\S]+?)\\\)/g,"$1").replace(/\\\[([\s\S]+?)\\\]/g,"$1").replace(/^\s{0,3}#{1,6}\s+/gm,"").replace(/^\s{0,3}>\s?/gm,"").replace(/^\s{0,3}(?:[-*+]|\d+\.)\s+/gm,"").replace(/^\s{0,3}(?:[-*_]\s?){3,}$/gm," ").replace(/\\boxed\{([^{}]+)\}/g,"$1").replace(/\\frac\{([^{}]+)\}\{([^{}]+)\}/g,"$1/$2").replace(/\\sqrt\{([^{}]+)\}/g,"sqrt($1)").replace(/\\(?:cdot|times)/g,"*").replace(/\\(alpha|beta|gamma|delta|theta|pi|sum|int|pm|mp|leq|geq|neq|approx)\b/g,"$1").replace(/\*\*([^*]+)\*\*/g,"$1").replace(/__([^_]+)__/g,"$1").replace(/\*([^*\n]+)\*/g,"$1").replace(/_([^_\n]+)_/g,"$1").replace(/~~([^~]+)~~/g,"$1").replace(/\*{2,}|_{2,}|~{2,}/g,"").replace(/`+/g,"").replace(/\|/g," ").replace(/\s+/g," ").trim();return n.length<=t?n:n.slice(0,t)}const Ip=/^\s*(?:hi|hello|hey|good\s+(?:morning|afternoon|evening))\b/i,Vp=/\b(?:thanks|thank\s+you|thank\s+u|ty)\b/i,ul=["Hi! I am MathPulse, your math tutor. I can help with algebra, geometry, calculus, and more. What math question would you like to try?","Hello! Great to see you. I am here for math topics and step-by-step solutions whenever you are ready."],dl=["You are very welcome. If you want, send another math question and we can work through it together.","Glad I could help. I am here anytime you want to practice more math."],ro=["That topic is outside my math scope, but I would be happy to help with mathematics like algebra, calculus, geometry, trigonometry, or statistics.","I focus on math-only support, so I may not be the best for that request. Share a math question and I will guide you step by step.","I am built for math tutoring, so I can best help with mathematical problems and explanations. If you want, ask me any math question next."],_p=["math","mathematics","algebra","geometry","trigonometry","calculus","statistics","probability","arithmetic","equation","inequality","function","graph","slope","derivative","integral","limit","matrix","determinant","fraction","percentage","ratio","polynomial","quadratic","logarithm","exponent","angle","triangle","circle","perimeter","area","volume","mean","median","mode","standard deviation","solve","simplify","factor","evaluate","compute","calculate"],jp=[/\d+\s*[%+\-*/^=]\s*[-+]?\d*/,/\b(?:sin|cos|tan|cot|sec|csc|log|ln|sqrt)\s*\(?/,/\b(?:differentiate|integrate|derive|proof|prove)\b/,/\b(?:x|y|z)\s*[=+\-*/^]\s*[-+]?\d/],Np=new Set(["go","continue","yes","ok","next","more"]),Op=[/\bshall\s+we\s+continue\b/i,/\b(?:would|do)\s+you\s+like\s+to\s+continue\b/i,/\b(?:want|need)\s+me\s+to\s+continue\b/i,/\bshould\s+(?:i|we)\s+continue\b/i,/\bcontinue\s*\?\s*$/i,/\b(?:ready\s+for|go\s+to)\s+the\s+next\s+step\b/i,/\bnext\s+step(?:s)?\s*\?\s*$/i,/\bkeep\s+going\s*\?\s*$/i],oo="I can continue once I know which math problem you mean. Please share the problem again or tell me which step to continue.";function En(e){return e.length===0?"":e[Math.floor(Math.random()*e.length)]??e[0]}function Fp(e){const t=(e??"").trim().toLowerCase();return t?_p.some(n=>t.includes(n))?!0:jp.some(n=>n.test(t)):!1}function Bp(e){return(e??"").trim().toLowerCase().replace(/\s+/g," ").replace(/[\p{P}]+$/gu,"")}function fl(e){const t=Bp(e);return t?Np.has(t):!1}function ao(e){const t=(e??"").trim();return t?Fp(t)?null:Ip.test(t)?En(ul):Vp.test(t)?En(dl):En(ro):En(ro)}function $p(e){const t=(e?.latestAssistantMessage??"").trim();if(t)return t;const n=e?.history??[];for(let s=n.length-1;s>=0;s-=1){const i=n[s],o=(i?.role??"").toLowerCase(),r=(i?.content??"").trim();if(r&&(o==="assistant"||o==="ai"))return r}return null}function zp(e){const t=$p(e);return t?Op.some(n=>n.test(t)):!1}function Up(e){const t=e?.history??[];for(let n=t.length-1;n>=0;n-=1){const s=t[n],i=(s?.role??"").toLowerCase(),o=(s?.content??"").trim();if(o&&i==="user"&&!fl(o))return o}return null}function Wp(e){return ul.includes(e)||dl.includes(e)}function hl(e,t){const n=ao(e);if(n===null)return null;if(!fl(e))return n;if(zp(t))return null;const s=Up(t);if(!s)return oo;const i=ao(s);return i===null?null:Wp(i)?oo:i}const pl=h.createContext(void 0);let Ts=null,Ps=null;const lo=()=>(Ts||(Ts=H(()=>import("./apiService-BmjkaPHy.js"),__vite__mapDeps([7,3,4,2,1,5,6]))),Ts),gt=()=>(Ps||(Ps=H(()=>import("./chatService-CcLfebtv.js"),__vite__mapDeps([8,1,2,3,4,5,6]))),Ps),Hp=new Set(["go","continue","next","more","yes","ok"]),qp=[/\b(?:end|finish|stop)\s+with(?:\s+the\s+(?:exact\s+)?(?:marker|text))?\s*[:\-]?\s*(["'`]?)([A-Za-z0-9_:\-]{2,96})\1/i,/\b(?:include|append)\s+(?:the\s+)?marker\s*[:\-]?\s*(["'`]?)([A-Za-z0-9_:\-]{2,96})\1/i];function mn(e){if(!e)return null;let t=e.trim();return!t||(t.length>=2&&t[0]===t[t.length-1]&&['"',"'","`"].includes(t[0])&&(t=t.slice(1,-1).trim()),t=t.replace(/[.,;\s]+$/g,""),!t)?null:t.slice(0,120)}function Kp(e){return(e??"").trim().toLowerCase().replace(/\s+/g," ").replace(/[\p{P}]+$/gu,"")}function ml(e){const t=Kp(e);return t?Hp.has(t):!1}function Gp(e){for(let t=e.length-1;t>=0;t-=1){const n=e[t];if(n.role!=="user")continue;const s=(n.content??"").trim();if(s&&!ml(s))return s}return null}function Xp(e){return["Continue the ongoing math explanation for the same user request.","Do not refuse or reset the topic if the request is mathematical.","Original user request:",e].join(` `)}function Yp(e){const t=(e??"").trim();if(!t)return null;for(const n of qp){const s=n.exec(t);if(!s)continue;const i=mn(s[2]);if(i)return i}return null}function Qp(e,t){const n=mn(t);return n?e.toLowerCase().includes(n.toLowerCase()):!1}function ni(e,t,n,s){return n&&!Qp(t,n)?!0:s?Jp(e,t):!1}function Zp(e){const t=e.trim();if(!t||[/```[^`]*$/,/\$\$[^$]*$/,/\$[^$\n]*$/,/\\\[[^\]]*$/,/\\\([^\)]*$/,/\\boxed\{[^}]*$/,/\\frac\{[^}]*\}\{?$/,/\\[a-zA-Z]+\s*$/,/(?:Step\s*\d+[:.]?)\s*$/i,/(?:Final\s*Answer[:.]?)\s*$/i].some(f=>f.test(t))||(t.match(/```/g)??[]).length%2!==0||(()=>{let f=0;for(let p=0;p=0&&t[w]==="\\";w-=1)g+=1;g%2===0&&(f+=1)}return f})()%2!==0)return!0;const o=(t.match(/\\left\b/g)??[]).length,r=(t.match(/\\right\b/g)??[]).length;if(o!==r)return!0;const a=[["(",")"],["[","]"],["{","}"]];for(const[f,p]of a){const g=(t.match(new RegExp(`\\${f}`,"g"))??[]).length,w=(t.match(new RegExp(`\\${p}`,"g"))??[]).length;if(g>w)return!0}if(t.length>=80&&/\b(?:and|or|but|because|since|so|then|which|that|where|when|with|for|to|from|of|in|on|at|by)\s*$/i.test(t))return!0;const c=t.split(/\r?\n/).map(f=>f.trim()).filter(Boolean),u=c.length>0?c[c.length-1]:t,d=/[.!?)]$/.test(u),l=/(?:=|\\boxed|\\int|d\/dx|f\(x\)|x\^\d+|\b\d+(?:\.\d+)?\b)\s*$/.test(u);return t.length>=140&&!d&&!l}function Jp(e,t){const n=t.trim(),s=e.toLowerCase();if(!n||Zp(n))return!0;const i=n.replace(/[#*_`>|\-]/g," ").replace(/\s+/g," ").trim();if(!i||i.length<24&&/(derivative|integral|equation|complete|explain|step)/.test(s))return!0;if(s.includes("derivative")&&s.includes("integral")){const o=n.toLowerCase(),r=/derivative|f'|d\/dx/.test(o),a=/integral|∫|\\int/.test(o);if(!r||!a)return!0}return!!((s.includes("complete equation")||s.includes("complete equations")||s.includes("step-by-step")||s.includes("step by step"))&&((n.match(/=|\\frac|\\int|∫|\\boxed|d\/dx|\b(dx|x\^\d+)\b/g)??[]).length<2||n.length<120))}function kt(e){const t=e.split(/\n{2,}/).map(i=>i.trim()).filter(Boolean);if(t.length<=1)return e.trim();const n=new Set,s=[];for(const i of t){const o=i.toLowerCase().replace(/[#*_`]/g,"").replace(/\s+/g," ").trim();!o||n.has(o)||(n.add(o),s.push(i))}return s.join(` `).trim()}function Cn(e,t){const n=e.trim(),s=t.trim();if(!n)return kt(s);if(!s)return kt(n);const i=Math.min(n.length,s.length,220);for(let o=i;o>=24;o-=1){const r=n.slice(-o),a=s.slice(0,o);if(r===a)return kt(`${n}${s.slice(o)}`.trim())}return n.endsWith(s)?kt(n):s.startsWith(n)?kt(s):kt(`${n} @@ -555,4 +555,4 @@ I can help with a wide range of math topics. Try asking: - Arithmetic (fractions, percentages) - Logarithms, Exponents, Matrices -What would you like to learn about?`}const bg=()=>{const e=h.useContext(pl);if(!e)throw new Error("useChatContext must be used within ChatProvider");return e},nm=({children:e})=>{const{currentUser:t}=ll(),[n,s]=h.useState([]),[i,o]=h.useState(null),[r,a]=h.useState(!1),[c,u]=h.useState(null),[d,l]=h.useState(!1),f=h.useRef(new Map);h.useEffect(()=>{if(!t){s([]),l(!1);return}(async()=>{try{const P=await gt(),S=await P.getUserChatSessions(t.uid),I=await Promise.all(S.map(async x=>{const L=(await P.getSessionMessages(x.id)).map(_=>({id:_.id,sender:_.role==="user"?"user":"ai",text:_.role==="assistant"?je(_.content):_.content,timestamp:_.timestamp instanceof Date?_.timestamp.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):new Date(_.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}));return{id:x.id,title:x.title,date:x.updatedAt instanceof Date?x.updatedAt.toLocaleDateString():new Date(x.updatedAt).toLocaleDateString(),messageCount:L.length,preview:L.length>0&&Ss(L[L.length-1].text)||"No messages yet",topics:[],messages:L,createdAt:x.createdAt instanceof Date?x.createdAt:new Date(x.createdAt),updatedAt:x.updatedAt instanceof Date?x.updatedAt:new Date(x.updatedAt)}}));s(I)}catch(P){console.error("Error loading chat sessions:",P)}finally{l(!0)}})()},[t]);const p=b=>{if(b.length===0)return"New Chat";const P=b.find(x=>x.sender==="user")?.text||"",S=P.toLowerCase();if(S.includes("quadratic")||S.includes("ax² + bx + c"))return"Quadratic Equations Help";if(S.includes("derivative")||S.includes("calculus"))return"Derivatives & Calculus";if(S.includes("pythagor")||S.includes("right triangle"))return"Pythagorean Theorem";if(S.includes("trig")||S.includes("sin")||S.includes("cos"))return"Trigonometry Help";if(S.includes("area")||S.includes("perimeter"))return"Geometry - Area & Perimeter";if(S.includes("algebra")||S.includes("solve")&&S.includes("x"))return"Algebra Problem Solving";if(S.includes("factor"))return"Factoring Practice";if(S.includes("graph")||S.includes("plot"))return"Graphing Functions";if(S.includes("matrix")||S.includes("matrices"))return"Matrix Operations";if(S.includes("integral")||S.includes("integrate"))return"Integration Problems";if(S.includes("limit"))return"Limits in Calculus";if(S.includes("statistic")||S.includes("probability"))return"Statistics & Probability";const I=P.slice(0,40);return I.length{const P=Date.now().toString(),S=new Date,I={id:P,title:b?p([b]):"New Chat",date:"Just now",messageCount:b?1:0,preview:b&&Ss(b.text)||"Start a new conversation...",topics:[],messages:b?[b]:[],createdAt:S,updatedAt:S};if(s(x=>[I,...x]),t){const x=b?p([b]):"New Chat",R=gt().then(async L=>{const _=await L.createChatSession(t.uid,x);return b&&await L.addMessageToSession(_.id,b.sender==="user"?"user":"assistant",b.text),_.id}).catch(L=>(console.error("Error creating Firebase session:",L),P));f.current.set(P,R)}return P},[t]),w=h.useCallback((b,P)=>{const S=P.sender==="ai"?{...P,text:je(P.text)}:P;s(x=>x.map(R=>{if(R.id===b){const L=[...R.messages,S];return{...R,messages:L,messageCount:L.length,preview:Ss(S.text)||R.preview,updatedAt:new Date,title:L.length===2?p(L):R.title}}return R}));const I=async x=>{const R=f.current.get(x);return R?await R:x};I(b).then(async x=>{await(await gt()).addMessageToSession(x,S.sender==="user"?"user":"assistant",S.text)}).catch(x=>console.error("Error persisting message:",x)),s(x=>{const R=x.find(L=>L.id===b);if(R&&R.messages.length===2){const L=p(R.messages);I(b).then(async _=>{await(await gt()).updateSessionTitle(_,L)}).catch(_=>console.error("Error updating title:",_))}return x})},[]),T=h.useCallback(async(b,P)=>{const S=P.trim(),I={id:Date.now().toString(),sender:"user",text:S,timestamp:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})};w(b,I),u(b),a(!0);try{let x=null,R=null;const L=n.find(N=>N.id===b),_=(L?.messages||[]).map(N=>({role:N.sender==="user"?"user":"assistant",content:N.text})),oe=ml(S)?Gp(_):null,J=oe?Xp(oe):S,ge=oe??S,Me=hl(S,{history:_});if(Me){const N={id:(Date.now()+1).toString(),sender:"ai",text:Me,timestamp:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})};w(b,N);return}try{const N=await lo();x=N.apiService,R=N.ApiTimeoutError}catch(N){console.error("Failed to load API service for chat:",N);const D={id:(Date.now()+1).toString(),sender:"ai",text:Dn(ge),timestamp:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})};w(b,D);return}const U=new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});let V="",W=null;const ee=em(S),G=tm(S),Q=Yp(S),ye=G||!!Q,j=Q?{expectedEndMarker:Q,completionMode:"marker"}:void 0,B=N=>ni(S,N,Q,G),$=N=>{N.trim()&&s(D=>D.map(K=>{if(K.id!==b)return K;if(!W){W=`stream-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;const ae={id:W,sender:"ai",text:N,timestamp:U},F=[...K.messages,ae];return{...K,messages:F,messageCount:F.length,updatedAt:new Date}}return{...K,messages:K.messages.map(ae=>ae.id===W?{...ae,text:N}:ae),updatedAt:new Date}}))},te=()=>{if(!W)return;const N=W;s(D=>D.map(K=>{if(K.id!==b)return K;const ae=K.messages.filter(F=>F.id!==N);return{...K,messages:ae,messageCount:ae.length,updatedAt:new Date}}))};try{const{response:N}=await x.chat(J,_,F=>{V+=F,ee&&$(Rp(V))},j);let D=je(N||V).trim();if(ye&&D&&B(D)){try{const F=await x.chatSafe(co(S,D,Q),_,j),fe=je(F.data.response).trim();D=Cn(D,fe)}catch(F){console.warn("Streaming completion repair failed:",F)}if(ye&&D&&B(D))try{const F=await x.chatSafe(uo(S,D,Q),_,j),fe=je(F.data.response).trim();D=Cn(D,fe)}catch(F){console.warn("Streaming plain continuation repair failed:",F)}if(ye&&D&&B(D))try{const F=await x.chatSafe(fo(S,Q),_,j),fe=je(F.data.response).trim();fe&&(D=ho(S,D,fe,Q,G))}catch(F){console.warn("Streaming full completion repair failed:",F)}}const K=B(D);(!D||K&&!ye)&&(D=Dn(ge,_)),W&&te();const ae={id:(Date.now()+1).toString(),sender:"ai",text:D,timestamp:U};w(b,ae)}catch(N){R&&N instanceof R?console.warn(`Streaming timed out after ${N.timeoutMs}ms, falling back to non-streaming chat.`,N):console.warn("Streaming failed, falling back to non-streaming chat:",N),W&&te();let D="";try{const F=x??(await lo()).apiService,{data:fe}=await F.chatSafe(J,_,j);if(D=je(fe.response).trim(),ye&&D&&B(D))try{const ve=await F.chatSafe(co(S,D,Q),_,j),be=je(ve.data.response).trim();D=Cn(D,be)}catch(ve){console.warn("Non-stream completion repair failed:",ve)}if(ye&&D&&B(D))try{const ve=await F.chatSafe(uo(S,D,Q),_,j),be=je(ve.data.response).trim();D=Cn(D,be)}catch(ve){console.warn("Non-stream plain continuation repair failed:",ve)}if(ye&&D&&B(D))try{const ve=await F.chatSafe(fo(S,Q),_,j),be=je(ve.data.response).trim();be&&(D=ho(S,D,be,Q,G))}catch(ve){console.warn("Non-stream full completion repair failed:",ve)}}catch(F){console.warn("Chat request failed, using local fallback response:",F),D=Dn(ge,_)}const K=B(D);(!D||K&&!ye)&&(D=Dn(ge,_));const ae={id:(Date.now()+1).toString(),sender:"ai",text:je(D),timestamp:U};w(b,ae)}if(L&&L.messages.length===1){const N=n.find(D=>D.id===b);if(N&&N.messages.length>1){const D=p(N.messages),K=f.current.get(b);(K||Promise.resolve(b)).then(async F=>{await(await gt()).updateSessionTitle(F,D)}).catch(F=>console.error("Error updating title:",F))}}}finally{a(!1),u(null)}},[n,w]),v=h.useCallback((b,P)=>{s(x=>x.map(R=>R.id===b?{...R,title:P}:R));const S=f.current.get(b);(S||Promise.resolve(b)).then(async x=>{await(await gt()).updateSessionTitle(x,P)}).catch(x=>console.error("Error updating session title:",x))},[]),A=h.useCallback(b=>{s(I=>I.filter(x=>x.id!==b)),i===b&&o(null);const P=f.current.get(b);(P||Promise.resolve(b)).then(async I=>{await(await gt()).deleteSession(I)}).catch(I=>console.error("Error deleting session:",I)),f.current.delete(b)},[i]),y=h.useCallback(()=>n.find(b=>b.id===i)||null,[n,i]);return m.jsx(pl.Provider,{value:{sessions:n,activeSessionId:i,isLoading:r,loadingSessionId:c,sessionsLoaded:d,setActiveSessionId:o,createNewSession:g,addMessageToSession:w,sendMessage:T,updateSessionTitle:v,deleteSession:A,getActiveSession:y,generateTitleFromMessages:p},children:e})},gl=e=>{const t=e.data(),n=t.createdAt,s=typeof n?.toDate=="function"?n.toDate():n instanceof Date?n:new Date,i=t.actionUrl??t.link??void 0;return{...t,id:e.id,createdAt:s,actionUrl:i}},sm=async(e,t,n,s,i)=>{try{const o=se(We(q,"notifications")),r={id:o.id,userId:e,type:t,title:n,message:s,read:!1,...i?{actionUrl:i}:{},createdAt:new Date},a={id:r.id,userId:r.userId,type:r.type,title:r.title,message:r.message,read:r.read,createdAt:he(),link:i||null};return await He(o,{...a}),r}catch(o){throw console.error("Error creating notification:",o),o}},xg=async(e,t=50,n=!1)=>{try{let s=rt(We(q,"notifications"),Oe("userId","==",e),tn("createdAt","desc"),nn(t));return n&&(s=rt(We(q,"notifications"),Oe("userId","==",e),Oe("read","==",!1),tn("createdAt","desc"),nn(t))),(await un(s)).docs.map(o=>gl(o))}catch(s){return console.error("Error getting notifications:",s),[]}},wg=(e,t={},n,s)=>{if(!e)return n([]),()=>{};const{limitCount:i=50,unreadOnly:o=!1}=t,r=[Oe("userId","==",e),tn("createdAt","desc"),nn(i)],a=o?rt(We(q,"notifications"),Oe("userId","==",e),Oe("read","==",!1),tn("createdAt","desc"),nn(i)):rt(We(q,"notifications"),...r);return bo(a,c=>{n(c.docs.map(u=>gl(u)))},c=>{console.error("Error subscribing to notifications:",c),s?.(c)})},Sg=async e=>{try{const t=se(q,"notifications",e);await Bt(t,{read:!0})}catch(t){throw console.error("Error marking notification as read:",t),t}},Tg=async e=>{try{const t=rt(We(q,"notifications"),Oe("userId","==",e),Oe("read","==",!1)),n=await un(t);await Promise.all(n.docs.map(s=>Bt(s.ref,{read:!0})))}catch(t){throw console.error("Error marking all notifications as read:",t),t}},im=async e=>{try{const t=se(q,"users",e),n=await ke(t);if(!n.exists())throw new Error("User not found");const s=n.data(),i=s.lastActivityDate?.toDate(),o=new Date;o.setHours(0,0,0,0);let r=s.streak||0;if(!i)r=1;else{const u=new Date(i);u.setHours(0,0,0,0);const d=Math.floor((o.getTime()-u.getTime())/(1e3*60*60*24));if(d===0)r=s.streak||1;else if(d===1){r=(s.streak||0)+1;const l=Math.min(r*5,50);await yl(e,l,"streak_bonus",`${r} day streak bonus!`)}else r=1}const a=new Date,c=`${a.getFullYear()}-${String(a.getMonth()+1).padStart(2,"0")}-${String(a.getDate()).padStart(2,"0")}`;return await Bt(t,{streak:r,streakHistory:Fl(c),lastActivityDate:he(),updatedAt:he()}),r}catch(t){return console.error("Error updating streak:",t),0}},yl=async(e,t,n,s)=>{try{const i=se(q,"users",e),o=await ke(i);if(!o.exists())throw new Error("User not found");const r=o.data(),a=r.currentXP||0,c=r.totalXP||0,u=a+t,d=c+t,l=r.level||1;console.log(`🏆 XP Award - User: ${e}, Amount: ${t}, Previous currentXP: ${a}, New: ${u}, Type: ${n}`);let f=l,p=d,g=!1;for(;;){const v=Math.floor(100*Math.pow(1.5,f-1));let A=0;for(let y=1;y<=f;y++)A+=Math.floor(100*Math.pow(1.5,y-1));if(d>=A)f++,g=!0;else break}const w={currentXP:u,totalXP:d,level:f,updatedAt:he()};await Bt(i,w),console.log(`💾 Firebase Update - currentXP: ${a} -> ${u}, totalXP: ${c} -> ${d}, level: ${f}`);const T=se(We(q,"xpActivities"));return await He(T,{activityId:T.id,userId:e,type:n,xpEarned:t,description:s,timestamp:he()}),{newLevel:f,leveledUp:g,xp:u,addedXp:t}}catch(i){throw console.error("Error awarding XP:",i),i}},Pg=async(e,t=!1,n="all",s=10)=>{try{const i=rt(We(q,"users"),Oe("role","==","student"),tn("totalXP","desc"),nn(s));return(await un(i)).docs.map((r,a)=>{const c=r.data();return{userId:r.id,name:c.name||"Unknown",photo:c.photo,xp:c.totalXP||0,level:c.level||1,rank:a+1,weeklyXP:c.weeklyXP||0,monthlyXP:c.monthlyXP||0}})}catch(i){return console.error("Error getting leaderboard:",i),[]}},Ag=async e=>{try{const t=await ke(se(q,"users",e));if(!t.exists())return 0;const n=t.data().totalXP||0,s=rt(We(q,"users"),Oe("role","==","student"),Oe("totalXP",">",n));return(await un(s)).size+1}catch(t){return console.error("Error getting user rank:",t),0}},Eg=async e=>{try{const t=await ke(se(q,"achievements",e));return t.exists()?t.data().achievements||[]:[]}catch(t){return console.error("Error getting user achievements:",t),[]}},ji=async e=>{const t={userId:e,subjects:{},lessons:{},quizAttempts:[],totalLessonsCompleted:0,totalQuizzesCompleted:0,averageScore:0,updatedAt:new Date};return await He(se(q,"progress",e),t),t},rm=async e=>{try{const t=se(q,"progress",e),n=await ke(t);if(n.exists()){const s=n.data();return{...s,updatedAt:s.updatedAt?.toDate()||new Date}}return await ji(e)}catch(t){return console.error("Error getting user progress:",t),null}},Cg=(e,t)=>{const n=se(q,"progress",e);return bo(n,s=>{if(!s.exists()){t(null);return}const i=s.data();t({...i,updatedAt:i.updatedAt?.toDate?.()||new Date})},s=>{console.error("Error subscribing to user progress:",s),t(null)})},Dg=async(e,t,n)=>{const s=Math.max(0,Math.min(100,n)),i=se(q,"progress",e);await He(i,{[`lessons.${t}.lessonId`]:t,[`lessons.${t}.progressPercent`]:s,updatedAt:he()},{merge:!0})},Rg=async(e,t,n,s,i)=>{const o=se(q,"progress",e),r=await ke(o);if(!r.exists())return 0;const c=r.data().subjects?.[t]?.modulesProgress?.[n];if(!c)return 0;const u=Math.max(1,s+i),d=c.lessonsCompleted?.length||0,l=c.quizzesCompleted?.length||0,f=Math.round((d+l)/u*100);return await He(o,{[`subjects.${t}.modulesProgress.${n}.progress`]:f,[`subjects.${t}.modulesProgress.${n}.lastAccessedAt`]:he(),updatedAt:he()},{merge:!0}),f},kg=async(e,t,n,s,i,o=50)=>{try{const r=se(q,"progress",e);let a=await ke(r);a.exists()||(await ji(e),a=await ke(r));const c=a.data(),u={lessonId:s,completed:!0,completedAt:new Date,timeSpent:i};c.subjects||(c.subjects={}),c.subjects[t]||(c.subjects[t]={subjectId:t,progress:0,completedModules:0,totalModules:0,modulesProgress:{}});const d=c.subjects[t];d.modulesProgress[n]||(d.modulesProgress[n]={moduleId:n,subjectId:t,progress:0,lessonsCompleted:[],quizzesCompleted:[],startedAt:new Date,lastAccessedAt:new Date});const l=d.modulesProgress[n],f=!l.lessonsCompleted.includes(s);f&&(l.lessonsCompleted.push(s),l.lastAccessedAt=new Date),await He(r,{[`lessons.${s}`]:u,[`subjects.${t}.modulesProgress.${n}`]:l,...f&&{totalLessonsCompleted:Fn(1)},updatedAt:he()},{merge:!0}),await vl(e,o,"lesson_complete",`Completed lesson: ${s}`)}catch(r){throw console.error("Error completing lesson:",r),r}},Mg=async(e,t,n,s,i,o,r)=>{try{const a=se(q,"progress",e);let c=await ke(a);c.exists()||(await ji(e),c=await ke(a));const u=c.data(),d={quizId:s,attemptNumber:(u.quizAttempts?.filter(w=>w.quizId===s).length||0)+1,score:i,completedAt:new Date,timeSpent:r,answers:o},l=Math.floor(i/100*100);u.subjects||(u.subjects={}),u.subjects[t]||(u.subjects[t]={subjectId:t,progress:0,completedModules:0,totalModules:0,modulesProgress:{}});const f=u.subjects[t];f.modulesProgress[n]||(f.modulesProgress[n]={moduleId:n,subjectId:t,progress:0,lessonsCompleted:[],quizzesCompleted:[],startedAt:new Date,lastAccessedAt:new Date});const p=f.modulesProgress[n],g=!p.quizzesCompleted.includes(s);g&&(p.quizzesCompleted.push(s),p.lastAccessedAt=new Date),await Bt(a,{quizAttempts:[...u.quizAttempts||[],d],[`subjects.${t}.modulesProgress.${n}`]:p,...g&&{totalQuizzesCompleted:Fn(1)},updatedAt:he()}),await vl(e,l,"quiz_complete",`Completed quiz: ${s} (Score: ${i}%)`)}catch(a){throw console.error("Error completing quiz:",a),a}},vl=async(e,t,n,s)=>{try{const i=se(q,"users",e);await Bt(i,{currentXP:Fn(t),totalXP:Fn(t),updatedAt:he()});const o=se(We(q,"xpActivities"));await He(o,{activityId:o.id,userId:e,type:n,xpEarned:t,description:s,timestamp:he()})}catch(i){console.error("Error awarding XP:",i)}},On={notifications:{emailNotifications:!0,pushNotifications:!0,soundEnabled:!0,notificationTypes:{quizReminders:!0,newContent:!0,achievements:!0,streakAlerts:!0,weeklySummary:!0},quietHours:{start:"22:00",end:"08:00"}},appearance:{darkMode:!1,fontSize:16,compactView:!1,reduceAnimations:!1},privacy:{profileVisibility:"everyone",showActivityStatus:!0,dataSharing:!0},learning:{dailyXpGoal:100,preferredStudyTime:"evening",autoPlayLessons:!1,showHints:!0,quizDifficultyPreference:"adaptive",studyReminderTime:"18:00"},adminPanel:{siteName:"MathPulse AI",siteDescription:"AI-Powered Mathematics Learning Platform",defaultLanguage:"English",maintenanceMode:!1,enforceStrongPasswords:!0,sessionTimeoutMinutes:60,aiTutorEnabled:!0,aiAutoRecommendations:!0,aiRiskAlertsEnabled:!0,gradingScale:"percentage",passingGrade:75,parentSummaryEmails:!0,teacherDigestEmails:!0,weeklyPlatformReport:!0,autoBackupEnabled:!1,backupFrequency:"weekly"}},om="preferences",Ni=()=>JSON.parse(JSON.stringify(On)),bl=e=>{const t=Ni();return e?{...t,...e,notifications:{...t.notifications,...e.notifications,notificationTypes:{...t.notifications.notificationTypes,...e.notifications?.notificationTypes},quietHours:{...t.notifications.quietHours,...e.notifications?.quietHours}},appearance:{...t.appearance,...e.appearance},privacy:{...t.privacy,...e.privacy},learning:{...t.learning,...e.learning},adminPanel:{...t.adminPanel,...e.adminPanel}}:t},Oi=e=>se(q,"users",e,"settings",om),xl=async e=>{const t=Oi(e),n=await ke(t);if(!n.exists()){const s=Ni();return await He(t,{...s,createdAt:he(),updatedAt:he()}),s}return bl(n.data())},am=async(e,t)=>{const n=await xl(e),s=bl({...n,...t});return await He(Oi(e),{...s,updatedAt:he()},{merge:!0}),s},lm=e=>{const t=document.documentElement;t.style.setProperty("--font-size",`${e.appearance.fontSize}px`),t.dataset.density=e.appearance.compactView?"compact":"comfortable",e.appearance.reduceAnimations?t.classList.add("reduced-motion"):t.classList.remove("reduced-motion"),e.appearance.darkMode?t.classList.add("smart-dark"):t.classList.remove("smart-dark")},cm=async()=>{try{if(localStorage.clear(),sessionStorage.clear(),"caches"in window){const e=await caches.keys();await Promise.all(e.map(t=>caches.delete(t)))}}catch(e){throw console.error("Failed clearing client cache:",e),new Error("Unable to clear cache on this device.")}},um=async e=>{const t=se(q,"users",e),n=await ke(t),s=await ke(Oi(e)),i=["progress","xpActivities","achievements","notifications","tasks","chatSessions","chatMessages"],o=await Promise.all(i.map(async r=>{const a=rt(We(q,r),Oe("userId","==",e)),c=await un(a);return{collectionName:r,items:c.docs.map(u=>({id:u.id,...u.data()}))}}));return{exportedAt:new Date().toISOString(),user:n.exists()?{id:n.id,...n.data()}:null,settings:s.exists()?s.data():Ni(),collections:o.reduce((r,a)=>(r[a.collectionName]=a.items,r),{})}};function dm(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}const fm=e=>{switch(e){case"success":return mm;case"info":return ym;case"warning":return gm;case"error":return vm;default:return null}},hm=Array(12).fill(0),pm=({visible:e,className:t})=>C.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},C.createElement("div",{className:"sonner-spinner"},hm.map((n,s)=>C.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${s}`})))),mm=C.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},C.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),gm=C.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},C.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),ym=C.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},C.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),vm=C.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},C.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),bm=C.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},C.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),C.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),xm=()=>{const[e,t]=C.useState(document.hidden);return C.useEffect(()=>{const n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e};let si=1;class wm{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const n=this.subscribers.indexOf(t);this.subscribers.splice(n,1)}),this.publish=t=>{this.subscribers.forEach(n=>n(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var n;const{message:s,...i}=t,o=typeof t?.id=="number"||((n=t.id)==null?void 0:n.length)>0?t.id:si++,r=this.toasts.find(c=>c.id===o),a=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(o)&&this.dismissedToasts.delete(o),r?this.toasts=this.toasts.map(c=>c.id===o?(this.publish({...c,...t,id:o,title:s}),{...c,...t,id:o,dismissible:a,title:s}):c):this.addToast({title:s,...i,dismissible:a,id:o}),o},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(n=>n({id:t,dismiss:!0})))):this.toasts.forEach(n=>{this.subscribers.forEach(s=>s({id:n.id,dismiss:!0}))}),t),this.message=(t,n)=>this.create({...n,message:t}),this.error=(t,n)=>this.create({...n,message:t,type:"error"}),this.success=(t,n)=>this.create({...n,type:"success",message:t}),this.info=(t,n)=>this.create({...n,type:"info",message:t}),this.warning=(t,n)=>this.create({...n,type:"warning",message:t}),this.loading=(t,n)=>this.create({...n,type:"loading",message:t}),this.promise=(t,n)=>{if(!n)return;let s;n.loading!==void 0&&(s=this.create({...n,promise:t,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));const i=Promise.resolve(t instanceof Function?t():t);let o=s!==void 0,r;const a=i.then(async u=>{if(r=["resolve",u],C.isValidElement(u))o=!1,this.create({id:s,type:"default",message:u});else if(Tm(u)&&!u.ok){o=!1;const l=typeof n.error=="function"?await n.error(`HTTP error! status: ${u.status}`):n.error,f=typeof n.description=="function"?await n.description(`HTTP error! status: ${u.status}`):n.description,g=typeof l=="object"&&!C.isValidElement(l)?l:{message:l};this.create({id:s,type:"error",description:f,...g})}else if(u instanceof Error){o=!1;const l=typeof n.error=="function"?await n.error(u):n.error,f=typeof n.description=="function"?await n.description(u):n.description,g=typeof l=="object"&&!C.isValidElement(l)?l:{message:l};this.create({id:s,type:"error",description:f,...g})}else if(n.success!==void 0){o=!1;const l=typeof n.success=="function"?await n.success(u):n.success,f=typeof n.description=="function"?await n.description(u):n.description,g=typeof l=="object"&&!C.isValidElement(l)?l:{message:l};this.create({id:s,type:"success",description:f,...g})}}).catch(async u=>{if(r=["reject",u],n.error!==void 0){o=!1;const d=typeof n.error=="function"?await n.error(u):n.error,l=typeof n.description=="function"?await n.description(u):n.description,p=typeof d=="object"&&!C.isValidElement(d)?d:{message:d};this.create({id:s,type:"error",description:l,...p})}}).finally(()=>{o&&(this.dismiss(s),s=void 0),n.finally==null||n.finally.call(n)}),c=()=>new Promise((u,d)=>a.then(()=>r[0]==="reject"?d(r[1]):u(r[1])).catch(d));return typeof s!="string"&&typeof s!="number"?{unwrap:c}:Object.assign(s,{unwrap:c})},this.custom=(t,n)=>{const s=n?.id||si++;return this.create({jsx:t(s),id:s,...n}),s},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const Re=new wm,Sm=(e,t)=>{const n=t?.id||si++;return Re.addToast({title:e,...t,id:n}),n},Tm=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",Pm=Sm,Am=()=>Re.toasts,Em=()=>Re.getActiveToasts(),Se=Object.assign(Pm,{success:Re.success,info:Re.info,warning:Re.warning,error:Re.error,custom:Re.custom,message:Re.message,promise:Re.promise,dismiss:Re.dismiss,loading:Re.loading},{getHistory:Am,getToasts:Em});dm("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function Rn(e){return e.label!==void 0}const Cm=3,Dm="24px",Rm="16px",po=4e3,km=356,Mm=14,Lm=45,Im=200;function Ge(...e){return e.filter(Boolean).join(" ")}function Vm(e){const[t,n]=e.split("-"),s=[];return t&&s.push(t),n&&s.push(n),s}const _m=e=>{var t,n,s,i,o,r,a,c,u;const{invert:d,toast:l,unstyled:f,interacting:p,setHeights:g,visibleToasts:w,heights:T,index:v,toasts:A,expanded:y,removeToast:b,defaultRichColors:P,closeButton:S,style:I,cancelButtonStyle:x,actionButtonStyle:R,className:L="",descriptionClassName:_="",duration:oe,position:J,gap:ge,expandByDefault:Me,classNames:U,icons:V,closeButtonAriaLabel:W="Close toast"}=e,[ee,G]=C.useState(null),[Q,ye]=C.useState(null),[j,B]=C.useState(!1),[$,te]=C.useState(!1),[N,D]=C.useState(!1),[K,ae]=C.useState(!1),[F,fe]=C.useState(!1),[ve,be]=C.useState(0),[Ze,gn]=C.useState(0),Be=C.useRef(l.duration||oe||po),et=C.useRef(null),Ve=C.useRef(null),yn=v===0,tt=v+1<=w,pe=l.type,qe=l.dismissible!==!1,Ht=l.className||"",wt=l.descriptionClassName||"",_e=C.useMemo(()=>T.findIndex(O=>O.toastId===l.id)||0,[T,l.id]),St=C.useMemo(()=>{var O;return(O=l.closeButton)!=null?O:S},[l.closeButton,S]),Tt=C.useMemo(()=>l.duration||oe||po,[l.duration,oe]),dt=C.useRef(0),nt=C.useRef(0),qt=C.useRef(0),Ke=C.useRef(null),[Kt,ft]=J.split("-"),ht=C.useMemo(()=>T.reduce((O,le,ie)=>ie>=_e?O:O+le.height,0),[T,_e]),Pt=xm(),At=l.invert||d,Et=pe==="loading";nt.current=C.useMemo(()=>_e*ge+ht,[_e,ht]),C.useEffect(()=>{Be.current=Tt},[Tt]),C.useEffect(()=>{B(!0)},[]),C.useEffect(()=>{const O=Ve.current;if(O){const le=O.getBoundingClientRect().height;return gn(le),g(ie=>[{toastId:l.id,height:le,position:l.position},...ie]),()=>g(ie=>ie.filter(re=>re.toastId!==l.id))}},[g,l.id]),C.useLayoutEffect(()=>{if(!j)return;const O=Ve.current,le=O.style.height;O.style.height="auto";const ie=O.getBoundingClientRect().height;O.style.height=le,gn(ie),g(re=>re.find(ue=>ue.toastId===l.id)?re.map(ue=>ue.toastId===l.id?{...ue,height:ie}:ue):[{toastId:l.id,height:ie,position:l.position},...re])},[j,l.title,l.description,g,l.id,l.jsx,l.action,l.cancel]);const Ae=C.useCallback(()=>{te(!0),be(nt.current),g(O=>O.filter(le=>le.toastId!==l.id)),setTimeout(()=>{b(l)},Im)},[l,b,g,nt]);C.useEffect(()=>{if(l.promise&&pe==="loading"||l.duration===1/0||l.type==="loading")return;let O;return y||p||Pt?(()=>{if(qt.current{Be.current!==1/0&&(dt.current=new Date().getTime(),O=setTimeout(()=>{l.onAutoClose==null||l.onAutoClose.call(l,l),Ae()},Be.current))})(),()=>clearTimeout(O)},[y,p,l,pe,Pt,Ae]),C.useEffect(()=>{l.delete&&(Ae(),l.onDismiss==null||l.onDismiss.call(l,l))},[Ae,l.delete]);function vn(){var O;if(V?.loading){var le;return C.createElement("div",{className:Ge(U?.loader,l==null||(le=l.classNames)==null?void 0:le.loader,"sonner-loader"),"data-visible":pe==="loading"},V.loading)}return C.createElement(pm,{className:Ge(U?.loader,l==null||(O=l.classNames)==null?void 0:O.loader),visible:pe==="loading"})}const bn=l.icon||V?.[pe]||fm(pe);var xn,Ct;return C.createElement("li",{tabIndex:0,ref:Ve,className:Ge(L,Ht,U?.toast,l==null||(t=l.classNames)==null?void 0:t.toast,U?.default,U?.[pe],l==null||(n=l.classNames)==null?void 0:n[pe]),"data-sonner-toast":"","data-rich-colors":(xn=l.richColors)!=null?xn:P,"data-styled":!(l.jsx||l.unstyled||f),"data-mounted":j,"data-promise":!!l.promise,"data-swiped":F,"data-removed":$,"data-visible":tt,"data-y-position":Kt,"data-x-position":ft,"data-index":v,"data-front":yn,"data-swiping":N,"data-dismissible":qe,"data-type":pe,"data-invert":At,"data-swipe-out":K,"data-swipe-direction":Q,"data-expanded":!!(y||Me&&j),"data-testid":l.testId,style:{"--index":v,"--toasts-before":v,"--z-index":A.length-v,"--offset":`${$?ve:nt.current}px`,"--initial-height":Me?"auto":`${Ze}px`,...I,...l.style},onDragEnd:()=>{D(!1),G(null),Ke.current=null},onPointerDown:O=>{O.button!==2&&(Et||!qe||(et.current=new Date,be(nt.current),O.target.setPointerCapture(O.pointerId),O.target.tagName!=="BUTTON"&&(D(!0),Ke.current={x:O.clientX,y:O.clientY})))},onPointerUp:()=>{var O,le,ie;if(K||!qe)return;Ke.current=null;const re=Number(((O=Ve.current)==null?void 0:O.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),pt=Number(((le=Ve.current)==null?void 0:le.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),ue=new Date().getTime()-((ie=et.current)==null?void 0:ie.getTime()),Ee=ee==="x"?re:pt,Dt=Math.abs(Ee)/ue;if(Math.abs(Ee)>=Lm||Dt>.11){be(nt.current),l.onDismiss==null||l.onDismiss.call(l,l),ye(ee==="x"?re>0?"right":"left":pt>0?"down":"up"),Ae(),ae(!0);return}else{var Le,Ie;(Le=Ve.current)==null||Le.style.setProperty("--swipe-amount-x","0px"),(Ie=Ve.current)==null||Ie.style.setProperty("--swipe-amount-y","0px")}fe(!1),D(!1),G(null)},onPointerMove:O=>{var le,ie,re;if(!Ke.current||!qe||((le=window.getSelection())==null?void 0:le.toString().length)>0)return;const ue=O.clientY-Ke.current.y,Ee=O.clientX-Ke.current.x;var Dt;const Le=(Dt=e.swipeDirections)!=null?Dt:Vm(J);!ee&&(Math.abs(Ee)>1||Math.abs(ue)>1)&&G(Math.abs(Ee)>Math.abs(ue)?"x":"y");let Ie={x:0,y:0};const Rt=Ce=>1/(1.5+Math.abs(Ce)/20);if(ee==="y"){if(Le.includes("top")||Le.includes("bottom"))if(Le.includes("top")&&ue<0||Le.includes("bottom")&&ue>0)Ie.y=ue;else{const Ce=ue*Rt(ue);Ie.y=Math.abs(Ce)0)Ie.x=Ee;else{const Ce=Ee*Rt(Ee);Ie.x=Math.abs(Ce)0||Math.abs(Ie.y)>0)&&fe(!0),(ie=Ve.current)==null||ie.style.setProperty("--swipe-amount-x",`${Ie.x}px`),(re=Ve.current)==null||re.style.setProperty("--swipe-amount-y",`${Ie.y}px`)}},St&&!l.jsx&&pe!=="loading"?C.createElement("button",{"aria-label":W,"data-disabled":Et,"data-close-button":!0,onClick:Et||!qe?()=>{}:()=>{Ae(),l.onDismiss==null||l.onDismiss.call(l,l)},className:Ge(U?.closeButton,l==null||(s=l.classNames)==null?void 0:s.closeButton)},(Ct=V?.close)!=null?Ct:bm):null,(pe||l.icon||l.promise)&&l.icon!==null&&(V?.[pe]!==null||l.icon)?C.createElement("div",{"data-icon":"",className:Ge(U?.icon,l==null||(i=l.classNames)==null?void 0:i.icon)},l.promise||l.type==="loading"&&!l.icon?l.icon||vn():null,l.type!=="loading"?bn:null):null,C.createElement("div",{"data-content":"",className:Ge(U?.content,l==null||(o=l.classNames)==null?void 0:o.content)},C.createElement("div",{"data-title":"",className:Ge(U?.title,l==null||(r=l.classNames)==null?void 0:r.title)},l.jsx?l.jsx:typeof l.title=="function"?l.title():l.title),l.description?C.createElement("div",{"data-description":"",className:Ge(_,wt,U?.description,l==null||(a=l.classNames)==null?void 0:a.description)},typeof l.description=="function"?l.description():l.description):null),C.isValidElement(l.cancel)?l.cancel:l.cancel&&Rn(l.cancel)?C.createElement("button",{"data-button":!0,"data-cancel":!0,style:l.cancelButtonStyle||x,onClick:O=>{Rn(l.cancel)&&qe&&(l.cancel.onClick==null||l.cancel.onClick.call(l.cancel,O),Ae())},className:Ge(U?.cancelButton,l==null||(c=l.classNames)==null?void 0:c.cancelButton)},l.cancel.label):null,C.isValidElement(l.action)?l.action:l.action&&Rn(l.action)?C.createElement("button",{"data-button":!0,"data-action":!0,style:l.actionButtonStyle||R,onClick:O=>{Rn(l.action)&&(l.action.onClick==null||l.action.onClick.call(l.action,O),!O.defaultPrevented&&Ae())},className:Ge(U?.actionButton,l==null||(u=l.classNames)==null?void 0:u.actionButton)},l.action.label):null)};function mo(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function jm(e,t){const n={};return[e,t].forEach((s,i)=>{const o=i===1,r=o?"--mobile-offset":"--offset",a=o?Rm:Dm;function c(u){["top","right","bottom","left"].forEach(d=>{n[`${r}-${d}`]=typeof u=="number"?`${u}px`:u})}typeof s=="number"||typeof s=="string"?c(s):typeof s=="object"?["top","right","bottom","left"].forEach(u=>{s[u]===void 0?n[`${r}-${u}`]=a:n[`${r}-${u}`]=typeof s[u]=="number"?`${s[u]}px`:s[u]}):c(a)}),n}const As=C.forwardRef(function(t,n){const{id:s,invert:i,position:o="bottom-right",hotkey:r=["altKey","KeyT"],expand:a,closeButton:c,className:u,offset:d,mobileOffset:l,theme:f="light",richColors:p,duration:g,style:w,visibleToasts:T=Cm,toastOptions:v,dir:A=mo(),gap:y=Mm,icons:b,containerAriaLabel:P="Notifications"}=t,[S,I]=C.useState([]),x=C.useMemo(()=>s?S.filter(j=>j.toasterId===s):S.filter(j=>!j.toasterId),[S,s]),R=C.useMemo(()=>Array.from(new Set([o].concat(x.filter(j=>j.position).map(j=>j.position)))),[x,o]),[L,_]=C.useState([]),[oe,J]=C.useState(!1),[ge,Me]=C.useState(!1),[U,V]=C.useState(f!=="system"?f:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),W=C.useRef(null),ee=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),G=C.useRef(null),Q=C.useRef(!1),ye=C.useCallback(j=>{I(B=>{var $;return($=B.find(te=>te.id===j.id))!=null&&$.delete||Re.dismiss(j.id),B.filter(({id:te})=>te!==j.id)})},[]);return C.useEffect(()=>Re.subscribe(j=>{if(j.dismiss){requestAnimationFrame(()=>{I(B=>B.map($=>$.id===j.id?{...$,delete:!0}:$))});return}setTimeout(()=>{Sl.flushSync(()=>{I(B=>{const $=B.findIndex(te=>te.id===j.id);return $!==-1?[...B.slice(0,$),{...B[$],...j},...B.slice($+1)]:[j,...B]})})})}),[S]),C.useEffect(()=>{if(f!=="system"){V(f);return}if(f==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?V("dark"):V("light")),typeof window>"u")return;const j=window.matchMedia("(prefers-color-scheme: dark)");try{j.addEventListener("change",({matches:B})=>{V(B?"dark":"light")})}catch{j.addListener(({matches:$})=>{try{V($?"dark":"light")}catch(te){console.error(te)}})}},[f]),C.useEffect(()=>{S.length<=1&&J(!1)},[S]),C.useEffect(()=>{const j=B=>{var $;if(r.every(D=>B[D]||B.code===D)){var N;J(!0),(N=W.current)==null||N.focus()}B.code==="Escape"&&(document.activeElement===W.current||($=W.current)!=null&&$.contains(document.activeElement))&&J(!1)};return document.addEventListener("keydown",j),()=>document.removeEventListener("keydown",j)},[r]),C.useEffect(()=>{if(W.current)return()=>{G.current&&(G.current.focus({preventScroll:!0}),G.current=null,Q.current=!1)}},[W.current]),C.createElement("section",{ref:n,"aria-label":`${P} ${ee}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},R.map((j,B)=>{var $;const[te,N]=j.split("-");return x.length?C.createElement("ol",{key:j,dir:A==="auto"?mo():A,tabIndex:-1,ref:W,className:u,"data-sonner-toaster":!0,"data-sonner-theme":U,"data-y-position":te,"data-x-position":N,style:{"--front-toast-height":`${(($=L[0])==null?void 0:$.height)||0}px`,"--width":`${km}px`,"--gap":`${y}px`,...w,...jm(d,l)},onBlur:D=>{Q.current&&!D.currentTarget.contains(D.relatedTarget)&&(Q.current=!1,G.current&&(G.current.focus({preventScroll:!0}),G.current=null))},onFocus:D=>{D.target instanceof HTMLElement&&D.target.dataset.dismissible==="false"||Q.current||(Q.current=!0,G.current=D.relatedTarget)},onMouseEnter:()=>J(!0),onMouseMove:()=>J(!0),onMouseLeave:()=>{ge||J(!1)},onDragEnd:()=>J(!1),onPointerDown:D=>{D.target instanceof HTMLElement&&D.target.dataset.dismissible==="false"||Me(!0)},onPointerUp:()=>Me(!1)},x.filter(D=>!D.position&&B===0||D.position===j).map((D,K)=>{var ae,F;return C.createElement(_m,{key:D.id,icons:b,index:K,toast:D,defaultRichColors:p,duration:(ae=v?.duration)!=null?ae:g,className:v?.className,descriptionClassName:v?.descriptionClassName,invert:i,visibleToasts:T,closeButton:(F=v?.closeButton)!=null?F:c,interacting:ge,position:j,style:v?.style,unstyled:v?.unstyled,classNames:v?.classNames,cancelButtonStyle:v?.cancelButtonStyle,actionButtonStyle:v?.actionButtonStyle,closeButtonAriaLabel:v?.closeButtonAriaLabel,removeToast:ye,toasts:x.filter(fe=>fe.position==D.position),heights:L.filter(fe=>fe.position==D.position),setHeights:_,expandByDefault:a,gap:y,expanded:oe,swipeDirections:t.swipeDirections})})):null}))}),Nm={Functions:"Functions and Graphs",BusinessMath:"Business and Financial Mathematics",Logic:"Logic and Reasoning"},Lg={Functions:"gm-1",BusinessMath:"gm-2",Logic:"gm-3"},Es=e=>{const t=e.trim().toLowerCase();return t==="functions"||t.includes("function")?"Functions":t==="businessmath"||t.includes("business")?"BusinessMath":t==="logic"||t.includes("reason")?"Logic":null},Om=h.lazy(()=>H(()=>import("./LoginPage-T2QRM5oF.js"),__vite__mapDeps([9,3,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,4,2,1,5,6]))),Fm=h.lazy(()=>H(()=>import("./TeacherDashboard-CLV58fUE.js"),__vite__mapDeps([27,3,10,11,12,13,14,28,29,30,31,4,2,1,5,6,32,7,20,16,21,33,34,25,35,36,37,38,39,40,41,42,43,15,44,17,19,45,46,47,48,24,49,50,18,51,52,53,54,55,56,57,58,59,60,61,62]))),Bm=h.lazy(()=>H(()=>import("./AdminDashboard-sWnGnYr4.js"),__vite__mapDeps([63,3,64,32,13,12,31,65,11,29,50,19,21,41,66,57,20,67,58,68,4,2,1,5,6,28,10,30,14,40,69,46,39,38,34,48,62,45,70,60,36,25,54,71,44,59,56,18,16,72,43,37,17]))),go=h.lazy(()=>H(()=>import("./Sidebar-CLDaRLyZ.js"),__vite__mapDeps([64,3,32,13,12,31,65,11,29,50,19,21,41,66,57,20,67,58,68,4,2,1,5,6]))),$m=h.lazy(()=>H(()=>import("./HeroBanner-Dml-Sn9K.js"),__vite__mapDeps([73,3,16,4,2,1,5,6]))),zm=h.lazy(()=>H(()=>import("./RightSidebar-BHJnYOaW.js"),__vite__mapDeps([74,3,48,65,11,13,12,58,50,75,4,2,1,5,6]))),Um=h.lazy(()=>H(()=>import("./XPNotification-BSSwW9a_.js"),__vite__mapDeps([76,3,75,15,4,2,1,5,6]))),Wm=h.lazy(()=>H(()=>import("./NotificationCenter-Eg9vwWZd.js"),__vite__mapDeps([77,3,54,55,29,21,57,36,58,4,2,1,5,6]))),Hm=h.lazy(()=>H(()=>import("./SearchBar-C7pZQ20f.js"),__vite__mapDeps([78,3,45,29,56,21,17,19,20,4,2,1,5,6]))),qm=h.lazy(()=>H(()=>import("./SupplementalBanner-DTd5-XUw.js"),__vite__mapDeps([79,3,29,15,50,21,17,16,4,2,1,5,6]))),Km=h.lazy(()=>H(()=>import("./LearningPath-BSacbKfT.js"),__vite__mapDeps([80,3,47,17,41,81,21,56,4,2,1,5,6]))),Gm=h.lazy(()=>H(()=>import("./CompetencyRadarChart-Bso8mrwZ.js"),__vite__mapDeps([82,3,47,17,41,16,15,61,12,4,2,1,5,6])).then(e=>({default:e.CompetencyRadarChart}))),Xm=h.lazy(()=>H(()=>import("./ModulesPage-DJAi-xJS.js"),__vite__mapDeps([83,3,81,21,56,10,11,12,13,14,58,15,59,18,75,39,29,70,47,17,41,33,1,2,48,23,84,0,4,5,6,85,7,46,86,79,50,16,62,45]))),Ym=h.lazy(()=>H(()=>import("./AIChatPage-CnRlS68Q.js"),__vite__mapDeps([87,3,10,11,12,13,14,51,52,53,4,2,1,5,6,38,45,30,35]))),Qm=h.lazy(()=>H(()=>import("./GradesPage-B1r-crcb.js"),__vite__mapDeps([88,3,10,11,12,13,47,17,41,18,59,60,43,72,50,4,2,1,5,6]))),Zm=h.lazy(()=>H(()=>import("./LeaderboardPage-D6ahhKnH.js"),__vite__mapDeps([89,3,29,21,59,18,56,58,17,34,75,49,4,2,1,5,6]))),Jm=h.lazy(()=>H(()=>import("./QuizBattlePage-BJ5HoB2m.js"),__vite__mapDeps([90,3,13,12,47,17,41,1,2,10,11,91,69,46,39,14,92,42,67,75,58,59,15,50,19,34,26,4,5,6]))),eg=h.lazy(()=>H(()=>import("./AvatarShop-1kFCJptl.js"),__vite__mapDeps([93,3,91,11,13,12,10,68,15,34,4,2,1,5,6]))),tg=h.lazy(()=>H(()=>import("./FloatingAITutor-DPLt7omS.js"),__vite__mapDeps([94,3,37,29,35,4,2,1,5,6]))),ng=h.lazy(()=>H(()=>import("./RewardsModal-BAC0Ze0K.js"),__vite__mapDeps([95,3,29,75,58,59,21,18,60,19,17,4,2,1,5,6]))),Cs=h.lazy(()=>H(()=>import("./ProfileModal-B2Fc7DEQ.js"),__vite__mapDeps([96,3,10,11,12,13,14,97,29,19,22,18,21,60,71,44,4,2,1,5,6]))),sg=h.lazy(()=>H(()=>import("./ConfirmModal-HuY-9h87.js"),__vite__mapDeps([28,3,10,11,12,13,29,30,31,4,2,1,5,6]))),Ds=h.lazy(()=>H(()=>import("./SettingsModal-ta9Wy9X1.js"),__vite__mapDeps([98,3,10,11,12,13,14,92,28,29,30,31,4,2,1,5,6,49,54,66,71,43,23,56]))),ig=h.lazy(()=>H(()=>import("./ScientificCalculator-vQs43GTt.js"),__vite__mapDeps([85,3,7,4,2,1,5,6,46,29]))),rg=h.lazy(()=>H(()=>import("./DiagnosticAssessmentModal-CMBQPpr8.js"),__vite__mapDeps([99,3,10,11,12,13,86,85,7,4,2,1,5,6,46,29,0,16,48,50,41,17]))),og=()=>{const{isLoggedIn:e,userProfile:t,userRole:n,loading:s,refreshProfile:i}=ll(),o=m.jsx("div",{className:"flex min-h-[320px] items-center justify-center text-sm font-semibold text-slate-500",children:"Loading content..."}),r=m.jsx("div",{className:"pb-4 text-sm font-semibold text-slate-500",children:"Loading dashboard content..."}),a=m.jsx("div",{className:"h-11 w-11 shrink-0 rounded-xl bg-[#edf1f7]","aria-hidden":"true"}),c=m.jsx("div",{className:"h-11 w-full rounded-xl bg-[#edf1f7]","aria-hidden":"true"}),u=m.jsx("div",{className:"h-screen w-72 border-r border-[#dde3eb] bg-white/70","aria-hidden":"true"}),d=m.jsx("div",{className:"min-h-[240px] rounded-3xl border border-[#dde3eb] bg-white/70","aria-hidden":"true"}),[l,f]=h.useState("Dashboard"),p=h.useRef(null),g=h.useRef(null),[w,T]=h.useState(!1),[v,A]=h.useState(!1),y=t,[b,P]=h.useState(y?.level||1),[S,I]=h.useState(y?.currentXP||0),[x,R]=h.useState(y?.totalXP||0),L=Math.floor(100*Math.pow(1.5,b-1));let _=0;for(let E=1;E{if(E==="Modules"&&bn){Se.info(`Complete your deep diagnostic (${Pt} outstanding) to unlock modules and regular practice.`),qe("followup_diagnostic"),tt(!0),f("Dashboard");return}M?ve(M):E==="Modules"&&l!=="Modules"&&ve(null),E==="Quiz Battle"&&l!=="Quiz Battle"?(U({collapsed:w}),T(!0)):l==="Quiz Battle"&&E!=="Quiz Battle"&&T(Me.collapsed),f(E),A(!1)},[W,ee]=h.useState(!1),[G,Q]=h.useState({show:!1,xp:0,message:""}),[ye,j]=h.useState(!1),[B,$]=h.useState(!1),[te,N]=h.useState(!1),[D,K]=h.useState(!1),[ae,F]=h.useState({}),[fe,ve]=h.useState(null),[be,Ze]=h.useState(On),[gn,Be]=h.useState(""),[et,Ve]=h.useState(!1),[yn,tt]=h.useState(!1),[pe,qe]=h.useState("initial_assessment"),[Ht,wt]=h.useState(y?.hasTakenDiagnostic||!1),[_e,St]=h.useState(y?.atRiskSubjects||[]),[Tt,dt]=h.useState(y?.priorityTopics||[]),[nt,qt]=h.useState(y?.gpa||"0.00"),[Ke,Kt]=h.useState(y?.learningPathState||"unlocked"),[ft,ht]=h.useState(y?.iarAssessmentState||"not_started"),[Pt,At]=h.useState(0),Et="iar_only";h.useEffect(()=>{e&&n==="student"&&t&&rm(t.uid).then(E=>{if(E&&E.averageScore>0){const M=Math.min(E.averageScore/25,4).toFixed(2);qt(M)}}).catch(E=>console.error("Error loading progress for GPA:",E))},[e,n,t]);const[Ae,vn]=h.useState(!1);h.useEffect(()=>{y&&n==="student"?(P(y.level||1),I(y.currentXP||0),R(y.totalXP||0),ge(y.streak||0),St(y.atRiskSubjects||[]),dt(y.priorityTopics||[]),wt(y.hasTakenDiagnostic||!1),Kt(y.learningPathState||"unlocked"),ht(y.iarAssessmentState||"not_started"),vn(!0)):n!=="student"&&vn(!0)},[t,n]),h.useEffect(()=>{if(!e||n!=="student"){Ve(!1);return}let E=!1;const M=()=>{E||Ve(!0)},z=window.requestIdleCallback,X=window.cancelIdleCallback,we=window.setTimeout(M,800),ss=window.requestAnimationFrame(()=>{z||M()}),Bi=z?.(()=>{M()},{timeout:500});return()=>{E=!0,window.clearTimeout(we),window.cancelAnimationFrame(ss),Bi!==void 0&&X&&X(Bi)}},[e,n]),h.useEffect(()=>{let E=!1;return(async()=>{if(!e||n!=="student"){At(0);return}const z=y?.lrn||t?.uid;if(!z||Ke!=="locked_pending_deep_diagnostic"){At(0);return}try{const{getPendingDeepDiagnosticCount:X}=await H(async()=>{const{getPendingDeepDiagnosticCount:ss}=await import("./automationService-BD3AWvKJ.js");return{getPendingDeepDiagnosticCount:ss}},__vite__mapDeps([0,1,2,3,4,5,6])),we=await X(z);E||At(we)}catch(X){console.error("Error loading deep diagnostic assignments:",X)}})(),()=>{E=!0}},[e,n,t?.uid,y?.lrn,Ke]);const bn=n==="student"&&(Ke==="locked_pending_deep_diagnostic"||ft==="deep_diagnostic_required"||ft==="deep_diagnostic_in_progress")&&(Pt>0||ft==="deep_diagnostic_required"||ft==="deep_diagnostic_in_progress"),xn=n==="student"&&ft==="skipped_unassessed",Ct=h.useMemo(()=>{const E=new Set;return _e.map(z=>Es(z)).filter(z=>z!==null).filter(z=>E.has(z)?!1:(E.add(z),!0))},[_e]),O=h.useMemo(()=>{const E=Tt.length>0?Tt:Ct,M=new Set;return E.filter(z=>M.has(z)?!1:(M.add(z),!0))},[Tt,Ct]),le=()=>{qe("initial_assessment"),tt(!0)};h.useEffect(()=>{e&&n==="student"&&t&&im(t.uid).then(E=>{ge(E)})},[e,n,t]),h.useEffect(()=>{F({})},[t?.uid]);const ie=[..._e].sort().join("|"),re=t?.uid?`mathpulse_supplemental_dismissed_${t.uid}`:null;h.useEffect(()=>{if(!re){Be("");return}try{const E=localStorage.getItem(re)||"";Be(E)}catch{Be("")}},[re]);const pt=()=>{if(ie&&(Be(ie),!!re))try{localStorage.setItem(re,ie)}catch{}},ue=()=>{if(Be(""),!!re)try{localStorage.removeItem(re)}catch{}},Ee=_e.length>0&&gn!==ie;h.useEffect(()=>{(async()=>{if(!t?.uid){Ze(On);return}try{const M=await xl(t.uid);Ze(M)}catch(M){console.error("Error loading user settings:",M),Ze(On)}})()},[t?.uid]),h.useEffect(()=>{lm(be)},[be]),h.useEffect(()=>{if(e&&n==="student"&&Ae&&!Ht){const E=setTimeout(()=>{qe("initial_assessment"),tt(!0)},1e3);return()=>clearTimeout(E)}},[e,n,Ae,Ht]);const Dt=async E=>{const M=y?.lrn||t?.uid;if(E.status==="skipped"){if(St([]),dt([]),wt(!0),Kt("unlocked"),ht("skipped_unassessed"),t?.uid)try{await ws(t.uid,{hasTakenDiagnostic:!0,atRiskSubjects:[],priorityTopics:[],learningPathState:"unlocked",remediationState:"not_required",iarAssessmentState:"skipped_unassessed",recommendedNextTopicGroupId:"g11-q1-functions-foundations",recommendationRationale:"Default Grade 11 Q1 path after explicit IAR skip.",recommendedPace:"normal",startingQuarterG11:"Q1",currentCurriculumVersionSetId:y?.currentCurriculumVersionSetId||"g11-core-genmath-legacy-detail-strengthened-structure"}),await sm(t.uid,"reminder","IAR Skipped: You are on default path","You are currently marked as Unassessed and placed on Grade 11 Quarter 1 default flow. Take the Initial Assessment anytime for personalized placement.")}catch(we){console.error("Failed to persist skipped IAR state:",we)}Se.message("Assessment skipped. Default Grade 11 Q1 path applied.",{description:"You can take the Initial Assessment later for personalized recommendations."}),tt(!1),f("Dashboard");return}ue();const z=(E.atRiskSubjectIds||[]).map(we=>Es(we)).filter(we=>we!==null),X=(E.priorityTopics||[]).map(we=>Es(we)).filter(we=>we!==null);if(St(z.length>0?z:E.atRiskSubjectIds||[]),dt(X),wt(!0),ht("in_progress"),t?.uid)try{await ws(t.uid,{hasTakenDiagnostic:!0,atRiskSubjects:z,priorityTopics:X,topicScores:E.topicScores,iarTopicClassifications:E.topicClassifications,g12ReadinessIndicators:E.g12ReadinessIndicators,iarAssessmentState:"in_progress",iarQuestionSetVersion:E.questionSetVersion})}catch(we){console.error("Failed to persist completed IAR payload:",we)}pe==="followup_diagnostic"&&Se.success("Deep diagnostic submitted. Module unlock will update after assignment-state verification."),pe==="initial_assessment"&&M&&((E.atRiskSubjectIds||[]).length>0&&Et==="iar_plus_diagnostic"||Se.success("Initial assessment completed. Personalized path is now active.")),tt(!1),f("Dashboard")},Le=()=>{f("AI Chat")},Ie=async(E,M)=>{if(t)try{const z=await yl(t.uid,E,"manual",M);I(z.xp),z.leveledUp&&P(z.newLevel),R(X=>X+E),await i(),Q({show:!0,xp:E,message:M})}catch(z){console.error("Error awarding XP:",z)}},Rt=async()=>{try{await dp(),F({}),f("Dashboard"),j(!1)}catch(E){console.error("Error logging out:",E)}},Ce=async E=>{if(!t){N(!1),$(!1);return}const M={};["name","email","phone","photo","avatarLayers","lrn","grade","section","school","enrollmentDate","major","gpa","department","subject","yearsOfExperience","qualification","position"].forEach(X=>{E[X]!==void 0&&(M[X]=E[X])});try{await ws(t.uid,M),F(X=>({...X,...M})),N(!1),$(!1),Se.success("Profile updated successfully")}catch(X){console.error("Error saving profile:",X),Se.error("Failed to update profile")}},wn=async E=>{if(t?.uid)try{const M=await am(t.uid,E);Ze(M),Se.success("Settings saved successfully")}catch(M){throw console.error("Error saving settings:",M),Se.error("Failed to save settings"),M}},Zn=async E=>{try{await fp(E),Se.success("Password updated successfully")}catch(M){const z=M instanceof Error?M.message:"Unable to update password";throw Se.error(z),M}},Jn=async()=>{if(!t?.uid)return;const E=await um(t.uid),M=new Blob([JSON.stringify(E,null,2)],{type:"application/json"}),z=URL.createObjectURL(M),X=document.createElement("a");X.href=z,X.download=`mathpulse-data-export-${t.uid}-${Date.now()}.json`,document.body.appendChild(X),X.click(),document.body.removeChild(X),URL.revokeObjectURL(z),Se.success("Data export downloaded")},es=async()=>{await cm(),Se.success("Local cache cleared")},ts=async()=>{if(!t?.uid||n!=="admin")throw new Error("Only admin accounts can delete this account from settings.");try{await hp(t.uid),Se.success("Account deleted successfully")}catch(E){const M=E instanceof Error?E.message:"Unable to delete account";throw Se.error(M),E}},ns=async()=>{if(!t)throw new Error("No active profile found.");const E=n==="student"?y?.lrn||t.uid:void 0,{resetTestingDataForRole:M}=await H(async()=>{const{resetTestingDataForRole:X}=await import("./testResetService-BCgi1kVA.js");return{resetTestingDataForRole:X}},__vite__mapDeps([100,1,2,3,4,5,6])),z=await M({uid:t.uid,role:n,lrn:E});n==="student"&&(P(1),I(0),R(0),ge(0),St([]),wt(!1),Kt("unlocked"),ht("not_started"),qt("0.00"),At(0),f("Dashboard")),Se.success(z.summary)},De=t?{uid:t.uid,name:t.name,email:t.email,phone:t.phone||"",photo:t.photo||"https://images.unsplash.com/photo-1633332755192-727a05c4013d?w=200&h=200&fit=crop",avatarLayers:t.avatarLayers,role:t.role,...n==="student"&&y?{lrn:y.lrn,grade:y.grade,section:y.section,school:y.school,enrollmentDate:y.enrollmentDate,major:y.major,gpa:nt}:{},...ae}:{uid:void 0,name:"User",email:"",phone:"",photo:"https://images.unsplash.com/photo-1633332755192-727a05c4013d?w=200&h=200&fit=crop",avatarLayers:void 0,role:n},Fi=De.name.trim().split(/\s+/).find(E=>/\p{L}/u.test(E))||De.name.trim()||"User";return h.useEffect(()=>{const E=M=>{if(!(M.target instanceof HTMLInputElement||M.target instanceof HTMLTextAreaElement)&&M.altKey)switch(M.key.toLowerCase()){case"d":M.preventDefault(),V("Dashboard");break;case"m":M.preventDefault(),V("Modules");break;case"c":M.preventDefault(),V("AI Chat");break;case"g":M.preventDefault(),V("Grades");break;case"b":M.preventDefault(),V("Quiz Battle");break;case"s":M.preventDefault(),$(!0);break;case"p":M.preventDefault(),N(!0);break;case"k":M.preventDefault(),K(z=>!z);break}};if(e&&n==="student")return window.addEventListener("keydown",E),()=>window.removeEventListener("keydown",E)},[e,n,bn,Pt]),s?m.jsx(Xt,{}):e?n!=="student"||Ae?n==="teacher"?m.jsxs(m.Fragment,{children:[m.jsx(h.Suspense,{fallback:m.jsx(Xt,{message:"Loading teacher dashboard..."}),children:m.jsx(Fm,{onLogout:Rt,onOpenProfile:()=>N(!0),onOpenSettings:()=>$(!0)})}),te&&m.jsx(h.Suspense,{fallback:null,children:m.jsx(Cs,{isOpen:te,onClose:()=>N(!1),profileData:De,onSave:Ce})}),B&&m.jsx(h.Suspense,{fallback:null,children:m.jsx(Ds,{isOpen:B,onClose:()=>$(!1),profileData:De,onSave:Ce,settingsData:be,onSaveSettings:wn,onApplySettingsPreview:Ze,onUpdatePassword:Zn,onExportData:Jn,onClearCache:es,onDeleteAccount:ts,onResetData:ns})}),m.jsx(As,{position:"top-right",richColors:!0,closeButton:!0})]}):n==="admin"?m.jsxs(m.Fragment,{children:[m.jsx(h.Suspense,{fallback:m.jsx(Xt,{message:"Loading admin dashboard..."}),children:m.jsx(Bm,{onLogout:Rt,onOpenProfile:()=>N(!0),onOpenSettings:()=>$(!0)})}),te&&m.jsx(h.Suspense,{fallback:null,children:m.jsx(Cs,{isOpen:te,onClose:()=>N(!1),profileData:De,onSave:Ce})}),B&&m.jsx(h.Suspense,{fallback:null,children:m.jsx(Ds,{isOpen:B,onClose:()=>$(!1),profileData:De,onSave:Ce,settingsData:be,onSaveSettings:wn,onApplySettingsPreview:Ze,onUpdatePassword:Zn,onExportData:Jn,onClearCache:es,onDeleteAccount:ts,onResetData:ns})}),m.jsx(As,{position:"top-right",richColors:!0,closeButton:!0})]}):m.jsxs(m.Fragment,{children:[m.jsx(nm,{children:m.jsxs("div",{className:"flex h-screen w-full bg-[#f8faff] overflow-hidden",children:[m.jsx("div",{className:"hidden lg:block",children:m.jsx(h.Suspense,{fallback:u,children:m.jsx(go,{activeTab:l,setActiveTab:V,userRole:n,onOpenSettings:()=>$(!0),onLogout:()=>j(!0),sidebarCollapsed:w,setSidebarCollapsed:T,forceCollapsed:l==="Quiz Battle"})})}),v&&m.jsxs(m.Fragment,{children:[m.jsx("button",{"aria-label":"Close navigation",className:"fixed inset-0 z-40 bg-slate-900/40 backdrop-blur-[1px] lg:hidden",onClick:()=>A(!1)}),m.jsx("div",{className:"fixed inset-y-0 left-0 z-50 p-3 lg:hidden",children:m.jsx(h.Suspense,{fallback:u,children:m.jsx(go,{mode:"mobile",onRequestClose:()=>A(!1),activeTab:l,setActiveTab:V,userRole:n,onOpenSettings:()=>{$(!0),A(!1)},onLogout:()=>{j(!0),A(!1)},sidebarCollapsed:!1})})})]}),m.jsxs("div",{className:"flex-1 min-h-0 flex flex-col min-w-0 bg-gradient-to-br from-indigo-200 via-fuchsia-50 to-orange-100 relative z-10 shadow-[rgba(124,58,237,0.05)_0px_0px_30px_inset]",children:[m.jsx("div",{className:"absolute inset-0 bg-math-pattern opacity-30 pointer-events-none mix-blend-multiply z-0"}),m.jsxs("header",{className:"bg-white/90 backdrop-blur-md border-b border-[#dde3eb] px-3 sm:px-6 py-3 flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 sticky top-0 z-30 shadow-sm",children:[m.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[m.jsx("button",{className:"lg:hidden p-2 rounded-xl bg-[#edf1f7] hover:bg-[#dde3eb] text-[#5a6578] hover:text-primary transition-colors",onClick:()=>A(!0),"aria-label":"Open navigation",children:m.jsx(ep,{size:20})}),m.jsxs("div",{className:"min-w-0",children:[m.jsx("h1",{className:"text-lg sm:text-xl font-display font-bold text-[#0a1628] leading-tight truncate",children:l}),m.jsxs("p",{className:"text-xs text-[#5a6578] font-body truncate",children:["Welcome back, ",De.name.split(" ")[0],"!"]})]}),m.jsxs("div",{className:"hidden md:flex items-center gap-2 ml-2",children:[m.jsxs("button",{onClick:()=>ee(!0),className:"flex items-center gap-1.5 px-3 py-1.5 bg-rose-50 hover:bg-rose-100 border border-rose-200/60 rounded-lg transition-colors cursor-pointer group",title:"View Rewards & Progress",children:[m.jsx(Yh,{className:"h-3.5 w-3.5 text-rose-500","aria-hidden":"true"}),m.jsxs("span",{className:"text-xs font-display font-bold text-rose-700",children:["Lv ",b]})]}),m.jsxs("button",{onClick:()=>ee(!0),className:"flex items-center gap-1.5 px-3 py-1.5 bg-violet-50 hover:bg-violet-100 border border-violet-200/60 rounded-lg transition-colors cursor-pointer",title:`${oe}/${L} XP to next level`,children:[m.jsx(ip,{className:"h-3.5 w-3.5 text-violet-500","aria-hidden":"true"}),m.jsxs("span",{className:"text-xs font-display font-bold text-violet-700",children:[S," XP"]}),m.jsx("div",{className:"w-12 h-1.5 bg-violet-100 rounded-full overflow-hidden",children:m.jsx("div",{className:"h-full bg-violet-500 rounded-full transition-all",style:{width:`${oe/L*100}%`}})})]}),m.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1.5 bg-orange-50 border border-orange-200/60 rounded-lg",children:[m.jsx(Zh,{className:"h-3.5 w-3.5 text-orange-500","aria-hidden":"true"}),m.jsxs("span",{className:"text-xs font-display font-bold text-orange-700",children:[J," day",J!==1?"s":""]})]})]})]}),m.jsxs("div",{className:"flex flex-wrap md:flex-nowrap items-center gap-2 min-w-0",children:[m.jsx("div",{className:"hidden md:block flex-1 min-w-0 max-w-[420px]",children:m.jsx(h.Suspense,{fallback:c,children:m.jsx(Hm,{onSelect:E=>{}})})}),m.jsx("button",{onClick:()=>K(E=>!E),className:"p-3 rounded-xl bg-[#edf1f7] hover:bg-[#dde3eb] text-[#5a6578] hover:text-primary transition-all group",title:"Scientific Calculator (Alt+K)",children:m.jsx(Gh,{size:20,className:"group-hover:scale-110 transition-transform"})}),m.jsx(h.Suspense,{fallback:a,children:m.jsx(Wm,{userRole:n})}),m.jsxs("button",{onClick:()=>N(!0),className:"flex items-center gap-2.5 h-11 shrink-0 bg-[#edf1f7] hover:bg-[#dde3eb] p-1.5 pr-3 rounded-lg cursor-pointer transition-all group","aria-label":`Profile: ${De.name}`,children:[m.jsx("img",{src:De.photo,alt:De.name,className:"w-8 h-8 rounded-lg object-cover"}),m.jsx("div",{className:"hidden sm:block text-left min-w-0 flex-1",children:m.jsx("p",{className:"text-sm font-semibold text-[#0a1628] leading-none group-hover:text-primary transition-colors font-body truncate",children:Fi})})]})]})]}),m.jsx("main",{ref:g,className:`flex-1 min-h-0 p-3 lg:p-4 ${l==="AI Chat"?"overflow-hidden":"overflow-y-auto pb-24 sm:pb-28"}`,children:m.jsx(Mf,{mode:"wait",children:m.jsx(Nn.div,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},exit:{opacity:0,y:-16},transition:{duration:.25,ease:[.22,1,.36,1]},className:l==="AI Chat"?"h-full min-h-0":"",children:l==="Dashboard"?m.jsx("div",{className:"px-4 sm:px-6 xl:px-10 py-6 sm:py-8",children:m.jsxs("div",{className:"grid grid-cols-12 gap-6 sm:gap-8 lg:gap-10",children:[m.jsxs("div",{className:"col-span-12 xl:col-span-9 flex flex-col gap-10 lg:gap-14 pt-0",children:[m.jsx(h.Suspense,{fallback:d,children:m.jsx($m,{userName:Fi,userLevel:b,avatarLayers:De.avatarLayers,onContinueLearning:()=>V("Modules"),showAssessmentTooltip:xn,onOpenAssessment:le})}),et&&Ht&&Ct.length>0&&m.jsxs("div",{className:"rounded-2xl border border-amber-300 bg-amber-50 px-5 py-4 shadow-sm dark:border-amber-400/40 dark:bg-amber-400/10",children:[m.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[m.jsxs("div",{children:[m.jsxs("p",{className:"inline-flex items-center gap-2 text-sm font-black text-amber-900 dark:text-amber-200",children:[m.jsx(np,{className:"h-4 w-4"}),"Assessment Focus Review"]}),m.jsx("p",{className:"mt-1 text-sm text-amber-900/85 dark:text-amber-100/90",children:"Your latest diagnostic flagged these topics for review. Modules are prioritized based on this focus order."})]}),m.jsxs("button",{type:"button",onClick:()=>V("Modules"),className:"inline-flex items-center gap-1.5 rounded-xl bg-amber-600 px-3 py-2 text-xs font-bold text-white transition-colors hover:bg-amber-700",children:["Open Modules",m.jsx(Wh,{className:"h-3.5 w-3.5"})]})]}),m.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:O.map((E,M)=>m.jsxs("span",{className:"rounded-full bg-white/90 px-3 py-1 text-xs font-semibold text-amber-900 shadow-sm dark:bg-amber-100/20 dark:text-amber-100",children:[M+1,". ",Nm[E]]},E))})]}),et&&Ee&&m.jsx(h.Suspense,{fallback:r,children:m.jsx(qm,{variant:"full",atRiskSubjects:_e,onDismiss:pt,onAction:()=>{pt(),V("Modules")}})}),Ae&&et&&m.jsx(h.Suspense,{fallback:r,children:m.jsx("div",{className:"pb-4",children:m.jsx(Km,{onNavigateToModules:E=>V("Modules",E),atRiskSubjects:_e,priorityTopics:O})})}),Ae&&et&&m.jsx(h.Suspense,{fallback:r,children:m.jsx("div",{className:"pb-4",children:m.jsx(Gm,{})})})]}),m.jsx("div",{className:"col-span-12 xl:col-span-3 pt-2",children:et?m.jsx(h.Suspense,{fallback:d,children:m.jsx(zm,{onOpenRewards:()=>ee(!0),onOpenLeaderboard:()=>f("Leaderboard"),onNavigateToModules:()=>f("Modules"),userLevel:b,currentXP:oe,xpToNextLevel:L,overallXP:S,streak:J,streakHistory:y?.streakHistory||[]})}):d})]})}):l==="Modules"?m.jsx(h.Suspense,{fallback:o,children:m.jsx(Xm,{onEarnXP:Ie,atRiskSubjects:_e,priorityTopics:O,initialModuleId:fe})}):l==="Leaderboard"?m.jsx(h.Suspense,{fallback:o,children:m.jsx(Zm,{currentUserPhoto:De.photo})}):l==="Quiz Battle"?m.jsx(h.Suspense,{fallback:o,children:m.jsx(Jm,{})}):l==="AI Chat"?m.jsx(h.Suspense,{fallback:o,children:m.jsx(Ym,{})}):l==="Grades"?m.jsx(h.Suspense,{fallback:o,children:m.jsx(Qm,{})}):l==="Avatar Studio"?m.jsx(h.Suspense,{fallback:o,children:m.jsx(eg,{onSaveProfile:E=>{F(M=>({...M,avatarLayers:E}))},onNavigateToModules:()=>f("Modules")})}):m.jsxs("div",{className:"flex-1 flex items-center justify-center text-[#a8a5b3] font-medium font-body",children:[l," Content Coming Soon"]})},l)})}),l!=="AI Chat"&&m.jsx(h.Suspense,{fallback:null,children:m.jsx("div",{className:"fixed bottom-4 right-4 sm:bottom-8 sm:right-8 z-50",children:m.jsx(tg,{constraintsRef:p,onFullScreen:Le})})}),m.jsx(h.Suspense,{fallback:null,children:m.jsx(Um,{xp:G.xp,message:G.message,show:G.show,onComplete:()=>Q(E=>({...E,show:!1}))})}),W&&m.jsx(h.Suspense,{fallback:null,children:m.jsx(ng,{isOpen:W,onClose:()=>ee(!1),userLevel:b,currentXP:S,xpToNextLevel:L,totalXP:x,streak:J})}),te&&m.jsx(h.Suspense,{fallback:null,children:m.jsx(Cs,{isOpen:te,onClose:()=>N(!1),profileData:De,onSave:Ce})}),ye&&m.jsx(h.Suspense,{fallback:null,children:m.jsx(sg,{isOpen:ye,onClose:()=>j(!1),onConfirm:Rt,title:"Confirm Logout",message:"Are you sure you want to log out? Your progress is saved automatically.",confirmText:"Logout",cancelText:"Stay",type:"warning",icon:"logout"})}),B&&m.jsx(h.Suspense,{fallback:null,children:m.jsx(Ds,{isOpen:B,onClose:()=>$(!1),profileData:De,onSave:Ce,settingsData:be,onSaveSettings:wn,onApplySettingsPreview:Ze,onUpdatePassword:Zn,onExportData:Jn,onClearCache:es,onDeleteAccount:ts,onResetData:ns})}),D&&m.jsx(h.Suspense,{fallback:null,children:m.jsx(ig,{isOpen:D,onClose:()=>K(!1)})}),yn&&m.jsx(h.Suspense,{fallback:null,children:m.jsx(rg,{isOpen:yn,onClose:()=>tt(!1),onComplete:Dt,lrn:y?.lrn||t?.uid,gradeLevel:y?.grade,workflowMode:Et,assessmentType:pe})})]})]})}),m.jsx(As,{position:"top-right",richColors:!0,closeButton:!0})]}):m.jsx(Xt,{message:"Preparing your dashboard..."}):m.jsx(h.Suspense,{fallback:m.jsx(Xt,{message:"Loading sign in..."}),children:m.jsx(Om,{})})};let yo=!1;const vo=()=>{yo||(yo=!0,H(()=>Promise.resolve({}),__vite__mapDeps([101])).catch(e=>{console.error("[styles] Deferred full stylesheet failed to load:",e)}))};if(typeof window<"u"){const e=window.requestIdleCallback,t=window.cancelIdleCallback,n=e?.(()=>{vo()},{timeout:1200});window.setTimeout(()=>{n!==void 0&&t&&t(n),vo()},1200)}const wl=document.getElementById("root");if(!wl)throw new Error("Root element not found");Tl.createRoot(wl).render(m.jsx(pp,{children:m.jsx(og,{})}));export{Wh as A,qh as B,Gh as C,On as D,Eg as E,Zh as F,Pg as G,mg as H,lt as I,op as J,ws as K,Ag as L,ep as M,sm as N,ji as O,Mp as P,np as T,ip as Z,H as _,yg as a,vg as b,ut as c,q as d,Mf as e,wg as f,rm as g,Tg as h,Sg as i,xl as j,am as k,Yh as l,Nn as m,xg as n,Es as o,Lg as p,Cg as q,kg as r,gg as s,Se as t,ll as u,Rg as v,Dg as w,Mg as x,Nm as y,bg as z}; +What would you like to learn about?`}const bg=()=>{const e=h.useContext(pl);if(!e)throw new Error("useChatContext must be used within ChatProvider");return e},nm=({children:e})=>{const{currentUser:t}=ll(),[n,s]=h.useState([]),[i,o]=h.useState(null),[r,a]=h.useState(!1),[c,u]=h.useState(null),[d,l]=h.useState(!1),f=h.useRef(new Map);h.useEffect(()=>{if(!t){s([]),l(!1);return}(async()=>{try{const P=await gt(),S=await P.getUserChatSessions(t.uid),I=await Promise.all(S.map(async x=>{const L=(await P.getSessionMessages(x.id)).map(_=>({id:_.id,sender:_.role==="user"?"user":"ai",text:_.role==="assistant"?je(_.content):_.content,timestamp:_.timestamp instanceof Date?_.timestamp.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):new Date(_.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}));return{id:x.id,title:x.title,date:x.updatedAt instanceof Date?x.updatedAt.toLocaleDateString():new Date(x.updatedAt).toLocaleDateString(),messageCount:L.length,preview:L.length>0&&Ss(L[L.length-1].text)||"No messages yet",topics:[],messages:L,createdAt:x.createdAt instanceof Date?x.createdAt:new Date(x.createdAt),updatedAt:x.updatedAt instanceof Date?x.updatedAt:new Date(x.updatedAt)}}));s(I)}catch(P){console.error("Error loading chat sessions:",P)}finally{l(!0)}})()},[t]);const p=b=>{if(b.length===0)return"New Chat";const P=b.find(x=>x.sender==="user")?.text||"",S=P.toLowerCase();if(S.includes("quadratic")||S.includes("ax² + bx + c"))return"Quadratic Equations Help";if(S.includes("derivative")||S.includes("calculus"))return"Derivatives & Calculus";if(S.includes("pythagor")||S.includes("right triangle"))return"Pythagorean Theorem";if(S.includes("trig")||S.includes("sin")||S.includes("cos"))return"Trigonometry Help";if(S.includes("area")||S.includes("perimeter"))return"Geometry - Area & Perimeter";if(S.includes("algebra")||S.includes("solve")&&S.includes("x"))return"Algebra Problem Solving";if(S.includes("factor"))return"Factoring Practice";if(S.includes("graph")||S.includes("plot"))return"Graphing Functions";if(S.includes("matrix")||S.includes("matrices"))return"Matrix Operations";if(S.includes("integral")||S.includes("integrate"))return"Integration Problems";if(S.includes("limit"))return"Limits in Calculus";if(S.includes("statistic")||S.includes("probability"))return"Statistics & Probability";const I=P.slice(0,40);return I.length{const P=Date.now().toString(),S=new Date,I={id:P,title:b?p([b]):"New Chat",date:"Just now",messageCount:b?1:0,preview:b&&Ss(b.text)||"Start a new conversation...",topics:[],messages:b?[b]:[],createdAt:S,updatedAt:S};if(s(x=>[I,...x]),t){const x=b?p([b]):"New Chat",R=gt().then(async L=>{const _=await L.createChatSession(t.uid,x);return b&&await L.addMessageToSession(_.id,b.sender==="user"?"user":"assistant",b.text),_.id}).catch(L=>(console.error("Error creating Firebase session:",L),P));f.current.set(P,R)}return P},[t]),w=h.useCallback((b,P)=>{const S=P.sender==="ai"?{...P,text:je(P.text)}:P;s(x=>x.map(R=>{if(R.id===b){const L=[...R.messages,S];return{...R,messages:L,messageCount:L.length,preview:Ss(S.text)||R.preview,updatedAt:new Date,title:L.length===2?p(L):R.title}}return R}));const I=async x=>{const R=f.current.get(x);return R?await R:x};I(b).then(async x=>{await(await gt()).addMessageToSession(x,S.sender==="user"?"user":"assistant",S.text)}).catch(x=>console.error("Error persisting message:",x)),s(x=>{const R=x.find(L=>L.id===b);if(R&&R.messages.length===2){const L=p(R.messages);I(b).then(async _=>{await(await gt()).updateSessionTitle(_,L)}).catch(_=>console.error("Error updating title:",_))}return x})},[]),T=h.useCallback(async(b,P)=>{const S=P.trim(),I={id:Date.now().toString(),sender:"user",text:S,timestamp:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})};w(b,I),u(b),a(!0);try{let x=null,R=null;const L=n.find(N=>N.id===b),_=(L?.messages||[]).map(N=>({role:N.sender==="user"?"user":"assistant",content:N.text})),oe=ml(S)?Gp(_):null,J=oe?Xp(oe):S,ge=oe??S,Me=hl(S,{history:_});if(Me){const N={id:(Date.now()+1).toString(),sender:"ai",text:Me,timestamp:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})};w(b,N);return}try{const N=await lo();x=N.apiService,R=N.ApiTimeoutError}catch(N){console.error("Failed to load API service for chat:",N);const D={id:(Date.now()+1).toString(),sender:"ai",text:Dn(ge),timestamp:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})};w(b,D);return}const U=new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});let V="",W=null;const ee=em(S),G=tm(S),Q=Yp(S),ye=G||!!Q,j=Q?{expectedEndMarker:Q,completionMode:"marker"}:void 0,B=N=>ni(S,N,Q,G),$=N=>{N.trim()&&s(D=>D.map(K=>{if(K.id!==b)return K;if(!W){W=`stream-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;const ae={id:W,sender:"ai",text:N,timestamp:U},F=[...K.messages,ae];return{...K,messages:F,messageCount:F.length,updatedAt:new Date}}return{...K,messages:K.messages.map(ae=>ae.id===W?{...ae,text:N}:ae),updatedAt:new Date}}))},te=()=>{if(!W)return;const N=W;s(D=>D.map(K=>{if(K.id!==b)return K;const ae=K.messages.filter(F=>F.id!==N);return{...K,messages:ae,messageCount:ae.length,updatedAt:new Date}}))};try{const{response:N}=await x.chat(J,_,F=>{V+=F,ee&&$(Rp(V))},j);let D=je(N||V).trim();if(ye&&D&&B(D)){try{const F=await x.chatSafe(co(S,D,Q),_,j),fe=je(F.data.response).trim();D=Cn(D,fe)}catch(F){console.warn("Streaming completion repair failed:",F)}if(ye&&D&&B(D))try{const F=await x.chatSafe(uo(S,D,Q),_,j),fe=je(F.data.response).trim();D=Cn(D,fe)}catch(F){console.warn("Streaming plain continuation repair failed:",F)}if(ye&&D&&B(D))try{const F=await x.chatSafe(fo(S,Q),_,j),fe=je(F.data.response).trim();fe&&(D=ho(S,D,fe,Q,G))}catch(F){console.warn("Streaming full completion repair failed:",F)}}const K=B(D);(!D||K&&!ye)&&(D=Dn(ge,_)),W&&te();const ae={id:(Date.now()+1).toString(),sender:"ai",text:D,timestamp:U};w(b,ae)}catch(N){R&&N instanceof R?console.warn(`Streaming timed out after ${N.timeoutMs}ms, falling back to non-streaming chat.`,N):console.warn("Streaming failed, falling back to non-streaming chat:",N),W&&te();let D="";try{const F=x??(await lo()).apiService,{data:fe}=await F.chatSafe(J,_,j);if(D=je(fe.response).trim(),ye&&D&&B(D))try{const ve=await F.chatSafe(co(S,D,Q),_,j),be=je(ve.data.response).trim();D=Cn(D,be)}catch(ve){console.warn("Non-stream completion repair failed:",ve)}if(ye&&D&&B(D))try{const ve=await F.chatSafe(uo(S,D,Q),_,j),be=je(ve.data.response).trim();D=Cn(D,be)}catch(ve){console.warn("Non-stream plain continuation repair failed:",ve)}if(ye&&D&&B(D))try{const ve=await F.chatSafe(fo(S,Q),_,j),be=je(ve.data.response).trim();be&&(D=ho(S,D,be,Q,G))}catch(ve){console.warn("Non-stream full completion repair failed:",ve)}}catch(F){console.warn("Chat request failed, using local fallback response:",F),D=Dn(ge,_)}const K=B(D);(!D||K&&!ye)&&(D=Dn(ge,_));const ae={id:(Date.now()+1).toString(),sender:"ai",text:je(D),timestamp:U};w(b,ae)}if(L&&L.messages.length===1){const N=n.find(D=>D.id===b);if(N&&N.messages.length>1){const D=p(N.messages),K=f.current.get(b);(K||Promise.resolve(b)).then(async F=>{await(await gt()).updateSessionTitle(F,D)}).catch(F=>console.error("Error updating title:",F))}}}finally{a(!1),u(null)}},[n,w]),v=h.useCallback((b,P)=>{s(x=>x.map(R=>R.id===b?{...R,title:P}:R));const S=f.current.get(b);(S||Promise.resolve(b)).then(async x=>{await(await gt()).updateSessionTitle(x,P)}).catch(x=>console.error("Error updating session title:",x))},[]),A=h.useCallback(b=>{s(I=>I.filter(x=>x.id!==b)),i===b&&o(null);const P=f.current.get(b);(P||Promise.resolve(b)).then(async I=>{await(await gt()).deleteSession(I)}).catch(I=>console.error("Error deleting session:",I)),f.current.delete(b)},[i]),y=h.useCallback(()=>n.find(b=>b.id===i)||null,[n,i]);return m.jsx(pl.Provider,{value:{sessions:n,activeSessionId:i,isLoading:r,loadingSessionId:c,sessionsLoaded:d,setActiveSessionId:o,createNewSession:g,addMessageToSession:w,sendMessage:T,updateSessionTitle:v,deleteSession:A,getActiveSession:y,generateTitleFromMessages:p},children:e})},gl=e=>{const t=e.data(),n=t.createdAt,s=typeof n?.toDate=="function"?n.toDate():n instanceof Date?n:new Date,i=t.actionUrl??t.link??void 0;return{...t,id:e.id,createdAt:s,actionUrl:i}},sm=async(e,t,n,s,i)=>{try{const o=se(We(q,"notifications")),r={id:o.id,userId:e,type:t,title:n,message:s,read:!1,...i?{actionUrl:i}:{},createdAt:new Date},a={id:r.id,userId:r.userId,type:r.type,title:r.title,message:r.message,read:r.read,createdAt:he(),link:i||null};return await He(o,{...a}),r}catch(o){throw console.error("Error creating notification:",o),o}},xg=async(e,t=50,n=!1)=>{try{let s=rt(We(q,"notifications"),Oe("userId","==",e),tn("createdAt","desc"),nn(t));return n&&(s=rt(We(q,"notifications"),Oe("userId","==",e),Oe("read","==",!1),tn("createdAt","desc"),nn(t))),(await un(s)).docs.map(o=>gl(o))}catch(s){return console.error("Error getting notifications:",s),[]}},wg=(e,t={},n,s)=>{if(!e)return n([]),()=>{};const{limitCount:i=50,unreadOnly:o=!1}=t,r=[Oe("userId","==",e),tn("createdAt","desc"),nn(i)],a=o?rt(We(q,"notifications"),Oe("userId","==",e),Oe("read","==",!1),tn("createdAt","desc"),nn(i)):rt(We(q,"notifications"),...r);return bo(a,c=>{n(c.docs.map(u=>gl(u)))},c=>{console.error("Error subscribing to notifications:",c),s?.(c)})},Sg=async e=>{try{const t=se(q,"notifications",e);await Bt(t,{read:!0})}catch(t){throw console.error("Error marking notification as read:",t),t}},Tg=async e=>{try{const t=rt(We(q,"notifications"),Oe("userId","==",e),Oe("read","==",!1)),n=await un(t);await Promise.all(n.docs.map(s=>Bt(s.ref,{read:!0})))}catch(t){throw console.error("Error marking all notifications as read:",t),t}},im=async e=>{try{const t=se(q,"users",e),n=await ke(t);if(!n.exists())throw new Error("User not found");const s=n.data(),i=s.lastActivityDate?.toDate(),o=new Date;o.setHours(0,0,0,0);let r=s.streak||0;if(!i)r=1;else{const u=new Date(i);u.setHours(0,0,0,0);const d=Math.floor((o.getTime()-u.getTime())/(1e3*60*60*24));if(d===0)r=s.streak||1;else if(d===1){r=(s.streak||0)+1;const l=Math.min(r*5,50);await yl(e,l,"streak_bonus",`${r} day streak bonus!`)}else r=1}const a=new Date,c=`${a.getFullYear()}-${String(a.getMonth()+1).padStart(2,"0")}-${String(a.getDate()).padStart(2,"0")}`;return await Bt(t,{streak:r,streakHistory:Fl(c),lastActivityDate:he(),updatedAt:he()}),r}catch(t){return console.error("Error updating streak:",t),0}},yl=async(e,t,n,s)=>{try{const i=se(q,"users",e),o=await ke(i);if(!o.exists())throw new Error("User not found");const r=o.data(),a=r.currentXP||0,c=r.totalXP||0,u=a+t,d=c+t,l=r.level||1;console.log(`🏆 XP Award - User: ${e}, Amount: ${t}, Previous currentXP: ${a}, New: ${u}, Type: ${n}`);let f=l,p=d,g=!1;for(;;){const v=Math.floor(100*Math.pow(1.5,f-1));let A=0;for(let y=1;y<=f;y++)A+=Math.floor(100*Math.pow(1.5,y-1));if(d>=A)f++,g=!0;else break}const w={currentXP:u,totalXP:d,level:f,updatedAt:he()};await Bt(i,w),console.log(`💾 Firebase Update - currentXP: ${a} -> ${u}, totalXP: ${c} -> ${d}, level: ${f}`);const T=se(We(q,"xpActivities"));return await He(T,{activityId:T.id,userId:e,type:n,xpEarned:t,description:s,timestamp:he()}),{newLevel:f,leveledUp:g,xp:u,addedXp:t}}catch(i){throw console.error("Error awarding XP:",i),i}},Pg=async(e,t=!1,n="all",s=10)=>{try{const i=rt(We(q,"users"),Oe("role","==","student"),tn("totalXP","desc"),nn(s));return(await un(i)).docs.map((r,a)=>{const c=r.data();return{userId:r.id,name:c.name||"Unknown",photo:c.photo,xp:c.totalXP||0,level:c.level||1,rank:a+1,weeklyXP:c.weeklyXP||0,monthlyXP:c.monthlyXP||0}})}catch(i){return console.error("Error getting leaderboard:",i),[]}},Ag=async e=>{try{const t=await ke(se(q,"users",e));if(!t.exists())return 0;const n=t.data().totalXP||0,s=rt(We(q,"users"),Oe("role","==","student"),Oe("totalXP",">",n));return(await un(s)).size+1}catch(t){return console.error("Error getting user rank:",t),0}},Eg=async e=>{try{const t=await ke(se(q,"achievements",e));return t.exists()?t.data().achievements||[]:[]}catch(t){return console.error("Error getting user achievements:",t),[]}},ji=async e=>{const t={userId:e,subjects:{},lessons:{},quizAttempts:[],totalLessonsCompleted:0,totalQuizzesCompleted:0,averageScore:0,updatedAt:new Date};return await He(se(q,"progress",e),t),t},rm=async e=>{try{const t=se(q,"progress",e),n=await ke(t);if(n.exists()){const s=n.data();return{...s,updatedAt:s.updatedAt?.toDate()||new Date}}return await ji(e)}catch(t){return console.error("Error getting user progress:",t),null}},Cg=(e,t)=>{const n=se(q,"progress",e);return bo(n,s=>{if(!s.exists()){t(null);return}const i=s.data();t({...i,updatedAt:i.updatedAt?.toDate?.()||new Date})},s=>{console.error("Error subscribing to user progress:",s),t(null)})},Dg=async(e,t,n)=>{const s=Math.max(0,Math.min(100,n)),i=se(q,"progress",e);await He(i,{[`lessons.${t}.lessonId`]:t,[`lessons.${t}.progressPercent`]:s,updatedAt:he()},{merge:!0})},Rg=async(e,t,n,s,i)=>{const o=se(q,"progress",e),r=await ke(o);if(!r.exists())return 0;const c=r.data().subjects?.[t]?.modulesProgress?.[n];if(!c)return 0;const u=Math.max(1,s+i),d=c.lessonsCompleted?.length||0,l=c.quizzesCompleted?.length||0,f=Math.round((d+l)/u*100);return await He(o,{[`subjects.${t}.modulesProgress.${n}.progress`]:f,[`subjects.${t}.modulesProgress.${n}.lastAccessedAt`]:he(),updatedAt:he()},{merge:!0}),f},kg=async(e,t,n,s,i,o=50)=>{try{const r=se(q,"progress",e);let a=await ke(r);a.exists()||(await ji(e),a=await ke(r));const c=a.data(),u={lessonId:s,completed:!0,completedAt:new Date,timeSpent:i};c.subjects||(c.subjects={}),c.subjects[t]||(c.subjects[t]={subjectId:t,progress:0,completedModules:0,totalModules:0,modulesProgress:{}});const d=c.subjects[t];d.modulesProgress[n]||(d.modulesProgress[n]={moduleId:n,subjectId:t,progress:0,lessonsCompleted:[],quizzesCompleted:[],startedAt:new Date,lastAccessedAt:new Date});const l=d.modulesProgress[n],f=!l.lessonsCompleted.includes(s);f&&(l.lessonsCompleted.push(s),l.lastAccessedAt=new Date),await He(r,{[`lessons.${s}`]:u,[`subjects.${t}.modulesProgress.${n}`]:l,...f&&{totalLessonsCompleted:Fn(1)},updatedAt:he()},{merge:!0}),await vl(e,o,"lesson_complete",`Completed lesson: ${s}`)}catch(r){throw console.error("Error completing lesson:",r),r}},Mg=async(e,t,n,s,i,o,r)=>{try{const a=se(q,"progress",e);let c=await ke(a);c.exists()||(await ji(e),c=await ke(a));const u=c.data(),d={quizId:s,attemptNumber:(u.quizAttempts?.filter(w=>w.quizId===s).length||0)+1,score:i,completedAt:new Date,timeSpent:r,answers:o},l=Math.floor(i/100*100);u.subjects||(u.subjects={}),u.subjects[t]||(u.subjects[t]={subjectId:t,progress:0,completedModules:0,totalModules:0,modulesProgress:{}});const f=u.subjects[t];f.modulesProgress[n]||(f.modulesProgress[n]={moduleId:n,subjectId:t,progress:0,lessonsCompleted:[],quizzesCompleted:[],startedAt:new Date,lastAccessedAt:new Date});const p=f.modulesProgress[n],g=!p.quizzesCompleted.includes(s);g&&(p.quizzesCompleted.push(s),p.lastAccessedAt=new Date),await Bt(a,{quizAttempts:[...u.quizAttempts||[],d],[`subjects.${t}.modulesProgress.${n}`]:p,...g&&{totalQuizzesCompleted:Fn(1)},updatedAt:he()}),await vl(e,l,"quiz_complete",`Completed quiz: ${s} (Score: ${i}%)`)}catch(a){throw console.error("Error completing quiz:",a),a}},vl=async(e,t,n,s)=>{try{const i=se(q,"users",e);await Bt(i,{currentXP:Fn(t),totalXP:Fn(t),updatedAt:he()});const o=se(We(q,"xpActivities"));await He(o,{activityId:o.id,userId:e,type:n,xpEarned:t,description:s,timestamp:he()})}catch(i){console.error("Error awarding XP:",i)}},On={notifications:{emailNotifications:!0,pushNotifications:!0,soundEnabled:!0,notificationTypes:{quizReminders:!0,newContent:!0,achievements:!0,streakAlerts:!0,weeklySummary:!0},quietHours:{start:"22:00",end:"08:00"}},appearance:{darkMode:!1,fontSize:16,compactView:!1,reduceAnimations:!1},privacy:{profileVisibility:"everyone",showActivityStatus:!0,dataSharing:!0},learning:{dailyXpGoal:100,preferredStudyTime:"evening",autoPlayLessons:!1,showHints:!0,quizDifficultyPreference:"adaptive",studyReminderTime:"18:00"},adminPanel:{siteName:"MathPulse AI",siteDescription:"AI-Powered Mathematics Learning Platform",defaultLanguage:"English",maintenanceMode:!1,enforceStrongPasswords:!0,sessionTimeoutMinutes:60,aiTutorEnabled:!0,aiAutoRecommendations:!0,aiRiskAlertsEnabled:!0,gradingScale:"percentage",passingGrade:75,parentSummaryEmails:!0,teacherDigestEmails:!0,weeklyPlatformReport:!0,autoBackupEnabled:!1,backupFrequency:"weekly"}},om="preferences",Ni=()=>JSON.parse(JSON.stringify(On)),bl=e=>{const t=Ni();return e?{...t,...e,notifications:{...t.notifications,...e.notifications,notificationTypes:{...t.notifications.notificationTypes,...e.notifications?.notificationTypes},quietHours:{...t.notifications.quietHours,...e.notifications?.quietHours}},appearance:{...t.appearance,...e.appearance},privacy:{...t.privacy,...e.privacy},learning:{...t.learning,...e.learning},adminPanel:{...t.adminPanel,...e.adminPanel}}:t},Oi=e=>se(q,"users",e,"settings",om),xl=async e=>{const t=Oi(e),n=await ke(t);if(!n.exists()){const s=Ni();return await He(t,{...s,createdAt:he(),updatedAt:he()}),s}return bl(n.data())},am=async(e,t)=>{const n=await xl(e),s=bl({...n,...t});return await He(Oi(e),{...s,updatedAt:he()},{merge:!0}),s},lm=e=>{const t=document.documentElement;t.style.setProperty("--font-size",`${e.appearance.fontSize}px`),t.dataset.density=e.appearance.compactView?"compact":"comfortable",e.appearance.reduceAnimations?t.classList.add("reduced-motion"):t.classList.remove("reduced-motion"),e.appearance.darkMode?t.classList.add("smart-dark"):t.classList.remove("smart-dark")},cm=async()=>{try{if(localStorage.clear(),sessionStorage.clear(),"caches"in window){const e=await caches.keys();await Promise.all(e.map(t=>caches.delete(t)))}}catch(e){throw console.error("Failed clearing client cache:",e),new Error("Unable to clear cache on this device.")}},um=async e=>{const t=se(q,"users",e),n=await ke(t),s=await ke(Oi(e)),i=["progress","xpActivities","achievements","notifications","tasks","chatSessions","chatMessages"],o=await Promise.all(i.map(async r=>{const a=rt(We(q,r),Oe("userId","==",e)),c=await un(a);return{collectionName:r,items:c.docs.map(u=>({id:u.id,...u.data()}))}}));return{exportedAt:new Date().toISOString(),user:n.exists()?{id:n.id,...n.data()}:null,settings:s.exists()?s.data():Ni(),collections:o.reduce((r,a)=>(r[a.collectionName]=a.items,r),{})}};function dm(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}const fm=e=>{switch(e){case"success":return mm;case"info":return ym;case"warning":return gm;case"error":return vm;default:return null}},hm=Array(12).fill(0),pm=({visible:e,className:t})=>C.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},C.createElement("div",{className:"sonner-spinner"},hm.map((n,s)=>C.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${s}`})))),mm=C.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},C.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),gm=C.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},C.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),ym=C.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},C.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),vm=C.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},C.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),bm=C.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},C.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),C.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),xm=()=>{const[e,t]=C.useState(document.hidden);return C.useEffect(()=>{const n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e};let si=1;class wm{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const n=this.subscribers.indexOf(t);this.subscribers.splice(n,1)}),this.publish=t=>{this.subscribers.forEach(n=>n(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var n;const{message:s,...i}=t,o=typeof t?.id=="number"||((n=t.id)==null?void 0:n.length)>0?t.id:si++,r=this.toasts.find(c=>c.id===o),a=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(o)&&this.dismissedToasts.delete(o),r?this.toasts=this.toasts.map(c=>c.id===o?(this.publish({...c,...t,id:o,title:s}),{...c,...t,id:o,dismissible:a,title:s}):c):this.addToast({title:s,...i,dismissible:a,id:o}),o},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(n=>n({id:t,dismiss:!0})))):this.toasts.forEach(n=>{this.subscribers.forEach(s=>s({id:n.id,dismiss:!0}))}),t),this.message=(t,n)=>this.create({...n,message:t}),this.error=(t,n)=>this.create({...n,message:t,type:"error"}),this.success=(t,n)=>this.create({...n,type:"success",message:t}),this.info=(t,n)=>this.create({...n,type:"info",message:t}),this.warning=(t,n)=>this.create({...n,type:"warning",message:t}),this.loading=(t,n)=>this.create({...n,type:"loading",message:t}),this.promise=(t,n)=>{if(!n)return;let s;n.loading!==void 0&&(s=this.create({...n,promise:t,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));const i=Promise.resolve(t instanceof Function?t():t);let o=s!==void 0,r;const a=i.then(async u=>{if(r=["resolve",u],C.isValidElement(u))o=!1,this.create({id:s,type:"default",message:u});else if(Tm(u)&&!u.ok){o=!1;const l=typeof n.error=="function"?await n.error(`HTTP error! status: ${u.status}`):n.error,f=typeof n.description=="function"?await n.description(`HTTP error! status: ${u.status}`):n.description,g=typeof l=="object"&&!C.isValidElement(l)?l:{message:l};this.create({id:s,type:"error",description:f,...g})}else if(u instanceof Error){o=!1;const l=typeof n.error=="function"?await n.error(u):n.error,f=typeof n.description=="function"?await n.description(u):n.description,g=typeof l=="object"&&!C.isValidElement(l)?l:{message:l};this.create({id:s,type:"error",description:f,...g})}else if(n.success!==void 0){o=!1;const l=typeof n.success=="function"?await n.success(u):n.success,f=typeof n.description=="function"?await n.description(u):n.description,g=typeof l=="object"&&!C.isValidElement(l)?l:{message:l};this.create({id:s,type:"success",description:f,...g})}}).catch(async u=>{if(r=["reject",u],n.error!==void 0){o=!1;const d=typeof n.error=="function"?await n.error(u):n.error,l=typeof n.description=="function"?await n.description(u):n.description,p=typeof d=="object"&&!C.isValidElement(d)?d:{message:d};this.create({id:s,type:"error",description:l,...p})}}).finally(()=>{o&&(this.dismiss(s),s=void 0),n.finally==null||n.finally.call(n)}),c=()=>new Promise((u,d)=>a.then(()=>r[0]==="reject"?d(r[1]):u(r[1])).catch(d));return typeof s!="string"&&typeof s!="number"?{unwrap:c}:Object.assign(s,{unwrap:c})},this.custom=(t,n)=>{const s=n?.id||si++;return this.create({jsx:t(s),id:s,...n}),s},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const Re=new wm,Sm=(e,t)=>{const n=t?.id||si++;return Re.addToast({title:e,...t,id:n}),n},Tm=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",Pm=Sm,Am=()=>Re.toasts,Em=()=>Re.getActiveToasts(),Se=Object.assign(Pm,{success:Re.success,info:Re.info,warning:Re.warning,error:Re.error,custom:Re.custom,message:Re.message,promise:Re.promise,dismiss:Re.dismiss,loading:Re.loading},{getHistory:Am,getToasts:Em});dm("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function Rn(e){return e.label!==void 0}const Cm=3,Dm="24px",Rm="16px",po=4e3,km=356,Mm=14,Lm=45,Im=200;function Ge(...e){return e.filter(Boolean).join(" ")}function Vm(e){const[t,n]=e.split("-"),s=[];return t&&s.push(t),n&&s.push(n),s}const _m=e=>{var t,n,s,i,o,r,a,c,u;const{invert:d,toast:l,unstyled:f,interacting:p,setHeights:g,visibleToasts:w,heights:T,index:v,toasts:A,expanded:y,removeToast:b,defaultRichColors:P,closeButton:S,style:I,cancelButtonStyle:x,actionButtonStyle:R,className:L="",descriptionClassName:_="",duration:oe,position:J,gap:ge,expandByDefault:Me,classNames:U,icons:V,closeButtonAriaLabel:W="Close toast"}=e,[ee,G]=C.useState(null),[Q,ye]=C.useState(null),[j,B]=C.useState(!1),[$,te]=C.useState(!1),[N,D]=C.useState(!1),[K,ae]=C.useState(!1),[F,fe]=C.useState(!1),[ve,be]=C.useState(0),[Ze,gn]=C.useState(0),Be=C.useRef(l.duration||oe||po),et=C.useRef(null),Ve=C.useRef(null),yn=v===0,tt=v+1<=w,pe=l.type,qe=l.dismissible!==!1,Ht=l.className||"",wt=l.descriptionClassName||"",_e=C.useMemo(()=>T.findIndex(O=>O.toastId===l.id)||0,[T,l.id]),St=C.useMemo(()=>{var O;return(O=l.closeButton)!=null?O:S},[l.closeButton,S]),Tt=C.useMemo(()=>l.duration||oe||po,[l.duration,oe]),dt=C.useRef(0),nt=C.useRef(0),qt=C.useRef(0),Ke=C.useRef(null),[Kt,ft]=J.split("-"),ht=C.useMemo(()=>T.reduce((O,le,ie)=>ie>=_e?O:O+le.height,0),[T,_e]),Pt=xm(),At=l.invert||d,Et=pe==="loading";nt.current=C.useMemo(()=>_e*ge+ht,[_e,ht]),C.useEffect(()=>{Be.current=Tt},[Tt]),C.useEffect(()=>{B(!0)},[]),C.useEffect(()=>{const O=Ve.current;if(O){const le=O.getBoundingClientRect().height;return gn(le),g(ie=>[{toastId:l.id,height:le,position:l.position},...ie]),()=>g(ie=>ie.filter(re=>re.toastId!==l.id))}},[g,l.id]),C.useLayoutEffect(()=>{if(!j)return;const O=Ve.current,le=O.style.height;O.style.height="auto";const ie=O.getBoundingClientRect().height;O.style.height=le,gn(ie),g(re=>re.find(ue=>ue.toastId===l.id)?re.map(ue=>ue.toastId===l.id?{...ue,height:ie}:ue):[{toastId:l.id,height:ie,position:l.position},...re])},[j,l.title,l.description,g,l.id,l.jsx,l.action,l.cancel]);const Ae=C.useCallback(()=>{te(!0),be(nt.current),g(O=>O.filter(le=>le.toastId!==l.id)),setTimeout(()=>{b(l)},Im)},[l,b,g,nt]);C.useEffect(()=>{if(l.promise&&pe==="loading"||l.duration===1/0||l.type==="loading")return;let O;return y||p||Pt?(()=>{if(qt.current{Be.current!==1/0&&(dt.current=new Date().getTime(),O=setTimeout(()=>{l.onAutoClose==null||l.onAutoClose.call(l,l),Ae()},Be.current))})(),()=>clearTimeout(O)},[y,p,l,pe,Pt,Ae]),C.useEffect(()=>{l.delete&&(Ae(),l.onDismiss==null||l.onDismiss.call(l,l))},[Ae,l.delete]);function vn(){var O;if(V?.loading){var le;return C.createElement("div",{className:Ge(U?.loader,l==null||(le=l.classNames)==null?void 0:le.loader,"sonner-loader"),"data-visible":pe==="loading"},V.loading)}return C.createElement(pm,{className:Ge(U?.loader,l==null||(O=l.classNames)==null?void 0:O.loader),visible:pe==="loading"})}const bn=l.icon||V?.[pe]||fm(pe);var xn,Ct;return C.createElement("li",{tabIndex:0,ref:Ve,className:Ge(L,Ht,U?.toast,l==null||(t=l.classNames)==null?void 0:t.toast,U?.default,U?.[pe],l==null||(n=l.classNames)==null?void 0:n[pe]),"data-sonner-toast":"","data-rich-colors":(xn=l.richColors)!=null?xn:P,"data-styled":!(l.jsx||l.unstyled||f),"data-mounted":j,"data-promise":!!l.promise,"data-swiped":F,"data-removed":$,"data-visible":tt,"data-y-position":Kt,"data-x-position":ft,"data-index":v,"data-front":yn,"data-swiping":N,"data-dismissible":qe,"data-type":pe,"data-invert":At,"data-swipe-out":K,"data-swipe-direction":Q,"data-expanded":!!(y||Me&&j),"data-testid":l.testId,style:{"--index":v,"--toasts-before":v,"--z-index":A.length-v,"--offset":`${$?ve:nt.current}px`,"--initial-height":Me?"auto":`${Ze}px`,...I,...l.style},onDragEnd:()=>{D(!1),G(null),Ke.current=null},onPointerDown:O=>{O.button!==2&&(Et||!qe||(et.current=new Date,be(nt.current),O.target.setPointerCapture(O.pointerId),O.target.tagName!=="BUTTON"&&(D(!0),Ke.current={x:O.clientX,y:O.clientY})))},onPointerUp:()=>{var O,le,ie;if(K||!qe)return;Ke.current=null;const re=Number(((O=Ve.current)==null?void 0:O.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),pt=Number(((le=Ve.current)==null?void 0:le.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),ue=new Date().getTime()-((ie=et.current)==null?void 0:ie.getTime()),Ee=ee==="x"?re:pt,Dt=Math.abs(Ee)/ue;if(Math.abs(Ee)>=Lm||Dt>.11){be(nt.current),l.onDismiss==null||l.onDismiss.call(l,l),ye(ee==="x"?re>0?"right":"left":pt>0?"down":"up"),Ae(),ae(!0);return}else{var Le,Ie;(Le=Ve.current)==null||Le.style.setProperty("--swipe-amount-x","0px"),(Ie=Ve.current)==null||Ie.style.setProperty("--swipe-amount-y","0px")}fe(!1),D(!1),G(null)},onPointerMove:O=>{var le,ie,re;if(!Ke.current||!qe||((le=window.getSelection())==null?void 0:le.toString().length)>0)return;const ue=O.clientY-Ke.current.y,Ee=O.clientX-Ke.current.x;var Dt;const Le=(Dt=e.swipeDirections)!=null?Dt:Vm(J);!ee&&(Math.abs(Ee)>1||Math.abs(ue)>1)&&G(Math.abs(Ee)>Math.abs(ue)?"x":"y");let Ie={x:0,y:0};const Rt=Ce=>1/(1.5+Math.abs(Ce)/20);if(ee==="y"){if(Le.includes("top")||Le.includes("bottom"))if(Le.includes("top")&&ue<0||Le.includes("bottom")&&ue>0)Ie.y=ue;else{const Ce=ue*Rt(ue);Ie.y=Math.abs(Ce)0)Ie.x=Ee;else{const Ce=Ee*Rt(Ee);Ie.x=Math.abs(Ce)0||Math.abs(Ie.y)>0)&&fe(!0),(ie=Ve.current)==null||ie.style.setProperty("--swipe-amount-x",`${Ie.x}px`),(re=Ve.current)==null||re.style.setProperty("--swipe-amount-y",`${Ie.y}px`)}},St&&!l.jsx&&pe!=="loading"?C.createElement("button",{"aria-label":W,"data-disabled":Et,"data-close-button":!0,onClick:Et||!qe?()=>{}:()=>{Ae(),l.onDismiss==null||l.onDismiss.call(l,l)},className:Ge(U?.closeButton,l==null||(s=l.classNames)==null?void 0:s.closeButton)},(Ct=V?.close)!=null?Ct:bm):null,(pe||l.icon||l.promise)&&l.icon!==null&&(V?.[pe]!==null||l.icon)?C.createElement("div",{"data-icon":"",className:Ge(U?.icon,l==null||(i=l.classNames)==null?void 0:i.icon)},l.promise||l.type==="loading"&&!l.icon?l.icon||vn():null,l.type!=="loading"?bn:null):null,C.createElement("div",{"data-content":"",className:Ge(U?.content,l==null||(o=l.classNames)==null?void 0:o.content)},C.createElement("div",{"data-title":"",className:Ge(U?.title,l==null||(r=l.classNames)==null?void 0:r.title)},l.jsx?l.jsx:typeof l.title=="function"?l.title():l.title),l.description?C.createElement("div",{"data-description":"",className:Ge(_,wt,U?.description,l==null||(a=l.classNames)==null?void 0:a.description)},typeof l.description=="function"?l.description():l.description):null),C.isValidElement(l.cancel)?l.cancel:l.cancel&&Rn(l.cancel)?C.createElement("button",{"data-button":!0,"data-cancel":!0,style:l.cancelButtonStyle||x,onClick:O=>{Rn(l.cancel)&&qe&&(l.cancel.onClick==null||l.cancel.onClick.call(l.cancel,O),Ae())},className:Ge(U?.cancelButton,l==null||(c=l.classNames)==null?void 0:c.cancelButton)},l.cancel.label):null,C.isValidElement(l.action)?l.action:l.action&&Rn(l.action)?C.createElement("button",{"data-button":!0,"data-action":!0,style:l.actionButtonStyle||R,onClick:O=>{Rn(l.action)&&(l.action.onClick==null||l.action.onClick.call(l.action,O),!O.defaultPrevented&&Ae())},className:Ge(U?.actionButton,l==null||(u=l.classNames)==null?void 0:u.actionButton)},l.action.label):null)};function mo(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function jm(e,t){const n={};return[e,t].forEach((s,i)=>{const o=i===1,r=o?"--mobile-offset":"--offset",a=o?Rm:Dm;function c(u){["top","right","bottom","left"].forEach(d=>{n[`${r}-${d}`]=typeof u=="number"?`${u}px`:u})}typeof s=="number"||typeof s=="string"?c(s):typeof s=="object"?["top","right","bottom","left"].forEach(u=>{s[u]===void 0?n[`${r}-${u}`]=a:n[`${r}-${u}`]=typeof s[u]=="number"?`${s[u]}px`:s[u]}):c(a)}),n}const As=C.forwardRef(function(t,n){const{id:s,invert:i,position:o="bottom-right",hotkey:r=["altKey","KeyT"],expand:a,closeButton:c,className:u,offset:d,mobileOffset:l,theme:f="light",richColors:p,duration:g,style:w,visibleToasts:T=Cm,toastOptions:v,dir:A=mo(),gap:y=Mm,icons:b,containerAriaLabel:P="Notifications"}=t,[S,I]=C.useState([]),x=C.useMemo(()=>s?S.filter(j=>j.toasterId===s):S.filter(j=>!j.toasterId),[S,s]),R=C.useMemo(()=>Array.from(new Set([o].concat(x.filter(j=>j.position).map(j=>j.position)))),[x,o]),[L,_]=C.useState([]),[oe,J]=C.useState(!1),[ge,Me]=C.useState(!1),[U,V]=C.useState(f!=="system"?f:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),W=C.useRef(null),ee=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),G=C.useRef(null),Q=C.useRef(!1),ye=C.useCallback(j=>{I(B=>{var $;return($=B.find(te=>te.id===j.id))!=null&&$.delete||Re.dismiss(j.id),B.filter(({id:te})=>te!==j.id)})},[]);return C.useEffect(()=>Re.subscribe(j=>{if(j.dismiss){requestAnimationFrame(()=>{I(B=>B.map($=>$.id===j.id?{...$,delete:!0}:$))});return}setTimeout(()=>{Sl.flushSync(()=>{I(B=>{const $=B.findIndex(te=>te.id===j.id);return $!==-1?[...B.slice(0,$),{...B[$],...j},...B.slice($+1)]:[j,...B]})})})}),[S]),C.useEffect(()=>{if(f!=="system"){V(f);return}if(f==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?V("dark"):V("light")),typeof window>"u")return;const j=window.matchMedia("(prefers-color-scheme: dark)");try{j.addEventListener("change",({matches:B})=>{V(B?"dark":"light")})}catch{j.addListener(({matches:$})=>{try{V($?"dark":"light")}catch(te){console.error(te)}})}},[f]),C.useEffect(()=>{S.length<=1&&J(!1)},[S]),C.useEffect(()=>{const j=B=>{var $;if(r.every(D=>B[D]||B.code===D)){var N;J(!0),(N=W.current)==null||N.focus()}B.code==="Escape"&&(document.activeElement===W.current||($=W.current)!=null&&$.contains(document.activeElement))&&J(!1)};return document.addEventListener("keydown",j),()=>document.removeEventListener("keydown",j)},[r]),C.useEffect(()=>{if(W.current)return()=>{G.current&&(G.current.focus({preventScroll:!0}),G.current=null,Q.current=!1)}},[W.current]),C.createElement("section",{ref:n,"aria-label":`${P} ${ee}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},R.map((j,B)=>{var $;const[te,N]=j.split("-");return x.length?C.createElement("ol",{key:j,dir:A==="auto"?mo():A,tabIndex:-1,ref:W,className:u,"data-sonner-toaster":!0,"data-sonner-theme":U,"data-y-position":te,"data-x-position":N,style:{"--front-toast-height":`${(($=L[0])==null?void 0:$.height)||0}px`,"--width":`${km}px`,"--gap":`${y}px`,...w,...jm(d,l)},onBlur:D=>{Q.current&&!D.currentTarget.contains(D.relatedTarget)&&(Q.current=!1,G.current&&(G.current.focus({preventScroll:!0}),G.current=null))},onFocus:D=>{D.target instanceof HTMLElement&&D.target.dataset.dismissible==="false"||Q.current||(Q.current=!0,G.current=D.relatedTarget)},onMouseEnter:()=>J(!0),onMouseMove:()=>J(!0),onMouseLeave:()=>{ge||J(!1)},onDragEnd:()=>J(!1),onPointerDown:D=>{D.target instanceof HTMLElement&&D.target.dataset.dismissible==="false"||Me(!0)},onPointerUp:()=>Me(!1)},x.filter(D=>!D.position&&B===0||D.position===j).map((D,K)=>{var ae,F;return C.createElement(_m,{key:D.id,icons:b,index:K,toast:D,defaultRichColors:p,duration:(ae=v?.duration)!=null?ae:g,className:v?.className,descriptionClassName:v?.descriptionClassName,invert:i,visibleToasts:T,closeButton:(F=v?.closeButton)!=null?F:c,interacting:ge,position:j,style:v?.style,unstyled:v?.unstyled,classNames:v?.classNames,cancelButtonStyle:v?.cancelButtonStyle,actionButtonStyle:v?.actionButtonStyle,closeButtonAriaLabel:v?.closeButtonAriaLabel,removeToast:ye,toasts:x.filter(fe=>fe.position==D.position),heights:L.filter(fe=>fe.position==D.position),setHeights:_,expandByDefault:a,gap:y,expanded:oe,swipeDirections:t.swipeDirections})})):null}))}),Nm={Functions:"Functions and Graphs",BusinessMath:"Business and Financial Mathematics",Logic:"Logic and Reasoning"},Lg={Functions:"gm-1",BusinessMath:"gm-2",Logic:"gm-3"},Es=e=>{const t=e.trim().toLowerCase();return t==="functions"||t.includes("function")?"Functions":t==="businessmath"||t.includes("business")?"BusinessMath":t==="logic"||t.includes("reason")?"Logic":null},Om=h.lazy(()=>H(()=>import("./LoginPage-QhJ2yB_c.js"),__vite__mapDeps([9,3,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,4,2,1,5,6]))),Fm=h.lazy(()=>H(()=>import("./TeacherDashboard-CTQJuBtl.js"),__vite__mapDeps([27,3,10,11,12,13,14,28,29,30,31,4,2,1,5,6,32,7,20,16,21,33,34,25,35,36,37,38,39,40,41,42,43,15,44,17,19,45,46,47,48,24,49,50,18,51,52,53,54,55,56,57,58,59,60,61,62]))),Bm=h.lazy(()=>H(()=>import("./AdminDashboard-gfXmaPwb.js"),__vite__mapDeps([63,3,64,32,13,12,31,65,11,29,50,19,21,41,66,57,20,67,58,68,4,2,1,5,6,28,10,30,14,40,69,46,39,38,34,48,62,45,70,60,36,25,54,71,44,59,56,18,16,72,43,37,17]))),go=h.lazy(()=>H(()=>import("./Sidebar-HVTXyPGL.js"),__vite__mapDeps([64,3,32,13,12,31,65,11,29,50,19,21,41,66,57,20,67,58,68,4,2,1,5,6]))),$m=h.lazy(()=>H(()=>import("./HeroBanner-nfRGXqul.js"),__vite__mapDeps([73,3,16,4,2,1,5,6]))),zm=h.lazy(()=>H(()=>import("./RightSidebar-c9BUk44H.js"),__vite__mapDeps([74,3,48,65,11,13,12,58,50,75,4,2,1,5,6]))),Um=h.lazy(()=>H(()=>import("./XPNotification-CFHzSyP5.js"),__vite__mapDeps([76,3,75,15,4,2,1,5,6]))),Wm=h.lazy(()=>H(()=>import("./NotificationCenter-ofzm6YSA.js"),__vite__mapDeps([77,3,54,55,29,21,57,36,58,4,2,1,5,6]))),Hm=h.lazy(()=>H(()=>import("./SearchBar-KL-CbGtm.js"),__vite__mapDeps([78,3,45,29,56,21,17,19,20,4,2,1,5,6]))),qm=h.lazy(()=>H(()=>import("./SupplementalBanner-DIN86DZO.js"),__vite__mapDeps([79,3,29,15,50,21,17,16,4,2,1,5,6]))),Km=h.lazy(()=>H(()=>import("./LearningPath-xhsARrsq.js"),__vite__mapDeps([80,3,47,17,41,81,21,56,4,2,1,5,6]))),Gm=h.lazy(()=>H(()=>import("./CompetencyRadarChart-D0AVDm8g.js"),__vite__mapDeps([82,3,47,17,41,16,15,61,12,4,2,1,5,6])).then(e=>({default:e.CompetencyRadarChart}))),Xm=h.lazy(()=>H(()=>import("./ModulesPage-COuXuHrB.js"),__vite__mapDeps([83,3,81,21,56,10,11,12,13,14,58,15,59,18,75,39,29,70,47,17,41,33,1,2,48,23,84,0,4,5,6,85,7,46,86,79,50,16,62,45]))),Ym=h.lazy(()=>H(()=>import("./AIChatPage-bzvb0iBg.js"),__vite__mapDeps([87,3,10,11,12,13,14,51,52,53,4,2,1,5,6,38,45,30,35]))),Qm=h.lazy(()=>H(()=>import("./GradesPage-CZjSVd52.js"),__vite__mapDeps([88,3,10,11,12,13,47,17,41,18,59,60,43,72,50,4,2,1,5,6]))),Zm=h.lazy(()=>H(()=>import("./LeaderboardPage-BMdoHzNS.js"),__vite__mapDeps([89,3,29,21,59,18,56,58,17,34,75,49,4,2,1,5,6]))),Jm=h.lazy(()=>H(()=>import("./QuizBattlePage-3pqx9mUa.js"),__vite__mapDeps([90,3,13,12,47,17,41,1,2,10,11,91,69,46,39,14,92,42,67,75,58,59,15,50,19,34,26,4,5,6]))),eg=h.lazy(()=>H(()=>import("./AvatarShop-EpLIaBDr.js"),__vite__mapDeps([93,3,91,11,13,12,10,68,15,34,4,2,1,5,6]))),tg=h.lazy(()=>H(()=>import("./FloatingAITutor-DFhmOqQt.js"),__vite__mapDeps([94,3,37,29,35,4,2,1,5,6]))),ng=h.lazy(()=>H(()=>import("./RewardsModal-CsH4qI6T.js"),__vite__mapDeps([95,3,29,75,58,59,21,18,60,19,17,4,2,1,5,6]))),Cs=h.lazy(()=>H(()=>import("./ProfileModal-C2CHUW-6.js"),__vite__mapDeps([96,3,10,11,12,13,14,97,29,19,22,18,21,60,71,44,4,2,1,5,6]))),sg=h.lazy(()=>H(()=>import("./ConfirmModal-FyItBILR.js"),__vite__mapDeps([28,3,10,11,12,13,29,30,31,4,2,1,5,6]))),Ds=h.lazy(()=>H(()=>import("./SettingsModal-BnULUpJH.js"),__vite__mapDeps([98,3,10,11,12,13,14,92,28,29,30,31,4,2,1,5,6,49,54,66,71,43,23,56]))),ig=h.lazy(()=>H(()=>import("./ScientificCalculator-Do4eNBdw.js"),__vite__mapDeps([85,3,7,4,2,1,5,6,46,29]))),rg=h.lazy(()=>H(()=>import("./DiagnosticAssessmentModal-Si7Hh1eA.js"),__vite__mapDeps([99,3,10,11,12,13,86,85,7,4,2,1,5,6,46,29,0,16,48,50,41,17]))),og=()=>{const{isLoggedIn:e,userProfile:t,userRole:n,loading:s,refreshProfile:i}=ll(),o=m.jsx("div",{className:"flex min-h-[320px] items-center justify-center text-sm font-semibold text-slate-500",children:"Loading content..."}),r=m.jsx("div",{className:"pb-4 text-sm font-semibold text-slate-500",children:"Loading dashboard content..."}),a=m.jsx("div",{className:"h-11 w-11 shrink-0 rounded-xl bg-[#edf1f7]","aria-hidden":"true"}),c=m.jsx("div",{className:"h-11 w-full rounded-xl bg-[#edf1f7]","aria-hidden":"true"}),u=m.jsx("div",{className:"h-screen w-72 border-r border-[#dde3eb] bg-white/70","aria-hidden":"true"}),d=m.jsx("div",{className:"min-h-[240px] rounded-3xl border border-[#dde3eb] bg-white/70","aria-hidden":"true"}),[l,f]=h.useState("Dashboard"),p=h.useRef(null),g=h.useRef(null),[w,T]=h.useState(!1),[v,A]=h.useState(!1),y=t,[b,P]=h.useState(y?.level||1),[S,I]=h.useState(y?.currentXP||0),[x,R]=h.useState(y?.totalXP||0),L=Math.floor(100*Math.pow(1.5,b-1));let _=0;for(let E=1;E{if(E==="Modules"&&bn){Se.info(`Complete your deep diagnostic (${Pt} outstanding) to unlock modules and regular practice.`),qe("followup_diagnostic"),tt(!0),f("Dashboard");return}M?ve(M):E==="Modules"&&l!=="Modules"&&ve(null),E==="Quiz Battle"&&l!=="Quiz Battle"?(U({collapsed:w}),T(!0)):l==="Quiz Battle"&&E!=="Quiz Battle"&&T(Me.collapsed),f(E),A(!1)},[W,ee]=h.useState(!1),[G,Q]=h.useState({show:!1,xp:0,message:""}),[ye,j]=h.useState(!1),[B,$]=h.useState(!1),[te,N]=h.useState(!1),[D,K]=h.useState(!1),[ae,F]=h.useState({}),[fe,ve]=h.useState(null),[be,Ze]=h.useState(On),[gn,Be]=h.useState(""),[et,Ve]=h.useState(!1),[yn,tt]=h.useState(!1),[pe,qe]=h.useState("initial_assessment"),[Ht,wt]=h.useState(y?.hasTakenDiagnostic||!1),[_e,St]=h.useState(y?.atRiskSubjects||[]),[Tt,dt]=h.useState(y?.priorityTopics||[]),[nt,qt]=h.useState(y?.gpa||"0.00"),[Ke,Kt]=h.useState(y?.learningPathState||"unlocked"),[ft,ht]=h.useState(y?.iarAssessmentState||"not_started"),[Pt,At]=h.useState(0),Et="iar_only";h.useEffect(()=>{e&&n==="student"&&t&&rm(t.uid).then(E=>{if(E&&E.averageScore>0){const M=Math.min(E.averageScore/25,4).toFixed(2);qt(M)}}).catch(E=>console.error("Error loading progress for GPA:",E))},[e,n,t]);const[Ae,vn]=h.useState(!1);h.useEffect(()=>{y&&n==="student"?(P(y.level||1),I(y.currentXP||0),R(y.totalXP||0),ge(y.streak||0),St(y.atRiskSubjects||[]),dt(y.priorityTopics||[]),wt(y.hasTakenDiagnostic||!1),Kt(y.learningPathState||"unlocked"),ht(y.iarAssessmentState||"not_started"),vn(!0)):n!=="student"&&vn(!0)},[t,n]),h.useEffect(()=>{if(!e||n!=="student"){Ve(!1);return}let E=!1;const M=()=>{E||Ve(!0)},z=window.requestIdleCallback,X=window.cancelIdleCallback,we=window.setTimeout(M,800),ss=window.requestAnimationFrame(()=>{z||M()}),Bi=z?.(()=>{M()},{timeout:500});return()=>{E=!0,window.clearTimeout(we),window.cancelAnimationFrame(ss),Bi!==void 0&&X&&X(Bi)}},[e,n]),h.useEffect(()=>{let E=!1;return(async()=>{if(!e||n!=="student"){At(0);return}const z=y?.lrn||t?.uid;if(!z||Ke!=="locked_pending_deep_diagnostic"){At(0);return}try{const{getPendingDeepDiagnosticCount:X}=await H(async()=>{const{getPendingDeepDiagnosticCount:ss}=await import("./automationService-b2P2XC_p.js");return{getPendingDeepDiagnosticCount:ss}},__vite__mapDeps([0,1,2,3,4,5,6])),we=await X(z);E||At(we)}catch(X){console.error("Error loading deep diagnostic assignments:",X)}})(),()=>{E=!0}},[e,n,t?.uid,y?.lrn,Ke]);const bn=n==="student"&&(Ke==="locked_pending_deep_diagnostic"||ft==="deep_diagnostic_required"||ft==="deep_diagnostic_in_progress")&&(Pt>0||ft==="deep_diagnostic_required"||ft==="deep_diagnostic_in_progress"),xn=n==="student"&&ft==="skipped_unassessed",Ct=h.useMemo(()=>{const E=new Set;return _e.map(z=>Es(z)).filter(z=>z!==null).filter(z=>E.has(z)?!1:(E.add(z),!0))},[_e]),O=h.useMemo(()=>{const E=Tt.length>0?Tt:Ct,M=new Set;return E.filter(z=>M.has(z)?!1:(M.add(z),!0))},[Tt,Ct]),le=()=>{qe("initial_assessment"),tt(!0)};h.useEffect(()=>{e&&n==="student"&&t&&im(t.uid).then(E=>{ge(E)})},[e,n,t]),h.useEffect(()=>{F({})},[t?.uid]);const ie=[..._e].sort().join("|"),re=t?.uid?`mathpulse_supplemental_dismissed_${t.uid}`:null;h.useEffect(()=>{if(!re){Be("");return}try{const E=localStorage.getItem(re)||"";Be(E)}catch{Be("")}},[re]);const pt=()=>{if(ie&&(Be(ie),!!re))try{localStorage.setItem(re,ie)}catch{}},ue=()=>{if(Be(""),!!re)try{localStorage.removeItem(re)}catch{}},Ee=_e.length>0&&gn!==ie;h.useEffect(()=>{(async()=>{if(!t?.uid){Ze(On);return}try{const M=await xl(t.uid);Ze(M)}catch(M){console.error("Error loading user settings:",M),Ze(On)}})()},[t?.uid]),h.useEffect(()=>{lm(be)},[be]),h.useEffect(()=>{if(e&&n==="student"&&Ae&&!Ht){const E=setTimeout(()=>{qe("initial_assessment"),tt(!0)},1e3);return()=>clearTimeout(E)}},[e,n,Ae,Ht]);const Dt=async E=>{const M=y?.lrn||t?.uid;if(E.status==="skipped"){if(St([]),dt([]),wt(!0),Kt("unlocked"),ht("skipped_unassessed"),t?.uid)try{await ws(t.uid,{hasTakenDiagnostic:!0,atRiskSubjects:[],priorityTopics:[],learningPathState:"unlocked",remediationState:"not_required",iarAssessmentState:"skipped_unassessed",recommendedNextTopicGroupId:"g11-q1-functions-foundations",recommendationRationale:"Default Grade 11 Q1 path after explicit IAR skip.",recommendedPace:"normal",startingQuarterG11:"Q1",currentCurriculumVersionSetId:y?.currentCurriculumVersionSetId||"g11-core-genmath-legacy-detail-strengthened-structure"}),await sm(t.uid,"reminder","IAR Skipped: You are on default path","You are currently marked as Unassessed and placed on Grade 11 Quarter 1 default flow. Take the Initial Assessment anytime for personalized placement.")}catch(we){console.error("Failed to persist skipped IAR state:",we)}Se.message("Assessment skipped. Default Grade 11 Q1 path applied.",{description:"You can take the Initial Assessment later for personalized recommendations."}),tt(!1),f("Dashboard");return}ue();const z=(E.atRiskSubjectIds||[]).map(we=>Es(we)).filter(we=>we!==null),X=(E.priorityTopics||[]).map(we=>Es(we)).filter(we=>we!==null);if(St(z.length>0?z:E.atRiskSubjectIds||[]),dt(X),wt(!0),ht("in_progress"),t?.uid)try{await ws(t.uid,{hasTakenDiagnostic:!0,atRiskSubjects:z,priorityTopics:X,topicScores:E.topicScores,iarTopicClassifications:E.topicClassifications,g12ReadinessIndicators:E.g12ReadinessIndicators,iarAssessmentState:"in_progress",iarQuestionSetVersion:E.questionSetVersion})}catch(we){console.error("Failed to persist completed IAR payload:",we)}pe==="followup_diagnostic"&&Se.success("Deep diagnostic submitted. Module unlock will update after assignment-state verification."),pe==="initial_assessment"&&M&&((E.atRiskSubjectIds||[]).length>0&&Et==="iar_plus_diagnostic"||Se.success("Initial assessment completed. Personalized path is now active.")),tt(!1),f("Dashboard")},Le=()=>{f("AI Chat")},Ie=async(E,M)=>{if(t)try{const z=await yl(t.uid,E,"manual",M);I(z.xp),z.leveledUp&&P(z.newLevel),R(X=>X+E),await i(),Q({show:!0,xp:E,message:M})}catch(z){console.error("Error awarding XP:",z)}},Rt=async()=>{try{await dp(),F({}),f("Dashboard"),j(!1)}catch(E){console.error("Error logging out:",E)}},Ce=async E=>{if(!t){N(!1),$(!1);return}const M={};["name","email","phone","photo","avatarLayers","lrn","grade","section","school","enrollmentDate","major","gpa","department","subject","yearsOfExperience","qualification","position"].forEach(X=>{E[X]!==void 0&&(M[X]=E[X])});try{await ws(t.uid,M),F(X=>({...X,...M})),N(!1),$(!1),Se.success("Profile updated successfully")}catch(X){console.error("Error saving profile:",X),Se.error("Failed to update profile")}},wn=async E=>{if(t?.uid)try{const M=await am(t.uid,E);Ze(M),Se.success("Settings saved successfully")}catch(M){throw console.error("Error saving settings:",M),Se.error("Failed to save settings"),M}},Zn=async E=>{try{await fp(E),Se.success("Password updated successfully")}catch(M){const z=M instanceof Error?M.message:"Unable to update password";throw Se.error(z),M}},Jn=async()=>{if(!t?.uid)return;const E=await um(t.uid),M=new Blob([JSON.stringify(E,null,2)],{type:"application/json"}),z=URL.createObjectURL(M),X=document.createElement("a");X.href=z,X.download=`mathpulse-data-export-${t.uid}-${Date.now()}.json`,document.body.appendChild(X),X.click(),document.body.removeChild(X),URL.revokeObjectURL(z),Se.success("Data export downloaded")},es=async()=>{await cm(),Se.success("Local cache cleared")},ts=async()=>{if(!t?.uid||n!=="admin")throw new Error("Only admin accounts can delete this account from settings.");try{await hp(t.uid),Se.success("Account deleted successfully")}catch(E){const M=E instanceof Error?E.message:"Unable to delete account";throw Se.error(M),E}},ns=async()=>{if(!t)throw new Error("No active profile found.");const E=n==="student"?y?.lrn||t.uid:void 0,{resetTestingDataForRole:M}=await H(async()=>{const{resetTestingDataForRole:X}=await import("./testResetService-TwZ9y_Zl.js");return{resetTestingDataForRole:X}},__vite__mapDeps([100,1,2,3,4,5,6])),z=await M({uid:t.uid,role:n,lrn:E});n==="student"&&(P(1),I(0),R(0),ge(0),St([]),wt(!1),Kt("unlocked"),ht("not_started"),qt("0.00"),At(0),f("Dashboard")),Se.success(z.summary)},De=t?{uid:t.uid,name:t.name,email:t.email,phone:t.phone||"",photo:t.photo||"https://images.unsplash.com/photo-1633332755192-727a05c4013d?w=200&h=200&fit=crop",avatarLayers:t.avatarLayers,role:t.role,...n==="student"&&y?{lrn:y.lrn,grade:y.grade,section:y.section,school:y.school,enrollmentDate:y.enrollmentDate,major:y.major,gpa:nt}:{},...ae}:{uid:void 0,name:"User",email:"",phone:"",photo:"https://images.unsplash.com/photo-1633332755192-727a05c4013d?w=200&h=200&fit=crop",avatarLayers:void 0,role:n},Fi=De.name.trim().split(/\s+/).find(E=>/\p{L}/u.test(E))||De.name.trim()||"User";return h.useEffect(()=>{const E=M=>{if(!(M.target instanceof HTMLInputElement||M.target instanceof HTMLTextAreaElement)&&M.altKey)switch(M.key.toLowerCase()){case"d":M.preventDefault(),V("Dashboard");break;case"m":M.preventDefault(),V("Modules");break;case"c":M.preventDefault(),V("AI Chat");break;case"g":M.preventDefault(),V("Grades");break;case"b":M.preventDefault(),V("Quiz Battle");break;case"s":M.preventDefault(),$(!0);break;case"p":M.preventDefault(),N(!0);break;case"k":M.preventDefault(),K(z=>!z);break}};if(e&&n==="student")return window.addEventListener("keydown",E),()=>window.removeEventListener("keydown",E)},[e,n,bn,Pt]),s?m.jsx(Xt,{}):e?n!=="student"||Ae?n==="teacher"?m.jsxs(m.Fragment,{children:[m.jsx(h.Suspense,{fallback:m.jsx(Xt,{message:"Loading teacher dashboard..."}),children:m.jsx(Fm,{onLogout:Rt,onOpenProfile:()=>N(!0),onOpenSettings:()=>$(!0)})}),te&&m.jsx(h.Suspense,{fallback:null,children:m.jsx(Cs,{isOpen:te,onClose:()=>N(!1),profileData:De,onSave:Ce})}),B&&m.jsx(h.Suspense,{fallback:null,children:m.jsx(Ds,{isOpen:B,onClose:()=>$(!1),profileData:De,onSave:Ce,settingsData:be,onSaveSettings:wn,onApplySettingsPreview:Ze,onUpdatePassword:Zn,onExportData:Jn,onClearCache:es,onDeleteAccount:ts,onResetData:ns})}),m.jsx(As,{position:"top-right",richColors:!0,closeButton:!0})]}):n==="admin"?m.jsxs(m.Fragment,{children:[m.jsx(h.Suspense,{fallback:m.jsx(Xt,{message:"Loading admin dashboard..."}),children:m.jsx(Bm,{onLogout:Rt,onOpenProfile:()=>N(!0),onOpenSettings:()=>$(!0)})}),te&&m.jsx(h.Suspense,{fallback:null,children:m.jsx(Cs,{isOpen:te,onClose:()=>N(!1),profileData:De,onSave:Ce})}),B&&m.jsx(h.Suspense,{fallback:null,children:m.jsx(Ds,{isOpen:B,onClose:()=>$(!1),profileData:De,onSave:Ce,settingsData:be,onSaveSettings:wn,onApplySettingsPreview:Ze,onUpdatePassword:Zn,onExportData:Jn,onClearCache:es,onDeleteAccount:ts,onResetData:ns})}),m.jsx(As,{position:"top-right",richColors:!0,closeButton:!0})]}):m.jsxs(m.Fragment,{children:[m.jsx(nm,{children:m.jsxs("div",{className:"flex h-screen w-full bg-[#f8faff] overflow-hidden",children:[m.jsx("div",{className:"hidden lg:block",children:m.jsx(h.Suspense,{fallback:u,children:m.jsx(go,{activeTab:l,setActiveTab:V,userRole:n,onOpenSettings:()=>$(!0),onLogout:()=>j(!0),sidebarCollapsed:w,setSidebarCollapsed:T,forceCollapsed:l==="Quiz Battle"})})}),v&&m.jsxs(m.Fragment,{children:[m.jsx("button",{"aria-label":"Close navigation",className:"fixed inset-0 z-40 bg-slate-900/40 backdrop-blur-[1px] lg:hidden",onClick:()=>A(!1)}),m.jsx("div",{className:"fixed inset-y-0 left-0 z-50 p-3 lg:hidden",children:m.jsx(h.Suspense,{fallback:u,children:m.jsx(go,{mode:"mobile",onRequestClose:()=>A(!1),activeTab:l,setActiveTab:V,userRole:n,onOpenSettings:()=>{$(!0),A(!1)},onLogout:()=>{j(!0),A(!1)},sidebarCollapsed:!1})})})]}),m.jsxs("div",{className:"flex-1 min-h-0 flex flex-col min-w-0 bg-gradient-to-br from-indigo-200 via-fuchsia-50 to-orange-100 relative z-10 shadow-[rgba(124,58,237,0.05)_0px_0px_30px_inset]",children:[m.jsx("div",{className:"absolute inset-0 bg-math-pattern opacity-30 pointer-events-none mix-blend-multiply z-0"}),m.jsxs("header",{className:"bg-white/90 backdrop-blur-md border-b border-[#dde3eb] px-3 sm:px-6 py-3 flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 sticky top-0 z-30 shadow-sm",children:[m.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[m.jsx("button",{className:"lg:hidden p-2 rounded-xl bg-[#edf1f7] hover:bg-[#dde3eb] text-[#5a6578] hover:text-primary transition-colors",onClick:()=>A(!0),"aria-label":"Open navigation",children:m.jsx(ep,{size:20})}),m.jsxs("div",{className:"min-w-0",children:[m.jsx("h1",{className:"text-lg sm:text-xl font-display font-bold text-[#0a1628] leading-tight truncate",children:l}),m.jsxs("p",{className:"text-xs text-[#5a6578] font-body truncate",children:["Welcome back, ",De.name.split(" ")[0],"!"]})]}),m.jsxs("div",{className:"hidden md:flex items-center gap-2 ml-2",children:[m.jsxs("button",{onClick:()=>ee(!0),className:"flex items-center gap-1.5 px-3 py-1.5 bg-rose-50 hover:bg-rose-100 border border-rose-200/60 rounded-lg transition-colors cursor-pointer group",title:"View Rewards & Progress",children:[m.jsx(Yh,{className:"h-3.5 w-3.5 text-rose-500","aria-hidden":"true"}),m.jsxs("span",{className:"text-xs font-display font-bold text-rose-700",children:["Lv ",b]})]}),m.jsxs("button",{onClick:()=>ee(!0),className:"flex items-center gap-1.5 px-3 py-1.5 bg-violet-50 hover:bg-violet-100 border border-violet-200/60 rounded-lg transition-colors cursor-pointer",title:`${oe}/${L} XP to next level`,children:[m.jsx(ip,{className:"h-3.5 w-3.5 text-violet-500","aria-hidden":"true"}),m.jsxs("span",{className:"text-xs font-display font-bold text-violet-700",children:[S," XP"]}),m.jsx("div",{className:"w-12 h-1.5 bg-violet-100 rounded-full overflow-hidden",children:m.jsx("div",{className:"h-full bg-violet-500 rounded-full transition-all",style:{width:`${oe/L*100}%`}})})]}),m.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1.5 bg-orange-50 border border-orange-200/60 rounded-lg",children:[m.jsx(Zh,{className:"h-3.5 w-3.5 text-orange-500","aria-hidden":"true"}),m.jsxs("span",{className:"text-xs font-display font-bold text-orange-700",children:[J," day",J!==1?"s":""]})]})]})]}),m.jsxs("div",{className:"flex flex-wrap md:flex-nowrap items-center gap-2 min-w-0",children:[m.jsx("div",{className:"hidden md:block flex-1 min-w-0 max-w-[420px]",children:m.jsx(h.Suspense,{fallback:c,children:m.jsx(Hm,{onSelect:E=>{}})})}),m.jsx("button",{onClick:()=>K(E=>!E),className:"p-3 rounded-xl bg-[#edf1f7] hover:bg-[#dde3eb] text-[#5a6578] hover:text-primary transition-all group",title:"Scientific Calculator (Alt+K)",children:m.jsx(Gh,{size:20,className:"group-hover:scale-110 transition-transform"})}),m.jsx(h.Suspense,{fallback:a,children:m.jsx(Wm,{userRole:n})}),m.jsxs("button",{onClick:()=>N(!0),className:"flex items-center gap-2.5 h-11 shrink-0 bg-[#edf1f7] hover:bg-[#dde3eb] p-1.5 pr-3 rounded-lg cursor-pointer transition-all group","aria-label":`Profile: ${De.name}`,children:[m.jsx("img",{src:De.photo,alt:De.name,className:"w-8 h-8 rounded-lg object-cover"}),m.jsx("div",{className:"hidden sm:block text-left min-w-0 flex-1",children:m.jsx("p",{className:"text-sm font-semibold text-[#0a1628] leading-none group-hover:text-primary transition-colors font-body truncate",children:Fi})})]})]})]}),m.jsx("main",{ref:g,className:`flex-1 min-h-0 p-3 lg:p-4 ${l==="AI Chat"?"overflow-hidden":"overflow-y-auto pb-24 sm:pb-28"}`,children:m.jsx(Mf,{mode:"wait",children:m.jsx(Nn.div,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},exit:{opacity:0,y:-16},transition:{duration:.25,ease:[.22,1,.36,1]},className:l==="AI Chat"?"h-full min-h-0":"",children:l==="Dashboard"?m.jsx("div",{className:"px-4 sm:px-6 xl:px-10 py-6 sm:py-8",children:m.jsxs("div",{className:"grid grid-cols-12 gap-6 sm:gap-8 lg:gap-10",children:[m.jsxs("div",{className:"col-span-12 xl:col-span-9 flex flex-col gap-10 lg:gap-14 pt-0",children:[m.jsx(h.Suspense,{fallback:d,children:m.jsx($m,{userName:Fi,userLevel:b,avatarLayers:De.avatarLayers,onContinueLearning:()=>V("Modules"),showAssessmentTooltip:xn,onOpenAssessment:le})}),et&&Ht&&Ct.length>0&&m.jsxs("div",{className:"rounded-2xl border border-amber-300 bg-amber-50 px-5 py-4 shadow-sm dark:border-amber-400/40 dark:bg-amber-400/10",children:[m.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[m.jsxs("div",{children:[m.jsxs("p",{className:"inline-flex items-center gap-2 text-sm font-black text-amber-900 dark:text-amber-200",children:[m.jsx(np,{className:"h-4 w-4"}),"Assessment Focus Review"]}),m.jsx("p",{className:"mt-1 text-sm text-amber-900/85 dark:text-amber-100/90",children:"Your latest diagnostic flagged these topics for review. Modules are prioritized based on this focus order."})]}),m.jsxs("button",{type:"button",onClick:()=>V("Modules"),className:"inline-flex items-center gap-1.5 rounded-xl bg-amber-600 px-3 py-2 text-xs font-bold text-white transition-colors hover:bg-amber-700",children:["Open Modules",m.jsx(Wh,{className:"h-3.5 w-3.5"})]})]}),m.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:O.map((E,M)=>m.jsxs("span",{className:"rounded-full bg-white/90 px-3 py-1 text-xs font-semibold text-amber-900 shadow-sm dark:bg-amber-100/20 dark:text-amber-100",children:[M+1,". ",Nm[E]]},E))})]}),et&&Ee&&m.jsx(h.Suspense,{fallback:r,children:m.jsx(qm,{variant:"full",atRiskSubjects:_e,onDismiss:pt,onAction:()=>{pt(),V("Modules")}})}),Ae&&et&&m.jsx(h.Suspense,{fallback:r,children:m.jsx("div",{className:"pb-4",children:m.jsx(Km,{onNavigateToModules:E=>V("Modules",E),atRiskSubjects:_e,priorityTopics:O})})}),Ae&&et&&m.jsx(h.Suspense,{fallback:r,children:m.jsx("div",{className:"pb-4",children:m.jsx(Gm,{})})})]}),m.jsx("div",{className:"col-span-12 xl:col-span-3 pt-2",children:et?m.jsx(h.Suspense,{fallback:d,children:m.jsx(zm,{onOpenRewards:()=>ee(!0),onOpenLeaderboard:()=>f("Leaderboard"),onNavigateToModules:()=>f("Modules"),userLevel:b,currentXP:oe,xpToNextLevel:L,overallXP:S,streak:J,streakHistory:y?.streakHistory||[]})}):d})]})}):l==="Modules"?m.jsx(h.Suspense,{fallback:o,children:m.jsx(Xm,{onEarnXP:Ie,atRiskSubjects:_e,priorityTopics:O,initialModuleId:fe})}):l==="Leaderboard"?m.jsx(h.Suspense,{fallback:o,children:m.jsx(Zm,{currentUserPhoto:De.photo})}):l==="Quiz Battle"?m.jsx(h.Suspense,{fallback:o,children:m.jsx(Jm,{})}):l==="AI Chat"?m.jsx(h.Suspense,{fallback:o,children:m.jsx(Ym,{})}):l==="Grades"?m.jsx(h.Suspense,{fallback:o,children:m.jsx(Qm,{})}):l==="Avatar Studio"?m.jsx(h.Suspense,{fallback:o,children:m.jsx(eg,{onSaveProfile:E=>{F(M=>({...M,avatarLayers:E}))},onNavigateToModules:()=>f("Modules")})}):m.jsxs("div",{className:"flex-1 flex items-center justify-center text-[#a8a5b3] font-medium font-body",children:[l," Content Coming Soon"]})},l)})}),l!=="AI Chat"&&m.jsx(h.Suspense,{fallback:null,children:m.jsx("div",{className:"fixed bottom-4 right-4 sm:bottom-8 sm:right-8 z-50",children:m.jsx(tg,{constraintsRef:p,onFullScreen:Le})})}),m.jsx(h.Suspense,{fallback:null,children:m.jsx(Um,{xp:G.xp,message:G.message,show:G.show,onComplete:()=>Q(E=>({...E,show:!1}))})}),W&&m.jsx(h.Suspense,{fallback:null,children:m.jsx(ng,{isOpen:W,onClose:()=>ee(!1),userLevel:b,currentXP:S,xpToNextLevel:L,totalXP:x,streak:J})}),te&&m.jsx(h.Suspense,{fallback:null,children:m.jsx(Cs,{isOpen:te,onClose:()=>N(!1),profileData:De,onSave:Ce})}),ye&&m.jsx(h.Suspense,{fallback:null,children:m.jsx(sg,{isOpen:ye,onClose:()=>j(!1),onConfirm:Rt,title:"Confirm Logout",message:"Are you sure you want to log out? Your progress is saved automatically.",confirmText:"Logout",cancelText:"Stay",type:"warning",icon:"logout"})}),B&&m.jsx(h.Suspense,{fallback:null,children:m.jsx(Ds,{isOpen:B,onClose:()=>$(!1),profileData:De,onSave:Ce,settingsData:be,onSaveSettings:wn,onApplySettingsPreview:Ze,onUpdatePassword:Zn,onExportData:Jn,onClearCache:es,onDeleteAccount:ts,onResetData:ns})}),D&&m.jsx(h.Suspense,{fallback:null,children:m.jsx(ig,{isOpen:D,onClose:()=>K(!1)})}),yn&&m.jsx(h.Suspense,{fallback:null,children:m.jsx(rg,{isOpen:yn,onClose:()=>tt(!1),onComplete:Dt,lrn:y?.lrn||t?.uid,gradeLevel:y?.grade,workflowMode:Et,assessmentType:pe})})]})]})}),m.jsx(As,{position:"top-right",richColors:!0,closeButton:!0})]}):m.jsx(Xt,{message:"Preparing your dashboard..."}):m.jsx(h.Suspense,{fallback:m.jsx(Xt,{message:"Loading sign in..."}),children:m.jsx(Om,{})})};let yo=!1;const vo=()=>{yo||(yo=!0,H(()=>Promise.resolve({}),__vite__mapDeps([101])).catch(e=>{console.error("[styles] Deferred full stylesheet failed to load:",e)}))};if(typeof window<"u"){const e=window.requestIdleCallback,t=window.cancelIdleCallback,n=e?.(()=>{vo()},{timeout:1200});window.setTimeout(()=>{n!==void 0&&t&&t(n),vo()},1200)}const wl=document.getElementById("root");if(!wl)throw new Error("Root element not found");Tl.createRoot(wl).render(m.jsx(pp,{children:m.jsx(og,{})}));export{Wh as A,qh as B,Gh as C,On as D,Eg as E,Zh as F,Pg as G,mg as H,lt as I,op as J,ws as K,Ag as L,ep as M,sm as N,ji as O,Mp as P,np as T,ip as Z,H as _,yg as a,vg as b,ut as c,q as d,Mf as e,wg as f,rm as g,Tg as h,Sg as i,xl as j,am as k,Yh as l,Nn as m,xg as n,Es as o,Lg as p,Cg as q,kg as r,gg as s,Se as t,ll as u,Rg as v,Dg as w,Mg as x,Nm as y,bg as z}; diff --git a/assets/loader-circle-C8PWHn54.js b/assets/loader-circle-Bd75QYdF.js similarity index 87% rename from assets/loader-circle-C8PWHn54.js rename to assets/loader-circle-Bd75QYdF.js index 4a8d10ce6b7f74391764e31703b9ce193fd19b14..57030a59ad4b1fc99f23ea1c058e34fa52d14eba 100644 --- a/assets/loader-circle-C8PWHn54.js +++ b/assets/loader-circle-Bd75QYdF.js @@ -1,4 +1,4 @@ -import{c}from"./index-CYVpLr_P.js";/** +import{c}from"./index-LyKgWktA.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/lock-COR_g_Qg.js b/assets/lock-DeaK7IhY.js similarity index 89% rename from assets/lock-COR_g_Qg.js rename to assets/lock-DeaK7IhY.js index 229c5a4dec65ca7d0de939c1f50def3cf26e978e..45c0e07319c3a2a9a3412ccf6f0459bc46d72a09 100644 --- a/assets/lock-COR_g_Qg.js +++ b/assets/lock-DeaK7IhY.js @@ -1,4 +1,4 @@ -import{c}from"./index-CYVpLr_P.js";/** +import{c}from"./index-LyKgWktA.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/log-out-B4zHGAON.js b/assets/log-out-CI4drKBP.js similarity index 89% rename from assets/log-out-B4zHGAON.js rename to assets/log-out-CI4drKBP.js index 029b34004ff747d183e26104afa9ca539c8dd586..bf232d0c1d031f99192dc0c8fb6274a21501a13f 100644 --- a/assets/log-out-B4zHGAON.js +++ b/assets/log-out-CI4drKBP.js @@ -1,4 +1,4 @@ -import{c as o}from"./index-CYVpLr_P.js";/** +import{c as o}from"./index-LyKgWktA.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/mail-C5ZpVS09.js b/assets/mail-BSFHdQFh.js similarity index 89% rename from assets/mail-C5ZpVS09.js rename to assets/mail-BSFHdQFh.js index 62eb5f29cca79b4de8a63eecfd915b01e4f10a4c..280bc2416424a8a1f6689dfa866d7c14a0e4324c 100644 --- a/assets/mail-C5ZpVS09.js +++ b/assets/mail-BSFHdQFh.js @@ -1,4 +1,4 @@ -import{c}from"./index-CYVpLr_P.js";/** +import{c}from"./index-LyKgWktA.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/message-square-c-O8e9VO.js b/assets/message-square-cJcev-mA.js similarity index 87% rename from assets/message-square-c-O8e9VO.js rename to assets/message-square-cJcev-mA.js index 5d4405ef5349200945d5e8e196bc4f7517552e81..58d0702d6fa51bd5dd396aaa2524e7a1bd963a66 100644 --- a/assets/message-square-c-O8e9VO.js +++ b/assets/message-square-cJcev-mA.js @@ -1,4 +1,4 @@ -import{c as e}from"./index-CYVpLr_P.js";/** +import{c as e}from"./index-LyKgWktA.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/minus-DeGDLvCZ.js b/assets/minus-BGOdCLGP.js similarity index 84% rename from assets/minus-DeGDLvCZ.js rename to assets/minus-BGOdCLGP.js index 2d72f6b314e3135f7f9f1549eb9f3f8ff805e847..a0eeac37c63ade97159a21dacde33a4cf4cf8bba 100644 --- a/assets/minus-DeGDLvCZ.js +++ b/assets/minus-BGOdCLGP.js @@ -1,4 +1,4 @@ -import{c as o}from"./index-CYVpLr_P.js";/** +import{c as o}from"./index-LyKgWktA.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/pen-line-Dzt-bcp9.js b/assets/pen-line-Ctg9I-nz.js similarity index 90% rename from assets/pen-line-Dzt-bcp9.js rename to assets/pen-line-Ctg9I-nz.js index 05c11410654d46ed61dab638504cff80d3d9967e..b73cd714f2cad47ffb747b48a1b31418d23f25ec 100644 --- a/assets/pen-line-Dzt-bcp9.js +++ b/assets/pen-line-Ctg9I-nz.js @@ -1,4 +1,4 @@ -import{c as e}from"./index-CYVpLr_P.js";/** +import{c as e}from"./index-LyKgWktA.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/plus-C6Q_7FrB.js b/assets/plus-QA9NgyWS.js similarity index 86% rename from assets/plus-C6Q_7FrB.js rename to assets/plus-QA9NgyWS.js index 75b1dcb6a0b21a3a3bcfc744b9142bda6828453a..49d50b4fb11bc2716a785301d6573d50a13e6388 100644 --- a/assets/plus-C6Q_7FrB.js +++ b/assets/plus-QA9NgyWS.js @@ -1,4 +1,4 @@ -import{c as e}from"./index-CYVpLr_P.js";/** +import{c as e}from"./index-LyKgWktA.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/quizService-DjlH8cxx.js b/assets/quizService-B3HGgNhs.js similarity index 98% rename from assets/quizService-DjlH8cxx.js rename to assets/quizService-B3HGgNhs.js index 8a205968354b4ae3b12c144cea2b0f84985e0ff7..15151bded97f6493d018241653d48cd048df555c 100644 --- a/assets/quizService-DjlH8cxx.js +++ b/assets/quizService-B3HGgNhs.js @@ -1,4 +1,4 @@ -import{c as A,d as i}from"./index-CYVpLr_P.js";import{d as o,e as r,s as f,q as z,w as m,o as L,h as b,u as g,c as M,a as d}from"./vendor-firebase-firestore-CkuVbeP5.js";/** +import{c as A,d as i}from"./index-LyKgWktA.js";import{d as o,e as r,s as f,q as z,w as m,o as L,h as b,u as g,c as M,a as d}from"./vendor-firebase-firestore-CkuVbeP5.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/quiz_battle_avatar-vvxcW_MO.png b/assets/quiz_battle_avatar-vvxcW_MO.png deleted file mode 100644 index cc3ec08ed26e7023bc5a92ddc32acc2d53b6779f..0000000000000000000000000000000000000000 --- a/assets/quiz_battle_avatar-vvxcW_MO.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:af3c2bc5b0e60b954f13d58d88e12e11bd6da3ca784b9ae816fd24165fc6a549 -size 135857 diff --git a/assets/quiz_battle_avatar-yi62KvvC.png b/assets/quiz_battle_avatar-yi62KvvC.png new file mode 100644 index 0000000000000000000000000000000000000000..49a2725e9aab792a5411a42ef02fab7ffaf12ef2 --- /dev/null +++ b/assets/quiz_battle_avatar-yi62KvvC.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cede765642677671789a530040a196a8fa5838323becf00c326e5d6e68e77558 +size 110683 diff --git a/assets/save-B_ytEIW_.js b/assets/save-qazbBcyz.js similarity index 91% rename from assets/save-B_ytEIW_.js rename to assets/save-qazbBcyz.js index 800e2db8978ba5369dabe5c1fbba81b01ce11fd9..d29dfddf2d98ddcec6fdd14ed652b6c0e18151d4 100644 --- a/assets/save-B_ytEIW_.js +++ b/assets/save-qazbBcyz.js @@ -1,4 +1,4 @@ -import{c as a}from"./index-CYVpLr_P.js";/** +import{c as a}from"./index-LyKgWktA.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/search-CwICt96b.js b/assets/search-B1VJAO7p.js similarity index 88% rename from assets/search-CwICt96b.js rename to assets/search-B1VJAO7p.js index 6499076a372a81ca60552f80b579cbfb1ab1008f..be5160d9bf2d8c1e5c8a2be060fecfa12acb904e 100644 --- a/assets/search-CwICt96b.js +++ b/assets/search-B1VJAO7p.js @@ -1,4 +1,4 @@ -import{c}from"./index-CYVpLr_P.js";/** +import{c}from"./index-LyKgWktA.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/select-CHi9TA28.js b/assets/select-DCrihmc0.js similarity index 96% rename from assets/select-CHi9TA28.js rename to assets/select-DCrihmc0.js index 7899527d05cb7ad3c414eac8a80b043c263e6148..dccf980914f7ec5e9c3f72136a127ce7f4f79800 100644 --- a/assets/select-CHi9TA28.js +++ b/assets/select-DCrihmc0.js @@ -1 +1 @@ -import{j as e}from"./vendor-react-Dexh7fmo.js";import{h as l,i,j as d,V as c,k as u,l as m,m as p,n as f,o as x,p as g,S as v,q as h}from"./vendor-radix-cHXhEj3X.js";import{c as r}from"./utils-BQQgILNW.js";import{a as n,C as b}from"./chevron-up-z_1tCiMP.js";import{C as j}from"./check-C1NZdYTy.js";function _({...t}){return e.jsx(l,{"data-slot":"select",...t})}function I({...t}){return e.jsx(c,{"data-slot":"select-value",...t})}function B({className:t,size:a="default",children:s,...o}){return e.jsxs(i,{"data-slot":"select-trigger","data-size":a,className:r("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-full items-center justify-between gap-2 rounded-md border bg-input-background px-3 py-2 text-sm whitespace-nowrap transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...o,children:[s,e.jsx(d,{asChild:!0,children:e.jsx(n,{className:"size-4 opacity-50"})})]})}function V({className:t,children:a,position:s="popper",...o}){return e.jsx(u,{children:e.jsxs(m,{"data-slot":"select-content",className:r("bg-popover text-popover-foreground 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 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",s==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:s,...o,children:[e.jsx(w,{}),e.jsx(p,{className:r("p-1",s==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:a}),e.jsx(y,{})]})})}function D({className:t,children:a,...s}){return e.jsxs(f,{"data-slot":"select-item",className:r("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",t),...s,children:[e.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:e.jsx(x,{children:e.jsx(j,{className:"size-4"})})}),e.jsx(g,{children:a})]})}function w({className:t,...a}){return e.jsx(v,{"data-slot":"select-scroll-up-button",className:r("flex cursor-default items-center justify-center py-1",t),...a,children:e.jsx(b,{className:"size-4"})})}function y({className:t,...a}){return e.jsx(h,{"data-slot":"select-scroll-down-button",className:r("flex cursor-default items-center justify-center py-1",t),...a,children:e.jsx(n,{className:"size-4"})})}export{_ as S,B as a,I as b,V as c,D as d}; +import{j as e}from"./vendor-react-Dexh7fmo.js";import{h as l,i,j as d,V as c,k as u,l as m,m as p,n as f,o as x,p as g,S as v,q as h}from"./vendor-radix-cHXhEj3X.js";import{c as r}from"./utils-BQQgILNW.js";import{a as n,C as b}from"./chevron-up-CmF1G4Yx.js";import{C as j}from"./check-sV5f01n0.js";function _({...t}){return e.jsx(l,{"data-slot":"select",...t})}function I({...t}){return e.jsx(c,{"data-slot":"select-value",...t})}function B({className:t,size:a="default",children:s,...o}){return e.jsxs(i,{"data-slot":"select-trigger","data-size":a,className:r("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-full items-center justify-between gap-2 rounded-md border bg-input-background px-3 py-2 text-sm whitespace-nowrap transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...o,children:[s,e.jsx(d,{asChild:!0,children:e.jsx(n,{className:"size-4 opacity-50"})})]})}function V({className:t,children:a,position:s="popper",...o}){return e.jsx(u,{children:e.jsxs(m,{"data-slot":"select-content",className:r("bg-popover text-popover-foreground 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 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",s==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:s,...o,children:[e.jsx(w,{}),e.jsx(p,{className:r("p-1",s==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:a}),e.jsx(y,{})]})})}function D({className:t,children:a,...s}){return e.jsxs(f,{"data-slot":"select-item",className:r("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",t),...s,children:[e.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:e.jsx(x,{children:e.jsx(j,{className:"size-4"})})}),e.jsx(g,{children:a})]})}function w({className:t,...a}){return e.jsx(v,{"data-slot":"select-scroll-up-button",className:r("flex cursor-default items-center justify-center py-1",t),...a,children:e.jsx(b,{className:"size-4"})})}function y({className:t,...a}){return e.jsx(h,{"data-slot":"select-scroll-down-button",className:r("flex cursor-default items-center justify-center py-1",t),...a,children:e.jsx(n,{className:"size-4"})})}export{_ as S,B as a,I as b,V as c,D as d}; diff --git a/assets/send-DoEjcxSJ.js b/assets/send-DdToiTRE.js similarity index 90% rename from assets/send-DoEjcxSJ.js rename to assets/send-DdToiTRE.js index 6d28e60faaa3b73e85625c55edee1097cbd4cd2d..980e2b8d59de77140862a35fc04bd0d1ad62ca9a 100644 --- a/assets/send-DoEjcxSJ.js +++ b/assets/send-DdToiTRE.js @@ -1,4 +1,4 @@ -import{c as a}from"./index-CYVpLr_P.js";/** +import{c as a}from"./index-LyKgWktA.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/shield-B_6hUGZX.js b/assets/shield-CcOzg2El.js similarity index 91% rename from assets/shield-B_6hUGZX.js rename to assets/shield-CcOzg2El.js index f1364d8d2c1ca49049b6562e4dcdf25e5d985f58..287e2a69aa633027a8bfe3b7dda132322ca3a65c 100644 --- a/assets/shield-B_6hUGZX.js +++ b/assets/shield-CcOzg2El.js @@ -1,4 +1,4 @@ -import{c}from"./index-CYVpLr_P.js";/** +import{c}from"./index-LyKgWktA.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/shield-check-CotW-v_m.js b/assets/shield-check-WLUcWIeq.js similarity index 92% rename from assets/shield-check-CotW-v_m.js rename to assets/shield-check-WLUcWIeq.js index d52919343f6513991b7ca9880df282d943f12e65..1fc8af05e8c769e274e9e08cca5c6891245673a6 100644 --- a/assets/shield-check-CotW-v_m.js +++ b/assets/shield-check-WLUcWIeq.js @@ -1,4 +1,4 @@ -import{c}from"./index-CYVpLr_P.js";/** +import{c}from"./index-LyKgWktA.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/shirt-D--nDwDf.js b/assets/shirt-PgcFQo2K.js similarity index 90% rename from assets/shirt-D--nDwDf.js rename to assets/shirt-PgcFQo2K.js index 2f5b89e331f7b4060f5d9c983d30ced17660d4a2..c0cc5037df71f83bca409426d7a36eb9686d6ac7 100644 --- a/assets/shirt-D--nDwDf.js +++ b/assets/shirt-PgcFQo2K.js @@ -1,4 +1,4 @@ -import{c as a}from"./index-CYVpLr_P.js";/** +import{c as a}from"./index-LyKgWktA.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/skeleton-BQc0_1c8.js b/assets/skeleton-FRDY0mw5.js similarity index 89% rename from assets/skeleton-BQc0_1c8.js rename to assets/skeleton-FRDY0mw5.js index fe90b721d9198bf9e0e274c614d906a9f9923921..0f5010d7e7d45e4174887c4bb9032811775f9e93 100644 --- a/assets/skeleton-BQc0_1c8.js +++ b/assets/skeleton-FRDY0mw5.js @@ -1,4 +1,4 @@ -import{c as o}from"./index-CYVpLr_P.js";import{j as c}from"./vendor-react-Dexh7fmo.js";import{c as a}from"./utils-BQQgILNW.js";/** +import{c as o}from"./index-LyKgWktA.js";import{j as c}from"./vendor-react-Dexh7fmo.js";import{c as a}from"./utils-BQQgILNW.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/sparkles-DCodfP-i.js b/assets/sparkles-D-fzJUWE.js similarity index 93% rename from assets/sparkles-DCodfP-i.js rename to assets/sparkles-D-fzJUWE.js index a64715fa83c3082cf6a32c22ff7f0decd467d34e..f01ecb1a2b853420951cad0f0a5bd0910e4a8dcd 100644 --- a/assets/sparkles-DCodfP-i.js +++ b/assets/sparkles-D-fzJUWE.js @@ -1,4 +1,4 @@ -import{c as a}from"./index-CYVpLr_P.js";/** +import{c as a}from"./index-LyKgWktA.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/star-BOFYd7BG.js b/assets/star-BbJSm_XE.js similarity index 93% rename from assets/star-BOFYd7BG.js rename to assets/star-BbJSm_XE.js index 5c3a9ed1f8e2aa7faa06926d6a9f4ecd3eb45c01..0f2aca325a5a92ecbde26c07ed1af17dbc481ab4 100644 --- a/assets/star-BOFYd7BG.js +++ b/assets/star-BbJSm_XE.js @@ -1,4 +1,4 @@ -import{c as a}from"./index-CYVpLr_P.js";/** +import{c as a}from"./index-LyKgWktA.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/subjects-BZyYKoxN.js b/assets/subjects-c5kzjeSA.js similarity index 99% rename from assets/subjects-BZyYKoxN.js rename to assets/subjects-c5kzjeSA.js index fe119267c2dd91002736a4636725ca06e50e358a..2e8fbc581845d5866fd6ec3430369a714cb305ac 100644 --- a/assets/subjects-BZyYKoxN.js +++ b/assets/subjects-c5kzjeSA.js @@ -1,4 +1,4 @@ -import{c as a,C as o}from"./index-CYVpLr_P.js";import{T as l}from"./trending-up-CqFD_DPI.js";import{C as s}from"./chart-column-sGYNY-cm.js";/** +import{c as a,C as o}from"./index-LyKgWktA.js";import{T as l}from"./trending-up-DwhUzSCD.js";import{C as s}from"./chart-column-CAJHtHZ_.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/swords-C8YOZegm.js b/assets/swords-DBnIhbCe.js similarity index 93% rename from assets/swords-C8YOZegm.js rename to assets/swords-DBnIhbCe.js index bd65b04b5ffaebde9f904dcd48eded5820ab8220..dde12ae60353af076b23b24906a066049c1cd8f9 100644 --- a/assets/swords-C8YOZegm.js +++ b/assets/swords-DBnIhbCe.js @@ -1,4 +1,4 @@ -import{c as e}from"./index-CYVpLr_P.js";/** +import{c as e}from"./index-LyKgWktA.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/target-GUh8ebLY.js b/assets/target-CX3SjMvf.js similarity index 90% rename from assets/target-GUh8ebLY.js rename to assets/target-CX3SjMvf.js index 2f9386de14fe8efb2213bf19af9635494be7e2a9..2bc55b653c98f7c18186c8015a7a363687f40620 100644 --- a/assets/target-GUh8ebLY.js +++ b/assets/target-CX3SjMvf.js @@ -1,4 +1,4 @@ -import{c}from"./index-CYVpLr_P.js";/** +import{c}from"./index-LyKgWktA.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/testResetService-BCgi1kVA.js b/assets/testResetService-TwZ9y_Zl.js similarity index 98% rename from assets/testResetService-BCgi1kVA.js rename to assets/testResetService-TwZ9y_Zl.js index 40a8f77efb20665aac27b5c0edef6cb9464add2c..cd77580de2eabc2e207e4045c1a314648dbe9a32 100644 --- a/assets/testResetService-BCgi1kVA.js +++ b/assets/testResetService-TwZ9y_Zl.js @@ -1 +1 @@ -import{s as l,a as d,d as i,h as f,q as p,w as g,e as I,c as m,m as w}from"./vendor-firebase-firestore-CkuVbeP5.js";import{I as S,O as v,d as n}from"./index-CYVpLr_P.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 k=400,A="https://deign86-mathpulse-api-v3test.hf.space";async function T(e){const t=S.currentUser;if(!t)throw new Error("Authentication is required to reset testing data.");const s=await t.getIdToken(),o=await fetch(`${A}/api/testing/reset-data`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${s}`},body:JSON.stringify({role:e.role,...e.lrn?{lrn:e.lrn}:{}})}),r=await o.json().catch(()=>({}));if(!o.ok){const D=typeof r?.detail=="string"?r.detail:"";throw new Error(D||`Reset request failed with status ${o.status}.`)}const c=typeof r?.role=="string"?r.role:e.role,u=Number(r?.deletedDocs??0),h=Number(r?.updatedDocs??0),y=typeof r?.summary=="string"?r.summary:`${c} reset complete: ${u} records deleted, ${h} records reset.`;return{role:c,deletedDocs:u,updatedDocs:h,summary:y}}async function R(e){const t=await f(e);if(t.empty)return 0;let s=w(n),o=0,r=0;for(const c of t.docs)s.delete(c.ref),o+=1,r+=1,o>=k&&(await s.commit(),s=w(n),o=0);return o>0&&await s.commit(),r}async function B(e,t,s){return R(p(I(n,e),g(t,"==",s)))}async function a(e,t,s){try{return await B(e,t,s)}catch{return 0}}async function b(e,t){const s=t||e;let o=0,r=0;return await v(e),r+=1,await l(i(n,"users",e),{level:1,currentXP:0,totalXP:0,streak:0,streakHistory:[],atRiskSubjects:[],hasTakenDiagnostic:!1,iarAssessmentState:"not_started",learningPathState:"unlocked",remediationState:"not_required",subjectBadges:{},riskClassifications:{},overallRisk:"Low",updatedAt:d()},{merge:!0}),r+=1,o+=await a("notifications","userId",e),o+=await a("chatSessions","userId",e),o+=await a("chatMessages","userId",e),s!==e&&(o+=await a("notifications","userId",s)),await l(i(n,"achievements",e),{userId:e,achievements:[],totalAchievements:0,updatedAt:d()},{merge:!0}).catch(()=>{}),{deletedDocs:o,updatedDocs:r}}async function $(e){let t=0,s=0;const r=(await f(p(I(n,"classrooms"),g("teacherId","==",e)))).docs.map(c=>c.id);t+=await a("notifications","userId",e),t+=await a("chatSessions","userId",e),t+=await a("chatMessages","userId",e),t+=await a("announcements","teacherId",e),t+=await a("classSectionOwnership","ownerTeacherId",e),t+=await a("managedStudents","teacherId",e),t+=await a("classrooms","teacherId",e),t+=await a("normalizedClassRecords","teacherId",e),t+=await a("classRecordImports","teacherId",e),t+=await a("courseMaterials","teacherId",e),t+=await a("riskRefreshEvents","teacherId",e),t+=await a("riskRefreshJobs","teacherId",e),t+=await a("importGroundedFeedbackEvents","teacherId",e),t+=await a("accessAuditLogs","actorUid",e),t+=await a("accessAuditLogs","teacherId",e);for(const c of r)t+=await a("managedStudents","classroomId",c),t+=await a("activities","classroomId",c),t+=await a("announcements","classroomId",c),await m(i(n,"classrooms",c)).then(()=>{t+=1}).catch(()=>{});return await m(i(n,"riskRefreshStats",e)).then(()=>{t+=1}).catch(()=>{}),await l(i(n,"users",e),{testingResetAt:d(),updatedAt:d()},{merge:!0}).catch(()=>{}),s+=1,{deletedDocs:t,updatedDocs:s}}async function C(e){let t=0,s=0;return t+=await a("notifications","userId",e),t+=await a("chatSessions","userId",e),t+=await a("chatMessages","userId",e),t+=await a("curriculumContent","updatedBy",e),t+=await a("curriculumContent","deletedBy",e),await l(i(n,"users",e),{testingResetAt:d(),updatedAt:d()},{merge:!0}).catch(()=>{}),s+=1,{deletedDocs:t,updatedDocs:s}}async function F(e){const{uid:t,role:s,lrn:o}=e;if(!t)throw new Error("Missing user id for reset.");if(s==="teacher"||s==="admin")return T(e);let r;s==="student"?r=await b(t,o):s==="teacher"?r=await $(t):r=await C(t);const c=`${s} reset complete: ${r.deletedDocs} records deleted, ${r.updatedDocs} records reset.`;return{role:s,deletedDocs:r.deletedDocs,updatedDocs:r.updatedDocs,summary:c}}export{F as resetTestingDataForRole}; +import{s as l,a as d,d as i,h as f,q as p,w as g,e as I,c as m,m as w}from"./vendor-firebase-firestore-CkuVbeP5.js";import{I as S,O as v,d as n}from"./index-LyKgWktA.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 k=400,A="https://deign86-mathpulse-api-v3test.hf.space";async function T(e){const t=S.currentUser;if(!t)throw new Error("Authentication is required to reset testing data.");const s=await t.getIdToken(),o=await fetch(`${A}/api/testing/reset-data`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${s}`},body:JSON.stringify({role:e.role,...e.lrn?{lrn:e.lrn}:{}})}),r=await o.json().catch(()=>({}));if(!o.ok){const D=typeof r?.detail=="string"?r.detail:"";throw new Error(D||`Reset request failed with status ${o.status}.`)}const c=typeof r?.role=="string"?r.role:e.role,u=Number(r?.deletedDocs??0),h=Number(r?.updatedDocs??0),y=typeof r?.summary=="string"?r.summary:`${c} reset complete: ${u} records deleted, ${h} records reset.`;return{role:c,deletedDocs:u,updatedDocs:h,summary:y}}async function R(e){const t=await f(e);if(t.empty)return 0;let s=w(n),o=0,r=0;for(const c of t.docs)s.delete(c.ref),o+=1,r+=1,o>=k&&(await s.commit(),s=w(n),o=0);return o>0&&await s.commit(),r}async function B(e,t,s){return R(p(I(n,e),g(t,"==",s)))}async function a(e,t,s){try{return await B(e,t,s)}catch{return 0}}async function b(e,t){const s=t||e;let o=0,r=0;return await v(e),r+=1,await l(i(n,"users",e),{level:1,currentXP:0,totalXP:0,streak:0,streakHistory:[],atRiskSubjects:[],hasTakenDiagnostic:!1,iarAssessmentState:"not_started",learningPathState:"unlocked",remediationState:"not_required",subjectBadges:{},riskClassifications:{},overallRisk:"Low",updatedAt:d()},{merge:!0}),r+=1,o+=await a("notifications","userId",e),o+=await a("chatSessions","userId",e),o+=await a("chatMessages","userId",e),s!==e&&(o+=await a("notifications","userId",s)),await l(i(n,"achievements",e),{userId:e,achievements:[],totalAchievements:0,updatedAt:d()},{merge:!0}).catch(()=>{}),{deletedDocs:o,updatedDocs:r}}async function $(e){let t=0,s=0;const r=(await f(p(I(n,"classrooms"),g("teacherId","==",e)))).docs.map(c=>c.id);t+=await a("notifications","userId",e),t+=await a("chatSessions","userId",e),t+=await a("chatMessages","userId",e),t+=await a("announcements","teacherId",e),t+=await a("classSectionOwnership","ownerTeacherId",e),t+=await a("managedStudents","teacherId",e),t+=await a("classrooms","teacherId",e),t+=await a("normalizedClassRecords","teacherId",e),t+=await a("classRecordImports","teacherId",e),t+=await a("courseMaterials","teacherId",e),t+=await a("riskRefreshEvents","teacherId",e),t+=await a("riskRefreshJobs","teacherId",e),t+=await a("importGroundedFeedbackEvents","teacherId",e),t+=await a("accessAuditLogs","actorUid",e),t+=await a("accessAuditLogs","teacherId",e);for(const c of r)t+=await a("managedStudents","classroomId",c),t+=await a("activities","classroomId",c),t+=await a("announcements","classroomId",c),await m(i(n,"classrooms",c)).then(()=>{t+=1}).catch(()=>{});return await m(i(n,"riskRefreshStats",e)).then(()=>{t+=1}).catch(()=>{}),await l(i(n,"users",e),{testingResetAt:d(),updatedAt:d()},{merge:!0}).catch(()=>{}),s+=1,{deletedDocs:t,updatedDocs:s}}async function C(e){let t=0,s=0;return t+=await a("notifications","userId",e),t+=await a("chatSessions","userId",e),t+=await a("chatMessages","userId",e),t+=await a("curriculumContent","updatedBy",e),t+=await a("curriculumContent","deletedBy",e),await l(i(n,"users",e),{testingResetAt:d(),updatedAt:d()},{merge:!0}).catch(()=>{}),s+=1,{deletedDocs:t,updatedDocs:s}}async function F(e){const{uid:t,role:s,lrn:o}=e;if(!t)throw new Error("Missing user id for reset.");if(s==="teacher"||s==="admin")return T(e);let r;s==="student"?r=await b(t,o):s==="teacher"?r=await $(t):r=await C(t);const c=`${s} reset complete: ${r.deletedDocs} records deleted, ${r.updatedDocs} records reset.`;return{role:s,deletedDocs:r.deletedDocs,updatedDocs:r.updatedDocs,summary:c}}export{F as resetTestingDataForRole}; diff --git a/assets/trash-2-D383W6Gx.js b/assets/trash-2-CSbIpBBo.js similarity index 91% rename from assets/trash-2-D383W6Gx.js rename to assets/trash-2-CSbIpBBo.js index 90f744b62fa33238c57159503ae70b574c77d07f..d98caf1ddc4125d1a23facae8cc14de6c28d5953 100644 --- a/assets/trash-2-D383W6Gx.js +++ b/assets/trash-2-CSbIpBBo.js @@ -1,4 +1,4 @@ -import{c as e}from"./index-CYVpLr_P.js";/** +import{c as e}from"./index-LyKgWktA.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/trending-down-HzTmBWMp.js b/assets/trending-down-B4HmNTSb.js similarity index 94% rename from assets/trending-down-HzTmBWMp.js rename to assets/trending-down-B4HmNTSb.js index b47b794419912347afdb98446476b56de57ab5d2..3685f861709575630923253ddaf9da43fadb5f03 100644 --- a/assets/trending-down-HzTmBWMp.js +++ b/assets/trending-down-B4HmNTSb.js @@ -1,4 +1,4 @@ -import{c as n}from"./index-CYVpLr_P.js";/** +import{c as n}from"./index-LyKgWktA.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/trending-up-CqFD_DPI.js b/assets/trending-up-DwhUzSCD.js similarity index 88% rename from assets/trending-up-CqFD_DPI.js rename to assets/trending-up-DwhUzSCD.js index 25c8decd5c767eee1d028104c3e63c48854a3656..48700c0826e94bfba170cb898b9e7c1447307574 100644 --- a/assets/trending-up-CqFD_DPI.js +++ b/assets/trending-up-DwhUzSCD.js @@ -1,4 +1,4 @@ -import{c as n}from"./index-CYVpLr_P.js";/** +import{c as n}from"./index-LyKgWktA.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/trophy-GpbJF7pP.js b/assets/trophy-vkFq3hpl.js similarity index 93% rename from assets/trophy-GpbJF7pP.js rename to assets/trophy-vkFq3hpl.js index e7f97aa03e8335ada693b3d612cd20bcd3af5cc8..61738aa12a2f610eb5a073aa5c410377b4246ecf 100644 --- a/assets/trophy-GpbJF7pP.js +++ b/assets/trophy-vkFq3hpl.js @@ -1,4 +1,4 @@ -import{c as a}from"./index-CYVpLr_P.js";/** +import{c as a}from"./index-LyKgWktA.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/user-D-TTwp40.js b/assets/user-BZgiUM6h.js similarity index 89% rename from assets/user-D-TTwp40.js rename to assets/user-BZgiUM6h.js index 9b0269f2c5859f7f039c0c8a99baac08a0f84f0f..a44261412cd8c644eea3e056cf753992c0d22514 100644 --- a/assets/user-D-TTwp40.js +++ b/assets/user-BZgiUM6h.js @@ -1,4 +1,4 @@ -import{c}from"./index-CYVpLr_P.js";/** +import{c}from"./index-LyKgWktA.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/users-CQJB3ZBq.js b/assets/users-CRaf-j4K.js similarity index 90% rename from assets/users-CQJB3ZBq.js rename to assets/users-CRaf-j4K.js index f457bdadc48c750ead865b5ba623ffa4b6aa3fdf..504c2dfc3a8e39adf560b1c5a78f12f6ed6092fe 100644 --- a/assets/users-CQJB3ZBq.js +++ b/assets/users-CRaf-j4K.js @@ -1,4 +1,4 @@ -import{c as e}from"./index-CYVpLr_P.js";/** +import{c as e}from"./index-LyKgWktA.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/x-D3HMN9wJ.js b/assets/x-CWNywLHU.js similarity index 86% rename from assets/x-D3HMN9wJ.js rename to assets/x-CWNywLHU.js index c4ac479160a61702eac110968b592fcd020c7b3e..8d6d21c2f975a688c53a80f2462e2a3f7a6ea4bc 100644 --- a/assets/x-D3HMN9wJ.js +++ b/assets/x-CWNywLHU.js @@ -1,4 +1,4 @@ -import{c as o}from"./index-CYVpLr_P.js";/** +import{c as o}from"./index-LyKgWktA.js";/** * @license lucide-react v0.487.0 - ISC * * This source code is licensed under the ISC license. diff --git a/avatar/avatar_body.png b/avatar/avatar_body.png index b57ed998fc2acb8fb9d58145d277d7d37d1d70a5..55c1d413ad61375bf551d039299bdd07ba44d1ed 100644 --- a/avatar/avatar_body.png +++ b/avatar/avatar_body.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8c7c377876a377a78705723f5d7186747478d2d371023e94d23a39f37a0c1d43 -size 71960 +oid sha256:986b59b02a0a8eeef1a213fd36eb0eb1c162919205fb05c40327f3cca8ff148f +size 56620 diff --git a/avatar/left_horn.png b/avatar/left_horn.png index db592cd40349ec08cd48353dd294926d38e42970..68172c648481f675bf1616522b741ae39566c8c2 100644 --- a/avatar/left_horn.png +++ b/avatar/left_horn.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7ced0c469cb01e975a9f6d510e51360b88bc7046785c19db2cd76e54bb602982 -size 11119 +oid sha256:bcfca296b19e17e9355a0ba9c9055f29218ff1cf8a47fca9abf60d91685df42b +size 6518 diff --git a/avatar/pants_black.png b/avatar/pants_black.png index e3ce4e08511d99c9d1fe8cfa32244b2861cfc71f..1420e65bb957722576aecba797fa952d97300dde 100644 --- a/avatar/pants_black.png +++ b/avatar/pants_black.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:18a7767c3e45a862d7384ecadafab6af892632ba93ff4f5e31401479f0c03644 -size 11818 +oid sha256:77ddb821cec000cff346cb0fe5250272a8043885d89d03fcf2b12ced8fd7502a +size 7336 diff --git a/avatar/pants_black_thumbnail.png b/avatar/pants_black_thumbnail.png index 880c721e5e2c0420208366d9ea07b716df2d21ac..d551f75292a939a4d331e77a57f53769467920b3 100644 --- a/avatar/pants_black_thumbnail.png +++ b/avatar/pants_black_thumbnail.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1eb90c7fae2bdd2acea0c44ea2cae90efc962103fca4246714d0741d9430a635 -size 21451 +oid sha256:2d2723d47c617c1034dffa40f2ddf80607f7aca7919cae813c360f92ef458c43 +size 13116 diff --git a/avatar/right_horn.png b/avatar/right_horn.png index a7ed1ee3bab5721b56d9ff4a175cb2828df1ea2d..20d13fc29a823fc4dee6ef5a67e1e5bae9b80674 100644 --- a/avatar/right_horn.png +++ b/avatar/right_horn.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:400d22ce0574c79366363613b60946f0701e61399a1acb6addc87300599747dd -size 11162 +oid sha256:1b021960c4db25d397f11c2d1e72246260daa0dc8f48bb1b6f768afacb86fa54 +size 6603 diff --git a/avatar/shoes_black.png b/avatar/shoes_black.png index 044655aacc257e53b7bebd2c2f8f9245e3afb2d9..b35dba758e3ea334e19b8ad67ddf52119b0db353 100644 --- a/avatar/shoes_black.png +++ b/avatar/shoes_black.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:695ce9813a10b3ea5e10a9eec2adfa9cf7fe9e169cbf8c3123db1a229f1aa95c -size 10112 +oid sha256:c3f8dde5a856bb32e0c082c3743f06edabd4435ab4ee4b91eddf8bd96ff33ce0 +size 4276 diff --git a/avatar/shoes_black_thumbnail.png b/avatar/shoes_black_thumbnail.png index a5c76d9527122b97083aba3e25afdaf2c9f3e6bc..675623b053e3b7c5a1f8ffe79d443ade35bc2ac5 100644 --- a/avatar/shoes_black_thumbnail.png +++ b/avatar/shoes_black_thumbnail.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:52d88af92003f5fac54b2b8e53ac69e9c5a13ee0d57ab2ec0a536721cf8678ec -size 16803 +oid sha256:c480df8c64a9c447c648cc5c5b7911b9f96c4b7d01f5250f047ac762f68b0caf +size 6477 diff --git a/avatar/uniform_blue.png b/avatar/uniform_blue.png index a978d063ff6b985831cd357351a177f08ab54310..791be847c014bf5631a7559195e7e6d5157d5691 100644 --- a/avatar/uniform_blue.png +++ b/avatar/uniform_blue.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:298b6cddd53e4b3637738ff276af958bd70dc63d3360f7d6a2243414f7a2fd1a -size 26395 +oid sha256:a4389accfd82e95aa22a52a33fd130f1344105cf85011e7ecdbd9915ed18fb00 +size 18726 diff --git a/avatar/uniform_blue_thumbnail.png b/avatar/uniform_blue_thumbnail.png index 2c551d7581163a4be335816bd1aa4494378930b8..f2459e3be0d890a2fec7e45385786bc333a18618 100644 --- a/avatar/uniform_blue_thumbnail.png +++ b/avatar/uniform_blue_thumbnail.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:89630a6282382b214d4b10023dd7b54de8a9ccfb086f61d031e2c6f119aa165c -size 40816 +oid sha256:d5ba09db5e7f98c663086fa649de4b91f1d70ea91a782540d53f63176db17af0 +size 26481 diff --git a/avatar/uniform_pink.png b/avatar/uniform_pink.png index eb05f686ac9dc916351d0bf0eaa9c66ff98f020b..3ec12cef6029bc484208b14bb3236f9de7500c52 100644 --- a/avatar/uniform_pink.png +++ b/avatar/uniform_pink.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:efa53dcbfa106c0d093720eeb74256c7f15200bab4ce907b259ca39a005d82e4 -size 25986 +oid sha256:154c716e74222b2ab20b67143480b9fd3caff3ec6421b4e9864c4879bfcb1ef6 +size 19030 diff --git a/avatar/uniform_pink_thumbnail.png b/avatar/uniform_pink_thumbnail.png index 29218beebc352544e3abd151a857a523d032ff09..985b3f1dc9e145fb6966423d4a4c941c4310988d 100644 --- a/avatar/uniform_pink_thumbnail.png +++ b/avatar/uniform_pink_thumbnail.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:daba15cf59ed92bfc8c7913fe4b43e349beecdc4598b6b1aac3a48a0cfb8a69a -size 41071 +oid sha256:fa9d9ca2b5d9e44407d4eec956f726de3c1dc9ef5b9711f7ccf9461e27b53b0a +size 26710 diff --git a/index.html b/index.html index b4d22714f90794f8ea1346b78175dfac66f36f53..fc14fe78b61641721b0a6873588e9b9bd10f8e3e 100644 --- a/index.html +++ b/index.html @@ -25,7 +25,7 @@ #pp-static-loader .pp-spinner{width:1rem;height:1rem;border-radius:999px;border:2px solid #0284c7;border-top-color:transparent;animation:pp-spin 1.5s linear infinite} #pp-static-loader .pp-msg{margin:0;font-size:.875rem;font-weight:600;color:#64748b} - + diff --git a/mathpulse_logo.png b/mathpulse_logo.png index a2f8fa5586e248f6d5377e350fff9e78ab1eda79..5a0d277a6f6cdff5072920fac22662bc410b605f 100644 --- a/mathpulse_logo.png +++ b/mathpulse_logo.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:445c7b4cc293b782593d81224aefee10a28938a4fabfd5e3b7c5445b2f472027 -size 210789 +oid sha256:4c5521ca12e5456eeaa4b7b05721f444cbd7ff424075098f4eecee59d8400231 +size 160608