@edpire/sdk 0.8.2 → 0.9.0

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 Zs,{useMemo as ei}from"react";import{jsx as ir}from"react/jsx-runtime";import{useEffect as Xr,useMemo as $s,useRef as zs}from"react";import Na from"mitt";var $e=class{constructor(){this.emitter=Na(),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()})}},Gt="__edpireGlobalAnswerBus",Qt=globalThis,Rr=Qt[Gt]??(Qt[Gt]=new $e);import{jsx as Ca}from"react/jsx-runtime";import{createContext as Aa,useContext as Pa}from"react";var Yt="__edpireAnswerBusContext",Kt=globalThis,Jt=Kt[Yt]??(Kt[Yt]=Aa(Rr));function ce(){return Pa(Jt)}function Sr({children:e,bus:r=new $e}){return Ca(Jt.Provider,{value:r,children:e})}import{Fragment as an,jsx as G,jsxs as je}from"react/jsx-runtime";import{Fragment as Ua,useState as Or,useEffect as jr,useMemo as Ha,useRef as Va}from"react";import Pe from"clsx";import{jsx as O}from"react/jsx-runtime";import Ea from"katex";import"katex/dist/contrib/mhchem.js";var Ma={"\\d":"\\mathrm{d}","\\R":"\\mathbb{R}","\\N":"\\mathbb{N}","\\Z":"\\mathbb{Z}","\\Q":"\\mathbb{Q}","\\C":"\\mathbb{C}"};function pr(e,r,t=!0){try{return Ea.renderToString(e,{displayMode:r,output:t?"htmlAndMathml":"html",throwOnError:!1,errorColor:"#cc0000",macros:Ma,strict:!1})}catch(n){return`<span class="katex-error" style="color:#cc0000" title="${String(n)}">${e}</span>`}}function A(e){return`calc(${typeof e=="number"?`${e}px`:e} * var(--edp-scale, 1))`}function X(e){return{width:A(e),height:A(e)}}function ke(e){if(e==null||e==="")return;if(typeof e=="number")return A(e);let r=String(e).trim();return/^\d+(\.\d+)?px$/.test(r)?A(r):r}var Xt={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"}},Zt={border:"#2563eb",background:"#e0f2fe"},en={border:"#dc2626",background:"#fee2e2"};function Ia(e){return{display:"inline-block",verticalAlign:"middle",border:`2px solid ${e?.border||Zt.border}`,background:e?.background||Zt.background,borderRadius:A("4px"),padding:"0.17em 0.37em"}}var Nr=`${A("6px")} ${A("8px")}`;function La(e){let r=e?.shape==="circle"?"50%":"9999px";return{display:"inline-block",verticalAlign:"middle",border:`2px solid ${e?.border||en.border}`,background:e?.background||en.background,borderRadius:r,padding:"0.15em 0.45em"}}function Re(e,r,t){return O("div",{className:"exercise-content",children:e.content.map((n,a)=>be(n,`node-${a}`,r,t))})}function be(e,r,t,n){switch(e.type){case"choiceSet":case"inlineChoiceSet":return O(Cr,{node:e,validationFeedback:t?.get(e.id)},r);case"blank":return e.attrs.mode==="typed"?O(Ar,{node:e,validationFeedback:t?.get(e.id)},r):O(Pr,{node:e,validationFeedback:t?.get(e.id)},r);case"blankPool":return O(Er,{node:e},r);case"inlinePool":return O(Mr,{node:e},r);case"matchingSet":return O(Ir,{node:e,validationFeedback:t?.get(e.id)},r);case"aiAnswerInput":return O(Lr,{node:e,validationFeedback:t?.get(e.id)},r);case"openResponseNode":return O(Tr,{node:e,validationFeedback:t?.get(e.id),readOnly:n?.readOnly,mediaHandler:n?.mediaHandler},r);case"mathResponse":return O($r,{nodeId:e.id,placeholder:e.attrs?.placeholder,hint:e.attrs?.hint,validationFeedback:t?.get(e.id),readOnly:n?.readOnly},r);case"codingResponse":return O(zr,{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 O("p",{dir:s,style:o?{textAlign:o}:void 0,children:e.content?.map((i,c)=>be(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,l=Xt[a]??Xt[3];return O(o,{dir:c,style:{...l,...i?{textAlign:i}:{}},children:e.content?.map((d,m)=>be(d,`${r}-${m}`,t,n))},r)}case"blockquote":{let a=e.attrs,o=a?.dir||void 0,s=a?.textAlign;return O("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)=>be(i,`${r}-${c}`,t,n))},r)}case"text":{let a=e,o=a.text??"",s=a.marks??[];if(s.length===0)return O("span",{children:o},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=o;for(let l of s)switch(l.type){case"bold":c=O("strong",{children:c});break;case"italic":c=O("em",{children:c});break;case"underline":c=O("u",{children:c});break;case"strike":c=O("s",{children:c});break;case"code":c=O("code",{children:c});break;case"subscript":c=O("sub",{children:c});break;case"superscript":c=O("sup",{children:c});break;case"boxedText":c=O("span",{style:Ia(l.attrs),children:c});break;case"circleText":c=O("span",{style:La(l.attrs),children:c});break}return O("span",{style:Object.keys(i).length>0?i:void 0,children:c},r)}case"hardBreak":return O("br",{},r);case"resizableImage":return O("img",{src:e.attrs?.src||void 0,alt:e.attrs?.alt||"",style:{display:"inline-block",verticalAlign:"middle",width:ke(e.attrs?.width||void 0)??"auto",height:ke(e.attrs?.height||void 0)??"auto",maxWidth:"100%"}},r);case"resizableAudio":return O("span",{style:{display:"inline-flex",verticalAlign:"middle",alignItems:"center",background:"#f1f5f9",borderRadius:A("8px"),padding:`${A("4px")} ${A("8px")}`,maxWidth:"100%"},children:O("audio",{controls:!0,src:e.attrs?.src||void 0,style:{display:"block",width:A("320px"),maxWidth:"100%"}})},r);case"resizableVideo":return O("video",{src:e.attrs?.src||void 0,controls:!0,style:{display:"inline-block",verticalAlign:"middle",width:ke(e.attrs?.width||void 0)??"auto",height:ke(e.attrs?.height||void 0)??"auto",maxWidth:"100%"}},r);case"youtubeEmbed":return O("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:ke(e.attrs?.width||480),height:ke(e.attrs?.height||270)}},r);case"inlineMath":return O("span",{dir:"ltr",style:{unicodeBidi:"isolate",display:"inline-block"},className:"math-inline",dangerouslySetInnerHTML:{__html:pr(e.attrs?.latex??"",!1,!0)}},r);case"blockMath":return O("div",{dir:"ltr",style:{unicodeBidi:"isolate",textAlign:"center",margin:"1em 0"},className:"math-block",dangerouslySetInnerHTML:{__html:pr(e.attrs?.latex??"",!0,!0)}},r);case"variable":return O("span",{className:"variable",children:`{${e.attrs?.name}}`},r);default:{let a=e;return a.type==="bulletList"?O("ul",{style:{listStyleType:"disc",paddingLeft:"1.5em",margin:"0.5em 0"},children:a.content?.map((o,s)=>be(o,`${r}-${s}`,t,n))},r):a.type==="orderedList"?O("ol",{style:{listStyleType:"decimal",paddingLeft:"1.5em",margin:"0.5em 0"},children:a.content?.map((o,s)=>be(o,`${r}-${s}`,t,n))},r):a.type==="listItem"?O("li",{children:a.content?.map((o,s)=>be(o,`${r}-${s}`,t,n))},r):a.type==="table"?O("div",{style:{overflowX:"auto",margin:`${A("1.25rem")} 0`},children:O("table",{style:{borderCollapse:"collapse",width:"100%",tableLayout:"fixed"},children:O("tbody",{children:a.content?.map((o,s)=>be(o,`${r}-${s}`,t,n))})})},r):a.type==="tableRow"?O("tr",{children:a.content?.map((o,s)=>be(o,`${r}-${s}`,t,n))},r):a.type==="tableCell"?O("td",{colSpan:a.attrs?.colspan,rowSpan:a.attrs?.rowspan,style:{border:"1px solid #d1d5db",padding:Nr,verticalAlign:"top"},children:a.content?.map((o,s)=>be(o,`${r}-${s}`,t,n))},r):a.type==="tableHeader"?O("th",{colSpan:a.attrs?.colspan,rowSpan:a.attrs?.rowspan,style:{border:"1px solid #d1d5db",padding:Nr,verticalAlign:"top",background:"#f3f4f6",fontWeight:600},children:a.content?.map((o,s)=>be(o,`${r}-${s}`,t,n))},r):(console.warn(`Unknown node type during interpretation: ${e.type}`),null)}}}function ee(e,r){return e.map(t=>{if(t.type==="text"){let n=Ve(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:${A("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?ee(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?ee(t.content,r):"";return`<div style="overflow-x:auto;margin:${A("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?ee(t.content,r):""}</tr>`;if(t.type==="tableCell"){let n=t.content?ee(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:${Nr};vertical-align:top">${n}</td>`}if(t.type==="tableHeader"){let n=t.content?ee(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:${Nr};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?ee(t.content,r):""}</ul>`;if(t.type==="orderedList")return`<ol style="list-style-type:decimal;padding-left:1.5em">${t.content?ee(t.content,r):""}</ol>`;if(t.type==="listItem")return`<li>${t.content?ee(t.content,r):""}</li>`;if(t.type==="blockquote"){let n=t.content?ee(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=_r(n.width),o=_r(n.height);return`<img src="${Ve(n.src??"")}" alt="${Ve(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:${A("8px")};padding:${A("4px")} ${A("8px")};max-width:100%"><audio controls src="${Ve(n.src??"")}" style="display:block;width:${A("320px")};max-width:100%"></audio></span>`}if(t.type==="resizableVideo"){let n=t.attrs??{},a=_r(n.width),o=_r(n.height);return`<video src="${Ve(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/${Ve(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:${ke(n.width||480)};height:${ke(n.height||270)}"></iframe>`}return t.type==="inlineMath"?`<span dir="ltr" class="math-inline" style="unicode-bidi:isolate;display:inline-block">${pr(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">${pr(t.attrs?.latex??"",!0,!0)}</div>`:t.type==="variable"?`<span class="variable">{${Ve(t.attrs?.name??"")}}</span>`:""}).join("")}function _r(e){return e==null||e===""?null:ke(e)??null}function Ve(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}import{jsx as Ta}from"react/jsx-runtime";import{createContext as $a,useContext as rn}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 Dr={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 Fr={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 za={en:rr,fr:Dr,ar:Fr},ot=$a(null);function Z(){return rn(ot)??rr}function st(e){let r=rn(ot);return e&&za[e]||r||rr}function mr({locale:e,children:r}){let t=st(e);return Ta(ot.Provider,{value:t,children:r})}import{jsx as Da}from"react/jsx-runtime";import{createContext as Fa,useContext as tn,useMemo as nn}from"react";var ja={sm:.875,md:1,lg:1.25,xl:1.5},it=Fa(null);function Oa(e,r){let t={...e??{}};if(r)for(let[n,a]of Object.entries(r))a!==void 0&&(t[n]=a);return t}function Ba(e){return typeof e=="number"?Number.isFinite(e)&&e>0?e:1:e?ja[e]??1:1}function Se(e){let r=e??{};return{scale:Ba(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(it);return nn(()=>Oa(r,e),[r,e?.size,e?.choiceLabels,e?.choiceColumns,e?.layoutBy,e?.motion,e?.shuffleSeed])}function _e(){let e=tn(it);return nn(()=>Se(e),[e])}function xe({display:e,children:r}){let t=ye(e);return Da(it.Provider,{value:t,children:r})}function Ne(e){if(e.sizeSet)return{"--edp-scale":String(e.scale)}}function Ge(){let{motion:e}=_e();return{hop:e==="none"?"":"animate-hop",shake:e==="full"?"animate-shake":"",wobble:e==="full"?"animate-wobble":""}}function Wa(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 qa(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 ur(e,r){let t=[...e],n=qa(Wa(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 ct({node:e}){if(e.type==="text"){if(!e.marks||e.marks.length===0)return G(an,{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(an,{children:r})}return e.type==="paragraph"?G("span",{className:"block",children:e.content?.map((r,t)=>G(ct,{node:r},t))??G("br",{})}):e.type==="hardBreak"?G("br",{}):e.content?G("span",{className:"block",children:e.content.map((r,t)=>G(ct,{node:r},t))}):null}function Ga({nodes:e}){return G("span",{className:"block space-y-1",style:{color:"var(--ink, #1d2025)"},children:e.map((r,t)=>G(ct,{node:r},t))})}function on({hint:e}){let r=Z(),[t,n]=Or(!1),[a,o]=Or(!1),s=Va(null);return jr(()=>{if(!a)return;let d=m=>{s.current&&!s.current.contains(m.target)&&(o(!1),n(!1))};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[a]),je("span",{ref:s,className:"relative inline-flex items-center align-middle",onMouseEnter:()=>n(!0),onMouseLeave:()=>{a||n(!1)},children:[G("button",{type:"button",onClick:d=>{d.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:d=>d.stopPropagation(),children:G(Ga,{nodes:e})})]})}function Qa(e){return[...e].map(r=>({v:r,r:Math.random()})).sort((r,t)=>r.r-t.r).map(r=>r.v)}var Ya=e=>e.replace(/ {2,}/g,r=>"&nbsp;".repeat(r.length-1)+" "),Ka=new Set(["image","resizableImage","resizableVideo","youtubeEmbed"]);function ln(e){return(e??[]).some(r=>Ka.has(r?.type)||ln(r?.content))}var sn=()=>G("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:3,children:G("path",{d:"M5 13l4 4L19 7"})}),cn=()=>G("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:3,children:G("path",{d:"M6 6l12 12M18 6L6 18"})});function Cr({node:e,validationFeedback:r}){let t=ce(),n=Z(),a=_e(),o=Ge(),{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??"/":"/",v="pickLimit"in c&&c.pickLimit?c.pickLimit:1,h="layout"in c?c.layout??"row":"row",x=e.type==="inlineChoiceSet",u=JSON.stringify(i),b=l&&a.shuffleSeed!==void 0,k=Ha(()=>b?ur(i,`${a.shuffleSeed}:${s}`):null,[b,a.shuffleSeed,s,u]),[g,E]=Or(i);jr(()=>{b||E(l?Qa(i):i)},[l,b,u]);let y=k??g,[f,C]=Or(new Set),N=r?.showFeedback??!1,I=r?.correctChoiceIds||[];jr(()=>{let W=w=>{let F=w.answers.find(H=>H.nodeId===s&&H.type==="choiceSet");F&&"selectedIds"in F.answer&&C(new Set(F.answer.selectedIds))};return t.on("answers:prefill",W),()=>t.off("answers:prefill",W)},[s,t]),jr(()=>{t.emit({type:"answer:changed",answer:{nodeId:s,type:"choiceSet",timestamp:Date.now(),answer:{selectedIds:Array.from(f)}}})},[f,s,t]);let T=W=>{N||C(w=>{let R=new Set(w);return v===1?R.has(W)?R.delete(W):(R.clear(),R.add(W)):R.has(W)?R.delete(W):R.size<v&&R.add(W),R})},p=W=>Ya(ee(W.content)),M=W=>{let w=f.has(W),R=I.includes(W);return N?R&&w?"correct":R&&!w?"correct-unchosen":!R&&w?"incorrect":"muted":w?"selected":"idle"},$={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(x)return je("span",{className:"inline-choice",children:[d&&je("span",{className:"mr-2 font-medium",children:[d,v>1?G("span",{className:"ml-1 opacity-60",children:n.chooseN(v)}):null]}),y.map((W,w)=>je(Ua,{children:[G("button",{type:"button",disabled:N,onClick:()=>T(W.id),className:Pe("player-inline-choice",q[M(W.id)]),"aria-pressed":f.has(W.id),dangerouslySetInnerHTML:{__html:p(W)}}),w<y.length-1&&G("span",{className:"mx-1",children:m})]},W.id)),c.hint&&c.hint.length>0&&G(on,{hint:c.hint})]});let S=a.layoutBy==="box",P=a.choiceColumns?Math.min(a.choiceColumns,y.length):0,B=P?{gridAutoRows:"1fr",gridTemplateColumns:`repeat(${P}, minmax(0, 1fr))`}:{gridAutoRows:"1fr"},D=y.some(W=>ln(W.content)),j=a.choiceLabels==="letters",z=W=>n.choiceLetters[W]??String(W+1);return je("div",{className:Pe("cs-player my-4 space-y-3",S&&"cs-player--box"),children:[d&&je("p",{className:"font-medium",children:[d,v>1?je("span",{className:"ml-2 text-sm opacity-70",children:["(choose ",v,")"]}):null]}),c.hint&&c.hint.length>0&&G(on,{hint:c.hint}),G("div",{className:Pe("cs-player__grid",h==="row"&&"cs-player__grid--row"),style:B,children:y.map((W,w)=>{let R=M(W.id),F=R==="incorrect"?"incorrect":R==="correct"||R==="correct-unchosen"?"correct":null;return je("button",{type:"button",disabled:N,onClick:()=>T(W.id),className:Pe("player-choice",D&&"player-choice--tile",$[R]),"aria-pressed":f.has(W.id),children:[G("span",{className:Pe("player-choice__mark",v>1?"player-choice__mark--box":"player-choice__mark--radio",j&&"player-choice__mark--letter"),children:j?z(w):R==="incorrect"?G(cn,{}):G(sn,{})}),G("span",{className:"player-choice__text",dangerouslySetInnerHTML:{__html:p(W)}}),j&&F&&G("span",{className:`player-choice__verdict player-choice__verdict--${F}`,"aria-hidden":"true",children:F==="incorrect"?G(cn,{}):G(sn,{})})]},W.id)})})]})}import{Fragment as lt,jsx as K,jsxs as Br}from"react/jsx-runtime";import{useState as dt,useEffect as Wr,useRef as dn,useCallback as Ja}from"react";import Oe from"clsx";function pt({node:e}){if(e.type==="text"){if(!e.marks||e.marks.length===0)return K(lt,{children:e.text});let r=e.text||"";for(let t of e.marks)t.type==="bold"?r=K("strong",{children:r}):t.type==="italic"?r=K("em",{children:r}):t.type==="underline"?r=K("u",{children:r}):t.type==="strike"?r=K("s",{children:r}):t.type==="textStyle"&&t.attrs?.color&&(r=K("span",{style:{color:t.attrs.color},children:r}));return K(lt,{children:r})}return e.type==="paragraph"?K("span",{className:"block",children:e.content?.map((r,t)=>K(pt,{node:r},t))??K("br",{})}):e.type==="hardBreak"?K("br",{}):e.content?K("span",{className:"block",children:e.content.map((r,t)=>K(pt,{node:r},t))}):null}function Xa({nodes:e}){return K("span",{className:"block space-y-1",children:e.map((r,t)=>K(pt,{node:r},t))})}function Za({hint:e}){let r=Z(),[t,n]=dt(!1),[a,o]=dt(!1),s=dn(null);return Wr(()=>{if(!a)return;let d=m=>{s.current&&!s.current.contains(m.target)&&(o(!1),n(!1))};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[a]),Br("span",{ref:s,className:"relative inline-flex items-center align-middle",onMouseEnter:()=>n(!0),onMouseLeave:()=>{a||n(!1)},children:[K("button",{type:"button",onClick:d=>{d.stopPropagation(),a?(o(!1),n(!1)):(o(!0),n(!0))},className:Oe("player-blank-hint-btn select-none",a&&"player-blank-hint-btn--pinned"),"aria-label":r.showHint,children:"?"}),t&&K("span",{className:"player-blank-hint-pop",onClick:d=>d.stopPropagation(),children:K(Xa,{nodes:e})})]})}function Ar({node:e,validationFeedback:r}){let t=ce(),n=Z(),a=Ge(),{id:o,attrs:s}=e,{placeholder:i="___",width:c="auto",hint:l}=s,d=dn(null),m=i.trim().split(/\s+/).filter(Boolean).length,v=c==="auto"&&m>=4,[h,x]=dt(""),u=r?.showFeedback??!1,b=r?.state,k=b==="validating",g=r?.displayAnswer,E=r?.message;Wr(()=>{let N=I=>{let p=I.answers.find(M=>M.nodeId===o&&M.type==="blank");p&&"mode"in p.answer&&p.answer.mode==="typed"&&"text"in p.answer&&x(p.answer.text)};return t.on("answers:prefill",N),()=>t.off("answers:prefill",N)},[o,t]),Wr(()=>{t.emit({type:"answer:changed",answer:{nodeId:o,type:"blank",timestamp:Date.now(),answer:{mode:"typed",text:h}}})},[h,o,t]);let y=N=>{x(N.target.value)},f=Ja(()=>{let N=d.current;N&&(N.style.height="auto",N.style.height=`${N.scrollHeight}px`)},[]);Wr(()=>{f()},[h,f]);let C=u&&!k;return Br("span",{className:Oe("inline-flex flex-wrap items-center gap-x-1 gap-y-0.5 align-middle max-w-full",v&&"w-full"),children:[K("span",{className:Oe("relative inline-block shrink-0 min-w-0 max-w-full",v&&"w-full flex-1"),children:C?K("span",{className:Oe("player-typed-blank-feedback",v&&"w-full",b==="correct"&&Oe("player-typed-blank-feedback--correct",a.hop),b==="partial"&&"player-typed-blank-feedback--partial",b==="incorrect"&&Oe("player-typed-blank-feedback--incorrect",a.wobble)),children:h||K("span",{className:"opacity-40",children:i})}):Br(lt,{children:[K("textarea",{ref:d,placeholder:i,value:h,onChange:y,disabled:u,rows:1,className:Oe("player-typed-blank",v&&"w-full",k&&"player-typed-blank--pending"),style:c!=="auto"?{width:c}:v?{width:"100%"}:{width:`${Math.max(7,h.length+1)}ch`,maxWidth:"100%"}}),!h&&!k&&K("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"}),k&&K("span",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:K("span",{className:"player-typed-blank-spinner","aria-label":n.aiEvaluationInProgressAria})})]})}),u&&b==="incorrect"&&g&&Br("span",{className:"player-blank-reveal",children:["(",g,")"]}),u&&E&&K("span",{className:Oe("player-blank-feedback",b==="correct"&&"player-blank-feedback--correct",b==="partial"&&"player-blank-feedback--partial",b==="incorrect"&&"player-blank-feedback--incorrect"),children:E}),l&&l.length>0&&K(Za,{hint:l})]})}import{jsx as Ur,Fragment as bn,jsxs as ht}from"react/jsx-runtime";import{useEffect as yn}from"react";import Hr from"clsx";import{useDroppable as uo,useDndContext as fo}from"@dnd-kit/core";import{jsx as eo}from"react/jsx-runtime";import{createContext as ro,useCallback as Be,useContext as to,useEffect as no,useMemo as pn,useRef as ao,useState as mt}from"react";import{useDndMonitor as oo}from"@dnd-kit/core";var un=ro(null);function Ee(){let e=to(un);if(!e)throw new Error("usePool must be used within a PoolProvider");return e}function mn(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 qr({children:e,initialAnswers:r}){let t=ce(),n=pn(()=>mn(r),[r]),[a,o]=mt(n),[s,i]=mt({}),[c,l]=mt({}),d=ao(new Set);no(()=>{let y=f=>{let C=mn(f.answers);Object.keys(C).length!==0&&o(N=>{if(!Object.entries(C).some(([p,M])=>N[p]?.choiceId!==M.choiceId||N[p]?.poolId!==M.poolId||N[p]?.value!==M.value))return N;let T={...N,...C};return i(p=>{let M={...p};for(let[$,q]of Object.entries(p)){let S=new Set(Object.values(T).filter(P=>P.poolId===$).map(P=>P.choiceId));M[$]={...q,available:new Set(q.choices.map(P=>P.id).filter(P=>!S.has(P)))}}return M}),T})};return t.on("answers:prefill",y),()=>t.off("answers:prefill",y)},[t]);let m=Be((y,f)=>{i(C=>{let N=C[y];if(!N){let $=new Set;for(let S of Object.values(a))S.poolId===y&&$.add(S.choiceId);let q=new Set(f.map(S=>S.id).filter(S=>!$.has(S)));return{...C,[y]:{choices:f,available:q}}}let I=new Set(N.choices.map($=>$.id)),T=new Set(f.map($=>$.id));if(!(f.some($=>!I.has($.id))||N.choices.some($=>!T.has($.id))))return C;let M=new Set;for(let $ of N.available)T.has($)&&M.add($);for(let $ of f)I.has($.id)||M.add($.id);return{...C,[y]:{choices:f,available:M}}})},[a]),v=Be((y,f)=>{l(C=>{let N=C[y]??[];return N.includes(f)?C:{...C,[y]:[...N,f]}}),!d.current.has(f)&&!a[f]&&(d.current.add(f),t.emit({type:"answer:changed",answer:{nodeId:f,type:"blank",timestamp:Date.now(),answer:{mode:"choice",choiceId:"",poolId:y,value:""}}}))},[a,t]),h=Be(y=>(c[y]??[]).find(C=>!a[C])??null,[c,a]),x=Be((y,f,C,N)=>{o(I=>{let T=I[y];return T&&i(p=>{let M=p[T.poolId];if(!M)return p;let $=new Set(M.available);return $.add(T.choiceId),{...p,[T.poolId]:{...M,available:$}}}),{...I,[y]:{choiceId:C,value:N,poolId:f}}}),i(I=>{let T=I[f];if(!T)return I;let p=new Set(T.available);return p.delete(C),{...I,[f]:{...T,available:p}}}),t.emit({type:"answer:changed",answer:{nodeId:y,type:"blank",timestamp:Date.now(),answer:{mode:"choice",choiceId:C,poolId:f,value:N}}})},[t]),u=Be(y=>{let f=a[y];if(!f)return;let{poolId:C,choiceId:N}=f;i(I=>{let T=I[C];if(!T)return I;let p=new Set(T.available);return p.add(N),{...I,[C]:{...T,available:p}}}),o(I=>{let{[y]:T,...p}=I;return p}),t.emit({type:"answer:changed",answer:{nodeId:y,type:"blank",timestamp:Date.now(),answer:{mode:"choice",choiceId:"",poolId:C,value:""}}})},[a,t]),b=Be((y,f)=>s[y]?.available.has(f)??!1,[s]),k=Be((y,f)=>s[y]?.choices.find(C=>C.id===f),[s]),g=Be(()=>{o({}),i(y=>{let f={};for(let[C,N]of Object.entries(y))f[C]={choices:N.choices,available:new Set(N.choices.map(I=>I.id))};return f});for(let[y,f]of Object.entries(c))for(let C of f)t.emit({type:"answer:changed",answer:{nodeId:C,type:"blank",timestamp:Date.now(),answer:{mode:"choice",choiceId:"",poolId:y,value:""}}})},[c,t]);oo({onDragEnd(y){window.dispatchEvent(new CustomEvent("dnd-drop",{detail:{active:y.active,over:y.over}}))}});let E=pn(()=>({blanks:a,pools:s,registerPool:m,registerBlank:v,fill:x,back:u,isAvailable:b,getChoice:k,firstEmptyBlank:h,resetAllAnswers:g}),[a,s,m,v,x,u,b,k,h,g]);return eo(un.Provider,{value:E,children:e})}import{Fragment as fn,jsx as ae,jsxs as so}from"react/jsx-runtime";import{useState as ut,useEffect as gn,useRef as hn,useLayoutEffect as io}from"react";import co from"clsx";var lo=typeof window<"u"?io:gn;function ft({node:e}){if(e.type==="text"){if(!e.marks||e.marks.length===0)return ae(fn,{children:e.text});let r=e.text||"";for(let t of e.marks)t.type==="bold"?r=ae("strong",{children:r}):t.type==="italic"?r=ae("em",{children:r}):t.type==="underline"?r=ae("u",{children:r}):t.type==="strike"?r=ae("s",{children:r}):t.type==="textStyle"&&t.attrs?.color&&(r=ae("span",{style:{color:t.attrs.color},children:r}));return ae(fn,{children:r})}return e.type==="paragraph"?ae("span",{className:"block",children:e.content?.map((r,t)=>ae(ft,{node:r},t))??ae("br",{})}):e.type==="hardBreak"?ae("br",{}):e.content?ae("span",{className:"block",children:e.content.map((r,t)=>ae(ft,{node:r},t))}):null}function po({nodes:e}){return ae("span",{className:"block space-y-1",style:{color:"var(--ink, #1d2025)"},children:e.map((r,t)=>ae(ft,{node:r},t))})}function mo({hint:e}){let r=Z(),[t,n]=ut(!1),[a,o]=ut(!1),[s,i]=ut(null),c=hn(null),l=hn(null);return gn(()=>{if(!a)return;let h=x=>{let u=x.target;c.current&&!c.current.contains(u)&&l.current&&!l.current.contains(u)&&(o(!1),n(!1))};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[a]),lo(()=>{if(!t){i(null);return}let h=c.current,x=l.current;if(!h||!x)return;let u=h.getBoundingClientRect(),b=x.getBoundingClientRect(),k=8,g=u.top-b.height-k;g<k&&(g=u.bottom+k);let E=u.left+u.width/2-b.width/2;E=Math.max(k,Math.min(E,window.innerWidth-b.width-k)),i({top:g,left:E})},[t]),so("span",{ref:c,className:"relative inline-flex items-center align-middle",onMouseEnter:()=>n(!0),onMouseLeave:()=>{a||n(!1)},children:[ae("button",{type:"button",onClick:h=>{h.stopPropagation(),a?(o(!1),n(!1)):(o(!0),n(!0))},className:co("player-blank-hint-btn select-none",a&&"player-blank-hint-btn--pinned"),"aria-label":r.showHint,children:"?"}),t&&ae("span",{ref:l,className:"player-blank-hint-pop",onClick:h=>h.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:ae(po,{nodes:e})})]})}function Me({hint:e}){return!e||e.length===0?null:ae(mo,{hint:e})}function Pr({node:e,validationFeedback:r}){let{id:t,attrs:n}=e,{poolId:a,placeholder:o="___",hint:s}=n,{blanks:i,fill:c,back:l,getChoice:d,registerBlank:m}=Ee(),v=Z(),h=Ge(),x=i[t],u=!!x?.choiceId,b=r?.showFeedback??!1,k=r?.state,g=r?.correctChoiceIds??[],E=b&&k==="incorrect"&&g.length>0?d(a||"",g[0]):void 0,y=E?E.html.replace(/<\/?[^>]+(>|$)/g,""):void 0,{setNodeRef:f,isOver:C}=uo({id:t,data:{type:"blank",blankId:t,poolId:a}}),{active:N}=fo(),I=!!N&&N.data.current?.poolId===a;return yn(()=>{m(a||"",t)},[a,t,m]),yn(()=>{let M=$=>{let q=$,{active:S,over:P}=q.detail||{};if(!P||P.id!==t)return;let{choiceId:B,poolId:D}=S?.data.current||{};if(!B||D!==a)return;let j=d(a||"",B);if(!j)return;let z=j.html.replace(/<\/?[^>]+(>|$)/g,"");c(t,a||"",B,z)};return window.addEventListener("dnd-drop",M),()=>window.removeEventListener("dnd-drop",M)},[t,a,d,c]),ht(bn,{children:[Ur("span",{ref:f,onClick:()=>{u&&!b&&l(t)},className:Hr("player-choice-blank",C&&"player-choice-blank--over",!C&&I&&!u&&!b&&"player-choice-blank--target",u&&!b&&!C&&"player-choice-blank--filled",b&&k==="correct"&&Hr("player-choice-blank--correct",h.hop),b&&k==="partial"&&Hr("player-choice-blank--partial",h.hop),b&&k==="incorrect"&&Hr("player-choice-blank--incorrect",h.wobble)),title:u&&!b?v.clickToRemove:void 0,"data-node-id":t,"data-pool-id":a,children:u?ht(bn,{children:[Ur("span",{children:x.value}),Ur("span",{className:"player-choice-blank__clear",children:"\xD7"})]}):o}),y&&ht("span",{className:"player-blank-reveal",children:["(",y,")"]}),Ur(Me,{hint:s})]})}import{jsx as gt,jsxs as bo}from"react/jsx-runtime";import{useEffect as vn,useState as yo}from"react";import xo from"clsx";import{jsx as xn}from"react/jsx-runtime";import ho from"clsx";import{useDraggable as go}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:l,attributes:d,listeners:m,transform:v,isDragging:h}=go({id:s,data:{type:"choice",choiceId:s,poolId:e,html:i},disabled:c});if(c)return null;let x=g=>g.replace(/<\/?[^>]+(>|$)/g,""),u=()=>{let g=a(e);if(g){let E=x(i);o(g,e,s,E)}},b=v?{transform:`translate3d(${v.x}px, ${v.y}px, 0)`}:void 0;return xn(t?"span":"div",{ref:l,style:b,className:ho("player-bank-pill",h&&"player-bank-pill--dragging",t&&"mx-1"),...d,...m,onClick:u,children:xn("span",{dangerouslySetInnerHTML:{__html:i},className:"pointer-events-none whitespace-pre-wrap break-words"})})}function Er({node:e}){let r=Z(),{id:t,attrs:n,content:a}=e,{shuffle:o=!0,equalWidth:s=!1}=n,{registerPool:i}=Ee(),[c,l]=yo(()=>a.map(d=>({id:d.id,html:ee(d.content)})));return vn(()=>{let d=a.map(m=>({id:m.id,html:ee(m.content)}));l(o?[...d].map(m=>({v:m,r:Math.random()})).sort((m,v)=>m.r-v.r).map(m=>m.v):d)},[o,JSON.stringify(a)]),vn(()=>{i(t,c)},[t,c,i]),bo("div",{className:"player-word-bank",children:[gt("div",{className:"player-word-bank__label",children:r.wordBank}),gt("div",{className:xo("player-word-bank__items",s&&"player-word-bank__items--grid"),children:c.map(d=>gt(tr,{poolId:t,data:d},d.id))})]})}import{jsx as bt,jsxs as vo}from"react/jsx-runtime";import{useEffect as wn,useState as wo}from"react";function Mr({node:e}){let{id:r,attrs:t,content:n}=e,{shuffle:a=!0,separator:o=" "}=t,{registerPool:s}=Ee(),[i,c]=wo(()=>n.map(l=>({id:l.id,html:ee(l.content,{stripParagraphs:!0})})));return wn(()=>{let l=n.map(d=>({id:d.id,html:ee(d.content,{stripParagraphs:!0})}));c(a?[...l].map(d=>({v:d,r:Math.random()})).sort((d,m)=>d.r-m.r).map(d=>d.v):l)},[a,JSON.stringify(n)]),wn(()=>{s(r,i)},[r,i,s]),bt("span",{style:{display:"inline-flex",flexWrap:"wrap",gap:A("0.25rem"),alignItems:"center"},children:i.map((l,d)=>vo("span",{children:[bt(tr,{poolId:r,data:l,isInline:!0}),d<i.length-1&&bt("span",{children:o})]},l.id))})}import{jsx as nr,jsxs as wt}from"react/jsx-runtime";import{useState as kt,useEffect as Rt,useMemo as _o}from"react";import{Check as No,X as Co}from"lucide-react";import{jsx as pe,jsxs as Qe}from"react/jsx-runtime";import{useState as yt,useMemo as xt,useRef as vt,useCallback as ko,useLayoutEffect as Ro}from"react";var kn="#1d2025",Rn="#8d93a0",Sn="#1f8a4c",_n="#d23b2b",So=11;function Nn({leftItems:e,rightItems:r,connections:t,direction:n,disabled:a,feedback:o,onConnectionsChange:s}){let[i,c]=yt(null),[l,d]=yt(null),[m,v]=yt(new Map),h=vt(null),x=vt(new Map),u=vt("mouse"),b=o?.showFeedback??!1,k=xt(()=>{let w=new Map;if(o?.pairFeedback)for(let R of o.pairFeedback)w.set(`${R.leftId}-${R.rightId}`,R.correct);return w},[o]),g=xt(()=>{let w=new Map;return o?.correctPairings?.forEach(R=>w.set(R.leftId,R.rightId)),w},[o]),E=xt(()=>{let w=new Map;return o?.correctPairings?.forEach(R=>w.set(R.rightId,R.leftId)),w},[o]),y=new Map,f=new Map;t.forEach((w,R)=>{y.set(w.leftId,R),f.set(w.rightId,R)});let C=w=>{let R=t[w];if(!b||!R)return null;let F=k.get(`${R.leftId}-${R.rightId}`);return F===!0?"correct":F===!1?"incorrect":null},N=ko(()=>{if(!h.current)return;let w=h.current.getBoundingClientRect(),R=new Map;x.current.forEach((F,H)=>{if(F){let V=F.getBoundingClientRect();R.set(H,new DOMRect(V.left-w.left,V.top-w.top,V.width,V.height))}}),v(R)},[]);Ro(()=>{N();let w=new ResizeObserver(N);return h.current&&w.observe(h.current),()=>w.disconnect()},[N,t,e,r]);let I=8,T=(w,R)=>{let F=m.get(w);if(!F)return null;let H=F.y+F.height/2;return R==="left"?{x:F.x+F.width,y:H}:{x:F.x-I,y:H}},p=(w,R)=>{if(a)return;let H=(R==="left"?y:f).has(w),V=i?.id===w&&i?.side===R,me=i!==null&&i.side!==R;if(V){c(null);return}if(me){let te=R==="right"?i.id:w,ne=R==="left"?i.id:w,ie=t.filter(re=>re.leftId!==te&&re.rightId!==ne);ie.push({leftId:te,rightId:ne}),s(ie),c(null);return}if(H&&!i){let te=R==="left"?t.filter(ne=>ne.leftId!==w):t.filter(ne=>ne.rightId!==w);s(te);return}c({id:w,side:R})},M=(w,R,F)=>{if(a||(u.current=F.pointerType,F.pointerType==="touch"))return;F.currentTarget.setPointerCapture(F.pointerId);let H=h.current.getBoundingClientRect();d({fromId:w,fromSide:R,x:F.clientX-H.left,y:F.clientY-H.top,overId:null,overSide:null})},$=w=>{if(!l)return;let R=h.current.getBoundingClientRect(),F=w.clientX-R.left,H=w.clientY-R.top,V=l.fromSide==="left"?"right":"left",me=V==="left"?e:r,te=null,ne=null;for(let ie of me){let re=m.get(ie.id);if(re&&F>=re.x&&F<=re.x+re.width&&H>=re.y&&H<=re.y+re.height){te=ie.id,ne=V;break}}d(ie=>ie?{...ie,x:F,y:H,overId:te,overSide:ne}:null)},q=w=>{if(!l)return;let R=h.current.getBoundingClientRect(),F=w.clientX-R.left,H=w.clientY-R.top,V=T(l.fromId,l.fromSide);if((V?Math.hypot(F-V.x,H-V.y):999)<8){d(null),p(l.fromId,l.fromSide);return}if(l.overId&&l.overSide){let te=l.fromSide==="left"?l.fromId:l.overId,ne=l.fromSide==="right"?l.fromId:l.overId,ie=t.filter(re=>re.leftId!==te&&re.rightId!==ne);ie.push({leftId:te,rightId:ne}),s(ie)}d(null),c(null)},S=(w,R)=>{if(!b)return null;let H=(R==="left"?y:f).get(w.id);if(H!==void 0){let V=t[H];if(k.get(`${V.leftId}-${V.rightId}`)===!0)return null}if(R==="left"){let V=g.get(w.id);return r.find(me=>me.id===V)?.content??null}else{let V=E.get(w.id);return e.find(me=>me.id===V)?.content??null}},P=(w,R)=>{let H=(R==="left"?y:f).get(w.id),V=H!==void 0,me=i?.id===w.id&&i?.side===R,te=i!==null&&i.side!==R&&!V,ne=l?.overId===w.id&&l?.overSide===R,ie=V?C(H):null,re=V?H+1:null,Ce="matching-player__item";V&&(Ce+=" matching-player__item--matched"),ie==="correct"&&(Ce+=" matching-player__item--correct"),ie==="incorrect"&&(Ce+=" matching-player__item--incorrect"),me&&(Ce+=" matching-player__item--selected"),(te||ne)&&(Ce+=" matching-player__item--available"),a&&(Ce+=" matching-player__item--disabled");let dr=S(w,R);return Qe("button",{ref:Xe=>{Xe?x.current.set(w.id,Xe):x.current.delete(w.id)},type:"button",className:Ce,onPointerDown:Xe=>M(w.id,R,Xe),onClick:()=>{u.current==="touch"&&p(w.id,R)},"aria-pressed":me,children:[R==="right"&&pe("span",{className:"matching-player__connector matching-player__connector--right","aria-hidden":!0,children:Qe("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"})]})}),V&&R==="left"&&pe("span",{className:"matching-player__pair-num","aria-hidden":!0,children:re}),pe("span",{className:"matching-player__item-text",dangerouslySetInnerHTML:{__html:ee(w.content)}}),dr&&Qe("span",{className:"matching-player__correct-hint",children:["(",pe("span",{dangerouslySetInnerHTML:{__html:ee(dr)}}),")"]}),V&&R==="right"&&pe("span",{className:"matching-player__pair-num","aria-hidden":!0,children:re}),R==="left"&&pe("span",{className:"matching-player__connector matching-player__connector--left","aria-hidden":!0,children:Qe("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"})]})})]},w.id)},B=n==="ltr"?e:r,D=n==="ltr"?r:e,j=n==="ltr"?"left":"right",z=n==="ltr"?"right":"left";return Qe("div",{ref:h,className:`matching-player__arena${l?" matching-player__arena--dragging":""}`,onPointerMove:$,onPointerUp:q,children:[Qe("svg",{className:"matching-player__svg","aria-hidden":!0,children:[pe("defs",{children:[["mp-arrow-ink",kn],["mp-arrow-correct",Sn],["mp-arrow-incorrect",_n],["mp-arrow-ghost",Rn]].map(([w,R])=>pe("marker",{id:w,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:R})},w))}),t.map(w=>{let R=T(w.leftId,"left"),F=T(w.rightId,"right");if(!R||!F)return null;let H=F.x-So,V=Math.max(16,Math.abs(H-R.x)*.4),me=`M ${R.x} ${R.y} C ${R.x+V} ${R.y}, ${H-V} ${F.y}, ${H} ${F.y}`,te=b?k.get(`${w.leftId}-${w.rightId}`):void 0;return pe("path",{d:me,stroke:te===!0?Sn:te===!1?_n:kn,strokeWidth:"2.5",fill:"none",markerEnd:`url(#${te===!0?"mp-arrow-correct":te===!1?"mp-arrow-incorrect":"mp-arrow-ink"})`},`${w.leftId}-${w.rightId}`)}),l&&(()=>{let w=T(l.fromId,l.fromSide);if(!w)return null;let R=Math.abs(l.x-w.x)*.35,F=`M ${w.x} ${w.y} C ${w.x+R} ${w.y}, ${l.x-R} ${l.y}, ${l.x} ${l.y}`;return pe("path",{d:F,stroke:Rn,strokeWidth:"2",strokeDasharray:"6 4",fill:"none",markerEnd:"url(#mp-arrow-ghost)"})})()]}),Qe("div",{className:"matching-player__columns",children:[pe("div",{className:"matching-player__column",children:B.map(w=>P(w,j))}),pe("div",{className:"matching-player__column",children:D.map(w=>P(w,z))})]})]})}var Cn=e=>Number.isInteger(e)?String(e):e.toFixed(2);function An(e){return[...e].map(r=>({v:r,r:Math.random()})).sort((r,t)=>r.r-t.r).map(r=>r.v)}function Ir({node:e,validationFeedback:r}){let t=ce(),{shuffleSeed:n,layoutBy:a}=_e(),{id:o,attrs:s,leftItems:i,rightItems:c}=e,{direction:l,shuffle:d,hint:m}=s,v=JSON.stringify(i),h=JSON.stringify(c),x=d&&n!==void 0,u=_o(()=>x?{left:ur(i,`${n}:${o}:left`),right:ur(c,`${n}:${o}:right`)}:null,[x,n,o,v,h]),[b,k]=kt(i),[g,E]=kt(c);Rt(()=>{x||(d?(k(An(i)),E(An(c))):(k(i),E(c)))},[d,x,v,h]);let y=u?.left??b,f=u?.right??g,[C,N]=kt([]),I=r?.showFeedback??!1;Rt(()=>{let S=P=>{let D=P.answers.find(j=>j.nodeId===o&&j.type==="matchingSet");D&&"connections"in D.answer&&N(D.answer.connections)};return t.on("answers:prefill",S),()=>t.off("answers:prefill",S)},[t,o]),Rt(()=>{t.emit({type:"answer:changed",answer:{nodeId:o,type:"matchingSet",timestamp:Date.now(),answer:{connections:C}}})},[t,o,C]);let T=S=>{I||N(S)},p=r?.score,M=r?.maxScore,$=I&&p!=null&&M!=null,q=$?p>=M?"correct":p>0?"partial":"incorrect":null;return wt("div",{className:a==="box"?"matching-player matching-player--box":"matching-player",children:[m&&m.length>0&&nr("div",{className:"matching-player-hintrow",children:nr(Me,{hint:m})}),nr(Nn,{leftItems:y,rightItems:f,connections:C,direction:l,disabled:I,feedback:r,onConnectionsChange:T}),$&&wt("div",{className:"matching-player-feedback matching-player-feedback--"+q,children:[q==="correct"&&nr(No,{size:15,style:X(15)}),q==="incorrect"&&nr(Co,{size:15,style:X(15)}),nr("span",{children:q==="correct"?"All matched":q==="partial"?"Partial credit":"Not matched"}),wt("span",{className:"matching-player-score",children:[Cn(p)," / ",Cn(M)]})]})]})}import{jsxs as ar,jsx as Ie,Fragment as Ao}from"react/jsx-runtime";import{useState as Pn,useEffect as St,useRef as Po,useCallback as En}from"react";import Vr from"clsx";function Lr({node:e,validationFeedback:r}){let t=ce(),n=Z(),{id:a,attrs:o}=e,{placeholder:s,minWords:i=0,maxWords:c=500,hint:l}=o,[d,m]=Pn(""),[v,h]=Pn(0),x=r?.showFeedback??!1,u=r?.state,b=c<=30,k=En(p=>p.trim().split(/\s+/).filter(Boolean).length,[]);St(()=>{let p=M=>{let q=M.answers?.find(S=>S.nodeId===a&&S.type==="aiAnswer");if(q&&q.answer?.text!=null){let S=q.answer.text;m(S),h(k(S))}};return t.on("answers:prefill",p),()=>t.off("answers:prefill",p)},[a,t,k]),St(()=>{let p=()=>{m(""),h(0)};return t.on("answers:reset",p),()=>t.off("answers:reset",p)},[t]);let g=Po(null),E=En((p,M)=>{g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{t.emit({type:"answer:changed",answer:{nodeId:a,type:"aiAnswer",timestamp:Date.now(),answer:{text:p,wordCount:M}}})},300)},[a,t]);St(()=>{t.emit({type:"answer:changed",answer:{nodeId:a,type:"aiAnswer",timestamp:Date.now(),answer:{text:"",wordCount:0}}})},[]);let y=p=>{if(x)return;let M=k(p);m(p),h(M),E(p,M)},f=u==="validating",C=Vr("player-ai-count",v>c&&"player-ai-count--over"),N=!x||f?"":u==="correct"?"player-ai-input--correct":u==="incorrect"?"player-ai-input--incorrect":u==="partial"?"player-ai-input--partial":"",I=u==="correct"?"player-ai-feedback--correct":u==="incorrect"?"player-ai-feedback--incorrect":u==="partial"?"player-ai-feedback--partial":"",T=p=>Number.isInteger(p)?String(p):p.toFixed(2);return ar("div",{className:"player-ai",children:[ar("div",{className:"player-ai-counts",children:[ar("span",{className:C,children:[v," / ",c]}),i>0&&v<i&&Ie("span",{className:"player-ai-count player-ai-count--min",children:n.minWordsLabel(i)}),Ie("span",{style:{marginInlineStart:"auto"},children:Ie(Me,{hint:l})})]}),b?Ie("input",{type:"text",value:d,onChange:p=>y(p.target.value),placeholder:s??n.shortAnswerPlaceholder,disabled:x,className:Vr("player-ai-input",N)}):Ie("textarea",{value:d,onChange:p=>y(p.target.value),placeholder:s??n.longAnswerPlaceholder,disabled:x,rows:5,className:Vr("player-ai-input player-ai-input--multiline",N)}),x&&r&&Ie("div",{className:Vr("player-ai-feedback",I),children:f?ar("div",{className:"player-ai-validating",children:[Ie("span",{className:"player-ai-spinner"}),Ie("span",{children:n.aiEvaluationInProgress})]}):ar(Ao,{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:[T(r.score)," / ",T(r.maxScore)]})})]})})]})}import{Fragment as Mn,jsx as _,jsxs as Y}from"react/jsx-runtime";import{useState as he,useEffect as we,useRef as ve,useCallback as Gr}from"react";import{useEditor as Eo,EditorContent as Mo}from"@tiptap/react";import Io from"@tiptap/starter-kit";import Le from"clsx";import{FolderOpen as Lo,Mic as To,Video as Tn,Monitor as $o,Clock as zo,Image as Do,FileText as $n,Music as Fo,Link2 as jo}from"lucide-react";function zn(e){return e.trim().split(/\s+/).filter(Boolean).length}function Dn(e){return e.length}function Oo(e){let r=t=>t.map(n=>(n.text??"")+(n.content?r(n.content):"")).join(" ");return zn(r(e))}function Bo(e){let r=t=>t.map(n=>(n.text??"")+(n.content?r(n.content):"")).join("");return Dn(r(e))}function _t({node:e}){if(e.type==="text"){if(!e.marks||e.marks.length===0)return _(Mn,{children:e.text});let r=e.text||"";for(let t of e.marks)t.type==="bold"?r=_("strong",{children:r}):t.type==="italic"?r=_("em",{children:r}):t.type==="underline"?r=_("u",{children:r}):t.type==="strike"?r=_("s",{children:r}):t.type==="textStyle"&&t.attrs?.color&&(r=_("span",{style:{color:t.attrs.color},children:r}));return _(Mn,{children:r})}return e.type==="paragraph"?_("span",{className:"block",children:e.content?.map((r,t)=>_(_t,{node:r},t))??_("br",{})}):e.type==="hardBreak"?_("br",{}):e.content?_("span",{className:"block",children:e.content.map((r,t)=>_(_t,{node:r},t))}):null}function Wo({nodes:e}){return _("span",{className:"block space-y-1 text-amber-900",children:e.map((r,t)=>_(_t,{node:r},t))})}function qo({hint:e}){let r=Z(),[t,n]=he(!1),[a,o]=he(!1),s=ve(null);return we(()=>{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]),Y("span",{ref:s,className:"relative inline-flex items-center align-middle",onMouseEnter:()=>n(!0),onMouseLeave:()=>{a||n(!1)},children:[_("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&&_("span",{className:"player-blank-hint-pop",onClick:i=>i.stopPropagation(),children:_(Wo,{nodes:e})})]})}function In(e){if(!isFinite(e.duration)){e.currentTime=1e101;let r=()=>{e.currentTime=0,e.removeEventListener("timeupdate",r)};e.addEventListener("timeupdate",r)}}function Uo(e){return/youtube\.com|youtu\.be/i.test(e)?"youtube":/vimeo\.com/i.test(e)?"vimeo":"other"}function Ho(e){let r=e.match(/[?&]v=([^&]+)/)||e.match(/youtu\.be\/([^?]+)/)||e.match(/embed\/([^?]+)/);return r?r[1]:null}function Ln(e){let r=Math.floor(e/60),t=e%60;return`${r}:${t.toString().padStart(2,"0")}`}function Tr({node:e,validationFeedback:r,readOnly:t=!1,mediaHandler:n}){let a=ce(),o=Z(),{id:s,attrs:i}=e,{mode:c,placeholder:l,allowFormatting:d,wordLimit:m,characterLimit:v,allowedTypes:h,allowMultiple:x,fileInstructions:u,maxDuration:b,hint:k}=i,g=t||(r?.showFeedback??!1),E=r?.state,y=ve(null),f=Gr(p=>{y.current&&clearTimeout(y.current),y.current=setTimeout(()=>{let M=p.files?.map($=>({url:$.url,mimeType:$.kind==="videoLink"?"video/x-link":$.mimeType,name:$.kind==="videoLink"?void 0:$.name,duration:$.kind==="videoLink"?void 0:$.duration}));a.emit({type:"answer:changed",answer:{nodeId:s,type:"openResponse",timestamp:Date.now(),answer:{...p,files:M}}})},300)},[s,a]);we(()=>{f({})},[]);let[C,N]=he([]);we(()=>{(c==="file"||c==="text+file")&&c==="file"&&f({files:C})},[C,c]),we(()=>{let p=()=>{N([])};return a.on("answers:reset",p),()=>a.off("answers:reset",p)},[a]),we(()=>{let p=M=>{let q=(M.answers??[]).find(S=>S.nodeId===s&&S.type==="openResponse");q?.answer?.files&&N(q.answer.files)};return a.on("answers:prefill",p),()=>a.off("answers:prefill",p)},[s,a]);let I=r?.showFeedback,T=Le(!I&&"player-or-field--pre",I&&E==="correct"&&"player-or-field--correct",I&&E==="partial"&&"player-or-field--partial",I&&E==="incorrect"&&"player-or-field--incorrect",I&&E==="awaiting_review"&&"player-or-field--review");return Y("div",{className:"my-3 space-y-2",children:[!g&&k&&k.length>0&&_("div",{className:"flex justify-end",children:_(qo,{hint:k})}),c==="text"&&_(Fn,{nodeId:s,placeholder:l,allowFormatting:d,wordLimit:m,characterLimit:v,isDisabled:g,feedbackBorderClass:T,emitAnswer:p=>f({text:p}),answerBus:a}),c==="file"&&_(Nt,{allowedTypes:h??["image"],allowMultiple:!!x,fileInstructions:u,isDisabled:g,feedbackBorderClass:T,files:C,setFiles:N,mediaHandler:n,t:o}),(c==="audio"||c==="video"||c==="screen")&&_(Ko,{kind:c,maxDuration:b,isDisabled:g,feedbackBorderClass:T,mediaHandler:n,emitAnswer:p=>f({recording:p}),t:o}),c==="text+file"&&_(Yo,{nodeId:s,placeholder:l,allowFormatting:d,wordLimit:m,characterLimit:v,allowedTypes:h??["image"],allowMultiple:!!x,fileInstructions:u,isDisabled:g,feedbackBorderClass:T,files:C,setFiles:N,emitAnswer:f,answerBus:a,mediaHandler:n,t:o}),r?.showFeedback&&E==="awaiting_review"&&Y("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:[_(zo,{size:15,style:X(15),className:"animate-pulse"}),_("span",{children:o.openResponseAwaitingReview})]}),r?.showFeedback&&E!=="awaiting_review"&&r.teacherFeedback&&_(Jo,{feedback:r.teacherFeedback,feedbackState:E,score:r.score,t:o})]})}function Fn({nodeId:e,placeholder:r,allowFormatting:t,wordLimit:n,characterLimit:a,isDisabled:o,feedbackBorderClass:s,emitAnswer:i,answerBus:c}){let l=Z(),[d,m]=he(""),[v,h]=he(0),[x,u]=he(0),b=ve(null),k=Gr(()=>{let P=b.current;P&&(P.style.height="auto",P.style.height=`${P.scrollHeight}px`)},[]),g=Eo({extensions:[Io.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1})],immediatelyRender:!1,editable:!o,content:"",onUpdate({editor:P}){if(o)return;let D=P.getJSON().content??[],j=Oo(D),z=Bo(D);h(j),u(z),i({content:D,wordCount:j})}});we(()=>{g&&g.setEditable(!o)},[o,g]);let E=ve(null);we(()=>{g&&E.current!==null&&(g.commands.setContent({type:"doc",content:E.current}),E.current=null)},[g]),we(()=>{let P=B=>{let D=(B.answers??[]).find(z=>z.nodeId===e&&z.type==="openResponse");if(!D?.answer?.text)return;let j=D.answer.text.content??[];if(t)g?g.commands.setContent({type:"doc",content:j}):E.current=j;else{let z=j.flatMap(W=>W.content?.map(w=>w.text??"")??[W.text??""]).join(`
2
- `);m(z),setTimeout(k,0)}};return c.on("answers:prefill",P),()=>c.off("answers:prefill",P)},[e,c,t,g]),we(()=>{let P=()=>{t&&g?g.commands.clearContent():(m(""),setTimeout(k,0)),h(0),u(0)};return c.on("answers:reset",P),()=>c.off("answers:reset",P)},[c,t,g,k]);let y=!!n,f=!!a&&!n,C=y?v:x,N=y?n?.max:a?.max,I=y?n?.min:a?.min,T=N!=null&&C>N,p=N!=null&&C>=N*.8&&!T,M=I!=null&&C<I&&C>0,$="text-xs tabular-nums",q=T?{color:"var(--pen, #d23b2b)",fontWeight:500}:p||M?{color:"var(--almost, #c8810e)"}:{color:"var(--ink-faint, #8d93a0)"},S=y?N?`${v} / ${N} ${l.openResponseWords}`:I?`${v} ${l.openResponseWords} (min. ${I})`:`${v} ${l.openResponseWords}`:f?N?`${x} / ${N} ${l.openResponseChars}`:`${x} ${l.openResponseChars}`:null;return t?Y("div",{className:"relative",children:[Y("div",{className:Le("rounded border transition-colors min-h-[120px]",s),children:[!o&&Y("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:P,cmd:B,style:D})=>_("button",{type:"button",onMouseDown:j=>{j.preventDefault(),g?.chain().focus()?.[B]().run()},className:`text-xs px-1.5 py-0.5 rounded hover:bg-gray-100 ${D}`,children:P},P)),_("button",{type:"button",onMouseDown:P=>{P.preventDefault(),g?.chain().focus().toggleBulletList().run()},className:"text-xs px-1.5 py-0.5 rounded hover:bg-gray-100",children:"\u2022\u2014"})]}),_(Mo,{editor:g,className:"prose prose-sm max-w-none p-3 outline-none [&_.ProseMirror]:min-h-[80px] [&_.ProseMirror]:outline-none"})]}),S&&_("div",{className:Le("absolute bottom-2 right-3",$),style:q,children:S})]}):Y("div",{className:"relative",children:[_("textarea",{ref:b,value:d,onChange:P=>{if(o)return;let B=P.target.value;m(B);let D=zn(B),j=Dn(B);h(D),u(j),k(),i({content:[{type:"paragraph",content:[{type:"text",text:B}]}],wordCount:D})},onInput:k,disabled:o,placeholder:r||l.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")}),S&&_("div",{className:Le("absolute bottom-2 right-3",$),children:S})]})}var Vo={image:"image/*",pdf:"application/pdf",audio:"audio/*",video:"video/*"},Go={image:_(Do,{size:12,style:X(12)}),pdf:_($n,{size:12,style:X(12)}),audio:_(Fo,{size:12,style:X(12)}),video:_(Tn,{size:12,style:X(12)}),videoLink:_(jo,{size:12,style:X(12)})};function Nt({allowedTypes:e,allowMultiple:r,fileInstructions:t,isDisabled:n,files:a,setFiles:o,mediaHandler:s,t:i,compact:c=!1}){let l=ve(null),[d,m]=he(!1),[v,h]=he(!1),[x,u]=he(""),b=e.some(p=>p!=="videoLink"),k=e.includes("videoLink"),g=r||a.length===0,E=e.filter(p=>p!=="videoLink").map(p=>Vo[p]).filter(Boolean).join(","),y=Gr(p=>{o(M=>r?[...M,p]:[p])},[r,o]),f=Gr(p=>{o(M=>M.filter(($,q)=>q!==p))},[o]),C=async p=>{if(!(!g||n)){m(!0);try{let M=p.type.startsWith("image/")?"image":p.type==="application/pdf"?"document":p.type.startsWith("audio/")?"audio":p.type.startsWith("video/")?"video":"file";if(s){let $=await s.upload(p,M);y({kind:"file",url:$.url,mimeType:$.mimeType??p.type,name:p.name})}else{let $=URL.createObjectURL(p);y({kind:"file",url:$,mimeType:p.type,name:p.name})}}finally{m(!1)}}},N=async p=>{if(p.preventDefault(),h(!1),n||!g)return;let M=p.dataTransfer.files?.[0];M&&await C(M)},I=()=>{let p=x.trim();p&&(y({kind:"videoLink",url:p,platform:Uo(p)}),u(""))},T={image:i.openResponseTypeImage,pdf:i.openResponseTypePdf,audio:i.openResponseTypeAudio,video:i.openResponseTypeVideo,videoLink:i.openResponseTypeVideoLink};return Y("div",{className:"space-y-2",children:[t&&!c&&_("p",{className:"text-sm text-gray-600 italic",children:t}),a.length>0&&_("div",{className:c?"flex flex-wrap gap-1.5":"space-y-2",children:a.map((p,M)=>_(Qo,{file:p,onRemove:n?void 0:()=>f(M),compact:c,t:i},M))}),!n&&g&&Y("div",{className:"space-y-2",children:[b&&!c&&Y("div",{onDragOver:p=>{p.preventDefault(),h(!0)},onDragLeave:()=>h(!1),onDrop:N,className:"border-2 border-dashed rounded-lg p-6 text-center transition-colors cursor-pointer",style:{borderColor:v?"var(--ink-faint, #8d93a0)":"var(--line-strong, #d6d3cc)",background:v?"var(--ui-muted, #f5f4f1)":"transparent"},onClick:()=>l.current?.click(),children:[_(Lo,{size:26,className:"mx-auto mb-2",style:{...X(26),color:"var(--ink-soft, #565b66)"}}),_("p",{className:"text-sm font-medium",style:{color:"var(--ink-soft, #565b66)"},children:i.openResponseDropZoneLabel}),_("p",{className:"text-xs hover:underline mt-0.5",style:{color:"var(--ink, #1d2025)"},children:i.openResponseDropZoneBrowse}),d&&_("p",{className:"text-xs mt-1 animate-pulse",style:{color:"var(--ink-faint, #8d93a0)"},children:i.openResponseUploading}),_("div",{className:"flex flex-wrap justify-center gap-1.5 mt-3",children:e.filter(p=>p!=="videoLink").map(p=>Y("span",{className:"inline-flex items-center gap-1 text-[10px] px-2 py-0.5 bg-gray-100 text-gray-600 rounded-full",children:[Go[p]," ",T[p]]},p))})]}),b&&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}`}),_("input",{ref:l,type:"file",accept:E,onChange:async p=>{let M=p.target.files?.[0];M&&(await C(M),p.target.value="")},className:"hidden"}),k&&Y("div",{className:"flex gap-2 flex-wrap",children:[_("input",{type:"url",value:x,onChange:p=>u(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(),I())}}),_("button",{type:"button",onClick:I,disabled:!x.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&&_("p",{className:"text-sm text-gray-400 text-center py-3",children:i.openResponseNoSubmission})]})}function Qo({file:e,onRemove:r,compact:t,t:n}){if(e.kind==="videoLink"){let a=e.platform==="youtube"?Ho(e.url):null;return Y("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&&_("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"}),_("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&&_("button",{type:"button",onClick:r,className:"ml-auto text-gray-400 hover:text-rose-500 text-xs",children:"\u2715"})]})}return Y("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/")?_("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/")?_("audio",{src:e.url,controls:!0,className:t?"hidden":"h-8 max-w-[240px]"}):e.mimeType?.startsWith("video/")?_("video",{src:e.url,controls:!0,className:t?"hidden":"h-16 max-w-[240px] rounded"}):_($n,{size:20,style:{...X(20),color:"var(--ink-soft, #565b66)"}}),Y("div",{className:"flex-1 min-w-0",children:[_("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/")&&_("audio",{src:e.url,controls:!0,className:"h-6 max-w-[160px] mt-0.5"})]}),r&&_("button",{type:"button",onClick:r,className:"ml-auto text-gray-400 hover:text-rose-500 text-xs shrink-0",children:"\u2715"})]})}function Yo({nodeId:e,placeholder:r,allowFormatting:t,wordLimit:n,characterLimit:a,allowedTypes:o,allowMultiple:s,fileInstructions:i,isDisabled:c,feedbackBorderClass:l,files:d,setFiles:m,emitAnswer:v,answerBus:h,mediaHandler:x,t:u}){let[b,k]=he(null),[g,E]=he(!1);return we(()=>{v({...b&&{text:b},files:d.length>0?d:void 0})},[b,d]),Y("div",{className:"space-y-2",children:[_(Fn,{nodeId:e,placeholder:r,allowFormatting:t,wordLimit:n,characterLimit:a,isDisabled:c,feedbackBorderClass:l,emitAnswer:y=>k(y),answerBus:h}),!c&&Y("div",{children:[Y("button",{type:"button",onClick:()=>E(!g),className:"flex items-center gap-1.5 text-xs",style:{color:"var(--ink-soft, #565b66)"},children:[_("span",{children:g?"\u25BE":"\u25B8"}),Y("span",{children:[u.openResponseAttachFiles,d.length>0&&_("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})]})]}),g&&_("div",{className:"mt-1.5",children:_(Nt,{allowedTypes:o,allowMultiple:s,fileInstructions:i,isDisabled:c,feedbackBorderClass:l,files:d,setFiles:m,mediaHandler:x,t:u,compact:!0})})]}),c&&d.length>0&&Y("div",{className:"space-y-1",children:[_("p",{className:"text-xs text-gray-500 font-medium",children:u.openResponseAttachedFiles}),_(Nt,{allowedTypes:o,allowMultiple:s,isDisabled:!0,feedbackBorderClass:l,files:d,setFiles:m,t:u,compact:!0})]})]})}function Ko({kind:e,maxDuration:r,isDisabled:t,feedbackBorderClass:n,mediaHandler:a,emitAnswer:o,t:s}){let[i,c]=he("idle"),[l,d]=he(0),[m,v]=he(null),[h,x]=he("audio/webm"),[u,b]=he(null),k=ve(null),g=ve(null),E=ve([]),y=ve(null),f=ve(null),C=ve(null),N=ve(0);we(()=>()=>{I(),y.current&&clearInterval(y.current),cancelAnimationFrame(N.current)},[]),we(()=>{i==="recording"&&e==="audio"&&g.current&&q(g.current)},[i]);let I=()=>{g.current?.getTracks().forEach(S=>S.stop()),g.current=null},T=async()=>{if(!a){b(s.openResponseMediaHandlerRequired);return}b(null),c("requesting");try{let S;if(e==="screen"){let D=await navigator.mediaDevices.getDisplayMedia({video:{cursor:"always"},audio:!1});try{let z=(await navigator.mediaDevices.getUserMedia({audio:!0})).getAudioTracks()[0];z&&D.addTrack(z)}catch{}D.getVideoTracks()[0]?.addEventListener("ended",()=>{k.current?.state==="recording"&&p()}),S=D,f.current&&(f.current.srcObject=S,f.current.play())}else e==="video"?(S=await navigator.mediaDevices.getUserMedia({audio:!0,video:{facingMode:"environment"}}),f.current&&(f.current.srcObject=S,f.current.play())):S=await navigator.mediaDevices.getUserMedia({audio:!0});g.current=S;let P=e==="audio"?"audio/webm":"video/webm";x(P);let B=new MediaRecorder(S,{mimeType:P});k.current=B,E.current=[],B.ondataavailable=D=>{D.data.size>0&&E.current.push(D.data)},B.onstop=()=>{let D=new Blob(E.current,{type:P}),j=URL.createObjectURL(D);v(j),c("reviewing"),I(),cancelAnimationFrame(N.current)},B.start(200),c("recording"),d(0),y.current=setInterval(()=>{d(D=>{let j=D+1;return r&&j>=r&&p(),j})},1e3)}catch{c("idle"),b(s.openResponsePermissionDenied)}},p=()=>{y.current&&(clearInterval(y.current),y.current=null),k.current?.stop()},M=async()=>{if(!m||!a)return;c("submitted");let P=await(await fetch(m)).blob(),B=e==="screen"?"video":e,D=new File([P],"recording.webm",{type:h}),j=await a.upload(D,B);URL.revokeObjectURL(m),o({url:j.url,mimeType:j.mimeType??h,duration:l,kind:B})},$=()=>{m&&URL.revokeObjectURL(m),v(null),d(0),c("idle")},q=S=>{let P=new AudioContext,B=P.createMediaStreamSource(S),D=P.createAnalyser();D.fftSize=64,B.connect(D);let j=new Uint8Array(D.frequencyBinCount),z=C.current;if(!z)return;let W=()=>{D.getByteFrequencyData(j);let w=z.getContext("2d");if(!w)return;w.clearRect(0,0,z.width,z.height);let R=z.width/j.length*2.5,F=0;for(let H=0;H<j.length;H++){let V=j[H]/255*z.height;w.fillStyle="#1d2025",w.fillRect(F,z.height-V,R,V),F+=R+1}N.current=requestAnimationFrame(W)};W()};return t?_("div",{className:Le("rounded border p-4 text-center text-sm text-gray-400",n),children:s.openResponseRecordingSubmitted}):Y("div",{className:Le("rounded border p-4 space-y-3",n),children:[u&&_("p",{className:"text-sm",style:{color:"var(--pen, #d23b2b)"},children:u}),(e==="video"||e==="screen")&&i==="recording"&&_("video",{ref:f,muted:!0,className:"w-full rounded max-h-48 bg-black",playsInline:!0}),e==="audio"&&i==="recording"&&_("canvas",{ref:C,width:300,height:48,className:"w-full rounded bg-gray-900"}),i==="reviewing"&&m&&(e==="audio"?_("audio",{src:m,controls:!0,className:"w-full",onLoadedMetadata:S=>In(S.currentTarget)}):_("video",{src:m,controls:!0,className:"w-full rounded max-h-48",onLoadedMetadata:S=>In(S.currentTarget)})),Y("div",{className:"flex items-center justify-center gap-3",children:[i==="idle"&&Y("button",{type:"button",onClick:T,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"?_(To,{size:22,style:X(22)}):e==="screen"?_($o,{size:22,style:X(22)}):_(Tn,{size:22,style:X(22)}),_("span",{className:"text-sm",children:e==="screen"?s.openResponseTapToRecordScreen:s.openResponseTapToRecord})]}),i==="requesting"&&_("p",{className:"text-sm text-gray-500 animate-pulse",children:s.openResponseRequestingPermission}),i==="recording"&&Y("div",{className:"flex flex-col items-center gap-2",children:[Y("div",{className:"flex items-center gap-2 font-mono text-lg",style:{color:"var(--pen, #d23b2b)"},children:[_("span",{className:"animate-pulse",children:"\u25CF"}),_("span",{children:Ln(l)}),r&&Y("span",{className:"text-sm",style:{color:"var(--ink-faint, #8d93a0)"},children:["/ ",Ln(r)]})]}),_("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"&&Y("div",{className:"flex gap-2",children:[_("button",{type:"button",onClick:$,className:"px-4 py-1.5 rounded border text-sm",style:{borderColor:"var(--line-strong, #d6d3cc)",color:"var(--ink, #1d2025)"},children:s.openResponseReRecord}),_("button",{type:"button",onClick:M,className:"px-4 py-1.5 rounded text-white text-sm",style:{background:"var(--ink, #1d2025)"},children:s.openResponseConfirmRecording})]}),i==="submitted"&&Y("p",{className:"text-sm",style:{color:"var(--ok, #1f8a4c)"},children:["\u2713 ",s.openResponseRecordingSubmitted]})]})]})}function Jo({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 Y("div",{className:"rounded p-3 text-sm border",style:{background:a.bg,borderColor:a.border,color:"var(--ink, #1d2025)"},children:[_("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&&Y("div",{className:"mt-1 text-right",style:{fontFamily:'var(--font-hand, "Caveat", cursive)',fontSize:A("1.4rem"),lineHeight:1,color:a.ink},children:[t," pts"]})]})}import{jsx as We,jsxs as or,Fragment as jn}from"react/jsx-runtime";import{useEffect as Ct,useRef as Xo,useState as On}from"react";function Zo(e){return e?.showFeedback?e.state==="validating"?"validating":e.state==="correct"?"correct":e.state==="incorrect"?"incorrect":"idle":"idle"}function $r({nodeId:e,placeholder:r,hint:t,validationFeedback:n,readOnly:a=!1}){let o=ce(),s=Xo(null),[i,c]=On(""),[l,d]=On(!1),m=Zo(n),v=n?.score,h=n?.maxScore,x=k=>Number.isInteger(k)?String(k):k.toFixed(2);Ct(()=>{import("mathlive").then(()=>{d(!0)}).catch(()=>{})},[]),Ct(()=>{let k=g=>{let E=g.answers?.find(y=>y.nodeId===e&&y.type==="mathResponse");E?.answer?.latex!==void 0&&(c(E.answer.latex),s.current&&(s.current.value=E.answer.latex))};return o.on("answers:prefill",k),()=>o.off("answers:prefill",k)},[o,e]),Ct(()=>{o.emit({type:"answer:changed",answer:{nodeId:e,type:"mathResponse",timestamp:Date.now(),answer:{latex:i}}})},[i,e,o]);let u=k=>{let g=k.target?.value??"";c(g)},b=m==="correct"?"player-math-field--correct":m==="incorrect"?"player-math-field--incorrect":m==="validating"?"player-math-field--validating":"";return or("div",{dir:"ltr",className:"math-response-player",children:[or("span",{style:{display:"inline-flex",alignItems:"center",gap:A("0.4rem")},children:[We("div",{className:"player-math-field"+(b?" "+b:"")+(a?" player-math-field--readonly":""),children:l?We("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"}}):We("input",{type:"text",value:i,onChange:k=>c(k.target.value),placeholder:r||"Enter LaTeX (e.g. \\frac{x^2}{2})",readOnly:a,className:"player-math-field__fallback"})}),We(Me,{hint:t})]}),n?.showFeedback&&or("div",{className:"player-math-feedback player-math-feedback--"+m,children:[m==="validating"&&or(jn,{children:[We("span",{className:"player-math-spinner"}),We("span",{children:"Checking your answer\u2026"})]}),m==="correct"&&or(jn,{children:[We("span",{children:"\u2713 Correct"}),v!=null&&or("span",{className:"player-math-score",children:[x(v),h!=null?` / ${x(h)}`:""]})]}),m==="incorrect"&&We("span",{children:"\u2717 Incorrect"})]})]})}import{jsx as J,jsxs as le,Fragment as gr}from"react/jsx-runtime";import{useCallback as gs,useEffect as bs,useRef as ys,useState as hr}from"react";import{Play as xs,Lock as vs,Check as Pt,X as qn}from"lucide-react";function Kr(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)=>Kr(d,l[m]))}let a=e,o=r,s=Object.keys(a),i=Object.keys(o);return s.length!==i.length?!1:s.every(c=>Kr(a[c],o[c]))}var es=`
1
+ import"./chunk-76CZ6Z7T.mjs";import Ti,{useMemo as $i}from"react";import{jsx as ir}from"react/jsx-runtime";import{useEffect as at,useMemo as fi,useRef as hi}from"react";import oo from"mitt";var Fe=class{constructor(){this.emitter=oo(),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()})}},xn="__edpireGlobalAnswerBus",vn=globalThis,Er=vn[xn]??(vn[xn]=new Fe);import{jsx as so}from"react/jsx-runtime";import{createContext as io,useContext as co}from"react";var wn="__edpireAnswerBusContext",kn=globalThis,Rn=kn[wn]??(kn[wn]=io(Er));function de(){return co(Rn)}function Pr({children:e,bus:r=new Fe}){return so(Rn.Provider,{value:r,children:e})}import{Fragment as Pn,jsx as G,jsxs as Be}from"react/jsx-runtime";import{Fragment as So,useState as Vr,useEffect as Hr,useMemo as _o,useRef as No}from"react";import Ee from"clsx";import{jsx as j}from"react/jsx-runtime";import lo from"katex";import"katex/dist/contrib/mhchem.js";var po={"\\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 lo.renderToString(e,{displayMode:r,output:t?"htmlAndMathml":"html",throwOnError:!1,errorColor:"#cc0000",macros:po,strict:!1})}catch(n){return`<span class="katex-error" style="color:#cc0000" title="${String(n)}">${e}</span>`}}function L(e){return`calc(${typeof e=="number"?`${e}px`:e} * var(--edp-scale, 1))`}function ee(e){return{width:L(e),height:L(e)}}function Ne(e){if(e==null||e==="")return;if(typeof e=="number")return L(e);let r=String(e).trim();return/^\d+(\.\d+)?px$/.test(r)?L(r):r}var Sn={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"}},_n={border:"#2563eb",background:"#e0f2fe"},Nn={border:"#dc2626",background:"#fee2e2"};function mo(e){return{display:"inline-block",verticalAlign:"middle",border:`2px solid ${e?.border||_n.border}`,background:e?.background||_n.background,borderRadius:L("4px"),padding:"0.17em 0.37em"}}var Lr=`${L("6px")} ${L("8px")}`;function uo(e){let r=e?.shape==="circle"?"50%":"9999px";return{display:"inline-block",verticalAlign:"middle",border:`2px solid ${e?.border||Nn.border}`,background:e?.background||Nn.background,borderRadius:r,padding:"0.15em 0.45em"}}function we(e,r,t){return j("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 j(Ir,{node:e,validationFeedback:t?.get(e.id)},r);case"blank":return e.attrs.mode==="typed"?j(Tr,{node:e,validationFeedback:t?.get(e.id)},r):j($r,{node:e,validationFeedback:t?.get(e.id)},r);case"blankPool":return j(zr,{node:e},r);case"inlinePool":return j(Dr,{node:e},r);case"matchingSet":return j(Fr,{node:e,validationFeedback:t?.get(e.id)},r);case"aiAnswerInput":return j(Or,{node:e,validationFeedback:t?.get(e.id)},r);case"openResponseNode":return j(jr,{node:e,validationFeedback:t?.get(e.id),readOnly:n?.readOnly,mediaHandler:n?.mediaHandler},r);case"mathResponse":return j(Br,{nodeId:e.id,placeholder:e.attrs?.placeholder,hint:e.attrs?.hint,validationFeedback:t?.get(e.id),readOnly:n?.readOnly},r);case"codingResponse":return j(Wr,{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 j("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=Sn[a]??Sn[3];return j(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 j("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 j("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=j("strong",{children:c});break;case"italic":c=j("em",{children:c});break;case"underline":c=j("u",{children:c});break;case"strike":c=j("s",{children:c});break;case"code":c=j("code",{children:c});break;case"subscript":c=j("sub",{children:c});break;case"superscript":c=j("sup",{children:c});break;case"boxedText":c=j("span",{style:mo(d.attrs),children:c});break;case"circleText":c=j("span",{style:uo(d.attrs),children:c});break}return j("span",{style:Object.keys(i).length>0?i:void 0,children:c},r)}case"hardBreak":return j("br",{},r);case"resizableImage":return j("img",{src:e.attrs?.src||void 0,alt:e.attrs?.alt||"",style:{display:"inline-block",verticalAlign:"middle",width:Ne(e.attrs?.width||void 0)??"auto",height:Ne(e.attrs?.height||void 0)??"auto",maxWidth:"100%"}},r);case"resizableAudio":return j("span",{style:{display:"inline-flex",verticalAlign:"middle",alignItems:"center",background:"#f1f5f9",borderRadius:L("8px"),padding:`${L("4px")} ${L("8px")}`,maxWidth:"100%"},children:j("audio",{controls:!0,src:e.attrs?.src||void 0,style:{display:"block",width:L("320px"),maxWidth:"100%"}})},r);case"resizableVideo":return j("video",{src:e.attrs?.src||void 0,controls:!0,style:{display:"inline-block",verticalAlign:"middle",width:Ne(e.attrs?.width||void 0)??"auto",height:Ne(e.attrs?.height||void 0)??"auto",maxWidth:"100%"}},r);case"youtubeEmbed":return j("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:Ne(e.attrs?.width||480),height:Ne(e.attrs?.height||270)}},r);case"inlineMath":return j("span",{dir:"ltr",style:{unicodeBidi:"isolate",display:"inline-block"},className:"math-inline",dangerouslySetInnerHTML:{__html:ur(e.attrs?.latex??"",!1,!0)}},r);case"blockMath":return j("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 j("span",{className:"variable",children:`{${e.attrs?.name}}`},r);default:{let a=e;return a.type==="bulletList"?j("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"?j("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"?j("li",{children:a.content?.map((o,s)=>ye(o,`${r}-${s}`,t,n))},r):a.type==="table"?j("div",{style:{overflowX:"auto",margin:`${L("1.25rem")} 0`},children:j("table",{style:{borderCollapse:"collapse",width:"100%",tableLayout:"fixed"},children:j("tbody",{children:a.content?.map((o,s)=>ye(o,`${r}-${s}`,t,n))})})},r):a.type==="tableRow"?j("tr",{children:a.content?.map((o,s)=>ye(o,`${r}-${s}`,t,n))},r):a.type==="tableCell"?j("td",{colSpan:a.attrs?.colspan,rowSpan:a.attrs?.rowspan,style:{border:"1px solid #d1d5db",padding:Lr,verticalAlign:"top"},children:a.content?.map((o,s)=>ye(o,`${r}-${s}`,t,n))},r):a.type==="tableHeader"?j("th",{colSpan:a.attrs?.colspan,rowSpan:a.attrs?.rowspan,style:{border:"1px solid #d1d5db",padding:Lr,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:${L("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:${L("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:${Lr};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:${Lr};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=Mr(n.width),o=Mr(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:${L("8px")};padding:${L("4px")} ${L("8px")};max-width:100%"><audio controls src="${Ye(n.src??"")}" style="display:block;width:${L("320px")};max-width:100%"></audio></span>`}if(t.type==="resizableVideo"){let n=t.attrs??{},a=Mr(n.width),o=Mr(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:${Ne(n.width||480)};height:${Ne(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 Mr(e){return e==null||e===""?null:Ne(e)??null}function Ye(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}import{jsx as fo}from"react/jsx-runtime";import{createContext as ho,useContext as Cn}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",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 qr={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",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 Ur={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",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 go={en:rr,fr:qr,ar:Ur},xt=ho(null);function re(){return Cn(xt)??rr}function fr(e){let r=Cn(xt);return e&&go[e]||r||rr}function hr({locale:e,children:r}){let t=fr(e);return fo(xt.Provider,{value:t,children:r})}import{jsx as bo}from"react/jsx-runtime";import{createContext as yo,useContext as An,useMemo as En}from"react";var xo={sm:.875,md:1,lg:1.25,xl:1.5},vt=yo(null);function vo(e,r){let t={...e??{}};if(r)for(let[n,a]of Object.entries(r))a!==void 0&&(t[n]=a);return t}function wo(e){return typeof e=="number"?Number.isFinite(e)&&e>0?e:1:e?xo[e]??1:1}function ke(e){let r=e??{};return{scale:wo(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=An(vt);return En(()=>vo(r,e),[r,e?.size,e?.choiceLabels,e?.choiceColumns,e?.layoutBy,e?.motion,e?.shuffleSeed])}function Ce(){let e=An(vt);return En(()=>ke(e),[e])}function ve({display:e,children:r}){let t=xe(e);return bo(vt.Provider,{value:t,children:r})}function Re(e){if(e.sizeSet)return{"--edp-scale":String(e.scale)}}function Ke(){let{motion:e}=Ce();return{hop:e==="none"?"":"animate-hop",shake:e==="full"?"animate-shake":"",wobble:e==="full"?"animate-wobble":""}}function ko(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 Ro(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 gr(e,r){let t=[...e],n=Ro(ko(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 wt({node:e}){if(e.type==="text"){if(!e.marks||e.marks.length===0)return G(Pn,{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(Pn,{children:r})}return e.type==="paragraph"?G("span",{className:"block",children:e.content?.map((r,t)=>G(wt,{node:r},t))??G("br",{})}):e.type==="hardBreak"?G("br",{}):e.content?G("span",{className:"block",children:e.content.map((r,t)=>G(wt,{node:r},t))}):null}function Co({nodes:e}){return G("span",{className:"block space-y-1",style:{color:"var(--ink, #1d2025)"},children:e.map((r,t)=>G(wt,{node:r},t))})}function Mn({hint:e}){let r=re(),[t,n]=Vr(!1),[a,o]=Vr(!1),s=No(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]),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:Ee("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(Co,{nodes:e})})]})}function Ao(e){return[...e].map(r=>({v:r,r:Math.random()})).sort((r,t)=>r.r-t.r).map(r=>r.v)}var Eo=e=>e.replace(/ {2,}/g,r=>"&nbsp;".repeat(r.length-1)+" "),Po=new Set(["image","resizableImage","resizableVideo","youtubeEmbed"]);function Tn(e){return(e??[]).some(r=>Po.has(r?.type)||Tn(r?.content))}var Ln=()=>G("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:3,children:G("path",{d:"M5 13l4 4L19 7"})}),In=()=>G("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:3,children:G("path",{d:"M6 6l12 12M18 6L6 18"})});function Ir({node:e,validationFeedback:r}){let t=de(),n=re(),a=Ce(),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,b="layout"in c?c.layout??"row":"row",v=e.type==="inlineChoiceSet",h=JSON.stringify(i),g=d&&a.shuffleSeed!==void 0,w=_o(()=>g?gr(i,`${a.shuffleSeed}:${s}`):null,[g,a.shuffleSeed,s,h]),[f,C]=Vr(i);Hr(()=>{g||C(d?Ao(i):i)},[d,g,h]);let u=w??f,[y,E]=Vr(new Set),P=r?.showFeedback??!1,z=r?.correctChoiceIds||[];Hr(()=>{let W=R=>{let D=R.answers.find(H=>H.nodeId===s&&H.type==="choiceSet");D&&"selectedIds"in D.answer&&E(new Set(D.answer.selectedIds))};return t.on("answers:prefill",W),()=>t.off("answers:prefill",W)},[s,t]),Hr(()=>{t.emit({type:"answer:changed",answer:{nodeId:s,type:"choiceSet",timestamp:Date.now(),answer:{selectedIds:Array.from(y)}}})},[y,s,t]);let k=W=>{P||E(R=>{let _=new Set(R);return x===1?_.has(W)?_.delete(W):(_.clear(),_.add(W)):_.has(W)?_.delete(W):_.size<x&&_.add(W),_})},m=W=>Eo(te(W.content)),N=W=>{let R=y.has(W),_=z.includes(W);return P?_&&R?"correct":_&&!R?"correct-unchosen":!_&&R?"incorrect":"muted":R?"selected":"idle"},I={idle:"",selected:"player-choice--selected",correct:Ee("player-choice--correct",o.hop),"correct-unchosen":"player-choice--correct-unchosen",incorrect:Ee("player-choice--incorrect",o.shake),muted:"player-choice--muted"},O={idle:"",selected:"player-inline-choice--selected",correct:Ee("player-inline-choice--correct",o.hop),"correct-unchosen":"player-inline-choice--correct-unchosen",incorrect:Ee("player-inline-choice--incorrect",o.shake),muted:"player-inline-choice--muted"};if(v)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]}),u.map((W,R)=>Be(So,{children:[G("button",{type:"button",disabled:P,onClick:()=>k(W.id),className:Ee("player-inline-choice",O[N(W.id)]),"aria-pressed":y.has(W.id),dangerouslySetInnerHTML:{__html:m(W)}}),R<u.length-1&&G("span",{className:"mx-1",children:p})]},W.id)),c.hint&&c.hint.length>0&&G(Mn,{hint:c.hint})]});let S=a.layoutBy==="box",M=a.choiceColumns?Math.min(a.choiceColumns,u.length):0,q=M?{gridAutoRows:"1fr",gridTemplateColumns:`repeat(${M}, minmax(0, 1fr))`}:{gridAutoRows:"1fr"},$=u.some(W=>Tn(W.content)),F=a.choiceLabels==="letters",Q=W=>n.choiceLetters[W]??String(W+1);return Be("div",{className:Ee("cs-player my-4 space-y-3",S&&"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(Mn,{hint:c.hint}),G("div",{className:Ee("cs-player__grid",b==="row"&&"cs-player__grid--row"),style:q,children:u.map((W,R)=>{let _=N(W.id),D=_==="incorrect"?"incorrect":_==="correct"||_==="correct-unchosen"?"correct":null;return Be("button",{type:"button",disabled:P,onClick:()=>k(W.id),className:Ee("player-choice",$&&"player-choice--tile",I[_]),"aria-pressed":y.has(W.id),children:[G("span",{className:Ee("player-choice__mark",x>1?"player-choice__mark--box":"player-choice__mark--radio",F&&"player-choice__mark--letter"),children:F?Q(R):_==="incorrect"?G(In,{}):G(Ln,{})}),G("span",{className:"player-choice__text",dangerouslySetInnerHTML:{__html:m(W)}}),F&&D&&G("span",{className:`player-choice__verdict player-choice__verdict--${D}`,"aria-hidden":"true",children:D==="incorrect"?G(In,{}):G(Ln,{})})]},W.id)})})]})}import{Fragment as kt,jsx as J,jsxs as Gr}from"react/jsx-runtime";import{useState as Rt,useEffect as Qr,useRef as $n,useCallback as Mo}from"react";import We from"clsx";function St({node:e}){if(e.type==="text"){if(!e.marks||e.marks.length===0)return J(kt,{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(kt,{children:r})}return e.type==="paragraph"?J("span",{className:"block",children:e.content?.map((r,t)=>J(St,{node:r},t))??J("br",{})}):e.type==="hardBreak"?J("br",{}):e.content?J("span",{className:"block",children:e.content.map((r,t)=>J(St,{node:r},t))}):null}function Lo({nodes:e}){return J("span",{className:"block space-y-1",children:e.map((r,t)=>J(St,{node:r},t))})}function Io({hint:e}){let r=re(),[t,n]=Rt(!1),[a,o]=Rt(!1),s=$n(null);return Qr(()=>{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]),Gr("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(Lo,{nodes:e})})]})}function Tr({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=$n(null),p=i.trim().split(/\s+/).filter(Boolean).length,x=c==="auto"&&p>=4,[b,v]=Rt(""),h=r?.showFeedback??!1,g=r?.state,w=g==="validating",f=r?.displayAnswer,C=r?.message;Qr(()=>{let P=z=>{let m=z.answers.find(N=>N.nodeId===o&&N.type==="blank");m&&"mode"in m.answer&&m.answer.mode==="typed"&&"text"in m.answer&&v(m.answer.text)};return t.on("answers:prefill",P),()=>t.off("answers:prefill",P)},[o,t]),Qr(()=>{t.emit({type:"answer:changed",answer:{nodeId:o,type:"blank",timestamp:Date.now(),answer:{mode:"typed",text:b}}})},[b,o,t]);let u=P=>{v(P.target.value)},y=Mo(()=>{let P=l.current;P&&(P.style.height="auto",P.style.height=`${P.scrollHeight}px`)},[]);Qr(()=>{y()},[b,y]);let E=h&&!w;return Gr("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:E?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:b||J("span",{className:"opacity-40",children:i})}):Gr(kt,{children:[J("textarea",{ref:l,placeholder:i,value:b,onChange:u,disabled:h,rows:1,className:We("player-typed-blank",x&&"w-full",w&&"player-typed-blank--pending"),style:c!=="auto"?{width:c}:x?{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})})]})}),h&&g==="incorrect"&&f&&Gr("span",{className:"player-blank-reveal",children:["(",f,")"]}),h&&C&&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:C}),d&&d.length>0&&J(Io,{hint:d})]})}import{jsx as Kr,Fragment as Wn,jsxs as At}from"react/jsx-runtime";import{useEffect as qn}from"react";import Jr from"clsx";import{useDroppable as Vo,useDndContext as Go}from"@dnd-kit/core";import{jsx as To}from"react/jsx-runtime";import{createContext as $o,useCallback as qe,useContext as zo,useEffect as Do,useMemo as zn,useRef as Fo,useState as _t}from"react";import{useDndMonitor as Oo}from"@dnd-kit/core";var Fn=$o(null);function Pe(){let e=zo(Fn);if(!e)throw new Error("usePool must be used within a PoolProvider");return e}function Dn(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 Yr({children:e,initialAnswers:r}){let t=de(),n=zn(()=>Dn(r),[r]),[a,o]=_t(n),[s,i]=_t({}),[c,d]=_t({}),l=Fo(new Set);Do(()=>{let u=y=>{let E=Dn(y.answers);Object.keys(E).length!==0&&o(P=>{if(!Object.entries(E).some(([m,N])=>P[m]?.choiceId!==N.choiceId||P[m]?.poolId!==N.poolId||P[m]?.value!==N.value))return P;let k={...P,...E};return i(m=>{let N={...m};for(let[I,O]of Object.entries(m)){let S=new Set(Object.values(k).filter(M=>M.poolId===I).map(M=>M.choiceId));N[I]={...O,available:new Set(O.choices.map(M=>M.id).filter(M=>!S.has(M)))}}return N}),k})};return t.on("answers:prefill",u),()=>t.off("answers:prefill",u)},[t]);let p=qe((u,y)=>{i(E=>{let P=E[u];if(!P){let I=new Set;for(let S of Object.values(a))S.poolId===u&&I.add(S.choiceId);let O=new Set(y.map(S=>S.id).filter(S=>!I.has(S)));return{...E,[u]:{choices:y,available:O}}}let z=new Set(P.choices.map(I=>I.id)),k=new Set(y.map(I=>I.id));if(!(y.some(I=>!z.has(I.id))||P.choices.some(I=>!k.has(I.id))))return E;let N=new Set;for(let I of P.available)k.has(I)&&N.add(I);for(let I of y)z.has(I.id)||N.add(I.id);return{...E,[u]:{choices:y,available:N}}})},[a]),x=qe((u,y)=>{d(E=>{let P=E[u]??[];return P.includes(y)?E:{...E,[u]:[...P,y]}}),!l.current.has(y)&&!a[y]&&(l.current.add(y),t.emit({type:"answer:changed",answer:{nodeId:y,type:"blank",timestamp:Date.now(),answer:{mode:"choice",choiceId:"",poolId:u,value:""}}}))},[a,t]),b=qe(u=>(c[u]??[]).find(E=>!a[E])??null,[c,a]),v=qe((u,y,E,P)=>{o(z=>{let k=z[u];return k&&i(m=>{let N=m[k.poolId];if(!N)return m;let I=new Set(N.available);return I.add(k.choiceId),{...m,[k.poolId]:{...N,available:I}}}),{...z,[u]:{choiceId:E,value:P,poolId:y}}}),i(z=>{let k=z[y];if(!k)return z;let m=new Set(k.available);return m.delete(E),{...z,[y]:{...k,available:m}}}),t.emit({type:"answer:changed",answer:{nodeId:u,type:"blank",timestamp:Date.now(),answer:{mode:"choice",choiceId:E,poolId:y,value:P}}})},[t]),h=qe(u=>{let y=a[u];if(!y)return;let{poolId:E,choiceId:P}=y;i(z=>{let k=z[E];if(!k)return z;let m=new Set(k.available);return m.add(P),{...z,[E]:{...k,available:m}}}),o(z=>{let{[u]:k,...m}=z;return m}),t.emit({type:"answer:changed",answer:{nodeId:u,type:"blank",timestamp:Date.now(),answer:{mode:"choice",choiceId:"",poolId:E,value:""}}})},[a,t]),g=qe((u,y)=>s[u]?.available.has(y)??!1,[s]),w=qe((u,y)=>s[u]?.choices.find(E=>E.id===y),[s]),f=qe(()=>{o({}),i(u=>{let y={};for(let[E,P]of Object.entries(u))y[E]={choices:P.choices,available:new Set(P.choices.map(z=>z.id))};return y});for(let[u,y]of Object.entries(c))for(let E of y)t.emit({type:"answer:changed",answer:{nodeId:E,type:"blank",timestamp:Date.now(),answer:{mode:"choice",choiceId:"",poolId:u,value:""}}})},[c,t]);Oo({onDragEnd(u){window.dispatchEvent(new CustomEvent("dnd-drop",{detail:{active:u.active,over:u.over}}))}});let C=zn(()=>({blanks:a,pools:s,registerPool:p,registerBlank:x,fill:v,back:h,isAvailable:g,getChoice:w,firstEmptyBlank:b,resetAllAnswers:f}),[a,s,p,x,v,h,g,w,b,f]);return To(Fn.Provider,{value:C,children:e})}import{Fragment as On,jsx as ie,jsxs as jo}from"react/jsx-runtime";import{useState as Nt,useEffect as Bn,useRef as jn,useLayoutEffect as Bo}from"react";import Wo from"clsx";var qo=typeof window<"u"?Bo:Bn;function Ct({node:e}){if(e.type==="text"){if(!e.marks||e.marks.length===0)return ie(On,{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(On,{children:r})}return e.type==="paragraph"?ie("span",{className:"block",children:e.content?.map((r,t)=>ie(Ct,{node:r},t))??ie("br",{})}):e.type==="hardBreak"?ie("br",{}):e.content?ie("span",{className:"block",children:e.content.map((r,t)=>ie(Ct,{node:r},t))}):null}function Uo({nodes:e}){return ie("span",{className:"block space-y-1",style:{color:"var(--ink, #1d2025)"},children:e.map((r,t)=>ie(Ct,{node:r},t))})}function Ho({hint:e}){let r=re(),[t,n]=Nt(!1),[a,o]=Nt(!1),[s,i]=Nt(null),c=jn(null),d=jn(null);return Bn(()=>{if(!a)return;let b=v=>{let h=v.target;c.current&&!c.current.contains(h)&&d.current&&!d.current.contains(h)&&(o(!1),n(!1))};return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[a]),qo(()=>{if(!t){i(null);return}let b=c.current,v=d.current;if(!b||!v)return;let h=b.getBoundingClientRect(),g=v.getBoundingClientRect(),w=8,f=h.top-g.height-w;f<w&&(f=h.bottom+w);let C=h.left+h.width/2-g.width/2;C=Math.max(w,Math.min(C,window.innerWidth-g.width-w)),i({top:f,left:C})},[t]),jo("span",{ref:c,className:"relative inline-flex items-center align-middle",onMouseEnter:()=>n(!0),onMouseLeave:()=>{a||n(!1)},children:[ie("button",{type:"button",onClick:b=>{b.stopPropagation(),a?(o(!1),n(!1)):(o(!0),n(!0))},className:Wo("player-blank-hint-btn select-none",a&&"player-blank-hint-btn--pinned"),"aria-label":r.showHint,children:"?"}),t&&ie("span",{ref:d,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(Uo,{nodes:e})})]})}function Me({hint:e}){return!e||e.length===0?null:ie(Ho,{hint:e})}function $r({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}=Pe(),x=re(),b=Ke(),v=i[t],h=!!v?.choiceId,g=r?.showFeedback??!1,w=r?.state,f=r?.correctChoiceIds??[],C=g&&w==="incorrect"&&f.length>0?l(a||"",f[0]):void 0,u=C?C.html.replace(/<\/?[^>]+(>|$)/g,""):void 0,{setNodeRef:y,isOver:E}=Vo({id:t,data:{type:"blank",blankId:t,poolId:a}}),{active:P}=Go(),z=!!P&&P.data.current?.poolId===a;return qn(()=>{p(a||"",t)},[a,t,p]),qn(()=>{let N=I=>{let O=I,{active:S,over:M}=O.detail||{};if(!M||M.id!==t)return;let{choiceId:q,poolId:$}=S?.data.current||{};if(!q||$!==a)return;let F=l(a||"",q);if(!F)return;let Q=F.html.replace(/<\/?[^>]+(>|$)/g,"");c(t,a||"",q,Q)};return window.addEventListener("dnd-drop",N),()=>window.removeEventListener("dnd-drop",N)},[t,a,l,c]),At(Wn,{children:[Kr("span",{ref:y,onClick:()=>{h&&!g&&d(t)},className:Jr("player-choice-blank",E&&"player-choice-blank--over",!E&&z&&!h&&!g&&"player-choice-blank--target",h&&!g&&!E&&"player-choice-blank--filled",g&&w==="correct"&&Jr("player-choice-blank--correct",b.hop),g&&w==="partial"&&Jr("player-choice-blank--partial",b.hop),g&&w==="incorrect"&&Jr("player-choice-blank--incorrect",b.wobble)),title:h&&!g?x.clickToRemove:void 0,"data-node-id":t,"data-pool-id":a,children:h?At(Wn,{children:[Kr("span",{children:v.value}),Kr("span",{className:"player-choice-blank__clear",children:"\xD7"})]}):o}),u&&At("span",{className:"player-blank-reveal",children:["(",u,")"]}),Kr(Me,{hint:s})]})}import{jsx as Et,jsxs as Ko}from"react/jsx-runtime";import{useEffect as Hn,useState as Jo}from"react";import Xo from"clsx";import{jsx as Un}from"react/jsx-runtime";import Qo from"clsx";import{useDraggable as Yo}from"@dnd-kit/core";function tr({poolId:e,data:r,isInline:t=!1}){let{isAvailable:n,firstEmptyBlank:a,fill:o}=Pe(),{id:s,html:i}=r,c=!n(e,s),{setNodeRef:d,attributes:l,listeners:p,transform:x,isDragging:b}=Yo({id:s,data:{type:"choice",choiceId:s,poolId:e,html:i},disabled:c});if(c)return null;let v=f=>f.replace(/<\/?[^>]+(>|$)/g,""),h=()=>{let f=a(e);if(f){let C=v(i);o(f,e,s,C)}},g=x?{transform:`translate3d(${x.x}px, ${x.y}px, 0)`}:void 0;return Un(t?"span":"div",{ref:d,style:g,className:Qo("player-bank-pill",b&&"player-bank-pill--dragging",t&&"mx-1"),...l,...p,onClick:h,children:Un("span",{dangerouslySetInnerHTML:{__html:i},className:"pointer-events-none whitespace-pre-wrap break-words"})})}function zr({node:e}){let r=re(),{id:t,attrs:n,content:a}=e,{shuffle:o=!0,equalWidth:s=!1}=n,{registerPool:i}=Pe(),[c,d]=Jo(()=>a.map(l=>({id:l.id,html:te(l.content)})));return Hn(()=>{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)]),Hn(()=>{i(t,c)},[t,c,i]),Ko("div",{className:"player-word-bank",children:[Et("div",{className:"player-word-bank__label",children:r.wordBank}),Et("div",{className:Xo("player-word-bank__items",s&&"player-word-bank__items--grid"),children:c.map(l=>Et(tr,{poolId:t,data:l},l.id))})]})}import{jsx as Pt,jsxs as Zo}from"react/jsx-runtime";import{useEffect as Vn,useState as es}from"react";function Dr({node:e}){let{id:r,attrs:t,content:n}=e,{shuffle:a=!0,separator:o=" "}=t,{registerPool:s}=Pe(),[i,c]=es(()=>n.map(d=>({id:d.id,html:te(d.content,{stripParagraphs:!0})})));return Vn(()=>{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)]),Vn(()=>{s(r,i)},[r,i,s]),Pt("span",{style:{display:"inline-flex",flexWrap:"wrap",gap:L("0.25rem"),alignItems:"center"},children:i.map((d,l)=>Zo("span",{children:[Pt(tr,{poolId:r,data:d,isInline:!0}),l<i.length-1&&Pt("span",{children:o})]},d.id))})}import{jsx as nr,jsxs as Tt}from"react/jsx-runtime";import{useState as $t,useEffect as zt,useMemo as as}from"react";import{Check as os,X as ss}from"lucide-react";import{jsx as ue,jsxs as Je}from"react/jsx-runtime";import{useState as Mt,useMemo as Lt,useRef as It,useCallback as rs,useLayoutEffect as ts}from"react";var Gn="#1d2025",Qn="#8d93a0",Yn="#1f8a4c",Kn="#d23b2b",ns=11;function Jn({leftItems:e,rightItems:r,connections:t,direction:n,disabled:a,feedback:o,onConnectionsChange:s}){let[i,c]=Mt(null),[d,l]=Mt(null),[p,x]=Mt(new Map),b=It(null),v=It(new Map),h=It("mouse"),g=o?.showFeedback??!1,w=Lt(()=>{let R=new Map;if(o?.pairFeedback)for(let _ of o.pairFeedback)R.set(`${_.leftId}-${_.rightId}`,_.correct);return R},[o]),f=Lt(()=>{let R=new Map;return o?.correctPairings?.forEach(_=>R.set(_.leftId,_.rightId)),R},[o]),C=Lt(()=>{let R=new Map;return o?.correctPairings?.forEach(_=>R.set(_.rightId,_.leftId)),R},[o]),u=new Map,y=new Map;t.forEach((R,_)=>{u.set(R.leftId,_),y.set(R.rightId,_)});let E=R=>{let _=t[R];if(!g||!_)return null;let D=w.get(`${_.leftId}-${_.rightId}`);return D===!0?"correct":D===!1?"incorrect":null},P=rs(()=>{if(!b.current)return;let R=b.current.getBoundingClientRect(),_=new Map;v.current.forEach((D,H)=>{if(D){let V=D.getBoundingClientRect();_.set(H,new DOMRect(V.left-R.left,V.top-R.top,V.width,V.height))}}),x(_)},[]);ts(()=>{P();let R=new ResizeObserver(P);return b.current&&R.observe(b.current),()=>R.disconnect()},[P,t,e,r]);let z=8,k=(R,_)=>{let D=p.get(R);if(!D)return null;let H=D.y+D.height/2;return _==="left"?{x:D.x+D.width,y:H}:{x:D.x-z,y:H}},m=(R,_)=>{if(a)return;let H=(_==="left"?u:y).has(R),V=i?.id===R&&i?.side===_,le=i!==null&&i.side!==_;if(V){c(null);return}if(le){let Z=_==="right"?i.id:R,oe=_==="left"?i.id:R,se=t.filter(ne=>ne.leftId!==Z&&ne.rightId!==oe);se.push({leftId:Z,rightId:oe}),s(se),c(null);return}if(H&&!i){let Z=_==="left"?t.filter(oe=>oe.leftId!==R):t.filter(oe=>oe.rightId!==R);s(Z);return}c({id:R,side:_})},N=(R,_,D)=>{if(a||(h.current=D.pointerType,D.pointerType==="touch"))return;D.currentTarget.setPointerCapture(D.pointerId);let H=b.current.getBoundingClientRect();l({fromId:R,fromSide:_,x:D.clientX-H.left,y:D.clientY-H.top,overId:null,overSide:null})},I=R=>{if(!d)return;let _=b.current.getBoundingClientRect(),D=R.clientX-_.left,H=R.clientY-_.top,V=d.fromSide==="left"?"right":"left",le=V==="left"?e:r,Z=null,oe=null;for(let se of le){let ne=p.get(se.id);if(ne&&D>=ne.x&&D<=ne.x+ne.width&&H>=ne.y&&H<=ne.y+ne.height){Z=se.id,oe=V;break}}l(se=>se?{...se,x:D,y:H,overId:Z,overSide:oe}:null)},O=R=>{if(!d)return;let _=b.current.getBoundingClientRect(),D=R.clientX-_.left,H=R.clientY-_.top,V=k(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,oe=d.fromSide==="right"?d.fromId:d.overId,se=t.filter(ne=>ne.leftId!==Z&&ne.rightId!==oe);se.push({leftId:Z,rightId:oe}),s(se)}l(null),c(null)},S=(R,_)=>{if(!g)return null;let H=(_==="left"?u:y).get(R.id);if(H!==void 0){let V=t[H];if(w.get(`${V.leftId}-${V.rightId}`)===!0)return null}if(_==="left"){let V=f.get(R.id);return r.find(le=>le.id===V)?.content??null}else{let V=C.get(R.id);return e.find(le=>le.id===V)?.content??null}},M=(R,_)=>{let H=(_==="left"?u:y).get(R.id),V=H!==void 0,le=i?.id===R.id&&i?.side===_,Z=i!==null&&i.side!==_&&!V,oe=d?.overId===R.id&&d?.overSide===_,se=V?E(H):null,ne=V?H+1:null,U="matching-player__item";V&&(U+=" matching-player__item--matched"),se==="correct"&&(U+=" matching-player__item--correct"),se==="incorrect"&&(U+=" matching-player__item--incorrect"),le&&(U+=" matching-player__item--selected"),(Z||oe)&&(U+=" matching-player__item--available"),a&&(U+=" matching-player__item--disabled");let mr=S(R,_);return Je("button",{ref:Ve=>{Ve?v.current.set(R.id,Ve):v.current.delete(R.id)},type:"button",className:U,onPointerDown:Ve=>N(R.id,_,Ve),onClick:()=>{h.current==="touch"&&m(R.id,_)},"aria-pressed":le,children:[_==="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&&_==="left"&&ue("span",{className:"matching-player__pair-num","aria-hidden":!0,children:ne}),ue("span",{className:"matching-player__item-text",dangerouslySetInnerHTML:{__html:te(R.content)}}),mr&&Je("span",{className:"matching-player__correct-hint",children:["(",ue("span",{dangerouslySetInnerHTML:{__html:te(mr)}}),")"]}),V&&_==="right"&&ue("span",{className:"matching-player__pair-num","aria-hidden":!0,children:ne}),_==="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"})]})})]},R.id)},q=n==="ltr"?e:r,$=n==="ltr"?r:e,F=n==="ltr"?"left":"right",Q=n==="ltr"?"right":"left";return Je("div",{ref:b,className:`matching-player__arena${d?" matching-player__arena--dragging":""}`,onPointerMove:I,onPointerUp:O,children:[Je("svg",{className:"matching-player__svg","aria-hidden":!0,children:[ue("defs",{children:[["mp-arrow-ink",Gn],["mp-arrow-correct",Yn],["mp-arrow-incorrect",Kn],["mp-arrow-ghost",Qn]].map(([R,_])=>ue("marker",{id:R,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:_})},R))}),t.map(R=>{let _=k(R.leftId,"left"),D=k(R.rightId,"right");if(!_||!D)return null;let H=D.x-ns,V=Math.max(16,Math.abs(H-_.x)*.4),le=`M ${_.x} ${_.y} C ${_.x+V} ${_.y}, ${H-V} ${D.y}, ${H} ${D.y}`,Z=g?w.get(`${R.leftId}-${R.rightId}`):void 0;return ue("path",{d:le,stroke:Z===!0?Yn:Z===!1?Kn:Gn,strokeWidth:"2.5",fill:"none",markerEnd:`url(#${Z===!0?"mp-arrow-correct":Z===!1?"mp-arrow-incorrect":"mp-arrow-ink"})`},`${R.leftId}-${R.rightId}`)}),d&&(()=>{let R=k(d.fromId,d.fromSide);if(!R)return null;let _=Math.abs(d.x-R.x)*.35,D=`M ${R.x} ${R.y} C ${R.x+_} ${R.y}, ${d.x-_} ${d.y}, ${d.x} ${d.y}`;return ue("path",{d:D,stroke:Qn,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:q.map(R=>M(R,F))}),ue("div",{className:"matching-player__column",children:$.map(R=>M(R,Q))})]})]})}var Xn=e=>Number.isInteger(e)?String(e):e.toFixed(2);function Zn(e){return[...e].map(r=>({v:r,r:Math.random()})).sort((r,t)=>r.r-t.r).map(r=>r.v)}function Fr({node:e,validationFeedback:r}){let t=de(),{shuffleSeed:n,layoutBy:a}=Ce(),{id:o,attrs:s,leftItems:i,rightItems:c}=e,{direction:d,shuffle:l,hint:p}=s,x=JSON.stringify(i),b=JSON.stringify(c),v=l&&n!==void 0,h=as(()=>v?{left:gr(i,`${n}:${o}:left`),right:gr(c,`${n}:${o}:right`)}:null,[v,n,o,x,b]),[g,w]=$t(i),[f,C]=$t(c);zt(()=>{v||(l?(w(Zn(i)),C(Zn(c))):(w(i),C(c)))},[l,v,x,b]);let u=h?.left??g,y=h?.right??f,[E,P]=$t([]),z=r?.showFeedback??!1;zt(()=>{let S=M=>{let $=M.answers.find(F=>F.nodeId===o&&F.type==="matchingSet");$&&"connections"in $.answer&&P($.answer.connections)};return t.on("answers:prefill",S),()=>t.off("answers:prefill",S)},[t,o]),zt(()=>{t.emit({type:"answer:changed",answer:{nodeId:o,type:"matchingSet",timestamp:Date.now(),answer:{connections:E}}})},[t,o,E]);let k=S=>{z||P(S)},m=r?.score,N=r?.maxScore,I=z&&m!=null&&N!=null,O=I?m>=N?"correct":m>0?"partial":"incorrect":null;return Tt("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(Jn,{leftItems:u,rightItems:y,connections:E,direction:d,disabled:z,feedback:r,onConnectionsChange:k}),I&&Tt("div",{className:"matching-player-feedback matching-player-feedback--"+O,children:[O==="correct"&&nr(os,{size:15,style:ee(15)}),O==="incorrect"&&nr(ss,{size:15,style:ee(15)}),nr("span",{children:O==="correct"?"All matched":O==="partial"?"Partial credit":"Not matched"}),Tt("span",{className:"matching-player-score",children:[Xn(m)," / ",Xn(N)]})]})]})}import{jsxs as ar,jsx as Le,Fragment as is}from"react/jsx-runtime";import{useState as ea,useEffect as Dt,useRef as cs,useCallback as ra}from"react";import Xr from"clsx";function Or({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]=ea(""),[x,b]=ea(0),v=r?.showFeedback??!1,h=r?.state,g=c<=30,w=ra(m=>m.trim().split(/\s+/).filter(Boolean).length,[]);Dt(()=>{let m=N=>{let O=N.answers?.find(S=>S.nodeId===a&&S.type==="aiAnswer");if(O&&O.answer?.text!=null){let S=O.answer.text;p(S),b(w(S))}};return t.on("answers:prefill",m),()=>t.off("answers:prefill",m)},[a,t,w]),Dt(()=>{let m=()=>{p(""),b(0)};return t.on("answers:reset",m),()=>t.off("answers:reset",m)},[t]);let f=cs(null),C=ra((m,N)=>{f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{t.emit({type:"answer:changed",answer:{nodeId:a,type:"aiAnswer",timestamp:Date.now(),answer:{text:m,wordCount:N}}})},300)},[a,t]);Dt(()=>{t.emit({type:"answer:changed",answer:{nodeId:a,type:"aiAnswer",timestamp:Date.now(),answer:{text:"",wordCount:0}}})},[]);let u=m=>{if(v)return;let N=w(m);p(m),b(N),C(m,N)},y=h==="validating",E=Xr("player-ai-count",x>c&&"player-ai-count--over"),P=!v||y?"":h==="correct"?"player-ai-input--correct":h==="incorrect"?"player-ai-input--incorrect":h==="partial"?"player-ai-input--partial":"",z=h==="correct"?"player-ai-feedback--correct":h==="incorrect"?"player-ai-feedback--incorrect":h==="partial"?"player-ai-feedback--partial":"",k=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:E,children:[x," / ",c]}),i>0&&x<i&&Le("span",{className:"player-ai-count player-ai-count--min",children:n.minWordsLabel(i)}),Le("span",{style:{marginInlineStart:"auto"},children:Le(Me,{hint:d})})]}),g?Le("input",{type:"text",value:l,onChange:m=>u(m.target.value),placeholder:s??n.shortAnswerPlaceholder,disabled:v,className:Xr("player-ai-input",P)}):Le("textarea",{value:l,onChange:m=>u(m.target.value),placeholder:s??n.longAnswerPlaceholder,disabled:v,rows:5,className:Xr("player-ai-input player-ai-input--multiline",P)}),v&&r&&Le("div",{className:Xr("player-ai-feedback",z),children:y?ar("div",{className:"player-ai-validating",children:[Le("span",{className:"player-ai-spinner"}),Le("span",{children:n.aiEvaluationInProgress})]}):ar(is,{children:[r.message&&Le("p",{className:"player-ai-message",children:r.message}),r.score!=null&&r.maxScore!=null&&Le("div",{className:"player-ai-score-row",children:ar("span",{className:"player-ai-score",children:[k(r.score)," / ",k(r.maxScore)]})})]})})]})}import{Fragment as ta,jsx as A,jsxs as K}from"react/jsx-runtime";import{useState as he,useEffect as _e,useRef as Se,useCallback as Zr}from"react";import{useEditor as ls,EditorContent as ds}from"@tiptap/react";import ps from"@tiptap/starter-kit";import Ie from"clsx";import{FolderOpen as ms,Mic as us,Video as oa,Monitor as fs,Clock as hs,Image as gs,FileText as sa,Music as bs,Link2 as ys}from"lucide-react";function ia(e){return e.trim().split(/\s+/).filter(Boolean).length}function ca(e){return e.length}function xs(e){let r=t=>t.map(n=>(n.text??"")+(n.content?r(n.content):"")).join(" ");return ia(r(e))}function vs(e){let r=t=>t.map(n=>(n.text??"")+(n.content?r(n.content):"")).join("");return ca(r(e))}function Ft({node:e}){if(e.type==="text"){if(!e.marks||e.marks.length===0)return A(ta,{children:e.text});let r=e.text||"";for(let t of e.marks)t.type==="bold"?r=A("strong",{children:r}):t.type==="italic"?r=A("em",{children:r}):t.type==="underline"?r=A("u",{children:r}):t.type==="strike"?r=A("s",{children:r}):t.type==="textStyle"&&t.attrs?.color&&(r=A("span",{style:{color:t.attrs.color},children:r}));return A(ta,{children:r})}return e.type==="paragraph"?A("span",{className:"block",children:e.content?.map((r,t)=>A(Ft,{node:r},t))??A("br",{})}):e.type==="hardBreak"?A("br",{}):e.content?A("span",{className:"block",children:e.content.map((r,t)=>A(Ft,{node:r},t))}):null}function ws({nodes:e}){return A("span",{className:"block space-y-1 text-amber-900",children:e.map((r,t)=>A(Ft,{node:r},t))})}function ks({hint:e}){let r=re(),[t,n]=he(!1),[a,o]=he(!1),s=Se(null);return _e(()=>{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:[A("button",{type:"button",onClick:i=>{i.stopPropagation(),a?(o(!1),n(!1)):(o(!0),n(!0))},className:Ie("player-blank-hint-btn select-none",a&&"player-blank-hint-btn--pinned"),"aria-label":r.showHint,children:"?"}),t&&A("span",{className:"player-blank-hint-pop",onClick:i=>i.stopPropagation(),children:A(ws,{nodes:e})})]})}function na(e){if(!isFinite(e.duration)){e.currentTime=1e101;let r=()=>{e.currentTime=0,e.removeEventListener("timeupdate",r)};e.addEventListener("timeupdate",r)}}function Rs(e){return/youtube\.com|youtu\.be/i.test(e)?"youtube":/vimeo\.com/i.test(e)?"vimeo":"other"}function Ss(e){let r=e.match(/[?&]v=([^&]+)/)||e.match(/youtu\.be\/([^?]+)/)||e.match(/embed\/([^?]+)/);return r?r[1]:null}function aa(e){let r=Math.floor(e/60),t=e%60;return`${r}:${t.toString().padStart(2,"0")}`}function jr({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:b,allowMultiple:v,fileInstructions:h,maxDuration:g,hint:w}=i,f=t||(r?.showFeedback??!1),C=r?.state,u=Se(null),y=Zr(m=>{u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{let N=m.files?.map(I=>({url:I.url,mimeType:I.kind==="videoLink"?"video/x-link":I.mimeType,name:I.kind==="videoLink"?void 0:I.name,duration:I.kind==="videoLink"?void 0:I.duration}));a.emit({type:"answer:changed",answer:{nodeId:s,type:"openResponse",timestamp:Date.now(),answer:{...m,files:N}}})},300)},[s,a]);_e(()=>{y({})},[]);let[E,P]=he([]);_e(()=>{(c==="file"||c==="text+file")&&c==="file"&&y({files:E})},[E,c]),_e(()=>{let m=()=>{P([])};return a.on("answers:reset",m),()=>a.off("answers:reset",m)},[a]),_e(()=>{let m=N=>{let O=(N.answers??[]).find(S=>S.nodeId===s&&S.type==="openResponse");O?.answer?.files&&P(O.answer.files)};return a.on("answers:prefill",m),()=>a.off("answers:prefill",m)},[s,a]);let z=r?.showFeedback,k=Ie(!z&&"player-or-field--pre",z&&C==="correct"&&"player-or-field--correct",z&&C==="partial"&&"player-or-field--partial",z&&C==="incorrect"&&"player-or-field--incorrect",z&&C==="awaiting_review"&&"player-or-field--review");return K("div",{className:"my-3 space-y-2",children:[!f&&w&&w.length>0&&A("div",{className:"flex justify-end",children:A(ks,{hint:w})}),c==="text"&&A(la,{nodeId:s,placeholder:d,allowFormatting:l,wordLimit:p,characterLimit:x,isDisabled:f,feedbackBorderClass:k,emitAnswer:m=>y({text:m}),answerBus:a}),c==="file"&&A(Ot,{allowedTypes:b??["image"],allowMultiple:!!v,fileInstructions:h,isDisabled:f,feedbackBorderClass:k,files:E,setFiles:P,mediaHandler:n,t:o}),(c==="audio"||c==="video"||c==="screen")&&A(Es,{kind:c,maxDuration:g,isDisabled:f,feedbackBorderClass:k,mediaHandler:n,emitAnswer:m=>y({recording:m}),t:o}),c==="text+file"&&A(As,{nodeId:s,placeholder:d,allowFormatting:l,wordLimit:p,characterLimit:x,allowedTypes:b??["image"],allowMultiple:!!v,fileInstructions:h,isDisabled:f,feedbackBorderClass:k,files:E,setFiles:P,emitAnswer:y,answerBus:a,mediaHandler:n,t:o}),r?.showFeedback&&C==="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:[A(hs,{size:15,style:ee(15),className:"animate-pulse"}),A("span",{children:o.openResponseAwaitingReview})]}),r?.showFeedback&&C!=="awaiting_review"&&r.teacherFeedback&&A(Ps,{feedback:r.teacherFeedback,feedbackState:C,score:r.score,t:o})]})}function la({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,b]=he(0),[v,h]=he(0),g=Se(null),w=Zr(()=>{let M=g.current;M&&(M.style.height="auto",M.style.height=`${M.scrollHeight}px`)},[]),f=ls({extensions:[ps.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1})],immediatelyRender:!1,editable:!o,content:"",onUpdate({editor:M}){if(o)return;let $=M.getJSON().content??[],F=xs($),Q=vs($);b(F),h(Q),i({content:$,wordCount:F})}});_e(()=>{f&&f.setEditable(!o)},[o,f]);let C=Se(null);_e(()=>{f&&C.current!==null&&(f.commands.setContent({type:"doc",content:C.current}),C.current=null)},[f]),_e(()=>{let M=q=>{let $=(q.answers??[]).find(Q=>Q.nodeId===e&&Q.type==="openResponse");if(!$?.answer?.text)return;let F=$.answer.text.content??[];if(t)f?f.commands.setContent({type:"doc",content:F}):C.current=F;else{let Q=F.flatMap(W=>W.content?.map(R=>R.text??"")??[W.text??""]).join(`
2
+ `);p(Q),setTimeout(w,0)}};return c.on("answers:prefill",M),()=>c.off("answers:prefill",M)},[e,c,t,f]),_e(()=>{let M=()=>{t&&f?f.commands.clearContent():(p(""),setTimeout(w,0)),b(0),h(0)};return c.on("answers:reset",M),()=>c.off("answers:reset",M)},[c,t,f,w]);let u=!!n,y=!!a&&!n,E=u?x:v,P=u?n?.max:a?.max,z=u?n?.min:a?.min,k=P!=null&&E>P,m=P!=null&&E>=P*.8&&!k,N=z!=null&&E<z&&E>0,I="text-xs tabular-nums",O=k?{color:"var(--pen, #d23b2b)",fontWeight:500}:m||N?{color:"var(--almost, #c8810e)"}:{color:"var(--ink-faint, #8d93a0)"},S=u?P?`${x} / ${P} ${d.openResponseWords}`:z?`${x} ${d.openResponseWords} (min. ${z})`:`${x} ${d.openResponseWords}`:y?P?`${v} / ${P} ${d.openResponseChars}`:`${v} ${d.openResponseChars}`:null;return t?K("div",{className:"relative",children:[K("div",{className:Ie("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:M,cmd:q,style:$})=>A("button",{type:"button",onMouseDown:F=>{F.preventDefault(),f?.chain().focus()?.[q]().run()},className:`text-xs px-1.5 py-0.5 rounded hover:bg-gray-100 ${$}`,children:M},M)),A("button",{type:"button",onMouseDown:M=>{M.preventDefault(),f?.chain().focus().toggleBulletList().run()},className:"text-xs px-1.5 py-0.5 rounded hover:bg-gray-100",children:"\u2022\u2014"})]}),A(ds,{editor:f,className:"prose prose-sm max-w-none p-3 outline-none [&_.ProseMirror]:min-h-[80px] [&_.ProseMirror]:outline-none"})]}),S&&A("div",{className:Ie("absolute bottom-2 right-3",I),style:O,children:S})]}):K("div",{className:"relative",children:[A("textarea",{ref:g,value:l,onChange:M=>{if(o)return;let q=M.target.value;p(q);let $=ia(q),F=ca(q);b($),h(F),w(),i({content:[{type:"paragraph",content:[{type:"text",text:q}]}],wordCount:$})},onInput:w,disabled:o,placeholder:r||d.openResponseTextPlaceholder,rows:4,style:{resize:"none",overflow:"hidden"},className:Ie("w-full px-3 py-2 text-base min-h-[100px] rounded border transition-colors outline-none",s,o&&"cursor-default")}),S&&A("div",{className:Ie("absolute bottom-2 right-3",I),children:S})]})}var _s={image:"image/*",pdf:"application/pdf",audio:"audio/*",video:"video/*"},Ns={image:A(gs,{size:12,style:ee(12)}),pdf:A(sa,{size:12,style:ee(12)}),audio:A(bs,{size:12,style:ee(12)}),video:A(oa,{size:12,style:ee(12)}),videoLink:A(ys,{size:12,style:ee(12)})};function Ot({allowedTypes:e,allowMultiple:r,fileInstructions:t,isDisabled:n,files:a,setFiles:o,mediaHandler:s,t:i,compact:c=!1}){let d=Se(null),[l,p]=he(!1),[x,b]=he(!1),[v,h]=he(""),g=e.some(m=>m!=="videoLink"),w=e.includes("videoLink"),f=r||a.length===0,C=e.filter(m=>m!=="videoLink").map(m=>_s[m]).filter(Boolean).join(","),u=Zr(m=>{o(N=>r?[...N,m]:[m])},[r,o]),y=Zr(m=>{o(N=>N.filter((I,O)=>O!==m))},[o]),E=async m=>{if(!(!f||n)){p(!0);try{let N=m.type.startsWith("image/")?"image":m.type==="application/pdf"?"document":m.type.startsWith("audio/")?"audio":m.type.startsWith("video/")?"video":"file";if(s){let I=await s.upload(m,N);u({kind:"file",url:I.url,mimeType:I.mimeType??m.type,name:m.name})}else{let I=URL.createObjectURL(m);u({kind:"file",url:I,mimeType:m.type,name:m.name})}}finally{p(!1)}}},P=async m=>{if(m.preventDefault(),b(!1),n||!f)return;let N=m.dataTransfer.files?.[0];N&&await E(N)},z=()=>{let m=v.trim();m&&(u({kind:"videoLink",url:m,platform:Rs(m)}),h(""))},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&&A("p",{className:"text-sm text-gray-600 italic",children:t}),a.length>0&&A("div",{className:c?"flex flex-wrap gap-1.5":"space-y-2",children:a.map((m,N)=>A(Cs,{file:m,onRemove:n?void 0:()=>y(N),compact:c,t:i},N))}),!n&&f&&K("div",{className:"space-y-2",children:[g&&!c&&K("div",{onDragOver:m=>{m.preventDefault(),b(!0)},onDragLeave:()=>b(!1),onDrop:P,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:[A(ms,{size:26,className:"mx-auto mb-2",style:{...ee(26),color:"var(--ink-soft, #565b66)"}}),A("p",{className:"text-sm font-medium",style:{color:"var(--ink-soft, #565b66)"},children:i.openResponseDropZoneLabel}),A("p",{className:"text-xs hover:underline mt-0.5",style:{color:"var(--ink, #1d2025)"},children:i.openResponseDropZoneBrowse}),l&&A("p",{className:"text-xs mt-1 animate-pulse",style:{color:"var(--ink-faint, #8d93a0)"},children:i.openResponseUploading}),A("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:[Ns[m]," ",k[m]]},m))})]}),g&&c&&A("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}`}),A("input",{ref:d,type:"file",accept:C,onChange:async m=>{let N=m.target.files?.[0];N&&(await E(N),m.target.value="")},className:"hidden"}),w&&K("div",{className:"flex gap-2 flex-wrap",children:[A("input",{type:"url",value:v,onChange:m=>h(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(),z())}}),A("button",{type:"button",onClick:z,disabled:!v.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&&A("p",{className:"text-sm text-gray-400 text-center py-3",children:i.openResponseNoSubmission})]})}function Cs({file:e,onRemove:r,compact:t,t:n}){if(e.kind==="videoLink"){let a=e.platform==="youtube"?Ss(e.url):null;return K("div",{className:Ie("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&&A("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"}),A("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&&A("button",{type:"button",onClick:r,className:"ml-auto text-gray-400 hover:text-rose-500 text-xs",children:"\u2715"})]})}return K("div",{className:Ie("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/")?A("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/")?A("audio",{src:e.url,controls:!0,className:t?"hidden":"h-8 max-w-[240px]"}):e.mimeType?.startsWith("video/")?A("video",{src:e.url,controls:!0,className:t?"hidden":"h-16 max-w-[240px] rounded"}):A(sa,{size:20,style:{...ee(20),color:"var(--ink-soft, #565b66)"}}),K("div",{className:"flex-1 min-w-0",children:[A("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/")&&A("audio",{src:e.url,controls:!0,className:"h-6 max-w-[160px] mt-0.5"})]}),r&&A("button",{type:"button",onClick:r,className:"ml-auto text-gray-400 hover:text-rose-500 text-xs shrink-0",children:"\u2715"})]})}function As({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:b,mediaHandler:v,t:h}){let[g,w]=he(null),[f,C]=he(!1);return _e(()=>{x({...g&&{text:g},files:l.length>0?l:void 0})},[g,l]),K("div",{className:"space-y-2",children:[A(la,{nodeId:e,placeholder:r,allowFormatting:t,wordLimit:n,characterLimit:a,isDisabled:c,feedbackBorderClass:d,emitAnswer:u=>w(u),answerBus:b}),!c&&K("div",{children:[K("button",{type:"button",onClick:()=>C(!f),className:"flex items-center gap-1.5 text-xs",style:{color:"var(--ink-soft, #565b66)"},children:[A("span",{children:f?"\u25BE":"\u25B8"}),K("span",{children:[h.openResponseAttachFiles,l.length>0&&A("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})]})]}),f&&A("div",{className:"mt-1.5",children:A(Ot,{allowedTypes:o,allowMultiple:s,fileInstructions:i,isDisabled:c,feedbackBorderClass:d,files:l,setFiles:p,mediaHandler:v,t:h,compact:!0})})]}),c&&l.length>0&&K("div",{className:"space-y-1",children:[A("p",{className:"text-xs text-gray-500 font-medium",children:h.openResponseAttachedFiles}),A(Ot,{allowedTypes:o,allowMultiple:s,isDisabled:!0,feedbackBorderClass:d,files:l,setFiles:p,t:h,compact:!0})]})]})}function Es({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),[b,v]=he("audio/webm"),[h,g]=he(null),w=Se(null),f=Se(null),C=Se([]),u=Se(null),y=Se(null),E=Se(null),P=Se(0);_e(()=>()=>{z(),u.current&&clearInterval(u.current),cancelAnimationFrame(P.current)},[]),_e(()=>{i==="recording"&&e==="audio"&&f.current&&O(f.current)},[i]);let z=()=>{f.current?.getTracks().forEach(S=>S.stop()),f.current=null},k=async()=>{if(!a){g(s.openResponseMediaHandlerRequired);return}g(null),c("requesting");try{let S;if(e==="screen"){let $=await navigator.mediaDevices.getDisplayMedia({video:{cursor:"always"},audio:!1});try{let Q=(await navigator.mediaDevices.getUserMedia({audio:!0})).getAudioTracks()[0];Q&&$.addTrack(Q)}catch{}$.getVideoTracks()[0]?.addEventListener("ended",()=>{w.current?.state==="recording"&&m()}),S=$,y.current&&(y.current.srcObject=S,y.current.play())}else e==="video"?(S=await navigator.mediaDevices.getUserMedia({audio:!0,video:{facingMode:"environment"}}),y.current&&(y.current.srcObject=S,y.current.play())):S=await navigator.mediaDevices.getUserMedia({audio:!0});f.current=S;let M=e==="audio"?"audio/webm":"video/webm";v(M);let q=new MediaRecorder(S,{mimeType:M});w.current=q,C.current=[],q.ondataavailable=$=>{$.data.size>0&&C.current.push($.data)},q.onstop=()=>{let $=new Blob(C.current,{type:M}),F=URL.createObjectURL($);x(F),c("reviewing"),z(),cancelAnimationFrame(P.current)},q.start(200),c("recording"),l(0),u.current=setInterval(()=>{l($=>{let F=$+1;return r&&F>=r&&m(),F})},1e3)}catch{c("idle"),g(s.openResponsePermissionDenied)}},m=()=>{u.current&&(clearInterval(u.current),u.current=null),w.current?.stop()},N=async()=>{if(!p||!a)return;c("submitted");let M=await(await fetch(p)).blob(),q=e==="screen"?"video":e,$=new File([M],"recording.webm",{type:b}),F=await a.upload($,q);URL.revokeObjectURL(p),o({url:F.url,mimeType:F.mimeType??b,duration:d,kind:q})},I=()=>{p&&URL.revokeObjectURL(p),x(null),l(0),c("idle")},O=S=>{let M=new AudioContext,q=M.createMediaStreamSource(S),$=M.createAnalyser();$.fftSize=64,q.connect($);let F=new Uint8Array($.frequencyBinCount),Q=E.current;if(!Q)return;let W=()=>{$.getByteFrequencyData(F);let R=Q.getContext("2d");if(!R)return;R.clearRect(0,0,Q.width,Q.height);let _=Q.width/F.length*2.5,D=0;for(let H=0;H<F.length;H++){let V=F[H]/255*Q.height;R.fillStyle="#1d2025",R.fillRect(D,Q.height-V,_,V),D+=_+1}P.current=requestAnimationFrame(W)};W()};return t?A("div",{className:Ie("rounded border p-4 text-center text-sm text-gray-400",n),children:s.openResponseRecordingSubmitted}):K("div",{className:Ie("rounded border p-4 space-y-3",n),children:[h&&A("p",{className:"text-sm",style:{color:"var(--pen, #d23b2b)"},children:h}),(e==="video"||e==="screen")&&i==="recording"&&A("video",{ref:y,muted:!0,className:"w-full rounded max-h-48 bg-black",playsInline:!0}),e==="audio"&&i==="recording"&&A("canvas",{ref:E,width:300,height:48,className:"w-full rounded bg-gray-900"}),i==="reviewing"&&p&&(e==="audio"?A("audio",{src:p,controls:!0,className:"w-full",onLoadedMetadata:S=>na(S.currentTarget)}):A("video",{src:p,controls:!0,className:"w-full rounded max-h-48",onLoadedMetadata:S=>na(S.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"?A(us,{size:22,style:ee(22)}):e==="screen"?A(fs,{size:22,style:ee(22)}):A(oa,{size:22,style:ee(22)}),A("span",{className:"text-sm",children:e==="screen"?s.openResponseTapToRecordScreen:s.openResponseTapToRecord})]}),i==="requesting"&&A("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:[A("span",{className:"animate-pulse",children:"\u25CF"}),A("span",{children:aa(d)}),r&&K("span",{className:"text-sm",style:{color:"var(--ink-faint, #8d93a0)"},children:["/ ",aa(r)]})]}),A("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:[A("button",{type:"button",onClick:I,className:"px-4 py-1.5 rounded border text-sm",style:{borderColor:"var(--line-strong, #d6d3cc)",color:"var(--ink, #1d2025)"},children:s.openResponseReRecord}),A("button",{type:"button",onClick:N,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 Ps({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:[A("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:L("1.4rem"),lineHeight:1,color:a.ink},children:[t," pts"]})]})}import{jsx as Ue,jsxs as or,Fragment as da}from"react/jsx-runtime";import{useEffect as jt,useRef as Ms,useState as pa}from"react";function Ls(e){return e?.showFeedback?e.state==="validating"?"validating":e.state==="correct"?"correct":e.state==="incorrect"?"incorrect":"idle":"idle"}function Br({nodeId:e,placeholder:r,hint:t,validationFeedback:n,readOnly:a=!1}){let o=de(),s=Ms(null),[i,c]=pa(""),[d,l]=pa(!1),p=Ls(n),x=n?.score,b=n?.maxScore,v=w=>Number.isInteger(w)?String(w):w.toFixed(2);jt(()=>{import("mathlive").then(()=>{l(!0)}).catch(()=>{})},[]),jt(()=>{let w=f=>{let C=f.answers?.find(u=>u.nodeId===e&&u.type==="mathResponse");C?.answer?.latex!==void 0&&(c(C.answer.latex),s.current&&(s.current.value=C.answer.latex))};return o.on("answers:prefill",w),()=>o.off("answers:prefill",w)},[o,e]),jt(()=>{o.emit({type:"answer:changed",answer:{nodeId:e,type:"mathResponse",timestamp:Date.now(),answer:{latex:i}}})},[i,e,o]);let h=w=>{let f=w.target?.value??"";c(f)},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:L("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:h,"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:w=>c(w.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(da,{children:[Ue("span",{className:"player-math-spinner"}),Ue("span",{children:"Checking your answer\u2026"})]}),p==="correct"&&or(da,{children:[Ue("span",{children:"\u2713 Correct"}),x!=null&&or("span",{className:"player-math-score",children:[v(x),b!=null?` / ${v(b)}`:""]})]}),p==="incorrect"&&Ue("span",{children:"\u2717 Incorrect"})]})]})}import{jsx as X,jsxs as pe,Fragment as xr}from"react/jsx-runtime";import{useCallback as Ys,useEffect as Ks,useRef as Js,useState as yr}from"react";import{Play as Xs,Lock as Zs,Check as Wt,X as fa}from"lucide-react";function tt(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)=>tt(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=>tt(a[c],o[c]))}var Is=`
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 rs(e,r,t,n,a,o,s,i,c){return new Promise(l=>{let d=new Blob([es],{type:"text/javascript"}),m=URL.createObjectURL(d),v=new Worker(m),h=setTimeout(()=>{v.terminate(),URL.revokeObjectURL(m),l({testId:n,passed:!1,stderr:`Execution timed out after ${c}ms`,errored:!0})},c);v.onmessage=x=>{clearTimeout(h),v.terminate(),URL.revokeObjectURL(m);let u=x.data;if(r==="function"&&!u.errored){let b=Kr(u.actual,o);l({testId:n,passed:b,actual:u.actual,stderr:u.stderr,durationMs:u.durationMs})}else l({testId:n,passed:u.passed??!1,actualStdout:u.actualStdout,stderr:u.stderr,durationMs:u.durationMs,errored:u.errored})},v.onerror=x=>{clearTimeout(h),v.terminate(),URL.revokeObjectURL(m),l({testId:n,passed:!1,stderr:x.message,errored:!0})},v.postMessage({testId:n,source:e,mode:r,entryFunction:t,args:a,expectedStdout:i,timeout:c})})}var ts="0.27.7";function ns(){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||ts}/full/`}var fr=null;function as(e){return typeof globalThis.loadPyodide=="function"?Promise.resolve():fr||(fr=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=()=>{fr=null,t(new Error(`Failed to load Pyodide from ${n.src}`))},document.head.appendChild(n)}),fr)}var Qr=null;async function os(){if(Qr)return Qr;let e=ns();await as(e);let r=globalThis.loadPyodide;if(typeof r!="function")throw new Error("Pyodide global not available after loading the CDN script");return Qr=await r({indexURL:e}),Qr}async function ss(e,r,t,n,a,o,s,i,c){let l=Date.now();try{let d=await os();if(r==="stdio"){d.runPython(`
39
+ `;async function Ts(e,r,t,n,a,o,s,i,c){return new Promise(d=>{let l=new Blob([Is],{type:"text/javascript"}),p=URL.createObjectURL(l),x=new Worker(p),b=setTimeout(()=>{x.terminate(),URL.revokeObjectURL(p),d({testId:n,passed:!1,stderr:`Execution timed out after ${c}ms`,errored:!0})},c);x.onmessage=v=>{clearTimeout(b),x.terminate(),URL.revokeObjectURL(p);let h=v.data;if(r==="function"&&!h.errored){let g=tt(h.actual,o);d({testId:n,passed:g,actual:h.actual,stderr:h.stderr,durationMs:h.durationMs})}else d({testId:n,passed:h.passed??!1,actualStdout:h.actualStdout,stderr:h.stderr,durationMs:h.durationMs,errored:h.errored})},x.onerror=v=>{clearTimeout(b),x.terminate(),URL.revokeObjectURL(p),d({testId:n,passed:!1,stderr:v.message,errored:!0})},x.postMessage({testId:n,source:e,mode:r,entryFunction:t,args:a,expectedStdout:i,timeout:c})})}var $s="0.27.7";function zs(){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||$s}/full/`}var br=null;function Ds(e){return typeof globalThis.loadPyodide=="function"?Promise.resolve():br||(br=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=()=>{br=null,t(new Error(`Failed to load Pyodide from ${n.src}`))},document.head.appendChild(n)}),br)}var et=null;async function Fs(){if(et)return et;let e=zs();await Ds(e);let r=globalThis.loadPyodide;if(typeof r!="function")throw new Error("Pyodide global not available after loading the CDN script");return et=await r({indexURL:e}),et}async function Os(e,r,t,n,a,o,s,i,c){let d=Date.now();try{let l=await Fs();if(r==="stdio"){l.runPython(`
40
40
  import sys, io
41
41
  _stdout_capture = io.StringIO()
42
42
  sys.stdout = _stdout_capture
43
- `),s&&d.runPython(`
43
+ `),s&&l.runPython(`
44
44
  import io
45
45
  sys.stdin = io.StringIO(${JSON.stringify(s)})
46
- `),d.runPython(e);let m=d.runPython("_stdout_capture.getvalue()");d.runPython("sys.stdout = sys.__stdout__");let v=m.trim()===(i||"").trim();return{testId:n,passed:v,actualStdout:m,durationMs:Date.now()-l}}else{d.runPython(e);let m=(a||[]).map(x=>JSON.stringify(x)).join(", "),v=d.runPython(`${t}(${m})`),h=Kr(v,o);return{testId:n,passed:h,actual:v,durationMs:Date.now()-l}}}catch(d){return{testId:n,passed:!1,stderr:String(d),errored:!0,durationMs:Date.now()-l}}}var Yr=null;async function is(){if(Yr)return Yr;let e=await import("./sql-wasm-browser-NICPVFVD.mjs");return Yr=await(e.default??e)(),Yr}async function cs(e,r,t,n){let a=Date.now();try{let o=await is(),s=new o.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()-a}}catch(o){return{testId:r,passed:!1,stderr:String(o),errored:!0,durationMs:Date.now()-a}}}async function ls(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(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 ls(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 ss(c,a,o,d.id,d.args,d.expectedReturn,d.stdin,d.expectedStdout,i):t==="sql"?m=await cs(c,d.id,d.stdin,d.expectedStdout):m=await rs(c,a,o,d.id,d.args,d.expectedReturn,d.stdin,d.expectedStdout,i),l.push(m)}return l}};import{jsx as Bn}from"react/jsx-runtime";import{forwardRef as ds,useEffect as ps,useImperativeHandle as ms,useRef as us,useState as fs}from"react";function hs(e){return{javascript:"javascript",typescript:"typescript",python:"python",sql:"sql",java:"java",cpp:"cpp",go:"go"}[e]??"plaintext"}var At=ds(function({value:r,onChange:t,language:n="javascript",readOnly:a=!1,readOnlyRanges:o,placeholder:s,height:i=300,className:c,autoFocus:l},d){let[m,v]=fs(null),{scale:h}=_e(),x=us(null);ps(()=>{import("./dist-RXTJ74FF.mjs").then(g=>{v(()=>g.default)}).catch(()=>{})},[]),ms(d,()=>({getValue(){return x.current?.getValue?.()??r},focus(){x.current?.focus?.()},insert(g){let E=x.current;if(!E)return;let y=E.getSelection();E.executeEdits("insert",[{range:y,text:g,forceMoveMarkers:!0}])}}));function u(g){x.current=g,l&&g.focus(),o?.length&&g.onDidAttemptReadOnlyEdit(()=>{})}function b(g){t(g??"")}let k=typeof i=="number"?i*h:i;return m?Bn(m,{className:c,height:k,language:hs(n),value:r,onChange:b,onMount:u,options:{readOnly:a,minimap:{enabled:!1},fontSize:14*h,lineNumbers:"on",scrollBeyondLastLine:!1,automaticLayout:!0,tabSize:2,wordWrap:"on"}}):Bn("textarea",{className:c,value:r,onChange:g=>t(g.target.value),readOnly:a,placeholder:s,style:{width:"100%",height:typeof i=="number"?A(i):i,fontFamily:"monospace",fontSize:A(14),padding:A("0.5rem"),border:"1px solid #e2e8f0",borderRadius:A("0.375rem"),resize:"vertical",background:a?"#f8fafc":"white",boxSizing:"border-box"},autoFocus:l})});var ws=new sr;function ks(e){return e?.showFeedback?e.state??"idle":"idle"}function Wn(e){let r={};for(let t of e.attrs.starters??[])r[t.language]=t.code;return r}function Rs({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 le("div",{style:{padding:`${A("0.5rem")} ${A("0.75rem")}`,borderBottom:"1px solid var(--line, #e7e5e0)",fontSize:A("0.8125rem"),fontFamily:"var(--font-mono, ui-monospace, monospace)"},children:[le("div",{style:{display:"flex",alignItems:"center",gap:A("0.5rem")},children:[J("span",{style:{color:s,fontWeight:700,fontSize:A("0.875rem"),display:"inline-flex"},children:i??(n?J(Pt,{size:15,style:X(15)}):J(qn,{size:15}))}),J("span",{style:{fontWeight:600,color:"var(--ink, #1d2025)"},children:e.name??`Test ${e.id}`})]}),o&&!n&&le("div",{style:{marginTop:A("0.25rem"),paddingLeft:A("1.5rem")},children:[t==="function"?J(gr,{children:r?.actual!==void 0&&le("div",{style:{color:"var(--ink-soft, #565b66)"},children:[J("span",{style:{color:"var(--ink-faint, #8d93a0)"},children:"got: "}),J("span",{style:{color:"var(--pen, #d23b2b)"},children:JSON.stringify(r.actual)}),J("span",{style:{color:"var(--ink-faint, #8d93a0)"},children:" expected: "}),J("span",{style:{color:"var(--ok, #1f8a4c)"},children:JSON.stringify(e.expectedReturn)})]})}):J(gr,{children:r?.actualStdout!==void 0&&le("div",{style:{color:"var(--ink-soft, #565b66)"},children:[le("div",{children:[J("span",{style:{color:"var(--ink-faint, #8d93a0)"},children:"got: "}),J("span",{style:{color:"var(--pen, #d23b2b)",whiteSpace:"pre-wrap"},children:r.actualStdout||"(empty)"})]}),le("div",{children:[J("span",{style:{color:"var(--ink-faint, #8d93a0)"},children:"expected: "}),J("span",{style:{color:"var(--ok, #1f8a4c)",whiteSpace:"pre-wrap"},children:e.expectedStdout||"(empty)"})]})]})}),r?.stderr&&J("div",{style:{color:"var(--almost-ink, #8a5a08)",marginTop:A("0.125rem"),whiteSpace:"pre-wrap"},children:r.stderr})]})]})}function zr({node:e,validationFeedback:r,readOnly:t=!1,executor:n=ws,gradingTests:a}){let o=ce(),s=ys(null),{attrs:i}=e,c=e.id,[l,d]=hr(i.defaultLanguage),[m,v]=hr(()=>Wn(e)),[h,x]=hr([]),[u,b]=hr(!1),[k,g]=hr(!1),E=m[l]??"",y=ks(r);bs(()=>{let S=B=>{let D=B.answers?.find(j=>j.nodeId===c&&j.type==="codingResponse");D?.answer&&(D.answer.language&&d(D.answer.language),D.answer.sourceByLanguage&&v(D.answer.sourceByLanguage),D.answer.testResults&&x(D.answer.testResults))},P=()=>{v(Wn(e)),x([]),g(!1)};return o.on("answers:prefill",S),o.on("answers:reset",P),()=>{o.off("answers:prefill",S),o.off("answers:reset",P)}},[o,c,e]);let f=gs((S,P,B)=>{o.emit({type:"answer:changed",answer:{nodeId:c,type:"codingResponse",timestamp:Date.now(),answer:{language:S,sourceByLanguage:P,source:P[S]??"",testResults:B}}})},[o,c]),C=S=>{let P={...m,[l]:S};v(P),f(l,P,h)},N=S=>{d(S),x([]),f(S,m,[])},I=async()=>{if(u)return;b(!0),x([]);let S=a??i.visibleSamples??[];if(S.length===0){b(!1);return}try{let P=await n.run({language:l,source:E,mode:i.testMode,entryFunction:i.entryFunction,tests:S,timeoutMs:5e3});x(P),f(l,m,P)}catch(P){let B=S.map(D=>({testId:D.id,passed:!1,stderr:String(P),errored:!0}));x(B),f(l,m,B)}finally{b(!1)}},T=()=>{k||(g(!0),f(l,m,h))},p=(a??[]).filter(S=>S.hidden).length,M=p>0?h.filter(S=>(a??[]).find(B=>B.id===S.testId)?.hidden&&S.passed).length:0,$=a?a.filter(S=>!S.hidden):i.visibleSamples??[],q=y==="correct"?"var(--ok, #1f8a4c)":y==="partial"?"var(--almost, #c8810e)":y==="incorrect"?"var(--pen, #d23b2b)":"var(--line-strong, #d6d3cc)";return le("div",{style:{margin:`${A("0.75rem")} 0`,border:`1px solid ${q}`,borderRadius:A("0.875rem"),overflow:"hidden",transition:"border-color 0.2s"},children:[le("div",{style:{background:"var(--ui-muted, #f5f4f1)",borderBottom:"1px solid var(--line, #e7e5e0)",padding:`${A("0.5rem")} ${A("0.75rem")}`,display:"flex",alignItems:"center",gap:A("0.5rem"),flexWrap:"wrap"},children:[J("div",{style:{display:"flex",gap:A("0.25rem")},children:i.languages.map(S=>J("button",{onClick:()=>!t&&N(S),disabled:t,style:{padding:`${A("0.2rem")} ${A("0.6rem")}`,borderRadius:A("0.375rem"),border:"1px solid",borderColor:l===S?"var(--ink, #1d2025)":"var(--line, #e7e5e0)",background:l===S?"var(--ink, #1d2025)":"var(--card, #fff)",color:l===S?"#fff":"var(--ink-soft, #565b66)",fontSize:A("0.75rem"),fontWeight:600,cursor:t?"default":"pointer",fontFamily:"var(--font-mono, ui-monospace, monospace)"},children:S},S))}),J("div",{style:{flex:1}}),J(Me,{hint:i.hint}),!t&&le(gr,{children:[le("button",{onClick:I,disabled:u,style:{padding:`${A("0.25rem")} ${A("0.75rem")}`,borderRadius:A("0.5rem"),border:"1px solid var(--line-strong, #d6d3cc)",background:u?"var(--ui-muted, #f5f4f1)":"var(--card, #fff)",color:"var(--ink, #1d2025)",fontSize:A("0.8125rem"),fontWeight:600,cursor:u?"not-allowed":"pointer",display:"inline-flex",alignItems:"center",gap:A("0.35rem")},children:[J(xs,{size:13,style:X(13)})," ",u?"Running\u2026":"Run"]}),le("button",{onClick:T,disabled:k,style:{padding:`${A("0.3rem")} ${A("0.85rem")}`,borderRadius:A("0.5rem"),border:"none",background:k?"var(--ok-soft, #ecf8f0)":"var(--ink, #1d2025)",color:k?"var(--ok, #1f8a4c)":"#fff",fontSize:A("0.8125rem"),fontWeight:600,cursor:k?"default":"pointer",display:"inline-flex",alignItems:"center",gap:A("0.35rem")},children:[k&&J(Pt,{size:13,style:X(13)})," ",k?"Submitted":"Submit"]})]})]}),J(At,{ref:s,value:E,onChange:C,language:l,readOnly:t,readOnlyRanges:i.starters.find(S=>S.language===l)?.readOnlyRanges,height:320}),(h.length>0||$.length>0)&&le("div",{style:{borderTop:"1px solid var(--line, #e7e5e0)",background:"var(--paper, #fbfaf7)"},children:[J("div",{style:{padding:`${A("0.5rem")} ${A("0.75rem")}`,fontSize:A("0.7rem"),fontWeight:700,color:"var(--ink-faint, #8d93a0)",textTransform:"uppercase",letterSpacing:"0.05em"},children:"Test Results"}),$.map(S=>J(Rs,{sample:S,result:h.find(P=>P.testId===S.id),mode:i.testMode},S.id)),p>0&&le("div",{style:{padding:`${A("0.5rem")} ${A("0.75rem")}`,fontSize:A("0.8125rem"),color:"var(--ink-soft, #565b66)",borderTop:"1px solid var(--line, #e7e5e0)",fontStyle:"italic",display:"flex",alignItems:"center",gap:A("0.4rem")},children:[J(vs,{size:13,style:X(13)})," Hidden tests: ",M,"/",p," passed"]})]}),r?.showFeedback&&le("div",{style:{padding:`${A("0.55rem")} ${A("0.75rem")}`,fontSize:A("0.85rem"),fontWeight:600,borderTop:"1px solid var(--line, #e7e5e0)",display:"flex",alignItems:"center",gap:A("0.45rem"),background:y==="correct"?"var(--ok-soft, #ecf8f0)":y==="partial"?"var(--almost-soft, #fbf1dc)":y==="incorrect"?"var(--pen-soft, #fdeeec)":"transparent",color:y==="correct"?"var(--ok, #1f8a4c)":y==="partial"?"var(--almost-ink, #8a5a08)":y==="incorrect"?"var(--pen, #d23b2b)":"var(--ink-soft, #565b66)"},children:[y==="correct"&&le(gr,{children:[J(Pt,{size:15,style:X(15)})," All tests passed"]}),y==="partial"&&"Partial credit",y==="incorrect"&&le(gr,{children:[J(qn,{size:15,style:X(15)})," Tests failed"]}),y==="validating"&&"Evaluating\u2026",y==="awaiting_review"&&"Awaiting teacher review",r.score!==void 0&&le("span",{style:{marginLeft:"auto",fontFamily:'var(--font-hand, "Caveat", cursive)',fontSize:A("1.5rem"),lineHeight:1},children:[r.score," / ",r.maxScore??i.maxScore]})]})]})}import{Fragment as Ns,jsx as It,jsxs as Cs}from"react/jsx-runtime";import{createContext as As,useContext as Ps}from"react";import{DndContext as Es,MouseSensor as Ms,TouchSensor as Is,KeyboardSensor as Ls,useSensor as Lt,useSensors as Ts}from"@dnd-kit/core";import{jsx as Et}from"react/jsx-runtime";import{DragOverlay as Ss,useDndContext as _s}from"@dnd-kit/core";function Mt(){let{active:e}=_s();if(!e)return null;let r=e.data.current?.html??"";return Et(Ss,{dropAnimation:null,children:Et("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:Et("span",{dangerouslySetInnerHTML:{__html:r},style:{pointerEvents:"none",whiteSpace:"nowrap",lineHeight:"1.25"}})})})}var Un=As(!1);function Jr({children:e}){let r=Ps(Un),t=Lt(Ms,{activationConstraint:{distance:8}}),n=Lt(Is,{activationConstraint:{delay:120,tolerance:8}}),a=Lt(Ls),o=Ts(t,n,a);return r?It(Ns,{children:e}):It(Un.Provider,{value:!0,children:Cs(Es,{sensors:o,children:[e,It(Mt,{})]})})}function cr({content:e,onAnswersChange:r,onSubmit:t,answerBus:n,namespace:a,initialAnswers:o,validationFeedback:s,className:i="",locale:c,readOnly:l=!1,mediaHandler:d,codeExecutor:m,display:v}){let h=ye(v),x=$s(()=>Se(h),[h]),u=zs(null);u.current||(u.current=new $e);let b=n??u.current;Xr(()=>{o&&o.length>0&&b.prefillAnswers(o)},[o,b]),Xr(()=>{if(!r)return;let g=()=>{let E=b.getAllAnswers();r(E)};return b.on("answer:changed",g),()=>b.off("answer:changed",g)},[b,r]),Xr(()=>{if(!t)return;let g=E=>{t(E.answers)};return b.on("answer:submitted",g),()=>b.off("answer:submitted",g)},[b,t]),Xr(()=>{document.querySelectorAll("[data-audio]").forEach(E=>{let y=E.querySelector("audio"),f=E.querySelector("svg");!y||!f||(E.onclick=()=>{y.paused?(y.play(),f.innerHTML='<path d="M6 4h4v16H6zm8 0h4v16h-4z"/>',f.dataset.icon="pause"):(y.pause(),f.innerHTML='<path d="M6 4v16l12-8z"/>',f.dataset.icon="play")},y.onended=()=>{f.innerHTML='<path d="M6 4v16l12-8z"/>',f.dataset.icon="play"})})},[e]);let k=Re(e,s,{readOnly:l,mediaHandler:d,codeExecutor:m});return ir(mr,{locale:c,children:ir(xe,{display:h,children:ir(Sr,{bus:b,children:ir(Jr,{children:ir(qr,{initialAnswers:o,children:ir("div",{className:`question-runtime ${i}${x.sizeSet?" edp-scaled":""}`,"data-namespace":a,style:{fontSize:A("1.125rem"),lineHeight:"1.75",...Ne(x)},children:k})})})})})})}import{jsx as Tt,jsxs as Hn}from"react/jsx-runtime";import{useCallback as Ds,useMemo as Fs,useRef as js}from"react";function Zr({exercise:e,onAnswersChange:r,validationFeedback:t,renderSharedContext:n,renderQuestion:a,renderSeparator:o,className:s="",locale:i,display:c}){let l=ye(c),d=Fs(()=>Se(l),[l]),m=js(new Map),v=Ds((x,u)=>{if(m.current.set(x,u),r){let b={exerciseId:e.id,questionAnswers:e.questions.map(k=>({questionId:k.id,answers:m.current.get(k.id)??[]}))};r(b)}},[e,r]),h=e.sharedContext?Tt("div",{className:"exercise-shared-context",children:Re(e.sharedContext)}):null;return Tt(xe,{display:l,children:Hn("div",{className:`exercise-runtime ${s}`,style:Ne(d),children:[h&&(n?n(h):h),e.questions.map((x,u)=>{let b=t?.get(x.id),k=Tt(cr,{content:x.content,onAnswersChange:g=>v(x.id,g),validationFeedback:b,locale:i},x.id);return Hn("div",{children:[a?a(x,k,u):k,o&&u<e.questions.length-1?o(u):null]},x.id)})]})})}import{jsx as $t,jsxs as Os}from"react/jsx-runtime";import{useCallback as Bs,useEffect as Ws,useMemo as qs,useRef as Us}from"react";function ze({assessment:e,onAnswersChange:r,validationFeedback:t,renderExercise:n,renderSharedContext:a,renderSeparator:o,className:s="",brandingConfig:i,locale:c,display:l}){let d=Us(new Map),m=ye(l),v=qs(()=>Se(m),[m]);Ws(()=>{if(!i?.fontUrl)return;let u=`edpire-brand-font-${i.fontUrl.replace(/\W/g,"").slice(-24)}`;if(document.getElementById(u))return;let b=document.createElement("link");b.id=u,b.rel="stylesheet",b.href=i.fontUrl,document.head.appendChild(b)},[i?.fontUrl]);let h={...Ne(v)};i?.fontFamily&&(h["--brand-font"]=i.fontFamily);let x=Bs(u=>{if(d.current.set(u.exerciseId,u),r){let b={exerciseAnswers:e.exercises.map(k=>d.current.get(k.id)??{exerciseId:k.id,questionAnswers:[]})};r(b)}},[e,r]);return $t(xe,{display:m,children:$t("div",{className:`assessment-runtime ${s}`,style:Object.keys(h).length?h:void 0,children:e.exercises.map((u,b)=>{let k=t?.get(u.id),g=$t(Zr,{exercise:u,onAnswersChange:x,validationFeedback:k,renderSharedContext:a?E=>a(E,u):void 0,locale:c},u.id);return Os("div",{children:[n?n(u,g,b):g,o&&b<e.exercises.length-1?o(b):null]},u.id)})})})}import{jsx as bp}from"react/jsx-runtime";import{useMemo as xp}from"react";import{jsx as br,Fragment as Vn,jsxs as et}from"react/jsx-runtime";import{useMemo as Hs}from"react";function lr({item:e,className:r,renderFigureLabel:t,display:n}){let a=ye(n),o=Hs(()=>Se(a),[a]);return br(xe,{display:a,children:et("div",{className:`annex-item-view ${r??""}${o.sizeSet?" edp-scaled":""}`,style:Ne(o),children:[e.type==="text-document"&&et(Vn,{children:[e.title&&br("h3",{className:"text-base font-semibold mb-2",children:e.title}),Re(e.content)]}),e.type==="figure"&&et("figure",{children:[Re(e.content),br("figcaption",{children:t?t(e.label):br("span",{children:e.label})})]}),e.type==="rich-block"&&et(Vn,{children:[e.title&&br("h3",{className:"text-base font-semibold mb-2",children:e.title}),Re(e.content)]})]})})}import{jsx as Pp,jsxs as Ep}from"react/jsx-runtime";import{useState as Ip}from"react";import{jsx as Fp,jsxs as jp}from"react/jsx-runtime";import{useState as Bp,useCallback as Wp,useMemo as qp}from"react";import{useEditor as Hp,EditorContent as Vp}from"@tiptap/react";import Qp from"@tiptap/starter-kit";import{jsx as Xp,jsxs as Zp,Fragment as em}from"react/jsx-runtime";import{useMemo as tm,useState as nm}from"react";function Ye(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))}Ye(`: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";Ye(`/*! 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-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-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-\\[\\#1f8a4c\\]{background-color:#1f8a4c}.edpire-scope .bg-\\[\\#d23b2b\\]{background-color:#d23b2b}.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-\\[\\#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\\: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 zt}from"react/jsx-runtime";var Gn=Zs.memo(function({content:r,onAnswersChange:t,feedback:n,initialAnswers:a,readOnly:o,className:s,dir:i}){let c=ei(()=>{if(n)return new Map(Object.entries(n))},[n]),l=zt(cr,{content:r,onAnswersChange:t,initialAnswers:a,validationFeedback:c,readOnly:o,className:s});return zt("div",{className:"edpire-scope",style:{display:"contents"},children:i?zt("div",{dir:i,children:l}):l})});import{useEffect as zi,useRef as qt}from"react";import xa from"react";import{createRoot as va}from"react-dom/client";import{useCallback as ha,useMemo as Ei,useState as Mi}from"react";import{cloneElement as na,isValidElement as aa,useCallback as yr,useEffect as pa,useMemo as Ue,useRef as ma,useState as Je}from"react";import{Send as oa,Loader2 as sa,BarChart2 as ia,CheckCircle2 as wi,XCircle as ki,RotateCcw as Ri,X as ca,Clock as xr,AlertTriangle as Si}from"lucide-react";import{clsx as ri}from"clsx";import{twMerge as ti}from"tailwind-merge";function de(...e){return ti(ri(e))}import{Fragment as ii,jsx as ge,jsxs as Dt}from"react/jsx-runtime";function ni({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 ai({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 oi({accent:e}){return Dt("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 si({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 Qn({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?Dt(ii,{children:[ge("style",{children:`
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(v=>JSON.stringify(v)).join(", "),x=l.runPython(`${t}(${p})`),b=tt(x,o);return{testId:n,passed:b,actual:x,durationMs:Date.now()-d}}}catch(l){return{testId:n,passed:!1,stderr:String(l),errored:!0,durationMs:Date.now()-d}}}var rt=null;async function js(){if(rt)return rt;let e=await import("./sql-wasm-browser-NICPVFVD.mjs");return rt=await(e.default??e)(),rt}async function Bs(e,r,t,n){let a=Date.now();try{let o=await js(),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 Ws(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 Ws(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 Os(c,a,o,l.id,l.args,l.expectedReturn,l.stdin,l.expectedStdout,i):t==="sql"?p=await Bs(c,l.id,l.stdin,l.expectedStdout):p=await Ts(c,a,o,l.id,l.args,l.expectedReturn,l.stdin,l.expectedStdout,i),d.push(p)}return d}};import{jsx as ma}from"react/jsx-runtime";import{forwardRef as qs,useEffect as Us,useImperativeHandle as Hs,useRef as Vs,useState as Gs}from"react";function Qs(e){return{javascript:"javascript",typescript:"typescript",python:"python",sql:"sql",java:"java",cpp:"cpp",go:"go"}[e]??"plaintext"}var Bt=qs(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]=Gs(null),{scale:b}=Ce(),v=Vs(null);Us(()=>{import("./dist-RXTJ74FF.mjs").then(f=>{x(()=>f.default)}).catch(()=>{})},[]),Hs(l,()=>({getValue(){return v.current?.getValue?.()??r},focus(){v.current?.focus?.()},insert(f){let C=v.current;if(!C)return;let u=C.getSelection();C.executeEdits("insert",[{range:u,text:f,forceMoveMarkers:!0}])}}));function h(f){v.current=f,d&&f.focus(),o?.length&&f.onDidAttemptReadOnlyEdit(()=>{})}function g(f){t(f??"")}let w=typeof i=="number"?i*b:i;return p?ma(p,{className:c,height:w,language:Qs(n),value:r,onChange:g,onMount:h,options:{readOnly:a,minimap:{enabled:!1},fontSize:14*b,lineNumbers:"on",scrollBeyondLastLine:!1,automaticLayout:!0,tabSize:2,wordWrap:"on"}}):ma("textarea",{className:c,value:r,onChange:f=>t(f.target.value),readOnly:a,placeholder:s,style:{width:"100%",height:typeof i=="number"?L(i):i,fontFamily:"monospace",fontSize:L(14),padding:L("0.5rem"),border:"1px solid #e2e8f0",borderRadius:L("0.375rem"),resize:"vertical",background:a?"#f8fafc":"white",boxSizing:"border-box"},autoFocus:d})});var ei=new sr;function ri(e){return e?.showFeedback?e.state??"idle":"idle"}function ua(e){let r={};for(let t of e.attrs.starters??[])r[t.language]=t.code;return r}function ti({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:`${L("0.5rem")} ${L("0.75rem")}`,borderBottom:"1px solid var(--line, #e7e5e0)",fontSize:L("0.8125rem"),fontFamily:"var(--font-mono, ui-monospace, monospace)"},children:[pe("div",{style:{display:"flex",alignItems:"center",gap:L("0.5rem")},children:[X("span",{style:{color:s,fontWeight:700,fontSize:L("0.875rem"),display:"inline-flex"},children:i??(n?X(Wt,{size:15,style:ee(15)}):X(fa,{size:15}))}),X("span",{style:{fontWeight:600,color:"var(--ink, #1d2025)"},children:e.name??`Test ${e.id}`})]}),o&&!n&&pe("div",{style:{marginTop:L("0.25rem"),paddingLeft:L("1.5rem")},children:[t==="function"?X(xr,{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(xr,{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:L("0.125rem"),whiteSpace:"pre-wrap"},children:r.stderr})]})]})}function Wr({node:e,validationFeedback:r,readOnly:t=!1,executor:n=ei,gradingTests:a}){let o=de(),s=Js(null),{attrs:i}=e,c=e.id,[d,l]=yr(i.defaultLanguage),[p,x]=yr(()=>ua(e)),[b,v]=yr([]),[h,g]=yr(!1),[w,f]=yr(!1),C=p[d]??"",u=ri(r);Ks(()=>{let S=q=>{let $=q.answers?.find(F=>F.nodeId===c&&F.type==="codingResponse");$?.answer&&($.answer.language&&l($.answer.language),$.answer.sourceByLanguage&&x($.answer.sourceByLanguage),$.answer.testResults&&v($.answer.testResults))},M=()=>{x(ua(e)),v([]),f(!1)};return o.on("answers:prefill",S),o.on("answers:reset",M),()=>{o.off("answers:prefill",S),o.off("answers:reset",M)}},[o,c,e]);let y=Ys((S,M,q)=>{o.emit({type:"answer:changed",answer:{nodeId:c,type:"codingResponse",timestamp:Date.now(),answer:{language:S,sourceByLanguage:M,source:M[S]??"",testResults:q}}})},[o,c]),E=S=>{let M={...p,[d]:S};x(M),y(d,M,b)},P=S=>{l(S),v([]),y(S,p,[])},z=async()=>{if(h)return;g(!0),v([]);let S=a??i.visibleSamples??[];if(S.length===0){g(!1);return}try{let M=await n.run({language:d,source:C,mode:i.testMode,entryFunction:i.entryFunction,tests:S,timeoutMs:5e3});v(M),y(d,p,M)}catch(M){let q=S.map($=>({testId:$.id,passed:!1,stderr:String(M),errored:!0}));v(q),y(d,p,q)}finally{g(!1)}},k=()=>{w||(f(!0),y(d,p,b))},m=(a??[]).filter(S=>S.hidden).length,N=m>0?b.filter(S=>(a??[]).find(q=>q.id===S.testId)?.hidden&&S.passed).length:0,I=a?a.filter(S=>!S.hidden):i.visibleSamples??[],O=u==="correct"?"var(--ok, #1f8a4c)":u==="partial"?"var(--almost, #c8810e)":u==="incorrect"?"var(--pen, #d23b2b)":"var(--line-strong, #d6d3cc)";return pe("div",{style:{margin:`${L("0.75rem")} 0`,border:`1px solid ${O}`,borderRadius:L("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:`${L("0.5rem")} ${L("0.75rem")}`,display:"flex",alignItems:"center",gap:L("0.5rem"),flexWrap:"wrap"},children:[X("div",{style:{display:"flex",gap:L("0.25rem")},children:i.languages.map(S=>X("button",{onClick:()=>!t&&P(S),disabled:t,style:{padding:`${L("0.2rem")} ${L("0.6rem")}`,borderRadius:L("0.375rem"),border:"1px solid",borderColor:d===S?"var(--ink, #1d2025)":"var(--line, #e7e5e0)",background:d===S?"var(--ink, #1d2025)":"var(--card, #fff)",color:d===S?"#fff":"var(--ink-soft, #565b66)",fontSize:L("0.75rem"),fontWeight:600,cursor:t?"default":"pointer",fontFamily:"var(--font-mono, ui-monospace, monospace)"},children:S},S))}),X("div",{style:{flex:1}}),X(Me,{hint:i.hint}),!t&&pe(xr,{children:[pe("button",{onClick:z,disabled:h,style:{padding:`${L("0.25rem")} ${L("0.75rem")}`,borderRadius:L("0.5rem"),border:"1px solid var(--line-strong, #d6d3cc)",background:h?"var(--ui-muted, #f5f4f1)":"var(--card, #fff)",color:"var(--ink, #1d2025)",fontSize:L("0.8125rem"),fontWeight:600,cursor:h?"not-allowed":"pointer",display:"inline-flex",alignItems:"center",gap:L("0.35rem")},children:[X(Xs,{size:13,style:ee(13)})," ",h?"Running\u2026":"Run"]}),pe("button",{onClick:k,disabled:w,style:{padding:`${L("0.3rem")} ${L("0.85rem")}`,borderRadius:L("0.5rem"),border:"none",background:w?"var(--ok-soft, #ecf8f0)":"var(--ink, #1d2025)",color:w?"var(--ok, #1f8a4c)":"#fff",fontSize:L("0.8125rem"),fontWeight:600,cursor:w?"default":"pointer",display:"inline-flex",alignItems:"center",gap:L("0.35rem")},children:[w&&X(Wt,{size:13,style:ee(13)})," ",w?"Submitted":"Submit"]})]})]}),X(Bt,{ref:s,value:C,onChange:E,language:d,readOnly:t,readOnlyRanges:i.starters.find(S=>S.language===d)?.readOnlyRanges,height:320}),(b.length>0||I.length>0)&&pe("div",{style:{borderTop:"1px solid var(--line, #e7e5e0)",background:"var(--paper, #fbfaf7)"},children:[X("div",{style:{padding:`${L("0.5rem")} ${L("0.75rem")}`,fontSize:L("0.7rem"),fontWeight:700,color:"var(--ink-faint, #8d93a0)",textTransform:"uppercase",letterSpacing:"0.05em"},children:"Test Results"}),I.map(S=>X(ti,{sample:S,result:b.find(M=>M.testId===S.id),mode:i.testMode},S.id)),m>0&&pe("div",{style:{padding:`${L("0.5rem")} ${L("0.75rem")}`,fontSize:L("0.8125rem"),color:"var(--ink-soft, #565b66)",borderTop:"1px solid var(--line, #e7e5e0)",fontStyle:"italic",display:"flex",alignItems:"center",gap:L("0.4rem")},children:[X(Zs,{size:13,style:ee(13)})," Hidden tests: ",N,"/",m," passed"]})]}),r?.showFeedback&&pe("div",{style:{padding:`${L("0.55rem")} ${L("0.75rem")}`,fontSize:L("0.85rem"),fontWeight:600,borderTop:"1px solid var(--line, #e7e5e0)",display:"flex",alignItems:"center",gap:L("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"&&pe(xr,{children:[X(Wt,{size:15,style:ee(15)})," All tests passed"]}),u==="partial"&&"Partial credit",u==="incorrect"&&pe(xr,{children:[X(fa,{size:15,style:ee(15)})," Tests failed"]}),u==="validating"&&"Evaluating\u2026",u==="awaiting_review"&&"Awaiting teacher review",r.score!==void 0&&pe("span",{style:{marginLeft:"auto",fontFamily:'var(--font-hand, "Caveat", cursive)',fontSize:L("1.5rem"),lineHeight:1},children:[r.score," / ",r.maxScore??i.maxScore]})]})]})}import{Fragment as oi,jsx as Ht,jsxs as si}from"react/jsx-runtime";import{createContext as ii,useContext as ci}from"react";import{DndContext as li,MouseSensor as di,TouchSensor as pi,KeyboardSensor as mi,useSensor as Vt,useSensors as ui}from"@dnd-kit/core";import{jsx as qt}from"react/jsx-runtime";import{DragOverlay as ni,useDndContext as ai}from"@dnd-kit/core";function Ut(){let{active:e}=ai();if(!e)return null;let r=e.data.current?.html??"";return qt(ni,{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 ha=ii(!1);function nt({children:e}){let r=ci(ha),t=Vt(di,{activationConstraint:{distance:8}}),n=Vt(pi,{activationConstraint:{delay:120,tolerance:8}}),a=Vt(mi),o=ui(t,n,a);return r?Ht(oi,{children:e}):Ht(ha.Provider,{value:!0,children:si(li,{sensors:o,children:[e,Ht(Ut,{})]})})}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 b=xe(x),v=fi(()=>ke(b),[b]),h=hi(null);h.current||(h.current=new Fe);let g=n??h.current;at(()=>{o&&o.length>0&&g.prefillAnswers(o)},[o,g]),at(()=>{if(!r)return;let f=()=>{let C=g.getAllAnswers();r(C)};return g.on("answer:changed",f),()=>g.off("answer:changed",f)},[g,r]),at(()=>{if(!t)return;let f=C=>{t(C.answers)};return g.on("answer:submitted",f),()=>g.off("answer:submitted",f)},[g,t]),at(()=>{document.querySelectorAll("[data-audio]").forEach(C=>{let u=C.querySelector("audio"),y=C.querySelector("svg");!u||!y||(C.onclick=()=>{u.paused?(u.play(),y.innerHTML='<path d="M6 4h4v16H6zm8 0h4v16h-4z"/>',y.dataset.icon="pause"):(u.pause(),y.innerHTML='<path d="M6 4v16l12-8z"/>',y.dataset.icon="play")},u.onended=()=>{y.innerHTML='<path d="M6 4v16l12-8z"/>',y.dataset.icon="play"})})},[e]);let w=we(e,s,{readOnly:d,mediaHandler:l,codeExecutor:p});return ir(hr,{locale:c,children:ir(ve,{display:b,children:ir(Pr,{bus:g,children:ir(nt,{children:ir(Yr,{initialAnswers:o,children:ir("div",{className:`question-runtime ${i}${v.sizeSet?" edp-scaled":""}`,"data-namespace":a,style:{fontSize:L("1.125rem"),lineHeight:"1.75",...Re(v)},children:w})})})})})})}import{jsx as lr,jsxs as it}from"react/jsx-runtime";import{memo as xi,useCallback as va,useMemo as vi,useRef as xa}from"react";var ga={words:80,media:1,tableRows:6},gi=new Set(["resizableImage","resizableVideo","youtubeEmbed"]);function ba(e){let r={words:0,media:0,tableRows:0},t=n=>{if(typeof n.text=="string"&&(r.words+=n.text.split(/\s+/).filter(a=>/[\p{L}\p{N}]/u.test(a)).length),n.type&&gi.has(n.type)&&r.media++,n.type==="table"){let a=(n.content??[]).filter(o=>o.type==="tableRow").length;r.tableRows=Math.max(r.tableRows,a)}for(let a of n.content??[])t(a)};return e&&t(e),r}function vr(e,r=ga){let t=ba(e);return t.words>r.words||t.media>r.media||t.tableRows>r.tableRows}import{createContext as bi,useContext as yi}from"react";var ya=bi(null),ot=ya.Provider;function st(){return yi(ya)}function ct({exercise:e,onAnswersChange:r,validationFeedback:t,renderSharedContext:n,renderQuestion:a,renderSeparator:o,className:s="",locale:i,display:c}){let d=xe(c),l=vi(()=>ke(d),[d]),p=xa(new Map),x=xa({exercise:e,onAnswersChange:r});x.current={exercise:e,onAnswersChange:r};let b=va((f,C)=>{p.current.set(f,C);let{exercise:u,onAnswersChange:y}=x.current;if(y){let E={exerciseId:u.id,questionAnswers:u.questions.map(P=>({questionId:P.id,answers:p.current.get(P.id)??[]}))};y(E)}},[]),v=st(),h=fr(i),g=!!(v&&e.sharedContext&&vr(e.sharedContext)),w=e.sharedContext?g?it("p",{className:"exercise-reference-cue",children:[lr("span",{children:h.referenceInPanel(v.label)})," ",it("button",{type:"button",className:"exercise-reference-cue__link",onClick:()=>v.showExerciseReference(e.id),children:[h.readReference,lr("span",{"aria-hidden":"true",className:"exercise-reference-cue__arrow",children:"\u203A"})]})]}):lr("div",{className:"exercise-shared-context",children:we(e.sharedContext)}):null;return lr(ve,{display:d,children:it("div",{className:`exercise-runtime ${s}`,style:Re(l),children:[w&&(n?n(w):w),e.questions.map((f,C)=>{let u=t?.get(f.id),y=lr(wi,{questionId:f.id,content:f.content,onQuestionAnswers:b,validationFeedback:u,locale:i},f.id);return it("div",{children:[a?a(f,y,C):y,o&&C<e.questions.length-1?o(C):null]},f.id)})]})})}var wi=xi(function({questionId:r,content:t,onQuestionAnswers:n,validationFeedback:a,locale:o}){let s=va(i=>n(r,i),[n,r]);return lr(cr,{content:t,onAnswersChange:s,validationFeedback:a,locale:o})});import{jsx as Gt,jsxs as ki}from"react/jsx-runtime";import{useCallback as Ri,useEffect as Si,useMemo as _i,useRef as wa}from"react";function He({assessment:e,onAnswersChange:r,validationFeedback:t,renderExercise:n,renderSharedContext:a,renderSeparator:o,className:s="",brandingConfig:i,locale:c,display:d}){let l=wa(new Map),p=xe(d),x=_i(()=>ke(p),[p]);Si(()=>{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(x)};i?.fontFamily&&(b["--brand-font"]=i.fontFamily);let v=wa({assessment:e,onAnswersChange:r});v.current={assessment:e,onAnswersChange:r};let h=Ri(g=>{l.current.set(g.exerciseId,g);let{assessment:w,onAnswersChange:f}=v.current;if(f){let C={exerciseAnswers:w.exercises.map(u=>l.current.get(u.id)??{exerciseId:u.id,questionAnswers:[]})};f(C)}},[]);return Gt(ve,{display:p,children:Gt("div",{className:`assessment-runtime ${s}`,style:Object.keys(b).length?b:void 0,children:e.exercises.map((g,w)=>{let f=t?.get(g.id),C=Gt(ct,{exercise:g,onAnswersChange:h,validationFeedback:f,renderSharedContext:a?u=>a(u,g):void 0,locale:c},g.id);return ki("div",{children:[n?n(g,C,w):C,o&&w<e.exercises.length-1?o(w):null]},g.id)})})})}import{jsx as ka}from"react/jsx-runtime";import{useMemo as Ni}from"react";function lt({content:e,className:r,display:t}){let n=xe(t),a=Ni(()=>ke(n),[n]);return ka(ve,{display:n,children:ka("div",{className:`content-view ${r??""}`,style:Re(a),children:we(e)})})}import{jsx as wr,Fragment as Ra,jsxs as dt}from"react/jsx-runtime";import{useMemo as Ci}from"react";function kr({item:e,className:r,renderFigureLabel:t,display:n}){let a=xe(n),o=Ci(()=>ke(a),[a]);return wr(ve,{display:a,children:dt("div",{className:`annex-item-view ${r??""}${o.sizeSet?" edp-scaled":""}`,style:Re(o),children:[e.type==="text-document"&&dt(Ra,{children:[e.title&&wr("h3",{className:"text-base font-semibold mb-2",children:e.title}),we(e.content)]}),e.type==="figure"&&dt("figure",{children:[we(e.content),wr("figcaption",{children:t?t(e.label):wr("span",{children:e.label})})]}),e.type==="rich-block"&&dt(Ra,{children:[e.title&&wr("h3",{className:"text-base font-semibold mb-2",children:e.title}),we(e.content)]})]})})}import{jsx as vm,jsxs as wm}from"react/jsx-runtime";import{useState as Rm}from"react";import{jsx as Em,jsxs as Pm}from"react/jsx-runtime";import{useState as Lm,useCallback as Im,useMemo as Tm}from"react";import{useEditor as zm,EditorContent as Dm}from"@tiptap/react";import Om from"@tiptap/starter-kit";import{jsx as qm,jsxs as Um,Fragment as Hm}from"react/jsx-runtime";import{useMemo as Gm,useState as Qm}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}.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";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-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 .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 .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-y-0\\.5{row-gap:calc(var(--spacing) * .5)}.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-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 .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\\: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 .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 Qt}from"react/jsx-runtime";var Sa=Ti.memo(function({content:r,onAnswersChange:t,feedback:n,initialAnswers:a,readOnly:o,className:s,dir:i}){let c=$i(()=>{if(n)return new Map(Object.entries(n))},[n]),d=Qt(cr,{content:r,onAnswersChange:t,initialAnswers:a,validationFeedback:c,readOnly:o,className:s});return Qt("div",{className:"edpire-scope",style:{display:"contents"},children:i?Qt("div",{dir:i,children:d}):d})});import{useEffect as Rc,useRef as cn}from"react";import Ya from"react";import{createRoot as Ka}from"react-dom/client";import{useCallback as Ha,useMemo as bc,useState as yc}from"react";import{cloneElement as Da,isValidElement as Fa,useCallback as dr,useEffect as tn,useMemo as $e,useRef as nn,useState as ze}from"react";import{Send as Oa,Loader2 as Zt,BarChart2 as ja,CheckCircle2 as oc,XCircle as sc,RotateCcw as ic,X as en,Clock as pr,AlertTriangle as cc,Check as lc,CloudOff as dc}from"lucide-react";import{clsx as zi}from"clsx";import{twMerge as Di}from"tailwind-merge";function be(...e){return Di(zi(e))}import{Fragment as Wi,jsx as ge,jsxs as Yt}from"react/jsx-runtime";function Fi({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 Oi({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 ji({accent:e}){return Yt("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 Bi({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 _a({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?Yt(Wi,{children:[ge("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:Dt("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(ai,{accent:t});case"pulse":return ge(oi,{accent:t});case"bars":return ge(si,{accent:t});default:return ge(ni,{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 ci}from"react";import{BookOpen as Yn,X as li}from"lucide-react";import{jsx as oe,jsxs as qe}from"react/jsx-runtime";function Kn({assessment:e,isSubmitted:r,setAnswers:t,validationFeedback:n,renderExercise:a,renderSeparator:o,primaryColor:s,contained:i=!1,locale:c,contentMaxWidth:l,t:d}){let[m,v]=ci(!1),h=e.annex,x=h.tabLabel??d("annexDocuments");return qe("div",{className:de("@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:[qe("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:[qe("div",{className:"flex items-center gap-2 px-5 py-3 border-b border-[#e7e5e0] flex-shrink-0",children:[oe(Yn,{size:14,className:"text-[#8d93a0]"}),oe("span",{className:"text-xs font-bold text-[#565b66] uppercase tracking-widest",children:x})]}),oe("div",{className:"flex-1 overflow-y-auto px-6 py-5 flex flex-col gap-6",children:h.items.map(u=>oe(lr,{item:u},u.id))})]}),oe("div",{className:"w-px bg-[#e7e5e0] flex-shrink-0 self-stretch my-1 rounded-full"}),oe("div",{className:"flex-1 bg-white rounded-[14px] border border-[#e7e5e0] shadow-sm",children:oe("div",{className:"px-6 py-5 flex flex-col gap-4",children:oe(ze,{assessment:e,onAnswersChange:r?void 0:t,validationFeedback:n,renderExercise:a,renderSeparator:o,locale:c})})})]}),qe("div",{className:"@6xl:hidden flex-1 relative overflow-hidden",children:[oe("div",{className:"absolute inset-0 overflow-y-auto",children:oe("div",{className:"mx-auto px-5 py-5 flex flex-col gap-4",style:{maxWidth:l},children:oe(ze,{assessment:e,onAnswersChange:r?void 0:t,validationFeedback:n,renderExercise:a,renderSeparator:o,locale:c})})}),m&&oe("div",{className:de("inset-0 z-30 bg-black/25",i?"absolute":"fixed"),onClick:()=>v(!1)}),qe("div",{className:de("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",m?"translate-x-0":"-translate-x-[110%]"),children:[qe("div",{className:"flex items-center justify-between px-5 py-3 flex-shrink-0",children:[oe("span",{className:"text-sm font-bold text-[#1d2025]",children:x}),oe("button",{onClick:()=>v(!1),className:"p-1 text-[#8d93a0] hover:text-[#1d2025] rounded-lg transition-colors",children:oe(li,{size:18})})]}),oe("div",{className:"overflow-y-auto max-h-[calc(100vh-8rem)] px-5 pb-5 flex flex-col gap-5",children:h.items.map(u=>oe(lr,{item:u},u.id))})]})]}),!m&&qe("button",{onClick:()=>v(!0),style:{transform:"translateY(-50%)",...s?{backgroundColor:s}:{}},className:de("@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:[oe(Yn,{size:12}),oe("span",{style:{writingMode:"vertical-rl",transform:"rotate(180deg)"},children:x})]})]})}import{useState as di}from"react";import{BookOpen as Jn,Plus as pi,X as mi}from"lucide-react";import{jsx as se,jsxs as Ke}from"react/jsx-runtime";function Xn({assessment:e,isSubmitted:r,setAnswers:t,validationFeedback:n,renderExercise:a,renderSeparator:o,primaryColor:s,contained:i=!1,locale:c,contentMaxWidth:l,t:d,onAddAnnex:m}){let[v,h]=di(!1),x=se(ze,{assessment:e,onAnswersChange:r?void 0:t,validationFeedback:n,renderExercise:a,renderSeparator:o,locale:c});if(v)return se("div",{className:"flex-1 overflow-y-auto",children:se("div",{className:"mx-auto p-6 flex flex-col gap-4",style:{maxWidth:l},children:x})});let u=g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),m())},b=g=>Ke("span",{style:s?{backgroundColor:s}:void 0,className:de("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",g?"px-3 py-1.5 text-xs":"mt-1 px-3.5 py-2 text-xs"),children:[se(pi,{size:13}),d("annexEmptyCta")]}),k=g=>se("button",{type:"button",onClick:E=>{E.stopPropagation(),h(!0)},"aria-label":d("annexEmptyDismiss"),title:d("annexEmptyDismiss"),className:de("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",g&&"absolute top-2 end-2 z-10"),children:se(mi,{size:15})});return Ke("div",{className:de("@container flex-1 min-h-0 flex",i&&"relative"),children:[Ke("div",{className:"hidden @6xl:flex flex-1 gap-4 p-4 bg-[#f5f4f1] items-start overflow-y-auto",children:[se("div",{className:"flex-1 sticky top-4 flex min-h-[200px] max-h-[calc(100svh-6rem)]",children:Ke("div",{role:"button",tabIndex:0,onClick:m,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:[k(!0),se("span",{className:"flex items-center justify-center w-11 h-11 rounded-full bg-[#f1efe9] text-[#8d93a0] group-hover:text-[#1d2025] transition-colors",children:se(Jn,{size:20})}),se("span",{className:"text-sm font-bold text-[#565b66]",children:d("annexEmptyTitle")}),se("span",{className:"text-xs text-[#8d93a0] max-w-[32ch] leading-relaxed",children:d("annexEmptyBody")}),b(!1)]})}),se("div",{className:"w-px bg-[#e7e5e0] flex-shrink-0 self-stretch my-1 rounded-full"}),se("div",{className:"flex-1 bg-white rounded-[14px] border border-[#e7e5e0] shadow-sm",children:se("div",{className:"px-6 py-5 flex flex-col gap-4",children:x})})]}),se("div",{className:"@6xl:hidden flex-1 overflow-y-auto",children:Ke("div",{className:"mx-auto px-5 py-5 flex flex-col gap-4",style:{maxWidth:l},children:[Ke("div",{role:"button",tabIndex:0,onClick:m,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:[se("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:se(Jn,{size:16})}),Ke("div",{className:"flex-1 min-w-0",children:[se("div",{className:"text-xs font-bold text-[#565b66]",children:d("annexEmptyTitle")}),se("div",{className:"text-[11px] text-[#8d93a0] leading-snug",children:d("annexEmptyBody")})]}),b(!0),k(!1)]}),x]})})]})}function Ft(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 ui=new Set(["choiceSet","inlineChoiceSet","blank","aiAnswerInput","matchingSet","openResponseNode","mathResponse","codingResponse"]),fi=new Set(["blankPool","inlinePool"]);function hi(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 gi(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(ui.has(a)){r+=1;return}if(fi.has(a))return}o!==void 0&&t(o)};return t(e),r}function Zn(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)hi(i)&&s.add(i.nodeId)}let n=0;for(let a of e.exercises)for(let o of a.questions){let s=gi(o.content);s!==0&&(t.get(o.id)?.size??0)<s&&(n+=1)}return n}var bi={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"},yi={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"},xi={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"},jt={en:bi,fr:yi,ar:xi};function vi(e,r,t){let a=(jt[e]??jt.en)[r]??jt.en[r]??r;return t?Object.entries(t).reduce((o,[s,i])=>o.replace(`{${s}}`,String(i)),a):a}function ea(e){return(r,t)=>vi(e,r,t)}function ra(e){return e==="ar"}function rt(e){return e==="en"?"en":"fr"}var ta="48rem";import"katex/dist/katex.min.css";Ye(`.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 da,jsx as L,jsxs as U}from"react/jsx-runtime";var _i="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 Ni(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 ua(e){let r=e;return typeof r.totalMaxScore=="number"?r.totalMaxScore:(r.answerKeys??[]).reduce((t,n)=>t+(n.scoring?.maxScore??0),0)}function la(e){return e.questions.reduce((r,t)=>r+ua(t),0)}function De(e){return Number.isInteger(e)?String(e):parseFloat(e.toFixed(2)).toString()}function fa(e){return e==="full"?"#1f8a4c":e==="partial"?"#c8810e":"#d23b2b"}function Ci({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:fa(e),strokeWidth:9,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:L("path",{d:r})})}function Ai({score:e,weight:r,t}){if(e){if(e.awaiting)return U("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(xr,{size:11}),t("pendingReview")]});let n=e.m>0&&e.s>=e.m?"full":e.s>0?"partial":"none";return U("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(Ci,{outcome:n}),U("span",{className:"font-bold leading-none",style:{fontFamily:'var(--font-hand, "Caveat", cursive)',fontSize:"1.05rem",color:fa(n)},children:[De(e.s)," / ",De(e.m)]})]})}return r>0?U("span",{className:"text-xs font-semibold tabular-nums text-[#8d93a0]",children:[De(r)," ",t("points")]}):null}function Pi({timeLimitMinutes:e,startedAt:r,onExpire:t}){let n=e*6e4,a=new Date(r).getTime()+n,[o,s]=Je(()=>Math.max(a-Date.now(),0)),i=ma(t);i.current=t,pa(()=>{if(o<=0){i.current();return}let u=setInterval(()=>{let b=Math.max(a-Date.now(),0);s(b),b<=0&&(clearInterval(u),i.current())},1e3);return()=>clearInterval(u)},[a]);let c=o/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(o/1e3),m=Math.floor(d/3600),v=Math.floor(d%3600/60),h=d%60,x=m>0?`${m}:${String(v).padStart(2,"0")}:${String(h).padStart(2,"0")}`:`${v}:${String(h).padStart(2,"0")}`;return U("span",{className:de("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(xr,{size:12}),x]})}function vr({assessment:e,meta:r,locale:t="en",branding:n,timeLimitMinutes:a,startedAt:o,onSubmit:s,review:i,onViewReport:c,reportLabel:l,onBack:d,backLabel:m,allowReset:v,onReset:h,overlayConfig:x,contained:u=!1,layout:b,onClose:k,mediaHandler:g,onAddAnnex:E,fallbackLogoUrl:y}){let f=Ue(()=>ea(t),[t]),C=ra(t)?"rtl":"ltr",N=b?.maxWidth??ta,I=n?.branding?.primaryColor,T=n?.branding?.accentColor,p=n?.branding?.fontFamily,M=n?.branding?.fontUrl,$=n?.branding?.showPoweredBy!==!1;pa(()=>{if(!M||typeof document>"u"||document.querySelector(`link[href="${M}"]`))return;let ue=document.createElement("link");ue.rel="stylesheet",ue.href=M,document.head.appendChild(ue)},[M]);let[q,S]=Je(()=>i?.answers??{exerciseAnswers:[]}),[P,B]=Je(!1),[D,j]=Je(!1),[z,W]=Je(i?.result??null),w=Ue(()=>{let Q=new Map;for(let ue of i?.answers.exerciseAnswers??[])for(let Ae of ue.questionAnswers)Q.set(Ae.questionId,Ae.answers);return Q},[i]),[R,F]=Je(null),[H,V]=Je(!1),me=ma(!1),te=Ue(()=>Ni(e),[e]),ne=Ue(()=>D?Zn(e,q):0,[D,e,q]),ie=Ue(()=>e.exercises.reduce((Q,ue)=>Q+la(ue),0),[e]),re=Ue(()=>z?Ft(z.exerciseFeedback):void 0,[z]),Ce=Ue(()=>{if(!z)return{};let Q={};for(let ue of z.exerciseFeedback){let Ae=0,Fe=0,fe=!1;for(let Ze of ue.questions)for(let Te of Ze.nodeResults)Ae+=Te.score,Fe+=Te.maxScore,Te.status==="awaiting_review"&&(fe=!0);Q[ue.exerciseId]={score:Ae,maxScore:Fe,awaiting:fe}}return Q},[z]),dr=Ue(()=>{if(!z)return{};let Q={};for(let ue of z.exerciseFeedback)for(let Ae of ue.questions){let Fe=0,fe=0,Ze=!1;for(let Te of Ae.nodeResults)Fe+=Te.score,fe+=Te.maxScore,Te.status==="awaiting_review"&&(Ze=!0);Q[Ae.questionId]={score:Fe,maxScore:fe,awaiting:Ze}}return Q},[z]),Xe=yr(async()=>{B(!0),F(null);try{let Q=await s(q);W(Q),typeof window<"u"&&window.scrollTo({top:0,behavior:"smooth"})}catch(Q){F(Q instanceof Error?Q.message:f("confirmCancel"))}finally{B(!1),j(!1)}},[q,s,f]),Ut=yr(()=>{!z||!c||c(z)},[z,c]),Ra=yr(()=>{me.current||P||z||(me.current=!0,V(!0),j(!1),typeof document<"u"&&document.activeElement?.blur(),setTimeout(()=>{B(!0),F(null),s(q).then(Q=>{W(Q),typeof window<"u"&&window.scrollTo({top:0,behavior:"smooth"})}).catch(Q=>{F(Q instanceof Error?Q.message:"submit_error")}).finally(()=>{B(!1),V(!1)})},800))},[q,P,s,z]),tt=yr((Q,ue,Ae)=>{let Fe=la(Q),fe=Ce[Q.id],Ze=Q.questions.length>1,Te=aa(ue)?na(ue,{renderQuestion:(wr,at,Sa)=>{let er=wr.id,Ht={...g?{mediaHandler:g}:{},...i?{initialAnswers:w.get(er)??[],readOnly:!0}:{}},Vt=Object.keys(Ht).length>0&&aa(at)?na(at,Ht):at;if(!Ze)return L("div",{"data-question-id":er,children:Vt},er);let kr=dr[er],_a=ua(wr);return U("div",{"data-question-id":er,children:[U("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:f("question",{index:Sa+1})}),L(Ai,{score:kr?{s:kr.score,m:kr.maxScore,awaiting:kr.awaiting}:null,weight:_a,t:f})]}),Vt]},er)},renderSeparator:wr=>L("div",{className:"border-t border-[#e7e5e0] my-1"},`qsep-${wr}`)}):ue;return U("div",{"data-exercise-id":Q.id,className:"bg-white rounded-[14px] border border-[#e7e5e0] shadow-sm overflow-hidden",children:[U("div",{className:"flex items-center justify-between px-4 py-2.5 bg-[#f1efe9] border-b border-[#e7e5e0]",style:T?{backgroundColor:T}:void 0,children:[L("span",{className:"text-sm font-bold text-[#1d2025]",children:f("exercise",{index:Ae+1})}),fe?.awaiting?U("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(xr,{size:11}),f("pendingReview")]}):fe?U("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:[De(fe.score)," / ",De(fe.maxScore)]}):Fe>0?U("span",{className:"text-xs font-semibold text-[#8d93a0] tabular-nums",children:["/ ",De(Fe)," ",f("points")]}):null]}),L("div",{className:"p-4",children:Te})]},Q.id)},[f,Ce,dr,T,g,i,w]),nt=yr(Q=>U("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:f("exercise",{index:Q+2})}),L("div",{className:"flex-1 border-t border-dashed border-[#e7e5e0]"})]},`sep-${Q}`),[f]),He=z!==null;return L("div",{className:"edpire-scope",style:{display:"contents"},children:U("div",{dir:C,className:de("flex flex-col",u?"h-full":"h-dvh"),style:p?{fontFamily:p}:void 0,children:[L(Qn,{visible:P&&!H,hasAiNodes:te,text:f("evaluating"),aiText:f("aiEvaluating"),contained:u,...x}),H&&U("div",{className:de("fixed inset-0 z-50 flex flex-col items-center justify-center gap-3 bg-red-950/80 backdrop-blur-sm",u&&"absolute"),children:[L(xr,{size:40,className:"text-red-300"}),L("p",{className:"text-xl font-black text-white tracking-tight",children:f("timeUp.title")}),L("p",{className:"text-sm text-red-200",children:f("timeUp.submitting")})]}),U("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:T?{backgroundColor:T}:void 0,children:[U("div",{className:"flex items-center gap-3",children:[L("img",{src:n?.logoUrl??y??_i,alt:n?.name??"Edpire",width:24,height:24,loading:"lazy",className:"rounded object-contain"}),U("div",{children:[L("h1",{className:"text-sm font-bold text-[#1d2025]",children:r.title}),L("p",{className:"text-[11px] text-[#8d93a0] capitalize",children:ie>0&&U("span",{className:"ms-2 font-semibold text-[#565b66]",children:["/ ",De(ie)," ",f("points")]})})]}),!He&&a&&a>0&&o&&L(Pi,{timeLimitMinutes:a,startedAt:o,onExpire:Ra})]}),U("div",{className:"flex items-center gap-2",children:[v&&U("button",{onClick:h,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(Ri,{size:13}),f("reset")]}),(!He||i)&&d&&U("button",{onClick:d,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(ca,{size:13}),m??f("back")]}),k&&L("button",{onClick:k,className:"p-1.5 text-[#8d93a0] hover:text-[#1d2025] hover:bg-[#f1efe9] rounded-lg transition-colors",children:L(ca,{size:15})}),!He&&L("button",{onClick:()=>j(!0),disabled:P,style:I?{backgroundColor:I}: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:P?U(da,{children:[L(sa,{size:14,className:"animate-spin"}),f("submitting")]}):U(da,{children:[L(oa,{size:14}),f("submit")]})})]})]}),R&&L("div",{className:"flex-shrink-0 bg-[#fdeeec] border-b border-[#f6cfc9] px-4 py-2 text-sm text-[#a32b1e]",children:R}),He&&z&&(z.awaitingManualGrading?L("div",{className:"flex-shrink-0 border-b bg-[#fbf1dc] border-[#f2e2bf]",children:L("div",{className:"mx-auto px-6 py-4",style:{maxWidth:N},children:U("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-4",children:[U("div",{className:"flex items-center gap-2",children:[L(xr,{size:20,className:"text-[#c8810e] flex-shrink-0"}),L("span",{className:"text-sm font-semibold text-[#8a5a08]",children:z.aiPending?f("beingMarked"):f("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:z.aiPending?f("beingMarkedDesc"):f("awaitingReviewDesc")}),c&&U("button",{onClick:Ut,style:I?{backgroundColor:I}: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(ia,{size:14}),l??f("viewFullReport")]})]})})}):L("div",{className:de("flex-shrink-0 border-b",z.passed?"bg-[#ecf8f0] border-[#c5e8d1]":"bg-[#fdeeec] border-[#f6cfc9]"),children:L("div",{className:"mx-auto px-6 py-4",style:{maxWidth:N},children:U("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-4",children:[U("div",{className:"flex items-center gap-2",children:[z.passed?L(wi,{size:20,className:"text-[#1f8a4c] flex-shrink-0"}):L(ki,{size:20,className:"text-[#d23b2b] flex-shrink-0"}),L("span",{className:de("text-sm font-semibold",z.passed?"text-[#1f8a4c]":"text-[#d23b2b]"),children:z.passed?f("assessmentPassed"):f("assessmentNotPassed")})]}),L("div",{className:"hidden sm:block w-px h-8 bg-[#e7e5e0]"}),U("div",{className:"flex items-baseline gap-1.5",children:[U("span",{className:"leading-none tabular-nums",style:{fontFamily:'var(--font-hand, "Caveat", cursive)',fontSize:"2rem",color:z.passed?"#1f8a4c":"#d23b2b"},children:[De(z.totalScore)," / ",De(z.maxScore)]}),L("span",{className:"text-sm text-[#8d93a0] font-medium",children:f("points")})]}),U("div",{className:"flex-1 flex items-center gap-3 min-w-0",children:[L("div",{className:"flex-1 h-2 bg-[#e7e5e0] rounded-full overflow-hidden min-w-[80px]",children:L("div",{className:de("h-full rounded-full transition-all duration-700",z.passed?"bg-[#1f8a4c]":"bg-[#d23b2b]"),style:{width:`${z.percentage}%`}})}),U("span",{className:de("text-sm font-bold tabular-nums flex-shrink-0",z.passed?"text-[#1f8a4c]":"text-[#d23b2b]"),children:[z.percentage,"%"]})]}),c&&U("button",{onClick:Ut,style:I?{backgroundColor:I}: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(ia,{size:14}),l??f("viewFullReport")]})]})})})),L("div",{className:de("flex-1 overflow-hidden flex flex-col",H&&"pointer-events-none opacity-60"),children:e.annex?L(Kn,{assessment:e,isSubmitted:He,setAnswers:S,validationFeedback:re,renderExercise:tt,renderSeparator:nt,primaryColor:I,contained:u,locale:rt(t),contentMaxWidth:N,t:f}):E?L(Xn,{assessment:e,isSubmitted:He,setAnswers:S,validationFeedback:re,renderExercise:tt,renderSeparator:nt,primaryColor:I,contained:u,locale:rt(t),contentMaxWidth:N,t:f,onAddAnnex:E}):L("div",{className:"flex-1 overflow-y-auto",children:L("div",{className:"mx-auto p-6 flex flex-col gap-4",style:{maxWidth:N},children:L(ze,{assessment:e,onAnswersChange:He?void 0:S,validationFeedback:re,renderExercise:tt,renderSeparator:nt,locale:rt(t)})})})}),$&&L("div",{className:"fixed bottom-2 end-3 text-[20px] text-black/20 pointer-events-none select-none z-10",children:f("poweredBy")}),D&&L("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",children:U("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:f("confirmTitle")}),ne>0&&U("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:[L(Si,{size:15,className:"flex-shrink-0 mt-px"}),L("span",{children:ne===1?f("unansweredOne"):f("unansweredMany",{count:ne})})]}),L("p",{className:"text-sm text-[#565b66] mb-5",children:f("confirmDescription")}),U("div",{className:"flex gap-3 justify-end",children:[L("button",{onClick:()=>j(!1),className:"px-4 py-2 text-sm font-medium text-[#565b66] hover:bg-[#f1efe9] rounded-lg transition-colors",children:f("confirmCancel")}),U("button",{onClick:Xe,disabled:P,style:I?{backgroundColor:I}: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:[P?L(sa,{size:14,className:"animate-spin"}):L(oa,{size:14}),f("confirmSubmit")]})]})]})})]})})}function Ot(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 Ii}from"react/jsx-runtime";function Bt(e,r){let t=Ot(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 Wt(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 ga({token:e,data:r,baseUrl:t,options:n}){let{locale:a,branding:o,returnUrl:s,reportLabel:i,backLabel:c,onBack:l,overlayConfig:d,layout:m,mediaHandler:v,onComplete:h,onError:x}=n,u=o??r.branding??void 0,b=a??r.meta.language??"en",k=Ei(()=>Wt(r.assessment),[r]),[g]=Mi(()=>new Date().toISOString()),E=ha(async f=>{let C=await fetch(`${t}/api/v1/embed/submit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:e,answers:f})});if(!C.ok){let I=await C.json().catch(()=>({})),T=typeof I.error=="string"?I.error:"Submission failed",p=C.status===401?"TOKEN_INVALID":C.status===409?"TOKEN_USED":C.status===404?"ASSESSMENT_NOT_FOUND":"UNKNOWN";throw x?.({code:p,message:T}),new Error(T)}let N=await C.json();return h?.(N),Bt(N,s)},[t,e,h,x,s]),y=ha(f=>{if(s)try{let C=new URL(s);C.searchParams.set("submission_id",f.submissionId),f.awaitingManualGrading||(C.searchParams.set("score",String(f.totalScore)),C.searchParams.set("max_score",String(f.maxScore))),window.location.href=C.toString()}catch{window.location.href=s}},[s]);return Ii(vr,{assessment:k,meta:{title:r.meta.title,category:r.meta.category??null},locale:b,branding:u,timeLimitMinutes:r.meta.settings.time_limit_minutes,startedAt:g,onSubmit:E,onViewReport:s?y:void 0,reportLabel:i,onBack:l,backLabel:c,overlayConfig:d,layout:m,mediaHandler:v})}import{useMemo as ba}from"react";import{jsx as Ti}from"react/jsx-runtime";function Li(){return Promise.reject(new Error("A review cannot be submitted"))}function ya({review:e,locale:r,branding:t,layout:n,onBack:a,backLabel:o}){let s=ba(()=>Wt(e.assessment),[e]),i=ba(()=>({answers:e.answers,result:Bt({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 Ti(vr,{assessment:s,meta:{title:e.meta.title,category:e.meta.category??null},locale:c,branding:t??e.branding??void 0,review:i,onSubmit:Li,onBack:a,backLabel:o,layout:n})}import Bu from"react";import{createRoot as qu}from"react-dom/client";var $i="https://edpire.com";function wa(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 ka={mount(e){let{token:r,container:t,baseUrl:n=$i,onError:a}=e,o=typeof t=="string"?document.querySelector(t):t;if(!o){let l={code:"UNKNOWN",message:`Container not found: ${t}`};return a?.(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()=>{o.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(()=>({})),v=typeof m.error=="string"?m.error:"Failed to load assessment",h=d.status===401?"TOKEN_INVALID":d.status===403?"ORIGIN_NOT_ALLOWED":d.status===404?"ASSESSMENT_NOT_FOUND":"UNKNOWN";a?.({code:h,message:v});let x=h==="ORIGIN_NOT_ALLOWED"?`Add ${typeof location<"u"?location.origin:"this origin"} to Allowed Embed Origins in Edpire, under Integrations then Origins.`:"";wa(o,v,x);return}l=await d.json()}catch{a?.({code:"NETWORK_ERROR",message:"Failed to connect to Edpire"}),wa(o,"Failed to connect to Edpire. Please try again.","");return}i||(o.innerHTML="",s=va(o),s.render(xa.createElement(ga,{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 a=va(n);return a.render(xa.createElement(ya,t)),{unmount(){let o=a;a=null,setTimeout(()=>o?.unmount(),0)}}}};import{jsx as Fi}from"react/jsx-runtime";function Di({tokenEndpoint:e,assessmentId:r,tokenBody:t,className:n,style:a,onComplete:o,onError:s,...i}){let c=qt(null),l=qt(o);l.current=o;let d=qt(s);return d.current=s,zi(()=>{let m=c.current;if(!m)return;let v=!1,h=null;return(async()=>{let x;try{let u=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({assessmentId:r,...t})});if(v)return;if(!u.ok){let k=await u.json().catch(()=>({}));d.current?.({code:"TOKEN_INVALID",message:typeof k.error=="string"?k.error:`Token endpoint returned ${u.status}`});return}let b=await u.json();if(!b.token){d.current?.({code:"TOKEN_INVALID",message:"Token endpoint did not return a token"});return}x=b.token}catch{v||d.current?.({code:"NETWORK_ERROR",message:"Failed to fetch embed token"});return}v||(h=ka.mount({token:x,container:m,...i,onComplete:u=>l.current?.(u),onError:u=>d.current?.(u)}))})(),()=>{v=!0,h?.unmount()}},[e,r]),Fi("div",{ref:c,className:n,style:n?void 0:a??{width:"100%",height:"100%"}})}export{vr as AssessmentShell,Di as EdpireAssessmentPlayer,Gn as EdpireQuestion};
65
+ `}),ge("div",{style:{background:r},className:`${c?"absolute":"fixed"} inset-0 z-[60] flex items-center justify-center`,children:Yt("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(Oi,{accent:t});case"pulse":return ge(ji,{accent:t});case"bars":return ge(Bi,{accent:t});default:return ge(Fi,{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{useCallback as Na,useEffect as qi,useMemo as Ca,useRef as pt,useState as Ui}from"react";import{BookOpen as Aa,X as Hi}from"lucide-react";import{Fragment as Gi,jsx as ae,jsxs as Te}from"react/jsx-runtime";function Kt(e){return e.exercises.flatMap((r,t)=>r.sharedContext&&vr(r.sharedContext)?[{id:r.id,index:t,content:r.sharedContext}]:[])}var Ea=()=>typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;function Vi(e){e.removeAttribute("data-flash"),e.offsetWidth,e.setAttribute("data-flash","true"),setTimeout(()=>e.removeAttribute("data-flash"),1200)}function Pa({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]=Ui(!1),b=e.annex,v=b?.tabLabel||l("annexDocuments"),h=Ca(()=>Kt(e),[e]),g=pt(null),w=pt(null),f=pt(null),C=pt(null),u=()=>(g.current?.getClientRects().length??0)>0,y=Na((N,I)=>{let O=N?.querySelector(`[data-reference-for="${CSS.escape(I)}"]`);if(!N||!O)return;let S=O.getBoundingClientRect().top-N.getBoundingClientRect().top+N.scrollTop-12;N.scrollTo({top:S,behavior:Ea()?"auto":"smooth"}),Vi(O)},[]),E=Na(N=>{if(u()){y(w.current,N);return}x(!0),requestAnimationFrame(()=>requestAnimationFrame(()=>y(C.current,N)))},[y]),P=N=>{let I=u()?g.current:f.current;u()||x(!1),Array.from(I?.querySelectorAll(`[data-exercise-id="${CSS.escape(N)}"]`)??[]).find(S=>S.getClientRects().length>0)?.scrollIntoView({behavior:Ea()?"auto":"smooth",block:"start"})};qi(()=>{let N=g.current;if(!N||h.length===0||typeof IntersectionObserver>"u")return;let I=new Set(h.map(M=>M.id)),O=null,S=new IntersectionObserver(M=>{if(!u())return;let $=M.filter(F=>F.isIntersecting&&I.has(F.target.dataset.exerciseId??"")).sort((F,Q)=>F.boundingClientRect.top-Q.boundingClientRect.top)[0]?.target?.dataset.exerciseId;!$||$===O||(O=$,y(w.current,$))},{root:N,rootMargin:"0px 0px -60% 0px"});return N.querySelectorAll("[data-exercise-id]").forEach(M=>S.observe(M)),()=>S.disconnect()},[h,y]);let z=Ca(()=>({label:v,showExerciseReference:E}),[v,E]),k=Te(Gi,{children:[b?.items.map(N=>ae(kr,{item:N},N.id)),b?.items.length&&h.length?ae("div",{className:"border-t border-[#e7e5e0]"}):null,h.map(N=>Te("section",{"data-reference-for":N.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:[ae("button",{type:"button",onClick:()=>P(N.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:l("exercise",{index:N.index+1})}),ae(lt,{content:N.content})]},N.id))]}),m=ae(He,{assessment:e,onAnswersChange:r?void 0:t,validationFeedback:n,renderExercise:a,renderSeparator:o,locale:c});return ae(ot,{value:z,children:Te("div",{className:be("@container flex-1 min-h-0 flex",i&&"relative"),children:[Te("div",{ref:g,className:"hidden @6xl:flex flex-1 gap-4 p-4 bg-[#f5f4f1] items-start overflow-y-auto",children:[Te("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:[Te("div",{className:"flex items-center gap-2 px-5 py-3 border-b border-[#e7e5e0] flex-shrink-0",children:[ae(Aa,{size:14,className:"text-[#8d93a0]"}),ae("span",{className:"text-xs font-bold text-[#565b66] uppercase tracking-widest",children:v})]}),ae("div",{ref:w,className:"flex-1 overflow-y-auto px-6 py-5 flex flex-col gap-6",children:k})]}),ae("div",{className:"w-px bg-[#e7e5e0] flex-shrink-0 self-stretch my-1 rounded-full"}),ae("div",{className:"flex-1 bg-white rounded-[14px] border border-[#e7e5e0] shadow-sm",children:ae("div",{className:"px-6 py-5 flex flex-col gap-4",children:m})})]}),Te("div",{className:"@6xl:hidden flex-1 relative overflow-hidden",children:[ae("div",{ref:f,className:"absolute inset-0 overflow-y-auto",children:ae("div",{className:"mx-auto px-5 py-5 flex flex-col gap-4",style:{maxWidth:d},children:m})}),p&&ae("div",{className:be("inset-0 z-30 bg-black/25",i?"absolute":"fixed"),onClick:()=>x(!1)}),Te("div",{role:"dialog","aria-label":v,"aria-hidden":!p,className:be("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",p?"translate-x-0":"-translate-x-[110%] rtl:translate-x-[110%]"),children:[Te("div",{className:"flex items-center justify-between px-5 py-3 flex-shrink-0",children:[ae("span",{className:"text-sm font-bold text-[#1d2025]",children:v}),ae("button",{onClick:()=>x(!1),"aria-label":l("close"),className:"p-1 text-[#8d93a0] hover:text-[#1d2025] rounded-lg transition-colors",children:ae(Hi,{size:18})})]}),ae("div",{ref:C,className:"overflow-y-auto max-h-[calc(100vh-8rem)] px-5 pb-5 flex flex-col gap-5",children:k})]})]}),!p&&Te("button",{onClick:()=>x(!0),"aria-label":v,style:{transform:"translateY(-50%)",...s?{backgroundColor:s}:{}},className:be("@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:[ae(Aa,{size:12}),ae("span",{style:{writingMode:"vertical-rl",transform:"rotate(180deg)"},children:v})]})]})})}import{useState as Qi}from"react";import{BookOpen as Ma,Plus as Yi,X as Ki}from"lucide-react";import{jsx as ce,jsxs as Ze}from"react/jsx-runtime";function La({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,b]=Qi(!1),v=ce(He,{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:v})});let h=f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),p())},g=f=>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",f?"px-3 py-1.5 text-xs":"mt-1 px-3.5 py-2 text-xs"),children:[ce(Yi,{size:13}),l("annexEmptyCta")]}),w=f=>ce("button",{type:"button",onClick:C=>{C.stopPropagation(),b(!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",f&&"absolute top-2 end-2 z-10"),children:ce(Ki,{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:h,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:[w(!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(Ma,{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:v})})]}),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:h,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(Ma,{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),w(!1)]}),v]})})]})}function Jt(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 Ji=new Set(["choiceSet","inlineChoiceSet","blank","aiAnswerInput","matchingSet","openResponseNode","mathResponse","codingResponse"]),Xi=new Set(["blankPool","inlinePool"]);function Zi(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 ec(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(Ji.has(a)){r+=1;return}if(Xi.has(a))return}o!==void 0&&t(o)};return t(e),r}function Ia(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)Zi(i)&&s.add(i.nodeId)}let n=0;for(let a of e.exercises)for(let o of a.questions){let s=ec(o.content);s!==0&&(t.get(o.id)?.size??0)<s&&(n+=1)}return n}var rc={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"},tc={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"},nc={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"},Xt={en:rc,fr:tc,ar:nc};function ac(e,r,t){let a=(Xt[e]??Xt.en)[r]??Xt.en[r]??r;return t?Object.entries(t).reduce((o,[s,i])=>o.replace(`{${s}}`,String(i)),a):a}function Ta(e){return(r,t)=>ac(e,r,t)}function $a(e){return e==="ar"}function mt(e){return e==="en"?"en":"fr"}var za="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 rn,jsx as T,jsxs as B}from"react/jsx-runtime";var pc="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 mc(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 qa(e){let r=e;return typeof r.totalMaxScore=="number"?r.totalMaxScore:(r.answerKeys??[]).reduce((t,n)=>t+(n.scoring?.maxScore??0),0)}function Ba(e){return e.questions.reduce((r,t)=>r+qa(t),0)}function Oe(e){return Number.isInteger(e)?String(e):parseFloat(e.toFixed(2)).toString()}function Ua(e){return e==="full"?"#1f8a4c":e==="partial"?"#c8810e":"#d23b2b"}function uc({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 T("svg",{width:14,height:14,viewBox:"0 0 100 100",fill:"none",stroke:Ua(e),strokeWidth:9,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:T("path",{d:r})})}function fc({score:e,weight:r,t}){if(e){if(e.awaiting)return B("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:[T(pr,{size:11}),t("pendingReview")]});let n=e.m>0&&e.s>=e.m?"full":e.s>0?"partial":"none";return B("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:[T(uc,{outcome:n}),B("span",{className:"font-bold leading-none",style:{fontFamily:'var(--font-hand, "Caveat", cursive)',fontSize:"1.05rem",color:Ua(n)},children:[Oe(e.s)," / ",Oe(e.m)]})]})}return r>0?B("span",{className:"text-xs font-semibold tabular-nums text-[#8d93a0]",children:[Oe(r)," ",t("points")]}):null}function Wa(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 hc(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 gc({timeLimitMinutes:e,startedAt:r,onExpire:t}){let n=e*6e4,a=new Date(r).getTime()+n,[o,s]=ze(()=>Math.max(a-Date.now(),0)),i=nn(t);i.current=t,tn(()=>{if(o<=0){i.current();return}let h=setInterval(()=>{let g=Math.max(a-Date.now(),0);s(g),g<=0&&(clearInterval(h),i.current())},1e3);return()=>clearInterval(h)},[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),b=l%60,v=p>0?`${p}:${String(x).padStart(2,"0")}:${String(b).padStart(2,"0")}`:`${x}:${String(b).padStart(2,"0")}`;return B("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:[T(pr,{size:12}),v]})}function Rr({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:b,onBack:v,backLabel:h,allowReset:g,onReset:w,overlayConfig:f,contained:C=!1,layout:u,onClose:y,mediaHandler:E,onAddAnnex:P,fallbackLogoUrl:z}){let k=$e(()=>Ta(t),[t]),m=$a(t)?"rtl":"ltr",N=u?.maxWidth??za,I=n?.branding?.primaryColor,O=n?.branding?.accentColor,S=n?.branding?.fontFamily,M=n?.branding?.fontUrl,q=n?.branding?.showPoweredBy!==!1;tn(()=>{if(!M||typeof document>"u"||document.querySelector(`link[href="${M}"]`))return;let me=document.createElement("link");me.rel="stylesheet",me.href=M,document.head.appendChild(me)},[M]);let[$,F]=ze(()=>p?.answers??s??{exerciseAnswers:[]}),[Q]=ze(()=>p?new Map:Wa(s)),W=nn(i);W.current=i;let R=dr(Y=>{let me=hc(Y,Q);F(me),W.current?.(me)},[Q]),[_,D]=ze(null);tn(()=>{D(Date.now())},[]);let[H,V]=ze(d&&!p),le=$e(()=>{if(_===null||!a||a<=0||!o)return null;let Y=new Date(o).getTime()+a*6e4-_;return Y>0?Math.max(1,Math.floor(Y/6e4)):null},[_,a,o]),[Z,oe]=ze(!1),[se,ne]=ze(!1),[U,mr]=ze(p?.result??null),Ve=$e(()=>Wa(p?.answers),[p]),[ln,Sr]=ze(null),[ut,dn]=ze(!1),pn=nn(!1),Za=$e(()=>mc(e),[e]),ft=$e(()=>se?Ia(e,$):0,[se,e,$]),mn=$e(()=>e.exercises.reduce((Y,me)=>Y+Ba(me),0),[e]),ht=$e(()=>U?Jt(U.exerciseFeedback):void 0,[U]),un=$e(()=>{if(!U)return{};let Y={};for(let me of U.exerciseFeedback){let Ge=0,je=0,fe=!1;for(let er of me.questions)for(let De of er.nodeResults)Ge+=De.score,je+=De.maxScore,De.status==="awaiting_review"&&(fe=!0);Y[me.exerciseId]={score:Ge,maxScore:je,awaiting:fe}}return Y},[U]),fn=$e(()=>{if(!U)return{};let Y={};for(let me of U.exerciseFeedback)for(let Ge of me.questions){let je=0,fe=0,er=!1;for(let De of Ge.nodeResults)je+=De.score,fe+=De.maxScore,De.status==="awaiting_review"&&(er=!0);Y[Ge.questionId]={score:je,maxScore:fe,awaiting:er}}return Y},[U]),eo=dr(async()=>{oe(!0),Sr(null);try{let Y=await l($);mr(Y),typeof window<"u"&&window.scrollTo({top:0,behavior:"smooth"})}catch(Y){Sr(Y instanceof Error?Y.message:k("confirmCancel"))}finally{oe(!1),ne(!1)}},[$,l,k]),hn=dr(()=>{!U||!x||x(U)},[U,x]),ro=dr(()=>{pn.current||Z||U||(pn.current=!0,dn(!0),ne(!1),typeof document<"u"&&document.activeElement?.blur(),setTimeout(()=>{oe(!0),Sr(null),l($).then(Y=>{mr(Y),typeof window<"u"&&window.scrollTo({top:0,behavior:"smooth"})}).catch(Y=>{Sr(Y instanceof Error?Y.message:"submit_error")}).finally(()=>{oe(!1),dn(!1)})},800))},[$,Z,l,U]),gt=dr((Y,me,Ge)=>{let je=Ba(Y),fe=un[Y.id],er=Y.questions.length>1,De=Fa(me)?Da(me,{renderQuestion:(Cr,yt,no)=>{let Qe=Cr.id,gn=Q.get(Qe),bn={...E?{mediaHandler:E}:{},...p?{initialAnswers:Ve.get(Qe)??[],readOnly:!0}:gn?{initialAnswers:gn}:{}},yn=Object.keys(bn).length>0&&Fa(yt)?Da(yt,bn):yt;if(!er)return T("div",{"data-question-id":Qe,children:yn},Qe);let Ar=fn[Qe],ao=qa(Cr);return B("div",{"data-question-id":Qe,children:[B("div",{className:"flex items-center gap-2.5 mb-3",children:[T("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:no+1})}),T(fc,{score:Ar?{s:Ar.score,m:Ar.maxScore,awaiting:Ar.awaiting}:null,weight:ao,t:k})]}),yn]},Qe)},renderSeparator:Cr=>T("div",{className:"border-t border-[#e7e5e0] my-1"},`qsep-${Cr}`)}):me;return B("div",{"data-exercise-id":Y.id,className:"bg-white rounded-[14px] border border-[#e7e5e0] shadow-sm overflow-hidden",children:[B("div",{className:"flex items-center justify-between px-4 py-2.5 bg-[#f1efe9] border-b border-[#e7e5e0]",style:O?{backgroundColor:O}:void 0,children:[T("span",{className:"text-sm font-bold text-[#1d2025]",children:k("exercise",{index:Ge+1})}),fe?.awaiting?B("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:[T(pr,{size:11}),k("pendingReview")]}):fe?B("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:[Oe(fe.score)," / ",Oe(fe.maxScore)]}):je>0?B("span",{className:"text-xs font-semibold text-[#8d93a0] tabular-nums",children:["/ ",Oe(je)," ",k("points")]}):null]}),T("div",{className:"p-4",children:De})]},Y.id)},[k,un,fn,O,E,p,Ve,Q]),to=$e(()=>Kt(e).length>0,[e]),bt=dr(Y=>B("div",{className:"flex items-center gap-3 py-2",children:[T("div",{className:"flex-1 border-t border-dashed border-[#e7e5e0]"}),T("span",{className:"text-[10px] font-bold text-[#8d93a0] uppercase tracking-widest",children:k("exercise",{index:Y+2})}),T("div",{className:"flex-1 border-t border-dashed border-[#e7e5e0]"})]},`sep-${Y}`),[k]),Ae=U!==null,_r=U?.showVerdict!==!1,Nr=_r?U?.passed?"#1f8a4c":"#d23b2b":"#1d2025";return T("div",{className:"edpire-scope",style:{display:"contents"},children:B("div",{dir:m,className:be("flex flex-col",C?"h-full":"h-dvh"),style:S?{fontFamily:S}:void 0,children:[T(_a,{visible:Z&&!ut,hasAiNodes:Za,text:k("evaluating"),aiText:k("aiEvaluating"),contained:C,...f}),ut&&B("div",{className:be("fixed inset-0 z-50 flex flex-col items-center justify-center gap-3 bg-red-950/80 backdrop-blur-sm",C&&"absolute"),children:[T(pr,{size:40,className:"text-red-300"}),T("p",{className:"text-xl font-black text-white tracking-tight",children:k("timeUp.title")}),T("p",{className:"text-sm text-red-200",children:k("timeUp.submitting")})]}),B("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:O?{backgroundColor:O}:void 0,children:[B("div",{className:"flex items-center gap-3",children:[T("img",{src:n?.logoUrl??z??pc,alt:n?.name??"Edpire",width:24,height:24,loading:"lazy",className:"rounded object-contain"}),B("div",{children:[T("h1",{className:"text-sm font-bold text-[#1d2025]",children:r.title}),T("p",{className:"text-[11px] text-[#8d93a0] capitalize",children:mn>0&&B("span",{className:"ms-2 font-semibold text-[#565b66]",children:["/ ",Oe(mn)," ",k("points")]})})]}),!Ae&&_!==null&&a&&a>0&&o&&T(gc,{timeLimitMinutes:a,startedAt:o,onExpire:ro}),!Ae&&(c==="saving"||c==="saved")&&B("span",{role:"status",className:"hidden sm:inline-flex items-center gap-1 text-[11px] font-medium text-[#8d93a0]",children:[c==="saved"?T(lc,{size:12}):T(Zt,{size:12,className:"animate-spin"}),k(c==="saved"?"answersSaved":"answersSaving")]})]}),B("div",{className:"flex items-center gap-2",children:[g&&B("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:[T(ic,{size:13}),k("reset")]}),(!Ae||p)&&v&&B("button",{onClick:v,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:[T(en,{size:13}),h??k("back")]}),y&&T("button",{onClick:y,className:"p-1.5 text-[#8d93a0] hover:text-[#1d2025] hover:bg-[#f1efe9] rounded-lg transition-colors",children:T(en,{size:15})}),!Ae&&T("button",{onClick:()=>ne(!0),disabled:Z,style:I?{backgroundColor:I}: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?B(rn,{children:[T(Zt,{size:14,className:"animate-spin"}),k("submitting")]}):B(rn,{children:[T(Oa,{size:14}),k("submit")]})})]})]}),ln&&T("div",{className:"flex-shrink-0 bg-[#fdeeec] border-b border-[#f6cfc9] px-4 py-2 text-sm text-[#a32b1e]",children:ln}),!Ae&&c==="failed"&&B("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:[T(dc,{size:15,className:"flex-shrink-0"}),k("answersNotSaved")]}),!Ae&&H&&(Q.size>0||le!==null)&&B("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&&T(pr,{size:15,className:"flex-shrink-0 text-[#565b66]"}),B("span",{className:"flex-1 min-w-0",children:[Q.size>0?k("resumeRestored"):k("resumeFresh"),le!==null&&B(rn,{children:[" ",k("resumeTimeLeft",{minutes:le})]})]}),T("button",{type:"button",onClick:()=>V(!1),"aria-label":k("close"),className:"flex-shrink-0 p-1 rounded-md text-[#8d93a0] hover:text-[#1d2025] hover:bg-[#e7e5e0] transition-colors",children:T(en,{size:14})})]}),Ae&&U&&(U.awaitingManualGrading?T("div",{className:"flex-shrink-0 border-b bg-[#fbf1dc] border-[#f2e2bf]",children:T("div",{className:"mx-auto px-6 py-4",style:{maxWidth:N},children:B("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-4",children:[B("div",{className:"flex items-center gap-2",children:[T(pr,{size:20,className:"text-[#c8810e] flex-shrink-0"}),T("span",{className:"text-sm font-semibold text-[#8a5a08]",children:U.aiPending?k("beingMarked"):k("awaitingReview")})]}),T("div",{className:"hidden sm:block w-px h-8 bg-[#f2e2bf]"}),T("p",{className:"text-sm text-[#8a5a08] flex-1 min-w-0",children:U.aiPending?k("beingMarkedDesc"):k("awaitingReviewDesc")}),x&&B("button",{onClick:hn,style:I?{backgroundColor:I}: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:[T(ja,{size:14}),b??k("viewFullReport")]})]})})}):T("div",{className:be("flex-shrink-0 border-b",_r?U.passed?"bg-[#ecf8f0] border-[#c5e8d1]":"bg-[#fdeeec] border-[#f6cfc9]":"bg-[#f5f4f1] border-[#e7e5e0]"),children:T("div",{className:"mx-auto px-6 py-4",style:{maxWidth:N},children:B("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-4",children:[B("div",{className:"flex items-center gap-2",children:[_r?U.passed?T(oc,{size:20,className:"text-[#1f8a4c] flex-shrink-0"}):T(sc,{size:20,className:"text-[#d23b2b] flex-shrink-0"}):null,T("span",{className:"text-sm font-semibold",style:{color:Nr},children:_r?U.passed?k("assessmentPassed"):k("assessmentNotPassed"):k("yourScore")})]}),T("div",{className:"hidden sm:block w-px h-8 bg-[#e7e5e0]"}),B("div",{className:"flex items-baseline gap-1.5",children:[B("span",{className:"leading-none tabular-nums",style:{fontFamily:'var(--font-hand, "Caveat", cursive)',fontSize:"2rem",color:Nr},children:[Oe(U.totalScore)," / ",Oe(U.maxScore)]}),T("span",{className:"text-sm text-[#8d93a0] font-medium",children:k("points")})]}),B("div",{className:"flex-1 flex items-center gap-3 min-w-0",children:[T("div",{className:"flex-1 h-2 bg-[#e7e5e0] rounded-full overflow-hidden min-w-[80px]",children:T("div",{className:"h-full rounded-full transition-all duration-700",style:{width:`${U.percentage}%`,backgroundColor:Nr}})}),B("span",{className:"text-sm font-bold tabular-nums flex-shrink-0",style:{color:Nr},children:[U.percentage,"%"]})]}),x&&B("button",{onClick:hn,style:I?{backgroundColor:I}: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:[T(ja,{size:14}),b??k("viewFullReport")]})]})})})),T("div",{className:be("flex-1 overflow-hidden flex flex-col",ut&&"pointer-events-none opacity-60"),children:e.annex||to?T(Pa,{assessment:e,isSubmitted:Ae,setAnswers:R,validationFeedback:ht,renderExercise:gt,renderSeparator:bt,primaryColor:I,contained:C,locale:mt(t),contentMaxWidth:N,t:k}):P?T(La,{assessment:e,isSubmitted:Ae,setAnswers:R,validationFeedback:ht,renderExercise:gt,renderSeparator:bt,primaryColor:I,contained:C,locale:mt(t),contentMaxWidth:N,t:k,onAddAnnex:P}):T("div",{className:"flex-1 overflow-y-auto",children:T("div",{className:"mx-auto p-6 flex flex-col gap-4",style:{maxWidth:N},children:T(He,{assessment:e,onAnswersChange:Ae?void 0:R,validationFeedback:ht,renderExercise:gt,renderSeparator:bt,locale:mt(t)})})})}),q&&T("div",{className:"fixed bottom-2 end-3 text-[20px] text-black/20 pointer-events-none select-none z-10",children:k("poweredBy")}),se&&T("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",children:B("div",{className:"bg-white rounded-[14px] shadow-xl p-6 max-w-sm mx-4",children:[T("h3",{className:"text-base font-bold text-[#1d2025] mb-2",children:k("confirmTitle")}),ft>0&&B("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:[T(cc,{size:15,className:"flex-shrink-0 mt-px"}),T("span",{children:ft===1?k("unansweredOne"):k("unansweredMany",{count:ft})})]}),T("p",{className:"text-sm text-[#565b66] mb-5",children:k("confirmDescription")}),B("div",{className:"flex gap-3 justify-end",children:[T("button",{onClick:()=>ne(!1),className:"px-4 py-2 text-sm font-medium text-[#565b66] hover:bg-[#f1efe9] rounded-lg transition-colors",children:k("confirmCancel")}),B("button",{onClick:eo,disabled:Z,style:I?{backgroundColor:I}: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?T(Zt,{size:14,className:"animate-spin"}):T(Oa,{size:14}),k("confirmSubmit")]})]})]})})]})})}function an(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 xc}from"react/jsx-runtime";function on(e,r){let t=an(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 sn(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 Va({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:b,onError:v}=n,h=o??r.branding??void 0,g=a??r.meta.language??"en",w=bc(()=>sn(r.assessment),[r]),[f]=yc(()=>new Date().toISOString()),C=Ha(async y=>{let E=await fetch(`${t}/api/v1/embed/submit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:e,answers:y})});if(!E.ok){let z=await E.json().catch(()=>({})),k=typeof z.error=="string"?z.error:"Submission failed",m=E.status===401?"TOKEN_INVALID":E.status===409?"TOKEN_USED":E.status===404?"ASSESSMENT_NOT_FOUND":"UNKNOWN";throw v?.({code:m,message:k}),new Error(k)}let P=await E.json();return b?.(P),on(P,s)},[t,e,b,v,s]),u=Ha(y=>{if(s)try{let E=new URL(s);E.searchParams.set("submission_id",y.submissionId),y.awaitingManualGrading||(E.searchParams.set("score",String(y.totalScore)),E.searchParams.set("max_score",String(y.maxScore))),window.location.href=E.toString()}catch{window.location.href=s}},[s]);return xc(Rr,{assessment:w,meta:{title:r.meta.title,category:r.meta.category??null},locale:g,branding:h,timeLimitMinutes:r.meta.settings.time_limit_minutes,startedAt:f,onSubmit:C,onViewReport:s?u:void 0,reportLabel:i,onBack:d,backLabel:c,overlayConfig:l,layout:p,mediaHandler:x})}import{useMemo as Ga}from"react";import{jsx as wc}from"react/jsx-runtime";function vc(){return Promise.reject(new Error("A review cannot be submitted"))}function Qa({review:e,locale:r,branding:t,layout:n,onBack:a,backLabel:o}){let s=Ga(()=>sn(e.assessment),[e]),i=Ga(()=>({answers:e.answers,result:on({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 wc(Rr,{assessment:s,meta:{title:e.meta.title,category:e.meta.category??null},locale:c,branding:t??e.branding??void 0,review:i,onSubmit:vc,onBack:a,backLabel:o,layout:n})}import $f from"react";import{createRoot as Df}from"react-dom/client";var kc="https://edpire.com";function Ja(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 Xa={mount(e){let{token:r,container:t,baseUrl:n=kc,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",b=l.status===401?"TOKEN_INVALID":l.status===403?"ORIGIN_NOT_ALLOWED":l.status===404?"ASSESSMENT_NOT_FOUND":"UNKNOWN";a?.({code:b,message:x});let v=b==="ORIGIN_NOT_ALLOWED"?`Add ${typeof location<"u"?location.origin:"this origin"} to Allowed Embed Origins in Edpire, under Integrations then Origins.`:"";Ja(o,x,v);return}d=await l.json()}catch{a?.({code:"NETWORK_ERROR",message:"Failed to connect to Edpire"}),Ja(o,"Failed to connect to Edpire. Please try again.","");return}i||(o.innerHTML="",s=Ka(o),s.render(Ya.createElement(Va,{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=Ka(n);return a.render(Ya.createElement(Qa,t)),{unmount(){let o=a;a=null,setTimeout(()=>o?.unmount(),0)}}}};import{jsx as _c}from"react/jsx-runtime";function Sc({tokenEndpoint:e,assessmentId:r,tokenBody:t,className:n,style:a,onComplete:o,onError:s,...i}){let c=cn(null),d=cn(o);d.current=o;let l=cn(s);return l.current=s,Rc(()=>{let p=c.current;if(!p)return;let x=!1,b=null;return(async()=>{let v;try{let h=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({assessmentId:r,...t})});if(x)return;if(!h.ok){let w=await h.json().catch(()=>({}));l.current?.({code:"TOKEN_INVALID",message:typeof w.error=="string"?w.error:`Token endpoint returned ${h.status}`});return}let g=await h.json();if(!g.token){l.current?.({code:"TOKEN_INVALID",message:"Token endpoint did not return a token"});return}v=g.token}catch{x||l.current?.({code:"NETWORK_ERROR",message:"Failed to fetch embed token"});return}x||(b=Xa.mount({token:v,container:p,...i,onComplete:h=>d.current?.(h),onError:h=>l.current?.(h)}))})(),()=>{x=!0,b?.unmount()}},[e,r]),_c("div",{ref:c,className:n,style:n?void 0:a??{width:"100%",height:"100%"}})}export{Rr as AssessmentShell,Sc as EdpireAssessmentPlayer,Sa as EdpireQuestion};