1import{c as de,j as e,h as $,r as d,B as A,X as ue,f as me,e as xe,v as fe,o as q,S as v}from"./index-M0tRxxsp.js";import{C as w,a as y,b as V,c as J}from"./card-Cy23akvE.js";import{E as pe}from"./empty-state-2q5teHwP.js";import{E as Z}from"./error-state-BqCmJVXp.js";import{M as he}from"./MaterialReaderSheet-dPgPCuLu.js";import{B as P}from"./badge-JKyFBreg.js";import{S as ge}from"./StudyCard-BdzSUjQA.js";import{Q as je}from"./QuestionRenderer-Dped4DoS.js";import{B as be}from"./book-open-fJpcueNh.js";import{C as ee}from"./circle-x-DoLPBCod.js";import{C as Ne}from"./circle-check-C7RR3DHm.js";import{a as se}from"./time-vzfztzdR.js";import{T as we}from"./trending-up-SRw2_IJY.js";import{F as oe}from"./flame-CRv1olrV.js";import{T as ye}from"./target-DScrwg5q.js";import{C as ve}from"./compass-CL0TZIp7.js";import{A as ke}from"./arrow-right-B6revRjC.js";import{u as Se,c as Ce}from"./useFirstRun-Be6EZFJS.js";import{I as Ee}from"./InviteCourseCta-CM6suEmk.js";import"./index.esm-CFqn1pp7.js";import{u as Ae,a as $e,b as Ie,c as Te,d as Re,e as _e,i as Le}from"./usePlanSession-BBRNk0kU.js";import{u as Me}from"./useDocumentTitle-CmeMPrRl.js";import{L as Be}from"./loader-circle-CuSojwNb.js";import{L as Pe}from"./list-checks-CqzNQIzP.js";import{A as We}from"./arrow-left-Bff5-jDN.js";import"./useMaterial-D5B-Oxen.js";import"./useDecks-D_I8s5RU.js";import"./useActionLedger-1kvASJ-0.js";import"./useForge-BAoPQ37z.js";import"./layers-BR13aOZG.js";import"./chevron-down-ByLjaLrP.js";import"./external-link-BmXGYD58.js";import"./users-C1wQLAuS.js";import"./siren-YCDRhuVc.js";import"./hammer-BoN_ErP3.js";import"./message-square-PmC_PazT.js";import"./useInvites-Petebij5.js";import"./check-D5tU9ax3.js";import"./copy-sKQf5MQG.js";import"./link-2-BVX7rfsS.js";/** 2 * @license lucide-react v1.16.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const De=[["path",{d:"M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528",key:"1jaruq"}]],Oe=de("flag",De),qe=new Set(["flashcard","quiz","practice_problem","summary_bullet"]);function Fe(s){if(s.source!=="bank"||s.payload==null)return"unsupported";const t=s.itemType;return t&&qe.has(t)?t:"unsupported"}function He(s,t){if(s!=="quiz")return!1;const n=t==null?void 0:t.type;return n==="mcq"||n==="true_false"}function Ge(s,t){return t===null?null:s.type==="mcq"?typeof t=="number"?t===s.answerIndex:null:s.type==="true_false"&&typeof t=="boolean"?t===s.answer:null}function K(s){return s==="flashcard"||s==="quiz"||s==="practice_problem"}function ie(s){if(s==null||typeof s!="object"||Array.isArray(s))return{confidence:null,correct:null};const t=s,n=t.confidence;return{confidence:n==="sure"||n==="unsure"||n==="guess"?n:null,correct:typeof t.correct=="boolean"?t.correct:null}}const Ke={sure:"Sure",unsure:"Not sure",guess:"Guessing"},te=72;function ne(s){const t=s.trim().replace(/\s+/g," ");return t.length<=te?t:`${t.slice(0,te-1)}â¦`}function Ye(s){const t=s.payload;if(!t)return null;
6if(typeof t.topic=="string"&&t.topic.trim().length>0)return ne(t.topic);for(const n of["question","front","problem","text"]){const a=t[n];if(typeof a=="string"&&a.trim().length>0)return ne(a)}return null}function ze(s){const t=[],n=new Set;for(const a of s){const{confidence:r,correct:l}=ie(a.outcome);if(r!=="sure"||l!==!1)continue;const o=Ye(a);!o||n.has(o)||(n.add(o),t.push(o))}return t}const Ue="Source";function Xe(s,t){return s==null?"":t==null||t<=s?`p.${s}`:`p.${s}â${t}`}function Qe(s,t){const a=(s.materialId?t(s.materialId):void 0)??(s.noteId?"Your note":Ue),r=Xe(s.pageStart,s.pageEnd);return r?`${a} · ${r}`:a}const Ve={warmup:"Warm up",teach:"Learn",retrieve:"Recall",transfer:"Apply",review:"Review"};function U(s){return Ve[s]??s}function Je({card:s,revealed:t,onFlip:n}){return e.jsx(ge,{front:s.front,back:t?s.back:"",flipped:t,onFlip:n,keyTerms:s.tags??[]})}function Ze({question:s,value:t,onChange:n,revealed:a,correctness:r}){return e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("p",{className:"text-lg font-medium text-foreground",children:s.question}),e.jsx(je,{question:s,value:t,onChange:n,revealed:a,correctness:r}),a&&s.type==="short_answer"&&s.expectedAnswer?e.jsx(w,{children:e.jsxs(y,{className:"p-4",children:[e.jsx("p",{className:"text-xs uppercase tracking-wide text-muted-foreground",children:"Expected answer"}),e.jsx("p",{className:"mt-1 text-sm text-foreground",children:s.expectedAnswer})]})}):null]})}function es({problem:s,revealed:t,hintsShown:n,onShowHint:a}){const r=s.hints??[];return e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("p",{className:"whitespace-pre-wrap text-base text-foreground",children:s.problem}),r.slice(0,n).map((l,o)=>e.jsx(w,{children:e.jsxs(y,{className:"border-l-2 border-border p-3 text-sm text-muted-foreground",children:[e.jsxs("span",{className:"font-medium text-foreground",children:["Hint ",o+1,". "]}),l]})},o)),!t&&n<r.length?e.jsx("button",{type:"button",onClick:a,className:"self-start rounded-md px-2 py-1 text-sm text-primary hover:bg-muted/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",children:"Show a hint"}):null,t?e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs uppercase tracking-wide text-muted-foreground",children:"Solution"}),e.jsx("ol",{className:"mt-1 flex flex-col gap-1.5",children:s.solution_steps.map((l,o)=>e.jsxs("li",{className:"flex gap-2 text-sm text-foreground",children:[e.jsxs("span",{className:"text-muted-foreground",children:[o+1,"."]}
6),e.jsx("span",{className:"whitespace-pre-wrap",children:l})]},o))})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs uppercase tracking-wide text-muted-foreground",children:"Answer"}),e.jsx("p",{className:"mt-1 whitespace-pre-wrap text-sm font-medium text-foreground",children:s.answer})]})]}):null]})}function ss({text:s}){return e.jsx(w,{children:e.jsx(y,{className:$("border-l-2 border-primary p-4"),children:e.jsx("p",{className:"whitespace-pre-wrap text-base text-foreground",children:s})})})}function ts({itemType:s}){return e.jsx(w,{children:e.jsx(y,{className:"p-4",children:e.jsxs("p",{className:"text-sm text-muted-foreground",children:["This activity",s?` (${s})`:""," canât be shown here yet. You can skip past it â it wonât count against you."]})})})}const re=[{value:"sure",label:"Sure",key:"1"},{value:"unsure",label:"Not sure",key:"2"},{value:"guess",label:"Guessing",key:"3"}];function ns({onPick:s,disabled:t=!1,prompt:n}){return d.useEffect(()=>{if(t)return;function a(r){if(r.target instanceof HTMLInputElement||r.target instanceof HTMLTextAreaElement)return;const l=re.find(o=>o.key===r.key);l&&(r.preventDefault(),s(l.value))}return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[s,t]),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:n??"How sure are you?"}),e.jsx("div",{className:"grid grid-cols-3 gap-2",role:"group","aria-label":"How sure are you? This reveals the answer.",children:re.map(({value:a,label:r,key:l})=>e.jsxs("button",{type:"button",disabled:t,"data-confidence":a,onClick:()=>s(a),className:$("flex min-h-[56px] flex-col items-center justify-center gap-0.5 rounded-lg border border-border","bg-card text-sm font-medium text-foreground transition-colors","hover:bg-muted/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40","disabled:opacity-50"),children:[e.jsx("span",{children:r}),e.jsx("span",{className:"text-xs font-normal text-muted-foreground","aria-hidden":"true",children:l})]},a))})]})}function rs({sources:s,titleOf:t,onOpen:n}){return s.length===0?null:e.jsx("div",{className:"flex flex-wrap items-center gap-1.5",children:s.map((a,r)=>{const l=Qe(a,t),o=`${a.materialId??a.noteId??"src"}:${a.pageStart??0}:${r}`,i=e.jsxs(e.Fragment,{children:[e.jsx(be,{className:"h-3 w-3 shrink-0","aria-hidden":"true"}),e.jsx("span",{className:"truncate",children:l})]});return a.materialId?e.jsx("button",{type:"button",onClick:()=>n(a),"aria-label":`Open source: ${l}`,className:"inline-flex max-w-full items-center gap-1 rounded-md border border-border px-2 py-0.5 text-xs text-muted-foreground hover:bg-muted/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",children:i},o):e.jsx("span",{className:"inline-flex max-w-full items-center gap-1 rounded-md border border-border px-2 py-0.5 text-xs text-muted-foreground",children:i},o)})})}function as({activity:s,position:t,total:n,titleOf:a,onOpenSource:r,onReport:l,onComplete:o,onAdvance:i,isLast:m,submitting:h=!1}){const f=Fe(s),x=He(f,s.payload),k=f!=="unsupported",[g]=d.useState(()=>s.completedAt!==null),[S,u]=d.useState(g?"revealed":"prompt"),[j,_]=d.useState(null),[C,L]=d.useState(null),[b,F]=d.useState(null),[H,T]=d.useState(0),I=d.useMemo(()=>f!=="quiz"||!x?null:Ge(s.payload,C),[f,x,s.payload,C]),R=x?I:b,G=d.useCallback(c=>{_(c),u("revealed"),K(f)?x&&o({confidence:c,correct:I}):o({confidence:c,correct:null})},[f,x,I,o]),E=d.useCallback(c=>{j!==null&&(F(c),o({confidence:j,correct:c}))},[j,o]);d.useEffect(()=>{if(S!=="revealed"||x||!K(f)||j===null||b!==null)return;function c(p){p.target instanceof HTMLInputElement||p.target instanceof HTMLTextAreaElement||((p.key==="y"||p.key==="Y")&&(p.preventDefault(),E(!0)),(p.key==="n"||p.key==="N")&&(p.preventDefault(),E(!1)))}return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[S,x,f,j,b,E]);const N=S==="revealed",W=x&&C===null,M=N&&!x&&K(f)&&j!==null&&b===null,D=!k||g||N&&!M,O=j==="sure"&&R===!1;return e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-xs text-muted-foreground",children:[t," of ",n]}),e.jsx(P,{variant:"neutral",children:U(s.phase)}),g?e.jsx(P,{variant:"success",children:"Done"}):null]}),s.learningItemId?e.jsxs("button",{type:"button",onClick:()=>l(s.learningItemId),"aria-label":"Report a problem with this item",className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-muted-foreground hover:bg-muted/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",children:[e.jsx(Oe,{className:"h-3.5 w-3.5","aria-hidden":"true"}),"Report"]}):null]}),e.jsx(rs,{sources:s.sources,titleOf:a,onOpen:r}),e.jsx(cs,{kind:f,activity:s,revealed:N,answer:C,onAnswer:L,correctness:x&&I!==null?I:void 0,hintsShown:H,onShowHint:()=>T(c=>c+1)}),k&&!N&&!g?W?e.jsx("p",{className:"text-sm text-muted-foreground",children:"Choose an answer to continue. Youâll rate your confidence next."}):e.jsx(ns,{onPick:G,disabled:h,prompt:ls(f,x)}):null,N&&!g&&R!==null?e.jsx(is,{correct:R,confidentWrong:O}):null,g?e.jsx(os,{outcome:s.outcome}):null,N&&ae(s.payload)?e.jsx(w,{children:e.jsx(y,{className:$("border-l-2 p-4 text-sm text-foreground",R===!1?"border-warning":"border-success"),children:ae(s.payload)})}
6):null,M?e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Did you get it?"}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(A,{variant:"secondary",className:"min-h-[48px]",onClick:()=>E(!0),disabled:h,children:"Got it"}),e.jsx(A,{variant:"secondary",className:"min-h-[48px]",onClick:()=>E(!1),disabled:h,children:"Missed it"})]})]}):null,D?e.jsx(A,{className:"min-h-[48px] w-full",onClick:i,children:m?"Finish session":"Continue"}):null]})}function ls(s,t){return s==="summary_bullet"?"Did you already know this?":t?"How sure are you of that answer?":"How sure are you? This reveals the answer."}function ae(s){const t=s==null?void 0:s.explanation;return typeof t=="string"&&t.trim().length>0?t:null}function os({outcome:s}){const{confidence:t,correct:n}=ie(s);return t===null&&n===null?null:e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm text-muted-foreground",children:[e.jsx("span",{children:"You answered:"}),t?e.jsx(P,{variant:"neutral",children:Ke[t]}):null,n!==null?e.jsx(P,{variant:n?"success":"warning",children:n?"Correct":"Missed"}):null]})}function is({correct:s,confidentWrong:t}){return t?e.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-warning/60 bg-warning/10 p-3",children:[e.jsx(ee,{className:"mt-0.5 h-4 w-4 shrink-0 text-warning","aria-hidden":"true"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"Not quite â and you felt sure."}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Thatâs the most useful kind of miss. This one comes back later."})]})]}):e.jsxs("div",{className:$("flex items-center gap-2 rounded-lg border p-3",s?"border-success/40 bg-success/10":"border-border bg-muted/40"),children:[s?e.jsx(Ne,{className:"h-4 w-4 shrink-0 text-success","aria-hidden":"true"}):e.jsx(ee,{className:"h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":"true"}),e.jsx("p",{className:"text-sm font-medium text-foreground",children:s?"Correct":"Not quite"})]})}function cs({kind:s,activity:t,revealed:n,answer:a,onAnswer:r,correctness:l,hintsShown:o,onShowHint:i}){var m;switch(s){case"flashcard":return e.jsx(Je,{card:t.payload,revealed:n,onFlip:()=>{}});case"quiz":return e.jsx(Ze,{question:t.payload,value:a,onChange:r,revealed:n,correctness:l});case"practice_problem":return e.jsx(es,{problem:t.payload,revealed:n,hintsShown:o,onShowHint:i});case"summary_bullet":return e.jsx(ss,{text:String(((m=t.payload)==null?void 0:m.text)??"")});default:return e.jsx(ts,{itemType:t.itemType})}}function ds(s){return s.activities.length===0?0:s.activities.filter(n=>n.completedAt!==null).length/s.activities.length}function us({phases:s,activePhase:t}){return s.length===0?null:e.jsx("ol",{className:"flex items-stretch gap-2","aria-label":"Session phases",children:s.map(n=>{const a=ds(n),r=n.phase===t,l=a>=1;return e.jsxs("li",{className:"flex min-w-0 flex-1 flex-col gap-1.5","aria-current":r?"step":void 0,children:[e.jsx("div",{className:"h-1 w-full overflow-hidden rounded-full bg-muted",role:"progressbar","aria-valuemin":0,"aria-valuemax":n.activities.length,"aria-valuenow":n.activities.filter(o=>o.completedAt!==null).length,"aria-label":`${U(n.phase)} progress`,children:e.jsx("div",{className:$("h-full rounded-full motion-safe:transition-[width] motion-safe:duration-500",l?"bg-success":"bg-primary"),style:{width:`${Math.round(a*100)}%`}})}),e.jsx("span",{className:$("truncate text-xs",r?"font-medium text-foreground":"text-muted-foreground"),children:U(n.phase)})]},n.phase)})})}const ms=3,Y=2;function le(s){return s.length<=1?s[0]??"":`${s.slice(0,-1).join(", ")} and ${s[s.length-1]}`}function xs(s){if(s.length<=Y)return le(s);const t=s.length-Y;return`${le(s.slice(0,Y))} and ${t} more`}function z(s,t,n){return`${s} ${s===1?t:n}`}function fs(s,t){const n=xs(t);switch(s.action){case"reweight":return n?`more time on ${n}`:"time shifted toward your weaker concepts";case"swap_variant":return n?`harder variants of ${n}`:"harder variants of what you have mastered";case"inject_review":return n?`+${n} review`:`+${z(s.itemCount,"review item","review items")}`;case"reteach_requested":return n?`a fresh explanation of ${n}`:"a fresh explanation queued";case"warmup":return n?`a warm-up on ${n}`:"a warm-up on concepts you have not seen lately";case"trim":return n?`${n} trimmed â you have it`:`${z(s.itemCount,"item","items")} trimmed`;default:return z(s.itemCount,"change","changes")}
6}function ps(s,t,n=ms){if(s.length===0)return[];const a=new Map(t.map(r=>[r.conceptKey,r.displayName]));return s.slice(0,n).map((r,l)=>{const o=r.conceptKeys.map(i=>a.get(i)).filter(i=>typeof i=="string"&&i.length>0);return{key:`${r.sessionId}:${r.action}:${l}`,text:fs(r,o)}})}const hs=3;function B(s){return Math.max(0,Math.min(100,Math.round(s*100)))}function X(s){return s.basis==="recall_backed"}function gs({delta:s}){const t=s.after,n=s.before,a=s.delta;return X(s)?e.jsxs("li",{className:"flex flex-col gap-1.5",children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-2",children:[e.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:s.displayName}),a===null?e.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:n===null?"first pass":"not scored yet"}):e.jsxs("span",{className:$("shrink-0 text-xs font-medium",a>0?"text-success":a<0?"text-warning":"text-muted-foreground"),children:[a>0?"+":"",Math.round(a*100)," pts"]})]}),e.jsxs("div",{className:"relative h-2 w-full overflow-hidden rounded-full bg-muted",children:[n!==null?e.jsx("div",{className:"absolute inset-y-0 left-0 rounded-full bg-muted-foreground/30",style:{width:`${B(n)}%`},"aria-hidden":"true"}):null,t!==null?e.jsx("div",{className:$("plan-delta-fill absolute inset-y-0 left-0 rounded-full",a!==null&&a<0?"bg-warning":"bg-primary"),style:{width:`${B(t)}%`}}):null]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsxs("span",{children:[n===null?"no baseline":`${B(n)}%`," â ",t===null?"not scored":`${B(t)}%`]}),s.cappedByExposureCeiling?e.jsx("span",{title:"Held back until you've seen this in more than one session",children:"· capped by exposure"}):null]})]}):e.jsxs("li",{className:"flex flex-col gap-1.5",children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-2",children:[e.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:s.displayName}),e.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:"seen"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Evidence recorded. Syllavo wonât score this until youâve been tested on it."})]})}function js({receipt:s,sureButWrong:t,onNextSession:n,onBackToPlan:a}){const{session:r,deltas:l,weakConcepts:o,calibration:i,streak:m,nextSession:h,counts:f}=s,x=l.filter(u=>X(u)&&u.delta!==null&&u.delta>0).length,k=l.filter(X).length,g=t.slice(0,hs),S=ps(s.adaptations,l);return e.jsxs("div",{className:"mx-auto flex w-full max-w-2xl flex-col gap-5",children:[e.jsxs("div",{className:"plan-receipt-in flex flex-col items-center gap-2 text-center",children:[e.jsx("span",{className:"inline-flex h-11 w-11 items-center justify-center rounded-full bg-celebrate/10 text-celebrate-foreground",children:e.jsx(we,{className:"h-5 w-5","aria-hidden":"true"})}),e.jsxs("h1",{className:"text-2xl font-semibold text-foreground",children:["Session ",r.sequence," done"]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[f.completed," of ",f.activities," activities",r.plannedMinutes?` · ${se(r.plannedMinutes)} planned`:""]})]}),e.jsx(w,{children:e.jsxs(y,{className:"flex items-center justify-between gap-3 p-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(oe,{className:"h-4 w-4 text-celebrate","aria-hidden":"true"}),e.jsx("span",{className:"text-sm font-medium text-foreground",children:m.currentDays===1?"1 day streak":`${m.currentDays} day streak`})]}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["best ",m.longestDays===1?"1 day":`${m.longestDays} days`]})]})}),e.jsxs(w,{children:[e.jsx(V,{children:e.jsx(J,{children:"What moved"})}),e.jsx(y,{className:"p-4 pt-0",children:l.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No concepts were linked to this sessionâs items, so there is nothing to compare yet."}):e.jsxs(e.Fragment,{children:[s.hasBaseline?e.jsx("p",{className:"mb-3 text-sm text-muted-foreground",children:k===0?"Evidence recorded. Nothing here has been tested yet, so there is no score to move.":x===0?"Nothing climbed this time. That happens â the recall attempt still counts.":`${x} ${x===1?"concept":"concepts"} moved up.`}):e.jsx("p",{className:"mb-3 text-sm text-muted-foreground",children:"This session started before we snapshotted your baseline, so we can show where you are now but not how far you moved."}),e.jsx("ul",{className:"flex flex-col gap-4",children:l.map(u=>e.jsx(gs,{delta:u},u.conceptId))})]})})]}),g.length>0?e.jsx(w,{children:e.jsxs(y,{className:"flex flex-col gap-2 border-l-2 border-warning p-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ye,{className:"h-4 w-4 text-warning","aria-hidden":"true"}),e.jsxs("p",{className:"text-sm font-medium text-foreground",children:["You felt sure about ",g.length===1?"this":"these"," â and missed"," ",g.length===1?"it":"them"]})]}),e.jsx("ul",{className:"flex flex-col gap-1",children:g.map(u=>e.jsx("li",{className:"text-sm text-muted-foreground",children:u},u))}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"These are the gaps worth your next twenty minutes. Theyâll c
6ome back."})]})}):null,o.length>0?e.jsxs(w,{children:[e.jsx(V,{children:e.jsx(J,{children:"Still weakest"})}),e.jsx(y,{className:"flex flex-wrap gap-2 p-4 pt-0",children:o.map(u=>e.jsxs(P,{variant:"warning",children:[u.displayName,u.after!==null?` · ${B(u.after)}%`:""]},u.conceptId))})]}):null,i&&i.graded>0?e.jsx(w,{children:e.jsx(y,{className:"p-4",children:e.jsxs("p",{className:"text-sm text-muted-foreground",children:["You rated ",i.sampled," ",i.sampled===1?"answer":"answers"," â"," ",e.jsxs("span",{className:"text-foreground",children:[i.sure," sure"]}),","," ",i.unsure," not sure, ",i.guess," guessing.",i.overconfidence!==null?` ${Math.round(i.overconfidence*100)}% of your "sure" answers were wrong.`:""]})})}):null,S.length>0?e.jsx(w,{children:e.jsxs(y,{className:"flex flex-col gap-2 p-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ve,{className:"h-4 w-4 text-primary","aria-hidden":"true"}),e.jsx("p",{className:"text-sm font-medium text-foreground",children:"Next session adapts"})]}),e.jsx("ul",{className:"flex flex-col gap-1",children:S.map(u=>e.jsx("li",{className:"text-sm text-muted-foreground",children:u.text},u.key))})]})}):null,h?e.jsx(w,{children:e.jsxs(y,{className:"flex flex-col gap-3 p-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs uppercase tracking-wide text-muted-foreground",children:"Up next"}),e.jsxs("p",{className:"mt-0.5 text-sm font-medium text-foreground",children:["Session ",h.sequence," · ",h.title]}),h.plannedMinutes?e.jsxs("p",{className:"text-xs text-muted-foreground",children:["about ",se(h.plannedMinutes)]}):null]}),e.jsxs(A,{className:"min-h-[48px] w-full",onClick:()=>n(h.id),children:["Start session ",h.sequence,e.jsx(ke,{className:"ml-2 h-4 w-4","aria-hidden":"true"})]})]})}):e.jsx(A,{className:"min-h-[48px] w-full",onClick:a,children:"Back to plan"}),h?e.jsx(A,{variant:"ghost",className:"w-full",onClick:a,children:"Back to plan"}):null]})}const bs=[{value:"wrong_answer",label:"The answer is wrong"},{value:"unsupported",label:"This isn't in the source material"},{value:"confusing",label:"The question is confusing"},{value:"typo",label:"Typo or formatting problem"},{value:"other",label:"Something else"}];function Ns({onSelect:s,onClose:t,pending:n=!1}){const a=d.useRef(null);return d.useEffect(()=>{function r(l){l.key==="Escape"&&t()}return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[t]),d.useEffect(()=>{var r;(r=a.current)==null||r.focus()},[]),e.jsxs("div",{className:"fixed inset-0 z-50 flex items-end justify-center sm:items-center",children:[e.jsx("button",{type:"button","aria-label":"Close report panel",className:"absolute inset-0 bg-foreground
6/40",onClick:t}),e.jsxs("div",{ref:a,tabIndex:-1,role:"dialog","aria-modal":"true","aria-label":"Report a problem with this item",className:"plan-sheet-in relative w-full max-w-md rounded-t-2xl border border-border bg-card p-5 shadow-raised focus:outline-none sm:rounded-2xl",children:[e.jsxs("div",{className:"mb-3 flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-semibold text-foreground",children:"Whatâs wrong with this item?"}),e.jsx("p",{className:"mt-0.5 text-sm text-muted-foreground",children:"Weâll stop using it in future sessions."})]}),e.jsx("button",{type:"button",onClick:t,"aria-label":"Close",className:"rounded-md p-1 text-muted-foreground hover:bg-muted/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",children:e.jsx(ue,{className:"h-4 w-4","aria-hidden":"true"})})]}),e.jsx("div",{className:"flex flex-col gap-2",children:bs.map(({value:r,label:l})=>e.jsx("button",{type:"button",disabled:n,"data-reason":r,onClick:()=>s(r),className:"min-h-[44px] rounded-lg border border-border px-4 py-2 text-left text-sm text-foreground hover:bg-muted/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40 disabled:opacity-50",children:l},r))}),e.jsx(A,{variant:"ghost",className:"mt-3 w-full",onClick:t,disabled:n,children:"Cancel"})]})]})}function ws({sessionId:s,isCompleted:t}){var m;const n=Se(),a=Ce(),r=d.useRef(!1),l=((m=n.data)==null?void 0:m.timings.firstWinAt)!=null,o=t&&!!s&&n.isSuccess&&!l;d.useEffect(()=>{!o||r.current||(r.current=!0,a.mutate({rung:"quick_session",sessionId:s}))},[o,a,s]);const i=a.data;return!i||i.alreadyRecorded||i.streakDays===null?null:e.jsx("div",{className:"mx-auto w-full max-w-2xl rounded-xl border border-border bg-card p-4",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(oe,{className:"h-4 w-4 text-celebrate","aria-hidden":"true"}),e.jsxs("p",{className:"text-sm font-medium text-foreground",children:["That was your first session on Syllavo â day ",i.streakDays,"."]})]})})}function it(){var M,D,O;const{planId:s,sessionId:t}=me(),n=xe(),a=Ae(s),r=$e(s,t),l=((M=a.data)==null?void 0:M.courseId)??null,o=fe(l??void 0),i=((D=r.data)==null?void 0:D.session.status)==="completed",m=Ie(s,t,i),h=Te(s,t,l),f=Re(s,t),x=_e(),[k,g]=d.useState(null),[S,u]=d.useState(null),[j,_]=d.useState(null),[C,L]=d.useState(null),b=((O=r.data)==null?void 0:O.activities)??[];d.useEffect(()=>{var c;!r.data||!t||S===t||(g(((c=r.data.resumeCursor)==null?void 0:c.index)??0),u(t))},[r.data,t,S]),Me(r.data?`Session ${r.data.session.sequence} · ${r.data.session.title}`:"Session");const F=d.useCallback(c=>{var p,Q;return(Q=(p=o.data)==null?void 0:p.materials.find(ce=>ce.id===c))==null?void 0:Q.title},[o.data]),H=d.useMemo(()=>{var c;return((c=o.data)==null?void 0:c.materials.map(p=>p.id))??[]},[o.data]),T=d.useCallback(()=>{s&&n(`/plans/${s}`)},[n,s]),I=d.useCallback((c,p)=>{h.mutate({activityId:c,confidence:p.confidence,correct:p.correct},{onError:()=>q.error("We could not save that answer. Check your connection.")})},[h]),R=d.useCallback(()=>{if(k!==null){if(k+1<b.length){g(k+1);return}f.mutate(void 0,{onError:()=>q.error("We could not finish the session. Try that once more.")})}},[k,b.length,f]),G=d.useCallback(c=>{C&&x.mutate({itemId:C,reason:c},{onSuccess:p=>{L(null),q.success(p.alreadyReported?"You already flagged this one â thanks.":"Thanks. We won't use this item again.")},onError:()=>q.error("We could not send that report.")})},[C,x]);if(r.isPending)return e.jsxs("div",{className:"mx-auto flex w-full max-w-2xl flex-col gap-4 p-4",children:[e.jsx(v,{className:"h-4 w-32"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(v,{className:"h-1 flex-1"}),e.jsx(v,{className:"h-1 flex-1"}),e.jsx(v,{className:"h-1 flex-1"})]}),e.jsx(v,{className:"h-5 w-48"}),e.jsx(v,{className:"h-[340px] w-full"}),e.jsx(v,{className:"h-14 w-full"})]});if(r.isError)return e.jsx("div",{className:"mx-auto w-full max-w-2xl p-4",children:e.jsx(Z,{title:"We couldn't load this session",error:r.error,onRetry:()=>void r.refetch()})});if(Le(r.data))return e.jsx("div",{className:"mx-auto w-full max-w-2xl p-4",children:e.jsxs("div",{role:"status","aria-live":"polite",className:"flex flex-col items-center gap-3 rounded-xl border border-border bg-card p-8 text-center",children:[e.jsx(Be,{className:"h-6 w-6 animate-spin text-muted-foreground motion-reduce:animate-none","aria-hidden":"true"}),e.jsx("p",{className:"text-base font-medium text-foreground",children:"Building this session"}),e.jsx("p",{className:"max-w-sm text-sm text-muted-foreground",children:"We are assembling it from your materials â usually under a minute. This page updates itself, so there is nothing to click."}),e.jsx(A,{variant:"secondary",className:"mt-2",onClick:T,children:"Back to plan"})]})});if(!r.data||b.length===0)return e.jsx("div",{className:"mx-auto w-full max-w-2xl p-4",children:e.jsx(pe,{icon:e.jsx(Pe,{className:"mx-auto h-6 w-6 text-muted-foreground","aria-hidden":"true"}),title:"This session has no activities yet",description:"It hasn't been prepared, or its sources had nothing usable in them. Head back to the plan and prepare it.",children:e.jsx(A,{className:"mt-4",onClick:T,children:"Back to plan"})})});if(i)return m.isPending?e.jsxs("div",{className:"mx-auto flex w-full max-w-2xl flex-col gap-4 p-4",children:[e.jsx(v,{className:"h-8 w-48"}),e.jsx(v,{className:"h-20 w-full"}),e.jsx(v,{className:"h-40 w-full"}),e.jsx(v,{className:"h-14 w-full"})]}):m.isError||!m.data?e.jsx("div",{className:"mx-auto w-full max-w-2xl p-4",children:e.jsx(Z,{title:"We couldn't load your session summary",description:"Your answers are saved. The summary just didn't load.",error:m.error,onRetry:()=>void m.refetch()})}):e.jsxs("div",{className:"flex flex-col gap-4 p-4",children:[e.jsx(ws,{sessionId:t,isCompleted:i}),e.jsx(js,{receipt:m.data,sureButWrong:ze(b),onNextSession:c=>{s&&n(`/plans/${s}/sessions/${c}`)},onBackToPlan:T}
6),l?e.jsx(Ee,{courseId:l,variant:"inline"}):null]});const E=Math.min(k??0,b.length-1),N=b[E],W=r.data.counts;return e.jsxs("div",{className:"mx-auto flex w-full max-w-2xl flex-col gap-5 p-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("button",{type:"button",onClick:T,className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-sm text-muted-foreground hover:bg-muted/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",children:[e.jsx(We,{className:"h-4 w-4","aria-hidden":"true"}),"Plan"]}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[W.completed,"/",W.total," done"]})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("h1",{className:"text-lg font-semibold text-foreground",children:["Session ",r.data.session.sequence," · ",r.data.session.title]}),e.jsx(us,{phases:r.data.phases,activePhase:(N==null?void 0:N.phase)??null})]}),e.jsx(w,{children:e.jsx(y,{className:"p-4",children:e.jsx(as,{activity:N,position:E+1,total:b.length,titleOf:F,onOpenSource:_,onReport:L,onComplete:c=>I(N.id,c),onAdvance:R,isLast:E===b.length-1,submitting:h.isPending||f.isPending},N.id)})}),C?e.jsx(Ns,{onSelect:G,onClose:()=>L(null),pending:x.isPending}):null,j!=null&&j.materialId&&l?e.jsx(he,{courseId:l,materialId:j.materialId,orderedIds:H,anchorPage:j.pageStart,onClose:()=>_(null),onNavigate:c=>_({...j,materialId:c,pageStart:null,pageEnd:null})}):null]})}export{it as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.