PageSourceSearch

https://app.tutorcloud.ai/static/js/3786.1e6b65dc.chunk.js

js tutorcloud.ai collected 2026-10-05 15:59:03 UTC 129,363 bytes, 1 lines download raw bytes

1"use strict";(globalThis.webpackChunkfrontend=globalThis.webpackChunkfrontend||[]).push([[3786],{24940(e,t,s){s.d(t,{A:()=>g});var n=s(9950),a=s(22875),i=s(18555),r=s(81986),l=s(93334),d=s(92906),o=s(41413),c=s(16758),u=s(55969),m=s(44414);const h=e=>{const t="string"===typeof e?e:(null===e||void 0===e?void 0:e.id)||(null===e||void 0===e?void 0:e.name)||(null===e||void 0===e?void 0:e.displayName)||"";return String(t).trim().toLowerCase().replace(/[\s-]+/g,"_")};const p=function(e){var t,s,l;let{open:p,onClose:v,onGoalCreated:g,initialSubject:x=null,afterCreateAction:b=null}=e;const f=(0,o.Zp)(),{student:y,userProfile:j}=(0,d.Fj)(),w=y||j||{},[N,S]=(0,n.useState)(1),[k,I]=(0,n.useState)([]),[C,A]=(0,n.useState)(!1),[_,L]=(0,n.useState)({subject:null,goalType:"Concept Mastery",examName:"",date:""}),[P,T]=(0,n.useState)(!1),[R,E]=(0,n.useState)(""),[D,$]=(0,n.useState)(null),[z,q]=(0,n.useState)(""),M=n.useRef(null),F=(null===w||void 0===w||null===(t=w.profile)||void 0===t?void 0:t.grade)||(null===w||void 0===w?void 0:w.grade)||"";(0,n.useEffect)(()=>{p&&(S(1),$(null),E(""),L({subject:null,goalType:"Concept Mastery",examName:"",date:""}),M.current="readiness"===b||"generate"===b?b:null,A(!0),i.default.get("/students/me/subjects").then(e=>{const t=(Array.isArray(e.data)?e.data:[]).map(e=>{var t;return"string"===typeof e?{id:e.toLowerCase().replace(/\s+/g,"_").replace(/-/g,"_"),name:e,stateStandard:"ccss"}:{id:(null===e||void 0===e?void 0:e.id)||(null===e||void 0===e||null===(t=e.name)||void 0===t?void 0:t.toLowerCase().replace(/\s+/g,"_")),name:(null===e||void 0===e?void 0:e.name)||(null===e||void 0===e?void 0:e.displayName)||(null===e||void 0===e?void 0:e.id)||String(e),stateStandard:(null===e||void 0===e?void 0:e.stateStandard)||"ccss"}});if(I(t),t.length>0){const e=x?h(x):"",s=e&&t.find(t=>h(t.id)===e||h(t.name)===e)||t[0];L(e=>({...e,subject:s}))}}).catch(()=>I([])).finally(()=>A(!1)))},[p]);const O=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e)return;const s=e.ilpId||e.id,n=Boolean(t.generateWithAi);q("generate");try{var a,r;const t=await i.default.post("/student/onboarding/learning-plan/generate-direct",{ilpId:s,storeLessons:!1,generateWithAi:n});v(),f("/student/onboarding/learning-plan-review",{state:{ilpId:s,planData:t.data,subject:"object"===typeof e.subject?null===(a=e.subject)||void 0===a?void 0:a.name:e.subject,grade:(null===w||void 0===w||null===(r=w.profile)||void 0===r?void 0:r.grade)||(null===w||void 0===w?void 0:w.grade)}})}catch(l){console.error("Generate ILP failed:",l),$(e),S(2),E((0,u.p)(l,"Failed to generate plan."))}finally{q("")}},B=async e=>{if(!e)return;const t=e.ilpId||e.id;q("readiness");try{var s;const n=await i.default.post("/student/onboarding/readiness-check/generate",{ilpId:t});v();const a="object"===typeof e.subject?null===(s=e.subject)||void 0===s?void 0:s.name:e.subject;f("/student/workspace",{state:{quizId:n.data.quizId,mode:"quiz",subject:a,lesson:"Readiness Check",ilpId:t,isReadinessCheck:!0}})}catch(r){var n,a;console.error("Readiness check generate failed:",r),$(e),S(2),E((null===(n=r.response)||void 0===n||null===(a=n.data)||void 0===a?void 0:a.detail)||"Failed to start readiness check.")}finally{q("")}};return p?(0,m.jsx)("div",{className:"fixed inset-0 z-50 overflow-y-auto bg-black/50 flex items-center justify-center p-4",children:(0,m.jsxs)("div",{className:"bg-[var(--card)] rounded-2xl shadow-xl max-w-md w-full",children:[(0,m.jsxs)("div",{className:"flex items-center justify-between p-4 border-b border-[var(--border)]",children:[(0,m.jsx)("h2",{className:"text-lg font-bold student-dash-text",children:1===N?"Set your goal":"Create your learning plan"}),(0,m.jsx)("button",{type:"button",onClick:v,className:"p-2 rounded-lg student-dash-text-muted hover:bg-[var(--muted)]","aria-label":"Close",children:(0,m.jsx)(a.QCr,{className:"text-xl"})})]}),(0,m.jsx)("div",{className:"p-4",children:1===N?(0,m.jsxs)("form",{onSubmit:async e=>{if(e.preventDefault(),E(""),!_.subject||!_.date)return void E("Please select subject and due date.");if("Exam Prep"===_.goalType&&(!_.examName||!_.examName.trim()))return void E("Please enter exam name for Exam Preparation.");const t=(()=>{let e=null===w||void 0===w?void 0:w.userId;if(Array.isArray(e)){const t=(e||[]).filter(e=>e&&e.length>3);e=t.length?t.sort((e,t)=>
1t.length-e.length)[0]:e[0]}return(!e||e&&e.length<3)&&(e=null===w||void 0===w?void 0:w.id),e})();if(t){T(!0);try{var s;const e="object"===typeof _.subject?_.subject.name:_.subject,n=r.A.fromLocalDateTimeString(`${_.date}T00:00:00`),a={title:"Exam Prep"===_.goalType&&_.examName?`${e} - ${_.examName}`:`${e} Goal`,type:"Exam Prep"===_.goalType?"Exam Preparation":_.goalType,dueDate:n,subject:"object"===typeof _.subject?_.subject:{id:e.toLowerCase().replace(/\s+/g,"_"),name:e,stateStandard:"ccss"},status:"Started",description:"Goal created from app",completionPercentage:0};"Exam Prep"===_.goalType&&_.examName&&(a.examName=_.examName.trim(),a.examDate=n);const l=await i.default.post("/studentgoals/",a),d=(null===l||void 0===l?void 0:l.data)||l,o="object"===typeof _.subject?_.subject:{id:e.toLowerCase().replace(/\s+/g,"_"),name:e,stateStandard:"ccss"},c=`ilp_${Date.now()}_${o.id}_${Math.random().toString(36).substr(2,9)}`,u="Exam Prep"===_.goalType?"examPreparation":"conceptMastery",m={ilpId:c,student:{userId:Array.isArray(null===w||void 0===w?void 0:w.userId)?w.userId:[t],role:"student"},teacher:{userId:"",role:""},grade:F,subject:o,curriculum_framework:o.stateStandard||"ccss",goal_type:"Exam Prep"===_.goalType?"Exam Preparation":_.goalType,planPurpose:u,status:"draft",targetType:"individual",selectedStudent:t,title:(null===d||void 0===d?void 0:d.title)||`${o.name} Learning Plan`,planName:(null===d||void 0===d?void 0:d.title)||`${o.name} Learning Plan`,description:(null===d||void 0===d?void 0:d.description)||`Learning plan for ${o.name}`};"Exam Prep"===_.goalType&&(_.examName&&(m.examName=_.examName.trim()),_.date&&(m.examDate=n));const h=await(0,i.createLearningPlanMeta)(m),p=null!==(s=null===h||void 0===h?void 0:h.data)&&void 0!==s?s:h;$(p),g&&g(p);const v=M.current;if(M.current=null,"generate"===v)return void await O(p);if("readiness"===v)return void await B(p);S(2)}catch(d){var n,a,l;if(console.error("Set goal / create meta failed:",d),401===(null===(n=d.response)||void 0===n?void 0:n.status))return void v();E((null===(a=d.response)||void 0===a||null===(l=a.data)||void 0===l?void 0:l.detail)||"Failed to set goal. Please try again.")}finally{T(!1)}}else E("Could not determine student. Please log in again.")},className:"space-y-4",children:[R&&(0,m.jsx)("p",{className:"text-sm text-[var(--destructive)]",children:R}),(0,m.jsxs)("div",{children:[(0,m.jsx)("label",{className:"block text-sm font-medium student-dash-text mb-1",children:"Subject"}),C?(0,m.jsx)("p",{className:"text-sm student-dash-text-muted",children:"Loading..."}):(0,m.jsxs)("select",{value:null!==(s=null===(l=_.subject)||void 0===l?void 0:l.id)&&void 0!==s?s:"",onChange:e=>{const t=k.find(t=>(t.id||t.name)===e.target.value);L(e=>({...e,subject:t||null}))},className:"w-full border border-[var(--border)] rounded-lg px-3 py-2 text-sm",required:!0,children:[(0,m.jsx)("option",{value:"",children:"Select subject"}),k.map(e=>(0,m.jsx)("option",{value:e.id||e.name,children:e.name},e.id||e.name))]})]}),(0,m.jsxs)("div",{children:[(0,m.jsx)("label",{className:"block text-sm font-medium student-dash-text mb-1",children:"Goal type"}),(0,m.jsxs)("select",{value:_.goalType,onChange:e=>L(t=>({...t,goalType:e.target.value})),className:"w-full border border-[var(--border)] rounded-lg px-3 py-2 text-sm",children:[(0,m.jsx)("option",{value:"Concept Mastery",children:"Concept Mastery"}),(0,m.jsx)("option",{value:"Exam Prep",children:"Exam Prep"})]})]}),"Exam Prep"===_.goalType&&(0,m.jsxs)("div",{children:[(0,m.jsx)("label",{className:"block text-sm font-medium student-dash-text mb-1",children:"Exam name"}),(0,m.jsxs)("select",{value:_.examName,onChange:e=>L(t=>({...t,examName:e.target.value})),className:"w-full border border-[var(--border)] rounded-lg px-3 py-2 text-sm",children:[(0,m.jsx)("option",{value:"",children:"Name of Exam"}),(0,m.jsx)("option",{value:"Term 1",children:"Term 1"}),(0,m.jsx)("option",{value:"Term 2",children:"Term 2"}),(0,m.jsx)("option",{value:"Finals",children:"Finals"}),(0,m.jsx)("option",{value:"Board Exam",children:"Board Exam"})]})]}),(0,m.jsxs)("div",{children:[(0,m.jsx)("label",{className:"block text-sm font-medium student-dash-text mb-1",children:"Due date"}),(0,m.jsx)(c.A,{type:"date",value:_.date,onChange:e=>L(t=>({...t,date:e.target.value})),className:"w-full border border-[var(--border)] rounded-lg px-3 py-2 text-sm",required:!0})]}),(0,m.jsxs)("div",{className:"flex gap-2 pt-2",children:[(0,m.jsx)("button",{type:"button",onClick:v,className:"flex-1 py-2 px-4 roun
1ded-lg border border-[var(--border)] student-dash-text text-sm font-medium hover:bg-[var(--muted)]",children:"Cancel"}),(0,m.jsx)("button",{type:"submit",disabled:P,className:"flex-1 py-2 px-4 rounded-lg bg-[#003D5C] text-white text-sm font-medium hover:bg-[#002D44] disabled:opacity-60",children:P?"Setting goal\u2026":"Set Goal"})]})]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("p",{className:"text-sm student-dash-text-muted mb-4",children:"Your goal is set. Would you like to create your learning plan now?"}),R&&(0,m.jsx)("p",{className:"text-sm text-[var(--destructive)] mb-2",children:R}),(0,m.jsxs)("div",{className:"space-y-2",children:[(0,m.jsxs)("button",{type:"button",onClick:async()=>{await O(D)},disabled:!!z,className:"w-full flex items-center justify-center gap-2 py-3 px-4 rounded-lg bg-[#003D5C] text-white text-sm font-medium hover:bg-[#002D44] disabled:opacity-60",children:[(0,m.jsx)(a.vd0,{className:"h-4 w-4"}),"generate"===z?"Generating\u2026":"Generate my learning plan"]}),(0,m.jsx)("button",{type:"button",onClick:async()=>{await O(D,{generateWithAi:!0})},disabled:!!z,className:"w-full flex items-center justify-center gap-2 py-3 px-4 rounded-lg border-2 border-[#003D5C] text-[#003D5C] text-sm font-medium hover:bg-[color-mix(in_srgb,#003D5C_8%,white)] disabled:opacity-60",children:"generate"===z?"Generating\u2026":"Generate with AI"}),(0,m.jsxs)("button",{type:"button",onClick:async()=>{await B(D)},disabled:!!z,className:"w-full flex items-center justify-center gap-2 py-3 px-4 rounded-lg border-2 border-[#009DFF] text-[#009DFF] text-sm font-medium hover:bg-[#EFF7FF] disabled:opacity-60",children:[(0,m.jsx)(a.RBv,{className:"h-4 w-4"}),"readiness"===z?"Starting\u2026":"Start readiness check"]}),(0,m.jsx)("button",{type:"button",onClick:v,className:"w-full py-2 text-sm student-dash-text-muted hover:student-dash-text",children:"I'll do this later"})]})]})})]})}):null};var v=s(32799);const g=function(e){let{goals:t=null}=e;
1const[s,o]=(0,n.useState)(t||[]),[c,u]=(0,n.useState)(null===t),[h,g]=(0,n.useState)(!1),[x,b]=(0,n.useState)({prev:!1,next:!1}),[f,y]=(0,n.useState)({prev:!1,next:!1}),j=(0,n.useRef)(null),w=(0,n.useRef)(null),{student:N,userProfile:S}=(0,d.Fj)(),k=(e,t)=>{const s=e.current;s&&t({prev:s.scrollLeft>2,next:s.scrollLeft<s.scrollWidth-s.clientWidth-2})},I=e=>{var t;return null===(t=e.current)||void 0===t?void 0:t.scrollBy({left:-e.current.clientWidth,behavior:"smooth"})},C=e=>{var t;return null===(t=e.current)||void 0===t?void 0:t.scrollBy({left:e.current.clientWidth,behavior:"smooth"})},A=(()=>{var e;const t=N||S||{};if(!(0,v.pT)(t))return!0;return 1===(null!==(e=null===t||void 0===t?void 0:t.setupLearningGoals)&&void 0!==e?e:0)})(),_=s.filter(e=>{var t,s;const n=null===e||void 0===e||null===(t=e.status)||void 0===t?void 0:t.toLowerCase(),a=Number(null!==(s=null===e||void 0===e?void 0:e.completionPercentage)&&void 0!==s?s:0);return"completed"===n||a>=100}).sort((e,t)=>{const s=new Date((null===e||void 0===e?void 0:e.lastUpdatedTime)||(null===e||void 0===e?void 0:e.dueDate)||0).getTime();return new Date((null===t||void 0===t?void 0:t.lastUpdatedTime)||(null===t||void 0===t?void 0:t.dueDate)||0).getTime()-s}),L=s.filter(e=>!_.some(t=>t.id===e.id)).sort((e,t)=>new Date((null===e||void 0===e?void 0:e.dueDate)||(null===e||void 0===e?void 0:e.lastUpdatedTime)||1/0).getTime()-new Date((null===t||void 0===t?void 0:t.dueDate)||(null===t||void 0===t?void 0:t.lastUpdatedTime)||1/0).getTime());return(0,n.useEffect)(()=>{if(void 0!==t&&null!==t)return o(Array.isArray(t)?t:[]),void u(!1);u(!0),i.default.get("/studentgoals/me",{_source:"GoalsSection (component-level)"}).then(e=>o(Array.isArray(e.data)?e.data:[])).catch(e=>console.error("Error fetching goals:",e)).finally(()=>u(!1))},[t]),(0,n.useEffect)(()=>{if(void 0===t||null===t)return;if(!Array.isArray(t)||t.length>0)return;let e=!1;return i.default.get("/studentgoals/me",{_source:"GoalsSection (empty-context fallback)"}).then(t=>{if(e)return;const s=Array.isArray(t.data)?t.data:[];s.length>0&&(o(s),window.dispatchEvent(new Event("goalsUpdated")))}).catch(()=>{}),()=>{e=!0}},[t]),(0,n.useEffect)(()=>{const e=j.current,t=w.current,s=()=>k(j,b),n=()=>k(w,y);let a=null,i=null;return L.length>0&&e&&(k(j,b),e.addEventListener("scroll",s),a=new ResizeObserver(s),a.observe(e)),_.length>0&&t&&(k(w,y),t.addEventListener("scroll",n),i=new ResizeObserver(n),i.observe(t)),()=>{e&&e.removeEventListener("scroll",s),t&&t.removeEventListener("scroll",n),a&&a.disconnect(),i&&i.disconnect()}},[L.length,_.length]),(0,m.jsxs)("div",{className:"student-dash-card student-dash-card-pad",children:[(0,m.jsxs)("div",{className:"flex items-center justify-between mb-5",children:[(0,m.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,m.jsx)("div",{className:"w-5 h-5 student-dash-accent-text shrink-0","aria-hidden":!0,children:(0,m.jsxs)("svg",{className:"block size-full",fill:"none",stroke:"currentColor",viewBox:"0 0 20 20",children:[(0,m.jsx)("path",{strokeWidth:"1.5",d:"M10 2C5.58172 2 2 5.58172 2 10C2 14.4183 5.58172 18 10 18C14.4183 18 18 14.4183 18 10C18 5.58172 14.4183 2 10 2Z"}),(0,m.jsx)("circle",{cx:"10",cy:"10",r:"4",strokeWidth:"1.5"}),(0,m.jsx)("circle",{cx:"10",cy:"10",r:"1.5",fill:"currentColor"})]})}),(0,m.jsx)("p",{className:"student-dash-heading-lg",children:"Your Goal"})]}),(0,m.jsxs)("div",{className:"flex gap-2",children:[A&&!h&&(0,m.jsx)("button",{type:"button",onClick:()=>g(!0),className:"student-dash-btn student-dash-btn-primary px-4 py-2 h-auto text-[14px]",children:"Set goal"}),(0,m.jsx)("button",{type:"button",onClick:()=>{},className:"hidden items-center justify-center gap-2 text-[14px] student-dash-btn student-dash-btn-outline border-2 border-[var(--chart-1)] student-dash-chart1-text hover:bg-[var(--secondary)] px-4 py-2",children:"Change request"})]})]}),c?(0,m.jsx)("p",{className:"text-center student-dash-text-muted",children:"Loading goals..."}):0===s.length?(0,m.jsx)("p",{className:"text-center student-dash-text-muted",children:"No goals set yet"}):(0,m.jsxs)("div",{className:"space-y-6",children:[L.length>0&&(0,m.jsxs)("div",{children:[(0,m.jsx)("h4",{className:"student-dash-text-sm font-semibold mb-2",children:"In Progress"}),(0,m.jsxs)("div",{className:"relative w-full min-w-0 overflow-hidden",children:[(0,m.jsx)("button",{type:"button",onClick:()=>I(j),disabled:!x.prev,"aria-label":"Previous goals",className:"absolute left-0 top-1/2 -translate-y-1/2 z-10 w-10 h-10 sm:w-12 sm:h-12 flex items-center justify-center rounded-full student-dash-card border-2 border-[var(--border)] student-dash-text-muted shadow-md hover:bg-[var(--muted)] disabled:opacity-40 disabled:pointer-events-none -translate-x-1 sm:-translate-x-2",children:(0,m.jsx)(a._Jj,{className:"w-5 h-5 sm:w-6 sm:h-6"})}),(0,m.jsx)("button",{type:"button",onClick:()=>C(j),disabled:!x.next,"aria-label":"Next goals",className:"absolute right-0 top-1/2 -translate-y-1/2 z-10 w-10 h-10 sm:w-12 sm:h-12 flex items-center justify-center rounded-full student-dash-card border-2 border-[var(--border)] student-dash-text-muted shadow-md hover:bg-[var(--muted)] disabled:opacity-40 disabled:pointer-events-none translate-x-1 sm:translate-x-2",children:(0,m.jsx)(a.X6T,{className:"w-5 h-5 sm:w-6 sm:h-6"})}),(0,m.jsx)("div",{ref:j,className:"flex flex-row flex-nowrap gap-4 overflow-x-auto overflow-y-hidden scroll-smooth pb-2 pl-16 pr-16 min-w-0 
1w-full [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden",style:{scrollSnapType:"x mandatory",WebkitOverflowScrolling:"touch"},children:L.map(e=>{const t=r.A.formatDate(null===e||void 0===e?void 0:e.dueDate)||"No due date";return(0,m.jsxs)("div",{className:"flex-none w-[280px] min-w-[280px] sm:w-[300px] sm:min-w-[300px] border border-[var(--border)] rounded-[12px] p-4",style:{scrollSnapAlign:"start"},children:[(0,m.jsxs)("div",{className:"flex items-start justify-between mb-3",children:[(0,m.jsxs)("p",{className:"text-[14px] student-dash-text-muted",children:["Goal ",L.indexOf(e)+1]}),(0,m.jsx)("div",{className:"w-2 h-2 rounded-full bg-[var(--chart-4)]"})]}),(0,m.jsx)("p",{className:"student-dash-text-xs mb-2",children:t}),(0,m.jsxs)("div",{className:"flex items-center gap-2 mb-3 flex-wrap",children:[(0,m.jsx)("span",{className:"text-[11px] px-2 py-0.5 rounded-md border font-medium student-dash-banner-warn border-[color-mix(in_srgb,var(--accent-brand)_25%,transparent)] student-dash-accent-text",children:"Exam Preparation"===e.type||"Exam Prep"===e.type?"Exam Prep":"Concept Mastery"}),(0,m.jsx)("span",{className:"text-[11px] px-2 py-0.5 rounded-md border border-[var(--border)] student-dash-text-sm",children:(0,l.LX)(e.subject)||"General"})]}),(0,m.jsx)("p",{className:"text-[16px] student-dash-text font-medium",children:e.title||"Goal"})]},e.id)})})]})]}),(0,m.jsxs)("div",{children:[(0,m.jsx)("h4",{className:"student-dash-text-sm font-semibold mb-2",children:"Completed"}),0===_.length?(0,m.jsx)("div",{className:"student-dash-text-muted text-sm border border-[var(--border)] rounded-md p-3 bg-[var(--muted)]",children:"No completed goals yet. Finish one to celebrate!"}):(0,m.jsxs)("div",{className:"relative w-full min-w-0 overflow-hidden",children:[(0,m.jsx)("button",{type:"button",onClick:()=>I(w),disabled:!f.prev,"aria-label":"Previous completed",className:"absolute left-0 top-1/2 -translate-y-1/2 z-10 w-10 h-10 sm:w-12 sm:h-12 flex items-center justify-center rounded-full student-dash-card border-2 border-[var(--border)] student-dash-text-muted shadow-md hover:bg-[var(--muted)] disabled:opacity-40 disabled:pointer-events-none -translate-x-1 sm:-translate-x-2",children:(0,m.jsx)(a._Jj,{className:"w-5 h-5 sm:w-6 sm:h-6"})}),(0,m.jsx)("button",{type:"button",onClick:()=>C(w),disabled:!f.next,"aria-label":"Next completed",className:"absolute right-0 top-1/2 -translate-y-1/2 z-10 w-10 h-10 sm:w-12 sm:h-12 flex items-center justify-center rounded-full student-dash-card border-2 border-[var(--border)] student-dash-text-muted shadow-md hover:bg-[var(--muted)] disabled:opacity-40 disabled:pointer-events-none translate-x-1 sm:translate-x-2",children:(0,m.jsx)(a.X6T,{className:"w-5 h-5 sm:w-6 sm:h-6"})}),(0,m.jsx)("div",{ref:w,className:"flex flex-row flex-nowrap gap-4 overflow-x-auto overflow-y-hidden scroll-smooth pb-2 pl-16 pr-16 min-w-0 
1w-full [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden",style:{scrollSnapType:"x mandatory",WebkitOverflowScrolling:"touch"},children:_.slice(0,6).map(e=>{const t=r.A.formatDate((null===e||void 0===e?void 0:e.lastUpdatedTime)||(null===e||void 0===e?void 0:e.dueDate))||"Recently";return(0,m.jsxs)("div",{className:"flex-none w-[280px] min-w-[280px] sm:w-[300px] sm:min-w-[300px] border border-[var(--border)] rounded-[12px] p-4",style:{scrollSnapAlign:"start"},children:[(0,m.jsxs)("div",{className:"flex items-start justify-between mb-3",children:[(0,m.jsxs)("p",{className:"text-[14px] student-dash-text-muted",children:["Goal ",_.indexOf(e)+1]}),(0,m.jsx)("div",{className:"w-2 h-2 rounded-full bg-[var(--chart-4)]"})]}),(0,m.jsx)("p",{className:"student-dash-text-xs mb-2",children:t}),(0,m.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,m.jsx)("span",{className:"text-[11px] px-2 py-0.5 rounded-md border font-medium bg-[color-mix(in_srgb,var(--chart-4)_12%,var(--card))] text-[var(--chart-4)] border-[color-mix(in_srgb,var(--chart-4)_25%,transparent)]",children:"Completed"}),(0,m.jsx)("span",{className:"text-[11px] px-2 py-0.5 rounded-md border border-[var(--border)] student-dash-text-sm",children:(0,l.LX)(e.subject)||"General"})]}),(0,m.jsx)("p",{className:"text-[16px] student-dash-text font-medium",children:e.title||"Goal"})]},e.id)})})]})]})]}),A&&(0,m.jsx)(p,{open:h,onClose:()=>g(!1),onGoalCreated:()=>{g(!1),void 0!==t?window.dispatchEvent(new Event("goalsUpdated")):void 0===t||null===t?(u(!0),i.default.get("/studentgoals/me").then(e=>o(Array.isArray(e.data)?e.data:[])).catch(e=>console.error("Error fetching goals:",e)).finally(()=>u(!1))):window.dispatchEvent(new Event("goalsUpdated"))}})]})}},66663(e,t,s){s.d(t,{A:()=>I});var n=s(9950),a=s(41413),i=s(22875),r=s(18555),l=s(93334),d=s(81986),o=s(45742),c=s(57787),u=s(6983),m=s(92906),h=s(32799),p=s(51365),v=s(81454),g=s(76060),x=s(44414);function b(e,t){const s=function(e){if(!e||"object"!==typeof e)return null;const t=e.submittedAt||e.endDateTime||e.completedAt||e.updatedAt||e.createdAt;if(!t)return null;const s=new Date(t).getTime();return Number.isNaN(s)?null:s}(e);return null!=s&&Date.now()-s>=864e5}const f=`${g.wI} student-dash-text-muted border-[var(--border)] bg-[var(--muted)]`;function y(e){if(null==e||""===e)return null;if("number"===typeof e&&Number.isFinite(e)&&e>0)return Math.round(e);const t=parseInt(String(e).replace(/[^\d]/g,""),10);return Number.isFinite(t)&&t>0?t:null}function j(e,t){if(!e||!Array.isArray(t)||0===t.length)return null;const s=e.assignmentId;if(s){const e=t.find(e=>e.teacherReadinessAssignmentId&&String(e.teacherReadinessAssignmentId)===String(s));if(e)return e}const n=e.ilpId;if(!n)return null;const a=t.filter(e=>String(e.ilpId||e.id)===String(n));if(0===a.length)return null;if(1===a.length)return a[0];const i=a.map(e=>({m:e,score:(e.readinessAssessmentScheduleEnd?4:0)+(e.readinessAssessmentDuration?2:0)+(e.readinessAssessmentAttempts?1:0),ts:e.updatedAt||e.createdAt||""}));return i.sort((e,t)=>t.score-e.score||String(t.ts).localeCompare(String(e.ts))),i[0].m}function w(e){const t=String(e||"").toLowerCase().trim();return t?"unlimited"===t?"Unlimited attempts":"two"===t?"Up to 2 attempts":"single"===t||"one"===t?"1 attempt":null:null}function N(e,t,s,n){var a,i,r,l,o;let{planMetaLoaded:c}=n;const u=(null===e||void 0===e?void 0:e.metadata)||{},m={},h=function(e){if(null===e||void 0===e||!e.dueDate)return null;const t=new Date(e.dueDate),s=new Date;s.setHours(0,0,0,0),t.setHours(0,0,0,0);const n=t-s,a=Math.ceil(n/864e5);return a<0?{text:"Due yesterday",isOverdue:!0}:0===a?{text:"Due today",isOverdue:!1}:1===a?{text:"Due tomorrow",isOverdue:!1}:{text:`Due ${d.A.formatDate(e.dueDate)}`,isOverdue:!1}}(e);if(void 0!==u.attemptsLeft&&null!==u.attemptsLeft){const e=Number(u.attemptsLeft);Number.isFinite(e)&&(m.attemptsLine=e<=0?"No attempts left":`${e} attempt${1===e?"":"s"} left`)}else if(u.allowMultipleAttempts)m.attemptsLine="Multiple attempts allowed";else{const e=w(u.readinessAssessmentAttempts);if(e)m.attemptsLine=e;else if(c&&t){const e=w(t.readinessAssessmentAttempts);e&&(m.attemptsLine=e)}}if(null!==e&&void 0!==e&&e.dueDate){let t=`${d.A.formatDate(e.dueDate)}${e.dueTime?` at ${e.dueTime}`:""}`;null!==h&&void 0!==h&&h.text&&(t=`${t} (${h.text})`),m.dueLine=t,m.dueInfo=h}else if(c&&t){const e=function(e){if(!e)return null;const t=e.readinessAssessmentScheduleEnd;if(!t)return null;try{const e=new Date(t);return Number.isNaN(e.getTime())?null:d.A.formatDate(t)}catch{return null}}(t);if(e){m.dueLine=e;const s=function(e){const t=null===e||void 0===e?void 0:e.readinessAssessmentScheduleEnd;if(!t)return null;try{const e=new Date(t);if(Number.isNaN(e.getTime()))return null;const s=new Date;s.setHours(0,0,0,0),e.setHours(0,0,0,0);const n=Math.ceil((e-s)/864e5);return n<0?{text:"Overdue",isOverdue:!0}:0===n?{text:"Due today",isOverdue:!1}:null}catch{return null}}(t);
1s&&(m.dueInfo=s)}}let p=null!==(a=null!==(i=null!==(r=null!==(l=null!==(o=y(u.plannedDurationMinutes))&&void 0!==o?o:y(e.duration))&&void 0!==l?l:"number"===typeof e.estimatedTime&&e.estimatedTime>0?Math.round(e.estimatedTime):null)&&void 0!==r?r:y(e.estimatedTime))&&void 0!==i?i:y(u.duration))&&void 0!==a?a:y(u.estimatedDuration);if(!p&&c&&null!=t&&null!=t.readinessAssessmentDuration){const e=Number(t.readinessAssessmentDuration);Number.isFinite(e)&&e>0&&(p=Math.round(e))}if(!p&&s&&(p=function(e){var t;if(!e||"object"!==typeof e)return null;const s=null!==(t=e.duration)&&void 0!==t?t:e.totalDuration;if(null==s||""===s)return null;if("number"===typeof s&&Number.isFinite(s)&&s>0)return Math.round(s);const n=String(s).trim(),a=n.match(/^(\d+)\s*m/i);return a?parseInt(a[1],10):y(n)}(s)),null!=p&&Number.isFinite(p)&&p>0){const e=Math.round(p);m.durationLine=`About ${e} minute${1===e?"":"s"}`,m.durationMins=e}return m}function S(e){const t=String((null===e||void 0===e?void 0:e.status)||"").trim().toLowerCase();return"active"===t||"published"===t||"inprogress"===t||"completed"===t}function k(e){var t,s;const n=(null===e||void 0===e||null===(t=e.teacher)||void 0===t?void 0:t.userId)||(null===e||void 0===e||null===(s=e.teacher)||void 0===s?void 0:s.user_id)||"";return n&&String(n).trim().length>0||!(null===e||void 0===e||!e.classId)}const I=function(){var e,t,s,y,w,I;const C=(0,a.Zp)(),A=(0,a.zy)(),{student:_,userProfile:L}=(0,m.Fj)(),P=_||L||{},T=(0,h.pT)(P),R=!T,E=null!==(e=null!==(t=null===P||void 0===P?void 0:P.baselineReadinessCheck)&&void 0!==t?t:null===P||void 0===P||null===(s=P.profile)||void 0===s?void 0:s.baselineReadinessCheck)&&void 0!==e?e:0,D=Number(null!==(y=null!==(w=null===P||void 0===P?void 0:P.setupLearningGoals)&&void 0!==w?w:null===P||void 0===P||null===(I=P.profile)||void 0===I?void 0:I.setupLearningGoals)&&void 0!==y?y:0)||0,$=!(!T||1!==E),[z,q]=(0,n.use
1State)([]),[M,F]=(0,n.useState)(!0),[O,B]=(0,n.useState)({}),[G,W]=(0,n.useState)({}),[U,Q]=(0,n.useState)({}),[J,Y]=(0,n.useState)([]),[H,Z]=(0,n.useState)(!1),[V,X]=(0,n.useState)(null),[K,ee]=(0,n.useState)(null),[te,se]=(0,n.useState)({}),[ne,ae]=(0,n.useState)(!1),[ie,re]=(0,n.useState)($),[le,de]=(0,n.useState)([]),[oe,ce]=(0,n.useState)([]),[ue,me]=(0,n.useState)({}),[he,pe]=(0,n.useState)(!0),ve=(0,n.useRef)(new Set),ge=(0,n.useRef)(!1),[xe,be]=(0,n.useState)({}),[fe,ye]=(0,n.useState)(()=>Date.now());(0,n.useEffect)(()=>{try{const e=localStorage.getItem("assignmentSubmissionResults");if(e){const t=JSON.parse(e);Q(t)}}catch(e){console.error("Error loading persisted submission results:",e)}je(),we()},[]),(0,n.useEffect)(()=>{if(!$)return void re(!1);let e=!1;return(async()=>{try{let s=null===P||void 0===P?void 0:P.userId;if(Array.isArray(s)){const e=s.filter(e=>e&&e.length>=3);s=e.length>0?e.sort((e,t)=>t.length-e.length)[0]:s[0]}if((!s||s.length<3)&&(s=null===P||void 0===P?void 0:P.id),!s)return void(e||re(!1));const n=await r.default.get(`/learningplanmeta/student/${s}`),a=Array.isArray(n.data)?n.data:[];for(const i of a){const s=i.ilpId||i.id;if(s)try{var t;if(null!==(t=(await r.default.get(`/student/onboarding/readiness-check/status/${s}`)).data)&&void 0!==t&&t.hasReadinessCheckCompleted){e||ae(!0);break}}catch{}}}catch(s){}e||re(!1)})(),()=>{e=!0}},[$,null===P||void 0===P?void 0:P.userId,null===P||void 0===P?void 0:P.id]),(0,n.useEffect)(()=>{let e=!1;return(async()=>{try{pe(!0);let s=null===P||void 0===P?void 0:P.userId;if(Array.isArray(s)){const e=s.filter(e=>e&&e.length>=3);s=e.length?e.sort((e,t)=>t.length-e.length)[0]:s[0]}if((!s||s.length<3)&&(s=null===P||void 0===P?void 0:P.id),!s)return void(e||(ce([]),de([]),pe(!1)));let n=[];try{const e=await r.default.get(`/learningplanmeta/student/${s}`);n=Array.isArray(e.data)?e.data:[]}catch(t){n=[]}if(e)return;ce(n.filter(S)),de(n.filter(e=>function(e,t){if(1!==Number(t))return!1;const s=String((null===e||void 0===e?void 0:e.status)||"draft").toLowerCase();return("draft"===s||"new"===s)&&!k(e)}(e,D)))}catch(s){e||(ce([]),de([]))}finally{e||pe(!1)}})(),()=>{e=!0}},[null===P||void 0===P?void 0:P.userId,null===P||void 0===P?void 0:P.id,D]),(0,n.useEffect)(()=>{if(he||!z.length)return;let e=!1;const t=[],s=new Set;for(const n of z){if(!n.quizzId||s.has(n.quizzId))continue;s.add(n.quizzId);if(!N(n,j(n,oe),void 0,{planMetaLoaded:!0}).durationLine&&(!ve.current.has(n.quizzId)&&(t.push(n.quizzId),t.length>=15)))break}return t.forEach(t=>{ve.current.add(t),r.default.get(`/quiz/session/${t}`).then(s=>{!e&&null!==s&&void 0!==s&&s.data&&me(e=>e[t]?e:{...e,[t]:s.data})}).catch(()=>{})}),()=>{e=!0}},[z,oe,he]);const je=async()=>{try{const e=await r.default.get("/quiz/recent-completed?limit=200"),t=Array.isArray(e.data)?e.data:[];Y(t);const s={};t.forEach(e=>{e.assignmentId&&"completed"===e.status&&(s[e.assignmentId]={score:e.actualScore||0,totalScore:e.maximumScore||100,submittedAt:e.submittedAt||e.endDateTime||e.createdAt})}),Object.keys(s).length>0&&Q(e=>{const t={...e,...s};try{localStorage.setItem("assignmentSubmissionResults",JSON.stringify(t))}catch(n){console.error("Error persisting submission results:",n)}return t})}catch(e){console.error(" [FRONTEND] Error fetching completed quizzes:",e)}},we=async()=>{try{F(!0);const e=await r.default.get("/quiz/learning-plan-questions",{_source:"LearningPlanQuestions"}),t=Array.isArray(e.data)?e.data:[];t.length,q(t);const s={};t.forEach((e,t)=>{const n=e.assignmentId||e.ilpId;n&&(s[n]||(s[n]=[]),s[n].push(e))}),B(s)}catch(e){console.error(" [FRONTEND] Error fetching learning plan questions:",e),console.error(" [FRONTEND] Error response:",e.response),console.error(" [FRONTEND] Error message:",e.message),q([]),B({})}finally{F(!1)}};(0,n.useEffect)(()=>{const e=()=>{"visible"===document.visibilityState&&(je(),we())};return document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[]),(0,n.useEffect)(()=>{const e=setInterval(()=>ye(Date.now()),6e4);return()=>clearInterval(e)},[]),(0,n.useEffect)(()=>{const e=()=>{je(),we()};return window.addEventListener("focus",e),()=>window.removeEventListener("focus",e)},[]);const Ne=e=>{const t=null===e||void 0===e?void 0:e.subject;return"string"===typeof t?t:(null===t||void 0===t?void 0:t.name)||(null===t||void 0===t?void 0:t.displayName)||(0,l.LX)(e)||"General"},Se=e=>"Exam Preparation"===(null===e||void 0===e?void 0:e.goal_type)&&null!==e&&void 0!==e&&e.examName?e.examName:"Exam Preparation"===(null===e||void 0===e?void 0:e.goal_type)?"Exam Preparation":"Concept Mastery",ke=e=>null!==e&&void 0!==e&&e.examDate?d.A.formatDate(e.examDate):null!==e&&void 0!==e&&e.completionDatePlanned?d.A.formatDate(e.completionDatePlanned):null,Ie=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=(null===e||void 0===e?void 0:e.ilpId)||(null===e||void 0===e?void 0:e.id);if(!s)return;const n=Boolean(t.generateWithAi),a=`draft_generate_${s}`;be(e=>({...e,[a]:!0}));try{var i;const t=await r.default.post("/student/onboarding/learning-plan/generate-direct",{ilpId:s,storeLessons:!1,generateWithAi:n});C("/student/onboarding/learning-plan-review",{state:{ilpId:s,planData:t.data,subject:Ne(e),grade:(null===P||void 0===P||null===(i=P.profile)||void 0===i?void 0:i.grade)||(null===P||void 0===P?void 0:P.grade)}})}catch(o){var l,d;console.error("Generate ILP failed:",o),alert((null===(l=o.response)||void 0===l||null===(d=l.data)||void 0===d?void 0:d.detail)||"Failed to generate plan.")}finally{be(e=>{const t={...e};return delete t[a],t})}},Ce=e=>{if(!e||"object"!==typeof e)return"Practice";const t=e.metadata||{};if(!0===t.isReadinessCheck||!0===t.readinessCheck)return"Readiness Check";if(String(t.type||"").toLowerCase().includes("readiness"))return"Readiness Check";
1if(String(e.lesson||e.topic||"").toLowerCase().includes("readiness"))return"Readiness Check";if(String(e.assignmentTitle||"").toLowerCase().includes("readiness"))return"Readiness Check";if(!0===e.readiness_check||!0===e.isReadinessCheck)return"Readiness Check";const s=String(e.assignmentType||e.type||"").toLowerCase();return"practice"===s||"homework"===s||"project"===s?"Practice":"assessment"===s||e.assignmentId&&e.quizzId?"Assessment":e.quizzId?"Quiz":t.type?t.type:"quiz"===e.questionType||"quiz"===e.mode?"Quiz":"Practice"},Ae=e=>{var t,s,n,a;if(!e||"object"!==typeof e)return{score:0,totalScore:0};const i=null!==(t=null!==(s=e.score)&&void 0!==s?s:e.actualScore)&&void 0!==t?t:0,r=null!==(n=null!==(a=e.totalScore)&&void 0!==a?a:e.maximumScore)&&void 0!==n?n:0;return{score:Number(i)||0,totalScore:Number(r)||0}},_e=(e,t)=>{var s;if("quiz"===(null===t||void 0===t?void 0:t.sessionCompletionMode)||"practice"===(null===t||void 0===t?void 0:t.sessionCompletionMode))return t.sessionCompletionMode;const n=null===e||void 0===e||null===(s=e.questions)||void 0===s?void 0:s[0];return null!==n&&void 0!==n&&n.quizzId?"quiz":"practice"},Le=()=>{ge.current=!1,Z(!1),X(null),(()=>{var e;localStorage.removeItem("assignmentCompletionData"),null!==(e=A.state)&&void 0!==e&&e.pendingAssignmentCompletion&&C(A.pathname,{replace:!0,state:{}})})(),je(),we()},Pe=function(e){var t,s,n,a,i,r,l,d,o,c,u,m,h,p;let v=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(ge.current)return!1;if(!(e=>{var t,s,n,a;if(null===e||void 0===e||!e.completionData)return!1;const i=e.completionData;return Boolean(e.sessionId||i.session||i.score||i.gradingEvaluatedAt||(null===(t=i.session)||void 0===t?void 0:t.gradingEvaluatedAt)||null!=(null===(s=i.score)||void 0===s?void 0:s.totalScore)||null!=(null===(n=i.score)||void 0===n?void 0:n.maxScore)||null!=(null===(a=i.session)||void 0===a?void 0:a.actualScore))})(e))return!1;const g=(null===v||void 0===v?void 0:v.assignmentId)||(null===v||void 0===v||null===(t=v.questions)||void 0===t||null===(s=t[0])||void 0===s?void 0:s.assignmentId)||(null===(n=e.config)||void 0===n?void 0:n.assignmentId);if(v&&g&&null!==(a=e.config)&&void 0!==a&&a.assignmentId&&e.config.assignmentId!==g&&e.config.assignmentId!==v.id)return!1;const x={subject:(null===v||void 0===v?void 0:v.subject)||(null===v||void 0===v?void 0:v.subjectName)||(null===(i=e.config)||void 0===i?void 0:i.subject),lesson:(null===v||void 0===v?void 0:v.lesson)||(null===(r=e.config)||void 0===r?void 0:r.lesson),type:(null===v||void 0===v?void 0:v.type)||(null===(l=e.config)||void 0===l?void 0:l.type),assignmentType:(null===v||void 0===v?void 0:v.type)||(null===(d=e.config)||void 0===d?void 0:d.type),mode:"assignment",assignmentId:g||(null===(o=e.config)||void 0===o?void 0:o.assignmentId),isLearningPlan:!0,duration:(null===v||void 0===v?void 0:v.durationLine)||(null===(c=e.config)||void 0===c?void 0:c.duration)||"20 min",sessionCompletionMode:_e(v||{},e.config),quizzId:(null===(u=e.config)||void 0===u?void 0:u.quizzId)||(null===v||void 0===v||null===(m=v.questions)||void 0===m||null===(h=m[0])||void 0===h?void 0:h.quizzId)};return X({completionData:{...e.completionData,ilpSummary:(null===(p=e.completionData)||void 0===p?void 0:p.ilpSummary)||{message:"Your assignment was submitted successfully.",lessonCount:0}},config:x,sessionId:e.sessionId}),Z(!0),ge.current=!0,!0};(0,n.useEffect)(()=>{try{var e;const t=null===(e=A.state)||void 0===e?void 0:e.pendingAssignmentCompletion;if(t&&Pe(t))return;const s=localStorage.getItem("assignmentCompletionData");if(!s)return;const n=JSON.parse(s);Pe(n)}catch(t){console.error("Error opening assignment completion modal:",t)}},[A.state]);const Te=(()=>{const e=[],t=((e,t)=>{if(!e||"object"!==typeof e)return e;const s=new Map;for(const[i,r]of Object.entries(e)){if(!r||!r[0]||!r[0].ilpId)continue;const e=r[0].ilpId;s.has(e)||s.set(e,[]),s.get(e).push([i,r])}const n=new Map;(t||[]).forEach(e=>{const t=e.ilpId||e.id;t&&e.teacherReadinessAssignmentId&&n.set(t,e.teacherReadinessAssignmentId)});const a={...e};for(const[,i]of s){if(i.length<=1)continue;const e=i[0][1][0].ilpId,t=n.get(e);if(t&&i.some(e=>{let[s]=e;return s===t})){for(const[e]of i)e!==t&&delete a[e];continue}const s=[...i].sort((e,t)=>
1{var s,n;const a=(null===(s=e[1][0])||void 0===s?void 0:s.createdAt)||"",i=(null===(n=t[1][0])||void 0===n?void 0:n.createdAt)||"";return String(i).localeCompare(String(a))})[0][0];for(const[n]of i)n!==s&&delete a[n]}return a})(O,oe);return Object.keys(t).forEach(s=>{const n=t[s];if(0===n.length)return;const a=n[0],i=Ce(a),r=function(e){var t;const s={dueInfo:null!==(t=e.dueInfo)&&void 0!==t?t:null};return e.attemptsLine&&(s.attemptsLine=e.attemptsLine),e.dueLine&&(s.dueLine=e.dueLine),e.durationLine&&(s.durationLine=e.durationLine,null!=e.durationMins&&(s.durationMins=e.durationMins)),s}(N(a,j(a,oe),a.quizzId?ue[a.quizzId]:void 0,{planMetaLoaded:!he})),d=(e=>{var t;return null!==(t=e.metadata)&&void 0!==t&&t.goalType?e.metadata.goalType:e.goal_type?e.goal_type:"Concept Mastery"})(a),o=n.some(e=>e.studentAnswer&&e.studentAnswer.length>0),c=n.every(e=>e.studentAnswer&&e.studentAnswer.length>0),u=a.assignmentId||s,m=(0,l.LX)(a.subject)||("string"===typeof a.subject?a.subject:"General");let h=void 0!==U[u],p=U[u];if(!h&&J.length>0){const e=J.find(e=>e.assignmentId===u&&"completed"===e.status);e&&(h=!0,p={score:e.actualScore||0,totalScore:e.maximumScore||100,submittedAt:e.submittedAt||e.endDateTime||e.createdAt})}if(!h){if(n.some(e=>{var t,s,n,a,i;return(null===(t=e.metadata)||void 0===t?void 0:t.submittedAt)||"submitted"===(null===(s=e.metadata)||void 0===s?void 0:s.submissionStatus)||"completed"===(null===(n=e.metadata)||void 0===n?void 0:n.submissionStatus)||e.submittedAt||void 0!==(null===(a=e.metadata)||void 0===a?void 0:a.score)&&void 0!==(null===(i=e.metadata)||void 0===i?void 0:i.totalScore)})){const e=n.find(e=>{var t,s;return(null===(t=e.metadata)||void 0===t?void 0:t.submittedAt)||e.submittedAt||void 0!==(null===(s=e.metadata)||void 0===s?void 0:s.score)});var v,g,x,b;if(e)h=!0,p={score:(null===(v=e.metadata)||void 0===v?void 0:v.score)||0,totalScore:(null===(g=e.metadata)||void 0===g?void 0:g.totalScore)||n.length,submittedAt:(null===(x=e.metadata)||void 0===x?void 0:x.submittedAt)||e.submittedAt||(null===(b=e.metadata)||void 0===b?void 0:b.completedAt)}}}if(h){var f,y,w,S,k,I,C,A,_,L,P;const{score:t,totalScore:l}=Ae(p);return void e.push({id:s,ilpId:a.ilpId,assignmentId:u,type:i,goalType:d,status:"Completed",subject:a.subject,subjectName:m,lesson:a.lesson||a.topic||"Learning Plan Question",...r,questions:n,questionCount:n.length,allAnswered:!0,isSubmitted:!0,submissionResult:{...p,score:null!==(f=null!==(y=null===(w=p)||void 0===w?void 0:w.score)&&void 0!==y?y:null===(S=p)||void 0===S?void 0:S.actualScore)&&void 0!==f?f:t,totalScore:null!==(k=null!==(I=null===(C=p)||void 0===C?void 0:C.totalScore)&&void 0!==I?I:null===(A=p)||void 0===A?void 0:A.maximumScore)&&void 0!==k?k:l,submittedAt:(null===(_=p)||void 0===_?void 0:_.submittedAt)||(null===(L=p)||void 0===L?void 0:L.endDateTime)||(null===(P=p)||void 0===P?void 0:P.createdAt)}})}const T=c?"Ready to Submit":o?"In Progress":"Not Started";e.push({id:s,ilpId:a.ilpId,assignmentId:u,type:i,goalType:d,status:T,subject:a.subject,subjectName:m,lesson:a.lesson||a.topic||"Learning Plan Question",...r,questions:n,questionCount:n.length,allAnswered:c,isSubmitted:h,submissionResult:p||U[u]})}),e.sort((e,t)=>{var s,n,a,i,r,l;if(null!==(s=e.dueInfo)&&void 0!==s&&s.isOverdue&&(null===(n=t.dueInfo)||void 0===n||!n.isOverdue))return-1;if((null===(a=e.dueInfo)||void 0===a||!a.isOverdue)&&null!==(i=t.dueInfo)&&void 0!==i&&i.isOverdue)return 1;const d=null===(r=e.questions[0])||void 0===r?void 0:r.dueDate,o=null===(l=t.questions[0])||void 0===l?void 0:l.dueDate;return d&&o?new Date(d)-new Date(o):e.dueInfo?-1:t.dueInfo?1:0}),e.length,e})().filter(e=>!e.isSubmitted||!e.submissionResult||!b(e.submissionResult)),Re=$&&!ne,Ee=(oe||[]).filter(e=>{if(!k(e))return!1;if(!S(e))return!1;const t=e.ilpId||e.id;return!Te.some(e=>String(e.ilpId||"")===String(t)||String(e.id||"")===String(t))}),De=Re||le.length>0||Te.length>0||Ee.length>0,$e=Te.some(e=>"Readiness Check"===e.type),ze=e=>(0,x.jsx)(p.cJ,{title:"Check what you already know.",text:"Complete a readiness check to help build your personalized learning plan.",showIcon:!0,showTitleInPopup:!0,placement:"top-end",className:"flex w-full h-full min-w-0 flex-col",children:e});return(0,x.jsxs)("div",{className:"student-dash-card student-dash-card-pad",children:[(0,x.jsx)("div",{className:"flex items-center justify-between mb-4",children:(0,x.jsxs)("div",{children:[(0,x.jsxs)("div",{className:"flex items-center gap-2.5 mb-1",children:[(0,x.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-5 h-5 student-dash-chart1-text",children:[(0,x.jsx)("path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20"}),(0,x.jsx)("path",{d:"m9 9.5 2 2 4-4"})]}),(0,x.jsx)(v.O,{children:"Assigned by Your Teacher"})]}),(0,x.jsx)("p",{className:"student-dash-text-muted text-[13px] ml-7",children:"Complete assigned activities shared by your teacher."})]})}),M?(0,x.jsxs)("div",{className:"flex flex-col items-center justify-center py-12",children:[(0,x.jsx)("div",{className:"animate-spin rounded-full h-10 w-10 border-2 border-[var(--border)] border-t-[var(--chart-1)] mb-3"}),(0,x.jsx)("p",{className:"student-dash-text-muted text-sm",children:"Loading..."})]}):De?(0,x.jsxs)("div",{className:"space-y-6",children:[le.length>0?(0,x.jsxs)("div",{className:"space-y-3",children:[(0,x.jsx)("p",{className:"student-dash-text-muted text-[13px]",children:"Set up your learning plan for your goals"}),(0,x.jsx)("div",{className:"schedule-cards-scroll min-w-0",style:{maxHeight:"min(800px, 75vh)"},children:(0,x.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 min-w-0 p-0.5 pt-1 pb-2",children:le.map(e=>{const t=e.ilpId||e.id,s=Ne(e),n=Se(e),a=ke(e),l=`draft_generate_${t}`,d=`draft_readiness_${t}`,o=xe[l]||xe[d],c=(e=>{var t,s;const n=(null===e||void 0===e||null===(t=e.teacher)||void 0===t?void 0:t.userId)||(null===e||void 0===e||null===(s=e.teacher)||void 0===s?void 0:s.user_id
1)||"";return n&&n.length>0||!(null===e||void 0===e||!e.classId)})(e);return(0,x.jsx)("div",{className:`${g.h9} ${g.qU}`,children:(0,x.jsxs)("div",{className:g.uR,children:[(0,x.jsxs)("div",{className:`${g.gZ} mb-2`,children:[(0,x.jsx)("span",{className:g.Gu["Set up plan"],children:"Set up plan"}),c?(0,x.jsx)("span",{className:`${g.wI} student-dash-chart1-text border-[color-mix(in_srgb,var(--chart-1)_25%,transparent)] bg-[color-mix(in_srgb,var(--chart-1)_8%,var(--card))]`,children:"From your teacher"}):null]}),(0,x.jsx)("p",{className:"text-[13px] student-dash-text font-medium mb-1 min-w-0 break-words",children:s}),(0,x.jsx)("p",{className:"text-[12px] student-dash-text-sm mb-1 min-w-0 break-words",children:n}),a&&(0,x.jsxs)("p",{className:"student-dash-text-xs mb-2",children:["Target: ",a]}),(0,x.jsxs)("div",{className:"flex flex-col gap-1.5 mt-auto",children:[R?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)("button",{type:"button",onClick:()=>Ie(e),disabled:!!o,className:"student-dash-btn student-dash-btn-primary w-full rounded-[8px] px-3 py-2 h-9 text-[12px] flex items-center justify-center gap-2 disabled:opacity-60 shadow-sm hover:shadow-md",children:[(0,x.jsx)(i.vd0,{className:"h-3 w-3"}),xe[l]?"Generating...":"Generate my learning plan"]}),(0,x.jsx)("button",{type:"button",onClick:()=>Ie(e,{generateWithAi:!0}),disabled:!!o,className:`${g.jT} rounded-[8px] h-8 min-h-8 px-3`,children:xe[l]?"Generating...":"Generate with AI"})]}):null,(0,x.jsxs)("button",{type:"button",onClick:()=>(async e=>{const t=(null===e||void 0===e?void 0:e.ilpId)||(null===e||void 0===e?void 0:e.id);if(!t)return;const s=`draft_readiness_${t}`;be(e=>({...e,[s]:!0}));try{const s=await r.default.post("/student/onboarding/readiness-check/generate",{ilpId:t});C("/student/workspace",{state:{quizId:s.data.quizId,mode:"quiz",subject:Ne(e),lesson:"Readiness Check",ilpId:t,isReadinessCheck:!0}})}catch(i){var n,a;console.error("Readiness check generate failed:",i),alert((null===(n=i.response)||void 0===n||null===(a=n.data)||void 0===a?void 0:a.detail)||"Failed to start readiness check.")}finally{be(e=>{const t={...e};return delete t[s],t})}})(e),disabled:!!o,className:R?`${g.jT} rounded-[8px] h-8 min-h-8 px-3`:`${g.JI} rounded-[8px] h-9 min-h-9 px-3`,children:[(0,x.jsx)(i.RBv,{className:"h-3 w-3 shrink-0"}),xe[d]?"Starting...":"Start readiness check"]})]})]})},t)})})})]}):null,Re&&ze((0,x.jsxs)("div",{className:`h-full min-w-0 ${g.h9} ${g.N8}`,children:[(0,x.jsx)(g.pM,{}),(0,x.jsxs)("div",{className:g.uR,children:[(0,x.jsxs)("div",{className:g.gZ,children:[(0,x.jsx)("span",{className:g.Gu["Readiness Check"],children:"Readiness Check"}),(0,x.jsx)("span",{className:"text-[13px] student-dash-text font-medium max-w-full",children:"Baseline"}),(0,x.jsx)("span",{className:g.$n,children:"Not Started"})]}),(0,x.jsx)("div",{className:"mb-2 space-y-1 text-[11px] student-dash-text-sm",children:(0,x.jsxs)("p",{children:[(0,x.jsx)("span",{className:"font-medium student-dash-text-muted",children:"Attempts:"})," 1 attempt"]})}),ie?(0,x.jsx)("div",{className:"student-dash-text-muted text-sm",children:"Checking status..."}):(0,x.jsx)("button",{type:"button",onClick:()=>C("/student/onboarding/baseline-check",{replace:!0}),className:g.JI,children:"Start"})]})]})),($e||Re)&&(0,x.jsx)("p",{className:"student-dash-text-muted text-[13px]",children:"Check what you already know."}),Ee.length>0?(0,x.jsxs)("div",{className:"space-y-3",children:[(0,x.jsx)("p",{className:"student-dash-text-muted text-[13px]",children:"Learning plans assigned by your teacher"}),(0,x.jsx)("div",{className:"schedule-cards-scroll min-w-0",style:{maxHeight:"min(800px, 75vh)"},children:(0,x.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 min-w-0 p-0.5 pt-1 pb-2",children:Ee.map(e=>{const t=e.ilpId||e.id,s=Ne(e),n=Se(e),a=ke(e);return(0,x.jsx)("div",{className:`${g.h9} ${g.qU}`,children:(0,x.jsxs)("div",{className:g.uR,children:[(0,x.jsxs)("div",{className:`${g.gZ} mb-2`,children:[(0,x.jsx)("span",{className:g.Gu["Learning Plan"]||g.Gu["Set up plan"],children:"Learning Plan"}),(0,x.jsx)("span",{className:`${g.wI} student-dash-chart1-text border-[color-mix(in_srgb,var(--chart-1)_25%,transparent)] bg-[
1color-mix(in_srgb,var(--chart-1)_8%,var(--card))]`,children:"From your teacher"})]}),(0,x.jsx)("p",{className:"text-[13px] student-dash-text font-medium mb-1 min-w-0 break-words",children:s}),(0,x.jsx)("p",{className:"text-[12px] student-dash-text-sm mb-1 min-w-0 break-words",children:n}),a?(0,x.jsxs)("p",{className:"student-dash-text-xs mb-2",children:["Target: ",a]}):null,(0,x.jsxs)("button",{type:"button",onClick:()=>C("/student/my-learning-plan",{state:{focusIlpId:e.ilpId||void 0,focusPlanMetaId:e.id}}),className:`${g.JI} rounded-[8px] h-9 min-h-9 px-3 mt-auto`,children:[(0,x.jsx)(i.vd0,{className:"h-3 w-3 shrink-0"}),"Open My Learning Plan"]})]})},`published-plan-${t}`)})})})]}):null,(0,x.jsx)("div",{className:"schedule-cards-scroll min-w-0",style:{maxHeight:"min(800px, 75vh)"},children:(0,x.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 items-stretch min-w-0 p-0.5 pt-1 pb-2",children:Te.map(e=>{var t,s,a;const r=g.Gu[e.type]||f,l=Boolean(null===(t=e.dueInfo)||void 0===t?void 0:t.isOverdue)&&!e.isSubmitted,d=Boolean(e.isSubmitted&&e.submissionResult);let o=e.status;l&&(o="Overdue");const c=(0,g.TF)(e.status,{isOverdue:l,submittedDone:d}),m="Readiness Check"===e.type&&"Not Started"===e.status?g.N8:g.qU,h=(0,x.jsxs)("div",{className:`${g.h9} ${m}`,children:["Readiness Check"===e.type&&"Not Started"===e.status&&(0,x.jsx)(g.pM,{}),(0,x.jsxs)("div",{className:g.uR,children:[(0,x.jsxs)("div",{className:g.gZ,children:[(0,x.jsx)("span",{className:r,children:e.type}),(0,x.jsx)("span",{className:c,children:o})]}),e.subjectName?(0,x.jsx)("p",{className:"text-[13px] student-dash-text font-medium mb-2 min-h-[1.25rem] leading-snug break-words",children:e.subjectName}):(0,x.jsx)("div",{className:"mb-2 min-h-[1.25rem]","aria-hidden":!0}),!(e.isSubmitted&&e.submissionResult)&&(e.attemptsLine||e.dueLine||e.durationLine||"Practice"===e.type&&e.questionCount>0)&&(0,x.jsxs)("div",{className:"mb-2 flex-1 min-h-[2.5rem] space-y-1 text-[11px] student-dash-text-sm",children:["Practice"===e.type&&e.questionCount>0?(0,x.jsxs)("p",{children:[(0,x.jsx)("span",{className:"font-medium student-dash-text-muted",children:"Questions:"})," ",e.questionCount]}):null,e.attemptsLine?(0,x.jsxs)("p",{children:[(0,x.jsx)("span",{className:"font-medium student-dash-text-muted",children:"Attempts:"})," ",e.attemptsLine]}):null,e.dueLine?(0,x.jsxs)("p",{children:[(0,x.jsx)("span",{className:"font-medium student-dash-text-muted",children:"Due:"})," ",e.dueLine]}):null,e.durationLine?(0,x.jsxs)("p",{children:[(0,x.jsx)("span",{className:"font-medium student-dash-text-muted",children:"Duration:"})," ",e.durationLine]}):null]}),l&&(0,x.jsx)("div",{className:"mb-2 p-1.5 rounded-lg border border-[color-mix(in_srgb,var(--destructive)_20%,transparent)] bg-[color-mix(in_srgb,var(--destructive)_8%,var(--card))]",children:(0,x.jsx)("p",{className:"text-[10px] text-[var(--destructive)]",children:"Try to complete this soon to stay on track."})}),e.isSubmitted&&e.submissionResult?(0,x.jsxs)("div",{className:"mt-auto pt-2 rounded-lg p-4 text-center border-2 border-[color-mix(in_srgb,var(--chart-4)_35%,transparent)] bg-[color-mix(in_srgb,var(--chart-4)_10%,var(--card))]",children:[(0,x.jsxs)("div",{className:"flex items-center justify-center gap-2 mb-2",children:[(0,x.jsx)(i.A7C,{className:"text-[var(--chart-4)] text-xl"}),(0,x.jsx)("span",{className:"text-sm font-semibold text-[var(--chart-4)]",children:"Completed"})]}),(0,x.jsxs)("p",{className:"text-lg font-bold text-[var(--foreground)]",children:["Score: ",Ae(e.submissionResult).score,"/",Ae(e.submissionResult).totalScore]}),(0,x.jsxs)("p",{className:"text-xs text-[var(--chart-4)] mt-1",children:["Submitted on"," ",new Date(e.submissionResult.submittedAt||e.submissionResult.endDateTime||Date.now()).toLocaleDateString("en-GB",{day:"2-digit",month:"2-digit",year:"numeric"})]})]}):(0,x.jsx)("div",{className:"mt-auto pt-2 flex flex-col gap-1.5",children:e.allAnswered&&!e.isSubmitted&&e.assignmentId?(0,x.jsx)("button",{type:"button",onClick:()=>(async e=>{var t,s;const n=e.assignmentId||(null===(t=e.questions[0])||void 0===t?void 0:t.assignmentId);e.ilpId||null===(s=e.questions[0])||void 0===s||s.ilpId;
1try{const t=localStorage.getItem("assignmentCompletionData");if(t){const s=JSON.parse(t);if(Pe(s,e))return}}catch(i){console.error("Error checking completion data:",i)}if(!n)return void(0,u.t)("Missing assignment information. Cannot submit.",{variant:"error"});if(!e.questions.every(e=>e.studentAnswer&&e.studentAnswer.length>0))return void(0,u.t)("Please answer all questions before submitting.",{variant:"error"});const a=e.lesson||e.subjectName||"this assignment";ee({card:e,titleHint:a})})(e),disabled:G[e.assignmentId],className:g.JI,children:G[e.assignmentId]?"Submitting...":(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(i.Cer,{})," Submit Assignment"]})}):(0,x.jsx)("button",{type:"button",onClick:()=>function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const s=`question_${e.id}`;if(te[s])return;se(e=>({...e,[s]:!0}));const n=Ce(e),a="Readiness Check"===n,i=t&&"object"===typeof t?t.numQuestions:t,r=t&&"object"===typeof t?t.durationMins:null;if(Boolean(e.assignmentId)&&!a&&"Practice"===n&&!e.quizzId){const t=null!=i&&Number(i)>0?Number(i):5;return void C("/student/workspace",{state:{questionId:e.id,assignmentId:e.assignmentId,practiceSessionId:e.practiceSessionId||void 0,subject:e.subject,lesson:e.lesson||e.topic||e.assignmentTitle,mode:"assignment",numQuestions:t,duration:null!=r&&Number(r)>0?Number(r):void 0,isLearningPlan:!1,isReadinessCheck:!1}})}const l=e.quizzId||"Quiz"===n?"quiz":"practice",d=i||("practice"===l?5:null);C("/student/workspace",{state:{questionId:e.id,quizzId:e.quizzId,ilpId:e.ilpId,assignmentId:e.assignmentId,subject:e.subject,lesson:e.lesson||e.topic,mode:l,numQuestions:d,isLearningPlan:!0,isReadinessCheck:a}})}(e.questions[0],{numQuestions:e.questionCount,durationMins:e.durationMins}),disabled:te[`question_${null===(s=e.questions[0])||void 0===s?void 0:s.id}`],className:g.JI,children:te[`question_${null===(a=e.questions[0])||void 0===a?void 0:a.id}`]?"Loading...":"In Progress"===e.status||"Ready to Submit"===e.status?"Resume":"Start"})})]})]});return"Readiness Check"===e.type?(0,x.jsx)(n.Fragment,{children:ze(h)},e.id):(0,x.jsx)("div",{className:"h-full min-w-0",children:h},e.id)})})})]}):(0,x.jsxs)("div",{className:"text-center py-8 max-w-lg mx-auto px-4",children:[(0,x.jsx)("p",{className:"student-dash-text font-medium mb-2",children:"No activities assigned yet."}),(0,x.jsx)("p",{className:"student-dash-text-muted text-sm leading-relaxed",children:"Until new activities are assigned, you can explore your Learning Plan, start a tutoring session, or schedule learning time with your tutor."})]}),V&&(0,x.jsx)(o.A,{isOpen:H,onClose:Le,onGoToDashboard:()=>{Le(),C("/student/dashboard",{replace:!0})},sessionId:V.sessionId,mode:"assignment",config:V.config,completionData:V.completionData}),(0,x.jsx)(c.A,{open:Boolean(K),title:"Submit assignment",message:K?`Submit "${K.titleHint}" for grading? You will not be able to change your answers after submitting.`:"",confirmText:"Submit",cancelText:"Cancel",zIndexClass:"z-[12000]",onCancel:()=>ee(null),onConfirm:()=>{const e=null===K||void 0===K?void 0:K.card;ee(null),e&&(async e=>{var t,s;const n=e.assignmentId||(null===(t=e.questions[0])||void 0===t?void 0:t.assignmentId),a=e.ilpId||(null===(s=e.questions[0])||void 0===s?void 0:s.ilpId)||"",i=e.questions.map(e=>{var t;const s=e.studentAnswer,n=e.answerOptions||[],a=1===n.length&&"opt_correct"===(null===(t=n[0])||void 0===t?void 0:t.id);let i=null,r=null;var l,d,o;return s&&s.length>0&&(a?(r=e.textAnswer||e.answerText||(null===(l=e.metadata)||void 0===l?void 0:l.textAnswer)||(null===(d=e.metadata)||void 0===d?void 0:d.answerText),!r&&s[0]&&("object"===typeof s[0]&&s[0].text?r=s[0].text:"object"===typeof s[0]&&s[0].answerText&&(r=s[0].answerText)),r||"opt_correct"!==(null===(o=s[0])||void 0===o?void 0:o.id)&&"opt_correct"!==s[0]||(r="[Text answer submitted - requires retrieval]"),i=r):(i=s.map(e=>e.id||e),1===i.length&&(i=i[0]))),{questionId:e.id,answer:i,answerText:a?r:void 0}});W(e=>({...e,[n]:!0}));try{var l,d;const t=await(0,r.submitAssignmentQuiz)(a,n,i);let s=null;try{const e=await r.default.get("/learningplans/me");s=(Array.isArray(e.data)?e.data:[]).filter(e=>e&&(e.ilpId===a||e.ilpId===(null===t||void 0===t?void 0:t.ilpId))).length}catch(m){console.warn("Could not load learning plans for ILP summary:",m)}const o=!!t.readiness_check;let c="";c=o?s>0?`Your personalized learning plan is ready with ${s} lesson${1===s?"":"s"}. Open My Learning Plan to start.`:"Your readiness check was submitted. If lessons do not appear under My Learning Plan within a few minutes, tr
1y refreshing the page or contact your teacher.":"Your assignment was submitted successfully.";const u={...U,[n]:t};Q(u);try{localStorage.setItem("assignmentSubmissionResults",JSON.stringify(u))}catch(h){console.error("Error persisting submission results:",h)}const p=void 0!==t.actualScore?t.actualScore:t.score||0,v=void 0!==t.maximumScore?t.maximumScore:t.totalScore||e.questions.length,g=t.submittedAt||t.endDateTime||(new Date).toISOString(),x=t.startDateTime||g,b=t.endDateTime||g,f=t.duration||e.durationLine||"20 min",y=e.questions.length;let j=0;const w=t.studentAnswers||[];w.forEach(e=>{var t;(null!==(t=null===e||void 0===e?void 0:e.score)&&void 0!==t?t:0)>0&&(j+=1)}),0===j&&v>0&&p>0&&(j=Math.max(1,Math.round(p/v*y)));const N={session:{id:t.id||t.sessionId||null,startDateTime:x,endDateTime:b,duration:f,timeSpent:t.timeSpent||"0"},score:{totalScore:p,maxScore:v,percentage:v>0?Math.round(p/v*100):0,correctAnswers:j,totalQuestions:y,answeredQuestions:w.length||y,totalTimeSpent:t.timeSpent||"0",actualTimeSpent:t.timeSpent||"0"},ilpSummary:{readinessCheck:o,lessonCount:s,message:c,ilpId:a}},S={subject:e.subject||e.subjectName,lesson:e.lesson,type:e.type,assignmentType:e.type,mode:"assignment",assignmentId:n,isLearningPlan:!0,duration:f,sessionCompletionMode:_e(e),quizzId:null===(l=e.questions)||void 0===l||null===(d=l[0])||void 0===d?void 0:d.quizzId};X({completionData:N,config:S,sessionId:t.id||t.sessionId||null}),Z(!0),await je(),await we()}catch(h){var o,c;console.error(" [FRONTEND] Error submitting assignment:",h),(0,u.t)((null===(o=h.response)||void 0===o||null===(c=o.data)||void 0===c?void 0:c.detail)||"Failed to submit assignment. Please try again.",{variant:"error"})}finally{W(e=>({...e,[n]:!1}))}})(e)}})]})}},25877(e,t,s){s.d(t,{A:()=>q});var n=s(9950),a=s(41413),i=s(22875),r=s(92906),l=s(18555),d=s(81986),o=s(32799),c=s(90145),u=s(46504),m=s(17108);const h="pending_setup",p="onboarding_draft",v="parent_explore",g="recommended_path",x="lesson_recommended",b="lesson_reinforce",f="Explore Your Learning Plan";function y(e){return e?"string"===typeof e?e:e.name||e.displayName||"Unknown Subject":"Unknown Subject"}function j(e){return String(e||"").trim().toLowerCase()}function w(e){var t,s;if(!e||"object"!==typeof e)return!1;const n=(null===(t=e.teacher)||void 0===t?void 0:t.userId)||(null===(s=e.teacher)||void 0===s?void 0:s.user_id)||"";return!(n&&n.length>0||e.classId)}function N(e){const t=null===e||void 0===e?void 0:e.subject,s=j("object"===typeof t?null===t||void 0===t?void 0:t.id:""),n=j("string"===typeof t?t:null===t||void 0===t?void 0:t.name);return s||n||j((null===e||void 0===e?void 0:e.ilpId)||(null===e||void 0===e?void 0:e.id))}function S(e){return(e||[]).some(e=>{const t=(0,m.mb)(e);return"in_progress"===t||"completed"===t})}function k(e){return"active"===String((null===e||void 0===e?void 0:e.status)||"").toLowerCase()}function I(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{lessonsByIlpId:s,profile:n={},planStatuses:a={},readinessCheckStatuses:i={},recommendedModes:r={}}=t;if(!w(e))return null;const l=(null===e||void 0===e?void 0:e.ilpId)||(null===e||void 0===e?void 0:e.id);if(!l)return null;const d=function(e,t){const s=(null===e||void 0===e?void 0:e.ilpId)||(null===e||void 0===e?void 0:e.id);return s&&t?"function"===typeof t.get?t.get(s)||[]:t[s]||[]:[]}(e,s),o=d.length>0,u=a[l]||"Not Yet Started",h=Boolean(i[l]);return Boolean(r[l])||(0,c.sd)(e,n)?{kind:g,ilpId:l,subjectName:y(e.subject),meta:e,badge:"Recommended Learning Path",planStatus:"In Progress"===u?"In Progress":"Ready to Start",description:null}:function(e){const t=String((null===e||void 0===e?void 0:e.status)||"draft").toLowerCase();return!t||"draft"===t||"new"===t}(e)&&!(0,c.UN)(e)?{kind:p,ilpId:l,subjectName:y(e.subject),meta:e,badge:"Readiness Check",planStatus:u,hasReadinessCheck:h,description:null}:k(e)&&o&&function(e){return Boolean(String((null===e||void 0===e?void 0:e.createdByParentUserId)||"").trim())}(e)&&!(0,c.jx)(n,l)&&!S(d)?{kind:v,ilpId:l,subjectName:y(e.subject),meta:e,badge:"Learning Plan",planStatus:"Ready to Explore",description:"Your parent added a learning plan for this subject. Explore it to see your lessons.",primaryCta:f}:k(e)&&o?function(e,t){const s=(null===e||void 0===e?void 0:e.ilpId)||(null===e||void 0===e?void 0:e.id);if(!s)return null;const n=Array.isArray(t)?t:[];if(0===n.length)return null;const a=(0,m.rt)(n);if(!a)return null;const i=n.find(e=>String(null===e||void 0===e?void 0:e.id)===String(a));if(!i)return null;const r=(0,m.mb)(i),l=(0,m.rO)(i),d=((0,m.yR)(i),(0,m.Tj)(i)),o=i.lesson||i.lessonTitle||i.topic||"Recommended lesson";if("in_progress"===r)return{kind:b,ilpId:s,subjectName:y(e.subject),meta:e,lesson:i,lessonTitle:o,badge:"Continue Learning",planStatus:"In Progress",description:"A little more practice can help strengthen your understanding.",primaryCta:m.yM,secondaryCtas:[...l.showPractice?[m.NC]:[],...l.showNotes?[d]:[]].filter(
1Boolean),showQuiz:!1,showPractice:Boolean(l.showPractice),showNotes:Boolean(l.showNotes)};const c=S(n);return{kind:x,ilpId:s,subjectName:y(e.subject),meta:e,lesson:i,lessonTitle:o,badge:"Recommended",planStatus:"Ready to Start",description:c?"Great progress! Here's your next recommended learning activity.":"You're ready to begin learning. Start with this recommended first lesson.",primaryCta:m.fM,secondaryCtas:[...l.showQuiz?[m.TB]:[],...l.showNotes?[d]:[]].filter(Boolean),showQuiz:Boolean(l.showQuiz),showPractice:!1,showNotes:Boolean(l.showNotes)}}(e,d):null}function C(){let{metas:e=[],lessonsByIlpId:t,pendingSubjects:s=[],profile:n={},planStatuses:a={},readinessCheckStatuses:i={},recommendedModes:r={}}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const l=[],d=new Set,o=(Array.isArray(e)?e:[]).filter(w);return o.forEach(e=>{const s=(null===e||void 0===e?void 0:e.ilpId)||(null===e||void 0===e?void 0:e.id);if(!(Boolean(null===r||void 0===r?void 0:r[s])||(0,c.sd)(e,n)))return;const o=I(e,{lessonsByIlpId:t,profile:n,planStatuses:a,readinessCheckStatuses:i,recommendedModes:r});if(!o)return;const u=N(e)||s;d.has(u)||(d.add(u),l.push(o))}),o.forEach(e=>{const s=(null===e||void 0===e?void 0:e.ilpId)||(null===e||void 0===e?void 0:e.id);if(Boolean(null===r||void 0===r?void 0:r[s])||(0,c.sd)(e,n))return;const o=I(e,{lessonsByIlpId:t,profile:n,planStatuses:a,readinessCheckStatuses:i,recommendedModes:r});if(!o)return;const u=N(e)||s;d.has(u)||(d.add(u),l.push(o))}),(Array.isArray(s)?s:[]).forEach(e=>{const t=(null===e||void 0===e?void 0:e.key)||j(null===e||void 0===e?void 0:e.name);
1t&&!d.has(t)&&(d.add(t),l.push({kind:h,ilpId:null,subjectName:(null===e||void 0===e?void 0:e.name)||"Subject",pendingSubject:e,badge:"Readiness Check",planStatus:"Not Yet Started",description:"Help me understand your current level so I can design the right plan for you."}))}),l}var A=s(27344),_=s(73526),L=s(44652),P=s(60226),T=s(71955),R=s(76060),E=s(25673),D=s(75055),$=s(55969),z=s(44414);const q=function(){const e=(0,a.Zp)(),t=(0,a.zy)(),{student:s,userProfile:p,refreshUserProfile:y}=(0,r.Fj)(),[j,w]=(0,n.useState)([]),[N,S]=(0,n.useState)([]),[k,I]=(0,n.useState)({}),[q,M]=(0,n.useState)(!0),[F,O]=(0,n.useState)({}),[B,G]=(0,n.useState)({}),[W,U]=(0,n.useState)({}),[Q,J]=(0,n.useState)(null),[Y,H]=(0,n.useState)(!1),[Z,V]=(0,n.useState)([]),[X,K]=(0,n.useState)(""),[ee,te]=(0,n.useState)(null),[se,ne]=(0,n.useState)(!1),ae=s||p||{},ie=(0,o.pT)(ae),re=e=>"string"===typeof e?e:(null===e||void 0===e?void 0:e.name)||(null===e||void 0===e?void 0:e.displayName)||"General",le=e=>{const t="string"===typeof e?e:(null===e||void 0===e?void 0:e.id)||(null===e||void 0===e?void 0:e.name)||(null===e||void 0===e?void 0:e.displayName)||"";return String(t).trim().toLowerCase().replace(/[\s-]+/g,"_")};(0,n.useEffect)(()=>{if(ie)return M(!1),w([]),S([]),V([]),void H(!1);(async()=>{try{M(!0),H(!1);let n=null,a=[];if(null!==ae&&void 0!==ae&&ae.userId)if(Array.isArray(ae.userId)){const e=ae.userId.filter(e=>e&&e.length>3);n=e.length>0?e.sort((e,t)=>t.length-e.length)[0]:ae.userId[0],a=ae.userId}else n=ae.userId,a=[ae.userId];if((!n||n.length<3)&&(n=null===ae||void 0===ae?void 0:ae.id,n&&!a.includes(n)&&a.push(n)),n&&n.length>=3)try{const s=await l.default.get(`/learningplanmeta/student/${n}`);let i=Array.isArray(s.data)?s.data:[];if(0===i.length&&a.length>1)for(const t of a)if(t&&t.length>=3&&t!==n)try{const e=await l.default.get(`/learningplanmeta/student/${t}`),s=Array.isArray(e.data)?e.data:[];if(s.length>0){i=[...i,...s];break}}catch(e){}let r=new Map;try{const e=await l.default.get("/learningplans/me");(Array.isArray(e.data)?e.data:[]).forEach(e=>{const t=(null===e||void 0===e?void 0:e.ilpId)||(null===e||void 0===e?void 0:e.ilp_id);if(!t)return;const s=r.get(t)||[];s.push(e),r.set(t,s)})}catch(t){console.warn("[NextLearningActions] Could not load /learningplans/me:",t),r=new Map}const d=e=>{var t,s;const n=(null===(t=e.teacher)||void 0===t?void 0:t.userId)||(null===(s=e.teacher)||void 0===s?void 0:s.user_id)||"";return!(n&&n.length>0||e.classId)},o=(null===ae||void 0===ae?void 0:ae.profile)||{},m=i.filter(e=>!!d(e)&&(0,c.sd)(e,o)),h={};m.forEach(e=>{h[e.ilpId||e.id]=!0});const p=i.filter(e=>{if(!d(e))return!1;if((0,c.UN)(e))return!1;const t=e.status||"draft";return!t||"draft"===t||"new"===t}),v=i.filter(d),g=v.filter(e=>{if((0,c.UN)(e)&&(0,c.sd)(e,o))return!1;if("active"!==String(e.status||"").toLowerCase())return!1;const t=e.ilpId||e.id;return(r.get(t)||[]).length>0}),x=new Set;i.forEach(e=>{const t=null===e||void 0===e?void 0:e.subject,s=le(null===t||void 0===t?void 0:t.id),n=le("string"===typeof t?t:null===t||void 0===t?void 0:t.name);s&&x.add(s),n&&x.add(n)});const b=Array.isArray(o.subjects)?o.subjects:[],f=new Set,y=[];b.forEach(e=>{const t=String("string"===typeof e?e:(null===e||void 0===e?void 0:e.name)||(null===e||void 0===e?void 0:e.displayName)||"").trim();if(!t)return;const s=le("string"===typeof e?"":null===e||void 0===e?void 0:e.id),n=le(t),a=s||n;a&&!f.has(a)&&(s&&x.has(s)||n&&x.has(n)||(f.add(a),y.push({key:a,name:t,subject:e})))}),V(y);const j=[...m,...p,...g],N={},k={},A=j.map(async e=>{const t=e.ilpId||e.id,s=Boolean(h[t]);if(t)try{if(s){let s=!1;try{let n=localStorage.getItem(`readinessCheckState_${t}`);if(!n&&e.id&&e.id!==t&&(n=localStorage.getItem(`readinessCheckState_${e.id}`)),n)s=!0;else{const e=await l.default.get(`/student/onboarding/readiness-check/status/${t}`);(0,u.A)(e.data)&&(s=!0)}}catch(a){console.warn("[NextLearningActions] recommended readiness status:",t,a)}return{ilpId:t,status:s?"In Progress":"Ready to Start",hasReadinessCheck:s}}const o=(r.get(t)||[]).length>0,c=e.status||"draft";let m=!1,h=!1;if(!o){if(e.teacherReadinessAssignmentId)try{const t=await l.default.get("/quiz/recent-completed?limit=200"),s=Array.isArray(t.data)?t.data:[],n=e.teacherReadinessAssignmentId;s.some(e=>e.assignmentId===n&&"completed"===String(e.status||"").toLowerCase())&&(h=!0)}catch(i){console.warn("[NextLearningActions] recent-completed for teacher readiness:",i)}try{var n;const e=await l.default.get(`/student/onboarding/readiness-check/status/${t}`),s=(null===(n=e.data)||void 0===n?void 0:n.hasReadinessCheckCompleted)||!1;h=h||!!s,(0,u.A)(e.data)&&(m=!0)}catch(a){console.warn("[NextLearningActions] Error checking readiness check 
1status (ilpId):",t,a)}if(h)m=!1;else try{let s=localStorage.getItem(`readinessCheckState_${t}`);!s&&e.id&&e.id!==t&&(s=localStorage.getItem(`readinessCheckState_${e.id}`)),s&&(m=!0)}catch(d){console.error("Error checking localStorage:",d)}}return"active"===c&&o?{ilpId:t,status:"Completed",hasReadinessCheck:!1}:o?{ilpId:t,status:"In Progress",hasReadinessCheck:!1}:h?{ilpId:t,status:"Baseline complete",hasReadinessCheck:!1}:m?{ilpId:t,status:"Readiness in progress",hasReadinessCheck:!0}:{ilpId:t,status:"Not Yet Started",hasReadinessCheck:!1}}catch(o){return{ilpId:t,status:"Not Yet Started",hasReadinessCheck:!1}}return null});(await Promise.all(A)).forEach(e=>{e&&e.ilpId&&(N[e.ilpId]=e.status,k[e.ilpId]=e.hasReadinessCheck)}),O(N),G(k),I(h);const _=C({metas:v,lessonsByIlpId:r,pendingSubjects:y,profile:o,planStatuses:N,readinessCheckStatuses:k,recommendedModes:h});S(_),w([...m,...p]),H(0===_.length&&v.length>0&&0===y.length)}catch(s){console.error("\u274c [NextLearningActions] Error fetching learning plan metas:",s),w([]),S([]),V([])}else console.warn("\u26a0\ufe0f [NextLearningActions] No studentId found yet, skipping fetch. userData:",ae)}catch(n){console.error("\u274c [NextLearningActions] Error loading data:",n),w([]),S([]),V([])}finally{M(!1)}})()},[s,p,ie,t.pathname]);const de=async t=>{const s=(null===t||void 0===t?void 0:t.ilpId)||(null===t||void 0===t?void 0:t.id),n=`${s}_readiness`;if(!W[n])if(t&&s)try{U(e=>({...e,[n]:!0}));const a=(await l.default.post("/student/onboarding/readiness-check/generate",{ilpId:s})).data.quizId,i=re(t.subject);a?e("/student/workspace",{state:{quizId:a,mode:"quiz",subject:i,lesson:"Readiness Check",ilpId:s,isReadinessCheck:!0}}):(alert("Failed to generate readiness check. Please try again."),U(e=>{const t={...e};return delete t[n],t}))}catch(r){var a,i;console.error("Error generating readiness check:",r),alert((null===(a=r.response)||void 0===a||null===(i=a.data)||void 0===i?void 0:i.detail)||"Failed to generate readiness check. Please try again."),U(e=>{const t={...e};return delete t[n],t})}else alert("Learning plan not found. Please try again.")},oe=async function(t){let s=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const a=(null===t||void 0===t?void 0:t.ilpId)||(null===t||void 0===t?void 0:t.id),i=`${a}_generate`,r=Boolean(n.generateWithAi);if(s){if(!W[i])if(t&&a)try{var d;U(e=>({...e,[i]:!0})),J(null);const s=await l.default.post("/student/onboarding/learning-plan/generate-direct",{ilpId:a,storeLessons:!1,generateWithAi:r});e("/student/onboarding/learning-plan-review",{state:{ilpId:a,planData:s.data,subject:t.subject,grade:t.grade||(null===ae||void 0===ae||null===(d=ae.profile)||void 0===d?void 0:d.grade)||(null===ae||void 0===ae?void 0:ae.grade)}})}catch(o){console.error("Error generating learning plan:",o),alert((0,$.p)(o,"Failed to generate learning plan. Please try again.")),U(e=>{const t={...e};return delete t[i],t})}else alert("Learning plan not found. Please try again.")}else J({ilpId:a,action:"generate",meta:t,generateWithAi:r})},ce=async e=>{var t,s,n,a,i,r,o,c,u;const m=(()=>{let e=null===ae||void 0===ae?void 0:ae.userId;if(Array.isArray(e)){const t=(e||[]).filter(e=>e&&String(e).length>3);e=t.length?t.sort((e,t)=>t.length-e.length)[0]:e[0]}return(!e||String(e).length<3)&&(e=null===ae||void 0===ae?void 0:ae.id),e})();if(!m)throw new Error("Could not determine student. Please log in again.");const h=null===e||void 0===e?void 0:e.subject,p=(null===e||void 0===e?void 0:e.name)||re(h),v=h&&"object"===typeof h?{id:h.id||le(p),name:h.name||h.displayName||p,stateStandard:h.stateStandard||(null===ae||void 0===ae||null===(t=ae.profile)||void 0===t?void 0:t.stateStandard)||"ccss"}:{id:le(p),name:p,stateStandard:(null===ae||void 0===ae||null===(s=ae.profile)||void 0===s?void 0:s.stateStandard)||"ccss"},g=new Set([le(v.id),le(v.name)].filter(Boolean));let x=null;try{const e=await l.default.get("/studentgoals/me");x=(Array.isArray(e.data)?e.data:[]).find(e=>{const t=null===e||void 0===e?void 0:e.subject,s=[];return"object"===typeof t&&t?(t.id&&s.push(le(t.id)),t.name&&s.push(le(t.name))):"string"===typeof t&&s.push(le(t)),s.some(e=>e&&g.has(e))})||null}catch(L){console.warn("Could not fetch student goals for pending subject draft:",L)}const b=(null===(n=x)||void 0===n?void 0:n.type)||("object"===typeof h?null===h||void 0===h?void 0:h.learningGoal:null)||"",{goalType:f,planPurpose:y,isExamPrep:j}=(0,E.Lo)(b),w=("object"===typeof h&&null!==h&&void 0!==h&&h.examName?String(h.examName).trim():"")||(null!==(a=x)&&void 0!==a&&a.examName?String(x.examName).trim():""),N=("object"===typeof h&&null!==h&&void 0!==h&&h.examDate?String(h.examDate).trim():"")||"",S="object"===typeof h&&null!==h&&void 0!==h&&h.targetMasteryD
1ate?String(h.targetMasteryDate).trim():"";let k=(null===(i=x)||void 0===i?void 0:i.dueDate)||(null===(r=x)||void 0===r?void 0:r.examDate)||null;if(!k){const e=(0,D.Of)(N||S)||(()=>{const e=new Date;return e.setDate(e.getDate()+90),e.toISOString().slice(0,10)})();k=d.A.fromLocalDateTimeString(`${e}T00:00:00`)}const I=(null===ae||void 0===ae||null===(o=ae.profile)||void 0===o?void 0:o.grade)||(null===ae||void 0===ae?void 0:ae.grade)||"",C={title:j&&w?`${v.name} - ${w}`:`${v.name} Goal`,type:f,dueDate:k,subject:v,status:"Started",description:j?`Exam preparation goal for ${w||v.name}`:"Goal created from Next Learning Actions",completionPercentage:0};if(j&&(C.examDate=k,w&&(C.examName=w)),null!==(c=x)&&void 0!==c&&c.id)try{await l.default.put(`/studentgoals/${x.id}`,{...x,...C,id:x.id})}catch(P){console.warn("Could not update existing goal; creating new goal:",P),await l.default.post("/studentgoals/",C)}else await l.default.post("/studentgoals/",C);const A={ilpId:`ilp_${Date.now()}_${v.id}_${Math.random().toString(36).substr(2,9)}`,student:{userId:Array.isArray(null===ae||void 0===ae?void 0:ae.userId)?ae.userId:[m],role:"student"},teacher:{userId:"",role:""},grade:I,subject:v,curriculum_framework:v.stateStandard||"ccss",goal_type:f,planPurpose:y,status:"draft",targetType:"individual",selectedStudent:m,title:`${v.name} Learning Plan`,planName:`${v.name} Learning Plan`,description:`Learning plan for ${v.name}`};j&&(w&&(A.examName=w),A.examDate=k);const _=await(0,l.createLearningPlanMeta)(A);return null!==(u=null===_||void 0===_?void 0:_.data)&&void 0!==u?u:_},ue=async function(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const n=`pending_${e.key}_${t}`;if(!W[n])try{U(e=>({...e,[n]:!0}));const a=await ce(e);V(t=>t.filter(t=>t.key!==e.key)),w(e=>{const t=(null===a||void 0===a?void 0:a.ilpId)||(null===a||void 0===a?void 0:a.id);return!t||e.some(e=>(e.ilpId||e.id)===t)?e:[...e,a]}),O(e=>({...e,[a.ilpId||a.id]:"Not Yet Started"})),"readiness"===t?await de(a):await oe(a,!1,{generateWithAi:Boolean(s.generateWithAi)||"generate_ai"===t})}catch(r){var a,i;console.error("Pending subject plan setup failed:",r),alert((null===(a=r.response)||void 0===a||null===(i=a.data)||void 0===i?void 0:i.detail)||r.message||"Failed to start. Please try again.")}finally{U(e=>{const t={...e};return delete t[n],t})}},me=async t=>{const s=(null===t||void 0===t?void 0:t.ilpId)||(null===t||void 0===t?void 0:t.id),n=`${s}_resume_readiness`;if(!W[n])if(t&&s){U(e=>({...e,[n]:!0}));try{let n=localStorage.getItem(`readinessCheckState_${s}`);if(!n&&t.id&&t.id!==s&&(n=localStorage.getItem(`readinessCheckState_${t.id}`)),n)try{const a=JSON.parse(n),i=a.quizId,r=a.subject||re(t.subject);if(i)return void e("/student/workspace",{state:{quizId:i,mode:"quiz",subject:r,lesson:"Readiness Check",ilpId:s,isReadinessCheck:!0}})}catch(r){console.error("Error parsing saved quiz state:",r)}}catch(d){console.error("Error checking localStorage:",d),U(e=>{const t={...e};return delete t[n],t})}try{var a,i;const n=await l.default.get(`/student/onboarding/readiness-check/status/${s}`),r=(null===(a=n.data)||void 0===a?void 0:a.hasReadinessCheckCompleted)||!1,d=null===(i=n.data)||void 0===i?void 0:i.quizId;r&&d?e("/student/onboarding/readiness-check-completion",{state:{subject:re(t.subject),ilpId:s,quizId:d}}):d?e("/student/workspace",{state:{quizId:d,mode:"quiz",subject:re(t.subject),lesson:"Readiness Check",ilpId:s,isReadinessCheck:!0}}):e("/student/onboarding/readiness-check-completion",{state:{subject:re(t.subject),ilpId:s,quizId:null}})}catch(o){console.error("Error checking readiness check status:",o),e("/student/onboarding/readiness-check-completion",{state:{subject:re(t.subject),ilpId:s,quizId:null}})}finally{setTimeout(()=>{U(e=>{const t={...e};return delete t[n],t})},1e3)}}else alert("Learning plan not found. Please try again."),U(e=>{const t={...e};return delete t[n],t})},he=async function(t){let s=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=(null===t||void 0===t?void 0:t.ilpId)||(null===t||void 0===t?void 0:t.id),a=`${n}_resume_ilp`,i=((null===t||void 0===t?void 0:t.status)||"draft").toLowerCase();if(s){if(!W[a])if(t&&n)try{var r;U(e=>({...e,[a]:!0})),J(null);const s=await l.default.get(`/learningplans/by-ilp/${n}`),d=Array.isArray(s.data)?s.data:[];if("active"===i&&d.length>0)return U(e=>{const t={...e};return delete t[a],t}),void pe(t);if(0===d.length)return U(e=>{const t={...e};return delete t[a],t}),void oe(t,!0);const o={status:"success",ilpId:n,metadata:{total_lessons:d.length,total_topics:new Set(d.map(e=>
1e.topic||e.domain).filter(Boolean)).size},lessons:d};e("/student/onboarding/learning-plan-confirmation",{state:{ilpId:n,planData:o,subject:t.subject,grade:t.grade||(null===ae||void 0===ae||null===(r=ae.profile)||void 0===r?void 0:r.grade)||(null===ae||void 0===ae?void 0:ae.grade),topicPriorities:{}}})}catch(c){var d,o;console.error("Error resuming ILP generation:",c),alert((null===(d=c.response)||void 0===d||null===(o=d.data)||void 0===o?void 0:o.detail)||"Failed to resume ILP generation. Please try again."),U(e=>{const t={...e};return delete t[a],t})}else alert("Learning plan not found. Please try again."),U(e=>{const t={...e};return delete t[a],t})}else J({ilpId:n,action:"resume",meta:t})},pe=t=>{const s=(null===t||void 0===t?void 0:t.ilpId)||(null===t||void 0===t?void 0:t.id),n=re(t.subject);s?e("/student/my-learning-plan",{state:{focusIlpId:s,focusSubjectTab:n,markLearningStarted:!0}}):alert("Learning plan not found. Please try again.")},ve=(t,s)=>{t&&(0,_.OQ)(e,t,s)};if(ie)return null;const ge=N.some(e=>e.kind===g),xe=N.some(e=>e.kind===x||e.kind===b||e.kind===v);return(0,z.jsxs)("div",{className:"student-dash-card student-dash-card-pad",children:[(0,z.jsx)("div",{className:"flex items-center justify-between mb-4",children:(0,z.jsxs)("div",{children:[(0,z.jsxs)("div",{className:"flex items-center gap-2.5 mb-1",children:[(0,z.jsx)(i.uoG,{className:"w-5 h-5 shrink-0 student-dash-chart1-text","aria-hidden":!0}),(0,z.jsx)("h2",{className:"student-dash-heading-lg",children:"Next Learning Actions"})]}),(0,z.jsx)("p",{className:"student-dash-text-muted text-[13px] ml-7",children:xe?"Your personalized next steps based on your learning plan and progress.":ge?"Your recommended learning paths are ready \u2014 start learning or personalize each subject.":"Set up your learning plans, one subject at a time."})]})}),q?(0,z.jsxs)("div",{className:"flex flex-col items-center justify-center py-12",children:[(0,z.jsx)("div",{className:"animate-spin rounded-full h-10 w-10 border-2 border-[var(--border)] border-t-[var(--chart-1)] mb-3"}),(0,z.jsx)("p",{className:"student-dash-text-muted text-sm",children:"Loading learning actions..."})]}):0===N.length?(0,z.jsx)("div",{className:"text-center py-8 "+(Y?"text-[var(--chart-4)] font-medium":"student-dash-text-muted"),children:Y?(0,z.jsx)("p",{className:"font-medium",children:"You're caught up! Check My Learning Plan anytime."}):(0,z.jsx)("p",{children:"No learning plans found. Please set your goals first."})}):(0,z.jsx)("div",{className:"schedule-cards-scroll min-w-0",style:{maxHeight:"min(800px, 75vh)"},children:(0,z.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 w-full min-w-0 items-stretch p-0.5 pt-1 pb-2",children:N.map(t=>{if(t.kind===h){const e=t.pendingSubject;return(0,z.jsxs)("div",{className:`${R.SE} min-w-0 ${R.N8} relative`,children:[(0,z.jsx)(R.pM,{}),(0,z.jsxs)("div",{className:R.uR,children:[(0,z.jsxs)("div",{className:R.gZ,children:[(0,z.jsx)("span",{className:R.Gu["Readiness Check"],children:"Readiness Check"}),(0,z.jsx)("span",{className:(0,R.re)("Not Yet Started"),children:"Not Yet Started"})]}),(0,z.jsx)("p",{className:"text-base font-semibold student-dash-text mb-2 min-h-[1.25rem] leading-snug break-words",children:e.name}),(0,z.jsx)("div",{className:"mb-2 min-h-[1.25rem]","aria-hidden":!0}),(0,z.jsx)("p",{className:"mb-2 flex-1 min-h-[2.5rem] text-[11px] leading-snug student-dash-text-muted",children:t.description}),(0,z.jsxs)("div",{className:"relative z-10 mt-auto flex flex-col gap-1.5 pt-2",children:[(0,z.jsx)("button",{type:"button",onClick:()=>ue(e,"readiness"),disabled:!!W[`pending_${e.key}_readiness`],className:R.JI,children:W[`pending_${e.key}_readiness`]?"Loading...":"Start Readiness Check"}),(0,z.jsxs)("button",{type:"button",onClick:()=>ue(e,"generate"),disabled:!!W[`pending_${e.key}_generate`],className:R.jT,children:[(0,z.jsx)(i.RBv,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),W[`pending_${e.key}_generate`]?"Loading...":"Generate Learning Plan"]}),(0,z.jsx)("button",{type:"button",onClick:()=>ue(e,"generate_ai",{generateWithAi:!0}),disabled:!!W[`pending_${e.key}_generate_ai`]||!!W[`pending_${e.key}_generate`],className:R.jT,children:W[`pending_${e.key}_generate_ai`]?"Loading...":"Generate with AI"})]})]})]},`pending_${e.key}`)}if(t.kind===v){const e=t.meta;return(0,z.jsx)("div",{className:`${R.SE} min-w-0 ${R.qU} relative`,children:(0,z.jsxs)("div",{className:R.uR,children:[(0,z.jsxs)("div",{className:R.gZ,children:[(0,z.jsx)("span",{className:R.Gu["Recommended Learning Path"],children:"Learning Plan"}),(0,z.jsx)("span",{className:(0,R.re)("Ready to Start"),children:t.planStatus})]}),(0,z.jsx)("p",{className:"text-base font-semibold student-dash-text mb-2 min-h-[1.25rem] leading-snug break-words",children:t.subjectName}),(0,z.jsx)("div",{className:"mb-2 min-h-[1.25rem]","aria-hidden":!0}),(0,z.jsx)("p",{className:"mb-2 flex-1 min-h-[2.5rem] text-[11px] leading-snug student-dash-text-muted",children:t.description}),(0,z.jsx)("div",{className:"relative z-10 mt-auto flex flex-col gap-1.5 pt-2",children:(0,z.jsx)("button",{type:"button",onClick:()=>pe(e),className:R.JI,children:f})})]})},`explore_${t.ilpId}`)}if(t.kind===x||t.kind===b){var s;const n=t.lesson,a=X===String(null!==(s=null===n||void 0===n?void 0:n.id)&&void 0!==s?s:"");return(0,z.jsx)("div",{className:`${R.SE} min-w-0 ${R.qU} relative`,children:(0,z.jsxs)("div",{className:R.uR,children:[(0,z.jsxs)("div",{className:R.gZ,children:[(0,z.jsx)("span",{className:R.Gu["Recommended Learning Path"],children:t.badge}),(0,z.jsx)("span",{className:(0,R.re)(t.planStatus),children:t.planStatus})]}),(0,z.jsx)("p",{className:"text-base font-semibold student-dash-text mb-1 min-h-[1.25rem] leading-snug break-words",children:t.subjectName}),(0,z.jsx)("p",{className:"mb-2 text-[12px] font-medium student-dash-text leading-snug break-words",children:t.lessonTitle}),(0,z.jsx)("p",{className:"mb-2 flex-1 min-h-[2.5rem] text-[11px] leading-snug student-dash-text-muted",children:t.description}),(0,z.jsxs)("div",{className:"relative z-10 mt-auto flex flex-col gap-1.5 pt-2",children:[(0,z.jsx)("button",{type:"button",onClick:()=>{(async e=>{var t;const s=String(null!==(t=null===e||void 0===e?void 0:e.id)&&void 0!==t?t:"");
1if(s&&!X){K(s);try{const t=await(0,A.Ov)(e,{sessions:[],fetchSessions:async()=>{try{var e;const t=await l.default.get("/sessions/me");return Array.isArray(t.data)?t.data:(null===(e=t.data)||void 0===e?void 0:e.sessions)||[]}catch{return[]}}});"summary_unavailable"===(null===t||void 0===t?void 0:t.action)?alert("No session summary is available yet. Complete a tutoring session for this lesson first."):"blocked"===(null===t||void 0===t?void 0:t.action)&&te(T.So.SESSION_IN_PROGRESS)}catch(a){var n;if(null!==a&&void 0!==a&&a.isSessionPolicyBlock||null!==a&&void 0!==a&&null!==(n=a.policyBlock)&&void 0!==n&&n.code)return;console.error("[NextLearningActions] Primary lesson action failed:",a),te((0,T._G)(a)||T.So.SESSION_START_FAILED)}finally{K("")}}})(n)},disabled:a,className:R.JI,children:a?"Loading...":t.primaryCta}),t.showQuiz?(0,z.jsx)("button",{type:"button",onClick:()=>ve(n,"quiz"),className:R.jT,children:"Quiz"}):null,t.showPractice?(0,z.jsx)("button",{type:"button",onClick:()=>ve(n,"practice"),className:R.jT,children:"Practice"}):null,t.showNotes?(0,z.jsx)("button",{type:"button",onClick:()=>(t=>{t&&(0,L.ct)(e,{...t,fromLearningPlan:!0},{mode:(0,L.Ji)((0,m.Tj)(t))})})(n),className:R.jT,children:"Notes"}):null]})]})},`lesson_${t.ilpId}_${(null===n||void 0===n?void 0:n.id)||"x"}`)}const n=t.meta,a=t.ilpId,r=t.subjectName,o=(e=>e.examDate?d.A.formatDate(e.examDate):e.completionDatePlanned?d.A.formatDate(e.completionDatePlanned):null)(n),u=(0,R.$A)(n),p=t.planStatus||F[a]||"Not Yet Started",j=t.kind===g,N=!j&&"Not Yet Started"===p,k=N?R.N8:R.qU,C=`${a}_generate`,_=`${a}_readiness`,P=`${a}_resume_readiness`,E=`${a}_resume_ilp`,D=j?c.e1:"Baseline complete"===p?"Great! I now understand your level. Let's create your personalized learning plan.":"Readiness in progress"===p?"Continue your readiness check so we can tailor your plan.":"Help me understand your current level so I can design the right plan for you.";return(0,z.jsxs)("div",{className:`${R.SE} min-w-0 ${k} relative`,children:[j?(0,z.jsx)("button",{type:"button",onClick:()=>(async e=>{const t=(null===e||void 0===e?void 0:e.ilpId)||(null===e||void 0===e?void 0:e.id);if(t){(0,c.AC)(t);try{var s;const e=(null===ae||void 0===ae||null===(s=ae.profile)||void 0===s?void 0:s.dismissedLearningActionCards)||{};await(0,l.updateCurrentUserProfile)({profile:{dismissedLearningActionCards:{...e,[t]:(new Date).toISOString()}}}),y&&await y("NextLearningActions (dismiss card)")}catch(n){console.warn("Could not persist dismissed card to profile:",n)}w(e=>e.filter(e=>(e.ilpId||e.id)!==t)),S(e=>e.filter(e=>e.ilpId!==t)),I(e=>{const s={...e};return delete s[t],s})}})(n),className:"absolute top-2 right-2 z-20 p-1 rounded-full student-dash-text-muted hover:student-dash-text hover:bg-[var(--muted)]","aria-label":`Dismiss ${r} learning path card`,children:(0,z.jsx)(i.QCr,{className:"h-3 w-3","aria-hidden":!0})}):null,N?(0,z.jsx)(R.pM,{}):null,(0,z.jsxs)("div",{className:R.uR,children:[(0,z.jsxs)("div",{className:R.gZ,children:[(0,z.jsx)("span",{className:j?R.Gu["Recommended Learning Path"]:R.Gu["Readiness Check"],children:j?"Recommended Learning Path":"Readiness Check"}),(0,z.jsx)("span",{className:(0,R.re)(p),children:p})]}),(0,z.jsx)("p",{className:"text-base font-semibold student-dash-text mb-2 min-h-[1.25rem] leading-snug break-words",children:r}),u?(0,z.jsx)("div",{className:"mb-2",children:(0,z.jsx)("span",{className:u.className,children:u.label})}):(0,z.jsx)("div",{className:"mb-2 min-h-[1.25rem]","aria-hidden":!0}),(0,z.jsx)("p",{className:"mb-2 flex-1 min-h-[2.5rem] text-[11px] leading-snug student-dash-text-muted",children:D}),o?(0,z.jsxs)("p",{className:"mb-2 text-[11px] student-dash-text-sm",children:[(0,z.jsx)("span",{className:"font-medium student-dash-text-muted",children:"Exam Preparation"===n.goal_type?"Target exam: ":"Target: "}),o]}):null,(0,z.jsx)("div",{className:"relative z-10 mt-auto flex flex-col gap-1.5 pt-2",children:j?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)("button",{type:"button",onClick:()=>pe(n),className:R.JI,children:"Start Learning"}),"In Progress"===p?(0,z.jsx)("button",{type:"button",onClick:()=>me(n),disabled:W[P],className:R.jT,children:W[P]?"Loading...":"Resume Readiness Check"}):(0,z.jsxs)("button",{type:"button",onClick:()=>de(n),disabled:W[_],className:R.jT,children:[(0,z.jsx)(i.RBv,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),W[_]?"Loading...":"Personalize Your Learning Plan"]})]}):"Baseline complete"===p?(0,z.jsx)("button",{type:"button",onClick:()=>(async t=>{const s=(null===t||void 0===t?void 0:t.ilpId)||(null===t||void 0===t?void 0:t.id),n=`${s}_review_topics`;if(!s||W[n])return;const a=re(t.subject);try{var i,r;U(e=>({...e,[n]:!0}));let o=null;try{var d;o=(null===(d=(await l.default.get(`/student/onboarding/readiness-check/status/${s}`)).data)||void 0===d?void 0:d.quizId)||null}catch(u){console.warn("[NextLearningActions] Could not load readiness status for results re-entry:",u)}if(o)return void e("/student/onboarding/readiness-check-completion",{state:{subject:a,ilpId:s,quizId:o}});const c=null===(i=(await l.default.post("/student/onboarding/readiness-check/generate-topics",{ilpId:s})).data)||void 0===i?void 0:i.planData;if(!c||!c.lessons||0===c.lessons.length)return void alert("Failed to generate topics from readiness check. Please try again.");e("/student/onboarding/learning-plan-review",{state:{ilpId:s,planData:c,subject:t.subject,grade:t.grade||(null===ae||void 0===ae||null===(r=ae.profile)||void 0===r?void 0:r.grade)||(null===ae||void 0===ae?void 0:ae.grade),planSource:"readiness"}})}catch(m){var o,c;console.error("Error generating topics from readiness:",m),alert((null===(o=m.response)||void 0===o||null===(c=o.data)||void 0===c?void 0:c.detail)||"Failed to generate topics from readiness check.")}finally{U(e=>{const t={...e};return delete t[n],t})}})(n),disabled:W[`${a}_review_topics`],className:R.JI,children:W[`${a}_review_topics`]?"Loading...":"Review Topics & Create Plan"}):B[a]?(0,z.jsx)("button",{type:"button",onClick:()=>me(n),disabled:W[P],className:R.JI,children:W[P]?"Loading...":"Resume Readiness Check"}):"In Progress"===p?(0,z.jsx)("button",{type:"button",onClick:()=>he(n),disabled:W[E],className:R.JI,children:W[E]?"Loading...":"Resume ILP Generation"}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)("button",{type:"button",onClick:()=>de(n),disabled:W[_],className:R.JI,children:W[_]?"Loading...":"Start Readiness Check"}),(0,z.jsxs)("button",{type:"button",onClick:()=>oe(n),disabled:W[C],className:R.jT,children:[(0,z.jsx)(i.RBv,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),W[C]?"Loading...":"Generate Learning Plan"]}),(0,z.jsx)("button",{type:"button",onClick:()=>oe(n,!1,{generateWithAi:!0}),disabled:W[C],className:R.jT,children:W[C]?"Loading...":"Generate with AI"})]})})]})]},a)})})}),Q&&(0,z.jsx)("div",{className:"student-dash-modal-backdrop fixed inset-0 flex items-start justify-center z-50 pt-24 pb-8 px-4 overflow-y-auto","data-student-layout":!0,children:(0,z.jsxs)("div",{className:"student-dash-modal-card p-6 max-w-md w-full mx-4",children:[(0,z.jsx)("h3",{className:"student-dash-heading-lg mb-4",children:"Confirm Learning Plan Generation"}),(0,z.jsx)("p",{className:"student-dash-text-muted mb-6",children:"generate"===Q.action?Q.generateWithAi?"Generate a learning plan with AI (skips the lesson catalog). Continue?":"Are you sure you want to generate a learning plan? This will create a personalized plan based on your goals.":"Are you sure you want to resume learning plan generation? This will continue from where you left off."}),(0,z.jsxs)("div",{className:"flex gap-3 justify-end",children:[(0,z.jsx)("button",{type:"button",onClick:()=>J(null),className:"student-dash-btn student-dash-btn-outline px-4 py-2 rounded-[8px]",children:"Cancel"}),(0,z.jsx)("button",{type:"button",onClick:()=>{"generate"===Q.action?oe(Q.meta,!0,{generateWithAi:Boolean(Q.generateWithAi)}):he(Q.meta,!0)},className:"student-dash-btn student-dash-btn-primary px-4 py-2 rounded-[8px]",children:"Confirm"})]})]})}),(0,z.jsx)(P.A,{open:Boolean(ee),errorType:ee,onClose:()=>{se||te(null)},onPrimaryAction:async()=>
1{if(ee)return ee===T.So.RESUME_FAILURE||ee===T.So.SESSION_IN_PROGRESS?(te(null),void e("/student/sessions")):(ee!==T.So.TIME_CONFLICT&&T.So.TIME_UNAVAILABLE,void te(null))},primaryLoading:se})]})}},84139(e,t,s){s.d(t,{A:()=>A});var n=s(9950),a=s(17119),i=s(22875),r=s(41413),l=s(18555),d=s(14232),o=s(60226),c=s(71955),u=s(48122),m=s(59737),h=s(46368),p=s(9688),v=s(92906),g=s(51365),x=s(81454),b=s(44414);const f={"learning-plan":i.vd0,"resume-session":i.Swo,"practice-quiz":i.aBf,"my-schedule":i.bfZ,"progress-report":i.v$b,"notes-resources":i.Svc,messages:i.uN,"homework-help":i.Mbp,"start-new-session":i.gSK,settings:i.Pcn};function y(e){let{actionId:t,className:s="w-6 h-6"}=e;const n=f[t];return n?(0,b.jsx)(n,{className:s,"aria-hidden":!0}):null}const j=[{id:"learning-plan",title:"Learning Plan",description:"Jump into your learning plan",accent:"student-dash-avatar-placeholder border border-[color:var(--border)] student-dash-primary-text",navigateTo:"/student/my-learning-plan",guidance:{title:"Learning Plan",text:"View your subjects, goals, lessons, and learning progress"}},{id:"resume-session",title:"Resume last session",description:"Continue where you left off",accent:"student-dash-avatar-placeholder border border-[color:var(--border)] student-dash-chart1-text",navigateTo:"/student/sessions",guidance:{title:"Resume Session",text:"Continue your interrupted tutoring session without losing progress."}},{id:"practice-quiz",title:"Practice/Quiz",description:"Practice or take a quiz",accent:"student-dash-avatar-placeholder border border-[color:var(--border)] student-dash-accent-text",navigateTo:"/student/practice",guidance:{title:"Practice & Readiness",text:"Complete readiness checks and practice activities for your lessons."}},{id:"my-schedule",title:"My Schedule",description:"View and manage your sessions",accent:"student-dash-avatar-placeholder border border-[color:var(--border)] student-dash-primary-text",navigateTo:"/student/my-schedule",guidance:{title:"Schedule",text:"View your upcoming tutoring sessions and learning schedule."}},{id:"progress-report",title:"Progress Report",description:"View your progress and insights",accent:"student-dash-avatar-placeholder border border-[color:var(--border)] student-dash-chart1-text",navigateTo:"/student/progress",guidance:{title:"Learning Progress",text:"Track your learning progress and completed activities."}},{id:"notes-resources",title:"Notes & Resources",description:"Access notes and study resources",accent:"student-dash-avatar-placeholder border border-[color:var(--border)] student-dash-chart1-text",navigateTo:"/student/notes-and-research",guidance:{title:"Notes & Resources",text:"Access your lesson notes and study resources."}},{id:"messages",title:"Messages",description:"Chat with your tutor",accent:"student-dash-avatar-placeholder border border-[color:var(--border)] student-dash-accent-text",navigateTo:"/student/messages",guidance:{title:"Messages",text:"View messages, updates, and learning communication."}},{id:"homework-help",title:"Homework",description:"Get help with homework",accent:"student-dash-avatar-placeholder border border-[color:var(--border)] student-dash-accent-text",navigateTo:"/student/sessions?sessionType=homework",guidance:{title:"Homework Help",text:"Work on teacher-assigned homework and learning activities."}},{id:"start-new-session",title:"Start New Session",description:"Start a new learning session",accent:"student-dash-avatar-placeholder border border-[color:var(--border)] student-dash-text-success",navigateTo:"/student/sessions",guidance:{title:"Start Session",text:"Start a tutoring session for a lesson you want to learn or review."}},{id:"settings",title:"Settings",description:"Profile and preferences",accent:"student-dash-avatar-placeholder border border-[color:var(--border)] student-dash-text-muted",navigateTo:"/student/profile",guidance:{title:"Settings",text:"Manage your account settings and profile preferences."}}],w=["start-new-session","homework-help","resume-session"],N="student_quick_actions_visibility",S="continueLearningQuickActions";function k(e){if(!Array.isArray(e))return null;const t=e.filter(e=>"string"===typeof e&&j.some(t=>t.id===e)).slice(0,3);return t.length>0?t:null}function I(e){try{localStorage.setItem(N,JSON.stringify(e))}catch(t){console.error("Error saving student quick actions preferences:",t)}}function C(e,t){var s;let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"block w-full min-w-0";return null!==e&&void 0!==e&&null!==(s=e.guidance)&&void 0!==s&&s.text?(0,b.jsx)(g.cJ,{title:e.guidance.title,text:e.guidance.text,placement:"top-end",showIcon:!0,showTitleInPopup:!1,showDelayMs:g.Nu,className:n,children:t}):t}const A=function(e){let{lastSession:t=null}=e;const s=(0,r.Zp)(),{userProfile:f,refreshUserProfile:A}
1=(0,v.Fj)(),[_,L]=(0,n.useState)(t),[P,T]=(0,n.useState)(null===t),[R,E]=(0,n.useState)(!1),[D,$]=(0,n.useState)(!1),[z,q]=(0,n.useState)(null),[M,F]=(0,n.useState)(!1),[O,B]=(0,n.useState)(!1),[G,W]=(0,n.useState)(!1),[U,Q]=(0,n.useState)(!1),[J,Y]=(0,n.useState)(()=>[...w]),[H,Z]=(0,n.useState)(!1),[V,X]=(0,n.useState)(""),[K,ee]=(0,n.useState)(""),te=n.useRef(!1),[se,ne]=(0,n.useState)(()=>{var e;return null!==(e=function(){try{const e=localStorage.getItem(N);return e?k(JSON.parse(e)):null}catch(e){return console.error("Error loading student quick actions preferences:",e),null}}())&&void 0!==e?e:[...w]}),ae=()=>{l.default.get("/sessions/me/last-inprogress",{_source:"QuickActions (component-level)"}).then(e=>{e.data&&e.data.id?L(e.data):L(null)}).catch(e=>{console.error("Error fetching last session",e),L(null)}).finally(()=>T(!1))};(0,n.useEffect)(()=>{if(void 0!==t){t&&t.id?(L(t),T(!1)):(L(null),ae());"true"===localStorage.getItem("sessionFeedbackSubmitted")&&(localStorage.removeItem("sessionFeedbackSubmitted"),setTimeout(()=>{ae()},500))}else{ae();"true"===localStorage.getItem("sessionFeedbackSubmitted")&&(localStorage.removeItem("sessionFeedbackSubmitted"),setTimeout(()=>{ae()},500))}},[t]),(0,n.useEffect)(()=>{var e;if(te.current||!f)return;const t=k(null===f||void 0===f||null===(e=f.profile)||void 0===e?void 0:e[S]);t&&(ne(t),I(t)),te.current=!0},[f]),(0,n.useEffect)(()=>{if(!K)return;const e=window.setTimeout(()=>ee(""),3e3);return()=>window.clearTimeout(e)},[K]),(0,n.useEffect)(()=>{(null===se||void 0===se?void 0:se.length)>0&&I(se)},[se]),(0,n.useEffect)(()=>{if(!U&&!R)return;const e=e=>{"Escape"===e.key&&(Q(!1),D||E(!1))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[U,R,D]),(0,n.useEffect)(()=>{if(!U&&!R)return;const e=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}},[U,R]);const ie=(0,n.useCallback)((e,t)=>e.includes(t)?1===e.length?e:e.filter(e=>e!==t):e.length>=3?e:[...e,t],[]),re=e=>{Y(t=>ie(t,e))},le=(0,n.useCallback)((e,t)=>{Y(s=>{const n=[...s],a=e+t;if(a<0||a>=n.length)return s;const i=n[e];return n[e]=n[a],n[a]=i,n})},[]),de=Array.isArray(se)?se:[...w],oe=Array.isArray(J)?J:[...w],ce=(0,n.useMemo)(()=>de.map(e=>j.find(t=>t.id===e)).filter(Boolean),[de]),ue=async()=>{if(_&&_.id)E(!0);else{console.warn("\u26a0\ufe0f [QuickActions] No valid session to resume, trying to fetch...");try{const e=await l.default.get("/sessions/me/last-inprogress");e.data&&e.data.id?(L(e.data),E(!0)):alert("No ongoing sessions found. Please start a new session.")}catch(e){console.error("Error fetching last session:",e),(0,d.a)(e,"Unable to check for ongoing sessions. Please try again.")}}},me=()=>{E(!1)},he=U&&"undefined"!==typeof document&&(0,a.createPortal)((0,b.jsx)("div",{className:"student-dash-modal-backdrop fixed inset-0 z-[110] flex items-center justify-center px-4 overflow-y-auto",role:"presentation","data-student-layout":!0,children:(0,b.jsxs)("div",{role:"dialog","aria-modal":"true","aria-labelledby":"student-continue-learning-customize-title",className:"student-dash-modal-card w-full max-w-2xl max-h-[min(90vh,calc(100dvh-5rem))] overflow-hidden flex flex-col pointer-events-auto",onClick:e=>e.stopPropagation(),children:[(0,b.jsxs)("div",{className:"student-dash-modal-header flex items-center justify-between px-6 py-4 shrink-0",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h3",{id:"student-continue-learning-customize-title",className:"student-dash-heading-lg",children:"Customize Continue Learning"}),(0,b.jsx)("p",{className:"student-dash-text-muted mt-1 text-left",children:"Select up to 3 actions that you use most often"})]}),(0,b.jsx)("button",{type:"button",onClick:()=>Q(!1),className:"student-dash-modal-close p-1 rounded-lg focus:outline-none focus-visible:ring-2 focus-visible:ring-[color:var(--ring)]","aria-label":"Close",children:(0,b.jsx)("svg",{className:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,b.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,b.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto px-6 py-4",children:[(0,b.jsx)("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4 items-stretch",children:j.map(e=>{var t;
1const s=(null===(t=e.guidance)||void 0===t?void 0:t.title)||e.title,n=oe.includes(e.id),a=n&&1===oe.length,i=!n&&oe.length>=3,r=a||i,l=`group relative h-full w-full rounded-xl border-2 p-4 text-left outline-none focus-visible:ring-2 focus-visible:ring-[color:var(--ring)] focus-visible:ring-offset-2 ${n?"shadow-md scale-105 border-[color:var(--primary)] bg-[color-mix(in_srgb,var(--primary)_8%,var(--card))]":`border-[color:var(--border)] bg-[var(--card)] ${u.z}`} ${r?"opacity-60 cursor-not-allowed":"cursor-pointer"}`,d=(0,b.jsxs)("div",{role:"button",tabIndex:r?-1:0,"aria-pressed":n,"aria-disabled":r,onClick:()=>{r||re(e.id)},onKeyDown:t=>{r||"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),re(e.id))},className:l,children:[(0,b.jsx)("input",{type:"checkbox",checked:n,disabled:r,onChange:t=>{t.stopPropagation(),r||re(e.id)},onClick:e=>e.stopPropagation(),className:"absolute top-2 right-2 z-10","aria-label":`${n?"Deselect":"Select"} ${s}`}),(0,b.jsxs)("div",{className:"flex h-full flex-col items-center text-center space-y-3",children:[(0,b.jsx)("div",{className:`flex shrink-0 items-center justify-center w-14 h-14 rounded-xl border-2 text-2xl transition-all duration-200 ${n?`${e.accent} border-[color:var(--primary)]`:e.accent}`,children:(0,b.jsx)(y,{actionId:e.id})}),(0,b.jsxs)("div",{className:"flex w-full flex-1 flex-col",children:[(0,b.jsx)("div",{className:"flex min-h-[2.5rem] items-center justify-center gap-1",children:(0,b.jsx)("span",{className:"line-clamp-2 font-semibold text-sm leading-snug "+(n?"student-dash-primary-text":"student-dash-text"),children:s})}),(0,b.jsx)("div",{className:"student-dash-text-xs mt-1 min-h-[2.5rem] line-clamp-2 leading-snug "+(n?"student-dash-primary-text":""),children:e.description})]})]})]}),o="block h-full w-full min-w-0";return e.guidance?(0,b.jsx)(g.cJ,{title:e.guidance.title,text:e.guidance.text,placement:"top-end",showIcon:!0,showTitleInPopup:!1,showDelayMs:g.Nu,className:o,children:d},e.id):(0,b.jsx)("div",{className:o,children:d},e.id)})}),(0,b.jsxs)("p",{className:"student-dash-text-muted text-center mt-4",children:[oe.length," / ",3," actions selected"]}),oe.length>0&&(0,b.jsxs)("div",{className:"mt-4 rounded-xl border border-[color:var(--border)] bg-[var(--muted)] p-4",children:[(0,b.jsx)("p",{className:"student-dash-text-xs font-semibold uppercase tracking-wide mb-2",children:"Order on dashboard"}),(0,b.jsx)("ul",{className:"space-y-2",children:oe.map((e,t)=>{var s;const n=j.find(t=>t.id===e);if(!n)return null;const a=(null===(s=n.guidance)||void 0===s?void 0:s.title)||n.title;return(0,b.jsxs)("li",{className:"flex items-center justify-between gap-2 rounded-lg bg-[var(--card)] border border-[color:var(--border)] px-3 py-2 student-dash-text-sm",children:[(0,b.jsxs)("span",{className:"flex items-center gap-2 min-w-0",children:[(0,b.jsx)("span",{className:"text-lg shrink-0 student-dash-primary-text","aria-hidden":!0,children:(0,b.jsx)(y,{actionId:n.id,className:"w-4 h-4"})}),(0,b.jsx)("span",{className:"truncate font-medium",children:a})]}),(0,b.jsxs)("span",{className:"flex items-center gap-1 shrink-0",children:[(0,b.jsx)("button",{type:"button",className:"student-dash-btn-outline p-1.5 rounded-md disabled:opacity-40 disabled:cursor-not-allowed",onClick:()=>le(t,-1),disabled:0===t,"aria-label":`Move ${a} up`,children:(0,b.jsx)(i.Ucs,{className:"w-3 h-3"})}),(0,b.jsx)("button",{type:"button",className:"student-dash-btn-outline p-1.5 rounded-md disabled:opacity-40 disabled:cursor-not-allowed",onClick:()=>le(t,1),disabled:t===oe.length-1,"aria-label":`Move ${a} down`,children:(0,b.jsx)(i.Vr3,{className:"w-3 h-3"})})]})]},e)})})]}),V?(0,b.jsx)("p",{className:"student-dash-text-xs text-[color:var(--destructive)] text-center mt-3",role:"alert",children:V}):null]}),(0,b.jsxs)("div",{className:"student-dash-modal-header flex items-center justify-end gap-3 px-6 py-4 shrink-0 bg-[var(--card)]",children:[(0,b.jsx)("button",{type:"button",onClick:()=>Y([...w]),className:"student-dash-btn student-dash-btn-outline px-4 py-2",disabled:H,children:"Reset to Default"}),(0,b.jsx)("button",{type:"button",onClick:async()=>{var e;const t=null!==(e=k(J))&&void 0!==e?e:[...w];Z(!0),X("");try{await l.default.put("/users/me",{profile:{...(null===f||void 0===f?void 0:f.profile)||{},[S]:t}}),ne(t),I(t),"function"===typeof A&&await A("QuickActions.savePreferences"),ee("Continue Learning preferences saved."),Q(!1)}catch(r){var s,n,a,i;console.error("Error saving Continue Learning preferences:",r),X((null===r||void 0===r||null===(s=r.response)||void 0===s||null===(n=s.data)||void 0===n?void 0:n.detail)||(null===r||void 0===r||null===(a=r.response)||void 0===a||null===(i=a.data)||void 0===i?void 0:i.message)||"Could not save preferences. Please try again.")}finally{Z(!1)}},disabled:H||0===oe.length,className:"student-dash-btn student-dash-btn-primary px-4 py-2 rounded-lg",children:H?"Saving\u2026":"Save"})]})]})}),document.body),pe=R&&"undefined"!==typeof document&&(0,a.createPortal)((0,b.jsx)("div",{className:"student-dash-modal-backdrop fixed inset-0 z-[9999] flex items-center justify-center px-4 overflow-y-auto bg-[rgba(0,0,0,0.5)]",role:"presentation","data-student-layout":!0,children:(0,b.jsx)("div",{className:"student-dash-modal-card p-6 w-80 max-w-sm mx-4 relative pointer-events-auto my-auto sm:my-0",onClick:e=>e.stopPropagation(),children:D?(0,b.jsxs)("div",{className:"text-center py-2","aria-live":"polite","aria-busy":"true",children:[(0,b.jsx)("div",{className:"student-layout-loading-spinner mb-4"}),(0,b.jsx)("h3",{className:"student-dash-heading-lg mb-2",children:"Preparing Your Session"}),(0,b.jsx)("p",{className:"student-dash-text-muted",children:"Please wait..."})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("button",{type:"button",onClick:me,className:"student-dash-modal-close absolute top-3 right-3","aria-label":"Close",children:(0,b.jsx)(i.QCr,{size:16})}),(0,b.jsxs)("div",{className:"text-center",children:[(0,b.jsxs)("div",{className:"mb-4",children:[(0,b.jsx)("h3",{className:"student-dash-heading-lg mb-2",children:"Welcome Back!"}),(0,b.jsx)("p",{className:"student-dash-text-muted",children:"Looks like you are left off between a session. Don't worry, we have saved your spot."})]}),(0,b.jsx)("button",{type:"button",onClick:async()=>
1{if(!_||!_.id)return alert("Session information is missing. Please try again."),void E(!1);$(!0);try{const e=await l.default.get(`/sessions/me/tutorbot/resume/${_.id}`);e.data&&e.data.url?(window.open(e.data.url,"_blank"),E(!1)):(console.error("\u26a0\ufe0f [QuickActions] Resume response missing URL:",e.data),E(!1),q(c.So.RESUME_FAILURE))}catch(s){var e,t;if(null!==s&&void 0!==s&&s.isSessionPolicyBlock||null!==s&&void 0!==s&&null!==(e=s.policyBlock)&&void 0!==e&&e.code)return void E(!1);console.error("Error resuming session:",s),404===(null===(t=s.response)||void 0===t?void 0:t.status)&&(L(null),ae()),E(!1),q((0,c._G)(s)||c.So.RESUME_FAILURE)}finally{$(!1)}},className:"student-dash-btn student-dash-btn-accent student-dash-btn-block w-full mb-2",children:"Join Now"}),(0,b.jsx)("button",{type:"button",onClick:me,className:"student-dash-btn student-dash-btn-outline student-dash-btn-block w-full mt-2",children:"Maybe Later"})]})]})})}),document.body);return(0,b.jsxs)("div",{className:"student-dash-card student-dash-card-pad relative student-continue-learning-card",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-4 gap-2",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2.5 min-w-0",children:[(0,b.jsx)("div",{className:"w-5 h-5 student-dash-accent-text","aria-hidden":!0,children:(0,b.jsx)("svg",{className:"block size-full",fill:"currentColor",viewBox:"0 0 20 20",children:(0,b.jsx)("path",{d:"M11 3a1 1 0 10-2 0v1a1 1 0 102 0V3zM15.657 5.757a1 1 0 00-1.414-1.414l-.707.707a1 1 0 001.414 1.414l.707-.707zM18 10a1 1 0 01-1 1h-1a1 1 0 110-2h1a1 1 0 011 1zM5.05 6.464A1 1 0 106.464 5.05l-.707-.707a1 1 0 00-1.414 1.414l.707.707zM5 10a1 1 0 01-1 1H3a1 1 0 110-2h1a1 1 0 011 1zM8 16v-1h4v1a2 2 0 11-4 0v-1H8v1a2 2 0 114 0zM12 14c.015-.34.208-.646.477-.859a4 4 0 10-4.954 0c.27.213.462.519.476.859h4.002z"})})}),(0,b.jsx)(x.O,{children:"Continue Learning"}),K?(0,b.jsx)("p",{className:"student-dash-text-xs text-[color:var(--chart-1)]",role:"status",children:K}):null]}),(0,b.jsxs)("button",{type:"button",onClick:()=>{X(""),Y([...de]),Q(!0)},className:"student-dash-link relative z-10 flex shrink-0 items-center gap-2 cursor-pointer group rounded-lg px-1 py-1 -mr-1 focus:outline-none focus-visible:ring-2 focus-visible:ring-[color:var(--ring)] focus-visible:ring-offset-2","aria-haspopup":"dialog","aria-expanded":U,children:[(0,b.jsx)("svg",{className:"w-6 h-6 student-dash-primary-text shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":!0,children:(0,b.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",d:"M12 6V4m0 2a2 2 0 100 4m0-4a2 2 0 110 4m-6 8a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4m6 6v10m6-2a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4"})}),(0,b.jsx)("span",{className:"student-dash-primary-text whitespace-nowrap",children:"Personalize"})]})]}),(0,b.jsx)("div",{className:"flex flex-col sm:flex-row gap-3 w-full",children:(ce||[]).map(e=>{var t;const a=(null===(t=e.guidance)||void 0===t?void 0:t.title)||e.title,i="resume-session"===e.id&&!_,r=(0,b.jsxs)("button",{type:"button",onClick:()=>{i||(e=>{e.navigateTo?s(e.navigateTo):"resume-session"!==e.id?"practice-quiz"===e.id&&F(!0):ue()})(e)},disabled:i,"aria-disabled":i||void 0,"aria-label":a,className:"student-quick-action-btn student-dash-btn student-dash-btn-outline student-dash-primary-text flex w-full min-w-0 flex-1 items-center justify-center gap-2 text-base font-medium rounded-[12px] px-4 sm:px-6 py-3 h-auto transition-all disabled:opacity-50 border-2 border-[color:var(--primary)] hover:bg-[color-mix(in_srgb,var(--primary)_8%,var(--card))]",children:[(0,b.jsx)(y,{actionId:e.id}),(0,b.jsx)("span",{children:a})]});return(0,b.jsx)(n.Fragment,{children:C(e,r,"flex flex-1 w-full min-w-0")},e.id)})}),pe,(0,b.jsx)(o.A,{open:Boolean(z),errorType:z,onClose:()=>q(null),onPrimaryAction:()=>{q(null),s("/student/sessions")}}),he,(0,b.jsx)(m.A,{isOpen:M,onClose:()=>F(!1),onSelectMode:e=>{F(!1),"practice"===e?B(!0):"quiz"===e&&W(!0)}}),(0,b.jsx)(h.A,{isOpen:O,onClose:()=>B(!1)}),(0,b.jsx)(p.A,{isOpen:G,onClose:()=>W(!1)})]})}},62299(e,t,s){s.d(t,{A:()=>v});var n=s(9950),a=s(22875),i=s(63535),r=s(74923),l=s(74374),d=s(62677),o=s(51365),c=s(81454),u=s(44414);const m="/studentbadges/pm/pm-orange.png",h="Weekly Progress",p="Shows how many scheduled tutoring sessions you completed this week.";const v=function(e){let{name:t,grade:s,academicYear:v="",showAcademicOnly:g=!1,avatar:x,latestBadge:b,badgeShelf:f=null,learningStreakDays:y=null,userId:j=null,weeklyProgress:w=null}=e;
1const[N,S]=(0,n.useState)(!1),k=(0,n.useRef)(null);(0,n.useEffect)(()=>()=>{k.current&&window.clearTimeout(k.current)},[]);const I="welcomeCardAvatarFloat 2.5s ease-in-out infinite",C=(0,n.useMemo)(()=>{var e,t,s,n,a;const i=null!==(e=null===f||void 0===f||null===(t=f.categories)||void 0===t||null===(s=t.find(e=>"LJ"===e.categoryCode))||void 0===s?void 0:s.badges)&&void 0!==e?e:null===f||void 0===f||null===(n=f.categories)||void 0===n||null===(a=n[0])||void 0===a?void 0:a.badges;if(!Array.isArray(i))return null;const l=i.filter(e=>(0,r.Ft)(e));return(0,r.Kn)(l)},[f]),A=(0,n.useMemo)(()=>{const e=null!==b&&void 0!==b&&b.earned&&null!==b&&void 0!==b&&b.icon?b:null,t=null!==e&&void 0!==e&&e.achievedDate?new Date(e.achievedDate).getTime():0,s=null!==C&&void 0!==C&&C.achievedDate?new Date(C.achievedDate).getTime():0;return C&&e?s>=t?{icon:C.icon,name:C.name,label:C.name||C.id}:{icon:e.icon,name:e.name,label:e.name}:C?{icon:C.icon,name:C.name,label:C.name||C.id}:e?{icon:e.icon,name:e.name,label:e.name}:null},[b,C]),_=(0,n.useMemo)(()=>{const e=String(t||"").trim();return e?e.split(/\s+/)[0]:"Student"},[t]),L=(0,n.useMemo)(()=>null==y?null:(0,l.Cl)(y),[y]),P=(0,n.useMemo)(()=>(0,d.QP)(j),[j]),T=(0,n.useMemo)(()=>(0,d.qO)(P),[P]),R=(0,n.useMemo)(()=>(0,d.y0)({firstName:_,isFirstVisit:T,showAcademicOnly:g}),[_,T,g]);(0,n.useEffect)(()=>{T&&P&&(0,d.yT)(P)},[T,P]);const E=w||{},D=Math.max(0,Math.min(100,Number(E.percentage)||0)),$=null!=E.completed&&Number.isFinite(Number(E.completed))?Number(E.completed):null,z=null!=E.total&&Number.isFinite(Number(E.total))?Number(E.total):null,q=null!=z&&z>0,M=g&&null!=w,F=null!=E.schoolWeeklyRequirement&&Number(E.schoolWeeklyRequirement)>0?Number(E.schoolWeeklyRequirement):0,O=null!=E.schoolWeeklyCompleted?Number(E.schoolWeeklyCompleted):0,B=M?(0,u.jsx)("div",{className:"student-dash-welcome-progress",children:E.loadError?(0,u.jsxs)("div",{className:"student-dash-banner-warn student-dash-welcome-progress-error",children:[(0,u.jsxs)("div",{className:"flex items-center gap-2 min-w-0 mb-1",children:[(0,u.jsx)(c.O,{className:"truncate",children:h}),(0,u.jsx)(o.Ay,{text:p,ariaLabel:`${h}: ${p}`,showTitleInPopup:!1,showDelayMs:o.Nu})]}),(0,u.jsx)("p",{className:"student-dash-banner-warn-text",children:E.loadError}),E.onRetry?(0,u.jsx)("button",{type:"button",onClick:E.onRetry,className:"student-dash-link student-dash-link-accent mt-2 underline",children:"Retry"}):null]}):(0,u.jsxs)(u.Fragment,{children:[(0,u.jsxs)("div",{className:"student-dash-welcome-progress-head",children:[(0,u.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,u.jsx)(c.O,{className:"truncate",children:h}),(0,u.jsx)(o.Ay,{text:p,ariaLabel:`${h}: ${p}`,showTitleInPopup:!1,showDelayMs:o.Nu})]}),(0,u.jsxs)("p",{className:"student-dash-welcome-progress-pct shrink-0",children:[(0,u.jsxs)("span",{className:"font-bold",children:[D,"%"]}),(0,u.jsx)("span",{className:"student-dash-text-muted",children:" of scheduled sessions completed"})]})]}),(0,u.jsx)("div",{className:"student-dash-progress-track student-dash-welcome-progress-track",children:(0,u.jsx)("div",{className:"student-dash-progress-fill",style:{width:`${D}%`}})}),q?null!=$&&null!=z?(0,u.jsxs)("p",{className:"student-dash-welcome-progress-footnote",children:[$," of ",z," scheduled tutoring session",1===z?"":"s"," completed this week"]}):null:(0,u.jsx)("p",{className:"student-dash-welcome-progress-footnote",children:"No scheduled tutoring sessions this week"})]})}):null,G=g&&F>0?(0,u.jsxs)("div",{className:"student-dash-welcome-progress mt-4 rounded-lg border border-blue-200 bg-blue-50/80 p-4",children:[(0,u.jsx)("p",{className:"text-xs font-bold tracking-wide text-blue-700 uppercase",children:"Weekly session requirement"}),(0,u.jsxs)("p",{className:"mt-2 text-sm text-gray-800",children:["Your school requires ",F," tutoring session",1===F?"":"s"," per week."]}),(0,u.jsxs)("p",{className:"mt-1 text-sm font-semibold text-gray-900",children:["This week: ",Math.min(O,F)," of ",F," completed"]}),(0,u.jsx)("p",{className:"mt-2 text-xs text-gray-600",children:"Schedule a session to stay on track. This does not block tutoring access."})]}):null;if(g){const e=x&&x.trim()?(0,u.jsxs)("div",{className:"student-dash-welcome-avatar-wrap","aria-hidden":!0,
1children:[(0,u.jsx)("img",{src:x,alt:"",className:"w-full h-full object-cover",onError:e=>{e.target.style.display="none";const t=e.target.parentNode.querySelector(".fallback-icon");t&&(t.style.display="flex")}}),(0,u.jsx)(a.NBi,{className:"fallback-icon hidden absolute inset-0 m-auto w-14 h-14 student-dash-accent-text"})]}):(0,u.jsx)("div",{className:"student-dash-welcome-avatar-wrap student-dash-avatar-placeholder","aria-hidden":!0,children:(0,u.jsx)(a.NBi,{className:"w-14 h-14 student-dash-accent-text"})});return(0,u.jsxs)("div",{className:"student-dash-card student-dash-welcome-merged relative overflow-hidden",children:[(0,u.jsx)("style",{children:"\n          @keyframes welcomeCardDotPulse {\n            0%, 100% { opacity: 0.5; }\n            50% { opacity: 0.85; }\n          }\n        "}),(0,u.jsxs)("div",{className:"student-dash-welcome-badge-cluster","aria-hidden":!A,children:[(0,u.jsx)("span",{className:"student-dash-welcome-dot student-dash-welcome-dot--accent student-dash-welcome-dot--a",style:{animation:"welcomeCardDotPulse 2.5s ease-in-out infinite"},"aria-hidden":!0}),(0,u.jsx)("span",{className:"student-dash-welcome-dot student-dash-welcome-dot--chart student-dash-welcome-dot--b",style:{animation:"welcomeCardDotPulse 2.5s ease-in-out 0.4s infinite"},"aria-hidden":!0}),(0,u.jsx)("span",{className:"student-dash-welcome-dot student-dash-welcome-dot--accent student-dash-welcome-dot--c",style:{animation:"welcomeCardDotPulse 2.5s ease-in-out 0.8s infinite"},"aria-hidden":!0}),A?(0,u.jsx)("img",{src:A.icon,alt:"",className:"student-dash-welcome-deco-badge-img","aria-label":`Latest achievement: ${A.label}`,onError:e=>{e.currentTarget.src=m}}):null]}),(0,u.jsxs)("div",{className:"student-dash-welcome-merged-body relative z-[1]",children:[(0,u.jsxs)("section",{className:"student-dash-welcome-section","aria-label":"Welcome",children:[e,(0,u.jsxs)("div",{className:"student-dash-welcome-info min-w-0 flex-1",children:[(0,u.jsx)(c.xk,{className:"truncate",children:R}),(0,u.jsxs)("p",{className:"student-dash-welcome-grade break-words line-clamp-2",children:[(0,i.F)(s),(0,u.jsxs)("span",{className:"student-dash-text-muted",children:[" | ","Ready to learn something amazing today?"]})]})]})]}),L?(0,u.jsx)("div",{className:"student-dash-welcome-streak-mid",children:(0,u.jsxs)("span",{className:"student-dash-welcome-streak","aria-label":`Learning streak: ${L}`,children:[(0,u.jsx)("span",{className:"student-dash-welcome-streak-icon","aria-hidden":!0,children:"\ud83d\udd25"}),(0,u.jsx)("span",{className:"student-dash-welcome-streak-text",children:L})]})}):null,(0,u.jsxs)("section",{className:"student-dash-welcome-progress-section","aria-label":"Weekly Progress",children:[B,G]})]})]})}return(0,u.jsxs)("div",{className:"student-dash-card relative overflow-visible",children:[(0,u.jsx)("style",{children:"\n        @keyframes welcomeCardAvatarFloat {\n          0%, 100% { transform: translateY(-8px); }\n          50% { transform: translateY(0); }\n        }\n        @keyframes welcomeCardDotPulse {\n          0%, 100% { opacity: 0.5; }\n          50% { opacity: 0.85; }\n        }\n      "}),(0,u.jsx)("div",{className:"absolute top-4 right-24 w-2 h-2 student-dash-dot-accent opacity-60",style:{animation:"welcomeCardDotPulse 2.5s ease-in-out infinite"},"aria-hidden":!0}),(0,u.jsx)("div",{className:"absolute top-12 right-32 w-1.5 h-1.5 student-dash-dot-chart1 opacity-60",style:{animation:"welcomeCardDotPulse 2.5s ease-in-out 0.4s infinite"},"aria-hidden":!0}),(0,u.jsx)("div",{className:"absolute bottom-8 right-28 w-2 h-2 student-dash-dot-accent opacity-50",style:{animation:"welcomeCardDotPulse 2.5s ease-in-out 0.8s infinite"},"aria-hidden":!0}),(0,u.jsxs)("div",{className:"flex min-w-0 items-center student-dash-card-pad-sm justify-between gap-3",children:[(0,u.jsxs)("div",{className:"flex min-w-0 items-center flex-1 gap-3 sm:gap-6",children:[x&&x.trim()?(0,u.jsxs)("div",{className:"w-14 h-14 sm:w-[80px] sm:h-[80px] rounded-full overflow-hidden shrink-0 shadow-lg",style:{animation:I},"aria-hidden":!0,children:[(0,u.jsx)("img",{src:x,alt:"Student Avatar",className:"w-full h-full object-cover",onError:e=>{e.target.style.display="none";const t=e.target.parentNode.querySelector(".fallback-icon");t&&(t.style.display="block")}}),(0,u.jsx)(a.NBi,{className:"fallback-icon hidden absolute inset-0 w-full h-full student-dash-accent-text"})]}):(0,u.jsx)("div",{className:"w-14 h-14 sm:w-[80px] sm:h-[80px] rounded-full overflow-hidden shrink-0 student-dash-avatar-placeholder flex items-center justify-center shadow-lg",style:{animation:I}
1,"aria-hidden":!0,children:(0,u.jsx)(a.NBi,{className:"w-14 h-14 student-dash-accent-text"})}),(0,u.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,u.jsx)(c.xk,{className:"truncate",children:T?R:(0,u.jsxs)(u.Fragment,{children:["Welcome back,"," ",(0,u.jsx)("span",{className:"student-dash-primary-text",children:_})]})}),(0,u.jsxs)("p",{className:"student-dash-text break-words line-clamp-2",children:[(0,i.F)(s)," |"," ",(0,u.jsx)("span",{className:"student-dash-text-muted",children:"Ready to learn something amazing today?"})]})]})]}),(0,u.jsxs)("div",{className:"relative flex shrink-0 flex-col items-center",children:[(0,u.jsx)("button",{type:"button",onClick:()=>{A||(S(!0),k.current&&window.clearTimeout(k.current),k.current=window.setTimeout(()=>{S(!1),k.current=null},3e3))},className:"focus:outline-none rounded-2xl","aria-label":A?`Latest badge: ${A.label}`:"No badges earned yet",children:A?(0,u.jsx)("img",{src:A.icon,alt:"",className:"w-16 h-16 object-contain drop-shadow-md",onError:e=>{e.currentTarget.src=m}}):(0,u.jsx)("span",{className:"student-dash-badge-placeholder flex h-16 w-16 items-center justify-center rounded-2xl",title:"No badges yet \u2014 complete sessions and goals to earn your first badge",children:(0,u.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,u.jsx)("path",{d:"M6 9H4.5a2.5 2.5 0 0 1 0-5H6"}),(0,u.jsx)("path",{d:"M18 9h1.5a2.5 2.5 0 0 0 0-5H18"}),(0,u.jsx)("path",{d:"M4 22h16"}),(0,u.jsx)("path",{d:"M10 14.66v1.626a2 2 0 0 1-.976 1.696A5 5 0 0 0 7 21.978"}),(0,u.jsx)("path",{d:"M14 14.66v1.626a2 2 0 0 0 .976 1.696A5 5 0 0 1 17 21.978"}),(0,u.jsx)("path",{d:"M18 9H6a1 1 0 0 0-1 1v2a5 5 0 0 0 10 0v-2a1 1 0 0 0-1-1Z"})]})})}),!A&&N&&(0,u.jsx)("div",{className:"student-dash-card absolute top-full mt-2 w-48 border border-[var(--border)] shadow-lg student-dash-card-pad-sm student-dash-text-xs z-20",children:"You have yet to unlock any badge. Keep learning!"})]})]})]})}},76060(e,t,s){s.d(t,{$A:()=>S,$n:()=>c,Gu:()=>r,JI:()=>v,N8:()=>h,SE:()=>b,TF:()=>N,gZ:()=>x,h9:()=>y,jT:()=>g,pM:()=>j,qU:()=>p,re:()=>w,uR:()=>f,wI:()=>i});s(9950);var n=s(44414);const a=String("ATTENTION REQUIRED - COMPLETE THIS SO WE KNOW WHERE TO START").replace(/[^\x20-\x7E]/g," ").replace(/\s+/g," ").trim(),i="inline-flex items-center justify-center rounded-md border font-medium text-[10px] leading-none px-2 py-1 min-h-[1.375rem] whitespace-nowrap",r={"Readiness Check":`${i} student-dash-primary-text border-[color-mix(in_srgb,var(--primary)_25%,transparent)] bg-[color-mix(in_srgb,var(--primary)_8%,var(--card))]`,Practice:`${i} student-dash-chart1-text border-[color-mix(in_srgb,var(--chart-1)_25%,transparent)] bg-[color-mix(in_srgb,var(--chart-1)_8%,var(--card))]`,Quiz:`${i} text-[var(--chart-4)] border-[color-mix(in_srgb,var(--chart-4)_25%,transparent)] bg-[color-mix(in_srgb,var(--chart-4)_8%,var(--card))]`,Assessment:`${i} text-[var(--chart-4)] border-[color-mix(in_srgb,var(--chart-4)_25%,transparent)] bg-[color-mix(in_srgb,var(--chart-4)_8%,var(--card))]`,"Set up plan":`${i} student-dash-banner-warn student-dash-accent-text`,"Learning Plan":`${i} student-dash-chart1-text border-[color-mix(in_srgb,var(--chart-1)_25%,transparent)] bg-[color-mix(in_srgb,var(--chart-1)_8%,var(--card))]`,"Recommended Learning Path":`${i} student-dash-chart1-text border-[color-mix(in_srgb,var(--chart-1)_25%,transparent)] bg-[color-mix(in_srgb,var(--chart-1)_8%,var(--card))]`},l=`${i} text-[var(--chart-4)] border-[color-mix(in_srgb,var(--chart-4)_25%,transparent)] bg-[color-mix(in_srgb,var(--chart-4)_8%,var(--card))]`,d=`${i} student-dash-chart1-text border-[color-mix(in_srgb,var(--chart-1)_25%,transparent)] bg-[color-mix(in_srgb,var(--chart-1)_8%,var(--card))]`,o=`${i} text-[var(--destructive)] border-[color-mix(in_srgb,var(--destructive)_25%,transparent)] bg-[color-mix(in_srgb,var(--destructive)_8%,var(--card))]`,c=`${i} student-dash-text-muted border-[var(--border)] bg-[var(--muted)]`,u=`${i} student-dash-accent-text border-[color-mix(in_srgb,var(--accent-brand)_25%,transparent)] bg-[
1color-mix(in_srgb,var(--accent-brand)_8%,var(--card))]`,m=`${i} student-dash-banner-warn student-dash-accent-text border-[color-mix(in_srgb,var(--accent-brand)_25%,transparent)] bg-[color-mix(in_srgb,var(--accent-brand)_8%,var(--card))]`,h="border-2 border-[var(--accent-brand)] animate-[blink_1.5s_ease-in-out_infinite]",p="border border-[var(--border)]",v="student-dash-btn student-dash-btn-primary w-full rounded-full px-4 py-2.5 min-h-[2.5rem] text-[12px] font-medium flex items-center justify-center gap-2 transition-colors duration-150 shadow-sm hover:shadow-md disabled:opacity-60 disabled:cursor-not-allowed",g="student-dash-btn student-dash-btn-outline-accent w-full rounded-full px-4 py-2 min-h-[2.25rem] text-[11px] font-medium flex items-center justify-center gap-2 shadow-sm hover:shadow-md disabled:cursor-not-allowed",x="flex flex-wrap items-center gap-1.5 mb-1 min-w-0 w-full",b="student-dash-card rounded-xl h-full min-w-0 flex flex-col overflow-hidden student-ui-card-hover",f="flex flex-col flex-1 min-h-0 min-w-0 w-full p-3",y=b;function j(){return(0,n.jsx)("div",{className:"student-dash-btn-accent h-6 shrink-0 w-full overflow-hidden rounded-t-xl",children:(0,n.jsxs)("div",{className:"flex w-max animate-news-banner-marquee whitespace-nowrap items-center h-6 text-[11px] font-bold uppercase tracking-wide",children:[(0,n.jsx)("span",{className:"inline-flex items-center shrink-0 px-8",children:a}),(0,n.jsx)("span",{className:"inline-flex items-center shrink-0 px-8",children:a})]})})}function w(e){return"Completed"===e||"Baseline complete"===e?l:"In Progress"===e||"Readiness in progress"===e||"Ready to Start"===e?"Ready to Start"===e?c:d:c}function N(e){let{isOverdue:t=!1,submittedDone:s=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return s||"Completed"===e?l:t?o:"In Progress"===e||"Ready to Submit"===e?d:c}function S(e){return e?"Exam Preparation"===e.goal_type&&e.examName?{label:e.examName,className:u}:"Exam Preparation"===e.goal_type?{label:"Final Exam",className:u}:"Concept Mastery"===e.goal_type?{label:"Concept Mastery",className:m}:null:null}},59737(e,t,s){s.d(t,{A:()=>i});s(9950);var n=s(22875),a=s(44414);const i=function(e){let{isOpen:t,onClose:s,onSelectMode:i}=e;return t?(0,a.jsx)("div",{className:"fixed inset-0 bg-black/40 flex items-start justify-center z-50 pt-24 pb-8 px-4 overflow-y-auto",children:(0,a.jsxs)("div",{className:"bg-[var(--card)] rounded-2xl shadow-xl w-full max-w-[700px] p-6 sm:p-8 relative max-h-[90vh] overflow-y-auto",children:[(0,a.jsx)("button",{type:"button",onClick:s,className:"absolute top-4 right-4 student-dash-text-muted hover:student-dash-text p-2 rounded-lg hover:bg-[var(--muted)]","aria-label":"Close",children:"\u2715"}),(0,a.jsx)("h2",{className:"text-xl sm:text-2xl font-bold student-dash-text text-center mb-1",children:"Choose Your Mode"}),(0,a.jsx)("p",{className:"student-dash-text-muted text-sm text-center mb-6",children:"Do you want a short practice set or a full quiz simulation?"}),(0,a.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 sm:gap-6",children:[(0,a.jsxs)("div",{className:"rounded-xl border-2 border-[color-mix(in_srgb,var(--accent-brand)_30%,transparent)] bg-[var(--card)] p-5 sm:p-6 flex flex-col",children:[(0,a.jsx)("div",{className:"w-12 h-12 rounded-full bg-[color-mix(in_srgb,var(--primary)_12%,var(--card))] flex items-center justify-center mx-auto mb-3",children:(0,a.jsx)(n.vd0,{className:"student-dash-primary-text text-xl"})}),(0,a.jsx)("h3",{className:"text-lg font-bold student-dash-text text-center mb-2",children:"Practice Mode"}),(0,a.jsx)("p",{className:"student-dash-text-muted text-sm text-center flex-1",children:"Reinforce what you've already learned. Work on lessons you've completed to improve accuracy and speed."}),(0,a.jsxs)("button",{type:"button",onClick:()=>i("practice"),className:"mt-4 w-full inline-flex items-center justify-center gap-2 student-dash-btn student-dash-btn-primary font-medium py-2.5 px-4 rounded-xl transition-colors",children:[(0,a.jsx)(n.vd0,{className:"text-sm"})," Start Practice"]})]}),(0,a.jsxs)("div",{className:"rounded-xl border-2 border-[color-mix(in_srgb,var(--chart-4)_25%,transparent)] bg-[var(--card)] p-5 sm:p-6 flex flex-col",children:[(0,a.jsx)("div",{className:"w-12 h-12 rounded-full bg-[color-mix(in_srgb,var(--chart-4)_12%,var(--card))] flex items-center justify-center mx-auto mb-3",children:(0,a.jsx)(n.RBv,{className:"text-[var(--chart-4)] text-xl"})}),(0,a.jsx)("h3",{className:"text-lg font-bold student-dash-text text-center mb-2",children:"Qu
1iz Mode"}),(0,a.jsx)("p",{className:"student-dash-text-muted text-sm text-center flex-1",children:"Challenge yourself. Test your knowledge on topics not yet mastered."}),(0,a.jsxs)("button",{type:"button",onClick:()=>i("quiz"),className:"mt-4 w-full inline-flex items-center justify-center gap-2 bg-green-500 hover:bg-green-600 text-white font-medium py-2.5 px-4 rounded-xl transition-colors",children:[(0,a.jsx)(n.RBv,{className:"text-sm"})," Start Quiz"]})]})]}),(0,a.jsxs)("div",{className:"mt-6 rounded-xl bg-[color-mix(in_srgb,var(--chart-1)_10%,var(--card))] border border-[color-mix(in_srgb,var(--chart-1)_15%,transparent)] px-4 py-3 flex items-start gap-3",children:[(0,a.jsx)("div",{className:"w-8 h-8 rounded-lg bg-[color-mix(in_srgb,var(--chart-1)_12%,var(--card))] flex items-center justify-center shrink-0",children:(0,a.jsx)(n.y8Q,{className:"student-dash-chart1-text text-sm"})}),(0,a.jsx)("p",{className:"text-sm student-dash-text",children:"Not sure which to choose? Practice mode gives instant feedback, while Quiz mode simulates real test conditions."})]})]})}):null}},46504(e,t,s){function n(e){if(!e||"object"!==typeof e)return!1;if(e.hasReadinessCheckCompleted)return!1;if("boolean"===typeof e.hasReadinessCheckInProgress)return e.hasReadinessCheckInProgress;const t=String(e.quizStatus||"").toLowerCase().replace(/\s+/g,"_").replace(/-/g,"_");return"paused"===t||"started"===t}s.d(t,{A:()=>n})}}]);

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