1 2!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="c8e02a5c-84e3-5019-95b1-3b1e31720beb")}catch(e){}}(); 3const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/math-B_pA4vG7.js","assets/extends-DagVZOLR.js","assets/objectWithoutPropertiesLoose-CWGuMMQQ.js","assets/floating-ui.react-dom-BungBFME.js","assets/react-dom-C2rawXAL.js","assets/react-DJ7JEX99.js","assets/floating-ui.react-CDWlNsBN.js","assets/jsx-runtime-BPZIWioN.js","assets/dnd.esm-RT-cpEXt.js","assets/react-redux-D2mBZb9D.js","assets/Accordion-DKQYe4hB.js","assets/AccordionChevron-CcIucU7w.js","assets/DirectionProvider-WoHhbF4S.js","assets/Collapse-CrvqMYUP.js","assets/Transition-DzEMygLU.js","assets/get-style-object-DkFquSkR.js","assets/use-merged-ref-B6P-4Q8y.js","assets/UnstyledButton-CBL-9dvL.js","assets/polymorphic-factory-CisIfEIW.js","assets/create-safe-context-BOprVo2H.js","assets/create-scoped-keydown-handler-Bbjcyq9J.js","assets/use-id-BBwINeDQ.js","assets/random-id-DAKsshcs.js","assets/use-uncontrolled-DMfMTPOz.js","assets/ActionIcon-M9YaMJXW.js","assets/Loader-B-3eWfjw.js","assets/Alert-D4lvsxpp.js","assets/CloseButton-CHH1g-Kx.js","assets/Anchor-BeiidfEY.js","assets/Text-BfBnpZkH.js","assets/src-CO-pUSSr.js","assets/Badge-BwAO6tJf.js","assets/Button-gMe9TjEo.js","assets/Card-CISAOJKf.js","assets/Paper-CUsnnV2p.js","assets/Center-Brtybf9f.js","assets/Checkbox-D0oLd6t8.js","assets/CheckIcon-X-v1ByZ3.js","assets/Input-B8o4nmBI.js","assets/use-resolved-styles-api-BbS2yzpO.js","assets/create-optional-context-DTH4kxun.js","assets/get-auto-contrast-value-D7I5qfSj.js","assets/InputsGroupFieldset-DY04xAAj.js","assets/Combobox-BQ9L4rJT.js","assets/Popover-B1R22kYe.js","assets/FocusTrap-DyNcZIAz.js","assets/OptionalPortal-CSk5_nKh.js","assets/get-floating-position-Dq6UMTlC.js","assets/noop-Cm-54mpx.js","assets/Flex-Bjz38QRa.js","assets/SegmentedControl-CT6T1XG3.js","assets/to-int-XCjggJ3T.js","assets/get-env-DcW6Gavx.js","assets/Group-CXsBFaBq.js","assets/Image-DMeVU-ZM.js","assets/InputBase-C-eFBSKp.js","assets/Menu-2WcDQpAg.js","assets/create-event-handler-CXk8r-Rq.js","assets/use-disclosure-CBVeehbX.js","assets/Modal-A5bXunhk.js","assets/ScrollArea-BkjMbDWk.js","assets/use-window-event-DNVJYf0I.js","assets/Combination-CLN9mIym.js","assets/tslib.es6-F9IDpUiZ.js","assets/NavLink-H5lvMTfw.js","assets/PillsInput-CZGYPbP6.js","assets/Progress-CSCBefox.js","assets/Select-D3hi79kZ.js","assets/OptionsDropdown-PL5ZBopF.js","assets/SimpleGrid-DwMKVwMO.js","assets/get-base-value-74eROqDG.js","assets/Skeleton-LPYg36lp.js","assets/Stack-CYoC6EK8.js","assets/Switch-Drvc7gdD.js","assets/Table-CAnjLBBh.js","assets/TextInput-DahJBtqc.js","assets/Textarea-CoOohsB6.js","assets/ThemeIcon--o6NfxVk.js","assets/Title-BwPayaHx.js","assets/Tooltip-zgWy1y4z.js","assets/DateTimePicker-B-pUMYHm.js","assets/pick-calendar-levels-props-V0XbWd3W.js","assets/clamp-BFhNwzK1.js","assets/DatePicker-Cq-YygkQ.js","assets/texmath-uwMQDd4r.js","assets/markdown-it-CuZ-Iy1z.js","assets/md-B7Z80BAo.js","assets/iconBase-DwqRc_EL.js","assets/react-resizable-panels-rpoAuZlT.js","assets/bundle-mjs-DXf1wPlc.js","assets/tokens-RLIKVhxM.js","assets/colors-DL1kt8PM.js","assets/src-BnEat_Vb.css","assets/dist-BXatYzI-.js","assets/dist-BiZceAcg.js","assets/shim-Bb088_A7.js","assets/math-CyWRvKD4.css"])))=>i.map(i=>d[i]); 4(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{};e.SENTRY_RELEASE={id:`415b81c2860d879fa09355366cbcb17ab6302154`}}catch{}})();import{o as e,t}from"./react-DJ7JEX99.js";import{i as n,r}from"./exports-GpYgP8TD.js";import{t as i}from"./preload-helper-D5gNJCN5.js";import{C as a,D as o,O as s,T as c,b as l,d as u,h as d,k as f,l as p,m,o as h,p as g,s as _,u as v,v as y,x as b}from"./schemas-Bfl4rKUZ.js";import{d as x,f as S,n as C}from"./assignment.types-TOqO6oez.js";import{t as ee}from"./useTranslation-B-OWq5Gd.js";import{t as te}from"./jsx-runtime-BPZIWioN.js";import{a as ne}from"./DirectionProvider-WoHhbF4S.js";import{Yt as w}from"./src-CO-pUSSr.js";import{Q as re,Qt as ie}from"./question-CkQASQNk.js";import{t as ae}from"./Text-BfBnpZkH.js";import{t as oe}from"./Skeleton-LPYg36lp.js";import{t as se}from"./Stack-CYoC6EK8.js";import{t as ce}from"./react-BQkSCOSc.js";import{Tn as T}from"./src-c4Mkhr6X.js";import{l as E}from"./question.types-BjI0rDWO.js";import{r as D}from"./uuid-BqvkBPfW.js";import{t as O}from"./jsonTypes-CXSOSjC0.js";import{t as k}from"./zod-FCZYw52p.js";import{t as le}from"./client-only-Bhz6d3vH.js";import{t as ue}from"./TextToSpeech-7a8bipM5.js";const de=b({text:c(),startTime:l(),endTime:l()}),fe=b({fullText:c(),segments:v(de)});b({timestamp:l(),feedbackText:c(),coordinates:b({x:l(),y:l()}).optional()}),b({subQuestionIdentifier:c().describe(`An identifier for the sub-question or criteria being scored.`),score:l().min(0).max(4).describe(`Score for this specific sub-question or criterion (0-4).`),reasoning:c().optional().describe(`Reasoning for this specific sub-score.`),studentFeedback:c().optional().describe(`Student-facing feedback for this sub-question. Focus on what was done well, areas for improvement, and suggestions for future attempts, without reveal
4ing the answer.`)});const A=h([`none`,`partial`,`full`]);b({answersCorrect:u().optional(),explanationGrading:A.optional()});const j=b({thinking:c(),additionalFeedback:v(b({sectionTitle:c(),content:c()})).describe(`More detailed feedback sections about what was observed, max 2 sections`),overallAIFeedback:c().describe(`High-level feedback about the student's work in a friendly tone, explaining correctness without revealing answers`),answersCorrect:u().describe(`Whether the student's answers are correct (separate from explanation)`),explanationGrading:A.describe(`Rating for the quality of the student's explanation`),isCorrect:u().describe(`Whether the student's response meets the acceptance criteria`)}),M=b({thinking:c(),additionalFeedback:v(b({sectionTitle:c(),content:c()})).describe(`More detailed feedback sections about what was observed, max 2 sections`),overallAIFeedback:c().describe(`High-level feedback about the student's work in a friendly tone, explaining correctness without revealing answers`),isCorrect:u().describe(`Whether the student's response meets the acceptance criteria`)});v(b({strategyName:c(),analysis:o([j,M])}));var pe=b({type:y(O.MULTIPLE_CHOICE),selectedChoiceIds:v(D)}),me=b({type:y(O.SELECT_ALL),selectedChoiceIds:v(D)}),he=b({type:y(O.SHORT_ANSWER),answerText:c().min(1),aiEvaluation:b({score:d().min(0).max(100),reasoning:c(),isAccepted:u()}).optional()}),ge=b({type:y(O.TRUE_FALSE),selectedChoiceIds:v(D)}),_e=b({type:y(O.CLOZE),answerText:c().min(1)}),ve=b({type:y(O.FREE_RESPONSE),answerText:c().min(1),aiEvaluation:b({score:d().min(0).max(100),reasoning:c(),isAccepted:u()}).optional()});const ye=b({canvasStateHistory:v(E),finalCanvasState:E,previewThumbnails:v(b({url:f(),timestamp:l()})).optional(),videoUrl:f().optional()}),be=b({answerScore:l(),partScores:v(b({partId:c(),isCorrect:u(),points:l()})),explanationScore:o([y(0),y(1),y(2)]),explanationReasoning:c(),thinking:c(),overallAIFeedback:c()}),xe=b({answerCorrectness:h([`none`,`partial`,`full`]),answerReasoning:c(),explanationQuality:h([`none`,`partial`,`full`]),explanationReasoning:c(),overallFeedback:c()}),N=b({type:y(O.D3),answerJson:a(c(),s()),aiEvaluation:b({score:d().min(0).max(100),reasoning:c(),isAccepted:u()}).optional(),checksEvaluation:be.optional(),scratchpadUrl:c().optional(),showWorkText:c().optional(),photoUrl:c().optional(),d3AssessmentEvaluation:xe.optional(),podId:c().uuid().optional()}),Se=b({type:y(O.LEARN_KIT),interactionState:T,feedback:c().optional(),aiEvaluation:b({score:d().min(0).max(100),reasoning:c(),isAccepted:u()}).optional(),workText:c().optional(),podId:c().uuid().optional()}),Ce=b({type:y(O.CUSTOM),interactionState:T,gradedByIframe:y(!0),feedback:c().optional(),workText:c().optional(),podId:c().uuid().optional()}),we=b({transcript:b({fullText:c(),segments:v(b({text:c(),startTime:l(),endTime:l()}))}),audioUrl:f().optional()}),P=b({type:y(O.CANVAS),canvasResponseData:ye,audioData:we.optional(),studentTextAnnotations:v(b({text:c(),timestamp:l()})).optional(),overallStudentTextResponse:c().optional(),aiAnalysis:o([j,M]).optional()});var F=b({questionId:x(),enrollmentId:x(),assignmentId:x().optional(),assignmentQuestionId:x().optional(),sessionId:x().optional(),questionAttemptId:D,mode:h(C).optional()});const I=F.extend({type:y(O.SHORT_ANSWER),answer:S().min(1,`Answer cannot be empty`)}),L=F.extend({type:y(O.MULTIPLE_CHOICE),choice:D}),R=F.extend({type:y(O.SELECT_ALL),choices:v(D).min(1,`Please select at least one option`)}),Te=F.extend({type:y(O.LEARN_KIT),interactionState:T.nullable()}),Ee=F.extend({type:y(O.CUSTOM),interactionState:T.nullable(),isCorrect:u(),feedback:c().optional()}),z=F.extend({type:y(O.TRUE_FALSE),choice:D}),B=F.extend({type:y(O.CLOZE),answer:S().min(1,`Answer cannot be empty`)}),V=F.extend({type:y(O.FREE_RESPONSE),answer:S().min(1,`Answer cannot be empty`)}),H=F.extend({type:y(O.CANVAS),finalCanvasState:c(),canvasStateHistory:c(),previewThumbnailData:v(b({url:c(),timestamp:l()})).optional(),audioFile:p().optional(),videoFile:p().optional(),studentTextAnnotations:c().optional(),overallStudentTextResponse:c().optional(),audioLanguageCode:c().optional()}),U=F.extend({type:y(O.D3),answerJson:a(c(),s()).default({}),scratchpadUrl:c().optional(),showWorkText:c().optional(),photoUrl:c().optional()});b({success:u(),responseId:l().optional(),aiAnalysis:o([j,M]).nullable(),videoUrl:f().optional().nullable(),audioUrl:f().optional().nullable(),audioTranscript:fe.optional().nullable(),isCorrect:u().nullable(),overallStudentTextResponse:c().optional().nullable(),uploadedThumbnails:v(b({url:f(),timestamp:l()})).optional().nullable(),error:c().optional()}),b({questionId:x(),enrollmentId:x(),questionAttemptId:D,finalCanvasState:E,canvasStateHistory:v(E),audioFile:_(File).optional(),videoFile:_(File).optional(),previewThumbnailData:v(b({url:c(),timestamp:l()})).optional(),overallStudentTextResponse:c().optional().nullable(),assignmentId:x().optional(),assignmentQuestionId:x().optional(),sessionId:x().optional(),type:y(O.CA
4NVAS),audioLanguageCode:c().optional()});const De=m(`type`,[I,L,R,z,V,B,H,U,Te,Ee]),Oe=k(I),ke=k(L),Ae=k(R),je=k(z),Me=k(B),Ne=k(V),Pe=k(H);k(U);const W=m(`type`,[pe,me,he,ge,_e,ve,P,N,Se,Ce]);b({id:l(),enrollmentId:l(),questionId:l(),responseContent:W,isCorrect:u(),firstAttemptOfSession:u(),createdAt:g(),updatedAt:g()});const Fe=b({type:y(O.CANVAS),canvasState:E});var G=b({type:y(O.SELECT_ALL),choices:v(D)}),K=b({type:y(O.MULTIPLE_CHOICE),choice:D}),Ie=b({type:y(O.TRUE_FALSE),choice:D}),Le=b({type:y(O.SHORT_ANSWER),answer:c()}),Re=b({type:y(O.CLOZE),answer:c()}),ze=b({type:y(O.FREE_RESPONSE),answer:c()}),Be=b({type:y(O.D3),answerJson:a(c(),s())}),Ve=b({type:y(O.LEARN_KIT),interactionState:T.nullable()}),He=b({type:y(O.CUSTOM),interactionState:T.nullable(),isCorrect:u(),feedback:c().optional()}),Ue=m(`type`,[G,K,Ie,Le,Re,ze,Be,Ve,He]);m(`type`,[Fe,G,K,Ie,Le,Re,ze,Be,b({type:y(`assessment_show_work`),textContent:c(),photoUrl:c().optional(),scratchpadUrl:c().optional(),formDraft:Ue.optional()}),b({type:y(`d3_with_show_work`),answerJson:a(c(),s()),textContent:c(),photoUrl:c().optional(),scratchpadUrl:c().optional()}),Ve,He]),k(m(`type`,[b({type:y(O.MULTIPLE_CHOICE),questionId:l(),choice:D}),b({type:y(O.SELECT_ALL),questionId:l(),choices:v(D)}),b({type:y(O.SHORT_ANSWER),questionId:l(),answer:c()}),b({type:y(O.TRUE_FALSE),questionId:l(),choice:D}),b({type:y(O.CLOZE),questionId:l(),answer:c()}),b({type:y(O.FREE_RESPONSE),questionId:l(),answer:c()}),b({type:y(O.D3),questionId:l(),answerJson:a(c(),s())})]));var q=b({questionId:l(),studentProfileId:D,groupId:l(),studySessionId:l()}),J=b({questionId:l(),studentProfileId:D,groupId:l(),assignmentId:l(),assignmentQuestionId:l(),mode:h(C).optional()});const We=b({enrollmentId:l()}).and(m(`type`,[q.extend({type:y(`studySession`)}),J.extend({type:y(`assignment`)})])),Ge=b({questionAttemptId:D,questionId:l(),studentProfileId:D,groupId:l(),enrollmentId:l()}).and(m(`type`,[q.extend({type:y(`studySession`)}),J.extend({type:y(`assignment`)})]));b({questionAttemptId:D,questionId:l(),studentProfileId:D,groupId:l(),language:c(),enrollmentId:l()}).and(m(`type`,[q.extend({type:y(`studySession`)}),J.extend({type:y(`assignment`)})])),b({questionId:l(),enrollmentId:l(),responseContent:W,isCorrect:u(),assignmentId:l().optional(),sessionId:l().optional(),assignmentQuestionId:l().optional(),questionAttemptId:D,timestamp:c().optional(),submissionSource:h([`user`,`timeout`]).optional(),mode:h(C).optional(),db:p().optional()});const Ke=b({questionId:x(),enrollmentId:x(),questionAttemptId:c().optional(),assignmentId:x().optional(),assignmentQuestionId:x().optional(),sessionId:x().optional()});k(Ke),b({assignmentQuestionResponseId:l(),responseId:l(),assignedAssignmentId:l(),assignment_name:c(),assignment_id:l(),group_name:c(),group_id:l(),is_correct:u().nullable(),createdAt:g().nullable(),response_payload:W,question_id:l()});var Y=()=>{throw Error(`Not implemented`)};const X={apis:{getNextQuestion:Y,submitAnswer:Y,submitTimeout:Y,getTranslation:Y,trackViewed:Y,trackClosed:Y,trackTranslated:Y},questionStatus:`unsent`,currentQuestion:null,currentSequence:null,progress:{totalQuestions:0,totalAnswered:0},flowStatus:{skipResults:!1,hasTimer:!1},translation:{status:`unsent`,currentLanguage:null,questionContent:null,translatedResources:null,extractedCanvasText:null,translatedCanvasText:null},viewedTracking:{status:`unsent`,questionAttemptId:null,firstViewedAt:null,serverClientOffset:null},closedTracking:{status:`unsent`},translatedTracking:{status:{}},timer:{timeAllowed:null},response:{status:`unsent`,type:null,choice:null,choices:null,answer:null,submittedAt:null,isCorrect:null,explanation:null,feedback:null,aiAnalysis:null,videoUrl:null,audioUrl:null,audioTranscript:null,overallStudentTextResponse:null,lastSnapshotImageUrl:null}},Z=ce((e,t)=>({...X,setInitialState:({questionId:n,questionContent:r,questionConfig:i,resources:a,totalQuestions:o,totalAnswered:s,hasTimer:c,timeAllowed:l,skipResults:u,assignmentId:d,assignmentName:f,assignmentQuestionId:p,groupId:m,studentProfileId:h,studySessionId:g,enrollmentId:_,apis:v,experimentId:y,mode:b,sequenceId:x})=>{if(t().initialized||(e(()=>({initialized:!0,experimentId:y,assignmentId:d,assignmentName:f,mode:b,groupId:m,studentProfileId:h,enrollmentId:_,studySessionId:g,questionStatus:`sent`,currentQuestion:n!==void 0&&r&&i?{questionId:n,questionContent:r,assignmentQuestionId:p,c
4onfig:i,resources:a}:null,currentSequence:x!==void 0&&p!==void 0?{sequenceId:x,assignmentQuestionId:p}:null,progress:{totalQuestions:o,totalAnswered:s},flowStatus:{skipResults:u,hasTimer:c},timer:{timeAllowed:l??null},apis:v})),n===void 0))return;let S=d&&p?`assignment`:`studySession`,C=We.parse({assignmentId:d,assignmentQuestionId:p,groupId:m,questionId:n,studentProfileId:h,studySessionId:g,enrollmentId:_,type:S,mode:b});t()._trackViewed(C)},getNextQuestion:async()=>{let{apis:i,studentProfileId:a,assignmentId:o,enrollmentId:s,studySessionId:c,experimentId:l,groupId:u,questionStatus:d}=t();if(d!==`pending`){if(!a){console.error(`Attempted to getNextQuestion without studentProfileId`),n(`Attempted to getNextQuestion without studentProfileId`,{extra:{context:`questionFlow.store.getNextQuestion - Missing studentProfileId`},level:`error`}),e({questionStatus:`error`});return}e({questionStatus:`pending`});try{let r={studentProfileId:a,assignmentId:o,enrollmentId:s,studySessionId:c,experimentId:l,groupId:u},d=await i.getNextQuestion(r);if(d.success){let{nextQuestion:n,progress:r}=d,i=d.nextSequence??null;if(i)return e(e=>({...e,questionStatus:`sent`,currentQuestion:null,currentSequence:i,progress:r,viewedTracking:{...X.viewedTracking},response:{...X.response},closedTracking:{...X.closedTracking},translatedTracking:{...X.translatedTracking},translation:{...X.translation}})),null;if(n===null)return e(e=>({...e,questionStatus:`sent`,currentQuestion:null,currentSequence:null,progress:r,viewedTracking:{...X.viewedTracking},response:{...X.response},closedTracking:{...X.closedTracking},translatedTracking:{...X.translatedTracking},translation:{...X.translation}})),null;e(e=>({...e,questionStatus:`sent`,currentSequence:null,currentQuestion:{questionId:n.id,assignmentQuestionId:n.assignmentQuestionId,questionContent:n.questionContent,config:n.config,resources:n.resources},progress:r,viewedTracking:{...X.viewedTracking},response:{...X.response},closedTracking:{...X.closedTracking},translatedTracking:{...X.translatedTracking},translation:{...X.translation}}));let{assignmentId:a,groupId:o,studySessionId:s,studentProfileId:c,enrollmentId:l,mode:u}=t(),f=We.parse({assignmentQuestionId:n.assignmentQuestionId,questionId:n.id,groupId:o,studentProfileId:c,assignmentId:a,studySessionId:s,enrollmentId:l,type:a?`assignment`:`studySession`,mode:u});t()._trackViewed(f)}else throw e(e=>({...e,questionStatus:`error`})),n(`Failed to get next question - API success false`,{extra:{context:`questionFlow.store.getNextQuestion - API success false`,studentProfileId:r.studentProfileId,assignmentId:r.assignmentId,enrollmentId:r.enrollmentId,studySessionId:r.studySessionId,experimentId:r.experimentId,groupId:r.groupId},level:`error`}),Error(`Failed to get next question`)}catch(n){console.error(`Failed to get next question`,n),r(n,{extra:{context:`questionFlow.store.getNextQuestion - catch block`,studentProfileId:t().studentProfileId,assignmentId:t().assignmentId,enrollmentId:t().enrollmentId,studySessionId:t().studySessionId,experimentId:t().experimentId,groupId:t().groupId}}),e(e=>({...e,questionStatus:`error`}))}}},_trackViewed:async i=>{e(e=>({...e,viewedTracking:{...e.viewedTracking,status:`pending`}})),await t().apis.trackViewed(i).then(t=>{if(t.success===!1)throw n(`Failed to track viewed - API success false`,{extra:{context:`questionFlow.store._trackViewed - API success false`,args:JSON.stringify(i)},level:`error`}),Error(`Failed to track viewed`);e(e=>({...e,viewedTracking:{status:`sent`,questionAttemptId:t.questionAttemptId,firstViewedAt:t.firstViewedAt,serverClientOffset:t.serverTime?new Date(t.serverTime).getTime()-Date.now():null}}))}).catch(t=>{r(t,{extra:{context:`questionFlow.store._trackViewed - catch block`,args:JSON.stringify(i)}}),e(e=>({...e,viewedTracking:{status:`error`,questionAttemptId:null,firstViewedAt:null,serverClientOffset:null}}))})},submitAnswer:async i=>{let a=De.safeParse(i);if(!a.success)return console.error(`Invalid form data`,a.error),r(a.error,{extra:{context:`questionFlow.store.submitAnswer - Invalid form data`,formDataArgs:JSON.stringify(i),formattedError:a.error.flatten()}}),e(e=>({response:{...e.response,status:`error`}})),{success:!1,errorMessage:`Invalid answer data`};
4if(t().response.status===`pending`||t().response.status===`sent`)return console.warn(`Submission attempted while status was pending or sent.`),n(`submitAnswer prevented due to in-flight submission`,{extra:{context:`questionFlow.store.submitAnswer.doubleSubmitGuard`,currentStatus:t().response.status,questionId:t().currentQuestion?.questionId,assignmentQuestionId:t().currentQuestion?.assignmentQuestionId,enrollmentId:t().enrollmentId,studentProfileId:t().studentProfileId,questionAttemptId:t().viewedTracking.questionAttemptId},level:`warning`}),{success:!1,errorMessage:`An answer submission is already in progress`};e(e=>({response:{...e.response,status:`pending`,type:`user`,submittedAt:new Date().toISOString(),isCorrect:null,explanation:null,feedback:null,aiAnalysis:null}}));try{let r={...i,mode:t().mode},a=await t().apis.submitAnswer(r);if(a.success){let r=null,o=null,s=null;i.type===O.MULTIPLE_CHOICE||i.type===O.TRUE_FALSE?r=i.choice??null:i.type===O.SELECT_ALL?o=i.choices??null:(i.type===O.SHORT_ANSWER||i.type===O.CLOZE||i.type===O.FREE_RESPONSE)&&(s=i.answer??null);let{skipResults:c}=t().flowStatus;return e(c?e=>{let t=e.response.status===`pending`&&e.response.type===`user`?e.progress.totalAnswered+1:e.progress.totalAnswered;return{progress:{...e.progress,totalAnswered:t},response:{...e.response,status:`sent`}}}:e=>{let t={status:`sent`,isCorrect:a.isCorrect??null,explanation:a.explanation??null,feedback:a.feedback??null,aiAnalysis:a.aiAnalysis??null,videoUrl:a.videoUrl??null,audioUrl:a.audioUrl??null,audioTranscript:a.audioTranscript??null,overallStudentTextResponse:a.overallStudentTextResponse??null,lastSnapshotImageUrl:a.lastSnapshotImageUrl??null,choice:r,choices:o,answer:s},n=e.response.status===`pending`&&e.response.type===`user`?e.progress.totalAnswered+1:e.progress.totalAnswered;return{progress:{...e.progress,totalAnswered:n},response:{...e.response,...t}}}),i.type===O.CANVAS&&!a.aiAnalysis&&!a.videoUrl&&!a.audioUrl&&!a.audioTranscript&&!a.overallStudentTextResponse&&!a.lastSnapshotImageUrl&&a.isCorrect===void 0&&n(`Canvas submit succeeded but returned minimal/empty payload`,{extra:{context:`questionFlow.store.submitAnswer.canvasEmptySuccess`,questionId:t().currentQuestion?.questionId,assignmentQuestionId:t().currentQuestion?.assignmentQuestionId,enrollmentId:t().enrollmentId,studentProfileId:t().studentProfileId,questionAttemptId:t().viewedTracking.questionAttemptId},level:`warning`}),t().flowStatus.skipResults&&await t()._handleAutoTransition(),a}else return n(`Submit answer failed - API success false`,{extra:{context:`questionFlow.store.submitAnswer - API success false`,formDataArgs:JSON.stringify(i),questionId:t().currentQuestion?.questionId,assignmentQuestionId:t().currentQuestion?.assignmentQuestionId,enrollmentId:t().enrollmentId,groupId:t().groupId,studentProfileId:t().studentProfileId,questionAttemptId:t().viewedTracking.questionAttemptId,responseStatus:t().response.status},level:`error`}),e(e=>({response:{...e.response,status:`error`}})),a}catch(n){return console.error(`Error submitting answer:`,n),r(n,{extra:{context:`questionFlow.store.submitAnswer - catch block`,formDataArgs:JSON.stringify(i),questionId:t().currentQuestion?.questionId,assignmentQuestionId:t().currentQuestion?.assignmentQuestionId,enrollmentId:t().enrollmentId,groupId:t().groupId,studentProfileId:t().studentProfileId,questionAttemptId:t().viewedTracking.questionAttemptId,responseStatus:t().response.status}}),e(e=>({response:{...e.response,status:`error`}})),{success:!1,errorMessage:n instanceof Error?n.message:`Answer submission failed`}}},submitTimeout:async()=>{if(t().response.status===`pending`||t().response.status===`sent`)return;e(()=>({response:{...X.response,status:`pending`,type:`timeout`}}));let{assignmentId:i,enrollmentId:a,studySessionId:o,currentQuestion:s,viewedTracking:c}=t();if(!s)throw Error(`Current question is required`);let l=Ke.parse({questionId:s.questionId,enrollmentId:a,questionAttemptId:c.questionAttemptId,assignmentId:i,assignmentQuestionId:s.assignmentQuestionId,studySessionId:o});await t().apis.submitTimeout(l).then(t=>{if(t.success===!1)throw n(`Failed to submit timeout - API success false`,{extra:{context:`questionFlow.store.submitTimeout - API success false`,timeoutArgs:JSON.stringify(l)},level:`error`}),Error(`Failed to submit timeout`);e(e=>({...e,response:{...X.response,status:`sent`,type:`timeout`,isCorrect:!1}}))}).catch(t=>{r(t,{extra:{context:`questionFlow.store.submitTimeout - catch block`,timeoutArgs:JSON.stringify(l)}}),e(e=>({...e,response:{...e.response,status:`error`}}))}),await t()._handleAutoTransition()},trackClosed:async()=>{let{assignmentId:i,viewedTracking:a,currentQuestion:o,groupId:s,studentProfileId:c,studySessionId:l,enrollmentId:u,closedTracking:d,mode:f}=t();
4if(d.status===`pending`||d.status===`sent`||a.status!==`sent`)return;if(!o)throw Error(`Current question is required`);if(!c)throw Error(`Student profile ID is required`);if(!s)throw Error(`Group ID is required`);let p=l?{type:`studySession`,studySessionId:l}:{type:`assignment`,assignmentId:i,assignmentQuestionId:o.assignmentQuestionId,mode:f},m=Ge.parse({questionAttemptId:a.questionAttemptId,questionId:o.questionId,studentProfileId:c,groupId:s,enrollmentId:u,...p});e(()=>({closedTracking:{status:`pending`}})),await t().apis.trackClosed(m).then(t=>{if(t.success===!1)throw n(`Failed to track closed - API success false`,{extra:{context:`questionFlow.store.trackClosed - API success false`,closedArgs:JSON.stringify(m)},level:`error`}),Error(`Failed to track closed`);e(e=>({closedTracking:{...e.closedTracking,status:`sent`}}))}).catch(t=>{r(t,{extra:{context:`questionFlow.store.trackClosed - catch block`,closedArgs:JSON.stringify(m)}}),e(e=>({closedTracking:{...e.closedTracking,status:`error`}}))})},_trackTranslated:async i=>{let{translatedTracking:a}=t();a.status[i.language]===`sent`||a.status[i.language]===`pending`||(e(e=>({translatedTracking:{status:{...e.translatedTracking.status,[i.language]:`pending`}}})),t().apis.trackTranslated(i).then(t=>{if(t.success===!1)throw n(`Failed to track translated - API success false`,{extra:{context:`questionFlow.store._trackTranslated - API success false`,translatedArgs:JSON.stringify(i)},level:`error`}),Error(`Failed to track translated`);e(e=>({translatedTracking:{...e.translatedTracking,status:{...e.translatedTracking.status,[i.language]:`sent`}}}))}).catch(t=>{r(t,{extra:{context:`questionFlow.store._trackTranslated - catch block`,translatedArgs:JSON.stringify(i)}}),e(e=>({translatedTracking:{...e.translatedTracking,status:{...e.translatedTracking.status,[i.language]:`error`}}}))}))},getTranslation:async i=>{let{translation:a,enrollmentId:o}=t();a.status===`pending`||a.currentLanguage===i.targetLanguage||(e(e=>({translation:{...e.translation,status:`pending`}})),t().apis.getTranslation({...i,enrollmentId:i.enrollmentId??o}).then(r=>{if(r.success===!1)throw n(`Failed to get translation - API success false`,{extra:{context:`questionFlow.store.getTranslation - API success false`,translationArgs:JSON.stringify(i)},level:`error`}),Error(`Failed to get translation`);if(i.questionId!==t().currentQuestion?.questionId)return;e(e=>({translation:{...e.translation,status:`sent`,questionContent:r,translatedResources:r.translatedResources||null,currentLanguage:i.targetLanguage,extractedCanvasText:null,translatedCanvasText:null}}));let{viewedTracking:a,groupId:o,studentProfileId:s,studySessionId:c,assignmentId:l,currentQuestion:u,enrollmentId:d}=t(),f=u?.assignmentQuestionId,p=c?{type:`studySession`,studySessionId:c}:{type:`assignment`,assignmentId:l,assignmentQuestionId:f};!a.questionAttemptId||!o||!s||!f||!d||t()._trackTranslated({questionId:i.questionId,language:i.targetLanguage,questionAttemptId:a.questionAttemptId,groupId:o,studentProfileId:s,enrollmentId:d,...p})}).catch(t=>{r(t,{extra:{context:`questionFlow.store.getTranslation - catch block`,translationArgs:JSON.stringify(i)}}),e(e=>({translation:{...e.translation,status:`error`}}))}))},showOriginal:()=>{e(()=>({translation:{...X.translation,currentLanguage:null,translatedResources:null}}))},_handleAutoTransition:async()=>{let{flowStatus:{skipResults:e},mode:n}=t();e&&(await t().trackClosed().catch(e=>{console.error(`Failed to track closed during auto-transition`,e),r(e,{extra:{context:`questionFlow.store._handleAutoTransition - trackClosed catch block`,currentQuestionId:t().currentQuestion?.questionId,studentProfileId:t().studentProfileId,groupId:t().groupId}})}),n!==`assessment`&&t().getNextQuestion())},closeAndGetNextQuestion:async()=>{if(t().currentSequence){t().getNextQuestion();return}await t().trackClosed().catch(e=>{console.error(`Failed to track closed`,e),r(e,{extra:{context:`questionFlow.store.closeAndGetNextQuestion - trackClosed catch block`,currentQuestionId:t().currentQuestion?.questionId,studentProfileId:t().studentProfileId,groupId:t().groupId}})}),t().getNextQuestion()},resetStore:()=>{e(()=>({...X,initialized:!1}))},setInitialProgress:n=>{t().initialized||e(()=>({progress:n}))},setResponseState:t=>{e(e=>({response:{...e.response,...t}}))}}));var qe=e(t(),1),Q=e(te(),1),Je=(0,qe.lazy)(()=>i(()=>import(`./math-B_pA4vG7.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96])).then(e=>({default:e.RichMathWorkEditor})));function Ye(e){let{t}=ee(`common`),n=e.label??t(`session-player.mathWork.showWork`);return(0,Q.jsx)(qe.Suspense,{fallback:(0,Q.jsxs)(se,{gap:4,children:[(0,Q.jsx)(ae,{size:`sm`,fw:600,c:`slate.7`,children:n}),(0,Q.jsx)(ne,{mih:112,p:12,children:e.value?(0,Q.jsx)(w,{content:e.value}):(0,Q.jsx)(oe,{h:80,animate:!1})})]}),children:(0,Q.jsx)(Je,{...e,label:n,labels:{showWork:t(`session-player.mathWork.showWork`),placeholder:t(`session-player.mathWork.placeholder`),toolbar:t(`session-player.mathWork.toolbar`),numerator:t(`session-player.mathWork.numerator`),denominator:t(`session-player.mathWork.denominator`),wholeNumber:t(`session-player.mathWork.wholeNumber`),base:t(`session-player.mathWork.base`),exponent:t(`session-player.mathWork.exponent`),expression:t(`session-player.mathWork.expression`),editExpression:t(`session-player.mathWork.editExpression`),plus:t(`Math-plus`),minus:t(`Math-minus`),times:t(`Math-times`),divide:t(`Math-divide`),equals:t(`Math-equals`),lessThan:t(`Math-less-than`),lessOrEqual:t(`Math-less-or-equal`),greaterThan:t(`Math-greater-than`),greaterOrEqual:t(`Math-greater-or-equal`),pi:t(`Math-pi`),fraction:t(`Math-fraction`),mixedNumber:t(`Math-mixed-number`),superscript:t(`Math-superscript`)}})})}function Xe(e){return(0,Q.jsx)(Ye,{...e})}var Ze=b({isCorrect:u(),feedback:c().nullable().optional()});async function Qe(e){let t=await fetch(`/api/assignment-work/short-answer-equivalence`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({questionId:e.questionId,answerText:e.text})});if(!t.ok)throw Error(`Short-answer grading unavailable`);let n=Ze.parse(await t.json());return{isCorrect:n.isCorrect,...n.feedback?{feedback:n.feedback}:{}}}function $(e){return e.flatMap(e=>`text`in e?[e.text]:`slots`in e?Object.values(e.slots).map(e=>$(e??[])):`kind`in e&&e.kind===`figure`?[$(e.parts)]:[]).filter(
4Boolean).join(` 5 6`).trim()}var $e=e=>e.translation.currentLanguage??`en`;function et({content:e}){let t=Z($e),n=$(e);return n?(0,Q.jsx)(le,{fallback:null,children:()=>(0,Q.jsx)(ue,{text:n,languageCode:t,variant:`button`})}):null}function tt(e){return e.map(nt).join(` `).replace(/\s+/g,` `).trim()}function nt(e){return`text`in e?e.text:`slots`in e?Object.values(e.slots).filter(e=>e!==void 0).map(tt).join(` `):``}var rt=e=>e.translation.currentLanguage??`en`;function it({content:e}){let t=Z(rt),n=tt(e);return n?(0,Q.jsx)(le,{fallback:null,children:()=>(0,Q.jsx)(ue,{text:n,languageCode:t,variant:`button`})}):null}function at(e,t=`body`){return(0,Q.jsx)(w,{content:e,textRole:t})}function ot(e){return(0,Q.jsx)(w,{content:e,inline:!0})}function st(e){return(0,Q.jsx)(et,{content:e})}function ct(e){return(0,Q.jsx)(ie,{name:e.source})}function lt(e){return(0,Q.jsx)(ie,{name:e.source})}function ut(e){return(0,Q.jsx)(it,{content:e})}const dt={registry:re,renderText:at,renderInlineText:ot,renderPromptActions:st,renderSource:ct,renderInteractionSource:lt,renderChoiceRightSection:ut,evaluateShortAnswerFallback:Qe,renderWorkEditor:Xe};export{H as a,Me as c,ke as d,Ae as f,Z as i,N as l,je as m,Ye as n,Pe as o,Oe as p,Xe as r,P as s,dt as t,Ne as u}; 7//# debugId=c8e02a5c-84e3-5019-95b1-3b1e31720beb
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.