@edpire/sdk 0.8.3 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/react.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import"./chunk-76CZ6Z7T.mjs";import hi,{useMemo as gi}from"react";import{jsx as ir}from"react/jsx-runtime";import{useEffect as rt,useMemo as Js,useRef as Xs}from"react";import Wa from"mitt";var ze=class{constructor(){this.emitter=Wa(),this.answers=new Map}emit(r){if(r.type==="answer:changed")this.answers.set(r.answer.nodeId,r.answer);else if(r.type==="answers:reset")this.answers.clear();else if(r.type==="answers:prefill")for(let t of r.answers)this.answers.set(t.nodeId,t);this.emitter.emit(r.type,r)}on(r,t){this.emitter.on(r,t)}off(r,t){this.emitter.off(r,t)}getAllAnswers(){return Array.from(this.answers.values())}clearAnswers(){this.answers.clear(),this.emit({type:"answers:reset"})}prefillAnswers(r){this.emit({type:"answers:prefill",answers:r})}submitAnswers(){this.emit({type:"answer:submitted",answers:this.getAllAnswers(),timestamp:Date.now()})}},mn="__edpireGlobalAnswerBus",un=globalThis,Nr=un[mn]??(un[mn]=new ze);import{jsx as qa}from"react/jsx-runtime";import{createContext as Ua,useContext as Ha}from"react";var fn="__edpireAnswerBusContext",hn=globalThis,gn=hn[fn]??(hn[fn]=Ua(Nr));function de(){return Ha(gn)}function Ar({children:e,bus:r=new ze}){return qa(gn.Provider,{value:r,children:e})}import{Fragment as Rn,jsx as G,jsxs as Be}from"react/jsx-runtime";import{Fragment as so,useState as qr,useEffect as Wr,useMemo as io,useRef as co}from"react";import Pe from"clsx";import{jsx as F}from"react/jsx-runtime";import Va from"katex";import"katex/dist/contrib/mhchem.js";var Ga={"\\d":"\\mathrm{d}","\\R":"\\mathbb{R}","\\N":"\\mathbb{N}","\\Z":"\\mathbb{Z}","\\Q":"\\mathbb{Q}","\\C":"\\mathbb{C}"};function ur(e,r,t=!0){try{return Va.renderToString(e,{displayMode:r,output:t?"htmlAndMathml":"html",throwOnError:!1,errorColor:"#cc0000",macros:Ga,strict:!1})}catch(n){return`<span class="katex-error" style="color:#cc0000" title="${String(n)}">${e}</span>`}}function E(e){return`calc(${typeof e=="number"?`${e}px`:e} * var(--edp-scale, 1))`}function ee(e){return{width:E(e),height:E(e)}}function Re(e){if(e==null||e==="")return;if(typeof e=="number")return E(e);let r=String(e).trim();return/^\d+(\.\d+)?px$/.test(r)?E(r):r}var bn={1:{fontSize:"1.75em",fontWeight:700,lineHeight:1.2,margin:"0.6em 0 0.4em"},2:{fontSize:"1.4em",fontWeight:700,lineHeight:1.25,margin:"0.6em 0 0.35em"},3:{fontSize:"1.15em",fontWeight:600,lineHeight:1.3,margin:"0.5em 0 0.3em"}},yn={border:"#2563eb",background:"#e0f2fe"},xn={border:"#dc2626",background:"#fee2e2"};function Qa(e){return{display:"inline-block",verticalAlign:"middle",border:`2px solid ${e?.border||yn.border}`,background:e?.background||yn.background,borderRadius:E("4px"),padding:"0.17em 0.37em"}}var Pr=`${E("6px")} ${E("8px")}`;function Ya(e){let r=e?.shape==="circle"?"50%":"9999px";return{display:"inline-block",verticalAlign:"middle",border:`2px solid ${e?.border||xn.border}`,background:e?.background||xn.background,borderRadius:r,padding:"0.15em 0.45em"}}function Se(e,r,t){return F("div",{className:"exercise-content",children:e.content.map((n,a)=>ye(n,`node-${a}`,r,t))})}function ye(e,r,t,n){switch(e.type){case"choiceSet":case"inlineChoiceSet":return F(Er,{node:e,validationFeedback:t?.get(e.id)},r);case"blank":return e.attrs.mode==="typed"?F(Mr,{node:e,validationFeedback:t?.get(e.id)},r):F(Ir,{node:e,validationFeedback:t?.get(e.id)},r);case"blankPool":return F(Lr,{node:e},r);case"inlinePool":return F(Tr,{node:e},r);case"matchingSet":return F($r,{node:e,validationFeedback:t?.get(e.id)},r);case"aiAnswerInput":return F(zr,{node:e,validationFeedback:t?.get(e.id)},r);case"openResponseNode":return F(Dr,{node:e,validationFeedback:t?.get(e.id),readOnly:n?.readOnly,mediaHandler:n?.mediaHandler},r);case"mathResponse":return F(Fr,{nodeId:e.id,placeholder:e.attrs?.placeholder,hint:e.attrs?.hint,validationFeedback:t?.get(e.id),readOnly:n?.readOnly},r);case"codingResponse":return F(jr,{node:e,validationFeedback:t?.get(e.id),readOnly:n?.readOnly,executor:n?.codeExecutor},r);case"aiEvaluationConfig":return null;case"paragraph":{let a=e.attrs,o=a?.textAlign,s=a?.dir||void 0;return F("p",{dir:s,style:o?{textAlign:o}:void 0,children:e.content?.map((i,c)=>ye(i,`${r}-${c}`,t,n))},r)}case"heading":{let a=e.attrs.level??1,o=`h${a}`,s=e.attrs,i=s?.textAlign,c=s?.dir||void 0,d=bn[a]??bn[3];return F(o,{dir:c,style:{...d,...i?{textAlign:i}:{}},children:e.content?.map((l,p)=>ye(l,`${r}-${p}`,t,n))},r)}case"blockquote":{let a=e.attrs,o=a?.dir||void 0,s=a?.textAlign;return F("blockquote",{dir:o,style:{borderInlineStart:"3px solid #d6d3cc",paddingInlineStart:"1em",margin:"0.75em 0",color:"#565b66",fontStyle:"italic",...s?{textAlign:s}:{}},children:e.content?.map((i,c)=>ye(i,`${r}-${c}`,t,n))},r)}case"text":{let a=e,o=a.text??"",s=a.marks??[];if(s.length===0)return F("span",{children:o},r);let i={};for(let d of s)d.type==="textStyle"&&(d.attrs?.color&&(i.color=d.attrs.color),d.attrs?.fontSize&&(i.fontSize=d.attrs.fontSize),d.attrs?.fontFamily&&(i.fontFamily=d.attrs.fontFamily));let c=o;for(let d of s)switch(d.type){case"bold":c=F("strong",{children:c});break;case"italic":c=F("em",{children:c});break;case"underline":c=F("u",{children:c});break;case"strike":c=F("s",{children:c});break;case"code":c=F("code",{children:c});break;case"subscript":c=F("sub",{children:c});break;case"superscript":c=F("sup",{children:c});break;case"boxedText":c=F("span",{style:Qa(d.attrs),children:c});break;case"circleText":c=F("span",{style:Ya(d.attrs),children:c});break}return F("span",{style:Object.keys(i).length>0?i:void 0,children:c},r)}case"hardBreak":return F("br",{},r);case"resizableImage":return F("img",{src:e.attrs?.src||void 0,alt:e.attrs?.alt||"",style:{display:"inline-block",verticalAlign:"middle",width:Re(e.attrs?.width||void 0)??"auto",height:Re(e.attrs?.height||void 0)??"auto",maxWidth:"100%"}},r);case"resizableAudio":return F("span",{style:{display:"inline-flex",verticalAlign:"middle",alignItems:"center",background:"#f1f5f9",borderRadius:E("8px"),padding:`${E("4px")} ${E("8px")}`,maxWidth:"100%"},children:F("audio",{controls:!0,src:e.attrs?.src||void 0,style:{display:"block",width:E("320px"),maxWidth:"100%"}})},r);case"resizableVideo":return F("video",{src:e.attrs?.src||void 0,controls:!0,style:{display:"inline-block",verticalAlign:"middle",width:Re(e.attrs?.width||void 0)??"auto",height:Re(e.attrs?.height||void 0)??"auto",maxWidth:"100%"}},r);case"youtubeEmbed":return F("iframe",{src:`https://www.youtube.com/embed/${e.attrs?.videoId||""}`,width:e.attrs?.width||480,height:e.attrs?.height||270,allowFullScreen:!0,frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",style:{display:"inline-block",verticalAlign:"middle",border:0,width:Re(e.attrs?.width||480),height:Re(e.attrs?.height||270)}},r);case"inlineMath":return F("span",{dir:"ltr",style:{unicodeBidi:"isolate",display:"inline-block"},className:"math-inline",dangerouslySetInnerHTML:{__html:ur(e.attrs?.latex??"",!1,!0)}},r);case"blockMath":return F("div",{dir:"ltr",style:{unicodeBidi:"isolate",textAlign:"center",margin:"1em 0"},className:"math-block",dangerouslySetInnerHTML:{__html:ur(e.attrs?.latex??"",!0,!0)}},r);case"variable":return F("span",{className:"variable",children:`{${e.attrs?.name}}`},r);default:{let a=e;return a.type==="bulletList"?F("ul",{style:{listStyleType:"disc",paddingLeft:"1.5em",margin:"0.5em 0"},children:a.content?.map((o,s)=>ye(o,`${r}-${s}`,t,n))},r):a.type==="orderedList"?F("ol",{style:{listStyleType:"decimal",paddingLeft:"1.5em",margin:"0.5em 0"},children:a.content?.map((o,s)=>ye(o,`${r}-${s}`,t,n))},r):a.type==="listItem"?F("li",{children:a.content?.map((o,s)=>ye(o,`${r}-${s}`,t,n))},r):a.type==="table"?F("div",{style:{overflowX:"auto",margin:`${E("1.25rem")} 0`},children:F("table",{style:{borderCollapse:"collapse",width:"100%",tableLayout:"fixed"},children:F("tbody",{children:a.content?.map((o,s)=>ye(o,`${r}-${s}`,t,n))})})},r):a.type==="tableRow"?F("tr",{children:a.content?.map((o,s)=>ye(o,`${r}-${s}`,t,n))},r):a.type==="tableCell"?F("td",{colSpan:a.attrs?.colspan,rowSpan:a.attrs?.rowspan,style:{border:"1px solid #d1d5db",padding:Pr,verticalAlign:"top"},children:a.content?.map((o,s)=>ye(o,`${r}-${s}`,t,n))},r):a.type==="tableHeader"?F("th",{colSpan:a.attrs?.colspan,rowSpan:a.attrs?.rowspan,style:{border:"1px solid #d1d5db",padding:Pr,verticalAlign:"top",background:"#f3f4f6",fontWeight:600},children:a.content?.map((o,s)=>ye(o,`${r}-${s}`,t,n))},r):(console.warn(`Unknown node type during interpretation: ${e.type}`),null)}}}function te(e,r){return e.map(t=>{if(t.type==="text"){let n=Ye(t.text??""),a=t.marks??[],o=[];for(let s of a)s.type==="textStyle"&&(s.attrs?.color&&o.push(`color:${s.attrs.color}`),s.attrs?.fontSize&&o.push(`font-size:${s.attrs.fontSize}`),s.attrs?.fontFamily&&o.push(`font-family:${s.attrs.fontFamily}`));o.length>0&&(n=`<span style="${o.join(";")}">${n}</span>`);for(let s of a)switch(s.type){case"bold":n=`<strong>${n}</strong>`;break;case"italic":n=`<em>${n}</em>`;break;case"underline":n=`<u>${n}</u>`;break;case"strike":n=`<s>${n}</s>`;break;case"code":n=`<code>${n}</code>`;break;case"subscript":n=`<sub>${n}</sub>`;break;case"superscript":n=`<sup>${n}</sup>`;break;case"boxedText":{let i=s.attrs?.border||"#2563eb",c=s.attrs?.background||"#e0f2fe";n=`<span style="display:inline-block;vertical-align:middle;border:2px solid ${i};background:${c};border-radius:${E("4px")};padding:0.17em 0.37em">${n}</span>`;break}case"circleText":{let i=s.attrs?.border||"#dc2626",c=s.attrs?.background||"#fee2e2",d=s.attrs?.shape==="circle"?"50%":"9999px";n=`<span style="display:inline-block;vertical-align:middle;border:2px solid ${i};background:${c};border-radius:${d};padding:0.15em 0.45em">${n}</span>`;break}}return n}if(t.type==="paragraph"){let n=t.content?te(t.content,r):"",a=t.attrs?.dir,o=t.attrs?.textAlign,s=a?` dir="${a}"`:"",i=o?` style="text-align:${o}"`:"";return r?.stripParagraphs?n:`<p${s}${i}>${n}</p>`}if(t.type==="hardBreak")return"<br/>";if(t.type==="table"){let n=t.content?te(t.content,r):"";return`<div style="overflow-x:auto;margin:${E("1.25rem")} 0"><table style="border-collapse:collapse;width:100%;table-layout:fixed"><tbody>${n}</tbody></table></div>`}if(t.type==="tableRow")return`<tr>${t.content?te(t.content,r):""}</tr>`;if(t.type==="tableCell"){let n=t.content?te(t.content,r):"",a=t.attrs?.colspan?` colspan="${t.attrs.colspan}"`:"",o=t.attrs?.rowspan?` rowspan="${t.attrs.rowspan}"`:"";return`<td${a}${o} style="border:1px solid #d1d5db;padding:${Pr};vertical-align:top">${n}</td>`}if(t.type==="tableHeader"){let n=t.content?te(t.content,r):"",a=t.attrs?.colspan?` colspan="${t.attrs.colspan}"`:"",o=t.attrs?.rowspan?` rowspan="${t.attrs.rowspan}"`:"";return`<th${a}${o} style="border:1px solid #d1d5db;padding:${Pr};vertical-align:top;background:#f3f4f6;font-weight:600">${n}</th>`}if(t.type==="bulletList")return`<ul style="list-style-type:disc;padding-left:1.5em">${t.content?te(t.content,r):""}</ul>`;if(t.type==="orderedList")return`<ol style="list-style-type:decimal;padding-left:1.5em">${t.content?te(t.content,r):""}</ol>`;if(t.type==="listItem")return`<li>${t.content?te(t.content,r):""}</li>`;if(t.type==="blockquote"){let n=t.content?te(t.content,r):"";return`<blockquote${t.attrs?.dir?` dir="${t.attrs.dir}"`:""} style="border-inline-start:3px solid #d6d3cc;padding-inline-start:1em;margin:0.75em 0;color:#565b66;font-style:italic">${n}</blockquote>`}if(t.type==="resizableImage"){let n=t.attrs??{},a=Cr(n.width),o=Cr(n.height);return`<img src="${Ye(n.src??"")}" alt="${Ye(n.alt??"")}" style="display:inline-block;vertical-align:middle;max-width:100%;${a?`width:${a};`:""}${o?`height:${o};`:""}"/>`}if(t.type==="resizableAudio"){let n=t.attrs??{};return`<span style="display:inline-flex;vertical-align:middle;align-items:center;background:#f1f5f9;border-radius:${E("8px")};padding:${E("4px")} ${E("8px")};max-width:100%"><audio controls src="${Ye(n.src??"")}" style="display:block;width:${E("320px")};max-width:100%"></audio></span>`}if(t.type==="resizableVideo"){let n=t.attrs??{},a=Cr(n.width),o=Cr(n.height);return`<video src="${Ye(n.src??"")}" controls style="display:inline-block;vertical-align:middle;max-width:100%;${a?`width:${a};`:""}${o?`height:${o};`:""}"></video>`}if(t.type==="youtubeEmbed"){let n=t.attrs??{};return`<iframe src="https://www.youtube.com/embed/${Ye(n.videoId??"")}" width="${n.width||480}" height="${n.height||270}" allowfullscreen frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" style="display:inline-block;vertical-align:middle;border:0;width:${Re(n.width||480)};height:${Re(n.height||270)}"></iframe>`}return t.type==="inlineMath"?`<span dir="ltr" class="math-inline" style="unicode-bidi:isolate;display:inline-block">${ur(t.attrs?.latex??"",!1,!0)}</span>`:t.type==="blockMath"?`<div dir="ltr" class="math-block" style="unicode-bidi:isolate;text-align:center;margin:1em 0">${ur(t.attrs?.latex??"",!0,!0)}</div>`:t.type==="variable"?`<span class="variable">{${Ye(t.attrs?.name??"")}}</span>`:""}).join("")}function Cr(e){return e==null||e===""?null:Re(e)??null}function Ye(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}import{jsx as Ka}from"react/jsx-runtime";import{createContext as Ja,useContext as vn}from"react";var rr={submitButton:"Submit",showHint:"Show hint",clickToRemove:"Click to remove",aiEvaluationInProgress:"AI evaluation in progress\u2026",aiEvaluationInProgressAria:"AI evaluation in progress",shortAnswerPlaceholder:"Short answer\u2026",longAnswerPlaceholder:"Write your answer here\u2026",minWordsLabel:e=>`Min: ${e}`,wordBank:"Word Bank",chooseN:e=>`(choose ${e})`,annexDefaultLabel:"Documents",annexOpen:e=>`Open ${e}`,annexClose:"Close",choiceLetters:"ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""),openResponseTextPlaceholder:"Write your answer here\u2026",openResponseWords:"words",openResponseChars:"chars",openResponseDropZoneLabel:"Drag & drop files here, or",openResponseDropZoneBrowse:"browse",openResponseUploading:"Uploading\u2026",openResponseNoSubmission:"No submission",openResponseFile:"File",openResponseAttachFile:"Attach a file",openResponseAttachFiles:"Attach files",openResponseAttachedFiles:"Attached files",openResponseTypeImage:"Image",openResponseTypePdf:"PDF",openResponseTypeAudio:"Audio",openResponseTypeVideo:"Video",openResponseTypeVideoLink:"Video link",openResponseVideoLinkPlaceholder:"Paste YouTube or Vimeo URL\u2026",openResponseAddVideoLink:"Add",openResponseTapToRecord:"Tap to start recording",openResponseTapToRecordScreen:"Click to start screen recording",openResponseRequestingPermission:"Requesting permission\u2026",openResponsePermissionDenied:"Microphone/camera access denied. Please allow access in your browser settings.",openResponseMediaHandlerRequired:"A media handler is required to save recordings.",openResponseStopRecording:"Stop",openResponseReRecord:"Re-record",openResponseConfirmRecording:"Use this recording",openResponseRecordingSubmitted:"Recording submitted",openResponseAwaitingReview:"Submitted, awaiting teacher review",openResponseTeacherFeedbackLabel:"Teacher feedback",openResponseGradeThisResponse:"Grade this response",openResponseGradeScoreLabel:e=>`Score (max ${e})`,openResponseGradeFeedbackLabel:"Feedback (optional)",openResponseGradeFeedbackPlaceholder:"Add feedback for the student\u2026",openResponseSubmitGrade:"Submit Grade",openResponseGradeSubmitted:(e,r)=>`Grade submitted: ${e} / ${r}`,openResponseRubricTitle:"Rubric",openResponseRubricCriterionPoints:(e,r)=>`${e} / ${r} pts`,openResponseAiSuggestionTitle:"AI Pre-grading Suggestion",openResponseAiSuggestedScore:(e,r)=>`Suggested score: ${e} / ${r}`,openResponseAiEvidence:"Evidence:",openResponseAiApplySuggestion:"Apply suggestion",openResponseStudentAnswerTitle:"Student answer"};var Or={submitButton:"Valider",showHint:"Voir l'indice",clickToRemove:"Cliquer pour retirer",aiEvaluationInProgress:"\xC9valuation IA en cours\u2026",aiEvaluationInProgressAria:"\xC9valuation IA en cours",shortAnswerPlaceholder:"R\xE9ponse courte\u2026",longAnswerPlaceholder:"\xC9cris ta r\xE9ponse ici\u2026",minWordsLabel:e=>`Min. : ${e}`,wordBank:"Banque de mots",chooseN:e=>`(choisir ${e})`,annexDefaultLabel:"Documents",annexOpen:e=>`Ouvrir ${e}`,annexClose:"Fermer",choiceLetters:"ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""),openResponseTextPlaceholder:"\xC9cris ta r\xE9ponse ici\u2026",openResponseWords:"mots",openResponseChars:"car.",openResponseDropZoneLabel:"Glisse-d\xE9pose des fichiers ici, ou",openResponseDropZoneBrowse:"parcourir",openResponseUploading:"Envoi en cours\u2026",openResponseNoSubmission:"Aucun fichier d\xE9pos\xE9",openResponseFile:"Fichier",openResponseAttachFile:"Joindre un fichier",openResponseAttachFiles:"Joindre des fichiers",openResponseAttachedFiles:"Fichiers joints",openResponseTypeImage:"Image",openResponseTypePdf:"PDF",openResponseTypeAudio:"Audio",openResponseTypeVideo:"Vid\xE9o",openResponseTypeVideoLink:"Lien vid\xE9o",openResponseVideoLinkPlaceholder:"Coller un lien YouTube ou Vimeo\u2026",openResponseAddVideoLink:"Ajouter",openResponseTapToRecord:"Appuyer pour d\xE9marrer l'enregistrement",openResponseTapToRecordScreen:"Cliquer pour d\xE9marrer l'enregistrement d'\xE9cran",openResponseRequestingPermission:"Demande d'autorisation\u2026",openResponsePermissionDenied:"Acc\xE8s au micro/cam\xE9ra refus\xE9. Autorise l'acc\xE8s dans les param\xE8tres du navigateur.",openResponseMediaHandlerRequired:"Un gestionnaire de m\xE9dias est requis pour sauvegarder les enregistrements.",openResponseStopRecording:"Arr\xEAter",openResponseReRecord:"R\xE9enregistrer",openResponseConfirmRecording:"Utiliser cet enregistrement",openResponseRecordingSubmitted:"Enregistrement soumis",openResponseAwaitingReview:"Soumis, en attente de correction par l'enseignant",openResponseTeacherFeedbackLabel:"Commentaire de l'enseignant",openResponseGradeThisResponse:"Corriger cette r\xE9ponse",openResponseGradeScoreLabel:e=>`Note (max ${e})`,openResponseGradeFeedbackLabel:"Commentaire (facultatif)",openResponseGradeFeedbackPlaceholder:"Ajouter un commentaire pour l'\xE9l\xE8ve\u2026",openResponseSubmitGrade:"Valider la note",openResponseGradeSubmitted:(e,r)=>`Note envoy\xE9e : ${e} / ${r}`,openResponseRubricTitle:"Grille d'\xE9valuation",openResponseRubricCriterionPoints:(e,r)=>`${e} / ${r} pts`,openResponseAiSuggestionTitle:"Suggestion de correction par IA",openResponseAiSuggestedScore:(e,r)=>`Score sugg\xE9r\xE9 : ${e} / ${r}`,openResponseAiEvidence:"Extrait :",openResponseAiApplySuggestion:"Appliquer la suggestion",openResponseStudentAnswerTitle:"R\xE9ponse de l'\xE9l\xE8ve"};var Br={submitButton:"\u0625\u0631\u0633\u0627\u0644",showHint:"\u0625\u0638\u0647\u0627\u0631 \u0627\u0644\u062A\u0644\u0645\u064A\u062D",clickToRemove:"\u0627\u0646\u0642\u0631 \u0644\u0644\u0625\u0632\u0627\u0644\u0629",aiEvaluationInProgress:"\u062C\u0627\u0631\u064D \u0627\u0644\u062A\u0642\u064A\u064A\u0645 \u0628\u0627\u0644\u0630\u0643\u0627\u0621 \u0627\u0644\u0627\u0635\u0637\u0646\u0627\u0639\u064A\u2026",aiEvaluationInProgressAria:"\u062C\u0627\u0631\u064D \u0627\u0644\u062A\u0642\u064A\u064A\u0645 \u0628\u0627\u0644\u0630\u0643\u0627\u0621 \u0627\u0644\u0627\u0635\u0637\u0646\u0627\u0639\u064A",shortAnswerPlaceholder:"\u0625\u062C\u0627\u0628\u0629 \u0642\u0635\u064A\u0631\u0629\u2026",longAnswerPlaceholder:"\u0627\u0643\u062A\u0628 \u0625\u062C\u0627\u0628\u062A\u0643 \u0647\u0646\u0627\u2026",minWordsLabel:e=>`\u0627\u0644\u062D\u062F \u0627\u0644\u0623\u062F\u0646\u0649: ${e}`,wordBank:"\u0628\u0646\u0643 \u0627\u0644\u0643\u0644\u0645\u0627\u062A",chooseN:e=>`(\u0627\u062E\u062A\u0631 ${e})`,annexDefaultLabel:"\u0627\u0644\u0645\u0633\u062A\u0646\u062F\u0627\u062A",annexOpen:e=>`\u0641\u062A\u062D ${e}`,annexClose:"\u0625\u063A\u0644\u0627\u0642",choiceLetters:["\u0623","\u0628","\u062C","\u062F","\u0647\u0640","\u0648","\u0632","\u062D","\u0637","\u064A","\u0643","\u0644","\u0645","\u0646","\u0633","\u0639","\u0641","\u0635","\u0642","\u0631","\u0634","\u062A","\u062B","\u062E","\u0630","\u0636","\u0638","\u063A"],openResponseTextPlaceholder:"\u0627\u0643\u062A\u0628 \u0625\u062C\u0627\u0628\u062A\u0643 \u0647\u0646\u0627\u2026",openResponseWords:"\u0643\u0644\u0645\u0629",openResponseChars:"\u062D\u0631\u0641",openResponseDropZoneLabel:"\u0627\u0633\u062D\u0628 \u0627\u0644\u0645\u0644\u0641\u0627\u062A \u0648\u0623\u0641\u0644\u062A\u0647\u0627 \u0647\u0646\u0627\u060C \u0623\u0648",openResponseDropZoneBrowse:"\u062A\u0635\u0641\u0651\u062D",openResponseUploading:"\u062C\u0627\u0631\u064D \u0627\u0644\u0631\u0641\u0639\u2026",openResponseNoSubmission:"\u0644\u0627 \u064A\u0648\u062C\u062F \u062A\u0633\u0644\u064A\u0645",openResponseFile:"\u0645\u0644\u0641",openResponseAttachFile:"\u0625\u0631\u0641\u0627\u0642 \u0645\u0644\u0641",openResponseAttachFiles:"\u0625\u0631\u0641\u0627\u0642 \u0645\u0644\u0641\u0627\u062A",openResponseAttachedFiles:"\u0627\u0644\u0645\u0644\u0641\u0627\u062A \u0627\u0644\u0645\u0631\u0641\u0642\u0629",openResponseTypeImage:"\u0635\u0648\u0631\u0629",openResponseTypePdf:"PDF",openResponseTypeAudio:"\u0635\u0648\u062A",openResponseTypeVideo:"\u0641\u064A\u062F\u064A\u0648",openResponseTypeVideoLink:"\u0631\u0627\u0628\u0637 \u0641\u064A\u062F\u064A\u0648",openResponseVideoLinkPlaceholder:"\u0627\u0644\u0635\u0642 \u0631\u0627\u0628\u0637 \u064A\u0648\u062A\u064A\u0648\u0628 \u0623\u0648 Vimeo\u2026",openResponseAddVideoLink:"\u0625\u0636\u0627\u0641\u0629",openResponseTapToRecord:"\u0627\u0646\u0642\u0631 \u0644\u0628\u062F\u0621 \u0627\u0644\u062A\u0633\u062C\u064A\u0644",openResponseTapToRecordScreen:"\u0627\u0646\u0642\u0631 \u0644\u0628\u062F\u0621 \u062A\u0633\u062C\u064A\u0644 \u0627\u0644\u0634\u0627\u0634\u0629",openResponseRequestingPermission:"\u062C\u0627\u0631\u064D \u0637\u0644\u0628 \u0627\u0644\u0625\u0630\u0646\u2026",openResponsePermissionDenied:"\u062A\u0645 \u0631\u0641\u0636 \u0627\u0644\u0648\u0635\u0648\u0644 \u0625\u0644\u0649 \u0627\u0644\u0645\u064A\u0643\u0631\u0648\u0641\u0648\u0646/\u0627\u0644\u0643\u0627\u0645\u064A\u0631\u0627. \u064A\u064F\u0631\u062C\u0649 \u0627\u0644\u0633\u0645\u0627\u062D \u0628\u0627\u0644\u0648\u0635\u0648\u0644 \u0645\u0646 \u0625\u0639\u062F\u0627\u062F\u0627\u062A \u0627\u0644\u0645\u062A\u0635\u0641\u062D.",openResponseMediaHandlerRequired:"\u064A\u0644\u0632\u0645 \u0645\u0639\u0627\u0644\u062C \u0648\u0633\u0627\u0626\u0637 \u0644\u062D\u0641\u0638 \u0627\u0644\u062A\u0633\u062C\u064A\u0644\u0627\u062A.",openResponseStopRecording:"\u0625\u064A\u0642\u0627\u0641",openResponseReRecord:"\u0625\u0639\u0627\u062F\u0629 \u0627\u0644\u062A\u0633\u062C\u064A\u0644",openResponseConfirmRecording:"\u0627\u0633\u062A\u062E\u062F\u0627\u0645 \u0647\u0630\u0627 \u0627\u0644\u062A\u0633\u062C\u064A\u0644",openResponseRecordingSubmitted:"\u062A\u0645 \u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u062A\u0633\u062C\u064A\u0644",openResponseAwaitingReview:"\u062A\u0645 \u0627\u0644\u0625\u0631\u0633\u0627\u0644\u060C \u0641\u064A \u0627\u0646\u062A\u0638\u0627\u0631 \u0645\u0631\u0627\u062C\u0639\u0629 \u0627\u0644\u0645\u0639\u0644\u0645",openResponseTeacherFeedbackLabel:"\u0645\u0644\u0627\u062D\u0638\u0627\u062A \u0627\u0644\u0645\u0639\u0644\u0645",openResponseGradeThisResponse:"\u062A\u0635\u062D\u064A\u062D \u0647\u0630\u0647 \u0627\u0644\u0625\u062C\u0627\u0628\u0629",openResponseGradeScoreLabel:e=>`\u0627\u0644\u062F\u0631\u062C\u0629 (\u0627\u0644\u062D\u062F \u0627\u0644\u0623\u0642\u0635\u0649 ${e})`,openResponseGradeFeedbackLabel:"\u0645\u0644\u0627\u062D\u0638\u0627\u062A (\u0627\u062E\u062A\u064A\u0627\u0631\u064A)",openResponseGradeFeedbackPlaceholder:"\u0623\u0636\u0641 \u0645\u0644\u0627\u062D\u0638\u0627\u062A \u0644\u0644\u0637\u0627\u0644\u0628\u2026",openResponseSubmitGrade:"\u0627\u0639\u062A\u0645\u0627\u062F \u0627\u0644\u062F\u0631\u062C\u0629",openResponseGradeSubmitted:(e,r)=>`\u062A\u0645 \u0627\u0639\u062A\u0645\u0627\u062F \u0627\u0644\u062F\u0631\u062C\u0629: ${e} / ${r}`,openResponseRubricTitle:"\u0633\u0644\u0651\u0645 \u0627\u0644\u062A\u0635\u062D\u064A\u062D",openResponseRubricCriterionPoints:(e,r)=>`${e} / ${r} \u0646\u0642\u0637\u0629`,openResponseAiSuggestionTitle:"\u0627\u0642\u062A\u0631\u0627\u062D \u0627\u0644\u062A\u0635\u062D\u064A\u062D \u0627\u0644\u0645\u0633\u0628\u0642 \u0628\u0627\u0644\u0630\u0643\u0627\u0621 \u0627\u0644\u0627\u0635\u0637\u0646\u0627\u0639\u064A",openResponseAiSuggestedScore:(e,r)=>`\u0627\u0644\u062F\u0631\u062C\u0629 \u0627\u0644\u0645\u0642\u062A\u0631\u062D\u0629: ${e} / ${r}`,openResponseAiEvidence:"\u0627\u0644\u0623\u062F\u0644\u0629:",openResponseAiApplySuggestion:"\u062A\u0637\u0628\u064A\u0642 \u0627\u0644\u0627\u0642\u062A\u0631\u0627\u062D",openResponseStudentAnswerTitle:"\u0625\u062C\u0627\u0628\u0629 \u0627\u0644\u0637\u0627\u0644\u0628"};var Xa={en:rr,fr:Or,ar:Br},pt=Ja(null);function re(){return vn(pt)??rr}function mt(e){let r=vn(pt);return e&&Xa[e]||r||rr}function fr({locale:e,children:r}){let t=mt(e);return Ka(pt.Provider,{value:t,children:r})}import{jsx as Za}from"react/jsx-runtime";import{createContext as eo,useContext as wn,useMemo as kn}from"react";var ro={sm:.875,md:1,lg:1.25,xl:1.5},ut=eo(null);function to(e,r){let t={...e??{}};if(r)for(let[n,a]of Object.entries(r))a!==void 0&&(t[n]=a);return t}function no(e){return typeof e=="number"?Number.isFinite(e)&&e>0?e:1:e?ro[e]??1:1}function _e(e){let r=e??{};return{scale:no(r.size),sizeSet:r.size!==void 0,choiceLabels:r.choiceLabels??"marks",choiceColumns:r.choiceColumns,layoutBy:r.layoutBy??"window",motion:r.motion??"full",shuffleSeed:r.shuffleSeed}}function xe(e){let r=wn(ut);return kn(()=>to(r,e),[r,e?.size,e?.choiceLabels,e?.choiceColumns,e?.layoutBy,e?.motion,e?.shuffleSeed])}function Ne(){let e=wn(ut);return kn(()=>_e(e),[e])}function ve({display:e,children:r}){let t=xe(e);return Za(ut.Provider,{value:t,children:r})}function Ae(e){if(e.sizeSet)return{"--edp-scale":String(e.scale)}}function Ke(){let{motion:e}=Ne();return{hop:e==="none"?"":"animate-hop",shake:e==="full"?"animate-shake":"",wobble:e==="full"?"animate-wobble":""}}function ao(e){let r=2166136261;for(let t=0;t<e.length;t++)r^=e.charCodeAt(t),r=Math.imul(r,16777619);return r>>>0}function oo(e){return()=>{e=e+1831565813|0;let r=Math.imul(e^e>>>15,1|e);return r=r+Math.imul(r^r>>>7,61|r)^r,((r^r>>>14)>>>0)/4294967296}}function hr(e,r){let t=[...e],n=oo(ao(r));for(let a=t.length-1;a>0;a--){let o=Math.floor(n()*(a+1));[t[a],t[o]]=[t[o],t[a]]}return t}function ft({node:e}){if(e.type==="text"){if(!e.marks||e.marks.length===0)return G(Rn,{children:e.text});let r=e.text||"";for(let t of e.marks)t.type==="bold"?r=G("strong",{children:r}):t.type==="italic"?r=G("em",{children:r}):t.type==="underline"?r=G("u",{children:r}):t.type==="strike"?r=G("s",{children:r}):t.type==="textStyle"&&t.attrs?.color&&(r=G("span",{style:{color:t.attrs.color},children:r}));return G(Rn,{children:r})}return e.type==="paragraph"?G("span",{className:"block",children:e.content?.map((r,t)=>G(ft,{node:r},t))??G("br",{})}):e.type==="hardBreak"?G("br",{}):e.content?G("span",{className:"block",children:e.content.map((r,t)=>G(ft,{node:r},t))}):null}function lo({nodes:e}){return G("span",{className:"block space-y-1",style:{color:"var(--ink, #1d2025)"},children:e.map((r,t)=>G(ft,{node:r},t))})}function Sn({hint:e}){let r=re(),[t,n]=qr(!1),[a,o]=qr(!1),s=co(null);return Wr(()=>{if(!a)return;let l=p=>{s.current&&!s.current.contains(p.target)&&(o(!1),n(!1))};return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[a]),Be("span",{ref:s,className:"relative inline-flex items-center align-middle",onMouseEnter:()=>n(!0),onMouseLeave:()=>{a||n(!1)},children:[G("button",{type:"button",onClick:l=>{l.stopPropagation(),a?(o(!1),n(!1)):(o(!0),n(!0))},className:Pe("player-blank-hint-btn select-none",a&&"player-blank-hint-btn--pinned"),"aria-label":r.showHint,children:"?"}),t&&G("span",{className:"player-blank-hint-pop",onClick:l=>l.stopPropagation(),children:G(lo,{nodes:e})})]})}function po(e){return[...e].map(r=>({v:r,r:Math.random()})).sort((r,t)=>r.r-t.r).map(r=>r.v)}var mo=e=>e.replace(/ {2,}/g,r=>"&nbsp;".repeat(r.length-1)+" "),uo=new Set(["image","resizableImage","resizableVideo","youtubeEmbed"]);function An(e){return(e??[]).some(r=>uo.has(r?.type)||An(r?.content))}var _n=()=>G("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:3,children:G("path",{d:"M5 13l4 4L19 7"})}),Nn=()=>G("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:3,children:G("path",{d:"M6 6l12 12M18 6L6 18"})});function Er({node:e,validationFeedback:r}){let t=de(),n=re(),a=Ne(),o=Ke(),{id:s,content:i,attrs:c}=e,d=c.shuffle??!1,l="prompt"in c?c.prompt:void 0,p="separator"in c?c.separator??"/":"/",x="pickLimit"in c&&c.pickLimit?c.pickLimit:1,f="layout"in c?c.layout??"row":"row",y=e.type==="inlineChoiceSet",u=JSON.stringify(i),g=d&&a.shuffleSeed!==void 0,R=io(()=>g?hr(i,`${a.shuffleSeed}:${s}`):null,[g,a.shuffleSeed,s,u]),[h,P]=qr(i);Wr(()=>{g||P(d?po(i):i)},[d,g,u]);let b=R??h,[k,A]=qr(new Set),C=r?.showFeedback??!1,$=r?.correctChoiceIds||[];Wr(()=>{let B=w=>{let D=w.answers.find(H=>H.nodeId===s&&H.type==="choiceSet");D&&"selectedIds"in D.answer&&A(new Set(D.answer.selectedIds))};return t.on("answers:prefill",B),()=>t.off("answers:prefill",B)},[s,t]),Wr(()=>{t.emit({type:"answer:changed",answer:{nodeId:s,type:"choiceSet",timestamp:Date.now(),answer:{selectedIds:Array.from(k)}}})},[k,s,t]);let v=B=>{C||A(w=>{let S=new Set(w);return x===1?S.has(B)?S.delete(B):(S.clear(),S.add(B)):S.has(B)?S.delete(B):S.size<x&&S.add(B),S})},m=B=>mo(te(B.content)),L=B=>{let w=k.has(B),S=$.includes(B);return C?S&&w?"correct":S&&!w?"correct-unchosen":!S&&w?"incorrect":"muted":w?"selected":"idle"},T={idle:"",selected:"player-choice--selected",correct:Pe("player-choice--correct",o.hop),"correct-unchosen":"player-choice--correct-unchosen",incorrect:Pe("player-choice--incorrect",o.shake),muted:"player-choice--muted"},q={idle:"",selected:"player-inline-choice--selected",correct:Pe("player-inline-choice--correct",o.hop),"correct-unchosen":"player-inline-choice--correct-unchosen",incorrect:Pe("player-inline-choice--incorrect",o.shake),muted:"player-inline-choice--muted"};if(y)return Be("span",{className:"inline-choice",children:[l&&Be("span",{className:"mr-2 font-medium",children:[l,x>1?G("span",{className:"ml-1 opacity-60",children:n.chooseN(x)}):null]}),b.map((B,w)=>Be(so,{children:[G("button",{type:"button",disabled:C,onClick:()=>v(B.id),className:Pe("player-inline-choice",q[L(B.id)]),"aria-pressed":k.has(B.id),dangerouslySetInnerHTML:{__html:m(B)}}),w<b.length-1&&G("span",{className:"mx-1",children:p})]},B.id)),c.hint&&c.hint.length>0&&G(Sn,{hint:c.hint})]});let _=a.layoutBy==="box",I=a.choiceColumns?Math.min(a.choiceColumns,b.length):0,W=I?{gridAutoRows:"1fr",gridTemplateColumns:`repeat(${I}, minmax(0, 1fr))`}:{gridAutoRows:"1fr"},z=b.some(B=>An(B.content)),O=a.choiceLabels==="letters",Y=B=>n.choiceLetters[B]??String(B+1);return Be("div",{className:Pe("cs-player my-4 space-y-3",_&&"cs-player--box"),children:[l&&Be("p",{className:"font-medium",children:[l,x>1?Be("span",{className:"ml-2 text-sm opacity-70",children:["(choose ",x,")"]}):null]}),c.hint&&c.hint.length>0&&G(Sn,{hint:c.hint}),G("div",{className:Pe("cs-player__grid",f==="row"&&"cs-player__grid--row"),style:W,children:b.map((B,w)=>{let S=L(B.id),D=S==="incorrect"?"incorrect":S==="correct"||S==="correct-unchosen"?"correct":null;return Be("button",{type:"button",disabled:C,onClick:()=>v(B.id),className:Pe("player-choice",z&&"player-choice--tile",T[S]),"aria-pressed":k.has(B.id),children:[G("span",{className:Pe("player-choice__mark",x>1?"player-choice__mark--box":"player-choice__mark--radio",O&&"player-choice__mark--letter"),children:O?Y(w):S==="incorrect"?G(Nn,{}):G(_n,{})}),G("span",{className:"player-choice__text",dangerouslySetInnerHTML:{__html:m(B)}}),O&&D&&G("span",{className:`player-choice__verdict player-choice__verdict--${D}`,"aria-hidden":"true",children:D==="incorrect"?G(Nn,{}):G(_n,{})})]},B.id)})})]})}import{Fragment as ht,jsx as J,jsxs as Ur}from"react/jsx-runtime";import{useState as gt,useEffect as Hr,useRef as Cn,useCallback as fo}from"react";import We from"clsx";function bt({node:e}){if(e.type==="text"){if(!e.marks||e.marks.length===0)return J(ht,{children:e.text});let r=e.text||"";for(let t of e.marks)t.type==="bold"?r=J("strong",{children:r}):t.type==="italic"?r=J("em",{children:r}):t.type==="underline"?r=J("u",{children:r}):t.type==="strike"?r=J("s",{children:r}):t.type==="textStyle"&&t.attrs?.color&&(r=J("span",{style:{color:t.attrs.color},children:r}));return J(ht,{children:r})}return e.type==="paragraph"?J("span",{className:"block",children:e.content?.map((r,t)=>J(bt,{node:r},t))??J("br",{})}):e.type==="hardBreak"?J("br",{}):e.content?J("span",{className:"block",children:e.content.map((r,t)=>J(bt,{node:r},t))}):null}function ho({nodes:e}){return J("span",{className:"block space-y-1",children:e.map((r,t)=>J(bt,{node:r},t))})}function go({hint:e}){let r=re(),[t,n]=gt(!1),[a,o]=gt(!1),s=Cn(null);return Hr(()=>{if(!a)return;let l=p=>{s.current&&!s.current.contains(p.target)&&(o(!1),n(!1))};return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[a]),Ur("span",{ref:s,className:"relative inline-flex items-center align-middle",onMouseEnter:()=>n(!0),onMouseLeave:()=>{a||n(!1)},children:[J("button",{type:"button",onClick:l=>{l.stopPropagation(),a?(o(!1),n(!1)):(o(!0),n(!0))},className:We("player-blank-hint-btn select-none",a&&"player-blank-hint-btn--pinned"),"aria-label":r.showHint,children:"?"}),t&&J("span",{className:"player-blank-hint-pop",onClick:l=>l.stopPropagation(),children:J(ho,{nodes:e})})]})}function Mr({node:e,validationFeedback:r}){let t=de(),n=re(),a=Ke(),{id:o,attrs:s}=e,{placeholder:i="___",width:c="auto",hint:d}=s,l=Cn(null),p=i.trim().split(/\s+/).filter(Boolean).length,x=c==="auto"&&p>=4,[f,y]=gt(""),u=r?.showFeedback??!1,g=r?.state,R=g==="validating",h=r?.displayAnswer,P=r?.message;Hr(()=>{let C=$=>{let m=$.answers.find(L=>L.nodeId===o&&L.type==="blank");m&&"mode"in m.answer&&m.answer.mode==="typed"&&"text"in m.answer&&y(m.answer.text)};return t.on("answers:prefill",C),()=>t.off("answers:prefill",C)},[o,t]),Hr(()=>{t.emit({type:"answer:changed",answer:{nodeId:o,type:"blank",timestamp:Date.now(),answer:{mode:"typed",text:f}}})},[f,o,t]);let b=C=>{y(C.target.value)},k=fo(()=>{let C=l.current;C&&(C.style.height="auto",C.style.height=`${C.scrollHeight}px`)},[]);Hr(()=>{k()},[f,k]);let A=u&&!R;return Ur("span",{className:We("inline-flex flex-wrap items-center gap-x-1 gap-y-0.5 align-middle max-w-full",x&&"w-full"),children:[J("span",{className:We("relative inline-block shrink-0 min-w-0 max-w-full",x&&"w-full flex-1"),children:A?J("span",{className:We("player-typed-blank-feedback",x&&"w-full",g==="correct"&&We("player-typed-blank-feedback--correct",a.hop),g==="partial"&&"player-typed-blank-feedback--partial",g==="incorrect"&&We("player-typed-blank-feedback--incorrect",a.wobble)),children:f||J("span",{className:"opacity-40",children:i})}):Ur(ht,{children:[J("textarea",{ref:l,placeholder:i,value:f,onChange:b,disabled:u,rows:1,className:We("player-typed-blank",x&&"w-full",R&&"player-typed-blank--pending"),style:c!=="auto"?{width:c}:x?{width:"100%"}:{width:`${Math.max(7,f.length+1)}ch`,maxWidth:"100%"}}),!f&&!R&&J("span",{className:"absolute right-1 top-1/2 -translate-y-1/2 pointer-events-none text-sm",style:{color:"var(--ink-faint, #8d93a0)"},children:"\u270E"}),R&&J("span",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:J("span",{className:"player-typed-blank-spinner","aria-label":n.aiEvaluationInProgressAria})})]})}),u&&g==="incorrect"&&h&&Ur("span",{className:"player-blank-reveal",children:["(",h,")"]}),u&&P&&J("span",{className:We("player-blank-feedback",g==="correct"&&"player-blank-feedback--correct",g==="partial"&&"player-blank-feedback--partial",g==="incorrect"&&"player-blank-feedback--incorrect"),children:P}),d&&d.length>0&&J(go,{hint:d})]})}import{jsx as Gr,Fragment as $n,jsxs as wt}from"react/jsx-runtime";import{useEffect as zn}from"react";import Qr from"clsx";import{useDroppable as Po,useDndContext as Eo}from"@dnd-kit/core";import{jsx as bo}from"react/jsx-runtime";import{createContext as yo,useCallback as qe,useContext as xo,useEffect as vo,useMemo as Pn,useRef as wo,useState as yt}from"react";import{useDndMonitor as ko}from"@dnd-kit/core";var Mn=yo(null);function Ee(){let e=xo(Mn);if(!e)throw new Error("usePool must be used within a PoolProvider");return e}function En(e){let r={};for(let t of e??[])t.type==="blank"&&"mode"in t.answer&&t.answer.mode==="choice"&&"choiceId"in t.answer&&t.answer.choiceId&&(r[t.nodeId]={choiceId:t.answer.choiceId,poolId:t.answer.poolId||"",value:t.answer.value||""});return r}function Vr({children:e,initialAnswers:r}){let t=de(),n=Pn(()=>En(r),[r]),[a,o]=yt(n),[s,i]=yt({}),[c,d]=yt({}),l=wo(new Set);vo(()=>{let b=k=>{let A=En(k.answers);Object.keys(A).length!==0&&o(C=>{if(!Object.entries(A).some(([m,L])=>C[m]?.choiceId!==L.choiceId||C[m]?.poolId!==L.poolId||C[m]?.value!==L.value))return C;let v={...C,...A};return i(m=>{let L={...m};for(let[T,q]of Object.entries(m)){let _=new Set(Object.values(v).filter(I=>I.poolId===T).map(I=>I.choiceId));L[T]={...q,available:new Set(q.choices.map(I=>I.id).filter(I=>!_.has(I)))}}return L}),v})};return t.on("answers:prefill",b),()=>t.off("answers:prefill",b)},[t]);let p=qe((b,k)=>{i(A=>{let C=A[b];if(!C){let T=new Set;for(let _ of Object.values(a))_.poolId===b&&T.add(_.choiceId);let q=new Set(k.map(_=>_.id).filter(_=>!T.has(_)));return{...A,[b]:{choices:k,available:q}}}let $=new Set(C.choices.map(T=>T.id)),v=new Set(k.map(T=>T.id));if(!(k.some(T=>!$.has(T.id))||C.choices.some(T=>!v.has(T.id))))return A;let L=new Set;for(let T of C.available)v.has(T)&&L.add(T);for(let T of k)$.has(T.id)||L.add(T.id);return{...A,[b]:{choices:k,available:L}}})},[a]),x=qe((b,k)=>{d(A=>{let C=A[b]??[];return C.includes(k)?A:{...A,[b]:[...C,k]}}),!l.current.has(k)&&!a[k]&&(l.current.add(k),t.emit({type:"answer:changed",answer:{nodeId:k,type:"blank",timestamp:Date.now(),answer:{mode:"choice",choiceId:"",poolId:b,value:""}}}))},[a,t]),f=qe(b=>(c[b]??[]).find(A=>!a[A])??null,[c,a]),y=qe((b,k,A,C)=>{o($=>{let v=$[b];return v&&i(m=>{let L=m[v.poolId];if(!L)return m;let T=new Set(L.available);return T.add(v.choiceId),{...m,[v.poolId]:{...L,available:T}}}),{...$,[b]:{choiceId:A,value:C,poolId:k}}}),i($=>{let v=$[k];if(!v)return $;let m=new Set(v.available);return m.delete(A),{...$,[k]:{...v,available:m}}}),t.emit({type:"answer:changed",answer:{nodeId:b,type:"blank",timestamp:Date.now(),answer:{mode:"choice",choiceId:A,poolId:k,value:C}}})},[t]),u=qe(b=>{let k=a[b];if(!k)return;let{poolId:A,choiceId:C}=k;i($=>{let v=$[A];if(!v)return $;let m=new Set(v.available);return m.add(C),{...$,[A]:{...v,available:m}}}),o($=>{let{[b]:v,...m}=$;return m}),t.emit({type:"answer:changed",answer:{nodeId:b,type:"blank",timestamp:Date.now(),answer:{mode:"choice",choiceId:"",poolId:A,value:""}}})},[a,t]),g=qe((b,k)=>s[b]?.available.has(k)??!1,[s]),R=qe((b,k)=>s[b]?.choices.find(A=>A.id===k),[s]),h=qe(()=>{o({}),i(b=>{let k={};for(let[A,C]of Object.entries(b))k[A]={choices:C.choices,available:new Set(C.choices.map($=>$.id))};return k});for(let[b,k]of Object.entries(c))for(let A of k)t.emit({type:"answer:changed",answer:{nodeId:A,type:"blank",timestamp:Date.now(),answer:{mode:"choice",choiceId:"",poolId:b,value:""}}})},[c,t]);ko({onDragEnd(b){window.dispatchEvent(new CustomEvent("dnd-drop",{detail:{active:b.active,over:b.over}}))}});let P=Pn(()=>({blanks:a,pools:s,registerPool:p,registerBlank:x,fill:y,back:u,isAvailable:g,getChoice:R,firstEmptyBlank:f,resetAllAnswers:h}),[a,s,p,x,y,u,g,R,f,h]);return bo(Mn.Provider,{value:P,children:e})}import{Fragment as In,jsx as se,jsxs as Ro}from"react/jsx-runtime";import{useState as xt,useEffect as Tn,useRef as Ln,useLayoutEffect as So}from"react";import _o from"clsx";var No=typeof window<"u"?So:Tn;function vt({node:e}){if(e.type==="text"){if(!e.marks||e.marks.length===0)return se(In,{children:e.text});let r=e.text||"";for(let t of e.marks)t.type==="bold"?r=se("strong",{children:r}):t.type==="italic"?r=se("em",{children:r}):t.type==="underline"?r=se("u",{children:r}):t.type==="strike"?r=se("s",{children:r}):t.type==="textStyle"&&t.attrs?.color&&(r=se("span",{style:{color:t.attrs.color},children:r}));return se(In,{children:r})}return e.type==="paragraph"?se("span",{className:"block",children:e.content?.map((r,t)=>se(vt,{node:r},t))??se("br",{})}):e.type==="hardBreak"?se("br",{}):e.content?se("span",{className:"block",children:e.content.map((r,t)=>se(vt,{node:r},t))}):null}function Ao({nodes:e}){return se("span",{className:"block space-y-1",style:{color:"var(--ink, #1d2025)"},children:e.map((r,t)=>se(vt,{node:r},t))})}function Co({hint:e}){let r=re(),[t,n]=xt(!1),[a,o]=xt(!1),[s,i]=xt(null),c=Ln(null),d=Ln(null);return Tn(()=>{if(!a)return;let f=y=>{let u=y.target;c.current&&!c.current.contains(u)&&d.current&&!d.current.contains(u)&&(o(!1),n(!1))};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[a]),No(()=>{if(!t){i(null);return}let f=c.current,y=d.current;if(!f||!y)return;let u=f.getBoundingClientRect(),g=y.getBoundingClientRect(),R=8,h=u.top-g.height-R;h<R&&(h=u.bottom+R);let P=u.left+u.width/2-g.width/2;P=Math.max(R,Math.min(P,window.innerWidth-g.width-R)),i({top:h,left:P})},[t]),Ro("span",{ref:c,className:"relative inline-flex items-center align-middle",onMouseEnter:()=>n(!0),onMouseLeave:()=>{a||n(!1)},children:[se("button",{type:"button",onClick:f=>{f.stopPropagation(),a?(o(!1),n(!1)):(o(!0),n(!0))},className:_o("player-blank-hint-btn select-none",a&&"player-blank-hint-btn--pinned"),"aria-label":r.showHint,children:"?"}),t&&se("span",{ref:d,className:"player-blank-hint-pop",onClick:f=>f.stopPropagation(),style:{position:"fixed",top:s?s.top:0,left:s?s.left:0,bottom:"auto",transform:"none",margin:0,visibility:s?"visible":"hidden"},children:se(Ao,{nodes:e})})]})}function Me({hint:e}){return!e||e.length===0?null:se(Co,{hint:e})}function Ir({node:e,validationFeedback:r}){let{id:t,attrs:n}=e,{poolId:a,placeholder:o="___",hint:s}=n,{blanks:i,fill:c,back:d,getChoice:l,registerBlank:p}=Ee(),x=re(),f=Ke(),y=i[t],u=!!y?.choiceId,g=r?.showFeedback??!1,R=r?.state,h=r?.correctChoiceIds??[],P=g&&R==="incorrect"&&h.length>0?l(a||"",h[0]):void 0,b=P?P.html.replace(/<\/?[^>]+(>|$)/g,""):void 0,{setNodeRef:k,isOver:A}=Po({id:t,data:{type:"blank",blankId:t,poolId:a}}),{active:C}=Eo(),$=!!C&&C.data.current?.poolId===a;return zn(()=>{p(a||"",t)},[a,t,p]),zn(()=>{let L=T=>{let q=T,{active:_,over:I}=q.detail||{};if(!I||I.id!==t)return;let{choiceId:W,poolId:z}=_?.data.current||{};if(!W||z!==a)return;let O=l(a||"",W);if(!O)return;let Y=O.html.replace(/<\/?[^>]+(>|$)/g,"");c(t,a||"",W,Y)};return window.addEventListener("dnd-drop",L),()=>window.removeEventListener("dnd-drop",L)},[t,a,l,c]),wt($n,{children:[Gr("span",{ref:k,onClick:()=>{u&&!g&&d(t)},className:Qr("player-choice-blank",A&&"player-choice-blank--over",!A&&$&&!u&&!g&&"player-choice-blank--target",u&&!g&&!A&&"player-choice-blank--filled",g&&R==="correct"&&Qr("player-choice-blank--correct",f.hop),g&&R==="partial"&&Qr("player-choice-blank--partial",f.hop),g&&R==="incorrect"&&Qr("player-choice-blank--incorrect",f.wobble)),title:u&&!g?x.clickToRemove:void 0,"data-node-id":t,"data-pool-id":a,children:u?wt($n,{children:[Gr("span",{children:y.value}),Gr("span",{className:"player-choice-blank__clear",children:"\xD7"})]}):o}),b&&wt("span",{className:"player-blank-reveal",children:["(",b,")"]}),Gr(Me,{hint:s})]})}import{jsx as kt,jsxs as Lo}from"react/jsx-runtime";import{useEffect as Fn,useState as To}from"react";import $o from"clsx";import{jsx as Dn}from"react/jsx-runtime";import Mo from"clsx";import{useDraggable as Io}from"@dnd-kit/core";function tr({poolId:e,data:r,isInline:t=!1}){let{isAvailable:n,firstEmptyBlank:a,fill:o}=Ee(),{id:s,html:i}=r,c=!n(e,s),{setNodeRef:d,attributes:l,listeners:p,transform:x,isDragging:f}=Io({id:s,data:{type:"choice",choiceId:s,poolId:e,html:i},disabled:c});if(c)return null;let y=h=>h.replace(/<\/?[^>]+(>|$)/g,""),u=()=>{let h=a(e);if(h){let P=y(i);o(h,e,s,P)}},g=x?{transform:`translate3d(${x.x}px, ${x.y}px, 0)`}:void 0;return Dn(t?"span":"div",{ref:d,style:g,className:Mo("player-bank-pill",f&&"player-bank-pill--dragging",t&&"mx-1"),...l,...p,onClick:u,children:Dn("span",{dangerouslySetInnerHTML:{__html:i},className:"pointer-events-none whitespace-pre-wrap break-words"})})}function Lr({node:e}){let r=re(),{id:t,attrs:n,content:a}=e,{shuffle:o=!0,equalWidth:s=!1}=n,{registerPool:i}=Ee(),[c,d]=To(()=>a.map(l=>({id:l.id,html:te(l.content)})));return Fn(()=>{let l=a.map(p=>({id:p.id,html:te(p.content)}));d(o?[...l].map(p=>({v:p,r:Math.random()})).sort((p,x)=>p.r-x.r).map(p=>p.v):l)},[o,JSON.stringify(a)]),Fn(()=>{i(t,c)},[t,c,i]),Lo("div",{className:"player-word-bank",children:[kt("div",{className:"player-word-bank__label",children:r.wordBank}),kt("div",{className:$o("player-word-bank__items",s&&"player-word-bank__items--grid"),children:c.map(l=>kt(tr,{poolId:t,data:l},l.id))})]})}import{jsx as Rt,jsxs as zo}from"react/jsx-runtime";import{useEffect as jn,useState as Do}from"react";function Tr({node:e}){let{id:r,attrs:t,content:n}=e,{shuffle:a=!0,separator:o=" "}=t,{registerPool:s}=Ee(),[i,c]=Do(()=>n.map(d=>({id:d.id,html:te(d.content,{stripParagraphs:!0})})));return jn(()=>{let d=n.map(l=>({id:l.id,html:te(l.content,{stripParagraphs:!0})}));c(a?[...d].map(l=>({v:l,r:Math.random()})).sort((l,p)=>l.r-p.r).map(l=>l.v):d)},[a,JSON.stringify(n)]),jn(()=>{s(r,i)},[r,i,s]),Rt("span",{style:{display:"inline-flex",flexWrap:"wrap",gap:E("0.25rem"),alignItems:"center"},children:i.map((d,l)=>zo("span",{children:[Rt(tr,{poolId:r,data:d,isInline:!0}),l<i.length-1&&Rt("span",{children:o})]},d.id))})}import{jsx as nr,jsxs as At}from"react/jsx-runtime";import{useState as Ct,useEffect as Pt,useMemo as Bo}from"react";import{Check as Wo,X as qo}from"lucide-react";import{jsx as ue,jsxs as Je}from"react/jsx-runtime";import{useState as St,useMemo as _t,useRef as Nt,useCallback as Fo,useLayoutEffect as jo}from"react";var On="#1d2025",Bn="#8d93a0",Wn="#1f8a4c",qn="#d23b2b",Oo=11;function Un({leftItems:e,rightItems:r,connections:t,direction:n,disabled:a,feedback:o,onConnectionsChange:s}){let[i,c]=St(null),[d,l]=St(null),[p,x]=St(new Map),f=Nt(null),y=Nt(new Map),u=Nt("mouse"),g=o?.showFeedback??!1,R=_t(()=>{let w=new Map;if(o?.pairFeedback)for(let S of o.pairFeedback)w.set(`${S.leftId}-${S.rightId}`,S.correct);return w},[o]),h=_t(()=>{let w=new Map;return o?.correctPairings?.forEach(S=>w.set(S.leftId,S.rightId)),w},[o]),P=_t(()=>{let w=new Map;return o?.correctPairings?.forEach(S=>w.set(S.rightId,S.leftId)),w},[o]),b=new Map,k=new Map;t.forEach((w,S)=>{b.set(w.leftId,S),k.set(w.rightId,S)});let A=w=>{let S=t[w];if(!g||!S)return null;let D=R.get(`${S.leftId}-${S.rightId}`);return D===!0?"correct":D===!1?"incorrect":null},C=Fo(()=>{if(!f.current)return;let w=f.current.getBoundingClientRect(),S=new Map;y.current.forEach((D,H)=>{if(D){let V=D.getBoundingClientRect();S.set(H,new DOMRect(V.left-w.left,V.top-w.top,V.width,V.height))}}),x(S)},[]);jo(()=>{C();let w=new ResizeObserver(C);return f.current&&w.observe(f.current),()=>w.disconnect()},[C,t,e,r]);let $=8,v=(w,S)=>{let D=p.get(w);if(!D)return null;let H=D.y+D.height/2;return S==="left"?{x:D.x+D.width,y:H}:{x:D.x-$,y:H}},m=(w,S)=>{if(a)return;let H=(S==="left"?b:k).has(w),V=i?.id===w&&i?.side===S,le=i!==null&&i.side!==S;if(V){c(null);return}if(le){let Z=S==="right"?i.id:w,ae=S==="left"?i.id:w,oe=t.filter(ne=>ne.leftId!==Z&&ne.rightId!==ae);oe.push({leftId:Z,rightId:ae}),s(oe),c(null);return}if(H&&!i){let Z=S==="left"?t.filter(ae=>ae.leftId!==w):t.filter(ae=>ae.rightId!==w);s(Z);return}c({id:w,side:S})},L=(w,S,D)=>{if(a||(u.current=D.pointerType,D.pointerType==="touch"))return;D.currentTarget.setPointerCapture(D.pointerId);let H=f.current.getBoundingClientRect();l({fromId:w,fromSide:S,x:D.clientX-H.left,y:D.clientY-H.top,overId:null,overSide:null})},T=w=>{if(!d)return;let S=f.current.getBoundingClientRect(),D=w.clientX-S.left,H=w.clientY-S.top,V=d.fromSide==="left"?"right":"left",le=V==="left"?e:r,Z=null,ae=null;for(let oe of le){let ne=p.get(oe.id);if(ne&&D>=ne.x&&D<=ne.x+ne.width&&H>=ne.y&&H<=ne.y+ne.height){Z=oe.id,ae=V;break}}l(oe=>oe?{...oe,x:D,y:H,overId:Z,overSide:ae}:null)},q=w=>{if(!d)return;let S=f.current.getBoundingClientRect(),D=w.clientX-S.left,H=w.clientY-S.top,V=v(d.fromId,d.fromSide);if((V?Math.hypot(D-V.x,H-V.y):999)<8){l(null),m(d.fromId,d.fromSide);return}if(d.overId&&d.overSide){let Z=d.fromSide==="left"?d.fromId:d.overId,ae=d.fromSide==="right"?d.fromId:d.overId,oe=t.filter(ne=>ne.leftId!==Z&&ne.rightId!==ae);oe.push({leftId:Z,rightId:ae}),s(oe)}l(null),c(null)},_=(w,S)=>{if(!g)return null;let H=(S==="left"?b:k).get(w.id);if(H!==void 0){let V=t[H];if(R.get(`${V.leftId}-${V.rightId}`)===!0)return null}if(S==="left"){let V=h.get(w.id);return r.find(le=>le.id===V)?.content??null}else{let V=P.get(w.id);return e.find(le=>le.id===V)?.content??null}},I=(w,S)=>{let H=(S==="left"?b:k).get(w.id),V=H!==void 0,le=i?.id===w.id&&i?.side===S,Z=i!==null&&i.side!==S&&!V,ae=d?.overId===w.id&&d?.overSide===S,oe=V?A(H):null,ne=V?H+1:null,U="matching-player__item";V&&(U+=" matching-player__item--matched"),oe==="correct"&&(U+=" matching-player__item--correct"),oe==="incorrect"&&(U+=" matching-player__item--incorrect"),le&&(U+=" matching-player__item--selected"),(Z||ae)&&(U+=" matching-player__item--available"),a&&(U+=" matching-player__item--disabled");let mr=_(w,S);return Je("button",{ref:Ve=>{Ve?y.current.set(w.id,Ve):y.current.delete(w.id)},type:"button",className:U,onPointerDown:Ve=>L(w.id,S,Ve),onClick:()=>{u.current==="touch"&&m(w.id,S)},"aria-pressed":le,children:[S==="right"&&ue("span",{className:"matching-player__connector matching-player__connector--right","aria-hidden":!0,children:Je("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:[ue("circle",{cx:"9",cy:"9",r:"8",stroke:"currentColor",strokeWidth:"1.5",fill:"currentColor",fillOpacity:"0.08"}),ue("path",{d:"M12 9H6M8.5 6.5L6 9l2.5 2.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}),V&&S==="left"&&ue("span",{className:"matching-player__pair-num","aria-hidden":!0,children:ne}),ue("span",{className:"matching-player__item-text",dangerouslySetInnerHTML:{__html:te(w.content)}}),mr&&Je("span",{className:"matching-player__correct-hint",children:["(",ue("span",{dangerouslySetInnerHTML:{__html:te(mr)}}),")"]}),V&&S==="right"&&ue("span",{className:"matching-player__pair-num","aria-hidden":!0,children:ne}),S==="left"&&ue("span",{className:"matching-player__connector matching-player__connector--left","aria-hidden":!0,children:Je("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:[ue("circle",{cx:"9",cy:"9",r:"8",stroke:"currentColor",strokeWidth:"1.5",fill:"currentColor",fillOpacity:"0.08"}),ue("path",{d:"M6 9h6M9.5 6.5L12 9l-2.5 2.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})})]},w.id)},W=n==="ltr"?e:r,z=n==="ltr"?r:e,O=n==="ltr"?"left":"right",Y=n==="ltr"?"right":"left";return Je("div",{ref:f,className:`matching-player__arena${d?" matching-player__arena--dragging":""}`,onPointerMove:T,onPointerUp:q,children:[Je("svg",{className:"matching-player__svg","aria-hidden":!0,children:[ue("defs",{children:[["mp-arrow-ink",On],["mp-arrow-correct",Wn],["mp-arrow-incorrect",qn],["mp-arrow-ghost",Bn]].map(([w,S])=>ue("marker",{id:w,markerUnits:"userSpaceOnUse",markerWidth:"11",markerHeight:"9",refX:"0",refY:"4.5",orient:"auto",children:ue("polygon",{points:"0 0, 11 4.5, 0 9",fill:S})},w))}),t.map(w=>{let S=v(w.leftId,"left"),D=v(w.rightId,"right");if(!S||!D)return null;let H=D.x-Oo,V=Math.max(16,Math.abs(H-S.x)*.4),le=`M ${S.x} ${S.y} C ${S.x+V} ${S.y}, ${H-V} ${D.y}, ${H} ${D.y}`,Z=g?R.get(`${w.leftId}-${w.rightId}`):void 0;return ue("path",{d:le,stroke:Z===!0?Wn:Z===!1?qn:On,strokeWidth:"2.5",fill:"none",markerEnd:`url(#${Z===!0?"mp-arrow-correct":Z===!1?"mp-arrow-incorrect":"mp-arrow-ink"})`},`${w.leftId}-${w.rightId}`)}),d&&(()=>{let w=v(d.fromId,d.fromSide);if(!w)return null;let S=Math.abs(d.x-w.x)*.35,D=`M ${w.x} ${w.y} C ${w.x+S} ${w.y}, ${d.x-S} ${d.y}, ${d.x} ${d.y}`;return ue("path",{d:D,stroke:Bn,strokeWidth:"2",strokeDasharray:"6 4",fill:"none",markerEnd:"url(#mp-arrow-ghost)"})})()]}),Je("div",{className:"matching-player__columns",children:[ue("div",{className:"matching-player__column",children:W.map(w=>I(w,O))}),ue("div",{className:"matching-player__column",children:z.map(w=>I(w,Y))})]})]})}var Hn=e=>Number.isInteger(e)?String(e):e.toFixed(2);function Vn(e){return[...e].map(r=>({v:r,r:Math.random()})).sort((r,t)=>r.r-t.r).map(r=>r.v)}function $r({node:e,validationFeedback:r}){let t=de(),{shuffleSeed:n,layoutBy:a}=Ne(),{id:o,attrs:s,leftItems:i,rightItems:c}=e,{direction:d,shuffle:l,hint:p}=s,x=JSON.stringify(i),f=JSON.stringify(c),y=l&&n!==void 0,u=Bo(()=>y?{left:hr(i,`${n}:${o}:left`),right:hr(c,`${n}:${o}:right`)}:null,[y,n,o,x,f]),[g,R]=Ct(i),[h,P]=Ct(c);Pt(()=>{y||(l?(R(Vn(i)),P(Vn(c))):(R(i),P(c)))},[l,y,x,f]);let b=u?.left??g,k=u?.right??h,[A,C]=Ct([]),$=r?.showFeedback??!1;Pt(()=>{let _=I=>{let z=I.answers.find(O=>O.nodeId===o&&O.type==="matchingSet");z&&"connections"in z.answer&&C(z.answer.connections)};return t.on("answers:prefill",_),()=>t.off("answers:prefill",_)},[t,o]),Pt(()=>{t.emit({type:"answer:changed",answer:{nodeId:o,type:"matchingSet",timestamp:Date.now(),answer:{connections:A}}})},[t,o,A]);let v=_=>{$||C(_)},m=r?.score,L=r?.maxScore,T=$&&m!=null&&L!=null,q=T?m>=L?"correct":m>0?"partial":"incorrect":null;return At("div",{className:a==="box"?"matching-player matching-player--box":"matching-player",children:[p&&p.length>0&&nr("div",{className:"matching-player-hintrow",children:nr(Me,{hint:p})}),nr(Un,{leftItems:b,rightItems:k,connections:A,direction:d,disabled:$,feedback:r,onConnectionsChange:v}),T&&At("div",{className:"matching-player-feedback matching-player-feedback--"+q,children:[q==="correct"&&nr(Wo,{size:15,style:ee(15)}),q==="incorrect"&&nr(qo,{size:15,style:ee(15)}),nr("span",{children:q==="correct"?"All matched":q==="partial"?"Partial credit":"Not matched"}),At("span",{className:"matching-player-score",children:[Hn(m)," / ",Hn(L)]})]})]})}import{jsxs as ar,jsx as Ie,Fragment as Uo}from"react/jsx-runtime";import{useState as Gn,useEffect as Et,useRef as Ho,useCallback as Qn}from"react";import Yr from"clsx";function zr({node:e,validationFeedback:r}){let t=de(),n=re(),{id:a,attrs:o}=e,{placeholder:s,minWords:i=0,maxWords:c=500,hint:d}=o,[l,p]=Gn(""),[x,f]=Gn(0),y=r?.showFeedback??!1,u=r?.state,g=c<=30,R=Qn(m=>m.trim().split(/\s+/).filter(Boolean).length,[]);Et(()=>{let m=L=>{let q=L.answers?.find(_=>_.nodeId===a&&_.type==="aiAnswer");if(q&&q.answer?.text!=null){let _=q.answer.text;p(_),f(R(_))}};return t.on("answers:prefill",m),()=>t.off("answers:prefill",m)},[a,t,R]),Et(()=>{let m=()=>{p(""),f(0)};return t.on("answers:reset",m),()=>t.off("answers:reset",m)},[t]);let h=Ho(null),P=Qn((m,L)=>{h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{t.emit({type:"answer:changed",answer:{nodeId:a,type:"aiAnswer",timestamp:Date.now(),answer:{text:m,wordCount:L}}})},300)},[a,t]);Et(()=>{t.emit({type:"answer:changed",answer:{nodeId:a,type:"aiAnswer",timestamp:Date.now(),answer:{text:"",wordCount:0}}})},[]);let b=m=>{if(y)return;let L=R(m);p(m),f(L),P(m,L)},k=u==="validating",A=Yr("player-ai-count",x>c&&"player-ai-count--over"),C=!y||k?"":u==="correct"?"player-ai-input--correct":u==="incorrect"?"player-ai-input--incorrect":u==="partial"?"player-ai-input--partial":"",$=u==="correct"?"player-ai-feedback--correct":u==="incorrect"?"player-ai-feedback--incorrect":u==="partial"?"player-ai-feedback--partial":"",v=m=>Number.isInteger(m)?String(m):m.toFixed(2);return ar("div",{className:"player-ai",children:[ar("div",{className:"player-ai-counts",children:[ar("span",{className:A,children:[x," / ",c]}),i>0&&x<i&&Ie("span",{className:"player-ai-count player-ai-count--min",children:n.minWordsLabel(i)}),Ie("span",{style:{marginInlineStart:"auto"},children:Ie(Me,{hint:d})})]}),g?Ie("input",{type:"text",value:l,onChange:m=>b(m.target.value),placeholder:s??n.shortAnswerPlaceholder,disabled:y,className:Yr("player-ai-input",C)}):Ie("textarea",{value:l,onChange:m=>b(m.target.value),placeholder:s??n.longAnswerPlaceholder,disabled:y,rows:5,className:Yr("player-ai-input player-ai-input--multiline",C)}),y&&r&&Ie("div",{className:Yr("player-ai-feedback",$),children:k?ar("div",{className:"player-ai-validating",children:[Ie("span",{className:"player-ai-spinner"}),Ie("span",{children:n.aiEvaluationInProgress})]}):ar(Uo,{children:[r.message&&Ie("p",{className:"player-ai-message",children:r.message}),r.score!=null&&r.maxScore!=null&&Ie("div",{className:"player-ai-score-row",children:ar("span",{className:"player-ai-score",children:[v(r.score)," / ",v(r.maxScore)]})})]})})]})}import{Fragment as Yn,jsx as N,jsxs as K}from"react/jsx-runtime";import{useState as he,useEffect as ke,useRef as we,useCallback as Kr}from"react";import{useEditor as Vo,EditorContent as Go}from"@tiptap/react";import Qo from"@tiptap/starter-kit";import Le from"clsx";import{FolderOpen as Yo,Mic as Ko,Video as Xn,Monitor as Jo,Clock as Xo,Image as Zo,FileText as Zn,Music as es,Link2 as rs}from"lucide-react";function ea(e){return e.trim().split(/\s+/).filter(Boolean).length}function ra(e){return e.length}function ts(e){let r=t=>t.map(n=>(n.text??"")+(n.content?r(n.content):"")).join(" ");return ea(r(e))}function ns(e){let r=t=>t.map(n=>(n.text??"")+(n.content?r(n.content):"")).join("");return ra(r(e))}function Mt({node:e}){if(e.type==="text"){if(!e.marks||e.marks.length===0)return N(Yn,{children:e.text});let r=e.text||"";for(let t of e.marks)t.type==="bold"?r=N("strong",{children:r}):t.type==="italic"?r=N("em",{children:r}):t.type==="underline"?r=N("u",{children:r}):t.type==="strike"?r=N("s",{children:r}):t.type==="textStyle"&&t.attrs?.color&&(r=N("span",{style:{color:t.attrs.color},children:r}));return N(Yn,{children:r})}return e.type==="paragraph"?N("span",{className:"block",children:e.content?.map((r,t)=>N(Mt,{node:r},t))??N("br",{})}):e.type==="hardBreak"?N("br",{}):e.content?N("span",{className:"block",children:e.content.map((r,t)=>N(Mt,{node:r},t))}):null}function as({nodes:e}){return N("span",{className:"block space-y-1 text-amber-900",children:e.map((r,t)=>N(Mt,{node:r},t))})}function os({hint:e}){let r=re(),[t,n]=he(!1),[a,o]=he(!1),s=we(null);return ke(()=>{if(!a)return;let i=c=>{s.current&&!s.current.contains(c.target)&&(o(!1),n(!1))};return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[a]),K("span",{ref:s,className:"relative inline-flex items-center align-middle",onMouseEnter:()=>n(!0),onMouseLeave:()=>{a||n(!1)},children:[N("button",{type:"button",onClick:i=>{i.stopPropagation(),a?(o(!1),n(!1)):(o(!0),n(!0))},className:Le("player-blank-hint-btn select-none",a&&"player-blank-hint-btn--pinned"),"aria-label":r.showHint,children:"?"}),t&&N("span",{className:"player-blank-hint-pop",onClick:i=>i.stopPropagation(),children:N(as,{nodes:e})})]})}function Kn(e){if(!isFinite(e.duration)){e.currentTime=1e101;let r=()=>{e.currentTime=0,e.removeEventListener("timeupdate",r)};e.addEventListener("timeupdate",r)}}function ss(e){return/youtube\.com|youtu\.be/i.test(e)?"youtube":/vimeo\.com/i.test(e)?"vimeo":"other"}function is(e){let r=e.match(/[?&]v=([^&]+)/)||e.match(/youtu\.be\/([^?]+)/)||e.match(/embed\/([^?]+)/);return r?r[1]:null}function Jn(e){let r=Math.floor(e/60),t=e%60;return`${r}:${t.toString().padStart(2,"0")}`}function Dr({node:e,validationFeedback:r,readOnly:t=!1,mediaHandler:n}){let a=de(),o=re(),{id:s,attrs:i}=e,{mode:c,placeholder:d,allowFormatting:l,wordLimit:p,characterLimit:x,allowedTypes:f,allowMultiple:y,fileInstructions:u,maxDuration:g,hint:R}=i,h=t||(r?.showFeedback??!1),P=r?.state,b=we(null),k=Kr(m=>{b.current&&clearTimeout(b.current),b.current=setTimeout(()=>{let L=m.files?.map(T=>({url:T.url,mimeType:T.kind==="videoLink"?"video/x-link":T.mimeType,name:T.kind==="videoLink"?void 0:T.name,duration:T.kind==="videoLink"?void 0:T.duration}));a.emit({type:"answer:changed",answer:{nodeId:s,type:"openResponse",timestamp:Date.now(),answer:{...m,files:L}}})},300)},[s,a]);ke(()=>{k({})},[]);let[A,C]=he([]);ke(()=>{(c==="file"||c==="text+file")&&c==="file"&&k({files:A})},[A,c]),ke(()=>{let m=()=>{C([])};return a.on("answers:reset",m),()=>a.off("answers:reset",m)},[a]),ke(()=>{let m=L=>{let q=(L.answers??[]).find(_=>_.nodeId===s&&_.type==="openResponse");q?.answer?.files&&C(q.answer.files)};return a.on("answers:prefill",m),()=>a.off("answers:prefill",m)},[s,a]);let $=r?.showFeedback,v=Le(!$&&"player-or-field--pre",$&&P==="correct"&&"player-or-field--correct",$&&P==="partial"&&"player-or-field--partial",$&&P==="incorrect"&&"player-or-field--incorrect",$&&P==="awaiting_review"&&"player-or-field--review");return K("div",{className:"my-3 space-y-2",children:[!h&&R&&R.length>0&&N("div",{className:"flex justify-end",children:N(os,{hint:R})}),c==="text"&&N(ta,{nodeId:s,placeholder:d,allowFormatting:l,wordLimit:p,characterLimit:x,isDisabled:h,feedbackBorderClass:v,emitAnswer:m=>k({text:m}),answerBus:a}),c==="file"&&N(It,{allowedTypes:f??["image"],allowMultiple:!!y,fileInstructions:u,isDisabled:h,feedbackBorderClass:v,files:A,setFiles:C,mediaHandler:n,t:o}),(c==="audio"||c==="video"||c==="screen")&&N(ms,{kind:c,maxDuration:g,isDisabled:h,feedbackBorderClass:v,mediaHandler:n,emitAnswer:m=>k({recording:m}),t:o}),c==="text+file"&&N(ps,{nodeId:s,placeholder:d,allowFormatting:l,wordLimit:p,characterLimit:x,allowedTypes:f??["image"],allowMultiple:!!y,fileInstructions:u,isDisabled:h,feedbackBorderClass:v,files:A,setFiles:C,emitAnswer:k,answerBus:a,mediaHandler:n,t:o}),r?.showFeedback&&P==="awaiting_review"&&K("div",{className:"flex items-center gap-2 text-sm border rounded px-3 py-2",style:{color:"var(--almost-ink, #8a5a08)",background:"var(--almost-soft, #fbf1dc)",borderColor:"var(--almost, #c8810e)"},children:[N(Xo,{size:15,style:ee(15),className:"animate-pulse"}),N("span",{children:o.openResponseAwaitingReview})]}),r?.showFeedback&&P!=="awaiting_review"&&r.teacherFeedback&&N(us,{feedback:r.teacherFeedback,feedbackState:P,score:r.score,t:o})]})}function ta({nodeId:e,placeholder:r,allowFormatting:t,wordLimit:n,characterLimit:a,isDisabled:o,feedbackBorderClass:s,emitAnswer:i,answerBus:c}){let d=re(),[l,p]=he(""),[x,f]=he(0),[y,u]=he(0),g=we(null),R=Kr(()=>{let I=g.current;I&&(I.style.height="auto",I.style.height=`${I.scrollHeight}px`)},[]),h=Vo({extensions:[Qo.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1})],immediatelyRender:!1,editable:!o,content:"",onUpdate({editor:I}){if(o)return;let z=I.getJSON().content??[],O=ts(z),Y=ns(z);f(O),u(Y),i({content:z,wordCount:O})}});ke(()=>{h&&h.setEditable(!o)},[o,h]);let P=we(null);ke(()=>{h&&P.current!==null&&(h.commands.setContent({type:"doc",content:P.current}),P.current=null)},[h]),ke(()=>{let I=W=>{let z=(W.answers??[]).find(Y=>Y.nodeId===e&&Y.type==="openResponse");if(!z?.answer?.text)return;let O=z.answer.text.content??[];if(t)h?h.commands.setContent({type:"doc",content:O}):P.current=O;else{let Y=O.flatMap(B=>B.content?.map(w=>w.text??"")??[B.text??""]).join(`
2
- `);p(Y),setTimeout(R,0)}};return c.on("answers:prefill",I),()=>c.off("answers:prefill",I)},[e,c,t,h]),ke(()=>{let I=()=>{t&&h?h.commands.clearContent():(p(""),setTimeout(R,0)),f(0),u(0)};return c.on("answers:reset",I),()=>c.off("answers:reset",I)},[c,t,h,R]);let b=!!n,k=!!a&&!n,A=b?x:y,C=b?n?.max:a?.max,$=b?n?.min:a?.min,v=C!=null&&A>C,m=C!=null&&A>=C*.8&&!v,L=$!=null&&A<$&&A>0,T="text-xs tabular-nums",q=v?{color:"var(--pen, #d23b2b)",fontWeight:500}:m||L?{color:"var(--almost, #c8810e)"}:{color:"var(--ink-faint, #8d93a0)"},_=b?C?`${x} / ${C} ${d.openResponseWords}`:$?`${x} ${d.openResponseWords} (min. ${$})`:`${x} ${d.openResponseWords}`:k?C?`${y} / ${C} ${d.openResponseChars}`:`${y} ${d.openResponseChars}`:null;return t?K("div",{className:"relative",children:[K("div",{className:Le("rounded border transition-colors min-h-[120px]",s),children:[!o&&K("div",{className:"sticky top-0 z-10 flex gap-1 px-2 pt-1.5 pb-1 border-b border-gray-100 bg-white rounded-t",children:[[{label:"B",cmd:"toggleBold",style:"font-bold"},{label:"I",cmd:"toggleItalic",style:"italic"}].map(({label:I,cmd:W,style:z})=>N("button",{type:"button",onMouseDown:O=>{O.preventDefault(),h?.chain().focus()?.[W]().run()},className:`text-xs px-1.5 py-0.5 rounded hover:bg-gray-100 ${z}`,children:I},I)),N("button",{type:"button",onMouseDown:I=>{I.preventDefault(),h?.chain().focus().toggleBulletList().run()},className:"text-xs px-1.5 py-0.5 rounded hover:bg-gray-100",children:"\u2022\u2014"})]}),N(Go,{editor:h,className:"prose prose-sm max-w-none p-3 outline-none [&_.ProseMirror]:min-h-[80px] [&_.ProseMirror]:outline-none"})]}),_&&N("div",{className:Le("absolute bottom-2 right-3",T),style:q,children:_})]}):K("div",{className:"relative",children:[N("textarea",{ref:g,value:l,onChange:I=>{if(o)return;let W=I.target.value;p(W);let z=ea(W),O=ra(W);f(z),u(O),R(),i({content:[{type:"paragraph",content:[{type:"text",text:W}]}],wordCount:z})},onInput:R,disabled:o,placeholder:r||d.openResponseTextPlaceholder,rows:4,style:{resize:"none",overflow:"hidden"},className:Le("w-full px-3 py-2 text-base min-h-[100px] rounded border transition-colors outline-none",s,o&&"cursor-default")}),_&&N("div",{className:Le("absolute bottom-2 right-3",T),children:_})]})}var cs={image:"image/*",pdf:"application/pdf",audio:"audio/*",video:"video/*"},ls={image:N(Zo,{size:12,style:ee(12)}),pdf:N(Zn,{size:12,style:ee(12)}),audio:N(es,{size:12,style:ee(12)}),video:N(Xn,{size:12,style:ee(12)}),videoLink:N(rs,{size:12,style:ee(12)})};function It({allowedTypes:e,allowMultiple:r,fileInstructions:t,isDisabled:n,files:a,setFiles:o,mediaHandler:s,t:i,compact:c=!1}){let d=we(null),[l,p]=he(!1),[x,f]=he(!1),[y,u]=he(""),g=e.some(m=>m!=="videoLink"),R=e.includes("videoLink"),h=r||a.length===0,P=e.filter(m=>m!=="videoLink").map(m=>cs[m]).filter(Boolean).join(","),b=Kr(m=>{o(L=>r?[...L,m]:[m])},[r,o]),k=Kr(m=>{o(L=>L.filter((T,q)=>q!==m))},[o]),A=async m=>{if(!(!h||n)){p(!0);try{let L=m.type.startsWith("image/")?"image":m.type==="application/pdf"?"document":m.type.startsWith("audio/")?"audio":m.type.startsWith("video/")?"video":"file";if(s){let T=await s.upload(m,L);b({kind:"file",url:T.url,mimeType:T.mimeType??m.type,name:m.name})}else{let T=URL.createObjectURL(m);b({kind:"file",url:T,mimeType:m.type,name:m.name})}}finally{p(!1)}}},C=async m=>{if(m.preventDefault(),f(!1),n||!h)return;let L=m.dataTransfer.files?.[0];L&&await A(L)},$=()=>{let m=y.trim();m&&(b({kind:"videoLink",url:m,platform:ss(m)}),u(""))},v={image:i.openResponseTypeImage,pdf:i.openResponseTypePdf,audio:i.openResponseTypeAudio,video:i.openResponseTypeVideo,videoLink:i.openResponseTypeVideoLink};return K("div",{className:"space-y-2",children:[t&&!c&&N("p",{className:"text-sm text-gray-600 italic",children:t}),a.length>0&&N("div",{className:c?"flex flex-wrap gap-1.5":"space-y-2",children:a.map((m,L)=>N(ds,{file:m,onRemove:n?void 0:()=>k(L),compact:c,t:i},L))}),!n&&h&&K("div",{className:"space-y-2",children:[g&&!c&&K("div",{onDragOver:m=>{m.preventDefault(),f(!0)},onDragLeave:()=>f(!1),onDrop:C,className:"border-2 border-dashed rounded-lg p-6 text-center transition-colors cursor-pointer",style:{borderColor:x?"var(--ink-faint, #8d93a0)":"var(--line-strong, #d6d3cc)",background:x?"var(--ui-muted, #f5f4f1)":"transparent"},onClick:()=>d.current?.click(),children:[N(Yo,{size:26,className:"mx-auto mb-2",style:{...ee(26),color:"var(--ink-soft, #565b66)"}}),N("p",{className:"text-sm font-medium",style:{color:"var(--ink-soft, #565b66)"},children:i.openResponseDropZoneLabel}),N("p",{className:"text-xs hover:underline mt-0.5",style:{color:"var(--ink, #1d2025)"},children:i.openResponseDropZoneBrowse}),l&&N("p",{className:"text-xs mt-1 animate-pulse",style:{color:"var(--ink-faint, #8d93a0)"},children:i.openResponseUploading}),N("div",{className:"flex flex-wrap justify-center gap-1.5 mt-3",children:e.filter(m=>m!=="videoLink").map(m=>K("span",{className:"inline-flex items-center gap-1 text-[10px] px-2 py-0.5 bg-gray-100 text-gray-600 rounded-full",children:[ls[m]," ",v[m]]},m))})]}),g&&c&&N("button",{type:"button",onClick:()=>d.current?.click(),disabled:l,className:"text-xs px-3 py-1.5 rounded border border-dashed disabled:opacity-50",style:{borderColor:"var(--line-strong, #d6d3cc)",color:"var(--ink-soft, #565b66)"},children:l?i.openResponseUploading:`+ ${i.openResponseAttachFile}`}),N("input",{ref:d,type:"file",accept:P,onChange:async m=>{let L=m.target.files?.[0];L&&(await A(L),m.target.value="")},className:"hidden"}),R&&K("div",{className:"flex gap-2 flex-wrap",children:[N("input",{type:"url",value:y,onChange:m=>u(m.target.value),placeholder:i.openResponseVideoLinkPlaceholder,className:"flex-1 text-sm border rounded px-2 py-1.5 outline-none",style:{borderColor:"var(--line-strong, #d6d3cc)"},onKeyDown:m=>{m.key==="Enter"&&(m.preventDefault(),$())}}),N("button",{type:"button",onClick:$,disabled:!y.trim(),className:"text-sm px-3 py-1.5 rounded text-white disabled:opacity-50",style:{background:"var(--ink, #1d2025)"},children:i.openResponseAddVideoLink})]})]}),n&&a.length===0&&N("p",{className:"text-sm text-gray-400 text-center py-3",children:i.openResponseNoSubmission})]})}function ds({file:e,onRemove:r,compact:t,t:n}){if(e.kind==="videoLink"){let a=e.platform==="youtube"?is(e.url):null;return K("div",{className:Le("bg-white rounded border border-gray-200",t?"px-2 py-1 flex items-center gap-1.5":"p-3 space-y-1"),children:[a&&!t&&N("iframe",{src:`https://www.youtube.com/embed/${a}`,width:240,height:135,allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,className:"rounded w-full"}),N("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-blue-600 underline truncate block max-w-[200px]",children:e.url}),r&&N("button",{type:"button",onClick:r,className:"ml-auto text-gray-400 hover:text-rose-500 text-xs",children:"\u2715"})]})}return K("div",{className:Le("bg-white rounded border border-gray-200",t?"px-2 py-1 flex items-center gap-1.5":"p-2 flex items-center gap-2"),children:[e.mimeType?.startsWith("image/")?N("img",{src:e.url,alt:e.name??"upload",className:t?"h-6 w-6 object-cover rounded":"h-16 w-16 object-cover rounded"}):e.mimeType?.startsWith("audio/")?N("audio",{src:e.url,controls:!0,className:t?"hidden":"h-8 max-w-[240px]"}):e.mimeType?.startsWith("video/")?N("video",{src:e.url,controls:!0,className:t?"hidden":"h-16 max-w-[240px] rounded"}):N(Zn,{size:20,style:{...ee(20),color:"var(--ink-soft, #565b66)"}}),K("div",{className:"flex-1 min-w-0",children:[N("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-gray-700 truncate block hover:underline",children:e.name??n.openResponseFile}),t&&e.mimeType?.startsWith("audio/")&&N("audio",{src:e.url,controls:!0,className:"h-6 max-w-[160px] mt-0.5"})]}),r&&N("button",{type:"button",onClick:r,className:"ml-auto text-gray-400 hover:text-rose-500 text-xs shrink-0",children:"\u2715"})]})}function ps({nodeId:e,placeholder:r,allowFormatting:t,wordLimit:n,characterLimit:a,allowedTypes:o,allowMultiple:s,fileInstructions:i,isDisabled:c,feedbackBorderClass:d,files:l,setFiles:p,emitAnswer:x,answerBus:f,mediaHandler:y,t:u}){let[g,R]=he(null),[h,P]=he(!1);return ke(()=>{x({...g&&{text:g},files:l.length>0?l:void 0})},[g,l]),K("div",{className:"space-y-2",children:[N(ta,{nodeId:e,placeholder:r,allowFormatting:t,wordLimit:n,characterLimit:a,isDisabled:c,feedbackBorderClass:d,emitAnswer:b=>R(b),answerBus:f}),!c&&K("div",{children:[K("button",{type:"button",onClick:()=>P(!h),className:"flex items-center gap-1.5 text-xs",style:{color:"var(--ink-soft, #565b66)"},children:[N("span",{children:h?"\u25BE":"\u25B8"}),K("span",{children:[u.openResponseAttachFiles,l.length>0&&N("span",{className:"ml-1 rounded-full px-1.5 py-0.5 text-[10px]",style:{background:"var(--ui-muted, #f5f4f1)",color:"var(--ink, #1d2025)"},children:l.length})]})]}),h&&N("div",{className:"mt-1.5",children:N(It,{allowedTypes:o,allowMultiple:s,fileInstructions:i,isDisabled:c,feedbackBorderClass:d,files:l,setFiles:p,mediaHandler:y,t:u,compact:!0})})]}),c&&l.length>0&&K("div",{className:"space-y-1",children:[N("p",{className:"text-xs text-gray-500 font-medium",children:u.openResponseAttachedFiles}),N(It,{allowedTypes:o,allowMultiple:s,isDisabled:!0,feedbackBorderClass:d,files:l,setFiles:p,t:u,compact:!0})]})]})}function ms({kind:e,maxDuration:r,isDisabled:t,feedbackBorderClass:n,mediaHandler:a,emitAnswer:o,t:s}){let[i,c]=he("idle"),[d,l]=he(0),[p,x]=he(null),[f,y]=he("audio/webm"),[u,g]=he(null),R=we(null),h=we(null),P=we([]),b=we(null),k=we(null),A=we(null),C=we(0);ke(()=>()=>{$(),b.current&&clearInterval(b.current),cancelAnimationFrame(C.current)},[]),ke(()=>{i==="recording"&&e==="audio"&&h.current&&q(h.current)},[i]);let $=()=>{h.current?.getTracks().forEach(_=>_.stop()),h.current=null},v=async()=>{if(!a){g(s.openResponseMediaHandlerRequired);return}g(null),c("requesting");try{let _;if(e==="screen"){let z=await navigator.mediaDevices.getDisplayMedia({video:{cursor:"always"},audio:!1});try{let Y=(await navigator.mediaDevices.getUserMedia({audio:!0})).getAudioTracks()[0];Y&&z.addTrack(Y)}catch{}z.getVideoTracks()[0]?.addEventListener("ended",()=>{R.current?.state==="recording"&&m()}),_=z,k.current&&(k.current.srcObject=_,k.current.play())}else e==="video"?(_=await navigator.mediaDevices.getUserMedia({audio:!0,video:{facingMode:"environment"}}),k.current&&(k.current.srcObject=_,k.current.play())):_=await navigator.mediaDevices.getUserMedia({audio:!0});h.current=_;let I=e==="audio"?"audio/webm":"video/webm";y(I);let W=new MediaRecorder(_,{mimeType:I});R.current=W,P.current=[],W.ondataavailable=z=>{z.data.size>0&&P.current.push(z.data)},W.onstop=()=>{let z=new Blob(P.current,{type:I}),O=URL.createObjectURL(z);x(O),c("reviewing"),$(),cancelAnimationFrame(C.current)},W.start(200),c("recording"),l(0),b.current=setInterval(()=>{l(z=>{let O=z+1;return r&&O>=r&&m(),O})},1e3)}catch{c("idle"),g(s.openResponsePermissionDenied)}},m=()=>{b.current&&(clearInterval(b.current),b.current=null),R.current?.stop()},L=async()=>{if(!p||!a)return;c("submitted");let I=await(await fetch(p)).blob(),W=e==="screen"?"video":e,z=new File([I],"recording.webm",{type:f}),O=await a.upload(z,W);URL.revokeObjectURL(p),o({url:O.url,mimeType:O.mimeType??f,duration:d,kind:W})},T=()=>{p&&URL.revokeObjectURL(p),x(null),l(0),c("idle")},q=_=>{let I=new AudioContext,W=I.createMediaStreamSource(_),z=I.createAnalyser();z.fftSize=64,W.connect(z);let O=new Uint8Array(z.frequencyBinCount),Y=A.current;if(!Y)return;let B=()=>{z.getByteFrequencyData(O);let w=Y.getContext("2d");if(!w)return;w.clearRect(0,0,Y.width,Y.height);let S=Y.width/O.length*2.5,D=0;for(let H=0;H<O.length;H++){let V=O[H]/255*Y.height;w.fillStyle="#1d2025",w.fillRect(D,Y.height-V,S,V),D+=S+1}C.current=requestAnimationFrame(B)};B()};return t?N("div",{className:Le("rounded border p-4 text-center text-sm text-gray-400",n),children:s.openResponseRecordingSubmitted}):K("div",{className:Le("rounded border p-4 space-y-3",n),children:[u&&N("p",{className:"text-sm",style:{color:"var(--pen, #d23b2b)"},children:u}),(e==="video"||e==="screen")&&i==="recording"&&N("video",{ref:k,muted:!0,className:"w-full rounded max-h-48 bg-black",playsInline:!0}),e==="audio"&&i==="recording"&&N("canvas",{ref:A,width:300,height:48,className:"w-full rounded bg-gray-900"}),i==="reviewing"&&p&&(e==="audio"?N("audio",{src:p,controls:!0,className:"w-full",onLoadedMetadata:_=>Kn(_.currentTarget)}):N("video",{src:p,controls:!0,className:"w-full rounded max-h-48",onLoadedMetadata:_=>Kn(_.currentTarget)})),K("div",{className:"flex items-center justify-center gap-3",children:[i==="idle"&&K("button",{type:"button",onClick:v,className:"flex flex-col items-center gap-1 px-6 py-3 rounded-full font-medium text-white transition-colors",style:{background:"var(--ink, #1d2025)"},children:[e==="audio"?N(Ko,{size:22,style:ee(22)}):e==="screen"?N(Jo,{size:22,style:ee(22)}):N(Xn,{size:22,style:ee(22)}),N("span",{className:"text-sm",children:e==="screen"?s.openResponseTapToRecordScreen:s.openResponseTapToRecord})]}),i==="requesting"&&N("p",{className:"text-sm text-gray-500 animate-pulse",children:s.openResponseRequestingPermission}),i==="recording"&&K("div",{className:"flex flex-col items-center gap-2",children:[K("div",{className:"flex items-center gap-2 font-mono text-lg",style:{color:"var(--pen, #d23b2b)"},children:[N("span",{className:"animate-pulse",children:"\u25CF"}),N("span",{children:Jn(d)}),r&&K("span",{className:"text-sm",style:{color:"var(--ink-faint, #8d93a0)"},children:["/ ",Jn(r)]})]}),N("button",{type:"button",onClick:m,className:"px-5 py-2 rounded-full text-white text-sm font-medium",style:{background:"var(--pen, #d23b2b)"},children:s.openResponseStopRecording})]}),i==="reviewing"&&K("div",{className:"flex gap-2",children:[N("button",{type:"button",onClick:T,className:"px-4 py-1.5 rounded border text-sm",style:{borderColor:"var(--line-strong, #d6d3cc)",color:"var(--ink, #1d2025)"},children:s.openResponseReRecord}),N("button",{type:"button",onClick:L,className:"px-4 py-1.5 rounded text-white text-sm",style:{background:"var(--ink, #1d2025)"},children:s.openResponseConfirmRecording})]}),i==="submitted"&&K("p",{className:"text-sm",style:{color:"var(--ok, #1f8a4c)"},children:["\u2713 ",s.openResponseRecordingSubmitted]})]})]})}function us({feedback:e,feedbackState:r,score:t,t:n}){let a=r==="correct"?{bg:"var(--ok-soft, #ecf8f0)",border:"var(--ok, #1f8a4c)",ink:"var(--ok, #1f8a4c)"}:r==="incorrect"?{bg:"var(--pen-soft, #fdeeec)",border:"var(--pen, #d23b2b)",ink:"var(--pen, #d23b2b)"}:{bg:"var(--almost-soft, #fbf1dc)",border:"var(--almost, #c8810e)",ink:"var(--almost-ink, #8a5a08)"};return K("div",{className:"rounded p-3 text-sm border",style:{background:a.bg,borderColor:a.border,color:"var(--ink, #1d2025)"},children:[N("p",{className:"text-xs font-medium mb-1 opacity-70",children:n.openResponseTeacherFeedbackLabel}),e.flatMap(o=>o.content?.map(s=>s.text??"")??[o.text??""]).join(" "),t!=null&&K("div",{className:"mt-1 text-right",style:{fontFamily:'var(--font-hand, "Caveat", cursive)',fontSize:E("1.4rem"),lineHeight:1,color:a.ink},children:[t," pts"]})]})}import{jsx as Ue,jsxs as or,Fragment as na}from"react/jsx-runtime";import{useEffect as Lt,useRef as fs,useState as aa}from"react";function hs(e){return e?.showFeedback?e.state==="validating"?"validating":e.state==="correct"?"correct":e.state==="incorrect"?"incorrect":"idle":"idle"}function Fr({nodeId:e,placeholder:r,hint:t,validationFeedback:n,readOnly:a=!1}){let o=de(),s=fs(null),[i,c]=aa(""),[d,l]=aa(!1),p=hs(n),x=n?.score,f=n?.maxScore,y=R=>Number.isInteger(R)?String(R):R.toFixed(2);Lt(()=>{import("mathlive").then(()=>{l(!0)}).catch(()=>{})},[]),Lt(()=>{let R=h=>{let P=h.answers?.find(b=>b.nodeId===e&&b.type==="mathResponse");P?.answer?.latex!==void 0&&(c(P.answer.latex),s.current&&(s.current.value=P.answer.latex))};return o.on("answers:prefill",R),()=>o.off("answers:prefill",R)},[o,e]),Lt(()=>{o.emit({type:"answer:changed",answer:{nodeId:e,type:"mathResponse",timestamp:Date.now(),answer:{latex:i}}})},[i,e,o]);let u=R=>{let h=R.target?.value??"";c(h)},g=p==="correct"?"player-math-field--correct":p==="incorrect"?"player-math-field--incorrect":p==="validating"?"player-math-field--validating":"";return or("div",{dir:"ltr",className:"math-response-player",children:[or("span",{style:{display:"inline-flex",alignItems:"center",gap:E("0.4rem")},children:[Ue("div",{className:"player-math-field"+(g?" "+g:"")+(a?" player-math-field--readonly":""),children:d?Ue("math-field",{ref:s,value:i,onInput:u,"virtual-keyboard-mode":"onfocus","smart-fence":"true",className:"player-math-field__input",style:{opacity:a?.7:1,pointerEvents:a?"none":"auto"}}):Ue("input",{type:"text",value:i,onChange:R=>c(R.target.value),placeholder:r||"Enter LaTeX (e.g. \\frac{x^2}{2})",readOnly:a,className:"player-math-field__fallback"})}),Ue(Me,{hint:t})]}),n?.showFeedback&&or("div",{className:"player-math-feedback player-math-feedback--"+p,children:[p==="validating"&&or(na,{children:[Ue("span",{className:"player-math-spinner"}),Ue("span",{children:"Checking your answer\u2026"})]}),p==="correct"&&or(na,{children:[Ue("span",{children:"\u2713 Correct"}),x!=null&&or("span",{className:"player-math-score",children:[y(x),f!=null?` / ${y(f)}`:""]})]}),p==="incorrect"&&Ue("span",{children:"\u2717 Incorrect"})]})]})}import{jsx as X,jsxs as pe,Fragment as yr}from"react/jsx-runtime";import{useCallback as Is,useEffect as Ls,useRef as Ts,useState as br}from"react";import{Play as $s,Lock as zs,Check as $t,X as ia}from"lucide-react";function Zr(e,r){if(e===r)return!0;if(e===null||r===null||typeof e!=typeof r||typeof e!="object")return!1;let t=Array.isArray(e),n=Array.isArray(r);if(t!==n)return!1;if(t&&n){let c=e,d=r;return c.length!==d.length?!1:c.every((l,p)=>Zr(l,d[p]))}let a=e,o=r,s=Object.keys(a),i=Object.keys(o);return s.length!==i.length?!1:s.every(c=>Zr(a[c],o[c]))}var gs=`
1
+ import"./chunk-76CZ6Z7T.mjs";import Hi,{useMemo as Vi}from"react";import{jsx as lr}from"react/jsx-runtime";import{useEffect as st,useMemo as _i,useRef as Ni}from"react";import fa from"mitt";var Be=class{constructor(){this.emitter=fa(),this.answers=new Map}emit(r){if(r.type==="answer:changed")this.answers.set(r.answer.nodeId,r.answer);else if(r.type==="answers:reset")this.answers.clear();else if(r.type==="answers:prefill")for(let t of r.answers)this.answers.set(t.nodeId,t);this.emitter.emit(r.type,r)}on(r,t){this.emitter.on(r,t)}off(r,t){this.emitter.off(r,t)}getAllAnswers(){return Array.from(this.answers.values())}clearAnswers(){this.answers.clear(),this.emit({type:"answers:reset"})}prefillAnswers(r){this.emit({type:"answers:prefill",answers:r})}submitAnswers(){this.emit({type:"answer:submitted",answers:this.getAllAnswers(),timestamp:Date.now()})}},Sn="__edpireGlobalAnswerBus",_n=globalThis,Mr=_n[Sn]??(_n[Sn]=new Be);import{jsx as ha}from"react/jsx-runtime";import{createContext as ga,useContext as ba}from"react";var Nn="__edpireAnswerBusContext",An=globalThis,Cn=An[Nn]??(An[Nn]=ga(Mr));function le(){return ba(Cn)}function Ir({children:e,bus:r=new Be}){return ha(Cn.Provider,{value:r,children:e})}import{Fragment as zn,jsx as G,jsxs as He}from"react/jsx-runtime";import{Fragment as $a,useState as Gr,useEffect as Qr,useMemo as za,useRef as Da}from"react";import Le from"clsx";import{jsx as B,jsxs as va}from"react/jsx-runtime";import xa from"katex";import"katex/dist/contrib/mhchem.js";var ya={"\\d":"\\mathrm{d}","\\R":"\\mathbb{R}","\\N":"\\mathbb{N}","\\Z":"\\mathbb{Z}","\\Q":"\\mathbb{Q}","\\C":"\\mathbb{C}"};function hr(e,r,t=!0){try{return xa.renderToString(e,{displayMode:r,output:t?"htmlAndMathml":"html",throwOnError:!1,errorColor:"#cc0000",macros:ya,strict:!1})}catch(n){return`<span class="katex-error" style="color:#cc0000" title="${String(n)}">${e}</span>`}}function I(e){return`calc(${typeof e=="number"?`${e}px`:e} * var(--edp-scale, 1))`}function ee(e){return{width:I(e),height:I(e)}}function Ee(e){if(e==null||e==="")return;if(typeof e=="number")return I(e);let r=String(e).trim();return/^\d+(\.\d+)?px$/.test(r)?I(r):r}var En={1:{fontSize:"1.75em",fontWeight:700,lineHeight:1.2,margin:"0.6em 0 0.4em"},2:{fontSize:"1.4em",fontWeight:700,lineHeight:1.25,margin:"0.6em 0 0.35em"},3:{fontSize:"1.15em",fontWeight:600,lineHeight:1.3,margin:"0.5em 0 0.3em"}},Pn={border:"#2563eb",background:"#e0f2fe"},Mn={border:"#dc2626",background:"#fee2e2"};function wa(e){return{display:"inline-block",verticalAlign:"middle",border:`2px solid ${e?.border||Pn.border}`,background:e?.background||Pn.background,borderRadius:I("4px"),padding:"0.17em 0.37em"}}var Tr=`${I("6px")} ${I("8px")}`;function ka(e){let r=e?.shape==="circle"?"50%":"9999px";return{display:"inline-block",verticalAlign:"middle",border:`2px solid ${e?.border||Mn.border}`,background:e?.background||Mn.background,borderRadius:r,padding:"0.15em 0.45em"}}function we(e,r,t){return B("div",{className:"exercise-content",children:e.content.map((n,o)=>be(n,`node-${o}`,r,t))})}var Ra=/^[\u00a0\u202f ]?[.,;:!?\u2026)\]}\u00bb\u201d\u2019%\u060c\u061b\u061f]+/,Sa=new Set(["blank","inlineChoiceSet"]);function In(e,r,t,n){let o=[],a=e??[];for(let s=0;s<a.length;s++){let i=a[s],c=a[s+1],l=Sa.has(i.type)&&c?.type==="text"?Ra.exec(c.text??"")?.[0]:void 0;if(!l||!c){o.push(be(i,`${r}-${s}`,t,n));continue}let d=(c.text??"").slice(l.length);o.push(va("span",{style:{whiteSpace:"nowrap"},children:[B("span",{style:{whiteSpace:"normal"},children:be(i,`${r}-${s}-a`,t,n)}),be({...c,text:l},`${r}-${s}-p`,t,n)]},`${r}-${s}`)),d&&o.push(be({...c,text:d},`${r}-${s+1}`,t,n)),s++}return o}function be(e,r,t,n){switch(e.type){case"choiceSet":case"inlineChoiceSet":return B($r,{node:e,validationFeedback:t?.get(e.id)},r);case"blank":return e.attrs.mode==="typed"?B(zr,{node:e,validationFeedback:t?.get(e.id)},r):B(Dr,{node:e,validationFeedback:t?.get(e.id)},r);case"blankPool":return B(Fr,{node:e},r);case"inlinePool":return B(Or,{node:e},r);case"matchingSet":return B(jr,{node:e,validationFeedback:t?.get(e.id)},r);case"aiAnswerInput":return B(Br,{node:e,validationFeedback:t?.get(e.id)},r);case"openResponseNode":return B(qr,{node:e,validationFeedback:t?.get(e.id),readOnly:n?.readOnly,mediaHandler:n?.mediaHandler},r);case"mathResponse":return B(Wr,{nodeId:e.id,placeholder:e.attrs?.placeholder,hint:e.attrs?.hint,validationFeedback:t?.get(e.id),readOnly:n?.readOnly},r);case"codingResponse":return B(Ur,{node:e,validationFeedback:t?.get(e.id),readOnly:n?.readOnly,executor:n?.codeExecutor},r);case"aiEvaluationConfig":return null;case"paragraph":{let o=e.attrs,a=o?.textAlign,s=o?.dir||void 0;return B("p",{dir:s,style:a?{textAlign:a}:void 0,children:In(e.content,r,t,n)},r)}case"heading":{let o=e.attrs.level??1,a=`h${o}`,s=e.attrs,i=s?.textAlign,c=s?.dir||void 0,l=En[o]??En[3];return B(a,{dir:c,style:{...l,...i?{textAlign:i}:{}},children:In(e.content,r,t,n)},r)}case"blockquote":{let o=e.attrs,a=o?.dir||void 0,s=o?.textAlign;return B("blockquote",{dir:a,style:{borderInlineStart:"3px solid #d6d3cc",paddingInlineStart:"1em",margin:"0.75em 0",color:"#565b66",fontStyle:"italic",...s?{textAlign:s}:{}},children:e.content?.map((i,c)=>be(i,`${r}-${c}`,t,n))},r)}case"text":{let o=e,a=o.text??"",s=o.marks??[];if(s.length===0)return B("span",{children:a},r);let i={};for(let l of s)l.type==="textStyle"&&(l.attrs?.color&&(i.color=l.attrs.color),l.attrs?.fontSize&&(i.fontSize=l.attrs.fontSize),l.attrs?.fontFamily&&(i.fontFamily=l.attrs.fontFamily));let c=a;for(let l of s)switch(l.type){case"bold":c=B("strong",{children:c});break;case"italic":c=B("em",{children:c});break;case"underline":c=B("u",{children:c});break;case"strike":c=B("s",{children:c});break;case"code":c=B("code",{children:c});break;case"subscript":c=B("sub",{children:c});break;case"superscript":c=B("sup",{children:c});break;case"boxedText":c=B("span",{style:wa(l.attrs),children:c});break;case"circleText":c=B("span",{style:ka(l.attrs),children:c});break}return B("span",{style:Object.keys(i).length>0?i:void 0,children:c},r)}case"hardBreak":return B("br",{},r);case"resizableImage":return B("img",{src:e.attrs?.src||void 0,alt:e.attrs?.alt||"",style:{display:"inline-block",verticalAlign:"middle",width:Ee(e.attrs?.width||void 0)??"auto",height:Ee(e.attrs?.height||void 0)??"auto",maxWidth:"100%"}},r);case"resizableAudio":return B("span",{style:{display:"inline-flex",verticalAlign:"middle",alignItems:"center",background:"#f1f5f9",borderRadius:I("8px"),padding:`${I("4px")} ${I("8px")}`,maxWidth:"100%"},children:B("audio",{controls:!0,src:e.attrs?.src||void 0,style:{display:"block",width:I("320px"),maxWidth:"100%"}})},r);case"resizableVideo":return B("video",{src:e.attrs?.src||void 0,controls:!0,style:{display:"inline-block",verticalAlign:"middle",width:Ee(e.attrs?.width||void 0)??"auto",height:Ee(e.attrs?.height||void 0)??"auto",maxWidth:"100%"}},r);case"youtubeEmbed":return B("iframe",{src:`https://www.youtube.com/embed/${e.attrs?.videoId||""}`,width:e.attrs?.width||480,height:e.attrs?.height||270,allowFullScreen:!0,frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",style:{display:"inline-block",verticalAlign:"middle",border:0,width:Ee(e.attrs?.width||480),height:Ee(e.attrs?.height||270)}},r);case"inlineMath":return B("span",{dir:"ltr",style:{unicodeBidi:"isolate",display:"inline-block"},className:"math-inline",dangerouslySetInnerHTML:{__html:hr(e.attrs?.latex??"",!1,!0)}},r);case"blockMath":return B("div",{dir:"ltr",style:{unicodeBidi:"isolate",textAlign:"center",margin:"1em 0"},className:"math-block",dangerouslySetInnerHTML:{__html:hr(e.attrs?.latex??"",!0,!0)}},r);case"variable":return B("span",{className:"variable",children:`{${e.attrs?.name}}`},r);default:{let o=e;return o.type==="bulletList"?B("ul",{style:{listStyleType:"disc",paddingLeft:"1.5em",margin:"0.5em 0"},children:o.content?.map((a,s)=>be(a,`${r}-${s}`,t,n))},r):o.type==="orderedList"?B("ol",{style:{listStyleType:"decimal",paddingLeft:"1.5em",margin:"0.5em 0"},children:o.content?.map((a,s)=>be(a,`${r}-${s}`,t,n))},r):o.type==="listItem"?B("li",{children:o.content?.map((a,s)=>be(a,`${r}-${s}`,t,n))},r):o.type==="table"?B("div",{style:{overflowX:"auto",margin:`${I("1.25rem")} 0`},children:B("table",{style:{borderCollapse:"collapse",width:"100%",tableLayout:"fixed"},children:B("tbody",{children:o.content?.map((a,s)=>be(a,`${r}-${s}`,t,n))})})},r):o.type==="tableRow"?B("tr",{children:o.content?.map((a,s)=>be(a,`${r}-${s}`,t,n))},r):o.type==="tableCell"?B("td",{colSpan:o.attrs?.colspan,rowSpan:o.attrs?.rowspan,style:{border:"1px solid #d1d5db",padding:Tr,verticalAlign:"top"},children:o.content?.map((a,s)=>be(a,`${r}-${s}`,t,n))},r):o.type==="tableHeader"?B("th",{colSpan:o.attrs?.colspan,rowSpan:o.attrs?.rowspan,style:{border:"1px solid #d1d5db",padding:Tr,verticalAlign:"top",background:"#f3f4f6",fontWeight:600},children:o.content?.map((a,s)=>be(a,`${r}-${s}`,t,n))},r):(console.warn(`Unknown node type during interpretation: ${e.type}`),null)}}}function te(e,r){return e.map(t=>{if(t.type==="text"){let n=Xe(t.text??""),o=t.marks??[],a=[];for(let s of o)s.type==="textStyle"&&(s.attrs?.color&&a.push(`color:${s.attrs.color}`),s.attrs?.fontSize&&a.push(`font-size:${s.attrs.fontSize}`),s.attrs?.fontFamily&&a.push(`font-family:${s.attrs.fontFamily}`));a.length>0&&(n=`<span style="${a.join(";")}">${n}</span>`);for(let s of o)switch(s.type){case"bold":n=`<strong>${n}</strong>`;break;case"italic":n=`<em>${n}</em>`;break;case"underline":n=`<u>${n}</u>`;break;case"strike":n=`<s>${n}</s>`;break;case"code":n=`<code>${n}</code>`;break;case"subscript":n=`<sub>${n}</sub>`;break;case"superscript":n=`<sup>${n}</sup>`;break;case"boxedText":{let i=s.attrs?.border||"#2563eb",c=s.attrs?.background||"#e0f2fe";n=`<span style="display:inline-block;vertical-align:middle;border:2px solid ${i};background:${c};border-radius:${I("4px")};padding:0.17em 0.37em">${n}</span>`;break}case"circleText":{let i=s.attrs?.border||"#dc2626",c=s.attrs?.background||"#fee2e2",l=s.attrs?.shape==="circle"?"50%":"9999px";n=`<span style="display:inline-block;vertical-align:middle;border:2px solid ${i};background:${c};border-radius:${l};padding:0.15em 0.45em">${n}</span>`;break}}return n}if(t.type==="paragraph"){let n=t.content?te(t.content,r):"",o=t.attrs?.dir,a=t.attrs?.textAlign,s=o?` dir="${o}"`:"",i=a?` style="text-align:${a}"`:"";return r?.stripParagraphs?n:`<p${s}${i}>${n}</p>`}if(t.type==="hardBreak")return"<br/>";if(t.type==="table"){let n=t.content?te(t.content,r):"";return`<div style="overflow-x:auto;margin:${I("1.25rem")} 0"><table style="border-collapse:collapse;width:100%;table-layout:fixed"><tbody>${n}</tbody></table></div>`}if(t.type==="tableRow")return`<tr>${t.content?te(t.content,r):""}</tr>`;if(t.type==="tableCell"){let n=t.content?te(t.content,r):"",o=t.attrs?.colspan?` colspan="${t.attrs.colspan}"`:"",a=t.attrs?.rowspan?` rowspan="${t.attrs.rowspan}"`:"";return`<td${o}${a} style="border:1px solid #d1d5db;padding:${Tr};vertical-align:top">${n}</td>`}if(t.type==="tableHeader"){let n=t.content?te(t.content,r):"",o=t.attrs?.colspan?` colspan="${t.attrs.colspan}"`:"",a=t.attrs?.rowspan?` rowspan="${t.attrs.rowspan}"`:"";return`<th${o}${a} style="border:1px solid #d1d5db;padding:${Tr};vertical-align:top;background:#f3f4f6;font-weight:600">${n}</th>`}if(t.type==="bulletList")return`<ul style="list-style-type:disc;padding-left:1.5em">${t.content?te(t.content,r):""}</ul>`;if(t.type==="orderedList")return`<ol style="list-style-type:decimal;padding-left:1.5em">${t.content?te(t.content,r):""}</ol>`;if(t.type==="listItem")return`<li>${t.content?te(t.content,r):""}</li>`;if(t.type==="blockquote"){let n=t.content?te(t.content,r):"";return`<blockquote${t.attrs?.dir?` dir="${t.attrs.dir}"`:""} style="border-inline-start:3px solid #d6d3cc;padding-inline-start:1em;margin:0.75em 0;color:#565b66;font-style:italic">${n}</blockquote>`}if(t.type==="resizableImage"){let n=t.attrs??{},o=Lr(n.width),a=Lr(n.height);return`<img src="${Xe(n.src??"")}" alt="${Xe(n.alt??"")}" style="display:inline-block;vertical-align:middle;max-width:100%;${o?`width:${o};`:""}${a?`height:${a};`:""}"/>`}if(t.type==="resizableAudio"){let n=t.attrs??{};return`<span style="display:inline-flex;vertical-align:middle;align-items:center;background:#f1f5f9;border-radius:${I("8px")};padding:${I("4px")} ${I("8px")};max-width:100%"><audio controls src="${Xe(n.src??"")}" style="display:block;width:${I("320px")};max-width:100%"></audio></span>`}if(t.type==="resizableVideo"){let n=t.attrs??{},o=Lr(n.width),a=Lr(n.height);return`<video src="${Xe(n.src??"")}" controls style="display:inline-block;vertical-align:middle;max-width:100%;${o?`width:${o};`:""}${a?`height:${a};`:""}"></video>`}if(t.type==="youtubeEmbed"){let n=t.attrs??{};return`<iframe src="https://www.youtube.com/embed/${Xe(n.videoId??"")}" width="${n.width||480}" height="${n.height||270}" allowfullscreen frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" style="display:inline-block;vertical-align:middle;border:0;width:${Ee(n.width||480)};height:${Ee(n.height||270)}"></iframe>`}return t.type==="inlineMath"?`<span dir="ltr" class="math-inline" style="unicode-bidi:isolate;display:inline-block">${hr(t.attrs?.latex??"",!1,!0)}</span>`:t.type==="blockMath"?`<div dir="ltr" class="math-block" style="unicode-bidi:isolate;text-align:center;margin:1em 0">${hr(t.attrs?.latex??"",!0,!0)}</div>`:t.type==="variable"?`<span class="variable">{${Xe(t.attrs?.name??"")}}</span>`:""}).join("")}function Lr(e){return e==null||e===""?null:Ee(e)??null}function Xe(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}import{jsx as _a}from"react/jsx-runtime";import{createContext as Na,useContext as Ln}from"react";var nr={submitButton:"Submit",showHint:"Show hint",clickToRemove:"Click to remove",blankAnswerAria:"Your answer",aiEvaluationInProgress:"AI evaluation in progress\u2026",aiEvaluationInProgressAria:"AI evaluation in progress",shortAnswerPlaceholder:"Short answer\u2026",longAnswerPlaceholder:"Write your answer here\u2026",minWordsLabel:e=>`Min: ${e}`,wordBank:"Word Bank",chooseN:e=>`(choose ${e})`,annexDefaultLabel:"Documents",annexOpen:e=>`Open ${e}`,annexClose:"Close",referenceInPanel:e=>`This exercise's text is in ${e}.`,readReference:"Read it",referenceForExercise:e=>`Exercise ${e}`,choiceLetters:"ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""),openResponseTextPlaceholder:"Write your answer here\u2026",openResponseWords:"words",openResponseChars:"chars",openResponseDropZoneLabel:"Drag & drop files here, or",openResponseDropZoneBrowse:"browse",openResponseUploading:"Uploading\u2026",openResponseNoSubmission:"No submission",openResponseFile:"File",openResponseAttachFile:"Attach a file",openResponseAttachFiles:"Attach files",openResponseAttachedFiles:"Attached files",openResponseTypeImage:"Image",openResponseTypePdf:"PDF",openResponseTypeAudio:"Audio",openResponseTypeVideo:"Video",openResponseTypeVideoLink:"Video link",openResponseVideoLinkPlaceholder:"Paste YouTube or Vimeo URL\u2026",openResponseAddVideoLink:"Add",openResponseTapToRecord:"Tap to start recording",openResponseTapToRecordScreen:"Click to start screen recording",openResponseRequestingPermission:"Requesting permission\u2026",openResponsePermissionDenied:"Microphone/camera access denied. Please allow access in your browser settings.",openResponseMediaHandlerRequired:"A media handler is required to save recordings.",openResponseStopRecording:"Stop",openResponseReRecord:"Re-record",openResponseConfirmRecording:"Use this recording",openResponseRecordingSubmitted:"Recording submitted",openResponseAwaitingReview:"Submitted, awaiting teacher review",openResponseTeacherFeedbackLabel:"Teacher feedback",openResponseGradeThisResponse:"Grade this response",openResponseGradeScoreLabel:e=>`Score (max ${e})`,openResponseGradeFeedbackLabel:"Feedback (optional)",openResponseGradeFeedbackPlaceholder:"Add feedback for the student\u2026",openResponseSubmitGrade:"Submit Grade",openResponseGradeSubmitted:(e,r)=>`Grade submitted: ${e} / ${r}`,openResponseRubricTitle:"Rubric",openResponseRubricCriterionPoints:(e,r)=>`${e} / ${r} pts`,openResponseAiSuggestionTitle:"AI Pre-grading Suggestion",openResponseAiSuggestedScore:(e,r)=>`Suggested score: ${e} / ${r}`,openResponseAiEvidence:"Evidence:",openResponseAiApplySuggestion:"Apply suggestion",openResponseStudentAnswerTitle:"Student answer"};var Hr={submitButton:"Valider",showHint:"Voir l'indice",clickToRemove:"Cliquer pour retirer",blankAnswerAria:"Votre r\xE9ponse",aiEvaluationInProgress:"\xC9valuation IA en cours\u2026",aiEvaluationInProgressAria:"\xC9valuation IA en cours",shortAnswerPlaceholder:"R\xE9ponse courte\u2026",longAnswerPlaceholder:"\xC9cris ta r\xE9ponse ici\u2026",minWordsLabel:e=>`Min. : ${e}`,wordBank:"Banque de mots",chooseN:e=>`(choisir ${e})`,annexDefaultLabel:"Documents",annexOpen:e=>`Ouvrir ${e}`,annexClose:"Fermer",referenceInPanel:e=>`Le texte de cet exercice est dans \xAB ${e} \xBB.`,readReference:"Le lire",referenceForExercise:e=>`Exercice ${e}`,choiceLetters:"ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""),openResponseTextPlaceholder:"\xC9cris ta r\xE9ponse ici\u2026",openResponseWords:"mots",openResponseChars:"car.",openResponseDropZoneLabel:"Glisse-d\xE9pose des fichiers ici, ou",openResponseDropZoneBrowse:"parcourir",openResponseUploading:"Envoi en cours\u2026",openResponseNoSubmission:"Aucun fichier d\xE9pos\xE9",openResponseFile:"Fichier",openResponseAttachFile:"Joindre un fichier",openResponseAttachFiles:"Joindre des fichiers",openResponseAttachedFiles:"Fichiers joints",openResponseTypeImage:"Image",openResponseTypePdf:"PDF",openResponseTypeAudio:"Audio",openResponseTypeVideo:"Vid\xE9o",openResponseTypeVideoLink:"Lien vid\xE9o",openResponseVideoLinkPlaceholder:"Coller un lien YouTube ou Vimeo\u2026",openResponseAddVideoLink:"Ajouter",openResponseTapToRecord:"Appuyer pour d\xE9marrer l'enregistrement",openResponseTapToRecordScreen:"Cliquer pour d\xE9marrer l'enregistrement d'\xE9cran",openResponseRequestingPermission:"Demande d'autorisation\u2026",openResponsePermissionDenied:"Acc\xE8s au micro/cam\xE9ra refus\xE9. Autorise l'acc\xE8s dans les param\xE8tres du navigateur.",openResponseMediaHandlerRequired:"Un gestionnaire de m\xE9dias est requis pour sauvegarder les enregistrements.",openResponseStopRecording:"Arr\xEAter",openResponseReRecord:"R\xE9enregistrer",openResponseConfirmRecording:"Utiliser cet enregistrement",openResponseRecordingSubmitted:"Enregistrement soumis",openResponseAwaitingReview:"Soumis, en attente de correction par l'enseignant",openResponseTeacherFeedbackLabel:"Commentaire de l'enseignant",openResponseGradeThisResponse:"Corriger cette r\xE9ponse",openResponseGradeScoreLabel:e=>`Note (max ${e})`,openResponseGradeFeedbackLabel:"Commentaire (facultatif)",openResponseGradeFeedbackPlaceholder:"Ajouter un commentaire pour l'\xE9l\xE8ve\u2026",openResponseSubmitGrade:"Valider la note",openResponseGradeSubmitted:(e,r)=>`Note envoy\xE9e : ${e} / ${r}`,openResponseRubricTitle:"Grille d'\xE9valuation",openResponseRubricCriterionPoints:(e,r)=>`${e} / ${r} pts`,openResponseAiSuggestionTitle:"Suggestion de correction par IA",openResponseAiSuggestedScore:(e,r)=>`Score sugg\xE9r\xE9 : ${e} / ${r}`,openResponseAiEvidence:"Extrait :",openResponseAiApplySuggestion:"Appliquer la suggestion",openResponseStudentAnswerTitle:"R\xE9ponse de l'\xE9l\xE8ve"};var Vr={submitButton:"\u0625\u0631\u0633\u0627\u0644",showHint:"\u0625\u0638\u0647\u0627\u0631 \u0627\u0644\u062A\u0644\u0645\u064A\u062D",clickToRemove:"\u0627\u0646\u0642\u0631 \u0644\u0644\u0625\u0632\u0627\u0644\u0629",blankAnswerAria:"\u0625\u062C\u0627\u0628\u062A\u0643",aiEvaluationInProgress:"\u062C\u0627\u0631\u064D \u0627\u0644\u062A\u0642\u064A\u064A\u0645 \u0628\u0627\u0644\u0630\u0643\u0627\u0621 \u0627\u0644\u0627\u0635\u0637\u0646\u0627\u0639\u064A\u2026",aiEvaluationInProgressAria:"\u062C\u0627\u0631\u064D \u0627\u0644\u062A\u0642\u064A\u064A\u0645 \u0628\u0627\u0644\u0630\u0643\u0627\u0621 \u0627\u0644\u0627\u0635\u0637\u0646\u0627\u0639\u064A",shortAnswerPlaceholder:"\u0625\u062C\u0627\u0628\u0629 \u0642\u0635\u064A\u0631\u0629\u2026",longAnswerPlaceholder:"\u0627\u0643\u062A\u0628 \u0625\u062C\u0627\u0628\u062A\u0643 \u0647\u0646\u0627\u2026",minWordsLabel:e=>`\u0627\u0644\u062D\u062F \u0627\u0644\u0623\u062F\u0646\u0649: ${e}`,wordBank:"\u0628\u0646\u0643 \u0627\u0644\u0643\u0644\u0645\u0627\u062A",chooseN:e=>`(\u0627\u062E\u062A\u0631 ${e})`,annexDefaultLabel:"\u0627\u0644\u0645\u0633\u062A\u0646\u062F\u0627\u062A",annexOpen:e=>`\u0641\u062A\u062D ${e}`,annexClose:"\u0625\u063A\u0644\u0627\u0642",referenceInPanel:e=>`\u0646\u0635 \u0647\u0630\u0627 \u0627\u0644\u062A\u0645\u0631\u064A\u0646 \u0641\u064A \xAB${e}\xBB.`,readReference:"\u0627\u0642\u0631\u0623\u0647",referenceForExercise:e=>`\u0627\u0644\u062A\u0645\u0631\u064A\u0646 ${e}`,choiceLetters:["\u0623","\u0628","\u062C","\u062F","\u0647\u0640","\u0648","\u0632","\u062D","\u0637","\u064A","\u0643","\u0644","\u0645","\u0646","\u0633","\u0639","\u0641","\u0635","\u0642","\u0631","\u0634","\u062A","\u062B","\u062E","\u0630","\u0636","\u0638","\u063A"],openResponseTextPlaceholder:"\u0627\u0643\u062A\u0628 \u0625\u062C\u0627\u0628\u062A\u0643 \u0647\u0646\u0627\u2026",openResponseWords:"\u0643\u0644\u0645\u0629",openResponseChars:"\u062D\u0631\u0641",openResponseDropZoneLabel:"\u0627\u0633\u062D\u0628 \u0627\u0644\u0645\u0644\u0641\u0627\u062A \u0648\u0623\u0641\u0644\u062A\u0647\u0627 \u0647\u0646\u0627\u060C \u0623\u0648",openResponseDropZoneBrowse:"\u062A\u0635\u0641\u0651\u062D",openResponseUploading:"\u062C\u0627\u0631\u064D \u0627\u0644\u0631\u0641\u0639\u2026",openResponseNoSubmission:"\u0644\u0627 \u064A\u0648\u062C\u062F \u062A\u0633\u0644\u064A\u0645",openResponseFile:"\u0645\u0644\u0641",openResponseAttachFile:"\u0625\u0631\u0641\u0627\u0642 \u0645\u0644\u0641",openResponseAttachFiles:"\u0625\u0631\u0641\u0627\u0642 \u0645\u0644\u0641\u0627\u062A",openResponseAttachedFiles:"\u0627\u0644\u0645\u0644\u0641\u0627\u062A \u0627\u0644\u0645\u0631\u0641\u0642\u0629",openResponseTypeImage:"\u0635\u0648\u0631\u0629",openResponseTypePdf:"PDF",openResponseTypeAudio:"\u0635\u0648\u062A",openResponseTypeVideo:"\u0641\u064A\u062F\u064A\u0648",openResponseTypeVideoLink:"\u0631\u0627\u0628\u0637 \u0641\u064A\u062F\u064A\u0648",openResponseVideoLinkPlaceholder:"\u0627\u0644\u0635\u0642 \u0631\u0627\u0628\u0637 \u064A\u0648\u062A\u064A\u0648\u0628 \u0623\u0648 Vimeo\u2026",openResponseAddVideoLink:"\u0625\u0636\u0627\u0641\u0629",openResponseTapToRecord:"\u0627\u0646\u0642\u0631 \u0644\u0628\u062F\u0621 \u0627\u0644\u062A\u0633\u062C\u064A\u0644",openResponseTapToRecordScreen:"\u0627\u0646\u0642\u0631 \u0644\u0628\u062F\u0621 \u062A\u0633\u062C\u064A\u0644 \u0627\u0644\u0634\u0627\u0634\u0629",openResponseRequestingPermission:"\u062C\u0627\u0631\u064D \u0637\u0644\u0628 \u0627\u0644\u0625\u0630\u0646\u2026",openResponsePermissionDenied:"\u062A\u0645 \u0631\u0641\u0636 \u0627\u0644\u0648\u0635\u0648\u0644 \u0625\u0644\u0649 \u0627\u0644\u0645\u064A\u0643\u0631\u0648\u0641\u0648\u0646/\u0627\u0644\u0643\u0627\u0645\u064A\u0631\u0627. \u064A\u064F\u0631\u062C\u0649 \u0627\u0644\u0633\u0645\u0627\u062D \u0628\u0627\u0644\u0648\u0635\u0648\u0644 \u0645\u0646 \u0625\u0639\u062F\u0627\u062F\u0627\u062A \u0627\u0644\u0645\u062A\u0635\u0641\u062D.",openResponseMediaHandlerRequired:"\u064A\u0644\u0632\u0645 \u0645\u0639\u0627\u0644\u062C \u0648\u0633\u0627\u0626\u0637 \u0644\u062D\u0641\u0638 \u0627\u0644\u062A\u0633\u062C\u064A\u0644\u0627\u062A.",openResponseStopRecording:"\u0625\u064A\u0642\u0627\u0641",openResponseReRecord:"\u0625\u0639\u0627\u062F\u0629 \u0627\u0644\u062A\u0633\u062C\u064A\u0644",openResponseConfirmRecording:"\u0627\u0633\u062A\u062E\u062F\u0627\u0645 \u0647\u0630\u0627 \u0627\u0644\u062A\u0633\u062C\u064A\u0644",openResponseRecordingSubmitted:"\u062A\u0645 \u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u062A\u0633\u062C\u064A\u0644",openResponseAwaitingReview:"\u062A\u0645 \u0627\u0644\u0625\u0631\u0633\u0627\u0644\u060C \u0641\u064A \u0627\u0646\u062A\u0638\u0627\u0631 \u0645\u0631\u0627\u062C\u0639\u0629 \u0627\u0644\u0645\u0639\u0644\u0645",openResponseTeacherFeedbackLabel:"\u0645\u0644\u0627\u062D\u0638\u0627\u062A \u0627\u0644\u0645\u0639\u0644\u0645",openResponseGradeThisResponse:"\u062A\u0635\u062D\u064A\u062D \u0647\u0630\u0647 \u0627\u0644\u0625\u062C\u0627\u0628\u0629",openResponseGradeScoreLabel:e=>`\u0627\u0644\u062F\u0631\u062C\u0629 (\u0627\u0644\u062D\u062F \u0627\u0644\u0623\u0642\u0635\u0649 ${e})`,openResponseGradeFeedbackLabel:"\u0645\u0644\u0627\u062D\u0638\u0627\u062A (\u0627\u062E\u062A\u064A\u0627\u0631\u064A)",openResponseGradeFeedbackPlaceholder:"\u0623\u0636\u0641 \u0645\u0644\u0627\u062D\u0638\u0627\u062A \u0644\u0644\u0637\u0627\u0644\u0628\u2026",openResponseSubmitGrade:"\u0627\u0639\u062A\u0645\u0627\u062F \u0627\u0644\u062F\u0631\u062C\u0629",openResponseGradeSubmitted:(e,r)=>`\u062A\u0645 \u0627\u0639\u062A\u0645\u0627\u062F \u0627\u0644\u062F\u0631\u062C\u0629: ${e} / ${r}`,openResponseRubricTitle:"\u0633\u0644\u0651\u0645 \u0627\u0644\u062A\u0635\u062D\u064A\u062D",openResponseRubricCriterionPoints:(e,r)=>`${e} / ${r} \u0646\u0642\u0637\u0629`,openResponseAiSuggestionTitle:"\u0627\u0642\u062A\u0631\u0627\u062D \u0627\u0644\u062A\u0635\u062D\u064A\u062D \u0627\u0644\u0645\u0633\u0628\u0642 \u0628\u0627\u0644\u0630\u0643\u0627\u0621 \u0627\u0644\u0627\u0635\u0637\u0646\u0627\u0639\u064A",openResponseAiSuggestedScore:(e,r)=>`\u0627\u0644\u062F\u0631\u062C\u0629 \u0627\u0644\u0645\u0642\u062A\u0631\u062D\u0629: ${e} / ${r}`,openResponseAiEvidence:"\u0627\u0644\u0623\u062F\u0644\u0629:",openResponseAiApplySuggestion:"\u062A\u0637\u0628\u064A\u0642 \u0627\u0644\u0627\u0642\u062A\u0631\u0627\u062D",openResponseStudentAnswerTitle:"\u0625\u062C\u0627\u0628\u0629 \u0627\u0644\u0637\u0627\u0644\u0628"};var Aa={en:nr,fr:Hr,ar:Vr},Rt=Na(null);function re(){return Ln(Rt)??nr}function gr(e){let r=Ln(Rt);return e&&Aa[e]||r||nr}function br({locale:e,children:r}){let t=gr(e);return _a(Rt.Provider,{value:t,children:r})}import{jsx as Ca}from"react/jsx-runtime";import{createContext as Ea,useContext as Tn,useMemo as $n}from"react";var Pa={sm:.875,md:1,lg:1.25,xl:1.5},St=Ea(null);function Ma(e,r){let t={...e??{}};if(r)for(let[n,o]of Object.entries(r))o!==void 0&&(t[n]=o);return t}function Ia(e){return typeof e=="number"?Number.isFinite(e)&&e>0?e:1:e?Pa[e]??1:1}function ke(e){let r=e??{};return{scale:Ia(r.size),sizeSet:r.size!==void 0,choiceLabels:r.choiceLabels??"marks",choiceColumns:r.choiceColumns,layoutBy:r.layoutBy??"window",motion:r.motion??"full",shuffleSeed:r.shuffleSeed}}function ye(e){let r=Tn(St);return $n(()=>Ma(r,e),[r,e?.size,e?.choiceLabels,e?.choiceColumns,e?.layoutBy,e?.motion,e?.shuffleSeed])}function Pe(){let e=Tn(St);return $n(()=>ke(e),[e])}function ve({display:e,children:r}){let t=ye(e);return Ca(St.Provider,{value:t,children:r})}function Re(e){if(e.sizeSet)return{"--edp-scale":String(e.scale)}}function Ze(){let{motion:e}=Pe();return{hop:e==="none"?"":"animate-hop",shake:e==="full"?"animate-shake":"",wobble:e==="full"?"animate-wobble":""}}function La(e){let r=2166136261;for(let t=0;t<e.length;t++)r^=e.charCodeAt(t),r=Math.imul(r,16777619);return r>>>0}function Ta(e){return()=>{e=e+1831565813|0;let r=Math.imul(e^e>>>15,1|e);return r=r+Math.imul(r^r>>>7,61|r)^r,((r^r>>>14)>>>0)/4294967296}}function xr(e,r){let t=[...e],n=Ta(La(r));for(let o=t.length-1;o>0;o--){let a=Math.floor(n()*(o+1));[t[o],t[a]]=[t[a],t[o]]}return t}function _t({node:e}){if(e.type==="text"){if(!e.marks||e.marks.length===0)return G(zn,{children:e.text});let r=e.text||"";for(let t of e.marks)t.type==="bold"?r=G("strong",{children:r}):t.type==="italic"?r=G("em",{children:r}):t.type==="underline"?r=G("u",{children:r}):t.type==="strike"?r=G("s",{children:r}):t.type==="textStyle"&&t.attrs?.color&&(r=G("span",{style:{color:t.attrs.color},children:r}));return G(zn,{children:r})}return e.type==="paragraph"?G("span",{className:"block",children:e.content?.map((r,t)=>G(_t,{node:r},t))??G("br",{})}):e.type==="hardBreak"?G("br",{}):e.content?G("span",{className:"block",children:e.content.map((r,t)=>G(_t,{node:r},t))}):null}function Fa({nodes:e}){return G("span",{className:"block space-y-1",style:{color:"var(--ink, #1d2025)"},children:e.map((r,t)=>G(_t,{node:r},t))})}function Dn({hint:e}){let r=re(),[t,n]=Gr(!1),[o,a]=Gr(!1),s=Da(null);return Qr(()=>{if(!o)return;let d=m=>{s.current&&!s.current.contains(m.target)&&(a(!1),n(!1))};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[o]),He("span",{ref:s,className:"relative inline-flex items-center align-middle",onMouseEnter:()=>n(!0),onMouseLeave:()=>{o||n(!1)},children:[G("button",{type:"button",onClick:d=>{d.stopPropagation(),o?(a(!1),n(!1)):(a(!0),n(!0))},className:Le("player-blank-hint-btn select-none",o&&"player-blank-hint-btn--pinned"),"aria-label":r.showHint,children:"?"}),t&&G("span",{className:"player-blank-hint-pop",onClick:d=>d.stopPropagation(),children:G(Fa,{nodes:e})})]})}function Oa(e){return[...e].map(r=>({v:r,r:Math.random()})).sort((r,t)=>r.r-t.r).map(r=>r.v)}var ja=e=>e.replace(/ {2,}/g,r=>"&nbsp;".repeat(r.length-1)+" "),Ba=new Set(["image","resizableImage","resizableVideo","youtubeEmbed"]);function jn(e){return(e??[]).some(r=>Ba.has(r?.type)||jn(r?.content))}var Fn=()=>G("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:3,children:G("path",{d:"M5 13l4 4L19 7"})}),On=()=>G("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:3,children:G("path",{d:"M6 6l12 12M18 6L6 18"})});function $r({node:e,validationFeedback:r}){let t=le(),n=re(),o=Pe(),a=Ze(),{id:s,content:i,attrs:c}=e,l=c.shuffle??!1,d="prompt"in c?c.prompt:void 0,m="separator"in c?c.separator??"/":"/",y="pickLimit"in c&&c.pickLimit?c.pickLimit:1,b="layout"in c?c.layout??"row":"row",S=e.type==="inlineChoiceSet",f=JSON.stringify(i),g=l&&o.shuffleSeed!==void 0,w=za(()=>g?xr(i,`${o.shuffleSeed}:${s}`):null,[g,o.shuffleSeed,s,f]),[h,_]=Gr(i);Qr(()=>{g||_(l?Oa(i):i)},[l,g,f]);let u=w??h,[x,A]=Gr(new Set),E=r?.showFeedback??!1,$=r?.correctChoiceIds||[];Qr(()=>{let U=R=>{let D=R.answers.find(H=>H.nodeId===s&&H.type==="choiceSet");D&&"selectedIds"in D.answer&&A(new Set(D.answer.selectedIds))};return t.on("answers:prefill",U),()=>t.off("answers:prefill",U)},[s,t]),Qr(()=>{t.emit({type:"answer:changed",answer:{nodeId:s,type:"choiceSet",timestamp:Date.now(),answer:{selectedIds:Array.from(x)}}})},[x,s,t]);let k=U=>{E||A(R=>{let N=new Set(R);return y===1?N.has(U)?N.delete(U):(N.clear(),N.add(U)):N.has(U)?N.delete(U):N.size<y&&N.add(U),N})},p=U=>ja(te(U.content)),T=U=>{let R=x.has(U),N=$.includes(U);return E?N&&R?"correct":N&&!R?"correct-unchosen":!N&&R?"incorrect":"muted":R?"selected":"idle"},P={idle:"",selected:"player-choice--selected",correct:Le("player-choice--correct",a.hop),"correct-unchosen":"player-choice--correct-unchosen",incorrect:Le("player-choice--incorrect",a.shake),muted:"player-choice--muted"},q={idle:"",selected:"player-inline-choice--selected",correct:Le("player-inline-choice--correct",a.hop),"correct-unchosen":"player-inline-choice--correct-unchosen",incorrect:Le("player-inline-choice--incorrect",a.shake),muted:"player-inline-choice--muted"};if(S)return He("span",{className:"inline-choice",children:[d&&He("span",{className:"mr-2 font-medium",children:[d,y>1?G("span",{className:"ml-1 opacity-60",children:n.chooseN(y)}):null]}),u.map((U,R)=>He($a,{children:[G("button",{type:"button",disabled:E,onClick:()=>k(U.id),className:Le("player-inline-choice",q[T(U.id)]),"aria-pressed":x.has(U.id),dangerouslySetInnerHTML:{__html:p(U)}}),R<u.length-1&&G("span",{className:"mx-1",children:m})]},U.id)),c.hint&&c.hint.length>0&&G(Dn,{hint:c.hint})]});let v=o.layoutBy==="box",M=o.choiceColumns?Math.min(o.choiceColumns,u.length):0,F=M?{gridAutoRows:"1fr",gridTemplateColumns:`repeat(${M}, minmax(0, 1fr))`}:{gridAutoRows:"1fr"},z=u.some(U=>jn(U.content)),O=o.choiceLabels==="letters",V=U=>n.choiceLetters[U]??String(U+1);return He("div",{className:Le("cs-player my-4 space-y-3",v&&"cs-player--box"),children:[d&&He("p",{className:"font-medium",children:[d,y>1?He("span",{className:"ml-2 text-sm opacity-70",children:["(choose ",y,")"]}):null]}),c.hint&&c.hint.length>0&&G(Dn,{hint:c.hint}),G("div",{className:Le("cs-player__grid",b==="row"&&"cs-player__grid--row"),style:F,children:u.map((U,R)=>{let N=T(U.id),D=N==="incorrect"?"incorrect":N==="correct"||N==="correct-unchosen"?"correct":null;return He("button",{type:"button",disabled:E,onClick:()=>k(U.id),className:Le("player-choice",z&&"player-choice--tile",P[N]),"aria-pressed":x.has(U.id),children:[G("span",{className:Le("player-choice__mark",y>1?"player-choice__mark--box":"player-choice__mark--radio",O&&"player-choice__mark--letter"),children:O?V(R):N==="incorrect"?G(On,{}):G(Fn,{})}),G("span",{className:"player-choice__text",dangerouslySetInnerHTML:{__html:p(U)}}),O&&D&&G("span",{className:`player-choice__verdict player-choice__verdict--${D}`,"aria-hidden":"true",children:D==="incorrect"?G(On,{}):G(Fn,{})})]},U.id)})})]})}import{Fragment as Nt,jsx as J,jsxs as Yr}from"react/jsx-runtime";import{useState as At,useEffect as Kr,useRef as Bn,useCallback as qa}from"react";import Ve from"clsx";function Ct({node:e}){if(e.type==="text"){if(!e.marks||e.marks.length===0)return J(Nt,{children:e.text});let r=e.text||"";for(let t of e.marks)t.type==="bold"?r=J("strong",{children:r}):t.type==="italic"?r=J("em",{children:r}):t.type==="underline"?r=J("u",{children:r}):t.type==="strike"?r=J("s",{children:r}):t.type==="textStyle"&&t.attrs?.color&&(r=J("span",{style:{color:t.attrs.color},children:r}));return J(Nt,{children:r})}return e.type==="paragraph"?J("span",{className:"block",children:e.content?.map((r,t)=>J(Ct,{node:r},t))??J("br",{})}):e.type==="hardBreak"?J("br",{}):e.content?J("span",{className:"block",children:e.content.map((r,t)=>J(Ct,{node:r},t))}):null}function Wa({nodes:e}){return J("span",{className:"block space-y-1",children:e.map((r,t)=>J(Ct,{node:r},t))})}function Ua({hint:e}){let r=re(),[t,n]=At(!1),[o,a]=At(!1),s=Bn(null);return Kr(()=>{if(!o)return;let d=m=>{s.current&&!s.current.contains(m.target)&&(a(!1),n(!1))};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[o]),Yr("span",{ref:s,className:"relative inline-flex items-center align-middle",onMouseEnter:()=>n(!0),onMouseLeave:()=>{o||n(!1)},children:[J("button",{type:"button",onClick:d=>{d.stopPropagation(),o?(a(!1),n(!1)):(a(!0),n(!0))},className:Ve("player-blank-hint-btn select-none",o&&"player-blank-hint-btn--pinned"),"aria-label":r.showHint,children:"?"}),t&&J("span",{className:"player-blank-hint-pop",onClick:d=>d.stopPropagation(),children:J(Wa,{nodes:e})})]})}function zr({node:e,validationFeedback:r}){let t=le(),n=re(),o=Ze(),{id:a,attrs:s}=e,{placeholder:i="___",width:c="auto",hint:l}=s,d=Bn(null),m=i.trim().split(/\s+/).filter(Boolean).length,y=c==="auto"&&m>=4,[b,S]=At(""),f=r?.showFeedback??!1,g=r?.state,w=g==="validating",h=r?.displayAnswer,_=r?.message;Kr(()=>{let E=$=>{let p=$.answers.find(T=>T.nodeId===a&&T.type==="blank");p&&"mode"in p.answer&&p.answer.mode==="typed"&&"text"in p.answer&&S(p.answer.text)};return t.on("answers:prefill",E),()=>t.off("answers:prefill",E)},[a,t]),Kr(()=>{t.emit({type:"answer:changed",answer:{nodeId:a,type:"blank",timestamp:Date.now(),answer:{mode:"typed",text:b}}})},[b,a,t]);let u=E=>{S(E.target.value)},x=qa(()=>{let E=d.current;E&&(E.style.height="auto",E.style.height=`${E.scrollHeight}px`)},[]);Kr(()=>{x()},[b,x]);let A=f&&!w;return Yr("span",{className:Ve("inline-flex flex-wrap items-center gap-x-1 gap-y-0.5 align-middle max-w-full",y&&"w-full"),children:[J("span",{className:Ve("relative inline-block shrink-0 min-w-0 max-w-full",y&&"w-full flex-1"),children:A?J("span",{className:Ve("player-typed-blank-feedback",y&&"w-full",g==="correct"&&Ve("player-typed-blank-feedback--correct",o.hop),g==="partial"&&"player-typed-blank-feedback--partial",g==="incorrect"&&Ve("player-typed-blank-feedback--incorrect",o.wobble)),children:b||J("span",{className:"opacity-40",children:i})}):Yr(Nt,{children:[J("textarea",{ref:d,"aria-label":n.blankAnswerAria,placeholder:i,value:b,onChange:u,disabled:f,rows:1,className:Ve("player-typed-blank",y&&"w-full",w&&"player-typed-blank--pending"),style:c!=="auto"?{width:c}:y?{width:"100%"}:{width:`${Math.max(7,b.length+1)}ch`,maxWidth:"100%"}}),!b&&!w&&J("span",{className:"absolute right-1 top-1/2 -translate-y-1/2 pointer-events-none text-sm",style:{color:"var(--ink-faint, #8d93a0)"},children:"\u270E"}),w&&J("span",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:J("span",{className:"player-typed-blank-spinner","aria-label":n.aiEvaluationInProgressAria})})]})}),f&&g==="incorrect"&&h&&Yr("span",{className:"player-blank-reveal",children:["(",h,")"]}),f&&_&&J("span",{className:Ve("player-blank-feedback",g==="correct"&&"player-blank-feedback--correct",g==="partial"&&"player-blank-feedback--partial",g==="incorrect"&&"player-blank-feedback--incorrect"),children:_}),l&&l.length>0&&J(Ua,{hint:l})]})}import{jsx as Xr,Fragment as Gn,jsxs as It}from"react/jsx-runtime";import{useEffect as Yn}from"react";import Zr from"clsx";import{useDroppable as ns,useDndContext as os}from"@dnd-kit/core";import{jsx as Ha}from"react/jsx-runtime";import{createContext as Va,useCallback as Qe,useContext as Qa,useEffect as Ga,useMemo as qn,useRef as Ya,useState as Et}from"react";import{useDndMonitor as Ka}from"@dnd-kit/core";var Un=Va(null);function Te(){let e=Qa(Un);if(!e)throw new Error("usePool must be used within a PoolProvider");return e}function Wn(e){let r={};for(let t of e??[])t.type==="blank"&&"mode"in t.answer&&t.answer.mode==="choice"&&"choiceId"in t.answer&&t.answer.choiceId&&(r[t.nodeId]={choiceId:t.answer.choiceId,poolId:t.answer.poolId||"",value:t.answer.value||""});return r}function Jr({children:e,initialAnswers:r}){let t=le(),n=qn(()=>Wn(r),[r]),[o,a]=Et(n),[s,i]=Et({}),[c,l]=Et({}),d=Ya(new Set);Ga(()=>{let u=x=>{let A=Wn(x.answers);Object.keys(A).length!==0&&a(E=>{if(!Object.entries(A).some(([p,T])=>E[p]?.choiceId!==T.choiceId||E[p]?.poolId!==T.poolId||E[p]?.value!==T.value))return E;let k={...E,...A};return i(p=>{let T={...p};for(let[P,q]of Object.entries(p)){let v=new Set(Object.values(k).filter(M=>M.poolId===P).map(M=>M.choiceId));T[P]={...q,available:new Set(q.choices.map(M=>M.id).filter(M=>!v.has(M)))}}return T}),k})};return t.on("answers:prefill",u),()=>t.off("answers:prefill",u)},[t]);let m=Qe((u,x)=>{i(A=>{let E=A[u];if(!E){let P=new Set;for(let v of Object.values(o))v.poolId===u&&P.add(v.choiceId);let q=new Set(x.map(v=>v.id).filter(v=>!P.has(v)));return{...A,[u]:{choices:x,available:q}}}let $=new Set(E.choices.map(P=>P.id)),k=new Set(x.map(P=>P.id));if(!(x.some(P=>!$.has(P.id))||E.choices.some(P=>!k.has(P.id))))return A;let T=new Set;for(let P of E.available)k.has(P)&&T.add(P);for(let P of x)$.has(P.id)||T.add(P.id);return{...A,[u]:{choices:x,available:T}}})},[o]),y=Qe((u,x)=>{l(A=>{let E=A[u]??[];return E.includes(x)?A:{...A,[u]:[...E,x]}}),!d.current.has(x)&&!o[x]&&(d.current.add(x),t.emit({type:"answer:changed",answer:{nodeId:x,type:"blank",timestamp:Date.now(),answer:{mode:"choice",choiceId:"",poolId:u,value:""}}}))},[o,t]),b=Qe(u=>(c[u]??[]).find(A=>!o[A])??null,[c,o]),S=Qe((u,x,A,E)=>{a($=>{let k=$[u];return k&&i(p=>{let T=p[k.poolId];if(!T)return p;let P=new Set(T.available);return P.add(k.choiceId),{...p,[k.poolId]:{...T,available:P}}}),{...$,[u]:{choiceId:A,value:E,poolId:x}}}),i($=>{let k=$[x];if(!k)return $;let p=new Set(k.available);return p.delete(A),{...$,[x]:{...k,available:p}}}),t.emit({type:"answer:changed",answer:{nodeId:u,type:"blank",timestamp:Date.now(),answer:{mode:"choice",choiceId:A,poolId:x,value:E}}})},[t]),f=Qe(u=>{let x=o[u];if(!x)return;let{poolId:A,choiceId:E}=x;i($=>{let k=$[A];if(!k)return $;let p=new Set(k.available);return p.add(E),{...$,[A]:{...k,available:p}}}),a($=>{let{[u]:k,...p}=$;return p}),t.emit({type:"answer:changed",answer:{nodeId:u,type:"blank",timestamp:Date.now(),answer:{mode:"choice",choiceId:"",poolId:A,value:""}}})},[o,t]),g=Qe((u,x)=>s[u]?.available.has(x)??!1,[s]),w=Qe((u,x)=>s[u]?.choices.find(A=>A.id===x),[s]),h=Qe(()=>{a({}),i(u=>{let x={};for(let[A,E]of Object.entries(u))x[A]={choices:E.choices,available:new Set(E.choices.map($=>$.id))};return x});for(let[u,x]of Object.entries(c))for(let A of x)t.emit({type:"answer:changed",answer:{nodeId:A,type:"blank",timestamp:Date.now(),answer:{mode:"choice",choiceId:"",poolId:u,value:""}}})},[c,t]);Ka({onDragEnd(u){window.dispatchEvent(new CustomEvent("dnd-drop",{detail:{active:u.active,over:u.over}}))}});let _=qn(()=>({blanks:o,pools:s,registerPool:m,registerBlank:y,fill:S,back:f,isAvailable:g,getChoice:w,firstEmptyBlank:b,resetAllAnswers:h}),[o,s,m,y,S,f,g,w,b,h]);return Ha(Un.Provider,{value:_,children:e})}import{Fragment as Hn,jsx as ie,jsxs as Ja}from"react/jsx-runtime";import{useState as Pt,useEffect as Qn,useRef as Vn,useLayoutEffect as Xa}from"react";import Za from"clsx";var es=typeof window<"u"?Xa:Qn;function Mt({node:e}){if(e.type==="text"){if(!e.marks||e.marks.length===0)return ie(Hn,{children:e.text});let r=e.text||"";for(let t of e.marks)t.type==="bold"?r=ie("strong",{children:r}):t.type==="italic"?r=ie("em",{children:r}):t.type==="underline"?r=ie("u",{children:r}):t.type==="strike"?r=ie("s",{children:r}):t.type==="textStyle"&&t.attrs?.color&&(r=ie("span",{style:{color:t.attrs.color},children:r}));return ie(Hn,{children:r})}return e.type==="paragraph"?ie("span",{className:"block",children:e.content?.map((r,t)=>ie(Mt,{node:r},t))??ie("br",{})}):e.type==="hardBreak"?ie("br",{}):e.content?ie("span",{className:"block",children:e.content.map((r,t)=>ie(Mt,{node:r},t))}):null}function rs({nodes:e}){return ie("span",{className:"block space-y-1",style:{color:"var(--ink, #1d2025)"},children:e.map((r,t)=>ie(Mt,{node:r},t))})}function ts({hint:e}){let r=re(),[t,n]=Pt(!1),[o,a]=Pt(!1),[s,i]=Pt(null),c=Vn(null),l=Vn(null);return Qn(()=>{if(!o)return;let b=S=>{let f=S.target;c.current&&!c.current.contains(f)&&l.current&&!l.current.contains(f)&&(a(!1),n(!1))};return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[o]),es(()=>{if(!t){i(null);return}let b=c.current,S=l.current;if(!b||!S)return;let f=b.getBoundingClientRect(),g=S.getBoundingClientRect(),w=8,h=f.top-g.height-w;h<w&&(h=f.bottom+w);let _=f.left+f.width/2-g.width/2;_=Math.max(w,Math.min(_,window.innerWidth-g.width-w)),i({top:h,left:_})},[t]),Ja("span",{ref:c,className:"relative inline-flex items-center align-middle",onMouseEnter:()=>n(!0),onMouseLeave:()=>{o||n(!1)},children:[ie("button",{type:"button",onClick:b=>{b.stopPropagation(),o?(a(!1),n(!1)):(a(!0),n(!0))},className:Za("player-blank-hint-btn select-none",o&&"player-blank-hint-btn--pinned"),"aria-label":r.showHint,children:"?"}),t&&ie("span",{ref:l,className:"player-blank-hint-pop",onClick:b=>b.stopPropagation(),style:{position:"fixed",top:s?s.top:0,left:s?s.left:0,bottom:"auto",transform:"none",margin:0,visibility:s?"visible":"hidden"},children:ie(rs,{nodes:e})})]})}function $e({hint:e}){return!e||e.length===0?null:ie(ts,{hint:e})}function Dr({node:e,validationFeedback:r}){let{id:t,attrs:n}=e,{poolId:o,placeholder:a="___",hint:s}=n,{blanks:i,fill:c,back:l,getChoice:d,registerBlank:m}=Te(),y=re(),b=Ze(),S=i[t],f=!!S?.choiceId,g=r?.showFeedback??!1,w=r?.state,h=r?.correctChoiceIds??[],_=g&&w==="incorrect"&&h.length>0?d(o||"",h[0]):void 0,u=_?_.html.replace(/<\/?[^>]+(>|$)/g,""):void 0,{setNodeRef:x,isOver:A}=ns({id:t,data:{type:"blank",blankId:t,poolId:o}}),{active:E}=os(),$=!!E&&E.data.current?.poolId===o;return Yn(()=>{m(o||"",t)},[o,t,m]),Yn(()=>{let T=P=>{let q=P,{active:v,over:M}=q.detail||{};if(!M||M.id!==t)return;let{choiceId:F,poolId:z}=v?.data.current||{};if(!F||z!==o)return;let O=d(o||"",F);if(!O)return;let V=O.html.replace(/<\/?[^>]+(>|$)/g,"");c(t,o||"",F,V)};return window.addEventListener("dnd-drop",T),()=>window.removeEventListener("dnd-drop",T)},[t,o,d,c]),It(Gn,{children:[Xr("span",{ref:x,onClick:()=>{f&&!g&&l(t)},className:Zr("player-choice-blank",A&&"player-choice-blank--over",!A&&$&&!f&&!g&&"player-choice-blank--target",f&&!g&&!A&&"player-choice-blank--filled",g&&w==="correct"&&Zr("player-choice-blank--correct",b.hop),g&&w==="partial"&&Zr("player-choice-blank--partial",b.hop),g&&w==="incorrect"&&Zr("player-choice-blank--incorrect",b.wobble)),title:f&&!g?y.clickToRemove:void 0,"data-node-id":t,"data-pool-id":o,children:f?It(Gn,{children:[Xr("span",{children:S.value}),!g&&Xr("span",{className:"player-choice-blank__clear",children:"\xD7"})]}):a}),u&&It("span",{className:"player-blank-reveal",children:["(",u,")"]}),Xr($e,{hint:s})]})}import{jsx as Lt,jsxs as is}from"react/jsx-runtime";import{useEffect as Jn,useState as cs}from"react";import ls from"clsx";import{jsx as Kn}from"react/jsx-runtime";import as from"clsx";import{useDraggable as ss}from"@dnd-kit/core";function or({poolId:e,data:r,isInline:t=!1}){let{isAvailable:n,firstEmptyBlank:o,fill:a}=Te(),{id:s,html:i}=r,c=!n(e,s),{setNodeRef:l,attributes:d,listeners:m,transform:y,isDragging:b}=ss({id:s,data:{type:"choice",choiceId:s,poolId:e,html:i},disabled:c});if(c)return null;let S=h=>h.replace(/<\/?[^>]+(>|$)/g,""),f=()=>{let h=o(e);if(h){let _=S(i);a(h,e,s,_)}},g=y?{transform:`translate3d(${y.x}px, ${y.y}px, 0)`}:void 0;return Kn(t?"span":"div",{ref:l,style:g,className:as("player-bank-pill",b&&"player-bank-pill--dragging",t&&"mx-1"),...d,...m,onClick:f,children:Kn("span",{dangerouslySetInnerHTML:{__html:i},className:"pointer-events-none whitespace-pre-wrap break-words"})})}function Fr({node:e}){let r=re(),{id:t,attrs:n,content:o}=e,{shuffle:a=!0,equalWidth:s=!1}=n,{registerPool:i}=Te(),[c,l]=cs(()=>o.map(d=>({id:d.id,html:te(d.content)})));return Jn(()=>{let d=o.map(m=>({id:m.id,html:te(m.content)}));l(a?[...d].map(m=>({v:m,r:Math.random()})).sort((m,y)=>m.r-y.r).map(m=>m.v):d)},[a,JSON.stringify(o)]),Jn(()=>{i(t,c)},[t,c,i]),is("div",{className:"player-word-bank",children:[Lt("div",{className:"player-word-bank__label",children:r.wordBank}),Lt("div",{className:ls("player-word-bank__items",s&&"player-word-bank__items--grid"),children:c.map(d=>Lt(or,{poolId:t,data:d},d.id))})]})}import{jsx as Tt,jsxs as ds}from"react/jsx-runtime";import{useEffect as Xn,useState as ps}from"react";function Or({node:e}){let{id:r,attrs:t,content:n}=e,{shuffle:o=!0,separator:a=" "}=t,{registerPool:s}=Te(),[i,c]=ps(()=>n.map(l=>({id:l.id,html:te(l.content,{stripParagraphs:!0})})));return Xn(()=>{let l=n.map(d=>({id:d.id,html:te(d.content,{stripParagraphs:!0})}));c(o?[...l].map(d=>({v:d,r:Math.random()})).sort((d,m)=>d.r-m.r).map(d=>d.v):l)},[o,JSON.stringify(n)]),Xn(()=>{s(r,i)},[r,i,s]),Tt("span",{style:{display:"inline-flex",flexWrap:"wrap",gap:I("0.25rem"),alignItems:"center"},children:i.map((l,d)=>ds("span",{children:[Tt(or,{poolId:r,data:l,isInline:!0}),d<i.length-1&&Tt("span",{children:a})]},l.id))})}import{jsx as ar,jsxs as Ft}from"react/jsx-runtime";import{useState as Ot,useEffect as jt,useMemo as hs}from"react";import{Check as gs,X as bs}from"lucide-react";import{jsx as pe,jsxs as er}from"react/jsx-runtime";import{useState as $t,useMemo as zt,useRef as Dt,useCallback as ms,useLayoutEffect as us}from"react";var Zn="#1d2025",eo="#8d93a0",ro="#1f8a4c",to="#d23b2b",fs=11;function no({leftItems:e,rightItems:r,connections:t,direction:n,disabled:o,feedback:a,onConnectionsChange:s}){let[i,c]=$t(null),[l,d]=$t(null),[m,y]=$t(new Map),b=Dt(null),S=Dt(new Map),f=Dt("mouse"),g=a?.showFeedback??!1,w=zt(()=>{let R=new Map;if(a?.pairFeedback)for(let N of a.pairFeedback)R.set(`${N.leftId}-${N.rightId}`,N.correct);return R},[a]),h=zt(()=>{let R=new Map;return a?.correctPairings?.forEach(N=>R.set(N.leftId,N.rightId)),R},[a]),_=zt(()=>{let R=new Map;return a?.correctPairings?.forEach(N=>R.set(N.rightId,N.leftId)),R},[a]),u=new Map,x=new Map;t.forEach((R,N)=>{u.set(R.leftId,N),x.set(R.rightId,N)});let A=R=>{let N=t[R];if(!g||!N)return null;let D=w.get(`${N.leftId}-${N.rightId}`);return D===!0?"correct":D===!1?"incorrect":null},E=ms(()=>{if(!b.current)return;let R=b.current.getBoundingClientRect(),N=new Map;S.current.forEach((D,H)=>{if(D){let Q=D.getBoundingClientRect();N.set(H,new DOMRect(Q.left-R.left,Q.top-R.top,Q.width,Q.height))}}),y(N)},[]);us(()=>{E();let R=new ResizeObserver(E);return b.current&&R.observe(b.current),()=>R.disconnect()},[E,t,e,r]);let $=8,k=(R,N)=>{let D=m.get(R);if(!D)return null;let H=D.y+D.height/2;return N==="left"?{x:D.x+D.width,y:H}:{x:D.x-$,y:H}},p=(R,N)=>{if(o)return;let H=(N==="left"?u:x).has(R),Q=i?.id===R&&i?.side===N,ge=i!==null&&i.side!==N;if(Q){c(null);return}if(ge){let ae=N==="right"?i.id:R,oe=N==="left"?i.id:R,Z=t.filter(ne=>ne.leftId!==ae&&ne.rightId!==oe);Z.push({leftId:ae,rightId:oe}),s(Z),c(null);return}if(H&&!i){let ae=N==="left"?t.filter(oe=>oe.leftId!==R):t.filter(oe=>oe.rightId!==R);s(ae);return}c({id:R,side:N})},T=(R,N,D)=>{if(o||(f.current=D.pointerType,D.pointerType==="touch"))return;D.currentTarget.setPointerCapture(D.pointerId);let H=b.current.getBoundingClientRect();d({fromId:R,fromSide:N,x:D.clientX-H.left,y:D.clientY-H.top,overId:null,overSide:null})},P=R=>{if(!l)return;let N=b.current.getBoundingClientRect(),D=R.clientX-N.left,H=R.clientY-N.top,Q=l.fromSide==="left"?"right":"left",ge=Q==="left"?e:r,ae=null,oe=null;for(let Z of ge){let ne=m.get(Z.id);if(ne&&D>=ne.x&&D<=ne.x+ne.width&&H>=ne.y&&H<=ne.y+ne.height){ae=Z.id,oe=Q;break}}d(Z=>Z?{...Z,x:D,y:H,overId:ae,overSide:oe}:null)},q=R=>{if(!l)return;let N=b.current.getBoundingClientRect(),D=R.clientX-N.left,H=R.clientY-N.top,Q=k(l.fromId,l.fromSide);if((Q?Math.hypot(D-Q.x,H-Q.y):999)<8){d(null),p(l.fromId,l.fromSide);return}if(l.overId&&l.overSide){let ae=l.fromSide==="left"?l.fromId:l.overId,oe=l.fromSide==="right"?l.fromId:l.overId,Z=t.filter(ne=>ne.leftId!==ae&&ne.rightId!==oe);Z.push({leftId:ae,rightId:oe}),s(Z)}d(null),c(null)},v=(R,N)=>{if(!g)return null;let H=(N==="left"?u:x).get(R.id);if(H!==void 0){let Q=t[H];if(w.get(`${Q.leftId}-${Q.rightId}`)===!0)return null}if(N==="left"){let Q=h.get(R.id);return r.find(ge=>ge.id===Q)?.content??null}else{let Q=_.get(R.id);return e.find(ge=>ge.id===Q)?.content??null}},M=(R,N)=>{let H=(N==="left"?u:x).get(R.id),Q=H!==void 0,ge=i?.id===R.id&&i?.side===N,ae=i!==null&&i.side!==N&&!Q,oe=l?.overId===R.id&&l?.overSide===N,Z=Q?A(H):null,ne=Q?H+1:null,Ae="matching-player__item";Q&&(Ae+=" matching-player__item--matched"),Z==="correct"&&(Ae+=" matching-player__item--correct"),Z==="incorrect"&&(Ae+=" matching-player__item--incorrect"),ge&&(Ae+=" matching-player__item--selected"),(ae||oe)&&(Ae+=" matching-player__item--available"),o&&(Ae+=" matching-player__item--disabled");let Ue=v(R,N);return er("button",{ref:Y=>{Y?S.current.set(R.id,Y):S.current.delete(R.id)},type:"button",className:Ae,onPointerDown:Y=>T(R.id,N,Y),onClick:()=>{f.current==="touch"&&p(R.id,N)},"aria-pressed":ge,children:[N==="right"&&pe("span",{className:"matching-player__connector matching-player__connector--right","aria-hidden":!0,children:er("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:[pe("circle",{cx:"9",cy:"9",r:"8",stroke:"currentColor",strokeWidth:"1.5",fill:"currentColor",fillOpacity:"0.08"}),pe("path",{d:"M12 9H6M8.5 6.5L6 9l2.5 2.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}),Q&&N==="left"&&pe("span",{className:"matching-player__pair-num","aria-hidden":!0,children:ne}),pe("span",{className:"matching-player__item-text",dangerouslySetInnerHTML:{__html:te(R.content)}}),Ue&&er("span",{className:"matching-player__correct-hint",children:["(",pe("span",{dangerouslySetInnerHTML:{__html:te(Ue)}}),")"]}),Q&&N==="right"&&pe("span",{className:"matching-player__pair-num","aria-hidden":!0,children:ne}),N==="left"&&pe("span",{className:"matching-player__connector matching-player__connector--left","aria-hidden":!0,children:er("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:[pe("circle",{cx:"9",cy:"9",r:"8",stroke:"currentColor",strokeWidth:"1.5",fill:"currentColor",fillOpacity:"0.08"}),pe("path",{d:"M6 9h6M9.5 6.5L12 9l-2.5 2.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})})]},R.id)},F=n==="ltr"?e:r,z=n==="ltr"?r:e,O=n==="ltr"?"left":"right",V=n==="ltr"?"right":"left";return er("div",{ref:b,className:`matching-player__arena${l?" matching-player__arena--dragging":""}`,onPointerMove:P,onPointerUp:q,children:[er("svg",{className:"matching-player__svg","aria-hidden":!0,children:[pe("defs",{children:[["mp-arrow-ink",Zn],["mp-arrow-correct",ro],["mp-arrow-incorrect",to],["mp-arrow-ghost",eo]].map(([R,N])=>pe("marker",{id:R,markerUnits:"userSpaceOnUse",markerWidth:"11",markerHeight:"9",refX:"0",refY:"4.5",orient:"auto",children:pe("polygon",{points:"0 0, 11 4.5, 0 9",fill:N})},R))}),t.map(R=>{let N=k(R.leftId,"left"),D=k(R.rightId,"right");if(!N||!D)return null;let H=D.x-fs,Q=Math.max(16,Math.abs(H-N.x)*.4),ge=`M ${N.x} ${N.y} C ${N.x+Q} ${N.y}, ${H-Q} ${D.y}, ${H} ${D.y}`,ae=g?w.get(`${R.leftId}-${R.rightId}`):void 0;return pe("path",{d:ge,stroke:ae===!0?ro:ae===!1?to:Zn,strokeWidth:"2.5",fill:"none",markerEnd:`url(#${ae===!0?"mp-arrow-correct":ae===!1?"mp-arrow-incorrect":"mp-arrow-ink"})`},`${R.leftId}-${R.rightId}`)}),l&&(()=>{let R=k(l.fromId,l.fromSide);if(!R)return null;let N=Math.abs(l.x-R.x)*.35,D=`M ${R.x} ${R.y} C ${R.x+N} ${R.y}, ${l.x-N} ${l.y}, ${l.x} ${l.y}`;return pe("path",{d:D,stroke:eo,strokeWidth:"2",strokeDasharray:"6 4",fill:"none",markerEnd:"url(#mp-arrow-ghost)"})})()]}),er("div",{className:"matching-player__columns",children:[pe("div",{className:"matching-player__column",children:F.map(R=>M(R,O))}),pe("div",{className:"matching-player__column",children:z.map(R=>M(R,V))})]})]})}var oo=e=>Number.isInteger(e)?String(e):e.toFixed(2);function ao(e){return[...e].map(r=>({v:r,r:Math.random()})).sort((r,t)=>r.r-t.r).map(r=>r.v)}function jr({node:e,validationFeedback:r}){let t=le(),{shuffleSeed:n,layoutBy:o}=Pe(),{id:a,attrs:s,leftItems:i,rightItems:c}=e,{direction:l,shuffle:d,hint:m}=s,y=JSON.stringify(i),b=JSON.stringify(c),S=d&&n!==void 0,f=hs(()=>S?{left:xr(i,`${n}:${a}:left`),right:xr(c,`${n}:${a}:right`)}:null,[S,n,a,y,b]),[g,w]=Ot(i),[h,_]=Ot(c);jt(()=>{S||(d?(w(ao(i)),_(ao(c))):(w(i),_(c)))},[d,S,y,b]);let u=f?.left??g,x=f?.right??h,[A,E]=Ot([]),$=r?.showFeedback??!1;jt(()=>{let v=M=>{let z=M.answers.find(O=>O.nodeId===a&&O.type==="matchingSet");z&&"connections"in z.answer&&E(z.answer.connections)};return t.on("answers:prefill",v),()=>t.off("answers:prefill",v)},[t,a]),jt(()=>{t.emit({type:"answer:changed",answer:{nodeId:a,type:"matchingSet",timestamp:Date.now(),answer:{connections:A}}})},[t,a,A]);let k=v=>{$||E(v)},p=r?.score,T=r?.maxScore,P=$&&p!=null&&T!=null,q=P?p>=T?"correct":p>0?"partial":"incorrect":null;return Ft("div",{className:o==="box"?"matching-player matching-player--box":"matching-player",children:[m&&m.length>0&&ar("div",{className:"matching-player-hintrow",children:ar($e,{hint:m})}),ar(no,{leftItems:u,rightItems:x,connections:A,direction:l,disabled:$,feedback:r,onConnectionsChange:k}),P&&Ft("div",{className:"matching-player-feedback matching-player-feedback--"+q,children:[q==="correct"&&ar(gs,{size:15,style:ee(15)}),q==="incorrect"&&ar(bs,{size:15,style:ee(15)}),ar("span",{children:q==="correct"?"All matched":q==="partial"?"Partial credit":"Not matched"}),Ft("span",{className:"matching-player-score",children:[oo(p)," / ",oo(T)]})]})]})}import{jsxs as sr,jsx as ze,Fragment as xs}from"react/jsx-runtime";import{useState as so,useEffect as Bt,useRef as ys,useCallback as io}from"react";import et from"clsx";function Br({node:e,validationFeedback:r}){let t=le(),n=re(),{id:o,attrs:a}=e,{placeholder:s,minWords:i=0,maxWords:c=500,hint:l}=a,[d,m]=so(""),[y,b]=so(0),S=r?.showFeedback??!1,f=r?.state,g=c<=30,w=io(p=>p.trim().split(/\s+/).filter(Boolean).length,[]);Bt(()=>{let p=T=>{let q=T.answers?.find(v=>v.nodeId===o&&v.type==="aiAnswer");if(q&&q.answer?.text!=null){let v=q.answer.text;m(v),b(w(v))}};return t.on("answers:prefill",p),()=>t.off("answers:prefill",p)},[o,t,w]),Bt(()=>{let p=()=>{m(""),b(0)};return t.on("answers:reset",p),()=>t.off("answers:reset",p)},[t]);let h=ys(null),_=io((p,T)=>{h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{t.emit({type:"answer:changed",answer:{nodeId:o,type:"aiAnswer",timestamp:Date.now(),answer:{text:p,wordCount:T}}})},300)},[o,t]);Bt(()=>{t.emit({type:"answer:changed",answer:{nodeId:o,type:"aiAnswer",timestamp:Date.now(),answer:{text:"",wordCount:0}}})},[]);let u=p=>{if(S)return;let T=w(p);m(p),b(T),_(p,T)},x=f==="validating",A=et("player-ai-count",y>c&&"player-ai-count--over"),E=!S||x?"":f==="correct"?"player-ai-input--correct":f==="incorrect"?"player-ai-input--incorrect":f==="partial"?"player-ai-input--partial":"",$=f==="correct"?"player-ai-feedback--correct":f==="incorrect"?"player-ai-feedback--incorrect":f==="partial"?"player-ai-feedback--partial":"",k=p=>Number.isInteger(p)?String(p):p.toFixed(2);return sr("div",{className:"player-ai",children:[sr("div",{className:"player-ai-counts",children:[sr("span",{className:A,children:[y," / ",c]}),i>0&&y<i&&ze("span",{className:"player-ai-count player-ai-count--min",children:n.minWordsLabel(i)}),ze("span",{style:{marginInlineStart:"auto"},children:ze($e,{hint:l})})]}),g?ze("input",{type:"text",value:d,onChange:p=>u(p.target.value),placeholder:s??n.shortAnswerPlaceholder,disabled:S,className:et("player-ai-input",E)}):ze("textarea",{value:d,onChange:p=>u(p.target.value),placeholder:s??n.longAnswerPlaceholder,disabled:S,rows:5,className:et("player-ai-input player-ai-input--multiline",E)}),S&&r&&ze("div",{className:et("player-ai-feedback",$),children:x?sr("div",{className:"player-ai-validating",children:[ze("span",{className:"player-ai-spinner"}),ze("span",{children:n.aiEvaluationInProgress})]}):sr(xs,{children:[r.message&&ze("p",{className:"player-ai-message",children:r.message}),r.score!=null&&r.maxScore!=null&&ze("div",{className:"player-ai-score-row",children:sr("span",{className:"player-ai-score",children:[k(r.score)," / ",k(r.maxScore)]})})]})})]})}import{Fragment as co,jsx as C,jsxs as K}from"react/jsx-runtime";import{useState as fe,useEffect as _e,useRef as Se,useCallback as rt}from"react";import{useEditor as vs,EditorContent as ws}from"@tiptap/react";import ks from"@tiptap/starter-kit";import De from"clsx";import{FolderOpen as Rs,Mic as Ss,Video as mo,Monitor as _s,Clock as Ns,Image as As,FileText as uo,Music as Cs,Link2 as Es}from"lucide-react";function fo(e){return e.trim().split(/\s+/).filter(Boolean).length}function ho(e){return e.length}function Ps(e){let r=t=>t.map(n=>(n.text??"")+(n.content?r(n.content):"")).join(" ");return fo(r(e))}function Ms(e){let r=t=>t.map(n=>(n.text??"")+(n.content?r(n.content):"")).join("");return ho(r(e))}function qt({node:e}){if(e.type==="text"){if(!e.marks||e.marks.length===0)return C(co,{children:e.text});let r=e.text||"";for(let t of e.marks)t.type==="bold"?r=C("strong",{children:r}):t.type==="italic"?r=C("em",{children:r}):t.type==="underline"?r=C("u",{children:r}):t.type==="strike"?r=C("s",{children:r}):t.type==="textStyle"&&t.attrs?.color&&(r=C("span",{style:{color:t.attrs.color},children:r}));return C(co,{children:r})}return e.type==="paragraph"?C("span",{className:"block",children:e.content?.map((r,t)=>C(qt,{node:r},t))??C("br",{})}):e.type==="hardBreak"?C("br",{}):e.content?C("span",{className:"block",children:e.content.map((r,t)=>C(qt,{node:r},t))}):null}function Is({nodes:e}){return C("span",{className:"block space-y-1 text-amber-900",children:e.map((r,t)=>C(qt,{node:r},t))})}function Ls({hint:e}){let r=re(),[t,n]=fe(!1),[o,a]=fe(!1),s=Se(null);return _e(()=>{if(!o)return;let i=c=>{s.current&&!s.current.contains(c.target)&&(a(!1),n(!1))};return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[o]),K("span",{ref:s,className:"relative inline-flex items-center align-middle",onMouseEnter:()=>n(!0),onMouseLeave:()=>{o||n(!1)},children:[C("button",{type:"button",onClick:i=>{i.stopPropagation(),o?(a(!1),n(!1)):(a(!0),n(!0))},className:De("player-blank-hint-btn select-none",o&&"player-blank-hint-btn--pinned"),"aria-label":r.showHint,children:"?"}),t&&C("span",{className:"player-blank-hint-pop",onClick:i=>i.stopPropagation(),children:C(Is,{nodes:e})})]})}function lo(e){if(!isFinite(e.duration)){e.currentTime=1e101;let r=()=>{e.currentTime=0,e.removeEventListener("timeupdate",r)};e.addEventListener("timeupdate",r)}}function Ts(e){return/youtube\.com|youtu\.be/i.test(e)?"youtube":/vimeo\.com/i.test(e)?"vimeo":"other"}function $s(e){let r=e.match(/[?&]v=([^&]+)/)||e.match(/youtu\.be\/([^?]+)/)||e.match(/embed\/([^?]+)/);return r?r[1]:null}function po(e){let r=Math.floor(e/60),t=e%60;return`${r}:${t.toString().padStart(2,"0")}`}function qr({node:e,validationFeedback:r,readOnly:t=!1,mediaHandler:n}){let o=le(),a=re(),{id:s,attrs:i}=e,{mode:c,placeholder:l,allowFormatting:d,wordLimit:m,characterLimit:y,allowedTypes:b,allowMultiple:S,fileInstructions:f,maxDuration:g,hint:w}=i,h=t||(r?.showFeedback??!1),_=r?.state,u=Se(null),x=rt(p=>{u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{let T=p.files?.map(P=>({url:P.url,mimeType:P.kind==="videoLink"?"video/x-link":P.mimeType,name:P.kind==="videoLink"?void 0:P.name,duration:P.kind==="videoLink"?void 0:P.duration}));o.emit({type:"answer:changed",answer:{nodeId:s,type:"openResponse",timestamp:Date.now(),answer:{...p,files:T}}})},300)},[s,o]);_e(()=>{x({})},[]);let[A,E]=fe([]);_e(()=>{(c==="file"||c==="text+file")&&c==="file"&&x({files:A})},[A,c]),_e(()=>{let p=()=>{E([])};return o.on("answers:reset",p),()=>o.off("answers:reset",p)},[o]),_e(()=>{let p=T=>{let q=(T.answers??[]).find(v=>v.nodeId===s&&v.type==="openResponse");q?.answer?.files&&E(q.answer.files)};return o.on("answers:prefill",p),()=>o.off("answers:prefill",p)},[s,o]);let $=r?.showFeedback,k=De(!$&&"player-or-field--pre",$&&_==="correct"&&"player-or-field--correct",$&&_==="partial"&&"player-or-field--partial",$&&_==="incorrect"&&"player-or-field--incorrect",$&&_==="awaiting_review"&&"player-or-field--review");return K("div",{className:"my-3 space-y-2",children:[!h&&w&&w.length>0&&C("div",{className:"flex justify-end",children:C(Ls,{hint:w})}),c==="text"&&C(go,{nodeId:s,placeholder:l,allowFormatting:d,wordLimit:m,characterLimit:y,isDisabled:h,feedbackBorderClass:k,emitAnswer:p=>x({text:p}),answerBus:o}),c==="file"&&C(Wt,{allowedTypes:b??["image"],allowMultiple:!!S,fileInstructions:f,isDisabled:h,feedbackBorderClass:k,files:A,setFiles:E,mediaHandler:n,t:a}),(c==="audio"||c==="video"||c==="screen")&&C(js,{kind:c,maxDuration:g,isDisabled:h,feedbackBorderClass:k,mediaHandler:n,emitAnswer:p=>x({recording:p}),t:a}),c==="text+file"&&C(Os,{nodeId:s,placeholder:l,allowFormatting:d,wordLimit:m,characterLimit:y,allowedTypes:b??["image"],allowMultiple:!!S,fileInstructions:f,isDisabled:h,feedbackBorderClass:k,files:A,setFiles:E,emitAnswer:x,answerBus:o,mediaHandler:n,t:a}),r?.showFeedback&&_==="awaiting_review"&&K("div",{className:"flex items-center gap-2 text-sm border rounded px-3 py-2",style:{color:"var(--almost-ink, #8a5a08)",background:"var(--almost-soft, #fbf1dc)",borderColor:"var(--almost, #c8810e)"},children:[C(Ns,{size:15,style:ee(15),className:"animate-pulse"}),C("span",{children:a.openResponseAwaitingReview})]}),r?.showFeedback&&_!=="awaiting_review"&&r.teacherFeedback&&C(Bs,{feedback:r.teacherFeedback,feedbackState:_,score:r.score,t:a})]})}function go({nodeId:e,placeholder:r,allowFormatting:t,wordLimit:n,characterLimit:o,isDisabled:a,feedbackBorderClass:s,emitAnswer:i,answerBus:c}){let l=re(),[d,m]=fe(""),[y,b]=fe(0),[S,f]=fe(0),g=Se(null),w=rt(()=>{let M=g.current;M&&(M.style.height="auto",M.style.height=`${M.scrollHeight}px`)},[]),h=vs({extensions:[ks.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1})],immediatelyRender:!1,editable:!a,content:"",onUpdate({editor:M}){if(a)return;let z=M.getJSON().content??[],O=Ps(z),V=Ms(z);b(O),f(V),i({content:z,wordCount:O})}});_e(()=>{h&&h.setEditable(!a)},[a,h]);let _=Se(null);_e(()=>{h&&_.current!==null&&(h.commands.setContent({type:"doc",content:_.current}),_.current=null)},[h]),_e(()=>{let M=F=>{let z=(F.answers??[]).find(V=>V.nodeId===e&&V.type==="openResponse");if(!z?.answer?.text)return;let O=z.answer.text.content??[];if(t)h?h.commands.setContent({type:"doc",content:O}):_.current=O;else{let V=O.flatMap(U=>U.content?.map(R=>R.text??"")??[U.text??""]).join(`
2
+ `);m(V),setTimeout(w,0)}};return c.on("answers:prefill",M),()=>c.off("answers:prefill",M)},[e,c,t,h]),_e(()=>{let M=()=>{t&&h?h.commands.clearContent():(m(""),setTimeout(w,0)),b(0),f(0)};return c.on("answers:reset",M),()=>c.off("answers:reset",M)},[c,t,h,w]);let u=!!n,x=!!o&&!n,A=u?y:S,E=u?n?.max:o?.max,$=u?n?.min:o?.min,k=E!=null&&A>E,p=E!=null&&A>=E*.8&&!k,T=$!=null&&A<$&&A>0,P="text-xs tabular-nums",q=k?{color:"var(--pen, #d23b2b)",fontWeight:500}:p||T?{color:"var(--almost, #c8810e)"}:{color:"var(--ink-faint, #8d93a0)"},v=u?E?`${y} / ${E} ${l.openResponseWords}`:$?`${y} ${l.openResponseWords} (min. ${$})`:`${y} ${l.openResponseWords}`:x?E?`${S} / ${E} ${l.openResponseChars}`:`${S} ${l.openResponseChars}`:null;return t?K("div",{className:"relative",children:[K("div",{className:De("rounded border transition-colors min-h-[120px]",s),children:[!a&&K("div",{className:"sticky top-0 z-10 flex gap-1 px-2 pt-1.5 pb-1 border-b border-gray-100 bg-white rounded-t",children:[[{label:"B",cmd:"toggleBold",style:"font-bold"},{label:"I",cmd:"toggleItalic",style:"italic"}].map(({label:M,cmd:F,style:z})=>C("button",{type:"button",onMouseDown:O=>{O.preventDefault(),h?.chain().focus()?.[F]().run()},className:`text-xs px-1.5 py-0.5 rounded hover:bg-gray-100 ${z}`,children:M},M)),C("button",{type:"button",onMouseDown:M=>{M.preventDefault(),h?.chain().focus().toggleBulletList().run()},className:"text-xs px-1.5 py-0.5 rounded hover:bg-gray-100",children:"\u2022\u2014"})]}),C(ws,{editor:h,className:"prose prose-sm max-w-none p-3 outline-none [&_.ProseMirror]:min-h-[80px] [&_.ProseMirror]:outline-none"})]}),v&&C("div",{className:De("absolute bottom-2 right-3",P),style:q,children:v})]}):K("div",{className:"relative",children:[C("textarea",{ref:g,value:d,onChange:M=>{if(a)return;let F=M.target.value;m(F);let z=fo(F),O=ho(F);b(z),f(O),w(),i({content:[{type:"paragraph",content:[{type:"text",text:F}]}],wordCount:z})},onInput:w,disabled:a,placeholder:r||l.openResponseTextPlaceholder,rows:4,style:{resize:"none",overflow:"hidden"},className:De("w-full px-3 py-2 text-base min-h-[100px] rounded border transition-colors outline-none",s,a&&"cursor-default")}),v&&C("div",{className:De("absolute bottom-2 right-3",P),children:v})]})}var zs={image:"image/*",pdf:"application/pdf",audio:"audio/*",video:"video/*"},Ds={image:C(As,{size:12,style:ee(12)}),pdf:C(uo,{size:12,style:ee(12)}),audio:C(Cs,{size:12,style:ee(12)}),video:C(mo,{size:12,style:ee(12)}),videoLink:C(Es,{size:12,style:ee(12)})};function Wt({allowedTypes:e,allowMultiple:r,fileInstructions:t,isDisabled:n,files:o,setFiles:a,mediaHandler:s,t:i,compact:c=!1}){let l=Se(null),[d,m]=fe(!1),[y,b]=fe(!1),[S,f]=fe(""),g=e.some(p=>p!=="videoLink"),w=e.includes("videoLink"),h=r||o.length===0,_=e.filter(p=>p!=="videoLink").map(p=>zs[p]).filter(Boolean).join(","),u=rt(p=>{a(T=>r?[...T,p]:[p])},[r,a]),x=rt(p=>{a(T=>T.filter((P,q)=>q!==p))},[a]),A=async p=>{if(!(!h||n)){m(!0);try{let T=p.type.startsWith("image/")?"image":p.type==="application/pdf"?"document":p.type.startsWith("audio/")?"audio":p.type.startsWith("video/")?"video":"file";if(s){let P=await s.upload(p,T);u({kind:"file",url:P.url,mimeType:P.mimeType??p.type,name:p.name})}else{let P=URL.createObjectURL(p);u({kind:"file",url:P,mimeType:p.type,name:p.name})}}finally{m(!1)}}},E=async p=>{if(p.preventDefault(),b(!1),n||!h)return;let T=p.dataTransfer.files?.[0];T&&await A(T)},$=()=>{let p=S.trim();p&&(u({kind:"videoLink",url:p,platform:Ts(p)}),f(""))},k={image:i.openResponseTypeImage,pdf:i.openResponseTypePdf,audio:i.openResponseTypeAudio,video:i.openResponseTypeVideo,videoLink:i.openResponseTypeVideoLink};return K("div",{className:"space-y-2",children:[t&&!c&&C("p",{className:"text-sm text-gray-600 italic",children:t}),o.length>0&&C("div",{className:c?"flex flex-wrap gap-1.5":"space-y-2",children:o.map((p,T)=>C(Fs,{file:p,onRemove:n?void 0:()=>x(T),compact:c,t:i},T))}),!n&&h&&K("div",{className:"space-y-2",children:[g&&!c&&K("div",{onDragOver:p=>{p.preventDefault(),b(!0)},onDragLeave:()=>b(!1),onDrop:E,className:"border-2 border-dashed rounded-lg p-6 text-center transition-colors cursor-pointer",style:{borderColor:y?"var(--ink-faint, #8d93a0)":"var(--line-strong, #d6d3cc)",background:y?"var(--ui-muted, #f5f4f1)":"transparent"},onClick:()=>l.current?.click(),children:[C(Rs,{size:26,className:"mx-auto mb-2",style:{...ee(26),color:"var(--ink-soft, #565b66)"}}),C("p",{className:"text-sm font-medium",style:{color:"var(--ink-soft, #565b66)"},children:i.openResponseDropZoneLabel}),C("p",{className:"text-xs hover:underline mt-0.5",style:{color:"var(--ink, #1d2025)"},children:i.openResponseDropZoneBrowse}),d&&C("p",{className:"text-xs mt-1 animate-pulse",style:{color:"var(--ink-faint, #8d93a0)"},children:i.openResponseUploading}),C("div",{className:"flex flex-wrap justify-center gap-1.5 mt-3",children:e.filter(p=>p!=="videoLink").map(p=>K("span",{className:"inline-flex items-center gap-1 text-[10px] px-2 py-0.5 bg-gray-100 text-gray-600 rounded-full",children:[Ds[p]," ",k[p]]},p))})]}),g&&c&&C("button",{type:"button",onClick:()=>l.current?.click(),disabled:d,className:"text-xs px-3 py-1.5 rounded border border-dashed disabled:opacity-50",style:{borderColor:"var(--line-strong, #d6d3cc)",color:"var(--ink-soft, #565b66)"},children:d?i.openResponseUploading:`+ ${i.openResponseAttachFile}`}),C("input",{ref:l,type:"file",accept:_,onChange:async p=>{let T=p.target.files?.[0];T&&(await A(T),p.target.value="")},className:"hidden"}),w&&K("div",{className:"flex gap-2 flex-wrap",children:[C("input",{type:"url",value:S,onChange:p=>f(p.target.value),placeholder:i.openResponseVideoLinkPlaceholder,className:"flex-1 text-sm border rounded px-2 py-1.5 outline-none",style:{borderColor:"var(--line-strong, #d6d3cc)"},onKeyDown:p=>{p.key==="Enter"&&(p.preventDefault(),$())}}),C("button",{type:"button",onClick:$,disabled:!S.trim(),className:"text-sm px-3 py-1.5 rounded text-white disabled:opacity-50",style:{background:"var(--ink, #1d2025)"},children:i.openResponseAddVideoLink})]})]}),n&&o.length===0&&C("p",{className:"text-sm text-gray-400 text-center py-3",children:i.openResponseNoSubmission})]})}function Fs({file:e,onRemove:r,compact:t,t:n}){if(e.kind==="videoLink"){let o=e.platform==="youtube"?$s(e.url):null;return K("div",{className:De("bg-white rounded border border-gray-200",t?"px-2 py-1 flex items-center gap-1.5":"p-3 space-y-1"),children:[o&&!t&&C("iframe",{src:`https://www.youtube.com/embed/${o}`,width:240,height:135,allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,className:"rounded w-full"}),C("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-blue-600 underline truncate block max-w-[200px]",children:e.url}),r&&C("button",{type:"button",onClick:r,className:"ml-auto text-gray-400 hover:text-rose-500 text-xs",children:"\u2715"})]})}return K("div",{className:De("bg-white rounded border border-gray-200",t?"px-2 py-1 flex items-center gap-1.5":"p-2 flex items-center gap-2"),children:[e.mimeType?.startsWith("image/")?C("img",{src:e.url,alt:e.name??"upload",className:t?"h-6 w-6 object-cover rounded":"h-16 w-16 object-cover rounded"}):e.mimeType?.startsWith("audio/")?C("audio",{src:e.url,controls:!0,className:t?"hidden":"h-8 max-w-[240px]"}):e.mimeType?.startsWith("video/")?C("video",{src:e.url,controls:!0,className:t?"hidden":"h-16 max-w-[240px] rounded"}):C(uo,{size:20,style:{...ee(20),color:"var(--ink-soft, #565b66)"}}),K("div",{className:"flex-1 min-w-0",children:[C("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-gray-700 truncate block hover:underline",children:e.name??n.openResponseFile}),t&&e.mimeType?.startsWith("audio/")&&C("audio",{src:e.url,controls:!0,className:"h-6 max-w-[160px] mt-0.5"})]}),r&&C("button",{type:"button",onClick:r,className:"ml-auto text-gray-400 hover:text-rose-500 text-xs shrink-0",children:"\u2715"})]})}function Os({nodeId:e,placeholder:r,allowFormatting:t,wordLimit:n,characterLimit:o,allowedTypes:a,allowMultiple:s,fileInstructions:i,isDisabled:c,feedbackBorderClass:l,files:d,setFiles:m,emitAnswer:y,answerBus:b,mediaHandler:S,t:f}){let[g,w]=fe(null),[h,_]=fe(!1);return _e(()=>{y({...g&&{text:g},files:d.length>0?d:void 0})},[g,d]),K("div",{className:"space-y-2",children:[C(go,{nodeId:e,placeholder:r,allowFormatting:t,wordLimit:n,characterLimit:o,isDisabled:c,feedbackBorderClass:l,emitAnswer:u=>w(u),answerBus:b}),!c&&K("div",{children:[K("button",{type:"button",onClick:()=>_(!h),className:"flex items-center gap-1.5 text-xs",style:{color:"var(--ink-soft, #565b66)"},children:[C("span",{children:h?"\u25BE":"\u25B8"}),K("span",{children:[f.openResponseAttachFiles,d.length>0&&C("span",{className:"ml-1 rounded-full px-1.5 py-0.5 text-[10px]",style:{background:"var(--ui-muted, #f5f4f1)",color:"var(--ink, #1d2025)"},children:d.length})]})]}),h&&C("div",{className:"mt-1.5",children:C(Wt,{allowedTypes:a,allowMultiple:s,fileInstructions:i,isDisabled:c,feedbackBorderClass:l,files:d,setFiles:m,mediaHandler:S,t:f,compact:!0})})]}),c&&d.length>0&&K("div",{className:"space-y-1",children:[C("p",{className:"text-xs text-gray-500 font-medium",children:f.openResponseAttachedFiles}),C(Wt,{allowedTypes:a,allowMultiple:s,isDisabled:!0,feedbackBorderClass:l,files:d,setFiles:m,t:f,compact:!0})]})]})}function js({kind:e,maxDuration:r,isDisabled:t,feedbackBorderClass:n,mediaHandler:o,emitAnswer:a,t:s}){let[i,c]=fe("idle"),[l,d]=fe(0),[m,y]=fe(null),[b,S]=fe("audio/webm"),[f,g]=fe(null),w=Se(null),h=Se(null),_=Se([]),u=Se(null),x=Se(null),A=Se(null),E=Se(0);_e(()=>()=>{$(),u.current&&clearInterval(u.current),cancelAnimationFrame(E.current)},[]),_e(()=>{i==="recording"&&e==="audio"&&h.current&&q(h.current)},[i]);let $=()=>{h.current?.getTracks().forEach(v=>v.stop()),h.current=null},k=async()=>{if(!o){g(s.openResponseMediaHandlerRequired);return}g(null),c("requesting");try{let v;if(e==="screen"){let z=await navigator.mediaDevices.getDisplayMedia({video:{cursor:"always"},audio:!1});try{let V=(await navigator.mediaDevices.getUserMedia({audio:!0})).getAudioTracks()[0];V&&z.addTrack(V)}catch{}z.getVideoTracks()[0]?.addEventListener("ended",()=>{w.current?.state==="recording"&&p()}),v=z,x.current&&(x.current.srcObject=v,x.current.play())}else e==="video"?(v=await navigator.mediaDevices.getUserMedia({audio:!0,video:{facingMode:"environment"}}),x.current&&(x.current.srcObject=v,x.current.play())):v=await navigator.mediaDevices.getUserMedia({audio:!0});h.current=v;let M=e==="audio"?"audio/webm":"video/webm";S(M);let F=new MediaRecorder(v,{mimeType:M});w.current=F,_.current=[],F.ondataavailable=z=>{z.data.size>0&&_.current.push(z.data)},F.onstop=()=>{let z=new Blob(_.current,{type:M}),O=URL.createObjectURL(z);y(O),c("reviewing"),$(),cancelAnimationFrame(E.current)},F.start(200),c("recording"),d(0),u.current=setInterval(()=>{d(z=>{let O=z+1;return r&&O>=r&&p(),O})},1e3)}catch{c("idle"),g(s.openResponsePermissionDenied)}},p=()=>{u.current&&(clearInterval(u.current),u.current=null),w.current?.stop()},T=async()=>{if(!m||!o)return;c("submitted");let M=await(await fetch(m)).blob(),F=e==="screen"?"video":e,z=new File([M],"recording.webm",{type:b}),O=await o.upload(z,F);URL.revokeObjectURL(m),a({url:O.url,mimeType:O.mimeType??b,duration:l,kind:F})},P=()=>{m&&URL.revokeObjectURL(m),y(null),d(0),c("idle")},q=v=>{let M=new AudioContext,F=M.createMediaStreamSource(v),z=M.createAnalyser();z.fftSize=64,F.connect(z);let O=new Uint8Array(z.frequencyBinCount),V=A.current;if(!V)return;let U=()=>{z.getByteFrequencyData(O);let R=V.getContext("2d");if(!R)return;R.clearRect(0,0,V.width,V.height);let N=V.width/O.length*2.5,D=0;for(let H=0;H<O.length;H++){let Q=O[H]/255*V.height;R.fillStyle="#1d2025",R.fillRect(D,V.height-Q,N,Q),D+=N+1}E.current=requestAnimationFrame(U)};U()};return t?C("div",{className:De("rounded border p-4 text-center text-sm text-gray-400",n),children:s.openResponseRecordingSubmitted}):K("div",{className:De("rounded border p-4 space-y-3",n),children:[f&&C("p",{className:"text-sm",style:{color:"var(--pen, #d23b2b)"},children:f}),(e==="video"||e==="screen")&&i==="recording"&&C("video",{ref:x,muted:!0,className:"w-full rounded max-h-48 bg-black",playsInline:!0}),e==="audio"&&i==="recording"&&C("canvas",{ref:A,width:300,height:48,className:"w-full rounded bg-gray-900"}),i==="reviewing"&&m&&(e==="audio"?C("audio",{src:m,controls:!0,className:"w-full",onLoadedMetadata:v=>lo(v.currentTarget)}):C("video",{src:m,controls:!0,className:"w-full rounded max-h-48",onLoadedMetadata:v=>lo(v.currentTarget)})),K("div",{className:"flex items-center justify-center gap-3",children:[i==="idle"&&K("button",{type:"button",onClick:k,className:"flex flex-col items-center gap-1 px-6 py-3 rounded-full font-medium text-white transition-colors",style:{background:"var(--ink, #1d2025)"},children:[e==="audio"?C(Ss,{size:22,style:ee(22)}):e==="screen"?C(_s,{size:22,style:ee(22)}):C(mo,{size:22,style:ee(22)}),C("span",{className:"text-sm",children:e==="screen"?s.openResponseTapToRecordScreen:s.openResponseTapToRecord})]}),i==="requesting"&&C("p",{className:"text-sm text-gray-500 animate-pulse",children:s.openResponseRequestingPermission}),i==="recording"&&K("div",{className:"flex flex-col items-center gap-2",children:[K("div",{className:"flex items-center gap-2 font-mono text-lg",style:{color:"var(--pen, #d23b2b)"},children:[C("span",{className:"animate-pulse",children:"\u25CF"}),C("span",{children:po(l)}),r&&K("span",{className:"text-sm",style:{color:"var(--ink-faint, #8d93a0)"},children:["/ ",po(r)]})]}),C("button",{type:"button",onClick:p,className:"px-5 py-2 rounded-full text-white text-sm font-medium",style:{background:"var(--pen, #d23b2b)"},children:s.openResponseStopRecording})]}),i==="reviewing"&&K("div",{className:"flex gap-2",children:[C("button",{type:"button",onClick:P,className:"px-4 py-1.5 rounded border text-sm",style:{borderColor:"var(--line-strong, #d6d3cc)",color:"var(--ink, #1d2025)"},children:s.openResponseReRecord}),C("button",{type:"button",onClick:T,className:"px-4 py-1.5 rounded text-white text-sm",style:{background:"var(--ink, #1d2025)"},children:s.openResponseConfirmRecording})]}),i==="submitted"&&K("p",{className:"text-sm",style:{color:"var(--ok, #1f8a4c)"},children:["\u2713 ",s.openResponseRecordingSubmitted]})]})]})}function Bs({feedback:e,feedbackState:r,score:t,t:n}){let o=r==="correct"?{bg:"var(--ok-soft, #ecf8f0)",border:"var(--ok, #1f8a4c)",ink:"var(--ok, #1f8a4c)"}:r==="incorrect"?{bg:"var(--pen-soft, #fdeeec)",border:"var(--pen, #d23b2b)",ink:"var(--pen, #d23b2b)"}:{bg:"var(--almost-soft, #fbf1dc)",border:"var(--almost, #c8810e)",ink:"var(--almost-ink, #8a5a08)"};return K("div",{className:"rounded p-3 text-sm border",style:{background:o.bg,borderColor:o.border,color:"var(--ink, #1d2025)"},children:[C("p",{className:"text-xs font-medium mb-1 opacity-70",children:n.openResponseTeacherFeedbackLabel}),e.flatMap(a=>a.content?.map(s=>s.text??"")??[a.text??""]).join(" "),t!=null&&K("div",{className:"mt-1 text-right",style:{fontFamily:'var(--font-hand, "Caveat", cursive)',fontSize:I("1.4rem"),lineHeight:1,color:o.ink},children:[t," pts"]})]})}import{jsx as Ge,jsxs as ir,Fragment as bo}from"react/jsx-runtime";import{useEffect as Ut,useRef as qs,useState as xo}from"react";function Ws(e){return e?.showFeedback?e.state==="validating"?"validating":e.state==="correct"?"correct":e.state==="incorrect"?"incorrect":"idle":"idle"}function Wr({nodeId:e,placeholder:r,hint:t,validationFeedback:n,readOnly:o=!1}){let a=le(),s=qs(null),[i,c]=xo(""),[l,d]=xo(!1),m=Ws(n),y=n?.score,b=n?.maxScore,S=w=>Number.isInteger(w)?String(w):w.toFixed(2);Ut(()=>{import("mathlive").then(()=>{d(!0)}).catch(()=>{})},[]),Ut(()=>{let w=h=>{let _=h.answers?.find(u=>u.nodeId===e&&u.type==="mathResponse");_?.answer?.latex!==void 0&&(c(_.answer.latex),s.current&&(s.current.value=_.answer.latex))};return a.on("answers:prefill",w),()=>a.off("answers:prefill",w)},[a,e]),Ut(()=>{a.emit({type:"answer:changed",answer:{nodeId:e,type:"mathResponse",timestamp:Date.now(),answer:{latex:i}}})},[i,e,a]);let f=w=>{let h=w.target?.value??"";c(h)},g=m==="correct"?"player-math-field--correct":m==="incorrect"?"player-math-field--incorrect":m==="validating"?"player-math-field--validating":"";return ir("div",{dir:"ltr",className:"math-response-player",children:[ir("span",{style:{display:"inline-flex",alignItems:"center",gap:I("0.4rem")},children:[Ge("div",{className:"player-math-field"+(g?" "+g:"")+(o?" player-math-field--readonly":""),children:l?Ge("math-field",{ref:s,value:i,onInput:f,"virtual-keyboard-mode":"onfocus","smart-fence":"true",className:"player-math-field__input",style:{opacity:o?.7:1,pointerEvents:o?"none":"auto"}}):Ge("input",{type:"text",value:i,onChange:w=>c(w.target.value),placeholder:r||"Enter LaTeX (e.g. \\frac{x^2}{2})",readOnly:o,className:"player-math-field__fallback"})}),Ge($e,{hint:t})]}),n?.showFeedback&&ir("div",{className:"player-math-feedback player-math-feedback--"+m,children:[m==="validating"&&ir(bo,{children:[Ge("span",{className:"player-math-spinner"}),Ge("span",{children:"Checking your answer\u2026"})]}),m==="correct"&&ir(bo,{children:[Ge("span",{children:"\u2713 Correct"}),y!=null&&ir("span",{className:"player-math-score",children:[S(y),b!=null?` / ${S(b)}`:""]})]}),m==="incorrect"&&Ge("span",{children:"\u2717 Incorrect"})]})]})}import{jsx as X,jsxs as de,Fragment as wr}from"react/jsx-runtime";import{useCallback as si,useEffect as ii,useRef as ci,useState as vr}from"react";import{Play as li,Lock as di,Check as Vt,X as wo}from"lucide-react";function ot(e,r){if(e===r)return!0;if(e===null||r===null||typeof e!=typeof r||typeof e!="object")return!1;let t=Array.isArray(e),n=Array.isArray(r);if(t!==n)return!1;if(t&&n){let c=e,l=r;return c.length!==l.length?!1:c.every((d,m)=>ot(d,l[m]))}let o=e,a=r,s=Object.keys(o),i=Object.keys(a);return s.length!==i.length?!1:s.every(c=>ot(o[c],a[c]))}var Us=`
3
3
  "use strict";
4
4
 
5
5
  // Capture console output for stdio mode
@@ -36,17 +36,17 @@ self.onmessage = async function(e) {
36
36
  self.postMessage({ testId, passed: false, stderr: String(err), errored: true, durationMs: Date.now() - start });
37
37
  }
38
38
  };
39
- `;async function bs(e,r,t,n,a,o,s,i,c){return new Promise(d=>{let l=new Blob([gs],{type:"text/javascript"}),p=URL.createObjectURL(l),x=new Worker(p),f=setTimeout(()=>{x.terminate(),URL.revokeObjectURL(p),d({testId:n,passed:!1,stderr:`Execution timed out after ${c}ms`,errored:!0})},c);x.onmessage=y=>{clearTimeout(f),x.terminate(),URL.revokeObjectURL(p);let u=y.data;if(r==="function"&&!u.errored){let g=Zr(u.actual,o);d({testId:n,passed:g,actual:u.actual,stderr:u.stderr,durationMs:u.durationMs})}else d({testId:n,passed:u.passed??!1,actualStdout:u.actualStdout,stderr:u.stderr,durationMs:u.durationMs,errored:u.errored})},x.onerror=y=>{clearTimeout(f),x.terminate(),URL.revokeObjectURL(p),d({testId:n,passed:!1,stderr:y.message,errored:!0})},x.postMessage({testId:n,source:e,mode:r,entryFunction:t,args:a,expectedStdout:i,timeout:c})})}var ys="0.27.7";function xs(){let e=globalThis.EDPIRE_PYODIDE_INDEX_URL;return typeof e=="string"&&e?e.endsWith("/")?e:e+"/":`https://cdn.jsdelivr.net/pyodide/v${globalThis.EDPIRE_PYODIDE_VERSION||ys}/full/`}var gr=null;function vs(e){return typeof globalThis.loadPyodide=="function"?Promise.resolve():gr||(gr=new Promise((r,t)=>{if(typeof document>"u"){t(new Error("Pyodide can only be loaded in a browser environment"));return}let n=document.createElement("script");n.src=`${e}pyodide.js`,n.async=!0,n.onload=()=>r(),n.onerror=()=>{gr=null,t(new Error(`Failed to load Pyodide from ${n.src}`))},document.head.appendChild(n)}),gr)}var Jr=null;async function ws(){if(Jr)return Jr;let e=xs();await vs(e);let r=globalThis.loadPyodide;if(typeof r!="function")throw new Error("Pyodide global not available after loading the CDN script");return Jr=await r({indexURL:e}),Jr}async function ks(e,r,t,n,a,o,s,i,c){let d=Date.now();try{let l=await ws();if(r==="stdio"){l.runPython(`
39
+ `;async function Hs(e,r,t,n,o,a,s,i,c){return new Promise(l=>{let d=new Blob([Us],{type:"text/javascript"}),m=URL.createObjectURL(d),y=new Worker(m),b=setTimeout(()=>{y.terminate(),URL.revokeObjectURL(m),l({testId:n,passed:!1,stderr:`Execution timed out after ${c}ms`,errored:!0})},c);y.onmessage=S=>{clearTimeout(b),y.terminate(),URL.revokeObjectURL(m);let f=S.data;if(r==="function"&&!f.errored){let g=ot(f.actual,a);l({testId:n,passed:g,actual:f.actual,stderr:f.stderr,durationMs:f.durationMs})}else l({testId:n,passed:f.passed??!1,actualStdout:f.actualStdout,stderr:f.stderr,durationMs:f.durationMs,errored:f.errored})},y.onerror=S=>{clearTimeout(b),y.terminate(),URL.revokeObjectURL(m),l({testId:n,passed:!1,stderr:S.message,errored:!0})},y.postMessage({testId:n,source:e,mode:r,entryFunction:t,args:o,expectedStdout:i,timeout:c})})}var Vs="0.27.7";function Qs(){let e=globalThis.EDPIRE_PYODIDE_INDEX_URL;return typeof e=="string"&&e?e.endsWith("/")?e:e+"/":`https://cdn.jsdelivr.net/pyodide/v${globalThis.EDPIRE_PYODIDE_VERSION||Vs}/full/`}var yr=null;function Gs(e){return typeof globalThis.loadPyodide=="function"?Promise.resolve():yr||(yr=new Promise((r,t)=>{if(typeof document>"u"){t(new Error("Pyodide can only be loaded in a browser environment"));return}let n=document.createElement("script");n.src=`${e}pyodide.js`,n.async=!0,n.onload=()=>r(),n.onerror=()=>{yr=null,t(new Error(`Failed to load Pyodide from ${n.src}`))},document.head.appendChild(n)}),yr)}var tt=null;async function Ys(){if(tt)return tt;let e=Qs();await Gs(e);let r=globalThis.loadPyodide;if(typeof r!="function")throw new Error("Pyodide global not available after loading the CDN script");return tt=await r({indexURL:e}),tt}async function Ks(e,r,t,n,o,a,s,i,c){let l=Date.now();try{let d=await Ys();if(r==="stdio"){d.runPython(`
40
40
  import sys, io
41
41
  _stdout_capture = io.StringIO()
42
42
  sys.stdout = _stdout_capture
43
- `),s&&l.runPython(`
43
+ `),s&&d.runPython(`
44
44
  import io
45
45
  sys.stdin = io.StringIO(${JSON.stringify(s)})
46
- `),l.runPython(e);let p=l.runPython("_stdout_capture.getvalue()");l.runPython("sys.stdout = sys.__stdout__");let x=p.trim()===(i||"").trim();return{testId:n,passed:x,actualStdout:p,durationMs:Date.now()-d}}else{l.runPython(e);let p=(a||[]).map(y=>JSON.stringify(y)).join(", "),x=l.runPython(`${t}(${p})`),f=Zr(x,o);return{testId:n,passed:f,actual:x,durationMs:Date.now()-d}}}catch(l){return{testId:n,passed:!1,stderr:String(l),errored:!0,durationMs:Date.now()-d}}}var Xr=null;async function Rs(){if(Xr)return Xr;let e=await import("./sql-wasm-browser-NICPVFVD.mjs");return Xr=await(e.default??e)(),Xr}async function Ss(e,r,t,n){let a=Date.now();try{let o=await Rs(),s=new o.Database;t&&s.run(t);let c=s.exec(e).flatMap(l=>l.values.map(p=>p.map(String).join("|"))).join(`
47
- `),d=c.trim()===(n||"").trim();return s.close(),{testId:r,passed:d,actualStdout:c,durationMs:Date.now()-a}}catch(o){return{testId:r,passed:!1,stderr:String(o),errored:!0,durationMs:Date.now()-a}}}async function _s(e){let{transform:r}=await import("./esm-RQP7AIMT.mjs");return r(e,{transforms:["typescript"]}).code}var sr=class{supports(r){return["javascript","typescript","python","sql"].includes(r)}async run(r){let{language:t,source:n,mode:a,entryFunction:o,tests:s,timeoutMs:i=5e3}=r;if(!this.supports(t))return s.map(l=>({testId:l.id,passed:!1,stderr:`Language "${t}" cannot run in-browser. Configure a RemoteExecutor for compiled languages.`,errored:!0}));let c=n;if(t==="typescript")try{c=await _s(n)}catch(l){return s.map(p=>({testId:p.id,passed:!1,stderr:`TypeScript compile error: ${l.message}`,errored:!0}))}let d=[];for(let l of s){let p;t==="python"?p=await ks(c,a,o,l.id,l.args,l.expectedReturn,l.stdin,l.expectedStdout,i):t==="sql"?p=await Ss(c,l.id,l.stdin,l.expectedStdout):p=await bs(c,a,o,l.id,l.args,l.expectedReturn,l.stdin,l.expectedStdout,i),d.push(p)}return d}};import{jsx as oa}from"react/jsx-runtime";import{forwardRef as Ns,useEffect as As,useImperativeHandle as Cs,useRef as Ps,useState as Es}from"react";function Ms(e){return{javascript:"javascript",typescript:"typescript",python:"python",sql:"sql",java:"java",cpp:"cpp",go:"go"}[e]??"plaintext"}var Tt=Ns(function({value:r,onChange:t,language:n="javascript",readOnly:a=!1,readOnlyRanges:o,placeholder:s,height:i=300,className:c,autoFocus:d},l){let[p,x]=Es(null),{scale:f}=Ne(),y=Ps(null);As(()=>{import("./dist-RXTJ74FF.mjs").then(h=>{x(()=>h.default)}).catch(()=>{})},[]),Cs(l,()=>({getValue(){return y.current?.getValue?.()??r},focus(){y.current?.focus?.()},insert(h){let P=y.current;if(!P)return;let b=P.getSelection();P.executeEdits("insert",[{range:b,text:h,forceMoveMarkers:!0}])}}));function u(h){y.current=h,d&&h.focus(),o?.length&&h.onDidAttemptReadOnlyEdit(()=>{})}function g(h){t(h??"")}let R=typeof i=="number"?i*f:i;return p?oa(p,{className:c,height:R,language:Ms(n),value:r,onChange:g,onMount:u,options:{readOnly:a,minimap:{enabled:!1},fontSize:14*f,lineNumbers:"on",scrollBeyondLastLine:!1,automaticLayout:!0,tabSize:2,wordWrap:"on"}}):oa("textarea",{className:c,value:r,onChange:h=>t(h.target.value),readOnly:a,placeholder:s,style:{width:"100%",height:typeof i=="number"?E(i):i,fontFamily:"monospace",fontSize:E(14),padding:E("0.5rem"),border:"1px solid #e2e8f0",borderRadius:E("0.375rem"),resize:"vertical",background:a?"#f8fafc":"white",boxSizing:"border-box"},autoFocus:d})});var Ds=new sr;function Fs(e){return e?.showFeedback?e.state??"idle":"idle"}function sa(e){let r={};for(let t of e.attrs.starters??[])r[t.language]=t.code;return r}function js({sample:e,result:r,mode:t}){let n=r?.passed,a=r?.errored,o=r!==void 0,s=o?a?"var(--almost, #c8810e)":n?"var(--ok, #1f8a4c)":"var(--pen, #d23b2b)":"var(--ink-faint, #8d93a0)",i=o?a?"\u26A0":null:"\u25CB";return pe("div",{style:{padding:`${E("0.5rem")} ${E("0.75rem")}`,borderBottom:"1px solid var(--line, #e7e5e0)",fontSize:E("0.8125rem"),fontFamily:"var(--font-mono, ui-monospace, monospace)"},children:[pe("div",{style:{display:"flex",alignItems:"center",gap:E("0.5rem")},children:[X("span",{style:{color:s,fontWeight:700,fontSize:E("0.875rem"),display:"inline-flex"},children:i??(n?X($t,{size:15,style:ee(15)}):X(ia,{size:15}))}),X("span",{style:{fontWeight:600,color:"var(--ink, #1d2025)"},children:e.name??`Test ${e.id}`})]}),o&&!n&&pe("div",{style:{marginTop:E("0.25rem"),paddingLeft:E("1.5rem")},children:[t==="function"?X(yr,{children:r?.actual!==void 0&&pe("div",{style:{color:"var(--ink-soft, #565b66)"},children:[X("span",{style:{color:"var(--ink-faint, #8d93a0)"},children:"got: "}),X("span",{style:{color:"var(--pen, #d23b2b)"},children:JSON.stringify(r.actual)}),X("span",{style:{color:"var(--ink-faint, #8d93a0)"},children:" expected: "}),X("span",{style:{color:"var(--ok, #1f8a4c)"},children:JSON.stringify(e.expectedReturn)})]})}):X(yr,{children:r?.actualStdout!==void 0&&pe("div",{style:{color:"var(--ink-soft, #565b66)"},children:[pe("div",{children:[X("span",{style:{color:"var(--ink-faint, #8d93a0)"},children:"got: "}),X("span",{style:{color:"var(--pen, #d23b2b)",whiteSpace:"pre-wrap"},children:r.actualStdout||"(empty)"})]}),pe("div",{children:[X("span",{style:{color:"var(--ink-faint, #8d93a0)"},children:"expected: "}),X("span",{style:{color:"var(--ok, #1f8a4c)",whiteSpace:"pre-wrap"},children:e.expectedStdout||"(empty)"})]})]})}),r?.stderr&&X("div",{style:{color:"var(--almost-ink, #8a5a08)",marginTop:E("0.125rem"),whiteSpace:"pre-wrap"},children:r.stderr})]})]})}function jr({node:e,validationFeedback:r,readOnly:t=!1,executor:n=Ds,gradingTests:a}){let o=de(),s=Ts(null),{attrs:i}=e,c=e.id,[d,l]=br(i.defaultLanguage),[p,x]=br(()=>sa(e)),[f,y]=br([]),[u,g]=br(!1),[R,h]=br(!1),P=p[d]??"",b=Fs(r);Ls(()=>{let _=W=>{let z=W.answers?.find(O=>O.nodeId===c&&O.type==="codingResponse");z?.answer&&(z.answer.language&&l(z.answer.language),z.answer.sourceByLanguage&&x(z.answer.sourceByLanguage),z.answer.testResults&&y(z.answer.testResults))},I=()=>{x(sa(e)),y([]),h(!1)};return o.on("answers:prefill",_),o.on("answers:reset",I),()=>{o.off("answers:prefill",_),o.off("answers:reset",I)}},[o,c,e]);let k=Is((_,I,W)=>{o.emit({type:"answer:changed",answer:{nodeId:c,type:"codingResponse",timestamp:Date.now(),answer:{language:_,sourceByLanguage:I,source:I[_]??"",testResults:W}}})},[o,c]),A=_=>{let I={...p,[d]:_};x(I),k(d,I,f)},C=_=>{l(_),y([]),k(_,p,[])},$=async()=>{if(u)return;g(!0),y([]);let _=a??i.visibleSamples??[];if(_.length===0){g(!1);return}try{let I=await n.run({language:d,source:P,mode:i.testMode,entryFunction:i.entryFunction,tests:_,timeoutMs:5e3});y(I),k(d,p,I)}catch(I){let W=_.map(z=>({testId:z.id,passed:!1,stderr:String(I),errored:!0}));y(W),k(d,p,W)}finally{g(!1)}},v=()=>{R||(h(!0),k(d,p,f))},m=(a??[]).filter(_=>_.hidden).length,L=m>0?f.filter(_=>(a??[]).find(W=>W.id===_.testId)?.hidden&&_.passed).length:0,T=a?a.filter(_=>!_.hidden):i.visibleSamples??[],q=b==="correct"?"var(--ok, #1f8a4c)":b==="partial"?"var(--almost, #c8810e)":b==="incorrect"?"var(--pen, #d23b2b)":"var(--line-strong, #d6d3cc)";return pe("div",{style:{margin:`${E("0.75rem")} 0`,border:`1px solid ${q}`,borderRadius:E("0.875rem"),overflow:"hidden",transition:"border-color 0.2s"},children:[pe("div",{style:{background:"var(--ui-muted, #f5f4f1)",borderBottom:"1px solid var(--line, #e7e5e0)",padding:`${E("0.5rem")} ${E("0.75rem")}`,display:"flex",alignItems:"center",gap:E("0.5rem"),flexWrap:"wrap"},children:[X("div",{style:{display:"flex",gap:E("0.25rem")},children:i.languages.map(_=>X("button",{onClick:()=>!t&&C(_),disabled:t,style:{padding:`${E("0.2rem")} ${E("0.6rem")}`,borderRadius:E("0.375rem"),border:"1px solid",borderColor:d===_?"var(--ink, #1d2025)":"var(--line, #e7e5e0)",background:d===_?"var(--ink, #1d2025)":"var(--card, #fff)",color:d===_?"#fff":"var(--ink-soft, #565b66)",fontSize:E("0.75rem"),fontWeight:600,cursor:t?"default":"pointer",fontFamily:"var(--font-mono, ui-monospace, monospace)"},children:_},_))}),X("div",{style:{flex:1}}),X(Me,{hint:i.hint}),!t&&pe(yr,{children:[pe("button",{onClick:$,disabled:u,style:{padding:`${E("0.25rem")} ${E("0.75rem")}`,borderRadius:E("0.5rem"),border:"1px solid var(--line-strong, #d6d3cc)",background:u?"var(--ui-muted, #f5f4f1)":"var(--card, #fff)",color:"var(--ink, #1d2025)",fontSize:E("0.8125rem"),fontWeight:600,cursor:u?"not-allowed":"pointer",display:"inline-flex",alignItems:"center",gap:E("0.35rem")},children:[X($s,{size:13,style:ee(13)})," ",u?"Running\u2026":"Run"]}),pe("button",{onClick:v,disabled:R,style:{padding:`${E("0.3rem")} ${E("0.85rem")}`,borderRadius:E("0.5rem"),border:"none",background:R?"var(--ok-soft, #ecf8f0)":"var(--ink, #1d2025)",color:R?"var(--ok, #1f8a4c)":"#fff",fontSize:E("0.8125rem"),fontWeight:600,cursor:R?"default":"pointer",display:"inline-flex",alignItems:"center",gap:E("0.35rem")},children:[R&&X($t,{size:13,style:ee(13)})," ",R?"Submitted":"Submit"]})]})]}),X(Tt,{ref:s,value:P,onChange:A,language:d,readOnly:t,readOnlyRanges:i.starters.find(_=>_.language===d)?.readOnlyRanges,height:320}),(f.length>0||T.length>0)&&pe("div",{style:{borderTop:"1px solid var(--line, #e7e5e0)",background:"var(--paper, #fbfaf7)"},children:[X("div",{style:{padding:`${E("0.5rem")} ${E("0.75rem")}`,fontSize:E("0.7rem"),fontWeight:700,color:"var(--ink-faint, #8d93a0)",textTransform:"uppercase",letterSpacing:"0.05em"},children:"Test Results"}),T.map(_=>X(js,{sample:_,result:f.find(I=>I.testId===_.id),mode:i.testMode},_.id)),m>0&&pe("div",{style:{padding:`${E("0.5rem")} ${E("0.75rem")}`,fontSize:E("0.8125rem"),color:"var(--ink-soft, #565b66)",borderTop:"1px solid var(--line, #e7e5e0)",fontStyle:"italic",display:"flex",alignItems:"center",gap:E("0.4rem")},children:[X(zs,{size:13,style:ee(13)})," Hidden tests: ",L,"/",m," passed"]})]}),r?.showFeedback&&pe("div",{style:{padding:`${E("0.55rem")} ${E("0.75rem")}`,fontSize:E("0.85rem"),fontWeight:600,borderTop:"1px solid var(--line, #e7e5e0)",display:"flex",alignItems:"center",gap:E("0.45rem"),background:b==="correct"?"var(--ok-soft, #ecf8f0)":b==="partial"?"var(--almost-soft, #fbf1dc)":b==="incorrect"?"var(--pen-soft, #fdeeec)":"transparent",color:b==="correct"?"var(--ok, #1f8a4c)":b==="partial"?"var(--almost-ink, #8a5a08)":b==="incorrect"?"var(--pen, #d23b2b)":"var(--ink-soft, #565b66)"},children:[b==="correct"&&pe(yr,{children:[X($t,{size:15,style:ee(15)})," All tests passed"]}),b==="partial"&&"Partial credit",b==="incorrect"&&pe(yr,{children:[X(ia,{size:15,style:ee(15)})," Tests failed"]}),b==="validating"&&"Evaluating\u2026",b==="awaiting_review"&&"Awaiting teacher review",r.score!==void 0&&pe("span",{style:{marginLeft:"auto",fontFamily:'var(--font-hand, "Caveat", cursive)',fontSize:E("1.5rem"),lineHeight:1},children:[r.score," / ",r.maxScore??i.maxScore]})]})]})}import{Fragment as Ws,jsx as Ft,jsxs as qs}from"react/jsx-runtime";import{createContext as Us,useContext as Hs}from"react";import{DndContext as Vs,MouseSensor as Gs,TouchSensor as Qs,KeyboardSensor as Ys,useSensor as jt,useSensors as Ks}from"@dnd-kit/core";import{jsx as zt}from"react/jsx-runtime";import{DragOverlay as Os,useDndContext as Bs}from"@dnd-kit/core";function Dt(){let{active:e}=Bs();if(!e)return null;let r=e.data.current?.html??"";return zt(Os,{dropAnimation:null,children:zt("div",{style:{display:"inline-block",padding:"0.375rem 0.75rem",borderRadius:"9999px",backgroundColor:"white",border:"1px solid #e5e7eb",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",cursor:"grabbing",maxWidth:"20rem"},children:zt("span",{dangerouslySetInnerHTML:{__html:r},style:{pointerEvents:"none",whiteSpace:"nowrap",lineHeight:"1.25"}})})})}var ca=Us(!1);function et({children:e}){let r=Hs(ca),t=jt(Gs,{activationConstraint:{distance:8}}),n=jt(Qs,{activationConstraint:{delay:120,tolerance:8}}),a=jt(Ys),o=Ks(t,n,a);return r?Ft(Ws,{children:e}):Ft(ca.Provider,{value:!0,children:qs(Vs,{sensors:o,children:[e,Ft(Dt,{})]})})}function cr({content:e,onAnswersChange:r,onSubmit:t,answerBus:n,namespace:a,initialAnswers:o,validationFeedback:s,className:i="",locale:c,readOnly:d=!1,mediaHandler:l,codeExecutor:p,display:x}){let f=xe(x),y=Js(()=>_e(f),[f]),u=Xs(null);u.current||(u.current=new ze);let g=n??u.current;rt(()=>{o&&o.length>0&&g.prefillAnswers(o)},[o,g]),rt(()=>{if(!r)return;let h=()=>{let P=g.getAllAnswers();r(P)};return g.on("answer:changed",h),()=>g.off("answer:changed",h)},[g,r]),rt(()=>{if(!t)return;let h=P=>{t(P.answers)};return g.on("answer:submitted",h),()=>g.off("answer:submitted",h)},[g,t]),rt(()=>{document.querySelectorAll("[data-audio]").forEach(P=>{let b=P.querySelector("audio"),k=P.querySelector("svg");!b||!k||(P.onclick=()=>{b.paused?(b.play(),k.innerHTML='<path d="M6 4h4v16H6zm8 0h4v16h-4z"/>',k.dataset.icon="pause"):(b.pause(),k.innerHTML='<path d="M6 4v16l12-8z"/>',k.dataset.icon="play")},b.onended=()=>{k.innerHTML='<path d="M6 4v16l12-8z"/>',k.dataset.icon="play"})})},[e]);let R=Se(e,s,{readOnly:d,mediaHandler:l,codeExecutor:p});return ir(fr,{locale:c,children:ir(ve,{display:f,children:ir(Ar,{bus:g,children:ir(et,{children:ir(Vr,{initialAnswers:o,children:ir("div",{className:`question-runtime ${i}${y.sizeSet?" edp-scaled":""}`,"data-namespace":a,style:{fontSize:E("1.125rem"),lineHeight:"1.75",...Ae(y)},children:R})})})})})})}import{jsx as Ot,jsxs as la}from"react/jsx-runtime";import{useCallback as Zs,useMemo as ei,useRef as ri}from"react";function tt({exercise:e,onAnswersChange:r,validationFeedback:t,renderSharedContext:n,renderQuestion:a,renderSeparator:o,className:s="",locale:i,display:c}){let d=xe(c),l=ei(()=>_e(d),[d]),p=ri(new Map),x=Zs((y,u)=>{if(p.current.set(y,u),r){let g={exerciseId:e.id,questionAnswers:e.questions.map(R=>({questionId:R.id,answers:p.current.get(R.id)??[]}))};r(g)}},[e,r]),f=e.sharedContext?Ot("div",{className:"exercise-shared-context",children:Se(e.sharedContext)}):null;return Ot(ve,{display:d,children:la("div",{className:`exercise-runtime ${s}`,style:Ae(l),children:[f&&(n?n(f):f),e.questions.map((y,u)=>{let g=t?.get(y.id),R=Ot(cr,{content:y.content,onAnswersChange:h=>x(y.id,h),validationFeedback:g,locale:i},y.id);return la("div",{children:[a?a(y,R,u):R,o&&u<e.questions.length-1?o(u):null]},y.id)})]})})}import{jsx as Bt,jsxs as ti}from"react/jsx-runtime";import{useCallback as ni,useEffect as ai,useMemo as oi,useRef as si}from"react";function De({assessment:e,onAnswersChange:r,validationFeedback:t,renderExercise:n,renderSharedContext:a,renderSeparator:o,className:s="",brandingConfig:i,locale:c,display:d}){let l=si(new Map),p=xe(d),x=oi(()=>_e(p),[p]);ai(()=>{if(!i?.fontUrl)return;let u=`edpire-brand-font-${i.fontUrl.replace(/\W/g,"").slice(-24)}`;if(document.getElementById(u))return;let g=document.createElement("link");g.id=u,g.rel="stylesheet",g.href=i.fontUrl,document.head.appendChild(g)},[i?.fontUrl]);let f={...Ae(x)};i?.fontFamily&&(f["--brand-font"]=i.fontFamily);let y=ni(u=>{if(l.current.set(u.exerciseId,u),r){let g={exerciseAnswers:e.exercises.map(R=>l.current.get(R.id)??{exerciseId:R.id,questionAnswers:[]})};r(g)}},[e,r]);return Bt(ve,{display:p,children:Bt("div",{className:`assessment-runtime ${s}`,style:Object.keys(f).length?f:void 0,children:e.exercises.map((u,g)=>{let R=t?.get(u.id),h=Bt(tt,{exercise:u,onAnswersChange:y,validationFeedback:R,renderSharedContext:a?P=>a(P,u):void 0,locale:c},u.id);return ti("div",{children:[n?n(u,h,g):h,o&&g<e.exercises.length-1?o(g):null]},u.id)})})})}import{jsx as zp}from"react/jsx-runtime";import{useMemo as Fp}from"react";import{jsx as xr,Fragment as da,jsxs as nt}from"react/jsx-runtime";import{useMemo as ii}from"react";function lr({item:e,className:r,renderFigureLabel:t,display:n}){let a=xe(n),o=ii(()=>_e(a),[a]);return xr(ve,{display:a,children:nt("div",{className:`annex-item-view ${r??""}${o.sizeSet?" edp-scaled":""}`,style:Ae(o),children:[e.type==="text-document"&&nt(da,{children:[e.title&&xr("h3",{className:"text-base font-semibold mb-2",children:e.title}),Se(e.content)]}),e.type==="figure"&&nt("figure",{children:[Se(e.content),xr("figcaption",{children:t?t(e.label):xr("span",{children:e.label})})]}),e.type==="rich-block"&&nt(da,{children:[e.title&&xr("h3",{className:"text-base font-semibold mb-2",children:e.title}),Se(e.content)]})]})})}import{jsx as Qp,jsxs as Yp}from"react/jsx-runtime";import{useState as Jp}from"react";import{jsx as nm,jsxs as am}from"react/jsx-runtime";import{useState as sm,useCallback as im,useMemo as cm}from"react";import{useEditor as dm,EditorContent as pm}from"@tiptap/react";import um from"@tiptap/starter-kit";import{jsx as bm,jsxs as ym,Fragment as xm}from"react/jsx-runtime";import{useMemo as wm,useState as km}from"react";function Xe(e,{insertAt:r}={}){if(!e||typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",r==="top"&&t.firstChild?t.insertBefore(n,t.firstChild):t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}Xe(`:root{--ink: #1d2025;--ink-soft: #565b66;--ink-faint: #8d93a0;--ui-muted: #f5f4f1;--line: #e7e5e0;--line-strong: #d6d3cc;--ok: #1f8a4c;--ok-soft: #ecf8f0;--pen: #d23b2b;--pen-soft: #fdeeec;--almost: #c8810e;--almost-ink: #8a5a08;--almost-soft: #fbf1dc;--font-hand: "Caveat", cursive}@keyframes answer-shake{10%,90%{transform:translate(-2px)}20%,80%{transform:translate(4px)}30%,50%,70%{transform:translate(-6px)}40%,60%{transform:translate(6px)}}@keyframes hop{0%,to{transform:translateY(0) scale(1)}40%{transform:translateY(-6%) scale(1.05)}}@keyframes wobble{0%,to{transform:translate(0)}15%,85%{transform:translate(-4px)}30%,70%{transform:translate(4px)}45%,55%{transform:translate(-2px)}}.animate-shake{animation:answer-shake .4s both}.animate-hop{animation:hop .5s ease-out}.animate-wobble{animation:wobble .5s ease}.cs-player__grid{display:grid;gap:calc(.75rem * var(--edp-scale, 1));grid-template-columns:repeat(1,minmax(0,1fr))}@media(min-width:40rem){:where(.cs-player:not(.cs-player--box)) .cs-player__grid--row{grid-template-columns:repeat(2,minmax(0,1fr))}}.cs-player--box{container-type:inline-size}@container (min-width: 35.5em){.cs-player--box .cs-player__grid--row{grid-template-columns:repeat(2,minmax(0,1fr))}}.player-choice{position:relative;display:inline-flex;align-items:center;gap:calc(.75rem * var(--edp-scale, 1));flex-wrap:wrap;width:100%;padding:calc(.75rem * var(--edp-scale, 1)) calc(1rem * var(--edp-scale, 1));border:1.5px solid var(--line, #e7e5e0);border-radius:calc(.75rem * var(--edp-scale, 1));background-color:#fff;color:var(--ink, #1d2025);cursor:pointer;user-select:none;transition:border-color .15s ease,background-color .15s ease,box-shadow .15s ease;font-weight:500;text-align:start}.player-choice:hover:not(:disabled){background-color:var(--ui-muted, #f5f4f1);border-color:var(--line-strong, #d6d3cc)}.player-choice:disabled{cursor:default}.player-choice>img{flex-shrink:0}.player-choice__mark{flex:none;display:grid;place-items:center;width:calc(20px * var(--edp-scale, 1));height:calc(20px * var(--edp-scale, 1));border:1.5px solid var(--ink-faint, #8d93a0);background:#fff;color:#fff;transition:border-color .15s,background .15s}.player-choice__mark--radio{border-radius:999px}.player-choice__mark--box{border-radius:calc(6px * var(--edp-scale, 1))}.player-choice__mark>svg{width:calc(13px * var(--edp-scale, 1));height:calc(13px * var(--edp-scale, 1));opacity:0}.player-choice__text{flex:1;min-width:0}.player-choice{height:100%}.player-choice__text img,.player-choice__text video,.player-choice__text iframe{max-height:calc(120px * var(--edp-scale, 1));width:auto;max-width:100%}.player-choice--tile{flex-direction:column;align-items:center;justify-content:center;text-align:center;gap:calc(.5rem * var(--edp-scale, 1));padding:calc(1rem * var(--edp-scale, 1)) calc(.75rem * var(--edp-scale, 1))}.player-choice--tile .player-choice__mark{position:absolute;top:calc(.5rem * var(--edp-scale, 1));inset-inline-start:calc(.5rem * var(--edp-scale, 1))}.player-choice--tile .player-choice__text{flex:0 1 auto;width:100%;text-align:center}.player-choice--tile .player-choice__text img,.player-choice--tile .player-choice__text video,.player-choice--tile .player-choice__text iframe{display:block!important;margin-inline:auto;margin-bottom:calc(.4rem * var(--edp-scale, 1))}.player-choice--selected{background-color:var(--ui-muted, #f5f4f1);border-color:var(--ink, #1d2025)}.player-choice--selected .player-choice__mark{border-color:var(--ink, #1d2025);background:var(--ink, #1d2025)}.player-choice--selected .player-choice__mark>svg{opacity:1}.player-choice--correct{background-color:var(--ok-soft, #ecf8f0);border-color:var(--ok, #1f8a4c)}.player-choice--correct .player-choice__mark{border-color:var(--ok, #1f8a4c);background:var(--ok, #1f8a4c)}.player-choice--correct .player-choice__mark>svg{opacity:1}.player-choice--correct-unchosen{background-color:#fff;border-color:var(--ok, #1f8a4c);border-style:dashed}.player-choice--correct-unchosen .player-choice__mark{border-color:var(--ok, #1f8a4c)}.player-choice--incorrect{background-color:var(--pen-soft, #fdeeec);border-color:var(--pen, #d23b2b)}.player-choice--incorrect .player-choice__mark{border-color:var(--pen, #d23b2b);background:var(--pen, #d23b2b)}.player-choice--incorrect .player-choice__mark>svg{opacity:1}.player-choice--muted{opacity:.55}.player-choice--partial{background-color:var(--ok-soft, #ecf8f0);border-color:var(--ok, #1f8a4c)}.player-choice--disabled{cursor:default}.player-choice__mark--letter{width:calc(1.625rem * var(--edp-scale, 1));height:calc(1.625rem * var(--edp-scale, 1));color:var(--ink, #1d2025);font-size:.8em;font-weight:700;line-height:1}.player-choice--selected .player-choice__mark--letter,.player-choice--correct .player-choice__mark--letter,.player-choice--incorrect .player-choice__mark--letter{color:#fff}.player-choice--correct-unchosen .player-choice__mark--letter{color:var(--ok, #1f8a4c)}.player-choice__verdict{flex:none;display:grid;place-items:center;margin-inline-start:auto}.player-choice__verdict>svg{width:calc(1.125rem * var(--edp-scale, 1));height:calc(1.125rem * var(--edp-scale, 1))}.player-choice__verdict--correct{color:var(--ok, #1f8a4c)}.player-choice__verdict--incorrect{color:var(--pen, #d23b2b)}.player-choice--tile .player-choice__verdict{position:absolute;top:calc(.5rem * var(--edp-scale, 1));inset-inline-end:calc(.5rem * var(--edp-scale, 1));margin:0}.player-inline-choice{display:inline-flex;align-items:center;gap:calc(.25rem * var(--edp-scale, 1));padding:.05em .55em;border:1.5px solid var(--line-strong, #d6d3cc);border-radius:999px;background:#fff;color:var(--ink, #1d2025);font-size:.9em;line-height:inherit;cursor:pointer;user-select:none;transition:border-color .15s,background .15s}.player-inline-choice:hover:not(:disabled){background:var(--ui-muted, #f5f4f1)}.player-inline-choice:disabled{cursor:default}.player-inline-choice--selected{border-color:var(--ink, #1d2025);background:var(--ui-muted, #f5f4f1)}.player-inline-choice--correct{border-color:var(--ok, #1f8a4c);background:var(--ok-soft, #ecf8f0)}.player-inline-choice--correct-unchosen{border-color:var(--ok, #1f8a4c);border-style:dashed}.player-inline-choice--incorrect{border-color:var(--pen, #d23b2b);background:var(--pen-soft, #fdeeec)}.player-inline-choice--muted{opacity:.55}.player-inline-choice:focus-visible{outline:2px solid var(--ink, #1d2025);outline-offset:2px}.player-blank-input{display:inline-block;min-width:3ch;padding:calc(.25rem * var(--edp-scale, 1)) calc(.5rem * var(--edp-scale, 1));border:none;border-bottom:2px solid var(--line-strong, #d6d3cc);background-color:transparent;font-size:inherit;font-family:inherit;transition:all .2s ease;outline:none}.player-blank-input:focus{border-bottom-color:var(--ink, #1d2025);background-color:var(--ui-muted, #f5f4f1)}.player-blank-input--correct{border-bottom-color:var(--ok, #1f8a4c);background-color:var(--ok-soft, #ecf8f0);color:var(--ok, #1f8a4c)}.player-blank-input--incorrect{border-bottom-color:var(--pen, #d23b2b);background-color:var(--pen-soft, #fdeeec);color:var(--pen, #d23b2b)}.player-blank-input:disabled{opacity:.7;cursor:not-allowed}.player-typed-blank{display:inline-block;min-width:7ch;max-width:100%;padding:0 calc(.25rem * var(--edp-scale, 1));font-weight:600;text-align:center;line-height:1.25;border:1px solid var(--line-strong, #d6d3cc);border-bottom-width:2px;border-radius:calc(2px * var(--edp-scale, 1));background:var(--ui-muted, #f5f4f1);color:var(--ink, #1d2025);outline:none;resize:none;overflow:hidden;vertical-align:middle}.player-typed-blank::placeholder{color:var(--ink-faint, #8d93a0);font-weight:500}.player-typed-blank:focus{border-color:var(--ink, #1d2025)}.player-typed-blank--pending{border-color:var(--ink-faint, #8d93a0);background:var(--card, #ffffff)}.player-typed-blank-feedback{display:inline-block;min-width:2ch;max-width:100%;padding:0 calc(.25rem * var(--edp-scale, 1));font-weight:600;text-align:center;line-height:1.25;border:1px solid var(--line-strong, #d6d3cc);border-bottom-width:2px;border-radius:calc(2px * var(--edp-scale, 1));overflow-x:auto;cursor:default;vertical-align:middle}.player-typed-blank-feedback--correct{border-color:var(--ok, #1f8a4c);background:var(--ok-soft, #ecf8f0);color:var(--ok, #1f8a4c)}.player-typed-blank-feedback--partial{border-color:var(--ok, #1f8a4c);border-style:dashed;background:var(--ok-soft, #ecf8f0);color:var(--ok, #1f8a4c)}.player-typed-blank-feedback--incorrect{border-color:var(--pen, #d23b2b);background:var(--pen-soft, #fdeeec);color:var(--pen, #d23b2b);text-decoration:line-through}.player-typed-blank-spinner{display:inline-block;width:calc(.75rem * var(--edp-scale, 1));height:calc(.75rem * var(--edp-scale, 1));border:2px solid var(--ink-faint, #8d93a0);border-top-color:transparent;border-radius:999px;animation:blank-spin .7s linear infinite}@keyframes blank-spin{to{transform:rotate(360deg)}}.player-blank-reveal{font-weight:700;color:var(--ok, #1f8a4c);font-size:.875em;word-break:break-word;min-width:0}.player-blank-feedback{display:inline-block;font-size:.8em;font-weight:500;line-height:1.3;padding:calc(2px * var(--edp-scale, 1)) calc(8px * var(--edp-scale, 1));border-radius:999px;word-break:break-word;min-width:0;background:var(--ui-muted, #f5f4f1);color:var(--ink-soft, #565b66)}.player-blank-feedback--correct{background:var(--ok-soft, #ecf8f0);color:var(--ok, #1f8a4c)}.player-blank-feedback--incorrect{background:var(--pen-soft, #fdeeec);color:var(--pen, #d23b2b)}.player-blank-hint-btn{width:calc(1rem * var(--edp-scale, 1));height:calc(1rem * var(--edp-scale, 1));border:0;border-radius:999px;background:#fbbf24;color:#fff;font-size:calc(10px * var(--edp-scale, 1));font-weight:700;line-height:1;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;transition:background .12s}.player-blank-hint-btn:hover,.player-blank-hint-btn--pinned{background:#f59e0b}.player-blank-hint-pop{position:absolute;bottom:100%;left:50%;transform:translate(-50%);margin-bottom:calc(.5rem * var(--edp-scale, 1));z-index:9999;min-width:calc(180px * var(--edp-scale, 1));max-width:calc(300px * var(--edp-scale, 1));width:max-content;background:#fffbeb;border:1px solid #fde68a;border-radius:calc(14px * var(--edp-scale, 1));box-shadow:0 8px 24px #92400e2e;padding:calc(.5rem * var(--edp-scale, 1)) calc(.75rem * var(--edp-scale, 1));font-size:calc(.875rem * var(--edp-scale, 1));color:#78350f}.matching-player-hintrow{display:flex;justify-content:flex-start;margin-bottom:calc(.4rem * var(--edp-scale, 1))}.player-choice-blank{display:inline-flex;align-items:center;justify-content:center;min-width:4ch;padding:calc(.1rem * var(--edp-scale, 1)) calc(.5rem * var(--edp-scale, 1));border:2px dashed var(--line-strong, #d6d3cc);border-radius:calc(.5rem * var(--edp-scale, 1));color:var(--ink-faint, #8d93a0);background:transparent;transition:border-color .15s,background .15s,transform .15s,color .15s;vertical-align:middle}.player-choice-blank--target{border-color:var(--ink, #1d2025);background:var(--ui-muted, #f5f4f1)}.player-choice-blank--over{border-style:solid;border-color:var(--ink, #1d2025);background:var(--ui-muted, #f5f4f1);transform:scale(1.05)}.player-choice-blank--filled{border-style:solid;border-color:var(--ink, #1d2025);background:var(--ui-muted, #f5f4f1);color:var(--ink, #1d2025);cursor:pointer}.player-choice-blank--correct,.player-choice-blank--partial{border-style:solid;border-color:var(--ok, #1f8a4c);background:var(--ok-soft, #ecf8f0);color:var(--ok, #1f8a4c)}.player-choice-blank--incorrect{border-style:solid;border-color:var(--pen, #d23b2b);background:var(--pen-soft, #fdeeec);color:var(--pen, #d23b2b)}.player-choice-blank__clear{margin-inline-start:calc(.25rem * var(--edp-scale, 1));opacity:0;font-size:calc(.75rem * var(--edp-scale, 1));line-height:1;transition:opacity .12s}.player-choice-blank--filled:hover .player-choice-blank__clear{opacity:.6}.player-word-bank{margin:calc(1rem * var(--edp-scale, 1)) 0;position:relative;border:1px solid var(--line, #e7e5e0);border-radius:calc(14px * var(--edp-scale, 1));background:var(--ui-muted, #f5f4f1);padding:calc(.75rem * var(--edp-scale, 1)) calc(1rem * var(--edp-scale, 1))}.player-word-bank__label{margin-bottom:calc(.5rem * var(--edp-scale, 1));font-size:.7em;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--ink-soft, #565b66);user-select:none}.player-word-bank__items{display:flex;flex-wrap:wrap;gap:calc(.5rem * var(--edp-scale, 1))}.player-word-bank__items--grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(calc(10rem * var(--edp-scale, 1)),1fr));gap:calc(.5rem * var(--edp-scale, 1))}.player-bank-pill{display:inline-block;padding:calc(.35rem * var(--edp-scale, 1)) calc(.75rem * var(--edp-scale, 1));border:1px solid var(--line-strong, #d6d3cc);border-radius:999px;background:var(--card, #ffffff);color:var(--ink, #1d2025);user-select:none;touch-action:manipulation;cursor:grab;transition:border-color .15s,background .15s,box-shadow .15s}.player-bank-pill:hover{border-color:var(--ink, #1d2025);background:var(--ui-muted, #f5f4f1)}.player-bank-pill--dragging{opacity:.5;cursor:grabbing;box-shadow:0 8px 24px #1d20252e}.exercise-runtime{font-family:var(--brand-font, "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", sans-serif);font-size:calc(1.25rem * var(--edp-scale, 1));line-height:1.6;color:#1f2937}.exercise-runtime input,.exercise-runtime textarea{font-family:inherit}@media(min-width:640px){.exercise-runtime{font-size:calc(1.5rem * var(--edp-scale, 1))}}@media(min-width:768px){.exercise-runtime{font-size:calc(1.5rem * var(--edp-scale, 1))}}@media(min-width:1024px){.exercise-runtime{font-size:calc(2.25rem * var(--edp-scale, 1))}}@media(min-width:1280px){.exercise-runtime{font-size:calc(2.25rem * var(--edp-scale, 1))}}.exercise-runtime :lang(ar),.exercise-runtime [lang=ar],.exercise-runtime [dir=rtl]{direction:rtl;font-family:Arial,Scheherazade New,Amiri,sans-serif;text-align:right}.exercise-runtime p{margin:.5em 0;min-height:1.5em}.exercise-runtime p:empty:after{content:"\\a0";display:inline-block;min-height:1em}.exercise-runtime strong{font-weight:600;color:inherit}.exercise-runtime em{font-style:italic}.exercise-runtime ul,.exercise-runtime ol{list-style:revert;margin-left:calc(1.25rem * var(--edp-scale, 1));padding-left:0}.exercise-runtime img{max-width:100%;height:auto;vertical-align:middle;display:inline-block;margin:0 calc(4px * var(--edp-scale, 1))}.exercise-runtime .inline-math{display:inline-block;vertical-align:middle;margin:0 calc(2px * var(--edp-scale, 1))}.exercise-runtime .math-formula{display:flex;justify-content:center;margin:1em 0}.choice-set-player{margin:calc(1rem * var(--edp-scale, 1)) 0}.choice-set-player__prompt{font-weight:600;margin-bottom:calc(.75rem * var(--edp-scale, 1));color:#374151}.choice-set-player__prompt-hint{margin-left:calc(.5rem * var(--edp-scale, 1));font-size:calc(.875rem * var(--edp-scale, 1));opacity:.7;font-weight:400}.choice-set-player__choices{display:flex;flex-direction:column;gap:calc(.75rem * var(--edp-scale, 1))}.choice-set-player__choices--grid{display:grid;gap:calc(.75rem * var(--edp-scale, 1));grid-template-columns:1fr}@media(min-width:640px){.choice-set-player__choices--grid{grid-template-columns:repeat(2,1fr)}}.choice-set-player--inline{display:inline-flex;align-items:center;gap:calc(.5rem * var(--edp-scale, 1));flex-wrap:wrap}.choice-set-player--inline .player-choice{width:auto;padding:calc(.5rem * var(--edp-scale, 1)) calc(1rem * var(--edp-scale, 1))}.player-choice:focus-visible{outline:2px solid var(--ink, #1d2025);outline-offset:2px}.player-blank-input:focus-visible{outline:2px solid #3b82f6;outline-offset:2px}@media(prefers-contrast:high){.player-choice{border-width:3px}.player-choice--correct{border-color:#15803d}.player-choice--incorrect{border-color:#991b1b}}@media(prefers-reduced-motion:reduce){.animate-shake,.animate-hop,.animate-wobble{animation:none}.player-choice{transition:none}}@media print{.exercise-runtime{font-size:12pt;color:#000}.player-choice{border:1px solid black;background-color:#fff;page-break-inside:avoid}.player-choice--correct:after{content:" \\2713";font-weight:700}.player-choice--incorrect:after{content:" \\2717";font-weight:700}}.matching-player{margin:calc(1rem * var(--edp-scale, 1)) 0}.matching-player-feedback{display:flex;align-items:center;gap:calc(.45rem * var(--edp-scale, 1));margin-top:calc(.6rem * var(--edp-scale, 1));padding:calc(.55rem * var(--edp-scale, 1)) calc(.75rem * var(--edp-scale, 1));border:1px solid var(--line, #e7e5e0);border-radius:calc(.625rem * var(--edp-scale, 1));font-size:calc(.85rem * var(--edp-scale, 1));font-weight:600}.matching-player-feedback--correct{color:var(--ok, #1f8a4c);border-color:var(--ok, #1f8a4c);background:var(--ok-soft, #ecf8f0)}.matching-player-feedback--partial{color:var(--almost-ink, #8a5a08);border-color:var(--almost, #c8810e);background:var(--almost-soft, #fbf1dc)}.matching-player-feedback--incorrect{color:var(--pen, #d23b2b);border-color:var(--pen, #d23b2b);background:var(--pen-soft, #fdeeec)}.matching-player-score{margin-inline-start:auto;font-family:var(--font-hand, "Caveat", cursive);font-size:calc(1.5rem * var(--edp-scale, 1));line-height:1}.matching-player__instruction{display:none}.matching-player__arena{position:relative;display:flex;flex-direction:column;gap:calc(.5rem * var(--edp-scale, 1))}.matching-player__arena--dragging{user-select:none;touch-action:none}.matching-player__svg{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;overflow:visible;z-index:1}.matching-player__columns{display:grid;grid-template-columns:1fr 1fr;gap:calc(5rem * var(--edp-scale, 1));align-items:start;position:relative}.matching-player__column{display:flex;flex-direction:column;gap:calc(.5rem * var(--edp-scale, 1))}.matching-player__item{display:flex;align-items:center;flex-wrap:wrap;gap:calc(.5rem * var(--edp-scale, 1));width:100%;padding:calc(.75rem * var(--edp-scale, 1)) calc(1rem * var(--edp-scale, 1));border:2px solid var(--line, #e7e5e0);border-radius:calc(.625rem * var(--edp-scale, 1));background:var(--card, #ffffff);text-align:left;transition:border-color .15s,background .15s,box-shadow .15s,transform .1s;font-size:inherit;font-family:inherit;color:var(--ink, #1d2025);min-height:calc(52px * var(--edp-scale, 1));user-select:none;-webkit-tap-highlight-color:transparent}.matching-player__item:not(.matching-player__item--disabled){cursor:grab}.matching-player__item:not(.matching-player__item--disabled):active{cursor:grabbing}.matching-player__item:hover:not(.matching-player__item--disabled){border-color:var(--line-strong, #d6d3cc);background:var(--ui-muted, #f5f4f1)}.matching-player__item--selected{border-color:var(--ink, #1d2025)!important;background:var(--ui-muted, #f5f4f1)!important;box-shadow:0 0 0 3px #1d20251f;transform:scale(1.02)}.matching-player__item--available{border-color:var(--ink-faint, #8d93a0);border-style:dashed}.matching-player__item--available:hover{border-color:var(--ink, #1d2025);border-style:solid;background:var(--ui-muted, #f5f4f1)}.matching-player__item--matched{border-width:2px;border-color:var(--ink, #1d2025)}.matching-player__item--matched:hover:not(.matching-player__item--disabled){background:var(--ui-muted, #f5f4f1)}.matching-player__item--correct,.matching-player__item--correct:hover{border-color:var(--ok, #1f8a4c)!important;background:var(--ok-soft, #ecf8f0)!important}.matching-player__item--incorrect,.matching-player__item--incorrect:hover{border-color:var(--pen, #d23b2b)!important;background:var(--pen-soft, #fdeeec)!important}.matching-player__item--disabled{cursor:default;pointer-events:none}.matching-player__item-text{flex:1;min-width:0;line-height:1.4}.matching-player__item-text p{margin:0}.matching-player__pair-num{flex-shrink:0;display:inline-flex;align-items:center;justify-content:center;width:calc(22px * var(--edp-scale, 1));height:calc(22px * var(--edp-scale, 1));border-radius:50%;font-size:calc(.7rem * var(--edp-scale, 1));font-weight:700;line-height:1;background:var(--ink, #1d2025);color:#fff}.matching-player__item--correct .matching-player__pair-num{background:var(--ok, #1f8a4c)}.matching-player__item--incorrect .matching-player__pair-num{background:var(--pen, #d23b2b)}.matching-player__connector{flex-shrink:0;color:var(--ink-faint, #8d93a0);display:flex;align-items:center;transition:color .2s,transform .2s;border-radius:50%}.matching-player__item:hover .matching-player__connector{color:var(--ink, #1d2025);transform:scale(1.25)}.matching-player__connector--left{order:10;margin-left:calc(6px * var(--edp-scale, 1))}.matching-player__connector--right{order:-1;margin-right:calc(6px * var(--edp-scale, 1))}.matching-player__connector svg{width:calc(18px * var(--edp-scale, 1));height:calc(18px * var(--edp-scale, 1))}.matching-player__correct-hint{width:100%;order:20;font-weight:700;color:var(--ok, #1f8a4c);font-size:.82em;line-height:1.4;padding-top:.1em;word-break:break-word}.matching-player__correct-hint p{display:inline;margin:0}.matching-player__item:focus-visible{outline:3px solid var(--ink, #1d2025);outline-offset:2px}.blank-correct-hint{display:inline;font-weight:700;color:var(--ok, #1f8a4c);font-size:.875em;margin-left:.3em;word-break:break-word}@keyframes matching-pulse{0%{opacity:.5}to{opacity:1}}@media(prefers-reduced-motion:reduce){.matching-player__item{transition:none}}@media(max-width:600px){:where(.matching-player:not(.matching-player--box)) .matching-player__columns{gap:calc(1rem * var(--edp-scale, 1))}:where(.matching-player:not(.matching-player--box)) .matching-player__item{padding:calc(.5rem * var(--edp-scale, 1)) calc(.6rem * var(--edp-scale, 1));min-height:calc(44px * var(--edp-scale, 1));font-size:calc(.875rem * var(--edp-scale, 1));gap:calc(.35rem * var(--edp-scale, 1))}.matching-player__item:not(.matching-player__item--disabled){cursor:pointer}.matching-player__item:not(.matching-player__item--disabled):active{cursor:pointer}:where(.matching-player:not(.matching-player--box)) .matching-player__connector svg{width:calc(15px * var(--edp-scale, 1));height:calc(15px * var(--edp-scale, 1))}}.matching-player--box{container-type:inline-size}@container (max-width: 33.3em){.matching-player--box .matching-player__columns{gap:calc(1rem * var(--edp-scale, 1))}.matching-player--box .matching-player__item{padding:calc(.5rem * var(--edp-scale, 1)) calc(.6rem * var(--edp-scale, 1));min-height:calc(44px * var(--edp-scale, 1));font-size:calc(.875rem * var(--edp-scale, 1));gap:calc(.35rem * var(--edp-scale, 1))}.matching-player--box .matching-player__connector svg{width:calc(15px * var(--edp-scale, 1));height:calc(15px * var(--edp-scale, 1))}}.math-response-player{margin:calc(.5rem * var(--edp-scale, 1)) 0}.player-math-field{border:2px solid var(--line, #e7e5e0);border-radius:calc(.625rem * var(--edp-scale, 1));padding:calc(.375rem * var(--edp-scale, 1)) calc(.5rem * var(--edp-scale, 1));background:var(--card, #ffffff);transition:border-color .2s ease,background .2s ease}.player-math-field:focus-within{border-color:var(--ink, #1d2025)}.player-math-field--readonly{background:var(--ui-muted, #f5f4f1)}.player-math-field__input{width:100%;min-height:calc(2.5rem * var(--edp-scale, 1));font-size:calc(1.1rem * var(--edp-scale, 1));outline:none;--primary: var(--ink, #1d2025);--caret-color: var(--ink, #1d2025);--selection-background-color: var(--ink-soft, #565b66);--contains-highlight-background-color: var(--ui-muted, #f5f4f1)}.player-math-field__input::part(virtual-keyboard-toggle),.player-math-field__input::part(menu-toggle){color:var(--ink-faint, #8d93a0)}.player-math-field__fallback{width:100%;border:none;outline:none;font-size:calc(1rem * var(--edp-scale, 1));font-family:monospace;background:transparent;color:var(--ink, #1d2025)}.player-math-field--correct{border-color:var(--ok, #1f8a4c);background:var(--ok-soft, #ecf8f0)}.player-math-field--incorrect{border-color:var(--pen, #d23b2b);background:var(--pen-soft, #fdeeec)}.player-math-field--validating{border-color:var(--ink-faint, #8d93a0)}.player-math-feedback{margin-top:calc(.4rem * var(--edp-scale, 1));font-size:calc(.8rem * var(--edp-scale, 1));font-weight:600;display:flex;align-items:center;gap:calc(.4rem * var(--edp-scale, 1))}.player-math-feedback--correct{color:var(--ok, #1f8a4c)}.player-math-feedback--incorrect{color:var(--pen, #d23b2b)}.player-math-feedback--validating{color:var(--ink-soft, #565b66)}.player-math-score{margin-inline-start:auto;font-family:var(--font-hand, "Caveat", cursive);font-size:calc(1.5rem * var(--edp-scale, 1));line-height:1;color:var(--ok, #1f8a4c)}.player-math-spinner{display:inline-block;width:calc(.9rem * var(--edp-scale, 1));height:calc(.9rem * var(--edp-scale, 1));border:2px solid var(--ink-faint, #8d93a0);border-top-color:transparent;border-radius:50%;animation:player-math-spin .7s linear infinite}@keyframes player-math-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.player-math-spinner{animation:none}}.player-ai{margin:calc(1rem * var(--edp-scale, 1)) 0;padding:calc(.5rem * var(--edp-scale, 1));display:flex;flex-direction:column;gap:calc(.75rem * var(--edp-scale, 1));border:1px solid var(--line, #e7e5e0);border-radius:calc(.875rem * var(--edp-scale, 1));background:var(--ui-muted, #f5f4f1)}.player-ai-counts{display:flex;justify-content:flex-end;gap:calc(.5rem * var(--edp-scale, 1))}.player-ai-count{font-size:calc(.75rem * var(--edp-scale, 1));font-weight:600;padding:calc(.1rem * var(--edp-scale, 1)) calc(.5rem * var(--edp-scale, 1));border-radius:999px;background:var(--card, #ffffff);border:1px solid var(--line, #e7e5e0);color:var(--ink-soft, #565b66)}.player-ai-count--over{color:var(--pen, #d23b2b);border-color:var(--pen, #d23b2b)}.player-ai-count--min{color:var(--ink-faint, #8d93a0)}.player-ai-input{width:100%;box-sizing:border-box;padding:calc(.5rem * var(--edp-scale, 1)) calc(.75rem * var(--edp-scale, 1));font-size:calc(1rem * var(--edp-scale, 1));border:1px solid var(--line-strong, #d6d3cc);border-radius:calc(.625rem * var(--edp-scale, 1));background:var(--card, #ffffff);color:var(--ink, #1d2025);outline:none;transition:border-color .2s ease,background .2s ease}.player-ai-input::placeholder{color:var(--ink-faint, #8d93a0)}.player-ai-input:focus{border-color:var(--ink, #1d2025)}.player-ai-input--multiline{min-height:calc(120px * var(--edp-scale, 1));resize:vertical}.player-ai-input:disabled{cursor:default}.player-ai-input--correct{border-color:var(--ok, #1f8a4c);background:var(--ok-soft, #ecf8f0)}.player-ai-input--partial{border-color:var(--almost, #c8810e);border-style:dashed;background:var(--almost-soft, #fbf1dc)}.player-ai-input--incorrect{border-color:var(--pen, #d23b2b);background:var(--pen-soft, #fdeeec)}.player-ai-feedback{display:flex;flex-direction:column;gap:calc(.25rem * var(--edp-scale, 1));padding:calc(.75rem * var(--edp-scale, 1));border-radius:calc(.5rem * var(--edp-scale, 1));font-size:calc(.875rem * var(--edp-scale, 1));border:1px solid var(--line, #e7e5e0);background:var(--card, #ffffff);color:var(--ink, #1d2025)}.player-ai-feedback--correct{border-color:var(--ok, #1f8a4c);background:var(--ok-soft, #ecf8f0);color:var(--ok, #1f8a4c)}.player-ai-feedback--partial{border-color:var(--almost, #c8810e);background:var(--almost-soft, #fbf1dc);color:var(--almost-ink, #8a5a08)}.player-ai-feedback--incorrect{border-color:var(--pen, #d23b2b);background:var(--pen-soft, #fdeeec);color:var(--pen, #d23b2b)}.player-ai-message{margin:0}.player-ai-score-row{display:flex;justify-content:flex-end}.player-ai-score{font-family:var(--font-hand, "Caveat", cursive);font-size:calc(1.5rem * var(--edp-scale, 1));font-weight:600;line-height:1;padding:0 calc(.35rem * var(--edp-scale, 1));color:inherit}.player-ai-validating{display:flex;align-items:center;gap:calc(.5rem * var(--edp-scale, 1));padding:calc(.25rem * var(--edp-scale, 1)) 0;color:var(--ink-soft, #565b66)}.player-ai-spinner{display:inline-block;width:calc(.9rem * var(--edp-scale, 1));height:calc(.9rem * var(--edp-scale, 1));border:2px solid var(--ink-faint, #8d93a0);border-top-color:transparent;border-radius:999px;animation:ai-answer-spin .7s linear infinite}@keyframes ai-answer-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.player-ai-spinner{animation:none}}.player-or-field--pre{border-color:var(--line-strong, #d6d3cc)!important}.player-or-field--correct{border-color:var(--ok, #1f8a4c)!important;background:var(--ok-soft, #ecf8f0)!important}.player-or-field--partial,.player-or-field--review{border-color:var(--almost, #c8810e)!important;background:var(--almost-soft, #fbf1dc)!important}.player-or-field--review{border-style:dashed!important}.player-or-field--incorrect{border-color:var(--pen, #d23b2b)!important;background:var(--pen-soft, #fdeeec)!important}.edp-scaled .text-xs{font-size:calc(.75rem * var(--edp-scale, 1));line-height:calc(1 / .75)}.edp-scaled .text-sm{font-size:calc(.875rem * var(--edp-scale, 1));line-height:calc(1.25 / .875)}.edp-scaled .text-base{font-size:calc(1rem * var(--edp-scale, 1));line-height:1.5}.edp-scaled .text-lg{font-size:calc(1.125rem * var(--edp-scale, 1));line-height:calc(1.75 / 1.125)}.edp-scaled .text-\\[10px\\]{font-size:calc(10px * var(--edp-scale, 1))}.edp-scaled .prose-sm{font-size:calc(.875rem * var(--edp-scale, 1))}.edp-scaled .p-2{padding:calc(.5rem * var(--edp-scale, 1))}.edp-scaled .p-3{padding:calc(.75rem * var(--edp-scale, 1))}.edp-scaled .p-4{padding:calc(1rem * var(--edp-scale, 1))}.edp-scaled .p-6{padding:calc(1.5rem * var(--edp-scale, 1))}.edp-scaled .pb-1{padding-bottom:calc(.25rem * var(--edp-scale, 1))}.edp-scaled .pt-1\\.5{padding-top:calc(.375rem * var(--edp-scale, 1))}.edp-scaled .px-1\\.5{padding-left:calc(.375rem * var(--edp-scale, 1));padding-right:calc(.375rem * var(--edp-scale, 1))}.edp-scaled .px-2{padding-left:calc(.5rem * var(--edp-scale, 1));padding-right:calc(.5rem * var(--edp-scale, 1))}.edp-scaled .px-3{padding-left:calc(.75rem * var(--edp-scale, 1));padding-right:calc(.75rem * var(--edp-scale, 1))}.edp-scaled .px-4{padding-left:calc(1rem * var(--edp-scale, 1));padding-right:calc(1rem * var(--edp-scale, 1))}.edp-scaled .px-5{padding-left:calc(1.25rem * var(--edp-scale, 1));padding-right:calc(1.25rem * var(--edp-scale, 1))}.edp-scaled .px-6{padding-left:calc(1.5rem * var(--edp-scale, 1));padding-right:calc(1.5rem * var(--edp-scale, 1))}.edp-scaled .py-0\\.5{padding-top:calc(.125rem * var(--edp-scale, 1));padding-bottom:calc(.125rem * var(--edp-scale, 1))}.edp-scaled .py-1{padding-top:calc(.25rem * var(--edp-scale, 1));padding-bottom:calc(.25rem * var(--edp-scale, 1))}.edp-scaled .py-1\\.5{padding-top:calc(.375rem * var(--edp-scale, 1));padding-bottom:calc(.375rem * var(--edp-scale, 1))}.edp-scaled .py-2{padding-top:calc(.5rem * var(--edp-scale, 1));padding-bottom:calc(.5rem * var(--edp-scale, 1))}.edp-scaled .py-3{padding-top:calc(.75rem * var(--edp-scale, 1));padding-bottom:calc(.75rem * var(--edp-scale, 1))}.edp-scaled .mb-1{margin-bottom:calc(.25rem * var(--edp-scale, 1))}.edp-scaled .mb-2{margin-bottom:calc(.5rem * var(--edp-scale, 1))}.edp-scaled .ml-1{margin-left:calc(.25rem * var(--edp-scale, 1))}.edp-scaled .ml-2{margin-left:calc(.5rem * var(--edp-scale, 1))}.edp-scaled .mr-2{margin-right:calc(.5rem * var(--edp-scale, 1))}.edp-scaled .mt-0\\.5{margin-top:calc(.125rem * var(--edp-scale, 1))}.edp-scaled .mt-1{margin-top:calc(.25rem * var(--edp-scale, 1))}.edp-scaled .mt-1\\.5{margin-top:calc(.375rem * var(--edp-scale, 1))}.edp-scaled .mt-3{margin-top:calc(.75rem * var(--edp-scale, 1))}.edp-scaled .mx-1{margin-left:calc(.25rem * var(--edp-scale, 1));margin-right:calc(.25rem * var(--edp-scale, 1))}.edp-scaled .my-3{margin-top:calc(.75rem * var(--edp-scale, 1));margin-bottom:calc(.75rem * var(--edp-scale, 1))}.edp-scaled .my-4{margin-top:calc(1rem * var(--edp-scale, 1));margin-bottom:calc(1rem * var(--edp-scale, 1))}.edp-scaled .gap-1{gap:calc(.25rem * var(--edp-scale, 1))}.edp-scaled .gap-1\\.5{gap:calc(.375rem * var(--edp-scale, 1))}.edp-scaled .gap-2{gap:calc(.5rem * var(--edp-scale, 1))}.edp-scaled .gap-3{gap:calc(.75rem * var(--edp-scale, 1))}.edp-scaled .gap-x-1{column-gap:calc(.25rem * var(--edp-scale, 1))}.edp-scaled .gap-y-0\\.5{row-gap:calc(.125rem * var(--edp-scale, 1))}.edp-scaled .w-6{width:calc(1.5rem * var(--edp-scale, 1))}.edp-scaled .w-16{width:calc(4rem * var(--edp-scale, 1))}.edp-scaled .h-6{height:calc(1.5rem * var(--edp-scale, 1))}.edp-scaled .h-8{height:calc(2rem * var(--edp-scale, 1))}.edp-scaled .h-16{height:calc(4rem * var(--edp-scale, 1))}.edp-scaled .max-h-48{max-height:calc(12rem * var(--edp-scale, 1))}.edp-scaled .right-1{right:calc(.25rem * var(--edp-scale, 1))}.edp-scaled .right-3{right:calc(.75rem * var(--edp-scale, 1))}.edp-scaled .bottom-2{bottom:calc(.5rem * var(--edp-scale, 1))}.edp-scaled .max-w-\\[160px\\]{max-width:calc(160px * var(--edp-scale, 1))}.edp-scaled .max-w-\\[200px\\]{max-width:calc(200px * var(--edp-scale, 1))}.edp-scaled .max-w-\\[240px\\]{max-width:calc(240px * var(--edp-scale, 1))}.edp-scaled .min-h-\\[100px\\]{min-height:calc(100px * var(--edp-scale, 1))}.edp-scaled .min-h-\\[120px\\]{min-height:calc(120px * var(--edp-scale, 1))}.edp-scaled .\\[\\&_\\.ProseMirror\\]\\:min-h-\\[80px\\] .ProseMirror{min-height:calc(80px * var(--edp-scale, 1))}.math-inline,.math-block,.math-response-player,.katex,.katex-display{direction:ltr;unicode-bidi:isolate}
48
- `);import"katex/dist/katex.min.css";Xe(`/*! tailwindcss v4.2.0 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){.edpire-scope *,.edpire-scope :before,.edpire-scope :after,.edpire-scope ::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial;--tw-content:""}}}@layer theme{.edpire-scope{--font-sans:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-red-200:oklch(88.5% .062 18.334);--color-red-300:oklch(80.8% .114 19.571);--color-red-950:oklch(25.8% .092 26.042);--color-amber-50:oklch(98.7% .022 95.277);--color-amber-200:oklch(92.4% .12 95.746);--color-amber-900:oklch(41.4% .112 45.904);--color-blue-600:oklch(54.6% .245 262.881);--color-rose-500:oklch(64.5% .246 16.439);--color-slate-500:oklch(55.4% .046 257.417);--color-slate-800:oklch(27.9% .041 260.031);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-800:oklch(27.8% .033 256.848);--color-gray-900:oklch(21% .034 264.665);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-xs:20rem;--container-sm:24rem;--container-3xl:48rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--font-weight-black:900;--tracking-tight:-.025em;--tracking-wide:.025em;--tracking-wider:.05em;--tracking-widest:.1em;--leading-snug:1.375;--leading-relaxed:1.625;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--ease-out:cubic-bezier(0, 0, .2, 1);--ease-in-out:cubic-bezier(.4, 0, .2, 1);--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--blur-sm:8px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1)}}.edpire-scope .\\@container{container-type:inline-size}.edpire-scope .pointer-events-none{pointer-events:none}.edpire-scope .collapse{visibility:collapse}.edpire-scope .invisible{visibility:hidden}.edpire-scope .visible{visibility:visible}.edpire-scope .absolute{position:absolute}.edpire-scope .fixed{position:fixed}.edpire-scope .relative{position:relative}.edpire-scope .static{position:static}.edpire-scope .sticky{position:sticky}.edpire-scope .inset-0{inset:calc(var(--spacing) * 0)}.edpire-scope .start{inset-inline-start:var(--spacing)}.edpire-scope .end{inset-inline-end:var(--spacing)}.edpire-scope .end-2{inset-inline-end:calc(var(--spacing) * 2)}.edpire-scope .end-3{inset-inline-end:calc(var(--spacing) * 3)}.edpire-scope .top-0{top:calc(var(--spacing) * 0)}.edpire-scope .top-1\\/2{top:50%}.edpire-scope .top-2{top:calc(var(--spacing) * 2)}.edpire-scope .top-4{top:calc(var(--spacing) * 4)}.edpire-scope .right-1{right:calc(var(--spacing) * 1)}.edpire-scope .right-3{right:calc(var(--spacing) * 3)}.edpire-scope .bottom-2{bottom:calc(var(--spacing) * 2)}.edpire-scope .left-0{left:calc(var(--spacing) * 0)}.edpire-scope .left-2{left:calc(var(--spacing) * 2)}.edpire-scope .isolate{isolation:isolate}.edpire-scope .z-10{z-index:10}.edpire-scope .z-20{z-index:20}.edpire-scope .z-30{z-index:30}.edpire-scope .z-40{z-index:40}.edpire-scope .z-50{z-index:50}.edpire-scope .z-\\[60\\]{z-index:60}.edpire-scope .container{width:100%}@media(min-width:40rem){.edpire-scope .container{max-width:40rem}}@media(min-width:48rem){.edpire-scope .container{max-width:48rem}}@media(min-width:64rem){.edpire-scope .container{max-width:64rem}}@media(min-width:80rem){.edpire-scope .container{max-width:80rem}}@media(min-width:96rem){.edpire-scope .container{max-width:96rem}}.edpire-scope .mx-1{margin-inline:calc(var(--spacing) * 1)}.edpire-scope .mx-4{margin-inline:calc(var(--spacing) * 4)}.edpire-scope .mx-auto{margin-inline:auto}.edpire-scope .my-1{margin-block:calc(var(--spacing) * 1)}.edpire-scope .my-3{margin-block:calc(var(--spacing) * 3)}.edpire-scope .my-4{margin-block:calc(var(--spacing) * 4)}.edpire-scope .ms-2{margin-inline-start:calc(var(--spacing) * 2)}.edpire-scope .ms-auto{margin-inline-start:auto}.edpire-scope .mt-0\\.5{margin-top:calc(var(--spacing) * .5)}.edpire-scope .mt-1{margin-top:calc(var(--spacing) * 1)}.edpire-scope .mt-1\\.5{margin-top:calc(var(--spacing) * 1.5)}.edpire-scope .mt-2{margin-top:calc(var(--spacing) * 2)}.edpire-scope .mt-3{margin-top:calc(var(--spacing) * 3)}.edpire-scope .mt-px{margin-top:1px}.edpire-scope .mr-2{margin-right:calc(var(--spacing) * 2)}.edpire-scope .mb-1{margin-bottom:calc(var(--spacing) * 1)}.edpire-scope .mb-2{margin-bottom:calc(var(--spacing) * 2)}.edpire-scope .mb-3{margin-bottom:calc(var(--spacing) * 3)}.edpire-scope .mb-5{margin-bottom:calc(var(--spacing) * 5)}.edpire-scope .ml-1{margin-left:calc(var(--spacing) * 1)}.edpire-scope .ml-2{margin-left:calc(var(--spacing) * 2)}.edpire-scope .ml-auto{margin-left:auto}.edpire-scope .block{display:block}.edpire-scope .contents{display:contents}.edpire-scope .flex{display:flex}.edpire-scope .grid{display:grid}.edpire-scope .hidden{display:none}.edpire-scope .inline{display:inline}.edpire-scope .inline-block{display:inline-block}.edpire-scope .inline-flex{display:inline-flex}.edpire-scope .table{display:table}.edpire-scope .h-2{height:calc(var(--spacing) * 2)}.edpire-scope .h-3{height:calc(var(--spacing) * 3)}.edpire-scope .h-4{height:calc(var(--spacing) * 4)}.edpire-scope .h-5{height:calc(var(--spacing) * 5)}.edpire-scope .h-6{height:calc(var(--spacing) * 6)}.edpire-scope .h-7{height:calc(var(--spacing) * 7)}.edpire-scope .h-8{height:calc(var(--spacing) * 8)}.edpire-scope .h-9{height:calc(var(--spacing) * 9)}.edpire-scope .h-11{height:calc(var(--spacing) * 11)}.edpire-scope .h-16{height:calc(var(--spacing) * 16)}.edpire-scope .h-24{height:calc(var(--spacing) * 24)}.edpire-scope .h-\\[600px\\]{height:600px}.edpire-scope .h-dvh{height:100dvh}.edpire-scope .h-full{height:100%}.edpire-scope .h-screen{height:100vh}.edpire-scope .max-h-48{max-height:calc(var(--spacing) * 48)}.edpire-scope .max-h-\\[calc\\(100svh-6rem\\)\\]{max-height:calc(100svh - 6rem)}.edpire-scope .max-h-\\[calc\\(100vh-8rem\\)\\]{max-height:calc(100vh - 8rem)}.edpire-scope .min-h-0{min-height:calc(var(--spacing) * 0)}.edpire-scope .min-h-\\[72px\\]{min-height:72px}.edpire-scope .min-h-\\[100px\\]{min-height:100px}.edpire-scope .min-h-\\[120px\\]{min-height:120px}.edpire-scope .min-h-\\[200px\\]{min-height:200px}.edpire-scope .w-3{width:calc(var(--spacing) * 3)}.edpire-scope .w-4{width:calc(var(--spacing) * 4)}.edpire-scope .w-5{width:calc(var(--spacing) * 5)}.edpire-scope .w-6{width:calc(var(--spacing) * 6)}.edpire-scope .w-7{width:calc(var(--spacing) * 7)}.edpire-scope .w-9{width:calc(var(--spacing) * 9)}.edpire-scope .w-11{width:calc(var(--spacing) * 11)}.edpire-scope .w-12{width:calc(var(--spacing) * 12)}.edpire-scope .w-16{width:calc(var(--spacing) * 16)}.edpire-scope .w-24{width:calc(var(--spacing) * 24)}.edpire-scope .w-\\[88\\%\\]{width:88%}.edpire-scope .w-full{width:100%}.edpire-scope .w-px{width:1px}.edpire-scope .max-w-3xl{max-width:var(--container-3xl)}.edpire-scope .max-w-\\[32ch\\]{max-width:32ch}.edpire-scope .max-w-\\[160px\\]{max-width:160px}.edpire-scope .max-w-\\[200px\\]{max-width:200px}.edpire-scope .max-w-\\[240px\\]{max-width:240px}.edpire-scope .max-w-full{max-width:100%}.edpire-scope .max-w-none{max-width:none}.edpire-scope .max-w-sm{max-width:var(--container-sm)}.edpire-scope .max-w-xs{max-width:var(--container-xs)}.edpire-scope .min-w-0{min-width:calc(var(--spacing) * 0)}.edpire-scope .min-w-\\[80px\\]{min-width:80px}.edpire-scope .min-w-\\[140px\\]{min-width:140px}.edpire-scope .flex-1{flex:1}.edpire-scope .flex-none{flex:none}.edpire-scope .flex-shrink-0,.edpire-scope .shrink-0{flex-shrink:0}.edpire-scope .grow{flex-grow:1}.edpire-scope .-translate-x-\\[110\\%\\]{--tw-translate-x: -110% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.edpire-scope .translate-x-0{--tw-translate-x:calc(var(--spacing) * 0);translate:var(--tw-translate-x) var(--tw-translate-y)}.edpire-scope .-translate-y-1\\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.edpire-scope .transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.edpire-scope .animate-pulse{animation:var(--animate-pulse)}.edpire-scope .animate-spin{animation:var(--animate-spin)}.edpire-scope .cursor-default{cursor:default}.edpire-scope .cursor-pointer{cursor:pointer}.edpire-scope .resize{resize:both}.edpire-scope .flex-col{flex-direction:column}.edpire-scope .flex-wrap{flex-wrap:wrap}.edpire-scope .items-baseline{align-items:baseline}.edpire-scope .items-center{align-items:center}.edpire-scope .items-start{align-items:flex-start}.edpire-scope .justify-between{justify-content:space-between}.edpire-scope .justify-center{justify-content:center}.edpire-scope .justify-end{justify-content:flex-end}.edpire-scope .gap-0\\.5{gap:calc(var(--spacing) * .5)}.edpire-scope .gap-1{gap:calc(var(--spacing) * 1)}.edpire-scope .gap-1\\.5{gap:calc(var(--spacing) * 1.5)}.edpire-scope .gap-2{gap:calc(var(--spacing) * 2)}.edpire-scope .gap-2\\.5{gap:calc(var(--spacing) * 2.5)}.edpire-scope .gap-3{gap:calc(var(--spacing) * 3)}.edpire-scope .gap-4{gap:calc(var(--spacing) * 4)}.edpire-scope .gap-5{gap:calc(var(--spacing) * 5)}.edpire-scope .gap-6{gap:calc(var(--spacing) * 6)}.edpire-scope :where(.edpire-scope .space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1) * calc(1 - var(--tw-space-y-reverse)))}.edpire-scope :where(.edpire-scope .space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}.edpire-scope :where(.edpire-scope .space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}.edpire-scope .gap-x-1{column-gap:calc(var(--spacing) * 1)}.edpire-scope .gap-y-0\\.5{row-gap:calc(var(--spacing) * .5)}.edpire-scope .self-stretch{align-self:stretch}.edpire-scope .truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.edpire-scope .overflow-hidden{overflow:hidden}.edpire-scope .overflow-y-auto{overflow-y:auto}.edpire-scope .rounded{border-radius:.25rem}.edpire-scope .rounded-2xl{border-radius:var(--radius-2xl)}.edpire-scope .rounded-\\[14px\\]{border-radius:14px}.edpire-scope .rounded-full{border-radius:3.40282e38px}.edpire-scope .rounded-lg{border-radius:var(--radius-lg)}.edpire-scope .rounded-md{border-radius:var(--radius-md)}.edpire-scope .rounded-xl{border-radius:var(--radius-xl)}.edpire-scope .rounded-e-lg{border-start-end-radius:var(--radius-lg);border-end-end-radius:var(--radius-lg)}.edpire-scope .rounded-t{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.edpire-scope .border{border-style:var(--tw-border-style);border-width:1px}.edpire-scope .border-2{border-style:var(--tw-border-style);border-width:2px}.edpire-scope .border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.edpire-scope .border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.edpire-scope .border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.edpire-scope .border-dashed{--tw-border-style:dashed;border-style:dashed}.edpire-scope .border-\\[\\#c5e8d1\\]{border-color:#c5e8d1}.edpire-scope .border-\\[\\#d6d3cc\\]{border-color:#d6d3cc}.edpire-scope .border-\\[\\#e7e5e0\\]{border-color:#e7e5e0}.edpire-scope .border-\\[\\#f2e2bf\\]{border-color:#f2e2bf}.edpire-scope .border-\\[\\#f6cfc9\\]{border-color:#f6cfc9}.edpire-scope .border-amber-200{border-color:var(--color-amber-200)}.edpire-scope .border-gray-100{border-color:var(--color-gray-100)}.edpire-scope .border-gray-200{border-color:var(--color-gray-200)}.edpire-scope .border-gray-300{border-color:var(--color-gray-300)}.edpire-scope .bg-\\[\\#1d2025\\]{background-color:#1d2025}.edpire-scope .bg-\\[\\#e7e5e0\\]{background-color:#e7e5e0}.edpire-scope .bg-\\[\\#ecf8f0\\]{background-color:#ecf8f0}.edpire-scope .bg-\\[\\#f1efe9\\]{background-color:#f1efe9}.edpire-scope .bg-\\[\\#f2e2bf\\]{background-color:#f2e2bf}.edpire-scope .bg-\\[\\#f5f4f1\\]{background-color:#f5f4f1}.edpire-scope .bg-\\[\\#fbf1dc\\]{background-color:#fbf1dc}.edpire-scope .bg-\\[\\#fbfaf7\\]{background-color:#fbfaf7}.edpire-scope .bg-\\[\\#fdeeec\\]{background-color:#fdeeec}.edpire-scope .bg-amber-50{background-color:var(--color-amber-50)}.edpire-scope .bg-black{background-color:var(--color-black)}.edpire-scope .bg-black\\/25{background-color:#00000040}@supports (color:color-mix(in lab,red,red)){.edpire-scope .bg-black\\/25{background-color:color-mix(in oklab,var(--color-black) 25%,transparent)}}.edpire-scope .bg-black\\/40{background-color:#0006}@supports (color:color-mix(in lab,red,red)){.edpire-scope .bg-black\\/40{background-color:color-mix(in oklab,var(--color-black) 40%,transparent)}}.edpire-scope .bg-gray-50{background-color:var(--color-gray-50)}.edpire-scope .bg-gray-100{background-color:var(--color-gray-100)}.edpire-scope .bg-gray-300{background-color:var(--color-gray-300)}.edpire-scope .bg-gray-900{background-color:var(--color-gray-900)}.edpire-scope .bg-red-950\\/80{background-color:#460809cc}@supports (color:color-mix(in lab,red,red)){.edpire-scope .bg-red-950\\/80{background-color:color-mix(in oklab,var(--color-red-950) 80%,transparent)}}.edpire-scope .bg-white{background-color:var(--color-white)}.edpire-scope .bg-white\\/60{background-color:#fff9}@supports (color:color-mix(in lab,red,red)){.edpire-scope .bg-white\\/60{background-color:color-mix(in oklab,var(--color-white) 60%,transparent)}}.edpire-scope .object-contain{object-fit:contain}.edpire-scope .object-cover{object-fit:cover}.edpire-scope .p-1{padding:calc(var(--spacing) * 1)}.edpire-scope .p-1\\.5{padding:calc(var(--spacing) * 1.5)}.edpire-scope .p-2{padding:calc(var(--spacing) * 2)}.edpire-scope .p-3{padding:calc(var(--spacing) * 3)}.edpire-scope .p-4{padding:calc(var(--spacing) * 4)}.edpire-scope .p-6{padding:calc(var(--spacing) * 6)}.edpire-scope .px-1\\.5{padding-inline:calc(var(--spacing) * 1.5)}.edpire-scope .px-2{padding-inline:calc(var(--spacing) * 2)}.edpire-scope .px-2\\.5{padding-inline:calc(var(--spacing) * 2.5)}.edpire-scope .px-3{padding-inline:calc(var(--spacing) * 3)}.edpire-scope .px-3\\.5{padding-inline:calc(var(--spacing) * 3.5)}.edpire-scope .px-4{padding-inline:calc(var(--spacing) * 4)}.edpire-scope .px-5{padding-inline:calc(var(--spacing) * 5)}.edpire-scope .px-6{padding-inline:calc(var(--spacing) * 6)}.edpire-scope .px-10{padding-inline:calc(var(--spacing) * 10)}.edpire-scope .py-0\\.5{padding-block:calc(var(--spacing) * .5)}.edpire-scope .py-1{padding-block:calc(var(--spacing) * 1)}.edpire-scope .py-1\\.5{padding-block:calc(var(--spacing) * 1.5)}.edpire-scope .py-2{padding-block:calc(var(--spacing) * 2)}.edpire-scope .py-2\\.5{padding-block:calc(var(--spacing) * 2.5)}.edpire-scope .py-3{padding-block:calc(var(--spacing) * 3)}.edpire-scope .py-4{padding-block:calc(var(--spacing) * 4)}.edpire-scope .py-5{padding-block:calc(var(--spacing) * 5)}.edpire-scope .py-8{padding-block:calc(var(--spacing) * 8)}.edpire-scope .ps-2{padding-inline-start:calc(var(--spacing) * 2)}.edpire-scope .pe-2\\.5{padding-inline-end:calc(var(--spacing) * 2.5)}.edpire-scope .pt-1\\.5{padding-top:calc(var(--spacing) * 1.5)}.edpire-scope .pt-2{padding-top:calc(var(--spacing) * 2)}.edpire-scope .pb-1{padding-bottom:calc(var(--spacing) * 1)}.edpire-scope .pb-5{padding-bottom:calc(var(--spacing) * 5)}.edpire-scope .pl-2{padding-left:calc(var(--spacing) * 2)}.edpire-scope .text-center{text-align:center}.edpire-scope .text-right{text-align:right}.edpire-scope .align-middle{vertical-align:middle}.edpire-scope .font-mono{font-family:var(--font-mono)}.edpire-scope .font-sans{font-family:var(--font-sans)}.edpire-scope .text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.edpire-scope .text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.edpire-scope .text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.edpire-scope .text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.edpire-scope .text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.edpire-scope .text-\\[10px\\]{font-size:10px}.edpire-scope .text-\\[11px\\]{font-size:11px}.edpire-scope .text-\\[20px\\]{font-size:20px}.edpire-scope .leading-none{--tw-leading:1;line-height:1}.edpire-scope .leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.edpire-scope .leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.edpire-scope .font-black{--tw-font-weight:var(--font-weight-black);font-weight:var(--font-weight-black)}.edpire-scope .font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.edpire-scope .font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.edpire-scope .font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.edpire-scope .tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.edpire-scope .tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.edpire-scope .tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.edpire-scope .tracking-widest{--tw-tracking:var(--tracking-widest);letter-spacing:var(--tracking-widest)}.edpire-scope .break-words{overflow-wrap:break-word}.edpire-scope .whitespace-pre-wrap{white-space:pre-wrap}.edpire-scope .text-\\[\\#1d2025\\]{color:#1d2025}.edpire-scope .text-\\[\\#1f8a4c\\]{color:#1f8a4c}.edpire-scope .text-\\[\\#8a5a08\\]{color:#8a5a08}.edpire-scope .text-\\[\\#8d93a0\\]{color:#8d93a0}.edpire-scope .text-\\[\\#565b66\\]{color:#565b66}.edpire-scope .text-\\[\\#a32b1e\\]{color:#a32b1e}.edpire-scope .text-\\[\\#c8810e\\]{color:#c8810e}.edpire-scope .text-\\[\\#d23b2b\\]{color:#d23b2b}.edpire-scope .text-amber-900{color:var(--color-amber-900)}.edpire-scope .text-black\\/20{color:#0003}@supports (color:color-mix(in lab,red,red)){.edpire-scope .text-black\\/20{color:color-mix(in oklab,var(--color-black) 20%,transparent)}}.edpire-scope .text-blue-600{color:var(--color-blue-600)}.edpire-scope .text-gray-400{color:var(--color-gray-400)}.edpire-scope .text-gray-500{color:var(--color-gray-500)}.edpire-scope .text-gray-600{color:var(--color-gray-600)}.edpire-scope .text-gray-700{color:var(--color-gray-700)}.edpire-scope .text-gray-800{color:var(--color-gray-800)}.edpire-scope .text-red-200{color:var(--color-red-200)}.edpire-scope .text-red-300{color:var(--color-red-300)}.edpire-scope .text-slate-500{color:var(--color-slate-500)}.edpire-scope .text-slate-800{color:var(--color-slate-800)}.edpire-scope .text-white{color:var(--color-white)}.edpire-scope .capitalize{text-transform:capitalize}.edpire-scope .uppercase{text-transform:uppercase}.edpire-scope .italic{font-style:italic}.edpire-scope .tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.edpire-scope .line-through{text-decoration-line:line-through}.edpire-scope .underline{text-decoration-line:underline}.edpire-scope .opacity-40{opacity:.4}.edpire-scope .opacity-60{opacity:.6}.edpire-scope .opacity-70{opacity:.7}.edpire-scope .shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.edpire-scope .shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.edpire-scope .shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.edpire-scope .shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a), 0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.edpire-scope .outline{outline-style:var(--tw-outline-style);outline-width:1px}.edpire-scope .grayscale{--tw-grayscale:grayscale(100%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.edpire-scope .backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.edpire-scope .transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.edpire-scope .transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.edpire-scope .transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.edpire-scope .transition-shadow{transition-property:box-shadow;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.edpire-scope .transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.edpire-scope .duration-300{--tw-duration:.3s;transition-duration:.3s}.edpire-scope .duration-700{--tw-duration:.7s;transition-duration:.7s}.edpire-scope .ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.edpire-scope .ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.edpire-scope .outline-none{--tw-outline-style:none;outline-style:none}.edpire-scope .select-none{-webkit-user-select:none;user-select:none}.edpire-scope :is(.edpire-scope .group-open\\:rotate-90):is(:where(.group):is([open],.edpire-scope :popover-open,.edpire-scope :open) *){rotate:90deg}@media(hover:hover){.edpire-scope :is(.edpire-scope .group-hover\\:text-\\[\\#1d2025\\]):is(:where(.group):hover *){color:#1d2025}.edpire-scope :is(.edpire-scope .group-hover\\:shadow-md):is(:where(.group):hover *){--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.edpire-scope :is(.edpire-scope .hover\\:border-\\[\\#8d93a0\\]):hover{border-color:#8d93a0}.edpire-scope :is(.edpire-scope .hover\\:bg-\\[\\#31353c\\]):hover{background-color:#31353c}.edpire-scope :is(.edpire-scope .hover\\:bg-\\[\\#e7e5e0\\]):hover{background-color:#e7e5e0}.edpire-scope :is(.edpire-scope .hover\\:bg-\\[\\#f1efe9\\]):hover{background-color:#f1efe9}.edpire-scope :is(.edpire-scope .hover\\:bg-gray-100):hover{background-color:var(--color-gray-100)}.edpire-scope :is(.edpire-scope .hover\\:bg-white):hover{background-color:var(--color-white)}.edpire-scope :is(.edpire-scope .hover\\:text-\\[\\#1d2025\\]):hover{color:#1d2025}.edpire-scope :is(.edpire-scope .hover\\:text-gray-700):hover{color:var(--color-gray-700)}.edpire-scope :is(.edpire-scope .hover\\:text-rose-500):hover{color:var(--color-rose-500)}.edpire-scope :is(.edpire-scope .hover\\:underline):hover{text-decoration-line:underline}}.edpire-scope :is(.edpire-scope .focus\\:outline-none):focus{--tw-outline-style:none;outline-style:none}.edpire-scope :is(.edpire-scope .focus-visible\\:ring-2):focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.edpire-scope :is(.edpire-scope .focus-visible\\:ring-\\[\\#8d93a0\\]):focus-visible{--tw-ring-color:#8d93a0}.edpire-scope :is(.edpire-scope .focus-visible\\:ring-offset-2):focus-visible{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.edpire-scope :is(.edpire-scope .disabled\\:cursor-not-allowed):disabled{cursor:not-allowed}.edpire-scope :is(.edpire-scope .disabled\\:opacity-50):disabled{opacity:.5}@media(min-width:40rem){.edpire-scope .sm\\:block{display:block}.edpire-scope .sm\\:inline-flex{display:inline-flex}.edpire-scope .sm\\:flex-row{flex-direction:row}.edpire-scope .sm\\:items-center{align-items:center}}@container (min-width:72rem){.edpire-scope .\\@6xl\\:flex{display:flex}.edpire-scope .\\@6xl\\:hidden{display:none}}.edpire-scope :is(.edpire-scope .\\[\\&_\\.ProseMirror\\]\\:min-h-\\[80px\\]) .ProseMirror{min-height:80px}.edpire-scope :is(.edpire-scope .\\[\\&_\\.ProseMirror\\]\\:outline-none) .ProseMirror{--tw-outline-style:none;outline-style:none}.edpire-scope :is(.edpire-scope .\\[\\&_\\.ProseMirror_p\\.is-editor-empty\\:first-child\\:\\:before\\]\\:pointer-events-none) .ProseMirror p.is-editor-empty:first-child:before{pointer-events:none}.edpire-scope :is(.edpire-scope .\\[\\&_\\.ProseMirror_p\\.is-editor-empty\\:first-child\\:\\:before\\]\\:float-left) .ProseMirror p.is-editor-empty:first-child:before{float:left}.edpire-scope :is(.edpire-scope .\\[\\&_\\.ProseMirror_p\\.is-editor-empty\\:first-child\\:\\:before\\]\\:h-0) .ProseMirror p.is-editor-empty:first-child:before{height:calc(var(--spacing) * 0)}.edpire-scope :is(.edpire-scope .\\[\\&_\\.ProseMirror_p\\.is-editor-empty\\:first-child\\:\\:before\\]\\:text-gray-400) .ProseMirror p.is-editor-empty:first-child:before{color:var(--color-gray-400)}.edpire-scope :is(.edpire-scope .\\[\\&_\\.ProseMirror_p\\.is-editor-empty\\:first-child\\:\\:before\\]\\:content-\\[attr\\(data-placeholder\\)\\]) .ProseMirror p.is-editor-empty:first-child:before{--tw-content:attr(data-placeholder);content:var(--tw-content)}@layer base{.edpire-scope *,.edpire-scope :after,.edpire-scope :before,.edpire-scope ::backdrop{border-color:var(--color-gray-200,currentColor)}.edpire-scope ::file-selector-button{border-color:var(--color-gray-200,currentColor)}}@supports not (height:100dvh){.edpire-scope .h-dvh{height:100vh}}.edpire-scope :where(span:has(>textarea.player-typed-blank)){line-height:0}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@property --tw-content{syntax:"*";inherits:false;initial-value:""}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}}
49
- `);import{jsx as Wt}from"react/jsx-runtime";var pa=hi.memo(function({content:r,onAnswersChange:t,feedback:n,initialAnswers:a,readOnly:o,className:s,dir:i}){let c=gi(()=>{if(n)return new Map(Object.entries(n))},[n]),d=Wt(cr,{content:r,onAnswersChange:t,initialAnswers:a,validationFeedback:c,readOnly:o,className:s});return Wt("div",{className:"edpire-scope",style:{display:"contents"},children:i?Wt("div",{dir:i,children:d}):d})});import{useEffect as rc,useRef as en}from"react";import La from"react";import{createRoot as Ta}from"react-dom/client";import{useCallback as Pa,useMemo as Yi,useState as Ki}from"react";import{cloneElement as wa,isValidElement as ka,useCallback as dr,useEffect as Yt,useMemo as Fe,useRef as Kt,useState as Te}from"react";import{Send as Ra,Loader2 as Vt,BarChart2 as Sa,CheckCircle2 as Di,XCircle as Fi,RotateCcw as ji,X as Gt,Clock as pr,AlertTriangle as Oi,Check as Bi,CloudOff as Wi}from"lucide-react";import{clsx as bi}from"clsx";import{twMerge as yi}from"tailwind-merge";function be(...e){return yi(bi(e))}import{Fragment as Ri,jsx as ge,jsxs as qt}from"react/jsx-runtime";function xi({accent:e}){return ge("div",{style:{width:48,height:48,borderRadius:"50%",border:`4px solid ${e}33`,borderTopColor:e,animation:"edpire-spin 0.8s linear infinite"}})}function vi({accent:e}){return ge("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[0,1,2].map(r=>ge("div",{style:{width:12,height:12,borderRadius:"50%",background:e,animation:`edpire-bounce 1.2s ease-in-out ${r*.2}s infinite`}},r))})}function wi({accent:e}){return qt("div",{style:{position:"relative",width:48,height:48},children:[[0,1].map(r=>ge("div",{style:{position:"absolute",inset:0,borderRadius:"50%",background:e,opacity:.4,animation:`edpire-pulse 1.6s ease-out ${r*.8}s infinite`}},r)),ge("div",{style:{position:"absolute",inset:"25%",borderRadius:"50%",background:e}})]})}function ki({accent:e}){return ge("div",{style:{display:"flex",gap:4,alignItems:"flex-end",height:40},children:[0,1,2,3].map(r=>ge("div",{style:{width:8,borderRadius:4,background:e,animation:`edpire-bars 1s ease-in-out ${r*.15}s infinite`}},r))})}function ma({visible:e,bgColor:r="rgba(0,0,0,0.55)",accentColor:t="#6366f1",text:n="Evaluating your answers\u2026",aiText:a="Some answers are being reviewed by AI \u2014 this may take a few seconds.",spinnerTheme:o="default",animationUrl:s,hasAiNodes:i=!1,contained:c=!1}){return e?qt(Ri,{children:[ge("style",{children:`
46
+ `),d.runPython(e);let m=d.runPython("_stdout_capture.getvalue()");d.runPython("sys.stdout = sys.__stdout__");let y=m.trim()===(i||"").trim();return{testId:n,passed:y,actualStdout:m,durationMs:Date.now()-l}}else{d.runPython(e);let m=(o||[]).map(S=>JSON.stringify(S)).join(", "),y=d.runPython(`${t}(${m})`),b=ot(y,a);return{testId:n,passed:b,actual:y,durationMs:Date.now()-l}}}catch(d){return{testId:n,passed:!1,stderr:String(d),errored:!0,durationMs:Date.now()-l}}}var nt=null;async function Js(){if(nt)return nt;let e=await import("./sql-wasm-browser-NICPVFVD.mjs");return nt=await(e.default??e)(),nt}async function Xs(e,r,t,n){let o=Date.now();try{let a=await Js(),s=new a.Database;t&&s.run(t);let c=s.exec(e).flatMap(d=>d.values.map(m=>m.map(String).join("|"))).join(`
47
+ `),l=c.trim()===(n||"").trim();return s.close(),{testId:r,passed:l,actualStdout:c,durationMs:Date.now()-o}}catch(a){return{testId:r,passed:!1,stderr:String(a),errored:!0,durationMs:Date.now()-o}}}async function Zs(e){let{transform:r}=await import("./esm-RQP7AIMT.mjs");return r(e,{transforms:["typescript"]}).code}var cr=class{supports(r){return["javascript","typescript","python","sql"].includes(r)}async run(r){let{language:t,source:n,mode:o,entryFunction:a,tests:s,timeoutMs:i=5e3}=r;if(!this.supports(t))return s.map(d=>({testId:d.id,passed:!1,stderr:`Language "${t}" cannot run in-browser. Configure a RemoteExecutor for compiled languages.`,errored:!0}));let c=n;if(t==="typescript")try{c=await Zs(n)}catch(d){return s.map(m=>({testId:m.id,passed:!1,stderr:`TypeScript compile error: ${d.message}`,errored:!0}))}let l=[];for(let d of s){let m;t==="python"?m=await Ks(c,o,a,d.id,d.args,d.expectedReturn,d.stdin,d.expectedStdout,i):t==="sql"?m=await Xs(c,d.id,d.stdin,d.expectedStdout):m=await Hs(c,o,a,d.id,d.args,d.expectedReturn,d.stdin,d.expectedStdout,i),l.push(m)}return l}};import{jsx as yo}from"react/jsx-runtime";import{forwardRef as ei,useEffect as ri,useImperativeHandle as ti,useRef as ni,useState as oi}from"react";function ai(e){return{javascript:"javascript",typescript:"typescript",python:"python",sql:"sql",java:"java",cpp:"cpp",go:"go"}[e]??"plaintext"}var Ht=ei(function({value:r,onChange:t,language:n="javascript",readOnly:o=!1,readOnlyRanges:a,placeholder:s,height:i=300,className:c,autoFocus:l},d){let[m,y]=oi(null),{scale:b}=Pe(),S=ni(null);ri(()=>{import("./dist-RXTJ74FF.mjs").then(h=>{y(()=>h.default)}).catch(()=>{})},[]),ti(d,()=>({getValue(){return S.current?.getValue?.()??r},focus(){S.current?.focus?.()},insert(h){let _=S.current;if(!_)return;let u=_.getSelection();_.executeEdits("insert",[{range:u,text:h,forceMoveMarkers:!0}])}}));function f(h){S.current=h,l&&h.focus(),a?.length&&h.onDidAttemptReadOnlyEdit(()=>{})}function g(h){t(h??"")}let w=typeof i=="number"?i*b:i;return m?yo(m,{className:c,height:w,language:ai(n),value:r,onChange:g,onMount:f,options:{readOnly:o,minimap:{enabled:!1},fontSize:14*b,lineNumbers:"on",scrollBeyondLastLine:!1,automaticLayout:!0,tabSize:2,wordWrap:"on"}}):yo("textarea",{className:c,value:r,onChange:h=>t(h.target.value),readOnly:o,placeholder:s,style:{width:"100%",height:typeof i=="number"?I(i):i,fontFamily:"monospace",fontSize:I(14),padding:I("0.5rem"),border:"1px solid #e2e8f0",borderRadius:I("0.375rem"),resize:"vertical",background:o?"#f8fafc":"white",boxSizing:"border-box"},autoFocus:l})});var pi=new cr;function mi(e){return e?.showFeedback?e.state??"idle":"idle"}function vo(e){let r={};for(let t of e.attrs.starters??[])r[t.language]=t.code;return r}function ui({sample:e,result:r,mode:t}){let n=r?.passed,o=r?.errored,a=r!==void 0,s=a?o?"var(--almost, #c8810e)":n?"var(--ok, #1f8a4c)":"var(--pen, #d23b2b)":"var(--ink-faint, #8d93a0)",i=a?o?"\u26A0":null:"\u25CB";return de("div",{style:{padding:`${I("0.5rem")} ${I("0.75rem")}`,borderBottom:"1px solid var(--line, #e7e5e0)",fontSize:I("0.8125rem"),fontFamily:"var(--font-mono, ui-monospace, monospace)"},children:[de("div",{style:{display:"flex",alignItems:"center",gap:I("0.5rem")},children:[X("span",{style:{color:s,fontWeight:700,fontSize:I("0.875rem"),display:"inline-flex"},children:i??(n?X(Vt,{size:15,style:ee(15)}):X(wo,{size:15}))}),X("span",{style:{fontWeight:600,color:"var(--ink, #1d2025)"},children:e.name??`Test ${e.id}`})]}),a&&!n&&de("div",{style:{marginTop:I("0.25rem"),paddingLeft:I("1.5rem")},children:[t==="function"?X(wr,{children:r?.actual!==void 0&&de("div",{style:{color:"var(--ink-soft, #565b66)"},children:[X("span",{style:{color:"var(--ink-faint, #8d93a0)"},children:"got: "}),X("span",{style:{color:"var(--pen, #d23b2b)"},children:JSON.stringify(r.actual)}),X("span",{style:{color:"var(--ink-faint, #8d93a0)"},children:" expected: "}),X("span",{style:{color:"var(--ok, #1f8a4c)"},children:JSON.stringify(e.expectedReturn)})]})}):X(wr,{children:r?.actualStdout!==void 0&&de("div",{style:{color:"var(--ink-soft, #565b66)"},children:[de("div",{children:[X("span",{style:{color:"var(--ink-faint, #8d93a0)"},children:"got: "}),X("span",{style:{color:"var(--pen, #d23b2b)",whiteSpace:"pre-wrap"},children:r.actualStdout||"(empty)"})]}),de("div",{children:[X("span",{style:{color:"var(--ink-faint, #8d93a0)"},children:"expected: "}),X("span",{style:{color:"var(--ok, #1f8a4c)",whiteSpace:"pre-wrap"},children:e.expectedStdout||"(empty)"})]})]})}),r?.stderr&&X("div",{style:{color:"var(--almost-ink, #8a5a08)",marginTop:I("0.125rem"),whiteSpace:"pre-wrap"},children:r.stderr})]})]})}function Ur({node:e,validationFeedback:r,readOnly:t=!1,executor:n=pi,gradingTests:o}){let a=le(),s=ci(null),{attrs:i}=e,c=e.id,[l,d]=vr(i.defaultLanguage),[m,y]=vr(()=>vo(e)),[b,S]=vr([]),[f,g]=vr(!1),[w,h]=vr(!1),_=m[l]??"",u=mi(r);ii(()=>{let v=F=>{let z=F.answers?.find(O=>O.nodeId===c&&O.type==="codingResponse");z?.answer&&(z.answer.language&&d(z.answer.language),z.answer.sourceByLanguage&&y(z.answer.sourceByLanguage),z.answer.testResults&&S(z.answer.testResults))},M=()=>{y(vo(e)),S([]),h(!1)};return a.on("answers:prefill",v),a.on("answers:reset",M),()=>{a.off("answers:prefill",v),a.off("answers:reset",M)}},[a,c,e]);let x=si((v,M,F)=>{a.emit({type:"answer:changed",answer:{nodeId:c,type:"codingResponse",timestamp:Date.now(),answer:{language:v,sourceByLanguage:M,source:M[v]??"",testResults:F}}})},[a,c]),A=v=>{let M={...m,[l]:v};y(M),x(l,M,b)},E=v=>{d(v),S([]),x(v,m,[])},$=async()=>{if(f)return;g(!0),S([]);let v=o??i.visibleSamples??[];if(v.length===0){g(!1);return}try{let M=await n.run({language:l,source:_,mode:i.testMode,entryFunction:i.entryFunction,tests:v,timeoutMs:5e3});S(M),x(l,m,M)}catch(M){let F=v.map(z=>({testId:z.id,passed:!1,stderr:String(M),errored:!0}));S(F),x(l,m,F)}finally{g(!1)}},k=()=>{w||(h(!0),x(l,m,b))},p=(o??[]).filter(v=>v.hidden).length,T=p>0?b.filter(v=>(o??[]).find(F=>F.id===v.testId)?.hidden&&v.passed).length:0,P=o?o.filter(v=>!v.hidden):i.visibleSamples??[],q=u==="correct"?"var(--ok, #1f8a4c)":u==="partial"?"var(--almost, #c8810e)":u==="incorrect"?"var(--pen, #d23b2b)":"var(--line-strong, #d6d3cc)";return de("div",{style:{margin:`${I("0.75rem")} 0`,border:`1px solid ${q}`,borderRadius:I("0.875rem"),overflow:"hidden",transition:"border-color 0.2s"},children:[de("div",{style:{background:"var(--ui-muted, #f5f4f1)",borderBottom:"1px solid var(--line, #e7e5e0)",padding:`${I("0.5rem")} ${I("0.75rem")}`,display:"flex",alignItems:"center",gap:I("0.5rem"),flexWrap:"wrap"},children:[X("div",{style:{display:"flex",gap:I("0.25rem")},children:i.languages.map(v=>X("button",{onClick:()=>!t&&E(v),disabled:t,style:{padding:`${I("0.2rem")} ${I("0.6rem")}`,borderRadius:I("0.375rem"),border:"1px solid",borderColor:l===v?"var(--ink, #1d2025)":"var(--line, #e7e5e0)",background:l===v?"var(--ink, #1d2025)":"var(--card, #fff)",color:l===v?"#fff":"var(--ink-soft, #565b66)",fontSize:I("0.75rem"),fontWeight:600,cursor:t?"default":"pointer",fontFamily:"var(--font-mono, ui-monospace, monospace)"},children:v},v))}),X("div",{style:{flex:1}}),X($e,{hint:i.hint}),!t&&de(wr,{children:[de("button",{onClick:$,disabled:f,style:{padding:`${I("0.25rem")} ${I("0.75rem")}`,borderRadius:I("0.5rem"),border:"1px solid var(--line-strong, #d6d3cc)",background:f?"var(--ui-muted, #f5f4f1)":"var(--card, #fff)",color:"var(--ink, #1d2025)",fontSize:I("0.8125rem"),fontWeight:600,cursor:f?"not-allowed":"pointer",display:"inline-flex",alignItems:"center",gap:I("0.35rem")},children:[X(li,{size:13,style:ee(13)})," ",f?"Running\u2026":"Run"]}),de("button",{onClick:k,disabled:w,style:{padding:`${I("0.3rem")} ${I("0.85rem")}`,borderRadius:I("0.5rem"),border:"none",background:w?"var(--ok-soft, #ecf8f0)":"var(--ink, #1d2025)",color:w?"var(--ok, #1f8a4c)":"#fff",fontSize:I("0.8125rem"),fontWeight:600,cursor:w?"default":"pointer",display:"inline-flex",alignItems:"center",gap:I("0.35rem")},children:[w&&X(Vt,{size:13,style:ee(13)})," ",w?"Submitted":"Submit"]})]})]}),X(Ht,{ref:s,value:_,onChange:A,language:l,readOnly:t,readOnlyRanges:i.starters.find(v=>v.language===l)?.readOnlyRanges,height:320}),(b.length>0||P.length>0)&&de("div",{style:{borderTop:"1px solid var(--line, #e7e5e0)",background:"var(--paper, #fbfaf7)"},children:[X("div",{style:{padding:`${I("0.5rem")} ${I("0.75rem")}`,fontSize:I("0.7rem"),fontWeight:700,color:"var(--ink-faint, #8d93a0)",textTransform:"uppercase",letterSpacing:"0.05em"},children:"Test Results"}),P.map(v=>X(ui,{sample:v,result:b.find(M=>M.testId===v.id),mode:i.testMode},v.id)),p>0&&de("div",{style:{padding:`${I("0.5rem")} ${I("0.75rem")}`,fontSize:I("0.8125rem"),color:"var(--ink-soft, #565b66)",borderTop:"1px solid var(--line, #e7e5e0)",fontStyle:"italic",display:"flex",alignItems:"center",gap:I("0.4rem")},children:[X(di,{size:13,style:ee(13)})," Hidden tests: ",T,"/",p," passed"]})]}),r?.showFeedback&&de("div",{style:{padding:`${I("0.55rem")} ${I("0.75rem")}`,fontSize:I("0.85rem"),fontWeight:600,borderTop:"1px solid var(--line, #e7e5e0)",display:"flex",alignItems:"center",gap:I("0.45rem"),background:u==="correct"?"var(--ok-soft, #ecf8f0)":u==="partial"?"var(--almost-soft, #fbf1dc)":u==="incorrect"?"var(--pen-soft, #fdeeec)":"transparent",color:u==="correct"?"var(--ok, #1f8a4c)":u==="partial"?"var(--almost-ink, #8a5a08)":u==="incorrect"?"var(--pen, #d23b2b)":"var(--ink-soft, #565b66)"},children:[u==="correct"&&de(wr,{children:[X(Vt,{size:15,style:ee(15)})," All tests passed"]}),u==="partial"&&"Partial credit",u==="incorrect"&&de(wr,{children:[X(wo,{size:15,style:ee(15)})," Tests failed"]}),u==="validating"&&"Evaluating\u2026",u==="awaiting_review"&&"Awaiting teacher review",r.score!==void 0&&de("span",{style:{marginLeft:"auto",fontFamily:'var(--font-hand, "Caveat", cursive)',fontSize:I("1.5rem"),lineHeight:1},children:[r.score," / ",r.maxScore??i.maxScore]})]})]})}import{Fragment as gi,jsx as Yt,jsxs as bi}from"react/jsx-runtime";import{createContext as xi,useContext as yi}from"react";import{DndContext as vi,MouseSensor as wi,TouchSensor as ki,KeyboardSensor as Ri,useSensor as Kt,useSensors as Si}from"@dnd-kit/core";import{jsx as Qt}from"react/jsx-runtime";import{DragOverlay as fi,useDndContext as hi}from"@dnd-kit/core";function Gt(){let{active:e}=hi();if(!e)return null;let r=e.data.current?.html??"";return Qt(fi,{dropAnimation:null,children:Qt("div",{style:{display:"inline-block",padding:"0.375rem 0.75rem",borderRadius:"9999px",backgroundColor:"white",border:"1px solid #e5e7eb",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",cursor:"grabbing",maxWidth:"20rem"},children:Qt("span",{dangerouslySetInnerHTML:{__html:r},style:{pointerEvents:"none",whiteSpace:"nowrap",lineHeight:"1.25"}})})})}var ko=xi(!1);function at({children:e}){let r=yi(ko),t=Kt(wi,{activationConstraint:{distance:8}}),n=Kt(ki,{activationConstraint:{delay:120,tolerance:8}}),o=Kt(Ri),a=Si(t,n,o);return r?Yt(gi,{children:e}):Yt(ko.Provider,{value:!0,children:bi(vi,{sensors:a,children:[e,Yt(Gt,{})]})})}function dr({content:e,onAnswersChange:r,onSubmit:t,answerBus:n,namespace:o,initialAnswers:a,validationFeedback:s,className:i="",locale:c,readOnly:l=!1,mediaHandler:d,codeExecutor:m,display:y}){let b=ye(y),S=_i(()=>ke(b),[b]),f=Ni(null);f.current||(f.current=new Be);let g=n??f.current;st(()=>{a&&a.length>0&&g.prefillAnswers(a)},[a,g]),st(()=>{if(!r)return;let h=()=>{let _=g.getAllAnswers();r(_)};return g.on("answer:changed",h),()=>g.off("answer:changed",h)},[g,r]),st(()=>{if(!t)return;let h=_=>{t(_.answers)};return g.on("answer:submitted",h),()=>g.off("answer:submitted",h)},[g,t]),st(()=>{document.querySelectorAll("[data-audio]").forEach(_=>{let u=_.querySelector("audio"),x=_.querySelector("svg");!u||!x||(_.onclick=()=>{u.paused?(u.play(),x.innerHTML='<path d="M6 4h4v16H6zm8 0h4v16h-4z"/>',x.dataset.icon="pause"):(u.pause(),x.innerHTML='<path d="M6 4v16l12-8z"/>',x.dataset.icon="play")},u.onended=()=>{x.innerHTML='<path d="M6 4v16l12-8z"/>',x.dataset.icon="play"})})},[e]);let w=we(e,s,{readOnly:l,mediaHandler:d,codeExecutor:m});return lr(br,{locale:c,children:lr(ve,{display:b,children:lr(Ir,{bus:g,children:lr(at,{children:lr(Jr,{initialAnswers:a,children:lr("div",{className:`question-runtime ${i}${S.sizeSet?" edp-scaled":""}`,"data-namespace":o,style:{fontSize:I("1.125rem"),lineHeight:"1.75",...Re(S)},children:w})})})})})})}import{jsx as pr,jsxs as lt}from"react/jsx-runtime";import{memo as Pi,useCallback as Ao,useMemo as Mi,useRef as No}from"react";var Ro={words:80,media:1,tableRows:6},Ai=new Set(["resizableImage","resizableVideo","youtubeEmbed"]);function So(e){let r={words:0,media:0,tableRows:0},t=n=>{if(typeof n.text=="string"&&(r.words+=n.text.split(/\s+/).filter(o=>/[\p{L}\p{N}]/u.test(o)).length),n.type&&Ai.has(n.type)&&r.media++,n.type==="table"){let o=(n.content??[]).filter(a=>a.type==="tableRow").length;r.tableRows=Math.max(r.tableRows,o)}for(let o of n.content??[])t(o)};return e&&t(e),r}function kr(e,r=Ro){let t=So(e);return t.words>r.words||t.media>r.media||t.tableRows>r.tableRows}import{createContext as Ci,useContext as Ei}from"react";var _o=Ci(null),it=_o.Provider;function ct(){return Ei(_o)}function dt({exercise:e,onAnswersChange:r,validationFeedback:t,renderSharedContext:n,renderQuestion:o,renderSeparator:a,className:s="",locale:i,display:c}){let l=ye(c),d=Mi(()=>ke(l),[l]),m=No(new Map),y=No({exercise:e,onAnswersChange:r});y.current={exercise:e,onAnswersChange:r};let b=Ao((h,_)=>{m.current.set(h,_);let{exercise:u,onAnswersChange:x}=y.current;if(x){let A={exerciseId:u.id,questionAnswers:u.questions.map(E=>({questionId:E.id,answers:m.current.get(E.id)??[]}))};x(A)}},[]),S=ct(),f=gr(i),g=!!(S&&e.sharedContext&&kr(e.sharedContext)),w=e.sharedContext?g?lt("p",{className:"exercise-reference-cue",children:[pr("span",{children:f.referenceInPanel(S.label)})," ",lt("button",{type:"button",className:"exercise-reference-cue__link",onClick:()=>S.showExerciseReference(e.id),children:[f.readReference,pr("span",{"aria-hidden":"true",className:"exercise-reference-cue__arrow",children:"\u203A"})]})]}):pr("div",{className:"exercise-shared-context",children:we(e.sharedContext)}):null;return pr(ve,{display:l,children:lt("div",{className:`exercise-runtime ${s}`,style:Re(d),children:[w&&(n?n(w):w),e.questions.map((h,_)=>{let u=t?.get(h.id),x=pr(Ii,{questionId:h.id,content:h.content,onQuestionAnswers:b,validationFeedback:u,locale:i},h.id);return lt("div",{children:[o?o(h,x,_):x,a&&_<e.questions.length-1?a(_):null]},h.id)})]})})}var Ii=Pi(function({questionId:r,content:t,onQuestionAnswers:n,validationFeedback:o,locale:a}){let s=Ao(i=>n(r,i),[n,r]);return pr(dr,{content:t,onAnswersChange:s,validationFeedback:o,locale:a})});import{jsx as Jt,jsxs as Li}from"react/jsx-runtime";import{useCallback as Ti,useEffect as $i,useMemo as zi,useRef as Co}from"react";function Ye({assessment:e,onAnswersChange:r,validationFeedback:t,renderExercise:n,renderSharedContext:o,renderSeparator:a,className:s="",brandingConfig:i,locale:c,display:l}){let d=Co(new Map),m=ye(l),y=zi(()=>ke(m),[m]);$i(()=>{if(!i?.fontUrl)return;let g=`edpire-brand-font-${i.fontUrl.replace(/\W/g,"").slice(-24)}`;if(document.getElementById(g))return;let w=document.createElement("link");w.id=g,w.rel="stylesheet",w.href=i.fontUrl,document.head.appendChild(w)},[i?.fontUrl]);let b={...Re(y)};i?.fontFamily&&(b["--brand-font"]=i.fontFamily);let S=Co({assessment:e,onAnswersChange:r});S.current={assessment:e,onAnswersChange:r};let f=Ti(g=>{d.current.set(g.exerciseId,g);let{assessment:w,onAnswersChange:h}=S.current;if(h){let _={exerciseAnswers:w.exercises.map(u=>d.current.get(u.id)??{exerciseId:u.id,questionAnswers:[]})};h(_)}},[]);return Jt(ve,{display:m,children:Jt("div",{className:`assessment-runtime ${s}`,style:Object.keys(b).length?b:void 0,children:e.exercises.map((g,w)=>{let h=t?.get(g.id),_=Jt(dt,{exercise:g,onAnswersChange:f,validationFeedback:h,renderSharedContext:o?u=>o(u,g):void 0,locale:c},g.id);return Li("div",{children:[n?n(g,_,w):_,a&&w<e.exercises.length-1?a(w):null]},g.id)})})})}import{jsx as Eo}from"react/jsx-runtime";import{useMemo as Di}from"react";function pt({content:e,className:r,display:t}){let n=ye(t),o=Di(()=>ke(n),[n]);return Eo(ve,{display:n,children:Eo("div",{className:`content-view ${r??""}`,style:Re(o),children:we(e)})})}import{jsx as Rr,Fragment as Po,jsxs as mt}from"react/jsx-runtime";import{useMemo as Fi}from"react";function Sr({item:e,className:r,renderFigureLabel:t,display:n}){let o=ye(n),a=Fi(()=>ke(o),[o]);return Rr(ve,{display:o,children:mt("div",{className:`annex-item-view ${r??""}${a.sizeSet?" edp-scaled":""}`,style:Re(a),children:[e.type==="text-document"&&mt(Po,{children:[e.title&&Rr("h3",{className:"text-base font-semibold mb-2",children:e.title}),we(e.content)]}),e.type==="figure"&&mt("figure",{children:[we(e.content),Rr("figcaption",{children:t?t(e.label):Rr("span",{children:e.label})})]}),e.type==="rich-block"&&mt(Po,{children:[e.title&&Rr("h3",{className:"text-base font-semibold mb-2",children:e.title}),we(e.content)]})]})})}import{jsx as Mm,jsxs as Im}from"react/jsx-runtime";import{useState as Tm}from"react";import{jsx as jm,jsxs as Bm}from"react/jsx-runtime";import{useState as Wm,useCallback as Um,useMemo as Hm}from"react";import{useEditor as Qm,EditorContent as Gm}from"@tiptap/react";import Km from"@tiptap/starter-kit";import{jsx as eu,jsxs as ru,Fragment as tu}from"react/jsx-runtime";import{useMemo as ou,useState as au}from"react";function rr(e,{insertAt:r}={}){if(!e||typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",r==="top"&&t.firstChild?t.insertBefore(n,t.firstChild):t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}rr(`:root{--ink: #1d2025;--ink-soft: #565b66;--ink-faint: #8d93a0;--ui-muted: #f5f4f1;--line: #e7e5e0;--line-strong: #d6d3cc;--ok: #1f8a4c;--ok-soft: #ecf8f0;--pen: #d23b2b;--pen-soft: #fdeeec;--almost: #c8810e;--almost-ink: #8a5a08;--almost-soft: #fbf1dc;--font-hand: "Caveat", cursive}@keyframes answer-shake{10%,90%{transform:translate(-2px)}20%,80%{transform:translate(4px)}30%,50%,70%{transform:translate(-6px)}40%,60%{transform:translate(6px)}}@keyframes hop{0%,to{transform:translateY(0) scale(1)}40%{transform:translateY(-6%) scale(1.05)}}@keyframes wobble{0%,to{transform:translate(0)}15%,85%{transform:translate(-4px)}30%,70%{transform:translate(4px)}45%,55%{transform:translate(-2px)}}.animate-shake{animation:answer-shake .4s both}.animate-hop{animation:hop .5s ease-out}.animate-wobble{animation:wobble .5s ease}.cs-player__grid{display:grid;gap:calc(.75rem * var(--edp-scale, 1));grid-template-columns:repeat(1,minmax(0,1fr))}@media(min-width:40rem){:where(.cs-player:not(.cs-player--box)) .cs-player__grid--row{grid-template-columns:repeat(2,minmax(0,1fr))}}.cs-player--box{container-type:inline-size}@container (min-width: 35.5em){.cs-player--box .cs-player__grid--row{grid-template-columns:repeat(2,minmax(0,1fr))}}.player-choice{position:relative;display:inline-flex;align-items:center;gap:calc(.75rem * var(--edp-scale, 1));flex-wrap:wrap;width:100%;padding:calc(.75rem * var(--edp-scale, 1)) calc(1rem * var(--edp-scale, 1));border:1.5px solid var(--line, #e7e5e0);border-radius:calc(.75rem * var(--edp-scale, 1));background-color:#fff;color:var(--ink, #1d2025);cursor:pointer;user-select:none;transition:border-color .15s ease,background-color .15s ease,box-shadow .15s ease;font-weight:500;text-align:start}.player-choice:hover:not(:disabled){background-color:var(--ui-muted, #f5f4f1);border-color:var(--line-strong, #d6d3cc)}.player-choice:disabled{cursor:default}.player-choice>img{flex-shrink:0}.player-choice__mark{flex:none;display:grid;place-items:center;width:calc(20px * var(--edp-scale, 1));height:calc(20px * var(--edp-scale, 1));border:1.5px solid var(--ink-faint, #8d93a0);background:#fff;color:#fff;transition:border-color .15s,background .15s}.player-choice__mark--radio{border-radius:999px}.player-choice__mark--box{border-radius:calc(6px * var(--edp-scale, 1))}.player-choice__mark>svg{width:calc(13px * var(--edp-scale, 1));height:calc(13px * var(--edp-scale, 1));opacity:0}.player-choice__text{flex:1;min-width:0}.player-choice{height:100%}.player-choice__text img,.player-choice__text video,.player-choice__text iframe{max-height:calc(120px * var(--edp-scale, 1));width:auto;max-width:100%}.player-choice--tile{flex-direction:column;align-items:center;justify-content:center;text-align:center;gap:calc(.5rem * var(--edp-scale, 1));padding:calc(1rem * var(--edp-scale, 1)) calc(.75rem * var(--edp-scale, 1))}.player-choice--tile .player-choice__mark{position:absolute;top:calc(.5rem * var(--edp-scale, 1));inset-inline-start:calc(.5rem * var(--edp-scale, 1))}.player-choice--tile .player-choice__text{flex:0 1 auto;width:100%;text-align:center}.player-choice--tile .player-choice__text img,.player-choice--tile .player-choice__text video,.player-choice--tile .player-choice__text iframe{display:block!important;margin-inline:auto;margin-bottom:calc(.4rem * var(--edp-scale, 1))}.player-choice--selected{background-color:var(--ui-muted, #f5f4f1);border-color:var(--ink, #1d2025)}.player-choice--selected .player-choice__mark{border-color:var(--ink, #1d2025);background:var(--ink, #1d2025)}.player-choice--selected .player-choice__mark>svg{opacity:1}.player-choice--correct{background-color:var(--ok-soft, #ecf8f0);border-color:var(--ok, #1f8a4c)}.player-choice--correct .player-choice__mark{border-color:var(--ok, #1f8a4c);background:var(--ok, #1f8a4c)}.player-choice--correct .player-choice__mark>svg{opacity:1}.player-choice--correct-unchosen{background-color:#fff;border-color:var(--ok, #1f8a4c);border-style:dashed}.player-choice--correct-unchosen .player-choice__mark{border-color:var(--ok, #1f8a4c)}.player-choice--incorrect{background-color:var(--pen-soft, #fdeeec);border-color:var(--pen, #d23b2b)}.player-choice--incorrect .player-choice__mark{border-color:var(--pen, #d23b2b);background:var(--pen, #d23b2b)}.player-choice--incorrect .player-choice__mark>svg{opacity:1}.player-choice--muted{opacity:.55}.player-choice--partial{background-color:var(--ok-soft, #ecf8f0);border-color:var(--ok, #1f8a4c)}.player-choice--disabled{cursor:default}.player-choice__mark--letter{width:calc(1.625rem * var(--edp-scale, 1));height:calc(1.625rem * var(--edp-scale, 1));color:var(--ink, #1d2025);font-size:.8em;font-weight:700;line-height:1}.player-choice--selected .player-choice__mark--letter,.player-choice--correct .player-choice__mark--letter,.player-choice--incorrect .player-choice__mark--letter{color:#fff}.player-choice--correct-unchosen .player-choice__mark--letter{color:var(--ok, #1f8a4c)}.player-choice__verdict{flex:none;display:grid;place-items:center;margin-inline-start:auto}.player-choice__verdict>svg{width:calc(1.125rem * var(--edp-scale, 1));height:calc(1.125rem * var(--edp-scale, 1))}.player-choice__verdict--correct{color:var(--ok, #1f8a4c)}.player-choice__verdict--incorrect{color:var(--pen, #d23b2b)}.player-choice--tile .player-choice__verdict{position:absolute;top:calc(.5rem * var(--edp-scale, 1));inset-inline-end:calc(.5rem * var(--edp-scale, 1));margin:0}.player-inline-choice{display:inline-flex;align-items:center;gap:calc(.25rem * var(--edp-scale, 1));padding:.05em .55em;border:1.5px solid var(--line-strong, #d6d3cc);border-radius:999px;background:#fff;color:var(--ink, #1d2025);font-size:.9em;line-height:inherit;cursor:pointer;user-select:none;transition:border-color .15s,background .15s}.player-inline-choice:hover:not(:disabled){background:var(--ui-muted, #f5f4f1)}.player-inline-choice:disabled{cursor:default}.player-inline-choice--selected{border-color:var(--ink, #1d2025);background:var(--ui-muted, #f5f4f1)}.player-inline-choice--correct{border-color:var(--ok, #1f8a4c);background:var(--ok-soft, #ecf8f0)}.player-inline-choice--correct-unchosen{border-color:var(--ok, #1f8a4c);border-style:dashed}.player-inline-choice--incorrect{border-color:var(--pen, #d23b2b);background:var(--pen-soft, #fdeeec)}.player-inline-choice--muted{opacity:.55}.player-inline-choice:focus-visible{outline:2px solid var(--ink, #1d2025);outline-offset:2px}.player-blank-input{display:inline-block;min-width:3ch;padding:calc(.25rem * var(--edp-scale, 1)) calc(.5rem * var(--edp-scale, 1));border:none;border-bottom:2px solid var(--line-strong, #d6d3cc);background-color:transparent;font-size:inherit;font-family:inherit;transition:all .2s ease;outline:none}.player-blank-input:focus{border-bottom-color:var(--ink, #1d2025);background-color:var(--ui-muted, #f5f4f1)}.player-blank-input--correct{border-bottom-color:var(--ok, #1f8a4c);background-color:var(--ok-soft, #ecf8f0);color:var(--ok, #1f8a4c)}.player-blank-input--incorrect{border-bottom-color:var(--pen, #d23b2b);background-color:var(--pen-soft, #fdeeec);color:var(--pen, #d23b2b)}.player-blank-input:disabled{opacity:.7;cursor:not-allowed}.player-typed-blank{display:inline-block;min-width:7ch;max-width:100%;padding:0 calc(.25rem * var(--edp-scale, 1));font-weight:600;text-align:center;line-height:1.25;border:1px solid var(--line-strong, #d6d3cc);border-bottom-width:2px;border-radius:calc(2px * var(--edp-scale, 1));background:var(--ui-muted, #f5f4f1);color:var(--ink, #1d2025);outline:none;resize:none;overflow:hidden;vertical-align:middle}.player-typed-blank::placeholder{color:var(--ink-faint, #8d93a0);font-weight:500}.player-typed-blank:focus{border-color:var(--ink, #1d2025)}.player-typed-blank--pending{border-color:var(--ink-faint, #8d93a0);background:var(--card, #ffffff)}.player-typed-blank-feedback{display:inline-block;min-width:2ch;max-width:100%;padding:0 calc(.25rem * var(--edp-scale, 1));font-weight:600;text-align:center;line-height:1.25;border:1px solid var(--line-strong, #d6d3cc);border-bottom-width:2px;border-radius:calc(2px * var(--edp-scale, 1));overflow-x:auto;cursor:default;vertical-align:middle}.player-typed-blank-feedback--correct{border-color:var(--ok, #1f8a4c);background:var(--ok-soft, #ecf8f0);color:var(--ok, #1f8a4c)}.player-typed-blank-feedback--partial{border-color:var(--ok, #1f8a4c);border-style:dashed;background:var(--ok-soft, #ecf8f0);color:var(--ok, #1f8a4c)}.player-typed-blank-feedback--incorrect{border-color:var(--pen, #d23b2b);background:var(--pen-soft, #fdeeec);color:var(--pen, #d23b2b);text-decoration:line-through}.player-typed-blank-spinner{display:inline-block;width:calc(.75rem * var(--edp-scale, 1));height:calc(.75rem * var(--edp-scale, 1));border:2px solid var(--ink-faint, #8d93a0);border-top-color:transparent;border-radius:999px;animation:blank-spin .7s linear infinite}@keyframes blank-spin{to{transform:rotate(360deg)}}.player-blank-reveal{font-weight:700;color:var(--ok, #1f8a4c);font-size:.875em;word-break:break-word;min-width:0}.player-blank-feedback{display:inline-block;font-size:.8em;font-weight:500;line-height:1.3;padding:calc(2px * var(--edp-scale, 1)) calc(8px * var(--edp-scale, 1));border-radius:999px;word-break:break-word;min-width:0;background:var(--ui-muted, #f5f4f1);color:var(--ink-soft, #565b66)}.player-blank-feedback--correct{background:var(--ok-soft, #ecf8f0);color:var(--ok, #1f8a4c)}.player-blank-feedback--incorrect{background:var(--pen-soft, #fdeeec);color:var(--pen, #d23b2b)}.player-blank-hint-btn{width:calc(1rem * var(--edp-scale, 1));height:calc(1rem * var(--edp-scale, 1));border:0;border-radius:999px;background:#fbbf24;color:#fff;font-size:calc(10px * var(--edp-scale, 1));font-weight:700;line-height:1;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;transition:background .12s}.player-blank-hint-btn:hover,.player-blank-hint-btn--pinned{background:#f59e0b}.player-blank-hint-pop{position:absolute;bottom:100%;left:50%;transform:translate(-50%);margin-bottom:calc(.5rem * var(--edp-scale, 1));z-index:9999;min-width:calc(180px * var(--edp-scale, 1));max-width:calc(300px * var(--edp-scale, 1));width:max-content;background:#fffbeb;border:1px solid #fde68a;border-radius:calc(14px * var(--edp-scale, 1));box-shadow:0 8px 24px #92400e2e;padding:calc(.5rem * var(--edp-scale, 1)) calc(.75rem * var(--edp-scale, 1));font-size:calc(.875rem * var(--edp-scale, 1));color:#78350f}.matching-player-hintrow{display:flex;justify-content:flex-start;margin-bottom:calc(.4rem * var(--edp-scale, 1))}.player-choice-blank{display:inline-flex;align-items:center;justify-content:center;min-width:4ch;padding:calc(.1rem * var(--edp-scale, 1)) calc(.5rem * var(--edp-scale, 1));border:2px dashed var(--line-strong, #d6d3cc);border-radius:calc(.5rem * var(--edp-scale, 1));color:var(--ink-faint, #8d93a0);background:transparent;transition:border-color .15s,background .15s,transform .15s,color .15s;vertical-align:middle}.player-choice-blank--target{border-color:var(--ink, #1d2025);background:var(--ui-muted, #f5f4f1)}.player-choice-blank--over{border-style:solid;border-color:var(--ink, #1d2025);background:var(--ui-muted, #f5f4f1);transform:scale(1.05)}.player-choice-blank--filled{border-style:solid;border-color:var(--ink, #1d2025);background:var(--ui-muted, #f5f4f1);color:var(--ink, #1d2025);cursor:pointer}.player-choice-blank--correct,.player-choice-blank--partial{border-style:solid;border-color:var(--ok, #1f8a4c);background:var(--ok-soft, #ecf8f0);color:var(--ok, #1f8a4c)}.player-choice-blank--incorrect{border-style:solid;border-color:var(--pen, #d23b2b);background:var(--pen-soft, #fdeeec);color:var(--pen, #d23b2b)}.player-choice-blank__clear{margin-inline-start:calc(.25rem * var(--edp-scale, 1));opacity:0;font-size:calc(.75rem * var(--edp-scale, 1));line-height:1;transition:opacity .12s}.player-choice-blank--filled:hover .player-choice-blank__clear{opacity:.6}.player-word-bank{margin:calc(1rem * var(--edp-scale, 1)) 0;position:relative;border:1px solid var(--line, #e7e5e0);border-radius:calc(14px * var(--edp-scale, 1));background:var(--ui-muted, #f5f4f1);padding:calc(.75rem * var(--edp-scale, 1)) calc(1rem * var(--edp-scale, 1))}.player-word-bank__label{margin-bottom:calc(.5rem * var(--edp-scale, 1));font-size:.7em;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--ink-soft, #565b66);user-select:none}.player-word-bank__items{display:flex;flex-wrap:wrap;gap:calc(.5rem * var(--edp-scale, 1))}.player-word-bank__items--grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(calc(10rem * var(--edp-scale, 1)),1fr));gap:calc(.5rem * var(--edp-scale, 1))}.player-bank-pill{display:inline-block;padding:calc(.35rem * var(--edp-scale, 1)) calc(.75rem * var(--edp-scale, 1));border:1px solid var(--line-strong, #d6d3cc);border-radius:999px;background:var(--card, #ffffff);color:var(--ink, #1d2025);user-select:none;touch-action:manipulation;cursor:grab;transition:border-color .15s,background .15s,box-shadow .15s}.player-bank-pill:hover{border-color:var(--ink, #1d2025);background:var(--ui-muted, #f5f4f1)}.player-bank-pill--dragging{opacity:.5;cursor:grabbing;box-shadow:0 8px 24px #1d20252e}.exercise-runtime{font-family:var(--brand-font, "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", sans-serif);font-size:calc(1.25rem * var(--edp-scale, 1));line-height:1.6;color:#1f2937}.exercise-runtime input,.exercise-runtime textarea{font-family:inherit}@media(min-width:640px){.exercise-runtime{font-size:calc(1.5rem * var(--edp-scale, 1))}}@media(min-width:768px){.exercise-runtime{font-size:calc(1.5rem * var(--edp-scale, 1))}}@media(min-width:1024px){.exercise-runtime{font-size:calc(2.25rem * var(--edp-scale, 1))}}@media(min-width:1280px){.exercise-runtime{font-size:calc(2.25rem * var(--edp-scale, 1))}}.exercise-runtime :lang(ar),.exercise-runtime [lang=ar],.exercise-runtime [dir=rtl]{direction:rtl;font-family:Arial,Scheherazade New,Amiri,sans-serif;text-align:right}.exercise-runtime p{margin:.5em 0;min-height:1.5em}.exercise-runtime p:empty:after{content:"\\a0";display:inline-block;min-height:1em}.exercise-runtime strong{font-weight:600;color:inherit}.exercise-runtime em{font-style:italic}.exercise-runtime ul,.exercise-runtime ol{list-style:revert;margin-left:calc(1.25rem * var(--edp-scale, 1));padding-left:0}.exercise-runtime img{max-width:100%;height:auto;vertical-align:middle;display:inline-block;margin:0 calc(4px * var(--edp-scale, 1))}.exercise-runtime .inline-math{display:inline-block;vertical-align:middle;margin:0 calc(2px * var(--edp-scale, 1))}.exercise-runtime .math-formula{display:flex;justify-content:center;margin:1em 0}.choice-set-player{margin:calc(1rem * var(--edp-scale, 1)) 0}.choice-set-player__prompt{font-weight:600;margin-bottom:calc(.75rem * var(--edp-scale, 1));color:#374151}.choice-set-player__prompt-hint{margin-left:calc(.5rem * var(--edp-scale, 1));font-size:calc(.875rem * var(--edp-scale, 1));opacity:.7;font-weight:400}.choice-set-player__choices{display:flex;flex-direction:column;gap:calc(.75rem * var(--edp-scale, 1))}.choice-set-player__choices--grid{display:grid;gap:calc(.75rem * var(--edp-scale, 1));grid-template-columns:1fr}@media(min-width:640px){.choice-set-player__choices--grid{grid-template-columns:repeat(2,1fr)}}.choice-set-player--inline{display:inline-flex;align-items:center;gap:calc(.5rem * var(--edp-scale, 1));flex-wrap:wrap}.choice-set-player--inline .player-choice{width:auto;padding:calc(.5rem * var(--edp-scale, 1)) calc(1rem * var(--edp-scale, 1))}.player-choice:focus-visible{outline:2px solid var(--ink, #1d2025);outline-offset:2px}.player-blank-input:focus-visible{outline:2px solid #3b82f6;outline-offset:2px}@media(prefers-contrast:high){.player-choice{border-width:3px}.player-choice--correct{border-color:#15803d}.player-choice--incorrect{border-color:#991b1b}}@media(prefers-reduced-motion:reduce){.animate-shake,.animate-hop,.animate-wobble{animation:none}.player-choice{transition:none}}@media print{.exercise-runtime{font-size:12pt;color:#000}.player-choice{border:1px solid black;background-color:#fff;page-break-inside:avoid}.player-choice--correct:after{content:" \\2713";font-weight:700}.player-choice--incorrect:after{content:" \\2717";font-weight:700}}.matching-player{margin:calc(1rem * var(--edp-scale, 1)) 0}.matching-player-feedback{display:flex;align-items:center;gap:calc(.45rem * var(--edp-scale, 1));margin-top:calc(.6rem * var(--edp-scale, 1));padding:calc(.55rem * var(--edp-scale, 1)) calc(.75rem * var(--edp-scale, 1));border:1px solid var(--line, #e7e5e0);border-radius:calc(.625rem * var(--edp-scale, 1));font-size:calc(.85rem * var(--edp-scale, 1));font-weight:600}.matching-player-feedback--correct{color:var(--ok, #1f8a4c);border-color:var(--ok, #1f8a4c);background:var(--ok-soft, #ecf8f0)}.matching-player-feedback--partial{color:var(--almost-ink, #8a5a08);border-color:var(--almost, #c8810e);background:var(--almost-soft, #fbf1dc)}.matching-player-feedback--incorrect{color:var(--pen, #d23b2b);border-color:var(--pen, #d23b2b);background:var(--pen-soft, #fdeeec)}.matching-player-score{margin-inline-start:auto;font-family:var(--font-hand, "Caveat", cursive);font-size:calc(1.5rem * var(--edp-scale, 1));line-height:1}.matching-player__instruction{display:none}.matching-player__arena{position:relative;display:flex;flex-direction:column;gap:calc(.5rem * var(--edp-scale, 1))}.matching-player__arena--dragging{user-select:none;touch-action:none}.matching-player__svg{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;overflow:visible;z-index:1}.matching-player__columns{display:grid;grid-template-columns:1fr 1fr;gap:calc(5rem * var(--edp-scale, 1));align-items:start;position:relative}.matching-player__column{display:flex;flex-direction:column;gap:calc(.5rem * var(--edp-scale, 1))}.matching-player__item{display:flex;align-items:center;flex-wrap:wrap;gap:calc(.5rem * var(--edp-scale, 1));width:100%;padding:calc(.75rem * var(--edp-scale, 1)) calc(1rem * var(--edp-scale, 1));border:2px solid var(--line, #e7e5e0);border-radius:calc(.625rem * var(--edp-scale, 1));background:var(--card, #ffffff);text-align:left;transition:border-color .15s,background .15s,box-shadow .15s,transform .1s;font-size:inherit;font-family:inherit;color:var(--ink, #1d2025);min-height:calc(52px * var(--edp-scale, 1));user-select:none;-webkit-tap-highlight-color:transparent}.matching-player__item:not(.matching-player__item--disabled){cursor:grab}.matching-player__item:not(.matching-player__item--disabled):active{cursor:grabbing}.matching-player__item:hover:not(.matching-player__item--disabled){border-color:var(--line-strong, #d6d3cc);background:var(--ui-muted, #f5f4f1)}.matching-player__item--selected{border-color:var(--ink, #1d2025)!important;background:var(--ui-muted, #f5f4f1)!important;box-shadow:0 0 0 3px #1d20251f;transform:scale(1.02)}.matching-player__item--available{border-color:var(--ink-faint, #8d93a0);border-style:dashed}.matching-player__item--available:hover{border-color:var(--ink, #1d2025);border-style:solid;background:var(--ui-muted, #f5f4f1)}.matching-player__item--matched{border-width:2px;border-color:var(--ink, #1d2025)}.matching-player__item--matched:hover:not(.matching-player__item--disabled){background:var(--ui-muted, #f5f4f1)}.matching-player__item--correct,.matching-player__item--correct:hover{border-color:var(--ok, #1f8a4c)!important;background:var(--ok-soft, #ecf8f0)!important}.matching-player__item--incorrect,.matching-player__item--incorrect:hover{border-color:var(--pen, #d23b2b)!important;background:var(--pen-soft, #fdeeec)!important}.matching-player__item--disabled{cursor:default;pointer-events:none}.matching-player__item-text{flex:1;min-width:0;line-height:1.4}.matching-player__item-text p{margin:0}.matching-player__pair-num{flex-shrink:0;display:inline-flex;align-items:center;justify-content:center;width:calc(22px * var(--edp-scale, 1));height:calc(22px * var(--edp-scale, 1));border-radius:50%;font-size:calc(.7rem * var(--edp-scale, 1));font-weight:700;line-height:1;background:var(--ink, #1d2025);color:#fff}.matching-player__item--correct .matching-player__pair-num{background:var(--ok, #1f8a4c)}.matching-player__item--incorrect .matching-player__pair-num{background:var(--pen, #d23b2b)}.matching-player__connector{flex-shrink:0;color:var(--ink-faint, #8d93a0);display:flex;align-items:center;transition:color .2s,transform .2s;border-radius:50%}.matching-player__item:hover .matching-player__connector{color:var(--ink, #1d2025);transform:scale(1.25)}.matching-player__connector--left{order:10;margin-left:calc(6px * var(--edp-scale, 1))}.matching-player__connector--right{order:-1;margin-right:calc(6px * var(--edp-scale, 1))}.matching-player__connector svg{width:calc(18px * var(--edp-scale, 1));height:calc(18px * var(--edp-scale, 1))}.matching-player__correct-hint{width:100%;order:20;font-weight:700;color:var(--ok, #1f8a4c);font-size:.82em;line-height:1.4;padding-top:.1em;word-break:break-word}.matching-player__correct-hint p{display:inline;margin:0}.matching-player__item:focus-visible{outline:3px solid var(--ink, #1d2025);outline-offset:2px}.blank-correct-hint{display:inline;font-weight:700;color:var(--ok, #1f8a4c);font-size:.875em;margin-left:.3em;word-break:break-word}@keyframes matching-pulse{0%{opacity:.5}to{opacity:1}}@media(prefers-reduced-motion:reduce){.matching-player__item{transition:none}}@media(max-width:600px){:where(.matching-player:not(.matching-player--box)) .matching-player__columns{gap:calc(1rem * var(--edp-scale, 1))}:where(.matching-player:not(.matching-player--box)) .matching-player__item{padding:calc(.5rem * var(--edp-scale, 1)) calc(.6rem * var(--edp-scale, 1));min-height:calc(44px * var(--edp-scale, 1));font-size:calc(.875rem * var(--edp-scale, 1));gap:calc(.35rem * var(--edp-scale, 1))}.matching-player__item:not(.matching-player__item--disabled){cursor:pointer}.matching-player__item:not(.matching-player__item--disabled):active{cursor:pointer}:where(.matching-player:not(.matching-player--box)) .matching-player__connector svg{width:calc(15px * var(--edp-scale, 1));height:calc(15px * var(--edp-scale, 1))}}.matching-player--box{container-type:inline-size}@container (max-width: 33.3em){.matching-player--box .matching-player__columns{gap:calc(1rem * var(--edp-scale, 1))}.matching-player--box .matching-player__item{padding:calc(.5rem * var(--edp-scale, 1)) calc(.6rem * var(--edp-scale, 1));min-height:calc(44px * var(--edp-scale, 1));font-size:calc(.875rem * var(--edp-scale, 1));gap:calc(.35rem * var(--edp-scale, 1))}.matching-player--box .matching-player__connector svg{width:calc(15px * var(--edp-scale, 1));height:calc(15px * var(--edp-scale, 1))}}.math-response-player{margin:calc(.5rem * var(--edp-scale, 1)) 0}.player-math-field{border:2px solid var(--line, #e7e5e0);border-radius:calc(.625rem * var(--edp-scale, 1));padding:calc(.375rem * var(--edp-scale, 1)) calc(.5rem * var(--edp-scale, 1));background:var(--card, #ffffff);transition:border-color .2s ease,background .2s ease}.player-math-field:focus-within{border-color:var(--ink, #1d2025)}.player-math-field--readonly{background:var(--ui-muted, #f5f4f1)}.player-math-field__input{width:100%;min-height:calc(2.5rem * var(--edp-scale, 1));font-size:calc(1.1rem * var(--edp-scale, 1));outline:none;--primary: var(--ink, #1d2025);--caret-color: var(--ink, #1d2025);--selection-background-color: var(--ink-soft, #565b66);--contains-highlight-background-color: var(--ui-muted, #f5f4f1)}.player-math-field__input::part(virtual-keyboard-toggle),.player-math-field__input::part(menu-toggle){color:var(--ink-faint, #8d93a0)}.player-math-field__fallback{width:100%;border:none;outline:none;font-size:calc(1rem * var(--edp-scale, 1));font-family:monospace;background:transparent;color:var(--ink, #1d2025)}.player-math-field--correct{border-color:var(--ok, #1f8a4c);background:var(--ok-soft, #ecf8f0)}.player-math-field--incorrect{border-color:var(--pen, #d23b2b);background:var(--pen-soft, #fdeeec)}.player-math-field--validating{border-color:var(--ink-faint, #8d93a0)}.player-math-feedback{margin-top:calc(.4rem * var(--edp-scale, 1));font-size:calc(.8rem * var(--edp-scale, 1));font-weight:600;display:flex;align-items:center;gap:calc(.4rem * var(--edp-scale, 1))}.player-math-feedback--correct{color:var(--ok, #1f8a4c)}.player-math-feedback--incorrect{color:var(--pen, #d23b2b)}.player-math-feedback--validating{color:var(--ink-soft, #565b66)}.player-math-score{margin-inline-start:auto;font-family:var(--font-hand, "Caveat", cursive);font-size:calc(1.5rem * var(--edp-scale, 1));line-height:1;color:var(--ok, #1f8a4c)}.player-math-spinner{display:inline-block;width:calc(.9rem * var(--edp-scale, 1));height:calc(.9rem * var(--edp-scale, 1));border:2px solid var(--ink-faint, #8d93a0);border-top-color:transparent;border-radius:50%;animation:player-math-spin .7s linear infinite}@keyframes player-math-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.player-math-spinner{animation:none}}.player-ai{margin:calc(1rem * var(--edp-scale, 1)) 0;padding:calc(.5rem * var(--edp-scale, 1));display:flex;flex-direction:column;gap:calc(.75rem * var(--edp-scale, 1));border:1px solid var(--line, #e7e5e0);border-radius:calc(.875rem * var(--edp-scale, 1));background:var(--ui-muted, #f5f4f1)}.player-ai-counts{display:flex;justify-content:flex-end;gap:calc(.5rem * var(--edp-scale, 1))}.player-ai-count{font-size:calc(.75rem * var(--edp-scale, 1));font-weight:600;padding:calc(.1rem * var(--edp-scale, 1)) calc(.5rem * var(--edp-scale, 1));border-radius:999px;background:var(--card, #ffffff);border:1px solid var(--line, #e7e5e0);color:var(--ink-soft, #565b66)}.player-ai-count--over{color:var(--pen, #d23b2b);border-color:var(--pen, #d23b2b)}.player-ai-count--min{color:var(--ink-faint, #8d93a0)}.player-ai-input{width:100%;box-sizing:border-box;padding:calc(.5rem * var(--edp-scale, 1)) calc(.75rem * var(--edp-scale, 1));font-size:calc(1rem * var(--edp-scale, 1));border:1px solid var(--line-strong, #d6d3cc);border-radius:calc(.625rem * var(--edp-scale, 1));background:var(--card, #ffffff);color:var(--ink, #1d2025);outline:none;transition:border-color .2s ease,background .2s ease}.player-ai-input::placeholder{color:var(--ink-faint, #8d93a0)}.player-ai-input:focus{border-color:var(--ink, #1d2025)}.player-ai-input--multiline{min-height:calc(120px * var(--edp-scale, 1));resize:vertical}.player-ai-input:disabled{cursor:default}.player-ai-input--correct{border-color:var(--ok, #1f8a4c);background:var(--ok-soft, #ecf8f0)}.player-ai-input--partial{border-color:var(--almost, #c8810e);border-style:dashed;background:var(--almost-soft, #fbf1dc)}.player-ai-input--incorrect{border-color:var(--pen, #d23b2b);background:var(--pen-soft, #fdeeec)}.player-ai-feedback{display:flex;flex-direction:column;gap:calc(.25rem * var(--edp-scale, 1));padding:calc(.75rem * var(--edp-scale, 1));border-radius:calc(.5rem * var(--edp-scale, 1));font-size:calc(.875rem * var(--edp-scale, 1));border:1px solid var(--line, #e7e5e0);background:var(--card, #ffffff);color:var(--ink, #1d2025)}.player-ai-feedback--correct{border-color:var(--ok, #1f8a4c);background:var(--ok-soft, #ecf8f0);color:var(--ok, #1f8a4c)}.player-ai-feedback--partial{border-color:var(--almost, #c8810e);background:var(--almost-soft, #fbf1dc);color:var(--almost-ink, #8a5a08)}.player-ai-feedback--incorrect{border-color:var(--pen, #d23b2b);background:var(--pen-soft, #fdeeec);color:var(--pen, #d23b2b)}.player-ai-message{margin:0}.player-ai-score-row{display:flex;justify-content:flex-end}.player-ai-score{font-family:var(--font-hand, "Caveat", cursive);font-size:calc(1.5rem * var(--edp-scale, 1));font-weight:600;line-height:1;padding:0 calc(.35rem * var(--edp-scale, 1));color:inherit}.player-ai-validating{display:flex;align-items:center;gap:calc(.5rem * var(--edp-scale, 1));padding:calc(.25rem * var(--edp-scale, 1)) 0;color:var(--ink-soft, #565b66)}.player-ai-spinner{display:inline-block;width:calc(.9rem * var(--edp-scale, 1));height:calc(.9rem * var(--edp-scale, 1));border:2px solid var(--ink-faint, #8d93a0);border-top-color:transparent;border-radius:999px;animation:ai-answer-spin .7s linear infinite}@keyframes ai-answer-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.player-ai-spinner{animation:none}}.player-or-field--pre{border-color:var(--line-strong, #d6d3cc)!important}.player-or-field--correct{border-color:var(--ok, #1f8a4c)!important;background:var(--ok-soft, #ecf8f0)!important}.player-or-field--partial,.player-or-field--review{border-color:var(--almost, #c8810e)!important;background:var(--almost-soft, #fbf1dc)!important}.player-or-field--review{border-style:dashed!important}.player-or-field--incorrect{border-color:var(--pen, #d23b2b)!important;background:var(--pen-soft, #fdeeec)!important}.edp-scaled .text-xs{font-size:calc(.75rem * var(--edp-scale, 1));line-height:calc(1 / .75)}.edp-scaled .text-sm{font-size:calc(.875rem * var(--edp-scale, 1));line-height:calc(1.25 / .875)}.edp-scaled .text-base{font-size:calc(1rem * var(--edp-scale, 1));line-height:1.5}.edp-scaled .text-lg{font-size:calc(1.125rem * var(--edp-scale, 1));line-height:calc(1.75 / 1.125)}.edp-scaled .text-\\[10px\\]{font-size:calc(10px * var(--edp-scale, 1))}.edp-scaled .prose-sm{font-size:calc(.875rem * var(--edp-scale, 1))}.edp-scaled .p-2{padding:calc(.5rem * var(--edp-scale, 1))}.edp-scaled .p-3{padding:calc(.75rem * var(--edp-scale, 1))}.edp-scaled .p-4{padding:calc(1rem * var(--edp-scale, 1))}.edp-scaled .p-6{padding:calc(1.5rem * var(--edp-scale, 1))}.edp-scaled .pb-1{padding-bottom:calc(.25rem * var(--edp-scale, 1))}.edp-scaled .pt-1\\.5{padding-top:calc(.375rem * var(--edp-scale, 1))}.edp-scaled .px-1\\.5{padding-left:calc(.375rem * var(--edp-scale, 1));padding-right:calc(.375rem * var(--edp-scale, 1))}.edp-scaled .px-2{padding-left:calc(.5rem * var(--edp-scale, 1));padding-right:calc(.5rem * var(--edp-scale, 1))}.edp-scaled .px-3{padding-left:calc(.75rem * var(--edp-scale, 1));padding-right:calc(.75rem * var(--edp-scale, 1))}.edp-scaled .px-4{padding-left:calc(1rem * var(--edp-scale, 1));padding-right:calc(1rem * var(--edp-scale, 1))}.edp-scaled .px-5{padding-left:calc(1.25rem * var(--edp-scale, 1));padding-right:calc(1.25rem * var(--edp-scale, 1))}.edp-scaled .px-6{padding-left:calc(1.5rem * var(--edp-scale, 1));padding-right:calc(1.5rem * var(--edp-scale, 1))}.edp-scaled .py-0\\.5{padding-top:calc(.125rem * var(--edp-scale, 1));padding-bottom:calc(.125rem * var(--edp-scale, 1))}.edp-scaled .py-1{padding-top:calc(.25rem * var(--edp-scale, 1));padding-bottom:calc(.25rem * var(--edp-scale, 1))}.edp-scaled .py-1\\.5{padding-top:calc(.375rem * var(--edp-scale, 1));padding-bottom:calc(.375rem * var(--edp-scale, 1))}.edp-scaled .py-2{padding-top:calc(.5rem * var(--edp-scale, 1));padding-bottom:calc(.5rem * var(--edp-scale, 1))}.edp-scaled .py-3{padding-top:calc(.75rem * var(--edp-scale, 1));padding-bottom:calc(.75rem * var(--edp-scale, 1))}.edp-scaled .mb-1{margin-bottom:calc(.25rem * var(--edp-scale, 1))}.edp-scaled .mb-2{margin-bottom:calc(.5rem * var(--edp-scale, 1))}.edp-scaled .ml-1{margin-left:calc(.25rem * var(--edp-scale, 1))}.edp-scaled .ml-2{margin-left:calc(.5rem * var(--edp-scale, 1))}.edp-scaled .mr-2{margin-right:calc(.5rem * var(--edp-scale, 1))}.edp-scaled .mt-0\\.5{margin-top:calc(.125rem * var(--edp-scale, 1))}.edp-scaled .mt-1{margin-top:calc(.25rem * var(--edp-scale, 1))}.edp-scaled .mt-1\\.5{margin-top:calc(.375rem * var(--edp-scale, 1))}.edp-scaled .mt-3{margin-top:calc(.75rem * var(--edp-scale, 1))}.edp-scaled .mx-1{margin-left:calc(.25rem * var(--edp-scale, 1));margin-right:calc(.25rem * var(--edp-scale, 1))}.edp-scaled .my-3{margin-top:calc(.75rem * var(--edp-scale, 1));margin-bottom:calc(.75rem * var(--edp-scale, 1))}.edp-scaled .my-4{margin-top:calc(1rem * var(--edp-scale, 1));margin-bottom:calc(1rem * var(--edp-scale, 1))}.edp-scaled .gap-1{gap:calc(.25rem * var(--edp-scale, 1))}.edp-scaled .gap-1\\.5{gap:calc(.375rem * var(--edp-scale, 1))}.edp-scaled .gap-2{gap:calc(.5rem * var(--edp-scale, 1))}.edp-scaled .gap-3{gap:calc(.75rem * var(--edp-scale, 1))}.edp-scaled .gap-x-1{column-gap:calc(.25rem * var(--edp-scale, 1))}.edp-scaled .gap-y-0\\.5{row-gap:calc(.125rem * var(--edp-scale, 1))}.edp-scaled .w-6{width:calc(1.5rem * var(--edp-scale, 1))}.edp-scaled .w-16{width:calc(4rem * var(--edp-scale, 1))}.edp-scaled .h-6{height:calc(1.5rem * var(--edp-scale, 1))}.edp-scaled .h-8{height:calc(2rem * var(--edp-scale, 1))}.edp-scaled .h-16{height:calc(4rem * var(--edp-scale, 1))}.edp-scaled .max-h-48{max-height:calc(12rem * var(--edp-scale, 1))}.edp-scaled .right-1{right:calc(.25rem * var(--edp-scale, 1))}.edp-scaled .right-3{right:calc(.75rem * var(--edp-scale, 1))}.edp-scaled .bottom-2{bottom:calc(.5rem * var(--edp-scale, 1))}.edp-scaled .max-w-\\[160px\\]{max-width:calc(160px * var(--edp-scale, 1))}.edp-scaled .max-w-\\[200px\\]{max-width:calc(200px * var(--edp-scale, 1))}.edp-scaled .max-w-\\[240px\\]{max-width:calc(240px * var(--edp-scale, 1))}.edp-scaled .min-h-\\[100px\\]{min-height:calc(100px * var(--edp-scale, 1))}.edp-scaled .min-h-\\[120px\\]{min-height:calc(120px * var(--edp-scale, 1))}.edp-scaled .\\[\\&_\\.ProseMirror\\]\\:min-h-\\[80px\\] .ProseMirror{min-height:calc(80px * var(--edp-scale, 1))}.math-inline,.math-block,.math-response-player,.katex,.katex-display{direction:ltr;unicode-bidi:isolate}.exercise-shared-context{font-size:calc(1.125rem * var(--edp-scale, 1));margin-bottom:calc(1rem * var(--edp-scale, 1))}.exercise-reference-cue{display:flex;flex-wrap:wrap;align-items:baseline;gap:calc(.25rem * var(--edp-scale, 1)) calc(.5rem * var(--edp-scale, 1));margin:0 0 calc(1rem * var(--edp-scale, 1));padding:calc(.625rem * var(--edp-scale, 1)) calc(.875rem * var(--edp-scale, 1));border:1px solid var(--line, #e7e5e0);border-inline-start:3px solid var(--ink-soft, #565b66);border-radius:calc(.625rem * var(--edp-scale, 1));background:var(--ui-muted, #f5f4f1);color:var(--ink-soft, #565b66);font-size:calc(1rem * var(--edp-scale, 1));line-height:1.5}.exercise-reference-cue__link{font:inherit;font-weight:600;color:var(--ink, #1d2025);background:none;border:0;padding:0;cursor:pointer;text-decoration:underline;text-underline-offset:3px}.exercise-reference-cue__link:hover{text-decoration-thickness:2px}.exercise-reference-cue__link:focus-visible{outline:2px solid var(--ink, #1d2025);outline-offset:2px;border-radius:2px}.exercise-reference-cue__arrow{display:inline-block;margin-inline-start:.25em}.exercise-reference-cue__arrow:dir(rtl){transform:scaleX(-1)}
48
+ `);import"katex/dist/katex.min.css";rr(`/*! tailwindcss v4.2.0 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){.edpire-scope *,.edpire-scope :before,.edpire-scope :after,.edpire-scope ::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial;--tw-content:""}}}@layer theme{.edpire-scope{--font-sans:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-red-200:oklch(88.5% .062 18.334);--color-red-300:oklch(80.8% .114 19.571);--color-red-950:oklch(25.8% .092 26.042);--color-amber-50:oklch(98.7% .022 95.277);--color-amber-200:oklch(92.4% .12 95.746);--color-amber-900:oklch(41.4% .112 45.904);--color-blue-600:oklch(54.6% .245 262.881);--color-rose-500:oklch(64.5% .246 16.439);--color-slate-500:oklch(55.4% .046 257.417);--color-slate-800:oklch(27.9% .041 260.031);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-800:oklch(27.8% .033 256.848);--color-gray-900:oklch(21% .034 264.665);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-xs:20rem;--container-sm:24rem;--container-3xl:48rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--font-weight-black:900;--tracking-tight:-.025em;--tracking-wide:.025em;--tracking-wider:.05em;--tracking-widest:.1em;--leading-snug:1.375;--leading-relaxed:1.625;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--ease-out:cubic-bezier(0, 0, .2, 1);--ease-in-out:cubic-bezier(.4, 0, .2, 1);--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--blur-sm:8px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1)}}.edpire-scope .\\@container{container-type:inline-size}.edpire-scope .pointer-events-none{pointer-events:none}.edpire-scope .collapse{visibility:collapse}.edpire-scope .invisible{visibility:hidden}.edpire-scope .visible{visibility:visible}.edpire-scope .absolute{position:absolute}.edpire-scope .fixed{position:fixed}.edpire-scope .relative{position:relative}.edpire-scope .static{position:static}.edpire-scope .sticky{position:sticky}.edpire-scope .inset-0{inset:calc(var(--spacing) * 0)}.edpire-scope .start{inset-inline-start:var(--spacing)}.edpire-scope .start-0{inset-inline-start:calc(var(--spacing) * 0)}.edpire-scope .start-2{inset-inline-start:calc(var(--spacing) * 2)}.edpire-scope .end{inset-inline-end:var(--spacing)}.edpire-scope .end-2{inset-inline-end:calc(var(--spacing) * 2)}.edpire-scope .top-0{top:calc(var(--spacing) * 0)}.edpire-scope .top-1\\/2{top:50%}.edpire-scope .top-2{top:calc(var(--spacing) * 2)}.edpire-scope .top-4{top:calc(var(--spacing) * 4)}.edpire-scope .right-1{right:calc(var(--spacing) * 1)}.edpire-scope .right-3{right:calc(var(--spacing) * 3)}.edpire-scope .bottom-2{bottom:calc(var(--spacing) * 2)}.edpire-scope .isolate{isolation:isolate}.edpire-scope .z-10{z-index:10}.edpire-scope .z-20{z-index:20}.edpire-scope .z-30{z-index:30}.edpire-scope .z-40{z-index:40}.edpire-scope .z-50{z-index:50}.edpire-scope .z-\\[60\\]{z-index:60}.edpire-scope .container{width:100%}@media(min-width:40rem){.edpire-scope .container{max-width:40rem}}@media(min-width:48rem){.edpire-scope .container{max-width:48rem}}@media(min-width:64rem){.edpire-scope .container{max-width:64rem}}@media(min-width:80rem){.edpire-scope .container{max-width:80rem}}@media(min-width:96rem){.edpire-scope .container{max-width:96rem}}.edpire-scope .-mx-3{margin-inline:calc(var(--spacing) * -3)}.edpire-scope .mx-1{margin-inline:calc(var(--spacing) * 1)}.edpire-scope .mx-4{margin-inline:calc(var(--spacing) * 4)}.edpire-scope .mx-auto{margin-inline:auto}.edpire-scope .my-1{margin-block:calc(var(--spacing) * 1)}.edpire-scope .my-3{margin-block:calc(var(--spacing) * 3)}.edpire-scope .my-4{margin-block:calc(var(--spacing) * 4)}.edpire-scope .ms-2{margin-inline-start:calc(var(--spacing) * 2)}.edpire-scope .ms-auto{margin-inline-start:auto}.edpire-scope .mt-0\\.5{margin-top:calc(var(--spacing) * .5)}.edpire-scope .mt-1{margin-top:calc(var(--spacing) * 1)}.edpire-scope .mt-1\\.5{margin-top:calc(var(--spacing) * 1.5)}.edpire-scope .mt-2{margin-top:calc(var(--spacing) * 2)}.edpire-scope .mt-3{margin-top:calc(var(--spacing) * 3)}.edpire-scope .mt-px{margin-top:1px}.edpire-scope .mr-2{margin-right:calc(var(--spacing) * 2)}.edpire-scope .mb-1{margin-bottom:calc(var(--spacing) * 1)}.edpire-scope .mb-2{margin-bottom:calc(var(--spacing) * 2)}.edpire-scope .mb-3{margin-bottom:calc(var(--spacing) * 3)}.edpire-scope .mb-5{margin-bottom:calc(var(--spacing) * 5)}.edpire-scope .ml-1{margin-left:calc(var(--spacing) * 1)}.edpire-scope .ml-2{margin-left:calc(var(--spacing) * 2)}.edpire-scope .ml-auto{margin-left:auto}.edpire-scope .block{display:block}.edpire-scope .contents{display:contents}.edpire-scope .flex{display:flex}.edpire-scope .grid{display:grid}.edpire-scope .hidden{display:none}.edpire-scope .inline{display:inline}.edpire-scope .inline-block{display:inline-block}.edpire-scope .inline-flex{display:inline-flex}.edpire-scope .table{display:table}.edpire-scope .h-2{height:calc(var(--spacing) * 2)}.edpire-scope .h-3{height:calc(var(--spacing) * 3)}.edpire-scope .h-4{height:calc(var(--spacing) * 4)}.edpire-scope .h-5{height:calc(var(--spacing) * 5)}.edpire-scope .h-6{height:calc(var(--spacing) * 6)}.edpire-scope .h-7{height:calc(var(--spacing) * 7)}.edpire-scope .h-8{height:calc(var(--spacing) * 8)}.edpire-scope .h-9{height:calc(var(--spacing) * 9)}.edpire-scope .h-11{height:calc(var(--spacing) * 11)}.edpire-scope .h-16{height:calc(var(--spacing) * 16)}.edpire-scope .h-24{height:calc(var(--spacing) * 24)}.edpire-scope .h-\\[600px\\]{height:600px}.edpire-scope .h-dvh{height:100dvh}.edpire-scope .h-full{height:100%}.edpire-scope .h-screen{height:100vh}.edpire-scope .max-h-48{max-height:calc(var(--spacing) * 48)}.edpire-scope .max-h-\\[calc\\(100svh-6rem\\)\\]{max-height:calc(100svh - 6rem)}.edpire-scope .max-h-\\[calc\\(100vh-8rem\\)\\]{max-height:calc(100vh - 8rem)}.edpire-scope .min-h-0{min-height:calc(var(--spacing) * 0)}.edpire-scope .min-h-\\[72px\\]{min-height:72px}.edpire-scope .min-h-\\[100px\\]{min-height:100px}.edpire-scope .min-h-\\[120px\\]{min-height:120px}.edpire-scope .min-h-\\[200px\\]{min-height:200px}.edpire-scope .w-3{width:calc(var(--spacing) * 3)}.edpire-scope .w-4{width:calc(var(--spacing) * 4)}.edpire-scope .w-5{width:calc(var(--spacing) * 5)}.edpire-scope .w-6{width:calc(var(--spacing) * 6)}.edpire-scope .w-7{width:calc(var(--spacing) * 7)}.edpire-scope .w-9{width:calc(var(--spacing) * 9)}.edpire-scope .w-11{width:calc(var(--spacing) * 11)}.edpire-scope .w-12{width:calc(var(--spacing) * 12)}.edpire-scope .w-16{width:calc(var(--spacing) * 16)}.edpire-scope .w-24{width:calc(var(--spacing) * 24)}.edpire-scope .w-\\[88\\%\\]{width:88%}.edpire-scope .w-full{width:100%}.edpire-scope .w-px{width:1px}.edpire-scope .max-w-3xl{max-width:var(--container-3xl)}.edpire-scope .max-w-\\[32ch\\]{max-width:32ch}.edpire-scope .max-w-\\[160px\\]{max-width:160px}.edpire-scope .max-w-\\[200px\\]{max-width:200px}.edpire-scope .max-w-\\[240px\\]{max-width:240px}.edpire-scope .max-w-full{max-width:100%}.edpire-scope .max-w-none{max-width:none}.edpire-scope .max-w-sm{max-width:var(--container-sm)}.edpire-scope .max-w-xs{max-width:var(--container-xs)}.edpire-scope .min-w-0{min-width:calc(var(--spacing) * 0)}.edpire-scope .min-w-\\[80px\\]{min-width:80px}.edpire-scope .min-w-\\[140px\\]{min-width:140px}.edpire-scope .flex-1{flex:1}.edpire-scope .flex-none{flex:none}.edpire-scope .flex-shrink-0,.edpire-scope .shrink-0{flex-shrink:0}.edpire-scope .grow{flex-grow:1}.edpire-scope .-translate-x-\\[110\\%\\]{--tw-translate-x: -110% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.edpire-scope .translate-x-0{--tw-translate-x:calc(var(--spacing) * 0);translate:var(--tw-translate-x) var(--tw-translate-y)}.edpire-scope .-translate-y-1\\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.edpire-scope .transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.edpire-scope .animate-pulse{animation:var(--animate-pulse)}.edpire-scope .animate-spin{animation:var(--animate-spin)}.edpire-scope .cursor-default{cursor:default}.edpire-scope .cursor-pointer{cursor:pointer}.edpire-scope .resize{resize:both}.edpire-scope .flex-col{flex-direction:column}.edpire-scope .flex-wrap{flex-wrap:wrap}.edpire-scope .items-baseline{align-items:baseline}.edpire-scope .items-center{align-items:center}.edpire-scope .items-start{align-items:flex-start}.edpire-scope .justify-between{justify-content:space-between}.edpire-scope .justify-center{justify-content:center}.edpire-scope .justify-end{justify-content:flex-end}.edpire-scope .gap-0\\.5{gap:calc(var(--spacing) * .5)}.edpire-scope .gap-1{gap:calc(var(--spacing) * 1)}.edpire-scope .gap-1\\.5{gap:calc(var(--spacing) * 1.5)}.edpire-scope .gap-2{gap:calc(var(--spacing) * 2)}.edpire-scope .gap-2\\.5{gap:calc(var(--spacing) * 2.5)}.edpire-scope .gap-3{gap:calc(var(--spacing) * 3)}.edpire-scope .gap-4{gap:calc(var(--spacing) * 4)}.edpire-scope .gap-5{gap:calc(var(--spacing) * 5)}.edpire-scope .gap-6{gap:calc(var(--spacing) * 6)}.edpire-scope :where(.edpire-scope .space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1) * calc(1 - var(--tw-space-y-reverse)))}.edpire-scope :where(.edpire-scope .space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}.edpire-scope :where(.edpire-scope .space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}.edpire-scope .gap-x-1{column-gap:calc(var(--spacing) * 1)}.edpire-scope .gap-x-4{column-gap:calc(var(--spacing) * 4)}.edpire-scope .gap-y-0\\.5{row-gap:calc(var(--spacing) * .5)}.edpire-scope .gap-y-2{row-gap:calc(var(--spacing) * 2)}.edpire-scope .self-start{align-self:flex-start}.edpire-scope .self-stretch{align-self:stretch}.edpire-scope .truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.edpire-scope .overflow-hidden{overflow:hidden}.edpire-scope .overflow-y-auto{overflow-y:auto}.edpire-scope .rounded{border-radius:.25rem}.edpire-scope .rounded-2xl{border-radius:var(--radius-2xl)}.edpire-scope .rounded-\\[10px\\]{border-radius:10px}.edpire-scope .rounded-\\[14px\\]{border-radius:14px}.edpire-scope .rounded-full{border-radius:3.40282e38px}.edpire-scope .rounded-lg{border-radius:var(--radius-lg)}.edpire-scope .rounded-md{border-radius:var(--radius-md)}.edpire-scope .rounded-sm{border-radius:var(--radius-sm)}.edpire-scope .rounded-xl{border-radius:var(--radius-xl)}.edpire-scope .rounded-e-lg{border-start-end-radius:var(--radius-lg);border-end-end-radius:var(--radius-lg)}.edpire-scope .rounded-t{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.edpire-scope .border{border-style:var(--tw-border-style);border-width:1px}.edpire-scope .border-2{border-style:var(--tw-border-style);border-width:2px}.edpire-scope .border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.edpire-scope .border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.edpire-scope .border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.edpire-scope .border-dashed{--tw-border-style:dashed;border-style:dashed}.edpire-scope .border-\\[\\#c5e8d1\\]{border-color:#c5e8d1}.edpire-scope .border-\\[\\#d6d3cc\\]{border-color:#d6d3cc}.edpire-scope .border-\\[\\#e7e5e0\\]{border-color:#e7e5e0}.edpire-scope .border-\\[\\#f2e2bf\\]{border-color:#f2e2bf}.edpire-scope .border-\\[\\#f6cfc9\\]{border-color:#f6cfc9}.edpire-scope .border-amber-200{border-color:var(--color-amber-200)}.edpire-scope .border-gray-100{border-color:var(--color-gray-100)}.edpire-scope .border-gray-200{border-color:var(--color-gray-200)}.edpire-scope .border-gray-300{border-color:var(--color-gray-300)}.edpire-scope .bg-\\[\\#1d2025\\]{background-color:#1d2025}.edpire-scope .bg-\\[\\#e7e5e0\\]{background-color:#e7e5e0}.edpire-scope .bg-\\[\\#ecf8f0\\]{background-color:#ecf8f0}.edpire-scope .bg-\\[\\#f1efe9\\]{background-color:#f1efe9}.edpire-scope .bg-\\[\\#f2e2bf\\]{background-color:#f2e2bf}.edpire-scope .bg-\\[\\#f5f4f1\\]{background-color:#f5f4f1}.edpire-scope .bg-\\[\\#fbf1dc\\]{background-color:#fbf1dc}.edpire-scope .bg-\\[\\#fbfaf7\\]{background-color:#fbfaf7}.edpire-scope .bg-\\[\\#fdeeec\\]{background-color:#fdeeec}.edpire-scope .bg-amber-50{background-color:var(--color-amber-50)}.edpire-scope .bg-black{background-color:var(--color-black)}.edpire-scope .bg-black\\/25{background-color:#00000040}@supports (color:color-mix(in lab,red,red)){.edpire-scope .bg-black\\/25{background-color:color-mix(in oklab,var(--color-black) 25%,transparent)}}.edpire-scope .bg-black\\/40{background-color:#0006}@supports (color:color-mix(in lab,red,red)){.edpire-scope .bg-black\\/40{background-color:color-mix(in oklab,var(--color-black) 40%,transparent)}}.edpire-scope .bg-gray-50{background-color:var(--color-gray-50)}.edpire-scope .bg-gray-100{background-color:var(--color-gray-100)}.edpire-scope .bg-gray-300{background-color:var(--color-gray-300)}.edpire-scope .bg-gray-900{background-color:var(--color-gray-900)}.edpire-scope .bg-red-950\\/80{background-color:#460809cc}@supports (color:color-mix(in lab,red,red)){.edpire-scope .bg-red-950\\/80{background-color:color-mix(in oklab,var(--color-red-950) 80%,transparent)}}.edpire-scope .bg-white{background-color:var(--color-white)}.edpire-scope .bg-white\\/60{background-color:#fff9}@supports (color:color-mix(in lab,red,red)){.edpire-scope .bg-white\\/60{background-color:color-mix(in oklab,var(--color-white) 60%,transparent)}}.edpire-scope .object-contain{object-fit:contain}.edpire-scope .object-cover{object-fit:cover}.edpire-scope .p-1{padding:calc(var(--spacing) * 1)}.edpire-scope .p-1\\.5{padding:calc(var(--spacing) * 1.5)}.edpire-scope .p-2{padding:calc(var(--spacing) * 2)}.edpire-scope .p-3{padding:calc(var(--spacing) * 3)}.edpire-scope .p-4{padding:calc(var(--spacing) * 4)}.edpire-scope .p-6{padding:calc(var(--spacing) * 6)}.edpire-scope .px-1\\.5{padding-inline:calc(var(--spacing) * 1.5)}.edpire-scope .px-2{padding-inline:calc(var(--spacing) * 2)}.edpire-scope .px-2\\.5{padding-inline:calc(var(--spacing) * 2.5)}.edpire-scope .px-3{padding-inline:calc(var(--spacing) * 3)}.edpire-scope .px-3\\.5{padding-inline:calc(var(--spacing) * 3.5)}.edpire-scope .px-4{padding-inline:calc(var(--spacing) * 4)}.edpire-scope .px-5{padding-inline:calc(var(--spacing) * 5)}.edpire-scope .px-6{padding-inline:calc(var(--spacing) * 6)}.edpire-scope .px-10{padding-inline:calc(var(--spacing) * 10)}.edpire-scope .py-0\\.5{padding-block:calc(var(--spacing) * .5)}.edpire-scope .py-1{padding-block:calc(var(--spacing) * 1)}.edpire-scope .py-1\\.5{padding-block:calc(var(--spacing) * 1.5)}.edpire-scope .py-2{padding-block:calc(var(--spacing) * 2)}.edpire-scope .py-2\\.5{padding-block:calc(var(--spacing) * 2.5)}.edpire-scope .py-3{padding-block:calc(var(--spacing) * 3)}.edpire-scope .py-5{padding-block:calc(var(--spacing) * 5)}.edpire-scope .py-8{padding-block:calc(var(--spacing) * 8)}.edpire-scope .ps-2{padding-inline-start:calc(var(--spacing) * 2)}.edpire-scope .ps-\\[23px\\]{padding-inline-start:23px}.edpire-scope .pe-2\\.5{padding-inline-end:calc(var(--spacing) * 2.5)}.edpire-scope .pt-1\\.5{padding-top:calc(var(--spacing) * 1.5)}.edpire-scope .pt-2{padding-top:calc(var(--spacing) * 2)}.edpire-scope .pb-1{padding-bottom:calc(var(--spacing) * 1)}.edpire-scope .pb-5{padding-bottom:calc(var(--spacing) * 5)}.edpire-scope .pl-2{padding-left:calc(var(--spacing) * 2)}.edpire-scope .text-center{text-align:center}.edpire-scope .text-right{text-align:right}.edpire-scope .text-start{text-align:start}.edpire-scope .align-middle{vertical-align:middle}.edpire-scope .font-mono{font-family:var(--font-mono)}.edpire-scope .font-sans{font-family:var(--font-sans)}.edpire-scope .text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.edpire-scope .text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.edpire-scope .text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.edpire-scope .text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.edpire-scope .text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.edpire-scope .text-\\[1\\.6rem\\]{font-size:1.6rem}.edpire-scope .text-\\[10px\\]{font-size:10px}.edpire-scope .text-\\[11px\\]{font-size:11px}.edpire-scope .leading-none{--tw-leading:1;line-height:1}.edpire-scope .leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.edpire-scope .leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.edpire-scope .font-black{--tw-font-weight:var(--font-weight-black);font-weight:var(--font-weight-black)}.edpire-scope .font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.edpire-scope .font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.edpire-scope .font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.edpire-scope .tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.edpire-scope .tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.edpire-scope .tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.edpire-scope .tracking-widest{--tw-tracking:var(--tracking-widest);letter-spacing:var(--tracking-widest)}.edpire-scope .break-words{overflow-wrap:break-word}.edpire-scope .whitespace-pre-wrap{white-space:pre-wrap}.edpire-scope .text-\\[\\#1d2025\\]{color:#1d2025}.edpire-scope .text-\\[\\#1f8a4c\\]{color:#1f8a4c}.edpire-scope .text-\\[\\#8a5a08\\]{color:#8a5a08}.edpire-scope .text-\\[\\#8d93a0\\]{color:#8d93a0}.edpire-scope .text-\\[\\#565b66\\]{color:#565b66}.edpire-scope .text-\\[\\#a32b1e\\]{color:#a32b1e}.edpire-scope .text-\\[\\#c8810e\\]{color:#c8810e}.edpire-scope .text-\\[\\#d23b2b\\]{color:#d23b2b}.edpire-scope .text-amber-900{color:var(--color-amber-900)}.edpire-scope .text-blue-600{color:var(--color-blue-600)}.edpire-scope .text-gray-400{color:var(--color-gray-400)}.edpire-scope .text-gray-500{color:var(--color-gray-500)}.edpire-scope .text-gray-600{color:var(--color-gray-600)}.edpire-scope .text-gray-700{color:var(--color-gray-700)}.edpire-scope .text-gray-800{color:var(--color-gray-800)}.edpire-scope .text-red-200{color:var(--color-red-200)}.edpire-scope .text-red-300{color:var(--color-red-300)}.edpire-scope .text-slate-500{color:var(--color-slate-500)}.edpire-scope .text-slate-800{color:var(--color-slate-800)}.edpire-scope .text-white{color:var(--color-white)}.edpire-scope .uppercase{text-transform:uppercase}.edpire-scope .italic{font-style:italic}.edpire-scope .tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.edpire-scope .line-through{text-decoration-line:line-through}.edpire-scope .underline{text-decoration-line:underline}.edpire-scope .underline-offset-2{text-underline-offset:2px}.edpire-scope .underline-offset-4{text-underline-offset:4px}.edpire-scope .opacity-40{opacity:.4}.edpire-scope .opacity-60{opacity:.6}.edpire-scope .opacity-70{opacity:.7}.edpire-scope .shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.edpire-scope .shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.edpire-scope .shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.edpire-scope .shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a), 0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.edpire-scope .outline{outline-style:var(--tw-outline-style);outline-width:1px}.edpire-scope .grayscale{--tw-grayscale:grayscale(100%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.edpire-scope .backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.edpire-scope .transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.edpire-scope .transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.edpire-scope .transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.edpire-scope .transition-shadow{transition-property:box-shadow;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.edpire-scope .transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.edpire-scope .duration-300{--tw-duration:.3s;transition-duration:.3s}.edpire-scope .duration-700{--tw-duration:.7s;transition-duration:.7s}.edpire-scope .ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.edpire-scope .ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.edpire-scope .outline-none{--tw-outline-style:none;outline-style:none}.edpire-scope .select-none{-webkit-user-select:none;user-select:none}.edpire-scope :is(.edpire-scope .group-open\\:rotate-90):is(:where(.group):is([open],.edpire-scope :popover-open,.edpire-scope :open) *){rotate:90deg}@media(hover:hover){.edpire-scope :is(.edpire-scope .group-hover\\:text-\\[\\#1d2025\\]):is(:where(.group):hover *){color:#1d2025}.edpire-scope :is(.edpire-scope .group-hover\\:shadow-md):is(:where(.group):hover *){--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.edpire-scope :is(.edpire-scope .hover\\:border-\\[\\#8d93a0\\]):hover{border-color:#8d93a0}.edpire-scope :is(.edpire-scope .hover\\:bg-\\[\\#31353c\\]):hover{background-color:#31353c}.edpire-scope :is(.edpire-scope .hover\\:bg-\\[\\#e7e5e0\\]):hover{background-color:#e7e5e0}.edpire-scope :is(.edpire-scope .hover\\:bg-\\[\\#f1efe9\\]):hover{background-color:#f1efe9}.edpire-scope :is(.edpire-scope .hover\\:bg-gray-100):hover{background-color:var(--color-gray-100)}.edpire-scope :is(.edpire-scope .hover\\:bg-white):hover{background-color:var(--color-white)}.edpire-scope :is(.edpire-scope .hover\\:text-\\[\\#1d2025\\]):hover{color:#1d2025}.edpire-scope :is(.edpire-scope .hover\\:text-gray-700):hover{color:var(--color-gray-700)}.edpire-scope :is(.edpire-scope .hover\\:text-rose-500):hover{color:var(--color-rose-500)}.edpire-scope :is(.edpire-scope .hover\\:underline):hover{text-decoration-line:underline}}.edpire-scope :is(.edpire-scope .focus\\:outline-none):focus{--tw-outline-style:none;outline-style:none}.edpire-scope :is(.edpire-scope .focus-visible\\:ring-2):focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.edpire-scope :is(.edpire-scope .focus-visible\\:ring-\\[\\#8d93a0\\]):focus-visible{--tw-ring-color:#8d93a0}.edpire-scope :is(.edpire-scope .focus-visible\\:ring-offset-2):focus-visible{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.edpire-scope :is(.edpire-scope .focus-visible\\:outline-2):focus-visible{outline-style:var(--tw-outline-style);outline-width:2px}.edpire-scope :is(.edpire-scope .focus-visible\\:outline-\\[\\#1d2025\\]):focus-visible{outline-color:#1d2025}.edpire-scope :is(.edpire-scope .disabled\\:cursor-not-allowed):disabled{cursor:not-allowed}.edpire-scope :is(.edpire-scope .disabled\\:opacity-50):disabled{opacity:.5}.edpire-scope :is(.edpire-scope .data-\\[flash\\=true\\]\\:bg-\\[\\#fbf1dc\\])[data-flash=true]{background-color:#fbf1dc}.edpire-scope :is(.edpire-scope .data-\\[flash\\=true\\]\\:duration-150)[data-flash=true]{--tw-duration:.15s;transition-duration:.15s}@media(min-width:40rem){.edpire-scope .sm\\:block{display:block}.edpire-scope .sm\\:hidden{display:none}.edpire-scope .sm\\:inline{display:inline}.edpire-scope .sm\\:inline-flex{display:inline-flex}.edpire-scope .sm\\:flex-row{flex-direction:row}.edpire-scope .sm\\:flex-nowrap{flex-wrap:nowrap}.edpire-scope .sm\\:items-center{align-items:center}.edpire-scope .sm\\:gap-4{gap:calc(var(--spacing) * 4)}.edpire-scope .sm\\:px-4{padding-inline:calc(var(--spacing) * 4)}.edpire-scope .sm\\:px-6{padding-inline:calc(var(--spacing) * 6)}.edpire-scope .sm\\:py-4{padding-block:calc(var(--spacing) * 4)}.edpire-scope .sm\\:text-\\[2rem\\]{font-size:2rem}}@container (min-width:72rem){.edpire-scope .\\@6xl\\:flex{display:flex}.edpire-scope .\\@6xl\\:hidden{display:none}}.edpire-scope :is(.edpire-scope .rtl\\:translate-x-\\[110\\%\\]):where(:dir(rtl),.edpire-scope [dir=rtl],.edpire-scope [dir=rtl] *){--tw-translate-x:110%;translate:var(--tw-translate-x) var(--tw-translate-y)}.edpire-scope :is(.edpire-scope .\\[\\&_\\.ProseMirror\\]\\:min-h-\\[80px\\]) .ProseMirror{min-height:80px}.edpire-scope :is(.edpire-scope .\\[\\&_\\.ProseMirror\\]\\:outline-none) .ProseMirror{--tw-outline-style:none;outline-style:none}.edpire-scope :is(.edpire-scope .\\[\\&_\\.ProseMirror_p\\.is-editor-empty\\:first-child\\:\\:before\\]\\:pointer-events-none) .ProseMirror p.is-editor-empty:first-child:before{pointer-events:none}.edpire-scope :is(.edpire-scope .\\[\\&_\\.ProseMirror_p\\.is-editor-empty\\:first-child\\:\\:before\\]\\:float-left) .ProseMirror p.is-editor-empty:first-child:before{float:left}.edpire-scope :is(.edpire-scope .\\[\\&_\\.ProseMirror_p\\.is-editor-empty\\:first-child\\:\\:before\\]\\:h-0) .ProseMirror p.is-editor-empty:first-child:before{height:calc(var(--spacing) * 0)}.edpire-scope :is(.edpire-scope .\\[\\&_\\.ProseMirror_p\\.is-editor-empty\\:first-child\\:\\:before\\]\\:text-gray-400) .ProseMirror p.is-editor-empty:first-child:before{color:var(--color-gray-400)}.edpire-scope :is(.edpire-scope .\\[\\&_\\.ProseMirror_p\\.is-editor-empty\\:first-child\\:\\:before\\]\\:content-\\[attr\\(data-placeholder\\)\\]) .ProseMirror p.is-editor-empty:first-child:before{--tw-content:attr(data-placeholder);content:var(--tw-content)}@layer base{.edpire-scope *,.edpire-scope :after,.edpire-scope :before,.edpire-scope ::backdrop{border-color:var(--color-gray-200,currentColor)}.edpire-scope ::file-selector-button{border-color:var(--color-gray-200,currentColor)}}@supports not (height:100dvh){.edpire-scope .h-dvh{height:100vh}}.edpire-scope :where(span:has(>textarea.player-typed-blank)){line-height:0}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@property --tw-content{syntax:"*";inherits:false;initial-value:""}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}}
49
+ `);import{jsx as Xt}from"react/jsx-runtime";var Mo=Hi.memo(function({content:r,onAnswersChange:t,feedback:n,initialAnswers:o,readOnly:a,className:s,dir:i}){let c=Vi(()=>{if(n)return new Map(Object.entries(n))},[n]),l=Xt(dr,{content:r,onAnswersChange:t,initialAnswers:o,validationFeedback:c,readOnly:a,className:s});return Xt("div",{className:"edpire-scope",style:{display:"contents"},children:i?Xt("div",{dir:i,children:l}):l})});import{useEffect as Tc,useRef as pn}from"react";import na from"react";import{createRoot as oa}from"react-dom/client";import{useCallback as Zo,useMemo as Cc,useState as Ec}from"react";import{cloneElement as Ho,isValidElement as Vo,useCallback as Ke,useEffect as sn,useMemo as Fe,useRef as ht,useState as Oe}from"react";import{Send as Qo,Loader2 as tn,BarChart2 as Go,CheckCircle2 as gc,XCircle as bc,RotateCcw as xc,X as nn,Clock as ur,AlertTriangle as yc,Check as vc,CloudOff as wc}from"lucide-react";import{clsx as Qi}from"clsx";import{twMerge as Gi}from"tailwind-merge";function xe(...e){return Gi(Qi(e))}import{Fragment as Zi,jsx as he,jsxs as Zt}from"react/jsx-runtime";function Yi({accent:e}){return he("div",{style:{width:48,height:48,borderRadius:"50%",border:`4px solid ${e}33`,borderTopColor:e,animation:"edpire-spin 0.8s linear infinite"}})}function Ki({accent:e}){return he("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[0,1,2].map(r=>he("div",{style:{width:12,height:12,borderRadius:"50%",background:e,animation:`edpire-bounce 1.2s ease-in-out ${r*.2}s infinite`}},r))})}function Ji({accent:e}){return Zt("div",{style:{position:"relative",width:48,height:48},children:[[0,1].map(r=>he("div",{style:{position:"absolute",inset:0,borderRadius:"50%",background:e,opacity:.4,animation:`edpire-pulse 1.6s ease-out ${r*.8}s infinite`}},r)),he("div",{style:{position:"absolute",inset:"25%",borderRadius:"50%",background:e}})]})}function Xi({accent:e}){return he("div",{style:{display:"flex",gap:4,alignItems:"flex-end",height:40},children:[0,1,2,3].map(r=>he("div",{style:{width:8,borderRadius:4,background:e,animation:`edpire-bars 1s ease-in-out ${r*.15}s infinite`}},r))})}function Io({visible:e,bgColor:r="rgba(0,0,0,0.55)",accentColor:t="#6366f1",text:n="Evaluating your answers\u2026",aiText:o="Some answers are being reviewed by AI \u2014 this may take a few seconds.",spinnerTheme:a="default",animationUrl:s,hasAiNodes:i=!1,contained:c=!1}){return e?Zt(Zi,{children:[he("style",{children:`
50
50
  @keyframes edpire-spin {
51
51
  to { transform: rotate(360deg); }
52
52
  }
@@ -62,5 +62,5 @@ sys.stdin = io.StringIO(${JSON.stringify(s)})
62
62
  0%, 100% { height: 12px; }
63
63
  50% { height: 40px; }
64
64
  }
65
- `}),ge("div",{style:{background:r},className:`${c?"absolute":"fixed"} inset-0 z-[60] flex items-center justify-center`,children:qt("div",{className:"flex flex-col items-center gap-5 bg-white rounded-2xl shadow-2xl px-10 py-8 max-w-xs text-center",children:[(()=>{if(s)return ge("img",{src:s,alt:"",className:"w-24 h-24 object-contain"});switch(o){case"dots":return ge(vi,{accent:t});case"pulse":return ge(wi,{accent:t});case"bars":return ge(ki,{accent:t});default:return ge(xi,{accent:t})}})(),ge("p",{className:"text-sm font-semibold text-slate-800",children:n}),i&&ge("p",{className:"text-xs text-slate-500 leading-snug",children:a})]})})]}):null}import{useState as Si}from"react";import{BookOpen as ua,X as _i}from"lucide-react";import{jsx as ie,jsxs as He}from"react/jsx-runtime";function fa({assessment:e,isSubmitted:r,setAnswers:t,validationFeedback:n,renderExercise:a,renderSeparator:o,primaryColor:s,contained:i=!1,locale:c,contentMaxWidth:d,t:l}){let[p,x]=Si(!1),f=e.annex,y=f.tabLabel??l("annexDocuments");return He("div",{className:be("@container flex-1 min-h-0 flex",i&&"relative"),children:[He("div",{className:"hidden @6xl:flex flex-1 gap-4 p-4 bg-[#f5f4f1] items-start overflow-y-auto",children:[He("div",{className:"flex-1 sticky top-4 max-h-[calc(100svh-6rem)] flex flex-col bg-white rounded-[14px] border border-[#e7e5e0] shadow-sm overflow-hidden",children:[He("div",{className:"flex items-center gap-2 px-5 py-3 border-b border-[#e7e5e0] flex-shrink-0",children:[ie(ua,{size:14,className:"text-[#8d93a0]"}),ie("span",{className:"text-xs font-bold text-[#565b66] uppercase tracking-widest",children:y})]}),ie("div",{className:"flex-1 overflow-y-auto px-6 py-5 flex flex-col gap-6",children:f.items.map(u=>ie(lr,{item:u},u.id))})]}),ie("div",{className:"w-px bg-[#e7e5e0] flex-shrink-0 self-stretch my-1 rounded-full"}),ie("div",{className:"flex-1 bg-white rounded-[14px] border border-[#e7e5e0] shadow-sm",children:ie("div",{className:"px-6 py-5 flex flex-col gap-4",children:ie(De,{assessment:e,onAnswersChange:r?void 0:t,validationFeedback:n,renderExercise:a,renderSeparator:o,locale:c})})})]}),He("div",{className:"@6xl:hidden flex-1 relative overflow-hidden",children:[ie("div",{className:"absolute inset-0 overflow-y-auto",children:ie("div",{className:"mx-auto px-5 py-5 flex flex-col gap-4",style:{maxWidth:d},children:ie(De,{assessment:e,onAnswersChange:r?void 0:t,validationFeedback:n,renderExercise:a,renderSeparator:o,locale:c})})}),p&&ie("div",{className:be("inset-0 z-30 bg-black/25",i?"absolute":"fixed"),onClick:()=>x(!1)}),He("div",{className:be("top-1/2 left-2 -translate-y-1/2 z-40 w-[88%] bg-[#f1efe9] rounded-2xl shadow-2xl flex flex-col overflow-hidden transition-transform duration-300 ease-in-out",i?"absolute":"fixed",p?"translate-x-0":"-translate-x-[110%]"),children:[He("div",{className:"flex items-center justify-between px-5 py-3 flex-shrink-0",children:[ie("span",{className:"text-sm font-bold text-[#1d2025]",children:y}),ie("button",{onClick:()=>x(!1),className:"p-1 text-[#8d93a0] hover:text-[#1d2025] rounded-lg transition-colors",children:ie(_i,{size:18})})]}),ie("div",{className:"overflow-y-auto max-h-[calc(100vh-8rem)] px-5 pb-5 flex flex-col gap-5",children:f.items.map(u=>ie(lr,{item:u},u.id))})]})]}),!p&&He("button",{onClick:()=>x(!0),style:{transform:"translateY(-50%)",...s?{backgroundColor:s}:{}},className:be("@6xl:hidden top-1/2 left-0 z-20 flex flex-col items-center gap-1 py-3 px-1.5 bg-[#1d2025] text-white text-[10px] font-bold uppercase tracking-wider rounded-e-lg shadow-md hover:bg-[#31353c] transition-colors",i?"absolute":"fixed"),children:[ie(ua,{size:12}),ie("span",{style:{writingMode:"vertical-rl",transform:"rotate(180deg)"},children:y})]})]})}import{useState as Ni}from"react";import{BookOpen as ha,Plus as Ai,X as Ci}from"lucide-react";import{jsx as ce,jsxs as Ze}from"react/jsx-runtime";function ga({assessment:e,isSubmitted:r,setAnswers:t,validationFeedback:n,renderExercise:a,renderSeparator:o,primaryColor:s,contained:i=!1,locale:c,contentMaxWidth:d,t:l,onAddAnnex:p}){let[x,f]=Ni(!1),y=ce(De,{assessment:e,onAnswersChange:r?void 0:t,validationFeedback:n,renderExercise:a,renderSeparator:o,locale:c});if(x)return ce("div",{className:"flex-1 overflow-y-auto",children:ce("div",{className:"mx-auto p-6 flex flex-col gap-4",style:{maxWidth:d},children:y})});let u=h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),p())},g=h=>Ze("span",{style:s?{backgroundColor:s}:void 0,className:be("flex-none inline-flex items-center gap-1.5 rounded-lg bg-[#1d2025] text-white font-semibold shadow-sm group-hover:shadow-md transition-shadow",h?"px-3 py-1.5 text-xs":"mt-1 px-3.5 py-2 text-xs"),children:[ce(Ai,{size:13}),l("annexEmptyCta")]}),R=h=>ce("button",{type:"button",onClick:P=>{P.stopPropagation(),f(!0)},"aria-label":l("annexEmptyDismiss"),title:l("annexEmptyDismiss"),className:be("flex-none flex items-center justify-center w-7 h-7 rounded-lg text-[#8d93a0] hover:text-[#1d2025] hover:bg-[#f1efe9] transition-colors cursor-pointer",h&&"absolute top-2 end-2 z-10"),children:ce(Ci,{size:15})});return Ze("div",{className:be("@container flex-1 min-h-0 flex",i&&"relative"),children:[Ze("div",{className:"hidden @6xl:flex flex-1 gap-4 p-4 bg-[#f5f4f1] items-start overflow-y-auto",children:[ce("div",{className:"flex-1 sticky top-4 flex min-h-[200px] max-h-[calc(100svh-6rem)]",children:Ze("div",{role:"button",tabIndex:0,onClick:p,onKeyDown:u,className:"group relative flex-1 w-full flex flex-col items-center justify-center gap-3 text-center rounded-[14px] border-2 border-dashed border-[#d6d3cc] bg-white/60 hover:border-[#8d93a0] hover:bg-white transition-colors cursor-pointer px-6 py-8 outline-none focus-visible:ring-2 focus-visible:ring-[#8d93a0] focus-visible:ring-offset-2",children:[R(!0),ce("span",{className:"flex items-center justify-center w-11 h-11 rounded-full bg-[#f1efe9] text-[#8d93a0] group-hover:text-[#1d2025] transition-colors",children:ce(ha,{size:20})}),ce("span",{className:"text-sm font-bold text-[#565b66]",children:l("annexEmptyTitle")}),ce("span",{className:"text-xs text-[#8d93a0] max-w-[32ch] leading-relaxed",children:l("annexEmptyBody")}),g(!1)]})}),ce("div",{className:"w-px bg-[#e7e5e0] flex-shrink-0 self-stretch my-1 rounded-full"}),ce("div",{className:"flex-1 bg-white rounded-[14px] border border-[#e7e5e0] shadow-sm",children:ce("div",{className:"px-6 py-5 flex flex-col gap-4",children:y})})]}),ce("div",{className:"@6xl:hidden flex-1 overflow-y-auto",children:Ze("div",{className:"mx-auto px-5 py-5 flex flex-col gap-4",style:{maxWidth:d},children:[Ze("div",{role:"button",tabIndex:0,onClick:p,onKeyDown:u,className:"group flex items-center gap-3 rounded-[14px] border-2 border-dashed border-[#d6d3cc] bg-white/60 hover:border-[#8d93a0] hover:bg-white transition-colors cursor-pointer px-4 py-2.5 outline-none focus-visible:ring-2 focus-visible:ring-[#8d93a0]",children:[ce("span",{className:"flex-none flex items-center justify-center w-9 h-9 rounded-full bg-[#f1efe9] text-[#8d93a0] group-hover:text-[#1d2025] transition-colors",children:ce(ha,{size:16})}),Ze("div",{className:"flex-1 min-w-0",children:[ce("div",{className:"text-xs font-bold text-[#565b66]",children:l("annexEmptyTitle")}),ce("div",{className:"text-[11px] text-[#8d93a0] leading-snug",children:l("annexEmptyBody")})]}),g(!0),R(!1)]}),y]})})]})}function Ut(e){let r=new Map;for(let t of e){let n=new Map;for(let a of t.questions){let o=new Map;for(let s of a.nodeResults){let i={state:s.status,showFeedback:!0,score:s.score,...s.feedback!==void 0?{message:s.feedback}:{},...s.displayAnswer!==void 0?{displayAnswer:s.displayAnswer}:{},...s.teacherFeedback!==void 0?{teacherFeedback:s.teacherFeedback}:{}};s.detail?.type==="choiceSet"?i.correctChoiceIds=s.detail.correctChoiceIds:s.detail?.type==="matchingSet"&&(i.pairFeedback=s.detail.pairFeedback,i.correctPairings=s.detail.correctPairings),o.set(s.nodeId,i)}n.set(a.questionId,o)}r.set(t.exerciseId,n)}return r}var Pi=new Set(["choiceSet","inlineChoiceSet","blank","aiAnswerInput","matchingSet","openResponseNode","mathResponse","codingResponse"]),Ei=new Set(["blankPool","inlinePool"]);function Mi(e){switch(e.type){case"choiceSet":case"inlineChoiceSet":return e.answer.selectedIds.length>0;case"blank":return e.answer.mode==="choice"?e.answer.choiceId.length>0:e.answer.text.trim().length>0;case"matchingSet":return e.answer.connections.length>0;case"aiAnswer":return e.answer.text.trim().length>0;case"openResponse":{let r=e.answer;return r.recording||r.files&&r.files.length>0?!0:(r.text?.wordCount??0)>0}case"mathResponse":return e.answer.latex.trim().length>0;case"codingResponse":return e.answer.source.trim().length>0;default:{let r=e;return!0}}}function Ii(e){let r=0,t=n=>{if(Array.isArray(n)){for(let s of n)t(s);return}if(!n||typeof n!="object")return;let{type:a,content:o}=n;if(typeof a=="string"){if(Pi.has(a)){r+=1;return}if(Ei.has(a))return}o!==void 0&&t(o)};return t(e),r}function ba(e,r){let t=new Map;for(let a of r?.exerciseAnswers??[])for(let o of a.questionAnswers){let s=t.get(o.questionId);s||(s=new Set,t.set(o.questionId,s));for(let i of o.answers)Mi(i)&&s.add(i.nodeId)}let n=0;for(let a of e.exercises)for(let o of a.questions){let s=Ii(o.content);s!==0&&(t.get(o.id)?.size??0)<s&&(n+=1)}return n}var Li={exercise:"Exercise {index}",question:"Question {index}",points:"pts",submit:"Submit Assessment",submitting:"Submitting...",confirmTitle:"Submit Assessment",confirmDescription:"Are you sure you want to submit? You cannot change your answers after submitting.",unansweredOne:"1 question is not fully answered.",unansweredMany:"{count} questions are not fully answered.",confirmSubmit:"Submit",confirmCancel:"Cancel",assessmentPassed:"Assessment passed",assessmentNotPassed:"Assessment not passed",awaitingReview:"Awaiting review",awaitingReviewDesc:"Your teacher is reviewing your open responses. Your final score will be available once grading is complete.",beingMarked:"Being marked",beingMarkedDesc:"Some answers are still being marked. Your final score will be available once every answer is marked.",pendingReview:"Pending review",viewFullReport:"View Full Report",poweredBy:"Powered by Edpire",evaluating:"Evaluating your answers\u2026",aiEvaluating:"Some answers are being reviewed by AI \u2014 this may take a few seconds.",reset:"Reset",back:"Back",annexDocuments:"Documents",annexEmptyTitle:"No reference yet",annexEmptyBody:"A text, figure, table or document that stays in view across the whole assessment while students answer.",annexEmptyCta:"Add reference",annexEmptyDismiss:"Hide","timeUp.title":"Time's up","timeUp.submitting":"Submitting your answers\u2026",yourScore:"Your score",answersSaving:"Saving\u2026",answersSaved:"Answers saved",answersNotSaved:"Your answers aren't being saved. Check your connection.",resumeRestored:"Welcome back. Your answers are here.",resumeFresh:"Welcome back.",resumeTimeLeft:"The clock kept running: {minutes} min left.",close:"Close"},Ti={exercise:"Exercice {index}",question:"Question {index}",points:"pts",submit:"Soumettre l'\xE9valuation",submitting:"Soumission...",confirmTitle:"Soumettre l'\xE9valuation",confirmDescription:"\xCAtes-vous s\xFBr de vouloir soumettre ? Vous ne pourrez pas modifier vos r\xE9ponses.",unansweredOne:"1 question n'est pas enti\xE8rement remplie.",unansweredMany:"{count} questions ne sont pas enti\xE8rement remplies.",confirmSubmit:"Soumettre",confirmCancel:"Annuler",assessmentPassed:"\xC9valuation r\xE9ussie",assessmentNotPassed:"\xC9valuation non r\xE9ussie",awaitingReview:"En attente de correction",awaitingReviewDesc:"Votre professeur examine vos r\xE9ponses ouvertes. Votre note finale sera disponible une fois la correction termin\xE9e.",beingMarked:"Correction en cours",beingMarkedDesc:"Certaines r\xE9ponses sont encore en cours de correction. Votre note finale sera disponible d\xE8s que toutes les r\xE9ponses seront corrig\xE9es.",pendingReview:"En attente de correction",viewFullReport:"Voir le rapport complet",poweredBy:"Propuls\xE9 par Edpire",evaluating:"\xC9valuation de vos r\xE9ponses\u2026",aiEvaluating:"Certaines r\xE9ponses sont examin\xE9es par l'IA \u2014 cela peut prendre quelques secondes.",reset:"R\xE9initialiser",back:"Retour",annexDocuments:"Documents",annexEmptyTitle:"Aucune annexe pour l'instant",annexEmptyBody:"Un texte, une figure, un tableau ou un document qui reste visible pour toute l'\xE9valuation pendant que les \xE9l\xE8ves r\xE9pondent.",annexEmptyCta:"Ajouter une annexe",annexEmptyDismiss:"Masquer","timeUp.title":"Temps \xE9coul\xE9","timeUp.submitting":"Envoi de vos r\xE9ponses\u2026",yourScore:"Votre score",answersSaving:"Enregistrement\u2026",answersSaved:"R\xE9ponses enregistr\xE9es",answersNotSaved:"Vos r\xE9ponses ne sont pas enregistr\xE9es. V\xE9rifiez votre connexion.",resumeRestored:"Bon retour. Vos r\xE9ponses sont l\xE0.",resumeFresh:"Bon retour.",resumeTimeLeft:"Le chrono a continu\xE9 : il reste {minutes} min.",close:"Fermer"},$i={exercise:"\u062A\u0645\u0631\u064A\u0646 {index}",question:"\u0633\u0624\u0627\u0644 {index}",points:"\u0646\u0642\u0637\u0629",submit:"\u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u062A\u0642\u064A\u064A\u0645",submitting:"\u062C\u0627\u0631\u064D \u0627\u0644\u0625\u0631\u0633\u0627\u0644...",confirmTitle:"\u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u062A\u0642\u064A\u064A\u0645",confirmDescription:"\u0647\u0644 \u0623\u0646\u062A \u0645\u062A\u0623\u0643\u062F \u0645\u0646 \u0627\u0644\u0625\u0631\u0633\u0627\u0644\u061F \u0644\u0646 \u062A\u062A\u0645\u0643\u0646 \u0645\u0646 \u062A\u063A\u064A\u064A\u0631 \u0625\u062C\u0627\u0628\u0627\u062A\u0643 \u0628\u0639\u062F \u0627\u0644\u0625\u0631\u0633\u0627\u0644.",unansweredOne:"\u0644\u0645 \u062A\u064F\u0643\u0645\u0644 \u0627\u0644\u0625\u062C\u0627\u0628\u0629 \u0639\u0646 \u0633\u0624\u0627\u0644 \u0648\u0627\u062D\u062F.",unansweredMany:"\u0644\u0645 \u062A\u064F\u0643\u0645\u0644 \u0627\u0644\u0625\u062C\u0627\u0628\u0629 \u0639\u0646 {count} \u0645\u0646 \u0627\u0644\u0623\u0633\u0626\u0644\u0629.",confirmSubmit:"\u0625\u0631\u0633\u0627\u0644",confirmCancel:"\u0625\u0644\u063A\u0627\u0621",assessmentPassed:"\u0627\u062C\u062A\u064A\u0627\u0632 \u0627\u0644\u062A\u0642\u064A\u064A\u0645",assessmentNotPassed:"\u0644\u0645 \u064A\u062A\u0645 \u0627\u062C\u062A\u064A\u0627\u0632 \u0627\u0644\u062A\u0642\u064A\u064A\u0645",awaitingReview:"\u0641\u064A \u0627\u0646\u062A\u0638\u0627\u0631 \u0627\u0644\u062A\u0635\u062D\u064A\u062D",awaitingReviewDesc:"\u064A\u0642\u0648\u0645 \u0645\u0639\u0644\u0645\u0643 \u0628\u0645\u0631\u0627\u062C\u0639\u0629 \u0625\u062C\u0627\u0628\u0627\u062A\u0643 \u0627\u0644\u0645\u0641\u062A\u0648\u062D\u0629. \u0633\u062A\u0638\u0647\u0631 \u0639\u0644\u0627\u0645\u062A\u0643 \u0627\u0644\u0646\u0647\u0627\u0626\u064A\u0629 \u0628\u0639\u062F \u0627\u0643\u062A\u0645\u0627\u0644 \u0627\u0644\u062A\u0635\u062D\u064A\u062D.",beingMarked:"\u0642\u064A\u062F \u0627\u0644\u062A\u0635\u062D\u064A\u062D",beingMarkedDesc:"\u0628\u0639\u0636 \u0627\u0644\u0625\u062C\u0627\u0628\u0627\u062A \u0645\u0627 \u0632\u0627\u0644\u062A \u0642\u064A\u062F \u0627\u0644\u062A\u0635\u062D\u064A\u062D. \u0633\u062A\u0638\u0647\u0631 \u0639\u0644\u0627\u0645\u062A\u0643 \u0627\u0644\u0646\u0647\u0627\u0626\u064A\u0629 \u0628\u0639\u062F \u062A\u0635\u062D\u064A\u062D \u062C\u0645\u064A\u0639 \u0627\u0644\u0625\u062C\u0627\u0628\u0627\u062A.",pendingReview:"\u0642\u064A\u062F \u0627\u0644\u062A\u0635\u062D\u064A\u062D",viewFullReport:"\u0639\u0631\u0636 \u0627\u0644\u062A\u0642\u0631\u064A\u0631 \u0627\u0644\u0643\u0627\u0645\u0644",poweredBy:"\u0645\u062F\u0639\u0648\u0645 \u0645\u0646 Edpire",evaluating:"\u062C\u0627\u0631\u064D \u062A\u0642\u064A\u064A\u0645 \u0625\u062C\u0627\u0628\u0627\u062A\u0643\u2026",aiEvaluating:"\u0628\u0639\u0636 \u0627\u0644\u0625\u062C\u0627\u0628\u0627\u062A \u0642\u064A\u062F \u0627\u0644\u0645\u0631\u0627\u062C\u0639\u0629 \u0628\u0627\u0644\u0630\u0643\u0627\u0621 \u0627\u0644\u0627\u0635\u0637\u0646\u0627\u0639\u064A \u2014 \u0642\u062F \u064A\u0633\u062A\u063A\u0631\u0642 \u0630\u0644\u0643 \u0628\u0636\u0639 \u062B\u0648\u0627\u0646\u064D.",reset:"\u0625\u0639\u0627\u062F\u0629 \u062A\u0639\u064A\u064A\u0646",back:"\u0631\u062C\u0648\u0639",annexDocuments:"\u0627\u0644\u0645\u0633\u062A\u0646\u062F\u0627\u062A",annexEmptyTitle:"\u0644\u0627 \u064A\u0648\u062C\u062F \u0645\u064F\u0644\u062D\u064E\u0642 \u0628\u0639\u062F",annexEmptyBody:"\u0646\u0635 \u0623\u0648 \u0635\u0648\u0631\u0629 \u0623\u0648 \u062C\u062F\u0648\u0644 \u0623\u0648 \u0645\u0633\u062A\u0646\u062F \u064A\u0628\u0642\u0649 \u0638\u0627\u0647\u0631\u064B\u0627 \u0637\u0648\u0627\u0644 \u0627\u0644\u062A\u0642\u064A\u064A\u0645 \u0623\u062B\u0646\u0627\u0621 \u0625\u062C\u0627\u0628\u0629 \u0627\u0644\u0637\u0644\u0627\u0628.",annexEmptyCta:"\u0625\u0636\u0627\u0641\u0629 \u0645\u064F\u0644\u062D\u064E\u0642",annexEmptyDismiss:"\u0625\u062E\u0641\u0627\u0621","timeUp.title":"\u0627\u0646\u062A\u0647\u0649 \u0627\u0644\u0648\u0642\u062A","timeUp.submitting":"\u062C\u0627\u0631\u064D \u0625\u0631\u0633\u0627\u0644 \u0625\u062C\u0627\u0628\u0627\u062A\u0643\u2026",yourScore:"\u0646\u062A\u064A\u062C\u062A\u0643",answersSaving:"\u062C\u0627\u0631\u064D \u0627\u0644\u062D\u0641\u0638\u2026",answersSaved:"\u062A\u0645 \u062D\u0641\u0638 \u0627\u0644\u0625\u062C\u0627\u0628\u0627\u062A",answersNotSaved:"\u0644\u0627 \u064A\u062A\u0645 \u062D\u0641\u0638 \u0625\u062C\u0627\u0628\u0627\u062A\u0643. \u062A\u062D\u0642\u0651\u0642 \u0645\u0646 \u0627\u062A\u0635\u0627\u0644\u0643.",resumeRestored:"\u0645\u0631\u062D\u0628\u064B\u0627 \u0628\u0639\u0648\u062F\u062A\u0643. \u0625\u062C\u0627\u0628\u0627\u062A\u0643 \u0647\u0646\u0627.",resumeFresh:"\u0645\u0631\u062D\u0628\u064B\u0627 \u0628\u0639\u0648\u062F\u062A\u0643.",resumeTimeLeft:"\u0627\u0633\u062A\u0645\u0631\u0651 \u0627\u0644\u0645\u0624\u0642\u0651\u062A: \u062A\u0628\u0642\u0651\u0649 {minutes} \u062F\u0642\u064A\u0642\u0629.",close:"\u0625\u063A\u0644\u0627\u0642"},Ht={en:Li,fr:Ti,ar:$i};function zi(e,r,t){let a=(Ht[e]??Ht.en)[r]??Ht.en[r]??r;return t?Object.entries(t).reduce((o,[s,i])=>o.replace(`{${s}}`,String(i)),a):a}function ya(e){return(r,t)=>zi(e,r,t)}function xa(e){return e==="ar"}function at(e){return e==="en"?"en":"fr"}var va="48rem";import"katex/dist/katex.min.css";Xe(`.edpire-annex-layout{display:flex;flex:1;min-width:0;height:100%;overflow:hidden;position:relative}.edpire-annex-main{flex:1;min-width:0;overflow:hidden;display:flex;flex-direction:column}.edpire-annex-panel{width:38%;min-width:calc(280px * var(--edp-scale, 1));max-width:calc(480px * var(--edp-scale, 1));flex-shrink:0;display:flex;flex-direction:column;border-right:1px solid #e5e7eb;background:#fff;overflow:hidden}.edpire-annex-panel__header{flex-shrink:0;padding:calc(12px * var(--edp-scale, 1)) calc(20px * var(--edp-scale, 1));border-bottom:1px solid #f3f4f6;background:#f9fafb}.edpire-annex-panel__header-label{font-size:calc(11px * var(--edp-scale, 1));font-weight:700;text-transform:uppercase;letter-spacing:.08em;color:#6b7280}.edpire-annex-panel__scroll{flex:1;overflow-y:auto;padding:calc(24px * var(--edp-scale, 1)) calc(20px * var(--edp-scale, 1));display:flex;flex-direction:column;gap:calc(32px * var(--edp-scale, 1))}.edpire-annex-tab,.edpire-annex-drawer,.edpire-annex-backdrop{display:none}@media(max-width:1023px){.edpire-annex-panel{display:none}.edpire-annex-tab{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:calc(8px * var(--edp-scale, 1));position:fixed;left:0;top:50%;transform:translateY(-50%);z-index:40;background:var(--edpire-annex-tab-bg, #2563eb);color:var(--edpire-annex-tab-color, #ffffff);border:none;border-radius:0 calc(10px * var(--edp-scale, 1)) calc(10px * var(--edp-scale, 1)) 0;padding:calc(18px * var(--edp-scale, 1)) calc(10px * var(--edp-scale, 1));cursor:pointer;box-shadow:2px 2px 16px #0000002e;transition:filter .15s}.edpire-annex-tab:hover{filter:brightness(.88)}.edpire-annex-tab__label{writing-mode:vertical-rl;text-orientation:mixed;transform:rotate(180deg);font-size:calc(11px * var(--edp-scale, 1));font-weight:700;letter-spacing:.07em;text-transform:uppercase;white-space:nowrap}.edpire-annex-drawer{display:flex;flex-direction:column;position:fixed;left:0;top:0;bottom:0;width:min(84vw,calc(440px * var(--edp-scale, 1)));background:#fff;z-index:50;transform:translate(-100%);transition:transform .28s cubic-bezier(.4,0,.2,1);box-shadow:4px 0 32px #00000021;overflow:hidden}.edpire-annex-drawer--open{transform:translate(0)}.edpire-annex-drawer__header{display:flex;align-items:center;justify-content:space-between;padding:calc(16px * var(--edp-scale, 1)) calc(20px * var(--edp-scale, 1));border-bottom:1px solid #f3f4f6;background:#f9fafb;flex-shrink:0}.edpire-annex-drawer__label{font-size:calc(13px * var(--edp-scale, 1));font-weight:700;color:#111827}.edpire-annex-drawer__close{display:flex;align-items:center;justify-content:center;width:calc(28px * var(--edp-scale, 1));height:calc(28px * var(--edp-scale, 1));background:none;border:none;cursor:pointer;font-size:calc(20px * var(--edp-scale, 1));line-height:1;color:#9ca3af;border-radius:calc(6px * var(--edp-scale, 1));transition:color .15s,background .15s}.edpire-annex-drawer__close:hover{color:#111827;background:#f3f4f6}.edpire-annex-drawer__scroll{flex:1;overflow-y:auto;padding:calc(24px * var(--edp-scale, 1)) calc(20px * var(--edp-scale, 1));display:flex;flex-direction:column;gap:calc(32px * var(--edp-scale, 1))}.edpire-annex-backdrop{display:block;position:fixed;inset:0;background:#00000061;z-index:45;cursor:pointer}}
66
- `);import{Fragment as Qt,jsx as M,jsxs as j}from"react/jsx-runtime";var qi="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%234f46e5'%3E%3Cpath d='M12 2L2 7v10l10 5 10-5V7L12 2zm0 2.18L19.5 8 12 11.82 4.5 8 12 4.18zM4 9.6l7 3.5v7.3L4 16.9V9.6zm9 10.8v-7.3l7-3.5v7.3L13 20.4z'/%3E%3C/svg%3E";function Ui(e){for(let r of e.exercises)for(let t of r.questions)if((t.content.content??[]).some(a=>a.type==="aiAnswerInput"))return!0;return!1}function Aa(e){let r=e;return typeof r.totalMaxScore=="number"?r.totalMaxScore:(r.answerKeys??[]).reduce((t,n)=>t+(n.scoring?.maxScore??0),0)}function _a(e){return e.questions.reduce((r,t)=>r+Aa(t),0)}function je(e){return Number.isInteger(e)?String(e):parseFloat(e.toFixed(2)).toString()}function Ca(e){return e==="full"?"#1f8a4c":e==="partial"?"#c8810e":"#d23b2b"}function Hi({outcome:e}){let r=e==="full"?"M20 54 L41 75 L82 24":e==="none"?"M27 27 L73 73 M73 27 L27 73":"M14 58 C29 33 40 33 52 51 C64 69 74 69 88 42";return M("svg",{width:14,height:14,viewBox:"0 0 100 100",fill:"none",stroke:Ca(e),strokeWidth:9,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:M("path",{d:r})})}function Vi({score:e,weight:r,t}){if(e){if(e.awaiting)return j("span",{className:"inline-flex items-center gap-1 rounded-lg border border-[#f2e2bf] bg-[#fbf1dc] px-2 py-0.5 text-xs font-semibold text-[#8a5a08]",children:[M(pr,{size:11}),t("pendingReview")]});let n=e.m>0&&e.s>=e.m?"full":e.s>0?"partial":"none";return j("span",{className:"inline-flex items-center gap-1.5 rounded-lg border border-[#e7e5e0] bg-[#f5f4f1] ps-2 pe-2.5 py-0.5",children:[M(Hi,{outcome:n}),j("span",{className:"font-bold leading-none",style:{fontFamily:'var(--font-hand, "Caveat", cursive)',fontSize:"1.05rem",color:Ca(n)},children:[je(e.s)," / ",je(e.m)]})]})}return r>0?j("span",{className:"text-xs font-semibold tabular-nums text-[#8d93a0]",children:[je(r)," ",t("points")]}):null}function Na(e){let r=new Map;for(let t of e?.exerciseAnswers??[])for(let n of t.questionAnswers)r.set(n.questionId,n.answers);return r}function Gi(e,r){return r.size===0?e:{exerciseAnswers:e.exerciseAnswers.map(t=>({...t,questionAnswers:t.questionAnswers.map(n=>n.answers.length===0&&r.has(n.questionId)?{...n,answers:r.get(n.questionId)}:n)}))}}function Qi({timeLimitMinutes:e,startedAt:r,onExpire:t}){let n=e*6e4,a=new Date(r).getTime()+n,[o,s]=Te(()=>Math.max(a-Date.now(),0)),i=Kt(t);i.current=t,Yt(()=>{if(o<=0){i.current();return}let u=setInterval(()=>{let g=Math.max(a-Date.now(),0);s(g),g<=0&&(clearInterval(u),i.current())},1e3);return()=>clearInterval(u)},[a]);let c=o/n,d=c<.1?"bg-[#fdeeec] text-[#a32b1e] border-[#f6cfc9] animate-pulse":c<.25?"bg-[#fbf1dc] text-[#8a5a08] border-[#f2e2bf]":"bg-[#f5f4f1] text-[#565b66] border-[#e7e5e0]",l=Math.ceil(o/1e3),p=Math.floor(l/3600),x=Math.floor(l%3600/60),f=l%60,y=p>0?`${p}:${String(x).padStart(2,"0")}:${String(f).padStart(2,"0")}`:`${x}:${String(f).padStart(2,"0")}`;return j("span",{className:be("inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full border text-xs font-bold tabular-nums transition-colors",d),children:[M(pr,{size:12}),y]})}function vr({assessment:e,meta:r,locale:t="en",branding:n,timeLimitMinutes:a,startedAt:o,initialAnswers:s,onAnswersChange:i,saveState:c,resumed:d=!1,onSubmit:l,review:p,onViewReport:x,reportLabel:f,onBack:y,backLabel:u,allowReset:g,onReset:R,overlayConfig:h,contained:P=!1,layout:b,onClose:k,mediaHandler:A,onAddAnnex:C,fallbackLogoUrl:$}){let v=Fe(()=>ya(t),[t]),m=xa(t)?"rtl":"ltr",L=b?.maxWidth??va,T=n?.branding?.primaryColor,q=n?.branding?.accentColor,_=n?.branding?.fontFamily,I=n?.branding?.fontUrl,W=n?.branding?.showPoweredBy!==!1;Yt(()=>{if(!I||typeof document>"u"||document.querySelector(`link[href="${I}"]`))return;let me=document.createElement("link");me.rel="stylesheet",me.href=I,document.head.appendChild(me)},[I]);let[z,O]=Te(()=>p?.answers??s??{exerciseAnswers:[]}),[Y]=Te(()=>p?new Map:Na(s)),B=Kt(i);B.current=i;let w=dr(Q=>{let me=Gi(Q,Y);O(me),B.current?.(me)},[Y]),[S,D]=Te(null);Yt(()=>{D(Date.now())},[]);let[H,V]=Te(d&&!p),le=Fe(()=>{if(S===null||!a||a<=0||!o)return null;let Q=new Date(o).getTime()+a*6e4-S;return Q>0?Math.max(1,Math.floor(Q/6e4)):null},[S,a,o]),[Z,ae]=Te(!1),[oe,ne]=Te(!1),[U,mr]=Te(p?.result??null),Ve=Fe(()=>Na(p?.answers),[p]),[rn,wr]=Te(null),[ot,tn]=Te(!1),nn=Kt(!1),Da=Fe(()=>Ui(e),[e]),st=Fe(()=>oe?ba(e,z):0,[oe,e,z]),an=Fe(()=>e.exercises.reduce((Q,me)=>Q+_a(me),0),[e]),it=Fe(()=>U?Ut(U.exerciseFeedback):void 0,[U]),on=Fe(()=>{if(!U)return{};let Q={};for(let me of U.exerciseFeedback){let Ge=0,Oe=0,fe=!1;for(let er of me.questions)for(let $e of er.nodeResults)Ge+=$e.score,Oe+=$e.maxScore,$e.status==="awaiting_review"&&(fe=!0);Q[me.exerciseId]={score:Ge,maxScore:Oe,awaiting:fe}}return Q},[U]),sn=Fe(()=>{if(!U)return{};let Q={};for(let me of U.exerciseFeedback)for(let Ge of me.questions){let Oe=0,fe=0,er=!1;for(let $e of Ge.nodeResults)Oe+=$e.score,fe+=$e.maxScore,$e.status==="awaiting_review"&&(er=!0);Q[Ge.questionId]={score:Oe,maxScore:fe,awaiting:er}}return Q},[U]),Fa=dr(async()=>{ae(!0),wr(null);try{let Q=await l(z);mr(Q),typeof window<"u"&&window.scrollTo({top:0,behavior:"smooth"})}catch(Q){wr(Q instanceof Error?Q.message:v("confirmCancel"))}finally{ae(!1),ne(!1)}},[z,l,v]),cn=dr(()=>{!U||!x||x(U)},[U,x]),ja=dr(()=>{nn.current||Z||U||(nn.current=!0,tn(!0),ne(!1),typeof document<"u"&&document.activeElement?.blur(),setTimeout(()=>{ae(!0),wr(null),l(z).then(Q=>{mr(Q),typeof window<"u"&&window.scrollTo({top:0,behavior:"smooth"})}).catch(Q=>{wr(Q instanceof Error?Q.message:"submit_error")}).finally(()=>{ae(!1),tn(!1)})},800))},[z,Z,l,U]),ct=dr((Q,me,Ge)=>{let Oe=_a(Q),fe=on[Q.id],er=Q.questions.length>1,$e=ka(me)?wa(me,{renderQuestion:(Sr,dt,Oa)=>{let Qe=Sr.id,ln=Y.get(Qe),dn={...A?{mediaHandler:A}:{},...p?{initialAnswers:Ve.get(Qe)??[],readOnly:!0}:ln?{initialAnswers:ln}:{}},pn=Object.keys(dn).length>0&&ka(dt)?wa(dt,dn):dt;if(!er)return M("div",{"data-question-id":Qe,children:pn},Qe);let _r=sn[Qe],Ba=Aa(Sr);return j("div",{"data-question-id":Qe,children:[j("div",{className:"flex items-center gap-2.5 mb-3",children:[M("span",{className:"inline-flex items-center rounded-lg border border-[#e7e5e0] bg-[#f1efe9] px-3 py-1 text-xs font-bold tracking-tight text-[#1d2025]",children:v("question",{index:Oa+1})}),M(Vi,{score:_r?{s:_r.score,m:_r.maxScore,awaiting:_r.awaiting}:null,weight:Ba,t:v})]}),pn]},Qe)},renderSeparator:Sr=>M("div",{className:"border-t border-[#e7e5e0] my-1"},`qsep-${Sr}`)}):me;return j("div",{"data-exercise-id":Q.id,className:"bg-white rounded-[14px] border border-[#e7e5e0] shadow-sm overflow-hidden",children:[j("div",{className:"flex items-center justify-between px-4 py-2.5 bg-[#f1efe9] border-b border-[#e7e5e0]",style:q?{backgroundColor:q}:void 0,children:[M("span",{className:"text-sm font-bold text-[#1d2025]",children:v("exercise",{index:Ge+1})}),fe?.awaiting?j("span",{className:"inline-flex items-center gap-1 text-xs font-semibold text-[#8a5a08] bg-[#fbf1dc] border border-[#f2e2bf] rounded-full px-2 py-0.5",children:[M(pr,{size:11}),v("pendingReview")]}):fe?j("span",{className:"font-bold leading-none tabular-nums",style:{fontFamily:'var(--font-hand, "Caveat", cursive)',fontSize:"1.15rem",color:fe.maxScore>0&&fe.score>=fe.maxScore?"#1f8a4c":fe.maxScore>0&&fe.score>0?"#c8810e":fe.maxScore>0?"#d23b2b":"#8d93a0"},children:[je(fe.score)," / ",je(fe.maxScore)]}):Oe>0?j("span",{className:"text-xs font-semibold text-[#8d93a0] tabular-nums",children:["/ ",je(Oe)," ",v("points")]}):null]}),M("div",{className:"p-4",children:$e})]},Q.id)},[v,on,sn,q,A,p,Ve,Y]),lt=dr(Q=>j("div",{className:"flex items-center gap-3 py-2",children:[M("div",{className:"flex-1 border-t border-dashed border-[#e7e5e0]"}),M("span",{className:"text-[10px] font-bold text-[#8d93a0] uppercase tracking-widest",children:v("exercise",{index:Q+2})}),M("div",{className:"flex-1 border-t border-dashed border-[#e7e5e0]"})]},`sep-${Q}`),[v]),Ce=U!==null,kr=U?.showVerdict!==!1,Rr=kr?U?.passed?"#1f8a4c":"#d23b2b":"#1d2025";return M("div",{className:"edpire-scope",style:{display:"contents"},children:j("div",{dir:m,className:be("flex flex-col",P?"h-full":"h-dvh"),style:_?{fontFamily:_}:void 0,children:[M(ma,{visible:Z&&!ot,hasAiNodes:Da,text:v("evaluating"),aiText:v("aiEvaluating"),contained:P,...h}),ot&&j("div",{className:be("fixed inset-0 z-50 flex flex-col items-center justify-center gap-3 bg-red-950/80 backdrop-blur-sm",P&&"absolute"),children:[M(pr,{size:40,className:"text-red-300"}),M("p",{className:"text-xl font-black text-white tracking-tight",children:v("timeUp.title")}),M("p",{className:"text-sm text-red-200",children:v("timeUp.submitting")})]}),j("div",{className:"sticky top-0 z-10 flex-shrink-0 flex items-center justify-between px-4 py-2.5 border-b border-[#e7e5e0] bg-[#fbfaf7]",style:q?{backgroundColor:q}:void 0,children:[j("div",{className:"flex items-center gap-3",children:[M("img",{src:n?.logoUrl??$??qi,alt:n?.name??"Edpire",width:24,height:24,loading:"lazy",className:"rounded object-contain"}),j("div",{children:[M("h1",{className:"text-sm font-bold text-[#1d2025]",children:r.title}),M("p",{className:"text-[11px] text-[#8d93a0] capitalize",children:an>0&&j("span",{className:"ms-2 font-semibold text-[#565b66]",children:["/ ",je(an)," ",v("points")]})})]}),!Ce&&S!==null&&a&&a>0&&o&&M(Qi,{timeLimitMinutes:a,startedAt:o,onExpire:ja}),!Ce&&(c==="saving"||c==="saved")&&j("span",{role:"status",className:"hidden sm:inline-flex items-center gap-1 text-[11px] font-medium text-[#8d93a0]",children:[c==="saved"?M(Bi,{size:12}):M(Vt,{size:12,className:"animate-spin"}),v(c==="saved"?"answersSaved":"answersSaving")]})]}),j("div",{className:"flex items-center gap-2",children:[g&&j("button",{onClick:R,className:"flex items-center gap-1.5 px-3 py-2 text-sm font-medium text-[#565b66] hover:text-[#1d2025] hover:bg-[#f1efe9] rounded-lg transition-colors",children:[M(ji,{size:13}),v("reset")]}),(!Ce||p)&&y&&j("button",{onClick:y,className:"flex items-center gap-1.5 px-3 py-2 text-sm font-medium text-[#565b66] hover:text-[#1d2025] hover:bg-[#f1efe9] rounded-lg transition-colors",children:[M(Gt,{size:13}),u??v("back")]}),k&&M("button",{onClick:k,className:"p-1.5 text-[#8d93a0] hover:text-[#1d2025] hover:bg-[#f1efe9] rounded-lg transition-colors",children:M(Gt,{size:15})}),!Ce&&M("button",{onClick:()=>ne(!0),disabled:Z,style:T?{backgroundColor:T}:void 0,className:"flex items-center gap-2 px-4 py-2 bg-[#1d2025] text-white text-sm font-semibold rounded-lg hover:bg-[#31353c] transition-colors disabled:opacity-50",children:Z?j(Qt,{children:[M(Vt,{size:14,className:"animate-spin"}),v("submitting")]}):j(Qt,{children:[M(Ra,{size:14}),v("submit")]})})]})]}),rn&&M("div",{className:"flex-shrink-0 bg-[#fdeeec] border-b border-[#f6cfc9] px-4 py-2 text-sm text-[#a32b1e]",children:rn}),!Ce&&c==="failed"&&j("div",{role:"alert",className:"flex-shrink-0 flex items-center gap-2 bg-[#fbf1dc] border-b border-[#f2e2bf] px-4 py-2 text-sm font-semibold text-[#8a5a08]",children:[M(Wi,{size:15,className:"flex-shrink-0"}),v("answersNotSaved")]}),!Ce&&H&&(Y.size>0||le!==null)&&j("div",{role:"status",className:"flex-shrink-0 flex items-center gap-2 bg-[#f5f4f1] border-b border-[#e7e5e0] px-4 py-2 text-sm text-[#1d2025]",children:[le!==null&&M(pr,{size:15,className:"flex-shrink-0 text-[#565b66]"}),j("span",{className:"flex-1 min-w-0",children:[Y.size>0?v("resumeRestored"):v("resumeFresh"),le!==null&&j(Qt,{children:[" ",v("resumeTimeLeft",{minutes:le})]})]}),M("button",{type:"button",onClick:()=>V(!1),"aria-label":v("close"),className:"flex-shrink-0 p-1 rounded-md text-[#8d93a0] hover:text-[#1d2025] hover:bg-[#e7e5e0] transition-colors",children:M(Gt,{size:14})})]}),Ce&&U&&(U.awaitingManualGrading?M("div",{className:"flex-shrink-0 border-b bg-[#fbf1dc] border-[#f2e2bf]",children:M("div",{className:"mx-auto px-6 py-4",style:{maxWidth:L},children:j("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-4",children:[j("div",{className:"flex items-center gap-2",children:[M(pr,{size:20,className:"text-[#c8810e] flex-shrink-0"}),M("span",{className:"text-sm font-semibold text-[#8a5a08]",children:U.aiPending?v("beingMarked"):v("awaitingReview")})]}),M("div",{className:"hidden sm:block w-px h-8 bg-[#f2e2bf]"}),M("p",{className:"text-sm text-[#8a5a08] flex-1 min-w-0",children:U.aiPending?v("beingMarkedDesc"):v("awaitingReviewDesc")}),x&&j("button",{onClick:cn,style:T?{backgroundColor:T}:void 0,className:"flex-shrink-0 flex items-center gap-2 px-4 py-2 bg-[#1d2025] text-white text-sm font-semibold rounded-lg hover:bg-[#31353c] transition-colors",children:[M(Sa,{size:14}),f??v("viewFullReport")]})]})})}):M("div",{className:be("flex-shrink-0 border-b",kr?U.passed?"bg-[#ecf8f0] border-[#c5e8d1]":"bg-[#fdeeec] border-[#f6cfc9]":"bg-[#f5f4f1] border-[#e7e5e0]"),children:M("div",{className:"mx-auto px-6 py-4",style:{maxWidth:L},children:j("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-4",children:[j("div",{className:"flex items-center gap-2",children:[kr?U.passed?M(Di,{size:20,className:"text-[#1f8a4c] flex-shrink-0"}):M(Fi,{size:20,className:"text-[#d23b2b] flex-shrink-0"}):null,M("span",{className:"text-sm font-semibold",style:{color:Rr},children:kr?U.passed?v("assessmentPassed"):v("assessmentNotPassed"):v("yourScore")})]}),M("div",{className:"hidden sm:block w-px h-8 bg-[#e7e5e0]"}),j("div",{className:"flex items-baseline gap-1.5",children:[j("span",{className:"leading-none tabular-nums",style:{fontFamily:'var(--font-hand, "Caveat", cursive)',fontSize:"2rem",color:Rr},children:[je(U.totalScore)," / ",je(U.maxScore)]}),M("span",{className:"text-sm text-[#8d93a0] font-medium",children:v("points")})]}),j("div",{className:"flex-1 flex items-center gap-3 min-w-0",children:[M("div",{className:"flex-1 h-2 bg-[#e7e5e0] rounded-full overflow-hidden min-w-[80px]",children:M("div",{className:"h-full rounded-full transition-all duration-700",style:{width:`${U.percentage}%`,backgroundColor:Rr}})}),j("span",{className:"text-sm font-bold tabular-nums flex-shrink-0",style:{color:Rr},children:[U.percentage,"%"]})]}),x&&j("button",{onClick:cn,style:T?{backgroundColor:T}:void 0,className:"flex-shrink-0 flex items-center gap-2 px-4 py-2 bg-[#1d2025] text-white text-sm font-semibold rounded-lg hover:bg-[#31353c] transition-colors",children:[M(Sa,{size:14}),f??v("viewFullReport")]})]})})})),M("div",{className:be("flex-1 overflow-hidden flex flex-col",ot&&"pointer-events-none opacity-60"),children:e.annex?M(fa,{assessment:e,isSubmitted:Ce,setAnswers:w,validationFeedback:it,renderExercise:ct,renderSeparator:lt,primaryColor:T,contained:P,locale:at(t),contentMaxWidth:L,t:v}):C?M(ga,{assessment:e,isSubmitted:Ce,setAnswers:w,validationFeedback:it,renderExercise:ct,renderSeparator:lt,primaryColor:T,contained:P,locale:at(t),contentMaxWidth:L,t:v,onAddAnnex:C}):M("div",{className:"flex-1 overflow-y-auto",children:M("div",{className:"mx-auto p-6 flex flex-col gap-4",style:{maxWidth:L},children:M(De,{assessment:e,onAnswersChange:Ce?void 0:w,validationFeedback:it,renderExercise:ct,renderSeparator:lt,locale:at(t)})})})}),W&&M("div",{className:"fixed bottom-2 end-3 text-[20px] text-black/20 pointer-events-none select-none z-10",children:v("poweredBy")}),oe&&M("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",children:j("div",{className:"bg-white rounded-[14px] shadow-xl p-6 max-w-sm mx-4",children:[M("h3",{className:"text-base font-bold text-[#1d2025] mb-2",children:v("confirmTitle")}),st>0&&j("p",{className:"flex items-start gap-2 text-sm font-semibold text-[#8a5a08] bg-[#fbf1dc] border border-[#f2e2bf] rounded-lg px-3 py-2 mb-3",children:[M(Oi,{size:15,className:"flex-shrink-0 mt-px"}),M("span",{children:st===1?v("unansweredOne"):v("unansweredMany",{count:st})})]}),M("p",{className:"text-sm text-[#565b66] mb-5",children:v("confirmDescription")}),j("div",{className:"flex gap-3 justify-end",children:[M("button",{onClick:()=>ne(!1),className:"px-4 py-2 text-sm font-medium text-[#565b66] hover:bg-[#f1efe9] rounded-lg transition-colors",children:v("confirmCancel")}),j("button",{onClick:Fa,disabled:Z,style:T?{backgroundColor:T}:void 0,className:"flex items-center gap-2 px-4 py-2 bg-[#1d2025] text-white text-sm font-semibold rounded-lg hover:bg-[#31353c] transition-colors disabled:opacity-50",children:[Z?M(Vt,{size:14,className:"animate-spin"}):M(Ra,{size:14}),v("confirmSubmit")]})]})]})})]})})}function Jt(e){return(e??[]).map(r=>({exerciseId:r.exercise_id,questions:r.questions.map(t=>({questionId:t.question_id,nodeResults:t.node_results.map(n=>({nodeId:n.node_id,status:n.status,score:n.score,maxScore:n.max_score,...n.feedback!==void 0?{feedback:n.feedback}:{},...n.display_answer!==void 0?{displayAnswer:n.display_answer}:{},...n.detail!==void 0?{detail:n.detail}:{},...n.teacher_feedback!==void 0?{teacherFeedback:n.teacher_feedback}:{}}))}))}))}import{jsx as Ji}from"react/jsx-runtime";function Xt(e,r){let t=Jt(e.exercise_feedback);return{submissionId:e.submission_id,totalScore:e.score,maxScore:e.max_score,percentage:e.percentage,passed:e.passed,returnUrl:r??null,exerciseFeedback:t,awaitingManualGrading:e.awaiting_manual_grading??!1,aiPending:e.ai_pending??!1}}function Zt(e){return{annex:e.annex??void 0,exercises:e.exercises.map(r=>({id:r.id,sharedContext:r.sharedContext,questions:r.questions.map(t=>({id:t.id,version:"1.0",content:t.content,answerKeys:[]}))}))}}function Ea({token:e,data:r,baseUrl:t,options:n}){let{locale:a,branding:o,returnUrl:s,reportLabel:i,backLabel:c,onBack:d,overlayConfig:l,layout:p,mediaHandler:x,onComplete:f,onError:y}=n,u=o??r.branding??void 0,g=a??r.meta.language??"en",R=Yi(()=>Zt(r.assessment),[r]),[h]=Ki(()=>new Date().toISOString()),P=Pa(async k=>{let A=await fetch(`${t}/api/v1/embed/submit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:e,answers:k})});if(!A.ok){let $=await A.json().catch(()=>({})),v=typeof $.error=="string"?$.error:"Submission failed",m=A.status===401?"TOKEN_INVALID":A.status===409?"TOKEN_USED":A.status===404?"ASSESSMENT_NOT_FOUND":"UNKNOWN";throw y?.({code:m,message:v}),new Error(v)}let C=await A.json();return f?.(C),Xt(C,s)},[t,e,f,y,s]),b=Pa(k=>{if(s)try{let A=new URL(s);A.searchParams.set("submission_id",k.submissionId),k.awaitingManualGrading||(A.searchParams.set("score",String(k.totalScore)),A.searchParams.set("max_score",String(k.maxScore))),window.location.href=A.toString()}catch{window.location.href=s}},[s]);return Ji(vr,{assessment:R,meta:{title:r.meta.title,category:r.meta.category??null},locale:g,branding:u,timeLimitMinutes:r.meta.settings.time_limit_minutes,startedAt:h,onSubmit:P,onViewReport:s?b:void 0,reportLabel:i,onBack:d,backLabel:c,overlayConfig:l,layout:p,mediaHandler:x})}import{useMemo as Ma}from"react";import{jsx as Zi}from"react/jsx-runtime";function Xi(){return Promise.reject(new Error("A review cannot be submitted"))}function Ia({review:e,locale:r,branding:t,layout:n,onBack:a,backLabel:o}){let s=Ma(()=>Zt(e.assessment),[e]),i=Ma(()=>({answers:e.answers,result:Xt({submission_id:e.submission.id,score:e.submission.score,max_score:e.submission.max_score,percentage:e.submission.percentage,passed:e.submission.passed,awaiting_manual_grading:e.submission.awaiting_manual_grading,ai_pending:e.submission.ai_pending,exercise_feedback:e.exercise_feedback})}),[e]),c=r??e.meta.language??"en";return Zi(vr,{assessment:s,meta:{title:e.meta.title,category:e.meta.category??null},locale:c,branding:t??e.branding??void 0,review:i,onSubmit:Xi,onBack:a,backLabel:o,layout:n})}import sf from"react";import{createRoot as lf}from"react-dom/client";var ec="https://edpire.com";function $a(e,r,t){e.textContent="";let n=document.createElement("div");n.style.cssText="padding:32px;text-align:center;color:#dc2626;font-family:sans-serif";let a=document.createElement("div");if(a.textContent=r,n.appendChild(a),t){let o=document.createElement("div");o.style.cssText="margin-top:8px;font-size:13px;color:#6b7280",o.textContent=t,n.appendChild(o)}e.appendChild(n)}var za={mount(e){let{token:r,container:t,baseUrl:n=ec,onError:a}=e,o=typeof t=="string"?document.querySelector(t):t;if(!o){let d={code:"UNKNOWN",message:`Container not found: ${t}`};return a?.(d),{unmount:()=>{}}}let s=null,i=!1;function c(){if(i)return;i=!0;let d=s;s=null,setTimeout(()=>{d?.unmount()},0)}return(async()=>{o.innerHTML='<div style="padding:32px;text-align:center;color:#6b7280;font-family:sans-serif">Loading assessment\u2026</div>';let d;try{let l=await fetch(`${n}/api/v1/embed/assessments?token=${encodeURIComponent(r)}`,{method:"GET"});if(!l.ok){let p=await l.json().catch(()=>({})),x=typeof p.error=="string"?p.error:"Failed to load assessment",f=l.status===401?"TOKEN_INVALID":l.status===403?"ORIGIN_NOT_ALLOWED":l.status===404?"ASSESSMENT_NOT_FOUND":"UNKNOWN";a?.({code:f,message:x});let y=f==="ORIGIN_NOT_ALLOWED"?`Add ${typeof location<"u"?location.origin:"this origin"} to Allowed Embed Origins in Edpire, under Integrations then Origins.`:"";$a(o,x,y);return}d=await l.json()}catch{a?.({code:"NETWORK_ERROR",message:"Failed to connect to Edpire"}),$a(o,"Failed to connect to Edpire. Please try again.","");return}i||(o.innerHTML="",s=Ta(o),s.render(La.createElement(Ea,{token:r,data:d,baseUrl:n,options:e})))})(),{unmount:c}},review(e){let{container:r,...t}=e,n=typeof r=="string"?document.querySelector(r):r;if(!n)return{unmount:()=>{}};n.textContent="";let a=Ta(n);return a.render(La.createElement(Ia,t)),{unmount(){let o=a;a=null,setTimeout(()=>o?.unmount(),0)}}}};import{jsx as nc}from"react/jsx-runtime";function tc({tokenEndpoint:e,assessmentId:r,tokenBody:t,className:n,style:a,onComplete:o,onError:s,...i}){let c=en(null),d=en(o);d.current=o;let l=en(s);return l.current=s,rc(()=>{let p=c.current;if(!p)return;let x=!1,f=null;return(async()=>{let y;try{let u=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({assessmentId:r,...t})});if(x)return;if(!u.ok){let R=await u.json().catch(()=>({}));l.current?.({code:"TOKEN_INVALID",message:typeof R.error=="string"?R.error:`Token endpoint returned ${u.status}`});return}let g=await u.json();if(!g.token){l.current?.({code:"TOKEN_INVALID",message:"Token endpoint did not return a token"});return}y=g.token}catch{x||l.current?.({code:"NETWORK_ERROR",message:"Failed to fetch embed token"});return}x||(f=za.mount({token:y,container:p,...i,onComplete:u=>d.current?.(u),onError:u=>l.current?.(u)}))})(),()=>{x=!0,f?.unmount()}},[e,r]),nc("div",{ref:c,className:n,style:n?void 0:a??{width:"100%",height:"100%"}})}export{vr as AssessmentShell,tc as EdpireAssessmentPlayer,pa as EdpireQuestion};
65
+ `}),he("div",{style:{background:r},className:`${c?"absolute":"fixed"} inset-0 z-[60] flex items-center justify-center`,children:Zt("div",{className:"flex flex-col items-center gap-5 bg-white rounded-2xl shadow-2xl px-10 py-8 max-w-xs text-center",children:[(()=>{if(s)return he("img",{src:s,alt:"",className:"w-24 h-24 object-contain"});switch(a){case"dots":return he(Ki,{accent:t});case"pulse":return he(Ji,{accent:t});case"bars":return he(Xi,{accent:t});default:return he(Yi,{accent:t})}})(),he("p",{className:"text-sm font-semibold text-slate-800",children:n}),i&&he("p",{className:"text-xs text-slate-500 leading-snug",children:o})]})})]}):null}import{useCallback as Lo,useEffect as ec,useMemo as To,useRef as ut,useState as rc}from"react";import{BookOpen as $o,X as tc}from"lucide-react";import{Fragment as oc,jsx as ce,jsxs as Ne}from"react/jsx-runtime";function en(e){return e.exercises.flatMap((r,t)=>r.sharedContext&&kr(r.sharedContext)?[{id:r.id,index:t,content:r.sharedContext}]:[])}var zo=()=>typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;function nc(e){e.removeAttribute("data-flash"),e.offsetWidth,e.setAttribute("data-flash","true"),setTimeout(()=>e.removeAttribute("data-flash"),1200)}function Do({assessment:e,isSubmitted:r,setAnswers:t,validationFeedback:n,renderExercise:o,renderSeparator:a,primaryColor:s,contained:i=!1,locale:c,contentMaxWidth:l,t:d,footer:m}){let[y,b]=rc(!1),S=e.annex,f=S?.tabLabel||d("annexDocuments"),g=To(()=>en(e),[e]),w=ut(null),h=ut(null),_=ut(null),u=ut(null),x=()=>(w.current?.getClientRects().length??0)>0,A=Lo((P,q)=>{let v=P?.querySelector(`[data-reference-for="${CSS.escape(q)}"]`);if(!P||!v)return;let M=v.getBoundingClientRect().top-P.getBoundingClientRect().top+P.scrollTop-12;P.scrollTo({top:M,behavior:zo()?"auto":"smooth"}),nc(v)},[]),E=Lo(P=>{if(x()){A(h.current,P);return}b(!0),requestAnimationFrame(()=>requestAnimationFrame(()=>A(u.current,P)))},[A]),$=P=>{let q=x()?w.current:_.current;x()||b(!1),Array.from(q?.querySelectorAll(`[data-exercise-id="${CSS.escape(P)}"]`)??[]).find(M=>M.getClientRects().length>0)?.scrollIntoView({behavior:zo()?"auto":"smooth",block:"start"})};ec(()=>{let P=w.current;if(!P||g.length===0||typeof IntersectionObserver>"u")return;let q=new Set(g.map(F=>F.id)),v=null,M=new IntersectionObserver(F=>{if(!x())return;let O=F.filter(V=>V.isIntersecting&&q.has(V.target.dataset.exerciseId??"")).sort((V,U)=>V.boundingClientRect.top-U.boundingClientRect.top)[0]?.target?.dataset.exerciseId;!O||O===v||(v=O,A(h.current,O))},{root:P,rootMargin:"0px 0px -60% 0px"});return P.querySelectorAll("[data-exercise-id]").forEach(F=>M.observe(F)),()=>M.disconnect()},[g,A]);let k=To(()=>({label:f,showExerciseReference:E}),[f,E]),p=Ne(oc,{children:[S?.items.map(P=>ce(Sr,{item:P},P.id)),S?.items.length&&g.length?ce("div",{className:"border-t border-[#e7e5e0]"}):null,g.map(P=>Ne("section",{"data-reference-for":P.id,className:"-mx-3 flex flex-col gap-2 rounded-[10px] px-3 py-2 transition-colors duration-700 data-[flash=true]:bg-[#fbf1dc] data-[flash=true]:duration-150",children:[ce("button",{type:"button",onClick:()=>$(P.id),className:"self-start cursor-pointer text-xs font-bold uppercase tracking-widest text-[#565b66] underline-offset-4 hover:text-[#1d2025] hover:underline focus-visible:outline-2 focus-visible:outline-[#1d2025] rounded-sm",children:d("exercise",{index:P.index+1})}),ce(pt,{content:P.content})]},P.id))]}),T=ce(Ye,{assessment:e,onAnswersChange:r?void 0:t,validationFeedback:n,renderExercise:o,renderSeparator:a,locale:c});return ce(it,{value:k,children:Ne("div",{className:xe("@container flex-1 min-h-0 flex",i&&"relative"),children:[Ne("div",{ref:w,className:"hidden @6xl:flex flex-1 gap-4 p-4 bg-[#f5f4f1] items-start overflow-y-auto",children:[Ne("div",{className:"flex-1 sticky top-4 max-h-[calc(100svh-6rem)] flex flex-col bg-white rounded-[14px] border border-[#e7e5e0] shadow-sm overflow-hidden",children:[Ne("div",{className:"flex items-center gap-2 px-5 py-3 border-b border-[#e7e5e0] flex-shrink-0",children:[ce($o,{size:14,className:"text-[#8d93a0]"}),ce("span",{className:"text-xs font-bold text-[#565b66] uppercase tracking-widest",children:f})]}),ce("div",{ref:h,className:"flex-1 overflow-y-auto px-6 py-5 flex flex-col gap-6",children:p})]}),ce("div",{className:"w-px bg-[#e7e5e0] flex-shrink-0 self-stretch my-1 rounded-full"}),ce("div",{className:"flex-1 bg-white rounded-[14px] border border-[#e7e5e0] shadow-sm",children:Ne("div",{className:"px-6 py-5 flex flex-col gap-4",children:[T,m]})})]}),Ne("div",{className:"@6xl:hidden flex-1 relative overflow-hidden",children:[ce("div",{ref:_,className:"absolute inset-0 overflow-y-auto",children:Ne("div",{className:"mx-auto px-5 py-5 flex flex-col gap-4",style:{maxWidth:l},children:[T,m]})}),y&&ce("div",{className:xe("inset-0 z-30 bg-black/25",i?"absolute":"fixed"),onClick:()=>b(!1)}),Ne("div",{role:"dialog","aria-label":f,"aria-hidden":!y,className:xe("top-1/2 start-2 -translate-y-1/2 z-40 w-[88%] bg-[#f1efe9] rounded-2xl shadow-2xl flex flex-col overflow-hidden transition-transform duration-300 ease-in-out",i?"absolute":"fixed",y?"translate-x-0":"-translate-x-[110%] rtl:translate-x-[110%]"),children:[Ne("div",{className:"flex items-center justify-between px-5 py-3 flex-shrink-0",children:[ce("span",{className:"text-sm font-bold text-[#1d2025]",children:f}),ce("button",{onClick:()=>b(!1),"aria-label":d("close"),className:"p-1 text-[#8d93a0] hover:text-[#1d2025] rounded-lg transition-colors",children:ce(tc,{size:18})})]}),ce("div",{ref:u,className:"overflow-y-auto max-h-[calc(100vh-8rem)] px-5 pb-5 flex flex-col gap-5",children:p})]})]}),!y&&Ne("button",{onClick:()=>b(!0),"aria-label":f,style:{transform:"translateY(-50%)",...s?{backgroundColor:s}:{}},className:xe("@6xl:hidden top-1/2 start-0 z-20 flex flex-col items-center gap-1 py-3 px-1.5 bg-[#1d2025] text-white text-[10px] font-bold uppercase tracking-wider rounded-e-lg shadow-md hover:bg-[#31353c] transition-colors",i?"absolute":"fixed"),children:[ce($o,{size:12}),ce("span",{style:{writingMode:"vertical-rl",transform:"rotate(180deg)"},children:f})]})]})})}import{useState as ac}from"react";import{BookOpen as Fo,Plus as sc,X as ic}from"lucide-react";import{jsx as me,jsxs as qe}from"react/jsx-runtime";function Oo({assessment:e,isSubmitted:r,setAnswers:t,validationFeedback:n,renderExercise:o,renderSeparator:a,primaryColor:s,contained:i=!1,locale:c,contentMaxWidth:l,t:d,onAddAnnex:m,footer:y}){let[b,S]=ac(!1),f=me(Ye,{assessment:e,onAnswersChange:r?void 0:t,validationFeedback:n,renderExercise:o,renderSeparator:a,locale:c});if(b)return me("div",{className:"flex-1 overflow-y-auto",children:qe("div",{className:"mx-auto p-6 flex flex-col gap-4",style:{maxWidth:l},children:[f,y]})});let g=_=>{(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),m())},w=_=>qe("span",{style:s?{backgroundColor:s}:void 0,className:xe("flex-none inline-flex items-center gap-1.5 rounded-lg bg-[#1d2025] text-white font-semibold shadow-sm group-hover:shadow-md transition-shadow",_?"px-3 py-1.5 text-xs":"mt-1 px-3.5 py-2 text-xs"),children:[me(sc,{size:13}),d("annexEmptyCta")]}),h=_=>me("button",{type:"button",onClick:u=>{u.stopPropagation(),S(!0)},"aria-label":d("annexEmptyDismiss"),title:d("annexEmptyDismiss"),className:xe("flex-none flex items-center justify-center w-7 h-7 rounded-lg text-[#8d93a0] hover:text-[#1d2025] hover:bg-[#f1efe9] transition-colors cursor-pointer",_&&"absolute top-2 end-2 z-10"),children:me(ic,{size:15})});return qe("div",{className:xe("@container flex-1 min-h-0 flex",i&&"relative"),children:[qe("div",{className:"hidden @6xl:flex flex-1 gap-4 p-4 bg-[#f5f4f1] items-start overflow-y-auto",children:[me("div",{className:"flex-1 sticky top-4 flex min-h-[200px] max-h-[calc(100svh-6rem)]",children:qe("div",{role:"button",tabIndex:0,onClick:m,onKeyDown:g,className:"group relative flex-1 w-full flex flex-col items-center justify-center gap-3 text-center rounded-[14px] border-2 border-dashed border-[#d6d3cc] bg-white/60 hover:border-[#8d93a0] hover:bg-white transition-colors cursor-pointer px-6 py-8 outline-none focus-visible:ring-2 focus-visible:ring-[#8d93a0] focus-visible:ring-offset-2",children:[h(!0),me("span",{className:"flex items-center justify-center w-11 h-11 rounded-full bg-[#f1efe9] text-[#8d93a0] group-hover:text-[#1d2025] transition-colors",children:me(Fo,{size:20})}),me("span",{className:"text-sm font-bold text-[#565b66]",children:d("annexEmptyTitle")}),me("span",{className:"text-xs text-[#8d93a0] max-w-[32ch] leading-relaxed",children:d("annexEmptyBody")}),w(!1)]})}),me("div",{className:"w-px bg-[#e7e5e0] flex-shrink-0 self-stretch my-1 rounded-full"}),me("div",{className:"flex-1 bg-white rounded-[14px] border border-[#e7e5e0] shadow-sm",children:qe("div",{className:"px-6 py-5 flex flex-col gap-4",children:[f,y]})})]}),me("div",{className:"@6xl:hidden flex-1 overflow-y-auto",children:qe("div",{className:"mx-auto px-5 py-5 flex flex-col gap-4",style:{maxWidth:l},children:[qe("div",{role:"button",tabIndex:0,onClick:m,onKeyDown:g,className:"group flex items-center gap-3 rounded-[14px] border-2 border-dashed border-[#d6d3cc] bg-white/60 hover:border-[#8d93a0] hover:bg-white transition-colors cursor-pointer px-4 py-2.5 outline-none focus-visible:ring-2 focus-visible:ring-[#8d93a0]",children:[me("span",{className:"flex-none flex items-center justify-center w-9 h-9 rounded-full bg-[#f1efe9] text-[#8d93a0] group-hover:text-[#1d2025] transition-colors",children:me(Fo,{size:16})}),qe("div",{className:"flex-1 min-w-0",children:[me("div",{className:"text-xs font-bold text-[#565b66]",children:d("annexEmptyTitle")}),me("div",{className:"text-[11px] text-[#8d93a0] leading-snug",children:d("annexEmptyBody")})]}),w(!0),h(!1)]}),f,y]})})]})}function rn(e){let r=new Map;for(let t of e){let n=new Map;for(let o of t.questions){let a=new Map;for(let s of o.nodeResults){let i={state:s.status,showFeedback:!0,score:s.score,...s.feedback!==void 0?{message:s.feedback}:{},...s.displayAnswer!==void 0?{displayAnswer:s.displayAnswer}:{},...s.teacherFeedback!==void 0?{teacherFeedback:s.teacherFeedback}:{}};s.detail?.type==="choiceSet"?i.correctChoiceIds=s.detail.correctChoiceIds:s.detail?.type==="matchingSet"&&(i.pairFeedback=s.detail.pairFeedback,i.correctPairings=s.detail.correctPairings),a.set(s.nodeId,i)}n.set(o.questionId,a)}r.set(t.exerciseId,n)}return r}var cc=new Set(["choiceSet","inlineChoiceSet","blank","aiAnswerInput","matchingSet","openResponseNode","mathResponse","codingResponse"]),lc=new Set(["blankPool","inlinePool"]);function dc(e){switch(e.type){case"choiceSet":case"inlineChoiceSet":return e.answer.selectedIds.length>0;case"blank":return e.answer.mode==="choice"?e.answer.choiceId.length>0:e.answer.text.trim().length>0;case"matchingSet":return e.answer.connections.length>0;case"aiAnswer":return e.answer.text.trim().length>0;case"openResponse":{let r=e.answer;return r.recording||r.files&&r.files.length>0?!0:(r.text?.wordCount??0)>0}case"mathResponse":return e.answer.latex.trim().length>0;case"codingResponse":return e.answer.source.trim().length>0;default:{let r=e;return!0}}}function pc(e){let r=0,t=n=>{if(Array.isArray(n)){for(let s of n)t(s);return}if(!n||typeof n!="object")return;let{type:o,content:a}=n;if(typeof o=="string"){if(cc.has(o)){r+=1;return}if(lc.has(o))return}a!==void 0&&t(a)};return t(e),r}function jo(e,r){let t=new Map;for(let o of r?.exerciseAnswers??[])for(let a of o.questionAnswers){let s=t.get(a.questionId);s||(s=new Set,t.set(a.questionId,s));for(let i of a.answers)dc(i)&&s.add(i.nodeId)}let n=[];return e.exercises.forEach((o,a)=>{o.questions.forEach((s,i)=>{let c=pc(s.content);c!==0&&(t.get(s.id)?.size??0)<c&&n.push({questionId:s.id,exerciseIndex:a,questionIndex:i,only:o.questions.length===1})})}),n}var mc={exercise:"Exercise {index}",question:"Question {index}",points:"pts","points.one":"pt",submit:"Submit Assessment",submitting:"Submitting...",confirmTitle:"Submit Assessment",confirmDescription:"Are you sure you want to submit? You cannot change your answers after submitting.",unansweredOne:"1 question is not fully answered.",unansweredMany:"{count} questions are not fully answered.",unansweredMore:"and {count} more",confirmSubmit:"Submit",confirmCancel:"Cancel",assessmentPassed:"Assessment passed",assessmentNotPassed:"Assessment not passed",awaitingReview:"Awaiting review",awaitingReviewDesc:"Your teacher is reviewing your open responses. Your final score will be available once grading is complete.",beingMarked:"Being marked",beingMarkedDesc:"Some answers are still being marked. Your final score will be available once every answer is marked.",pendingReview:"Pending review",viewFullReport:"View Full Report",poweredBy:"Powered by Edpire",evaluating:"Evaluating your answers\u2026",aiEvaluating:"Some answers are being reviewed by AI \u2014 this may take a few seconds.",reset:"Reset",back:"Back",annexDocuments:"Documents",annexEmptyTitle:"No reference yet",annexEmptyBody:"A text, figure, table or document that stays in view across the whole assessment while students answer.",annexEmptyCta:"Add reference",annexEmptyDismiss:"Hide","timeUp.title":"Time's up","timeUp.submitting":"Submitting your answers\u2026",yourScore:"Your score",answersSaving:"Saving\u2026",answersSaved:"Answers saved",answersNotSaved:"Your answers aren't being saved. Check your connection.",resumeRestored:"Welcome back. Your answers are here.",resumeFresh:"Welcome back.",resumeTimeLeft:"The clock kept running: {minutes} min left.",close:"Close"},uc={exercise:"Exercice {index}",question:"Question {index}",points:"pts","points.one":"pt",submit:"Soumettre l'\xE9valuation",submitting:"Soumission...",confirmTitle:"Soumettre l'\xE9valuation",confirmDescription:"\xCAtes-vous s\xFBr de vouloir soumettre ? Vous ne pourrez pas modifier vos r\xE9ponses.",unansweredOne:"1 question n'est pas enti\xE8rement remplie.",unansweredMany:"{count} questions ne sont pas enti\xE8rement remplies.",unansweredMore:"et {count} autres",confirmSubmit:"Soumettre",confirmCancel:"Annuler",assessmentPassed:"\xC9valuation r\xE9ussie",assessmentNotPassed:"\xC9valuation non r\xE9ussie",awaitingReview:"En attente de correction",awaitingReviewDesc:"Votre professeur examine vos r\xE9ponses ouvertes. Votre note finale sera disponible une fois la correction termin\xE9e.",beingMarked:"Correction en cours",beingMarkedDesc:"Certaines r\xE9ponses sont encore en cours de correction. Votre note finale sera disponible d\xE8s que toutes les r\xE9ponses seront corrig\xE9es.",pendingReview:"En attente de correction",viewFullReport:"Voir le rapport complet",poweredBy:"Propuls\xE9 par Edpire",evaluating:"\xC9valuation de vos r\xE9ponses\u2026",aiEvaluating:"Certaines r\xE9ponses sont examin\xE9es par l'IA \u2014 cela peut prendre quelques secondes.",reset:"R\xE9initialiser",back:"Retour",annexDocuments:"Documents",annexEmptyTitle:"Aucune annexe pour l'instant",annexEmptyBody:"Un texte, une figure, un tableau ou un document qui reste visible pour toute l'\xE9valuation pendant que les \xE9l\xE8ves r\xE9pondent.",annexEmptyCta:"Ajouter une annexe",annexEmptyDismiss:"Masquer","timeUp.title":"Temps \xE9coul\xE9","timeUp.submitting":"Envoi de vos r\xE9ponses\u2026",yourScore:"Votre score",answersSaving:"Enregistrement\u2026",answersSaved:"R\xE9ponses enregistr\xE9es",answersNotSaved:"Vos r\xE9ponses ne sont pas enregistr\xE9es. V\xE9rifiez votre connexion.",resumeRestored:"Bon retour. Vos r\xE9ponses sont l\xE0.",resumeFresh:"Bon retour.",resumeTimeLeft:"Le chrono a continu\xE9 : il reste {minutes} min.",close:"Fermer"},fc={exercise:"\u062A\u0645\u0631\u064A\u0646 {index}",question:"\u0633\u0624\u0627\u0644 {index}",points:"\u0646\u0642\u0637\u0629","points.two":"\u0646\u0642\u0637\u062A\u0627\u0646","points.few":"\u0646\u0642\u0627\u0637",submit:"\u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u062A\u0642\u064A\u064A\u0645",submitting:"\u062C\u0627\u0631\u064D \u0627\u0644\u0625\u0631\u0633\u0627\u0644...",confirmTitle:"\u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u062A\u0642\u064A\u064A\u0645",confirmDescription:"\u0647\u0644 \u0623\u0646\u062A \u0645\u062A\u0623\u0643\u062F \u0645\u0646 \u0627\u0644\u0625\u0631\u0633\u0627\u0644\u061F \u0644\u0646 \u062A\u062A\u0645\u0643\u0646 \u0645\u0646 \u062A\u063A\u064A\u064A\u0631 \u0625\u062C\u0627\u0628\u0627\u062A\u0643 \u0628\u0639\u062F \u0627\u0644\u0625\u0631\u0633\u0627\u0644.",unansweredOne:"\u0644\u0645 \u062A\u064F\u0643\u0645\u0644 \u0627\u0644\u0625\u062C\u0627\u0628\u0629 \u0639\u0646 \u0633\u0624\u0627\u0644 \u0648\u0627\u062D\u062F.",unansweredMany:"\u0644\u0645 \u062A\u064F\u0643\u0645\u0644 \u0627\u0644\u0625\u062C\u0627\u0628\u0629 \u0639\u0646 {count} \u0645\u0646 \u0627\u0644\u0623\u0633\u0626\u0644\u0629.",unansweredMore:"\u0648{count} \u0623\u062E\u0631\u0649",confirmSubmit:"\u0625\u0631\u0633\u0627\u0644",confirmCancel:"\u0625\u0644\u063A\u0627\u0621",assessmentPassed:"\u0627\u062C\u062A\u064A\u0627\u0632 \u0627\u0644\u062A\u0642\u064A\u064A\u0645",assessmentNotPassed:"\u0644\u0645 \u064A\u062A\u0645 \u0627\u062C\u062A\u064A\u0627\u0632 \u0627\u0644\u062A\u0642\u064A\u064A\u0645",awaitingReview:"\u0641\u064A \u0627\u0646\u062A\u0638\u0627\u0631 \u0627\u0644\u062A\u0635\u062D\u064A\u062D",awaitingReviewDesc:"\u064A\u0642\u0648\u0645 \u0645\u0639\u0644\u0645\u0643 \u0628\u0645\u0631\u0627\u062C\u0639\u0629 \u0625\u062C\u0627\u0628\u0627\u062A\u0643 \u0627\u0644\u0645\u0641\u062A\u0648\u062D\u0629. \u0633\u062A\u0638\u0647\u0631 \u0639\u0644\u0627\u0645\u062A\u0643 \u0627\u0644\u0646\u0647\u0627\u0626\u064A\u0629 \u0628\u0639\u062F \u0627\u0643\u062A\u0645\u0627\u0644 \u0627\u0644\u062A\u0635\u062D\u064A\u062D.",beingMarked:"\u0642\u064A\u062F \u0627\u0644\u062A\u0635\u062D\u064A\u062D",beingMarkedDesc:"\u0628\u0639\u0636 \u0627\u0644\u0625\u062C\u0627\u0628\u0627\u062A \u0645\u0627 \u0632\u0627\u0644\u062A \u0642\u064A\u062F \u0627\u0644\u062A\u0635\u062D\u064A\u062D. \u0633\u062A\u0638\u0647\u0631 \u0639\u0644\u0627\u0645\u062A\u0643 \u0627\u0644\u0646\u0647\u0627\u0626\u064A\u0629 \u0628\u0639\u062F \u062A\u0635\u062D\u064A\u062D \u062C\u0645\u064A\u0639 \u0627\u0644\u0625\u062C\u0627\u0628\u0627\u062A.",pendingReview:"\u0642\u064A\u062F \u0627\u0644\u062A\u0635\u062D\u064A\u062D",viewFullReport:"\u0639\u0631\u0636 \u0627\u0644\u062A\u0642\u0631\u064A\u0631 \u0627\u0644\u0643\u0627\u0645\u0644",poweredBy:"\u0645\u062F\u0639\u0648\u0645 \u0645\u0646 Edpire",evaluating:"\u062C\u0627\u0631\u064D \u062A\u0642\u064A\u064A\u0645 \u0625\u062C\u0627\u0628\u0627\u062A\u0643\u2026",aiEvaluating:"\u0628\u0639\u0636 \u0627\u0644\u0625\u062C\u0627\u0628\u0627\u062A \u0642\u064A\u062F \u0627\u0644\u0645\u0631\u0627\u062C\u0639\u0629 \u0628\u0627\u0644\u0630\u0643\u0627\u0621 \u0627\u0644\u0627\u0635\u0637\u0646\u0627\u0639\u064A \u2014 \u0642\u062F \u064A\u0633\u062A\u063A\u0631\u0642 \u0630\u0644\u0643 \u0628\u0636\u0639 \u062B\u0648\u0627\u0646\u064D.",reset:"\u0625\u0639\u0627\u062F\u0629 \u062A\u0639\u064A\u064A\u0646",back:"\u0631\u062C\u0648\u0639",annexDocuments:"\u0627\u0644\u0645\u0633\u062A\u0646\u062F\u0627\u062A",annexEmptyTitle:"\u0644\u0627 \u064A\u0648\u062C\u062F \u0645\u064F\u0644\u062D\u064E\u0642 \u0628\u0639\u062F",annexEmptyBody:"\u0646\u0635 \u0623\u0648 \u0635\u0648\u0631\u0629 \u0623\u0648 \u062C\u062F\u0648\u0644 \u0623\u0648 \u0645\u0633\u062A\u0646\u062F \u064A\u0628\u0642\u0649 \u0638\u0627\u0647\u0631\u064B\u0627 \u0637\u0648\u0627\u0644 \u0627\u0644\u062A\u0642\u064A\u064A\u0645 \u0623\u062B\u0646\u0627\u0621 \u0625\u062C\u0627\u0628\u0629 \u0627\u0644\u0637\u0644\u0627\u0628.",annexEmptyCta:"\u0625\u0636\u0627\u0641\u0629 \u0645\u064F\u0644\u062D\u064E\u0642",annexEmptyDismiss:"\u0625\u062E\u0641\u0627\u0621","timeUp.title":"\u0627\u0646\u062A\u0647\u0649 \u0627\u0644\u0648\u0642\u062A","timeUp.submitting":"\u062C\u0627\u0631\u064D \u0625\u0631\u0633\u0627\u0644 \u0625\u062C\u0627\u0628\u0627\u062A\u0643\u2026",yourScore:"\u0646\u062A\u064A\u062C\u062A\u0643",answersSaving:"\u062C\u0627\u0631\u064D \u0627\u0644\u062D\u0641\u0638\u2026",answersSaved:"\u062A\u0645 \u062D\u0641\u0638 \u0627\u0644\u0625\u062C\u0627\u0628\u0627\u062A",answersNotSaved:"\u0644\u0627 \u064A\u062A\u0645 \u062D\u0641\u0638 \u0625\u062C\u0627\u0628\u0627\u062A\u0643. \u062A\u062D\u0642\u0651\u0642 \u0645\u0646 \u0627\u062A\u0635\u0627\u0644\u0643.",resumeRestored:"\u0645\u0631\u062D\u0628\u064B\u0627 \u0628\u0639\u0648\u062F\u062A\u0643. \u0625\u062C\u0627\u0628\u0627\u062A\u0643 \u0647\u0646\u0627.",resumeFresh:"\u0645\u0631\u062D\u0628\u064B\u0627 \u0628\u0639\u0648\u062F\u062A\u0643.",resumeTimeLeft:"\u0627\u0633\u062A\u0645\u0631\u0651 \u0627\u0644\u0645\u0624\u0642\u0651\u062A: \u062A\u0628\u0642\u0651\u0649 {minutes} \u062F\u0642\u064A\u0642\u0629.",close:"\u0625\u063A\u0644\u0627\u0642"},mr={en:mc,fr:uc,ar:fc};function hc(e,r,t){let o=(mr[e]??mr.en)[r]??mr.en[r]??r;return t?Object.entries(t).reduce((a,[s,i])=>a.replace(`{${s}}`,String(i)),o):o}function Bo(e,r){let t=new Intl.PluralRules(e).select(r),n=mr[e]??mr.en;return n[`points.${t}`]??n.points??mr.en.points}function qo(e){return(r,t)=>hc(e,r,t)}function Wo(e){return e==="ar"}function ft(e){return e==="en"?"en":"fr"}var Uo="48rem";import"katex/dist/katex.min.css";rr(`.edpire-annex-layout{display:flex;flex:1;min-width:0;height:100%;overflow:hidden;position:relative}.edpire-annex-main{flex:1;min-width:0;overflow:hidden;display:flex;flex-direction:column}.edpire-annex-panel{width:38%;min-width:calc(280px * var(--edp-scale, 1));max-width:calc(480px * var(--edp-scale, 1));flex-shrink:0;display:flex;flex-direction:column;border-right:1px solid #e5e7eb;background:#fff;overflow:hidden}.edpire-annex-panel__header{flex-shrink:0;padding:calc(12px * var(--edp-scale, 1)) calc(20px * var(--edp-scale, 1));border-bottom:1px solid #f3f4f6;background:#f9fafb}.edpire-annex-panel__header-label{font-size:calc(11px * var(--edp-scale, 1));font-weight:700;text-transform:uppercase;letter-spacing:.08em;color:#6b7280}.edpire-annex-panel__scroll{flex:1;overflow-y:auto;padding:calc(24px * var(--edp-scale, 1)) calc(20px * var(--edp-scale, 1));display:flex;flex-direction:column;gap:calc(32px * var(--edp-scale, 1))}.edpire-annex-tab,.edpire-annex-drawer,.edpire-annex-backdrop{display:none}@media(max-width:1023px){.edpire-annex-panel{display:none}.edpire-annex-tab{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:calc(8px * var(--edp-scale, 1));position:fixed;left:0;top:50%;transform:translateY(-50%);z-index:40;background:var(--edpire-annex-tab-bg, #2563eb);color:var(--edpire-annex-tab-color, #ffffff);border:none;border-radius:0 calc(10px * var(--edp-scale, 1)) calc(10px * var(--edp-scale, 1)) 0;padding:calc(18px * var(--edp-scale, 1)) calc(10px * var(--edp-scale, 1));cursor:pointer;box-shadow:2px 2px 16px #0000002e;transition:filter .15s}.edpire-annex-tab:hover{filter:brightness(.88)}.edpire-annex-tab__label{writing-mode:vertical-rl;text-orientation:mixed;transform:rotate(180deg);font-size:calc(11px * var(--edp-scale, 1));font-weight:700;letter-spacing:.07em;text-transform:uppercase;white-space:nowrap}.edpire-annex-drawer{display:flex;flex-direction:column;position:fixed;left:0;top:0;bottom:0;width:min(84vw,calc(440px * var(--edp-scale, 1)));background:#fff;z-index:50;transform:translate(-100%);transition:transform .28s cubic-bezier(.4,0,.2,1);box-shadow:4px 0 32px #00000021;overflow:hidden}.edpire-annex-drawer--open{transform:translate(0)}.edpire-annex-drawer__header{display:flex;align-items:center;justify-content:space-between;padding:calc(16px * var(--edp-scale, 1)) calc(20px * var(--edp-scale, 1));border-bottom:1px solid #f3f4f6;background:#f9fafb;flex-shrink:0}.edpire-annex-drawer__label{font-size:calc(13px * var(--edp-scale, 1));font-weight:700;color:#111827}.edpire-annex-drawer__close{display:flex;align-items:center;justify-content:center;width:calc(28px * var(--edp-scale, 1));height:calc(28px * var(--edp-scale, 1));background:none;border:none;cursor:pointer;font-size:calc(20px * var(--edp-scale, 1));line-height:1;color:#9ca3af;border-radius:calc(6px * var(--edp-scale, 1));transition:color .15s,background .15s}.edpire-annex-drawer__close:hover{color:#111827;background:#f3f4f6}.edpire-annex-drawer__scroll{flex:1;overflow-y:auto;padding:calc(24px * var(--edp-scale, 1)) calc(20px * var(--edp-scale, 1));display:flex;flex-direction:column;gap:calc(32px * var(--edp-scale, 1))}.edpire-annex-backdrop{display:block;position:fixed;inset:0;background:#00000061;z-index:45;cursor:pointer}}
66
+ `);import{Fragment as an,jsx as L,jsxs as j}from"react/jsx-runtime";var kc="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%234f46e5'%3E%3Cpath d='M12 2L2 7v10l10 5 10-5V7L12 2zm0 2.18L19.5 8 12 11.82 4.5 8 12 4.18zM4 9.6l7 3.5v7.3L4 16.9V9.6zm9 10.8v-7.3l7-3.5v7.3L13 20.4z'/%3E%3C/svg%3E";function Rc(e){for(let r of e.exercises)for(let t of r.questions)if((t.content.content??[]).some(o=>o.type==="aiAnswerInput"))return!0;return!1}function Jo(e){let r=e;return typeof r.totalMaxScore=="number"?r.totalMaxScore:(r.answerKeys??[]).reduce((t,n)=>t+(n.scoring?.maxScore??0),0)}function Yo(e){return e.questions.reduce((r,t)=>r+Jo(t),0)}function We(e){return Number.isInteger(e)?String(e):parseFloat(e.toFixed(2)).toString()}var on=5;function Xo(e){return e==="full"?"#1f8a4c":e==="partial"?"#c8810e":"#d23b2b"}function Sc({outcome:e}){let r=e==="full"?"M20 54 L41 75 L82 24":e==="none"?"M27 27 L73 73 M73 27 L27 73":"M14 58 C29 33 40 33 52 51 C64 69 74 69 88 42";return L("svg",{width:14,height:14,viewBox:"0 0 100 100",fill:"none",stroke:Xo(e),strokeWidth:9,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:L("path",{d:r})})}function _c({score:e,weight:r,unit:t,t:n}){if(e){if(e.awaiting)return j("span",{className:"inline-flex items-center gap-1 rounded-lg border border-[#f2e2bf] bg-[#fbf1dc] px-2 py-0.5 text-xs font-semibold text-[#8a5a08]",children:[L(ur,{size:11}),n("pendingReview")]});let o=e.m>0&&e.s>=e.m?"full":e.s>0?"partial":"none";return j("span",{className:"inline-flex items-center gap-1.5 rounded-lg border border-[#e7e5e0] bg-[#f5f4f1] ps-2 pe-2.5 py-0.5",children:[L(Sc,{outcome:o}),j("span",{className:"font-bold leading-none",style:{fontFamily:'var(--font-hand, "Caveat", cursive)',fontSize:"1.05rem",color:Xo(o)},children:[We(e.s)," / ",We(e.m)]})]})}return r>0?j("span",{className:"text-xs font-semibold tabular-nums text-[#8d93a0]",children:[We(r)," ",t(r)]}):null}function Ko(e){let r=new Map;for(let t of e?.exerciseAnswers??[])for(let n of t.questionAnswers)r.set(n.questionId,n.answers);return r}function Nc(e,r){return r.size===0?e:{exerciseAnswers:e.exerciseAnswers.map(t=>({...t,questionAnswers:t.questionAnswers.map(n=>n.answers.length===0&&r.has(n.questionId)?{...n,answers:r.get(n.questionId)}:n)}))}}function Ac({timeLimitMinutes:e,startedAt:r,onExpire:t}){let n=e*6e4,o=new Date(r).getTime()+n,[a,s]=Oe(()=>Math.max(o-Date.now(),0)),i=ht(t);i.current=t,sn(()=>{if(a<=0){i.current();return}let f=setInterval(()=>{let g=Math.max(o-Date.now(),0);s(g),g<=0&&(clearInterval(f),i.current())},1e3);return()=>clearInterval(f)},[o]);let c=a/n,l=c<.1?"bg-[#fdeeec] text-[#a32b1e] border-[#f6cfc9] animate-pulse":c<.25?"bg-[#fbf1dc] text-[#8a5a08] border-[#f2e2bf]":"bg-[#f5f4f1] text-[#565b66] border-[#e7e5e0]",d=Math.ceil(a/1e3),m=Math.floor(d/3600),y=Math.floor(d%3600/60),b=d%60,S=m>0?`${m}:${String(y).padStart(2,"0")}:${String(b).padStart(2,"0")}`:`${y}:${String(b).padStart(2,"0")}`;return j("span",{className:xe("inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full border text-xs font-bold tabular-nums transition-colors",l),children:[L(ur,{size:12}),S]})}function _r({assessment:e,meta:r,locale:t="en",branding:n,timeLimitMinutes:o,startedAt:a,initialAnswers:s,onAnswersChange:i,saveState:c,resumed:l=!1,onSubmit:d,review:m,onViewReport:y,reportLabel:b,onBack:S,backLabel:f,allowReset:g,onReset:w,overlayConfig:h,contained:_=!1,layout:u,onClose:x,mediaHandler:A,onAddAnnex:E,fallbackLogoUrl:$}){let k=Fe(()=>qo(t),[t]),p=Ke(W=>Bo(t,W),[t]),T=Wo(t)?"rtl":"ltr",P=ht(null),q=u?.maxWidth??Uo,v=n?.branding?.primaryColor,M=n?.branding?.accentColor,F=n?.branding?.fontFamily,z=n?.branding?.fontUrl,O=n?.branding?.showPoweredBy!==!1;sn(()=>{if(!z||typeof document>"u"||document.querySelector(`link[href="${z}"]`))return;let se=document.createElement("link");se.rel="stylesheet",se.href=z,document.head.appendChild(se)},[z]);let[V,U]=Oe(()=>m?.answers??s??{exerciseAnswers:[]}),[R]=Oe(()=>m?new Map:Ko(s)),N=ht(i);N.current=i;let D=Ke(W=>{let se=Nc(W,R);U(se),N.current?.(se)},[R]),[H,Q]=Oe(null);sn(()=>{Q(Date.now())},[]);let[ge,ae]=Oe(l&&!m),oe=Fe(()=>{if(H===null||!o||o<=0||!a)return null;let W=new Date(a).getTime()+o*6e4-H;return W>0?Math.max(1,Math.floor(W/6e4)):null},[H,o,a]),[Z,ne]=Oe(!1),[Ae,Ue]=Oe(!1),[Y,mn]=Oe(m?.result??null),un=Fe(()=>Ko(m?.answers),[m]),[fn,Nr]=Oe(null),[gt,hn]=Oe(!1),gn=ht(!1),ia=Fe(()=>Rc(e),[e]),bn=Fe(()=>Ae?jo(e,V):[],[Ae,e,V]),fr=bn.length,ca=Ke(W=>{Ue(!1);let se=P.current?.querySelectorAll(`[data-question-id="${CSS.escape(W)}"]`),Ie=Array.from(se??[]).find(Ce=>Ce.getClientRects().length>0);Ie&&requestAnimationFrame(()=>Ie.scrollIntoView({block:"start",behavior:"smooth"}))},[]),bt=Fe(()=>e.exercises.reduce((W,se)=>W+Yo(se),0),[e]),xt=Fe(()=>Y?rn(Y.exerciseFeedback):void 0,[Y]),xn=Fe(()=>{if(!Y)return{};let W={};for(let se of Y.exerciseFeedback){let Ie=0,Ce=0,ue=!1;for(let tr of se.questions)for(let je of tr.nodeResults)Ie+=je.score,Ce+=je.maxScore,je.status==="awaiting_review"&&(ue=!0);W[se.exerciseId]={score:Ie,maxScore:Ce,awaiting:ue}}return W},[Y]),yn=Fe(()=>{if(!Y)return{};let W={};for(let se of Y.exerciseFeedback)for(let Ie of se.questions){let Ce=0,ue=0,tr=!1;for(let je of Ie.nodeResults)Ce+=je.score,ue+=je.maxScore,je.status==="awaiting_review"&&(tr=!0);W[Ie.questionId]={score:Ce,maxScore:ue,awaiting:tr}}return W},[Y]),la=Ke(async()=>{ne(!0),Nr(null);try{let W=await d(V);mn(W),typeof window<"u"&&window.scrollTo({top:0,behavior:"smooth"})}catch(W){Nr(W instanceof Error?W.message:k("confirmCancel"))}finally{ne(!1),Ue(!1)}},[V,d,k]),vn=Ke(()=>{!Y||!y||y(Y)},[Y,y]),da=Ke(()=>{gn.current||Z||Y||(gn.current=!0,hn(!0),Ue(!1),typeof document<"u"&&document.activeElement?.blur(),setTimeout(()=>{ne(!0),Nr(null),d(V).then(W=>{mn(W),typeof window<"u"&&window.scrollTo({top:0,behavior:"smooth"})}).catch(W=>{Nr(W instanceof Error?W.message:"submit_error")}).finally(()=>{ne(!1),hn(!1)})},800))},[V,Z,d,Y]),yt=Ke((W,se,Ie)=>{let Ce=Yo(W),ue=xn[W.id],tr=W.questions.length>1,je=Vo(se)?Ho(se,{renderQuestion:(Er,kt,ma)=>{let Je=Er.id,wn=R.get(Je),kn={...A?{mediaHandler:A}:{},...m?{initialAnswers:un.get(Je)??[],readOnly:!0}:wn?{initialAnswers:wn}:{}},Rn=Object.keys(kn).length>0&&Vo(kt)?Ho(kt,kn):kt;if(!tr)return L("div",{"data-question-id":Je,children:Rn},Je);let Pr=yn[Je],ua=Jo(Er);return j("div",{"data-question-id":Je,children:[j("div",{className:"flex items-center gap-2.5 mb-3",children:[L("span",{className:"inline-flex items-center rounded-lg border border-[#e7e5e0] bg-[#f1efe9] px-3 py-1 text-xs font-bold tracking-tight text-[#1d2025]",children:k("question",{index:ma+1})}),L(_c,{score:Pr?{s:Pr.score,m:Pr.maxScore,awaiting:Pr.awaiting}:null,weight:ua,unit:p,t:k})]}),Rn]},Je)},renderSeparator:Er=>L("div",{className:"border-t border-[#e7e5e0] my-1"},`qsep-${Er}`)}):se;return j("div",{"data-exercise-id":W.id,className:"bg-white rounded-[14px] border border-[#e7e5e0] shadow-sm overflow-hidden",children:[j("div",{className:"flex items-center justify-between px-4 py-2.5 bg-[#f1efe9] border-b border-[#e7e5e0]",style:M?{backgroundColor:M}:void 0,children:[L("span",{className:"text-sm font-bold text-[#1d2025]",children:k("exercise",{index:Ie+1})}),ue?.awaiting?j("span",{className:"inline-flex items-center gap-1 text-xs font-semibold text-[#8a5a08] bg-[#fbf1dc] border border-[#f2e2bf] rounded-full px-2 py-0.5",children:[L(ur,{size:11}),k("pendingReview")]}):ue?j("span",{className:"font-bold leading-none tabular-nums",style:{fontFamily:'var(--font-hand, "Caveat", cursive)',fontSize:"1.15rem",color:ue.maxScore>0&&ue.score>=ue.maxScore?"#1f8a4c":ue.maxScore>0&&ue.score>0?"#c8810e":ue.maxScore>0?"#d23b2b":"#8d93a0"},children:[We(ue.score)," / ",We(ue.maxScore)]}):Ce>0?j("span",{className:"text-xs font-semibold text-[#8d93a0] tabular-nums",children:["/ ",We(Ce)," ",p(Ce)]}):null]}),L("div",{className:"p-4",children:je})]},W.id)},[k,p,xn,yn,M,A,m,un,R]),pa=Fe(()=>en(e).length>0,[e]),vt=Ke(W=>j("div",{className:"flex items-center gap-3 py-2",children:[L("div",{className:"flex-1 border-t border-dashed border-[#e7e5e0]"}),L("span",{className:"text-[10px] font-bold text-[#8d93a0] uppercase tracking-widest",children:k("exercise",{index:W+2})}),L("div",{className:"flex-1 border-t border-dashed border-[#e7e5e0]"})]},`sep-${W}`),[k]),wt=O?L("p",{className:"pt-2 pb-1 text-center text-xs text-[#8d93a0] select-none",children:k("poweredBy")}):null,Me=Y!==null,Ar=Y?.showVerdict!==!1,Cr=Ar?Y?.passed?"#1f8a4c":"#d23b2b":"#1d2025";return L("div",{className:"edpire-scope",style:{display:"contents"},children:j("div",{ref:P,dir:T,className:xe("flex flex-col",_?"h-full":"h-dvh"),style:F?{fontFamily:F}:void 0,children:[L(Io,{visible:Z&&!gt,hasAiNodes:ia,text:k("evaluating"),aiText:k("aiEvaluating"),contained:_,...h}),gt&&j("div",{className:xe("fixed inset-0 z-50 flex flex-col items-center justify-center gap-3 bg-red-950/80 backdrop-blur-sm",_&&"absolute"),children:[L(ur,{size:40,className:"text-red-300"}),L("p",{className:"text-xl font-black text-white tracking-tight",children:k("timeUp.title")}),L("p",{className:"text-sm text-red-200",children:k("timeUp.submitting")})]}),j("div",{className:"sticky top-0 z-10 flex-shrink-0 flex items-center justify-between px-4 py-2.5 border-b border-[#e7e5e0] bg-[#fbfaf7]",style:M?{backgroundColor:M}:void 0,children:[j("div",{className:"flex items-center gap-3",children:[L("img",{src:n?.logoUrl??$??kc,alt:n?.name??"Edpire",width:24,height:24,loading:"lazy",className:"rounded object-contain"}),j("div",{children:[L("h1",{className:"text-sm font-bold text-[#1d2025]",children:r.title}),L("p",{className:"text-[11px] text-[#8d93a0]",children:bt>0&&j("span",{className:"ms-2 font-semibold text-[#565b66]",children:["/ ",We(bt)," ",p(bt)]})})]}),!Me&&H!==null&&o&&o>0&&a&&L(Ac,{timeLimitMinutes:o,startedAt:a,onExpire:da}),!Me&&(c==="saving"||c==="saved")&&j("span",{role:"status",className:"hidden sm:inline-flex items-center gap-1 text-[11px] font-medium text-[#8d93a0]",children:[c==="saved"?L(vc,{size:12}):L(tn,{size:12,className:"animate-spin"}),k(c==="saved"?"answersSaved":"answersSaving")]})]}),j("div",{className:"flex items-center gap-2",children:[g&&j("button",{onClick:w,className:"flex items-center gap-1.5 px-3 py-2 text-sm font-medium text-[#565b66] hover:text-[#1d2025] hover:bg-[#f1efe9] rounded-lg transition-colors",children:[L(xc,{size:13}),k("reset")]}),(!Me||m)&&S&&j("button",{onClick:S,className:"flex items-center gap-1.5 px-3 py-2 text-sm font-medium text-[#565b66] hover:text-[#1d2025] hover:bg-[#f1efe9] rounded-lg transition-colors",children:[L(nn,{size:13}),f??k("back")]}),x&&L("button",{onClick:x,className:"p-1.5 text-[#8d93a0] hover:text-[#1d2025] hover:bg-[#f1efe9] rounded-lg transition-colors",children:L(nn,{size:15})}),!Me&&L("button",{onClick:()=>Ue(!0),disabled:Z,style:v?{backgroundColor:v}:void 0,className:"flex flex-shrink-0 items-center gap-2 px-3.5 sm:px-4 py-2 bg-[#1d2025] text-white text-sm font-semibold rounded-lg hover:bg-[#31353c] transition-colors disabled:opacity-50",children:Z?j(an,{children:[L(tn,{size:14,className:"animate-spin"}),k("submitting")]}):j(an,{children:[L(Qo,{size:14}),L("span",{className:"sm:hidden",children:k("confirmSubmit")}),L("span",{className:"hidden sm:inline",children:k("submit")})]})})]})]}),fn&&L("div",{className:"flex-shrink-0 bg-[#fdeeec] border-b border-[#f6cfc9] px-4 py-2 text-sm text-[#a32b1e]",children:fn}),!Me&&c==="failed"&&j("div",{role:"alert",className:"flex-shrink-0 flex items-center gap-2 bg-[#fbf1dc] border-b border-[#f2e2bf] px-4 py-2 text-sm font-semibold text-[#8a5a08]",children:[L(wc,{size:15,className:"flex-shrink-0"}),k("answersNotSaved")]}),!Me&&ge&&(R.size>0||oe!==null)&&j("div",{role:"status",className:"flex-shrink-0 flex items-center gap-2 bg-[#f5f4f1] border-b border-[#e7e5e0] px-4 py-2 text-sm text-[#1d2025]",children:[oe!==null&&L(ur,{size:15,className:"flex-shrink-0 text-[#565b66]"}),j("span",{className:"flex-1 min-w-0",children:[R.size>0?k("resumeRestored"):k("resumeFresh"),oe!==null&&j(an,{children:[" ",k("resumeTimeLeft",{minutes:oe})]})]}),L("button",{type:"button",onClick:()=>ae(!1),"aria-label":k("close"),className:"flex-shrink-0 p-1 rounded-md text-[#8d93a0] hover:text-[#1d2025] hover:bg-[#e7e5e0] transition-colors",children:L(nn,{size:14})})]}),Me&&Y&&(Y.awaitingManualGrading?L("div",{className:"flex-shrink-0 border-b bg-[#fbf1dc] border-[#f2e2bf]",children:L("div",{className:"mx-auto px-4 py-3 sm:px-6 sm:py-4",style:{maxWidth:q},children:j("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2 sm:gap-4",children:[j("div",{className:"flex items-center gap-2",children:[L(ur,{size:20,className:"text-[#c8810e] flex-shrink-0"}),L("span",{className:"text-sm font-semibold text-[#8a5a08]",children:Y.aiPending?k("beingMarked"):k("awaitingReview")})]}),L("div",{className:"hidden sm:block w-px h-8 bg-[#f2e2bf]"}),L("p",{className:"text-sm text-[#8a5a08] flex-1 min-w-0",children:Y.aiPending?k("beingMarkedDesc"):k("awaitingReviewDesc")}),y&&j("button",{onClick:vn,style:v?{backgroundColor:v}:void 0,className:"flex-shrink-0 flex items-center gap-2 px-4 py-2 bg-[#1d2025] text-white text-sm font-semibold rounded-lg hover:bg-[#31353c] transition-colors",children:[L(Go,{size:14}),b??k("viewFullReport")]})]})})}):L("div",{className:xe("flex-shrink-0 border-b",Ar?Y.passed?"bg-[#ecf8f0] border-[#c5e8d1]":"bg-[#fdeeec] border-[#f6cfc9]":"bg-[#f5f4f1] border-[#e7e5e0]"),children:L("div",{className:"mx-auto px-4 py-3 sm:px-6 sm:py-4",style:{maxWidth:q},children:j("div",{className:"flex flex-wrap sm:flex-nowrap items-center gap-x-4 gap-y-2",children:[j("div",{className:"flex items-center gap-2",children:[Ar?Y.passed?L(gc,{size:20,className:"text-[#1f8a4c] flex-shrink-0"}):L(bc,{size:20,className:"text-[#d23b2b] flex-shrink-0"}):null,L("span",{className:"text-sm font-semibold",style:{color:Cr},children:Ar?Y.passed?k("assessmentPassed"):k("assessmentNotPassed"):k("yourScore")})]}),L("div",{className:"hidden sm:block w-px h-8 bg-[#e7e5e0]"}),j("div",{className:"flex items-baseline gap-1.5",children:[j("span",{className:"leading-none tabular-nums text-[1.6rem] sm:text-[2rem]",style:{fontFamily:'var(--font-hand, "Caveat", cursive)',color:Cr},children:[We(Y.totalScore)," / ",We(Y.maxScore)]}),L("span",{className:"text-sm text-[#8d93a0] font-medium",children:p(Y.maxScore)})]}),j("div",{className:"flex-1 flex items-center gap-3 min-w-[140px]",children:[L("div",{className:"flex-1 h-2 bg-[#e7e5e0] rounded-full overflow-hidden min-w-[80px]",children:L("div",{className:"h-full rounded-full transition-all duration-700",style:{width:`${Y.percentage}%`,backgroundColor:Cr}})}),j("span",{className:"text-sm font-bold tabular-nums flex-shrink-0",style:{color:Cr},children:[Y.percentage,"%"]})]}),y&&j("button",{onClick:vn,style:v?{backgroundColor:v}:void 0,className:"flex-shrink-0 flex items-center gap-2 px-4 py-2 bg-[#1d2025] text-white text-sm font-semibold rounded-lg hover:bg-[#31353c] transition-colors",children:[L(Go,{size:14}),b??k("viewFullReport")]})]})})})),L("div",{className:xe("flex-1 overflow-hidden flex flex-col",gt&&"pointer-events-none opacity-60"),children:e.annex||pa?L(Do,{assessment:e,isSubmitted:Me,setAnswers:D,validationFeedback:xt,renderExercise:yt,renderSeparator:vt,primaryColor:v,contained:_,locale:ft(t),contentMaxWidth:q,t:k,footer:wt}):E?L(Oo,{assessment:e,isSubmitted:Me,setAnswers:D,validationFeedback:xt,renderExercise:yt,renderSeparator:vt,primaryColor:v,contained:_,locale:ft(t),contentMaxWidth:q,t:k,onAddAnnex:E,footer:wt}):L("div",{className:"flex-1 overflow-y-auto",children:j("div",{className:"mx-auto p-6 flex flex-col gap-4",style:{maxWidth:q},children:[L(Ye,{assessment:e,onAnswersChange:Me?void 0:D,validationFeedback:xt,renderExercise:yt,renderSeparator:vt,locale:ft(t)}),wt]})})}),Ae&&L("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",children:j("div",{className:"bg-white rounded-[14px] shadow-xl p-6 max-w-sm mx-4",children:[L("h3",{className:"text-base font-bold text-[#1d2025] mb-2",children:k("confirmTitle")}),fr>0&&j("div",{className:"text-sm text-[#8a5a08] bg-[#fbf1dc] border border-[#f2e2bf] rounded-lg px-3 py-2 mb-3",children:[j("p",{className:"flex items-start gap-2 font-semibold",children:[L(yc,{size:15,className:"flex-shrink-0 mt-px"}),L("span",{children:fr===1?k("unansweredOne"):k("unansweredMany",{count:fr})})]}),j("ul",{className:"mt-1 ps-[23px] flex flex-col gap-0.5",children:[bn.slice(0,on).map(W=>L("li",{children:L("button",{type:"button",onClick:()=>ca(W.questionId),className:"text-start underline underline-offset-2 hover:text-[#1d2025] cursor-pointer",children:W.only?k("exercise",{index:W.exerciseIndex+1}):`${k("exercise",{index:W.exerciseIndex+1})} \xB7 ${k("question",{index:W.questionIndex+1})}`})},W.questionId)),fr>on&&L("li",{children:k("unansweredMore",{count:fr-on})})]})]}),L("p",{className:"text-sm text-[#565b66] mb-5",children:k("confirmDescription")}),j("div",{className:"flex gap-3 justify-end",children:[L("button",{onClick:()=>Ue(!1),className:"px-4 py-2 text-sm font-medium text-[#565b66] hover:bg-[#f1efe9] rounded-lg transition-colors",children:k("confirmCancel")}),j("button",{onClick:la,disabled:Z,style:v?{backgroundColor:v}:void 0,className:"flex items-center gap-2 px-4 py-2 bg-[#1d2025] text-white text-sm font-semibold rounded-lg hover:bg-[#31353c] transition-colors disabled:opacity-50",children:[Z?L(tn,{size:14,className:"animate-spin"}):L(Qo,{size:14}),k("confirmSubmit")]})]})]})})]})})}function cn(e){return(e??[]).map(r=>({exerciseId:r.exercise_id,questions:r.questions.map(t=>({questionId:t.question_id,nodeResults:t.node_results.map(n=>({nodeId:n.node_id,status:n.status,score:n.score,maxScore:n.max_score,...n.feedback!==void 0?{feedback:n.feedback}:{},...n.display_answer!==void 0?{displayAnswer:n.display_answer}:{},...n.detail!==void 0?{detail:n.detail}:{},...n.teacher_feedback!==void 0?{teacherFeedback:n.teacher_feedback}:{}}))}))}))}import{jsx as Pc}from"react/jsx-runtime";function ln(e,r){let t=cn(e.exercise_feedback);return{submissionId:e.submission_id,totalScore:e.score,maxScore:e.max_score,percentage:e.percentage,passed:e.passed,returnUrl:r??null,exerciseFeedback:t,awaitingManualGrading:e.awaiting_manual_grading??!1,aiPending:e.ai_pending??!1}}function dn(e){return{annex:e.annex??void 0,exercises:e.exercises.map(r=>({id:r.id,sharedContext:r.sharedContext,questions:r.questions.map(t=>({id:t.id,version:"1.0",content:t.content,answerKeys:[]}))}))}}function ea({token:e,data:r,baseUrl:t,options:n}){let{locale:o,branding:a,returnUrl:s,reportLabel:i,backLabel:c,onBack:l,overlayConfig:d,layout:m,mediaHandler:y,onComplete:b,onError:S}=n,f=a??r.branding??void 0,g=o??r.meta.language??"en",w=Cc(()=>dn(r.assessment),[r]),[h]=Ec(()=>new Date().toISOString()),_=Zo(async x=>{let A=await fetch(`${t}/api/v1/embed/submit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:e,answers:x})});if(!A.ok){let $=await A.json().catch(()=>({})),k=typeof $.error=="string"?$.error:"Submission failed",p=A.status===401?"TOKEN_INVALID":A.status===409?"TOKEN_USED":A.status===404?"ASSESSMENT_NOT_FOUND":"UNKNOWN";throw S?.({code:p,message:k}),new Error(k)}let E=await A.json();return b?.(E),ln(E,s)},[t,e,b,S,s]),u=Zo(x=>{if(s)try{let A=new URL(s);A.searchParams.set("submission_id",x.submissionId),x.awaitingManualGrading||(A.searchParams.set("score",String(x.totalScore)),A.searchParams.set("max_score",String(x.maxScore))),window.location.href=A.toString()}catch{window.location.href=s}},[s]);return Pc(_r,{assessment:w,meta:{title:r.meta.title,category:r.meta.category??null},locale:g,branding:f,timeLimitMinutes:r.meta.settings.time_limit_minutes,startedAt:h,onSubmit:_,onViewReport:s?u:void 0,reportLabel:i,onBack:l,backLabel:c,overlayConfig:d,layout:m,mediaHandler:y})}import{useMemo as ra}from"react";import{jsx as Ic}from"react/jsx-runtime";function Mc(){return Promise.reject(new Error("A review cannot be submitted"))}function ta({review:e,locale:r,branding:t,layout:n,onBack:o,backLabel:a}){let s=ra(()=>dn(e.assessment),[e]),i=ra(()=>({answers:e.answers,result:ln({submission_id:e.submission.id,score:e.submission.score,max_score:e.submission.max_score,percentage:e.submission.percentage,passed:e.submission.passed,awaiting_manual_grading:e.submission.awaiting_manual_grading,ai_pending:e.submission.ai_pending,exercise_feedback:e.exercise_feedback})}),[e]),c=r??e.meta.language??"en";return Ic(_r,{assessment:s,meta:{title:e.meta.title,category:e.meta.category??null},locale:c,branding:t??e.branding??void 0,review:i,onSubmit:Mc,onBack:o,backLabel:a,layout:n})}import Vf from"react";import{createRoot as Gf}from"react-dom/client";var Lc="https://edpire.com";function aa(e,r,t){e.textContent="";let n=document.createElement("div");n.style.cssText="padding:32px;text-align:center;color:#dc2626;font-family:sans-serif";let o=document.createElement("div");if(o.textContent=r,n.appendChild(o),t){let a=document.createElement("div");a.style.cssText="margin-top:8px;font-size:13px;color:#6b7280",a.textContent=t,n.appendChild(a)}e.appendChild(n)}var sa={mount(e){let{token:r,container:t,baseUrl:n=Lc,onError:o}=e,a=typeof t=="string"?document.querySelector(t):t;if(!a){let l={code:"UNKNOWN",message:`Container not found: ${t}`};return o?.(l),{unmount:()=>{}}}let s=null,i=!1;function c(){if(i)return;i=!0;let l=s;s=null,setTimeout(()=>{l?.unmount()},0)}return(async()=>{a.innerHTML='<div style="padding:32px;text-align:center;color:#6b7280;font-family:sans-serif">Loading assessment\u2026</div>';let l;try{let d=await fetch(`${n}/api/v1/embed/assessments?token=${encodeURIComponent(r)}`,{method:"GET"});if(!d.ok){let m=await d.json().catch(()=>({})),y=typeof m.error=="string"?m.error:"Failed to load assessment",b=d.status===401?"TOKEN_INVALID":d.status===403?"ORIGIN_NOT_ALLOWED":d.status===404?"ASSESSMENT_NOT_FOUND":"UNKNOWN";o?.({code:b,message:y});let S=b==="ORIGIN_NOT_ALLOWED"?`Add ${typeof location<"u"?location.origin:"this origin"} to Allowed Embed Origins in Edpire, under Integrations then Origins.`:"";aa(a,y,S);return}l=await d.json()}catch{o?.({code:"NETWORK_ERROR",message:"Failed to connect to Edpire"}),aa(a,"Failed to connect to Edpire. Please try again.","");return}i||(a.innerHTML="",s=oa(a),s.render(na.createElement(ea,{token:r,data:l,baseUrl:n,options:e})))})(),{unmount:c}},review(e){let{container:r,...t}=e,n=typeof r=="string"?document.querySelector(r):r;if(!n)return{unmount:()=>{}};n.textContent="";let o=oa(n);return o.render(na.createElement(ta,t)),{unmount(){let a=o;o=null,setTimeout(()=>a?.unmount(),0)}}}};import{jsx as zc}from"react/jsx-runtime";function $c({tokenEndpoint:e,assessmentId:r,tokenBody:t,className:n,style:o,onComplete:a,onError:s,...i}){let c=pn(null),l=pn(a);l.current=a;let d=pn(s);return d.current=s,Tc(()=>{let m=c.current;if(!m)return;let y=!1,b=null;return(async()=>{let S;try{let f=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({assessmentId:r,...t})});if(y)return;if(!f.ok){let w=await f.json().catch(()=>({}));d.current?.({code:"TOKEN_INVALID",message:typeof w.error=="string"?w.error:`Token endpoint returned ${f.status}`});return}let g=await f.json();if(!g.token){d.current?.({code:"TOKEN_INVALID",message:"Token endpoint did not return a token"});return}S=g.token}catch{y||d.current?.({code:"NETWORK_ERROR",message:"Failed to fetch embed token"});return}y||(b=sa.mount({token:S,container:m,...i,onComplete:f=>l.current?.(f),onError:f=>d.current?.(f)}))})(),()=>{y=!0,b?.unmount()}},[e,r]),zc("div",{ref:c,className:n,style:n?void 0:o??{width:"100%",height:"100%"}})}export{_r as AssessmentShell,$c as EdpireAssessmentPlayer,Mo as EdpireQuestion};