@edpire/sdk 0.16.0 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,10 +1,10 @@
1
- import"./chunk-76CZ6Z7T.mjs";import $d from"react";import{createRoot as Fd}from"react-dom/client";import{useCallback as Td,useMemo as _d,useState as nb}from"react";import{cloneElement as yd,isValidElement as xd,useCallback as yt,useEffect as Oo,useMemo as $e,useRef as Yt,useState as et}from"react";import{jsx as Fr}from"react/jsx-runtime";import{useEffect as Rs,useMemo as Vf,useRef as Gf}from"react";import Xd from"mitt";var Tt=class{constructor(){this.emitter=Xd(),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()})}},mi="__edpireGlobalAnswerBus",hi=globalThis,_n=hi[mi]??(hi[mi]=new Tt);import{jsx as Jd}from"react/jsx-runtime";import{createContext as Zd,useContext as ep}from"react";var fi="__edpireAnswerBusContext",gi=globalThis,bi=gi[fi]??(gi[fi]=Zd(_n));function Ne(){return ep(bi)}function Mn({children:e,bus:t=new Tt}){return Jd(bi.Provider,{value:t,children:e})}import{jsx as Fe,jsxs as xr}from"react/jsx-runtime";import{Fragment as Hp,useState as Fi,useEffect as pa,useMemo as Up}from"react";import _t from"clsx";import{jsx as oe,jsxs as _i}from"react/jsx-runtime";import{jsx as rt,jsxs as ea}from"react/jsx-runtime";import{createContext as op,useCallback as ta,useContext as ap,useEffect as Vr,useMemo as sp,useRef as br,useState as Zt}from"react";import{Pause as ip,Play as cp,RotateCcw as lp}from"lucide-react";import{jsx as tp}from"react/jsx-runtime";import{createContext as rp,useContext as yi}from"react";var gr={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",sheetPages:"Pages",sheetPageOf:(e,t)=>`Page ${e} of ${t}`,sheetPageOpen:"Open full screen",sheetPhotoRemove:"Remove this photo",sheetPhotoAddPage:"Add a page",sheetPhotoRead:"Read my copy",sheetPhotoPages:"Your pages",sheetPhotoView:e=>`See page ${e}`,sheetPhotoTurn:"Turn this page",sheetPhotoReadingLive:"Reading your copy\u2026 the lines appear in your answer as they are read.",sheetPhotoStop:"Stop",copyTitle:"Photograph my copy",copyPhoneHelp:"Scan this code with your phone and take a photo of each page of your copy. They will appear here.",copyReadingLive:"Reading your copy\u2026 each part appears under its question as it is read.",copyLimit:"You have used every reading of the whole copy. Photograph an answer under its question, or type it.",copyCut:"The reading stopped before the end. Check what was read below, or try again.",copyCheckTitle:"Check where each part goes",copyCheckHelp:"Each part was placed by the number written before it. Move a part if it landed in the wrong question; you will correct the words in each answer after.",copyMoveTo:"Question",copyNowhere:"Don't use it",copyNotPlaced:"Not placed",copyNotPlacedHelp:"These parts could not be matched to a question. Choose one, or leave them out.",copyHasText:"This answer already has text:",copyReplace:"Replace it",copyBelow:"Add below",copyLeave:"Keep mine",copyConfirm:"Put in my answers",copyCancel:"Cancel",copyNothing:"No part is going into a question yet. Choose a question for the parts you want to keep.",copyLeavePages:"Close? The pages you took will be lost.",copyLeaveRead:"Close without putting what was read in your answers? It will be lost, and reading the copy again counts as another reading.",copyLeaveBack:"Go back",copyLeaveConfirm:"Close anyway",sheetPhotoUnreadable:"Nothing could be read on this photo. Take it again in good light, the page flat and filling the photo, or type your answer.",sheetPhotoNetwork:"The connection dropped. Try again, or type your answer.",sheetPhotoLimit:"You have used every reading for this question. Type the rest of your answer.",sheetPhotoBusy:"Reading is busy right now. Try again in a moment, or type your answer.",sheetPhotoCut:"The reading stopped before the end. What was read is in your answer: check it and add the rest.",sheetPhotoSideways:"This page still looks sideways. Turn it so the writing is upright, then read it.",sheetPhotoSendFailed:"A photo could not be sent. Remove it and take it again.",sheetPhotoOpenFailed:"This photo could not be opened. Choose a JPEG or PNG photo.",sheetPhotoType:"Type instead",sheetPhotoUnsure:"Words underlined in yellow may have been misread.",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",sheetPadFix:"Not right? Rewrite the symbol, or insert it and fix it with the keys.",sheetHandwritingFormula:"Formula by hand",sheetInkPage:"Page by hand",sheetInkTitle:"Write your answer by hand",sheetInkHelp:"Write on the lines with a pen or your finger, then read the page: the text goes into your answer.",sheetInkCanvas:e=>`Page ${e}, write here`,sheetInkPageN:e=>`Page ${e}`,sheetInkRemovePage:"Remove this page",sheetInkPageRemoved:e=>`Page ${e} removed.`,sheetInkRead:e=>e>1?"Read my pages":"Read my page",sheetInkReading:"Reading your page\u2026 the lines appear in your answer as they are read.",sheetInkSendFailed:"A page could not be sent. Check your connection and try again.",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 En={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",sheetPages:"Pages",sheetPageOf:(e,t)=>`Page ${e} sur ${t}`,sheetPageOpen:"Ouvrir en plein \xE9cran",sheetPhotoRemove:"Retirer cette photo",sheetPhotoAddPage:"Ajouter une page",sheetPhotoRead:"Lire ma copie",sheetPhotoPages:"Vos pages",sheetPhotoView:e=>`Voir la page ${e}`,sheetPhotoTurn:"Tourner cette page",sheetPhotoReadingLive:"Lecture de votre copie\u2026 les lignes apparaissent dans votre r\xE9ponse au fur et \xE0 mesure.",sheetPhotoStop:"Arr\xEAter",copyTitle:"Photographier ma copie",copyPhoneHelp:"Scannez ce code avec votre t\xE9l\xE9phone et prenez chaque page de votre copie en photo. Elles appara\xEEtront ici.",copyReadingLive:"Lecture de votre copie\u2026 chaque partie appara\xEEt sous sa question au fil de la lecture.",copyLimit:"Vous avez utilis\xE9 toutes les lectures de la copie enti\xE8re. Photographiez une r\xE9ponse sous sa question, ou tapez-la.",copyCut:"La lecture s'est arr\xEAt\xE9e avant la fin. V\xE9rifiez ce qui a \xE9t\xE9 lu ci-dessous, ou r\xE9essayez.",copyCheckTitle:"V\xE9rifiez o\xF9 va chaque partie",copyCheckHelp:"Chaque partie a \xE9t\xE9 plac\xE9e d'apr\xE8s le num\xE9ro \xE9crit devant. D\xE9placez-la si elle est dans la mauvaise question ; vous corrigerez les mots dans chaque r\xE9ponse ensuite.",copyMoveTo:"Question",copyNowhere:"Ne pas l'utiliser",copyNotPlaced:"Non plac\xE9es",copyNotPlacedHelp:"Ces parties n'ont pas pu \xEAtre rattach\xE9es \xE0 une question. Choisissez-en une, ou laissez-les de c\xF4t\xE9.",copyHasText:"Cette r\xE9ponse contient d\xE9j\xE0 du texte :",copyReplace:"Le remplacer",copyBelow:"Ajouter dessous",copyLeave:"Garder le mien",copyConfirm:"Mettre dans mes r\xE9ponses",copyCancel:"Annuler",copyNothing:"Aucune partie ne va encore dans une question. Choisissez une question pour les parties \xE0 garder.",copyLeavePages:"Fermer ? Les pages prises seront perdues.",copyLeaveRead:"Fermer sans mettre ce qui a \xE9t\xE9 lu dans vos r\xE9ponses ? Ce sera perdu, et relire la copie compte comme une nouvelle lecture.",copyLeaveBack:"Revenir",copyLeaveConfirm:"Fermer quand m\xEAme",sheetPhotoUnreadable:"Rien n'a pu \xEAtre lu sur cette photo. Reprenez-la avec une bonne lumi\xE8re, la page bien \xE0 plat et qui remplit la photo, ou tapez votre r\xE9ponse.",sheetPhotoNetwork:"La connexion a \xE9t\xE9 coup\xE9e. R\xE9essayez, ou tapez votre r\xE9ponse.",sheetPhotoLimit:"Vous avez utilis\xE9 toutes les lectures de cette question. Tapez la suite de votre r\xE9ponse.",sheetPhotoBusy:"La lecture est occup\xE9e pour le moment. R\xE9essayez dans un instant, ou tapez votre r\xE9ponse.",sheetPhotoCut:"La lecture s'est arr\xEAt\xE9e avant la fin. Ce qui a \xE9t\xE9 lu est dans votre r\xE9ponse : v\xE9rifiez-le et ajoutez la suite.",sheetPhotoSideways:"Cette page semble encore de travers. Tournez-la pour que l'\xE9criture soit droite, puis lisez-la.",sheetPhotoSendFailed:"Une photo n'a pas pu \xEAtre envoy\xE9e. Retirez-la et reprenez-la.",sheetPhotoOpenFailed:"Cette photo n'a pas pu \xEAtre ouverte. Choisissez une photo JPEG ou PNG.",sheetPhotoType:"Taper plut\xF4t",sheetPhotoUnsure:"Les mots soulign\xE9s en jaune ont peut-\xEAtre \xE9t\xE9 mal lus.",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",sheetPadFix:"Pas \xE7a ? R\xE9\xE9crivez le symbole, ou ins\xE9rez-la et corrigez-la avec les touches.",sheetHandwritingFormula:"Formule \xE0 la main",sheetInkPage:"Page \xE0 la main",sheetInkTitle:"\xC9crire votre r\xE9ponse \xE0 la main",sheetInkHelp:"\xC9crivez sur les lignes avec un stylet ou le doigt, puis faites lire la page : le texte arrive dans votre r\xE9ponse.",sheetInkCanvas:e=>`Page ${e}, \xE9crivez ici`,sheetInkPageN:e=>`Page ${e}`,sheetInkRemovePage:"Retirer cette page",sheetInkPageRemoved:e=>`Page ${e} retir\xE9e.`,sheetInkRead:e=>e>1?"Lire mes pages":"Lire ma page",sheetInkReading:"Lecture de votre page\u2026 les lignes apparaissent dans votre r\xE9ponse au fur et \xE0 mesure.",sheetInkSendFailed:"Une page n'a pas pu \xEAtre envoy\xE9e. V\xE9rifiez votre connexion et r\xE9essayez.",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 Ln={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",sheetPages:"\u0627\u0644\u0635\u0641\u062D\u0627\u062A",sheetPageOf:(e,t)=>`\u0627\u0644\u0635\u0641\u062D\u0629 ${e} \u0645\u0646 ${t}`,sheetPageOpen:"\u0641\u062A\u062D \u0628\u0645\u0644\u0621 \u0627\u0644\u0634\u0627\u0634\u0629",sheetPhotoRemove:"\u062D\u0630\u0641 \u0647\u0630\u0647 \u0627\u0644\u0635\u0648\u0631\u0629",sheetPhotoAddPage:"\u0625\u0636\u0627\u0641\u0629 \u0635\u0641\u062D\u0629",sheetPhotoRead:"\u0642\u0631\u0627\u0621\u0629 \u0648\u0631\u0642\u062A\u064A",sheetPhotoPages:"\u0635\u0641\u062D\u0627\u062A\u0643",sheetPhotoView:e=>`\u0639\u0631\u0636 \u0627\u0644\u0635\u0641\u062D\u0629 ${e}`,sheetPhotoTurn:"\u062A\u062F\u0648\u064A\u0631 \u0647\u0630\u0647 \u0627\u0644\u0635\u0641\u062D\u0629",sheetPhotoReadingLive:"\u062C\u0627\u0631\u064D \u0642\u0631\u0627\u0621\u0629 \u0648\u0631\u0642\u062A\u0643\u2026 \u062A\u0638\u0647\u0631 \u0627\u0644\u0623\u0633\u0637\u0631 \u0641\u064A \u0625\u062C\u0627\u0628\u062A\u0643 \u062A\u0628\u0627\u0639\u064B\u0627.",sheetPhotoStop:"\u0625\u064A\u0642\u0627\u0641",copyTitle:"\u062A\u0635\u0648\u064A\u0631 \u0648\u0631\u0642\u062A\u064A",copyPhoneHelp:"\u0627\u0645\u0633\u062D \u0647\u0630\u0627 \u0627\u0644\u0631\u0645\u0632 \u0628\u0647\u0627\u062A\u0641\u0643 \u0648\u0635\u0648\u0651\u0631 \u0643\u0644 \u0635\u0641\u062D\u0629 \u0645\u0646 \u0648\u0631\u0642\u062A\u0643. \u0633\u062A\u0638\u0647\u0631 \u0627\u0644\u0635\u0648\u0631 \u0647\u0646\u0627.",copyReadingLive:"\u062C\u0627\u0631\u064D \u0642\u0631\u0627\u0621\u0629 \u0648\u0631\u0642\u062A\u0643\u2026 \u064A\u0638\u0647\u0631 \u0643\u0644 \u062C\u0632\u0621 \u062A\u062D\u062A \u0633\u0624\u0627\u0644\u0647 \u0623\u062B\u0646\u0627\u0621 \u0627\u0644\u0642\u0631\u0627\u0621\u0629.",copyLimit:"\u0627\u0633\u062A\u0639\u0645\u0644\u062A \u0643\u0644 \u0642\u0631\u0627\u0621\u0627\u062A \u0627\u0644\u0648\u0631\u0642\u0629 \u0643\u0627\u0645\u0644\u0629. \u0635\u0648\u0651\u0631 \u0627\u0644\u0625\u062C\u0627\u0628\u0629 \u062A\u062D\u062A \u0633\u0624\u0627\u0644\u0647\u0627\u060C \u0623\u0648 \u0627\u0643\u062A\u0628\u0647\u0627.",copyCut:"\u062A\u0648\u0642\u0641\u062A \u0627\u0644\u0642\u0631\u0627\u0621\u0629 \u0642\u0628\u0644 \u0627\u0644\u0646\u0647\u0627\u064A\u0629. \u0631\u0627\u062C\u0639 \u0645\u0627 \u0642\u064F\u0631\u0626 \u0623\u062F\u0646\u0627\u0647\u060C \u0623\u0648 \u062D\u0627\u0648\u0644 \u0645\u0631\u0629 \u0623\u062E\u0631\u0649.",copyCheckTitle:"\u062A\u062D\u0642\u0642 \u0645\u0646 \u0645\u0643\u0627\u0646 \u0643\u0644 \u062C\u0632\u0621",copyCheckHelp:"\u0648\u064F\u0636\u0639 \u0643\u0644 \u062C\u0632\u0621 \u062D\u0633\u0628 \u0627\u0644\u0631\u0642\u0645 \u0627\u0644\u0645\u0643\u062A\u0648\u0628 \u0642\u0628\u0644\u0647. \u0627\u0646\u0642\u0644 \u0627\u0644\u062C\u0632\u0621 \u0625\u0646 \u0648\u0642\u0639 \u0641\u064A \u0633\u0624\u0627\u0644 \u062E\u0627\u0637\u0626\u061B \u0633\u062A\u0635\u062D\u062D \u0627\u0644\u0643\u0644\u0645\u0627\u062A \u0641\u064A \u0643\u0644 \u0625\u062C\u0627\u0628\u0629 \u0628\u0639\u062F \u0630\u0644\u0643.",copyMoveTo:"\u0627\u0644\u0633\u0624\u0627\u0644",copyNowhere:"\u0644\u0627 \u062A\u0633\u062A\u0639\u0645\u0644\u0647",copyNotPlaced:"\u063A\u064A\u0631 \u0645\u0648\u0636\u0648\u0639\u0629",copyNotPlacedHelp:"\u0644\u0645 \u0646\u062A\u0645\u0643\u0646 \u0645\u0646 \u0631\u0628\u0637 \u0647\u0630\u0647 \u0627\u0644\u0623\u062C\u0632\u0627\u0621 \u0628\u0633\u0624\u0627\u0644. \u0627\u062E\u062A\u0631 \u0633\u0624\u0627\u0644\u064B\u0627\u060C \u0623\u0648 \u0627\u062A\u0631\u0643\u0647\u0627.",copyHasText:"\u0641\u064A \u0647\u0630\u0647 \u0627\u0644\u0625\u062C\u0627\u0628\u0629 \u0646\u0635 \u0645\u0646 \u0642\u0628\u0644:",copyReplace:"\u0627\u0633\u062A\u0628\u062F\u0627\u0644\u0647",copyBelow:"\u0625\u0636\u0627\u0641\u0629 \u062A\u062D\u062A\u0647",copyLeave:"\u0627\u0644\u0625\u0628\u0642\u0627\u0621 \u0639\u0644\u0649 \u0646\u0635\u064A",copyConfirm:"\u0636\u0639\u0647\u0627 \u0641\u064A \u0625\u062C\u0627\u0628\u0627\u062A\u064A",copyCancel:"\u0625\u0644\u063A\u0627\u0621",copyNothing:"\u0644\u0627 \u064A\u0630\u0647\u0628 \u0623\u064A \u062C\u0632\u0621 \u0625\u0644\u0649 \u0633\u0624\u0627\u0644 \u0628\u0639\u062F. \u0627\u062E\u062A\u0631 \u0633\u0624\u0627\u0644\u064B\u0627 \u0644\u0644\u0623\u062C\u0632\u0627\u0621 \u0627\u0644\u062A\u064A \u062A\u0631\u064A\u062F \u0627\u0644\u0625\u0628\u0642\u0627\u0621 \u0639\u0644\u064A\u0647\u0627.",copyLeavePages:"\u0625\u063A\u0644\u0627\u0642\u061F \u0633\u062A\u0636\u064A\u0639 \u0627\u0644\u0635\u0641\u062D\u0627\u062A \u0627\u0644\u062A\u064A \u0627\u0644\u062A\u0642\u0637\u062A\u0647\u0627.",copyLeaveRead:"\u0625\u063A\u0644\u0627\u0642 \u062F\u0648\u0646 \u0648\u0636\u0639 \u0645\u0627 \u0642\u064F\u0631\u0626 \u0641\u064A \u0625\u062C\u0627\u0628\u0627\u062A\u0643\u061F \u0633\u064A\u0636\u064A\u0639\u060C \u0648\u0625\u0639\u0627\u062F\u0629 \u0642\u0631\u0627\u0621\u0629 \u0627\u0644\u0648\u0631\u0642\u0629 \u062A\u064F\u062D\u0633\u0628 \u0642\u0631\u0627\u0621\u0629 \u062C\u062F\u064A\u062F\u0629.",copyLeaveBack:"\u0631\u062C\u0648\u0639",copyLeaveConfirm:"\u0625\u063A\u0644\u0627\u0642 \u0639\u0644\u0649 \u0623\u064A \u062D\u0627\u0644",sheetPhotoUnreadable:"\u062A\u0639\u0630\u0651\u0631\u062A \u0642\u0631\u0627\u0621\u0629 \u0623\u064A \u0634\u064A\u0621 \u0641\u064A \u0647\u0630\u0647 \u0627\u0644\u0635\u0648\u0631\u0629. \u0623\u0639\u062F \u0627\u0644\u062A\u0642\u0627\u0637\u0647\u0627 \u0641\u064A \u0625\u0636\u0627\u0621\u0629 \u062C\u064A\u062F\u0629 \u0648\u0627\u0644\u0648\u0631\u0642\u0629 \u0645\u0633\u0637\u0651\u062D\u0629 \u062A\u0645\u0644\u0623 \u0627\u0644\u0635\u0648\u0631\u0629\u060C \u0623\u0648 \u0627\u0643\u062A\u0628 \u0625\u062C\u0627\u0628\u062A\u0643.",sheetPhotoNetwork:"\u0627\u0646\u0642\u0637\u0639 \u0627\u0644\u0627\u062A\u0635\u0627\u0644. \u0623\u0639\u062F \u0627\u0644\u0645\u062D\u0627\u0648\u0644\u0629\u060C \u0623\u0648 \u0627\u0643\u062A\u0628 \u0625\u062C\u0627\u0628\u062A\u0643.",sheetPhotoLimit:"\u0627\u0633\u062A\u0639\u0645\u0644\u062A \u0643\u0644 \u0627\u0644\u0642\u0631\u0627\u0621\u0627\u062A \u0627\u0644\u0645\u062A\u0627\u062D\u0629 \u0644\u0647\u0630\u0627 \u0627\u0644\u0633\u0624\u0627\u0644. \u0627\u0643\u062A\u0628 \u0628\u0642\u064A\u0629 \u0625\u062C\u0627\u0628\u062A\u0643.",sheetPhotoBusy:"\u0627\u0644\u0642\u0631\u0627\u0621\u0629 \u0645\u0634\u063A\u0648\u0644\u0629 \u0627\u0644\u0622\u0646. \u0623\u0639\u062F \u0627\u0644\u0645\u062D\u0627\u0648\u0644\u0629 \u0628\u0639\u062F \u0642\u0644\u064A\u0644\u060C \u0623\u0648 \u0627\u0643\u062A\u0628 \u0625\u062C\u0627\u0628\u062A\u0643.",sheetPhotoCut:"\u062A\u0648\u0642\u0651\u0641\u062A \u0627\u0644\u0642\u0631\u0627\u0621\u0629 \u0642\u0628\u0644 \u0627\u0644\u0646\u0647\u0627\u064A\u0629. \u0645\u0627 \u062A\u0645\u0651\u062A \u0642\u0631\u0627\u0621\u062A\u0647 \u0645\u0648\u062C\u0648\u062F \u0641\u064A \u0625\u062C\u0627\u0628\u062A\u0643: \u0631\u0627\u062C\u0639\u0647 \u0648\u0623\u0643\u0645\u0644 \u0627\u0644\u0628\u0627\u0642\u064A.",sheetPhotoSideways:"\u064A\u0628\u062F\u0648 \u0623\u0646\u0651 \u0647\u0630\u0647 \u0627\u0644\u0635\u0641\u062D\u0629 \u0645\u0627 \u0632\u0627\u0644\u062A \u0645\u0627\u0626\u0644\u0629. \u062F\u0648\u0651\u0631\u0647\u0627 \u062D\u062A\u0649 \u062A\u0635\u0628\u062D \u0627\u0644\u0643\u062A\u0627\u0628\u0629 \u0645\u0633\u062A\u0642\u064A\u0645\u0629\u060C \u062B\u0645 \u0627\u0642\u0631\u0623\u0647\u0627.",sheetPhotoSendFailed:"\u062A\u0639\u0630\u0651\u0631 \u0625\u0631\u0633\u0627\u0644 \u0635\u0648\u0631\u0629. \u0627\u062D\u0630\u0641\u0647\u0627 \u0648\u0623\u0639\u062F \u0627\u0644\u062A\u0642\u0627\u0637\u0647\u0627.",sheetPhotoOpenFailed:"\u062A\u0639\u0630\u0651\u0631 \u0641\u062A\u062D \u0647\u0630\u0647 \u0627\u0644\u0635\u0648\u0631\u0629. \u0627\u062E\u062A\u0631 \u0635\u0648\u0631\u0629 \u0628\u0635\u064A\u063A\u0629 JPEG \u0623\u0648 PNG.",sheetPhotoType:"\u0627\u0644\u0643\u062A\u0627\u0628\u0629 \u0628\u062F\u0644\u064B\u0627 \u0645\u0646 \u0630\u0644\u0643",sheetPhotoUnsure:"\u0627\u0644\u0643\u0644\u0645\u0627\u062A \u0627\u0644\u0645\u0633\u0637\u0651\u0631\u0629 \u0628\u0627\u0644\u0623\u0635\u0641\u0631 \u0631\u0628\u0645\u0627 \u0642\u064F\u0631\u0626\u062A \u062E\u0637\u0623\u064B.",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",sheetPadFix:"\u0644\u064A\u0633\u062A \u0635\u062D\u064A\u062D\u0629\u061F \u0623\u0639\u0650\u062F \u0643\u062A\u0627\u0628\u0629 \u0627\u0644\u0631\u0645\u0632\u060C \u0623\u0648 \u0623\u062F\u0631\u0650\u062C\u0647\u0627 \u0648\u0635\u062D\u0651\u062D\u0647\u0627 \u0628\u0627\u0644\u0645\u0641\u0627\u062A\u064A\u062D.",sheetHandwritingFormula:"\u0635\u064A\u063A\u0629 \u0628\u0627\u0644\u064A\u062F",sheetInkPage:"\u0635\u0641\u062D\u0629 \u0628\u0627\u0644\u064A\u062F",sheetInkTitle:"\u0627\u0643\u062A\u0628 \u0625\u062C\u0627\u0628\u062A\u0643 \u0628\u0627\u0644\u064A\u062F",sheetInkHelp:"\u0627\u0643\u062A\u0628 \u0639\u0644\u0649 \u0627\u0644\u0623\u0633\u0637\u0631 \u0628\u0642\u0644\u0645 \u0623\u0648 \u0628\u0625\u0635\u0628\u0639\u0643\u060C \u062B\u0645 \u0627\u0637\u0644\u0628 \u0642\u0631\u0627\u0621\u0629 \u0627\u0644\u0635\u0641\u062D\u0629: \u064A\u0638\u0647\u0631 \u0627\u0644\u0646\u0635 \u0641\u064A \u0625\u062C\u0627\u0628\u062A\u0643.",sheetInkCanvas:e=>`\u0627\u0644\u0635\u0641\u062D\u0629 ${e}\u060C \u0627\u0643\u062A\u0628 \u0647\u0646\u0627`,sheetInkPageN:e=>`\u0627\u0644\u0635\u0641\u062D\u0629 ${e}`,sheetInkRemovePage:"\u062D\u0630\u0641 \u0647\u0630\u0647 \u0627\u0644\u0635\u0641\u062D\u0629",sheetInkPageRemoved:e=>`\u062D\u064F\u0630\u0641\u062A \u0627\u0644\u0635\u0641\u062D\u0629 ${e}.`,sheetInkRead:e=>e>1?"\u0627\u0642\u0631\u0623 \u0635\u0641\u062D\u0627\u062A\u064A":"\u0627\u0642\u0631\u0623 \u0635\u0641\u062D\u062A\u064A",sheetInkReading:"\u062C\u0627\u0631\u064D \u0642\u0631\u0627\u0621\u0629 \u0635\u0641\u062D\u062A\u0643\u2026 \u062A\u0638\u0647\u0631 \u0627\u0644\u0623\u0633\u0637\u0631 \u0641\u064A \u0625\u062C\u0627\u0628\u062A\u0643 \u0623\u062B\u0646\u0627\u0621 \u0627\u0644\u0642\u0631\u0627\u0621\u0629.",sheetInkSendFailed:"\u062A\u0639\u0630\u0651\u0631 \u0625\u0631\u0633\u0627\u0644 \u0635\u0641\u062D\u0629. \u062A\u062D\u0642\u0651\u0642 \u0645\u0646 \u0627\u062A\u0635\u0627\u0644\u0643 \u0648\u0623\u0639\u062F \u0627\u0644\u0645\u062D\u0627\u0648\u0644\u0629.",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 np={en:gr,fr:En,ar:Ln},Zo=rp(null);function ce(){return yi(Zo)??gr}function Wr(e){let t=yi(Zo);return e&&np[e]||t||gr}function Jt({locale:e,children:t}){let r=Wr(e);return tp(Zo.Provider,{value:r,children:t})}var xi=op(null);function In({initial:e,onChange:t,children:r}){let n=br({...e??{}}),o=br(t);o.current=t;let a=sp(()=>({get:s=>n.current[s]??0,set:(s,i)=>{n.current={...n.current,[s]:i},o.current?.(n.current)}}),[]);return rt(xi.Provider,{value:a,children:r})}var ra=[.75,1,1.25,1.5],na=.5;function yr(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 oa="edpire:audio-play";function vt({src:e,maxPlays:t,learnerSpeed:r,speed:n,allowSeek:o,durationHint:a,playsKey:s,playsUsed:i,onPlaysUsedChange:c,disabled:l=!1,label:p,className:d}){let u=ce(),f=ap(xi),h=s??e,m=t&&t>0?Math.floor(t):0,b=o!==!1,w=r!==!1,P=n&&n>=.25&&n<=4?n:1,g=br(null),R=br(null),[_,A]=Zt(!1),[I,C]=Zt(0),[L,v]=Zt(a&&a>0?a:0),[S,x]=Zt(!1),[B,E]=Zt(!1),[y,K]=Zt(P),[F,Y]=Zt(()=>i??f?.get(h)??0),$=br(!1),O=br(!1);Vr(()=>{i!==void 0&&Y(i)},[i]),Vr(()=>K(P),[P]),Vr(()=>{g.current&&(g.current.playbackRate=y)},[y]),Vr(()=>{E(!1),x(!1),C(0),A(!1),$.current=!1,a&&a>0||v(0);let X=g.current;X&&X.readyState>=1&&Number.isFinite(X.duration)&&X.duration>0&&v(X.duration)},[e]),Vr(()=>{let X=he=>{let be=g.current;be&&he.detail!==be&&!be.paused&&be.pause()};return window.addEventListener(oa,X),()=>window.removeEventListener(oa,X)},[]);let G=m>0&&F>=m&&!$.current,T=m>0?Math.max(0,m-F):null,N=l||B||G,H=ta(()=>{if(m===0)return!0;if(F>=m)return!1;let X=F+1;return Y(X),$.current=!0,i===void 0&&f?.set(h,X),c?.(X),!0},[m,F,i,f,h,c]),M=ta(()=>{let X=g.current;if(!X||l||B)return;if(!X.paused){X.pause();return}(S||X.currentTime<na)&&!$.current&&!H()||((S||X.currentTime>=(X.duration||1/0))&&(X.currentTime=0),x(!1),X.playbackRate=y,window.dispatchEvent(new CustomEvent(oa,{detail:X})),X.play().catch(()=>A(!1)))},[l,B,S,H,y]),k=L>0?L:0,W=k>0?Math.min(1,I/k):0,V=ta(X=>{let he=g.current;if(!he||!b||N||k===0)return;let be=Math.max(0,Math.min(k,X));if(m>0&&be<na&&I>=na&&$.current&&($.current=!1,!he.paused&&!H())){he.pause();return}he.currentTime=be,C(be),x(!1)},[b,N,k,m,I,H]),ne=X=>{let he=R.current;if(!he)return 0;let be=he.getBoundingClientRect(),re=getComputedStyle(he).direction==="rtl"?(be.right-X)/be.width:(X-be.left)/be.width;return Math.max(0,Math.min(1,re))},le=X=>{!b||N||k===0||(X.preventDefault(),O.current=!0,X.currentTarget.setPointerCapture(X.pointerId),V(ne(X.clientX)*k))},Z=X=>{O.current&&V(ne(X.clientX)*k)},se=()=>{O.current=!1},ve=X=>{if(!b||N||k===0)return;let he=R.current?getComputedStyle(R.current).direction==="rtl":!1,be=5,z=null;X.key==="ArrowRight"?z=I+(he?-be:be):X.key==="ArrowLeft"?z=I+(he?be:-be):X.key==="ArrowUp"?z=I+be:X.key==="ArrowDown"?z=I-be:X.key==="Home"?z=0:X.key==="End"&&(z=k),z!==null&&(X.preventDefault(),V(z))},ye=()=>{let X=ra.indexOf(y);K(ra[(X+1)%ra.length]??1)},ge=(_||I>0)&&!S&&k>0,xe=yr(ge?k-I:k),We=_?rt(ip,{size:18,fill:"currentColor",strokeWidth:0,"aria-hidden":!0}):S&&!G?rt(lp,{size:18,"aria-hidden":!0}):rt(cp,{size:18,fill:"currentColor",strokeWidth:0,"aria-hidden":!0,style:{marginInlineStart:2}}),He=_?u.audioPause:S?u.audioReplay:u.audioPlay;return ea("span",{role:"group","aria-label":p,className:`edp-audio${N?" edp-audio--off":""}${d?` ${d}`:""}`,"data-audio-player":"",children:[ea("span",{className:"edp-audio-bar",children:[rt("button",{type:"button",className:"edp-audio-play",onClick:M,disabled:N,"aria-label":He,children:We}),ea("span",{ref:R,className:`edp-audio-track${b&&!N?" edp-audio-track--seek":""}`,role:"slider",tabIndex:b&&!N?0:-1,"aria-label":u.audioPosition,"aria-valuemin":0,"aria-valuemax":Math.round(k),"aria-valuenow":Math.round(I),"aria-valuetext":u.audioTimeOf(yr(I),yr(k)),"aria-disabled":!b||N,onPointerDown:le,onPointerMove:Z,onPointerUp:se,onPointerCancel:se,onKeyDown:ve,children:[rt("span",{className:"edp-audio-rail",children:rt("span",{className:"edp-audio-fill",style:{width:`${W*100}%`}})}),b&&!N&&k>0&&rt("span",{className:"edp-audio-thumb",style:{insetInlineStart:`${W*100}%`}})]}),rt("span",{className:"edp-audio-time",dir:"ltr",children:xe}),w&&!B&&rt("button",{type:"button",className:"edp-audio-speed",dir:"ltr",onClick:ye,disabled:l,"aria-label":u.audioSpeed(u.audioRate(y)),children:u.audioRate(y)})]}),(B||T!==null)&&rt("span",{className:"edp-audio-note","aria-live":"polite",children:rt("bdi",{children:B?u.audioUnavailable:T===0&&!$.current?u.audioNoPlaysLeft:u.audioPlaysLeft(T??0)})}),rt("audio",{ref:g,src:e||void 0,preload:"metadata",onLoadedMetadata:X=>{let he=X.currentTarget;he.playbackRate=y,Number.isFinite(he.duration)&&he.duration>0?v(he.duration):dp(he,be=>v(z=>z>0?z:be))},onDurationChange:X=>{let he=X.currentTarget.duration;Number.isFinite(he)&&he>0&&v(he)},onTimeUpdate:X=>{O.current||C(X.currentTarget.currentTime)},onPlay:()=>A(!0),onPause:()=>A(!1),onEnded:()=>{A(!1),x(!0),$.current=!1,C(k)},onError:()=>{e&&E(!0)}})]})}function dp(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 pp from"katex";import"katex/dist/contrib/mhchem.js";var up={"\\d":"\\mathrm{d}","\\R":"\\mathbb{R}","\\N":"\\mathbb{N}","\\Z":"\\mathbb{Z}","\\Q":"\\mathbb{Q}","\\C":"\\mathbb{C}"};function Le(e,t,r=!0){try{return pp.renderToString(e,{displayMode:t,output:r?"htmlAndMathml":"html",throwOnError:!1,errorColor:"#cc0000",macros:up,strict:!1})}catch(n){return`<span class="katex-error" style="color:#cc0000" title="${String(n)}">${e}</span>`}}function U(e){return`calc(${typeof e=="number"?`${e}px`:e} * var(--edp-scale, 1))`}function Te(e){return{width:U(e),height:U(e)}}function ht(e){if(e==null||e==="")return;if(typeof e=="number")return U(e);let t=String(e).trim();return/^\d+(\.\d+)?px$/.test(t)?U(t):t}import{createContext as mp}from"react";var Gr=mp(!1),$n="1px solid #d1d5db",hp="#f3f4f6",fp="#e3e1dc",gp="var(--card, #fff)",er="edp-table-first",vi={overflowX:"auto",margin:`${U("1.25rem")} 0`},wi={left:!1,right:!1,held:0,rtl:!1};function ki(e,t,r,n=0){return{left:t.left<e.left-1,right:t.right>e.right+1,held:n,rtl:r}}function Si(e,t){return Math.max(80,Math.round((e-t)*.8))}var aa={borderCollapse:"separate",borderSpacing:0,width:"100%",tableLayout:"auto",fontSize:U("0.875rem"),lineHeight:1.3,borderBlockStart:$n,borderInlineStart:$n};function Yr(e){let t=e.gray?fp:e.header?hp:e.sticky?gp:void 0;return{borderBlockEnd:$n,borderInlineEnd:$n,padding:`${U("4px")} ${U("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 Qr(e){return Object.entries(e).map(([t,r])=>`${t.replace(/[A-Z]/g,n=>`-${n.toLowerCase()}`)}:${r}`).join(";")}function sa(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),d=Math.max(1,l.attrs?.rowspan??1);for(let u=i;u<i+d;u++){let f=n[u]??(n[u]=[]);for(let h=c;h<c+p;h++)f[h]=!0}for(let u=0;u<p;u++){let f=l.attrs?.colwidth?.[u];f&&t[c+u]==null&&(t[c+u]=f)}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 ia(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 wt,jsxs as ca}from"react/jsx-runtime";import{useCallback as bp,useEffect as yp,useLayoutEffect as xp,useRef as vp,useState as wp}from"react";var kp=typeof window<"u"?xp:yp;function Ri({side:e}){return wt("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:wt("path",{d:e==="left"?"M15 6l-6 6 6 6":"M9 6l6 6-6 6"})})}function Pi({children:e}){let t=ce(),r=vp(null),[n,o]=wp(wi),a=bp(()=>{let d=r.current,u=d?.querySelector("table");if(!d||!u)return;let f=d.querySelector(`.${er}`),h=ki(d.getBoundingClientRect(),u.getBoundingClientRect(),getComputedStyle(d).direction==="rtl",f?f.getBoundingClientRect().width:0);o(m=>m.left===h.left&&m.right===h.right&&m.held===h.held&&m.rtl===h.rtl?m:h)},[]);kp(()=>{let d=r.current;if(!d)return;a(),d.addEventListener("scroll",a,{passive:!0});let u=typeof ResizeObserver<"u"?new ResizeObserver(a):null;u?.observe(d);let f=d.querySelector("table");return f&&u?.observe(f),()=>{d.removeEventListener("scroll",a),u?.disconnect()}},[a]);let s=d=>{let u=r.current;u&&u.scrollBy({left:d*Si(u.clientWidth,n.held),behavior:"smooth"})},i=n.left||n.right,c=d=>i?wt("div",{className:`edp-table-arrows edp-table-arrows--${d}`,children:ca("span",{dir:"ltr",className:"edp-table-arrows__pair",children:[wt("button",{type:"button",className:"edp-table-arrow",onClick:()=>s(-1),disabled:!n.left,"aria-label":t.tableScrollLeft,children:wt(Ri,{side:"left"})}),wt("button",{type:"button",className:"edp-table-arrow",onClick:()=>s(1),disabled:!n.right,"aria-label":t.tableScrollRight,children:wt(Ri,{side:"right"})})]})}):null,l=n.rtl?0:n.held,p=n.rtl?n.held:0;return ca("div",{className:"edp-table-frame",style:{margin:`${U("1.25rem")} 0`},children:[c("top"),ca("div",{style:{position:"relative"},children:[wt("div",{ref:r,className:"edp-table-scroll",style:{overflowX:"auto"},children:e}),n.left&&wt("span",{className:"edp-table-shade edp-table-shade--left",style:{left:l},"aria-hidden":"true"}),n.right&&wt("span",{className:"edp-table-shade edp-table-shade--right",style:{right:p},"aria-hidden":"true"})]}),c("bottom")]})}var Ci={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"}},Ai={border:"#2563eb",background:"#e0f2fe"},Ni={border:"#dc2626",background:"#fee2e2"};function Sp(e){return{display:"inline-block",verticalAlign:"middle",border:`2px solid ${e?.border||Ai.border}`,background:e?.background||Ai.background,borderRadius:U("4px"),padding:"0.17em 0.37em"}}function Rp(e){let t=e?.shape==="circle"?"50%":"9999px";return{display:"inline-block",verticalAlign:"middle",border:`2px solid ${e?.border||Ni.border}`,background:e?.background||Ni.background,borderRadius:t,padding:"0.15em 0.45em"}}function Pp(e,t){if(!(!e&&!t))return{...e?{textAlign:e}:{},...t?{margin:0}:{}}}function ct(e,t,r){return oe("div",{className:"exercise-content",children:e.content.map((n,o)=>Ge(n,`node-${o}`,t,r))})}var Cp=/^[\u00a0\u202f ]?[.,;:!?\u2026)\]}\u00bb\u201d\u2019%\u060c\u061b\u061f]+/,Ap=new Set(["blank","inlineChoiceSet"]);function Ti(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=Ap.has(i.type)&&c?.type==="text"?Cp.exec(c.text??"")?.[0]:void 0;if(!l||!c){o.push(Ge(i,`${t}-${s}`,r,n));continue}let p=(c.text??"").slice(l.length);o.push(_i("span",{style:{whiteSpace:"nowrap"},children:[oe("span",{style:{whiteSpace:"normal"},children:Ge(i,`${t}-${s}-a`,r,n)}),Ge({...c,text:l},`${t}-${s}-p`,r,n)]},`${t}-${s}`)),p&&o.push(Ge({...c,text:p},`${t}-${s+1}`,r,n)),s++}return o}function Ge(e,t,r,n){switch(e.type){case"choiceSet":case"inlineChoiceSet":return oe(zn,{node:e,validationFeedback:r?.get(e.id)},t);case"blank":return e.attrs.mode==="typed"?oe(Dn,{node:e,validationFeedback:r?.get(e.id)},t):oe(On,{node:e,validationFeedback:r?.get(e.id)},t);case"blankPool":return oe(Bn,{node:e},t);case"inlinePool":return oe(jn,{node:e},t);case"matchingSet":return oe(qn,{node:e,validationFeedback:r?.get(e.id)},t);case"aiAnswerInput":return oe(Hn,{node:e,validationFeedback:r?.get(e.id),readOnly:n?.readOnly,mediaHandler:n?.mediaHandler,answerSheetHandler:n?.answerSheetHandler},t);case"openResponseNode":return oe(Un,{node:e,validationFeedback:r?.get(e.id),readOnly:n?.readOnly,mediaHandler:n?.mediaHandler,answerSheetHandler:n?.answerSheetHandler},t);case"mathResponse":{let o=oe(Kn,{nodeId:e.id,placeholder:e.attrs?.placeholder,hint:e.attrs?.hint,validationFeedback:r?.get(e.id),readOnly:n?.readOnly},t);return n?.inInline?o:oe("p",{className:"edp-slot-line",children:o},t)}case"codingResponse":return oe(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 oe("p",{dir:s,style:Pp(a,n?.inTable),children:Ti(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=Ci[o]??Ci[3];return oe(a,{dir:c,style:{...l,...i?{textAlign:i}:{}},children:Ti(e.content,t,r,n)},t)}case"blockquote":{let o=e.attrs,a=o?.dir||void 0,s=o?.textAlign;return oe("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)=>Ge(i,`${t}-${c}`,r,n))},t)}case"text":{let o=e,a=n?.inTable?ia(o.text??""):o.text??"",s=o.marks??[];if(s.length===0)return oe("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=oe("strong",{children:c});break;case"italic":c=oe("em",{children:c});break;case"underline":c=oe("u",{children:c});break;case"strike":c=oe("s",{children:c});break;case"code":c=oe("code",{children:c});break;case"subscript":c=oe("sub",{children:c});break;case"superscript":c=oe("sup",{children:c});break;case"boxedText":c=oe("span",{style:Sp(l.attrs),children:c});break;case"circleText":c=oe("span",{style:Rp(l.attrs),children:c});break}return oe("span",{style:Object.keys(i).length>0?i:void 0,children:c},t)}case"hardBreak":return oe("br",{},t);case"resizableImage":return oe("img",{src:e.attrs?.src||void 0,alt:e.attrs?.alt||"",style:{display:"inline-block",verticalAlign:"middle",width:ht(e.attrs?.width||void 0)??"auto",height:ht(e.attrs?.height||void 0)??"auto",maxWidth:"100%"}},t);case"resizableAudio":{let o=e.attrs??{src:""},a=n?.readOnly===!0;return oe(vt,{src:o.src||"",maxPlays:a?null:o.maxPlays,learnerSpeed:o.learnerSpeed,speed:o.speed,allowSeek:a?null:o.allowSeek},t)}case"resizableVideo":return oe("video",{src:e.attrs?.src||void 0,controls:!0,style:{display:"inline-block",verticalAlign:"middle",width:ht(e.attrs?.width||void 0)??"auto",height:ht(e.attrs?.height||void 0)??"auto",maxWidth:"100%"}},t);case"youtubeEmbed":return oe("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:ht(e.attrs?.width||480),height:ht(e.attrs?.height||270)}},t);case"inlineMath":return oe("span",{dir:"ltr",style:{unicodeBidi:"isolate",display:"inline-block"},className:"math-inline",dangerouslySetInnerHTML:{__html:Le(e.attrs?.latex??"",!1,!0)}},t);case"blockMath":return oe("div",{dir:"ltr",style:{unicodeBidi:"isolate",textAlign:"center",margin:"1em 0"},className:"math-block",dangerouslySetInnerHTML:{__html:Le(e.attrs?.latex??"",!0,!0)}},t);case"variable":return oe("span",{className:"variable",children:`{${e.attrs?.name}}`},t);default:{let o=e;if(o.type==="bulletList")return oe("ul",{style:{listStyleType:"disc",paddingLeft:"1.5em",margin:"0.5em 0"},children:o.content?.map((a,s)=>Ge(a,`${t}-${s}`,r,n))},t);if(o.type==="orderedList")return oe("ol",{style:{listStyleType:"decimal",paddingLeft:"1.5em",margin:"0.5em 0"},children:o.content?.map((a,s)=>Ge(a,`${t}-${s}`,r,n))},t);if(o.type==="listItem")return oe("li",{children:o.content?.map((a,s)=>Ge(a,`${t}-${s}`,r,n))},t);if(o.type==="table"){let a=sa(o.content),s={...n,inTable:!0,stickyCells:a.stickyCells};return oe(Pi,{children:_i("table",{style:aa,children:[a.columnWidths.length>0&&oe("colgroup",{children:a.columnWidths.map((i,c)=>oe("col",{style:i?{width:U(i)}:void 0},c))}),oe("tbody",{children:o.content?.map((i,c)=>Ge(i,`${t}-${c}`,r,s))})]})},t)}return o.type==="tableRow"?oe("tr",{children:o.content?.map((a,s)=>Ge(a,`${t}-${s}`,r,n))},t):o.type==="tableCell"?oe("td",{colSpan:o.attrs?.colspan,rowSpan:o.attrs?.rowspan,className:n?.stickyCells?.has(o)?er:void 0,style:Yr({header:!1,gray:!!o.attrs?.gray,sticky:!!n?.stickyCells?.has(o)}),children:oe(Gr.Provider,{value:!0,children:o.content?.map((a,s)=>Ge(a,`${t}-${s}`,r,n))})},t):o.type==="tableHeader"?oe("th",{colSpan:o.attrs?.colspan,rowSpan:o.attrs?.rowspan,className:n?.stickyCells?.has(o)?er:void 0,style:Yr({header:!0,gray:!!o.attrs?.gray,sticky:!!n?.stickyCells?.has(o)}),children:oe(Gr.Provider,{value:!0,children:o.content?.map((a,s)=>Ge(a,`${t}-${s}`,r,n))})},t):(console.warn(`Unknown node type during interpretation: ${e.type}`),null)}}}function ke(e,t){return e.map(r=>{if(r.type==="text"){let n=tr(t?.inTable?ia(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:${U("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?ke(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=sa(r.content),o=r.content?ke(r.content,{...t,inTable:!0,stickyCells:n.stickyCells}):"",a=n.columnWidths.length?`<colgroup>${n.columnWidths.map(s=>s?`<col style="width:${U(s)}">`:"<col>").join("")}</colgroup>`:"";return`<div style="${Qr(vi)}"><table style="${Qr(aa)}">${a}<tbody>${o}</tbody></table></div>`}if(r.type==="tableRow")return`<tr>${r.content?ke(r.content,t):""}</tr>`;if(r.type==="tableCell"){let n=r.content?ke(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="${er}"`:"";return`<td${o}${a}${i} style="${Qr(Yr({header:!1,gray:!!r.attrs?.gray,sticky:s}))}">${n}</td>`}if(r.type==="tableHeader"){let n=r.content?ke(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="${er}"`:"";return`<th${o}${a}${i} style="${Qr(Yr({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?ke(r.content,t):""}</ul>`;if(r.type==="orderedList")return`<ol style="list-style-type:decimal;padding-left:1.5em">${r.content?ke(r.content,t):""}</ol>`;if(r.type==="listItem")return`<li>${r.content?ke(r.content,t):""}</li>`;if(r.type==="blockquote"){let n=r.content?ke(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=Fn(n.width),a=Fn(n.height);return`<img src="${tr(n.src??"")}" alt="${tr(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="${tr(n.src??"")}" style="display:inline-block;vertical-align:middle;width:${U("260px")};max-width:100%;height:${U("36px")}"></audio>`}if(r.type==="resizableVideo"){let n=r.attrs??{},o=Fn(n.width),a=Fn(n.height);return`<video src="${tr(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/${tr(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:${ht(n.width||480)};height:${ht(n.height||270)}"></iframe>`}return r.type==="inlineMath"?`<span dir="ltr" class="math-inline" style="unicode-bidi:isolate;display:inline-block">${Le(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">${Le(r.attrs?.latex??"",!0,!0)}</div>`:r.type==="variable"?`<span class="variable">{${tr(r.attrs?.name??"")}}</span>`:""}).join("")}function Fn(e){return e==null||e===""?null:ht(e)??null}function tr(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}import{jsx as Np}from"react/jsx-runtime";import{createContext as Tp,useContext as Mi,useMemo as Ei}from"react";var _p={sm:.875,md:1,lg:1.25,xl:1.5},la=Tp(null);function Mp(e,t){let r={...e??{}};if(t)for(let[n,o]of Object.entries(t))o!==void 0&&(r[n]=o);return r}function Ep(e){return typeof e=="number"?Number.isFinite(e)&&e>0?e:1:e?_p[e]??1:1}function lt(e){let t=e??{};return{scale:Ep(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 nt(e){let t=Mi(la);return Ei(()=>Mp(t,e),[t,e?.size,e?.choiceLabels,e?.choiceColumns,e?.layoutBy,e?.motion,e?.shuffleSeed])}function ot(){let e=Mi(la);return Ei(()=>lt(e),[e])}function at({display:e,children:t}){let r=nt(e);return Np(la.Provider,{value:r,children:t})}function dt(e){if(e.sizeSet)return{"--edp-scale":String(e.scale)}}function rr(){let{motion:e}=ot();return{hop:e==="none"?"":"animate-hop",shake:e==="full"?"animate-shake":"",wobble:e==="full"?"animate-wobble":""}}function Lp(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 Ip(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 Xr(e,t){let r=[...e],n=Ip(Lp(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 Li,jsx as Ae,jsxs as $p}from"react/jsx-runtime";import{useState as Vn,useEffect as $i,useRef as Ii,useLayoutEffect as Fp,useCallback as zp}from"react";import{createPortal as Dp}from"react-dom";import Op from"clsx";var Bp=typeof window<"u"?Fp:$i;function da({node:e}){if(e.type==="text"){if(!e.marks||e.marks.length===0)return Ae(Li,{children:e.text});let t=e.text||"";for(let r of e.marks)r.type==="bold"?t=Ae("strong",{children:t}):r.type==="italic"?t=Ae("em",{children:t}):r.type==="underline"?t=Ae("u",{children:t}):r.type==="strike"?t=Ae("s",{children:t}):r.type==="textStyle"&&r.attrs?.color&&(t=Ae("span",{style:{color:r.attrs.color},children:t}));return Ae(Li,{children:t})}if(e.type==="paragraph")return Ae("span",{className:"block",children:e.content?.map((t,r)=>Ae(da,{node:t},r))??Ae("br",{})});if(e.type==="hardBreak")return Ae("br",{});if(e.type==="inlineMath"||e.type==="blockMath"){let t=String(e.attrs?.latex??""),r=e.type==="blockMath";return Ae("span",{className:r?"block text-center":void 0,dir:"ltr",dangerouslySetInnerHTML:{__html:Le(t,r)}})}return e.content?Ae("span",{className:"block",children:e.content.map((t,r)=>Ae(da,{node:t},r))}):null}function jp({nodes:e}){return Ae("span",{className:"block space-y-1",style:{color:"var(--ink, #1d2025)"},children:e.map((t,r)=>Ae(da,{node:t},r))})}function qp(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 qt({hint:e}){let t=ce(),[r,n]=Vn(!1),[o,a]=Vn(!1),[s,i]=Vn(null),[c,l]=Vn({}),p=Ii(null),d=Ii(null);$i(()=>{if(!o)return;let w=P=>{let g=P.target;p.current&&!p.current.contains(g)&&d.current&&!d.current.contains(g)&&(a(!1),n(!1))};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[o]);let u=zp(()=>{let w=p.current,P=d.current;!w||!P||i(qp(w.getBoundingClientRect(),P.getBoundingClientRect(),window.innerWidth))},[]);Bp(()=>{if(!r){i(null);return}let w=p.current;if(w){let P=getComputedStyle(w);l({direction:P.direction,fontFamily:P.fontFamily,"--edp-scale":P.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 f=()=>n(!0),h=()=>{o||n(!1)},m=w=>{w.stopPropagation(),o?(a(!1),n(!1)):(a(!0),n(!0))},b=r&&typeof document<"u"?Dp(Ae("span",{className:"edpire-scope",style:{...c,display:"contents"},children:Ae("span",{ref:d,role:"tooltip",className:"player-blank-hint-pop",onClick:w=>w.stopPropagation(),onMouseEnter:f,onMouseLeave:h,style:{position:"fixed",top:s?s.top:0,left:s?s.left:0,bottom:"auto",transform:"none",margin:0,visibility:s?"visible":"hidden"},children:Ae(jp,{nodes:e})})}),document.body):null;return $p("span",{ref:p,className:"relative inline-flex items-center align-middle",onMouseEnter:f,onMouseLeave:h,children:[Ae("button",{type:"button",onClick:m,className:Op("player-blank-hint-btn select-none",o&&"player-blank-hint-btn--pinned"),"aria-label":t.showHint,"aria-expanded":r,children:"?"}),b]})}function kt({hint:e}){return!e||e.length===0?null:Ae(qt,{hint:e})}function Kp(e){return[...e].map(t=>({v:t,r:Math.random()})).sort((t,r)=>t.r-r.r).map(t=>t.v)}var Wp=e=>e.replace(/ {2,}/g,t=>"&nbsp;".repeat(t.length-1)+" "),Vp=new Set(["image","resizableImage","resizableVideo","youtubeEmbed"]);function Oi(e){return(e??[]).some(t=>Vp.has(t?.type)||Oi(t?.content))}var zi=()=>Fe("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:3,children:Fe("path",{d:"M5 13l4 4L19 7"})}),Di=()=>Fe("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:3,children:Fe("path",{d:"M6 6l12 12M18 6L6 18"})});function zn({node:e,validationFeedback:t}){let r=Ne(),n=ce(),o=ot(),a=rr(),{id:s,content:i,attrs:c}=e,l=c.shuffle??!1,p="prompt"in c?c.prompt:void 0,d="separator"in c?c.separator??"/":"/",u="pickLimit"in c&&c.pickLimit?c.pickLimit:1,f=c.hideCount===!0,h=f||u>1,m=!f&&u>1,b="layout"in c?c.layout??"row":"row",w=e.type==="inlineChoiceSet",P=JSON.stringify(i),g=l&&o.shuffleSeed!==void 0,R=Up(()=>g?Xr(i,`${o.shuffleSeed}:${s}`):null,[g,o.shuffleSeed,s,P]),[_,A]=Fi(i);pa(()=>{g||A(l?Kp(i):i)},[l,g,P]);let I=R??_,[C,L]=Fi(new Set),v=t?.showFeedback??!1,S=t?.correctChoiceIds||[];pa(()=>{let N=H=>{let k=H.answers.find(W=>W.nodeId===s&&W.type==="choiceSet");k&&"selectedIds"in k.answer&&L(new Set(k.answer.selectedIds))};return r.on("answers:prefill",N),()=>r.off("answers:prefill",N)},[s,r]),pa(()=>{r.emit({type:"answer:changed",answer:{nodeId:s,type:"choiceSet",timestamp:Date.now(),answer:{selectedIds:Array.from(C)}}})},[C,s,r]);let x=N=>{v||L(H=>{let M=new Set(H);return h?M.has(N)?M.delete(N):(f||M.size<u)&&M.add(N):M.has(N)?M.delete(N):(M.clear(),M.add(N)),M})},B=N=>Wp(ke(N.content)),E=N=>{let H=C.has(N),M=S.includes(N);return v?M&&H?"correct":M&&!H?"correct-unchosen":!M&&H?"incorrect":"muted":H?"selected":"idle"},y={idle:"",selected:"player-choice--selected",correct:_t("player-choice--correct",a.hop),"correct-unchosen":"player-choice--correct-unchosen",incorrect:_t("player-choice--incorrect",a.shake),muted:"player-choice--muted"},K={idle:"",selected:"player-inline-choice--selected",correct:_t("player-inline-choice--correct",a.hop),"correct-unchosen":"player-inline-choice--correct-unchosen",incorrect:_t("player-inline-choice--incorrect",a.shake),muted:"player-inline-choice--muted"};if(w)return xr("span",{className:"inline-choice",children:[p&&xr("span",{className:"mr-2 font-medium",children:[p,m?Fe("span",{className:"ms-1 opacity-60",children:n.chooseN(u)}):null]}),I.map((N,H)=>xr(Hp,{children:[Fe("button",{type:"button",disabled:v,onClick:()=>x(N.id),className:_t("player-inline-choice",K[E(N.id)]),"aria-pressed":C.has(N.id),dangerouslySetInnerHTML:{__html:B(N)}}),H<I.length-1&&Fe("span",{className:"mx-1",children:d})]},N.id)),c.hint&&c.hint.length>0&&Fe(qt,{hint:c.hint})]});let F=o.layoutBy==="box",Y=o.choiceColumns?Math.min(o.choiceColumns,I.length):0,$=Y?{gridAutoRows:"1fr",gridTemplateColumns:`repeat(${Y}, minmax(0, 1fr))`}:{gridAutoRows:"1fr"},O=I.some(N=>Oi(N.content)),G=o.choiceLabels==="letters",T=N=>n.choiceLetters[N]??String(N+1);return xr("div",{className:_t("cs-player my-4 space-y-3",F&&"cs-player--box"),children:[p&&xr("p",{className:"font-medium",children:[p,m?Fe("span",{className:"ms-2 text-sm opacity-70",children:n.chooseN(u)}):null]}),c.hint&&c.hint.length>0&&Fe(qt,{hint:c.hint}),Fe("div",{className:_t("cs-player__grid",b==="row"&&"cs-player__grid--row"),style:$,children:I.map((N,H)=>{let M=E(N.id),k=M==="incorrect"?"incorrect":M==="correct"||M==="correct-unchosen"?"correct":null;return xr("button",{type:"button",disabled:v,onClick:()=>x(N.id),className:_t("player-choice",O&&"player-choice--tile",y[M]),"aria-pressed":C.has(N.id),children:[Fe("span",{className:_t("player-choice__mark",h?"player-choice__mark--box":"player-choice__mark--radio",G&&"player-choice__mark--letter"),children:G?T(H):M==="incorrect"?Fe(Di,{}):Fe(zi,{})}),Fe("span",{className:"player-choice__text",dangerouslySetInnerHTML:{__html:B(N)}}),G&&k&&Fe("span",{className:`player-choice__verdict player-choice__verdict--${k}`,"aria-hidden":"true",children:k==="incorrect"?Fe(Di,{}):Fe(zi,{})})]},N.id)})})]})}import{jsx as Mt,Fragment as Gp,jsxs as ua}from"react/jsx-runtime";import{useContext as Yp,useState as Qp,useEffect as ma,useRef as Xp,useCallback as Jp}from"react";import nr from"clsx";function Dn({node:e,validationFeedback:t}){let r=Ne(),n=ce(),o=rr(),{id:a,attrs:s}=e,{placeholder:i="___",width:c="auto",hint:l}=s,p=Xp(null),d=i.trim().split(/\s+/).filter(Boolean).length,u=Yp(Gr),f=!u&&c==="auto"&&d>=4,[h,m]=Qp(""),b=t?.showFeedback??!1,w=t?.state,P=w==="validating",g=t?.displayAnswer,R=t?.message;ma(()=>{let C=L=>{let S=L.answers.find(x=>x.nodeId===a&&x.type==="blank");S&&"mode"in S.answer&&S.answer.mode==="typed"&&"text"in S.answer&&m(S.answer.text)};return r.on("answers:prefill",C),()=>r.off("answers:prefill",C)},[a,r]),ma(()=>{r.emit({type:"answer:changed",answer:{nodeId:a,type:"blank",timestamp:Date.now(),answer:{mode:"typed",text:h}}})},[h,a,r]);let _=C=>{m(C.target.value)},A=Jp(()=>{let C=p.current;C&&(C.style.height="auto",C.style.height=`${C.scrollHeight}px`)},[]);ma(()=>{A()},[h,A]);let I=b&&!P;return ua("span",{className:u?"player-blank-cell":nr("inline-flex flex-wrap items-center gap-x-1 gap-y-0.5 align-middle max-w-full",f&&"w-full"),children:[Mt("span",{className:u?"player-blank-cell__box":nr("relative inline-block shrink-0 min-w-0 max-w-full",f&&"w-full flex-1"),children:I?Mt("span",{className:nr("player-typed-blank-feedback",u&&"player-typed-blank-feedback--cell",f&&"w-full",w==="correct"&&nr("player-typed-blank-feedback--correct",o.hop),w==="partial"&&"player-typed-blank-feedback--partial",w==="incorrect"&&nr("player-typed-blank-feedback--incorrect",o.wobble)),children:h||Mt("span",{className:"opacity-40",children:i})}):ua(Gp,{children:[Mt("textarea",{ref:p,"aria-label":n.blankAnswerAria,placeholder:i,value:h,onChange:_,disabled:b,rows:1,wrap:u?"off":void 0,className:nr("player-typed-blank",u&&"player-typed-blank--cell",f&&"w-full",P&&"player-typed-blank--pending"),style:u?void 0:c!=="auto"?{width:c}:f?{width:"100%"}:{width:`${Math.max(7,h.length+1)}ch`,maxWidth:"100%"}}),!h&&!P&&!u&&Mt("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"}),P&&Mt("span",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:Mt("span",{className:"player-typed-blank-spinner","aria-label":n.aiEvaluationInProgressAria})})]})}),b&&w==="incorrect"&&g&&ua("span",{className:"player-blank-reveal",children:["(",g,")"]}),b&&R&&Mt("span",{className:nr("player-blank-feedback",w==="correct"&&"player-blank-feedback--correct",w==="partial"&&"player-blank-feedback--partial",w==="incorrect"&&"player-blank-feedback--incorrect"),children:R}),l&&l.length>0&&Mt(qt,{hint:l})]})}import{jsx as Yn,Fragment as Hi,jsxs as fa}from"react/jsx-runtime";import{useEffect as Ui}from"react";import Qn from"clsx";import{useDroppable as au,useDndContext as su}from"@dnd-kit/core";import{jsx as Zp}from"react/jsx-runtime";import{createContext as eu,useCallback as Ht,useContext as tu,useEffect as ru,useMemo as Bi,useRef as nu,useState as ha}from"react";import{useDndMonitor as ou}from"@dnd-kit/core";var qi=eu(null);function St(){let e=tu(qi);if(!e)throw new Error("usePool must be used within a PoolProvider");return e}function ji(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 Gn({children:e,initialAnswers:t}){let r=Ne(),n=Bi(()=>ji(t),[t]),[o,a]=ha(n),[s,i]=ha({}),[c,l]=ha({}),p=nu(new Set);ru(()=>{let R=_=>{let A=ji(_.answers);Object.keys(A).length!==0&&a(I=>{if(!Object.entries(A).some(([v,S])=>I[v]?.choiceId!==S.choiceId||I[v]?.poolId!==S.poolId||I[v]?.value!==S.value))return I;let L={...I,...A};return i(v=>{let S={...v};for(let[x,B]of Object.entries(v)){let E=new Set(Object.values(L).filter(y=>y.poolId===x).map(y=>y.choiceId));S[x]={...B,available:new Set(B.choices.map(y=>y.id).filter(y=>!E.has(y)))}}return S}),L})};return r.on("answers:prefill",R),()=>r.off("answers:prefill",R)},[r]);let d=Ht((R,_)=>{i(A=>{let I=A[R];if(!I){let x=new Set;for(let E of Object.values(o))E.poolId===R&&x.add(E.choiceId);let B=new Set(_.map(E=>E.id).filter(E=>!x.has(E)));return{...A,[R]:{choices:_,available:B}}}let C=new Set(I.choices.map(x=>x.id)),L=new Set(_.map(x=>x.id));if(!(_.some(x=>!C.has(x.id))||I.choices.some(x=>!L.has(x.id))))return A;let S=new Set;for(let x of I.available)L.has(x)&&S.add(x);for(let x of _)C.has(x.id)||S.add(x.id);return{...A,[R]:{choices:_,available:S}}})},[o]),u=Ht((R,_)=>{l(A=>{let I=A[R]??[];return I.includes(_)?A:{...A,[R]:[...I,_]}}),!p.current.has(_)&&!o[_]&&(p.current.add(_),r.emit({type:"answer:changed",answer:{nodeId:_,type:"blank",timestamp:Date.now(),answer:{mode:"choice",choiceId:"",poolId:R,value:""}}}))},[o,r]),f=Ht(R=>(c[R]??[]).find(A=>!o[A])??null,[c,o]),h=Ht((R,_,A,I)=>{a(C=>{let L=C[R];return L&&i(v=>{let S=v[L.poolId];if(!S)return v;let x=new Set(S.available);return x.add(L.choiceId),{...v,[L.poolId]:{...S,available:x}}}),{...C,[R]:{choiceId:A,value:I,poolId:_}}}),i(C=>{let L=C[_];if(!L)return C;let v=new Set(L.available);return v.delete(A),{...C,[_]:{...L,available:v}}}),r.emit({type:"answer:changed",answer:{nodeId:R,type:"blank",timestamp:Date.now(),answer:{mode:"choice",choiceId:A,poolId:_,value:I}}})},[r]),m=Ht(R=>{let _=o[R];if(!_)return;let{poolId:A,choiceId:I}=_;i(C=>{let L=C[A];if(!L)return C;let v=new Set(L.available);return v.add(I),{...C,[A]:{...L,available:v}}}),a(C=>{let{[R]:L,...v}=C;return v}),r.emit({type:"answer:changed",answer:{nodeId:R,type:"blank",timestamp:Date.now(),answer:{mode:"choice",choiceId:"",poolId:A,value:""}}})},[o,r]),b=Ht((R,_)=>s[R]?.available.has(_)??!1,[s]),w=Ht((R,_)=>s[R]?.choices.find(A=>A.id===_),[s]),P=Ht(()=>{a({}),i(R=>{let _={};for(let[A,I]of Object.entries(R))_[A]={choices:I.choices,available:new Set(I.choices.map(C=>C.id))};return _});for(let[R,_]of Object.entries(c))for(let A of _)r.emit({type:"answer:changed",answer:{nodeId:A,type:"blank",timestamp:Date.now(),answer:{mode:"choice",choiceId:"",poolId:R,value:""}}})},[c,r]);ou({onDragEnd(R){window.dispatchEvent(new CustomEvent("dnd-drop",{detail:{active:R.active,over:R.over}}))}});let g=Bi(()=>({blanks:o,pools:s,registerPool:d,registerBlank:u,fill:h,back:m,isAvailable:b,getChoice:w,firstEmptyBlank:f,resetAllAnswers:P}),[o,s,d,u,h,m,b,w,f,P]);return Zp(qi.Provider,{value:g,children:e})}function On({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:d}=St(),u=ce(),f=rr(),h=i[r],m=!!h?.choiceId,b=t?.showFeedback??!1,w=t?.state,P=t?.correctChoiceIds??[],g=b&&w==="incorrect"&&P.length>0?p(o||"",P[0]):void 0,R=g?g.html.replace(/<\/?[^>]+(>|$)/g,""):void 0,{setNodeRef:_,isOver:A}=au({id:r,data:{type:"blank",blankId:r,poolId:o}}),{active:I}=su(),C=!!I&&I.data.current?.poolId===o;return Ui(()=>{d(o||"",r)},[o,r,d]),Ui(()=>{let S=x=>{let B=x,{active:E,over:y}=B.detail||{};if(!y||y.id!==r)return;let{choiceId:K,poolId:F}=E?.data.current||{};if(!K||F!==o)return;let Y=p(o||"",K);if(!Y)return;let $=Y.html.replace(/<\/?[^>]+(>|$)/g,"");c(r,o||"",K,$)};return window.addEventListener("dnd-drop",S),()=>window.removeEventListener("dnd-drop",S)},[r,o,p,c]),fa(Hi,{children:[Yn("span",{ref:_,onClick:()=>{m&&!b&&l(r)},className:Qn("player-choice-blank",A&&"player-choice-blank--over",!A&&C&&!m&&!b&&"player-choice-blank--target",m&&!b&&!A&&"player-choice-blank--filled",b&&w==="correct"&&Qn("player-choice-blank--correct",f.hop),b&&w==="partial"&&Qn("player-choice-blank--partial",f.hop),b&&w==="incorrect"&&Qn("player-choice-blank--incorrect",f.wobble)),title:m&&!b?u.clickToRemove:void 0,"data-node-id":r,"data-pool-id":o,children:m?fa(Hi,{children:[Yn("span",{children:h.value}),!b&&Yn("span",{className:"player-choice-blank__clear",children:"\xD7"})]}):a}),R&&fa("span",{className:"player-blank-reveal",children:["(",R,")"]}),Yn(kt,{hint:s})]})}import{jsx as ya,jsxs as mu}from"react/jsx-runtime";import{useEffect as Zi,useRef as hu,useState as fu}from"react";import gu from"clsx";import{jsx as Ji,jsxs as du}from"react/jsx-runtime";import pu from"clsx";import{useDraggable as uu}from"@dnd-kit/core";import{jsx as or,jsxs as Ki}from"react/jsx-runtime";import{useEffect as Wi,useState as Vi}from"react";import iu from"clsx";var Gi="edpire:tap-hint-placed",Yi=2;function cu(e){let r=(()=>{try{return Number(e?.getItem(Gi))||0}catch{return 0}})(),n=new Set,o=new Set,a=()=>n.forEach(s=>s());return{done:()=>r>=Yi,placed:()=>r,recordPlacement(){if(!(r>=Yi)){r+=1;try{e?.setItem(Gi,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 ga=null;function ba(){if(!ga){let e=null;try{e=typeof window<"u"?window.localStorage:null}catch{e=null}ga=cu(e)}return ga}function Qi(){typeof window>"u"||ba().recordPlacement()}function lu(){try{return window.matchMedia("(hover: none) and (pointer: coarse)").matches}catch{return!1}}function Xn(e,t){let[,r]=Vi(0),[n,o]=Vi(!1);if(Wi(()=>{o(lu())},[]),Wi(()=>{let s=e.current;if(!n||!s)return;let i=ba();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 d of p)i.setOnScreen(s,d.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=ba();return!a.done()&&a.owner()===e.current}function Xi(){let{motion:e}=ot();return Ki("span",{className:iu("player-tap-hint",e==="none"&&"player-tap-hint--still"),"aria-hidden":"true",children:[or("span",{className:"player-tap-hint__ripple"}),or("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)=>Ki("g",{...t,children:[or("path",{d:"M22 14a8 8 0 0 1-8 8"}),or("path",{d:"M18 11v-1a2 2 0 0 0-2-2a2 2 0 0 0-2 2"}),or("path",{d:"M14 10V9a2 2 0 0 0-2-2a2 2 0 0 0-2 2v1"}),or("path",{d:"M10 9.5V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v10"}),or("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 vr({poolId:e,data:t,isInline:r=!1,tapHint:n=!1}){let{isAvailable:o,firstEmptyBlank:a,fill:s}=St(),{id:i,html:c}=t,l=!o(e,i),{setNodeRef:p,attributes:d,listeners:u,transform:f,isDragging:h}=uu({id:i,data:{type:"choice",choiceId:i,poolId:e,html:c},disabled:l});if(l)return null;let m=g=>g.replace(/<\/?[^>]+(>|$)/g,""),b=()=>{let g=a(e);if(g){let R=m(c);s(g,e,i,R),Qi()}},w=f?{transform:`translate3d(${f.x}px, ${f.y}px, 0)`}:void 0;return du(r?"span":"div",{ref:p,style:w,className:pu("player-bank-pill",h&&"player-bank-pill--dragging",n&&!h&&"player-bank-pill--hinted",r&&"mx-1"),...d,...u,onClick:b,children:[Ji("span",{dangerouslySetInnerHTML:{__html:c},className:"pointer-events-none whitespace-pre-wrap break-words"}),n&&!h&&Ji(Xi,{})]})}function Bn({node:e}){let t=ce(),{id:r,attrs:n,content:o}=e,{shuffle:a=!0,equalWidth:s=!1}=n,{registerPool:i,isAvailable:c}=St(),l=hu(null),[p,d]=fu(()=>o.map(h=>({id:h.id,html:ke(h.content)})));Zi(()=>{let h=o.map(m=>({id:m.id,html:ke(m.content)}));d(a?[...h].map(m=>({v:m,r:Math.random()})).sort((m,b)=>m.r-b.r).map(m=>m.v):h)},[a,JSON.stringify(o)]),Zi(()=>{i(r,p)},[r,p,i]);let u=p.find(h=>c(r,h.id))?.id,f=Xn(l,u!==void 0);return mu("div",{ref:l,className:"player-word-bank",children:[ya("div",{className:"player-word-bank__label",children:t.wordBank}),ya("div",{className:gu("player-word-bank__items",s&&"player-word-bank__items--grid"),children:p.map(h=>ya(vr,{poolId:r,data:h,tapHint:f&&h.id===u},h.id))})]})}import{jsx as xa,jsxs as bu}from"react/jsx-runtime";import{useEffect as ec,useRef as yu,useState as xu}from"react";function jn({node:e}){let{id:t,attrs:r,content:n}=e,{shuffle:o=!0,separator:a=" "}=r,{registerPool:s,isAvailable:i}=St(),c=yu(null),[l,p]=xu(()=>n.map(f=>({id:f.id,html:ke(f.content,{stripParagraphs:!0})})));ec(()=>{let f=n.map(h=>({id:h.id,html:ke(h.content,{stripParagraphs:!0})}));p(o?[...f].map(h=>({v:h,r:Math.random()})).sort((h,m)=>h.r-m.r).map(h=>h.v):f)},[o,JSON.stringify(n)]),ec(()=>{s(t,l)},[t,l,s]);let d=l.find(f=>i(t,f.id))?.id,u=Xn(c,d!==void 0);return xa("span",{ref:c,style:{display:"inline-flex",flexWrap:"wrap",gap:U("0.25rem"),alignItems:"center"},children:l.map((f,h)=>bu("span",{children:[xa(vr,{poolId:t,data:f,isInline:!0,tapHint:u&&f.id===d}),h<l.length-1&&xa("span",{children:a})]},f.id))})}import{jsx as wr,jsxs as ka}from"react/jsx-runtime";import{useState as Sa,useEffect as Ra,useMemo as Su}from"react";import{Check as Ru,X as Pu}from"lucide-react";import{jsx as De,jsxs as ar}from"react/jsx-runtime";import{useState as va,useMemo as wa,useRef as Jn,useCallback as vu,useLayoutEffect as wu}from"react";var tc="#1d2025",rc="#8d93a0",nc="#1f8a4c",oc="#d23b2b",ku=11;function ac({leftItems:e,rightItems:t,connections:r,direction:n,disabled:o,feedback:a,onConnectionsChange:s}){let[i,c]=va(null),[l,p]=va(null),[d,u]=va(new Map),f=Jn(null),h=Jn(new Map),m=Jn("mouse"),b=a?.showFeedback??!1,w=wa(()=>{let T=new Map;if(a?.pairFeedback)for(let N of a.pairFeedback)T.set(`${N.leftId}-${N.rightId}`,N.correct);return T},[a]),P=wa(()=>{let T=new Map;return a?.correctPairings?.forEach(N=>T.set(N.leftId,N.rightId)),T},[a]),g=wa(()=>{let T=new Map;return a?.correctPairings?.forEach(N=>T.set(N.rightId,N.leftId)),T},[a]),R=new Map,_=new Map;r.forEach((T,N)=>{R.set(T.leftId,N),_.set(T.rightId,N)});let A=T=>{let N=r[T];if(!b||!N)return null;let H=w.get(`${N.leftId}-${N.rightId}`);return H===!0?"correct":H===!1?"incorrect":null},I=vu(()=>{if(!f.current)return;let T=f.current.getBoundingClientRect(),N=new Map;h.current.forEach((H,M)=>{if(H){let k=H.getBoundingClientRect();N.set(M,new DOMRect(k.left-T.left,k.top-T.top,k.width,k.height))}}),u(N)},[]);wu(()=>{I();let T=new ResizeObserver(I);return f.current&&T.observe(f.current),()=>T.disconnect()},[I,r,e,t]);let C=8,L=(T,N)=>{let H=d.get(T);if(!H)return null;let M=H.y+H.height/2;return N==="left"?{x:H.x+H.width,y:M}:{x:H.x-C,y:M}},v=(T,N)=>{if(o)return;let M=(N==="left"?R:_).has(T),k=i?.id===T&&i?.side===N,W=i!==null&&i.side!==N;if(k){c(null);return}if(W){let V=N==="right"?i.id:T,ne=N==="left"?i.id:T,le=r.filter(Z=>Z.leftId!==V&&Z.rightId!==ne);le.push({leftId:V,rightId:ne}),s(le),c(null);return}if(M&&!i){let V=N==="left"?r.filter(ne=>ne.leftId!==T):r.filter(ne=>ne.rightId!==T);s(V);return}c({id:T,side:N})},S=Jn(null),x=(T,N,H)=>{if(o||(m.current=H.pointerType,H.pointerType==="touch"))return;H.currentTarget.setPointerCapture(H.pointerId);let M=f.current.getBoundingClientRect();S.current={x:H.clientX-M.left,y:H.clientY-M.top},p({fromId:T,fromSide:N,x:H.clientX-M.left,y:H.clientY-M.top,overId:null,overSide:null})},B=T=>{if(!l)return;let N=f.current.getBoundingClientRect(),H=T.clientX-N.left,M=T.clientY-N.top,k=l.fromSide==="left"?"right":"left",W=k==="left"?e:t,V=null,ne=null;for(let le of W){let Z=d.get(le.id);if(Z&&H>=Z.x&&H<=Z.x+Z.width&&M>=Z.y&&M<=Z.y+Z.height){V=le.id,ne=k;break}}p(le=>le?{...le,x:H,y:M,overId:V,overSide:ne}:null)},E=T=>{if(!l)return;let N=f.current.getBoundingClientRect(),H=T.clientX-N.left,M=T.clientY-N.top,k=S.current;if((k?Math.hypot(H-k.x,M-k.y):999)<8){p(null),v(l.fromId,l.fromSide);return}if(l.overId&&l.overSide){let V=l.fromSide==="left"?l.fromId:l.overId,ne=l.fromSide==="right"?l.fromId:l.overId,le=r.filter(Z=>Z.leftId!==V&&Z.rightId!==ne);le.push({leftId:V,rightId:ne}),s(le)}p(null),c(null)},y=(T,N)=>{if(!b)return null;let M=(N==="left"?R:_).get(T.id);if(M!==void 0){let k=r[M];if(w.get(`${k.leftId}-${k.rightId}`)===!0)return null}if(N==="left"){let k=P.get(T.id);return t.find(W=>W.id===k)?.content??null}else{let k=g.get(T.id);return e.find(W=>W.id===k)?.content??null}},K=(T,N)=>{let M=(N==="left"?R:_).get(T.id),k=M!==void 0,W=i?.id===T.id&&i?.side===N,V=i!==null&&i.side!==N&&!k,ne=l?.overId===T.id&&l?.overSide===N,le=k?A(M):null,Z=k?M+1:null,se="matching-player__item";k&&(se+=" matching-player__item--matched"),le==="correct"&&(se+=" matching-player__item--correct"),le==="incorrect"&&(se+=" matching-player__item--incorrect"),W&&(se+=" matching-player__item--selected"),(V||ne)&&(se+=" matching-player__item--available"),o&&(se+=" matching-player__item--disabled");let ve=y(T,N);return ar("button",{ref:ye=>{ye?h.current.set(T.id,ye):h.current.delete(T.id)},type:"button",className:se,onPointerDown:ye=>x(T.id,N,ye),onClick:()=>{m.current==="touch"&&v(T.id,N)},"aria-pressed":W,children:[N==="right"&&De("span",{className:"matching-player__connector matching-player__connector--right","aria-hidden":!0,children:ar("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:[De("circle",{cx:"9",cy:"9",r:"8",stroke:"currentColor",strokeWidth:"1.5",fill:"currentColor",fillOpacity:"0.08"}),De("path",{d:"M12 9H6M8.5 6.5L6 9l2.5 2.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}),k&&N==="left"&&De("span",{className:"matching-player__pair-num","aria-hidden":!0,children:Z}),De("span",{className:"matching-player__item-text",dangerouslySetInnerHTML:{__html:ke(T.content)}}),ve&&ar("span",{className:"matching-player__correct-hint",children:["(",De("span",{dangerouslySetInnerHTML:{__html:ke(ve)}}),")"]}),k&&N==="right"&&De("span",{className:"matching-player__pair-num","aria-hidden":!0,children:Z}),N==="left"&&De("span",{className:"matching-player__connector matching-player__connector--left","aria-hidden":!0,children:ar("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:[De("circle",{cx:"9",cy:"9",r:"8",stroke:"currentColor",strokeWidth:"1.5",fill:"currentColor",fillOpacity:"0.08"}),De("path",{d:"M6 9h6M9.5 6.5L12 9l-2.5 2.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})})]},T.id)},F=n==="ltr"?e:t,Y=n==="ltr"?t:e,$=n==="ltr"?"left":"right",O=n==="ltr"?"right":"left";return ar("div",{ref:f,className:`matching-player__arena${l?" matching-player__arena--dragging":""}`,onPointerMove:B,onPointerUp:E,children:[ar("svg",{className:"matching-player__svg","aria-hidden":!0,children:[De("defs",{children:[["mp-arrow-ink",tc],["mp-arrow-correct",nc],["mp-arrow-incorrect",oc],["mp-arrow-ghost",rc]].map(([T,N])=>De("marker",{id:T,markerUnits:"userSpaceOnUse",markerWidth:"11",markerHeight:"9",refX:"0",refY:"4.5",orient:"auto",children:De("polygon",{points:"0 0, 11 4.5, 0 9",fill:N})},T))}),r.map(T=>{let N=L(T.leftId,"left"),H=L(T.rightId,"right");if(!N||!H)return null;let M=H.x-ku,k=Math.max(16,Math.abs(M-N.x)*.4),W=`M ${N.x} ${N.y} C ${N.x+k} ${N.y}, ${M-k} ${H.y}, ${M} ${H.y}`,V=b?w.get(`${T.leftId}-${T.rightId}`):void 0;return De("path",{d:W,stroke:V===!0?nc:V===!1?oc:tc,strokeWidth:"2.5",fill:"none",markerEnd:`url(#${V===!0?"mp-arrow-correct":V===!1?"mp-arrow-incorrect":"mp-arrow-ink"})`},`${T.leftId}-${T.rightId}`)}),l&&(()=>{let T=L(l.fromId,l.fromSide);if(!T)return null;let N=Math.abs(l.x-T.x)*.35,H=`M ${T.x} ${T.y} C ${T.x+N} ${T.y}, ${l.x-N} ${l.y}, ${l.x} ${l.y}`;return De("path",{d:H,stroke:rc,strokeWidth:"2",strokeDasharray:"6 4",fill:"none",markerEnd:"url(#mp-arrow-ghost)"})})()]}),ar("div",{className:"matching-player__columns",children:[De("div",{className:"matching-player__column",children:F.map(T=>K(T,$))}),De("div",{className:"matching-player__column",children:Y.map(T=>K(T,O))})]})]})}var sc=e=>Number.isInteger(e)?String(e):e.toFixed(2);function ic(e){return[...e].map(t=>({v:t,r:Math.random()})).sort((t,r)=>t.r-r.r).map(t=>t.v)}function qn({node:e,validationFeedback:t}){let r=Ne(),{shuffleSeed:n,layoutBy:o}=ot(),{id:a,attrs:s,leftItems:i,rightItems:c}=e,{direction:l,shuffle:p,hint:d}=s,u=JSON.stringify(i),f=JSON.stringify(c),h=p&&n!==void 0,m=Su(()=>h?{left:Xr(i,`${n}:${a}:left`),right:Xr(c,`${n}:${a}:right`)}:null,[h,n,a,u,f]),[b,w]=Sa(i),[P,g]=Sa(c);Ra(()=>{h||(p?(w(ic(i)),g(ic(c))):(w(i),g(c)))},[p,h,u,f]);let R=m?.left??b,_=m?.right??P,[A,I]=Sa([]),C=t?.showFeedback??!1;Ra(()=>{let E=y=>{let F=y.answers.find(Y=>Y.nodeId===a&&Y.type==="matchingSet");F&&"connections"in F.answer&&I(F.answer.connections)};return r.on("answers:prefill",E),()=>r.off("answers:prefill",E)},[r,a]),Ra(()=>{r.emit({type:"answer:changed",answer:{nodeId:a,type:"matchingSet",timestamp:Date.now(),answer:{connections:A}}})},[r,a,A]);let L=E=>{C||I(E)},v=t?.score,S=t?.maxScore,x=C&&v!=null&&S!=null,B=x?v>=S?"correct":v>0?"partial":"incorrect":null;return ka("div",{className:o==="box"?"matching-player matching-player--box":"matching-player",children:[d&&d.length>0&&wr("div",{className:"matching-player-hintrow",children:wr(kt,{hint:d})}),wr(ac,{leftItems:R,rightItems:_,connections:A,direction:l,disabled:C,feedback:t,onConnectionsChange:L}),x&&ka("div",{className:"matching-player-feedback matching-player-feedback--"+B,children:[B==="correct"&&wr(Ru,{size:15,style:Te(15)}),B==="incorrect"&&wr(Pu,{size:15,style:Te(15)}),wr("span",{children:B==="correct"?"All matched":B==="partial"?"Partial credit":"Not matched"}),ka("span",{className:"matching-player-score",children:[sc(v)," / ",sc(S)]})]})]})}import{jsx as je,jsxs as gt,Fragment as Cl}from"react/jsx-runtime";import{useState as Al,useEffect as ms,useRef as Nl,useCallback as hs}from"react";import Ir from"clsx";import{jsx as Qe,jsxs as Pt,Fragment as kl}from"react/jsx-runtime";import{useCallback as xh,useEffect as Sl,useMemo as vh,useRef as un,useState as Lr}from"react";import mn from"clsx";import{Camera as wh,NotebookPen as kh,PenLine as Sh}from"lucide-react";var Cu=["unreadable","limit","busy","network","cut","failed"];function Jr(e){let t=e instanceof Error?e.message:"";return Cu.includes(t)?t:"failed"}function Et(e){return!!e?.uploadPhoto&&!!e.readPages}function Pa(e){return Et(e)||!!e?.transcribePhotos}import{jsx as Rt,jsxs as cn}from"react/jsx-runtime";import{forwardRef as Am,useEffect as lr,useImperativeHandle as Nm,useRef as sn,useState as Tm}from"react";import Uc from"clsx";import{Keyboard as _m}from"lucide-react";import{useEditor as Mm,EditorContent as Em}from"@tiptap/react";import{Extension as Lm}from"@tiptap/core";import{Fragment as Im,Slice as $m}from"@tiptap/pm/model";import{Selection as Kc}from"@tiptap/pm/state";import Fm from"@tiptap/starter-kit";import{Placeholder as zm}from"@tiptap/extensions";var cc,kr={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:{}},Ca=null;function lc(e){Ca=e}var Au=150,Nu=80,Zn=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()},Nu),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&&Ca&&typeof document<"u"&&(this.view=Ca(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()},Au)}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))}},Tu=typeof window<"u",_e=Tu?(cc=window).__edpMathInputV1??(cc.__edpMathInputV1=new Zn):new Zn;import{Node as yc,mergeAttributes as xc}from"@tiptap/core";import{Fragment as Eu}from"@tiptap/pm/model";import{TextSelection as uc}from"@tiptap/pm/state";function _u(e){let t=/^\\left\(([\s\S]*)\\right[).]$/.exec(e);if(!t)return null;let r=0;for(let n of t[1].matchAll(/\\(left|right)(?![a-zA-Z])/g))if(r+=n[1]==="left"?1:-1,r<0)return null;return r===0?t[1]:null}function Mu(e,t){return/^\\[dt]?frac(?![a-zA-Z])|^\\sqrt(?![a-zA-Z])|^[\^_]\{/.test(e)||e.includes(`^{${t}}`)||e.includes(`_{${t}}`)}function Sr(e){let t=e,r=t.executeCommand,n=t.getElementInfo;if(typeof r!="function"||typeof n!="function"||typeof t.getValue!="function")return!1;let o=t.position;if(o==null||t.selectionIsCollapsed===!1||(n.call(t,o)?.depth??0)<1)return!1;let a=()=>(t.position=o,!1),s=h=>r.call(t,h);if(s("moveToGroupEnd"),t.position!==o)return a();s("moveAfterParent");let i=t.position;if(i==null||i===o)return a();let c=n.call(t,i),l=c?.latex??"",p=_u(l);if(p==null||(c?.depth??0)<1||(s("moveToGroupEnd"),t.position!==i))return a();s("extendToGroupStart");let d=t.selection?.ranges,u=d?.[0]?Math.min(d[0][0],d[0][1]):i;if(t.position=i,u===i||t.getValue(u,i)!==l)return a();s("moveAfterParent");let f=t.position;return f==null||f===i||!Mu(n.call(t,f)?.latex??"",l)?a():(t.selection={ranges:[[u,i]]},s(["insert",p,{selectionMode:"after"}]),s("moveAfterParent"),!0)}var dc=new WeakSet;function pc(e){let t=e;if(!t||typeof t.addEventListener!="function"||dc.has(t))return;dc.add(t);let r=n=>{n.preventDefault(),n.stopImmediatePropagation()};t.addEventListener("keydown",n=>{let o=n;o.key!==")"||o.ctrlKey||o.metaKey||o.altKey||o.isComposing||o.defaultPrevented||Sr(e)&&r(o)},!0),t.addEventListener("beforeinput",n=>{let o=n;o.inputType!=="insertText"||o.data!==")"||o.defaultPrevented||Sr(e)&&r(o)},!0)}var Ma={ownLine:!1,centred:!1,onOpenWindow:null,chip:!1};function Lu(e){return e.storage.mathTyping?.chip??{unwrap:"Back to text",ownLine:"On its own line"}}function mc(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 hc(e){let t=!1;return e.forEach(r=>{(!r.isText||(r.text??"").trim())&&(t=!0)}),t}var Iu={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 Zr(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 Aa=e=>e.length>1&&!/^[\dA-Za-zπ.,]+$/.test(e)&&!/^\(.*\)$/.test(e)?`(${e})`:e;function sr(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]=Zr(n,r),[c,l]=Zr(n,i);t+=`${Aa(sr(s))}/${Aa(sr(c))}`,r=l}else if(a==="sqrt"){let[s,i]=Zr(n,r);t+=`sqrt(${sr(s)})`,r=i}else if(a==="text"||a==="mathrm"||a==="operatorname"){let[s,i]=Zr(n,r);t+=s,r=i}else a===","||a===" "||a===";"||a==="quad"?t+=" ":a==="{"||a==="}"?t+=a:t+=Iu[a]??a}else if(o==="^"||o==="_"){let[a,s]=Zr(n,r+1);t+=`${o}${Aa(sr(a))}`,r=s}else o==="{"||o==="}"||o===" "||(t+=o),r++}return t}function eo(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(uc.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(uc.create(s.doc,t+r.length))}function vc(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 f=n.nodes.paragraph.create(null,n.nodes.inlineMath.create(o));return e.tr.replaceWith(t,t+r.nodeSize,f)}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=mc(s.cut(0,i),"end"),l=mc(s.cut(i+r.nodeSize),"start"),p=[...hc(c.content)?[c]:[],n.nodes.blockMath.create(o),...hc(l.content)?[l]:[]],d=a.node(a.depth-1),u=a.index(a.depth-1);return d.canReplace(u,u+1,Eu.from(p))?e.tr.replaceWith(a.before(),a.after(),p):null}var Na=null,Ea=!1,Ta=null;function ft(){return Na||(Na=import("mathlive").then(e=>(e.MathfieldElement.soundsDirectory=null,Ta=e.convertAsciiMathToLatex??null,Ea=!0,document.addEventListener("focusin",t=>{let r=t.target;r?.tagName==="MATH-FIELD"&&_e.targetOf(r)&&Kt(r)},!0),!0)).catch(()=>!1)),Na}function wc(e){try{return Ta?Ta(e):null}catch{return null}}function Kt(e){let t=e;if(t){try{t.mathVirtualKeyboardPolicy!=="manual"&&(t.mathVirtualKeyboardPolicy="manual"),t.menuItems=[]}catch{}pc(t),$u()&&(Fu(t),Du(t))}}function $u(){return typeof matchMedia=="function"&&matchMedia("(pointer: coarse)").matches}var fc=new WeakSet;function Fu(e){let t=e.shadowRoot,r=t?.querySelector(".ML__keyboard-sink");if(!t||!r||fc.has(r)||typeof MutationObserver>"u"||typeof getSelection!="function")return;fc.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 gc=new WeakSet,zu={deleteContentBackward:"Backspace",deleteContentForward:"Delete"};function Du(e){let t=e;if(!t.shadowRoot||typeof t.addEventListener!="function"||gc.has(t)||typeof KeyboardEvent!="function")return;gc.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=zu[s.inputType];!i||r||s.defaultPrevented||performance.now()-n<100||(s.preventDefault(),s.stopImmediatePropagation(),o(i))},!0)}function to(e){let t=e;try{t?.hasFocus?.()&&t.blur?.()}catch{}}function ro(){return Ea}var Rr=new WeakMap,Ut={el:null};function ir(e){return e.shadowRoot?.querySelector(".ML__keyboard-sink")??null}var tn=new WeakMap,en={el:null},Ou=/(=|\+|-|\\times|\\cdot|\\le|\\ge|\\ne|\\in|\\lt|\\gt|<|>|\(|\\left\()\s*$/,Bu=/([.,;:])$/;function cr(e,t,r,n,o){let a=0,s=()=>{let c=e.nodeDOM(t)?.querySelector?.("math-field");if(c&&typeof c.executeCommand=="function"){n&&Rr.set(c,n);let l=ir(c);l&&_e.prepareInput(l),c.focus(),l&&l.focus({preventScroll:!0}),document.activeElement!==c&&(en.el=c,c.addEventListener("focus",()=>en.el===c&&(en.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 Lt(e){e.view.focus()}function bc(e,t,r){let n=e.chain().setTextSelection(t);r&&n.insertContent(r),n.run(),Lt(e)}var _a=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={...Ma,...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&&Ea){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?Le(r,!1):"",this.dom.append(t),this.editable&&ft().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"),Kt(t),t.setAttribute("smart-fence","on"),t.value=this.latex;let r=this.options.chip?[this.chip()]:[];if(this.isLine&&this.options.centred){let m=document.createElement("span");m.className="edp-sheet-line-box",m.append(t,...r),this.dom.append(m)}else this.dom.append(t,...r);Kt(t),this.field=t;let n=this.editor,o=()=>this.getPos(),a=m=>{let b=o();b!=null&&bc(n,b+this.node.nodeSize,m)},s=()=>{let m=o();m!=null&&bc(n,m)},i=()=>{let m=o();m!=null&&n.view.dispatch(n.state.tr.delete(m,m+this.node.nodeSize))},c=()=>t.position===t.lastOffset,l=()=>{Rr.delete(t),this.echoed=t.value;let m=o();m!=null&&n.view.dispatch(n.state.tr.setNodeMarkup(m,void 0,{...this.node.attrs,latex:t.value}))},p=()=>{Ut.el=t,Kt(t)},d=()=>{_e.isSwitching()||(Ut.el===t&&(Ut.el=null),setTimeout(()=>{!t.value&&t.isConnected&&document.activeElement!==t&&n.isEditable&&i()},0))},u=()=>{let m=o();m!=null&&(n.chain().setTextSelection(m+this.node.nodeSize).splitBlock().run(),Lt(n))};tn.set(t,{enter:u,removeEmpty:()=>{s(),i()},leave:m=>m==="before"?s():a(),pos:o});let f=m=>{let b=m.detail?.direction;b==="backward"||b==="upward"?s():a()},h=m=>{if(m.key===" "&&!m.ctrlKey&&!m.metaKey){m.preventDefault(),m.stopPropagation(),Rr.delete(t);let b=t.position;if(t.executeCommand?.("moveAfterParent"),t.position!==b)return;if(!c()){t.position=t.lastOffset??t.position;return}if(!t.value||Ou.test(t.value))return;let w=t.value.match(Bu)?.[1],P=o();if(w&&P!=null&&t.value.length>1){let g=t.value.slice(0,-1);t.value=g,this.echoed=g,n.view.dispatch(n.state.tr.setNodeMarkup(P,void 0,{...this.node.attrs,latex:g})),a(`${w} `);return}a(" ")}else if((m.ctrlKey||m.metaKey)&&m.key.toLowerCase()==="z"&&!m.shiftKey&&Rr.has(t)){m.preventDefault(),m.stopPropagation();let b=Rr.get(t)??[];Rr.delete(t);let w=o();if(w==null)return;n.chain().insertContentAt({from:w,to:w+this.node.nodeSize},b).run(),Lt(n)}else m.key==="Enter"?(m.preventDefault(),m.stopPropagation(),u()):m.key==="Backspace"&&!t.value?(m.preventDefault(),m.stopPropagation(),s(),i()):m.key==="Escape"&&(m.preventDefault(),a())};t.addEventListener("input",l),t.addEventListener("focus",p),t.addEventListener("focusout",d),t.addEventListener("move-out",f),t.addEventListener("keydown",h,!0),this.fieldCleanup=()=>{tn.delete(t),t.removeEventListener("input",l),t.removeEventListener("focus",p),t.removeEventListener("focusout",d),t.removeEventListener("move-out",f),t.removeEventListener("keydown",h,!0),Ut.el===t&&(Ut.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=Lu(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 sr(this.field?.value??this.latex)}unwrap(){let t=this.getPos();if(t==null)return;let r=eo(this.editor.state,t,this.plainText());r&&(this.editor.view.dispatch(r),Lt(this.editor))}toggleLine(){let t=this.getPos();if(t==null)return;let r=vc(this.editor.state,t);r&&this.editor.view.dispatch(r)}dropField(){to(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()}},kc=e=>new _a(e),La=yc.create({name:"inlineMath",addOptions(){return{...Ma}},group:"inline",inline:!0,atom:!0,selectable:!0,addAttributes(){return{latex:{default:""}}},parseHTML(){return[{tag:"span[data-inline-math]"}]},renderHTML({HTMLAttributes:e}){return["span",xc(e,{"data-inline-math":""})]},addNodeView(){return kc}}),Ia=yc.create({name:"blockMath",addOptions(){return{...Ma}},group:"block",atom:!0,selectable:!0,addAttributes(){return{latex:{default:""}}},parseHTML(){return[{tag:"div[data-block-math]"}]},renderHTML({HTMLAttributes:e}){return["div",xc(e,{"data-block-math":""})]},addNodeView(){return kc}});import{Extension as im}from"@tiptap/core";import{NodeSelection as Ec,Plugin as cm,PluginKey as lm,Selection as dm,TextSelection as pm}from"@tiptap/pm/state";var no="\\placeholder{}",ju=/[A-Za-z0-9.,()[\]π²³+\-*×·−_'∘∩∪]/,Pc=/^[+\-−*×·=/^)]/,qu=/[+\-−*×·=(]$/,$a={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}"},Cc=new RegExp(`(^|[^A-Za-z])(${Object.keys($a).join("|")})(?=\\()`,"g"),Hu=new RegExp(`(?:${Object.keys($a).join("|")}|[A-Za-z]'*)$`),Uu=e=>/[A-Za-z]{2,}/.test(e.replace(Cc,"$1").replace(/\([^()]*\)/g,""));function Sc(e){let t=e.endsWith(" ")?e.length-1:e.length,r="",n=null;for(;t>0;){let o=t;for(;o>0&&ju.test(e[o-1]);)o--;let a=e.slice(o,t);if(!a||Uu(a)||n!==null&&!(qu.test(a)||Pc.test(n))||(r=e.slice(o),n=a,o<2||e[o-1]!==" "))break;t=o-1}return r}function Ku(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(Hu);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 rn(e){return e.replace(Cc,(t,r,n)=>`${r}${$a[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 Wu=e=>/[\d²³]|[+\-*×·−()]/.test(e)||/^[A-Za-zπ](\([^()]*\))?$/.test(e);function Rc(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===""||Pc.test(o)?n[0].length:0}function Fa(e,t){if(t==="t"&&/(^|[^A-Za-z])sqr$/.test(e))return{take:3,latex:`\\sqrt{${no}}`,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=Sc(e),n=r?Ku(r):null;if(!r||!n||t==="_"&&!/^[A-Za-z]$/.test(n))return null;let o=rn(r.slice(0,r.length-n.length)),a=rn(t==="/"&&n.startsWith("(")?n.slice(1,-1):n),s=t==="^"?`${o}${a}^{${no}}`:t==="_"?`${o}${a}_{${no}}`:`${o}\\frac{${a}}{${no}}`,i=Rc(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=Sc(n),a=Rc(n,o),s=r==="<"?"\\le ":r===">"?"\\ge ":r==="!"?"\\ne ":"=";return!r&&!a&&(!o.trim()||!Wu(o.trim()))?null:{take:o.length+a+(r?1:0),latex:`${rn(o)}${s}`,placeholder:!1,merge:a>0}}return null}function Ac(e){return e.replace(/\\placeholder(\[[^\]]*\])?\{\}/g,"")}import{TextSelection as Vu}from"@tiptap/pm/state";var Nc=2;function Gu(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-Nc||t>c.bottom+Nc||(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 Yu="inlineMath";function Qu(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 p=o+l;if(c.type.name===Yu){let d=e.nodeDOM(p);d instanceof HTMLElement&&(s.push({kind:"formula",box:d.getBoundingClientRect()}),i.push(p+c.nodeSize));return}if(!(!c.isText||!c.text))for(let d of c.text.matchAll(/\S+/g)){let u=e.domAtPos(p+(d.index??0)),f=e.domAtPos(p+(d.index??0)+d[0].length),h=document.createRange();try{h.setStart(u.node,u.offset),h.setEnd(f.node,f.offset)}catch{continue}for(let m of Array.from(h.getClientRects()))s.push({kind:"text",box:m}),i.push(-1)}}),{pieces:s,after:i,end:r.end(),dom:a}}function za(e,t,r){if(!e.editable)return!1;let n=e.posAtCoords({left:t,top:r});if(!n)return!1;let o=Qu(e,n.pos);if(!o)return!1;let a=getComputedStyle(o.dom).direction==="rtl"?"rtl":"ltr",s=Gu(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(Vu.create(e.state.doc,i)).scrollIntoView()),e.focus(),!0}function Da(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 oo=(e,t)=>`\\begin{pmatrix}${Array.from({length:e},()=>Array.from({length:t},()=>"#?").join("&")).join("\\\\")}\\end{pmatrix}`,Tc=e=>`\\begin{vmatrix}${Array.from({length:e},()=>Array.from({length:e},()=>"#?").join("&")).join("\\\\")}\\end{vmatrix}`,_c=e=>`\\begin{cases}${Array.from({length:e},()=>"#?").join("\\\\")}\\end{cases}`,Wt=(e,t)=>`\\begin{${t}}${e}\\end{${t}}`,pe="\\square",Oe={lim:"\\lim\\limits_{x\\to#?}#?",matrix2:oo(2,2),matrix3:oo(3,3),column2:oo(2,1),column3:oo(3,1),det2:Tc(2),det3:Tc(3),system2:_c(2),system3:_c(3),identity3:"I_3",inverse:"#@^{-1}",openInterval:"\\rbrack #?;#?\\lbrack",closedInterval:"\\lbrack #?;#?\\rbrack",set:"\\lbrace #?\\rbrace",integral:"\\int_{#?}^{#?}#?\\,\\mathrm{d}x",sum:"\\sum_{#?}^{#?}#?"},Q=(e,t,r,n)=>({id:e,face:r??t,action:{kind:"insert",latex:t},...n}),ae=(e,t)=>({id:`char:${e}`,face:e,text:!0,action:{kind:"insert",latex:t??e}}),ao=(e,t,r)=>({id:e,face:t,text:!0,action:{kind:"command",command:e},...r?{width:r}:{}}),J={power:Q("power","#@^{2}","x^{2}"),powerN:Q("powerN","#@^{#?}","x^{n}"),fraction:Q("fraction","\\frac{#@}{#?}","\\frac{a}{b}"),root:Q("root","\\sqrt{#0}","\\sqrt{x}"),pi:Q("pi","\\pi"),le:Q("le","\\le"),ge:Q("ge","\\ge"),ne:Q("ne","\\ne"),in:Q("in","\\in"),abs:Q("abs","\\left|#0\\right|","|x|"),brackets:Q("brackets","\\left(#0\\right)","(\\,)"),equals:Q("equals","=","="),infinity:Q("infinity","\\infty"),backspace:ao("backspace","\u232B"),enter:ao("enter","\u21B5"),left:ao("left","\u2190"),right:ao("right","\u2192")},Xu={id:"basic",label:"123",rows:[[ae("x"),ae("y"),ae("7"),ae("8"),ae("9"),Q("div","\\div","\\div"),J.fraction,J.power,J.root,J.backspace],[ae("("),ae(")"),ae("4"),ae("5"),ae("6"),Q("times","\\times","\\times"),J.powerN,J.pi,J.abs,J.enter],[ae("<"),ae(">"),ae("1"),ae("2"),ae("3"),Q("minus","-","-"),J.le,J.ge,J.ne,J.left],[ae(","),ae(";"),ae("0"),ae("."),J.equals,Q("plus","+","+"),J.in,J.infinity,ae("%","\\%"),J.right]]},Ju={id:"analysis",label:"lim \u221E",rows:[[Q("lim",Oe.lim,"\\lim"),J.infinity,Q("plusInfinity","+\\infty"),Q("minusInfinity","-\\infty"),Q("rightLimit","#@^{+}","x^{+}"),Q("leftLimit","#@^{-}","x^{-}"),Q("prime","#@'","f'"),Q("compose","\\circ"),J.backspace],[Q("ln","\\ln(#0)","\\ln"),Q("exp","e^{#0}","e^{x}"),J.root,J.abs,J.fraction,J.powerN,J.power,J.pi,J.enter],[Q("sequence","u_{#?}","u_{n}"),Q("integral",Oe.integral,"\\int"),Q("sum",Oe.sum,"\\sum"),Q("to","\\to"),Q("fx","f(x)","f(x)"),J.equals,J.le,J.ge,J.left],[ae("x"),ae("n"),ae("("),ae(")"),ae(","),ae(";"),ae("<"),ae(">"),J.right]]},Zu={id:"sets",label:"\u211D \u222A",rows:[[Q("reals","\\R","\\mathbb{R}"),Q("naturals","\\N","\\mathbb{N}"),Q("integers","\\Z","\\mathbb{Z}"),Q("rationals","\\Q","\\mathbb{Q}"),Q("setminus","\\setminus"),Q("cup","\\cup"),Q("cap","\\cap"),Q("emptyset","\\emptyset"),J.backspace],[J.in,Q("notin","\\notin"),Q("subset","\\subset"),Q("set",Oe.set,"\\lbrace\\,\\rbrace"),Q("openInterval",Oe.openInterval,"\\rbrack a;b\\lbrack"),Q("closedInterval",Oe.closedInterval,"\\lbrack a;b\\rbrack"),Q("rbrack","\\rbrack"),Q("lbrack","\\lbrack"),J.enter],[ae(";"),ae(","),ae("("),ae(")"),Q("minusInfinity","-\\infty"),Q("plusInfinity","+\\infty"),ae("x"),J.equals,J.left],[J.le,J.ge,ae("<"),ae(">"),J.ne,Q("forall","\\forall"),Q("exists","\\exists"),Q("implies","\\Rightarrow"),J.right]]},em={id:"matrices",label:"(\u25A6) {",rows:[[Q("matrix2",Oe.matrix2,Wt(`${pe}&${pe}\\\\${pe}&${pe}`,"pmatrix"),{width:1.5,small:!0}),Q("matrix3",Oe.matrix3,Wt(`${pe}&${pe}&${pe}\\\\${pe}&${pe}&${pe}\\\\${pe}&${pe}&${pe}`,"pmatrix"),{width:1.5,small:!0}),Q("column2",Oe.column2,Wt(`${pe}\\\\${pe}`,"pmatrix"),{small:!0}),Q("column3",Oe.column3,Wt(`${pe}\\\\${pe}\\\\${pe}`,"pmatrix"),{small:!0}),Q("system2",Oe.system2,Wt(`${pe}\\\\${pe}`,"cases"),{small:!0}),Q("system3",Oe.system3,Wt(`${pe}\\\\${pe}\\\\${pe}`,"cases"),{small:!0}),J.backspace],[Q("det2",Oe.det2,Wt(`${pe}&${pe}\\\\${pe}&${pe}`,"vmatrix"),{width:1.5,small:!0}),Q("det3",Oe.det3,Wt(`${pe}&${pe}&${pe}\\\\${pe}&${pe}&${pe}\\\\${pe}&${pe}&${pe}`,"vmatrix"),{width:1.5,small:!0}),Q("identity3",Oe.identity3,"I_3"),Q("inverse",Oe.inverse,"A^{-1}"),Q("det","\\det","\\det"),Q("times","\\times","\\times"),J.enter],[Q("cdot","\\cdot","\\cdot"),J.equals,ae(","),ae(";"),ae("("),ae(")"),Q("vector","\\overrightarrow{#0}","\\vec{u}"),J.left],[ae("x"),ae("y"),ae("z"),ae("a"),ae("b"),ae("c"),J.ne,J.right]]},Se=e=>Q(e,`\\${e}`),tm={id:"greek",label:"\u03B1\u03B2\u03B3",rows:[[Se("alpha"),Se("beta"),Se("gamma"),Se("delta"),Se("varepsilon"),Se("theta"),Se("lambda"),Se("mu"),J.backspace],[Se("pi"),Se("rho"),Se("sigma"),Se("tau"),Se("varphi"),Se("omega"),Se("Delta"),Se("Omega"),J.enter],[Se("Sigma"),Se("Phi"),Se("Gamma"),Se("Lambda"),Se("chi"),Se("psi"),Se("nu"),Se("xi"),J.left],[ae("("),ae(")"),J.equals,J.ne,J.le,J.ge,J.in,J.infinity,J.right]]},nn=[Xu,Ju,Zu,em,tm],Oa=[J.power,J.fraction,J.root,J.brackets,J.equals];var Mc=new Map;function rm(e,t){if(e.text)return ja(e.face);let r=`${t?"s":"h"}${e.face}`,n=Mc.get(r);return n===void 0&&(n=Le(e.face,!1,t),Mc.set(r,n)),n}function ja(e){return e.replace(/[&<>"]/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"})[t]??t)}function nm(e,t){return t.keys[e.id]??(e.text?e.face:null)}function om(){let e=typeof window<"u"?window.visualViewport:null;return e?Math.max(0,Math.round(window.innerHeight-(e.offsetTop+e.height))):0}var am=420,sm=70,qa=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 f=It("edp-kb-bar");f.append(this.modeSwitch("system",a));let h=It("edp-kb-bar-keys");h.dir="ltr";for(let m of Oa)h.append(this.key(m,a));f.append(h),n==="box"&&f.append(this.convertButton(a)),this.root.append(f);return}let i=It("edp-kb-panel"),c=It("edp-kb-head");s&&c.append(this.modeSwitch("maths",a));let l=It("edp-kb-tabs");l.setAttribute("role","tablist"),l.setAttribute("aria-label",a.keyboard);for(let f of nn){let h=Ba("edp-kb-tab",ja(f.label));h.dir="ltr",h.setAttribute("role","tab"),h.setAttribute("aria-selected",String(f.id===r)),h.title=a.tabs[f.id],h.setAttribute("aria-label",a.tabs[f.id]),h.addEventListener("click",()=>this.controller.setTab(f.id)),l.append(h)}let p=It("edp-kb-tabs-end");n==="box"&&p.append(this.convertButton(a)),p.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,p),i.append(c);let d=nn.find(f=>f.id===r)??nn[0],u=It("edp-kb-keys");u.dir="ltr",u.setAttribute("role","tabpanel"),u.setAttribute("aria-label",a.tabs[d.id]);for(let f of d.rows){let h=It("edp-kb-row");for(let m of f)h.append(this.key(m,a));u.append(h)}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=nm(t,r),a=Ba(n,rm(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,sm)};i()},am)});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=It("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=Ba(`edp-kb-action ${t}`,ja(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"?om():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 It(e){let t=document.createElement("div");return t.className=e,t}function Ba(e,t){let r=document.createElement("button");return r.type="button",r.className=e,r.tabIndex=-1,r.innerHTML=t,r}lc(e=>new qa(e));var Pr="\\placeholder{}",um={power:{inField:"^{2}",create:"#@^{2}"},fraction:{inField:`\\frac{${Pr}}{${Pr}}`,create:`\\frac{${Pr}}{${Pr}}`},root:{inField:`\\sqrt{${Pr}}`,create:`\\sqrt{${Pr}}`},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"}},mm=new Set(["\\le","\\ge","\\ne","\\in","=","+","-","\\times","\\div","\\cdot","<",">"]);function co(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 Lc(e,t,r,n){if(!co(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=Fa(s,r);if(!i)return null;let c=t-i.take,l=i.latex,p=[],d=s.slice(s.length-i.take)+r+(n??""),u={};if(i.merge){let h=e.doc.nodeAt(c);if(h?.type.name!=="inlineMath")return null;l=`${h.attrs.latex??""}${l}`,u=h.attrs,p.push({type:"inlineMath",attrs:{...h.attrs}}),d=d.slice(1)}return p.push({type:"text",text:d}),{tr:e.tr.replaceWith(c,t,e.schema.nodes.inlineMath.create({...u,latex:l})),pos:c,placeholder:i.placeholder,revert:p}}function Cr(e,t,r,n){if(!ro())return ft(),!1;let o=Lc(e.state,t,r,n);return o?(e.dispatch(o.tr),cr(e,o.pos,o.placeholder?"placeholder":"end",n?void 0:o.revert,n),!0):!1}function Ua(e,t){return e.nodeDOM(t)?.querySelector?.("math-field")??null}var io=e=>/#\?|#0|#@|\\placeholder/.test(e);function hm(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)),cr(e,i,"end");let c=Ua(e,i);return c?.executeCommand?.(["insert",r,{selectionMode:io(r)?"placeholder":"after"}]),!!c}function Ic(e,t){let{from:r,empty:n,$from:o}=e.state.selection,a=n&&o.parent.isTextblock?r:e.state.selection.to;return co(e.state,a)?(e.chain().insertContentAt(a,{type:"inlineMath",attrs:{latex:""}}).run(),cr(e.view,a,"end"),t&&Ua(e.view,a)?.executeCommand?.(["insert",t,{selectionMode:io(t)?"placeholder":"after"}]),a):null}function Ar(e){let t=Ut.el;return t&&t.isConnected&&!e.isDestroyed&&e.view.dom.contains(t)?t:null}function Ha(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=wc(r);return n||rn(t).replace(/<=/g,"\\le ").replace(/>=/g,"\\ge ").replace(/!=/g,"\\ne ").replace(/sqrt\(([^()]*)\)/g,"\\sqrt{$1}")}function Ka(e){if(Ar(e))return"formula";let t=e.state.selection;if(t instanceof Ec&&(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 $c(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(!co(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,f)=>{if(u.isText){let h=Math.max(a,f),m=Math.min(s,f+u.nodeSize);l+=(u.text??"").slice(h-f,m-f)}else u.type.name==="inlineMath"&&(l&&c.push(Ha(l)),l="",c.push(String(u.attrs.latex??"")))}),l&&c.push(Ha(l));let p=c.join("");if(!p)return null;let d=t.doc.slice(a,s).content.toJSON();return r.dispatch(t.tr.replaceWith(a,s,t.schema.nodes.inlineMath.create({latex:p}))),cr(r,a,"end",d),a}function fm(e){let t=Ar(e),r,n="";if(t?(r=tn.get(t)?.pos(),n=t.value):e.state.selection instanceof Ec&&(r=e.state.selection.from,n=String(e.state.selection.node.attrs.latex??"")),r==null)return!1;let o=eo(e.state,r,sr(n));return o?(e.view.dispatch(o),Lt(e),!0):!1}function on(e){if(!e.isEditable)return;if(!ro()){ft().then(r=>r&&on(e));return}let t=Ka(e);t==="formula"?fm(e):t==="selection"?$c(e):Ic(e,"")}function Wa(e,t){if(!e.isEditable)return;if(!ro()){ft().then(o=>o&&Wa(e,t));return}let r=Ar(e);if(r){if(t===")"&&Sr(r))return;r.executeCommand?.(["insert",t,{selectionMode:io(t)?"placeholder":"after"}]);return}let{selection:n}=e.state;if(Ka(e)==="selection"){let o=$c(e),a=o==null?null:Ua(e.view,o);a&&(a.executeCommand?.("selectAll"),a.executeCommand?.(["insert",t,{selectionMode:io(t)?"placeholder":"after"}]));return}if(n.empty){let o=t.match(/^#@\^\{([^{}#]+)\}$/)?.[1];if(o&&Cr(e.view,n.from,"^",o)||t==="#@^{#?}"&&Cr(e.view,n.from,"^")||t==="\\frac{#@}{#?}"&&Cr(e.view,n.from,"/")||hm(e.view,n.from,t,!mm.has(t)))return}Ic(e,t)}function gm(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?dm.near(a.doc.resolve(i),o?1:-1):pm.create(a.doc,o?s.to:s.from);e.dispatch(a.tr.setSelection(c).scrollIntoView())}function bm(e,t){if(!e.isEditable)return;let r=Ar(e);if(r){let i=tn.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&&Ut.el===r&&i?.leave(t==="left"?"before":"after")}return}let{view:n}=e;if(t==="left"||t==="right"){gm(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 lo(e){return e.storage.mathTyping}function ym(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=ir(n);o&&r.push(o)}),r},refocus(){if(e.isDestroyed)return;let t=Ar(e),r=t?ir(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=>Wa(e,t),command:t=>bm(e,t),convert:()=>on(e),caret:()=>e.isDestroyed?"text":Ka(e),caretRect(){if(e.isDestroyed)return null;let t=Ar(e);if(t)return t.getBoundingClientRect();try{return e.view.coordsAtPos(e.state.selection.head)}catch{return null}},labels:()=>lo(e)?.keyboard??kr,dir:()=>!e.isDestroyed&&getComputedStyle(e.view.dom).direction==="rtl"?"rtl":"ltr"}}function Va(e,t){let r=J[t];r.action.kind==="insert"&&Wa(e,r.action.latex)}function Ga(e){if(!e.isEditable)return;let t=lo(e)?.target;t&&_e.openFor(t)}var xm=new lm("edpMathTyping"),Ya=im.create({name:"mathTyping",addStorage(){return{chip:{unwrap:"Back to text",ownLine:"On its own line"},keyboard:kr,target:null,unregister:null}},onCreate(){this.editor.isEditable&&ft();let e=ym(this.editor);this.storage.target=e,this.storage.unregister=_e.register(e)},onDestroy(){this.storage.unregister?.(),this.storage.unregister=null,this.storage.target=null},onSelectionUpdate(){_e.active===this.storage.target&&_e.emit()},addProseMirrorPlugins(){let e=null,t=0;return[new cm({key:xm,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(),!Da(r,n.target)||!za(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||!Da(r,n.target)||!za(r,n.clientX,n.clientY)?!1:(n.preventDefault(),!0)}},handleTextInput(r,n,o,a){return n!==o?!1:a.length===1?Cr(r,n,a):a.length===2&&a[0]==="^"?Cr(r,n,"^",a[1]):!1},handleKeyDown(r,n){let o=en.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&&Cr(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"?(cr(r,l.pos-l.nodeBefore.nodeSize,"end"),!0):c&&l.nodeAfter?.type.name==="inlineMath"?(cr(r,l.pos,"start"),!0):!1}}})]}});function Qa(e,t){let r=lo(e);r&&(r.chip={...r.chip,...t})}function Xa(e,t){let r=lo(e);r&&(r.keyboard={...r.keyboard,...t,tabs:{...r.keyboard.tabs,...t.tabs},keys:{...r.keyboard.keys,...t.keys}},_e.active===r.target&&_e.emit())}import{useEffect as vm,useState as wm}from"react";function po(){let[,e]=wm(0);return vm(()=>_e.subscribe(()=>e(t=>t+1)),[]),_e.state()}function Ja(e){let t=po();if(!e||e.isDestroyed)return!1;let r=e.storage.mathTyping?.target;return!!r&&t.active===r&&t.caret==="formula"}import{Extension as km}from"@tiptap/core";import{Plugin as Sm,PluginKey as Rm}from"@tiptap/pm/state";import{Decoration as zc,DecorationSet as Dc}from"@tiptap/pm/view";function Za(e){return(e??[]).map(t=>t.type==="text"?t.text??"":t.type==="inlineMath"?t.attrs?.latex?`$${t.attrs.latex}$`:"":t.type==="hardBreak"?`
2
- `:Za(t.content)).join("")}function es(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(Za(o.content)):o.type==="bulletList"||o.type==="orderedList"||o.type==="listItem"?r(o.content??[]):t.push(Za(o.content))};return r(e),t.join(`
1
+ import"./chunk-76CZ6Z7T.mjs";import Zd from"react";import{createRoot as ep}from"react-dom/client";import{useCallback as Vd,useMemo as Gd,useState as Tb}from"react";import{cloneElement as zd,isValidElement as Fd,useCallback as St,useEffect as Vo,useMemo as De,useRef as nr,useState as ot}from"react";import{jsx as Kr}from"react/jsx-runtime";import{useEffect as Ds,useMemo as vg,useRef as xg}from"react";import hp from"mitt";var It=class{constructor(){this.emitter=hp(),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()})}},Pi="__edpireGlobalAnswerBus",Ci=globalThis,On=Ci[Pi]??(Ci[Pi]=new It);import{jsx as fp}from"react/jsx-runtime";import{createContext as gp,useContext as bp}from"react";var Ni="__edpireAnswerBusContext",Ai=globalThis,Ti=Ai[Ni]??(Ai[Ni]=gp(On));function Me(){return bp(Ti)}function Bn({children:e,bus:t=new It}){return fp(Ti.Provider,{value:t,children:e})}import{jsx as Oe,jsxs as Tr}from"react/jsx-runtime";import{Fragment as iu,useState as Gi,useEffect as va,useMemo as cu}from"react";import $t from"clsx";import{jsx as oe,jsxs as qi}from"react/jsx-runtime";import{jsx as st,jsxs as ca}from"react/jsx-runtime";import{createContext as wp,useCallback as la,useContext as kp,useEffect as rn,useMemo as Sp,useRef as Nr,useState as ir}from"react";import{Pause as Rp,Play as Pp,RotateCcw as Cp}from"lucide-react";import{jsx as yp}from"react/jsx-runtime";import{createContext as vp,useContext as _i}from"react";var Cr={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",sheetPhotoDropHint:"You can also drop photos here.",sheetPhotoDropHere:"Drop your photos here",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",sheetPages:"Pages",sheetPageOf:(e,t)=>`Page ${e} of ${t}`,sheetPageOpen:"Open full screen",sheetPagesSee:e=>e===1?"See the page":`See the ${e} pages`,sheetPagePrev:"Previous page",sheetPageNext:"Next page",sheetPhotoRemove:"Remove this photo",sheetPhotoAddPage:"Add a page",sheetPhotoRead:"Read my copy",sheetPhotoPages:"Your pages",sheetPhotoView:e=>`See page ${e}`,sheetPhotoTurn:"Turn this page",sheetPhotoReadingLive:"Reading your copy\u2026 the lines appear in your answer as they are read.",sheetPhotoStop:"Stop",copyTitle:"Photograph my copy",copyPhoneHelp:"Scan this code with your phone and take a photo of each page of your copy. They will appear here.",copyReadingLive:"Reading your copy\u2026 each part appears under its question as it is read.",copyLimit:"You have used every reading of the whole copy. Photograph an answer under its question, or type it.",copyCut:"The reading stopped before the end. Check what was read below, or try again.",copyCheckTitle:"Check where each part goes",copyCheckHelp:"Each part was placed by the number written before it. Move a part if it landed in the wrong question; you will correct the words in each answer after.",copyMoveTo:"Question",copyNowhere:"Don't use it",copyNotPlaced:"Not placed",copyNotPlacedHelp:"These parts could not be matched to a question. Choose one, or leave them out.",copyHasText:"This answer already has text:",copyReplace:"Replace it",copyBelow:"Add below",copyLeave:"Keep mine",copyConfirm:"Put in my answers",copyCancel:"Cancel",copyNothing:"No part is going into a question yet. Choose a question for the parts you want to keep.",copyLeavePages:"Close? The pages you took will be lost.",copyLeaveRead:"Close without putting what was read in your answers? It will be lost, and reading the copy again counts as another reading.",copyLeaveBack:"Go back",copyLeaveConfirm:"Close anyway",sheetPhotoUnreadable:"Nothing could be read on this photo. Take it again in good light, the page flat and filling the photo, or type your answer.",sheetPhotoNetwork:"The connection dropped. Try again, or type your answer.",sheetPhotoLimit:"You have used every reading for this question. Type the rest of your answer.",sheetPhotoBusy:"Reading is busy right now. Try again in a moment, or type your answer.",sheetPhotoCut:"The reading stopped before the end. What was read is in your answer: check it and add the rest.",sheetPhotoSideways:"This page still looks sideways. Turn it so the writing is upright, then read it.",sheetPhotoSendFailed:"A photo could not be sent. Remove it and take it again.",sheetPhotoOpenFailed:"This photo could not be opened. Choose a JPEG or PNG photo.",sheetPhotoType:"Type instead",sheetPhotoUnsure:"Words underlined in yellow may have been misread.",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",sheetPadFix:"Not right? Rewrite the symbol, or insert it and fix it with the keys.",sheetHandwritingFormula:"Formula by hand",sheetInkPage:"Page by hand",sheetInkTitle:"Write your answer by hand",sheetInkMouseHint:"Writing with a mouse is slow: it is easier on a phone or a tablet, or on paper with a photo.",sheetInkMousePhoto:"Take a photo instead",sheetInkHelp:"Write on the lines with a pen or your finger, then read the page: the text goes into your answer.",sheetInkCanvas:e=>`Page ${e}, write here`,sheetInkPageN:e=>`Page ${e}`,sheetInkRemovePage:"Remove this page",sheetInkPageRemoved:e=>`Page ${e} removed.`,sheetInkRead:e=>e>1?"Read my pages":"Read my page",sheetInkReading:"Reading your page\u2026 the lines appear in your answer as they are read.",sheetInkSendFailed:"A page could not be sent. Check your connection and try again.",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 jn={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",sheetPhotoDropHint:"Vous pouvez aussi d\xE9poser vos photos ici.",sheetPhotoDropHere:"D\xE9posez vos photos ici",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",sheetPages:"Pages",sheetPageOf:(e,t)=>`Page ${e} sur ${t}`,sheetPageOpen:"Ouvrir en plein \xE9cran",sheetPagesSee:e=>e===1?"Voir la page":`Voir les ${e} pages`,sheetPagePrev:"Page pr\xE9c\xE9dente",sheetPageNext:"Page suivante",sheetPhotoRemove:"Retirer cette photo",sheetPhotoAddPage:"Ajouter une page",sheetPhotoRead:"Lire ma copie",sheetPhotoPages:"Vos pages",sheetPhotoView:e=>`Voir la page ${e}`,sheetPhotoTurn:"Tourner cette page",sheetPhotoReadingLive:"Lecture de votre copie\u2026 les lignes apparaissent dans votre r\xE9ponse au fur et \xE0 mesure.",sheetPhotoStop:"Arr\xEAter",copyTitle:"Photographier ma copie",copyPhoneHelp:"Scannez ce code avec votre t\xE9l\xE9phone et prenez chaque page de votre copie en photo. Elles appara\xEEtront ici.",copyReadingLive:"Lecture de votre copie\u2026 chaque partie appara\xEEt sous sa question au fil de la lecture.",copyLimit:"Vous avez utilis\xE9 toutes les lectures de la copie enti\xE8re. Photographiez une r\xE9ponse sous sa question, ou tapez-la.",copyCut:"La lecture s'est arr\xEAt\xE9e avant la fin. V\xE9rifiez ce qui a \xE9t\xE9 lu ci-dessous, ou r\xE9essayez.",copyCheckTitle:"V\xE9rifiez o\xF9 va chaque partie",copyCheckHelp:"Chaque partie a \xE9t\xE9 plac\xE9e d'apr\xE8s le num\xE9ro \xE9crit devant. D\xE9placez-la si elle est dans la mauvaise question ; vous corrigerez les mots dans chaque r\xE9ponse ensuite.",copyMoveTo:"Question",copyNowhere:"Ne pas l'utiliser",copyNotPlaced:"Non plac\xE9es",copyNotPlacedHelp:"Ces parties n'ont pas pu \xEAtre rattach\xE9es \xE0 une question. Choisissez-en une, ou laissez-les de c\xF4t\xE9.",copyHasText:"Cette r\xE9ponse contient d\xE9j\xE0 du texte :",copyReplace:"Le remplacer",copyBelow:"Ajouter dessous",copyLeave:"Garder le mien",copyConfirm:"Mettre dans mes r\xE9ponses",copyCancel:"Annuler",copyNothing:"Aucune partie ne va encore dans une question. Choisissez une question pour les parties \xE0 garder.",copyLeavePages:"Fermer ? Les pages prises seront perdues.",copyLeaveRead:"Fermer sans mettre ce qui a \xE9t\xE9 lu dans vos r\xE9ponses ? Ce sera perdu, et relire la copie compte comme une nouvelle lecture.",copyLeaveBack:"Revenir",copyLeaveConfirm:"Fermer quand m\xEAme",sheetPhotoUnreadable:"Rien n'a pu \xEAtre lu sur cette photo. Reprenez-la avec une bonne lumi\xE8re, la page bien \xE0 plat et qui remplit la photo, ou tapez votre r\xE9ponse.",sheetPhotoNetwork:"La connexion a \xE9t\xE9 coup\xE9e. R\xE9essayez, ou tapez votre r\xE9ponse.",sheetPhotoLimit:"Vous avez utilis\xE9 toutes les lectures de cette question. Tapez la suite de votre r\xE9ponse.",sheetPhotoBusy:"La lecture est occup\xE9e pour le moment. R\xE9essayez dans un instant, ou tapez votre r\xE9ponse.",sheetPhotoCut:"La lecture s'est arr\xEAt\xE9e avant la fin. Ce qui a \xE9t\xE9 lu est dans votre r\xE9ponse : v\xE9rifiez-le et ajoutez la suite.",sheetPhotoSideways:"Cette page semble encore de travers. Tournez-la pour que l'\xE9criture soit droite, puis lisez-la.",sheetPhotoSendFailed:"Une photo n'a pas pu \xEAtre envoy\xE9e. Retirez-la et reprenez-la.",sheetPhotoOpenFailed:"Cette photo n'a pas pu \xEAtre ouverte. Choisissez une photo JPEG ou PNG.",sheetPhotoType:"Taper plut\xF4t",sheetPhotoUnsure:"Les mots soulign\xE9s en jaune ont peut-\xEAtre \xE9t\xE9 mal lus.",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",sheetPadFix:"Pas \xE7a ? R\xE9\xE9crivez le symbole, ou ins\xE9rez-la et corrigez-la avec les touches.",sheetHandwritingFormula:"Formule \xE0 la main",sheetInkPage:"Page \xE0 la main",sheetInkTitle:"\xC9crire votre r\xE9ponse \xE0 la main",sheetInkMouseHint:"\xC9crire \xE0 la souris est lent : c'est plus simple sur un t\xE9l\xE9phone ou une tablette, ou sur papier avec une photo.",sheetInkMousePhoto:"Prendre une photo",sheetInkHelp:"\xC9crivez sur les lignes avec un stylet ou le doigt, puis faites lire la page : le texte arrive dans votre r\xE9ponse.",sheetInkCanvas:e=>`Page ${e}, \xE9crivez ici`,sheetInkPageN:e=>`Page ${e}`,sheetInkRemovePage:"Retirer cette page",sheetInkPageRemoved:e=>`Page ${e} retir\xE9e.`,sheetInkRead:e=>e>1?"Lire mes pages":"Lire ma page",sheetInkReading:"Lecture de votre page\u2026 les lignes apparaissent dans votre r\xE9ponse au fur et \xE0 mesure.",sheetInkSendFailed:"Une page n'a pas pu \xEAtre envoy\xE9e. V\xE9rifiez votre connexion et r\xE9essayez.",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 qn={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",sheetPhotoDropHint:"\u064A\u0645\u0643\u0646\u0643 \u0623\u064A\u0636\u064B\u0627 \u0625\u0641\u0644\u0627\u062A \u0635\u0648\u0631\u0643 \u0647\u0646\u0627.",sheetPhotoDropHere:"\u0623\u0641\u0644\u062A \u0635\u0648\u0631\u0643 \u0647\u0646\u0627",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",sheetPages:"\u0627\u0644\u0635\u0641\u062D\u0627\u062A",sheetPageOf:(e,t)=>`\u0627\u0644\u0635\u0641\u062D\u0629 ${e} \u0645\u0646 ${t}`,sheetPageOpen:"\u0641\u062A\u062D \u0628\u0645\u0644\u0621 \u0627\u0644\u0634\u0627\u0634\u0629",sheetPagesSee:e=>e===1?"\u0639\u0631\u0636 \u0627\u0644\u0635\u0641\u062D\u0629":`\u0639\u0631\u0636 \u0627\u0644\u0635\u0641\u062D\u0627\u062A (${e})`,sheetPagePrev:"\u0627\u0644\u0635\u0641\u062D\u0629 \u0627\u0644\u0633\u0627\u0628\u0642\u0629",sheetPageNext:"\u0627\u0644\u0635\u0641\u062D\u0629 \u0627\u0644\u062A\u0627\u0644\u064A\u0629",sheetPhotoRemove:"\u062D\u0630\u0641 \u0647\u0630\u0647 \u0627\u0644\u0635\u0648\u0631\u0629",sheetPhotoAddPage:"\u0625\u0636\u0627\u0641\u0629 \u0635\u0641\u062D\u0629",sheetPhotoRead:"\u0642\u0631\u0627\u0621\u0629 \u0648\u0631\u0642\u062A\u064A",sheetPhotoPages:"\u0635\u0641\u062D\u0627\u062A\u0643",sheetPhotoView:e=>`\u0639\u0631\u0636 \u0627\u0644\u0635\u0641\u062D\u0629 ${e}`,sheetPhotoTurn:"\u062A\u062F\u0648\u064A\u0631 \u0647\u0630\u0647 \u0627\u0644\u0635\u0641\u062D\u0629",sheetPhotoReadingLive:"\u062C\u0627\u0631\u064D \u0642\u0631\u0627\u0621\u0629 \u0648\u0631\u0642\u062A\u0643\u2026 \u062A\u0638\u0647\u0631 \u0627\u0644\u0623\u0633\u0637\u0631 \u0641\u064A \u0625\u062C\u0627\u0628\u062A\u0643 \u062A\u0628\u0627\u0639\u064B\u0627.",sheetPhotoStop:"\u0625\u064A\u0642\u0627\u0641",copyTitle:"\u062A\u0635\u0648\u064A\u0631 \u0648\u0631\u0642\u062A\u064A",copyPhoneHelp:"\u0627\u0645\u0633\u062D \u0647\u0630\u0627 \u0627\u0644\u0631\u0645\u0632 \u0628\u0647\u0627\u062A\u0641\u0643 \u0648\u0635\u0648\u0651\u0631 \u0643\u0644 \u0635\u0641\u062D\u0629 \u0645\u0646 \u0648\u0631\u0642\u062A\u0643. \u0633\u062A\u0638\u0647\u0631 \u0627\u0644\u0635\u0648\u0631 \u0647\u0646\u0627.",copyReadingLive:"\u062C\u0627\u0631\u064D \u0642\u0631\u0627\u0621\u0629 \u0648\u0631\u0642\u062A\u0643\u2026 \u064A\u0638\u0647\u0631 \u0643\u0644 \u062C\u0632\u0621 \u062A\u062D\u062A \u0633\u0624\u0627\u0644\u0647 \u0623\u062B\u0646\u0627\u0621 \u0627\u0644\u0642\u0631\u0627\u0621\u0629.",copyLimit:"\u0627\u0633\u062A\u0639\u0645\u0644\u062A \u0643\u0644 \u0642\u0631\u0627\u0621\u0627\u062A \u0627\u0644\u0648\u0631\u0642\u0629 \u0643\u0627\u0645\u0644\u0629. \u0635\u0648\u0651\u0631 \u0627\u0644\u0625\u062C\u0627\u0628\u0629 \u062A\u062D\u062A \u0633\u0624\u0627\u0644\u0647\u0627\u060C \u0623\u0648 \u0627\u0643\u062A\u0628\u0647\u0627.",copyCut:"\u062A\u0648\u0642\u0641\u062A \u0627\u0644\u0642\u0631\u0627\u0621\u0629 \u0642\u0628\u0644 \u0627\u0644\u0646\u0647\u0627\u064A\u0629. \u0631\u0627\u062C\u0639 \u0645\u0627 \u0642\u064F\u0631\u0626 \u0623\u062F\u0646\u0627\u0647\u060C \u0623\u0648 \u062D\u0627\u0648\u0644 \u0645\u0631\u0629 \u0623\u062E\u0631\u0649.",copyCheckTitle:"\u062A\u062D\u0642\u0642 \u0645\u0646 \u0645\u0643\u0627\u0646 \u0643\u0644 \u062C\u0632\u0621",copyCheckHelp:"\u0648\u064F\u0636\u0639 \u0643\u0644 \u062C\u0632\u0621 \u062D\u0633\u0628 \u0627\u0644\u0631\u0642\u0645 \u0627\u0644\u0645\u0643\u062A\u0648\u0628 \u0642\u0628\u0644\u0647. \u0627\u0646\u0642\u0644 \u0627\u0644\u062C\u0632\u0621 \u0625\u0646 \u0648\u0642\u0639 \u0641\u064A \u0633\u0624\u0627\u0644 \u062E\u0627\u0637\u0626\u061B \u0633\u062A\u0635\u062D\u062D \u0627\u0644\u0643\u0644\u0645\u0627\u062A \u0641\u064A \u0643\u0644 \u0625\u062C\u0627\u0628\u0629 \u0628\u0639\u062F \u0630\u0644\u0643.",copyMoveTo:"\u0627\u0644\u0633\u0624\u0627\u0644",copyNowhere:"\u0644\u0627 \u062A\u0633\u062A\u0639\u0645\u0644\u0647",copyNotPlaced:"\u063A\u064A\u0631 \u0645\u0648\u0636\u0648\u0639\u0629",copyNotPlacedHelp:"\u0644\u0645 \u0646\u062A\u0645\u0643\u0646 \u0645\u0646 \u0631\u0628\u0637 \u0647\u0630\u0647 \u0627\u0644\u0623\u062C\u0632\u0627\u0621 \u0628\u0633\u0624\u0627\u0644. \u0627\u062E\u062A\u0631 \u0633\u0624\u0627\u0644\u064B\u0627\u060C \u0623\u0648 \u0627\u062A\u0631\u0643\u0647\u0627.",copyHasText:"\u0641\u064A \u0647\u0630\u0647 \u0627\u0644\u0625\u062C\u0627\u0628\u0629 \u0646\u0635 \u0645\u0646 \u0642\u0628\u0644:",copyReplace:"\u0627\u0633\u062A\u0628\u062F\u0627\u0644\u0647",copyBelow:"\u0625\u0636\u0627\u0641\u0629 \u062A\u062D\u062A\u0647",copyLeave:"\u0627\u0644\u0625\u0628\u0642\u0627\u0621 \u0639\u0644\u0649 \u0646\u0635\u064A",copyConfirm:"\u0636\u0639\u0647\u0627 \u0641\u064A \u0625\u062C\u0627\u0628\u0627\u062A\u064A",copyCancel:"\u0625\u0644\u063A\u0627\u0621",copyNothing:"\u0644\u0627 \u064A\u0630\u0647\u0628 \u0623\u064A \u062C\u0632\u0621 \u0625\u0644\u0649 \u0633\u0624\u0627\u0644 \u0628\u0639\u062F. \u0627\u062E\u062A\u0631 \u0633\u0624\u0627\u0644\u064B\u0627 \u0644\u0644\u0623\u062C\u0632\u0627\u0621 \u0627\u0644\u062A\u064A \u062A\u0631\u064A\u062F \u0627\u0644\u0625\u0628\u0642\u0627\u0621 \u0639\u0644\u064A\u0647\u0627.",copyLeavePages:"\u0625\u063A\u0644\u0627\u0642\u061F \u0633\u062A\u0636\u064A\u0639 \u0627\u0644\u0635\u0641\u062D\u0627\u062A \u0627\u0644\u062A\u064A \u0627\u0644\u062A\u0642\u0637\u062A\u0647\u0627.",copyLeaveRead:"\u0625\u063A\u0644\u0627\u0642 \u062F\u0648\u0646 \u0648\u0636\u0639 \u0645\u0627 \u0642\u064F\u0631\u0626 \u0641\u064A \u0625\u062C\u0627\u0628\u0627\u062A\u0643\u061F \u0633\u064A\u0636\u064A\u0639\u060C \u0648\u0625\u0639\u0627\u062F\u0629 \u0642\u0631\u0627\u0621\u0629 \u0627\u0644\u0648\u0631\u0642\u0629 \u062A\u064F\u062D\u0633\u0628 \u0642\u0631\u0627\u0621\u0629 \u062C\u062F\u064A\u062F\u0629.",copyLeaveBack:"\u0631\u062C\u0648\u0639",copyLeaveConfirm:"\u0625\u063A\u0644\u0627\u0642 \u0639\u0644\u0649 \u0623\u064A \u062D\u0627\u0644",sheetPhotoUnreadable:"\u062A\u0639\u0630\u0651\u0631\u062A \u0642\u0631\u0627\u0621\u0629 \u0623\u064A \u0634\u064A\u0621 \u0641\u064A \u0647\u0630\u0647 \u0627\u0644\u0635\u0648\u0631\u0629. \u0623\u0639\u062F \u0627\u0644\u062A\u0642\u0627\u0637\u0647\u0627 \u0641\u064A \u0625\u0636\u0627\u0621\u0629 \u062C\u064A\u062F\u0629 \u0648\u0627\u0644\u0648\u0631\u0642\u0629 \u0645\u0633\u0637\u0651\u062D\u0629 \u062A\u0645\u0644\u0623 \u0627\u0644\u0635\u0648\u0631\u0629\u060C \u0623\u0648 \u0627\u0643\u062A\u0628 \u0625\u062C\u0627\u0628\u062A\u0643.",sheetPhotoNetwork:"\u0627\u0646\u0642\u0637\u0639 \u0627\u0644\u0627\u062A\u0635\u0627\u0644. \u0623\u0639\u062F \u0627\u0644\u0645\u062D\u0627\u0648\u0644\u0629\u060C \u0623\u0648 \u0627\u0643\u062A\u0628 \u0625\u062C\u0627\u0628\u062A\u0643.",sheetPhotoLimit:"\u0627\u0633\u062A\u0639\u0645\u0644\u062A \u0643\u0644 \u0627\u0644\u0642\u0631\u0627\u0621\u0627\u062A \u0627\u0644\u0645\u062A\u0627\u062D\u0629 \u0644\u0647\u0630\u0627 \u0627\u0644\u0633\u0624\u0627\u0644. \u0627\u0643\u062A\u0628 \u0628\u0642\u064A\u0629 \u0625\u062C\u0627\u0628\u062A\u0643.",sheetPhotoBusy:"\u0627\u0644\u0642\u0631\u0627\u0621\u0629 \u0645\u0634\u063A\u0648\u0644\u0629 \u0627\u0644\u0622\u0646. \u0623\u0639\u062F \u0627\u0644\u0645\u062D\u0627\u0648\u0644\u0629 \u0628\u0639\u062F \u0642\u0644\u064A\u0644\u060C \u0623\u0648 \u0627\u0643\u062A\u0628 \u0625\u062C\u0627\u0628\u062A\u0643.",sheetPhotoCut:"\u062A\u0648\u0642\u0651\u0641\u062A \u0627\u0644\u0642\u0631\u0627\u0621\u0629 \u0642\u0628\u0644 \u0627\u0644\u0646\u0647\u0627\u064A\u0629. \u0645\u0627 \u062A\u0645\u0651\u062A \u0642\u0631\u0627\u0621\u062A\u0647 \u0645\u0648\u062C\u0648\u062F \u0641\u064A \u0625\u062C\u0627\u0628\u062A\u0643: \u0631\u0627\u062C\u0639\u0647 \u0648\u0623\u0643\u0645\u0644 \u0627\u0644\u0628\u0627\u0642\u064A.",sheetPhotoSideways:"\u064A\u0628\u062F\u0648 \u0623\u0646\u0651 \u0647\u0630\u0647 \u0627\u0644\u0635\u0641\u062D\u0629 \u0645\u0627 \u0632\u0627\u0644\u062A \u0645\u0627\u0626\u0644\u0629. \u062F\u0648\u0651\u0631\u0647\u0627 \u062D\u062A\u0649 \u062A\u0635\u0628\u062D \u0627\u0644\u0643\u062A\u0627\u0628\u0629 \u0645\u0633\u062A\u0642\u064A\u0645\u0629\u060C \u062B\u0645 \u0627\u0642\u0631\u0623\u0647\u0627.",sheetPhotoSendFailed:"\u062A\u0639\u0630\u0651\u0631 \u0625\u0631\u0633\u0627\u0644 \u0635\u0648\u0631\u0629. \u0627\u062D\u0630\u0641\u0647\u0627 \u0648\u0623\u0639\u062F \u0627\u0644\u062A\u0642\u0627\u0637\u0647\u0627.",sheetPhotoOpenFailed:"\u062A\u0639\u0630\u0651\u0631 \u0641\u062A\u062D \u0647\u0630\u0647 \u0627\u0644\u0635\u0648\u0631\u0629. \u0627\u062E\u062A\u0631 \u0635\u0648\u0631\u0629 \u0628\u0635\u064A\u063A\u0629 JPEG \u0623\u0648 PNG.",sheetPhotoType:"\u0627\u0644\u0643\u062A\u0627\u0628\u0629 \u0628\u062F\u0644\u064B\u0627 \u0645\u0646 \u0630\u0644\u0643",sheetPhotoUnsure:"\u0627\u0644\u0643\u0644\u0645\u0627\u062A \u0627\u0644\u0645\u0633\u0637\u0651\u0631\u0629 \u0628\u0627\u0644\u0623\u0635\u0641\u0631 \u0631\u0628\u0645\u0627 \u0642\u064F\u0631\u0626\u062A \u062E\u0637\u0623\u064B.",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",sheetPadFix:"\u0644\u064A\u0633\u062A \u0635\u062D\u064A\u062D\u0629\u061F \u0623\u0639\u0650\u062F \u0643\u062A\u0627\u0628\u0629 \u0627\u0644\u0631\u0645\u0632\u060C \u0623\u0648 \u0623\u062F\u0631\u0650\u062C\u0647\u0627 \u0648\u0635\u062D\u0651\u062D\u0647\u0627 \u0628\u0627\u0644\u0645\u0641\u0627\u062A\u064A\u062D.",sheetHandwritingFormula:"\u0635\u064A\u063A\u0629 \u0628\u0627\u0644\u064A\u062F",sheetInkPage:"\u0635\u0641\u062D\u0629 \u0628\u0627\u0644\u064A\u062F",sheetInkTitle:"\u0627\u0643\u062A\u0628 \u0625\u062C\u0627\u0628\u062A\u0643 \u0628\u0627\u0644\u064A\u062F",sheetInkMouseHint:"\u0627\u0644\u0643\u062A\u0627\u0628\u0629 \u0628\u0627\u0644\u0641\u0623\u0631\u0629 \u0628\u0637\u064A\u0626\u0629: \u0627\u0644\u0623\u0633\u0647\u0644 \u0639\u0644\u0649 \u0647\u0627\u062A\u0641 \u0623\u0648 \u0644\u0648\u062D\u060C \u0623\u0648 \u0639\u0644\u0649 \u0627\u0644\u0648\u0631\u0642 \u062B\u0645 \u0635\u0648\u0631\u0629.",sheetInkMousePhoto:"\u0627\u0644\u062A\u0642\u0627\u0637 \u0635\u0648\u0631\u0629 \u0628\u062F\u0644\u064B\u0627 \u0645\u0646 \u0630\u0644\u0643",sheetInkHelp:"\u0627\u0643\u062A\u0628 \u0639\u0644\u0649 \u0627\u0644\u0623\u0633\u0637\u0631 \u0628\u0642\u0644\u0645 \u0623\u0648 \u0628\u0625\u0635\u0628\u0639\u0643\u060C \u062B\u0645 \u0627\u0637\u0644\u0628 \u0642\u0631\u0627\u0621\u0629 \u0627\u0644\u0635\u0641\u062D\u0629: \u064A\u0638\u0647\u0631 \u0627\u0644\u0646\u0635 \u0641\u064A \u0625\u062C\u0627\u0628\u062A\u0643.",sheetInkCanvas:e=>`\u0627\u0644\u0635\u0641\u062D\u0629 ${e}\u060C \u0627\u0643\u062A\u0628 \u0647\u0646\u0627`,sheetInkPageN:e=>`\u0627\u0644\u0635\u0641\u062D\u0629 ${e}`,sheetInkRemovePage:"\u062D\u0630\u0641 \u0647\u0630\u0647 \u0627\u0644\u0635\u0641\u062D\u0629",sheetInkPageRemoved:e=>`\u062D\u064F\u0630\u0641\u062A \u0627\u0644\u0635\u0641\u062D\u0629 ${e}.`,sheetInkRead:e=>e>1?"\u0627\u0642\u0631\u0623 \u0635\u0641\u062D\u0627\u062A\u064A":"\u0627\u0642\u0631\u0623 \u0635\u0641\u062D\u062A\u064A",sheetInkReading:"\u062C\u0627\u0631\u064D \u0642\u0631\u0627\u0621\u0629 \u0635\u0641\u062D\u062A\u0643\u2026 \u062A\u0638\u0647\u0631 \u0627\u0644\u0623\u0633\u0637\u0631 \u0641\u064A \u0625\u062C\u0627\u0628\u062A\u0643 \u0623\u062B\u0646\u0627\u0621 \u0627\u0644\u0642\u0631\u0627\u0621\u0629.",sheetInkSendFailed:"\u062A\u0639\u0630\u0651\u0631 \u0625\u0631\u0633\u0627\u0644 \u0635\u0641\u062D\u0629. \u062A\u062D\u0642\u0651\u0642 \u0645\u0646 \u0627\u062A\u0635\u0627\u0644\u0643 \u0648\u0623\u0639\u062F \u0627\u0644\u0645\u062D\u0627\u0648\u0644\u0629.",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 xp={en:Cr,fr:jn,ar:qn},ia=vp(null);function me(){return _i(ia)??Cr}function tn(e){let t=_i(ia);return e&&xp[e]||t||Cr}function sr({locale:e,children:t}){let r=tn(e);return yp(ia.Provider,{value:r,children:t})}var Mi=wp(null);function Hn({initial:e,onChange:t,children:r}){let n=Nr({...e??{}}),o=Nr(t);o.current=t;let a=Sp(()=>({get:s=>n.current[s]??0,set:(s,i)=>{n.current={...n.current,[s]:i},o.current?.(n.current)}}),[]);return st(Mi.Provider,{value:a,children:r})}var da=[.75,1,1.25,1.5],pa=.5;function Ar(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 ua="edpire:audio-play";function Nt({src:e,maxPlays:t,learnerSpeed:r,speed:n,allowSeek:o,durationHint:a,playsKey:s,playsUsed:i,onPlaysUsedChange:c,disabled:l=!1,label:d,className:u}){let p=me(),f=kp(Mi),h=s??e,m=t&&t>0?Math.floor(t):0,b=o!==!1,y=r!==!1,x=n&&n>=.25&&n<=4?n:1,A=Nr(null),g=Nr(null),[T,C]=ir(!1),[E,R]=ir(0),[M,k]=ir(a&&a>0?a:0),[S,v]=ir(!1),[O,_]=ir(!1),[w,X]=ir(x),[Y,F]=ir(()=>i??f?.get(h)??0),L=Nr(!1),B=Nr(!1);rn(()=>{i!==void 0&&F(i)},[i]),rn(()=>X(x),[x]),rn(()=>{A.current&&(A.current.playbackRate=w)},[w]),rn(()=>{_(!1),v(!1),R(0),C(!1),L.current=!1,a&&a>0||k(0);let ee=A.current;ee&&ee.readyState>=1&&Number.isFinite(ee.duration)&&ee.duration>0&&k(ee.duration)},[e]),rn(()=>{let ee=fe=>{let xe=A.current;xe&&fe.detail!==xe&&!xe.paused&&xe.pause()};return window.addEventListener(ua,ee),()=>window.removeEventListener(ua,ee)},[]);let J=m>0&&Y>=m&&!L.current,N=m>0?Math.max(0,m-Y):null,P=l||O||J,K=la(()=>{if(m===0)return!0;if(Y>=m)return!1;let ee=Y+1;return F(ee),L.current=!0,i===void 0&&f?.set(h,ee),c?.(ee),!0},[m,Y,i,f,h,c]),U=la(()=>{let ee=A.current;if(!ee||l||O)return;if(!ee.paused){ee.pause();return}(S||ee.currentTime<pa)&&!L.current&&!K()||((S||ee.currentTime>=(ee.duration||1/0))&&(ee.currentTime=0),v(!1),ee.playbackRate=w,window.dispatchEvent(new CustomEvent(ua,{detail:ee})),ee.play().catch(()=>C(!1)))},[l,O,S,K,w]),j=M>0?M:0,de=j>0?Math.min(1,E/j):0,z=la(ee=>{let fe=A.current;if(!fe||!b||P||j===0)return;let xe=Math.max(0,Math.min(j,ee));if(m>0&&xe<pa&&E>=pa&&L.current&&(L.current=!1,!fe.paused&&!K())){fe.pause();return}fe.currentTime=xe,R(xe),v(!1)},[b,P,j,m,E,K]),W=ee=>{let fe=g.current;if(!fe)return 0;let xe=fe.getBoundingClientRect(),Ae=getComputedStyle(fe).direction==="rtl"?(xe.right-ee)/xe.width:(ee-xe.left)/xe.width;return Math.max(0,Math.min(1,Ae))},le=ee=>{!b||P||j===0||(ee.preventDefault(),B.current=!0,ee.currentTarget.setPointerCapture(ee.pointerId),z(W(ee.clientX)*j))},I=ee=>{B.current&&z(W(ee.clientX)*j)},G=()=>{B.current=!1},re=ee=>{if(!b||P||j===0)return;let fe=g.current?getComputedStyle(g.current).direction==="rtl":!1,xe=5,ke=null;ee.key==="ArrowRight"?ke=E+(fe?-xe:xe):ee.key==="ArrowLeft"?ke=E+(fe?xe:-xe):ee.key==="ArrowUp"?ke=E+xe:ee.key==="ArrowDown"?ke=E-xe:ee.key==="Home"?ke=0:ee.key==="End"&&(ke=j),ke!==null&&(ee.preventDefault(),z(ke))},ne=()=>{let ee=da.indexOf(w);X(da[(ee+1)%da.length]??1)},ie=(T||E>0)&&!S&&j>0,ve=Ar(ie?j-E:j),Ye=T?st(Rp,{size:18,fill:"currentColor",strokeWidth:0,"aria-hidden":!0}):S&&!J?st(Cp,{size:18,"aria-hidden":!0}):st(Pp,{size:18,fill:"currentColor",strokeWidth:0,"aria-hidden":!0,style:{marginInlineStart:2}}),Qe=T?p.audioPause:S?p.audioReplay:p.audioPlay;return ca("span",{role:"group","aria-label":d,className:`edp-audio${P?" edp-audio--off":""}${u?` ${u}`:""}`,"data-audio-player":"",children:[ca("span",{className:"edp-audio-bar",children:[st("button",{type:"button",className:"edp-audio-play",onClick:U,disabled:P,"aria-label":Qe,children:Ye}),ca("span",{ref:g,className:`edp-audio-track${b&&!P?" edp-audio-track--seek":""}`,role:"slider",tabIndex:b&&!P?0:-1,"aria-label":p.audioPosition,"aria-valuemin":0,"aria-valuemax":Math.round(j),"aria-valuenow":Math.round(E),"aria-valuetext":p.audioTimeOf(Ar(E),Ar(j)),"aria-disabled":!b||P,onPointerDown:le,onPointerMove:I,onPointerUp:G,onPointerCancel:G,onKeyDown:re,children:[st("span",{className:"edp-audio-rail",children:st("span",{className:"edp-audio-fill",style:{width:`${de*100}%`}})}),b&&!P&&j>0&&st("span",{className:"edp-audio-thumb",style:{insetInlineStart:`${de*100}%`}})]}),st("span",{className:"edp-audio-time",dir:"ltr",children:ve}),y&&!O&&st("button",{type:"button",className:"edp-audio-speed",dir:"ltr",onClick:ne,disabled:l,"aria-label":p.audioSpeed(p.audioRate(w)),children:p.audioRate(w)})]}),(O||N!==null)&&st("span",{className:"edp-audio-note","aria-live":"polite",children:st("bdi",{children:O?p.audioUnavailable:N===0&&!L.current?p.audioNoPlaysLeft:p.audioPlaysLeft(N??0)})}),st("audio",{ref:A,src:e||void 0,preload:"metadata",onLoadedMetadata:ee=>{let fe=ee.currentTarget;fe.playbackRate=w,Number.isFinite(fe.duration)&&fe.duration>0?k(fe.duration):Np(fe,xe=>k(ke=>ke>0?ke:xe))},onDurationChange:ee=>{let fe=ee.currentTarget.duration;Number.isFinite(fe)&&fe>0&&k(fe)},onTimeUpdate:ee=>{B.current||R(ee.currentTarget.currentTime)},onPlay:()=>C(!0),onPause:()=>C(!1),onEnded:()=>{C(!1),v(!0),L.current=!1,R(j)},onError:()=>{e&&_(!0)}})]})}function Np(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 Ap from"katex";import"katex/dist/contrib/mhchem.js";var Tp={"\\d":"\\mathrm{d}","\\R":"\\mathbb{R}","\\N":"\\mathbb{N}","\\Z":"\\mathbb{Z}","\\Q":"\\mathbb{Q}","\\C":"\\mathbb{C}"};function _p(e){return e.replace(/\\lim(?![a-zA-Z])(?=\s*_)/g,"\\lim\\limits")}function Fe(e,t,r=!0){try{return Ap.renderToString(_p(e),{displayMode:t,output:r?"htmlAndMathml":"html",throwOnError:!1,errorColor:"#cc0000",macros:Tp,strict:!1})}catch(n){return`<span class="katex-error" style="color:#cc0000" title="${String(n)}">${e}</span>`}}function V(e){return`calc(${typeof e=="number"?`${e}px`:e} * var(--edp-scale, 1))`}function Ee(e){return{width:V(e),height:V(e)}}function bt(e){if(e==null||e==="")return;if(typeof e=="number")return V(e);let t=String(e).trim();return/^\d+(\.\d+)?px$/.test(t)?V(t):t}import{createContext as Mp}from"react";var nn=Mp(!1),Un="1px solid #d1d5db",Ep="#f3f4f6",Lp="#e3e1dc",Ip="var(--card, #fff)",cr="edp-table-first",Ei={overflowX:"auto",margin:`${V("1.25rem")} 0`},Li={left:!1,right:!1,held:0,rtl:!1};function Ii(e,t,r,n=0){return{left:t.left<e.left-1,right:t.right>e.right+1,held:n,rtl:r}}function $i(e,t){return Math.max(80,Math.round((e-t)*.8))}var ma={borderCollapse:"separate",borderSpacing:0,width:"100%",tableLayout:"auto",fontSize:V("0.875rem"),lineHeight:1.3,borderBlockStart:Un,borderInlineStart:Un};function on(e){let t=e.gray?Lp:e.header?Ep:e.sticky?Ip:void 0;return{borderBlockEnd:Un,borderInlineEnd:Un,padding:`${V("4px")} ${V("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 an(e){return Object.entries(e).map(([t,r])=>`${t.replace(/[A-Z]/g,n=>`-${n.toLowerCase()}`)}:${r}`).join(";")}function ha(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),u=Math.max(1,l.attrs?.rowspan??1);for(let p=i;p<i+u;p++){let f=n[p]??(n[p]=[]);for(let h=c;h<c+d;h++)f[h]=!0}for(let p=0;p<d;p++){let f=l.attrs?.colwidth?.[p];f&&t[c+p]==null&&(t[c+p]=f)}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 fa(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 At,jsxs as ga}from"react/jsx-runtime";import{useCallback as $p,useEffect as zp,useLayoutEffect as Fp,useRef as Dp,useState as Op}from"react";var Bp=typeof window<"u"?Fp:zp;function zi({side:e}){return At("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:At("path",{d:e==="left"?"M15 6l-6 6 6 6":"M9 6l6 6-6 6"})})}function Fi({children:e}){let t=me(),r=Dp(null),[n,o]=Op(Li),a=$p(()=>{let u=r.current,p=u?.querySelector("table");if(!u||!p)return;let f=u.querySelector(`.${cr}`),h=Ii(u.getBoundingClientRect(),p.getBoundingClientRect(),getComputedStyle(u).direction==="rtl",f?f.getBoundingClientRect().width:0);o(m=>m.left===h.left&&m.right===h.right&&m.held===h.held&&m.rtl===h.rtl?m:h)},[]);Bp(()=>{let u=r.current;if(!u)return;a(),u.addEventListener("scroll",a,{passive:!0});let p=typeof ResizeObserver<"u"?new ResizeObserver(a):null;p?.observe(u);let f=u.querySelector("table");return f&&p?.observe(f),()=>{u.removeEventListener("scroll",a),p?.disconnect()}},[a]);let s=u=>{let p=r.current;p&&p.scrollBy({left:u*$i(p.clientWidth,n.held),behavior:"smooth"})},i=n.left||n.right,c=u=>i?At("div",{className:`edp-table-arrows edp-table-arrows--${u}`,children:ga("span",{dir:"ltr",className:"edp-table-arrows__pair",children:[At("button",{type:"button",className:"edp-table-arrow",onClick:()=>s(-1),disabled:!n.left,"aria-label":t.tableScrollLeft,children:At(zi,{side:"left"})}),At("button",{type:"button",className:"edp-table-arrow",onClick:()=>s(1),disabled:!n.right,"aria-label":t.tableScrollRight,children:At(zi,{side:"right"})})]})}):null,l=n.rtl?0:n.held,d=n.rtl?n.held:0;return ga("div",{className:"edp-table-frame",style:{margin:`${V("1.25rem")} 0`},children:[c("top"),ga("div",{style:{position:"relative"},children:[At("div",{ref:r,className:"edp-table-scroll",style:{overflowX:"auto"},children:e}),n.left&&At("span",{className:"edp-table-shade edp-table-shade--left",style:{left:l},"aria-hidden":"true"}),n.right&&At("span",{className:"edp-table-shade edp-table-shade--right",style:{right:d},"aria-hidden":"true"})]}),c("bottom")]})}var Di={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"}},Oi={border:"#2563eb",background:"#e0f2fe"},Bi={border:"#dc2626",background:"#fee2e2"};function jp(e){return{display:"inline-block",verticalAlign:"middle",border:`2px solid ${e?.border||Oi.border}`,background:e?.background||Oi.background,borderRadius:V("4px"),padding:"0.17em 0.37em"}}function qp(e){let t=e?.shape==="circle"?"50%":"9999px";return{display:"inline-block",verticalAlign:"middle",border:`2px solid ${e?.border||Bi.border}`,background:e?.background||Bi.background,borderRadius:t,padding:"0.15em 0.45em"}}function Hp(e,t){if(!(!e&&!t))return{...e?{textAlign:e}:{},...t?{margin:0}:{}}}function ut(e,t,r){return oe("div",{className:"exercise-content",children:e.content.map((n,o)=>Xe(n,`node-${o}`,t,r))})}var Up=/^[\u00a0\u202f ]?[.,;:!?\u2026)\]}\u00bb\u201d\u2019%\u060c\u061b\u061f]+/,Kp=new Set(["blank","inlineChoiceSet"]);function ji(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=Kp.has(i.type)&&c?.type==="text"?Up.exec(c.text??"")?.[0]:void 0;if(!l||!c){o.push(Xe(i,`${t}-${s}`,r,n));continue}let d=(c.text??"").slice(l.length);o.push(qi("span",{style:{whiteSpace:"nowrap"},children:[oe("span",{style:{whiteSpace:"normal"},children:Xe(i,`${t}-${s}-a`,r,n)}),Xe({...c,text:l},`${t}-${s}-p`,r,n)]},`${t}-${s}`)),d&&o.push(Xe({...c,text:d},`${t}-${s+1}`,r,n)),s++}return o}function Xe(e,t,r,n){switch(e.type){case"choiceSet":case"inlineChoiceSet":return oe(Wn,{node:e,validationFeedback:r?.get(e.id)},t);case"blank":return e.attrs.mode==="typed"?oe(Vn,{node:e,validationFeedback:r?.get(e.id)},t):oe(Gn,{node:e,validationFeedback:r?.get(e.id)},t);case"blankPool":return oe(Yn,{node:e},t);case"inlinePool":return oe(Qn,{node:e},t);case"matchingSet":return oe(Xn,{node:e,validationFeedback:r?.get(e.id)},t);case"aiAnswerInput":return oe(Jn,{node:e,validationFeedback:r?.get(e.id),readOnly:n?.readOnly,mediaHandler:n?.mediaHandler,answerSheetHandler:n?.answerSheetHandler},t);case"openResponseNode":return oe(Zn,{node:e,validationFeedback:r?.get(e.id),readOnly:n?.readOnly,mediaHandler:n?.mediaHandler,answerSheetHandler:n?.answerSheetHandler},t);case"mathResponse":{let o=oe(eo,{nodeId:e.id,placeholder:e.attrs?.placeholder,hint:e.attrs?.hint,validationFeedback:r?.get(e.id),readOnly:n?.readOnly},t);return n?.inInline?o:oe("p",{className:"edp-slot-line",children:o},t)}case"codingResponse":return oe(to,{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 oe("p",{dir:s,style:Hp(a,n?.inTable),children:ji(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=Di[o]??Di[3];return oe(a,{dir:c,style:{...l,...i?{textAlign:i}:{}},children:ji(e.content,t,r,n)},t)}case"blockquote":{let o=e.attrs,a=o?.dir||void 0,s=o?.textAlign;return oe("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)=>Xe(i,`${t}-${c}`,r,n))},t)}case"text":{let o=e,a=n?.inTable?fa(o.text??""):o.text??"",s=o.marks??[];if(s.length===0)return oe("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=oe("strong",{children:c});break;case"italic":c=oe("em",{children:c});break;case"underline":c=oe("u",{children:c});break;case"strike":c=oe("s",{children:c});break;case"code":c=oe("code",{children:c});break;case"subscript":c=oe("sub",{children:c});break;case"superscript":c=oe("sup",{children:c});break;case"boxedText":c=oe("span",{style:jp(l.attrs),children:c});break;case"circleText":c=oe("span",{style:qp(l.attrs),children:c});break}return oe("span",{style:Object.keys(i).length>0?i:void 0,children:c},t)}case"hardBreak":return oe("br",{},t);case"resizableImage":return oe("img",{src:e.attrs?.src||void 0,alt:e.attrs?.alt||"",style:{display:"inline-block",verticalAlign:"middle",width:bt(e.attrs?.width||void 0)??"auto",height:bt(e.attrs?.height||void 0)??"auto",maxWidth:"100%"}},t);case"resizableAudio":{let o=e.attrs??{src:""},a=n?.readOnly===!0;return oe(Nt,{src:o.src||"",maxPlays:a?null:o.maxPlays,learnerSpeed:o.learnerSpeed,speed:o.speed,allowSeek:a?null:o.allowSeek},t)}case"resizableVideo":return oe("video",{src:e.attrs?.src||void 0,controls:!0,style:{display:"inline-block",verticalAlign:"middle",width:bt(e.attrs?.width||void 0)??"auto",height:bt(e.attrs?.height||void 0)??"auto",maxWidth:"100%"}},t);case"youtubeEmbed":return oe("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:bt(e.attrs?.width||480),height:bt(e.attrs?.height||270)}},t);case"inlineMath":return oe("span",{dir:"ltr",style:{unicodeBidi:"isolate",display:"inline-block"},className:"math-inline",dangerouslySetInnerHTML:{__html:Fe(e.attrs?.latex??"",!1,!0)}},t);case"blockMath":return oe("div",{dir:"ltr",style:{unicodeBidi:"isolate",textAlign:"center",margin:"1em 0"},className:"math-block",dangerouslySetInnerHTML:{__html:Fe(e.attrs?.latex??"",!0,!0)}},t);case"variable":return oe("span",{className:"variable",children:`{${e.attrs?.name}}`},t);default:{let o=e;if(o.type==="bulletList")return oe("ul",{style:{listStyleType:"disc",paddingLeft:"1.5em",margin:"0.5em 0"},children:o.content?.map((a,s)=>Xe(a,`${t}-${s}`,r,n))},t);if(o.type==="orderedList")return oe("ol",{style:{listStyleType:"decimal",paddingLeft:"1.5em",margin:"0.5em 0"},children:o.content?.map((a,s)=>Xe(a,`${t}-${s}`,r,n))},t);if(o.type==="listItem")return oe("li",{children:o.content?.map((a,s)=>Xe(a,`${t}-${s}`,r,n))},t);if(o.type==="table"){let a=ha(o.content),s={...n,inTable:!0,stickyCells:a.stickyCells};return oe(Fi,{children:qi("table",{style:ma,children:[a.columnWidths.length>0&&oe("colgroup",{children:a.columnWidths.map((i,c)=>oe("col",{style:i?{width:V(i)}:void 0},c))}),oe("tbody",{children:o.content?.map((i,c)=>Xe(i,`${t}-${c}`,r,s))})]})},t)}return o.type==="tableRow"?oe("tr",{children:o.content?.map((a,s)=>Xe(a,`${t}-${s}`,r,n))},t):o.type==="tableCell"?oe("td",{colSpan:o.attrs?.colspan,rowSpan:o.attrs?.rowspan,className:n?.stickyCells?.has(o)?cr:void 0,style:on({header:!1,gray:!!o.attrs?.gray,sticky:!!n?.stickyCells?.has(o)}),children:oe(nn.Provider,{value:!0,children:o.content?.map((a,s)=>Xe(a,`${t}-${s}`,r,n))})},t):o.type==="tableHeader"?oe("th",{colSpan:o.attrs?.colspan,rowSpan:o.attrs?.rowspan,className:n?.stickyCells?.has(o)?cr:void 0,style:on({header:!0,gray:!!o.attrs?.gray,sticky:!!n?.stickyCells?.has(o)}),children:oe(nn.Provider,{value:!0,children:o.content?.map((a,s)=>Xe(a,`${t}-${s}`,r,n))})},t):(console.warn(`Unknown node type during interpretation: ${e.type}`),null)}}}function Se(e,t){return e.map(r=>{if(r.type==="text"){let n=lr(t?.inTable?fa(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:${V("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?Se(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=ha(r.content),o=r.content?Se(r.content,{...t,inTable:!0,stickyCells:n.stickyCells}):"",a=n.columnWidths.length?`<colgroup>${n.columnWidths.map(s=>s?`<col style="width:${V(s)}">`:"<col>").join("")}</colgroup>`:"";return`<div style="${an(Ei)}"><table style="${an(ma)}">${a}<tbody>${o}</tbody></table></div>`}if(r.type==="tableRow")return`<tr>${r.content?Se(r.content,t):""}</tr>`;if(r.type==="tableCell"){let n=r.content?Se(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="${cr}"`:"";return`<td${o}${a}${i} style="${an(on({header:!1,gray:!!r.attrs?.gray,sticky:s}))}">${n}</td>`}if(r.type==="tableHeader"){let n=r.content?Se(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="${cr}"`:"";return`<th${o}${a}${i} style="${an(on({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?Se(r.content,t):""}</ul>`;if(r.type==="orderedList")return`<ol style="list-style-type:decimal;padding-left:1.5em">${r.content?Se(r.content,t):""}</ol>`;if(r.type==="listItem")return`<li>${r.content?Se(r.content,t):""}</li>`;if(r.type==="blockquote"){let n=r.content?Se(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=Kn(n.width),a=Kn(n.height);return`<img src="${lr(n.src??"")}" alt="${lr(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="${lr(n.src??"")}" style="display:inline-block;vertical-align:middle;width:${V("260px")};max-width:100%;height:${V("36px")}"></audio>`}if(r.type==="resizableVideo"){let n=r.attrs??{},o=Kn(n.width),a=Kn(n.height);return`<video src="${lr(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/${lr(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:${bt(n.width||480)};height:${bt(n.height||270)}"></iframe>`}return r.type==="inlineMath"?`<span dir="ltr" class="math-inline" style="unicode-bidi:isolate;display:inline-block">${Fe(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">${Fe(r.attrs?.latex??"",!0,!0)}</div>`:r.type==="variable"?`<span class="variable">{${lr(r.attrs?.name??"")}}</span>`:""}).join("")}function Kn(e){return e==null||e===""?null:bt(e)??null}function lr(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}import{jsx as Wp}from"react/jsx-runtime";import{createContext as Vp,useContext as Hi,useMemo as Ui}from"react";var Gp={sm:.875,md:1,lg:1.25,xl:1.5},ba=Vp(null);function Yp(e,t){let r={...e??{}};if(t)for(let[n,o]of Object.entries(t))o!==void 0&&(r[n]=o);return r}function Qp(e){return typeof e=="number"?Number.isFinite(e)&&e>0?e:1:e?Gp[e]??1:1}function mt(e){let t=e??{};return{scale:Qp(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,answerPages:t.answerPages??"corner"}}function it(e){let t=Hi(ba);return Ui(()=>Yp(t,e),[t,e?.size,e?.choiceLabels,e?.choiceColumns,e?.layoutBy,e?.motion,e?.shuffleSeed,e?.answerPages])}function Je(){let e=Hi(ba);return Ui(()=>mt(e),[e])}function ct({display:e,children:t}){let r=it(e);return Wp(ba.Provider,{value:r,children:t})}function ht(e){if(e.sizeSet)return{"--edp-scale":String(e.scale)}}function dr(){let{motion:e}=Je();return{hop:e==="none"?"":"animate-hop",shake:e==="full"?"animate-shake":"",wobble:e==="full"?"animate-wobble":""}}function Xp(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 Jp(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 sn(e,t){let r=[...e],n=Jp(Xp(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 Ki,jsx as _e,jsxs as Zp}from"react/jsx-runtime";import{useState as ro,useEffect as Vi,useRef as Wi,useLayoutEffect as eu,useCallback as tu}from"react";import{createPortal as ru}from"react-dom";import nu from"clsx";var ou=typeof window<"u"?eu:Vi;function ya({node:e}){if(e.type==="text"){if(!e.marks||e.marks.length===0)return _e(Ki,{children:e.text});let t=e.text||"";for(let r of e.marks)r.type==="bold"?t=_e("strong",{children:t}):r.type==="italic"?t=_e("em",{children:t}):r.type==="underline"?t=_e("u",{children:t}):r.type==="strike"?t=_e("s",{children:t}):r.type==="textStyle"&&r.attrs?.color&&(t=_e("span",{style:{color:r.attrs.color},children:t}));return _e(Ki,{children:t})}if(e.type==="paragraph")return _e("span",{className:"block",children:e.content?.map((t,r)=>_e(ya,{node:t},r))??_e("br",{})});if(e.type==="hardBreak")return _e("br",{});if(e.type==="inlineMath"||e.type==="blockMath"){let t=String(e.attrs?.latex??""),r=e.type==="blockMath";return _e("span",{className:r?"block text-center":void 0,dir:"ltr",dangerouslySetInnerHTML:{__html:Fe(t,r)}})}return e.content?_e("span",{className:"block",children:e.content.map((t,r)=>_e(ya,{node:t},r))}):null}function au({nodes:e}){return _e("span",{className:"block space-y-1",style:{color:"var(--ink, #1d2025)"},children:e.map((t,r)=>_e(ya,{node:t},r))})}function su(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 Gt({hint:e}){let t=me(),[r,n]=ro(!1),[o,a]=ro(!1),[s,i]=ro(null),[c,l]=ro({}),d=Wi(null),u=Wi(null);Vi(()=>{if(!o)return;let y=x=>{let A=x.target;d.current&&!d.current.contains(A)&&u.current&&!u.current.contains(A)&&(a(!1),n(!1))};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[o]);let p=tu(()=>{let y=d.current,x=u.current;!y||!x||i(su(y.getBoundingClientRect(),x.getBoundingClientRect(),window.innerWidth))},[]);ou(()=>{if(!r){i(null);return}let y=d.current;if(y){let x=getComputedStyle(y);l({direction:x.direction,fontFamily:x.fontFamily,"--edp-scale":x.getPropertyValue("--edp-scale").trim()||"1"})}return p(),window.addEventListener("scroll",p,!0),window.addEventListener("resize",p),()=>{window.removeEventListener("scroll",p,!0),window.removeEventListener("resize",p)}},[r,p]);let f=()=>n(!0),h=()=>{o||n(!1)},m=y=>{y.stopPropagation(),o?(a(!1),n(!1)):(a(!0),n(!0))},b=r&&typeof document<"u"?ru(_e("span",{className:"edpire-scope",style:{...c,display:"contents"},children:_e("span",{ref:u,role:"tooltip",className:"player-blank-hint-pop",onClick:y=>y.stopPropagation(),onMouseEnter:f,onMouseLeave:h,style:{position:"fixed",top:s?s.top:0,left:s?s.left:0,bottom:"auto",transform:"none",margin:0,visibility:s?"visible":"hidden"},children:_e(au,{nodes:e})})}),document.body):null;return Zp("span",{ref:d,className:"relative inline-flex items-center align-middle",onMouseEnter:f,onMouseLeave:h,children:[_e("button",{type:"button",onClick:m,className:nu("player-blank-hint-btn select-none",o&&"player-blank-hint-btn--pinned"),"aria-label":t.showHint,"aria-expanded":r,children:"?"}),b]})}function Tt({hint:e}){return!e||e.length===0?null:_e(Gt,{hint:e})}function lu(e){return[...e].map(t=>({v:t,r:Math.random()})).sort((t,r)=>t.r-r.r).map(t=>t.v)}var du=e=>e.replace(/ {2,}/g,t=>"&nbsp;".repeat(t.length-1)+" "),pu=new Set(["image","resizableImage","resizableVideo","youtubeEmbed"]);function Xi(e){return(e??[]).some(t=>pu.has(t?.type)||Xi(t?.content))}var Yi=()=>Oe("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:3,children:Oe("path",{d:"M5 13l4 4L19 7"})}),Qi=()=>Oe("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:3,children:Oe("path",{d:"M6 6l12 12M18 6L6 18"})});function Wn({node:e,validationFeedback:t}){let r=Me(),n=me(),o=Je(),a=dr(),{id:s,content:i,attrs:c}=e,l=c.shuffle??!1,d="prompt"in c?c.prompt:void 0,u="separator"in c?c.separator??"/":"/",p="pickLimit"in c&&c.pickLimit?c.pickLimit:1,f=c.hideCount===!0,h=f||p>1,m=!f&&p>1,b="layout"in c?c.layout??"row":"row",y=e.type==="inlineChoiceSet",x=JSON.stringify(i),A=l&&o.shuffleSeed!==void 0,g=cu(()=>A?sn(i,`${o.shuffleSeed}:${s}`):null,[A,o.shuffleSeed,s,x]),[T,C]=Gi(i);va(()=>{A||C(l?lu(i):i)},[l,A,x]);let E=g??T,[R,M]=Gi(new Set),k=t?.showFeedback??!1,S=t?.correctChoiceIds||[];va(()=>{let P=K=>{let j=K.answers.find(de=>de.nodeId===s&&de.type==="choiceSet");j&&"selectedIds"in j.answer&&M(new Set(j.answer.selectedIds))};return r.on("answers:prefill",P),()=>r.off("answers:prefill",P)},[s,r]),va(()=>{r.emit({type:"answer:changed",answer:{nodeId:s,type:"choiceSet",timestamp:Date.now(),answer:{selectedIds:Array.from(R)}}})},[R,s,r]);let v=P=>{k||M(K=>{let U=new Set(K);return h?U.has(P)?U.delete(P):(f||U.size<p)&&U.add(P):U.has(P)?U.delete(P):(U.clear(),U.add(P)),U})},O=P=>du(Se(P.content)),_=P=>{let K=R.has(P),U=S.includes(P);return k?U&&K?"correct":U&&!K?"correct-unchosen":!U&&K?"incorrect":"muted":K?"selected":"idle"},w={idle:"",selected:"player-choice--selected",correct:$t("player-choice--correct",a.hop),"correct-unchosen":"player-choice--correct-unchosen",incorrect:$t("player-choice--incorrect",a.shake),muted:"player-choice--muted"},X={idle:"",selected:"player-inline-choice--selected",correct:$t("player-inline-choice--correct",a.hop),"correct-unchosen":"player-inline-choice--correct-unchosen",incorrect:$t("player-inline-choice--incorrect",a.shake),muted:"player-inline-choice--muted"};if(y)return Tr("span",{className:"inline-choice",children:[d&&Tr("span",{className:"mr-2 font-medium",children:[d,m?Oe("span",{className:"ms-1 opacity-60",children:n.chooseN(p)}):null]}),E.map((P,K)=>Tr(iu,{children:[Oe("button",{type:"button",disabled:k,onClick:()=>v(P.id),className:$t("player-inline-choice",X[_(P.id)]),"aria-pressed":R.has(P.id),dangerouslySetInnerHTML:{__html:O(P)}}),K<E.length-1&&Oe("span",{className:"mx-1",children:u})]},P.id)),c.hint&&c.hint.length>0&&Oe(Gt,{hint:c.hint})]});let Y=o.layoutBy==="box",F=o.choiceColumns?Math.min(o.choiceColumns,E.length):0,L=F?{gridAutoRows:"1fr",gridTemplateColumns:`repeat(${F}, minmax(0, 1fr))`}:{gridAutoRows:"1fr"},B=E.some(P=>Xi(P.content)),J=o.choiceLabels==="letters",N=P=>n.choiceLetters[P]??String(P+1);return Tr("div",{className:$t("cs-player my-4 space-y-3",Y&&"cs-player--box"),children:[d&&Tr("p",{className:"font-medium",children:[d,m?Oe("span",{className:"ms-2 text-sm opacity-70",children:n.chooseN(p)}):null]}),c.hint&&c.hint.length>0&&Oe(Gt,{hint:c.hint}),Oe("div",{className:$t("cs-player__grid",b==="row"&&"cs-player__grid--row"),style:L,children:E.map((P,K)=>{let U=_(P.id),j=U==="incorrect"?"incorrect":U==="correct"||U==="correct-unchosen"?"correct":null;return Tr("button",{type:"button",disabled:k,onClick:()=>v(P.id),className:$t("player-choice",B&&"player-choice--tile",w[U]),"aria-pressed":R.has(P.id),children:[Oe("span",{className:$t("player-choice__mark",h?"player-choice__mark--box":"player-choice__mark--radio",J&&"player-choice__mark--letter"),children:J?N(K):U==="incorrect"?Oe(Qi,{}):Oe(Yi,{})}),Oe("span",{className:"player-choice__text",dangerouslySetInnerHTML:{__html:O(P)}}),J&&j&&Oe("span",{className:`player-choice__verdict player-choice__verdict--${j}`,"aria-hidden":"true",children:j==="incorrect"?Oe(Qi,{}):Oe(Yi,{})})]},P.id)})})]})}import{jsx as zt,Fragment as uu,jsxs as xa}from"react/jsx-runtime";import{useContext as mu,useState as hu,useEffect as wa,useRef as fu,useCallback as gu}from"react";import pr from"clsx";function Vn({node:e,validationFeedback:t}){let r=Me(),n=me(),o=dr(),{id:a,attrs:s}=e,{placeholder:i="___",width:c="auto",hint:l}=s,d=fu(null),u=i.trim().split(/\s+/).filter(Boolean).length,p=mu(nn),f=!p&&c==="auto"&&u>=4,[h,m]=hu(""),b=t?.showFeedback??!1,y=t?.state,x=y==="validating",A=t?.displayAnswer,g=t?.message;wa(()=>{let R=M=>{let S=M.answers.find(v=>v.nodeId===a&&v.type==="blank");S&&"mode"in S.answer&&S.answer.mode==="typed"&&"text"in S.answer&&m(S.answer.text)};return r.on("answers:prefill",R),()=>r.off("answers:prefill",R)},[a,r]),wa(()=>{r.emit({type:"answer:changed",answer:{nodeId:a,type:"blank",timestamp:Date.now(),answer:{mode:"typed",text:h}}})},[h,a,r]);let T=R=>{m(R.target.value)},C=gu(()=>{let R=d.current;R&&(R.style.height="auto",R.style.height=`${R.scrollHeight}px`)},[]);wa(()=>{C()},[h,C]);let E=b&&!x;return xa("span",{className:p?"player-blank-cell":pr("inline-flex flex-wrap items-center gap-x-1 gap-y-0.5 align-middle max-w-full",f&&"w-full"),children:[zt("span",{className:p?"player-blank-cell__box":pr("relative inline-block shrink-0 min-w-0 max-w-full",f&&"w-full flex-1"),children:E?zt("span",{className:pr("player-typed-blank-feedback",p&&"player-typed-blank-feedback--cell",f&&"w-full",y==="correct"&&pr("player-typed-blank-feedback--correct",o.hop),y==="partial"&&"player-typed-blank-feedback--partial",y==="incorrect"&&pr("player-typed-blank-feedback--incorrect",o.wobble)),children:h||zt("span",{className:"opacity-40",children:i})}):xa(uu,{children:[zt("textarea",{ref:d,"aria-label":n.blankAnswerAria,placeholder:i,value:h,onChange:T,disabled:b,rows:1,wrap:p?"off":void 0,className:pr("player-typed-blank",p&&"player-typed-blank--cell",f&&"w-full",x&&"player-typed-blank--pending"),style:p?void 0:c!=="auto"?{width:c}:f?{width:"100%"}:{width:`${Math.max(7,h.length+1)}ch`,maxWidth:"100%"}}),!h&&!x&&!p&&zt("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"}),x&&zt("span",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:zt("span",{className:"player-typed-blank-spinner","aria-label":n.aiEvaluationInProgressAria})})]})}),b&&y==="incorrect"&&A&&xa("span",{className:"player-blank-reveal",children:["(",A,")"]}),b&&g&&zt("span",{className:pr("player-blank-feedback",y==="correct"&&"player-blank-feedback--correct",y==="partial"&&"player-blank-feedback--partial",y==="incorrect"&&"player-blank-feedback--incorrect"),children:g}),l&&l.length>0&&zt(Gt,{hint:l})]})}import{jsx as oo,Fragment as tc,jsxs as Sa}from"react/jsx-runtime";import{useEffect as rc}from"react";import ao from"clsx";import{useDroppable as Su,useDndContext as Ru}from"@dnd-kit/core";import{jsx as bu}from"react/jsx-runtime";import{createContext as yu,useCallback as Yt,useContext as vu,useEffect as xu,useMemo as Ji,useRef as wu,useState as ka}from"react";import{useDndMonitor as ku}from"@dnd-kit/core";var ec=yu(null);function _t(){let e=vu(ec);if(!e)throw new Error("usePool must be used within a PoolProvider");return e}function Zi(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 no({children:e,initialAnswers:t}){let r=Me(),n=Ji(()=>Zi(t),[t]),[o,a]=ka(n),[s,i]=ka({}),[c,l]=ka({}),d=wu(new Set);xu(()=>{let g=T=>{let C=Zi(T.answers);Object.keys(C).length!==0&&a(E=>{if(!Object.entries(C).some(([k,S])=>E[k]?.choiceId!==S.choiceId||E[k]?.poolId!==S.poolId||E[k]?.value!==S.value))return E;let M={...E,...C};return i(k=>{let S={...k};for(let[v,O]of Object.entries(k)){let _=new Set(Object.values(M).filter(w=>w.poolId===v).map(w=>w.choiceId));S[v]={...O,available:new Set(O.choices.map(w=>w.id).filter(w=>!_.has(w)))}}return S}),M})};return r.on("answers:prefill",g),()=>r.off("answers:prefill",g)},[r]);let u=Yt((g,T)=>{i(C=>{let E=C[g];if(!E){let v=new Set;for(let _ of Object.values(o))_.poolId===g&&v.add(_.choiceId);let O=new Set(T.map(_=>_.id).filter(_=>!v.has(_)));return{...C,[g]:{choices:T,available:O}}}let R=new Set(E.choices.map(v=>v.id)),M=new Set(T.map(v=>v.id));if(!(T.some(v=>!R.has(v.id))||E.choices.some(v=>!M.has(v.id))))return C;let S=new Set;for(let v of E.available)M.has(v)&&S.add(v);for(let v of T)R.has(v.id)||S.add(v.id);return{...C,[g]:{choices:T,available:S}}})},[o]),p=Yt((g,T)=>{l(C=>{let E=C[g]??[];return E.includes(T)?C:{...C,[g]:[...E,T]}}),!d.current.has(T)&&!o[T]&&(d.current.add(T),r.emit({type:"answer:changed",answer:{nodeId:T,type:"blank",timestamp:Date.now(),answer:{mode:"choice",choiceId:"",poolId:g,value:""}}}))},[o,r]),f=Yt(g=>(c[g]??[]).find(C=>!o[C])??null,[c,o]),h=Yt((g,T,C,E)=>{a(R=>{let M=R[g];return M&&i(k=>{let S=k[M.poolId];if(!S)return k;let v=new Set(S.available);return v.add(M.choiceId),{...k,[M.poolId]:{...S,available:v}}}),{...R,[g]:{choiceId:C,value:E,poolId:T}}}),i(R=>{let M=R[T];if(!M)return R;let k=new Set(M.available);return k.delete(C),{...R,[T]:{...M,available:k}}}),r.emit({type:"answer:changed",answer:{nodeId:g,type:"blank",timestamp:Date.now(),answer:{mode:"choice",choiceId:C,poolId:T,value:E}}})},[r]),m=Yt(g=>{let T=o[g];if(!T)return;let{poolId:C,choiceId:E}=T;i(R=>{let M=R[C];if(!M)return R;let k=new Set(M.available);return k.add(E),{...R,[C]:{...M,available:k}}}),a(R=>{let{[g]:M,...k}=R;return k}),r.emit({type:"answer:changed",answer:{nodeId:g,type:"blank",timestamp:Date.now(),answer:{mode:"choice",choiceId:"",poolId:C,value:""}}})},[o,r]),b=Yt((g,T)=>s[g]?.available.has(T)??!1,[s]),y=Yt((g,T)=>s[g]?.choices.find(C=>C.id===T),[s]),x=Yt(()=>{a({}),i(g=>{let T={};for(let[C,E]of Object.entries(g))T[C]={choices:E.choices,available:new Set(E.choices.map(R=>R.id))};return T});for(let[g,T]of Object.entries(c))for(let C of T)r.emit({type:"answer:changed",answer:{nodeId:C,type:"blank",timestamp:Date.now(),answer:{mode:"choice",choiceId:"",poolId:g,value:""}}})},[c,r]);ku({onDragEnd(g){window.dispatchEvent(new CustomEvent("dnd-drop",{detail:{active:g.active,over:g.over}}))}});let A=Ji(()=>({blanks:o,pools:s,registerPool:u,registerBlank:p,fill:h,back:m,isAvailable:b,getChoice:y,firstEmptyBlank:f,resetAllAnswers:x}),[o,s,u,p,h,m,b,y,f,x]);return bu(ec.Provider,{value:A,children:e})}function Gn({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:u}=_t(),p=me(),f=dr(),h=i[r],m=!!h?.choiceId,b=t?.showFeedback??!1,y=t?.state,x=t?.correctChoiceIds??[],A=b&&y==="incorrect"&&x.length>0?d(o||"",x[0]):void 0,g=A?A.html.replace(/<\/?[^>]+(>|$)/g,""):void 0,{setNodeRef:T,isOver:C}=Su({id:r,data:{type:"blank",blankId:r,poolId:o}}),{active:E}=Ru(),R=!!E&&E.data.current?.poolId===o;return rc(()=>{u(o||"",r)},[o,r,u]),rc(()=>{let S=v=>{let O=v,{active:_,over:w}=O.detail||{};if(!w||w.id!==r)return;let{choiceId:X,poolId:Y}=_?.data.current||{};if(!X||Y!==o)return;let F=d(o||"",X);if(!F)return;let L=F.html.replace(/<\/?[^>]+(>|$)/g,"");c(r,o||"",X,L)};return window.addEventListener("dnd-drop",S),()=>window.removeEventListener("dnd-drop",S)},[r,o,d,c]),Sa(tc,{children:[oo("span",{ref:T,onClick:()=>{m&&!b&&l(r)},className:ao("player-choice-blank",C&&"player-choice-blank--over",!C&&R&&!m&&!b&&"player-choice-blank--target",m&&!b&&!C&&"player-choice-blank--filled",b&&y==="correct"&&ao("player-choice-blank--correct",f.hop),b&&y==="partial"&&ao("player-choice-blank--partial",f.hop),b&&y==="incorrect"&&ao("player-choice-blank--incorrect",f.wobble)),title:m&&!b?p.clickToRemove:void 0,"data-node-id":r,"data-pool-id":o,children:m?Sa(tc,{children:[oo("span",{children:h.value}),!b&&oo("span",{className:"player-choice-blank__clear",children:"\xD7"})]}):a}),g&&Sa("span",{className:"player-blank-reveal",children:["(",g,")"]}),oo(Tt,{hint:s})]})}import{jsx as Ca,jsxs as Mu}from"react/jsx-runtime";import{useEffect as pc,useRef as Eu,useState as Lu}from"react";import Iu from"clsx";import{jsx as dc,jsxs as Au}from"react/jsx-runtime";import Tu from"clsx";import{useDraggable as _u}from"@dnd-kit/core";import{jsx as ur,jsxs as nc}from"react/jsx-runtime";import{useEffect as oc,useState as ac}from"react";import Pu from"clsx";var sc="edpire:tap-hint-placed",ic=2;function Cu(e){let r=(()=>{try{return Number(e?.getItem(sc))||0}catch{return 0}})(),n=new Set,o=new Set,a=()=>n.forEach(s=>s());return{done:()=>r>=ic,placed:()=>r,recordPlacement(){if(!(r>=ic)){r+=1;try{e?.setItem(sc,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 Ra=null;function Pa(){if(!Ra){let e=null;try{e=typeof window<"u"?window.localStorage:null}catch{e=null}Ra=Cu(e)}return Ra}function cc(){typeof window>"u"||Pa().recordPlacement()}function Nu(){try{return window.matchMedia("(hover: none) and (pointer: coarse)").matches}catch{return!1}}function so(e,t){let[,r]=ac(0),[n,o]=ac(!1);if(oc(()=>{o(Nu())},[]),oc(()=>{let s=e.current;if(!n||!s)return;let i=Pa();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 u of d)i.setOnScreen(s,u.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=Pa();return!a.done()&&a.owner()===e.current}function lc(){let{motion:e}=Je();return nc("span",{className:Pu("player-tap-hint",e==="none"&&"player-tap-hint--still"),"aria-hidden":"true",children:[ur("span",{className:"player-tap-hint__ripple"}),ur("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)=>nc("g",{...t,children:[ur("path",{d:"M22 14a8 8 0 0 1-8 8"}),ur("path",{d:"M18 11v-1a2 2 0 0 0-2-2a2 2 0 0 0-2 2"}),ur("path",{d:"M14 10V9a2 2 0 0 0-2-2a2 2 0 0 0-2 2v1"}),ur("path",{d:"M10 9.5V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v10"}),ur("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 _r({poolId:e,data:t,isInline:r=!1,tapHint:n=!1}){let{isAvailable:o,firstEmptyBlank:a,fill:s}=_t(),{id:i,html:c}=t,l=!o(e,i),{setNodeRef:d,attributes:u,listeners:p,transform:f,isDragging:h}=_u({id:i,data:{type:"choice",choiceId:i,poolId:e,html:c},disabled:l});if(l)return null;let m=A=>A.replace(/<\/?[^>]+(>|$)/g,""),b=()=>{let A=a(e);if(A){let g=m(c);s(A,e,i,g),cc()}},y=f?{transform:`translate3d(${f.x}px, ${f.y}px, 0)`}:void 0;return Au(r?"span":"div",{ref:d,style:y,className:Tu("player-bank-pill",h&&"player-bank-pill--dragging",n&&!h&&"player-bank-pill--hinted",r&&"mx-1"),...u,...p,onClick:b,children:[dc("span",{dangerouslySetInnerHTML:{__html:c},className:"pointer-events-none whitespace-pre-wrap break-words"}),n&&!h&&dc(lc,{})]})}function Yn({node:e}){let t=me(),{id:r,attrs:n,content:o}=e,{shuffle:a=!0,equalWidth:s=!1}=n,{registerPool:i,isAvailable:c}=_t(),l=Eu(null),[d,u]=Lu(()=>o.map(h=>({id:h.id,html:Se(h.content)})));pc(()=>{let h=o.map(m=>({id:m.id,html:Se(m.content)}));u(a?[...h].map(m=>({v:m,r:Math.random()})).sort((m,b)=>m.r-b.r).map(m=>m.v):h)},[a,JSON.stringify(o)]),pc(()=>{i(r,d)},[r,d,i]);let p=d.find(h=>c(r,h.id))?.id,f=so(l,p!==void 0);return Mu("div",{ref:l,className:"player-word-bank",children:[Ca("div",{className:"player-word-bank__label",children:t.wordBank}),Ca("div",{className:Iu("player-word-bank__items",s&&"player-word-bank__items--grid"),children:d.map(h=>Ca(_r,{poolId:r,data:h,tapHint:f&&h.id===p},h.id))})]})}import{jsx as Na,jsxs as $u}from"react/jsx-runtime";import{useEffect as uc,useRef as zu,useState as Fu}from"react";function Qn({node:e}){let{id:t,attrs:r,content:n}=e,{shuffle:o=!0,separator:a=" "}=r,{registerPool:s,isAvailable:i}=_t(),c=zu(null),[l,d]=Fu(()=>n.map(f=>({id:f.id,html:Se(f.content,{stripParagraphs:!0})})));uc(()=>{let f=n.map(h=>({id:h.id,html:Se(h.content,{stripParagraphs:!0})}));d(o?[...f].map(h=>({v:h,r:Math.random()})).sort((h,m)=>h.r-m.r).map(h=>h.v):f)},[o,JSON.stringify(n)]),uc(()=>{s(t,l)},[t,l,s]);let u=l.find(f=>i(t,f.id))?.id,p=so(c,u!==void 0);return Na("span",{ref:c,style:{display:"inline-flex",flexWrap:"wrap",gap:V("0.25rem"),alignItems:"center"},children:l.map((f,h)=>$u("span",{children:[Na(_r,{poolId:t,data:f,isInline:!0,tapHint:p&&f.id===u}),h<l.length-1&&Na("span",{children:a})]},f.id))})}import{jsx as Mr,jsxs as _a}from"react/jsx-runtime";import{useState as Ma,useEffect as Ea,useMemo as ju}from"react";import{Check as qu,X as Hu}from"lucide-react";import{jsx as qe,jsxs as mr}from"react/jsx-runtime";import{useState as Aa,useMemo as Ta,useRef as io,useCallback as Du,useLayoutEffect as Ou}from"react";var mc="#1d2025",hc="#8d93a0",fc="#1f8a4c",gc="#d23b2b",Bu=11;function bc({leftItems:e,rightItems:t,connections:r,direction:n,disabled:o,feedback:a,onConnectionsChange:s}){let[i,c]=Aa(null),[l,d]=Aa(null),[u,p]=Aa(new Map),f=io(null),h=io(new Map),m=io("mouse"),b=a?.showFeedback??!1,y=Ta(()=>{let N=new Map;if(a?.pairFeedback)for(let P of a.pairFeedback)N.set(`${P.leftId}-${P.rightId}`,P.correct);return N},[a]),x=Ta(()=>{let N=new Map;return a?.correctPairings?.forEach(P=>N.set(P.leftId,P.rightId)),N},[a]),A=Ta(()=>{let N=new Map;return a?.correctPairings?.forEach(P=>N.set(P.rightId,P.leftId)),N},[a]),g=new Map,T=new Map;r.forEach((N,P)=>{g.set(N.leftId,P),T.set(N.rightId,P)});let C=N=>{let P=r[N];if(!b||!P)return null;let K=y.get(`${P.leftId}-${P.rightId}`);return K===!0?"correct":K===!1?"incorrect":null},E=Du(()=>{if(!f.current)return;let N=f.current.getBoundingClientRect(),P=new Map;h.current.forEach((K,U)=>{if(K){let j=K.getBoundingClientRect();P.set(U,new DOMRect(j.left-N.left,j.top-N.top,j.width,j.height))}}),p(P)},[]);Ou(()=>{E();let N=new ResizeObserver(E);return f.current&&N.observe(f.current),()=>N.disconnect()},[E,r,e,t]);let R=8,M=(N,P)=>{let K=u.get(N);if(!K)return null;let U=K.y+K.height/2;return P==="left"?{x:K.x+K.width,y:U}:{x:K.x-R,y:U}},k=(N,P)=>{if(o)return;let U=(P==="left"?g:T).has(N),j=i?.id===N&&i?.side===P,de=i!==null&&i.side!==P;if(j){c(null);return}if(de){let z=P==="right"?i.id:N,W=P==="left"?i.id:N,le=r.filter(I=>I.leftId!==z&&I.rightId!==W);le.push({leftId:z,rightId:W}),s(le),c(null);return}if(U&&!i){let z=P==="left"?r.filter(W=>W.leftId!==N):r.filter(W=>W.rightId!==N);s(z);return}c({id:N,side:P})},S=io(null),v=(N,P,K)=>{if(o||(m.current=K.pointerType,K.pointerType==="touch"))return;K.currentTarget.setPointerCapture(K.pointerId);let U=f.current.getBoundingClientRect();S.current={x:K.clientX-U.left,y:K.clientY-U.top},d({fromId:N,fromSide:P,x:K.clientX-U.left,y:K.clientY-U.top,overId:null,overSide:null})},O=N=>{if(!l)return;let P=f.current.getBoundingClientRect(),K=N.clientX-P.left,U=N.clientY-P.top,j=l.fromSide==="left"?"right":"left",de=j==="left"?e:t,z=null,W=null;for(let le of de){let I=u.get(le.id);if(I&&K>=I.x&&K<=I.x+I.width&&U>=I.y&&U<=I.y+I.height){z=le.id,W=j;break}}d(le=>le?{...le,x:K,y:U,overId:z,overSide:W}:null)},_=N=>{if(!l)return;let P=f.current.getBoundingClientRect(),K=N.clientX-P.left,U=N.clientY-P.top,j=S.current;if((j?Math.hypot(K-j.x,U-j.y):999)<8){d(null),k(l.fromId,l.fromSide);return}if(l.overId&&l.overSide){let z=l.fromSide==="left"?l.fromId:l.overId,W=l.fromSide==="right"?l.fromId:l.overId,le=r.filter(I=>I.leftId!==z&&I.rightId!==W);le.push({leftId:z,rightId:W}),s(le)}d(null),c(null)},w=(N,P)=>{if(!b)return null;let U=(P==="left"?g:T).get(N.id);if(U!==void 0){let j=r[U];if(y.get(`${j.leftId}-${j.rightId}`)===!0)return null}if(P==="left"){let j=x.get(N.id);return t.find(de=>de.id===j)?.content??null}else{let j=A.get(N.id);return e.find(de=>de.id===j)?.content??null}},X=(N,P)=>{let U=(P==="left"?g:T).get(N.id),j=U!==void 0,de=i?.id===N.id&&i?.side===P,z=i!==null&&i.side!==P&&!j,W=l?.overId===N.id&&l?.overSide===P,le=j?C(U):null,I=j?U+1:null,G="matching-player__item";j&&(G+=" matching-player__item--matched"),le==="correct"&&(G+=" matching-player__item--correct"),le==="incorrect"&&(G+=" matching-player__item--incorrect"),de&&(G+=" matching-player__item--selected"),(z||W)&&(G+=" matching-player__item--available"),o&&(G+=" matching-player__item--disabled");let re=w(N,P);return mr("button",{ref:ne=>{ne?h.current.set(N.id,ne):h.current.delete(N.id)},type:"button",className:G,onPointerDown:ne=>v(N.id,P,ne),onClick:()=>{m.current==="touch"&&k(N.id,P)},"aria-pressed":de,children:[P==="right"&&qe("span",{className:"matching-player__connector matching-player__connector--right","aria-hidden":!0,children:mr("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:[qe("circle",{cx:"9",cy:"9",r:"8",stroke:"currentColor",strokeWidth:"1.5",fill:"currentColor",fillOpacity:"0.08"}),qe("path",{d:"M12 9H6M8.5 6.5L6 9l2.5 2.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}),j&&P==="left"&&qe("span",{className:"matching-player__pair-num","aria-hidden":!0,children:I}),qe("span",{className:"matching-player__item-text",dangerouslySetInnerHTML:{__html:Se(N.content)}}),re&&mr("span",{className:"matching-player__correct-hint",children:["(",qe("span",{dangerouslySetInnerHTML:{__html:Se(re)}}),")"]}),j&&P==="right"&&qe("span",{className:"matching-player__pair-num","aria-hidden":!0,children:I}),P==="left"&&qe("span",{className:"matching-player__connector matching-player__connector--left","aria-hidden":!0,children:mr("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:[qe("circle",{cx:"9",cy:"9",r:"8",stroke:"currentColor",strokeWidth:"1.5",fill:"currentColor",fillOpacity:"0.08"}),qe("path",{d:"M6 9h6M9.5 6.5L12 9l-2.5 2.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})})]},N.id)},Y=n==="ltr"?e:t,F=n==="ltr"?t:e,L=n==="ltr"?"left":"right",B=n==="ltr"?"right":"left";return mr("div",{ref:f,className:`matching-player__arena${l?" matching-player__arena--dragging":""}`,onPointerMove:O,onPointerUp:_,children:[mr("svg",{className:"matching-player__svg","aria-hidden":!0,children:[qe("defs",{children:[["mp-arrow-ink",mc],["mp-arrow-correct",fc],["mp-arrow-incorrect",gc],["mp-arrow-ghost",hc]].map(([N,P])=>qe("marker",{id:N,markerUnits:"userSpaceOnUse",markerWidth:"11",markerHeight:"9",refX:"0",refY:"4.5",orient:"auto",children:qe("polygon",{points:"0 0, 11 4.5, 0 9",fill:P})},N))}),r.map(N=>{let P=M(N.leftId,"left"),K=M(N.rightId,"right");if(!P||!K)return null;let U=K.x-Bu,j=Math.max(16,Math.abs(U-P.x)*.4),de=`M ${P.x} ${P.y} C ${P.x+j} ${P.y}, ${U-j} ${K.y}, ${U} ${K.y}`,z=b?y.get(`${N.leftId}-${N.rightId}`):void 0;return qe("path",{d:de,stroke:z===!0?fc:z===!1?gc:mc,strokeWidth:"2.5",fill:"none",markerEnd:`url(#${z===!0?"mp-arrow-correct":z===!1?"mp-arrow-incorrect":"mp-arrow-ink"})`},`${N.leftId}-${N.rightId}`)}),l&&(()=>{let N=M(l.fromId,l.fromSide);if(!N)return null;let P=Math.abs(l.x-N.x)*.35,K=`M ${N.x} ${N.y} C ${N.x+P} ${N.y}, ${l.x-P} ${l.y}, ${l.x} ${l.y}`;return qe("path",{d:K,stroke:hc,strokeWidth:"2",strokeDasharray:"6 4",fill:"none",markerEnd:"url(#mp-arrow-ghost)"})})()]}),mr("div",{className:"matching-player__columns",children:[qe("div",{className:"matching-player__column",children:Y.map(N=>X(N,L))}),qe("div",{className:"matching-player__column",children:F.map(N=>X(N,B))})]})]})}var yc=e=>Number.isInteger(e)?String(e):e.toFixed(2);function vc(e){return[...e].map(t=>({v:t,r:Math.random()})).sort((t,r)=>t.r-r.r).map(t=>t.v)}function Xn({node:e,validationFeedback:t}){let r=Me(),{shuffleSeed:n,layoutBy:o}=Je(),{id:a,attrs:s,leftItems:i,rightItems:c}=e,{direction:l,shuffle:d,hint:u}=s,p=JSON.stringify(i),f=JSON.stringify(c),h=d&&n!==void 0,m=ju(()=>h?{left:sn(i,`${n}:${a}:left`),right:sn(c,`${n}:${a}:right`)}:null,[h,n,a,p,f]),[b,y]=Ma(i),[x,A]=Ma(c);Ea(()=>{h||(d?(y(vc(i)),A(vc(c))):(y(i),A(c)))},[d,h,p,f]);let g=m?.left??b,T=m?.right??x,[C,E]=Ma([]),R=t?.showFeedback??!1;Ea(()=>{let _=w=>{let Y=w.answers.find(F=>F.nodeId===a&&F.type==="matchingSet");Y&&"connections"in Y.answer&&E(Y.answer.connections)};return r.on("answers:prefill",_),()=>r.off("answers:prefill",_)},[r,a]),Ea(()=>{r.emit({type:"answer:changed",answer:{nodeId:a,type:"matchingSet",timestamp:Date.now(),answer:{connections:C}}})},[r,a,C]);let M=_=>{R||E(_)},k=t?.score,S=t?.maxScore,v=R&&k!=null&&S!=null,O=v?k>=S?"correct":k>0?"partial":"incorrect":null;return _a("div",{className:o==="box"?"matching-player matching-player--box":"matching-player",children:[u&&u.length>0&&Mr("div",{className:"matching-player-hintrow",children:Mr(Tt,{hint:u})}),Mr(bc,{leftItems:g,rightItems:T,connections:C,direction:l,disabled:R,feedback:t,onConnectionsChange:M}),v&&_a("div",{className:"matching-player-feedback matching-player-feedback--"+O,children:[O==="correct"&&Mr(qu,{size:15,style:Ee(15)}),O==="incorrect"&&Mr(Hu,{size:15,style:Ee(15)}),Mr("span",{children:O==="correct"?"All matched":O==="partial"?"Partial credit":"Not matched"}),_a("span",{className:"matching-player-score",children:[yc(k)," / ",yc(S)]})]})]})}import{jsx as Ke,jsxs as wt,Fragment as Ul}from"react/jsx-runtime";import{useState as Kl,useEffect as Ns,useRef as Wl,useCallback as As}from"react";import Hr from"clsx";import{jsx as et,jsxs as jt,Fragment as Ol}from"react/jsx-runtime";import{useCallback as Bl,useEffect as jl,useMemo as Wh,useRef as wn,useState as er}from"react";import kn from"clsx";import{Camera as Vh,NotebookPen as Gh,PenLine as Yh}from"lucide-react";var Uu=["unreadable","limit","busy","network","cut","failed"];function cn(e){let t=e instanceof Error?e.message:"";return Uu.includes(t)?t:"failed"}function Ft(e){return!!e?.uploadPhoto&&!!e.readPages}function La(e){return Ft(e)||!!e?.transcribePhotos}import{jsx as vt,jsxs as vr}from"react/jsx-runtime";import{forwardRef as Vm,useEffect as yr,useImperativeHandle as Gm,useRef as yn,useState as Ym}from"react";import ol from"clsx";import{Keyboard as Qm}from"lucide-react";import{useEditor as Xm,EditorContent as Jm}from"@tiptap/react";import{Extension as Zm}from"@tiptap/core";import{Fragment as eh,Slice as th}from"@tiptap/pm/model";import{Selection as al}from"@tiptap/pm/state";import rh from"@tiptap/starter-kit";import{Placeholder as nh}from"@tiptap/extensions";var xc,Er={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:{}},Ia=null;function wc(e){Ia=e}var Ku=150,Wu=80,co=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()},Wu),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&&Ia&&typeof document<"u"&&(this.view=Ia(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()},Ku)}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))}},Vu=typeof window<"u",Le=Vu?(xc=window).__edpMathInputV1??(xc.__edpMathInputV1=new co):new co;import{Node as _c,mergeAttributes as Mc}from"@tiptap/core";import{Fragment as Qu}from"@tiptap/pm/model";import{TextSelection as Rc}from"@tiptap/pm/state";function Gu(e){let t=/^\\left\(([\s\S]*)\\right[).]$/.exec(e);if(!t)return null;let r=0;for(let n of t[1].matchAll(/\\(left|right)(?![a-zA-Z])/g))if(r+=n[1]==="left"?1:-1,r<0)return null;return r===0?t[1]:null}function Yu(e,t){return/^\\[dt]?frac(?![a-zA-Z])|^\\sqrt(?![a-zA-Z])|^[\^_]\{/.test(e)||e.includes(`^{${t}}`)||e.includes(`_{${t}}`)}function Lr(e){let t=e,r=t.executeCommand,n=t.getElementInfo;if(typeof r!="function"||typeof n!="function"||typeof t.getValue!="function")return!1;let o=t.position;if(o==null||t.selectionIsCollapsed===!1||(n.call(t,o)?.depth??0)<1)return!1;let a=()=>(t.position=o,!1),s=h=>r.call(t,h);if(s("moveToGroupEnd"),t.position!==o)return a();s("moveAfterParent");let i=t.position;if(i==null||i===o)return a();let c=n.call(t,i),l=c?.latex??"",d=Gu(l);if(d==null||(c?.depth??0)<1||(s("moveToGroupEnd"),t.position!==i))return a();s("extendToGroupStart");let u=t.selection?.ranges,p=u?.[0]?Math.min(u[0][0],u[0][1]):i;if(t.position=i,p===i||t.getValue(p,i)!==l)return a();s("moveAfterParent");let f=t.position;return f==null||f===i||!Yu(n.call(t,f)?.latex??"",l)?a():(t.selection={ranges:[[p,i]]},s(["insert",d,{selectionMode:"after"}]),s("moveAfterParent"),!0)}var kc=new WeakSet;function Sc(e){let t=e;if(!t||typeof t.addEventListener!="function"||kc.has(t))return;kc.add(t);let r=n=>{n.preventDefault(),n.stopImmediatePropagation()};t.addEventListener("keydown",n=>{let o=n;o.key!==")"||o.ctrlKey||o.metaKey||o.altKey||o.isComposing||o.defaultPrevented||Lr(e)&&r(o)},!0),t.addEventListener("beforeinput",n=>{let o=n;o.inputType!=="insertText"||o.data!==")"||o.defaultPrevented||Lr(e)&&r(o)},!0)}var Oa={ownLine:!1,centred:!1,onOpenWindow:null,chip:!1};function Xu(e){return e.storage.mathTyping?.chip??{unwrap:"Back to text",ownLine:"On its own line"}}function Pc(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 Cc(e){let t=!1;return e.forEach(r=>{(!r.isText||(r.text??"").trim())&&(t=!0)}),t}var Ju={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 ln(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 $a=e=>e.length>1&&!/^[\dA-Za-zπ.,]+$/.test(e)&&!/^\(.*\)$/.test(e)?`(${e})`:e;function hr(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]=ln(n,r),[c,l]=ln(n,i);t+=`${$a(hr(s))}/${$a(hr(c))}`,r=l}else if(a==="sqrt"){let[s,i]=ln(n,r);t+=`sqrt(${hr(s)})`,r=i}else if(a==="text"||a==="mathrm"||a==="operatorname"){let[s,i]=ln(n,r);t+=s,r=i}else a===","||a===" "||a===";"||a==="quad"?t+=" ":a==="{"||a==="}"?t+=a:t+=Ju[a]??a}else if(o==="^"||o==="_"){let[a,s]=ln(n,r+1);t+=`${o}${$a(hr(a))}`,r=s}else o==="{"||o==="}"||o===" "||(t+=o),r++}return t}function lo(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(Rc.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(Rc.create(s.doc,t+r.length))}function Ec(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 f=n.nodes.paragraph.create(null,n.nodes.inlineMath.create(o));return e.tr.replaceWith(t,t+r.nodeSize,f)}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=Pc(s.cut(0,i),"end"),l=Pc(s.cut(i+r.nodeSize),"start"),d=[...Cc(c.content)?[c]:[],n.nodes.blockMath.create(o),...Cc(l.content)?[l]:[]],u=a.node(a.depth-1),p=a.index(a.depth-1);return u.canReplace(p,p+1,Qu.from(d))?e.tr.replaceWith(a.before(),a.after(),d):null}var za=null,Ba=!1,Fa=null;function yt(){return za||(za=import("mathlive").then(e=>(e.MathfieldElement.soundsDirectory=null,Fa=e.convertAsciiMathToLatex??null,Ba=!0,document.addEventListener("focusin",t=>{let r=t.target;r?.tagName==="MATH-FIELD"&&Le.targetOf(r)&&Xt(r)},!0),!0)).catch(()=>!1)),za}function Lc(e){try{return Fa?Fa(e):null}catch{return null}}function Xt(e){let t=e;if(t){try{t.mathVirtualKeyboardPolicy!=="manual"&&(t.mathVirtualKeyboardPolicy="manual"),t.menuItems=[]}catch{}Sc(t),Zu()&&(em(t),rm(t))}}function Zu(){return typeof matchMedia=="function"&&matchMedia("(pointer: coarse)").matches}var Nc=new WeakSet;function em(e){let t=e.shadowRoot,r=t?.querySelector(".ML__keyboard-sink");if(!t||!r||Nc.has(r)||typeof MutationObserver>"u"||typeof getSelection!="function")return;Nc.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 Ac=new WeakSet,tm={deleteContentBackward:"Backspace",deleteContentForward:"Delete"};function rm(e){let t=e;if(!t.shadowRoot||typeof t.addEventListener!="function"||Ac.has(t)||typeof KeyboardEvent!="function")return;Ac.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=tm[s.inputType];!i||r||s.defaultPrevented||performance.now()-n<100||(s.preventDefault(),s.stopImmediatePropagation(),o(i))},!0)}function po(e){let t=e;try{t?.hasFocus?.()&&t.blur?.()}catch{}}function uo(){return Ba}var Ir=new WeakMap,Qt={el:null};function fr(e){return e.shadowRoot?.querySelector(".ML__keyboard-sink")??null}var pn=new WeakMap,dn={el:null},nm=/(=|\+|-|\\times|\\cdot|\\le|\\ge|\\ne|\\in|\\lt|\\gt|<|>|\(|\\left\()\s*$/,om=/([.,;:])$/;function gr(e,t,r,n,o){let a=0,s=()=>{let c=e.nodeDOM(t)?.querySelector?.("math-field");if(c&&typeof c.executeCommand=="function"){n&&Ir.set(c,n);let l=fr(c);l&&Le.prepareInput(l),c.focus(),l&&l.focus({preventScroll:!0}),document.activeElement!==c&&(dn.el=c,c.addEventListener("focus",()=>dn.el===c&&(dn.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 Dt(e){e.view.focus()}function Tc(e,t,r){let n=e.chain().setTextSelection(t);r&&n.insertContent(r),n.run(),Dt(e)}var Da=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={...Oa,...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&&Ba){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?Fe(r,!1):"",this.dom.append(t),this.editable&&yt().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"),Xt(t),t.setAttribute("smart-fence","on"),t.value=this.latex;let r=this.options.chip?[this.chip()]:[];if(this.isLine&&this.options.centred){let m=document.createElement("span");m.className="edp-sheet-line-box",m.append(t,...r),this.dom.append(m)}else this.dom.append(t,...r);Xt(t),this.field=t;let n=this.editor,o=()=>this.getPos(),a=m=>{let b=o();b!=null&&Tc(n,b+this.node.nodeSize,m)},s=()=>{let m=o();m!=null&&Tc(n,m)},i=()=>{let m=o();m!=null&&n.view.dispatch(n.state.tr.delete(m,m+this.node.nodeSize))},c=()=>t.position===t.lastOffset,l=()=>{Ir.delete(t),this.echoed=t.value;let m=o();m!=null&&n.view.dispatch(n.state.tr.setNodeMarkup(m,void 0,{...this.node.attrs,latex:t.value}))},d=()=>{Qt.el=t,Xt(t)},u=()=>{Le.isSwitching()||(Qt.el===t&&(Qt.el=null),setTimeout(()=>{!t.value&&t.isConnected&&document.activeElement!==t&&n.isEditable&&i()},0))},p=()=>{let m=o();m!=null&&(n.chain().setTextSelection(m+this.node.nodeSize).splitBlock().run(),Dt(n))};pn.set(t,{enter:p,removeEmpty:()=>{s(),i()},leave:m=>m==="before"?s():a(),pos:o});let f=m=>{let b=m.detail?.direction;b==="backward"||b==="upward"?s():a()},h=m=>{if(m.key===" "&&!m.ctrlKey&&!m.metaKey){m.preventDefault(),m.stopPropagation(),Ir.delete(t);let b=t.position;if(t.executeCommand?.("moveAfterParent"),t.position!==b)return;if(!c()){t.position=t.lastOffset??t.position;return}if(!t.value||nm.test(t.value))return;let y=t.value.match(om)?.[1],x=o();if(y&&x!=null&&t.value.length>1){let A=t.value.slice(0,-1);t.value=A,this.echoed=A,n.view.dispatch(n.state.tr.setNodeMarkup(x,void 0,{...this.node.attrs,latex:A})),a(`${y} `);return}a(" ")}else if((m.ctrlKey||m.metaKey)&&m.key.toLowerCase()==="z"&&!m.shiftKey&&Ir.has(t)){m.preventDefault(),m.stopPropagation();let b=Ir.get(t)??[];Ir.delete(t);let y=o();if(y==null)return;n.chain().insertContentAt({from:y,to:y+this.node.nodeSize},b).run(),Dt(n)}else m.key==="Enter"?(m.preventDefault(),m.stopPropagation(),p()):m.key==="Backspace"&&!t.value?(m.preventDefault(),m.stopPropagation(),s(),i()):m.key==="Escape"&&(m.preventDefault(),a())};t.addEventListener("input",l),t.addEventListener("focus",d),t.addEventListener("focusout",u),t.addEventListener("move-out",f),t.addEventListener("keydown",h,!0),this.fieldCleanup=()=>{pn.delete(t),t.removeEventListener("input",l),t.removeEventListener("focus",d),t.removeEventListener("focusout",u),t.removeEventListener("move-out",f),t.removeEventListener("keydown",h,!0),Qt.el===t&&(Qt.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=Xu(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 hr(this.field?.value??this.latex)}unwrap(){let t=this.getPos();if(t==null)return;let r=lo(this.editor.state,t,this.plainText());r&&(this.editor.view.dispatch(r),Dt(this.editor))}toggleLine(){let t=this.getPos();if(t==null)return;let r=Ec(this.editor.state,t);r&&this.editor.view.dispatch(r)}dropField(){po(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()}},Ic=e=>new Da(e),ja=_c.create({name:"inlineMath",addOptions(){return{...Oa}},group:"inline",inline:!0,atom:!0,selectable:!0,addAttributes(){return{latex:{default:""}}},parseHTML(){return[{tag:"span[data-inline-math]"}]},renderHTML({HTMLAttributes:e}){return["span",Mc(e,{"data-inline-math":""})]},addNodeView(){return Ic}}),qa=_c.create({name:"blockMath",addOptions(){return{...Oa}},group:"block",atom:!0,selectable:!0,addAttributes(){return{latex:{default:""}}},parseHTML(){return[{tag:"div[data-block-math]"}]},renderHTML({HTMLAttributes:e}){return["div",Mc(e,{"data-block-math":""})]},addNodeView(){return Ic}});import{Extension as Nm}from"@tiptap/core";import{NodeSelection as Uc,Plugin as Am,PluginKey as Tm,Selection as _m,TextSelection as Mm}from"@tiptap/pm/state";var mo="\\placeholder{}",am=/[A-Za-z0-9.,()[\]π²³+\-*×·−_'∘∩∪]/,Fc=/^[+\-−*×·=/^)]/,sm=/[+\-−*×·=(]$/,Ha={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}"},Dc=new RegExp(`(^|[^A-Za-z])(${Object.keys(Ha).join("|")})(?=\\()`,"g"),im=new RegExp(`(?:${Object.keys(Ha).join("|")}|[A-Za-z]'*)$`),cm=e=>/[A-Za-z]{2,}/.test(e.replace(Dc,"$1").replace(/\([^()]*\)/g,""));function $c(e){let t=e.endsWith(" ")?e.length-1:e.length,r="",n=null;for(;t>0;){let o=t;for(;o>0&&am.test(e[o-1]);)o--;let a=e.slice(o,t);if(!a||cm(a)||n!==null&&!(sm.test(a)||Fc.test(n))||(r=e.slice(o),n=a,o<2||e[o-1]!==" "))break;t=o-1}return r}function lm(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(im);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 un(e){return e.replace(Dc,(t,r,n)=>`${r}${Ha[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 dm=e=>/[\d²³]|[+\-*×·−()]/.test(e)||/^[A-Za-zπ](\([^()]*\))?$/.test(e);function zc(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===""||Fc.test(o)?n[0].length:0}function Ua(e,t){if(t==="t"&&/(^|[^A-Za-z])sqr$/.test(e))return{take:3,latex:`\\sqrt{${mo}}`,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=$c(e),n=r?lm(r):null;if(!r||!n||t==="_"&&!/^[A-Za-z]$/.test(n))return null;let o=un(r.slice(0,r.length-n.length)),a=un(t==="/"&&n.startsWith("(")?n.slice(1,-1):n),s=t==="^"?`${o}${a}^{${mo}}`:t==="_"?`${o}${a}_{${mo}}`:`${o}\\frac{${a}}{${mo}}`,i=zc(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=$c(n),a=zc(n,o),s=r==="<"?"\\le ":r===">"?"\\ge ":r==="!"?"\\ne ":"=";return!r&&!a&&(!o.trim()||!dm(o.trim()))?null:{take:o.length+a+(r?1:0),latex:`${un(o)}${s}`,placeholder:!1,merge:a>0}}return null}function Oc(e){return e.replace(/\\placeholder(\[[^\]]*\])?\{\}/g,"")}import{TextSelection as pm}from"@tiptap/pm/state";var Bc=2;function um(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-Bc||t>c.bottom+Bc||(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 mm="inlineMath";function hm(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===mm){let u=e.nodeDOM(d);u instanceof HTMLElement&&(s.push({kind:"formula",box:u.getBoundingClientRect()}),i.push(d+c.nodeSize));return}if(!(!c.isText||!c.text))for(let u of c.text.matchAll(/\S+/g)){let p=e.domAtPos(d+(u.index??0)),f=e.domAtPos(d+(u.index??0)+u[0].length),h=document.createRange();try{h.setStart(p.node,p.offset),h.setEnd(f.node,f.offset)}catch{continue}for(let m of Array.from(h.getClientRects()))s.push({kind:"text",box:m}),i.push(-1)}}),{pieces:s,after:i,end:r.end(),dom:a}}function Ka(e,t,r){if(!e.editable)return!1;let n=e.posAtCoords({left:t,top:r});if(!n)return!1;let o=hm(e,n.pos);if(!o)return!1;let a=getComputedStyle(o.dom).direction==="rtl"?"rtl":"ltr",s=um(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(pm.create(e.state.doc,i)).scrollIntoView()),e.focus(),!0}function Wa(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 ho=(e,t)=>`\\begin{pmatrix}${Array.from({length:e},()=>Array.from({length:t},()=>"#?").join("&")).join("\\\\")}\\end{pmatrix}`,jc=e=>`\\begin{vmatrix}${Array.from({length:e},()=>Array.from({length:e},()=>"#?").join("&")).join("\\\\")}\\end{vmatrix}`,qc=e=>`\\begin{cases}${Array.from({length:e},()=>"#?").join("\\\\")}\\end{cases}`,Jt=(e,t)=>`\\begin{${t}}${e}\\end{${t}}`,ge="\\square",He={lim:"\\lim\\limits_{x\\to#?}#?",matrix2:ho(2,2),matrix3:ho(3,3),column2:ho(2,1),column3:ho(3,1),det2:jc(2),det3:jc(3),system2:qc(2),system3:qc(3),identity3:"I_3",inverse:"#@^{-1}",openInterval:"\\rbrack #?;#?\\lbrack",closedInterval:"\\lbrack #?;#?\\rbrack",set:"\\lbrace #?\\rbrace",integral:"\\int_{#?}^{#?}#?\\,\\mathrm{d}x",sum:"\\sum_{#?}^{#?}#?"},Q=(e,t,r,n)=>({id:e,face:r??t,action:{kind:"insert",latex:t},...n}),ae=(e,t)=>({id:`char:${e}`,face:e,text:!0,action:{kind:"insert",latex:t??e}}),fo=(e,t,r)=>({id:e,face:t,text:!0,action:{kind:"command",command:e},...r?{width:r}:{}}),Z={power:Q("power","#@^{2}","x^{2}"),powerN:Q("powerN","#@^{#?}","x^{n}"),fraction:Q("fraction","\\frac{#@}{#?}","\\frac{a}{b}"),root:Q("root","\\sqrt{#0}","\\sqrt{x}"),pi:Q("pi","\\pi"),le:Q("le","\\le"),ge:Q("ge","\\ge"),ne:Q("ne","\\ne"),in:Q("in","\\in"),abs:Q("abs","\\left|#0\\right|","|x|"),brackets:Q("brackets","\\left(#0\\right)","(\\,)"),equals:Q("equals","=","="),infinity:Q("infinity","\\infty"),backspace:fo("backspace","\u232B"),enter:fo("enter","\u21B5"),left:fo("left","\u2190"),right:fo("right","\u2192")},fm={id:"basic",label:"123",rows:[[ae("x"),ae("y"),ae("7"),ae("8"),ae("9"),Q("div","\\div","\\div"),Z.fraction,Z.power,Z.root,Z.backspace],[ae("("),ae(")"),ae("4"),ae("5"),ae("6"),Q("times","\\times","\\times"),Z.powerN,Z.pi,Z.abs,Z.enter],[ae("<"),ae(">"),ae("1"),ae("2"),ae("3"),Q("minus","-","-"),Z.le,Z.ge,Z.ne,Z.left],[ae(","),ae(";"),ae("0"),ae("."),Z.equals,Q("plus","+","+"),Z.in,Z.infinity,ae("%","\\%"),Z.right]]},gm={id:"analysis",label:"lim \u221E",rows:[[Q("lim",He.lim,"\\lim"),Z.infinity,Q("plusInfinity","+\\infty"),Q("minusInfinity","-\\infty"),Q("rightLimit","#@^{+}","x^{+}"),Q("leftLimit","#@^{-}","x^{-}"),Q("prime","#@'","f'"),Q("compose","\\circ"),Z.backspace],[Q("ln","\\ln(#0)","\\ln"),Q("exp","e^{#0}","e^{x}"),Z.root,Z.abs,Z.fraction,Z.powerN,Z.power,Z.pi,Z.enter],[Q("sequence","u_{#?}","u_{n}"),Q("integral",He.integral,"\\int"),Q("sum",He.sum,"\\sum"),Q("to","\\to"),Q("fx","f(x)","f(x)"),Z.equals,Z.le,Z.ge,Z.left],[ae("x"),ae("n"),ae("("),ae(")"),ae(","),ae(";"),ae("<"),ae(">"),Z.right]]},bm={id:"sets",label:"\u211D \u222A",rows:[[Q("reals","\\R","\\mathbb{R}"),Q("naturals","\\N","\\mathbb{N}"),Q("integers","\\Z","\\mathbb{Z}"),Q("rationals","\\Q","\\mathbb{Q}"),Q("setminus","\\setminus"),Q("cup","\\cup"),Q("cap","\\cap"),Q("emptyset","\\emptyset"),Z.backspace],[Z.in,Q("notin","\\notin"),Q("subset","\\subset"),Q("set",He.set,"\\lbrace\\,\\rbrace"),Q("openInterval",He.openInterval,"\\rbrack a;b\\lbrack"),Q("closedInterval",He.closedInterval,"\\lbrack a;b\\rbrack"),Q("rbrack","\\rbrack"),Q("lbrack","\\lbrack"),Z.enter],[ae(";"),ae(","),ae("("),ae(")"),Q("minusInfinity","-\\infty"),Q("plusInfinity","+\\infty"),ae("x"),Z.equals,Z.left],[Z.le,Z.ge,ae("<"),ae(">"),Z.ne,Q("forall","\\forall"),Q("exists","\\exists"),Q("implies","\\Rightarrow"),Z.right]]},ym={id:"matrices",label:"(\u25A6) {",rows:[[Q("matrix2",He.matrix2,Jt(`${ge}&${ge}\\\\${ge}&${ge}`,"pmatrix"),{width:1.5,small:!0}),Q("matrix3",He.matrix3,Jt(`${ge}&${ge}&${ge}\\\\${ge}&${ge}&${ge}\\\\${ge}&${ge}&${ge}`,"pmatrix"),{width:1.5,small:!0}),Q("column2",He.column2,Jt(`${ge}\\\\${ge}`,"pmatrix"),{small:!0}),Q("column3",He.column3,Jt(`${ge}\\\\${ge}\\\\${ge}`,"pmatrix"),{small:!0}),Q("system2",He.system2,Jt(`${ge}\\\\${ge}`,"cases"),{small:!0}),Q("system3",He.system3,Jt(`${ge}\\\\${ge}\\\\${ge}`,"cases"),{small:!0}),Z.backspace],[Q("det2",He.det2,Jt(`${ge}&${ge}\\\\${ge}&${ge}`,"vmatrix"),{width:1.5,small:!0}),Q("det3",He.det3,Jt(`${ge}&${ge}&${ge}\\\\${ge}&${ge}&${ge}\\\\${ge}&${ge}&${ge}`,"vmatrix"),{width:1.5,small:!0}),Q("identity3",He.identity3,"I_3"),Q("inverse",He.inverse,"A^{-1}"),Q("det","\\det","\\det"),Q("times","\\times","\\times"),Z.enter],[Q("cdot","\\cdot","\\cdot"),Z.equals,ae(","),ae(";"),ae("("),ae(")"),Q("vector","\\overrightarrow{#0}","\\vec{u}"),Z.left],[ae("x"),ae("y"),ae("z"),ae("a"),ae("b"),ae("c"),Z.ne,Z.right]]},Re=e=>Q(e,`\\${e}`),vm={id:"greek",label:"\u03B1\u03B2\u03B3",rows:[[Re("alpha"),Re("beta"),Re("gamma"),Re("delta"),Re("varepsilon"),Re("theta"),Re("lambda"),Re("mu"),Z.backspace],[Re("pi"),Re("rho"),Re("sigma"),Re("tau"),Re("varphi"),Re("omega"),Re("Delta"),Re("Omega"),Z.enter],[Re("Sigma"),Re("Phi"),Re("Gamma"),Re("Lambda"),Re("chi"),Re("psi"),Re("nu"),Re("xi"),Z.left],[ae("("),ae(")"),Z.equals,Z.ne,Z.le,Z.ge,Z.in,Z.infinity,Z.right]]},mn=[fm,gm,bm,ym,vm],Va=[Z.power,Z.fraction,Z.root,Z.brackets,Z.equals];var xm=e=>/#\?|#0|#@|\\placeholder/.test(e);function wm(e){return/^\\(?:sum|int|prod|oint|iint|iiint)(?:\\limits)?_\{(?:#\?|\\placeholder\{\})\}\^\{(?:#\?|\\placeholder\{\})\}/.test(e)}function br(e,t){e?.executeCommand&&(e.executeCommand(["insert",t,{selectionMode:xm(t)?"placeholder":"after"}]),wm(t)&&e.executeCommand("moveToNextPlaceholder"))}var Hc=new Map;function km(e,t){if(e.text)return Ya(e.face);let r=`${t?"s":"h"}${e.face}`,n=Hc.get(r);return n===void 0&&(n=Fe(e.face,!1,t),Hc.set(r,n)),n}function Ya(e){return e.replace(/[&<>"]/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"})[t]??t)}function Sm(e,t){return t.keys[e.id]??(e.text?e.face:null)}function Rm(){let e=typeof window<"u"?window.visualViewport:null;return e?Math.max(0,Math.round(window.innerHeight-(e.offsetTop+e.height))):0}var Pm=420,Cm=70,Qa=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 f=Ot("edp-kb-bar");f.append(this.modeSwitch("system",a));let h=Ot("edp-kb-bar-keys");h.dir="ltr";for(let m of Va)h.append(this.key(m,a));f.append(h),n==="box"&&f.append(this.convertButton(a)),this.root.append(f);return}let i=Ot("edp-kb-panel"),c=Ot("edp-kb-head");s&&c.append(this.modeSwitch("maths",a));let l=Ot("edp-kb-tabs");l.setAttribute("role","tablist"),l.setAttribute("aria-label",a.keyboard);for(let f of mn){let h=Ga("edp-kb-tab",Ya(f.label));h.dir="ltr",h.setAttribute("role","tab"),h.setAttribute("aria-selected",String(f.id===r)),h.title=a.tabs[f.id],h.setAttribute("aria-label",a.tabs[f.id]),h.addEventListener("click",()=>this.controller.setTab(f.id)),l.append(h)}let d=Ot("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 u=mn.find(f=>f.id===r)??mn[0],p=Ot("edp-kb-keys");p.dir="ltr",p.setAttribute("role","tabpanel"),p.setAttribute("aria-label",a.tabs[u.id]);for(let f of u.rows){let h=Ot("edp-kb-row");for(let m of f)h.append(this.key(m,a));p.append(h)}i.append(p),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=Sm(t,r),a=Ga(n,km(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,Cm)};i()},Pm)});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=Ot("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=Ga(`edp-kb-action ${t}`,Ya(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"?Rm():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 Ot(e){let t=document.createElement("div");return t.className=e,t}function Ga(e,t){let r=document.createElement("button");return r.type="button",r.className=e,r.tabIndex=-1,r.innerHTML=t,r}wc(e=>new Qa(e));var $r="\\placeholder{}",Em={power:{inField:"^{2}",create:"#@^{2}"},fraction:{inField:`\\frac{${$r}}{${$r}}`,create:`\\frac{${$r}}{${$r}}`},root:{inField:`\\sqrt{${$r}}`,create:`\\sqrt{${$r}}`},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"}},Lm=new Set(["\\le","\\ge","\\ne","\\in","=","+","-","\\times","\\div","\\cdot","<",">"]);function bo(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 Kc(e,t,r,n){if(!bo(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=Ua(s,r);if(!i)return null;let c=t-i.take,l=i.latex,d=[],u=s.slice(s.length-i.take)+r+(n??""),p={};if(i.merge){let h=e.doc.nodeAt(c);if(h?.type.name!=="inlineMath")return null;l=`${h.attrs.latex??""}${l}`,p=h.attrs,d.push({type:"inlineMath",attrs:{...h.attrs}}),u=u.slice(1)}return d.push({type:"text",text:u}),{tr:e.tr.replaceWith(c,t,e.schema.nodes.inlineMath.create({...p,latex:l})),pos:c,placeholder:i.placeholder,revert:d}}function zr(e,t,r,n){if(!uo())return yt(),!1;let o=Kc(e.state,t,r,n);return o?(e.dispatch(o.tr),gr(e,o.pos,o.placeholder?"placeholder":"end",n?void 0:o.revert,n),!0):!1}function Ja(e,t){return e.nodeDOM(t)?.querySelector?.("math-field")??null}function Im(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)),gr(e,i,"end");let c=Ja(e,i);return br(c,r),!!c}function Wc(e,t){let{from:r,empty:n,$from:o}=e.state.selection,a=n&&o.parent.isTextblock?r:e.state.selection.to;return bo(e.state,a)?(e.chain().insertContentAt(a,{type:"inlineMath",attrs:{latex:""}}).run(),gr(e.view,a,"end"),t&&br(Ja(e.view,a),t),a):null}function Fr(e){let t=Qt.el;return t&&t.isConnected&&!e.isDestroyed&&e.view.dom.contains(t)?t:null}function Xa(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=Lc(r);return n||un(t).replace(/<=/g,"\\le ").replace(/>=/g,"\\ge ").replace(/!=/g,"\\ne ").replace(/sqrt\(([^()]*)\)/g,"\\sqrt{$1}")}function Za(e){if(Fr(e))return"formula";let t=e.state.selection;if(t instanceof Uc&&(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 Vc(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(!bo(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,(p,f)=>{if(p.isText){let h=Math.max(a,f),m=Math.min(s,f+p.nodeSize);l+=(p.text??"").slice(h-f,m-f)}else p.type.name==="inlineMath"&&(l&&c.push(Xa(l)),l="",c.push(String(p.attrs.latex??"")))}),l&&c.push(Xa(l));let d=c.join("");if(!d)return null;let u=t.doc.slice(a,s).content.toJSON();return r.dispatch(t.tr.replaceWith(a,s,t.schema.nodes.inlineMath.create({latex:d}))),gr(r,a,"end",u),a}function $m(e){let t=Fr(e),r,n="";if(t?(r=pn.get(t)?.pos(),n=t.value):e.state.selection instanceof Uc&&(r=e.state.selection.from,n=String(e.state.selection.node.attrs.latex??"")),r==null)return!1;let o=lo(e.state,r,hr(n));return o?(e.view.dispatch(o),Dt(e),!0):!1}function hn(e){if(!e.isEditable)return;if(!uo()){yt().then(r=>r&&hn(e));return}let t=Za(e);t==="formula"?$m(e):t==="selection"?Vc(e):Wc(e,"")}function es(e,t){if(!e.isEditable)return;if(!uo()){yt().then(o=>o&&es(e,t));return}let r=Fr(e);if(r){if(t===")"&&Lr(r))return;br(r,t);return}let{selection:n}=e.state;if(Za(e)==="selection"){let o=Vc(e),a=o==null?null:Ja(e.view,o);a&&(a.executeCommand?.("selectAll"),br(a,t));return}if(n.empty){let o=t.match(/^#@\^\{([^{}#]+)\}$/)?.[1];if(o&&zr(e.view,n.from,"^",o)||t==="#@^{#?}"&&zr(e.view,n.from,"^")||t==="\\frac{#@}{#?}"&&zr(e.view,n.from,"/")||Im(e.view,n.from,t,!Lm.has(t)))return}Wc(e,t)}function zm(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?_m.near(a.doc.resolve(i),o?1:-1):Mm.create(a.doc,o?s.to:s.from);e.dispatch(a.tr.setSelection(c).scrollIntoView())}function Fm(e,t){if(!e.isEditable)return;let r=Fr(e);if(r){let i=pn.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&&Qt.el===r&&i?.leave(t==="left"?"before":"after")}return}let{view:n}=e;if(t==="left"||t==="right"){zm(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 yo(e){return e.storage.mathTyping}function Dm(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=fr(n);o&&r.push(o)}),r},refocus(){if(e.isDestroyed)return;let t=Fr(e),r=t?fr(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=>es(e,t),command:t=>Fm(e,t),convert:()=>hn(e),caret:()=>e.isDestroyed?"text":Za(e),caretRect(){if(e.isDestroyed)return null;let t=Fr(e);if(t)return t.getBoundingClientRect();try{return e.view.coordsAtPos(e.state.selection.head)}catch{return null}},labels:()=>yo(e)?.keyboard??Er,dir:()=>!e.isDestroyed&&getComputedStyle(e.view.dom).direction==="rtl"?"rtl":"ltr"}}function ts(e,t){let r=Z[t];r.action.kind==="insert"&&es(e,r.action.latex)}function rs(e){if(!e.isEditable)return;let t=yo(e)?.target;t&&Le.openFor(t)}var Om=new Tm("edpMathTyping"),ns=Nm.create({name:"mathTyping",addStorage(){return{chip:{unwrap:"Back to text",ownLine:"On its own line"},keyboard:Er,target:null,unregister:null}},onCreate(){this.editor.isEditable&&yt();let e=Dm(this.editor);this.storage.target=e,this.storage.unregister=Le.register(e)},onDestroy(){this.storage.unregister?.(),this.storage.unregister=null,this.storage.target=null},onSelectionUpdate(){Le.active===this.storage.target&&Le.emit()},addProseMirrorPlugins(){let e=null,t=0;return[new Am({key:Om,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(),!Wa(r,n.target)||!Ka(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||!Wa(r,n.target)||!Ka(r,n.clientX,n.clientY)?!1:(n.preventDefault(),!0)}},handleTextInput(r,n,o,a){return n!==o?!1:a.length===1?zr(r,n,a):a.length===2&&a[0]==="^"?zr(r,n,"^",a[1]):!1},handleKeyDown(r,n){let o=dn.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&&zr(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"?(gr(r,l.pos-l.nodeBefore.nodeSize,"end"),!0):c&&l.nodeAfter?.type.name==="inlineMath"?(gr(r,l.pos,"start"),!0):!1}}})]}});function os(e,t){let r=yo(e);r&&(r.chip={...r.chip,...t})}function as(e,t){let r=yo(e);r&&(r.keyboard={...r.keyboard,...t,tabs:{...r.keyboard.tabs,...t.tabs},keys:{...r.keyboard.keys,...t.keys}},Le.active===r.target&&Le.emit())}import{useEffect as Bm,useState as jm}from"react";function vo(){let[,e]=jm(0);return Bm(()=>Le.subscribe(()=>e(t=>t+1)),[]),Le.state()}function ss(e){let t=vo();if(!e||e.isDestroyed)return!1;let r=e.storage.mathTyping?.target;return!!r&&t.active===r&&t.caret==="formula"}import{Extension as qm}from"@tiptap/core";import{Plugin as Qc,PluginKey as Xc}from"@tiptap/pm/state";import{Decoration as ls,DecorationSet as gn}from"@tiptap/pm/view";function is(e){return(e??[]).map(t=>t.type==="text"?t.text??"":t.type==="inlineMath"?t.attrs?.latex?`$${t.attrs.latex}$`:"":t.type==="hardBreak"?`
2
+ `:is(t.content)).join("")}function cs(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(is(o.content)):o.type==="bulletList"||o.type==="orderedList"||o.type==="listItem"?r(o.content??[]):t.push(is(o.content))};return r(e),t.join(`
3
3
  `).replace(/\n{3,}/g,`
4
4
 
5
- `).trim()}function uo(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 Nr(e){return uo(e)===0}function an(e){return(e??"").split(`
6
- `).map(Fc)}function Fc(e){let t=e.trim().match(/^\$\$([\s\S]+)\$\$$/);if(t)return{type:"blockMath",attrs:{latex:t[1].trim()}};let r=[],n=/\$\$([^$]+)\$\$|\$([^$]+)\$/g,o=0;for(let a=n.exec(e);a;a=n.exec(e))a.index>o&&r.push({type:"text",text:e.slice(o,a.index)}),r.push({type:"inlineMath",attrs:{latex:(a[1]??a[2]).trim()}}),o=a.index+a[0].length;return o<e.length&&r.push({type:"text",text:e.slice(o)}),r.length?{type:"paragraph",content:r}:{type:"paragraph"}}function mo(e,t={}){if(e.kind==="figure")return t.figures==="keep"&&e.box?{type:"photoFigure",attrs:{box:e.box}}:null;let r=(e.value??"").trim();return r?e.kind==="math"?{type:"blockMath",attrs:{latex:r.replace(/^\$+|\$+$/g,"").trim()}}:Fc(r):null}function Tr(e,t={}){return e.flatMap(r=>{let n=mo(r,t);return n?[n]:[]})}var fo="edpReading",ho=new Rm("edpUnsureWords");function Bc(e,t){let{doc:r,selection:n}=e;if(Nr(r.toJSON().content??[]))return{pos:0,replace:!0};if(!t.caretPlaced)return{pos:r.content.size,replace:!1};let{$from:o}=n;return{pos:o.depth>=1?o.after(1):n.to,replace:!1}}function jc(e,t,r){return e.replace?Nr(r.doc.toJSON().content??[])?e:{pos:r.doc.content.size,replace:!1}:{pos:Math.min(t.mapping.map(e.pos,-1),r.doc.content.size),replace:!1}}var Oc=e=>e.replace(/\s+/g,"");function Pm(e,t,r,n){let o=n.map(s=>s.trim()).filter(Boolean);if(!o.length)return[];let a=[];return e.nodesBetween(t,r,(s,i)=>{if(s.isText){let c=s.text??"";for(let l of o)if(!l.includes("$"))for(let p=c.indexOf(l);p!==-1;p=c.indexOf(l,p+l.length))a.push(zc.inline(i+p,i+p+l.length,{class:"edp-sheet-unsure"}));return!1}if(s.type.name==="inlineMath"||s.type.name==="blockMath"){let c=Oc(String(s.attrs.latex??""));return o.some(p=>{let d=Oc(p.replace(/\$/g,""));return d.length>0&&c.includes(d)})&&a.push(zc.node(i,i+s.nodeSize,{class:"edp-sheet-unsure"})),!1}return!0}),a}function qc(e,t,r){let n=mo(r);if(!n)return null;let o;try{o=e.schema.nodeFromJSON(n)}catch{return null}let a=e.tr,s=t.replace?0:Math.min(t.pos,e.doc.content.size);t.replace?a.replaceWith(0,e.doc.content.size,o):a.insert(s,o);let i=s+o.nodeSize;a.setMeta(fo,!0);let c=r.unsure?.length?Pm(a.doc,s,i,r.unsure):[];return c.length&&a.setMeta(ho,c),{tr:a,next:{pos:i,replace:!1}}}var Cm=new Sm({key:ho,state:{init:()=>Dc.empty,apply(e,t){let r=t.map(e.mapping,e.doc),n=e.getMeta(ho);return n?.length&&(r=r.add(e.doc,n)),e.docChanged&&!e.getMeta(fo)&&r!==Dc.empty&&e.mapping.maps.forEach((o,a)=>{let s=e.mapping.slice(a+1);o.forEach((i,c,l,p)=>{let d=r.find(s.map(l,-1),s.map(p,1));d.length&&(r=r.remove(d))})}),r}},props:{decorations(e){return ho.getState(e)}}}),Hc=km.create({name:"edpUnsureWords",addProseMirrorPlugins(){return[Cm]}});var Dm={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"},Wc={power:cn("span",{className:"edp-key-pow",children:["x",Rt("sup",{children:"2"})]}),fraction:cn("span",{className:"edp-key-frac",children:[Rt("span",{children:"a"}),Rt("span",{children:"b"})]}),root:"\u221A",pi:"\u03C0",le:"\u2264",ge:"\u2265",ne:"\u2260",in:"\u2208"},Om=["power","fraction","root","pi","le","ge","ne","in"],Bm=Lm.create({name:"edpOneLine",priority:1e3,addKeyboardShortcuts(){return{Enter:()=>!0,"Shift-Enter":()=>!0,"Mod-Enter":()=>!0}}}),ts=!1;if(typeof document<"u"){document.addEventListener("pointerdown",()=>ts=!0,!0);for(let e of["pointerup","pointercancel"])document.addEventListener(e,()=>ts=!1,!0)}function jm(e){if(!ts)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 qm(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 $m(Im.from(t.nodes.paragraph.create(null,r)),1,1)}function rs(e){let t=[];for(let r of e){if(r.type==="inlineMath"||r.type==="blockMath"){let o=Ac(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:rs(r.content)}:r)}return t}var ns=Am(function({initialContent:t,onChange:r,disabled:n=!1,placeholder:o,labels:a,extraTools:s,className:i,keys:c=!0,ariaLabel:l,ariaLabelledBy:p,dir:d,keyboardLabels:u,compact:f=!1,singleLine:h=!1,autoFocus:m=!1},b){let w={...Dm,...a},P=sn(r);P.current=r;let g=Mm({extensions:[Fm.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1}),La,Ia,Ya,Hc,zm.configure({placeholder:o??"",showOnlyWhenEditable:!0}),...h?[Bm]:[]],immediatelyRender:!1,editable:!n,content:t?.length?{type:"doc",content:t}:"",editorProps:{attributes:{class:"edp-sheet-doc",role:"textbox","aria-multiline":h?"false":"true",...l?{"aria-label":l}:{},...p?{"aria-labelledby":p}:{},...d?{dir:d}:{}},...h?{transformPastedText:F=>F.replace(/\s*[\r\n]+\s*/g," "),transformPasted:(F,Y)=>qm(F,Y.state.schema)}:{}},onUpdate({editor:F}){F.isEditable&&P.current(rs(F.getJSON().content??[]))}});lr(()=>{n||ft()},[n]);let R=sn(m&&!n);lr(()=>{if(!g||!R.current)return;let F=0,Y,$=()=>{if(!g.isDestroyed){if(g.view.dom?.isConnected){R.current=!1,g.view.dispatch(g.state.tr.setSelection(Kc.atEnd(g.state.doc))),g.view.focus();return}++F<40&&(Y=setTimeout($,16))}};return Y=setTimeout($,0),()=>clearTimeout(Y)},[g]),lr(()=>{g&&Qa(g,{unwrap:w.unwrap})},[g,w.unwrap]),lr(()=>{g&&u&&Xa(g,u)},[g,u]);let _=Ja(g),A=f||h,[I,C]=Tm(!1),L=sn(null),v=()=>A&&C(!0),S=F=>{!A||F.currentTarget.contains(F.relatedTarget)||jm(()=>{_e.isSwitching()||L.current?.contains(document.activeElement)||C(!1)})};lr(()=>{g&&(g.setEditable(!n,!1),g.view.dispatch(g.state.tr.setMeta("edpSheetEditable",!n)))},[n,g]);let x=sn(null);lr(()=>{g&&x.current&&(g.commands.setContent({type:"doc",content:x.current},{emitUpdate:!1}),x.current=null)},[g]);let B=sn(!1);lr(()=>{if(!g)return;let F=()=>{B.current=!0};return g.on("focus",F),()=>{g.off("focus",F)}},[g]),Nm(b,()=>({setContent(F){g?g.commands.setContent({type:"doc",content:F},{emitUpdate:!1}):x.current=F},clear(){g?.commands.clearContent(!1)},getContent(){return rs(g?.getJSON().content??[])},insertFormula(F){if(!g)return;let{to:Y}=g.state.selection;g.chain().insertContentAt(Y,[{type:"inlineMath",attrs:{latex:F}},{type:"text",text:" "}]).run(),Lt(g)},beginLines(F){if(!g)return{add(){},end(){}};let Y=Bc(g.state,{caretPlaced:F?.at==="end"?!1:B.current}),$=({transaction:O})=>{O.docChanged&&!O.getMeta(fo)&&(Y=jc(Y,O,g.state))};return g.on("transaction",$),{add(O){if(g.isDestroyed)return;let G=qc(g.state,Y,O);G&&(g.view.dispatch(G.tr),Y=G.next)},end(){g.off("transaction",$)}}},focus(){!g||g.isDestroyed||(g.view.dispatch(g.state.tr.setSelection(Kc.atEnd(g.state.doc))),Lt(g))}}),[g]);let E=F=>{g&&!n&&Va(g,F)},y=()=>{g&&!n&&Ga(g)},K=()=>{g&&!n&&on(g)};return cn("div",{ref:L,onFocusCapture:v,onBlurCapture:S,className:Uc("edp-sheet-box",A&&"edp-sheet-box--compact",A&&I&&"edp-sheet-box--keys-open",h&&"edp-sheet-box--line",n&&"edp-sheet-box--readonly",i),children:[Rt("div",{className:"edp-sheet-page",children:Rt(Em,{editor:g})}),!n&&(c||s)&&cn("div",{className:"edp-sheet-keys",role:"toolbar","aria-label":w.keysAria,children:[c&&Om.map(F=>Rt("button",{type:"button",className:"edp-sheet-key",title:w[F],"aria-label":w[F],onMouseDown:Y=>Y.preventDefault(),onClick:()=>E(F),children:Wc[F]},F)),c&&Rt("button",{type:"button",className:Uc("edp-sheet-key edp-sheet-key--convert",_&&"is-text"),title:_?w.toText:w.toMaths,"aria-label":_?w.toText:w.toMaths,onMouseDown:F=>F.preventDefault(),onClick:K,children:_?"Aa":Rt("i",{children:"fx"})}),c&&cn("button",{type:"button",className:"edp-sheet-key edp-sheet-key--more",onMouseDown:F=>F.preventDefault(),onClick:y,children:[Rt(_m,{size:16,"aria-hidden":"true"})," ",w.more]}),s&&Rt("span",{className:"edp-sheet-keys-extra",children:s})]})]})});import{jsx as me,jsxs as Be,Fragment as Vc}from"react/jsx-runtime";import{useEffect as _r,useRef as pt,useState as ln}from"react";import{RotateCw as Hm,X as Um}from"lucide-react";var Km={answer:4,copy:12},Gc=1600,Wm=800,Vm=2;function Yc(e,t){let r=Math.max(e,t);return r<=0?1:r>Gc||r<Wm?Gc/r:1}async function Qc(e){let t=await createImageBitmap(e),r=Yc(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}var Xc=e=>new Promise((t,r)=>e.toBlob(n=>n?t(n):r(new Error("encode_failed")),"image/jpeg",.85));async function Jc(e){return Xc(await Qc(e))}async function Zc(e,t){let r=await createImageBitmap(e),n=t!==180,o=document.createElement("canvas");o.width=n?r.height:r.width,o.height=n?r.width:r.height;let a=o.getContext("2d");return a&&(a.translate(o.width/2,o.height/2),a.rotate(t*Math.PI/180),a.drawImage(r,-r.width/2,-r.height/2)),r.close?.(),Xc(o)}async function el(e){return(await Qc(e)).toDataURL("image/jpeg",.85)}async function os(e,t,r){let{signal:n,startLines:o}=r,a=null,s=0,i=c=>{n.aborted||(a??(a=o(t.photos)),a.add(c),s++)};try{let{lines:c,turns:l}=await e.readPages(t,{signal:n,onLine:i});return n.aborted?{shown:s}:l?.length?{shown:s,turns:l}:(s===0&&c.forEach(i),{shown:s})}finally{a?.end()}}function Gm(e,t){let r=t.filter(o=>o.page>=0&&o.page<e.length),n=r.filter(o=>e[o.page]>=Vm).map(o=>o.page);return n.length||r.length===0?{sideways:n.length?n:t.map(o=>o.page)}:{turn:r}}function as(){return typeof window<"u"&&!!window.matchMedia?.("(pointer: coarse)").matches}function go({src:e,alt:t,closeLabel:r,onClose:n}){let o=pt(null);return _r(()=>{o.current?.focus();let a=s=>{s.key==="Escape"&&(s.stopPropagation(),n())};return window.addEventListener("keydown",a,!0),()=>window.removeEventListener("keydown",a,!0)},[n]),Be("div",{className:"edp-sheet-viewer",role:"dialog","aria-modal":"true","aria-label":t,onClick:n,children:[me("img",{src:e,alt:t,onClick:a=>a.stopPropagation()}),me("button",{ref:o,type:"button",className:"edp-sheet-viewer-close",onClick:n,"aria-label":r,children:"\xD7"})]})}function bo({nodeId:e,purpose:t="answer",mediaHandler:r,handler:n,incoming:o,startLines:a,onRead:s,onDone:i,onType:c,onClose:l,onPages:p}){let d=ce(),u=as(),f=Et(n),h=Km[t],[m,b]=ln("choose"),[w,P]=ln(null),[g,R]=ln(null),[_,A]=ln([]),[I,C]=ln(null),L=pt([]),v=z=>{L.current=z,A(z)};_r(()=>{p?.(_.length)},[_.length]);let S=pt(1),x=pt(new Map),B=pt(!1),E=pt(null),y=pt(null),K=pt(null),F=pt(null),Y=pt(null),$=pt(new AbortController),O=pt(null);_r(()=>{let z=new AbortController;return $.current=z,()=>{z.abort(),O.current?.abort();for(let re of L.current)re.blob&&URL.revokeObjectURL(re.preview)}},[]);let G=z=>{R(z),b("error")},T=(z,re)=>{v(L.current.map(de=>de.id===z?{...de,...re}:de))},N=z=>{if(!f||!z.blob)return;let re=z.blob,de=n.uploadPhoto(re,{signal:$.current.signal}).then(ie=>T(z.id,{photo:{...ie,name:ie.name??z.name},failed:!1})).catch(()=>{$.current.signal.aborted||T(z.id,{failed:!0})});x.current.set(z.id,de)},H=async z=>{if(n.transcribePhotos){b("reading");try{let re=await Promise.all(z.map(ee=>el(ee))),de=[];if(r)for(let ee of z){let{url:Ve,mimeType:mt}=await r.upload(ee,"image");de.push({url:Ve,mimeType:mt??ee.type,name:ee.name})}let ie=new AbortController;O.current=ie;let{content:Pe}=await n.transcribePhotos({images:re,photos:de},{nodeId:e,signal:ie.signal});ie.signal.aborted||s(Pe,de)}catch{$.current.signal.aborted||G("unreadable")}}},M=async z=>{let re=z.filter(Pe=>Pe.type.startsWith("image/")||/\.hei[cf]$/i.test(Pe.name));if(re.length===0)return;if(!f)return H(re.slice(0,h));let de=h-L.current.length,ie=[];for(let Pe of re.slice(0,Math.max(de,0)))try{let ee=await Jc(Pe);ie.push({id:S.current++,preview:URL.createObjectURL(ee),blob:ee,photo:null,failed:!1,turns:0,name:Pe.name})}catch{G("open");return}$.current.signal.aborted||(v([...L.current,...ie]),ie.forEach(N),R(null),b("pages"))};_r(()=>{o?.files.length&&M(o.files)},[o?.key]);let k=z=>{let re=L.current.find(ie=>ie.id===z);re?.blob&&URL.revokeObjectURL(re.preview),x.current.delete(z);let de=L.current.filter(ie=>ie.id!==z);v(de),de.length===0&&(R(null),b("choose"))},W=async(z,re,de)=>{let ie=L.current.find(mt=>mt.id===z);if(!ie)return;let Pe=ie.blob?ie.blob:await(await fetch(ie.preview,{signal:$.current.signal})).blob(),ee=await Zc(Pe,re);ie.blob&&URL.revokeObjectURL(ie.preview);let Ve={...ie,blob:ee,preview:URL.createObjectURL(ee),photo:null,failed:!1,turns:ie.turns+(de?0:1)};v(L.current.map(mt=>mt.id===z?Ve:mt)),de&&(B.current=!0),N(Ve)},V=z=>{W(z,90,!0).catch(()=>G("open"))},ne=async()=>{let z=new AbortController;if(O.current=z,R(null),b("reading"),await Promise.all(x.current.values()),z.signal.aborted)return;let re=L.current;if(re.some(ie=>ie.failed||!ie.photo))return G("send");let de=re.map(ie=>ie.photo);try{let{shown:ie,turns:Pe}=await os(n,{photos:de,purpose:t,...e?{nodeId:e}:{},...B.current?{upright:!0}:{}},{signal:z.signal,startLines:a});if(z.signal.aborted)return;if(Pe?.length){let ee=Gm(re.map(Ve=>Ve.turns),Pe);if("sideways"in ee){B.current=!0,R("sideways"),b("pages");return}for(let Ve of ee.turn)await W(re[Ve.page].id,Ve.degrees,!1);return ne()}if(ie===0)return G("unreadable");i()}catch(ie){if(z.signal.aborted||$.current.signal.aborted)return;G(Jr(ie))}},le=()=>{O.current?.abort(),b(L.current.length?"pages":"choose")},Z=z=>{if(z.length===0)return;if(!f){b("reading"),n.transcribePhotos({images:[],photos:z},{nodeId:e,signal:$.current.signal}).then(({content:de})=>s(de,z)).catch(()=>{$.current.signal.aborted||G("unreadable")});return}let re=z.slice(0,h-L.current.length).map(de=>({id:S.current++,preview:de.url,blob:null,photo:de,failed:!1,turns:0,name:de.name}));v([...L.current,...re]),ne()};_r(()=>{if(u||!n.startPhoneCapture)return;let z=new AbortController;return Y.current=z,n.startPhoneCapture({nodeId:e,signal:z.signal}).then(({url:re,qrImage:de,photos:ie})=>{z.signal.aborted||(P({url:re,qrImage:de}),ie.then(Pe=>{z.signal.aborted||Z(Pe)}).catch(()=>{}))}).catch(()=>{}),()=>z.abort()},[]);let se=()=>{F.current?.getTracks().forEach(z=>z.stop()),F.current=null};_r(()=>se,[]);let ve=async()=>{Y.current?.abort();try{let z=await navigator.mediaDevices.getUserMedia({video:{facingMode:"environment"}});F.current=z,b("camera"),requestAnimationFrame(()=>{K.current&&(K.current.srcObject=z,K.current.play().catch(()=>{}))})}catch{G("camera")}},ye=()=>{let z=K.current;if(!z)return;let re=document.createElement("canvas");re.width=z.videoWidth,re.height=z.videoHeight,re.getContext("2d")?.drawImage(z,0,0),re.toBlob(de=>{se(),de?M([new File([de],"copie.jpg",{type:"image/jpeg"})]):b(L.current.length?"pages":"choose")},"image/jpeg",.9)},ge=z=>{Y.current?.abort();let re=Array.from(z.target.files??[]);z.target.value="",M(re)},xe={unreadable:d.sheetPhotoUnreadable,limit:t==="copy"?d.copyLimit:d.sheetPhotoLimit,busy:d.sheetPhotoBusy,network:d.sheetPhotoNetwork,cut:t==="copy"?d.copyCut:d.sheetPhotoCut,failed:d.sheetPhotoFailed,camera:d.sheetPhotoCameraFailed,sideways:d.sheetPhotoSideways,send:d.sheetPhotoSendFailed,open:d.sheetPhotoOpenFailed},We=t==="copy"?d.copyTitle:d.sheetPhotoTitle,He=m==="reading",X=_.length>=h,he=_.length>0&&_.every(z=>z.photo&&!z.failed),be=()=>{if(g==="camera"||g==="open"||L.current.length===0){R(null),b(L.current.length?"pages":"choose");return}if(g==="unreadable"||g==="send"){R(null),b("pages");return}ne()};return Be("div",{className:t==="copy"?"edp-sheet-panel edp-sheet-panel--bare":"edp-sheet-panel",role:t==="copy"?void 0:"dialog","aria-label":We,children:[t!=="copy"&&Be("div",{className:"edp-sheet-panel-head",children:[me("strong",{children:We}),me("button",{type:"button",className:"edp-sheet-panel-close",onClick:l,"aria-label":d.sheetClose,children:"\xD7"})]}),me("input",{ref:E,type:"file",accept:"image/*",capture:"environment",hidden:!0,onChange:ge}),me("input",{ref:y,type:"file",accept:"image/*",multiple:!0,hidden:!0,onChange:ge}),m==="choose"&&u&&Be("div",{className:"edp-sheet-panel-actions",children:[me("button",{type:"button",className:"edp-sheet-btn edp-sheet-btn--primary",onClick:()=>E.current?.click(),children:d.sheetPhotoTake}),me("button",{type:"button",className:"edp-sheet-btn",onClick:()=>y.current?.click(),children:d.sheetPhotoGallery})]}),m==="choose"&&!u&&Be(Vc,{children:[n.startPhoneCapture&&Be("div",{className:"edp-sheet-qr",children:[w?me("img",{src:w.qrImage,alt:"",width:168,height:168}):me("span",{className:"edp-sheet-qr-wait"}),me("p",{children:t==="copy"?d.copyPhoneHelp:d.sheetPhotoPhoneHelp})]}),me("p",{className:"edp-sheet-or",children:n.startPhoneCapture?d.sheetPhotoOr:null}),Be("div",{className:"edp-sheet-panel-actions",children:[me("button",{type:"button",className:"edp-sheet-btn",onClick:()=>y.current?.click(),children:d.sheetPhotoUpload}),me("button",{type:"button",className:"edp-sheet-btn",onClick:ve,children:d.sheetPhotoWebcam})]})]}),m==="camera"&&Be("div",{className:"edp-sheet-camera",children:[me("video",{ref:K,playsInline:!0,muted:!0}),me("button",{type:"button",className:"edp-sheet-btn edp-sheet-btn--primary",onClick:ye,children:d.sheetPhotoShoot})]}),_.length>0&&m!=="camera"&&me("ul",{className:"edp-sheet-shots","aria-label":d.sheetPhotoPages,children:_.map((z,re)=>Be("li",{className:"edp-sheet-shot","data-state":z.failed?"failed":z.photo?"stored":"sending",children:[Be("button",{type:"button",className:"edp-sheet-shot-view",onClick:()=>C(z),"aria-label":d.sheetPhotoView(re+1),children:[me("img",{src:z.preview,alt:""}),!z.photo&&!z.failed&&me("span",{className:"player-ai-spinner","aria-hidden":"true"})]}),!He&&Be("div",{className:"edp-sheet-shot-tools",children:[me("button",{type:"button",className:"edp-sheet-shot-tool",onClick:()=>V(z.id),"aria-label":d.sheetPhotoTurn,disabled:!z.photo&&!z.failed,children:me(Hm,{size:15,"aria-hidden":"true"})}),me("button",{type:"button",className:"edp-sheet-shot-tool",onClick:()=>k(z.id),"aria-label":d.sheetPhotoRemove,children:me(Um,{size:15,"aria-hidden":"true"})})]})]},z.id))}),m==="pages"&&Be(Vc,{children:[g==="sideways"&&me("p",{className:"edp-sheet-hint",role:"alert",children:xe.sideways}),_.some(z=>z.failed)&&me("p",{className:"edp-sheet-hint",role:"alert",children:xe.send}),Be("div",{className:"edp-sheet-panel-actions",children:[Be("button",{type:"button",className:"edp-sheet-btn",onClick:()=>(u?E.current:y.current)?.click(),disabled:X,children:["+ ",d.sheetPhotoAddPage]}),u?me("button",{type:"button",className:"edp-sheet-btn",onClick:()=>y.current?.click(),disabled:X,children:d.sheetPhotoGallery}):me("button",{type:"button",className:"edp-sheet-btn",onClick:ve,disabled:X,children:d.sheetPhotoWebcam}),me("button",{type:"button",className:"edp-sheet-btn edp-sheet-btn--primary edp-sheet-btn--end",onClick:()=>{ne()},disabled:!he,children:d.sheetPhotoRead})]})]}),He&&Be("div",{className:"edp-sheet-progress",role:"status",children:[me("span",{className:"player-ai-spinner","aria-hidden":"true"}),me("span",{children:t==="copy"?d.copyReadingLive:f?d.sheetPhotoReadingLive:d.sheetPhotoReading}),f&&me("button",{type:"button",className:"edp-sheet-btn edp-sheet-btn--end",onClick:le,children:d.sheetPhotoStop})]}),m==="error"&&g&&Be("div",{className:"edp-sheet-error",role:"alert",children:[me("p",{children:xe[g]}),Be("div",{className:"edp-sheet-panel-actions",children:[g!=="limit"&&me("button",{type:"button",className:"edp-sheet-btn",onClick:be,children:d.sheetPhotoRetry}),me("button",{type:"button",className:"edp-sheet-btn",onClick:c,children:d.sheetPhotoType})]})]}),I&&me(go,{src:I.preview,alt:d.sheetPhotoView(_.findIndex(z=>z.id===I.id)+1),closeLabel:d.sheetClose,onClose:()=>C(null)})]})}import{jsx as $t,jsxs as Mr,Fragment as ph}from"react/jsx-runtime";import{useEffect as uh,useRef as gl,useState as mh}from"react";var yo="#1d2433",Ym="#c9d6e8",Qm="#f0b7b2";function tl(e,t){return e==="pen"||e==="mouse"?!0:!t}function rl(e,t){return e!=="pen"||!Number.isFinite(t)||t<=0?.5:Math.min(t,1)}function dn(e,t,r){return t?e*(.6+Math.min(Math.max(r,0),1)):e}function ss(e,t,r=0){let n=1/0,o=1/0,a=-1/0,s=-1/0;for(let i of e)for(let c of i.points){let l=dn(t,i.pen,c.p)/2;n=Math.min(n,c.x-l),o=Math.min(o,c.y-l),a=Math.max(a,c.x+l),s=Math.max(s,c.y+l)}return Number.isFinite(n)?{x:n-r,y:o-r,width:a-n+2*r,height:s-o+2*r}:null}function Ye(e){return e.some(t=>t.points.length>0)}function nl(e,t){let r=Math.round(e*Math.SQRT2),n=Math.round(t-200);return Math.max(Math.min(r,n),288)}function Xm(e,t=36){let r=[];for(let n=t*1.5;n<e-t/2;n+=t)r.push(Math.round(n));return r}function ol(e){let t=Math.max(e.width,e.height);if(t<=0)return{width:1,height:1,scale:1};let r=1600/t;return{width:Math.max(1,Math.round(e.width*r)),height:Math.max(1,Math.round(e.height*r)),scale:r}}var Jm=1024,Zm=3;function al(e){let t=Math.max(e.width,e.height);if(t<=0)return{width:1,height:1,scale:1};let r=Math.min(Zm,Jm/t);return{width:Math.max(1,Math.round(e.width*r)),height:Math.max(1,Math.round(e.height*r)),scale:r}}function sl(e,t,r){let n=ss(t,r);if(!n)return e;let o=Math.max(n.y+n.height+36,108);return{x:e.x,y:e.y,width:e.width,height:Math.min(e.height,Math.ceil(o))}}function is(e,t,r){let{base:n,box:o,scale:a,rules:s}=r,i=o.width*a,c=o.height*a;if(e.fillStyle="#ffffff",e.fillRect(0,0,i,c),s){e.lineWidth=1,e.strokeStyle=Ym;for(let d of Xm(s.height))e.beginPath(),e.moveTo(0,d+.5),e.lineTo(s.width,d+.5),e.stroke();let p=s.marginAt==="left"?36*1.5:s.width-36*1.5;e.strokeStyle=Qm,e.beginPath(),e.moveTo(p+.5,0),e.lineTo(p+.5,s.height),e.stroke()}e.strokeStyle=yo,e.fillStyle=yo,e.lineCap="round",e.lineJoin="round";let l=p=>[(p.x-o.x)*a,(p.y-o.y)*a];for(let p of t){let d=p.points;if(d.length!==0){if(d.length===1){let[u,f]=l(d[0]);e.beginPath(),e.arc(u,f,dn(n,p.pen,d[0].p)*a/2,0,Math.PI*2),e.fill();continue}if(!p.pen){e.lineWidth=n*a,e.beginPath(),d.forEach((u,f)=>{let[h,m]=l(u);f?e.lineTo(h,m):e.moveTo(h,m)}),e.stroke();continue}for(let u=1;u<d.length;u++){let[f,h]=l(d[u-1]),[m,b]=l(d[u]);e.lineWidth=dn(n,!0,(d[u-1].p+d[u].p)/2)*a,e.beginPath(),e.moveTo(f,h),e.lineTo(m,b),e.stroke()}}}}import{jsx as eh}from"react/jsx-runtime";import{forwardRef as th,useCallback as rh,useEffect as cl,useImperativeHandle as nh,useLayoutEffect as oh,useRef as xo,useState as ll,useSyncExternalStore as ah}from"react";var vo=!1,cs=new Set,il=!1;function dl(){il||typeof window>"u"||(il=!0,window.addEventListener("pointerdown",e=>{e.pointerType==="pen"&&!vo&&(vo=!0,cs.forEach(t=>t()))},{capture:!0,passive:!0}))}var sh=e=>(dl(),cs.add(e),()=>cs.delete(e));function ih(){return ah(sh,()=>vo,()=>!1)}function ch(){return typeof window<"u"&&!!window.matchMedia?.("(any-pointer: coarse)").matches}function lh(){return typeof window>"u"||!window.screen?!1:Math.min(window.screen.width,window.screen.height)>=600}function pl(){let e=ih(),[t,r]=ll({touch:!1,large:!1});return cl(()=>{r({touch:ch(),large:lh()})},[]),{pad:e||t.touch,page:e||t.touch&&t.large}}var ul={pad:3,page:2.5},dh=12,ml=e=>ul[e];function ls(e,t,r){let n=t?sl(t,e,r):ss(e,r,dh);if(!n||!Ye(e)||typeof document>"u")return Promise.resolve(null);let o=t?ol(n):al(n),a=document.createElement("canvas");a.width=o.width,a.height=o.height;let s=a.getContext("2d");return s?(is(s,e,{base:r,box:n,scale:o.scale}),new Promise(i=>a.toBlob(c=>i(c),"image/png"))):Promise.resolve(null)}var wo=th(function({variant:t,initialStrokes:r,initialHeight:n,ariaLabel:o,className:a,onStrokeStart:s,onChange:i},c){let l=xo(null),p=xo(r??[]),d=xo(null),u=xo({width:0,height:0}),[f,h]=ll(n??null),m=ul[t];cl(dl,[]);let b=()=>({x:0,y:0,width:u.current.width,height:u.current.height}),w=rh(()=>{let C=l.current,L=C?.getContext("2d");if(!C||!L)return;let v=window.devicePixelRatio||1;L.setTransform(v,0,0,v,0,0);let{width:S,height:x}=u.current,B=getComputedStyle(C).direction==="rtl";is(L,[...p.current,...d.current?[d.current.stroke]:[]],{base:m,box:{x:0,y:0,width:S,height:x},scale:1,...t==="page"?{rules:{width:S,height:x,marginAt:B?"right":"left"}}:{}})},[m,t]);oh(()=>{let C=l.current;if(!C)return;let L=()=>{let S=C.getBoundingClientRect();if(t==="page"&&!Ye(p.current)){let B=nl(S.width,window.innerHeight);if(Math.abs(B-S.height)>1){h(B);return}}let x=window.devicePixelRatio||1;u.current={width:S.width,height:S.height},C.width=Math.round(S.width*x),C.height=Math.round(S.height*x),w()};if(L(),typeof ResizeObserver>"u")return;let v=new ResizeObserver(L);return v.observe(C),()=>v.disconnect()},[w,t]);let P=()=>i?.(p.current.slice());nh(c,()=>({undo(){p.current=p.current.slice(0,-1),w(),P()},clear(){p.current=[],d.current=null,w(),P()},restore(C){p.current=C.slice(),d.current=null,w(),P()},isEmpty:()=>!Ye(p.current),strokes:()=>p.current.slice(),surface:b,toBlob:C=>ls(p.current,C==="page"?b():null,m)}));let g=C=>{let L=C.currentTarget.getBoundingClientRect(),v=C.nativeEvent,S=typeof v.getCoalescedEvents=="function"?v.getCoalescedEvents():[];return(S.length?S:[v]).map(B=>({x:B.clientX-L.left,y:B.clientY-L.top,p:rl(B.pointerType,B.pressure)}))},R=(C,L)=>{let S=l.current?.getContext("2d");if(!S)return;let x=C.points.slice(Math.max(L-1,0));if(x.length<2)return;let B=window.devicePixelRatio||1;S.setTransform(B,0,0,B,0,0),S.strokeStyle=yo,S.lineCap="round",S.lineJoin="round";for(let E=1;E<x.length;E++)S.lineWidth=dn(m,C.pen,(x[E-1].p+x[E].p)/2),S.beginPath(),S.moveTo(x[E-1].x,x[E-1].y),S.lineTo(x[E].x,x[E].y),S.stroke()},_=C=>{if(tl(C.pointerType,vo)&&!(C.pointerType==="mouse"&&C.button!==0)&&!d.current){try{C.currentTarget.setPointerCapture(C.pointerId)}catch{}s?.(),d.current={id:C.pointerId,stroke:{points:g(C).slice(-1),pen:C.pointerType==="pen"}}}},A=C=>{let L=d.current;if(!L||L.id!==C.pointerId)return;let v=L.stroke.points.length;L.stroke.points.push(...g(C)),R(L.stroke,v)},I=C=>{let L=d.current;!L||L.id!==C.pointerId||(d.current=null,p.current=[...p.current,L.stroke],w(),P())};return eh("canvas",{ref:l,className:a,style:f?{height:f}:void 0,role:"img","aria-label":o,onPointerDown:_,onPointerMove:A,onPointerUp:I,onPointerCancel:I})});var ko={latex:"",stale:!1,state:"idle"},hl=e=>!!e.latex&&!e.stale&&e.state==="idle";function fl(e){let t=e.setTimer??((u,f)=>setTimeout(u,f)),r=e.clearTimer??(u=>clearTimeout(u)),n=ko,o=null,a=null,s=!1,i=!1,c=u=>{n=u,i||e.onView(n)},l=()=>{o!==null&&r(o),o=null},p=()=>{a?.abort(),a=null},d=async()=>{if(l(),p(),!s||i)return;let u=new AbortController;a=u,c({...n,state:"reading"});try{let f=(await e.read(u.signal)).trim();if(u.signal.aborted)return;a=null,c(f?{latex:f,stale:!1,state:"idle"}:{latex:"",stale:!1,state:"failed"})}catch{if(u.signal.aborted)return;a=null,c({latex:"",stale:!1,state:"failed"})}};return{strokeStart(){l(),p(),c({...n,stale:!!n.latex,state:"idle"})},changed(u){if(s=u,l(),p(),!u){c(ko);return}c({...n,stale:!!n.latex,state:"idle"}),o=t(()=>{o=null,d()},700)},retry(){n.state==="failed"&&d()},dispose(){i=!0,l(),p()},view:()=>n}}function ds({handler:e,onInsert:t,onClose:r}){let n=ce(),o=gl(null),a=gl(null),[s,i]=mh(ko);uh(()=>{let l=fl({onView:i,read:async p=>{let d=await o.current?.toBlob("crop");if(!d||!e.recognizeHandwriting)throw new Error("unreadable");if(p.aborted)throw new Error("aborted");let{latex:u}=await e.recognizeHandwriting(d,{signal:p});return u}});return a.current=l,()=>{l.dispose(),a.current=null}},[e]);let c=s.state==="failed"?n.sheetPadFailed:s.latex?n.sheetPadFix:n.sheetPadHelp;return Mr("div",{className:"edp-sheet-panel",role:"dialog","aria-label":n.sheetPadTitle,children:[Mr("div",{className:"edp-sheet-panel-head",children:[$t("strong",{children:n.sheetPadTitle}),$t("button",{type:"button",className:"edp-sheet-panel-close",onClick:r,"aria-label":n.sheetClose,children:"\xD7"})]}),Mr("div",{className:"edp-sheet-pad-result","aria-live":"polite","aria-busy":s.state==="reading",children:[s.state==="reading"&&$t("span",{className:"player-ai-spinner","aria-hidden":"true"}),s.latex&&$t("span",{className:s.stale?"edp-sheet-pad-latex edp-sheet-pad-latex--stale":"edp-sheet-pad-latex",dir:"ltr",dangerouslySetInnerHTML:{__html:Le(s.latex,!1)}})]}),Mr("p",{className:"edp-sheet-pad-help",children:[c,s.state==="failed"&&Mr(ph,{children:[" ",$t("button",{type:"button",className:"edp-sheet-pad-retry",onClick:()=>a.current?.retry(),children:n.sheetPhotoRetry})]})]}),$t(wo,{ref:o,variant:"pad",className:"edp-sheet-pad",ariaLabel:n.sheetPadTitle,onStrokeStart:()=>a.current?.strokeStart(),onChange:l=>a.current?.changed(Ye(l))}),Mr("div",{className:"edp-sheet-panel-actions",children:[$t("button",{type:"button",className:"edp-sheet-btn",onClick:()=>o.current?.undo(),children:n.sheetPadUndo}),$t("button",{type:"button",className:"edp-sheet-btn",onClick:()=>o.current?.clear(),children:n.sheetPadClear}),$t("button",{type:"button",className:"edp-sheet-btn edp-sheet-btn--primary",disabled:!hl(s),onClick:()=>t(s.latex),children:n.sheetPadInsert})]})]})}import{jsx as Ie,jsxs as Ft}from"react/jsx-runtime";import{useEffect as hh,useRef as Er,useState as So}from"react";import{X as fh}from"lucide-react";import bl from"clsx";var yl=4,gh=()=>({pages:[{id:1,strokes:[],box:null,version:0,stored:null}],current:0,nextId:2}),ps=e=>e.filter(t=>Ye(t.strokes)),xl=e=>Ye(e.strokes)&&e.stored?.version!==e.version;function vl({nodeId:e,handler:t,draft:r,startLines:n,onDone:o,onType:a,onClose:s}){let i=ce(),c=Er(null),[l,p]=So(()=>r.current??gh()),d=Er(l),u=M=>{d.current=M,r.current=M,p(M)},[f,h]=So("write"),[m,b]=So(null),[w,P]=So(null),g=Er(new Map),R=Er(new AbortController),_=Er(null);hh(()=>{let M=new AbortController;return R.current=M,()=>{M.abort(),_.current?.abort()}},[]);let A=l.pages[l.current],I=ml("page"),C=Er(null),L=()=>requestAnimationFrame(()=>{let M=C.current;M&&M.getBoundingClientRect().top<0&&M.scrollIntoView({block:"start"})}),v=(M,k)=>{let W=d.current;u({...W,pages:W.pages.map(V=>V.id===M?k(V):V)})},S=M=>{if(!xl(M)||!M.box)return;let k=`${M.id}:${M.version}`;if(g.current.has(k))return;let W=ls(M.strokes,M.box,I).then(V=>{if(!V)throw new Error("encode_failed");return t.uploadPhoto(V,{signal:R.current.signal})}).then(V=>v(M.id,ne=>({...ne,stored:{photo:V,version:M.version}}))).catch(()=>{g.current.delete(k)});g.current.set(k,W)},x=M=>{let k=c.current?.surface()??null;P(null),v(A.id,W=>({...W,strokes:M,box:k,version:W.version+1}))},B=()=>{let M=A.strokes;c.current?.clear(),v(A.id,k=>({...k,cleared:M}))},E=()=>{if(Ye(A.strokes))c.current?.undo();else if(A.cleared?.length){let M=A.cleared;c.current?.restore(M),v(A.id,k=>({...k,cleared:void 0}))}},y=Ye(A.strokes)||!!A.cleared?.length,K=M=>{let k=d.current;M===k.current||M<0||M>=k.pages.length||(S(k.pages[k.current]),P(null),u({...k,current:M}),L())},F=()=>{let M=d.current;if(M.pages.length>=yl)return;S(M.pages[M.current]),P(null);let k={id:M.nextId,strokes:[],box:null,version:0,stored:null};u({pages:[...M.pages,k],current:M.pages.length,nextId:M.nextId+1}),L()},Y=M=>{let k=d.current;if(k.pages.length<=1)return;let W=k.pages[M],V=k.pages.filter((le,Z)=>Z!==M),ne=Math.min(M<=k.current?Math.max(k.current-1,0):k.current,V.length-1);u({...k,pages:V,current:ne}),P(Ye(W.strokes)||W.cleared?.length?{page:W,index:M}:null)},$=()=>{if(!w)return;let M=d.current,k=Math.min(w.index,M.pages.length),W=[...M.pages.slice(0,k),w.page,...M.pages.slice(k)];P(null),u({...M,pages:W,current:k}),L()},O=async()=>{let M=new AbortController;if(_.current=M,P(null),b(null),h("reading"),ps(d.current.pages).forEach(S),await Promise.all(g.current.values()),M.signal.aborted)return;let k=ps(d.current.pages);if(k.length===0)return h("write");if(k.some(xl)){b("send"),h("error");return}let W=k.map(V=>V.stored.photo);try{let{shown:V}=await os(t,{photos:W,purpose:"answer",nodeId:e,upright:!0},{signal:M.signal,startLines:n});if(M.signal.aborted)return;if(V===0){b("unreadable"),h("error");return}r.current=null,o()}catch(V){if(M.signal.aborted||R.current.signal.aborted)return;b(Jr(V)),h("error")}},G=()=>{_.current?.abort(),h("write")},T={unreadable:i.sheetPadFailed,limit:i.sheetPhotoLimit,busy:i.sheetPhotoBusy,network:i.sheetPhotoNetwork,cut:i.sheetPhotoCut,failed:i.sheetPhotoFailed,send:i.sheetInkSendFailed},N=ps(l.pages).length,H=f==="reading";return Ft("div",{className:"edp-sheet-panel edp-ink",role:"dialog","aria-label":i.sheetInkTitle,children:[Ft("div",{className:"edp-sheet-panel-head",children:[Ie("strong",{children:i.sheetInkTitle}),Ie("button",{type:"button",className:"edp-sheet-panel-close",onClick:s,"aria-label":i.sheetClose,children:"\xD7"})]}),Ie("p",{className:"edp-ink-help",children:i.sheetInkHelp}),Ie("div",{ref:C}),l.pages.length>1&&Ie("ul",{className:"edp-ink-tabs","aria-label":i.sheetPhotoPages,children:l.pages.map((M,k)=>Ft("li",{className:bl("edp-ink-tab",k===l.current&&"is-current"),children:[Ie("button",{type:"button",className:"edp-ink-tab-go",onClick:()=>K(k),"aria-current":k===l.current?"page":void 0,disabled:H,children:i.sheetInkPageN(k+1)}),!H&&Ie("button",{type:"button",className:"edp-ink-tab-remove",onClick:()=>Y(k),"aria-label":`${i.sheetInkRemovePage} (${k+1})`,children:Ie(fh,{size:14,"aria-hidden":"true"})})]},M.id))}),w&&!H&&Ft("p",{className:"edp-ink-removed",role:"status",children:[i.sheetInkPageRemoved(w.index+1)," ",Ie("button",{type:"button",className:"edp-sheet-pad-retry",onClick:$,children:i.sheetPadUndo})]}),Ie(wo,{ref:c,variant:"page",className:bl("edp-ink-page",H&&"is-busy"),initialStrokes:A.strokes,initialHeight:Ye(A.strokes)?A.box?.height:void 0,ariaLabel:i.sheetInkCanvas(l.current+1),onChange:x},A.id),f==="write"&&Ft("div",{className:"edp-sheet-panel-actions",children:[Ie("button",{type:"button",className:"edp-sheet-btn",onClick:E,disabled:!y,children:i.sheetPadUndo}),Ie("button",{type:"button",className:"edp-sheet-btn",onClick:B,disabled:!Ye(A.strokes),children:i.sheetPadClear}),Ft("button",{type:"button",className:"edp-sheet-btn",onClick:F,disabled:l.pages.length>=yl||!Ye(A.strokes),children:["+ ",i.sheetPhotoAddPage]}),Ie("button",{type:"button",className:"edp-sheet-btn edp-sheet-btn--primary edp-sheet-btn--end",onClick:()=>{O()},disabled:N===0,children:i.sheetInkRead(N)})]}),H&&Ft("div",{className:"edp-sheet-progress",role:"status",children:[Ie("span",{className:"player-ai-spinner","aria-hidden":"true"}),Ie("span",{children:i.sheetInkReading}),Ie("button",{type:"button",className:"edp-sheet-btn edp-sheet-btn--end",onClick:G,children:i.sheetPhotoStop})]}),f==="error"&&m&&Ft("div",{className:"edp-sheet-error",role:"alert",children:[Ie("p",{children:T[m]}),Ft("div",{className:"edp-sheet-panel-actions",children:[m!=="limit"&&Ie("button",{type:"button",className:"edp-sheet-btn",onClick:()=>m==="unreadable"?h("write"):void O(),children:i.sheetPhotoRetry}),Ie("button",{type:"button",className:"edp-sheet-btn",onClick:a,children:i.sheetPhotoType})]})]})]})}import{jsx as dr,jsxs as wl}from"react/jsx-runtime";import{useState as bh}from"react";import yh from"clsx";function us({photos:e,onView:t}){let r=ce(),[n,o]=bh(0),a=Math.min(n,e.length-1),s=e[a];if(!s)return null;let i=e.length>1;return wl("figure",{className:"edp-sheet-pages",children:[wl("figcaption",{className:"edp-sheet-pages-head",children:[dr("span",{className:"edp-sheet-photos-label",children:r.sheetPages}),i&&dr("span",{className:"edp-sheet-pages-tabs",role:"group","aria-label":r.sheetPages,children:e.map((c,l)=>dr("button",{type:"button",className:yh("edp-sheet-pages-tab",l===a&&"is-active"),"aria-pressed":l===a,"aria-label":r.sheetPageOf(l+1,e.length),onClick:()=>o(l),children:l+1},c.url))})]}),dr("button",{type:"button",className:"edp-sheet-pages-view",onClick:()=>t(s),"aria-label":`${r.sheetPageOf(a+1,e.length)}, ${r.sheetPageOpen}`,children:dr("img",{src:s.url,alt:""})}),i&&dr("span",{className:"edp-sheet-pages-print","aria-hidden":"true",children:e.map((c,l)=>l===a?null:dr("img",{src:c.url,alt:""},c.url))})]})}function pn(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 Rh(e,t,r){let n=e.math!==!1;return{math:n,photo:!!e.photo&&Pa(t),pad:!!e.handwriting&&n&&!!t?.recognizeHandwriting&&r.pad,page:!!e.handwriting&&Et(t)&&r.page}}function Ph(e){if(!e)return null;if(e.type==="aiAnswer"){let t=e.answer,r=t.content?.length?t.content:t.text?an(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 hn({nodeId:e,answerType:t,options:r,placeholder:n,disabled:o,stateClass:a,onChange:s,mediaHandler:i,answerSheetHandler:c}){let l=ce(),p=Ne(),d=un(null),u=vh(()=>pn(l),[l]),[f,h]=Lr([]),[m,b]=Lr(null),w=un(null),P=pl(),[g,R]=Lr(!1),[_,A]=Lr(!1),[I,C]=Lr(null),L=un(null),[v,S]=Lr(null),x=un([]);x.current=f;let{math:B,photo:E,pad:y,page:K}=Rh(r,c,P),F=xh((k,W)=>{s({content:k,text:es(k),wordCount:uo(k),photos:W})},[s]);Sl(()=>{let k=V=>{let ne=(V.answers??[]).find(Z=>Z.nodeId===e&&Z.type===t),le=Ph(ne);le&&(h(le.photos),d.current?.setContent(le.content))},W=()=>{h([]),w.current=null,R(!1),A(!1),d.current?.clear()};return p.on("answers:prefill",k),p.on("answers:reset",W),()=>{p.off("answers:prefill",k),p.off("answers:reset",W)}},[p,e,t]);let Y=(k,W)=>{let V=[...x.current,...W];h(V),x.current=V;let ne=d.current?.getContent()??[],le=Nr(ne)?k:[...ne,...k];d.current?.setContent(le),F(le,V),R(!0),b(null)},$=k=>{let W=new Set(x.current.map(ne=>ne.url)),V=[...x.current,...k.filter(ne=>!W.has(ne.url))];h(V),x.current=V,F(d.current?.getContent()??[],V)},O=k=>{let W=d.current?.beginLines(),V=!0;return{add(ne){W&&(V&&(V=!1,$(k),R(!0)),ne.unsure?.length&&A(!0),W.add(ne))},end(){W?.end()}}},G=un(()=>{});G.current=(k,W,V)=>{if(!d.current||k.length===0)return;V==="replace"&&d.current.clear(),$(W),R(!0),k.some(le=>le.unsure?.length)&&A(!0);let ne=d.current.beginLines({at:"end"});for(let le of k)ne.add(le);ne.end()};let T=c?.attachSheet;Sl(()=>{if(!(!T||!E||o))return T(e,{isEmpty:()=>Nr(d.current?.getContent()??[]),placeLines:(k,W,V)=>G.current(k,W,V)})},[T,E,o,e]);let N=()=>{if(m==="photo")return b(null);S(null),b("photo"),as()&&L.current?.click()},H=k=>{let W=f.filter(V=>V.url!==k);h(W),x.current=W,F(d.current?.getContent()??[],W)},M=E||y||K?Pt(kl,{children:[E&&Pt("button",{type:"button",className:mn("edp-sheet-key edp-sheet-key--tool",m==="photo"&&"is-active"),onClick:N,"aria-expanded":m==="photo",children:[Qe(wh,{size:16,"aria-hidden":"true"})," ",l.sheetPhoto]}),y&&Pt("button",{type:"button",className:mn("edp-sheet-key edp-sheet-key--tool",m==="pad"&&"is-active"),onClick:()=>b(m==="pad"?null:"pad"),"aria-expanded":m==="pad",children:[Qe(Sh,{size:16,"aria-hidden":"true"})," ",K?l.sheetHandwritingFormula:l.sheetHandwriting]}),K&&Pt("button",{type:"button",className:mn("edp-sheet-key edp-sheet-key--tool",m==="ink"&&"is-active"),onClick:()=>b(m==="ink"?null:"ink"),"aria-expanded":m==="ink",children:[Qe(kh,{size:16,"aria-hidden":"true"})," ",l.sheetInkPage]})]}):null;return Pt("div",{className:mn("edp-sheet",o&&"edp-sheet--readonly",a),children:[g&&!o&&Pt("p",{className:"edp-sheet-notice",role:"status",children:[l.sheetPhotoCheck,_&&Pt(kl,{children:[" ",l.sheetPhotoUnsure]})]}),Qe("div",{className:"edp-sheet-body",children:Pt("div",{className:mn("edp-sheet-grid",o&&f.length>0&&"has-pages"),children:[Qe(ns,{ref:d,onChange:k=>F(k,x.current),disabled:o,placeholder:n||(B?l.sheetPlaceholder:l.longAnswerPlaceholder),keys:B,extraTools:M,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}),o&&f.length>0&&Qe(us,{photos:f,onView:C})]})}),E&&Qe("input",{ref:L,type:"file",accept:"image/*",capture:"environment",hidden:!0,onChange:k=>{let W=Array.from(k.target.files??[]);k.target.value="",W.length&&S({files:W,key:Date.now()})}}),m==="photo"&&E&&c&&Qe(bo,{nodeId:e,mediaHandler:i,handler:c,incoming:v,startLines:O,onRead:Y,onDone:()=>b(null),onType:()=>{b(null),d.current?.focus()},onClose:()=>b(null)}),m==="pad"&&y&&c&&Qe(ds,{handler:c,onInsert:k=>{d.current?.insertFormula(k),b(null)},onClose:()=>b(null)}),m==="ink"&&K&&Et(c)&&Qe(vl,{nodeId:e,handler:c,draft:w,startLines:O,onDone:()=>b(null),onType:()=>{b(null),d.current?.focus()},onClose:()=>b(null)}),!o&&f.length>0&&m!=="photo"&&Pt("div",{className:"edp-sheet-photos",children:[Qe("span",{className:"edp-sheet-photos-label",children:l.sheetPhotoYours}),f.map(k=>Pt("span",{className:"edp-sheet-photo",children:[Qe("button",{type:"button",className:"edp-sheet-photo-view",onClick:()=>C(k),"aria-label":l.sheetPhotoYours,children:Qe("img",{src:k.url,alt:""})}),Qe("button",{type:"button",className:"edp-sheet-photo-remove",onClick:()=>H(k.url),"aria-label":l.sheetPhotoRemove,children:"\xD7"})]},k.url))]}),I&&Qe(go,{src:I.url,alt:o?l.sheetPages:l.sheetPhotoYours,closeLabel:l.sheetClose,onClose:()=>C(null)})]})}import{jsx as fn,jsxs as Ch,Fragment as Ah}from"react/jsx-runtime";import{Fragment as Rl}from"react";function Pl({text:e}){let t=an(e);return fn(Ah,{children:t.map((r,n)=>Ch(Rl,{children:[n>0&&fn("br",{}),r.type==="blockMath"?fn("span",{className:"edp-math-text-formula",dir:"ltr",dangerouslySetInnerHTML:{__html:Le(String(r.attrs?.latex??""),!1)}}):(r.content??[]).map((o,a)=>o.type==="inlineMath"?fn("span",{className:"edp-math-text-formula",dir:"ltr",dangerouslySetInnerHTML:{__html:Le(String(o.attrs?.latex??""),!1)}},a):fn(Rl,{children:o.text},a))]},n))})}function Hn({node:e,validationFeedback:t,readOnly:r=!1,mediaHandler:n,answerSheetHandler:o}){let a=Ne(),s=ce(),{id:i,attrs:c}=e,{placeholder:l,minWords:p=0,maxWords:d=500,hint:u}=c,f=!!(c.math||c.photo||c.handwriting),[h,m]=Al(""),[b,w]=Al(0),P=t?.showFeedback??!1,g=t?.state,R=d<=30,_=hs($=>$.trim().split(/\s+/).filter(Boolean).length,[]);ms(()=>{let $=O=>{let T=O.answers?.find(N=>N.nodeId===i&&N.type==="aiAnswer");if(T&&T.answer?.text!=null){let N=T.answer.text;m(N),w(_(N))}};return a.on("answers:prefill",$),()=>a.off("answers:prefill",$)},[i,a,_]),ms(()=>{let $=()=>{m(""),w(0)};return a.on("answers:reset",$),()=>a.off("answers:reset",$)},[a]);let A=Nl(null),I=hs(($,O)=>{A.current&&clearTimeout(A.current),A.current=setTimeout(()=>{a.emit({type:"answer:changed",answer:{nodeId:i,type:"aiAnswer",timestamp:Date.now(),answer:{text:$,wordCount:O}}})},300)},[i,a]);ms(()=>{a.emit({type:"answer:changed",answer:{nodeId:i,type:"aiAnswer",timestamp:Date.now(),answer:{text:"",wordCount:0}}})},[]);let C=$=>{if(P)return;let O=_($);m($),w(O),I($,O)},L=Nl(null),v=hs($=>{w($.wordCount),L.current&&clearTimeout(L.current),L.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]),S=g==="validating",x=Ir("player-ai-count",b>d&&"player-ai-count--over"),B=!P||S?"":g==="correct"?"player-ai-input--correct":g==="incorrect"?"player-ai-input--incorrect":g==="partial"?"player-ai-input--partial":"",E=g==="correct"?"player-ai-feedback--correct":g==="incorrect"?"player-ai-feedback--incorrect":g==="partial"?"player-ai-feedback--partial":"",y=$=>Number.isInteger($)?String($):$.toFixed(2),K=t,F=(K?.lines??[]).filter($=>!!$.feedback||$.score!=null&&$.maxScore!=null),Y=$=>c.math?je(Pl,{text:$}):$;return gt("div",{className:Ir("player-ai",f&&"player-ai--sheet"),children:[gt("div",{className:"player-ai-counts",children:[gt("span",{className:x,children:[b," / ",d," ",s.openResponseWords]}),p>0&&b<p&&je("span",{className:"player-ai-count player-ai-count--min",children:s.minWordsLabel(p)}),je("span",{style:{marginInlineStart:"auto"},children:je(kt,{hint:u})})]}),f?je(hn,{nodeId:i,answerType:"aiAnswer",options:{math:c.math,photo:c.photo,handwriting:c.handwriting},placeholder:l,disabled:P||r,stateClass:B,onChange:v,mediaHandler:n,answerSheetHandler:o}):R?je("input",{type:"text",value:h,onChange:$=>C($.target.value),placeholder:l??s.shortAnswerPlaceholder,"aria-label":s.blankAnswerAria,disabled:P,className:Ir("player-ai-input",B)}):je("textarea",{value:h,onChange:$=>C($.target.value),placeholder:l??s.longAnswerPlaceholder,"aria-label":s.blankAnswerAria,disabled:P,rows:5,className:Ir("player-ai-input player-ai-input--multiline",B)}),P&&t&&je("div",{className:Ir("player-ai-feedback",E),children:S?gt("div",{className:"player-ai-validating",children:[je("span",{className:"player-ai-spinner"}),je("span",{children:s.aiEvaluationInProgress})]}):gt(Cl,{children:[F.length>0?gt(Cl,{children:[je("ul",{className:"player-ai-lines",children:F.map(($,O)=>gt("li",{className:"player-ai-line",children:[gt("div",{className:"player-ai-line-head",children:[je("span",{className:"player-ai-line-label",children:Y($.label)}),$.score!=null&&$.maxScore!=null&&gt("span",{className:Ir("player-ai-line-mark",Nh($)),children:[y($.score)," / ",y($.maxScore)]})]}),$.feedback&&je("p",{className:"player-ai-line-text",children:Y($.feedback)})]},O))}),K?.next&&gt("p",{className:"player-ai-next",children:[je("span",{className:"player-ai-next-mark","aria-hidden":"true",children:"\u2192"}),je("span",{children:Y(K.next)})]})]}):t.message&&je("p",{className:"player-ai-message",children:Y(t.message)}),t.score!=null&&t.maxScore!=null&&je("div",{className:"player-ai-score-row",children:gt("span",{className:"player-ai-score",children:[y(t.score)," / ",y(t.maxScore)]})})]})})]})}function Nh(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 j,jsxs as ue,Fragment as gn}from"react/jsx-runtime";import{useState as Xe,useEffect as Ze,useRef as Ue,useCallback as Ro}from"react";import{useEditor as Th,EditorContent as _h}from"@tiptap/react";import Mh from"@tiptap/starter-kit";import zt from"clsx";import{FolderOpen as Eh,Mic as Lh,Video as Tl,Monitor as Ih,Clock as $h,Image as Fh,FileText as _l,Music as zh,Link2 as Dh,Check as Oh,AlertCircle as Bh}from"lucide-react";function Ml(e){return e.trim().split(/\s+/).filter(Boolean).length}function El(e){return e.length}function jh(e){let t=r=>r.map(n=>(n.text??"")+(n.content?t(n.content):"")).join(" ");return Ml(t(e))}function qh(e){let t=r=>r.map(n=>(n.text??"")+(n.content?t(n.content):"")).join("");return El(t(e))}function Hh(e){return/youtube\.com|youtu\.be/i.test(e)?"youtube":/vimeo\.com/i.test(e)?"vimeo":"other"}function Uh(e){let t=e.match(/[?&]v=([^&]+)/)||e.match(/youtu\.be\/([^?]+)/)||e.match(/embed\/([^?]+)/);return t?t[1]:null}function fs(e){let t=Math.floor(e/60),r=e%60;return`${t}:${r.toString().padStart(2,"0")}`}function Un({node:e,validationFeedback:t,readOnly:r=!1,mediaHandler:n,answerSheetHandler:o}){let a=Ne(),s=ce(),{id:i,attrs:c}=e,{mode:l,placeholder:p,allowFormatting:d,wordLimit:u,characterLimit:f,allowedTypes:h,allowMultiple:m,fileInstructions:b,maxDuration:w,hint:P}=c,g=l==="text"&&!!(c.math||c.photo||c.handwriting),R=r||(t?.showFeedback??!1),_=t?.state,A=Ue(null),I=Ro(x=>{A.current&&clearTimeout(A.current),A.current=setTimeout(()=>{let B=x.files?.map(E=>({url:E.url,mimeType:E.kind==="videoLink"?"video/x-link":E.mimeType,name:E.kind==="videoLink"?void 0:E.name,duration:E.kind==="videoLink"?void 0:E.duration}));a.emit({type:"answer:changed",answer:{nodeId:i,type:"openResponse",timestamp:Date.now(),answer:{...x,files:B}}})},300)},[i,a]);Ze(()=>{I({})},[]);let[C,L]=Xe([]);Ze(()=>{(l==="file"||l==="text+file")&&l==="file"&&I({files:C})},[C,l]),Ze(()=>{let x=()=>{L([])};return a.on("answers:reset",x),()=>a.off("answers:reset",x)},[a]),Ze(()=>{let x=B=>{let y=(B.answers??[]).find(K=>K.nodeId===i&&K.type==="openResponse");y&&(A.current&&(clearTimeout(A.current),A.current=null),y.answer?.files&&L(y.answer.files))};return a.on("answers:prefill",x),()=>a.off("answers:prefill",x)},[i,a]);let v=t?.showFeedback,S=zt(!v&&"player-or-field--pre",v&&_==="correct"&&"player-or-field--correct",v&&_==="partial"&&"player-or-field--partial",v&&_==="incorrect"&&"player-or-field--incorrect",v&&_==="awaiting_review"&&"player-or-field--review");return ue("div",{className:"my-3 space-y-2",children:[!R&&P&&P.length>0&&j("div",{className:"flex justify-end",children:j(qt,{hint:P})}),g&&j(hn,{nodeId:i,answerType:"openResponse",options:{math:c.math,photo:c.photo,handwriting:c.handwriting},placeholder:p,disabled:R,stateClass:S,onChange:x=>I({text:{content:x.content,wordCount:x.wordCount},...x.photos.length?{photos:x.photos}:{}}),mediaHandler:n,answerSheetHandler:o}),l==="text"&&!g&&j(Ll,{nodeId:i,placeholder:p,allowFormatting:d,wordLimit:u,characterLimit:f,isDisabled:R,feedbackBorderClass:S,emitAnswer:x=>I({text:x}),answerBus:a}),l==="file"&&j(gs,{allowedTypes:h??["image"],allowMultiple:!!m,fileInstructions:b,isDisabled:R,feedbackBorderClass:S,files:C,setFiles:L,mediaHandler:n,t:s}),(l==="audio"||l==="video"||l==="screen")&&j(ef,{nodeId:i,answerBus:a,kind:l,maxDuration:w,isDisabled:R,feedbackBorderClass:S,mediaHandler:n,emitAnswer:x=>I({recording:x}),t:s}),l==="text+file"&&j(Gh,{nodeId:i,placeholder:p,allowFormatting:d,wordLimit:u,characterLimit:f,allowedTypes:h??["image"],allowMultiple:!!m,fileInstructions:b,isDisabled:R,feedbackBorderClass:S,files:C,setFiles:L,emitAnswer:I,answerBus:a,mediaHandler:n,t:s}),t?.showFeedback&&_==="awaiting_review"&&ue("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:[j($h,{size:15,style:Te(15),className:"animate-pulse"}),j("span",{children:s.openResponseAwaitingReview})]}),t?.showFeedback&&_!=="awaiting_review"&&t.teacherFeedback&&j(tf,{feedback:t.teacherFeedback,feedbackState:_,score:t.score,t:s})]})}function Ll({nodeId:e,placeholder:t,allowFormatting:r,wordLimit:n,characterLimit:o,isDisabled:a,feedbackBorderClass:s,emitAnswer:i,answerBus:c}){let l=ce(),[p,d]=Xe(""),[u,f]=Xe(0),[h,m]=Xe(0),b=Ue(null),w=Ro(()=>{let y=b.current;y&&(y.style.height="auto",y.style.height=`${y.scrollHeight}px`)},[]),P=Th({extensions:[Mh.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1})],immediatelyRender:!1,editable:!a,content:"",onUpdate({editor:y}){if(a||!r)return;let F=y.getJSON().content??[],Y=jh(F),$=qh(F);f(Y),m($),i({content:F,wordCount:Y})}});Ze(()=>{P&&P.setEditable(!a,!1)},[a,P]);let g=Ue(null);Ze(()=>{P&&g.current!==null&&(P.commands.setContent({type:"doc",content:g.current}),g.current=null)},[P]),Ze(()=>{let y=K=>{let F=(K.answers??[]).find($=>$.nodeId===e&&$.type==="openResponse");if(!F?.answer?.text)return;let Y=F.answer.text.content??[];if(r)P?P.commands.setContent({type:"doc",content:Y}):g.current=Y;else{let $=Y.flatMap(O=>O.content?.map(G=>G.text??"")??[O.text??""]).join(`
7
- `);d($),setTimeout(w,0)}};return c.on("answers:prefill",y),()=>c.off("answers:prefill",y)},[e,c,r,P]),Ze(()=>{let y=()=>{r&&P?P.commands.clearContent():(d(""),setTimeout(w,0)),f(0),m(0)};return c.on("answers:reset",y),()=>c.off("answers:reset",y)},[c,r,P,w]);let R=!!n,_=!!o&&!n,A=R?u:h,I=R?n?.max:o?.max,C=R?n?.min:o?.min,L=I!=null&&A>I,v=I!=null&&A>=I*.8&&!L,S=C!=null&&A<C&&A>0,x="text-xs tabular-nums",B=L?{color:"var(--pen, #d23b2b)",fontWeight:500}:v||S?{color:"var(--almost, #c8810e)"}:{color:"var(--ink-faint, #8d93a0)"},E=R?I?`${u} / ${I} ${l.openResponseWords}`:C?`${u} ${l.openResponseWords} (min. ${C})`:`${u} ${l.openResponseWords}`:_?I?`${h} / ${I} ${l.openResponseChars}`:`${h} ${l.openResponseChars}`:null;return r?ue("div",{className:"relative",children:[ue("div",{className:zt("rounded border transition-colors min-h-[120px]",s),children:[!a&&ue("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:y,cmd:K,style:F})=>j("button",{type:"button",onMouseDown:Y=>{Y.preventDefault(),P?.chain().focus()?.[K]().run()},className:`text-xs px-1.5 py-0.5 rounded hover:bg-gray-100 ${F}`,children:y},y)),j("button",{type:"button",onMouseDown:y=>{y.preventDefault(),P?.chain().focus().toggleBulletList().run()},className:"text-xs px-1.5 py-0.5 rounded hover:bg-gray-100",children:"\u2022\u2014"})]}),j(_h,{editor:P,className:"prose prose-sm max-w-none p-3 outline-none [&_.ProseMirror]:min-h-[80px] [&_.ProseMirror]:outline-none"})]}),E&&j("div",{className:zt("absolute bottom-2 right-3",x),style:B,children:E})]}):ue("div",{className:"relative",children:[j("textarea",{ref:b,value:p,onChange:y=>{if(a)return;let K=y.target.value;d(K);let F=Ml(K),Y=El(K);f(F),m(Y),w(),i({content:[{type:"paragraph",content:[{type:"text",text:K}]}],wordCount:F})},onInput:w,disabled:a,placeholder:t||l.openResponseTextPlaceholder,rows:4,style:{resize:"none",overflow:"hidden"},className:zt("w-full px-3 py-2 text-base min-h-[100px] rounded border transition-colors outline-none",s,a&&"cursor-default")}),E&&j("div",{className:zt("absolute bottom-2 right-3",x),children:E})]})}var Kh={image:"image/*",pdf:"application/pdf",audio:"audio/*",video:"video/*"},Wh={image:j(Fh,{size:12,style:Te(12)}),pdf:j(_l,{size:12,style:Te(12)}),audio:j(zh,{size:12,style:Te(12)}),video:j(Tl,{size:12,style:Te(12)}),videoLink:j(Dh,{size:12,style:Te(12)})};function gs({allowedTypes:e,allowMultiple:t,fileInstructions:r,isDisabled:n,files:o,setFiles:a,mediaHandler:s,t:i,compact:c=!1}){let l=Ue(null),[p,d]=Xe(!1),[u,f]=Xe(!1),[h,m]=Xe(""),b=e.some(v=>v!=="videoLink"),w=e.includes("videoLink"),P=t||o.length===0,g=e.filter(v=>v!=="videoLink").map(v=>Kh[v]).filter(Boolean).join(","),R=Ro(v=>{a(S=>t?[...S,v]:[v])},[t,a]),_=Ro(v=>{a(S=>S.filter((x,B)=>B!==v))},[a]),A=async v=>{if(!(!P||n)){d(!0);try{let S=v.type.startsWith("image/")?"image":v.type==="application/pdf"?"document":v.type.startsWith("audio/")?"audio":v.type.startsWith("video/")?"video":"file";if(s){let x=await s.upload(v,S);R({kind:"file",url:x.url,mimeType:x.mimeType??v.type,name:v.name})}else{let x=URL.createObjectURL(v);R({kind:"file",url:x,mimeType:v.type,name:v.name})}}finally{d(!1)}}},I=async v=>{if(v.preventDefault(),f(!1),n||!P)return;let S=v.dataTransfer.files?.[0];S&&await A(S)},C=()=>{let v=h.trim();v&&(R({kind:"videoLink",url:v,platform:Hh(v)}),m(""))},L={image:i.openResponseTypeImage,pdf:i.openResponseTypePdf,audio:i.openResponseTypeAudio,video:i.openResponseTypeVideo,videoLink:i.openResponseTypeVideoLink};return ue("div",{className:"space-y-2",children:[r&&!c&&j("p",{className:"text-sm text-gray-600 italic",children:r}),o.length>0&&j("div",{className:c?"flex flex-wrap gap-1.5":"space-y-2",children:o.map((v,S)=>j(Vh,{file:v,onRemove:n?void 0:()=>_(S),compact:c,t:i},S))}),!n&&P&&ue("div",{className:"space-y-2",children:[b&&!c&&ue("div",{onDragOver:v=>{v.preventDefault(),f(!0)},onDragLeave:()=>f(!1),onDrop:I,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:[j(Eh,{size:26,className:"mx-auto mb-2",style:{...Te(26),color:"var(--ink-soft, #565b66)"}}),j("p",{className:"text-sm font-medium",style:{color:"var(--ink-soft, #565b66)"},children:i.openResponseDropZoneLabel}),j("p",{className:"text-xs hover:underline mt-0.5",style:{color:"var(--ink, #1d2025)"},children:i.openResponseDropZoneBrowse}),p&&j("p",{className:"text-xs mt-1 animate-pulse",style:{color:"var(--ink-faint, #8d93a0)"},children:i.openResponseUploading}),j("div",{className:"flex flex-wrap justify-center gap-1.5 mt-3",children:e.filter(v=>v!=="videoLink").map(v=>ue("span",{className:"inline-flex items-center gap-1 text-[10px] px-2 py-0.5 bg-gray-100 text-gray-600 rounded-full",children:[Wh[v]," ",L[v]]},v))})]}),b&&c&&j("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}`}),j("input",{ref:l,type:"file",accept:g,onChange:async v=>{let S=v.target.files?.[0];S&&(await A(S),v.target.value="")},className:"hidden"}),w&&ue("div",{className:"flex gap-2 flex-wrap",children:[j("input",{type:"url",value:h,onChange:v=>m(v.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:v=>{v.key==="Enter"&&(v.preventDefault(),C())}}),j("button",{type:"button",onClick:C,disabled:!h.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&&j("p",{className:"text-sm text-gray-400 text-center py-3",children:i.openResponseNoSubmission})]})}function Vh({file:e,onRemove:t,compact:r,t:n}){if(e.kind==="videoLink"){let o=e.platform==="youtube"?Uh(e.url):null;return ue("div",{className:zt("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&&j("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"}),j("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&&j("button",{type:"button",onClick:t,className:"ml-auto text-gray-400 hover:text-rose-500 text-xs",children:"\u2715"})]})}return ue("div",{className:zt("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/")?j("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:j("span",{className:"flex-1 min-w-0",children:j(vt,{src:e.url,durationHint:e.duration})}):e.mimeType?.startsWith("video/")?j("video",{src:e.url,controls:!0,className:r?"hidden":"h-16 max-w-[240px] rounded"}):j(_l,{size:20,style:{...Te(20),color:"var(--ink-soft, #565b66)"}}),ue("div",{className:"flex-1 min-w-0",children:[j("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/")&&j(vt,{src:e.url,durationHint:e.duration})]}),t&&j("button",{type:"button",onClick:t,className:"ml-auto text-gray-400 hover:text-rose-500 text-xs shrink-0",children:"\u2715"})]})}function Gh({nodeId:e,placeholder:t,allowFormatting:r,wordLimit:n,characterLimit:o,allowedTypes:a,allowMultiple:s,fileInstructions:i,isDisabled:c,feedbackBorderClass:l,files:p,setFiles:d,emitAnswer:u,answerBus:f,mediaHandler:h,t:m}){let[b,w]=Xe(null),[P,g]=Xe(!1);return Ze(()=>{u({...b&&{text:b},files:p.length>0?p:void 0})},[b,p]),ue("div",{className:"space-y-2",children:[j(Ll,{nodeId:e,placeholder:t,allowFormatting:r,wordLimit:n,characterLimit:o,isDisabled:c,feedbackBorderClass:l,emitAnswer:R=>w(R),answerBus:f}),!c&&ue("div",{children:[ue("button",{type:"button",onClick:()=>g(!P),className:"flex items-center gap-1.5 text-xs",style:{color:"var(--ink-soft, #565b66)"},children:[j("span",{children:P?"\u25BE":"\u25B8"}),ue("span",{children:[m.openResponseAttachFiles,p.length>0&&j("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})]})]}),P&&j("div",{className:"mt-1.5",children:j(gs,{allowedTypes:a,allowMultiple:s,fileInstructions:i,isDisabled:c,feedbackBorderClass:l,files:p,setFiles:d,mediaHandler:h,t:m,compact:!0})})]}),c&&p.length>0&&ue("div",{className:"space-y-1",children:[j("p",{className:"text-xs text-gray-500 font-medium",children:m.openResponseAttachedFiles}),j(gs,{allowedTypes:a,allowMultiple:s,isDisabled:!0,feedbackBorderClass:l,files:p,setFiles:d,t:m,compact:!0})]})]})}var Yh=180,Qh={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 Xh(e){if(!(typeof MediaRecorder>"u"||typeof MediaRecorder.isTypeSupported!="function"))return Qh[e].find(t=>MediaRecorder.isTypeSupported(t))}function Jh(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 Zh(e){return e instanceof DOMException?e.name==="AbortError":e?.name==="AbortError"}function ef({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"?Yh:null,[d,u]=Xe("idle"),[f,h]=Xe(null),[m,b]=Xe(null),[w,P]=Xe(0),[g,R]=Xe(null),[_,A]=Xe(null),I=Ue(null),C=Ue(null),L=Ue([]),v=Ue(0),S=Ue(null),x=Ue(null),B=Ue(null),E=Ue(null),y=Ue(0),K=Ue(null),F=Ue(null),Y=Ue(null);Ze(()=>{let Z=ve=>{let ge=(ve.answers??[]).find(xe=>xe.nodeId===e&&xe.type==="openResponse")?.answer?.recording;ge?.url&&(h(ge),u("saved"))},se=()=>{K.current?.abort(),h(null),b(null),A(null),u("idle")};return i.on("answers:prefill",Z),i.on("answers:reset",se),()=>{i.off("answers:prefill",Z),i.off("answers:reset",se)}},[e,i]);let $=()=>{cancelAnimationFrame(y.current);let Z=E.current;E.current=null,Z&&Z.state!=="closed"&&Z.close().catch(()=>{})},O=()=>{C.current?.getTracks().forEach(Z=>Z.stop()),C.current=null};Ze(()=>()=>{S.current&&clearInterval(S.current),$(),O(),K.current?.abort()},[]),Ze(()=>{let Z=m?.url;return()=>{Z&&URL.revokeObjectURL(Z)}},[m?.url]);let G=Z=>{let se=B.current,ve=window.AudioContext||window.webkitAudioContext;if(!se||!ve)return;let ye;try{ye=new ve}catch{return}E.current=ye;let ge=ye.createAnalyser();ge.fftSize=512,ye.createMediaStreamSource(Z).connect(ge);let xe=new Uint8Array(ge.fftSize),We=window.devicePixelRatio||1,He=Math.max(1,se.clientWidth),X=Math.max(1,se.clientHeight);se.width=Math.round(He*We),se.height=Math.round(X*We);let he=se.getContext("2d");if(!he)return;he.scale(We,We);let be=3,z=2,re=[],de=Math.floor(He/(be+z)),ie=0,Pe=ee=>{if(y.current=requestAnimationFrame(Pe),ee-ie<50)return;ie=ee,ge.getByteTimeDomainData(xe);let Ve=0;for(let jt=0;jt<xe.length;jt++){let Nt=(xe[jt]-128)/128;Ve+=Nt*Nt}re.push(Math.min(1,Math.sqrt(Ve/xe.length)*3)),re.length>de&&re.shift(),he.clearRect(0,0,He,X),he.fillStyle="#1d2025";let mt=He-re.length*(be+z);re.forEach((jt,Nt)=>{let hr=Math.max(2,jt*X);he.fillRect(mt+Nt*(be+z),(X-hr)/2,be,hr)})};y.current=requestAnimationFrame(Pe)};Ze(()=>{d==="recording"&&t==="audio"&&C.current&&G(C.current)},[d]);let T=async(Z,se)=>{if(!a)return;let ve=new AbortController;K.current=ve,F.current={file:Z,duration:se},A(null),R(0),u("uploading");try{let ye=await a.upload(Z,l,{onProgress:xe=>{ve.signal.aborted||R(Math.max(0,Math.min(1,xe)))},signal:ve.signal});if(ve.signal.aborted)return;let ge={url:ye.url,mimeType:ye.mimeType??Z.type,duration:se,kind:l};F.current=null,h(ge),u("saved"),s(ge)}catch(ye){if(ve.signal.aborted||Zh(ye))return;u("failed"),A(c.recorderFailed)}finally{R(null)}},N=()=>{K.current?.abort(),F.current=null,b(null),R(null),u(Y.current?"saved":"idle")},H=()=>{let Z=F.current;Z&&T(Z.file,Z.duration)},M=()=>{S.current&&(clearInterval(S.current),S.current=null);let Z=I.current;Z&&Z.state!=="inactive"&&Z.stop()},k=async()=>{if(!a){A(c.recorderUnavailableHere);return}if(!(typeof MediaRecorder<"u"&&typeof navigator<"u"&&!!navigator.mediaDevices?.getUserMedia&&(t!=="screen"||!!navigator.mediaDevices.getDisplayMedia))){A(c.recorderUnsupported);return}K.current?.abort(),Y.current=f,A(null),u("requesting");let se;try{if(t==="screen"){se=await navigator.mediaDevices.getDisplayMedia({video:!0,audio:!1});try{let xe=(await navigator.mediaDevices.getUserMedia({audio:!0})).getAudioTracks()[0];xe&&se.addTrack(xe)}catch{}se.getVideoTracks()[0]?.addEventListener("ended",()=>M())}else t==="video"?se=await navigator.mediaDevices.getUserMedia({audio:!0,video:{facingMode:"user"}}):se=await navigator.mediaDevices.getUserMedia({audio:!0})}catch(ge){let xe=ge?.name;u(f?"saved":"idle"),A(xe==="NotAllowedError"||xe==="SecurityError"||xe==="NotFoundError"?c.openResponsePermissionDenied:c.recorderUnsupported);return}let ve=Xh(l),ye;try{ye=ve?new MediaRecorder(se,{mimeType:ve}):new MediaRecorder(se)}catch{try{ye=new MediaRecorder(se)}catch{se.getTracks().forEach(ge=>ge.stop()),u(f?"saved":"idle"),A(c.recorderUnsupported);return}}C.current=se,I.current=ye,L.current=[],ye.ondataavailable=ge=>{ge.data.size>0&&L.current.push(ge.data)},ye.onstop=()=>{let ge=Math.max(1,Math.round((performance.now()-v.current)/1e3)),xe=ye.mimeType||ve||`${l}/webm`,We=new Blob(L.current,{type:xe});if(L.current=[],$(),O(),x.current&&(x.current.srcObject=null),We.size===0){u(Y.current?"saved":"idle"),A(c.recorderUnsupported);return}let He=new File([We],`recording.${Jh(xe,l)}`,{type:xe});b({url:URL.createObjectURL(We),duration:ge}),T(He,ge)},ye.start(250),v.current=performance.now(),P(0),u("recording"),S.current=setInterval(()=>{let ge=(performance.now()-v.current)/1e3;P(ge),p&&ge>=p&&M()},200)};Ze(()=>{let Z=x.current;d==="recording"&&Z&&C.current&&(Z.srcObject=C.current,Z.play().catch(()=>{}))},[d]);let W=m?.url??f?.url??null,V=m?.duration??f?.duration??null,ne=W?l==="audio"?j(vt,{src:W,durationHint:V}):j("video",{src:W,controls:!0,playsInline:!0,preload:"metadata"}):null;if(n)return j("div",{className:zt("edp-rec",o),children:f?l==="audio"?j(vt,{src:f.url,durationHint:f.duration}):j("video",{src:f.url,controls:!0,playsInline:!0,preload:"metadata"}):j("p",{className:"edp-rec-message",children:c.recorderNone})});let le=t==="audio"?j(Lh,{"aria-hidden":!0}):t==="screen"?j(Ih,{"aria-hidden":!0}):j(Tl,{"aria-hidden":!0});return ue("div",{className:zt("edp-rec",o),children:[(d==="idle"||d==="requesting")&&ue("div",{className:"edp-rec-idle",children:[j("button",{type:"button",className:"edp-rec-record",onClick:k,disabled:d==="requesting"||!a,"aria-label":t==="screen"?c.openResponseTapToRecordScreen:c.recorderRecord,children:le}),j("span",{className:"edp-rec-label",children:d==="requesting"?c.openResponseRequestingPermission:c.recorderRecord}),p&&j("span",{className:"edp-rec-limit",children:c.recorderUpTo(fs(p))}),!a&&j("p",{className:"edp-rec-message",children:c.recorderUnavailableHere})]}),d==="recording"&&ue(gn,{children:[l==="video"&&j("video",{ref:x,muted:!0,playsInline:!0}),ue("div",{className:"edp-rec-live",role:"status","aria-label":c.recorderRecordingAria,children:[t==="audio"?j("canvas",{ref:B,className:"edp-rec-level","aria-hidden":!0}):j("span",{style:{flex:1}}),ue("span",{className:"edp-rec-clock",dir:"ltr",children:[j("span",{className:"edp-rec-dot","aria-hidden":!0}),fs(Math.floor(w)),p&&ue("small",{children:["/ ",fs(p)]})]}),ue("button",{type:"button",className:"edp-rec-stop",onClick:M,children:[j("i",{"aria-hidden":!0}),c.openResponseStopRecording]})]})]}),(d==="uploading"||d==="saved"||d==="failed")&&ue(gn,{children:[ne,ue("div",{className:"edp-rec-foot",children:[d==="uploading"&&ue(gn,{children:[j("span",{className:"edp-rec-status","aria-live":"polite",children:g&&g>0?c.recorderSaving(Math.round(g*100)):c.openResponseUploading}),j("span",{className:"edp-rec-progress","aria-hidden":!0,children:j("span",{style:{width:`${Math.round((g??0)*100)}%`}})}),j("button",{type:"button",className:"edp-rec-link",onClick:N,children:c.recorderCancel})]}),d==="saved"&&ue(gn,{children:[ue("span",{className:"edp-rec-status edp-rec-status--ok","aria-live":"polite",children:[j(Oh,{size:16,"aria-hidden":!0}),c.recorderSaved]}),j("button",{type:"button",className:"edp-rec-link",onClick:k,children:c.recorderRecordAgain})]}),d==="failed"&&ue(gn,{children:[ue("span",{className:"edp-rec-status edp-rec-status--error",role:"alert",children:[j(Bh,{size:16,"aria-hidden":!0}),_??c.recorderFailed]}),ue("span",{style:{display:"inline-flex",gap:"1rem"},children:[j("button",{type:"button",className:"edp-rec-link",onClick:H,children:c.recorderRetry}),j("button",{type:"button",className:"edp-rec-link",onClick:k,children:c.recorderRecordAgain})]})]})]})]}),_&&d!=="failed"&&j("p",{className:"edp-rec-message",role:"alert",children:_})]})}function tf({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 ue("div",{className:"rounded p-3 text-sm border",style:{background:o.bg,borderColor:o.border,color:"var(--ink, #1d2025)"},children:[j("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&&ue("div",{className:"mt-1 text-right",style:{fontFamily:'var(--font-hand, "Caveat", cursive)',fontSize:U("1.4rem"),lineHeight:1,color:o.ink},children:[r," pts"]})]})}import{jsx as bt,jsxs as pr,Fragment as Il}from"react/jsx-runtime";import{useEffect as Po,useLayoutEffect as of,useMemo as ys,useRef as bn,useState as $l}from"react";import Fl from"clsx";var rf=e=>/#\?|#0|#@|\\placeholder/.test(e),nf={left:"moveToPreviousChar",right:"moveToNextChar",backspace:"deleteBackward",enter:null};function bs(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?ir(r):null;return n?[n]:[]},refocus(){let r=e.field();if(!r)return;let n=ir(r);n?.blur(),r.focus(),n?.focus({preventScroll:!0})},editable:()=>e.editable(),insert(r){let n=e.field();n&&(r===")"&&Sr(n)||n.executeCommand?.(["insert",r,{selectionMode:rf(r)?"placeholder":"after"}]),t())},command(r){let n=e.field(),o=nf[r];!n||!o||(n.executeCommand?.(o),t())},caret:()=>"formula",caretRect:()=>e.field()?.getBoundingClientRect()??null,labels:()=>e.labels()??kr,dir(){let r=e.root()?.parentElement;return r&&getComputedStyle(r).direction==="rtl"?"rtl":"ltr"}}}function af(e){return e?.showFeedback?e.state==="validating"?"validating":e.state==="correct"?"correct":e.state==="incorrect"?"incorrect":"idle":"idle"}var zl=e=>Number.isInteger(e)?String(e):e.toFixed(2);function Kn({nodeId:e,placeholder:t,hint:r,validationFeedback:n,readOnly:o=!1}){let a=ce(),s=Ne(),i=bn(null),c=bn(null),l=bn(null),[p,d]=$l(""),[u,f]=$l(!1),h=po(),m=ys(()=>pn(a),[a]),b=bn(m);b.current=m;let w=bn(o);w.current=o;let P=af(n),g=n?.score,R=n?.maxScore,_=n?.displayAnswer,A=ys(()=>_?Le(_,!1):"",[_]),I=ys(()=>o&&p?Le(p,!1):"",[o,p]);Po(()=>{let S=!0;return ft().then(x=>S&&x&&f(!0)),()=>{S=!1}},[]),of(()=>{if(!u||o)return;let S=c.current;return Kt(S),()=>to(S)},[u,o]),Po(()=>{if(!u||o)return;let S=bs({field:()=>c.current,root:()=>i.current,editable:()=>!w.current,labels:()=>b.current,onChange:B=>d(B)});l.current=S;let x=_e.register(S);return()=>{x(),l.current=null}},[u,o]),Po(()=>{let S=x=>{let B=x.answers?.find(E=>E.nodeId===e&&E.type==="mathResponse");if(B?.answer?.latex!==void 0){d(B.answer.latex);let E=c.current;E&&(E.value=B.answer.latex)}};return s.on("answers:prefill",S),()=>s.off("answers:prefill",S)},[s,e]),Po(()=>{s.emit({type:"answer:changed",answer:{nodeId:e,type:"mathResponse",timestamp:Date.now(),answer:{latex:p}}})},[p,e,s]);let C=!!l.current&&h.active===l.current,L=S=>{if(o)return;let x=c.current;!x||x.contains(S.target)||(S.preventDefault(),x.focus())},v=()=>{let S=l.current;S&&_e.openFor(S)};return pr("span",{className:"math-response-player edp-slot-wrap",children:[pr("span",{ref:i,dir:"ltr",className:Fl("edp-slot",P!=="idle"&&`edp-slot--${P}`,o&&"edp-slot--readonly",C&&"is-active",!p&&"is-empty"),onMouseDown:L,children:[o&&u?bt("span",{className:"edp-slot-printed",dangerouslySetInnerHTML:{__html:I||"&#8203;"}}):u?bt("math-field",{ref:c,value:p,onInput:S=>d(S.target.value??""),onFocus:S=>Kt(S.currentTarget),"math-virtual-keyboard-policy":"manual","smart-fence":"true","aria-label":a.blankAnswerAria,className:"edp-slot-mf"}):bt("input",{type:"text",value:p,onChange:S=>d(S.target.value),readOnly:o,"aria-label":a.blankAnswerAria,className:"edp-slot-fallback"}),!p&&!C&&!o&&bt("span",{className:"edp-slot-hint","aria-hidden":"true",children:t||a.mathSlotPlaceholder}),u&&!o&&!h.touch&&bt("button",{type:"button",className:Fl("edp-slot-kb",C&&h.mode==="maths"&&"is-open"),onMouseDown:S=>S.preventDefault(),onClick:v,"aria-label":a.kbMaths,title:a.kbMaths,tabIndex:-1,children:"\u2211"})]}),bt(kt,{hint:r}),n?.showFeedback&&P!=="idle"&&pr("span",{className:`edp-slot-feedback edp-slot-feedback--${P}`,role:"status",children:[P==="validating"&&pr(Il,{children:[bt("span",{className:"player-math-spinner"}),bt("span",{children:a.mathChecking})]}),P==="correct"&&pr(Il,{children:[bt("span",{"aria-label":a.mathCorrect,children:"\u2713"}),g!=null&&pr("span",{className:"edp-slot-score",children:[zl(g),R!=null?` / ${zl(R)}`:""]})]}),P==="incorrect"&&bt("span",{"aria-label":a.mathIncorrect,children:"\u2717"}),P==="incorrect"&&A&&pr("span",{className:"player-blank-reveal edp-slot-reveal",children:["(",bt("span",{dangerouslySetInnerHTML:{__html:A}}),")"]})]})]})}import{jsx as we,jsxs as ze,Fragment as vn}from"react/jsx-runtime";import{useCallback as Sf,useEffect as Rf,useRef as Pf,useState as xn}from"react";import{Play as Cf,Lock as Af,Check as vs,X as Bl}from"lucide-react";function No(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,d)=>No(p,l[d]))}let o=e,a=t,s=Object.keys(o),i=Object.keys(a);return s.length!==i.length?!1:s.every(c=>No(o[c],a[c]))}var sf=`
5
+ `).trim()}function xo(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 Dr(e){return xo(e)===0}function fn(e){return(e??"").split(`
6
+ `).map(Gc)}function Gc(e){let t=e.trim().match(/^\$\$([\s\S]+)\$\$$/);if(t)return{type:"blockMath",attrs:{latex:t[1].trim()}};let r=[],n=/\$\$([^$]+)\$\$|\$([^$]+)\$/g,o=0;for(let a=n.exec(e);a;a=n.exec(e))a.index>o&&r.push({type:"text",text:e.slice(o,a.index)}),r.push({type:"inlineMath",attrs:{latex:(a[1]??a[2]).trim()}}),o=a.index+a[0].length;return o<e.length&&r.push({type:"text",text:e.slice(o)}),r.length?{type:"paragraph",content:r}:{type:"paragraph"}}function wo(e,t={}){if(e.kind==="figure")return t.figures==="keep"&&e.box?{type:"photoFigure",attrs:{box:e.box}}:null;let r=(e.value??"").trim();return r?e.kind==="math"?{type:"blockMath",attrs:{latex:r.replace(/^\$+|\$+$/g,"").trim()}}:Gc(r):null}function Or(e,t={}){return e.flatMap(r=>{let n=wo(r,t);return n?[n]:[]})}var bn="edpReading",ko=new Xc("edpUnsureWords"),So=new Xc("edpArrive"),ds="edpArriveClear",Jc=50,Hm=Jc*7;function Zc(e,t){let r=Math.min(Math.max(0,t-e),Hm);return{delay:r,free:e+r+Jc}}function el(e,t){let{doc:r,selection:n}=e;if(Dr(r.toJSON().content??[]))return{pos:0,replace:!0};if(!t.caretPlaced)return{pos:r.content.size,replace:!1};let{$from:o}=n;return{pos:o.depth>=1?o.after(1):n.to,replace:!1}}function tl(e,t,r){return e.replace?Dr(r.doc.toJSON().content??[])?e:{pos:r.doc.content.size,replace:!1}:{pos:Math.min(t.mapping.map(e.pos,-1),r.doc.content.size),replace:!1}}var Yc=e=>e.replace(/\s+/g,"");function Um(e,t,r,n){let o=n.map(s=>s.trim()).filter(Boolean);if(!o.length)return[];let a=[];return e.nodesBetween(t,r,(s,i)=>{if(s.isText){let c=s.text??"";for(let l of o)if(!l.includes("$"))for(let d=c.indexOf(l);d!==-1;d=c.indexOf(l,d+l.length))a.push(ls.inline(i+d,i+d+l.length,{class:"edp-sheet-unsure"}));return!1}if(s.type.name==="inlineMath"||s.type.name==="blockMath"){let c=Yc(String(s.attrs.latex??""));return o.some(d=>{let u=Yc(d.replace(/\$/g,""));return u.length>0&&c.includes(u)})&&a.push(ls.node(i,i+s.nodeSize,{class:"edp-sheet-unsure"})),!1}return!0}),a}function rl(e,t,r,n){let o=wo(r);if(!o)return null;let a;try{a=e.schema.nodeFromJSON(o)}catch{return null}let s=e.tr,i=t.replace?0:Math.min(t.pos,e.doc.content.size);t.replace?s.replaceWith(0,e.doc.content.size,a):s.insert(i,a);let c=i+a.nodeSize;s.setMeta(bn,!0);let l=r.unsure?.length?Um(s.doc,i,c,r.unsure):[];return l.length&&s.setMeta(ko,l),n?.revealDelay!=null&&s.setMeta(So,[ls.node(i,c,{class:"edp-sheet-arrive",style:`animation-delay: ${Math.round(n.revealDelay)}ms`})]),{tr:s,next:{pos:c,replace:!1}}}var Km=new Qc({key:ko,state:{init:()=>gn.empty,apply(e,t){let r=t.map(e.mapping,e.doc),n=e.getMeta(ko);return n?.length&&(r=r.add(e.doc,n)),e.docChanged&&!e.getMeta(bn)&&r!==gn.empty&&e.mapping.maps.forEach((o,a)=>{let s=e.mapping.slice(a+1);o.forEach((i,c,l,d)=>{let u=r.find(s.map(l,-1),s.map(d,1));u.length&&(r=r.remove(u))})}),r}},props:{decorations(e){return ko.getState(e)}}}),Wm=new Qc({key:So,state:{init:()=>gn.empty,apply(e,t){if(e.getMeta(ds))return gn.empty;if(e.docChanged&&!e.getMeta(bn))return gn.empty;let r=t.map(e.mapping,e.doc),n=e.getMeta(So);return n?.length&&(r=r.add(e.doc,n)),r}},props:{decorations(e){return So.getState(e)}}});var nl=qm.create({name:"edpUnsureWords",addProseMirrorPlugins(){return[Km,Wm]}});var oh={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"},sl={power:vr("span",{className:"edp-key-pow",children:["x",vt("sup",{children:"2"})]}),fraction:vr("span",{className:"edp-key-frac",children:[vt("span",{children:"a"}),vt("span",{children:"b"})]}),root:"\u221A",pi:"\u03C0",le:"\u2264",ge:"\u2265",ne:"\u2260",in:"\u2208"},ah=["power","fraction","root","pi","le","ge","ne","in"],sh=280,ih=Zm.create({name:"edpOneLine",priority:1e3,addKeyboardShortcuts(){return{Enter:()=>!0,"Shift-Enter":()=>!0,"Mod-Enter":()=>!0}}}),ps=!1;if(typeof document<"u"){document.addEventListener("pointerdown",()=>ps=!0,!0);for(let e of["pointerup","pointercancel"])document.addEventListener(e,()=>ps=!1,!0)}function ch(e){if(!ps)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 lh(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 th(eh.from(t.nodes.paragraph.create(null,r)),1,1)}function us(e){let t=[];for(let r of e){if(r.type==="inlineMath"||r.type==="blockMath"){let o=Oc(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:us(r.content)}:r)}return t}var ms=Vm(function({initialContent:t,onChange:r,disabled:n=!1,placeholder:o,labels:a,extraTools:s,className:i,keys:c=!0,ariaLabel:l,ariaLabelledBy:d,dir:u,keyboardLabels:p,compact:f=!1,singleLine:h=!1,autoFocus:m=!1,skeletonLines:b=0},y){let x={...oh,...a},A=yn(r);A.current=r;let g=Xm({extensions:[rh.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1}),ja,qa,ns,nl,nh.configure({placeholder:o??"",showOnlyWhenEditable:!0}),...h?[ih]:[]],immediatelyRender:!1,editable:!n,content:t?.length?{type:"doc",content:t}:"",editorProps:{attributes:{class:"edp-sheet-doc",role:"textbox","aria-multiline":h?"false":"true",...l?{"aria-label":l}:{},...d?{"aria-labelledby":d}:{},...u?{dir:u}:{}},...h?{transformPastedText:F=>F.replace(/\s*[\r\n]+\s*/g," "),transformPasted:(F,L)=>lh(F,L.state.schema)}:{}},onUpdate({editor:F}){F.isEditable&&A.current(us(F.getJSON().content??[]))}});yr(()=>{n||yt()},[n]);let T=yn(m&&!n);yr(()=>{if(!g||!T.current)return;let F=0,L,B=()=>{if(!g.isDestroyed){if(g.view.dom?.isConnected){T.current=!1,g.view.dispatch(g.state.tr.setSelection(al.atEnd(g.state.doc))),g.view.focus();return}++F<40&&(L=setTimeout(B,16))}};return L=setTimeout(B,0),()=>clearTimeout(L)},[g]),yr(()=>{g&&os(g,{unwrap:x.unwrap})},[g,x.unwrap]),yr(()=>{g&&p&&as(g,p)},[g,p]);let C=ss(g),E=f||h,[R,M]=Ym(!1),k=yn(null),S=()=>E&&M(!0),v=F=>{!E||F.currentTarget.contains(F.relatedTarget)||ch(()=>{Le.isSwitching()||k.current?.contains(document.activeElement)||M(!1)})};yr(()=>{g&&(g.setEditable(!n,!1),g.view.dispatch(g.state.tr.setMeta("edpSheetEditable",!n)))},[n,g]);let O=yn(null);yr(()=>{g&&O.current&&(g.commands.setContent({type:"doc",content:O.current},{emitUpdate:!1}),O.current=null)},[g]);let _=yn(!1);yr(()=>{if(!g)return;let F=()=>{_.current=!0};return g.on("focus",F),()=>{g.off("focus",F)}},[g]),Gm(y,()=>({setContent(F){g?g.commands.setContent({type:"doc",content:F},{emitUpdate:!1}):O.current=F},clear(){g?.commands.clearContent(!1)},getContent(){return us(g?.getJSON().content??[])},insertFormula(F){if(!g)return;let{to:L}=g.state.selection;g.chain().insertContentAt(L,[{type:"inlineMath",attrs:{latex:F}},{type:"text",text:" "}]).run(),Dt(g)},beginLines(F){if(!g)return{add(){},end(){}};let L=el(g.state,{caretPlaced:F?.at==="end"?!1:_.current}),B=({transaction:P})=>{P.docChanged&&!P.getMeta(bn)&&(L=tl(L,P,g.state))};g.on("transaction",B);let J=0,N=0;return{add(P){if(g.isDestroyed)return;let K=Zc(performance.now(),J),U=rl(g.state,L,P,{revealDelay:K.delay});U&&(J=K.free,N=K.delay,g.view.dispatch(U.tr),L=U.next)},end(){g.off("transaction",B),setTimeout(()=>{g.isDestroyed||g.view.dispatch(g.state.tr.setMeta(ds,!0))},N+sh+100)}}},focus(){!g||g.isDestroyed||(g.view.dispatch(g.state.tr.setSelection(al.atEnd(g.state.doc))),Dt(g))}}),[g]);let w=F=>{g&&!n&&ts(g,F)},X=()=>{g&&!n&&rs(g)},Y=()=>{g&&!n&&hn(g)};return vr("div",{ref:k,onFocusCapture:S,onBlurCapture:v,className:ol("edp-sheet-box",E&&"edp-sheet-box--compact",E&&R&&"edp-sheet-box--keys-open",h&&"edp-sheet-box--line",n&&"edp-sheet-box--readonly",b>0&&"is-reading",b>0&&g?.isEmpty&&"is-empty",i),children:[vr("div",{className:"edp-sheet-page",children:[vt(Jm,{editor:g}),b>0&&vt("div",{className:"edp-sheet-skeleton","aria-hidden":"true",children:Array.from({length:b},(F,L)=>vt("span",{className:"edp-sheet-skeleton-line"},L))})]}),!n&&(c||s)&&vr("div",{className:"edp-sheet-keys",role:"toolbar","aria-label":x.keysAria,children:[c&&vr("span",{className:"edp-sheet-keys-maths",children:[ah.map(F=>vt("button",{type:"button",className:"edp-sheet-key",title:x[F],"aria-label":x[F],onMouseDown:L=>L.preventDefault(),onClick:()=>w(F),children:sl[F]},F)),vt("button",{type:"button",className:ol("edp-sheet-key edp-sheet-key--convert",C&&"is-text"),title:C?x.toText:x.toMaths,"aria-label":C?x.toText:x.toMaths,onMouseDown:F=>F.preventDefault(),onClick:Y,children:C?"Aa":vt("i",{children:"fx"})}),vr("button",{type:"button",className:"edp-sheet-key edp-sheet-key--more",onMouseDown:F=>F.preventDefault(),onClick:X,children:[vt(Qm,{size:16,"aria-hidden":"true"})," ",x.more]})]}),s&&vt("span",{className:"edp-sheet-keys-extra",children:s})]})]})});import{jsx as he,jsxs as Ue,Fragment as il}from"react/jsx-runtime";import{useEffect as Zt,useRef as ft,useState as Br}from"react";import dh from"clsx";import{RotateCw as ph,X as uh}from"lucide-react";var mh={answer:4,copy:12},cl=1600,hh=800,fh=2;function dl(e,t){let r=Math.max(e,t);return r<=0?1:r>cl||r<hh?cl/r:1}async function pl(e){let t=await createImageBitmap(e),r=dl(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}var ul=e=>new Promise((t,r)=>e.toBlob(n=>n?t(n):r(new Error("encode_failed")),"image/jpeg",.85));async function ml(e){return ul(await pl(e))}async function hl(e,t){let r=await createImageBitmap(e),n=t!==180,o=document.createElement("canvas");o.width=n?r.height:r.width,o.height=n?r.width:r.height;let a=o.getContext("2d");return a&&(a.translate(o.width/2,o.height/2),a.rotate(t*Math.PI/180),a.drawImage(r,-r.width/2,-r.height/2)),r.close?.(),ul(o)}async function fl(e){return(await pl(e)).toDataURL("image/jpeg",.85)}async function hs(e,t,r){let{signal:n,startLines:o}=r,a=null,s=0,i=c=>{n.aborted||(a??(a=o(t.photos)),a.add(c),s++)};try{let{lines:c,turns:l}=await e.readPages(t,{signal:n,onLine:i});return n.aborted?{shown:s}:l?.length?{shown:s,turns:l}:(s===0&&c.forEach(i),{shown:s})}finally{a?.end()}}function gh(e,t){let r=t.filter(o=>o.page>=0&&o.page<e.length),n=r.filter(o=>e[o.page]>=fh).map(o=>o.page);return n.length||r.length===0?{sideways:n.length?n:t.map(o=>o.page)}:{turn:r}}function ll(e){return!!e&&Array.from(e).includes("Files")}function fs(){return typeof window<"u"&&!!window.matchMedia?.("(pointer: coarse)").matches}function bh({src:e,alt:t,closeLabel:r,onClose:n}){let o=ft(null);return Zt(()=>{o.current?.focus();let a=s=>{s.key==="Escape"&&(s.stopPropagation(),n())};return window.addEventListener("keydown",a,!0),()=>window.removeEventListener("keydown",a,!0)},[n]),Ue("div",{className:"edp-sheet-viewer",role:"dialog","aria-modal":"true","aria-label":t,onClick:n,children:[he("img",{src:e,alt:t,onClick:a=>a.stopPropagation()}),he("button",{ref:o,type:"button",className:"edp-sheet-viewer-close",onClick:n,"aria-label":r,children:"\xD7"})]})}function Ro({nodeId:e,purpose:t="answer",mediaHandler:r,handler:n,incoming:o,startLines:a,onReading:s,onRead:i,onDone:c,onType:l,onClose:d,onPages:u}){let p=me(),f=fs(),h=Ft(n),m=mh[t],[b,y]=Br("choose"),[x,A]=Br(null),[g,T]=Br(null),[C,E]=Br([]),[R,M]=Br(null),[k,S]=Br(!1),v=ft([]),O=$=>{v.current=$,E($)};Zt(()=>{u?.(C.length)},[C.length]);let _=ft(1),w=ft(new Map),X=ft(!1),Y=ft(null),F=ft(null),L=ft(null),B=ft(null),J=ft(null),N=ft(new AbortController),P=ft(null);Zt(()=>{let $=new AbortController;return N.current=$,()=>{$.abort(),P.current?.abort();for(let pe of v.current)pe.blob&&URL.revokeObjectURL(pe.preview)}},[]);let K=b==="reading"&&h;Zt(()=>{s?.(K)},[K]),Zt(()=>()=>s?.(!1),[]);let U=$=>{T($),y("error")},j=($,pe)=>{O(v.current.map(ue=>ue.id===$?{...ue,...pe}:ue))},de=$=>{if(!h||!$.blob)return;let pe=$.blob,ue=n.uploadPhoto(pe,{signal:N.current.signal}).then(ce=>j($.id,{photo:{...ce,name:ce.name??$.name},failed:!1})).catch(()=>{N.current.signal.aborted||j($.id,{failed:!0})});w.current.set($.id,ue)},z=async $=>{if(n.transcribePhotos){y("reading");try{let pe=await Promise.all($.map(je=>fl(je))),ue=[];if(r)for(let je of $){let{url:lt,mimeType:Vt}=await r.upload(je,"image");ue.push({url:lt,mimeType:Vt??je.type,name:je.name})}let ce=new AbortController;P.current=ce;let{content:Te}=await n.transcribePhotos({images:pe,photos:ue},{nodeId:e,signal:ce.signal});ce.signal.aborted||i(Te,ue)}catch{N.current.signal.aborted||U("unreadable")}}},W=async $=>{let pe=$.filter(Te=>Te.type.startsWith("image/")||/\.hei[cf]$/i.test(Te.name));if(pe.length===0)return;if(!h)return z(pe.slice(0,m));let ue=m-v.current.length,ce=[];for(let Te of pe.slice(0,Math.max(ue,0)))try{let je=await ml(Te);ce.push({id:_.current++,preview:URL.createObjectURL(je),blob:je,photo:null,failed:!1,turns:0,name:Te.name})}catch{U("open");return}N.current.signal.aborted||(O([...v.current,...ce]),ce.forEach(de),T(null),y("pages"))};Zt(()=>{o?.files.length&&W(o.files)},[o?.key]);let le=$=>{let pe=v.current.find(ce=>ce.id===$);pe?.blob&&URL.revokeObjectURL(pe.preview),w.current.delete($);let ue=v.current.filter(ce=>ce.id!==$);O(ue),ue.length===0&&(T(null),y("choose"))},I=async($,pe,ue)=>{let ce=v.current.find(Vt=>Vt.id===$);if(!ce)return;let Te=ce.blob?ce.blob:await(await fetch(ce.preview,{signal:N.current.signal})).blob(),je=await hl(Te,pe);ce.blob&&URL.revokeObjectURL(ce.preview);let lt={...ce,blob:je,preview:URL.createObjectURL(je),photo:null,failed:!1,turns:ce.turns+(ue?0:1)};O(v.current.map(Vt=>Vt.id===$?lt:Vt)),ue&&(X.current=!0),de(lt)},G=$=>{I($,90,!0).catch(()=>U("open"))},re=async()=>{let $=new AbortController;if(P.current=$,T(null),y("reading"),await Promise.all(w.current.values()),$.signal.aborted)return;let pe=v.current;if(pe.some(ce=>ce.failed||!ce.photo))return U("send");let ue=pe.map(ce=>ce.photo);try{let{shown:ce,turns:Te}=await hs(n,{photos:ue,purpose:t,...e?{nodeId:e}:{},...X.current?{upright:!0}:{}},{signal:$.signal,startLines:a});if($.signal.aborted)return;if(Te?.length){let je=gh(pe.map(lt=>lt.turns),Te);if("sideways"in je){X.current=!0,T("sideways"),y("pages");return}for(let lt of je.turn)await I(pe[lt.page].id,lt.degrees,!1);return re()}if(ce===0)return U("unreadable");c()}catch(ce){if($.signal.aborted||N.current.signal.aborted)return;U(cn(ce))}},ne=()=>{P.current?.abort(),y(v.current.length?"pages":"choose")},ie=$=>{if($.length===0)return;if(!h){y("reading"),n.transcribePhotos({images:[],photos:$},{nodeId:e,signal:N.current.signal}).then(({content:ue})=>i(ue,$)).catch(()=>{N.current.signal.aborted||U("unreadable")});return}let pe=$.slice(0,m-v.current.length).map(ue=>({id:_.current++,preview:ue.url,blob:null,photo:ue,failed:!1,turns:0,name:ue.name}));O([...v.current,...pe]),re()};Zt(()=>{if(f||!n.startPhoneCapture)return;let $=new AbortController;return J.current=$,n.startPhoneCapture({nodeId:e,signal:$.signal}).then(({url:pe,qrImage:ue,photos:ce})=>{$.signal.aborted||(A({url:pe,qrImage:ue}),ce.then(Te=>{$.signal.aborted||ie(Te)}).catch(()=>{}))}).catch(()=>{}),()=>$.abort()},[]);let ve=()=>{B.current?.getTracks().forEach($=>$.stop()),B.current=null};Zt(()=>ve,[]);let Ye=async()=>{J.current?.abort();try{let $=await navigator.mediaDevices.getUserMedia({video:{facingMode:"environment"}});B.current=$,y("camera"),requestAnimationFrame(()=>{L.current&&(L.current.srcObject=$,L.current.play().catch(()=>{}))})}catch{U("camera")}},Qe=()=>{let $=L.current;if(!$)return;let pe=document.createElement("canvas");pe.width=$.videoWidth,pe.height=$.videoHeight,pe.getContext("2d")?.drawImage($,0,0),pe.toBlob(ue=>{ve(),ue?W([new File([ue],"copie.jpg",{type:"image/jpeg"})]):y(v.current.length?"pages":"choose")},"image/jpeg",.9)},ee=$=>{J.current?.abort();let pe=Array.from($.target.files??[]);$.target.value="",W(pe)},fe={unreadable:p.sheetPhotoUnreadable,limit:t==="copy"?p.copyLimit:p.sheetPhotoLimit,busy:p.sheetPhotoBusy,network:p.sheetPhotoNetwork,cut:t==="copy"?p.copyCut:p.sheetPhotoCut,failed:p.sheetPhotoFailed,camera:p.sheetPhotoCameraFailed,sideways:p.sheetPhotoSideways,send:p.sheetPhotoSendFailed,open:p.sheetPhotoOpenFailed},xe=t==="copy"?p.copyTitle:p.sheetPhotoTitle,ke=b==="reading",Ae=C.length>=m,Wt=C.length>0&&C.every($=>$.photo&&!$.failed),Rt=!Ae&&(b==="choose"||b==="pages"||b==="error"),Pt=Rt?{onDragOver:$=>{ll($.dataTransfer?.types)&&($.preventDefault(),$.dataTransfer.dropEffect="copy",k||S(!0))},onDragLeave:$=>{$.currentTarget.contains($.relatedTarget)||S(!1)},onDrop:$=>{ll($.dataTransfer?.types)&&($.preventDefault(),S(!1),J.current?.abort(),W(Array.from($.dataTransfer.files)))}}:{},se=()=>{if(g==="camera"||g==="open"||v.current.length===0){T(null),y(v.current.length?"pages":"choose");return}if(g==="unreadable"||g==="send"){T(null),y("pages");return}re()};return Ue("div",{className:dh("edp-sheet-panel",t==="copy"&&"edp-sheet-panel--bare",k&&Rt&&"is-dropping"),role:t==="copy"?void 0:"dialog","aria-label":xe,...Pt,children:[k&&Rt&&he("div",{className:"edp-sheet-drop","aria-hidden":"true",children:he("span",{children:p.sheetPhotoDropHere})}),t!=="copy"&&Ue("div",{className:"edp-sheet-panel-head",children:[he("strong",{children:xe}),he("button",{type:"button",className:"edp-sheet-panel-close",onClick:d,"aria-label":p.sheetClose,children:"\xD7"})]}),he("input",{ref:Y,type:"file",accept:"image/*",capture:"environment",hidden:!0,onChange:ee}),he("input",{ref:F,type:"file",accept:"image/*",multiple:!0,hidden:!0,onChange:ee}),b==="choose"&&f&&Ue("div",{className:"edp-sheet-panel-actions",children:[he("button",{type:"button",className:"edp-sheet-btn edp-sheet-btn--primary",onClick:()=>Y.current?.click(),children:p.sheetPhotoTake}),he("button",{type:"button",className:"edp-sheet-btn",onClick:()=>F.current?.click(),children:p.sheetPhotoGallery})]}),b==="choose"&&!f&&Ue(il,{children:[n.startPhoneCapture&&Ue("div",{className:"edp-sheet-qr",children:[x?he("img",{src:x.qrImage,alt:"",width:168,height:168}):he("span",{className:"edp-sheet-qr-wait"}),he("p",{children:t==="copy"?p.copyPhoneHelp:p.sheetPhotoPhoneHelp})]}),he("p",{className:"edp-sheet-or",children:n.startPhoneCapture?p.sheetPhotoOr:null}),Ue("div",{className:"edp-sheet-panel-actions",children:[he("button",{type:"button",className:"edp-sheet-btn",onClick:()=>F.current?.click(),children:p.sheetPhotoUpload}),he("button",{type:"button",className:"edp-sheet-btn",onClick:Ye,children:p.sheetPhotoWebcam})]}),he("p",{className:"edp-sheet-drop-hint",children:p.sheetPhotoDropHint})]}),b==="camera"&&Ue("div",{className:"edp-sheet-camera",children:[he("video",{ref:L,playsInline:!0,muted:!0}),he("button",{type:"button",className:"edp-sheet-btn edp-sheet-btn--primary",onClick:Qe,children:p.sheetPhotoShoot})]}),C.length>0&&b!=="camera"&&he("ul",{className:"edp-sheet-shots","aria-label":p.sheetPhotoPages,children:C.map(($,pe)=>Ue("li",{className:"edp-sheet-shot","data-state":$.failed?"failed":$.photo?"stored":"sending",children:[Ue("button",{type:"button",className:"edp-sheet-shot-view",onClick:()=>M($),"aria-label":p.sheetPhotoView(pe+1),children:[he("img",{src:$.preview,alt:""}),!$.photo&&!$.failed&&he("span",{className:"player-ai-spinner","aria-hidden":"true"})]}),!ke&&Ue("div",{className:"edp-sheet-shot-tools",children:[he("button",{type:"button",className:"edp-sheet-shot-tool",onClick:()=>G($.id),"aria-label":p.sheetPhotoTurn,disabled:!$.photo&&!$.failed,children:he(ph,{size:15,"aria-hidden":"true"})}),he("button",{type:"button",className:"edp-sheet-shot-tool",onClick:()=>le($.id),"aria-label":p.sheetPhotoRemove,children:he(uh,{size:15,"aria-hidden":"true"})})]})]},$.id))}),b==="pages"&&Ue(il,{children:[g==="sideways"&&he("p",{className:"edp-sheet-hint",role:"alert",children:fe.sideways}),C.some($=>$.failed)&&he("p",{className:"edp-sheet-hint",role:"alert",children:fe.send}),Ue("div",{className:"edp-sheet-panel-actions",children:[Ue("button",{type:"button",className:"edp-sheet-btn",onClick:()=>(f?Y.current:F.current)?.click(),disabled:Ae,children:["+ ",p.sheetPhotoAddPage]}),f?he("button",{type:"button",className:"edp-sheet-btn",onClick:()=>F.current?.click(),disabled:Ae,children:p.sheetPhotoGallery}):he("button",{type:"button",className:"edp-sheet-btn",onClick:Ye,disabled:Ae,children:p.sheetPhotoWebcam}),he("button",{type:"button",className:"edp-sheet-btn edp-sheet-btn--primary edp-sheet-btn--end",onClick:()=>{re()},disabled:!Wt,children:p.sheetPhotoRead})]})]}),ke&&Ue("div",{className:"edp-sheet-progress",role:"status",children:[he("span",{className:"player-ai-spinner","aria-hidden":"true"}),he("span",{children:t==="copy"?p.copyReadingLive:h?p.sheetPhotoReadingLive:p.sheetPhotoReading}),h&&he("button",{type:"button",className:"edp-sheet-btn edp-sheet-btn--end",onClick:ne,children:p.sheetPhotoStop})]}),b==="error"&&g&&Ue("div",{className:"edp-sheet-error",role:"alert",children:[he("p",{children:fe[g]}),Ue("div",{className:"edp-sheet-panel-actions",children:[g!=="limit"&&he("button",{type:"button",className:"edp-sheet-btn",onClick:se,children:p.sheetPhotoRetry}),he("button",{type:"button",className:"edp-sheet-btn",onClick:l,children:p.sheetPhotoType})]})]}),R&&he(bh,{src:R.preview,alt:p.sheetPhotoView(C.findIndex($=>$.id===R.id)+1),closeLabel:p.sheetClose,onClose:()=>M(null)})]})}import{jsx as Bt,jsxs as jr,Fragment as $h}from"react/jsx-runtime";import{useEffect as zh,useRef as Ml,useState as Fh}from"react";var Po="#1d2433",yh="#c9d6e8",vh="#f0b7b2";function gl(e,t){return e==="pen"||e==="mouse"?!0:!t}function bl(e,t){return e!=="pen"||!Number.isFinite(t)||t<=0?.5:Math.min(t,1)}function vn(e,t,r){return t?e*(.6+Math.min(Math.max(r,0),1)):e}function gs(e,t,r=0){let n=1/0,o=1/0,a=-1/0,s=-1/0;for(let i of e)for(let c of i.points){let l=vn(t,i.pen,c.p)/2;n=Math.min(n,c.x-l),o=Math.min(o,c.y-l),a=Math.max(a,c.x+l),s=Math.max(s,c.y+l)}return Number.isFinite(n)?{x:n-r,y:o-r,width:a-n+2*r,height:s-o+2*r}:null}function Ze(e){return e.some(t=>t.points.length>0)}function yl(e,t){let r=Math.round(e*Math.SQRT2),n=Math.round(t-200);return Math.max(Math.min(r,n),288)}function xh(e,t=36){let r=[];for(let n=t*1.5;n<e-t/2;n+=t)r.push(Math.round(n));return r}function vl(e){let t=Math.max(e.width,e.height);if(t<=0)return{width:1,height:1,scale:1};let r=1600/t;return{width:Math.max(1,Math.round(e.width*r)),height:Math.max(1,Math.round(e.height*r)),scale:r}}var wh=1024,kh=3;function xl(e){let t=Math.max(e.width,e.height);if(t<=0)return{width:1,height:1,scale:1};let r=Math.min(kh,wh/t);return{width:Math.max(1,Math.round(e.width*r)),height:Math.max(1,Math.round(e.height*r)),scale:r}}function wl(e,t,r){let n=gs(t,r);if(!n)return e;let o=Math.max(n.y+n.height+36,108);return{x:e.x,y:e.y,width:e.width,height:Math.min(e.height,Math.ceil(o))}}function bs(e,t,r){let{base:n,box:o,scale:a,rules:s}=r,i=o.width*a,c=o.height*a;if(e.fillStyle="#ffffff",e.fillRect(0,0,i,c),s){e.lineWidth=1,e.strokeStyle=yh;for(let u of xh(s.height))e.beginPath(),e.moveTo(0,u+.5),e.lineTo(s.width,u+.5),e.stroke();let d=s.marginAt==="left"?36*1.5:s.width-36*1.5;e.strokeStyle=vh,e.beginPath(),e.moveTo(d+.5,0),e.lineTo(d+.5,s.height),e.stroke()}e.strokeStyle=Po,e.fillStyle=Po,e.lineCap="round",e.lineJoin="round";let l=d=>[(d.x-o.x)*a,(d.y-o.y)*a];for(let d of t){let u=d.points;if(u.length!==0){if(u.length===1){let[p,f]=l(u[0]);e.beginPath(),e.arc(p,f,vn(n,d.pen,u[0].p)*a/2,0,Math.PI*2),e.fill();continue}if(!d.pen){e.lineWidth=n*a,e.beginPath(),u.forEach((p,f)=>{let[h,m]=l(p);f?e.lineTo(h,m):e.moveTo(h,m)}),e.stroke();continue}for(let p=1;p<u.length;p++){let[f,h]=l(u[p-1]),[m,b]=l(u[p]);e.lineWidth=vn(n,!0,(u[p-1].p+u[p].p)/2)*a,e.beginPath(),e.moveTo(f,h),e.lineTo(m,b),e.stroke()}}}}import{jsx as Sh}from"react/jsx-runtime";import{forwardRef as Rh,useCallback as Ph,useEffect as Sl,useImperativeHandle as Ch,useLayoutEffect as Nh,useRef as Co,useState as Rl,useSyncExternalStore as Ah}from"react";var No=!1,ys=new Set,kl=!1;function Pl(){kl||typeof window>"u"||(kl=!0,window.addEventListener("pointerdown",e=>{e.pointerType==="pen"&&!No&&(No=!0,ys.forEach(t=>t()))},{capture:!0,passive:!0}))}var Th=e=>(Pl(),ys.add(e),()=>ys.delete(e));function _h(){return Ah(Th,()=>No,()=>!1)}function Mh(){return typeof window<"u"&&!!window.matchMedia?.("(any-pointer: coarse)").matches}function Eh(){return typeof window>"u"||!window.screen?!1:Math.min(window.screen.width,window.screen.height)>=600}function Lh(e,t){let r=e.ready&&!e.touch&&!t;return{pad:t||e.touch,page:t||e.touch&&e.large||r,mouse:r}}function Cl(){let e=_h(),[t,r]=Rl({ready:!1,touch:!1,large:!1});return Sl(()=>{r({ready:!0,touch:Mh(),large:Eh()})},[]),Lh(t,e)}var Nl={pad:3,page:2.5},Ih=12,Al=e=>Nl[e];function vs(e,t,r){let n=t?wl(t,e,r):gs(e,r,Ih);if(!n||!Ze(e)||typeof document>"u")return Promise.resolve(null);let o=t?vl(n):xl(n),a=document.createElement("canvas");a.width=o.width,a.height=o.height;let s=a.getContext("2d");return s?(bs(s,e,{base:r,box:n,scale:o.scale}),new Promise(i=>a.toBlob(c=>i(c),"image/png"))):Promise.resolve(null)}var Ao=Rh(function({variant:t,initialStrokes:r,initialHeight:n,ariaLabel:o,className:a,onStrokeStart:s,onChange:i},c){let l=Co(null),d=Co(r??[]),u=Co(null),p=Co({width:0,height:0}),[f,h]=Rl(n??null),m=Nl[t];Sl(Pl,[]);let b=()=>({x:0,y:0,width:p.current.width,height:p.current.height}),y=Ph(()=>{let R=l.current,M=R?.getContext("2d");if(!R||!M)return;let k=window.devicePixelRatio||1;M.setTransform(k,0,0,k,0,0);let{width:S,height:v}=p.current,O=getComputedStyle(R).direction==="rtl";bs(M,[...d.current,...u.current?[u.current.stroke]:[]],{base:m,box:{x:0,y:0,width:S,height:v},scale:1,...t==="page"?{rules:{width:S,height:v,marginAt:O?"right":"left"}}:{}})},[m,t]);Nh(()=>{let R=l.current;if(!R)return;let M=()=>{let S=R.getBoundingClientRect();if(t==="page"&&!Ze(d.current)){let O=yl(S.width,window.innerHeight);if(Math.abs(O-S.height)>1){h(O);return}}let v=window.devicePixelRatio||1;p.current={width:S.width,height:S.height},R.width=Math.round(S.width*v),R.height=Math.round(S.height*v),y()};if(M(),typeof ResizeObserver>"u")return;let k=new ResizeObserver(M);return k.observe(R),()=>k.disconnect()},[y,t]);let x=()=>i?.(d.current.slice());Ch(c,()=>({undo(){d.current=d.current.slice(0,-1),y(),x()},clear(){d.current=[],u.current=null,y(),x()},restore(R){d.current=R.slice(),u.current=null,y(),x()},isEmpty:()=>!Ze(d.current),strokes:()=>d.current.slice(),surface:b,toBlob:R=>vs(d.current,R==="page"?b():null,m)}));let A=R=>{let M=R.currentTarget.getBoundingClientRect(),k=R.nativeEvent,S=typeof k.getCoalescedEvents=="function"?k.getCoalescedEvents():[];return(S.length?S:[k]).map(O=>({x:O.clientX-M.left,y:O.clientY-M.top,p:bl(O.pointerType,O.pressure)}))},g=(R,M)=>{let S=l.current?.getContext("2d");if(!S)return;let v=R.points.slice(Math.max(M-1,0));if(v.length<2)return;let O=window.devicePixelRatio||1;S.setTransform(O,0,0,O,0,0),S.strokeStyle=Po,S.lineCap="round",S.lineJoin="round";for(let _=1;_<v.length;_++)S.lineWidth=vn(m,R.pen,(v[_-1].p+v[_].p)/2),S.beginPath(),S.moveTo(v[_-1].x,v[_-1].y),S.lineTo(v[_].x,v[_].y),S.stroke()},T=R=>{if(gl(R.pointerType,No)&&!(R.pointerType==="mouse"&&R.button!==0)&&!u.current){try{R.currentTarget.setPointerCapture(R.pointerId)}catch{}s?.(),u.current={id:R.pointerId,stroke:{points:A(R).slice(-1),pen:R.pointerType==="pen"}}}},C=R=>{let M=u.current;if(!M||M.id!==R.pointerId)return;let k=M.stroke.points.length;M.stroke.points.push(...A(R)),g(M.stroke,k)},E=R=>{let M=u.current;!M||M.id!==R.pointerId||(u.current=null,d.current=[...d.current,M.stroke],y(),x())};return Sh("canvas",{ref:l,className:a,style:f?{height:f}:void 0,role:"img","aria-label":o,onPointerDown:T,onPointerMove:C,onPointerUp:E,onPointerCancel:E})});var To={latex:"",stale:!1,state:"idle"},Tl=e=>!!e.latex&&!e.stale&&e.state==="idle";function _l(e){let t=e.setTimer??((p,f)=>setTimeout(p,f)),r=e.clearTimer??(p=>clearTimeout(p)),n=To,o=null,a=null,s=!1,i=!1,c=p=>{n=p,i||e.onView(n)},l=()=>{o!==null&&r(o),o=null},d=()=>{a?.abort(),a=null},u=async()=>{if(l(),d(),!s||i)return;let p=new AbortController;a=p,c({...n,state:"reading"});try{let f=(await e.read(p.signal)).trim();if(p.signal.aborted)return;a=null,c(f?{latex:f,stale:!1,state:"idle"}:{latex:"",stale:!1,state:"failed"})}catch{if(p.signal.aborted)return;a=null,c({latex:"",stale:!1,state:"failed"})}};return{strokeStart(){l(),d(),c({...n,stale:!!n.latex,state:"idle"})},changed(p){if(s=p,l(),d(),!p){c(To);return}c({...n,stale:!!n.latex,state:"idle"}),o=t(()=>{o=null,u()},700)},retry(){n.state==="failed"&&u()},dispose(){i=!0,l(),d()},view:()=>n}}function xs({handler:e,onInsert:t,onClose:r}){let n=me(),o=Ml(null),a=Ml(null),[s,i]=Fh(To);zh(()=>{let l=_l({onView:i,read:async d=>{let u=await o.current?.toBlob("crop");if(!u||!e.recognizeHandwriting)throw new Error("unreadable");if(d.aborted)throw new Error("aborted");let{latex:p}=await e.recognizeHandwriting(u,{signal:d});return p}});return a.current=l,()=>{l.dispose(),a.current=null}},[e]);let c=s.state==="failed"?n.sheetPadFailed:s.latex?n.sheetPadFix:n.sheetPadHelp;return jr("div",{className:"edp-sheet-panel",role:"dialog","aria-label":n.sheetPadTitle,children:[jr("div",{className:"edp-sheet-panel-head",children:[Bt("strong",{children:n.sheetPadTitle}),Bt("button",{type:"button",className:"edp-sheet-panel-close",onClick:r,"aria-label":n.sheetClose,children:"\xD7"})]}),jr("div",{className:"edp-sheet-pad-result","aria-live":"polite","aria-busy":s.state==="reading",children:[s.state==="reading"&&Bt("span",{className:"player-ai-spinner","aria-hidden":"true"}),s.latex&&Bt("span",{className:s.stale?"edp-sheet-pad-latex edp-sheet-pad-latex--stale":"edp-sheet-pad-latex",dir:"ltr",dangerouslySetInnerHTML:{__html:Fe(s.latex,!1)}})]}),jr("p",{className:"edp-sheet-pad-help",children:[c,s.state==="failed"&&jr($h,{children:[" ",Bt("button",{type:"button",className:"edp-sheet-pad-retry",onClick:()=>a.current?.retry(),children:n.sheetPhotoRetry})]})]}),Bt(Ao,{ref:o,variant:"pad",className:"edp-sheet-pad",ariaLabel:n.sheetPadTitle,onStrokeStart:()=>a.current?.strokeStart(),onChange:l=>a.current?.changed(Ze(l))}),jr("div",{className:"edp-sheet-panel-actions",children:[Bt("button",{type:"button",className:"edp-sheet-btn",onClick:()=>o.current?.undo(),children:n.sheetPadUndo}),Bt("button",{type:"button",className:"edp-sheet-btn",onClick:()=>o.current?.clear(),children:n.sheetPadClear}),Bt("button",{type:"button",className:"edp-sheet-btn edp-sheet-btn--primary",disabled:!Tl(s),onClick:()=>t(s.latex),children:n.sheetPadInsert})]})]})}import{jsx as Ie,jsxs as xt,Fragment as Dh}from"react/jsx-runtime";import{useEffect as ws,useRef as qr,useState as _o}from"react";import{X as Oh}from"lucide-react";import El from"clsx";var Ll=4,Bh=()=>({pages:[{id:1,strokes:[],box:null,version:0,stored:null}],current:0,nextId:2}),ks=e=>e.filter(t=>Ze(t.strokes)),Il=e=>Ze(e.strokes)&&e.stored?.version!==e.version;function $l({nodeId:e,handler:t,draft:r,startLines:n,onReading:o,mouse:a=!1,onPhoto:s,onDone:i,onType:c,onClose:l}){let d=me(),u=qr(null),[p,f]=_o(()=>r.current??Bh()),h=qr(p),m=z=>{h.current=z,r.current=z,f(z)},[b,y]=_o("write"),[x,A]=_o(null),[g,T]=_o(null),C=qr(new Map),E=qr(new AbortController),R=qr(null);ws(()=>{let z=new AbortController;return E.current=z,()=>{z.abort(),R.current?.abort()}},[]);let M=p.pages[p.current],k=Al("page"),S=qr(null),v=()=>requestAnimationFrame(()=>{let z=S.current;z&&z.getBoundingClientRect().top<0&&z.scrollIntoView({block:"start"})}),O=(z,W)=>{let le=h.current;m({...le,pages:le.pages.map(I=>I.id===z?W(I):I)})},_=z=>{if(!Il(z)||!z.box)return;let W=`${z.id}:${z.version}`;if(C.current.has(W))return;let le=vs(z.strokes,z.box,k).then(I=>{if(!I)throw new Error("encode_failed");return t.uploadPhoto(I,{signal:E.current.signal})}).then(I=>O(z.id,G=>({...G,stored:{photo:I,version:z.version}}))).catch(()=>{C.current.delete(W)});C.current.set(W,le)},w=z=>{let W=u.current?.surface()??null;T(null),O(M.id,le=>({...le,strokes:z,box:W,version:le.version+1}))},X=()=>{let z=M.strokes;u.current?.clear(),O(M.id,W=>({...W,cleared:z}))},Y=()=>{if(Ze(M.strokes))u.current?.undo();else if(M.cleared?.length){let z=M.cleared;u.current?.restore(z),O(M.id,W=>({...W,cleared:void 0}))}},F=Ze(M.strokes)||!!M.cleared?.length,L=z=>{let W=h.current;z===W.current||z<0||z>=W.pages.length||(_(W.pages[W.current]),T(null),m({...W,current:z}),v())},B=()=>{let z=h.current;if(z.pages.length>=Ll)return;_(z.pages[z.current]),T(null);let W={id:z.nextId,strokes:[],box:null,version:0,stored:null};m({pages:[...z.pages,W],current:z.pages.length,nextId:z.nextId+1}),v()},J=z=>{let W=h.current;if(W.pages.length<=1)return;let le=W.pages[z],I=W.pages.filter((re,ne)=>ne!==z),G=Math.min(z<=W.current?Math.max(W.current-1,0):W.current,I.length-1);m({...W,pages:I,current:G}),T(Ze(le.strokes)||le.cleared?.length?{page:le,index:z}:null)},N=()=>{if(!g)return;let z=h.current,W=Math.min(g.index,z.pages.length),le=[...z.pages.slice(0,W),g.page,...z.pages.slice(W)];T(null),m({...z,pages:le,current:W}),v()},P=async()=>{let z=new AbortController;if(R.current=z,T(null),A(null),y("reading"),ks(h.current.pages).forEach(_),await Promise.all(C.current.values()),z.signal.aborted)return;let W=ks(h.current.pages);if(W.length===0)return y("write");if(W.some(Il)){A("send"),y("error");return}let le=W.map(I=>I.stored.photo);try{let{shown:I}=await hs(t,{photos:le,purpose:"answer",nodeId:e,upright:!0},{signal:z.signal,startLines:n});if(z.signal.aborted)return;if(I===0){A("unreadable"),y("error");return}r.current=null,i()}catch(I){if(z.signal.aborted||E.current.signal.aborted)return;A(cn(I)),y("error")}},K=()=>{R.current?.abort(),y("write")},U={unreadable:d.sheetPadFailed,limit:d.sheetPhotoLimit,busy:d.sheetPhotoBusy,network:d.sheetPhotoNetwork,cut:d.sheetPhotoCut,failed:d.sheetPhotoFailed,send:d.sheetInkSendFailed},j=ks(p.pages).length,de=b==="reading";return ws(()=>{o?.(de)},[de]),ws(()=>()=>o?.(!1),[]),xt("div",{className:"edp-sheet-panel edp-ink",role:"dialog","aria-label":d.sheetInkTitle,children:[xt("div",{className:"edp-sheet-panel-head",children:[Ie("strong",{children:d.sheetInkTitle}),Ie("button",{type:"button",className:"edp-sheet-panel-close",onClick:l,"aria-label":d.sheetClose,children:"\xD7"})]}),Ie("p",{className:"edp-ink-help",children:d.sheetInkHelp}),Ie("div",{ref:S}),p.pages.length>1&&Ie("ul",{className:"edp-ink-tabs","aria-label":d.sheetPhotoPages,children:p.pages.map((z,W)=>xt("li",{className:El("edp-ink-tab",W===p.current&&"is-current"),children:[Ie("button",{type:"button",className:"edp-ink-tab-go",onClick:()=>L(W),"aria-current":W===p.current?"page":void 0,disabled:de,children:d.sheetInkPageN(W+1)}),!de&&Ie("button",{type:"button",className:"edp-ink-tab-remove",onClick:()=>J(W),"aria-label":`${d.sheetInkRemovePage} (${W+1})`,children:Ie(Oh,{size:14,"aria-hidden":"true"})})]},z.id))}),g&&!de&&xt("p",{className:"edp-ink-removed",role:"status",children:[d.sheetInkPageRemoved(g.index+1)," ",Ie("button",{type:"button",className:"edp-sheet-pad-retry",onClick:N,children:d.sheetPadUndo})]}),Ie(Ao,{ref:u,variant:"page",className:El("edp-ink-page",de&&"is-busy"),initialStrokes:M.strokes,initialHeight:Ze(M.strokes)?M.box?.height:void 0,ariaLabel:d.sheetInkCanvas(p.current+1),onChange:w},M.id),a&&b==="write"&&xt("p",{className:"edp-ink-mouse-hint",children:[d.sheetInkMouseHint,s&&xt(Dh,{children:[" ",Ie("button",{type:"button",className:"edp-sheet-pad-retry",onClick:s,children:d.sheetInkMousePhoto})]})]}),b==="write"&&xt("div",{className:"edp-sheet-panel-actions",children:[Ie("button",{type:"button",className:"edp-sheet-btn",onClick:Y,disabled:!F,children:d.sheetPadUndo}),Ie("button",{type:"button",className:"edp-sheet-btn",onClick:X,disabled:!Ze(M.strokes),children:d.sheetPadClear}),xt("button",{type:"button",className:"edp-sheet-btn",onClick:B,disabled:p.pages.length>=Ll||!Ze(M.strokes),children:["+ ",d.sheetPhotoAddPage]}),Ie("button",{type:"button",className:"edp-sheet-btn edp-sheet-btn--primary edp-sheet-btn--end",onClick:()=>{P()},disabled:j===0,children:d.sheetInkRead(j)})]}),de&&xt("div",{className:"edp-sheet-progress",role:"status",children:[Ie("span",{className:"player-ai-spinner","aria-hidden":"true"}),Ie("span",{children:d.sheetInkReading}),Ie("button",{type:"button",className:"edp-sheet-btn edp-sheet-btn--end",onClick:K,children:d.sheetPhotoStop})]}),b==="error"&&x&&xt("div",{className:"edp-sheet-error",role:"alert",children:[Ie("p",{children:U[x]}),xt("div",{className:"edp-sheet-panel-actions",children:[x!=="limit"&&Ie("button",{type:"button",className:"edp-sheet-btn",onClick:()=>x==="unreadable"?y("write"):void P(),children:d.sheetPhotoRetry}),Ie("button",{type:"button",className:"edp-sheet-btn",onClick:c,children:d.sheetPhotoType})]})]})]})}import{jsx as Pe,jsxs as Mt,Fragment as zl}from"react/jsx-runtime";import{useEffect as Mo,useLayoutEffect as jh,useRef as xr,useState as Rs}from"react";import{createPortal as qh}from"react-dom";import Ss from"clsx";import{ChevronLeft as Fl,ChevronRight as Dl}from"lucide-react";var Hh=typeof window<"u"?jh:Mo;function wr(e,t,r){return Math.min(Math.max(e+t,0),Math.max(r-1,0))}function Uh(e,t,r){return Math.abs(e)<40||Math.abs(e)<Math.abs(t)?0:(r?e>0:e<0)?1:-1}function Ps({photos:e,layout:t="corner",onOpen:r}){let n=me(),[o,a]=Rs(0),s=e.length;if(s===0)return null;let i=Math.min(o,s-1),c=e[i],l=s-1;return Mt("div",{className:Ss("edp-sheet-pages",`edp-sheet-pages--${t}`),children:[Mt("button",{type:"button",className:"edp-sheet-thumb",onClick:()=>r(0),"aria-label":n.sheetPagesSee(s),children:[Pe("img",{src:e[0].url,alt:""}),l>0&&Mt("span",{className:"edp-sheet-thumb-more","aria-hidden":"true",children:["+",l]})]}),t==="beside"&&Mt("figure",{className:"edp-sheet-pages-beside",children:[Mt("figcaption",{className:"edp-sheet-pages-head",children:[Pe("span",{className:"edp-sheet-photos-label",children:n.sheetPages}),s>1&&Mt("span",{className:"edp-sheet-pages-nav",children:[Pe("button",{type:"button",className:"edp-sheet-pages-arrow",onClick:()=>a(wr(i,-1,s)),disabled:i===0,"aria-label":n.sheetPagePrev,children:Pe(Fl,{size:16,"aria-hidden":"true"})}),Mt("span",{className:"edp-sheet-pages-count","aria-live":"polite",children:[i+1," / ",s]}),Pe("button",{type:"button",className:"edp-sheet-pages-arrow",onClick:()=>a(wr(i,1,s)),disabled:i===s-1,"aria-label":n.sheetPageNext,children:Pe(Dl,{size:16,"aria-hidden":"true"})})]})]}),Pe("button",{type:"button",className:"edp-sheet-pages-view",onClick:()=>r(i),"aria-label":`${n.sheetPageOf(i+1,s)}, ${n.sheetPageOpen}`,children:Pe("img",{src:c.url,alt:""})})]}),Pe("span",{className:"edp-sheet-pages-print","aria-hidden":"true",children:e.map(d=>Pe("img",{src:d.url,alt:""},d.url))})]})}function Cs(e){let t=xr(null),[r,n]=Rs(null);return Hh(()=>{let o=t.current;if(!o)return;let a=getComputedStyle(o);n({host:o.closest('[role="dialog"][aria-modal="true"], [role="dialog"][data-state="open"]')??document.body,dir:a.direction==="rtl"?"rtl":"ltr",style:{fontFamily:a.fontFamily,"--edp-scale":a.getPropertyValue("--edp-scale").trim()||"1"}})},[]),Mt(zl,{children:[Pe("span",{ref:t,hidden:!0}),r&&qh(Pe("span",{className:"edpire-scope",dir:r.dir,style:{...r.style,display:"contents"},children:Pe(Kh,{...e})}),r.host)]})}function Kh({photos:e,start:t=0,onClose:r}){let n=me(),o=e.length,[a,s]=Rs(()=>wr(t,0,o)),i=xr(null),c=xr(null),l=xr(null),d=xr(null),u=xr(!1),p=xr(r);p.current=r;let f=()=>!!i.current&&getComputedStyle(i.current).direction==="rtl";Mo(()=>{let b=document.activeElement;return c.current?.focus(),()=>b?.focus?.()},[]),Mo(()=>{let b=y=>{if(y.key==="Escape"){y.stopPropagation(),p.current();return}if(y.key==="Tab"&&i.current){let A=Array.from(i.current.querySelectorAll("button:not(:disabled)"));if(A.length===0)return;let g=A[0],T=A[A.length-1],C=i.current.contains(document.activeElement);y.shiftKey&&(document.activeElement===g||!C)?(y.preventDefault(),T.focus()):!y.shiftKey&&(document.activeElement===T||!C)&&(y.preventDefault(),g.focus());return}if(y.key!=="ArrowLeft"&&y.key!=="ArrowRight")return;y.preventDefault();let x=y.key==="ArrowRight"!==f();s(A=>wr(A,x?1:-1,o))};return window.addEventListener("keydown",b,!0),()=>window.removeEventListener("keydown",b,!0)},[o]),Mo(()=>{l.current?.querySelector(".is-active")?.scrollIntoView?.({block:"nearest",inline:"nearest"})},[a]);let h=e[a];if(!h)return null;let m=o>1;return Mt("div",{ref:i,className:Ss("edp-sheet-viewer",m&&"edp-sheet-viewer--pages"),role:"dialog","aria-modal":"true","aria-label":n.sheetPages,onClick:()=>{if(u.current){u.current=!1;return}r()},onPointerDown:b=>{d.current={x:b.clientX,y:b.clientY},u.current=!1},onPointerUp:b=>{let y=d.current;if(d.current=null,!y||!m)return;let x=Uh(b.clientX-y.x,b.clientY-y.y,f());x!==0&&(u.current=!0,s(A=>wr(A,x,o)))},children:[m&&Pe("span",{className:"edp-sheet-viewer-count","aria-live":"polite",children:n.sheetPageOf(a+1,o)}),Pe("div",{className:"edp-sheet-viewer-stage",children:Pe("img",{src:h.url,alt:n.sheetPageOf(a+1,o),onClick:b=>b.stopPropagation(),draggable:!1})}),m&&Mt(zl,{children:[Pe("button",{type:"button",className:"edp-sheet-viewer-nav edp-sheet-viewer-nav--prev",onClick:b=>{b.stopPropagation(),s(y=>wr(y,-1,o))},disabled:a===0,"aria-label":n.sheetPagePrev,children:Pe(Fl,{size:22,"aria-hidden":"true"})}),Pe("button",{type:"button",className:"edp-sheet-viewer-nav edp-sheet-viewer-nav--next",onClick:b=>{b.stopPropagation(),s(y=>wr(y,1,o))},disabled:a===o-1,"aria-label":n.sheetPageNext,children:Pe(Dl,{size:22,"aria-hidden":"true"})}),Pe("div",{ref:l,className:"edp-sheet-viewer-strip",role:"group","aria-label":n.sheetPages,onClick:b=>b.stopPropagation(),children:e.map((b,y)=>Pe("button",{type:"button",className:Ss("edp-sheet-viewer-thumb",y===a&&"is-active"),"aria-pressed":y===a,"aria-label":n.sheetPageOf(y+1,o),onClick:()=>s(y),children:Pe("img",{src:b.url,alt:"",draggable:!1})},b.url))})]}),Pe("button",{ref:c,type:"button",className:"edp-sheet-viewer-close",onClick:b=>{b.stopPropagation(),r()},"aria-label":n.sheetClose,children:"\xD7"})]})}function xn(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}}}var Qh=3;function Xh(e,t,r){let n=e.math===!0;return{math:n,photo:!!e.photo&&La(t),pad:!!e.handwriting&&n&&!!t?.recognizeHandwriting&&r.pad,page:!!e.handwriting&&Ft(t)&&r.page}}function Jh(e){if(!e)return null;if(e.type==="aiAnswer"){let t=e.answer,r=t.content?.length?t.content:t.text?fn(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 Sn({nodeId:e,answerType:t,options:r,placeholder:n,disabled:o,stateClass:a,onChange:s,mediaHandler:i,answerSheetHandler:c}){let l=me(),d=Me(),u=wn(null),p=Wh(()=>xn(l),[l]),[f,h]=er([]),[m,b]=er(null),y=wn(null),x=Cl(),[A,g]=er(!1),[T,C]=er(!1),[E,R]=er(null),{answerPages:M}=Je(),[k,S]=er(!1),[v,O]=er(0),_=Bl(I=>{S(I),I&&O(0)},[]),w=wn(null),[X,Y]=er(null),F=wn([]);F.current=f;let{math:L,photo:B,pad:J,page:N}=Xh(r,c,x),P=Bl((I,G)=>{s({content:I,text:cs(I),wordCount:xo(I),photos:G})},[s]);jl(()=>{let I=re=>{let ne=(re.answers??[]).find(ve=>ve.nodeId===e&&ve.type===t),ie=Jh(ne);ie&&(h(ie.photos),u.current?.setContent(ie.content))},G=()=>{h([]),y.current=null,g(!1),C(!1),u.current?.clear()};return d.on("answers:prefill",I),d.on("answers:reset",G),()=>{d.off("answers:prefill",I),d.off("answers:reset",G)}},[d,e,t]);let K=(I,G)=>{let re=[...F.current,...G];h(re),F.current=re;let ne=u.current?.getContent()??[],ie=Dr(ne)?I:[...ne,...I];u.current?.setContent(ie),P(ie,re),g(!0),b(null)},U=I=>{let G=new Set(F.current.map(ne=>ne.url)),re=[...F.current,...I.filter(ne=>!G.has(ne.url))];h(re),F.current=re,P(u.current?.getContent()??[],re)},j=I=>{let G=u.current?.beginLines(),re=!0;return{add(ne){G&&(re&&(re=!1,U(I),g(!0)),ne.unsure?.length&&C(!0),G.add(ne),O(ie=>ie+1))},end(){G?.end()}}},de=wn(()=>{});de.current=(I,G,re)=>{if(!u.current||I.length===0)return;re==="replace"&&u.current.clear(),U(G),g(!0),I.some(ie=>ie.unsure?.length)&&C(!0);let ne=u.current.beginLines({at:"end"});for(let ie of I)ne.add(ie);ne.end()};let z=c?.attachSheet;jl(()=>{if(!(!z||!B||o))return z(e,{isEmpty:()=>Dr(u.current?.getContent()??[]),placeLines:(I,G,re)=>de.current(I,G,re)})},[z,B,o,e]);let W=()=>{if(m==="photo")return b(null);Y(null),b("photo"),fs()&&w.current?.click()},le=B||J||N?jt(Ol,{children:[B&&jt("button",{type:"button",className:kn("edp-sheet-key edp-sheet-key--tool",m==="photo"&&"is-active"),onClick:W,"aria-expanded":m==="photo",children:[et(Vh,{size:16,"aria-hidden":"true"})," ",l.sheetPhoto]}),J&&jt("button",{type:"button",className:kn("edp-sheet-key edp-sheet-key--tool",m==="pad"&&"is-active"),onClick:()=>b(m==="pad"?null:"pad"),"aria-expanded":m==="pad",children:[et(Yh,{size:16,"aria-hidden":"true"})," ",N?l.sheetHandwritingFormula:l.sheetHandwriting]}),N&&jt("button",{type:"button",className:kn("edp-sheet-key edp-sheet-key--tool",m==="ink"&&"is-active"),onClick:()=>b(m==="ink"?null:"ink"),"aria-expanded":m==="ink",children:[et(Gh,{size:16,"aria-hidden":"true"})," ",l.sheetInkPage]})]}):null;return jt("div",{className:kn("edp-sheet",o&&"edp-sheet--readonly",a),children:[A&&!o&&jt("p",{className:"edp-sheet-notice",role:"status",children:[l.sheetPhotoCheck,T&&jt(Ol,{children:[" ",l.sheetPhotoUnsure]})]}),et("div",{className:"edp-sheet-body",children:jt("div",{className:kn("edp-sheet-grid",o&&f.length>0&&["has-pages",`has-pages--${M}`]),children:[et(ms,{ref:u,onChange:I=>P(I,F.current),disabled:o,placeholder:n||(L?l.sheetPlaceholder:l.longAnswerPlaceholder),keys:L,extraTools:le,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:p,skeletonLines:k&&!o?Math.max(1,Qh-v):0}),o&&f.length>0&&et(Ps,{photos:f,layout:M,onOpen:R})]})}),B&&et("input",{ref:w,type:"file",accept:"image/*",capture:"environment",hidden:!0,onChange:I=>{let G=Array.from(I.target.files??[]);I.target.value="",G.length&&Y({files:G,key:Date.now()})}}),m==="photo"&&B&&c&&et(Ro,{nodeId:e,mediaHandler:i,handler:c,incoming:X,startLines:j,onReading:_,onRead:K,onDone:()=>b(null),onType:()=>{b(null),u.current?.focus()},onClose:()=>b(null)}),m==="pad"&&J&&c&&et(xs,{handler:c,onInsert:I=>{u.current?.insertFormula(I),b(null)},onClose:()=>b(null)}),m==="ink"&&N&&Ft(c)&&et($l,{nodeId:e,handler:c,draft:y,startLines:j,onReading:_,mouse:x.mouse,onPhoto:B?()=>b("photo"):void 0,onDone:()=>b(null),onType:()=>{b(null),u.current?.focus()},onClose:()=>b(null)}),!o&&f.length>0&&m!=="photo"&&jt("div",{className:"edp-sheet-photos",children:[et("span",{className:"edp-sheet-photos-label",children:l.sheetPhotoYours}),f.map((I,G)=>et("span",{className:"edp-sheet-photo",children:et("button",{type:"button",className:"edp-sheet-photo-view",onClick:()=>R(G),"aria-label":l.sheetPageOf(G+1,f.length),children:et("img",{src:I.url,alt:""})})},I.url))]}),E!==null&&f[E]&&et(Cs,{photos:f,start:E,onClose:()=>R(null)})]})}import{jsx as Rn,jsxs as Zh,Fragment as ef}from"react/jsx-runtime";import{Fragment as ql}from"react";function Hl({text:e}){let t=fn(e);return Rn(ef,{children:t.map((r,n)=>Zh(ql,{children:[n>0&&Rn("br",{}),r.type==="blockMath"?Rn("span",{className:"edp-math-text-formula",dir:"ltr",dangerouslySetInnerHTML:{__html:Fe(String(r.attrs?.latex??""),!1)}}):(r.content??[]).map((o,a)=>o.type==="inlineMath"?Rn("span",{className:"edp-math-text-formula",dir:"ltr",dangerouslySetInnerHTML:{__html:Fe(String(o.attrs?.latex??""),!1)}},a):Rn(ql,{children:o.text},a))]},n))})}function Jn({node:e,validationFeedback:t,readOnly:r=!1,mediaHandler:n,answerSheetHandler:o}){let a=Me(),s=me(),{id:i,attrs:c}=e,{placeholder:l,minWords:d=0,maxWords:u=500,hint:p}=c,f=!!(c.math||c.photo||c.handwriting),[h,m]=Kl(""),[b,y]=Kl(0),x=t?.showFeedback??!1,A=t?.state,g=u<=30,T=As(L=>L.trim().split(/\s+/).filter(Boolean).length,[]);Ns(()=>{let L=B=>{let N=B.answers?.find(P=>P.nodeId===i&&P.type==="aiAnswer");if(N&&N.answer?.text!=null){let P=N.answer.text;m(P),y(T(P))}};return a.on("answers:prefill",L),()=>a.off("answers:prefill",L)},[i,a,T]),Ns(()=>{let L=()=>{m(""),y(0)};return a.on("answers:reset",L),()=>a.off("answers:reset",L)},[a]);let C=Wl(null),E=As((L,B)=>{C.current&&clearTimeout(C.current),C.current=setTimeout(()=>{a.emit({type:"answer:changed",answer:{nodeId:i,type:"aiAnswer",timestamp:Date.now(),answer:{text:L,wordCount:B}}})},300)},[i,a]);Ns(()=>{a.emit({type:"answer:changed",answer:{nodeId:i,type:"aiAnswer",timestamp:Date.now(),answer:{text:"",wordCount:0}}})},[]);let R=L=>{if(x)return;let B=T(L);m(L),y(B),E(L,B)},M=Wl(null),k=As(L=>{y(L.wordCount),M.current&&clearTimeout(M.current),M.current=setTimeout(()=>{a.emit({type:"answer:changed",answer:{nodeId:i,type:"aiAnswer",timestamp:Date.now(),answer:{text:L.text,wordCount:L.wordCount,content:L.content,...L.photos.length?{photos:L.photos}:{}}}})},300)},[i,a]),S=A==="validating",v=Hr("player-ai-count",b>u&&"player-ai-count--over"),O=!x||S?"":A==="correct"?"player-ai-input--correct":A==="incorrect"?"player-ai-input--incorrect":A==="partial"?"player-ai-input--partial":"",_=A==="correct"?"player-ai-feedback--correct":A==="incorrect"?"player-ai-feedback--incorrect":A==="partial"?"player-ai-feedback--partial":"",w=L=>Number.isInteger(L)?String(L):L.toFixed(2),X=t,Y=(X?.lines??[]).filter(L=>!!L.feedback||L.score!=null&&L.maxScore!=null),F=L=>c.math?Ke(Hl,{text:L}):L;return wt("div",{className:Hr("player-ai",f&&"player-ai--sheet"),children:[wt("div",{className:"player-ai-counts",children:[!c.math&&wt("span",{className:v,children:[b," / ",u," ",s.openResponseWords]}),!c.math&&d>0&&b<d&&Ke("span",{className:"player-ai-count player-ai-count--min",children:s.minWordsLabel(d)}),Ke("span",{style:{marginInlineStart:"auto"},children:Ke(Tt,{hint:p})})]}),f?Ke(Sn,{nodeId:i,answerType:"aiAnswer",options:{math:c.math,photo:c.photo,handwriting:c.handwriting},placeholder:l,disabled:x||r,stateClass:O,onChange:k,mediaHandler:n,answerSheetHandler:o}):g?Ke("input",{type:"text",value:h,onChange:L=>R(L.target.value),placeholder:l??s.shortAnswerPlaceholder,"aria-label":s.blankAnswerAria,disabled:x,className:Hr("player-ai-input",O)}):Ke("textarea",{value:h,onChange:L=>R(L.target.value),placeholder:l??s.longAnswerPlaceholder,"aria-label":s.blankAnswerAria,disabled:x,rows:5,className:Hr("player-ai-input player-ai-input--multiline",O)}),x&&t&&Ke("div",{className:Hr("player-ai-feedback",_),children:S?wt("div",{className:"player-ai-validating",children:[Ke("span",{className:"player-ai-spinner"}),Ke("span",{children:s.aiEvaluationInProgress})]}):wt(Ul,{children:[Y.length>0?wt(Ul,{children:[Ke("ul",{className:"player-ai-lines",children:Y.map((L,B)=>wt("li",{className:"player-ai-line",children:[wt("div",{className:"player-ai-line-head",children:[Ke("span",{className:"player-ai-line-label",children:F(L.label)}),L.score!=null&&L.maxScore!=null&&wt("span",{className:Hr("player-ai-line-mark",tf(L)),children:[w(L.score)," / ",w(L.maxScore)]})]}),L.feedback&&Ke("p",{className:"player-ai-line-text",children:F(L.feedback)})]},B))}),X?.next&&wt("p",{className:"player-ai-next",children:[Ke("span",{className:"player-ai-next-mark","aria-hidden":"true",children:"\u2192"}),Ke("span",{children:F(X.next)})]})]}):t.message&&Ke("p",{className:"player-ai-message",children:F(t.message)}),t.score!=null&&t.maxScore!=null&&Ke("div",{className:"player-ai-score-row",children:wt("span",{className:"player-ai-score",children:[w(t.score)," / ",w(t.maxScore)]})})]})})]})}function tf(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 q,jsxs as be,Fragment as Pn}from"react/jsx-runtime";import{useState as tt,useEffect as nt,useRef as Ve,useCallback as Eo}from"react";import{useEditor as rf,EditorContent as nf}from"@tiptap/react";import of from"@tiptap/starter-kit";import qt from"clsx";import{FolderOpen as af,Mic as sf,Video as Vl,Monitor as cf,Clock as lf,Image as df,FileText as Gl,Music as pf,Link2 as uf,Check as mf,AlertCircle as hf}from"lucide-react";function Yl(e){return e.trim().split(/\s+/).filter(Boolean).length}function Ql(e){return e.length}function ff(e){let t=r=>r.map(n=>(n.text??"")+(n.content?t(n.content):"")).join(" ");return Yl(t(e))}function gf(e){let t=r=>r.map(n=>(n.text??"")+(n.content?t(n.content):"")).join("");return Ql(t(e))}function bf(e){return/youtube\.com|youtu\.be/i.test(e)?"youtube":/vimeo\.com/i.test(e)?"vimeo":"other"}function yf(e){let t=e.match(/[?&]v=([^&]+)/)||e.match(/youtu\.be\/([^?]+)/)||e.match(/embed\/([^?]+)/);return t?t[1]:null}function Ts(e){let t=Math.floor(e/60),r=e%60;return`${t}:${r.toString().padStart(2,"0")}`}function Zn({node:e,validationFeedback:t,readOnly:r=!1,mediaHandler:n,answerSheetHandler:o}){let a=Me(),s=me(),{id:i,attrs:c}=e,{mode:l,placeholder:d,allowFormatting:u,wordLimit:p,characterLimit:f,allowedTypes:h,allowMultiple:m,fileInstructions:b,maxDuration:y,hint:x}=c,A=l==="text"&&!!(c.math||c.photo||c.handwriting),g=r||(t?.showFeedback??!1),T=t?.state,C=Ve(null),E=Eo(v=>{C.current&&clearTimeout(C.current),C.current=setTimeout(()=>{let O=v.files?.map(_=>({url:_.url,mimeType:_.kind==="videoLink"?"video/x-link":_.mimeType,name:_.kind==="videoLink"?void 0:_.name,duration:_.kind==="videoLink"?void 0:_.duration}));a.emit({type:"answer:changed",answer:{nodeId:i,type:"openResponse",timestamp:Date.now(),answer:{...v,files:O}}})},300)},[i,a]);nt(()=>{E({})},[]);let[R,M]=tt([]);nt(()=>{(l==="file"||l==="text+file")&&l==="file"&&E({files:R})},[R,l]),nt(()=>{let v=()=>{M([])};return a.on("answers:reset",v),()=>a.off("answers:reset",v)},[a]),nt(()=>{let v=O=>{let w=(O.answers??[]).find(X=>X.nodeId===i&&X.type==="openResponse");w&&(C.current&&(clearTimeout(C.current),C.current=null),w.answer?.files&&M(w.answer.files))};return a.on("answers:prefill",v),()=>a.off("answers:prefill",v)},[i,a]);let k=t?.showFeedback,S=qt(!k&&"player-or-field--pre",k&&T==="correct"&&"player-or-field--correct",k&&T==="partial"&&"player-or-field--partial",k&&T==="incorrect"&&"player-or-field--incorrect",k&&T==="awaiting_review"&&"player-or-field--review");return be("div",{className:"my-3 space-y-2",children:[!g&&x&&x.length>0&&q("div",{className:"flex justify-end",children:q(Gt,{hint:x})}),A&&q(Sn,{nodeId:i,answerType:"openResponse",options:{math:c.math,photo:c.photo,handwriting:c.handwriting},placeholder:d,disabled:g,stateClass:S,onChange:v=>E({text:{content:v.content,wordCount:v.wordCount},...v.photos.length?{photos:v.photos}:{}}),mediaHandler:n,answerSheetHandler:o}),l==="text"&&!A&&q(Xl,{nodeId:i,placeholder:d,allowFormatting:u,wordLimit:p,characterLimit:f,isDisabled:g,feedbackBorderClass:S,emitAnswer:v=>E({text:v}),answerBus:a}),l==="file"&&q(_s,{allowedTypes:h??["image"],allowMultiple:!!m,fileInstructions:b,isDisabled:g,feedbackBorderClass:S,files:R,setFiles:M,mediaHandler:n,t:s}),(l==="audio"||l==="video"||l==="screen")&&q(Af,{nodeId:i,answerBus:a,kind:l,maxDuration:y,isDisabled:g,feedbackBorderClass:S,mediaHandler:n,emitAnswer:v=>E({recording:v}),t:s}),l==="text+file"&&q(kf,{nodeId:i,placeholder:d,allowFormatting:u,wordLimit:p,characterLimit:f,allowedTypes:h??["image"],allowMultiple:!!m,fileInstructions:b,isDisabled:g,feedbackBorderClass:S,files:R,setFiles:M,emitAnswer:E,answerBus:a,mediaHandler:n,t:s}),t?.showFeedback&&T==="awaiting_review"&&be("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:[q(lf,{size:15,style:Ee(15),className:"animate-pulse"}),q("span",{children:s.openResponseAwaitingReview})]}),t?.showFeedback&&T!=="awaiting_review"&&t.teacherFeedback&&q(Tf,{feedback:t.teacherFeedback,feedbackState:T,score:t.score,t:s})]})}function Xl({nodeId:e,placeholder:t,allowFormatting:r,wordLimit:n,characterLimit:o,isDisabled:a,feedbackBorderClass:s,emitAnswer:i,answerBus:c}){let l=me(),[d,u]=tt(""),[p,f]=tt(0),[h,m]=tt(0),b=Ve(null),y=Eo(()=>{let w=b.current;w&&(w.style.height="auto",w.style.height=`${w.scrollHeight}px`)},[]),x=rf({extensions:[of.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1})],immediatelyRender:!1,editable:!a,content:"",onUpdate({editor:w}){if(a||!r)return;let Y=w.getJSON().content??[],F=ff(Y),L=gf(Y);f(F),m(L),i({content:Y,wordCount:F})}});nt(()=>{x&&x.setEditable(!a,!1)},[a,x]);let A=Ve(null);nt(()=>{x&&A.current!==null&&(x.commands.setContent({type:"doc",content:A.current}),A.current=null)},[x]),nt(()=>{let w=X=>{let Y=(X.answers??[]).find(L=>L.nodeId===e&&L.type==="openResponse");if(!Y?.answer?.text)return;let F=Y.answer.text.content??[];if(r)x?x.commands.setContent({type:"doc",content:F}):A.current=F;else{let L=F.flatMap(B=>B.content?.map(J=>J.text??"")??[B.text??""]).join(`
7
+ `);u(L),setTimeout(y,0)}};return c.on("answers:prefill",w),()=>c.off("answers:prefill",w)},[e,c,r,x]),nt(()=>{let w=()=>{r&&x?x.commands.clearContent():(u(""),setTimeout(y,0)),f(0),m(0)};return c.on("answers:reset",w),()=>c.off("answers:reset",w)},[c,r,x,y]);let g=!!n,T=!!o&&!n,C=g?p:h,E=g?n?.max:o?.max,R=g?n?.min:o?.min,M=E!=null&&C>E,k=E!=null&&C>=E*.8&&!M,S=R!=null&&C<R&&C>0,v="text-xs tabular-nums",O=M?{color:"var(--pen, #d23b2b)",fontWeight:500}:k||S?{color:"var(--almost, #c8810e)"}:{color:"var(--ink-faint, #8d93a0)"},_=g?E?`${p} / ${E} ${l.openResponseWords}`:R?`${p} ${l.openResponseWords} (min. ${R})`:`${p} ${l.openResponseWords}`:T?E?`${h} / ${E} ${l.openResponseChars}`:`${h} ${l.openResponseChars}`:null;return r?be("div",{className:"relative",children:[be("div",{className:qt("rounded border transition-colors min-h-[120px]",s),children:[!a&&be("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:w,cmd:X,style:Y})=>q("button",{type:"button",onMouseDown:F=>{F.preventDefault(),x?.chain().focus()?.[X]().run()},className:`text-xs px-1.5 py-0.5 rounded hover:bg-gray-100 ${Y}`,children:w},w)),q("button",{type:"button",onMouseDown:w=>{w.preventDefault(),x?.chain().focus().toggleBulletList().run()},className:"text-xs px-1.5 py-0.5 rounded hover:bg-gray-100",children:"\u2022\u2014"})]}),q(nf,{editor:x,className:"prose prose-sm max-w-none p-3 outline-none [&_.ProseMirror]:min-h-[80px] [&_.ProseMirror]:outline-none"})]}),_&&q("div",{className:qt("absolute bottom-2 right-3",v),style:O,children:_})]}):be("div",{className:"relative",children:[q("textarea",{ref:b,value:d,onChange:w=>{if(a)return;let X=w.target.value;u(X);let Y=Yl(X),F=Ql(X);f(Y),m(F),y(),i({content:[{type:"paragraph",content:[{type:"text",text:X}]}],wordCount:Y})},onInput:y,disabled:a,placeholder:t||l.openResponseTextPlaceholder,rows:4,style:{resize:"none",overflow:"hidden"},className:qt("w-full px-3 py-2 text-base min-h-[100px] rounded border transition-colors outline-none",s,a&&"cursor-default")}),_&&q("div",{className:qt("absolute bottom-2 right-3",v),children:_})]})}var vf={image:"image/*",pdf:"application/pdf",audio:"audio/*",video:"video/*"},xf={image:q(df,{size:12,style:Ee(12)}),pdf:q(Gl,{size:12,style:Ee(12)}),audio:q(pf,{size:12,style:Ee(12)}),video:q(Vl,{size:12,style:Ee(12)}),videoLink:q(uf,{size:12,style:Ee(12)})};function _s({allowedTypes:e,allowMultiple:t,fileInstructions:r,isDisabled:n,files:o,setFiles:a,mediaHandler:s,t:i,compact:c=!1}){let l=Ve(null),[d,u]=tt(!1),[p,f]=tt(!1),[h,m]=tt(""),b=e.some(k=>k!=="videoLink"),y=e.includes("videoLink"),x=t||o.length===0,A=e.filter(k=>k!=="videoLink").map(k=>vf[k]).filter(Boolean).join(","),g=Eo(k=>{a(S=>t?[...S,k]:[k])},[t,a]),T=Eo(k=>{a(S=>S.filter((v,O)=>O!==k))},[a]),C=async k=>{if(!(!x||n)){u(!0);try{let S=k.type.startsWith("image/")?"image":k.type==="application/pdf"?"document":k.type.startsWith("audio/")?"audio":k.type.startsWith("video/")?"video":"file";if(s){let v=await s.upload(k,S);g({kind:"file",url:v.url,mimeType:v.mimeType??k.type,name:k.name})}else{let v=URL.createObjectURL(k);g({kind:"file",url:v,mimeType:k.type,name:k.name})}}finally{u(!1)}}},E=async k=>{if(k.preventDefault(),f(!1),n||!x)return;let S=k.dataTransfer.files?.[0];S&&await C(S)},R=()=>{let k=h.trim();k&&(g({kind:"videoLink",url:k,platform:bf(k)}),m(""))},M={image:i.openResponseTypeImage,pdf:i.openResponseTypePdf,audio:i.openResponseTypeAudio,video:i.openResponseTypeVideo,videoLink:i.openResponseTypeVideoLink};return be("div",{className:"space-y-2",children:[r&&!c&&q("p",{className:"text-sm text-gray-600 italic",children:r}),o.length>0&&q("div",{className:c?"flex flex-wrap gap-1.5":"space-y-2",children:o.map((k,S)=>q(wf,{file:k,onRemove:n?void 0:()=>T(S),compact:c,t:i},S))}),!n&&x&&be("div",{className:"space-y-2",children:[b&&!c&&be("div",{onDragOver:k=>{k.preventDefault(),f(!0)},onDragLeave:()=>f(!1),onDrop:E,className:"border-2 border-dashed rounded-lg p-6 text-center transition-colors cursor-pointer",style:{borderColor:p?"var(--ink-faint, #8d93a0)":"var(--line-strong, #d6d3cc)",background:p?"var(--ui-muted, #f5f4f1)":"transparent"},onClick:()=>l.current?.click(),children:[q(af,{size:26,className:"mx-auto mb-2",style:{...Ee(26),color:"var(--ink-soft, #565b66)"}}),q("p",{className:"text-sm font-medium",style:{color:"var(--ink-soft, #565b66)"},children:i.openResponseDropZoneLabel}),q("p",{className:"text-xs hover:underline mt-0.5",style:{color:"var(--ink, #1d2025)"},children:i.openResponseDropZoneBrowse}),d&&q("p",{className:"text-xs mt-1 animate-pulse",style:{color:"var(--ink-faint, #8d93a0)"},children:i.openResponseUploading}),q("div",{className:"flex flex-wrap justify-center gap-1.5 mt-3",children:e.filter(k=>k!=="videoLink").map(k=>be("span",{className:"inline-flex items-center gap-1 text-[10px] px-2 py-0.5 bg-gray-100 text-gray-600 rounded-full",children:[xf[k]," ",M[k]]},k))})]}),b&&c&&q("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}`}),q("input",{ref:l,type:"file",accept:A,onChange:async k=>{let S=k.target.files?.[0];S&&(await C(S),k.target.value="")},className:"hidden"}),y&&be("div",{className:"flex gap-2 flex-wrap",children:[q("input",{type:"url",value:h,onChange:k=>m(k.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:k=>{k.key==="Enter"&&(k.preventDefault(),R())}}),q("button",{type:"button",onClick:R,disabled:!h.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&&q("p",{className:"text-sm text-gray-400 text-center py-3",children:i.openResponseNoSubmission})]})}function wf({file:e,onRemove:t,compact:r,t:n}){if(e.kind==="videoLink"){let o=e.platform==="youtube"?yf(e.url):null;return be("div",{className:qt("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&&q("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"}),q("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&&q("button",{type:"button",onClick:t,className:"ml-auto text-gray-400 hover:text-rose-500 text-xs",children:"\u2715"})]})}return be("div",{className:qt("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/")?q("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:q("span",{className:"flex-1 min-w-0",children:q(Nt,{src:e.url,durationHint:e.duration})}):e.mimeType?.startsWith("video/")?q("video",{src:e.url,controls:!0,className:r?"hidden":"h-16 max-w-[240px] rounded"}):q(Gl,{size:20,style:{...Ee(20),color:"var(--ink-soft, #565b66)"}}),be("div",{className:"flex-1 min-w-0",children:[q("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/")&&q(Nt,{src:e.url,durationHint:e.duration})]}),t&&q("button",{type:"button",onClick:t,className:"ml-auto text-gray-400 hover:text-rose-500 text-xs shrink-0",children:"\u2715"})]})}function kf({nodeId:e,placeholder:t,allowFormatting:r,wordLimit:n,characterLimit:o,allowedTypes:a,allowMultiple:s,fileInstructions:i,isDisabled:c,feedbackBorderClass:l,files:d,setFiles:u,emitAnswer:p,answerBus:f,mediaHandler:h,t:m}){let[b,y]=tt(null),[x,A]=tt(!1);return nt(()=>{p({...b&&{text:b},files:d.length>0?d:void 0})},[b,d]),be("div",{className:"space-y-2",children:[q(Xl,{nodeId:e,placeholder:t,allowFormatting:r,wordLimit:n,characterLimit:o,isDisabled:c,feedbackBorderClass:l,emitAnswer:g=>y(g),answerBus:f}),!c&&be("div",{children:[be("button",{type:"button",onClick:()=>A(!x),className:"flex items-center gap-1.5 text-xs",style:{color:"var(--ink-soft, #565b66)"},children:[q("span",{children:x?"\u25BE":"\u25B8"}),be("span",{children:[m.openResponseAttachFiles,d.length>0&&q("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})]})]}),x&&q("div",{className:"mt-1.5",children:q(_s,{allowedTypes:a,allowMultiple:s,fileInstructions:i,isDisabled:c,feedbackBorderClass:l,files:d,setFiles:u,mediaHandler:h,t:m,compact:!0})})]}),c&&d.length>0&&be("div",{className:"space-y-1",children:[q("p",{className:"text-xs text-gray-500 font-medium",children:m.openResponseAttachedFiles}),q(_s,{allowedTypes:a,allowMultiple:s,isDisabled:!0,feedbackBorderClass:l,files:d,setFiles:u,t:m,compact:!0})]})]})}var Sf=180,Rf={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 Pf(e){if(!(typeof MediaRecorder>"u"||typeof MediaRecorder.isTypeSupported!="function"))return Rf[e].find(t=>MediaRecorder.isTypeSupported(t))}function Cf(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 Nf(e){return e instanceof DOMException?e.name==="AbortError":e?.name==="AbortError"}function Af({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"?Sf:null,[u,p]=tt("idle"),[f,h]=tt(null),[m,b]=tt(null),[y,x]=tt(0),[A,g]=tt(null),[T,C]=tt(null),E=Ve(null),R=Ve(null),M=Ve([]),k=Ve(0),S=Ve(null),v=Ve(null),O=Ve(null),_=Ve(null),w=Ve(0),X=Ve(null),Y=Ve(null),F=Ve(null);nt(()=>{let I=re=>{let ie=(re.answers??[]).find(ve=>ve.nodeId===e&&ve.type==="openResponse")?.answer?.recording;ie?.url&&(h(ie),p("saved"))},G=()=>{X.current?.abort(),h(null),b(null),C(null),p("idle")};return i.on("answers:prefill",I),i.on("answers:reset",G),()=>{i.off("answers:prefill",I),i.off("answers:reset",G)}},[e,i]);let L=()=>{cancelAnimationFrame(w.current);let I=_.current;_.current=null,I&&I.state!=="closed"&&I.close().catch(()=>{})},B=()=>{R.current?.getTracks().forEach(I=>I.stop()),R.current=null};nt(()=>()=>{S.current&&clearInterval(S.current),L(),B(),X.current?.abort()},[]),nt(()=>{let I=m?.url;return()=>{I&&URL.revokeObjectURL(I)}},[m?.url]);let J=I=>{let G=O.current,re=window.AudioContext||window.webkitAudioContext;if(!G||!re)return;let ne;try{ne=new re}catch{return}_.current=ne;let ie=ne.createAnalyser();ie.fftSize=512,ne.createMediaStreamSource(I).connect(ie);let ve=new Uint8Array(ie.fftSize),Ye=window.devicePixelRatio||1,Qe=Math.max(1,G.clientWidth),ee=Math.max(1,G.clientHeight);G.width=Math.round(Qe*Ye),G.height=Math.round(ee*Ye);let fe=G.getContext("2d");if(!fe)return;fe.scale(Ye,Ye);let xe=3,ke=2,Ae=[],Wt=Math.floor(Qe/(xe+ke)),Rt=0,Pt=se=>{if(w.current=requestAnimationFrame(Pt),se-Rt<50)return;Rt=se,ie.getByteTimeDomainData(ve);let $=0;for(let ue=0;ue<ve.length;ue++){let ce=(ve[ue]-128)/128;$+=ce*ce}Ae.push(Math.min(1,Math.sqrt($/ve.length)*3)),Ae.length>Wt&&Ae.shift(),fe.clearRect(0,0,Qe,ee),fe.fillStyle="#1d2025";let pe=Qe-Ae.length*(xe+ke);Ae.forEach((ue,ce)=>{let Te=Math.max(2,ue*ee);fe.fillRect(pe+ce*(xe+ke),(ee-Te)/2,xe,Te)})};w.current=requestAnimationFrame(Pt)};nt(()=>{u==="recording"&&t==="audio"&&R.current&&J(R.current)},[u]);let N=async(I,G)=>{if(!a)return;let re=new AbortController;X.current=re,Y.current={file:I,duration:G},C(null),g(0),p("uploading");try{let ne=await a.upload(I,l,{onProgress:ve=>{re.signal.aborted||g(Math.max(0,Math.min(1,ve)))},signal:re.signal});if(re.signal.aborted)return;let ie={url:ne.url,mimeType:ne.mimeType??I.type,duration:G,kind:l};Y.current=null,h(ie),p("saved"),s(ie)}catch(ne){if(re.signal.aborted||Nf(ne))return;p("failed"),C(c.recorderFailed)}finally{g(null)}},P=()=>{X.current?.abort(),Y.current=null,b(null),g(null),p(F.current?"saved":"idle")},K=()=>{let I=Y.current;I&&N(I.file,I.duration)},U=()=>{S.current&&(clearInterval(S.current),S.current=null);let I=E.current;I&&I.state!=="inactive"&&I.stop()},j=async()=>{if(!a){C(c.recorderUnavailableHere);return}if(!(typeof MediaRecorder<"u"&&typeof navigator<"u"&&!!navigator.mediaDevices?.getUserMedia&&(t!=="screen"||!!navigator.mediaDevices.getDisplayMedia))){C(c.recorderUnsupported);return}X.current?.abort(),F.current=f,C(null),p("requesting");let G;try{if(t==="screen"){G=await navigator.mediaDevices.getDisplayMedia({video:!0,audio:!1});try{let ve=(await navigator.mediaDevices.getUserMedia({audio:!0})).getAudioTracks()[0];ve&&G.addTrack(ve)}catch{}G.getVideoTracks()[0]?.addEventListener("ended",()=>U())}else t==="video"?G=await navigator.mediaDevices.getUserMedia({audio:!0,video:{facingMode:"user"}}):G=await navigator.mediaDevices.getUserMedia({audio:!0})}catch(ie){let ve=ie?.name;p(f?"saved":"idle"),C(ve==="NotAllowedError"||ve==="SecurityError"||ve==="NotFoundError"?c.openResponsePermissionDenied:c.recorderUnsupported);return}let re=Pf(l),ne;try{ne=re?new MediaRecorder(G,{mimeType:re}):new MediaRecorder(G)}catch{try{ne=new MediaRecorder(G)}catch{G.getTracks().forEach(ie=>ie.stop()),p(f?"saved":"idle"),C(c.recorderUnsupported);return}}R.current=G,E.current=ne,M.current=[],ne.ondataavailable=ie=>{ie.data.size>0&&M.current.push(ie.data)},ne.onstop=()=>{let ie=Math.max(1,Math.round((performance.now()-k.current)/1e3)),ve=ne.mimeType||re||`${l}/webm`,Ye=new Blob(M.current,{type:ve});if(M.current=[],L(),B(),v.current&&(v.current.srcObject=null),Ye.size===0){p(F.current?"saved":"idle"),C(c.recorderUnsupported);return}let Qe=new File([Ye],`recording.${Cf(ve,l)}`,{type:ve});b({url:URL.createObjectURL(Ye),duration:ie}),N(Qe,ie)},ne.start(250),k.current=performance.now(),x(0),p("recording"),S.current=setInterval(()=>{let ie=(performance.now()-k.current)/1e3;x(ie),d&&ie>=d&&U()},200)};nt(()=>{let I=v.current;u==="recording"&&I&&R.current&&(I.srcObject=R.current,I.play().catch(()=>{}))},[u]);let de=m?.url??f?.url??null,z=m?.duration??f?.duration??null,W=de?l==="audio"?q(Nt,{src:de,durationHint:z}):q("video",{src:de,controls:!0,playsInline:!0,preload:"metadata"}):null;if(n)return q("div",{className:qt("edp-rec",o),children:f?l==="audio"?q(Nt,{src:f.url,durationHint:f.duration}):q("video",{src:f.url,controls:!0,playsInline:!0,preload:"metadata"}):q("p",{className:"edp-rec-message",children:c.recorderNone})});let le=t==="audio"?q(sf,{"aria-hidden":!0}):t==="screen"?q(cf,{"aria-hidden":!0}):q(Vl,{"aria-hidden":!0});return be("div",{className:qt("edp-rec",o),children:[(u==="idle"||u==="requesting")&&be("div",{className:"edp-rec-idle",children:[q("button",{type:"button",className:"edp-rec-record",onClick:j,disabled:u==="requesting"||!a,"aria-label":t==="screen"?c.openResponseTapToRecordScreen:c.recorderRecord,children:le}),q("span",{className:"edp-rec-label",children:u==="requesting"?c.openResponseRequestingPermission:c.recorderRecord}),d&&q("span",{className:"edp-rec-limit",children:c.recorderUpTo(Ts(d))}),!a&&q("p",{className:"edp-rec-message",children:c.recorderUnavailableHere})]}),u==="recording"&&be(Pn,{children:[l==="video"&&q("video",{ref:v,muted:!0,playsInline:!0}),be("div",{className:"edp-rec-live",role:"status","aria-label":c.recorderRecordingAria,children:[t==="audio"?q("canvas",{ref:O,className:"edp-rec-level","aria-hidden":!0}):q("span",{style:{flex:1}}),be("span",{className:"edp-rec-clock",dir:"ltr",children:[q("span",{className:"edp-rec-dot","aria-hidden":!0}),Ts(Math.floor(y)),d&&be("small",{children:["/ ",Ts(d)]})]}),be("button",{type:"button",className:"edp-rec-stop",onClick:U,children:[q("i",{"aria-hidden":!0}),c.openResponseStopRecording]})]})]}),(u==="uploading"||u==="saved"||u==="failed")&&be(Pn,{children:[W,be("div",{className:"edp-rec-foot",children:[u==="uploading"&&be(Pn,{children:[q("span",{className:"edp-rec-status","aria-live":"polite",children:A&&A>0?c.recorderSaving(Math.round(A*100)):c.openResponseUploading}),q("span",{className:"edp-rec-progress","aria-hidden":!0,children:q("span",{style:{width:`${Math.round((A??0)*100)}%`}})}),q("button",{type:"button",className:"edp-rec-link",onClick:P,children:c.recorderCancel})]}),u==="saved"&&be(Pn,{children:[be("span",{className:"edp-rec-status edp-rec-status--ok","aria-live":"polite",children:[q(mf,{size:16,"aria-hidden":!0}),c.recorderSaved]}),q("button",{type:"button",className:"edp-rec-link",onClick:j,children:c.recorderRecordAgain})]}),u==="failed"&&be(Pn,{children:[be("span",{className:"edp-rec-status edp-rec-status--error",role:"alert",children:[q(hf,{size:16,"aria-hidden":!0}),T??c.recorderFailed]}),be("span",{style:{display:"inline-flex",gap:"1rem"},children:[q("button",{type:"button",className:"edp-rec-link",onClick:K,children:c.recorderRetry}),q("button",{type:"button",className:"edp-rec-link",onClick:j,children:c.recorderRecordAgain})]})]})]})]}),T&&u!=="failed"&&q("p",{className:"edp-rec-message",role:"alert",children:T})]})}function Tf({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 be("div",{className:"rounded p-3 text-sm border",style:{background:o.bg,borderColor:o.border,color:"var(--ink, #1d2025)"},children:[q("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&&be("div",{className:"mt-1 text-right",style:{fontFamily:'var(--font-hand, "Caveat", cursive)',fontSize:V("1.4rem"),lineHeight:1,color:o.ink},children:[r," pts"]})]})}import{jsx as kt,jsxs as kr,Fragment as Jl}from"react/jsx-runtime";import{useEffect as Lo,useLayoutEffect as Mf,useMemo as Es,useRef as Cn,useState as Zl}from"react";import ed from"clsx";var _f={left:"moveToPreviousChar",right:"moveToNextChar",backspace:"deleteBackward",enter:null};function Ms(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?fr(r):null;return n?[n]:[]},refocus(){let r=e.field();if(!r)return;let n=fr(r);n?.blur(),r.focus(),n?.focus({preventScroll:!0})},editable:()=>e.editable(),insert(r){let n=e.field();n&&(r===")"&&Lr(n)||br(n,r),t())},command(r){let n=e.field(),o=_f[r];!n||!o||(n.executeCommand?.(o),t())},caret:()=>"formula",caretRect:()=>e.field()?.getBoundingClientRect()??null,labels:()=>e.labels()??Er,dir(){let r=e.root()?.parentElement;return r&&getComputedStyle(r).direction==="rtl"?"rtl":"ltr"}}}function Ef(e){return e?.showFeedback?e.state==="validating"?"validating":e.state==="correct"?"correct":e.state==="incorrect"?"incorrect":"idle":"idle"}var td=e=>Number.isInteger(e)?String(e):e.toFixed(2);function eo({nodeId:e,placeholder:t,hint:r,validationFeedback:n,readOnly:o=!1}){let a=me(),s=Me(),i=Cn(null),c=Cn(null),l=Cn(null),[d,u]=Zl(""),[p,f]=Zl(!1),h=vo(),m=Es(()=>xn(a),[a]),b=Cn(m);b.current=m;let y=Cn(o);y.current=o;let x=Ef(n),A=n?.score,g=n?.maxScore,T=n?.displayAnswer,C=Es(()=>T?Fe(T,!1):"",[T]),E=Es(()=>o&&d?Fe(d,!1):"",[o,d]);Lo(()=>{let S=!0;return yt().then(v=>S&&v&&f(!0)),()=>{S=!1}},[]),Mf(()=>{if(!p||o)return;let S=c.current;return Xt(S),()=>po(S)},[p,o]),Lo(()=>{if(!p||o)return;let S=Ms({field:()=>c.current,root:()=>i.current,editable:()=>!y.current,labels:()=>b.current,onChange:O=>u(O)});l.current=S;let v=Le.register(S);return()=>{v(),l.current=null}},[p,o]),Lo(()=>{let S=v=>{let O=v.answers?.find(_=>_.nodeId===e&&_.type==="mathResponse");if(O?.answer?.latex!==void 0){u(O.answer.latex);let _=c.current;_&&(_.value=O.answer.latex)}};return s.on("answers:prefill",S),()=>s.off("answers:prefill",S)},[s,e]),Lo(()=>{s.emit({type:"answer:changed",answer:{nodeId:e,type:"mathResponse",timestamp:Date.now(),answer:{latex:d}}})},[d,e,s]);let R=!!l.current&&h.active===l.current,M=S=>{if(o)return;let v=c.current;!v||v.contains(S.target)||(S.preventDefault(),v.focus())},k=()=>{let S=l.current;S&&Le.openFor(S)};return kr("span",{className:"math-response-player edp-slot-wrap",children:[kr("span",{ref:i,dir:"ltr",className:ed("edp-slot",x!=="idle"&&`edp-slot--${x}`,o&&"edp-slot--readonly",R&&"is-active",!d&&"is-empty"),onMouseDown:M,children:[o&&p?kt("span",{className:"edp-slot-printed",dangerouslySetInnerHTML:{__html:E||"&#8203;"}}):p?kt("math-field",{ref:c,value:d,onInput:S=>u(S.target.value??""),onFocus:S=>Xt(S.currentTarget),"math-virtual-keyboard-policy":"manual","smart-fence":"true","aria-label":a.blankAnswerAria,className:"edp-slot-mf"}):kt("input",{type:"text",value:d,onChange:S=>u(S.target.value),readOnly:o,"aria-label":a.blankAnswerAria,className:"edp-slot-fallback"}),!d&&!R&&!o&&kt("span",{className:"edp-slot-hint","aria-hidden":"true",children:t||a.mathSlotPlaceholder}),p&&!o&&!h.touch&&kt("button",{type:"button",className:ed("edp-slot-kb",R&&h.mode==="maths"&&"is-open"),onMouseDown:S=>S.preventDefault(),onClick:k,"aria-label":a.kbMaths,title:a.kbMaths,tabIndex:-1,children:"\u2211"})]}),kt(Tt,{hint:r}),n?.showFeedback&&x!=="idle"&&kr("span",{className:`edp-slot-feedback edp-slot-feedback--${x}`,role:"status",children:[x==="validating"&&kr(Jl,{children:[kt("span",{className:"player-math-spinner"}),kt("span",{children:a.mathChecking})]}),x==="correct"&&kr(Jl,{children:[kt("span",{"aria-label":a.mathCorrect,children:"\u2713"}),A!=null&&kr("span",{className:"edp-slot-score",children:[td(A),g!=null?` / ${td(g)}`:""]})]}),x==="incorrect"&&kt("span",{"aria-label":a.mathIncorrect,children:"\u2717"}),x==="incorrect"&&C&&kr("span",{className:"player-blank-reveal edp-slot-reveal",children:["(",kt("span",{dangerouslySetInnerHTML:{__html:C}}),")"]})]})]})}import{jsx as we,jsxs as Be,Fragment as Tn}from"react/jsx-runtime";import{useCallback as Yf,useEffect as Qf,useRef as Xf,useState as An}from"react";import{Play as Jf,Lock as Zf,Check as Is,X as od}from"lucide-react";function zo(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,u)=>zo(d,l[u]))}let o=e,a=t,s=Object.keys(o),i=Object.keys(a);return s.length!==i.length?!1:s.every(c=>zo(o[c],a[c]))}var Lf=`
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 cf(e,t,r,n,o,a,s,i,c){return new Promise(l=>{let p=new Blob([sf],{type:"text/javascript"}),d=URL.createObjectURL(p),u=new Worker(d),f=setTimeout(()=>{u.terminate(),URL.revokeObjectURL(d),l({testId:n,passed:!1,stderr:`Execution timed out after ${c}ms`,errored:!0})},c);u.onmessage=h=>{clearTimeout(f),u.terminate(),URL.revokeObjectURL(d);let m=h.data;if(t==="function"&&!m.errored){let b=No(m.actual,a);l({testId:n,passed:b,actual:m.actual,stderr:m.stderr,durationMs:m.durationMs})}else l({testId:n,passed:m.passed??!1,actualStdout:m.actualStdout,stderr:m.stderr,durationMs:m.durationMs,errored:m.errored})},u.onerror=h=>{clearTimeout(f),u.terminate(),URL.revokeObjectURL(d),l({testId:n,passed:!1,stderr:h.message,errored:!0})},u.postMessage({testId:n,source:e,mode:t,entryFunction:r,args:o,expectedStdout:i,timeout:c})})}var lf="0.27.7";function df(){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||lf}/full/`}var yn=null;function pf(e){return typeof globalThis.loadPyodide=="function"?Promise.resolve():yn||(yn=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=()=>{yn=null,r(new Error(`Failed to load Pyodide from ${n.src}`))},document.head.appendChild(n)}),yn)}var Co=null;async function uf(){if(Co)return Co;let e=df();await pf(e);let t=globalThis.loadPyodide;if(typeof t!="function")throw new Error("Pyodide global not available after loading the CDN script");return Co=await t({indexURL:e}),Co}async function mf(e,t,r,n,o,a,s,i,c){let l=Date.now();try{let p=await uf();if(t==="stdio"){p.runPython(`
44
+ `;async function If(e,t,r,n,o,a,s,i,c){return new Promise(l=>{let d=new Blob([Lf],{type:"text/javascript"}),u=URL.createObjectURL(d),p=new Worker(u),f=setTimeout(()=>{p.terminate(),URL.revokeObjectURL(u),l({testId:n,passed:!1,stderr:`Execution timed out after ${c}ms`,errored:!0})},c);p.onmessage=h=>{clearTimeout(f),p.terminate(),URL.revokeObjectURL(u);let m=h.data;if(t==="function"&&!m.errored){let b=zo(m.actual,a);l({testId:n,passed:b,actual:m.actual,stderr:m.stderr,durationMs:m.durationMs})}else l({testId:n,passed:m.passed??!1,actualStdout:m.actualStdout,stderr:m.stderr,durationMs:m.durationMs,errored:m.errored})},p.onerror=h=>{clearTimeout(f),p.terminate(),URL.revokeObjectURL(u),l({testId:n,passed:!1,stderr:h.message,errored:!0})},p.postMessage({testId:n,source:e,mode:t,entryFunction:r,args:o,expectedStdout:i,timeout:c})})}var $f="0.27.7";function zf(){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||$f}/full/`}var Nn=null;function Ff(e){return typeof globalThis.loadPyodide=="function"?Promise.resolve():Nn||(Nn=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=()=>{Nn=null,r(new Error(`Failed to load Pyodide from ${n.src}`))},document.head.appendChild(n)}),Nn)}var Io=null;async function Df(){if(Io)return Io;let e=zf();await Ff(e);let t=globalThis.loadPyodide;if(typeof t!="function")throw new Error("Pyodide global not available after loading the CDN script");return Io=await t({indexURL:e}),Io}async function Of(e,t,r,n,o,a,s,i,c){let l=Date.now();try{let d=await Df();if(t==="stdio"){d.runPython(`
45
45
  import sys, io
46
46
  _stdout_capture = io.StringIO()
47
47
  sys.stdout = _stdout_capture
48
- `),s&&p.runPython(`
48
+ `),s&&d.runPython(`
49
49
  import io
50
50
  sys.stdin = io.StringIO(${JSON.stringify(s)})
51
- `),p.runPython(e);let d=p.runPython("_stdout_capture.getvalue()");p.runPython("sys.stdout = sys.__stdout__");let u=d.trim()===(i||"").trim();return{testId:n,passed:u,actualStdout:d,durationMs:Date.now()-l}}else{p.runPython(e);let d=(o||[]).map(h=>JSON.stringify(h)).join(", "),u=p.runPython(`${r}(${d})`),f=No(u,a);return{testId:n,passed:f,actual:u,durationMs:Date.now()-l}}}catch(p){return{testId:n,passed:!1,stderr:String(p),errored:!0,durationMs:Date.now()-l}}}var Ao=null;async function hf(){if(Ao)return Ao;let e=await import("./sql-wasm-browser-NICPVFVD.mjs");return Ao=await(e.default??e)(),Ao}async function ff(e,t,r,n){let o=Date.now();try{let a=await hf(),s=new a.Database;r&&s.run(r);let c=s.exec(e).flatMap(p=>p.values.map(d=>d.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 gf(e){let{transform:t}=await import("./esm-RQP7AIMT.mjs");return t(e,{transforms:["typescript"]}).code}var $r=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 gf(n)}catch(p){return s.map(d=>({testId:d.id,passed:!1,stderr:`TypeScript compile error: ${p.message}`,errored:!0}))}let l=[];for(let p of s){let d;r==="python"?d=await mf(c,o,a,p.id,p.args,p.expectedReturn,p.stdin,p.expectedStdout,i):r==="sql"?d=await ff(c,p.id,p.stdin,p.expectedStdout):d=await cf(c,o,a,p.id,p.args,p.expectedReturn,p.stdin,p.expectedStdout,i),l.push(d)}return l}};import{jsx as Dl}from"react/jsx-runtime";import{forwardRef as bf,useEffect as yf,useImperativeHandle as xf,useRef as vf,useState as wf}from"react";function kf(e){return{javascript:"javascript",typescript:"typescript",python:"python",sql:"sql",java:"java",cpp:"cpp",go:"go"}[e]??"plaintext"}var xs=bf(function({value:t,onChange:r,language:n="javascript",readOnly:o=!1,readOnlyRanges:a,placeholder:s,height:i=300,className:c,autoFocus:l},p){let[d,u]=wf(null),{scale:f}=ot(),h=vf(null);yf(()=>{import("./dist-RXTJ74FF.mjs").then(P=>{u(()=>P.default)}).catch(()=>{})},[]),xf(p,()=>({getValue(){return h.current?.getValue?.()??t},focus(){h.current?.focus?.()},insert(P){let g=h.current;if(!g)return;let R=g.getSelection();g.executeEdits("insert",[{range:R,text:P,forceMoveMarkers:!0}])}}));function m(P){h.current=P,l&&P.focus(),a?.length&&P.onDidAttemptReadOnlyEdit(()=>{})}function b(P){r(P??"")}let w=typeof i=="number"?i*f:i;return d?Dl(d,{className:c,height:w,language:kf(n),value:t,onChange:b,onMount:m,options:{readOnly:o,minimap:{enabled:!1},fontSize:14*f,lineNumbers:"on",scrollBeyondLastLine:!1,automaticLayout:!0,tabSize:2,wordWrap:"on"}}):Dl("textarea",{className:c,value:t,onChange:P=>r(P.target.value),readOnly:o,placeholder:s,style:{width:"100%",height:typeof i=="number"?U(i):i,fontFamily:"monospace",fontSize:U(14),padding:U("0.5rem"),border:"1px solid #e2e8f0",borderRadius:U("0.375rem"),resize:"vertical",background:o?"#f8fafc":"white",boxSizing:"border-box"},autoFocus:l})});var Nf=new $r;function Tf(e){return e?.showFeedback?e.state??"idle":"idle"}function Ol(e){let t={};for(let r of e.attrs.starters??[])t[r.language]=r.code;return t}function _f({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 ze("div",{style:{padding:`${U("0.5rem")} ${U("0.75rem")}`,borderBottom:"1px solid var(--line, #e7e5e0)",fontSize:U("0.8125rem"),fontFamily:"var(--font-mono, ui-monospace, monospace)"},children:[ze("div",{style:{display:"flex",alignItems:"center",gap:U("0.5rem")},children:[we("span",{style:{color:s,fontWeight:700,fontSize:U("0.875rem"),display:"inline-flex"},children:i??(n?we(vs,{size:15,style:Te(15)}):we(Bl,{size:15}))}),we("span",{style:{fontWeight:600,color:"var(--ink, #1d2025)"},children:e.name??`Test ${e.id}`})]}),a&&!n&&ze("div",{style:{marginTop:U("0.25rem"),paddingLeft:U("1.5rem")},children:[r==="function"?we(vn,{children:t?.actual!==void 0&&ze("div",{style:{color:"var(--ink-soft, #565b66)"},children:[we("span",{style:{color:"var(--ink-faint, #8d93a0)"},children:"got: "}),we("span",{style:{color:"var(--pen, #d23b2b)"},children:JSON.stringify(t.actual)}),we("span",{style:{color:"var(--ink-faint, #8d93a0)"},children:" expected: "}),we("span",{style:{color:"var(--ok, #1f8a4c)"},children:JSON.stringify(e.expectedReturn)})]})}):we(vn,{children:t?.actualStdout!==void 0&&ze("div",{style:{color:"var(--ink-soft, #565b66)"},children:[ze("div",{children:[we("span",{style:{color:"var(--ink-faint, #8d93a0)"},children:"got: "}),we("span",{style:{color:"var(--pen, #d23b2b)",whiteSpace:"pre-wrap"},children:t.actualStdout||"(empty)"})]}),ze("div",{children:[we("span",{style:{color:"var(--ink-faint, #8d93a0)"},children:"expected: "}),we("span",{style:{color:"var(--ok, #1f8a4c)",whiteSpace:"pre-wrap"},children:e.expectedStdout||"(empty)"})]})]})}),t?.stderr&&we("div",{style:{color:"var(--almost-ink, #8a5a08)",marginTop:U("0.125rem"),whiteSpace:"pre-wrap"},children:t.stderr})]})]})}function Wn({node:e,validationFeedback:t,readOnly:r=!1,executor:n=Nf,gradingTests:o}){let a=Ne(),s=Pf(null),{attrs:i}=e,c=e.id,[l,p]=xn(i.defaultLanguage),[d,u]=xn(()=>Ol(e)),[f,h]=xn([]),[m,b]=xn(!1),[w,P]=xn(!1),g=d[l]??"",R=Tf(t);Rf(()=>{let E=K=>{let F=K.answers?.find(Y=>Y.nodeId===c&&Y.type==="codingResponse");F?.answer&&(F.answer.language&&p(F.answer.language),F.answer.sourceByLanguage&&u(F.answer.sourceByLanguage),F.answer.testResults&&h(F.answer.testResults))},y=()=>{u(Ol(e)),h([]),P(!1)};return a.on("answers:prefill",E),a.on("answers:reset",y),()=>{a.off("answers:prefill",E),a.off("answers:reset",y)}},[a,c,e]);let _=Sf((E,y,K)=>{a.emit({type:"answer:changed",answer:{nodeId:c,type:"codingResponse",timestamp:Date.now(),answer:{language:E,sourceByLanguage:y,source:y[E]??"",testResults:K}}})},[a,c]),A=E=>{let y={...d,[l]:E};u(y),_(l,y,f)},I=E=>{p(E),h([]),_(E,d,[])},C=async()=>{if(m)return;b(!0),h([]);let E=o??i.visibleSamples??[];if(E.length===0){b(!1);return}try{let y=await n.run({language:l,source:g,mode:i.testMode,entryFunction:i.entryFunction,tests:E,timeoutMs:5e3});h(y),_(l,d,y)}catch(y){let K=E.map(F=>({testId:F.id,passed:!1,stderr:String(y),errored:!0}));h(K),_(l,d,K)}finally{b(!1)}},L=()=>{w||(P(!0),_(l,d,f))},v=(o??[]).filter(E=>E.hidden).length,S=v>0?f.filter(E=>(o??[]).find(K=>K.id===E.testId)?.hidden&&E.passed).length:0,x=o?o.filter(E=>!E.hidden):i.visibleSamples??[],B=R==="correct"?"var(--ok, #1f8a4c)":R==="partial"?"var(--almost, #c8810e)":R==="incorrect"?"var(--pen, #d23b2b)":"var(--line-strong, #d6d3cc)";return ze("div",{style:{margin:`${U("0.75rem")} 0`,border:`1px solid ${B}`,borderRadius:U("0.875rem"),overflow:"hidden",transition:"border-color 0.2s"},children:[ze("div",{style:{background:"var(--ui-muted, #f5f4f1)",borderBottom:"1px solid var(--line, #e7e5e0)",padding:`${U("0.5rem")} ${U("0.75rem")}`,display:"flex",alignItems:"center",gap:U("0.5rem"),flexWrap:"wrap"},children:[we("div",{style:{display:"flex",gap:U("0.25rem")},children:i.languages.map(E=>we("button",{onClick:()=>!r&&I(E),disabled:r,style:{padding:`${U("0.2rem")} ${U("0.6rem")}`,borderRadius:U("0.375rem"),border:"1px solid",borderColor:l===E?"var(--ink, #1d2025)":"var(--line, #e7e5e0)",background:l===E?"var(--ink, #1d2025)":"var(--card, #fff)",color:l===E?"#fff":"var(--ink-soft, #565b66)",fontSize:U("0.75rem"),fontWeight:600,cursor:r?"default":"pointer",fontFamily:"var(--font-mono, ui-monospace, monospace)"},children:E},E))}),we("div",{style:{flex:1}}),we(kt,{hint:i.hint}),!r&&ze(vn,{children:[ze("button",{onClick:C,disabled:m,style:{padding:`${U("0.25rem")} ${U("0.75rem")}`,borderRadius:U("0.5rem"),border:"1px solid var(--line-strong, #d6d3cc)",background:m?"var(--ui-muted, #f5f4f1)":"var(--card, #fff)",color:"var(--ink, #1d2025)",fontSize:U("0.8125rem"),fontWeight:600,cursor:m?"not-allowed":"pointer",display:"inline-flex",alignItems:"center",gap:U("0.35rem")},children:[we(Cf,{size:13,style:Te(13)})," ",m?"Running\u2026":"Run"]}),ze("button",{onClick:L,disabled:w,style:{padding:`${U("0.3rem")} ${U("0.85rem")}`,borderRadius:U("0.5rem"),border:"none",background:w?"var(--ok-soft, #ecf8f0)":"var(--ink, #1d2025)",color:w?"var(--ok, #1f8a4c)":"#fff",fontSize:U("0.8125rem"),fontWeight:600,cursor:w?"default":"pointer",display:"inline-flex",alignItems:"center",gap:U("0.35rem")},children:[w&&we(vs,{size:13,style:Te(13)})," ",w?"Submitted":"Submit"]})]})]}),we(xs,{ref:s,value:g,onChange:A,language:l,readOnly:r,readOnlyRanges:i.starters.find(E=>E.language===l)?.readOnlyRanges,height:320}),(f.length>0||x.length>0)&&ze("div",{style:{borderTop:"1px solid var(--line, #e7e5e0)",background:"var(--paper, #fbfaf7)"},children:[we("div",{style:{padding:`${U("0.5rem")} ${U("0.75rem")}`,fontSize:U("0.7rem"),fontWeight:700,color:"var(--ink-faint, #8d93a0)",textTransform:"uppercase",letterSpacing:"0.05em"},children:"Test Results"}),x.map(E=>we(_f,{sample:E,result:f.find(y=>y.testId===E.id),mode:i.testMode},E.id)),v>0&&ze("div",{style:{padding:`${U("0.5rem")} ${U("0.75rem")}`,fontSize:U("0.8125rem"),color:"var(--ink-soft, #565b66)",borderTop:"1px solid var(--line, #e7e5e0)",fontStyle:"italic",display:"flex",alignItems:"center",gap:U("0.4rem")},children:[we(Af,{size:13,style:Te(13)})," Hidden tests: ",S,"/",v," passed"]})]}),t?.showFeedback&&ze("div",{style:{padding:`${U("0.55rem")} ${U("0.75rem")}`,fontSize:U("0.85rem"),fontWeight:600,borderTop:"1px solid var(--line, #e7e5e0)",display:"flex",alignItems:"center",gap:U("0.45rem"),background:R==="correct"?"var(--ok-soft, #ecf8f0)":R==="partial"?"var(--almost-soft, #fbf1dc)":R==="incorrect"?"var(--pen-soft, #fdeeec)":"transparent",color:R==="correct"?"var(--ok, #1f8a4c)":R==="partial"?"var(--almost-ink, #8a5a08)":R==="incorrect"?"var(--pen, #d23b2b)":"var(--ink-soft, #565b66)"},children:[R==="correct"&&ze(vn,{children:[we(vs,{size:15,style:Te(15)})," All tests passed"]}),R==="partial"&&"Partial credit",R==="incorrect"&&ze(vn,{children:[we(Bl,{size:15,style:Te(15)})," Tests failed"]}),R==="validating"&&"Evaluating\u2026",R==="awaiting_review"&&"Awaiting teacher review",t.score!==void 0&&ze("span",{style:{marginLeft:"auto",fontFamily:'var(--font-hand, "Caveat", cursive)',fontSize:U("1.5rem"),lineHeight:1},children:[t.score," / ",t.maxScore??i.maxScore]})]})]})}import{Fragment as Lf,jsx as To,jsxs as If}from"react/jsx-runtime";import{createContext as $f,useContext as Ff,useEffect as zf}from"react";import{DndContext as Df,MouseSensor as Of,TouchSensor as Bf,KeyboardSensor as jf,useDndContext as qf,useSensor as Ss,useSensors as Hf}from"@dnd-kit/core";import{jsx as ws}from"react/jsx-runtime";import{DragOverlay as Mf,useDndContext as Ef}from"@dnd-kit/core";function ks(){let{active:e}=Ef();if(!e)return null;let t=e.data.current?.html??"";return ws(Mf,{dropAnimation:null,children:ws("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:ws("span",{dangerouslySetInnerHTML:{__html:t},style:{pointerEvents:"none",whiteSpace:"nowrap",lineHeight:"1.25"}})})})}function Uf(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 Kf(){let{activeNode:e}=qf();return zf(()=>{if(!(!e||typeof document>"u"))return Uf(e,document.scrollingElement,t=>getComputedStyle(t).scrollBehavior)},[e]),null}var jl=$f(!1),Wf={acceleration:3,threshold:{x:0,y:.25}};function _o({children:e}){let t=Ff(jl),r=Ss(Of,{activationConstraint:{distance:8}}),n=Ss(Bf,{activationConstraint:{delay:250,tolerance:5}}),o=Ss(jf),a=Hf(r,n,o);return t?To(Lf,{children:e}):To(jl.Provider,{value:!0,children:If(Df,{sensors:a,autoScroll:Wf,children:[e,To(ks,{}),To(Kf,{})]})})}function zr({content:e,onAnswersChange:t,onSubmit:r,answerBus:n,namespace:o,initialAnswers:a,validationFeedback:s,className:i="",locale:c,readOnly:l=!1,mediaHandler:p,answerSheetHandler:d,codeExecutor:u,display:f}){let h=nt(f),m=Vf(()=>lt(h),[h]),b=Gf(null);b.current||(b.current=new Tt);let w=n??b.current;Rs(()=>{a&&a.length>0&&w.prefillAnswers(a)},[a,w]),Rs(()=>{if(!t)return;let g=()=>{let R=w.getAllAnswers();t(R)};return w.on("answer:changed",g),()=>w.off("answer:changed",g)},[w,t]),Rs(()=>{if(!r)return;let g=R=>{r(R.answers)};return w.on("answer:submitted",g),()=>w.off("answer:submitted",g)},[w,r]);let P=ct(e,s,{readOnly:l,mediaHandler:p,answerSheetHandler:d,codeExecutor:u});return Fr(Jt,{locale:c,children:Fr(at,{display:h,children:Fr(Mn,{bus:w,children:Fr(_o,{children:Fr(Gn,{initialAnswers:a,children:Fr("div",{className:`question-runtime ${i}${m.sizeSet?" edp-scaled":""}`,"data-namespace":o,style:{fontSize:U("1.125rem"),lineHeight:"1.75",...dt(m)},children:P})})})})})})}import{jsx as Dr,jsxs as Lo}from"react/jsx-runtime";import{memo as Jf,useCallback as Wl,useMemo as Zf,useRef as Kl}from"react";var ql={words:80,media:1,tableRows:6},Yf=new Set(["resizableImage","resizableVideo","youtubeEmbed"]);function Hl(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&&Yf.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 wn(e,t=ql){let r=Hl(e);return r.words>t.words||r.media>t.media||r.tableRows>t.tableRows}import{createContext as Qf,useContext as Xf}from"react";var Ul=Qf(null),Mo=Ul.Provider;function Eo(){return Xf(Ul)}function Io({exercise:e,onAnswersChange:t,validationFeedback:r,renderSharedContext:n,renderQuestion:o,renderSeparator:a,className:s="",locale:i,display:c}){let l=nt(c),p=Zf(()=>lt(l),[l]),d=Kl(new Map),u=Kl({exercise:e,onAnswersChange:t});u.current={exercise:e,onAnswersChange:t};let f=Wl((P,g)=>{d.current.set(P,g);let{exercise:R,onAnswersChange:_}=u.current;if(_){let A={exerciseId:R.id,questionAnswers:R.questions.map(I=>({questionId:I.id,answers:d.current.get(I.id)??[]}))};_(A)}},[]),h=Eo(),m=Wr(i),b=!!(h&&e.sharedContext&&wn(e.sharedContext)),w=e.sharedContext?b?Lo("p",{className:"exercise-reference-cue",children:[Dr("span",{children:m.referenceInPanel(h.label)})," ",Lo("button",{type:"button",className:"exercise-reference-cue__link",onClick:()=>h.showExerciseReference(e.id),children:[m.readReference,Dr("span",{"aria-hidden":"true",className:"exercise-reference-cue__arrow",children:"\u203A"})]})]}):Dr("div",{className:"exercise-shared-context",children:ct(e.sharedContext)}):null;return Dr(at,{display:l,children:Lo("div",{className:`exercise-runtime ${s}`,style:dt(p),children:[w&&(n?n(w):w),e.questions.map((P,g)=>{let R=r?.get(P.id),_=Dr(eg,{questionId:P.id,content:P.content,onQuestionAnswers:f,validationFeedback:R,locale:i},P.id);return Lo("div",{children:[o?o(P,_,g):_,a&&g<e.questions.length-1?a(g):null]},P.id)})]})})}var eg=Jf(function({questionId:t,onQuestionAnswers:r,...n}){let o=Wl(a=>r(t,a),[r,t]);return Dr(zr,{...n,onAnswersChange:o})});import{jsx as Ps,jsxs as tg}from"react/jsx-runtime";import{useCallback as rg,useEffect as ng,useMemo as og,useRef as Vl}from"react";function Vt({assessment:e,onAnswersChange:t,validationFeedback:r,renderExercise:n,renderSharedContext:o,renderSeparator:a,className:s="",brandingConfig:i,locale:c,display:l}){let p=Vl(new Map),d=nt(l),u=og(()=>lt(d),[d]);ng(()=>{if(!i?.fontUrl)return;let b=`edpire-brand-font-${i.fontUrl.replace(/\W/g,"").slice(-24)}`;if(document.getElementById(b))return;let w=document.createElement("link");w.id=b,w.rel="stylesheet",w.href=i.fontUrl,document.head.appendChild(w)},[i?.fontUrl]);let f={...dt(u)};i?.fontFamily&&(f["--brand-font"]=i.fontFamily);let h=Vl({assessment:e,onAnswersChange:t});h.current={assessment:e,onAnswersChange:t};let m=rg(b=>{p.current.set(b.exerciseId,b);let{assessment:w,onAnswersChange:P}=h.current;if(P){let g={exerciseAnswers:w.exercises.map(R=>p.current.get(R.id)??{exerciseId:R.id,questionAnswers:[]})};P(g)}},[]);return Ps(at,{display:d,children:Ps("div",{className:`assessment-runtime ${s}`,style:Object.keys(f).length?f:void 0,children:e.exercises.map((b,w)=>{let P=r?.get(b.id),g=Ps(Io,{exercise:b,onAnswersChange:m,validationFeedback:P,renderSharedContext:o?R=>o(R,b):void 0,locale:c},b.id);return tg("div",{children:[n?n(b,g,w):g,a&&w<e.exercises.length-1?a(w):null]},b.id)})})})}import{jsx as Gl}from"react/jsx-runtime";import{useMemo as ag}from"react";function Or({content:e,className:t,display:r}){let n=nt(r),o=ag(()=>lt(n),[n]);return Gl(at,{display:n,children:Gl("div",{className:`content-view ${t??""}`,style:dt(o),children:ct(e)})})}import{jsx as kn,Fragment as Yl,jsxs as $o}from"react/jsx-runtime";import{useMemo as sg}from"react";function Sn({item:e,className:t,renderFigureLabel:r,display:n}){let o=nt(n),a=sg(()=>lt(o),[o]);return kn(at,{display:o,children:$o("div",{className:`annex-item-view ${t??""}${a.sizeSet?" edp-scaled":""}`,style:dt(a),children:[e.type==="text-document"&&$o(Yl,{children:[e.title&&kn("h3",{className:"text-base font-semibold mb-2",children:e.title}),ct(e.content)]}),e.type==="figure"&&$o("figure",{children:[ct(e.content),kn("figcaption",{children:r?r(e.label):kn("span",{children:e.label})})]}),e.type==="rich-block"&&$o(Yl,{children:[e.title&&kn("h3",{className:"text-base font-semibold mb-2",children:e.title}),ct(e.content)]})]})})}import{jsx as i1,jsxs as c1}from"react/jsx-runtime";import{useState as d1}from"react";import{jsx as g1,jsxs as b1,Fragment as y1}from"react/jsx-runtime";import{useState as v1,useCallback as w1,useMemo as k1}from"react";import{useEditor as R1,EditorContent as P1}from"@tiptap/react";import A1 from"@tiptap/starter-kit";import{jsx as I1,jsxs as $1,Fragment as F1}from"react/jsx-runtime";import{useMemo as D1,useState as O1}from"react";import{jsx as Re,jsxs as Je,Fragment as pg}from"react/jsx-runtime";import{useEffect as Ql,useMemo as Ns,useRef as Ts,useState as Gt}from"react";function Cs(e,t){let r=[];for(let n of e){let o=n.questionId&&t.has(n.questionId)?n.questionId:null,a=r[r.length-1];a&&a.questionId===o?a.lines.push(n):r.push({id:r.length,lines:[n],questionId:o})}return r.filter(n=>Tr(n.lines).length>0)}function Br(e,t){return e.id in t?t[e.id]:e.questionId}function As(e,t,r,n){let o=new Map;for(let s of e){let i=Br(s,t);i&&o.set(i,[...o.get(i)??[],...s.lines])}let a=[];for(let s of n){let i=o.get(s);if(!i?.length)continue;let l=[...new Set(i.map(p=>p.page))].sort((p,d)=>p-d).map(p=>r[p]).filter(p=>!!p);a.push({nodeId:s,lines:i,photos:l})}return a}function _s({locale:e,...t}){return Re(Jt,{locale:e,children:Re(ug,{...t})})}function ug({handler:e,questions:t,isEmpty:r,place:n,onPlaced:o,onClose:a}){let s=ce(),[i,c]=Gt([]),[l,p]=Gt([]),[d,u]=Gt(!1),[f,h]=Gt({}),[m,b]=Gt({}),[w,P]=Gt(!1),[g,R]=Gt(0),[_,A]=Gt(!1),I=Ts(null),C=Ts(null),L=Ns(()=>new Set(t.map(O=>O.nodeId)),[t]),v=Ns(()=>Cs(i,L),[i,L]),S=()=>{g>0||v.length>0?A(!0):a()},x=Ts(S);x.current=_?()=>A(!1):S,Ql(()=>{I.current?.focus();let O=G=>{G.key==="Escape"&&x.current()};return window.addEventListener("keydown",O),()=>window.removeEventListener("keydown",O)},[]),Ql(()=>{_&&C.current?.focus()},[_]);let B=O=>(p(O),c([]),h({}),u(!1),{add:G=>c(T=>[...T,G]),end:()=>{}}),E=Ns(()=>d?new Set(t.filter(O=>!r(O.nodeId)).map(O=>O.nodeId)):new Set,[d,t]),y=()=>{let O=t.map(T=>T.nodeId),G=As(v,f,l,O).filter(T=>(m[T.nodeId]??"below")!=="leave"||!E.has(T.nodeId));if(G.length===0){P(!0);return}for(let T of G)n(T.nodeId,T.lines,T.photos,E.has(T.nodeId)?m[T.nodeId]==="replace"?"replace":"below":"replace");o(G.map(T=>T.nodeId)),a()},K=(O,G)=>{P(!1),h(T=>({...T,[O.id]:G===""?null:G}))},F=O=>Je("li",{className:"edp-copy-part",children:[Re("div",{className:"edp-copy-part-text",dir:"auto",dangerouslySetInnerHTML:{__html:ke(Tr(O.lines))}}),d&&Je("label",{className:"edp-copy-move",children:[Re("span",{children:s.copyMoveTo}),Je("select",{value:Br(O,f)??"",onChange:G=>K(O,G.target.value),children:[t.map(G=>Re("option",{value:G.nodeId,children:G.label},G.nodeId)),Re("option",{value:"",children:s.copyNowhere})]})]})]},O.id),Y=t.map(O=>({q:O,parts:v.filter(G=>Br(G,f)===O.nodeId)})).filter(O=>O.parts.length>0),$=v.filter(O=>Br(O,f)===null);return Re("div",{className:"edp-copy",role:"dialog","aria-modal":"true","aria-labelledby":"edp-copy-title",children:Je("div",{className:"edp-copy-sheet",children:[Je("div",{className:"edp-copy-head",children:[Re("h2",{id:"edp-copy-title",ref:I,tabIndex:-1,children:d?s.copyCheckTitle:s.copyTitle}),Re("button",{type:"button",className:"edp-sheet-panel-close",onClick:S,"aria-label":s.sheetClose,children:"\xD7"})]}),Je("div",{className:"edp-copy-body",children:[!d&&Re(bo,{purpose:"copy",handler:e,startLines:B,onRead:()=>{},onDone:()=>u(!0),onType:a,onClose:S,onPages:R}),v.length>0&&Je(pg,{children:[d&&Re("p",{className:"edp-copy-help",children:s.copyCheckHelp}),Y.map(({q:O,parts:G})=>Je("section",{className:"edp-copy-question","aria-label":O.label,children:[Re("h3",{children:O.label}),E.has(O.nodeId)&&Je("div",{className:"edp-copy-keep",role:"radiogroup","aria-label":s.copyHasText,children:[Re("span",{children:s.copyHasText}),["below","replace","leave"].map(T=>Je("label",{className:"edp-copy-keep-option",children:[Re("input",{type:"radio",name:`edp-copy-keep-${O.nodeId}`,checked:(m[O.nodeId]??"below")===T,onChange:()=>b(N=>({...N,[O.nodeId]:T}))}),T==="below"?s.copyBelow:T==="replace"?s.copyReplace:s.copyLeave]},T))]}),Re("ul",{className:"edp-copy-parts",children:G.map(F)})]},O.nodeId)),$.length>0&&Je("section",{className:"edp-copy-question edp-copy-question--loose","aria-label":s.copyNotPlaced,children:[Re("h3",{children:s.copyNotPlaced}),d&&Re("p",{className:"edp-copy-help",children:s.copyNotPlacedHelp}),Re("ul",{className:"edp-copy-parts",children:$.map(F)})]})]})]}),_?Je("div",{className:"edp-copy-foot",role:"alertdialog","aria-labelledby":"edp-copy-leave",children:[Re("p",{id:"edp-copy-leave",className:"edp-copy-leave",children:v.length>0?s.copyLeaveRead:s.copyLeavePages}),Je("div",{className:"edp-sheet-panel-actions",children:[Re("button",{ref:C,type:"button",className:"edp-sheet-btn",onClick:()=>A(!1),children:s.copyLeaveBack}),Re("button",{type:"button",className:"edp-sheet-btn edp-sheet-btn--end",onClick:a,children:s.copyLeaveConfirm})]})]},"leave"):d&&Je("div",{className:"edp-copy-foot",children:[w&&Re("p",{className:"edp-sheet-hint",role:"alert",children:s.copyNothing}),Je("div",{className:"edp-sheet-panel-actions",children:[Re("button",{type:"button",className:"edp-sheet-btn",onClick:S,children:s.copyCancel}),Re("button",{type:"button",className:"edp-sheet-btn edp-sheet-btn--primary edp-sheet-btn--end",onClick:y,children:s.copyConfirm})]})]},"check")]})})}import{Send as vd,Loader2 as js,BarChart2 as qs,CheckCircle2 as wd,XCircle as jg,RotateCcw as qg,X as Hs,Clock as qr,AlertTriangle as Hg,AlertCircle as Ug,Check as Kg,CloudOff as Wg,Camera as Vg}from"lucide-react";import{clsx as fg}from"clsx";import{twMerge as gg}from"tailwind-merge";function Me(...e){return gg(fg(e))}function Ct(e,t,r){return t?.trim()||e("exercise",{index:r+1})}import{Fragment as wg,jsx as Ke,jsxs as Ms}from"react/jsx-runtime";function bg({accent:e}){return Ke("div",{style:{width:48,height:48,borderRadius:"50%",border:`4px solid ${e}33`,borderTopColor:e,animation:"edpire-spin 0.8s linear infinite"}})}function yg({accent:e}){return Ke("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[0,1,2].map(t=>Ke("div",{style:{width:12,height:12,borderRadius:"50%",background:e,animation:`edpire-bounce 1.2s ease-in-out ${t*.2}s infinite`}},t))})}function xg({accent:e}){return Ms("div",{style:{position:"relative",width:48,height:48},children:[[0,1].map(t=>Ke("div",{style:{position:"absolute",inset:0,borderRadius:"50%",background:e,opacity:.4,animation:`edpire-pulse 1.6s ease-out ${t*.8}s infinite`}},t)),Ke("div",{style:{position:"absolute",inset:"25%",borderRadius:"50%",background:e}})]})}function vg({accent:e}){return Ke("div",{style:{display:"flex",gap:4,alignItems:"flex-end",height:40},children:[0,1,2,3].map(t=>Ke("div",{style:{width:8,borderRadius:4,background:e,animation:`edpire-bars 1s ease-in-out ${t*.15}s infinite`}},t))})}function Xl({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?Ms(wg,{children:[Ke("style",{children:`
51
+ `),d.runPython(e);let u=d.runPython("_stdout_capture.getvalue()");d.runPython("sys.stdout = sys.__stdout__");let p=u.trim()===(i||"").trim();return{testId:n,passed:p,actualStdout:u,durationMs:Date.now()-l}}else{d.runPython(e);let u=(o||[]).map(h=>JSON.stringify(h)).join(", "),p=d.runPython(`${r}(${u})`),f=zo(p,a);return{testId:n,passed:f,actual:p,durationMs:Date.now()-l}}}catch(d){return{testId:n,passed:!1,stderr:String(d),errored:!0,durationMs:Date.now()-l}}}var $o=null;async function Bf(){if($o)return $o;let e=await import("./sql-wasm-browser-NICPVFVD.mjs");return $o=await(e.default??e)(),$o}async function jf(e,t,r,n){let o=Date.now();try{let a=await Bf(),s=new a.Database;r&&s.run(r);let c=s.exec(e).flatMap(d=>d.values.map(u=>u.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 qf(e){let{transform:t}=await import("./esm-RQP7AIMT.mjs");return t(e,{transforms:["typescript"]}).code}var Ur=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 qf(n)}catch(d){return s.map(u=>({testId:u.id,passed:!1,stderr:`TypeScript compile error: ${d.message}`,errored:!0}))}let l=[];for(let d of s){let u;r==="python"?u=await Of(c,o,a,d.id,d.args,d.expectedReturn,d.stdin,d.expectedStdout,i):r==="sql"?u=await jf(c,d.id,d.stdin,d.expectedStdout):u=await If(c,o,a,d.id,d.args,d.expectedReturn,d.stdin,d.expectedStdout,i),l.push(u)}return l}};import{jsx as rd}from"react/jsx-runtime";import{forwardRef as Hf,useEffect as Uf,useImperativeHandle as Kf,useRef as Wf,useState as Vf}from"react";function Gf(e){return{javascript:"javascript",typescript:"typescript",python:"python",sql:"sql",java:"java",cpp:"cpp",go:"go"}[e]??"plaintext"}var Ls=Hf(function({value:t,onChange:r,language:n="javascript",readOnly:o=!1,readOnlyRanges:a,placeholder:s,height:i=300,className:c,autoFocus:l},d){let[u,p]=Vf(null),{scale:f}=Je(),h=Wf(null);Uf(()=>{import("./dist-RXTJ74FF.mjs").then(x=>{p(()=>x.default)}).catch(()=>{})},[]),Kf(d,()=>({getValue(){return h.current?.getValue?.()??t},focus(){h.current?.focus?.()},insert(x){let A=h.current;if(!A)return;let g=A.getSelection();A.executeEdits("insert",[{range:g,text:x,forceMoveMarkers:!0}])}}));function m(x){h.current=x,l&&x.focus(),a?.length&&x.onDidAttemptReadOnlyEdit(()=>{})}function b(x){r(x??"")}let y=typeof i=="number"?i*f:i;return u?rd(u,{className:c,height:y,language:Gf(n),value:t,onChange:b,onMount:m,options:{readOnly:o,minimap:{enabled:!1},fontSize:14*f,lineNumbers:"on",scrollBeyondLastLine:!1,automaticLayout:!0,tabSize:2,wordWrap:"on"}}):rd("textarea",{className:c,value:t,onChange:x=>r(x.target.value),readOnly:o,placeholder:s,style:{width:"100%",height:typeof i=="number"?V(i):i,fontFamily:"monospace",fontSize:V(14),padding:V("0.5rem"),border:"1px solid #e2e8f0",borderRadius:V("0.375rem"),resize:"vertical",background:o?"#f8fafc":"white",boxSizing:"border-box"},autoFocus:l})});var eg=new Ur;function tg(e){return e?.showFeedback?e.state??"idle":"idle"}function nd(e){let t={};for(let r of e.attrs.starters??[])t[r.language]=r.code;return t}function rg({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 Be("div",{style:{padding:`${V("0.5rem")} ${V("0.75rem")}`,borderBottom:"1px solid var(--line, #e7e5e0)",fontSize:V("0.8125rem"),fontFamily:"var(--font-mono, ui-monospace, monospace)"},children:[Be("div",{style:{display:"flex",alignItems:"center",gap:V("0.5rem")},children:[we("span",{style:{color:s,fontWeight:700,fontSize:V("0.875rem"),display:"inline-flex"},children:i??(n?we(Is,{size:15,style:Ee(15)}):we(od,{size:15}))}),we("span",{style:{fontWeight:600,color:"var(--ink, #1d2025)"},children:e.name??`Test ${e.id}`})]}),a&&!n&&Be("div",{style:{marginTop:V("0.25rem"),paddingLeft:V("1.5rem")},children:[r==="function"?we(Tn,{children:t?.actual!==void 0&&Be("div",{style:{color:"var(--ink-soft, #565b66)"},children:[we("span",{style:{color:"var(--ink-faint, #8d93a0)"},children:"got: "}),we("span",{style:{color:"var(--pen, #d23b2b)"},children:JSON.stringify(t.actual)}),we("span",{style:{color:"var(--ink-faint, #8d93a0)"},children:" expected: "}),we("span",{style:{color:"var(--ok, #1f8a4c)"},children:JSON.stringify(e.expectedReturn)})]})}):we(Tn,{children:t?.actualStdout!==void 0&&Be("div",{style:{color:"var(--ink-soft, #565b66)"},children:[Be("div",{children:[we("span",{style:{color:"var(--ink-faint, #8d93a0)"},children:"got: "}),we("span",{style:{color:"var(--pen, #d23b2b)",whiteSpace:"pre-wrap"},children:t.actualStdout||"(empty)"})]}),Be("div",{children:[we("span",{style:{color:"var(--ink-faint, #8d93a0)"},children:"expected: "}),we("span",{style:{color:"var(--ok, #1f8a4c)",whiteSpace:"pre-wrap"},children:e.expectedStdout||"(empty)"})]})]})}),t?.stderr&&we("div",{style:{color:"var(--almost-ink, #8a5a08)",marginTop:V("0.125rem"),whiteSpace:"pre-wrap"},children:t.stderr})]})]})}function to({node:e,validationFeedback:t,readOnly:r=!1,executor:n=eg,gradingTests:o}){let a=Me(),s=Xf(null),{attrs:i}=e,c=e.id,[l,d]=An(i.defaultLanguage),[u,p]=An(()=>nd(e)),[f,h]=An([]),[m,b]=An(!1),[y,x]=An(!1),A=u[l]??"",g=tg(t);Qf(()=>{let _=X=>{let Y=X.answers?.find(F=>F.nodeId===c&&F.type==="codingResponse");Y?.answer&&(Y.answer.language&&d(Y.answer.language),Y.answer.sourceByLanguage&&p(Y.answer.sourceByLanguage),Y.answer.testResults&&h(Y.answer.testResults))},w=()=>{p(nd(e)),h([]),x(!1)};return a.on("answers:prefill",_),a.on("answers:reset",w),()=>{a.off("answers:prefill",_),a.off("answers:reset",w)}},[a,c,e]);let T=Yf((_,w,X)=>{a.emit({type:"answer:changed",answer:{nodeId:c,type:"codingResponse",timestamp:Date.now(),answer:{language:_,sourceByLanguage:w,source:w[_]??"",testResults:X}}})},[a,c]),C=_=>{let w={...u,[l]:_};p(w),T(l,w,f)},E=_=>{d(_),h([]),T(_,u,[])},R=async()=>{if(m)return;b(!0),h([]);let _=o??i.visibleSamples??[];if(_.length===0){b(!1);return}try{let w=await n.run({language:l,source:A,mode:i.testMode,entryFunction:i.entryFunction,tests:_,timeoutMs:5e3});h(w),T(l,u,w)}catch(w){let X=_.map(Y=>({testId:Y.id,passed:!1,stderr:String(w),errored:!0}));h(X),T(l,u,X)}finally{b(!1)}},M=()=>{y||(x(!0),T(l,u,f))},k=(o??[]).filter(_=>_.hidden).length,S=k>0?f.filter(_=>(o??[]).find(X=>X.id===_.testId)?.hidden&&_.passed).length:0,v=o?o.filter(_=>!_.hidden):i.visibleSamples??[],O=g==="correct"?"var(--ok, #1f8a4c)":g==="partial"?"var(--almost, #c8810e)":g==="incorrect"?"var(--pen, #d23b2b)":"var(--line-strong, #d6d3cc)";return Be("div",{style:{margin:`${V("0.75rem")} 0`,border:`1px solid ${O}`,borderRadius:V("0.875rem"),overflow:"hidden",transition:"border-color 0.2s"},children:[Be("div",{style:{background:"var(--ui-muted, #f5f4f1)",borderBottom:"1px solid var(--line, #e7e5e0)",padding:`${V("0.5rem")} ${V("0.75rem")}`,display:"flex",alignItems:"center",gap:V("0.5rem"),flexWrap:"wrap"},children:[we("div",{style:{display:"flex",gap:V("0.25rem")},children:i.languages.map(_=>we("button",{onClick:()=>!r&&E(_),disabled:r,style:{padding:`${V("0.2rem")} ${V("0.6rem")}`,borderRadius:V("0.375rem"),border:"1px solid",borderColor:l===_?"var(--ink, #1d2025)":"var(--line, #e7e5e0)",background:l===_?"var(--ink, #1d2025)":"var(--card, #fff)",color:l===_?"#fff":"var(--ink-soft, #565b66)",fontSize:V("0.75rem"),fontWeight:600,cursor:r?"default":"pointer",fontFamily:"var(--font-mono, ui-monospace, monospace)"},children:_},_))}),we("div",{style:{flex:1}}),we(Tt,{hint:i.hint}),!r&&Be(Tn,{children:[Be("button",{onClick:R,disabled:m,style:{padding:`${V("0.25rem")} ${V("0.75rem")}`,borderRadius:V("0.5rem"),border:"1px solid var(--line-strong, #d6d3cc)",background:m?"var(--ui-muted, #f5f4f1)":"var(--card, #fff)",color:"var(--ink, #1d2025)",fontSize:V("0.8125rem"),fontWeight:600,cursor:m?"not-allowed":"pointer",display:"inline-flex",alignItems:"center",gap:V("0.35rem")},children:[we(Jf,{size:13,style:Ee(13)})," ",m?"Running\u2026":"Run"]}),Be("button",{onClick:M,disabled:y,style:{padding:`${V("0.3rem")} ${V("0.85rem")}`,borderRadius:V("0.5rem"),border:"none",background:y?"var(--ok-soft, #ecf8f0)":"var(--ink, #1d2025)",color:y?"var(--ok, #1f8a4c)":"#fff",fontSize:V("0.8125rem"),fontWeight:600,cursor:y?"default":"pointer",display:"inline-flex",alignItems:"center",gap:V("0.35rem")},children:[y&&we(Is,{size:13,style:Ee(13)})," ",y?"Submitted":"Submit"]})]})]}),we(Ls,{ref:s,value:A,onChange:C,language:l,readOnly:r,readOnlyRanges:i.starters.find(_=>_.language===l)?.readOnlyRanges,height:320}),(f.length>0||v.length>0)&&Be("div",{style:{borderTop:"1px solid var(--line, #e7e5e0)",background:"var(--paper, #fbfaf7)"},children:[we("div",{style:{padding:`${V("0.5rem")} ${V("0.75rem")}`,fontSize:V("0.7rem"),fontWeight:700,color:"var(--ink-faint, #8d93a0)",textTransform:"uppercase",letterSpacing:"0.05em"},children:"Test Results"}),v.map(_=>we(rg,{sample:_,result:f.find(w=>w.testId===_.id),mode:i.testMode},_.id)),k>0&&Be("div",{style:{padding:`${V("0.5rem")} ${V("0.75rem")}`,fontSize:V("0.8125rem"),color:"var(--ink-soft, #565b66)",borderTop:"1px solid var(--line, #e7e5e0)",fontStyle:"italic",display:"flex",alignItems:"center",gap:V("0.4rem")},children:[we(Zf,{size:13,style:Ee(13)})," Hidden tests: ",S,"/",k," passed"]})]}),t?.showFeedback&&Be("div",{style:{padding:`${V("0.55rem")} ${V("0.75rem")}`,fontSize:V("0.85rem"),fontWeight:600,borderTop:"1px solid var(--line, #e7e5e0)",display:"flex",alignItems:"center",gap:V("0.45rem"),background:g==="correct"?"var(--ok-soft, #ecf8f0)":g==="partial"?"var(--almost-soft, #fbf1dc)":g==="incorrect"?"var(--pen-soft, #fdeeec)":"transparent",color:g==="correct"?"var(--ok, #1f8a4c)":g==="partial"?"var(--almost-ink, #8a5a08)":g==="incorrect"?"var(--pen, #d23b2b)":"var(--ink-soft, #565b66)"},children:[g==="correct"&&Be(Tn,{children:[we(Is,{size:15,style:Ee(15)})," All tests passed"]}),g==="partial"&&"Partial credit",g==="incorrect"&&Be(Tn,{children:[we(od,{size:15,style:Ee(15)})," Tests failed"]}),g==="validating"&&"Evaluating\u2026",g==="awaiting_review"&&"Awaiting teacher review",t.score!==void 0&&Be("span",{style:{marginLeft:"auto",fontFamily:'var(--font-hand, "Caveat", cursive)',fontSize:V("1.5rem"),lineHeight:1},children:[t.score," / ",t.maxScore??i.maxScore]})]})]})}import{Fragment as ag,jsx as Fo,jsxs as sg}from"react/jsx-runtime";import{createContext as ig,useContext as cg,useEffect as lg}from"react";import{DndContext as dg,MouseSensor as pg,TouchSensor as ug,KeyboardSensor as mg,useDndContext as hg,useSensor as Fs,useSensors as fg}from"@dnd-kit/core";import{jsx as $s}from"react/jsx-runtime";import{DragOverlay as ng,useDndContext as og}from"@dnd-kit/core";function zs(){let{active:e}=og();if(!e)return null;let t=e.data.current?.html??"";return $s(ng,{dropAnimation:null,children:$s("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:$s("span",{dangerouslySetInnerHTML:{__html:t},style:{pointerEvents:"none",whiteSpace:"nowrap",lineHeight:"1.25"}})})})}function gg(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 bg(){let{activeNode:e}=hg();return lg(()=>{if(!(!e||typeof document>"u"))return gg(e,document.scrollingElement,t=>getComputedStyle(t).scrollBehavior)},[e]),null}var ad=ig(!1),yg={acceleration:3,threshold:{x:0,y:.25}};function Do({children:e}){let t=cg(ad),r=Fs(pg,{activationConstraint:{distance:8}}),n=Fs(ug,{activationConstraint:{delay:250,tolerance:5}}),o=Fs(mg),a=fg(r,n,o);return t?Fo(ag,{children:e}):Fo(ad.Provider,{value:!0,children:sg(dg,{sensors:a,autoScroll:yg,children:[e,Fo(zs,{}),Fo(bg,{})]})})}function Wr({content:e,onAnswersChange:t,onSubmit:r,answerBus:n,namespace:o,initialAnswers:a,validationFeedback:s,className:i="",locale:c,readOnly:l=!1,mediaHandler:d,answerSheetHandler:u,codeExecutor:p,display:f}){let h=it(f),m=vg(()=>mt(h),[h]),b=xg(null);b.current||(b.current=new It);let y=n??b.current;Ds(()=>{a&&a.length>0&&y.prefillAnswers(a)},[a,y]),Ds(()=>{if(!t)return;let A=()=>{let g=y.getAllAnswers();t(g)};return y.on("answer:changed",A),()=>y.off("answer:changed",A)},[y,t]),Ds(()=>{if(!r)return;let A=g=>{r(g.answers)};return y.on("answer:submitted",A),()=>y.off("answer:submitted",A)},[y,r]);let x=ut(e,s,{readOnly:l,mediaHandler:d,answerSheetHandler:u,codeExecutor:p});return Kr(sr,{locale:c,children:Kr(ct,{display:h,children:Kr(Bn,{bus:y,children:Kr(Do,{children:Kr(no,{initialAnswers:a,children:Kr("div",{className:`question-runtime ${i}${m.sizeSet?" edp-scaled":""}`,"data-namespace":o,style:{fontSize:V("1.125rem"),lineHeight:"1.75",...ht(m)},children:x})})})})})})}import{jsx as Vr,jsxs as jo}from"react/jsx-runtime";import{memo as Rg,useCallback as dd,useMemo as Pg,useRef as ld}from"react";var sd={words:80,media:1,tableRows:6},wg=new Set(["resizableImage","resizableVideo","youtubeEmbed"]);function id(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&&wg.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 _n(e,t=sd){let r=id(e);return r.words>t.words||r.media>t.media||r.tableRows>t.tableRows}import{createContext as kg,useContext as Sg}from"react";var cd=kg(null),Oo=cd.Provider;function Bo(){return Sg(cd)}function qo({exercise:e,onAnswersChange:t,validationFeedback:r,renderSharedContext:n,renderQuestion:o,renderSeparator:a,className:s="",locale:i,display:c}){let l=it(c),d=Pg(()=>mt(l),[l]),u=ld(new Map),p=ld({exercise:e,onAnswersChange:t});p.current={exercise:e,onAnswersChange:t};let f=dd((x,A)=>{u.current.set(x,A);let{exercise:g,onAnswersChange:T}=p.current;if(T){let C={exerciseId:g.id,questionAnswers:g.questions.map(E=>({questionId:E.id,answers:u.current.get(E.id)??[]}))};T(C)}},[]),h=Bo(),m=tn(i),b=!!(h&&e.sharedContext&&_n(e.sharedContext)),y=e.sharedContext?b?jo("p",{className:"exercise-reference-cue",children:[Vr("span",{children:m.referenceInPanel(h.label)})," ",jo("button",{type:"button",className:"exercise-reference-cue__link",onClick:()=>h.showExerciseReference(e.id),children:[m.readReference,Vr("span",{"aria-hidden":"true",className:"exercise-reference-cue__arrow",children:"\u203A"})]})]}):Vr("div",{className:"exercise-shared-context",children:ut(e.sharedContext)}):null;return Vr(ct,{display:l,children:jo("div",{className:`exercise-runtime ${s}`,style:ht(d),children:[y&&(n?n(y):y),e.questions.map((x,A)=>{let g=r?.get(x.id),T=Vr(Cg,{questionId:x.id,content:x.content,onQuestionAnswers:f,validationFeedback:g,locale:i},x.id);return jo("div",{children:[o?o(x,T,A):T,a&&A<e.questions.length-1?a(A):null]},x.id)})]})})}var Cg=Rg(function({questionId:t,onQuestionAnswers:r,...n}){let o=dd(a=>r(t,a),[r,t]);return Vr(Wr,{...n,onAnswersChange:o})});import{jsx as Os,jsxs as Ng}from"react/jsx-runtime";import{useCallback as Ag,useEffect as Tg,useMemo as _g,useRef as pd}from"react";function tr({assessment:e,onAnswersChange:t,validationFeedback:r,renderExercise:n,renderSharedContext:o,renderSeparator:a,className:s="",brandingConfig:i,locale:c,display:l}){let d=pd(new Map),u=it(l),p=_g(()=>mt(u),[u]);Tg(()=>{if(!i?.fontUrl)return;let b=`edpire-brand-font-${i.fontUrl.replace(/\W/g,"").slice(-24)}`;if(document.getElementById(b))return;let y=document.createElement("link");y.id=b,y.rel="stylesheet",y.href=i.fontUrl,document.head.appendChild(y)},[i?.fontUrl]);let f={...ht(p)};i?.fontFamily&&(f["--brand-font"]=i.fontFamily);let h=pd({assessment:e,onAnswersChange:t});h.current={assessment:e,onAnswersChange:t};let m=Ag(b=>{d.current.set(b.exerciseId,b);let{assessment:y,onAnswersChange:x}=h.current;if(x){let A={exerciseAnswers:y.exercises.map(g=>d.current.get(g.id)??{exerciseId:g.id,questionAnswers:[]})};x(A)}},[]);return Os(ct,{display:u,children:Os("div",{className:`assessment-runtime ${s}`,style:Object.keys(f).length?f:void 0,children:e.exercises.map((b,y)=>{let x=r?.get(b.id),A=Os(qo,{exercise:b,onAnswersChange:m,validationFeedback:x,renderSharedContext:o?g=>o(g,b):void 0,locale:c},b.id);return Ng("div",{children:[n?n(b,A,y):A,a&&y<e.exercises.length-1?a(y):null]},b.id)})})})}import{jsx as ud}from"react/jsx-runtime";import{useMemo as Mg}from"react";function Gr({content:e,className:t,display:r}){let n=it(r),o=Mg(()=>mt(n),[n]);return ud(ct,{display:n,children:ud("div",{className:`content-view ${t??""}`,style:ht(o),children:ut(e)})})}import{jsx as Mn,Fragment as md,jsxs as Ho}from"react/jsx-runtime";import{useMemo as Eg}from"react";function En({item:e,className:t,renderFigureLabel:r,display:n}){let o=it(n),a=Eg(()=>mt(o),[o]);return Mn(ct,{display:o,children:Ho("div",{className:`annex-item-view ${t??""}${a.sizeSet?" edp-scaled":""}`,style:ht(a),children:[e.type==="text-document"&&Ho(md,{children:[e.title&&Mn("h3",{className:"text-base font-semibold mb-2",children:e.title}),ut(e.content)]}),e.type==="figure"&&Ho("figure",{children:[ut(e.content),Mn("figcaption",{children:r?r(e.label):Mn("span",{children:e.label})})]}),e.type==="rich-block"&&Ho(md,{children:[e.title&&Mn("h3",{className:"text-base font-semibold mb-2",children:e.title}),ut(e.content)]})]})})}import{jsx as B1,jsxs as j1}from"react/jsx-runtime";import{useState as H1}from"react";import{jsx as Y1,jsxs as Q1,Fragment as X1}from"react/jsx-runtime";import{useState as Z1,useCallback as e2,useMemo as t2}from"react";import{useEditor as n2,EditorContent as o2}from"@tiptap/react";import s2 from"@tiptap/starter-kit";import{jsx as u2,jsxs as m2,Fragment as h2}from"react/jsx-runtime";import{useMemo as g2,useState as b2}from"react";import{jsx as Ce,jsxs as rt,Fragment as Fg}from"react/jsx-runtime";import{useEffect as hd,useMemo as qs,useRef as Hs,useState as rr}from"react";function Bs(e,t){let r=[];for(let n of e){let o=n.questionId&&t.has(n.questionId)?n.questionId:null,a=r[r.length-1];a&&a.questionId===o?a.lines.push(n):r.push({id:r.length,lines:[n],questionId:o})}return r.filter(n=>Or(n.lines).length>0)}function Yr(e,t){return e.id in t?t[e.id]:e.questionId}function js(e,t,r,n){let o=new Map;for(let s of e){let i=Yr(s,t);i&&o.set(i,[...o.get(i)??[],...s.lines])}let a=[];for(let s of n){let i=o.get(s);if(!i?.length)continue;let l=[...new Set(i.map(d=>d.page))].sort((d,u)=>d-u).map(d=>r[d]).filter(d=>!!d);a.push({nodeId:s,lines:i,photos:l})}return a}function Us({locale:e,...t}){return Ce(sr,{locale:e,children:Ce(Dg,{...t})})}function Dg({handler:e,questions:t,isEmpty:r,place:n,onPlaced:o,onClose:a}){let s=me(),[i,c]=rr([]),[l,d]=rr([]),[u,p]=rr(!1),[f,h]=rr({}),[m,b]=rr({}),[y,x]=rr(!1),[A,g]=rr(0),[T,C]=rr(!1),E=Hs(null),R=Hs(null),M=qs(()=>new Set(t.map(B=>B.nodeId)),[t]),k=qs(()=>Bs(i,M),[i,M]),S=()=>{A>0||k.length>0?C(!0):a()},v=Hs(S);v.current=T?()=>C(!1):S,hd(()=>{E.current?.focus();let B=J=>{J.key==="Escape"&&v.current()};return window.addEventListener("keydown",B),()=>window.removeEventListener("keydown",B)},[]),hd(()=>{T&&R.current?.focus()},[T]);let O=B=>(d(B),c([]),h({}),p(!1),{add:J=>c(N=>[...N,J]),end:()=>{}}),_=qs(()=>u?new Set(t.filter(B=>!r(B.nodeId)).map(B=>B.nodeId)):new Set,[u,t]),w=()=>{let B=t.map(N=>N.nodeId),J=js(k,f,l,B).filter(N=>(m[N.nodeId]??"below")!=="leave"||!_.has(N.nodeId));if(J.length===0){x(!0);return}for(let N of J)n(N.nodeId,N.lines,N.photos,_.has(N.nodeId)?m[N.nodeId]==="replace"?"replace":"below":"replace");o(J.map(N=>N.nodeId)),a()},X=(B,J)=>{x(!1),h(N=>({...N,[B.id]:J===""?null:J}))},Y=B=>rt("li",{className:"edp-copy-part",children:[Ce("div",{className:"edp-copy-part-text",dir:"auto",dangerouslySetInnerHTML:{__html:Se(Or(B.lines))}}),u&&rt("label",{className:"edp-copy-move",children:[Ce("span",{children:s.copyMoveTo}),rt("select",{value:Yr(B,f)??"",onChange:J=>X(B,J.target.value),children:[t.map(J=>Ce("option",{value:J.nodeId,children:J.label},J.nodeId)),Ce("option",{value:"",children:s.copyNowhere})]})]})]},B.id),F=t.map(B=>({q:B,parts:k.filter(J=>Yr(J,f)===B.nodeId)})).filter(B=>B.parts.length>0),L=k.filter(B=>Yr(B,f)===null);return Ce("div",{className:"edp-copy",role:"dialog","aria-modal":"true","aria-labelledby":"edp-copy-title",children:rt("div",{className:"edp-copy-sheet",children:[rt("div",{className:"edp-copy-head",children:[Ce("h2",{id:"edp-copy-title",ref:E,tabIndex:-1,children:u?s.copyCheckTitle:s.copyTitle}),Ce("button",{type:"button",className:"edp-sheet-panel-close",onClick:S,"aria-label":s.sheetClose,children:"\xD7"})]}),rt("div",{className:"edp-copy-body",children:[!u&&Ce(Ro,{purpose:"copy",handler:e,startLines:O,onRead:()=>{},onDone:()=>p(!0),onType:a,onClose:S,onPages:g}),k.length>0&&rt(Fg,{children:[u&&Ce("p",{className:"edp-copy-help",children:s.copyCheckHelp}),F.map(({q:B,parts:J})=>rt("section",{className:"edp-copy-question","aria-label":B.label,children:[Ce("h3",{children:B.label}),_.has(B.nodeId)&&rt("div",{className:"edp-copy-keep",role:"radiogroup","aria-label":s.copyHasText,children:[Ce("span",{children:s.copyHasText}),["below","replace","leave"].map(N=>rt("label",{className:"edp-copy-keep-option",children:[Ce("input",{type:"radio",name:`edp-copy-keep-${B.nodeId}`,checked:(m[B.nodeId]??"below")===N,onChange:()=>b(P=>({...P,[B.nodeId]:N}))}),N==="below"?s.copyBelow:N==="replace"?s.copyReplace:s.copyLeave]},N))]}),Ce("ul",{className:"edp-copy-parts",children:J.map(Y)})]},B.nodeId)),L.length>0&&rt("section",{className:"edp-copy-question edp-copy-question--loose","aria-label":s.copyNotPlaced,children:[Ce("h3",{children:s.copyNotPlaced}),u&&Ce("p",{className:"edp-copy-help",children:s.copyNotPlacedHelp}),Ce("ul",{className:"edp-copy-parts",children:L.map(Y)})]})]})]}),T?rt("div",{className:"edp-copy-foot",role:"alertdialog","aria-labelledby":"edp-copy-leave",children:[Ce("p",{id:"edp-copy-leave",className:"edp-copy-leave",children:k.length>0?s.copyLeaveRead:s.copyLeavePages}),rt("div",{className:"edp-sheet-panel-actions",children:[Ce("button",{ref:R,type:"button",className:"edp-sheet-btn",onClick:()=>C(!1),children:s.copyLeaveBack}),Ce("button",{type:"button",className:"edp-sheet-btn edp-sheet-btn--end",onClick:a,children:s.copyLeaveConfirm})]})]},"leave"):u&&rt("div",{className:"edp-copy-foot",children:[y&&Ce("p",{className:"edp-sheet-hint",role:"alert",children:s.copyNothing}),rt("div",{className:"edp-sheet-panel-actions",children:[Ce("button",{type:"button",className:"edp-sheet-btn",onClick:S,children:s.copyCancel}),Ce("button",{type:"button",className:"edp-sheet-btn edp-sheet-btn--primary edp-sheet-btn--end",onClick:w,children:s.copyConfirm})]})]},"check")]})})}import{Send as Dd,Loader2 as ti,BarChart2 as ri,CheckCircle2 as Od,XCircle as mb,RotateCcw as hb,X as ni,Clock as Xr,AlertTriangle as fb,AlertCircle as gb,Check as bb,CloudOff as yb,Camera as vb}from"lucide-react";import{clsx as jg}from"clsx";import{twMerge as qg}from"tailwind-merge";function $e(...e){return qg(jg(e))}function Et(e,t,r){return t?.trim()||e("exercise",{index:r+1})}import{Fragment as Vg,jsx as Ge,jsxs as Ks}from"react/jsx-runtime";function Hg({accent:e}){return Ge("div",{style:{width:48,height:48,borderRadius:"50%",border:`4px solid ${e}33`,borderTopColor:e,animation:"edpire-spin 0.8s linear infinite"}})}function Ug({accent:e}){return Ge("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[0,1,2].map(t=>Ge("div",{style:{width:12,height:12,borderRadius:"50%",background:e,animation:`edpire-bounce 1.2s ease-in-out ${t*.2}s infinite`}},t))})}function Kg({accent:e}){return Ks("div",{style:{position:"relative",width:48,height:48},children:[[0,1].map(t=>Ge("div",{style:{position:"absolute",inset:0,borderRadius:"50%",background:e,opacity:.4,animation:`edpire-pulse 1.6s ease-out ${t*.8}s infinite`}},t)),Ge("div",{style:{position:"absolute",inset:"25%",borderRadius:"50%",background:e}})]})}function Wg({accent:e}){return Ge("div",{style:{display:"flex",gap:4,alignItems:"flex-end",height:40},children:[0,1,2,3].map(t=>Ge("div",{style:{width:8,borderRadius:4,background:e,animation:`edpire-bars 1s ease-in-out ${t*.15}s infinite`}},t))})}function fd({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?Ks(Vg,{children:[Ge("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
- `}),Ke("div",{style:{background:t},className:`${c?"absolute":"fixed"} inset-0 z-[60] flex items-center justify-center`,children:Ms("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 Ke("img",{src:s,alt:"",className:"w-24 h-24 object-contain"});switch(a){case"dots":return Ke(yg,{accent:r});case"pulse":return Ke(xg,{accent:r});case"bars":return Ke(vg,{accent:r});default:return Ke(bg,{accent:r})}})(),Ke("p",{className:"text-sm font-semibold text-slate-800",children:n}),i&&Ke("p",{className:"text-xs text-slate-500 leading-snug",children:o})]})})]}):null}import{useCallback as Jl,useEffect as kg,useMemo as Zl,useRef as Fo,useState as Sg}from"react";import{BookOpen as ed,X as Rg}from"lucide-react";import{Fragment as Cg,jsx as Ee,jsxs as ut}from"react/jsx-runtime";function Es(e){return e.exercises.flatMap((t,r)=>t.sharedContext&&wn(t.sharedContext)?[{id:t.id,index:r,title:t.title,content:t.sharedContext}]:[])}var td=()=>typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;function Pg(e){e.removeAttribute("data-flash"),e.offsetWidth,e.setAttribute("data-flash","true"),setTimeout(()=>e.removeAttribute("data-flash"),1200)}function rd({assessment:e,isSubmitted:t,setAnswers:r,validationFeedback:n,renderExercise:o,renderSeparator:a,primaryColor:s,contained:i=!1,locale:c,contentMaxWidth:l,t:p,footer:d}){let[u,f]=Sg(!1),h=e.annex,m=h?.tabLabel||p("annexDocuments"),b=Zl(()=>Es(e),[e]),w=Fo(null),P=Fo(null),g=Fo(null),R=Fo(null),_=()=>(w.current?.getClientRects().length??0)>0,A=Jl((x,B)=>{let E=x?.querySelector(`[data-reference-for="${CSS.escape(B)}"]`);if(!x||!E)return;let y=E.getBoundingClientRect().top-x.getBoundingClientRect().top+x.scrollTop-12;x.scrollTo({top:y,behavior:td()?"auto":"smooth"}),Pg(E)},[]),I=Jl(x=>{if(_()){A(P.current,x);return}f(!0),requestAnimationFrame(()=>requestAnimationFrame(()=>A(R.current,x)))},[A]),C=x=>{let B=_()?w.current:g.current;_()||f(!1),Array.from(B?.querySelectorAll(`[data-exercise-id="${CSS.escape(x)}"]`)??[]).find(y=>y.getClientRects().length>0)?.scrollIntoView({behavior:td()?"auto":"smooth",block:"start"})};kg(()=>{let x=w.current;if(!x||b.length===0||typeof IntersectionObserver>"u")return;let B=i?x:null,E=new Set(b.map(F=>F.id)),y=null,K=new IntersectionObserver(F=>{if(!_())return;let $=F.filter(O=>O.isIntersecting&&E.has(O.target.dataset.exerciseId??"")).sort((O,G)=>O.boundingClientRect.top-G.boundingClientRect.top)[0]?.target?.dataset.exerciseId;!$||$===y||(y=$,A(P.current,$))},{root:B,rootMargin:"0px 0px -60% 0px"});return x.querySelectorAll("[data-exercise-id]").forEach(F=>K.observe(F)),()=>K.disconnect()},[b,A,i]);let L=Zl(()=>({label:m,showExerciseReference:I}),[m,I]),v=ut(Cg,{children:[h?.items.map(x=>Ee(Sn,{item:x},x.id)),h?.items.length&&b.length?Ee("div",{className:"border-t border-[#e7e5e0]"}):null,b.map(x=>ut("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:[Ee("button",{type:"button",onClick:()=>C(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:Ee("span",{dir:"auto",children:Ct(p,x.title,x.index)})}),Ee(Or,{content:x.content})]},x.id))]}),S=Ee(Vt,{assessment:e,onAnswersChange:t?void 0:r,validationFeedback:n,renderExercise:o,renderSeparator:a,locale:c});return Ee(Mo,{value:L,children:ut("div",{className:Me("@container flex-1 min-h-0 flex",i&&"relative"),children:[ut("div",{ref:w,className:Me("hidden @6xl:flex flex-1 min-w-0 gap-4 p-4 bg-[#f5f4f1] items-start",i&&"overflow-y-auto"),children:[ut("div",{className:Me("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:[ut("div",{className:"flex items-center gap-2 px-5 py-3 border-b border-[#e7e5e0] flex-shrink-0",children:[Ee(ed,{size:14,className:"text-[#8d93a0]"}),Ee("span",{className:"text-xs font-bold text-[#565b66] uppercase tracking-widest",children:m})]}),Ee("div",{ref:P,className:"flex-1 overflow-y-auto px-6 py-5 flex flex-col gap-6",children:v})]}),Ee("div",{className:"w-px bg-[#e7e5e0] flex-shrink-0 self-stretch my-1 rounded-full"}),Ee("div",{className:"flex-1 min-w-0 bg-white rounded-[14px] border border-[#e7e5e0] shadow-sm",children:ut("div",{className:"px-6 py-5 flex flex-col gap-4",children:[S,d]})})]}),ut("div",{className:Me("@6xl:hidden flex-1 min-w-0 relative",i&&"overflow-hidden"),children:[Ee("div",{ref:g,className:Me(i&&"absolute inset-0 overflow-y-auto"),children:ut("div",{className:"mx-auto px-5 py-5 flex flex-col gap-4",style:{maxWidth:l},children:[S,d]})}),u&&Ee("div",{className:Me("inset-0 z-30 bg-black/25",i?"absolute":"fixed"),onClick:()=>f(!1)}),ut("div",{role:"dialog","aria-label":m,"aria-hidden":!u,className:Me("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:[ut("div",{className:"flex items-center justify-between px-5 py-3 flex-shrink-0",children:[Ee("span",{className:"text-sm font-bold text-[#1d2025]",children:m}),Ee("button",{onClick:()=>f(!1),"aria-label":p("close"),className:"p-1 text-[#8d93a0] hover:text-[#1d2025] rounded-lg transition-colors",children:Ee(Rg,{size:18})})]}),Ee("div",{ref:R,className:"overflow-y-auto max-h-[calc(100dvh-8rem)] px-5 pb-5 flex flex-col gap-5",children:v})]})]}),!u&&ut("button",{onClick:()=>f(!0),"aria-label":m,style:{transform:"translateY(-50%)",...s?{backgroundColor:s}:{}},className:Me("@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:[Ee(ed,{size:12}),Ee("span",{style:{writingMode:"vertical-rl",transform:"rotate(180deg)"},children:m})]})]})})}import{useState as Ag}from"react";import{BookOpen as nd,Plus as Ng,X as Tg}from"lucide-react";import{jsx as qe,jsxs as Dt}from"react/jsx-runtime";function od({assessment:e,isSubmitted:t,setAnswers:r,validationFeedback:n,renderExercise:o,renderSeparator:a,primaryColor:s,contained:i=!1,locale:c,contentMaxWidth:l,t:p,onAddAnnex:d,footer:u}){let[f,h]=Ag(!1),m=qe(Vt,{assessment:e,onAnswersChange:t?void 0:r,validationFeedback:n,renderExercise:o,renderSeparator:a,locale:c});if(f)return qe("div",{className:"flex-1 overflow-y-auto",children:Dt("div",{className:"mx-auto p-6 flex flex-col gap-4",style:{maxWidth:l},children:[m,u]})});let b=g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),d())},w=g=>Dt("span",{style:s?{backgroundColor:s}:void 0,className:Me("flex-none inline-flex items-center gap-1.5 rounded-lg bg-[#1d2025] text-white font-semibold shadow-sm group-hover:shadow-md transition-shadow",g?"px-3 py-1.5 text-xs":"mt-1 px-3.5 py-2 text-xs"),children:[qe(Ng,{size:13}),p("annexEmptyCta")]}),P=g=>qe("button",{type:"button",onClick:R=>{R.stopPropagation(),h(!0)},"aria-label":p("annexEmptyDismiss"),title:p("annexEmptyDismiss"),className:Me("flex-none flex items-center justify-center w-7 h-7 rounded-lg text-[#8d93a0] hover:text-[#1d2025] hover:bg-[#f1efe9] transition-colors cursor-pointer",g&&"absolute top-2 end-2 z-10"),children:qe(Tg,{size:15})});return Dt("div",{className:Me("@container flex-1 min-h-0 flex",i&&"relative"),children:[Dt("div",{className:"hidden @6xl:flex flex-1 gap-4 p-4 bg-[#f5f4f1] items-start overflow-y-auto",children:[qe("div",{className:"flex-1 sticky top-4 flex min-h-[200px] max-h-[calc(100svh-6rem)]",children:Dt("div",{role:"button",tabIndex:0,onClick:d,onKeyDown:b,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:[P(!0),qe("span",{className:"flex items-center justify-center w-11 h-11 rounded-full bg-[#f1efe9] text-[#8d93a0] group-hover:text-[#1d2025] transition-colors",children:qe(nd,{size:20})}),qe("span",{className:"text-sm font-bold text-[#565b66]",children:p("annexEmptyTitle")}),qe("span",{className:"text-xs text-[#8d93a0] max-w-[32ch] leading-relaxed",children:p("annexEmptyBody")}),w(!1)]})}),qe("div",{className:"w-px bg-[#e7e5e0] flex-shrink-0 self-stretch my-1 rounded-full"}),qe("div",{className:"flex-1 bg-white rounded-[14px] border border-[#e7e5e0] shadow-sm",children:Dt("div",{className:"px-6 py-5 flex flex-col gap-4",children:[m,u]})})]}),qe("div",{className:"@6xl:hidden flex-1 overflow-y-auto",children:Dt("div",{className:"mx-auto px-5 py-5 flex flex-col gap-4",style:{maxWidth:l},children:[Dt("div",{role:"button",tabIndex:0,onClick:d,onKeyDown:b,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:[qe("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:qe(nd,{size:16})}),Dt("div",{className:"flex-1 min-w-0",children:[qe("div",{className:"text-xs font-bold text-[#565b66]",children:p("annexEmptyTitle")}),qe("div",{className:"text-[11px] text-[#8d93a0] leading-snug",children:p("annexEmptyBody")})]}),w(!0),P(!1)]}),m,u]})})]})}function zo(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 _g}from"lucide-react";import{jsx as Ls,jsxs as ad}from"react/jsx-runtime";function Mg(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 sd({content:e,nodeResults:t,label:r}){let n=Mg(t);return ad("div",{className:`player-ai-feedback mt-3 mb-3${n?` player-ai-feedback--${n}`:""}`,children:[ad("p",{className:"flex items-center gap-1.5 text-xs font-semibold",children:[Ls(_g,{size:14,"aria-hidden":!0}),r]}),Ls("div",{className:"text-[#1d2025]",children:Ls(Or,{content:e})})]})}import{useState as id}from"react";import{jsx as ur,jsxs as cd}from"react/jsx-runtime";function ld({questionId:e,onReport:t,t:r}){let[n,o]=id("closed"),[a,s]=id("");if(n==="sent")return ur("p",{role:"status",className:"mt-2 text-sm text-[#5b6170]",children:r("reportGradeSent")});if(n==="closed")return ur("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 cd("div",{className:"mt-2 rounded-lg border border-[#e7e5e0] bg-[#fbfaf7] p-3",children:[ur("label",{className:"mb-1.5 block text-sm font-medium text-[#1d2025]",htmlFor:`report-${e}`,children:r("reportGradePrompt")}),ur("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"&&ur("p",{role:"alert",className:"mt-1 text-sm text-[#a32b1e]",children:r("reportGradeFailed")}),cd("div",{className:"mt-2 flex gap-2",children:[ur("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")}),ur("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 Ot,jsxs as Is}from"react/jsx-runtime";function dd({t:e,rtl:t,showClose:r,onContinue:n,continueLabel:o,primaryColor:a}){return Is("div",{role:"status",className:"edp-thanks flex-1 flex items-center justify-center px-6 py-16",children:[Ot("style",{children:Eg}),Is("div",{className:"flex flex-col items-center text-center",style:{maxWidth:"26rem"},children:[Is("div",{className:"relative",style:{width:120,height:120},"aria-hidden":!0,children:[Ot("svg",{className:"edp-thanks-blob absolute inset-0 overflow-visible",viewBox:"0 0 200 200",width:"120",height:"120",children:Ot("path",{d:"M104 14c44 2 80 34 82 80s-34 94-86 92S12 150 16 98 58 12 104 14z",fill:"#ffd64a"})}),Ot("svg",{className:"absolute inset-0 overflow-visible",viewBox:"0 0 100 100",width:"120",height:"120",children:Ot("path",{className:"edp-thanks-check",d:"M26 54l17 17 33-39",fill:"none",stroke:"#1d2025",strokeWidth:9,strokeLinecap:"round",strokeLinejoin:"round",pathLength:1})})]}),Ot("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")}),Ot("p",{className:"edp-thanks-rise mt-4 text-base text-[#565b66]",style:{animationDelay:"750ms"},children:e("formThanksDesc")}),r&&!n&&Ot("p",{className:"edp-thanks-rise mt-1 text-sm text-[#8a8f99]",style:{animationDelay:"850ms"},children:e("formThanksClose")}),n&&Ot("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 Eg=`
68
+ `}),Ge("div",{style:{background:t},className:`${c?"absolute":"fixed"} inset-0 z-[60] flex items-center justify-center`,children:Ks("div",{className:"flex flex-col items-center gap-5 bg-white rounded-2xl shadow-2xl px-10 py-8 max-w-xs text-center",children:[(()=>{if(s)return Ge("img",{src:s,alt:"",className:"w-24 h-24 object-contain"});switch(a){case"dots":return Ge(Ug,{accent:r});case"pulse":return Ge(Kg,{accent:r});case"bars":return Ge(Wg,{accent:r});default:return Ge(Hg,{accent:r})}})(),Ge("p",{className:"text-sm font-semibold text-slate-800",children:n}),i&&Ge("p",{className:"text-xs text-slate-500 leading-snug",children:o})]})})]}):null}import{useCallback as gd,useEffect as Gg,useMemo as bd,useRef as Uo,useState as Yg}from"react";import{BookOpen as yd,X as Qg}from"lucide-react";import{Fragment as Jg,jsx as ze,jsxs as gt}from"react/jsx-runtime";function Ws(e){return e.exercises.flatMap((t,r)=>t.sharedContext&&_n(t.sharedContext)?[{id:t.id,index:r,title:t.title,content:t.sharedContext}]:[])}var vd=()=>typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;function Xg(e){e.removeAttribute("data-flash"),e.offsetWidth,e.setAttribute("data-flash","true"),setTimeout(()=>e.removeAttribute("data-flash"),1200)}function xd({assessment:e,isSubmitted:t,setAnswers:r,validationFeedback:n,renderExercise:o,renderSeparator:a,primaryColor:s,contained:i=!1,locale:c,contentMaxWidth:l,t:d,footer:u}){let[p,f]=Yg(!1),h=e.annex,m=h?.tabLabel||d("annexDocuments"),b=bd(()=>Ws(e),[e]),y=Uo(null),x=Uo(null),A=Uo(null),g=Uo(null),T=()=>(y.current?.getClientRects().length??0)>0,C=gd((v,O)=>{let _=v?.querySelector(`[data-reference-for="${CSS.escape(O)}"]`);if(!v||!_)return;let w=_.getBoundingClientRect().top-v.getBoundingClientRect().top+v.scrollTop-12;v.scrollTo({top:w,behavior:vd()?"auto":"smooth"}),Xg(_)},[]),E=gd(v=>{if(T()){C(x.current,v);return}f(!0),requestAnimationFrame(()=>requestAnimationFrame(()=>C(g.current,v)))},[C]),R=v=>{let O=T()?y.current:A.current;T()||f(!1),Array.from(O?.querySelectorAll(`[data-exercise-id="${CSS.escape(v)}"]`)??[]).find(w=>w.getClientRects().length>0)?.scrollIntoView({behavior:vd()?"auto":"smooth",block:"start"})};Gg(()=>{let v=y.current;if(!v||b.length===0||typeof IntersectionObserver>"u")return;let O=i?v:null,_=new Set(b.map(Y=>Y.id)),w=null,X=new IntersectionObserver(Y=>{if(!T())return;let L=Y.filter(B=>B.isIntersecting&&_.has(B.target.dataset.exerciseId??"")).sort((B,J)=>B.boundingClientRect.top-J.boundingClientRect.top)[0]?.target?.dataset.exerciseId;!L||L===w||(w=L,C(x.current,L))},{root:O,rootMargin:"0px 0px -60% 0px"});return v.querySelectorAll("[data-exercise-id]").forEach(Y=>X.observe(Y)),()=>X.disconnect()},[b,C,i]);let M=bd(()=>({label:m,showExerciseReference:E}),[m,E]),k=gt(Jg,{children:[h?.items.map(v=>ze(En,{item:v},v.id)),h?.items.length&&b.length?ze("div",{className:"border-t border-[#e7e5e0]"}):null,b.map(v=>gt("section",{"data-reference-for":v.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:[ze("button",{type:"button",onClick:()=>R(v.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:ze("span",{dir:"auto",children:Et(d,v.title,v.index)})}),ze(Gr,{content:v.content})]},v.id))]}),S=ze(tr,{assessment:e,onAnswersChange:t?void 0:r,validationFeedback:n,renderExercise:o,renderSeparator:a,locale:c});return ze(Oo,{value:M,children:gt("div",{className:$e("@container flex-1 min-h-0 flex",i&&"relative"),children:[gt("div",{ref:y,className:$e("hidden @6xl:flex flex-1 min-w-0 gap-4 p-4 bg-[#f5f4f1] items-start",i&&"overflow-y-auto"),children:[gt("div",{className:$e("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:[gt("div",{className:"flex items-center gap-2 px-5 py-3 border-b border-[#e7e5e0] flex-shrink-0",children:[ze(yd,{size:14,className:"text-[#8d93a0]"}),ze("span",{className:"text-xs font-bold text-[#565b66] uppercase tracking-widest",children:m})]}),ze("div",{ref:x,className:"flex-1 overflow-y-auto px-6 py-5 flex flex-col gap-6",children:k})]}),ze("div",{className:"w-px bg-[#e7e5e0] flex-shrink-0 self-stretch my-1 rounded-full"}),ze("div",{className:"flex-1 min-w-0 bg-white rounded-[14px] border border-[#e7e5e0] shadow-sm",children:gt("div",{className:"px-6 py-5 flex flex-col gap-4",children:[S,u]})})]}),gt("div",{className:$e("@6xl:hidden flex-1 min-w-0 relative",i&&"overflow-hidden"),children:[ze("div",{ref:A,className:$e(i&&"absolute inset-0 overflow-y-auto"),children:gt("div",{className:"mx-auto px-5 py-5 flex flex-col gap-4",style:{maxWidth:l},children:[S,u]})}),p&&ze("div",{className:$e("inset-0 z-30 bg-black/25",i?"absolute":"fixed"),onClick:()=>f(!1)}),gt("div",{role:"dialog","aria-label":m,"aria-hidden":!p,className:$e("top-1/2 start-2 -translate-y-1/2 z-40 w-[88%] bg-[#f1efe9] rounded-2xl shadow-2xl flex flex-col overflow-hidden transition-transform duration-300 ease-in-out",i?"absolute":"fixed",p?"translate-x-0":"-translate-x-[110%] rtl:translate-x-[110%]"),children:[gt("div",{className:"flex items-center justify-between px-5 py-3 flex-shrink-0",children:[ze("span",{className:"text-sm font-bold text-[#1d2025]",children:m}),ze("button",{onClick:()=>f(!1),"aria-label":d("close"),className:"p-1 text-[#8d93a0] hover:text-[#1d2025] rounded-lg transition-colors",children:ze(Qg,{size:18})})]}),ze("div",{ref:g,className:"overflow-y-auto max-h-[calc(100dvh-8rem)] px-5 pb-5 flex flex-col gap-5",children:k})]})]}),!p&&gt("button",{onClick:()=>f(!0),"aria-label":m,style:{transform:"translateY(-50%)",...s?{backgroundColor:s}:{}},className:$e("@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:[ze(yd,{size:12}),ze("span",{style:{writingMode:"vertical-rl",transform:"rotate(180deg)"},children:m})]})]})})}import{useState as Zg}from"react";import{BookOpen as wd,Plus as eb,X as tb}from"lucide-react";import{jsx as We,jsxs as Ht}from"react/jsx-runtime";function kd({assessment:e,isSubmitted:t,setAnswers:r,validationFeedback:n,renderExercise:o,renderSeparator:a,primaryColor:s,contained:i=!1,locale:c,contentMaxWidth:l,t:d,onAddAnnex:u,footer:p}){let[f,h]=Zg(!1),m=We(tr,{assessment:e,onAnswersChange:t?void 0:r,validationFeedback:n,renderExercise:o,renderSeparator:a,locale:c});if(f)return We("div",{className:"flex-1 overflow-y-auto",children:Ht("div",{className:"mx-auto p-6 flex flex-col gap-4",style:{maxWidth:l},children:[m,p]})});let b=A=>{(A.key==="Enter"||A.key===" ")&&(A.preventDefault(),u())},y=A=>Ht("span",{style:s?{backgroundColor:s}:void 0,className:$e("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",A?"px-3 py-1.5 text-xs":"mt-1 px-3.5 py-2 text-xs"),children:[We(eb,{size:13}),d("annexEmptyCta")]}),x=A=>We("button",{type:"button",onClick:g=>{g.stopPropagation(),h(!0)},"aria-label":d("annexEmptyDismiss"),title:d("annexEmptyDismiss"),className:$e("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",A&&"absolute top-2 end-2 z-10"),children:We(tb,{size:15})});return Ht("div",{className:$e("@container flex-1 min-h-0 flex",i&&"relative"),children:[Ht("div",{className:"hidden @6xl:flex flex-1 gap-4 p-4 bg-[#f5f4f1] items-start overflow-y-auto",children:[We("div",{className:"flex-1 sticky top-4 flex min-h-[200px] max-h-[calc(100svh-6rem)]",children:Ht("div",{role:"button",tabIndex:0,onClick:u,onKeyDown:b,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:[x(!0),We("span",{className:"flex items-center justify-center w-11 h-11 rounded-full bg-[#f1efe9] text-[#8d93a0] group-hover:text-[#1d2025] transition-colors",children:We(wd,{size:20})}),We("span",{className:"text-sm font-bold text-[#565b66]",children:d("annexEmptyTitle")}),We("span",{className:"text-xs text-[#8d93a0] max-w-[32ch] leading-relaxed",children:d("annexEmptyBody")}),y(!1)]})}),We("div",{className:"w-px bg-[#e7e5e0] flex-shrink-0 self-stretch my-1 rounded-full"}),We("div",{className:"flex-1 bg-white rounded-[14px] border border-[#e7e5e0] shadow-sm",children:Ht("div",{className:"px-6 py-5 flex flex-col gap-4",children:[m,p]})})]}),We("div",{className:"@6xl:hidden flex-1 overflow-y-auto",children:Ht("div",{className:"mx-auto px-5 py-5 flex flex-col gap-4",style:{maxWidth:l},children:[Ht("div",{role:"button",tabIndex:0,onClick:u,onKeyDown:b,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:[We("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:We(wd,{size:16})}),Ht("div",{className:"flex-1 min-w-0",children:[We("div",{className:"text-xs font-bold text-[#565b66]",children:d("annexEmptyTitle")}),We("div",{className:"text-[11px] text-[#8d93a0] leading-snug",children:d("annexEmptyBody")})]}),y(!0),x(!1)]}),m,p]})})]})}function Ko(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 rb}from"lucide-react";import{jsx as Vs,jsxs as Sd}from"react/jsx-runtime";function nb(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 Rd({content:e,nodeResults:t,label:r}){let n=nb(t);return Sd("div",{className:`player-ai-feedback mt-3 mb-3${n?` player-ai-feedback--${n}`:""}`,children:[Sd("p",{className:"flex items-center gap-1.5 text-xs font-semibold",children:[Vs(rb,{size:14,"aria-hidden":!0}),r]}),Vs("div",{className:"text-[#1d2025]",children:Vs(Gr,{content:e})})]})}import{useState as Pd}from"react";import{jsx as Sr,jsxs as Cd}from"react/jsx-runtime";function Nd({questionId:e,onReport:t,t:r}){let[n,o]=Pd("closed"),[a,s]=Pd("");if(n==="sent")return Sr("p",{role:"status",className:"mt-2 text-sm text-[#5b6170]",children:r("reportGradeSent")});if(n==="closed")return Sr("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 Cd("div",{className:"mt-2 rounded-lg border border-[#e7e5e0] bg-[#fbfaf7] p-3",children:[Sr("label",{className:"mb-1.5 block text-sm font-medium text-[#1d2025]",htmlFor:`report-${e}`,children:r("reportGradePrompt")}),Sr("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"&&Sr("p",{role:"alert",className:"mt-1 text-sm text-[#a32b1e]",children:r("reportGradeFailed")}),Cd("div",{className:"mt-2 flex gap-2",children:[Sr("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")}),Sr("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 Ut,jsxs as Gs}from"react/jsx-runtime";function Ad({t:e,rtl:t,showClose:r,onContinue:n,continueLabel:o,primaryColor:a}){return Gs("div",{role:"status",className:"edp-thanks flex-1 flex items-center justify-center px-6 py-16",children:[Ut("style",{children:ob}),Gs("div",{className:"flex flex-col items-center text-center",style:{maxWidth:"26rem"},children:[Gs("div",{className:"relative",style:{width:120,height:120},"aria-hidden":!0,children:[Ut("svg",{className:"edp-thanks-blob absolute inset-0 overflow-visible",viewBox:"0 0 200 200",width:"120",height:"120",children:Ut("path",{d:"M104 14c44 2 80 34 82 80s-34 94-86 92S12 150 16 98 58 12 104 14z",fill:"#ffd64a"})}),Ut("svg",{className:"absolute inset-0 overflow-visible",viewBox:"0 0 100 100",width:"120",height:"120",children:Ut("path",{className:"edp-thanks-check",d:"M26 54l17 17 33-39",fill:"none",stroke:"#1d2025",strokeWidth:9,strokeLinecap:"round",strokeLinejoin:"round",pathLength:1})})]}),Ut("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")}),Ut("p",{className:"edp-thanks-rise mt-4 text-base text-[#565b66]",style:{animationDelay:"750ms"},children:e("formThanksDesc")}),r&&!n&&Ut("p",{className:"edp-thanks-rise mt-1 text-sm text-[#8a8f99]",style:{animationDelay:"850ms"},children:e("formThanksClose")}),n&&Ut("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 ob=`
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,9 +78,9 @@ 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 Lg=new Set(["choiceSet","inlineChoiceSet","blank","aiAnswerInput","matchingSet","openResponseNode","mathResponse","codingResponse"]),Ig=new Set(["blankPool","inlinePool"]);function $g(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 Fg(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(Lg.has(o)){t+=1;return}if(Ig.has(o))return}a!==void 0&&r(a)};return r(e),t}function $s(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)$g(i)&&s.add(i.nodeId)}let n=[];return e.exercises.forEach((o,a)=>{o.questions.forEach((s,i)=>{let c=Fg(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 Fs(e,t,r){let n=new Set(r);return n.size===0?[]:$s(e,t).filter(o=>n.has(o.questionId))}function Ds(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 ud(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 zs(e){if(Array.isArray(e))return e.some(zs);if(!e||typeof e!="object")return!1;let{text:t,content:r}=e;return typeof t=="string"||r!==void 0&&zs(r)}function pd(e,t){if(e.type!=="openResponse"||!t.has(e.nodeId))return!1;let r=e.answer.text;return r!==void 0&&!zs(r.content)}function md(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=>pd(s,r))?{...o,answers:o.answers.map(s=>{let i=s;if(i.type!=="openResponse"||!pd(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 zg={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.",copyButton:"Photograph my copy",copyButtonShort:"My copy",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"},Dg={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.",copyButton:"Photographier ma copie",copyButtonShort:"Ma copie",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"},Og={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.",copyButton:"\u062A\u0635\u0648\u064A\u0631 \u0648\u0631\u0642\u062A\u064A",copyButtonShort:"\u0648\u0631\u0642\u062A\u064A",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"},jr={en:zg,fr:Dg,ar:Og};function Bg(e,t,r){let o=(jr[e]??jr.en)[t]??jr.en[t]??t;return r?Object.entries(r).reduce((a,[s,i])=>a.replace(`{${s}}`,String(i)),o):o}function hd(e,t){let r=new Intl.PluralRules(e).select(t),n=jr[e]??jr.en;return n[`points.${r}`]??n.points??jr.en.points}function fd(e){return(t,r)=>Bg(e,t,r)}function Os(e){return e==="ar"}function Bs(e,t=[]){if(Array.isArray(e)){for(let n of e)Bs(n,t);return t}if(!e||typeof e!="object")return t;let r=e;return typeof r.id=="string"&&(r.type==="aiAnswerInput"||r.type==="openResponseNode")&&r.attrs?.photo===!0&&t.push(r.id),Bs(r.content,t)}function gd(e,t){let r=[];return e.exercises.forEach((n,o)=>{let a=n.questions.length===1;n.questions.forEach((s,i)=>{let c=Bs(s.content.content);c.forEach((l,p)=>{let d=a?Ct(t,n.title,o):`${Ct(t,n.title,o)} \xB7 ${t("question",{index:i+1})}`;r.push({nodeId:l,questionId:s.id,label:c.length>1?`${d} ${String.fromCharCode(97+p)})`:d})})})}),r}var Do=class{constructor(t){this.onChange=t;this.sheets=new Map;this.attach=(t,r)=>{let n=this.sheets.get(t)??new Set;return n.add(r),this.sheets.set(t,n),this.onChange(),()=>{n.delete(r),n.size===0&&this.sheets.delete(t),this.onChange()}};this.isEmpty=t=>{let r=this.sheets.get(t);return!r||[...r].every(n=>n.isEmpty())};this.place=(t,r,n,o)=>{for(let a of this.sheets.get(t)??[])a.placeLines(r,n,o)}}has(t){return this.sheets.has(t)}};var bd="48rem";function mr(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))}mr(`: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--readonly .edp-sheet-body{container-type:inline-size}.edp-sheet-grid.has-pages{display:grid;grid-template-columns:minmax(0,1fr);gap:calc(.75rem * var(--edp-scale, 1));align-items:start}@container (min-width: 40rem){.edp-sheet-grid.has-pages{grid-template-columns:minmax(0,1fr) minmax(15rem,42%)}.edp-sheet-grid.has-pages .edp-sheet-pages{position:sticky;top:calc(var(--edp-bar, 0px) + .75rem)}.edp-sheet-grid.has-pages .edp-sheet-pages-view img{max-height:min(78vh,46rem)}}.edp-sheet-pages{margin:0;min-width:0}.edp-sheet-pages-head{display:flex;flex-wrap:wrap;align-items:center;gap:calc(.5rem * var(--edp-scale, 1));margin-bottom:calc(.375rem * var(--edp-scale, 1))}.edp-sheet-pages-tabs{display:inline-flex;flex-wrap:wrap;gap:calc(.25rem * var(--edp-scale, 1));margin-inline-start:auto}.edp-sheet-pages-tab{min-width:calc(2rem * var(--edp-scale, 1));height:calc(2rem * var(--edp-scale, 1));padding:0 calc(.5rem * var(--edp-scale, 1));border:1px solid var(--line-strong, #d6d3cc);border-radius:999px;background:var(--card, #ffffff);color:var(--ink, #1d2025);font-size:calc(.8125rem * var(--edp-scale, 1));font-variant-numeric:tabular-nums;cursor:pointer;transition:background-color .18s ease,color .18s ease}.edp-sheet-pages-tab:hover:not(.is-active){background:var(--paper-deep, #f4f1ea)}.edp-sheet-pages-tab.is-active{border-color:var(--ink, #1d2025);background:var(--ink, #1d2025);color:var(--card, #ffffff)}.edp-sheet-pages-tab:focus-visible,.edp-sheet-pages-view:focus-visible{outline:2px solid var(--ink, #1d2025);outline-offset:2px}.edp-sheet-pages-view{display:block;width:100%;padding:0;border:none;background:none;cursor:zoom-in}.edp-sheet-pages-view img,.edp-sheet-pages-print img{display:block;width:100%;max-height:calc(26rem * var(--edp-scale, 1));object-fit:contain;border:1px solid var(--line, #e8e5de);border-radius:calc(.5rem * var(--edp-scale, 1));background:var(--card, #ffffff)}.edp-sheet-pages-print{display:none}@media print{.edp-sheet-pages-tabs{display:none}.edp-sheet-pages-print{display:grid;gap:.5rem;margin-top:.5rem}.edp-sheet-pages{position:static!important}.edp-sheet-pages-view img,.edp-sheet-pages-print img{max-height:22rem;break-inside:avoid}}.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(--ink, #1d2025);font-weight:500;font-size:calc(.9375rem * var(--edp-scale, 1))}.edp-sheet-btn--end{margin-inline-start:auto}.edp-sheet-shots{display:flex;flex-wrap:wrap;gap:calc(.75rem * var(--edp-scale, 1));margin:0 0 calc(.75rem * var(--edp-scale, 1));padding:calc(.5rem * var(--edp-scale, 1)) 0 0;list-style:none}.edp-sheet-shot{display:flex;flex-direction:column;align-items:center;gap:calc(.375rem * var(--edp-scale, 1))}.edp-sheet-shot-tools{display:flex;gap:calc(.375rem * var(--edp-scale, 1))}.edp-sheet-shot-view,.edp-sheet-photo-view{position:relative;display:block;padding:0;border:none;background:none;cursor:zoom-in}.edp-sheet-shot-view img{display:block;width:calc(5rem * var(--edp-scale, 1));height:calc(6.5rem * var(--edp-scale, 1));object-fit:cover;border-radius:calc(.375rem * var(--edp-scale, 1));border:1px solid var(--line, #e8e5de);background:var(--card, #ffffff)}.edp-sheet-shot[data-state=sending] img{opacity:.55}.edp-sheet-shot[data-state=failed] img{border:2px dashed var(--ink, #1d2025)}.edp-sheet-shot-view .player-ai-spinner{position:absolute;inset:0;margin:auto}.edp-sheet-shot-tool{display:grid;place-items:center;width:calc(2rem * var(--edp-scale, 1));height:calc(2rem * var(--edp-scale, 1));padding:0;border-radius:999px;border:1px solid var(--line-strong, #d6d3cc);background:var(--card, #ffffff);color:var(--ink, #1d2025);cursor:pointer;transition:background-color .18s ease}.edp-sheet-shot-tool:hover:not(:disabled){background:var(--paper-deep, #f4f1ea)}.edp-sheet-shot-tool:disabled{opacity:.45;cursor:default}.edp-sheet-shot-view:focus-visible,.edp-sheet-photo-view:focus-visible,.edp-sheet-shot-tool:focus-visible{outline:2px solid var(--ink, #1d2025);outline-offset:2px}.edp-sheet-hint{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(--paper-deep, #f4f1ea);border-radius:calc(.5rem * var(--edp-scale, 1))}.edp-sheet-progress .edp-sheet-btn--end{flex:none}.edp-sheet-viewer{position:fixed;inset:0;z-index:1000;display:grid;place-items:center;padding:calc(1rem * var(--edp-scale, 1));background:#111317e0}.edp-sheet-viewer img{max-width:100%;max-height:100%;object-fit:contain;border-radius:calc(.375rem * var(--edp-scale, 1));cursor:default}.edp-sheet-viewer-close{position:absolute;top:calc(.75rem * var(--edp-scale, 1));inset-inline-end:calc(.75rem * var(--edp-scale, 1));width:calc(2.75rem * var(--edp-scale, 1));height:calc(2.75rem * var(--edp-scale, 1));border:none;border-radius:999px;background:#ffffffeb;color:var(--ink, #1d2025);font-size:calc(1.5rem * var(--edp-scale, 1));line-height:1;cursor:pointer}.edp-sheet-viewer-close{transition:background-color .18s ease}.edp-sheet-viewer-close:hover{background:var(--paper-deep, #f4f1ea)}.edp-sheet-viewer-close:focus-visible{outline:2px solid #ffffff;outline-offset:2px}.edp-sheet-unsure{background-image:linear-gradient(var(--almost, #c8810e),var(--almost, #c8810e));background-repeat:no-repeat;background-position:0 100%;background-size:100% 2px;background-color:var(--almost-soft, #fbf1dc);-webkit-box-decoration-break:clone;box-decoration-break:clone}.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(.25rem * var(--edp-scale, 1));font-size:calc(1.6rem * var(--edp-scale, 1))}.edp-sheet-pad-latex{display:block;flex:0 1 auto;min-width:0;overflow-x:auto;transition:opacity .12s ease-out}.edp-sheet-pad-latex--stale{opacity:.4}.edp-sheet-pad-help{min-height:1.4em;margin:0 0 calc(.5rem * var(--edp-scale, 1));font-size:calc(.875rem * var(--edp-scale, 1));line-height:1.4;color:var(--ink-soft, #5b6170)}.edp-sheet-pad-retry{padding:.75rem .25rem;margin:-.75rem -.25rem;border:0;background:none;color:var(--ink, #1d2025);font:inherit;font-weight:500;text-decoration:underline;text-underline-offset:3px;cursor:pointer}.edp-sheet-pad-retry:focus-visible{outline:2px solid var(--ink, #1d2025);outline-offset:2px}@media(prefers-reduced-motion:reduce){.edp-sheet-pad-latex{transition:none}}.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}.edp-ink-help{margin:0 0 calc(.5rem * var(--edp-scale, 1));font-size:calc(.875rem * var(--edp-scale, 1));color:var(--ink-soft, #5b6170)}.edp-ink-tabs{display:flex;flex-wrap:wrap;gap:calc(.375rem * var(--edp-scale, 1));margin:0 0 calc(.5rem * var(--edp-scale, 1));padding:0;list-style:none}.edp-ink-tab{display:inline-flex;align-items:center;border:1px solid var(--line-strong, #d6d3cc);border-radius:calc(.5rem * var(--edp-scale, 1));background:var(--card, #ffffff)}.edp-ink-tab.is-current{border-color:var(--ink, #1d2025);background:var(--ink, #1d2025)}.edp-ink-tab.is-current .edp-ink-tab-go,.edp-ink-tab.is-current .edp-ink-tab-remove{color:var(--card, #ffffff)}.edp-ink-tab-go,.edp-ink-tab-remove{min-height:calc(2.5rem * var(--edp-scale, 1));border:none;background:transparent;color:var(--ink, #1d2025);cursor:pointer;touch-action:manipulation}.edp-ink-tab-go{padding-inline:calc(.75rem * var(--edp-scale, 1)) calc(.375rem * var(--edp-scale, 1));font-size:calc(.875rem * var(--edp-scale, 1));font-weight:500}.edp-ink-tab-remove{display:inline-flex;align-items:center;justify-content:center;width:calc(2.25rem * var(--edp-scale, 1));color:var(--ink-soft, #5b6170);border-start-end-radius:inherit;border-end-end-radius:inherit}.edp-ink-tab-go,.edp-ink-tab-remove{transition:background-color .18s ease,color .18s ease}.edp-ink-tab-go{border-start-start-radius:inherit;border-end-start-radius:inherit}.edp-ink-tab:not(.is-current) .edp-ink-tab-go:hover:not(:disabled),.edp-ink-tab-remove:hover{background:var(--paper-deep, #f4f1ea);color:var(--ink, #1d2025)}.edp-ink-tab.is-current .edp-ink-tab-remove:hover{background:#ffffff29;color:var(--card, #ffffff)}.edp-ink-removed,.edp-copy-leave{margin:0 0 calc(.5rem * var(--edp-scale, 1));font-size:calc(.875rem * var(--edp-scale, 1));color:var(--ink, #1d2025)}@media(pointer:coarse){.edp-sheet-pages-tab{min-width:calc(2.5rem * var(--edp-scale, 1));height:calc(2.5rem * var(--edp-scale, 1))}}@media(prefers-reduced-motion:reduce){.edp-ink-tab-go,.edp-ink-tab-remove,.edp-sheet-viewer-close,.edp-sheet-pages-tab{transition:none}}.edp-ink-tab-go:focus-visible,.edp-ink-tab-remove:focus-visible{outline:2px solid var(--ink, #1d2025);outline-offset:2px}.edp-ink-page{display:block;width:100%;height:calc(288px * var(--edp-scale, 1));margin-bottom:calc(.5rem * var(--edp-scale, 1));background:#fff;border:1px solid var(--line-strong, #d6d3cc);border-radius:calc(.25rem * var(--edp-scale, 1));box-shadow:0 1px 2px #1d20250f;touch-action:none;cursor:crosshair}.edp-ink-page.is-busy{pointer-events:none;opacity:.7}@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,.edp-sheet-shot-tool{width:calc(2.5rem * var(--edp-scale, 1));height:calc(2.5rem * var(--edp-scale, 1))}.edp-sheet-shot-view img{width:calc(6rem * var(--edp-scale, 1));height:calc(8rem * var(--edp-scale, 1))}.edp-sheet-btn--end{margin-inline-start:0}.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,.edp-sheet-shot-tool{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}}.edp-copy{position:fixed;inset:0;z-index:900;display:flex;align-items:center;justify-content:center;padding:1rem;background:#11131773}.edp-copy-sheet{display:flex;flex-direction:column;width:100%;max-width:40rem;max-height:100%;background:var(--card, #ffffff);border-radius:.875rem;box-shadow:0 12px 40px #1113172e;overflow:hidden}.edp-copy-head{display:flex;align-items:center;justify-content:space-between;gap:.5rem;padding-block:.625rem;padding-inline:1rem .75rem;border-bottom:1px solid var(--line, #e8e5de)}.edp-copy-head h2{margin:0;font-size:1rem;font-weight:700;color:var(--ink, #1d2025);outline:none}.edp-copy-body{flex:1 1 auto;min-height:0;overflow-y:auto;padding:.75rem 1rem 1rem;overscroll-behavior:contain}.edp-sheet-panel--bare{margin:0;padding:0;border:none;background:transparent}.edp-copy-help{margin:.75rem 0 .5rem;font-size:.875rem;line-height:1.5;color:var(--ink-soft, #5b6170)}.edp-copy-question{margin-top:1rem}.edp-copy-question h3{margin:0 0 .375rem;font-size:.8125rem;font-weight:700;color:var(--ink, #1d2025)}.edp-copy-question--loose h3{color:var(--almost-ink, #8a5a08)}.edp-copy-parts{display:flex;flex-direction:column;gap:.5rem;margin:0;padding:0;list-style:none}.edp-copy-part{padding:.625rem .75rem;border:1px solid var(--line, #e8e5de);border-radius:.625rem;background:var(--paper, #fbfaf7)}.edp-copy-question--loose .edp-copy-part{border-color:var(--almost, #c8810e);background:var(--almost-soft, #fbf1dc)}.edp-copy-part-text{font-size:.9375rem;line-height:1.6;color:var(--ink, #1d2025);overflow-wrap:anywhere}.edp-copy-part-text p{margin:0}.edp-copy-part-text .katex-display{margin:.25rem 0;overflow-x:auto;overflow-y:hidden}.edp-copy-move{display:flex;align-items:center;gap:.5rem;margin-top:.5rem;font-size:.8125rem;color:var(--ink-soft, #5b6170)}.edp-copy-move select{min-width:0;max-width:100%;flex:1 1 auto;min-height:2.25rem;padding-inline:.5rem;font-size:.875rem;color:var(--ink, #1d2025);background:var(--card, #ffffff);border:1px solid var(--line-strong, #d6d3cc);border-radius:.5rem}.edp-copy-keep{display:flex;flex-wrap:wrap;align-items:center;gap:.25rem .875rem;margin-bottom:.5rem;padding:.5rem .75rem;border-radius:.5rem;background:var(--paper-deep, #f4f1ea);font-size:.8125rem;color:var(--ink, #1d2025)}.edp-copy-keep>span{flex-basis:100%;color:var(--ink-soft, #5b6170)}.edp-copy-keep-option{display:inline-flex;align-items:center;gap:.375rem;min-height:2rem;cursor:pointer}.edp-copy-foot{padding:.75rem 1rem;border-top:1px solid var(--line, #e8e5de);background:var(--card, #ffffff)}.edp-copy-foot .edp-sheet-hint{margin:0 0 .5rem}@media(pointer:coarse){.edp-copy-move select,.edp-copy-keep-option{min-height:2.5rem}}@media(max-width:640px){.edp-copy{padding:0}.edp-copy-sheet{max-width:none;height:100%;border-radius:0}}
82
- `);import"katex/dist/katex.min.css";mr(`.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
- `);mr(`/*! 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 Ks,jsx as D,jsxs as te}from"react/jsx-runtime";var Gg="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 Yg(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 Cd(e){let t=e;return typeof t.totalMaxScore=="number"?t.totalMaxScore:(t.answerKeys??[]).reduce((r,n)=>r+(n.scoring?.maxScore??0),0)}function kd(e){return e.questions.reduce((t,r)=>t+Cd(r),0)}function Bt(e){return Number.isInteger(e)?String(e):parseFloat(e.toFixed(2)).toString()}var Us=5;function Sd({label:e}){return D("span",{className:"ms-0.5 text-[#d23b2b]",title:e,"aria-label":e,children:"*"})}function Ad(e){return e==="full"?"#1f8a4c":e==="partial"?"#c8810e":"#d23b2b"}function Rd({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 D("svg",{width:14,height:14,viewBox:"0 0 100 100",fill:"none",stroke:Ad(e),strokeWidth:9,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:D("path",{d:t})})}function Qg({score:e,weight:t,unit:r,t:n,hidden:o=!1}){if(e){if(e.awaiting)return te("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:[D(qr,{size:11}),n("pendingReview")]});let a=o?e.outcome:e.m>0&&e.s>=e.m?"full":e.s>0?"partial":"none";return o?D("span",{className:"inline-flex items-center rounded-lg border border-[#e7e5e0] bg-[#f5f4f1] px-2 py-1",children:D(Rd,{outcome:a})}):te("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:[D(Rd,{outcome:a}),te("span",{className:"font-bold leading-none",style:{fontFamily:'var(--font-hand, "Caveat", cursive)',fontSize:"1.05rem",color:Ad(a)},children:[Bt(e.s)," / ",Bt(e.m)]})]})}return t>0&&!o?te("span",{className:"text-xs font-semibold tabular-nums text-[#8d93a0]",children:[Bt(t)," ",r(t)]}):null}function Pd(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 Xg({timeLimitMinutes:e,startedAt:t,onExpire:r}){let n=e*6e4,o=new Date(t).getTime()+n,[a,s]=et(()=>Math.max(o-Date.now(),0)),i=Yt(r);i.current=r,Oo(()=>{if(a<=0){i.current();return}let m=setInterval(()=>{let b=Math.max(o-Date.now(),0);s(b),b<=0&&(clearInterval(m),i.current())},1e3);return()=>clearInterval(m)},[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),d=Math.floor(p/3600),u=Math.floor(p%3600/60),f=p%60,h=d>0?`${d}:${String(u).padStart(2,"0")}:${String(f).padStart(2,"0")}`:`${u}:${String(f).padStart(2,"0")}`;return te("span",{className:Me("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:[D(qr,{size:12}),h]})}function Bo({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:d,resumed:u=!1,onSubmit:f,review:h,onViewReport:m,reportLabel:b,onBack:w,backLabel:P,allowReset:g,onReset:R,overlayConfig:_,contained:A=!1,layout:I,onClose:C,mediaHandler:L,answerSheetHandler:v,wholeCopy:S=!1,onReportGrade:x,onAddAnnex:B,fallbackLogoUrl:E}){let y=$e(()=>fd(a),[a]),K=yt(q=>hd(a,q),[a]),F=Os(a)?"rtl":"ltr",Y=Yt(null),$=Yt(null);Oo(()=>{let q=$.current,fe=Y.current;if(!q||!fe||typeof ResizeObserver>"u")return;let Ce=()=>fe.style.setProperty("--edp-bar",`${q.offsetHeight}px`);Ce();let xt=new ResizeObserver(Ce);return xt.observe(q),()=>xt.disconnect()},[]);let O=I?.maxWidth??bd,G=s?.branding?.primaryColor,T=s?.branding?.accentColor,N=s?.branding?.fontFamily,H=s?.branding?.fontUrl,M=s?.branding?.showPoweredBy!==!1;Oo(()=>{if(!H||typeof document>"u"||document.querySelector(`link[href="${H}"]`))return;let fe=document.createElement("link");fe.rel="stylesheet",fe.href=H,document.head.appendChild(fe)},[H]);let[k,W]=et(()=>h?.answers??l??{exerciseAnswers:[]}),[V]=et(()=>h?new Map:Ds(l)),ne=$e(()=>ud(e),[e]),le=Yt(p);le.current=p;let[Z]=et(()=>(h?h.answers:l)?.mediaPlays),se=Yt(Z),ve=yt(q=>se.current&&Object.keys(se.current).length>0?{...q,mediaPlays:se.current}:q,[]),ye=Yt(k);ye.current=k;let ge=Yt(!1),xe=yt(q=>{let fe=ve(md(q,V,ne));W(fe),le.current?.(fe)},[V,ne,ve]),We=yt(q=>{if(se.current=q,h||ge.current)return;let fe=ve(ye.current);W(fe),le.current?.(fe)},[h,ve]),[He,X]=et(null);Oo(()=>{X(Date.now())},[]);let[he,be]=et(u&&!h),z=$e(()=>{if(He===null||!i||i<=0||!c)return null;let q=new Date(c).getTime()+i*6e4-He;return q>0?Math.max(1,Math.floor(q/6e4)):null},[He,i,c]),[re,de]=et(!1),[ie,Pe]=et(!1),[ee,Ve]=et(h?.result??null);ge.current=ee!==null;let mt=$e(()=>Ds(h?.answers),[h]),[jt,Nt]=et(null),[hr,Qs]=et(!1),Xs=Yt(!1),Dd=$e(()=>Yg(e),[e]),[Od,Bd]=et(0),fr=$e(()=>new Do(()=>Bd(q=>q+1)),[]),Hr=$e(()=>{if(!v)return;let q=v.attachSheet;return{...v,attachSheet:(fe,Ce)=>{let xt=fr.attach(fe,Ce),st=q?.(fe,Ce);return()=>{xt(),st?.()}}}},[v,fr]),qo=$e(()=>gd(e,y),[e,y]),Js=$e(()=>S&&Et(v)?qo.filter(q=>fr.has(q.nodeId)):[],[S,v,qo,fr,Od]),[jd,Zs]=et(!1),ei=$e(()=>ie?$s(e,k):[],[ie,e,k]),Ur=ei.length,Rn=yt(q=>{Pe(!1);let fe=Y.current?.querySelectorAll(`[data-question-id="${CSS.escape(q)}"]`),Ce=Array.from(fe??[]).find(xt=>xt.getClientRects().length>0);Ce&&requestAnimationFrame(()=>Ce.scrollIntoView({block:"start",behavior:"smooth"}))},[]),Ho=(o??[]).join(" "),Qt=$e(()=>new Set(Ho?Ho.split(" "):[]),[Ho]),[ti,qd]=et(!1),Uo=$e(()=>ti?Fs(e,k,Qt).map(q=>q.questionId).join(" "):"",[ti,e,k,Qt]),ri=$e(()=>new Set(Uo?Uo.split(" "):[]),[Uo]),Hd=yt(()=>{let q=Fs(e,k,Qt);if(q.length===0){Pe(!0);return}qd(!0),Rn(q[0].questionId)},[e,k,Qt,Rn]),Ko=$e(()=>e.exercises.reduce((q,fe)=>q+kd(fe),0),[e]),Wo=$e(()=>ee?zo(ee.exerciseFeedback):void 0,[ee]),ni=$e(()=>{let q=new Map;for(let fe of ee?.exerciseFeedback??[])for(let Ce of fe.questions)Ce.explanation&&q.set(Ce.questionId,Ce);return q},[ee]),Pn=r||ee?.scoreHidden===!0,oi=$e(()=>{if(!ee)return{};let q={};for(let fe of ee.exerciseFeedback)q[fe.exerciseId]=Pd(fe.questions.flatMap(Ce=>Ce.nodeResults));return q},[ee]),Vo=$e(()=>{if(!ee)return{};let q={};for(let fe of ee.exerciseFeedback)for(let Ce of fe.questions)Ce.nodeResults.length>0&&(q[Ce.questionId]=Pd(Ce.nodeResults));return q},[ee]),Ud=yt(async()=>{de(!0),Nt(null);try{let q=await f(k);Ve(q),typeof window<"u"&&window.scrollTo({top:0,behavior:"smooth"})}catch(q){Nt(q instanceof Error?q.message==="required_unanswered"?y("requiredBlocked"):q.message:y("confirmCancel"))}finally{de(!1),Pe(!1)}},[k,f,y]),Cn=yt(()=>{!ee||!m||m(ee)},[ee,m]),Kd=yt(()=>{Xs.current||re||ee||(Xs.current=!0,Qs(!0),Pe(!1),typeof document<"u"&&document.activeElement?.blur(),setTimeout(()=>{de(!0),Nt(null),f(k).then(q=>{Ve(q),typeof window<"u"&&window.scrollTo({top:0,behavior:"smooth"})}).catch(q=>{Nt(q instanceof Error?q.message:"submit_error")}).finally(()=>{de(!1),Qs(!1)})},800))},[k,re,f,ee]),Go=yt((q,fe,Ce)=>{let xt=kd(q),st=oi[q.id],ai=q.questions.length>1,Vd=xd(fe)?yd(fe,{renderQuestion:(Tn,Xo,Gd)=>{let it=Tn.id,si=V.get(it),ii={...L?{mediaHandler:L}:{},...Hr?{answerSheetHandler:Hr}:{},...h?{initialAnswers:mt.get(it)??[],readOnly:!0}:si?{initialAnswers:si}:{},...ee!==null?{readOnly:!0}:{}},ci=Object.keys(ii).length>0&&xd(Xo)?yd(Xo,ii):Xo,Yd=Qt.has(it),li=ri.has(it)?te("p",{role:"alert",className:"mt-2 flex items-center gap-1.5 text-sm font-medium text-[#a32b1e]",children:[D(Ug,{size:14,className:"flex-shrink-0"}),y("requiredMissing")]}):null,Jo=ni.get(it),di=Jo?.explanation?D(sd,{content:Jo.explanation,nodeResults:Jo.nodeResults,label:y("explanation")}):null,pi=Vo[it],ui=ee&&x&&pi&&!pi.awaiting?D(ld,{questionId:it,onReport:x,t:y}):null;if(!ai)return te("div",{"data-question-id":it,children:[ci,li,di,ui]},it);let Kr=Vo[it],Qd=Cd(Tn);return te("div",{"data-question-id":it,children:[te("div",{className:"flex items-center gap-2.5 mb-3",children:[te("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:[y("question",{index:Gd+1}),Yd&&D(Sd,{label:y("required")})]}),D(Qg,{hidden:Pn,score:Kr?{s:Kr.score,m:Kr.maxScore,awaiting:Kr.awaiting,outcome:Kr.outcome}:null,weight:Qd,unit:K,t:y})]}),ci,li,di,ui]},it)},renderSeparator:Tn=>D("div",{className:"border-t border-[#e7e5e0] my-1"},`qsep-${Tn}`)}):fe;return te("div",{"data-exercise-id":q.id,className:"bg-white rounded-[14px] border border-[#e7e5e0] shadow-sm overflow-hidden",children:[te("div",{className:"flex items-center justify-between px-4 py-2.5 bg-[#f1efe9] border-b border-[#e7e5e0]",style:T?{backgroundColor:T}:void 0,children:[te("span",{dir:"auto",className:"min-w-0 text-sm font-bold text-[#1d2025] [overflow-wrap:anywhere]",children:[Ct(y,q.title,Ce),!ai&&q.questions[0]&&Qt.has(q.questions[0].id)&&D(Sd,{label:y("required")})]}),Pn?null:st?.awaiting?te("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:[D(qr,{size:11}),y("pendingReview")]}):st?te("span",{className:"font-bold leading-none tabular-nums",style:{fontFamily:'var(--font-hand, "Caveat", cursive)',fontSize:"1.15rem",color:st.maxScore>0&&st.score>=st.maxScore?"#1f8a4c":st.maxScore>0&&st.score>0?"#c8810e":st.maxScore>0?"#d23b2b":"#8d93a0"},children:[Bt(st.score)," / ",Bt(st.maxScore)]}):xt>0?te("span",{className:"text-xs font-semibold text-[#8d93a0] tabular-nums",children:["/ ",Bt(xt)," ",K(xt)]}):null]}),D("div",{className:"p-4",children:Vd})]},q.id)},[y,K,oi,Vo,T,L,Hr,x,h,mt,V,ni,Pn,Qt,ri,ee]),Wd=$e(()=>Es(e).length>0,[e]),Yo=yt(q=>te("div",{className:"flex items-center gap-3 py-2",children:[D("div",{className:"flex-1 border-t border-dashed border-[#e7e5e0]"}),D("span",{className:"text-[10px] font-bold text-[#8d93a0] uppercase tracking-widest",children:Ct(y,e.exercises[q+1]?.title,q+1)}),D("div",{className:"flex-1 border-t border-dashed border-[#e7e5e0]"})]},`sep-${q}`),[y,e]),Qo=M?D("p",{className:"pt-2 pb-1 text-center text-xs text-[#8d93a0] select-none",children:y("poweredBy")}):null,tt=ee!==null,Xt=n||ee?.isForm===!0,An=ee?.showVerdict!==!1,Nn=An?ee?.passed?"#1f8a4c":"#d23b2b":"#1d2025";return D(In,{initial:Z,onChange:We,children:D("div",{className:"edpire-scope",style:{display:"contents"},children:te("div",{ref:Y,dir:F,className:Me("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)]",A?"h-full":"min-h-dvh"),style:N?{fontFamily:N}:void 0,children:[D(Xl,{visible:re&&!hr&&!Xt,hasAiNodes:Dd,text:y("evaluating"),aiText:y("aiEvaluating"),contained:A,..._}),hr&&te("div",{className:Me("fixed inset-0 z-50 flex flex-col items-center justify-center gap-3 bg-red-950/80 backdrop-blur-sm",A&&"absolute"),children:[D(qr,{size:40,className:"text-red-300"}),D("p",{className:"text-xl font-black text-white tracking-tight",children:y("timeUp.title")}),D("p",{className:"text-sm text-red-200",children:y("timeUp.submitting")})]}),te("div",{ref:$,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:T?{backgroundColor:T}:void 0,children:[te("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[D("img",{src:s?.logoUrl??E??Gg,alt:s?.name??"Edpire",width:24,height:24,loading:"lazy",className:"flex-none rounded object-contain"}),te("div",{className:"min-w-0",children:[D("h1",{dir:"auto",title:t.title,className:"line-clamp-2 text-sm font-bold leading-snug text-[#1d2025] [overflow-wrap:anywhere]",children:t.title}),D("p",{className:"text-[11px] text-[#8d93a0]",children:Ko>0&&!Pn&&te("span",{className:"ms-2 font-semibold text-[#565b66]",children:["/ ",Bt(Ko)," ",K(Ko)]})})]}),!tt&&He!==null&&i&&i>0&&c&&D(Xg,{timeLimitMinutes:i,startedAt:c,onExpire:Kd}),!tt&&(d==="saving"||d==="saved")&&te("span",{role:"status",className:"hidden sm:inline-flex items-center gap-1 text-[11px] font-medium text-[#8d93a0]",children:[d==="saved"?D(Kg,{size:12}):D(js,{size:12,className:"animate-spin"}),y(d==="saved"?"answersSaved":"answersSaving")]})]}),te("div",{className:"flex flex-none items-center gap-2",children:[g&&te("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:[D(qg,{size:13}),y("reset")]}),(!tt||h)&&w&&te("button",{onClick:w,className:"flex items-center gap-1.5 px-3 py-2 text-sm font-medium text-[#565b66] hover:text-[#1d2025] hover:bg-[#f1efe9] rounded-lg transition-colors",children:[D(Hs,{size:13}),P??y("back")]}),C&&D("button",{onClick:C,className:"p-1.5 text-[#8d93a0] hover:text-[#1d2025] hover:bg-[#f1efe9] rounded-lg transition-colors",children:D(Hs,{size:15})}),!tt&&!h&&Js.length>0&&te("button",{type:"button",onClick:()=>Zs(!0),disabled:re,"aria-haspopup":"dialog",className:"flex flex-shrink-0 items-center gap-1.5 px-3 py-2 text-sm font-semibold text-[#1d2025] border border-[#d6d3cc] bg-white rounded-lg hover:bg-[#f1efe9] transition-colors disabled:opacity-50",children:[D(Vg,{size:14}),D("span",{className:"sm:hidden",children:y("copyButtonShort")}),D("span",{className:"hidden sm:inline",children:y("copyButton")})]}),!tt&&D("button",{onClick:Hd,disabled:re,style:G?{backgroundColor:G}: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:re?te(Ks,{children:[D(js,{size:14,className:"animate-spin"}),y(Xt?"formSending":"submitting")]}):te(Ks,{children:[D(vd,{size:14}),D("span",{className:"sm:hidden",children:y(Xt?"formSubmit":"confirmSubmit")}),D("span",{className:"hidden sm:inline",children:y(Xt?"formSubmit":"submit")})]})})]})]}),jt&&D("div",{className:"flex-shrink-0 bg-[#fdeeec] border-b border-[#f6cfc9] px-4 py-2 text-sm text-[#a32b1e]",children:jt}),!tt&&d==="failed"&&te("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:[D(Wg,{size:15,className:"flex-shrink-0"}),y("answersNotSaved")]}),!tt&&he&&(V.size>0||z!==null)&&te("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:[z!==null&&D(qr,{size:15,className:"flex-shrink-0 text-[#565b66]"}),te("span",{className:"flex-1 min-w-0",children:[V.size>0?y("resumeRestored"):y("resumeFresh"),z!==null&&te(Ks,{children:[" ",y("resumeTimeLeft",{minutes:z})]})]}),D("button",{type:"button",onClick:()=>be(!1),"aria-label":y("close"),className:"flex-shrink-0 p-1 rounded-md text-[#8d93a0] hover:text-[#1d2025] hover:bg-[#e7e5e0] transition-colors",children:D(Hs,{size:14})})]}),tt&&ee?.isForm?D(dd,{t:y,rtl:Os(a),showClose:!A,onContinue:m&&ee.returnUrl?Cn:void 0,continueLabel:b,primaryColor:G}):tt&&ee&&(ee.awaitingManualGrading?D("div",{className:"flex-shrink-0 border-b bg-[#fbf1dc] border-[#f2e2bf]",children:D("div",{className:"mx-auto px-4 py-3 sm:px-6 sm:py-4",style:{maxWidth:O},children:te("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2 sm:gap-4",children:[te("div",{className:"flex items-center gap-2",children:[D(qr,{size:20,className:"text-[#c8810e] flex-shrink-0"}),D("span",{className:"text-sm font-semibold text-[#8a5a08]",children:ee.aiPending?y("beingMarked"):y("awaitingReview")})]}),D("div",{className:"hidden sm:block w-px h-8 bg-[#f2e2bf]"}),D("p",{className:"text-sm text-[#8a5a08] flex-1 min-w-0",children:ee.aiPending?y("beingMarkedDesc"):y("awaitingReviewDesc")}),m&&te("button",{onClick:Cn,style:G?{backgroundColor:G}: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:[D(qs,{size:14}),b??y("viewFullReport")]})]})})}):ee.scoreHidden?D("div",{className:"flex-shrink-0 border-b bg-[#f5f4f1] border-[#e7e5e0]",children:D("div",{className:"mx-auto px-4 py-3 sm:px-6 sm:py-4",style:{maxWidth:O},children:te("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2 sm:gap-4",children:[te("div",{className:"flex items-center gap-2",children:[D(wd,{size:20,className:"text-[#1d2025] flex-shrink-0"}),D("span",{className:"text-sm font-semibold text-[#1d2025]",children:y("submittedNoScore")})]}),D("div",{className:"hidden sm:block w-px h-8 bg-[#e7e5e0]"}),D("p",{className:"text-sm text-[#565b66] flex-1 min-w-0",children:y("submittedNoScoreDesc")}),m&&te("button",{onClick:Cn,style:G?{backgroundColor:G}: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:[D(qs,{size:14}),b??y("viewFullReport")]})]})})}):D("div",{className:Me("flex-shrink-0 border-b",An?ee.passed?"bg-[#ecf8f0] border-[#c5e8d1]":"bg-[#fdeeec] border-[#f6cfc9]":"bg-[#f5f4f1] border-[#e7e5e0]"),children:D("div",{className:"mx-auto px-4 py-3 sm:px-6 sm:py-4",style:{maxWidth:O},children:te("div",{className:"flex flex-wrap sm:flex-nowrap items-center gap-x-4 gap-y-2",children:[te("div",{className:"flex items-center gap-2",children:[An?ee.passed?D(wd,{size:20,className:"text-[#1f8a4c] flex-shrink-0"}):D(jg,{size:20,className:"text-[#d23b2b] flex-shrink-0"}):null,D("span",{className:"text-sm font-semibold",style:{color:Nn},children:An?ee.passed?y("assessmentPassed"):y("assessmentNotPassed"):y("yourScore")})]}),D("div",{className:"hidden sm:block w-px h-8 bg-[#e7e5e0]"}),te("div",{className:"flex items-baseline gap-1.5",children:[te("span",{className:"leading-none tabular-nums text-[1.6rem] sm:text-[2rem]",style:{fontFamily:'var(--font-hand, "Caveat", cursive)',color:Nn},children:[Bt(ee.totalScore)," / ",Bt(ee.maxScore)]}),D("span",{className:"text-sm text-[#8d93a0] font-medium",children:K(ee.maxScore)})]}),te("div",{className:"flex-1 flex items-center gap-3 min-w-[140px]",children:[D("div",{className:"flex-1 h-2 bg-[#e7e5e0] rounded-full overflow-hidden min-w-[80px]",children:D("div",{className:"h-full rounded-full transition-all duration-700",style:{width:`${ee.percentage}%`,backgroundColor:Nn}})}),te("span",{className:"text-sm font-bold tabular-nums flex-shrink-0",style:{color:Nn},children:[ee.percentage,"%"]})]}),m&&te("button",{onClick:Cn,style:G?{backgroundColor:G}: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:[D(qs,{size:14}),b??y("viewFullReport")]})]})})})),D("div",{className:Me("flex-1 flex flex-col",A&&"overflow-hidden",hr&&"pointer-events-none opacity-60",ee?.isForm&&"hidden"),children:e.annex||Wd?D(rd,{assessment:e,isSubmitted:tt,setAnswers:xe,validationFeedback:Wo,renderExercise:Go,renderSeparator:Yo,primaryColor:G,contained:A,locale:a,contentMaxWidth:O,t:y,footer:Qo}):B?D(od,{assessment:e,isSubmitted:tt,setAnswers:xe,validationFeedback:Wo,renderExercise:Go,renderSeparator:Yo,primaryColor:G,contained:A,locale:a,contentMaxWidth:O,t:y,onAddAnnex:B,footer:Qo}):D("div",{className:Me("flex-1",A&&"overflow-y-auto"),children:te("div",{className:"mx-auto p-6 flex flex-col gap-4",style:{maxWidth:O},children:[D(Vt,{assessment:e,onAnswersChange:tt?void 0:xe,validationFeedback:Wo,renderExercise:Go,renderSeparator:Yo,locale:a}),Qo]})})}),jd&&Hr&&!tt&&D(_s,{locale:a,handler:Hr,questions:Js.map(q=>({nodeId:q.nodeId,label:q.label})),isEmpty:fr.isEmpty,place:fr.place,onPlaced:q=>{let fe=qo.find(Ce=>Ce.nodeId===q[0]);fe&&Rn(fe.questionId)},onClose:()=>Zs(!1)}),ie&&D("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",children:te("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:[D("h3",{id:"edpire-submit-confirm-title",className:"text-base font-bold text-[#1d2025] mb-2",children:y(Xt?"formConfirmTitle":"confirmTitle")}),Ur>0&&te("div",{className:"text-sm text-[#8a5a08] bg-[#fbf1dc] border border-[#f2e2bf] rounded-lg px-3 py-2 mb-3",children:[te("p",{className:"flex items-start gap-2 font-semibold",children:[D(Hg,{size:15,className:"flex-shrink-0 mt-px"}),D("span",{children:Ur===1?y("unansweredOne"):y("unansweredMany",{count:Ur})})]}),te("ul",{className:"mt-1 ps-[23px] flex flex-col gap-0.5",children:[ei.slice(0,Us).map(q=>D("li",{children:D("button",{type:"button",onClick:()=>Rn(q.questionId),className:"text-start underline underline-offset-2 hover:text-[#1d2025] cursor-pointer",children:q.only?Ct(y,q.exerciseTitle,q.exerciseIndex):`${Ct(y,q.exerciseTitle,q.exerciseIndex)} \xB7 ${y("question",{index:q.questionIndex+1})}`})},q.questionId)),Ur>Us&&D("li",{children:y("unansweredMore",{count:Ur-Us})})]})]}),D("p",{className:"text-sm text-[#565b66] mb-5",children:y(Xt?"formConfirmDescription":"confirmDescription")}),te("div",{className:"flex gap-3 justify-end",children:[D("button",{onClick:()=>Pe(!1),className:"px-4 py-2 text-sm font-medium text-[#565b66] hover:bg-[#f1efe9] rounded-lg transition-colors",children:y("confirmCancel")}),te("button",{onClick:Ud,disabled:re,style:G?{backgroundColor:G}: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:[re?D(js,{size:14,className:"animate-spin"}):D(vd,{size:14}),y(Xt?"formSubmit":"confirmSubmit")]})]})]})})]})})})}function jo(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 Jg(e,t){return new Promise((r,n)=>{if(t.aborted)return n(new Error("aborted"));let o=setTimeout(r,e);t.addEventListener("abort",()=>{clearTimeout(o),n(new Error("aborted"))},{once:!0})})}function Zg(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)})}async function eb(e){return(await fetch(e)).blob()}var At=e=>new Error(e);function Ws(e,t){let r=e instanceof Error?e.message:typeof e=="string"?e:"";return t===429||/\blimit\b/.test(r)?r.includes("ai_busy")?"busy":"limit":t===503||r.includes("ai_busy")||r==="busy"?"busy":r==="unreadable"?"unreadable":r==="cut"?"cut":e instanceof TypeError||r==="network"?"network":"failed"}async function tb(e,t,r){if(!e.ok||!e.body){let p=await e.json().catch(()=>({}));throw At(Ws(p.error??"",e.status))}let n=e.body.getReader(),o=new TextDecoder,a=[],s="",i=null,c=p=>{if(!p.trim())return;let d;try{d=JSON.parse(p)}catch{return}d.type==="line"?(a.push(d.line),t?.(d.line)):d.type==="end"&&(i=d)};try{for(;;){let{done:p,value:d}=await n.read();if(p)break;s+=o.decode(d,{stream:!0});let u=s.indexOf(`
85
- `);for(;u!==-1;)c(s.slice(0,u)),s=s.slice(u+1),u=s.indexOf(`
86
- `)}c(s+o.decode())}catch{throw r.aborted?new Error("aborted"):At(a.length?"cut":"network")}if(r.aborted)throw new Error("aborted");let l=i;if(!l)throw At(a.length?"cut":"network");switch(l.outcome){case"success":return{lines:a};case"turn":return{lines:[],turns:l.turns??[]};case"unreadable":throw At("unreadable");case"cut":throw At("cut");case"busy":throw At("busy");default:throw At("failed")}}function rb(e){let{signPhoto:t}=e,r=t?async(s,i)=>{let c=await t({mime:s.type||"image/jpeg",sizeBytes:s.size});if(!(await fetch(c.uploadUrl,{method:"PUT",headers:{"Content-Type":c.contentType},body:s,signal:i})).ok)throw new Error("upload_failed");return{url:c.url,mimeType:c.contentType}}:null,n={transcribePhotos:async({images:s,photos:i},c)=>{if(r&&s.length>0){let p=await Promise.all(s.map(async u=>r(await eb(u),c?.signal))),{content:d}=await e.readPhotos({images:[],photos:p,nodeId:c?.nodeId});return{content:d}}let{content:l}=await e.readPhotos({images:s,photos:i,nodeId:c?.nodeId});return{content:l}},recognizeHandwriting:async(s,i)=>e.readHandwriting(await Zg(s),i?.signal?{signal:i.signal}:void 0)};if(r){n.uploadPhoto=(i,c)=>r(i,c?.signal);let{streamPhotos:s}=e;n.readPages=async({photos:i,purpose:c,nodeId:l,upright:p},d)=>{let u=d?.signal??new AbortController().signal;if(s){let h;try{h=await s({photos:i,nodeId:l,purpose:c,...p?{upright:p}:{}},u)}catch(m){throw u.aborted?new Error("aborted"):At(Ws(m))}return tb(h,d?.onLine,u)}let f;try{f=await e.readPhotos({images:[],photos:i,nodeId:l,purpose:c})}catch(h){throw At(Ws(h))}if(u.aborted)throw new Error("aborted");if(!f.lines)throw At("failed");for(let h of f.lines)d?.onLine?.(h);return{lines:f.lines}}}let{startCapture:o,captureStatus:a}=e;return o&&a&&(n.startPhoneCapture=async({nodeId:s,signal:i})=>{let{captureId:c,url:l,qrImage:p}=await o(s),d=(async()=>{let u=Date.now()+12e5;for(;Date.now()<u;){await Jg(2500,i);let f=await a(c).catch(()=>null);if(i.aborted)throw new Error("aborted");if(f?.photos.length)return f.photos}throw new Error("expired")})();return d.catch(()=>{}),{url:l,qrImage:p,photos:d}}),n}function Nd(e,t){let r=`${e.replace(/\/$/,"")}/api/v1/embed/read`,n=(a,s)=>fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:t,...a}),signal:s}),o=async(a,s)=>{let i=await n(a,s),c=await i.json().catch(()=>({}));if(!i.ok)throw new Error(c.error??"failed");return c};return rb({streamPhotos:({photos:a,nodeId:s,purpose:i,upright:c},l)=>n({kind:"stream",photo_urls:a.map(p=>p.url),...s?{node_id:s}:{},...i==="copy"?{purpose:i}:{},...c?{upright:c}:{}},l),startCapture:async a=>{let s=await o({kind:"capture",...a?{node_id:a}:{}});return{captureId:s.capture_id,url:s.url,qrImage:s.qr_image}},captureStatus:async a=>{let s=await o({kind:"capture_status",capture_id:a});return s.photos?{photos:s.photos.map(i=>({url:i.url,mimeType:i.mime_type}))}:null},readPhotos:({photos:a,nodeId:s,purpose:i})=>o({kind:"photos",photo_urls:a.map(c=>c.url),...s?{node_id:s}:{},...i==="copy"?{purpose:i}:{}}),readHandwriting:(a,s)=>o({kind:"handwriting",image:a},s?.signal),signPhoto:async({mime:a,sizeBytes:s})=>{let i=await o({kind:"sign",mime:a,size_bytes:s});return{uploadUrl:i.upload_url,contentType:i.content_type,url:i.url}}})}import{jsx as ob}from"react/jsx-runtime";function Vs(e,t){let r=jo(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 Gs(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 Md({token:e,data:t,baseUrl:r,options:n}){let{locale:o,branding:a,returnUrl:s,reportLabel:i,backLabel:c,onBack:l,overlayConfig:p,layout:d,mediaHandler:u,answerSheetHandler:f,onComplete:h,onError:m}=n,b=_d(()=>Nd(r,e),[r,e]),w=a??t.branding??void 0,P=o??t.meta.language??"en",g=_d(()=>Gs(t.assessment),[t]),[R]=nb(()=>new Date().toISOString()),_=Td(async I=>{let C=await fetch(`${r}/api/v1/embed/submit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:e,answers:I})});if(!C.ok){let v=await C.json().catch(()=>({}));if(C.status===422&&v.code==="required_unanswered")throw new Error("required_unanswered");let S=typeof v.error=="string"?v.error:"Submission failed",x=C.status===401?"TOKEN_INVALID":C.status===409?"TOKEN_USED":C.status===404?"ASSESSMENT_NOT_FOUND":"UNKNOWN";throw m?.({code:x,message:S}),new Error(S)}let L=await C.json();return h?.(L),Vs(L,s)},[r,e,h,m,s]),A=Td(I=>{if(s)try{let C=new URL(s);C.searchParams.set("submission_id",I.submissionId),!I.awaitingManualGrading&&!I.scoreHidden&&(C.searchParams.set("score",String(I.totalScore)),C.searchParams.set("max_score",String(I.maxScore))),window.location.href=C.toString()}catch{window.location.href=s}},[s]);return ob(Bo,{assessment:g,meta:{title:t.meta.title,category:t.meta.category??null},locale:P,branding:w,scoreHidden:t.meta.score_hidden===!0,requiredQuestionIds:t.meta.required_question_ids,timeLimitMinutes:t.meta.settings.time_limit_minutes,startedAt:R,onSubmit:_,onViewReport:s?A:void 0,reportLabel:i,onBack:l,backLabel:c,overlayConfig:p,layout:d,mediaHandler:u,answerSheetHandler:f??b})}import{useMemo as Ed}from"react";import{jsx as sb}from"react/jsx-runtime";function ab(){return Promise.reject(new Error("A review cannot be submitted"))}function Ld({review:e,locale:t,branding:r,layout:n,onBack:o,backLabel:a}){let s=Ed(()=>Gs(e.assessment),[e]),i=Ed(()=>({answers:e.answers,result:Vs({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 sb(Bo,{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:ab,onBack:o,backLabel:a,layout:n})}import lb from"react";import{createRoot as db}from"react-dom/client";import ib,{useMemo as cb}from"react";import"katex/dist/katex.min.css";import{jsx as Ys}from"react/jsx-runtime";var Id=ib.memo(function({content:t,onAnswersChange:r,feedback:n,initialAnswers:o,readOnly:a,className:s,dir:i}){let c=cb(()=>{if(n)return new Map(Object.entries(n))},[n]),l=Ys(zr,{content:t,onAnswersChange:r,initialAnswers:o,validationFeedback:c,readOnly:a,className:s});return Ys("div",{className:"edpire-scope",style:{display:"contents"},children:i?Ys("div",{dir:i,children:l}):l})});function pb(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=db(c);function d(){p.render(lb.createElement(Id,l))}return d(),{setContent(u){l={...l,content:u,feedback:null},d()},setFeedback(u){l={...l,feedback:u},d()},setInitialAnswers(u){l={...l,initialAnswers:u},d()},unmount(){p.unmount()}}}function ub(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 mb(e){let t=zo(jo(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(m=>m.exercise_id===s.id)?.questions.find(m=>m.question_id===c.id),d=p?.node_results??[],u=0,f=0,h=!1;for(let m of d)u+=m.score??0,f+=m.max_score??0,m.status==="awaiting_review"&&(h=!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:u,maxScore:f,scoreHidden:n,status:h?"awaiting_review":n?hb(d.map(m=>m.status)):f===0?"unscored":u>=f?"correct":u>0?"partial":"incorrect",index:a++})}}return o}function hb(e){return e.length===0?"unscored":e.every(t=>t==="correct")?"correct":e.every(t=>t==="incorrect")?"incorrect":"partial"}function fb(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 gb="https://edpire.com";function zd(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 MS={mount(e){let{token:t,container:r,baseUrl:n=gb,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 d=await p.json().catch(()=>({})),u=typeof d.error=="string"?d.error:"Failed to load assessment",f=p.status===401?"TOKEN_INVALID":p.status===403?"ORIGIN_NOT_ALLOWED":p.status===404?"ASSESSMENT_NOT_FOUND":"UNKNOWN";o?.({code:f,message:u});let h=f==="ORIGIN_NOT_ALLOWED"?`Add ${typeof location<"u"?location.origin:"this origin"} to Allowed Embed Origins in Edpire, under Integrations then Origins.`:"";zd(a,u,h);return}l=await p.json()}catch{o?.({code:"NETWORK_ERROR",message:"Failed to connect to Edpire"}),zd(a,"Failed to connect to Edpire. Please try again.","");return}i||(a.innerHTML="",s=Fd(a),s.render($d.createElement(Md,{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=Fd(n);return o.render($d.createElement(Ld,r)),{unmount(){let a=o;o=null,setTimeout(()=>a?.unmount(),0)}}}};export{MS as EdpireAssessment,fb as buildSubmitPayload,ub as flattenAssessment,mb as flattenReview,pb as renderQuestion};
81
+ `;var ab=new Set(["choiceSet","inlineChoiceSet","blank","aiAnswerInput","matchingSet","openResponseNode","mathResponse","codingResponse"]),sb=new Set(["blankPool","inlinePool"]);function ib(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 cb(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(ab.has(o)){t+=1;return}if(sb.has(o))return}a!==void 0&&r(a)};return r(e),t}function Ys(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)ib(i)&&s.add(i.nodeId)}let n=[];return e.exercises.forEach((o,a)=>{o.questions.forEach((s,i)=>{let c=cb(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 Qs(e,t,r){let n=new Set(r);return n.size===0?[]:Ys(e,t).filter(o=>n.has(o.questionId))}function Js(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 _d(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 Xs(e){if(Array.isArray(e))return e.some(Xs);if(!e||typeof e!="object")return!1;let{text:t,content:r}=e;return typeof t=="string"||r!==void 0&&Xs(r)}function Td(e,t){if(e.type!=="openResponse"||!t.has(e.nodeId))return!1;let r=e.answer.text;return r!==void 0&&!Xs(r.content)}function Md(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=>Td(s,r))?{...o,answers:o.answers.map(s=>{let i=s;if(i.type!=="openResponse"||!Td(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 lb={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.",copyButton:"Photograph my copy",copyButtonShort:"My copy",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"},db={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.",copyButton:"Photographier ma copie",copyButtonShort:"Ma copie",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"},pb={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.",copyButton:"\u062A\u0635\u0648\u064A\u0631 \u0648\u0631\u0642\u062A\u064A",copyButtonShort:"\u0648\u0631\u0642\u062A\u064A",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"},Qr={en:lb,fr:db,ar:pb};function ub(e,t,r){let o=(Qr[e]??Qr.en)[t]??Qr.en[t]??t;return r?Object.entries(r).reduce((a,[s,i])=>a.replace(`{${s}}`,String(i)),o):o}function Ed(e,t){let r=new Intl.PluralRules(e).select(t),n=Qr[e]??Qr.en;return n[`points.${r}`]??n.points??Qr.en.points}function Ld(e){return(t,r)=>ub(e,t,r)}function Zs(e){return e==="ar"}function ei(e,t=[]){if(Array.isArray(e)){for(let n of e)ei(n,t);return t}if(!e||typeof e!="object")return t;let r=e;return typeof r.id=="string"&&(r.type==="aiAnswerInput"||r.type==="openResponseNode")&&r.attrs?.photo===!0&&t.push(r.id),ei(r.content,t)}function Id(e,t){let r=[];return e.exercises.forEach((n,o)=>{let a=n.questions.length===1;n.questions.forEach((s,i)=>{let c=ei(s.content.content);c.forEach((l,d)=>{let u=a?Et(t,n.title,o):`${Et(t,n.title,o)} \xB7 ${t("question",{index:i+1})}`;r.push({nodeId:l,questionId:s.id,label:c.length>1?`${u} ${String.fromCharCode(97+d)})`:u})})})}),r}var Wo=class{constructor(t){this.onChange=t;this.sheets=new Map;this.attach=(t,r)=>{let n=this.sheets.get(t)??new Set;return n.add(r),this.sheets.set(t,n),this.onChange(),()=>{n.delete(r),n.size===0&&this.sheets.delete(t),this.onChange()}};this.isEmpty=t=>{let r=this.sheets.get(t);return!r||[...r].every(n=>n.isEmpty())};this.place=(t,r,n,o)=>{for(let a of this.sheets.get(t)??[])a.placeLines(r,n,o)}}has(t){return this.sheets.has(t)}};var $d="48rem";function Rr(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))}Rr(`:root{--ink: #1d2025;--ink-soft: #565b66;--ink-faint: #8d93a0;--ui-muted: #f5f4f1;--line: #e7e5e0;--line-strong: #d6d3cc;--ok: #1f8a4c;--ok-soft: #ecf8f0;--pen: #d23b2b;--pen-soft: #fdeeec;--almost: #c8810e;--almost-ink: #8a5a08;--almost-soft: #fbf1dc;--font-hand: "Caveat", cursive}@keyframes answer-shake{10%,90%{transform:translate(-2px)}20%,80%{transform:translate(4px)}30%,50%,70%{transform:translate(-6px)}40%,60%{transform:translate(6px)}}@keyframes hop{0%,to{transform:translateY(0) scale(1)}40%{transform:translateY(-6%) scale(1.05)}}@keyframes wobble{0%,to{transform:translate(0)}15%,85%{transform:translate(-4px)}30%,70%{transform:translate(4px)}45%,55%{transform:translate(-2px)}}.animate-shake{animation:answer-shake .4s both}.animate-hop{animation:hop .5s ease-out}.animate-wobble{animation:wobble .5s ease}.cs-player__grid{display:grid;gap:calc(.75rem * var(--edp-scale, 1));grid-template-columns:repeat(1,minmax(0,1fr))}@media(min-width:40rem){:where(.cs-player:not(.cs-player--box)) .cs-player__grid--row{grid-template-columns:repeat(2,minmax(0,1fr))}}.cs-player--box{container-type:inline-size}@container (min-width: 35.5em){.cs-player--box .cs-player__grid--row{grid-template-columns:repeat(2,minmax(0,1fr))}}.player-choice{position:relative;display:inline-flex;align-items:center;gap:calc(.75rem * var(--edp-scale, 1));flex-wrap:wrap;width:100%;padding:calc(.75rem * var(--edp-scale, 1)) calc(1rem * var(--edp-scale, 1));border:1.5px solid var(--line, #e7e5e0);border-radius:calc(.75rem * var(--edp-scale, 1));background-color:#fff;color:var(--ink, #1d2025);cursor:pointer;user-select:none;transition:border-color .15s ease,background-color .15s ease,box-shadow .15s ease;font-weight:500;text-align:start}.player-choice:hover:not(:disabled){background-color:var(--ui-muted, #f5f4f1);border-color:var(--line-strong, #d6d3cc)}.player-choice:disabled{cursor:default}.player-choice>img{flex-shrink:0}.player-choice__mark{flex:none;display:grid;place-items:center;width:calc(20px * var(--edp-scale, 1));height:calc(20px * var(--edp-scale, 1));border:1.5px solid var(--ink-faint, #8d93a0);background:#fff;color:#fff;transition:border-color .15s,background .15s}.player-choice__mark--radio{border-radius:999px}.player-choice__mark--box{border-radius:calc(6px * var(--edp-scale, 1))}.player-choice__mark>svg{width:calc(13px * var(--edp-scale, 1));height:calc(13px * var(--edp-scale, 1));opacity:0}.player-choice__text{flex:1;min-width:0}.player-choice{height:100%}.player-choice__text img,.player-choice__text video,.player-choice__text iframe{max-height:calc(120px * var(--edp-scale, 1));width:auto;max-width:100%}.player-choice--tile{flex-direction:column;align-items:center;justify-content:center;text-align:center;gap:calc(.5rem * var(--edp-scale, 1));padding:calc(1rem * var(--edp-scale, 1)) calc(.75rem * var(--edp-scale, 1))}.player-choice--tile .player-choice__mark{position:absolute;top:calc(.5rem * var(--edp-scale, 1));inset-inline-start:calc(.5rem * var(--edp-scale, 1))}.player-choice--tile .player-choice__text{flex:0 1 auto;width:100%;text-align:center}.player-choice--tile .player-choice__text img,.player-choice--tile .player-choice__text video,.player-choice--tile .player-choice__text iframe{display:block!important;margin-inline:auto;margin-bottom:calc(.4rem * var(--edp-scale, 1))}.player-choice--selected{background-color:var(--ui-muted, #f5f4f1);border-color:var(--ink, #1d2025)}.player-choice--selected .player-choice__mark{border-color:var(--ink, #1d2025);background:var(--ink, #1d2025)}.player-choice--selected .player-choice__mark>svg{opacity:1}.player-choice--correct{background-color:var(--ok-soft, #ecf8f0);border-color:var(--ok, #1f8a4c)}.player-choice--correct .player-choice__mark{border-color:var(--ok, #1f8a4c);background:var(--ok, #1f8a4c)}.player-choice--correct .player-choice__mark>svg{opacity:1}.player-choice--correct-unchosen{background-color:#fff;border-color:var(--ok, #1f8a4c);border-style:dashed}.player-choice--correct-unchosen .player-choice__mark{border-color:var(--ok, #1f8a4c)}.player-choice--incorrect{background-color:var(--pen-soft, #fdeeec);border-color:var(--pen, #d23b2b)}.player-choice--incorrect .player-choice__mark{border-color:var(--pen, #d23b2b);background:var(--pen, #d23b2b)}.player-choice--incorrect .player-choice__mark>svg{opacity:1}.player-choice--muted{opacity:.55}.player-choice--partial{background-color:var(--ok-soft, #ecf8f0);border-color:var(--ok, #1f8a4c)}.player-choice--disabled{cursor:default}.player-choice__mark--letter{width:calc(1.625rem * var(--edp-scale, 1));height:calc(1.625rem * var(--edp-scale, 1));color:var(--ink, #1d2025);font-size:.8em;font-weight:700;line-height:1}.player-choice--selected .player-choice__mark--letter,.player-choice--correct .player-choice__mark--letter,.player-choice--incorrect .player-choice__mark--letter{color:#fff}.player-choice--correct-unchosen .player-choice__mark--letter{color:var(--ok, #1f8a4c)}.player-choice__verdict{flex:none;display:grid;place-items:center;margin-inline-start:auto}.player-choice__verdict>svg{width:calc(1.125rem * var(--edp-scale, 1));height:calc(1.125rem * var(--edp-scale, 1))}.player-choice__verdict--correct{color:var(--ok, #1f8a4c)}.player-choice__verdict--incorrect{color:var(--pen, #d23b2b)}.player-choice--tile .player-choice__verdict{position:absolute;top:calc(.5rem * var(--edp-scale, 1));inset-inline-end:calc(.5rem * var(--edp-scale, 1));margin:0}.player-inline-choice{display:inline-flex;align-items:center;gap:calc(.25rem * var(--edp-scale, 1));padding:.05em .55em;border:1.5px solid var(--line-strong, #d6d3cc);border-radius:999px;background:#fff;color:var(--ink, #1d2025);font-size:.9em;line-height:inherit;cursor:pointer;user-select:none;transition:border-color .15s,background .15s}.player-inline-choice:hover:not(:disabled){background:var(--ui-muted, #f5f4f1)}.player-inline-choice:disabled{cursor:default}.player-inline-choice--selected{border-color:var(--ink, #1d2025);background:var(--ui-muted, #f5f4f1)}.player-inline-choice--correct{border-color:var(--ok, #1f8a4c);background:var(--ok-soft, #ecf8f0)}.player-inline-choice--correct-unchosen{border-color:var(--ok, #1f8a4c);border-style:dashed}.player-inline-choice--incorrect{border-color:var(--pen, #d23b2b);background:var(--pen-soft, #fdeeec)}.player-inline-choice--muted{opacity:.55}.player-inline-choice:focus-visible{outline:2px solid var(--ink, #1d2025);outline-offset:2px}.player-blank-input{display:inline-block;min-width:3ch;padding:calc(.25rem * var(--edp-scale, 1)) calc(.5rem * var(--edp-scale, 1));border:none;border-bottom:2px solid var(--line-strong, #d6d3cc);background-color:transparent;font-size:inherit;font-family:inherit;transition:all .2s ease;outline:none}.player-blank-input:focus{border-bottom-color:var(--ink, #1d2025);background-color:var(--ui-muted, #f5f4f1)}.player-blank-input--correct{border-bottom-color:var(--ok, #1f8a4c);background-color:var(--ok-soft, #ecf8f0);color:var(--ok, #1f8a4c)}.player-blank-input--incorrect{border-bottom-color:var(--pen, #d23b2b);background-color:var(--pen-soft, #fdeeec);color:var(--pen, #d23b2b)}.player-blank-input:disabled{opacity:.7;cursor:not-allowed}.player-typed-blank{display:inline-block;min-width:7ch;max-width:100%;padding:0 calc(.25rem * var(--edp-scale, 1));font-weight:600;text-align:center;line-height:1.25;border:1px solid var(--line-strong, #d6d3cc);border-bottom-width:2px;border-radius:calc(2px * var(--edp-scale, 1));background:var(--ui-muted, #f5f4f1);color:var(--ink, #1d2025);outline:none;resize:none;overflow:hidden;vertical-align:middle}.player-typed-blank::placeholder{color:var(--ink-faint, #8d93a0);font-weight:500}.player-typed-blank:focus{border-color:var(--ink, #1d2025)}.player-typed-blank--pending{border-color:var(--ink-faint, #8d93a0);background:var(--card, #ffffff)}.player-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;unicode-bidi:plaintext;text-align:start}.edp-sheet-box.is-reading .edp-sheet-doc{min-height:0}.edp-sheet-box.is-reading.is-empty .edp-sheet-doc{display:none}.edp-sheet-skeleton{display:flex;flex-direction:column;gap:calc(.875rem * var(--edp-scale, 1));padding-block:calc(.625rem * var(--edp-scale, 1))}.edp-sheet-skeleton-line{display:block;height:calc(.75rem * var(--edp-scale, 1));width:88%;border-radius:999px;background:var(--paper-deep, #f4f1ea);animation:edp-sheet-skeleton 1.6s ease-in-out infinite}.edp-sheet-skeleton-line:nth-child(2){width:72%;animation-delay:.15s}.edp-sheet-skeleton-line:nth-child(3){width:56%;animation-delay:.3s}@keyframes edp-sheet-skeleton{0%,to{opacity:1}50%{opacity:.45}}.edp-sheet-arrive{animation:edp-sheet-arrive .28s cubic-bezier(.2,.8,.2,1) both}@keyframes edp-sheet-arrive{0%{opacity:0;transform:translateY(calc(.375rem * var(--edp-scale, 1)))}to{opacity:1;transform:none}}@media(prefers-reduced-motion:reduce){.edp-sheet-skeleton-line{animation:none}.edp-sheet-arrive{animation:edp-sheet-arrive-fade .15s ease-out both}}@keyframes edp-sheet-arrive-fade{0%{opacity:0}to{opacity:1}}.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-maths{display:inline-flex;flex-wrap:nowrap;gap:calc(.25rem * var(--edp-scale, 1));min-width:0;max-width:100%;overflow-x:auto;overscroll-behavior-x:contain;scrollbar-width:none}.edp-sheet-keys-maths::-webkit-scrollbar{display:none}.edp-sheet-keys-maths>.edp-sheet-key{flex:none}.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--readonly .edp-sheet-body,.edp-sheet-pages-box{container-type:inline-size}.edp-sheet-grid.has-pages{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:calc(.75rem * var(--edp-scale, 1));align-items:start}.edp-sheet-pages{margin:0;min-width:0}.edp-sheet-thumb{position:relative;display:block;width:calc(3.5rem * var(--edp-scale, 1));height:calc(4.5rem * var(--edp-scale, 1));padding:0;overflow:hidden;border:1px solid var(--line-strong, #d6d3cc);border-radius:calc(.5rem * var(--edp-scale, 1));background:var(--card, #ffffff);cursor:zoom-in;transition:border-color .18s ease}.edp-sheet-thumb img{display:block;width:100%;height:100%;object-fit:cover}.edp-sheet-thumb:hover{border-color:var(--ink, #1d2025)}.edp-sheet-thumb-more{position:absolute;inset-inline-end:calc(.25rem * var(--edp-scale, 1));inset-block-end:calc(.25rem * var(--edp-scale, 1));min-width:calc(1.5rem * var(--edp-scale, 1));padding:0 calc(.3rem * var(--edp-scale, 1));border-radius:999px;background:#111317d1;color:#fff;font-size:calc(.75rem * var(--edp-scale, 1));font-weight:600;line-height:calc(1.25rem * var(--edp-scale, 1));text-align:center;font-variant-numeric:tabular-nums}.edp-sheet-pages-beside{display:none;margin:0}@container (min-width: 40rem){.edp-sheet-grid.has-pages--beside{grid-template-columns:minmax(0,1fr) minmax(15rem,42%)}.edp-sheet-grid.has-pages--beside .edp-sheet-pages{position:sticky;top:calc(var(--edp-bar, 0px) + .75rem)}.edp-sheet-pages--beside .edp-sheet-thumb{display:none}.edp-sheet-pages--beside .edp-sheet-pages-beside{display:block}.edp-sheet-pages--beside .edp-sheet-pages-view img{max-height:min(78vh,46rem)}}.edp-sheet-pages-head{display:flex;align-items:center;gap:calc(.5rem * var(--edp-scale, 1));margin-bottom:calc(.375rem * var(--edp-scale, 1))}.edp-sheet-pages-nav{display:inline-flex;align-items:center;gap:calc(.25rem * var(--edp-scale, 1));margin-inline-start:auto}.edp-sheet-pages-count{min-width:calc(2.75rem * var(--edp-scale, 1));text-align:center;font-size:calc(.8125rem * var(--edp-scale, 1));font-variant-numeric:tabular-nums;color:var(--ink-soft, #5b6170)}.edp-sheet-pages-arrow{display:inline-grid;place-items:center;width:calc(2rem * var(--edp-scale, 1));height:calc(2rem * 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:background-color .18s ease}.edp-sheet-pages-arrow:hover:not(:disabled){background:var(--paper-deep, #f4f1ea)}.edp-sheet-pages-arrow:disabled{opacity:.4;cursor:default}.edp-sheet-pages-arrow:dir(rtl) svg{transform:scaleX(-1)}.edp-sheet-thumb:focus-visible,.edp-sheet-pages-arrow:focus-visible,.edp-sheet-pages-view:focus-visible{outline:2px solid var(--ink, #1d2025);outline-offset:2px}.edp-sheet-pages-view{display:block;width:100%;padding:0;border:none;background:none;cursor:zoom-in}.edp-sheet-pages-view img{transition:border-color .18s ease}.edp-sheet-pages-view:hover img{border-color:var(--ink-soft, #5b6170)}.edp-sheet-pages-view img,.edp-sheet-pages-print img{display:block;width:100%;max-height:calc(26rem * var(--edp-scale, 1));object-fit:contain;border:1px solid var(--line, #e8e5de);border-radius:calc(.5rem * var(--edp-scale, 1));background:var(--card, #ffffff)}.edp-sheet-pages-print{display:none}@media print{.edp-sheet-thumb,.edp-sheet-pages-beside{display:none!important}.edp-sheet-grid.has-pages{grid-template-columns:minmax(0,1fr)!important}.edp-sheet-pages-print{display:grid;gap:.5rem;margin-top:.5rem}.edp-sheet-pages{position:static!important}.edp-sheet-pages-print img{max-height:22rem;break-inside:avoid}}.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);position:relative}.edp-sheet-drop{position:absolute;inset:0;z-index:2;display:flex;align-items:center;justify-content:center;border:2px dashed var(--ink, #1d2025);border-radius:inherit;background:color-mix(in srgb,var(--paper, #fbfaf7) 92%,transparent);font-size:calc(.9375rem * var(--edp-scale, 1));font-weight:500;color:var(--ink, #1d2025);pointer-events:none}.edp-sheet-drop-hint{margin:calc(.5rem * var(--edp-scale, 1)) 0 0;font-size:calc(.8125rem * var(--edp-scale, 1));color:var(--ink-soft, #5b6170)}.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{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{background:var(--paper-deep, #f4f1ea);color:var(--ink, #1d2025)}.edp-sheet-btn:focus-visible,.edp-sheet-panel-close: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(--ink, #1d2025);font-weight:500;font-size:calc(.9375rem * var(--edp-scale, 1))}.edp-sheet-btn--end{margin-inline-start:auto}.edp-sheet-shots{display:flex;flex-wrap:wrap;gap:calc(.75rem * var(--edp-scale, 1));margin:0 0 calc(.75rem * var(--edp-scale, 1));padding:calc(.5rem * var(--edp-scale, 1)) 0 0;list-style:none}.edp-sheet-shot{display:flex;flex-direction:column;align-items:center;gap:calc(.375rem * var(--edp-scale, 1))}.edp-sheet-shot-tools{display:flex;gap:calc(.375rem * var(--edp-scale, 1))}.edp-sheet-shot-view,.edp-sheet-photo-view{position:relative;display:block;padding:0;border:none;background:none;cursor:zoom-in}.edp-sheet-shot-view img{display:block;width:calc(5rem * var(--edp-scale, 1));height:calc(6.5rem * var(--edp-scale, 1));object-fit:cover;border-radius:calc(.375rem * var(--edp-scale, 1));border:1px solid var(--line, #e8e5de);background:var(--card, #ffffff)}.edp-sheet-shot[data-state=sending] img{opacity:.55}.edp-sheet-shot[data-state=failed] img{border:2px dashed var(--ink, #1d2025)}.edp-sheet-shot-view .player-ai-spinner{position:absolute;inset:0;margin:auto}.edp-sheet-shot-tool{display:grid;place-items:center;width:calc(2rem * var(--edp-scale, 1));height:calc(2rem * var(--edp-scale, 1));padding:0;border-radius:999px;border:1px solid var(--line-strong, #d6d3cc);background:var(--card, #ffffff);color:var(--ink, #1d2025);cursor:pointer;transition:background-color .18s ease}.edp-sheet-shot-tool:hover:not(:disabled){background:var(--paper-deep, #f4f1ea)}.edp-sheet-shot-tool:disabled{opacity:.45;cursor:default}.edp-sheet-shot-view:focus-visible,.edp-sheet-photo-view:focus-visible,.edp-sheet-shot-tool:focus-visible{outline:2px solid var(--ink, #1d2025);outline-offset:2px}.edp-sheet-hint{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(--paper-deep, #f4f1ea);border-radius:calc(.5rem * var(--edp-scale, 1))}.edp-sheet-progress .edp-sheet-btn--end{flex:none}.edp-sheet-viewer{position:fixed;inset:0;z-index:1000;display:grid;place-items:center;padding:calc(1rem * var(--edp-scale, 1));grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr);background:#111317e0;touch-action:pan-y pinch-zoom}.edp-sheet-viewer--pages{grid-template-rows:auto minmax(0,1fr) auto;gap:calc(.75rem * var(--edp-scale, 1));padding-inline:calc(4rem * var(--edp-scale, 1))}.edp-sheet-viewer-stage{display:flex;align-items:center;justify-content:center;width:100%;height:100%;min-height:0;overflow:hidden}.edp-sheet-viewer img{max-width:100%;max-height:100%;object-fit:contain;border-radius:calc(.375rem * var(--edp-scale, 1));cursor:default;user-select:none}.edp-sheet-viewer-count{justify-self:start;color:#ffffffdb;font-size:calc(.875rem * var(--edp-scale, 1));font-variant-numeric:tabular-nums}.edp-sheet-viewer-nav{position:absolute;top:50%;display:grid;place-items:center;width:calc(2.75rem * var(--edp-scale, 1));height:calc(2.75rem * var(--edp-scale, 1));margin-top:calc(-1.375rem * var(--edp-scale, 1));padding:0;border:none;border-radius:999px;background:#ffffffeb;color:var(--ink, #1d2025);cursor:pointer;transition:background-color .18s ease,opacity .18s ease}.edp-sheet-viewer-nav--prev{inset-inline-start:calc(.75rem * var(--edp-scale, 1))}.edp-sheet-viewer-nav--next{inset-inline-end:calc(.75rem * var(--edp-scale, 1))}.edp-sheet-viewer-nav:dir(rtl) svg{transform:scaleX(-1)}.edp-sheet-viewer-nav:disabled{opacity:.35;cursor:default}.edp-sheet-viewer-nav:hover:not(:disabled){background:var(--paper-deep, #f4f1ea)}.edp-sheet-viewer-strip{display:flex;gap:calc(.5rem * var(--edp-scale, 1));max-width:100%;overflow-x:auto;padding:calc(.25rem * var(--edp-scale, 1));scrollbar-width:thin}.edp-sheet-viewer-thumb{flex:none;width:calc(3rem * var(--edp-scale, 1));height:calc(4rem * var(--edp-scale, 1));padding:0;overflow:hidden;border:2px solid transparent;border-radius:calc(.375rem * var(--edp-scale, 1));background:#ffffff1a;opacity:.6;cursor:pointer;transition:opacity .18s ease,border-color .18s ease}.edp-sheet-viewer-thumb img{width:100%;height:100%;object-fit:cover;border-radius:0;cursor:pointer}.edp-sheet-viewer-thumb:hover{opacity:.85}.edp-sheet-viewer-thumb.is-active{border-color:#fff;opacity:1}.edp-sheet-viewer-close{position:absolute;top:calc(.75rem * var(--edp-scale, 1));inset-inline-end:calc(.75rem * var(--edp-scale, 1));width:calc(2.75rem * var(--edp-scale, 1));height:calc(2.75rem * var(--edp-scale, 1));border:none;border-radius:999px;background:#ffffffeb;color:var(--ink, #1d2025);font-size:calc(1.5rem * var(--edp-scale, 1));line-height:1;cursor:pointer}.edp-sheet-viewer-close{transition:background-color .18s ease}.edp-sheet-viewer-close:hover{background:var(--paper-deep, #f4f1ea)}.edp-sheet-viewer-close:focus-visible,.edp-sheet-viewer-nav:focus-visible,.edp-sheet-viewer-thumb:focus-visible{outline:2px solid #ffffff;outline-offset:2px}@media(max-width:480px){.edp-sheet-viewer--pages{padding-inline:calc(.5rem * var(--edp-scale, 1))}.edp-sheet-viewer-nav{top:auto;bottom:calc(5.5rem * var(--edp-scale, 1));margin-top:0}}.edp-sheet-unsure{background-image:linear-gradient(var(--almost, #c8810e),var(--almost, #c8810e));background-repeat:no-repeat;background-position:0 100%;background-size:100% 2px;background-color:var(--almost-soft, #fbf1dc);-webkit-box-decoration-break:clone;box-decoration-break:clone}.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(.25rem * var(--edp-scale, 1));font-size:calc(1.6rem * var(--edp-scale, 1))}.edp-sheet-pad-latex{display:block;flex:0 1 auto;min-width:0;overflow-x:auto;transition:opacity .12s ease-out}.edp-sheet-pad-latex--stale{opacity:.4}.edp-sheet-pad-help{min-height:1.4em;margin:0 0 calc(.5rem * var(--edp-scale, 1));font-size:calc(.875rem * var(--edp-scale, 1));line-height:1.4;color:var(--ink-soft, #5b6170)}.edp-sheet-pad-retry{padding:.75rem .25rem;margin:-.75rem -.25rem;border:0;background:none;color:var(--ink, #1d2025);font:inherit;font-weight:500;text-decoration:underline;text-underline-offset:3px;cursor:pointer}.edp-sheet-pad-retry:hover{text-decoration-thickness:2px}.edp-sheet-pad-retry:focus-visible{outline:2px solid var(--ink, #1d2025);outline-offset:2px}@media(prefers-reduced-motion:reduce){.edp-sheet-pad-latex{transition:none}}.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}.edp-ink-help{margin:0 0 calc(.5rem * var(--edp-scale, 1));font-size:calc(.875rem * var(--edp-scale, 1));color:var(--ink-soft, #5b6170)}.edp-ink-tabs{display:flex;flex-wrap:wrap;gap:calc(.375rem * var(--edp-scale, 1));margin:0 0 calc(.5rem * var(--edp-scale, 1));padding:0;list-style:none}.edp-ink-tab{display:inline-flex;align-items:center;border:1px solid var(--line-strong, #d6d3cc);border-radius:calc(.5rem * var(--edp-scale, 1));background:var(--card, #ffffff)}.edp-ink-tab.is-current{border-color:var(--ink, #1d2025);background:var(--ink, #1d2025)}.edp-ink-tab.is-current .edp-ink-tab-go,.edp-ink-tab.is-current .edp-ink-tab-remove{color:var(--card, #ffffff)}.edp-ink-tab-go,.edp-ink-tab-remove{min-height:calc(2.5rem * var(--edp-scale, 1));border:none;background:transparent;color:var(--ink, #1d2025);cursor:pointer;touch-action:manipulation}.edp-ink-tab-go{padding-inline:calc(.75rem * var(--edp-scale, 1)) calc(.375rem * var(--edp-scale, 1));font-size:calc(.875rem * var(--edp-scale, 1));font-weight:500}.edp-ink-tab-remove{display:inline-flex;align-items:center;justify-content:center;width:calc(2.25rem * var(--edp-scale, 1));color:var(--ink-soft, #5b6170);border-start-end-radius:inherit;border-end-end-radius:inherit}.edp-ink-tab-go,.edp-ink-tab-remove{transition:background-color .18s ease,color .18s ease}.edp-ink-tab-go{border-start-start-radius:inherit;border-end-start-radius:inherit}.edp-ink-tab:not(.is-current) .edp-ink-tab-go:hover:not(:disabled),.edp-ink-tab-remove:hover{background:var(--paper-deep, #f4f1ea);color:var(--ink, #1d2025)}.edp-ink-tab.is-current .edp-ink-tab-remove:hover{background:#ffffff29;color:var(--card, #ffffff)}.edp-ink-mouse-hint{margin:calc(.5rem * var(--edp-scale, 1)) 0;font-size:calc(.8125rem * var(--edp-scale, 1));color:var(--ink-soft, #5b6170)}.edp-ink-removed,.edp-copy-leave{margin:0 0 calc(.5rem * var(--edp-scale, 1));font-size:calc(.875rem * var(--edp-scale, 1));color:var(--ink, #1d2025)}@media(pointer:coarse){.edp-sheet-pages-arrow{width:calc(2.5rem * var(--edp-scale, 1));height:calc(2.5rem * var(--edp-scale, 1))}}@media(prefers-reduced-motion:reduce){.edp-ink-tab-go,.edp-ink-tab-remove,.edp-sheet-viewer-close,.edp-sheet-viewer-nav,.edp-sheet-viewer-thumb,.edp-sheet-thumb,.edp-sheet-pages-arrow{transition:none}}.edp-ink-tab-go:focus-visible,.edp-ink-tab-remove:focus-visible{outline:2px solid var(--ink, #1d2025);outline-offset:2px}.edp-ink-page{display:block;width:100%;height:calc(288px * var(--edp-scale, 1));margin-bottom:calc(.5rem * var(--edp-scale, 1));background:#fff;border:1px solid var(--line-strong, #d6d3cc);border-radius:calc(.25rem * var(--edp-scale, 1));box-shadow:0 1px 2px #1d20250f;touch-action:none;cursor:crosshair}.edp-ink-page.is-busy{pointer-events:none;opacity:.7}@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-shot-tool{width:calc(2.5rem * var(--edp-scale, 1));height:calc(2.5rem * var(--edp-scale, 1))}.edp-sheet-shot-view img{width:calc(6rem * var(--edp-scale, 1));height:calc(8rem * var(--edp-scale, 1))}.edp-sheet-btn--end{margin-inline-start:0}.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-shot-tool{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-maths{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}}.edp-copy{position:fixed;inset:0;z-index:900;display:flex;align-items:center;justify-content:center;padding:1rem;background:#11131773}.edp-copy-sheet{display:flex;flex-direction:column;width:100%;max-width:40rem;max-height:100%;background:var(--card, #ffffff);border-radius:.875rem;box-shadow:0 12px 40px #1113172e;overflow:hidden}.edp-copy-head{display:flex;align-items:center;justify-content:space-between;gap:.5rem;padding-block:.625rem;padding-inline:1rem .75rem;border-bottom:1px solid var(--line, #e8e5de)}.edp-copy-head h2{margin:0;font-size:1rem;font-weight:700;color:var(--ink, #1d2025);outline:none}.edp-copy-body{flex:1 1 auto;min-height:0;overflow-y:auto;padding:.75rem 1rem 1rem;overscroll-behavior:contain}.edp-sheet-panel--bare{margin:0;padding:0;border:none;background:transparent}.edp-copy-help{margin:.75rem 0 .5rem;font-size:.875rem;line-height:1.5;color:var(--ink-soft, #5b6170)}.edp-copy-question{margin-top:1rem}.edp-copy-question h3{margin:0 0 .375rem;font-size:.8125rem;font-weight:700;color:var(--ink, #1d2025)}.edp-copy-question--loose h3{color:var(--almost-ink, #8a5a08)}.edp-copy-parts{display:flex;flex-direction:column;gap:.5rem;margin:0;padding:0;list-style:none}.edp-copy-part{padding:.625rem .75rem;border:1px solid var(--line, #e8e5de);border-radius:.625rem;background:var(--paper, #fbfaf7)}.edp-copy-question--loose .edp-copy-part{border-color:var(--almost, #c8810e);background:var(--almost-soft, #fbf1dc)}.edp-copy-part-text{font-size:.9375rem;line-height:1.6;color:var(--ink, #1d2025);overflow-wrap:anywhere}.edp-copy-part-text p{margin:0}.edp-copy-part-text .katex-display{margin:.25rem 0;overflow-x:auto;overflow-y:hidden}.edp-copy-move{display:flex;align-items:center;gap:.5rem;margin-top:.5rem;font-size:.8125rem;color:var(--ink-soft, #5b6170)}.edp-copy-move select{min-width:0;max-width:100%;flex:1 1 auto;min-height:2.25rem;padding-inline:.5rem;font-size:.875rem;color:var(--ink, #1d2025);background:var(--card, #ffffff);border:1px solid var(--line-strong, #d6d3cc);border-radius:.5rem}.edp-copy-keep{display:flex;flex-wrap:wrap;align-items:center;gap:.25rem .875rem;margin-bottom:.5rem;padding:.5rem .75rem;border-radius:.5rem;background:var(--paper-deep, #f4f1ea);font-size:.8125rem;color:var(--ink, #1d2025)}.edp-copy-keep>span{flex-basis:100%;color:var(--ink-soft, #5b6170)}.edp-copy-keep-option{display:inline-flex;align-items:center;gap:.375rem;min-height:2rem;cursor:pointer}.edp-copy-foot{padding:.75rem 1rem;border-top:1px solid var(--line, #e8e5de);background:var(--card, #ffffff)}.edp-copy-foot .edp-sheet-hint{margin:0 0 .5rem}@media(pointer:coarse){.edp-copy-move select,.edp-copy-keep-option{min-height:2.5rem}}@media(max-width:640px){.edp-copy{padding:0}.edp-copy-sheet{max-width:none;height:100%;border-radius:0}}
82
+ `);import"katex/dist/katex.min.css";Rr(`.edpire-annex-layout{display:flex;flex:1;min-width:0;height:100%;overflow:hidden;position:relative}.edpire-annex-main{flex:1;min-width:0;overflow:hidden;display:flex;flex-direction:column}.edpire-annex-panel{width:38%;min-width:calc(280px * var(--edp-scale, 1));max-width:calc(480px * var(--edp-scale, 1));flex-shrink:0;display:flex;flex-direction:column;border-right:1px solid #e5e7eb;background:#fff;overflow:hidden}.edpire-annex-panel__header{flex-shrink:0;padding:calc(12px * var(--edp-scale, 1)) calc(20px * var(--edp-scale, 1));border-bottom:1px solid #f3f4f6;background:#f9fafb}.edpire-annex-panel__header-label{font-size:calc(11px * var(--edp-scale, 1));font-weight:700;text-transform:uppercase;letter-spacing:.08em;color:#6b7280}.edpire-annex-panel__scroll{flex:1;overflow-y:auto;padding:calc(24px * var(--edp-scale, 1)) calc(20px * var(--edp-scale, 1));display:flex;flex-direction:column;gap:calc(32px * var(--edp-scale, 1))}.edpire-annex-tab,.edpire-annex-drawer,.edpire-annex-backdrop{display:none}@media(max-width:1023px){.edpire-annex-panel{display:none}.edpire-annex-tab{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:calc(8px * var(--edp-scale, 1));position:fixed;left:0;top:50%;transform:translateY(-50%);z-index:40;background:var(--edpire-annex-tab-bg, #2563eb);color:var(--edpire-annex-tab-color, #ffffff);border:none;border-radius:0 calc(10px * var(--edp-scale, 1)) calc(10px * var(--edp-scale, 1)) 0;padding:calc(18px * var(--edp-scale, 1)) calc(10px * var(--edp-scale, 1));cursor:pointer;box-shadow:2px 2px 16px #0000002e;transition:filter .15s}.edpire-annex-tab:hover{filter:brightness(.88)}.edpire-annex-tab__label{writing-mode:vertical-rl;text-orientation:mixed;transform:rotate(180deg);font-size:calc(11px * var(--edp-scale, 1));font-weight:700;letter-spacing:.07em;text-transform:uppercase;white-space:nowrap}.edpire-annex-drawer{display:flex;flex-direction:column;position:fixed;left:0;top:0;bottom:0;width:min(84vw,calc(440px * var(--edp-scale, 1)));background:#fff;z-index:50;transform:translate(-100%);transition:transform .28s cubic-bezier(.4,0,.2,1);box-shadow:4px 0 32px #00000021;overflow:hidden}.edpire-annex-drawer--open{transform:translate(0)}.edpire-annex-drawer__header{display:flex;align-items:center;justify-content:space-between;padding:calc(16px * var(--edp-scale, 1)) calc(20px * var(--edp-scale, 1));border-bottom:1px solid #f3f4f6;background:#f9fafb;flex-shrink:0}.edpire-annex-drawer__label{font-size:calc(13px * var(--edp-scale, 1));font-weight:700;color:#111827}.edpire-annex-drawer__close{display:flex;align-items:center;justify-content:center;width:calc(28px * var(--edp-scale, 1));height:calc(28px * var(--edp-scale, 1));background:none;border:none;cursor:pointer;font-size:calc(20px * var(--edp-scale, 1));line-height:1;color:#9ca3af;border-radius:calc(6px * var(--edp-scale, 1));transition:color .15s,background .15s}.edpire-annex-drawer__close:hover{color:#111827;background:#f3f4f6}.edpire-annex-drawer__scroll{flex:1;overflow-y:auto;padding:calc(24px * var(--edp-scale, 1)) calc(20px * var(--edp-scale, 1));display:flex;flex-direction:column;gap:calc(32px * var(--edp-scale, 1))}.edpire-annex-backdrop{display:block;position:fixed;inset:0;background:#00000061;z-index:45;cursor:pointer}}
83
+ `);Rr(`/*! tailwindcss v4.2.0 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){.edpire-scope *,.edpire-scope :before,.edpire-scope :after,.edpire-scope ::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial;--tw-content:""}}}@layer theme{.edpire-scope{--font-sans:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-red-200:oklch(88.5% .062 18.334);--color-red-300:oklch(80.8% .114 19.571);--color-red-950:oklch(25.8% .092 26.042);--color-amber-50:oklch(98.7% .022 95.277);--color-amber-200:oklch(92.4% .12 95.746);--color-amber-900:oklch(41.4% .112 45.904);--color-blue-600:oklch(54.6% .245 262.881);--color-rose-500:oklch(64.5% .246 16.439);--color-slate-500:oklch(55.4% .046 257.417);--color-slate-800:oklch(27.9% .041 260.031);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-800:oklch(27.8% .033 256.848);--color-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 ai,jsx as D,jsxs as te}from"react/jsx-runtime";var xb="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 wb(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 Ud(e){let t=e;return typeof t.totalMaxScore=="number"?t.totalMaxScore:(t.answerKeys??[]).reduce((r,n)=>r+(n.scoring?.maxScore??0),0)}function Bd(e){return e.questions.reduce((t,r)=>t+Ud(r),0)}function Kt(e){return Number.isInteger(e)?String(e):parseFloat(e.toFixed(2)).toString()}var oi=5;function jd({label:e}){return D("span",{className:"ms-0.5 text-[#d23b2b]",title:e,"aria-label":e,children:"*"})}function Kd(e){return e==="full"?"#1f8a4c":e==="partial"?"#c8810e":"#d23b2b"}function qd({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 D("svg",{width:14,height:14,viewBox:"0 0 100 100",fill:"none",stroke:Kd(e),strokeWidth:9,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:D("path",{d:t})})}function kb({score:e,weight:t,unit:r,t:n,hidden:o=!1}){if(e){if(e.awaiting)return te("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:[D(Xr,{size:11}),n("pendingReview")]});let a=o?e.outcome:e.m>0&&e.s>=e.m?"full":e.s>0?"partial":"none";return o?D("span",{className:"inline-flex items-center rounded-lg border border-[#e7e5e0] bg-[#f5f4f1] px-2 py-1",children:D(qd,{outcome:a})}):te("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:[D(qd,{outcome:a}),te("span",{className:"font-bold leading-none",style:{fontFamily:'var(--font-hand, "Caveat", cursive)',fontSize:"1.05rem",color:Kd(a)},children:[Kt(e.s)," / ",Kt(e.m)]})]})}return t>0&&!o?te("span",{className:"text-xs font-semibold tabular-nums text-[#8d93a0]",children:[Kt(t)," ",r(t)]}):null}function Hd(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 Sb({timeLimitMinutes:e,startedAt:t,onExpire:r}){let n=e*6e4,o=new Date(t).getTime()+n,[a,s]=ot(()=>Math.max(o-Date.now(),0)),i=nr(r);i.current=r,Vo(()=>{if(a<=0){i.current();return}let m=setInterval(()=>{let b=Math.max(o-Date.now(),0);s(b),b<=0&&(clearInterval(m),i.current())},1e3);return()=>clearInterval(m)},[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),u=Math.floor(d/3600),p=Math.floor(d%3600/60),f=d%60,h=u>0?`${u}:${String(p).padStart(2,"0")}:${String(f).padStart(2,"0")}`:`${p}:${String(f).padStart(2,"0")}`;return te("span",{className:$e("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:[D(Xr,{size:12}),h]})}function Go({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:u,resumed:p=!1,onSubmit:f,review:h,onViewReport:m,reportLabel:b,onBack:y,backLabel:x,allowReset:A,onReset:g,overlayConfig:T,contained:C=!1,layout:E,onClose:R,mediaHandler:M,answerSheetHandler:k,wholeCopy:S=!1,onReportGrade:v,onAddAnnex:O,fallbackLogoUrl:_}){let w=De(()=>Ld(a),[a]),X=St(H=>Ed(a,H),[a]),Y=Zs(a)?"rtl":"ltr",F=nr(null),L=nr(null);Vo(()=>{let H=L.current,ye=F.current;if(!H||!ye||typeof ResizeObserver>"u")return;let Ne=()=>ye.style.setProperty("--edp-bar",`${H.offsetHeight}px`);Ne();let Ct=new ResizeObserver(Ne);return Ct.observe(H),()=>Ct.disconnect()},[]);let B=E?.maxWidth??$d,J=s?.branding?.primaryColor,N=s?.branding?.accentColor,P=s?.branding?.fontFamily,K=s?.branding?.fontUrl,U=s?.branding?.showPoweredBy!==!1;Vo(()=>{if(!K||typeof document>"u"||document.querySelector(`link[href="${K}"]`))return;let ye=document.createElement("link");ye.rel="stylesheet",ye.href=K,document.head.appendChild(ye)},[K]);let[j,de]=ot(()=>h?.answers??l??{exerciseAnswers:[]}),[z]=ot(()=>h?new Map:Js(l)),W=De(()=>_d(e),[e]),le=nr(d);le.current=d;let[I]=ot(()=>(h?h.answers:l)?.mediaPlays),G=nr(I),re=St(H=>G.current&&Object.keys(G.current).length>0?{...H,mediaPlays:G.current}:H,[]),ne=nr(j);ne.current=j;let ie=nr(!1),ve=St(H=>{let ye=re(Md(H,z,W));de(ye),le.current?.(ye)},[z,W,re]),Ye=St(H=>{if(G.current=H,h||ie.current)return;let ye=re(ne.current);de(ye),le.current?.(ye)},[h,re]),[Qe,ee]=ot(null);Vo(()=>{ee(Date.now())},[]);let[fe,xe]=ot(p&&!h),ke=De(()=>{if(Qe===null||!i||i<=0||!c)return null;let H=new Date(c).getTime()+i*6e4-Qe;return H>0?Math.max(1,Math.floor(H/6e4)):null},[Qe,i,c]),[Ae,Wt]=ot(!1),[Rt,Pt]=ot(!1),[se,$]=ot(h?.result??null);ie.current=se!==null;let pe=De(()=>Js(h?.answers),[h]),[ue,ce]=ot(null),[Te,je]=ot(!1),lt=nr(!1),Vt=De(()=>wb(e),[e]),[rp,np]=ot(0),Pr=De(()=>new Wo(()=>np(H=>H+1)),[]),Jr=De(()=>{if(!k)return;let H=k.attachSheet;return{...k,attachSheet:(ye,Ne)=>{let Ct=Pr.attach(ye,Ne),dt=H?.(ye,Ne);return()=>{Ct(),dt?.()}}}},[k,Pr]),Qo=De(()=>Id(e,w),[e,w]),di=De(()=>S&&Ft(k)?Qo.filter(H=>Pr.has(H.nodeId)):[],[S,k,Qo,Pr,rp]),[op,pi]=ot(!1),ui=De(()=>Rt?Ys(e,j):[],[Rt,e,j]),Zr=ui.length,Ln=St(H=>{Pt(!1);let ye=F.current?.querySelectorAll(`[data-question-id="${CSS.escape(H)}"]`),Ne=Array.from(ye??[]).find(Ct=>Ct.getClientRects().length>0);Ne&&requestAnimationFrame(()=>Ne.scrollIntoView({block:"start",behavior:"smooth"}))},[]),Xo=(o??[]).join(" "),or=De(()=>new Set(Xo?Xo.split(" "):[]),[Xo]),[mi,ap]=ot(!1),Jo=De(()=>mi?Qs(e,j,or).map(H=>H.questionId).join(" "):"",[mi,e,j,or]),hi=De(()=>new Set(Jo?Jo.split(" "):[]),[Jo]),sp=St(()=>{let H=Qs(e,j,or);if(H.length===0){Pt(!0);return}ap(!0),Ln(H[0].questionId)},[e,j,or,Ln]),Zo=De(()=>e.exercises.reduce((H,ye)=>H+Bd(ye),0),[e]),ea=De(()=>se?Ko(se.exerciseFeedback):void 0,[se]),fi=De(()=>{let H=new Map;for(let ye of se?.exerciseFeedback??[])for(let Ne of ye.questions)Ne.explanation&&H.set(Ne.questionId,Ne);return H},[se]),In=r||se?.scoreHidden===!0,gi=De(()=>{if(!se)return{};let H={};for(let ye of se.exerciseFeedback)H[ye.exerciseId]=Hd(ye.questions.flatMap(Ne=>Ne.nodeResults));return H},[se]),ta=De(()=>{if(!se)return{};let H={};for(let ye of se.exerciseFeedback)for(let Ne of ye.questions)Ne.nodeResults.length>0&&(H[Ne.questionId]=Hd(Ne.nodeResults));return H},[se]),ip=St(async()=>{Wt(!0),ce(null);try{let H=await f(j);$(H),typeof window<"u"&&window.scrollTo({top:0,behavior:"smooth"})}catch(H){ce(H instanceof Error?H.message==="required_unanswered"?w("requiredBlocked"):H.message:w("confirmCancel"))}finally{Wt(!1),Pt(!1)}},[j,f,w]),$n=St(()=>{!se||!m||m(se)},[se,m]),cp=St(()=>{lt.current||Ae||se||(lt.current=!0,je(!0),Pt(!1),typeof document<"u"&&document.activeElement?.blur(),setTimeout(()=>{Wt(!0),ce(null),f(j).then(H=>{$(H),typeof window<"u"&&window.scrollTo({top:0,behavior:"smooth"})}).catch(H=>{ce(H instanceof Error?H.message:"submit_error")}).finally(()=>{Wt(!1),je(!1)})},800))},[j,Ae,f,se]),ra=St((H,ye,Ne)=>{let Ct=Bd(H),dt=gi[H.id],bi=H.questions.length>1,dp=Fd(ye)?zd(ye,{renderQuestion:(Dn,aa,pp)=>{let pt=Dn.id,yi=z.get(pt),vi={...M?{mediaHandler:M}:{},...Jr?{answerSheetHandler:Jr}:{},...h?{initialAnswers:pe.get(pt)??[],readOnly:!0}:yi?{initialAnswers:yi}:{},...se!==null?{readOnly:!0}:{}},xi=Object.keys(vi).length>0&&Fd(aa)?zd(aa,vi):aa,up=or.has(pt),wi=hi.has(pt)?te("p",{role:"alert",className:"mt-2 flex items-center gap-1.5 text-sm font-medium text-[#a32b1e]",children:[D(gb,{size:14,className:"flex-shrink-0"}),w("requiredMissing")]}):null,sa=fi.get(pt),ki=sa?.explanation?D(Rd,{content:sa.explanation,nodeResults:sa.nodeResults,label:w("explanation")}):null,Si=ta[pt],Ri=se&&v&&Si&&!Si.awaiting?D(Nd,{questionId:pt,onReport:v,t:w}):null;if(!bi)return te("div",{"data-question-id":pt,children:[xi,wi,ki,Ri]},pt);let en=ta[pt],mp=Ud(Dn);return te("div",{"data-question-id":pt,children:[te("div",{className:"flex items-center gap-2.5 mb-3",children:[te("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:[w("question",{index:pp+1}),up&&D(jd,{label:w("required")})]}),D(kb,{hidden:In,score:en?{s:en.score,m:en.maxScore,awaiting:en.awaiting,outcome:en.outcome}:null,weight:mp,unit:X,t:w})]}),xi,wi,ki,Ri]},pt)},renderSeparator:Dn=>D("div",{className:"border-t border-[#e7e5e0] my-1"},`qsep-${Dn}`)}):ye;return te("div",{"data-exercise-id":H.id,className:"bg-white rounded-[14px] border border-[#e7e5e0] shadow-sm overflow-hidden",children:[te("div",{className:"flex items-center justify-between px-4 py-2.5 bg-[#f1efe9] border-b border-[#e7e5e0]",style:N?{backgroundColor:N}:void 0,children:[te("span",{dir:"auto",className:"min-w-0 text-sm font-bold text-[#1d2025] [overflow-wrap:anywhere]",children:[Et(w,H.title,Ne),!bi&&H.questions[0]&&or.has(H.questions[0].id)&&D(jd,{label:w("required")})]}),In?null:dt?.awaiting?te("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:[D(Xr,{size:11}),w("pendingReview")]}):dt?te("span",{className:"font-bold leading-none tabular-nums",style:{fontFamily:'var(--font-hand, "Caveat", cursive)',fontSize:"1.15rem",color:dt.maxScore>0&&dt.score>=dt.maxScore?"#1f8a4c":dt.maxScore>0&&dt.score>0?"#c8810e":dt.maxScore>0?"#d23b2b":"#8d93a0"},children:[Kt(dt.score)," / ",Kt(dt.maxScore)]}):Ct>0?te("span",{className:"text-xs font-semibold text-[#8d93a0] tabular-nums",children:["/ ",Kt(Ct)," ",X(Ct)]}):null]}),D("div",{className:"p-4",children:dp})]},H.id)},[w,X,gi,ta,N,M,Jr,v,h,pe,z,fi,In,or,hi,se]),lp=De(()=>Ws(e).length>0,[e]),na=St(H=>te("div",{className:"flex items-center gap-3 py-2",children:[D("div",{className:"flex-1 border-t border-dashed border-[#e7e5e0]"}),D("span",{className:"text-[10px] font-bold text-[#8d93a0] uppercase tracking-widest",children:Et(w,e.exercises[H+1]?.title,H+1)}),D("div",{className:"flex-1 border-t border-dashed border-[#e7e5e0]"})]},`sep-${H}`),[w,e]),oa=U?D("p",{className:"pt-2 pb-1 text-center text-xs text-[#8d93a0] select-none",children:w("poweredBy")}):null,at=se!==null,ar=n||se?.isForm===!0,zn=se?.showVerdict!==!1,Fn=zn?se?.passed?"#1f8a4c":"#d23b2b":"#1d2025";return D(Hn,{initial:I,onChange:Ye,children:D("div",{className:"edpire-scope",style:{display:"contents"},children:te("div",{ref:F,dir:Y,className:$e("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)]",C?"h-full":"min-h-dvh"),style:P?{fontFamily:P}:void 0,children:[D(fd,{visible:Ae&&!Te&&!ar,hasAiNodes:Vt,text:w("evaluating"),aiText:w("aiEvaluating"),contained:C,...T}),Te&&te("div",{className:$e("fixed inset-0 z-50 flex flex-col items-center justify-center gap-3 bg-red-950/80 backdrop-blur-sm",C&&"absolute"),children:[D(Xr,{size:40,className:"text-red-300"}),D("p",{className:"text-xl font-black text-white tracking-tight",children:w("timeUp.title")}),D("p",{className:"text-sm text-red-200",children:w("timeUp.submitting")})]}),te("div",{ref:L,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:N?{backgroundColor:N}:void 0,children:[te("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[D("img",{src:s?.logoUrl??_??xb,alt:s?.name??"Edpire",width:24,height:24,loading:"lazy",className:"flex-none rounded object-contain"}),te("div",{className:"min-w-0",children:[D("h1",{dir:"auto",title:t.title,className:"line-clamp-2 text-sm font-bold leading-snug text-[#1d2025] [overflow-wrap:anywhere]",children:t.title}),D("p",{className:"text-[11px] text-[#8d93a0]",children:Zo>0&&!In&&te("span",{className:"ms-2 font-semibold text-[#565b66]",children:["/ ",Kt(Zo)," ",X(Zo)]})})]}),!at&&Qe!==null&&i&&i>0&&c&&D(Sb,{timeLimitMinutes:i,startedAt:c,onExpire:cp}),!at&&(u==="saving"||u==="saved")&&te("span",{role:"status",className:"hidden sm:inline-flex items-center gap-1 text-[11px] font-medium text-[#8d93a0]",children:[u==="saved"?D(bb,{size:12}):D(ti,{size:12,className:"animate-spin"}),w(u==="saved"?"answersSaved":"answersSaving")]})]}),te("div",{className:"flex flex-none items-center gap-2",children:[A&&te("button",{onClick:g,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:[D(hb,{size:13}),w("reset")]}),(!at||h)&&y&&te("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:[D(ni,{size:13}),x??w("back")]}),R&&D("button",{onClick:R,className:"p-1.5 text-[#8d93a0] hover:text-[#1d2025] hover:bg-[#f1efe9] rounded-lg transition-colors",children:D(ni,{size:15})}),!at&&!h&&di.length>0&&te("button",{type:"button",onClick:()=>pi(!0),disabled:Ae,"aria-haspopup":"dialog",className:"flex flex-shrink-0 items-center gap-1.5 px-3 py-2 text-sm font-semibold text-[#1d2025] border border-[#d6d3cc] bg-white rounded-lg hover:bg-[#f1efe9] transition-colors disabled:opacity-50",children:[D(vb,{size:14}),D("span",{className:"sm:hidden",children:w("copyButtonShort")}),D("span",{className:"hidden sm:inline",children:w("copyButton")})]}),!at&&D("button",{onClick:sp,disabled:Ae,style:J?{backgroundColor:J}: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:Ae?te(ai,{children:[D(ti,{size:14,className:"animate-spin"}),w(ar?"formSending":"submitting")]}):te(ai,{children:[D(Dd,{size:14}),D("span",{className:"sm:hidden",children:w(ar?"formSubmit":"confirmSubmit")}),D("span",{className:"hidden sm:inline",children:w(ar?"formSubmit":"submit")})]})})]})]}),ue&&D("div",{className:"flex-shrink-0 bg-[#fdeeec] border-b border-[#f6cfc9] px-4 py-2 text-sm text-[#a32b1e]",children:ue}),!at&&u==="failed"&&te("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:[D(yb,{size:15,className:"flex-shrink-0"}),w("answersNotSaved")]}),!at&&fe&&(z.size>0||ke!==null)&&te("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:[ke!==null&&D(Xr,{size:15,className:"flex-shrink-0 text-[#565b66]"}),te("span",{className:"flex-1 min-w-0",children:[z.size>0?w("resumeRestored"):w("resumeFresh"),ke!==null&&te(ai,{children:[" ",w("resumeTimeLeft",{minutes:ke})]})]}),D("button",{type:"button",onClick:()=>xe(!1),"aria-label":w("close"),className:"flex-shrink-0 p-1 rounded-md text-[#8d93a0] hover:text-[#1d2025] hover:bg-[#e7e5e0] transition-colors",children:D(ni,{size:14})})]}),at&&se?.isForm?D(Ad,{t:w,rtl:Zs(a),showClose:!C,onContinue:m&&se.returnUrl?$n:void 0,continueLabel:b,primaryColor:J}):at&&se&&(se.awaitingManualGrading?D("div",{className:"flex-shrink-0 border-b bg-[#fbf1dc] border-[#f2e2bf]",children:D("div",{className:"mx-auto px-4 py-3 sm:px-6 sm:py-4",style:{maxWidth:B},children:te("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2 sm:gap-4",children:[te("div",{className:"flex items-center gap-2",children:[D(Xr,{size:20,className:"text-[#c8810e] flex-shrink-0"}),D("span",{className:"text-sm font-semibold text-[#8a5a08]",children:se.aiPending?w("beingMarked"):w("awaitingReview")})]}),D("div",{className:"hidden sm:block w-px h-8 bg-[#f2e2bf]"}),D("p",{className:"text-sm text-[#8a5a08] flex-1 min-w-0",children:se.aiPending?w("beingMarkedDesc"):w("awaitingReviewDesc")}),m&&te("button",{onClick:$n,style:J?{backgroundColor:J}: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:[D(ri,{size:14}),b??w("viewFullReport")]})]})})}):se.scoreHidden?D("div",{className:"flex-shrink-0 border-b bg-[#f5f4f1] border-[#e7e5e0]",children:D("div",{className:"mx-auto px-4 py-3 sm:px-6 sm:py-4",style:{maxWidth:B},children:te("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2 sm:gap-4",children:[te("div",{className:"flex items-center gap-2",children:[D(Od,{size:20,className:"text-[#1d2025] flex-shrink-0"}),D("span",{className:"text-sm font-semibold text-[#1d2025]",children:w("submittedNoScore")})]}),D("div",{className:"hidden sm:block w-px h-8 bg-[#e7e5e0]"}),D("p",{className:"text-sm text-[#565b66] flex-1 min-w-0",children:w("submittedNoScoreDesc")}),m&&te("button",{onClick:$n,style:J?{backgroundColor:J}: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:[D(ri,{size:14}),b??w("viewFullReport")]})]})})}):D("div",{className:$e("flex-shrink-0 border-b",zn?se.passed?"bg-[#ecf8f0] border-[#c5e8d1]":"bg-[#fdeeec] border-[#f6cfc9]":"bg-[#f5f4f1] border-[#e7e5e0]"),children:D("div",{className:"mx-auto px-4 py-3 sm:px-6 sm:py-4",style:{maxWidth:B},children:te("div",{className:"flex flex-wrap sm:flex-nowrap items-center gap-x-4 gap-y-2",children:[te("div",{className:"flex items-center gap-2",children:[zn?se.passed?D(Od,{size:20,className:"text-[#1f8a4c] flex-shrink-0"}):D(mb,{size:20,className:"text-[#d23b2b] flex-shrink-0"}):null,D("span",{className:"text-sm font-semibold",style:{color:Fn},children:zn?se.passed?w("assessmentPassed"):w("assessmentNotPassed"):w("yourScore")})]}),D("div",{className:"hidden sm:block w-px h-8 bg-[#e7e5e0]"}),te("div",{className:"flex items-baseline gap-1.5",children:[te("span",{className:"leading-none tabular-nums text-[1.6rem] sm:text-[2rem]",style:{fontFamily:'var(--font-hand, "Caveat", cursive)',color:Fn},children:[Kt(se.totalScore)," / ",Kt(se.maxScore)]}),D("span",{className:"text-sm text-[#8d93a0] font-medium",children:X(se.maxScore)})]}),te("div",{className:"flex-1 flex items-center gap-3 min-w-[140px]",children:[D("div",{className:"flex-1 h-2 bg-[#e7e5e0] rounded-full overflow-hidden min-w-[80px]",children:D("div",{className:"h-full rounded-full transition-all duration-700",style:{width:`${se.percentage}%`,backgroundColor:Fn}})}),te("span",{className:"text-sm font-bold tabular-nums flex-shrink-0",style:{color:Fn},children:[se.percentage,"%"]})]}),m&&te("button",{onClick:$n,style:J?{backgroundColor:J}: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:[D(ri,{size:14}),b??w("viewFullReport")]})]})})})),D("div",{className:$e("flex-1 flex flex-col",C&&"overflow-hidden",Te&&"pointer-events-none opacity-60",se?.isForm&&"hidden"),children:e.annex||lp?D(xd,{assessment:e,isSubmitted:at,setAnswers:ve,validationFeedback:ea,renderExercise:ra,renderSeparator:na,primaryColor:J,contained:C,locale:a,contentMaxWidth:B,t:w,footer:oa}):O?D(kd,{assessment:e,isSubmitted:at,setAnswers:ve,validationFeedback:ea,renderExercise:ra,renderSeparator:na,primaryColor:J,contained:C,locale:a,contentMaxWidth:B,t:w,onAddAnnex:O,footer:oa}):D("div",{className:$e("flex-1",C&&"overflow-y-auto"),children:te("div",{className:"mx-auto p-6 flex flex-col gap-4",style:{maxWidth:B},children:[D(tr,{assessment:e,onAnswersChange:at?void 0:ve,validationFeedback:ea,renderExercise:ra,renderSeparator:na,locale:a}),oa]})})}),op&&Jr&&!at&&D(Us,{locale:a,handler:Jr,questions:di.map(H=>({nodeId:H.nodeId,label:H.label})),isEmpty:Pr.isEmpty,place:Pr.place,onPlaced:H=>{let ye=Qo.find(Ne=>Ne.nodeId===H[0]);ye&&Ln(ye.questionId)},onClose:()=>pi(!1)}),Rt&&D("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",children:te("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:[D("h3",{id:"edpire-submit-confirm-title",className:"text-base font-bold text-[#1d2025] mb-2",children:w(ar?"formConfirmTitle":"confirmTitle")}),Zr>0&&te("div",{className:"text-sm text-[#8a5a08] bg-[#fbf1dc] border border-[#f2e2bf] rounded-lg px-3 py-2 mb-3",children:[te("p",{className:"flex items-start gap-2 font-semibold",children:[D(fb,{size:15,className:"flex-shrink-0 mt-px"}),D("span",{children:Zr===1?w("unansweredOne"):w("unansweredMany",{count:Zr})})]}),te("ul",{className:"mt-1 ps-[23px] flex flex-col gap-0.5",children:[ui.slice(0,oi).map(H=>D("li",{children:D("button",{type:"button",onClick:()=>Ln(H.questionId),className:"text-start underline underline-offset-2 hover:text-[#1d2025] cursor-pointer",children:H.only?Et(w,H.exerciseTitle,H.exerciseIndex):`${Et(w,H.exerciseTitle,H.exerciseIndex)} \xB7 ${w("question",{index:H.questionIndex+1})}`})},H.questionId)),Zr>oi&&D("li",{children:w("unansweredMore",{count:Zr-oi})})]})]}),D("p",{className:"text-sm text-[#565b66] mb-5",children:w(ar?"formConfirmDescription":"confirmDescription")}),te("div",{className:"flex gap-3 justify-end",children:[D("button",{onClick:()=>Pt(!1),className:"px-4 py-2 text-sm font-medium text-[#565b66] hover:bg-[#f1efe9] rounded-lg transition-colors",children:w("confirmCancel")}),te("button",{onClick:ip,disabled:Ae,style:J?{backgroundColor:J}: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:[Ae?D(ti,{size:14,className:"animate-spin"}):D(Dd,{size:14}),w(ar?"formSubmit":"confirmSubmit")]})]})]})})]})})})}function Yo(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 Rb(e,t){return new Promise((r,n)=>{if(t.aborted)return n(new Error("aborted"));let o=setTimeout(r,e);t.addEventListener("abort",()=>{clearTimeout(o),n(new Error("aborted"))},{once:!0})})}function Pb(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)})}async function Cb(e){return(await fetch(e)).blob()}var Lt=e=>new Error(e);function si(e,t){let r=e instanceof Error?e.message:typeof e=="string"?e:"";return t===429||/\blimit\b/.test(r)?r.includes("ai_busy")?"busy":"limit":t===503||r.includes("ai_busy")||r==="busy"?"busy":r==="unreadable"?"unreadable":r==="cut"?"cut":e instanceof TypeError||r==="network"?"network":"failed"}async function Nb(e,t,r){if(!e.ok||!e.body){let d=await e.json().catch(()=>({}));throw Lt(si(d.error??"",e.status))}let n=e.body.getReader(),o=new TextDecoder,a=[],s="",i=null,c=d=>{if(!d.trim())return;let u;try{u=JSON.parse(d)}catch{return}u.type==="line"?(a.push(u.line),t?.(u.line)):u.type==="end"&&(i=u)};try{for(;;){let{done:d,value:u}=await n.read();if(d)break;s+=o.decode(u,{stream:!0});let p=s.indexOf(`
85
+ `);for(;p!==-1;)c(s.slice(0,p)),s=s.slice(p+1),p=s.indexOf(`
86
+ `)}c(s+o.decode())}catch{throw r.aborted?new Error("aborted"):Lt(a.length?"cut":"network")}if(r.aborted)throw new Error("aborted");let l=i;if(!l)throw Lt(a.length?"cut":"network");switch(l.outcome){case"success":return{lines:a};case"turn":return{lines:[],turns:l.turns??[]};case"unreadable":throw Lt("unreadable");case"cut":throw Lt("cut");case"busy":throw Lt("busy");default:throw Lt("failed")}}function Ab(e){let{signPhoto:t}=e,r=t?async(s,i)=>{let c=await t({mime:s.type||"image/jpeg",sizeBytes:s.size});if(!(await fetch(c.uploadUrl,{method:"PUT",headers:{"Content-Type":c.contentType},body:s,signal:i})).ok)throw new Error("upload_failed");return{url:c.url,mimeType:c.contentType}}:null,n={transcribePhotos:async({images:s,photos:i},c)=>{if(r&&s.length>0){let d=await Promise.all(s.map(async p=>r(await Cb(p),c?.signal))),{content:u}=await e.readPhotos({images:[],photos:d,nodeId:c?.nodeId});return{content:u}}let{content:l}=await e.readPhotos({images:s,photos:i,nodeId:c?.nodeId});return{content:l}},recognizeHandwriting:async(s,i)=>e.readHandwriting(await Pb(s),i?.signal?{signal:i.signal}:void 0)};if(r){n.uploadPhoto=(i,c)=>r(i,c?.signal);let{streamPhotos:s}=e;n.readPages=async({photos:i,purpose:c,nodeId:l,upright:d},u)=>{let p=u?.signal??new AbortController().signal;if(s){let h;try{h=await s({photos:i,nodeId:l,purpose:c,...d?{upright:d}:{}},p)}catch(m){throw p.aborted?new Error("aborted"):Lt(si(m))}return Nb(h,u?.onLine,p)}let f;try{f=await e.readPhotos({images:[],photos:i,nodeId:l,purpose:c})}catch(h){throw Lt(si(h))}if(p.aborted)throw new Error("aborted");if(!f.lines)throw Lt("failed");for(let h of f.lines)u?.onLine?.(h);return{lines:f.lines}}}let{startCapture:o,captureStatus:a}=e;return o&&a&&(n.startPhoneCapture=async({nodeId:s,signal:i})=>{let{captureId:c,url:l,qrImage:d}=await o(s),u=(async()=>{let p=Date.now()+12e5;for(;Date.now()<p;){await Rb(2500,i);let f=await a(c).catch(()=>null);if(i.aborted)throw new Error("aborted");if(f?.photos.length)return f.photos}throw new Error("expired")})();return u.catch(()=>{}),{url:l,qrImage:d,photos:u}}),n}function Wd(e,t){let r=`${e.replace(/\/$/,"")}/api/v1/embed/read`,n=(a,s)=>fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:t,...a}),signal:s}),o=async(a,s)=>{let i=await n(a,s),c=await i.json().catch(()=>({}));if(!i.ok)throw new Error(c.error??"failed");return c};return Ab({streamPhotos:({photos:a,nodeId:s,purpose:i,upright:c},l)=>n({kind:"stream",photo_urls:a.map(d=>d.url),...s?{node_id:s}:{},...i==="copy"?{purpose:i}:{},...c?{upright:c}:{}},l),startCapture:async a=>{let s=await o({kind:"capture",...a?{node_id:a}:{}});return{captureId:s.capture_id,url:s.url,qrImage:s.qr_image}},captureStatus:async a=>{let s=await o({kind:"capture_status",capture_id:a});return s.photos?{photos:s.photos.map(i=>({url:i.url,mimeType:i.mime_type}))}:null},readPhotos:({photos:a,nodeId:s,purpose:i})=>o({kind:"photos",photo_urls:a.map(c=>c.url),...s?{node_id:s}:{},...i==="copy"?{purpose:i}:{}}),readHandwriting:(a,s)=>o({kind:"handwriting",image:a},s?.signal),signPhoto:async({mime:a,sizeBytes:s})=>{let i=await o({kind:"sign",mime:a,size_bytes:s});return{uploadUrl:i.upload_url,contentType:i.content_type,url:i.url}}})}import{jsx as _b}from"react/jsx-runtime";function ii(e,t){let r=Yo(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 ci(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 Yd({token:e,data:t,baseUrl:r,options:n}){let{locale:o,branding:a,returnUrl:s,reportLabel:i,backLabel:c,onBack:l,overlayConfig:d,layout:u,mediaHandler:p,answerSheetHandler:f,onComplete:h,onError:m}=n,b=Gd(()=>Wd(r,e),[r,e]),y=a??t.branding??void 0,x=o??t.meta.language??"en",A=Gd(()=>ci(t.assessment),[t]),[g]=Tb(()=>new Date().toISOString()),T=Vd(async E=>{let R=await fetch(`${r}/api/v1/embed/submit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:e,answers:E})});if(!R.ok){let k=await R.json().catch(()=>({}));if(R.status===422&&k.code==="required_unanswered")throw new Error("required_unanswered");let S=typeof k.error=="string"?k.error:"Submission failed",v=R.status===401?"TOKEN_INVALID":R.status===409?"TOKEN_USED":R.status===404?"ASSESSMENT_NOT_FOUND":"UNKNOWN";throw m?.({code:v,message:S}),new Error(S)}let M=await R.json();return h?.(M),ii(M,s)},[r,e,h,m,s]),C=Vd(E=>{if(s)try{let R=new URL(s);R.searchParams.set("submission_id",E.submissionId),!E.awaitingManualGrading&&!E.scoreHidden&&(R.searchParams.set("score",String(E.totalScore)),R.searchParams.set("max_score",String(E.maxScore))),window.location.href=R.toString()}catch{window.location.href=s}},[s]);return _b(Go,{assessment:A,meta:{title:t.meta.title,category:t.meta.category??null},locale:x,branding:y,scoreHidden:t.meta.score_hidden===!0,requiredQuestionIds:t.meta.required_question_ids,timeLimitMinutes:t.meta.settings.time_limit_minutes,startedAt:g,onSubmit:T,onViewReport:s?C:void 0,reportLabel:i,onBack:l,backLabel:c,overlayConfig:d,layout:u,mediaHandler:p,answerSheetHandler:f??b})}import{useMemo as Qd}from"react";import{jsx as Eb}from"react/jsx-runtime";function Mb(){return Promise.reject(new Error("A review cannot be submitted"))}function Xd({review:e,locale:t,branding:r,layout:n,onBack:o,backLabel:a}){let s=Qd(()=>ci(e.assessment),[e]),i=Qd(()=>({answers:e.answers,result:ii({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 Eb(Go,{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:Mb,onBack:o,backLabel:a,layout:n})}import $b from"react";import{createRoot as zb}from"react-dom/client";import Lb,{useMemo as Ib}from"react";import"katex/dist/katex.min.css";import{jsx as li}from"react/jsx-runtime";var Jd=Lb.memo(function({content:t,onAnswersChange:r,feedback:n,initialAnswers:o,readOnly:a,className:s,dir:i}){let c=Ib(()=>{if(n)return new Map(Object.entries(n))},[n]),l=li(Wr,{content:t,onAnswersChange:r,initialAnswers:o,validationFeedback:c,readOnly:a,className:s});return li("div",{className:"edpire-scope",style:{display:"contents"},children:i?li("div",{dir:i,children:l}):l})});function Fb(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=zb(c);function u(){d.render($b.createElement(Jd,l))}return u(),{setContent(p){l={...l,content:p,feedback:null},u()},setFeedback(p){l={...l,feedback:p},u()},setInitialAnswers(p){l={...l,initialAnswers:p},u()},unmount(){d.unmount()}}}function Db(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 Ob(e){let t=Ko(Yo(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(m=>m.exercise_id===s.id)?.questions.find(m=>m.question_id===c.id),u=d?.node_results??[],p=0,f=0,h=!1;for(let m of u)p+=m.score??0,f+=m.max_score??0,m.status==="awaiting_review"&&(h=!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:p,maxScore:f,scoreHidden:n,status:h?"awaiting_review":n?Bb(u.map(m=>m.status)):f===0?"unscored":p>=f?"correct":p>0?"partial":"incorrect",index:a++})}}return o}function Bb(e){return e.length===0?"unscored":e.every(t=>t==="correct")?"correct":e.every(t=>t==="incorrect")?"incorrect":"partial"}function jb(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 qb="https://edpire.com";function tp(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 lR={mount(e){let{token:t,container:r,baseUrl:n=qb,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 u=await d.json().catch(()=>({})),p=typeof u.error=="string"?u.error:"Failed to load assessment",f=d.status===401?"TOKEN_INVALID":d.status===403?"ORIGIN_NOT_ALLOWED":d.status===404?"ASSESSMENT_NOT_FOUND":"UNKNOWN";o?.({code:f,message:p});let h=f==="ORIGIN_NOT_ALLOWED"?`Add ${typeof location<"u"?location.origin:"this origin"} to Allowed Embed Origins in Edpire, under Integrations then Origins.`:"";tp(a,p,h);return}l=await d.json()}catch{o?.({code:"NETWORK_ERROR",message:"Failed to connect to Edpire"}),tp(a,"Failed to connect to Edpire. Please try again.","");return}i||(a.innerHTML="",s=ep(a),s.render(Zd.createElement(Yd,{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=ep(n);return o.render(Zd.createElement(Xd,r)),{unmount(){let a=o;o=null,setTimeout(()=>a?.unmount(),0)}}}};export{lR as EdpireAssessment,jb as buildSubmitPayload,Db as flattenAssessment,Ob as flattenReview,Fb as renderQuestion};