@edpire/sdk 0.14.0 → 0.15.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/CHANGELOG.md +23 -0
- package/README.md +2 -2
- package/dist/core.mjs +1 -1
- package/dist/index.d.mts +13 -0
- package/dist/index.mjs +14 -14
- package/dist/react.d.mts +14 -1
- package/dist/react.mjs +14 -14
- package/dist/umd/index.global.js +162 -162
- package/package.json +3 -3
- package/src/styles/runtime-utilities.css +1 -1
- package/src/styles/shell.css +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import"./chunk-76CZ6Z7T.mjs";import gc from"react";import{createRoot as bc}from"react-dom/client";import{useCallback as dc,useMemo as pc,useState as wm}from"react";import{cloneElement as Zi,isValidElement as ec,useCallback as Je,useEffect as zn,useMemo as Le,useRef as _t,useState as Ve}from"react";import{jsx as Zt}from"react/jsx-runtime";import{useEffect as sa,useMemo as gu,useRef as bu}from"react";import Pc from"mitt";var lt=class{constructor(){this.emitter=Pc(),this.answers=new Map}emit(t){if(t.type==="answer:changed")this.answers.set(t.answer.nodeId,t.answer);else if(t.type==="answers:reset")this.answers.clear();else if(t.type==="answers:prefill")for(let r of t.answers)this.answers.set(r.nodeId,r);this.emitter.emit(t.type,t)}on(t,r){this.emitter.on(t,r)}off(t,r){this.emitter.off(t,r)}getAllAnswers(){return Array.from(this.answers.values())}clearAnswers(){this.answers.clear(),this.emit({type:"answers:reset"})}prefillAnswers(t){this.emit({type:"answers:prefill",answers:t})}submitAnswers(){this.emit({type:"answer:submitted",answers:this.getAllAnswers(),timestamp:Date.now()})}},Oa="__edpireGlobalAnswerBus",ja=globalThis,Wr=ja[Oa]??(ja[Oa]=new lt);import{jsx as Tc}from"react/jsx-runtime";import{createContext as Mc,useContext as Ec}from"react";var Ba="__edpireAnswerBusContext",qa=globalThis,Ha=qa[Ba]??(qa[Ba]=Mc(Wr));function ge(){return Ec(Ha)}function Ur({children:e,bus:t=new lt}){return Tc(Ha.Provider,{value:t,children:e})}import{jsx as we,jsxs as Wt}from"react/jsx-runtime";import{Fragment as wl,useState as cs,useEffect as lo,useMemo as kl}from"react";import dt from"clsx";import{jsx as V,jsxs as rs}from"react/jsx-runtime";import{jsx as $e,jsxs as Jn}from"react/jsx-runtime";import{createContext as Fc,useCallback as Zn,useContext as zc,useEffect as mr,useMemo as Dc,useRef as qt,useState as Mt}from"react";import{Pause as Oc,Play as jc,RotateCcw as Bc}from"lucide-react";import{jsx as Lc}from"react/jsx-runtime";import{createContext as Ic,useContext as Wa}from"react";var Bt={submitButton:"Submit",showHint:"Show hint",clickToRemove:"Click to remove",blankAnswerAria:"Your answer",aiEvaluationInProgress:"AI evaluation in progress\u2026",aiEvaluationInProgressAria:"AI evaluation in progress",shortAnswerPlaceholder:"Short answer\u2026",longAnswerPlaceholder:"Write your answer here\u2026",minWordsLabel:e=>`Min: ${e}`,wordBank:"Word Bank",chooseN:e=>`(choose ${e})`,annexDefaultLabel:"Documents",annexOpen:e=>`Open ${e}`,annexClose:"Close",referenceInPanel:e=>`This exercise's text is in ${e}.`,readReference:"Read it",referenceForExercise:e=>`Exercise ${e}`,choiceLetters:"ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""),tableScrollLeft:"Show the columns on the left",tableScrollRight:"Show the columns on the right",mathChecking:"Checking your answer\u2026",mathCorrect:"Correct",mathIncorrect:"Incorrect",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,t)=>`Grade submitted: ${e} / ${t}`,openResponseRubricTitle:"Rubric",openResponseRubricCriterionPoints:(e,t)=>`${e} / ${t} pts`,openResponseAiSuggestionTitle:"AI Pre-grading Suggestion",openResponseAiSuggestedScore:(e,t)=>`Suggested score: ${e} / ${t}`,openResponseAiEvidence:"Evidence:",openResponseAiApplySuggestion:"Apply suggestion",openResponseStudentAnswerTitle:"Student answer",audioPlay:"Play",audioPause:"Pause",audioReplay:"Play again",audioSpeed:e=>`Speed ${e}`,audioRate:e=>`${e}\xD7`,audioPosition:"Position in the audio",audioTimeOf:(e,t)=>`${e} of ${t}`,audioPlaysLeft:e=>e===1?"1 play left":`${e} plays left`,audioNoPlaysLeft:"No plays left",audioUnavailable:"This audio can't be played.",recorderUpTo:e=>`Up to ${e}`,recorderRecord:"Record",recorderRecordingAria:"Recording",recorderSaving:e=>`Saving ${e}%`,recorderSaved:"Saved",recorderRecordAgain:"Record again",recorderCancel:"Cancel",recorderFailed:"Your recording wasn't saved. Check your connection.",recorderRetry:"Try again",recorderUnsupported:"This browser can't record. Try an up-to-date Chrome, Safari or Firefox.",recorderUnavailableHere:"Recording isn't available here.",recorderNone:"No recording",sheetToolsAria:"Write your answer",sheetKeysAria:"Maths keys",sheetMoreKeys:"More",sheetKeyPower:"Squared",sheetKeyFraction:"Fraction",sheetKeyRoot:"Square root",sheetKeyPi:"Pi",sheetKeyLe:"Less than or equal to",sheetKeyGe:"Greater than or equal to",sheetKeyNe:"Not equal to",sheetKeyIn:"Belongs to",sheetFormulaUnwrap:"Back to text",sheetKeyboardClose:"Close the maths keyboard",sheetPhoto:"Photo of my copy",sheetHandwriting:"Write by hand",sheetPlaceholder:"Write your answer here, maths included: x^2, 1/2 or sqrt become x\xB2, \xBD, \u221A.",sheetClose:"Close",sheetPhotoTitle:"Photo of your copy",sheetPhotoPhoneHelp:"Scan this code with your phone and take photos of your copy. They will appear here.",sheetPhotoOr:"Or",sheetPhotoUpload:"Upload a photo",sheetPhotoWebcam:"Use this computer's camera",sheetPhotoTake:"Take a photo",sheetPhotoGallery:"Choose a photo",sheetPhotoShoot:"Take the photo",sheetPhotoReading:"Reading your copy\u2026",sheetPhotoCheck:"Check what was read and correct it before you submit.",sheetPhotoFailed:"We couldn't read this photo. Try again with more light, or type your answer.",sheetPhotoCameraFailed:"The camera didn't open. Upload a photo instead.",sheetPhotoRetry:"Try again",sheetPhotoYours:"Your photo",sheetPhotoRemove:"Remove this photo",sheetPadTitle:"Write a formula by hand",sheetPadHelp:"Write here with your finger or a pen.",sheetPadFailed:"Not recognised. Write a little bigger, or type it with the keys.",sheetPadUndo:"Undo",sheetPadClear:"Clear",sheetPadInsert:"Insert"};var Kr={submitButton:"Valider",showHint:"Voir l'indice",clickToRemove:"Cliquer pour retirer",blankAnswerAria:"Votre r\xE9ponse",aiEvaluationInProgress:"\xC9valuation IA en cours\u2026",aiEvaluationInProgressAria:"\xC9valuation IA en cours",shortAnswerPlaceholder:"R\xE9ponse courte\u2026",longAnswerPlaceholder:"\xC9crivez votre 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(""),tableScrollLeft:"Voir les colonnes de gauche",tableScrollRight:"Voir les colonnes de droite",mathChecking:"V\xE9rification de votre r\xE9ponse\u2026",mathCorrect:"Juste",mathIncorrect:"Faux",openResponseTextPlaceholder:"\xC9crivez votre r\xE9ponse ici\u2026",openResponseWords:"mots",openResponseChars:"car.",openResponseDropZoneLabel:"Glissez-d\xE9posez 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 ou \xE0 la cam\xE9ra refus\xE9. Autorisez-le dans les r\xE9glages 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,t)=>`Note envoy\xE9e : ${e} / ${t}`,openResponseRubricTitle:"Grille d'\xE9valuation",openResponseRubricCriterionPoints:(e,t)=>`${e} / ${t} pts`,openResponseAiSuggestionTitle:"Suggestion de correction par IA",openResponseAiSuggestedScore:(e,t)=>`Score sugg\xE9r\xE9 : ${e} / ${t}`,openResponseAiEvidence:"Extrait :",openResponseAiApplySuggestion:"Appliquer la suggestion",openResponseStudentAnswerTitle:"R\xE9ponse de l'\xE9l\xE8ve",audioPlay:"\xC9couter",audioPause:"Pause",audioReplay:"R\xE9\xE9couter",audioSpeed:e=>`Vitesse ${e}`,audioRate:e=>`${String(e).replace(".",",")}\xD7`,audioPosition:"Position dans l'audio",audioTimeOf:(e,t)=>`${e} sur ${t}`,audioPlaysLeft:e=>e===1?"1 \xE9coute restante":`${e} \xE9coutes restantes`,audioNoPlaysLeft:"Plus d'\xE9coute restante",audioUnavailable:"Impossible de lire cet audio.",recorderUpTo:e=>`Jusqu'\xE0 ${e}`,recorderRecord:"Enregistrer",recorderRecordingAria:"Enregistrement en cours",recorderSaving:e=>`Envoi ${e}\u202F%`,recorderSaved:"Enregistr\xE9",recorderRecordAgain:"Recommencer",recorderCancel:"Annuler",recorderFailed:"Votre enregistrement n'a pas \xE9t\xE9 envoy\xE9. V\xE9rifiez votre connexion.",recorderRetry:"R\xE9essayer",recorderUnsupported:"Ce navigateur ne peut pas enregistrer. Essayez Chrome, Safari ou Firefox \xE0 jour.",recorderUnavailableHere:"L'enregistrement n'est pas disponible ici.",recorderNone:"Aucun enregistrement",sheetToolsAria:"R\xE9diger votre r\xE9ponse",sheetKeysAria:"Touches de maths",sheetMoreKeys:"Plus",sheetKeyPower:"Au carr\xE9",sheetKeyFraction:"Fraction",sheetKeyRoot:"Racine carr\xE9e",sheetKeyPi:"Pi",sheetKeyLe:"Inf\xE9rieur ou \xE9gal \xE0",sheetKeyGe:"Sup\xE9rieur ou \xE9gal \xE0",sheetKeyNe:"Diff\xE9rent de",sheetKeyIn:"Appartient \xE0",sheetFormulaUnwrap:"Remettre en texte",sheetKeyboardClose:"Fermer le clavier de maths",sheetPhoto:"Photo de ma copie",sheetHandwriting:"\xC9crire \xE0 la main",sheetPlaceholder:"R\xE9digez votre r\xE9ponse ici, maths comprises : x^2, 1/2 ou sqrt deviennent x\xB2, \xBD, \u221A.",sheetClose:"Fermer",sheetPhotoTitle:"Photo de votre copie",sheetPhotoPhoneHelp:"Scannez ce code avec votre t\xE9l\xE9phone et photographiez votre copie. Les photos appara\xEEtront ici.",sheetPhotoOr:"Ou",sheetPhotoUpload:"T\xE9l\xE9verser une photo",sheetPhotoWebcam:"Utiliser la cam\xE9ra de cet ordinateur",sheetPhotoTake:"Prendre une photo",sheetPhotoGallery:"Choisir une photo",sheetPhotoShoot:"Prendre la photo",sheetPhotoReading:"Lecture de votre copie\u2026",sheetPhotoCheck:"V\xE9rifiez ce qui a \xE9t\xE9 lu et corrigez-le avant d'envoyer.",sheetPhotoFailed:"Impossible de lire cette photo. R\xE9essayez avec plus de lumi\xE8re, ou tapez votre r\xE9ponse.",sheetPhotoCameraFailed:"La cam\xE9ra ne s'est pas ouverte. T\xE9l\xE9versez plut\xF4t une photo.",sheetPhotoRetry:"R\xE9essayer",sheetPhotoYours:"Votre photo",sheetPhotoRemove:"Retirer cette photo",sheetPadTitle:"\xC9crire une formule \xE0 la main",sheetPadHelp:"\xC9crivez ici avec le doigt ou un stylet.",sheetPadFailed:"Non reconnu. \xC9crivez un peu plus grand, ou tapez-la avec les touches.",sheetPadUndo:"Annuler",sheetPadClear:"Effacer",sheetPadInsert:"Ins\xE9rer"};var Vr={submitButton:"\u0625\u0631\u0633\u0627\u0644",showHint:"\u0625\u0638\u0647\u0627\u0631 \u0627\u0644\u062A\u0644\u0645\u064A\u062D",clickToRemove:"\u0627\u0646\u0642\u0631 \u0644\u0644\u0625\u0632\u0627\u0644\u0629",blankAnswerAria:"\u0625\u062C\u0627\u0628\u062A\u0643",aiEvaluationInProgress:"\u062C\u0627\u0631\u064D \u0627\u0644\u062A\u0642\u064A\u064A\u0645 \u0628\u0627\u0644\u0630\u0643\u0627\u0621 \u0627\u0644\u0627\u0635\u0637\u0646\u0627\u0639\u064A\u2026",aiEvaluationInProgressAria:"\u062C\u0627\u0631\u064D \u0627\u0644\u062A\u0642\u064A\u064A\u0645 \u0628\u0627\u0644\u0630\u0643\u0627\u0621 \u0627\u0644\u0627\u0635\u0637\u0646\u0627\u0639\u064A",shortAnswerPlaceholder:"\u0625\u062C\u0627\u0628\u0629 \u0642\u0635\u064A\u0631\u0629\u2026",longAnswerPlaceholder:"\u0627\u0643\u062A\u0628 \u0625\u062C\u0627\u0628\u062A\u0643 \u0647\u0646\u0627\u2026",minWordsLabel:e=>`\u0627\u0644\u062D\u062F \u0627\u0644\u0623\u062F\u0646\u0649: ${e}`,wordBank:"\u0628\u0646\u0643 \u0627\u0644\u0643\u0644\u0645\u0627\u062A",chooseN:e=>`(\u0627\u062E\u062A\u0631 ${e})`,annexDefaultLabel:"\u0627\u0644\u0645\u0633\u062A\u0646\u062F\u0627\u062A",annexOpen:e=>`\u0641\u062A\u062D ${e}`,annexClose:"\u0625\u063A\u0644\u0627\u0642",referenceInPanel:e=>`\u0646\u0635 \u0647\u0630\u0627 \u0627\u0644\u062A\u0645\u0631\u064A\u0646 \u0641\u064A \xAB${e}\xBB.`,readReference:"\u0627\u0642\u0631\u0623\u0647",referenceForExercise:e=>`\u0627\u0644\u062A\u0645\u0631\u064A\u0646 ${e}`,choiceLetters:["\u0623","\u0628","\u062C","\u062F","\u0647\u0640","\u0648","\u0632","\u062D","\u0637","\u064A","\u0643","\u0644","\u0645","\u0646","\u0633","\u0639","\u0641","\u0635","\u0642","\u0631","\u0634","\u062A","\u062B","\u062E","\u0630","\u0636","\u0638","\u063A"],tableScrollLeft:"\u0625\u0638\u0647\u0627\u0631 \u0627\u0644\u0623\u0639\u0645\u062F\u0629 \u0639\u0644\u0649 \u0627\u0644\u064A\u0633\u0627\u0631",tableScrollRight:"\u0625\u0638\u0647\u0627\u0631 \u0627\u0644\u0623\u0639\u0645\u062F\u0629 \u0639\u0644\u0649 \u0627\u0644\u064A\u0645\u064A\u0646",mathChecking:"\u062C\u0627\u0631\u064D \u0627\u0644\u062A\u062D\u0642\u0642 \u0645\u0646 \u0625\u062C\u0627\u0628\u062A\u0643\u2026",mathCorrect:"\u0635\u062D\u064A\u062D",mathIncorrect:"\u062E\u0637\u0623",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,t)=>`\u062A\u0645 \u0627\u0639\u062A\u0645\u0627\u062F \u0627\u0644\u062F\u0631\u062C\u0629: ${e} / ${t}`,openResponseRubricTitle:"\u0633\u0644\u0651\u0645 \u0627\u0644\u062A\u0635\u062D\u064A\u062D",openResponseRubricCriterionPoints:(e,t)=>`${e} / ${t} \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,t)=>`\u0627\u0644\u062F\u0631\u062C\u0629 \u0627\u0644\u0645\u0642\u062A\u0631\u062D\u0629: ${e} / ${t}`,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",audioPlay:"\u062A\u0634\u063A\u064A\u0644",audioPause:"\u0625\u064A\u0642\u0627\u0641 \u0645\u0624\u0642\u062A",audioReplay:"\u0625\u0639\u0627\u062F\u0629 \u0627\u0644\u0627\u0633\u062A\u0645\u0627\u0639",audioSpeed:e=>`\u0627\u0644\u0633\u0631\u0639\u0629 ${e}`,audioRate:e=>`${e}\xD7`,audioPosition:"\u0627\u0644\u0645\u0648\u0636\u0639 \u0641\u064A \u0627\u0644\u062A\u0633\u062C\u064A\u0644 \u0627\u0644\u0635\u0648\u062A\u064A",audioTimeOf:(e,t)=>`${e} \u0645\u0646 ${t}`,audioPlaysLeft:e=>e===1?"\u0628\u0642\u064A \u0627\u0633\u062A\u0645\u0627\u0639 \u0648\u0627\u062D\u062F":e===2?"\u0628\u0642\u064A \u0627\u0633\u062A\u0645\u0627\u0639\u0627\u0646":`\u0628\u0642\u064A\u062A ${e} \u0627\u0633\u062A\u0645\u0627\u0639\u0627\u062A`,audioNoPlaysLeft:"\u0644\u0645 \u064A\u0628\u0642 \u0623\u064A \u0627\u0633\u062A\u0645\u0627\u0639",audioUnavailable:"\u062A\u0639\u0630\u0631 \u062A\u0634\u063A\u064A\u0644 \u0647\u0630\u0627 \u0627\u0644\u062A\u0633\u062C\u064A\u0644 \u0627\u0644\u0635\u0648\u062A\u064A.",recorderUpTo:e=>`\u062D\u062A\u0649 ${e}`,recorderRecord:"\u062A\u0633\u062C\u064A\u0644",recorderRecordingAria:"\u062C\u0627\u0631\u064D \u0627\u0644\u062A\u0633\u062C\u064A\u0644",recorderSaving:e=>`\u062C\u0627\u0631\u064D \u0627\u0644\u0625\u0631\u0633\u0627\u0644 ${e}\u066A`,recorderSaved:"\u062A\u0645 \u0627\u0644\u062D\u0641\u0638",recorderRecordAgain:"\u0625\u0639\u0627\u062F\u0629 \u0627\u0644\u062A\u0633\u062C\u064A\u0644",recorderCancel:"\u0625\u0644\u063A\u0627\u0621",recorderFailed:"\u0644\u0645 \u064A\u062A\u0645 \u0625\u0631\u0633\u0627\u0644 \u062A\u0633\u062C\u064A\u0644\u0643. \u062A\u062D\u0642\u0642 \u0645\u0646 \u0627\u062A\u0635\u0627\u0644\u0643.",recorderRetry:"\u0625\u0639\u0627\u062F\u0629 \u0627\u0644\u0645\u062D\u0627\u0648\u0644\u0629",recorderUnsupported:"\u0644\u0627 \u064A\u0645\u0643\u0646 \u0644\u0647\u0630\u0627 \u0627\u0644\u0645\u062A\u0635\u0641\u062D \u0627\u0644\u062A\u0633\u062C\u064A\u0644. \u062C\u0631\u0651\u0628 \u0625\u0635\u062F\u0627\u0631\u064B\u0627 \u062D\u062F\u064A\u062B\u064B\u0627 \u0645\u0646 Chrome \u0623\u0648 Safari \u0623\u0648 Firefox.",recorderUnavailableHere:"\u0627\u0644\u062A\u0633\u062C\u064A\u0644 \u063A\u064A\u0631 \u0645\u062A\u0627\u062D \u0647\u0646\u0627.",recorderNone:"\u0644\u0627 \u064A\u0648\u062C\u062F \u062A\u0633\u062C\u064A\u0644",sheetToolsAria:"\u062D\u0631\u0651\u0631 \u0625\u062C\u0627\u0628\u062A\u0643",sheetKeysAria:"\u0645\u0641\u0627\u062A\u064A\u062D \u0627\u0644\u0631\u064A\u0627\u0636\u064A\u0627\u062A",sheetMoreKeys:"\u0627\u0644\u0645\u0632\u064A\u062F",sheetKeyPower:"\u0645\u0631\u0628\u0651\u0639",sheetKeyFraction:"\u0643\u0633\u0631",sheetKeyRoot:"\u062C\u0630\u0631 \u062A\u0631\u0628\u064A\u0639\u064A",sheetKeyPi:"\u0628\u0627\u064A",sheetKeyLe:"\u0623\u0635\u063A\u0631 \u0645\u0646 \u0623\u0648 \u064A\u0633\u0627\u0648\u064A",sheetKeyGe:"\u0623\u0643\u0628\u0631 \u0645\u0646 \u0623\u0648 \u064A\u0633\u0627\u0648\u064A",sheetKeyNe:"\u0644\u0627 \u064A\u0633\u0627\u0648\u064A",sheetKeyIn:"\u064A\u0646\u062A\u0645\u064A \u0625\u0644\u0649",sheetFormulaUnwrap:"\u0625\u0631\u062C\u0627\u0639\u0647\u0627 \u0646\u0635\u064B\u0651\u0627",sheetKeyboardClose:"\u0625\u063A\u0644\u0627\u0642 \u0644\u0648\u062D\u0629 \u0645\u0641\u0627\u062A\u064A\u062D \u0627\u0644\u0631\u064A\u0627\u0636\u064A\u0627\u062A",sheetPhoto:"\u0635\u0648\u0631\u0629 \u0648\u0631\u0642\u062A\u064A",sheetHandwriting:"\u0627\u0644\u0643\u062A\u0627\u0628\u0629 \u0628\u0627\u0644\u064A\u062F",sheetPlaceholder:"\u0627\u0643\u062A\u0628 \u0625\u062C\u0627\u0628\u062A\u0643 \u0647\u0646\u0627 \u0645\u0639 \u0627\u0644\u0631\u064A\u0627\u0636\u064A\u0627\u062A: x^2 \u06481/2 \u0648sqrt \u062A\u0635\u0628\u062D x\xB2 \u0648\xBD \u0648\u221A.",sheetClose:"\u0625\u063A\u0644\u0627\u0642",sheetPhotoTitle:"\u0635\u0648\u0631\u0629 \u0648\u0631\u0642\u062A\u0643",sheetPhotoPhoneHelp:"\u0627\u0645\u0633\u062D \u0647\u0630\u0627 \u0627\u0644\u0631\u0645\u0632 \u0628\u0647\u0627\u062A\u0641\u0643 \u0648\u0635\u0648\u0651\u0631 \u0648\u0631\u0642\u062A\u0643. \u0633\u062A\u0638\u0647\u0631 \u0627\u0644\u0635\u0648\u0631 \u0647\u0646\u0627.",sheetPhotoOr:"\u0623\u0648",sheetPhotoUpload:"\u062A\u062D\u0645\u064A\u0644 \u0635\u0648\u0631\u0629",sheetPhotoWebcam:"\u0627\u0633\u062A\u0639\u0645\u0627\u0644 \u0643\u0627\u0645\u064A\u0631\u0627 \u0647\u0630\u0627 \u0627\u0644\u062D\u0627\u0633\u0648\u0628",sheetPhotoTake:"\u0627\u0644\u062A\u0642\u0627\u0637 \u0635\u0648\u0631\u0629",sheetPhotoGallery:"\u0627\u062E\u062A\u064A\u0627\u0631 \u0635\u0648\u0631\u0629",sheetPhotoShoot:"\u0627\u0644\u062A\u0642\u0637 \u0627\u0644\u0635\u0648\u0631\u0629",sheetPhotoReading:"\u062C\u0627\u0631\u064D \u0642\u0631\u0627\u0621\u0629 \u0648\u0631\u0642\u062A\u0643\u2026",sheetPhotoCheck:"\u0631\u0627\u062C\u0639 \u0645\u0627 \u062A\u0645\u0651\u062A \u0642\u0631\u0627\u0621\u062A\u0647 \u0648\u0635\u062D\u0651\u062D\u0647 \u0642\u0628\u0644 \u0627\u0644\u0625\u0631\u0633\u0627\u0644.",sheetPhotoFailed:"\u062A\u0639\u0630\u0651\u0631\u062A \u0642\u0631\u0627\u0621\u0629 \u0647\u0630\u0647 \u0627\u0644\u0635\u0648\u0631\u0629. \u0623\u0639\u062F \u0627\u0644\u0645\u062D\u0627\u0648\u0644\u0629 \u0645\u0639 \u0625\u0636\u0627\u0621\u0629 \u0623\u0641\u0636\u0644\u060C \u0623\u0648 \u0627\u0643\u062A\u0628 \u0625\u062C\u0627\u0628\u062A\u0643.",sheetPhotoCameraFailed:"\u0644\u0645 \u062A\u064F\u0641\u062A\u062D \u0627\u0644\u0643\u0627\u0645\u064A\u0631\u0627. \u062D\u0645\u0651\u0644 \u0635\u0648\u0631\u0629 \u0628\u062F\u0644\u064B\u0627 \u0645\u0646 \u0630\u0644\u0643.",sheetPhotoRetry:"\u0625\u0639\u0627\u062F\u0629 \u0627\u0644\u0645\u062D\u0627\u0648\u0644\u0629",sheetPhotoYours:"\u0635\u0648\u0631\u062A\u0643",sheetPhotoRemove:"\u062D\u0630\u0641 \u0647\u0630\u0647 \u0627\u0644\u0635\u0648\u0631\u0629",sheetPadTitle:"\u0643\u062A\u0627\u0628\u0629 \u0635\u064A\u063A\u0629 \u0628\u0627\u0644\u064A\u062F",sheetPadHelp:"\u0627\u0643\u062A\u0628 \u0647\u0646\u0627 \u0628\u0625\u0635\u0628\u0639\u0643 \u0623\u0648 \u0628\u0642\u0644\u0645.",sheetPadFailed:"\u0644\u0645 \u064A\u062A\u0645\u0651 \u0627\u0644\u062A\u0639\u0631\u0651\u0641 \u0639\u0644\u064A\u0647\u0627. \u0627\u0643\u062A\u0628 \u0628\u062E\u0637 \u0623\u0643\u0628\u0631 \u0642\u0644\u064A\u0644\u064B\u0627\u060C \u0623\u0648 \u0627\u0643\u062A\u0628\u0647\u0627 \u0628\u0627\u0644\u0645\u0641\u0627\u062A\u064A\u062D.",sheetPadUndo:"\u062A\u0631\u0627\u062C\u0639",sheetPadClear:"\u0645\u0633\u062D",sheetPadInsert:"\u0625\u062F\u0631\u0627\u062C"};var $c={en:Bt,fr:Kr,ar:Vr},Xn=Ic(null);function re(){return Wa(Xn)??Bt}function pr(e){let t=Wa(Xn);return e&&$c[e]||t||Bt}function ur({locale:e,children:t}){let r=pr(e);return Lc(Xn.Provider,{value:r,children:t})}var Ua=Fc(null);function Gr({initial:e,onChange:t,children:r}){let n=qt({...e??{}}),o=qt(t);o.current=t;let a=Dc(()=>({get:s=>n.current[s]??0,set:(s,i)=>{n.current={...n.current,[s]:i},o.current?.(n.current)}}),[]);return $e(Ua.Provider,{value:a,children:r})}var eo=[.75,1,1.25,1.5],to=.5;function Ht(e){if(!Number.isFinite(e)||e<0)return"0:00";let t=Math.round(e);return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`}var ro="edpire:audio-play";function rt({src:e,maxPlays:t,learnerSpeed:r,speed:n,allowSeek:o,durationHint:a,playsKey:s,playsUsed:i,onPlaysUsedChange:c,disabled:l=!1,label:p,className:f}){let m=re(),h=zc(Ua),d=s??e,u=t&&t>0?Math.floor(t):0,S=o!==!1,R=r!==!1,k=n&&n>=.25&&n<=4?n:1,C=qt(null),v=qt(null),[N,w]=Mt(!1),[x,y]=Mt(0),[T,g]=Mt(a&&a>0?a:0),[P,A]=Mt(!1),[W,b]=Mt(!1),[M,$]=Mt(k),[B,J]=Mt(()=>i??h?.get(d)??0),Y=qt(!1),Q=qt(!1);mr(()=>{i!==void 0&&J(i)},[i]),mr(()=>$(k),[k]),mr(()=>{C.current&&(C.current.playbackRate=M)},[M]),mr(()=>{b(!1),A(!1),y(0),w(!1),Y.current=!1,a&&a>0||g(0);let H=C.current;H&&H.readyState>=1&&Number.isFinite(H.duration)&&H.duration>0&&g(H.duration)},[e]),mr(()=>{let H=ee=>{let te=C.current;te&&ee.detail!==te&&!te.paused&&te.pause()};return window.addEventListener(ro,H),()=>window.removeEventListener(ro,H)},[]);let ve=u>0&&B>=u&&!Y.current,L=u>0?Math.max(0,u-B):null,_=l||W||ve,q=Zn(()=>{if(u===0)return!0;if(B>=u)return!1;let H=B+1;return J(H),Y.current=!0,i===void 0&&h?.set(d,H),c?.(H),!0},[u,B,i,h,d,c]),z=Zn(()=>{let H=C.current;if(!H||l||W)return;if(!H.paused){H.pause();return}(P||H.currentTime<to)&&!Y.current&&!q()||((P||H.currentTime>=(H.duration||1/0))&&(H.currentTime=0),A(!1),H.playbackRate=M,window.dispatchEvent(new CustomEvent(ro,{detail:H})),H.play().catch(()=>w(!1)))},[l,W,P,q,M]),O=T>0?T:0,ne=O>0?Math.min(1,x/O):0,ce=Zn(H=>{let ee=C.current;if(!ee||!S||_||O===0)return;let te=Math.max(0,Math.min(O,H));if(u>0&&te<to&&x>=to&&Y.current&&(Y.current=!1,!ee.paused&&!q())){ee.pause();return}ee.currentTime=te,y(te),A(!1)},[S,_,O,u,x,q]),le=H=>{let ee=v.current;if(!ee)return 0;let te=ee.getBoundingClientRect(),je=getComputedStyle(ee).direction==="rtl"?(te.right-H)/te.width:(H-te.left)/te.width;return Math.max(0,Math.min(1,je))},ue=H=>{!S||_||O===0||(H.preventDefault(),Q.current=!0,H.currentTarget.setPointerCapture(H.pointerId),ce(le(H.clientX)*O))},U=H=>{Q.current&&ce(le(H.clientX)*O)},X=()=>{Q.current=!1},me=H=>{if(!S||_||O===0)return;let ee=v.current?getComputedStyle(v.current).direction==="rtl":!1,te=5,pe=null;H.key==="ArrowRight"?pe=x+(ee?-te:te):H.key==="ArrowLeft"?pe=x+(ee?te:-te):H.key==="ArrowUp"?pe=x+te:H.key==="ArrowDown"?pe=x-te:H.key==="Home"?pe=0:H.key==="End"&&(pe=O),pe!==null&&(H.preventDefault(),ce(pe))},ae=()=>{let H=eo.indexOf(M);$(eo[(H+1)%eo.length]??1)},oe=(N||x>0)&&!P&&O>0,de=Ht(oe?O-x:O),Te=N?$e(Oc,{size:18,fill:"currentColor",strokeWidth:0,"aria-hidden":!0}):P&&!ve?$e(Bc,{size:18,"aria-hidden":!0}):$e(jc,{size:18,fill:"currentColor",strokeWidth:0,"aria-hidden":!0,style:{marginInlineStart:2}}),Ze=N?m.audioPause:P?m.audioReplay:m.audioPlay;return Jn("span",{role:"group","aria-label":p,className:`edp-audio${_?" edp-audio--off":""}${f?` ${f}`:""}`,"data-audio-player":"",children:[Jn("span",{className:"edp-audio-bar",children:[$e("button",{type:"button",className:"edp-audio-play",onClick:z,disabled:_,"aria-label":Ze,children:Te}),Jn("span",{ref:v,className:`edp-audio-track${S&&!_?" edp-audio-track--seek":""}`,role:"slider",tabIndex:S&&!_?0:-1,"aria-label":m.audioPosition,"aria-valuemin":0,"aria-valuemax":Math.round(O),"aria-valuenow":Math.round(x),"aria-valuetext":m.audioTimeOf(Ht(x),Ht(O)),"aria-disabled":!S||_,onPointerDown:ue,onPointerMove:U,onPointerUp:X,onPointerCancel:X,onKeyDown:me,children:[$e("span",{className:"edp-audio-rail",children:$e("span",{className:"edp-audio-fill",style:{width:`${ne*100}%`}})}),S&&!_&&O>0&&$e("span",{className:"edp-audio-thumb",style:{insetInlineStart:`${ne*100}%`}})]}),$e("span",{className:"edp-audio-time",dir:"ltr",children:de}),R&&!W&&$e("button",{type:"button",className:"edp-audio-speed",dir:"ltr",onClick:ae,disabled:l,"aria-label":m.audioSpeed(m.audioRate(M)),children:m.audioRate(M)})]}),(W||L!==null)&&$e("span",{className:"edp-audio-note","aria-live":"polite",children:$e("bdi",{children:W?m.audioUnavailable:L===0&&!Y.current?m.audioNoPlaysLeft:m.audioPlaysLeft(L??0)})}),$e("audio",{ref:C,src:e||void 0,preload:"metadata",onLoadedMetadata:H=>{let ee=H.currentTarget;ee.playbackRate=M,Number.isFinite(ee.duration)&&ee.duration>0?g(ee.duration):qc(ee,te=>g(pe=>pe>0?pe:te))},onDurationChange:H=>{let ee=H.currentTarget.duration;Number.isFinite(ee)&&ee>0&&g(ee)},onTimeUpdate:H=>{Q.current||y(H.currentTarget.currentTime)},onPlay:()=>w(!0),onPause:()=>w(!1),onEnded:()=>{w(!1),A(!0),Y.current=!1,y(O)},onError:()=>{e&&b(!0)}})]})}function qc(e,t){let r=()=>{e.removeEventListener("timeupdate",r),Number.isFinite(e.duration)&&e.duration>0&&t(e.duration),e.currentTime=0};e.addEventListener("timeupdate",r);try{e.currentTime=1e101}catch{e.removeEventListener("timeupdate",r)}}import Hc from"katex";import"katex/dist/contrib/mhchem.js";var Wc={"\\d":"\\mathrm{d}","\\R":"\\mathbb{R}","\\N":"\\mathbb{N}","\\Z":"\\mathbb{Z}","\\Q":"\\mathbb{Q}","\\C":"\\mathbb{C}"};function Ne(e,t,r=!0){try{return Hc.renderToString(e,{displayMode:t,output:r?"htmlAndMathml":"html",throwOnError:!1,errorColor:"#cc0000",macros:Wc,strict:!1})}catch(n){return`<span class="katex-error" style="color:#cc0000" title="${String(n)}">${e}</span>`}}function F(e){return`calc(${typeof e=="number"?`${e}px`:e} * var(--edp-scale, 1))`}function be(e){return{width:F(e),height:F(e)}}function Ye(e){if(e==null||e==="")return;if(typeof e=="number")return F(e);let t=String(e).trim();return/^\d+(\.\d+)?px$/.test(t)?F(t):t}import{createContext as Uc}from"react";var fr=Uc(!1),Yr="1px solid #d1d5db",Kc="#f3f4f6",Vc="#e3e1dc",Gc="var(--card, #fff)",Et="edp-table-first",Ka={overflowX:"auto",margin:`${F("1.25rem")} 0`},Va={left:!1,right:!1,held:0,rtl:!1};function Ga(e,t,r,n=0){return{left:t.left<e.left-1,right:t.right>e.right+1,held:n,rtl:r}}function Ya(e,t){return Math.max(80,Math.round((e-t)*.8))}var no={borderCollapse:"separate",borderSpacing:0,width:"100%",tableLayout:"auto",fontSize:F("0.875rem"),lineHeight:1.3,borderBlockStart:Yr,borderInlineStart:Yr};function hr(e){let t=e.gray?Vc:e.header?Kc:e.sticky?Gc:void 0;return{borderBlockEnd:Yr,borderInlineEnd:Yr,padding:`${F("4px")} ${F("6px")}`,verticalAlign:"middle",overflowWrap:"normal",wordBreak:"normal",hyphens:"manual",...t?{background:t}:{},...e.header?{fontWeight:600}:{},...e.sticky?{position:"sticky",insetInlineStart:0,zIndex:1}:{}}}function gr(e){return Object.entries(e).map(([t,r])=>`${t.replace(/[A-Z]/g,n=>`-${n.toLowerCase()}`)}:${r}`).join(";")}function oo(e){let t=[],r=new Set,n=[];(e??[]).forEach((s,i)=>{let c=0;(s.content??[]).forEach(l=>{for(;n[i]?.[c];)c++;let p=Math.max(1,l.attrs?.colspan??1),f=Math.max(1,l.attrs?.rowspan??1);for(let m=i;m<i+f;m++){let h=n[m]??(n[m]=[]);for(let d=c;d<c+p;d++)h[d]=!0}for(let m=0;m<p;m++){let h=l.attrs?.colwidth?.[m];h&&t[c+m]==null&&(t[c+m]=h)}c===0&&p===1&&r.add(l),c+=p})});let o=n.reduce((s,i)=>Math.max(s,i.length),0);return{columnWidths:t.some(s=>s!=null)?Array.from({length:o},(s,i)=>t[i]??null):[],stickyCells:r}}function ao(e){return e.replace(/(\d) (?=\d)/g,"$1\xA0").replace(/(\d) (?=[\p{L}%\p{Sc}]{1,3}(?![\p{L}\p{N}]))/gu,"$1\xA0")}import{jsx as nt,jsxs as so}from"react/jsx-runtime";import{useCallback as Yc,useEffect as Qc,useLayoutEffect as Xc,useRef as Jc,useState as Zc}from"react";var el=typeof window<"u"?Xc:Qc;function Qa({side:e}){return nt("svg",{viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2.25",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:nt("path",{d:e==="left"?"M15 6l-6 6 6 6":"M9 6l6 6-6 6"})})}function Xa({children:e}){let t=re(),r=Jc(null),[n,o]=Zc(Va),a=Yc(()=>{let f=r.current,m=f?.querySelector("table");if(!f||!m)return;let h=f.querySelector(`.${Et}`),d=Ga(f.getBoundingClientRect(),m.getBoundingClientRect(),getComputedStyle(f).direction==="rtl",h?h.getBoundingClientRect().width:0);o(u=>u.left===d.left&&u.right===d.right&&u.held===d.held&&u.rtl===d.rtl?u:d)},[]);el(()=>{let f=r.current;if(!f)return;a(),f.addEventListener("scroll",a,{passive:!0});let m=typeof ResizeObserver<"u"?new ResizeObserver(a):null;m?.observe(f);let h=f.querySelector("table");return h&&m?.observe(h),()=>{f.removeEventListener("scroll",a),m?.disconnect()}},[a]);let s=f=>{let m=r.current;m&&m.scrollBy({left:f*Ya(m.clientWidth,n.held),behavior:"smooth"})},i=n.left||n.right,c=f=>i?nt("div",{className:`edp-table-arrows edp-table-arrows--${f}`,children:so("span",{dir:"ltr",className:"edp-table-arrows__pair",children:[nt("button",{type:"button",className:"edp-table-arrow",onClick:()=>s(-1),disabled:!n.left,"aria-label":t.tableScrollLeft,children:nt(Qa,{side:"left"})}),nt("button",{type:"button",className:"edp-table-arrow",onClick:()=>s(1),disabled:!n.right,"aria-label":t.tableScrollRight,children:nt(Qa,{side:"right"})})]})}):null,l=n.rtl?0:n.held,p=n.rtl?n.held:0;return so("div",{className:"edp-table-frame",style:{margin:`${F("1.25rem")} 0`},children:[c("top"),so("div",{style:{position:"relative"},children:[nt("div",{ref:r,className:"edp-table-scroll",style:{overflowX:"auto"},children:e}),n.left&&nt("span",{className:"edp-table-shade edp-table-shade--left",style:{left:l},"aria-hidden":"true"}),n.right&&nt("span",{className:"edp-table-shade edp-table-shade--right",style:{right:p},"aria-hidden":"true"})]}),c("bottom")]})}var Ja={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"}},Za={border:"#2563eb",background:"#e0f2fe"},es={border:"#dc2626",background:"#fee2e2"};function tl(e){return{display:"inline-block",verticalAlign:"middle",border:`2px solid ${e?.border||Za.border}`,background:e?.background||Za.background,borderRadius:F("4px"),padding:"0.17em 0.37em"}}function rl(e){let t=e?.shape==="circle"?"50%":"9999px";return{display:"inline-block",verticalAlign:"middle",border:`2px solid ${e?.border||es.border}`,background:e?.background||es.background,borderRadius:t,padding:"0.15em 0.45em"}}function nl(e,t){if(!(!e&&!t))return{...e?{textAlign:e}:{},...t?{margin:0}:{}}}function qe(e,t,r){return V("div",{className:"exercise-content",children:e.content.map((n,o)=>Me(n,`node-${o}`,t,r))})}var ol=/^[\u00a0\u202f ]?[.,;:!?\u2026)\]}\u00bb\u201d\u2019%\u060c\u061b\u061f]+/,al=new Set(["blank","inlineChoiceSet"]);function ts(e,t,r,n){let o=[],a=e??[];for(let s=0;s<a.length;s++){let i=a[s],c=a[s+1],l=al.has(i.type)&&c?.type==="text"?ol.exec(c.text??"")?.[0]:void 0;if(!l||!c){o.push(Me(i,`${t}-${s}`,r,n));continue}let p=(c.text??"").slice(l.length);o.push(rs("span",{style:{whiteSpace:"nowrap"},children:[V("span",{style:{whiteSpace:"normal"},children:Me(i,`${t}-${s}-a`,r,n)}),Me({...c,text:l},`${t}-${s}-p`,r,n)]},`${t}-${s}`)),p&&o.push(Me({...c,text:p},`${t}-${s+1}`,r,n)),s++}return o}function Me(e,t,r,n){switch(e.type){case"choiceSet":case"inlineChoiceSet":return V(Xr,{node:e,validationFeedback:r?.get(e.id)},t);case"blank":return e.attrs.mode==="typed"?V(Jr,{node:e,validationFeedback:r?.get(e.id)},t):V(Zr,{node:e,validationFeedback:r?.get(e.id)},t);case"blankPool":return V(en,{node:e},t);case"inlinePool":return V(tn,{node:e},t);case"matchingSet":return V(rn,{node:e,validationFeedback:r?.get(e.id)},t);case"aiAnswerInput":return V(nn,{node:e,validationFeedback:r?.get(e.id),readOnly:n?.readOnly,mediaHandler:n?.mediaHandler,answerSheetHandler:n?.answerSheetHandler},t);case"openResponseNode":return V(on,{node:e,validationFeedback:r?.get(e.id),readOnly:n?.readOnly,mediaHandler:n?.mediaHandler,answerSheetHandler:n?.answerSheetHandler},t);case"mathResponse":return V(an,{nodeId:e.id,placeholder:e.attrs?.placeholder,hint:e.attrs?.hint,validationFeedback:r?.get(e.id),readOnly:n?.readOnly},t);case"codingResponse":return V(sn,{node:e,validationFeedback:r?.get(e.id),readOnly:n?.readOnly,executor:n?.codeExecutor},t);case"aiEvaluationConfig":return null;case"paragraph":{let o=e.attrs,a=o?.textAlign,s=o?.dir||void 0;return V("p",{dir:s,style:nl(a,n?.inTable),children:ts(e.content,t,r,n)},t)}case"heading":{let o=e.attrs.level??1,a=`h${o}`,s=e.attrs,i=s?.textAlign,c=s?.dir||void 0,l=Ja[o]??Ja[3];return V(a,{dir:c,style:{...l,...i?{textAlign:i}:{}},children:ts(e.content,t,r,n)},t)}case"blockquote":{let o=e.attrs,a=o?.dir||void 0,s=o?.textAlign;return V("blockquote",{dir:a,style:{borderInlineStart:"3px solid #d6d3cc",paddingInlineStart:"1em",margin:"0.75em 0",color:"#565b66",fontStyle:"italic",...s?{textAlign:s}:{}},children:e.content?.map((i,c)=>Me(i,`${t}-${c}`,r,n))},t)}case"text":{let o=e,a=n?.inTable?ao(o.text??""):o.text??"",s=o.marks??[];if(s.length===0)return V("span",{children:a},t);let i={};for(let l of s)l.type==="textStyle"&&(l.attrs?.color&&(i.color=l.attrs.color),l.attrs?.fontSize&&(i.fontSize=l.attrs.fontSize),l.attrs?.fontFamily&&(i.fontFamily=l.attrs.fontFamily));let c=a;for(let l of s)switch(l.type){case"bold":c=V("strong",{children:c});break;case"italic":c=V("em",{children:c});break;case"underline":c=V("u",{children:c});break;case"strike":c=V("s",{children:c});break;case"code":c=V("code",{children:c});break;case"subscript":c=V("sub",{children:c});break;case"superscript":c=V("sup",{children:c});break;case"boxedText":c=V("span",{style:tl(l.attrs),children:c});break;case"circleText":c=V("span",{style:rl(l.attrs),children:c});break}return V("span",{style:Object.keys(i).length>0?i:void 0,children:c},t)}case"hardBreak":return V("br",{},t);case"resizableImage":return V("img",{src:e.attrs?.src||void 0,alt:e.attrs?.alt||"",style:{display:"inline-block",verticalAlign:"middle",width:Ye(e.attrs?.width||void 0)??"auto",height:Ye(e.attrs?.height||void 0)??"auto",maxWidth:"100%"}},t);case"resizableAudio":{let o=e.attrs??{src:""},a=n?.readOnly===!0;return V(rt,{src:o.src||"",maxPlays:a?null:o.maxPlays,learnerSpeed:o.learnerSpeed,speed:o.speed,allowSeek:a?null:o.allowSeek},t)}case"resizableVideo":return V("video",{src:e.attrs?.src||void 0,controls:!0,style:{display:"inline-block",verticalAlign:"middle",width:Ye(e.attrs?.width||void 0)??"auto",height:Ye(e.attrs?.height||void 0)??"auto",maxWidth:"100%"}},t);case"youtubeEmbed":return V("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:Ye(e.attrs?.width||480),height:Ye(e.attrs?.height||270)}},t);case"inlineMath":return V("span",{dir:"ltr",style:{unicodeBidi:"isolate",display:"inline-block"},className:"math-inline",dangerouslySetInnerHTML:{__html:Ne(e.attrs?.latex??"",!1,!0)}},t);case"blockMath":return V("div",{dir:"ltr",style:{unicodeBidi:"isolate",textAlign:"center",margin:"1em 0"},className:"math-block",dangerouslySetInnerHTML:{__html:Ne(e.attrs?.latex??"",!0,!0)}},t);case"variable":return V("span",{className:"variable",children:`{${e.attrs?.name}}`},t);default:{let o=e;if(o.type==="bulletList")return V("ul",{style:{listStyleType:"disc",paddingLeft:"1.5em",margin:"0.5em 0"},children:o.content?.map((a,s)=>Me(a,`${t}-${s}`,r,n))},t);if(o.type==="orderedList")return V("ol",{style:{listStyleType:"decimal",paddingLeft:"1.5em",margin:"0.5em 0"},children:o.content?.map((a,s)=>Me(a,`${t}-${s}`,r,n))},t);if(o.type==="listItem")return V("li",{children:o.content?.map((a,s)=>Me(a,`${t}-${s}`,r,n))},t);if(o.type==="table"){let a=oo(o.content),s={...n,inTable:!0,stickyCells:a.stickyCells};return V(Xa,{children:rs("table",{style:no,children:[a.columnWidths.length>0&&V("colgroup",{children:a.columnWidths.map((i,c)=>V("col",{style:i?{width:F(i)}:void 0},c))}),V("tbody",{children:o.content?.map((i,c)=>Me(i,`${t}-${c}`,r,s))})]})},t)}return o.type==="tableRow"?V("tr",{children:o.content?.map((a,s)=>Me(a,`${t}-${s}`,r,n))},t):o.type==="tableCell"?V("td",{colSpan:o.attrs?.colspan,rowSpan:o.attrs?.rowspan,className:n?.stickyCells?.has(o)?Et:void 0,style:hr({header:!1,gray:!!o.attrs?.gray,sticky:!!n?.stickyCells?.has(o)}),children:V(fr.Provider,{value:!0,children:o.content?.map((a,s)=>Me(a,`${t}-${s}`,r,n))})},t):o.type==="tableHeader"?V("th",{colSpan:o.attrs?.colspan,rowSpan:o.attrs?.rowspan,className:n?.stickyCells?.has(o)?Et:void 0,style:hr({header:!0,gray:!!o.attrs?.gray,sticky:!!n?.stickyCells?.has(o)}),children:V(fr.Provider,{value:!0,children:o.content?.map((a,s)=>Me(a,`${t}-${s}`,r,n))})},t):(console.warn(`Unknown node type during interpretation: ${e.type}`),null)}}}function fe(e,t){return e.map(r=>{if(r.type==="text"){let n=Lt(t?.inTable?ao(r.text??""):r.text??""),o=r.marks??[],a=[];for(let s of o)s.type==="textStyle"&&(s.attrs?.color&&a.push(`color:${s.attrs.color}`),s.attrs?.fontSize&&a.push(`font-size:${s.attrs.fontSize}`),s.attrs?.fontFamily&&a.push(`font-family:${s.attrs.fontFamily}`));a.length>0&&(n=`<span style="${a.join(";")}">${n}</span>`);for(let s of o)switch(s.type){case"bold":n=`<strong>${n}</strong>`;break;case"italic":n=`<em>${n}</em>`;break;case"underline":n=`<u>${n}</u>`;break;case"strike":n=`<s>${n}</s>`;break;case"code":n=`<code>${n}</code>`;break;case"subscript":n=`<sub>${n}</sub>`;break;case"superscript":n=`<sup>${n}</sup>`;break;case"boxedText":{let i=s.attrs?.border||"#2563eb",c=s.attrs?.background||"#e0f2fe";n=`<span style="display:inline-block;vertical-align:middle;border:2px solid ${i};background:${c};border-radius:${F("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(r.type==="paragraph"){let n=r.content?fe(r.content,t):"",o=r.attrs?.dir,a=r.attrs?.textAlign,s=o?` dir="${o}"`:"",i=[a?`text-align:${a}`:"",t?.inTable?"margin:0":""].filter(Boolean).join(";"),c=i?` style="${i}"`:"";return t?.stripParagraphs?n:`<p${s}${c}>${n}</p>`}if(r.type==="hardBreak")return"<br/>";if(r.type==="table"){let n=oo(r.content),o=r.content?fe(r.content,{...t,inTable:!0,stickyCells:n.stickyCells}):"",a=n.columnWidths.length?`<colgroup>${n.columnWidths.map(s=>s?`<col style="width:${F(s)}">`:"<col>").join("")}</colgroup>`:"";return`<div style="${gr(Ka)}"><table style="${gr(no)}">${a}<tbody>${o}</tbody></table></div>`}if(r.type==="tableRow")return`<tr>${r.content?fe(r.content,t):""}</tr>`;if(r.type==="tableCell"){let n=r.content?fe(r.content,t):"",o=r.attrs?.colspan?` colspan="${r.attrs.colspan}"`:"",a=r.attrs?.rowspan?` rowspan="${r.attrs.rowspan}"`:"",s=!!t?.stickyCells?.has(r),i=s?` class="${Et}"`:"";return`<td${o}${a}${i} style="${gr(hr({header:!1,gray:!!r.attrs?.gray,sticky:s}))}">${n}</td>`}if(r.type==="tableHeader"){let n=r.content?fe(r.content,t):"",o=r.attrs?.colspan?` colspan="${r.attrs.colspan}"`:"",a=r.attrs?.rowspan?` rowspan="${r.attrs.rowspan}"`:"",s=!!t?.stickyCells?.has(r),i=s?` class="${Et}"`:"";return`<th${o}${a}${i} style="${gr(hr({header:!0,gray:!!r.attrs?.gray,sticky:s}))}">${n}</th>`}if(r.type==="bulletList")return`<ul style="list-style-type:disc;padding-left:1.5em">${r.content?fe(r.content,t):""}</ul>`;if(r.type==="orderedList")return`<ol style="list-style-type:decimal;padding-left:1.5em">${r.content?fe(r.content,t):""}</ol>`;if(r.type==="listItem")return`<li>${r.content?fe(r.content,t):""}</li>`;if(r.type==="blockquote"){let n=r.content?fe(r.content,t):"";return`<blockquote${r.attrs?.dir?` dir="${r.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(r.type==="resizableImage"){let n=r.attrs??{},o=Qr(n.width),a=Qr(n.height);return`<img src="${Lt(n.src??"")}" alt="${Lt(n.alt??"")}" style="display:inline-block;vertical-align:middle;max-width:100%;${o?`width:${o};`:""}${a?`height:${a};`:""}"/>`}if(r.type==="resizableAudio"){let n=r.attrs??{};return`<audio controls preload="metadata" src="${Lt(n.src??"")}" style="display:inline-block;vertical-align:middle;width:${F("260px")};max-width:100%;height:${F("36px")}"></audio>`}if(r.type==="resizableVideo"){let n=r.attrs??{},o=Qr(n.width),a=Qr(n.height);return`<video src="${Lt(n.src??"")}" controls style="display:inline-block;vertical-align:middle;max-width:100%;${o?`width:${o};`:""}${a?`height:${a};`:""}"></video>`}if(r.type==="youtubeEmbed"){let n=r.attrs??{};return`<iframe src="https://www.youtube.com/embed/${Lt(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:${Ye(n.width||480)};height:${Ye(n.height||270)}"></iframe>`}return r.type==="inlineMath"?`<span dir="ltr" class="math-inline" style="unicode-bidi:isolate;display:inline-block">${Ne(r.attrs?.latex??"",!1,!0)}</span>`:r.type==="blockMath"?`<div dir="ltr" class="math-block" style="unicode-bidi:isolate;text-align:center;margin:1em 0">${Ne(r.attrs?.latex??"",!0,!0)}</div>`:r.type==="variable"?`<span class="variable">{${Lt(r.attrs?.name??"")}}</span>`:""}).join("")}function Qr(e){return e==null||e===""?null:Ye(e)??null}function Lt(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}import{jsx as sl}from"react/jsx-runtime";import{createContext as il,useContext as ns,useMemo as os}from"react";var cl={sm:.875,md:1,lg:1.25,xl:1.5},io=il(null);function ll(e,t){let r={...e??{}};if(t)for(let[n,o]of Object.entries(t))o!==void 0&&(r[n]=o);return r}function dl(e){return typeof e=="number"?Number.isFinite(e)&&e>0?e:1:e?cl[e]??1:1}function He(e){let t=e??{};return{scale:dl(t.size),sizeSet:t.size!==void 0,choiceLabels:t.choiceLabels??"marks",choiceColumns:t.choiceColumns,layoutBy:t.layoutBy??"window",motion:t.motion??"full",shuffleSeed:t.shuffleSeed}}function Fe(e){let t=ns(io);return os(()=>ll(t,e),[t,e?.size,e?.choiceLabels,e?.choiceColumns,e?.layoutBy,e?.motion,e?.shuffleSeed])}function ze(){let e=ns(io);return os(()=>He(e),[e])}function De({display:e,children:t}){let r=Fe(e);return sl(io.Provider,{value:r,children:t})}function We(e){if(e.sizeSet)return{"--edp-scale":String(e.scale)}}function It(){let{motion:e}=ze();return{hop:e==="none"?"":"animate-hop",shake:e==="full"?"animate-shake":"",wobble:e==="full"?"animate-wobble":""}}function pl(e){let t=2166136261;for(let r=0;r<e.length;r++)t^=e.charCodeAt(r),t=Math.imul(t,16777619);return t>>>0}function ul(e){return()=>{e=e+1831565813|0;let t=Math.imul(e^e>>>15,1|e);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}}function br(e,t){let r=[...e],n=ul(pl(t));for(let o=r.length-1;o>0;o--){let a=Math.floor(n()*(o+1));[r[o],r[a]]=[r[a],r[o]]}return r}import{Fragment as as,jsx as he,jsxs as ml}from"react/jsx-runtime";import{useState as cn,useEffect as is,useRef as ss,useLayoutEffect as fl,useCallback as hl}from"react";import{createPortal as gl}from"react-dom";import bl from"clsx";var yl=typeof window<"u"?fl:is;function co({node:e}){if(e.type==="text"){if(!e.marks||e.marks.length===0)return he(as,{children:e.text});let t=e.text||"";for(let r of e.marks)r.type==="bold"?t=he("strong",{children:t}):r.type==="italic"?t=he("em",{children:t}):r.type==="underline"?t=he("u",{children:t}):r.type==="strike"?t=he("s",{children:t}):r.type==="textStyle"&&r.attrs?.color&&(t=he("span",{style:{color:r.attrs.color},children:t}));return he(as,{children:t})}if(e.type==="paragraph")return he("span",{className:"block",children:e.content?.map((t,r)=>he(co,{node:t},r))??he("br",{})});if(e.type==="hardBreak")return he("br",{});if(e.type==="inlineMath"||e.type==="blockMath"){let t=String(e.attrs?.latex??""),r=e.type==="blockMath";return he("span",{className:r?"block text-center":void 0,dir:"ltr",dangerouslySetInnerHTML:{__html:Ne(t,r)}})}return e.content?he("span",{className:"block",children:e.content.map((t,r)=>he(co,{node:t},r))}):null}function xl({nodes:e}){return he("span",{className:"block space-y-1",style:{color:"var(--ink, #1d2025)"},children:e.map((t,r)=>he(co,{node:t},r))})}function vl(e,t,r,n=8){let o=e.top-t.height-n;o<n&&(o=e.bottom+n);let a=e.left+e.width/2-t.width/2;return a=Math.max(n,Math.min(a,r-t.width-n)),{top:o,left:a}}function kt({hint:e}){let t=re(),[r,n]=cn(!1),[o,a]=cn(!1),[s,i]=cn(null),[c,l]=cn({}),p=ss(null),f=ss(null);is(()=>{if(!o)return;let R=k=>{let C=k.target;p.current&&!p.current.contains(C)&&f.current&&!f.current.contains(C)&&(a(!1),n(!1))};return document.addEventListener("mousedown",R),()=>document.removeEventListener("mousedown",R)},[o]);let m=hl(()=>{let R=p.current,k=f.current;!R||!k||i(vl(R.getBoundingClientRect(),k.getBoundingClientRect(),window.innerWidth))},[]);yl(()=>{if(!r){i(null);return}let R=p.current;if(R){let k=getComputedStyle(R);l({direction:k.direction,fontFamily:k.fontFamily,"--edp-scale":k.getPropertyValue("--edp-scale").trim()||"1"})}return m(),window.addEventListener("scroll",m,!0),window.addEventListener("resize",m),()=>{window.removeEventListener("scroll",m,!0),window.removeEventListener("resize",m)}},[r,m]);let h=()=>n(!0),d=()=>{o||n(!1)},u=R=>{R.stopPropagation(),o?(a(!1),n(!1)):(a(!0),n(!0))},S=r&&typeof document<"u"?gl(he("span",{className:"edpire-scope",style:{...c,display:"contents"},children:he("span",{ref:f,role:"tooltip",className:"player-blank-hint-pop",onClick:R=>R.stopPropagation(),onMouseEnter:h,onMouseLeave:d,style:{position:"fixed",top:s?s.top:0,left:s?s.left:0,bottom:"auto",transform:"none",margin:0,visibility:s?"visible":"hidden"},children:he(xl,{nodes:e})})}),document.body):null;return ml("span",{ref:p,className:"relative inline-flex items-center align-middle",onMouseEnter:h,onMouseLeave:d,children:[he("button",{type:"button",onClick:u,className:bl("player-blank-hint-btn select-none",o&&"player-blank-hint-btn--pinned"),"aria-label":t.showHint,"aria-expanded":r,children:"?"}),S]})}function ot({hint:e}){return!e||e.length===0?null:he(kt,{hint:e})}function Sl(e){return[...e].map(t=>({v:t,r:Math.random()})).sort((t,r)=>t.r-r.r).map(t=>t.v)}var Rl=e=>e.replace(/ {2,}/g,t=>" ".repeat(t.length-1)+" "),Cl=new Set(["image","resizableImage","resizableVideo","youtubeEmbed"]);function ps(e){return(e??[]).some(t=>Cl.has(t?.type)||ps(t?.content))}var ls=()=>we("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:3,children:we("path",{d:"M5 13l4 4L19 7"})}),ds=()=>we("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:3,children:we("path",{d:"M6 6l12 12M18 6L6 18"})});function Xr({node:e,validationFeedback:t}){let r=ge(),n=re(),o=ze(),a=It(),{id:s,content:i,attrs:c}=e,l=c.shuffle??!1,p="prompt"in c?c.prompt:void 0,f="separator"in c?c.separator??"/":"/",m="pickLimit"in c&&c.pickLimit?c.pickLimit:1,h=c.hideCount===!0,d=h||m>1,u=!h&&m>1,S="layout"in c?c.layout??"row":"row",R=e.type==="inlineChoiceSet",k=JSON.stringify(i),C=l&&o.shuffleSeed!==void 0,v=kl(()=>C?br(i,`${o.shuffleSeed}:${s}`):null,[C,o.shuffleSeed,s,k]),[N,w]=cs(i);lo(()=>{C||w(l?Sl(i):i)},[l,C,k]);let x=v??N,[y,T]=cs(new Set),g=t?.showFeedback??!1,P=t?.correctChoiceIds||[];lo(()=>{let _=q=>{let O=q.answers.find(ne=>ne.nodeId===s&&ne.type==="choiceSet");O&&"selectedIds"in O.answer&&T(new Set(O.answer.selectedIds))};return r.on("answers:prefill",_),()=>r.off("answers:prefill",_)},[s,r]),lo(()=>{r.emit({type:"answer:changed",answer:{nodeId:s,type:"choiceSet",timestamp:Date.now(),answer:{selectedIds:Array.from(y)}}})},[y,s,r]);let A=_=>{g||T(q=>{let z=new Set(q);return d?z.has(_)?z.delete(_):(h||z.size<m)&&z.add(_):z.has(_)?z.delete(_):(z.clear(),z.add(_)),z})},W=_=>Rl(fe(_.content)),b=_=>{let q=y.has(_),z=P.includes(_);return g?z&&q?"correct":z&&!q?"correct-unchosen":!z&&q?"incorrect":"muted":q?"selected":"idle"},M={idle:"",selected:"player-choice--selected",correct:dt("player-choice--correct",a.hop),"correct-unchosen":"player-choice--correct-unchosen",incorrect:dt("player-choice--incorrect",a.shake),muted:"player-choice--muted"},$={idle:"",selected:"player-inline-choice--selected",correct:dt("player-inline-choice--correct",a.hop),"correct-unchosen":"player-inline-choice--correct-unchosen",incorrect:dt("player-inline-choice--incorrect",a.shake),muted:"player-inline-choice--muted"};if(R)return Wt("span",{className:"inline-choice",children:[p&&Wt("span",{className:"mr-2 font-medium",children:[p,u?we("span",{className:"ms-1 opacity-60",children:n.chooseN(m)}):null]}),x.map((_,q)=>Wt(wl,{children:[we("button",{type:"button",disabled:g,onClick:()=>A(_.id),className:dt("player-inline-choice",$[b(_.id)]),"aria-pressed":y.has(_.id),dangerouslySetInnerHTML:{__html:W(_)}}),q<x.length-1&&we("span",{className:"mx-1",children:f})]},_.id)),c.hint&&c.hint.length>0&&we(kt,{hint:c.hint})]});let B=o.layoutBy==="box",J=o.choiceColumns?Math.min(o.choiceColumns,x.length):0,Y=J?{gridAutoRows:"1fr",gridTemplateColumns:`repeat(${J}, minmax(0, 1fr))`}:{gridAutoRows:"1fr"},Q=x.some(_=>ps(_.content)),ve=o.choiceLabels==="letters",L=_=>n.choiceLetters[_]??String(_+1);return Wt("div",{className:dt("cs-player my-4 space-y-3",B&&"cs-player--box"),children:[p&&Wt("p",{className:"font-medium",children:[p,u?we("span",{className:"ms-2 text-sm opacity-70",children:n.chooseN(m)}):null]}),c.hint&&c.hint.length>0&&we(kt,{hint:c.hint}),we("div",{className:dt("cs-player__grid",S==="row"&&"cs-player__grid--row"),style:Y,children:x.map((_,q)=>{let z=b(_.id),O=z==="incorrect"?"incorrect":z==="correct"||z==="correct-unchosen"?"correct":null;return Wt("button",{type:"button",disabled:g,onClick:()=>A(_.id),className:dt("player-choice",Q&&"player-choice--tile",M[z]),"aria-pressed":y.has(_.id),children:[we("span",{className:dt("player-choice__mark",d?"player-choice__mark--box":"player-choice__mark--radio",ve&&"player-choice__mark--letter"),children:ve?L(q):z==="incorrect"?we(ds,{}):we(ls,{})}),we("span",{className:"player-choice__text",dangerouslySetInnerHTML:{__html:W(_)}}),ve&&O&&we("span",{className:`player-choice__verdict player-choice__verdict--${O}`,"aria-hidden":"true",children:O==="incorrect"?we(ds,{}):we(ls,{})})]},_.id)})})]})}import{jsx as pt,Fragment as Al,jsxs as po}from"react/jsx-runtime";import{useContext as Nl,useState as _l,useEffect as uo,useRef as Pl,useCallback as Tl}from"react";import $t from"clsx";function Jr({node:e,validationFeedback:t}){let r=ge(),n=re(),o=It(),{id:a,attrs:s}=e,{placeholder:i="___",width:c="auto",hint:l}=s,p=Pl(null),f=i.trim().split(/\s+/).filter(Boolean).length,m=Nl(fr),h=!m&&c==="auto"&&f>=4,[d,u]=_l(""),S=t?.showFeedback??!1,R=t?.state,k=R==="validating",C=t?.displayAnswer,v=t?.message;uo(()=>{let y=T=>{let P=T.answers.find(A=>A.nodeId===a&&A.type==="blank");P&&"mode"in P.answer&&P.answer.mode==="typed"&&"text"in P.answer&&u(P.answer.text)};return r.on("answers:prefill",y),()=>r.off("answers:prefill",y)},[a,r]),uo(()=>{r.emit({type:"answer:changed",answer:{nodeId:a,type:"blank",timestamp:Date.now(),answer:{mode:"typed",text:d}}})},[d,a,r]);let N=y=>{u(y.target.value)},w=Tl(()=>{let y=p.current;y&&(y.style.height="auto",y.style.height=`${y.scrollHeight}px`)},[]);uo(()=>{w()},[d,w]);let x=S&&!k;return po("span",{className:m?"player-blank-cell":$t("inline-flex flex-wrap items-center gap-x-1 gap-y-0.5 align-middle max-w-full",h&&"w-full"),children:[pt("span",{className:m?"player-blank-cell__box":$t("relative inline-block shrink-0 min-w-0 max-w-full",h&&"w-full flex-1"),children:x?pt("span",{className:$t("player-typed-blank-feedback",m&&"player-typed-blank-feedback--cell",h&&"w-full",R==="correct"&&$t("player-typed-blank-feedback--correct",o.hop),R==="partial"&&"player-typed-blank-feedback--partial",R==="incorrect"&&$t("player-typed-blank-feedback--incorrect",o.wobble)),children:d||pt("span",{className:"opacity-40",children:i})}):po(Al,{children:[pt("textarea",{ref:p,"aria-label":n.blankAnswerAria,placeholder:i,value:d,onChange:N,disabled:S,rows:1,wrap:m?"off":void 0,className:$t("player-typed-blank",m&&"player-typed-blank--cell",h&&"w-full",k&&"player-typed-blank--pending"),style:m?void 0:c!=="auto"?{width:c}:h?{width:"100%"}:{width:`${Math.max(7,d.length+1)}ch`,maxWidth:"100%"}}),!d&&!k&&!m&&pt("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&&pt("span",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:pt("span",{className:"player-typed-blank-spinner","aria-label":n.aiEvaluationInProgressAria})})]})}),S&&R==="incorrect"&&C&&po("span",{className:"player-blank-reveal",children:["(",C,")"]}),S&&v&&pt("span",{className:$t("player-blank-feedback",R==="correct"&&"player-blank-feedback--correct",R==="partial"&&"player-blank-feedback--partial",R==="incorrect"&&"player-blank-feedback--incorrect"),children:v}),l&&l.length>0&&pt(kt,{hint:l})]})}import{jsx as dn,Fragment as hs,jsxs as fo}from"react/jsx-runtime";import{useEffect as gs}from"react";import pn from"clsx";import{useDroppable as zl,useDndContext as Dl}from"@dnd-kit/core";import{jsx as Ml}from"react/jsx-runtime";import{createContext as El,useCallback as St,useContext as Ll,useEffect as Il,useMemo as us,useRef as $l,useState as mo}from"react";import{useDndMonitor as Fl}from"@dnd-kit/core";var fs=El(null);function at(){let e=Ll(fs);if(!e)throw new Error("usePool must be used within a PoolProvider");return e}function ms(e){let t={};for(let r of e??[])r.type==="blank"&&"mode"in r.answer&&r.answer.mode==="choice"&&"choiceId"in r.answer&&r.answer.choiceId&&(t[r.nodeId]={choiceId:r.answer.choiceId,poolId:r.answer.poolId||"",value:r.answer.value||""});return t}function ln({children:e,initialAnswers:t}){let r=ge(),n=us(()=>ms(t),[t]),[o,a]=mo(n),[s,i]=mo({}),[c,l]=mo({}),p=$l(new Set);Il(()=>{let v=N=>{let w=ms(N.answers);Object.keys(w).length!==0&&a(x=>{if(!Object.entries(w).some(([g,P])=>x[g]?.choiceId!==P.choiceId||x[g]?.poolId!==P.poolId||x[g]?.value!==P.value))return x;let T={...x,...w};return i(g=>{let P={...g};for(let[A,W]of Object.entries(g)){let b=new Set(Object.values(T).filter(M=>M.poolId===A).map(M=>M.choiceId));P[A]={...W,available:new Set(W.choices.map(M=>M.id).filter(M=>!b.has(M)))}}return P}),T})};return r.on("answers:prefill",v),()=>r.off("answers:prefill",v)},[r]);let f=St((v,N)=>{i(w=>{let x=w[v];if(!x){let A=new Set;for(let b of Object.values(o))b.poolId===v&&A.add(b.choiceId);let W=new Set(N.map(b=>b.id).filter(b=>!A.has(b)));return{...w,[v]:{choices:N,available:W}}}let y=new Set(x.choices.map(A=>A.id)),T=new Set(N.map(A=>A.id));if(!(N.some(A=>!y.has(A.id))||x.choices.some(A=>!T.has(A.id))))return w;let P=new Set;for(let A of x.available)T.has(A)&&P.add(A);for(let A of N)y.has(A.id)||P.add(A.id);return{...w,[v]:{choices:N,available:P}}})},[o]),m=St((v,N)=>{l(w=>{let x=w[v]??[];return x.includes(N)?w:{...w,[v]:[...x,N]}}),!p.current.has(N)&&!o[N]&&(p.current.add(N),r.emit({type:"answer:changed",answer:{nodeId:N,type:"blank",timestamp:Date.now(),answer:{mode:"choice",choiceId:"",poolId:v,value:""}}}))},[o,r]),h=St(v=>(c[v]??[]).find(w=>!o[w])??null,[c,o]),d=St((v,N,w,x)=>{a(y=>{let T=y[v];return T&&i(g=>{let P=g[T.poolId];if(!P)return g;let A=new Set(P.available);return A.add(T.choiceId),{...g,[T.poolId]:{...P,available:A}}}),{...y,[v]:{choiceId:w,value:x,poolId:N}}}),i(y=>{let T=y[N];if(!T)return y;let g=new Set(T.available);return g.delete(w),{...y,[N]:{...T,available:g}}}),r.emit({type:"answer:changed",answer:{nodeId:v,type:"blank",timestamp:Date.now(),answer:{mode:"choice",choiceId:w,poolId:N,value:x}}})},[r]),u=St(v=>{let N=o[v];if(!N)return;let{poolId:w,choiceId:x}=N;i(y=>{let T=y[w];if(!T)return y;let g=new Set(T.available);return g.add(x),{...y,[w]:{...T,available:g}}}),a(y=>{let{[v]:T,...g}=y;return g}),r.emit({type:"answer:changed",answer:{nodeId:v,type:"blank",timestamp:Date.now(),answer:{mode:"choice",choiceId:"",poolId:w,value:""}}})},[o,r]),S=St((v,N)=>s[v]?.available.has(N)??!1,[s]),R=St((v,N)=>s[v]?.choices.find(w=>w.id===N),[s]),k=St(()=>{a({}),i(v=>{let N={};for(let[w,x]of Object.entries(v))N[w]={choices:x.choices,available:new Set(x.choices.map(y=>y.id))};return N});for(let[v,N]of Object.entries(c))for(let w of N)r.emit({type:"answer:changed",answer:{nodeId:w,type:"blank",timestamp:Date.now(),answer:{mode:"choice",choiceId:"",poolId:v,value:""}}})},[c,r]);Fl({onDragEnd(v){window.dispatchEvent(new CustomEvent("dnd-drop",{detail:{active:v.active,over:v.over}}))}});let C=us(()=>({blanks:o,pools:s,registerPool:f,registerBlank:m,fill:d,back:u,isAvailable:S,getChoice:R,firstEmptyBlank:h,resetAllAnswers:k}),[o,s,f,m,d,u,S,R,h,k]);return Ml(fs.Provider,{value:C,children:e})}function Zr({node:e,validationFeedback:t}){let{id:r,attrs:n}=e,{poolId:o,placeholder:a="___",hint:s}=n,{blanks:i,fill:c,back:l,getChoice:p,registerBlank:f}=at(),m=re(),h=It(),d=i[r],u=!!d?.choiceId,S=t?.showFeedback??!1,R=t?.state,k=t?.correctChoiceIds??[],C=S&&R==="incorrect"&&k.length>0?p(o||"",k[0]):void 0,v=C?C.html.replace(/<\/?[^>]+(>|$)/g,""):void 0,{setNodeRef:N,isOver:w}=zl({id:r,data:{type:"blank",blankId:r,poolId:o}}),{active:x}=Dl(),y=!!x&&x.data.current?.poolId===o;return gs(()=>{f(o||"",r)},[o,r,f]),gs(()=>{let P=A=>{let W=A,{active:b,over:M}=W.detail||{};if(!M||M.id!==r)return;let{choiceId:$,poolId:B}=b?.data.current||{};if(!$||B!==o)return;let J=p(o||"",$);if(!J)return;let Y=J.html.replace(/<\/?[^>]+(>|$)/g,"");c(r,o||"",$,Y)};return window.addEventListener("dnd-drop",P),()=>window.removeEventListener("dnd-drop",P)},[r,o,p,c]),fo(hs,{children:[dn("span",{ref:N,onClick:()=>{u&&!S&&l(r)},className:pn("player-choice-blank",w&&"player-choice-blank--over",!w&&y&&!u&&!S&&"player-choice-blank--target",u&&!S&&!w&&"player-choice-blank--filled",S&&R==="correct"&&pn("player-choice-blank--correct",h.hop),S&&R==="partial"&&pn("player-choice-blank--partial",h.hop),S&&R==="incorrect"&&pn("player-choice-blank--incorrect",h.wobble)),title:u&&!S?m.clickToRemove:void 0,"data-node-id":r,"data-pool-id":o,children:u?fo(hs,{children:[dn("span",{children:d.value}),!S&&dn("span",{className:"player-choice-blank__clear",children:"\xD7"})]}):a}),v&&fo("span",{className:"player-blank-reveal",children:["(",v,")"]}),dn(ot,{hint:s})]})}import{jsx as bo,jsxs as Ul}from"react/jsx-runtime";import{useEffect as Cs,useRef as Kl,useState as Vl}from"react";import Gl from"clsx";import{jsx as Rs,jsxs as ql}from"react/jsx-runtime";import Hl from"clsx";import{useDraggable as Wl}from"@dnd-kit/core";import{jsx as Ft,jsxs as bs}from"react/jsx-runtime";import{useEffect as ys,useState as xs}from"react";import Ol from"clsx";var vs="edpire:tap-hint-placed",ws=2;function jl(e){let r=(()=>{try{return Number(e?.getItem(vs))||0}catch{return 0}})(),n=new Set,o=new Set,a=()=>n.forEach(s=>s());return{done:()=>r>=ws,placed:()=>r,recordPlacement(){if(!(r>=ws)){r+=1;try{e?.setItem(vs,String(r))}catch{}a()}},setOnScreen(s,i){let c=o.has(s);i!==c&&(i?o.add(s):o.delete(s),a())},owner(){let s=null;for(let i of o)(!s||i.compareDocumentPosition(s)&4)&&(s=i);return s},subscribe(s){return n.add(s),()=>{n.delete(s)}}}}var ho=null;function go(){if(!ho){let e=null;try{e=typeof window<"u"?window.localStorage:null}catch{e=null}ho=jl(e)}return ho}function ks(){typeof window>"u"||go().recordPlacement()}function Bl(){try{return window.matchMedia("(hover: none) and (pointer: coarse)").matches}catch{return!1}}function un(e,t){let[,r]=xs(0),[n,o]=xs(!1);if(ys(()=>{o(Bl())},[]),ys(()=>{let s=e.current;if(!n||!s)return;let i=go();if(i.done())return;let c=i.subscribe(()=>r(p=>p+1));if(!t||typeof IntersectionObserver>"u")return()=>{i.setOnScreen(s,!1),c()};let l=new IntersectionObserver(p=>{for(let f of p)i.setOnScreen(s,f.isIntersecting)},{threshold:.6});return l.observe(s),()=>{l.disconnect(),i.setOnScreen(s,!1),c()}},[e,n,t]),!n||!t||typeof window>"u")return!1;let a=go();return!a.done()&&a.owner()===e.current}function Ss(){let{motion:e}=ze();return bs("span",{className:Ol("player-tap-hint",e==="none"&&"player-tap-hint--still"),"aria-hidden":"true",children:[Ft("span",{className:"player-tap-hint__ripple"}),Ft("svg",{className:"player-tap-hint__hand",viewBox:"0 0 24 24",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[{stroke:"#ffffff",strokeWidth:4.5},{stroke:"currentColor",strokeWidth:1.75}].map((t,r)=>bs("g",{...t,children:[Ft("path",{d:"M22 14a8 8 0 0 1-8 8"}),Ft("path",{d:"M18 11v-1a2 2 0 0 0-2-2a2 2 0 0 0-2 2"}),Ft("path",{d:"M14 10V9a2 2 0 0 0-2-2a2 2 0 0 0-2 2v1"}),Ft("path",{d:"M10 9.5V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v10"}),Ft("path",{d:"M18 11a2 2 0 1 1 4 0v3a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15"})]},r))})]})}function Ut({poolId:e,data:t,isInline:r=!1,tapHint:n=!1}){let{isAvailable:o,firstEmptyBlank:a,fill:s}=at(),{id:i,html:c}=t,l=!o(e,i),{setNodeRef:p,attributes:f,listeners:m,transform:h,isDragging:d}=Wl({id:i,data:{type:"choice",choiceId:i,poolId:e,html:c},disabled:l});if(l)return null;let u=C=>C.replace(/<\/?[^>]+(>|$)/g,""),S=()=>{let C=a(e);if(C){let v=u(c);s(C,e,i,v),ks()}},R=h?{transform:`translate3d(${h.x}px, ${h.y}px, 0)`}:void 0;return ql(r?"span":"div",{ref:p,style:R,className:Hl("player-bank-pill",d&&"player-bank-pill--dragging",n&&!d&&"player-bank-pill--hinted",r&&"mx-1"),...f,...m,onClick:S,children:[Rs("span",{dangerouslySetInnerHTML:{__html:c},className:"pointer-events-none whitespace-pre-wrap break-words"}),n&&!d&&Rs(Ss,{})]})}function en({node:e}){let t=re(),{id:r,attrs:n,content:o}=e,{shuffle:a=!0,equalWidth:s=!1}=n,{registerPool:i,isAvailable:c}=at(),l=Kl(null),[p,f]=Vl(()=>o.map(d=>({id:d.id,html:fe(d.content)})));Cs(()=>{let d=o.map(u=>({id:u.id,html:fe(u.content)}));f(a?[...d].map(u=>({v:u,r:Math.random()})).sort((u,S)=>u.r-S.r).map(u=>u.v):d)},[a,JSON.stringify(o)]),Cs(()=>{i(r,p)},[r,p,i]);let m=p.find(d=>c(r,d.id))?.id,h=un(l,m!==void 0);return Ul("div",{ref:l,className:"player-word-bank",children:[bo("div",{className:"player-word-bank__label",children:t.wordBank}),bo("div",{className:Gl("player-word-bank__items",s&&"player-word-bank__items--grid"),children:p.map(d=>bo(Ut,{poolId:r,data:d,tapHint:h&&d.id===m},d.id))})]})}import{jsx as yo,jsxs as Yl}from"react/jsx-runtime";import{useEffect as As,useRef as Ql,useState as Xl}from"react";function tn({node:e}){let{id:t,attrs:r,content:n}=e,{shuffle:o=!0,separator:a=" "}=r,{registerPool:s,isAvailable:i}=at(),c=Ql(null),[l,p]=Xl(()=>n.map(h=>({id:h.id,html:fe(h.content,{stripParagraphs:!0})})));As(()=>{let h=n.map(d=>({id:d.id,html:fe(d.content,{stripParagraphs:!0})}));p(o?[...h].map(d=>({v:d,r:Math.random()})).sort((d,u)=>d.r-u.r).map(d=>d.v):h)},[o,JSON.stringify(n)]),As(()=>{s(t,l)},[t,l,s]);let f=l.find(h=>i(t,h.id))?.id,m=un(c,f!==void 0);return yo("span",{ref:c,style:{display:"inline-flex",flexWrap:"wrap",gap:F("0.25rem"),alignItems:"center"},children:l.map((h,d)=>Yl("span",{children:[yo(Ut,{poolId:t,data:h,isInline:!0,tapHint:m&&h.id===f}),d<l.length-1&&yo("span",{children:a})]},h.id))})}import{jsx as Kt,jsxs as wo}from"react/jsx-runtime";import{useState as ko,useEffect as So,useMemo as td}from"react";import{Check as rd,X as nd}from"lucide-react";import{jsx as Re,jsxs as zt}from"react/jsx-runtime";import{useState as xo,useMemo as vo,useRef as mn,useCallback as Jl,useLayoutEffect as Zl}from"react";var Ns="#1d2025",_s="#8d93a0",Ps="#1f8a4c",Ts="#d23b2b",ed=11;function Ms({leftItems:e,rightItems:t,connections:r,direction:n,disabled:o,feedback:a,onConnectionsChange:s}){let[i,c]=xo(null),[l,p]=xo(null),[f,m]=xo(new Map),h=mn(null),d=mn(new Map),u=mn("mouse"),S=a?.showFeedback??!1,R=vo(()=>{let L=new Map;if(a?.pairFeedback)for(let _ of a.pairFeedback)L.set(`${_.leftId}-${_.rightId}`,_.correct);return L},[a]),k=vo(()=>{let L=new Map;return a?.correctPairings?.forEach(_=>L.set(_.leftId,_.rightId)),L},[a]),C=vo(()=>{let L=new Map;return a?.correctPairings?.forEach(_=>L.set(_.rightId,_.leftId)),L},[a]),v=new Map,N=new Map;r.forEach((L,_)=>{v.set(L.leftId,_),N.set(L.rightId,_)});let w=L=>{let _=r[L];if(!S||!_)return null;let q=R.get(`${_.leftId}-${_.rightId}`);return q===!0?"correct":q===!1?"incorrect":null},x=Jl(()=>{if(!h.current)return;let L=h.current.getBoundingClientRect(),_=new Map;d.current.forEach((q,z)=>{if(q){let O=q.getBoundingClientRect();_.set(z,new DOMRect(O.left-L.left,O.top-L.top,O.width,O.height))}}),m(_)},[]);Zl(()=>{x();let L=new ResizeObserver(x);return h.current&&L.observe(h.current),()=>L.disconnect()},[x,r,e,t]);let y=8,T=(L,_)=>{let q=f.get(L);if(!q)return null;let z=q.y+q.height/2;return _==="left"?{x:q.x+q.width,y:z}:{x:q.x-y,y:z}},g=(L,_)=>{if(o)return;let z=(_==="left"?v:N).has(L),O=i?.id===L&&i?.side===_,ne=i!==null&&i.side!==_;if(O){c(null);return}if(ne){let ce=_==="right"?i.id:L,le=_==="left"?i.id:L,ue=r.filter(U=>U.leftId!==ce&&U.rightId!==le);ue.push({leftId:ce,rightId:le}),s(ue),c(null);return}if(z&&!i){let ce=_==="left"?r.filter(le=>le.leftId!==L):r.filter(le=>le.rightId!==L);s(ce);return}c({id:L,side:_})},P=mn(null),A=(L,_,q)=>{if(o||(u.current=q.pointerType,q.pointerType==="touch"))return;q.currentTarget.setPointerCapture(q.pointerId);let z=h.current.getBoundingClientRect();P.current={x:q.clientX-z.left,y:q.clientY-z.top},p({fromId:L,fromSide:_,x:q.clientX-z.left,y:q.clientY-z.top,overId:null,overSide:null})},W=L=>{if(!l)return;let _=h.current.getBoundingClientRect(),q=L.clientX-_.left,z=L.clientY-_.top,O=l.fromSide==="left"?"right":"left",ne=O==="left"?e:t,ce=null,le=null;for(let ue of ne){let U=f.get(ue.id);if(U&&q>=U.x&&q<=U.x+U.width&&z>=U.y&&z<=U.y+U.height){ce=ue.id,le=O;break}}p(ue=>ue?{...ue,x:q,y:z,overId:ce,overSide:le}:null)},b=L=>{if(!l)return;let _=h.current.getBoundingClientRect(),q=L.clientX-_.left,z=L.clientY-_.top,O=P.current;if((O?Math.hypot(q-O.x,z-O.y):999)<8){p(null),g(l.fromId,l.fromSide);return}if(l.overId&&l.overSide){let ce=l.fromSide==="left"?l.fromId:l.overId,le=l.fromSide==="right"?l.fromId:l.overId,ue=r.filter(U=>U.leftId!==ce&&U.rightId!==le);ue.push({leftId:ce,rightId:le}),s(ue)}p(null),c(null)},M=(L,_)=>{if(!S)return null;let z=(_==="left"?v:N).get(L.id);if(z!==void 0){let O=r[z];if(R.get(`${O.leftId}-${O.rightId}`)===!0)return null}if(_==="left"){let O=k.get(L.id);return t.find(ne=>ne.id===O)?.content??null}else{let O=C.get(L.id);return e.find(ne=>ne.id===O)?.content??null}},$=(L,_)=>{let z=(_==="left"?v:N).get(L.id),O=z!==void 0,ne=i?.id===L.id&&i?.side===_,ce=i!==null&&i.side!==_&&!O,le=l?.overId===L.id&&l?.overSide===_,ue=O?w(z):null,U=O?z+1:null,X="matching-player__item";O&&(X+=" matching-player__item--matched"),ue==="correct"&&(X+=" matching-player__item--correct"),ue==="incorrect"&&(X+=" matching-player__item--incorrect"),ne&&(X+=" matching-player__item--selected"),(ce||le)&&(X+=" matching-player__item--available"),o&&(X+=" matching-player__item--disabled");let me=M(L,_);return zt("button",{ref:ae=>{ae?d.current.set(L.id,ae):d.current.delete(L.id)},type:"button",className:X,onPointerDown:ae=>A(L.id,_,ae),onClick:()=>{u.current==="touch"&&g(L.id,_)},"aria-pressed":ne,children:[_==="right"&&Re("span",{className:"matching-player__connector matching-player__connector--right","aria-hidden":!0,children:zt("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:[Re("circle",{cx:"9",cy:"9",r:"8",stroke:"currentColor",strokeWidth:"1.5",fill:"currentColor",fillOpacity:"0.08"}),Re("path",{d:"M12 9H6M8.5 6.5L6 9l2.5 2.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}),O&&_==="left"&&Re("span",{className:"matching-player__pair-num","aria-hidden":!0,children:U}),Re("span",{className:"matching-player__item-text",dangerouslySetInnerHTML:{__html:fe(L.content)}}),me&&zt("span",{className:"matching-player__correct-hint",children:["(",Re("span",{dangerouslySetInnerHTML:{__html:fe(me)}}),")"]}),O&&_==="right"&&Re("span",{className:"matching-player__pair-num","aria-hidden":!0,children:U}),_==="left"&&Re("span",{className:"matching-player__connector matching-player__connector--left","aria-hidden":!0,children:zt("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:[Re("circle",{cx:"9",cy:"9",r:"8",stroke:"currentColor",strokeWidth:"1.5",fill:"currentColor",fillOpacity:"0.08"}),Re("path",{d:"M6 9h6M9.5 6.5L12 9l-2.5 2.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})})]},L.id)},B=n==="ltr"?e:t,J=n==="ltr"?t:e,Y=n==="ltr"?"left":"right",Q=n==="ltr"?"right":"left";return zt("div",{ref:h,className:`matching-player__arena${l?" matching-player__arena--dragging":""}`,onPointerMove:W,onPointerUp:b,children:[zt("svg",{className:"matching-player__svg","aria-hidden":!0,children:[Re("defs",{children:[["mp-arrow-ink",Ns],["mp-arrow-correct",Ps],["mp-arrow-incorrect",Ts],["mp-arrow-ghost",_s]].map(([L,_])=>Re("marker",{id:L,markerUnits:"userSpaceOnUse",markerWidth:"11",markerHeight:"9",refX:"0",refY:"4.5",orient:"auto",children:Re("polygon",{points:"0 0, 11 4.5, 0 9",fill:_})},L))}),r.map(L=>{let _=T(L.leftId,"left"),q=T(L.rightId,"right");if(!_||!q)return null;let z=q.x-ed,O=Math.max(16,Math.abs(z-_.x)*.4),ne=`M ${_.x} ${_.y} C ${_.x+O} ${_.y}, ${z-O} ${q.y}, ${z} ${q.y}`,ce=S?R.get(`${L.leftId}-${L.rightId}`):void 0;return Re("path",{d:ne,stroke:ce===!0?Ps:ce===!1?Ts:Ns,strokeWidth:"2.5",fill:"none",markerEnd:`url(#${ce===!0?"mp-arrow-correct":ce===!1?"mp-arrow-incorrect":"mp-arrow-ink"})`},`${L.leftId}-${L.rightId}`)}),l&&(()=>{let L=T(l.fromId,l.fromSide);if(!L)return null;let _=Math.abs(l.x-L.x)*.35,q=`M ${L.x} ${L.y} C ${L.x+_} ${L.y}, ${l.x-_} ${l.y}, ${l.x} ${l.y}`;return Re("path",{d:q,stroke:_s,strokeWidth:"2",strokeDasharray:"6 4",fill:"none",markerEnd:"url(#mp-arrow-ghost)"})})()]}),zt("div",{className:"matching-player__columns",children:[Re("div",{className:"matching-player__column",children:B.map(L=>$(L,Y))}),Re("div",{className:"matching-player__column",children:J.map(L=>$(L,Q))})]})]})}var Es=e=>Number.isInteger(e)?String(e):e.toFixed(2);function Ls(e){return[...e].map(t=>({v:t,r:Math.random()})).sort((t,r)=>t.r-r.r).map(t=>t.v)}function rn({node:e,validationFeedback:t}){let r=ge(),{shuffleSeed:n,layoutBy:o}=ze(),{id:a,attrs:s,leftItems:i,rightItems:c}=e,{direction:l,shuffle:p,hint:f}=s,m=JSON.stringify(i),h=JSON.stringify(c),d=p&&n!==void 0,u=td(()=>d?{left:br(i,`${n}:${a}:left`),right:br(c,`${n}:${a}:right`)}:null,[d,n,a,m,h]),[S,R]=ko(i),[k,C]=ko(c);So(()=>{d||(p?(R(Ls(i)),C(Ls(c))):(R(i),C(c)))},[p,d,m,h]);let v=u?.left??S,N=u?.right??k,[w,x]=ko([]),y=t?.showFeedback??!1;So(()=>{let b=M=>{let B=M.answers.find(J=>J.nodeId===a&&J.type==="matchingSet");B&&"connections"in B.answer&&x(B.answer.connections)};return r.on("answers:prefill",b),()=>r.off("answers:prefill",b)},[r,a]),So(()=>{r.emit({type:"answer:changed",answer:{nodeId:a,type:"matchingSet",timestamp:Date.now(),answer:{connections:w}}})},[r,a,w]);let T=b=>{y||x(b)},g=t?.score,P=t?.maxScore,A=y&&g!=null&&P!=null,W=A?g>=P?"correct":g>0?"partial":"incorrect":null;return wo("div",{className:o==="box"?"matching-player matching-player--box":"matching-player",children:[f&&f.length>0&&Kt("div",{className:"matching-player-hintrow",children:Kt(ot,{hint:f})}),Kt(Ms,{leftItems:v,rightItems:N,connections:w,direction:l,disabled:y,feedback:t,onConnectionsChange:T}),A&&wo("div",{className:"matching-player-feedback matching-player-feedback--"+W,children:[W==="correct"&&Kt(rd,{size:15,style:be(15)}),W==="incorrect"&&Kt(nd,{size:15,style:be(15)}),Kt("span",{children:W==="correct"?"All matched":W==="partial"?"Partial credit":"Not matched"}),wo("span",{className:"matching-player-score",children:[Es(g)," / ",Es(P)]})]})]})}import{jsxs as Xt,jsx as Ue,Fragment as Xd}from"react/jsx-runtime";import{useState as pi,useEffect as Qo,useRef as ui,useCallback as Xo}from"react";import Tr from"clsx";import{jsx as ct,jsxs as Qt,Fragment as Hd}from"react/jsx-runtime";import{useCallback as Wd,useEffect as Ud,useRef as ci,useState as Go}from"react";import Yo from"clsx";import{Camera as Kd,PenLine as Vd}from"lucide-react";import{jsx as At,jsxs as Rr}from"react/jsx-runtime";import{forwardRef as Nd,useEffect as vn,useImperativeHandle as _d,useRef as ti}from"react";import Pd from"clsx";import{Keyboard as Td}from"lucide-react";import{useEditor as Md,EditorContent as Ed}from"@tiptap/react";import Ld from"@tiptap/starter-kit";import{Placeholder as Id}from"@tiptap/extensions";var j=(e,t,r,n)=>({insert:e,latex:t??e,...r?{width:r}:{},...n?{class:n}:{}}),Rt=(e,t,r)=>j(e,t,r,"small"),Ro=["[left]","[right]","[backspace]","[hide-keyboard]"],fn=(e,t)=>`\\begin{pmatrix}${Array.from({length:e},()=>Array.from({length:t},()=>"#?").join("&")).join("\\\\")}\\end{pmatrix}`,Is=e=>`\\begin{vmatrix}${Array.from({length:e},()=>Array.from({length:e},()=>"#?").join("&")).join("\\\\")}\\end{vmatrix}`,$s=e=>`\\begin{cases}${Array.from({length:e},()=>"#?").join("\\\\")}\\end{cases}`,Oe={lim:"\\lim\\limits_{x\\to#?}#?",matrix2:fn(2,2),matrix3:fn(3,3),column2:fn(2,1),column3:fn(3,1),det2:Is(2),det3:Is(3),system2:$s(2),system3:$s(3),identity3:"I_3",inverse:"#@^{-1}",openInterval:"\\rbrack #?;#?\\lbrack",closedInterval:"\\lbrack #?;#?\\rbrack",set:"\\lbrace #?\\rbrace"},od={id:"edp-analyse",label:"lim, \u221E",tooltip:"Analyse",rows:[[j(Oe.lim,"\\lim"),j("\\infty","\\infty"),j("+\\infty","+\\infty"),j("-\\infty","-\\infty"),j("#@^{+}","x^{+}"),j("#@^{-}","x^{-}"),j("#@'","f'"),j("\\circ","\\circ")],[j("\\ln(#0)","\\ln"),j("e^{#0}","e^{x}"),j("\\sqrt{#0}","\\sqrt{x}"),j("\\left|#0\\right|","|x|"),j("\\frac{#@}{#?}","\\frac{a}{b}"),j("#@^{#?}","x^{n}"),j("#@^{2}","x^{2}"),j("\\pi","\\pi")],[j("x"),j("f(x)","f(x)"),j("("),j(")"),j("="),j("\\ne"),j("\\le"),j("\\ge")],[j("<"),j(">"),j(","),j(";"),...Ro]]},ad={id:"edp-sets",label:"\u211D, \u222A",tooltip:"Ensembles",rows:[[j("\\R","\\mathbb{R}"),j("\\N","\\mathbb{N}"),j("\\Z","\\mathbb{Z}"),j("\\Q","\\mathbb{Q}"),j("\\setminus","\\setminus"),j("\\cup","\\cup"),j("\\cap","\\cap"),j("\\emptyset","\\emptyset")],[j("\\in","\\in"),j("\\notin","\\notin"),j("\\subset","\\subset"),j(Oe.set,"\\lbrace\\,\\rbrace"),j(Oe.openInterval,"\\rbrack a;b\\lbrack"),j(Oe.closedInterval,"\\lbrack a;b\\rbrack"),j("\\rbrack","\\rbrack"),j("\\lbrack","\\lbrack")],[j(";"),j(","),j("("),j(")"),j("-\\infty","-\\infty"),j("+\\infty","+\\infty"),j("x"),j("=")],Ro]},sd={id:"edp-matrices",label:"(\u25A6), {",tooltip:"Matrices",rows:[[Rt(Oe.matrix2,"\\begin{pmatrix}\\square&\\square\\\\\\square&\\square\\end{pmatrix}",1.5),Rt(Oe.matrix3,"\\begin{pmatrix}\\square&\\square&\\square\\\\\\square&\\square&\\square\\\\\\square&\\square&\\square\\end{pmatrix}",1.5),Rt(Oe.column2,"\\begin{pmatrix}\\square\\\\\\square\\end{pmatrix}"),Rt(Oe.column3,"\\begin{pmatrix}\\square\\\\\\square\\\\\\square\\end{pmatrix}")],[Rt(Oe.det2,"\\begin{vmatrix}\\square&\\square\\\\\\square&\\square\\end{vmatrix}",1.5),Rt(Oe.det3,"\\begin{vmatrix}\\square&\\square&\\square\\\\\\square&\\square&\\square\\\\\\square&\\square&\\square\\end{vmatrix}",1.5),Rt(Oe.system2,"\\begin{cases}\\square\\\\\\square\\end{cases}"),Rt(Oe.system3,"\\begin{cases}\\square\\\\\\square\\\\\\square\\end{cases}")],[j("I_3","I_3"),j(Oe.inverse,"A^{-1}"),j("\\times","\\times"),j("\\cdot","\\cdot"),j("\\det","\\det"),j("="),j(","),j(";")],Ro]},id=[od,ad,sd,"numeric","greek"],Fs=!1;function zs(){if(Fs||typeof window>"u")return;let e=window.mathVirtualKeyboard;if(e)try{e.layouts=id,Fs=!0}catch{}}var cd=new Set(["ce-evaluate","ce-simplify","ce-solve","color","background-color","mode","variant","decoration"]);function hn(e){let t=e,r=t?.menuItems;if(!(!t||!Array.isArray(r)))try{t.menuItems=r.filter(n=>!n.id||!cd.has(n.id))}catch{}}import{Node as qs,mergeAttributes as Hs}from"@tiptap/core";import{Fragment as ld}from"@tiptap/pm/model";import{TextSelection as Ds}from"@tiptap/pm/state";var _o={ownLine:!1,centred:!1,onOpenWindow:null};function dd(e){return e.storage.mathTyping?.chip??{unwrap:"Back to text",ownLine:"On its own line"}}function Os(e,t){let r=t==="start"?e.firstChild:e.lastChild;if(!r?.isText)return e;let n=t==="start"?(r.text??"").replace(/^\s+/,""):(r.text??"").replace(/\s+$/,"");if(n===r.text)return e;let o=t==="start"?0:e.childCount-1,a=n?e.content.replaceChild(o,e.type.schema.text(n,r.marks)):t==="start"?e.content.cut(r.nodeSize):e.content.cut(0,e.content.size-r.nodeSize);return e.copy(a)}function js(e){let t=!1;return e.forEach(r=>{(!r.isText||(r.text??"").trim())&&(t=!0)}),t}var pd={le:"<=",leq:"<=",ge:">=",geq:">=",ne:"!=",neq:"!=",times:"*",cdot:"*",div:"/",pi:"\u03C0",in:"\u2208",infty:"\u221E",pm:"\xB1",lt:"<",gt:">",approx:"\u2248",degree:"\xB0",circ:"\xB0"};function yr(e,t){for(;e[t]===" ";)t++;if(e[t]!=="{")return[e[t]??"",t+1];let r=0;for(let n=t;n<e.length;n++)if(e[n]==="{")r++;else if(e[n]==="}"&&--r===0)return[e.slice(t+1,n),n+1];return[e.slice(t+1),e.length]}var Co=e=>e.length>1&&!/^[\dA-Za-zπ.,]+$/.test(e)&&!/^\(.*\)$/.test(e)?`(${e})`:e;function xr(e){let t="",r=0,n=e.replace(/\\(left|right)\b/g,"").replace(/\\placeholder(\[[^\]]*\])?\{\}/g,"");for(;r<n.length;){let o=n[r];if(o==="\\"){let a=n.slice(r+1).match(/^([A-Za-z]+|.)/)?.[1]??"";if(r+=1+a.length,a==="frac"||a==="dfrac"||a==="tfrac"){let[s,i]=yr(n,r),[c,l]=yr(n,i);t+=`${Co(xr(s))}/${Co(xr(c))}`,r=l}else if(a==="sqrt"){let[s,i]=yr(n,r);t+=`sqrt(${xr(s)})`,r=i}else if(a==="text"||a==="mathrm"||a==="operatorname"){let[s,i]=yr(n,r);t+=s,r=i}else a===","||a===" "||a===";"||a==="quad"?t+=" ":a==="{"||a==="}"?t+=a:t+=pd[a]??a}else if(o==="^"||o==="_"){let[a,s]=yr(n,r+1);t+=`${o}${Co(xr(a))}`,r=s}else o==="{"||o==="}"||o===" "||(t+=o),r++}return t}function Ws(e,t,r){let n=e.doc.nodeAt(t);if(!n||n.type.name!=="inlineMath"&&n.type.name!=="blockMath")return null;let{schema:o}=e,a=r?o.text(r):null;if(n.type.name==="blockMath"){let i=e.tr.replaceWith(t,t+n.nodeSize,o.nodes.paragraph.create(null,a));return i.setSelection(Ds.create(i.doc,t+1+r.length))}let s=a?e.tr.replaceWith(t,t+n.nodeSize,a):e.tr.delete(t,t+n.nodeSize);return s.setSelection(Ds.create(s.doc,t+r.length))}function Us(e,t){let r=e.doc.nodeAt(t),{schema:n}=e;if(!r||!n.nodes.blockMath||!n.nodes.inlineMath)return null;let o={...r.attrs};if(r.type.name==="blockMath"){let h=n.nodes.paragraph.create(null,n.nodes.inlineMath.create(o));return e.tr.replaceWith(t,t+r.nodeSize,h)}if(r.type.name!=="inlineMath")return null;let a=e.doc.resolve(t);if(a.depth<1)return null;let s=a.parent,i=t-a.start(),c=Os(s.cut(0,i),"end"),l=Os(s.cut(i+r.nodeSize),"start"),p=[...js(c.content)?[c]:[],n.nodes.blockMath.create(o),...js(l.content)?[l]:[]],f=a.node(a.depth-1),m=a.index(a.depth-1);return f.canReplace(m,m+1,ld.from(p))?e.tr.replaceWith(a.before(),a.after(),p):null}var Ao=null,Po=!1;function Qe(){return Ao||(Ao=import("mathlive").then(({MathfieldElement:e})=>(e.soundsDirectory=null,zs(),Po=!0,!0)).catch(()=>!1)),Ao}function To(){return Po}var Vt=new WeakMap,st={el:null};function it(){return window.mathVirtualKeyboard??null}function ud(){let e=it();e?.visible&&document.activeElement?.tagName!=="MATH-FIELD"&&e.hide()}var vr=null;function gn(){let e=vr;if(!e)return;let t=it(),r=!!t?.visible&&(t.boundingRect?.height??0)>0;e.hidden=!r,r&&t&&(e.style.bottom=`${Math.round(window.innerHeight-t.boundingRect.top+8)}px`)}function bn(e,t){if(!vr){let r=document.createElement("button");r.type="button",r.className="edp-mathkb-close",r.textContent="\u2715",r.hidden=!0,r.addEventListener("mousedown",n=>n.preventDefault()),r.addEventListener("click",()=>it()?.hide()),document.body.append(r),e.addEventListener("visibilitychange",gn),e.addEventListener("geometrychange",gn),window.addEventListener("resize",gn),vr=r}vr.title=t,vr.setAttribute("aria-label",t);for(let r of[0,120,400])setTimeout(gn,r)}function Ks(e){return e.shadowRoot?.querySelector(".ML__keyboard-sink")??null}function kr(e){Ks(e)?.setAttribute("inputmode",it()?.visible?"none":"text")}var wr={el:null},md=/(=|\+|-|\\times|\\cdot|\\le|\\ge|\\ne|\\in|\\lt|\\gt|<|>|\(|\\left\()\s*$/,fd=/([.,;:])$/;function Yt(e,t,r,n,o){let a=0,s=()=>{let c=e.nodeDOM(t)?.querySelector?.("math-field");if(c&&typeof c.executeCommand=="function"){n&&Vt.set(c,n),c.focus();let l=Ks(c);l&&(kr(c),l.focus({preventScroll:!0})),document.activeElement!==c&&(wr.el=c,c.addEventListener("focus",()=>wr.el===c&&(wr.el=null),{once:!0})),r==="placeholder"?(c.position=0,c.executeCommand("moveToNextPlaceholder")):c.position=r==="end"?c.lastOffset??0:0,o&&(c.executeCommand(["typedText",o]),r==="placeholder"&&/^\d$/.test(o)&&c.executeCommand("moveAfterParent"));return}++a<60&&requestAnimationFrame(s)};s()}function Gt(e){e.view.focus()}function Bs(e,t,r){let n=e.chain().setTextSelection(t);r&&n.insertContent(r),n.run(),Gt(e)}var No=class{constructor({node:t,editor:r,getPos:n,extension:o}){this.field=null,this.echoed=null,this.cleanups=[],this.fieldCleanup=null,this.node=t,this.editor=r,this.getPos=typeof n=="function"?n:()=>{},this.isLine=t.type.name==="blockMath",this.options={..._o,...o?.options},this.editable=r.isEditable,this.dom=document.createElement(this.isLine?"div":"span"),this.dom.className=this.isLine?`edp-sheet-line${this.options.centred?" edp-sheet-line--centred":""}`:"edp-sheet-formula",this.dom.dir="ltr",this.dom.setAttribute(this.isLine?"data-block-math":"data-inline-math",""),this.render();let a=()=>{this.editor.isEditable!==this.editable&&(this.editable=this.editor.isEditable,this.render())};r.on("transaction",a),this.cleanups.push(()=>r.off("transaction",a));let s=this.options.onOpenWindow;if(s){let i=c=>{if(!this.editor.isEditable||c.target?.closest?.(".edp-math-chip"))return;let l=this.getPos();l!=null&&(c.preventDefault(),s({editor:this.editor,pos:l,latex:this.latex,block:this.isLine}))};this.dom.addEventListener("dblclick",i),this.cleanups.push(()=>this.dom.removeEventListener("dblclick",i))}}get latex(){return String(this.node.attrs.latex??"")}render(){if(this.dropField(),this.dom.replaceChildren(),this.editable&&Po){this.mountField();return}let t=document.createElement(this.isLine?"div":"span");t.className="edp-sheet-static";let r=this.latex.replace(/\\placeholder(\[[^\]]*\])?\{\}/g,"");t.innerHTML=r?Ne(r,!1):"",this.dom.append(t),this.editable&&Qe().then(n=>{n&&this.editable&&!this.field&&this.dom.isConnected&&this.render()})}mountField(){let t=document.createElement("math-field");if(t.className=this.isLine?"edp-sheet-mf edp-sheet-mf--line":"edp-sheet-mf",t.setAttribute("math-virtual-keyboard-policy","manual"),t.setAttribute("smart-fence","on"),t.value=this.latex,this.isLine&&this.options.centred){let d=document.createElement("span");d.className="edp-sheet-line-box",d.append(t,this.chip()),this.dom.append(d)}else this.dom.append(t,this.chip());this.field=t;let r=this.editor,n=()=>this.getPos(),o=d=>{let u=n();u!=null&&Bs(r,u+this.node.nodeSize,d)},a=()=>{let d=n();d!=null&&Bs(r,d)},s=()=>{let d=n();d!=null&&r.view.dispatch(r.state.tr.delete(d,d+this.node.nodeSize))},i=()=>t.position===t.lastOffset,c=()=>{Vt.delete(t),this.echoed=t.value;let d=n();d!=null&&r.view.dispatch(r.state.tr.setNodeMarkup(d,void 0,{...this.node.attrs,latex:t.value}))},l=()=>{st.el=t,hn(t)},p=()=>{st.el===t&&(st.el=null),setTimeout(()=>{!t.value&&t.isConnected&&document.activeElement!==t&&r.isEditable&&s(),ud()},0)},f=d=>{let u=d.detail?.direction;u==="backward"||u==="upward"?a():o()},m=d=>{if(d.key===" "&&!d.ctrlKey&&!d.metaKey){d.preventDefault(),d.stopPropagation(),Vt.delete(t);let u=t.position;if(t.executeCommand?.("moveAfterParent"),t.position!==u)return;if(!i()){t.position=t.lastOffset??t.position;return}if(!t.value||md.test(t.value))return;let S=t.value.match(fd)?.[1],R=n();if(S&&R!=null&&t.value.length>1){let k=t.value.slice(0,-1);t.value=k,this.echoed=k,r.view.dispatch(r.state.tr.setNodeMarkup(R,void 0,{...this.node.attrs,latex:k})),o(`${S} `);return}o(" ")}else if((d.ctrlKey||d.metaKey)&&d.key.toLowerCase()==="z"&&!d.shiftKey&&Vt.has(t)){d.preventDefault(),d.stopPropagation();let u=Vt.get(t)??[];Vt.delete(t);let S=n();if(S==null)return;r.chain().insertContentAt({from:S,to:S+this.node.nodeSize},u).run(),Gt(r)}else if(d.key==="Enter"){d.preventDefault(),d.stopPropagation();let u=n();if(u==null)return;r.chain().setTextSelection(u+this.node.nodeSize).splitBlock().run(),Gt(r)}else d.key==="Backspace"&&!t.value?(d.preventDefault(),d.stopPropagation(),a(),s()):d.key==="Escape"&&(d.preventDefault(),o())};t.addEventListener("input",c),t.addEventListener("focus",l),t.addEventListener("focusout",p),t.addEventListener("move-out",f),t.addEventListener("keydown",m,!0);let h=()=>kr(t);t.addEventListener("pointerdown",h,!0),this.fieldCleanup=()=>{t.removeEventListener("pointerdown",h,!0),t.removeEventListener("input",c),t.removeEventListener("focus",l),t.removeEventListener("focusout",p),t.removeEventListener("move-out",f),t.removeEventListener("keydown",m,!0),st.el===t&&(st.el=null)}}chip(){let t=document.createElement("span");t.className="edp-math-chip",t.contentEditable="false";let r=(s,i,c)=>{let l=document.createElement("button");return l.type="button",l.className=`edp-math-chip-btn ${s}`,l.textContent=i,l.addEventListener("mousedown",p=>p.preventDefault()),l.addEventListener("click",p=>{p.preventDefault(),p.stopPropagation(),c()}),l},n=r("edp-math-chip-unwrap","\xD7",()=>this.unwrap()),o=this.options.ownLine?r("edp-math-chip-line","\u2195",()=>this.toggleLine()):null,a=()=>{let s=dd(this.editor);n.title=s.unwrap,n.setAttribute("aria-label",s.unwrap),o&&(o.title=s.ownLine,o.setAttribute("aria-label",s.ownLine),o.setAttribute("aria-pressed",String(this.isLine)))};return a(),t.addEventListener("pointerenter",a),o&&t.append(o),t.append(n),t}plainText(){return xr(this.field?.value??this.latex)}unwrap(){let t=this.getPos();if(t==null)return;let r=Ws(this.editor.state,t,this.plainText());r&&(this.editor.view.dispatch(r),Gt(this.editor))}toggleLine(){let t=this.getPos();if(t==null)return;let r=Us(this.editor.state,t);r&&this.editor.view.dispatch(r)}dropField(){this.fieldCleanup?.(),this.fieldCleanup=null,this.field=null}update(t){if(t.type!==this.node.type)return!1;this.node=t;let r=this.field;return r?r.value!==this.latex&&this.latex!==this.echoed&&document.activeElement!==r&&(r.value=this.latex):this.render(),!0}selectNode(){this.dom.classList.add("is-selected")}deselectNode(){this.dom.classList.remove("is-selected")}stopEvent(t){return!!t.target?.closest?.("math-field, .edp-math-chip")}ignoreMutation(){return!0}destroy(){this.dropField();for(let t of this.cleanups.splice(0))t()}},Vs=e=>new No(e),Mo=qs.create({name:"inlineMath",addOptions(){return{..._o}},group:"inline",inline:!0,atom:!0,selectable:!0,addAttributes(){return{latex:{default:""}}},parseHTML(){return[{tag:"span[data-inline-math]"}]},renderHTML({HTMLAttributes:e}){return["span",Hs(e,{"data-inline-math":""})]},addNodeView(){return Vs}}),Eo=qs.create({name:"blockMath",addOptions(){return{..._o}},group:"block",atom:!0,selectable:!0,addAttributes(){return{latex:{default:""}}},parseHTML(){return[{tag:"div[data-block-math]"}]},renderHTML({HTMLAttributes:e}){return["div",Hs(e,{"data-block-math":""})]},addNodeView(){return Vs}});import{Extension as vd}from"@tiptap/core";import{Plugin as wd,PluginKey as kd}from"@tiptap/pm/state";var Lo="\\placeholder{}",hd=/[A-Za-z0-9.,()[\]π²³+\-*×·−]/,Qs=/^[+\-−*×·=/^)]/,gd=/[+\-−*×·=(]$/,bd=e=>/[A-Za-z]{2,}/.test(e.replace(/\([^()]*\)/g,""));function Gs(e){let t=e.endsWith(" ")?e.length-1:e.length,r="",n=null;for(;t>0;){let o=t;for(;o>0&&hd.test(e[o-1]);)o--;let a=e.slice(o,t);if(!a||bd(a)||n!==null&&!(gd.test(a)||Qs.test(n))||(r=e.slice(o),n=a,o<2||e[o-1]!==" "))break;t=o-1}return r}function yd(e){if(e.endsWith(")")){let r=0;for(let n=e.length-1;n>=0;n--)if(e[n]===")")r++;else if(e[n]==="("&&--r===0)return e.slice(0,n).match(/[A-Za-z]$/)?e.slice(n-1):e.slice(n);return null}let t=e.match(/(\d+(?:[.,]\d+)?|[A-Za-zπ²³])$/);return t?t[0]:null}function Io(e){return e.replace(/ /g,"").replace(/[*×·]/g,"\\times ").replace(/−/g,"-").replace(/π/g,"\\pi ").replace(/²/g,"^{2}").replace(/³/g,"^{3}")}var xd=e=>/[\d²³]|[+\-*×·−()]/.test(e)||/^[A-Za-zπ](\([^()]*\))?$/.test(e);function Ys(e,t){let n=e.slice(0,e.length-t.length).match(new RegExp("\uFFFC( ?)$"));if(!n)return 0;let o=t.trim();return o===""||Qs.test(o)?n[0].length:0}function $o(e,t){if(t==="t"&&/(^|[^A-Za-z])sqr$/.test(e))return{take:3,latex:`\\sqrt{${Lo}}`,placeholder:!0,merge:!1};if(/^[+\-−*×]$/.test(t)){let r=e.match(new RegExp("\uFFFC( ?)$"));if(!r)return null;let n=t==="*"||t==="\xD7"?"\\times ":t==="\u2212"?"-":t;return{take:r[0].length,latex:n,placeholder:!1,merge:!0}}if(t==="^"||t==="/"){if(e.endsWith(" "))return null;let r=Gs(e),n=r?yd(r):null;if(!r||!n)return null;let o=Io(r.slice(0,r.length-n.length)),a=Io(n),s=t==="^"?`${o}${a}^{${Lo}}`:`${o}\\frac{${a}}{${Lo}}`,i=Ys(e,r);return{take:r.length+i,latex:s,placeholder:!0,merge:i>0}}if(t==="="){let r=e.match(/([<>!])$/)?.[1],n=r?e.slice(0,-1):e,o=Gs(n),a=Ys(n,o),s=r==="<"?"\\le ":r===">"?"\\ge ":r==="!"?"\\ne ":"=";return!r&&!a&&(!o.trim()||!xd(o.trim()))?null:{take:o.length+a+(r?1:0),latex:`${Io(o)}${s}`,placeholder:!1,merge:a>0}}return null}function Xs(e){return e.replace(/\\placeholder(\[[^\]]*\])?\{\}/g,"")}var Ct="\\placeholder{}",yn={power:{inField:"^{2}",create:"#@^{2}"},fraction:{inField:`\\frac{${Ct}}{${Ct}}`,create:`\\frac{${Ct}}{${Ct}}`},root:{inField:`\\sqrt{${Ct}}`,create:`\\sqrt{${Ct}}`},pi:{inField:"\\pi",create:"\\pi"},le:{inField:"\\le",create:"\\le"},ge:{inField:"\\ge",create:"\\ge"},ne:{inField:"\\ne",create:"\\ne"},in:{inField:"\\in",create:"\\in"}},Sd=new Set(["le","ge","ne","in"]);function zo(e,t){let r=e.doc.resolve(t),n=e.schema.nodes.inlineMath;return!n||!r.parent.isTextblock||r.parent.type.spec.code||r.marks().some(o=>o.type.spec.code)?!1:r.parent.canReplaceWith(r.index(),r.index(),n)}function Zs(e,t,r,n){if(!zo(e,t))return null;let o=e.doc.resolve(t),a=t-o.parentOffset,s=e.doc.textBetween(Math.max(a,t-80),t,void 0,"\uFFFC"),i=$o(s,r);if(!i)return null;let c=t-i.take,l=i.latex,p=[],f=s.slice(s.length-i.take)+r+(n??""),m={};if(i.merge){let d=e.doc.nodeAt(c);if(d?.type.name!=="inlineMath")return null;l=`${d.attrs.latex??""}${l}`,m=d.attrs,p.push({type:"inlineMath",attrs:{...d.attrs}}),f=f.slice(1)}return p.push({type:"text",text:f}),{tr:e.tr.replaceWith(c,t,e.schema.nodes.inlineMath.create({...m,latex:l})),pos:c,placeholder:i.placeholder,revert:p}}function Sr(e,t,r,n){if(!To())return Qe(),!1;let o=Zs(e.state,t,r,n);return o?(e.dispatch(o.tr),Yt(e,o.pos,o.placeholder?"placeholder":"end",n?void 0:o.revert,n),!0):!1}function Rd(e,t,r){let n=e.state.doc.resolve(t);if(!n.parent.isTextblock)return!1;let a=e.state.doc.textBetween(Math.max(t-n.parentOffset,t-2),t,void 0,"\uFFFC").match(new RegExp(`${"\uFFFC"}( ?)$`));if(!a)return!1;let s=t-a[0].length;a[1]&&e.dispatch(e.state.tr.delete(t-1,t)),Yt(e,s,"end");let i=Do(e,s);return i?.executeCommand?.(["insert",r,{selectionMode:"after"}]),!!i}function Do(e,t){return e.nodeDOM(t)?.querySelector?.("math-field")??null}function ei(e,t){let{from:r,empty:n,$from:o}=e.state.selection,a=n&&o.parent.isTextblock?r:e.state.selection.to;if(!zo(e.state,a))return null;if(e.chain().insertContentAt(a,{type:"inlineMath",attrs:{latex:""}}).run(),Yt(e.view,a,"end"),t){let s=t.includes(Ct)||t.includes("#");Do(e.view,a)?.executeCommand?.(["insert",t,{selectionMode:s?"placeholder":"after"}])}return a}function xn(e,t){if(!e.isEditable)return;if(!To()){Qe().then(a=>a&&xn(e,t));return}let r=yn[t],n=st.el;if(n&&e.view.dom.contains(n)){n.executeCommand?.(["insert",r.inField,{selectionMode:r.inField.includes(Ct)?"placeholder":"after"}]),n.focus();return}let{selection:o}=e.state;o.empty&&(t==="power"&&Sr(e.view,o.from,"^","2")||t==="fraction"&&Sr(e.view,o.from,"/")||Sd.has(t)&&Rd(e.view,o.from,r.inField))||ei(e,r.create)}function Oo(e){if(!e.isEditable)return;let t=it();if(t?.visible){t.hide();return}it()?Js(e):Qe().then(r=>r&&Js(e))}function Js(e){let t=it();if(!t)return;let r=st.el;if(!r||!e.view.dom.contains(r)){let o=ei(e,"");r=o==null?null:Do(e.view,o)}if(!r)return;let n=()=>{t.visible||(t.removeEventListener("visibilitychange",n),st.el&&kr(st.el))};t.addEventListener("visibilitychange",n),t.show(),bn(t,Ad(e).closeKeyboard),kr(r)}var Cd=new kd("edpMathTyping"),jo=vd.create({name:"mathTyping",addStorage(){return{chip:{unwrap:"Back to text",ownLine:"On its own line",closeKeyboard:"Close the maths keyboard"}}},onCreate(){this.editor.isEditable&&Qe()},addProseMirrorPlugins(){return[new wd({key:Cd,props:{handleTextInput(e,t,r,n){return t!==r?!1:n.length===1?Sr(e,t,n):n.length===2&&n[0]==="^"?Sr(e,t,"^",n[1]):!1},handleKeyDown(e,t){let r=wr.el;if(r?.isConnected&&e.dom.contains(r)&&t.key.length===1&&!t.ctrlKey&&!t.metaKey&&!t.altKey)return r.executeCommand?.(["typedText",t.key]),t.preventDefault(),!0;let{selection:n}=e.state;if(!n.empty||t.ctrlKey||t.metaKey||t.altKey||t.isComposing)return!1;if(t.key.length===1&&Sr(e,n.from,t.key))return t.preventDefault(),!0;if(t.shiftKey)return!1;let o=getComputedStyle(e.dom).direction==="rtl",a=t.key==="Backspace"||t.key===(o?"ArrowRight":"ArrowLeft"),s=t.key===(o?"ArrowLeft":"ArrowRight"),{$from:i}=n;return a&&i.nodeBefore?.type.name==="inlineMath"?(Yt(e,i.pos-i.nodeBefore.nodeSize,"end"),!0):s&&i.nodeAfter?.type.name==="inlineMath"?(Yt(e,i.pos,"start"),!0):!1}}})]}});function Ad(e){return e.storage.mathTyping?.chip??{unwrap:"Back to text",ownLine:"On its own line",closeKeyboard:"Close the maths keyboard"}}function Bo(e,t){let r=e.storage.mathTyping;r&&(r.chip={...r.chip,...t})}var $d={keysAria:"Maths keys",more:"More",power:"Squared",fraction:"Fraction",root:"Square root",pi:"Pi",le:"Less than or equal to",ge:"Greater than or equal to",ne:"Not equal to",in:"Belongs to",unwrap:"Back to text",closeKeyboard:"Close the maths keyboard"},wn={power:Rr("span",{className:"edp-key-pow",children:["x",At("sup",{children:"2"})]}),fraction:Rr("span",{className:"edp-key-frac",children:[At("span",{children:"a"}),At("span",{children:"b"})]}),root:"\u221A",pi:"\u03C0",le:"\u2264",ge:"\u2265",ne:"\u2260",in:"\u2208"},Fd=["power","fraction","root","pi","le","ge","ne","in"];function qo(e){let t=[];for(let r of e){if(r.type==="inlineMath"||r.type==="blockMath"){let o=Xs(String(r.attrs?.latex??"")),a=r.type==="inlineMath"&&o.length>1?o.match(/([.,;:])$/)?.[1]:void 0;a&&(o=o.slice(0,-1)),o&&t.push({...r,attrs:{...r.attrs,latex:o}}),a&&t.push({type:"text",text:a});continue}let n=t[t.length-1];if(r.type==="text"&&n?.type==="text"&&!n.marks&&!r.marks){t[t.length-1]={...n,text:`${n.text??""}${r.text??""}`};continue}t.push(r.content?{...r,content:qo(r.content)}:r)}return t}var Ho=Nd(function({initialContent:t,onChange:r,disabled:n=!1,placeholder:o,labels:a,extraTools:s,className:i,keys:c=!0,ariaLabel:l,ariaLabelledBy:p,dir:f},m){let h={...$d,...a},d=ti(r);d.current=r;let u=Md({extensions:[Ld.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1}),Mo,Eo,jo,Id.configure({placeholder:o??"",showOnlyWhenEditable:!0})],immediatelyRender:!1,editable:!n,content:t?.length?{type:"doc",content:t}:"",editorProps:{attributes:{class:"edp-sheet-doc",role:"textbox","aria-multiline":"true",...l?{"aria-label":l}:{},...p?{"aria-labelledby":p}:{},...f?{dir:f}:{}}},onUpdate({editor:C}){C.isEditable&&d.current(qo(C.getJSON().content??[]))}});vn(()=>{n||Qe()},[n]),vn(()=>{u&&Bo(u,{unwrap:h.unwrap,closeKeyboard:h.closeKeyboard})},[u,h.unwrap,h.closeKeyboard]),vn(()=>{u&&(u.setEditable(!n,!1),u.view.dispatch(u.state.tr.setMeta("edpSheetEditable",!n)))},[n,u]);let S=ti(null);vn(()=>{u&&S.current&&(u.commands.setContent({type:"doc",content:S.current},{emitUpdate:!1}),S.current=null)},[u]),_d(m,()=>({setContent(C){u?u.commands.setContent({type:"doc",content:C},{emitUpdate:!1}):S.current=C},clear(){u?.commands.clearContent(!1)},getContent(){return qo(u?.getJSON().content??[])},insertFormula(C){if(!u)return;let{to:v}=u.state.selection;u.chain().insertContentAt(v,[{type:"inlineMath",attrs:{latex:C}},{type:"text",text:" "}]).run(),Gt(u)}}),[u]);let R=C=>{u&&!n&&xn(u,C)},k=()=>{u&&!n&&Oo(u)};return Rr("div",{className:Pd("edp-sheet-box",n&&"edp-sheet-box--readonly",i),children:[At("div",{className:"edp-sheet-page",children:At(Ed,{editor:u})}),!n&&(c||s)&&Rr("div",{className:"edp-sheet-keys",role:"toolbar","aria-label":h.keysAria,children:[c&&Fd.map(C=>At("button",{type:"button",className:"edp-sheet-key",title:h[C],"aria-label":h[C],onMouseDown:v=>v.preventDefault(),onClick:()=>R(C),children:wn[C]},C)),c&&Rr("button",{type:"button",className:"edp-sheet-key edp-sheet-key--more",onMouseDown:C=>C.preventDefault(),onClick:k,children:[At(Td,{size:16,"aria-hidden":"true"})," ",h.more]}),s&&At("span",{className:"edp-sheet-keys-extra",children:s})]})]})});function Wo(e){return(e??[]).map(t=>t.type==="text"?t.text??"":t.type==="inlineMath"?t.attrs?.latex?`$${t.attrs.latex}$`:"":t.type==="hardBreak"?`
|
|
2
|
-
`:
|
|
1
|
+
import"./chunk-76CZ6Z7T.mjs";import tl from"react";import{createRoot as rl}from"react-dom/client";import{useCallback as Yc,useMemo as Qc,useState as zf}from"react";import{cloneElement as zc,isValidElement as Bc,useCallback as ot,useEffect as no,useMemo as Oe,useRef as It,useState as Je}from"react";import{jsx as ur}from"react/jsx-runtime";import{useEffect as Da,useMemo as Em,useRef as Lm}from"react";import fl from"mitt";var ft=class{constructor(){this.emitter=fl(),this.answers=new Map}emit(t){if(t.type==="answer:changed")this.answers.set(t.answer.nodeId,t.answer);else if(t.type==="answers:reset")this.answers.clear();else if(t.type==="answers:prefill")for(let r of t.answers)this.answers.set(r.nodeId,r);this.emitter.emit(t.type,t)}on(t,r){this.emitter.on(t,r)}off(t,r){this.emitter.off(t,r)}getAllAnswers(){return Array.from(this.answers.values())}clearAnswers(){this.answers.clear(),this.emit({type:"answers:reset"})}prefillAnswers(t){this.emit({type:"answers:prefill",answers:t})}submitAnswers(){this.emit({type:"answer:submitted",answers:this.getAllAnswers(),timestamp:Date.now()})}},gs="__edpireGlobalAnswerBus",bs=globalThis,on=bs[gs]??(bs[gs]=new ft);import{jsx as hl}from"react/jsx-runtime";import{createContext as gl,useContext as bl}from"react";var xs="__edpireAnswerBusContext",ys=globalThis,vs=ys[xs]??(ys[xs]=gl(on));function we(){return bl(vs)}function an({children:e,bus:t=new ft}){return hl(vs.Provider,{value:t,children:e})}import{jsx as Ne,jsxs as er}from"react/jsx-runtime";import{Fragment as sd,useState as Bs,useEffect as Po,useMemo as id}from"react";import ht from"clsx";import{jsx as Y,jsxs as Ls}from"react/jsx-runtime";import{jsx as qe,jsxs as yo}from"react/jsx-runtime";import{createContext as wl,useCallback as vo,useContext as kl,useEffect as Ar,useMemo as Sl,useRef as Jt,useState as Dt}from"react";import{Pause as Rl,Play as Cl,RotateCcw as Al}from"lucide-react";import{jsx as xl}from"react/jsx-runtime";import{createContext as yl,useContext as ws}from"react";var Xt={submitButton:"Submit",showHint:"Show hint",clickToRemove:"Click to remove",blankAnswerAria:"Your answer",aiEvaluationInProgress:"AI evaluation in progress\u2026",aiEvaluationInProgressAria:"AI evaluation in progress",shortAnswerPlaceholder:"Short answer\u2026",longAnswerPlaceholder:"Write your answer here\u2026",minWordsLabel:e=>`Min: ${e}`,wordBank:"Word Bank",chooseN:e=>`(choose ${e})`,annexDefaultLabel:"Documents",annexOpen:e=>`Open ${e}`,annexClose:"Close",referenceInPanel:e=>`This exercise's text is in ${e}.`,readReference:"Read it",referenceForExercise:e=>`Exercise ${e}`,choiceLetters:"ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""),tableScrollLeft:"Show the columns on the left",tableScrollRight:"Show the columns on the right",mathChecking:"Checking your answer\u2026",mathCorrect:"Correct",mathIncorrect:"Incorrect",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,t)=>`Grade submitted: ${e} / ${t}`,openResponseRubricTitle:"Rubric",openResponseRubricCriterionPoints:(e,t)=>`${e} / ${t} pts`,openResponseAiSuggestionTitle:"AI Pre-grading Suggestion",openResponseAiSuggestedScore:(e,t)=>`Suggested score: ${e} / ${t}`,openResponseAiEvidence:"Evidence:",openResponseAiApplySuggestion:"Apply suggestion",openResponseStudentAnswerTitle:"Student answer",audioPlay:"Play",audioPause:"Pause",audioReplay:"Play again",audioSpeed:e=>`Speed ${e}`,audioRate:e=>`${e}\xD7`,audioPosition:"Position in the audio",audioTimeOf:(e,t)=>`${e} of ${t}`,audioPlaysLeft:e=>e===1?"1 play left":`${e} plays left`,audioNoPlaysLeft:"No plays left",audioUnavailable:"This audio can't be played.",recorderUpTo:e=>`Up to ${e}`,recorderRecord:"Record",recorderRecordingAria:"Recording",recorderSaving:e=>`Saving ${e}%`,recorderSaved:"Saved",recorderRecordAgain:"Record again",recorderCancel:"Cancel",recorderFailed:"Your recording wasn't saved. Check your connection.",recorderRetry:"Try again",recorderUnsupported:"This browser can't record. Try an up-to-date Chrome, Safari or Firefox.",recorderUnavailableHere:"Recording isn't available here.",recorderNone:"No recording",sheetToolsAria:"Write your answer",sheetKeysAria:"Maths keys",sheetMoreKeys:"More",sheetKeyPower:"Squared",sheetKeyFraction:"Fraction",sheetKeyRoot:"Square root",sheetKeyPi:"Pi",sheetKeyLe:"Less than or equal to",sheetKeyGe:"Greater than or equal to",sheetKeyNe:"Not equal to",sheetKeyIn:"Belongs to",sheetFormulaUnwrap:"Back to text",sheetKeyboardClose:"Close the maths keyboard",sheetPhoto:"Photo of my copy",sheetHandwriting:"Write by hand",sheetPlaceholder:"Write your answer here, maths included: x^2, 1/2 or sqrt become x\xB2, \xBD, \u221A.",sheetClose:"Close",sheetPhotoTitle:"Photo of your copy",sheetPhotoPhoneHelp:"Scan this code with your phone and take photos of your copy. They will appear here.",sheetPhotoOr:"Or",sheetPhotoUpload:"Upload a photo",sheetPhotoWebcam:"Use this computer's camera",sheetPhotoTake:"Take a photo",sheetPhotoGallery:"Choose a photo",sheetPhotoShoot:"Take the photo",sheetPhotoReading:"Reading your copy\u2026",sheetPhotoCheck:"Check what was read and correct it before you submit.",sheetPhotoFailed:"We couldn't read this photo. Try again with more light, or type your answer.",sheetPhotoCameraFailed:"The camera didn't open. Upload a photo instead.",sheetPhotoRetry:"Try again",sheetPhotoYours:"Your photo",sheetPhotoRemove:"Remove this photo",sheetPadTitle:"Write a formula by hand",sheetPadHelp:"Write here with your finger or a pen.",sheetPadFailed:"Not recognised. Write a little bigger, or type it with the keys.",sheetPadUndo:"Undo",sheetPadClear:"Clear",sheetPadInsert:"Insert",kbMaths:"Maths keyboard",kbPhone:"Phone keyboard",kbToMaths:"Write as maths",kbToText:"Back to text",kbHide:"Hide the keyboard",kbTabBasic:"Numbers",kbTabAnalysis:"Analysis",kbTabSets:"Sets and intervals",kbTabMatrices:"Matrices and systems",kbTabGreek:"Greek letters",kbKeyPowerN:"Power",kbKeyAbs:"Absolute value",kbKeyBrackets:"Brackets",kbKeyBackspace:"Delete",kbKeyEnter:"New line",kbKeyLeft:"Left",kbKeyRight:"Right",mathSlotPlaceholder:"answer"};var sn={submitButton:"Valider",showHint:"Voir l'indice",clickToRemove:"Cliquer pour retirer",blankAnswerAria:"Votre r\xE9ponse",aiEvaluationInProgress:"\xC9valuation IA en cours\u2026",aiEvaluationInProgressAria:"\xC9valuation IA en cours",shortAnswerPlaceholder:"R\xE9ponse courte\u2026",longAnswerPlaceholder:"\xC9crivez votre 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(""),tableScrollLeft:"Voir les colonnes de gauche",tableScrollRight:"Voir les colonnes de droite",mathChecking:"V\xE9rification de votre r\xE9ponse\u2026",mathCorrect:"Juste",mathIncorrect:"Faux",openResponseTextPlaceholder:"\xC9crivez votre r\xE9ponse ici\u2026",openResponseWords:"mots",openResponseChars:"car.",openResponseDropZoneLabel:"Glissez-d\xE9posez 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 ou \xE0 la cam\xE9ra refus\xE9. Autorisez-le dans les r\xE9glages 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,t)=>`Note envoy\xE9e : ${e} / ${t}`,openResponseRubricTitle:"Grille d'\xE9valuation",openResponseRubricCriterionPoints:(e,t)=>`${e} / ${t} pts`,openResponseAiSuggestionTitle:"Suggestion de correction par IA",openResponseAiSuggestedScore:(e,t)=>`Score sugg\xE9r\xE9 : ${e} / ${t}`,openResponseAiEvidence:"Extrait :",openResponseAiApplySuggestion:"Appliquer la suggestion",openResponseStudentAnswerTitle:"R\xE9ponse de l'\xE9l\xE8ve",audioPlay:"\xC9couter",audioPause:"Pause",audioReplay:"R\xE9\xE9couter",audioSpeed:e=>`Vitesse ${e}`,audioRate:e=>`${String(e).replace(".",",")}\xD7`,audioPosition:"Position dans l'audio",audioTimeOf:(e,t)=>`${e} sur ${t}`,audioPlaysLeft:e=>e===1?"1 \xE9coute restante":`${e} \xE9coutes restantes`,audioNoPlaysLeft:"Plus d'\xE9coute restante",audioUnavailable:"Impossible de lire cet audio.",recorderUpTo:e=>`Jusqu'\xE0 ${e}`,recorderRecord:"Enregistrer",recorderRecordingAria:"Enregistrement en cours",recorderSaving:e=>`Envoi ${e}\u202F%`,recorderSaved:"Enregistr\xE9",recorderRecordAgain:"Recommencer",recorderCancel:"Annuler",recorderFailed:"Votre enregistrement n'a pas \xE9t\xE9 envoy\xE9. V\xE9rifiez votre connexion.",recorderRetry:"R\xE9essayer",recorderUnsupported:"Ce navigateur ne peut pas enregistrer. Essayez Chrome, Safari ou Firefox \xE0 jour.",recorderUnavailableHere:"L'enregistrement n'est pas disponible ici.",recorderNone:"Aucun enregistrement",sheetToolsAria:"R\xE9diger votre r\xE9ponse",sheetKeysAria:"Touches de maths",sheetMoreKeys:"Plus",sheetKeyPower:"Au carr\xE9",sheetKeyFraction:"Fraction",sheetKeyRoot:"Racine carr\xE9e",sheetKeyPi:"Pi",sheetKeyLe:"Inf\xE9rieur ou \xE9gal \xE0",sheetKeyGe:"Sup\xE9rieur ou \xE9gal \xE0",sheetKeyNe:"Diff\xE9rent de",sheetKeyIn:"Appartient \xE0",sheetFormulaUnwrap:"Remettre en texte",sheetKeyboardClose:"Fermer le clavier de maths",sheetPhoto:"Photo de ma copie",sheetHandwriting:"\xC9crire \xE0 la main",sheetPlaceholder:"R\xE9digez votre r\xE9ponse ici, maths comprises : x^2, 1/2 ou sqrt deviennent x\xB2, \xBD, \u221A.",sheetClose:"Fermer",sheetPhotoTitle:"Photo de votre copie",sheetPhotoPhoneHelp:"Scannez ce code avec votre t\xE9l\xE9phone et photographiez votre copie. Les photos appara\xEEtront ici.",sheetPhotoOr:"Ou",sheetPhotoUpload:"T\xE9l\xE9verser une photo",sheetPhotoWebcam:"Utiliser la cam\xE9ra de cet ordinateur",sheetPhotoTake:"Prendre une photo",sheetPhotoGallery:"Choisir une photo",sheetPhotoShoot:"Prendre la photo",sheetPhotoReading:"Lecture de votre copie\u2026",sheetPhotoCheck:"V\xE9rifiez ce qui a \xE9t\xE9 lu et corrigez-le avant d'envoyer.",sheetPhotoFailed:"Impossible de lire cette photo. R\xE9essayez avec plus de lumi\xE8re, ou tapez votre r\xE9ponse.",sheetPhotoCameraFailed:"La cam\xE9ra ne s'est pas ouverte. T\xE9l\xE9versez plut\xF4t une photo.",sheetPhotoRetry:"R\xE9essayer",sheetPhotoYours:"Votre photo",sheetPhotoRemove:"Retirer cette photo",sheetPadTitle:"\xC9crire une formule \xE0 la main",sheetPadHelp:"\xC9crivez ici avec le doigt ou un stylet.",sheetPadFailed:"Non reconnu. \xC9crivez un peu plus grand, ou tapez-la avec les touches.",sheetPadUndo:"Annuler",sheetPadClear:"Effacer",sheetPadInsert:"Ins\xE9rer",kbMaths:"Clavier de maths",kbPhone:"Clavier du t\xE9l\xE9phone",kbToMaths:"\xC9crire en maths",kbToText:"Revenir au texte",kbHide:"Masquer le clavier",kbTabBasic:"Nombres",kbTabAnalysis:"Analyse",kbTabSets:"Ensembles et intervalles",kbTabMatrices:"Matrices et syst\xE8mes",kbTabGreek:"Lettres grecques",kbKeyPowerN:"Puissance",kbKeyAbs:"Valeur absolue",kbKeyBrackets:"Parenth\xE8ses",kbKeyBackspace:"Effacer",kbKeyEnter:"Nouvelle ligne",kbKeyLeft:"Gauche",kbKeyRight:"Droite",mathSlotPlaceholder:"r\xE9ponse"};var cn={submitButton:"\u0625\u0631\u0633\u0627\u0644",showHint:"\u0625\u0638\u0647\u0627\u0631 \u0627\u0644\u062A\u0644\u0645\u064A\u062D",clickToRemove:"\u0627\u0646\u0642\u0631 \u0644\u0644\u0625\u0632\u0627\u0644\u0629",blankAnswerAria:"\u0625\u062C\u0627\u0628\u062A\u0643",aiEvaluationInProgress:"\u062C\u0627\u0631\u064D \u0627\u0644\u062A\u0642\u064A\u064A\u0645 \u0628\u0627\u0644\u0630\u0643\u0627\u0621 \u0627\u0644\u0627\u0635\u0637\u0646\u0627\u0639\u064A\u2026",aiEvaluationInProgressAria:"\u062C\u0627\u0631\u064D \u0627\u0644\u062A\u0642\u064A\u064A\u0645 \u0628\u0627\u0644\u0630\u0643\u0627\u0621 \u0627\u0644\u0627\u0635\u0637\u0646\u0627\u0639\u064A",shortAnswerPlaceholder:"\u0625\u062C\u0627\u0628\u0629 \u0642\u0635\u064A\u0631\u0629\u2026",longAnswerPlaceholder:"\u0627\u0643\u062A\u0628 \u0625\u062C\u0627\u0628\u062A\u0643 \u0647\u0646\u0627\u2026",minWordsLabel:e=>`\u0627\u0644\u062D\u062F \u0627\u0644\u0623\u062F\u0646\u0649: ${e}`,wordBank:"\u0628\u0646\u0643 \u0627\u0644\u0643\u0644\u0645\u0627\u062A",chooseN:e=>`(\u0627\u062E\u062A\u0631 ${e})`,annexDefaultLabel:"\u0627\u0644\u0645\u0633\u062A\u0646\u062F\u0627\u062A",annexOpen:e=>`\u0641\u062A\u062D ${e}`,annexClose:"\u0625\u063A\u0644\u0627\u0642",referenceInPanel:e=>`\u0646\u0635 \u0647\u0630\u0627 \u0627\u0644\u062A\u0645\u0631\u064A\u0646 \u0641\u064A \xAB${e}\xBB.`,readReference:"\u0627\u0642\u0631\u0623\u0647",referenceForExercise:e=>`\u0627\u0644\u062A\u0645\u0631\u064A\u0646 ${e}`,choiceLetters:["\u0623","\u0628","\u062C","\u062F","\u0647\u0640","\u0648","\u0632","\u062D","\u0637","\u064A","\u0643","\u0644","\u0645","\u0646","\u0633","\u0639","\u0641","\u0635","\u0642","\u0631","\u0634","\u062A","\u062B","\u062E","\u0630","\u0636","\u0638","\u063A"],tableScrollLeft:"\u0625\u0638\u0647\u0627\u0631 \u0627\u0644\u0623\u0639\u0645\u062F\u0629 \u0639\u0644\u0649 \u0627\u0644\u064A\u0633\u0627\u0631",tableScrollRight:"\u0625\u0638\u0647\u0627\u0631 \u0627\u0644\u0623\u0639\u0645\u062F\u0629 \u0639\u0644\u0649 \u0627\u0644\u064A\u0645\u064A\u0646",mathChecking:"\u062C\u0627\u0631\u064D \u0627\u0644\u062A\u062D\u0642\u0642 \u0645\u0646 \u0625\u062C\u0627\u0628\u062A\u0643\u2026",mathCorrect:"\u0635\u062D\u064A\u062D",mathIncorrect:"\u062E\u0637\u0623",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,t)=>`\u062A\u0645 \u0627\u0639\u062A\u0645\u0627\u062F \u0627\u0644\u062F\u0631\u062C\u0629: ${e} / ${t}`,openResponseRubricTitle:"\u0633\u0644\u0651\u0645 \u0627\u0644\u062A\u0635\u062D\u064A\u062D",openResponseRubricCriterionPoints:(e,t)=>`${e} / ${t} \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,t)=>`\u0627\u0644\u062F\u0631\u062C\u0629 \u0627\u0644\u0645\u0642\u062A\u0631\u062D\u0629: ${e} / ${t}`,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",audioPlay:"\u062A\u0634\u063A\u064A\u0644",audioPause:"\u0625\u064A\u0642\u0627\u0641 \u0645\u0624\u0642\u062A",audioReplay:"\u0625\u0639\u0627\u062F\u0629 \u0627\u0644\u0627\u0633\u062A\u0645\u0627\u0639",audioSpeed:e=>`\u0627\u0644\u0633\u0631\u0639\u0629 ${e}`,audioRate:e=>`${e}\xD7`,audioPosition:"\u0627\u0644\u0645\u0648\u0636\u0639 \u0641\u064A \u0627\u0644\u062A\u0633\u062C\u064A\u0644 \u0627\u0644\u0635\u0648\u062A\u064A",audioTimeOf:(e,t)=>`${e} \u0645\u0646 ${t}`,audioPlaysLeft:e=>e===1?"\u0628\u0642\u064A \u0627\u0633\u062A\u0645\u0627\u0639 \u0648\u0627\u062D\u062F":e===2?"\u0628\u0642\u064A \u0627\u0633\u062A\u0645\u0627\u0639\u0627\u0646":`\u0628\u0642\u064A\u062A ${e} \u0627\u0633\u062A\u0645\u0627\u0639\u0627\u062A`,audioNoPlaysLeft:"\u0644\u0645 \u064A\u0628\u0642 \u0623\u064A \u0627\u0633\u062A\u0645\u0627\u0639",audioUnavailable:"\u062A\u0639\u0630\u0631 \u062A\u0634\u063A\u064A\u0644 \u0647\u0630\u0627 \u0627\u0644\u062A\u0633\u062C\u064A\u0644 \u0627\u0644\u0635\u0648\u062A\u064A.",recorderUpTo:e=>`\u062D\u062A\u0649 ${e}`,recorderRecord:"\u062A\u0633\u062C\u064A\u0644",recorderRecordingAria:"\u062C\u0627\u0631\u064D \u0627\u0644\u062A\u0633\u062C\u064A\u0644",recorderSaving:e=>`\u062C\u0627\u0631\u064D \u0627\u0644\u0625\u0631\u0633\u0627\u0644 ${e}\u066A`,recorderSaved:"\u062A\u0645 \u0627\u0644\u062D\u0641\u0638",recorderRecordAgain:"\u0625\u0639\u0627\u062F\u0629 \u0627\u0644\u062A\u0633\u062C\u064A\u0644",recorderCancel:"\u0625\u0644\u063A\u0627\u0621",recorderFailed:"\u0644\u0645 \u064A\u062A\u0645 \u0625\u0631\u0633\u0627\u0644 \u062A\u0633\u062C\u064A\u0644\u0643. \u062A\u062D\u0642\u0642 \u0645\u0646 \u0627\u062A\u0635\u0627\u0644\u0643.",recorderRetry:"\u0625\u0639\u0627\u062F\u0629 \u0627\u0644\u0645\u062D\u0627\u0648\u0644\u0629",recorderUnsupported:"\u0644\u0627 \u064A\u0645\u0643\u0646 \u0644\u0647\u0630\u0627 \u0627\u0644\u0645\u062A\u0635\u0641\u062D \u0627\u0644\u062A\u0633\u062C\u064A\u0644. \u062C\u0631\u0651\u0628 \u0625\u0635\u062F\u0627\u0631\u064B\u0627 \u062D\u062F\u064A\u062B\u064B\u0627 \u0645\u0646 Chrome \u0623\u0648 Safari \u0623\u0648 Firefox.",recorderUnavailableHere:"\u0627\u0644\u062A\u0633\u062C\u064A\u0644 \u063A\u064A\u0631 \u0645\u062A\u0627\u062D \u0647\u0646\u0627.",recorderNone:"\u0644\u0627 \u064A\u0648\u062C\u062F \u062A\u0633\u062C\u064A\u0644",sheetToolsAria:"\u062D\u0631\u0651\u0631 \u0625\u062C\u0627\u0628\u062A\u0643",sheetKeysAria:"\u0645\u0641\u0627\u062A\u064A\u062D \u0627\u0644\u0631\u064A\u0627\u0636\u064A\u0627\u062A",sheetMoreKeys:"\u0627\u0644\u0645\u0632\u064A\u062F",sheetKeyPower:"\u0645\u0631\u0628\u0651\u0639",sheetKeyFraction:"\u0643\u0633\u0631",sheetKeyRoot:"\u062C\u0630\u0631 \u062A\u0631\u0628\u064A\u0639\u064A",sheetKeyPi:"\u0628\u0627\u064A",sheetKeyLe:"\u0623\u0635\u063A\u0631 \u0645\u0646 \u0623\u0648 \u064A\u0633\u0627\u0648\u064A",sheetKeyGe:"\u0623\u0643\u0628\u0631 \u0645\u0646 \u0623\u0648 \u064A\u0633\u0627\u0648\u064A",sheetKeyNe:"\u0644\u0627 \u064A\u0633\u0627\u0648\u064A",sheetKeyIn:"\u064A\u0646\u062A\u0645\u064A \u0625\u0644\u0649",sheetFormulaUnwrap:"\u0625\u0631\u062C\u0627\u0639\u0647\u0627 \u0646\u0635\u064B\u0651\u0627",sheetKeyboardClose:"\u0625\u063A\u0644\u0627\u0642 \u0644\u0648\u062D\u0629 \u0645\u0641\u0627\u062A\u064A\u062D \u0627\u0644\u0631\u064A\u0627\u0636\u064A\u0627\u062A",sheetPhoto:"\u0635\u0648\u0631\u0629 \u0648\u0631\u0642\u062A\u064A",sheetHandwriting:"\u0627\u0644\u0643\u062A\u0627\u0628\u0629 \u0628\u0627\u0644\u064A\u062F",sheetPlaceholder:"\u0627\u0643\u062A\u0628 \u0625\u062C\u0627\u0628\u062A\u0643 \u0647\u0646\u0627 \u0645\u0639 \u0627\u0644\u0631\u064A\u0627\u0636\u064A\u0627\u062A: x^2 \u06481/2 \u0648sqrt \u062A\u0635\u0628\u062D x\xB2 \u0648\xBD \u0648\u221A.",sheetClose:"\u0625\u063A\u0644\u0627\u0642",sheetPhotoTitle:"\u0635\u0648\u0631\u0629 \u0648\u0631\u0642\u062A\u0643",sheetPhotoPhoneHelp:"\u0627\u0645\u0633\u062D \u0647\u0630\u0627 \u0627\u0644\u0631\u0645\u0632 \u0628\u0647\u0627\u062A\u0641\u0643 \u0648\u0635\u0648\u0651\u0631 \u0648\u0631\u0642\u062A\u0643. \u0633\u062A\u0638\u0647\u0631 \u0627\u0644\u0635\u0648\u0631 \u0647\u0646\u0627.",sheetPhotoOr:"\u0623\u0648",sheetPhotoUpload:"\u062A\u062D\u0645\u064A\u0644 \u0635\u0648\u0631\u0629",sheetPhotoWebcam:"\u0627\u0633\u062A\u0639\u0645\u0627\u0644 \u0643\u0627\u0645\u064A\u0631\u0627 \u0647\u0630\u0627 \u0627\u0644\u062D\u0627\u0633\u0648\u0628",sheetPhotoTake:"\u0627\u0644\u062A\u0642\u0627\u0637 \u0635\u0648\u0631\u0629",sheetPhotoGallery:"\u0627\u062E\u062A\u064A\u0627\u0631 \u0635\u0648\u0631\u0629",sheetPhotoShoot:"\u0627\u0644\u062A\u0642\u0637 \u0627\u0644\u0635\u0648\u0631\u0629",sheetPhotoReading:"\u062C\u0627\u0631\u064D \u0642\u0631\u0627\u0621\u0629 \u0648\u0631\u0642\u062A\u0643\u2026",sheetPhotoCheck:"\u0631\u0627\u062C\u0639 \u0645\u0627 \u062A\u0645\u0651\u062A \u0642\u0631\u0627\u0621\u062A\u0647 \u0648\u0635\u062D\u0651\u062D\u0647 \u0642\u0628\u0644 \u0627\u0644\u0625\u0631\u0633\u0627\u0644.",sheetPhotoFailed:"\u062A\u0639\u0630\u0651\u0631\u062A \u0642\u0631\u0627\u0621\u0629 \u0647\u0630\u0647 \u0627\u0644\u0635\u0648\u0631\u0629. \u0623\u0639\u062F \u0627\u0644\u0645\u062D\u0627\u0648\u0644\u0629 \u0645\u0639 \u0625\u0636\u0627\u0621\u0629 \u0623\u0641\u0636\u0644\u060C \u0623\u0648 \u0627\u0643\u062A\u0628 \u0625\u062C\u0627\u0628\u062A\u0643.",sheetPhotoCameraFailed:"\u0644\u0645 \u062A\u064F\u0641\u062A\u062D \u0627\u0644\u0643\u0627\u0645\u064A\u0631\u0627. \u062D\u0645\u0651\u0644 \u0635\u0648\u0631\u0629 \u0628\u062F\u0644\u064B\u0627 \u0645\u0646 \u0630\u0644\u0643.",sheetPhotoRetry:"\u0625\u0639\u0627\u062F\u0629 \u0627\u0644\u0645\u062D\u0627\u0648\u0644\u0629",sheetPhotoYours:"\u0635\u0648\u0631\u062A\u0643",sheetPhotoRemove:"\u062D\u0630\u0641 \u0647\u0630\u0647 \u0627\u0644\u0635\u0648\u0631\u0629",sheetPadTitle:"\u0643\u062A\u0627\u0628\u0629 \u0635\u064A\u063A\u0629 \u0628\u0627\u0644\u064A\u062F",sheetPadHelp:"\u0627\u0643\u062A\u0628 \u0647\u0646\u0627 \u0628\u0625\u0635\u0628\u0639\u0643 \u0623\u0648 \u0628\u0642\u0644\u0645.",sheetPadFailed:"\u0644\u0645 \u064A\u062A\u0645\u0651 \u0627\u0644\u062A\u0639\u0631\u0651\u0641 \u0639\u0644\u064A\u0647\u0627. \u0627\u0643\u062A\u0628 \u0628\u062E\u0637 \u0623\u0643\u0628\u0631 \u0642\u0644\u064A\u0644\u064B\u0627\u060C \u0623\u0648 \u0627\u0643\u062A\u0628\u0647\u0627 \u0628\u0627\u0644\u0645\u0641\u0627\u062A\u064A\u062D.",sheetPadUndo:"\u062A\u0631\u0627\u062C\u0639",sheetPadClear:"\u0645\u0633\u062D",sheetPadInsert:"\u0625\u062F\u0631\u0627\u062C",kbMaths:"\u0644\u0648\u062D\u0629 \u0645\u0641\u0627\u062A\u064A\u062D \u0627\u0644\u0631\u064A\u0627\u0636\u064A\u0627\u062A",kbPhone:"\u0644\u0648\u062D\u0629 \u0645\u0641\u0627\u062A\u064A\u062D \u0627\u0644\u0647\u0627\u062A\u0641",kbToMaths:"\u0627\u0643\u062A\u0628\u0647\u0627 \u0631\u064A\u0627\u0636\u064A\u0627\u062A",kbToText:"\u0625\u0631\u062C\u0627\u0639\u0647\u0627 \u0646\u0635\u064B\u0651\u0627",kbHide:"\u0625\u062E\u0641\u0627\u0621 \u0644\u0648\u062D\u0629 \u0627\u0644\u0645\u0641\u0627\u062A\u064A\u062D",kbTabBasic:"\u0627\u0644\u0623\u0639\u062F\u0627\u062F",kbTabAnalysis:"\u0627\u0644\u062A\u062D\u0644\u064A\u0644",kbTabSets:"\u0627\u0644\u0645\u062C\u0645\u0648\u0639\u0627\u062A \u0648\u0627\u0644\u0645\u062C\u0627\u0644\u0627\u062A",kbTabMatrices:"\u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0627\u062A \u0648\u0627\u0644\u0623\u0646\u0638\u0645\u0629",kbTabGreek:"\u0627\u0644\u062D\u0631\u0648\u0641 \u0627\u0644\u064A\u0648\u0646\u0627\u0646\u064A\u0629",kbKeyPowerN:"\u0623\u064F\u0633",kbKeyAbs:"\u0627\u0644\u0642\u064A\u0645\u0629 \u0627\u0644\u0645\u0637\u0644\u0642\u0629",kbKeyBrackets:"\u0623\u0642\u0648\u0627\u0633",kbKeyBackspace:"\u062D\u0630\u0641",kbKeyEnter:"\u0633\u0637\u0631 \u062C\u062F\u064A\u062F",kbKeyLeft:"\u064A\u0633\u0627\u0631",kbKeyRight:"\u064A\u0645\u064A\u0646",mathSlotPlaceholder:"\u0627\u0644\u0625\u062C\u0627\u0628\u0629"};var vl={en:Xt,fr:sn,ar:cn},xo=yl(null);function ae(){return ws(xo)??Xt}function Rr(e){let t=ws(xo);return e&&vl[e]||t||Xt}function Cr({locale:e,children:t}){let r=Rr(e);return xl(xo.Provider,{value:r,children:t})}var ks=wl(null);function ln({initial:e,onChange:t,children:r}){let n=Jt({...e??{}}),o=Jt(t);o.current=t;let a=Sl(()=>({get:s=>n.current[s]??0,set:(s,i)=>{n.current={...n.current,[s]:i},o.current?.(n.current)}}),[]);return qe(ks.Provider,{value:a,children:r})}var wo=[.75,1,1.25,1.5],ko=.5;function Zt(e){if(!Number.isFinite(e)||e<0)return"0:00";let t=Math.round(e);return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`}var So="edpire:audio-play";function ct({src:e,maxPlays:t,learnerSpeed:r,speed:n,allowSeek:o,durationHint:a,playsKey:s,playsUsed:i,onPlaysUsedChange:c,disabled:l=!1,label:d,className:m}){let u=ae(),h=kl(ks),f=s??e,p=t&&t>0?Math.floor(t):0,k=o!==!1,y=r!==!1,S=n&&n>=.25&&n<=4?n:1,b=Jt(null),C=Jt(null),[A,w]=Dt(!1),[T,N]=Dt(0),[M,R]=Dt(a&&a>0?a:0),[v,x]=Dt(!1),[B,g]=Dt(!1),[P,$]=Dt(S),[q,J]=Dt(()=>i??h?.get(f)??0),I=Jt(!1),Z=Jt(!1);Ar(()=>{i!==void 0&&J(i)},[i]),Ar(()=>$(S),[S]),Ar(()=>{b.current&&(b.current.playbackRate=P)},[P]),Ar(()=>{g(!1),x(!1),N(0),w(!1),I.current=!1,a&&a>0||R(0);let U=b.current;U&&U.readyState>=1&&Number.isFinite(U.duration)&&U.duration>0&&R(U.duration)},[e]),Ar(()=>{let U=ne=>{let oe=b.current;oe&&ne.detail!==oe&&!oe.paused&&oe.pause()};return window.addEventListener(So,U),()=>window.removeEventListener(So,U)},[]);let ve=p>0&&q>=p&&!I.current,E=p>0?Math.max(0,p-q):null,_=l||B||ve,W=vo(()=>{if(p===0)return!0;if(q>=p)return!1;let U=q+1;return J(U),I.current=!0,i===void 0&&h?.set(f,U),c?.(U),!0},[p,q,i,h,f,c]),z=vo(()=>{let U=b.current;if(!U||l||B)return;if(!U.paused){U.pause();return}(v||U.currentTime<ko)&&!I.current&&!W()||((v||U.currentTime>=(U.duration||1/0))&&(U.currentTime=0),x(!1),U.playbackRate=P,window.dispatchEvent(new CustomEvent(So,{detail:U})),U.play().catch(()=>w(!1)))},[l,B,v,W,P]),H=M>0?M:0,se=H>0?Math.min(1,T/H):0,pe=vo(U=>{let ne=b.current;if(!ne||!k||_||H===0)return;let oe=Math.max(0,Math.min(H,U));if(p>0&&oe<ko&&T>=ko&&I.current&&(I.current=!1,!ne.paused&&!W())){ne.pause();return}ne.currentTime=oe,N(oe),x(!1)},[k,_,H,p,T,W]),ue=U=>{let ne=C.current;if(!ne)return 0;let oe=ne.getBoundingClientRect(),Ue=getComputedStyle(ne).direction==="rtl"?(oe.right-U)/oe.width:(U-oe.left)/oe.width;return Math.max(0,Math.min(1,Ue))},ge=U=>{!k||_||H===0||(U.preventDefault(),Z.current=!0,U.currentTarget.setPointerCapture(U.pointerId),pe(ue(U.clientX)*H))},V=U=>{Z.current&&pe(ue(U.clientX)*H)},ee=()=>{Z.current=!1},be=U=>{if(!k||_||H===0)return;let ne=C.current?getComputedStyle(C.current).direction==="rtl":!1,oe=5,fe=null;U.key==="ArrowRight"?fe=T+(ne?-oe:oe):U.key==="ArrowLeft"?fe=T+(ne?oe:-oe):U.key==="ArrowUp"?fe=T+oe:U.key==="ArrowDown"?fe=T-oe:U.key==="Home"?fe=0:U.key==="End"&&(fe=H),fe!==null&&(U.preventDefault(),pe(fe))},ce=()=>{let U=wo.indexOf(P);$(wo[(U+1)%wo.length]??1)},ie=(A||T>0)&&!v&&H>0,me=Zt(ie?H-T:H),De=A?qe(Rl,{size:18,fill:"currentColor",strokeWidth:0,"aria-hidden":!0}):v&&!ve?qe(Al,{size:18,"aria-hidden":!0}):qe(Cl,{size:18,fill:"currentColor",strokeWidth:0,"aria-hidden":!0,style:{marginInlineStart:2}}),at=A?u.audioPause:v?u.audioReplay:u.audioPlay;return yo("span",{role:"group","aria-label":d,className:`edp-audio${_?" edp-audio--off":""}${m?` ${m}`:""}`,"data-audio-player":"",children:[yo("span",{className:"edp-audio-bar",children:[qe("button",{type:"button",className:"edp-audio-play",onClick:z,disabled:_,"aria-label":at,children:De}),yo("span",{ref:C,className:`edp-audio-track${k&&!_?" edp-audio-track--seek":""}`,role:"slider",tabIndex:k&&!_?0:-1,"aria-label":u.audioPosition,"aria-valuemin":0,"aria-valuemax":Math.round(H),"aria-valuenow":Math.round(T),"aria-valuetext":u.audioTimeOf(Zt(T),Zt(H)),"aria-disabled":!k||_,onPointerDown:ge,onPointerMove:V,onPointerUp:ee,onPointerCancel:ee,onKeyDown:be,children:[qe("span",{className:"edp-audio-rail",children:qe("span",{className:"edp-audio-fill",style:{width:`${se*100}%`}})}),k&&!_&&H>0&&qe("span",{className:"edp-audio-thumb",style:{insetInlineStart:`${se*100}%`}})]}),qe("span",{className:"edp-audio-time",dir:"ltr",children:me}),y&&!B&&qe("button",{type:"button",className:"edp-audio-speed",dir:"ltr",onClick:ce,disabled:l,"aria-label":u.audioSpeed(u.audioRate(P)),children:u.audioRate(P)})]}),(B||E!==null)&&qe("span",{className:"edp-audio-note","aria-live":"polite",children:qe("bdi",{children:B?u.audioUnavailable:E===0&&!I.current?u.audioNoPlaysLeft:u.audioPlaysLeft(E??0)})}),qe("audio",{ref:b,src:e||void 0,preload:"metadata",onLoadedMetadata:U=>{let ne=U.currentTarget;ne.playbackRate=P,Number.isFinite(ne.duration)&&ne.duration>0?R(ne.duration):Nl(ne,oe=>R(fe=>fe>0?fe:oe))},onDurationChange:U=>{let ne=U.currentTarget.duration;Number.isFinite(ne)&&ne>0&&R(ne)},onTimeUpdate:U=>{Z.current||N(U.currentTarget.currentTime)},onPlay:()=>w(!0),onPause:()=>w(!1),onEnded:()=>{w(!1),x(!0),I.current=!1,N(H)},onError:()=>{e&&g(!0)}})]})}function Nl(e,t){let r=()=>{e.removeEventListener("timeupdate",r),Number.isFinite(e.duration)&&e.duration>0&&t(e.duration),e.currentTime=0};e.addEventListener("timeupdate",r);try{e.currentTime=1e101}catch{e.removeEventListener("timeupdate",r)}}import _l from"katex";import"katex/dist/contrib/mhchem.js";var Tl={"\\d":"\\mathrm{d}","\\R":"\\mathbb{R}","\\N":"\\mathbb{N}","\\Z":"\\mathbb{Z}","\\Q":"\\mathbb{Q}","\\C":"\\mathbb{C}"};function Ae(e,t,r=!0){try{return _l.renderToString(e,{displayMode:t,output:r?"htmlAndMathml":"html",throwOnError:!1,errorColor:"#cc0000",macros:Tl,strict:!1})}catch(n){return`<span class="katex-error" style="color:#cc0000" title="${String(n)}">${e}</span>`}}function D(e){return`calc(${typeof e=="number"?`${e}px`:e} * var(--edp-scale, 1))`}function ke(e){return{width:D(e),height:D(e)}}function et(e){if(e==null||e==="")return;if(typeof e=="number")return D(e);let t=String(e).trim();return/^\d+(\.\d+)?px$/.test(t)?D(t):t}import{createContext as Pl}from"react";var Nr=Pl(!1),dn="1px solid #d1d5db",Ml="#f3f4f6",El="#e3e1dc",Ll="var(--card, #fff)",zt="edp-table-first",Ss={overflowX:"auto",margin:`${D("1.25rem")} 0`},Rs={left:!1,right:!1,held:0,rtl:!1};function Cs(e,t,r,n=0){return{left:t.left<e.left-1,right:t.right>e.right+1,held:n,rtl:r}}function As(e,t){return Math.max(80,Math.round((e-t)*.8))}var Ro={borderCollapse:"separate",borderSpacing:0,width:"100%",tableLayout:"auto",fontSize:D("0.875rem"),lineHeight:1.3,borderBlockStart:dn,borderInlineStart:dn};function _r(e){let t=e.gray?El:e.header?Ml:e.sticky?Ll:void 0;return{borderBlockEnd:dn,borderInlineEnd:dn,padding:`${D("4px")} ${D("6px")}`,verticalAlign:"middle",overflowWrap:"normal",wordBreak:"normal",hyphens:"manual",...t?{background:t}:{},...e.header?{fontWeight:600}:{},...e.sticky?{position:"sticky",insetInlineStart:0,zIndex:1}:{}}}function Tr(e){return Object.entries(e).map(([t,r])=>`${t.replace(/[A-Z]/g,n=>`-${n.toLowerCase()}`)}:${r}`).join(";")}function Co(e){let t=[],r=new Set,n=[];(e??[]).forEach((s,i)=>{let c=0;(s.content??[]).forEach(l=>{for(;n[i]?.[c];)c++;let d=Math.max(1,l.attrs?.colspan??1),m=Math.max(1,l.attrs?.rowspan??1);for(let u=i;u<i+m;u++){let h=n[u]??(n[u]=[]);for(let f=c;f<c+d;f++)h[f]=!0}for(let u=0;u<d;u++){let h=l.attrs?.colwidth?.[u];h&&t[c+u]==null&&(t[c+u]=h)}c===0&&d===1&&r.add(l),c+=d})});let o=n.reduce((s,i)=>Math.max(s,i.length),0);return{columnWidths:t.some(s=>s!=null)?Array.from({length:o},(s,i)=>t[i]??null):[],stickyCells:r}}function Ao(e){return e.replace(/(\d) (?=\d)/g,"$1\xA0").replace(/(\d) (?=[\p{L}%\p{Sc}]{1,3}(?![\p{L}\p{N}]))/gu,"$1\xA0")}import{jsx as lt,jsxs as No}from"react/jsx-runtime";import{useCallback as Il,useEffect as $l,useLayoutEffect as Fl,useRef as Dl,useState as zl}from"react";var Bl=typeof window<"u"?Fl:$l;function Ns({side:e}){return lt("svg",{viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2.25",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:lt("path",{d:e==="left"?"M15 6l-6 6 6 6":"M9 6l6 6-6 6"})})}function _s({children:e}){let t=ae(),r=Dl(null),[n,o]=zl(Rs),a=Il(()=>{let m=r.current,u=m?.querySelector("table");if(!m||!u)return;let h=m.querySelector(`.${zt}`),f=Cs(m.getBoundingClientRect(),u.getBoundingClientRect(),getComputedStyle(m).direction==="rtl",h?h.getBoundingClientRect().width:0);o(p=>p.left===f.left&&p.right===f.right&&p.held===f.held&&p.rtl===f.rtl?p:f)},[]);Bl(()=>{let m=r.current;if(!m)return;a(),m.addEventListener("scroll",a,{passive:!0});let u=typeof ResizeObserver<"u"?new ResizeObserver(a):null;u?.observe(m);let h=m.querySelector("table");return h&&u?.observe(h),()=>{m.removeEventListener("scroll",a),u?.disconnect()}},[a]);let s=m=>{let u=r.current;u&&u.scrollBy({left:m*As(u.clientWidth,n.held),behavior:"smooth"})},i=n.left||n.right,c=m=>i?lt("div",{className:`edp-table-arrows edp-table-arrows--${m}`,children:No("span",{dir:"ltr",className:"edp-table-arrows__pair",children:[lt("button",{type:"button",className:"edp-table-arrow",onClick:()=>s(-1),disabled:!n.left,"aria-label":t.tableScrollLeft,children:lt(Ns,{side:"left"})}),lt("button",{type:"button",className:"edp-table-arrow",onClick:()=>s(1),disabled:!n.right,"aria-label":t.tableScrollRight,children:lt(Ns,{side:"right"})})]})}):null,l=n.rtl?0:n.held,d=n.rtl?n.held:0;return No("div",{className:"edp-table-frame",style:{margin:`${D("1.25rem")} 0`},children:[c("top"),No("div",{style:{position:"relative"},children:[lt("div",{ref:r,className:"edp-table-scroll",style:{overflowX:"auto"},children:e}),n.left&<("span",{className:"edp-table-shade edp-table-shade--left",style:{left:l},"aria-hidden":"true"}),n.right&<("span",{className:"edp-table-shade edp-table-shade--right",style:{right:d},"aria-hidden":"true"})]}),c("bottom")]})}var Ts={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"}},Ps={border:"#2563eb",background:"#e0f2fe"},Ms={border:"#dc2626",background:"#fee2e2"};function Ol(e){return{display:"inline-block",verticalAlign:"middle",border:`2px solid ${e?.border||Ps.border}`,background:e?.background||Ps.background,borderRadius:D("4px"),padding:"0.17em 0.37em"}}function jl(e){let t=e?.shape==="circle"?"50%":"9999px";return{display:"inline-block",verticalAlign:"middle",border:`2px solid ${e?.border||Ms.border}`,background:e?.background||Ms.background,borderRadius:t,padding:"0.15em 0.45em"}}function ql(e,t){if(!(!e&&!t))return{...e?{textAlign:e}:{},...t?{margin:0}:{}}}function Ge(e,t,r){return Y("div",{className:"exercise-content",children:e.content.map((n,o)=>ze(n,`node-${o}`,t,r))})}var Hl=/^[\u00a0\u202f ]?[.,;:!?\u2026)\]}\u00bb\u201d\u2019%\u060c\u061b\u061f]+/,Kl=new Set(["blank","inlineChoiceSet"]);function Es(e,t,r,n){let o=[],a=e??[];n?.inInline||(n={...n,inInline:!0});for(let s=0;s<a.length;s++){let i=a[s],c=a[s+1],l=Kl.has(i.type)&&c?.type==="text"?Hl.exec(c.text??"")?.[0]:void 0;if(!l||!c){o.push(ze(i,`${t}-${s}`,r,n));continue}let d=(c.text??"").slice(l.length);o.push(Ls("span",{style:{whiteSpace:"nowrap"},children:[Y("span",{style:{whiteSpace:"normal"},children:ze(i,`${t}-${s}-a`,r,n)}),ze({...c,text:l},`${t}-${s}-p`,r,n)]},`${t}-${s}`)),d&&o.push(ze({...c,text:d},`${t}-${s+1}`,r,n)),s++}return o}function ze(e,t,r,n){switch(e.type){case"choiceSet":case"inlineChoiceSet":return Y(un,{node:e,validationFeedback:r?.get(e.id)},t);case"blank":return e.attrs.mode==="typed"?Y(mn,{node:e,validationFeedback:r?.get(e.id)},t):Y(fn,{node:e,validationFeedback:r?.get(e.id)},t);case"blankPool":return Y(hn,{node:e},t);case"inlinePool":return Y(gn,{node:e},t);case"matchingSet":return Y(bn,{node:e,validationFeedback:r?.get(e.id)},t);case"aiAnswerInput":return Y(xn,{node:e,validationFeedback:r?.get(e.id),readOnly:n?.readOnly,mediaHandler:n?.mediaHandler,answerSheetHandler:n?.answerSheetHandler},t);case"openResponseNode":return Y(yn,{node:e,validationFeedback:r?.get(e.id),readOnly:n?.readOnly,mediaHandler:n?.mediaHandler,answerSheetHandler:n?.answerSheetHandler},t);case"mathResponse":{let o=Y(vn,{nodeId:e.id,placeholder:e.attrs?.placeholder,hint:e.attrs?.hint,validationFeedback:r?.get(e.id),readOnly:n?.readOnly},t);return n?.inInline?o:Y("p",{className:"edp-slot-line",children:o},t)}case"codingResponse":return Y(wn,{node:e,validationFeedback:r?.get(e.id),readOnly:n?.readOnly,executor:n?.codeExecutor},t);case"aiEvaluationConfig":return null;case"paragraph":{let o=e.attrs,a=o?.textAlign,s=o?.dir||void 0;return Y("p",{dir:s,style:ql(a,n?.inTable),children:Es(e.content,t,r,n)},t)}case"heading":{let o=e.attrs.level??1,a=`h${o}`,s=e.attrs,i=s?.textAlign,c=s?.dir||void 0,l=Ts[o]??Ts[3];return Y(a,{dir:c,style:{...l,...i?{textAlign:i}:{}},children:Es(e.content,t,r,n)},t)}case"blockquote":{let o=e.attrs,a=o?.dir||void 0,s=o?.textAlign;return Y("blockquote",{dir:a,style:{borderInlineStart:"3px solid #d6d3cc",paddingInlineStart:"1em",margin:"0.75em 0",color:"#565b66",fontStyle:"italic",...s?{textAlign:s}:{}},children:e.content?.map((i,c)=>ze(i,`${t}-${c}`,r,n))},t)}case"text":{let o=e,a=n?.inTable?Ao(o.text??""):o.text??"",s=o.marks??[];if(s.length===0)return Y("span",{children:a},t);let i={};for(let l of s)l.type==="textStyle"&&(l.attrs?.color&&(i.color=l.attrs.color),l.attrs?.fontSize&&(i.fontSize=l.attrs.fontSize),l.attrs?.fontFamily&&(i.fontFamily=l.attrs.fontFamily));let c=a;for(let l of s)switch(l.type){case"bold":c=Y("strong",{children:c});break;case"italic":c=Y("em",{children:c});break;case"underline":c=Y("u",{children:c});break;case"strike":c=Y("s",{children:c});break;case"code":c=Y("code",{children:c});break;case"subscript":c=Y("sub",{children:c});break;case"superscript":c=Y("sup",{children:c});break;case"boxedText":c=Y("span",{style:Ol(l.attrs),children:c});break;case"circleText":c=Y("span",{style:jl(l.attrs),children:c});break}return Y("span",{style:Object.keys(i).length>0?i:void 0,children:c},t)}case"hardBreak":return Y("br",{},t);case"resizableImage":return Y("img",{src:e.attrs?.src||void 0,alt:e.attrs?.alt||"",style:{display:"inline-block",verticalAlign:"middle",width:et(e.attrs?.width||void 0)??"auto",height:et(e.attrs?.height||void 0)??"auto",maxWidth:"100%"}},t);case"resizableAudio":{let o=e.attrs??{src:""},a=n?.readOnly===!0;return Y(ct,{src:o.src||"",maxPlays:a?null:o.maxPlays,learnerSpeed:o.learnerSpeed,speed:o.speed,allowSeek:a?null:o.allowSeek},t)}case"resizableVideo":return Y("video",{src:e.attrs?.src||void 0,controls:!0,style:{display:"inline-block",verticalAlign:"middle",width:et(e.attrs?.width||void 0)??"auto",height:et(e.attrs?.height||void 0)??"auto",maxWidth:"100%"}},t);case"youtubeEmbed":return Y("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:et(e.attrs?.width||480),height:et(e.attrs?.height||270)}},t);case"inlineMath":return Y("span",{dir:"ltr",style:{unicodeBidi:"isolate",display:"inline-block"},className:"math-inline",dangerouslySetInnerHTML:{__html:Ae(e.attrs?.latex??"",!1,!0)}},t);case"blockMath":return Y("div",{dir:"ltr",style:{unicodeBidi:"isolate",textAlign:"center",margin:"1em 0"},className:"math-block",dangerouslySetInnerHTML:{__html:Ae(e.attrs?.latex??"",!0,!0)}},t);case"variable":return Y("span",{className:"variable",children:`{${e.attrs?.name}}`},t);default:{let o=e;if(o.type==="bulletList")return Y("ul",{style:{listStyleType:"disc",paddingLeft:"1.5em",margin:"0.5em 0"},children:o.content?.map((a,s)=>ze(a,`${t}-${s}`,r,n))},t);if(o.type==="orderedList")return Y("ol",{style:{listStyleType:"decimal",paddingLeft:"1.5em",margin:"0.5em 0"},children:o.content?.map((a,s)=>ze(a,`${t}-${s}`,r,n))},t);if(o.type==="listItem")return Y("li",{children:o.content?.map((a,s)=>ze(a,`${t}-${s}`,r,n))},t);if(o.type==="table"){let a=Co(o.content),s={...n,inTable:!0,stickyCells:a.stickyCells};return Y(_s,{children:Ls("table",{style:Ro,children:[a.columnWidths.length>0&&Y("colgroup",{children:a.columnWidths.map((i,c)=>Y("col",{style:i?{width:D(i)}:void 0},c))}),Y("tbody",{children:o.content?.map((i,c)=>ze(i,`${t}-${c}`,r,s))})]})},t)}return o.type==="tableRow"?Y("tr",{children:o.content?.map((a,s)=>ze(a,`${t}-${s}`,r,n))},t):o.type==="tableCell"?Y("td",{colSpan:o.attrs?.colspan,rowSpan:o.attrs?.rowspan,className:n?.stickyCells?.has(o)?zt:void 0,style:_r({header:!1,gray:!!o.attrs?.gray,sticky:!!n?.stickyCells?.has(o)}),children:Y(Nr.Provider,{value:!0,children:o.content?.map((a,s)=>ze(a,`${t}-${s}`,r,n))})},t):o.type==="tableHeader"?Y("th",{colSpan:o.attrs?.colspan,rowSpan:o.attrs?.rowspan,className:n?.stickyCells?.has(o)?zt:void 0,style:_r({header:!0,gray:!!o.attrs?.gray,sticky:!!n?.stickyCells?.has(o)}),children:Y(Nr.Provider,{value:!0,children:o.content?.map((a,s)=>ze(a,`${t}-${s}`,r,n))})},t):(console.warn(`Unknown node type during interpretation: ${e.type}`),null)}}}function xe(e,t){return e.map(r=>{if(r.type==="text"){let n=Bt(t?.inTable?Ao(r.text??""):r.text??""),o=r.marks??[],a=[];for(let s of o)s.type==="textStyle"&&(s.attrs?.color&&a.push(`color:${s.attrs.color}`),s.attrs?.fontSize&&a.push(`font-size:${s.attrs.fontSize}`),s.attrs?.fontFamily&&a.push(`font-family:${s.attrs.fontFamily}`));a.length>0&&(n=`<span style="${a.join(";")}">${n}</span>`);for(let s of o)switch(s.type){case"bold":n=`<strong>${n}</strong>`;break;case"italic":n=`<em>${n}</em>`;break;case"underline":n=`<u>${n}</u>`;break;case"strike":n=`<s>${n}</s>`;break;case"code":n=`<code>${n}</code>`;break;case"subscript":n=`<sub>${n}</sub>`;break;case"superscript":n=`<sup>${n}</sup>`;break;case"boxedText":{let i=s.attrs?.border||"#2563eb",c=s.attrs?.background||"#e0f2fe";n=`<span style="display:inline-block;vertical-align:middle;border:2px solid ${i};background:${c};border-radius:${D("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(r.type==="paragraph"){let n=r.content?xe(r.content,t):"",o=r.attrs?.dir,a=r.attrs?.textAlign,s=o?` dir="${o}"`:"",i=[a?`text-align:${a}`:"",t?.inTable?"margin:0":""].filter(Boolean).join(";"),c=i?` style="${i}"`:"";return t?.stripParagraphs?n:`<p${s}${c}>${n}</p>`}if(r.type==="hardBreak")return"<br/>";if(r.type==="table"){let n=Co(r.content),o=r.content?xe(r.content,{...t,inTable:!0,stickyCells:n.stickyCells}):"",a=n.columnWidths.length?`<colgroup>${n.columnWidths.map(s=>s?`<col style="width:${D(s)}">`:"<col>").join("")}</colgroup>`:"";return`<div style="${Tr(Ss)}"><table style="${Tr(Ro)}">${a}<tbody>${o}</tbody></table></div>`}if(r.type==="tableRow")return`<tr>${r.content?xe(r.content,t):""}</tr>`;if(r.type==="tableCell"){let n=r.content?xe(r.content,t):"",o=r.attrs?.colspan?` colspan="${r.attrs.colspan}"`:"",a=r.attrs?.rowspan?` rowspan="${r.attrs.rowspan}"`:"",s=!!t?.stickyCells?.has(r),i=s?` class="${zt}"`:"";return`<td${o}${a}${i} style="${Tr(_r({header:!1,gray:!!r.attrs?.gray,sticky:s}))}">${n}</td>`}if(r.type==="tableHeader"){let n=r.content?xe(r.content,t):"",o=r.attrs?.colspan?` colspan="${r.attrs.colspan}"`:"",a=r.attrs?.rowspan?` rowspan="${r.attrs.rowspan}"`:"",s=!!t?.stickyCells?.has(r),i=s?` class="${zt}"`:"";return`<th${o}${a}${i} style="${Tr(_r({header:!0,gray:!!r.attrs?.gray,sticky:s}))}">${n}</th>`}if(r.type==="bulletList")return`<ul style="list-style-type:disc;padding-left:1.5em">${r.content?xe(r.content,t):""}</ul>`;if(r.type==="orderedList")return`<ol style="list-style-type:decimal;padding-left:1.5em">${r.content?xe(r.content,t):""}</ol>`;if(r.type==="listItem")return`<li>${r.content?xe(r.content,t):""}</li>`;if(r.type==="blockquote"){let n=r.content?xe(r.content,t):"";return`<blockquote${r.attrs?.dir?` dir="${r.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(r.type==="resizableImage"){let n=r.attrs??{},o=pn(n.width),a=pn(n.height);return`<img src="${Bt(n.src??"")}" alt="${Bt(n.alt??"")}" style="display:inline-block;vertical-align:middle;max-width:100%;${o?`width:${o};`:""}${a?`height:${a};`:""}"/>`}if(r.type==="resizableAudio"){let n=r.attrs??{};return`<audio controls preload="metadata" src="${Bt(n.src??"")}" style="display:inline-block;vertical-align:middle;width:${D("260px")};max-width:100%;height:${D("36px")}"></audio>`}if(r.type==="resizableVideo"){let n=r.attrs??{},o=pn(n.width),a=pn(n.height);return`<video src="${Bt(n.src??"")}" controls style="display:inline-block;vertical-align:middle;max-width:100%;${o?`width:${o};`:""}${a?`height:${a};`:""}"></video>`}if(r.type==="youtubeEmbed"){let n=r.attrs??{};return`<iframe src="https://www.youtube.com/embed/${Bt(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:${et(n.width||480)};height:${et(n.height||270)}"></iframe>`}return r.type==="inlineMath"?`<span dir="ltr" class="math-inline" style="unicode-bidi:isolate;display:inline-block">${Ae(r.attrs?.latex??"",!1,!0)}</span>`:r.type==="blockMath"?`<div dir="ltr" class="math-block" style="unicode-bidi:isolate;text-align:center;margin:1em 0">${Ae(r.attrs?.latex??"",!0,!0)}</div>`:r.type==="variable"?`<span class="variable">{${Bt(r.attrs?.name??"")}}</span>`:""}).join("")}function pn(e){return e==null||e===""?null:et(e)??null}function Bt(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}import{jsx as Wl}from"react/jsx-runtime";import{createContext as Ul,useContext as Is,useMemo as $s}from"react";var Vl={sm:.875,md:1,lg:1.25,xl:1.5},_o=Ul(null);function Gl(e,t){let r={...e??{}};if(t)for(let[n,o]of Object.entries(t))o!==void 0&&(r[n]=o);return r}function Yl(e){return typeof e=="number"?Number.isFinite(e)&&e>0?e:1:e?Vl[e]??1:1}function Ye(e){let t=e??{};return{scale:Yl(t.size),sizeSet:t.size!==void 0,choiceLabels:t.choiceLabels??"marks",choiceColumns:t.choiceColumns,layoutBy:t.layoutBy??"window",motion:t.motion??"full",shuffleSeed:t.shuffleSeed}}function He(e){let t=Is(_o);return $s(()=>Gl(t,e),[t,e?.size,e?.choiceLabels,e?.choiceColumns,e?.layoutBy,e?.motion,e?.shuffleSeed])}function Ke(){let e=Is(_o);return $s(()=>Ye(e),[e])}function We({display:e,children:t}){let r=He(e);return Wl(_o.Provider,{value:r,children:t})}function Qe(e){if(e.sizeSet)return{"--edp-scale":String(e.scale)}}function Ot(){let{motion:e}=Ke();return{hop:e==="none"?"":"animate-hop",shake:e==="full"?"animate-shake":"",wobble:e==="full"?"animate-wobble":""}}function Ql(e){let t=2166136261;for(let r=0;r<e.length;r++)t^=e.charCodeAt(r),t=Math.imul(t,16777619);return t>>>0}function Xl(e){return()=>{e=e+1831565813|0;let t=Math.imul(e^e>>>15,1|e);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}}function Pr(e,t){let r=[...e],n=Xl(Ql(t));for(let o=r.length-1;o>0;o--){let a=Math.floor(n()*(o+1));[r[o],r[a]]=[r[a],r[o]]}return r}import{Fragment as Fs,jsx as ye,jsxs as Jl}from"react/jsx-runtime";import{useState as kn,useEffect as zs,useRef as Ds,useLayoutEffect as Zl,useCallback as ed}from"react";import{createPortal as td}from"react-dom";import rd from"clsx";var nd=typeof window<"u"?Zl:zs;function To({node:e}){if(e.type==="text"){if(!e.marks||e.marks.length===0)return ye(Fs,{children:e.text});let t=e.text||"";for(let r of e.marks)r.type==="bold"?t=ye("strong",{children:t}):r.type==="italic"?t=ye("em",{children:t}):r.type==="underline"?t=ye("u",{children:t}):r.type==="strike"?t=ye("s",{children:t}):r.type==="textStyle"&&r.attrs?.color&&(t=ye("span",{style:{color:r.attrs.color},children:t}));return ye(Fs,{children:t})}if(e.type==="paragraph")return ye("span",{className:"block",children:e.content?.map((t,r)=>ye(To,{node:t},r))??ye("br",{})});if(e.type==="hardBreak")return ye("br",{});if(e.type==="inlineMath"||e.type==="blockMath"){let t=String(e.attrs?.latex??""),r=e.type==="blockMath";return ye("span",{className:r?"block text-center":void 0,dir:"ltr",dangerouslySetInnerHTML:{__html:Ae(t,r)}})}return e.content?ye("span",{className:"block",children:e.content.map((t,r)=>ye(To,{node:t},r))}):null}function od({nodes:e}){return ye("span",{className:"block space-y-1",style:{color:"var(--ink, #1d2025)"},children:e.map((t,r)=>ye(To,{node:t},r))})}function ad(e,t,r,n=8){let o=e.top-t.height-n;o<n&&(o=e.bottom+n);let a=e.left+e.width/2-t.width/2;return a=Math.max(n,Math.min(a,r-t.width-n)),{top:o,left:a}}function Nt({hint:e}){let t=ae(),[r,n]=kn(!1),[o,a]=kn(!1),[s,i]=kn(null),[c,l]=kn({}),d=Ds(null),m=Ds(null);zs(()=>{if(!o)return;let y=S=>{let b=S.target;d.current&&!d.current.contains(b)&&m.current&&!m.current.contains(b)&&(a(!1),n(!1))};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[o]);let u=ed(()=>{let y=d.current,S=m.current;!y||!S||i(ad(y.getBoundingClientRect(),S.getBoundingClientRect(),window.innerWidth))},[]);nd(()=>{if(!r){i(null);return}let y=d.current;if(y){let S=getComputedStyle(y);l({direction:S.direction,fontFamily:S.fontFamily,"--edp-scale":S.getPropertyValue("--edp-scale").trim()||"1"})}return u(),window.addEventListener("scroll",u,!0),window.addEventListener("resize",u),()=>{window.removeEventListener("scroll",u,!0),window.removeEventListener("resize",u)}},[r,u]);let h=()=>n(!0),f=()=>{o||n(!1)},p=y=>{y.stopPropagation(),o?(a(!1),n(!1)):(a(!0),n(!0))},k=r&&typeof document<"u"?td(ye("span",{className:"edpire-scope",style:{...c,display:"contents"},children:ye("span",{ref:m,role:"tooltip",className:"player-blank-hint-pop",onClick:y=>y.stopPropagation(),onMouseEnter:h,onMouseLeave:f,style:{position:"fixed",top:s?s.top:0,left:s?s.left:0,bottom:"auto",transform:"none",margin:0,visibility:s?"visible":"hidden"},children:ye(od,{nodes:e})})}),document.body):null;return Jl("span",{ref:d,className:"relative inline-flex items-center align-middle",onMouseEnter:h,onMouseLeave:f,children:[ye("button",{type:"button",onClick:p,className:rd("player-blank-hint-btn select-none",o&&"player-blank-hint-btn--pinned"),"aria-label":t.showHint,"aria-expanded":r,children:"?"}),k]})}function dt({hint:e}){return!e||e.length===0?null:ye(Nt,{hint:e})}function cd(e){return[...e].map(t=>({v:t,r:Math.random()})).sort((t,r)=>t.r-r.r).map(t=>t.v)}var ld=e=>e.replace(/ {2,}/g,t=>" ".repeat(t.length-1)+" "),dd=new Set(["image","resizableImage","resizableVideo","youtubeEmbed"]);function qs(e){return(e??[]).some(t=>dd.has(t?.type)||qs(t?.content))}var Os=()=>Ne("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:3,children:Ne("path",{d:"M5 13l4 4L19 7"})}),js=()=>Ne("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:3,children:Ne("path",{d:"M6 6l12 12M18 6L6 18"})});function un({node:e,validationFeedback:t}){let r=we(),n=ae(),o=Ke(),a=Ot(),{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??"/":"/",u="pickLimit"in c&&c.pickLimit?c.pickLimit:1,h=c.hideCount===!0,f=h||u>1,p=!h&&u>1,k="layout"in c?c.layout??"row":"row",y=e.type==="inlineChoiceSet",S=JSON.stringify(i),b=l&&o.shuffleSeed!==void 0,C=id(()=>b?Pr(i,`${o.shuffleSeed}:${s}`):null,[b,o.shuffleSeed,s,S]),[A,w]=Bs(i);Po(()=>{b||w(l?cd(i):i)},[l,b,S]);let T=C??A,[N,M]=Bs(new Set),R=t?.showFeedback??!1,v=t?.correctChoiceIds||[];Po(()=>{let _=W=>{let H=W.answers.find(se=>se.nodeId===s&&se.type==="choiceSet");H&&"selectedIds"in H.answer&&M(new Set(H.answer.selectedIds))};return r.on("answers:prefill",_),()=>r.off("answers:prefill",_)},[s,r]),Po(()=>{r.emit({type:"answer:changed",answer:{nodeId:s,type:"choiceSet",timestamp:Date.now(),answer:{selectedIds:Array.from(N)}}})},[N,s,r]);let x=_=>{R||M(W=>{let z=new Set(W);return f?z.has(_)?z.delete(_):(h||z.size<u)&&z.add(_):z.has(_)?z.delete(_):(z.clear(),z.add(_)),z})},B=_=>ld(xe(_.content)),g=_=>{let W=N.has(_),z=v.includes(_);return R?z&&W?"correct":z&&!W?"correct-unchosen":!z&&W?"incorrect":"muted":W?"selected":"idle"},P={idle:"",selected:"player-choice--selected",correct:ht("player-choice--correct",a.hop),"correct-unchosen":"player-choice--correct-unchosen",incorrect:ht("player-choice--incorrect",a.shake),muted:"player-choice--muted"},$={idle:"",selected:"player-inline-choice--selected",correct:ht("player-inline-choice--correct",a.hop),"correct-unchosen":"player-inline-choice--correct-unchosen",incorrect:ht("player-inline-choice--incorrect",a.shake),muted:"player-inline-choice--muted"};if(y)return er("span",{className:"inline-choice",children:[d&&er("span",{className:"mr-2 font-medium",children:[d,p?Ne("span",{className:"ms-1 opacity-60",children:n.chooseN(u)}):null]}),T.map((_,W)=>er(sd,{children:[Ne("button",{type:"button",disabled:R,onClick:()=>x(_.id),className:ht("player-inline-choice",$[g(_.id)]),"aria-pressed":N.has(_.id),dangerouslySetInnerHTML:{__html:B(_)}}),W<T.length-1&&Ne("span",{className:"mx-1",children:m})]},_.id)),c.hint&&c.hint.length>0&&Ne(Nt,{hint:c.hint})]});let q=o.layoutBy==="box",J=o.choiceColumns?Math.min(o.choiceColumns,T.length):0,I=J?{gridAutoRows:"1fr",gridTemplateColumns:`repeat(${J}, minmax(0, 1fr))`}:{gridAutoRows:"1fr"},Z=T.some(_=>qs(_.content)),ve=o.choiceLabels==="letters",E=_=>n.choiceLetters[_]??String(_+1);return er("div",{className:ht("cs-player my-4 space-y-3",q&&"cs-player--box"),children:[d&&er("p",{className:"font-medium",children:[d,p?Ne("span",{className:"ms-2 text-sm opacity-70",children:n.chooseN(u)}):null]}),c.hint&&c.hint.length>0&&Ne(Nt,{hint:c.hint}),Ne("div",{className:ht("cs-player__grid",k==="row"&&"cs-player__grid--row"),style:I,children:T.map((_,W)=>{let z=g(_.id),H=z==="incorrect"?"incorrect":z==="correct"||z==="correct-unchosen"?"correct":null;return er("button",{type:"button",disabled:R,onClick:()=>x(_.id),className:ht("player-choice",Z&&"player-choice--tile",P[z]),"aria-pressed":N.has(_.id),children:[Ne("span",{className:ht("player-choice__mark",f?"player-choice__mark--box":"player-choice__mark--radio",ve&&"player-choice__mark--letter"),children:ve?E(W):z==="incorrect"?Ne(js,{}):Ne(Os,{})}),Ne("span",{className:"player-choice__text",dangerouslySetInnerHTML:{__html:B(_)}}),ve&&H&&Ne("span",{className:`player-choice__verdict player-choice__verdict--${H}`,"aria-hidden":"true",children:H==="incorrect"?Ne(js,{}):Ne(Os,{})})]},_.id)})})]})}import{jsx as gt,Fragment as pd,jsxs as Mo}from"react/jsx-runtime";import{useContext as ud,useState as md,useEffect as Eo,useRef as fd,useCallback as hd}from"react";import jt from"clsx";function mn({node:e,validationFeedback:t}){let r=we(),n=ae(),o=Ot(),{id:a,attrs:s}=e,{placeholder:i="___",width:c="auto",hint:l}=s,d=fd(null),m=i.trim().split(/\s+/).filter(Boolean).length,u=ud(Nr),h=!u&&c==="auto"&&m>=4,[f,p]=md(""),k=t?.showFeedback??!1,y=t?.state,S=y==="validating",b=t?.displayAnswer,C=t?.message;Eo(()=>{let N=M=>{let v=M.answers.find(x=>x.nodeId===a&&x.type==="blank");v&&"mode"in v.answer&&v.answer.mode==="typed"&&"text"in v.answer&&p(v.answer.text)};return r.on("answers:prefill",N),()=>r.off("answers:prefill",N)},[a,r]),Eo(()=>{r.emit({type:"answer:changed",answer:{nodeId:a,type:"blank",timestamp:Date.now(),answer:{mode:"typed",text:f}}})},[f,a,r]);let A=N=>{p(N.target.value)},w=hd(()=>{let N=d.current;N&&(N.style.height="auto",N.style.height=`${N.scrollHeight}px`)},[]);Eo(()=>{w()},[f,w]);let T=k&&!S;return Mo("span",{className:u?"player-blank-cell":jt("inline-flex flex-wrap items-center gap-x-1 gap-y-0.5 align-middle max-w-full",h&&"w-full"),children:[gt("span",{className:u?"player-blank-cell__box":jt("relative inline-block shrink-0 min-w-0 max-w-full",h&&"w-full flex-1"),children:T?gt("span",{className:jt("player-typed-blank-feedback",u&&"player-typed-blank-feedback--cell",h&&"w-full",y==="correct"&&jt("player-typed-blank-feedback--correct",o.hop),y==="partial"&&"player-typed-blank-feedback--partial",y==="incorrect"&&jt("player-typed-blank-feedback--incorrect",o.wobble)),children:f||gt("span",{className:"opacity-40",children:i})}):Mo(pd,{children:[gt("textarea",{ref:d,"aria-label":n.blankAnswerAria,placeholder:i,value:f,onChange:A,disabled:k,rows:1,wrap:u?"off":void 0,className:jt("player-typed-blank",u&&"player-typed-blank--cell",h&&"w-full",S&&"player-typed-blank--pending"),style:u?void 0:c!=="auto"?{width:c}:h?{width:"100%"}:{width:`${Math.max(7,f.length+1)}ch`,maxWidth:"100%"}}),!f&&!S&&!u&>("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"}),S&>("span",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:gt("span",{className:"player-typed-blank-spinner","aria-label":n.aiEvaluationInProgressAria})})]})}),k&&y==="incorrect"&&b&&Mo("span",{className:"player-blank-reveal",children:["(",b,")"]}),k&&C&>("span",{className:jt("player-blank-feedback",y==="correct"&&"player-blank-feedback--correct",y==="partial"&&"player-blank-feedback--partial",y==="incorrect"&&"player-blank-feedback--incorrect"),children:C}),l&&l.length>0&>(Nt,{hint:l})]})}import{jsx as Rn,Fragment as Us,jsxs as Io}from"react/jsx-runtime";import{useEffect as Vs}from"react";import Cn from"clsx";import{useDroppable as kd,useDndContext as Sd}from"@dnd-kit/core";import{jsx as gd}from"react/jsx-runtime";import{createContext as bd,useCallback as _t,useContext as xd,useEffect as yd,useMemo as Hs,useRef as vd,useState as Lo}from"react";import{useDndMonitor as wd}from"@dnd-kit/core";var Ws=bd(null);function pt(){let e=xd(Ws);if(!e)throw new Error("usePool must be used within a PoolProvider");return e}function Ks(e){let t={};for(let r of e??[])r.type==="blank"&&"mode"in r.answer&&r.answer.mode==="choice"&&"choiceId"in r.answer&&r.answer.choiceId&&(t[r.nodeId]={choiceId:r.answer.choiceId,poolId:r.answer.poolId||"",value:r.answer.value||""});return t}function Sn({children:e,initialAnswers:t}){let r=we(),n=Hs(()=>Ks(t),[t]),[o,a]=Lo(n),[s,i]=Lo({}),[c,l]=Lo({}),d=vd(new Set);yd(()=>{let C=A=>{let w=Ks(A.answers);Object.keys(w).length!==0&&a(T=>{if(!Object.entries(w).some(([R,v])=>T[R]?.choiceId!==v.choiceId||T[R]?.poolId!==v.poolId||T[R]?.value!==v.value))return T;let M={...T,...w};return i(R=>{let v={...R};for(let[x,B]of Object.entries(R)){let g=new Set(Object.values(M).filter(P=>P.poolId===x).map(P=>P.choiceId));v[x]={...B,available:new Set(B.choices.map(P=>P.id).filter(P=>!g.has(P)))}}return v}),M})};return r.on("answers:prefill",C),()=>r.off("answers:prefill",C)},[r]);let m=_t((C,A)=>{i(w=>{let T=w[C];if(!T){let x=new Set;for(let g of Object.values(o))g.poolId===C&&x.add(g.choiceId);let B=new Set(A.map(g=>g.id).filter(g=>!x.has(g)));return{...w,[C]:{choices:A,available:B}}}let N=new Set(T.choices.map(x=>x.id)),M=new Set(A.map(x=>x.id));if(!(A.some(x=>!N.has(x.id))||T.choices.some(x=>!M.has(x.id))))return w;let v=new Set;for(let x of T.available)M.has(x)&&v.add(x);for(let x of A)N.has(x.id)||v.add(x.id);return{...w,[C]:{choices:A,available:v}}})},[o]),u=_t((C,A)=>{l(w=>{let T=w[C]??[];return T.includes(A)?w:{...w,[C]:[...T,A]}}),!d.current.has(A)&&!o[A]&&(d.current.add(A),r.emit({type:"answer:changed",answer:{nodeId:A,type:"blank",timestamp:Date.now(),answer:{mode:"choice",choiceId:"",poolId:C,value:""}}}))},[o,r]),h=_t(C=>(c[C]??[]).find(w=>!o[w])??null,[c,o]),f=_t((C,A,w,T)=>{a(N=>{let M=N[C];return M&&i(R=>{let v=R[M.poolId];if(!v)return R;let x=new Set(v.available);return x.add(M.choiceId),{...R,[M.poolId]:{...v,available:x}}}),{...N,[C]:{choiceId:w,value:T,poolId:A}}}),i(N=>{let M=N[A];if(!M)return N;let R=new Set(M.available);return R.delete(w),{...N,[A]:{...M,available:R}}}),r.emit({type:"answer:changed",answer:{nodeId:C,type:"blank",timestamp:Date.now(),answer:{mode:"choice",choiceId:w,poolId:A,value:T}}})},[r]),p=_t(C=>{let A=o[C];if(!A)return;let{poolId:w,choiceId:T}=A;i(N=>{let M=N[w];if(!M)return N;let R=new Set(M.available);return R.add(T),{...N,[w]:{...M,available:R}}}),a(N=>{let{[C]:M,...R}=N;return R}),r.emit({type:"answer:changed",answer:{nodeId:C,type:"blank",timestamp:Date.now(),answer:{mode:"choice",choiceId:"",poolId:w,value:""}}})},[o,r]),k=_t((C,A)=>s[C]?.available.has(A)??!1,[s]),y=_t((C,A)=>s[C]?.choices.find(w=>w.id===A),[s]),S=_t(()=>{a({}),i(C=>{let A={};for(let[w,T]of Object.entries(C))A[w]={choices:T.choices,available:new Set(T.choices.map(N=>N.id))};return A});for(let[C,A]of Object.entries(c))for(let w of A)r.emit({type:"answer:changed",answer:{nodeId:w,type:"blank",timestamp:Date.now(),answer:{mode:"choice",choiceId:"",poolId:C,value:""}}})},[c,r]);wd({onDragEnd(C){window.dispatchEvent(new CustomEvent("dnd-drop",{detail:{active:C.active,over:C.over}}))}});let b=Hs(()=>({blanks:o,pools:s,registerPool:m,registerBlank:u,fill:f,back:p,isAvailable:k,getChoice:y,firstEmptyBlank:h,resetAllAnswers:S}),[o,s,m,u,f,p,k,y,h,S]);return gd(Ws.Provider,{value:b,children:e})}function fn({node:e,validationFeedback:t}){let{id:r,attrs:n}=e,{poolId:o,placeholder:a="___",hint:s}=n,{blanks:i,fill:c,back:l,getChoice:d,registerBlank:m}=pt(),u=ae(),h=Ot(),f=i[r],p=!!f?.choiceId,k=t?.showFeedback??!1,y=t?.state,S=t?.correctChoiceIds??[],b=k&&y==="incorrect"&&S.length>0?d(o||"",S[0]):void 0,C=b?b.html.replace(/<\/?[^>]+(>|$)/g,""):void 0,{setNodeRef:A,isOver:w}=kd({id:r,data:{type:"blank",blankId:r,poolId:o}}),{active:T}=Sd(),N=!!T&&T.data.current?.poolId===o;return Vs(()=>{m(o||"",r)},[o,r,m]),Vs(()=>{let v=x=>{let B=x,{active:g,over:P}=B.detail||{};if(!P||P.id!==r)return;let{choiceId:$,poolId:q}=g?.data.current||{};if(!$||q!==o)return;let J=d(o||"",$);if(!J)return;let I=J.html.replace(/<\/?[^>]+(>|$)/g,"");c(r,o||"",$,I)};return window.addEventListener("dnd-drop",v),()=>window.removeEventListener("dnd-drop",v)},[r,o,d,c]),Io(Us,{children:[Rn("span",{ref:A,onClick:()=>{p&&!k&&l(r)},className:Cn("player-choice-blank",w&&"player-choice-blank--over",!w&&N&&!p&&!k&&"player-choice-blank--target",p&&!k&&!w&&"player-choice-blank--filled",k&&y==="correct"&&Cn("player-choice-blank--correct",h.hop),k&&y==="partial"&&Cn("player-choice-blank--partial",h.hop),k&&y==="incorrect"&&Cn("player-choice-blank--incorrect",h.wobble)),title:p&&!k?u.clickToRemove:void 0,"data-node-id":r,"data-pool-id":o,children:p?Io(Us,{children:[Rn("span",{children:f.value}),!k&&Rn("span",{className:"player-choice-blank__clear",children:"\xD7"})]}):a}),C&&Io("span",{className:"player-blank-reveal",children:["(",C,")"]}),Rn(dt,{hint:s})]})}import{jsx as Do,jsxs as Pd}from"react/jsx-runtime";import{useEffect as ri,useRef as Md,useState as Ed}from"react";import Ld from"clsx";import{jsx as ti,jsxs as Nd}from"react/jsx-runtime";import _d from"clsx";import{useDraggable as Td}from"@dnd-kit/core";import{jsx as qt,jsxs as Gs}from"react/jsx-runtime";import{useEffect as Ys,useState as Qs}from"react";import Rd from"clsx";var Xs="edpire:tap-hint-placed",Js=2;function Cd(e){let r=(()=>{try{return Number(e?.getItem(Xs))||0}catch{return 0}})(),n=new Set,o=new Set,a=()=>n.forEach(s=>s());return{done:()=>r>=Js,placed:()=>r,recordPlacement(){if(!(r>=Js)){r+=1;try{e?.setItem(Xs,String(r))}catch{}a()}},setOnScreen(s,i){let c=o.has(s);i!==c&&(i?o.add(s):o.delete(s),a())},owner(){let s=null;for(let i of o)(!s||i.compareDocumentPosition(s)&4)&&(s=i);return s},subscribe(s){return n.add(s),()=>{n.delete(s)}}}}var $o=null;function Fo(){if(!$o){let e=null;try{e=typeof window<"u"?window.localStorage:null}catch{e=null}$o=Cd(e)}return $o}function Zs(){typeof window>"u"||Fo().recordPlacement()}function Ad(){try{return window.matchMedia("(hover: none) and (pointer: coarse)").matches}catch{return!1}}function An(e,t){let[,r]=Qs(0),[n,o]=Qs(!1);if(Ys(()=>{o(Ad())},[]),Ys(()=>{let s=e.current;if(!n||!s)return;let i=Fo();if(i.done())return;let c=i.subscribe(()=>r(d=>d+1));if(!t||typeof IntersectionObserver>"u")return()=>{i.setOnScreen(s,!1),c()};let l=new IntersectionObserver(d=>{for(let m of d)i.setOnScreen(s,m.isIntersecting)},{threshold:.6});return l.observe(s),()=>{l.disconnect(),i.setOnScreen(s,!1),c()}},[e,n,t]),!n||!t||typeof window>"u")return!1;let a=Fo();return!a.done()&&a.owner()===e.current}function ei(){let{motion:e}=Ke();return Gs("span",{className:Rd("player-tap-hint",e==="none"&&"player-tap-hint--still"),"aria-hidden":"true",children:[qt("span",{className:"player-tap-hint__ripple"}),qt("svg",{className:"player-tap-hint__hand",viewBox:"0 0 24 24",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[{stroke:"#ffffff",strokeWidth:4.5},{stroke:"currentColor",strokeWidth:1.75}].map((t,r)=>Gs("g",{...t,children:[qt("path",{d:"M22 14a8 8 0 0 1-8 8"}),qt("path",{d:"M18 11v-1a2 2 0 0 0-2-2a2 2 0 0 0-2 2"}),qt("path",{d:"M14 10V9a2 2 0 0 0-2-2a2 2 0 0 0-2 2v1"}),qt("path",{d:"M10 9.5V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v10"}),qt("path",{d:"M18 11a2 2 0 1 1 4 0v3a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15"})]},r))})]})}function tr({poolId:e,data:t,isInline:r=!1,tapHint:n=!1}){let{isAvailable:o,firstEmptyBlank:a,fill:s}=pt(),{id:i,html:c}=t,l=!o(e,i),{setNodeRef:d,attributes:m,listeners:u,transform:h,isDragging:f}=Td({id:i,data:{type:"choice",choiceId:i,poolId:e,html:c},disabled:l});if(l)return null;let p=b=>b.replace(/<\/?[^>]+(>|$)/g,""),k=()=>{let b=a(e);if(b){let C=p(c);s(b,e,i,C),Zs()}},y=h?{transform:`translate3d(${h.x}px, ${h.y}px, 0)`}:void 0;return Nd(r?"span":"div",{ref:d,style:y,className:_d("player-bank-pill",f&&"player-bank-pill--dragging",n&&!f&&"player-bank-pill--hinted",r&&"mx-1"),...m,...u,onClick:k,children:[ti("span",{dangerouslySetInnerHTML:{__html:c},className:"pointer-events-none whitespace-pre-wrap break-words"}),n&&!f&&ti(ei,{})]})}function hn({node:e}){let t=ae(),{id:r,attrs:n,content:o}=e,{shuffle:a=!0,equalWidth:s=!1}=n,{registerPool:i,isAvailable:c}=pt(),l=Md(null),[d,m]=Ed(()=>o.map(f=>({id:f.id,html:xe(f.content)})));ri(()=>{let f=o.map(p=>({id:p.id,html:xe(p.content)}));m(a?[...f].map(p=>({v:p,r:Math.random()})).sort((p,k)=>p.r-k.r).map(p=>p.v):f)},[a,JSON.stringify(o)]),ri(()=>{i(r,d)},[r,d,i]);let u=d.find(f=>c(r,f.id))?.id,h=An(l,u!==void 0);return Pd("div",{ref:l,className:"player-word-bank",children:[Do("div",{className:"player-word-bank__label",children:t.wordBank}),Do("div",{className:Ld("player-word-bank__items",s&&"player-word-bank__items--grid"),children:d.map(f=>Do(tr,{poolId:r,data:f,tapHint:h&&f.id===u},f.id))})]})}import{jsx as zo,jsxs as Id}from"react/jsx-runtime";import{useEffect as ni,useRef as $d,useState as Fd}from"react";function gn({node:e}){let{id:t,attrs:r,content:n}=e,{shuffle:o=!0,separator:a=" "}=r,{registerPool:s,isAvailable:i}=pt(),c=$d(null),[l,d]=Fd(()=>n.map(h=>({id:h.id,html:xe(h.content,{stripParagraphs:!0})})));ni(()=>{let h=n.map(f=>({id:f.id,html:xe(f.content,{stripParagraphs:!0})}));d(o?[...h].map(f=>({v:f,r:Math.random()})).sort((f,p)=>f.r-p.r).map(f=>f.v):h)},[o,JSON.stringify(n)]),ni(()=>{s(t,l)},[t,l,s]);let m=l.find(h=>i(t,h.id))?.id,u=An(c,m!==void 0);return zo("span",{ref:c,style:{display:"inline-flex",flexWrap:"wrap",gap:D("0.25rem"),alignItems:"center"},children:l.map((h,f)=>Id("span",{children:[zo(tr,{poolId:t,data:h,isInline:!0,tapHint:u&&h.id===m}),f<l.length-1&&zo("span",{children:a})]},h.id))})}import{jsx as rr,jsxs as jo}from"react/jsx-runtime";import{useState as qo,useEffect as Ho,useMemo as Od}from"react";import{Check as jd,X as qd}from"lucide-react";import{jsx as Pe,jsxs as Ht}from"react/jsx-runtime";import{useState as Bo,useMemo as Oo,useRef as Nn,useCallback as Dd,useLayoutEffect as zd}from"react";var oi="#1d2025",ai="#8d93a0",si="#1f8a4c",ii="#d23b2b",Bd=11;function ci({leftItems:e,rightItems:t,connections:r,direction:n,disabled:o,feedback:a,onConnectionsChange:s}){let[i,c]=Bo(null),[l,d]=Bo(null),[m,u]=Bo(new Map),h=Nn(null),f=Nn(new Map),p=Nn("mouse"),k=a?.showFeedback??!1,y=Oo(()=>{let E=new Map;if(a?.pairFeedback)for(let _ of a.pairFeedback)E.set(`${_.leftId}-${_.rightId}`,_.correct);return E},[a]),S=Oo(()=>{let E=new Map;return a?.correctPairings?.forEach(_=>E.set(_.leftId,_.rightId)),E},[a]),b=Oo(()=>{let E=new Map;return a?.correctPairings?.forEach(_=>E.set(_.rightId,_.leftId)),E},[a]),C=new Map,A=new Map;r.forEach((E,_)=>{C.set(E.leftId,_),A.set(E.rightId,_)});let w=E=>{let _=r[E];if(!k||!_)return null;let W=y.get(`${_.leftId}-${_.rightId}`);return W===!0?"correct":W===!1?"incorrect":null},T=Dd(()=>{if(!h.current)return;let E=h.current.getBoundingClientRect(),_=new Map;f.current.forEach((W,z)=>{if(W){let H=W.getBoundingClientRect();_.set(z,new DOMRect(H.left-E.left,H.top-E.top,H.width,H.height))}}),u(_)},[]);zd(()=>{T();let E=new ResizeObserver(T);return h.current&&E.observe(h.current),()=>E.disconnect()},[T,r,e,t]);let N=8,M=(E,_)=>{let W=m.get(E);if(!W)return null;let z=W.y+W.height/2;return _==="left"?{x:W.x+W.width,y:z}:{x:W.x-N,y:z}},R=(E,_)=>{if(o)return;let z=(_==="left"?C:A).has(E),H=i?.id===E&&i?.side===_,se=i!==null&&i.side!==_;if(H){c(null);return}if(se){let pe=_==="right"?i.id:E,ue=_==="left"?i.id:E,ge=r.filter(V=>V.leftId!==pe&&V.rightId!==ue);ge.push({leftId:pe,rightId:ue}),s(ge),c(null);return}if(z&&!i){let pe=_==="left"?r.filter(ue=>ue.leftId!==E):r.filter(ue=>ue.rightId!==E);s(pe);return}c({id:E,side:_})},v=Nn(null),x=(E,_,W)=>{if(o||(p.current=W.pointerType,W.pointerType==="touch"))return;W.currentTarget.setPointerCapture(W.pointerId);let z=h.current.getBoundingClientRect();v.current={x:W.clientX-z.left,y:W.clientY-z.top},d({fromId:E,fromSide:_,x:W.clientX-z.left,y:W.clientY-z.top,overId:null,overSide:null})},B=E=>{if(!l)return;let _=h.current.getBoundingClientRect(),W=E.clientX-_.left,z=E.clientY-_.top,H=l.fromSide==="left"?"right":"left",se=H==="left"?e:t,pe=null,ue=null;for(let ge of se){let V=m.get(ge.id);if(V&&W>=V.x&&W<=V.x+V.width&&z>=V.y&&z<=V.y+V.height){pe=ge.id,ue=H;break}}d(ge=>ge?{...ge,x:W,y:z,overId:pe,overSide:ue}:null)},g=E=>{if(!l)return;let _=h.current.getBoundingClientRect(),W=E.clientX-_.left,z=E.clientY-_.top,H=v.current;if((H?Math.hypot(W-H.x,z-H.y):999)<8){d(null),R(l.fromId,l.fromSide);return}if(l.overId&&l.overSide){let pe=l.fromSide==="left"?l.fromId:l.overId,ue=l.fromSide==="right"?l.fromId:l.overId,ge=r.filter(V=>V.leftId!==pe&&V.rightId!==ue);ge.push({leftId:pe,rightId:ue}),s(ge)}d(null),c(null)},P=(E,_)=>{if(!k)return null;let z=(_==="left"?C:A).get(E.id);if(z!==void 0){let H=r[z];if(y.get(`${H.leftId}-${H.rightId}`)===!0)return null}if(_==="left"){let H=S.get(E.id);return t.find(se=>se.id===H)?.content??null}else{let H=b.get(E.id);return e.find(se=>se.id===H)?.content??null}},$=(E,_)=>{let z=(_==="left"?C:A).get(E.id),H=z!==void 0,se=i?.id===E.id&&i?.side===_,pe=i!==null&&i.side!==_&&!H,ue=l?.overId===E.id&&l?.overSide===_,ge=H?w(z):null,V=H?z+1:null,ee="matching-player__item";H&&(ee+=" matching-player__item--matched"),ge==="correct"&&(ee+=" matching-player__item--correct"),ge==="incorrect"&&(ee+=" matching-player__item--incorrect"),se&&(ee+=" matching-player__item--selected"),(pe||ue)&&(ee+=" matching-player__item--available"),o&&(ee+=" matching-player__item--disabled");let be=P(E,_);return Ht("button",{ref:ce=>{ce?f.current.set(E.id,ce):f.current.delete(E.id)},type:"button",className:ee,onPointerDown:ce=>x(E.id,_,ce),onClick:()=>{p.current==="touch"&&R(E.id,_)},"aria-pressed":se,children:[_==="right"&&Pe("span",{className:"matching-player__connector matching-player__connector--right","aria-hidden":!0,children:Ht("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"})]})}),H&&_==="left"&&Pe("span",{className:"matching-player__pair-num","aria-hidden":!0,children:V}),Pe("span",{className:"matching-player__item-text",dangerouslySetInnerHTML:{__html:xe(E.content)}}),be&&Ht("span",{className:"matching-player__correct-hint",children:["(",Pe("span",{dangerouslySetInnerHTML:{__html:xe(be)}}),")"]}),H&&_==="right"&&Pe("span",{className:"matching-player__pair-num","aria-hidden":!0,children:V}),_==="left"&&Pe("span",{className:"matching-player__connector matching-player__connector--left","aria-hidden":!0,children:Ht("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"})]})})]},E.id)},q=n==="ltr"?e:t,J=n==="ltr"?t:e,I=n==="ltr"?"left":"right",Z=n==="ltr"?"right":"left";return Ht("div",{ref:h,className:`matching-player__arena${l?" matching-player__arena--dragging":""}`,onPointerMove:B,onPointerUp:g,children:[Ht("svg",{className:"matching-player__svg","aria-hidden":!0,children:[Pe("defs",{children:[["mp-arrow-ink",oi],["mp-arrow-correct",si],["mp-arrow-incorrect",ii],["mp-arrow-ghost",ai]].map(([E,_])=>Pe("marker",{id:E,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:_})},E))}),r.map(E=>{let _=M(E.leftId,"left"),W=M(E.rightId,"right");if(!_||!W)return null;let z=W.x-Bd,H=Math.max(16,Math.abs(z-_.x)*.4),se=`M ${_.x} ${_.y} C ${_.x+H} ${_.y}, ${z-H} ${W.y}, ${z} ${W.y}`,pe=k?y.get(`${E.leftId}-${E.rightId}`):void 0;return Pe("path",{d:se,stroke:pe===!0?si:pe===!1?ii:oi,strokeWidth:"2.5",fill:"none",markerEnd:`url(#${pe===!0?"mp-arrow-correct":pe===!1?"mp-arrow-incorrect":"mp-arrow-ink"})`},`${E.leftId}-${E.rightId}`)}),l&&(()=>{let E=M(l.fromId,l.fromSide);if(!E)return null;let _=Math.abs(l.x-E.x)*.35,W=`M ${E.x} ${E.y} C ${E.x+_} ${E.y}, ${l.x-_} ${l.y}, ${l.x} ${l.y}`;return Pe("path",{d:W,stroke:ai,strokeWidth:"2",strokeDasharray:"6 4",fill:"none",markerEnd:"url(#mp-arrow-ghost)"})})()]}),Ht("div",{className:"matching-player__columns",children:[Pe("div",{className:"matching-player__column",children:q.map(E=>$(E,I))}),Pe("div",{className:"matching-player__column",children:J.map(E=>$(E,Z))})]})]})}var li=e=>Number.isInteger(e)?String(e):e.toFixed(2);function di(e){return[...e].map(t=>({v:t,r:Math.random()})).sort((t,r)=>t.r-r.r).map(t=>t.v)}function bn({node:e,validationFeedback:t}){let r=we(),{shuffleSeed:n,layoutBy:o}=Ke(),{id:a,attrs:s,leftItems:i,rightItems:c}=e,{direction:l,shuffle:d,hint:m}=s,u=JSON.stringify(i),h=JSON.stringify(c),f=d&&n!==void 0,p=Od(()=>f?{left:Pr(i,`${n}:${a}:left`),right:Pr(c,`${n}:${a}:right`)}:null,[f,n,a,u,h]),[k,y]=qo(i),[S,b]=qo(c);Ho(()=>{f||(d?(y(di(i)),b(di(c))):(y(i),b(c)))},[d,f,u,h]);let C=p?.left??k,A=p?.right??S,[w,T]=qo([]),N=t?.showFeedback??!1;Ho(()=>{let g=P=>{let q=P.answers.find(J=>J.nodeId===a&&J.type==="matchingSet");q&&"connections"in q.answer&&T(q.answer.connections)};return r.on("answers:prefill",g),()=>r.off("answers:prefill",g)},[r,a]),Ho(()=>{r.emit({type:"answer:changed",answer:{nodeId:a,type:"matchingSet",timestamp:Date.now(),answer:{connections:w}}})},[r,a,w]);let M=g=>{N||T(g)},R=t?.score,v=t?.maxScore,x=N&&R!=null&&v!=null,B=x?R>=v?"correct":R>0?"partial":"incorrect":null;return jo("div",{className:o==="box"?"matching-player matching-player--box":"matching-player",children:[m&&m.length>0&&rr("div",{className:"matching-player-hintrow",children:rr(dt,{hint:m})}),rr(ci,{leftItems:C,rightItems:A,connections:w,direction:l,disabled:N,feedback:t,onConnectionsChange:M}),x&&jo("div",{className:"matching-player-feedback matching-player-feedback--"+B,children:[B==="correct"&&rr(jd,{size:15,style:ke(15)}),B==="incorrect"&&rr(qd,{size:15,style:ke(15)}),rr("span",{children:B==="correct"?"All matched":B==="partial"?"Partial credit":"Not matched"}),jo("span",{className:"matching-player-score",children:[li(R)," / ",li(v)]})]})]})}import{jsx as Le,jsxs as rt,Fragment as Gi}from"react/jsx-runtime";import{useState as Yi,useEffect as Aa,useRef as Qi,useCallback as Na}from"react";import dr from"clsx";import{jsx as mt,jsxs as lr,Fragment as au}from"react/jsx-runtime";import{useCallback as su,useEffect as iu,useMemo as cu,useRef as Wi,useState as Ra}from"react";import Ca from"clsx";import{Camera as lu,PenLine as du}from"lucide-react";import{jsx as ut,jsxs as Dr}from"react/jsx-runtime";import{forwardRef as Fp,useEffect as cr,useImperativeHandle as Dp,useRef as On,useState as zp}from"react";import Di from"clsx";import{Keyboard as Bp}from"lucide-react";import{useEditor as Op,EditorContent as jp}from"@tiptap/react";import{Extension as qp}from"@tiptap/core";import{Fragment as Hp,Slice as Kp}from"@tiptap/pm/model";import{Selection as Wp}from"@tiptap/pm/state";import Up from"@tiptap/starter-kit";import{Placeholder as Vp}from"@tiptap/extensions";var pi,nr={keyboard:"Maths keyboard",mathsKeys:"Maths keyboard",phoneKeys:"Phone keyboard",toMaths:"Write as maths",toText:"Back to text",close:"Close the maths keyboard",hide:"Hide the keyboard",tabs:{basic:"Numbers",analysis:"Analysis",sets:"Sets",matrices:"Matrices and systems",greek:"Greek letters"},keys:{}},Ko=null;function ui(e){Ko=e}var Hd=150,Kd=80,_n=class{constructor(){this.targets=new Set,this.listeners=new Set,this.installed=!1,this.leaveTimer=null,this.switchTimer=null,this.view=null,this.active=null,this.mode="system",this.tab="basic",this.ownElements=new Set}touch(){return typeof matchMedia=="function"&&matchMedia("(pointer: coarse)").matches}state(){return{active:this.active,mode:this.mode,tab:this.tab,touch:this.touch(),caret:this.active?.caret()??"text"}}subscribe(t){return this.listeners.add(t),()=>this.listeners.delete(t)}emit(){this.view?.update();for(let t of[...this.listeners])t()}register(t){this.targets.add(t),this.install();let r=typeof document<"u"?document.activeElement:null;return r&&t.root?.contains(r)&&this.activate(t),()=>{this.targets.delete(t),this.active===t&&this.deactivate()}}targetOf(t){if(!t||!t.nodeType)return null;for(let r of this.targets)if(r.root?.contains(t))return r;return null}isOwn(t){if(!t||!t.nodeType)return!1;for(let r of this.ownElements)if(r.contains(t))return!0;return!1}defaultMode(t){return t.kind!=="field"||t.quietOnComputer&&!this.touch()?"system":"maths"}applyInputMode(t,r=this.mode){if(!this.touch())return;let n=r==="maths"?"none":"text";for(let o of t.inputs())o.getAttribute("inputmode")!==n&&o.setAttribute("inputmode",n)}prepareInput(t){if(!this.touch())return;let r=this.targetOf(t),n=r&&r!==this.active?this.defaultMode(r):this.mode;t.setAttribute("inputmode",n==="maths"?"none":"text")}activate(t){if(!t.editable())return;this.cancelLeave();let r=this.active!==t;this.active=t,r&&(this.mode=this.defaultMode(t)),this.applyInputMode(t),this.ensureView(),this.emit()}deactivate(){this.cancelLeave(),this.cancelSwitch(),this.active&&(this.active=null,this.emit())}setMode(t){let r=this.active;r&&(this.mode=t,this.applyInputMode(r),this.touch()&&(t==="maths"?this.refocusWithoutPhoneKeyboard(r):r.refocus()),this.emit())}isSwitching(){return this.switchTimer!==null}refocusWithoutPhoneKeyboard(t){this.cancelSwitch();let r=typeof document<"u"?document.activeElement:null;this.switchTimer=setTimeout(()=>{this.switchTimer=null,this.active===t&&t.editable()&&t.refocus()},Kd),r&&t.root?.contains(r)&&r.blur()}cancelSwitch(){this.switchTimer&&clearTimeout(this.switchTimer),this.switchTimer=null}toggle(){this.setMode(this.mode==="maths"?"system":"maths")}openFor(t){t.editable()&&(this.active!==t&&(t.refocus(),this.activate(t)),this.setMode(this.mode==="maths"?"system":"maths"))}setTab(t){this.tab=t,this.emit()}hideAll(){let t=this.active;this.deactivate();let r=document.activeElement;t?.root?.contains(r)&&r?.blur()}press(t){let r=this.active;!r||!r.editable()||(t.kind==="insert"?r.insert(t.latex):r.command(t.command),this.emit())}convert(){let t=this.active;!t?.convert||!t.editable()||(t.convert(),this.emit())}ensureView(){!this.view&&Ko&&typeof document<"u"&&(this.view=Ko(this))}cancelLeave(){this.leaveTimer&&clearTimeout(this.leaveTimer),this.leaveTimer=null}scheduleLeave(){this.cancelLeave(),this.leaveTimer=setTimeout(()=>{this.leaveTimer=null;let t=this.targetOf(document.activeElement);t?t!==this.active&&this.activate(t):this.deactivate()},Hd)}install(){this.installed||typeof document>"u"||(this.installed=!0,document.addEventListener("pointerdown",t=>{if(this.isOwn(t.target))return;let r=this.targetOf(t.target);r&&this.applyInputMode(r,r===this.active?this.mode:this.defaultMode(r))},!0),document.addEventListener("focusin",t=>{if(this.isOwn(t.target))return;let r=this.targetOf(t.target);if(!r){this.active&&this.scheduleLeave();return}r!==this.active?this.activate(r):(this.cancelLeave(),this.applyInputMode(r),this.emit())},!0),document.addEventListener("focusout",t=>{let r=t.relatedTarget;r&&(this.targetOf(r)||this.isOwn(r))||this.isSwitching()||this.active&&this.scheduleLeave()},!0))}},Wd=typeof window<"u",Se=Wd?(pi=window).__edpMathInputV1??(pi.__edpMathInputV1=new _n):new _n;import{Node as yi,mergeAttributes as vi}from"@tiptap/core";import{Fragment as Ud}from"@tiptap/pm/model";import{TextSelection as mi}from"@tiptap/pm/state";var Yo={ownLine:!1,centred:!1,onOpenWindow:null,chip:!1};function Vd(e){return e.storage.mathTyping?.chip??{unwrap:"Back to text",ownLine:"On its own line"}}function fi(e,t){let r=t==="start"?e.firstChild:e.lastChild;if(!r?.isText)return e;let n=t==="start"?(r.text??"").replace(/^\s+/,""):(r.text??"").replace(/\s+$/,"");if(n===r.text)return e;let o=t==="start"?0:e.childCount-1,a=n?e.content.replaceChild(o,e.type.schema.text(n,r.marks)):t==="start"?e.content.cut(r.nodeSize):e.content.cut(0,e.content.size-r.nodeSize);return e.copy(a)}function hi(e){let t=!1;return e.forEach(r=>{(!r.isText||(r.text??"").trim())&&(t=!0)}),t}var Gd={le:"<=",leq:"<=",ge:">=",geq:">=",ne:"!=",neq:"!=",times:"*",cdot:"*",div:"/",pi:"\u03C0",in:"\u2208",infty:"\u221E",pm:"\xB1",lt:"<",gt:">",approx:"\u2248",degree:"\xB0",circ:"\xB0"};function Mr(e,t){for(;e[t]===" ";)t++;if(e[t]!=="{")return[e[t]??"",t+1];let r=0;for(let n=t;n<e.length;n++)if(e[n]==="{")r++;else if(e[n]==="}"&&--r===0)return[e.slice(t+1,n),n+1];return[e.slice(t+1),e.length]}var Wo=e=>e.length>1&&!/^[\dA-Za-zπ.,]+$/.test(e)&&!/^\(.*\)$/.test(e)?`(${e})`:e;function Kt(e){let t="",r=0,n=e.replace(/\\(left|right)\b/g,"").replace(/\\placeholder(\[[^\]]*\])?\{\}/g,"");for(;r<n.length;){let o=n[r];if(o==="\\"){let a=n.slice(r+1).match(/^([A-Za-z]+|.)/)?.[1]??"";if(r+=1+a.length,a==="frac"||a==="dfrac"||a==="tfrac"){let[s,i]=Mr(n,r),[c,l]=Mr(n,i);t+=`${Wo(Kt(s))}/${Wo(Kt(c))}`,r=l}else if(a==="sqrt"){let[s,i]=Mr(n,r);t+=`sqrt(${Kt(s)})`,r=i}else if(a==="text"||a==="mathrm"||a==="operatorname"){let[s,i]=Mr(n,r);t+=s,r=i}else a===","||a===" "||a===";"||a==="quad"?t+=" ":a==="{"||a==="}"?t+=a:t+=Gd[a]??a}else if(o==="^"||o==="_"){let[a,s]=Mr(n,r+1);t+=`${o}${Wo(Kt(a))}`,r=s}else o==="{"||o==="}"||o===" "||(t+=o),r++}return t}function Tn(e,t,r){let n=e.doc.nodeAt(t);if(!n||n.type.name!=="inlineMath"&&n.type.name!=="blockMath")return null;let{schema:o}=e,a=r?o.text(r):null;if(n.type.name==="blockMath"){let i=e.tr.replaceWith(t,t+n.nodeSize,o.nodes.paragraph.create(null,a));return i.setSelection(mi.create(i.doc,t+1+r.length))}let s=a?e.tr.replaceWith(t,t+n.nodeSize,a):e.tr.delete(t,t+n.nodeSize);return s.setSelection(mi.create(s.doc,t+r.length))}function wi(e,t){let r=e.doc.nodeAt(t),{schema:n}=e;if(!r||!n.nodes.blockMath||!n.nodes.inlineMath)return null;let o={...r.attrs};if(r.type.name==="blockMath"){let h=n.nodes.paragraph.create(null,n.nodes.inlineMath.create(o));return e.tr.replaceWith(t,t+r.nodeSize,h)}if(r.type.name!=="inlineMath")return null;let a=e.doc.resolve(t);if(a.depth<1)return null;let s=a.parent,i=t-a.start(),c=fi(s.cut(0,i),"end"),l=fi(s.cut(i+r.nodeSize),"start"),d=[...hi(c.content)?[c]:[],n.nodes.blockMath.create(o),...hi(l.content)?[l]:[]],m=a.node(a.depth-1),u=a.index(a.depth-1);return m.canReplace(u,u+1,Ud.from(d))?e.tr.replaceWith(a.before(),a.after(),d):null}var Uo=null,Qo=!1,Vo=null;function tt(){return Uo||(Uo=import("mathlive").then(e=>(e.MathfieldElement.soundsDirectory=null,Vo=e.convertAsciiMathToLatex??null,Qo=!0,document.addEventListener("focusin",t=>{let r=t.target;r?.tagName==="MATH-FIELD"&&Se.targetOf(r)&&Pt(r)},!0),!0)).catch(()=>!1)),Uo}function ki(e){try{return Vo?Vo(e):null}catch{return null}}function Pt(e){let t=e;if(t){try{t.mathVirtualKeyboardPolicy!=="manual"&&(t.mathVirtualKeyboardPolicy="manual"),t.menuItems=[]}catch{}Yd()&&(Qd(t),Jd(t))}}function Yd(){return typeof matchMedia=="function"&&matchMedia("(pointer: coarse)").matches}var gi=new WeakSet;function Qd(e){let t=e.shadowRoot,r=t?.querySelector(".ML__keyboard-sink");if(!t||!r||gi.has(r)||typeof MutationObserver>"u"||typeof getSelection!="function")return;gi.add(r);let n=!1;r.addEventListener("compositionstart",()=>n=!0),r.addEventListener("compositionend",()=>n=!1),new MutationObserver(()=>{if(n||!r.isConnected||!r.textContent||t.activeElement!==r)return;let o=getSelection();o&&o.rangeCount>0&&o.collapseToEnd()}).observe(r,{childList:!0,characterData:!0,subtree:!0})}var bi=new WeakSet,Xd={deleteContentBackward:"Backspace",deleteContentForward:"Delete"};function Jd(e){let t=e;if(!t.shadowRoot||typeof t.addEventListener!="function"||bi.has(t)||typeof KeyboardEvent!="function")return;bi.add(t);let r=!1,n=-1/0,o=a=>{let s=t.shadowRoot?.querySelector(".ML__keyboard-sink");s&&(n=performance.now(),s.dispatchEvent(new KeyboardEvent("keydown",{key:a,code:a,bubbles:!0,cancelable:!0,composed:!0})))};t.addEventListener("compositionstart",()=>r=!0,!0),t.addEventListener("compositionend",()=>r=!1,!0),t.addEventListener("keydown",a=>{let s=a;s.code||r||s.isComposing||s.defaultPrevented||s.ctrlKey||s.metaKey||s.altKey||s.key!=="Backspace"&&s.key!=="Delete"||(s.preventDefault(),s.stopImmediatePropagation(),o(s.key))},!0),t.addEventListener("beforeinput",a=>{let s=a,i=Xd[s.inputType];!i||r||s.defaultPrevented||performance.now()-n<100||(s.preventDefault(),s.stopImmediatePropagation(),o(i))},!0)}function Pn(e){let t=e;try{t?.hasFocus?.()&&t.blur?.()}catch{}}function Mn(){return Qo}var or=new WeakMap,Tt={el:null};function Wt(e){return e.shadowRoot?.querySelector(".ML__keyboard-sink")??null}var Lr=new WeakMap,Er={el:null},Zd=/(=|\+|-|\\times|\\cdot|\\le|\\ge|\\ne|\\in|\\lt|\\gt|<|>|\(|\\left\()\s*$/,ep=/([.,;:])$/;function Ut(e,t,r,n,o){let a=0,s=()=>{let c=e.nodeDOM(t)?.querySelector?.("math-field");if(c&&typeof c.executeCommand=="function"){n&&or.set(c,n);let l=Wt(c);l&&Se.prepareInput(l),c.focus(),l&&l.focus({preventScroll:!0}),document.activeElement!==c&&(Er.el=c,c.addEventListener("focus",()=>Er.el===c&&(Er.el=null),{once:!0})),r==="placeholder"?(c.position=0,c.executeCommand("moveToNextPlaceholder")):c.position=r==="end"?c.lastOffset??0:0,o&&(c.executeCommand(["typedText",o]),r==="placeholder"&&/^(\d|[+-]|-1)$/.test(o)&&c.executeCommand("moveAfterParent"));return}++a<60&&requestAnimationFrame(s)};s()}function Mt(e){e.view.focus()}function xi(e,t,r){let n=e.chain().setTextSelection(t);r&&n.insertContent(r),n.run(),Mt(e)}var Go=class{constructor({node:t,editor:r,getPos:n,extension:o}){this.field=null,this.echoed=null,this.cleanups=[],this.fieldCleanup=null,this.node=t,this.editor=r,this.getPos=typeof n=="function"?n:()=>{},this.isLine=t.type.name==="blockMath",this.options={...Yo,...o?.options},this.editable=r.isEditable,this.dom=document.createElement(this.isLine?"div":"span"),this.dom.className=this.isLine?`edp-sheet-line${this.options.centred?" edp-sheet-line--centred":""}`:"edp-sheet-formula",this.dom.dir="ltr",this.dom.setAttribute(this.isLine?"data-block-math":"data-inline-math",""),this.render();let a=()=>{this.editor.isEditable!==this.editable&&(this.editable=this.editor.isEditable,this.render())};r.on("transaction",a),this.cleanups.push(()=>r.off("transaction",a));let s=this.options.onOpenWindow;if(s){let i=c=>{if(!this.editor.isEditable||c.target?.closest?.(".edp-math-chip"))return;let l=this.getPos();l!=null&&(c.preventDefault(),s({editor:this.editor,pos:l,latex:this.latex,block:this.isLine}))};this.dom.addEventListener("dblclick",i),this.cleanups.push(()=>this.dom.removeEventListener("dblclick",i))}}get latex(){return String(this.node.attrs.latex??"")}render(){if(this.dropField(),this.dom.replaceChildren(),this.editable&&Qo){this.mountField();return}let t=document.createElement(this.isLine?"div":"span");t.className="edp-sheet-static";let r=this.latex.replace(/\\placeholder(\[[^\]]*\])?\{\}/g,"");t.innerHTML=r?Ae(r,!1):"",this.dom.append(t),this.editable&&tt().then(n=>{n&&this.editable&&!this.field&&this.dom.isConnected&&this.render()})}mountField(){let t=document.createElement("math-field");t.className=this.isLine?"edp-sheet-mf edp-sheet-mf--line":"edp-sheet-mf",t.setAttribute("math-virtual-keyboard-policy","manual"),Pt(t),t.setAttribute("smart-fence","on"),t.value=this.latex;let r=this.options.chip?[this.chip()]:[];if(this.isLine&&this.options.centred){let p=document.createElement("span");p.className="edp-sheet-line-box",p.append(t,...r),this.dom.append(p)}else this.dom.append(t,...r);Pt(t),this.field=t;let n=this.editor,o=()=>this.getPos(),a=p=>{let k=o();k!=null&&xi(n,k+this.node.nodeSize,p)},s=()=>{let p=o();p!=null&&xi(n,p)},i=()=>{let p=o();p!=null&&n.view.dispatch(n.state.tr.delete(p,p+this.node.nodeSize))},c=()=>t.position===t.lastOffset,l=()=>{or.delete(t),this.echoed=t.value;let p=o();p!=null&&n.view.dispatch(n.state.tr.setNodeMarkup(p,void 0,{...this.node.attrs,latex:t.value}))},d=()=>{Tt.el=t,Pt(t)},m=()=>{Se.isSwitching()||(Tt.el===t&&(Tt.el=null),setTimeout(()=>{!t.value&&t.isConnected&&document.activeElement!==t&&n.isEditable&&i()},0))},u=()=>{let p=o();p!=null&&(n.chain().setTextSelection(p+this.node.nodeSize).splitBlock().run(),Mt(n))};Lr.set(t,{enter:u,removeEmpty:()=>{s(),i()},leave:p=>p==="before"?s():a(),pos:o});let h=p=>{let k=p.detail?.direction;k==="backward"||k==="upward"?s():a()},f=p=>{if(p.key===" "&&!p.ctrlKey&&!p.metaKey){p.preventDefault(),p.stopPropagation(),or.delete(t);let k=t.position;if(t.executeCommand?.("moveAfterParent"),t.position!==k)return;if(!c()){t.position=t.lastOffset??t.position;return}if(!t.value||Zd.test(t.value))return;let y=t.value.match(ep)?.[1],S=o();if(y&&S!=null&&t.value.length>1){let b=t.value.slice(0,-1);t.value=b,this.echoed=b,n.view.dispatch(n.state.tr.setNodeMarkup(S,void 0,{...this.node.attrs,latex:b})),a(`${y} `);return}a(" ")}else if((p.ctrlKey||p.metaKey)&&p.key.toLowerCase()==="z"&&!p.shiftKey&&or.has(t)){p.preventDefault(),p.stopPropagation();let k=or.get(t)??[];or.delete(t);let y=o();if(y==null)return;n.chain().insertContentAt({from:y,to:y+this.node.nodeSize},k).run(),Mt(n)}else p.key==="Enter"?(p.preventDefault(),p.stopPropagation(),u()):p.key==="Backspace"&&!t.value?(p.preventDefault(),p.stopPropagation(),s(),i()):p.key==="Escape"&&(p.preventDefault(),a())};t.addEventListener("input",l),t.addEventListener("focus",d),t.addEventListener("focusout",m),t.addEventListener("move-out",h),t.addEventListener("keydown",f,!0),this.fieldCleanup=()=>{Lr.delete(t),t.removeEventListener("input",l),t.removeEventListener("focus",d),t.removeEventListener("focusout",m),t.removeEventListener("move-out",h),t.removeEventListener("keydown",f,!0),Tt.el===t&&(Tt.el=null)}}chip(){let t=document.createElement("span");t.className="edp-math-chip",t.contentEditable="false";let r=(s,i,c)=>{let l=document.createElement("button");return l.type="button",l.className=`edp-math-chip-btn ${s}`,l.textContent=i,l.addEventListener("mousedown",d=>d.preventDefault()),l.addEventListener("click",d=>{d.preventDefault(),d.stopPropagation(),c()}),l},n=r("edp-math-chip-unwrap","\xD7",()=>this.unwrap()),o=this.options.ownLine?r("edp-math-chip-line","\u2195",()=>this.toggleLine()):null,a=()=>{let s=Vd(this.editor);n.title=s.unwrap,n.setAttribute("aria-label",s.unwrap),o&&(o.title=s.ownLine,o.setAttribute("aria-label",s.ownLine),o.setAttribute("aria-pressed",String(this.isLine)))};return a(),t.addEventListener("pointerenter",a),o&&t.append(o),t.append(n),t}plainText(){return Kt(this.field?.value??this.latex)}unwrap(){let t=this.getPos();if(t==null)return;let r=Tn(this.editor.state,t,this.plainText());r&&(this.editor.view.dispatch(r),Mt(this.editor))}toggleLine(){let t=this.getPos();if(t==null)return;let r=wi(this.editor.state,t);r&&this.editor.view.dispatch(r)}dropField(){Pn(this.field),this.fieldCleanup?.(),this.fieldCleanup=null,this.field=null}update(t){if(t.type!==this.node.type)return!1;this.node=t;let r=this.field;return r?r.value!==this.latex&&this.latex!==this.echoed&&document.activeElement!==r&&(r.value=this.latex):this.render(),!0}selectNode(){this.dom.classList.add("is-selected")}deselectNode(){this.dom.classList.remove("is-selected")}stopEvent(t){return!!t.target?.closest?.("math-field, .edp-math-chip")}ignoreMutation(){return!0}destroy(){this.dropField();for(let t of this.cleanups.splice(0))t()}},Si=e=>new Go(e),Xo=yi.create({name:"inlineMath",addOptions(){return{...Yo}},group:"inline",inline:!0,atom:!0,selectable:!0,addAttributes(){return{latex:{default:""}}},parseHTML(){return[{tag:"span[data-inline-math]"}]},renderHTML({HTMLAttributes:e}){return["span",vi(e,{"data-inline-math":""})]},addNodeView(){return Si}}),Jo=yi.create({name:"blockMath",addOptions(){return{...Yo}},group:"block",atom:!0,selectable:!0,addAttributes(){return{latex:{default:""}}},parseHTML(){return[{tag:"div[data-block-math]"}]},renderHTML({HTMLAttributes:e}){return["div",vi(e,{"data-block-math":""})]},addNodeView(){return Si}});import{Extension as wp}from"@tiptap/core";import{NodeSelection as Li,Plugin as kp,PluginKey as Sp,Selection as Rp,TextSelection as Cp}from"@tiptap/pm/state";var En="\\placeholder{}",tp=/[A-Za-z0-9.,()[\]π²³+\-*×·−_'∘∩∪]/,Ai=/^[+\-−*×·=/^)]/,rp=/[+\-−*×·=(]$/,Zo={det:"\\det",ln:"\\ln",log:"\\log",exp:"\\exp",sin:"\\sin",cos:"\\cos",tan:"\\tan",max:"\\max",min:"\\min",arg:"\\arg",card:"\\operatorname{card}",Card:"\\operatorname{Card}",pgcd:"\\operatorname{pgcd}",ppcm:"\\operatorname{ppcm}",Im:"\\operatorname{Im}",Re:"\\operatorname{Re}"},Ni=new RegExp(`(^|[^A-Za-z])(${Object.keys(Zo).join("|")})(?=\\()`,"g"),np=new RegExp(`(?:${Object.keys(Zo).join("|")}|[A-Za-z]'*)$`),op=e=>/[A-Za-z]{2,}/.test(e.replace(Ni,"$1").replace(/\([^()]*\)/g,""));function Ri(e){let t=e.endsWith(" ")?e.length-1:e.length,r="",n=null;for(;t>0;){let o=t;for(;o>0&&tp.test(e[o-1]);)o--;let a=e.slice(o,t);if(!a||op(a)||n!==null&&!(rp.test(a)||Ai.test(n))||(r=e.slice(o),n=a,o<2||e[o-1]!==" "))break;t=o-1}return r}function ap(e){if(e.endsWith(")")){let r=0;for(let n=e.length-1;n>=0;n--)if(e[n]===")")r++;else if(e[n]==="("&&--r===0){let o=e.slice(0,n).match(np);return o?e.slice(n-o[0].length):e.slice(n)}return null}let t=e.match(/(\d+(?:[.,]\d+)?|[A-Za-zπ²³])$/);return t?t[0]:null}function Ir(e){return e.replace(Ni,(t,r,n)=>`${r}${Zo[n]}`).replace(/ /g,"").replace(/∘/g,"\\circ ").replace(/∩/g,"\\cap ").replace(/∪/g,"\\cup ").replace(/[*×·]/g,"\\times ").replace(/−/g,"-").replace(/π/g,"\\pi ").replace(/²/g,"^{2}").replace(/³/g,"^{3}")}var sp=e=>/[\d²³]|[+\-*×·−()]/.test(e)||/^[A-Za-zπ](\([^()]*\))?$/.test(e);function Ci(e,t){let n=e.slice(0,e.length-t.length).match(new RegExp("\uFFFC( ?)$"));if(!n)return 0;let o=t.trim();return o===""||Ai.test(o)?n[0].length:0}function ea(e,t){if(t==="t"&&/(^|[^A-Za-z])sqr$/.test(e))return{take:3,latex:`\\sqrt{${En}}`,placeholder:!0,merge:!1};if(/^[+\-−*×]$/.test(t)){let r=e.match(new RegExp("\uFFFC( ?)$"));if(!r)return null;let n=t==="*"||t==="\xD7"?"\\times ":t==="\u2212"?"-":t;return{take:r[0].length,latex:n,placeholder:!1,merge:!0}}if(t==="^"||t==="/"||t==="_"){if(e.endsWith(" "))return null;let r=Ri(e),n=r?ap(r):null;if(!r||!n||t==="_"&&!/^[A-Za-z]$/.test(n))return null;let o=Ir(r.slice(0,r.length-n.length)),a=Ir(n),s=t==="^"?`${o}${a}^{${En}}`:t==="_"?`${o}${a}_{${En}}`:`${o}\\frac{${a}}{${En}}`,i=Ci(e,r);return{take:r.length+i,latex:s,placeholder:!0,merge:i>0}}if(t==="="){let r=e.match(/([<>!])$/)?.[1],n=r?e.slice(0,-1):e,o=Ri(n),a=Ci(n,o),s=r==="<"?"\\le ":r===">"?"\\ge ":r==="!"?"\\ne ":"=";return!r&&!a&&(!o.trim()||!sp(o.trim()))?null:{take:o.length+a+(r?1:0),latex:`${Ir(o)}${s}`,placeholder:!1,merge:a>0}}return null}function _i(e){return e.replace(/\\placeholder(\[[^\]]*\])?\{\}/g,"")}import{TextSelection as ip}from"@tiptap/pm/state";var Ti=2;function cp(e,t,r,n){let o=i=>n==="rtl"?-i:i,a=i=>o(n==="rtl"?i.left:i.right),s=-1;for(let i=0;i<r.length;i++){let c=r[i].box;c.right<=c.left||t<c.top-Ti||t>c.bottom+Ti||(s<0||a(c)>a(r[s].box))&&(s=i)}return s<0||r[s].kind!=="formula"?-1:o(e)>=a(r[s].box)-1?s:-1}var lp="inlineMath";function dp(e,t){let r=e.state.doc.resolve(t),n=r.parent;if(!n.isTextblock||n.childCount===0)return null;let o=r.start(),a=e.nodeDOM(r.before());if(!(a instanceof HTMLElement))return null;let s=[],i=[];return n.forEach((c,l)=>{let d=o+l;if(c.type.name===lp){let m=e.nodeDOM(d);m instanceof HTMLElement&&(s.push({kind:"formula",box:m.getBoundingClientRect()}),i.push(d+c.nodeSize));return}if(!(!c.isText||!c.text))for(let m of c.text.matchAll(/\S+/g)){let u=e.domAtPos(d+(m.index??0)),h=e.domAtPos(d+(m.index??0)+m[0].length),f=document.createRange();try{f.setStart(u.node,u.offset),f.setEnd(h.node,h.offset)}catch{continue}for(let p of Array.from(f.getClientRects()))s.push({kind:"text",box:p}),i.push(-1)}}),{pieces:s,after:i,end:r.end(),dom:a}}function ta(e,t,r){if(!e.editable)return!1;let n=e.posAtCoords({left:t,top:r});if(!n)return!1;let o=dp(e,n.pos);if(!o)return!1;let a=getComputedStyle(o.dom).direction==="rtl"?"rtl":"ltr",s=cp(t,r,o.pieces,a);if(s<0)return!1;let i=o.after[s];return e.state.doc.textBetween(i,o.end).trim()||(i=o.end),e.dispatch(e.state.tr.setSelection(ip.create(e.state.doc,i)).scrollIntoView()),e.focus(),!0}function ra(e,t){let r=t instanceof Element?t:null;return!r||!e.dom.contains(r)?!1:!r.closest("math-field, .edp-sheet-formula, .edp-math-chip, .edp-sheet-line")}var Ln=(e,t)=>`\\begin{pmatrix}${Array.from({length:e},()=>Array.from({length:t},()=>"#?").join("&")).join("\\\\")}\\end{pmatrix}`,Pi=e=>`\\begin{vmatrix}${Array.from({length:e},()=>Array.from({length:e},()=>"#?").join("&")).join("\\\\")}\\end{vmatrix}`,Mi=e=>`\\begin{cases}${Array.from({length:e},()=>"#?").join("\\\\")}\\end{cases}`,Et=(e,t)=>`\\begin{${t}}${e}\\end{${t}}`,te="\\square",Me={lim:"\\lim\\limits_{x\\to#?}#?",matrix2:Ln(2,2),matrix3:Ln(3,3),column2:Ln(2,1),column3:Ln(3,1),det2:Pi(2),det3:Pi(3),system2:Mi(2),system3:Mi(3),identity3:"I_3",inverse:"#@^{-1}",openInterval:"\\rbrack #?;#?\\lbrack",closedInterval:"\\lbrack #?;#?\\rbrack",set:"\\lbrace #?\\rbrace",integral:"\\int_{#?}^{#?}#?\\,\\mathrm{d}x",sum:"\\sum_{#?}^{#?}#?"},j=(e,t,r,n)=>({id:e,face:r??t,action:{kind:"insert",latex:t},...n}),Q=(e,t)=>({id:`char:${e}`,face:e,text:!0,action:{kind:"insert",latex:t??e}}),In=(e,t,r)=>({id:e,face:t,text:!0,action:{kind:"command",command:e},...r?{width:r}:{}}),K={power:j("power","#@^{2}","x^{2}"),powerN:j("powerN","#@^{#?}","x^{n}"),fraction:j("fraction","\\frac{#@}{#?}","\\frac{a}{b}"),root:j("root","\\sqrt{#0}","\\sqrt{x}"),pi:j("pi","\\pi"),le:j("le","\\le"),ge:j("ge","\\ge"),ne:j("ne","\\ne"),in:j("in","\\in"),abs:j("abs","\\left|#0\\right|","|x|"),brackets:j("brackets","\\left(#0\\right)","(\\,)"),equals:j("equals","=","="),infinity:j("infinity","\\infty"),backspace:In("backspace","\u232B"),enter:In("enter","\u21B5"),left:In("left","\u2190"),right:In("right","\u2192")},pp={id:"basic",label:"123",rows:[[Q("x"),Q("y"),Q("7"),Q("8"),Q("9"),j("div","\\div","\\div"),K.fraction,K.power,K.root,K.backspace],[Q("("),Q(")"),Q("4"),Q("5"),Q("6"),j("times","\\times","\\times"),K.powerN,K.pi,K.abs,K.enter],[Q("<"),Q(">"),Q("1"),Q("2"),Q("3"),j("minus","-","-"),K.le,K.ge,K.ne,K.left],[Q(","),Q(";"),Q("0"),Q("."),K.equals,j("plus","+","+"),K.in,K.infinity,Q("%","\\%"),K.right]]},up={id:"analysis",label:"lim \u221E",rows:[[j("lim",Me.lim,"\\lim"),K.infinity,j("plusInfinity","+\\infty"),j("minusInfinity","-\\infty"),j("rightLimit","#@^{+}","x^{+}"),j("leftLimit","#@^{-}","x^{-}"),j("prime","#@'","f'"),j("compose","\\circ"),K.backspace],[j("ln","\\ln(#0)","\\ln"),j("exp","e^{#0}","e^{x}"),K.root,K.abs,K.fraction,K.powerN,K.power,K.pi,K.enter],[j("sequence","u_{#?}","u_{n}"),j("integral",Me.integral,"\\int"),j("sum",Me.sum,"\\sum"),j("to","\\to"),j("fx","f(x)","f(x)"),K.equals,K.le,K.ge,K.left],[Q("x"),Q("n"),Q("("),Q(")"),Q(","),Q(";"),Q("<"),Q(">"),K.right]]},mp={id:"sets",label:"\u211D \u222A",rows:[[j("reals","\\R","\\mathbb{R}"),j("naturals","\\N","\\mathbb{N}"),j("integers","\\Z","\\mathbb{Z}"),j("rationals","\\Q","\\mathbb{Q}"),j("setminus","\\setminus"),j("cup","\\cup"),j("cap","\\cap"),j("emptyset","\\emptyset"),K.backspace],[K.in,j("notin","\\notin"),j("subset","\\subset"),j("set",Me.set,"\\lbrace\\,\\rbrace"),j("openInterval",Me.openInterval,"\\rbrack a;b\\lbrack"),j("closedInterval",Me.closedInterval,"\\lbrack a;b\\rbrack"),j("rbrack","\\rbrack"),j("lbrack","\\lbrack"),K.enter],[Q(";"),Q(","),Q("("),Q(")"),j("minusInfinity","-\\infty"),j("plusInfinity","+\\infty"),Q("x"),K.equals,K.left],[K.le,K.ge,Q("<"),Q(">"),K.ne,j("forall","\\forall"),j("exists","\\exists"),j("implies","\\Rightarrow"),K.right]]},fp={id:"matrices",label:"(\u25A6) {",rows:[[j("matrix2",Me.matrix2,Et(`${te}&${te}\\\\${te}&${te}`,"pmatrix"),{width:1.5,small:!0}),j("matrix3",Me.matrix3,Et(`${te}&${te}&${te}\\\\${te}&${te}&${te}\\\\${te}&${te}&${te}`,"pmatrix"),{width:1.5,small:!0}),j("column2",Me.column2,Et(`${te}\\\\${te}`,"pmatrix"),{small:!0}),j("column3",Me.column3,Et(`${te}\\\\${te}\\\\${te}`,"pmatrix"),{small:!0}),j("system2",Me.system2,Et(`${te}\\\\${te}`,"cases"),{small:!0}),j("system3",Me.system3,Et(`${te}\\\\${te}\\\\${te}`,"cases"),{small:!0}),K.backspace],[j("det2",Me.det2,Et(`${te}&${te}\\\\${te}&${te}`,"vmatrix"),{width:1.5,small:!0}),j("det3",Me.det3,Et(`${te}&${te}&${te}\\\\${te}&${te}&${te}\\\\${te}&${te}&${te}`,"vmatrix"),{width:1.5,small:!0}),j("identity3",Me.identity3,"I_3"),j("inverse",Me.inverse,"A^{-1}"),j("det","\\det","\\det"),j("times","\\times","\\times"),K.enter],[j("cdot","\\cdot","\\cdot"),K.equals,Q(","),Q(";"),Q("("),Q(")"),j("vector","\\overrightarrow{#0}","\\vec{u}"),K.left],[Q("x"),Q("y"),Q("z"),Q("a"),Q("b"),Q("c"),K.ne,K.right]]},he=e=>j(e,`\\${e}`),hp={id:"greek",label:"\u03B1\u03B2\u03B3",rows:[[he("alpha"),he("beta"),he("gamma"),he("delta"),he("varepsilon"),he("theta"),he("lambda"),he("mu"),K.backspace],[he("pi"),he("rho"),he("sigma"),he("tau"),he("varphi"),he("omega"),he("Delta"),he("Omega"),K.enter],[he("Sigma"),he("Phi"),he("Gamma"),he("Lambda"),he("chi"),he("psi"),he("nu"),he("xi"),K.left],[Q("("),Q(")"),K.equals,K.ne,K.le,K.ge,K.in,K.infinity,K.right]]},$r=[pp,up,mp,fp,hp],na=[K.power,K.fraction,K.root,K.brackets,K.equals];var Ei=new Map;function gp(e,t){if(e.text)return aa(e.face);let r=`${t?"s":"h"}${e.face}`,n=Ei.get(r);return n===void 0&&(n=Ae(e.face,!1,t),Ei.set(r,n)),n}function aa(e){return e.replace(/[&<>"]/g,t=>({"&":"&","<":"<",">":">",'"':"""})[t]??t)}function bp(e,t){return t.keys[e.id]??(e.text?e.face:null)}function xp(){let e=typeof window<"u"?window.visualViewport:null;return e?Math.max(0,Math.round(window.innerHeight-(e.offsetTop+e.height))):0}var yp=420,vp=70,sa=class{constructor(t){this.controller=t,this.signature="",this.convertButtons=[],this.repeatTimer=null,this.repeated=!1,this.lastActive=null,this.lastMode="",this.root=document.createElement("div"),this.root.className="edp-kb",this.root.hidden=!0,this.root.setAttribute("role","group"),this.root.addEventListener("pointerdown",n=>n.preventDefault()),this.root.addEventListener("mousedown",n=>n.preventDefault()),this.spacer=document.createElement("div"),this.spacer.className="edp-kb-spacer",this.spacer.setAttribute("aria-hidden","true"),document.body.append(this.root,this.spacer),t.ownElements.add(this.root);let r=()=>this.place();window.visualViewport?.addEventListener("resize",r),window.visualViewport?.addEventListener("scroll",r),window.addEventListener("resize",r)}update(){let t=this.controller.state(),r=t.active;if(!(!!r&&(t.touch||t.mode==="maths"))||!r){this.root.hidden=!0,this.spacer.style.height="0px",this.signature="",this.lastActive=null;return}let o=r.labels(),a=t.touch?t.mode==="maths"?"phone-panel":"phone-bar":"desk-panel",s=[a,t.tab,r.kind,r.dir(),o.keyboard,o.tabs.basic].join("|");s!==this.signature&&(this.signature=s,this.render(a,t.tab,r.kind,r.dir(),o));for(let i of this.convertButtons)this.setConvert(i,t.caret,o);this.root.hidden=!1,this.place(),this.lastActive!==r||this.lastMode!==a?(this.lastActive=r,this.lastMode=a,requestAnimationFrame(()=>requestAnimationFrame(()=>this.keepCaretInSight()))):requestAnimationFrame(()=>this.keepCaretInSight())}render(t,r,n,o,a){this.convertButtons=[],this.root.replaceChildren(),this.root.dataset.view=t,this.root.dir=o,this.root.setAttribute("aria-label",a.keyboard);let s=t!=="desk-panel";if(t==="phone-bar"){let h=bt("edp-kb-bar");h.append(this.modeSwitch("system",a));let f=bt("edp-kb-bar-keys");f.dir="ltr";for(let p of na)f.append(this.key(p,a));h.append(f),n==="box"&&h.append(this.convertButton(a)),this.root.append(h);return}let i=bt("edp-kb-panel"),c=bt("edp-kb-head");s&&c.append(this.modeSwitch("maths",a));let l=bt("edp-kb-tabs");l.setAttribute("role","tablist"),l.setAttribute("aria-label",a.keyboard);for(let h of $r){let f=oa("edp-kb-tab",aa(h.label));f.dir="ltr",f.setAttribute("role","tab"),f.setAttribute("aria-selected",String(h.id===r)),f.title=a.tabs[h.id],f.setAttribute("aria-label",a.tabs[h.id]),f.addEventListener("click",()=>this.controller.setTab(h.id)),l.append(f)}let d=bt("edp-kb-tabs-end");n==="box"&&d.append(this.convertButton(a)),d.append(s?this.action("edp-kb-close","\u2304",a.hide,()=>this.controller.hideAll()):this.action("edp-kb-close","\u2715",a.close,()=>this.controller.setMode("system"))),c.append(l,d),i.append(c);let m=$r.find(h=>h.id===r)??$r[0],u=bt("edp-kb-keys");u.dir="ltr",u.setAttribute("role","tabpanel"),u.setAttribute("aria-label",a.tabs[m.id]);for(let h of m.rows){let f=bt("edp-kb-row");for(let p of h)f.append(this.key(p,a));u.append(f)}i.append(u),this.root.append(i)}key(t,r){let n=["edp-kb-key",t.action.kind==="command"?"edp-kb-key--command":"",t.small?"edp-kb-key--small":"",t.text?"edp-kb-key--text":""].filter(Boolean).join(" "),o=bp(t,r),a=oa(n,gp(t,o===null));t.width&&(a.style.flexGrow=String(t.width)),o!==null&&(a.setAttribute("aria-label",o),this.controller.touch()||(a.title=o));let s=()=>this.controller.press(t.action);if(t.action.kind==="command"&&t.action.command==="backspace"){a.addEventListener("pointerdown",()=>{this.repeated=!1,this.stopRepeat(),this.repeatTimer=setTimeout(()=>{let i=()=>{this.repeated=!0,s(),this.repeatTimer=setTimeout(i,vp)};i()},yp)});for(let i of["pointerup","pointerleave","pointercancel"])a.addEventListener(i,()=>this.stopRepeat());a.addEventListener("click",()=>{this.repeated||s(),this.repeated=!1})}else a.addEventListener("click",s);return a}stopRepeat(){this.repeatTimer&&clearTimeout(this.repeatTimer),this.repeatTimer=null}modeSwitch(t,r){let n=bt("edp-kb-switch"),o=(a,s,i,c)=>{let l=this.action(`edp-kb-switch-option ${s}`,i,c,()=>{this.controller.mode!==a&&this.controller.setMode(a)});return l.setAttribute("aria-pressed",String(a===t)),a===t&&l.classList.add("is-current"),l};return n.append(o("system","edp-kb-abc","abc",r.phoneKeys),o("maths","edp-kb-sigma","\u2211",r.mathsKeys)),n}action(t,r,n,o){let a=oa(`edp-kb-action ${t}`,aa(r));return a.setAttribute("aria-label",n),this.controller.touch()||(a.title=n),a.addEventListener("click",o),a}convertButton(t){let r=this.action("edp-kb-convert","fx",t.toMaths,()=>this.controller.convert());return this.convertButtons.push(r),r}setConvert(t,r,n){let o=r==="formula",a=o?"Aa":"fx";t.textContent!==a&&(t.textContent=a);let s=o?n.toText:n.toMaths;t.setAttribute("aria-label",s),this.controller.touch()||(t.title=s),t.classList.toggle("is-text",o)}place(){if(this.root.hidden)return;let r=this.root.dataset.view==="phone-bar"?xp():0;this.root.style.bottom="0px",this.root.style.setProperty("--edp-kb-under",`${r}px`),this.spacer.style.height=`${this.root.offsetHeight}px`}keepCaretInSight(){let t=this.controller.active;if(!t||this.root.hidden)return;let r=t.caretRect();if(!r)return;let n=window.visualViewport,o=n?n.offsetTop:0,a=n?n.offsetTop+n.height:window.innerHeight,s=this.root.getBoundingClientRect().top,i=Math.min(a,s)-16;r.bottom>i?window.scrollBy({top:r.bottom-i}):r.top<o+8&&window.scrollBy({top:r.top-o-8})}};function bt(e){let t=document.createElement("div");return t.className=e,t}function oa(e,t){let r=document.createElement("button");return r.type="button",r.className=e,r.tabIndex=-1,r.innerHTML=t,r}ui(e=>new sa(e));var ar="\\placeholder{}",Ap={power:{inField:"^{2}",create:"#@^{2}"},fraction:{inField:`\\frac{${ar}}{${ar}}`,create:`\\frac{${ar}}{${ar}}`},root:{inField:`\\sqrt{${ar}}`,create:`\\sqrt{${ar}}`},pi:{inField:"\\pi",create:"\\pi"},le:{inField:"\\le",create:"\\le"},ge:{inField:"\\ge",create:"\\ge"},ne:{inField:"\\ne",create:"\\ne"},in:{inField:"\\in",create:"\\in"}},Np=new Set(["\\le","\\ge","\\ne","\\in","=","+","-","\\times","\\div","\\cdot","<",">"]);function Dn(e,t){let r=e.doc.resolve(t),n=e.schema.nodes.inlineMath;return!n||!r.parent.isTextblock||r.parent.type.spec.code||r.marks().some(o=>o.type.spec.code)?!1:r.parent.canReplaceWith(r.index(),r.index(),n)}function Ii(e,t,r,n){if(!Dn(e,t))return null;let o=e.doc.resolve(t),a=t-o.parentOffset,s=e.doc.textBetween(Math.max(a,t-80),t,void 0,"\uFFFC"),i=ea(s,r);if(!i)return null;let c=t-i.take,l=i.latex,d=[],m=s.slice(s.length-i.take)+r+(n??""),u={};if(i.merge){let f=e.doc.nodeAt(c);if(f?.type.name!=="inlineMath")return null;l=`${f.attrs.latex??""}${l}`,u=f.attrs,d.push({type:"inlineMath",attrs:{...f.attrs}}),m=m.slice(1)}return d.push({type:"text",text:m}),{tr:e.tr.replaceWith(c,t,e.schema.nodes.inlineMath.create({...u,latex:l})),pos:c,placeholder:i.placeholder,revert:d}}function sr(e,t,r,n){if(!Mn())return tt(),!1;let o=Ii(e.state,t,r,n);return o?(e.dispatch(o.tr),Ut(e,o.pos,o.placeholder?"placeholder":"end",n?void 0:o.revert,n),!0):!1}function ca(e,t){return e.nodeDOM(t)?.querySelector?.("math-field")??null}var Fn=e=>/#\?|#0|#@|\\placeholder/.test(e);function _p(e,t,r,n=!1){let o=e.state.doc.resolve(t);if(!o.parent.isTextblock)return!1;let s=e.state.doc.textBetween(Math.max(t-o.parentOffset,t-2),t,void 0,"\uFFFC").match(new RegExp(`${"\uFFFC"}( ?)$`));if(!s||n&&s[1])return!1;let i=t-s[0].length;s[1]&&e.dispatch(e.state.tr.delete(t-1,t)),Ut(e,i,"end");let c=ca(e,i);return c?.executeCommand?.(["insert",r,{selectionMode:Fn(r)?"placeholder":"after"}]),!!c}function $i(e,t){let{from:r,empty:n,$from:o}=e.state.selection,a=n&&o.parent.isTextblock?r:e.state.selection.to;return Dn(e.state,a)?(e.chain().insertContentAt(a,{type:"inlineMath",attrs:{latex:""}}).run(),Ut(e.view,a,"end"),t&&ca(e.view,a)?.executeCommand?.(["insert",t,{selectionMode:Fn(t)?"placeholder":"after"}]),a):null}function ir(e){let t=Tt.el;return t&&t.isConnected&&!e.isDestroyed&&e.view.dom.contains(t)?t:null}function ia(e){let t=e.trim();if(!t)return"";let r=t.replace(/≤/g,"<=").replace(/≥/g,">=").replace(/≠/g,"!=").replace(/[×·]/g,"*").replace(/÷/g,"/").replace(/−/g,"-").replace(/√/g,"sqrt").replace(/π/g,"pi").replace(/∞/g,"oo").replace(/∈/g," in ").replace(/²/g,"^2").replace(/³/g,"^3"),n=ki(r);return n||Ir(t).replace(/<=/g,"\\le ").replace(/>=/g,"\\ge ").replace(/!=/g,"\\ne ").replace(/sqrt\(([^()]*)\)/g,"\\sqrt{$1}")}function la(e){if(ir(e))return"formula";let t=e.state.selection;if(t instanceof Li&&(t.node.type.name==="inlineMath"||t.node.type.name==="blockMath"))return"formula";if(t.empty)return"text";let r=!1;return e.state.doc.nodesBetween(t.from,t.to,n=>{n.isText&&(n.text??"").trim()&&(r=!0)}),r?"selection":"text"}function Fi(e){let{state:t,view:r}=e,{$from:n,$to:o}=t.selection,a=t.selection.from,s=n.sameParent(o)?t.selection.to:n.end();if(!Dn(t,a))return null;let i=t.doc.textBetween(a,s,void 0,"\uFFFC");if(a+=i.length-i.trimStart().length,s-=i.length-i.trimEnd().length,s<=a)return null;let c=[],l="";t.doc.nodesBetween(a,s,(u,h)=>{if(u.isText){let f=Math.max(a,h),p=Math.min(s,h+u.nodeSize);l+=(u.text??"").slice(f-h,p-h)}else u.type.name==="inlineMath"&&(l&&c.push(ia(l)),l="",c.push(String(u.attrs.latex??"")))}),l&&c.push(ia(l));let d=c.join("");if(!d)return null;let m=t.doc.slice(a,s).content.toJSON();return r.dispatch(t.tr.replaceWith(a,s,t.schema.nodes.inlineMath.create({latex:d}))),Ut(r,a,"end",m),a}function Tp(e){let t=ir(e),r,n="";if(t?(r=Lr.get(t)?.pos(),n=t.value):e.state.selection instanceof Li&&(r=e.state.selection.from,n=String(e.state.selection.node.attrs.latex??"")),r==null)return!1;let o=Tn(e.state,r,Kt(n));return o?(e.view.dispatch(o),Mt(e),!0):!1}function Fr(e){if(!e.isEditable)return;if(!Mn()){tt().then(r=>r&&Fr(e));return}let t=la(e);t==="formula"?Tp(e):t==="selection"?Fi(e):$i(e,"")}function da(e,t){if(!e.isEditable)return;if(!Mn()){tt().then(o=>o&&da(e,t));return}let r=ir(e);if(r){r.executeCommand?.(["insert",t,{selectionMode:Fn(t)?"placeholder":"after"}]);return}let{selection:n}=e.state;if(la(e)==="selection"){let o=Fi(e),a=o==null?null:ca(e.view,o);a&&(a.executeCommand?.("selectAll"),a.executeCommand?.(["insert",t,{selectionMode:Fn(t)?"placeholder":"after"}]));return}if(n.empty){let o=t.match(/^#@\^\{([^{}#]+)\}$/)?.[1];if(o&&sr(e.view,n.from,"^",o)||t==="#@^{#?}"&&sr(e.view,n.from,"^")||t==="\\frac{#@}{#?}"&&sr(e.view,n.from,"/")||_p(e.view,n.from,t,!Np.has(t)))return}$i(e,t)}function Pp(e,t){let r=new KeyboardEvent("keydown",{key:t,bubbles:!0,cancelable:!0});if(e.someProp("handleKeyDown",l=>l(e,r)))return;let n=getComputedStyle(e.dom).direction==="rtl",o=t==="ArrowRight"!==n,{state:a}=e,s=a.selection,i=o?Math.min(a.doc.content.size,s.to+1):Math.max(0,s.from-1),c=s.empty?Rp.near(a.doc.resolve(i),o?1:-1):Cp.create(a.doc,o?s.to:s.from);e.dispatch(a.tr.setSelection(c).scrollIntoView())}function Mp(e,t){if(!e.isEditable)return;let r=ir(e);if(r){let i=Lr.get(r);if(t==="enter")i?.enter();else if(t==="backspace")r.value?r.executeCommand?.("deleteBackward"):i?.removeEmpty();else{let c=r.position;r.executeCommand?.(t==="left"?"moveToPreviousChar":"moveToNextChar"),r.position===c&&Tt.el===r&&i?.leave(t==="left"?"before":"after")}return}let{view:n}=e;if(t==="left"||t==="right"){Pp(n,t==="left"?"ArrowLeft":"ArrowRight");return}let o=t==="enter"?"Enter":"Backspace",a=new KeyboardEvent("keydown",{key:o,bubbles:!0,cancelable:!0});if(n.someProp("handleKeyDown",i=>i(n,a)))return;if(t==="enter"){e.commands.splitBlock();return}let{selection:s}=n.state;if(!s.empty)n.dispatch(n.state.tr.deleteSelection());else if(s.$from.parentOffset>0){let i=n.state.doc.textBetween(s.from-Math.min(2,s.$from.parentOffset),s.from),c=i.length===2&&/[\uDC00-\uDFFF]$/.test(i)?2:1;n.dispatch(n.state.tr.delete(s.from-c,s.from))}}function zn(e){return e.storage.mathTyping}function Ep(e){return{kind:"box",get root(){return e.isDestroyed?null:e.view.dom},inputs(){if(e.isDestroyed)return[];let t=e.view.dom,r=[t];return t.querySelectorAll("math-field").forEach(n=>{let o=Wt(n);o&&r.push(o)}),r},refocus(){if(e.isDestroyed)return;let t=ir(e),r=t?Wt(t):null;if(t&&r){r.blur(),t.focus(),r.focus({preventScroll:!0});return}e.view.dom.blur(),e.view.focus()},editable:()=>!e.isDestroyed&&e.isEditable,insert:t=>da(e,t),command:t=>Mp(e,t),convert:()=>Fr(e),caret:()=>e.isDestroyed?"text":la(e),caretRect(){if(e.isDestroyed)return null;let t=ir(e);if(t)return t.getBoundingClientRect();try{return e.view.coordsAtPos(e.state.selection.head)}catch{return null}},labels:()=>zn(e)?.keyboard??nr,dir:()=>!e.isDestroyed&&getComputedStyle(e.view.dom).direction==="rtl"?"rtl":"ltr"}}function pa(e,t){let r=K[t];r.action.kind==="insert"&&da(e,r.action.latex)}function ua(e){if(!e.isEditable)return;let t=zn(e)?.target;t&&Se.openFor(t)}var Lp=new Sp("edpMathTyping"),ma=wp.create({name:"mathTyping",addStorage(){return{chip:{unwrap:"Back to text",ownLine:"On its own line"},keyboard:nr,target:null,unregister:null}},onCreate(){this.editor.isEditable&&tt();let e=Ep(this.editor);this.storage.target=e,this.storage.unregister=Se.register(e)},onDestroy(){this.storage.unregister?.(),this.storage.unregister=null,this.storage.target=null},onSelectionUpdate(){Se.active===this.storage.target&&Se.emit()},addProseMirrorPlugins(){let e=null,t=0;return[new kp({key:Lp,props:{handleDOMEvents:{touchstart(r,n){let o=n.touches[0];return e=n.touches.length===1&&o?{x:o.clientX,y:o.clientY,at:Date.now()}:null,!1},touchend(r,n){let o=e;e=null;let a=n.changedTouches[0];return!o||!a||n.touches.length>0||Math.hypot(a.clientX-o.x,a.clientY-o.y)>10||Date.now()-o.at>500||(t=Date.now(),!ra(r,n.target)||!ta(r,a.clientX,a.clientY))?!1:(n.preventDefault(),!0)},mousedown(r,n){return n.button!==0||n.shiftKey||n.detail>1||Date.now()-t<800||!ra(r,n.target)||!ta(r,n.clientX,n.clientY)?!1:(n.preventDefault(),!0)}},handleTextInput(r,n,o,a){return n!==o?!1:a.length===1?sr(r,n,a):a.length===2&&a[0]==="^"?sr(r,n,"^",a[1]):!1},handleKeyDown(r,n){let o=Er.el;if(o?.isConnected&&r.dom.contains(o)&&n.key.length===1&&!n.ctrlKey&&!n.metaKey&&!n.altKey)return o.executeCommand?.(["typedText",n.key]),n.preventDefault(),!0;let{selection:a}=r.state;if(!a.empty||n.ctrlKey||n.metaKey||n.altKey||n.isComposing)return!1;if(n.key.length===1&&sr(r,a.from,n.key))return n.preventDefault(),!0;if(n.shiftKey)return!1;let s=getComputedStyle(r.dom).direction==="rtl",i=n.key==="Backspace"||n.key===(s?"ArrowRight":"ArrowLeft"),c=n.key===(s?"ArrowLeft":"ArrowRight"),{$from:l}=a;return i&&l.nodeBefore?.type.name==="inlineMath"?(Ut(r,l.pos-l.nodeBefore.nodeSize,"end"),!0):c&&l.nodeAfter?.type.name==="inlineMath"?(Ut(r,l.pos,"start"),!0):!1}}})]}});function fa(e,t){let r=zn(e);r&&(r.chip={...r.chip,...t})}function ha(e,t){let r=zn(e);r&&(r.keyboard={...r.keyboard,...t,tabs:{...r.keyboard.tabs,...t.tabs},keys:{...r.keyboard.keys,...t.keys}},Se.active===r.target&&Se.emit())}import{useEffect as Ip,useState as $p}from"react";function Bn(){let[,e]=$p(0);return Ip(()=>Se.subscribe(()=>e(t=>t+1)),[]),Se.state()}function ga(e){let t=Bn();if(!e||e.isDestroyed)return!1;let r=e.storage.mathTyping?.target;return!!r&&t.active===r&&t.caret==="formula"}var Gp={keysAria:"Maths keys",more:"More",power:"Squared",fraction:"Fraction",root:"Square root",pi:"Pi",le:"Less than or equal to",ge:"Greater than or equal to",ne:"Not equal to",in:"Belongs to",unwrap:"Back to text",closeKeyboard:"Close the maths keyboard",toMaths:"Write as maths",toText:"Back to text"},zi={power:Dr("span",{className:"edp-key-pow",children:["x",ut("sup",{children:"2"})]}),fraction:Dr("span",{className:"edp-key-frac",children:[ut("span",{children:"a"}),ut("span",{children:"b"})]}),root:"\u221A",pi:"\u03C0",le:"\u2264",ge:"\u2265",ne:"\u2260",in:"\u2208"},Yp=["power","fraction","root","pi","le","ge","ne","in"],Qp=qp.create({name:"edpOneLine",priority:1e3,addKeyboardShortcuts(){return{Enter:()=>!0,"Shift-Enter":()=>!0,"Mod-Enter":()=>!0}}}),ba=!1;if(typeof document<"u"){document.addEventListener("pointerdown",()=>ba=!0,!0);for(let e of["pointerup","pointercancel"])document.addEventListener(e,()=>ba=!1,!0)}function Xp(e){if(!ba)return e();let t=()=>{document.removeEventListener("pointerup",t,!0),document.removeEventListener("pointercancel",t,!0),setTimeout(e,0)};document.addEventListener("pointerup",t,!0),document.addEventListener("pointercancel",t,!0)}function Jp(e,t){if(e.content.childCount<=1)return e;let r=[];return e.content.forEach(n=>{let o=[];n.isTextblock?n.content.forEach(a=>o.push(a)):n.type.name==="blockMath"&&t.nodes.inlineMath&&o.push(t.nodes.inlineMath.create({latex:n.attrs.latex})),o.length&&(r.length&&r.push(t.text(" ")),r.push(...o))}),new Kp(Hp.from(t.nodes.paragraph.create(null,r)),1,1)}function xa(e){let t=[];for(let r of e){if(r.type==="inlineMath"||r.type==="blockMath"){let o=_i(String(r.attrs?.latex??"")),a=r.type==="inlineMath"&&o.length>1?o.match(/([.,;:])$/)?.[1]:void 0;a&&(o=o.slice(0,-1)),o&&t.push({...r,attrs:{...r.attrs,latex:o}}),a&&t.push({type:"text",text:a});continue}let n=t[t.length-1];if(r.type==="text"&&n?.type==="text"&&!n.marks&&!r.marks){t[t.length-1]={...n,text:`${n.text??""}${r.text??""}`};continue}t.push(r.content?{...r,content:xa(r.content)}:r)}return t}var ya=Fp(function({initialContent:t,onChange:r,disabled:n=!1,placeholder:o,labels:a,extraTools:s,className:i,keys:c=!0,ariaLabel:l,ariaLabelledBy:d,dir:m,keyboardLabels:u,compact:h=!1,singleLine:f=!1,autoFocus:p=!1},k){let y={...Gp,...a},S=On(r);S.current=r;let b=Op({extensions:[Up.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1}),Xo,Jo,ma,Vp.configure({placeholder:o??"",showOnlyWhenEditable:!0}),...f?[Qp]:[]],immediatelyRender:!1,editable:!n,content:t?.length?{type:"doc",content:t}:"",editorProps:{attributes:{class:"edp-sheet-doc",role:"textbox","aria-multiline":f?"false":"true",...l?{"aria-label":l}:{},...d?{"aria-labelledby":d}:{},...m?{dir:m}:{}},...f?{transformPastedText:$=>$.replace(/\s*[\r\n]+\s*/g," "),transformPasted:($,q)=>Jp($,q.state.schema)}:{}},onUpdate({editor:$}){$.isEditable&&S.current(xa($.getJSON().content??[]))}});cr(()=>{n||tt()},[n]);let C=On(p&&!n);cr(()=>{if(!b||!C.current)return;let $=0,q,J=()=>{if(!b.isDestroyed){if(b.view.dom?.isConnected){C.current=!1,b.view.dispatch(b.state.tr.setSelection(Wp.atEnd(b.state.doc))),b.view.focus();return}++$<40&&(q=setTimeout(J,16))}};return q=setTimeout(J,0),()=>clearTimeout(q)},[b]),cr(()=>{b&&fa(b,{unwrap:y.unwrap})},[b,y.unwrap]),cr(()=>{b&&u&&ha(b,u)},[b,u]);let A=ga(b),w=h||f,[T,N]=zp(!1),M=On(null),R=()=>w&&N(!0),v=$=>{!w||$.currentTarget.contains($.relatedTarget)||Xp(()=>{Se.isSwitching()||M.current?.contains(document.activeElement)||N(!1)})};cr(()=>{b&&(b.setEditable(!n,!1),b.view.dispatch(b.state.tr.setMeta("edpSheetEditable",!n)))},[n,b]);let x=On(null);cr(()=>{b&&x.current&&(b.commands.setContent({type:"doc",content:x.current},{emitUpdate:!1}),x.current=null)},[b]),Dp(k,()=>({setContent($){b?b.commands.setContent({type:"doc",content:$},{emitUpdate:!1}):x.current=$},clear(){b?.commands.clearContent(!1)},getContent(){return xa(b?.getJSON().content??[])},insertFormula($){if(!b)return;let{to:q}=b.state.selection;b.chain().insertContentAt(q,[{type:"inlineMath",attrs:{latex:$}},{type:"text",text:" "}]).run(),Mt(b)}}),[b]);let B=$=>{b&&!n&&pa(b,$)},g=()=>{b&&!n&&ua(b)},P=()=>{b&&!n&&Fr(b)};return Dr("div",{ref:M,onFocusCapture:R,onBlurCapture:v,className:Di("edp-sheet-box",w&&"edp-sheet-box--compact",w&&T&&"edp-sheet-box--keys-open",f&&"edp-sheet-box--line",n&&"edp-sheet-box--readonly",i),children:[ut("div",{className:"edp-sheet-page",children:ut(jp,{editor:b})}),!n&&(c||s)&&Dr("div",{className:"edp-sheet-keys",role:"toolbar","aria-label":y.keysAria,children:[c&&Yp.map($=>ut("button",{type:"button",className:"edp-sheet-key",title:y[$],"aria-label":y[$],onMouseDown:q=>q.preventDefault(),onClick:()=>B($),children:zi[$]},$)),c&&ut("button",{type:"button",className:Di("edp-sheet-key edp-sheet-key--convert",A&&"is-text"),title:A?y.toText:y.toMaths,"aria-label":A?y.toText:y.toMaths,onMouseDown:$=>$.preventDefault(),onClick:P,children:A?"Aa":ut("i",{children:"fx"})}),c&&Dr("button",{type:"button",className:"edp-sheet-key edp-sheet-key--more",onMouseDown:$=>$.preventDefault(),onClick:g,children:[ut(Bp,{size:16,"aria-hidden":"true"})," ",y.more]}),s&&ut("span",{className:"edp-sheet-keys-extra",children:s})]})]})});function va(e){return(e??[]).map(t=>t.type==="text"?t.text??"":t.type==="inlineMath"?t.attrs?.latex?`$${t.attrs.latex}$`:"":t.type==="hardBreak"?`
|
|
2
|
+
`:va(t.content)).join("")}function wa(e){let t=[],r=n=>{for(let o of n)o.type==="blockMath"?o.attrs?.latex&&t.push(`$$${o.attrs.latex}$$`):o.type==="paragraph"?t.push(va(o.content)):o.type==="bulletList"||o.type==="orderedList"||o.type==="listItem"?r(o.content??[]):t.push(va(o.content))};return r(e),t.join(`
|
|
3
3
|
`).replace(/\n{3,}/g,`
|
|
4
4
|
|
|
5
|
-
`).trim()}function
|
|
6
|
-
`).map(t=>{let r=t.trim().match(/^\$\$([\s\S]+)\$\$$/);if(r)return{type:"blockMath",attrs:{latex:r[1].trim()}};let n=[],o=/\$\$([^$]+)\$\$|\$([^$]+)\$/g,a=0;for(let s=o.exec(t);s;s=o.exec(t))s.index>a&&n.push({type:"text",text:t.slice(a,s.index)}),n.push({type:"inlineMath",attrs:{latex:(s[1]??s[2]).trim()}}),a=s.index+s[0].length;return a<t.length&&n.push({type:"text",text:t.slice(a)}),n.length?{type:"paragraph",content:n}:{type:"paragraph"}})}import{jsx as Ce,jsxs as ut,Fragment as zd}from"react/jsx-runtime";import{useEffect as ni,useRef as Ar,useState as Ko}from"react";var Dd=4,Od=1600;async function oi(e){let t=await createImageBitmap(e),r=Math.min(1,Od/Math.max(t.width,t.height)),n=document.createElement("canvas");return n.width=Math.round(t.width*r),n.height=Math.round(t.height*r),n.getContext("2d")?.drawImage(t,0,0,n.width,n.height),t.close?.(),n.toDataURL("image/jpeg",.85)}function jd(){return typeof window<"u"&&!!window.matchMedia?.("(pointer: coarse)").matches}function ai({nodeId:e,mediaHandler:t,handler:r,onRead:n,onClose:o}){let a=re(),s=jd(),[i,c]=Ko("choose"),[l,p]=Ko(null),[f,m]=Ko(null),h=Ar(null),d=Ar(null),u=Ar(null),S=Ar(null),R=Ar(null),k=async(y,T)=>{if(!(!r.transcribePhotos||y.length===0&&T.length===0)){c("reading");try{let{content:g}=await r.transcribePhotos({images:y,photos:T},{nodeId:e});n(g,T)}catch{m(a.sheetPhotoFailed),c("error")}}},C=async y=>{let T=y.filter(g=>g.type.startsWith("image/")).slice(0,Dd);if(T.length!==0){c("uploading");try{let g=await Promise.all(T.map(A=>oi(A))),P=[];if(t)for(let A of T){let{url:W,mimeType:b}=await t.upload(A,"image");P.push({url:W,mimeType:b??A.type,name:A.name})}await k(g,P)}catch{m(a.sheetPhotoFailed),c("error")}}};ni(()=>{if(s||!r.startPhoneCapture)return;let y=new AbortController;return R.current=y,r.startPhoneCapture({nodeId:e,signal:y.signal}).then(({url:T,qrImage:g,photos:P})=>{y.signal.aborted||(p({url:T,qrImage:g}),P.then(A=>{y.signal.aborted||k([],A)}).catch(()=>{}))}).catch(()=>{}),()=>y.abort()},[]);let v=()=>{S.current?.getTracks().forEach(y=>y.stop()),S.current=null};ni(()=>v,[]);let N=async()=>{R.current?.abort();try{let y=await navigator.mediaDevices.getUserMedia({video:{facingMode:"environment"}});S.current=y,c("camera"),requestAnimationFrame(()=>{u.current&&(u.current.srcObject=y,u.current.play().catch(()=>{}))})}catch{m(a.sheetPhotoCameraFailed),c("error")}},w=()=>{let y=u.current;if(!y)return;let T=document.createElement("canvas");T.width=y.videoWidth,T.height=y.videoHeight,T.getContext("2d")?.drawImage(y,0,0),T.toBlob(g=>{v(),g&&C([new File([g],"copie.jpg",{type:"image/jpeg"})])},"image/jpeg",.9)},x=y=>{R.current?.abort();let T=Array.from(y.target.files??[]);y.target.value="",C(T)};return ut("div",{className:"edp-sheet-panel",role:"dialog","aria-label":a.sheetPhotoTitle,children:[ut("div",{className:"edp-sheet-panel-head",children:[Ce("strong",{children:a.sheetPhotoTitle}),Ce("button",{type:"button",className:"edp-sheet-panel-close",onClick:o,"aria-label":a.sheetClose,children:"\xD7"})]}),Ce("input",{ref:h,type:"file",accept:"image/*",capture:"environment",hidden:!0,onChange:x}),Ce("input",{ref:d,type:"file",accept:"image/*",multiple:!0,hidden:!0,onChange:x}),i==="choose"&&s&&ut("div",{className:"edp-sheet-panel-actions",children:[Ce("button",{type:"button",className:"edp-sheet-btn edp-sheet-btn--primary",onClick:()=>h.current?.click(),children:a.sheetPhotoTake}),Ce("button",{type:"button",className:"edp-sheet-btn",onClick:()=>d.current?.click(),children:a.sheetPhotoGallery})]}),i==="choose"&&!s&&ut(zd,{children:[r.startPhoneCapture&&ut("div",{className:"edp-sheet-qr",children:[l?Ce("img",{src:l.qrImage,alt:"",width:168,height:168}):Ce("span",{className:"edp-sheet-qr-wait"}),Ce("p",{children:a.sheetPhotoPhoneHelp})]}),Ce("p",{className:"edp-sheet-or",children:r.startPhoneCapture?a.sheetPhotoOr:null}),ut("div",{className:"edp-sheet-panel-actions",children:[Ce("button",{type:"button",className:"edp-sheet-btn",onClick:()=>d.current?.click(),children:a.sheetPhotoUpload}),Ce("button",{type:"button",className:"edp-sheet-btn",onClick:N,children:a.sheetPhotoWebcam})]})]}),i==="camera"&&ut("div",{className:"edp-sheet-camera",children:[Ce("video",{ref:u,playsInline:!0,muted:!0}),Ce("button",{type:"button",className:"edp-sheet-btn edp-sheet-btn--primary",onClick:w,children:a.sheetPhotoShoot})]}),(i==="uploading"||i==="reading")&&ut("p",{className:"edp-sheet-progress",role:"status",children:[Ce("span",{className:"player-ai-spinner","aria-hidden":"true"}),i==="uploading"?a.openResponseUploading:a.sheetPhotoReading]}),i==="error"&&ut("div",{className:"edp-sheet-error",role:"alert",children:[Ce("p",{children:f}),Ce("button",{type:"button",className:"edp-sheet-btn",onClick:()=>{m(null),c("choose")},children:a.sheetPhotoRetry})]})]})}import{jsx as mt,jsxs as Sn}from"react/jsx-runtime";import{useCallback as si,useEffect as Bd,useRef as Nr,useState as ii}from"react";var qd=900;function Vo({handler:e,onInsert:t,onClose:r}){let n=re(),o=Nr(null),a=Nr([]),s=Nr(null),i=Nr(null),c=Nr(null),[l,p]=ii(""),[f,m]=ii("idle"),h=si(()=>{let N=o.current,w=N?.getContext("2d");if(!N||!w)return;let x=window.devicePixelRatio||1;w.setTransform(x,0,0,x,0,0),w.fillStyle="#ffffff",w.fillRect(0,0,N.width,N.height),w.strokeStyle="#1d2433",w.lineWidth=3,w.lineCap="round",w.lineJoin="round";for(let y of[...a.current,...s.current?[s.current]:[]])w.beginPath(),y.forEach((T,g)=>g?w.lineTo(T.x,T.y):w.moveTo(T.x,T.y)),w.stroke()},[]);Bd(()=>{let N=o.current;if(!N)return;let w=window.devicePixelRatio||1,x=N.getBoundingClientRect();return N.width=Math.round(x.width*w),N.height=Math.round(x.height*w),h(),()=>{i.current&&clearTimeout(i.current),c.current?.abort()}},[h]);let d=si(()=>{let N=o.current;if(!N||a.current.length===0||!e.recognizeHandwriting)return;c.current?.abort();let w=new AbortController;c.current=w,m("reading"),N.toBlob(async x=>{if(!(!x||w.signal.aborted))try{let{latex:y}=await e.recognizeHandwriting(x,{signal:w.signal});w.signal.aborted||(p(y),m("idle"))}catch{w.signal.aborted||m("failed")}},"image/png")},[e]),u=N=>{let w=N.currentTarget.getBoundingClientRect();return{x:N.clientX-w.left,y:N.clientY-w.top}},S=N=>{N.currentTarget.setPointerCapture(N.pointerId),i.current&&clearTimeout(i.current),s.current=[u(N)]},R=N=>{s.current&&(s.current.push(u(N)),h())},k=()=>{s.current&&(s.current.length>1&&a.current.push(s.current),s.current=null,h(),i.current&&clearTimeout(i.current),i.current=setTimeout(d,qd))},C=()=>{a.current=[],c.current?.abort(),p(""),m("idle"),h()},v=()=>{a.current.pop(),h(),a.current.length?d():C()};return Sn("div",{className:"edp-sheet-panel",role:"dialog","aria-label":n.sheetPadTitle,children:[Sn("div",{className:"edp-sheet-panel-head",children:[mt("strong",{children:n.sheetPadTitle}),mt("button",{type:"button",className:"edp-sheet-panel-close",onClick:r,"aria-label":n.sheetClose,children:"\xD7"})]}),Sn("div",{className:"edp-sheet-pad-result",dir:"ltr","aria-live":"polite",children:[f==="reading"&&mt("span",{className:"player-ai-spinner","aria-hidden":"true"}),l?mt("span",{dangerouslySetInnerHTML:{__html:Ne(l,!1)}}):mt("span",{className:"edp-sheet-pad-help",children:f==="failed"?n.sheetPadFailed:n.sheetPadHelp})]}),mt("canvas",{ref:o,className:"edp-sheet-pad",onPointerDown:S,onPointerMove:R,onPointerUp:k,onPointerCancel:k}),Sn("div",{className:"edp-sheet-panel-actions",children:[mt("button",{type:"button",className:"edp-sheet-btn",onClick:v,children:n.sheetPadUndo}),mt("button",{type:"button",className:"edp-sheet-btn",onClick:C,children:n.sheetPadClear}),mt("button",{type:"button",className:"edp-sheet-btn edp-sheet-btn--primary",disabled:!l||f==="reading",onClick:()=>t(l),children:n.sheetPadInsert})]})]})}function Gd(e){if(!e)return null;if(e.type==="aiAnswer"){let t=e.answer,r=t.content?.length?t.content:t.text?Cr(t.text):null;return r?{content:r,photos:t.photos??[]}:null}if(e.type==="openResponse"){let t=e.answer;return t.text?.content?{content:t.text.content,photos:t.photos??[]}:null}return null}function _r({nodeId:e,answerType:t,options:r,placeholder:n,disabled:o,stateClass:a,onChange:s,mediaHandler:i,answerSheetHandler:c}){let l=re(),p=ge(),f=ci(null),[m,h]=Go([]),[d,u]=Go(null),[S,R]=Go(!1),k=ci([]);k.current=m;let C=!!r.photo&&!!c?.transcribePhotos,v=!!r.handwriting&&!!c?.recognizeHandwriting,N=r.math!==!1,w=Wd((g,P)=>{s({content:g,text:Uo(g),wordCount:kn(g),photos:P})},[s]);Ud(()=>{let g=A=>{let W=(A.answers??[]).find(M=>M.nodeId===e&&M.type===t),b=Gd(W);b&&(h(b.photos),f.current?.setContent(b.content))},P=()=>{h([]),R(!1),f.current?.clear()};return p.on("answers:prefill",g),p.on("answers:reset",P),()=>{p.off("answers:prefill",g),p.off("answers:reset",P)}},[p,e,t]);let x=(g,P)=>{let A=[...k.current,...P];h(A),k.current=A;let W=f.current?.getContent()??[],b=ri(W)?g:[...W,...g];f.current?.setContent(b),w(b,A),R(!0),u(null)},y=g=>{let P=m.filter(A=>A.url!==g);h(P),k.current=P,w(f.current?.getContent()??[],P)},T=C||v?Qt(Hd,{children:[C&&Qt("button",{type:"button",className:Yo("edp-sheet-key edp-sheet-key--tool",d==="photo"&&"is-active"),onClick:()=>u(d==="photo"?null:"photo"),"aria-expanded":d==="photo",children:[ct(Kd,{size:16,"aria-hidden":"true"})," ",l.sheetPhoto]}),v&&Qt("button",{type:"button",className:Yo("edp-sheet-key edp-sheet-key--tool",d==="pad"&&"is-active"),onClick:()=>u(d==="pad"?null:"pad"),"aria-expanded":d==="pad",children:[ct(Vd,{size:16,"aria-hidden":"true"})," ",l.sheetHandwriting]})]}):null;return Qt("div",{className:Yo("edp-sheet",o&&"edp-sheet--readonly",a),children:[S&&!o&&ct("p",{className:"edp-sheet-notice",role:"status",children:l.sheetPhotoCheck}),ct(Ho,{ref:f,onChange:g=>w(g,k.current),disabled:o,placeholder:n||(N?l.sheetPlaceholder:l.longAnswerPlaceholder),keys:N,extraTools:T,ariaLabel:l.blankAnswerAria,labels:{keysAria:l.sheetKeysAria,more:l.sheetMoreKeys,power:l.sheetKeyPower,fraction:l.sheetKeyFraction,root:l.sheetKeyRoot,pi:l.sheetKeyPi,le:l.sheetKeyLe,ge:l.sheetKeyGe,ne:l.sheetKeyNe,in:l.sheetKeyIn,unwrap:l.sheetFormulaUnwrap,closeKeyboard:l.sheetKeyboardClose}}),d==="photo"&&C&&c&&ct(ai,{nodeId:e,mediaHandler:i,handler:c,onRead:x,onClose:()=>u(null)}),d==="pad"&&v&&c&&ct(Vo,{handler:c,onInsert:g=>{f.current?.insertFormula(g),u(null)},onClose:()=>u(null)}),m.length>0&&Qt("div",{className:"edp-sheet-photos",children:[ct("span",{className:"edp-sheet-photos-label",children:l.sheetPhotoYours}),m.map(g=>Qt("span",{className:"edp-sheet-photo",children:[ct("a",{href:g.url,target:"_blank",rel:"noreferrer",children:ct("img",{src:g.url,alt:l.sheetPhotoYours})}),!o&&ct("button",{type:"button",className:"edp-sheet-photo-remove",onClick:()=>y(g.url),"aria-label":l.sheetPhotoRemove,children:"\xD7"})]},g.url))]})]})}import{jsx as Pr,jsxs as Yd,Fragment as Qd}from"react/jsx-runtime";import{Fragment as li}from"react";function di({text:e}){let t=Cr(e);return Pr(Qd,{children:t.map((r,n)=>Yd(li,{children:[n>0&&Pr("br",{}),r.type==="blockMath"?Pr("span",{className:"edp-math-text-formula",dir:"ltr",dangerouslySetInnerHTML:{__html:Ne(String(r.attrs?.latex??""),!1)}}):(r.content??[]).map((o,a)=>o.type==="inlineMath"?Pr("span",{className:"edp-math-text-formula",dir:"ltr",dangerouslySetInnerHTML:{__html:Ne(String(o.attrs?.latex??""),!1)}},a):Pr(li,{children:o.text},a))]},n))})}function nn({node:e,validationFeedback:t,readOnly:r=!1,mediaHandler:n,answerSheetHandler:o}){let a=ge(),s=re(),{id:i,attrs:c}=e,{placeholder:l,minWords:p=0,maxWords:f=500,hint:m}=c,h=!!(c.math||c.photo||c.handwriting),[d,u]=pi(""),[S,R]=pi(0),k=t?.showFeedback??!1,C=t?.state,v=f<=30,N=Xo($=>$.trim().split(/\s+/).filter(Boolean).length,[]);Qo(()=>{let $=B=>{let Y=B.answers?.find(Q=>Q.nodeId===i&&Q.type==="aiAnswer");if(Y&&Y.answer?.text!=null){let Q=Y.answer.text;u(Q),R(N(Q))}};return a.on("answers:prefill",$),()=>a.off("answers:prefill",$)},[i,a,N]),Qo(()=>{let $=()=>{u(""),R(0)};return a.on("answers:reset",$),()=>a.off("answers:reset",$)},[a]);let w=ui(null),x=Xo(($,B)=>{w.current&&clearTimeout(w.current),w.current=setTimeout(()=>{a.emit({type:"answer:changed",answer:{nodeId:i,type:"aiAnswer",timestamp:Date.now(),answer:{text:$,wordCount:B}}})},300)},[i,a]);Qo(()=>{a.emit({type:"answer:changed",answer:{nodeId:i,type:"aiAnswer",timestamp:Date.now(),answer:{text:"",wordCount:0}}})},[]);let y=$=>{if(k)return;let B=N($);u($),R(B),x($,B)},T=ui(null),g=Xo($=>{R($.wordCount),T.current&&clearTimeout(T.current),T.current=setTimeout(()=>{a.emit({type:"answer:changed",answer:{nodeId:i,type:"aiAnswer",timestamp:Date.now(),answer:{text:$.text,wordCount:$.wordCount,content:$.content,...$.photos.length?{photos:$.photos}:{}}}})},300)},[i,a]),P=C==="validating",A=Tr("player-ai-count",S>f&&"player-ai-count--over"),W=!k||P?"":C==="correct"?"player-ai-input--correct":C==="incorrect"?"player-ai-input--incorrect":C==="partial"?"player-ai-input--partial":"",b=C==="correct"?"player-ai-feedback--correct":C==="incorrect"?"player-ai-feedback--incorrect":C==="partial"?"player-ai-feedback--partial":"",M=$=>Number.isInteger($)?String($):$.toFixed(2);return Xt("div",{className:Tr("player-ai",h&&"player-ai--sheet"),children:[Xt("div",{className:"player-ai-counts",children:[Xt("span",{className:A,children:[S," / ",f," ",s.openResponseWords]}),p>0&&S<p&&Ue("span",{className:"player-ai-count player-ai-count--min",children:s.minWordsLabel(p)}),Ue("span",{style:{marginInlineStart:"auto"},children:Ue(ot,{hint:m})})]}),h?Ue(_r,{nodeId:i,answerType:"aiAnswer",options:{math:c.math,photo:c.photo,handwriting:c.handwriting},placeholder:l,disabled:k||r,stateClass:W,onChange:g,mediaHandler:n,answerSheetHandler:o}):v?Ue("input",{type:"text",value:d,onChange:$=>y($.target.value),placeholder:l??s.shortAnswerPlaceholder,"aria-label":s.blankAnswerAria,disabled:k,className:Tr("player-ai-input",W)}):Ue("textarea",{value:d,onChange:$=>y($.target.value),placeholder:l??s.longAnswerPlaceholder,"aria-label":s.blankAnswerAria,disabled:k,rows:5,className:Tr("player-ai-input player-ai-input--multiline",W)}),k&&t&&Ue("div",{className:Tr("player-ai-feedback",b),children:P?Xt("div",{className:"player-ai-validating",children:[Ue("span",{className:"player-ai-spinner"}),Ue("span",{children:s.aiEvaluationInProgress})]}):Xt(Xd,{children:[t.message&&Ue("p",{className:"player-ai-message",children:c.math?Ue(di,{text:t.message}):t.message}),t.score!=null&&t.maxScore!=null&&Ue("div",{className:"player-ai-score-row",children:Xt("span",{className:"player-ai-score",children:[M(t.score)," / ",M(t.maxScore)]})})]})})]})}import{jsx as I,jsxs as Z,Fragment as Mr}from"react/jsx-runtime";import{useState as Ee,useEffect as Ie,useRef as _e,useCallback as Rn}from"react";import{useEditor as Jd,EditorContent as Zd}from"@tiptap/react";import ep from"@tiptap/starter-kit";import ft from"clsx";import{FolderOpen as tp,Mic as rp,Video as mi,Monitor as np,Clock as op,Image as ap,FileText as fi,Music as sp,Link2 as ip,Check as cp,AlertCircle as lp}from"lucide-react";function hi(e){return e.trim().split(/\s+/).filter(Boolean).length}function gi(e){return e.length}function dp(e){let t=r=>r.map(n=>(n.text??"")+(n.content?t(n.content):"")).join(" ");return hi(t(e))}function pp(e){let t=r=>r.map(n=>(n.text??"")+(n.content?t(n.content):"")).join("");return gi(t(e))}function up(e){return/youtube\.com|youtu\.be/i.test(e)?"youtube":/vimeo\.com/i.test(e)?"vimeo":"other"}function mp(e){let t=e.match(/[?&]v=([^&]+)/)||e.match(/youtu\.be\/([^?]+)/)||e.match(/embed\/([^?]+)/);return t?t[1]:null}function Jo(e){let t=Math.floor(e/60),r=e%60;return`${t}:${r.toString().padStart(2,"0")}`}function on({node:e,validationFeedback:t,readOnly:r=!1,mediaHandler:n,answerSheetHandler:o}){let a=ge(),s=re(),{id:i,attrs:c}=e,{mode:l,placeholder:p,allowFormatting:f,wordLimit:m,characterLimit:h,allowedTypes:d,allowMultiple:u,fileInstructions:S,maxDuration:R,hint:k}=c,C=l==="text"&&!!(c.math||c.photo||c.handwriting),v=r||(t?.showFeedback??!1),N=t?.state,w=_e(null),x=Rn(A=>{w.current&&clearTimeout(w.current),w.current=setTimeout(()=>{let W=A.files?.map(b=>({url:b.url,mimeType:b.kind==="videoLink"?"video/x-link":b.mimeType,name:b.kind==="videoLink"?void 0:b.name,duration:b.kind==="videoLink"?void 0:b.duration}));a.emit({type:"answer:changed",answer:{nodeId:i,type:"openResponse",timestamp:Date.now(),answer:{...A,files:W}}})},300)},[i,a]);Ie(()=>{x({})},[]);let[y,T]=Ee([]);Ie(()=>{(l==="file"||l==="text+file")&&l==="file"&&x({files:y})},[y,l]),Ie(()=>{let A=()=>{T([])};return a.on("answers:reset",A),()=>a.off("answers:reset",A)},[a]),Ie(()=>{let A=W=>{let M=(W.answers??[]).find($=>$.nodeId===i&&$.type==="openResponse");M&&(w.current&&(clearTimeout(w.current),w.current=null),M.answer?.files&&T(M.answer.files))};return a.on("answers:prefill",A),()=>a.off("answers:prefill",A)},[i,a]);let g=t?.showFeedback,P=ft(!g&&"player-or-field--pre",g&&N==="correct"&&"player-or-field--correct",g&&N==="partial"&&"player-or-field--partial",g&&N==="incorrect"&&"player-or-field--incorrect",g&&N==="awaiting_review"&&"player-or-field--review");return Z("div",{className:"my-3 space-y-2",children:[!v&&k&&k.length>0&&I("div",{className:"flex justify-end",children:I(kt,{hint:k})}),C&&I(_r,{nodeId:i,answerType:"openResponse",options:{math:c.math,photo:c.photo,handwriting:c.handwriting},placeholder:p,disabled:v,stateClass:P,onChange:A=>x({text:{content:A.content,wordCount:A.wordCount},...A.photos.length?{photos:A.photos}:{}}),mediaHandler:n,answerSheetHandler:o}),l==="text"&&!C&&I(bi,{nodeId:i,placeholder:p,allowFormatting:f,wordLimit:m,characterLimit:h,isDisabled:v,feedbackBorderClass:P,emitAnswer:A=>x({text:A}),answerBus:a}),l==="file"&&I(Zo,{allowedTypes:d??["image"],allowMultiple:!!u,fileInstructions:S,isDisabled:v,feedbackBorderClass:P,files:y,setFiles:T,mediaHandler:n,t:s}),(l==="audio"||l==="video"||l==="screen")&&I(Sp,{nodeId:i,answerBus:a,kind:l,maxDuration:R,isDisabled:v,feedbackBorderClass:P,mediaHandler:n,emitAnswer:A=>x({recording:A}),t:s}),l==="text+file"&&I(bp,{nodeId:i,placeholder:p,allowFormatting:f,wordLimit:m,characterLimit:h,allowedTypes:d??["image"],allowMultiple:!!u,fileInstructions:S,isDisabled:v,feedbackBorderClass:P,files:y,setFiles:T,emitAnswer:x,answerBus:a,mediaHandler:n,t:s}),t?.showFeedback&&N==="awaiting_review"&&Z("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:[I(op,{size:15,style:be(15),className:"animate-pulse"}),I("span",{children:s.openResponseAwaitingReview})]}),t?.showFeedback&&N!=="awaiting_review"&&t.teacherFeedback&&I(Rp,{feedback:t.teacherFeedback,feedbackState:N,score:t.score,t:s})]})}function bi({nodeId:e,placeholder:t,allowFormatting:r,wordLimit:n,characterLimit:o,isDisabled:a,feedbackBorderClass:s,emitAnswer:i,answerBus:c}){let l=re(),[p,f]=Ee(""),[m,h]=Ee(0),[d,u]=Ee(0),S=_e(null),R=Rn(()=>{let M=S.current;M&&(M.style.height="auto",M.style.height=`${M.scrollHeight}px`)},[]),k=Jd({extensions:[ep.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1})],immediatelyRender:!1,editable:!a,content:"",onUpdate({editor:M}){if(a||!r)return;let B=M.getJSON().content??[],J=dp(B),Y=pp(B);h(J),u(Y),i({content:B,wordCount:J})}});Ie(()=>{k&&k.setEditable(!a,!1)},[a,k]);let C=_e(null);Ie(()=>{k&&C.current!==null&&(k.commands.setContent({type:"doc",content:C.current}),C.current=null)},[k]),Ie(()=>{let M=$=>{let B=($.answers??[]).find(Y=>Y.nodeId===e&&Y.type==="openResponse");if(!B?.answer?.text)return;let J=B.answer.text.content??[];if(r)k?k.commands.setContent({type:"doc",content:J}):C.current=J;else{let Y=J.flatMap(Q=>Q.content?.map(ve=>ve.text??"")??[Q.text??""]).join(`
|
|
7
|
-
`);f(Y),setTimeout(R,0)}};return c.on("answers:prefill",M),()=>c.off("answers:prefill",M)},[e,c,r,k]),Ie(()=>{let M=()=>{r&&k?k.commands.clearContent():(f(""),setTimeout(R,0)),h(0),u(0)};return c.on("answers:reset",M),()=>c.off("answers:reset",M)},[c,r,k,R]);let v=!!n,N=!!o&&!n,w=v?m:d,x=v?n?.max:o?.max,y=v?n?.min:o?.min,T=x!=null&&w>x,g=x!=null&&w>=x*.8&&!T,P=y!=null&&w<y&&w>0,A="text-xs tabular-nums",W=T?{color:"var(--pen, #d23b2b)",fontWeight:500}:g||P?{color:"var(--almost, #c8810e)"}:{color:"var(--ink-faint, #8d93a0)"},b=v?x?`${m} / ${x} ${l.openResponseWords}`:y?`${m} ${l.openResponseWords} (min. ${y})`:`${m} ${l.openResponseWords}`:N?x?`${d} / ${x} ${l.openResponseChars}`:`${d} ${l.openResponseChars}`:null;return r?Z("div",{className:"relative",children:[Z("div",{className:ft("rounded border transition-colors min-h-[120px]",s),children:[!a&&Z("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:$,style:B})=>I("button",{type:"button",onMouseDown:J=>{J.preventDefault(),k?.chain().focus()?.[$]().run()},className:`text-xs px-1.5 py-0.5 rounded hover:bg-gray-100 ${B}`,children:M},M)),I("button",{type:"button",onMouseDown:M=>{M.preventDefault(),k?.chain().focus().toggleBulletList().run()},className:"text-xs px-1.5 py-0.5 rounded hover:bg-gray-100",children:"\u2022\u2014"})]}),I(Zd,{editor:k,className:"prose prose-sm max-w-none p-3 outline-none [&_.ProseMirror]:min-h-[80px] [&_.ProseMirror]:outline-none"})]}),b&&I("div",{className:ft("absolute bottom-2 right-3",A),style:W,children:b})]}):Z("div",{className:"relative",children:[I("textarea",{ref:S,value:p,onChange:M=>{if(a)return;let $=M.target.value;f($);let B=hi($),J=gi($);h(B),u(J),R(),i({content:[{type:"paragraph",content:[{type:"text",text:$}]}],wordCount:B})},onInput:R,disabled:a,placeholder:t||l.openResponseTextPlaceholder,rows:4,style:{resize:"none",overflow:"hidden"},className:ft("w-full px-3 py-2 text-base min-h-[100px] rounded border transition-colors outline-none",s,a&&"cursor-default")}),b&&I("div",{className:ft("absolute bottom-2 right-3",A),children:b})]})}var fp={image:"image/*",pdf:"application/pdf",audio:"audio/*",video:"video/*"},hp={image:I(ap,{size:12,style:be(12)}),pdf:I(fi,{size:12,style:be(12)}),audio:I(sp,{size:12,style:be(12)}),video:I(mi,{size:12,style:be(12)}),videoLink:I(ip,{size:12,style:be(12)})};function Zo({allowedTypes:e,allowMultiple:t,fileInstructions:r,isDisabled:n,files:o,setFiles:a,mediaHandler:s,t:i,compact:c=!1}){let l=_e(null),[p,f]=Ee(!1),[m,h]=Ee(!1),[d,u]=Ee(""),S=e.some(g=>g!=="videoLink"),R=e.includes("videoLink"),k=t||o.length===0,C=e.filter(g=>g!=="videoLink").map(g=>fp[g]).filter(Boolean).join(","),v=Rn(g=>{a(P=>t?[...P,g]:[g])},[t,a]),N=Rn(g=>{a(P=>P.filter((A,W)=>W!==g))},[a]),w=async g=>{if(!(!k||n)){f(!0);try{let P=g.type.startsWith("image/")?"image":g.type==="application/pdf"?"document":g.type.startsWith("audio/")?"audio":g.type.startsWith("video/")?"video":"file";if(s){let A=await s.upload(g,P);v({kind:"file",url:A.url,mimeType:A.mimeType??g.type,name:g.name})}else{let A=URL.createObjectURL(g);v({kind:"file",url:A,mimeType:g.type,name:g.name})}}finally{f(!1)}}},x=async g=>{if(g.preventDefault(),h(!1),n||!k)return;let P=g.dataTransfer.files?.[0];P&&await w(P)},y=()=>{let g=d.trim();g&&(v({kind:"videoLink",url:g,platform:up(g)}),u(""))},T={image:i.openResponseTypeImage,pdf:i.openResponseTypePdf,audio:i.openResponseTypeAudio,video:i.openResponseTypeVideo,videoLink:i.openResponseTypeVideoLink};return Z("div",{className:"space-y-2",children:[r&&!c&&I("p",{className:"text-sm text-gray-600 italic",children:r}),o.length>0&&I("div",{className:c?"flex flex-wrap gap-1.5":"space-y-2",children:o.map((g,P)=>I(gp,{file:g,onRemove:n?void 0:()=>N(P),compact:c,t:i},P))}),!n&&k&&Z("div",{className:"space-y-2",children:[S&&!c&&Z("div",{onDragOver:g=>{g.preventDefault(),h(!0)},onDragLeave:()=>h(!1),onDrop:x,className:"border-2 border-dashed rounded-lg p-6 text-center transition-colors cursor-pointer",style:{borderColor:m?"var(--ink-faint, #8d93a0)":"var(--line-strong, #d6d3cc)",background:m?"var(--ui-muted, #f5f4f1)":"transparent"},onClick:()=>l.current?.click(),children:[I(tp,{size:26,className:"mx-auto mb-2",style:{...be(26),color:"var(--ink-soft, #565b66)"}}),I("p",{className:"text-sm font-medium",style:{color:"var(--ink-soft, #565b66)"},children:i.openResponseDropZoneLabel}),I("p",{className:"text-xs hover:underline mt-0.5",style:{color:"var(--ink, #1d2025)"},children:i.openResponseDropZoneBrowse}),p&&I("p",{className:"text-xs mt-1 animate-pulse",style:{color:"var(--ink-faint, #8d93a0)"},children:i.openResponseUploading}),I("div",{className:"flex flex-wrap justify-center gap-1.5 mt-3",children:e.filter(g=>g!=="videoLink").map(g=>Z("span",{className:"inline-flex items-center gap-1 text-[10px] px-2 py-0.5 bg-gray-100 text-gray-600 rounded-full",children:[hp[g]," ",T[g]]},g))})]}),S&&c&&I("button",{type:"button",onClick:()=>l.current?.click(),disabled:p,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:p?i.openResponseUploading:`+ ${i.openResponseAttachFile}`}),I("input",{ref:l,type:"file",accept:C,onChange:async g=>{let P=g.target.files?.[0];P&&(await w(P),g.target.value="")},className:"hidden"}),R&&Z("div",{className:"flex gap-2 flex-wrap",children:[I("input",{type:"url",value:d,onChange:g=>u(g.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:g=>{g.key==="Enter"&&(g.preventDefault(),y())}}),I("button",{type:"button",onClick:y,disabled:!d.trim(),className:"text-sm px-3 py-1.5 rounded text-white disabled:opacity-50",style:{background:"var(--ink, #1d2025)"},children:i.openResponseAddVideoLink})]})]}),n&&o.length===0&&I("p",{className:"text-sm text-gray-400 text-center py-3",children:i.openResponseNoSubmission})]})}function gp({file:e,onRemove:t,compact:r,t:n}){if(e.kind==="videoLink"){let o=e.platform==="youtube"?mp(e.url):null;return Z("div",{className:ft("bg-white rounded border border-gray-200",r?"px-2 py-1 flex items-center gap-1.5":"p-3 space-y-1"),children:[o&&!r&&I("iframe",{src:`https://www.youtube.com/embed/${o}`,width:240,height:135,allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,className:"rounded w-full"}),I("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-blue-600 underline truncate block max-w-[200px]",children:e.url}),t&&I("button",{type:"button",onClick:t,className:"ml-auto text-gray-400 hover:text-rose-500 text-xs",children:"\u2715"})]})}return Z("div",{className:ft("bg-white rounded border border-gray-200",r?"px-2 py-1 flex items-center gap-1.5":"p-2 flex items-center gap-2"),children:[e.mimeType?.startsWith("image/")?I("img",{src:e.url,alt:e.name??"upload",className:r?"h-6 w-6 object-cover rounded":"h-16 w-16 object-cover rounded"}):e.mimeType?.startsWith("audio/")?r?null:I("span",{className:"flex-1 min-w-0",children:I(rt,{src:e.url,durationHint:e.duration})}):e.mimeType?.startsWith("video/")?I("video",{src:e.url,controls:!0,className:r?"hidden":"h-16 max-w-[240px] rounded"}):I(fi,{size:20,style:{...be(20),color:"var(--ink-soft, #565b66)"}}),Z("div",{className:"flex-1 min-w-0",children:[I("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-gray-700 truncate block hover:underline",children:e.name??n.openResponseFile}),r&&e.mimeType?.startsWith("audio/")&&I(rt,{src:e.url,durationHint:e.duration})]}),t&&I("button",{type:"button",onClick:t,className:"ml-auto text-gray-400 hover:text-rose-500 text-xs shrink-0",children:"\u2715"})]})}function bp({nodeId:e,placeholder:t,allowFormatting:r,wordLimit:n,characterLimit:o,allowedTypes:a,allowMultiple:s,fileInstructions:i,isDisabled:c,feedbackBorderClass:l,files:p,setFiles:f,emitAnswer:m,answerBus:h,mediaHandler:d,t:u}){let[S,R]=Ee(null),[k,C]=Ee(!1);return Ie(()=>{m({...S&&{text:S},files:p.length>0?p:void 0})},[S,p]),Z("div",{className:"space-y-2",children:[I(bi,{nodeId:e,placeholder:t,allowFormatting:r,wordLimit:n,characterLimit:o,isDisabled:c,feedbackBorderClass:l,emitAnswer:v=>R(v),answerBus:h}),!c&&Z("div",{children:[Z("button",{type:"button",onClick:()=>C(!k),className:"flex items-center gap-1.5 text-xs",style:{color:"var(--ink-soft, #565b66)"},children:[I("span",{children:k?"\u25BE":"\u25B8"}),Z("span",{children:[u.openResponseAttachFiles,p.length>0&&I("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:p.length})]})]}),k&&I("div",{className:"mt-1.5",children:I(Zo,{allowedTypes:a,allowMultiple:s,fileInstructions:i,isDisabled:c,feedbackBorderClass:l,files:p,setFiles:f,mediaHandler:d,t:u,compact:!0})})]}),c&&p.length>0&&Z("div",{className:"space-y-1",children:[I("p",{className:"text-xs text-gray-500 font-medium",children:u.openResponseAttachedFiles}),I(Zo,{allowedTypes:a,allowMultiple:s,isDisabled:!0,feedbackBorderClass:l,files:p,setFiles:f,t:u,compact:!0})]})]})}var yp=180,xp={audio:["audio/webm;codecs=opus","audio/webm","audio/mp4;codecs=mp4a.40.2","audio/mp4","audio/aac","audio/ogg;codecs=opus"],video:["video/webm;codecs=vp9,opus","video/webm;codecs=vp8,opus","video/webm","video/mp4"]};function vp(e){if(!(typeof MediaRecorder>"u"||typeof MediaRecorder.isTypeSupported!="function"))return xp[e].find(t=>MediaRecorder.isTypeSupported(t))}function wp(e,t){let r=e.split(";")[0].trim().toLowerCase();return r.endsWith("/webm")?"webm":r.endsWith("/ogg")?"ogg":r.endsWith("/aac")?"aac":r.endsWith("/mp4")?t==="audio"?"m4a":"mp4":"webm"}function kp(e){return e instanceof DOMException?e.name==="AbortError":e?.name==="AbortError"}function Sp({nodeId:e,kind:t,maxDuration:r,isDisabled:n,feedbackBorderClass:o,mediaHandler:a,emitAnswer:s,answerBus:i,t:c}){let l=t==="audio"?"audio":"video",p=r&&r>0?r:t==="audio"?yp:null,[f,m]=Ee("idle"),[h,d]=Ee(null),[u,S]=Ee(null),[R,k]=Ee(0),[C,v]=Ee(null),[N,w]=Ee(null),x=_e(null),y=_e(null),T=_e([]),g=_e(0),P=_e(null),A=_e(null),W=_e(null),b=_e(null),M=_e(0),$=_e(null),B=_e(null),J=_e(null);Ie(()=>{let U=me=>{let oe=(me.answers??[]).find(de=>de.nodeId===e&&de.type==="openResponse")?.answer?.recording;oe?.url&&(d(oe),m("saved"))},X=()=>{$.current?.abort(),d(null),S(null),w(null),m("idle")};return i.on("answers:prefill",U),i.on("answers:reset",X),()=>{i.off("answers:prefill",U),i.off("answers:reset",X)}},[e,i]);let Y=()=>{cancelAnimationFrame(M.current);let U=b.current;b.current=null,U&&U.state!=="closed"&&U.close().catch(()=>{})},Q=()=>{y.current?.getTracks().forEach(U=>U.stop()),y.current=null};Ie(()=>()=>{P.current&&clearInterval(P.current),Y(),Q(),$.current?.abort()},[]),Ie(()=>{let U=u?.url;return()=>{U&&URL.revokeObjectURL(U)}},[u?.url]);let ve=U=>{let X=W.current,me=window.AudioContext||window.webkitAudioContext;if(!X||!me)return;let ae;try{ae=new me}catch{return}b.current=ae;let oe=ae.createAnalyser();oe.fftSize=512,ae.createMediaStreamSource(U).connect(oe);let de=new Uint8Array(oe.fftSize),Te=window.devicePixelRatio||1,Ze=Math.max(1,X.clientWidth),H=Math.max(1,X.clientHeight);X.width=Math.round(Ze*Te),X.height=Math.round(H*Te);let ee=X.getContext("2d");if(!ee)return;ee.scale(Te,Te);let te=3,pe=2,je=[],ar=Math.floor(Ze/(te+pe)),xt=0,G=sr=>{if(M.current=requestAnimationFrame(G),sr-xt<50)return;xt=sr,oe.getByteTimeDomainData(de);let ir=0;for(let et=0;et<de.length;et++){let vt=(de[et]-128)/128;ir+=vt*vt}je.push(Math.min(1,Math.sqrt(ir/de.length)*3)),je.length>ar&&je.shift(),ee.clearRect(0,0,Ze,H),ee.fillStyle="#1d2025";let Dr=Ze-je.length*(te+pe);je.forEach((et,vt)=>{let cr=Math.max(2,et*H);ee.fillRect(Dr+vt*(te+pe),(H-cr)/2,te,cr)})};M.current=requestAnimationFrame(G)};Ie(()=>{f==="recording"&&t==="audio"&&y.current&&ve(y.current)},[f]);let L=async(U,X)=>{if(!a)return;let me=new AbortController;$.current=me,B.current={file:U,duration:X},w(null),v(0),m("uploading");try{let ae=await a.upload(U,l,{onProgress:de=>{me.signal.aborted||v(Math.max(0,Math.min(1,de)))},signal:me.signal});if(me.signal.aborted)return;let oe={url:ae.url,mimeType:ae.mimeType??U.type,duration:X,kind:l};B.current=null,d(oe),m("saved"),s(oe)}catch(ae){if(me.signal.aborted||kp(ae))return;m("failed"),w(c.recorderFailed)}finally{v(null)}},_=()=>{$.current?.abort(),B.current=null,S(null),v(null),m(J.current?"saved":"idle")},q=()=>{let U=B.current;U&&L(U.file,U.duration)},z=()=>{P.current&&(clearInterval(P.current),P.current=null);let U=x.current;U&&U.state!=="inactive"&&U.stop()},O=async()=>{if(!a){w(c.recorderUnavailableHere);return}if(!(typeof MediaRecorder<"u"&&typeof navigator<"u"&&!!navigator.mediaDevices?.getUserMedia&&(t!=="screen"||!!navigator.mediaDevices.getDisplayMedia))){w(c.recorderUnsupported);return}$.current?.abort(),J.current=h,w(null),m("requesting");let X;try{if(t==="screen"){X=await navigator.mediaDevices.getDisplayMedia({video:!0,audio:!1});try{let de=(await navigator.mediaDevices.getUserMedia({audio:!0})).getAudioTracks()[0];de&&X.addTrack(de)}catch{}X.getVideoTracks()[0]?.addEventListener("ended",()=>z())}else t==="video"?X=await navigator.mediaDevices.getUserMedia({audio:!0,video:{facingMode:"user"}}):X=await navigator.mediaDevices.getUserMedia({audio:!0})}catch(oe){let de=oe?.name;m(h?"saved":"idle"),w(de==="NotAllowedError"||de==="SecurityError"||de==="NotFoundError"?c.openResponsePermissionDenied:c.recorderUnsupported);return}let me=vp(l),ae;try{ae=me?new MediaRecorder(X,{mimeType:me}):new MediaRecorder(X)}catch{try{ae=new MediaRecorder(X)}catch{X.getTracks().forEach(oe=>oe.stop()),m(h?"saved":"idle"),w(c.recorderUnsupported);return}}y.current=X,x.current=ae,T.current=[],ae.ondataavailable=oe=>{oe.data.size>0&&T.current.push(oe.data)},ae.onstop=()=>{let oe=Math.max(1,Math.round((performance.now()-g.current)/1e3)),de=ae.mimeType||me||`${l}/webm`,Te=new Blob(T.current,{type:de});if(T.current=[],Y(),Q(),A.current&&(A.current.srcObject=null),Te.size===0){m(J.current?"saved":"idle"),w(c.recorderUnsupported);return}let Ze=new File([Te],`recording.${wp(de,l)}`,{type:de});S({url:URL.createObjectURL(Te),duration:oe}),L(Ze,oe)},ae.start(250),g.current=performance.now(),k(0),m("recording"),P.current=setInterval(()=>{let oe=(performance.now()-g.current)/1e3;k(oe),p&&oe>=p&&z()},200)};Ie(()=>{let U=A.current;f==="recording"&&U&&y.current&&(U.srcObject=y.current,U.play().catch(()=>{}))},[f]);let ne=u?.url??h?.url??null,ce=u?.duration??h?.duration??null,le=ne?l==="audio"?I(rt,{src:ne,durationHint:ce}):I("video",{src:ne,controls:!0,playsInline:!0,preload:"metadata"}):null;if(n)return I("div",{className:ft("edp-rec",o),children:h?l==="audio"?I(rt,{src:h.url,durationHint:h.duration}):I("video",{src:h.url,controls:!0,playsInline:!0,preload:"metadata"}):I("p",{className:"edp-rec-message",children:c.recorderNone})});let ue=t==="audio"?I(rp,{"aria-hidden":!0}):t==="screen"?I(np,{"aria-hidden":!0}):I(mi,{"aria-hidden":!0});return Z("div",{className:ft("edp-rec",o),children:[(f==="idle"||f==="requesting")&&Z("div",{className:"edp-rec-idle",children:[I("button",{type:"button",className:"edp-rec-record",onClick:O,disabled:f==="requesting"||!a,"aria-label":t==="screen"?c.openResponseTapToRecordScreen:c.recorderRecord,children:ue}),I("span",{className:"edp-rec-label",children:f==="requesting"?c.openResponseRequestingPermission:c.recorderRecord}),p&&I("span",{className:"edp-rec-limit",children:c.recorderUpTo(Jo(p))}),!a&&I("p",{className:"edp-rec-message",children:c.recorderUnavailableHere})]}),f==="recording"&&Z(Mr,{children:[l==="video"&&I("video",{ref:A,muted:!0,playsInline:!0}),Z("div",{className:"edp-rec-live",role:"status","aria-label":c.recorderRecordingAria,children:[t==="audio"?I("canvas",{ref:W,className:"edp-rec-level","aria-hidden":!0}):I("span",{style:{flex:1}}),Z("span",{className:"edp-rec-clock",dir:"ltr",children:[I("span",{className:"edp-rec-dot","aria-hidden":!0}),Jo(Math.floor(R)),p&&Z("small",{children:["/ ",Jo(p)]})]}),Z("button",{type:"button",className:"edp-rec-stop",onClick:z,children:[I("i",{"aria-hidden":!0}),c.openResponseStopRecording]})]})]}),(f==="uploading"||f==="saved"||f==="failed")&&Z(Mr,{children:[le,Z("div",{className:"edp-rec-foot",children:[f==="uploading"&&Z(Mr,{children:[I("span",{className:"edp-rec-status","aria-live":"polite",children:C&&C>0?c.recorderSaving(Math.round(C*100)):c.openResponseUploading}),I("span",{className:"edp-rec-progress","aria-hidden":!0,children:I("span",{style:{width:`${Math.round((C??0)*100)}%`}})}),I("button",{type:"button",className:"edp-rec-link",onClick:_,children:c.recorderCancel})]}),f==="saved"&&Z(Mr,{children:[Z("span",{className:"edp-rec-status edp-rec-status--ok","aria-live":"polite",children:[I(cp,{size:16,"aria-hidden":!0}),c.recorderSaved]}),I("button",{type:"button",className:"edp-rec-link",onClick:O,children:c.recorderRecordAgain})]}),f==="failed"&&Z(Mr,{children:[Z("span",{className:"edp-rec-status edp-rec-status--error",role:"alert",children:[I(lp,{size:16,"aria-hidden":!0}),N??c.recorderFailed]}),Z("span",{style:{display:"inline-flex",gap:"1rem"},children:[I("button",{type:"button",className:"edp-rec-link",onClick:q,children:c.recorderRetry}),I("button",{type:"button",className:"edp-rec-link",onClick:O,children:c.recorderRecordAgain})]})]})]})]}),N&&f!=="failed"&&I("p",{className:"edp-rec-message",role:"alert",children:N})]})}function Rp({feedback:e,feedbackState:t,score:r,t:n}){let o=t==="correct"?{bg:"var(--ok-soft, #ecf8f0)",border:"var(--ok, #1f8a4c)",ink:"var(--ok, #1f8a4c)"}:t==="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 Z("div",{className:"rounded p-3 text-sm border",style:{background:o.bg,borderColor:o.border,color:"var(--ink, #1d2025)"},children:[I("p",{className:"text-xs font-medium mb-1 opacity-70",children:n.openResponseTeacherFeedbackLabel}),e.flatMap(a=>a.content?.map(s=>s.text??"")??[a.text??""]).join(" "),r!=null&&Z("div",{className:"mt-1 text-right",style:{fontFamily:'var(--font-hand, "Caveat", cursive)',fontSize:F("1.4rem"),lineHeight:1,color:o.ink},children:[r," pts"]})]})}import{jsx as ht,jsxs as Xe,Fragment as yi}from"react/jsx-runtime";import{useEffect as ea,useMemo as Cp,useRef as Ap,useState as xi}from"react";import{Keyboard as Np}from"lucide-react";var _p=["power","fraction","root","pi","le","ge","ne","in"];function Pp(e){return e?.showFeedback?e.state==="validating"?"validating":e.state==="correct"?"correct":e.state==="incorrect"?"incorrect":"idle":"idle"}function an({nodeId:e,placeholder:t,hint:r,validationFeedback:n,readOnly:o=!1}){let a=re(),s=ge(),i=Ap(null),[c,l]=xi(""),[p,f]=xi(!1),m=Pp(n),h=n?.score,d=n?.maxScore,u=x=>Number.isInteger(x)?String(x):x.toFixed(2),S=n?.displayAnswer,R=Cp(()=>S?Ne(S,!1):"",[S]);ea(()=>{let x=!0;return Qe().then(y=>x&&y&&f(!0)),()=>{x=!1}},[]);let k=()=>i.current,C=x=>{let y=k();if(!y||o)return;y.focus();let T=yn[x].inField;y.executeCommand?.(["insert",T,{selectionMode:T.includes("\\placeholder")?"placeholder":"after"}]),l(y.value)},v=()=>{let x=k(),y=it();if(!(!x||!y||o)){if(y.visible){y.hide();return}x.focus(),y.show(),bn(y,a.sheetKeyboardClose)}};ea(()=>{let x=y=>{let T=y.answers?.find(g=>g.nodeId===e&&g.type==="mathResponse");T?.answer?.latex!==void 0&&(l(T.answer.latex),i.current&&(i.current.value=T.answer.latex))};return s.on("answers:prefill",x),()=>s.off("answers:prefill",x)},[s,e]),ea(()=>{s.emit({type:"answer:changed",answer:{nodeId:e,type:"mathResponse",timestamp:Date.now(),answer:{latex:c}}})},[c,e,s]);let N=x=>{let y=x.target?.value??"";l(y)},w=m==="correct"?"player-math-field--correct":m==="incorrect"?"player-math-field--incorrect":m==="validating"?"player-math-field--validating":"";return Xe("div",{dir:"ltr",className:"math-response-player",children:[Xe("span",{style:{display:"inline-flex",alignItems:"center",gap:F("0.4rem")},children:[ht("div",{className:"player-math-field"+(w?" "+w:"")+(o?" player-math-field--readonly":""),children:p?ht("math-field",{ref:i,value:c,onInput:N,onFocus:x=>hn(x.currentTarget),"math-virtual-keyboard-policy":"manual","smart-fence":"true",className:"player-math-field__input",style:{opacity:o?.7:1,pointerEvents:o?"none":"auto"}}):ht("input",{type:"text",value:c,onChange:x=>l(x.target.value),placeholder:t||"Enter LaTeX (e.g. \\frac{x^2}{2})",readOnly:o,className:"player-math-field__fallback"})}),ht(ot,{hint:r})]}),p&&!o&&Xe("div",{className:"edp-sheet-keys player-math-keys",role:"toolbar","aria-label":a.sheetKeysAria,children:[_p.map(x=>ht("button",{type:"button",className:"edp-sheet-key",title:vi(a,x),"aria-label":vi(a,x),onMouseDown:y=>y.preventDefault(),onClick:()=>C(x),children:wn[x]},x)),Xe("button",{type:"button",className:"edp-sheet-key edp-sheet-key--more",onMouseDown:x=>x.preventDefault(),onClick:v,children:[ht(Np,{size:16,"aria-hidden":"true"})," ",a.sheetMoreKeys]})]}),n?.showFeedback&&Xe("div",{className:"player-math-feedback player-math-feedback--"+m,children:[m==="validating"&&Xe(yi,{children:[ht("span",{className:"player-math-spinner"}),ht("span",{children:a.mathChecking})]}),m==="correct"&&Xe(yi,{children:[Xe("span",{children:["\u2713 ",a.mathCorrect]}),h!=null&&Xe("span",{className:"player-math-score",children:[u(h),d!=null?` / ${u(d)}`:""]})]}),m==="incorrect"&&Xe("span",{children:["\u2717 ",a.mathIncorrect]}),m==="incorrect"&&R&&Xe("span",{className:"player-blank-reveal player-math-reveal",children:["(",ht("span",{dangerouslySetInnerHTML:{__html:R}}),")"]})]})]})}function vi(e,t){return{power:e.sheetKeyPower,fraction:e.sheetKeyFraction,root:e.sheetKeyRoot,pi:e.sheetKeyPi,le:e.sheetKeyLe,ge:e.sheetKeyGe,ne:e.sheetKeyNe,in:e.sheetKeyIn}[t]}import{jsx as ie,jsxs as ke,Fragment as Ir}from"react/jsx-runtime";import{useCallback as Kp,useEffect as Vp,useRef as Gp,useState as Lr}from"react";import{Play as Yp,Lock as Qp,Check as ra,X as Si}from"lucide-react";function Nn(e,t){if(e===t)return!0;if(e===null||t===null||typeof e!=typeof t||typeof e!="object")return!1;let r=Array.isArray(e),n=Array.isArray(t);if(r!==n)return!1;if(r&&n){let c=e,l=t;return c.length!==l.length?!1:c.every((p,f)=>Nn(p,l[f]))}let o=e,a=t,s=Object.keys(o),i=Object.keys(a);return s.length!==i.length?!1:s.every(c=>Nn(o[c],a[c]))}var Tp=`
|
|
5
|
+
`).trim()}function jn(e){let t=0,r=n=>{for(let o of n??[])o.type==="text"?t+=(o.text??"").trim().split(/\s+/).filter(a=>/[\p{L}\p{N}]/u.test(a)).length:(o.type==="inlineMath"||o.type==="blockMath")&&o.attrs?.latex?t+=1:r(o.content)};return r(e),t}function Bi(e){return jn(e)===0}function zr(e){return(e??"").split(`
|
|
6
|
+
`).map(t=>{let r=t.trim().match(/^\$\$([\s\S]+)\$\$$/);if(r)return{type:"blockMath",attrs:{latex:r[1].trim()}};let n=[],o=/\$\$([^$]+)\$\$|\$([^$]+)\$/g,a=0;for(let s=o.exec(t);s;s=o.exec(t))s.index>a&&n.push({type:"text",text:t.slice(a,s.index)}),n.push({type:"inlineMath",attrs:{latex:(s[1]??s[2]).trim()}}),a=s.index+s[0].length;return a<t.length&&n.push({type:"text",text:t.slice(a)}),n.length?{type:"paragraph",content:n}:{type:"paragraph"}})}import{jsx as Ee,jsxs as xt,Fragment as Zp}from"react/jsx-runtime";import{useEffect as Oi,useRef as Br,useState as ka}from"react";var eu=4,tu=1600;async function ji(e){let t=await createImageBitmap(e),r=Math.min(1,tu/Math.max(t.width,t.height)),n=document.createElement("canvas");return n.width=Math.round(t.width*r),n.height=Math.round(t.height*r),n.getContext("2d")?.drawImage(t,0,0,n.width,n.height),t.close?.(),n.toDataURL("image/jpeg",.85)}function ru(){return typeof window<"u"&&!!window.matchMedia?.("(pointer: coarse)").matches}function qi({nodeId:e,mediaHandler:t,handler:r,onRead:n,onClose:o}){let a=ae(),s=ru(),[i,c]=ka("choose"),[l,d]=ka(null),[m,u]=ka(null),h=Br(null),f=Br(null),p=Br(null),k=Br(null),y=Br(null),S=async(N,M)=>{if(!(!r.transcribePhotos||N.length===0&&M.length===0)){c("reading");try{let{content:R}=await r.transcribePhotos({images:N,photos:M},{nodeId:e});n(R,M)}catch{u(a.sheetPhotoFailed),c("error")}}},b=async N=>{let M=N.filter(R=>R.type.startsWith("image/")).slice(0,eu);if(M.length!==0){c("uploading");try{let R=await Promise.all(M.map(x=>ji(x))),v=[];if(t)for(let x of M){let{url:B,mimeType:g}=await t.upload(x,"image");v.push({url:B,mimeType:g??x.type,name:x.name})}await S(R,v)}catch{u(a.sheetPhotoFailed),c("error")}}};Oi(()=>{if(s||!r.startPhoneCapture)return;let N=new AbortController;return y.current=N,r.startPhoneCapture({nodeId:e,signal:N.signal}).then(({url:M,qrImage:R,photos:v})=>{N.signal.aborted||(d({url:M,qrImage:R}),v.then(x=>{N.signal.aborted||S([],x)}).catch(()=>{}))}).catch(()=>{}),()=>N.abort()},[]);let C=()=>{k.current?.getTracks().forEach(N=>N.stop()),k.current=null};Oi(()=>C,[]);let A=async()=>{y.current?.abort();try{let N=await navigator.mediaDevices.getUserMedia({video:{facingMode:"environment"}});k.current=N,c("camera"),requestAnimationFrame(()=>{p.current&&(p.current.srcObject=N,p.current.play().catch(()=>{}))})}catch{u(a.sheetPhotoCameraFailed),c("error")}},w=()=>{let N=p.current;if(!N)return;let M=document.createElement("canvas");M.width=N.videoWidth,M.height=N.videoHeight,M.getContext("2d")?.drawImage(N,0,0),M.toBlob(R=>{C(),R&&b([new File([R],"copie.jpg",{type:"image/jpeg"})])},"image/jpeg",.9)},T=N=>{y.current?.abort();let M=Array.from(N.target.files??[]);N.target.value="",b(M)};return xt("div",{className:"edp-sheet-panel",role:"dialog","aria-label":a.sheetPhotoTitle,children:[xt("div",{className:"edp-sheet-panel-head",children:[Ee("strong",{children:a.sheetPhotoTitle}),Ee("button",{type:"button",className:"edp-sheet-panel-close",onClick:o,"aria-label":a.sheetClose,children:"\xD7"})]}),Ee("input",{ref:h,type:"file",accept:"image/*",capture:"environment",hidden:!0,onChange:T}),Ee("input",{ref:f,type:"file",accept:"image/*",multiple:!0,hidden:!0,onChange:T}),i==="choose"&&s&&xt("div",{className:"edp-sheet-panel-actions",children:[Ee("button",{type:"button",className:"edp-sheet-btn edp-sheet-btn--primary",onClick:()=>h.current?.click(),children:a.sheetPhotoTake}),Ee("button",{type:"button",className:"edp-sheet-btn",onClick:()=>f.current?.click(),children:a.sheetPhotoGallery})]}),i==="choose"&&!s&&xt(Zp,{children:[r.startPhoneCapture&&xt("div",{className:"edp-sheet-qr",children:[l?Ee("img",{src:l.qrImage,alt:"",width:168,height:168}):Ee("span",{className:"edp-sheet-qr-wait"}),Ee("p",{children:a.sheetPhotoPhoneHelp})]}),Ee("p",{className:"edp-sheet-or",children:r.startPhoneCapture?a.sheetPhotoOr:null}),xt("div",{className:"edp-sheet-panel-actions",children:[Ee("button",{type:"button",className:"edp-sheet-btn",onClick:()=>f.current?.click(),children:a.sheetPhotoUpload}),Ee("button",{type:"button",className:"edp-sheet-btn",onClick:A,children:a.sheetPhotoWebcam})]})]}),i==="camera"&&xt("div",{className:"edp-sheet-camera",children:[Ee("video",{ref:p,playsInline:!0,muted:!0}),Ee("button",{type:"button",className:"edp-sheet-btn edp-sheet-btn--primary",onClick:w,children:a.sheetPhotoShoot})]}),(i==="uploading"||i==="reading")&&xt("p",{className:"edp-sheet-progress",role:"status",children:[Ee("span",{className:"player-ai-spinner","aria-hidden":"true"}),i==="uploading"?a.openResponseUploading:a.sheetPhotoReading]}),i==="error"&&xt("div",{className:"edp-sheet-error",role:"alert",children:[Ee("p",{children:m}),Ee("button",{type:"button",className:"edp-sheet-btn",onClick:()=>{u(null),c("choose")},children:a.sheetPhotoRetry})]})]})}import{jsx as yt,jsxs as qn}from"react/jsx-runtime";import{useCallback as Hi,useEffect as nu,useRef as Or,useState as Ki}from"react";var ou=900;function Sa({handler:e,onInsert:t,onClose:r}){let n=ae(),o=Or(null),a=Or([]),s=Or(null),i=Or(null),c=Or(null),[l,d]=Ki(""),[m,u]=Ki("idle"),h=Hi(()=>{let A=o.current,w=A?.getContext("2d");if(!A||!w)return;let T=window.devicePixelRatio||1;w.setTransform(T,0,0,T,0,0),w.fillStyle="#ffffff",w.fillRect(0,0,A.width,A.height),w.strokeStyle="#1d2433",w.lineWidth=3,w.lineCap="round",w.lineJoin="round";for(let N of[...a.current,...s.current?[s.current]:[]])w.beginPath(),N.forEach((M,R)=>R?w.lineTo(M.x,M.y):w.moveTo(M.x,M.y)),w.stroke()},[]);nu(()=>{let A=o.current;if(!A)return;let w=window.devicePixelRatio||1,T=A.getBoundingClientRect();return A.width=Math.round(T.width*w),A.height=Math.round(T.height*w),h(),()=>{i.current&&clearTimeout(i.current),c.current?.abort()}},[h]);let f=Hi(()=>{let A=o.current;if(!A||a.current.length===0||!e.recognizeHandwriting)return;c.current?.abort();let w=new AbortController;c.current=w,u("reading"),A.toBlob(async T=>{if(!(!T||w.signal.aborted))try{let{latex:N}=await e.recognizeHandwriting(T,{signal:w.signal});w.signal.aborted||(d(N),u("idle"))}catch{w.signal.aborted||u("failed")}},"image/png")},[e]),p=A=>{let w=A.currentTarget.getBoundingClientRect();return{x:A.clientX-w.left,y:A.clientY-w.top}},k=A=>{A.currentTarget.setPointerCapture(A.pointerId),i.current&&clearTimeout(i.current),s.current=[p(A)]},y=A=>{s.current&&(s.current.push(p(A)),h())},S=()=>{s.current&&(s.current.length>1&&a.current.push(s.current),s.current=null,h(),i.current&&clearTimeout(i.current),i.current=setTimeout(f,ou))},b=()=>{a.current=[],c.current?.abort(),d(""),u("idle"),h()},C=()=>{a.current.pop(),h(),a.current.length?f():b()};return qn("div",{className:"edp-sheet-panel",role:"dialog","aria-label":n.sheetPadTitle,children:[qn("div",{className:"edp-sheet-panel-head",children:[yt("strong",{children:n.sheetPadTitle}),yt("button",{type:"button",className:"edp-sheet-panel-close",onClick:r,"aria-label":n.sheetClose,children:"\xD7"})]}),qn("div",{className:"edp-sheet-pad-result",dir:"ltr","aria-live":"polite",children:[m==="reading"&&yt("span",{className:"player-ai-spinner","aria-hidden":"true"}),l?yt("span",{dangerouslySetInnerHTML:{__html:Ae(l,!1)}}):yt("span",{className:"edp-sheet-pad-help",children:m==="failed"?n.sheetPadFailed:n.sheetPadHelp})]}),yt("canvas",{ref:o,className:"edp-sheet-pad",onPointerDown:k,onPointerMove:y,onPointerUp:S,onPointerCancel:S}),qn("div",{className:"edp-sheet-panel-actions",children:[yt("button",{type:"button",className:"edp-sheet-btn",onClick:C,children:n.sheetPadUndo}),yt("button",{type:"button",className:"edp-sheet-btn",onClick:b,children:n.sheetPadClear}),yt("button",{type:"button",className:"edp-sheet-btn edp-sheet-btn--primary",disabled:!l||m==="reading",onClick:()=>t(l),children:n.sheetPadInsert})]})]})}function jr(e){return{keyboard:e.kbMaths,mathsKeys:e.kbMaths,phoneKeys:e.kbPhone,toMaths:e.kbToMaths,toText:e.kbToText,close:e.sheetKeyboardClose,hide:e.kbHide,tabs:{basic:e.kbTabBasic,analysis:e.kbTabAnalysis,sets:e.kbTabSets,matrices:e.kbTabMatrices,greek:e.kbTabGreek},keys:{power:e.sheetKeyPower,powerN:e.kbKeyPowerN,fraction:e.sheetKeyFraction,root:e.sheetKeyRoot,pi:e.sheetKeyPi,le:e.sheetKeyLe,ge:e.sheetKeyGe,ne:e.sheetKeyNe,in:e.sheetKeyIn,abs:e.kbKeyAbs,brackets:e.kbKeyBrackets,backspace:e.kbKeyBackspace,enter:e.kbKeyEnter,left:e.kbKeyLeft,right:e.kbKeyRight}}}function pu(e){if(!e)return null;if(e.type==="aiAnswer"){let t=e.answer,r=t.content?.length?t.content:t.text?zr(t.text):null;return r?{content:r,photos:t.photos??[]}:null}if(e.type==="openResponse"){let t=e.answer;return t.text?.content?{content:t.text.content,photos:t.photos??[]}:null}return null}function qr({nodeId:e,answerType:t,options:r,placeholder:n,disabled:o,stateClass:a,onChange:s,mediaHandler:i,answerSheetHandler:c}){let l=ae(),d=we(),m=Wi(null),u=cu(()=>jr(l),[l]),[h,f]=Ra([]),[p,k]=Ra(null),[y,S]=Ra(!1),b=Wi([]);b.current=h;let C=!!r.photo&&!!c?.transcribePhotos,A=!!r.handwriting&&!!c?.recognizeHandwriting,w=r.math!==!1,T=su((v,x)=>{s({content:v,text:wa(v),wordCount:jn(v),photos:x})},[s]);iu(()=>{let v=B=>{let g=(B.answers??[]).find($=>$.nodeId===e&&$.type===t),P=pu(g);P&&(f(P.photos),m.current?.setContent(P.content))},x=()=>{f([]),S(!1),m.current?.clear()};return d.on("answers:prefill",v),d.on("answers:reset",x),()=>{d.off("answers:prefill",v),d.off("answers:reset",x)}},[d,e,t]);let N=(v,x)=>{let B=[...b.current,...x];f(B),b.current=B;let g=m.current?.getContent()??[],P=Bi(g)?v:[...g,...v];m.current?.setContent(P),T(P,B),S(!0),k(null)},M=v=>{let x=h.filter(B=>B.url!==v);f(x),b.current=x,T(m.current?.getContent()??[],x)},R=C||A?lr(au,{children:[C&&lr("button",{type:"button",className:Ca("edp-sheet-key edp-sheet-key--tool",p==="photo"&&"is-active"),onClick:()=>k(p==="photo"?null:"photo"),"aria-expanded":p==="photo",children:[mt(lu,{size:16,"aria-hidden":"true"})," ",l.sheetPhoto]}),A&&lr("button",{type:"button",className:Ca("edp-sheet-key edp-sheet-key--tool",p==="pad"&&"is-active"),onClick:()=>k(p==="pad"?null:"pad"),"aria-expanded":p==="pad",children:[mt(du,{size:16,"aria-hidden":"true"})," ",l.sheetHandwriting]})]}):null;return lr("div",{className:Ca("edp-sheet",o&&"edp-sheet--readonly",a),children:[y&&!o&&mt("p",{className:"edp-sheet-notice",role:"status",children:l.sheetPhotoCheck}),mt(ya,{ref:m,onChange:v=>T(v,b.current),disabled:o,placeholder:n||(w?l.sheetPlaceholder:l.longAnswerPlaceholder),keys:w,extraTools:R,ariaLabel:l.blankAnswerAria,labels:{keysAria:l.sheetKeysAria,more:l.sheetMoreKeys,power:l.sheetKeyPower,fraction:l.sheetKeyFraction,root:l.sheetKeyRoot,pi:l.sheetKeyPi,le:l.sheetKeyLe,ge:l.sheetKeyGe,ne:l.sheetKeyNe,in:l.sheetKeyIn,unwrap:l.sheetFormulaUnwrap,closeKeyboard:l.sheetKeyboardClose,toMaths:l.kbToMaths,toText:l.kbToText},keyboardLabels:u}),p==="photo"&&C&&c&&mt(qi,{nodeId:e,mediaHandler:i,handler:c,onRead:N,onClose:()=>k(null)}),p==="pad"&&A&&c&&mt(Sa,{handler:c,onInsert:v=>{m.current?.insertFormula(v),k(null)},onClose:()=>k(null)}),h.length>0&&lr("div",{className:"edp-sheet-photos",children:[mt("span",{className:"edp-sheet-photos-label",children:l.sheetPhotoYours}),h.map(v=>lr("span",{className:"edp-sheet-photo",children:[mt("a",{href:v.url,target:"_blank",rel:"noreferrer",children:mt("img",{src:v.url,alt:l.sheetPhotoYours})}),!o&&mt("button",{type:"button",className:"edp-sheet-photo-remove",onClick:()=>M(v.url),"aria-label":l.sheetPhotoRemove,children:"\xD7"})]},v.url))]})]})}import{jsx as Hr,jsxs as uu,Fragment as mu}from"react/jsx-runtime";import{Fragment as Ui}from"react";function Vi({text:e}){let t=zr(e);return Hr(mu,{children:t.map((r,n)=>uu(Ui,{children:[n>0&&Hr("br",{}),r.type==="blockMath"?Hr("span",{className:"edp-math-text-formula",dir:"ltr",dangerouslySetInnerHTML:{__html:Ae(String(r.attrs?.latex??""),!1)}}):(r.content??[]).map((o,a)=>o.type==="inlineMath"?Hr("span",{className:"edp-math-text-formula",dir:"ltr",dangerouslySetInnerHTML:{__html:Ae(String(o.attrs?.latex??""),!1)}},a):Hr(Ui,{children:o.text},a))]},n))})}function xn({node:e,validationFeedback:t,readOnly:r=!1,mediaHandler:n,answerSheetHandler:o}){let a=we(),s=ae(),{id:i,attrs:c}=e,{placeholder:l,minWords:d=0,maxWords:m=500,hint:u}=c,h=!!(c.math||c.photo||c.handwriting),[f,p]=Yi(""),[k,y]=Yi(0),S=t?.showFeedback??!1,b=t?.state,C=m<=30,A=Na(I=>I.trim().split(/\s+/).filter(Boolean).length,[]);Aa(()=>{let I=Z=>{let E=Z.answers?.find(_=>_.nodeId===i&&_.type==="aiAnswer");if(E&&E.answer?.text!=null){let _=E.answer.text;p(_),y(A(_))}};return a.on("answers:prefill",I),()=>a.off("answers:prefill",I)},[i,a,A]),Aa(()=>{let I=()=>{p(""),y(0)};return a.on("answers:reset",I),()=>a.off("answers:reset",I)},[a]);let w=Qi(null),T=Na((I,Z)=>{w.current&&clearTimeout(w.current),w.current=setTimeout(()=>{a.emit({type:"answer:changed",answer:{nodeId:i,type:"aiAnswer",timestamp:Date.now(),answer:{text:I,wordCount:Z}}})},300)},[i,a]);Aa(()=>{a.emit({type:"answer:changed",answer:{nodeId:i,type:"aiAnswer",timestamp:Date.now(),answer:{text:"",wordCount:0}}})},[]);let N=I=>{if(S)return;let Z=A(I);p(I),y(Z),T(I,Z)},M=Qi(null),R=Na(I=>{y(I.wordCount),M.current&&clearTimeout(M.current),M.current=setTimeout(()=>{a.emit({type:"answer:changed",answer:{nodeId:i,type:"aiAnswer",timestamp:Date.now(),answer:{text:I.text,wordCount:I.wordCount,content:I.content,...I.photos.length?{photos:I.photos}:{}}}})},300)},[i,a]),v=b==="validating",x=dr("player-ai-count",k>m&&"player-ai-count--over"),B=!S||v?"":b==="correct"?"player-ai-input--correct":b==="incorrect"?"player-ai-input--incorrect":b==="partial"?"player-ai-input--partial":"",g=b==="correct"?"player-ai-feedback--correct":b==="incorrect"?"player-ai-feedback--incorrect":b==="partial"?"player-ai-feedback--partial":"",P=I=>Number.isInteger(I)?String(I):I.toFixed(2),$=t,q=($?.lines??[]).filter(I=>!!I.feedback||I.score!=null&&I.maxScore!=null),J=I=>c.math?Le(Vi,{text:I}):I;return rt("div",{className:dr("player-ai",h&&"player-ai--sheet"),children:[rt("div",{className:"player-ai-counts",children:[rt("span",{className:x,children:[k," / ",m," ",s.openResponseWords]}),d>0&&k<d&&Le("span",{className:"player-ai-count player-ai-count--min",children:s.minWordsLabel(d)}),Le("span",{style:{marginInlineStart:"auto"},children:Le(dt,{hint:u})})]}),h?Le(qr,{nodeId:i,answerType:"aiAnswer",options:{math:c.math,photo:c.photo,handwriting:c.handwriting},placeholder:l,disabled:S||r,stateClass:B,onChange:R,mediaHandler:n,answerSheetHandler:o}):C?Le("input",{type:"text",value:f,onChange:I=>N(I.target.value),placeholder:l??s.shortAnswerPlaceholder,"aria-label":s.blankAnswerAria,disabled:S,className:dr("player-ai-input",B)}):Le("textarea",{value:f,onChange:I=>N(I.target.value),placeholder:l??s.longAnswerPlaceholder,"aria-label":s.blankAnswerAria,disabled:S,rows:5,className:dr("player-ai-input player-ai-input--multiline",B)}),S&&t&&Le("div",{className:dr("player-ai-feedback",g),children:v?rt("div",{className:"player-ai-validating",children:[Le("span",{className:"player-ai-spinner"}),Le("span",{children:s.aiEvaluationInProgress})]}):rt(Gi,{children:[q.length>0?rt(Gi,{children:[Le("ul",{className:"player-ai-lines",children:q.map((I,Z)=>rt("li",{className:"player-ai-line",children:[rt("div",{className:"player-ai-line-head",children:[Le("span",{className:"player-ai-line-label",children:J(I.label)}),I.score!=null&&I.maxScore!=null&&rt("span",{className:dr("player-ai-line-mark",fu(I)),children:[P(I.score)," / ",P(I.maxScore)]})]}),I.feedback&&Le("p",{className:"player-ai-line-text",children:J(I.feedback)})]},Z))}),$?.next&&rt("p",{className:"player-ai-next",children:[Le("span",{className:"player-ai-next-mark","aria-hidden":"true",children:"\u2192"}),Le("span",{children:J($.next)})]})]}):t.message&&Le("p",{className:"player-ai-message",children:J(t.message)}),t.score!=null&&t.maxScore!=null&&Le("div",{className:"player-ai-score-row",children:rt("span",{className:"player-ai-score",children:[P(t.score)," / ",P(t.maxScore)]})})]})})]})}function fu(e){return e.score==null||e.maxScore==null||e.maxScore<=0?"":e.score>=e.maxScore?"player-ai-line-mark--full":e.score>0?"player-ai-line-mark--part":"player-ai-line-mark--none"}import{jsx as F,jsxs as re,Fragment as Kr}from"react/jsx-runtime";import{useState as Be,useEffect as je,useRef as $e,useCallback as Hn}from"react";import{useEditor as hu,EditorContent as gu}from"@tiptap/react";import bu from"@tiptap/starter-kit";import vt from"clsx";import{FolderOpen as xu,Mic as yu,Video as Xi,Monitor as vu,Clock as wu,Image as ku,FileText as Ji,Music as Su,Link2 as Ru,Check as Cu,AlertCircle as Au}from"lucide-react";function Zi(e){return e.trim().split(/\s+/).filter(Boolean).length}function ec(e){return e.length}function Nu(e){let t=r=>r.map(n=>(n.text??"")+(n.content?t(n.content):"")).join(" ");return Zi(t(e))}function _u(e){let t=r=>r.map(n=>(n.text??"")+(n.content?t(n.content):"")).join("");return ec(t(e))}function Tu(e){return/youtube\.com|youtu\.be/i.test(e)?"youtube":/vimeo\.com/i.test(e)?"vimeo":"other"}function Pu(e){let t=e.match(/[?&]v=([^&]+)/)||e.match(/youtu\.be\/([^?]+)/)||e.match(/embed\/([^?]+)/);return t?t[1]:null}function _a(e){let t=Math.floor(e/60),r=e%60;return`${t}:${r.toString().padStart(2,"0")}`}function yn({node:e,validationFeedback:t,readOnly:r=!1,mediaHandler:n,answerSheetHandler:o}){let a=we(),s=ae(),{id:i,attrs:c}=e,{mode:l,placeholder:d,allowFormatting:m,wordLimit:u,characterLimit:h,allowedTypes:f,allowMultiple:p,fileInstructions:k,maxDuration:y,hint:S}=c,b=l==="text"&&!!(c.math||c.photo||c.handwriting),C=r||(t?.showFeedback??!1),A=t?.state,w=$e(null),T=Hn(x=>{w.current&&clearTimeout(w.current),w.current=setTimeout(()=>{let B=x.files?.map(g=>({url:g.url,mimeType:g.kind==="videoLink"?"video/x-link":g.mimeType,name:g.kind==="videoLink"?void 0:g.name,duration:g.kind==="videoLink"?void 0:g.duration}));a.emit({type:"answer:changed",answer:{nodeId:i,type:"openResponse",timestamp:Date.now(),answer:{...x,files:B}}})},300)},[i,a]);je(()=>{T({})},[]);let[N,M]=Be([]);je(()=>{(l==="file"||l==="text+file")&&l==="file"&&T({files:N})},[N,l]),je(()=>{let x=()=>{M([])};return a.on("answers:reset",x),()=>a.off("answers:reset",x)},[a]),je(()=>{let x=B=>{let P=(B.answers??[]).find($=>$.nodeId===i&&$.type==="openResponse");P&&(w.current&&(clearTimeout(w.current),w.current=null),P.answer?.files&&M(P.answer.files))};return a.on("answers:prefill",x),()=>a.off("answers:prefill",x)},[i,a]);let R=t?.showFeedback,v=vt(!R&&"player-or-field--pre",R&&A==="correct"&&"player-or-field--correct",R&&A==="partial"&&"player-or-field--partial",R&&A==="incorrect"&&"player-or-field--incorrect",R&&A==="awaiting_review"&&"player-or-field--review");return re("div",{className:"my-3 space-y-2",children:[!C&&S&&S.length>0&&F("div",{className:"flex justify-end",children:F(Nt,{hint:S})}),b&&F(qr,{nodeId:i,answerType:"openResponse",options:{math:c.math,photo:c.photo,handwriting:c.handwriting},placeholder:d,disabled:C,stateClass:v,onChange:x=>T({text:{content:x.content,wordCount:x.wordCount},...x.photos.length?{photos:x.photos}:{}}),mediaHandler:n,answerSheetHandler:o}),l==="text"&&!b&&F(tc,{nodeId:i,placeholder:d,allowFormatting:m,wordLimit:u,characterLimit:h,isDisabled:C,feedbackBorderClass:v,emitAnswer:x=>T({text:x}),answerBus:a}),l==="file"&&F(Ta,{allowedTypes:f??["image"],allowMultiple:!!p,fileInstructions:k,isDisabled:C,feedbackBorderClass:v,files:N,setFiles:M,mediaHandler:n,t:s}),(l==="audio"||l==="video"||l==="screen")&&F(Ou,{nodeId:i,answerBus:a,kind:l,maxDuration:y,isDisabled:C,feedbackBorderClass:v,mediaHandler:n,emitAnswer:x=>T({recording:x}),t:s}),l==="text+file"&&F(Iu,{nodeId:i,placeholder:d,allowFormatting:m,wordLimit:u,characterLimit:h,allowedTypes:f??["image"],allowMultiple:!!p,fileInstructions:k,isDisabled:C,feedbackBorderClass:v,files:N,setFiles:M,emitAnswer:T,answerBus:a,mediaHandler:n,t:s}),t?.showFeedback&&A==="awaiting_review"&&re("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:[F(wu,{size:15,style:ke(15),className:"animate-pulse"}),F("span",{children:s.openResponseAwaitingReview})]}),t?.showFeedback&&A!=="awaiting_review"&&t.teacherFeedback&&F(ju,{feedback:t.teacherFeedback,feedbackState:A,score:t.score,t:s})]})}function tc({nodeId:e,placeholder:t,allowFormatting:r,wordLimit:n,characterLimit:o,isDisabled:a,feedbackBorderClass:s,emitAnswer:i,answerBus:c}){let l=ae(),[d,m]=Be(""),[u,h]=Be(0),[f,p]=Be(0),k=$e(null),y=Hn(()=>{let P=k.current;P&&(P.style.height="auto",P.style.height=`${P.scrollHeight}px`)},[]),S=hu({extensions:[bu.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1})],immediatelyRender:!1,editable:!a,content:"",onUpdate({editor:P}){if(a||!r)return;let q=P.getJSON().content??[],J=Nu(q),I=_u(q);h(J),p(I),i({content:q,wordCount:J})}});je(()=>{S&&S.setEditable(!a,!1)},[a,S]);let b=$e(null);je(()=>{S&&b.current!==null&&(S.commands.setContent({type:"doc",content:b.current}),b.current=null)},[S]),je(()=>{let P=$=>{let q=($.answers??[]).find(I=>I.nodeId===e&&I.type==="openResponse");if(!q?.answer?.text)return;let J=q.answer.text.content??[];if(r)S?S.commands.setContent({type:"doc",content:J}):b.current=J;else{let I=J.flatMap(Z=>Z.content?.map(ve=>ve.text??"")??[Z.text??""]).join(`
|
|
7
|
+
`);m(I),setTimeout(y,0)}};return c.on("answers:prefill",P),()=>c.off("answers:prefill",P)},[e,c,r,S]),je(()=>{let P=()=>{r&&S?S.commands.clearContent():(m(""),setTimeout(y,0)),h(0),p(0)};return c.on("answers:reset",P),()=>c.off("answers:reset",P)},[c,r,S,y]);let C=!!n,A=!!o&&!n,w=C?u:f,T=C?n?.max:o?.max,N=C?n?.min:o?.min,M=T!=null&&w>T,R=T!=null&&w>=T*.8&&!M,v=N!=null&&w<N&&w>0,x="text-xs tabular-nums",B=M?{color:"var(--pen, #d23b2b)",fontWeight:500}:R||v?{color:"var(--almost, #c8810e)"}:{color:"var(--ink-faint, #8d93a0)"},g=C?T?`${u} / ${T} ${l.openResponseWords}`:N?`${u} ${l.openResponseWords} (min. ${N})`:`${u} ${l.openResponseWords}`:A?T?`${f} / ${T} ${l.openResponseChars}`:`${f} ${l.openResponseChars}`:null;return r?re("div",{className:"relative",children:[re("div",{className:vt("rounded border transition-colors min-h-[120px]",s),children:[!a&&re("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:$,style:q})=>F("button",{type:"button",onMouseDown:J=>{J.preventDefault(),S?.chain().focus()?.[$]().run()},className:`text-xs px-1.5 py-0.5 rounded hover:bg-gray-100 ${q}`,children:P},P)),F("button",{type:"button",onMouseDown:P=>{P.preventDefault(),S?.chain().focus().toggleBulletList().run()},className:"text-xs px-1.5 py-0.5 rounded hover:bg-gray-100",children:"\u2022\u2014"})]}),F(gu,{editor:S,className:"prose prose-sm max-w-none p-3 outline-none [&_.ProseMirror]:min-h-[80px] [&_.ProseMirror]:outline-none"})]}),g&&F("div",{className:vt("absolute bottom-2 right-3",x),style:B,children:g})]}):re("div",{className:"relative",children:[F("textarea",{ref:k,value:d,onChange:P=>{if(a)return;let $=P.target.value;m($);let q=Zi($),J=ec($);h(q),p(J),y(),i({content:[{type:"paragraph",content:[{type:"text",text:$}]}],wordCount:q})},onInput:y,disabled:a,placeholder:t||l.openResponseTextPlaceholder,rows:4,style:{resize:"none",overflow:"hidden"},className:vt("w-full px-3 py-2 text-base min-h-[100px] rounded border transition-colors outline-none",s,a&&"cursor-default")}),g&&F("div",{className:vt("absolute bottom-2 right-3",x),children:g})]})}var Mu={image:"image/*",pdf:"application/pdf",audio:"audio/*",video:"video/*"},Eu={image:F(ku,{size:12,style:ke(12)}),pdf:F(Ji,{size:12,style:ke(12)}),audio:F(Su,{size:12,style:ke(12)}),video:F(Xi,{size:12,style:ke(12)}),videoLink:F(Ru,{size:12,style:ke(12)})};function Ta({allowedTypes:e,allowMultiple:t,fileInstructions:r,isDisabled:n,files:o,setFiles:a,mediaHandler:s,t:i,compact:c=!1}){let l=$e(null),[d,m]=Be(!1),[u,h]=Be(!1),[f,p]=Be(""),k=e.some(R=>R!=="videoLink"),y=e.includes("videoLink"),S=t||o.length===0,b=e.filter(R=>R!=="videoLink").map(R=>Mu[R]).filter(Boolean).join(","),C=Hn(R=>{a(v=>t?[...v,R]:[R])},[t,a]),A=Hn(R=>{a(v=>v.filter((x,B)=>B!==R))},[a]),w=async R=>{if(!(!S||n)){m(!0);try{let v=R.type.startsWith("image/")?"image":R.type==="application/pdf"?"document":R.type.startsWith("audio/")?"audio":R.type.startsWith("video/")?"video":"file";if(s){let x=await s.upload(R,v);C({kind:"file",url:x.url,mimeType:x.mimeType??R.type,name:R.name})}else{let x=URL.createObjectURL(R);C({kind:"file",url:x,mimeType:R.type,name:R.name})}}finally{m(!1)}}},T=async R=>{if(R.preventDefault(),h(!1),n||!S)return;let v=R.dataTransfer.files?.[0];v&&await w(v)},N=()=>{let R=f.trim();R&&(C({kind:"videoLink",url:R,platform:Tu(R)}),p(""))},M={image:i.openResponseTypeImage,pdf:i.openResponseTypePdf,audio:i.openResponseTypeAudio,video:i.openResponseTypeVideo,videoLink:i.openResponseTypeVideoLink};return re("div",{className:"space-y-2",children:[r&&!c&&F("p",{className:"text-sm text-gray-600 italic",children:r}),o.length>0&&F("div",{className:c?"flex flex-wrap gap-1.5":"space-y-2",children:o.map((R,v)=>F(Lu,{file:R,onRemove:n?void 0:()=>A(v),compact:c,t:i},v))}),!n&&S&&re("div",{className:"space-y-2",children:[k&&!c&&re("div",{onDragOver:R=>{R.preventDefault(),h(!0)},onDragLeave:()=>h(!1),onDrop:T,className:"border-2 border-dashed rounded-lg p-6 text-center transition-colors cursor-pointer",style:{borderColor:u?"var(--ink-faint, #8d93a0)":"var(--line-strong, #d6d3cc)",background:u?"var(--ui-muted, #f5f4f1)":"transparent"},onClick:()=>l.current?.click(),children:[F(xu,{size:26,className:"mx-auto mb-2",style:{...ke(26),color:"var(--ink-soft, #565b66)"}}),F("p",{className:"text-sm font-medium",style:{color:"var(--ink-soft, #565b66)"},children:i.openResponseDropZoneLabel}),F("p",{className:"text-xs hover:underline mt-0.5",style:{color:"var(--ink, #1d2025)"},children:i.openResponseDropZoneBrowse}),d&&F("p",{className:"text-xs mt-1 animate-pulse",style:{color:"var(--ink-faint, #8d93a0)"},children:i.openResponseUploading}),F("div",{className:"flex flex-wrap justify-center gap-1.5 mt-3",children:e.filter(R=>R!=="videoLink").map(R=>re("span",{className:"inline-flex items-center gap-1 text-[10px] px-2 py-0.5 bg-gray-100 text-gray-600 rounded-full",children:[Eu[R]," ",M[R]]},R))})]}),k&&c&&F("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}`}),F("input",{ref:l,type:"file",accept:b,onChange:async R=>{let v=R.target.files?.[0];v&&(await w(v),R.target.value="")},className:"hidden"}),y&&re("div",{className:"flex gap-2 flex-wrap",children:[F("input",{type:"url",value:f,onChange:R=>p(R.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:R=>{R.key==="Enter"&&(R.preventDefault(),N())}}),F("button",{type:"button",onClick:N,disabled:!f.trim(),className:"text-sm px-3 py-1.5 rounded text-white disabled:opacity-50",style:{background:"var(--ink, #1d2025)"},children:i.openResponseAddVideoLink})]})]}),n&&o.length===0&&F("p",{className:"text-sm text-gray-400 text-center py-3",children:i.openResponseNoSubmission})]})}function Lu({file:e,onRemove:t,compact:r,t:n}){if(e.kind==="videoLink"){let o=e.platform==="youtube"?Pu(e.url):null;return re("div",{className:vt("bg-white rounded border border-gray-200",r?"px-2 py-1 flex items-center gap-1.5":"p-3 space-y-1"),children:[o&&!r&&F("iframe",{src:`https://www.youtube.com/embed/${o}`,width:240,height:135,allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,className:"rounded w-full"}),F("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-blue-600 underline truncate block max-w-[200px]",children:e.url}),t&&F("button",{type:"button",onClick:t,className:"ml-auto text-gray-400 hover:text-rose-500 text-xs",children:"\u2715"})]})}return re("div",{className:vt("bg-white rounded border border-gray-200",r?"px-2 py-1 flex items-center gap-1.5":"p-2 flex items-center gap-2"),children:[e.mimeType?.startsWith("image/")?F("img",{src:e.url,alt:e.name??"upload",className:r?"h-6 w-6 object-cover rounded":"h-16 w-16 object-cover rounded"}):e.mimeType?.startsWith("audio/")?r?null:F("span",{className:"flex-1 min-w-0",children:F(ct,{src:e.url,durationHint:e.duration})}):e.mimeType?.startsWith("video/")?F("video",{src:e.url,controls:!0,className:r?"hidden":"h-16 max-w-[240px] rounded"}):F(Ji,{size:20,style:{...ke(20),color:"var(--ink-soft, #565b66)"}}),re("div",{className:"flex-1 min-w-0",children:[F("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-gray-700 truncate block hover:underline",children:e.name??n.openResponseFile}),r&&e.mimeType?.startsWith("audio/")&&F(ct,{src:e.url,durationHint:e.duration})]}),t&&F("button",{type:"button",onClick:t,className:"ml-auto text-gray-400 hover:text-rose-500 text-xs shrink-0",children:"\u2715"})]})}function Iu({nodeId:e,placeholder:t,allowFormatting:r,wordLimit:n,characterLimit:o,allowedTypes:a,allowMultiple:s,fileInstructions:i,isDisabled:c,feedbackBorderClass:l,files:d,setFiles:m,emitAnswer:u,answerBus:h,mediaHandler:f,t:p}){let[k,y]=Be(null),[S,b]=Be(!1);return je(()=>{u({...k&&{text:k},files:d.length>0?d:void 0})},[k,d]),re("div",{className:"space-y-2",children:[F(tc,{nodeId:e,placeholder:t,allowFormatting:r,wordLimit:n,characterLimit:o,isDisabled:c,feedbackBorderClass:l,emitAnswer:C=>y(C),answerBus:h}),!c&&re("div",{children:[re("button",{type:"button",onClick:()=>b(!S),className:"flex items-center gap-1.5 text-xs",style:{color:"var(--ink-soft, #565b66)"},children:[F("span",{children:S?"\u25BE":"\u25B8"}),re("span",{children:[p.openResponseAttachFiles,d.length>0&&F("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})]})]}),S&&F("div",{className:"mt-1.5",children:F(Ta,{allowedTypes:a,allowMultiple:s,fileInstructions:i,isDisabled:c,feedbackBorderClass:l,files:d,setFiles:m,mediaHandler:f,t:p,compact:!0})})]}),c&&d.length>0&&re("div",{className:"space-y-1",children:[F("p",{className:"text-xs text-gray-500 font-medium",children:p.openResponseAttachedFiles}),F(Ta,{allowedTypes:a,allowMultiple:s,isDisabled:!0,feedbackBorderClass:l,files:d,setFiles:m,t:p,compact:!0})]})]})}var $u=180,Fu={audio:["audio/webm;codecs=opus","audio/webm","audio/mp4;codecs=mp4a.40.2","audio/mp4","audio/aac","audio/ogg;codecs=opus"],video:["video/webm;codecs=vp9,opus","video/webm;codecs=vp8,opus","video/webm","video/mp4"]};function Du(e){if(!(typeof MediaRecorder>"u"||typeof MediaRecorder.isTypeSupported!="function"))return Fu[e].find(t=>MediaRecorder.isTypeSupported(t))}function zu(e,t){let r=e.split(";")[0].trim().toLowerCase();return r.endsWith("/webm")?"webm":r.endsWith("/ogg")?"ogg":r.endsWith("/aac")?"aac":r.endsWith("/mp4")?t==="audio"?"m4a":"mp4":"webm"}function Bu(e){return e instanceof DOMException?e.name==="AbortError":e?.name==="AbortError"}function Ou({nodeId:e,kind:t,maxDuration:r,isDisabled:n,feedbackBorderClass:o,mediaHandler:a,emitAnswer:s,answerBus:i,t:c}){let l=t==="audio"?"audio":"video",d=r&&r>0?r:t==="audio"?$u:null,[m,u]=Be("idle"),[h,f]=Be(null),[p,k]=Be(null),[y,S]=Be(0),[b,C]=Be(null),[A,w]=Be(null),T=$e(null),N=$e(null),M=$e([]),R=$e(0),v=$e(null),x=$e(null),B=$e(null),g=$e(null),P=$e(0),$=$e(null),q=$e(null),J=$e(null);je(()=>{let V=be=>{let ie=(be.answers??[]).find(me=>me.nodeId===e&&me.type==="openResponse")?.answer?.recording;ie?.url&&(f(ie),u("saved"))},ee=()=>{$.current?.abort(),f(null),k(null),w(null),u("idle")};return i.on("answers:prefill",V),i.on("answers:reset",ee),()=>{i.off("answers:prefill",V),i.off("answers:reset",ee)}},[e,i]);let I=()=>{cancelAnimationFrame(P.current);let V=g.current;g.current=null,V&&V.state!=="closed"&&V.close().catch(()=>{})},Z=()=>{N.current?.getTracks().forEach(V=>V.stop()),N.current=null};je(()=>()=>{v.current&&clearInterval(v.current),I(),Z(),$.current?.abort()},[]),je(()=>{let V=p?.url;return()=>{V&&URL.revokeObjectURL(V)}},[p?.url]);let ve=V=>{let ee=B.current,be=window.AudioContext||window.webkitAudioContext;if(!ee||!be)return;let ce;try{ce=new be}catch{return}g.current=ce;let ie=ce.createAnalyser();ie.fftSize=512,ce.createMediaStreamSource(V).connect(ie);let me=new Uint8Array(ie.fftSize),De=window.devicePixelRatio||1,at=Math.max(1,ee.clientWidth),U=Math.max(1,ee.clientHeight);ee.width=Math.round(at*De),ee.height=Math.round(U*De);let ne=ee.getContext("2d");if(!ne)return;ne.scale(De,De);let oe=3,fe=2,Ue=[],xr=Math.floor(at/(oe+fe)),Rt=0,X=yr=>{if(P.current=requestAnimationFrame(X),yr-Rt<50)return;Rt=yr,ie.getByteTimeDomainData(me);let vr=0;for(let st=0;st<me.length;st++){let Ct=(me[st]-128)/128;vr+=Ct*Ct}Ue.push(Math.min(1,Math.sqrt(vr/me.length)*3)),Ue.length>xr&&Ue.shift(),ne.clearRect(0,0,at,U),ne.fillStyle="#1d2025";let Jr=at-Ue.length*(oe+fe);Ue.forEach((st,Ct)=>{let wr=Math.max(2,st*U);ne.fillRect(Jr+Ct*(oe+fe),(U-wr)/2,oe,wr)})};P.current=requestAnimationFrame(X)};je(()=>{m==="recording"&&t==="audio"&&N.current&&ve(N.current)},[m]);let E=async(V,ee)=>{if(!a)return;let be=new AbortController;$.current=be,q.current={file:V,duration:ee},w(null),C(0),u("uploading");try{let ce=await a.upload(V,l,{onProgress:me=>{be.signal.aborted||C(Math.max(0,Math.min(1,me)))},signal:be.signal});if(be.signal.aborted)return;let ie={url:ce.url,mimeType:ce.mimeType??V.type,duration:ee,kind:l};q.current=null,f(ie),u("saved"),s(ie)}catch(ce){if(be.signal.aborted||Bu(ce))return;u("failed"),w(c.recorderFailed)}finally{C(null)}},_=()=>{$.current?.abort(),q.current=null,k(null),C(null),u(J.current?"saved":"idle")},W=()=>{let V=q.current;V&&E(V.file,V.duration)},z=()=>{v.current&&(clearInterval(v.current),v.current=null);let V=T.current;V&&V.state!=="inactive"&&V.stop()},H=async()=>{if(!a){w(c.recorderUnavailableHere);return}if(!(typeof MediaRecorder<"u"&&typeof navigator<"u"&&!!navigator.mediaDevices?.getUserMedia&&(t!=="screen"||!!navigator.mediaDevices.getDisplayMedia))){w(c.recorderUnsupported);return}$.current?.abort(),J.current=h,w(null),u("requesting");let ee;try{if(t==="screen"){ee=await navigator.mediaDevices.getDisplayMedia({video:!0,audio:!1});try{let me=(await navigator.mediaDevices.getUserMedia({audio:!0})).getAudioTracks()[0];me&&ee.addTrack(me)}catch{}ee.getVideoTracks()[0]?.addEventListener("ended",()=>z())}else t==="video"?ee=await navigator.mediaDevices.getUserMedia({audio:!0,video:{facingMode:"user"}}):ee=await navigator.mediaDevices.getUserMedia({audio:!0})}catch(ie){let me=ie?.name;u(h?"saved":"idle"),w(me==="NotAllowedError"||me==="SecurityError"||me==="NotFoundError"?c.openResponsePermissionDenied:c.recorderUnsupported);return}let be=Du(l),ce;try{ce=be?new MediaRecorder(ee,{mimeType:be}):new MediaRecorder(ee)}catch{try{ce=new MediaRecorder(ee)}catch{ee.getTracks().forEach(ie=>ie.stop()),u(h?"saved":"idle"),w(c.recorderUnsupported);return}}N.current=ee,T.current=ce,M.current=[],ce.ondataavailable=ie=>{ie.data.size>0&&M.current.push(ie.data)},ce.onstop=()=>{let ie=Math.max(1,Math.round((performance.now()-R.current)/1e3)),me=ce.mimeType||be||`${l}/webm`,De=new Blob(M.current,{type:me});if(M.current=[],I(),Z(),x.current&&(x.current.srcObject=null),De.size===0){u(J.current?"saved":"idle"),w(c.recorderUnsupported);return}let at=new File([De],`recording.${zu(me,l)}`,{type:me});k({url:URL.createObjectURL(De),duration:ie}),E(at,ie)},ce.start(250),R.current=performance.now(),S(0),u("recording"),v.current=setInterval(()=>{let ie=(performance.now()-R.current)/1e3;S(ie),d&&ie>=d&&z()},200)};je(()=>{let V=x.current;m==="recording"&&V&&N.current&&(V.srcObject=N.current,V.play().catch(()=>{}))},[m]);let se=p?.url??h?.url??null,pe=p?.duration??h?.duration??null,ue=se?l==="audio"?F(ct,{src:se,durationHint:pe}):F("video",{src:se,controls:!0,playsInline:!0,preload:"metadata"}):null;if(n)return F("div",{className:vt("edp-rec",o),children:h?l==="audio"?F(ct,{src:h.url,durationHint:h.duration}):F("video",{src:h.url,controls:!0,playsInline:!0,preload:"metadata"}):F("p",{className:"edp-rec-message",children:c.recorderNone})});let ge=t==="audio"?F(yu,{"aria-hidden":!0}):t==="screen"?F(vu,{"aria-hidden":!0}):F(Xi,{"aria-hidden":!0});return re("div",{className:vt("edp-rec",o),children:[(m==="idle"||m==="requesting")&&re("div",{className:"edp-rec-idle",children:[F("button",{type:"button",className:"edp-rec-record",onClick:H,disabled:m==="requesting"||!a,"aria-label":t==="screen"?c.openResponseTapToRecordScreen:c.recorderRecord,children:ge}),F("span",{className:"edp-rec-label",children:m==="requesting"?c.openResponseRequestingPermission:c.recorderRecord}),d&&F("span",{className:"edp-rec-limit",children:c.recorderUpTo(_a(d))}),!a&&F("p",{className:"edp-rec-message",children:c.recorderUnavailableHere})]}),m==="recording"&&re(Kr,{children:[l==="video"&&F("video",{ref:x,muted:!0,playsInline:!0}),re("div",{className:"edp-rec-live",role:"status","aria-label":c.recorderRecordingAria,children:[t==="audio"?F("canvas",{ref:B,className:"edp-rec-level","aria-hidden":!0}):F("span",{style:{flex:1}}),re("span",{className:"edp-rec-clock",dir:"ltr",children:[F("span",{className:"edp-rec-dot","aria-hidden":!0}),_a(Math.floor(y)),d&&re("small",{children:["/ ",_a(d)]})]}),re("button",{type:"button",className:"edp-rec-stop",onClick:z,children:[F("i",{"aria-hidden":!0}),c.openResponseStopRecording]})]})]}),(m==="uploading"||m==="saved"||m==="failed")&&re(Kr,{children:[ue,re("div",{className:"edp-rec-foot",children:[m==="uploading"&&re(Kr,{children:[F("span",{className:"edp-rec-status","aria-live":"polite",children:b&&b>0?c.recorderSaving(Math.round(b*100)):c.openResponseUploading}),F("span",{className:"edp-rec-progress","aria-hidden":!0,children:F("span",{style:{width:`${Math.round((b??0)*100)}%`}})}),F("button",{type:"button",className:"edp-rec-link",onClick:_,children:c.recorderCancel})]}),m==="saved"&&re(Kr,{children:[re("span",{className:"edp-rec-status edp-rec-status--ok","aria-live":"polite",children:[F(Cu,{size:16,"aria-hidden":!0}),c.recorderSaved]}),F("button",{type:"button",className:"edp-rec-link",onClick:H,children:c.recorderRecordAgain})]}),m==="failed"&&re(Kr,{children:[re("span",{className:"edp-rec-status edp-rec-status--error",role:"alert",children:[F(Au,{size:16,"aria-hidden":!0}),A??c.recorderFailed]}),re("span",{style:{display:"inline-flex",gap:"1rem"},children:[F("button",{type:"button",className:"edp-rec-link",onClick:W,children:c.recorderRetry}),F("button",{type:"button",className:"edp-rec-link",onClick:H,children:c.recorderRecordAgain})]})]})]})]}),A&&m!=="failed"&&F("p",{className:"edp-rec-message",role:"alert",children:A})]})}function ju({feedback:e,feedbackState:t,score:r,t:n}){let o=t==="correct"?{bg:"var(--ok-soft, #ecf8f0)",border:"var(--ok, #1f8a4c)",ink:"var(--ok, #1f8a4c)"}:t==="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 re("div",{className:"rounded p-3 text-sm border",style:{background:o.bg,borderColor:o.border,color:"var(--ink, #1d2025)"},children:[F("p",{className:"text-xs font-medium mb-1 opacity-70",children:n.openResponseTeacherFeedbackLabel}),e.flatMap(a=>a.content?.map(s=>s.text??"")??[a.text??""]).join(" "),r!=null&&re("div",{className:"mt-1 text-right",style:{fontFamily:'var(--font-hand, "Caveat", cursive)',fontSize:D("1.4rem"),lineHeight:1,color:o.ink},children:[r," pts"]})]})}import{jsx as nt,jsxs as Vt,Fragment as rc}from"react/jsx-runtime";import{useEffect as Kn,useLayoutEffect as Ku,useMemo as Ma,useRef as Wr,useState as nc}from"react";import oc from"clsx";var qu=e=>/#\?|#0|#@|\\placeholder/.test(e),Hu={left:"moveToPreviousChar",right:"moveToNextChar",backspace:"deleteBackward",enter:null};function Pa(e){let t=()=>{let r=e.field();r&&e.onChange?.(r.value)};return{kind:"field",quietOnComputer:e.quietOnComputer,get root(){return e.root()},inputs(){let r=e.field(),n=r?Wt(r):null;return n?[n]:[]},refocus(){let r=e.field();if(!r)return;let n=Wt(r);n?.blur(),r.focus(),n?.focus({preventScroll:!0})},editable:()=>e.editable(),insert(r){let n=e.field();n&&(n.executeCommand?.(["insert",r,{selectionMode:qu(r)?"placeholder":"after"}]),t())},command(r){let n=e.field(),o=Hu[r];!n||!o||(n.executeCommand?.(o),t())},caret:()=>"formula",caretRect:()=>e.field()?.getBoundingClientRect()??null,labels:()=>e.labels()??nr,dir(){let r=e.root()?.parentElement;return r&&getComputedStyle(r).direction==="rtl"?"rtl":"ltr"}}}function Wu(e){return e?.showFeedback?e.state==="validating"?"validating":e.state==="correct"?"correct":e.state==="incorrect"?"incorrect":"idle":"idle"}var ac=e=>Number.isInteger(e)?String(e):e.toFixed(2);function vn({nodeId:e,placeholder:t,hint:r,validationFeedback:n,readOnly:o=!1}){let a=ae(),s=we(),i=Wr(null),c=Wr(null),l=Wr(null),[d,m]=nc(""),[u,h]=nc(!1),f=Bn(),p=Ma(()=>jr(a),[a]),k=Wr(p);k.current=p;let y=Wr(o);y.current=o;let S=Wu(n),b=n?.score,C=n?.maxScore,A=n?.displayAnswer,w=Ma(()=>A?Ae(A,!1):"",[A]),T=Ma(()=>o&&d?Ae(d,!1):"",[o,d]);Kn(()=>{let v=!0;return tt().then(x=>v&&x&&h(!0)),()=>{v=!1}},[]),Ku(()=>{if(!u||o)return;let v=c.current;return Pt(v),()=>Pn(v)},[u,o]),Kn(()=>{if(!u||o)return;let v=Pa({field:()=>c.current,root:()=>i.current,editable:()=>!y.current,labels:()=>k.current,onChange:B=>m(B)});l.current=v;let x=Se.register(v);return()=>{x(),l.current=null}},[u,o]),Kn(()=>{let v=x=>{let B=x.answers?.find(g=>g.nodeId===e&&g.type==="mathResponse");if(B?.answer?.latex!==void 0){m(B.answer.latex);let g=c.current;g&&(g.value=B.answer.latex)}};return s.on("answers:prefill",v),()=>s.off("answers:prefill",v)},[s,e]),Kn(()=>{s.emit({type:"answer:changed",answer:{nodeId:e,type:"mathResponse",timestamp:Date.now(),answer:{latex:d}}})},[d,e,s]);let N=!!l.current&&f.active===l.current,M=v=>{if(o)return;let x=c.current;!x||x.contains(v.target)||(v.preventDefault(),x.focus())},R=()=>{let v=l.current;v&&Se.openFor(v)};return Vt("span",{className:"math-response-player edp-slot-wrap",children:[Vt("span",{ref:i,dir:"ltr",className:oc("edp-slot",S!=="idle"&&`edp-slot--${S}`,o&&"edp-slot--readonly",N&&"is-active",!d&&"is-empty"),onMouseDown:M,children:[o&&u?nt("span",{className:"edp-slot-printed",dangerouslySetInnerHTML:{__html:T||"​"}}):u?nt("math-field",{ref:c,value:d,onInput:v=>m(v.target.value??""),onFocus:v=>Pt(v.currentTarget),"math-virtual-keyboard-policy":"manual","smart-fence":"true","aria-label":a.blankAnswerAria,className:"edp-slot-mf"}):nt("input",{type:"text",value:d,onChange:v=>m(v.target.value),readOnly:o,"aria-label":a.blankAnswerAria,className:"edp-slot-fallback"}),!d&&!N&&!o&&nt("span",{className:"edp-slot-hint","aria-hidden":"true",children:t||a.mathSlotPlaceholder}),u&&!o&&!f.touch&&nt("button",{type:"button",className:oc("edp-slot-kb",N&&f.mode==="maths"&&"is-open"),onMouseDown:v=>v.preventDefault(),onClick:R,"aria-label":a.kbMaths,title:a.kbMaths,tabIndex:-1,children:"\u2211"})]}),nt(dt,{hint:r}),n?.showFeedback&&S!=="idle"&&Vt("span",{className:`edp-slot-feedback edp-slot-feedback--${S}`,role:"status",children:[S==="validating"&&Vt(rc,{children:[nt("span",{className:"player-math-spinner"}),nt("span",{children:a.mathChecking})]}),S==="correct"&&Vt(rc,{children:[nt("span",{"aria-label":a.mathCorrect,children:"\u2713"}),b!=null&&Vt("span",{className:"edp-slot-score",children:[ac(b),C!=null?` / ${ac(C)}`:""]})]}),S==="incorrect"&&nt("span",{"aria-label":a.mathIncorrect,children:"\u2717"}),S==="incorrect"&&w&&Vt("span",{className:"player-blank-reveal edp-slot-reveal",children:["(",nt("span",{dangerouslySetInnerHTML:{__html:w}}),")"]})]})]})}import{jsx as de,jsxs as _e,Fragment as Gr}from"react/jsx-runtime";import{useCallback as cm,useEffect as lm,useRef as dm,useState as Vr}from"react";import{Play as pm,Lock as um,Check as La,X as cc}from"lucide-react";function Vn(e,t){if(e===t)return!0;if(e===null||t===null||typeof e!=typeof t||typeof e!="object")return!1;let r=Array.isArray(e),n=Array.isArray(t);if(r!==n)return!1;if(r&&n){let c=e,l=t;return c.length!==l.length?!1:c.every((d,m)=>Vn(d,l[m]))}let o=e,a=t,s=Object.keys(o),i=Object.keys(a);return s.length!==i.length?!1:s.every(c=>Vn(o[c],a[c]))}var Uu=`
|
|
8
8
|
"use strict";
|
|
9
9
|
|
|
10
10
|
// Capture console output for stdio mode
|
|
@@ -41,15 +41,15 @@ self.onmessage = async function(e) {
|
|
|
41
41
|
self.postMessage({ testId, passed: false, stderr: String(err), errored: true, durationMs: Date.now() - start });
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
|
-
`;async function
|
|
44
|
+
`;async function Vu(e,t,r,n,o,a,s,i,c){return new Promise(l=>{let d=new Blob([Uu],{type:"text/javascript"}),m=URL.createObjectURL(d),u=new Worker(m),h=setTimeout(()=>{u.terminate(),URL.revokeObjectURL(m),l({testId:n,passed:!1,stderr:`Execution timed out after ${c}ms`,errored:!0})},c);u.onmessage=f=>{clearTimeout(h),u.terminate(),URL.revokeObjectURL(m);let p=f.data;if(t==="function"&&!p.errored){let k=Vn(p.actual,a);l({testId:n,passed:k,actual:p.actual,stderr:p.stderr,durationMs:p.durationMs})}else l({testId:n,passed:p.passed??!1,actualStdout:p.actualStdout,stderr:p.stderr,durationMs:p.durationMs,errored:p.errored})},u.onerror=f=>{clearTimeout(h),u.terminate(),URL.revokeObjectURL(m),l({testId:n,passed:!1,stderr:f.message,errored:!0})},u.postMessage({testId:n,source:e,mode:t,entryFunction:r,args:o,expectedStdout:i,timeout:c})})}var Gu="0.27.7";function Yu(){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||Gu}/full/`}var Ur=null;function Qu(e){return typeof globalThis.loadPyodide=="function"?Promise.resolve():Ur||(Ur=new Promise((t,r)=>{if(typeof document>"u"){r(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=()=>t(),n.onerror=()=>{Ur=null,r(new Error(`Failed to load Pyodide from ${n.src}`))},document.head.appendChild(n)}),Ur)}var Wn=null;async function Xu(){if(Wn)return Wn;let e=Yu();await Qu(e);let t=globalThis.loadPyodide;if(typeof t!="function")throw new Error("Pyodide global not available after loading the CDN script");return Wn=await t({indexURL:e}),Wn}async function Ju(e,t,r,n,o,a,s,i,c){let l=Date.now();try{let d=await Xu();if(t==="stdio"){d.runPython(`
|
|
45
45
|
import sys, io
|
|
46
46
|
_stdout_capture = io.StringIO()
|
|
47
47
|
sys.stdout = _stdout_capture
|
|
48
|
-
`),s&&
|
|
48
|
+
`),s&&d.runPython(`
|
|
49
49
|
import io
|
|
50
50
|
sys.stdin = io.StringIO(${JSON.stringify(s)})
|
|
51
|
-
`),
|
|
52
|
-
`),l=c.trim()===(n||"").trim();return s.close(),{testId:t,passed:l,actualStdout:c,durationMs:Date.now()-o}}catch(a){return{testId:t,passed:!1,stderr:String(a),errored:!0,durationMs:Date.now()-o}}}async function Op(e){let{transform:t}=await import("./esm-RQP7AIMT.mjs");return t(e,{transforms:["typescript"]}).code}var Jt=class{supports(t){return["javascript","typescript","python","sql"].includes(t)}async run(t){let{language:r,source:n,mode:o,entryFunction:a,tests:s,timeoutMs:i=5e3}=t;if(!this.supports(r))return s.map(p=>({testId:p.id,passed:!1,stderr:`Language "${r}" cannot run in-browser. Configure a RemoteExecutor for compiled languages.`,errored:!0}));let c=n;if(r==="typescript")try{c=await Op(n)}catch(p){return s.map(f=>({testId:f.id,passed:!1,stderr:`TypeScript compile error: ${p.message}`,errored:!0}))}let l=[];for(let p of s){let f;r==="python"?f=await Fp(c,o,a,p.id,p.args,p.expectedReturn,p.stdin,p.expectedStdout,i):r==="sql"?f=await Dp(c,p.id,p.stdin,p.expectedStdout):f=await Mp(c,o,a,p.id,p.args,p.expectedReturn,p.stdin,p.expectedStdout,i),l.push(f)}return l}};import{jsx as wi}from"react/jsx-runtime";import{forwardRef as jp,useEffect as Bp,useImperativeHandle as qp,useRef as Hp,useState as Wp}from"react";function Up(e){return{javascript:"javascript",typescript:"typescript",python:"python",sql:"sql",java:"java",cpp:"cpp",go:"go"}[e]??"plaintext"}var ta=jp(function({value:t,onChange:r,language:n="javascript",readOnly:o=!1,readOnlyRanges:a,placeholder:s,height:i=300,className:c,autoFocus:l},p){let[f,m]=Wp(null),{scale:h}=ze(),d=Hp(null);Bp(()=>{import("./dist-RXTJ74FF.mjs").then(k=>{m(()=>k.default)}).catch(()=>{})},[]),qp(p,()=>({getValue(){return d.current?.getValue?.()??t},focus(){d.current?.focus?.()},insert(k){let C=d.current;if(!C)return;let v=C.getSelection();C.executeEdits("insert",[{range:v,text:k,forceMoveMarkers:!0}])}}));function u(k){d.current=k,l&&k.focus(),a?.length&&k.onDidAttemptReadOnlyEdit(()=>{})}function S(k){r(k??"")}let R=typeof i=="number"?i*h:i;return f?wi(f,{className:c,height:R,language:Up(n),value:t,onChange:S,onMount:u,options:{readOnly:o,minimap:{enabled:!1},fontSize:14*h,lineNumbers:"on",scrollBeyondLastLine:!1,automaticLayout:!0,tabSize:2,wordWrap:"on"}}):wi("textarea",{className:c,value:t,onChange:k=>r(k.target.value),readOnly:o,placeholder:s,style:{width:"100%",height:typeof i=="number"?F(i):i,fontFamily:"monospace",fontSize:F(14),padding:F("0.5rem"),border:"1px solid #e2e8f0",borderRadius:F("0.375rem"),resize:"vertical",background:o?"#f8fafc":"white",boxSizing:"border-box"},autoFocus:l})});var Xp=new Jt;function Jp(e){return e?.showFeedback?e.state??"idle":"idle"}function ki(e){let t={};for(let r of e.attrs.starters??[])t[r.language]=r.code;return t}function Zp({sample:e,result:t,mode:r}){let n=t?.passed,o=t?.errored,a=t!==void 0,s=a?o?"var(--almost, #c8810e)":n?"var(--ok, #1f8a4c)":"var(--pen, #d23b2b)":"var(--ink-faint, #8d93a0)",i=a?o?"\u26A0":null:"\u25CB";return ke("div",{style:{padding:`${F("0.5rem")} ${F("0.75rem")}`,borderBottom:"1px solid var(--line, #e7e5e0)",fontSize:F("0.8125rem"),fontFamily:"var(--font-mono, ui-monospace, monospace)"},children:[ke("div",{style:{display:"flex",alignItems:"center",gap:F("0.5rem")},children:[ie("span",{style:{color:s,fontWeight:700,fontSize:F("0.875rem"),display:"inline-flex"},children:i??(n?ie(ra,{size:15,style:be(15)}):ie(Si,{size:15}))}),ie("span",{style:{fontWeight:600,color:"var(--ink, #1d2025)"},children:e.name??`Test ${e.id}`})]}),a&&!n&&ke("div",{style:{marginTop:F("0.25rem"),paddingLeft:F("1.5rem")},children:[r==="function"?ie(Ir,{children:t?.actual!==void 0&&ke("div",{style:{color:"var(--ink-soft, #565b66)"},children:[ie("span",{style:{color:"var(--ink-faint, #8d93a0)"},children:"got: "}),ie("span",{style:{color:"var(--pen, #d23b2b)"},children:JSON.stringify(t.actual)}),ie("span",{style:{color:"var(--ink-faint, #8d93a0)"},children:" expected: "}),ie("span",{style:{color:"var(--ok, #1f8a4c)"},children:JSON.stringify(e.expectedReturn)})]})}):ie(Ir,{children:t?.actualStdout!==void 0&&ke("div",{style:{color:"var(--ink-soft, #565b66)"},children:[ke("div",{children:[ie("span",{style:{color:"var(--ink-faint, #8d93a0)"},children:"got: "}),ie("span",{style:{color:"var(--pen, #d23b2b)",whiteSpace:"pre-wrap"},children:t.actualStdout||"(empty)"})]}),ke("div",{children:[ie("span",{style:{color:"var(--ink-faint, #8d93a0)"},children:"expected: "}),ie("span",{style:{color:"var(--ok, #1f8a4c)",whiteSpace:"pre-wrap"},children:e.expectedStdout||"(empty)"})]})]})}),t?.stderr&&ie("div",{style:{color:"var(--almost-ink, #8a5a08)",marginTop:F("0.125rem"),whiteSpace:"pre-wrap"},children:t.stderr})]})]})}function sn({node:e,validationFeedback:t,readOnly:r=!1,executor:n=Xp,gradingTests:o}){let a=ge(),s=Gp(null),{attrs:i}=e,c=e.id,[l,p]=Lr(i.defaultLanguage),[f,m]=Lr(()=>ki(e)),[h,d]=Lr([]),[u,S]=Lr(!1),[R,k]=Lr(!1),C=f[l]??"",v=Jp(t);Vp(()=>{let b=$=>{let B=$.answers?.find(J=>J.nodeId===c&&J.type==="codingResponse");B?.answer&&(B.answer.language&&p(B.answer.language),B.answer.sourceByLanguage&&m(B.answer.sourceByLanguage),B.answer.testResults&&d(B.answer.testResults))},M=()=>{m(ki(e)),d([]),k(!1)};return a.on("answers:prefill",b),a.on("answers:reset",M),()=>{a.off("answers:prefill",b),a.off("answers:reset",M)}},[a,c,e]);let N=Kp((b,M,$)=>{a.emit({type:"answer:changed",answer:{nodeId:c,type:"codingResponse",timestamp:Date.now(),answer:{language:b,sourceByLanguage:M,source:M[b]??"",testResults:$}}})},[a,c]),w=b=>{let M={...f,[l]:b};m(M),N(l,M,h)},x=b=>{p(b),d([]),N(b,f,[])},y=async()=>{if(u)return;S(!0),d([]);let b=o??i.visibleSamples??[];if(b.length===0){S(!1);return}try{let M=await n.run({language:l,source:C,mode:i.testMode,entryFunction:i.entryFunction,tests:b,timeoutMs:5e3});d(M),N(l,f,M)}catch(M){let $=b.map(B=>({testId:B.id,passed:!1,stderr:String(M),errored:!0}));d($),N(l,f,$)}finally{S(!1)}},T=()=>{R||(k(!0),N(l,f,h))},g=(o??[]).filter(b=>b.hidden).length,P=g>0?h.filter(b=>(o??[]).find($=>$.id===b.testId)?.hidden&&b.passed).length:0,A=o?o.filter(b=>!b.hidden):i.visibleSamples??[],W=v==="correct"?"var(--ok, #1f8a4c)":v==="partial"?"var(--almost, #c8810e)":v==="incorrect"?"var(--pen, #d23b2b)":"var(--line-strong, #d6d3cc)";return ke("div",{style:{margin:`${F("0.75rem")} 0`,border:`1px solid ${W}`,borderRadius:F("0.875rem"),overflow:"hidden",transition:"border-color 0.2s"},children:[ke("div",{style:{background:"var(--ui-muted, #f5f4f1)",borderBottom:"1px solid var(--line, #e7e5e0)",padding:`${F("0.5rem")} ${F("0.75rem")}`,display:"flex",alignItems:"center",gap:F("0.5rem"),flexWrap:"wrap"},children:[ie("div",{style:{display:"flex",gap:F("0.25rem")},children:i.languages.map(b=>ie("button",{onClick:()=>!r&&x(b),disabled:r,style:{padding:`${F("0.2rem")} ${F("0.6rem")}`,borderRadius:F("0.375rem"),border:"1px solid",borderColor:l===b?"var(--ink, #1d2025)":"var(--line, #e7e5e0)",background:l===b?"var(--ink, #1d2025)":"var(--card, #fff)",color:l===b?"#fff":"var(--ink-soft, #565b66)",fontSize:F("0.75rem"),fontWeight:600,cursor:r?"default":"pointer",fontFamily:"var(--font-mono, ui-monospace, monospace)"},children:b},b))}),ie("div",{style:{flex:1}}),ie(ot,{hint:i.hint}),!r&&ke(Ir,{children:[ke("button",{onClick:y,disabled:u,style:{padding:`${F("0.25rem")} ${F("0.75rem")}`,borderRadius:F("0.5rem"),border:"1px solid var(--line-strong, #d6d3cc)",background:u?"var(--ui-muted, #f5f4f1)":"var(--card, #fff)",color:"var(--ink, #1d2025)",fontSize:F("0.8125rem"),fontWeight:600,cursor:u?"not-allowed":"pointer",display:"inline-flex",alignItems:"center",gap:F("0.35rem")},children:[ie(Yp,{size:13,style:be(13)})," ",u?"Running\u2026":"Run"]}),ke("button",{onClick:T,disabled:R,style:{padding:`${F("0.3rem")} ${F("0.85rem")}`,borderRadius:F("0.5rem"),border:"none",background:R?"var(--ok-soft, #ecf8f0)":"var(--ink, #1d2025)",color:R?"var(--ok, #1f8a4c)":"#fff",fontSize:F("0.8125rem"),fontWeight:600,cursor:R?"default":"pointer",display:"inline-flex",alignItems:"center",gap:F("0.35rem")},children:[R&&ie(ra,{size:13,style:be(13)})," ",R?"Submitted":"Submit"]})]})]}),ie(ta,{ref:s,value:C,onChange:w,language:l,readOnly:r,readOnlyRanges:i.starters.find(b=>b.language===l)?.readOnlyRanges,height:320}),(h.length>0||A.length>0)&&ke("div",{style:{borderTop:"1px solid var(--line, #e7e5e0)",background:"var(--paper, #fbfaf7)"},children:[ie("div",{style:{padding:`${F("0.5rem")} ${F("0.75rem")}`,fontSize:F("0.7rem"),fontWeight:700,color:"var(--ink-faint, #8d93a0)",textTransform:"uppercase",letterSpacing:"0.05em"},children:"Test Results"}),A.map(b=>ie(Zp,{sample:b,result:h.find(M=>M.testId===b.id),mode:i.testMode},b.id)),g>0&&ke("div",{style:{padding:`${F("0.5rem")} ${F("0.75rem")}`,fontSize:F("0.8125rem"),color:"var(--ink-soft, #565b66)",borderTop:"1px solid var(--line, #e7e5e0)",fontStyle:"italic",display:"flex",alignItems:"center",gap:F("0.4rem")},children:[ie(Qp,{size:13,style:be(13)})," Hidden tests: ",P,"/",g," passed"]})]}),t?.showFeedback&&ke("div",{style:{padding:`${F("0.55rem")} ${F("0.75rem")}`,fontSize:F("0.85rem"),fontWeight:600,borderTop:"1px solid var(--line, #e7e5e0)",display:"flex",alignItems:"center",gap:F("0.45rem"),background:v==="correct"?"var(--ok-soft, #ecf8f0)":v==="partial"?"var(--almost-soft, #fbf1dc)":v==="incorrect"?"var(--pen-soft, #fdeeec)":"transparent",color:v==="correct"?"var(--ok, #1f8a4c)":v==="partial"?"var(--almost-ink, #8a5a08)":v==="incorrect"?"var(--pen, #d23b2b)":"var(--ink-soft, #565b66)"},children:[v==="correct"&&ke(Ir,{children:[ie(ra,{size:15,style:be(15)})," All tests passed"]}),v==="partial"&&"Partial credit",v==="incorrect"&&ke(Ir,{children:[ie(Si,{size:15,style:be(15)})," Tests failed"]}),v==="validating"&&"Evaluating\u2026",v==="awaiting_review"&&"Awaiting teacher review",t.score!==void 0&&ke("span",{style:{marginLeft:"auto",fontFamily:'var(--font-hand, "Caveat", cursive)',fontSize:F("1.5rem"),lineHeight:1},children:[t.score," / ",t.maxScore??i.maxScore]})]})]})}import{Fragment as ru,jsx as _n,jsxs as nu}from"react/jsx-runtime";import{createContext as ou,useContext as au,useEffect as su}from"react";import{DndContext as iu,MouseSensor as cu,TouchSensor as lu,KeyboardSensor as du,useDndContext as pu,useSensor as aa,useSensors as uu}from"@dnd-kit/core";import{jsx as na}from"react/jsx-runtime";import{DragOverlay as eu,useDndContext as tu}from"@dnd-kit/core";function oa(){let{active:e}=tu();if(!e)return null;let t=e.data.current?.html??"";return na(eu,{dropAnimation:null,children:na("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:na("span",{dangerouslySetInnerHTML:{__html:t},style:{pointerEvents:"none",whiteSpace:"nowrap",lineHeight:"1.25"}})})})}function mu(e,t,r){let n=[],o=new Set,a=s=>{o.has(s)||(o.add(s),r(s)==="smooth"&&(n.push([s,s.style.scrollBehavior]),s.style.scrollBehavior="auto"))};for(let s=e;s;s=s.parentElement)a(s);return t&&a(t),()=>{for(let[s,i]of n)s.style.scrollBehavior=i}}function fu(){let{activeNode:e}=pu();return su(()=>{if(!(!e||typeof document>"u"))return mu(e,document.scrollingElement,t=>getComputedStyle(t).scrollBehavior)},[e]),null}var Ri=ou(!1),hu={acceleration:3,threshold:{x:0,y:.25}};function Pn({children:e}){let t=au(Ri),r=aa(cu,{activationConstraint:{distance:8}}),n=aa(lu,{activationConstraint:{delay:250,tolerance:5}}),o=aa(du),a=uu(r,n,o);return t?_n(ru,{children:e}):_n(Ri.Provider,{value:!0,children:nu(iu,{sensors:a,autoScroll:hu,children:[e,_n(oa,{}),_n(fu,{})]})})}function er({content:e,onAnswersChange:t,onSubmit:r,answerBus:n,namespace:o,initialAnswers:a,validationFeedback:s,className:i="",locale:c,readOnly:l=!1,mediaHandler:p,answerSheetHandler:f,codeExecutor:m,display:h}){let d=Fe(h),u=gu(()=>He(d),[d]),S=bu(null);S.current||(S.current=new lt);let R=n??S.current;sa(()=>{a&&a.length>0&&R.prefillAnswers(a)},[a,R]),sa(()=>{if(!t)return;let C=()=>{let v=R.getAllAnswers();t(v)};return R.on("answer:changed",C),()=>R.off("answer:changed",C)},[R,t]),sa(()=>{if(!r)return;let C=v=>{r(v.answers)};return R.on("answer:submitted",C),()=>R.off("answer:submitted",C)},[R,r]);let k=qe(e,s,{readOnly:l,mediaHandler:p,answerSheetHandler:f,codeExecutor:m});return Zt(ur,{locale:c,children:Zt(De,{display:d,children:Zt(Ur,{bus:R,children:Zt(Pn,{children:Zt(ln,{initialAnswers:a,children:Zt("div",{className:`question-runtime ${i}${u.sizeSet?" edp-scaled":""}`,"data-namespace":o,style:{fontSize:F("1.125rem"),lineHeight:"1.75",...We(u)},children:k})})})})})})}import{jsx as tr,jsxs as En}from"react/jsx-runtime";import{memo as wu,useCallback as Pi,useMemo as ku,useRef as _i}from"react";var Ci={words:80,media:1,tableRows:6},yu=new Set(["resizableImage","resizableVideo","youtubeEmbed"]);function Ai(e){let t={words:0,media:0,tableRows:0},r=n=>{if(typeof n.text=="string"&&(t.words+=n.text.split(/\s+/).filter(o=>/[\p{L}\p{N}]/u.test(o)).length),n.type&&yu.has(n.type)&&t.media++,n.type==="table"){let o=(n.content??[]).filter(a=>a.type==="tableRow").length;t.tableRows=Math.max(t.tableRows,o)}for(let o of n.content??[])r(o)};return e&&r(e),t}function $r(e,t=Ci){let r=Ai(e);return r.words>t.words||r.media>t.media||r.tableRows>t.tableRows}import{createContext as xu,useContext as vu}from"react";var Ni=xu(null),Tn=Ni.Provider;function Mn(){return vu(Ni)}function Ln({exercise:e,onAnswersChange:t,validationFeedback:r,renderSharedContext:n,renderQuestion:o,renderSeparator:a,className:s="",locale:i,display:c}){let l=Fe(c),p=ku(()=>He(l),[l]),f=_i(new Map),m=_i({exercise:e,onAnswersChange:t});m.current={exercise:e,onAnswersChange:t};let h=Pi((k,C)=>{f.current.set(k,C);let{exercise:v,onAnswersChange:N}=m.current;if(N){let w={exerciseId:v.id,questionAnswers:v.questions.map(x=>({questionId:x.id,answers:f.current.get(x.id)??[]}))};N(w)}},[]),d=Mn(),u=pr(i),S=!!(d&&e.sharedContext&&$r(e.sharedContext)),R=e.sharedContext?S?En("p",{className:"exercise-reference-cue",children:[tr("span",{children:u.referenceInPanel(d.label)})," ",En("button",{type:"button",className:"exercise-reference-cue__link",onClick:()=>d.showExerciseReference(e.id),children:[u.readReference,tr("span",{"aria-hidden":"true",className:"exercise-reference-cue__arrow",children:"\u203A"})]})]}):tr("div",{className:"exercise-shared-context",children:qe(e.sharedContext)}):null;return tr(De,{display:l,children:En("div",{className:`exercise-runtime ${s}`,style:We(p),children:[R&&(n?n(R):R),e.questions.map((k,C)=>{let v=r?.get(k.id),N=tr(Su,{questionId:k.id,content:k.content,onQuestionAnswers:h,validationFeedback:v,locale:i},k.id);return En("div",{children:[o?o(k,N,C):N,a&&C<e.questions.length-1?a(C):null]},k.id)})]})})}var Su=wu(function({questionId:t,onQuestionAnswers:r,...n}){let o=Pi(a=>r(t,a),[r,t]);return tr(er,{...n,onAnswersChange:o})});import{jsx as ia,jsxs as Ru}from"react/jsx-runtime";import{useCallback as Cu,useEffect as Au,useMemo as Nu,useRef as Ti}from"react";function Nt({assessment:e,onAnswersChange:t,validationFeedback:r,renderExercise:n,renderSharedContext:o,renderSeparator:a,className:s="",brandingConfig:i,locale:c,display:l}){let p=Ti(new Map),f=Fe(l),m=Nu(()=>He(f),[f]);Au(()=>{if(!i?.fontUrl)return;let S=`edpire-brand-font-${i.fontUrl.replace(/\W/g,"").slice(-24)}`;if(document.getElementById(S))return;let R=document.createElement("link");R.id=S,R.rel="stylesheet",R.href=i.fontUrl,document.head.appendChild(R)},[i?.fontUrl]);let h={...We(m)};i?.fontFamily&&(h["--brand-font"]=i.fontFamily);let d=Ti({assessment:e,onAnswersChange:t});d.current={assessment:e,onAnswersChange:t};let u=Cu(S=>{p.current.set(S.exerciseId,S);let{assessment:R,onAnswersChange:k}=d.current;if(k){let C={exerciseAnswers:R.exercises.map(v=>p.current.get(v.id)??{exerciseId:v.id,questionAnswers:[]})};k(C)}},[]);return ia(De,{display:f,children:ia("div",{className:`assessment-runtime ${s}`,style:Object.keys(h).length?h:void 0,children:e.exercises.map((S,R)=>{let k=r?.get(S.id),C=ia(Ln,{exercise:S,onAnswersChange:u,validationFeedback:k,renderSharedContext:o?v=>o(v,S):void 0,locale:c},S.id);return Ru("div",{children:[n?n(S,C,R):C,a&&R<e.exercises.length-1?a(R):null]},S.id)})})})}import{jsx as Mi}from"react/jsx-runtime";import{useMemo as _u}from"react";function rr({content:e,className:t,display:r}){let n=Fe(r),o=_u(()=>He(n),[n]);return Mi(De,{display:n,children:Mi("div",{className:`content-view ${t??""}`,style:We(o),children:qe(e)})})}import{jsx as Fr,Fragment as Ei,jsxs as In}from"react/jsx-runtime";import{useMemo as Pu}from"react";function zr({item:e,className:t,renderFigureLabel:r,display:n}){let o=Fe(n),a=Pu(()=>He(o),[o]);return Fr(De,{display:o,children:In("div",{className:`annex-item-view ${t??""}${a.sizeSet?" edp-scaled":""}`,style:We(a),children:[e.type==="text-document"&&In(Ei,{children:[e.title&&Fr("h3",{className:"text-base font-semibold mb-2",children:e.title}),qe(e.content)]}),e.type==="figure"&&In("figure",{children:[qe(e.content),Fr("figcaption",{children:r?r(e.label):Fr("span",{children:e.label})})]}),e.type==="rich-block"&&In(Ei,{children:[e.title&&Fr("h3",{className:"text-base font-semibold mb-2",children:e.title}),qe(e.content)]})]})})}import{jsx as fx,jsxs as hx}from"react/jsx-runtime";import{useState as bx}from"react";import{jsx as Sx,jsxs as Rx}from"react/jsx-runtime";import{useState as Ax,useCallback as Nx,useMemo as _x}from"react";import{useEditor as Tx,EditorContent as Mx}from"@tiptap/react";import Lx from"@tiptap/starter-kit";import{jsx as Dx,jsxs as Ox,Fragment as jx}from"react/jsx-runtime";import{useMemo as qx,useState as Hx}from"react";import{Send as tc,Loader2 as ba,BarChart2 as ya,CheckCircle2 as rc,XCircle as cm,RotateCcw as lm,X as xa,Clock as or,AlertTriangle as dm,AlertCircle as pm,Check as um,CloudOff as mm}from"lucide-react";import{clsx as Fu}from"clsx";import{twMerge as zu}from"tailwind-merge";function ye(...e){return zu(Fu(e))}function Dt(e,t,r){return t?.trim()||e("exercise",{index:r+1})}import{Fragment as qu,jsx as Pe,jsxs as ca}from"react/jsx-runtime";function Du({accent:e}){return Pe("div",{style:{width:48,height:48,borderRadius:"50%",border:`4px solid ${e}33`,borderTopColor:e,animation:"edpire-spin 0.8s linear infinite"}})}function Ou({accent:e}){return Pe("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[0,1,2].map(t=>Pe("div",{style:{width:12,height:12,borderRadius:"50%",background:e,animation:`edpire-bounce 1.2s ease-in-out ${t*.2}s infinite`}},t))})}function ju({accent:e}){return ca("div",{style:{position:"relative",width:48,height:48},children:[[0,1].map(t=>Pe("div",{style:{position:"absolute",inset:0,borderRadius:"50%",background:e,opacity:.4,animation:`edpire-pulse 1.6s ease-out ${t*.8}s infinite`}},t)),Pe("div",{style:{position:"absolute",inset:"25%",borderRadius:"50%",background:e}})]})}function Bu({accent:e}){return Pe("div",{style:{display:"flex",gap:4,alignItems:"flex-end",height:40},children:[0,1,2,3].map(t=>Pe("div",{style:{width:8,borderRadius:4,background:e,animation:`edpire-bars 1s ease-in-out ${t*.15}s infinite`}},t))})}function Li({visible:e,bgColor:t="rgba(0,0,0,0.55)",accentColor:r="#6366f1",text:n="Evaluating your answers\u2026",aiText:o="Some answers are being reviewed by AI, this may take a few seconds.",spinnerTheme:a="default",animationUrl:s,hasAiNodes:i=!1,contained:c=!1}){return e?ca(qu,{children:[Pe("style",{children:`
|
|
51
|
+
`),d.runPython(e);let m=d.runPython("_stdout_capture.getvalue()");d.runPython("sys.stdout = sys.__stdout__");let u=m.trim()===(i||"").trim();return{testId:n,passed:u,actualStdout:m,durationMs:Date.now()-l}}else{d.runPython(e);let m=(o||[]).map(f=>JSON.stringify(f)).join(", "),u=d.runPython(`${r}(${m})`),h=Vn(u,a);return{testId:n,passed:h,actual:u,durationMs:Date.now()-l}}}catch(d){return{testId:n,passed:!1,stderr:String(d),errored:!0,durationMs:Date.now()-l}}}var Un=null;async function Zu(){if(Un)return Un;let e=await import("./sql-wasm-browser-NICPVFVD.mjs");return Un=await(e.default??e)(),Un}async function em(e,t,r,n){let o=Date.now();try{let a=await Zu(),s=new a.Database;r&&s.run(r);let c=s.exec(e).flatMap(d=>d.values.map(m=>m.map(String).join("|"))).join(`
|
|
52
|
+
`),l=c.trim()===(n||"").trim();return s.close(),{testId:t,passed:l,actualStdout:c,durationMs:Date.now()-o}}catch(a){return{testId:t,passed:!1,stderr:String(a),errored:!0,durationMs:Date.now()-o}}}async function tm(e){let{transform:t}=await import("./esm-RQP7AIMT.mjs");return t(e,{transforms:["typescript"]}).code}var pr=class{supports(t){return["javascript","typescript","python","sql"].includes(t)}async run(t){let{language:r,source:n,mode:o,entryFunction:a,tests:s,timeoutMs:i=5e3}=t;if(!this.supports(r))return s.map(d=>({testId:d.id,passed:!1,stderr:`Language "${r}" cannot run in-browser. Configure a RemoteExecutor for compiled languages.`,errored:!0}));let c=n;if(r==="typescript")try{c=await tm(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;r==="python"?m=await Ju(c,o,a,d.id,d.args,d.expectedReturn,d.stdin,d.expectedStdout,i):r==="sql"?m=await em(c,d.id,d.stdin,d.expectedStdout):m=await Vu(c,o,a,d.id,d.args,d.expectedReturn,d.stdin,d.expectedStdout,i),l.push(m)}return l}};import{jsx as sc}from"react/jsx-runtime";import{forwardRef as rm,useEffect as nm,useImperativeHandle as om,useRef as am,useState as sm}from"react";function im(e){return{javascript:"javascript",typescript:"typescript",python:"python",sql:"sql",java:"java",cpp:"cpp",go:"go"}[e]??"plaintext"}var Ea=rm(function({value:t,onChange:r,language:n="javascript",readOnly:o=!1,readOnlyRanges:a,placeholder:s,height:i=300,className:c,autoFocus:l},d){let[m,u]=sm(null),{scale:h}=Ke(),f=am(null);nm(()=>{import("./dist-RXTJ74FF.mjs").then(S=>{u(()=>S.default)}).catch(()=>{})},[]),om(d,()=>({getValue(){return f.current?.getValue?.()??t},focus(){f.current?.focus?.()},insert(S){let b=f.current;if(!b)return;let C=b.getSelection();b.executeEdits("insert",[{range:C,text:S,forceMoveMarkers:!0}])}}));function p(S){f.current=S,l&&S.focus(),a?.length&&S.onDidAttemptReadOnlyEdit(()=>{})}function k(S){r(S??"")}let y=typeof i=="number"?i*h:i;return m?sc(m,{className:c,height:y,language:im(n),value:t,onChange:k,onMount:p,options:{readOnly:o,minimap:{enabled:!1},fontSize:14*h,lineNumbers:"on",scrollBeyondLastLine:!1,automaticLayout:!0,tabSize:2,wordWrap:"on"}}):sc("textarea",{className:c,value:t,onChange:S=>r(S.target.value),readOnly:o,placeholder:s,style:{width:"100%",height:typeof i=="number"?D(i):i,fontFamily:"monospace",fontSize:D(14),padding:D("0.5rem"),border:"1px solid #e2e8f0",borderRadius:D("0.375rem"),resize:"vertical",background:o?"#f8fafc":"white",boxSizing:"border-box"},autoFocus:l})});var mm=new pr;function fm(e){return e?.showFeedback?e.state??"idle":"idle"}function ic(e){let t={};for(let r of e.attrs.starters??[])t[r.language]=r.code;return t}function hm({sample:e,result:t,mode:r}){let n=t?.passed,o=t?.errored,a=t!==void 0,s=a?o?"var(--almost, #c8810e)":n?"var(--ok, #1f8a4c)":"var(--pen, #d23b2b)":"var(--ink-faint, #8d93a0)",i=a?o?"\u26A0":null:"\u25CB";return _e("div",{style:{padding:`${D("0.5rem")} ${D("0.75rem")}`,borderBottom:"1px solid var(--line, #e7e5e0)",fontSize:D("0.8125rem"),fontFamily:"var(--font-mono, ui-monospace, monospace)"},children:[_e("div",{style:{display:"flex",alignItems:"center",gap:D("0.5rem")},children:[de("span",{style:{color:s,fontWeight:700,fontSize:D("0.875rem"),display:"inline-flex"},children:i??(n?de(La,{size:15,style:ke(15)}):de(cc,{size:15}))}),de("span",{style:{fontWeight:600,color:"var(--ink, #1d2025)"},children:e.name??`Test ${e.id}`})]}),a&&!n&&_e("div",{style:{marginTop:D("0.25rem"),paddingLeft:D("1.5rem")},children:[r==="function"?de(Gr,{children:t?.actual!==void 0&&_e("div",{style:{color:"var(--ink-soft, #565b66)"},children:[de("span",{style:{color:"var(--ink-faint, #8d93a0)"},children:"got: "}),de("span",{style:{color:"var(--pen, #d23b2b)"},children:JSON.stringify(t.actual)}),de("span",{style:{color:"var(--ink-faint, #8d93a0)"},children:" expected: "}),de("span",{style:{color:"var(--ok, #1f8a4c)"},children:JSON.stringify(e.expectedReturn)})]})}):de(Gr,{children:t?.actualStdout!==void 0&&_e("div",{style:{color:"var(--ink-soft, #565b66)"},children:[_e("div",{children:[de("span",{style:{color:"var(--ink-faint, #8d93a0)"},children:"got: "}),de("span",{style:{color:"var(--pen, #d23b2b)",whiteSpace:"pre-wrap"},children:t.actualStdout||"(empty)"})]}),_e("div",{children:[de("span",{style:{color:"var(--ink-faint, #8d93a0)"},children:"expected: "}),de("span",{style:{color:"var(--ok, #1f8a4c)",whiteSpace:"pre-wrap"},children:e.expectedStdout||"(empty)"})]})]})}),t?.stderr&&de("div",{style:{color:"var(--almost-ink, #8a5a08)",marginTop:D("0.125rem"),whiteSpace:"pre-wrap"},children:t.stderr})]})]})}function wn({node:e,validationFeedback:t,readOnly:r=!1,executor:n=mm,gradingTests:o}){let a=we(),s=dm(null),{attrs:i}=e,c=e.id,[l,d]=Vr(i.defaultLanguage),[m,u]=Vr(()=>ic(e)),[h,f]=Vr([]),[p,k]=Vr(!1),[y,S]=Vr(!1),b=m[l]??"",C=fm(t);lm(()=>{let g=$=>{let q=$.answers?.find(J=>J.nodeId===c&&J.type==="codingResponse");q?.answer&&(q.answer.language&&d(q.answer.language),q.answer.sourceByLanguage&&u(q.answer.sourceByLanguage),q.answer.testResults&&f(q.answer.testResults))},P=()=>{u(ic(e)),f([]),S(!1)};return a.on("answers:prefill",g),a.on("answers:reset",P),()=>{a.off("answers:prefill",g),a.off("answers:reset",P)}},[a,c,e]);let A=cm((g,P,$)=>{a.emit({type:"answer:changed",answer:{nodeId:c,type:"codingResponse",timestamp:Date.now(),answer:{language:g,sourceByLanguage:P,source:P[g]??"",testResults:$}}})},[a,c]),w=g=>{let P={...m,[l]:g};u(P),A(l,P,h)},T=g=>{d(g),f([]),A(g,m,[])},N=async()=>{if(p)return;k(!0),f([]);let g=o??i.visibleSamples??[];if(g.length===0){k(!1);return}try{let P=await n.run({language:l,source:b,mode:i.testMode,entryFunction:i.entryFunction,tests:g,timeoutMs:5e3});f(P),A(l,m,P)}catch(P){let $=g.map(q=>({testId:q.id,passed:!1,stderr:String(P),errored:!0}));f($),A(l,m,$)}finally{k(!1)}},M=()=>{y||(S(!0),A(l,m,h))},R=(o??[]).filter(g=>g.hidden).length,v=R>0?h.filter(g=>(o??[]).find($=>$.id===g.testId)?.hidden&&g.passed).length:0,x=o?o.filter(g=>!g.hidden):i.visibleSamples??[],B=C==="correct"?"var(--ok, #1f8a4c)":C==="partial"?"var(--almost, #c8810e)":C==="incorrect"?"var(--pen, #d23b2b)":"var(--line-strong, #d6d3cc)";return _e("div",{style:{margin:`${D("0.75rem")} 0`,border:`1px solid ${B}`,borderRadius:D("0.875rem"),overflow:"hidden",transition:"border-color 0.2s"},children:[_e("div",{style:{background:"var(--ui-muted, #f5f4f1)",borderBottom:"1px solid var(--line, #e7e5e0)",padding:`${D("0.5rem")} ${D("0.75rem")}`,display:"flex",alignItems:"center",gap:D("0.5rem"),flexWrap:"wrap"},children:[de("div",{style:{display:"flex",gap:D("0.25rem")},children:i.languages.map(g=>de("button",{onClick:()=>!r&&T(g),disabled:r,style:{padding:`${D("0.2rem")} ${D("0.6rem")}`,borderRadius:D("0.375rem"),border:"1px solid",borderColor:l===g?"var(--ink, #1d2025)":"var(--line, #e7e5e0)",background:l===g?"var(--ink, #1d2025)":"var(--card, #fff)",color:l===g?"#fff":"var(--ink-soft, #565b66)",fontSize:D("0.75rem"),fontWeight:600,cursor:r?"default":"pointer",fontFamily:"var(--font-mono, ui-monospace, monospace)"},children:g},g))}),de("div",{style:{flex:1}}),de(dt,{hint:i.hint}),!r&&_e(Gr,{children:[_e("button",{onClick:N,disabled:p,style:{padding:`${D("0.25rem")} ${D("0.75rem")}`,borderRadius:D("0.5rem"),border:"1px solid var(--line-strong, #d6d3cc)",background:p?"var(--ui-muted, #f5f4f1)":"var(--card, #fff)",color:"var(--ink, #1d2025)",fontSize:D("0.8125rem"),fontWeight:600,cursor:p?"not-allowed":"pointer",display:"inline-flex",alignItems:"center",gap:D("0.35rem")},children:[de(pm,{size:13,style:ke(13)})," ",p?"Running\u2026":"Run"]}),_e("button",{onClick:M,disabled:y,style:{padding:`${D("0.3rem")} ${D("0.85rem")}`,borderRadius:D("0.5rem"),border:"none",background:y?"var(--ok-soft, #ecf8f0)":"var(--ink, #1d2025)",color:y?"var(--ok, #1f8a4c)":"#fff",fontSize:D("0.8125rem"),fontWeight:600,cursor:y?"default":"pointer",display:"inline-flex",alignItems:"center",gap:D("0.35rem")},children:[y&&de(La,{size:13,style:ke(13)})," ",y?"Submitted":"Submit"]})]})]}),de(Ea,{ref:s,value:b,onChange:w,language:l,readOnly:r,readOnlyRanges:i.starters.find(g=>g.language===l)?.readOnlyRanges,height:320}),(h.length>0||x.length>0)&&_e("div",{style:{borderTop:"1px solid var(--line, #e7e5e0)",background:"var(--paper, #fbfaf7)"},children:[de("div",{style:{padding:`${D("0.5rem")} ${D("0.75rem")}`,fontSize:D("0.7rem"),fontWeight:700,color:"var(--ink-faint, #8d93a0)",textTransform:"uppercase",letterSpacing:"0.05em"},children:"Test Results"}),x.map(g=>de(hm,{sample:g,result:h.find(P=>P.testId===g.id),mode:i.testMode},g.id)),R>0&&_e("div",{style:{padding:`${D("0.5rem")} ${D("0.75rem")}`,fontSize:D("0.8125rem"),color:"var(--ink-soft, #565b66)",borderTop:"1px solid var(--line, #e7e5e0)",fontStyle:"italic",display:"flex",alignItems:"center",gap:D("0.4rem")},children:[de(um,{size:13,style:ke(13)})," Hidden tests: ",v,"/",R," passed"]})]}),t?.showFeedback&&_e("div",{style:{padding:`${D("0.55rem")} ${D("0.75rem")}`,fontSize:D("0.85rem"),fontWeight:600,borderTop:"1px solid var(--line, #e7e5e0)",display:"flex",alignItems:"center",gap:D("0.45rem"),background:C==="correct"?"var(--ok-soft, #ecf8f0)":C==="partial"?"var(--almost-soft, #fbf1dc)":C==="incorrect"?"var(--pen-soft, #fdeeec)":"transparent",color:C==="correct"?"var(--ok, #1f8a4c)":C==="partial"?"var(--almost-ink, #8a5a08)":C==="incorrect"?"var(--pen, #d23b2b)":"var(--ink-soft, #565b66)"},children:[C==="correct"&&_e(Gr,{children:[de(La,{size:15,style:ke(15)})," All tests passed"]}),C==="partial"&&"Partial credit",C==="incorrect"&&_e(Gr,{children:[de(cc,{size:15,style:ke(15)})," Tests failed"]}),C==="validating"&&"Evaluating\u2026",C==="awaiting_review"&&"Awaiting teacher review",t.score!==void 0&&_e("span",{style:{marginLeft:"auto",fontFamily:'var(--font-hand, "Caveat", cursive)',fontSize:D("1.5rem"),lineHeight:1},children:[t.score," / ",t.maxScore??i.maxScore]})]})]})}import{Fragment as xm,jsx as Gn,jsxs as ym}from"react/jsx-runtime";import{createContext as vm,useContext as wm,useEffect as km}from"react";import{DndContext as Sm,MouseSensor as Rm,TouchSensor as Cm,KeyboardSensor as Am,useDndContext as Nm,useSensor as Fa,useSensors as _m}from"@dnd-kit/core";import{jsx as Ia}from"react/jsx-runtime";import{DragOverlay as gm,useDndContext as bm}from"@dnd-kit/core";function $a(){let{active:e}=bm();if(!e)return null;let t=e.data.current?.html??"";return Ia(gm,{dropAnimation:null,children:Ia("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:Ia("span",{dangerouslySetInnerHTML:{__html:t},style:{pointerEvents:"none",whiteSpace:"nowrap",lineHeight:"1.25"}})})})}function Tm(e,t,r){let n=[],o=new Set,a=s=>{o.has(s)||(o.add(s),r(s)==="smooth"&&(n.push([s,s.style.scrollBehavior]),s.style.scrollBehavior="auto"))};for(let s=e;s;s=s.parentElement)a(s);return t&&a(t),()=>{for(let[s,i]of n)s.style.scrollBehavior=i}}function Pm(){let{activeNode:e}=Nm();return km(()=>{if(!(!e||typeof document>"u"))return Tm(e,document.scrollingElement,t=>getComputedStyle(t).scrollBehavior)},[e]),null}var lc=vm(!1),Mm={acceleration:3,threshold:{x:0,y:.25}};function Yn({children:e}){let t=wm(lc),r=Fa(Rm,{activationConstraint:{distance:8}}),n=Fa(Cm,{activationConstraint:{delay:250,tolerance:5}}),o=Fa(Am),a=_m(r,n,o);return t?Gn(xm,{children:e}):Gn(lc.Provider,{value:!0,children:ym(Sm,{sensors:a,autoScroll:Mm,children:[e,Gn($a,{}),Gn(Pm,{})]})})}function mr({content:e,onAnswersChange:t,onSubmit:r,answerBus:n,namespace:o,initialAnswers:a,validationFeedback:s,className:i="",locale:c,readOnly:l=!1,mediaHandler:d,answerSheetHandler:m,codeExecutor:u,display:h}){let f=He(h),p=Em(()=>Ye(f),[f]),k=Lm(null);k.current||(k.current=new ft);let y=n??k.current;Da(()=>{a&&a.length>0&&y.prefillAnswers(a)},[a,y]),Da(()=>{if(!t)return;let b=()=>{let C=y.getAllAnswers();t(C)};return y.on("answer:changed",b),()=>y.off("answer:changed",b)},[y,t]),Da(()=>{if(!r)return;let b=C=>{r(C.answers)};return y.on("answer:submitted",b),()=>y.off("answer:submitted",b)},[y,r]);let S=Ge(e,s,{readOnly:l,mediaHandler:d,answerSheetHandler:m,codeExecutor:u});return ur(Cr,{locale:c,children:ur(We,{display:f,children:ur(an,{bus:y,children:ur(Yn,{children:ur(Sn,{initialAnswers:a,children:ur("div",{className:`question-runtime ${i}${p.sizeSet?" edp-scaled":""}`,"data-namespace":o,style:{fontSize:D("1.125rem"),lineHeight:"1.75",...Qe(p)},children:S})})})})})})}import{jsx as fr,jsxs as Jn}from"react/jsx-runtime";import{memo as Dm,useCallback as fc,useMemo as zm,useRef as mc}from"react";var dc={words:80,media:1,tableRows:6},Im=new Set(["resizableImage","resizableVideo","youtubeEmbed"]);function pc(e){let t={words:0,media:0,tableRows:0},r=n=>{if(typeof n.text=="string"&&(t.words+=n.text.split(/\s+/).filter(o=>/[\p{L}\p{N}]/u.test(o)).length),n.type&&Im.has(n.type)&&t.media++,n.type==="table"){let o=(n.content??[]).filter(a=>a.type==="tableRow").length;t.tableRows=Math.max(t.tableRows,o)}for(let o of n.content??[])r(o)};return e&&r(e),t}function Yr(e,t=dc){let r=pc(e);return r.words>t.words||r.media>t.media||r.tableRows>t.tableRows}import{createContext as $m,useContext as Fm}from"react";var uc=$m(null),Qn=uc.Provider;function Xn(){return Fm(uc)}function Zn({exercise:e,onAnswersChange:t,validationFeedback:r,renderSharedContext:n,renderQuestion:o,renderSeparator:a,className:s="",locale:i,display:c}){let l=He(c),d=zm(()=>Ye(l),[l]),m=mc(new Map),u=mc({exercise:e,onAnswersChange:t});u.current={exercise:e,onAnswersChange:t};let h=fc((S,b)=>{m.current.set(S,b);let{exercise:C,onAnswersChange:A}=u.current;if(A){let w={exerciseId:C.id,questionAnswers:C.questions.map(T=>({questionId:T.id,answers:m.current.get(T.id)??[]}))};A(w)}},[]),f=Xn(),p=Rr(i),k=!!(f&&e.sharedContext&&Yr(e.sharedContext)),y=e.sharedContext?k?Jn("p",{className:"exercise-reference-cue",children:[fr("span",{children:p.referenceInPanel(f.label)})," ",Jn("button",{type:"button",className:"exercise-reference-cue__link",onClick:()=>f.showExerciseReference(e.id),children:[p.readReference,fr("span",{"aria-hidden":"true",className:"exercise-reference-cue__arrow",children:"\u203A"})]})]}):fr("div",{className:"exercise-shared-context",children:Ge(e.sharedContext)}):null;return fr(We,{display:l,children:Jn("div",{className:`exercise-runtime ${s}`,style:Qe(d),children:[y&&(n?n(y):y),e.questions.map((S,b)=>{let C=r?.get(S.id),A=fr(Bm,{questionId:S.id,content:S.content,onQuestionAnswers:h,validationFeedback:C,locale:i},S.id);return Jn("div",{children:[o?o(S,A,b):A,a&&b<e.questions.length-1?a(b):null]},S.id)})]})})}var Bm=Dm(function({questionId:t,onQuestionAnswers:r,...n}){let o=fc(a=>r(t,a),[r,t]);return fr(mr,{...n,onAnswersChange:o})});import{jsx as za,jsxs as Om}from"react/jsx-runtime";import{useCallback as jm,useEffect as qm,useMemo as Hm,useRef as hc}from"react";function Lt({assessment:e,onAnswersChange:t,validationFeedback:r,renderExercise:n,renderSharedContext:o,renderSeparator:a,className:s="",brandingConfig:i,locale:c,display:l}){let d=hc(new Map),m=He(l),u=Hm(()=>Ye(m),[m]);qm(()=>{if(!i?.fontUrl)return;let k=`edpire-brand-font-${i.fontUrl.replace(/\W/g,"").slice(-24)}`;if(document.getElementById(k))return;let y=document.createElement("link");y.id=k,y.rel="stylesheet",y.href=i.fontUrl,document.head.appendChild(y)},[i?.fontUrl]);let h={...Qe(u)};i?.fontFamily&&(h["--brand-font"]=i.fontFamily);let f=hc({assessment:e,onAnswersChange:t});f.current={assessment:e,onAnswersChange:t};let p=jm(k=>{d.current.set(k.exerciseId,k);let{assessment:y,onAnswersChange:S}=f.current;if(S){let b={exerciseAnswers:y.exercises.map(C=>d.current.get(C.id)??{exerciseId:C.id,questionAnswers:[]})};S(b)}},[]);return za(We,{display:m,children:za("div",{className:`assessment-runtime ${s}`,style:Object.keys(h).length?h:void 0,children:e.exercises.map((k,y)=>{let S=r?.get(k.id),b=za(Zn,{exercise:k,onAnswersChange:p,validationFeedback:S,renderSharedContext:o?C=>o(C,k):void 0,locale:c},k.id);return Om("div",{children:[n?n(k,b,y):b,a&&y<e.exercises.length-1?a(y):null]},k.id)})})})}import{jsx as gc}from"react/jsx-runtime";import{useMemo as Km}from"react";function hr({content:e,className:t,display:r}){let n=He(r),o=Km(()=>Ye(n),[n]);return gc(We,{display:n,children:gc("div",{className:`content-view ${t??""}`,style:Qe(o),children:Ge(e)})})}import{jsx as Qr,Fragment as bc,jsxs as eo}from"react/jsx-runtime";import{useMemo as Wm}from"react";function Xr({item:e,className:t,renderFigureLabel:r,display:n}){let o=He(n),a=Wm(()=>Ye(o),[o]);return Qr(We,{display:o,children:eo("div",{className:`annex-item-view ${t??""}${a.sizeSet?" edp-scaled":""}`,style:Qe(a),children:[e.type==="text-document"&&eo(bc,{children:[e.title&&Qr("h3",{className:"text-base font-semibold mb-2",children:e.title}),Ge(e.content)]}),e.type==="figure"&&eo("figure",{children:[Ge(e.content),Qr("figcaption",{children:r?r(e.label):Qr("span",{children:e.label})})]}),e.type==="rich-block"&&eo(bc,{children:[e.title&&Qr("h3",{className:"text-base font-semibold mb-2",children:e.title}),Ge(e.content)]})]})})}import{jsx as e0,jsxs as t0}from"react/jsx-runtime";import{useState as n0}from"react";import{jsx as l0,jsxs as d0}from"react/jsx-runtime";import{useState as u0,useCallback as m0,useMemo as f0}from"react";import{useEditor as g0,EditorContent as b0}from"@tiptap/react";import y0 from"@tiptap/starter-kit";import{jsx as R0,jsxs as C0,Fragment as A0}from"react/jsx-runtime";import{useMemo as _0,useState as T0}from"react";import{Send as Oc,Loader2 as Ga,BarChart2 as Ya,CheckCircle2 as jc,XCircle as Cf,RotateCcw as Af,X as Qa,Clock as br,AlertTriangle as Nf,AlertCircle as _f,Check as Tf,CloudOff as Pf}from"lucide-react";import{clsx as Jm}from"clsx";import{twMerge as Zm}from"tailwind-merge";function Re(...e){return Zm(Jm(e))}function Gt(e,t,r){return t?.trim()||e("exercise",{index:r+1})}import{Fragment as of,jsx as Fe,jsxs as Ba}from"react/jsx-runtime";function ef({accent:e}){return Fe("div",{style:{width:48,height:48,borderRadius:"50%",border:`4px solid ${e}33`,borderTopColor:e,animation:"edpire-spin 0.8s linear infinite"}})}function tf({accent:e}){return Fe("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[0,1,2].map(t=>Fe("div",{style:{width:12,height:12,borderRadius:"50%",background:e,animation:`edpire-bounce 1.2s ease-in-out ${t*.2}s infinite`}},t))})}function rf({accent:e}){return Ba("div",{style:{position:"relative",width:48,height:48},children:[[0,1].map(t=>Fe("div",{style:{position:"absolute",inset:0,borderRadius:"50%",background:e,opacity:.4,animation:`edpire-pulse 1.6s ease-out ${t*.8}s infinite`}},t)),Fe("div",{style:{position:"absolute",inset:"25%",borderRadius:"50%",background:e}})]})}function nf({accent:e}){return Fe("div",{style:{display:"flex",gap:4,alignItems:"flex-end",height:40},children:[0,1,2,3].map(t=>Fe("div",{style:{width:8,borderRadius:4,background:e,animation:`edpire-bars 1s ease-in-out ${t*.15}s infinite`}},t))})}function xc({visible:e,bgColor:t="rgba(0,0,0,0.55)",accentColor:r="#6366f1",text:n="Evaluating your answers\u2026",aiText:o="Some answers are being reviewed by AI, this may take a few seconds.",spinnerTheme:a="default",animationUrl:s,hasAiNodes:i=!1,contained:c=!1}){return e?Ba(of,{children:[Fe("style",{children:`
|
|
53
53
|
@keyframes edpire-spin {
|
|
54
54
|
to { transform: rotate(360deg); }
|
|
55
55
|
}
|
|
@@ -65,7 +65,7 @@ sys.stdin = io.StringIO(${JSON.stringify(s)})
|
|
|
65
65
|
0%, 100% { height: 12px; }
|
|
66
66
|
50% { height: 40px; }
|
|
67
67
|
}
|
|
68
|
-
`}),Pe("div",{style:{background:t},className:`${c?"absolute":"fixed"} inset-0 z-[60] flex items-center justify-center`,children:ca("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 Pe("img",{src:s,alt:"",className:"w-24 h-24 object-contain"});switch(a){case"dots":return Pe(Ou,{accent:r});case"pulse":return Pe(ju,{accent:r});case"bars":return Pe(Bu,{accent:r});default:return Pe(Du,{accent:r})}})(),Pe("p",{className:"text-sm font-semibold text-slate-800",children:n}),i&&Pe("p",{className:"text-xs text-slate-500 leading-snug",children:o})]})})]}):null}import{useCallback as Ii,useEffect as Hu,useMemo as $i,useRef as $n,useState as Wu}from"react";import{BookOpen as Fi,X as Uu}from"lucide-react";import{Fragment as Vu,jsx as xe,jsxs as Ke}from"react/jsx-runtime";function la(e){return e.exercises.flatMap((t,r)=>t.sharedContext&&$r(t.sharedContext)?[{id:t.id,index:r,title:t.title,content:t.sharedContext}]:[])}var zi=()=>typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;function Ku(e){e.removeAttribute("data-flash"),e.offsetWidth,e.setAttribute("data-flash","true"),setTimeout(()=>e.removeAttribute("data-flash"),1200)}function Di({assessment:e,isSubmitted:t,setAnswers:r,validationFeedback:n,renderExercise:o,renderSeparator:a,primaryColor:s,contained:i=!1,locale:c,contentMaxWidth:l,t:p,footer:f}){let[m,h]=Wu(!1),d=e.annex,u=d?.tabLabel||p("annexDocuments"),S=$i(()=>la(e),[e]),R=$n(null),k=$n(null),C=$n(null),v=$n(null),N=()=>(R.current?.getClientRects().length??0)>0,w=Ii((A,W)=>{let b=A?.querySelector(`[data-reference-for="${CSS.escape(W)}"]`);if(!A||!b)return;let M=b.getBoundingClientRect().top-A.getBoundingClientRect().top+A.scrollTop-12;A.scrollTo({top:M,behavior:zi()?"auto":"smooth"}),Ku(b)},[]),x=Ii(A=>{if(N()){w(k.current,A);return}h(!0),requestAnimationFrame(()=>requestAnimationFrame(()=>w(v.current,A)))},[w]),y=A=>{let W=N()?R.current:C.current;N()||h(!1),Array.from(W?.querySelectorAll(`[data-exercise-id="${CSS.escape(A)}"]`)??[]).find(M=>M.getClientRects().length>0)?.scrollIntoView({behavior:zi()?"auto":"smooth",block:"start"})};Hu(()=>{let A=R.current;if(!A||S.length===0||typeof IntersectionObserver>"u")return;let W=i?A:null,b=new Set(S.map(B=>B.id)),M=null,$=new IntersectionObserver(B=>{if(!N())return;let Y=B.filter(Q=>Q.isIntersecting&&b.has(Q.target.dataset.exerciseId??"")).sort((Q,ve)=>Q.boundingClientRect.top-ve.boundingClientRect.top)[0]?.target?.dataset.exerciseId;!Y||Y===M||(M=Y,w(k.current,Y))},{root:W,rootMargin:"0px 0px -60% 0px"});return A.querySelectorAll("[data-exercise-id]").forEach(B=>$.observe(B)),()=>$.disconnect()},[S,w,i]);let T=$i(()=>({label:u,showExerciseReference:x}),[u,x]),g=Ke(Vu,{children:[d?.items.map(A=>xe(zr,{item:A},A.id)),d?.items.length&&S.length?xe("div",{className:"border-t border-[#e7e5e0]"}):null,S.map(A=>Ke("section",{"data-reference-for":A.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:[xe("button",{type:"button",onClick:()=>y(A.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:xe("span",{dir:"auto",children:Dt(p,A.title,A.index)})}),xe(rr,{content:A.content})]},A.id))]}),P=xe(Nt,{assessment:e,onAnswersChange:t?void 0:r,validationFeedback:n,renderExercise:o,renderSeparator:a,locale:c});return xe(Tn,{value:T,children:Ke("div",{className:ye("@container flex-1 min-h-0 flex",i&&"relative"),children:[Ke("div",{ref:R,className:ye("hidden @6xl:flex flex-1 min-w-0 gap-4 p-4 bg-[#f5f4f1] items-start",i&&"overflow-y-auto"),children:[Ke("div",{className:ye("flex-1 sticky flex flex-col bg-white rounded-[14px] border border-[#e7e5e0] shadow-sm overflow-hidden",i?"top-4 max-h-[calc(100svh-6rem)]":"top-[calc(var(--edp-bar)+1rem)] max-h-[calc(100dvh-var(--edp-bar)-2rem)]"),children:[Ke("div",{className:"flex items-center gap-2 px-5 py-3 border-b border-[#e7e5e0] flex-shrink-0",children:[xe(Fi,{size:14,className:"text-[#8d93a0]"}),xe("span",{className:"text-xs font-bold text-[#565b66] uppercase tracking-widest",children:u})]}),xe("div",{ref:k,className:"flex-1 overflow-y-auto px-6 py-5 flex flex-col gap-6",children:g})]}),xe("div",{className:"w-px bg-[#e7e5e0] flex-shrink-0 self-stretch my-1 rounded-full"}),xe("div",{className:"flex-1 min-w-0 bg-white rounded-[14px] border border-[#e7e5e0] shadow-sm",children:Ke("div",{className:"px-6 py-5 flex flex-col gap-4",children:[P,f]})})]}),Ke("div",{className:ye("@6xl:hidden flex-1 min-w-0 relative",i&&"overflow-hidden"),children:[xe("div",{ref:C,className:ye(i&&"absolute inset-0 overflow-y-auto"),children:Ke("div",{className:"mx-auto px-5 py-5 flex flex-col gap-4",style:{maxWidth:l},children:[P,f]})}),m&&xe("div",{className:ye("inset-0 z-30 bg-black/25",i?"absolute":"fixed"),onClick:()=>h(!1)}),Ke("div",{role:"dialog","aria-label":u,"aria-hidden":!m,className:ye("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",m?"translate-x-0":"-translate-x-[110%] rtl:translate-x-[110%]"),children:[Ke("div",{className:"flex items-center justify-between px-5 py-3 flex-shrink-0",children:[xe("span",{className:"text-sm font-bold text-[#1d2025]",children:u}),xe("button",{onClick:()=>h(!1),"aria-label":p("close"),className:"p-1 text-[#8d93a0] hover:text-[#1d2025] rounded-lg transition-colors",children:xe(Uu,{size:18})})]}),xe("div",{ref:v,className:"overflow-y-auto max-h-[calc(100dvh-8rem)] px-5 pb-5 flex flex-col gap-5",children:g})]})]}),!m&&Ke("button",{onClick:()=>h(!0),"aria-label":u,style:{transform:"translateY(-50%)",...s?{backgroundColor:s}:{}},className:ye("@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:[xe(Fi,{size:12}),xe("span",{style:{writingMode:"vertical-rl",transform:"rotate(180deg)"},children:u})]})]})})}import{useState as Gu}from"react";import{BookOpen as Oi,Plus as Yu,X as Qu}from"lucide-react";import{jsx as Ae,jsxs as gt}from"react/jsx-runtime";function ji({assessment:e,isSubmitted:t,setAnswers:r,validationFeedback:n,renderExercise:o,renderSeparator:a,primaryColor:s,contained:i=!1,locale:c,contentMaxWidth:l,t:p,onAddAnnex:f,footer:m}){let[h,d]=Gu(!1),u=Ae(Nt,{assessment:e,onAnswersChange:t?void 0:r,validationFeedback:n,renderExercise:o,renderSeparator:a,locale:c});if(h)return Ae("div",{className:"flex-1 overflow-y-auto",children:gt("div",{className:"mx-auto p-6 flex flex-col gap-4",style:{maxWidth:l},children:[u,m]})});let S=C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),f())},R=C=>gt("span",{style:s?{backgroundColor:s}:void 0,className:ye("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",C?"px-3 py-1.5 text-xs":"mt-1 px-3.5 py-2 text-xs"),children:[Ae(Yu,{size:13}),p("annexEmptyCta")]}),k=C=>Ae("button",{type:"button",onClick:v=>{v.stopPropagation(),d(!0)},"aria-label":p("annexEmptyDismiss"),title:p("annexEmptyDismiss"),className:ye("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",C&&"absolute top-2 end-2 z-10"),children:Ae(Qu,{size:15})});return gt("div",{className:ye("@container flex-1 min-h-0 flex",i&&"relative"),children:[gt("div",{className:"hidden @6xl:flex flex-1 gap-4 p-4 bg-[#f5f4f1] items-start overflow-y-auto",children:[Ae("div",{className:"flex-1 sticky top-4 flex min-h-[200px] max-h-[calc(100svh-6rem)]",children:gt("div",{role:"button",tabIndex:0,onClick:f,onKeyDown:S,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),Ae("span",{className:"flex items-center justify-center w-11 h-11 rounded-full bg-[#f1efe9] text-[#8d93a0] group-hover:text-[#1d2025] transition-colors",children:Ae(Oi,{size:20})}),Ae("span",{className:"text-sm font-bold text-[#565b66]",children:p("annexEmptyTitle")}),Ae("span",{className:"text-xs text-[#8d93a0] max-w-[32ch] leading-relaxed",children:p("annexEmptyBody")}),R(!1)]})}),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:gt("div",{className:"px-6 py-5 flex flex-col gap-4",children:[u,m]})})]}),Ae("div",{className:"@6xl:hidden flex-1 overflow-y-auto",children:gt("div",{className:"mx-auto px-5 py-5 flex flex-col gap-4",style:{maxWidth:l},children:[gt("div",{role:"button",tabIndex:0,onClick:f,onKeyDown:S,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:[Ae("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:Ae(Oi,{size:16})}),gt("div",{className:"flex-1 min-w-0",children:[Ae("div",{className:"text-xs font-bold text-[#565b66]",children:p("annexEmptyTitle")}),Ae("div",{className:"text-[11px] text-[#8d93a0] leading-snug",children:p("annexEmptyBody")})]}),R(!0),k(!1)]}),u,m]})})]})}function Fn(e){let t=new Map;for(let r of e){let n=new Map;for(let o of r.questions){let a=new Map;for(let s of o.nodeResults){let i={state:s.status,showFeedback:!0,score:s.score,...s.feedback!==void 0?{message:s.feedback}:{},...s.displayAnswer!==void 0?{displayAnswer:s.displayAnswer}:{},...s.teacherFeedback!==void 0?{teacherFeedback:s.teacherFeedback}:{}};s.detail?.type==="choiceSet"?i.correctChoiceIds=s.detail.correctChoiceIds:s.detail?.type==="matchingSet"&&(i.pairFeedback=s.detail.pairFeedback,i.correctPairings=s.detail.correctPairings),a.set(s.nodeId,i)}n.set(o.questionId,a)}t.set(r.exerciseId,n)}return t}import{Lightbulb as Xu}from"lucide-react";import{jsx as da,jsxs as Bi}from"react/jsx-runtime";function Ju(e){return e.length===0||e.some(t=>t.status==="awaiting_review")?null:e.every(t=>t.status==="correct")?"correct":e.some(t=>t.status==="partial"||t.status==="correct"||(t.score??0)>0)?"partial":"incorrect"}function qi({content:e,nodeResults:t,label:r}){let n=Ju(t);return Bi("div",{className:`player-ai-feedback mt-3 mb-3${n?` player-ai-feedback--${n}`:""}`,children:[Bi("p",{className:"flex items-center gap-1.5 text-xs font-semibold",children:[da(Xu,{size:14,"aria-hidden":!0}),r]}),da("div",{className:"text-[#1d2025]",children:da(rr,{content:e})})]})}import{useState as Hi}from"react";import{jsx as Ot,jsxs as Wi}from"react/jsx-runtime";function Ui({questionId:e,onReport:t,t:r}){let[n,o]=Hi("closed"),[a,s]=Hi("");if(n==="sent")return Ot("p",{role:"status",className:"mt-2 text-sm text-[#5b6170]",children:r("reportGradeSent")});if(n==="closed")return Ot("button",{type:"button",onClick:()=>o("open"),className:"mt-2 text-sm text-[#5b6170] underline underline-offset-2 hover:text-[#1d2025]",children:r("reportGrade")});let i=async()=>{if(a.trim()){o("sending");try{await t(e,a.trim()),o("sent")}catch{o("failed")}}};return Wi("div",{className:"mt-2 rounded-lg border border-[#e7e5e0] bg-[#fbfaf7] p-3",children:[Ot("label",{className:"mb-1.5 block text-sm font-medium text-[#1d2025]",htmlFor:`report-${e}`,children:r("reportGradePrompt")}),Ot("textarea",{id:`report-${e}`,value:a,onChange:c=>s(c.target.value.slice(0,1e3)),rows:3,dir:"auto",className:"w-full rounded-md border border-[#d6d3cc] bg-white p-2 text-sm text-[#1d2025] outline-none focus:border-[#1d2025]"}),n==="failed"&&Ot("p",{role:"alert",className:"mt-1 text-sm text-[#a32b1e]",children:r("reportGradeFailed")}),Wi("div",{className:"mt-2 flex gap-2",children:[Ot("button",{type:"button",onClick:i,disabled:!a.trim()||n==="sending",className:"rounded-md bg-[#1d2025] px-3 py-1.5 text-sm font-medium text-white disabled:opacity-40",children:r("reportGradeSend")}),Ot("button",{type:"button",onClick:()=>o("closed"),className:"rounded-md border border-[#d6d3cc] px-3 py-1.5 text-sm text-[#1d2025]",children:r("reportGradeCancel")})]})]})}import{jsx as bt,jsxs as pa}from"react/jsx-runtime";function Ki({t:e,rtl:t,showClose:r,onContinue:n,continueLabel:o,primaryColor:a}){return pa("div",{role:"status",className:"edp-thanks flex-1 flex items-center justify-center px-6 py-16",children:[bt("style",{children:Zu}),pa("div",{className:"flex flex-col items-center text-center",style:{maxWidth:"26rem"},children:[pa("div",{className:"relative",style:{width:120,height:120},"aria-hidden":!0,children:[bt("svg",{className:"edp-thanks-blob absolute inset-0 overflow-visible",viewBox:"0 0 200 200",width:"120",height:"120",children:bt("path",{d:"M104 14c44 2 80 34 82 80s-34 94-86 92S12 150 16 98 58 12 104 14z",fill:"#ffd64a"})}),bt("svg",{className:"absolute inset-0 overflow-visible",viewBox:"0 0 100 100",width:"120",height:"120",children:bt("path",{className:"edp-thanks-check",d:"M26 54l17 17 33-39",fill:"none",stroke:"#1d2025",strokeWidth:9,strokeLinecap:"round",strokeLinejoin:"round",pathLength:1})})]}),bt("h2",{className:"edp-thanks-stamp mt-4 text-[#1d2025]",style:t?{fontSize:36,fontWeight:700,lineHeight:1.3,transform:"rotate(-3deg)"}:{fontFamily:'var(--font-hand, "Caveat", cursive)',fontSize:56,fontWeight:600,lineHeight:1,transform:"rotate(-4deg)"},children:e("formThanks")}),bt("p",{className:"edp-thanks-rise mt-4 text-base text-[#565b66]",style:{animationDelay:"750ms"},children:e("formThanksDesc")}),r&&!n&&bt("p",{className:"edp-thanks-rise mt-1 text-sm text-[#8a8f99]",style:{animationDelay:"850ms"},children:e("formThanksClose")}),n&&bt("button",{onClick:n,style:{animationDelay:"850ms",...a?{backgroundColor:a}:{}},className:"edp-thanks-rise mt-6 px-4 py-2 bg-[#1d2025] text-white text-sm font-semibold rounded-lg hover:bg-[#31353c] transition-colors",children:o??e("continue")})]})]})}var Zu=`
|
|
68
|
+
`}),Fe("div",{style:{background:t},className:`${c?"absolute":"fixed"} inset-0 z-[60] flex items-center justify-center`,children:Ba("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 Fe("img",{src:s,alt:"",className:"w-24 h-24 object-contain"});switch(a){case"dots":return Fe(tf,{accent:r});case"pulse":return Fe(rf,{accent:r});case"bars":return Fe(nf,{accent:r});default:return Fe(ef,{accent:r})}})(),Fe("p",{className:"text-sm font-semibold text-slate-800",children:n}),i&&Fe("p",{className:"text-xs text-slate-500 leading-snug",children:o})]})})]}):null}import{useCallback as yc,useEffect as af,useMemo as vc,useRef as to,useState as sf}from"react";import{BookOpen as wc,X as cf}from"lucide-react";import{Fragment as df,jsx as Ce,jsxs as Xe}from"react/jsx-runtime";function Oa(e){return e.exercises.flatMap((t,r)=>t.sharedContext&&Yr(t.sharedContext)?[{id:t.id,index:r,title:t.title,content:t.sharedContext}]:[])}var kc=()=>typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;function lf(e){e.removeAttribute("data-flash"),e.offsetWidth,e.setAttribute("data-flash","true"),setTimeout(()=>e.removeAttribute("data-flash"),1200)}function Sc({assessment:e,isSubmitted:t,setAnswers:r,validationFeedback:n,renderExercise:o,renderSeparator:a,primaryColor:s,contained:i=!1,locale:c,contentMaxWidth:l,t:d,footer:m}){let[u,h]=sf(!1),f=e.annex,p=f?.tabLabel||d("annexDocuments"),k=vc(()=>Oa(e),[e]),y=to(null),S=to(null),b=to(null),C=to(null),A=()=>(y.current?.getClientRects().length??0)>0,w=yc((x,B)=>{let g=x?.querySelector(`[data-reference-for="${CSS.escape(B)}"]`);if(!x||!g)return;let P=g.getBoundingClientRect().top-x.getBoundingClientRect().top+x.scrollTop-12;x.scrollTo({top:P,behavior:kc()?"auto":"smooth"}),lf(g)},[]),T=yc(x=>{if(A()){w(S.current,x);return}h(!0),requestAnimationFrame(()=>requestAnimationFrame(()=>w(C.current,x)))},[w]),N=x=>{let B=A()?y.current:b.current;A()||h(!1),Array.from(B?.querySelectorAll(`[data-exercise-id="${CSS.escape(x)}"]`)??[]).find(P=>P.getClientRects().length>0)?.scrollIntoView({behavior:kc()?"auto":"smooth",block:"start"})};af(()=>{let x=y.current;if(!x||k.length===0||typeof IntersectionObserver>"u")return;let B=i?x:null,g=new Set(k.map(q=>q.id)),P=null,$=new IntersectionObserver(q=>{if(!A())return;let I=q.filter(Z=>Z.isIntersecting&&g.has(Z.target.dataset.exerciseId??"")).sort((Z,ve)=>Z.boundingClientRect.top-ve.boundingClientRect.top)[0]?.target?.dataset.exerciseId;!I||I===P||(P=I,w(S.current,I))},{root:B,rootMargin:"0px 0px -60% 0px"});return x.querySelectorAll("[data-exercise-id]").forEach(q=>$.observe(q)),()=>$.disconnect()},[k,w,i]);let M=vc(()=>({label:p,showExerciseReference:T}),[p,T]),R=Xe(df,{children:[f?.items.map(x=>Ce(Xr,{item:x},x.id)),f?.items.length&&k.length?Ce("div",{className:"border-t border-[#e7e5e0]"}):null,k.map(x=>Xe("section",{"data-reference-for":x.id,className:"-mx-3 flex flex-col gap-2 rounded-[10px] px-3 py-2 transition-colors duration-700 data-[flash=true]:bg-[#fbf1dc] data-[flash=true]:duration-150",children:[Ce("button",{type:"button",onClick:()=>N(x.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:Ce("span",{dir:"auto",children:Gt(d,x.title,x.index)})}),Ce(hr,{content:x.content})]},x.id))]}),v=Ce(Lt,{assessment:e,onAnswersChange:t?void 0:r,validationFeedback:n,renderExercise:o,renderSeparator:a,locale:c});return Ce(Qn,{value:M,children:Xe("div",{className:Re("@container flex-1 min-h-0 flex",i&&"relative"),children:[Xe("div",{ref:y,className:Re("hidden @6xl:flex flex-1 min-w-0 gap-4 p-4 bg-[#f5f4f1] items-start",i&&"overflow-y-auto"),children:[Xe("div",{className:Re("flex-1 sticky flex flex-col bg-white rounded-[14px] border border-[#e7e5e0] shadow-sm overflow-hidden",i?"top-4 max-h-[calc(100svh-6rem)]":"top-[calc(var(--edp-bar)+1rem)] max-h-[calc(100dvh-var(--edp-bar)-2rem)]"),children:[Xe("div",{className:"flex items-center gap-2 px-5 py-3 border-b border-[#e7e5e0] flex-shrink-0",children:[Ce(wc,{size:14,className:"text-[#8d93a0]"}),Ce("span",{className:"text-xs font-bold text-[#565b66] uppercase tracking-widest",children:p})]}),Ce("div",{ref:S,className:"flex-1 overflow-y-auto px-6 py-5 flex flex-col gap-6",children:R})]}),Ce("div",{className:"w-px bg-[#e7e5e0] flex-shrink-0 self-stretch my-1 rounded-full"}),Ce("div",{className:"flex-1 min-w-0 bg-white rounded-[14px] border border-[#e7e5e0] shadow-sm",children:Xe("div",{className:"px-6 py-5 flex flex-col gap-4",children:[v,m]})})]}),Xe("div",{className:Re("@6xl:hidden flex-1 min-w-0 relative",i&&"overflow-hidden"),children:[Ce("div",{ref:b,className:Re(i&&"absolute inset-0 overflow-y-auto"),children:Xe("div",{className:"mx-auto px-5 py-5 flex flex-col gap-4",style:{maxWidth:l},children:[v,m]})}),u&&Ce("div",{className:Re("inset-0 z-30 bg-black/25",i?"absolute":"fixed"),onClick:()=>h(!1)}),Xe("div",{role:"dialog","aria-label":p,"aria-hidden":!u,className:Re("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",u?"translate-x-0":"-translate-x-[110%] rtl:translate-x-[110%]"),children:[Xe("div",{className:"flex items-center justify-between px-5 py-3 flex-shrink-0",children:[Ce("span",{className:"text-sm font-bold text-[#1d2025]",children:p}),Ce("button",{onClick:()=>h(!1),"aria-label":d("close"),className:"p-1 text-[#8d93a0] hover:text-[#1d2025] rounded-lg transition-colors",children:Ce(cf,{size:18})})]}),Ce("div",{ref:C,className:"overflow-y-auto max-h-[calc(100dvh-8rem)] px-5 pb-5 flex flex-col gap-5",children:R})]})]}),!u&&Xe("button",{onClick:()=>h(!0),"aria-label":p,style:{transform:"translateY(-50%)",...s?{backgroundColor:s}:{}},className:Re("@6xl:hidden top-1/2 start-0 z-20 flex flex-col items-center gap-1 py-3 px-1.5 bg-[#1d2025] text-white text-[10px] font-bold uppercase tracking-wider rounded-e-lg shadow-md hover:bg-[#31353c] transition-colors",i?"absolute":"fixed"),children:[Ce(wc,{size:12}),Ce("span",{style:{writingMode:"vertical-rl",transform:"rotate(180deg)"},children:p})]})]})})}import{useState as pf}from"react";import{BookOpen as Rc,Plus as uf,X as mf}from"lucide-react";import{jsx as Ie,jsxs as wt}from"react/jsx-runtime";function Cc({assessment:e,isSubmitted:t,setAnswers:r,validationFeedback:n,renderExercise:o,renderSeparator:a,primaryColor:s,contained:i=!1,locale:c,contentMaxWidth:l,t:d,onAddAnnex:m,footer:u}){let[h,f]=pf(!1),p=Ie(Lt,{assessment:e,onAnswersChange:t?void 0:r,validationFeedback:n,renderExercise:o,renderSeparator:a,locale:c});if(h)return Ie("div",{className:"flex-1 overflow-y-auto",children:wt("div",{className:"mx-auto p-6 flex flex-col gap-4",style:{maxWidth:l},children:[p,u]})});let k=b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),m())},y=b=>wt("span",{style:s?{backgroundColor:s}:void 0,className:Re("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",b?"px-3 py-1.5 text-xs":"mt-1 px-3.5 py-2 text-xs"),children:[Ie(uf,{size:13}),d("annexEmptyCta")]}),S=b=>Ie("button",{type:"button",onClick:C=>{C.stopPropagation(),f(!0)},"aria-label":d("annexEmptyDismiss"),title:d("annexEmptyDismiss"),className:Re("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",b&&"absolute top-2 end-2 z-10"),children:Ie(mf,{size:15})});return wt("div",{className:Re("@container flex-1 min-h-0 flex",i&&"relative"),children:[wt("div",{className:"hidden @6xl:flex flex-1 gap-4 p-4 bg-[#f5f4f1] items-start overflow-y-auto",children:[Ie("div",{className:"flex-1 sticky top-4 flex min-h-[200px] max-h-[calc(100svh-6rem)]",children:wt("div",{role:"button",tabIndex:0,onClick:m,onKeyDown:k,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:[S(!0),Ie("span",{className:"flex items-center justify-center w-11 h-11 rounded-full bg-[#f1efe9] text-[#8d93a0] group-hover:text-[#1d2025] transition-colors",children:Ie(Rc,{size:20})}),Ie("span",{className:"text-sm font-bold text-[#565b66]",children:d("annexEmptyTitle")}),Ie("span",{className:"text-xs text-[#8d93a0] max-w-[32ch] leading-relaxed",children:d("annexEmptyBody")}),y(!1)]})}),Ie("div",{className:"w-px bg-[#e7e5e0] flex-shrink-0 self-stretch my-1 rounded-full"}),Ie("div",{className:"flex-1 bg-white rounded-[14px] border border-[#e7e5e0] shadow-sm",children:wt("div",{className:"px-6 py-5 flex flex-col gap-4",children:[p,u]})})]}),Ie("div",{className:"@6xl:hidden flex-1 overflow-y-auto",children:wt("div",{className:"mx-auto px-5 py-5 flex flex-col gap-4",style:{maxWidth:l},children:[wt("div",{role:"button",tabIndex:0,onClick:m,onKeyDown:k,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:[Ie("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:Ie(Rc,{size:16})}),wt("div",{className:"flex-1 min-w-0",children:[Ie("div",{className:"text-xs font-bold text-[#565b66]",children:d("annexEmptyTitle")}),Ie("div",{className:"text-[11px] text-[#8d93a0] leading-snug",children:d("annexEmptyBody")})]}),y(!0),S(!1)]}),p,u]})})]})}function ro(e){let t=new Map;for(let r of e){let n=new Map;for(let o of r.questions){let a=new Map;for(let s of o.nodeResults){let i={state:s.status,showFeedback:!0,score:s.score,...s.feedback!==void 0?{message:s.feedback}:{},...s.displayAnswer!==void 0?{displayAnswer:s.displayAnswer}:{},...s.teacherFeedback!==void 0?{teacherFeedback:s.teacherFeedback}:{}};s.detail?.type==="choiceSet"?i.correctChoiceIds=s.detail.correctChoiceIds:s.detail?.type==="matchingSet"?(i.pairFeedback=s.detail.pairFeedback,i.correctPairings=s.detail.correctPairings):s.detail?.type==="aiAnswer"&&(i.lines=s.detail.lines,s.detail.next&&(i.next=s.detail.next)),a.set(s.nodeId,i)}n.set(o.questionId,a)}t.set(r.exerciseId,n)}return t}import{Lightbulb as ff}from"lucide-react";import{jsx as ja,jsxs as Ac}from"react/jsx-runtime";function hf(e){return e.length===0||e.some(t=>t.status==="awaiting_review")?null:e.every(t=>t.status==="correct")?"correct":e.some(t=>t.status==="partial"||t.status==="correct"||(t.score??0)>0)?"partial":"incorrect"}function Nc({content:e,nodeResults:t,label:r}){let n=hf(t);return Ac("div",{className:`player-ai-feedback mt-3 mb-3${n?` player-ai-feedback--${n}`:""}`,children:[Ac("p",{className:"flex items-center gap-1.5 text-xs font-semibold",children:[ja(ff,{size:14,"aria-hidden":!0}),r]}),ja("div",{className:"text-[#1d2025]",children:ja(hr,{content:e})})]})}import{useState as _c}from"react";import{jsx as Yt,jsxs as Tc}from"react/jsx-runtime";function Pc({questionId:e,onReport:t,t:r}){let[n,o]=_c("closed"),[a,s]=_c("");if(n==="sent")return Yt("p",{role:"status",className:"mt-2 text-sm text-[#5b6170]",children:r("reportGradeSent")});if(n==="closed")return Yt("button",{type:"button",onClick:()=>o("open"),className:"mt-2 text-sm text-[#5b6170] underline underline-offset-2 hover:text-[#1d2025]",children:r("reportGrade")});let i=async()=>{if(a.trim()){o("sending");try{await t(e,a.trim()),o("sent")}catch{o("failed")}}};return Tc("div",{className:"mt-2 rounded-lg border border-[#e7e5e0] bg-[#fbfaf7] p-3",children:[Yt("label",{className:"mb-1.5 block text-sm font-medium text-[#1d2025]",htmlFor:`report-${e}`,children:r("reportGradePrompt")}),Yt("textarea",{id:`report-${e}`,value:a,onChange:c=>s(c.target.value.slice(0,1e3)),rows:3,dir:"auto",className:"w-full rounded-md border border-[#d6d3cc] bg-white p-2 text-sm text-[#1d2025] outline-none focus:border-[#1d2025]"}),n==="failed"&&Yt("p",{role:"alert",className:"mt-1 text-sm text-[#a32b1e]",children:r("reportGradeFailed")}),Tc("div",{className:"mt-2 flex gap-2",children:[Yt("button",{type:"button",onClick:i,disabled:!a.trim()||n==="sending",className:"rounded-md bg-[#1d2025] px-3 py-1.5 text-sm font-medium text-white disabled:opacity-40",children:r("reportGradeSend")}),Yt("button",{type:"button",onClick:()=>o("closed"),className:"rounded-md border border-[#d6d3cc] px-3 py-1.5 text-sm text-[#1d2025]",children:r("reportGradeCancel")})]})]})}import{jsx as kt,jsxs as qa}from"react/jsx-runtime";function Mc({t:e,rtl:t,showClose:r,onContinue:n,continueLabel:o,primaryColor:a}){return qa("div",{role:"status",className:"edp-thanks flex-1 flex items-center justify-center px-6 py-16",children:[kt("style",{children:gf}),qa("div",{className:"flex flex-col items-center text-center",style:{maxWidth:"26rem"},children:[qa("div",{className:"relative",style:{width:120,height:120},"aria-hidden":!0,children:[kt("svg",{className:"edp-thanks-blob absolute inset-0 overflow-visible",viewBox:"0 0 200 200",width:"120",height:"120",children:kt("path",{d:"M104 14c44 2 80 34 82 80s-34 94-86 92S12 150 16 98 58 12 104 14z",fill:"#ffd64a"})}),kt("svg",{className:"absolute inset-0 overflow-visible",viewBox:"0 0 100 100",width:"120",height:"120",children:kt("path",{className:"edp-thanks-check",d:"M26 54l17 17 33-39",fill:"none",stroke:"#1d2025",strokeWidth:9,strokeLinecap:"round",strokeLinejoin:"round",pathLength:1})})]}),kt("h2",{className:"edp-thanks-stamp mt-4 text-[#1d2025]",style:t?{fontSize:36,fontWeight:700,lineHeight:1.3,transform:"rotate(-3deg)"}:{fontFamily:'var(--font-hand, "Caveat", cursive)',fontSize:56,fontWeight:600,lineHeight:1,transform:"rotate(-4deg)"},children:e("formThanks")}),kt("p",{className:"edp-thanks-rise mt-4 text-base text-[#565b66]",style:{animationDelay:"750ms"},children:e("formThanksDesc")}),r&&!n&&kt("p",{className:"edp-thanks-rise mt-1 text-sm text-[#8a8f99]",style:{animationDelay:"850ms"},children:e("formThanksClose")}),n&&kt("button",{onClick:n,style:{animationDelay:"850ms",...a?{backgroundColor:a}:{}},className:"edp-thanks-rise mt-6 px-4 py-2 bg-[#1d2025] text-white text-sm font-semibold rounded-lg hover:bg-[#31353c] transition-colors",children:o??e("continue")})]})]})}var gf=`
|
|
69
69
|
@keyframes edp-thanks-blob-in { from { transform: scale(0) rotate(-25deg); } }
|
|
70
70
|
@keyframes edp-thanks-draw { to { stroke-dashoffset: 0; } }
|
|
71
71
|
@keyframes edp-thanks-stamp-in { from { opacity: 0; transform: scale(1.8) rotate(-4deg); } }
|
|
@@ -78,7 +78,7 @@ sys.stdin = io.StringIO(${JSON.stringify(s)})
|
|
|
78
78
|
.edp-thanks * { animation: none !important; }
|
|
79
79
|
.edp-thanks .edp-thanks-check { stroke-dashoffset: 0; }
|
|
80
80
|
}
|
|
81
|
-
`;var em=new Set(["choiceSet","inlineChoiceSet","blank","aiAnswerInput","matchingSet","openResponseNode","mathResponse","codingResponse"]),tm=new Set(["blankPool","inlinePool"]);function rm(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 t=e.answer;return t.recording||t.files&&t.files.length>0?!0:(t.text?.wordCount??0)>0}case"mathResponse":return e.answer.latex.trim().length>0;case"codingResponse":return e.answer.source.trim().length>0;default:{let t=e;return!0}}}function nm(e){let t=0,r=n=>{if(Array.isArray(n)){for(let s of n)r(s);return}if(!n||typeof n!="object")return;let{type:o,content:a}=n;if(typeof o=="string"){if(em.has(o)){t+=1;return}if(tm.has(o))return}a!==void 0&&r(a)};return r(e),t}function ua(e,t){let r=new Map;for(let o of t?.exerciseAnswers??[])for(let a of o.questionAnswers){let s=r.get(a.questionId);s||(s=new Set,r.set(a.questionId,s));for(let i of a.answers)rm(i)&&s.add(i.nodeId)}let n=[];return e.exercises.forEach((o,a)=>{o.questions.forEach((s,i)=>{let c=nm(s.content);c!==0&&(r.get(s.id)?.size??0)<c&&n.push({questionId:s.id,exerciseIndex:a,...o.title?{exerciseTitle:o.title}:{},questionIndex:i,only:o.questions.length===1})})}),n}function ma(e,t,r){let n=new Set(r);return n.size===0?[]:ua(e,t).filter(o=>n.has(o.questionId))}function ha(e){let t=new Map;for(let r of e?.exerciseAnswers??[])for(let n of r.questionAnswers)t.set(n.questionId,n.answers);return t}function Gi(e){let t=new Set,r=n=>{if(Array.isArray(n)){for(let c of n)r(c);return}if(!n||typeof n!="object")return;let{type:o,id:a,attrs:s,content:i}=n;if(o==="openResponseNode"){let{mode:c,allowFormatting:l}=s??{};typeof a=="string"&&(c==="text"||c==="text+file")&&!l&&t.add(a);return}i!==void 0&&r(i)};for(let n of e.exercises)for(let o of n.questions)r(o.content);return t}function fa(e){if(Array.isArray(e))return e.some(fa);if(!e||typeof e!="object")return!1;let{text:t,content:r}=e;return typeof t=="string"||r!==void 0&&fa(r)}function Vi(e,t){if(e.type!=="openResponse"||!t.has(e.nodeId))return!1;let r=e.answer.text;return r!==void 0&&!fa(r.content)}function Yi(e,t,r){return t.size===0?e:{...e,exerciseAnswers:e.exerciseAnswers.map(n=>({...n,questionAnswers:n.questionAnswers.map(o=>{let a=t.get(o.questionId);return a?o.answers.length===0?{...o,answers:a}:o.answers.some(s=>Vi(s,r))?{...o,answers:o.answers.map(s=>{let i=s;if(i.type!=="openResponse"||!Vi(i,r))return s;let c=a.find(p=>p.nodeId===i.nodeId&&p.type==="openResponse"),l=c?.type==="openResponse"?c.answer.text:void 0;return l?{...i,answer:{...i.answer,text:l}}:s})}:o:o})}))}}var om={exercise:"Exercise {index}",question:"Question {index}",points:"pts","points.one":"pt",submit:"Submit Assessment",submitting:"Submitting...",confirmTitle:"Submit Assessment",confirmDescription:"Are you sure you want to submit? You cannot change your answers after submitting.",unansweredOne:"1 question is not fully answered.",unansweredMany:"{count} questions are not fully answered.",unansweredMore:"and {count} more",confirmSubmit:"Submit",confirmCancel:"Cancel",assessmentPassed:"Assessment passed",assessmentNotPassed:"Assessment not passed",awaitingReview:"Awaiting review",awaitingReviewDesc:"Your teacher is reviewing your open responses. Your final score will be available once grading is complete.",submittedNoScore:"Your answers are in",submittedNoScoreDesc:"No score on this one: see below what you got right and what to look at again.",formThanks:"Thank you!",formThanksDesc:"Your answers have been sent.",formThanksClose:"You can close this page.",formSubmit:"Send",formSending:"Sending\u2026",formConfirmTitle:"Send your answers?",formConfirmDescription:"You won't be able to change them after sending.",required:"Required",requiredMissing:"This question is required",requiredBlocked:"A required question is unanswered: answer it, then send again.",continue:"Continue",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",explanation:"Explanation",reportGrade:"Report a marking mistake",reportGradePrompt:"What do you think is wrong with this mark?",reportGradeSend:"Send to my teacher",reportGradeCancel:"Cancel",reportGradeSent:"Sent to your teacher.",reportGradeFailed:"It could not be sent. Try again.",poweredBy:"Powered by Edpire",evaluating:"Evaluating your answers\u2026",aiEvaluating:"Some answers are being reviewed by AI, 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"},am={exercise:"Exercice {index}",question:"Question {index}",points:"pts","points.one":"pt",submit:"Soumettre l'\xE9valuation",submitting:"Soumission...",confirmTitle:"Soumettre l'\xE9valuation",confirmDescription:"\xCAtes-vous s\xFBr de vouloir soumettre ? Vous ne pourrez pas modifier vos r\xE9ponses.",unansweredOne:"1 question n'est pas enti\xE8rement remplie.",unansweredMany:"{count} questions ne sont pas enti\xE8rement remplies.",unansweredMore:"et {count} autres",confirmSubmit:"Soumettre",confirmCancel:"Annuler",assessmentPassed:"\xC9valuation r\xE9ussie",assessmentNotPassed:"\xC9valuation non r\xE9ussie",awaitingReview:"En attente de correction",awaitingReviewDesc:"Votre professeur examine vos r\xE9ponses ouvertes. Votre note finale sera disponible une fois la correction termin\xE9e.",submittedNoScore:"Vos r\xE9ponses sont envoy\xE9es",submittedNoScoreDesc:"Pas de note pour celle-ci : voyez ci-dessous ce qui est juste et ce qu'il faut revoir.",formThanks:"Merci !",formThanksDesc:"Vos r\xE9ponses ont bien \xE9t\xE9 envoy\xE9es.",formThanksClose:"Vous pouvez fermer cette page.",formSubmit:"Envoyer",formSending:"Envoi\u2026",formConfirmTitle:"Envoyer vos r\xE9ponses ?",formConfirmDescription:"Vous ne pourrez plus les modifier ensuite.",required:"Obligatoire",requiredMissing:"R\xE9ponse obligatoire",requiredBlocked:"Une question obligatoire est sans r\xE9ponse : r\xE9pondez-y, puis envoyez \xE0 nouveau.",continue:"Continuer",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",explanation:"Explication",reportGrade:"Signaler une erreur de correction",reportGradePrompt:"Qu'est-ce qui vous semble faux dans cette note ?",reportGradeSend:"Envoyer \xE0 mon enseignant",reportGradeCancel:"Annuler",reportGradeSent:"Envoy\xE9 \xE0 votre enseignant.",reportGradeFailed:"L'envoi a \xE9chou\xE9. R\xE9essayez.",poweredBy:"Propuls\xE9 par Edpire",evaluating:"\xC9valuation de vos r\xE9ponses\u2026",aiEvaluating:"Certaines r\xE9ponses sont examin\xE9es par l'IA, 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"},sm={exercise:"\u062A\u0645\u0631\u064A\u0646 {index}",question:"\u0633\u0624\u0627\u0644 {index}",points:"\u0646\u0642\u0637\u0629","points.two":"\u0646\u0642\u0637\u062A\u0627\u0646","points.few":"\u0646\u0642\u0627\u0637",submit:"\u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u062A\u0642\u064A\u064A\u0645",submitting:"\u062C\u0627\u0631\u064D \u0627\u0644\u0625\u0631\u0633\u0627\u0644...",confirmTitle:"\u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u062A\u0642\u064A\u064A\u0645",confirmDescription:"\u0647\u0644 \u0623\u0646\u062A \u0645\u062A\u0623\u0643\u062F \u0645\u0646 \u0627\u0644\u0625\u0631\u0633\u0627\u0644\u061F \u0644\u0646 \u062A\u062A\u0645\u0643\u0646 \u0645\u0646 \u062A\u063A\u064A\u064A\u0631 \u0625\u062C\u0627\u0628\u0627\u062A\u0643 \u0628\u0639\u062F \u0627\u0644\u0625\u0631\u0633\u0627\u0644.",unansweredOne:"\u0644\u0645 \u062A\u064F\u0643\u0645\u0644 \u0627\u0644\u0625\u062C\u0627\u0628\u0629 \u0639\u0646 \u0633\u0624\u0627\u0644 \u0648\u0627\u062D\u062F.",unansweredMany:"\u0644\u0645 \u062A\u064F\u0643\u0645\u0644 \u0627\u0644\u0625\u062C\u0627\u0628\u0629 \u0639\u0646 {count} \u0645\u0646 \u0627\u0644\u0623\u0633\u0626\u0644\u0629.",unansweredMore:"\u0648{count} \u0623\u062E\u0631\u0649",confirmSubmit:"\u0625\u0631\u0633\u0627\u0644",confirmCancel:"\u0625\u0644\u063A\u0627\u0621",assessmentPassed:"\u0627\u062C\u062A\u064A\u0627\u0632 \u0627\u0644\u062A\u0642\u064A\u064A\u0645",assessmentNotPassed:"\u0644\u0645 \u064A\u062A\u0645 \u0627\u062C\u062A\u064A\u0627\u0632 \u0627\u0644\u062A\u0642\u064A\u064A\u0645",awaitingReview:"\u0641\u064A \u0627\u0646\u062A\u0638\u0627\u0631 \u0627\u0644\u062A\u0635\u062D\u064A\u062D",awaitingReviewDesc:"\u064A\u0642\u0648\u0645 \u0645\u0639\u0644\u0645\u0643 \u0628\u0645\u0631\u0627\u062C\u0639\u0629 \u0625\u062C\u0627\u0628\u0627\u062A\u0643 \u0627\u0644\u0645\u0641\u062A\u0648\u062D\u0629. \u0633\u062A\u0638\u0647\u0631 \u0639\u0644\u0627\u0645\u062A\u0643 \u0627\u0644\u0646\u0647\u0627\u0626\u064A\u0629 \u0628\u0639\u062F \u0627\u0643\u062A\u0645\u0627\u0644 \u0627\u0644\u062A\u0635\u062D\u064A\u062D.",submittedNoScore:"\u062A\u0645 \u0625\u0631\u0633\u0627\u0644 \u0625\u062C\u0627\u0628\u0627\u062A\u0643",submittedNoScoreDesc:"\u0644\u0627 \u0639\u0644\u0627\u0645\u0629 \u0644\u0647\u0630\u0627 \u0627\u0644\u062A\u0642\u064A\u064A\u0645: \u0627\u0646\u0638\u0631 \u0623\u062F\u0646\u0627\u0647 \u0645\u0627 \u0623\u062C\u0628\u062A \u0639\u0646\u0647 \u0628\u0634\u0643\u0644 \u0635\u062D\u064A\u062D \u0648\u0645\u0627 \u064A\u062C\u0628 \u0645\u0631\u0627\u062C\u0639\u062A\u0647.",formThanks:"\u0634\u0643\u0631\u064B\u0627 \u0644\u0643!",formThanksDesc:"\u062A\u0645 \u0625\u0631\u0633\u0627\u0644 \u0625\u062C\u0627\u0628\u0627\u062A\u0643.",formThanksClose:"\u064A\u0645\u0643\u0646\u0643 \u0625\u063A\u0644\u0627\u0642 \u0647\u0630\u0647 \u0627\u0644\u0635\u0641\u062D\u0629.",formSubmit:"\u0625\u0631\u0633\u0627\u0644",formSending:"\u062C\u0627\u0631\u064D \u0627\u0644\u0625\u0631\u0633\u0627\u0644\u2026",formConfirmTitle:"\u0625\u0631\u0633\u0627\u0644 \u0625\u062C\u0627\u0628\u0627\u062A\u0643\u061F",formConfirmDescription:"\u0644\u0646 \u062A\u062A\u0645\u0643\u0646 \u0645\u0646 \u062A\u0639\u062F\u064A\u0644\u0647\u0627 \u0628\u0639\u062F \u0627\u0644\u0625\u0631\u0633\u0627\u0644.",required:"\u0645\u0637\u0644\u0648\u0628",requiredMissing:"\u0647\u0630\u0627 \u0633\u0624\u0627\u0644 \u0645\u0637\u0644\u0648\u0628",requiredBlocked:"\u0633\u0624\u0627\u0644 \u0645\u0637\u0644\u0648\u0628 \u0628\u0644\u0627 \u0625\u062C\u0627\u0628\u0629: \u0623\u062C\u0628 \u0639\u0646\u0647 \u062B\u0645 \u0623\u0631\u0633\u0644 \u0645\u0646 \u062C\u062F\u064A\u062F.",continue:"\u0645\u062A\u0627\u0628\u0639\u0629",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",explanation:"\u0634\u0631\u062D",reportGrade:"\u0627\u0644\u0625\u0628\u0644\u0627\u063A \u0639\u0646 \u062E\u0637\u0623 \u0641\u064A \u0627\u0644\u062A\u0635\u062D\u064A\u062D",reportGradePrompt:"\u0645\u0627 \u0627\u0644\u0630\u064A \u062A\u0631\u0627\u0647 \u062E\u0627\u0637\u0626\u064B\u0627 \u0641\u064A \u0647\u0630\u0627 \u0627\u0644\u0639\u062F\u062F\u061F",reportGradeSend:"\u0625\u0631\u0633\u0627\u0644 \u0625\u0644\u0649 \u0623\u0633\u062A\u0627\u0630\u064A",reportGradeCancel:"\u0625\u0644\u063A\u0627\u0621",reportGradeSent:"\u0623\u064F\u0631\u0633\u0644 \u0625\u0644\u0649 \u0623\u0633\u062A\u0627\u0630\u0643.",reportGradeFailed:"\u062A\u0639\u0630\u0651\u0631 \u0627\u0644\u0625\u0631\u0633\u0627\u0644. \u0623\u0639\u062F \u0627\u0644\u0645\u062D\u0627\u0648\u0644\u0629.",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\u060C \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"},nr={en:om,fr:am,ar:sm};function im(e,t,r){let o=(nr[e]??nr.en)[t]??nr.en[t]??t;return r?Object.entries(r).reduce((a,[s,i])=>a.replace(`{${s}}`,String(i)),o):o}function Qi(e,t){let r=new Intl.PluralRules(e).select(t),n=nr[e]??nr.en;return n[`points.${r}`]??n.points??nr.en.points}function Xi(e){return(t,r)=>im(e,t,r)}function ga(e){return e==="ar"}var Ji="48rem";function jt(e,{insertAt:t}={}){if(!e||typeof document>"u")return;let r=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t==="top"&&r.firstChild?r.insertBefore(n,r.firstChild):r.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}jt(`: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-blank-cell{display:flex;flex-wrap:wrap;align-items:center;gap:calc(.125rem * var(--edp-scale, 1)) calc(.25rem * var(--edp-scale, 1));width:100%}.player-blank-cell__box{position:relative;display:block;flex:1 1 100%;min-width:0}.player-typed-blank--cell{display:block;box-sizing:border-box;width:100%;min-width:6.5ch;padding:calc(1px * var(--edp-scale, 1)) calc(2px * var(--edp-scale, 1));font:inherit;font-weight:600;line-height:1.3;white-space:nowrap;overflow-x:hidden}.player-typed-blank-feedback--cell{display:block;box-sizing:border-box;width:max-content;min-width:100%;max-width:none;white-space:nowrap;overflow:visible}.player-blank-cell .player-blank-reveal{white-space:nowrap;font-size:.9em}.edp-table-arrows{display:flex;justify-content:flex-end}.edp-table-arrows--top{margin-bottom:calc(.375rem * var(--edp-scale, 1))}.edp-table-arrows--bottom{margin-top:calc(.375rem * var(--edp-scale, 1))}.edp-table-arrows__pair{display:inline-flex;gap:calc(.375rem * var(--edp-scale, 1))}.edp-table-arrow{display:inline-flex;align-items:center;justify-content:center;width:calc(1.875rem * var(--edp-scale, 1));height:calc(1.875rem * var(--edp-scale, 1));padding:0;border:1px solid var(--line-strong, #d6d3cc);border-radius:999px;background:var(--card, #ffffff);color:var(--ink, #1d2025);cursor:pointer;transition:border-color .15s,background .15s,opacity .15s;-webkit-tap-highlight-color:transparent}.edp-table-arrow:hover:not(:disabled){border-color:var(--ink, #1d2025);background:var(--ui-muted, #f5f4f1)}.edp-table-arrow:focus-visible{outline:2px solid var(--ink, #1d2025);outline-offset:2px}.edp-table-arrow:disabled{opacity:.35;cursor:default}.edp-table-shade{position:absolute;top:0;bottom:0;width:calc(1.5rem * var(--edp-scale, 1));pointer-events:none;z-index:2}.edp-table-shade--left{background:linear-gradient(to right,#1d202529,#1d202500)}.edp-table-shade--right{background:linear-gradient(to left,#1d202529,#1d202500)}@media(max-width:640px){.edp-table-first{max-width:38vw}}.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;-webkit-touch-callout: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}.player-bank-pill--hinted{position:relative}.player-tap-hint{position:absolute;left:calc(50% - 10px * var(--edp-scale, 1));top:50%;width:calc(30px * var(--edp-scale, 1));height:calc(30px * var(--edp-scale, 1));z-index:2;pointer-events:none;color:var(--ink, #1d2025)}.player-tap-hint__hand{display:block;width:100%;height:100%;opacity:.92;filter:drop-shadow(0 2px 3px rgba(29,32,37,.25));transform-origin:33% 8%;animation:edp-tap-hand 1.8s ease-in-out infinite}.player-tap-hint__ripple{position:absolute;left:calc(10px * var(--edp-scale, 1) - 11px);top:-11px;width:22px;height:22px;border-radius:999px;border:2px solid var(--ink, #1d2025);opacity:0;animation:edp-tap-ripple 1.8s ease-out infinite}@keyframes edp-tap-hand{0%,to{transform:translateY(12px)}30%{transform:translateY(0) scale(1)}38%{transform:translateY(1px) scale(.88)}48%{transform:translateY(0) scale(1)}75%{transform:translateY(12px)}}@keyframes edp-tap-ripple{0%,34%{opacity:0;transform:scale(.4)}40%{opacity:.45;transform:scale(.6)}70%{opacity:0;transform:scale(1.5)}to{opacity:0}}.player-tap-hint--still .player-tap-hint__hand,.player-tap-hint--still .player-tap-hint__ripple{animation:none}@media(prefers-reduced-motion:reduce){.player-tap-hint__hand,.player-tap-hint__ripple{animation:none}}.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)}.edp-audio{--edp-a: var(--edp-scale, 1);display:flex;flex-direction:column;gap:calc(.25rem * var(--edp-a));width:100%;max-width:100%;margin:calc(.5rem * var(--edp-a)) 0;font-size:calc(.875rem * var(--edp-a));line-height:1.4;vertical-align:middle}.edp-audio-bar{display:flex;align-items:center;gap:calc(.75rem * var(--edp-a));min-width:0;padding:calc(.375rem * var(--edp-a));padding-inline-end:calc(.75rem * var(--edp-a));background:#fff;border:1px solid var(--line, #e7e5e0);border-radius:999px}.edp-audio-play{flex:none;display:inline-flex;align-items:center;justify-content:center;width:calc(2.75rem * var(--edp-a));height:calc(2.75rem * var(--edp-a));border:0;border-radius:999px;background:var(--ink, #1d2025);color:#fff;cursor:pointer;transition:transform 90ms ease-out,background-color .18s ease-out}.edp-audio-play:hover:not(:disabled){background:#33373e}.edp-audio-play:active:not(:disabled){transform:scale(.94)}.edp-audio-play:focus-visible,.edp-audio-speed:focus-visible,.edp-audio-track:focus-visible{outline:2px solid var(--ink, #1d2025);outline-offset:2px}.edp-audio-play:disabled{background:var(--line-strong, #d6d3cc);cursor:not-allowed}.edp-audio-play svg{width:calc(1.125rem * var(--edp-a));height:calc(1.125rem * var(--edp-a))}.edp-audio-track{position:relative;flex:1 1 auto;min-width:calc(3rem * var(--edp-a));height:calc(2rem * var(--edp-a));display:flex;align-items:center;touch-action:none;border-radius:4px}.edp-audio-track--seek{cursor:pointer}.edp-audio-rail{position:relative;display:block;width:100%;height:4px;border-radius:999px;background:var(--line, #e7e5e0);overflow:hidden}.edp-audio-fill{position:absolute;inset-block:0;inset-inline-start:0;background:var(--ink, #1d2025);border-radius:999px}.edp-audio-thumb{position:absolute;top:50%;width:12px;height:12px;margin-inline-start:-6px;margin-top:-6px;border-radius:999px;background:var(--ink, #1d2025);box-shadow:0 0 0 3px #fff;transition:transform .15s ease-out;pointer-events:none}.edp-audio-track--seek:hover .edp-audio-thumb,.edp-audio-track--seek:focus-visible .edp-audio-thumb{transform:scale(1.25)}.edp-audio-time{flex:none;min-width:2.6em;text-align:end;font-variant-numeric:tabular-nums;color:var(--ink-soft, #565b66);unicode-bidi:isolate}.edp-audio-speed{flex:none;min-width:3.1em;height:calc(1.75rem * var(--edp-a));padding:0 .5em;border:1px solid var(--line-strong, #d6d3cc);border-radius:999px;background:var(--ui-muted, #f5f4f1);color:var(--ink, #1d2025);font:inherit;font-size:.85em;font-weight:600;font-variant-numeric:tabular-nums;cursor:pointer;transition:border-color .18s ease-out}.edp-audio-speed:hover:not(:disabled){border-color:var(--ink-faint, #8d93a0)}.edp-audio-speed:active:not(:disabled){transform:scale(.97)}.edp-audio-note{display:block;margin:0;padding-inline-start:calc(.75rem * var(--edp-a));font-size:.9em;color:var(--ink-soft, #565b66)}.edp-audio--off .edp-audio-bar{background:var(--ui-muted, #f5f4f1)}.edp-audio--off .edp-audio-fill{background:var(--ink-faint, #8d93a0)}@media(max-width:380px){.edp-audio-bar{gap:calc(.5rem * var(--edp-a))}}@media(pointer:coarse){.edp-audio-speed{height:calc(2.5rem * var(--edp-a));min-width:3.6em}}.edp-rec{--edp-a: var(--edp-scale, 1);display:flex;flex-direction:column;gap:calc(.75rem * var(--edp-a));padding:calc(1rem * var(--edp-a));border:1px solid var(--line, #e7e5e0);border-radius:14px;background:#fff;font-size:calc(.9375rem * var(--edp-a));line-height:1.4}.edp-rec .edp-audio{margin:0}.edp-rec-idle{display:flex;flex-direction:column;align-items:center;gap:calc(.5rem * var(--edp-a));padding:calc(.5rem * var(--edp-a)) 0}.edp-rec-record{display:inline-flex;align-items:center;justify-content:center;width:calc(4rem * var(--edp-a));height:calc(4rem * var(--edp-a));border:0;border-radius:999px;background:var(--pen, #d23b2b);color:#fff;cursor:pointer;box-shadow:0 0 0 5px var(--pen-soft, #fdeeec);transition:transform 90ms ease-out,box-shadow .18s ease-out}.edp-rec-record:hover:not(:disabled){box-shadow:0 0 0 7px var(--pen-soft, #fdeeec)}.edp-rec-record:active:not(:disabled){transform:scale(.95)}.edp-rec-record:disabled{background:var(--line-strong, #d6d3cc);box-shadow:none;cursor:not-allowed}.edp-rec-record svg{width:calc(1.6rem * var(--edp-a));height:calc(1.6rem * var(--edp-a))}.edp-rec-record:focus-visible,.edp-rec-stop:focus-visible,.edp-rec-link:focus-visible{outline:2px solid var(--ink, #1d2025);outline-offset:3px}.edp-rec-label{font-weight:600;color:var(--ink, #1d2025)}.edp-rec-limit{font-size:.9em;color:var(--ink-soft, #565b66);font-variant-numeric:tabular-nums}.edp-rec-live{display:flex;align-items:center;gap:calc(.75rem * var(--edp-a))}.edp-rec-level{flex:1 1 auto;min-width:0;width:100%;height:calc(2.5rem * var(--edp-a));display:block}.edp-rec-clock{flex:none;display:inline-flex;align-items:center;gap:.4em;font-variant-numeric:tabular-nums;color:var(--ink, #1d2025);unicode-bidi:isolate}.edp-rec-clock small{color:var(--ink-faint, #8d93a0);font-size:.9em}.edp-rec-dot{width:.6em;height:.6em;border-radius:999px;background:var(--pen, #d23b2b);animation:edp-rec-dot 1.2s ease-in-out infinite}@keyframes edp-rec-dot{50%{opacity:.35}}.edp-rec-stop{flex:none;display:inline-flex;align-items:center;gap:.45em;height:calc(2.5rem * var(--edp-a));padding:0 1em;border:1px solid var(--ink, #1d2025);border-radius:999px;background:var(--ink, #1d2025);color:#fff;font:inherit;font-weight:600;cursor:pointer}.edp-rec-stop{transition:background-color .18s ease-out,transform 90ms ease-out}.edp-rec-stop:hover{background:#33373e}.edp-rec-stop:active{transform:scale(.97)}.edp-rec-stop i{display:inline-block;width:.7em;height:.7em;border-radius:2px;background:currentColor}.edp-rec-foot{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:calc(.5rem * var(--edp-a)) calc(1rem * var(--edp-a));min-height:1.75em}.edp-rec-status{display:inline-flex;align-items:center;gap:.4em;color:var(--ink-soft, #565b66)}.edp-rec-status--ok{color:var(--ok, #1f8a4c);font-weight:600}.edp-rec-status--error{color:var(--ink, #1d2025)}.edp-rec-status--error svg{color:var(--ink, #1d2025);flex:none}.edp-rec-progress{flex:1 1 8rem;height:4px;border-radius:999px;background:var(--line, #e7e5e0);overflow:hidden}.edp-rec-progress>span{display:block;height:100%;background:var(--ink, #1d2025);transition:width .15s ease-out}.edp-rec-link{font:inherit;font-weight:600;color:var(--ink, #1d2025);background:none;border:0;padding:.25em 0;cursor:pointer;text-decoration:underline;text-underline-offset:3px}.edp-rec-link:hover{text-decoration-thickness:2px}@media(pointer:coarse){.edp-rec-link{min-height:2.5rem;padding:0 .25em}}.edp-rec-level:dir(rtl){transform:scaleX(-1)}.edp-rec-message{margin:0;color:var(--ink-soft, #565b66);text-align:center}.edp-rec video{width:100%;max-height:16rem;border-radius:10px;background:#000}@media(prefers-reduced-motion:reduce){.edp-rec-dot{animation:none}.edp-audio-play,.edp-audio-thumb,.edp-rec-record,.edp-rec-stop,.edp-rec-progress>span{transition:none}}.player-ai--sheet{padding:0;border:none;background:transparent}.edp-sheet-box{display:flex;flex-direction:column;overflow:hidden;border:1px solid var(--line-strong, #d6d3cc);border-radius:calc(.625rem * var(--edp-scale, 1));background:var(--card, #ffffff);color:var(--ink, #1d2025);transition:border-color .18s ease}.edp-sheet-box:focus-within{border-color:var(--ink, #1d2025)}.edp-sheet--readonly .edp-sheet-box{background:var(--paper, #fbfaf7)}.edp-sheet.player-ai-input--correct,.edp-sheet.player-ai-input--incorrect,.edp-sheet.player-ai-input--partial{border:none;background:transparent}.edp-sheet.player-ai-input--correct .edp-sheet-box{border-color:var(--ok, #1f8a4c);background:var(--ok-soft, #ecf8f0)}.edp-sheet.player-ai-input--incorrect .edp-sheet-box{border-color:var(--pen, #d23b2b);background:var(--pen-soft, #fdeeec)}.edp-sheet.player-ai-input--partial .edp-sheet-box{border-color:var(--almost, #c8810e);border-style:dashed;background:var(--almost-soft, #fbf1dc)}.edp-sheet-page{position:relative;padding:calc(.75rem * var(--edp-scale, 1)) calc(.875rem * var(--edp-scale, 1));min-height:calc(132px * var(--edp-scale, 1));font-size:calc(1rem * var(--edp-scale, 1));line-height:1.85}.edp-sheet-doc p.is-editor-empty:first-child:before{content:attr(data-placeholder);float:inline-start;height:0;color:var(--ink-faint, #8d93a0);pointer-events:none}.edp-sheet-doc{outline:none;min-height:calc(108px * var(--edp-scale, 1));white-space:pre-wrap;overflow-wrap:break-word}.edp-sheet-doc p{margin:0}.edp-sheet-doc ul,.edp-sheet-doc ol{margin:0;padding-inline-start:calc(1.25rem * var(--edp-scale, 1))}.edp-sheet-formula{display:inline;unicode-bidi:isolate}.edp-sheet-line{display:block;unicode-bidi:isolate;margin:calc(.125rem * var(--edp-scale, 1)) 0}.edp-sheet-mf{display:inline-block;min-width:1ch;padding:0 calc(.1875rem * var(--edp-scale, 1));margin:0;vertical-align:baseline;font-size:1.05em;color:inherit;border:none;border-radius:calc(.3125rem * var(--edp-scale, 1));background:transparent;outline:none;transition:background-color .18s ease;--caret-color: var(--ink, #1d2025);--selection-background-color: var(--line, #e8e5de);--contains-highlight-background-color: transparent;--smart-fence-color: var(--ink-faint, #8d93a0);--placeholder-color: var(--ink-faint, #8d93a0)}.edp-sheet-mf:focus-within{background:var(--paper-deep, #f4f1ea)}.edp-sheet-mf::part(container),.edp-sheet-mf::part(content){padding:0}.edp-sheet-mf::part(menu-toggle),.edp-sheet-mf::part(virtual-keyboard-toggle){display:none}.edp-sheet-formula .edp-sheet-static{display:inline}.edp-sheet-line .edp-sheet-static{display:block;max-width:100%;overflow-x:auto}.edp-sheet-line.edp-sheet-line--centred[dir]{text-align:center;margin:calc(.375rem * var(--edp-scale, 1)) 0}.edp-sheet-formula,.edp-sheet-line{position:relative}.edp-math-chip{position:absolute;z-index:2;inset-block-start:0;inset-inline-end:-.35em;translate:0 calc(-100% - 3px);display:none;gap:1px;padding:1px;font:600 .75rem/1 system-ui,sans-serif;background:var(--card, #ffffff);border:1px solid var(--line, #e8e5de);border-radius:999px;box-shadow:0 1px 2px #00000014;user-select:none}.edp-math-chip:after{content:"";position:absolute;inset-inline:0;inset-block-start:100%;height:5px}.edp-sheet-line-box{position:relative;display:inline-block;max-width:100%}.edp-sheet-formula:hover>.edp-math-chip,.edp-sheet-line:hover .edp-math-chip,.edp-sheet-formula:focus-within>.edp-math-chip,.edp-sheet-line:focus-within .edp-math-chip{display:inline-flex}.edp-math-chip-btn{display:inline-flex;align-items:center;justify-content:center;width:1.375rem;height:1.375rem;padding:0;font:inherit;color:var(--ink-soft, #5b6170);background:transparent;border:none;border-radius:999px;cursor:pointer;touch-action:manipulation}.edp-math-chip-btn:hover{color:var(--ink, #1d2025);background:var(--paper-deep, #f4f1ea)}.edp-math-chip-btn:focus-visible{outline:2px solid var(--pen, #d23b2b);outline-offset:1px}.edp-math-chip-btn[aria-pressed=true]{color:var(--pen, #d23b2b)}@media(pointer:coarse){.edp-math-chip-btn{width:1.75rem;height:1.75rem}}.edp-sheet-keys{display:flex;flex-wrap:wrap;align-items:center;gap:calc(.25rem * var(--edp-scale, 1));padding:calc(.375rem * var(--edp-scale, 1)) calc(.5rem * var(--edp-scale, 1));border-top:1px solid var(--line, #e8e5de);background:var(--paper, #fbfaf7)}.edp-sheet-key{display:inline-flex;align-items:center;justify-content:center;gap:calc(.3125rem * var(--edp-scale, 1));min-width:calc(2.25rem * var(--edp-scale, 1));height:calc(2.25rem * var(--edp-scale, 1));padding:0 calc(.5rem * var(--edp-scale, 1));font-family:KaTeX_Main,Times New Roman,serif;font-size:calc(1.0625rem * var(--edp-scale, 1));line-height:1;color:var(--ink, #1d2025);background:var(--card, #ffffff);border:1px solid var(--line, #e8e5de);border-radius:calc(.5rem * var(--edp-scale, 1));cursor:pointer;touch-action:manipulation;transition:background-color .18s ease,border-color .18s ease}.edp-sheet-key:hover,.edp-sheet-key.is-active{background:var(--paper-deep, #f4f1ea);border-color:var(--line-strong, #d6d3cc)}.edp-sheet-key:active{background:var(--line, #e8e5de)}.edp-sheet-key:focus-visible{outline:2px solid var(--ink, #1d2025);outline-offset:2px}.edp-key-pow sup{margin-inline-start:.05em;font-size:.62em;line-height:0}.edp-key-frac{display:inline-flex;flex-direction:column;align-items:center;font-size:.72em;line-height:1.1}.edp-key-frac>span:first-child{padding:0 .15em;border-bottom:1px solid currentColor}.edp-sheet-key--more,.edp-sheet-key--tool{font-family:inherit;font-size:calc(.8125rem * var(--edp-scale, 1));font-weight:500}.edp-sheet-keys-extra{display:inline-flex;flex-wrap:wrap;gap:calc(.25rem * var(--edp-scale, 1));margin-inline-start:auto}.edp-sheet-notice{margin:0 0 calc(.5rem * var(--edp-scale, 1));padding:calc(.5rem * var(--edp-scale, 1)) calc(.75rem * var(--edp-scale, 1));font-size:calc(.875rem * var(--edp-scale, 1));color:var(--ink, #1d2025);background:var(--almost-soft, #fbf1dc);border-radius:calc(.5rem * var(--edp-scale, 1))}.edp-sheet-photos{display:flex;flex-wrap:wrap;align-items:center;gap:calc(.5rem * var(--edp-scale, 1));padding:calc(.5rem * var(--edp-scale, 1)) 0 0}.edp-sheet-photos-label{font-size:calc(.8125rem * var(--edp-scale, 1));color:var(--ink-soft, #5b6170)}.edp-sheet-photo{position:relative;display:inline-block}.edp-sheet-photo img{display:block;width:calc(4rem * var(--edp-scale, 1));height:calc(4rem * var(--edp-scale, 1));object-fit:cover;border-radius:calc(.375rem * var(--edp-scale, 1));border:1px solid var(--line, #e8e5de)}.edp-sheet-photo-remove{position:absolute;top:calc(-.5rem * var(--edp-scale, 1));inset-inline-end:calc(-.5rem * var(--edp-scale, 1));width:calc(1.5rem * var(--edp-scale, 1));height:calc(1.5rem * var(--edp-scale, 1));border-radius:999px;border:1px solid var(--line-strong, #d6d3cc);background:var(--card, #ffffff);color:var(--ink, #1d2025);cursor:pointer;line-height:1}.edp-sheet-panel{margin:calc(.5rem * var(--edp-scale, 1)) 0 0;padding:calc(.75rem * var(--edp-scale, 1));border:1px solid var(--line, #e8e5de);border-radius:calc(.625rem * var(--edp-scale, 1));background:var(--paper, #fbfaf7)}.edp-sheet-panel-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:calc(.5rem * var(--edp-scale, 1));font-size:calc(.9375rem * var(--edp-scale, 1))}.edp-sheet-panel-close{width:calc(2.25rem * var(--edp-scale, 1));height:calc(2.25rem * var(--edp-scale, 1));border:none;border-radius:calc(.5rem * var(--edp-scale, 1));background:transparent;font-size:calc(1.25rem * var(--edp-scale, 1));color:var(--ink-soft, #5b6170);cursor:pointer}.edp-sheet-panel-actions{display:flex;flex-wrap:wrap;gap:calc(.5rem * var(--edp-scale, 1))}.edp-sheet-btn{min-height:calc(2.5rem * var(--edp-scale, 1));padding:0 calc(.875rem * var(--edp-scale, 1));font-size:calc(.9375rem * var(--edp-scale, 1));font-weight:500;color:var(--ink, #1d2025);background:var(--card, #ffffff);border:1px solid var(--line-strong, #d6d3cc);border-radius:calc(.5rem * var(--edp-scale, 1));cursor:pointer;touch-action:manipulation}.edp-sheet-btn--primary{color:#fff;background:var(--ink, #1d2025);border-color:var(--ink, #1d2025)}.edp-sheet-btn:disabled{opacity:.45;cursor:default}.edp-sheet-btn,.edp-sheet-panel-close,.edp-sheet-photo-remove{transition:background-color .18s ease,border-color .18s ease}.edp-sheet-btn:hover:not(:disabled){background:var(--paper-deep, #f4f1ea);border-color:var(--ink, #1d2025)}.edp-sheet-btn--primary:hover:not(:disabled){background:var(--ink-soft, #2c313b)}.edp-sheet-panel-close:hover,.edp-sheet-photo-remove:hover{background:var(--paper-deep, #f4f1ea);color:var(--ink, #1d2025)}.edp-sheet-btn:focus-visible,.edp-sheet-panel-close:focus-visible,.edp-sheet-photo-remove:focus-visible{outline:2px solid var(--ink, #1d2025);outline-offset:2px}.edp-sheet-qr{display:flex;align-items:center;gap:calc(.875rem * var(--edp-scale, 1))}.edp-sheet-qr img,.edp-sheet-qr-wait{flex:none;width:calc(168px * var(--edp-scale, 1));height:calc(168px * var(--edp-scale, 1));border-radius:calc(.5rem * var(--edp-scale, 1));background:var(--card, #ffffff);border:1px solid var(--line, #e8e5de)}.edp-sheet-qr p{margin:0;font-size:calc(.9375rem * var(--edp-scale, 1));line-height:1.5}.edp-sheet-or{margin:calc(.625rem * var(--edp-scale, 1)) 0 calc(.375rem * var(--edp-scale, 1));font-size:calc(.8125rem * var(--edp-scale, 1));color:var(--ink-soft, #5b6170)}.edp-sheet-camera video{display:block;width:100%;max-height:calc(320px * var(--edp-scale, 1));margin-bottom:calc(.5rem * var(--edp-scale, 1));border-radius:calc(.5rem * var(--edp-scale, 1));background:#000}.edp-sheet-progress{display:flex;align-items:center;gap:calc(.5rem * var(--edp-scale, 1));margin:0;font-size:calc(.9375rem * var(--edp-scale, 1))}.edp-sheet-error p{margin:0 0 calc(.5rem * var(--edp-scale, 1));color:var(--pen, #d23b2b);font-size:calc(.9375rem * var(--edp-scale, 1))}.edp-sheet-pad-result{display:flex;align-items:center;gap:calc(.5rem * var(--edp-scale, 1));min-height:calc(2.5rem * var(--edp-scale, 1));margin-bottom:calc(.5rem * var(--edp-scale, 1));font-size:calc(1.6rem * var(--edp-scale, 1))}.edp-sheet-pad-help{font-size:calc(.875rem * var(--edp-scale, 1));color:var(--ink-soft, #5b6170)}.edp-sheet-pad{display:block;width:100%;height:calc(180px * var(--edp-scale, 1));margin-bottom:calc(.5rem * var(--edp-scale, 1));background:#fff;border:1px solid var(--line-strong, #d6d3cc);border-radius:calc(.5rem * var(--edp-scale, 1));touch-action:none;cursor:crosshair}@media(max-width:480px){.edp-sheet-key{min-width:calc(2.5rem * var(--edp-scale, 1));height:calc(2.5rem * var(--edp-scale, 1))}.edp-sheet-keys-extra{margin-inline-start:0}.edp-sheet-photo-remove{width:calc(2.5rem * var(--edp-scale, 1));height:calc(2.5rem * var(--edp-scale, 1))}.edp-sheet-qr{flex-direction:column;align-items:flex-start}}@media(prefers-reduced-motion:reduce){.edp-sheet-box,.edp-sheet-mf,.edp-sheet-key,.edp-sheet-btn,.edp-sheet-panel-close,.edp-sheet-photo-remove{transition:none}}.edp-mathkb-close{position:fixed;z-index:1000;inset-inline-end:12px;display:inline-flex;align-items:center;justify-content:center;width:2.5rem;height:2.5rem;font:600 1rem/1 system-ui,sans-serif;color:var(--ink, #1d2025);background:var(--card, #ffffff);border:1px solid var(--line, #e8e5de);border-radius:999px;box-shadow:0 2px 8px #00000026;cursor:pointer;touch-action:manipulation}.edp-mathkb-close[hidden]{display:none}.edp-mathkb-close:hover{background:var(--paper-deep, #f4f1ea)}.edp-mathkb-close:focus-visible{outline:2px solid var(--pen, #d23b2b);outline-offset:2px}.edp-math-text-formula{unicode-bidi:isolate;white-space:nowrap}.player-math-keys{margin-top:calc(.375rem * var(--edp-scale, 1));padding:0;border-top:0;background:transparent}
|
|
82
|
-
`);import"katex/dist/katex.min.css";
|
|
83
|
-
`);jt(`/*! 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-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-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--font-weight-black:900;--tracking-tight:-.025em;--tracking-wide:.025em;--tracking-wider:.05em;--tracking-widest:.1em;--leading-snug:1.375;--leading-relaxed:1.625;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--ease-out:cubic-bezier(0, 0, .2, 1);--ease-in-out:cubic-bezier(.4, 0, .2, 1);--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--blur-sm:8px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1)}}.edpire-scope .\\@container{container-type:inline-size}.edpire-scope .pointer-events-none{pointer-events:none}.edpire-scope .collapse{visibility:collapse}.edpire-scope .invisible{visibility:hidden}.edpire-scope .visible{visibility:visible}.edpire-scope .absolute{position:absolute}.edpire-scope .fixed{position:fixed}.edpire-scope .relative{position:relative}.edpire-scope .static{position:static}.edpire-scope .sticky{position:sticky}.edpire-scope .inset-0{inset:calc(var(--spacing) * 0)}.edpire-scope .start{inset-inline-start:var(--spacing)}.edpire-scope .start-0{inset-inline-start:calc(var(--spacing) * 0)}.edpire-scope .start-2{inset-inline-start:calc(var(--spacing) * 2)}.edpire-scope .end{inset-inline-end:var(--spacing)}.edpire-scope .end-2{inset-inline-end:calc(var(--spacing) * 2)}.edpire-scope .top-0{top:calc(var(--spacing) * 0)}.edpire-scope .top-1\\/2{top:50%}.edpire-scope .top-2{top:calc(var(--spacing) * 2)}.edpire-scope .top-4{top:calc(var(--spacing) * 4)}.edpire-scope .top-\\[calc\\(var\\(--edp-bar\\)\\+1rem\\)\\]{top:calc(var(--edp-bar) + 1rem)}.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-0\\.5{margin-inline-start:calc(var(--spacing) * .5)}.edpire-scope .ms-1{margin-inline-start:calc(var(--spacing) * 1)}.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-4{margin-top:calc(var(--spacing) * 4)}.edpire-scope .mt-6{margin-top:calc(var(--spacing) * 6)}.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-1\\.5{margin-bottom:calc(var(--spacing) * 1.5)}.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-auto{margin-left:auto}.edpire-scope .line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.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\\(100dvh-8rem\\)\\]{max-height:calc(100dvh - 8rem)}.edpire-scope .max-h-\\[calc\\(100dvh-var\\(--edp-bar\\)-2rem\\)\\]{max-height:calc(100dvh - var(--edp-bar) - 2rem)}.edpire-scope .max-h-\\[calc\\(100svh-6rem\\)\\]{max-height:calc(100svh - 6rem)}.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 .min-h-dvh{min-height:100dvh}.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-\\[200px\\]{max-width:200px}.edpire-scope .max-w-\\[240px\\]{max-width:240px}.edpire-scope .max-w-full{max-width:100%}.edpire-scope .max-w-none{max-width:none}.edpire-scope .max-w-sm{max-width:var(--container-sm)}.edpire-scope .max-w-xs{max-width:var(--container-xs)}.edpire-scope .min-w-0{min-width:calc(var(--spacing) * 0)}.edpire-scope .min-w-\\[80px\\]{min-width:80px}.edpire-scope .min-w-\\[140px\\]{min-width:140px}.edpire-scope .flex-1{flex:1}.edpire-scope .flex-none{flex:none}.edpire-scope .flex-shrink-0,.edpire-scope .shrink-0{flex-shrink:0}.edpire-scope .grow{flex-grow:1}.edpire-scope .-translate-x-\\[110\\%\\]{--tw-translate-x: -110% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.edpire-scope .translate-x-0{--tw-translate-x:calc(var(--spacing) * 0);translate:var(--tw-translate-x) var(--tw-translate-y)}.edpire-scope .-translate-y-1\\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.edpire-scope .transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.edpire-scope .animate-pulse{animation:var(--animate-pulse)}.edpire-scope .animate-spin{animation:var(--animate-spin)}.edpire-scope .cursor-default{cursor:default}.edpire-scope .cursor-pointer{cursor:pointer}.edpire-scope .resize{resize:both}.edpire-scope .flex-col{flex-direction:column}.edpire-scope .flex-wrap{flex-wrap:wrap}.edpire-scope .items-baseline{align-items:baseline}.edpire-scope .items-center{align-items:center}.edpire-scope .items-start{align-items:flex-start}.edpire-scope .justify-between{justify-content:space-between}.edpire-scope .justify-center{justify-content:center}.edpire-scope .justify-end{justify-content:flex-end}.edpire-scope .gap-0\\.5{gap:calc(var(--spacing) * .5)}.edpire-scope .gap-1{gap:calc(var(--spacing) * 1)}.edpire-scope .gap-1\\.5{gap:calc(var(--spacing) * 1.5)}.edpire-scope .gap-2{gap:calc(var(--spacing) * 2)}.edpire-scope .gap-2\\.5{gap:calc(var(--spacing) * 2.5)}.edpire-scope .gap-3{gap:calc(var(--spacing) * 3)}.edpire-scope .gap-4{gap:calc(var(--spacing) * 4)}.edpire-scope .gap-5{gap:calc(var(--spacing) * 5)}.edpire-scope .gap-6{gap:calc(var(--spacing) * 6)}.edpire-scope :where(.edpire-scope .space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1) * calc(1 - var(--tw-space-y-reverse)))}.edpire-scope :where(.edpire-scope .space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}.edpire-scope :where(.edpire-scope .space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}.edpire-scope .gap-x-1{column-gap:calc(var(--spacing) * 1)}.edpire-scope .gap-x-4{column-gap:calc(var(--spacing) * 4)}.edpire-scope .gap-y-0\\.5{row-gap:calc(var(--spacing) * .5)}.edpire-scope .gap-y-2{row-gap:calc(var(--spacing) * 2)}.edpire-scope .self-start{align-self:flex-start}.edpire-scope .self-stretch{align-self:stretch}.edpire-scope .truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.edpire-scope .overflow-auto{overflow:auto}.edpire-scope .overflow-hidden{overflow:hidden}.edpire-scope .overflow-visible{overflow:visible}.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\\/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-red-950\\/80{background-color:#460809cc}@supports (color:color-mix(in lab,red,red)){.edpire-scope .bg-red-950\\/80{background-color:color-mix(in oklab,var(--color-red-950) 80%,transparent)}}.edpire-scope .bg-white{background-color:var(--color-white)}.edpire-scope .bg-white\\/60{background-color:#fff9}@supports (color:color-mix(in lab,red,red)){.edpire-scope .bg-white\\/60{background-color:color-mix(in oklab,var(--color-white) 60%,transparent)}}.edpire-scope .object-contain{object-fit:contain}.edpire-scope .object-cover{object-fit:cover}.edpire-scope .p-1{padding:calc(var(--spacing) * 1)}.edpire-scope .p-1\\.5{padding:calc(var(--spacing) * 1.5)}.edpire-scope .p-2{padding:calc(var(--spacing) * 2)}.edpire-scope .p-3{padding:calc(var(--spacing) * 3)}.edpire-scope .p-4{padding:calc(var(--spacing) * 4)}.edpire-scope .p-6{padding:calc(var(--spacing) * 6)}.edpire-scope .px-1\\.5{padding-inline:calc(var(--spacing) * 1.5)}.edpire-scope .px-2{padding-inline:calc(var(--spacing) * 2)}.edpire-scope .px-2\\.5{padding-inline:calc(var(--spacing) * 2.5)}.edpire-scope .px-3{padding-inline:calc(var(--spacing) * 3)}.edpire-scope .px-3\\.5{padding-inline:calc(var(--spacing) * 3.5)}.edpire-scope .px-4{padding-inline:calc(var(--spacing) * 4)}.edpire-scope .px-5{padding-inline:calc(var(--spacing) * 5)}.edpire-scope .px-6{padding-inline:calc(var(--spacing) * 6)}.edpire-scope .px-10{padding-inline:calc(var(--spacing) * 10)}.edpire-scope .py-0\\.5{padding-block:calc(var(--spacing) * .5)}.edpire-scope .py-1{padding-block:calc(var(--spacing) * 1)}.edpire-scope .py-1\\.5{padding-block:calc(var(--spacing) * 1.5)}.edpire-scope .py-2{padding-block:calc(var(--spacing) * 2)}.edpire-scope .py-2\\.5{padding-block:calc(var(--spacing) * 2.5)}.edpire-scope .py-3{padding-block:calc(var(--spacing) * 3)}.edpire-scope .py-5{padding-block:calc(var(--spacing) * 5)}.edpire-scope .py-8{padding-block:calc(var(--spacing) * 8)}.edpire-scope .py-16{padding-block:calc(var(--spacing) * 16)}.edpire-scope .ps-2{padding-inline-start:calc(var(--spacing) * 2)}.edpire-scope .ps-\\[23px\\]{padding-inline-start:23px}.edpire-scope .pe-2\\.5{padding-inline-end:calc(var(--spacing) * 2.5)}.edpire-scope .pt-1\\.5{padding-top:calc(var(--spacing) * 1.5)}.edpire-scope .pt-2{padding-top:calc(var(--spacing) * 2)}.edpire-scope .pb-1{padding-bottom:calc(var(--spacing) * 1)}.edpire-scope .pb-5{padding-bottom:calc(var(--spacing) * 5)}.edpire-scope .pl-2{padding-left:calc(var(--spacing) * 2)}.edpire-scope .text-center{text-align:center}.edpire-scope .text-right{text-align:right}.edpire-scope .text-start{text-align:start}.edpire-scope .align-middle{vertical-align:middle}.edpire-scope .font-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-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.edpire-scope .text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.edpire-scope .text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.edpire-scope .text-\\[1\\.6rem\\]{font-size:1.6rem}.edpire-scope .text-\\[10px\\]{font-size:10px}.edpire-scope .text-\\[11px\\]{font-size:11px}.edpire-scope .leading-none{--tw-leading:1;line-height:1}.edpire-scope .leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.edpire-scope .leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.edpire-scope .font-black{--tw-font-weight:var(--font-weight-black);font-weight:var(--font-weight-black)}.edpire-scope .font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.edpire-scope .font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.edpire-scope .font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.edpire-scope .tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.edpire-scope .tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.edpire-scope .tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.edpire-scope .tracking-widest{--tw-tracking:var(--tracking-widest);letter-spacing:var(--tracking-widest)}.edpire-scope .\\[overflow-wrap\\:anywhere\\]{overflow-wrap:anywhere}.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-\\[\\#5b6170\\]{color:#5b6170}.edpire-scope .text-\\[\\#8a5a08\\]{color:#8a5a08}.edpire-scope .text-\\[\\#8a8f99\\]{color:#8a8f99}.edpire-scope .text-\\[\\#8d93a0\\]{color:#8d93a0}.edpire-scope .text-\\[\\#565b66\\]{color:#565b66}.edpire-scope .text-\\[\\#a32b1e\\]{color:#a32b1e}.edpire-scope .text-\\[\\#c8810e\\]{color:#c8810e}.edpire-scope .text-\\[\\#d23b2b\\]{color:#d23b2b}.edpire-scope .text-amber-900{color:var(--color-amber-900)}.edpire-scope .text-blue-600{color:var(--color-blue-600)}.edpire-scope .text-gray-400{color:var(--color-gray-400)}.edpire-scope .text-gray-500{color:var(--color-gray-500)}.edpire-scope .text-gray-600{color:var(--color-gray-600)}.edpire-scope .text-gray-700{color:var(--color-gray-700)}.edpire-scope .text-gray-800{color:var(--color-gray-800)}.edpire-scope .text-red-200{color:var(--color-red-200)}.edpire-scope .text-red-300{color:var(--color-red-300)}.edpire-scope .text-slate-500{color:var(--color-slate-500)}.edpire-scope .text-slate-800{color:var(--color-slate-800)}.edpire-scope .text-white{color:var(--color-white)}.edpire-scope .uppercase{text-transform:uppercase}.edpire-scope .italic{font-style:italic}.edpire-scope .tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.edpire-scope .line-through{text-decoration-line:line-through}.edpire-scope .underline{text-decoration-line:underline}.edpire-scope .underline-offset-2{text-underline-offset:2px}.edpire-scope .underline-offset-4{text-underline-offset:4px}.edpire-scope .opacity-40{opacity:.4}.edpire-scope .opacity-60{opacity:.6}.edpire-scope .opacity-70{opacity:.7}.edpire-scope .shadow{--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-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 .\\[--edp-bar\\:0px\\]{--edp-bar:0px}.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\\:border-\\[\\#1d2025\\]):focus{border-color:#1d2025}.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-40):disabled{opacity:.4}.edpire-scope :is(.edpire-scope .disabled\\:opacity-50):disabled{opacity:.5}.edpire-scope :is(.edpire-scope .data-\\[flash\\=true\\]\\:bg-\\[\\#fbf1dc\\])[data-flash=true]{background-color:#fbf1dc}.edpire-scope :is(.edpire-scope .data-\\[flash\\=true\\]\\:duration-150)[data-flash=true]{--tw-duration:.15s;transition-duration:.15s}@media(min-width:40rem){.edpire-scope .sm\\:block{display:block}.edpire-scope .sm\\:hidden{display:none}.edpire-scope .sm\\:inline{display:inline}.edpire-scope .sm\\:inline-flex{display:inline-flex}.edpire-scope .sm\\:flex-row{flex-direction:row}.edpire-scope .sm\\:flex-nowrap{flex-wrap:nowrap}.edpire-scope .sm\\:items-center{align-items:center}.edpire-scope .sm\\:gap-4{gap:calc(var(--spacing) * 4)}.edpire-scope .sm\\:px-4{padding-inline:calc(var(--spacing) * 4)}.edpire-scope .sm\\:px-6{padding-inline:calc(var(--spacing) * 6)}.edpire-scope .sm\\:py-4{padding-block:calc(var(--spacing) * 4)}.edpire-scope .sm\\:text-\\[2rem\\]{font-size:2rem}}@container (min-width:72rem){.edpire-scope .\\@6xl\\:flex{display:flex}.edpire-scope .\\@6xl\\:hidden{display:none}}.edpire-scope :is(.edpire-scope .rtl\\:translate-x-\\[110\\%\\]):where(:dir(rtl),.edpire-scope [dir=rtl],.edpire-scope [dir=rtl] *){--tw-translate-x:110%;translate:var(--tw-translate-x) var(--tw-translate-y)}.edpire-scope :is(.edpire-scope .\\[\\&_\\.ProseMirror\\]\\:min-h-\\[80px\\]) .ProseMirror{min-height:80px}.edpire-scope :is(.edpire-scope .\\[\\&_\\.ProseMirror\\]\\:outline-none) .ProseMirror{--tw-outline-style:none;outline-style:none}.edpire-scope :is(.edpire-scope .\\[\\&_\\.ProseMirror_p\\.is-editor-empty\\:first-child\\:\\:before\\]\\:pointer-events-none) .ProseMirror p.is-editor-empty:first-child:before{pointer-events:none}.edpire-scope :is(.edpire-scope .\\[\\&_\\.ProseMirror_p\\.is-editor-empty\\:first-child\\:\\:before\\]\\:float-left) .ProseMirror p.is-editor-empty:first-child:before{float:left}.edpire-scope :is(.edpire-scope .\\[\\&_\\.ProseMirror_p\\.is-editor-empty\\:first-child\\:\\:before\\]\\:h-0) .ProseMirror p.is-editor-empty:first-child:before{height:calc(var(--spacing) * 0)}.edpire-scope :is(.edpire-scope .\\[\\&_\\.ProseMirror_p\\.is-editor-empty\\:first-child\\:\\:before\\]\\:text-gray-400) .ProseMirror p.is-editor-empty:first-child:before{color:var(--color-gray-400)}.edpire-scope :is(.edpire-scope .\\[\\&_\\.ProseMirror_p\\.is-editor-empty\\:first-child\\:\\:before\\]\\:content-\\[attr\\(data-placeholder\\)\\]) .ProseMirror p.is-editor-empty:first-child:before{--tw-content:attr(data-placeholder);content:var(--tw-content)}.edpire-scope :is(.edpire-scope .\\[\\&_\\[data-exercise-id\\]\\]\\:scroll-mt-\\[calc\\(var\\(--edp-bar\\)\\+0\\.75rem\\)\\]) [data-exercise-id],.edpire-scope :is(.edpire-scope .\\[\\&_\\[data-question-id\\]\\]\\:scroll-mt-\\[calc\\(var\\(--edp-bar\\)\\+0\\.75rem\\)\\]) [data-question-id]{scroll-margin-top:calc(var(--edp-bar) + .75rem)}@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}}
|
|
84
|
-
`);import{Fragment as wa,jsx as E,jsxs as K}from"react/jsx-runtime";var fm="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 hm(e){for(let t of e.exercises)for(let r of t.questions)if((r.content.content??[]).some(o=>o.type==="aiAnswerInput"))return!0;return!1}function ic(e){let t=e;return typeof t.totalMaxScore=="number"?t.totalMaxScore:(t.answerKeys??[]).reduce((r,n)=>r+(n.scoring?.maxScore??0),0)}function nc(e){return e.questions.reduce((t,r)=>t+ic(r),0)}function yt(e){return Number.isInteger(e)?String(e):parseFloat(e.toFixed(2)).toString()}var va=5;function oc({label:e}){return E("span",{className:"ms-0.5 text-[#d23b2b]",title:e,"aria-label":e,children:"*"})}function cc(e){return e==="full"?"#1f8a4c":e==="partial"?"#c8810e":"#d23b2b"}function ac({outcome:e}){let t=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 E("svg",{width:14,height:14,viewBox:"0 0 100 100",fill:"none",stroke:cc(e),strokeWidth:9,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:E("path",{d:t})})}function gm({score:e,weight:t,unit:r,t:n,hidden:o=!1}){if(e){if(e.awaiting)return K("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:[E(or,{size:11}),n("pendingReview")]});let a=o?e.outcome:e.m>0&&e.s>=e.m?"full":e.s>0?"partial":"none";return o?E("span",{className:"inline-flex items-center rounded-lg border border-[#e7e5e0] bg-[#f5f4f1] px-2 py-1",children:E(ac,{outcome:a})}):K("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:[E(ac,{outcome:a}),K("span",{className:"font-bold leading-none",style:{fontFamily:'var(--font-hand, "Caveat", cursive)',fontSize:"1.05rem",color:cc(a)},children:[yt(e.s)," / ",yt(e.m)]})]})}return t>0&&!o?K("span",{className:"text-xs font-semibold tabular-nums text-[#8d93a0]",children:[yt(t)," ",r(t)]}):null}function sc(e){let t=0,r=0,n=!1,o=0,a=0;for(let i of e)t+=i.score??0,r+=i.maxScore??0,i.status==="awaiting_review"&&(n=!0),i.status==="correct"&&o++,(i.status==="correct"||i.status==="partial")&&a++;let s=e.length>0&&o===e.length?"full":a>0?"partial":"none";return{score:t,maxScore:r,awaiting:n,outcome:s}}function bm({timeLimitMinutes:e,startedAt:t,onExpire:r}){let n=e*6e4,o=new Date(t).getTime()+n,[a,s]=Ve(()=>Math.max(o-Date.now(),0)),i=_t(r);i.current=r,zn(()=>{if(a<=0){i.current();return}let u=setInterval(()=>{let S=Math.max(o-Date.now(),0);s(S),S<=0&&(clearInterval(u),i.current())},1e3);return()=>clearInterval(u)},[o]);let c=a/n,l=c<.1?"bg-[#fdeeec] text-[#a32b1e] border-[#f6cfc9] animate-pulse":c<.25?"bg-[#fbf1dc] text-[#8a5a08] border-[#f2e2bf]":"bg-[#f5f4f1] text-[#565b66] border-[#e7e5e0]",p=Math.ceil(a/1e3),f=Math.floor(p/3600),m=Math.floor(p%3600/60),h=p%60,d=f>0?`${f}:${String(m).padStart(2,"0")}:${String(h).padStart(2,"0")}`:`${m}:${String(h).padStart(2,"0")}`;return K("span",{className:ye("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:[E(or,{size:12}),d]})}function Dn({assessment:e,meta:t,scoreHidden:r=!1,isForm:n=!1,requiredQuestionIds:o,locale:a="en",branding:s,timeLimitMinutes:i,startedAt:c,initialAnswers:l,onAnswersChange:p,saveState:f,resumed:m=!1,onSubmit:h,review:d,onViewReport:u,reportLabel:S,onBack:R,backLabel:k,allowReset:C,onReset:v,overlayConfig:N,contained:w=!1,layout:x,onClose:y,mediaHandler:T,answerSheetHandler:g,onReportGrade:P,onAddAnnex:A,fallbackLogoUrl:W}){let b=Le(()=>Xi(a),[a]),M=Je(D=>Qi(a,D),[a]),$=ga(a)?"rtl":"ltr",B=_t(null),J=_t(null);zn(()=>{let D=J.current,se=B.current;if(!D||!se||typeof ResizeObserver>"u")return;let Se=()=>se.style.setProperty("--edp-bar",`${D.offsetHeight}px`);Se();let wt=new ResizeObserver(Se);return wt.observe(D),()=>wt.disconnect()},[]);let Y=x?.maxWidth??Ji,Q=s?.branding?.primaryColor,ve=s?.branding?.accentColor,L=s?.branding?.fontFamily,_=s?.branding?.fontUrl,q=s?.branding?.showPoweredBy!==!1;zn(()=>{if(!_||typeof document>"u"||document.querySelector(`link[href="${_}"]`))return;let se=document.createElement("link");se.rel="stylesheet",se.href=_,document.head.appendChild(se)},[_]);let[z,O]=Ve(()=>d?.answers??l??{exerciseAnswers:[]}),[ne]=Ve(()=>d?new Map:ha(l)),ce=Le(()=>Gi(e),[e]),le=_t(p);le.current=p;let[ue]=Ve(()=>(d?d.answers:l)?.mediaPlays),U=_t(ue),X=Je(D=>U.current&&Object.keys(U.current).length>0?{...D,mediaPlays:U.current}:D,[]),me=_t(z);me.current=z;let ae=_t(!1),oe=Je(D=>{let se=X(Yi(D,ne,ce));O(se),le.current?.(se)},[ne,ce,X]),de=Je(D=>{if(U.current=D,d||ae.current)return;let se=X(me.current);O(se),le.current?.(se)},[d,X]),[Te,Ze]=Ve(null);zn(()=>{Ze(Date.now())},[]);let[H,ee]=Ve(m&&!d),te=Le(()=>{if(Te===null||!i||i<=0||!c)return null;let D=new Date(c).getTime()+i*6e4-Te;return D>0?Math.max(1,Math.floor(D/6e4)):null},[Te,i,c]),[pe,je]=Ve(!1),[ar,xt]=Ve(!1),[G,sr]=Ve(d?.result??null);ae.current=G!==null;let ir=Le(()=>ha(d?.answers),[d]),[Dr,et]=Ve(null),[vt,cr]=Ve(!1),Ca=_t(!1),xc=Le(()=>hm(e),[e]),Aa=Le(()=>ar?ua(e,z):[],[ar,e,z]),lr=Aa.length,jn=Je(D=>{xt(!1);let se=B.current?.querySelectorAll(`[data-question-id="${CSS.escape(D)}"]`),Se=Array.from(se??[]).find(wt=>wt.getClientRects().length>0);Se&&requestAnimationFrame(()=>Se.scrollIntoView({block:"start",behavior:"smooth"}))},[]),Bn=(o??[]).join(" "),Pt=Le(()=>new Set(Bn?Bn.split(" "):[]),[Bn]),[Na,vc]=Ve(!1),qn=Le(()=>Na?ma(e,z,Pt).map(D=>D.questionId).join(" "):"",[Na,e,z,Pt]),_a=Le(()=>new Set(qn?qn.split(" "):[]),[qn]),wc=Je(()=>{let D=ma(e,z,Pt);if(D.length===0){xt(!0);return}vc(!0),jn(D[0].questionId)},[e,z,Pt,jn]),Hn=Le(()=>e.exercises.reduce((D,se)=>D+nc(se),0),[e]),Wn=Le(()=>G?Fn(G.exerciseFeedback):void 0,[G]),Pa=Le(()=>{let D=new Map;for(let se of G?.exerciseFeedback??[])for(let Se of se.questions)Se.explanation&&D.set(Se.questionId,Se);return D},[G]),Or=r||G?.scoreHidden===!0,Ta=Le(()=>{if(!G)return{};let D={};for(let se of G.exerciseFeedback)D[se.exerciseId]=sc(se.questions.flatMap(Se=>Se.nodeResults));return D},[G]),Un=Le(()=>{if(!G)return{};let D={};for(let se of G.exerciseFeedback)for(let Se of se.questions)Se.nodeResults.length>0&&(D[Se.questionId]=sc(Se.nodeResults));return D},[G]),kc=Je(async()=>{je(!0),et(null);try{let D=await h(z);sr(D),typeof window<"u"&&window.scrollTo({top:0,behavior:"smooth"})}catch(D){et(D instanceof Error?D.message==="required_unanswered"?b("requiredBlocked"):D.message:b("confirmCancel"))}finally{je(!1),xt(!1)}},[z,h,b]),jr=Je(()=>{!G||!u||u(G)},[G,u]),Sc=Je(()=>{Ca.current||pe||G||(Ca.current=!0,cr(!0),xt(!1),typeof document<"u"&&document.activeElement?.blur(),setTimeout(()=>{je(!0),et(null),h(z).then(D=>{sr(D),typeof window<"u"&&window.scrollTo({top:0,behavior:"smooth"})}).catch(D=>{et(D instanceof Error?D.message:"submit_error")}).finally(()=>{je(!1),cr(!1)})},800))},[z,pe,h,G]),Kn=Je((D,se,Se)=>{let wt=nc(D),tt=Ta[D.id],Ma=D.questions.length>1,Cc=ec(se)?Zi(se,{renderQuestion:(Hr,Yn,Ac)=>{let Be=Hr.id,Ea=ne.get(Be),La={...T?{mediaHandler:T}:{},...g?{answerSheetHandler:g}:{},...d?{initialAnswers:ir.get(Be)??[],readOnly:!0}:Ea?{initialAnswers:Ea}:{},...G!==null?{readOnly:!0}:{}},Ia=Object.keys(La).length>0&&ec(Yn)?Zi(Yn,La):Yn,Nc=Pt.has(Be),$a=_a.has(Be)?K("p",{role:"alert",className:"mt-2 flex items-center gap-1.5 text-sm font-medium text-[#a32b1e]",children:[E(pm,{size:14,className:"flex-shrink-0"}),b("requiredMissing")]}):null,Qn=Pa.get(Be),Fa=Qn?.explanation?E(qi,{content:Qn.explanation,nodeResults:Qn.nodeResults,label:b("explanation")}):null,za=Un[Be],Da=G&&P&&za&&!za.awaiting?E(Ui,{questionId:Be,onReport:P,t:b}):null;if(!Ma)return K("div",{"data-question-id":Be,children:[Ia,$a,Fa,Da]},Be);let dr=Un[Be],_c=ic(Hr);return K("div",{"data-question-id":Be,children:[K("div",{className:"flex items-center gap-2.5 mb-3",children:[K("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:[b("question",{index:Ac+1}),Nc&&E(oc,{label:b("required")})]}),E(gm,{hidden:Or,score:dr?{s:dr.score,m:dr.maxScore,awaiting:dr.awaiting,outcome:dr.outcome}:null,weight:_c,unit:M,t:b})]}),Ia,$a,Fa,Da]},Be)},renderSeparator:Hr=>E("div",{className:"border-t border-[#e7e5e0] my-1"},`qsep-${Hr}`)}):se;return K("div",{"data-exercise-id":D.id,className:"bg-white rounded-[14px] border border-[#e7e5e0] shadow-sm overflow-hidden",children:[K("div",{className:"flex items-center justify-between px-4 py-2.5 bg-[#f1efe9] border-b border-[#e7e5e0]",style:ve?{backgroundColor:ve}:void 0,children:[K("span",{dir:"auto",className:"min-w-0 text-sm font-bold text-[#1d2025] [overflow-wrap:anywhere]",children:[Dt(b,D.title,Se),!Ma&&D.questions[0]&&Pt.has(D.questions[0].id)&&E(oc,{label:b("required")})]}),Or?null:tt?.awaiting?K("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:[E(or,{size:11}),b("pendingReview")]}):tt?K("span",{className:"font-bold leading-none tabular-nums",style:{fontFamily:'var(--font-hand, "Caveat", cursive)',fontSize:"1.15rem",color:tt.maxScore>0&&tt.score>=tt.maxScore?"#1f8a4c":tt.maxScore>0&&tt.score>0?"#c8810e":tt.maxScore>0?"#d23b2b":"#8d93a0"},children:[yt(tt.score)," / ",yt(tt.maxScore)]}):wt>0?K("span",{className:"text-xs font-semibold text-[#8d93a0] tabular-nums",children:["/ ",yt(wt)," ",M(wt)]}):null]}),E("div",{className:"p-4",children:Cc})]},D.id)},[b,M,Ta,Un,ve,T,g,P,d,ir,ne,Pa,Or,Pt,_a,G]),Rc=Le(()=>la(e).length>0,[e]),Vn=Je(D=>K("div",{className:"flex items-center gap-3 py-2",children:[E("div",{className:"flex-1 border-t border-dashed border-[#e7e5e0]"}),E("span",{className:"text-[10px] font-bold text-[#8d93a0] uppercase tracking-widest",children:Dt(b,e.exercises[D+1]?.title,D+1)}),E("div",{className:"flex-1 border-t border-dashed border-[#e7e5e0]"})]},`sep-${D}`),[b,e]),Gn=q?E("p",{className:"pt-2 pb-1 text-center text-xs text-[#8d93a0] select-none",children:b("poweredBy")}):null,Ge=G!==null,Tt=n||G?.isForm===!0,Br=G?.showVerdict!==!1,qr=Br?G?.passed?"#1f8a4c":"#d23b2b":"#1d2025";return E(Gr,{initial:ue,onChange:de,children:E("div",{className:"edpire-scope",style:{display:"contents"},children:K("div",{ref:B,dir:$,className:ye("flex flex-col [--edp-bar:0px] [&_[data-exercise-id]]:scroll-mt-[calc(var(--edp-bar)+0.75rem)] [&_[data-question-id]]:scroll-mt-[calc(var(--edp-bar)+0.75rem)]",w?"h-full":"min-h-dvh"),style:L?{fontFamily:L}:void 0,children:[E(Li,{visible:pe&&!vt&&!Tt,hasAiNodes:xc,text:b("evaluating"),aiText:b("aiEvaluating"),contained:w,...N}),vt&&K("div",{className:ye("fixed inset-0 z-50 flex flex-col items-center justify-center gap-3 bg-red-950/80 backdrop-blur-sm",w&&"absolute"),children:[E(or,{size:40,className:"text-red-300"}),E("p",{className:"text-xl font-black text-white tracking-tight",children:b("timeUp.title")}),E("p",{className:"text-sm text-red-200",children:b("timeUp.submitting")})]}),K("div",{ref:J,className:"sticky top-0 z-10 flex-shrink-0 flex items-center justify-between gap-2 px-4 py-2.5 border-b border-[#e7e5e0] bg-[#fbfaf7]",style:ve?{backgroundColor:ve}:void 0,children:[K("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[E("img",{src:s?.logoUrl??W??fm,alt:s?.name??"Edpire",width:24,height:24,loading:"lazy",className:"flex-none rounded object-contain"}),K("div",{className:"min-w-0",children:[E("h1",{dir:"auto",title:t.title,className:"line-clamp-2 text-sm font-bold leading-snug text-[#1d2025] [overflow-wrap:anywhere]",children:t.title}),E("p",{className:"text-[11px] text-[#8d93a0]",children:Hn>0&&!Or&&K("span",{className:"ms-2 font-semibold text-[#565b66]",children:["/ ",yt(Hn)," ",M(Hn)]})})]}),!Ge&&Te!==null&&i&&i>0&&c&&E(bm,{timeLimitMinutes:i,startedAt:c,onExpire:Sc}),!Ge&&(f==="saving"||f==="saved")&&K("span",{role:"status",className:"hidden sm:inline-flex items-center gap-1 text-[11px] font-medium text-[#8d93a0]",children:[f==="saved"?E(um,{size:12}):E(ba,{size:12,className:"animate-spin"}),b(f==="saved"?"answersSaved":"answersSaving")]})]}),K("div",{className:"flex flex-none items-center gap-2",children:[C&&K("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:[E(lm,{size:13}),b("reset")]}),(!Ge||d)&&R&&K("button",{onClick:R,className:"flex items-center gap-1.5 px-3 py-2 text-sm font-medium text-[#565b66] hover:text-[#1d2025] hover:bg-[#f1efe9] rounded-lg transition-colors",children:[E(xa,{size:13}),k??b("back")]}),y&&E("button",{onClick:y,className:"p-1.5 text-[#8d93a0] hover:text-[#1d2025] hover:bg-[#f1efe9] rounded-lg transition-colors",children:E(xa,{size:15})}),!Ge&&E("button",{onClick:wc,disabled:pe,style:Q?{backgroundColor:Q}:void 0,className:"flex flex-shrink-0 items-center gap-2 px-3.5 sm:px-4 py-2 bg-[#1d2025] text-white text-sm font-semibold rounded-lg hover:bg-[#31353c] transition-colors disabled:opacity-50",children:pe?K(wa,{children:[E(ba,{size:14,className:"animate-spin"}),b(Tt?"formSending":"submitting")]}):K(wa,{children:[E(tc,{size:14}),E("span",{className:"sm:hidden",children:b(Tt?"formSubmit":"confirmSubmit")}),E("span",{className:"hidden sm:inline",children:b(Tt?"formSubmit":"submit")})]})})]})]}),Dr&&E("div",{className:"flex-shrink-0 bg-[#fdeeec] border-b border-[#f6cfc9] px-4 py-2 text-sm text-[#a32b1e]",children:Dr}),!Ge&&f==="failed"&&K("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:[E(mm,{size:15,className:"flex-shrink-0"}),b("answersNotSaved")]}),!Ge&&H&&(ne.size>0||te!==null)&&K("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:[te!==null&&E(or,{size:15,className:"flex-shrink-0 text-[#565b66]"}),K("span",{className:"flex-1 min-w-0",children:[ne.size>0?b("resumeRestored"):b("resumeFresh"),te!==null&&K(wa,{children:[" ",b("resumeTimeLeft",{minutes:te})]})]}),E("button",{type:"button",onClick:()=>ee(!1),"aria-label":b("close"),className:"flex-shrink-0 p-1 rounded-md text-[#8d93a0] hover:text-[#1d2025] hover:bg-[#e7e5e0] transition-colors",children:E(xa,{size:14})})]}),Ge&&G?.isForm?E(Ki,{t:b,rtl:ga(a),showClose:!w,onContinue:u&&G.returnUrl?jr:void 0,continueLabel:S,primaryColor:Q}):Ge&&G&&(G.awaitingManualGrading?E("div",{className:"flex-shrink-0 border-b bg-[#fbf1dc] border-[#f2e2bf]",children:E("div",{className:"mx-auto px-4 py-3 sm:px-6 sm:py-4",style:{maxWidth:Y},children:K("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2 sm:gap-4",children:[K("div",{className:"flex items-center gap-2",children:[E(or,{size:20,className:"text-[#c8810e] flex-shrink-0"}),E("span",{className:"text-sm font-semibold text-[#8a5a08]",children:G.aiPending?b("beingMarked"):b("awaitingReview")})]}),E("div",{className:"hidden sm:block w-px h-8 bg-[#f2e2bf]"}),E("p",{className:"text-sm text-[#8a5a08] flex-1 min-w-0",children:G.aiPending?b("beingMarkedDesc"):b("awaitingReviewDesc")}),u&&K("button",{onClick:jr,style:Q?{backgroundColor:Q}: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:[E(ya,{size:14}),S??b("viewFullReport")]})]})})}):G.scoreHidden?E("div",{className:"flex-shrink-0 border-b bg-[#f5f4f1] border-[#e7e5e0]",children:E("div",{className:"mx-auto px-4 py-3 sm:px-6 sm:py-4",style:{maxWidth:Y},children:K("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2 sm:gap-4",children:[K("div",{className:"flex items-center gap-2",children:[E(rc,{size:20,className:"text-[#1d2025] flex-shrink-0"}),E("span",{className:"text-sm font-semibold text-[#1d2025]",children:b("submittedNoScore")})]}),E("div",{className:"hidden sm:block w-px h-8 bg-[#e7e5e0]"}),E("p",{className:"text-sm text-[#565b66] flex-1 min-w-0",children:b("submittedNoScoreDesc")}),u&&K("button",{onClick:jr,style:Q?{backgroundColor:Q}: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:[E(ya,{size:14}),S??b("viewFullReport")]})]})})}):E("div",{className:ye("flex-shrink-0 border-b",Br?G.passed?"bg-[#ecf8f0] border-[#c5e8d1]":"bg-[#fdeeec] border-[#f6cfc9]":"bg-[#f5f4f1] border-[#e7e5e0]"),children:E("div",{className:"mx-auto px-4 py-3 sm:px-6 sm:py-4",style:{maxWidth:Y},children:K("div",{className:"flex flex-wrap sm:flex-nowrap items-center gap-x-4 gap-y-2",children:[K("div",{className:"flex items-center gap-2",children:[Br?G.passed?E(rc,{size:20,className:"text-[#1f8a4c] flex-shrink-0"}):E(cm,{size:20,className:"text-[#d23b2b] flex-shrink-0"}):null,E("span",{className:"text-sm font-semibold",style:{color:qr},children:Br?G.passed?b("assessmentPassed"):b("assessmentNotPassed"):b("yourScore")})]}),E("div",{className:"hidden sm:block w-px h-8 bg-[#e7e5e0]"}),K("div",{className:"flex items-baseline gap-1.5",children:[K("span",{className:"leading-none tabular-nums text-[1.6rem] sm:text-[2rem]",style:{fontFamily:'var(--font-hand, "Caveat", cursive)',color:qr},children:[yt(G.totalScore)," / ",yt(G.maxScore)]}),E("span",{className:"text-sm text-[#8d93a0] font-medium",children:M(G.maxScore)})]}),K("div",{className:"flex-1 flex items-center gap-3 min-w-[140px]",children:[E("div",{className:"flex-1 h-2 bg-[#e7e5e0] rounded-full overflow-hidden min-w-[80px]",children:E("div",{className:"h-full rounded-full transition-all duration-700",style:{width:`${G.percentage}%`,backgroundColor:qr}})}),K("span",{className:"text-sm font-bold tabular-nums flex-shrink-0",style:{color:qr},children:[G.percentage,"%"]})]}),u&&K("button",{onClick:jr,style:Q?{backgroundColor:Q}: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:[E(ya,{size:14}),S??b("viewFullReport")]})]})})})),E("div",{className:ye("flex-1 flex flex-col",w&&"overflow-hidden",vt&&"pointer-events-none opacity-60",G?.isForm&&"hidden"),children:e.annex||Rc?E(Di,{assessment:e,isSubmitted:Ge,setAnswers:oe,validationFeedback:Wn,renderExercise:Kn,renderSeparator:Vn,primaryColor:Q,contained:w,locale:a,contentMaxWidth:Y,t:b,footer:Gn}):A?E(ji,{assessment:e,isSubmitted:Ge,setAnswers:oe,validationFeedback:Wn,renderExercise:Kn,renderSeparator:Vn,primaryColor:Q,contained:w,locale:a,contentMaxWidth:Y,t:b,onAddAnnex:A,footer:Gn}):E("div",{className:ye("flex-1",w&&"overflow-y-auto"),children:K("div",{className:"mx-auto p-6 flex flex-col gap-4",style:{maxWidth:Y},children:[E(Nt,{assessment:e,onAnswersChange:Ge?void 0:oe,validationFeedback:Wn,renderExercise:Kn,renderSeparator:Vn,locale:a}),Gn]})})}),ar&&E("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",children:K("div",{role:"dialog","aria-modal":"true","aria-labelledby":"edpire-submit-confirm-title",className:"bg-white rounded-[14px] shadow-xl p-6 max-w-sm mx-4",children:[E("h3",{id:"edpire-submit-confirm-title",className:"text-base font-bold text-[#1d2025] mb-2",children:b(Tt?"formConfirmTitle":"confirmTitle")}),lr>0&&K("div",{className:"text-sm text-[#8a5a08] bg-[#fbf1dc] border border-[#f2e2bf] rounded-lg px-3 py-2 mb-3",children:[K("p",{className:"flex items-start gap-2 font-semibold",children:[E(dm,{size:15,className:"flex-shrink-0 mt-px"}),E("span",{children:lr===1?b("unansweredOne"):b("unansweredMany",{count:lr})})]}),K("ul",{className:"mt-1 ps-[23px] flex flex-col gap-0.5",children:[Aa.slice(0,va).map(D=>E("li",{children:E("button",{type:"button",onClick:()=>jn(D.questionId),className:"text-start underline underline-offset-2 hover:text-[#1d2025] cursor-pointer",children:D.only?Dt(b,D.exerciseTitle,D.exerciseIndex):`${Dt(b,D.exerciseTitle,D.exerciseIndex)} \xB7 ${b("question",{index:D.questionIndex+1})}`})},D.questionId)),lr>va&&E("li",{children:b("unansweredMore",{count:lr-va})})]})]}),E("p",{className:"text-sm text-[#565b66] mb-5",children:b(Tt?"formConfirmDescription":"confirmDescription")}),K("div",{className:"flex gap-3 justify-end",children:[E("button",{onClick:()=>xt(!1),className:"px-4 py-2 text-sm font-medium text-[#565b66] hover:bg-[#f1efe9] rounded-lg transition-colors",children:b("confirmCancel")}),K("button",{onClick:kc,disabled:pe,style:Q?{backgroundColor:Q}: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:[pe?E(ba,{size:14,className:"animate-spin"}):E(tc,{size:14}),b(Tt?"formSubmit":"confirmSubmit")]})]})]})})]})})})}function On(e){return(e??[]).map(t=>({exerciseId:t.exercise_id,questions:t.questions.map(r=>({questionId:r.question_id,...r.explanation?{explanation:r.explanation}:{},nodeResults:r.node_results.map(n=>({nodeId:n.node_id,status:n.status,...n.score!==void 0?{score:n.score}:{},...n.max_score!==void 0?{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}:{}}))}))}))}function ym(e,t){return new Promise((r,n)=>{let o=setTimeout(r,e);t.addEventListener("abort",()=>{clearTimeout(o),n(new Error("aborted"))},{once:!0})})}function xm(e){return new Promise((t,r)=>{let n=new FileReader;n.onload=()=>t(String(n.result)),n.onerror=()=>r(n.error??new Error("read_failed")),n.readAsDataURL(e)})}function vm(e){let t={transcribePhotos:({images:o,photos:a},s)=>e.readPhotos({images:o,photos:a,nodeId:s?.nodeId}),recognizeHandwriting:async o=>e.readHandwriting(await xm(o))},{startCapture:r,captureStatus:n}=e;return r&&n&&(t.startPhoneCapture=async({nodeId:o,signal:a})=>{let{captureId:s,url:i,qrImage:c}=await r(o),l=(async()=>{let p=Date.now()+12e5;for(;Date.now()<p;){await ym(2500,a);let f=await n(s).catch(()=>null);if(f?.photos.length)return f.photos}throw new Error("expired")})();return{url:i,qrImage:c,photos:l}}),t}function lc(e,t){let r=async n=>{let o=await fetch(`${e.replace(/\/$/,"")}/api/v1/embed/read`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:t,...n})}),a=await o.json().catch(()=>({}));if(!o.ok)throw new Error(a.error??"failed");return a};return vm({readPhotos:({images:n,nodeId:o})=>r({kind:"photos",images:n,...o?{node_id:o}:{}}),readHandwriting:n=>r({kind:"handwriting",image:n})})}import{jsx as km}from"react/jsx-runtime";function ka(e,t){let r=On(e.exercise_feedback);return{submissionId:e.submission_id,totalScore:e.score??0,maxScore:e.max_score??0,percentage:e.percentage??0,passed:e.passed??!1,...e.score_hidden?{scoreHidden:!0}:{},returnUrl:t??null,exerciseFeedback:r,awaitingManualGrading:e.awaiting_manual_grading??!1,aiPending:e.ai_pending??!1}}function Sa(e){return{annex:e.annex??void 0,exercises:e.exercises.map(t=>({id:t.id,...t.title?{title:t.title}:{},sharedContext:t.sharedContext,questions:t.questions.map(r=>({id:r.id,version:"1.0",content:r.content,answerKeys:[]}))}))}}function uc({token:e,data:t,baseUrl:r,options:n}){let{locale:o,branding:a,returnUrl:s,reportLabel:i,backLabel:c,onBack:l,overlayConfig:p,layout:f,mediaHandler:m,answerSheetHandler:h,onComplete:d,onError:u}=n,S=pc(()=>lc(r,e),[r,e]),R=a??t.branding??void 0,k=o??t.meta.language??"en",C=pc(()=>Sa(t.assessment),[t]),[v]=wm(()=>new Date().toISOString()),N=dc(async x=>{let y=await fetch(`${r}/api/v1/embed/submit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:e,answers:x})});if(!y.ok){let g=await y.json().catch(()=>({}));if(y.status===422&&g.code==="required_unanswered")throw new Error("required_unanswered");let P=typeof g.error=="string"?g.error:"Submission failed",A=y.status===401?"TOKEN_INVALID":y.status===409?"TOKEN_USED":y.status===404?"ASSESSMENT_NOT_FOUND":"UNKNOWN";throw u?.({code:A,message:P}),new Error(P)}let T=await y.json();return d?.(T),ka(T,s)},[r,e,d,u,s]),w=dc(x=>{if(s)try{let y=new URL(s);y.searchParams.set("submission_id",x.submissionId),!x.awaitingManualGrading&&!x.scoreHidden&&(y.searchParams.set("score",String(x.totalScore)),y.searchParams.set("max_score",String(x.maxScore))),window.location.href=y.toString()}catch{window.location.href=s}},[s]);return km(Dn,{assessment:C,meta:{title:t.meta.title,category:t.meta.category??null},locale:k,branding:R,scoreHidden:t.meta.score_hidden===!0,requiredQuestionIds:t.meta.required_question_ids,timeLimitMinutes:t.meta.settings.time_limit_minutes,startedAt:v,onSubmit:N,onViewReport:s?w:void 0,reportLabel:i,onBack:l,backLabel:c,overlayConfig:p,layout:f,mediaHandler:m,answerSheetHandler:h??S})}import{useMemo as mc}from"react";import{jsx as Rm}from"react/jsx-runtime";function Sm(){return Promise.reject(new Error("A review cannot be submitted"))}function fc({review:e,locale:t,branding:r,layout:n,onBack:o,backLabel:a}){let s=mc(()=>Sa(e.assessment),[e]),i=mc(()=>({answers:e.answers,result:ka({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,score_hidden:e.submission.score_hidden,exercise_feedback:e.exercise_feedback})}),[e]),c=t??e.meta.language??"en";return Rm(Dn,{assessment:s,meta:{title:e.meta.title,category:e.meta.category??null},locale:c,branding:r??e.branding??void 0,review:i,scoreHidden:e.submission.score_hidden===!0,onSubmit:Sm,onBack:o,backLabel:a,layout:n})}import Nm from"react";import{createRoot as _m}from"react-dom/client";import Cm,{useMemo as Am}from"react";import"katex/dist/katex.min.css";import{jsx as Ra}from"react/jsx-runtime";var hc=Cm.memo(function({content:t,onAnswersChange:r,feedback:n,initialAnswers:o,readOnly:a,className:s,dir:i}){let c=Am(()=>{if(n)return new Map(Object.entries(n))},[n]),l=Ra(er,{content:t,onAnswersChange:r,initialAnswers:o,validationFeedback:c,readOnly:a,className:s});return Ra("div",{className:"edpire-scope",style:{display:"contents"},children:i?Ra("div",{dir:i,children:l}):l})});function Pm(e){let{container:t,content:r,onAnswersChange:n,feedback:o,initialAnswers:a,readOnly:s,dir:i}=e,c=typeof t=="string"?document.querySelector(t):t;if(!c)throw new Error(`EdpireSDK.renderQuestion: container not found: ${String(t)}`);let l={content:r,onAnswersChange:n,feedback:o,initialAnswers:a,readOnly:s,dir:i},p=_m(c);function f(){p.render(Nm.createElement(hc,l))}return f(),{setContent(m){l={...l,content:m,feedback:null},f()},setFeedback(m){l={...l,feedback:m},f()},setInitialAnswers(m){l={...l,initialAnswers:m},f()},unmount(){p.unmount()}}}function Tm(e){let t=[],r=0;for(let n of e.exercises)for(let o of n.questions)t.push({exerciseId:n.id,questionId:o.id,content:o.content_ast,points:o.points,sequenceNumber:o.sequence_number,index:r++});return t}function Mm(e){let t=Fn(On(e.exercise_feedback)),r=new Map;for(let s of e.answers.exerciseAnswers)for(let i of s.questionAnswers)r.set(i.questionId,i.answers);let n=e.submission.score_hidden===!0,o=[],a=0;for(let s of e.assessment.exercises){let i=t.get(s.id);for(let c of s.questions){let l=i?.get(c.id),p=e.exercise_feedback.find(u=>u.exercise_id===s.id)?.questions.find(u=>u.question_id===c.id),f=p?.node_results??[],m=0,h=0,d=!1;for(let u of f)m+=u.score??0,h+=u.max_score??0,u.status==="awaiting_review"&&(d=!0);o.push({exerciseId:s.id,questionId:c.id,content:c.content,sharedContext:s.sharedContext??null,explanation:p?.explanation??null,answers:r.get(c.id)??[],feedback:l?Object.fromEntries(l):{},score:m,maxScore:h,scoreHidden:n,status:d?"awaiting_review":n?Em(f.map(u=>u.status)):h===0?"unscored":m>=h?"correct":m>0?"partial":"incorrect",index:a++})}}return o}function Em(e){return e.length===0?"unscored":e.every(t=>t==="correct")?"correct":e.every(t=>t==="incorrect")?"incorrect":"partial"}function Lm(e){let t=new Map;for(let r of e)t.has(r.exerciseId)||t.set(r.exerciseId,[]),t.get(r.exerciseId).push({questionId:r.questionId,answers:r.answers});return{exerciseAnswers:Array.from(t.entries()).map(([r,n])=>({exerciseId:r,questionAnswers:n}))}}var Im="https://edpire.com";function yc(e,t,r){e.textContent="";let n=document.createElement("div");n.style.cssText="padding:32px;text-align:center;color:#dc2626;font-family:sans-serif";let o=document.createElement("div");if(o.textContent=t,n.appendChild(o),r){let a=document.createElement("div");a.style.cssText="margin-top:8px;font-size:13px;color:#6b7280",a.textContent=r,n.appendChild(a)}e.appendChild(n)}var mw={mount(e){let{token:t,container:r,baseUrl:n=Im,onError:o}=e,a=typeof r=="string"?document.querySelector(r):r;if(!a){let l={code:"UNKNOWN",message:`Container not found: ${r}`};return o?.(l),{unmount:()=>{}}}let s=null,i=!1;function c(){if(i)return;i=!0;let l=s;s=null,setTimeout(()=>{l?.unmount()},0)}return(async()=>{a.innerHTML='<div style="padding:32px;text-align:center;color:#6b7280;font-family:sans-serif">Loading assessment\u2026</div>';let l;try{let p=await fetch(`${n}/api/v1/embed/assessments?token=${encodeURIComponent(t)}`,{method:"GET"});if(!p.ok){let f=await p.json().catch(()=>({})),m=typeof f.error=="string"?f.error:"Failed to load assessment",h=p.status===401?"TOKEN_INVALID":p.status===403?"ORIGIN_NOT_ALLOWED":p.status===404?"ASSESSMENT_NOT_FOUND":"UNKNOWN";o?.({code:h,message:m});let d=h==="ORIGIN_NOT_ALLOWED"?`Add ${typeof location<"u"?location.origin:"this origin"} to Allowed Embed Origins in Edpire, under Integrations then Origins.`:"";yc(a,m,d);return}l=await p.json()}catch{o?.({code:"NETWORK_ERROR",message:"Failed to connect to Edpire"}),yc(a,"Failed to connect to Edpire. Please try again.","");return}i||(a.innerHTML="",s=bc(a),s.render(gc.createElement(uc,{token:t,data:l,baseUrl:n,options:e})))})(),{unmount:c}},review(e){let{container:t,...r}=e,n=typeof t=="string"?document.querySelector(t):t;if(!n)return{unmount:()=>{}};n.textContent="";let o=bc(n);return o.render(gc.createElement(fc,r)),{unmount(){let a=o;o=null,setTimeout(()=>a?.unmount(),0)}}}};export{mw as EdpireAssessment,Lm as buildSubmitPayload,Tm as flattenAssessment,Mm as flattenReview,Pm as renderQuestion};
|
|
81
|
+
`;var bf=new Set(["choiceSet","inlineChoiceSet","blank","aiAnswerInput","matchingSet","openResponseNode","mathResponse","codingResponse"]),xf=new Set(["blankPool","inlinePool"]);function yf(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 t=e.answer;return t.recording||t.files&&t.files.length>0?!0:(t.text?.wordCount??0)>0}case"mathResponse":return e.answer.latex.trim().length>0;case"codingResponse":return e.answer.source.trim().length>0;default:{let t=e;return!0}}}function vf(e){let t=0,r=n=>{if(Array.isArray(n)){for(let s of n)r(s);return}if(!n||typeof n!="object")return;let{type:o,content:a}=n;if(typeof o=="string"){if(bf.has(o)){t+=1;return}if(xf.has(o))return}a!==void 0&&r(a)};return r(e),t}function Ha(e,t){let r=new Map;for(let o of t?.exerciseAnswers??[])for(let a of o.questionAnswers){let s=r.get(a.questionId);s||(s=new Set,r.set(a.questionId,s));for(let i of a.answers)yf(i)&&s.add(i.nodeId)}let n=[];return e.exercises.forEach((o,a)=>{o.questions.forEach((s,i)=>{let c=vf(s.content);c!==0&&(r.get(s.id)?.size??0)<c&&n.push({questionId:s.id,exerciseIndex:a,...o.title?{exerciseTitle:o.title}:{},questionIndex:i,only:o.questions.length===1})})}),n}function Ka(e,t,r){let n=new Set(r);return n.size===0?[]:Ha(e,t).filter(o=>n.has(o.questionId))}function Ua(e){let t=new Map;for(let r of e?.exerciseAnswers??[])for(let n of r.questionAnswers)t.set(n.questionId,n.answers);return t}function Lc(e){let t=new Set,r=n=>{if(Array.isArray(n)){for(let c of n)r(c);return}if(!n||typeof n!="object")return;let{type:o,id:a,attrs:s,content:i}=n;if(o==="openResponseNode"){let{mode:c,allowFormatting:l}=s??{};typeof a=="string"&&(c==="text"||c==="text+file")&&!l&&t.add(a);return}i!==void 0&&r(i)};for(let n of e.exercises)for(let o of n.questions)r(o.content);return t}function Wa(e){if(Array.isArray(e))return e.some(Wa);if(!e||typeof e!="object")return!1;let{text:t,content:r}=e;return typeof t=="string"||r!==void 0&&Wa(r)}function Ec(e,t){if(e.type!=="openResponse"||!t.has(e.nodeId))return!1;let r=e.answer.text;return r!==void 0&&!Wa(r.content)}function Ic(e,t,r){return t.size===0?e:{...e,exerciseAnswers:e.exerciseAnswers.map(n=>({...n,questionAnswers:n.questionAnswers.map(o=>{let a=t.get(o.questionId);return a?o.answers.length===0?{...o,answers:a}:o.answers.some(s=>Ec(s,r))?{...o,answers:o.answers.map(s=>{let i=s;if(i.type!=="openResponse"||!Ec(i,r))return s;let c=a.find(d=>d.nodeId===i.nodeId&&d.type==="openResponse"),l=c?.type==="openResponse"?c.answer.text:void 0;return l?{...i,answer:{...i.answer,text:l}}:s})}:o:o})}))}}var wf={exercise:"Exercise {index}",question:"Question {index}",points:"pts","points.one":"pt",submit:"Submit Assessment",submitting:"Submitting...",confirmTitle:"Submit Assessment",confirmDescription:"Are you sure you want to submit? You cannot change your answers after submitting.",unansweredOne:"1 question is not fully answered.",unansweredMany:"{count} questions are not fully answered.",unansweredMore:"and {count} more",confirmSubmit:"Submit",confirmCancel:"Cancel",assessmentPassed:"Assessment passed",assessmentNotPassed:"Assessment not passed",awaitingReview:"Awaiting review",awaitingReviewDesc:"Your teacher is reviewing your open responses. Your final score will be available once grading is complete.",submittedNoScore:"Your answers are in",submittedNoScoreDesc:"No score on this one: see below what you got right and what to look at again.",formThanks:"Thank you!",formThanksDesc:"Your answers have been sent.",formThanksClose:"You can close this page.",formSubmit:"Send",formSending:"Sending\u2026",formConfirmTitle:"Send your answers?",formConfirmDescription:"You won't be able to change them after sending.",required:"Required",requiredMissing:"This question is required",requiredBlocked:"A required question is unanswered: answer it, then send again.",continue:"Continue",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",explanation:"Explanation",reportGrade:"Report a marking mistake",reportGradePrompt:"What do you think is wrong with this mark?",reportGradeSend:"Send to my teacher",reportGradeCancel:"Cancel",reportGradeSent:"Sent to your teacher.",reportGradeFailed:"It could not be sent. Try again.",poweredBy:"Powered by Edpire",evaluating:"Evaluating your answers\u2026",aiEvaluating:"Some answers are being reviewed by AI, 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"},kf={exercise:"Exercice {index}",question:"Question {index}",points:"pts","points.one":"pt",submit:"Soumettre l'\xE9valuation",submitting:"Soumission...",confirmTitle:"Soumettre l'\xE9valuation",confirmDescription:"\xCAtes-vous s\xFBr de vouloir soumettre ? Vous ne pourrez pas modifier vos r\xE9ponses.",unansweredOne:"1 question n'est pas enti\xE8rement remplie.",unansweredMany:"{count} questions ne sont pas enti\xE8rement remplies.",unansweredMore:"et {count} autres",confirmSubmit:"Soumettre",confirmCancel:"Annuler",assessmentPassed:"\xC9valuation r\xE9ussie",assessmentNotPassed:"\xC9valuation non r\xE9ussie",awaitingReview:"En attente de correction",awaitingReviewDesc:"Votre professeur examine vos r\xE9ponses ouvertes. Votre note finale sera disponible une fois la correction termin\xE9e.",submittedNoScore:"Vos r\xE9ponses sont envoy\xE9es",submittedNoScoreDesc:"Pas de note pour celle-ci : voyez ci-dessous ce qui est juste et ce qu'il faut revoir.",formThanks:"Merci !",formThanksDesc:"Vos r\xE9ponses ont bien \xE9t\xE9 envoy\xE9es.",formThanksClose:"Vous pouvez fermer cette page.",formSubmit:"Envoyer",formSending:"Envoi\u2026",formConfirmTitle:"Envoyer vos r\xE9ponses ?",formConfirmDescription:"Vous ne pourrez plus les modifier ensuite.",required:"Obligatoire",requiredMissing:"R\xE9ponse obligatoire",requiredBlocked:"Une question obligatoire est sans r\xE9ponse : r\xE9pondez-y, puis envoyez \xE0 nouveau.",continue:"Continuer",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",explanation:"Explication",reportGrade:"Signaler une erreur de correction",reportGradePrompt:"Qu'est-ce qui vous semble faux dans cette note ?",reportGradeSend:"Envoyer \xE0 mon enseignant",reportGradeCancel:"Annuler",reportGradeSent:"Envoy\xE9 \xE0 votre enseignant.",reportGradeFailed:"L'envoi a \xE9chou\xE9. R\xE9essayez.",poweredBy:"Propuls\xE9 par Edpire",evaluating:"\xC9valuation de vos r\xE9ponses\u2026",aiEvaluating:"Certaines r\xE9ponses sont examin\xE9es par l'IA, 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"},Sf={exercise:"\u062A\u0645\u0631\u064A\u0646 {index}",question:"\u0633\u0624\u0627\u0644 {index}",points:"\u0646\u0642\u0637\u0629","points.two":"\u0646\u0642\u0637\u062A\u0627\u0646","points.few":"\u0646\u0642\u0627\u0637",submit:"\u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u062A\u0642\u064A\u064A\u0645",submitting:"\u062C\u0627\u0631\u064D \u0627\u0644\u0625\u0631\u0633\u0627\u0644...",confirmTitle:"\u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u062A\u0642\u064A\u064A\u0645",confirmDescription:"\u0647\u0644 \u0623\u0646\u062A \u0645\u062A\u0623\u0643\u062F \u0645\u0646 \u0627\u0644\u0625\u0631\u0633\u0627\u0644\u061F \u0644\u0646 \u062A\u062A\u0645\u0643\u0646 \u0645\u0646 \u062A\u063A\u064A\u064A\u0631 \u0625\u062C\u0627\u0628\u0627\u062A\u0643 \u0628\u0639\u062F \u0627\u0644\u0625\u0631\u0633\u0627\u0644.",unansweredOne:"\u0644\u0645 \u062A\u064F\u0643\u0645\u0644 \u0627\u0644\u0625\u062C\u0627\u0628\u0629 \u0639\u0646 \u0633\u0624\u0627\u0644 \u0648\u0627\u062D\u062F.",unansweredMany:"\u0644\u0645 \u062A\u064F\u0643\u0645\u0644 \u0627\u0644\u0625\u062C\u0627\u0628\u0629 \u0639\u0646 {count} \u0645\u0646 \u0627\u0644\u0623\u0633\u0626\u0644\u0629.",unansweredMore:"\u0648{count} \u0623\u062E\u0631\u0649",confirmSubmit:"\u0625\u0631\u0633\u0627\u0644",confirmCancel:"\u0625\u0644\u063A\u0627\u0621",assessmentPassed:"\u0627\u062C\u062A\u064A\u0627\u0632 \u0627\u0644\u062A\u0642\u064A\u064A\u0645",assessmentNotPassed:"\u0644\u0645 \u064A\u062A\u0645 \u0627\u062C\u062A\u064A\u0627\u0632 \u0627\u0644\u062A\u0642\u064A\u064A\u0645",awaitingReview:"\u0641\u064A \u0627\u0646\u062A\u0638\u0627\u0631 \u0627\u0644\u062A\u0635\u062D\u064A\u062D",awaitingReviewDesc:"\u064A\u0642\u0648\u0645 \u0645\u0639\u0644\u0645\u0643 \u0628\u0645\u0631\u0627\u062C\u0639\u0629 \u0625\u062C\u0627\u0628\u0627\u062A\u0643 \u0627\u0644\u0645\u0641\u062A\u0648\u062D\u0629. \u0633\u062A\u0638\u0647\u0631 \u0639\u0644\u0627\u0645\u062A\u0643 \u0627\u0644\u0646\u0647\u0627\u0626\u064A\u0629 \u0628\u0639\u062F \u0627\u0643\u062A\u0645\u0627\u0644 \u0627\u0644\u062A\u0635\u062D\u064A\u062D.",submittedNoScore:"\u062A\u0645 \u0625\u0631\u0633\u0627\u0644 \u0625\u062C\u0627\u0628\u0627\u062A\u0643",submittedNoScoreDesc:"\u0644\u0627 \u0639\u0644\u0627\u0645\u0629 \u0644\u0647\u0630\u0627 \u0627\u0644\u062A\u0642\u064A\u064A\u0645: \u0627\u0646\u0638\u0631 \u0623\u062F\u0646\u0627\u0647 \u0645\u0627 \u0623\u062C\u0628\u062A \u0639\u0646\u0647 \u0628\u0634\u0643\u0644 \u0635\u062D\u064A\u062D \u0648\u0645\u0627 \u064A\u062C\u0628 \u0645\u0631\u0627\u062C\u0639\u062A\u0647.",formThanks:"\u0634\u0643\u0631\u064B\u0627 \u0644\u0643!",formThanksDesc:"\u062A\u0645 \u0625\u0631\u0633\u0627\u0644 \u0625\u062C\u0627\u0628\u0627\u062A\u0643.",formThanksClose:"\u064A\u0645\u0643\u0646\u0643 \u0625\u063A\u0644\u0627\u0642 \u0647\u0630\u0647 \u0627\u0644\u0635\u0641\u062D\u0629.",formSubmit:"\u0625\u0631\u0633\u0627\u0644",formSending:"\u062C\u0627\u0631\u064D \u0627\u0644\u0625\u0631\u0633\u0627\u0644\u2026",formConfirmTitle:"\u0625\u0631\u0633\u0627\u0644 \u0625\u062C\u0627\u0628\u0627\u062A\u0643\u061F",formConfirmDescription:"\u0644\u0646 \u062A\u062A\u0645\u0643\u0646 \u0645\u0646 \u062A\u0639\u062F\u064A\u0644\u0647\u0627 \u0628\u0639\u062F \u0627\u0644\u0625\u0631\u0633\u0627\u0644.",required:"\u0645\u0637\u0644\u0648\u0628",requiredMissing:"\u0647\u0630\u0627 \u0633\u0624\u0627\u0644 \u0645\u0637\u0644\u0648\u0628",requiredBlocked:"\u0633\u0624\u0627\u0644 \u0645\u0637\u0644\u0648\u0628 \u0628\u0644\u0627 \u0625\u062C\u0627\u0628\u0629: \u0623\u062C\u0628 \u0639\u0646\u0647 \u062B\u0645 \u0623\u0631\u0633\u0644 \u0645\u0646 \u062C\u062F\u064A\u062F.",continue:"\u0645\u062A\u0627\u0628\u0639\u0629",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",explanation:"\u0634\u0631\u062D",reportGrade:"\u0627\u0644\u0625\u0628\u0644\u0627\u063A \u0639\u0646 \u062E\u0637\u0623 \u0641\u064A \u0627\u0644\u062A\u0635\u062D\u064A\u062D",reportGradePrompt:"\u0645\u0627 \u0627\u0644\u0630\u064A \u062A\u0631\u0627\u0647 \u062E\u0627\u0637\u0626\u064B\u0627 \u0641\u064A \u0647\u0630\u0627 \u0627\u0644\u0639\u062F\u062F\u061F",reportGradeSend:"\u0625\u0631\u0633\u0627\u0644 \u0625\u0644\u0649 \u0623\u0633\u062A\u0627\u0630\u064A",reportGradeCancel:"\u0625\u0644\u063A\u0627\u0621",reportGradeSent:"\u0623\u064F\u0631\u0633\u0644 \u0625\u0644\u0649 \u0623\u0633\u062A\u0627\u0630\u0643.",reportGradeFailed:"\u062A\u0639\u0630\u0651\u0631 \u0627\u0644\u0625\u0631\u0633\u0627\u0644. \u0623\u0639\u062F \u0627\u0644\u0645\u062D\u0627\u0648\u0644\u0629.",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\u060C \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"},gr={en:wf,fr:kf,ar:Sf};function Rf(e,t,r){let o=(gr[e]??gr.en)[t]??gr.en[t]??t;return r?Object.entries(r).reduce((a,[s,i])=>a.replace(`{${s}}`,String(i)),o):o}function $c(e,t){let r=new Intl.PluralRules(e).select(t),n=gr[e]??gr.en;return n[`points.${r}`]??n.points??gr.en.points}function Fc(e){return(t,r)=>Rf(e,t,r)}function Va(e){return e==="ar"}var Dc="48rem";function Qt(e,{insertAt:t}={}){if(!e||typeof document>"u")return;let r=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t==="top"&&r.firstChild?r.insertBefore(n,r.firstChild):r.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}Qt(`: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-blank-cell{display:flex;flex-wrap:wrap;align-items:center;gap:calc(.125rem * var(--edp-scale, 1)) calc(.25rem * var(--edp-scale, 1));width:100%}.player-blank-cell__box{position:relative;display:block;flex:1 1 100%;min-width:0}.player-typed-blank--cell{display:block;box-sizing:border-box;width:100%;min-width:6.5ch;padding:calc(1px * var(--edp-scale, 1)) calc(2px * var(--edp-scale, 1));font:inherit;font-weight:600;line-height:1.3;white-space:nowrap;overflow-x:hidden}.player-typed-blank-feedback--cell{display:block;box-sizing:border-box;width:max-content;min-width:100%;max-width:none;white-space:nowrap;overflow:visible}.player-blank-cell .player-blank-reveal{white-space:nowrap;font-size:.9em}.edp-table-arrows{display:flex;justify-content:flex-end}.edp-table-arrows--top{margin-bottom:calc(.375rem * var(--edp-scale, 1))}.edp-table-arrows--bottom{margin-top:calc(.375rem * var(--edp-scale, 1))}.edp-table-arrows__pair{display:inline-flex;gap:calc(.375rem * var(--edp-scale, 1))}.edp-table-arrow{display:inline-flex;align-items:center;justify-content:center;width:calc(1.875rem * var(--edp-scale, 1));height:calc(1.875rem * var(--edp-scale, 1));padding:0;border:1px solid var(--line-strong, #d6d3cc);border-radius:999px;background:var(--card, #ffffff);color:var(--ink, #1d2025);cursor:pointer;transition:border-color .15s,background .15s,opacity .15s;-webkit-tap-highlight-color:transparent}.edp-table-arrow:hover:not(:disabled){border-color:var(--ink, #1d2025);background:var(--ui-muted, #f5f4f1)}.edp-table-arrow:focus-visible{outline:2px solid var(--ink, #1d2025);outline-offset:2px}.edp-table-arrow:disabled{opacity:.35;cursor:default}.edp-table-shade{position:absolute;top:0;bottom:0;width:calc(1.5rem * var(--edp-scale, 1));pointer-events:none;z-index:2}.edp-table-shade--left{background:linear-gradient(to right,#1d202529,#1d202500)}.edp-table-shade--right{background:linear-gradient(to left,#1d202529,#1d202500)}@media(max-width:640px){.edp-table-first{max-width:38vw}}.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;-webkit-touch-callout: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}.player-bank-pill--hinted{position:relative}.player-tap-hint{position:absolute;left:calc(50% - 10px * var(--edp-scale, 1));top:50%;width:calc(30px * var(--edp-scale, 1));height:calc(30px * var(--edp-scale, 1));z-index:2;pointer-events:none;color:var(--ink, #1d2025)}.player-tap-hint__hand{display:block;width:100%;height:100%;opacity:.92;filter:drop-shadow(0 2px 3px rgba(29,32,37,.25));transform-origin:33% 8%;animation:edp-tap-hand 1.8s ease-in-out infinite}.player-tap-hint__ripple{position:absolute;left:calc(10px * var(--edp-scale, 1) - 11px);top:-11px;width:22px;height:22px;border-radius:999px;border:2px solid var(--ink, #1d2025);opacity:0;animation:edp-tap-ripple 1.8s ease-out infinite}@keyframes edp-tap-hand{0%,to{transform:translateY(12px)}30%{transform:translateY(0) scale(1)}38%{transform:translateY(1px) scale(.88)}48%{transform:translateY(0) scale(1)}75%{transform:translateY(12px)}}@keyframes edp-tap-ripple{0%,34%{opacity:0;transform:scale(.4)}40%{opacity:.45;transform:scale(.6)}70%{opacity:0;transform:scale(1.5)}to{opacity:0}}.player-tap-hint--still .player-tap-hint__hand,.player-tap-hint--still .player-tap-hint__ripple{animation:none}@media(prefers-reduced-motion:reduce){.player-tap-hint__hand,.player-tap-hint__ripple{animation:none}}.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))}}.edp-slot-line{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;white-space:pre-line}.player-ai-lines{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:calc(.5rem * var(--edp-scale, 1))}.player-ai-line-head{display:flex;align-items:baseline;justify-content:space-between;gap:calc(.75rem * var(--edp-scale, 1))}.player-ai-line-label{font-weight:600;min-width:0;overflow-wrap:anywhere}.player-ai-line-mark{flex-shrink:0;font-variant-numeric:tabular-nums;font-weight:600;white-space:nowrap}.player-ai-line-mark--full{color:var(--ok, #1f8a4c)}.player-ai-line-mark--part{color:var(--almost-ink, #8a5a08)}.player-ai-line-mark--none{color:var(--pen, #d23b2b)}.player-ai-line-text{margin:calc(.125rem * var(--edp-scale, 1)) 0 0;color:var(--ink, #1d2025)}.player-ai-next{display:flex;gap:calc(.4rem * var(--edp-scale, 1));margin:calc(.25rem * var(--edp-scale, 1)) 0 0;padding-block-start:calc(.5rem * var(--edp-scale, 1));border-block-start:1px solid color-mix(in srgb,currentColor 22%,transparent);font-weight:500}.player-ai-next-mark{flex-shrink:0}.player-ai-next-mark:dir(rtl){transform:scaleX(-1)}.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,.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)}.edp-audio{--edp-a: var(--edp-scale, 1);display:flex;flex-direction:column;gap:calc(.25rem * var(--edp-a));width:100%;max-width:100%;margin:calc(.5rem * var(--edp-a)) 0;font-size:calc(.875rem * var(--edp-a));line-height:1.4;vertical-align:middle}.edp-audio-bar{display:flex;align-items:center;gap:calc(.75rem * var(--edp-a));min-width:0;padding:calc(.375rem * var(--edp-a));padding-inline-end:calc(.75rem * var(--edp-a));background:#fff;border:1px solid var(--line, #e7e5e0);border-radius:999px}.edp-audio-play{flex:none;display:inline-flex;align-items:center;justify-content:center;width:calc(2.75rem * var(--edp-a));height:calc(2.75rem * var(--edp-a));border:0;border-radius:999px;background:var(--ink, #1d2025);color:#fff;cursor:pointer;transition:transform 90ms ease-out,background-color .18s ease-out}.edp-audio-play:hover:not(:disabled){background:#33373e}.edp-audio-play:active:not(:disabled){transform:scale(.94)}.edp-audio-play:focus-visible,.edp-audio-speed:focus-visible,.edp-audio-track:focus-visible{outline:2px solid var(--ink, #1d2025);outline-offset:2px}.edp-audio-play:disabled{background:var(--line-strong, #d6d3cc);cursor:not-allowed}.edp-audio-play svg{width:calc(1.125rem * var(--edp-a));height:calc(1.125rem * var(--edp-a))}.edp-audio-track{position:relative;flex:1 1 auto;min-width:calc(3rem * var(--edp-a));height:calc(2rem * var(--edp-a));display:flex;align-items:center;touch-action:none;border-radius:4px}.edp-audio-track--seek{cursor:pointer}.edp-audio-rail{position:relative;display:block;width:100%;height:4px;border-radius:999px;background:var(--line, #e7e5e0);overflow:hidden}.edp-audio-fill{position:absolute;inset-block:0;inset-inline-start:0;background:var(--ink, #1d2025);border-radius:999px}.edp-audio-thumb{position:absolute;top:50%;width:12px;height:12px;margin-inline-start:-6px;margin-top:-6px;border-radius:999px;background:var(--ink, #1d2025);box-shadow:0 0 0 3px #fff;transition:transform .15s ease-out;pointer-events:none}.edp-audio-track--seek:hover .edp-audio-thumb,.edp-audio-track--seek:focus-visible .edp-audio-thumb{transform:scale(1.25)}.edp-audio-time{flex:none;min-width:2.6em;text-align:end;font-variant-numeric:tabular-nums;color:var(--ink-soft, #565b66);unicode-bidi:isolate}.edp-audio-speed{flex:none;min-width:3.1em;height:calc(1.75rem * var(--edp-a));padding:0 .5em;border:1px solid var(--line-strong, #d6d3cc);border-radius:999px;background:var(--ui-muted, #f5f4f1);color:var(--ink, #1d2025);font:inherit;font-size:.85em;font-weight:600;font-variant-numeric:tabular-nums;cursor:pointer;transition:border-color .18s ease-out}.edp-audio-speed:hover:not(:disabled){border-color:var(--ink-faint, #8d93a0)}.edp-audio-speed:active:not(:disabled){transform:scale(.97)}.edp-audio-note{display:block;margin:0;padding-inline-start:calc(.75rem * var(--edp-a));font-size:.9em;color:var(--ink-soft, #565b66)}.edp-audio--off .edp-audio-bar{background:var(--ui-muted, #f5f4f1)}.edp-audio--off .edp-audio-fill{background:var(--ink-faint, #8d93a0)}@media(max-width:380px){.edp-audio-bar{gap:calc(.5rem * var(--edp-a))}}@media(pointer:coarse){.edp-audio-speed{height:calc(2.5rem * var(--edp-a));min-width:3.6em}}.edp-rec{--edp-a: var(--edp-scale, 1);display:flex;flex-direction:column;gap:calc(.75rem * var(--edp-a));padding:calc(1rem * var(--edp-a));border:1px solid var(--line, #e7e5e0);border-radius:14px;background:#fff;font-size:calc(.9375rem * var(--edp-a));line-height:1.4}.edp-rec .edp-audio{margin:0}.edp-rec-idle{display:flex;flex-direction:column;align-items:center;gap:calc(.5rem * var(--edp-a));padding:calc(.5rem * var(--edp-a)) 0}.edp-rec-record{display:inline-flex;align-items:center;justify-content:center;width:calc(4rem * var(--edp-a));height:calc(4rem * var(--edp-a));border:0;border-radius:999px;background:var(--pen, #d23b2b);color:#fff;cursor:pointer;box-shadow:0 0 0 5px var(--pen-soft, #fdeeec);transition:transform 90ms ease-out,box-shadow .18s ease-out}.edp-rec-record:hover:not(:disabled){box-shadow:0 0 0 7px var(--pen-soft, #fdeeec)}.edp-rec-record:active:not(:disabled){transform:scale(.95)}.edp-rec-record:disabled{background:var(--line-strong, #d6d3cc);box-shadow:none;cursor:not-allowed}.edp-rec-record svg{width:calc(1.6rem * var(--edp-a));height:calc(1.6rem * var(--edp-a))}.edp-rec-record:focus-visible,.edp-rec-stop:focus-visible,.edp-rec-link:focus-visible{outline:2px solid var(--ink, #1d2025);outline-offset:3px}.edp-rec-label{font-weight:600;color:var(--ink, #1d2025)}.edp-rec-limit{font-size:.9em;color:var(--ink-soft, #565b66);font-variant-numeric:tabular-nums}.edp-rec-live{display:flex;align-items:center;gap:calc(.75rem * var(--edp-a))}.edp-rec-level{flex:1 1 auto;min-width:0;width:100%;height:calc(2.5rem * var(--edp-a));display:block}.edp-rec-clock{flex:none;display:inline-flex;align-items:center;gap:.4em;font-variant-numeric:tabular-nums;color:var(--ink, #1d2025);unicode-bidi:isolate}.edp-rec-clock small{color:var(--ink-faint, #8d93a0);font-size:.9em}.edp-rec-dot{width:.6em;height:.6em;border-radius:999px;background:var(--pen, #d23b2b);animation:edp-rec-dot 1.2s ease-in-out infinite}@keyframes edp-rec-dot{50%{opacity:.35}}.edp-rec-stop{flex:none;display:inline-flex;align-items:center;gap:.45em;height:calc(2.5rem * var(--edp-a));padding:0 1em;border:1px solid var(--ink, #1d2025);border-radius:999px;background:var(--ink, #1d2025);color:#fff;font:inherit;font-weight:600;cursor:pointer}.edp-rec-stop{transition:background-color .18s ease-out,transform 90ms ease-out}.edp-rec-stop:hover{background:#33373e}.edp-rec-stop:active{transform:scale(.97)}.edp-rec-stop i{display:inline-block;width:.7em;height:.7em;border-radius:2px;background:currentColor}.edp-rec-foot{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:calc(.5rem * var(--edp-a)) calc(1rem * var(--edp-a));min-height:1.75em}.edp-rec-status{display:inline-flex;align-items:center;gap:.4em;color:var(--ink-soft, #565b66)}.edp-rec-status--ok{color:var(--ok, #1f8a4c);font-weight:600}.edp-rec-status--error{color:var(--ink, #1d2025)}.edp-rec-status--error svg{color:var(--ink, #1d2025);flex:none}.edp-rec-progress{flex:1 1 8rem;height:4px;border-radius:999px;background:var(--line, #e7e5e0);overflow:hidden}.edp-rec-progress>span{display:block;height:100%;background:var(--ink, #1d2025);transition:width .15s ease-out}.edp-rec-link{font:inherit;font-weight:600;color:var(--ink, #1d2025);background:none;border:0;padding:.25em 0;cursor:pointer;text-decoration:underline;text-underline-offset:3px}.edp-rec-link:hover{text-decoration-thickness:2px}@media(pointer:coarse){.edp-rec-link{min-height:2.5rem;padding:0 .25em}}.edp-rec-level:dir(rtl){transform:scaleX(-1)}.edp-rec-message{margin:0;color:var(--ink-soft, #565b66);text-align:center}.edp-rec video{width:100%;max-height:16rem;border-radius:10px;background:#000}@media(prefers-reduced-motion:reduce){.edp-rec-dot{animation:none}.edp-audio-play,.edp-audio-thumb,.edp-rec-record,.edp-rec-stop,.edp-rec-progress>span{transition:none}}.player-ai--sheet{padding:0;border:none;background:transparent}.edp-sheet-box{display:flex;flex-direction:column;overflow:hidden;border:1px solid var(--line-strong, #d6d3cc);border-radius:calc(.625rem * var(--edp-scale, 1));background:var(--card, #ffffff);color:var(--ink, #1d2025);transition:border-color .18s ease}.edp-sheet-box:focus-within{border-color:var(--ink, #1d2025)}.edp-sheet--readonly .edp-sheet-box{background:var(--paper, #fbfaf7)}.edp-sheet.player-ai-input--correct,.edp-sheet.player-ai-input--incorrect,.edp-sheet.player-ai-input--partial{border:none;background:transparent}.edp-sheet.player-ai-input--correct .edp-sheet-box{border-color:var(--ok, #1f8a4c);background:var(--ok-soft, #ecf8f0)}.edp-sheet.player-ai-input--incorrect .edp-sheet-box{border-color:var(--pen, #d23b2b);background:var(--pen-soft, #fdeeec)}.edp-sheet.player-ai-input--partial .edp-sheet-box{border-color:var(--almost, #c8810e);border-style:dashed;background:var(--almost-soft, #fbf1dc)}.edp-sheet-page{position:relative;padding:calc(.75rem * var(--edp-scale, 1)) calc(.875rem * var(--edp-scale, 1));min-height:calc(132px * var(--edp-scale, 1));font-size:calc(1rem * var(--edp-scale, 1));line-height:1.85}.edp-sheet-doc p.is-editor-empty:first-child:before{content:attr(data-placeholder);float:inline-start;height:0;color:var(--ink-faint, #8d93a0);pointer-events:none}.edp-sheet-box .edp-sheet-doc{outline:none;padding:0;min-height:calc(108px * var(--edp-scale, 1));white-space:pre-wrap;overflow-wrap:break-word}.edp-sheet-doc p{margin:0}.edp-sheet-box--compact .edp-sheet-page{min-height:0;padding:calc(.375rem * var(--edp-scale, 1)) calc(.625rem * var(--edp-scale, 1));line-height:1.6}.edp-sheet-box--compact .edp-sheet-doc{min-height:calc(3.2em * var(--edp-scale, 1))}.edp-sheet-box--line .edp-sheet-doc{min-height:1.6em;white-space:pre;overflow-x:auto;scrollbar-width:none}.edp-sheet-box--compact:not(.edp-sheet-box--keys-open) .edp-sheet-keys{display:none}.edp-sheet-doc ul,.edp-sheet-doc ol{margin:0;padding-inline-start:calc(1.25rem * var(--edp-scale, 1))}.edp-sheet-formula{display:inline;unicode-bidi:isolate}.edp-sheet-line{display:block;unicode-bidi:isolate;margin:calc(.125rem * var(--edp-scale, 1)) 0}.edp-sheet-mf{display:inline-block;min-width:1ch;padding:0 calc(.1875rem * var(--edp-scale, 1));margin:0;vertical-align:baseline;font-size:1.05em;color:inherit;border:none;border-radius:calc(.3125rem * var(--edp-scale, 1));background:transparent;outline:none;transition:background-color .18s ease;--caret-color: var(--ink, #1d2025);--selection-background-color: var(--line, #e8e5de);--contains-highlight-background-color: transparent;--smart-fence-color: var(--ink-faint, #8d93a0);--placeholder-color: var(--ink-faint, #8d93a0)}.edp-sheet-mf:focus-within{background:var(--paper-deep, #f4f1ea)}.edp-sheet-mf::part(container),.edp-sheet-mf::part(content){padding:0}.edp-sheet-mf::part(menu-toggle),.edp-sheet-mf::part(virtual-keyboard-toggle){display:none}math-field::part(keyboard-sink){left:auto!important;caret-color:transparent}.edp-sheet-formula .edp-sheet-static{display:inline}.edp-sheet-line .edp-sheet-static{display:block;max-width:100%;overflow-x:auto}.edp-sheet-line.edp-sheet-line--centred[dir]{text-align:center;margin:calc(.375rem * var(--edp-scale, 1)) 0}.edp-sheet-formula,.edp-sheet-line{position:relative}.edp-math-chip{position:absolute;z-index:2;inset-block-start:50%;inset-inline-start:100%;translate:2px -50%;display:none;gap:1px;padding:1px;font:600 .75rem/1 system-ui,sans-serif;background:var(--card, #ffffff);border:1px solid var(--line, #e8e5de);border-radius:999px;box-shadow:0 1px 2px #00000014;user-select:none}.edp-math-chip:after{content:"";position:absolute;inset-block:0;inset-inline-end:100%;width:4px}.edp-sheet-line-box{position:relative;display:inline-block;max-width:100%}.edp-sheet-formula:hover>.edp-math-chip,.edp-sheet-line:hover .edp-math-chip{display:inline-flex}@media(hover:none){.edp-math-chip{display:none!important}}.edp-math-chip-btn{display:inline-flex;align-items:center;justify-content:center;width:1.375rem;height:1.375rem;padding:0;font:inherit;color:var(--ink-soft, #5b6170);background:transparent;border:none;border-radius:999px;cursor:pointer;touch-action:manipulation}.edp-math-chip-btn:hover{color:var(--ink, #1d2025);background:var(--paper-deep, #f4f1ea)}.edp-math-chip-btn:focus-visible{outline:2px solid var(--pen, #d23b2b);outline-offset:1px}.edp-math-chip-btn[aria-pressed=true]{color:var(--pen, #d23b2b)}@media(pointer:coarse){.edp-math-chip-btn{width:1.75rem;height:1.75rem}}.edp-sheet-keys{display:flex;flex-wrap:wrap;align-items:center;gap:calc(.25rem * var(--edp-scale, 1));padding:calc(.375rem * var(--edp-scale, 1)) calc(.5rem * var(--edp-scale, 1));border-top:1px solid var(--line, #e8e5de);background:var(--paper, #fbfaf7)}.edp-sheet-key{display:inline-flex;align-items:center;justify-content:center;gap:calc(.3125rem * var(--edp-scale, 1));min-width:calc(2.25rem * var(--edp-scale, 1));height:calc(2.25rem * var(--edp-scale, 1));padding:0 calc(.5rem * var(--edp-scale, 1));font-family:KaTeX_Main,Times New Roman,serif;font-size:calc(1.0625rem * var(--edp-scale, 1));line-height:1;color:var(--ink, #1d2025);background:var(--card, #ffffff);border:1px solid var(--line, #e8e5de);border-radius:calc(.5rem * var(--edp-scale, 1));cursor:pointer;touch-action:manipulation;transition:background-color .18s ease,border-color .18s ease}.edp-sheet-key:hover,.edp-sheet-key.is-active{background:var(--paper-deep, #f4f1ea);border-color:var(--line-strong, #d6d3cc)}.edp-sheet-key:active{background:var(--line, #e8e5de)}.edp-sheet-key:focus-visible{outline:2px solid var(--ink, #1d2025);outline-offset:2px}.edp-key-pow sup{margin-inline-start:.05em;font-size:.62em;line-height:0}.edp-key-frac{display:inline-flex;flex-direction:column;align-items:center;font-size:.72em;line-height:1.1}.edp-key-frac>span:first-child{padding:0 .15em;border-bottom:1px solid currentColor}.edp-sheet-key--convert{font-weight:600}.edp-sheet-key--convert.is-text{font-family:inherit;font-size:calc(.875rem * var(--edp-scale, 1))}.edp-sheet-key--more,.edp-sheet-key--tool{font-family:inherit;font-size:calc(.8125rem * var(--edp-scale, 1));font-weight:500}.edp-sheet-keys-extra{display:inline-flex;flex-wrap:wrap;gap:calc(.25rem * var(--edp-scale, 1));margin-inline-start:auto}.edp-sheet-notice{margin:0 0 calc(.5rem * var(--edp-scale, 1));padding:calc(.5rem * var(--edp-scale, 1)) calc(.75rem * var(--edp-scale, 1));font-size:calc(.875rem * var(--edp-scale, 1));color:var(--ink, #1d2025);background:var(--almost-soft, #fbf1dc);border-radius:calc(.5rem * var(--edp-scale, 1))}.edp-sheet-photos{display:flex;flex-wrap:wrap;align-items:center;gap:calc(.5rem * var(--edp-scale, 1));padding:calc(.5rem * var(--edp-scale, 1)) 0 0}.edp-sheet-photos-label{font-size:calc(.8125rem * var(--edp-scale, 1));color:var(--ink-soft, #5b6170)}.edp-sheet-photo{position:relative;display:inline-block}.edp-sheet-photo img{display:block;width:calc(4rem * var(--edp-scale, 1));height:calc(4rem * var(--edp-scale, 1));object-fit:cover;border-radius:calc(.375rem * var(--edp-scale, 1));border:1px solid var(--line, #e8e5de)}.edp-sheet-photo-remove{position:absolute;top:calc(-.5rem * var(--edp-scale, 1));inset-inline-end:calc(-.5rem * var(--edp-scale, 1));width:calc(1.5rem * var(--edp-scale, 1));height:calc(1.5rem * var(--edp-scale, 1));border-radius:999px;border:1px solid var(--line-strong, #d6d3cc);background:var(--card, #ffffff);color:var(--ink, #1d2025);cursor:pointer;line-height:1}.edp-sheet-panel{margin:calc(.5rem * var(--edp-scale, 1)) 0 0;padding:calc(.75rem * var(--edp-scale, 1));border:1px solid var(--line, #e8e5de);border-radius:calc(.625rem * var(--edp-scale, 1));background:var(--paper, #fbfaf7)}.edp-sheet-panel-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:calc(.5rem * var(--edp-scale, 1));font-size:calc(.9375rem * var(--edp-scale, 1))}.edp-sheet-panel-close{width:calc(2.25rem * var(--edp-scale, 1));height:calc(2.25rem * var(--edp-scale, 1));border:none;border-radius:calc(.5rem * var(--edp-scale, 1));background:transparent;font-size:calc(1.25rem * var(--edp-scale, 1));color:var(--ink-soft, #5b6170);cursor:pointer}.edp-sheet-panel-actions{display:flex;flex-wrap:wrap;gap:calc(.5rem * var(--edp-scale, 1))}.edp-sheet-btn{min-height:calc(2.5rem * var(--edp-scale, 1));padding:0 calc(.875rem * var(--edp-scale, 1));font-size:calc(.9375rem * var(--edp-scale, 1));font-weight:500;color:var(--ink, #1d2025);background:var(--card, #ffffff);border:1px solid var(--line-strong, #d6d3cc);border-radius:calc(.5rem * var(--edp-scale, 1));cursor:pointer;touch-action:manipulation}.edp-sheet-btn--primary{color:#fff;background:var(--ink, #1d2025);border-color:var(--ink, #1d2025)}.edp-sheet-btn:disabled{opacity:.45;cursor:default}.edp-sheet-btn,.edp-sheet-panel-close,.edp-sheet-photo-remove{transition:background-color .18s ease,border-color .18s ease}.edp-sheet-btn:hover:not(:disabled){background:var(--paper-deep, #f4f1ea);border-color:var(--ink, #1d2025)}.edp-sheet-btn--primary:hover:not(:disabled){background:var(--ink-soft, #2c313b)}.edp-sheet-panel-close:hover,.edp-sheet-photo-remove:hover{background:var(--paper-deep, #f4f1ea);color:var(--ink, #1d2025)}.edp-sheet-btn:focus-visible,.edp-sheet-panel-close:focus-visible,.edp-sheet-photo-remove:focus-visible{outline:2px solid var(--ink, #1d2025);outline-offset:2px}.edp-sheet-qr{display:flex;align-items:center;gap:calc(.875rem * var(--edp-scale, 1))}.edp-sheet-qr img,.edp-sheet-qr-wait{flex:none;width:calc(168px * var(--edp-scale, 1));height:calc(168px * var(--edp-scale, 1));border-radius:calc(.5rem * var(--edp-scale, 1));background:var(--card, #ffffff);border:1px solid var(--line, #e8e5de)}.edp-sheet-qr p{margin:0;font-size:calc(.9375rem * var(--edp-scale, 1));line-height:1.5}.edp-sheet-or{margin:calc(.625rem * var(--edp-scale, 1)) 0 calc(.375rem * var(--edp-scale, 1));font-size:calc(.8125rem * var(--edp-scale, 1));color:var(--ink-soft, #5b6170)}.edp-sheet-camera video{display:block;width:100%;max-height:calc(320px * var(--edp-scale, 1));margin-bottom:calc(.5rem * var(--edp-scale, 1));border-radius:calc(.5rem * var(--edp-scale, 1));background:#000}.edp-sheet-progress{display:flex;align-items:center;gap:calc(.5rem * var(--edp-scale, 1));margin:0;font-size:calc(.9375rem * var(--edp-scale, 1))}.edp-sheet-error p{margin:0 0 calc(.5rem * var(--edp-scale, 1));color:var(--pen, #d23b2b);font-size:calc(.9375rem * var(--edp-scale, 1))}.edp-sheet-pad-result{display:flex;align-items:center;gap:calc(.5rem * var(--edp-scale, 1));min-height:calc(2.5rem * var(--edp-scale, 1));margin-bottom:calc(.5rem * var(--edp-scale, 1));font-size:calc(1.6rem * var(--edp-scale, 1))}.edp-sheet-pad-help{font-size:calc(.875rem * var(--edp-scale, 1));color:var(--ink-soft, #5b6170)}.edp-sheet-pad{display:block;width:100%;height:calc(180px * var(--edp-scale, 1));margin-bottom:calc(.5rem * var(--edp-scale, 1));background:#fff;border:1px solid var(--line-strong, #d6d3cc);border-radius:calc(.5rem * var(--edp-scale, 1));touch-action:none;cursor:crosshair}@media(max-width:480px){.edp-sheet-key{min-width:calc(2.5rem * var(--edp-scale, 1));height:calc(2.5rem * var(--edp-scale, 1))}.edp-sheet-keys-extra{margin-inline-start:0}.edp-sheet-photo-remove{width:calc(2.5rem * var(--edp-scale, 1));height:calc(2.5rem * var(--edp-scale, 1))}.edp-sheet-qr{flex-direction:column;align-items:flex-start}}@media(prefers-reduced-motion:reduce){.edp-sheet-box,.edp-sheet-mf,.edp-sheet-key,.edp-sheet-btn,.edp-sheet-panel-close,.edp-sheet-photo-remove{transition:none}}.edp-math-text-formula{unicode-bidi:isolate;white-space:nowrap}.edp-kb{position:fixed;inset-inline:0;bottom:0;z-index:var(--edp-kb-z, 9000);color:var(--ink, #1d2025);font-family:system-ui,-apple-system,Segoe UI,sans-serif;user-select:none;-webkit-user-select:none;-webkit-tap-highlight-color:transparent;touch-action:manipulation}.edp-kb[hidden]{display:none}.edp-kb button{-webkit-tap-highlight-color:transparent;touch-action:manipulation}.edp-kb-spacer{display:block;pointer-events:none}.edp-kb-bar{display:flex;align-items:center;gap:4px;padding:4px 6px calc(4px + var(--edp-kb-under, 0px));background:#efece5;border-top:1px solid var(--line-strong, #d6d3cc)}.edp-kb-bar-keys{display:flex;flex:1 1 auto;gap:4px;min-width:0}.edp-kb-panel{padding:6px 6px max(8px,env(safe-area-inset-bottom));background:#efece5;border-top:1px solid var(--line-strong, #d6d3cc);box-shadow:0 -6px 18px #1d202514}.edp-kb[data-view=desk-panel]{inset-inline:auto;left:50%;bottom:12px;width:min(760px,calc(100vw - 24px));translate:-50% 0}.edp-kb[data-view=desk-panel] .edp-kb-panel{padding:8px;border:1px solid var(--line-strong, #d6d3cc);border-radius:14px;box-shadow:0 10px 30px #1d202529}.edp-kb-head{display:flex;align-items:center;gap:4px;margin-bottom:6px}.edp-kb-tabs{display:flex;flex:1 1 auto;align-items:center;gap:2px;min-width:0;overflow-x:auto;scrollbar-width:none}.edp-kb-tabs::-webkit-scrollbar{display:none}.edp-kb-tab{flex:0 0 auto;height:34px;padding:0 8px;font:600 13px/1 system-ui,-apple-system,Segoe UI,sans-serif;color:var(--ink-soft, #565b66);background:transparent;border:1px solid transparent;border-radius:8px;cursor:pointer;white-space:nowrap}.edp-kb-tab[aria-selected=true]{color:var(--ink, #1d2025);background:var(--card, #ffffff);border-color:var(--line-strong, #d6d3cc)}.edp-kb-tabs-end{display:flex;flex:0 0 auto;gap:4px}.edp-kb-keys{display:flex;flex-direction:column;gap:6px}.edp-kb-row{display:flex;gap:5px}.edp-kb-key,.edp-kb-action{display:inline-flex;align-items:center;justify-content:center;min-width:0;height:44px;padding:0 2px;overflow:hidden;color:var(--ink, #1d2025);background:var(--card, #ffffff);border:1px solid var(--line, #e7e5e0);border-bottom:2px solid var(--line-strong, #d6d3cc);border-radius:8px;cursor:pointer}.edp-kb-key{flex:1 1 0;font-family:KaTeX_Main,Times New Roman,serif;font-size:18px;line-height:1}.edp-kb-bar .edp-kb-key,.edp-kb-bar .edp-kb-action{height:40px}.edp-kb-key .katex{font-size:1em}.edp-kb-key--small .katex{font-size:.6em}.edp-kb-key--command{font-family:system-ui,-apple-system,Segoe UI,sans-serif;font-size:17px;background:#e2ded5}.edp-kb-key:active,.edp-kb-action:active{background:var(--line, #e7e5e0);translate:0 1px}.edp-kb-action{flex:0 0 auto;min-width:44px;padding:0 10px;font:600 15px/1 system-ui,-apple-system,Segoe UI,sans-serif}.edp-kb-switch{display:inline-flex;flex:0 0 auto;gap:2px;padding:2px;background:#e2ded5;border-radius:10px}.edp-kb-switch .edp-kb-action{min-width:40px;height:40px;padding:0 8px}.edp-kb-bar .edp-kb-switch .edp-kb-action{height:36px}.edp-kb-switch .edp-kb-action.is-current{color:#fff;background:var(--ink, #1d2025);border-color:var(--ink, #1d2025);cursor:default;translate:none}.edp-kb-abc{font-size:15px}.edp-kb-sigma{font-size:18px}.edp-kb-convert{font:italic 600 17px/1 KaTeX_Main,Times New Roman,serif}.edp-kb-convert.is-text{font:600 15px/1 system-ui,-apple-system,Segoe UI,sans-serif}.edp-kb-close{min-width:40px;height:34px;padding:0 8px;color:var(--ink-soft, #565b66);background:transparent;border-color:transparent}.edp-kb[data-view=desk-panel] .edp-kb-key,.edp-kb[data-view=desk-panel] .edp-kb-action:not(.edp-kb-close){height:40px}@media(hover:hover){.edp-kb-key:hover,.edp-kb-action:hover{background:var(--paper-deep, #f4f1ea)}.edp-kb-switch .edp-kb-action.is-current:hover{background:var(--ink, #1d2025)}.edp-kb-tab:not([aria-selected=true]):hover{color:var(--ink, #1d2025);background:#ffffff8c}}.edp-kb button:focus-visible{outline:2px solid var(--ink, #1d2025);outline-offset:2px}@media(pointer:coarse){.edp-kb-tab,.edp-kb-close{height:40px}}@media(max-width:380px){.edp-kb-key{font-size:16px}.edp-kb-row{gap:4px}}@media(prefers-reduced-motion:reduce){.edp-kb-key:active,.edp-kb-action:active{translate:none}}@media(pointer:coarse){.edp-sheet-keys>.edp-sheet-key:not(.edp-sheet-key--tool){display:none}.edp-sheet-keys:not(:has(.edp-sheet-key--tool)){display:none}.edp-sheet-keys-extra{margin-inline-start:0}}.edp-slot-wrap{display:inline}.edp-slot{position:relative;display:inline-grid;grid-template-columns:minmax(0,auto) auto;align-items:center;max-width:100%;min-width:6ch;min-height:1.9em;padding:0 .3em;vertical-align:middle;color:var(--ink, #1d2025);background:var(--ui-muted, #f5f4f1);border:1px solid var(--line-strong, #d6d3cc);border-bottom-width:2px;border-radius:4px;cursor:text;unicode-bidi:isolate;transition:border-color .18s ease,background-color .18s ease}@media(hover:hover){.edp-slot:not(.edp-slot--readonly):not(.is-active):hover{border-color:var(--ink-soft, #565b66)}.edp-slot-kb:hover{color:var(--ink, #1d2025)}}.edp-slot.is-active,.edp-slot:focus-within{background:var(--card, #ffffff);border-color:var(--ink, #1d2025)}.edp-slot-mf{display:inline-block;min-width:4ch;max-width:100%;padding:0;font-size:1.05em;color:inherit;background:transparent;border:none;outline:none;--caret-color: var(--ink, #1d2025);--selection-background-color: var(--line, #e7e5e0);--contains-highlight-background-color: transparent;--smart-fence-color: var(--ink-faint, #8d93a0);--placeholder-color: var(--ink-faint, #8d93a0)}.edp-slot-mf::part(virtual-keyboard-toggle),.edp-slot-mf::part(menu-toggle){display:none}.edp-slot-mf::part(container),.edp-slot-mf::part(content){padding:0}.edp-slot>.edp-slot-mf,.edp-slot>.edp-slot-printed,.edp-slot>.edp-slot-fallback,.edp-slot>.edp-slot-hint{grid-area:1 / 1}.edp-slot>.edp-slot-kb{grid-area:1 / 2}.edp-slot-hint{justify-self:start;padding-inline:.2em;font-size:.85em;color:var(--ink-faint, #8d93a0);pointer-events:none;white-space:nowrap}.edp-slot-fallback{min-width:6ch;font:inherit;color:inherit;background:transparent;border:none;outline:none}.edp-slot-printed{padding:0 .1em}.edp-slot-kb{flex:0 0 auto;width:1.6em;height:1.6em;margin-inline-start:.2em;padding:0;font:600 .9em/1 KaTeX_Main,Times New Roman,serif;color:var(--ink-faint, #8d93a0);background:transparent;border:none;border-radius:6px;cursor:pointer;opacity:0;transition:opacity .18s ease}.edp-slot:hover .edp-slot-kb,.edp-slot:focus-within .edp-slot-kb,.edp-slot-kb.is-open{opacity:1}.edp-slot-kb.is-open{color:var(--ink, #1d2025);background:var(--paper-deep, #f4f1ea)}.edp-slot--correct{background:var(--ok-soft, #ecf8f0);border-color:var(--ok, #1f8a4c)}.edp-slot--incorrect{background:var(--pen-soft, #fdeeec);border-color:var(--pen, #d23b2b)}.edp-slot--validating{border-color:var(--ink-faint, #8d93a0)}.edp-slot--readonly{cursor:default}.edp-slot-feedback{display:inline-flex;align-items:center;gap:.3em;margin-inline-start:.4em;font-size:.9em;font-weight:600;vertical-align:middle}.edp-slot-feedback--correct{color:var(--ok, #1f8a4c)}.edp-slot-feedback--incorrect{color:var(--pen, #d23b2b)}.edp-slot-feedback--validating{color:var(--ink-soft, #565b66)}.edp-slot-score{font-family:var(--font-hand, "Caveat", cursive);font-size:1.35em;line-height:1}.edp-slot-reveal{font-weight:500}@media(prefers-reduced-motion:reduce){.edp-slot,.edp-slot-kb{transition:none}}
|
|
82
|
+
`);import"katex/dist/katex.min.css";Qt(`.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}}
|
|
83
|
+
`);Qt(`/*! 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-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-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--font-weight-black:900;--tracking-tight:-.025em;--tracking-wide:.025em;--tracking-wider:.05em;--tracking-widest:.1em;--leading-snug:1.375;--leading-relaxed:1.625;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--ease-out:cubic-bezier(0, 0, .2, 1);--ease-in-out:cubic-bezier(.4, 0, .2, 1);--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--blur-sm:8px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1)}}.edpire-scope .\\@container{container-type:inline-size}.edpire-scope .pointer-events-none{pointer-events:none}.edpire-scope .collapse{visibility:collapse}.edpire-scope .invisible{visibility:hidden}.edpire-scope .visible{visibility:visible}.edpire-scope .absolute{position:absolute}.edpire-scope .fixed{position:fixed}.edpire-scope .relative{position:relative}.edpire-scope .static{position:static}.edpire-scope .sticky{position:sticky}.edpire-scope .inset-0{inset:calc(var(--spacing) * 0)}.edpire-scope .start{inset-inline-start:var(--spacing)}.edpire-scope .start-0{inset-inline-start:calc(var(--spacing) * 0)}.edpire-scope .start-2{inset-inline-start:calc(var(--spacing) * 2)}.edpire-scope .end{inset-inline-end:var(--spacing)}.edpire-scope .end-2{inset-inline-end:calc(var(--spacing) * 2)}.edpire-scope .top-0{top:calc(var(--spacing) * 0)}.edpire-scope .top-1\\/2{top:50%}.edpire-scope .top-2{top:calc(var(--spacing) * 2)}.edpire-scope .top-4{top:calc(var(--spacing) * 4)}.edpire-scope .top-\\[calc\\(var\\(--edp-bar\\)\\+1rem\\)\\]{top:calc(var(--edp-bar) + 1rem)}.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-0\\.5{margin-inline-start:calc(var(--spacing) * .5)}.edpire-scope .ms-1{margin-inline-start:calc(var(--spacing) * 1)}.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-4{margin-top:calc(var(--spacing) * 4)}.edpire-scope .mt-6{margin-top:calc(var(--spacing) * 6)}.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-1\\.5{margin-bottom:calc(var(--spacing) * 1.5)}.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-auto{margin-left:auto}.edpire-scope .line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.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\\(100dvh-8rem\\)\\]{max-height:calc(100dvh - 8rem)}.edpire-scope .max-h-\\[calc\\(100dvh-var\\(--edp-bar\\)-2rem\\)\\]{max-height:calc(100dvh - var(--edp-bar) - 2rem)}.edpire-scope .max-h-\\[calc\\(100svh-6rem\\)\\]{max-height:calc(100svh - 6rem)}.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 .min-h-dvh{min-height:100dvh}.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-\\[200px\\]{max-width:200px}.edpire-scope .max-w-\\[240px\\]{max-width:240px}.edpire-scope .max-w-full{max-width:100%}.edpire-scope .max-w-none{max-width:none}.edpire-scope .max-w-sm{max-width:var(--container-sm)}.edpire-scope .max-w-xs{max-width:var(--container-xs)}.edpire-scope .min-w-0{min-width:calc(var(--spacing) * 0)}.edpire-scope .min-w-\\[80px\\]{min-width:80px}.edpire-scope .min-w-\\[140px\\]{min-width:140px}.edpire-scope .flex-1{flex:1}.edpire-scope .flex-none{flex:none}.edpire-scope .flex-shrink-0,.edpire-scope .shrink-0{flex-shrink:0}.edpire-scope .grow{flex-grow:1}.edpire-scope .-translate-x-\\[110\\%\\]{--tw-translate-x: -110% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.edpire-scope .translate-x-0{--tw-translate-x:calc(var(--spacing) * 0);translate:var(--tw-translate-x) var(--tw-translate-y)}.edpire-scope .-translate-y-1\\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.edpire-scope .transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.edpire-scope .animate-pulse{animation:var(--animate-pulse)}.edpire-scope .animate-spin{animation:var(--animate-spin)}.edpire-scope .cursor-default{cursor:default}.edpire-scope .cursor-pointer{cursor:pointer}.edpire-scope .resize{resize:both}.edpire-scope .flex-col{flex-direction:column}.edpire-scope .flex-wrap{flex-wrap:wrap}.edpire-scope .items-baseline{align-items:baseline}.edpire-scope .items-center{align-items:center}.edpire-scope .items-start{align-items:flex-start}.edpire-scope .justify-between{justify-content:space-between}.edpire-scope .justify-center{justify-content:center}.edpire-scope .justify-end{justify-content:flex-end}.edpire-scope .gap-0\\.5{gap:calc(var(--spacing) * .5)}.edpire-scope .gap-1{gap:calc(var(--spacing) * 1)}.edpire-scope .gap-1\\.5{gap:calc(var(--spacing) * 1.5)}.edpire-scope .gap-2{gap:calc(var(--spacing) * 2)}.edpire-scope .gap-2\\.5{gap:calc(var(--spacing) * 2.5)}.edpire-scope .gap-3{gap:calc(var(--spacing) * 3)}.edpire-scope .gap-4{gap:calc(var(--spacing) * 4)}.edpire-scope .gap-5{gap:calc(var(--spacing) * 5)}.edpire-scope .gap-6{gap:calc(var(--spacing) * 6)}.edpire-scope :where(.edpire-scope .space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1) * calc(1 - var(--tw-space-y-reverse)))}.edpire-scope :where(.edpire-scope .space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}.edpire-scope :where(.edpire-scope .space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}.edpire-scope .gap-x-1{column-gap:calc(var(--spacing) * 1)}.edpire-scope .gap-x-4{column-gap:calc(var(--spacing) * 4)}.edpire-scope .gap-y-0\\.5{row-gap:calc(var(--spacing) * .5)}.edpire-scope .gap-y-2{row-gap:calc(var(--spacing) * 2)}.edpire-scope .self-start{align-self:flex-start}.edpire-scope .self-stretch{align-self:stretch}.edpire-scope .truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.edpire-scope .overflow-auto{overflow:auto}.edpire-scope .overflow-hidden{overflow:hidden}.edpire-scope .overflow-visible{overflow:visible}.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\\/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-red-950\\/80{background-color:#460809cc}@supports (color:color-mix(in lab,red,red)){.edpire-scope .bg-red-950\\/80{background-color:color-mix(in oklab,var(--color-red-950) 80%,transparent)}}.edpire-scope .bg-white{background-color:var(--color-white)}.edpire-scope .bg-white\\/60{background-color:#fff9}@supports (color:color-mix(in lab,red,red)){.edpire-scope .bg-white\\/60{background-color:color-mix(in oklab,var(--color-white) 60%,transparent)}}.edpire-scope .object-contain{object-fit:contain}.edpire-scope .object-cover{object-fit:cover}.edpire-scope .p-1{padding:calc(var(--spacing) * 1)}.edpire-scope .p-1\\.5{padding:calc(var(--spacing) * 1.5)}.edpire-scope .p-2{padding:calc(var(--spacing) * 2)}.edpire-scope .p-3{padding:calc(var(--spacing) * 3)}.edpire-scope .p-4{padding:calc(var(--spacing) * 4)}.edpire-scope .p-6{padding:calc(var(--spacing) * 6)}.edpire-scope .px-1\\.5{padding-inline:calc(var(--spacing) * 1.5)}.edpire-scope .px-2{padding-inline:calc(var(--spacing) * 2)}.edpire-scope .px-2\\.5{padding-inline:calc(var(--spacing) * 2.5)}.edpire-scope .px-3{padding-inline:calc(var(--spacing) * 3)}.edpire-scope .px-3\\.5{padding-inline:calc(var(--spacing) * 3.5)}.edpire-scope .px-4{padding-inline:calc(var(--spacing) * 4)}.edpire-scope .px-5{padding-inline:calc(var(--spacing) * 5)}.edpire-scope .px-6{padding-inline:calc(var(--spacing) * 6)}.edpire-scope .px-10{padding-inline:calc(var(--spacing) * 10)}.edpire-scope .py-0\\.5{padding-block:calc(var(--spacing) * .5)}.edpire-scope .py-1{padding-block:calc(var(--spacing) * 1)}.edpire-scope .py-1\\.5{padding-block:calc(var(--spacing) * 1.5)}.edpire-scope .py-2{padding-block:calc(var(--spacing) * 2)}.edpire-scope .py-2\\.5{padding-block:calc(var(--spacing) * 2.5)}.edpire-scope .py-3{padding-block:calc(var(--spacing) * 3)}.edpire-scope .py-5{padding-block:calc(var(--spacing) * 5)}.edpire-scope .py-8{padding-block:calc(var(--spacing) * 8)}.edpire-scope .py-16{padding-block:calc(var(--spacing) * 16)}.edpire-scope .ps-2{padding-inline-start:calc(var(--spacing) * 2)}.edpire-scope .ps-\\[23px\\]{padding-inline-start:23px}.edpire-scope .pe-2\\.5{padding-inline-end:calc(var(--spacing) * 2.5)}.edpire-scope .pt-1\\.5{padding-top:calc(var(--spacing) * 1.5)}.edpire-scope .pt-2{padding-top:calc(var(--spacing) * 2)}.edpire-scope .pb-1{padding-bottom:calc(var(--spacing) * 1)}.edpire-scope .pb-5{padding-bottom:calc(var(--spacing) * 5)}.edpire-scope .pl-2{padding-left:calc(var(--spacing) * 2)}.edpire-scope .text-center{text-align:center}.edpire-scope .text-right{text-align:right}.edpire-scope .text-start{text-align:start}.edpire-scope .align-middle{vertical-align:middle}.edpire-scope .font-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-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.edpire-scope .text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.edpire-scope .text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.edpire-scope .text-\\[1\\.6rem\\]{font-size:1.6rem}.edpire-scope .text-\\[10px\\]{font-size:10px}.edpire-scope .text-\\[11px\\]{font-size:11px}.edpire-scope .leading-none{--tw-leading:1;line-height:1}.edpire-scope .leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.edpire-scope .leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.edpire-scope .font-black{--tw-font-weight:var(--font-weight-black);font-weight:var(--font-weight-black)}.edpire-scope .font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.edpire-scope .font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.edpire-scope .font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.edpire-scope .tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.edpire-scope .tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.edpire-scope .tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.edpire-scope .tracking-widest{--tw-tracking:var(--tracking-widest);letter-spacing:var(--tracking-widest)}.edpire-scope .\\[overflow-wrap\\:anywhere\\]{overflow-wrap:anywhere}.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-\\[\\#5b6170\\]{color:#5b6170}.edpire-scope .text-\\[\\#8a5a08\\]{color:#8a5a08}.edpire-scope .text-\\[\\#8a8f99\\]{color:#8a8f99}.edpire-scope .text-\\[\\#8d93a0\\]{color:#8d93a0}.edpire-scope .text-\\[\\#565b66\\]{color:#565b66}.edpire-scope .text-\\[\\#a32b1e\\]{color:#a32b1e}.edpire-scope .text-\\[\\#c8810e\\]{color:#c8810e}.edpire-scope .text-\\[\\#d23b2b\\]{color:#d23b2b}.edpire-scope .text-amber-900{color:var(--color-amber-900)}.edpire-scope .text-blue-600{color:var(--color-blue-600)}.edpire-scope .text-gray-400{color:var(--color-gray-400)}.edpire-scope .text-gray-500{color:var(--color-gray-500)}.edpire-scope .text-gray-600{color:var(--color-gray-600)}.edpire-scope .text-gray-700{color:var(--color-gray-700)}.edpire-scope .text-gray-800{color:var(--color-gray-800)}.edpire-scope .text-red-200{color:var(--color-red-200)}.edpire-scope .text-red-300{color:var(--color-red-300)}.edpire-scope .text-slate-500{color:var(--color-slate-500)}.edpire-scope .text-slate-800{color:var(--color-slate-800)}.edpire-scope .text-white{color:var(--color-white)}.edpire-scope .uppercase{text-transform:uppercase}.edpire-scope .italic{font-style:italic}.edpire-scope .tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.edpire-scope .line-through{text-decoration-line:line-through}.edpire-scope .underline{text-decoration-line:underline}.edpire-scope .underline-offset-2{text-underline-offset:2px}.edpire-scope .underline-offset-4{text-underline-offset:4px}.edpire-scope .opacity-40{opacity:.4}.edpire-scope .opacity-60{opacity:.6}.edpire-scope .opacity-70{opacity:.7}.edpire-scope .shadow{--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-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 .blur{--tw-blur:blur(8px);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 .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 .\\[--edp-bar\\:0px\\]{--edp-bar:0px}.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\\:border-\\[\\#1d2025\\]):focus{border-color:#1d2025}.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-40):disabled{opacity:.4}.edpire-scope :is(.edpire-scope .disabled\\:opacity-50):disabled{opacity:.5}.edpire-scope :is(.edpire-scope .data-\\[flash\\=true\\]\\:bg-\\[\\#fbf1dc\\])[data-flash=true]{background-color:#fbf1dc}.edpire-scope :is(.edpire-scope .data-\\[flash\\=true\\]\\:duration-150)[data-flash=true]{--tw-duration:.15s;transition-duration:.15s}@media(min-width:40rem){.edpire-scope .sm\\:block{display:block}.edpire-scope .sm\\:hidden{display:none}.edpire-scope .sm\\:inline{display:inline}.edpire-scope .sm\\:inline-flex{display:inline-flex}.edpire-scope .sm\\:flex-row{flex-direction:row}.edpire-scope .sm\\:flex-nowrap{flex-wrap:nowrap}.edpire-scope .sm\\:items-center{align-items:center}.edpire-scope .sm\\:gap-4{gap:calc(var(--spacing) * 4)}.edpire-scope .sm\\:px-4{padding-inline:calc(var(--spacing) * 4)}.edpire-scope .sm\\:px-6{padding-inline:calc(var(--spacing) * 6)}.edpire-scope .sm\\:py-4{padding-block:calc(var(--spacing) * 4)}.edpire-scope .sm\\:text-\\[2rem\\]{font-size:2rem}}@container (min-width:72rem){.edpire-scope .\\@6xl\\:flex{display:flex}.edpire-scope .\\@6xl\\:hidden{display:none}}.edpire-scope :is(.edpire-scope .rtl\\:translate-x-\\[110\\%\\]):where(:dir(rtl),.edpire-scope [dir=rtl],.edpire-scope [dir=rtl] *){--tw-translate-x:110%;translate:var(--tw-translate-x) var(--tw-translate-y)}.edpire-scope :is(.edpire-scope .\\[\\&_\\.ProseMirror\\]\\:min-h-\\[80px\\]) .ProseMirror{min-height:80px}.edpire-scope :is(.edpire-scope .\\[\\&_\\.ProseMirror\\]\\:outline-none) .ProseMirror{--tw-outline-style:none;outline-style:none}.edpire-scope :is(.edpire-scope .\\[\\&_\\.ProseMirror_p\\.is-editor-empty\\:first-child\\:\\:before\\]\\:pointer-events-none) .ProseMirror p.is-editor-empty:first-child:before{pointer-events:none}.edpire-scope :is(.edpire-scope .\\[\\&_\\.ProseMirror_p\\.is-editor-empty\\:first-child\\:\\:before\\]\\:float-left) .ProseMirror p.is-editor-empty:first-child:before{float:left}.edpire-scope :is(.edpire-scope .\\[\\&_\\.ProseMirror_p\\.is-editor-empty\\:first-child\\:\\:before\\]\\:h-0) .ProseMirror p.is-editor-empty:first-child:before{height:calc(var(--spacing) * 0)}.edpire-scope :is(.edpire-scope .\\[\\&_\\.ProseMirror_p\\.is-editor-empty\\:first-child\\:\\:before\\]\\:text-gray-400) .ProseMirror p.is-editor-empty:first-child:before{color:var(--color-gray-400)}.edpire-scope :is(.edpire-scope .\\[\\&_\\.ProseMirror_p\\.is-editor-empty\\:first-child\\:\\:before\\]\\:content-\\[attr\\(data-placeholder\\)\\]) .ProseMirror p.is-editor-empty:first-child:before{--tw-content:attr(data-placeholder);content:var(--tw-content)}.edpire-scope :is(.edpire-scope .\\[\\&_\\[data-exercise-id\\]\\]\\:scroll-mt-\\[calc\\(var\\(--edp-bar\\)\\+0\\.75rem\\)\\]) [data-exercise-id],.edpire-scope :is(.edpire-scope .\\[\\&_\\[data-question-id\\]\\]\\:scroll-mt-\\[calc\\(var\\(--edp-bar\\)\\+0\\.75rem\\)\\]) [data-question-id]{scroll-margin-top:calc(var(--edp-bar) + .75rem)}@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}}
|
|
84
|
+
`);import{Fragment as Ja,jsx as L,jsxs as G}from"react/jsx-runtime";var Mf="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 Ef(e){for(let t of e.exercises)for(let r of t.questions)if((r.content.content??[]).some(o=>o.type==="aiAnswerInput"))return!0;return!1}function Uc(e){let t=e;return typeof t.totalMaxScore=="number"?t.totalMaxScore:(t.answerKeys??[]).reduce((r,n)=>r+(n.scoring?.maxScore??0),0)}function qc(e){return e.questions.reduce((t,r)=>t+Uc(r),0)}function St(e){return Number.isInteger(e)?String(e):parseFloat(e.toFixed(2)).toString()}var Xa=5;function Hc({label:e}){return L("span",{className:"ms-0.5 text-[#d23b2b]",title:e,"aria-label":e,children:"*"})}function Vc(e){return e==="full"?"#1f8a4c":e==="partial"?"#c8810e":"#d23b2b"}function Kc({outcome:e}){let t=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:Vc(e),strokeWidth:9,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:L("path",{d:t})})}function Lf({score:e,weight:t,unit:r,t:n,hidden:o=!1}){if(e){if(e.awaiting)return G("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(br,{size:11}),n("pendingReview")]});let a=o?e.outcome:e.m>0&&e.s>=e.m?"full":e.s>0?"partial":"none";return o?L("span",{className:"inline-flex items-center rounded-lg border border-[#e7e5e0] bg-[#f5f4f1] px-2 py-1",children:L(Kc,{outcome:a})}):G("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(Kc,{outcome:a}),G("span",{className:"font-bold leading-none",style:{fontFamily:'var(--font-hand, "Caveat", cursive)',fontSize:"1.05rem",color:Vc(a)},children:[St(e.s)," / ",St(e.m)]})]})}return t>0&&!o?G("span",{className:"text-xs font-semibold tabular-nums text-[#8d93a0]",children:[St(t)," ",r(t)]}):null}function Wc(e){let t=0,r=0,n=!1,o=0,a=0;for(let i of e)t+=i.score??0,r+=i.maxScore??0,i.status==="awaiting_review"&&(n=!0),i.status==="correct"&&o++,(i.status==="correct"||i.status==="partial")&&a++;let s=e.length>0&&o===e.length?"full":a>0?"partial":"none";return{score:t,maxScore:r,awaiting:n,outcome:s}}function If({timeLimitMinutes:e,startedAt:t,onExpire:r}){let n=e*6e4,o=new Date(t).getTime()+n,[a,s]=Je(()=>Math.max(o-Date.now(),0)),i=It(r);i.current=r,no(()=>{if(a<=0){i.current();return}let p=setInterval(()=>{let k=Math.max(o-Date.now(),0);s(k),k<=0&&(clearInterval(p),i.current())},1e3);return()=>clearInterval(p)},[o]);let c=a/n,l=c<.1?"bg-[#fdeeec] text-[#a32b1e] border-[#f6cfc9] animate-pulse":c<.25?"bg-[#fbf1dc] text-[#8a5a08] border-[#f2e2bf]":"bg-[#f5f4f1] text-[#565b66] border-[#e7e5e0]",d=Math.ceil(a/1e3),m=Math.floor(d/3600),u=Math.floor(d%3600/60),h=d%60,f=m>0?`${m}:${String(u).padStart(2,"0")}:${String(h).padStart(2,"0")}`:`${u}:${String(h).padStart(2,"0")}`;return G("span",{className:Re("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(br,{size:12}),f]})}function oo({assessment:e,meta:t,scoreHidden:r=!1,isForm:n=!1,requiredQuestionIds:o,locale:a="en",branding:s,timeLimitMinutes:i,startedAt:c,initialAnswers:l,onAnswersChange:d,saveState:m,resumed:u=!1,onSubmit:h,review:f,onViewReport:p,reportLabel:k,onBack:y,backLabel:S,allowReset:b,onReset:C,overlayConfig:A,contained:w=!1,layout:T,onClose:N,mediaHandler:M,answerSheetHandler:R,onReportGrade:v,onAddAnnex:x,fallbackLogoUrl:B}){let g=Oe(()=>Fc(a),[a]),P=ot(O=>$c(a,O),[a]),$=Va(a)?"rtl":"ltr",q=It(null),J=It(null);no(()=>{let O=J.current,le=q.current;if(!O||!le||typeof ResizeObserver>"u")return;let Te=()=>le.style.setProperty("--edp-bar",`${O.offsetHeight}px`);Te();let At=new ResizeObserver(Te);return At.observe(O),()=>At.disconnect()},[]);let I=T?.maxWidth??Dc,Z=s?.branding?.primaryColor,ve=s?.branding?.accentColor,E=s?.branding?.fontFamily,_=s?.branding?.fontUrl,W=s?.branding?.showPoweredBy!==!1;no(()=>{if(!_||typeof document>"u"||document.querySelector(`link[href="${_}"]`))return;let le=document.createElement("link");le.rel="stylesheet",le.href=_,document.head.appendChild(le)},[_]);let[z,H]=Je(()=>f?.answers??l??{exerciseAnswers:[]}),[se]=Je(()=>f?new Map:Ua(l)),pe=Oe(()=>Lc(e),[e]),ue=It(d);ue.current=d;let[ge]=Je(()=>(f?f.answers:l)?.mediaPlays),V=It(ge),ee=ot(O=>V.current&&Object.keys(V.current).length>0?{...O,mediaPlays:V.current}:O,[]),be=It(z);be.current=z;let ce=It(!1),ie=ot(O=>{let le=ee(Ic(O,se,pe));H(le),ue.current?.(le)},[se,pe,ee]),me=ot(O=>{if(V.current=O,f||ce.current)return;let le=ee(be.current);H(le),ue.current?.(le)},[f,ee]),[De,at]=Je(null);no(()=>{at(Date.now())},[]);let[U,ne]=Je(u&&!f),oe=Oe(()=>{if(De===null||!i||i<=0||!c)return null;let O=new Date(c).getTime()+i*6e4-De;return O>0?Math.max(1,Math.floor(O/6e4)):null},[De,i,c]),[fe,Ue]=Je(!1),[xr,Rt]=Je(!1),[X,yr]=Je(f?.result??null);ce.current=X!==null;let vr=Oe(()=>Ua(f?.answers),[f]),[Jr,st]=Je(null),[Ct,wr]=Je(!1),rs=It(!1),ol=Oe(()=>Ef(e),[e]),ns=Oe(()=>xr?Ha(e,z):[],[xr,e,z]),kr=ns.length,so=ot(O=>{Rt(!1);let le=q.current?.querySelectorAll(`[data-question-id="${CSS.escape(O)}"]`),Te=Array.from(le??[]).find(At=>At.getClientRects().length>0);Te&&requestAnimationFrame(()=>Te.scrollIntoView({block:"start",behavior:"smooth"}))},[]),io=(o??[]).join(" "),$t=Oe(()=>new Set(io?io.split(" "):[]),[io]),[os,al]=Je(!1),co=Oe(()=>os?Ka(e,z,$t).map(O=>O.questionId).join(" "):"",[os,e,z,$t]),as=Oe(()=>new Set(co?co.split(" "):[]),[co]),sl=ot(()=>{let O=Ka(e,z,$t);if(O.length===0){Rt(!0);return}al(!0),so(O[0].questionId)},[e,z,$t,so]),lo=Oe(()=>e.exercises.reduce((O,le)=>O+qc(le),0),[e]),po=Oe(()=>X?ro(X.exerciseFeedback):void 0,[X]),ss=Oe(()=>{let O=new Map;for(let le of X?.exerciseFeedback??[])for(let Te of le.questions)Te.explanation&&O.set(Te.questionId,Te);return O},[X]),Zr=r||X?.scoreHidden===!0,is=Oe(()=>{if(!X)return{};let O={};for(let le of X.exerciseFeedback)O[le.exerciseId]=Wc(le.questions.flatMap(Te=>Te.nodeResults));return O},[X]),uo=Oe(()=>{if(!X)return{};let O={};for(let le of X.exerciseFeedback)for(let Te of le.questions)Te.nodeResults.length>0&&(O[Te.questionId]=Wc(Te.nodeResults));return O},[X]),il=ot(async()=>{Ue(!0),st(null);try{let O=await h(z);yr(O),typeof window<"u"&&window.scrollTo({top:0,behavior:"smooth"})}catch(O){st(O instanceof Error?O.message==="required_unanswered"?g("requiredBlocked"):O.message:g("confirmCancel"))}finally{Ue(!1),Rt(!1)}},[z,h,g]),en=ot(()=>{!X||!p||p(X)},[X,p]),cl=ot(()=>{rs.current||fe||X||(rs.current=!0,wr(!0),Rt(!1),typeof document<"u"&&document.activeElement?.blur(),setTimeout(()=>{Ue(!0),st(null),h(z).then(O=>{yr(O),typeof window<"u"&&window.scrollTo({top:0,behavior:"smooth"})}).catch(O=>{st(O instanceof Error?O.message:"submit_error")}).finally(()=>{Ue(!1),wr(!1)})},800))},[z,fe,h,X]),mo=ot((O,le,Te)=>{let At=qc(O),it=is[O.id],cs=O.questions.length>1,dl=Bc(le)?zc(le,{renderQuestion:(nn,go,pl)=>{let Ve=nn.id,ls=se.get(Ve),ds={...M?{mediaHandler:M}:{},...R?{answerSheetHandler:R}:{},...f?{initialAnswers:vr.get(Ve)??[],readOnly:!0}:ls?{initialAnswers:ls}:{},...X!==null?{readOnly:!0}:{}},ps=Object.keys(ds).length>0&&Bc(go)?zc(go,ds):go,ul=$t.has(Ve),us=as.has(Ve)?G("p",{role:"alert",className:"mt-2 flex items-center gap-1.5 text-sm font-medium text-[#a32b1e]",children:[L(_f,{size:14,className:"flex-shrink-0"}),g("requiredMissing")]}):null,bo=ss.get(Ve),ms=bo?.explanation?L(Nc,{content:bo.explanation,nodeResults:bo.nodeResults,label:g("explanation")}):null,fs=uo[Ve],hs=X&&v&&fs&&!fs.awaiting?L(Pc,{questionId:Ve,onReport:v,t:g}):null;if(!cs)return G("div",{"data-question-id":Ve,children:[ps,us,ms,hs]},Ve);let Sr=uo[Ve],ml=Uc(nn);return G("div",{"data-question-id":Ve,children:[G("div",{className:"flex items-center gap-2.5 mb-3",children:[G("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:[g("question",{index:pl+1}),ul&&L(Hc,{label:g("required")})]}),L(Lf,{hidden:Zr,score:Sr?{s:Sr.score,m:Sr.maxScore,awaiting:Sr.awaiting,outcome:Sr.outcome}:null,weight:ml,unit:P,t:g})]}),ps,us,ms,hs]},Ve)},renderSeparator:nn=>L("div",{className:"border-t border-[#e7e5e0] my-1"},`qsep-${nn}`)}):le;return G("div",{"data-exercise-id":O.id,className:"bg-white rounded-[14px] border border-[#e7e5e0] shadow-sm overflow-hidden",children:[G("div",{className:"flex items-center justify-between px-4 py-2.5 bg-[#f1efe9] border-b border-[#e7e5e0]",style:ve?{backgroundColor:ve}:void 0,children:[G("span",{dir:"auto",className:"min-w-0 text-sm font-bold text-[#1d2025] [overflow-wrap:anywhere]",children:[Gt(g,O.title,Te),!cs&&O.questions[0]&&$t.has(O.questions[0].id)&&L(Hc,{label:g("required")})]}),Zr?null:it?.awaiting?G("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(br,{size:11}),g("pendingReview")]}):it?G("span",{className:"font-bold leading-none tabular-nums",style:{fontFamily:'var(--font-hand, "Caveat", cursive)',fontSize:"1.15rem",color:it.maxScore>0&&it.score>=it.maxScore?"#1f8a4c":it.maxScore>0&&it.score>0?"#c8810e":it.maxScore>0?"#d23b2b":"#8d93a0"},children:[St(it.score)," / ",St(it.maxScore)]}):At>0?G("span",{className:"text-xs font-semibold text-[#8d93a0] tabular-nums",children:["/ ",St(At)," ",P(At)]}):null]}),L("div",{className:"p-4",children:dl})]},O.id)},[g,P,is,uo,ve,M,R,v,f,vr,se,ss,Zr,$t,as,X]),ll=Oe(()=>Oa(e).length>0,[e]),fo=ot(O=>G("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:Gt(g,e.exercises[O+1]?.title,O+1)}),L("div",{className:"flex-1 border-t border-dashed border-[#e7e5e0]"})]},`sep-${O}`),[g,e]),ho=W?L("p",{className:"pt-2 pb-1 text-center text-xs text-[#8d93a0] select-none",children:g("poweredBy")}):null,Ze=X!==null,Ft=n||X?.isForm===!0,tn=X?.showVerdict!==!1,rn=tn?X?.passed?"#1f8a4c":"#d23b2b":"#1d2025";return L(ln,{initial:ge,onChange:me,children:L("div",{className:"edpire-scope",style:{display:"contents"},children:G("div",{ref:q,dir:$,className:Re("flex flex-col [--edp-bar:0px] [&_[data-exercise-id]]:scroll-mt-[calc(var(--edp-bar)+0.75rem)] [&_[data-question-id]]:scroll-mt-[calc(var(--edp-bar)+0.75rem)]",w?"h-full":"min-h-dvh"),style:E?{fontFamily:E}:void 0,children:[L(xc,{visible:fe&&!Ct&&!Ft,hasAiNodes:ol,text:g("evaluating"),aiText:g("aiEvaluating"),contained:w,...A}),Ct&&G("div",{className:Re("fixed inset-0 z-50 flex flex-col items-center justify-center gap-3 bg-red-950/80 backdrop-blur-sm",w&&"absolute"),children:[L(br,{size:40,className:"text-red-300"}),L("p",{className:"text-xl font-black text-white tracking-tight",children:g("timeUp.title")}),L("p",{className:"text-sm text-red-200",children:g("timeUp.submitting")})]}),G("div",{ref:J,className:"sticky top-0 z-10 flex-shrink-0 flex items-center justify-between gap-2 px-4 py-2.5 border-b border-[#e7e5e0] bg-[#fbfaf7]",style:ve?{backgroundColor:ve}:void 0,children:[G("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[L("img",{src:s?.logoUrl??B??Mf,alt:s?.name??"Edpire",width:24,height:24,loading:"lazy",className:"flex-none rounded object-contain"}),G("div",{className:"min-w-0",children:[L("h1",{dir:"auto",title:t.title,className:"line-clamp-2 text-sm font-bold leading-snug text-[#1d2025] [overflow-wrap:anywhere]",children:t.title}),L("p",{className:"text-[11px] text-[#8d93a0]",children:lo>0&&!Zr&&G("span",{className:"ms-2 font-semibold text-[#565b66]",children:["/ ",St(lo)," ",P(lo)]})})]}),!Ze&&De!==null&&i&&i>0&&c&&L(If,{timeLimitMinutes:i,startedAt:c,onExpire:cl}),!Ze&&(m==="saving"||m==="saved")&&G("span",{role:"status",className:"hidden sm:inline-flex items-center gap-1 text-[11px] font-medium text-[#8d93a0]",children:[m==="saved"?L(Tf,{size:12}):L(Ga,{size:12,className:"animate-spin"}),g(m==="saved"?"answersSaved":"answersSaving")]})]}),G("div",{className:"flex flex-none items-center gap-2",children:[b&&G("button",{onClick:C,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(Af,{size:13}),g("reset")]}),(!Ze||f)&&y&&G("button",{onClick:y,className:"flex items-center gap-1.5 px-3 py-2 text-sm font-medium text-[#565b66] hover:text-[#1d2025] hover:bg-[#f1efe9] rounded-lg transition-colors",children:[L(Qa,{size:13}),S??g("back")]}),N&&L("button",{onClick:N,className:"p-1.5 text-[#8d93a0] hover:text-[#1d2025] hover:bg-[#f1efe9] rounded-lg transition-colors",children:L(Qa,{size:15})}),!Ze&&L("button",{onClick:sl,disabled:fe,style:Z?{backgroundColor:Z}:void 0,className:"flex flex-shrink-0 items-center gap-2 px-3.5 sm:px-4 py-2 bg-[#1d2025] text-white text-sm font-semibold rounded-lg hover:bg-[#31353c] transition-colors disabled:opacity-50",children:fe?G(Ja,{children:[L(Ga,{size:14,className:"animate-spin"}),g(Ft?"formSending":"submitting")]}):G(Ja,{children:[L(Oc,{size:14}),L("span",{className:"sm:hidden",children:g(Ft?"formSubmit":"confirmSubmit")}),L("span",{className:"hidden sm:inline",children:g(Ft?"formSubmit":"submit")})]})})]})]}),Jr&&L("div",{className:"flex-shrink-0 bg-[#fdeeec] border-b border-[#f6cfc9] px-4 py-2 text-sm text-[#a32b1e]",children:Jr}),!Ze&&m==="failed"&&G("div",{role:"alert",className:"flex-shrink-0 flex items-center gap-2 bg-[#fbf1dc] border-b border-[#f2e2bf] px-4 py-2 text-sm font-semibold text-[#8a5a08]",children:[L(Pf,{size:15,className:"flex-shrink-0"}),g("answersNotSaved")]}),!Ze&&U&&(se.size>0||oe!==null)&&G("div",{role:"status",className:"flex-shrink-0 flex items-center gap-2 bg-[#f5f4f1] border-b border-[#e7e5e0] px-4 py-2 text-sm text-[#1d2025]",children:[oe!==null&&L(br,{size:15,className:"flex-shrink-0 text-[#565b66]"}),G("span",{className:"flex-1 min-w-0",children:[se.size>0?g("resumeRestored"):g("resumeFresh"),oe!==null&&G(Ja,{children:[" ",g("resumeTimeLeft",{minutes:oe})]})]}),L("button",{type:"button",onClick:()=>ne(!1),"aria-label":g("close"),className:"flex-shrink-0 p-1 rounded-md text-[#8d93a0] hover:text-[#1d2025] hover:bg-[#e7e5e0] transition-colors",children:L(Qa,{size:14})})]}),Ze&&X?.isForm?L(Mc,{t:g,rtl:Va(a),showClose:!w,onContinue:p&&X.returnUrl?en:void 0,continueLabel:k,primaryColor:Z}):Ze&&X&&(X.awaitingManualGrading?L("div",{className:"flex-shrink-0 border-b bg-[#fbf1dc] border-[#f2e2bf]",children:L("div",{className:"mx-auto px-4 py-3 sm:px-6 sm:py-4",style:{maxWidth:I},children:G("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2 sm:gap-4",children:[G("div",{className:"flex items-center gap-2",children:[L(br,{size:20,className:"text-[#c8810e] flex-shrink-0"}),L("span",{className:"text-sm font-semibold text-[#8a5a08]",children:X.aiPending?g("beingMarked"):g("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:X.aiPending?g("beingMarkedDesc"):g("awaitingReviewDesc")}),p&&G("button",{onClick:en,style:Z?{backgroundColor:Z}: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(Ya,{size:14}),k??g("viewFullReport")]})]})})}):X.scoreHidden?L("div",{className:"flex-shrink-0 border-b bg-[#f5f4f1] border-[#e7e5e0]",children:L("div",{className:"mx-auto px-4 py-3 sm:px-6 sm:py-4",style:{maxWidth:I},children:G("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2 sm:gap-4",children:[G("div",{className:"flex items-center gap-2",children:[L(jc,{size:20,className:"text-[#1d2025] flex-shrink-0"}),L("span",{className:"text-sm font-semibold text-[#1d2025]",children:g("submittedNoScore")})]}),L("div",{className:"hidden sm:block w-px h-8 bg-[#e7e5e0]"}),L("p",{className:"text-sm text-[#565b66] flex-1 min-w-0",children:g("submittedNoScoreDesc")}),p&&G("button",{onClick:en,style:Z?{backgroundColor:Z}: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(Ya,{size:14}),k??g("viewFullReport")]})]})})}):L("div",{className:Re("flex-shrink-0 border-b",tn?X.passed?"bg-[#ecf8f0] border-[#c5e8d1]":"bg-[#fdeeec] border-[#f6cfc9]":"bg-[#f5f4f1] border-[#e7e5e0]"),children:L("div",{className:"mx-auto px-4 py-3 sm:px-6 sm:py-4",style:{maxWidth:I},children:G("div",{className:"flex flex-wrap sm:flex-nowrap items-center gap-x-4 gap-y-2",children:[G("div",{className:"flex items-center gap-2",children:[tn?X.passed?L(jc,{size:20,className:"text-[#1f8a4c] flex-shrink-0"}):L(Cf,{size:20,className:"text-[#d23b2b] flex-shrink-0"}):null,L("span",{className:"text-sm font-semibold",style:{color:rn},children:tn?X.passed?g("assessmentPassed"):g("assessmentNotPassed"):g("yourScore")})]}),L("div",{className:"hidden sm:block w-px h-8 bg-[#e7e5e0]"}),G("div",{className:"flex items-baseline gap-1.5",children:[G("span",{className:"leading-none tabular-nums text-[1.6rem] sm:text-[2rem]",style:{fontFamily:'var(--font-hand, "Caveat", cursive)',color:rn},children:[St(X.totalScore)," / ",St(X.maxScore)]}),L("span",{className:"text-sm text-[#8d93a0] font-medium",children:P(X.maxScore)})]}),G("div",{className:"flex-1 flex items-center gap-3 min-w-[140px]",children:[L("div",{className:"flex-1 h-2 bg-[#e7e5e0] rounded-full overflow-hidden min-w-[80px]",children:L("div",{className:"h-full rounded-full transition-all duration-700",style:{width:`${X.percentage}%`,backgroundColor:rn}})}),G("span",{className:"text-sm font-bold tabular-nums flex-shrink-0",style:{color:rn},children:[X.percentage,"%"]})]}),p&&G("button",{onClick:en,style:Z?{backgroundColor:Z}: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(Ya,{size:14}),k??g("viewFullReport")]})]})})})),L("div",{className:Re("flex-1 flex flex-col",w&&"overflow-hidden",Ct&&"pointer-events-none opacity-60",X?.isForm&&"hidden"),children:e.annex||ll?L(Sc,{assessment:e,isSubmitted:Ze,setAnswers:ie,validationFeedback:po,renderExercise:mo,renderSeparator:fo,primaryColor:Z,contained:w,locale:a,contentMaxWidth:I,t:g,footer:ho}):x?L(Cc,{assessment:e,isSubmitted:Ze,setAnswers:ie,validationFeedback:po,renderExercise:mo,renderSeparator:fo,primaryColor:Z,contained:w,locale:a,contentMaxWidth:I,t:g,onAddAnnex:x,footer:ho}):L("div",{className:Re("flex-1",w&&"overflow-y-auto"),children:G("div",{className:"mx-auto p-6 flex flex-col gap-4",style:{maxWidth:I},children:[L(Lt,{assessment:e,onAnswersChange:Ze?void 0:ie,validationFeedback:po,renderExercise:mo,renderSeparator:fo,locale:a}),ho]})})}),xr&&L("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",children:G("div",{role:"dialog","aria-modal":"true","aria-labelledby":"edpire-submit-confirm-title",className:"bg-white rounded-[14px] shadow-xl p-6 max-w-sm mx-4",children:[L("h3",{id:"edpire-submit-confirm-title",className:"text-base font-bold text-[#1d2025] mb-2",children:g(Ft?"formConfirmTitle":"confirmTitle")}),kr>0&&G("div",{className:"text-sm text-[#8a5a08] bg-[#fbf1dc] border border-[#f2e2bf] rounded-lg px-3 py-2 mb-3",children:[G("p",{className:"flex items-start gap-2 font-semibold",children:[L(Nf,{size:15,className:"flex-shrink-0 mt-px"}),L("span",{children:kr===1?g("unansweredOne"):g("unansweredMany",{count:kr})})]}),G("ul",{className:"mt-1 ps-[23px] flex flex-col gap-0.5",children:[ns.slice(0,Xa).map(O=>L("li",{children:L("button",{type:"button",onClick:()=>so(O.questionId),className:"text-start underline underline-offset-2 hover:text-[#1d2025] cursor-pointer",children:O.only?Gt(g,O.exerciseTitle,O.exerciseIndex):`${Gt(g,O.exerciseTitle,O.exerciseIndex)} \xB7 ${g("question",{index:O.questionIndex+1})}`})},O.questionId)),kr>Xa&&L("li",{children:g("unansweredMore",{count:kr-Xa})})]})]}),L("p",{className:"text-sm text-[#565b66] mb-5",children:g(Ft?"formConfirmDescription":"confirmDescription")}),G("div",{className:"flex gap-3 justify-end",children:[L("button",{onClick:()=>Rt(!1),className:"px-4 py-2 text-sm font-medium text-[#565b66] hover:bg-[#f1efe9] rounded-lg transition-colors",children:g("confirmCancel")}),G("button",{onClick:il,disabled:fe,style:Z?{backgroundColor:Z}: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:[fe?L(Ga,{size:14,className:"animate-spin"}):L(Oc,{size:14}),g(Ft?"formSubmit":"confirmSubmit")]})]})]})})]})})})}function ao(e){return(e??[]).map(t=>({exerciseId:t.exercise_id,questions:t.questions.map(r=>({questionId:r.question_id,...r.explanation?{explanation:r.explanation}:{},nodeResults:r.node_results.map(n=>({nodeId:n.node_id,status:n.status,...n.score!==void 0?{score:n.score}:{},...n.max_score!==void 0?{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}:{}}))}))}))}function $f(e,t){return new Promise((r,n)=>{let o=setTimeout(r,e);t.addEventListener("abort",()=>{clearTimeout(o),n(new Error("aborted"))},{once:!0})})}function Ff(e){return new Promise((t,r)=>{let n=new FileReader;n.onload=()=>t(String(n.result)),n.onerror=()=>r(n.error??new Error("read_failed")),n.readAsDataURL(e)})}function Df(e){let t={transcribePhotos:({images:o,photos:a},s)=>e.readPhotos({images:o,photos:a,nodeId:s?.nodeId}),recognizeHandwriting:async o=>e.readHandwriting(await Ff(o))},{startCapture:r,captureStatus:n}=e;return r&&n&&(t.startPhoneCapture=async({nodeId:o,signal:a})=>{let{captureId:s,url:i,qrImage:c}=await r(o),l=(async()=>{let d=Date.now()+12e5;for(;Date.now()<d;){await $f(2500,a);let m=await n(s).catch(()=>null);if(m?.photos.length)return m.photos}throw new Error("expired")})();return{url:i,qrImage:c,photos:l}}),t}function Gc(e,t){let r=async n=>{let o=await fetch(`${e.replace(/\/$/,"")}/api/v1/embed/read`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:t,...n})}),a=await o.json().catch(()=>({}));if(!o.ok)throw new Error(a.error??"failed");return a};return Df({readPhotos:({images:n,nodeId:o})=>r({kind:"photos",images:n,...o?{node_id:o}:{}}),readHandwriting:n=>r({kind:"handwriting",image:n})})}import{jsx as Bf}from"react/jsx-runtime";function Za(e,t){let r=ao(e.exercise_feedback);return{submissionId:e.submission_id,totalScore:e.score??0,maxScore:e.max_score??0,percentage:e.percentage??0,passed:e.passed??!1,...e.score_hidden?{scoreHidden:!0}:{},returnUrl:t??null,exerciseFeedback:r,awaitingManualGrading:e.awaiting_manual_grading??!1,aiPending:e.ai_pending??!1}}function es(e){return{annex:e.annex??void 0,exercises:e.exercises.map(t=>({id:t.id,...t.title?{title:t.title}:{},sharedContext:t.sharedContext,questions:t.questions.map(r=>({id:r.id,version:"1.0",content:r.content,answerKeys:[]}))}))}}function Xc({token:e,data:t,baseUrl:r,options:n}){let{locale:o,branding:a,returnUrl:s,reportLabel:i,backLabel:c,onBack:l,overlayConfig:d,layout:m,mediaHandler:u,answerSheetHandler:h,onComplete:f,onError:p}=n,k=Qc(()=>Gc(r,e),[r,e]),y=a??t.branding??void 0,S=o??t.meta.language??"en",b=Qc(()=>es(t.assessment),[t]),[C]=zf(()=>new Date().toISOString()),A=Yc(async T=>{let N=await fetch(`${r}/api/v1/embed/submit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:e,answers:T})});if(!N.ok){let R=await N.json().catch(()=>({}));if(N.status===422&&R.code==="required_unanswered")throw new Error("required_unanswered");let v=typeof R.error=="string"?R.error:"Submission failed",x=N.status===401?"TOKEN_INVALID":N.status===409?"TOKEN_USED":N.status===404?"ASSESSMENT_NOT_FOUND":"UNKNOWN";throw p?.({code:x,message:v}),new Error(v)}let M=await N.json();return f?.(M),Za(M,s)},[r,e,f,p,s]),w=Yc(T=>{if(s)try{let N=new URL(s);N.searchParams.set("submission_id",T.submissionId),!T.awaitingManualGrading&&!T.scoreHidden&&(N.searchParams.set("score",String(T.totalScore)),N.searchParams.set("max_score",String(T.maxScore))),window.location.href=N.toString()}catch{window.location.href=s}},[s]);return Bf(oo,{assessment:b,meta:{title:t.meta.title,category:t.meta.category??null},locale:S,branding:y,scoreHidden:t.meta.score_hidden===!0,requiredQuestionIds:t.meta.required_question_ids,timeLimitMinutes:t.meta.settings.time_limit_minutes,startedAt:C,onSubmit:A,onViewReport:s?w:void 0,reportLabel:i,onBack:l,backLabel:c,overlayConfig:d,layout:m,mediaHandler:u,answerSheetHandler:h??k})}import{useMemo as Jc}from"react";import{jsx as jf}from"react/jsx-runtime";function Of(){return Promise.reject(new Error("A review cannot be submitted"))}function Zc({review:e,locale:t,branding:r,layout:n,onBack:o,backLabel:a}){let s=Jc(()=>es(e.assessment),[e]),i=Jc(()=>({answers:e.answers,result:Za({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,score_hidden:e.submission.score_hidden,exercise_feedback:e.exercise_feedback})}),[e]),c=t??e.meta.language??"en";return jf(oo,{assessment:s,meta:{title:e.meta.title,category:e.meta.category??null},locale:c,branding:r??e.branding??void 0,review:i,scoreHidden:e.submission.score_hidden===!0,onSubmit:Of,onBack:o,backLabel:a,layout:n})}import Kf from"react";import{createRoot as Wf}from"react-dom/client";import qf,{useMemo as Hf}from"react";import"katex/dist/katex.min.css";import{jsx as ts}from"react/jsx-runtime";var el=qf.memo(function({content:t,onAnswersChange:r,feedback:n,initialAnswers:o,readOnly:a,className:s,dir:i}){let c=Hf(()=>{if(n)return new Map(Object.entries(n))},[n]),l=ts(mr,{content:t,onAnswersChange:r,initialAnswers:o,validationFeedback:c,readOnly:a,className:s});return ts("div",{className:"edpire-scope",style:{display:"contents"},children:i?ts("div",{dir:i,children:l}):l})});function Uf(e){let{container:t,content:r,onAnswersChange:n,feedback:o,initialAnswers:a,readOnly:s,dir:i}=e,c=typeof t=="string"?document.querySelector(t):t;if(!c)throw new Error(`EdpireSDK.renderQuestion: container not found: ${String(t)}`);let l={content:r,onAnswersChange:n,feedback:o,initialAnswers:a,readOnly:s,dir:i},d=Wf(c);function m(){d.render(Kf.createElement(el,l))}return m(),{setContent(u){l={...l,content:u,feedback:null},m()},setFeedback(u){l={...l,feedback:u},m()},setInitialAnswers(u){l={...l,initialAnswers:u},m()},unmount(){d.unmount()}}}function Vf(e){let t=[],r=0;for(let n of e.exercises)for(let o of n.questions)t.push({exerciseId:n.id,questionId:o.id,content:o.content_ast,points:o.points,sequenceNumber:o.sequence_number,index:r++});return t}function Gf(e){let t=ro(ao(e.exercise_feedback)),r=new Map;for(let s of e.answers.exerciseAnswers)for(let i of s.questionAnswers)r.set(i.questionId,i.answers);let n=e.submission.score_hidden===!0,o=[],a=0;for(let s of e.assessment.exercises){let i=t.get(s.id);for(let c of s.questions){let l=i?.get(c.id),d=e.exercise_feedback.find(p=>p.exercise_id===s.id)?.questions.find(p=>p.question_id===c.id),m=d?.node_results??[],u=0,h=0,f=!1;for(let p of m)u+=p.score??0,h+=p.max_score??0,p.status==="awaiting_review"&&(f=!0);o.push({exerciseId:s.id,questionId:c.id,content:c.content,sharedContext:s.sharedContext??null,explanation:d?.explanation??null,answers:r.get(c.id)??[],feedback:l?Object.fromEntries(l):{},score:u,maxScore:h,scoreHidden:n,status:f?"awaiting_review":n?Yf(m.map(p=>p.status)):h===0?"unscored":u>=h?"correct":u>0?"partial":"incorrect",index:a++})}}return o}function Yf(e){return e.length===0?"unscored":e.every(t=>t==="correct")?"correct":e.every(t=>t==="incorrect")?"incorrect":"partial"}function Qf(e){let t=new Map;for(let r of e)t.has(r.exerciseId)||t.set(r.exerciseId,[]),t.get(r.exerciseId).push({questionId:r.questionId,answers:r.answers});return{exerciseAnswers:Array.from(t.entries()).map(([r,n])=>({exerciseId:r,questionAnswers:n}))}}var Xf="https://edpire.com";function nl(e,t,r){e.textContent="";let n=document.createElement("div");n.style.cssText="padding:32px;text-align:center;color:#dc2626;font-family:sans-serif";let o=document.createElement("div");if(o.textContent=t,n.appendChild(o),r){let a=document.createElement("div");a.style.cssText="margin-top:8px;font-size:13px;color:#6b7280",a.textContent=r,n.appendChild(a)}e.appendChild(n)}var a1={mount(e){let{token:t,container:r,baseUrl:n=Xf,onError:o}=e,a=typeof r=="string"?document.querySelector(r):r;if(!a){let l={code:"UNKNOWN",message:`Container not found: ${r}`};return o?.(l),{unmount:()=>{}}}let s=null,i=!1;function c(){if(i)return;i=!0;let l=s;s=null,setTimeout(()=>{l?.unmount()},0)}return(async()=>{a.innerHTML='<div style="padding:32px;text-align:center;color:#6b7280;font-family:sans-serif">Loading assessment\u2026</div>';let l;try{let d=await fetch(`${n}/api/v1/embed/assessments?token=${encodeURIComponent(t)}`,{method:"GET"});if(!d.ok){let m=await d.json().catch(()=>({})),u=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";o?.({code:h,message:u});let f=h==="ORIGIN_NOT_ALLOWED"?`Add ${typeof location<"u"?location.origin:"this origin"} to Allowed Embed Origins in Edpire, under Integrations then Origins.`:"";nl(a,u,f);return}l=await d.json()}catch{o?.({code:"NETWORK_ERROR",message:"Failed to connect to Edpire"}),nl(a,"Failed to connect to Edpire. Please try again.","");return}i||(a.innerHTML="",s=rl(a),s.render(tl.createElement(Xc,{token:t,data:l,baseUrl:n,options:e})))})(),{unmount:c}},review(e){let{container:t,...r}=e,n=typeof t=="string"?document.querySelector(t):t;if(!n)return{unmount:()=>{}};n.textContent="";let o=rl(n);return o.render(tl.createElement(Zc,r)),{unmount(){let a=o;o=null,setTimeout(()=>a?.unmount(),0)}}}};export{a1 as EdpireAssessment,Qf as buildSubmitPayload,Vf as flattenAssessment,Gf as flattenReview,Uf as renderQuestion};
|