PageSourceSearch

https://app.idrivesafely.com/assets/TopicFlowRoute-BPe6_2zv.js

js idrivesafely.com collected 2026-10-02 03:35:35 UTC 31,576 bytes, 2 lines download raw bytes

1import{gT as Pe,a2 as Fe,gU as Be,gV as $e,D as i,gW as se,gX as ae,gY as qe,gZ as Ke,g_ as ze,g$ as q,G as a,a9 as B,V as _,U as V,be as ke,bf as Te,bp as Ge,bq as Ye,aS as Xe,aT as Ze,bg as We,aW as Je,bc as Ee,T as ue,cS as et,cU as tt,cV as ie,cX as st,cY as at,bV as nt,Y as rt,x as ot,z as me,ag as it,d3 as lt,d7 as dt,h0 as ct,h1 as ut,bO as ye}from"./index-CL22zKs4.js";import{u as pt}from"./useAceModeName-w_c6oRMV.js";import{S as U}from"./index-Cy2i7PTh.js";import{S as G}from"./studyPlanAnalytics-SWDhFk7Q.js";import{S as ne}from"./Skeleton-COOlBzv7.js";import{i as ht,r as mt,h as yt,g as gt,a as ft,I as xt,c as vt,d as re,s as bt,K as St,T as Ct,M as jt,D as At,e as wt,f as Pt,v as kt,u as Tt,C as Et,S as Nt}from"./drag-handle-small-B08xv3PR.js";import{F as Mt,T as ge,I as fe,a as xe,b as It,B as Rt,D as Ut,R as _t}from"./FlashCard-Dj7J_0m8.js";import{C as Lt}from"./chevron-DvJAmwsf.js";import{u as Dt}from"./progress-test-grade-Cpx5oC8A.js";import{H as Qt}from"./HiddenHotspotMarkerField-KuA2ANBP.js";import{V as Ne}from"./VideoPlayer-DvYf3j_Q.js";import{R as Vt,C as Ot,T as Ht,P as Ft}from"./index-9cdLSaDP.js";import{R as Bt,I as $t}from"./index-B7vlcZQO.js";import"./chevron-left-BG-SLm_5.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};e.SENTRY_RELEASE={id:"[email protected]"};var t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="d2da2b86-3db6-4c90-8f75-21feee82492e",e._sentryDebugIdIdentifier="sentry-dbid-d2da2b86-3db6-4c90-8f75-21feee82492e")}catch{}})();const ve=e=>({activeTopicId:e,activity:null,currentActivityIndex:0,errorMessage:null,hasAdvanced:!1,isAccessDenied:!1,isResumed:!1,masteryScoreAtStart:null,masteryToken:null,phase:"loading",plan:{completedActivityCount:0,totalActivityCount:0}}),Y=(e,t)=>t&&t.totalActivityCount>0?t:e,qt=(e,t)=>{const s=e.findIndex(r=>
1r.id===t);return(s===-1?e:e.slice(s+1)).find(r=>!r.status||Pe(r.status))},X=e=>e.status===200,Kt=3,be={refetchType:"none"},zt=({studyPlanId:e,topicId:t,topics:s,onPlanComplete:n,onOrphanedContent:r,onRolledOver:o,onTopicChange:l})=>{const u=Fe(),f=Be(),j=$e(),{isPending:x,mutate:Q}=f,{isPending:R,mutateAsync:k}=j,L=i.useRef(!1),w=i.useRef(null),E=i.useRef(null),I=i.useRef(0),O=i.useRef(s),[g,p]=i.useState(()=>ve(t));i.useEffect(()=>{O.current=s},[s]),i.useEffect(()=>{if(w.current===t){w.current=null;return}L.current=!1,I.current=0,p(ve(t))},[e,t]);const T=i.useCallback(()=>{p(c=>({...c,activity:null,errorMessage:null,phase:"redirectingToResults"})),n()},[n]),F=i.useCallback(()=>{se(u,e),ae(u),T()},[u,T,e]),S=i.useCallback(()=>{p(c=>({...c,activity:null,errorMessage:null,phase:"redirectingToResults"})),se(u,e),ae(u),r()},[r,u,e]),D=i.useCallback(()=>{se(u,e,be),ae(u,be)},[u,e]),v=i.useCallback((c,d,b)=>{E.current=d,p(y=>({...y,activeTopicId:b??y.activeTopicId,errorMessage:c,phase:"error"}))},[]),A=i.useCallback(c=>qe(c)?(p(d=>({...d,errorMessage:null,isAccessDenied:!0})),!0):Ke(c)?(o(),!0):ze(c)?(S(),!0):!1,[S,o]),P=i.useCallback(c=>new Promise((d,b)=>{Q({studyPlanId:e,topicId:c},{onSuccess:d,onError:b})}),[Q,e]),N=i.useCallback((c,d,b,y=!0)=>{E.current=null,y&&(I.current=0),p(h=>({...h,activeTopicId:c,activity:d.data.activity,currentActivityIndex:d.data.currentActivityIndex,errorMessage:null,hasAdvanced:b??h.hasAdvanced,isAccessDenied:!1,isResumed:d.data.isResumed,masteryScoreAtStart:d.data.masteryScoreAtStart,masteryToken:d.data.masteryToken,phase:"activity",plan:Y(h.plan,d.data.plan)}))},[]),M=i.useCallback(async c=>{let d=c;const b=O.current.length+1;for(let y=0;y<b;y+=1){const h=qt(O.current,d);if(!h){F();return}p(C=>({...C,activeTopicId:h.id,activity:null,errorMessage:null,phase:"loading"})),w.current=h.id,l(h.id);try{const C=await P(h.id);if(!X(C)){v("Unable to start this topic.","start",h.id);return}N(h.id,C);return}catch(C){if(A(C))return;if(q(C)){I.current+=1,console.info("Study plan topic already finished, skipping",{topicId:h.id}),d=h.id;continue}v("Unable to start this topic.","start",h.id);return}}v("Unable to start this topic.","start")},[N,A,F,l,v,P]),m=i.useCallback(async c=>{if(c===null){T();return}p(d=>({...d,activeTopicId:c,activity:null,errorMessage:null,phase:"loading"})),w.current=c,l(c);try{const d=await P(c);if(!X(d)){v("Unable to start this topic.","start",c);return}N(c,d)}catch(d){if(A(d))return;if(q(d)){M(c);return}v("Unable to start this topic.","start",c)}},[N,A,l,T,v,M,P]),H=i.useCallback(async c=>{if(!(!e||!c)){L.current=!0,p(d=>({...d,activeTopicId:c,errorMessage:null,phase:"loading"}));try{const d=await P(c);if(!X(d)){v("Unable to start this topic.","start");return}N(c,d,!1)}catch(d){if(A(d))return;if(q(d)){M(c);return}v("Unable to start this topic.","start")}}},[N,A,v,M,P,e]);i.useEffect(()=>{!e||!t||L.current||H(t)},[H,e,t]);const z=i.useCallback(async c=>{p(d=>({...d,activeTopicId:c,activity:null,errorMessage:null,phase:"loading"}));try{const d=await P(c);if(!X(d)){v("Unable to advance this activity.","advance",c);return}N(c,d,void 0,!1)}catch(d){if(A(d))return;if(q(d)){M(c);return}v("Unable to advance this activity.","advance",c)}},[N,A,v,M,P]),$=i.useCallback(async()=>{const c=g.phase==="error"&&E.current==="advance";if(!g.activity||R||g.phase!=="activity"&&!c)return;E.current=null,p(y=>({...y,errorMessage:null,phase:"activity"}));let d;try{d=await k({studyPlanId:e,topicId:g.activeTopicId,data:{expectedActivityIndex:g.currentActivityIndex}})}catch(y){if(A(y))return;if(q(y)){if(I.current+=1,I.current>=Kt){M(g.activeTopicId);return}z(g.activeTopicId);return}v("Unable to advance this activity.","advance");return}if(d.status!==200){v("Unable to advance this activity.","advance");return}I.current=0;const b=d.data;if(b.outcome==="topic_in_progress"){D(),p(y=>({...y,activity:b.activity,currentActivityIndex:b.currentActivityIndex,errorMessage:null,hasAdvanced:!0,phase:"activity",plan:Y(y.plan,b.plan)}));return}if(b.outcome==="topic_completed"){console.info("Study plan topic completed",{delta:b.delta,topicId:b.topicId}),D(),p(y=>({...y,hasAdvanced:!0,plan:Y(y.plan,b.plan)})),m(b.nextTopicId);return}p(y=>({...y,activity:null,errorMessage:null,hasAdvanced:!0,phase:"redirectingToResults",plan:Y(y.plan,b.plan)})),D(),n()},[k,A,D,R,n,z,v,M,m,g.activeTopicId,g.activity,g.currentActivityIndex,g.phase,e]),ee=i.useCallback(()=>
1{if(E.current==="start"){H(g.activeTopicId||t);return}E.current==="advance"&&$()},[$,H,g.activeTopicId,t]),te=i.useCallback(c=>{p(d=>({...d,masteryToken:c}))},[]);return{...g,advance:$,retry:ee,updateMasteryToken:te,isAdvancing:R,isStarting:g.phase==="loading"||x&&!g.activity,isRedirectingToResults:g.phase==="redirectingToResults"}},Gt=({completedActivityCount:e,totalActivityCount:t})=>t<=0?null:Math.min(100,Math.max(0,e/t*100));class K extends Error{}K.prototype.name="InvalidTokenError";function Yt(e){return decodeURIComponent(atob(e).replace(/(.)/g,(t,s)=>{let n=s.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n}))}function Xt(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return Yt(t)}catch{return atob(t)}}function Zt(e,t){if(typeof e!="string")throw new K("Invalid token specified: must be a string");t||(t={});const s=t.header===!0?0:1,n=e.split(".")[s];if(typeof n!="string")throw new K(`Invalid token specified: missing part #${s+1}`);let r;try{r=Xt(n)}catch(o){throw new K(`Invalid token specified: invalid base64 for part #${s+1} (${o.message})`)}try{return JSON.parse(r)}catch(o){throw new K(`Invalid token specified: invalid json for part #${s+1} (${o.message})`)}}const Wt=e=>e?.type==="VIDEO",Jt=e=>e?.type==="FLASHCARD",es=e=>e?.type==="QUESTION",Me=e=>!!(e&&typeof e=="object"),le=(e,t="")=>typeof e=="string"||typeof e=="number"||typeof e=="boolean"?String(e):t,de=e=>{const t=le(e);return t||void 0},ts=e=>{if(!Me(e))return;const{x:t,y:s,diameter:n,w:r,h:o}=e;if(typeof t!="number"||typeof s!="number")return;const l={x:t,y:s};return typeof n=="number"&&(l.diameter=n),typeof r=="number"&&(l.w=r),typeof o=="number"&&(l.h=o),yt(l)?l:void 0},ss=e=>(e??[]).flatMap((t,s)=>{if(!Me(t))return[];const n=le(t.key??t._id??t.id,String(s)),r=le(t.value??t.text??t.label??t.answer),o=de(t.id??t._id),l=ts(t.meta);return[{key:n,value:r,...o?{id:o}:{},...l?{meta:l}:{},isCorrect:typeof t.isCorrect=="boolean"?t.isCorrect:void 0,isSelected:typeof t.isSelected=="boolean"?t.isSelected:void 0}]}),as=e=>ss(e.payload.answerList?.length?e.payload.answerList:e.payload.choiceList),Z=e=>typeof e.payload.template=="string"?e.payload.template:"",ns=e=>Z(e)==="QUESTION_TEMPLATE_7",rs=e=>Z(e)==="QUESTION_ORDERED_LIST",Ie=e=>Z(e)==="QUESTION_CLICKABLE_IMAGE",os=e=>Z(e)==="QUESTION_VIDEO",Re=e=>mt(e.payload.requiredMarkerCount),is=e=>ht({isClickableImage:Ie(e),isHiddenHotspot:e.payload.isHiddenHotspot,requiredMarkerCount:Re(e)}),ls=e=>typeof e.payload.imageUrl=="string"&&e.payload.imageUrl?e.payload.imageUrl:null,oe=e=>typeof e.payload.altImageText=="string"&&e.payload.altImageText?e.payload.altImageText:void 0,ds=e=>e.filter(t=>!!t.meta),cs=(e,t,s)=>{const n=e.findIndex(o=>o.key===t),r=e.findIndex(o=>o.key===s);return n===-1||r===-1||n===r?e:gt(e,n,r)},us=(e,t)=>{const s=t&&e.payload.videoExplanation?e.payload.videoExplanation:e.payload.video,n=de(s?.streamingUrl)??de(s?.streamUrl);return s&&n?{...s,streamUrl:n}:null},ps=e=>{if(e)try{const t=Zt(e);return typeof t.progressTestId=="string"?t.progressTestId:void 0}catch{return}},hs=(e,t)=>ps(t)??e.payload.source.test?._id??e.payload._id,ms=e=>e.payload.isSingleChoice!==!1,Ue=i.createContext(null),W=()=>{const e=i.useContext(Ue);if(!e)throw new Error("StudyPlanActivityNavigation compound components must be rendered inside Root.");return e},J=({actionLabel:e="",pendingLabel:t="Loading...",actionTestId:s,actionType:n="arrow",disabled:r=!1,isPending:o=!1,onAction:l})=>{const{setAction:u}=W(),f=i.useRef(l);f.current=l;const j=i.useCallback(()=>{f.current()},[]);i.useEffect(()=>(u({actionLabel:e,pendingLabel:t,actionTestId:s,actionType:n,disabled:r||o,isPending:o,onAction:j}),()=>{u(null)}),[e,s,n,r,j,o,t,u])},_e=({className:e,...t})=>a.jsx("div",{className:_("flex min-h-20 w-full items-center gap-2 px-0 py-4",e),...t}),Le=()=>{const{onExit:e}=W();return a.jsx("div",{className:"flex min-w-0 flex-1 shrink-0",children:a.jsx(B,{type:"button",variant:"text-primary",onClick:e,"data-test":"studyPlanSaveAndExit","aria-label":"Save and Exit",className:"h-11 w-full justify-start px-4 active:bg-control
1s-menu-active-old hover:bg-controls-menu-active-old hover:text-controls-primary-old! focus-visible:text-controls-primary-old!",children:"Save and Exit"})})},De=()=>{const{action:e}=W();if(!e)return null;const{actionLabel:t,actionTestId:s,actionType:n,disabled:r,isPending:o,onAction:l,pendingLabel:u}=e,f=o&&t?u:t,j=n==="label"?f:"Next";return a.jsx("div",{className:"flex min-w-0 flex-1 shrink-0 justify-end",children:a.jsxs(B,{type:"button",variant:"text-primary",onClick:l,disabled:r,"data-test":s,"aria-label":j,className:"h-11 w-full justify-end px-4 active:bg-controls-menu-active-old hover:bg-controls-menu-active-old hover:text-controls-primary-old! focus-visible:text-controls-primary-old!",children:[n==="label"?f:null,a.jsx(Lt,{direction:"right","aria-hidden":"true",className:r?"text-control-disabled-text":"text-control-secondary"})]})})},ys=({children:e,onExit:t})=>{const[s,n]=i.useState(null),r=i.useMemo(()=>({action:s,setAction:n,onExit:t}),[s,t]);return a.jsx(Ue.Provider,{value:r,children:e})},Se=()=>{const{action:e}=W();return e?a.jsx("nav",{"data-test":"studyPlanActivityNavigation",className:"sticky bottom-0 z-40 mt-auto flex w-full flex-col border-t border-divider-line-light bg-background-secondary desktop:fixed desktop:bottom-6 desktop:left-1/2 desktop:w-[800px] desktop:-translate-x-1/2 desktop:rounded-lg desktop:border-t-0 desktop:shadow-card-floating",children:a.jsxs(_e,{children:[a.jsx(Le,{}),a.jsx(De,{})]})}):null},Ce=Object.assign(Se,{Provider:ys,Root:Se,Row:_e,ExitButton:Le,ActionButton:De}),gs=({activity:e,isAdvancing:t,onAdvance:s})=>{const[n,r]=i.useState(!1),{text:o,answer:l,imageUrl:u,imageAltTag:f}=e.payload,j=!!u;J({actionTestId:"studyPlanNextActivity",disabled:!n||t,isPending:t,onAction:s});const x=i.useMemo(()=>a.jsxs(a.Fragment,{children:[a.jsxs(Mt,{children:[a.jsx(ge,{"data-test":"termFront",children:o}),u?a.jsx(fe,{children:a.jsx(xe,{src:u,title:f,alt:f})}):null,a.jsx(It,{children:"Tap to reveal"})]}),a.jsxs(Rt,{children:[a.jsx(ge,{"data-test":"termBack",children:o}),u?a.jsx(fe,{children:a.jsx(xe,{src:u,alt:f})}):null,a.jsx(Ut,{"data-test":"studyPlanFlashcardAnswer",className:j?"mt-0!":"",children:l})]})]}),[o,l,u,f,j]);return a.jsx(U.Activity,{className:"flex-1","data-test":"studyPlanFlashcardActivity",children:a.jsx("div",{className:"flex flex-1 flex-col items-center justify-center",children:a.jsx(_t,{onClick:()=>{r(!0)},children:x})})})},fs=(e,t,s)=>[{questionId:e,answerKeyList:t,...s?.length?{pointList:s}:{}}],ce=e=>!!(e&&typeof e=="object"),Qe=(e,t)=>{const n=(Array.isArray(e?.resultList)?e.resultList:[]).find(r=>ce(r)&&r._id===t);return ce(n)?n:null},xs=(e,t)=>{const s=Qe(e,t);return typeof s?.isCorrect=="boolean"?s.isCorrect:typeof s?.gradePercent=="number"?s.gradePercent>=1:typeof e?.isCorrect=="boolean"?e.isCorrect:typeof e?.gradePercent=="number"?e.gradePercent>=100:!1},vs=e=>(Array.isArray(e?.answerList)?e.answerList:[]).flatMap(s=>!ce(s)||s.isCorrect!==!0?[]:typeof s.key=="string"?[s.key]:[]),je=(e,t,s,n)=>{const r=Qe(e,t),o=vs(r);return s.map(l=>({...l,isCorrect:o.includes(l.key)?!0:void 0,isSelected:n.includes(l.key)}))},pe=(e,t,s)=>{const n=t.includes(e.key)||e.isSelected;return s?!e.isSelected&&e.isCorrect?"missed":e.isSelected&&!e.isCorrect?"incorrect":e.isCorrect?"correct":n?"selected":"unselected":n?"selected":"unselected"},Ae="[&_p]:m-0! [&_p]:text-xl! [&_p]:leading-[25px]! [&_p]:font-extrabold!",bs=({hasChoices:e,isClickableImage:t,isHiddenHotspot:s,isOrderedList:n,imageUrl:r})=>n&&e?"ordered":t&&r?s?"hotspot":"image":"buttons",Ss=(e,t,s)=>{const n=pe(e,t,s);return n==="correct"||n==="incorrect"||n==="missed"?n:void 0},Cs=({activity:e,masteryToken:t,onAdvance:s,isAdvancing:n,onMasteryTokenChange:r,gradeMutation:o})=>{const l=i.useMemo(()=>as(e),[e]),u=ms(e),f=Ie(e),j=is(e),x=Re(e),Q=os(e),R=ls(e),[k,L]=i.useState([]),[w,E]=i.useState([]),[I,O]=i.useState(l),[g,p]=i.useState(!1),[T,F]=i.useState(null),S=!!T,D=S?je(T,e.payload._id,l,k):l,v=S?je(T,e.payload._id,I,k):I,A=bs({hasChoices:l.length>0,isClickableImage:f,isHiddenHotspot:j,isOrderedList:rs(e),imageUrl:R}),P=A==="hotspot",N=P?ft(w.length,x):k.length>0,M=A==="image"?ds(D):[],m=us(e,S),H=!Q||S||!m||g,z=String(T?.explanation??e.payload.explanation??""),$=xs(T,e.payload._id),ee=h=>{S||L(C=>u?[h]:C.includes(h)?C.filter(he=>he!==h):[...C,h])},te=h=>{O(h),L(h.map(C=>C.key))},c=h=>{S||E(C=>x!==null&&C.length>=x?C:[...C,h])},d=h=>{S||E(C=>C.filter((he,He)=>He!==h))},b=()=>{S||E([])},y=i.useCallback(()=>{o.mutate({progressTestId:hs(e,t),answerList:fs(e.payload._id,k,P?w:void 0),isTimeout:!1,masteryToken:t??void 0},{onSuccess:h=>{F(h),e.payload.source.test?.modeType==="PRACTICE"&&typeof h.mastery?.token=="string"&&r?.(h.mastery.token)}})},[e,o,P,t,r,w,k]);return J({actionLabel:"Submit",pendingLabel:"Submitting",actionTestId:S?"studyPlanNextActivity":"studyPlanSubmitAnswer",actionType:S?"arrow":"label",disabled:S?n:!N||o.isPending||!H,isPending:S?n:o.isPending,onAction:S?s:y}),{answerMode:A,displayedOrderedChoices:v,explanation:z,gradedChoices:D,handleClearPoints:b,handleOrderChange:te,handlePlacePoint:c,handleRemovePoint:d,handleSelect:ee,imageMapChoices:M,imageUrl:R,isPassed:$,isSingleChoice:u,isSubmitted:S,placedPoints:w,questionVideo:m,requiredMarkerCount:x,selectedKeys:k,setHasVideoEnded:p,shouldShowAnswers:H}},js=({questionId:e,imageUrl:t,choices:s,isSingleChoice:n,isSubmitted:r,selectedKeys:o,altText:l,onSelect:u})=>a.jsx(xt,{questionId:e,imageUrl:t,imageAnswerList:s,onClick:u,chosenAnswerList:o,chosenAnswer:n?o[0]??"":"",getGradedState:f=>Ss(f,o,r),isSubmitted:r,altImageText:l}),As=({choice:e,isSubmitted:t,selectedKeys:s})=>{const{attributes:n,listeners:r,setNodeRef:o,transform:l,transition:u,isDragging:f}=Tt({disabled:t,id:e.key}),j={transform:Et.Transform.toString(l),transition:u},x=pe(e,s,t);return a.jsx("li",{className:"list-none",children:a.jsxs("div",{ref:o,style:j,"data-test":"studyPlanOrderedAnswer",className:_("relative flex min-h-14 w-full items-center justify-between border-y-2 border-x-0 border-solid border-fields-border-old p-4 text-left -mt-0.5",!t&&"cursor-grab hover:z-[2] hover:bg-fields-hover-old active:cursor-grabbing",f&&"z-[3] bg-fields-active-old shadow-floating-old",t&&x==="correct"&&"bg-fields-positive-old",t&&x==="incorrect"&&"bg-fields-negative-old",t&&x==="missed"&&"border-fields-border-positive-old"),...n,...t?{}:r,children:[a.jsx(V,{as:"span",variant:"list-item",className:"max-w-[calc(100%-3rem)] break-words",children:e.value}),t?null:a.jsx(Nt,{width:24,height:24,"data-test":"studyPlanOrderedDragHandle",className:"absolute right-2 block text-subdued-old","aria-hidden":"true"}),t&&x==="correct"?a.jsx(ke,{width:24,height:24,"data-test":"studyPlanOrderedCorrect",className:"absolute right-2 block text-content-positive-old","aria-hidden":"true"}):null,t&&x==="incorrect"?a.jsx(Te,{width:24,height:24,"data-test":"studyPlanOrderedIncorrect",className:"absolute right-2 block text-content-negative-old","aria-hidden":"true"}):null]})})},ws=({choices:e,isSubmitted:t,selectedKeys:s,onOrderChange:n})=>{const r=vt(re(jt),re(Ct),re(St,{coordinateGetter:bt})),o=l=>{t||!l.over||n(cs(e,String(l.active.id),String(l.over.id)))};return a.jsx(At,{sensors:r,collisionDetection:wt,onDragEnd:o,children:a.jsx(Pt,{items:e.map(l=>l.key),strategy:kt,children:a.jsx("ul",{"data-test":"studyPlanOrderedAnswerList",className:"mb-8 flex flex-col",children:e.map(l=>a.jsx(As,{choice:l,isSubmitted:t,selectedKeys:s},l.key))})})})},Ps=({choices:e,isSubmitted:t,selectedKeys:s,onSelect:n})=>a.jsx(U.Stack,{children:e.map(r=>{const o=pe(r,s,t);return a.jsxs(Ge,{type:"button",variant:o,onClick:()=>{n(r.key)},disabled:t,"data-test":"studyPlanAnswerChoice",className:"h-auto min-h-14",children:[a.jsx("div",{className:"flex-1 min-w-0 text-left",children:a.jsx("p",{className:"break-words m-0",children:r.value})}),Ye(o)]},r.key)})}),ks=({explanation:e,isPassed:t})=>a.jsxs(Xe,{variant:t?"correct":"incorrect","data-test":"studyPlanGradeFeedback",children:[t?a.jsx(ke,{width:32,height:32,"aria-hidden":"true"}):a.jsx(Te,{width:32,height:32,"aria-hidden":"true"}),a.jsxs(Ze,{children:[a.jsx(We,{children:t?"That's correct!":"That's incorrect. Here's why:"}),e?a.jsx(Je,{children:a.jsx(Ee,{html:e})}):null]})]}),Ts=({imageUrl:e,altText:t})=>a.jsx("img",{className:"mx-auto max-h-[60vh] max-w-full rounded-lg",src:e,alt:t??"Question image","data-test":"studyPlanQuestionImage"}),Es=({html:e,isRichText:t,instructions:s})=>a.jsxs(a.Fragment,{children:[t?a.jsx(Ee,{className:_("text-xl leading-[25px] font-extrabold",Ae),"data-test":"studyPlanQuestionPrompt",html:e}):a.jsx(ue,{as:"h2",size:"large",className:Ae,"data-test":"studyPlanQuestionPrompt",dangerouslySetInnerHTML:{__html:e}}),s?a.jsx(V,{className:"text-content-subtle","data-test":"studyPlanQuestionInstructions",children:s}):null]}),Ve=e=>`study-plan-video-${e.replace(/[^A-Za-z0-9_-]/g,"-")}`,Ns=({activityId:e,isSubmitted:t,streamUrl:s,subtitleUrl:n,thumbnailUrl:r,imageUrl:o,currentVideoSeconds:l,onEnded:u})=>a.jsx("div",{className:"-mx-4 desktop:mx-0","data-test":"studyPlanQuestionVideo",children:a.jsx(Ne,{streamUrl:s,subtitleUrl:n??void 0,id:Ve(`${e}-${t?"explanation":"question"}`),nodeId:e,img:r??o??void 0,currentTime:l??0,isLeadingNode:!1,isAutoplay:!1,isSkipAllowed:!0,progressId:"",showFullscreen:!1,isVideoQuestion:!0,onVideoEnded:u})}),Ms=e=>{const{activity:t}=e,s=Cs(e);return a.jsxs(U.Activity,{"data-test":"studyPlanQuestionActivity",children:[a.jsx(U.Header,{children:a.jsx(Es,{html:t.payload.question??"Answer the question",isRichText:ns(t),instructions:t.payload.instructions??void 0})}),s.questionVideo?a.jsx(Ns,{activityId:t.payload._id,isSubmitted:s.isSubmitted,streamUrl:s.questionVideo.streamUrl,subtitleUrl:s.questionVideo.subtitleUrl,thumbnailUrl:s.questionVideo.thumbnailUrl,imageUrl:s.questionVideo.imageUrl,currentVideoSeconds:s.questionVideo.currentVideoSeconds,onEnded:()=>{s.setHasVideoEnded(!0)}}
1):null,s.imageUrl&&s.answerMode!=="image"&&s.answerMode!=="hotspot"?a.jsx(Ts,{imageUrl:s.imageUrl,altText:oe(t)}):null,s.shouldShowAnswers&&s.answerMode==="ordered"?a.jsx(ws,{choices:s.displayedOrderedChoices,isSubmitted:s.isSubmitted,selectedKeys:s.selectedKeys,onOrderChange:s.handleOrderChange}):null,s.shouldShowAnswers&&s.answerMode==="image"&&s.imageUrl?a.jsx(js,{questionId:t.payload._id,imageUrl:s.imageUrl,choices:s.imageMapChoices,isSingleChoice:s.isSingleChoice,isSubmitted:s.isSubmitted,selectedKeys:s.selectedKeys,onSelect:s.handleSelect,altText:oe(t)}):null,s.shouldShowAnswers&&s.answerMode==="hotspot"&&s.imageUrl?a.jsx(Qt,{imageUrl:s.imageUrl,altText:oe(t),placedPoints:s.placedPoints,requiredMarkerCount:s.requiredMarkerCount,isSubmitted:s.isSubmitted,onPlace:s.handlePlacePoint,onRemove:s.handleRemovePoint,onClear:s.handleClearPoints}):null,s.shouldShowAnswers&&s.answerMode==="buttons"?a.jsx(Ps,{choices:s.gradedChoices,isSubmitted:s.isSubmitted,selectedKeys:s.selectedKeys,onSelect:s.handleSelect}):null,s.isSubmitted?a.jsx(ks,{explanation:s.explanation,isPassed:s.isPassed}):null]})},Is=({activity:e,isAdvancing:t,masteryToken:s,onAdvance:n,onMasteryTokenChange:r})=>{const o=Dt();return a.jsx(Ms,{activity:e,isAdvancing:t,masteryToken:s,onAdvance:n,onMasteryTokenChange:r,gradeMutation:o})},Rs=({activity:e,isAdvancing:t,onAdvance:s})=>{const n=e.payload.title??"Study video",{streamUrl:r}=e.payload,[o,l]=i.useState(!1);return J({actionTestId:"studyPlanNextActivity",disabled:!!r&&!o||t,isPending:t,onAction:s}),a.jsxs(U.Activity,{className:"gap-0 desktop:gap-5","data-test":"studyPlanVideoActivity",children:[a.jsx("div",{className:"order-1 -mx-4 -mt-6 desktop:order-2 desktop:mx-0 desktop:mt-0","data-test":"studyPlanVideoFrame",children:r?a.jsx(Ne,{streamUrl:r,subtitleUrl:e.payload.subtitleUrl??void 0,id:Ve(e.payload._id),nodeId:e.payload._id,img:e.payload.imageUrl??void 0,currentTime:0,isLeadingNode:!1,isAutoplay:!1,isSkipAllowed:!0,progressId:"",showFullscreen:!1,onVideoPlaying:()=>{l(!0)}}):a.jsx("div",{className:"flex aspect-video items-center justify-center bg-background-secondary p-6 desktop:rounded-lg",children:a.jsx(V,{children:"No video source is available for this activity."})})}),a.jsx(U.Header,{className:"order-2 p-4 desktop:order-1 desktop:p-0","data-test":"studyPlanVideoTitle",children:a.jsx(ue,{as:"h2",size:"small",className:"desktop:!text-xl desktop:!leading-[25px] desktop:!font-extrabold",children:n})})]})},Us=({onAdvance:e})=>(J({actionTestId:"studyPlanNextActivity",disabled:!1,onAction:e}),a.jsx(V,{"data-test":"studyPlanEmptyActivity",children:"No activity is available."})),_s=({activity:e,isPending:t,masteryToken:s,onAdvance:n,isAdvancing:r,onMasteryTokenChange:o})=>t?a.jsxs(U.Stack,{className:"gap-4","data-test":"studyPlanActivitySkeleton",children:[a.jsx(ne,{className:"h-8 w-2/3"}),a.jsx(ne,{className:"h-52 w-full"}),a.jsx(ne,{className:"h-13.5 w-40"})]}):Wt(e)?a.jsx(Rs,{activity:e,onAdvance:n,isAdvancing:r},e.payload._id):Jt(e)?a.jsx(gs,{activity:e,onAdvance:n,isAdvancing:r},e.payload._id):es(e)?a.jsx(Is,{activity:e,masteryToken:s,onAdvance:n,isAdvancing:r,onMasteryTokenChange:o},e.payload._id):e?a.jsx(Us,{onAdvance:n}):a.jsx(V,{"data-test":"studyPlanEmptyActivity",children:"No activity is available."}),Ls=e=>i.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},i.createElement("path",{d:"M11.9998 13.4L7.0998 18.3C6.91647 18.4833 6.68314 18.575 6.3998 18.575C6.11647 18.575 5.88314 18.4833 5.6998 18.3C5.51647 18.1167 5.4248 17.8833 5.4248 17.6C5.4248 17.3167 5.51647 17.0833 5.6998 16.9L10.5998 12L5.6998 7.1C5.51647 6.91667 5.4248 6.68334 5.4248 6.4C5.4248 6.11667 5.51647 5.88334 5.6998 5.7C5.88314 5.51667 6.11647 5.425 6.3998 5.425C6.68314 5.425 6.91647 5.51667 7.0998 5.7L11.9998 10.6L16.8998 5.7C17.0831 5.51667 17.3165 5.425 17.5998 5.425C17.8831 5.425 18.1165 5.51667 18.2998 5.7C18.4831 5.88334 18.5748 6.11667 18.5748 6.4C18.5748 6.68334 18.4831 6.91667 18.2998 7.1L13.3998 12L18.2998 16.9C18.4831 17.0833 18.5748 17.3167 18.5748 17.6C18.5748 17.8833 18.4831 18.1167 18.2998 18.3C18.1165 18.4833 17.8831 18.575 17.5998 18.575C17.3165 18.575 17.0831 18.4833 16.8998 18.3L11.9998 13.4Z",fill:"currentColor"})),Oe=i.createContext(null);function Ds(e){const t=i.useContext(Oe);if(!t)throw new Error(`${e} must be used within StudyPlanExitModal.Root.`);return t}function Qs({onEndStudyPlan:e,onContinueStudying:t,children:s,...n}){return a.jsx(Oe.Provider,{value:{onEndStudyPlan:e,onContinueStudying:t},children:a.jsx(et,{...n,children:s})})}function Vs({className:e,children:t,...s}){return a.jsx(tt,{"data-test":"studyPlanExitModal",showCloseButton:!1,className:_("flex max-h-[calc(100vh-32px)] max-w-[calc(100vw-32px)] flex-col gap-6 overflow-y-auto border-none","px-6 pb-8 pt-12 sm:max-w-[480px]",e),...s,children:t??a.jsxs(a.Fragment,{children:[a.jsx(Os,{}),a.jsx(Hs,{}),a.jsx($s,{})]})})}function Os({className:e,children:t,type:s="button",...n}){return a.jsx(ie,{asChild:!0,children:a.jsx("button",{type:s,"aria-label":"Close end study plan dialog",className:_("absolute right-4 top-4 inline-flex size-6 items-center justify-center rounded-full text-content-secondary","transition-colors hover:bg-background-secondary hover:text-content-regular","focus-visible:outline-none focus-visible:shadow-focus-subtle","[&_svg]:size-6 [&_svg]:shrink-0",e),...n,children:t??a.jsx(Ls,{"aria-hidden":"true"})})})}function Hs({className:e,children:t,...s}){return a.jsx("div",{className:_("flex w-full flex-col items-start gap-2 text-left",e),...s,children:t??a.jsxs(a.Fragment,{children:[a.jsx(Fs,{}),a.jsx(Bs,{})]})})}function Fs({className:e,children:t,...s}){return a.jsx(st,{className:_("text-left text-2xl leading-[30px] font-extrabold text-content-regular",e),...s,children:t??"End Today's Study Plan"})}function Bs({className:e,children:t,...s}){return a.jsx(at,{className:_("w-full text-left text-base leading-6 text-content-secondary",e),...s,children:t??a.jsxs(a.Fragment,{children:["Your progress is saved, but only for"," ",a.jsx(V,{as:"strong",variant:"paragraph-medium",weight:"bold",className:"text-inherit",children:"today."})," ","You can resume anytime, however the study plan"," ",a.jsx(V,{as:"strong",variant:"paragraph-medium",weight:"bold",className:"text-inherit",children:"will reset tomorrow"}),"."]})})}function $s({className:e,children:t,...s}){const{onEndStudyPlan:n,onContinueStudying:r}=Ds("StudyPlanExitModal.Actions");return a.jsx("div",{className:_("flex w-full flex-col gap-2",e),...s,children:t??a.jsxs(a.Fragment,{children:[a.jsx(ie,{asChild:!0,children:a.jsx(B,{t
1ype:"button",variant:"filled",className:"w-full","data-test":"studyPlanExitConfirm",onClick:n,children:"End study plan"})}),a.jsx(ie,{asChild:!0,children:a.jsx(B,{type:"button",variant:"outline",className:"w-full","data-test":"studyPlanExitCancel",onClick:r,children:"Continue studying"})})]})})}const we={Root:Qs,Content:Vs},qs=e=>Math.min(100,Math.max(0,e));function Ks({"aria-label":e,className:t,"data-test":s,percentage:n}){const r=n===null?null:qs(n),o=r===null?null:Math.round(r),l=(r??0)/100;return a.jsx(Bt,{className:_("h-2 w-full overflow-hidden rounded-xl bg-control-disabled-button-background",t),value:o,max:100,"aria-label":e??(o===null?"Study plan progress":`Study plan progress, ${String(o)}%`),"data-test":s,children:a.jsx($t,{"data-test":"studyPlanTopicProgressFiller",className:"h-full w-full origin-left rounded-[3px] bg-status-info-icon",style:{transform:`scaleX(${String(l)})`}})})}const zs={Root:Ks},Gs=({progressPercent:e,topicTitle:t})=>a.jsx(Vt,{className:"sticky top-0 z-40 min-h-16 bg-nav-old px-4 py-3","data-test":"studyPlanTopicHeader",children:a.jsx(Ot,{className:"min-h-10 max-w-none items-center hd:max-w-none","data-test":"studyPlanTopicHeaderContent",children:a.jsxs(Ht,{className:"flex w-full flex-col gap-2 p-0",children:[a.jsx(ue,{as:"h1",size:"xsmall","data-test":"studyPlanTopicTitle",children:t}),a.jsx(Ft,{className:"m-0",children:a.jsx(zs.Root,{percentage:e,"data-test":"studyPlanTopicProgress"})})]})})}),da=()=>{const{studyPlanId:e="",topicId:t=""}=nt(),s=rt(),n=ot(),r=me(it),o=me(lt),l=pt(),u=i.useRef(performance.now()),[f,j]=i.useState(!1),x=dt({progressId:r,courseId:o,enabled:!!(r&&o)}),Q=i.useMemo(()=>x.data?.state==="ready"?x.data.topics:[],[x.data]),R=Q.length>0,k=ct(e,{enabled:!x.isLoading&&!x.isFetching&&!R}),L=i.useMemo(()=>R?Q.map(m=>({completedActivityCount:m.completedActivityCount,id:m.id,title:m.title,totalActivityCount:m.totalActivityCount})):k.data?.topicList.flatMap(m=>m.topicId&&m.topicName&&Pe(m.status)?[{completedActivityCount:void 0,id:m.topicId,status:m.status,title:m.topicName,totalActivityCount:void 0}]:[])??[],[R,k.data?.topicList,Q]),w=i.useCallback(()=>Math.max(1,Math.ceil((performance.now()-u.current)/6e4)),[]),E=i.useCallback(()=>{s(`/study-plan/${e}/results`,{replace:!0,state:{elapsedMinutes:w()}})},[w,s,e]),I=i.useCallback(()=>{s(`/study-plan/${e}/results`,{replace:!0,state:{elapsedMinutes:w(),suppressConfetti:!0}})},[w,s,e]),O=i.useCallback(()=>{s("/dash/index",{replace:!0})},[s]),g=i.useCallback(m=>{s(`/study-plan/${e}/topic/${m}`,{replace:!0})},[s,e]),p=zt({studyPlanId:e,topicId:t,topics:L,onPlanComplete:E,onOrphanedContent:I,onRolledOver:O,onTopicChange:g}),T=p.activeTopicId||t,F=L.find(m=>m.id===T),S=Gt(p.plan),D=F?.title??k.data?.topicList.find(m=>m.topicId===T)?.topicName??"Topic practice",v=()=>{p.advance()},A=()=>{if(p.hasAdvanced){s(`/study-plan/${e}/results`,{replace:!0,state:{elapsedMinutes:w(),suppressConfetti:!0}});return}s("/dash/index",{replace:!0})},P=()=>{n({type:ye,payload:{to:G.toSaveAndExit,from:G.fromTopic}}),j(!0)},N=()=>{s("/dash/index",{replace:!0})},M=()=>{p.retry()};return p.isAccessDenied?a.jsx(ut,{onBackToDashboard:()=>{s("/dash/index",{replace:!0})}}):a.jsxs(a.Fragment,{children:[a.jsx(we.Root,{open:f,onOpenChange:j,onEndStudyPlan:A,onContinueStudying:()=>n({type:ye,payload:{to:G.toContinueDailyStudying,from:G.fromSaveAndExitFlow}}),children:a.jsx(we.Content,{})}),a.jsx(Ce.Provider,{onExit:P,children:a.jsxs(U.Shell,{"data-test":"studyPlanTopicShell",children:[a.jsx(Gs,{progressPercent:S,topicTitle:D}),a.jsx(U.Main,{className:"flex flex-col","data-test":"studyPlanTopicFlow",children:a.jsx(U.Content,{children:p.isRedirectingToResults?null:p.errorMessage?a.jsxs("div",{className:"flex w-full flex-col gap-4",children:[a.jsx(V,{role:"alert","data-test":"studyPlanTopicError",children:p.errorMessage}),a.jsxs("div",{className:"flex w-full flex-col gap-2",children:[a.jsxs(B,{type:"button",variant:"filled","data-test":"studyPlanErrorBack",onClick:N,children:["Back to ",l]}),a.jsx(B,{type:"button",variant:"outline","data-test":"studyPlanErrorRetry",onClick:M,children:"Try again"})]})]}):a.jsx(_s,{activity:p.activity,isPending:p.isStarting||p.isAdvancing,masteryToken:p.masteryToken,onAdvance:v,isAdvancing:p.isAdvancing,onMasteryTokenChange:p.updateMasteryToken})})}),a.jsx(Ce.Root,{})]})})]})};export{da as default};
2//# sourceMappingURL=TopicFlowRoute-BPe6_2zv.js.map

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.