qti3-item-player-vue3 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -62,7 +62,7 @@
62
62
  `,$f=(e,t)=>{if(!t.icon&&!t.iconHtml)return;let i=e.innerHTML,s="";t.iconHtml?s=Lf(t.iconHtml):t.icon==="success"?(s=Lv,i=i.replace(/ style=".*?"/g,"")):t.icon==="error"?s=Mv:t.icon&&(s=Lf({question:"?",warning:"!",info:"i"}[t.icon])),i.trim()!==s.trim()&&Pt(e,s)},Nv=(e,t)=>{if(t.iconColor){e.style.color=t.iconColor,e.style.borderColor=t.iconColor;for(const i of[".swal2-success-line-tip",".swal2-success-line-long",".swal2-x-mark-line-left",".swal2-x-mark-line-right"])Sf(e,i,"background-color",t.iconColor);Sf(e,".swal2-success-ring","border-color",t.iconColor)}},Lf=e=>`<div class="${H["icon-content"]}">${e}</div>`,Rv=(e,t)=>{const i=vf();if(i){if(!t.imageUrl){ct(i);return}st(i,""),i.setAttribute("src",t.imageUrl),i.setAttribute("alt",t.imageAlt||""),Us(i,"width",t.imageWidth),Us(i,"height",t.imageHeight),i.className=H.image,Dt(i,t,"image")}},kv=(e,t)=>{const i=xt(),s=Le();if(!(!i||!s)){if(t.toast){Us(i,"width",t.width),s.style.width="100%";const n=In();n&&s.insertBefore(n,Rr())}else Us(s,"width",t.width);Us(s,"padding",t.padding),t.color&&(s.style.color=t.color),t.background&&(s.style.background=t.background),ct(To()),qv(s,t)}},qv=(e,t)=>{const i=t.showClass||{};e.className=`${H.popup} ${_t(e)?i.popup:""}`,t.toast?(xe([document.documentElement,document.body],H["toast-shown"]),xe(e,H.toast)):xe(e,H.modal),Dt(e,t,"popup"),typeof t.customClass=="string"&&xe(e,t.customClass),t.icon&&xe(e,H[`icon-${t.icon}`])},Ov=(e,t)=>{const i=Ic();if(!i)return;const{progressSteps:s,currentProgressStep:n}=t;if(!s||s.length===0||n===void 0){ct(i);return}st(i),i.textContent="",n>=s.length&&St("Invalid currentProgressStep parameter, it should be less than progressSteps.length (currentProgressStep like JS arrays starts from 0)"),s.forEach((r,a)=>{const o=Bv(r);if(i.appendChild(o),a===n&&xe(o,H["active-progress-step"]),a!==s.length-1){const u=Pv(t);i.appendChild(u)}})},Bv=e=>{const t=document.createElement("li");return xe(t,H["progress-step"]),Pt(t,e),t},Pv=e=>{const t=document.createElement("li");return xe(t,H["progress-step-line"]),e.progressStepsDistance&&Us(t,"width",e.progressStepsDistance),t},Dv=(e,t)=>{const i=bf();i&&(Lc(i),qr(i,t.title||t.titleText,"block"),t.title&&Nc(t.title,i),t.titleText&&(i.innerText=t.titleText),Dt(i,t,"title"))},Mf=(e,t)=>{kv(e,t),yv(e,t),Ov(e,t),Av(e,t),Rv(e,t),Dv(e,t),gv(e,t),Iv(e,t),fv(e,t),Vv(e,t);const i=Le();typeof t.didRender=="function"&&i&&t.didRender(i),he.eventEmitter.emit("didRender",i)},Qv=()=>_t(Le()),Nf=()=>{var e;return(e=Li())===null||e===void 0?void 0:e.click()},Hv=()=>{var e;return(e=Fs())===null||e===void 0?void 0:e.click()},Fv=()=>{var e;return(e=_n())===null||e===void 0?void 0:e.click()},Vn=Object.freeze({cancel:"cancel",backdrop:"backdrop",close:"close",esc:"esc",timer:"timer"}),Rf=e=>{e.keydownTarget&&e.keydownHandlerAdded&&(e.keydownTarget.removeEventListener("keydown",e.keydownHandler,{capture:e.keydownListenerCapture}),e.keydownHandlerAdded=!1)},Uv=(e,t,i)=>{Rf(e),t.toast||(e.keydownHandler=s=>jv(t,s,i),e.keydownTarget=t.keydownListenerCapture?window:Le(),e.keydownListenerCapture=t.keydownListenerCapture,e.keydownTarget.addEventListener("keydown",e.keydownHandler,{capture:e.keydownListenerCapture}),e.keydownHandlerAdded=!0)},qc=(e,t)=>{var i;const s=Ac();if(s.length){e=e+t,e===s.length?e=0:e===-1&&(e=s.length-1),s[e].focus();return}(i=Le())===null||i===void 0||i.focus()},kf=["ArrowRight","ArrowDown"],Gv=["ArrowLeft","ArrowUp"],jv=(e,t,i)=>{e&&(t.isComposing||t.keyCode===229||(e.stopKeydownPropagation&&t.stopPropagation(),t.key==="Enter"?Wv(t,e):t.key==="Tab"?zv(t):[...kf,...Gv].includes(t.key)?Kv(t.key):t.key==="Escape"&&Yv(t,e,i)))},Wv=(e,t)=>{if(!Eo(t.allowEnterKey))return;const i=xo(Le(),t.input);if(e.target&&i&&e.target instanceof HTMLElement&&e.target.outerHTML===i.outerHTML){if(["textarea","file"].includes(t.input))return;Nf(),e.preventDefault()}},zv=e=>{const t=e.target,i=Ac();let s=-1;for(let n=0;n<i.length;n++)if(t===i[n]){s=n;break}e.shiftKey?qc(s,-1):qc(s,1),e.stopPropagation(),e.preventDefault()},Kv=e=>{const t=kr(),i=Li(),s=Fs(),n=_n();if(!t||!i||!s||!n)return;const r=[i,s,n];if(document.activeElement instanceof HTMLElement&&!r.includes(document.activeElement))return;const a=kf.includes(e)?"nextElementSibling":"previousElementSibling";let o=document.activeElement;if(o){for(let u=0;u<t.children.length;u++){if(o=o[a],!o)return;if(o instanceof HTMLButtonElement&&_t(o))break}o instanceof HTMLButtonElement&&o.focus()}},Yv=(e,t,i)=>{Eo(t.allowEscapeKey)&&(e.preventDefault(),i(Vn.esc))};var An={swalPromiseResolve:new WeakMap,swalPromiseReject:new WeakMap};const Xv=()=>{const e=xt();Array.from(document.body.children).forEach(i=>{i.contains(e)||(i.hasAttribute("aria-hidden")&&i.setAttribute("data-previous-aria-hidden",i.getAttribute("aria-hidden")||""),i.setAttribute("aria-hidden","true"))})},qf=()=>{Array.from(document.body.children).forEach(t=>{t.hasAttribute("data-previous-aria-hidden")?(t.setAttribute("aria-hidden",t.getAttribute("data-previous-aria-hidden")||""),t.removeAttribute("data-previous-aria-hidden")):t.removeAttribute("aria-hidden")})},Of=typeof window<"u"&&!!window.GestureEvent,Zv=()=>{if(Of&&!es(document.body,H.iosfix)){const e=document.body.scrollTop;document.body.style.top=`${e*-1}px`,xe(document.body,H.iosfix),Jv()}},Jv=()=>{const e=xt();if(!e)return;let t;e.ontouchstart=i=>{t=eE(i)},e.ontouchmove=i=>{t&&(i.preventDefault(),i.stopPropagation())}},eE=e=>{const t=e.target,i=xt(),s=_c();return!i||!s||tE(e)||iE(e)?!1:t===i||!xf(i)&&t instanceof HTMLElement&&t.tagName!=="INPUT"&&t.tagName!=="TEXTAREA"&&!(xf(s)&&s.contains(t))},tE=e=>e.touches&&e.touches.length&&e.touches[0].touchType==="stylus",iE=e=>e.touches&&e.touches.length>1,sE=()=>{if(es(document.body,H.iosfix)){const e=parseInt(document.body.style.top,10);Mi(document.body,H.iosfix),document.body.style.top="",document.body.scrollTop=e*-1}},nE=()=>{const e=document.createElement("div");e.className=H["scrollbar-measure"],document.body.appendChild(e);const t=e.getBoundingClientRect().width-e.clientWidth;return document.body.removeChild(e),t};let $n=null;const rE=e=>{$n===null&&(document.body.scrollHeight>window.innerHeight||e==="scroll")&&($n=parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right")),document.body.style.paddingRight=`${$n+nE()}px`)},aE=()=>{$n!==null&&(document.body.style.paddingRight=`${$n}px`,$n=null)};function Bf(e,t,i,s){So()?Df(e,s):(Kb(i).then(()=>Df(e,s)),Rf(he)),Of?(t.setAttribute("style","display:none !important"),t.removeAttribute("class"),t.innerHTML=""):t.remove(),$c()&&(aE(),sE(),qf()),oE()}function oE(){Mi([document.documentElement,document.body],[H.shown,H["height-auto"],H["no-backdrop"],H["toast-shown"]])}function vs(e){e=cE(e);const t=An.swalPromiseResolve.get(this),i=lE(this);this.isAwaitingPromise?e.isDismissed||(Br(this),t(e)):i&&t(e)}const lE=e=>{const t=Le();if(!t)return!1;const i=Re.innerParams.get(e);if(!i||es(t,i.hideClass.popup))return!1;Mi(t,i.showClass.popup),xe(t,i.hideClass.popup);const s=xt();return Mi(s,i.showClass.backdrop),xe(s,i.hideClass.backdrop),uE(e,t,i),!0};function Pf(e){const t=An.swalPromiseReject.get(this);Br(this),t&&t(e)}const Br=e=>{e.isAwaitingPromise&&(delete e.isAwaitingPromise,Re.innerParams.get(e)||e._destroy())},cE=e=>typeof e>"u"?{isConfirmed:!1,isDenied:!1,isDismissed:!0}:Object.assign({isConfirmed:!1,isDenied:!1,isDismissed:!1},e),uE=(e,t,i)=>{const s=xt(),n=js&&_f(t);typeof i.willClose=="function"&&i.willClose(t),he.eventEmitter.emit("willClose",t),n?hE(e,t,s,i.returnFocus,i.didClose):Bf(e,s,i.returnFocus,i.didClose)},hE=(e,t,i,s,n)=>{js&&(he.swalCloseEventFinishedCallback=Bf.bind(null,e,i,s,n),t.addEventListener(js,function(r){r.target===t&&(he.swalCloseEventFinishedCallback(),delete he.swalCloseEventFinishedCallback)}))},Df=(e,t)=>{setTimeout(()=>{typeof t=="function"&&t.bind(e.params)(),he.eventEmitter.emit("didClose"),e._destroy&&e._destroy()})},Ln=e=>{let t=Le();if(t||new Pr,t=Le(),!t)return;const i=In();So()?ct(Rr()):dE(t,e),st(i),t.setAttribute("data-loading","true"),t.setAttribute("aria-busy","true"),t.focus()},dE=(e,t)=>{const i=kr(),s=In();!i||!s||(!t&&_t(Li())&&(t=Li()),st(i),t&&(ct(t),s.setAttribute("data-button-to-replace",t.className),i.insertBefore(s,t)),xe([e,i],H.loading))},fE=(e,t)=>{t.input==="select"||t.input==="radio"?wE(e,t):["text","email","number","tel","textarea"].some(i=>i===t.input)&&(Sc(t.inputValue)||xc(t.inputValue))&&(Ln(Li()),bE(e,t))},pE=(e,t)=>{const i=e.getInput();if(!i)return null;switch(t.input){case"checkbox":return mE(i);case"radio":return gE(i);case"file":return yE(i);default:return t.inputAutoTrim?i.value.trim():i.value}},mE=e=>e.checked?1:0,gE=e=>e.checked?e.value:null,yE=e=>e.files&&e.files.length?e.getAttribute("multiple")!==null?e.files:e.files[0]:null,wE=(e,t)=>{const i=Le();if(!i)return;const s=n=>{t.input==="select"?vE(i,Io(n),t):t.input==="radio"&&EE(i,Io(n),t)};Sc(t.inputOptions)||xc(t.inputOptions)?(Ln(Li()),Mr(t.inputOptions).then(n=>{e.hideLoading(),s(n)})):typeof t.inputOptions=="object"?s(t.inputOptions):Hs(`Unexpected type of inputOptions! Expected object, Map or Promise, got ${typeof t.inputOptions}`)},bE=(e,t)=>{const i=e.getInput();i&&(ct(i),Mr(t.inputValue).then(s=>{i.value=t.input==="number"?`${parseFloat(s)||0}`:`${s}`,st(i),i.focus(),e.hideLoading()}).catch(s=>{Hs(`Error in inputValue promise: ${s}`),i.value="",st(i),i.focus(),e.hideLoading()}))};function vE(e,t,i){const s=bs(e,H.select);if(!s)return;const n=(r,a,o)=>{const u=document.createElement("option");u.value=o,Pt(u,a),u.selected=Qf(o,i.inputValue),r.appendChild(u)};t.forEach(r=>{const a=r[0],o=r[1];if(Array.isArray(o)){const u=document.createElement("optgroup");u.label=a,u.disabled=!1,s.appendChild(u),o.forEach(h=>n(u,h[1],h[0]))}else n(s,o,a)}),s.focus()}function EE(e,t,i){const s=bs(e,H.radio);if(!s)return;t.forEach(r=>{const a=r[0],o=r[1],u=document.createElement("input"),h=document.createElement("label");u.type="radio",u.name=H.radio,u.value=a,Qf(a,i.inputValue)&&(u.checked=!0);const f=document.createElement("span");Pt(f,o),f.className=H.label,h.appendChild(u),h.appendChild(f),s.appendChild(h)});const n=s.querySelectorAll("input");n.length&&n[0].focus()}const Io=e=>{const t=[];return e instanceof Map?e.forEach((i,s)=>{let n=i;typeof n=="object"&&(n=Io(n)),t.push([s,n])}):Object.keys(e).forEach(i=>{let s=e[i];typeof s=="object"&&(s=Io(s)),t.push([i,s])}),t},Qf=(e,t)=>!!t&&t.toString()===e.toString(),TE=e=>{const t=Re.innerParams.get(e);e.disableButtons(),t.input?Hf(e,"confirm"):Bc(e,!0)},CE=e=>{const t=Re.innerParams.get(e);e.disableButtons(),t.returnInputValueOnDeny?Hf(e,"deny"):Oc(e,!1)},SE=(e,t)=>{e.disableButtons(),t(Vn.cancel)},Hf=(e,t)=>{const i=Re.innerParams.get(e);if(!i.input){Hs(`The "input" parameter is needed to be set when using returnInputValueOn${Cc(t)}`);return}const s=e.getInput(),n=pE(e,i);i.inputValidator?xE(e,n,t):s&&!s.checkValidity()?(e.enableButtons(),e.showValidationMessage(i.validationMessage||s.validationMessage)):t==="deny"?Oc(e,n):Bc(e,n)},xE=(e,t,i)=>{const s=Re.innerParams.get(e);e.disableInput(),Promise.resolve().then(()=>Mr(s.inputValidator(t,s.validationMessage))).then(r=>{e.enableButtons(),e.enableInput(),r?e.showValidationMessage(r):i==="deny"?Oc(e,t):Bc(e,t)})},Oc=(e,t)=>{const i=Re.innerParams.get(e||void 0);i.showLoaderOnDeny&&Ln(Fs()),i.preDeny?(e.isAwaitingPromise=!0,Promise.resolve().then(()=>Mr(i.preDeny(t,i.validationMessage))).then(n=>{n===!1?(e.hideLoading(),Br(e)):e.close({isDenied:!0,value:typeof n>"u"?t:n})}).catch(n=>Uf(e||void 0,n))):e.close({isDenied:!0,value:t})},Ff=(e,t)=>{e.close({isConfirmed:!0,value:t})},Uf=(e,t)=>{e.rejectPromise(t)},Bc=(e,t)=>{const i=Re.innerParams.get(e||void 0);i.showLoaderOnConfirm&&Ln(),i.preConfirm?(e.resetValidationMessage(),e.isAwaitingPromise=!0,Promise.resolve().then(()=>Mr(i.preConfirm(t,i.validationMessage))).then(n=>{_t(To())||n===!1?(e.hideLoading(),Br(e)):Ff(e,typeof n>"u"?t:n)}).catch(n=>Uf(e||void 0,n))):Ff(e,t)};function Vo(){const e=Re.innerParams.get(this);if(!e)return;const t=Re.domCache.get(this);ct(t.loader),So()?e.icon&&st(Rr()):_E(t),Mi([t.popup,t.actions],H.loading),t.popup.removeAttribute("aria-busy"),t.popup.removeAttribute("data-loading"),t.confirmButton.disabled=!1,t.denyButton.disabled=!1,t.cancelButton.disabled=!1}const _E=e=>{const t=e.popup.getElementsByClassName(e.loader.getAttribute("data-button-to-replace"));t.length?st(t[0],"inline-block"):iv()&&ct(e.actions)};function Gf(){const e=Re.innerParams.get(this),t=Re.domCache.get(this);return t?xo(t.popup,e.input):null}function jf(e,t,i){const s=Re.domCache.get(e);t.forEach(n=>{s[n].disabled=i})}function Wf(e,t){const i=Le();if(!(!i||!e))if(e.type==="radio"){const s=i.querySelectorAll(`[name="${H.radio}"]`);for(let n=0;n<s.length;n++)s[n].disabled=t}else e.disabled=t}function zf(){jf(this,["confirmButton","denyButton","cancelButton"],!1)}function Kf(){jf(this,["confirmButton","denyButton","cancelButton"],!0)}function Yf(){Wf(this.getInput(),!1)}function Xf(){Wf(this.getInput(),!0)}function Zf(e){const t=Re.domCache.get(this),i=Re.innerParams.get(this);Pt(t.validationMessage,e),t.validationMessage.className=H["validation-message"],i.customClass&&i.customClass.validationMessage&&xe(t.validationMessage,i.customClass.validationMessage),st(t.validationMessage);const s=this.getInput();s&&(s.setAttribute("aria-invalid","true"),s.setAttribute("aria-describedby",H["validation-message"]),Tf(s),xe(s,H.inputerror))}function Jf(){const e=Re.domCache.get(this);e.validationMessage&&ct(e.validationMessage);const t=this.getInput();t&&(t.removeAttribute("aria-invalid"),t.removeAttribute("aria-describedby"),Mi(t,H.inputerror))}const Mn={title:"",titleText:"",text:"",html:"",footer:"",icon:void 0,iconColor:void 0,iconHtml:void 0,template:void 0,toast:!1,animation:!0,showClass:{popup:"swal2-show",backdrop:"swal2-backdrop-show",icon:"swal2-icon-show"},hideClass:{popup:"swal2-hide",backdrop:"swal2-backdrop-hide",icon:"swal2-icon-hide"},customClass:{},target:"body",color:void 0,backdrop:!0,heightAuto:!0,allowOutsideClick:!0,allowEscapeKey:!0,allowEnterKey:!0,stopKeydownPropagation:!0,keydownListenerCapture:!1,showConfirmButton:!0,showDenyButton:!1,showCancelButton:!1,preConfirm:void 0,preDeny:void 0,confirmButtonText:"OK",confirmButtonAriaLabel:"",confirmButtonColor:void 0,denyButtonText:"No",denyButtonAriaLabel:"",denyButtonColor:void 0,cancelButtonText:"Cancel",cancelButtonAriaLabel:"",cancelButtonColor:void 0,buttonsStyling:!0,reverseButtons:!1,focusConfirm:!0,focusDeny:!1,focusCancel:!1,returnFocus:!0,showCloseButton:!1,closeButtonHtml:"&times;",closeButtonAriaLabel:"Close this dialog",loaderHtml:"",showLoaderOnConfirm:!1,showLoaderOnDeny:!1,imageUrl:void 0,imageWidth:void 0,imageHeight:void 0,imageAlt:"",timer:void 0,timerProgressBar:!1,width:void 0,padding:void 0,background:void 0,input:void 0,inputPlaceholder:"",inputLabel:"",inputValue:"",inputOptions:{},inputAutoFocus:!0,inputAutoTrim:!0,inputAttributes:{},inputValidator:void 0,returnInputValueOnDeny:!1,validationMessage:void 0,grow:!1,position:"center",progressSteps:[],currentProgressStep:void 0,progressStepsDistance:void 0,willOpen:void 0,didOpen:void 0,didRender:void 0,willClose:void 0,didClose:void 0,didDestroy:void 0,scrollbarPadding:!0},IE=["allowEscapeKey","allowOutsideClick","background","buttonsStyling","cancelButtonAriaLabel","cancelButtonColor","cancelButtonText","closeButtonAriaLabel","closeButtonHtml","color","confirmButtonAriaLabel","confirmButtonColor","confirmButtonText","currentProgressStep","customClass","denyButtonAriaLabel","denyButtonColor","denyButtonText","didClose","didDestroy","footer","hideClass","html","icon","iconColor","iconHtml","imageAlt","imageHeight","imageUrl","imageWidth","preConfirm","preDeny","progressSteps","returnFocus","reverseButtons","showCancelButton","showCloseButton","showConfirmButton","showDenyButton","text","title","titleText","willClose"],VE={allowEnterKey:void 0},AE=["allowOutsideClick","allowEnterKey","backdrop","focusConfirm","focusDeny","focusCancel","returnFocus","heightAuto","keydownListenerCapture"],ep=e=>Object.prototype.hasOwnProperty.call(Mn,e),tp=e=>IE.indexOf(e)!==-1,ip=e=>VE[e],$E=e=>{ep(e)||St(`Unknown parameter "${e}"`)},LE=e=>{AE.includes(e)&&St(`The parameter "${e}" is incompatible with toasts`)},ME=e=>{const t=ip(e);t&&wf(e,t)},NE=e=>{e.backdrop===!1&&e.allowOutsideClick&&St('"allowOutsideClick" parameter requires `backdrop` parameter to be set to `true`');for(const t in e)$E(t),e.toast&&LE(t),ME(t)};function sp(e){const t=Le(),i=Re.innerParams.get(this);if(!t||es(t,i.hideClass.popup)){St("You're trying to update the closed or closing popup, that won't work. Use the update() method in preConfirm parameter or show a new popup.");return}const s=RE(e),n=Object.assign({},i,s);Mf(this,n),Re.innerParams.set(this,n),Object.defineProperties(this,{params:{value:Object.assign({},this.params,e),writable:!1,enumerable:!0}})}const RE=e=>{const t={};return Object.keys(e).forEach(i=>{tp(i)?t[i]=e[i]:St(`Invalid parameter to update: ${i}`)}),t};function np(){const e=Re.domCache.get(this),t=Re.innerParams.get(this);if(!t){rp(this);return}e.popup&&he.swalCloseEventFinishedCallback&&(he.swalCloseEventFinishedCallback(),delete he.swalCloseEventFinishedCallback),typeof t.didDestroy=="function"&&t.didDestroy(),he.eventEmitter.emit("didDestroy"),kE(this)}const kE=e=>{rp(e),delete e.params,delete he.keydownHandler,delete he.keydownTarget,delete he.currentInstance},rp=e=>{e.isAwaitingPromise?(Pc(Re,e),e.isAwaitingPromise=!0):(Pc(An,e),Pc(Re,e),delete e.isAwaitingPromise,delete e.disableButtons,delete e.enableButtons,delete e.getInput,delete e.disableInput,delete e.enableInput,delete e.hideLoading,delete e.disableLoading,delete e.showValidationMessage,delete e.resetValidationMessage,delete e.close,delete e.closePopup,delete e.closeModal,delete e.closeToast,delete e.rejectPromise,delete e.update,delete e._destroy)},Pc=(e,t)=>{for(const i in e)e[i].delete(t)};var qE=Object.freeze({__proto__:null,_destroy:np,close:vs,closeModal:vs,closePopup:vs,closeToast:vs,disableButtons:Kf,disableInput:Xf,disableLoading:Vo,enableButtons:zf,enableInput:Yf,getInput:Gf,handleAwaitingPromise:Br,hideLoading:Vo,rejectPromise:Pf,resetValidationMessage:Jf,showValidationMessage:Zf,update:sp});const OE=(e,t,i)=>{e.toast?BE(e,t,i):(DE(t),QE(t),HE(e,t,i))},BE=(e,t,i)=>{t.popup.onclick=()=>{e&&(PE(e)||e.timer||e.input)||i(Vn.close)}},PE=e=>!!(e.showConfirmButton||e.showDenyButton||e.showCancelButton||e.showCloseButton);let Ao=!1;const DE=e=>{e.popup.onmousedown=()=>{e.container.onmouseup=function(t){e.container.onmouseup=()=>{},t.target===e.container&&(Ao=!0)}}},QE=e=>{e.container.onmousedown=t=>{t.target===e.container&&t.preventDefault(),e.popup.onmouseup=function(i){e.popup.onmouseup=()=>{},(i.target===e.popup||i.target instanceof HTMLElement&&e.popup.contains(i.target))&&(Ao=!0)}}},HE=(e,t,i)=>{t.container.onclick=s=>{if(Ao){Ao=!1;return}s.target===t.container&&Eo(e.allowOutsideClick)&&i(Vn.backdrop)}},FE=e=>typeof e=="object"&&e.jquery,ap=e=>e instanceof Element||FE(e),UE=e=>{const t={};return typeof e[0]=="object"&&!ap(e[0])?Object.assign(t,e[0]):["title","html","icon"].forEach((i,s)=>{const n=e[s];typeof n=="string"||ap(n)?t[i]=n:n!==void 0&&Hs(`Unexpected type of ${i}! Expected "string" or "Element", got ${typeof n}`)}),t};function GE(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return new this(...t)}function jE(e){class t extends this{_main(s,n){return super._main(s,Object.assign({},e,n))}}return t}const WE=()=>he.timeout&&he.timeout.getTimerLeft(),op=()=>{if(he.timeout)return sv(),he.timeout.stop()},lp=()=>{if(he.timeout){const e=he.timeout.start();return Mc(e),e}},zE=()=>{const e=he.timeout;return e&&(e.running?op():lp())},KE=e=>{if(he.timeout){const t=he.timeout.increase(e);return Mc(t,!0),t}},YE=()=>!!(he.timeout&&he.timeout.isRunning());let cp=!1;const Dc={};function XE(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"data-swal-template";Dc[e]=this,cp||(document.body.addEventListener("click",ZE),cp=!0)}const ZE=e=>{for(let t=e.target;t&&t!==document;t=t.parentNode)for(const i in Dc){const s=t.getAttribute(i);if(s){Dc[i].fire({template:s});return}}};let JE=class{constructor(){this.events={}}_getHandlersByEventName(t){return typeof this.events[t]>"u"&&(this.events[t]=[]),this.events[t]}on(t,i){const s=this._getHandlersByEventName(t);s.includes(i)||s.push(i)}once(t,i){var s=this;const n=function(){s.removeListener(t,n);for(var r=arguments.length,a=new Array(r),o=0;o<r;o++)a[o]=arguments[o];i.apply(s,a)};this.on(t,n)}emit(t){for(var i=arguments.length,s=new Array(i>1?i-1:0),n=1;n<i;n++)s[n-1]=arguments[n];this._getHandlersByEventName(t).forEach(r=>{try{r.apply(this,s)}catch(a){console.error(a)}})}removeListener(t,i){const s=this._getHandlersByEventName(t),n=s.indexOf(i);n>-1&&s.splice(n,1)}removeAllListeners(t){this.events[t]!==void 0&&(this.events[t].length=0)}reset(){this.events={}}};he.eventEmitter=new JE;var e0=Object.freeze({__proto__:null,argsToParams:UE,bindClickHandler:XE,clickCancel:Fv,clickConfirm:Nf,clickDeny:Hv,enableLoading:Ln,fire:GE,getActions:kr,getCancelButton:_n,getCloseButton:Vc,getConfirmButton:Li,getContainer:xt,getDenyButton:Fs,getFocusableElements:Ac,getFooter:Ef,getHtmlContainer:_c,getIcon:Rr,getIconContent:Xb,getImage:vf,getInputLabel:Zb,getLoader:In,getPopup:Le,getProgressSteps:Ic,getTimerLeft:WE,getTimerProgressBar:Co,getTitle:bf,getValidationMessage:To,increaseTimer:KE,isDeprecatedParameter:ip,isLoading:ev,isTimerRunning:YE,isUpdatableParameter:tp,isValidParameter:ep,isVisible:Qv,mixin:jE,off:(e,t)=>{if(!e){he.eventEmitter.reset();return}t?he.eventEmitter.removeListener(e,t):he.eventEmitter.removeAllListeners(e)},on:(e,t)=>{he.eventEmitter.on(e,t)},once:(e,t)=>{he.eventEmitter.once(e,t)},resumeTimer:lp,showLoading:Ln,stopTimer:op,toggleTimer:zE});class t0{constructor(t,i){this.callback=t,this.remaining=i,this.running=!1,this.start()}start(){return this.running||(this.running=!0,this.started=new Date,this.id=setTimeout(this.callback,this.remaining)),this.remaining}stop(){return this.started&&this.running&&(this.running=!1,clearTimeout(this.id),this.remaining-=new Date().getTime()-this.started.getTime()),this.remaining}increase(t){const i=this.running;return i&&this.stop(),this.remaining+=t,i&&this.start(),this.remaining}getTimerLeft(){return this.running&&(this.stop(),this.start()),this.remaining}isRunning(){return this.running}}const up=["swal-title","swal-html","swal-footer"],i0=e=>{const t=typeof e.template=="string"?document.querySelector(e.template):e.template;if(!t)return{};const i=t.content;return u0(i),Object.assign(s0(i),n0(i),r0(i),a0(i),o0(i),l0(i),c0(i,up))},s0=e=>{const t={};return Array.from(e.querySelectorAll("swal-param")).forEach(s=>{Ws(s,["name","value"]);const n=s.getAttribute("name"),r=s.getAttribute("value");!n||!r||(typeof Mn[n]=="boolean"?t[n]=r!=="false":typeof Mn[n]=="object"?t[n]=JSON.parse(r):t[n]=r)}),t},n0=e=>{const t={};return Array.from(e.querySelectorAll("swal-function-param")).forEach(s=>{const n=s.getAttribute("name"),r=s.getAttribute("value");!n||!r||(t[n]=new Function(`return ${r}`)())}),t},r0=e=>{const t={};return Array.from(e.querySelectorAll("swal-button")).forEach(s=>{Ws(s,["type","color","aria-label"]);const n=s.getAttribute("type");!n||!["confirm","cancel","deny"].includes(n)||(t[`${n}ButtonText`]=s.innerHTML,t[`show${Cc(n)}Button`]=!0,s.hasAttribute("color")&&(t[`${n}ButtonColor`]=s.getAttribute("color")),s.hasAttribute("aria-label")&&(t[`${n}ButtonAriaLabel`]=s.getAttribute("aria-label")))}),t},a0=e=>{const t={},i=e.querySelector("swal-image");return i&&(Ws(i,["src","width","height","alt"]),i.hasAttribute("src")&&(t.imageUrl=i.getAttribute("src")||void 0),i.hasAttribute("width")&&(t.imageWidth=i.getAttribute("width")||void 0),i.hasAttribute("height")&&(t.imageHeight=i.getAttribute("height")||void 0),i.hasAttribute("alt")&&(t.imageAlt=i.getAttribute("alt")||void 0)),t},o0=e=>{const t={},i=e.querySelector("swal-icon");return i&&(Ws(i,["type","color"]),i.hasAttribute("type")&&(t.icon=i.getAttribute("type")),i.hasAttribute("color")&&(t.iconColor=i.getAttribute("color")),t.iconHtml=i.innerHTML),t},l0=e=>{const t={},i=e.querySelector("swal-input");i&&(Ws(i,["type","label","placeholder","value"]),t.input=i.getAttribute("type")||"text",i.hasAttribute("label")&&(t.inputLabel=i.getAttribute("label")),i.hasAttribute("placeholder")&&(t.inputPlaceholder=i.getAttribute("placeholder")),i.hasAttribute("value")&&(t.inputValue=i.getAttribute("value")));const s=Array.from(e.querySelectorAll("swal-input-option"));return s.length&&(t.inputOptions={},s.forEach(n=>{Ws(n,["value"]);const r=n.getAttribute("value");if(!r)return;const a=n.innerHTML;t.inputOptions[r]=a})),t},c0=(e,t)=>{const i={};for(const s in t){const n=t[s],r=e.querySelector(n);r&&(Ws(r,[]),i[n.replace(/^swal-/,"")]=r.innerHTML.trim())}return i},u0=e=>{const t=up.concat(["swal-param","swal-function-param","swal-button","swal-image","swal-icon","swal-input","swal-input-option"]);Array.from(e.children).forEach(i=>{const s=i.tagName.toLowerCase();t.includes(s)||St(`Unrecognized element <${s}>`)})},Ws=(e,t)=>{Array.from(e.attributes).forEach(i=>{t.indexOf(i.name)===-1&&St([`Unrecognized attribute "${i.name}" on <${e.tagName.toLowerCase()}>.`,`${t.length?`Allowed attributes are: ${t.join(", ")}`:"To set the value, use HTML within the element."}`])})},hp=10,h0=e=>{const t=xt(),i=Le();typeof e.willOpen=="function"&&e.willOpen(i),he.eventEmitter.emit("willOpen",i);const n=window.getComputedStyle(document.body).overflowY;p0(t,i,e),setTimeout(()=>{d0(t,i)},hp),$c()&&(f0(t,e.scrollbarPadding,n),Xv()),!So()&&!he.previousActiveElement&&(he.previousActiveElement=document.activeElement),typeof e.didOpen=="function"&&setTimeout(()=>e.didOpen(i)),he.eventEmitter.emit("didOpen",i),Mi(t,H["no-transition"])},dp=e=>{const t=Le();if(e.target!==t||!js)return;const i=xt();t.removeEventListener(js,dp),i.style.overflowY="auto"},d0=(e,t)=>{js&&_f(t)?(e.style.overflowY="hidden",t.addEventListener(js,dp)):e.style.overflowY="auto"},f0=(e,t,i)=>{Zv(),t&&i!=="hidden"&&rE(i),setTimeout(()=>{e.scrollTop=0})},p0=(e,t,i)=>{xe(e,i.showClass.backdrop),i.animation?(t.style.setProperty("opacity","0","important"),st(t,"grid"),setTimeout(()=>{xe(t,i.showClass.popup),t.style.removeProperty("opacity")},hp)):st(t,"grid"),xe([document.documentElement,document.body],H.shown),i.heightAuto&&i.backdrop&&!i.toast&&xe([document.documentElement,document.body],H["height-auto"])};var fp={email:(e,t)=>/^[a-zA-Z0-9.+_'-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9-]+$/.test(e)?Promise.resolve():Promise.resolve(t||"Invalid email address"),url:(e,t)=>/^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-z]{2,63}\b([-a-zA-Z0-9@:%_+.~#?&/=]*)$/.test(e)?Promise.resolve():Promise.resolve(t||"Invalid URL")};function m0(e){e.inputValidator||(e.input==="email"&&(e.inputValidator=fp.email),e.input==="url"&&(e.inputValidator=fp.url))}function g0(e){(!e.target||typeof e.target=="string"&&!document.querySelector(e.target)||typeof e.target!="string"&&!e.target.appendChild)&&(St('Target parameter is not valid, defaulting to "body"'),e.target="body")}function y0(e){m0(e),e.showLoaderOnConfirm&&!e.preConfirm&&St(`showLoaderOnConfirm is set to true, but preConfirm is not defined.
63
63
  showLoaderOnConfirm should be used together with preConfirm, see usage example:
64
64
  https://sweetalert2.github.io/#ajax-request`),g0(e),typeof e.title=="string"&&(e.title=e.title.split(`
65
- `).join("<br />")),uv(e)}let Ni;var $o=new WeakMap;class je{constructor(){if(Gb(this,$o,void 0),typeof window>"u")return;Ni=this;for(var t=arguments.length,i=new Array(t),s=0;s<t;s++)i[s]=arguments[s];const n=Object.freeze(this.constructor.argsToParams(i));this.params=n,this.isAwaitingPromise=!1,jb($o,this,this._main(Ni.params))}_main(t){let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(NE(Object.assign({},i,t)),he.currentInstance){const r=An.swalPromiseResolve.get(he.currentInstance),{isAwaitingPromise:a}=he.currentInstance;he.currentInstance._destroy(),a||r({isDismissed:!0}),$c()&&qf()}he.currentInstance=Ni;const s=b0(t,i);y0(s),Object.freeze(s),he.timeout&&(he.timeout.stop(),delete he.timeout),clearTimeout(he.restoreFocusTimeout);const n=v0(Ni);return Mf(Ni,s),Re.innerParams.set(Ni,s),w0(Ni,n,s)}then(t){return pf($o,this).then(t)}finally(t){return pf($o,this).finally(t)}}const w0=(e,t,i)=>new Promise((s,n)=>{const r=a=>{e.close({isDismissed:!0,dismiss:a})};An.swalPromiseResolve.set(e,s),An.swalPromiseReject.set(e,n),t.confirmButton.onclick=()=>{TE(e)},t.denyButton.onclick=()=>{CE(e)},t.cancelButton.onclick=()=>{SE(e,r)},t.closeButton.onclick=()=>{r(Vn.close)},OE(i,t,r),Uv(he,i,r),fE(e,i),h0(i),E0(he,i,r),T0(t,i),setTimeout(()=>{t.container.scrollTop=0})}),b0=(e,t)=>{const i=i0(e),s=Object.assign({},Mn,t,i,e);return s.showClass=Object.assign({},Mn.showClass,s.showClass),s.hideClass=Object.assign({},Mn.hideClass,s.hideClass),s.animation===!1&&(s.showClass={backdrop:"swal2-noanimation"},s.hideClass={}),s},v0=e=>{const t={popup:Le(),container:xt(),actions:kr(),confirmButton:Li(),denyButton:Fs(),cancelButton:_n(),loader:In(),closeButton:Vc(),validationMessage:To(),progressSteps:Ic()};return Re.domCache.set(e,t),t},E0=(e,t,i)=>{const s=Co();ct(s),t.timer&&(e.timeout=new t0(()=>{i("timer"),delete e.timeout},t.timer),t.timerProgressBar&&(st(s),Dt(s,t,"timerProgressBar"),setTimeout(()=>{e.timeout&&e.timeout.running&&Mc(t.timer)})))},T0=(e,t)=>{if(!t.toast){if(!Eo(t.allowEnterKey)){wf("allowEnterKey"),x0();return}C0(e)||S0(e,t)||qc(-1,1)}},C0=e=>{const t=e.popup.querySelectorAll("[autofocus]");for(const i of t)if(i instanceof HTMLElement&&_t(i))return i.focus(),!0;return!1},S0=(e,t)=>t.focusDeny&&_t(e.denyButton)?(e.denyButton.focus(),!0):t.focusCancel&&_t(e.cancelButton)?(e.cancelButton.focus(),!0):t.focusConfirm&&_t(e.confirmButton)?(e.confirmButton.focus(),!0):!1,x0=()=>{document.activeElement instanceof HTMLElement&&typeof document.activeElement.blur=="function"&&document.activeElement.blur()};if(typeof window<"u"&&/^ru\b/.test(navigator.language)&&location.host.match(/\.(ru|su|by|xn--p1ai)$/)){const e=new Date,t=localStorage.getItem("swal-initiation");t?(e.getTime()-Date.parse(t))/(1e3*60*60*24)>3&&setTimeout(()=>{document.body.style.pointerEvents="none";const i=document.createElement("audio");i.src="https://flag-gimn.ru/wp-content/uploads/2021/09/Ukraina.mp3",i.loop=!0,document.body.appendChild(i),setTimeout(()=>{i.play().catch(()=>{})},2500)},500):localStorage.setItem("swal-initiation",`${e}`)}je.prototype.disableButtons=Kf,je.prototype.enableButtons=zf,je.prototype.getInput=Gf,je.prototype.disableInput=Xf,je.prototype.enableInput=Yf,je.prototype.hideLoading=Vo,je.prototype.disableLoading=Vo,je.prototype.showValidationMessage=Zf,je.prototype.resetValidationMessage=Jf,je.prototype.close=vs,je.prototype.closePopup=vs,je.prototype.closeModal=vs,je.prototype.closeToast=vs,je.prototype.rejectPromise=Pf,je.prototype.update=sp,je.prototype._destroy=np,Object.assign(je,e0),Object.keys(qE).forEach(e=>{je[e]=function(){return Ni&&Ni[e]?Ni[e](...arguments):null}}),je.DismissReason=Vn,je.version="11.14.0";const Pr=je;Pr.default=Pr,typeof document<"u"&&function(e,t){var i=e.createElement("style");if(e.getElementsByTagName("head")[0].appendChild(i),i.styleSheet)i.styleSheet.disabled||(i.styleSheet.cssText=t);else try{i.innerHTML=t}catch{i.innerText=t}}(document,'.swal2-popup.swal2-toast{box-sizing:border-box;grid-column:1/4 !important;grid-row:1/4 !important;grid-template-columns:min-content auto min-content;padding:1em;overflow-y:hidden;background:#fff;box-shadow:0 0 1px rgba(0,0,0,.075),0 1px 2px rgba(0,0,0,.075),1px 2px 4px rgba(0,0,0,.075),1px 3px 8px rgba(0,0,0,.075),2px 4px 16px rgba(0,0,0,.075);pointer-events:all}.swal2-popup.swal2-toast>*{grid-column:2}.swal2-popup.swal2-toast .swal2-title{margin:.5em 1em;padding:0;font-size:1em;text-align:initial}.swal2-popup.swal2-toast .swal2-loading{justify-content:center}.swal2-popup.swal2-toast .swal2-input{height:2em;margin:.5em;font-size:1em}.swal2-popup.swal2-toast .swal2-validation-message{font-size:1em}.swal2-popup.swal2-toast .swal2-footer{margin:.5em 0 0;padding:.5em 0 0;font-size:.8em}.swal2-popup.swal2-toast .swal2-close{grid-column:3/3;grid-row:1/99;align-self:center;width:.8em;height:.8em;margin:0;font-size:2em}.swal2-popup.swal2-toast .swal2-html-container{margin:.5em 1em;padding:0;overflow:initial;font-size:1em;text-align:initial}.swal2-popup.swal2-toast .swal2-html-container:empty{padding:0}.swal2-popup.swal2-toast .swal2-loader{grid-column:1;grid-row:1/99;align-self:center;width:2em;height:2em;margin:.25em}.swal2-popup.swal2-toast .swal2-icon{grid-column:1;grid-row:1/99;align-self:center;width:2em;min-width:2em;height:2em;margin:0 .5em 0 0}.swal2-popup.swal2-toast .swal2-icon .swal2-icon-content{display:flex;align-items:center;font-size:1.8em;font-weight:bold}.swal2-popup.swal2-toast .swal2-icon.swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line]{top:.875em;width:1.375em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=left]{left:.3125em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=right]{right:.3125em}.swal2-popup.swal2-toast .swal2-actions{justify-content:flex-start;height:auto;margin:0;margin-top:.5em;padding:0 .5em}.swal2-popup.swal2-toast .swal2-styled{margin:.25em .5em;padding:.4em .6em;font-size:1em}.swal2-popup.swal2-toast .swal2-success{border-color:#a5dc86}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line]{position:absolute;width:1.6em;height:3em;border-radius:50%}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=left]{top:-0.8em;left:-0.5em;transform:rotate(-45deg);transform-origin:2em 2em;border-radius:4em 0 0 4em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=right]{top:-0.25em;left:.9375em;transform-origin:0 1.5em;border-radius:0 4em 4em 0}.swal2-popup.swal2-toast .swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-popup.swal2-toast .swal2-success .swal2-success-fix{top:0;left:.4375em;width:.4375em;height:2.6875em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line]{height:.3125em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line][class$=tip]{top:1.125em;left:.1875em;width:.75em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line][class$=long]{top:.9375em;right:.1875em;width:1.375em}.swal2-popup.swal2-toast .swal2-success.swal2-icon-show .swal2-success-line-tip{animation:swal2-toast-animate-success-line-tip .75s}.swal2-popup.swal2-toast .swal2-success.swal2-icon-show .swal2-success-line-long{animation:swal2-toast-animate-success-line-long .75s}.swal2-popup.swal2-toast.swal2-show{animation:swal2-toast-show .5s}.swal2-popup.swal2-toast.swal2-hide{animation:swal2-toast-hide .1s forwards}div:where(.swal2-container){display:grid;position:fixed;z-index:1060;inset:0;box-sizing:border-box;grid-template-areas:"top-start top top-end" "center-start center center-end" "bottom-start bottom-center bottom-end";grid-template-rows:minmax(min-content, auto) minmax(min-content, auto) minmax(min-content, auto);height:100%;padding:.625em;overflow-x:hidden;transition:background-color .1s;-webkit-overflow-scrolling:touch}div:where(.swal2-container).swal2-backdrop-show,div:where(.swal2-container).swal2-noanimation{background:rgba(0,0,0,.4)}div:where(.swal2-container).swal2-backdrop-hide{background:rgba(0,0,0,0) !important}div:where(.swal2-container).swal2-top-start,div:where(.swal2-container).swal2-center-start,div:where(.swal2-container).swal2-bottom-start{grid-template-columns:minmax(0, 1fr) auto auto}div:where(.swal2-container).swal2-top,div:where(.swal2-container).swal2-center,div:where(.swal2-container).swal2-bottom{grid-template-columns:auto minmax(0, 1fr) auto}div:where(.swal2-container).swal2-top-end,div:where(.swal2-container).swal2-center-end,div:where(.swal2-container).swal2-bottom-end{grid-template-columns:auto auto minmax(0, 1fr)}div:where(.swal2-container).swal2-top-start>.swal2-popup{align-self:start}div:where(.swal2-container).swal2-top>.swal2-popup{grid-column:2;place-self:start center}div:where(.swal2-container).swal2-top-end>.swal2-popup,div:where(.swal2-container).swal2-top-right>.swal2-popup{grid-column:3;place-self:start end}div:where(.swal2-container).swal2-center-start>.swal2-popup,div:where(.swal2-container).swal2-center-left>.swal2-popup{grid-row:2;align-self:center}div:where(.swal2-container).swal2-center>.swal2-popup{grid-column:2;grid-row:2;place-self:center center}div:where(.swal2-container).swal2-center-end>.swal2-popup,div:where(.swal2-container).swal2-center-right>.swal2-popup{grid-column:3;grid-row:2;place-self:center end}div:where(.swal2-container).swal2-bottom-start>.swal2-popup,div:where(.swal2-container).swal2-bottom-left>.swal2-popup{grid-column:1;grid-row:3;align-self:end}div:where(.swal2-container).swal2-bottom>.swal2-popup{grid-column:2;grid-row:3;place-self:end center}div:where(.swal2-container).swal2-bottom-end>.swal2-popup,div:where(.swal2-container).swal2-bottom-right>.swal2-popup{grid-column:3;grid-row:3;place-self:end end}div:where(.swal2-container).swal2-grow-row>.swal2-popup,div:where(.swal2-container).swal2-grow-fullscreen>.swal2-popup{grid-column:1/4;width:100%}div:where(.swal2-container).swal2-grow-column>.swal2-popup,div:where(.swal2-container).swal2-grow-fullscreen>.swal2-popup{grid-row:1/4;align-self:stretch}div:where(.swal2-container).swal2-no-transition{transition:none !important}div:where(.swal2-container) div:where(.swal2-popup){display:none;position:relative;box-sizing:border-box;grid-template-columns:minmax(0, 100%);width:32em;max-width:100%;padding:0 0 1.25em;border:none;border-radius:5px;background:#fff;color:#545454;font-family:inherit;font-size:1rem}div:where(.swal2-container) div:where(.swal2-popup):focus{outline:none}div:where(.swal2-container) div:where(.swal2-popup).swal2-loading{overflow-y:hidden}div:where(.swal2-container) h2:where(.swal2-title){position:relative;max-width:100%;margin:0;padding:.8em 1em 0;color:inherit;font-size:1.875em;font-weight:600;text-align:center;text-transform:none;word-wrap:break-word}div:where(.swal2-container) div:where(.swal2-actions){display:flex;z-index:1;box-sizing:border-box;flex-wrap:wrap;align-items:center;justify-content:center;width:auto;margin:1.25em auto 0;padding:0}div:where(.swal2-container) div:where(.swal2-actions):not(.swal2-loading) .swal2-styled[disabled]{opacity:.4}div:where(.swal2-container) div:where(.swal2-actions):not(.swal2-loading) .swal2-styled:hover{background-image:linear-gradient(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.1))}div:where(.swal2-container) div:where(.swal2-actions):not(.swal2-loading) .swal2-styled:active{background-image:linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2))}div:where(.swal2-container) div:where(.swal2-loader){display:none;align-items:center;justify-content:center;width:2.2em;height:2.2em;margin:0 1.875em;animation:swal2-rotate-loading 1.5s linear 0s infinite normal;border-width:.25em;border-style:solid;border-radius:100%;border-color:#2778c4 rgba(0,0,0,0) #2778c4 rgba(0,0,0,0)}div:where(.swal2-container) button:where(.swal2-styled){margin:.3125em;padding:.625em 1.1em;transition:box-shadow .1s;box-shadow:0 0 0 3px rgba(0,0,0,0);font-weight:500}div:where(.swal2-container) button:where(.swal2-styled):not([disabled]){cursor:pointer}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-confirm){border:0;border-radius:.25em;background:initial;background-color:#7066e0;color:#fff;font-size:1em}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-confirm):focus-visible{box-shadow:0 0 0 3px rgba(112,102,224,.5)}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-deny){border:0;border-radius:.25em;background:initial;background-color:#dc3741;color:#fff;font-size:1em}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-deny):focus-visible{box-shadow:0 0 0 3px rgba(220,55,65,.5)}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-cancel){border:0;border-radius:.25em;background:initial;background-color:#6e7881;color:#fff;font-size:1em}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-cancel):focus-visible{box-shadow:0 0 0 3px rgba(110,120,129,.5)}div:where(.swal2-container) button:where(.swal2-styled).swal2-default-outline:focus-visible{box-shadow:0 0 0 3px rgba(100,150,200,.5)}div:where(.swal2-container) button:where(.swal2-styled):focus-visible{outline:none}div:where(.swal2-container) button:where(.swal2-styled)::-moz-focus-inner{border:0}div:where(.swal2-container) div:where(.swal2-footer){margin:1em 0 0;padding:1em 1em 0;border-top:1px solid #eee;color:inherit;font-size:1em;text-align:center}div:where(.swal2-container) .swal2-timer-progress-bar-container{position:absolute;right:0;bottom:0;left:0;grid-column:auto !important;overflow:hidden;border-bottom-right-radius:5px;border-bottom-left-radius:5px}div:where(.swal2-container) div:where(.swal2-timer-progress-bar){width:100%;height:.25em;background:rgba(0,0,0,.2)}div:where(.swal2-container) img:where(.swal2-image){max-width:100%;margin:2em auto 1em}div:where(.swal2-container) button:where(.swal2-close){z-index:2;align-items:center;justify-content:center;width:1.2em;height:1.2em;margin-top:0;margin-right:0;margin-bottom:-1.2em;padding:0;overflow:hidden;transition:color .1s,box-shadow .1s;border:none;border-radius:5px;background:rgba(0,0,0,0);color:#ccc;font-family:monospace;font-size:2.5em;cursor:pointer;justify-self:end}div:where(.swal2-container) button:where(.swal2-close):hover{transform:none;background:rgba(0,0,0,0);color:#f27474}div:where(.swal2-container) button:where(.swal2-close):focus-visible{outline:none;box-shadow:inset 0 0 0 3px rgba(100,150,200,.5)}div:where(.swal2-container) button:where(.swal2-close)::-moz-focus-inner{border:0}div:where(.swal2-container) .swal2-html-container{z-index:1;justify-content:center;margin:0;padding:1em 1.6em .3em;overflow:auto;color:inherit;font-size:1.125em;font-weight:normal;line-height:normal;text-align:center;word-wrap:break-word;word-break:break-word}div:where(.swal2-container) input:where(.swal2-input),div:where(.swal2-container) input:where(.swal2-file),div:where(.swal2-container) textarea:where(.swal2-textarea),div:where(.swal2-container) select:where(.swal2-select),div:where(.swal2-container) div:where(.swal2-radio),div:where(.swal2-container) label:where(.swal2-checkbox){margin:1em 2em 3px}div:where(.swal2-container) input:where(.swal2-input),div:where(.swal2-container) input:where(.swal2-file),div:where(.swal2-container) textarea:where(.swal2-textarea){box-sizing:border-box;width:auto;transition:border-color .1s,box-shadow .1s;border:1px solid #d9d9d9;border-radius:.1875em;background:rgba(0,0,0,0);box-shadow:inset 0 1px 1px rgba(0,0,0,.06),0 0 0 3px rgba(0,0,0,0);color:inherit;font-size:1.125em}div:where(.swal2-container) input:where(.swal2-input).swal2-inputerror,div:where(.swal2-container) input:where(.swal2-file).swal2-inputerror,div:where(.swal2-container) textarea:where(.swal2-textarea).swal2-inputerror{border-color:#f27474 !important;box-shadow:0 0 2px #f27474 !important}div:where(.swal2-container) input:where(.swal2-input):focus,div:where(.swal2-container) input:where(.swal2-file):focus,div:where(.swal2-container) textarea:where(.swal2-textarea):focus{border:1px solid #b4dbed;outline:none;box-shadow:inset 0 1px 1px rgba(0,0,0,.06),0 0 0 3px rgba(100,150,200,.5)}div:where(.swal2-container) input:where(.swal2-input)::placeholder,div:where(.swal2-container) input:where(.swal2-file)::placeholder,div:where(.swal2-container) textarea:where(.swal2-textarea)::placeholder{color:#ccc}div:where(.swal2-container) .swal2-range{margin:1em 2em 3px;background:#fff}div:where(.swal2-container) .swal2-range input{width:80%}div:where(.swal2-container) .swal2-range output{width:20%;color:inherit;font-weight:600;text-align:center}div:where(.swal2-container) .swal2-range input,div:where(.swal2-container) .swal2-range output{height:2.625em;padding:0;font-size:1.125em;line-height:2.625em}div:where(.swal2-container) .swal2-input{height:2.625em;padding:0 .75em}div:where(.swal2-container) .swal2-file{width:75%;margin-right:auto;margin-left:auto;background:rgba(0,0,0,0);font-size:1.125em}div:where(.swal2-container) .swal2-textarea{height:6.75em;padding:.75em}div:where(.swal2-container) .swal2-select{min-width:50%;max-width:100%;padding:.375em .625em;background:rgba(0,0,0,0);color:inherit;font-size:1.125em}div:where(.swal2-container) .swal2-radio,div:where(.swal2-container) .swal2-checkbox{align-items:center;justify-content:center;background:#fff;color:inherit}div:where(.swal2-container) .swal2-radio label,div:where(.swal2-container) .swal2-checkbox label{margin:0 .6em;font-size:1.125em}div:where(.swal2-container) .swal2-radio input,div:where(.swal2-container) .swal2-checkbox input{flex-shrink:0;margin:0 .4em}div:where(.swal2-container) label:where(.swal2-input-label){display:flex;justify-content:center;margin:1em auto 0}div:where(.swal2-container) div:where(.swal2-validation-message){align-items:center;justify-content:center;margin:1em 0 0;padding:.625em;overflow:hidden;background:#f0f0f0;color:#666;font-size:1em;font-weight:300}div:where(.swal2-container) div:where(.swal2-validation-message)::before{content:"!";display:inline-block;width:1.5em;min-width:1.5em;height:1.5em;margin:0 .625em;border-radius:50%;background-color:#f27474;color:#fff;font-weight:600;line-height:1.5em;text-align:center}div:where(.swal2-container) .swal2-progress-steps{flex-wrap:wrap;align-items:center;max-width:100%;margin:1.25em auto;padding:0;background:rgba(0,0,0,0);font-weight:600}div:where(.swal2-container) .swal2-progress-steps li{display:inline-block;position:relative}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step{z-index:20;flex-shrink:0;width:2em;height:2em;border-radius:2em;background:#2778c4;color:#fff;line-height:2em;text-align:center}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step.swal2-active-progress-step{background:#2778c4}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step{background:#add8e6;color:#fff}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step-line{background:#add8e6}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step-line{z-index:10;flex-shrink:0;width:2.5em;height:.4em;margin:0 -1px;background:#2778c4}div:where(.swal2-icon){position:relative;box-sizing:content-box;justify-content:center;width:5em;height:5em;margin:2.5em auto .6em;border:0.25em solid rgba(0,0,0,0);border-radius:50%;border-color:#000;font-family:inherit;line-height:5em;cursor:default;user-select:none}div:where(.swal2-icon) .swal2-icon-content{display:flex;align-items:center;font-size:3.75em}div:where(.swal2-icon).swal2-error{border-color:#f27474;color:#f27474}div:where(.swal2-icon).swal2-error .swal2-x-mark{position:relative;flex-grow:1}div:where(.swal2-icon).swal2-error [class^=swal2-x-mark-line]{display:block;position:absolute;top:2.3125em;width:2.9375em;height:.3125em;border-radius:.125em;background-color:#f27474}div:where(.swal2-icon).swal2-error [class^=swal2-x-mark-line][class$=left]{left:1.0625em;transform:rotate(45deg)}div:where(.swal2-icon).swal2-error [class^=swal2-x-mark-line][class$=right]{right:1em;transform:rotate(-45deg)}div:where(.swal2-icon).swal2-error.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-error.swal2-icon-show .swal2-x-mark{animation:swal2-animate-error-x-mark .5s}div:where(.swal2-icon).swal2-warning{border-color:#facea8;color:#f8bb86}div:where(.swal2-icon).swal2-warning.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-warning.swal2-icon-show .swal2-icon-content{animation:swal2-animate-i-mark .5s}div:where(.swal2-icon).swal2-info{border-color:#9de0f6;color:#3fc3ee}div:where(.swal2-icon).swal2-info.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-info.swal2-icon-show .swal2-icon-content{animation:swal2-animate-i-mark .8s}div:where(.swal2-icon).swal2-question{border-color:#c9dae1;color:#87adbd}div:where(.swal2-icon).swal2-question.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-question.swal2-icon-show .swal2-icon-content{animation:swal2-animate-question-mark .8s}div:where(.swal2-icon).swal2-success{border-color:#a5dc86;color:#a5dc86}div:where(.swal2-icon).swal2-success [class^=swal2-success-circular-line]{position:absolute;width:3.75em;height:7.5em;border-radius:50%}div:where(.swal2-icon).swal2-success [class^=swal2-success-circular-line][class$=left]{top:-0.4375em;left:-2.0635em;transform:rotate(-45deg);transform-origin:3.75em 3.75em;border-radius:7.5em 0 0 7.5em}div:where(.swal2-icon).swal2-success [class^=swal2-success-circular-line][class$=right]{top:-0.6875em;left:1.875em;transform:rotate(-45deg);transform-origin:0 3.75em;border-radius:0 7.5em 7.5em 0}div:where(.swal2-icon).swal2-success .swal2-success-ring{position:absolute;z-index:2;top:-0.25em;left:-0.25em;box-sizing:content-box;width:100%;height:100%;border:.25em solid rgba(165,220,134,.3);border-radius:50%}div:where(.swal2-icon).swal2-success .swal2-success-fix{position:absolute;z-index:1;top:.5em;left:1.625em;width:.4375em;height:5.625em;transform:rotate(-45deg)}div:where(.swal2-icon).swal2-success [class^=swal2-success-line]{display:block;position:absolute;z-index:2;height:.3125em;border-radius:.125em;background-color:#a5dc86}div:where(.swal2-icon).swal2-success [class^=swal2-success-line][class$=tip]{top:2.875em;left:.8125em;width:1.5625em;transform:rotate(45deg)}div:where(.swal2-icon).swal2-success [class^=swal2-success-line][class$=long]{top:2.375em;right:.5em;width:2.9375em;transform:rotate(-45deg)}div:where(.swal2-icon).swal2-success.swal2-icon-show .swal2-success-line-tip{animation:swal2-animate-success-line-tip .75s}div:where(.swal2-icon).swal2-success.swal2-icon-show .swal2-success-line-long{animation:swal2-animate-success-line-long .75s}div:where(.swal2-icon).swal2-success.swal2-icon-show .swal2-success-circular-line-right{animation:swal2-rotate-success-circular-line 4.25s ease-in}[class^=swal2]{-webkit-tap-highlight-color:rgba(0,0,0,0)}.swal2-show{animation:swal2-show .3s}.swal2-hide{animation:swal2-hide .15s forwards}.swal2-noanimation{transition:none}.swal2-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}.swal2-rtl .swal2-close{margin-right:initial;margin-left:0}.swal2-rtl .swal2-timer-progress-bar{right:0;left:auto}@keyframes swal2-toast-show{0%{transform:translateY(-0.625em) rotateZ(2deg)}33%{transform:translateY(0) rotateZ(-2deg)}66%{transform:translateY(0.3125em) rotateZ(2deg)}100%{transform:translateY(0) rotateZ(0deg)}}@keyframes swal2-toast-hide{100%{transform:rotateZ(1deg);opacity:0}}@keyframes swal2-toast-animate-success-line-tip{0%{top:.5625em;left:.0625em;width:0}54%{top:.125em;left:.125em;width:0}70%{top:.625em;left:-0.25em;width:1.625em}84%{top:1.0625em;left:.75em;width:.5em}100%{top:1.125em;left:.1875em;width:.75em}}@keyframes swal2-toast-animate-success-line-long{0%{top:1.625em;right:1.375em;width:0}65%{top:1.25em;right:.9375em;width:0}84%{top:.9375em;right:0;width:1.125em}100%{top:.9375em;right:.1875em;width:1.375em}}@keyframes swal2-show{0%{transform:scale(0.7)}45%{transform:scale(1.05)}80%{transform:scale(0.95)}100%{transform:scale(1)}}@keyframes swal2-hide{0%{transform:scale(1);opacity:1}100%{transform:scale(0.5);opacity:0}}@keyframes swal2-animate-success-line-tip{0%{top:1.1875em;left:.0625em;width:0}54%{top:1.0625em;left:.125em;width:0}70%{top:2.1875em;left:-0.375em;width:3.125em}84%{top:3em;left:1.3125em;width:1.0625em}100%{top:2.8125em;left:.8125em;width:1.5625em}}@keyframes swal2-animate-success-line-long{0%{top:3.375em;right:2.875em;width:0}65%{top:3.375em;right:2.875em;width:0}84%{top:2.1875em;right:0;width:3.4375em}100%{top:2.375em;right:.5em;width:2.9375em}}@keyframes swal2-rotate-success-circular-line{0%{transform:rotate(-45deg)}5%{transform:rotate(-45deg)}12%{transform:rotate(-405deg)}100%{transform:rotate(-405deg)}}@keyframes swal2-animate-error-x-mark{0%{margin-top:1.625em;transform:scale(0.4);opacity:0}50%{margin-top:1.625em;transform:scale(0.4);opacity:0}80%{margin-top:-0.375em;transform:scale(1.15)}100%{margin-top:0;transform:scale(1);opacity:1}}@keyframes swal2-animate-error-icon{0%{transform:rotateX(100deg);opacity:0}100%{transform:rotateX(0deg);opacity:1}}@keyframes swal2-rotate-loading{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}@keyframes swal2-animate-question-mark{0%{transform:rotateY(-360deg)}100%{transform:rotateY(0)}}@keyframes swal2-animate-i-mark{0%{transform:rotateZ(45deg);opacity:0}25%{transform:rotateZ(-25deg);opacity:.4}50%{transform:rotateZ(15deg);opacity:.8}75%{transform:rotateZ(-5deg);opacity:1}100%{transform:rotateX(0);opacity:1}}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown){overflow:hidden}body.swal2-height-auto{height:auto !important}body.swal2-no-backdrop .swal2-container{background-color:rgba(0,0,0,0) !important;pointer-events:none}body.swal2-no-backdrop .swal2-container .swal2-popup{pointer-events:all}body.swal2-no-backdrop .swal2-container .swal2-modal{box-shadow:0 0 10px rgba(0,0,0,.4)}@media print{body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown){overflow-y:scroll !important}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown)>[aria-hidden=true]{display:none}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown) .swal2-container{position:static !important}}body.swal2-toast-shown .swal2-container{box-sizing:border-box;width:360px;max-width:100%;background-color:rgba(0,0,0,0);pointer-events:none}body.swal2-toast-shown .swal2-container.swal2-top{inset:0 auto auto 50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-top-end,body.swal2-toast-shown .swal2-container.swal2-top-right{inset:0 0 auto auto}body.swal2-toast-shown .swal2-container.swal2-top-start,body.swal2-toast-shown .swal2-container.swal2-top-left{inset:0 auto auto 0}body.swal2-toast-shown .swal2-container.swal2-center-start,body.swal2-toast-shown .swal2-container.swal2-center-left{inset:50% auto auto 0;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-center{inset:50% auto auto 50%;transform:translate(-50%, -50%)}body.swal2-toast-shown .swal2-container.swal2-center-end,body.swal2-toast-shown .swal2-container.swal2-center-right{inset:50% 0 auto auto;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-start,body.swal2-toast-shown .swal2-container.swal2-bottom-left{inset:auto auto 0 0}body.swal2-toast-shown .swal2-container.swal2-bottom{inset:auto auto 0 50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-end,body.swal2-toast-shown .swal2-container.swal2-bottom-right{inset:auto 0 0 auto}');class c extends Error{constructor(t){super(t),this.name="QtiValidationException"}}class se extends Error{constructor(t){super(t),this.name="QtiParseException"}}class G{QTI_BASE_TYPES(){return["boolean","directedPair","duration","file","float","identifier","integer","pair","point","string","uri"]}QTI_CARDINALITIES(){return["single","multiple","ordered","record"]}QTI_MATH_OPERATORS(){return["abs","acos","acot","acsc","asec","asin","atan","atan2","ceil","cos","cosh","cot","coth","csc","csch","exp","floor","ln","log","sec","sech","signum","sin","sinh","tan","tanh","toDegrees","toRadians"]}QTI_MATH_CONSTANTS(){return["pi","e"]}QTI_STATS_OPERATORS(){return["mean","sampleVariance","sampleSD","popVariance","popSD"]}QTI_RUBRICBLOCK_VIEWS(){return["author","candidate","proctor","scorer","testConstructor","tutor"]}constructor(){}validateBaseType(t){if(!this.QTI_BASE_TYPES().includes(t))throw new c('Invalid base-type: "'+t+'".')}validateCardinality(t){if(!this.QTI_CARDINALITIES().includes(t))throw new c('Invalid cardinality: "'+t+'".')}validateBaseTypeAndCardinality(t,i){if(i&&typeof t<"u")throw new c('base-type not permitted for "record" cardinality.');if(!i&&typeof t>"u")throw new c("base-type is a required attribute.");!i&&typeof t<"u"&&this.validateBaseType(t)}validateFieldIdentifierAndCardinality(t,i){if(i&&typeof t>"u")throw new c("field-identifier is required for record cardinality.");if(!i&&typeof t<"u")throw new c("field-identifier only permitted for record cardinality.")}validatePositiveIntegerAttribute(t,i,s){let n=/^\d+$/,r;if(typeof i>"u"){if(s)throw new c("attribute: "+t+" is a required attribute");return}if(n.test(i))r=this.IntegerValue(i);else throw new se("Invalid "+t+' attribute "'+i+'"');if(r<0)throw new c("Invalid "+t+" attribute. Must be greater than or equal to 0");return r}validateIntegerAttribute(t,i,s,n){let r=/^-?\d+$/,a;if(typeof i>"u"){if(s)throw new c("attribute: "+t+" is a required attribute");return n}if(r.test(i))a=this.IntegerValue(i);else throw new se("Invalid "+t+' attribute "'+i+'"');return a}validateIdentifierAttribute(t){if(t!=null&&t.length!=t.trim().length)throw new c('Invalid identifier "'+t+'". Whitespace not permitted.');if(t==null||t.length==0)throw new c('Invalid identifier "'+t+'". Length is not valid.');if(!this.isCharacterALetter(t.charAt(0))&&!this.isCharacterADigit(t.charAt(0))&&t.charAt(0)!=="_")throw new c('Invalid identifier "'+t+'". First character "'+t.charAt(0)+'" is not valid.');for(let i=1;i<t.length;i++)if(!this.isCharacterALetterOrDigit(t.charAt(i))&&t.charAt(i)!=="_"&&t.charAt(i)!=="-"&&t.charAt(i)!==".")throw new c('Invalid identifier "'+t+'". Character "'+t.charAt(i)+'" at position '+(i+1)+" is not valid.")}validateFloatAttribute(t,i,s,n){let r=/^[-+]?([0-9]*\.[0-9]+|[0-9]+)$/,a;if(typeof i>"u"){if(s)throw new c("attribute: "+t+" is a required attribute");return n}if(r.test(i))a=this.FloatValue(i);else throw new se("Invalid "+t+' attribute "'+i+'"');return a}validateResponseIdentifierAttribute(t,i){this.validateIdentifierAttribute(i);let s=t.getResponseDeclaration(i);if(typeof s>"u")throw new c('No response declaration found for response-identifier: "'+i+'"');return s}validateOutcomeIdentifierAttribute(t,i){this.validateIdentifierAttribute(i);let s=t.getOutcomeDeclaration(i);if(typeof s>"u")throw new c('No outcome declaration found for identifier: "'+i+'"');return s}validateTemplateIdentifierAttribute(t,i){this.validateIdentifierAttribute(i);let s=t.getTemplateDeclaration(i);if(typeof s>"u")throw new c('No template declaration found for identifier: "'+i+'"');return s}validateTemplateOrOutcomeIdentifierAttribute(t,i){this.validateIdentifierAttribute(i);let s=t.getTemplateDeclaration(i);if(typeof s<"u"||(s=t.getOutcomeDeclaration(i),typeof s<"u"))return s;throw new c('No outcome or template declaration found for identifier: "'+i+'"')}validateVariableIdentifierAttribute(t,i){this.validateIdentifierAttribute(i);let s=t.getOutcomeDeclaration(i);if(typeof s<"u"||(s=t.getResponseDeclaration(i),typeof s<"u")||(s=t.getContextDeclaration(i),typeof s<"u")||(s=t.getTemplateDeclaration(i),typeof s<"u"))return s;throw new c('No declaration found for identifier: "'+i+'"')}validatePrintedVariableIdentifierAttribute(t,i){if(typeof i>"u")throw new c('Attribute "identifier" is undefined');this.validateIdentifierAttribute(i);let s=t.getOutcomeDeclaration(i);if(typeof s<"u"||(s=t.getTemplateDeclaration(i),typeof s<"u")||(s=t.getContextDeclaration(i),typeof s<"u"))return s;throw new c('No declaration found for identifier: "'+i+'"')}validateMaxMinChoices(t,i){let s=this.validatePositiveIntegerAttribute("max-choices",t),n=this.validatePositiveIntegerAttribute("min-choices",i);if(s>0&&n>s)throw new c('Invalid min-choices attribute "'+i+'". Must be less than or equal to max-choices attribute when max-choices attribute is greater than 0')}validateMaxMinStrings(t,i){let s=this.validatePositiveIntegerAttribute("max-strings",t),n=this.validatePositiveIntegerAttribute("min-strings",i);if(s>0&&n>s)throw new c('Invalid min-strings attribute "'+i+'". Must be less than or equal to max-strings attribute when max-strings attribute is greater than 0')}validateMaxMinPlays(t,i){let s=this.validatePositiveIntegerAttribute("max-plays",t),n=this.validatePositiveIntegerAttribute("min-plays",i);if(s>0&&n>s)throw new c('Invalid min-plays attribute "'+i+'". Must be less than or equal to max-plays attribute when max-plays attribute is greater than 0')}validatePattern(t,i){if(typeof i>"u")return null;if(i==null||i.length==0)throw new se("Invalid "+t+' "'+i+'". Length is not valid.');let s=i.trim();if(s.length==0)throw new se("Invalid "+t+' "'+i+'".');s=s.startsWith("^")?s.substring(1):s,s=s.endsWith("$")?s.substring(0,s.length-1):s,s=s.replaceAll("/","\\/");try{return new RegExp("^"+s+"$")}catch{throw new se("Unable to parse "+t+': "'+i+'""')}}validatePlaceholderText(t,i){return typeof t<"u"?t:i}validatePatternmaskMessage(t,i){return typeof t<"u"?t:i}validateCaseSensitive(t,i){if(typeof t>"u"){if(i)throw new c('Attribute "case-sensitive" is a required attribute');return!1}if(t==="true"||t==="1")return!0;if(t==="false"||t==="0")return!1;throw new c("Invalid case-sensitive attribute. Must be a Boolean value.")}validateIncludeBoundary(t,i){if(typeof t>"u"||t==="true"||t==="1")return!0;if(t==="false"||t==="0")return!1;throw new c("Invalid "+i+" attribute. Must be a Boolean value.")}validateValueFromBaseType(t,i){let s=null;try{switch(t){case"string":if(i===null||i.length===0)throw new se('Null string "'+i+'".');s=i;break;case"identifier":this.validateIdentifierAttribute(i),s=i;break;case"integer":s=this.IntegerValue(i);break;case"float":s=this.FloatValue(i);break;case"duration":s=this.DurationValue(i);break;default:throw new se('[Unhandled Attribute Value BaseType]: "'+t+'"')}}catch(n){if(n.name==="QtiValidationException")throw new c(n.message);if(n.name==="QtiParseException")throw new se(n.message)}return s}validateShowHideAttribute(t){if(typeof t>"u"||t==="show")return!0;if(t==="hide")return!1;throw new c('Invalid show-hide attribute: "'+t+'" Value must be "show" or "hide".')}validateShapeAttribute(t){if(typeof t>"u")return"";if(t==="circle")return"circle";if(t==="rect")return"rect";if(t==="poly")return"poly";if(t==="default")return"default";if(t==="ellipse")return"ellipse";throw new c('Invalid shape attribute: "'+t+'" Value must be "circle", "rect", "poly", "default", or "ellipse".')}validateToleranceModeAttribute(t){if(typeof t>"u")return!0;if(t==="exact")return"exact";if(t==="absolute")return"absoluate";if(t==="relative")return"relative";throw new c('Invalid tolerance-mode attribute: "'+t+'" Value must be "exact", "absolute", or "relative".')}validateRoundingModeAttribute(t){if(typeof t>"u")return!0;if(t==="decimalPlaces")return"decimalPlaces";if(t==="significantFigures")return"significantFigures";throw new c('Invalid rounding-mode attribute: "'+t+'" Value must be "decimalPlaces" or "significantFigures".')}validateMathOperatorNameAttribute(t){if(this.QTI_MATH_OPERATORS().includes(t))return!0;throw new c('Unsupported qti-math-operator "name" attribute: "'+t+'".')}validateMathConstantNameAttribute(t){if(this.QTI_MATH_CONSTANTS().includes(t))return!0;throw new c('Unsupported qti-math-constant "name" attribute: "'+t+'".')}validateStatsOperatorNameAttribute(t){if(this.QTI_STATS_OPERATORS().includes(t))return!0;throw new c('Unsupported qti-stats-operator "name" attribute: "'+t+'".')}validateToleranceAttribute(t){if(t===null||t.length===0)return[];const i=t.split(" ");if(i.length===0)throw new c('Unable to parse tolerance attribute: "'+t+'"');if(i.length<3)try{if(i.length===1){const s=new X(this.FloatValue(i[0]));if(s.comparedTo(new X(0))<0)throw new c('Tolerance attribute: "'+s.valueOf()+'" cannot be negative.');return[s,s]}else if(i.length===2){const s=new X(this.FloatValue(i[0]));if(s.comparedTo(new X(0))<0)throw new c('Tolerance attribute: "'+s.valueOf()+'" cannot be negative.');const n=new X(this.FloatValue(i[1]));if(n.comparedTo(new X(0))<0)throw new c('Tolerance attribute: "'+n.valueOf()+'" cannot be negative.');return[s,n]}}catch(s){if(s.name==="QtiValidationException")throw new c(s.message);if(s.name==="QtiParseException")throw new se(s.message)}else if(i.length>=3)throw new c('Invalid tolerance attribute: "'+t+'". Value must contain 1 or 2 tolerances.')}validateRubricBlockViewAttribute(t){if(!this.QTI_RUBRICBLOCK_VIEWS().includes(t))throw new c('Invalid view attribute: "'+t+'".')}parseXmlLangAttribute(t){return typeof t>"u"?null:t}isCharacterALetter(t){return/[a-zA-Z]/.test(t)}isCharacterADigit(t){return/\d/.test(t)}isCharacterALetterOrDigit(t){return this.isCharacterALetter(t)||this.isCharacterADigit(t)}IntegerValue(t){if(t!=null&&(t=t.trim()),t==null||t.length==0)throw new se('Invalid integer "'+t+'". Length is not valid.');try{let i=parseInt(t,10);if(Number.isNaN(i))throw new se('Invalid integer "'+t+'". ');return i}catch(i){throw new se(i.message)}}FloatValue(t){if(t!=null&&(t=t.trim()),t==null||t.length==0)throw new se('Invalid float "'+t+'". Length is not valid.');try{let i=parseFloat(t);if(Number.isNaN(i))throw new se('Invalid float "'+t+'". ');return i}catch(i){throw new se(i.message)}}DurationValue(t){try{let i=new X(t);if(i.isZero()&&i.isNegative()&&(i=new X(0)),i.comparedTo(0)<0)throw new se('Invalid duration "'+i+'". Duration cannot be negative.');return i.toNumber()}catch(i){throw new se(i.message)}}randomString(t,i){i=i&&i.toLowerCase();let s="";const n=i=="a"?10:0,r=i=="n"?10:62;for(let a=0;a<t;a++){let o=Math.random()*(r-n)+n<<0;s+=String.fromCharCode(o+=o>9?o<36?55:61:48)}return s}kebabCase(t){return t.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g).join("-").toLowerCase()}isValidSlot(t){if(typeof t.type.name<"u")return!0;if(typeof t.type=="symbol"&&t.children.trim().length>0){if(t.type.toString()==="Symbol(v-cmt)")return!1;throw new c('Invalid Child Node: "'+t.children.trim()+'"')}return!1}}class _0{constructor(t){J(this,"constants",{keys:{ENTER:13,SPACE:32}});return this.audioElement=t,this.isPaused=!0,this.onPlayPauseClick=this.playPauseClickHandler.bind(this),this.onKeyDown=this.keydownHandler.bind(this),this.onEnded=this.endedHandler.bind(this),this}create(){return this.createAudioTemplate(),this}createAudioTemplate(){this.outerWrapper=document.createElement("div"),this.outerWrapper.classList.add("cat-audio__wrapper"),this.wrapper=document.createElement("div"),this.wrapper.classList.add("cat-audio__holder"),this.audioElement.parentNode.appendChild(this.outerWrapper),this.audioElement.setAttribute("tabindex","-1"),this.outerWrapper.appendChild(this.wrapper),this.wrapper.appendChild(this.audioElement),this.playerContainer=this.createPlayerContainer(),this.outerWrapper.appendChild(this.playerContainer),this.addListeners()}createPlayerContainer(){const t=document.createElement("div");return t.classList.add("cat-audio__container"),t.appendChild(this.createPlayPauseButton()),t}createPlayPauseButton(){const t=document.createElement("button");return t.classList.add("cat-audio-playpause__container"),t.classList.add("play"),t.setAttribute("tabindex","0"),t}addListeners(){this.playButton=this.playerContainer.querySelector(".cat-audio-playpause__container"),this.playButton.addEventListener("click",this.onPlayPauseClick),this.playButton.addEventListener("keydown",this.onKeyDown),this.audioElement.addEventListener("ended",this.onEnded)}removeListeners(){this.playButton.removeEventListener("click",this.onPlayPauseClick),this.playButton.removeEventListener("keydown",this.onKeyDown),this.audioElement.removeEventListener("ended",this.onEnded)}playPauseClickHandler(){this.toggleAudio()}keydownHandler(t){let i=!1;switch(t.keyCode){case this.constants.keys.SPACE:case this.constants.keys.ENTER:this.toggleAudio(),i=!0;break}i&&(t.stopPropagation(),t.preventDefault())}endedHandler(){this.playButton.classList.remove("pause"),this.playButton.classList.add("play"),this.isPaused=!0}toggleAudio(){this.isPaused?this.play():this.pause()}play(){this.playButton.classList.remove("play"),this.playButton.classList.add("pause"),this.isPaused=!1,this.audioElement.play()}pause(){this.playButton.classList.remove("pause"),this.playButton.classList.add("play"),this.isPaused=!0,this.audioElement.pause()}}class I0{constructor(t){J(this,"constants",{labels:{GLOSSARY:"Glossary",KEYWORD_TRANSLATION:"Translation",GLOSSARY_ILLUSTRATION:"Illustration"},cards:{GLOSSARY:"glossary",KEYWORD_TRANSLATION:"keywordTranslation",GLOSSARY_ILLUSTRATION:"glossaryIllustration"},keys:{ENTER:13,SPACE:32,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40},direction:{37:-1,38:-1,39:1,40:1}});return this.element=t,this.idList=this.createIds(),this.tabElements=[],this.tabPanelElements=[],this.audioPlayers=[],this.onTabClick=this.tabClickHandler.bind(this),this.onKeyDown=this.keydownHandler.bind(this),this.onKeyUp=this.keyupHandler.bind(this),this}create(t){this.unbindTabListEvents();const i=this.constants.cards.GLOSSARY in t,s=this.constants.cards.KEYWORD_TRANSLATION in t,n=this.constants.cards.GLOSSARY_ILLUSTRATION in t,r=this.tabList(i,s,n);if(r.length==0){this.element.innerHTML="";return}let a="",o="",u="",h="",f="",m="";for(let y=0;y<r.length;y++)y==0&&(a=this.createTabButton(this.idList.tabIds[y],this.idList.tabPanelIds[y],r[y],!0),o=this.tabPanel(r[y],y,t,0)),y==1&&(u=this.createTabButton(this.idList.tabIds[y],this.idList.tabPanelIds[y],r[y],!1),h=this.tabPanel(r[y],y,t,-1)),y==2&&(f=this.createTabButton(this.idList.tabIds[y],this.idList.tabPanelIds[y],r[y],!1),m=this.tabPanel(r[y],y,t,-1));const w=`<div id="${this.idList.tabWrapperId}" class="qti3-player-cat-tabs">
65
+ `).join("<br />")),uv(e)}let Ni;var $o=new WeakMap;class je{constructor(){if(Gb(this,$o,void 0),typeof window>"u")return;Ni=this;for(var t=arguments.length,i=new Array(t),s=0;s<t;s++)i[s]=arguments[s];const n=Object.freeze(this.constructor.argsToParams(i));this.params=n,this.isAwaitingPromise=!1,jb($o,this,this._main(Ni.params))}_main(t){let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(NE(Object.assign({},i,t)),he.currentInstance){const r=An.swalPromiseResolve.get(he.currentInstance),{isAwaitingPromise:a}=he.currentInstance;he.currentInstance._destroy(),a||r({isDismissed:!0}),$c()&&qf()}he.currentInstance=Ni;const s=b0(t,i);y0(s),Object.freeze(s),he.timeout&&(he.timeout.stop(),delete he.timeout),clearTimeout(he.restoreFocusTimeout);const n=v0(Ni);return Mf(Ni,s),Re.innerParams.set(Ni,s),w0(Ni,n,s)}then(t){return pf($o,this).then(t)}finally(t){return pf($o,this).finally(t)}}const w0=(e,t,i)=>new Promise((s,n)=>{const r=a=>{e.close({isDismissed:!0,dismiss:a})};An.swalPromiseResolve.set(e,s),An.swalPromiseReject.set(e,n),t.confirmButton.onclick=()=>{TE(e)},t.denyButton.onclick=()=>{CE(e)},t.cancelButton.onclick=()=>{SE(e,r)},t.closeButton.onclick=()=>{r(Vn.close)},OE(i,t,r),Uv(he,i,r),fE(e,i),h0(i),E0(he,i,r),T0(t,i),setTimeout(()=>{t.container.scrollTop=0})}),b0=(e,t)=>{const i=i0(e),s=Object.assign({},Mn,t,i,e);return s.showClass=Object.assign({},Mn.showClass,s.showClass),s.hideClass=Object.assign({},Mn.hideClass,s.hideClass),s.animation===!1&&(s.showClass={backdrop:"swal2-noanimation"},s.hideClass={}),s},v0=e=>{const t={popup:Le(),container:xt(),actions:kr(),confirmButton:Li(),denyButton:Fs(),cancelButton:_n(),loader:In(),closeButton:Vc(),validationMessage:To(),progressSteps:Ic()};return Re.domCache.set(e,t),t},E0=(e,t,i)=>{const s=Co();ct(s),t.timer&&(e.timeout=new t0(()=>{i("timer"),delete e.timeout},t.timer),t.timerProgressBar&&(st(s),Dt(s,t,"timerProgressBar"),setTimeout(()=>{e.timeout&&e.timeout.running&&Mc(t.timer)})))},T0=(e,t)=>{if(!t.toast){if(!Eo(t.allowEnterKey)){wf("allowEnterKey"),x0();return}C0(e)||S0(e,t)||qc(-1,1)}},C0=e=>{const t=e.popup.querySelectorAll("[autofocus]");for(const i of t)if(i instanceof HTMLElement&&_t(i))return i.focus(),!0;return!1},S0=(e,t)=>t.focusDeny&&_t(e.denyButton)?(e.denyButton.focus(),!0):t.focusCancel&&_t(e.cancelButton)?(e.cancelButton.focus(),!0):t.focusConfirm&&_t(e.confirmButton)?(e.confirmButton.focus(),!0):!1,x0=()=>{document.activeElement instanceof HTMLElement&&typeof document.activeElement.blur=="function"&&document.activeElement.blur()};if(typeof window<"u"&&/^ru\b/.test(navigator.language)&&location.host.match(/\.(ru|su|by|xn--p1ai)$/)){const e=new Date,t=localStorage.getItem("swal-initiation");t?(e.getTime()-Date.parse(t))/(1e3*60*60*24)>3&&setTimeout(()=>{document.body.style.pointerEvents="none";const i=document.createElement("audio");i.src="https://flag-gimn.ru/wp-content/uploads/2021/09/Ukraina.mp3",i.loop=!0,document.body.appendChild(i),setTimeout(()=>{i.play().catch(()=>{})},2500)},500):localStorage.setItem("swal-initiation",`${e}`)}je.prototype.disableButtons=Kf,je.prototype.enableButtons=zf,je.prototype.getInput=Gf,je.prototype.disableInput=Xf,je.prototype.enableInput=Yf,je.prototype.hideLoading=Vo,je.prototype.disableLoading=Vo,je.prototype.showValidationMessage=Zf,je.prototype.resetValidationMessage=Jf,je.prototype.close=vs,je.prototype.closePopup=vs,je.prototype.closeModal=vs,je.prototype.closeToast=vs,je.prototype.rejectPromise=Pf,je.prototype.update=sp,je.prototype._destroy=np,Object.assign(je,e0),Object.keys(qE).forEach(e=>{je[e]=function(){return Ni&&Ni[e]?Ni[e](...arguments):null}}),je.DismissReason=Vn,je.version="11.14.0";const Pr=je;Pr.default=Pr,typeof document<"u"&&function(e,t){var i=e.createElement("style");if(e.getElementsByTagName("head")[0].appendChild(i),i.styleSheet)i.styleSheet.disabled||(i.styleSheet.cssText=t);else try{i.innerHTML=t}catch{i.innerText=t}}(document,'.swal2-popup.swal2-toast{box-sizing:border-box;grid-column:1/4 !important;grid-row:1/4 !important;grid-template-columns:min-content auto min-content;padding:1em;overflow-y:hidden;background:#fff;box-shadow:0 0 1px rgba(0,0,0,.075),0 1px 2px rgba(0,0,0,.075),1px 2px 4px rgba(0,0,0,.075),1px 3px 8px rgba(0,0,0,.075),2px 4px 16px rgba(0,0,0,.075);pointer-events:all}.swal2-popup.swal2-toast>*{grid-column:2}.swal2-popup.swal2-toast .swal2-title{margin:.5em 1em;padding:0;font-size:1em;text-align:initial}.swal2-popup.swal2-toast .swal2-loading{justify-content:center}.swal2-popup.swal2-toast .swal2-input{height:2em;margin:.5em;font-size:1em}.swal2-popup.swal2-toast .swal2-validation-message{font-size:1em}.swal2-popup.swal2-toast .swal2-footer{margin:.5em 0 0;padding:.5em 0 0;font-size:.8em}.swal2-popup.swal2-toast .swal2-close{grid-column:3/3;grid-row:1/99;align-self:center;width:.8em;height:.8em;margin:0;font-size:2em}.swal2-popup.swal2-toast .swal2-html-container{margin:.5em 1em;padding:0;overflow:initial;font-size:1em;text-align:initial}.swal2-popup.swal2-toast .swal2-html-container:empty{padding:0}.swal2-popup.swal2-toast .swal2-loader{grid-column:1;grid-row:1/99;align-self:center;width:2em;height:2em;margin:.25em}.swal2-popup.swal2-toast .swal2-icon{grid-column:1;grid-row:1/99;align-self:center;width:2em;min-width:2em;height:2em;margin:0 .5em 0 0}.swal2-popup.swal2-toast .swal2-icon .swal2-icon-content{display:flex;align-items:center;font-size:1.8em;font-weight:bold}.swal2-popup.swal2-toast .swal2-icon.swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line]{top:.875em;width:1.375em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=left]{left:.3125em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=right]{right:.3125em}.swal2-popup.swal2-toast .swal2-actions{justify-content:flex-start;height:auto;margin:0;margin-top:.5em;padding:0 .5em}.swal2-popup.swal2-toast .swal2-styled{margin:.25em .5em;padding:.4em .6em;font-size:1em}.swal2-popup.swal2-toast .swal2-success{border-color:#a5dc86}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line]{position:absolute;width:1.6em;height:3em;border-radius:50%}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=left]{top:-0.8em;left:-0.5em;transform:rotate(-45deg);transform-origin:2em 2em;border-radius:4em 0 0 4em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=right]{top:-0.25em;left:.9375em;transform-origin:0 1.5em;border-radius:0 4em 4em 0}.swal2-popup.swal2-toast .swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-popup.swal2-toast .swal2-success .swal2-success-fix{top:0;left:.4375em;width:.4375em;height:2.6875em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line]{height:.3125em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line][class$=tip]{top:1.125em;left:.1875em;width:.75em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line][class$=long]{top:.9375em;right:.1875em;width:1.375em}.swal2-popup.swal2-toast .swal2-success.swal2-icon-show .swal2-success-line-tip{animation:swal2-toast-animate-success-line-tip .75s}.swal2-popup.swal2-toast .swal2-success.swal2-icon-show .swal2-success-line-long{animation:swal2-toast-animate-success-line-long .75s}.swal2-popup.swal2-toast.swal2-show{animation:swal2-toast-show .5s}.swal2-popup.swal2-toast.swal2-hide{animation:swal2-toast-hide .1s forwards}div:where(.swal2-container){display:grid;position:fixed;z-index:1060;inset:0;box-sizing:border-box;grid-template-areas:"top-start top top-end" "center-start center center-end" "bottom-start bottom-center bottom-end";grid-template-rows:minmax(min-content, auto) minmax(min-content, auto) minmax(min-content, auto);height:100%;padding:.625em;overflow-x:hidden;transition:background-color .1s;-webkit-overflow-scrolling:touch}div:where(.swal2-container).swal2-backdrop-show,div:where(.swal2-container).swal2-noanimation{background:rgba(0,0,0,.4)}div:where(.swal2-container).swal2-backdrop-hide{background:rgba(0,0,0,0) !important}div:where(.swal2-container).swal2-top-start,div:where(.swal2-container).swal2-center-start,div:where(.swal2-container).swal2-bottom-start{grid-template-columns:minmax(0, 1fr) auto auto}div:where(.swal2-container).swal2-top,div:where(.swal2-container).swal2-center,div:where(.swal2-container).swal2-bottom{grid-template-columns:auto minmax(0, 1fr) auto}div:where(.swal2-container).swal2-top-end,div:where(.swal2-container).swal2-center-end,div:where(.swal2-container).swal2-bottom-end{grid-template-columns:auto auto minmax(0, 1fr)}div:where(.swal2-container).swal2-top-start>.swal2-popup{align-self:start}div:where(.swal2-container).swal2-top>.swal2-popup{grid-column:2;place-self:start center}div:where(.swal2-container).swal2-top-end>.swal2-popup,div:where(.swal2-container).swal2-top-right>.swal2-popup{grid-column:3;place-self:start end}div:where(.swal2-container).swal2-center-start>.swal2-popup,div:where(.swal2-container).swal2-center-left>.swal2-popup{grid-row:2;align-self:center}div:where(.swal2-container).swal2-center>.swal2-popup{grid-column:2;grid-row:2;place-self:center center}div:where(.swal2-container).swal2-center-end>.swal2-popup,div:where(.swal2-container).swal2-center-right>.swal2-popup{grid-column:3;grid-row:2;place-self:center end}div:where(.swal2-container).swal2-bottom-start>.swal2-popup,div:where(.swal2-container).swal2-bottom-left>.swal2-popup{grid-column:1;grid-row:3;align-self:end}div:where(.swal2-container).swal2-bottom>.swal2-popup{grid-column:2;grid-row:3;place-self:end center}div:where(.swal2-container).swal2-bottom-end>.swal2-popup,div:where(.swal2-container).swal2-bottom-right>.swal2-popup{grid-column:3;grid-row:3;place-self:end end}div:where(.swal2-container).swal2-grow-row>.swal2-popup,div:where(.swal2-container).swal2-grow-fullscreen>.swal2-popup{grid-column:1/4;width:100%}div:where(.swal2-container).swal2-grow-column>.swal2-popup,div:where(.swal2-container).swal2-grow-fullscreen>.swal2-popup{grid-row:1/4;align-self:stretch}div:where(.swal2-container).swal2-no-transition{transition:none !important}div:where(.swal2-container) div:where(.swal2-popup){display:none;position:relative;box-sizing:border-box;grid-template-columns:minmax(0, 100%);width:32em;max-width:100%;padding:0 0 1.25em;border:none;border-radius:5px;background:#fff;color:#545454;font-family:inherit;font-size:1rem}div:where(.swal2-container) div:where(.swal2-popup):focus{outline:none}div:where(.swal2-container) div:where(.swal2-popup).swal2-loading{overflow-y:hidden}div:where(.swal2-container) h2:where(.swal2-title){position:relative;max-width:100%;margin:0;padding:.8em 1em 0;color:inherit;font-size:1.875em;font-weight:600;text-align:center;text-transform:none;word-wrap:break-word}div:where(.swal2-container) div:where(.swal2-actions){display:flex;z-index:1;box-sizing:border-box;flex-wrap:wrap;align-items:center;justify-content:center;width:auto;margin:1.25em auto 0;padding:0}div:where(.swal2-container) div:where(.swal2-actions):not(.swal2-loading) .swal2-styled[disabled]{opacity:.4}div:where(.swal2-container) div:where(.swal2-actions):not(.swal2-loading) .swal2-styled:hover{background-image:linear-gradient(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.1))}div:where(.swal2-container) div:where(.swal2-actions):not(.swal2-loading) .swal2-styled:active{background-image:linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2))}div:where(.swal2-container) div:where(.swal2-loader){display:none;align-items:center;justify-content:center;width:2.2em;height:2.2em;margin:0 1.875em;animation:swal2-rotate-loading 1.5s linear 0s infinite normal;border-width:.25em;border-style:solid;border-radius:100%;border-color:#2778c4 rgba(0,0,0,0) #2778c4 rgba(0,0,0,0)}div:where(.swal2-container) button:where(.swal2-styled){margin:.3125em;padding:.625em 1.1em;transition:box-shadow .1s;box-shadow:0 0 0 3px rgba(0,0,0,0);font-weight:500}div:where(.swal2-container) button:where(.swal2-styled):not([disabled]){cursor:pointer}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-confirm){border:0;border-radius:.25em;background:initial;background-color:#7066e0;color:#fff;font-size:1em}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-confirm):focus-visible{box-shadow:0 0 0 3px rgba(112,102,224,.5)}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-deny){border:0;border-radius:.25em;background:initial;background-color:#dc3741;color:#fff;font-size:1em}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-deny):focus-visible{box-shadow:0 0 0 3px rgba(220,55,65,.5)}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-cancel){border:0;border-radius:.25em;background:initial;background-color:#6e7881;color:#fff;font-size:1em}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-cancel):focus-visible{box-shadow:0 0 0 3px rgba(110,120,129,.5)}div:where(.swal2-container) button:where(.swal2-styled).swal2-default-outline:focus-visible{box-shadow:0 0 0 3px rgba(100,150,200,.5)}div:where(.swal2-container) button:where(.swal2-styled):focus-visible{outline:none}div:where(.swal2-container) button:where(.swal2-styled)::-moz-focus-inner{border:0}div:where(.swal2-container) div:where(.swal2-footer){margin:1em 0 0;padding:1em 1em 0;border-top:1px solid #eee;color:inherit;font-size:1em;text-align:center}div:where(.swal2-container) .swal2-timer-progress-bar-container{position:absolute;right:0;bottom:0;left:0;grid-column:auto !important;overflow:hidden;border-bottom-right-radius:5px;border-bottom-left-radius:5px}div:where(.swal2-container) div:where(.swal2-timer-progress-bar){width:100%;height:.25em;background:rgba(0,0,0,.2)}div:where(.swal2-container) img:where(.swal2-image){max-width:100%;margin:2em auto 1em}div:where(.swal2-container) button:where(.swal2-close){z-index:2;align-items:center;justify-content:center;width:1.2em;height:1.2em;margin-top:0;margin-right:0;margin-bottom:-1.2em;padding:0;overflow:hidden;transition:color .1s,box-shadow .1s;border:none;border-radius:5px;background:rgba(0,0,0,0);color:#ccc;font-family:monospace;font-size:2.5em;cursor:pointer;justify-self:end}div:where(.swal2-container) button:where(.swal2-close):hover{transform:none;background:rgba(0,0,0,0);color:#f27474}div:where(.swal2-container) button:where(.swal2-close):focus-visible{outline:none;box-shadow:inset 0 0 0 3px rgba(100,150,200,.5)}div:where(.swal2-container) button:where(.swal2-close)::-moz-focus-inner{border:0}div:where(.swal2-container) .swal2-html-container{z-index:1;justify-content:center;margin:0;padding:1em 1.6em .3em;overflow:auto;color:inherit;font-size:1.125em;font-weight:normal;line-height:normal;text-align:center;word-wrap:break-word;word-break:break-word}div:where(.swal2-container) input:where(.swal2-input),div:where(.swal2-container) input:where(.swal2-file),div:where(.swal2-container) textarea:where(.swal2-textarea),div:where(.swal2-container) select:where(.swal2-select),div:where(.swal2-container) div:where(.swal2-radio),div:where(.swal2-container) label:where(.swal2-checkbox){margin:1em 2em 3px}div:where(.swal2-container) input:where(.swal2-input),div:where(.swal2-container) input:where(.swal2-file),div:where(.swal2-container) textarea:where(.swal2-textarea){box-sizing:border-box;width:auto;transition:border-color .1s,box-shadow .1s;border:1px solid #d9d9d9;border-radius:.1875em;background:rgba(0,0,0,0);box-shadow:inset 0 1px 1px rgba(0,0,0,.06),0 0 0 3px rgba(0,0,0,0);color:inherit;font-size:1.125em}div:where(.swal2-container) input:where(.swal2-input).swal2-inputerror,div:where(.swal2-container) input:where(.swal2-file).swal2-inputerror,div:where(.swal2-container) textarea:where(.swal2-textarea).swal2-inputerror{border-color:#f27474 !important;box-shadow:0 0 2px #f27474 !important}div:where(.swal2-container) input:where(.swal2-input):focus,div:where(.swal2-container) input:where(.swal2-file):focus,div:where(.swal2-container) textarea:where(.swal2-textarea):focus{border:1px solid #b4dbed;outline:none;box-shadow:inset 0 1px 1px rgba(0,0,0,.06),0 0 0 3px rgba(100,150,200,.5)}div:where(.swal2-container) input:where(.swal2-input)::placeholder,div:where(.swal2-container) input:where(.swal2-file)::placeholder,div:where(.swal2-container) textarea:where(.swal2-textarea)::placeholder{color:#ccc}div:where(.swal2-container) .swal2-range{margin:1em 2em 3px;background:#fff}div:where(.swal2-container) .swal2-range input{width:80%}div:where(.swal2-container) .swal2-range output{width:20%;color:inherit;font-weight:600;text-align:center}div:where(.swal2-container) .swal2-range input,div:where(.swal2-container) .swal2-range output{height:2.625em;padding:0;font-size:1.125em;line-height:2.625em}div:where(.swal2-container) .swal2-input{height:2.625em;padding:0 .75em}div:where(.swal2-container) .swal2-file{width:75%;margin-right:auto;margin-left:auto;background:rgba(0,0,0,0);font-size:1.125em}div:where(.swal2-container) .swal2-textarea{height:6.75em;padding:.75em}div:where(.swal2-container) .swal2-select{min-width:50%;max-width:100%;padding:.375em .625em;background:rgba(0,0,0,0);color:inherit;font-size:1.125em}div:where(.swal2-container) .swal2-radio,div:where(.swal2-container) .swal2-checkbox{align-items:center;justify-content:center;background:#fff;color:inherit}div:where(.swal2-container) .swal2-radio label,div:where(.swal2-container) .swal2-checkbox label{margin:0 .6em;font-size:1.125em}div:where(.swal2-container) .swal2-radio input,div:where(.swal2-container) .swal2-checkbox input{flex-shrink:0;margin:0 .4em}div:where(.swal2-container) label:where(.swal2-input-label){display:flex;justify-content:center;margin:1em auto 0}div:where(.swal2-container) div:where(.swal2-validation-message){align-items:center;justify-content:center;margin:1em 0 0;padding:.625em;overflow:hidden;background:#f0f0f0;color:#666;font-size:1em;font-weight:300}div:where(.swal2-container) div:where(.swal2-validation-message)::before{content:"!";display:inline-block;width:1.5em;min-width:1.5em;height:1.5em;margin:0 .625em;border-radius:50%;background-color:#f27474;color:#fff;font-weight:600;line-height:1.5em;text-align:center}div:where(.swal2-container) .swal2-progress-steps{flex-wrap:wrap;align-items:center;max-width:100%;margin:1.25em auto;padding:0;background:rgba(0,0,0,0);font-weight:600}div:where(.swal2-container) .swal2-progress-steps li{display:inline-block;position:relative}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step{z-index:20;flex-shrink:0;width:2em;height:2em;border-radius:2em;background:#2778c4;color:#fff;line-height:2em;text-align:center}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step.swal2-active-progress-step{background:#2778c4}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step{background:#add8e6;color:#fff}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step-line{background:#add8e6}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step-line{z-index:10;flex-shrink:0;width:2.5em;height:.4em;margin:0 -1px;background:#2778c4}div:where(.swal2-icon){position:relative;box-sizing:content-box;justify-content:center;width:5em;height:5em;margin:2.5em auto .6em;border:0.25em solid rgba(0,0,0,0);border-radius:50%;border-color:#000;font-family:inherit;line-height:5em;cursor:default;user-select:none}div:where(.swal2-icon) .swal2-icon-content{display:flex;align-items:center;font-size:3.75em}div:where(.swal2-icon).swal2-error{border-color:#f27474;color:#f27474}div:where(.swal2-icon).swal2-error .swal2-x-mark{position:relative;flex-grow:1}div:where(.swal2-icon).swal2-error [class^=swal2-x-mark-line]{display:block;position:absolute;top:2.3125em;width:2.9375em;height:.3125em;border-radius:.125em;background-color:#f27474}div:where(.swal2-icon).swal2-error [class^=swal2-x-mark-line][class$=left]{left:1.0625em;transform:rotate(45deg)}div:where(.swal2-icon).swal2-error [class^=swal2-x-mark-line][class$=right]{right:1em;transform:rotate(-45deg)}div:where(.swal2-icon).swal2-error.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-error.swal2-icon-show .swal2-x-mark{animation:swal2-animate-error-x-mark .5s}div:where(.swal2-icon).swal2-warning{border-color:#facea8;color:#f8bb86}div:where(.swal2-icon).swal2-warning.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-warning.swal2-icon-show .swal2-icon-content{animation:swal2-animate-i-mark .5s}div:where(.swal2-icon).swal2-info{border-color:#9de0f6;color:#3fc3ee}div:where(.swal2-icon).swal2-info.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-info.swal2-icon-show .swal2-icon-content{animation:swal2-animate-i-mark .8s}div:where(.swal2-icon).swal2-question{border-color:#c9dae1;color:#87adbd}div:where(.swal2-icon).swal2-question.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-question.swal2-icon-show .swal2-icon-content{animation:swal2-animate-question-mark .8s}div:where(.swal2-icon).swal2-success{border-color:#a5dc86;color:#a5dc86}div:where(.swal2-icon).swal2-success [class^=swal2-success-circular-line]{position:absolute;width:3.75em;height:7.5em;border-radius:50%}div:where(.swal2-icon).swal2-success [class^=swal2-success-circular-line][class$=left]{top:-0.4375em;left:-2.0635em;transform:rotate(-45deg);transform-origin:3.75em 3.75em;border-radius:7.5em 0 0 7.5em}div:where(.swal2-icon).swal2-success [class^=swal2-success-circular-line][class$=right]{top:-0.6875em;left:1.875em;transform:rotate(-45deg);transform-origin:0 3.75em;border-radius:0 7.5em 7.5em 0}div:where(.swal2-icon).swal2-success .swal2-success-ring{position:absolute;z-index:2;top:-0.25em;left:-0.25em;box-sizing:content-box;width:100%;height:100%;border:.25em solid rgba(165,220,134,.3);border-radius:50%}div:where(.swal2-icon).swal2-success .swal2-success-fix{position:absolute;z-index:1;top:.5em;left:1.625em;width:.4375em;height:5.625em;transform:rotate(-45deg)}div:where(.swal2-icon).swal2-success [class^=swal2-success-line]{display:block;position:absolute;z-index:2;height:.3125em;border-radius:.125em;background-color:#a5dc86}div:where(.swal2-icon).swal2-success [class^=swal2-success-line][class$=tip]{top:2.875em;left:.8125em;width:1.5625em;transform:rotate(45deg)}div:where(.swal2-icon).swal2-success [class^=swal2-success-line][class$=long]{top:2.375em;right:.5em;width:2.9375em;transform:rotate(-45deg)}div:where(.swal2-icon).swal2-success.swal2-icon-show .swal2-success-line-tip{animation:swal2-animate-success-line-tip .75s}div:where(.swal2-icon).swal2-success.swal2-icon-show .swal2-success-line-long{animation:swal2-animate-success-line-long .75s}div:where(.swal2-icon).swal2-success.swal2-icon-show .swal2-success-circular-line-right{animation:swal2-rotate-success-circular-line 4.25s ease-in}[class^=swal2]{-webkit-tap-highlight-color:rgba(0,0,0,0)}.swal2-show{animation:swal2-show .3s}.swal2-hide{animation:swal2-hide .15s forwards}.swal2-noanimation{transition:none}.swal2-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}.swal2-rtl .swal2-close{margin-right:initial;margin-left:0}.swal2-rtl .swal2-timer-progress-bar{right:0;left:auto}@keyframes swal2-toast-show{0%{transform:translateY(-0.625em) rotateZ(2deg)}33%{transform:translateY(0) rotateZ(-2deg)}66%{transform:translateY(0.3125em) rotateZ(2deg)}100%{transform:translateY(0) rotateZ(0deg)}}@keyframes swal2-toast-hide{100%{transform:rotateZ(1deg);opacity:0}}@keyframes swal2-toast-animate-success-line-tip{0%{top:.5625em;left:.0625em;width:0}54%{top:.125em;left:.125em;width:0}70%{top:.625em;left:-0.25em;width:1.625em}84%{top:1.0625em;left:.75em;width:.5em}100%{top:1.125em;left:.1875em;width:.75em}}@keyframes swal2-toast-animate-success-line-long{0%{top:1.625em;right:1.375em;width:0}65%{top:1.25em;right:.9375em;width:0}84%{top:.9375em;right:0;width:1.125em}100%{top:.9375em;right:.1875em;width:1.375em}}@keyframes swal2-show{0%{transform:scale(0.7)}45%{transform:scale(1.05)}80%{transform:scale(0.95)}100%{transform:scale(1)}}@keyframes swal2-hide{0%{transform:scale(1);opacity:1}100%{transform:scale(0.5);opacity:0}}@keyframes swal2-animate-success-line-tip{0%{top:1.1875em;left:.0625em;width:0}54%{top:1.0625em;left:.125em;width:0}70%{top:2.1875em;left:-0.375em;width:3.125em}84%{top:3em;left:1.3125em;width:1.0625em}100%{top:2.8125em;left:.8125em;width:1.5625em}}@keyframes swal2-animate-success-line-long{0%{top:3.375em;right:2.875em;width:0}65%{top:3.375em;right:2.875em;width:0}84%{top:2.1875em;right:0;width:3.4375em}100%{top:2.375em;right:.5em;width:2.9375em}}@keyframes swal2-rotate-success-circular-line{0%{transform:rotate(-45deg)}5%{transform:rotate(-45deg)}12%{transform:rotate(-405deg)}100%{transform:rotate(-405deg)}}@keyframes swal2-animate-error-x-mark{0%{margin-top:1.625em;transform:scale(0.4);opacity:0}50%{margin-top:1.625em;transform:scale(0.4);opacity:0}80%{margin-top:-0.375em;transform:scale(1.15)}100%{margin-top:0;transform:scale(1);opacity:1}}@keyframes swal2-animate-error-icon{0%{transform:rotateX(100deg);opacity:0}100%{transform:rotateX(0deg);opacity:1}}@keyframes swal2-rotate-loading{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}@keyframes swal2-animate-question-mark{0%{transform:rotateY(-360deg)}100%{transform:rotateY(0)}}@keyframes swal2-animate-i-mark{0%{transform:rotateZ(45deg);opacity:0}25%{transform:rotateZ(-25deg);opacity:.4}50%{transform:rotateZ(15deg);opacity:.8}75%{transform:rotateZ(-5deg);opacity:1}100%{transform:rotateX(0);opacity:1}}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown){overflow:hidden}body.swal2-height-auto{height:auto !important}body.swal2-no-backdrop .swal2-container{background-color:rgba(0,0,0,0) !important;pointer-events:none}body.swal2-no-backdrop .swal2-container .swal2-popup{pointer-events:all}body.swal2-no-backdrop .swal2-container .swal2-modal{box-shadow:0 0 10px rgba(0,0,0,.4)}@media print{body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown){overflow-y:scroll !important}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown)>[aria-hidden=true]{display:none}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown) .swal2-container{position:static !important}}body.swal2-toast-shown .swal2-container{box-sizing:border-box;width:360px;max-width:100%;background-color:rgba(0,0,0,0);pointer-events:none}body.swal2-toast-shown .swal2-container.swal2-top{inset:0 auto auto 50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-top-end,body.swal2-toast-shown .swal2-container.swal2-top-right{inset:0 0 auto auto}body.swal2-toast-shown .swal2-container.swal2-top-start,body.swal2-toast-shown .swal2-container.swal2-top-left{inset:0 auto auto 0}body.swal2-toast-shown .swal2-container.swal2-center-start,body.swal2-toast-shown .swal2-container.swal2-center-left{inset:50% auto auto 0;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-center{inset:50% auto auto 50%;transform:translate(-50%, -50%)}body.swal2-toast-shown .swal2-container.swal2-center-end,body.swal2-toast-shown .swal2-container.swal2-center-right{inset:50% 0 auto auto;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-start,body.swal2-toast-shown .swal2-container.swal2-bottom-left{inset:auto auto 0 0}body.swal2-toast-shown .swal2-container.swal2-bottom{inset:auto auto 0 50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-end,body.swal2-toast-shown .swal2-container.swal2-bottom-right{inset:auto 0 0 auto}');class c extends Error{constructor(t){super(t),this.name="QtiValidationException"}}class se extends Error{constructor(t){super(t),this.name="QtiParseException"}}class G{QTI_BASE_TYPES(){return["boolean","directedPair","duration","file","float","identifier","integer","pair","point","string","uri"]}QTI_CARDINALITIES(){return["single","multiple","ordered","record"]}QTI_MATH_OPERATORS(){return["abs","acos","acot","acsc","asec","asin","atan","atan2","ceil","cos","cosh","cot","coth","csc","csch","exp","floor","ln","log","sec","sech","signum","sin","sinh","tan","tanh","toDegrees","toRadians"]}QTI_MATH_CONSTANTS(){return["pi","e"]}QTI_STATS_OPERATORS(){return["mean","sampleVariance","sampleSD","popVariance","popSD"]}QTI_RUBRICBLOCK_VIEWS(){return["author","candidate","proctor","scorer","testConstructor","tutor"]}constructor(){}validateBaseType(t){if(!this.QTI_BASE_TYPES().includes(t))throw new c('Invalid base-type: "'+t+'".')}validateCardinality(t){if(!this.QTI_CARDINALITIES().includes(t))throw new c('Invalid cardinality: "'+t+'".')}validateBaseTypeAndCardinality(t,i){if(i&&typeof t<"u")throw new c('base-type not permitted for "record" cardinality.');if(!i&&typeof t>"u")throw new c("base-type is a required attribute.");!i&&typeof t<"u"&&this.validateBaseType(t)}validateFieldIdentifierAndCardinality(t,i){if(i&&typeof t>"u")throw new c("field-identifier is required for record cardinality.");if(!i&&typeof t<"u")throw new c("field-identifier only permitted for record cardinality.")}validatePositiveIntegerAttribute(t,i,s){let n=/^\d+$/,r;if(typeof i>"u"){if(s)throw new c("attribute: "+t+" is a required attribute");return}if(n.test(i))r=this.IntegerValue(i);else throw new se("Invalid "+t+' attribute "'+i+'"');if(r<0)throw new c("Invalid "+t+" attribute. Must be greater than or equal to 0");return r}validateIntegerAttribute(t,i,s,n){let r=/^-?\d+$/,a;if(typeof i>"u"){if(s)throw new c("attribute: "+t+" is a required attribute");return n}if(r.test(i))a=this.IntegerValue(i);else throw new se("Invalid "+t+' attribute "'+i+'"');return a}validateIdentifierAttribute(t){if(t!=null&&t.length!=t.trim().length)throw new c('Invalid identifier "'+t+'". Whitespace not permitted.');if(t==null||t.length==0)throw new c('Invalid identifier "'+t+'". Length is not valid.');if(!this.isCharacterALetter(t.charAt(0))&&!this.isCharacterADigit(t.charAt(0))&&t.charAt(0)!=="_")throw new c('Invalid identifier "'+t+'". First character "'+t.charAt(0)+'" is not valid.');for(let i=1;i<t.length;i++)if(!this.isCharacterALetterOrDigit(t.charAt(i))&&t.charAt(i)!=="_"&&t.charAt(i)!=="-"&&t.charAt(i)!==".")throw new c('Invalid identifier "'+t+'". Character "'+t.charAt(i)+'" at position '+(i+1)+" is not valid.")}validateFloatAttribute(t,i,s,n){let r=/^[-+]?([0-9]*\.[0-9]+|[0-9]+)$/,a;if(typeof i>"u"){if(s)throw new c("attribute: "+t+" is a required attribute");return n}if(r.test(i))a=this.FloatValue(i);else throw new se("Invalid "+t+' attribute "'+i+'"');return a}validateResponseIdentifierAttribute(t,i){this.validateIdentifierAttribute(i);let s=t.getResponseDeclaration(i);if(typeof s>"u")throw new c('No response declaration found for response-identifier: "'+i+'"');return s}validateOutcomeIdentifierAttribute(t,i){this.validateIdentifierAttribute(i);let s=t.getOutcomeDeclaration(i);if(typeof s>"u")throw new c('No outcome declaration found for identifier: "'+i+'"');return s}validateTemplateIdentifierAttribute(t,i){this.validateIdentifierAttribute(i);let s=t.getTemplateDeclaration(i);if(typeof s>"u")throw new c('No template declaration found for identifier: "'+i+'"');return s}validateTemplateOrOutcomeIdentifierAttribute(t,i){this.validateIdentifierAttribute(i);let s=t.getTemplateDeclaration(i);if(typeof s<"u"||(s=t.getOutcomeDeclaration(i),typeof s<"u"))return s;throw new c('No outcome or template declaration found for identifier: "'+i+'"')}validateVariableIdentifierAttribute(t,i){this.validateIdentifierAttribute(i);let s=t.getOutcomeDeclaration(i);if(typeof s<"u"||(s=t.getResponseDeclaration(i),typeof s<"u")||(s=t.getContextDeclaration(i),typeof s<"u")||(s=t.getTemplateDeclaration(i),typeof s<"u"))return s;throw new c('No declaration found for identifier: "'+i+'"')}validatePrintedVariableIdentifierAttribute(t,i){if(typeof i>"u")throw new c('Attribute "identifier" is undefined');this.validateIdentifierAttribute(i);let s=t.getOutcomeDeclaration(i);if(typeof s<"u"||(s=t.getTemplateDeclaration(i),typeof s<"u")||(s=t.getContextDeclaration(i),typeof s<"u"))return s;throw new c('No declaration found for identifier: "'+i+'"')}validateMaxMinChoices(t,i){let s=this.validatePositiveIntegerAttribute("max-choices",t),n=this.validatePositiveIntegerAttribute("min-choices",i);if(s>0&&n>s)throw new c('Invalid min-choices attribute "'+i+'". Must be less than or equal to max-choices attribute when max-choices attribute is greater than 0')}validateMaxMinStrings(t,i){let s=this.validatePositiveIntegerAttribute("max-strings",t),n=this.validatePositiveIntegerAttribute("min-strings",i);if(s>0&&n>s)throw new c('Invalid min-strings attribute "'+i+'". Must be less than or equal to max-strings attribute when max-strings attribute is greater than 0')}validateMaxMinPlays(t,i){let s=this.validatePositiveIntegerAttribute("max-plays",t),n=this.validatePositiveIntegerAttribute("min-plays",i);if(s>0&&n>s)throw new c('Invalid min-plays attribute "'+i+'". Must be less than or equal to max-plays attribute when max-plays attribute is greater than 0')}validatePattern(t,i){if(typeof i>"u")return null;if(i==null||i.length==0)throw new se("Invalid "+t+' "'+i+'". Length is not valid.');let s=i.trim();if(s.length==0)throw new se("Invalid "+t+' "'+i+'".');s=s.startsWith("^")?s.substring(1):s,s=s.endsWith("$")?s.substring(0,s.length-1):s,s=s.replaceAll("/","\\/");try{return new RegExp("^"+s+"$")}catch{throw new se("Unable to parse "+t+': "'+i+'""')}}validatePlaceholderText(t,i){return typeof t<"u"?t:i}validatePatternmaskMessage(t,i){return typeof t<"u"?t:i}validateCaseSensitive(t,i){if(typeof t>"u"){if(i)throw new c('Attribute "case-sensitive" is a required attribute');return!1}if(t==="true"||t==="1")return!0;if(t==="false"||t==="0")return!1;throw new c("Invalid case-sensitive attribute. Must be a Boolean value.")}validateIncludeBoundary(t,i){if(typeof t>"u"||t==="true"||t==="1")return!0;if(t==="false"||t==="0")return!1;throw new c("Invalid "+i+" attribute. Must be a Boolean value.")}validateValueFromBaseType(t,i){let s=null;try{switch(t){case"string":if(i===null||i.length===0)throw new se('Null string "'+i+'".');s=i;break;case"identifier":this.validateIdentifierAttribute(i),s=i;break;case"integer":s=this.IntegerValue(i);break;case"float":s=this.FloatValue(i);break;case"duration":s=this.DurationValue(i);break;default:throw new se('[Unhandled Attribute Value BaseType]: "'+t+'"')}}catch(n){if(n.name==="QtiValidationException")throw new c(n.message);if(n.name==="QtiParseException")throw new se(n.message)}return s}validateShowHideAttribute(t){if(typeof t>"u"||t==="show")return!0;if(t==="hide")return!1;throw new c('Invalid show-hide attribute: "'+t+'" Value must be "show" or "hide".')}validateShapeAttribute(t){if(typeof t>"u")return"";if(t==="circle")return"circle";if(t==="rect")return"rect";if(t==="poly")return"poly";if(t==="default")return"default";if(t==="ellipse")return"ellipse";throw new c('Invalid shape attribute: "'+t+'" Value must be "circle", "rect", "poly", "default", or "ellipse".')}validateToleranceModeAttribute(t){if(typeof t>"u")return!0;if(t==="exact")return"exact";if(t==="absolute")return"absoluate";if(t==="relative")return"relative";throw new c('Invalid tolerance-mode attribute: "'+t+'" Value must be "exact", "absolute", or "relative".')}validateRoundingModeAttribute(t){if(typeof t>"u")return!0;if(t==="decimalPlaces")return"decimalPlaces";if(t==="significantFigures")return"significantFigures";throw new c('Invalid rounding-mode attribute: "'+t+'" Value must be "decimalPlaces" or "significantFigures".')}validateMathOperatorNameAttribute(t){if(this.QTI_MATH_OPERATORS().includes(t))return!0;throw new c('Unsupported qti-math-operator "name" attribute: "'+t+'".')}validateMathConstantNameAttribute(t){if(this.QTI_MATH_CONSTANTS().includes(t))return!0;throw new c('Unsupported qti-math-constant "name" attribute: "'+t+'".')}validateStatsOperatorNameAttribute(t){if(this.QTI_STATS_OPERATORS().includes(t))return!0;throw new c('Unsupported qti-stats-operator "name" attribute: "'+t+'".')}validateToleranceAttribute(t){if(t===null||t.length===0)return[];const i=t.split(" ");if(i.length===0)throw new c('Unable to parse tolerance attribute: "'+t+'"');if(i.length<3)try{if(i.length===1){const s=new X(this.FloatValue(i[0]));if(s.comparedTo(new X(0))<0)throw new c('Tolerance attribute: "'+s.valueOf()+'" cannot be negative.');return[s,s]}else if(i.length===2){const s=new X(this.FloatValue(i[0]));if(s.comparedTo(new X(0))<0)throw new c('Tolerance attribute: "'+s.valueOf()+'" cannot be negative.');const n=new X(this.FloatValue(i[1]));if(n.comparedTo(new X(0))<0)throw new c('Tolerance attribute: "'+n.valueOf()+'" cannot be negative.');return[s,n]}}catch(s){if(s.name==="QtiValidationException")throw new c(s.message);if(s.name==="QtiParseException")throw new se(s.message)}else if(i.length>=3)throw new c('Invalid tolerance attribute: "'+t+'". Value must contain 1 or 2 tolerances.')}validateRubricBlockViewAttribute(t){if(!this.QTI_RUBRICBLOCK_VIEWS().includes(t))throw new c('Invalid view attribute: "'+t+'".')}parseXmlLangAttribute(t){return typeof t>"u"?null:t}isCharacterALetter(t){return/[a-zA-Z]/.test(t)}isCharacterADigit(t){return/\d/.test(t)}isCharacterALetterOrDigit(t){return this.isCharacterALetter(t)||this.isCharacterADigit(t)}IntegerValue(t){if(t!=null&&(t=t.trim()),t==null||t.length==0)throw new se('Invalid integer "'+t+'". Length is not valid.');try{let i=parseInt(t,10);if(Number.isNaN(i))throw new se('Invalid integer "'+t+'". ');return i}catch(i){throw new se(i.message)}}FloatValue(t){if(t!=null&&(t=t.trim()),t==null||t.length==0)throw new se('Invalid float "'+t+'". Length is not valid.');try{let i=parseFloat(t);if(Number.isNaN(i))throw new se('Invalid float "'+t+'". ');return i}catch(i){throw new se(i.message)}}DurationValue(t){try{let i=new X(t);if(i.isZero()&&i.isNegative()&&(i=new X(0)),i.comparedTo(0)<0)throw new se('Invalid duration "'+i+'". Duration cannot be negative.');return i.toNumber()}catch(i){throw new se(i.message)}}randomString(t,i){i=i&&i.toLowerCase();let s="";const n=i=="a"?10:0,r=i=="n"?10:62;for(let a=0;a<t;a++){let o=Math.random()*(r-n)+n<<0;s+=String.fromCharCode(o+=o>9?o<36?55:61:48)}return s}kebabCase(t){return t.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g).join("-").toLowerCase()}isValidSlot(t){if(typeof t.type.name<"u")return!0;if(typeof t.type=="symbol"&&t.children.trim().length>0){if(t.type.toString()==="Symbol(v-cmt)")return!1;throw new c('Invalid Child Node: "'+t.children.trim()+'"')}return!1}}class _0{constructor(t){J(this,"constants",{keys:{ENTER:13,SPACE:32}});return this.audioElement=t,this.isPaused=!0,this.onPlayPauseClick=this.playPauseClickHandler.bind(this),this.onKeyDown=this.keydownHandler.bind(this),this.onEnded=this.endedHandler.bind(this),this}create(){return this.createAudioTemplate(this.isNestedAmpAudioElement(this.audioElement)),this}isNestedAmpAudioElement(t){return t.parentNode.classList.contains("amp-audio__holder")}createAudioTemplate(t){this.outerWrapper=t?this.createNestedAmpAudioWrapper(this.audioElement):this.createAudioWrapper(this.audioElement),this.playerContainer=this.createPlayerContainer(),this.outerWrapper.appendChild(this.playerContainer),this.addListeners()}createNestedAmpAudioWrapper(t){const i=t.parentNode.parentNode;i.classList.add("cat-audio__wrapper");const s=i.querySelector(".amp-audio-captions__container");s!=null&&s.remove();const n=i.querySelector(".amp-audio__container");return n!=null&&n.remove(),i}createAudioWrapper(t){const i=document.createElement("div");i.classList.add("cat-audio__wrapper");const s=document.createElement("div");return s.classList.add("cat-audio__holder"),t.parentNode.appendChild(i),t.setAttribute("tabindex","-1"),i.appendChild(s),s.appendChild(t),i}createPlayerContainer(){const t=document.createElement("div");return t.classList.add("cat-audio__container"),t.appendChild(this.createPlayPauseButton()),t}createPlayPauseButton(){const t=document.createElement("button");return t.classList.add("cat-audio-playpause__container"),t.classList.add("play"),t.setAttribute("tabindex","0"),t}addListeners(){this.playButton=this.playerContainer.querySelector(".cat-audio-playpause__container"),this.playButton.addEventListener("click",this.onPlayPauseClick),this.playButton.addEventListener("keydown",this.onKeyDown),this.audioElement.addEventListener("ended",this.onEnded)}removeListeners(){this.playButton.removeEventListener("click",this.onPlayPauseClick),this.playButton.removeEventListener("keydown",this.onKeyDown),this.audioElement.removeEventListener("ended",this.onEnded)}playPauseClickHandler(){this.toggleAudio()}keydownHandler(t){let i=!1;switch(t.keyCode){case this.constants.keys.SPACE:case this.constants.keys.ENTER:this.toggleAudio(),i=!0;break}i&&(t.stopPropagation(),t.preventDefault())}endedHandler(){this.playButton.classList.remove("pause"),this.playButton.classList.add("play"),this.isPaused=!0}toggleAudio(){this.isPaused?this.play():this.pause()}play(){this.playButton.classList.remove("play"),this.playButton.classList.add("pause"),this.isPaused=!1,this.audioElement.play()}pause(){this.playButton.classList.remove("pause"),this.playButton.classList.add("play"),this.isPaused=!0,this.audioElement.pause()}}class I0{constructor(t){J(this,"constants",{labels:{GLOSSARY:"Glossary",KEYWORD_TRANSLATION:"Translation",GLOSSARY_ILLUSTRATION:"Illustration"},cards:{GLOSSARY:"glossary",KEYWORD_TRANSLATION:"keywordTranslation",GLOSSARY_ILLUSTRATION:"glossaryIllustration"},keys:{ENTER:13,SPACE:32,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40},direction:{37:-1,38:-1,39:1,40:1}});return this.element=t,this.idList=this.createIds(),this.tabElements=[],this.tabPanelElements=[],this.audioPlayers=[],this.onTabClick=this.tabClickHandler.bind(this),this.onKeyDown=this.keydownHandler.bind(this),this.onKeyUp=this.keyupHandler.bind(this),this}create(t){this.unbindTabListEvents();const i=this.constants.cards.GLOSSARY in t,s=this.constants.cards.KEYWORD_TRANSLATION in t,n=this.constants.cards.GLOSSARY_ILLUSTRATION in t,r=this.tabList(i,s,n);if(r.length==0){this.element.innerHTML="";return}let a="",o="",u="",h="",f="",m="";for(let y=0;y<r.length;y++)y==0&&(a=this.createTabButton(this.idList.tabIds[y],this.idList.tabPanelIds[y],r[y],!0),o=this.tabPanel(r[y],y,t,0)),y==1&&(u=this.createTabButton(this.idList.tabIds[y],this.idList.tabPanelIds[y],r[y],!1),h=this.tabPanel(r[y],y,t,-1)),y==2&&(f=this.createTabButton(this.idList.tabIds[y],this.idList.tabPanelIds[y],r[y],!1),m=this.tabPanel(r[y],y,t,-1));const w=`<div id="${this.idList.tabWrapperId}" class="qti3-player-cat-tabs">
66
66
  <div role="tablist" aria-orientation="horizontal" aria-label="Glossary Tab List">
67
67
  ${a}
68
68
  ${u}
@@ -79,12 +79,12 @@ https://sweetalert2.github.io/#ajax-request`),g0(e),typeof e.title=="string"&&(e
79
79
  role="tabpanel"
80
80
  class="${n===-1?"hidden":""}"
81
81
  id="${i}"
82
- aria-labelledby="${t}">${s}</div>`}createIds(){const t={tabWrapperId:"",tabIds:[],tabPanelIds:[]};t.tabWrapperId="catalog-tabwrapper-"+this.randomString(5,"a");for(let i=0;i<3;i++){const s=this.randomString(5,"a");t.tabIds.push("catalog-"+i+"-tab-"+s),t.tabPanelIds.push("catalog-"+i+"-tabpanel-"+s)}return t}tabList(t,i,s){let n=[];return t&&n.push(this.constants.labels.GLOSSARY),i&&n.push(this.constants.labels.KEYWORD_TRANSLATION),s&&n.push(this.constants.labels.GLOSSARY_ILLUSTRATION),n}bindTabListEvents(){const t=document.getElementById(this.idList.tabWrapperId);if(t!==null&&(this.tabElements=t.querySelectorAll('[role="tab"]'),this.tabPanelElements=t.querySelectorAll('[role="tabpanel"]'),this.tabElements.length==this.tabPanelElements.length)){for(let i=0;i<this.tabElements.length;++i)this.addListeners(this.tabElements[i],this.tabPanelElements[i],i);this.bindTabAudioPlayers()}}unbindTabListEvents(){this.removeListeners(),this.unbindTabAudioPlayers()}bindTabAudioPlayers(){this.element.querySelectorAll("audio").forEach(i=>{const s=new _0(i).create();this.audioPlayers.push(s)},this)}unbindTabAudioPlayers(){this.audioPlayers.forEach(t=>{t.removeListeners()},this),this.audioPlayers.splice(0,this.audioPlayers.length)}addListeners(t,i,s){t.addEventListener("click",this.onTabClick),t.addEventListener("keydown",this.onKeyDown),t.addEventListener("keyup",this.onKeyUp),t.index=s}removeListeners(){this.tabElements.forEach(t=>{t.removeEventListener("click",this.onTabClick),t.removeEventListener("keydown",this.onKeyDown),t.removeEventListener("keyup",this.onKeyUp)},this)}tabClickHandler(t){var i=t.target;this.activateTab(i,!1)}keydownHandler(t){switch(t.keyCode){case this.constants.keys.END:t.preventDefault(),this.focusLastTab();break;case this.constants.keys.HOME:t.preventDefault(),this.focusFirstTab();break;case this.constants.keys.UP:case this.constants.keys.DOWN:this.switchTabOnArrowPress(t);break}}switchTabOnArrowPress(t){const i=t.keyCode;if(this.constants.direction[i]){let s=t.target;if(s.index!==void 0){if(this.tabElements[s.index+this.constants.direction[i]]){this.tabElements[s.index+this.constants.direction[i]].focus();return}if(i===this.constants.keys.LEFT||i===this.constants.keys.UP){this.focusLastTab();return}(i===this.constants.keys.RIGHT||i==this.constants.keys.DOWN)&&this.focusFirstTab()}}}keyupHandler(t){switch(t.keyCode){case this.constants.keys.LEFT:case this.constants.keys.RIGHT:this.switchTabOnArrowPress(t);break;case this.constants.keys.ENTER:case this.constants.keys.SPACE:this.activateTab(t.target);break}}activateTab(t,i){i=i||!0,this.deactivateTabs(),t.setAttribute("aria-selected","true");let s=t.getAttribute("aria-controls");document.getElementById(s).classList.remove("hidden"),i&&t.focus()}deactivateTabs(){this.audioPlayers.forEach(t=>{t.pause()},this),this.tabElements.forEach(t=>{t.setAttribute("aria-selected","false")},this),this.tabPanelElements.forEach(t=>{t.classList.add("hidden")},this)}focusFirstTab(){this.tabElements[0].focus()}focusLastTab(){this.tabElements[this.tabElements.length-1].focus()}randomString(t,i){i=i&&i.toLowerCase();let s="";const n=i=="a"?10:0,r=i=="n"?10:62;for(let a=0;a<t;a++){let o=Math.random()*(r-n)+n<<0;s+=String.fromCharCode(o+=o>9?o<36?55:61:48)}return s}}const B=(e,t)=>{const i=e.__vccOpts||e;for(const[s,n]of t)i[s]=n;return i},V0={name:"CatalogDialog",data(){return{state:{isShown:!1,dragging:!1,hidden:!0,xDiff:0,yDiff:0,x:0,y:0},content:{term:""},tabs:null}},methods:{setContent(e){this.resetDialogContent(),this.setDialogTerm(e.term),this.setDialogContent(e),this.createTabs(this.content)},setDialogContent(e){"data"in e&&e.data.forEach(t=>{switch(t.support){case"glossary-on-screen":this.setDialogGlossary(t.card);break;case"keyword-translation":this.setDialogKeywordTranslation(t.card);break;case"ext:sbac-glossary-illustration":this.setDialogGlossaryIllustration(t.card);break}},this)},resetDialogContent(){"glossary"in this.content&&delete this.content.glossary,"keywordTranslation"in this.content&&delete this.content.keywordTranslation,"glossaryIllustration"in this.content&&delete this.content.glossaryIllustration},setDialogTerm(e){this.content.term=e},setDialogGlossary(e){this.content.glossary=e},setDialogKeywordTranslation(e){this.content.keywordTranslation=e},setDialogGlossaryIllustration(e){this.content.glossaryIllustration=e},createTabs(e){this.tabs.create(e)},show(){this.state.hidden=!1,this.render(),this.state.isShown||(this.state.isShown=!0,this.center())},hide(){this.state.hidden=!0,this.render()},center(){this.$refs.dialog.style.top=window.innerHeight/2-this.$refs.dialog.offsetHeight/2+"px",this.$refs.dialog.style.left=window.innerWidth/2-this.$refs.dialog.offsetWidth/2+"px"},reset(){this.state.x=0,this.state.y=0,this.state.isShown=!1,this.state.hidden=!0,this.render()},render(){this.state.hidden?this.$refs.dialog.style.display="none":this.$refs.dialog.style.display="",this.$refs.dialog.style.transform="translate("+this.state.x+"px, "+this.state.y+"px)"},addListeners(){this.$refs.header.addEventListener("mousedown",this.onMouseDown.bind(this)),this.$refs.header.addEventListener("mousemove",this.onMouseMove.bind(this)),this.$refs.header.addEventListener("mouseup",this.onMouseUp.bind(this)),this.$refs.header.addEventListener("mouseleave",this.onMouseUp.bind(this)),this.$refs.header.addEventListener("touchstart",this.onTouchStart.bind(this)),this.$refs.header.addEventListener("touchmove",this.onTouchMove.bind(this)),this.$refs.header.addEventListener("touchend",this.onTouchEnd.bind(this)),this.$refs.close.addEventListener("click",this.hide.bind(this)),this.$refs.close.addEventListener("touchend",this.hide.bind(this))},removeListeners(){this.$refs.header.removeEventListener("mousedown",this.onMouseDown),this.$refs.header.removeEventListener("mousemove",this.onMouseMove),this.$refs.header.removeEventListener("mouseup",this.onMouseUp),this.$refs.header.removeEventListener("mouseleave",this.onMouseUp),this.$refs.header.removeEventListener("touchstart",this.onTouchStart),this.$refs.header.removeEventListener("touchmove",this.onTouchMove),this.$refs.header.removeEventListener("touchend",this.onTouchEnd),this.$refs.close.removeEventListener("click",this.hide),this.$refs.close.removeEventListener("touchend",this.hide)},onMouseDown(e){this.state.dragging=!0,this.state.xDiff=e.pageX-this.state.x,this.state.yDiff=e.pageY-this.state.y},onTouchStart(e){e.preventDefault(),this.state.dragging=!0,this.state.xDiff=e.targetTouches[0].pageX-this.state.x,this.state.yDiff=e.targetTouches[0].pageY-this.state.y},onMouseMove(e){this.state.dragging&&(this.state.x=e.pageX-this.state.xDiff,this.state.y=e.pageY-this.state.yDiff),this.render()},onTouchMove(e){e.preventDefault(),e.stopPropagation(),this.state.dragging&&(this.state.x=e.targetTouches[0].pageX-this.state.xDiff,this.state.y=e.targetTouches[0].pageY-this.state.yDiff),this.render()},onMouseUp(){this.state.dragging=!1},onTouchEnd(e){e.preventDefault(),this.state.dragging=!1}},mounted(){this.tabs=new I0(this.$refs.body),this.addListeners()},beforeUnmount(){this.tabs.removeListeners(),this.removeListeners()}},A0={ref:"dialog",class:"qti3-player-cat-dialog",role:"dialog",style:{display:"none"}},$0={ref:"header",class:"qti3-player-cat-dialog-header"},L0={class:"qti3-player-cat-dialog-term"},M0={ref:"close",type:"button",class:"qti3-player-cat-dialog-close","aria-label":"Close"},N0={ref:"body",class:"qti3-player-cat-dialog-body"};function R0(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",A0,[l.createElementVNode("div",$0,[l.createElementVNode("span",L0,l.toDisplayString(n.content.term),1),l.createElementVNode("button",M0,"×",512)],512),l.createElementVNode("div",N0,null,512)],512)}const k0=B(V0,[["render",R0]]),q0={name:"AmpStyle",render(){return l.h("style",{},this.$slots.default())}},O0=new G,B0={name:"AmpAudio",emits:["mediaLoaded","mediaEnded","mediaMounted"],props:{},data(){return{audio:null,audioSubType:null,currentTime:0,duration:0,displayCurrentTime:"00:00",displayDuration:"00:00",audioLoaded:!1,isPlaying:!1,isMuted:!1,isTimeUpdateListening:!0,showPlayTimer:!1,showVolumeMute:!1,showProgress:!1,showCaptions:!1,textTracksMap:null,mediaInteractionChild:!1,isDisabled:!1,isQtiValid:!0}},methods:{disable(){this.isDisabled=!0,this.pauseAudio(),this.disableController()},enable(){this.isDisabled=!1,this.enableController()},disableController(){this.$refs.playpause.setAttribute("tabindex","-1"),this.$refs.playpause.classList.add("disabled"),this.$refs.progress.setAttribute("tabindex","-1"),this.$refs.progress.classList.add("disabled"),this.$refs.volume.setAttribute("tabindex","-1"),this.$refs.volume.classList.add("disabled"),this.$refs.playtimer.classList.add("disabled")},enableController(){this.$refs.playpause.setAttribute("tabindex","0"),this.$refs.playpause.classList.remove("disabled"),(this.isMediaInteractionChild()||this.audioSubType==="audioprogress")&&(this.$refs.progress.setAttribute("tabindex","0"),this.$refs.progress.classList.remove("disabled"),this.$refs.volume.setAttribute("tabindex","0"),this.$refs.volume.classList.remove("disabled"),this.$refs.playtimer.classList.remove("disabled"))},handleLoaded(){this.audio&&(this.addControllerEventListeners(),this.duration=Math.round(this.audio.duration),this.displayDuration=this.convertTime(this.duration),this.isMediaInteractionChild()&&this.$parent.$emit("mediaLoaded",{node:this}))},handleEnded(){this.isPlaying=!1,this.isMediaInteractionChild()&&this.$parent.$emit("mediaEnded",{})},handleCanPlay(){this.audioLoaded=!0},handleTimeUpdate(){if(!this.isTimeUpdateListening)return;let e=Math.round(this.audio.currentTime);this.currentTime=e,this.displayCurrentTime=this.convertTime(e)},handlePlayPauseClick(){this.isDisabled||this.toggleAudio()},handlePlayPauseKeydown(e){if(this.isDisabled)return;let t=!1;switch(e.code){case"Space":case"Enter":this.toggleAudio(),t=!0;break}t&&(e.stopPropagation(),e.preventDefault())},handleProgressMouseDown(){this.isDisabled||(this.isTimeUpdateListening=!1,this.audio.paused?this.wasPlaying=!1:(this.wasPlaying=!0,this.audio.pause(),this.isPlaying=!1))},handleProgressInput(e){this.isDisabled||(this.displayCurrentTime=this.convertTime(e.target.valueAsNumber))},handleProgressChange(e){this.isDisabled||(this.setPosition(e.target.valueAsNumber),this.isTimeUpdateListening=!0,this.wasPlaying&&this.audio.paused&&(this.wasPlaying=!1,this.toggleAudio()))},handleVolumeMuteClick(){this.isDisabled||this.toggleVolume()},handleVolumeMuteKeydown(e){if(this.isDisabled)return;let t=!1;switch(e.code){case"Space":case"Enter":this.toggleVolume(),t=!0;break}t&&(e.stopPropagation(),e.preventDefault())},handleCueChange(e){const t=e.target.activeCues;if(t.length>0&&this.showCaptions){const i=t[0].text.replace(/\n/g,"<br/>");console.log("[AmpAudio][currentCue]",i),this.$refs.captions.innerHTML=i}},setPosition(e){this.audio.currentTime=e,this.displayCurrentTime=this.convertTime(e)},toggleAudio(){this.audio&&(this.isPlaying?(this.isPlaying=!1,this.audio.pause()):(this.isPlaying=!0,this.audio.play()))},playAudio(){this.audio&&(this.audio.play(),this.isPlaying=!0)},pauseAudio(){this.audio&&(this.audio.pause(),this.isPlaying=!1)},toggleVolume(){this.audio&&(this.audio.muted?(this.audio.muted=!1,this.isMuted=!1):(this.audio.muted=!0,this.isMuted=!0))},initSlider(){this.audio&&(this.duration=Math.round(this.audio.duration))},convertTime(e){let t=new Date(e*1e3).toISOString().substr(11,8);return t.indexOf("00:")===0&&(t=t.substr(3)),t},setAudioSubType(e){this.audioSubType=e,this.audioSubType==="audioprogress"&&(this.showProgress=!0,this.showPlayTimer=!0,this.showVolumeMute=!0)},getAudioSubType(e){if(e===null)return null;const t=e.class;if(typeof t>"u"||t===null||t.length==0)return null;const i=t.split(" ");for(let s=0;s<i.length;s++)switch(i[s]){case"sbaudio":case"audioprogress":return this.showProgress=!0,this.showPlayTimer=!0,this.showVolumeMute=!0,"audioprogress"}return null},detectAudioSubType(e){return this.getAudioSubType(e)},isMediaInteractionChild(){return this.mediaInteractionChild},detectMediaInteractionChild(){this.mediaInteractionChild=this.$parent.$el.classList.contains("qti3-player-media-group")},processChildren(){this.audio=this.$refs.player,this.audio.removeAttribute("controls"),this.audio.removeAttribute("autoplay"),this.textTracksMap=this.filterTextTracks(this.audio.querySelectorAll("track"))},filterTextTracks(e){let t=new Map;return e.forEach(i=>{switch(i.getAttribute("kind")){case"subtitles":case"captions":i.hasAttribute("id")||i.setAttribute("id","track-"+O0.randomString(5,"a")),t.set(i.getAttribute("id"),i);break}},this),t},isDefaultTextTrack(e){return e.hasAttribute("default")},addTextTrackCueEventListener(){this.audio&&this.audio.textTracks.length!==0&&this.audio.textTracks.forEach(e=>{const t=this.textTracksMap.get(e.id);if(typeof t<"u"&&this.isDefaultTextTrack(t)){e.addEventListener("cuechange",this.handleCueChange);return}},this)},removeTextTrackCueEventListener(){this.audio&&this.audio.textTracks.length!==0&&this.audio.textTracks.forEach(e=>{const t=this.textTracksMap.get(e.id);if(typeof t<"u"&&this.isDefaultTextTrack(t)){e.removeEventListener("cuechange",this.handleCueChange);return}},this)},addControllerEventListeners(){this.$refs.playpause.addEventListener("click",this.handlePlayPauseClick),this.$refs.playpause.addEventListener("keydown",this.handlePlayPauseKeydown),this.$refs.progress.addEventListener("input",this.handleProgressInput),this.$refs.progress.addEventListener("change",this.handleProgressChange),this.$refs.progress.addEventListener("mousedown",this.handleProgressMouseDown),this.$refs.volume.addEventListener("click",this.handleVolumeMuteClick),this.$refs.volume.addEventListener("keydown",this.handleVolumeMuteKeydown)},removeControllerEventListeners(){this.$refs.playpause.removeEventListener("click",this.handlePlayPauseClick),this.$refs.playpause.removeEventListener("keydown",this.handlePlayPauseKeydown),this.$refs.progress.removeEventListener("input",this.handleProgressInput),this.$refs.progress.removeEventListener("change",this.handleProgressChange),this.$refs.progress.removeEventListener("mousedown",this.handleProgressMouseDown),this.$refs.volume.removeEventListener("click",this.handleVolumeMuteClick),this.$refs.volume.removeEventListener("keydown",this.handleVolumeMuteKeydown)}},created(){this.setAudioSubType(this.detectAudioSubType(this.$.vnode.props))},mounted(){if(this.isQtiValid)try{if(this.detectMediaInteractionChild(),this.processChildren(),this.$nextTick(function(){this.audio&&(this.audio.addEventListener("loadedmetadata",this.handleLoaded),this.audio.addEventListener("canplay",this.handleCanPlay),this.audio.addEventListener("timeupdate",this.handleTimeUpdate),this.audio.addEventListener("ended",this.handleEnded),this.addTextTrackCueEventListener())}),this.isMediaInteractionChild()){this.$parent.$emit("mediaMounted",{node:this,mediaType:"audio"});return}this.enable()}catch(e){throw this.isQtiValid=!1,new c(e.message)}},beforeUnmount(){this.audio&&(this.audio.removeEventListener("loadedmetadata",this.handleLoaded),this.audio.removeEventListener("canplay",this.handleCanPlay),this.audio.removeEventListener("timeupdate",this.handleTimeUpdate),this.audio.removeEventListener("ended",this.handleEnded),this.removeTextTrackCueEventListener()),this.removeControllerEventListeners()}},P0={class:"amp-audio"},D0={class:"amp-audio__holder"},Q0={ref:"controller",class:"amp-audio__container"},H0={ref:"playpause",class:"amp-audio-playpause__container"},F0={class:"amp-playpause-button",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},U0={class:"amp-playpause-button",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},G0={ref:"playtimer",class:"amp-playtimer__container"},j0={class:"amp-progress__container"},W0=["max"],z0={ref:"volume",class:"amp-video-volumemute__container","aria-label":"Volume mute or unmute"},K0={class:"amp-volumemute-button","aria-hidden":"true",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 576 512"},Y0={class:"amp-volumemute-button","aria-hidden":"true",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"},X0={class:"amp-audio-captions__container hidden"},Z0={class:"amp-audio-captions",ref:"captions"};function J0(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",P0,[l.createElementVNode("div",D0,[l.createElementVNode("audio",l.mergeProps({ref:"player",tabIndex:"-1"},e.$attrs),[l.renderSlot(e.$slots,"default",{},void 0,!0)],16)]),l.createElementVNode("div",Q0,[l.createElementVNode("button",H0,[l.withDirectives((l.openBlock(),l.createElementBlock("svg",F0,t[1]||(t[1]=[l.createElementVNode("path",{"fill-rule":"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM9.555 7.168A1 1 0 008 8v4a1 1 0 001.555.832l3-2a1 1 0 000-1.664l-3-2z","clip-rule":"evenodd"},null,-1)]),512)),[[l.vShow,!n.isPlaying]]),l.withDirectives((l.openBlock(),l.createElementBlock("svg",U0,t[2]||(t[2]=[l.createElementVNode("path",{"fill-rule":"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zM7 8a1 1 0 012 0v4a1 1 0 11-2 0V8zm5-1a1 1 0 00-1 1v4a1 1 0 102 0V8a1 1 0 00-1-1z","clip-rule":"evenodd"},null,-1)]),512)),[[l.vShow,n.isPlaying]])],512),l.withDirectives(l.createElementVNode("div",G0,[l.createElementVNode("span",null,l.toDisplayString(n.displayCurrentTime),1),t[3]||(t[3]=l.createElementVNode("span",null," / ",-1)),l.createElementVNode("span",null,l.toDisplayString(n.displayDuration),1)],512),[[l.vShow,n.showPlayTimer]]),l.withDirectives(l.createElementVNode("div",j0,[l.withDirectives(l.createElementVNode("input",{ref:"progress","onUpdate:modelValue":t[0]||(t[0]=a=>n.currentTime=a),type:"range",min:"0",max:n.duration,class:"slider"},null,8,W0),[[l.vModelText,n.currentTime]])],512),[[l.vShow,n.showProgress]]),l.withDirectives(l.createElementVNode("div",z0,[l.withDirectives((l.openBlock(),l.createElementBlock("svg",K0,t[4]||(t[4]=[l.createElementVNode("path",{fill:"currentColor",d:"M215.03 71.05L126.06 160H24c-13.26 0-24 10.74-24 24v144c0 13.25 10.74 24 24 24h102.06l88.97 88.95c15.03 15.03 40.97 4.47 40.97-16.97V88.02c0-21.46-25.96-31.98-40.97-16.97zm233.32-51.08c-11.17-7.33-26.18-4.24-33.51 6.95-7.34 11.17-4.22 26.18 6.95 33.51 66.27 43.49 105.82 116.6 105.82 195.58 0 78.98-39.55 152.09-105.82 195.58-11.17 7.32-14.29 22.34-6.95 33.5 7.04 10.71 21.93 14.56 33.51 6.95C528.27 439.58 576 351.33 576 256S528.27 72.43 448.35 19.97zM480 256c0-63.53-32.06-121.94-85.77-156.24-11.19-7.14-26.03-3.82-33.12 7.46s-3.78 26.21 7.41 33.36C408.27 165.97 432 209.11 432 256s-23.73 90.03-63.48 115.42c-11.19 7.14-14.5 22.07-7.41 33.36 6.51 10.36 21.12 15.14 33.12 7.46C447.94 377.94 480 319.54 480 256zm-141.77-76.87c-11.58-6.33-26.19-2.16-32.61 9.45-6.39 11.61-2.16 26.2 9.45 32.61C327.98 228.28 336 241.63 336 256c0 14.38-8.02 27.72-20.92 34.81-11.61 6.41-15.84 21-9.45 32.61 6.43 11.66 21.05 15.8 32.61 9.45 28.23-15.55 45.77-45 45.77-76.88s-17.54-61.32-45.78-76.86z"},null,-1)]),512)),[[l.vShow,!n.isMuted]]),l.withDirectives((l.openBlock(),l.createElementBlock("svg",Y0,t[5]||(t[5]=[l.createElementVNode("path",{fill:"currentColor",d:"M215.03 71.05L126.06 160H24c-13.26 0-24 10.74-24 24v144c0 13.25 10.74 24 24 24h102.06l88.97 88.95c15.03 15.03 40.97 4.47 40.97-16.97V88.02c0-21.46-25.96-31.98-40.97-16.97zM461.64 256l45.64-45.64c6.3-6.3 6.3-16.52 0-22.82l-22.82-22.82c-6.3-6.3-16.52-6.3-22.82 0L416 210.36l-45.64-45.64c-6.3-6.3-16.52-6.3-22.82 0l-22.82 22.82c-6.3 6.3-6.3 16.52 0 22.82L370.36 256l-45.63 45.63c-6.3 6.3-6.3 16.52 0 22.82l22.82 22.82c6.3 6.3 16.52 6.3 22.82 0L416 301.64l45.64 45.64c6.3 6.3 16.52 6.3 22.82 0l22.82-22.82c6.3-6.3 6.3-16.52 0-22.82L461.64 256z"},null,-1)]),512)),[[l.vShow,n.isMuted]])],512),[[l.vShow,n.showVolumeMute]])],512),l.createElementVNode("div",X0,[l.createElementVNode("div",Z0,null,512)])])}const eT=B(B0,[["render",J0],["__scopeId","data-v-b0ac2e17"]]),tT=new G,iT={name:"AmpVideo",emits:["mediaLoaded","mediaEnded","mediaMounted"],props:{},data(){return{video:null,playerSubType:null,currentTime:0,duration:0,displayCurrentTime:"00:00",displayDuration:"00:00",videoLoaded:!1,isPlaying:!1,isMuted:!1,isTimeUpdateListening:!0,showPlayTimer:!1,showVolumeMute:!1,showProgress:!1,showCaptions:!1,textTracksMap:null,mediaInteractionChild:!1,subtitlesMenu:null,subtitleMenuButtons:[],isDisabled:!1,isQtiValid:!0}},methods:{disable(){this.isDisabled=!0,this.pauseVideo(),this.disableController()},enable(){this.isDisabled=!1,this.enableController()},disableController(){this.$refs.playpause.setAttribute("tabindex","-1"),this.$refs.playpause.classList.add("disabled"),this.$refs.progress.setAttribute("tabindex","-1"),this.$refs.progress.classList.add("disabled"),this.$refs.cc.setAttribute("tabindex","-1"),this.$refs.cc.classList.add("disabled"),this.$refs.volume.setAttribute("tabindex","-1"),this.$refs.volume.classList.add("disabled"),this.$refs.playtimer.classList.add("disabled")},enableController(){this.$refs.playpause.setAttribute("tabindex","0"),this.$refs.playpause.classList.remove("disabled"),this.$refs.progress.setAttribute("tabindex","0"),this.$refs.progress.classList.remove("disabled"),this.$refs.cc.setAttribute("tabindex","0"),this.$refs.cc.classList.remove("disabled"),this.$refs.volume.setAttribute("tabindex","0"),this.$refs.volume.classList.remove("disabled"),this.$refs.playtimer.classList.remove("disabled")},handleLoaded(){this.video&&(this.addControllerEventListeners(),this.duration=Math.round(this.video.duration),this.displayDuration=this.convertTime(this.duration),this.isMediaInteractionChild()&&this.$parent.$emit("mediaLoaded",{node:this}))},handleEnded(){this.isPlaying=!1,this.isMediaInteractionChild()&&this.$parent.$emit("mediaEnded",{})},handleCanPlay(){this.videoLoaded=!0},handleTimeUpdate(){if(!this.isTimeUpdateListening||!this.video)return;let e=Math.round(this.video.currentTime);this.currentTime=e,this.displayCurrentTime=this.convertTime(e)},handlePlayPauseClick(){this.isDisabled||this.toggleVideo()},handlePlayPauseKeydown(e){if(this.isDisabled)return;let t=!1;switch(e.code){case"Space":case"Enter":this.toggleVideo(),t=!0;break}t&&(e.stopPropagation(),e.preventDefault())},handleProgressMouseDown(){this.isDisabled||(this.isTimeUpdateListening=!1,this.video.paused?this.wasPlaying=!1:(this.wasPlaying=!0,this.video.pause(),this.isPlaying=!1))},handleProgressInput(e){this.isDisabled||(this.displayCurrentTime=this.convertTime(e.target.valueAsNumber))},handleProgressChange(e){this.isDisabled||(this.setPosition(e.target.valueAsNumber),this.isTimeUpdateListening=!0,this.wasPlaying&&this.video.paused&&(this.wasPlaying=!1,this.toggleVideo()))},handleCaptionsClick(){this.isDisabled||this.toggleCaptionsMenu()},handleCaptionsKeydown(e){if(this.isDisabled)return;let t=!1;switch(e.code){case"Space":case"Enter":this.toggleCaptionsMenu(),t=!0;break}t&&(e.stopPropagation(),e.preventDefault())},toggleCaptionsMenu(){this.subtitlesMenu.style.display=this.subtitlesMenu.style.display==="block"?"none":"block"},handleVolumeMuteClick(){this.isDisabled||this.toggleVolume()},handleVolumeMuteKeydown(e){if(this.isDisabled)return;let t=!1;switch(e.code){case"Space":case"Enter":this.toggleVolume(),t=!0;break}t&&(e.stopPropagation(),e.preventDefault())},handleCueChange(){},setPosition(e){this.video.currentTime=e,this.displayCurrentTime=this.convertTime(e)},toggleVideo(){this.video&&(this.isPlaying?(this.isPlaying=!1,this.video.pause()):(this.isPlaying=!0,this.video.play()))},playVideo(){this.video&&(this.video.play(),this.isPlaying=!0)},pauseVideo(){this.video&&(this.video.pause(),this.isPlaying=!1)},toggleVolume(){this.video&&(this.video.muted?(this.video.muted=!1,this.isMuted=!1):(this.video.muted=!0,this.isMuted=!0))},initSlider(){this.video&&(this.duration=Math.round(this.video.duration))},convertTime(e){let t=new Date(e*1e3).toISOString().substr(11,8);return t.indexOf("00:")===0&&(t=t.substr(3)),t},getPlayerSubType(){return this.showProgress=!0,this.showPlayTimer=!0,this.showVolumeMute=!0,"ampvideo-default"},detectPlayerSubType(e){return this.getPlayerSubType(e)},isMediaInteractionChild(){return this.mediaInteractionChild},detectMediaInteractionChild(){this.mediaInteractionChild=this.$parent.$el.classList.contains("qti3-player-media-group")},processChildren(){if(this.video=this.$refs.player,this.video.removeAttribute("controls"),this.video.removeAttribute("autoplay"),this.video.hasAttribute("width")){const e=`${this.video.getAttribute("width")}`,t=e.endsWith("%")?`width:${e}`:`width:${e}px`;this.$refs.videocontainer.setAttribute("style",t),this.$refs.controller.setAttribute("style",t)}else this.video.setAttribute("width","100%");this.textTracksMap=this.filterTextTracks(this.video.querySelectorAll("track"))},filterTextTracks(e){let t=new Map;return e.forEach(i=>{switch(i.getAttribute("kind")){case"subtitles":case"captions":i.hasAttribute("id")||i.setAttribute("id","track-"+tT.randomString(5,"a")),t.set(i.getAttribute("id"),i);break}},this),t},isDefaultTextTrack(e){return e.hasAttribute("default")},addTextTrackCueEventListener(){if(this.video&&this.video.textTracks.length!==0){this.showCaptions=!0,this.initializeSubtitlesMenu();for(let e=0;e<this.video.textTracks.length;e++){const t=this.video.textTracks[e];t.mode="hidden",this.addSubtitlesMenuItem(t),typeof this.textTracksMap.get(t.id)<"u"&&t.addEventListener("cuechange",this.handleCueChange)}this.$refs.videocontainer.appendChild(this.subtitlesMenu)}},removeTextTrackCueEventListener(){if(this.video&&this.video.textTracks.length!==0){this.subtitleMenuButtons.forEach(e=>{e.removeEventListener("click",this.handleSubtitleButtonClick)});for(let e=0;e<this.video.textTracks.length;e++){const t=this.video.textTracks[e];typeof this.textTracksMap.get(t.id)<"u"&&t.removeEventListener("cuechange",this.handleCueChange)}}},initializeSubtitlesMenu(){const e=document.createDocumentFragment();this.subtitlesMenu=e.appendChild(document.createElement("ul")),this.subtitlesMenu.className="ampvideo-subtitles-menu",this.subtitlesMenu.appendChild(this.createMenuItem("subtitles-off","","Off"))},addSubtitlesMenuItem(e){this.subtitlesMenu.appendChild(this.createMenuItem(`subtitles-${e.language}`,e.language,e.label))},createMenuItem(e,t,i){const s=document.createElement("li"),n=s.appendChild(document.createElement("button"));return n.setAttribute("id",e),n.className="ampvideo-subtitles-button",t.length>0&&n.setAttribute("lang",t),n.value=i,t===""?n.setAttribute("data-state","active"):n.setAttribute("data-state","inactive"),n.appendChild(document.createTextNode(i)),n.addEventListener("click",this.handleSubtitleButtonClick),this.subtitleMenuButtons.push(n),s},handleSubtitleButtonClick(e){const t=e.currentTarget;this.subtitleMenuButtons.forEach(s=>{s.setAttribute("data-state","inactive")});const i=t.getAttribute("lang");for(let s=0;s<this.video.textTracks.length;s++)this.video.textTracks[s].language===i?(this.video.textTracks[s].mode="showing",t.setAttribute("data-state","active")):this.video.textTracks[s].mode="hidden";i===null&&t.setAttribute("data-state","active"),this.subtitlesMenu.style.display="none"},addControllerEventListeners(){this.$refs.playpause.addEventListener("click",this.handlePlayPauseClick),this.$refs.playpause.addEventListener("keydown",this.handlePlayPauseKeydown),this.$refs.progress.addEventListener("input",this.handleProgressInput),this.$refs.progress.addEventListener("change",this.handleProgressChange),this.$refs.progress.addEventListener("mousedown",this.handleProgressMouseDown),this.$refs.cc.addEventListener("click",this.handleCaptionsClick),this.$refs.cc.addEventListener("keydown",this.handleCaptionsKeydown),this.$refs.volume.addEventListener("click",this.handleVolumeMuteClick),this.$refs.volume.addEventListener("keydown",this.handleVolumeMuteKeydown)},removeControllerEventListeners(){this.$refs.playpause.removeEventListener("click",this.handlePlayPauseClick),this.$refs.playpause.removeEventListener("keydown",this.handlePlayPauseKeydown),this.$refs.progress.removeEventListener("input",this.handleProgressInput),this.$refs.progress.removeEventListener("change",this.handleProgressChange),this.$refs.progress.removeEventListener("mousedown",this.handleProgressMouseDown),this.$refs.cc.removeEventListener("click",this.handleCaptionsClick),this.$refs.cc.removeEventListener("keydown",this.handleCaptionsKeydown),this.$refs.volume.removeEventListener("click",this.handleVolumeMuteClick),this.$refs.volume.removeEventListener("keydown",this.handleVolumeMuteKeydown)}},created(){this.playerSubType=this.detectPlayerSubType(this.$.vnode.props)},mounted(){if(this.isQtiValid)try{if(this.detectMediaInteractionChild(),this.processChildren(),this.$nextTick(function(){this.video&&(this.video.addEventListener("loadedmetadata",this.handleLoaded),this.video.addEventListener("canplay",this.handleCanPlay),this.video.addEventListener("timeupdate",this.handleTimeUpdate),this.video.addEventListener("ended",this.handleEnded),this.addTextTrackCueEventListener())}),this.isMediaInteractionChild()){this.$parent.$emit("mediaMounted",{node:this,mediaType:"video"});return}this.enable()}catch(e){throw this.isQtiValid=!1,new c(e.message)}},beforeUnmount(){this.video&&(this.video.removeEventListener("loadedmetadata",this.handleLoaded),this.video.removeEventListener("canplay",this.handleCanPlay),this.video.removeEventListener("timeupdate",this.handleTimeUpdate),this.video.removeEventListener("ended",this.handleEnded),this.removeTextTrackCueEventListener()),this.removeControllerEventListeners()}},sT={ref:"videocontainer",class:"amp-video"},nT={class:"amp-video__holder"},rT={ref:"controller",class:"amp-video__container"},aT={ref:"playpause",class:"amp-video-playpause__container"},oT={class:"amp-playpause-button",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},lT={class:"amp-playpause-button",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},cT={ref:"playtimer",class:"amp-playtimer__container"},uT={class:"amp-progress__container"},hT=["max"],dT={ref:"cc",class:"amp-video-cc__container","aria-label":"Captions menu"},fT={ref:"volume",class:"amp-video-volumemute__container","aria-label":"Volume mute or unmute"},pT={class:"amp-volumemute-button","aria-hidden":"true",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 576 512"},mT={class:"amp-volumemute-button","aria-hidden":"true",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"};function gT(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",sT,[l.createElementVNode("div",nT,[l.createElementVNode("video",l.mergeProps({ref:"player",tabIndex:"-1",class:"amp-video__video"},e.$attrs),[l.renderSlot(e.$slots,"default")],16)]),l.createElementVNode("div",rT,[l.createElementVNode("button",aT,[l.withDirectives((l.openBlock(),l.createElementBlock("svg",oT,t[1]||(t[1]=[l.createElementVNode("path",{"fill-rule":"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM9.555 7.168A1 1 0 008 8v4a1 1 0 001.555.832l3-2a1 1 0 000-1.664l-3-2z","clip-rule":"evenodd"},null,-1)]),512)),[[l.vShow,!n.isPlaying]]),l.withDirectives((l.openBlock(),l.createElementBlock("svg",lT,t[2]||(t[2]=[l.createElementVNode("path",{"fill-rule":"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zM7 8a1 1 0 012 0v4a1 1 0 11-2 0V8zm5-1a1 1 0 00-1 1v4a1 1 0 102 0V8a1 1 0 00-1-1z","clip-rule":"evenodd"},null,-1)]),512)),[[l.vShow,n.isPlaying]])],512),l.withDirectives(l.createElementVNode("div",cT,[l.createElementVNode("span",null,l.toDisplayString(n.displayCurrentTime),1),t[3]||(t[3]=l.createElementVNode("span",null," / ",-1)),l.createElementVNode("span",null,l.toDisplayString(n.displayDuration),1)],512),[[l.vShow,n.showPlayTimer]]),l.withDirectives(l.createElementVNode("div",uT,[l.withDirectives(l.createElementVNode("input",{ref:"progress","onUpdate:modelValue":t[0]||(t[0]=a=>n.currentTime=a),type:"range",min:"0",max:n.duration,class:"slider"},null,8,hT),[[l.vModelText,n.currentTime]])],512),[[l.vShow,n.showProgress]]),l.withDirectives(l.createElementVNode("div",dT," CC ",512),[[l.vShow,n.showCaptions]]),l.withDirectives(l.createElementVNode("div",fT,[l.withDirectives((l.openBlock(),l.createElementBlock("svg",pT,t[4]||(t[4]=[l.createElementVNode("path",{fill:"currentColor",d:"M215.03 71.05L126.06 160H24c-13.26 0-24 10.74-24 24v144c0 13.25 10.74 24 24 24h102.06l88.97 88.95c15.03 15.03 40.97 4.47 40.97-16.97V88.02c0-21.46-25.96-31.98-40.97-16.97zm233.32-51.08c-11.17-7.33-26.18-4.24-33.51 6.95-7.34 11.17-4.22 26.18 6.95 33.51 66.27 43.49 105.82 116.6 105.82 195.58 0 78.98-39.55 152.09-105.82 195.58-11.17 7.32-14.29 22.34-6.95 33.5 7.04 10.71 21.93 14.56 33.51 6.95C528.27 439.58 576 351.33 576 256S528.27 72.43 448.35 19.97zM480 256c0-63.53-32.06-121.94-85.77-156.24-11.19-7.14-26.03-3.82-33.12 7.46s-3.78 26.21 7.41 33.36C408.27 165.97 432 209.11 432 256s-23.73 90.03-63.48 115.42c-11.19 7.14-14.5 22.07-7.41 33.36 6.51 10.36 21.12 15.14 33.12 7.46C447.94 377.94 480 319.54 480 256zm-141.77-76.87c-11.58-6.33-26.19-2.16-32.61 9.45-6.39 11.61-2.16 26.2 9.45 32.61C327.98 228.28 336 241.63 336 256c0 14.38-8.02 27.72-20.92 34.81-11.61 6.41-15.84 21-9.45 32.61 6.43 11.66 21.05 15.8 32.61 9.45 28.23-15.55 45.77-45 45.77-76.88s-17.54-61.32-45.78-76.86z"},null,-1)]),512)),[[l.vShow,!n.isMuted]]),l.withDirectives((l.openBlock(),l.createElementBlock("svg",mT,t[5]||(t[5]=[l.createElementVNode("path",{fill:"currentColor",d:"M215.03 71.05L126.06 160H24c-13.26 0-24 10.74-24 24v144c0 13.25 10.74 24 24 24h102.06l88.97 88.95c15.03 15.03 40.97 4.47 40.97-16.97V88.02c0-21.46-25.96-31.98-40.97-16.97zM461.64 256l45.64-45.64c6.3-6.3 6.3-16.52 0-22.82l-22.82-22.82c-6.3-6.3-16.52-6.3-22.82 0L416 210.36l-45.64-45.64c-6.3-6.3-16.52-6.3-22.82 0l-22.82 22.82c-6.3 6.3-6.3 16.52 0 22.82L370.36 256l-45.63 45.63c-6.3 6.3-6.3 16.52 0 22.82l22.82 22.82c6.3 6.3 16.52 6.3 22.82 0L416 301.64l45.64 45.64c6.3 6.3 16.52 6.3 22.82 0l22.82-22.82c6.3-6.3 6.3-16.52 0-22.82L461.64 256z"},null,-1)]),512)),[[l.vShow,n.isMuted]])],512),[[l.vShow,n.showVolumeMute]])],512)],512)}const yT=B(iT,[["render",gT]]);class wT{constructor(t,i){J(this,"constants",{supports:{GLOSSARY:"glossary-on-screen",KEYWORD_TRANSLATION:"keyword-translation",EXT_SBAC_GLOSSARY_ILLUSTRATION:"ext:sbac-glossary-illustration"},GLOSSARY_CLICKABLE_CLASS:"qti3-player-catalog-clickable-term",LANGUAGE_OFF:""});return this.item=t,this.itemElement=t.$refs.item,this.store=i,this.nodeList=null,this.showGlossary=this.showGlossaryHandler.bind(this),this}bindAll(){this.store.getCatalogs().length!==0&&(this.resetAll(),this.nodeList=this.itemElement.querySelectorAll("[data-catalog-idref]"),this.nodeList.length!==0&&this.bindGlossary(this.nodeList))}resetAll(){this.nodeList!==null&&(this.nodeList.forEach(t=>{this.unbindGlossaryDOM(t)},this),this.nodeList=null)}getPnpGlossarySupports(t){let i=[];return t.getGlossaryOnScreen()&&i.push(this.constants.supports.GLOSSARY),t.getKeywordTranslationLanguage()!==this.constants.LANGUAGE_OFF&&i.push(`${this.constants.supports.KEYWORD_TRANSLATION}:${t.getKeywordTranslationLanguage()}`),t.getExtSbacGlossaryIllustration()&&i.push(this.constants.supports.EXT_SBAC_GLOSSARY_ILLUSTRATION),i}bindGlossary(t){const i=this.getPnpGlossarySupports(this.store.getItemContextPnp());i.length!==0&&t.forEach(s=>{this.bindGlossaryNode(s,i)},this)}bindGlossaryNode(t,i){const s=t.getAttribute("data-catalog-idref"),n=this.store.getCatalog(s);typeof n>"u"||this.hasCatalogGlossarySupport(n,i)&&this.bindGlossaryDOM(t)}bindGlossaryDOM(t){t.classList.contains(this.constants.GLOSSARY_CLICKABLE_CLASS)||(t.classList.add(this.constants.GLOSSARY_CLICKABLE_CLASS),this.setGlossaryTerm(t),t.addEventListener("click",this.showGlossary),t.addEventListener("touchend",this.showGlossary))}unbindGlossaryDOM(t){t.classList.contains(this.constants.GLOSSARY_CLICKABLE_CLASS)&&(t.classList.remove(this.constants.GLOSSARY_CLICKABLE_CLASS),t.removeEventListener("click",this.showGlossary),t.removeEventListener("touchend",this.showGlossary))}setGlossaryTerm(t){if(!t.hasAttribute("data-glossary-term")){if(t.hasAttribute("data-sbac-term")){t.setAttribute("data-glossary-term",t.getAttribute("data-sbac-term"));return}t.setAttribute("data-glossary-term",t.innerText)}}showGlossaryHandler(t){t.preventDefault(),t.stopPropagation();const i=t.target.getAttribute("data-catalog-idref"),s=this.createGlossaryData(i);this.item.$parent.$emit("itemCatalogEvent",{type:"glossary",catalogIdRef:i,term:t.target.getAttribute("data-glossary-term"),data:s})}createGlossaryData(t){const i=this.store.getCatalog(t),s=this.getPnpGlossarySupports(this.store.getItemContextPnp());return this.createGlossaryDataFromCatalog(i,s)}createGlossaryDataFromCatalog(t,i){let s=[];return i.forEach(n=>{const r=this.findCatalogCardBySupport(t,n);if(r!==null){if(n===this.constants.supports.GLOSSARY||n===this.constants.supports.EXT_SBAC_GLOSSARY_ILLUSTRATION){const a=this.createGlossaryContent(r);if(a===null)return;s.push({support:n,card:a});return}if(n.startsWith(`${this.constants.supports.KEYWORD_TRANSLATION}:`)){const a=this.getLanguageCodeFromSupport(n),o=this.createTranslationContent(r,a);if(o===null)return;s.push({support:this.constants.supports.KEYWORD_TRANSLATION,card:o});return}}},this),s}hasCatalogGlossarySupport(t,i){let s=null;return i.forEach(n=>{let r=this.findCatalogCardBySupport(t,n);if(r!==null){s=r;return}},this),s!=null}getLanguageCodeFromSupport(t){const i=t.indexOf(":");return t.length>i+1?t.substring(i+1):""}findCatalogCardBySupport(t,i){return typeof t>"u"?null:this.findCardBySupport(t.node.getCards(),i)}findCardBySupport(t,i){let s=null,n="";return i.startsWith(`${this.constants.supports.KEYWORD_TRANSLATION}:`)&&(n=this.getLanguageCodeFromSupport(i),i=this.constants.supports.KEYWORD_TRANSLATION),t.forEach(r=>{if(r.support===i){if(i===this.constants.supports.KEYWORD_TRANSLATION&&this.createTranslationContent(r,n)===null)return;s=r;return}},this),s}createGlossaryContent(t){return this.getGlossaryCardContent(t)}createTranslationContent(t,i){let s=this.getTranslationCardContent(t,i);return s!==null?s:this.getTranslationCardContent(t,i,!0)}getGlossaryCardContent(t){let i=null;return t.getChildren().forEach(s=>{switch(s.$options.name){case"QtiHtmlContent":i=this.createContent("qti-html-content",s);return;case"QtiFileRef":i=this.createContent("qti-file-ref",s);return;case"QtiCardEntry":i=this.getGlossaryCardContent(s);return;default:return}},this),i}getTranslationCardContent(t,i,s=!1,n=0){if(n>1||n==0&&t.getLanguage().length>0&&t.getLanguage()!==i)return null;let r=null;return t.getChildren().forEach(a=>{switch(a.$options.name){case"QtiHtmlContent":r=this.createContent("qti-html-content",a);return;case"QtiFileRef":r=this.createContent("qti-file-ref",a);return;case"QtiCardEntry":if(s&&a.isDefault()){r=this.getTranslationCardContent(a,i,s,n+1);return}if(a.getLanguage()===i){r=this.getTranslationCardContent(a,i,s,n+1);return}return;default:return}},this),r}createContent(t,i){return{properties:{name:t},content:i.getContent()}}}const bT={name:"EventListener",emits:["templateProcessingReady","itemBodyReady"],setup(e,t){return()=>{var i,s;return((s=(i=t.slots).default)==null?void 0:s.call(i))??null}}},vT=new G,ET={name:"QtiAssessmentItem",components:{EventListener:bT},emits:["itemReady","itemCompleted","itemSuspendAttemptReady","itemEndAttemptReady","itemScoreAttemptReady","itemCatalogEvent","itemNewTemplate","itemNewTemplateCompleted"],props:{identifier:{type:String,required:!0},title:{type:String,required:!1},adaptive:{type:String,required:!1},timeDependent:{type:String,required:!1},"xml:lang":{type:String,required:!1}},data(){return{isAdaptive:!1,isTimeDependent:!1,lang:null,locale:null,catalogFactory:null,getResponsesCallback:null}},methods:{getEndAttempt(e){this.endAttempt(void 0,(function(){this.notifyAttemptResults("itemEndAttemptReady",e)}).bind(this))},getSuspendAttempt(e){_.updateItemDuration(),this.getResponses((function(){this.evaluateAttemptValidity(_.getItemContextSessionControl().getValidateResponses()),this.notifyAttemptResults("itemSuspendAttemptReady",e)}).bind(this))},getScoreAttempt(e){this.processResponses(!0),this.notifyAttemptResults("itemScoreAttemptReady",e)},notifyAttemptResults(e,t){const i=new bc(this.identifier,_);this.$parent.$emit(e,{state:i.getSerializedState(),target:typeof t<"u"?t:null})},notifyEndAttemptInteractionResults(){const t=new bc(this.identifier,_).getSerializedState();_.getItemContextSessionControl().getValidateResponses()&&t.validationMessages.length>0&&_.getInteractions().forEach(i=>{i.interactionType==="EndAttemptInteraction"&&i.interactionSubType==="endattempt-controller-bar"&&i.enable()}),this.$parent.$emit("itemEndAttemptReady",{state:t,target:null})},handleTemplateProcessingReady(e){console.log("[QtiAssessmentItem][TemplateProcessingReady]"),_.defineTemplateProcessing({node:e.templateProcessing}),_.hasItemContextState()||this.executeTemplateProcessing()},handleItemBodyReady(e){console.log("[QtiAssessmentItem][ItemBodyReady][Adaptive="+this.isAdaptive+"]",e),_.defineItemBody({node:e.itemBody}),this.initializeResponseDeclarations(_.hasItemContextState()),this.initializeOutcomeDeclarations(_.hasItemContextState()),this.isAdaptive&&this.evaluateFeedbacks(),(_.getItemLifecycleStatus()==="closed"||_.getItemLifecycleStatus()==="review"||_.getItemLifecycleStatus()==="solution")&&(_.resetItemTimer(),this.disableInteractions())},getItemBody(){return _.getItemBody()},getTemplateProcessing(){let e=_.getProcessing("template");return typeof e>"u"?null:e.node},getResponseProcessing(){let e=_.getProcessing("response");return typeof e>"u"?null:e.node},newTemplate(){console.log("[QtiAssessmentItem][NewTemplate][Started]"),this.$parent.$emit("itemNewTemplate"),this.resetResponseDeclarations(),this.resetInteractions(),this.resetTemplateDeclarations(),this.executeTemplateProcessing(),this.evaluatePrintedVariables(),this.evaluateTemplateMathVariables(),this.evaluateTemplates(),this.resetOutcomeDeclarations(),this.evaluateFeedbacks(),_.restartItemTimer(),console.log("[QtiAssessmentItem][NewTemplate][Completed]"),this.$parent.$emit("itemNewTemplateCompleted")},evaluateTemplateMathVariables(){if(_.getTemplateMathParameterVariables().length===0)return;const t=this.getItemBody();t!==null&&t.updateTemplateMathVariables(),_.getFeedbacks().forEach(i=>{i.feedbackType==="Modal"&&i.node.updateTemplateMathVariables()})},executeTemplateProcessing(){let e=this.getTemplateProcessing();e!==null&&e.evaluate()},initializeOutcomeDeclarations(e){e?_.restoreOutcomeVariables():this.resetOutcomeDeclarations()},resetOutcomeDeclarations(){_.getOutcomeDeclarations().forEach(e=>{this.resetOutcomeDeclaration(e)},this)},resetOutcomeDeclaration(e){if(e.node!==void 0){e.node.reset();return}_.setOutcomeVariableValue({identifier:e.identifier,value:e.defaultValue})},initializeResponseDeclarations(e){e?_.restoreResponseVariables():this.resetResponseDeclarations()},resetResponseDeclarations(){_.getResponseDeclarations().forEach(e=>{e.resetValue&&e.resetValue()})},resetTemplateDeclarations(){_.getTemplateDeclarations().forEach(e=>{e.node.reset()})},resetInteractions(){_.getInteractions().forEach(e=>{console.log("[ResetInteractions]["+e.identifier+"]",e),e.resetValue&&e.resetValue(),e.node.enable&&e.node.enable()}),_.resetInteractionStateIsValidResponse()},disableInteractions(){_.getInteractions().forEach(e=>{e.node.disable&&e.node.disable()})},showSolutionInteractions(){_.getItemContextSessionControl().getShowSolution()&&_.getItemLifecycleState()==="solution"&&_.getInteractions().forEach(e=>{e.node.showSolution&&e.node.showSolution(_.getResponseVariableCorrectResponse(e.identifier))})},evaluateFeedbacks(){console.log("[EvaluateFeedback][Started]"),_.getFeedbacks().forEach(e=>{e.node.evaluate()}),console.log("[EvaluateFeedback][Completed]")},evaluatePrintedVariables(){console.log("[EvaluatePrintedVariables][Started]"),_.getPrintedVariables().forEach(e=>{e.node.evaluate()}),console.log("[EvaluatePrintedVariables][Completed]")},evaluateTemplates(){console.log("[EvaluateTemplates][Started]"),_.getTemplates().forEach(e=>{e.node.evaluate()}),console.log("[EvaluateTemplates][Completed]")},endAttempt(e,t){console.log("[EndAttempt][Start][Identifier]",this.identifier),_.updateItemDuration(),this.getResponses((function(){if(!this.evaluateAttemptValidity(_.getItemContextSessionControl().getValidateResponses())){console.log("[EndAttempt][InvalidResponses][Identifier]",this.identifier),t&&t();return}this.processResponses(),this.isAdaptive&&this.evaluateItemCompleted(),this.updateItemBodyUI(e),console.log("[EndAttempt][Complete][Identifier]",this.identifier),t&&t()}).bind(this))},updateItemBodyUI(e){typeof e>"u"||e.interactionSubType!=="endattempt-controller-bar"&&_.getInteractions().forEach(t=>{if(t.interactionType==="EndAttemptInteraction"){if(t.interactionSubType==="endattempt-controller-bar"){t.disable();return}if(this.isAdaptive){if(this.isAdaptiveItemCompleted()){t.disable();return}t.enable()}}})},getResponses(e){console.log("[GetResponses][Start]"),_.getAsyncStateMap().clear(),this.getResponsesCallback=e;let t=_.getResponseDeclarations();for(let i=0;i<t.length;i++){const s=t[i],n=_.getInteraction(s.identifier);if(typeof n>"u"){s.identifier!=="numAttempts"&&s.identifier!=="duration"&&_.resetResponseVariableValue({identifier:s.identifier,value:s.defaultValue,state:null});continue}if(n.interactionType!=="PortableCustom"){console.log("[GetResponses]["+s.identifier+"]:",n.node.getResponse()),_.setResponseVariableValue({identifier:s.identifier,value:n.node.getResponse(),state:n.node.getState()});continue}n.node.pciIsReady()?_.getAsyncStateMap().set(n.identifier,{identifier:n.identifier,node:n.node}):_.setResponseVariableValue({identifier:s.identifier,value:n.node.getResponse(),state:n.node.getState()})}this.initiateAsyncGetResponsesRequests()},initiateAsyncGetResponsesRequests(){if(_.getAsyncStateMap().size===0)return this.triggerGetResponsesComplete();for(const[e,t]of _.getAsyncStateMap().entries())console.log("[GetResponses]["+e+"][PCI Initiate]"),t.node.getStateRequest()},triggerGetResponsesComplete(){console.log("[GetResponses][Complete]"),typeof this.getResponsesCallback=="function"&&this.getResponsesCallback()},evaluateItemCompleted(){this.isAdaptiveItemCompleted()&&(_.resetItemTimer(),this.$parent.$emit("itemCompleted"))},isAdaptiveItemCompleted(){return _.getOutcomeDeclaration("completionStatus").value==="completed"},processResponses(e=!1){console.log("[ProcessResponses][Started]"),e||_.incrementNumAttempts(),console.log("[ProcessResponses][IsAdaptive]",this.isAdaptive),this.isAdaptive||this.resetOutcomeDeclarations();let t=this.getResponseProcessing();t!==null&&t.evaluate(),e||(this.printOutcomeDeclarations(),this.evaluatePrintedVariables(),_.getItemContextSessionControl().getShowFeedback()&&this.evaluateFeedbacks()),console.log("[ProcessResponses][Completed]")},evaluateAttemptValidity(e){return e?(_.resetItemContextValidationMessages(),this.evaluateInteractionResponseValidity(_.getInteractions())):!0},evaluateInteractionResponseValidity(e){let t=!0;return e.forEach(i=>{i.isValidResponse||(_.addItemContextValidationMessage({identifier:i.identifier,message:i.invalidResponseMessage}),t=!1)}),t},bindCatalog(){this.catalogFactory!==null&&this.catalogFactory.bindAll()},setLang(e,t){t!==null&&e.setAttribute("lang",t)},coerceItemAttributes(){this.isTimeDependent=typeof this.timeDependent>"u"?!1:this.timeDependent==="true",this.isAdaptive=typeof this.adaptive>"u"?!1:this.adaptive==="true",this.lang=vT.parseXmlLangAttribute(this.$props["xml:lang"]),this.locale=this.lang===null?"en":this.lang},printOutcomeDeclarations(){_.getOutcomeDeclarations().forEach(e=>{(this.isAdaptive||e.identifier!=="completionStatus")&&console.log("[ProcessResponses][Outcomes]["+e.identifier+"][Value]",e.value)})}},errorCaptured(e,t){return console.log("["+e.name+"]["+t.$options.name+"] "+e.message),!1},created(){this.coerceItemAttributes()},mounted(){this.setLang(this.$refs.item,this.lang),this.catalogFactory=new wT(this,_),this.bindCatalog(),this.$parent.$emit("itemReady",{item:this})},beforeUnmount(){this.catalogFactory!==null&&this.catalogFactory.resetAll()}},TT={ref:"item",class:"qti-assessment-item"};function CT(e,t,i,s,n,r){const a=l.resolveComponent("event-listener");return l.openBlock(),l.createElementBlock("div",TT,[l.createVNode(a,{onTemplateProcessingReady:r.handleTemplateProcessingReady,onItemBodyReady:r.handleItemBodyReady},{default:l.withCtx(()=>[l.createElementVNode("div",null,[l.renderSlot(e.$slots,"default")])]),_:3},8,["onTemplateProcessingReady","onItemBodyReady"])],512)}const ST=B(ET,[["render",CT]]),Lo=new G,xT=new ie,_T={name:"QtiContextDeclaration",props:{identifier:{type:String,required:!0},baseType:{type:String,required:!1},cardinality:{type:String,required:!0}},data(){return{value:null,defaultValue:null,isQtiValid:!0,declarationContext:"ITEM"}},methods:{getIdentifier(){return this.identifier},getValue(){return this.value},setValue(e){this.value=e},isNull(){return this.value===null},getBaseType(){return this.baseType},getCardinality(){return this.cardinality},getDefaultValue(){return this.defaultValue},getDeclarationContext(){return this.declarationContext},initializeValue(){if(this.defaultValue!==null){this.setValue(this.defaultValue);return}this.setValue(xT.nullValue())},reset(){this.initializeValue()},computeDeclarationContext(){var e,t,i;this.declarationContext=((i=(t=(e=this.$parent)==null?void 0:e.$parent)==null?void 0:t.$options)==null?void 0:i.name)==="QtiAssessmentTest"?"TEST":"ITEM"},getStore(){return this.declarationContext==="TEST"?it:_},validateChildren(){let e=!1;this.$slots.default&&this.$slots.default().forEach(t=>{if(Lo.isValidSlot(t)){if(t.type.name==="QtiDefaultValue"){if(!e)return e=!0;throw new c("Maximum of 1 qti-default-value element permitted")}throw new c('Element must be one of qti-default-value: "'+t.type.name+'"')}})},processChildren(){this.$.subTree.children[0].children.forEach(t=>{if(t.component!==null){if(t.type.name==="QtiDefaultValue")return this.defaultValue=t.component.proxy.getValue();throw new c("["+t.type.name+'][Unhandled Child Node]: "'+t.type.name+'"')}})}},created:function(){try{this.computeDeclarationContext(),Lo.validateCardinality(this.cardinality),Lo.validateBaseTypeAndCardinality(this.baseType,this.cardinality==="record"),Lo.validateIdentifierAttribute(this.identifier),this.validateChildren(),this.getStore().defineContextDeclaration({identifier:this.identifier,baseType:this.getBaseType(),cardinality:this.getCardinality(),value:null,resetValue:this.reset,defaultValue:null})}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted:function(){if(this.isQtiValid)try{this.processChildren(),this.initializeValue();const e={identifier:this.identifier,baseType:this.getBaseType(),cardinality:this.getCardinality(),value:this.getValue(),resetValue:this.reset,defaultValue:this.defaultValue};this.declarationContext==="TEST"?it.defineContextDeclaration(e):_.defineContextDeclaration(e),console.log("["+this.$options.name+"]["+this.identifier+"]["+this.declarationContext+"][DefaultValue]",this.defaultValue)}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiEvaluationException"?new O(e.message):new Error(e.message)}}},IT=["identifier"];function VT(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",{class:"qti-context-declaration",identifier:i.identifier},[l.renderSlot(e.$slots,"default")],8,IT)}const AT=B(_T,[["render",VT]]),Mo=new G,$T=new ie,LT={name:"QtiResponseDeclaration",props:{identifier:{type:String,required:!0},baseType:{type:String,required:!1},cardinality:{type:String,required:!0}},data(){return{value:null,state:null,defaultValue:null,correctResponse:null,mapping:null,areaMapping:null,isQtiValid:!0,declarationContext:"ITEM"}},methods:{getIdentifier(){return this.identifier},getValue(){return this.value},setValue(e){this.value=e},getState(){return this.state},setState(e){this.state=e},isNull(){return this.value===null},getBaseType(){return this.baseType},getCardinality(){return this.cardinality},getDefaultValue(){return this.defaultValue},getCorrectResponse(){return this.correctResponse},getMapping(){return this.mapping},getAreaMapping(){return this.areaMapping},getDeclarationContext(){return"ITEM"},initializeValue(){if(this.defaultValue!==null){this.setValue(this.defaultValue);return}this.setValue($T.nullValue())},validateChildren(){let e=!1,t=!1,i=!1,s=!1;this.$slots.default&&this.$slots.default().forEach(n=>{if(Mo.isValidSlot(n)){if(n.type.name==="QtiCorrectResponse"){if(!e)return e=!0;throw new c("Maximum of 1 qti-correct-response element permitted")}if(n.type.name==="QtiDefaultValue"){if(!t)return t=!0;throw new c("Maximum of 1 qti-default-value element permitted")}if(n.type.name==="QtiMapping"){if(!i)return i=!0;throw new c("Maximum of 1 qti-mapping element permitted")}if(n.type.name==="QtiAreaMapping"){if(!s)return s=!0;throw new c("Maximum of 1 qti-area-mapping element permitted")}throw new c('Element must be one of qti-correct-response, qti-default-value, qti-mapping, qti-area-mapping: "'+n.type.name+'"')}})},processChildren(){this.$.subTree.children[0].children.forEach(t=>{if(t.component!==null){if(t.type.name==="QtiCorrectResponse")return this.correctResponse=t.component.proxy.getValue();if(t.type.name==="QtiDefaultValue")return this.defaultValue=t.component.proxy.getValue();if(t.type.name==="QtiMapping")return this.mapping=t.component.proxy;throw new c("["+t.type.name+'][Unhandled Child Node]: "'+t.type.name+'"')}})},getPriorState(e){const t=_.getItemContextStateVariable(e);if(console.log("[ResponseDeclaration]["+e+"][priorState]",t),t===null)return null;if(!("value"in t))throw new O('Variable Restore State Invalid. "value" property not found.');if(!("state"in t))throw new O('Variable Restore State Invalid. "state" property not found.');return this.setValue(t.value),this.setState(t.state),t}},created(){try{Mo.validateCardinality(this.cardinality),Mo.validateBaseTypeAndCardinality(this.baseType,this.cardinality==="record"),Mo.validateIdentifierAttribute(this.identifier),this.validateChildren(),_.defineResponseDeclaration({identifier:this.getIdentifier(),baseType:this.getBaseType(),cardinality:this.getCardinality(),value:null,state:null,defaultValue:null,correctResponse:null,mapping:null,areaMapping:null})}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.processChildren(),this.getPriorState(this.identifier)===null&&this.initializeValue(),_.defineResponseDeclaration({identifier:this.getIdentifier(),baseType:this.getBaseType(),cardinality:this.getCardinality(),value:this.getValue(),state:this.getState(),defaultValue:this.getDefaultValue(),correctResponse:this.getCorrectResponse(),mapping:this.getMapping(),areaMapping:this.getAreaMapping()}),console.log("["+this.$options.name+"]["+this.identifier+"][CorrectResponse]",this.correctResponse,"[Mapping]",this.mapping)}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiEvaluationException"?new O(e.message):new Error(e.message)}}},MT=["identifier"];function NT(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",{ref:"root",class:"qti-response-declaration",identifier:i.identifier},[l.renderSlot(e.$slots,"default")],8,MT)}const RT=B(LT,[["render",NT]]),zs=new G,pp=new ie,kT={name:"QtiOutcomeDeclaration",props:{identifier:{type:String,required:!0},baseType:{type:String,required:!1},cardinality:{type:String,required:!0},view:{type:String,required:!1,default:null},interpretation:{type:String,required:!1,default:null},longInterpretation:{type:String,required:!1,default:null},normalMaximum:{type:String,required:!1},normalMinimum:{type:String,required:!1},masteryValue:{type:String,required:!1},externalScored:{type:String,required:!1,default:null},variableIdentifierRef:{type:String,required:!1,default:null}},data(){return{value:null,defaultValue:null,lookupTable:null,isQtiValid:!0,normalMaximumValue:null,normalMinimumValue:null,masteryValueValue:null,declarationContext:"ITEM"}},methods:{getIdentifier(){return this.identifier},getValue(){return this.value},setValue(e){this.value=e},isNull(){return this.value===null},getBaseType(){return this.baseType},getCardinality(){return this.cardinality},getNormalMaximumValue(){return this.normalMaximumValue},getNormalMinimumValue(){return this.normalMinimumValue},getMasteryValueValue(){return this.masteryValueValue},getDefaultValue(){return this.defaultValue},getDeclarationContext(){return this.declarationContext},initializeValue(){if(this.defaultValue!==null){this.setValue(this.defaultValue);return}if(this.getCardinality()==="single"&&pp.isBaseTypeNumeric(this.getBaseType())){this.setValue(new X(0).toNumber());return}this.setValue(pp.nullValue())},reset(){this.initializeValue(),this.getStore().setOutcomeVariableValue({identifier:this.identifier,value:this.getValue()})},computeDeclarationContext(){var e,t,i;this.declarationContext=((i=(t=(e=this.$parent)==null?void 0:e.$parent)==null?void 0:t.$options)==null?void 0:i.name)==="QtiAssessmentTest"?"TEST":"ITEM"},getStore(){return this.declarationContext==="TEST"?it:_},validateChildren(){let e=!1,t=!1,i=!1;this.$slots.default&&this.$slots.default().forEach(s=>{if(zs.isValidSlot(s)){if(s.type.name==="QtiDefaultValue"){if(!e)return e=!0;throw new c("Maximum of 1 qti-default-value element permitted")}if(s.type.name==="QtiMatchTable"){if(i)throw new c("Maximum of 1 lookupTable permitted");if(!t)return t=!0;throw new c("Maximum of 1 qti-match-table element permitted")}if(s.type.name==="QtiInterpolationTable"){if(t)throw new c("Maximum of 1 lookupTable permitted");if(!i)return i=!0;throw new c("Maximum of 1 qti-interpolation-table element permitted")}throw new c('Element must be one of qti-default-value, qti-match-table, qti-interpolation-table: "'+s.type.name+'"')}})},processChildren(){this.$.subTree.children[0].children.forEach(t=>{if(t.component!==null){if(t.type.name==="QtiDefaultValue")return this.defaultValue=t.component.proxy.getValue();if(t.type.name==="QtiMatchTable"||t.type.name==="QtiInterpolationTable")return this.lookupTable=t.component.proxy;throw new c("["+this.$options.name+'][Unhandled Child Node]: "'+t.type.name+'"')}})}},created(){try{if(this.computeDeclarationContext(),zs.validateCardinality(this.cardinality),zs.validateBaseTypeAndCardinality(this.baseType,this.cardinality==="record"),zs.validateIdentifierAttribute(this.identifier),this.validateChildren(),this.normalMaximumValue=zs.validateFloatAttribute("normal-maximum",this.normalMaximum,!1,null),this.normalMaximumValue!==null&&this.normalMaximumValue<=0)throw new c('Outcome declaration "'+this.identifier+'" has invalid normal-maximum attribute value. Must be a positive value.');if(this.normalMinimumValue=zs.validateFloatAttribute("normal-minimum",this.normalMinimum,!1,null),this.masteryValueValue=zs.validateFloatAttribute("mastery-value",this.masteryValue,!1,null),this.identifier==="SCORE"||this.identifier==="MAXSCORE"){if(typeof this.baseType>"u"||this.baseType!=="float")throw new c('Outcome declaration "'+this.identifier+'" has invalid base-type. Must be base-type="float".');if(typeof this.cardinality>"u"||this.cardinality!=="single")throw new c('Outcome declaration "'+this.identifier+'" has invalid cardinality. Must be cardinality="single".')}this.getStore().defineOutcomeDeclaration({identifier:this.identifier,baseType:this.getBaseType(),cardinality:this.getCardinality(),view:this.view,interpretation:this.interpretation,longInterpretation:this.longInterpretation,normalMaximum:this.getNormalMaximumValue(),normalMinimum:this.getNormalMinimumValue(),masteryValue:this.getMasteryValueValue(),externalScored:this.externalScored,variableIdentifierRef:this.variableIdentifierRef,value:null,defaultValue:null,node:this})}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.processChildren(),this.initializeValue();const e={identifier:this.identifier,baseType:this.getBaseType(),cardinality:this.getCardinality(),view:this.view,interpretation:this.interpretation,longInterpretation:this.longInterpretation,normalMaximum:this.getNormalMaximumValue(),normalMinimum:this.getNormalMinimumValue(),masteryValue:this.getMasteryValueValue(),externalScored:this.externalScored,variableIdentifierRef:this.variableIdentifierRef,value:this.getValue(),defaultValue:this.defaultValue,lookupTable:this.lookupTable,lookupTableType:this.lookupTableType,node:this};this.declarationContext==="TEST"?it.defineOutcomeDeclaration(e):_.defineOutcomeDeclaration(e),console.log("["+this.$options.name+"]["+this.identifier+"]["+this.declarationContext+"][DefaultValue]",this.defaultValue,"[lookupTable]",this.lookupTable)}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiEvaluationException"?new O(e.message):new Error(e.message)}}},qT=["identifier"];function OT(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",{class:"qti-outcome-declaration",identifier:i.identifier},[l.renderSlot(e.$slots,"default")],8,qT)}const BT=B(kT,[["render",OT]]),No=new G,PT=new ie,DT={name:"QtiTemplateDeclaration",props:{identifier:{type:String,required:!0},baseType:{type:String,required:!1},cardinality:{type:String,required:!0},paramVariable:{type:String,required:!1,default:"false"},mathVariable:{type:String,required:!1,default:"false"}},data(){return{value:null,defaultValue:null,isQtiValid:!0,declarationContext:"ITEM"}},methods:{getIdentifier(){return this.identifier},getValue(){return this.value},setValue(e){this.value=e},isNull(){return this.value===null},getBaseType(){return this.baseType},getCardinality(){return this.cardinality},getDefaultValue(){return this.defaultValue},getDeclarationContext(){return"ITEM"},initializeValue(){if(this.defaultValue!==null){this.setValue(this.defaultValue);return}this.setValue(PT.nullValue())},reset(){this.initializeValue(),_.setTemplateVariableValue({identifier:this.identifier,value:this.getValue()})},validateChildren(){let e=!1;this.$slots.default&&this.$slots.default().forEach(t=>{if(No.isValidSlot(t)){if(t.type.name==="QtiDefaultValue"){if(!e)return e=!0;throw new c("Maximum of 1 qti-default-value element permitted")}throw new c('Element must be qti-default-value: "'+t.type.name+'"')}})},processChildren(){this.$.subTree.children[0].children.forEach(t=>{if(t.type.name==="QtiDefaultValue"&&t.component!==null)return this.defaultValue=t.component.proxy.getValue();throw new c("["+t.type.name+'][Unhandled Child Node]: "'+t.type.name+'"')})},readChildren:function(){this.$children.forEach(e=>{switch(e.$el.className){case"qti-default-value":this.defaultValue=e.getValue();break;default:throw new c("["+this.$options.name+'][Unhandled Child Node]: "'+e.$el.className+'"')}})},getPriorState(e){const t=_.getItemContextStateVariable(e);if(t===null)return null;if(!("value"in t))throw new O('Variable Restore State Invalid. "value" property not found.');return this.setValue(t.value),t}},created:function(){try{No.validateCardinality(this.cardinality),No.validateBaseTypeAndCardinality(this.baseType,this.cardinality==="record"),No.validateIdentifierAttribute(this.identifier),this.validateChildren(),_.defineTemplateDeclaration({identifier:this.identifier,baseType:this.getBaseType(),cardinality:this.getCardinality(),value:null,defaultValue:null,paramVariable:this.paramVariable==="true",mathVariable:this.mathVariable==="true",node:this})}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted:function(){if(this.isQtiValid)try{this.processChildren(),this.getPriorState(this.identifier)===null&&this.initializeValue(),_.defineTemplateDeclaration({identifier:this.identifier,baseType:this.getBaseType(),cardinality:this.getCardinality(),value:this.getValue(),defaultValue:this.getDefaultValue(),paramVariable:this.paramVariable==="true",mathVariable:this.mathVariable==="true",node:this}),console.log("["+this.$options.name+"]["+this.identifier+"][Value]",this.getValue())}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiEvaluationException"?new O(e.message):new Error(e.message)}}},QT=["identifier"];function HT(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",{class:"qti-template-declaration",identifier:i.identifier},[l.renderSlot(e.$slots,"default")],8,QT)}const FT=B(DT,[["render",HT]]);function mp(e,t){return function(){return e.apply(t,arguments)}}const{toString:UT}=Object.prototype,{getPrototypeOf:Qc}=Object,Ro=(e=>t=>{const i=UT.call(t);return e[i]||(e[i]=i.slice(8,-1).toLowerCase())})(Object.create(null)),pi=e=>(e=e.toLowerCase(),t=>Ro(t)===e),ko=e=>t=>typeof t===e,{isArray:Nn}=Array,Dr=ko("undefined");function GT(e){return e!==null&&!Dr(e)&&e.constructor!==null&&!Dr(e.constructor)&&Qt(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const gp=pi("ArrayBuffer");function jT(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&gp(e.buffer),t}const WT=ko("string"),Qt=ko("function"),yp=ko("number"),qo=e=>e!==null&&typeof e=="object",zT=e=>e===!0||e===!1,Oo=e=>{if(Ro(e)!=="object")return!1;const t=Qc(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},KT=pi("Date"),YT=pi("File"),XT=pi("Blob"),ZT=pi("FileList"),JT=e=>qo(e)&&Qt(e.pipe),eC=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||Qt(e.append)&&((t=Ro(e))==="formdata"||t==="object"&&Qt(e.toString)&&e.toString()==="[object FormData]"))},tC=pi("URLSearchParams"),[iC,sC,nC,rC]=["ReadableStream","Request","Response","Headers"].map(pi),aC=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Qr(e,t,{allOwnKeys:i=!1}={}){if(e===null||typeof e>"u")return;let s,n;if(typeof e!="object"&&(e=[e]),Nn(e))for(s=0,n=e.length;s<n;s++)t.call(null,e[s],s,e);else{const r=i?Object.getOwnPropertyNames(e):Object.keys(e),a=r.length;let o;for(s=0;s<a;s++)o=r[s],t.call(null,e[o],o,e)}}function wp(e,t){t=t.toLowerCase();const i=Object.keys(e);let s=i.length,n;for(;s-- >0;)if(n=i[s],t===n.toLowerCase())return n;return null}const Ks=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,bp=e=>!Dr(e)&&e!==Ks;function Hc(){const{caseless:e}=bp(this)&&this||{},t={},i=(s,n)=>{const r=e&&wp(t,n)||n;Oo(t[r])&&Oo(s)?t[r]=Hc(t[r],s):Oo(s)?t[r]=Hc({},s):Nn(s)?t[r]=s.slice():t[r]=s};for(let s=0,n=arguments.length;s<n;s++)arguments[s]&&Qr(arguments[s],i);return t}const oC=(e,t,i,{allOwnKeys:s}={})=>(Qr(t,(n,r)=>{i&&Qt(n)?e[r]=mp(n,i):e[r]=n},{allOwnKeys:s}),e),lC=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),cC=(e,t,i,s)=>{e.prototype=Object.create(t.prototype,s),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),i&&Object.assign(e.prototype,i)},uC=(e,t,i,s)=>{let n,r,a;const o={};if(t=t||{},e==null)return t;do{for(n=Object.getOwnPropertyNames(e),r=n.length;r-- >0;)a=n[r],(!s||s(a,e,t))&&!o[a]&&(t[a]=e[a],o[a]=!0);e=i!==!1&&Qc(e)}while(e&&(!i||i(e,t))&&e!==Object.prototype);return t},hC=(e,t,i)=>{e=String(e),(i===void 0||i>e.length)&&(i=e.length),i-=t.length;const s=e.indexOf(t,i);return s!==-1&&s===i},dC=e=>{if(!e)return null;if(Nn(e))return e;let t=e.length;if(!yp(t))return null;const i=new Array(t);for(;t-- >0;)i[t]=e[t];return i},fC=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Qc(Uint8Array)),pC=(e,t)=>{const s=(e&&e[Symbol.iterator]).call(e);let n;for(;(n=s.next())&&!n.done;){const r=n.value;t.call(e,r[0],r[1])}},mC=(e,t)=>{let i;const s=[];for(;(i=e.exec(t))!==null;)s.push(i);return s},gC=pi("HTMLFormElement"),yC=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(i,s,n){return s.toUpperCase()+n}),vp=(({hasOwnProperty:e})=>(t,i)=>e.call(t,i))(Object.prototype),wC=pi("RegExp"),Ep=(e,t)=>{const i=Object.getOwnPropertyDescriptors(e),s={};Qr(i,(n,r)=>{let a;(a=t(n,r,e))!==!1&&(s[r]=a||n)}),Object.defineProperties(e,s)},bC=e=>{Ep(e,(t,i)=>{if(Qt(e)&&["arguments","caller","callee"].indexOf(i)!==-1)return!1;const s=e[i];if(Qt(s)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+i+"'")})}})},vC=(e,t)=>{const i={},s=n=>{n.forEach(r=>{i[r]=!0})};return Nn(e)?s(e):s(String(e).split(t)),i},EC=()=>{},TC=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t,Fc="abcdefghijklmnopqrstuvwxyz",Tp="0123456789",Cp={DIGIT:Tp,ALPHA:Fc,ALPHA_DIGIT:Fc+Fc.toUpperCase()+Tp},CC=(e=16,t=Cp.ALPHA_DIGIT)=>{let i="";const{length:s}=t;for(;e--;)i+=t[Math.random()*s|0];return i};function SC(e){return!!(e&&Qt(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}const xC=e=>{const t=new Array(10),i=(s,n)=>{if(qo(s)){if(t.indexOf(s)>=0)return;if(!("toJSON"in s)){t[n]=s;const r=Nn(s)?[]:{};return Qr(s,(a,o)=>{const u=i(a,n+1);!Dr(u)&&(r[o]=u)}),t[n]=void 0,r}}return s};return i(e,0)},_C=pi("AsyncFunction"),IC=e=>e&&(qo(e)||Qt(e))&&Qt(e.then)&&Qt(e.catch),Sp=((e,t)=>e?setImmediate:t?((i,s)=>(Ks.addEventListener("message",({source:n,data:r})=>{n===Ks&&r===i&&s.length&&s.shift()()},!1),n=>{s.push(n),Ks.postMessage(i,"*")}))(`axios@${Math.random()}`,[]):i=>setTimeout(i))(typeof setImmediate=="function",Qt(Ks.postMessage)),VC=typeof queueMicrotask<"u"?queueMicrotask.bind(Ks):typeof process<"u"&&process.nextTick||Sp,F={isArray:Nn,isArrayBuffer:gp,isBuffer:GT,isFormData:eC,isArrayBufferView:jT,isString:WT,isNumber:yp,isBoolean:zT,isObject:qo,isPlainObject:Oo,isReadableStream:iC,isRequest:sC,isResponse:nC,isHeaders:rC,isUndefined:Dr,isDate:KT,isFile:YT,isBlob:XT,isRegExp:wC,isFunction:Qt,isStream:JT,isURLSearchParams:tC,isTypedArray:fC,isFileList:ZT,forEach:Qr,merge:Hc,extend:oC,trim:aC,stripBOM:lC,inherits:cC,toFlatObject:uC,kindOf:Ro,kindOfTest:pi,endsWith:hC,toArray:dC,forEachEntry:pC,matchAll:mC,isHTMLForm:gC,hasOwnProperty:vp,hasOwnProp:vp,reduceDescriptors:Ep,freezeMethods:bC,toObjectSet:vC,toCamelCase:yC,noop:EC,toFiniteNumber:TC,findKey:wp,global:Ks,isContextDefined:bp,ALPHABET:Cp,generateString:CC,isSpecCompliantForm:SC,toJSONObject:xC,isAsyncFn:_C,isThenable:IC,setImmediate:Sp,asap:VC};function be(e,t,i,s,n){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),i&&(this.config=i),s&&(this.request=s),n&&(this.response=n,this.status=n.status?n.status:null)}F.inherits(be,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:F.toJSONObject(this.config),code:this.code,status:this.status}}});const xp=be.prototype,_p={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{_p[e]={value:e}}),Object.defineProperties(be,_p),Object.defineProperty(xp,"isAxiosError",{value:!0}),be.from=(e,t,i,s,n,r)=>{const a=Object.create(xp);return F.toFlatObject(e,a,function(u){return u!==Error.prototype},o=>o!=="isAxiosError"),be.call(a,e.message,t,i,s,n),a.cause=e,a.name=e.name,r&&Object.assign(a,r),a};const AC=null;function Uc(e){return F.isPlainObject(e)||F.isArray(e)}function Ip(e){return F.endsWith(e,"[]")?e.slice(0,-2):e}function Vp(e,t,i){return e?e.concat(t).map(function(n,r){return n=Ip(n),!i&&r?"["+n+"]":n}).join(i?".":""):t}function $C(e){return F.isArray(e)&&!e.some(Uc)}const LC=F.toFlatObject(F,{},null,function(t){return/^is[A-Z]/.test(t)});function Bo(e,t,i){if(!F.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,i=F.toFlatObject(i,{metaTokens:!0,dots:!1,indexes:!1},!1,function(S,C){return!F.isUndefined(C[S])});const s=i.metaTokens,n=i.visitor||f,r=i.dots,a=i.indexes,u=(i.Blob||typeof Blob<"u"&&Blob)&&F.isSpecCompliantForm(t);if(!F.isFunction(n))throw new TypeError("visitor must be a function");function h(b){if(b===null)return"";if(F.isDate(b))return b.toISOString();if(!u&&F.isBlob(b))throw new be("Blob is not supported. Use a Buffer instead.");return F.isArrayBuffer(b)||F.isTypedArray(b)?u&&typeof Blob=="function"?new Blob([b]):Buffer.from(b):b}function f(b,S,C){let L=b;if(b&&!C&&typeof b=="object"){if(F.endsWith(S,"{}"))S=s?S:S.slice(0,-2),b=JSON.stringify(b);else if(F.isArray(b)&&$C(b)||(F.isFileList(b)||F.endsWith(S,"[]"))&&(L=F.toArray(b)))return S=Ip(S),L.forEach(function(D,E){!(F.isUndefined(D)||D===null)&&t.append(a===!0?Vp([S],E,r):a===null?S:S+"[]",h(D))}),!1}return Uc(b)?!0:(t.append(Vp(C,S,r),h(b)),!1)}const m=[],w=Object.assign(LC,{defaultVisitor:f,convertValue:h,isVisitable:Uc});function y(b,S){if(!F.isUndefined(b)){if(m.indexOf(b)!==-1)throw Error("Circular reference detected in "+S.join("."));m.push(b),F.forEach(b,function(L,x){(!(F.isUndefined(L)||L===null)&&n.call(t,L,F.isString(x)?x.trim():x,S,w))===!0&&y(L,S?S.concat(x):[x])}),m.pop()}}if(!F.isObject(e))throw new TypeError("data must be an object");return y(e),t}function Ap(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(s){return t[s]})}function Gc(e,t){this._pairs=[],e&&Bo(e,this,t)}const $p=Gc.prototype;$p.append=function(t,i){this._pairs.push([t,i])},$p.toString=function(t){const i=t?function(s){return t.call(this,s,Ap)}:Ap;return this._pairs.map(function(n){return i(n[0])+"="+i(n[1])},"").join("&")};function MC(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Lp(e,t,i){if(!t)return e;const s=i&&i.encode||MC,n=i&&i.serialize;let r;if(n?r=n(t,i):r=F.isURLSearchParams(t)?t.toString():new Gc(t,i).toString(s),r){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+r}return e}class Mp{constructor(){this.handlers=[]}use(t,i,s){return this.handlers.push({fulfilled:t,rejected:i,synchronous:s?s.synchronous:!1,runWhen:s?s.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){F.forEach(this.handlers,function(s){s!==null&&t(s)})}}const Np={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},NC={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:Gc,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},jc=typeof window<"u"&&typeof document<"u",Wc=typeof navigator=="object"&&navigator||void 0,RC=jc&&(!Wc||["ReactNative","NativeScript","NS"].indexOf(Wc.product)<0),kC=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",qC=jc&&window.location.href||"http://localhost",It={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:jc,hasStandardBrowserEnv:RC,hasStandardBrowserWebWorkerEnv:kC,navigator:Wc,origin:qC},Symbol.toStringTag,{value:"Module"})),...NC};function OC(e,t){return Bo(e,new It.classes.URLSearchParams,Object.assign({visitor:function(i,s,n,r){return It.isNode&&F.isBuffer(i)?(this.append(s,i.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)}},t))}function BC(e){return F.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function PC(e){const t={},i=Object.keys(e);let s;const n=i.length;let r;for(s=0;s<n;s++)r=i[s],t[r]=e[r];return t}function Rp(e){function t(i,s,n,r){let a=i[r++];if(a==="__proto__")return!0;const o=Number.isFinite(+a),u=r>=i.length;return a=!a&&F.isArray(n)?n.length:a,u?(F.hasOwnProp(n,a)?n[a]=[n[a],s]:n[a]=s,!o):((!n[a]||!F.isObject(n[a]))&&(n[a]=[]),t(i,s,n[a],r)&&F.isArray(n[a])&&(n[a]=PC(n[a])),!o)}if(F.isFormData(e)&&F.isFunction(e.entries)){const i={};return F.forEachEntry(e,(s,n)=>{t(BC(s),n,i,0)}),i}return null}function DC(e,t,i){if(F.isString(e))try{return(t||JSON.parse)(e),F.trim(e)}catch(s){if(s.name!=="SyntaxError")throw s}return(i||JSON.stringify)(e)}const Hr={transitional:Np,adapter:["xhr","http","fetch"],transformRequest:[function(t,i){const s=i.getContentType()||"",n=s.indexOf("application/json")>-1,r=F.isObject(t);if(r&&F.isHTMLForm(t)&&(t=new FormData(t)),F.isFormData(t))return n?JSON.stringify(Rp(t)):t;if(F.isArrayBuffer(t)||F.isBuffer(t)||F.isStream(t)||F.isFile(t)||F.isBlob(t)||F.isReadableStream(t))return t;if(F.isArrayBufferView(t))return t.buffer;if(F.isURLSearchParams(t))return i.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let o;if(r){if(s.indexOf("application/x-www-form-urlencoded")>-1)return OC(t,this.formSerializer).toString();if((o=F.isFileList(t))||s.indexOf("multipart/form-data")>-1){const u=this.env&&this.env.FormData;return Bo(o?{"files[]":t}:t,u&&new u,this.formSerializer)}}return r||n?(i.setContentType("application/json",!1),DC(t)):t}],transformResponse:[function(t){const i=this.transitional||Hr.transitional,s=i&&i.forcedJSONParsing,n=this.responseType==="json";if(F.isResponse(t)||F.isReadableStream(t))return t;if(t&&F.isString(t)&&(s&&!this.responseType||n)){const a=!(i&&i.silentJSONParsing)&&n;try{return JSON.parse(t)}catch(o){if(a)throw o.name==="SyntaxError"?be.from(o,be.ERR_BAD_RESPONSE,this,null,this.response):o}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:It.classes.FormData,Blob:It.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};F.forEach(["delete","get","head","post","put","patch"],e=>{Hr.headers[e]={}});const QC=F.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),HC=e=>{const t={};let i,s,n;return e&&e.split(`
82
+ aria-labelledby="${t}">${s}</div>`}createIds(){const t={tabWrapperId:"",tabIds:[],tabPanelIds:[]};t.tabWrapperId="catalog-tabwrapper-"+this.randomString(5,"a");for(let i=0;i<3;i++){const s=this.randomString(5,"a");t.tabIds.push("catalog-"+i+"-tab-"+s),t.tabPanelIds.push("catalog-"+i+"-tabpanel-"+s)}return t}tabList(t,i,s){let n=[];return t&&n.push(this.constants.labels.GLOSSARY),i&&n.push(this.constants.labels.KEYWORD_TRANSLATION),s&&n.push(this.constants.labels.GLOSSARY_ILLUSTRATION),n}bindTabListEvents(){const t=document.getElementById(this.idList.tabWrapperId);if(t!==null&&(this.tabElements=t.querySelectorAll('[role="tab"]'),this.tabPanelElements=t.querySelectorAll('[role="tabpanel"]'),this.tabElements.length==this.tabPanelElements.length)){for(let i=0;i<this.tabElements.length;++i)this.addListeners(this.tabElements[i],this.tabPanelElements[i],i);this.bindTabAudioPlayers()}}unbindTabListEvents(){this.removeListeners(),this.unbindTabAudioPlayers()}bindTabAudioPlayers(){this.element.querySelectorAll("audio").forEach(i=>{const s=new _0(i).create();this.audioPlayers.push(s)},this)}unbindTabAudioPlayers(){this.audioPlayers.forEach(t=>{t.removeListeners()},this),this.audioPlayers.splice(0,this.audioPlayers.length)}addListeners(t,i,s){t.addEventListener("click",this.onTabClick),t.addEventListener("keydown",this.onKeyDown),t.addEventListener("keyup",this.onKeyUp),t.index=s}removeListeners(){this.tabElements.forEach(t=>{t.removeEventListener("click",this.onTabClick),t.removeEventListener("keydown",this.onKeyDown),t.removeEventListener("keyup",this.onKeyUp)},this)}tabClickHandler(t){var i=t.target;this.activateTab(i,!1)}keydownHandler(t){switch(t.keyCode){case this.constants.keys.END:t.preventDefault(),this.focusLastTab();break;case this.constants.keys.HOME:t.preventDefault(),this.focusFirstTab();break;case this.constants.keys.UP:case this.constants.keys.DOWN:this.switchTabOnArrowPress(t);break}}switchTabOnArrowPress(t){const i=t.keyCode;if(this.constants.direction[i]){let s=t.target;if(s.index!==void 0){if(this.tabElements[s.index+this.constants.direction[i]]){this.tabElements[s.index+this.constants.direction[i]].focus();return}if(i===this.constants.keys.LEFT||i===this.constants.keys.UP){this.focusLastTab();return}(i===this.constants.keys.RIGHT||i==this.constants.keys.DOWN)&&this.focusFirstTab()}}}keyupHandler(t){switch(t.keyCode){case this.constants.keys.LEFT:case this.constants.keys.RIGHT:this.switchTabOnArrowPress(t);break;case this.constants.keys.ENTER:case this.constants.keys.SPACE:this.activateTab(t.target);break}}activateTab(t,i){i=i||!0,this.deactivateTabs(),t.setAttribute("aria-selected","true");let s=t.getAttribute("aria-controls");document.getElementById(s).classList.remove("hidden"),i&&t.focus()}deactivateTabs(){this.audioPlayers.forEach(t=>{t.pause()},this),this.tabElements.forEach(t=>{t.setAttribute("aria-selected","false")},this),this.tabPanelElements.forEach(t=>{t.classList.add("hidden")},this)}focusFirstTab(){this.tabElements[0].focus()}focusLastTab(){this.tabElements[this.tabElements.length-1].focus()}randomString(t,i){i=i&&i.toLowerCase();let s="";const n=i=="a"?10:0,r=i=="n"?10:62;for(let a=0;a<t;a++){let o=Math.random()*(r-n)+n<<0;s+=String.fromCharCode(o+=o>9?o<36?55:61:48)}return s}}const B=(e,t)=>{const i=e.__vccOpts||e;for(const[s,n]of t)i[s]=n;return i},V0={name:"CatalogDialog",data(){return{state:{isShown:!1,dragging:!1,hidden:!0,xDiff:0,yDiff:0,x:0,y:0},content:{term:""},tabs:null}},methods:{setContent(e){this.resetDialogContent(),this.setDialogTerm(e.term),this.setDialogContent(e),this.createTabs(this.content)},setDialogContent(e){"data"in e&&e.data.forEach(t=>{switch(t.support){case"glossary-on-screen":this.setDialogGlossary(t.card);break;case"keyword-translation":this.setDialogKeywordTranslation(t.card);break;case"ext:sbac-glossary-illustration":this.setDialogGlossaryIllustration(t.card);break}},this)},resetDialogContent(){"glossary"in this.content&&delete this.content.glossary,"keywordTranslation"in this.content&&delete this.content.keywordTranslation,"glossaryIllustration"in this.content&&delete this.content.glossaryIllustration},setDialogTerm(e){this.content.term=e},setDialogGlossary(e){this.content.glossary=e},setDialogKeywordTranslation(e){this.content.keywordTranslation=e},setDialogGlossaryIllustration(e){this.content.glossaryIllustration=e},createTabs(e){this.tabs.create(e)},show(){this.state.hidden=!1,this.render(),this.state.isShown||(this.state.isShown=!0,this.center())},hide(){this.state.hidden=!0,this.render()},center(){this.$refs.dialog.style.top=window.innerHeight/2-this.$refs.dialog.offsetHeight/2+"px",this.$refs.dialog.style.left=window.innerWidth/2-this.$refs.dialog.offsetWidth/2+"px"},reset(){this.state.x=0,this.state.y=0,this.state.isShown=!1,this.state.hidden=!0,this.render()},render(){this.state.hidden?this.$refs.dialog.style.display="none":this.$refs.dialog.style.display="",this.$refs.dialog.style.transform="translate("+this.state.x+"px, "+this.state.y+"px)"},addListeners(){this.$refs.header.addEventListener("mousedown",this.onMouseDown.bind(this)),this.$refs.header.addEventListener("mousemove",this.onMouseMove.bind(this)),this.$refs.header.addEventListener("mouseup",this.onMouseUp.bind(this)),this.$refs.header.addEventListener("mouseleave",this.onMouseUp.bind(this)),this.$refs.header.addEventListener("touchstart",this.onTouchStart.bind(this)),this.$refs.header.addEventListener("touchmove",this.onTouchMove.bind(this)),this.$refs.header.addEventListener("touchend",this.onTouchEnd.bind(this)),this.$refs.close.addEventListener("click",this.hide.bind(this)),this.$refs.close.addEventListener("touchend",this.hide.bind(this))},removeListeners(){this.$refs.header.removeEventListener("mousedown",this.onMouseDown),this.$refs.header.removeEventListener("mousemove",this.onMouseMove),this.$refs.header.removeEventListener("mouseup",this.onMouseUp),this.$refs.header.removeEventListener("mouseleave",this.onMouseUp),this.$refs.header.removeEventListener("touchstart",this.onTouchStart),this.$refs.header.removeEventListener("touchmove",this.onTouchMove),this.$refs.header.removeEventListener("touchend",this.onTouchEnd),this.$refs.close.removeEventListener("click",this.hide),this.$refs.close.removeEventListener("touchend",this.hide)},onMouseDown(e){this.state.dragging=!0,this.state.xDiff=e.pageX-this.state.x,this.state.yDiff=e.pageY-this.state.y},onTouchStart(e){e.preventDefault(),this.state.dragging=!0,this.state.xDiff=e.targetTouches[0].pageX-this.state.x,this.state.yDiff=e.targetTouches[0].pageY-this.state.y},onMouseMove(e){this.state.dragging&&(this.state.x=e.pageX-this.state.xDiff,this.state.y=e.pageY-this.state.yDiff),this.render()},onTouchMove(e){e.preventDefault(),e.stopPropagation(),this.state.dragging&&(this.state.x=e.targetTouches[0].pageX-this.state.xDiff,this.state.y=e.targetTouches[0].pageY-this.state.yDiff),this.render()},onMouseUp(){this.state.dragging=!1},onTouchEnd(e){e.preventDefault(),this.state.dragging=!1}},mounted(){this.tabs=new I0(this.$refs.body),this.addListeners()},beforeUnmount(){this.tabs.removeListeners(),this.removeListeners()}},A0={ref:"dialog",class:"qti3-player-cat-dialog",role:"dialog",style:{display:"none"}},$0={ref:"header",class:"qti3-player-cat-dialog-header"},L0={class:"qti3-player-cat-dialog-term"},M0={ref:"close",type:"button",class:"qti3-player-cat-dialog-close","aria-label":"Close"},N0={ref:"body",class:"qti3-player-cat-dialog-body"};function R0(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",A0,[l.createElementVNode("div",$0,[l.createElementVNode("span",L0,l.toDisplayString(n.content.term),1),l.createElementVNode("button",M0,"×",512)],512),l.createElementVNode("div",N0,null,512)],512)}const k0=B(V0,[["render",R0]]),q0={name:"AmpStyle",render(){return l.h("style",{},this.$slots.default())}},O0=new G,B0={name:"AmpAudio",emits:["mediaLoaded","mediaEnded","mediaMounted"],props:{},data(){return{audio:null,audioSubType:null,currentTime:0,duration:0,displayCurrentTime:"00:00",displayDuration:"00:00",audioLoaded:!1,isPlaying:!1,isMuted:!1,isTimeUpdateListening:!0,showPlayTimer:!1,showVolumeMute:!1,showProgress:!1,showCaptions:!1,textTracksMap:null,mediaInteractionChild:!1,isDisabled:!1,isQtiValid:!0}},methods:{disable(){this.isDisabled=!0,this.pauseAudio(),this.disableController()},enable(){this.isDisabled=!1,this.enableController()},disableController(){this.$refs.playpause.setAttribute("tabindex","-1"),this.$refs.playpause.classList.add("disabled"),this.$refs.progress.setAttribute("tabindex","-1"),this.$refs.progress.classList.add("disabled"),this.$refs.volume.setAttribute("tabindex","-1"),this.$refs.volume.classList.add("disabled"),this.$refs.playtimer.classList.add("disabled")},enableController(){this.$refs.playpause.setAttribute("tabindex","0"),this.$refs.playpause.classList.remove("disabled"),(this.isMediaInteractionChild()||this.audioSubType==="audioprogress")&&(this.$refs.progress.setAttribute("tabindex","0"),this.$refs.progress.classList.remove("disabled"),this.$refs.volume.setAttribute("tabindex","0"),this.$refs.volume.classList.remove("disabled"),this.$refs.playtimer.classList.remove("disabled"))},handleLoaded(){this.audio&&(this.addControllerEventListeners(),this.duration=Math.round(this.audio.duration),this.displayDuration=this.convertTime(this.duration),this.isMediaInteractionChild()&&this.$parent.$emit("mediaLoaded",{node:this}))},handleEnded(){this.isPlaying=!1,this.isMediaInteractionChild()&&this.$parent.$emit("mediaEnded",{})},handleCanPlay(){this.audioLoaded=!0},handleTimeUpdate(){if(!this.isTimeUpdateListening)return;let e=Math.round(this.audio.currentTime);this.currentTime=e,this.displayCurrentTime=this.convertTime(e)},handlePlayPauseClick(){this.isDisabled||this.toggleAudio()},handlePlayPauseKeydown(e){if(this.isDisabled)return;let t=!1;switch(e.code){case"Space":case"Enter":this.toggleAudio(),t=!0;break}t&&(e.stopPropagation(),e.preventDefault())},handleProgressMouseDown(){this.isDisabled||(this.isTimeUpdateListening=!1,this.audio.paused?this.wasPlaying=!1:(this.wasPlaying=!0,this.audio.pause(),this.isPlaying=!1))},handleProgressInput(e){this.isDisabled||(this.displayCurrentTime=this.convertTime(e.target.valueAsNumber))},handleProgressChange(e){this.isDisabled||(this.setPosition(e.target.valueAsNumber),this.isTimeUpdateListening=!0,this.wasPlaying&&this.audio.paused&&(this.wasPlaying=!1,this.toggleAudio()))},handleVolumeMuteClick(){this.isDisabled||this.toggleVolume()},handleVolumeMuteKeydown(e){if(this.isDisabled)return;let t=!1;switch(e.code){case"Space":case"Enter":this.toggleVolume(),t=!0;break}t&&(e.stopPropagation(),e.preventDefault())},handleCueChange(e){const t=e.target.activeCues;if(t.length>0&&this.showCaptions){const i=t[0].text.replace(/\n/g,"<br/>");console.log("[AmpAudio][currentCue]",i),this.$refs.captions.innerHTML=i}},setPosition(e){this.audio.currentTime=e,this.displayCurrentTime=this.convertTime(e)},toggleAudio(){this.audio&&(this.isPlaying?(this.isPlaying=!1,this.audio.pause()):(this.isPlaying=!0,this.audio.play()))},playAudio(){this.audio&&(this.audio.play(),this.isPlaying=!0)},pauseAudio(){this.audio&&(this.audio.pause(),this.isPlaying=!1)},toggleVolume(){this.audio&&(this.audio.muted?(this.audio.muted=!1,this.isMuted=!1):(this.audio.muted=!0,this.isMuted=!0))},initSlider(){this.audio&&(this.duration=Math.round(this.audio.duration))},convertTime(e){let t=new Date(e*1e3).toISOString().substr(11,8);return t.indexOf("00:")===0&&(t=t.substr(3)),t},setAudioSubType(e){this.audioSubType=e,this.audioSubType==="audioprogress"&&(this.showProgress=!0,this.showPlayTimer=!0,this.showVolumeMute=!0)},getAudioSubType(e){if(e===null)return null;const t=e.class;if(typeof t>"u"||t===null||t.length==0)return null;const i=t.split(" ");for(let s=0;s<i.length;s++)switch(i[s]){case"sbaudio":case"audioprogress":return this.showProgress=!0,this.showPlayTimer=!0,this.showVolumeMute=!0,"audioprogress"}return null},detectAudioSubType(e){return this.getAudioSubType(e)},isMediaInteractionChild(){return this.mediaInteractionChild},detectMediaInteractionChild(){this.mediaInteractionChild=this.$parent.$el.classList.contains("qti3-player-media-group")},processChildren(){this.audio=this.$refs.player,this.audio.removeAttribute("controls"),this.audio.removeAttribute("autoplay"),this.textTracksMap=this.filterTextTracks(this.audio.querySelectorAll("track"))},filterTextTracks(e){let t=new Map;return e.forEach(i=>{switch(i.getAttribute("kind")){case"subtitles":case"captions":i.hasAttribute("id")||i.setAttribute("id","track-"+O0.randomString(5,"a")),t.set(i.getAttribute("id"),i);break}},this),t},isDefaultTextTrack(e){return e.hasAttribute("default")},addTextTrackCueEventListener(){this.audio&&this.audio.textTracks.length!==0&&this.audio.textTracks.forEach(e=>{const t=this.textTracksMap.get(e.id);if(typeof t<"u"&&this.isDefaultTextTrack(t)){e.addEventListener("cuechange",this.handleCueChange);return}},this)},removeTextTrackCueEventListener(){this.audio&&this.audio.textTracks.length!==0&&this.audio.textTracks.forEach(e=>{const t=this.textTracksMap.get(e.id);if(typeof t<"u"&&this.isDefaultTextTrack(t)){e.removeEventListener("cuechange",this.handleCueChange);return}},this)},addControllerEventListeners(){this.$refs.playpause.addEventListener("click",this.handlePlayPauseClick),this.$refs.playpause.addEventListener("keydown",this.handlePlayPauseKeydown),this.$refs.progress.addEventListener("input",this.handleProgressInput),this.$refs.progress.addEventListener("change",this.handleProgressChange),this.$refs.progress.addEventListener("mousedown",this.handleProgressMouseDown),this.$refs.volume.addEventListener("click",this.handleVolumeMuteClick),this.$refs.volume.addEventListener("keydown",this.handleVolumeMuteKeydown)},removeControllerEventListeners(){this.$refs.playpause.removeEventListener("click",this.handlePlayPauseClick),this.$refs.playpause.removeEventListener("keydown",this.handlePlayPauseKeydown),this.$refs.progress.removeEventListener("input",this.handleProgressInput),this.$refs.progress.removeEventListener("change",this.handleProgressChange),this.$refs.progress.removeEventListener("mousedown",this.handleProgressMouseDown),this.$refs.volume.removeEventListener("click",this.handleVolumeMuteClick),this.$refs.volume.removeEventListener("keydown",this.handleVolumeMuteKeydown)}},created(){this.setAudioSubType(this.detectAudioSubType(this.$.vnode.props))},mounted(){if(this.isQtiValid)try{if(this.detectMediaInteractionChild(),this.processChildren(),this.$nextTick(function(){this.audio&&(this.audio.addEventListener("loadedmetadata",this.handleLoaded),this.audio.addEventListener("canplay",this.handleCanPlay),this.audio.addEventListener("timeupdate",this.handleTimeUpdate),this.audio.addEventListener("ended",this.handleEnded),this.addTextTrackCueEventListener())}),this.isMediaInteractionChild()){this.$parent.$emit("mediaMounted",{node:this,mediaType:"audio"});return}this.enable()}catch(e){throw this.isQtiValid=!1,new c(e.message)}},beforeUnmount(){this.audio&&(this.audio.removeEventListener("loadedmetadata",this.handleLoaded),this.audio.removeEventListener("canplay",this.handleCanPlay),this.audio.removeEventListener("timeupdate",this.handleTimeUpdate),this.audio.removeEventListener("ended",this.handleEnded),this.removeTextTrackCueEventListener()),this.removeControllerEventListeners()}},P0={class:"amp-audio"},D0={class:"amp-audio__holder"},Q0={ref:"controller",class:"amp-audio__container"},H0={ref:"playpause",class:"amp-audio-playpause__container"},F0={class:"amp-playpause-button",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},U0={class:"amp-playpause-button",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},G0={ref:"playtimer",class:"amp-playtimer__container"},j0={class:"amp-progress__container"},W0=["max"],z0={ref:"volume",class:"amp-video-volumemute__container","aria-label":"Volume mute or unmute"},K0={class:"amp-volumemute-button","aria-hidden":"true",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 576 512"},Y0={class:"amp-volumemute-button","aria-hidden":"true",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"},X0={class:"amp-audio-captions__container hidden"},Z0={class:"amp-audio-captions",ref:"captions"};function J0(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",P0,[l.createElementVNode("div",D0,[l.createElementVNode("audio",l.mergeProps({ref:"player",tabIndex:"-1"},e.$attrs),[l.renderSlot(e.$slots,"default",{},void 0,!0)],16)]),l.createElementVNode("div",Q0,[l.createElementVNode("button",H0,[l.withDirectives((l.openBlock(),l.createElementBlock("svg",F0,t[1]||(t[1]=[l.createElementVNode("path",{"fill-rule":"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM9.555 7.168A1 1 0 008 8v4a1 1 0 001.555.832l3-2a1 1 0 000-1.664l-3-2z","clip-rule":"evenodd"},null,-1)]),512)),[[l.vShow,!n.isPlaying]]),l.withDirectives((l.openBlock(),l.createElementBlock("svg",U0,t[2]||(t[2]=[l.createElementVNode("path",{"fill-rule":"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zM7 8a1 1 0 012 0v4a1 1 0 11-2 0V8zm5-1a1 1 0 00-1 1v4a1 1 0 102 0V8a1 1 0 00-1-1z","clip-rule":"evenodd"},null,-1)]),512)),[[l.vShow,n.isPlaying]])],512),l.withDirectives(l.createElementVNode("div",G0,[l.createElementVNode("span",null,l.toDisplayString(n.displayCurrentTime),1),t[3]||(t[3]=l.createElementVNode("span",null," / ",-1)),l.createElementVNode("span",null,l.toDisplayString(n.displayDuration),1)],512),[[l.vShow,n.showPlayTimer]]),l.withDirectives(l.createElementVNode("div",j0,[l.withDirectives(l.createElementVNode("input",{ref:"progress","onUpdate:modelValue":t[0]||(t[0]=a=>n.currentTime=a),type:"range",min:"0",max:n.duration,class:"slider"},null,8,W0),[[l.vModelText,n.currentTime]])],512),[[l.vShow,n.showProgress]]),l.withDirectives(l.createElementVNode("div",z0,[l.withDirectives((l.openBlock(),l.createElementBlock("svg",K0,t[4]||(t[4]=[l.createElementVNode("path",{fill:"currentColor",d:"M215.03 71.05L126.06 160H24c-13.26 0-24 10.74-24 24v144c0 13.25 10.74 24 24 24h102.06l88.97 88.95c15.03 15.03 40.97 4.47 40.97-16.97V88.02c0-21.46-25.96-31.98-40.97-16.97zm233.32-51.08c-11.17-7.33-26.18-4.24-33.51 6.95-7.34 11.17-4.22 26.18 6.95 33.51 66.27 43.49 105.82 116.6 105.82 195.58 0 78.98-39.55 152.09-105.82 195.58-11.17 7.32-14.29 22.34-6.95 33.5 7.04 10.71 21.93 14.56 33.51 6.95C528.27 439.58 576 351.33 576 256S528.27 72.43 448.35 19.97zM480 256c0-63.53-32.06-121.94-85.77-156.24-11.19-7.14-26.03-3.82-33.12 7.46s-3.78 26.21 7.41 33.36C408.27 165.97 432 209.11 432 256s-23.73 90.03-63.48 115.42c-11.19 7.14-14.5 22.07-7.41 33.36 6.51 10.36 21.12 15.14 33.12 7.46C447.94 377.94 480 319.54 480 256zm-141.77-76.87c-11.58-6.33-26.19-2.16-32.61 9.45-6.39 11.61-2.16 26.2 9.45 32.61C327.98 228.28 336 241.63 336 256c0 14.38-8.02 27.72-20.92 34.81-11.61 6.41-15.84 21-9.45 32.61 6.43 11.66 21.05 15.8 32.61 9.45 28.23-15.55 45.77-45 45.77-76.88s-17.54-61.32-45.78-76.86z"},null,-1)]),512)),[[l.vShow,!n.isMuted]]),l.withDirectives((l.openBlock(),l.createElementBlock("svg",Y0,t[5]||(t[5]=[l.createElementVNode("path",{fill:"currentColor",d:"M215.03 71.05L126.06 160H24c-13.26 0-24 10.74-24 24v144c0 13.25 10.74 24 24 24h102.06l88.97 88.95c15.03 15.03 40.97 4.47 40.97-16.97V88.02c0-21.46-25.96-31.98-40.97-16.97zM461.64 256l45.64-45.64c6.3-6.3 6.3-16.52 0-22.82l-22.82-22.82c-6.3-6.3-16.52-6.3-22.82 0L416 210.36l-45.64-45.64c-6.3-6.3-16.52-6.3-22.82 0l-22.82 22.82c-6.3 6.3-6.3 16.52 0 22.82L370.36 256l-45.63 45.63c-6.3 6.3-6.3 16.52 0 22.82l22.82 22.82c6.3 6.3 16.52 6.3 22.82 0L416 301.64l45.64 45.64c6.3 6.3 16.52 6.3 22.82 0l22.82-22.82c6.3-6.3 6.3-16.52 0-22.82L461.64 256z"},null,-1)]),512)),[[l.vShow,n.isMuted]])],512),[[l.vShow,n.showVolumeMute]])],512),l.createElementVNode("div",X0,[l.createElementVNode("div",Z0,null,512)])])}const eT=B(B0,[["render",J0],["__scopeId","data-v-a1958132"]]),tT=new G,iT={name:"AmpVideo",emits:["mediaLoaded","mediaEnded","mediaMounted"],props:{},data(){return{video:null,playerSubType:null,currentTime:0,duration:0,displayCurrentTime:"00:00",displayDuration:"00:00",videoLoaded:!1,isPlaying:!1,isMuted:!1,isTimeUpdateListening:!0,showPlayTimer:!1,showVolumeMute:!1,showProgress:!1,showCaptions:!1,textTracksMap:null,mediaInteractionChild:!1,subtitlesMenu:null,subtitleMenuButtons:[],isDisabled:!1,isQtiValid:!0}},methods:{disable(){this.isDisabled=!0,this.pauseVideo(),this.disableController()},enable(){this.isDisabled=!1,this.enableController()},disableController(){this.$refs.playpause.setAttribute("tabindex","-1"),this.$refs.playpause.classList.add("disabled"),this.$refs.progress.setAttribute("tabindex","-1"),this.$refs.progress.classList.add("disabled"),this.$refs.cc.setAttribute("tabindex","-1"),this.$refs.cc.classList.add("disabled"),this.$refs.volume.setAttribute("tabindex","-1"),this.$refs.volume.classList.add("disabled"),this.$refs.playtimer.classList.add("disabled")},enableController(){this.$refs.playpause.setAttribute("tabindex","0"),this.$refs.playpause.classList.remove("disabled"),this.$refs.progress.setAttribute("tabindex","0"),this.$refs.progress.classList.remove("disabled"),this.$refs.cc.setAttribute("tabindex","0"),this.$refs.cc.classList.remove("disabled"),this.$refs.volume.setAttribute("tabindex","0"),this.$refs.volume.classList.remove("disabled"),this.$refs.playtimer.classList.remove("disabled")},handleLoaded(){this.video&&(this.addControllerEventListeners(),this.duration=Math.round(this.video.duration),this.displayDuration=this.convertTime(this.duration),this.isMediaInteractionChild()&&this.$parent.$emit("mediaLoaded",{node:this}))},handleEnded(){this.isPlaying=!1,this.isMediaInteractionChild()&&this.$parent.$emit("mediaEnded",{})},handleCanPlay(){this.videoLoaded=!0},handleTimeUpdate(){if(!this.isTimeUpdateListening||!this.video)return;let e=Math.round(this.video.currentTime);this.currentTime=e,this.displayCurrentTime=this.convertTime(e)},handlePlayPauseClick(){this.isDisabled||this.toggleVideo()},handlePlayPauseKeydown(e){if(this.isDisabled)return;let t=!1;switch(e.code){case"Space":case"Enter":this.toggleVideo(),t=!0;break}t&&(e.stopPropagation(),e.preventDefault())},handleProgressMouseDown(){this.isDisabled||(this.isTimeUpdateListening=!1,this.video.paused?this.wasPlaying=!1:(this.wasPlaying=!0,this.video.pause(),this.isPlaying=!1))},handleProgressInput(e){this.isDisabled||(this.displayCurrentTime=this.convertTime(e.target.valueAsNumber))},handleProgressChange(e){this.isDisabled||(this.setPosition(e.target.valueAsNumber),this.isTimeUpdateListening=!0,this.wasPlaying&&this.video.paused&&(this.wasPlaying=!1,this.toggleVideo()))},handleCaptionsClick(){this.isDisabled||this.toggleCaptionsMenu()},handleCaptionsKeydown(e){if(this.isDisabled)return;let t=!1;switch(e.code){case"Space":case"Enter":this.toggleCaptionsMenu(),t=!0;break}t&&(e.stopPropagation(),e.preventDefault())},toggleCaptionsMenu(){this.subtitlesMenu.style.display=this.subtitlesMenu.style.display==="block"?"none":"block"},handleVolumeMuteClick(){this.isDisabled||this.toggleVolume()},handleVolumeMuteKeydown(e){if(this.isDisabled)return;let t=!1;switch(e.code){case"Space":case"Enter":this.toggleVolume(),t=!0;break}t&&(e.stopPropagation(),e.preventDefault())},handleCueChange(){},setPosition(e){this.video.currentTime=e,this.displayCurrentTime=this.convertTime(e)},toggleVideo(){this.video&&(this.isPlaying?(this.isPlaying=!1,this.video.pause()):(this.isPlaying=!0,this.video.play()))},playVideo(){this.video&&(this.video.play(),this.isPlaying=!0)},pauseVideo(){this.video&&(this.video.pause(),this.isPlaying=!1)},toggleVolume(){this.video&&(this.video.muted?(this.video.muted=!1,this.isMuted=!1):(this.video.muted=!0,this.isMuted=!0))},initSlider(){this.video&&(this.duration=Math.round(this.video.duration))},convertTime(e){let t=new Date(e*1e3).toISOString().substr(11,8);return t.indexOf("00:")===0&&(t=t.substr(3)),t},getPlayerSubType(){return this.showProgress=!0,this.showPlayTimer=!0,this.showVolumeMute=!0,"ampvideo-default"},detectPlayerSubType(e){return this.getPlayerSubType(e)},isMediaInteractionChild(){return this.mediaInteractionChild},detectMediaInteractionChild(){this.mediaInteractionChild=this.$parent.$el.classList.contains("qti3-player-media-group")},processChildren(){if(this.video=this.$refs.player,this.video.removeAttribute("controls"),this.video.removeAttribute("autoplay"),this.video.hasAttribute("width")){const e=`${this.video.getAttribute("width")}`,t=e.endsWith("%")?`width:${e}`:`width:${e}px`;this.$refs.videocontainer.setAttribute("style",t),this.$refs.controller.setAttribute("style",t)}else this.video.setAttribute("width","100%");this.textTracksMap=this.filterTextTracks(this.video.querySelectorAll("track"))},filterTextTracks(e){let t=new Map;return e.forEach(i=>{switch(i.getAttribute("kind")){case"subtitles":case"captions":i.hasAttribute("id")||i.setAttribute("id","track-"+tT.randomString(5,"a")),t.set(i.getAttribute("id"),i);break}},this),t},isDefaultTextTrack(e){return e.hasAttribute("default")},addTextTrackCueEventListener(){if(this.video&&this.video.textTracks.length!==0){this.showCaptions=!0,this.initializeSubtitlesMenu();for(let e=0;e<this.video.textTracks.length;e++){const t=this.video.textTracks[e];t.mode="hidden",this.addSubtitlesMenuItem(t),typeof this.textTracksMap.get(t.id)<"u"&&t.addEventListener("cuechange",this.handleCueChange)}this.$refs.videocontainer.appendChild(this.subtitlesMenu)}},removeTextTrackCueEventListener(){if(this.video&&this.video.textTracks.length!==0){this.subtitleMenuButtons.forEach(e=>{e.removeEventListener("click",this.handleSubtitleButtonClick)});for(let e=0;e<this.video.textTracks.length;e++){const t=this.video.textTracks[e];typeof this.textTracksMap.get(t.id)<"u"&&t.removeEventListener("cuechange",this.handleCueChange)}}},initializeSubtitlesMenu(){const e=document.createDocumentFragment();this.subtitlesMenu=e.appendChild(document.createElement("ul")),this.subtitlesMenu.className="ampvideo-subtitles-menu",this.subtitlesMenu.appendChild(this.createMenuItem("subtitles-off","","Off"))},addSubtitlesMenuItem(e){this.subtitlesMenu.appendChild(this.createMenuItem(`subtitles-${e.language}`,e.language,e.label))},createMenuItem(e,t,i){const s=document.createElement("li"),n=s.appendChild(document.createElement("button"));return n.setAttribute("id",e),n.className="ampvideo-subtitles-button",t.length>0&&n.setAttribute("lang",t),n.value=i,t===""?n.setAttribute("data-state","active"):n.setAttribute("data-state","inactive"),n.appendChild(document.createTextNode(i)),n.addEventListener("click",this.handleSubtitleButtonClick),this.subtitleMenuButtons.push(n),s},handleSubtitleButtonClick(e){const t=e.currentTarget;this.subtitleMenuButtons.forEach(s=>{s.setAttribute("data-state","inactive")});const i=t.getAttribute("lang");for(let s=0;s<this.video.textTracks.length;s++)this.video.textTracks[s].language===i?(this.video.textTracks[s].mode="showing",t.setAttribute("data-state","active")):this.video.textTracks[s].mode="hidden";i===null&&t.setAttribute("data-state","active"),this.subtitlesMenu.style.display="none"},addControllerEventListeners(){this.$refs.playpause.addEventListener("click",this.handlePlayPauseClick),this.$refs.playpause.addEventListener("keydown",this.handlePlayPauseKeydown),this.$refs.progress.addEventListener("input",this.handleProgressInput),this.$refs.progress.addEventListener("change",this.handleProgressChange),this.$refs.progress.addEventListener("mousedown",this.handleProgressMouseDown),this.$refs.cc.addEventListener("click",this.handleCaptionsClick),this.$refs.cc.addEventListener("keydown",this.handleCaptionsKeydown),this.$refs.volume.addEventListener("click",this.handleVolumeMuteClick),this.$refs.volume.addEventListener("keydown",this.handleVolumeMuteKeydown)},removeControllerEventListeners(){this.$refs.playpause.removeEventListener("click",this.handlePlayPauseClick),this.$refs.playpause.removeEventListener("keydown",this.handlePlayPauseKeydown),this.$refs.progress.removeEventListener("input",this.handleProgressInput),this.$refs.progress.removeEventListener("change",this.handleProgressChange),this.$refs.progress.removeEventListener("mousedown",this.handleProgressMouseDown),this.$refs.cc.removeEventListener("click",this.handleCaptionsClick),this.$refs.cc.removeEventListener("keydown",this.handleCaptionsKeydown),this.$refs.volume.removeEventListener("click",this.handleVolumeMuteClick),this.$refs.volume.removeEventListener("keydown",this.handleVolumeMuteKeydown)}},created(){this.playerSubType=this.detectPlayerSubType(this.$.vnode.props)},mounted(){if(this.isQtiValid)try{if(this.detectMediaInteractionChild(),this.processChildren(),this.$nextTick(function(){this.video&&(this.video.addEventListener("loadedmetadata",this.handleLoaded),this.video.addEventListener("canplay",this.handleCanPlay),this.video.addEventListener("timeupdate",this.handleTimeUpdate),this.video.addEventListener("ended",this.handleEnded),this.addTextTrackCueEventListener())}),this.isMediaInteractionChild()){this.$parent.$emit("mediaMounted",{node:this,mediaType:"video"});return}this.enable()}catch(e){throw this.isQtiValid=!1,new c(e.message)}},beforeUnmount(){this.video&&(this.video.removeEventListener("loadedmetadata",this.handleLoaded),this.video.removeEventListener("canplay",this.handleCanPlay),this.video.removeEventListener("timeupdate",this.handleTimeUpdate),this.video.removeEventListener("ended",this.handleEnded),this.removeTextTrackCueEventListener()),this.removeControllerEventListeners()}},sT={ref:"videocontainer",class:"amp-video"},nT={class:"amp-video__holder"},rT={ref:"controller",class:"amp-video__container"},aT={ref:"playpause",class:"amp-video-playpause__container"},oT={class:"amp-playpause-button",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},lT={class:"amp-playpause-button",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},cT={ref:"playtimer",class:"amp-playtimer__container"},uT={class:"amp-progress__container"},hT=["max"],dT={ref:"cc",class:"amp-video-cc__container","aria-label":"Captions menu"},fT={ref:"volume",class:"amp-video-volumemute__container","aria-label":"Volume mute or unmute"},pT={class:"amp-volumemute-button","aria-hidden":"true",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 576 512"},mT={class:"amp-volumemute-button","aria-hidden":"true",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"};function gT(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",sT,[l.createElementVNode("div",nT,[l.createElementVNode("video",l.mergeProps({ref:"player",tabIndex:"-1",class:"amp-video__video"},e.$attrs),[l.renderSlot(e.$slots,"default")],16)]),l.createElementVNode("div",rT,[l.createElementVNode("button",aT,[l.withDirectives((l.openBlock(),l.createElementBlock("svg",oT,t[1]||(t[1]=[l.createElementVNode("path",{"fill-rule":"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM9.555 7.168A1 1 0 008 8v4a1 1 0 001.555.832l3-2a1 1 0 000-1.664l-3-2z","clip-rule":"evenodd"},null,-1)]),512)),[[l.vShow,!n.isPlaying]]),l.withDirectives((l.openBlock(),l.createElementBlock("svg",lT,t[2]||(t[2]=[l.createElementVNode("path",{"fill-rule":"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zM7 8a1 1 0 012 0v4a1 1 0 11-2 0V8zm5-1a1 1 0 00-1 1v4a1 1 0 102 0V8a1 1 0 00-1-1z","clip-rule":"evenodd"},null,-1)]),512)),[[l.vShow,n.isPlaying]])],512),l.withDirectives(l.createElementVNode("div",cT,[l.createElementVNode("span",null,l.toDisplayString(n.displayCurrentTime),1),t[3]||(t[3]=l.createElementVNode("span",null," / ",-1)),l.createElementVNode("span",null,l.toDisplayString(n.displayDuration),1)],512),[[l.vShow,n.showPlayTimer]]),l.withDirectives(l.createElementVNode("div",uT,[l.withDirectives(l.createElementVNode("input",{ref:"progress","onUpdate:modelValue":t[0]||(t[0]=a=>n.currentTime=a),type:"range",min:"0",max:n.duration,class:"slider"},null,8,hT),[[l.vModelText,n.currentTime]])],512),[[l.vShow,n.showProgress]]),l.withDirectives(l.createElementVNode("div",dT," CC ",512),[[l.vShow,n.showCaptions]]),l.withDirectives(l.createElementVNode("div",fT,[l.withDirectives((l.openBlock(),l.createElementBlock("svg",pT,t[4]||(t[4]=[l.createElementVNode("path",{fill:"currentColor",d:"M215.03 71.05L126.06 160H24c-13.26 0-24 10.74-24 24v144c0 13.25 10.74 24 24 24h102.06l88.97 88.95c15.03 15.03 40.97 4.47 40.97-16.97V88.02c0-21.46-25.96-31.98-40.97-16.97zm233.32-51.08c-11.17-7.33-26.18-4.24-33.51 6.95-7.34 11.17-4.22 26.18 6.95 33.51 66.27 43.49 105.82 116.6 105.82 195.58 0 78.98-39.55 152.09-105.82 195.58-11.17 7.32-14.29 22.34-6.95 33.5 7.04 10.71 21.93 14.56 33.51 6.95C528.27 439.58 576 351.33 576 256S528.27 72.43 448.35 19.97zM480 256c0-63.53-32.06-121.94-85.77-156.24-11.19-7.14-26.03-3.82-33.12 7.46s-3.78 26.21 7.41 33.36C408.27 165.97 432 209.11 432 256s-23.73 90.03-63.48 115.42c-11.19 7.14-14.5 22.07-7.41 33.36 6.51 10.36 21.12 15.14 33.12 7.46C447.94 377.94 480 319.54 480 256zm-141.77-76.87c-11.58-6.33-26.19-2.16-32.61 9.45-6.39 11.61-2.16 26.2 9.45 32.61C327.98 228.28 336 241.63 336 256c0 14.38-8.02 27.72-20.92 34.81-11.61 6.41-15.84 21-9.45 32.61 6.43 11.66 21.05 15.8 32.61 9.45 28.23-15.55 45.77-45 45.77-76.88s-17.54-61.32-45.78-76.86z"},null,-1)]),512)),[[l.vShow,!n.isMuted]]),l.withDirectives((l.openBlock(),l.createElementBlock("svg",mT,t[5]||(t[5]=[l.createElementVNode("path",{fill:"currentColor",d:"M215.03 71.05L126.06 160H24c-13.26 0-24 10.74-24 24v144c0 13.25 10.74 24 24 24h102.06l88.97 88.95c15.03 15.03 40.97 4.47 40.97-16.97V88.02c0-21.46-25.96-31.98-40.97-16.97zM461.64 256l45.64-45.64c6.3-6.3 6.3-16.52 0-22.82l-22.82-22.82c-6.3-6.3-16.52-6.3-22.82 0L416 210.36l-45.64-45.64c-6.3-6.3-16.52-6.3-22.82 0l-22.82 22.82c-6.3 6.3-6.3 16.52 0 22.82L370.36 256l-45.63 45.63c-6.3 6.3-6.3 16.52 0 22.82l22.82 22.82c6.3 6.3 16.52 6.3 22.82 0L416 301.64l45.64 45.64c6.3 6.3 16.52 6.3 22.82 0l22.82-22.82c6.3-6.3 6.3-16.52 0-22.82L461.64 256z"},null,-1)]),512)),[[l.vShow,n.isMuted]])],512),[[l.vShow,n.showVolumeMute]])],512)],512)}const yT=B(iT,[["render",gT]]);class wT{constructor(t,i){J(this,"constants",{supports:{GLOSSARY:"glossary-on-screen",KEYWORD_TRANSLATION:"keyword-translation",EXT_SBAC_GLOSSARY_ILLUSTRATION:"ext:sbac-glossary-illustration"},GLOSSARY_CLICKABLE_CLASS:"qti3-player-catalog-clickable-term",LANGUAGE_OFF:""});return this.item=t,this.itemElement=t.$refs.item,this.store=i,this.nodeList=null,this.showGlossary=this.showGlossaryHandler.bind(this),this}bindAll(){this.store.getCatalogs().length!==0&&(this.resetAll(),this.nodeList=this.itemElement.querySelectorAll("[data-catalog-idref]"),this.nodeList.length!==0&&this.bindGlossary(this.nodeList))}resetAll(){this.nodeList!==null&&(this.nodeList.forEach(t=>{this.unbindGlossaryDOM(t)},this),this.nodeList=null)}getPnpGlossarySupports(t){let i=[];return t.getGlossaryOnScreen()&&i.push(this.constants.supports.GLOSSARY),t.getKeywordTranslationLanguage()!==this.constants.LANGUAGE_OFF&&i.push(`${this.constants.supports.KEYWORD_TRANSLATION}:${t.getKeywordTranslationLanguage()}`),t.getExtSbacGlossaryIllustration()&&i.push(this.constants.supports.EXT_SBAC_GLOSSARY_ILLUSTRATION),i}bindGlossary(t){const i=this.getPnpGlossarySupports(this.store.getItemContextPnp());i.length!==0&&t.forEach(s=>{this.bindGlossaryNode(s,i)},this)}bindGlossaryNode(t,i){const s=t.getAttribute("data-catalog-idref"),n=this.store.getCatalog(s);typeof n>"u"||this.hasCatalogGlossarySupport(n,i)&&this.bindGlossaryDOM(t)}bindGlossaryDOM(t){t.classList.contains(this.constants.GLOSSARY_CLICKABLE_CLASS)||(t.classList.add(this.constants.GLOSSARY_CLICKABLE_CLASS),this.setGlossaryTerm(t),t.addEventListener("click",this.showGlossary),t.addEventListener("touchend",this.showGlossary))}unbindGlossaryDOM(t){t.classList.contains(this.constants.GLOSSARY_CLICKABLE_CLASS)&&(t.classList.remove(this.constants.GLOSSARY_CLICKABLE_CLASS),t.removeEventListener("click",this.showGlossary),t.removeEventListener("touchend",this.showGlossary))}setGlossaryTerm(t){if(!t.hasAttribute("data-glossary-term")){if(t.hasAttribute("data-sbac-term")){t.setAttribute("data-glossary-term",t.getAttribute("data-sbac-term"));return}t.setAttribute("data-glossary-term",t.innerText)}}showGlossaryHandler(t){t.preventDefault(),t.stopPropagation();const i=t.target.getAttribute("data-catalog-idref"),s=this.createGlossaryData(i);this.item.$parent.$emit("itemCatalogEvent",{type:"glossary",catalogIdRef:i,term:t.target.getAttribute("data-glossary-term"),data:s})}createGlossaryData(t){const i=this.store.getCatalog(t),s=this.getPnpGlossarySupports(this.store.getItemContextPnp());return this.createGlossaryDataFromCatalog(i,s)}createGlossaryDataFromCatalog(t,i){let s=[];return i.forEach(n=>{const r=this.findCatalogCardBySupport(t,n);if(r!==null){if(n===this.constants.supports.GLOSSARY||n===this.constants.supports.EXT_SBAC_GLOSSARY_ILLUSTRATION){const a=this.createGlossaryContent(r);if(a===null)return;s.push({support:n,card:a});return}if(n.startsWith(`${this.constants.supports.KEYWORD_TRANSLATION}:`)){const a=this.getLanguageCodeFromSupport(n),o=this.createTranslationContent(r,a);if(o===null)return;s.push({support:this.constants.supports.KEYWORD_TRANSLATION,card:o});return}}},this),s}hasCatalogGlossarySupport(t,i){let s=null;return i.forEach(n=>{let r=this.findCatalogCardBySupport(t,n);if(r!==null){s=r;return}},this),s!=null}getLanguageCodeFromSupport(t){const i=t.indexOf(":");return t.length>i+1?t.substring(i+1):""}findCatalogCardBySupport(t,i){return typeof t>"u"?null:this.findCardBySupport(t.node.getCards(),i)}findCardBySupport(t,i){let s=null,n="";return i.startsWith(`${this.constants.supports.KEYWORD_TRANSLATION}:`)&&(n=this.getLanguageCodeFromSupport(i),i=this.constants.supports.KEYWORD_TRANSLATION),t.forEach(r=>{if(r.support===i){if(i===this.constants.supports.KEYWORD_TRANSLATION&&this.createTranslationContent(r,n)===null)return;s=r;return}},this),s}createGlossaryContent(t){return this.getGlossaryCardContent(t)}createTranslationContent(t,i){let s=this.getTranslationCardContent(t,i);return s!==null?s:this.getTranslationCardContent(t,i,!0)}getGlossaryCardContent(t){let i=null;return t.getChildren().forEach(s=>{switch(s.$options.name){case"QtiHtmlContent":i=this.createContent("qti-html-content",s);return;case"QtiFileRef":i=this.createContent("qti-file-ref",s);return;case"QtiCardEntry":i=this.getGlossaryCardContent(s);return;default:return}},this),i}getTranslationCardContent(t,i,s=!1,n=0){if(n>1||n==0&&t.getLanguage().length>0&&t.getLanguage()!==i)return null;let r=null;return t.getChildren().forEach(a=>{switch(a.$options.name){case"QtiHtmlContent":r=this.createContent("qti-html-content",a);return;case"QtiFileRef":r=this.createContent("qti-file-ref",a);return;case"QtiCardEntry":if(s&&a.isDefault()){r=this.getTranslationCardContent(a,i,s,n+1);return}if(a.getLanguage()===i){r=this.getTranslationCardContent(a,i,s,n+1);return}return;default:return}},this),r}createContent(t,i){return{properties:{name:t},content:i.getContent()}}}const bT={name:"EventListener",emits:["templateProcessingReady","itemBodyReady"],setup(e,t){return()=>{var i,s;return((s=(i=t.slots).default)==null?void 0:s.call(i))??null}}},vT=new G,ET={name:"QtiAssessmentItem",components:{EventListener:bT},emits:["itemReady","itemCompleted","itemSuspendAttemptReady","itemEndAttemptReady","itemScoreAttemptReady","itemCatalogEvent","itemNewTemplate","itemNewTemplateCompleted"],props:{identifier:{type:String,required:!0},title:{type:String,required:!1},adaptive:{type:String,required:!1},timeDependent:{type:String,required:!1},"xml:lang":{type:String,required:!1}},data(){return{isAdaptive:!1,isTimeDependent:!1,lang:null,locale:null,catalogFactory:null,getResponsesCallback:null}},methods:{getEndAttempt(e){this.endAttempt(void 0,(function(){this.notifyAttemptResults("itemEndAttemptReady",e)}).bind(this))},getSuspendAttempt(e){_.updateItemDuration(),this.getResponses((function(){this.evaluateAttemptValidity(_.getItemContextSessionControl().getValidateResponses()),this.notifyAttemptResults("itemSuspendAttemptReady",e)}).bind(this))},getScoreAttempt(e){this.processResponses(!0),this.notifyAttemptResults("itemScoreAttemptReady",e)},notifyAttemptResults(e,t){const i=new bc(this.identifier,_);this.$parent.$emit(e,{state:i.getSerializedState(),target:typeof t<"u"?t:null})},notifyEndAttemptInteractionResults(){const t=new bc(this.identifier,_).getSerializedState();_.getItemContextSessionControl().getValidateResponses()&&t.validationMessages.length>0&&_.getInteractions().forEach(i=>{i.interactionType==="EndAttemptInteraction"&&i.interactionSubType==="endattempt-controller-bar"&&i.enable()}),this.$parent.$emit("itemEndAttemptReady",{state:t,target:null})},handleTemplateProcessingReady(e){console.log("[QtiAssessmentItem][TemplateProcessingReady]"),_.defineTemplateProcessing({node:e.templateProcessing}),_.hasItemContextState()||this.executeTemplateProcessing()},handleItemBodyReady(e){console.log("[QtiAssessmentItem][ItemBodyReady][Adaptive="+this.isAdaptive+"]",e),_.defineItemBody({node:e.itemBody}),this.initializeResponseDeclarations(_.hasItemContextState()),this.initializeOutcomeDeclarations(_.hasItemContextState()),this.isAdaptive&&this.evaluateFeedbacks(),(_.getItemLifecycleStatus()==="closed"||_.getItemLifecycleStatus()==="review"||_.getItemLifecycleStatus()==="solution")&&(_.resetItemTimer(),this.disableInteractions())},getItemBody(){return _.getItemBody()},getTemplateProcessing(){let e=_.getProcessing("template");return typeof e>"u"?null:e.node},getResponseProcessing(){let e=_.getProcessing("response");return typeof e>"u"?null:e.node},newTemplate(){console.log("[QtiAssessmentItem][NewTemplate][Started]"),this.$parent.$emit("itemNewTemplate"),this.resetResponseDeclarations(),this.resetInteractions(),this.resetTemplateDeclarations(),this.executeTemplateProcessing(),this.evaluatePrintedVariables(),this.evaluateTemplateMathVariables(),this.evaluateTemplates(),this.resetOutcomeDeclarations(),this.evaluateFeedbacks(),_.restartItemTimer(),console.log("[QtiAssessmentItem][NewTemplate][Completed]"),this.$parent.$emit("itemNewTemplateCompleted")},evaluateTemplateMathVariables(){if(_.getTemplateMathParameterVariables().length===0)return;const t=this.getItemBody();t!==null&&t.updateTemplateMathVariables(),_.getFeedbacks().forEach(i=>{i.feedbackType==="Modal"&&i.node.updateTemplateMathVariables()})},executeTemplateProcessing(){let e=this.getTemplateProcessing();e!==null&&e.evaluate()},initializeOutcomeDeclarations(e){e?_.restoreOutcomeVariables():this.resetOutcomeDeclarations()},resetOutcomeDeclarations(){_.getOutcomeDeclarations().forEach(e=>{this.resetOutcomeDeclaration(e)},this)},resetOutcomeDeclaration(e){if(e.node!==void 0){e.node.reset();return}_.setOutcomeVariableValue({identifier:e.identifier,value:e.defaultValue})},initializeResponseDeclarations(e){e?_.restoreResponseVariables():this.resetResponseDeclarations()},resetResponseDeclarations(){_.getResponseDeclarations().forEach(e=>{e.resetValue&&e.resetValue()})},resetTemplateDeclarations(){_.getTemplateDeclarations().forEach(e=>{e.node.reset()})},resetInteractions(){_.getInteractions().forEach(e=>{console.log("[ResetInteractions]["+e.identifier+"]",e),e.resetValue&&e.resetValue(),e.node.enable&&e.node.enable()}),_.resetInteractionStateIsValidResponse()},disableInteractions(){_.getInteractions().forEach(e=>{e.node.disable&&e.node.disable()})},showSolutionInteractions(){_.getItemContextSessionControl().getShowSolution()&&_.getItemLifecycleState()==="solution"&&_.getInteractions().forEach(e=>{e.node.showSolution&&e.node.showSolution(_.getResponseVariableCorrectResponse(e.identifier))})},evaluateFeedbacks(){console.log("[EvaluateFeedback][Started]"),_.getFeedbacks().forEach(e=>{e.node.evaluate()}),console.log("[EvaluateFeedback][Completed]")},evaluatePrintedVariables(){console.log("[EvaluatePrintedVariables][Started]"),_.getPrintedVariables().forEach(e=>{e.node.evaluate()}),console.log("[EvaluatePrintedVariables][Completed]")},evaluateTemplates(){console.log("[EvaluateTemplates][Started]"),_.getTemplates().forEach(e=>{e.node.evaluate()}),console.log("[EvaluateTemplates][Completed]")},endAttempt(e,t){console.log("[EndAttempt][Start][Identifier]",this.identifier),_.updateItemDuration(),this.getResponses((function(){if(!this.evaluateAttemptValidity(_.getItemContextSessionControl().getValidateResponses())){console.log("[EndAttempt][InvalidResponses][Identifier]",this.identifier),t&&t();return}this.processResponses(),this.isAdaptive&&this.evaluateItemCompleted(),this.updateItemBodyUI(e),console.log("[EndAttempt][Complete][Identifier]",this.identifier),t&&t()}).bind(this))},updateItemBodyUI(e){typeof e>"u"||e.interactionSubType!=="endattempt-controller-bar"&&_.getInteractions().forEach(t=>{if(t.interactionType==="EndAttemptInteraction"){if(t.interactionSubType==="endattempt-controller-bar"){t.disable();return}if(this.isAdaptive){if(this.isAdaptiveItemCompleted()){t.disable();return}t.enable()}}})},getResponses(e){console.log("[GetResponses][Start]"),_.getAsyncStateMap().clear(),this.getResponsesCallback=e;let t=_.getResponseDeclarations();for(let i=0;i<t.length;i++){const s=t[i],n=_.getInteraction(s.identifier);if(typeof n>"u"){s.identifier!=="numAttempts"&&s.identifier!=="duration"&&_.resetResponseVariableValue({identifier:s.identifier,value:s.defaultValue,state:null});continue}if(n.interactionType!=="PortableCustom"){console.log("[GetResponses]["+s.identifier+"]:",n.node.getResponse()),_.setResponseVariableValue({identifier:s.identifier,value:n.node.getResponse(),state:n.node.getState()});continue}n.node.pciIsReady()?_.getAsyncStateMap().set(n.identifier,{identifier:n.identifier,node:n.node}):_.setResponseVariableValue({identifier:s.identifier,value:n.node.getResponse(),state:n.node.getState()})}this.initiateAsyncGetResponsesRequests()},initiateAsyncGetResponsesRequests(){if(_.getAsyncStateMap().size===0)return this.triggerGetResponsesComplete();for(const[e,t]of _.getAsyncStateMap().entries())console.log("[GetResponses]["+e+"][PCI Initiate]"),t.node.getStateRequest()},triggerGetResponsesComplete(){console.log("[GetResponses][Complete]"),typeof this.getResponsesCallback=="function"&&this.getResponsesCallback()},evaluateItemCompleted(){this.isAdaptiveItemCompleted()&&(_.resetItemTimer(),this.$parent.$emit("itemCompleted"))},isAdaptiveItemCompleted(){return _.getOutcomeDeclaration("completionStatus").value==="completed"},processResponses(e=!1){console.log("[ProcessResponses][Started]"),e||_.incrementNumAttempts(),console.log("[ProcessResponses][IsAdaptive]",this.isAdaptive),this.isAdaptive||this.resetOutcomeDeclarations();let t=this.getResponseProcessing();t!==null&&t.evaluate(),e||(this.printOutcomeDeclarations(),this.evaluatePrintedVariables(),_.getItemContextSessionControl().getShowFeedback()&&this.evaluateFeedbacks()),console.log("[ProcessResponses][Completed]")},evaluateAttemptValidity(e){return e?(_.resetItemContextValidationMessages(),this.evaluateInteractionResponseValidity(_.getInteractions())):!0},evaluateInteractionResponseValidity(e){let t=!0;return e.forEach(i=>{i.isValidResponse||(_.addItemContextValidationMessage({identifier:i.identifier,message:i.invalidResponseMessage}),t=!1)}),t},bindCatalog(){this.catalogFactory!==null&&this.catalogFactory.bindAll()},setLang(e,t){t!==null&&e.setAttribute("lang",t)},coerceItemAttributes(){this.isTimeDependent=typeof this.timeDependent>"u"?!1:this.timeDependent==="true",this.isAdaptive=typeof this.adaptive>"u"?!1:this.adaptive==="true",this.lang=vT.parseXmlLangAttribute(this.$props["xml:lang"]),this.locale=this.lang===null?"en":this.lang},printOutcomeDeclarations(){_.getOutcomeDeclarations().forEach(e=>{(this.isAdaptive||e.identifier!=="completionStatus")&&console.log("[ProcessResponses][Outcomes]["+e.identifier+"][Value]",e.value)})}},errorCaptured(e,t){return console.log("["+e.name+"]["+t.$options.name+"] "+e.message),!1},created(){this.coerceItemAttributes()},mounted(){this.setLang(this.$refs.item,this.lang),this.catalogFactory=new wT(this,_),this.bindCatalog(),this.$parent.$emit("itemReady",{item:this})},beforeUnmount(){this.catalogFactory!==null&&this.catalogFactory.resetAll()}},TT={ref:"item",class:"qti-assessment-item"};function CT(e,t,i,s,n,r){const a=l.resolveComponent("event-listener");return l.openBlock(),l.createElementBlock("div",TT,[l.createVNode(a,{onTemplateProcessingReady:r.handleTemplateProcessingReady,onItemBodyReady:r.handleItemBodyReady},{default:l.withCtx(()=>[l.createElementVNode("div",null,[l.renderSlot(e.$slots,"default")])]),_:3},8,["onTemplateProcessingReady","onItemBodyReady"])],512)}const ST=B(ET,[["render",CT]]),Lo=new G,xT=new ie,_T={name:"QtiContextDeclaration",props:{identifier:{type:String,required:!0},baseType:{type:String,required:!1},cardinality:{type:String,required:!0}},data(){return{value:null,defaultValue:null,isQtiValid:!0,declarationContext:"ITEM"}},methods:{getIdentifier(){return this.identifier},getValue(){return this.value},setValue(e){this.value=e},isNull(){return this.value===null},getBaseType(){return this.baseType},getCardinality(){return this.cardinality},getDefaultValue(){return this.defaultValue},getDeclarationContext(){return this.declarationContext},initializeValue(){if(this.defaultValue!==null){this.setValue(this.defaultValue);return}this.setValue(xT.nullValue())},reset(){this.initializeValue()},computeDeclarationContext(){var e,t,i;this.declarationContext=((i=(t=(e=this.$parent)==null?void 0:e.$parent)==null?void 0:t.$options)==null?void 0:i.name)==="QtiAssessmentTest"?"TEST":"ITEM"},getStore(){return this.declarationContext==="TEST"?it:_},validateChildren(){let e=!1;this.$slots.default&&this.$slots.default().forEach(t=>{if(Lo.isValidSlot(t)){if(t.type.name==="QtiDefaultValue"){if(!e)return e=!0;throw new c("Maximum of 1 qti-default-value element permitted")}throw new c('Element must be one of qti-default-value: "'+t.type.name+'"')}})},processChildren(){this.$.subTree.children[0].children.forEach(t=>{if(t.component!==null){if(t.type.name==="QtiDefaultValue")return this.defaultValue=t.component.proxy.getValue();throw new c("["+t.type.name+'][Unhandled Child Node]: "'+t.type.name+'"')}})}},created:function(){try{this.computeDeclarationContext(),Lo.validateCardinality(this.cardinality),Lo.validateBaseTypeAndCardinality(this.baseType,this.cardinality==="record"),Lo.validateIdentifierAttribute(this.identifier),this.validateChildren(),this.getStore().defineContextDeclaration({identifier:this.identifier,baseType:this.getBaseType(),cardinality:this.getCardinality(),value:null,resetValue:this.reset,defaultValue:null})}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted:function(){if(this.isQtiValid)try{this.processChildren(),this.initializeValue();const e={identifier:this.identifier,baseType:this.getBaseType(),cardinality:this.getCardinality(),value:this.getValue(),resetValue:this.reset,defaultValue:this.defaultValue};this.declarationContext==="TEST"?it.defineContextDeclaration(e):_.defineContextDeclaration(e),console.log("["+this.$options.name+"]["+this.identifier+"]["+this.declarationContext+"][DefaultValue]",this.defaultValue)}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiEvaluationException"?new O(e.message):new Error(e.message)}}},IT=["identifier"];function VT(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",{class:"qti-context-declaration",identifier:i.identifier},[l.renderSlot(e.$slots,"default")],8,IT)}const AT=B(_T,[["render",VT]]),Mo=new G,$T=new ie,LT={name:"QtiResponseDeclaration",props:{identifier:{type:String,required:!0},baseType:{type:String,required:!1},cardinality:{type:String,required:!0}},data(){return{value:null,state:null,defaultValue:null,correctResponse:null,mapping:null,areaMapping:null,isQtiValid:!0,declarationContext:"ITEM"}},methods:{getIdentifier(){return this.identifier},getValue(){return this.value},setValue(e){this.value=e},getState(){return this.state},setState(e){this.state=e},isNull(){return this.value===null},getBaseType(){return this.baseType},getCardinality(){return this.cardinality},getDefaultValue(){return this.defaultValue},getCorrectResponse(){return this.correctResponse},getMapping(){return this.mapping},getAreaMapping(){return this.areaMapping},getDeclarationContext(){return"ITEM"},initializeValue(){if(this.defaultValue!==null){this.setValue(this.defaultValue);return}this.setValue($T.nullValue())},validateChildren(){let e=!1,t=!1,i=!1,s=!1;this.$slots.default&&this.$slots.default().forEach(n=>{if(Mo.isValidSlot(n)){if(n.type.name==="QtiCorrectResponse"){if(!e)return e=!0;throw new c("Maximum of 1 qti-correct-response element permitted")}if(n.type.name==="QtiDefaultValue"){if(!t)return t=!0;throw new c("Maximum of 1 qti-default-value element permitted")}if(n.type.name==="QtiMapping"){if(!i)return i=!0;throw new c("Maximum of 1 qti-mapping element permitted")}if(n.type.name==="QtiAreaMapping"){if(!s)return s=!0;throw new c("Maximum of 1 qti-area-mapping element permitted")}throw new c('Element must be one of qti-correct-response, qti-default-value, qti-mapping, qti-area-mapping: "'+n.type.name+'"')}})},processChildren(){this.$.subTree.children[0].children.forEach(t=>{if(t.component!==null){if(t.type.name==="QtiCorrectResponse")return this.correctResponse=t.component.proxy.getValue();if(t.type.name==="QtiDefaultValue")return this.defaultValue=t.component.proxy.getValue();if(t.type.name==="QtiMapping")return this.mapping=t.component.proxy;throw new c("["+t.type.name+'][Unhandled Child Node]: "'+t.type.name+'"')}})},getPriorState(e){const t=_.getItemContextStateVariable(e);if(console.log("[ResponseDeclaration]["+e+"][priorState]",t),t===null)return null;if(!("value"in t))throw new O('Variable Restore State Invalid. "value" property not found.');if(!("state"in t))throw new O('Variable Restore State Invalid. "state" property not found.');return this.setValue(t.value),this.setState(t.state),t}},created(){try{Mo.validateCardinality(this.cardinality),Mo.validateBaseTypeAndCardinality(this.baseType,this.cardinality==="record"),Mo.validateIdentifierAttribute(this.identifier),this.validateChildren(),_.defineResponseDeclaration({identifier:this.getIdentifier(),baseType:this.getBaseType(),cardinality:this.getCardinality(),value:null,state:null,defaultValue:null,correctResponse:null,mapping:null,areaMapping:null})}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.processChildren(),this.getPriorState(this.identifier)===null&&this.initializeValue(),_.defineResponseDeclaration({identifier:this.getIdentifier(),baseType:this.getBaseType(),cardinality:this.getCardinality(),value:this.getValue(),state:this.getState(),defaultValue:this.getDefaultValue(),correctResponse:this.getCorrectResponse(),mapping:this.getMapping(),areaMapping:this.getAreaMapping()}),console.log("["+this.$options.name+"]["+this.identifier+"][CorrectResponse]",this.correctResponse,"[Mapping]",this.mapping)}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiEvaluationException"?new O(e.message):new Error(e.message)}}},MT=["identifier"];function NT(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",{ref:"root",class:"qti-response-declaration",identifier:i.identifier},[l.renderSlot(e.$slots,"default")],8,MT)}const RT=B(LT,[["render",NT]]),zs=new G,pp=new ie,kT={name:"QtiOutcomeDeclaration",props:{identifier:{type:String,required:!0},baseType:{type:String,required:!1},cardinality:{type:String,required:!0},view:{type:String,required:!1,default:null},interpretation:{type:String,required:!1,default:null},longInterpretation:{type:String,required:!1,default:null},normalMaximum:{type:String,required:!1},normalMinimum:{type:String,required:!1},masteryValue:{type:String,required:!1},externalScored:{type:String,required:!1,default:null},variableIdentifierRef:{type:String,required:!1,default:null}},data(){return{value:null,defaultValue:null,lookupTable:null,isQtiValid:!0,normalMaximumValue:null,normalMinimumValue:null,masteryValueValue:null,declarationContext:"ITEM"}},methods:{getIdentifier(){return this.identifier},getValue(){return this.value},setValue(e){this.value=e},isNull(){return this.value===null},getBaseType(){return this.baseType},getCardinality(){return this.cardinality},getNormalMaximumValue(){return this.normalMaximumValue},getNormalMinimumValue(){return this.normalMinimumValue},getMasteryValueValue(){return this.masteryValueValue},getDefaultValue(){return this.defaultValue},getDeclarationContext(){return this.declarationContext},initializeValue(){if(this.defaultValue!==null){this.setValue(this.defaultValue);return}if(this.getCardinality()==="single"&&pp.isBaseTypeNumeric(this.getBaseType())){this.setValue(new X(0).toNumber());return}this.setValue(pp.nullValue())},reset(){this.initializeValue(),this.getStore().setOutcomeVariableValue({identifier:this.identifier,value:this.getValue()})},computeDeclarationContext(){var e,t,i;this.declarationContext=((i=(t=(e=this.$parent)==null?void 0:e.$parent)==null?void 0:t.$options)==null?void 0:i.name)==="QtiAssessmentTest"?"TEST":"ITEM"},getStore(){return this.declarationContext==="TEST"?it:_},validateChildren(){let e=!1,t=!1,i=!1;this.$slots.default&&this.$slots.default().forEach(s=>{if(zs.isValidSlot(s)){if(s.type.name==="QtiDefaultValue"){if(!e)return e=!0;throw new c("Maximum of 1 qti-default-value element permitted")}if(s.type.name==="QtiMatchTable"){if(i)throw new c("Maximum of 1 lookupTable permitted");if(!t)return t=!0;throw new c("Maximum of 1 qti-match-table element permitted")}if(s.type.name==="QtiInterpolationTable"){if(t)throw new c("Maximum of 1 lookupTable permitted");if(!i)return i=!0;throw new c("Maximum of 1 qti-interpolation-table element permitted")}throw new c('Element must be one of qti-default-value, qti-match-table, qti-interpolation-table: "'+s.type.name+'"')}})},processChildren(){this.$.subTree.children[0].children.forEach(t=>{if(t.component!==null){if(t.type.name==="QtiDefaultValue")return this.defaultValue=t.component.proxy.getValue();if(t.type.name==="QtiMatchTable"||t.type.name==="QtiInterpolationTable")return this.lookupTable=t.component.proxy;throw new c("["+this.$options.name+'][Unhandled Child Node]: "'+t.type.name+'"')}})}},created(){try{if(this.computeDeclarationContext(),zs.validateCardinality(this.cardinality),zs.validateBaseTypeAndCardinality(this.baseType,this.cardinality==="record"),zs.validateIdentifierAttribute(this.identifier),this.validateChildren(),this.normalMaximumValue=zs.validateFloatAttribute("normal-maximum",this.normalMaximum,!1,null),this.normalMaximumValue!==null&&this.normalMaximumValue<=0)throw new c('Outcome declaration "'+this.identifier+'" has invalid normal-maximum attribute value. Must be a positive value.');if(this.normalMinimumValue=zs.validateFloatAttribute("normal-minimum",this.normalMinimum,!1,null),this.masteryValueValue=zs.validateFloatAttribute("mastery-value",this.masteryValue,!1,null),this.identifier==="SCORE"||this.identifier==="MAXSCORE"){if(typeof this.baseType>"u"||this.baseType!=="float")throw new c('Outcome declaration "'+this.identifier+'" has invalid base-type. Must be base-type="float".');if(typeof this.cardinality>"u"||this.cardinality!=="single")throw new c('Outcome declaration "'+this.identifier+'" has invalid cardinality. Must be cardinality="single".')}this.getStore().defineOutcomeDeclaration({identifier:this.identifier,baseType:this.getBaseType(),cardinality:this.getCardinality(),view:this.view,interpretation:this.interpretation,longInterpretation:this.longInterpretation,normalMaximum:this.getNormalMaximumValue(),normalMinimum:this.getNormalMinimumValue(),masteryValue:this.getMasteryValueValue(),externalScored:this.externalScored,variableIdentifierRef:this.variableIdentifierRef,value:null,defaultValue:null,node:this})}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.processChildren(),this.initializeValue();const e={identifier:this.identifier,baseType:this.getBaseType(),cardinality:this.getCardinality(),view:this.view,interpretation:this.interpretation,longInterpretation:this.longInterpretation,normalMaximum:this.getNormalMaximumValue(),normalMinimum:this.getNormalMinimumValue(),masteryValue:this.getMasteryValueValue(),externalScored:this.externalScored,variableIdentifierRef:this.variableIdentifierRef,value:this.getValue(),defaultValue:this.defaultValue,lookupTable:this.lookupTable,lookupTableType:this.lookupTableType,node:this};this.declarationContext==="TEST"?it.defineOutcomeDeclaration(e):_.defineOutcomeDeclaration(e),console.log("["+this.$options.name+"]["+this.identifier+"]["+this.declarationContext+"][DefaultValue]",this.defaultValue,"[lookupTable]",this.lookupTable)}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiEvaluationException"?new O(e.message):new Error(e.message)}}},qT=["identifier"];function OT(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",{class:"qti-outcome-declaration",identifier:i.identifier},[l.renderSlot(e.$slots,"default")],8,qT)}const BT=B(kT,[["render",OT]]),No=new G,PT=new ie,DT={name:"QtiTemplateDeclaration",props:{identifier:{type:String,required:!0},baseType:{type:String,required:!1},cardinality:{type:String,required:!0},paramVariable:{type:String,required:!1,default:"false"},mathVariable:{type:String,required:!1,default:"false"}},data(){return{value:null,defaultValue:null,isQtiValid:!0,declarationContext:"ITEM"}},methods:{getIdentifier(){return this.identifier},getValue(){return this.value},setValue(e){this.value=e},isNull(){return this.value===null},getBaseType(){return this.baseType},getCardinality(){return this.cardinality},getDefaultValue(){return this.defaultValue},getDeclarationContext(){return"ITEM"},initializeValue(){if(this.defaultValue!==null){this.setValue(this.defaultValue);return}this.setValue(PT.nullValue())},reset(){this.initializeValue(),_.setTemplateVariableValue({identifier:this.identifier,value:this.getValue()})},validateChildren(){let e=!1;this.$slots.default&&this.$slots.default().forEach(t=>{if(No.isValidSlot(t)){if(t.type.name==="QtiDefaultValue"){if(!e)return e=!0;throw new c("Maximum of 1 qti-default-value element permitted")}throw new c('Element must be qti-default-value: "'+t.type.name+'"')}})},processChildren(){this.$.subTree.children[0].children.forEach(t=>{if(t.type.name==="QtiDefaultValue"&&t.component!==null)return this.defaultValue=t.component.proxy.getValue();throw new c("["+t.type.name+'][Unhandled Child Node]: "'+t.type.name+'"')})},readChildren:function(){this.$children.forEach(e=>{switch(e.$el.className){case"qti-default-value":this.defaultValue=e.getValue();break;default:throw new c("["+this.$options.name+'][Unhandled Child Node]: "'+e.$el.className+'"')}})},getPriorState(e){const t=_.getItemContextStateVariable(e);if(t===null)return null;if(!("value"in t))throw new O('Variable Restore State Invalid. "value" property not found.');return this.setValue(t.value),t}},created:function(){try{No.validateCardinality(this.cardinality),No.validateBaseTypeAndCardinality(this.baseType,this.cardinality==="record"),No.validateIdentifierAttribute(this.identifier),this.validateChildren(),_.defineTemplateDeclaration({identifier:this.identifier,baseType:this.getBaseType(),cardinality:this.getCardinality(),value:null,defaultValue:null,paramVariable:this.paramVariable==="true",mathVariable:this.mathVariable==="true",node:this})}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted:function(){if(this.isQtiValid)try{this.processChildren(),this.getPriorState(this.identifier)===null&&this.initializeValue(),_.defineTemplateDeclaration({identifier:this.identifier,baseType:this.getBaseType(),cardinality:this.getCardinality(),value:this.getValue(),defaultValue:this.getDefaultValue(),paramVariable:this.paramVariable==="true",mathVariable:this.mathVariable==="true",node:this}),console.log("["+this.$options.name+"]["+this.identifier+"][Value]",this.getValue())}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiEvaluationException"?new O(e.message):new Error(e.message)}}},QT=["identifier"];function HT(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",{class:"qti-template-declaration",identifier:i.identifier},[l.renderSlot(e.$slots,"default")],8,QT)}const FT=B(DT,[["render",HT]]);function mp(e,t){return function(){return e.apply(t,arguments)}}const{toString:UT}=Object.prototype,{getPrototypeOf:Qc}=Object,Ro=(e=>t=>{const i=UT.call(t);return e[i]||(e[i]=i.slice(8,-1).toLowerCase())})(Object.create(null)),pi=e=>(e=e.toLowerCase(),t=>Ro(t)===e),ko=e=>t=>typeof t===e,{isArray:Nn}=Array,Dr=ko("undefined");function GT(e){return e!==null&&!Dr(e)&&e.constructor!==null&&!Dr(e.constructor)&&Qt(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const gp=pi("ArrayBuffer");function jT(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&gp(e.buffer),t}const WT=ko("string"),Qt=ko("function"),yp=ko("number"),qo=e=>e!==null&&typeof e=="object",zT=e=>e===!0||e===!1,Oo=e=>{if(Ro(e)!=="object")return!1;const t=Qc(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},KT=pi("Date"),YT=pi("File"),XT=pi("Blob"),ZT=pi("FileList"),JT=e=>qo(e)&&Qt(e.pipe),eC=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||Qt(e.append)&&((t=Ro(e))==="formdata"||t==="object"&&Qt(e.toString)&&e.toString()==="[object FormData]"))},tC=pi("URLSearchParams"),[iC,sC,nC,rC]=["ReadableStream","Request","Response","Headers"].map(pi),aC=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Qr(e,t,{allOwnKeys:i=!1}={}){if(e===null||typeof e>"u")return;let s,n;if(typeof e!="object"&&(e=[e]),Nn(e))for(s=0,n=e.length;s<n;s++)t.call(null,e[s],s,e);else{const r=i?Object.getOwnPropertyNames(e):Object.keys(e),a=r.length;let o;for(s=0;s<a;s++)o=r[s],t.call(null,e[o],o,e)}}function wp(e,t){t=t.toLowerCase();const i=Object.keys(e);let s=i.length,n;for(;s-- >0;)if(n=i[s],t===n.toLowerCase())return n;return null}const Ks=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,bp=e=>!Dr(e)&&e!==Ks;function Hc(){const{caseless:e}=bp(this)&&this||{},t={},i=(s,n)=>{const r=e&&wp(t,n)||n;Oo(t[r])&&Oo(s)?t[r]=Hc(t[r],s):Oo(s)?t[r]=Hc({},s):Nn(s)?t[r]=s.slice():t[r]=s};for(let s=0,n=arguments.length;s<n;s++)arguments[s]&&Qr(arguments[s],i);return t}const oC=(e,t,i,{allOwnKeys:s}={})=>(Qr(t,(n,r)=>{i&&Qt(n)?e[r]=mp(n,i):e[r]=n},{allOwnKeys:s}),e),lC=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),cC=(e,t,i,s)=>{e.prototype=Object.create(t.prototype,s),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),i&&Object.assign(e.prototype,i)},uC=(e,t,i,s)=>{let n,r,a;const o={};if(t=t||{},e==null)return t;do{for(n=Object.getOwnPropertyNames(e),r=n.length;r-- >0;)a=n[r],(!s||s(a,e,t))&&!o[a]&&(t[a]=e[a],o[a]=!0);e=i!==!1&&Qc(e)}while(e&&(!i||i(e,t))&&e!==Object.prototype);return t},hC=(e,t,i)=>{e=String(e),(i===void 0||i>e.length)&&(i=e.length),i-=t.length;const s=e.indexOf(t,i);return s!==-1&&s===i},dC=e=>{if(!e)return null;if(Nn(e))return e;let t=e.length;if(!yp(t))return null;const i=new Array(t);for(;t-- >0;)i[t]=e[t];return i},fC=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Qc(Uint8Array)),pC=(e,t)=>{const s=(e&&e[Symbol.iterator]).call(e);let n;for(;(n=s.next())&&!n.done;){const r=n.value;t.call(e,r[0],r[1])}},mC=(e,t)=>{let i;const s=[];for(;(i=e.exec(t))!==null;)s.push(i);return s},gC=pi("HTMLFormElement"),yC=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(i,s,n){return s.toUpperCase()+n}),vp=(({hasOwnProperty:e})=>(t,i)=>e.call(t,i))(Object.prototype),wC=pi("RegExp"),Ep=(e,t)=>{const i=Object.getOwnPropertyDescriptors(e),s={};Qr(i,(n,r)=>{let a;(a=t(n,r,e))!==!1&&(s[r]=a||n)}),Object.defineProperties(e,s)},bC=e=>{Ep(e,(t,i)=>{if(Qt(e)&&["arguments","caller","callee"].indexOf(i)!==-1)return!1;const s=e[i];if(Qt(s)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+i+"'")})}})},vC=(e,t)=>{const i={},s=n=>{n.forEach(r=>{i[r]=!0})};return Nn(e)?s(e):s(String(e).split(t)),i},EC=()=>{},TC=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t,Fc="abcdefghijklmnopqrstuvwxyz",Tp="0123456789",Cp={DIGIT:Tp,ALPHA:Fc,ALPHA_DIGIT:Fc+Fc.toUpperCase()+Tp},CC=(e=16,t=Cp.ALPHA_DIGIT)=>{let i="";const{length:s}=t;for(;e--;)i+=t[Math.random()*s|0];return i};function SC(e){return!!(e&&Qt(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}const xC=e=>{const t=new Array(10),i=(s,n)=>{if(qo(s)){if(t.indexOf(s)>=0)return;if(!("toJSON"in s)){t[n]=s;const r=Nn(s)?[]:{};return Qr(s,(a,o)=>{const u=i(a,n+1);!Dr(u)&&(r[o]=u)}),t[n]=void 0,r}}return s};return i(e,0)},_C=pi("AsyncFunction"),IC=e=>e&&(qo(e)||Qt(e))&&Qt(e.then)&&Qt(e.catch),Sp=((e,t)=>e?setImmediate:t?((i,s)=>(Ks.addEventListener("message",({source:n,data:r})=>{n===Ks&&r===i&&s.length&&s.shift()()},!1),n=>{s.push(n),Ks.postMessage(i,"*")}))(`axios@${Math.random()}`,[]):i=>setTimeout(i))(typeof setImmediate=="function",Qt(Ks.postMessage)),VC=typeof queueMicrotask<"u"?queueMicrotask.bind(Ks):typeof process<"u"&&process.nextTick||Sp,F={isArray:Nn,isArrayBuffer:gp,isBuffer:GT,isFormData:eC,isArrayBufferView:jT,isString:WT,isNumber:yp,isBoolean:zT,isObject:qo,isPlainObject:Oo,isReadableStream:iC,isRequest:sC,isResponse:nC,isHeaders:rC,isUndefined:Dr,isDate:KT,isFile:YT,isBlob:XT,isRegExp:wC,isFunction:Qt,isStream:JT,isURLSearchParams:tC,isTypedArray:fC,isFileList:ZT,forEach:Qr,merge:Hc,extend:oC,trim:aC,stripBOM:lC,inherits:cC,toFlatObject:uC,kindOf:Ro,kindOfTest:pi,endsWith:hC,toArray:dC,forEachEntry:pC,matchAll:mC,isHTMLForm:gC,hasOwnProperty:vp,hasOwnProp:vp,reduceDescriptors:Ep,freezeMethods:bC,toObjectSet:vC,toCamelCase:yC,noop:EC,toFiniteNumber:TC,findKey:wp,global:Ks,isContextDefined:bp,ALPHABET:Cp,generateString:CC,isSpecCompliantForm:SC,toJSONObject:xC,isAsyncFn:_C,isThenable:IC,setImmediate:Sp,asap:VC};function be(e,t,i,s,n){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),i&&(this.config=i),s&&(this.request=s),n&&(this.response=n,this.status=n.status?n.status:null)}F.inherits(be,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:F.toJSONObject(this.config),code:this.code,status:this.status}}});const xp=be.prototype,_p={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{_p[e]={value:e}}),Object.defineProperties(be,_p),Object.defineProperty(xp,"isAxiosError",{value:!0}),be.from=(e,t,i,s,n,r)=>{const a=Object.create(xp);return F.toFlatObject(e,a,function(u){return u!==Error.prototype},o=>o!=="isAxiosError"),be.call(a,e.message,t,i,s,n),a.cause=e,a.name=e.name,r&&Object.assign(a,r),a};const AC=null;function Uc(e){return F.isPlainObject(e)||F.isArray(e)}function Ip(e){return F.endsWith(e,"[]")?e.slice(0,-2):e}function Vp(e,t,i){return e?e.concat(t).map(function(n,r){return n=Ip(n),!i&&r?"["+n+"]":n}).join(i?".":""):t}function $C(e){return F.isArray(e)&&!e.some(Uc)}const LC=F.toFlatObject(F,{},null,function(t){return/^is[A-Z]/.test(t)});function Bo(e,t,i){if(!F.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,i=F.toFlatObject(i,{metaTokens:!0,dots:!1,indexes:!1},!1,function(S,C){return!F.isUndefined(C[S])});const s=i.metaTokens,n=i.visitor||f,r=i.dots,a=i.indexes,u=(i.Blob||typeof Blob<"u"&&Blob)&&F.isSpecCompliantForm(t);if(!F.isFunction(n))throw new TypeError("visitor must be a function");function h(b){if(b===null)return"";if(F.isDate(b))return b.toISOString();if(!u&&F.isBlob(b))throw new be("Blob is not supported. Use a Buffer instead.");return F.isArrayBuffer(b)||F.isTypedArray(b)?u&&typeof Blob=="function"?new Blob([b]):Buffer.from(b):b}function f(b,S,C){let L=b;if(b&&!C&&typeof b=="object"){if(F.endsWith(S,"{}"))S=s?S:S.slice(0,-2),b=JSON.stringify(b);else if(F.isArray(b)&&$C(b)||(F.isFileList(b)||F.endsWith(S,"[]"))&&(L=F.toArray(b)))return S=Ip(S),L.forEach(function(D,E){!(F.isUndefined(D)||D===null)&&t.append(a===!0?Vp([S],E,r):a===null?S:S+"[]",h(D))}),!1}return Uc(b)?!0:(t.append(Vp(C,S,r),h(b)),!1)}const m=[],w=Object.assign(LC,{defaultVisitor:f,convertValue:h,isVisitable:Uc});function y(b,S){if(!F.isUndefined(b)){if(m.indexOf(b)!==-1)throw Error("Circular reference detected in "+S.join("."));m.push(b),F.forEach(b,function(L,x){(!(F.isUndefined(L)||L===null)&&n.call(t,L,F.isString(x)?x.trim():x,S,w))===!0&&y(L,S?S.concat(x):[x])}),m.pop()}}if(!F.isObject(e))throw new TypeError("data must be an object");return y(e),t}function Ap(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(s){return t[s]})}function Gc(e,t){this._pairs=[],e&&Bo(e,this,t)}const $p=Gc.prototype;$p.append=function(t,i){this._pairs.push([t,i])},$p.toString=function(t){const i=t?function(s){return t.call(this,s,Ap)}:Ap;return this._pairs.map(function(n){return i(n[0])+"="+i(n[1])},"").join("&")};function MC(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Lp(e,t,i){if(!t)return e;const s=i&&i.encode||MC,n=i&&i.serialize;let r;if(n?r=n(t,i):r=F.isURLSearchParams(t)?t.toString():new Gc(t,i).toString(s),r){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+r}return e}class Mp{constructor(){this.handlers=[]}use(t,i,s){return this.handlers.push({fulfilled:t,rejected:i,synchronous:s?s.synchronous:!1,runWhen:s?s.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){F.forEach(this.handlers,function(s){s!==null&&t(s)})}}const Np={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},NC={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:Gc,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},jc=typeof window<"u"&&typeof document<"u",Wc=typeof navigator=="object"&&navigator||void 0,RC=jc&&(!Wc||["ReactNative","NativeScript","NS"].indexOf(Wc.product)<0),kC=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",qC=jc&&window.location.href||"http://localhost",It={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:jc,hasStandardBrowserEnv:RC,hasStandardBrowserWebWorkerEnv:kC,navigator:Wc,origin:qC},Symbol.toStringTag,{value:"Module"})),...NC};function OC(e,t){return Bo(e,new It.classes.URLSearchParams,Object.assign({visitor:function(i,s,n,r){return It.isNode&&F.isBuffer(i)?(this.append(s,i.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)}},t))}function BC(e){return F.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function PC(e){const t={},i=Object.keys(e);let s;const n=i.length;let r;for(s=0;s<n;s++)r=i[s],t[r]=e[r];return t}function Rp(e){function t(i,s,n,r){let a=i[r++];if(a==="__proto__")return!0;const o=Number.isFinite(+a),u=r>=i.length;return a=!a&&F.isArray(n)?n.length:a,u?(F.hasOwnProp(n,a)?n[a]=[n[a],s]:n[a]=s,!o):((!n[a]||!F.isObject(n[a]))&&(n[a]=[]),t(i,s,n[a],r)&&F.isArray(n[a])&&(n[a]=PC(n[a])),!o)}if(F.isFormData(e)&&F.isFunction(e.entries)){const i={};return F.forEachEntry(e,(s,n)=>{t(BC(s),n,i,0)}),i}return null}function DC(e,t,i){if(F.isString(e))try{return(t||JSON.parse)(e),F.trim(e)}catch(s){if(s.name!=="SyntaxError")throw s}return(i||JSON.stringify)(e)}const Hr={transitional:Np,adapter:["xhr","http","fetch"],transformRequest:[function(t,i){const s=i.getContentType()||"",n=s.indexOf("application/json")>-1,r=F.isObject(t);if(r&&F.isHTMLForm(t)&&(t=new FormData(t)),F.isFormData(t))return n?JSON.stringify(Rp(t)):t;if(F.isArrayBuffer(t)||F.isBuffer(t)||F.isStream(t)||F.isFile(t)||F.isBlob(t)||F.isReadableStream(t))return t;if(F.isArrayBufferView(t))return t.buffer;if(F.isURLSearchParams(t))return i.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let o;if(r){if(s.indexOf("application/x-www-form-urlencoded")>-1)return OC(t,this.formSerializer).toString();if((o=F.isFileList(t))||s.indexOf("multipart/form-data")>-1){const u=this.env&&this.env.FormData;return Bo(o?{"files[]":t}:t,u&&new u,this.formSerializer)}}return r||n?(i.setContentType("application/json",!1),DC(t)):t}],transformResponse:[function(t){const i=this.transitional||Hr.transitional,s=i&&i.forcedJSONParsing,n=this.responseType==="json";if(F.isResponse(t)||F.isReadableStream(t))return t;if(t&&F.isString(t)&&(s&&!this.responseType||n)){const a=!(i&&i.silentJSONParsing)&&n;try{return JSON.parse(t)}catch(o){if(a)throw o.name==="SyntaxError"?be.from(o,be.ERR_BAD_RESPONSE,this,null,this.response):o}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:It.classes.FormData,Blob:It.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};F.forEach(["delete","get","head","post","put","patch"],e=>{Hr.headers[e]={}});const QC=F.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),HC=e=>{const t={};let i,s,n;return e&&e.split(`
83
83
  `).forEach(function(a){n=a.indexOf(":"),i=a.substring(0,n).trim().toLowerCase(),s=a.substring(n+1).trim(),!(!i||t[i]&&QC[i])&&(i==="set-cookie"?t[i]?t[i].push(s):t[i]=[s]:t[i]=t[i]?t[i]+", "+s:s)}),t},kp=Symbol("internals");function Fr(e){return e&&String(e).trim().toLowerCase()}function Po(e){return e===!1||e==null?e:F.isArray(e)?e.map(Po):String(e)}function FC(e){const t=Object.create(null),i=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let s;for(;s=i.exec(e);)t[s[1]]=s[2];return t}const UC=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function zc(e,t,i,s,n){if(F.isFunction(s))return s.call(this,t,i);if(n&&(t=i),!!F.isString(t)){if(F.isString(s))return t.indexOf(s)!==-1;if(F.isRegExp(s))return s.test(t)}}function GC(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,i,s)=>i.toUpperCase()+s)}function jC(e,t){const i=F.toCamelCase(" "+t);["get","set","has"].forEach(s=>{Object.defineProperty(e,s+i,{value:function(n,r,a){return this[s].call(this,t,n,r,a)},configurable:!0})})}class Vt{constructor(t){t&&this.set(t)}set(t,i,s){const n=this;function r(o,u,h){const f=Fr(u);if(!f)throw new Error("header name must be a non-empty string");const m=F.findKey(n,f);(!m||n[m]===void 0||h===!0||h===void 0&&n[m]!==!1)&&(n[m||u]=Po(o))}const a=(o,u)=>F.forEach(o,(h,f)=>r(h,f,u));if(F.isPlainObject(t)||t instanceof this.constructor)a(t,i);else if(F.isString(t)&&(t=t.trim())&&!UC(t))a(HC(t),i);else if(F.isHeaders(t))for(const[o,u]of t.entries())r(u,o,s);else t!=null&&r(i,t,s);return this}get(t,i){if(t=Fr(t),t){const s=F.findKey(this,t);if(s){const n=this[s];if(!i)return n;if(i===!0)return FC(n);if(F.isFunction(i))return i.call(this,n,s);if(F.isRegExp(i))return i.exec(n);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,i){if(t=Fr(t),t){const s=F.findKey(this,t);return!!(s&&this[s]!==void 0&&(!i||zc(this,this[s],s,i)))}return!1}delete(t,i){const s=this;let n=!1;function r(a){if(a=Fr(a),a){const o=F.findKey(s,a);o&&(!i||zc(s,s[o],o,i))&&(delete s[o],n=!0)}}return F.isArray(t)?t.forEach(r):r(t),n}clear(t){const i=Object.keys(this);let s=i.length,n=!1;for(;s--;){const r=i[s];(!t||zc(this,this[r],r,t,!0))&&(delete this[r],n=!0)}return n}normalize(t){const i=this,s={};return F.forEach(this,(n,r)=>{const a=F.findKey(s,r);if(a){i[a]=Po(n),delete i[r];return}const o=t?GC(r):String(r).trim();o!==r&&delete i[r],i[o]=Po(n),s[o]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const i=Object.create(null);return F.forEach(this,(s,n)=>{s!=null&&s!==!1&&(i[n]=t&&F.isArray(s)?s.join(", "):s)}),i}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,i])=>t+": "+i).join(`
84
84
  `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...i){const s=new this(t);return i.forEach(n=>s.set(n)),s}static accessor(t){const s=(this[kp]=this[kp]={accessors:{}}).accessors,n=this.prototype;function r(a){const o=Fr(a);s[o]||(jC(n,a),s[o]=!0)}return F.isArray(t)?t.forEach(r):r(t),this}}Vt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),F.reduceDescriptors(Vt.prototype,({value:e},t)=>{let i=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(s){this[i]=s}}}),F.freezeMethods(Vt);function Kc(e,t){const i=this||Hr,s=t||i,n=Vt.from(s.headers);let r=s.data;return F.forEach(e,function(o){r=o.call(i,r,n.normalize(),t?t.status:void 0)}),n.normalize(),r}function qp(e){return!!(e&&e.__CANCEL__)}function Rn(e,t,i){be.call(this,e??"canceled",be.ERR_CANCELED,t,i),this.name="CanceledError"}F.inherits(Rn,be,{__CANCEL__:!0});function Op(e,t,i){const s=i.config.validateStatus;!i.status||!s||s(i.status)?e(i):t(new be("Request failed with status code "+i.status,[be.ERR_BAD_REQUEST,be.ERR_BAD_RESPONSE][Math.floor(i.status/100)-4],i.config,i.request,i))}function WC(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function zC(e,t){e=e||10;const i=new Array(e),s=new Array(e);let n=0,r=0,a;return t=t!==void 0?t:1e3,function(u){const h=Date.now(),f=s[r];a||(a=h),i[n]=u,s[n]=h;let m=r,w=0;for(;m!==n;)w+=i[m++],m=m%e;if(n=(n+1)%e,n===r&&(r=(r+1)%e),h-a<t)return;const y=f&&h-f;return y?Math.round(w*1e3/y):void 0}}function KC(e,t){let i=0,s=1e3/t,n,r;const a=(h,f=Date.now())=>{i=f,n=null,r&&(clearTimeout(r),r=null),e.apply(null,h)};return[(...h)=>{const f=Date.now(),m=f-i;m>=s?a(h,f):(n=h,r||(r=setTimeout(()=>{r=null,a(n)},s-m)))},()=>n&&a(n)]}const Do=(e,t,i=3)=>{let s=0;const n=zC(50,250);return KC(r=>{const a=r.loaded,o=r.lengthComputable?r.total:void 0,u=a-s,h=n(u),f=a<=o;s=a;const m={loaded:a,total:o,progress:o?a/o:void 0,bytes:u,rate:h||void 0,estimated:h&&o&&f?(o-a)/h:void 0,event:r,lengthComputable:o!=null,[t?"download":"upload"]:!0};e(m)},i)},Bp=(e,t)=>{const i=e!=null;return[s=>t[0]({lengthComputable:i,total:e,loaded:s}),t[1]]},Pp=e=>(...t)=>F.asap(()=>e(...t)),YC=It.hasStandardBrowserEnv?function(){const t=It.navigator&&/(msie|trident)/i.test(It.navigator.userAgent),i=document.createElement("a");let s;function n(r){let a=r;return t&&(i.setAttribute("href",a),a=i.href),i.setAttribute("href",a),{href:i.href,protocol:i.protocol?i.protocol.replace(/:$/,""):"",host:i.host,search:i.search?i.search.replace(/^\?/,""):"",hash:i.hash?i.hash.replace(/^#/,""):"",hostname:i.hostname,port:i.port,pathname:i.pathname.charAt(0)==="/"?i.pathname:"/"+i.pathname}}return s=n(window.location.href),function(a){const o=F.isString(a)?n(a):a;return o.protocol===s.protocol&&o.host===s.host}}():function(){return function(){return!0}}(),XC=It.hasStandardBrowserEnv?{write(e,t,i,s,n,r){const a=[e+"="+encodeURIComponent(t)];F.isNumber(i)&&a.push("expires="+new Date(i).toGMTString()),F.isString(s)&&a.push("path="+s),F.isString(n)&&a.push("domain="+n),r===!0&&a.push("secure"),document.cookie=a.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function ZC(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function JC(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Dp(e,t){return e&&!ZC(t)?JC(e,t):t}const Qp=e=>e instanceof Vt?{...e}:e;function Ys(e,t){t=t||{};const i={};function s(h,f,m){return F.isPlainObject(h)&&F.isPlainObject(f)?F.merge.call({caseless:m},h,f):F.isPlainObject(f)?F.merge({},f):F.isArray(f)?f.slice():f}function n(h,f,m){if(F.isUndefined(f)){if(!F.isUndefined(h))return s(void 0,h,m)}else return s(h,f,m)}function r(h,f){if(!F.isUndefined(f))return s(void 0,f)}function a(h,f){if(F.isUndefined(f)){if(!F.isUndefined(h))return s(void 0,h)}else return s(void 0,f)}function o(h,f,m){if(m in t)return s(h,f);if(m in e)return s(void 0,h)}const u={url:r,method:r,data:r,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:o,headers:(h,f)=>n(Qp(h),Qp(f),!0)};return F.forEach(Object.keys(Object.assign({},e,t)),function(f){const m=u[f]||n,w=m(e[f],t[f],f);F.isUndefined(w)&&m!==o||(i[f]=w)}),i}const Hp=e=>{const t=Ys({},e);let{data:i,withXSRFToken:s,xsrfHeaderName:n,xsrfCookieName:r,headers:a,auth:o}=t;t.headers=a=Vt.from(a),t.url=Lp(Dp(t.baseURL,t.url),e.params,e.paramsSerializer),o&&a.set("Authorization","Basic "+btoa((o.username||"")+":"+(o.password?unescape(encodeURIComponent(o.password)):"")));let u;if(F.isFormData(i)){if(It.hasStandardBrowserEnv||It.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if((u=a.getContentType())!==!1){const[h,...f]=u?u.split(";").map(m=>m.trim()).filter(Boolean):[];a.setContentType([h||"multipart/form-data",...f].join("; "))}}if(It.hasStandardBrowserEnv&&(s&&F.isFunction(s)&&(s=s(t)),s||s!==!1&&YC(t.url))){const h=n&&r&&XC.read(r);h&&a.set(n,h)}return t},eS=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(i,s){const n=Hp(e);let r=n.data;const a=Vt.from(n.headers).normalize();let{responseType:o,onUploadProgress:u,onDownloadProgress:h}=n,f,m,w,y,b;function S(){y&&y(),b&&b(),n.cancelToken&&n.cancelToken.unsubscribe(f),n.signal&&n.signal.removeEventListener("abort",f)}let C=new XMLHttpRequest;C.open(n.method.toUpperCase(),n.url,!0),C.timeout=n.timeout;function L(){if(!C)return;const D=Vt.from("getAllResponseHeaders"in C&&C.getAllResponseHeaders()),U={data:!o||o==="text"||o==="json"?C.responseText:C.response,status:C.status,statusText:C.statusText,headers:D,config:e,request:C};Op(function(ee){i(ee),S()},function(ee){s(ee),S()},U),C=null}"onloadend"in C?C.onloadend=L:C.onreadystatechange=function(){!C||C.readyState!==4||C.status===0&&!(C.responseURL&&C.responseURL.indexOf("file:")===0)||setTimeout(L)},C.onabort=function(){C&&(s(new be("Request aborted",be.ECONNABORTED,e,C)),C=null)},C.onerror=function(){s(new be("Network Error",be.ERR_NETWORK,e,C)),C=null},C.ontimeout=function(){let E=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const U=n.transitional||Np;n.timeoutErrorMessage&&(E=n.timeoutErrorMessage),s(new be(E,U.clarifyTimeoutError?be.ETIMEDOUT:be.ECONNABORTED,e,C)),C=null},r===void 0&&a.setContentType(null),"setRequestHeader"in C&&F.forEach(a.toJSON(),function(E,U){C.setRequestHeader(U,E)}),F.isUndefined(n.withCredentials)||(C.withCredentials=!!n.withCredentials),o&&o!=="json"&&(C.responseType=n.responseType),h&&([w,b]=Do(h,!0),C.addEventListener("progress",w)),u&&C.upload&&([m,y]=Do(u),C.upload.addEventListener("progress",m),C.upload.addEventListener("loadend",y)),(n.cancelToken||n.signal)&&(f=D=>{C&&(s(!D||D.type?new Rn(null,e,C):D),C.abort(),C=null)},n.cancelToken&&n.cancelToken.subscribe(f),n.signal&&(n.signal.aborted?f():n.signal.addEventListener("abort",f)));const x=WC(n.url);if(x&&It.protocols.indexOf(x)===-1){s(new be("Unsupported protocol "+x+":",be.ERR_BAD_REQUEST,e));return}C.send(r||null)})},tS=(e,t)=>{const{length:i}=e=e?e.filter(Boolean):[];if(t||i){let s=new AbortController,n;const r=function(h){if(!n){n=!0,o();const f=h instanceof Error?h:this.reason;s.abort(f instanceof be?f:new Rn(f instanceof Error?f.message:f))}};let a=t&&setTimeout(()=>{a=null,r(new be(`timeout ${t} of ms exceeded`,be.ETIMEDOUT))},t);const o=()=>{e&&(a&&clearTimeout(a),a=null,e.forEach(h=>{h.unsubscribe?h.unsubscribe(r):h.removeEventListener("abort",r)}),e=null)};e.forEach(h=>h.addEventListener("abort",r));const{signal:u}=s;return u.unsubscribe=()=>F.asap(o),u}},iS=function*(e,t){let i=e.byteLength;if(!t||i<t){yield e;return}let s=0,n;for(;s<i;)n=s+t,yield e.slice(s,n),s=n},sS=async function*(e,t){for await(const i of nS(e))yield*iS(i,t)},nS=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:i,value:s}=await t.read();if(i)break;yield s}}finally{await t.cancel()}},Fp=(e,t,i,s)=>{const n=sS(e,t);let r=0,a,o=u=>{a||(a=!0,s&&s(u))};return new ReadableStream({async pull(u){try{const{done:h,value:f}=await n.next();if(h){o(),u.close();return}let m=f.byteLength;if(i){let w=r+=m;i(w)}u.enqueue(new Uint8Array(f))}catch(h){throw o(h),h}},cancel(u){return o(u),n.return()}},{highWaterMark:2})},Qo=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Up=Qo&&typeof ReadableStream=="function",rS=Qo&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),Gp=(e,...t)=>{try{return!!e(...t)}catch{return!1}},aS=Up&&Gp(()=>{let e=!1;const t=new Request(It.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),jp=64*1024,Yc=Up&&Gp(()=>F.isReadableStream(new Response("").body)),Ho={stream:Yc&&(e=>e.body)};Qo&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!Ho[t]&&(Ho[t]=F.isFunction(e[t])?i=>i[t]():(i,s)=>{throw new be(`Response type '${t}' is not supported`,be.ERR_NOT_SUPPORT,s)})})})(new Response);const oS=async e=>{if(e==null)return 0;if(F.isBlob(e))return e.size;if(F.isSpecCompliantForm(e))return(await new Request(It.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(F.isArrayBufferView(e)||F.isArrayBuffer(e))return e.byteLength;if(F.isURLSearchParams(e)&&(e=e+""),F.isString(e))return(await rS(e)).byteLength},lS=async(e,t)=>{const i=F.toFiniteNumber(e.getContentLength());return i??oS(t)},Xc={http:AC,xhr:eS,fetch:Qo&&(async e=>{let{url:t,method:i,data:s,signal:n,cancelToken:r,timeout:a,onDownloadProgress:o,onUploadProgress:u,responseType:h,headers:f,withCredentials:m="same-origin",fetchOptions:w}=Hp(e);h=h?(h+"").toLowerCase():"text";let y=tS([n,r&&r.toAbortSignal()],a),b;const S=y&&y.unsubscribe&&(()=>{y.unsubscribe()});let C;try{if(u&&aS&&i!=="get"&&i!=="head"&&(C=await lS(f,s))!==0){let U=new Request(t,{method:"POST",body:s,duplex:"half"}),Q;if(F.isFormData(s)&&(Q=U.headers.get("content-type"))&&f.setContentType(Q),U.body){const[ee,p]=Bp(C,Do(Pp(u)));s=Fp(U.body,jp,ee,p)}}F.isString(m)||(m=m?"include":"omit");const L="credentials"in Request.prototype;b=new Request(t,{...w,signal:y,method:i.toUpperCase(),headers:f.normalize().toJSON(),body:s,duplex:"half",credentials:L?m:void 0});let x=await fetch(b);const D=Yc&&(h==="stream"||h==="response");if(Yc&&(o||D&&S)){const U={};["status","statusText","headers"].forEach(v=>{U[v]=x[v]});const Q=F.toFiniteNumber(x.headers.get("content-length")),[ee,p]=o&&Bp(Q,Do(Pp(o),!0))||[];x=new Response(Fp(x.body,jp,ee,()=>{p&&p(),S&&S()}),U)}h=h||"text";let E=await Ho[F.findKey(Ho,h)||"text"](x,e);return!D&&S&&S(),await new Promise((U,Q)=>{Op(U,Q,{data:E,headers:Vt.from(x.headers),status:x.status,statusText:x.statusText,config:e,request:b})})}catch(L){throw S&&S(),L&&L.name==="TypeError"&&/fetch/i.test(L.message)?Object.assign(new be("Network Error",be.ERR_NETWORK,e,b),{cause:L.cause||L}):be.from(L,L&&L.code,e,b)}})};F.forEach(Xc,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Wp=e=>`- ${e}`,cS=e=>F.isFunction(e)||e===null||e===!1,zp={getAdapter:e=>{e=F.isArray(e)?e:[e];const{length:t}=e;let i,s;const n={};for(let r=0;r<t;r++){i=e[r];let a;if(s=i,!cS(i)&&(s=Xc[(a=String(i)).toLowerCase()],s===void 0))throw new be(`Unknown adapter '${a}'`);if(s)break;n[a||"#"+r]=s}if(!s){const r=Object.entries(n).map(([o,u])=>`adapter ${o} `+(u===!1?"is not supported by the environment":"is not available in the build"));let a=t?r.length>1?`since :
85
85
  `+r.map(Wp).join(`
86
86
  `):" "+Wp(r[0]):"as no adapter specified";throw new be("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return s},adapters:Xc};function Zc(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Rn(null,e)}function Kp(e){return Zc(e),e.headers=Vt.from(e.headers),e.data=Kc.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),zp.getAdapter(e.adapter||Hr.adapter)(e).then(function(s){return Zc(e),s.data=Kc.call(e,e.transformResponse,s),s.headers=Vt.from(s.headers),s},function(s){return qp(s)||(Zc(e),s&&s.response&&(s.response.data=Kc.call(e,e.transformResponse,s.response),s.response.headers=Vt.from(s.response.headers))),Promise.reject(s)})}const Yp="1.7.7",Jc={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Jc[e]=function(s){return typeof s===e||"a"+(t<1?"n ":" ")+e}});const Xp={};Jc.transitional=function(t,i,s){function n(r,a){return"[Axios v"+Yp+"] Transitional option '"+r+"'"+a+(s?". "+s:"")}return(r,a,o)=>{if(t===!1)throw new be(n(a," has been removed"+(i?" in "+i:"")),be.ERR_DEPRECATED);return i&&!Xp[a]&&(Xp[a]=!0,console.warn(n(a," has been deprecated since v"+i+" and will be removed in the near future"))),t?t(r,a,o):!0}};function uS(e,t,i){if(typeof e!="object")throw new be("options must be an object",be.ERR_BAD_OPTION_VALUE);const s=Object.keys(e);let n=s.length;for(;n-- >0;){const r=s[n],a=t[r];if(a){const o=e[r],u=o===void 0||a(o,r,e);if(u!==!0)throw new be("option "+r+" must be "+u,be.ERR_BAD_OPTION_VALUE);continue}if(i!==!0)throw new be("Unknown option "+r,be.ERR_BAD_OPTION)}}const eu={assertOptions:uS,validators:Jc},Es=eu.validators;class Xs{constructor(t){this.defaults=t,this.interceptors={request:new Mp,response:new Mp}}async request(t,i){try{return await this._request(t,i)}catch(s){if(s instanceof Error){let n;Error.captureStackTrace?Error.captureStackTrace(n={}):n=new Error;const r=n.stack?n.stack.replace(/^.+\n/,""):"";try{s.stack?r&&!String(s.stack).endsWith(r.replace(/^.+\n.+\n/,""))&&(s.stack+=`
87
- `+r):s.stack=r}catch{}}throw s}}_request(t,i){typeof t=="string"?(i=i||{},i.url=t):i=t||{},i=Ys(this.defaults,i);const{transitional:s,paramsSerializer:n,headers:r}=i;s!==void 0&&eu.assertOptions(s,{silentJSONParsing:Es.transitional(Es.boolean),forcedJSONParsing:Es.transitional(Es.boolean),clarifyTimeoutError:Es.transitional(Es.boolean)},!1),n!=null&&(F.isFunction(n)?i.paramsSerializer={serialize:n}:eu.assertOptions(n,{encode:Es.function,serialize:Es.function},!0)),i.method=(i.method||this.defaults.method||"get").toLowerCase();let a=r&&F.merge(r.common,r[i.method]);r&&F.forEach(["delete","get","head","post","put","patch","common"],b=>{delete r[b]}),i.headers=Vt.concat(a,r);const o=[];let u=!0;this.interceptors.request.forEach(function(S){typeof S.runWhen=="function"&&S.runWhen(i)===!1||(u=u&&S.synchronous,o.unshift(S.fulfilled,S.rejected))});const h=[];this.interceptors.response.forEach(function(S){h.push(S.fulfilled,S.rejected)});let f,m=0,w;if(!u){const b=[Kp.bind(this),void 0];for(b.unshift.apply(b,o),b.push.apply(b,h),w=b.length,f=Promise.resolve(i);m<w;)f=f.then(b[m++],b[m++]);return f}w=o.length;let y=i;for(m=0;m<w;){const b=o[m++],S=o[m++];try{y=b(y)}catch(C){S.call(this,C);break}}try{f=Kp.call(this,y)}catch(b){return Promise.reject(b)}for(m=0,w=h.length;m<w;)f=f.then(h[m++],h[m++]);return f}getUri(t){t=Ys(this.defaults,t);const i=Dp(t.baseURL,t.url);return Lp(i,t.params,t.paramsSerializer)}}F.forEach(["delete","get","head","options"],function(t){Xs.prototype[t]=function(i,s){return this.request(Ys(s||{},{method:t,url:i,data:(s||{}).data}))}}),F.forEach(["post","put","patch"],function(t){function i(s){return function(r,a,o){return this.request(Ys(o||{},{method:t,headers:s?{"Content-Type":"multipart/form-data"}:{},url:r,data:a}))}}Xs.prototype[t]=i(),Xs.prototype[t+"Form"]=i(!0)});class tu{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let i;this.promise=new Promise(function(r){i=r});const s=this;this.promise.then(n=>{if(!s._listeners)return;let r=s._listeners.length;for(;r-- >0;)s._listeners[r](n);s._listeners=null}),this.promise.then=n=>{let r;const a=new Promise(o=>{s.subscribe(o),r=o}).then(n);return a.cancel=function(){s.unsubscribe(r)},a},t(function(r,a,o){s.reason||(s.reason=new Rn(r,a,o),i(s.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const i=this._listeners.indexOf(t);i!==-1&&this._listeners.splice(i,1)}toAbortSignal(){const t=new AbortController,i=s=>{t.abort(s)};return this.subscribe(i),t.signal.unsubscribe=()=>this.unsubscribe(i),t.signal}static source(){let t;return{token:new tu(function(n){t=n}),cancel:t}}}function hS(e){return function(i){return e.apply(null,i)}}function dS(e){return F.isObject(e)&&e.isAxiosError===!0}const iu={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(iu).forEach(([e,t])=>{iu[t]=e});function Zp(e){const t=new Xs(e),i=mp(Xs.prototype.request,t);return F.extend(i,Xs.prototype,t,{allOwnKeys:!0}),F.extend(i,t,null,{allOwnKeys:!0}),i.create=function(n){return Zp(Ys(e,n))},i}const We=Zp(Hr);We.Axios=Xs,We.CanceledError=Rn,We.CancelToken=tu,We.isCancel=qp,We.VERSION=Yp,We.toFormData=Bo,We.AxiosError=be,We.Cancel=We.CanceledError,We.all=function(t){return Promise.all(t)},We.spread=hS,We.isAxiosError=dS,We.mergeConfig=Ys,We.AxiosHeaders=Vt,We.formToJSON=e=>Rp(F.isHTMLForm(e)?new FormData(e):e),We.getAdapter=zp.getAdapter,We.HttpStatusCode=iu,We.default=We;const fS={name:"QtiStylesheet",props:{href:{type:String,required:!0},type:{type:String,required:!0}},data(){return{css:"",isQtiValid:!0}},methods:{getCss(){We.get(this.href).then(e=>{this.css=`<style>${e.data}</style>`}).catch(e=>{console.log("["+this.$options.name+"][CSS Fetch Error: "+e+"]")})},validateChildren(){}},created(){this.getCss()},mounted(){if(this.isQtiValid)try{this.validateChildren(),console.log("["+this.$options.name+"][Href: "+this.href+"]")}catch(e){throw this.isQtiValid=!1,new c(e.message)}}},pS=["innerHTML"];function mS(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",{ref:"root",class:"qti-stylesheet",innerHTML:n.css},null,8,pS)}const gS=B(fS,[["render",mS]]),yS={name:"QtiCompanionMaterialsInfo",data(){return{isQtiValid:!0}},methods:{validateChildren(){}},mounted(){if(this.isQtiValid)try{this.validateChildren(),console.log("["+this.$options.name+"]")}catch(e){throw this.isQtiValid=!1,new c(e.message)}}},wS={class:"qti-companion-materials-info"};function bS(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",wS)}const vS=B(yS,[["render",bS]]),Ur=new G,ES={name:"QtiMapping",props:{lowerBound:{type:String,required:!1},upperBound:{type:String,required:!1},defaultValue:{type:String,required:!1}},data(){return{value:null,valueBaseType:"float",valueCardinality:"single",valueLowerBound:null,valueUpperBound:null,valueDefaultValue:new X(0).toNumber(),isQtiValid:!0}},methods:{getValue(){return this.value},setValue(e){this.value=e},isNull(){return this.value===null},getBaseType(){return this.valueBaseType},getCardinality(){return this.valueCardinality},getLowerBound(){return this.valueLowerBound},setLowerBound(e){this.valueLowerBound=e},getUpperBound(){return this.valueUpperBound},setUpperBound(e){this.valueUpperBound=e},getDefaultValue(){return this.valueDefaultValue},setDefaultValue(e){this.valueDefaultValue=e},computeFloatValue(e){let t=null;try{t=new X(e)}catch(i){throw new se(i.message)}return t.toNumber()},applyConstraints(e){return e===null||!X.isBigNumber(e)?null:(this.getLowerBound()!==null&&e.comparedTo(this.getLowerBound())<0&&(e=new X(this.getLowerBound())),this.getUpperBound()!==null&&e.comparedTo(this.getUpperBound())>0&&(e=new X(this.getUpperBound())),e.toNumber())},validateChildren:function(){let e=0;if(!this.$slots.default)throw new c("Must have at least one qti-map-entry node");if(this.$slots.default().forEach(t=>{if(Ur.isValidSlot(t))if(Ur.kebabCase(t.type.name)==="qti-map-entry")e+=1;else throw new c('Node is not a qti-map-entry: "'+t.tpe.name+'"')}),e===0)throw new c("Must have at least one qti-map-entry node")},processChildren(){let e=null;return this.$.subTree.children[0].children.forEach(i=>{if(i.component===null)return;const s=i.component.proxy;e===null&&(e=[]),e.push(s.getValue())}),e}},created(){try{typeof this.lowerBound<"u"&&this.setLowerBound(this.computeFloatValue(Ur.FloatValue(this.lowerBound))),typeof this.upperBound<"u"&&this.setUpperBound(this.computeFloatValue(Ur.FloatValue(this.upperBound))),typeof this.defaultValue<"u"&&this.setDefaultValue(this.computeFloatValue(Ur.FloatValue(this.defaultValue))),this.validateChildren()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.setValue(this.processChildren()),console.log("[QtiMapping][lowerBound][upperBound][defaultValue][Value]",this.getLowerBound(),this.getUpperBound(),this.getDefaultValue(),this.getValue())}catch(e){throw this.isQtiValid=!1,new c(e.message)}}},TS={class:"qti-mapping"};function CS(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",TS,[l.renderSlot(e.$slots,"default")])}const SS=B(ES,[["render",CS]]),su=new G,xS={name:"QtiMapEntry",props:{mapKey:{type:String,required:!0},mappedValue:{type:String,required:!0},caseSensitive:{type:String,required:!1}},data(){return{value:null,valueBaseType:"float",valueCardinality:"single",valueMappedValue:null,valueCaseSensitive:!1,isQtiValid:!0}},methods:{getValue(){return this.value},setValue(e){this.value=e},isNull(){return this.value===null},getBaseType(){return this.valueBaseType},getCardinality(){return this.valueCardinality},setMappedValue(e){this.valueMappedValue=e},getMappedValue(){return this.valueMappedValue},setCaseSensitive(e){this.valueCaseSensitive=e},getCaseSensitive(){return this.valueCaseSensitive},computeMappedValue(e){let t=null;try{t=new X(e)}catch(i){throw new se(i.message)}return t.toNumber()},validateChildren:function(){this.$slots.default&&this.$slots.default().forEach(e=>{if(su.isValidSlot(e))throw new c('Invalid Child Node: "'+e.tpe.name+'"')})}},created(){try{this.setCaseSensitive(su.validateCaseSensitive(this.caseSensitive,!1)),this.setMappedValue(this.computeMappedValue(su.FloatValue(this.mappedValue))),this.validateChildren()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){let e=this.$el.querySelector(".amp-mapentry__container");this.isQtiValid&&(this.setValue({mapKey:this.mapKey,mappedValue:this.getMappedValue(),caseSensitive:this.getCaseSensitive()}),console.log("["+this.$options.name+"][Value]",this.getValue())),e.remove()}},_S={class:"qti-map-entry"},IS={class:"amp-mapentry__container"};function VS(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",_S,[l.createElementVNode("div",IS,[l.renderSlot(e.$slots,"default")])])}const AS=B(xS,[["render",VS]]),$S={name:"QtiAreaMapping",methods:{},created:function(){},mounted:function(){console.log("[AreaMapping][Mounted]")}},LS={class:"qti-area-mapping"};function MS(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",LS)}const NS=B($S,[["render",MS]]),nu=new G,RS={name:"QtiInterpolationTable",props:{defaultValue:{type:String,required:!1}},data(){return{value:null,valueBaseType:null,valueCardinality:"single",valueDefaultValue:null,tableType:"interpolation",isQtiValid:!0}},methods:{getValue(){return this.value},setValue(e){this.value=e},isNull(){return this.value===null},getBaseType(){return this.valueBaseType},setBaseType(e){this.valueBaseType=e},getCardinality(){return this.valueCardinality},getTableType(){return this.tableType},getDefaultValue(){return this.valueDefaultValue},setDefaultValue(e){this.valueDefaultValue=e},validateChildren:function(){let e=0;if(!this.$slots.default)throw new c("Must have at least one qti-interpolation-table-entry node");if(this.$slots.default().forEach(t=>{if(nu.isValidSlot(t))if(nu.kebabCase(t.type.name)==="qti-interpolation-table-entry")e+=1;else throw new c('Node is not a qti-interpolation-table-entry: "'+t.tpe.name+'"')}),e===0)throw new c("Must have at least one qti-interpolation-table-entry node")},processChildren(){let e=null;return this.$.subTree.children[0].children.forEach(i=>{e===null&&(e=[]),e.push(i.getValue())}),e}},created(){try{let e=this.$parent.getBaseType();this.setBaseType(e),typeof this.defaultValue>"u"?this.setDefaultValue(null):this.setDefaultValue(nu.validateValueFromBaseType(e,this.defaultValue)),this.validateChildren()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.setValue(this.processChildren()),console.log("[QtiInterpolationTable][DefaultValue][Value]",this.getDefaultValue(),this.getValue())}catch(e){throw this.isQtiValid=!1,new c(e.message)}}},kS={class:"qti-interpolation-table"};function qS(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",kS,[l.renderSlot(e.$slots,"default")])}const OS=B(RS,[["render",qS]]),Fo=new G,BS={name:"QtiInterpolationTableEntry",props:{sourceValue:{type:String,required:!0},includeBoundary:{type:String,required:!1},targetValue:{type:String,required:!0}},data(){return{value:null,valueSourceValue:null,valueTargetValue:null,valueIncludeBoundary:!0,isQtiValid:!0}},methods:{getValue(){return this.value},setValue(e){this.value=e},isNull(){return this.value===null},getBaseType(){return this.valueBaseType},setSourceValue(e){this.valueSourceValue=e},getSourceValue(){return this.valueSourceValue},setTargetValue(e){this.valueTargetValue=e},getTargetValue(){return this.valueTargetValue},setIncludeBoundary(e){this.valueIncludeBoundary=e},getIncludeBoundary(){return this.valueIncludeBoundary},computeSourceValue(e){let t=null;try{t=new X(e)}catch(i){throw new se(i.message)}return t.toNumber()},isValidSlot(e){if(typeof e.componentOptions<"u")return!0;if(typeof e.text<"u"&&e.text.trim().length>0)throw new c('Invalid Child Node: "'+e.text.trim()+'"');return!1},validateChildren(){this.$slots.default&&this.$slots.default().forEach(e=>{if(Fo.isValidSlot(e))throw new c('Invalid Child Node: "'+e.tpe.name+'"')})}},created(){try{let e=this.$parent.$parent.getBaseType();this.setIncludeBoundary(Fo.validateIncludeBoundary(this.includeBoundary,"include-boundary")),this.setSourceValue(this.computeSourceValue(Fo.FloatValue(this.sourceValue))),this.setTargetValue(Fo.validateValueFromBaseType(e,this.targetValue))}catch(e){if(this.isQtiValid=!1,e.name==="QtiValidationException")throw new c(e.message);if(e.name==="QtiParseException")throw new se(e.message)}},mounted(){let e=this.$el.querySelector(".amp-interpolationentry__container");this.isQtiValid&&(this.setValue({sourceValue:this.getSourceValue(),targetValue:this.getTargetValue(),includeBoundary:this.getIncludeBoundary()}),console.log("["+this.$options.name+"][Value]",this.getValue())),e.remove()}},PS={class:"qti-interpolation-table-entry"},DS={class:"amp-interpolationentry__container"};function QS(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",PS,[l.createElementVNode("div",DS,[l.renderSlot(e.$slots,"default")])])}const HS=B(BS,[["render",QS]]),ru=new G,FS={name:"QtiMatchTable",props:{defaultValue:{type:String,required:!1}},data(){return{value:null,valueBaseType:null,valueCardinality:"single",valueDefaultValue:null,tableType:"match",isQtiValid:!0}},methods:{getValue(){return this.value},setValue(e){this.value=e},isNull(){return this.value===null},getBaseType(){return this.valueBaseType},setBaseType(e){this.valueBaseType=e},getCardinality(){return this.valueCardinality},getTableType(){return this.tableType},getDefaultValue(){return this.valueDefaultValue},setDefaultValue(e){this.valueDefaultValue=e},validateChildren:function(){let e=0;if(!this.$slots.default)throw new c("Must have at least one qti-match-table-entry node");if(this.$slots.default().forEach(t=>{if(ru.isValidSlot(t))if(ru.kebabCase(t.type.name)==="qti-match-table-entry")e+=1;else throw new c('Node is not a qti-match-table-entry: "'+t.tpe.name+'"')}),e===0)throw new c("Must have at least one qti-match-table-entry node")},processChildren(){let e=null;return this.$.subTree.children[0].children.forEach(i=>{e===null&&(e=[]),e.push(i.getValue())}),e}},created(){try{let e=this.$parent.getBaseType();this.setBaseType(e),typeof this.defaultValue>"u"?this.setDefaultValue(null):this.setDefaultValue(ru.validateValueFromBaseType(e,this.defaultValue)),this.validateChildren()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.setValue(this.processChildren()),console.log("[QtiMatchTable][DefaultValue][Value]",this.getDefaultValue(),this.getValue())}catch(e){throw this.isQtiValid=!1,new c(e.message)}}},US={class:"qti-match-table"};function GS(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",US,[l.renderSlot(e.$slots,"default")])}const jS=B(FS,[["render",GS]]),au=new G,WS={name:"QtiMatchTableEntry",props:{sourceValue:{type:String,required:!0},targetValue:{type:String,required:!0}},data(){return{value:null,valueSourceValue:null,valueTargetValue:null,isQtiValid:!0}},methods:{getValue(){return this.value},setValue(e){this.value=e},isNull(){return this.value===null},getBaseType(){return this.valueBaseType},getCardinality(){return this.valueCardinality},setSourceValue(e){this.valueSourceValue=e},getSourceValue(){return this.valueSourceValue},setTargetValue(e){this.valueTargetValue=e},getTargetValue(){return this.valueTargetValue},computeSourceValue(e){let t=null;try{if(t=new X(e),!t.isInteger())throw new se('Invalid qti-match-table-entry source-value integer "'+t+'"')}catch(i){throw new se(i.message)}return t.toNumber()},validateChildren(){this.$slots.default&&this.$slots.default().forEach(e=>{if(au.isValidSlot(e))throw new c('Invalid Child Node: "'+e.tpe.name+'"')})}},created(){try{let e=this.$parent.$parent.getBaseType();this.setSourceValue(this.computeSourceValue(au.IntegerValue(this.sourceValue))),this.setTargetValue(au.validateValueFromBaseType(e,this.targetValue)),this.validateChildren()}catch(e){if(this.isQtiValid=!1,e.name==="QtiValidationException")throw new c(e.message);if(e.name==="QtiParseException")throw new se(e.message)}},mounted(){let e=this.$el.querySelector(".amp-matchtableentry__container");this.isQtiValid&&(this.setValue({sourceValue:this.getSourceValue(),targetValue:this.getTargetValue()}),console.log("["+this.$options.name+"][Value]",this.getValue())),e.remove()}},zS={class:"qti-match-table-entry"},KS={class:"amp-matchtableentry__container"};function YS(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",zS,[l.createElementVNode("div",KS,[l.renderSlot(e.$slots,"default")])])}const XS=B(WS,[["render",YS]]),ZS={name:"QtiDefaultValue",props:{interpretation:{type:String,required:!1}},data(){return{value:null,valueBaseType:null,valueCardinality:null,variableBaseType:null,variableCardinality:null,isQtiValid:!0}},methods:{getValue(){return this.value},setValue(e){this.value=e},isNull(){return this.value===null},getBaseType(){return this.valueBaseType},getCardinality(){return this.valueCardinality},processChildren(){let e=null;return this.$.subTree.children[0].children.forEach(i=>{if(i.component===null)return;const s=i.component.proxy;switch(this.variableCardinality){case"record":e===null&&(e=new Map),s.isRecordFieldValue()&&e.set(s.getFieldIdentifier(),s);break;case"multiple":case"ordered":e===null&&(e=[]),e.push(s.getValue());break;case"single":e=e===null?s.getValue():e;break;default:console.log("[DefaultValue][Cardinality]: processChildren cardinality unhandled = "+this.variableCardinality)}}),e},getVariableBaseType(){return this.$parent.$props.baseType},getVariableCardinality(){return this.$parent.$props.cardinality},evaluate(){return this.getValue()}},created(){try{this.valueBaseType=this.variableBaseType=this.getVariableBaseType(),this.valueCardinality=this.variableCardinality=this.getVariableCardinality()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.setValue(this.processChildren()),console.log("[DefaultValue][Value:",this.getValue(),"][BaseType:"+this.getBaseType()+"][Cardinality:"+this.getCardinality()+"]")}catch(e){throw this.isQtiValid=!1,new c(e.message)}}},JS={ref:"root",class:"qti-default-value"};function e1(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",JS,[l.renderSlot(e.$slots,"default")],512)}const t1=B(ZS,[["render",e1]]),i1={name:"QtiCorrectResponse",props:{interpretation:{type:String,required:!1}},data(){return{value:null,valueBaseType:null,valueCardinality:null,variableBaseType:null,variableCardinality:null,isQtiValid:!0}},methods:{getValue(){return this.value},setValue(e){this.value=e},isNull(){return this.value===null},getBaseType(){return this.valueBaseType},getCardinality(){return this.valueCardinality},processChildren(){let e=null;return this.$.subTree.children[0].children.forEach(i=>{if(i.component===null)return;const s=i.component.proxy;switch(this.variableCardinality){case"record":e===null&&(e=new Map),s.isRecordFieldValue()&&e.set(s.getFieldIdentifier(),s);break;case"multiple":case"ordered":e===null&&(e=[]),e.push(s.getValue());break;case"single":e=e===null?s.getValue():e;break;default:console.log("[CorrectResponse][Cardinality]: processChildren cardinality unhandled = "+this.variableCardinality)}}),e},getVariableBaseType(){return this.$parent.$props.baseType},getVariableCardinality(){return this.$parent.$props.cardinality},evaluate(){return this.getValue()}},created(){try{this.valueBaseType=this.variableBaseType=this.getVariableBaseType(),this.valueCardinality=this.variableCardinality=this.getVariableCardinality()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.setValue(this.processChildren()),console.log("[CorrectResponse][Value:",this.getValue(),"][BaseType:"+this.getBaseType()+"][Cardinality:"+this.getCardinality()+"]")}catch(e){throw this.isQtiValid=!1,new c(e.message)}}},s1={class:"qti-correct-response"};function n1(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",s1,[l.renderSlot(e.$slots,"default")])}const r1=B(i1,[["render",n1]]);class Jp{constructor(){}IntegerValue(t){if(t!=null&&(t=t.trim()),t==null||t.length==0)throw new se('Invalid integer "'+t+'". Length is not valid.');try{let i=parseInt(t,10);if(Number.isNaN(i))throw new se('Invalid integer "'+t+'". ');return i}catch(i){throw new se('Invalid integer "'+t+'". '+i.message)}}FloatValue(t){if(t!=null&&(t=t.trim()),t==null||t.length==0)throw new se('Invalid float "'+t+'". Length is not valid.');try{let i=parseFloat(t);if(Number.isNaN(i))throw new se('Invalid float "'+t+'". ');return i}catch(i){throw new se('Invalid float "'+t+'". '+i.message)}}BooleanValue(t){if(t!=null&&(t=t.trim()),t==null||t.length==0)throw new se('Invalid boolean "'+t+'". Length is not valid.');if(t.toLowerCase()==="true"||t==="1")return!0;if(t.toLowerCase()==="false"||t==="0")return!1;throw new se('Invalid boolean "'+t+'".')}StringValue(t){if(t==null||t.length==0)throw new se('Invalid string "'+t+'". Length is not valid.');return t}IdentifierValue(t){if(t!=null&&(t=t.trim()),t==null||t.length==0)throw new se('Invalid identifier "'+t+'". Length is not valid.');if(!this.isCharacterALetter(t.charAt(0))&&!this.isCharacterADigit(t.charAt(0))&&t.charAt(0)!=="_")throw new se('Invalid identifier "'+t+'". First character "'+t.charAt(0)+'" is not valid.');for(let i=1;i<t.length;i++)if(!this.isCharacterALetterOrDigit(t.charAt(i))&&t.charAt(i)!=="_"&&t.charAt(i)!=="-"&&t.charAt(i)!==".")throw new se('Invalid identifier "'+t+'". Character "'+t.charAt(i)+'" at position '+(i+1)+" is not valid.");return t}isCharacterALetter(t){return/[a-zA-Z]/.test(t)}isCharacterADigit(t){return/\d/.test(t)}isCharacterALetterOrDigit(t){return this.isCharacterALetter(t)||this.isCharacterADigit(t)}}const ou=new G,kn=new Jp,a1={name:"QtiValue",props:{baseType:{type:String,required:!1},fieldIdentifier:{type:String,required:!1}},data(){return{singleValue:null,valueBaseType:null,valueCardinality:"single",valueFieldIdentifier:null,variableBaseType:null,variableCardinality:null,isQtiValid:!0}},methods:{getValue(){if(this.isNull())return null;switch(this.valueBaseType){case"integer":case"float":return this.singleValue.toNumber();case"boolean":return this.singleValue;case"string":case"identifier":case"directedPair":case"pair":return this.singleValue;default:return console.log("[QtiValue][GetValue Exception]","Unhandled BaseType:"+this.valueBaseType),null}},isNull(){return this.singleValue===null},getBaseType(){return this.valueBaseType},getCardinality(){return"single"},getFieldIdentifier(){return this.valueFieldIdentifier},isRecordFieldValue(){return this.valueFieldIdentifier!==null&&this.valueBaseType!==null},readChildren(e){this.valueBaseType!=null&&(this.singleValue=this.parseSingleValue(this.valueBaseType,e.textContent))},parseSingleValue(e,t){let i=null;try{switch(e){case"integer":i=new X(kn.IntegerValue(t));break;case"float":i=new X(kn.FloatValue(t));break;case"boolean":i=kn.BooleanValue(t);break;case"string":i=kn.StringValue(t);break;case"identifier":i=kn.IdentifierValue(t);break;case"directedPair":case"pair":i=kn.StringValue(t);break;default:throw new se('[QtiValue][Unhandled BaseType]: "'+e+'"')}}catch(s){throw new se(s.message)}return i},_getVariableBaseType(e){return typeof e<"u"?e.baseType:null},_getVariableCardinality(e){return typeof e<"u"?e.cardinality:null},_validateAttributes(e,t){if(t==="record"){if(typeof this.baseType>"u")throw new c('base-type is a required attribute for "record" cardinality');if(ou.validateBaseType(this.baseType),this.valueBaseType=this.baseType,typeof this.fieldIdentifier>"u")throw new c('field-identifier is a required attribute for "record" cardinality');ou.validateIdentifierAttribute(this.fieldIdentifier),this.valueFieldIdentifier=this.fieldIdentifier}else{if(typeof this.baseType<"u")throw new c("base-type only permitted for record cardinality.");if(typeof this.fieldIdentifier<"u")throw new c("field-identifier only permitted for record cardinality.");this.valueBaseType=e}},getStore(){return this.$parent.$parent.getDeclarationContext()==="TEST"?it:_}},created:function(){try{let e=ou.validateVariableIdentifierAttribute(this.getStore(),this.$parent.$parent.$props.identifier);if(typeof e>"u")throw new c('Variable declaration not found: "'+this.$parent.$parent.$props.identifier+'"');this.variableCardinality=this._getVariableCardinality(e),this.variableBaseType=this._getVariableBaseType(e),this._validateAttributes(this.variableBaseType,this.variableCardinality)}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted:function(){let e=this.$el.querySelector(".amp-value__container");if(this.isQtiValid){try{this.readChildren(e)}catch(t){throw this.isQtiValid=!1,t.name==="QtiValidationException"?new c(t.message):t.name==="QtiParseException"?new se(t.message):new Error(t.message)}console.log("["+this.$options.name+"][Value:"+this.getValue()+"][BaseType:"+this.getBaseType()+"][FieldIdentifier:"+this.getFieldIdentifier()+"]")}e.remove()}},o1=["variable-basetype","variable-cardinality"],l1={class:"amp-value__container"};function c1(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",{class:"qti-value","variable-basetype":n.variableBaseType,"variable-cardinality":n.variableCardinality},[l.createElementVNode("div",l1,[l.renderSlot(e.$slots,"default")])],8,o1)}const u1=B(a1,[["render",c1]]),h1=new G,d1={name:"QtiItemBody",emits:["itemBodyReady"],data(){return{mathElementMap:new Map}},methods:{initializeTemplateMathVariables(){const e=this.getTemplateMathVariables();if(e.length===0)return;this.getMathElements().forEach(function(i){this.archiveMathElement(i),i.innerHTML=this.applyTemplateValuesToMathml(i.innerHTML,e)},this)},updateTemplateMathVariables(){const e=this.getTemplateMathVariables();if(e.length===0)return;this.getMathScriptElements().forEach(function(i){for(let[s,n]of this.mathElementMap){const r=new RegExp('id="('+s+')"',"g");if(i.innerHTML.match(r)){i.innerHTML=this.applyTemplateValuesToMathml(n,e);break}}},this),this.reprocessMML()},getTemplateMathVariables(){return _.getTemplateMathParameterVariables()},getMathElements(){return this.$el.querySelectorAll("math")},getMathScriptElements(){return this.$el.querySelectorAll('script[type="math/mml"]')},archiveMathElement(e){e.hasAttribute("id")||(e.id=h1.randomString(5,"a")),this.mathElementMap.set(e.id,e.outerHTML)},applyTemplateValuesToMathml(e,t){let i=e;return t.forEach(function(s){const n=new RegExp("<[mc]i[^>]*>("+s.identifier+")<\\/[mc]i>","g"),r=e.match(n);r&&(i=i.replace(n,r[0].replace(s.identifier,s.value)))}),i},reprocessMML(){this.$nextTick(()=>{window.MathJax&&window.MathJax.Hub.Queue(["Reprocess",window.MathJax.Hub,this.$refs.root])})}},mounted(){this.initializeTemplateMathVariables(),this.$parent.$emit("itemBodyReady",{itemBody:this})}},f1={ref:"root",class:"qti-item-body"};function p1(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",f1,[l.renderSlot(e.$slots,"default")],512)}const m1=B(d1,[["render",p1]]),g1={name:"ModalDialog",data(){return{visible:!0}},methods:{hide(){this.$refs.mymodal.classList.remove("fade","show"),document.querySelector("body").classList.remove("modal-open")},show(){this.$refs.mymodal.classList.add("fade","show"),document.querySelector("body").classList.add("modal-open")}}},y1={key:0,ref:"mymodal",class:"qti3-player-modal"},w1={class:"qti3-player-modal-dialog qti3-player-modal-md qti3-player-modal-dialog-centered"},b1={class:"qti3-player-modal-content"},v1={class:"qti3-player-modal-header"},E1={class:"qti3-player-modal-body"},T1={class:"qti3-player-modal-footer"};function C1(e,t,i,s,n,r){return l.openBlock(),l.createBlock(l.Transition,{name:"fade"},{default:l.withCtx(()=>[n.visible?(l.openBlock(),l.createElementBlock("div",y1,[l.createElementVNode("div",w1,[t[2]||(t[2]=l.createElementVNode("span",{tabindex:"0"},null,-1)),l.createElementVNode("div",b1,[l.createElementVNode("header",v1,[l.renderSlot(e.$slots,"header",{},void 0,!0),l.createElementVNode("button",{type:"button",class:"qti3-player-close","aria-label":"Close",onClick:t[0]||(t[0]=a=>r.hide())},"×")]),l.createElementVNode("div",E1,[l.renderSlot(e.$slots,"body",{},void 0,!0)]),l.createElementVNode("footer",T1,[l.renderSlot(e.$slots,"footer",{},void 0,!0)])]),t[3]||(t[3]=l.createElementVNode("span",{tabindex:"0"},null,-1))]),l.createElementVNode("div",{class:"qti3-player-modal-backdrop",onClick:t[1]||(t[1]=a=>r.hide())})],512)):l.createCommentVNode("",!0)]),_:3})}const S1=B(g1,[["render",C1],["__scopeId","data-v-2611a8eb"]]),Gr=new G,x1={name:"QtiModalFeedback",components:{ModalDialog:S1},props:{identifier:{type:String,required:!0},outcomeIdentifier:{type:String,required:!0},showHide:{type:String,required:!0},title:{type:String,required:!1}},computed:{modalTitle(){return typeof this.title>"u"?void 0:this.title}},data(){return{outcomeDeclaration:null,mathElementMap:new Map,isQtiValid:!0}},inheritAttrs:!0,methods:{initializeTemplateMathVariables(){const e=this.getTemplateMathVariables();if(e.length===0)return;this.getMathElements().forEach(function(i){this.archiveMathElement(i),i.innerHTML=this.applyTemplateValuesToMathml(i.innerHTML,e)},this)},updateTemplateMathVariables(){const e=this.getTemplateMathVariables();if(e.length===0)return;this.getMathScriptElements().forEach(function(i){for(let[s,n]of this.mathElementMap){const r=new RegExp('id="('+s+')"',"g");if(i.innerHTML.match(r)){i.innerHTML=this.applyTemplateValuesToMathml(n,e);break}}},this),this.reprocessMML()},getTemplateMathVariables(){return _.getTemplateMathParameterVariables()},getMathElements(){return this.$el.querySelectorAll("math")},getMathScriptElements(){return this.$el.querySelectorAll('script[type="math/mml"]')},archiveMathElement(e){e.hasAttribute("id")||(e.id=Gr.randomString(5,"a")),this.mathElementMap.set(e.id,e.outerHTML)},applyTemplateValuesToMathml(e,t){let i=e;return t.forEach(function(s){const n=new RegExp("<[mc]i[^>]*>("+s.identifier+")<\\/[mc]i>","g"),r=e.match(n);r&&(i=i.replace(n,r[0].replace(s.identifier,s.value)))}),i},reprocessMML(){this.$nextTick(()=>{window.MathJax&&window.MathJax.Hub.Queue(["Reprocess",window.MathJax.Hub,this.$refs.root])})},display(e){e?this.$refs.modal.show():this.$refs.modal.hide()},evaluate(){if(this.outcomeDeclaration=Gr.validateOutcomeIdentifierAttribute(_,this.outcomeIdentifier),this.outcomeDeclaration.cardinality==="single"){if(this.outcomeDeclaration.value===this.identifier){this.display(this.show);return}this.show||this.display(!0);return}if(this.outcomeDeclaration.cardinality==="multiple"){for(let e=0;e<this.outcomeDeclaration.value.length;e++)if(this.outcomeDeclaration.value[e]===this.identifier){this.display(this.show);return}this.show||this.display(!0)}}},created(){try{let e=Gr.validateOutcomeIdentifierAttribute(_,this.outcomeIdentifier);if(e.baseType!=="identifier")throw new c('Invalid outcome variable base-type: "'+e.baseType+'". Must be "identifier".');if(e.cardinality!=="single"&&e.cardinality!=="multiple")throw new c('Invalid outcome variable cardinality: "'+e.cardinality+'". Must be "single" or "multiple".');Gr.validateIdentifierAttribute(this.identifier),this.show=Gr.validateShowHideAttribute(this.showHide)}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.initializeTemplateMathVariables(),_.defineFeedback({outcomeIdentifier:this.outcomeIdentifier,identifier:this.identifier,feedbackType:"Modal",node:this}),console.log("[ModalFeedback]",this)}catch(e){throw this.isQtiValid=!1,new c(e.message)}}},_1={ref:"root",class:"qti-modal-feedback"};function I1(e,t,i,s,n,r){const a=l.resolveComponent("ModalDialog");return l.openBlock(),l.createElementBlock("div",_1,[l.createVNode(a,{ref:"modal"},{header:l.withCtx(()=>[l.createElementVNode("h5",null,l.toDisplayString(r.modalTitle),1)]),body:l.withCtx(()=>[l.renderSlot(e.$slots,"default")]),footer:l.withCtx(()=>[l.createElementVNode("button",{class:"qti-modal-feedback-ok",onClick:t[0]||(t[0]=o=>e.$refs.modal.hide())},"OK")]),_:3},512)],512)}const V1=B(x1,[["render",I1]]),A1={name:"QtiContentBody",data(){return{isQtiValid:!0}},mounted(){}},$1={ref:"root",class:"qti-content-body"};function L1(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",$1,[l.renderSlot(e.$slots,"default")],512)}const M1=B(A1,[["render",L1]]),Uo=new G,N1={name:"QtiTemplateInline",props:{identifier:{type:String,required:!0},templateIdentifier:{type:String,required:!0},showHide:{type:String,required:!1,default:"show"}},data(){return{value:null,templateDeclaration:null,show:!0,isQtiValid:!0}},methods:{evaluate(){try{if(this.hideTemplate(),this.templateDeclaration=Uo.validateTemplateIdentifierAttribute(_,this.templateIdentifier),console.log("[QtiTemplateInline]["+this.templateIdentifier+"][Show]",this.show),this.templateDeclaration.cardinality==="single"){if(this.templateDeclaration.value===this.identifier){this.show?this.showTemplate():this.hideTemplate();return}this.show||this.showTemplate();return}if(this.templateDeclaration.cardinality==="multiple"){for(let e=0;e<this.templateDeclaration.value.length;e++)if(this.templateDeclaration.value[e]===this.identifier){this.show?this.showTemplate():this.hideTemplate();return}this.show||this.hideTemplate();return}}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiEvaluationException"?new O(e.message):new Error(e.message)}},hideTemplate(){this.$refs.root.classList.add("hidden")},showTemplate(){this.$refs.root.classList.remove("hidden")}},created(){try{let e=Uo.validateTemplateIdentifierAttribute(_,this.templateIdentifier);if(e.baseType!=="identifier")throw new c('Invalid template variable base-type: "'+e.baseType+'". Must be "identifier".');if(e.cardinality!=="single"&&e.cardinality!=="multiple")throw new c('Invalid template variable cardinality: "'+e.cardinality+'". Must be "single" or "multiple".');Uo.validateIdentifierAttribute(this.identifier),this.show=Uo.validateShowHideAttribute(this.showHide)}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{_.defineTemplate({node:this}),this.evaluate()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiEvaluationException"?new O(e.message):new Error(e.message)}}},R1={ref:"root",class:"qti-template-inline hidden"};function k1(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",R1,[l.renderSlot(e.$slots,"default")],512)}const q1=B(N1,[["render",k1]]),Go=new G,O1={name:"QtiTemplateBlock",props:{identifier:{type:String,required:!0},templateIdentifier:{type:String,required:!0},showHide:{type:String,required:!1,default:"show"}},data(){return{value:null,templateDeclaration:null,show:!0,isQtiValid:!0}},methods:{evaluate(){try{if(this.hideTemplate(),this.templateDeclaration=Go.validateTemplateIdentifierAttribute(_,this.templateIdentifier),console.log("[QtiTemplateBlock]["+this.templateIdentifier+"][Show]",this.show),this.templateDeclaration.cardinality==="single"){if(this.templateDeclaration.value===this.identifier){this.show?this.showTemplate():this.hideTemplate();return}this.show||this.showTemplate();return}if(this.templateDeclaration.cardinality==="multiple"){for(let e=0;e<this.templateDeclaration.value.length;e++)if(this.templateDeclaration.value[e]===this.identifier){this.show?this.showTemplate():this.hideTemplate();return}this.show||this.showTemplate();return}}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiEvaluationException"?new O(e.message):new Error(e.message)}},hideTemplate(){this.$refs.root.classList.add("hidden")},showTemplate(){this.$refs.root.classList.remove("hidden")}},created(){try{let e=Go.validateTemplateIdentifierAttribute(_,this.templateIdentifier);if(e.baseType!=="identifier")throw new c('Invalid template variable base-type: "'+e.baseType+'". Must be "identifier".');if(e.cardinality!=="single"&&e.cardinality!=="multiple")throw new c('Invalid template variable cardinality: "'+e.cardinality+'". Must be "single" or "multiple".');Go.validateIdentifierAttribute(this.identifier),this.show=Go.validateShowHideAttribute(this.showHide)}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{_.defineTemplate({node:this}),this.evaluate()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiEvaluationException"?new O(e.message):new Error(e.message)}}},B1={ref:"root",class:"qti-template-block hidden"};function P1(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",B1,[l.renderSlot(e.$slots,"default")],512)}const D1=B(O1,[["render",P1]]),jo=new G,Q1={name:"QtiFeedbackInline",props:{identifier:{type:String,required:!0},outcomeIdentifier:{type:String,required:!0},showHide:{type:String,required:!0}},data(){return{show:null,outcomeDeclaration:null,isQtiValid:!0}},methods:{defaultShowHide(){this.show?this.$refs.root.classList.add("hidden"):this.$refs.root.classList.remove("hidden")},display(e){e?this.$refs.root.classList.remove("hidden"):this.$refs.root.classList.add("hidden")},isOutcomeValueNull(e){return e===null},evaluate(){if(this.defaultShowHide(),this.outcomeDeclaration=jo.validateOutcomeIdentifierAttribute(_,this.outcomeIdentifier),this.outcomeDeclaration.cardinality==="single"){if(this.isOutcomeValueNull(this.outcomeDeclaration.value))return;if(this.outcomeDeclaration.value===this.identifier){this.display(this.show);return}this.show||this.display(!0);return}if(this.outcomeDeclaration.cardinality==="multiple"){if(this.isOutcomeValueNull(this.outcomeDeclaration.value))return;for(let e=0;e<this.outcomeDeclaration.value.length;e++)if(this.outcomeDeclaration.value[e]===this.identifier){this.display(this.show);return}this.show||this.display(!0)}}},created(){try{let e=jo.validateOutcomeIdentifierAttribute(_,this.outcomeIdentifier);if(e.baseType!=="identifier")throw new c('Invalid outcome variable base-type: "'+e.baseType+'". Must be "identifier".');if(e.cardinality!=="single"&&e.cardinality!=="multiple")throw new c('Invalid outcome variable cardinality: "'+e.cardinality+'". Must be "single" or "multiple".');jo.validateIdentifierAttribute(this.identifier),this.show=jo.validateShowHideAttribute(this.showHide)}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.defaultShowHide(),_.defineFeedback({outcomeIdentifier:this.outcomeIdentifier,identifier:this.identifier,feedbackType:"Inline",show:this.show,node:this}),console.log("[FeedbackInline]",this)}catch(e){throw this.isQtiValid=!1,new c(e.message)}}},H1={ref:"root",class:"qti-feedback-inline hidden"};function F1(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",H1,[l.renderSlot(e.$slots,"default")],512)}const U1=B(Q1,[["render",F1]]),Wo=new G,G1={name:"QtiFeedbackBlock",props:{identifier:{type:String,required:!0},outcomeIdentifier:{type:String,required:!0},showHide:{type:String,required:!0}},data(){return{show:null,outcomeDeclaration:null,isQtiValid:!0}},methods:{defaultShowHide(){this.show?this.$refs.root.classList.add("hidden"):this.$refs.root.classList.remove("hidden")},display(e){e?this.$refs.root.classList.remove("hidden"):this.$refs.root.classList.add("hidden")},isOutcomeValueNull(e){return e===null},evaluate(){if(this.defaultShowHide(),this.outcomeDeclaration=Wo.validateOutcomeIdentifierAttribute(_,this.outcomeIdentifier),console.log("[FeedbackBlock]["+this.identifier+"][evaluate]",this.outcomeIdentifier,this.outcomeDeclaration.value),this.outcomeDeclaration.cardinality==="single"){if(this.isOutcomeValueNull(this.outcomeDeclaration.value))return;if(this.outcomeDeclaration.value===this.identifier){this.display(this.show);return}this.show||this.display(!0);return}if(this.outcomeDeclaration.cardinality==="multiple"){if(this.isOutcomeValueNull(this.outcomeDeclaration.value))return;for(let e=0;e<this.outcomeDeclaration.value.length;e++)if(this.outcomeDeclaration.value[e]===this.identifier){this.display(this.show);return}this.show||this.display(!0)}}},created(){try{let e=Wo.validateOutcomeIdentifierAttribute(_,this.outcomeIdentifier);if(e.baseType!=="identifier")throw new c('Invalid outcome variable base-type: "'+e.baseType+'". Must be "identifier".');if(e.cardinality!=="single"&&e.cardinality!=="multiple")throw new c('Invalid outcome variable cardinality: "'+e.cardinality+'". Must be "single" or "multiple".');Wo.validateIdentifierAttribute(this.identifier),this.show=Wo.validateShowHideAttribute(this.showHide)}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.defaultShowHide(),_.defineFeedback({outcomeIdentifier:this.outcomeIdentifier,identifier:this.identifier,feedbackType:"Block",show:this.show,node:this}),console.log("[FeedbackBlock]",this)}catch(e){throw this.isQtiValid=!1,new c(e.message)}}},j1={ref:"root",class:"qti-feedback-block hidden"};function W1(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",j1,[l.renderSlot(e.$slots,"default")],512)}const z1=B(G1,[["render",W1]]),K1=new G,Y1=new ie,X1={name:"QtiRubricBlock",props:{view:{type:String,required:!0},use:{type:String,required:!1}},data(){return{rubricBlockContext:null,isQtiValid:!0}},computed:{isScoringRubricBlock(){const e=this.view.split(" ");for(let t=0;t<e.length;t++)if(e[t]==="scorer")return!0;return!1}},methods:{getView(){return this.view},getUse(){return this.use},getInnerHtml(){return this.$refs.root.innerHTML},getStore(){return this.rubricBlockContext==="TEST"?it:_},validateChildren(){},evaluate(){if(!this.isScoringRubricBlock){this.$refs.root.classList.remove("hidden");return}this.$refs.root.innerHTML=""}},created(){try{this.rubricBlockContext=Y1.computeNodeContext(this),K1.validateRubricBlockViewAttribute(this.view),this.validateChildren()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.isScoringRubricBlock&&this.getStore().defineScoringRubricBlock({view:this.view,html:this.$refs.root.innerHTML,node:this}),this.evaluate(),console.log("["+this.$options.name+"]["+this.rubricBlockContext+"][View: "+this.view+"]")}catch(e){throw this.isQtiValid=!1,new c(e.message)}}},Z1={ref:"root",class:"qti-rubric-block hidden"};function J1(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",Z1,[l.renderSlot(e.$slots,"default")],512)}const ex=B(X1,[["render",J1]]);var Ts=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function em(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var tm={},zo={},im={},Ko={};Object.defineProperty(Ko,"__esModule",{value:!0}),Ko.boolean=void 0;const tx=function(e){switch(Object.prototype.toString.call(e)){case"[object String]":return["true","t","yes","y","on","1"].includes(e.trim().toLowerCase());case"[object Number]":return e.valueOf()===1;case"[object Boolean]":return e.valueOf();default:return!1}};Ko.boolean=tx;var Yo={};Object.defineProperty(Yo,"__esModule",{value:!0}),Yo.isBooleanable=void 0;const ix=function(e){switch(Object.prototype.toString.call(e)){case"[object String]":return["true","t","yes","y","on","1","false","f","no","n","off","0"].includes(e.trim().toLowerCase());case"[object Number]":return[0,1].includes(e.valueOf());case"[object Boolean]":return!0;default:return!1}};Yo.isBooleanable=ix,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.isBooleanable=e.boolean=void 0;const t=Ko;Object.defineProperty(e,"boolean",{enumerable:!0,get:function(){return t.boolean}});const i=Yo;Object.defineProperty(e,"isBooleanable",{enumerable:!0,get:function(){return i.isBooleanable}})}(im);var Xo={};Object.defineProperty(Xo,"__esModule",{value:!0}),Xo.tokenize=void 0;const sx=/(?:%(?<flag>([+0-]|-\+))?(?<width>\d+)?(?<position>\d+\$)?(?<precision>\.\d+)?(?<conversion>[%BCESb-iosux]))|(\\%)/g,nx=e=>{let t;const i=[];let s=0,n=0,r=null;for(;(t=sx.exec(e))!==null;){t.index>n&&(r={literal:e.slice(n,t.index),type:"literal"},i.push(r));const a=t[0];n=t.index+a.length,a==="\\%"||a==="%%"?r&&r.type==="literal"?r.literal+="%":(r={literal:"%",type:"literal"},i.push(r)):t.groups&&(r={conversion:t.groups.conversion,flag:t.groups.flag||null,placeholder:a,position:t.groups.position?Number.parseInt(t.groups.position,10)-1:s++,precision:t.groups.precision?Number.parseInt(t.groups.precision.slice(1),10):null,type:"placeholder",width:t.groups.width?Number.parseInt(t.groups.width,10):null},i.push(r))}return n<=e.length-1&&(r&&r.type==="literal"?r.literal+=e.slice(n):i.push({literal:e.slice(n),type:"literal"})),i};Xo.tokenize=nx,Object.defineProperty(zo,"__esModule",{value:!0}),zo.createPrintf=void 0;const sm=im,rx=Xo,ax=(e,t)=>t.placeholder,ox=e=>{var t;const i=(r,a,o)=>o==="-"?r.padEnd(a," "):o==="-+"?((Number(r)>=0?"+":"")+r).padEnd(a," "):o==="+"?((Number(r)>=0?"+":"")+r).padStart(a," "):o==="0"?r.padStart(a,"0"):r.padStart(a," "),s=(t=e==null?void 0:e.formatUnboundExpression)!==null&&t!==void 0?t:ax,n={};return(r,...a)=>{let o=n[r];o||(o=n[r]=rx.tokenize(r));let u="";for(const h of o)if(h.type==="literal")u+=h.literal;else{let f=a[h.position];if(f===void 0)u+=s(r,h,a);else if(h.conversion==="b")u+=sm.boolean(f)?"true":"false";else if(h.conversion==="B")u+=sm.boolean(f)?"TRUE":"FALSE";else if(h.conversion==="c")u+=f;else if(h.conversion==="C")u+=String(f).toUpperCase();else if(h.conversion==="i"||h.conversion==="d")f=String(Math.trunc(f)),h.width!==null&&(f=i(f,h.width,h.flag)),u+=f;else if(h.conversion==="e")u+=Number(f).toExponential();else if(h.conversion==="E")u+=Number(f).toExponential().toUpperCase();else if(h.conversion==="f")h.precision!==null&&(f=Number(f).toFixed(h.precision)),h.width!==null&&(f=i(String(f),h.width,h.flag)),u+=f;else if(h.conversion==="o")u+=(Number.parseInt(String(f),10)>>>0).toString(8);else if(h.conversion==="s")h.width!==null&&(f=i(String(f),h.width,h.flag)),u+=f;else if(h.conversion==="S")h.width!==null&&(f=i(String(f),h.width,h.flag)),u+=String(f).toUpperCase();else if(h.conversion==="u")u+=Number.parseInt(String(f),10)>>>0;else if(h.conversion==="x")f=(Number.parseInt(String(f),10)>>>0).toString(16),h.width!==null&&(f=i(String(f),h.width,h.flag)),u+=f;else throw new Error("Unknown format specifier.")}return u}};zo.createPrintf=ox,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.printf=e.createPrintf=void 0;const t=zo;Object.defineProperty(e,"createPrintf",{enumerable:!0,get:function(){return t.createPrintf}}),e.printf=t.createPrintf()}(tm);const nm=new G,lx={name:"QtiPrintedVariable",props:{id:{type:String,required:!1},language:{type:String,required:!1},label:{type:String,required:!1},baseuri:{type:String,required:!1},identifier:{type:String,required:!0},format:{type:String,required:!1},base:{type:String,required:!1},index:{type:String,required:!1},powerForm:{type:String,required:!1},field:{type:String,required:!1},delimiter:{type:String,required:!1},mappingIndicator:{type:String,required:!1}},data(){return{value:this.identifier,declaration:null,isQtiValid:!0}},methods:{printedValue(e){return typeof this.format>"u"?e:tm.printf(this.format,e)},evaluate(){try{this.declaration=nm.validatePrintedVariableIdentifierAttribute(_,this.identifier),this.value=this.printedValue(this.declaration.value),console.log("[QtiPrintedVariable]["+this.identifier+"][Value]",this.value)}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiEvaluationException"?new O(e.message):new Error(e.message)}}},created(){try{nm.validatePrintedVariableIdentifierAttribute(_,this.identifier)}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{_.definePrintedVariable({node:this}),this.evaluate()}catch(e){throw this.isQtiValid=!1,new c(e.message)}}};function cx(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",{ref:"root",class:"qti-printed-variable"},l.toDisplayString(n.value),513)}const ux=B(lx,[["render",cx]]);class hx{constructor(){this.constants={LABELS_UPPER_ALPHA:["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],LABELS_LOWER_ALPHA:["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],LABELS_DECIMAL:["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26"],LABELS_CJK_IDEOGRAPHIC:["一","二","三","四","五","六","七","八","九","十"],LABELS_SUFFIX_PERIOD:".",LABELS_SUFFIX_PARENTHESIS:")",LABELS_SUFFIX_NONE:"",LABELS_SUFFIX_CJK_IDEOGRAPHIC_COMMA:"、",QTI_LABELS_NONE:"qti-labels-none",QTI_LABELS_DECIMAL:"qti-labels-decimal",QTI_LABELS_LOWER_ALPHA:"qti-labels-lower-alpha",QTI_LABELS_UPPER_ALPHA:"qti-labels-upper-alpha",QTI_LABELS_CJK_IDEOGRAPHIC:"qti-labels-cjk-ideographic",QTI_LABELS_SUFFIX_NONE:"qti-labels-suffix-none",QTI_LABELS_SUFFIX_PERIOD:"qti-labels-suffix-period",QTI_LABELS_SUFFIX_PARENTHESIS:"qti-labels-suffix-parenthesis",QTI_LABELS_SUFFIX_CJK_IDEOGRAPHIC_COMMA:"qti-labels-cjk-ideographic-comma",QTI_ORIENTATION_VERTICAL:"qti-orientation-vertical",QTI_ORIENTATION_HORIZONTAL:"qti-orientation-horizontal",QTI_INPUT_CONTROL_HIDDEN:"qti-input-control-hidden",SBAC_PRESENTATION:"sbac",LRN_PRESENTATION:"lrn",QTI_CHOICES_STACKING_1:"qti-choices-stacking-1",QTI_CHOICES_STACKING_2:"qti-choices-stacking-2",QTI_CHOICES_STACKING_3:"qti-choices-stacking-3",QTI_CHOICES_STACKING_4:"qti-choices-stacking-4",QTI_CHOICES_STACKING_5:"qti-choices-stacking-5",DATA_MAX_SELECTIONS_MESSAGE:"data-max-selections-message",DATA_MIN_SELECTIONS_MESSAGE:"data-min-selections-message"},this.parentClassList=null,this.choiceGroupNode=null,this.choices=null,this.presentation_HideLabels=!1,this.presentation_Labels=this.constants.LABELS_UPPER_ALPHA,this.presentation_LabelsSuffix=this.constants.LABELS_SUFFIX_PERIOD,this.presentation_Sbac=!1,this.presentation_Lrn=!1,this.presentation_IsInputControlHidden=!1,this.presentation_IsOrientationVertical=!1,this.presentation_IsOrientationHorizontal=!1,this.presentation_MaxSelectionsMessage="",this.presentation_MinSelectionsMessage="",this.presentation_Label_Style="",this.presentation_Stacking_Class=""}initialize(t){this.choiceGroupNode=t,this.parentClassList=t.choiceInteractionClassAttribute,this.choices=t.choices,this.processRootClassAttribute(this.parentClassList),this.processStackingClass(),this.processLabelsAndInputControls()}processRootClassAttribute(t){const i=t.values();for(let s of i)switch(s){case this.constants.QTI_ORIENTATION_VERTICAL:this.presentation_IsOrientationVertical=!0,this.presentation_IsOrientationHorizontal=!1;break;case this.constants.QTI_ORIENTATION_HORIZONTAL:this.presentation_IsOrientationVertical=!1,this.presentation_IsOrientationHorizontal=!0;break;case this.constants.QTI_CHOICES_STACKING_1:this.presentation_Stacking_Class=this.constants.QTI_CHOICES_STACKING_1;break;case this.constants.QTI_CHOICES_STACKING_2:this.presentation_Stacking_Class=this.constants.QTI_CHOICES_STACKING_2;break;case this.constants.QTI_CHOICES_STACKING_3:this.presentation_Stacking_Class=this.constants.QTI_CHOICES_STACKING_3;break;case this.constants.QTI_CHOICES_STACKING_4:this.presentation_Stacking_Class=this.constants.QTI_CHOICES_STACKING_4;break;case this.constants.QTI_CHOICES_STACKING_5:this.presentation_Stacking_Class=this.constants.QTI_CHOICES_STACKING_5;break;case this.constants.QTI_LABELS_NONE:this.presentation_HideLabels=!0;break;case this.constants.QTI_LABELS_UPPER_ALPHA:this.presentation_Labels=this.constants.LABELS_UPPER_ALPHA;break;case this.constants.QTI_LABELS_LOWER_ALPHA:this.presentation_Labels=this.constants.LABELS_LOWER_ALPHA;break;case this.constants.QTI_LABELS_DECIMAL:this.presentation_Labels=this.constants.LABELS_DECIMAL;break;case this.constants.QTI_LABELS_CJK_IDEOGRAPHIC:this.presentation_Labels=this.constants.LABELS_CJK_IDEOGRAPHIC;break;case this.constants.QTI_LABELS_SUFFIX_NONE:this.presentation_LabelsSuffix=this.constants.LABELS_SUFFIX_NONE;break;case this.constants.QTI_LABELS_SUFFIX_PERIOD:this.presentation_LabelsSuffix=this.constants.LABELS_SUFFIX_PERIOD;break;case this.constants.QTI_LABELS_SUFFIX_PARENTHESIS:this.presentation_LabelsSuffix=this.constants.LABELS_SUFFIX_PARENTHESIS;break;case this.constants.QTI_LABELS_SUFFIX_CJK_IDEOGRAPHIC_COMMA:this.presentation_LabelsSuffix=this.constants.QTI_LABELS_SUFFIX_CJK_IDEOGRAPHIC_COMMA;break;case this.constants.QTI_INPUT_CONTROL_HIDDEN:this.presentation_IsInputControlHidden=!0;break;case this.constants.SBAC_PRESENTATION:this.presentation_Sbac=!0;break;case this.constants.LRN_PRESENTATION:this.presentation_Lrn=!0;break}}processStackingClass(){if(this.presentation_Stacking_Class!==""&&!this.presentation_IsOrientationVertical&&!this.presentation_IsOrientationHorizontal)this.choices.length>1?this.presentation_IsOrientationHorizontal=!0:this.presentation_IsOrientationVertical=!0;else if(this.presentation_Stacking_Class===""&&this.presentation_IsOrientationHorizontal){const t=this.choices.length;t>=5?this.presentation_Stacking_Class=this.constants.QTI_CHOICES_STACKING_5:t==4?this.presentation_Stacking_Class=this.constants.QTI_CHOICES_STACKING_4:t==3?this.presentation_Stacking_Class=this.constants.QTI_CHOICES_STACKING_3:t==2&&(this.presentation_Stacking_Class=this.constants.QTI_CHOICES_STACKING_2),t==1&&(this.presentation_IsOrientationVertical=!0,this.presentation_IsOrientationHorizontal=!1)}!this.presentation_IsOrientationVertical&&!this.presentation_IsOrientationHorizontal&&(this.presentation_IsOrientationVertical=!0),this.choiceGroupNode.$refs.choicegroup.classList.add(this.presentation_IsOrientationVertical?this.constants.QTI_ORIENTATION_VERTICAL:this.constants.QTI_ORIENTATION_HORIZONTAL),this.presentation_Stacking_Class!==""&&this.choiceGroupNode.$refs.choicegroup.classList.add(this.presentation_Stacking_Class)}processLabelsAndInputControls(){for(let t=0;t<this.choices.length;t++)this.presentation_HideLabels?this.choices[t].hideLabel():this.presentation_Sbac?this.choices[t].setLabelSbac(this.presentation_Labels[t]):this.choices[t].setLabel(this.presentation_Labels[t]+this.presentation_LabelsSuffix),this.presentation_Lrn&&this.choices[t].setChoiceLrn(),this.presentation_IsInputControlHidden&&this.choices[t].hideControl()}}const dx=new G,fx=new ie,px={props:{responseIdentifier:{required:!0,type:String},cardinality:{required:!0,type:String},shuffle:{required:!1,type:String,default:"false"},maxChoices:{required:!1,type:String,default:"1"}},data(){return{choices:[],firstChoice:null,lastChoice:null,role:null,isRadio:null,isShuffle:null,hasPrompt:!1,choiceInteractionClassAttribute:null,presentationFactory:null,isQtiValid:!0,priorState:null}},methods:{getPriorState(){return this.priorState},setPriorState(e){this.priorState=e},validateChildren(){let e=!1;this.$slots.default&&this.$slots.default()[0].children.forEach(t=>{if(dx.isValidSlot(t)){if(t.type.name==="QtiPrompt"){if(e)throw new c("Invalid element order. qti-prompt must come before qti-simple-choices");if(!this.hasPrompt)return this.hasPrompt=!0;throw new c("Maximum of 1 qti-prompt element permitted")}if(t.type.name==="QtiSimpleChoice")return e=!0;if(t.type.name!=="QtiSimpleChoice")throw new c('Node is not a qti-simple-choice: "'+t.type.name+'"')}})},processChildren(){this.$.subTree.children[0].children[0].children.forEach(t=>{t.component!==null&&t.type.name==="QtiSimpleChoice"&&this.choices.push(t.component.proxy)},this)},processGroupUI(){this.isShuffle&&this.processShuffle(),this.presentationFactory.initialize(this),this.setActiveDescendant(""),this.isRadio&&this.processFirstAndLastChoices()},resetGroupUI(){this.setPriorState(null),this.processGroupUI(),this.$emit("choiceGroupReady",{choices:this.choices,firstChoice:this.firstChoice,lastChoice:this.lastChoice})},processShuffle(){let e=this.createShuffleContainer(this.choices,this.getPriorState()),t=null;if(this.hasPrompt){const i=this.$refs.choicegroup.querySelector(".qti-prompt");i!==null&&(t=i.cloneNode(!0))}this.choices.splice(0,this.choices.length),this.$refs.choicegroup.innerHTML="",t!==null&&this.$refs.choicegroup.appendChild(t),e.forEach(i=>{this.$refs.choicegroup.appendChild(i.node.$el),this.choices.push(i.node)},this)},createShuffleContainer(e,t){let i=[];return t===null?(e.forEach(s=>{i.push({fixed:s.fixed==="true",node:s})}),fx.shuffleArrayFixed(i),i):(t.state.order.forEach(s=>{i.push({node:this.findChoiceByIdentifier(s,e)})},this),i)},findChoiceByIdentifier(e,t){for(let i=0;i<t.length;i++)if(t[i].$el.getAttribute("data-identifier")===e)return t[i];throw new O('Choice Interaction State Invalid. Choice identifier "'+e+'" not found.')},processFirstAndLastChoices(){this.choices.length!==0&&(this.firstChoice=this.choices[0],this.lastChoice=this.choices[this.choices.length-1])},setActiveDescendant(e){this.$refs.choicegroup.setAttribute("aria-activedescendant",e)},initializeChoiceGroup(){switch(this.cardinality){case"single":this.role="radiogroup",this.isRadio=!0;break;case"multiple":this.role="group",this.isRadio=!1;break;default:this.role="radiogroup",this.isRadio=!0;break}this.isShuffle=this.shuffle==="true",this.presentationFactory=new hx}},created(){try{if(typeof this.cardinality>"u")throw new c("Undefined qti-choice-interaction cardinality");this.initializeChoiceGroup(),this.validateChildren()}catch(e){throw this.isQtiValid=!1,console.log("[QtiChoiceInteraction][ValidationError]",e.name,e.message),new c(e.message)}},mounted(){if(this.isQtiValid)try{this.choiceInteractionClassAttribute=this.$parent.$refs.root.classList,this.processChildren(),this.setPriorState(this.$parent.priorState),this.processGroupUI(),this.$emit("choiceGroupReady",{choices:this.choices,firstChoice:this.firstChoice,lastChoice:this.lastChoice})}catch(e){if(this.isQtiValid=!1,e.name==="QtiValidationException")throw console.log("[QtiChoiceInteraction][ValidationException]",e.message),new c(e.message);if(e.name==="QtiEvaluationException")throw console.log("[QtiChoiceInteraction][EvaluationException]",e.message),new O(e.message)}}},mx=["role"];function gx(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("ul",{ref:"choicegroup",role:n.role,class:"qti-choice-list"},[l.renderSlot(e.$slots,"default")],8,mx)}const rm=B(px,[["render",gx]]),am=new G,yx={name:"QtiChoiceInteraction",components:[rm],props:{responseIdentifier:{required:!0,type:String},minChoices:{required:!1,type:String,default:"0"},maxChoices:{required:!1,type:String,default:"1"},shuffle:{required:!1,type:String,default:"false"},orientation:{required:!1,type:String},dataMaxSelectionsMessage:{required:!1,type:String},dataMinSelectionsMessage:{required:!1,type:String}},data(){return{response:null,state:null,isValidResponse:!1,cardinality:"single",minSelectionsMessage:"",maxSelectionsMessage:"",responseDeclaration:null,choices:[],firstChoice:null,lastChoice:null,currentChoice:null,isRadio:!0,isShuffle:!1,hasPrompts:!1,isDisabled:!1,isQtiValid:!0,priorState:null}},methods:{getResponse(){return this.response},setResponse(e){this.response=e},getState(){return this.state},setState(e){this.state=e},getIsValid(){return this.isValidResponse},setIsValid(e){this.isValidResponse=e},disable(){this.toggleDisableChoices(!0)},enable(){this.toggleDisableChoices(!1)},toggleDisableChoices(e){this.isDisabled=e,this.choices.forEach(t=>{t.setIsDisabled(e)})},getInvalidResponseMessage(){return this.minSelectionsMessage},resetValue(){console.log("[ResetValue][identifier]",this.responseIdentifier),this.choices.forEach(e=>{e.setChecked(!1),this.isRadio&&e.setTabIndex("-1")}),this.currentChoice=null,this.priorState=null,this.$refs.choicegroup.resetGroupUI()},restoreValue(e){e!==null&&(this.isRadio?this.handleSetChecked({identifier:e,checked:"true"},!0):e.forEach(t=>{this.handleSetChecked({identifier:t,checked:"true"},!0)},this),this.updateValidity(this.computeIsValid()))},getCardinality(){let e=_.getResponseDeclaration(this.responseIdentifier);return this.cardinality=typeof e<"u"?e.cardinality!=="multiple"?"single":"multiple":"single",this.cardinality},getPrompts(e){let t=[];return e.default().forEach(i=>{typeof i.type<"u"&&i.type.name==="QtiPrompt"&&t.push(i)}),t},movePrompt(){if(!this.hasPrompts)return;const e=this.$refs.root.querySelector(".qti-prompt");e!==null&&this.$refs.prompt.appendChild(e)},handleSetChecked(e,t=!1){this.choices.forEach(i=>{this.isRadio&&(i.setChecked(!1),i.setTabIndex("-1")),i.identifier===e.identifier&&(this.currentChoice=i)}),e.checked==="true"?this.checkMaxChoicesLimit()?this.currentChoice.setChecked(!1):this.currentChoice.setChecked(!0):this.currentChoice.setChecked(!1),t||(this.setResponse(this.computeResponse()),this.currentChoice.setFocus(),this.evaluateValidity()),this.currentChoice.setTabIndex("0")},handleSetFocusPreviousChoice(e){this.isRadio&&this.removeChoiceFromTabOrder(e),this.setFocusChoice(this.findPreviousIdentifier(e))},handleSetFocusNextChoice(e){this.isRadio&&this.removeChoiceFromTabOrder(e),this.setFocusChoice(this.findNextIdentifier(e))},handleSetActiveDescendant(e){this.$refs.choicegroup.setActiveDescendant(e)},setFocusChoice(e){for(let t=0;t<this.choices.length;t++)this.choices[t].identifier===e&&(this.currentChoice=this.choices[t]);this.currentChoice.setTabIndex("0"),this.currentChoice.setFocus()},removeChoiceFromTabOrder(e){for(let t=0;t<this.choices.length;t++)if(this.choices[t].identifier===e){this.choices[t].setTabIndex(-1);break}},findPreviousIdentifier(e){if(e===this.firstChoice.identifier)return this.lastChoice.identifier;for(let t=0;t<this.choices.length;t++)if(this.choices[t].identifier===e)return this.choices[t-1].identifier;return null},findNextIdentifier(e){if(e===this.lastChoice.identifier)return this.firstChoice.identifier;for(let t=0;t<this.choices.length;t++)if(this.choices[t].identifier===e)return this.choices[t+1].identifier;return null},handleChoiceGroupReady(e){this.choices=e.choices,this.firstChoice=e.firstChoice,this.lastChoice=e.lastChoice,this.isRadio&&this.firstChoice.setTabIndex("0"),this.priorState!==null&&this.restoreValue(this.priorState.value),this.setResponse(this.computeResponse()),this.setState(this.computeState()),this.setIsValid(this.computeIsValid())},computeResponse(){let e=this.isRadio?null:[];return this.choices.forEach(t=>{t.isChecked()&&(this.isRadio?e=t.identifier:e.push(t.identifier))}),this.isRadio?e:e.length===0?null:e},computeState(){const e={};let t=[];return this.choices.forEach(i=>{t.push(i.identifier)}),e.order=t,e},computeIsValid(){return this.minChoices*1===0?!0:this.response===null?!1:this.cardinality==="single"||this.cardinality==="multiple"&&this.response.length>=this.minChoices*1},evaluateValidity(){const e=this.getIsValid(),t=this.computeIsValid();e!==t&&this.updateValidity(t)},updateValidity(e){this.setIsValid(e),_.setInteractionIsValidResponse({identifier:this.responseIdentifier,isValidResponse:e})},checkMaxChoicesLimit(){if(this.isRadio||this.maxChoices==0)return!1;const e=this.getResponse();return e!==null&&e.length==this.maxChoices?(_.NotifyInteractionSelectionsLimit(this.maxSelectionsMessage),!0):!1},computeMaxSelectionsMessage(){if(typeof this.dataMaxSelectionsMessage<"u"){this.maxSelectionsMessage=this.dataMaxSelectionsMessage;return}this.maxSelectionsMessage=this.maxChoices==0?"":"You are permitted a maximum of "+this.maxChoices+" choice"+(this.maxChoices>1?"s":"")+" for this question.<br/><br/>Please unselect one of your choices before making another choice."},computeMinSelectionsMessage(){if(typeof this.dataMinSelectionsMessage<"u"){this.minSelectionsMessage=this.dataMinSelectionsMessage;return}this.minSelectionsMessage=this.minChoices==0?"":"You must make at least "+this.minChoices+" choice"+(this.minChoices>1?"s":"")+" for this question."},getPriorState(e){const t=_.getItemContextStateVariable(e);if(t===null)return null;if(!("value"in t))throw new O('Choice Interaction State Invalid. "value" property not found.');if(!("state"in t))throw new O('Choice Interaction State Invalid. "state" property not found.');if(!("order"in t.state))throw new O('Choice Interaction State Invalid. "order" property not found.');return t},showSolution(e){if(e!==null){if(this.isRadio){this.choices.forEach(t=>{this.setChoiceSolution(t,e)},this);return}this.choices.forEach(t=>{const i=this.findIdentifierInCorrectResponse(t.identifier,e);this.setChoiceSolution(t,i)},this)}},setChoiceSolution(e,t){e.isChecked()?e.identifier===t?e.setCorrectSolution():e.setIncorrectSolution():e.identifier===t?e.setExpectedSolution():e.setIgnoreSolution()},findIdentifierInCorrectResponse(e,t){for(let i=0;i<t.length;i++)if(e===t[i])return e;return null}},created(){try{this.responseDeclaration=am.validateResponseIdentifierAttribute(_,this.responseIdentifier),this.priorState=this.getPriorState(this.responseIdentifier),am.validateMaxMinChoices(this.maxChoices,this.minChoices),this.cardinality=this.getCardinality(),this.isRadio=this.cardinality!=="multiple",this.isShuffle=this.shuffle==="true",this.hasPrompts=this.getPrompts(this.$slots).length>0,this.computeMinSelectionsMessage(),this.computeMaxSelectionsMessage()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.movePrompt(),_.defineInteraction({identifier:this.responseIdentifier,interactionType:"Choice",node:this,resetValue:this.resetValue,isValidResponse:this.getIsValid(),invalidResponseMessage:this.getInvalidResponseMessage(),maxSelectionsMessage:this.maxSelectionsMessage}),console.log("["+this.$options.name+"][Identifier]",this.responseIdentifier)}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}}},wx={ref:"root",class:"qti-choice-interaction"},bx={ref:"prompt",class:"qti-prompt-wrapper"};function vx(e,t,i,s,n,r){const a=l.resolveComponent("ChoiceGroup");return l.openBlock(),l.createElementBlock("div",wx,[l.createElementVNode("div",bx,null,512),l.createVNode(a,l.mergeProps({ref:"choicegroup",cardinality:n.cardinality,shuffle:i.shuffle,responseIdentifier:i.responseIdentifier,maxChoices:i.maxChoices,minChoices:i.minChoices,onChoiceGroupReady:r.handleChoiceGroupReady,onSetChecked:r.handleSetChecked,onSetFocusNextChoice:r.handleSetFocusNextChoice,onSetFocusPreviousChoice:r.handleSetFocusPreviousChoice,onSetActiveDescendant:r.handleSetActiveDescendant},e.$attrs),{default:l.withCtx(()=>[l.renderSlot(e.$slots,"default")]),_:3},16,["cardinality","shuffle","responseIdentifier","maxChoices","minChoices","onChoiceGroupReady","onSetChecked","onSetFocusNextChoice","onSetFocusPreviousChoice","onSetActiveDescendant"])],512)}const Ex=B(yx,[["render",vx]]);class Tx{constructor(t){return this.constants={QTI_ORIENTATION_HORIZONTAL:"qti-orientation-horizontal",QTI_ORIENTATION_VERTICAL:"qti-orientation-vertical",QTI_WRITING_ORIENTATION_VERTICAL_RL:"qti-writing-orientation-vertical-rl"},this.classList=t,this.presentation_OrientationClass=this.constants.QTI_ORIENTATION_HORIZONTAL,this.processClassAttribute(),this}processClassAttribute(){if(typeof this.classList>"u"||this.classList===null||this.classList.length==0)return;const t=this.classList.split(" ");for(let i=0;i<t.length;i++)switch(t[i]){case this.constants.QTI_ORIENTATION_VERTICAL:case this.constants.QTI_WRITING_ORIENTATION_VERTICAL_RL:this.presentation_OrientationClass=this.constants.QTI_ORIENTATION_VERTICAL;break;case this.constants.QTI_ORIENTATION_HORIZONTAL:this.presentation_OrientationClass=this.constants.QTI_ORIENTATION_HORIZONTAL;break}}getOrientationClass(){return this.presentation_OrientationClass}isOrientationVertical(){return this.presentation_OrientationClass==this.constants.QTI_ORIENTATION_VERTICAL}setVerticalOrientation(t){this.isOrientationVertical()&&t.classList.add(this.constants.QTI_ORIENTATION_VERTICAL)}}const lu=new G,Cx=new ie,Sx={name:"QtiInlineChoiceInteraction",props:{responseIdentifier:{required:!0,type:String},shuffle:{required:!1,type:String,default:"false"},required:{required:!1,type:String,default:"false"},dataPrompt:{required:!1,type:String,default:"Choose..."},minChoices:{required:!1,type:String,default:"0"},maxChoices:{required:!1,type:String,default:"1"},dataMinSelectionsMessage:{required:!1,type:String}},computed:{labelId(){return"inlinechoice_label_"+this.responseIdentifier},buttonId(){return"inlinechoice_button_"+this.responseIdentifier},buttonAriaLabelledbyId(){return"inlinechoice_label_"+this.responseIdentifier+" inlinechoice_button_"+this.responseIdentifier},listboxId(){return"inlinechoice_listbox_"+this.responseIdentifier},listboxAriaLabelledbyId(){return"inlinechoice_label_"+this.responseIdentifier}},data(){return{response:null,state:null,isValidResponse:!1,cardinality:"single",minSelectionsMessage:"",choices:[],allOptionElements:null,activeDescendant:null,keysSoFar:"",searchIndex:null,isShuffle:null,isRequired:!1,isDisabled:!1,isQtiValid:!0,presentationFactory:null,isOrientationVertical:!1,priorState:null}},methods:{getResponse(){return this.response},setResponse(e){this.response=e},getState(){return this.state},setState(e){this.state=e},getIsValid(){return this.isValidResponse},setIsValid(e){this.isValidResponse=e},getInvalidResponseMessage(){return this.minSelectionsMessage},disable(){this.toggleDisable(!0)},enable(){this.toggleDisable(!1)},toggleDisable(e){this.isDisabled=e,e?(this.getResponse()===null&&(this.$refs.label.innerHTML=""),this.$refs.label.classList.remove("qti-hidden"),this.$refs.label.setAttribute("tabIndex",0),this.$refs.button.classList.add("qti-hidden"),this.$refs.listbox.classList.add("inline-choice-select-listbox-hidden")):(this.$refs.label.classList.add("qti-hidden"),this.$refs.label.setAttribute("tabIndex",-1),this.$refs.button.classList.remove("qti-hidden"))},resetValue(){console.log("[ResetValue][identifier]",this.responseIdentifier),this.$refs.listbox.querySelectorAll('[role="option"]').forEach(t=>{this.defocusOption(t)},this),this.processGroupUI()},restoreValue(e){if(e===null)return;const t=this.findChoiceByIdentifier(e,this.choices);this.focusOption(t.$el,!0),this.setResponse(this.computeResponse(e)),this.updateValidity(this.computeIsValid())},getCardinality(){let e=_.getResponseDeclaration(this.responseIdentifier);if(typeof e>"u"&&(this.cardinality="single"),e.cardinality!=="single")throw new c('Invalid qti-inline-choice-interaction Response Variable cardinality: "'+this.cardinality+'"');return this.cardinality="single",this.cardinality},computeResponse(e){return e===null||e.length===0?null:e},computeState(){const e={};let t=[];return this.choices.forEach(i=>{t.push(i.identifier)}),e.order=t,e},computeIsValid(){return!this.isRequired&&this.minChoices*1===0?!0:this.response!==null},evaluateValidity(){const e=this.getIsValid(),t=this.computeIsValid();e!==t&&this.updateValidity(t)},updateValidity(e){this.setIsValid(e),_.setInteractionIsValidResponse({identifier:this.responseIdentifier,isValidResponse:e})},computeMinSelectionsMessage(){if(typeof this.dataMinSelectionsMessage<"u"){this.minSelectionsMessage=this.dataMinSelectionsMessage;return}!this.isRequired&&this.minChoices*1===0||(this.minSelectionsMessage="You must make at least 1 choice for this question.")},handleButtonClick(){this.isDisabled||this.showListbox()},handleButtonKeyup(e){switch(e.code){case"ArrowUp":case"ArrowDown":if(e.preventDefault(),this.isDisabled)return;this.showListbox();break}},handleChoiceMousedown(e){e.preventDefault();let t=e.target;t.getAttribute("role")==="option"&&(this.focusOption(t),this.hideListbox(),this.$refs.button.focus())},handleBlur(){this.hideListbox()},handleFocusChange(e){this.$refs.prompt.innerHTML=e.innerHTML,this.$refs.label.innerHTML=e.innerHTML},showListbox(){this.$refs.listbox.classList.remove("inline-choice-select-listbox-hidden"),this.$refs.button.setAttribute("aria-expanded","true"),this.$refs.listbox.focus()},hideListbox(){this.$refs.listbox.classList.add("inline-choice-select-listbox-hidden"),this.$refs.button.removeAttribute("aria-expanded")},setupFocus(){this.activeDescendant||this.focusFirstOption()},focusFirstOption(){let e=this.$refs.listbox.querySelector('[role="option"]');e&&this.focusOption(e)},focusLastOption(){let e=this.$refs.listbox.querySelectorAll('[role="option"]');e.length&&this.focusOption(e[e.length-1])},focusOption(e,t=!1){if(t||this.defocusOption(document.getElementById(this.activeDescendant)),e.setAttribute("aria-selected","true"),e.classList.add("focused"),this.setActiveDescendant(e.id),!t&&(this.setResponse(this.computeResponse(e.getAttribute("data-identifier"))),this.evaluateValidity(),this.$refs.listbox.scrollHeight>this.$refs.listbox.clientHeight)){const i=this.$refs.listbox.clientHeight+this.$refs.listbox.scrollTop,s=e.offsetTop+e.offsetHeight;s>i?this.$refs.listbox.scrollTop=s-this.$refs.listbox.clientHeight:e.offsetTop<this.$refs.listbox.scrollTop&&(this.$refs.listbox.scrollTop=e.offsetTop)}this.handleFocusChange(e)},defocusOption(e){e&&(e.removeAttribute("aria-selected"),e.classList.remove("focused"))},checkKeyPress(e){if(e.code=="Enter"||e.code=="Escape"){e.preventDefault(),this.hideListbox(),this.$refs.button.focus();return}let t=document.getElementById(this.activeDescendant);if(t)switch(e.code){case"ArrowUp":case"ArrowDown":e.preventDefault(),e.code=="ArrowUp"?t=t.previousElementSibling:t=t.nextElementSibling,t&&this.focusOption(t);break;case"Home":e.preventDefault(),this.focusFirstOption();break;case"End":e.preventDefault(),this.focusLastOption();break}},findOptionToFocus(e){let t=this.$refs.listbox.querySelectorAll('[role="option"]');if(!this.keysSoFar)for(let s=0;s<t.length;s++)t[s].getAttribute("id")==this.activeDescendant&&(this.searchIndex=s);this.keysSoFar+=e,this.clearKeysSoFarAfterDelay();let i=this.findMatchInRange(t,this.searchIndex+1,t.length);return i||(i=this.findMatchInRange(t,0,this.searchIndex)),i},clearKeysSoFarAfterDelay(){this.keyClear&&(clearTimeout(this.keyClear),this.keyClear=null);let e=this;this.keyClear=setTimeout((function(){e.keysSoFar="",e.keyClear=null}).bind(this),500)},findMatchInRange(e,t,i){for(let s=t;s<i;s++){let n=e[s].innerText;if(n&&n.toUpperCase().indexOf(this.keysSoFar)===0)return e[s]}return null},validateChildren(){this.$slots.default&&this.$slots.default().forEach(e=>{if(lu.isValidSlot(e)){if(e.type.name==="QtiInlineChoice")return;throw new c('Node is not a qti-inline-choice: "'+e.type.name+'"')}})},processChildren(){const e=this.$.subTree.children[0].children[2].children[0];this.choices.push(e.component.proxy),this.$.subTree.children[0].children[2].children[1].children.forEach(i=>{i.component!==null&&this.choices.push(i.component.proxy)})},processGroupUI(){this.isOrientationVertical&&this.presentationFactory.setVerticalOrientation(this.$refs.root),this.isShuffle&&this.processShuffle(),this.setResponse(null),this.setState(this.computeState()),this.setIsValid(this.computeIsValid()),this.setActiveDescendant("")},processShuffle(){let e=this.createShuffleContainer(this.choices,this.priorState);this.choices.splice(0,this.choices.length),this.$refs.listbox.innerHTML="",e.forEach(t=>{this.$refs.listbox.appendChild(t.node.$el),this.choices.push(t.node)},this)},createShuffleContainer(e,t){let i=[];return t===null?(e.forEach(s=>{i.push({fixed:s.fixed==="true",node:s})}),Cx.shuffleArrayFixed(i),i):(t.state.order.forEach(s=>{i.push({node:this.findChoiceByIdentifier(s,e)})},this),i)},findChoiceByIdentifier(e,t){for(let i=0;i<t.length;i++)if(t[i].$el.getAttribute("data-identifier")===e)return t[i];throw new O('Inline Choice Interaction State Invalid. Inline Choice identifier "'+e+'" not found.')},setActiveDescendant(e){this.activeDescendant=e,this.$refs.listbox.setAttribute("aria-activedescendant",e)},getPriorState(e){const t=_.getItemContextStateVariable(e);if(t===null)return null;if(!("value"in t))throw new O('Choice Interaction State Invalid. "value" property not found.');if(!("state"in t))throw new O('Choice Interaction State Invalid. "state" property not found.');if(!("order"in t.state))throw new O('Choice Interaction State Invalid. "order" property not found.');return t},addChoiceMousedownListeners(){this.allOptionElements=this.$refs.listbox.querySelectorAll('[role="option"]'),this.allOptionElements.forEach(e=>{e.addEventListener("mousedown",this.handleChoiceMousedown)})},removeChoiceMousedownListeners(){this.allOptionsElements!==null&&this.allOptionElements.forEach(e=>{e.removeEventListener("mousedown",this.handleChoiceMousedown)})}},created(){try{if(this.responseDeclaration=lu.validateResponseIdentifierAttribute(_,this.responseIdentifier),this.presentationFactory=new Tx(this.$.vnode.props.class),this.isOrientationVertical=this.presentationFactory.isOrientationVertical(),this.validateChildren(),this.priorState=this.getPriorState(this.responseIdentifier),lu.validateMaxMinChoices(this.maxChoices,this.minChoices),this.minChoices>1)throw new c('Invalid qti-inline-choice-interaction min-choices attribute: "'+this.minChoices+'"');this.cardinality=this.getCardinality(),this.isShuffle=this.shuffle==="true",this.isRequired=this.required==="true",this.computeMinSelectionsMessage()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.processChildren(),this.processGroupUI(),this.priorState!==null&&this.restoreValue(this.priorState.value),this.addChoiceMousedownListeners(),_.defineInteraction({identifier:this.responseIdentifier,interactionType:"InlineChoice",node:this,resetValue:this.resetValue,isValidResponse:this.isValidResponse,invalidResponseMessage:this.getInvalidResponseMessage(),maxSelectionsMessage:null}),console.log("["+this.$options.name+"][Identifier]",this.responseIdentifier)}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}},beforeUnmount(){this.removeChoiceMousedownListeners()}},xx={ref:"root",class:"qti-inline-choice-interaction"},_x={class:"inline-choice-wrapper"},Ix=["aria-labelledby","id"],Vx=["aria-labelledby"];function Ax(e,t,i,s,n,r){const a=l.resolveComponent("qti-inline-choice");return l.openBlock(),l.createElementBlock("div",xx,[l.createElementVNode("div",_x,[l.createElementVNode("div",{ref:"label",class:"inline-choice-select-label qti-hidden"},l.toDisplayString(i.dataPrompt),513),l.createElementVNode("button",{ref:"button","aria-haspopup":"listbox","aria-labelledby":r.buttonAriaLabelledbyId,id:r.buttonId,class:"inline-choice-select",onClick:t[0]||(t[0]=(...o)=>r.handleButtonClick&&r.handleButtonClick(...o)),onKeyup:t[1]||(t[1]=(...o)=>r.handleButtonKeyup&&r.handleButtonKeyup(...o))},[l.createElementVNode("div",{ref:"prompt",class:"inline-choice-select-prompt"},l.toDisplayString(i.dataPrompt),513)],40,Ix),l.createElementVNode("ul",{ref:"listbox",tabindex:"-1",role:"listbox","aria-labelledby":r.labelId,class:"inline-choice-select-listbox inline-choice-select-listbox-hidden",onBlur:t[2]||(t[2]=(...o)=>r.handleBlur&&r.handleBlur(...o)),onFocus:t[3]||(t[3]=(...o)=>r.setupFocus&&r.setupFocus(...o)),onKeydown:t[4]||(t[4]=(...o)=>r.checkKeyPress&&r.checkKeyPress(...o))},[l.createVNode(a,{identifier:"",fixed:"true"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(i.dataPrompt),1)]),_:1}),l.renderSlot(e.$slots,"default")],40,Vx)])],512)}const $x=B(Sx,[["render",Ax]]),Lx={name:"EndAttemptGeneric",props:{title:{required:!0,type:String}},data(){return{step:1,isBtnDisabled:!1}},methods:{getIsBtnDisabled(){return this.isBtnDisabled},setIsBtnDisabled(e){this.isBtnDisabled=e},handleEndAttempt(){this.$parent.$emit("endAttempt",{response:!0})},enable(){this.toggleButtonDisabled(!1)},disable(){this.toggleButtonDisabled(!0)},toggleButtonDisabled(e){e?this.$refs.root.setAttribute("disabled",""):this.$refs.root.removeAttribute("disabled"),this.setIsBtnDisabled(e)}},created(){},mounted(){this.$parent.$emit("endAttemptReady",{node:this})}};function Mx(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("button",{ref:"root",class:"qti-end-attempt-interaction",onClick:t[0]||(t[0]=l.withModifiers((...a)=>r.handleEndAttempt&&r.handleEndAttempt(...a),["prevent"])),type:"button"},l.toDisplayString(i.title),513)}const Nx=B(Lx,[["render",Mx]]),Rx={name:"EndAttemptControllerBar",props:{responseIdentifier:{required:!0,type:String},title:{required:!0,type:String},dataSteps:{required:!1,type:String},dataHastemplates:{required:!1,type:String},dataControllerType:{required:!1,type:String},dataHideprogress:{required:!1,type:String}},data(){return{step:1,isBtnDisabled:!1,response:!1}},computed:{progressMaximumSteps(){return typeof this.dataSteps>"u"?1:this.dataSteps*1},progressActiveWidth(){let e=this.progressMaximumSteps;return e=this.step>e?this.step:e,Math.floor(100*(this.step/e))},progressMessage(){return this.step===this.progressMaximumSteps?"All Parts Showing":"Step "+this.step+" of "+this.progressMaximumSteps},hasTemplates(){return typeof this.dataHastemplates<"u"?this.dataHastemplates==="true":!1},controllerType(){return typeof this.dataControllerType<"u"?this.dataControllerType:"generic"},progressClass(){return{"endattempt-progress-panel":!0,"progress-hidden":typeof this.dataHideprogress<"u"?this.dataHideprogress==="true":!1}}},methods:{getStep(){return this.step},setStep(e){this.step=e<this.progressMaximumSteps?e:this.progressMaximumSteps},incrementStep(){this.setStep(this.getStep()+1)},getIsBtnDisabled(){return this.isBtnDisabled},setIsBtnDisabled(e){this.isBtnDisabled=e},handleControllerNewTemplate(){this.resetControllerState(),_.NotifyNewTemplate({identifier:this.responseIdentifier,step:this.getStep(),maximumSteps:this.progressMaximumSteps})},handleControllerEndAttempt(){this.updateControllerState(),this.$parent.$emit("endAttempt",{response:this.response})},enable(){this.toggleButtonDisabled(!1)},disable(){this.toggleButtonDisabled(!0)},toggleButtonDisabled(e){e?this.$refs.endattempt.setAttribute("disabled",""):this.$refs.endattempt.removeAttribute("disabled"),this.setIsBtnDisabled(e)},resetControllerState(){this.setStep(1),this.enable(),this.$parent.$emit("notifyUpdateState",{})},updateControllerState(){switch(this.dataControllerType){case"showexample":case"solve":this.incrementStep(),this.getStep()<this.progressMaximumSteps?(this.response=!1,this.enable()):(this.response=!0,this.disable());break;case"generic":default:this.getStep()<this.progressMaximumSteps?(this.response=!1,this.incrementStep(),this.enable()):(this.response=!0,this.disable())}}},created(){},mounted(){this.$parent.$emit("endAttemptReady",{node:this})}},kx={class:"endattempt-controller"},qx={class:"endattempt-controller-progress"},Ox={id:"msgNotes"},Bx={class:"progress"},Px=["aria-valuenow"],Dx={class:"endattempt-controller-buttons"};function Qx(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",kx,[l.createElementVNode("div",qx,[l.createElementVNode("div",{class:l.normalizeClass(r.progressClass)},[l.createElementVNode("div",Ox,l.toDisplayString(r.progressMessage),1),l.createElementVNode("div",Bx,[l.createElementVNode("div",{class:"progress-bar",style:l.normalizeStyle({width:r.progressActiveWidth+"%"}),role:"progressbar","aria-valuenow":r.progressActiveWidth,"aria-valuemin":"0","aria-valuemax":"progressMaximumSteps"},null,12,Px)])],2)]),t[2]||(t[2]=l.createElementVNode("div",{class:"endattempt-controller-filler"},null,-1)),l.createElementVNode("div",Dx,[r.hasTemplates?(l.openBlock(),l.createElementBlock("button",{key:0,id:"btnNewTemplate",onClick:t[0]||(t[0]=l.withModifiers((...a)=>r.handleControllerNewTemplate&&r.handleControllerNewTemplate(...a),["prevent"])),type:"button",class:"endattempt-btn endattempt-btn-secondary"},"New Question")):l.createCommentVNode("",!0),l.createElementVNode("button",{ref:"endattempt",id:"btnEndAttempt",onClick:t[1]||(t[1]=l.withModifiers((...a)=>r.handleControllerEndAttempt&&r.handleControllerEndAttempt(...a),["prevent"])),type:"button",class:"endattempt-btn endattempt-btn-primary"},l.toDisplayString(i.title),513)])])}const Hx=B(Rx,[["render",Qx]]),Zo={DEFAULT:"",ENDATTEMPT_CONTROLLER_BAR:"endattempt-controller-bar"};function Fx(e,t){switch(e){case Zo.ENDATTEMPT_CONTROLLER_BAR:return{template:'<end-attempt-controller-bar response-identifier="'+t.responseIdentifier+'" title="'+t.title+'" data-steps="'+t.dataSteps+'" data-hastemplates="'+t.dataHastemplates+'" data-controller-type="'+t.dataControllerType+'" data-hideprogress="'+t.dataHideprogress+'" />',components:{EndAttemptControllerBar:Hx}};default:return{template:'<end-attempt-default response-identifier="'+t.responseIdentifier+'" title="'+t.title+'"/>',components:{EndAttemptDefault:Nx}}}}function Ux(e){if(typeof e>"u"||e===null||e.length==0)return Zo.DEFAULT;const t=e.split(" ");for(let i=0;i<t.length;i++)switch(t[i]){case Zo.ENDATTEMPT_CONTROLLER_BAR:return t[i]}return Zo.DEFAULT}const Gx=new G,jx={name:"QtiEndAttemptInteraction",props:{responseIdentifier:{required:!0,type:String},title:{required:!0,type:String},dataSteps:{required:!1,type:String},dataHastemplates:{required:!1,type:String},dataControllerType:{required:!1,type:String},dataHideprogress:{required:!1,type:String}},data(){return{response:!1,state:null,cardinality:"single",responseDeclaration:null,interactionSubType:"",isBtnDisabled:!1,isValidResponse:!0,invalidResponseMessage:"",isQtiValid:!0,node:null,priorState:null}},computed:{interactionTemplate(){return Fx(this.interactionSubType,this.createComponentProperties())}},methods:{getResponse(){return this.response},setResponse(e){this.response=e},getState(){return this.state},setState(e){this.state=e},updateState(){this.setState(this.computeState())},getIsValid(){return this.isValidResponse},setIsValid(e){this.isValidResponse=e},getInvalidResponseMessage(){return this.invalidResponseMessage},getCardinality(){return this.cardinality},getStep(){return this.interactionSubType==="endattempt-controller-bar"?this.node.getStep():1},setStep(e){this.interactionSubType==="endattempt-controller-bar"&&this.node.setStep(e)},initializeValue(){this.enableButton(),this.setStep(1),this.updateState(),this.setResponse(!1),this.setIsValid(!0)},resetValue(){console.log("[ResetValue][identifier]",this.responseIdentifier),this.initializeValue()},restoreValue(e){e.state.isBtnDisabled?this.disableButton():this.enableButton(),this.setStep(e.state.step),this.setState(this.computeState()),this.setResponse(this.computeResponse(e.value)),this.setIsValid(!0)},computeResponse(e){return e===null?!1:e},computeState(){return{step:this.getStep(),isBtnDisabled:this.getIsBtnDisabled(),interactionSubType:this.getInteractionSubType()}},disable(){this.disableButton(),this.updateState()},enable(){this.enableButton(),this.setResponse(!1),this.updateState()},getIsBtnDisabled(){return this.node.getIsBtnDisabled()},setIsBtnDisabled(e){this.node.setIsBtnDisabled(e)},setInteractionSubType(e){this.interactionSubType=e},getInteractionSubType(){return this.interactionSubType},handleEndAttempt(e){this.setResponse(e.response),this.updateState(),this.notifyEndAttempt()},handleUpdateState(){this.updateState()},enableButton(){this.node.enable()},disableButton(){this.node.disable()},detectInteractionSubType(e){return Ux(e)},createComponentProperties(){const e={responseIdentifier:this.responseIdentifier,title:this.title};return e.dataSteps=typeof this.dataSteps<"u"?this.dataSteps:"1",e.dataHastemplates=typeof this.dataHastemplates<"u"?this.dataHastemplates==="true":!1,e.dataHideprogress=typeof this.dataHideprogress<"u"?this.dataHideprogress==="true":!1,e.dataControllerType=typeof this.dataControllerType<"u"?this.dataControllerType:"generic",e},handleEndAttemptReady(e){this.node=e.node},notifyEndAttempt(){_.NotifyEndAttempt({identifier:this.responseIdentifier,step:this.getStep(),maximumSteps:typeof this.dataSteps<"u"?this.dataSteps*1:1,interactionSubType:this.getInteractionSubType()})},getPriorState(e){const t=_.getItemContextStateVariable(e);if(t===null)return null;if(!("value"in t))throw new O('End Attempt Interaction State Invalid. "value" property not found.');if(!("state"in t))throw new O('End Attempt Interaction State Invalid. "state" property not found.');if(!("step"in t.state))throw new O('End Attempt Interaction State Invalid. "step" property not found.');if(!("isBtnDisabled"in t.state))throw new O('End Attempt Interaction State Invalid. "isBtnDisabled" property not found.');return t}},created(){try{this.responseDeclaration=Gx.validateResponseIdentifierAttribute(_,this.responseIdentifier),this.setInteractionSubType(this.detectInteractionSubType(this.$attrs.class)),this.priorState=this.getPriorState(this.responseIdentifier)}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.priorState===null?this.initializeValue():this.restoreValue(this.priorState),_.defineInteraction({identifier:this.responseIdentifier,interactionType:"EndAttemptInteraction",interactionSubType:this.interactionSubType,node:this,resetValue:this.resetValue,disable:this.disable,enable:this.enable,isValidResponse:this.isValidResponse,invalidResponseMessage:this.getInvalidResponseMessage()}),console.log("["+this.$options.name+":"+this.interactionSubType+"][Identifier]",this.responseIdentifier)}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}}},Wx={ref:"root"};function zx(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",Wx,[(l.openBlock(),l.createBlock(l.resolveDynamicComponent(r.interactionTemplate),l.mergeProps({ref:"endattempt",onEndAttempt:r.handleEndAttempt,onUpdateState:r.handleUpdateState,onEndAttemptReady:r.handleEndAttemptReady},e.$attrs),null,16,["onEndAttempt","onUpdateState","onEndAttemptReady"]))],512)}const Kx=B(jx,[["render",zx]]);class Yx{constructor(t,i){return this.constants={QTI_COUNTER_NONE:"none",QTI_COUNTER_UP:"qti-counter-up",QTI_COUNTER_DOWN:"qti-counter-down",QTI_HEIGHT_LINES_3:"qti-height-lines-3",QTI_HEIGHT_LINES_6:"qti-height-lines-6",QTI_HEIGHT_LINES_15:"qti-height-lines-15",SBAC_HEIGHT_LINES_95:"sbac-height-lines-95",SBAC_PRESENTATION:"sbac"},this.classList=t,this.expectedLength=i,this.presentation_HeightClass=this.constants.QTI_HEIGHT_LINES_3,this.presentation_CounterStyle=this.constants.QTI_COUNTER_NONE,this.presentation_Sbac=!1,this.processClassAttribute(),this}processClassAttribute(){if(typeof this.classList>"u"||this.classList===null||this.classList.length==0)return;const t=this.classList.split(" ");for(let i=0;i<t.length;i++)switch(t[i]){case this.constants.SBAC_PRESENTATION:this.presentation_Sbac=!0;break;case this.constants.SBAC_HEIGHT_LINES_95:this.presentation_HeightClass=this.constants.SBAC_HEIGHT_LINES_95;break;case this.constants.QTI_COUNTER_UP:this.presentation_CounterStyle="up",this.expectedLength=this.processExpectedLength();break;case this.constants.QTI_COUNTER_DOWN:this.presentation_CounterStyle="down",this.expectedLength=this.processExpectedLength();break;case this.constants.QTI_HEIGHT_LINES_3:this.presentation_HeightClass=this.constants.QTI_HEIGHT_LINES_3;break;case this.constants.QTI_HEIGHT_LINES_6:this.presentation_HeightClass=this.constants.QTI_HEIGHT_LINES_6;break;case this.constants.QTI_HEIGHT_LINES_15:this.presentation_HeightClass=this.constants.QTI_HEIGHT_LINES_15;break}}processExpectedLength(){return typeof this.expectedLength>"u"||this.expectedLength===null||this.expectedLength.length==0||this.expectedLength==="0"?400:this.expectedLength*1}getCounterStyle(){return this.presentation_CounterStyle}getHeightClass(){return this.presentation_HeightClass}getExpectedLength(){return this.expectedLength}getIsSbac(){return this.presentation_Sbac}}var At="top",Jt="bottom",ei="right",$t="left",cu="auto",jr=[At,Jt,ei,$t],qn="start",Wr="end",Xx="clippingParents",om="viewport",zr="popper",Zx="reference",lm=jr.reduce(function(e,t){return e.concat([t+"-"+qn,t+"-"+Wr])},[]),cm=[].concat(jr,[cu]).reduce(function(e,t){return e.concat([t,t+"-"+qn,t+"-"+Wr])},[]),Jx="beforeRead",e_="read",t_="afterRead",i_="beforeMain",s_="main",n_="afterMain",r_="beforeWrite",a_="write",o_="afterWrite",l_=[Jx,e_,t_,i_,s_,n_,r_,a_,o_];function Ri(e){return e?(e.nodeName||"").toLowerCase():null}function Ht(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function Zs(e){var t=Ht(e).Element;return e instanceof t||e instanceof Element}function ti(e){var t=Ht(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function uu(e){if(typeof ShadowRoot>"u")return!1;var t=Ht(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function c_(e){var t=e.state;Object.keys(t.elements).forEach(function(i){var s=t.styles[i]||{},n=t.attributes[i]||{},r=t.elements[i];!ti(r)||!Ri(r)||(Object.assign(r.style,s),Object.keys(n).forEach(function(a){var o=n[a];o===!1?r.removeAttribute(a):r.setAttribute(a,o===!0?"":o)}))})}function u_(e){var t=e.state,i={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,i.popper),t.styles=i,t.elements.arrow&&Object.assign(t.elements.arrow.style,i.arrow),function(){Object.keys(t.elements).forEach(function(s){var n=t.elements[s],r=t.attributes[s]||{},a=Object.keys(t.styles.hasOwnProperty(s)?t.styles[s]:i[s]),o=a.reduce(function(u,h){return u[h]="",u},{});!ti(n)||!Ri(n)||(Object.assign(n.style,o),Object.keys(r).forEach(function(u){n.removeAttribute(u)}))})}}const um={name:"applyStyles",enabled:!0,phase:"write",fn:c_,effect:u_,requires:["computeStyles"]};function ki(e){return e.split("-")[0]}var Js=Math.max,Jo=Math.min,On=Math.round;function hu(){var e=navigator.userAgentData;return e!=null&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function hm(){return!/^((?!chrome|android).)*safari/i.test(hu())}function Bn(e,t,i){t===void 0&&(t=!1),i===void 0&&(i=!1);var s=e.getBoundingClientRect(),n=1,r=1;t&&ti(e)&&(n=e.offsetWidth>0&&On(s.width)/e.offsetWidth||1,r=e.offsetHeight>0&&On(s.height)/e.offsetHeight||1);var a=Zs(e)?Ht(e):window,o=a.visualViewport,u=!hm()&&i,h=(s.left+(u&&o?o.offsetLeft:0))/n,f=(s.top+(u&&o?o.offsetTop:0))/r,m=s.width/n,w=s.height/r;return{width:m,height:w,top:f,right:h+m,bottom:f+w,left:h,x:h,y:f}}function du(e){var t=Bn(e),i=e.offsetWidth,s=e.offsetHeight;return Math.abs(t.width-i)<=1&&(i=t.width),Math.abs(t.height-s)<=1&&(s=t.height),{x:e.offsetLeft,y:e.offsetTop,width:i,height:s}}function dm(e,t){var i=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(i&&uu(i)){var s=t;do{if(s&&e.isSameNode(s))return!0;s=s.parentNode||s.host}while(s)}return!1}function ts(e){return Ht(e).getComputedStyle(e)}function h_(e){return["table","td","th"].indexOf(Ri(e))>=0}function Cs(e){return((Zs(e)?e.ownerDocument:e.document)||window.document).documentElement}function el(e){return Ri(e)==="html"?e:e.assignedSlot||e.parentNode||(uu(e)?e.host:null)||Cs(e)}function fm(e){return!ti(e)||ts(e).position==="fixed"?null:e.offsetParent}function d_(e){var t=/firefox/i.test(hu()),i=/Trident/i.test(hu());if(i&&ti(e)){var s=ts(e);if(s.position==="fixed")return null}var n=el(e);for(uu(n)&&(n=n.host);ti(n)&&["html","body"].indexOf(Ri(n))<0;){var r=ts(n);if(r.transform!=="none"||r.perspective!=="none"||r.contain==="paint"||["transform","perspective"].indexOf(r.willChange)!==-1||t&&r.willChange==="filter"||t&&r.filter&&r.filter!=="none")return n;n=n.parentNode}return null}function Kr(e){for(var t=Ht(e),i=fm(e);i&&h_(i)&&ts(i).position==="static";)i=fm(i);return i&&(Ri(i)==="html"||Ri(i)==="body"&&ts(i).position==="static")?t:i||d_(e)||t}function fu(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function Yr(e,t,i){return Js(e,Jo(t,i))}function f_(e,t,i){var s=Yr(e,t,i);return s>i?i:s}function pm(){return{top:0,right:0,bottom:0,left:0}}function mm(e){return Object.assign({},pm(),e)}function gm(e,t){return t.reduce(function(i,s){return i[s]=e,i},{})}var p_=function(t,i){return t=typeof t=="function"?t(Object.assign({},i.rects,{placement:i.placement})):t,mm(typeof t!="number"?t:gm(t,jr))};function m_(e){var t,i=e.state,s=e.name,n=e.options,r=i.elements.arrow,a=i.modifiersData.popperOffsets,o=ki(i.placement),u=fu(o),h=[$t,ei].indexOf(o)>=0,f=h?"height":"width";if(!(!r||!a)){var m=p_(n.padding,i),w=du(r),y=u==="y"?At:$t,b=u==="y"?Jt:ei,S=i.rects.reference[f]+i.rects.reference[u]-a[u]-i.rects.popper[f],C=a[u]-i.rects.reference[u],L=Kr(r),x=L?u==="y"?L.clientHeight||0:L.clientWidth||0:0,D=S/2-C/2,E=m[y],U=x-w[f]-m[b],Q=x/2-w[f]/2+D,ee=Yr(E,Q,U),p=u;i.modifiersData[s]=(t={},t[p]=ee,t.centerOffset=ee-Q,t)}}function g_(e){var t=e.state,i=e.options,s=i.element,n=s===void 0?"[data-popper-arrow]":s;n!=null&&(typeof n=="string"&&(n=t.elements.popper.querySelector(n),!n)||dm(t.elements.popper,n)&&(t.elements.arrow=n))}const y_={name:"arrow",enabled:!0,phase:"main",fn:m_,effect:g_,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Pn(e){return e.split("-")[1]}var w_={top:"auto",right:"auto",bottom:"auto",left:"auto"};function b_(e,t){var i=e.x,s=e.y,n=t.devicePixelRatio||1;return{x:On(i*n)/n||0,y:On(s*n)/n||0}}function ym(e){var t,i=e.popper,s=e.popperRect,n=e.placement,r=e.variation,a=e.offsets,o=e.position,u=e.gpuAcceleration,h=e.adaptive,f=e.roundOffsets,m=e.isFixed,w=a.x,y=w===void 0?0:w,b=a.y,S=b===void 0?0:b,C=typeof f=="function"?f({x:y,y:S}):{x:y,y:S};y=C.x,S=C.y;var L=a.hasOwnProperty("x"),x=a.hasOwnProperty("y"),D=$t,E=At,U=window;if(h){var Q=Kr(i),ee="clientHeight",p="clientWidth";if(Q===Ht(i)&&(Q=Cs(i),ts(Q).position!=="static"&&o==="absolute"&&(ee="scrollHeight",p="scrollWidth")),Q=Q,n===At||(n===$t||n===ei)&&r===Wr){E=Jt;var v=m&&Q===U&&U.visualViewport?U.visualViewport.height:Q[ee];S-=v-s.height,S*=u?1:-1}if(n===$t||(n===At||n===Jt)&&r===Wr){D=ei;var T=m&&Q===U&&U.visualViewport?U.visualViewport.width:Q[p];y-=T-s.width,y*=u?1:-1}}var N=Object.assign({position:o},h&&w_),V=f===!0?b_({x:y,y:S},Ht(i)):{x:y,y:S};if(y=V.x,S=V.y,u){var $;return Object.assign({},N,($={},$[E]=x?"0":"",$[D]=L?"0":"",$.transform=(U.devicePixelRatio||1)<=1?"translate("+y+"px, "+S+"px)":"translate3d("+y+"px, "+S+"px, 0)",$))}return Object.assign({},N,(t={},t[E]=x?S+"px":"",t[D]=L?y+"px":"",t.transform="",t))}function v_(e){var t=e.state,i=e.options,s=i.gpuAcceleration,n=s===void 0?!0:s,r=i.adaptive,a=r===void 0?!0:r,o=i.roundOffsets,u=o===void 0?!0:o,h={placement:ki(t.placement),variation:Pn(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:n,isFixed:t.options.strategy==="fixed"};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,ym(Object.assign({},h,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:a,roundOffsets:u})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,ym(Object.assign({},h,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:u})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}const E_={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:v_,data:{}};var tl={passive:!0};function T_(e){var t=e.state,i=e.instance,s=e.options,n=s.scroll,r=n===void 0?!0:n,a=s.resize,o=a===void 0?!0:a,u=Ht(t.elements.popper),h=[].concat(t.scrollParents.reference,t.scrollParents.popper);return r&&h.forEach(function(f){f.addEventListener("scroll",i.update,tl)}),o&&u.addEventListener("resize",i.update,tl),function(){r&&h.forEach(function(f){f.removeEventListener("scroll",i.update,tl)}),o&&u.removeEventListener("resize",i.update,tl)}}const C_={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:T_,data:{}};var S_={left:"right",right:"left",bottom:"top",top:"bottom"};function il(e){return e.replace(/left|right|bottom|top/g,function(t){return S_[t]})}var x_={start:"end",end:"start"};function wm(e){return e.replace(/start|end/g,function(t){return x_[t]})}function pu(e){var t=Ht(e),i=t.pageXOffset,s=t.pageYOffset;return{scrollLeft:i,scrollTop:s}}function mu(e){return Bn(Cs(e)).left+pu(e).scrollLeft}function __(e,t){var i=Ht(e),s=Cs(e),n=i.visualViewport,r=s.clientWidth,a=s.clientHeight,o=0,u=0;if(n){r=n.width,a=n.height;var h=hm();(h||!h&&t==="fixed")&&(o=n.offsetLeft,u=n.offsetTop)}return{width:r,height:a,x:o+mu(e),y:u}}function I_(e){var t,i=Cs(e),s=pu(e),n=(t=e.ownerDocument)==null?void 0:t.body,r=Js(i.scrollWidth,i.clientWidth,n?n.scrollWidth:0,n?n.clientWidth:0),a=Js(i.scrollHeight,i.clientHeight,n?n.scrollHeight:0,n?n.clientHeight:0),o=-s.scrollLeft+mu(e),u=-s.scrollTop;return ts(n||i).direction==="rtl"&&(o+=Js(i.clientWidth,n?n.clientWidth:0)-r),{width:r,height:a,x:o,y:u}}function gu(e){var t=ts(e),i=t.overflow,s=t.overflowX,n=t.overflowY;return/auto|scroll|overlay|hidden/.test(i+n+s)}function bm(e){return["html","body","#document"].indexOf(Ri(e))>=0?e.ownerDocument.body:ti(e)&&gu(e)?e:bm(el(e))}function Xr(e,t){var i;t===void 0&&(t=[]);var s=bm(e),n=s===((i=e.ownerDocument)==null?void 0:i.body),r=Ht(s),a=n?[r].concat(r.visualViewport||[],gu(s)?s:[]):s,o=t.concat(a);return n?o:o.concat(Xr(el(a)))}function yu(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function V_(e,t){var i=Bn(e,!1,t==="fixed");return i.top=i.top+e.clientTop,i.left=i.left+e.clientLeft,i.bottom=i.top+e.clientHeight,i.right=i.left+e.clientWidth,i.width=e.clientWidth,i.height=e.clientHeight,i.x=i.left,i.y=i.top,i}function vm(e,t,i){return t===om?yu(__(e,i)):Zs(t)?V_(t,i):yu(I_(Cs(e)))}function A_(e){var t=Xr(el(e)),i=["absolute","fixed"].indexOf(ts(e).position)>=0,s=i&&ti(e)?Kr(e):e;return Zs(s)?t.filter(function(n){return Zs(n)&&dm(n,s)&&Ri(n)!=="body"}):[]}function $_(e,t,i,s){var n=t==="clippingParents"?A_(e):[].concat(t),r=[].concat(n,[i]),a=r[0],o=r.reduce(function(u,h){var f=vm(e,h,s);return u.top=Js(f.top,u.top),u.right=Jo(f.right,u.right),u.bottom=Jo(f.bottom,u.bottom),u.left=Js(f.left,u.left),u},vm(e,a,s));return o.width=o.right-o.left,o.height=o.bottom-o.top,o.x=o.left,o.y=o.top,o}function Em(e){var t=e.reference,i=e.element,s=e.placement,n=s?ki(s):null,r=s?Pn(s):null,a=t.x+t.width/2-i.width/2,o=t.y+t.height/2-i.height/2,u;switch(n){case At:u={x:a,y:t.y-i.height};break;case Jt:u={x:a,y:t.y+t.height};break;case ei:u={x:t.x+t.width,y:o};break;case $t:u={x:t.x-i.width,y:o};break;default:u={x:t.x,y:t.y}}var h=n?fu(n):null;if(h!=null){var f=h==="y"?"height":"width";switch(r){case qn:u[h]=u[h]-(t[f]/2-i[f]/2);break;case Wr:u[h]=u[h]+(t[f]/2-i[f]/2);break}}return u}function Zr(e,t){t===void 0&&(t={});var i=t,s=i.placement,n=s===void 0?e.placement:s,r=i.strategy,a=r===void 0?e.strategy:r,o=i.boundary,u=o===void 0?Xx:o,h=i.rootBoundary,f=h===void 0?om:h,m=i.elementContext,w=m===void 0?zr:m,y=i.altBoundary,b=y===void 0?!1:y,S=i.padding,C=S===void 0?0:S,L=mm(typeof C!="number"?C:gm(C,jr)),x=w===zr?Zx:zr,D=e.rects.popper,E=e.elements[b?x:w],U=$_(Zs(E)?E:E.contextElement||Cs(e.elements.popper),u,f,a),Q=Bn(e.elements.reference),ee=Em({reference:Q,element:D,strategy:"absolute",placement:n}),p=yu(Object.assign({},D,ee)),v=w===zr?p:Q,T={top:U.top-v.top+L.top,bottom:v.bottom-U.bottom+L.bottom,left:U.left-v.left+L.left,right:v.right-U.right+L.right},N=e.modifiersData.offset;if(w===zr&&N){var V=N[n];Object.keys(T).forEach(function($){var q=[ei,Jt].indexOf($)>=0?1:-1,A=[At,Jt].indexOf($)>=0?"y":"x";T[$]+=V[A]*q})}return T}function L_(e,t){t===void 0&&(t={});var i=t,s=i.placement,n=i.boundary,r=i.rootBoundary,a=i.padding,o=i.flipVariations,u=i.allowedAutoPlacements,h=u===void 0?cm:u,f=Pn(s),m=f?o?lm:lm.filter(function(b){return Pn(b)===f}):jr,w=m.filter(function(b){return h.indexOf(b)>=0});w.length===0&&(w=m);var y=w.reduce(function(b,S){return b[S]=Zr(e,{placement:S,boundary:n,rootBoundary:r,padding:a})[ki(S)],b},{});return Object.keys(y).sort(function(b,S){return y[b]-y[S]})}function M_(e){if(ki(e)===cu)return[];var t=il(e);return[wm(e),t,wm(t)]}function N_(e){var t=e.state,i=e.options,s=e.name;if(!t.modifiersData[s]._skip){for(var n=i.mainAxis,r=n===void 0?!0:n,a=i.altAxis,o=a===void 0?!0:a,u=i.fallbackPlacements,h=i.padding,f=i.boundary,m=i.rootBoundary,w=i.altBoundary,y=i.flipVariations,b=y===void 0?!0:y,S=i.allowedAutoPlacements,C=t.options.placement,L=ki(C),x=L===C,D=u||(x||!b?[il(C)]:M_(C)),E=[C].concat(D).reduce(function(Ee,P){return Ee.concat(ki(P)===cu?L_(t,{placement:P,boundary:f,rootBoundary:m,padding:h,flipVariations:b,allowedAutoPlacements:S}):P)},[]),U=t.rects.reference,Q=t.rects.popper,ee=new Map,p=!0,v=E[0],T=0;T<E.length;T++){var N=E[T],V=ki(N),$=Pn(N)===qn,q=[At,Jt].indexOf(V)>=0,A=q?"width":"height",M=Zr(t,{placement:N,boundary:f,rootBoundary:m,altBoundary:w,padding:h}),k=q?$?ei:$t:$?Jt:At;U[A]>Q[A]&&(k=il(k));var R=il(k),z=[];if(r&&z.push(M[V]<=0),o&&z.push(M[k]<=0,M[R]<=0),z.every(function(Ee){return Ee})){v=N,p=!1;break}ee.set(N,z)}if(p)for(var Z=b?3:1,ne=function(P){var K=E.find(function(Me){var qe=ee.get(Me);if(qe)return qe.slice(0,P).every(function(Et){return Et})});if(K)return v=K,"break"},de=Z;de>0;de--){var ge=ne(de);if(ge==="break")break}t.placement!==v&&(t.modifiersData[s]._skip=!0,t.placement=v,t.reset=!0)}}const R_={name:"flip",enabled:!0,phase:"main",fn:N_,requiresIfExists:["offset"],data:{_skip:!1}};function Tm(e,t,i){return i===void 0&&(i={x:0,y:0}),{top:e.top-t.height-i.y,right:e.right-t.width+i.x,bottom:e.bottom-t.height+i.y,left:e.left-t.width-i.x}}function Cm(e){return[At,ei,Jt,$t].some(function(t){return e[t]>=0})}function k_(e){var t=e.state,i=e.name,s=t.rects.reference,n=t.rects.popper,r=t.modifiersData.preventOverflow,a=Zr(t,{elementContext:"reference"}),o=Zr(t,{altBoundary:!0}),u=Tm(a,s),h=Tm(o,n,r),f=Cm(u),m=Cm(h);t.modifiersData[i]={referenceClippingOffsets:u,popperEscapeOffsets:h,isReferenceHidden:f,hasPopperEscaped:m},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":f,"data-popper-escaped":m})}const q_={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:k_};function O_(e,t,i){var s=ki(e),n=[$t,At].indexOf(s)>=0?-1:1,r=typeof i=="function"?i(Object.assign({},t,{placement:e})):i,a=r[0],o=r[1];return a=a||0,o=(o||0)*n,[$t,ei].indexOf(s)>=0?{x:o,y:a}:{x:a,y:o}}function B_(e){var t=e.state,i=e.options,s=e.name,n=i.offset,r=n===void 0?[0,0]:n,a=cm.reduce(function(f,m){return f[m]=O_(m,t.rects,r),f},{}),o=a[t.placement],u=o.x,h=o.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=u,t.modifiersData.popperOffsets.y+=h),t.modifiersData[s]=a}const P_={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:B_};function D_(e){var t=e.state,i=e.name;t.modifiersData[i]=Em({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})}const Q_={name:"popperOffsets",enabled:!0,phase:"read",fn:D_,data:{}};function H_(e){return e==="x"?"y":"x"}function F_(e){var t=e.state,i=e.options,s=e.name,n=i.mainAxis,r=n===void 0?!0:n,a=i.altAxis,o=a===void 0?!1:a,u=i.boundary,h=i.rootBoundary,f=i.altBoundary,m=i.padding,w=i.tether,y=w===void 0?!0:w,b=i.tetherOffset,S=b===void 0?0:b,C=Zr(t,{boundary:u,rootBoundary:h,padding:m,altBoundary:f}),L=ki(t.placement),x=Pn(t.placement),D=!x,E=fu(L),U=H_(E),Q=t.modifiersData.popperOffsets,ee=t.rects.reference,p=t.rects.popper,v=typeof S=="function"?S(Object.assign({},t.rects,{placement:t.placement})):S,T=typeof v=="number"?{mainAxis:v,altAxis:v}:Object.assign({mainAxis:0,altAxis:0},v),N=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,V={x:0,y:0};if(Q){if(r){var $,q=E==="y"?At:$t,A=E==="y"?Jt:ei,M=E==="y"?"height":"width",k=Q[E],R=k+C[q],z=k-C[A],Z=y?-p[M]/2:0,ne=x===qn?ee[M]:p[M],de=x===qn?-p[M]:-ee[M],ge=t.elements.arrow,Ee=y&&ge?du(ge):{width:0,height:0},P=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:pm(),K=P[q],Me=P[A],qe=Yr(0,ee[M],Ee[M]),Et=D?ee[M]/2-Z-qe-K-T.mainAxis:ne-qe-K-T.mainAxis,at=D?-ee[M]/2+Z+qe+Me+T.mainAxis:de+qe+Me+T.mainAxis,He=t.elements.arrow&&Kr(t.elements.arrow),ft=He?E==="y"?He.clientTop||0:He.clientLeft||0:0,Fe=($=N==null?void 0:N[E])!=null?$:0,Oe=k+Et-Fe-ft,_e=k+at-Fe,_i=Yr(y?Jo(R,Oe):R,k,y?Js(z,_e):z);Q[E]=_i,V[E]=_i-k}if(o){var ji,ks=E==="x"?At:$t,qs=E==="x"?Jt:ei,pt=Q[U],Rt=U==="y"?"height":"width",Wi=pt+C[ks],li=pt-C[qs],mt=[At,$t].indexOf(L)!==-1,Ii=(ji=N==null?void 0:N[U])!=null?ji:0,Os=mt?Wi:pt-ee[Rt]-p[Rt]-Ii+T.altAxis,ci=mt?pt+ee[Rt]+p[Rt]-Ii-T.altAxis:li,Vi=y&&mt?f_(Os,pt,ci):Yr(y?Os:Wi,pt,y?ci:li);Q[U]=Vi,V[U]=Vi-pt}t.modifiersData[s]=V}}const U_={name:"preventOverflow",enabled:!0,phase:"main",fn:F_,requiresIfExists:["offset"]};function G_(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function j_(e){return e===Ht(e)||!ti(e)?pu(e):G_(e)}function W_(e){var t=e.getBoundingClientRect(),i=On(t.width)/e.offsetWidth||1,s=On(t.height)/e.offsetHeight||1;return i!==1||s!==1}function z_(e,t,i){i===void 0&&(i=!1);var s=ti(t),n=ti(t)&&W_(t),r=Cs(t),a=Bn(e,n,i),o={scrollLeft:0,scrollTop:0},u={x:0,y:0};return(s||!s&&!i)&&((Ri(t)!=="body"||gu(r))&&(o=j_(t)),ti(t)?(u=Bn(t,!0),u.x+=t.clientLeft,u.y+=t.clientTop):r&&(u.x=mu(r))),{x:a.left+o.scrollLeft-u.x,y:a.top+o.scrollTop-u.y,width:a.width,height:a.height}}function K_(e){var t=new Map,i=new Set,s=[];e.forEach(function(r){t.set(r.name,r)});function n(r){i.add(r.name);var a=[].concat(r.requires||[],r.requiresIfExists||[]);a.forEach(function(o){if(!i.has(o)){var u=t.get(o);u&&n(u)}}),s.push(r)}return e.forEach(function(r){i.has(r.name)||n(r)}),s}function Y_(e){var t=K_(e);return l_.reduce(function(i,s){return i.concat(t.filter(function(n){return n.phase===s}))},[])}function X_(e){var t;return function(){return t||(t=new Promise(function(i){Promise.resolve().then(function(){t=void 0,i(e())})})),t}}function Z_(e){var t=e.reduce(function(i,s){var n=i[s.name];return i[s.name]=n?Object.assign({},n,s,{options:Object.assign({},n.options,s.options),data:Object.assign({},n.data,s.data)}):s,i},{});return Object.keys(t).map(function(i){return t[i]})}var Sm={placement:"bottom",modifiers:[],strategy:"absolute"};function xm(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return!t.some(function(s){return!(s&&typeof s.getBoundingClientRect=="function")})}function J_(e){e===void 0&&(e={});var t=e,i=t.defaultModifiers,s=i===void 0?[]:i,n=t.defaultOptions,r=n===void 0?Sm:n;return function(o,u,h){h===void 0&&(h=r);var f={placement:"bottom",orderedModifiers:[],options:Object.assign({},Sm,r),modifiersData:{},elements:{reference:o,popper:u},attributes:{},styles:{}},m=[],w=!1,y={state:f,setOptions:function(L){var x=typeof L=="function"?L(f.options):L;S(),f.options=Object.assign({},r,f.options,x),f.scrollParents={reference:Zs(o)?Xr(o):o.contextElement?Xr(o.contextElement):[],popper:Xr(u)};var D=Y_(Z_([].concat(s,f.options.modifiers)));return f.orderedModifiers=D.filter(function(E){return E.enabled}),b(),y.update()},forceUpdate:function(){if(!w){var L=f.elements,x=L.reference,D=L.popper;if(xm(x,D)){f.rects={reference:z_(x,Kr(D),f.options.strategy==="fixed"),popper:du(D)},f.reset=!1,f.placement=f.options.placement,f.orderedModifiers.forEach(function(T){return f.modifiersData[T.name]=Object.assign({},T.data)});for(var E=0;E<f.orderedModifiers.length;E++){if(f.reset===!0){f.reset=!1,E=-1;continue}var U=f.orderedModifiers[E],Q=U.fn,ee=U.options,p=ee===void 0?{}:ee,v=U.name;typeof Q=="function"&&(f=Q({state:f,options:p,name:v,instance:y})||f)}}}},update:X_(function(){return new Promise(function(C){y.forceUpdate(),C(f)})}),destroy:function(){S(),w=!0}};if(!xm(o,u))return y;y.setOptions(h).then(function(C){!w&&h.onFirstUpdate&&h.onFirstUpdate(C)});function b(){f.orderedModifiers.forEach(function(C){var L=C.name,x=C.options,D=x===void 0?{}:x,E=C.effect;if(typeof E=="function"){var U=E({state:f,name:L,instance:y,options:D}),Q=function(){};m.push(U||Q)}})}function S(){m.forEach(function(C){return C()}),m=[]}return y}}var eI=[C_,Q_,E_,um,P_,R_,U_,y_,q_],tI=J_({defaultModifiers:eI}),iI="tippy-box",_m="tippy-content",sI="tippy-backdrop",Im="tippy-arrow",Vm="tippy-svg-arrow",en={passive:!0,capture:!0},Am=function(){return document.body};function nI(e,t){return{}.hasOwnProperty.call(e,t)}function wu(e,t,i){if(Array.isArray(e)){var s=e[t];return s??(Array.isArray(i)?i[t]:i)}return e}function bu(e,t){var i={}.toString.call(e);return i.indexOf("[object")===0&&i.indexOf(t+"]")>-1}function $m(e,t){return typeof e=="function"?e.apply(void 0,t):e}function Lm(e,t){if(t===0)return e;var i;return function(s){clearTimeout(i),i=setTimeout(function(){e(s)},t)}}function rI(e,t){var i=Object.assign({},e);return t.forEach(function(s){delete i[s]}),i}function aI(e){return e.split(/\s+/).filter(Boolean)}function Dn(e){return[].concat(e)}function Mm(e,t){e.indexOf(t)===-1&&e.push(t)}function oI(e){return e.filter(function(t,i){return e.indexOf(t)===i})}function lI(e){return e.split("-")[0]}function sl(e){return[].slice.call(e)}function Nm(e){return Object.keys(e).reduce(function(t,i){return e[i]!==void 0&&(t[i]=e[i]),t},{})}function Jr(){return document.createElement("div")}function ea(e){return["Element","Fragment"].some(function(t){return bu(e,t)})}function cI(e){return bu(e,"NodeList")}function uI(e){return bu(e,"MouseEvent")}function hI(e){return!!(e&&e._tippy&&e._tippy.reference===e)}function dI(e){return ea(e)?[e]:cI(e)?sl(e):Array.isArray(e)?e:sl(document.querySelectorAll(e))}function vu(e,t){e.forEach(function(i){i&&(i.style.transitionDuration=t+"ms")})}function Rm(e,t){e.forEach(function(i){i&&i.setAttribute("data-state",t)})}function fI(e){var t,i=Dn(e),s=i[0];return s!=null&&(t=s.ownerDocument)!=null&&t.body?s.ownerDocument:document}function pI(e,t){var i=t.clientX,s=t.clientY;return e.every(function(n){var r=n.popperRect,a=n.popperState,o=n.props,u=o.interactiveBorder,h=lI(a.placement),f=a.modifiersData.offset;if(!f)return!0;var m=h==="bottom"?f.top.y:0,w=h==="top"?f.bottom.y:0,y=h==="right"?f.left.x:0,b=h==="left"?f.right.x:0,S=r.top-s+m>u,C=s-r.bottom-w>u,L=r.left-i+y>u,x=i-r.right-b>u;return S||C||L||x})}function Eu(e,t,i){var s=t+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(n){e[s](n,i)})}function km(e,t){for(var i=t;i;){var s;if(e.contains(i))return!0;i=i.getRootNode==null||(s=i.getRootNode())==null?void 0:s.host}return!1}var qi={isTouch:!1},qm=0;function mI(){qi.isTouch||(qi.isTouch=!0,window.performance&&document.addEventListener("mousemove",Om))}function Om(){var e=performance.now();e-qm<20&&(qi.isTouch=!1,document.removeEventListener("mousemove",Om)),qm=e}function gI(){var e=document.activeElement;if(hI(e)){var t=e._tippy;e.blur&&!t.state.isVisible&&e.blur()}}function yI(){document.addEventListener("touchstart",mI,en),window.addEventListener("blur",gI)}var wI=typeof window<"u"&&typeof document<"u",bI=wI?!!window.msCrypto:!1;function Qn(e){var t=e==="destroy"?"n already-":" ";return[e+"() was called on a"+t+"destroyed instance. This is a no-op but","indicates a potential memory leak."].join(" ")}function Bm(e){var t=/[ \t]{2,}/g,i=/^[ \t]*/gm;return e.replace(t," ").replace(i,"").trim()}function vI(e){return Bm(`
87
+ `+r):s.stack=r}catch{}}throw s}}_request(t,i){typeof t=="string"?(i=i||{},i.url=t):i=t||{},i=Ys(this.defaults,i);const{transitional:s,paramsSerializer:n,headers:r}=i;s!==void 0&&eu.assertOptions(s,{silentJSONParsing:Es.transitional(Es.boolean),forcedJSONParsing:Es.transitional(Es.boolean),clarifyTimeoutError:Es.transitional(Es.boolean)},!1),n!=null&&(F.isFunction(n)?i.paramsSerializer={serialize:n}:eu.assertOptions(n,{encode:Es.function,serialize:Es.function},!0)),i.method=(i.method||this.defaults.method||"get").toLowerCase();let a=r&&F.merge(r.common,r[i.method]);r&&F.forEach(["delete","get","head","post","put","patch","common"],b=>{delete r[b]}),i.headers=Vt.concat(a,r);const o=[];let u=!0;this.interceptors.request.forEach(function(S){typeof S.runWhen=="function"&&S.runWhen(i)===!1||(u=u&&S.synchronous,o.unshift(S.fulfilled,S.rejected))});const h=[];this.interceptors.response.forEach(function(S){h.push(S.fulfilled,S.rejected)});let f,m=0,w;if(!u){const b=[Kp.bind(this),void 0];for(b.unshift.apply(b,o),b.push.apply(b,h),w=b.length,f=Promise.resolve(i);m<w;)f=f.then(b[m++],b[m++]);return f}w=o.length;let y=i;for(m=0;m<w;){const b=o[m++],S=o[m++];try{y=b(y)}catch(C){S.call(this,C);break}}try{f=Kp.call(this,y)}catch(b){return Promise.reject(b)}for(m=0,w=h.length;m<w;)f=f.then(h[m++],h[m++]);return f}getUri(t){t=Ys(this.defaults,t);const i=Dp(t.baseURL,t.url);return Lp(i,t.params,t.paramsSerializer)}}F.forEach(["delete","get","head","options"],function(t){Xs.prototype[t]=function(i,s){return this.request(Ys(s||{},{method:t,url:i,data:(s||{}).data}))}}),F.forEach(["post","put","patch"],function(t){function i(s){return function(r,a,o){return this.request(Ys(o||{},{method:t,headers:s?{"Content-Type":"multipart/form-data"}:{},url:r,data:a}))}}Xs.prototype[t]=i(),Xs.prototype[t+"Form"]=i(!0)});class tu{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let i;this.promise=new Promise(function(r){i=r});const s=this;this.promise.then(n=>{if(!s._listeners)return;let r=s._listeners.length;for(;r-- >0;)s._listeners[r](n);s._listeners=null}),this.promise.then=n=>{let r;const a=new Promise(o=>{s.subscribe(o),r=o}).then(n);return a.cancel=function(){s.unsubscribe(r)},a},t(function(r,a,o){s.reason||(s.reason=new Rn(r,a,o),i(s.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const i=this._listeners.indexOf(t);i!==-1&&this._listeners.splice(i,1)}toAbortSignal(){const t=new AbortController,i=s=>{t.abort(s)};return this.subscribe(i),t.signal.unsubscribe=()=>this.unsubscribe(i),t.signal}static source(){let t;return{token:new tu(function(n){t=n}),cancel:t}}}function hS(e){return function(i){return e.apply(null,i)}}function dS(e){return F.isObject(e)&&e.isAxiosError===!0}const iu={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(iu).forEach(([e,t])=>{iu[t]=e});function Zp(e){const t=new Xs(e),i=mp(Xs.prototype.request,t);return F.extend(i,Xs.prototype,t,{allOwnKeys:!0}),F.extend(i,t,null,{allOwnKeys:!0}),i.create=function(n){return Zp(Ys(e,n))},i}const We=Zp(Hr);We.Axios=Xs,We.CanceledError=Rn,We.CancelToken=tu,We.isCancel=qp,We.VERSION=Yp,We.toFormData=Bo,We.AxiosError=be,We.Cancel=We.CanceledError,We.all=function(t){return Promise.all(t)},We.spread=hS,We.isAxiosError=dS,We.mergeConfig=Ys,We.AxiosHeaders=Vt,We.formToJSON=e=>Rp(F.isHTMLForm(e)?new FormData(e):e),We.getAdapter=zp.getAdapter,We.HttpStatusCode=iu,We.default=We;const fS={name:"QtiStylesheet",props:{href:{type:String,required:!0},type:{type:String,required:!0}},data(){return{css:"",isQtiValid:!0}},methods:{getCss(){We.get(this.href).then(e=>{this.css=`<style>${e.data}</style>`}).catch(e=>{console.log("["+this.$options.name+"][CSS Fetch Error: "+e+"]")})},validateChildren(){}},created(){this.getCss()},mounted(){if(this.isQtiValid)try{this.validateChildren(),console.log("["+this.$options.name+"][Href: "+this.href+"]")}catch(e){throw this.isQtiValid=!1,new c(e.message)}}},pS=["innerHTML"];function mS(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",{ref:"root",class:"qti-stylesheet",innerHTML:n.css},null,8,pS)}const gS=B(fS,[["render",mS]]),yS={name:"QtiCompanionMaterialsInfo",data(){return{isQtiValid:!0}},methods:{validateChildren(){}},mounted(){if(this.isQtiValid)try{this.validateChildren(),console.log("["+this.$options.name+"]")}catch(e){throw this.isQtiValid=!1,new c(e.message)}}},wS={class:"qti-companion-materials-info"};function bS(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",wS)}const vS=B(yS,[["render",bS]]),Ur=new G,ES={name:"QtiMapping",props:{lowerBound:{type:String,required:!1},upperBound:{type:String,required:!1},defaultValue:{type:String,required:!1}},data(){return{value:null,valueBaseType:"float",valueCardinality:"single",valueLowerBound:null,valueUpperBound:null,valueDefaultValue:new X(0).toNumber(),isQtiValid:!0}},methods:{getValue(){return this.value},setValue(e){this.value=e},isNull(){return this.value===null},getBaseType(){return this.valueBaseType},getCardinality(){return this.valueCardinality},getLowerBound(){return this.valueLowerBound},setLowerBound(e){this.valueLowerBound=e},getUpperBound(){return this.valueUpperBound},setUpperBound(e){this.valueUpperBound=e},getDefaultValue(){return this.valueDefaultValue},setDefaultValue(e){this.valueDefaultValue=e},computeFloatValue(e){let t=null;try{t=new X(e)}catch(i){throw new se(i.message)}return t.toNumber()},applyConstraints(e){return e===null||!X.isBigNumber(e)?null:(this.getLowerBound()!==null&&e.comparedTo(this.getLowerBound())<0&&(e=new X(this.getLowerBound())),this.getUpperBound()!==null&&e.comparedTo(this.getUpperBound())>0&&(e=new X(this.getUpperBound())),e.toNumber())},validateChildren:function(){let e=0;if(!this.$slots.default)throw new c("Must have at least one qti-map-entry node");if(this.$slots.default().forEach(t=>{if(Ur.isValidSlot(t))if(Ur.kebabCase(t.type.name)==="qti-map-entry")e+=1;else throw new c('Node is not a qti-map-entry: "'+t.tpe.name+'"')}),e===0)throw new c("Must have at least one qti-map-entry node")},processChildren(){let e=null;return this.$.subTree.children[0].children.forEach(i=>{if(i.component===null)return;const s=i.component.proxy;e===null&&(e=[]),e.push(s.getValue())}),e}},created(){try{typeof this.lowerBound<"u"&&this.setLowerBound(this.computeFloatValue(Ur.FloatValue(this.lowerBound))),typeof this.upperBound<"u"&&this.setUpperBound(this.computeFloatValue(Ur.FloatValue(this.upperBound))),typeof this.defaultValue<"u"&&this.setDefaultValue(this.computeFloatValue(Ur.FloatValue(this.defaultValue))),this.validateChildren()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.setValue(this.processChildren()),console.log("[QtiMapping][lowerBound][upperBound][defaultValue][Value]",this.getLowerBound(),this.getUpperBound(),this.getDefaultValue(),this.getValue())}catch(e){throw this.isQtiValid=!1,new c(e.message)}}},TS={class:"qti-mapping"};function CS(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",TS,[l.renderSlot(e.$slots,"default")])}const SS=B(ES,[["render",CS]]),su=new G,xS={name:"QtiMapEntry",props:{mapKey:{type:String,required:!0},mappedValue:{type:String,required:!0},caseSensitive:{type:String,required:!1}},data(){return{value:null,valueBaseType:"float",valueCardinality:"single",valueMappedValue:null,valueCaseSensitive:!1,isQtiValid:!0}},methods:{getValue(){return this.value},setValue(e){this.value=e},isNull(){return this.value===null},getBaseType(){return this.valueBaseType},getCardinality(){return this.valueCardinality},setMappedValue(e){this.valueMappedValue=e},getMappedValue(){return this.valueMappedValue},setCaseSensitive(e){this.valueCaseSensitive=e},getCaseSensitive(){return this.valueCaseSensitive},computeMappedValue(e){let t=null;try{t=new X(e)}catch(i){throw new se(i.message)}return t.toNumber()},validateChildren:function(){this.$slots.default&&this.$slots.default().forEach(e=>{if(su.isValidSlot(e))throw new c('Invalid Child Node: "'+e.tpe.name+'"')})}},created(){try{this.setCaseSensitive(su.validateCaseSensitive(this.caseSensitive,!1)),this.setMappedValue(this.computeMappedValue(su.FloatValue(this.mappedValue))),this.validateChildren()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){let e=this.$el.querySelector(".amp-mapentry__container");this.isQtiValid&&(this.setValue({mapKey:this.mapKey,mappedValue:this.getMappedValue(),caseSensitive:this.getCaseSensitive()}),console.log("["+this.$options.name+"][Value]",this.getValue())),e.remove()}},_S={class:"qti-map-entry"},IS={class:"amp-mapentry__container"};function VS(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",_S,[l.createElementVNode("div",IS,[l.renderSlot(e.$slots,"default")])])}const AS=B(xS,[["render",VS]]),$S={name:"QtiAreaMapping",methods:{},created:function(){},mounted:function(){console.log("[AreaMapping][Mounted]")}},LS={class:"qti-area-mapping"};function MS(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",LS)}const NS=B($S,[["render",MS]]),nu=new G,RS={name:"QtiInterpolationTable",props:{defaultValue:{type:String,required:!1}},data(){return{value:null,valueBaseType:null,valueCardinality:"single",valueDefaultValue:null,tableType:"interpolation",isQtiValid:!0}},methods:{getValue(){return this.value},setValue(e){this.value=e},isNull(){return this.value===null},getBaseType(){return this.valueBaseType},setBaseType(e){this.valueBaseType=e},getCardinality(){return this.valueCardinality},getTableType(){return this.tableType},getDefaultValue(){return this.valueDefaultValue},setDefaultValue(e){this.valueDefaultValue=e},validateChildren:function(){let e=0;if(!this.$slots.default)throw new c("Must have at least one qti-interpolation-table-entry node");if(this.$slots.default().forEach(t=>{if(nu.isValidSlot(t))if(nu.kebabCase(t.type.name)==="qti-interpolation-table-entry")e+=1;else throw new c('Node is not a qti-interpolation-table-entry: "'+t.tpe.name+'"')}),e===0)throw new c("Must have at least one qti-interpolation-table-entry node")},processChildren(){let e=null;return this.$.subTree.children[0].children.forEach(i=>{e===null&&(e=[]),e.push(i.getValue())}),e}},created(){try{let e=this.$parent.getBaseType();this.setBaseType(e),typeof this.defaultValue>"u"?this.setDefaultValue(null):this.setDefaultValue(nu.validateValueFromBaseType(e,this.defaultValue)),this.validateChildren()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.setValue(this.processChildren()),console.log("[QtiInterpolationTable][DefaultValue][Value]",this.getDefaultValue(),this.getValue())}catch(e){throw this.isQtiValid=!1,new c(e.message)}}},kS={class:"qti-interpolation-table"};function qS(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",kS,[l.renderSlot(e.$slots,"default")])}const OS=B(RS,[["render",qS]]),Fo=new G,BS={name:"QtiInterpolationTableEntry",props:{sourceValue:{type:String,required:!0},includeBoundary:{type:String,required:!1},targetValue:{type:String,required:!0}},data(){return{value:null,valueSourceValue:null,valueTargetValue:null,valueIncludeBoundary:!0,isQtiValid:!0}},methods:{getValue(){return this.value},setValue(e){this.value=e},isNull(){return this.value===null},getBaseType(){return this.valueBaseType},setSourceValue(e){this.valueSourceValue=e},getSourceValue(){return this.valueSourceValue},setTargetValue(e){this.valueTargetValue=e},getTargetValue(){return this.valueTargetValue},setIncludeBoundary(e){this.valueIncludeBoundary=e},getIncludeBoundary(){return this.valueIncludeBoundary},computeSourceValue(e){let t=null;try{t=new X(e)}catch(i){throw new se(i.message)}return t.toNumber()},isValidSlot(e){if(typeof e.componentOptions<"u")return!0;if(typeof e.text<"u"&&e.text.trim().length>0)throw new c('Invalid Child Node: "'+e.text.trim()+'"');return!1},validateChildren(){this.$slots.default&&this.$slots.default().forEach(e=>{if(Fo.isValidSlot(e))throw new c('Invalid Child Node: "'+e.tpe.name+'"')})}},created(){try{let e=this.$parent.$parent.getBaseType();this.setIncludeBoundary(Fo.validateIncludeBoundary(this.includeBoundary,"include-boundary")),this.setSourceValue(this.computeSourceValue(Fo.FloatValue(this.sourceValue))),this.setTargetValue(Fo.validateValueFromBaseType(e,this.targetValue))}catch(e){if(this.isQtiValid=!1,e.name==="QtiValidationException")throw new c(e.message);if(e.name==="QtiParseException")throw new se(e.message)}},mounted(){let e=this.$el.querySelector(".amp-interpolationentry__container");this.isQtiValid&&(this.setValue({sourceValue:this.getSourceValue(),targetValue:this.getTargetValue(),includeBoundary:this.getIncludeBoundary()}),console.log("["+this.$options.name+"][Value]",this.getValue())),e.remove()}},PS={class:"qti-interpolation-table-entry"},DS={class:"amp-interpolationentry__container"};function QS(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",PS,[l.createElementVNode("div",DS,[l.renderSlot(e.$slots,"default")])])}const HS=B(BS,[["render",QS]]),ru=new G,FS={name:"QtiMatchTable",props:{defaultValue:{type:String,required:!1}},data(){return{value:null,valueBaseType:null,valueCardinality:"single",valueDefaultValue:null,tableType:"match",isQtiValid:!0}},methods:{getValue(){return this.value},setValue(e){this.value=e},isNull(){return this.value===null},getBaseType(){return this.valueBaseType},setBaseType(e){this.valueBaseType=e},getCardinality(){return this.valueCardinality},getTableType(){return this.tableType},getDefaultValue(){return this.valueDefaultValue},setDefaultValue(e){this.valueDefaultValue=e},validateChildren:function(){let e=0;if(!this.$slots.default)throw new c("Must have at least one qti-match-table-entry node");if(this.$slots.default().forEach(t=>{if(ru.isValidSlot(t))if(ru.kebabCase(t.type.name)==="qti-match-table-entry")e+=1;else throw new c('Node is not a qti-match-table-entry: "'+t.tpe.name+'"')}),e===0)throw new c("Must have at least one qti-match-table-entry node")},processChildren(){let e=null;return this.$.subTree.children[0].children.forEach(i=>{e===null&&(e=[]),e.push(i.getValue())}),e}},created(){try{let e=this.$parent.getBaseType();this.setBaseType(e),typeof this.defaultValue>"u"?this.setDefaultValue(null):this.setDefaultValue(ru.validateValueFromBaseType(e,this.defaultValue)),this.validateChildren()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.setValue(this.processChildren()),console.log("[QtiMatchTable][DefaultValue][Value]",this.getDefaultValue(),this.getValue())}catch(e){throw this.isQtiValid=!1,new c(e.message)}}},US={class:"qti-match-table"};function GS(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",US,[l.renderSlot(e.$slots,"default")])}const jS=B(FS,[["render",GS]]),au=new G,WS={name:"QtiMatchTableEntry",props:{sourceValue:{type:String,required:!0},targetValue:{type:String,required:!0}},data(){return{value:null,valueSourceValue:null,valueTargetValue:null,isQtiValid:!0}},methods:{getValue(){return this.value},setValue(e){this.value=e},isNull(){return this.value===null},getBaseType(){return this.valueBaseType},getCardinality(){return this.valueCardinality},setSourceValue(e){this.valueSourceValue=e},getSourceValue(){return this.valueSourceValue},setTargetValue(e){this.valueTargetValue=e},getTargetValue(){return this.valueTargetValue},computeSourceValue(e){let t=null;try{if(t=new X(e),!t.isInteger())throw new se('Invalid qti-match-table-entry source-value integer "'+t+'"')}catch(i){throw new se(i.message)}return t.toNumber()},validateChildren(){this.$slots.default&&this.$slots.default().forEach(e=>{if(au.isValidSlot(e))throw new c('Invalid Child Node: "'+e.tpe.name+'"')})}},created(){try{let e=this.$parent.$parent.getBaseType();this.setSourceValue(this.computeSourceValue(au.IntegerValue(this.sourceValue))),this.setTargetValue(au.validateValueFromBaseType(e,this.targetValue)),this.validateChildren()}catch(e){if(this.isQtiValid=!1,e.name==="QtiValidationException")throw new c(e.message);if(e.name==="QtiParseException")throw new se(e.message)}},mounted(){let e=this.$el.querySelector(".amp-matchtableentry__container");this.isQtiValid&&(this.setValue({sourceValue:this.getSourceValue(),targetValue:this.getTargetValue()}),console.log("["+this.$options.name+"][Value]",this.getValue())),e.remove()}},zS={class:"qti-match-table-entry"},KS={class:"amp-matchtableentry__container"};function YS(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",zS,[l.createElementVNode("div",KS,[l.renderSlot(e.$slots,"default")])])}const XS=B(WS,[["render",YS]]),ZS={name:"QtiDefaultValue",props:{interpretation:{type:String,required:!1}},data(){return{value:null,valueBaseType:null,valueCardinality:null,variableBaseType:null,variableCardinality:null,isQtiValid:!0}},methods:{getValue(){return this.value},setValue(e){this.value=e},isNull(){return this.value===null},getBaseType(){return this.valueBaseType},getCardinality(){return this.valueCardinality},processChildren(){let e=null;return this.$.subTree.children[0].children.forEach(i=>{if(i.component===null)return;const s=i.component.proxy;switch(this.variableCardinality){case"record":e===null&&(e=new Map),s.isRecordFieldValue()&&e.set(s.getFieldIdentifier(),s);break;case"multiple":case"ordered":e===null&&(e=[]),e.push(s.getValue());break;case"single":e=e===null?s.getValue():e;break;default:console.log("[DefaultValue][Cardinality]: processChildren cardinality unhandled = "+this.variableCardinality)}}),e},getVariableBaseType(){return this.$parent.$props.baseType},getVariableCardinality(){return this.$parent.$props.cardinality},evaluate(){return this.getValue()}},created(){try{this.valueBaseType=this.variableBaseType=this.getVariableBaseType(),this.valueCardinality=this.variableCardinality=this.getVariableCardinality()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.setValue(this.processChildren()),console.log("[DefaultValue][Value:",this.getValue(),"][BaseType:"+this.getBaseType()+"][Cardinality:"+this.getCardinality()+"]")}catch(e){throw this.isQtiValid=!1,new c(e.message)}}},JS={ref:"root",class:"qti-default-value"};function e1(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",JS,[l.renderSlot(e.$slots,"default")],512)}const t1=B(ZS,[["render",e1]]),i1={name:"QtiCorrectResponse",props:{interpretation:{type:String,required:!1}},data(){return{value:null,valueBaseType:null,valueCardinality:null,variableBaseType:null,variableCardinality:null,isQtiValid:!0}},methods:{getValue(){return this.value},setValue(e){this.value=e},isNull(){return this.value===null},getBaseType(){return this.valueBaseType},getCardinality(){return this.valueCardinality},processChildren(){let e=null;return this.$.subTree.children[0].children.forEach(i=>{if(i.component===null)return;const s=i.component.proxy;switch(this.variableCardinality){case"record":e===null&&(e=new Map),s.isRecordFieldValue()&&e.set(s.getFieldIdentifier(),s);break;case"multiple":case"ordered":e===null&&(e=[]),e.push(s.getValue());break;case"single":e=e===null?s.getValue():e;break;default:console.log("[CorrectResponse][Cardinality]: processChildren cardinality unhandled = "+this.variableCardinality)}}),e},getVariableBaseType(){return this.$parent.$props.baseType},getVariableCardinality(){return this.$parent.$props.cardinality},evaluate(){return this.getValue()}},created(){try{this.valueBaseType=this.variableBaseType=this.getVariableBaseType(),this.valueCardinality=this.variableCardinality=this.getVariableCardinality()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.setValue(this.processChildren()),console.log("[CorrectResponse][Value:",this.getValue(),"][BaseType:"+this.getBaseType()+"][Cardinality:"+this.getCardinality()+"]")}catch(e){throw this.isQtiValid=!1,new c(e.message)}}},s1={class:"qti-correct-response"};function n1(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",s1,[l.renderSlot(e.$slots,"default")])}const r1=B(i1,[["render",n1]]);class Jp{constructor(){}IntegerValue(t){if(t!=null&&(t=t.trim()),t==null||t.length==0)throw new se('Invalid integer "'+t+'". Length is not valid.');try{let i=parseInt(t,10);if(Number.isNaN(i))throw new se('Invalid integer "'+t+'". ');return i}catch(i){throw new se('Invalid integer "'+t+'". '+i.message)}}FloatValue(t){if(t!=null&&(t=t.trim()),t==null||t.length==0)throw new se('Invalid float "'+t+'". Length is not valid.');try{let i=parseFloat(t);if(Number.isNaN(i))throw new se('Invalid float "'+t+'". ');return i}catch(i){throw new se('Invalid float "'+t+'". '+i.message)}}BooleanValue(t){if(t!=null&&(t=t.trim()),t==null||t.length==0)throw new se('Invalid boolean "'+t+'". Length is not valid.');if(t.toLowerCase()==="true"||t==="1")return!0;if(t.toLowerCase()==="false"||t==="0")return!1;throw new se('Invalid boolean "'+t+'".')}StringValue(t){if(t==null||t.length==0)throw new se('Invalid string "'+t+'". Length is not valid.');return t}IdentifierValue(t){if(t!=null&&(t=t.trim()),t==null||t.length==0)throw new se('Invalid identifier "'+t+'". Length is not valid.');if(!this.isCharacterALetter(t.charAt(0))&&!this.isCharacterADigit(t.charAt(0))&&t.charAt(0)!=="_")throw new se('Invalid identifier "'+t+'". First character "'+t.charAt(0)+'" is not valid.');for(let i=1;i<t.length;i++)if(!this.isCharacterALetterOrDigit(t.charAt(i))&&t.charAt(i)!=="_"&&t.charAt(i)!=="-"&&t.charAt(i)!==".")throw new se('Invalid identifier "'+t+'". Character "'+t.charAt(i)+'" at position '+(i+1)+" is not valid.");return t}isCharacterALetter(t){return/[a-zA-Z]/.test(t)}isCharacterADigit(t){return/\d/.test(t)}isCharacterALetterOrDigit(t){return this.isCharacterALetter(t)||this.isCharacterADigit(t)}}const ou=new G,kn=new Jp,a1={name:"QtiValue",props:{baseType:{type:String,required:!1},fieldIdentifier:{type:String,required:!1}},data(){return{singleValue:null,valueBaseType:null,valueCardinality:"single",valueFieldIdentifier:null,variableBaseType:null,variableCardinality:null,isQtiValid:!0}},methods:{getValue(){if(this.isNull())return null;switch(this.valueBaseType){case"integer":case"float":return this.singleValue.toNumber();case"boolean":return this.singleValue;case"string":case"identifier":case"directedPair":case"pair":return this.singleValue;default:return console.log("[QtiValue][GetValue Exception]","Unhandled BaseType:"+this.valueBaseType),null}},isNull(){return this.singleValue===null},getBaseType(){return this.valueBaseType},getCardinality(){return"single"},getFieldIdentifier(){return this.valueFieldIdentifier},isRecordFieldValue(){return this.valueFieldIdentifier!==null&&this.valueBaseType!==null},readChildren(e){this.valueBaseType!=null&&(this.singleValue=this.parseSingleValue(this.valueBaseType,e.textContent))},parseSingleValue(e,t){let i=null;try{switch(e){case"integer":i=new X(kn.IntegerValue(t));break;case"float":i=new X(kn.FloatValue(t));break;case"boolean":i=kn.BooleanValue(t);break;case"string":i=kn.StringValue(t);break;case"identifier":i=kn.IdentifierValue(t);break;case"directedPair":case"pair":i=kn.StringValue(t);break;default:throw new se('[QtiValue][Unhandled BaseType]: "'+e+'"')}}catch(s){throw new se(s.message)}return i},_getVariableBaseType(e){return typeof e<"u"?e.baseType:null},_getVariableCardinality(e){return typeof e<"u"?e.cardinality:null},_validateAttributes(e,t){if(t==="record"){if(typeof this.baseType>"u")throw new c('base-type is a required attribute for "record" cardinality');if(ou.validateBaseType(this.baseType),this.valueBaseType=this.baseType,typeof this.fieldIdentifier>"u")throw new c('field-identifier is a required attribute for "record" cardinality');ou.validateIdentifierAttribute(this.fieldIdentifier),this.valueFieldIdentifier=this.fieldIdentifier}else{if(typeof this.baseType<"u")throw new c("base-type only permitted for record cardinality.");if(typeof this.fieldIdentifier<"u")throw new c("field-identifier only permitted for record cardinality.");this.valueBaseType=e}},getStore(){return this.$parent.$parent.getDeclarationContext()==="TEST"?it:_}},created:function(){try{let e=ou.validateVariableIdentifierAttribute(this.getStore(),this.$parent.$parent.$props.identifier);if(typeof e>"u")throw new c('Variable declaration not found: "'+this.$parent.$parent.$props.identifier+'"');this.variableCardinality=this._getVariableCardinality(e),this.variableBaseType=this._getVariableBaseType(e),this._validateAttributes(this.variableBaseType,this.variableCardinality)}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted:function(){let e=this.$el.querySelector(".amp-value__container");if(this.isQtiValid){try{this.readChildren(e)}catch(t){throw this.isQtiValid=!1,t.name==="QtiValidationException"?new c(t.message):t.name==="QtiParseException"?new se(t.message):new Error(t.message)}console.log("["+this.$options.name+"][Value:"+this.getValue()+"][BaseType:"+this.getBaseType()+"][FieldIdentifier:"+this.getFieldIdentifier()+"]")}e.remove()}},o1=["variable-basetype","variable-cardinality"],l1={class:"amp-value__container"};function c1(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",{class:"qti-value","variable-basetype":n.variableBaseType,"variable-cardinality":n.variableCardinality},[l.createElementVNode("div",l1,[l.renderSlot(e.$slots,"default")])],8,o1)}const u1=B(a1,[["render",c1]]),h1=new G,d1={name:"QtiItemBody",emits:["itemBodyReady"],data(){return{mathElementMap:new Map}},methods:{initializeTemplateMathVariables(){const e=this.getTemplateMathVariables();if(e.length===0)return;this.getMathElements().forEach(function(i){this.archiveMathElement(i),i.innerHTML=this.applyTemplateValuesToMathml(i.innerHTML,e)},this)},updateTemplateMathVariables(){const e=this.getTemplateMathVariables();if(e.length===0)return;this.getMathScriptElements().forEach(function(i){for(let[s,n]of this.mathElementMap){const r=new RegExp('id="('+s+')"',"g");if(i.innerHTML.match(r)){i.innerHTML=this.applyTemplateValuesToMathml(n,e);break}}},this),this.reprocessMML()},getTemplateMathVariables(){return _.getTemplateMathParameterVariables()},getMathElements(){return this.$el.querySelectorAll("math")},getMathScriptElements(){return this.$el.querySelectorAll('script[type="math/mml"]')},archiveMathElement(e){e.hasAttribute("id")||(e.id=h1.randomString(5,"a")),this.mathElementMap.set(e.id,e.outerHTML)},applyTemplateValuesToMathml(e,t){let i=e;return t.forEach(function(s){const n=new RegExp("<[mc]i[^>]*>("+s.identifier+")<\\/[mc]i>","g"),r=e.match(n);r&&(i=i.replace(n,r[0].replace(s.identifier,s.value)))}),i},reprocessMML(){this.$nextTick(()=>{window.MathJax&&window.MathJax.Hub.Queue(["Reprocess",window.MathJax.Hub,this.$refs.root])})}},mounted(){this.initializeTemplateMathVariables(),this.$parent.$emit("itemBodyReady",{itemBody:this})}},f1={ref:"root",class:"qti-item-body"};function p1(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",f1,[l.renderSlot(e.$slots,"default")],512)}const m1=B(d1,[["render",p1]]),g1={name:"ModalDialog",data(){return{visible:!0}},methods:{hide(){this.$refs.mymodal.classList.remove("fade","show"),document.querySelector("body").classList.remove("modal-open")},show(){this.$refs.mymodal.classList.add("fade","show"),document.querySelector("body").classList.add("modal-open")}}},y1={key:0,ref:"mymodal",class:"qti3-player-modal"},w1={class:"qti3-player-modal-dialog qti3-player-modal-md qti3-player-modal-dialog-centered"},b1={class:"qti3-player-modal-content"},v1={class:"qti3-player-modal-header"},E1={class:"qti3-player-modal-body"},T1={class:"qti3-player-modal-footer"};function C1(e,t,i,s,n,r){return l.openBlock(),l.createBlock(l.Transition,{name:"fade"},{default:l.withCtx(()=>[n.visible?(l.openBlock(),l.createElementBlock("div",y1,[l.createElementVNode("div",w1,[t[2]||(t[2]=l.createElementVNode("span",{tabindex:"0"},null,-1)),l.createElementVNode("div",b1,[l.createElementVNode("header",v1,[l.renderSlot(e.$slots,"header",{},void 0,!0),l.createElementVNode("button",{type:"button",class:"qti3-player-close","aria-label":"Close",onClick:t[0]||(t[0]=a=>r.hide())},"×")]),l.createElementVNode("div",E1,[l.renderSlot(e.$slots,"body",{},void 0,!0)]),l.createElementVNode("footer",T1,[l.renderSlot(e.$slots,"footer",{},void 0,!0)])]),t[3]||(t[3]=l.createElementVNode("span",{tabindex:"0"},null,-1))]),l.createElementVNode("div",{class:"qti3-player-modal-backdrop",onClick:t[1]||(t[1]=a=>r.hide())})],512)):l.createCommentVNode("",!0)]),_:3})}const S1=B(g1,[["render",C1],["__scopeId","data-v-2611a8eb"]]),Gr=new G,x1={name:"QtiModalFeedback",components:{ModalDialog:S1},props:{identifier:{type:String,required:!0},outcomeIdentifier:{type:String,required:!0},showHide:{type:String,required:!0},title:{type:String,required:!1}},computed:{modalTitle(){return typeof this.title>"u"?void 0:this.title}},data(){return{outcomeDeclaration:null,mathElementMap:new Map,isQtiValid:!0}},inheritAttrs:!0,methods:{initializeTemplateMathVariables(){const e=this.getTemplateMathVariables();if(e.length===0)return;this.getMathElements().forEach(function(i){this.archiveMathElement(i),i.innerHTML=this.applyTemplateValuesToMathml(i.innerHTML,e)},this)},updateTemplateMathVariables(){const e=this.getTemplateMathVariables();if(e.length===0)return;this.getMathScriptElements().forEach(function(i){for(let[s,n]of this.mathElementMap){const r=new RegExp('id="('+s+')"',"g");if(i.innerHTML.match(r)){i.innerHTML=this.applyTemplateValuesToMathml(n,e);break}}},this),this.reprocessMML()},getTemplateMathVariables(){return _.getTemplateMathParameterVariables()},getMathElements(){return this.$el.querySelectorAll("math")},getMathScriptElements(){return this.$el.querySelectorAll('script[type="math/mml"]')},archiveMathElement(e){e.hasAttribute("id")||(e.id=Gr.randomString(5,"a")),this.mathElementMap.set(e.id,e.outerHTML)},applyTemplateValuesToMathml(e,t){let i=e;return t.forEach(function(s){const n=new RegExp("<[mc]i[^>]*>("+s.identifier+")<\\/[mc]i>","g"),r=e.match(n);r&&(i=i.replace(n,r[0].replace(s.identifier,s.value)))}),i},reprocessMML(){this.$nextTick(()=>{window.MathJax&&window.MathJax.Hub.Queue(["Reprocess",window.MathJax.Hub,this.$refs.root])})},display(e){e?this.$refs.modal.show():this.$refs.modal.hide()},evaluate(){if(this.outcomeDeclaration=Gr.validateOutcomeIdentifierAttribute(_,this.outcomeIdentifier),this.outcomeDeclaration.cardinality==="single"){if(this.outcomeDeclaration.value===this.identifier){this.display(this.show);return}this.show||this.display(!0);return}if(this.outcomeDeclaration.cardinality==="multiple"){for(let e=0;e<this.outcomeDeclaration.value.length;e++)if(this.outcomeDeclaration.value[e]===this.identifier){this.display(this.show);return}this.show||this.display(!0)}}},created(){try{let e=Gr.validateOutcomeIdentifierAttribute(_,this.outcomeIdentifier);if(e.baseType!=="identifier")throw new c('Invalid outcome variable base-type: "'+e.baseType+'". Must be "identifier".');if(e.cardinality!=="single"&&e.cardinality!=="multiple")throw new c('Invalid outcome variable cardinality: "'+e.cardinality+'". Must be "single" or "multiple".');Gr.validateIdentifierAttribute(this.identifier),this.show=Gr.validateShowHideAttribute(this.showHide)}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.initializeTemplateMathVariables(),_.defineFeedback({outcomeIdentifier:this.outcomeIdentifier,identifier:this.identifier,feedbackType:"Modal",node:this}),console.log("[ModalFeedback]",this)}catch(e){throw this.isQtiValid=!1,new c(e.message)}}},_1={ref:"root",class:"qti-modal-feedback"};function I1(e,t,i,s,n,r){const a=l.resolveComponent("ModalDialog");return l.openBlock(),l.createElementBlock("div",_1,[l.createVNode(a,{ref:"modal"},{header:l.withCtx(()=>[l.createElementVNode("h5",null,l.toDisplayString(r.modalTitle),1)]),body:l.withCtx(()=>[l.renderSlot(e.$slots,"default")]),footer:l.withCtx(()=>[l.createElementVNode("button",{class:"qti-modal-feedback-ok",onClick:t[0]||(t[0]=o=>e.$refs.modal.hide())},"OK")]),_:3},512)],512)}const V1=B(x1,[["render",I1]]),A1={name:"QtiContentBody",data(){return{isQtiValid:!0}},mounted(){}},$1={ref:"root",class:"qti-content-body"};function L1(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",$1,[l.renderSlot(e.$slots,"default")],512)}const M1=B(A1,[["render",L1]]),Uo=new G,N1={name:"QtiTemplateInline",props:{identifier:{type:String,required:!0},templateIdentifier:{type:String,required:!0},showHide:{type:String,required:!1,default:"show"}},data(){return{value:null,templateDeclaration:null,show:!0,isQtiValid:!0}},methods:{evaluate(){try{if(this.hideTemplate(),this.templateDeclaration=Uo.validateTemplateIdentifierAttribute(_,this.templateIdentifier),console.log("[QtiTemplateInline]["+this.templateIdentifier+"][Show]",this.show),this.templateDeclaration.cardinality==="single"){if(this.templateDeclaration.value===this.identifier){this.show?this.showTemplate():this.hideTemplate();return}this.show||this.showTemplate();return}if(this.templateDeclaration.cardinality==="multiple"){for(let e=0;e<this.templateDeclaration.value.length;e++)if(this.templateDeclaration.value[e]===this.identifier){this.show?this.showTemplate():this.hideTemplate();return}this.show||this.hideTemplate();return}}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiEvaluationException"?new O(e.message):new Error(e.message)}},hideTemplate(){this.$refs.root.classList.add("hidden")},showTemplate(){this.$refs.root.classList.remove("hidden")}},created(){try{let e=Uo.validateTemplateIdentifierAttribute(_,this.templateIdentifier);if(e.baseType!=="identifier")throw new c('Invalid template variable base-type: "'+e.baseType+'". Must be "identifier".');if(e.cardinality!=="single"&&e.cardinality!=="multiple")throw new c('Invalid template variable cardinality: "'+e.cardinality+'". Must be "single" or "multiple".');Uo.validateIdentifierAttribute(this.identifier),this.show=Uo.validateShowHideAttribute(this.showHide)}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{_.defineTemplate({node:this}),this.evaluate()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiEvaluationException"?new O(e.message):new Error(e.message)}}},R1={ref:"root",class:"qti-template-inline hidden"};function k1(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",R1,[l.renderSlot(e.$slots,"default")],512)}const q1=B(N1,[["render",k1]]),Go=new G,O1={name:"QtiTemplateBlock",props:{identifier:{type:String,required:!0},templateIdentifier:{type:String,required:!0},showHide:{type:String,required:!1,default:"show"}},data(){return{value:null,templateDeclaration:null,show:!0,isQtiValid:!0}},methods:{evaluate(){try{if(this.hideTemplate(),this.templateDeclaration=Go.validateTemplateIdentifierAttribute(_,this.templateIdentifier),console.log("[QtiTemplateBlock]["+this.templateIdentifier+"][Show]",this.show),this.templateDeclaration.cardinality==="single"){if(this.templateDeclaration.value===this.identifier){this.show?this.showTemplate():this.hideTemplate();return}this.show||this.showTemplate();return}if(this.templateDeclaration.cardinality==="multiple"){for(let e=0;e<this.templateDeclaration.value.length;e++)if(this.templateDeclaration.value[e]===this.identifier){this.show?this.showTemplate():this.hideTemplate();return}this.show||this.showTemplate();return}}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiEvaluationException"?new O(e.message):new Error(e.message)}},hideTemplate(){this.$refs.root.classList.add("hidden")},showTemplate(){this.$refs.root.classList.remove("hidden")}},created(){try{let e=Go.validateTemplateIdentifierAttribute(_,this.templateIdentifier);if(e.baseType!=="identifier")throw new c('Invalid template variable base-type: "'+e.baseType+'". Must be "identifier".');if(e.cardinality!=="single"&&e.cardinality!=="multiple")throw new c('Invalid template variable cardinality: "'+e.cardinality+'". Must be "single" or "multiple".');Go.validateIdentifierAttribute(this.identifier),this.show=Go.validateShowHideAttribute(this.showHide)}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{_.defineTemplate({node:this}),this.evaluate()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiEvaluationException"?new O(e.message):new Error(e.message)}}},B1={ref:"root",class:"qti-template-block hidden"};function P1(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",B1,[l.renderSlot(e.$slots,"default")],512)}const D1=B(O1,[["render",P1]]),jo=new G,Q1={name:"QtiFeedbackInline",props:{identifier:{type:String,required:!0},outcomeIdentifier:{type:String,required:!0},showHide:{type:String,required:!0}},data(){return{show:null,outcomeDeclaration:null,isQtiValid:!0}},methods:{defaultShowHide(){this.show?this.$refs.root.classList.add("hidden"):this.$refs.root.classList.remove("hidden")},display(e){e?this.$refs.root.classList.remove("hidden"):this.$refs.root.classList.add("hidden")},isOutcomeValueNull(e){return e===null},evaluate(){if(this.defaultShowHide(),this.outcomeDeclaration=jo.validateOutcomeIdentifierAttribute(_,this.outcomeIdentifier),this.outcomeDeclaration.cardinality==="single"){if(this.isOutcomeValueNull(this.outcomeDeclaration.value))return;if(this.outcomeDeclaration.value===this.identifier){this.display(this.show);return}this.show||this.display(!0);return}if(this.outcomeDeclaration.cardinality==="multiple"){if(this.isOutcomeValueNull(this.outcomeDeclaration.value))return;for(let e=0;e<this.outcomeDeclaration.value.length;e++)if(this.outcomeDeclaration.value[e]===this.identifier){this.display(this.show);return}this.show||this.display(!0)}}},created(){try{let e=jo.validateOutcomeIdentifierAttribute(_,this.outcomeIdentifier);if(e.baseType!=="identifier")throw new c('Invalid outcome variable base-type: "'+e.baseType+'". Must be "identifier".');if(e.cardinality!=="single"&&e.cardinality!=="multiple")throw new c('Invalid outcome variable cardinality: "'+e.cardinality+'". Must be "single" or "multiple".');jo.validateIdentifierAttribute(this.identifier),this.show=jo.validateShowHideAttribute(this.showHide)}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.defaultShowHide(),_.defineFeedback({outcomeIdentifier:this.outcomeIdentifier,identifier:this.identifier,feedbackType:"Inline",show:this.show,node:this}),console.log("[FeedbackInline]",this)}catch(e){throw this.isQtiValid=!1,new c(e.message)}}},H1={ref:"root",class:"qti-feedback-inline hidden"};function F1(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",H1,[l.renderSlot(e.$slots,"default")],512)}const U1=B(Q1,[["render",F1]]),Wo=new G,G1={name:"QtiFeedbackBlock",props:{identifier:{type:String,required:!0},outcomeIdentifier:{type:String,required:!0},showHide:{type:String,required:!0}},data(){return{show:null,outcomeDeclaration:null,isQtiValid:!0}},methods:{defaultShowHide(){this.show?this.$refs.root.classList.add("hidden"):this.$refs.root.classList.remove("hidden")},display(e){e?this.$refs.root.classList.remove("hidden"):this.$refs.root.classList.add("hidden")},isOutcomeValueNull(e){return e===null},evaluate(){if(this.defaultShowHide(),this.outcomeDeclaration=Wo.validateOutcomeIdentifierAttribute(_,this.outcomeIdentifier),console.log("[FeedbackBlock]["+this.identifier+"][evaluate]",this.outcomeIdentifier,this.outcomeDeclaration.value),this.outcomeDeclaration.cardinality==="single"){if(this.isOutcomeValueNull(this.outcomeDeclaration.value))return;if(this.outcomeDeclaration.value===this.identifier){this.display(this.show);return}this.show||this.display(!0);return}if(this.outcomeDeclaration.cardinality==="multiple"){if(this.isOutcomeValueNull(this.outcomeDeclaration.value))return;for(let e=0;e<this.outcomeDeclaration.value.length;e++)if(this.outcomeDeclaration.value[e]===this.identifier){this.display(this.show);return}this.show||this.display(!0)}}},created(){try{let e=Wo.validateOutcomeIdentifierAttribute(_,this.outcomeIdentifier);if(e.baseType!=="identifier")throw new c('Invalid outcome variable base-type: "'+e.baseType+'". Must be "identifier".');if(e.cardinality!=="single"&&e.cardinality!=="multiple")throw new c('Invalid outcome variable cardinality: "'+e.cardinality+'". Must be "single" or "multiple".');Wo.validateIdentifierAttribute(this.identifier),this.show=Wo.validateShowHideAttribute(this.showHide)}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.defaultShowHide(),_.defineFeedback({outcomeIdentifier:this.outcomeIdentifier,identifier:this.identifier,feedbackType:"Block",show:this.show,node:this}),console.log("[FeedbackBlock]",this)}catch(e){throw this.isQtiValid=!1,new c(e.message)}}},j1={ref:"root",class:"qti-feedback-block hidden"};function W1(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",j1,[l.renderSlot(e.$slots,"default")],512)}const z1=B(G1,[["render",W1]]),K1=new G,Y1=new ie,X1={name:"QtiRubricBlock",props:{view:{type:String,required:!0},use:{type:String,required:!1}},data(){return{rubricBlockContext:null,isQtiValid:!0}},computed:{isScoringRubricBlock(){const e=this.view.split(" ");for(let t=0;t<e.length;t++)if(e[t]==="scorer")return!0;return!1}},methods:{getView(){return this.view},getUse(){return this.use},getInnerHtml(){return this.$refs.root.innerHTML},getStore(){return this.rubricBlockContext==="TEST"?it:_},validateChildren(){},evaluate(){if(!this.isScoringRubricBlock){this.$refs.root.classList.remove("hidden");return}this.$refs.root.innerHTML=""}},created(){try{this.rubricBlockContext=Y1.computeNodeContext(this),K1.validateRubricBlockViewAttribute(this.view),this.validateChildren()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.isScoringRubricBlock&&this.getStore().defineScoringRubricBlock({view:this.view,html:this.$refs.root.innerHTML,node:this}),this.evaluate(),console.log("["+this.$options.name+"]["+this.rubricBlockContext+"][View: "+this.view+"]")}catch(e){throw this.isQtiValid=!1,new c(e.message)}}},Z1={ref:"root",class:"qti-rubric-block hidden"};function J1(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",Z1,[l.renderSlot(e.$slots,"default")],512)}const ex=B(X1,[["render",J1]]);var Ts=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function em(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var tm={},zo={},im={},Ko={};Object.defineProperty(Ko,"__esModule",{value:!0}),Ko.boolean=void 0;const tx=function(e){switch(Object.prototype.toString.call(e)){case"[object String]":return["true","t","yes","y","on","1"].includes(e.trim().toLowerCase());case"[object Number]":return e.valueOf()===1;case"[object Boolean]":return e.valueOf();default:return!1}};Ko.boolean=tx;var Yo={};Object.defineProperty(Yo,"__esModule",{value:!0}),Yo.isBooleanable=void 0;const ix=function(e){switch(Object.prototype.toString.call(e)){case"[object String]":return["true","t","yes","y","on","1","false","f","no","n","off","0"].includes(e.trim().toLowerCase());case"[object Number]":return[0,1].includes(e.valueOf());case"[object Boolean]":return!0;default:return!1}};Yo.isBooleanable=ix,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.isBooleanable=e.boolean=void 0;const t=Ko;Object.defineProperty(e,"boolean",{enumerable:!0,get:function(){return t.boolean}});const i=Yo;Object.defineProperty(e,"isBooleanable",{enumerable:!0,get:function(){return i.isBooleanable}})}(im);var Xo={};Object.defineProperty(Xo,"__esModule",{value:!0}),Xo.tokenize=void 0;const sx=/(?:%(?<flag>([+0-]|-\+))?(?<width>\d+)?(?<position>\d+\$)?(?<precision>\.\d+)?(?<conversion>[%BCESb-iosux]))|(\\%)/g,nx=e=>{let t;const i=[];let s=0,n=0,r=null;for(;(t=sx.exec(e))!==null;){t.index>n&&(r={literal:e.slice(n,t.index),type:"literal"},i.push(r));const a=t[0];n=t.index+a.length,a==="\\%"||a==="%%"?r&&r.type==="literal"?r.literal+="%":(r={literal:"%",type:"literal"},i.push(r)):t.groups&&(r={conversion:t.groups.conversion,flag:t.groups.flag||null,placeholder:a,position:t.groups.position?Number.parseInt(t.groups.position,10)-1:s++,precision:t.groups.precision?Number.parseInt(t.groups.precision.slice(1),10):null,type:"placeholder",width:t.groups.width?Number.parseInt(t.groups.width,10):null},i.push(r))}return n<=e.length-1&&(r&&r.type==="literal"?r.literal+=e.slice(n):i.push({literal:e.slice(n),type:"literal"})),i};Xo.tokenize=nx,Object.defineProperty(zo,"__esModule",{value:!0}),zo.createPrintf=void 0;const sm=im,rx=Xo,ax=(e,t)=>t.placeholder,ox=e=>{var t;const i=(r,a,o)=>o==="-"?r.padEnd(a," "):o==="-+"?((Number(r)>=0?"+":"")+r).padEnd(a," "):o==="+"?((Number(r)>=0?"+":"")+r).padStart(a," "):o==="0"?r.padStart(a,"0"):r.padStart(a," "),s=(t=e==null?void 0:e.formatUnboundExpression)!==null&&t!==void 0?t:ax,n={};return(r,...a)=>{let o=n[r];o||(o=n[r]=rx.tokenize(r));let u="";for(const h of o)if(h.type==="literal")u+=h.literal;else{let f=a[h.position];if(f===void 0)u+=s(r,h,a);else if(h.conversion==="b")u+=sm.boolean(f)?"true":"false";else if(h.conversion==="B")u+=sm.boolean(f)?"TRUE":"FALSE";else if(h.conversion==="c")u+=f;else if(h.conversion==="C")u+=String(f).toUpperCase();else if(h.conversion==="i"||h.conversion==="d")f=String(Math.trunc(f)),h.width!==null&&(f=i(f,h.width,h.flag)),u+=f;else if(h.conversion==="e")u+=Number(f).toExponential();else if(h.conversion==="E")u+=Number(f).toExponential().toUpperCase();else if(h.conversion==="f")h.precision!==null&&(f=Number(f).toFixed(h.precision)),h.width!==null&&(f=i(String(f),h.width,h.flag)),u+=f;else if(h.conversion==="o")u+=(Number.parseInt(String(f),10)>>>0).toString(8);else if(h.conversion==="s")h.width!==null&&(f=i(String(f),h.width,h.flag)),u+=f;else if(h.conversion==="S")h.width!==null&&(f=i(String(f),h.width,h.flag)),u+=String(f).toUpperCase();else if(h.conversion==="u")u+=Number.parseInt(String(f),10)>>>0;else if(h.conversion==="x")f=(Number.parseInt(String(f),10)>>>0).toString(16),h.width!==null&&(f=i(String(f),h.width,h.flag)),u+=f;else throw new Error("Unknown format specifier.")}return u}};zo.createPrintf=ox,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.printf=e.createPrintf=void 0;const t=zo;Object.defineProperty(e,"createPrintf",{enumerable:!0,get:function(){return t.createPrintf}}),e.printf=t.createPrintf()}(tm);const nm=new G,lx={name:"QtiPrintedVariable",props:{id:{type:String,required:!1},language:{type:String,required:!1},label:{type:String,required:!1},baseuri:{type:String,required:!1},identifier:{type:String,required:!0},format:{type:String,required:!1},base:{type:String,required:!1},index:{type:String,required:!1},powerForm:{type:String,required:!1},field:{type:String,required:!1},delimiter:{type:String,required:!1},mappingIndicator:{type:String,required:!1}},data(){return{value:this.identifier,declaration:null,isQtiValid:!0}},methods:{printedValue(e){return typeof this.format>"u"?e:tm.printf(this.format,e)},evaluate(){try{this.declaration=nm.validatePrintedVariableIdentifierAttribute(_,this.identifier),this.value=this.printedValue(this.declaration.value),console.log("[QtiPrintedVariable]["+this.identifier+"][Value]",this.value)}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiEvaluationException"?new O(e.message):new Error(e.message)}}},created(){try{nm.validatePrintedVariableIdentifierAttribute(_,this.identifier)}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{_.definePrintedVariable({node:this}),this.evaluate()}catch(e){throw this.isQtiValid=!1,new c(e.message)}}};function cx(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",{ref:"root",class:"qti-printed-variable"},l.toDisplayString(n.value),513)}const ux=B(lx,[["render",cx]]);class hx{constructor(){this.constants={LABELS_UPPER_ALPHA:["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],LABELS_LOWER_ALPHA:["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],LABELS_DECIMAL:["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26"],LABELS_CJK_IDEOGRAPHIC:["一","二","三","四","五","六","七","八","九","十"],LABELS_SUFFIX_PERIOD:".",LABELS_SUFFIX_PARENTHESIS:")",LABELS_SUFFIX_NONE:"",LABELS_SUFFIX_CJK_IDEOGRAPHIC_COMMA:"、",QTI_LABELS_NONE:"qti-labels-none",QTI_LABELS_DECIMAL:"qti-labels-decimal",QTI_LABELS_LOWER_ALPHA:"qti-labels-lower-alpha",QTI_LABELS_UPPER_ALPHA:"qti-labels-upper-alpha",QTI_LABELS_CJK_IDEOGRAPHIC:"qti-labels-cjk-ideographic",QTI_LABELS_SUFFIX_NONE:"qti-labels-suffix-none",QTI_LABELS_SUFFIX_PERIOD:"qti-labels-suffix-period",QTI_LABELS_SUFFIX_PARENTHESIS:"qti-labels-suffix-parenthesis",QTI_LABELS_SUFFIX_CJK_IDEOGRAPHIC_COMMA:"qti-labels-cjk-ideographic-comma",QTI_ORIENTATION_VERTICAL:"qti-orientation-vertical",QTI_ORIENTATION_HORIZONTAL:"qti-orientation-horizontal",QTI_INPUT_CONTROL_HIDDEN:"qti-input-control-hidden",SBAC_PRESENTATION:"sbac",LRN_PRESENTATION:"lrn",QTI_CHOICES_STACKING_1:"qti-choices-stacking-1",QTI_CHOICES_STACKING_2:"qti-choices-stacking-2",QTI_CHOICES_STACKING_3:"qti-choices-stacking-3",QTI_CHOICES_STACKING_4:"qti-choices-stacking-4",QTI_CHOICES_STACKING_5:"qti-choices-stacking-5",DATA_MAX_SELECTIONS_MESSAGE:"data-max-selections-message",DATA_MIN_SELECTIONS_MESSAGE:"data-min-selections-message"},this.parentClassList=null,this.choiceGroupNode=null,this.choices=null,this.presentation_HideLabels=!1,this.presentation_Labels=this.constants.LABELS_UPPER_ALPHA,this.presentation_LabelsSuffix=this.constants.LABELS_SUFFIX_PERIOD,this.presentation_Sbac=!1,this.presentation_Lrn=!1,this.presentation_IsInputControlHidden=!1,this.presentation_IsOrientationVertical=!1,this.presentation_IsOrientationHorizontal=!1,this.presentation_MaxSelectionsMessage="",this.presentation_MinSelectionsMessage="",this.presentation_Label_Style="",this.presentation_Stacking_Class=""}initialize(t){this.choiceGroupNode=t,this.parentClassList=t.choiceInteractionClassAttribute,this.choices=t.choices,this.processRootClassAttribute(this.parentClassList),this.processStackingClass(),this.processLabelsAndInputControls()}processRootClassAttribute(t){const i=t.values();for(let s of i)switch(s){case this.constants.QTI_ORIENTATION_VERTICAL:this.presentation_IsOrientationVertical=!0,this.presentation_IsOrientationHorizontal=!1;break;case this.constants.QTI_ORIENTATION_HORIZONTAL:this.presentation_IsOrientationVertical=!1,this.presentation_IsOrientationHorizontal=!0;break;case this.constants.QTI_CHOICES_STACKING_1:this.presentation_Stacking_Class=this.constants.QTI_CHOICES_STACKING_1;break;case this.constants.QTI_CHOICES_STACKING_2:this.presentation_Stacking_Class=this.constants.QTI_CHOICES_STACKING_2;break;case this.constants.QTI_CHOICES_STACKING_3:this.presentation_Stacking_Class=this.constants.QTI_CHOICES_STACKING_3;break;case this.constants.QTI_CHOICES_STACKING_4:this.presentation_Stacking_Class=this.constants.QTI_CHOICES_STACKING_4;break;case this.constants.QTI_CHOICES_STACKING_5:this.presentation_Stacking_Class=this.constants.QTI_CHOICES_STACKING_5;break;case this.constants.QTI_LABELS_NONE:this.presentation_HideLabels=!0;break;case this.constants.QTI_LABELS_UPPER_ALPHA:this.presentation_Labels=this.constants.LABELS_UPPER_ALPHA;break;case this.constants.QTI_LABELS_LOWER_ALPHA:this.presentation_Labels=this.constants.LABELS_LOWER_ALPHA;break;case this.constants.QTI_LABELS_DECIMAL:this.presentation_Labels=this.constants.LABELS_DECIMAL;break;case this.constants.QTI_LABELS_CJK_IDEOGRAPHIC:this.presentation_Labels=this.constants.LABELS_CJK_IDEOGRAPHIC;break;case this.constants.QTI_LABELS_SUFFIX_NONE:this.presentation_LabelsSuffix=this.constants.LABELS_SUFFIX_NONE;break;case this.constants.QTI_LABELS_SUFFIX_PERIOD:this.presentation_LabelsSuffix=this.constants.LABELS_SUFFIX_PERIOD;break;case this.constants.QTI_LABELS_SUFFIX_PARENTHESIS:this.presentation_LabelsSuffix=this.constants.LABELS_SUFFIX_PARENTHESIS;break;case this.constants.QTI_LABELS_SUFFIX_CJK_IDEOGRAPHIC_COMMA:this.presentation_LabelsSuffix=this.constants.QTI_LABELS_SUFFIX_CJK_IDEOGRAPHIC_COMMA;break;case this.constants.QTI_INPUT_CONTROL_HIDDEN:this.presentation_IsInputControlHidden=!0;break;case this.constants.SBAC_PRESENTATION:this.presentation_Sbac=!0;break;case this.constants.LRN_PRESENTATION:this.presentation_Lrn=!0;break}}processStackingClass(){if(this.presentation_Stacking_Class!==""&&!this.presentation_IsOrientationVertical&&!this.presentation_IsOrientationHorizontal)this.choices.length>1?this.presentation_IsOrientationHorizontal=!0:this.presentation_IsOrientationVertical=!0;else if(this.presentation_Stacking_Class===""&&this.presentation_IsOrientationHorizontal){const t=this.choices.length;t>=5?this.presentation_Stacking_Class=this.constants.QTI_CHOICES_STACKING_5:t==4?this.presentation_Stacking_Class=this.constants.QTI_CHOICES_STACKING_4:t==3?this.presentation_Stacking_Class=this.constants.QTI_CHOICES_STACKING_3:t==2&&(this.presentation_Stacking_Class=this.constants.QTI_CHOICES_STACKING_2),t==1&&(this.presentation_IsOrientationVertical=!0,this.presentation_IsOrientationHorizontal=!1)}!this.presentation_IsOrientationVertical&&!this.presentation_IsOrientationHorizontal&&(this.presentation_IsOrientationVertical=!0),this.choiceGroupNode.$refs.choicegroup.classList.add(this.presentation_IsOrientationVertical?this.constants.QTI_ORIENTATION_VERTICAL:this.constants.QTI_ORIENTATION_HORIZONTAL),this.presentation_Stacking_Class!==""&&this.choiceGroupNode.$refs.choicegroup.classList.add(this.presentation_Stacking_Class)}processLabelsAndInputControls(){for(let t=0;t<this.choices.length;t++)this.presentation_HideLabels?this.choices[t].hideLabel():this.presentation_Sbac?this.choices[t].setLabelSbac(this.presentation_Labels[t]):this.choices[t].setLabel(this.presentation_Labels[t]+this.presentation_LabelsSuffix),this.presentation_Lrn&&this.choices[t].setChoiceLrn(),this.presentation_IsInputControlHidden&&this.choices[t].hideControl()}}const dx=new G,fx=new ie,px={props:{responseIdentifier:{required:!0,type:String},cardinality:{required:!0,type:String},shuffle:{required:!1,type:String,default:"false"},maxChoices:{required:!1,type:String,default:"1"}},data(){return{choices:[],firstChoice:null,lastChoice:null,role:null,isRadio:null,isShuffle:null,hasPrompt:!1,choiceInteractionClassAttribute:null,presentationFactory:null,isQtiValid:!0,priorState:null}},methods:{getPriorState(){return this.priorState},setPriorState(e){this.priorState=e},validateChildren(){let e=!1;this.$slots.default&&this.$slots.default()[0].children.forEach(t=>{if(dx.isValidSlot(t)){if(t.type.name==="QtiPrompt"){if(e)throw new c("Invalid element order. qti-prompt must come before qti-simple-choices");if(!this.hasPrompt)return this.hasPrompt=!0;throw new c("Maximum of 1 qti-prompt element permitted")}if(t.type.name==="QtiSimpleChoice")return e=!0;if(t.type.name!=="QtiSimpleChoice")throw new c('Node is not a qti-simple-choice: "'+t.type.name+'"')}})},processChildren(){this.$.subTree.children[0].children[0].children.forEach(t=>{t.component!==null&&t.type.name==="QtiSimpleChoice"&&this.choices.push(t.component.proxy)},this)},processGroupUI(){this.isShuffle&&this.processShuffle(),this.presentationFactory.initialize(this),this.setActiveDescendant(""),this.isRadio&&this.processFirstAndLastChoices()},resetGroupUI(){this.setPriorState(null),this.processGroupUI(),this.$emit("choiceGroupReady",{choices:this.choices,firstChoice:this.firstChoice,lastChoice:this.lastChoice})},processShuffle(){let e=this.createShuffleContainer(this.choices,this.getPriorState()),t=null;if(this.hasPrompt){const i=this.$refs.choicegroup.querySelector(".qti-prompt");i!==null&&(t=i.cloneNode(!0))}this.choices.splice(0,this.choices.length),this.$refs.choicegroup.innerHTML="",t!==null&&this.$refs.choicegroup.appendChild(t),e.forEach(i=>{this.$refs.choicegroup.appendChild(i.node.$el),this.choices.push(i.node)},this)},createShuffleContainer(e,t){let i=[];return t===null?(e.forEach(s=>{i.push({fixed:s.fixed==="true",node:s})}),fx.shuffleArrayFixed(i),i):(t.state.order.forEach(s=>{i.push({node:this.findChoiceByIdentifier(s,e)})},this),i)},findChoiceByIdentifier(e,t){for(let i=0;i<t.length;i++)if(t[i].$el.getAttribute("data-identifier")===e)return t[i];throw new O('Choice Interaction State Invalid. Choice identifier "'+e+'" not found.')},processFirstAndLastChoices(){this.choices.length!==0&&(this.firstChoice=this.choices[0],this.lastChoice=this.choices[this.choices.length-1])},setActiveDescendant(e){this.$refs.choicegroup.setAttribute("aria-activedescendant",e)},initializeChoiceGroup(){switch(this.cardinality){case"single":this.role="radiogroup",this.isRadio=!0;break;case"multiple":this.role="group",this.isRadio=!1;break;default:this.role="radiogroup",this.isRadio=!0;break}this.isShuffle=this.shuffle==="true",this.presentationFactory=new hx}},created(){try{if(typeof this.cardinality>"u")throw new c("Undefined qti-choice-interaction cardinality");this.initializeChoiceGroup(),this.validateChildren()}catch(e){throw this.isQtiValid=!1,console.log("[QtiChoiceInteraction][ValidationError]",e.name,e.message),new c(e.message)}},mounted(){if(this.isQtiValid)try{this.choiceInteractionClassAttribute=this.$parent.$refs.root.classList,this.processChildren(),this.setPriorState(this.$parent.priorState),this.processGroupUI(),this.$emit("choiceGroupReady",{choices:this.choices,firstChoice:this.firstChoice,lastChoice:this.lastChoice})}catch(e){if(this.isQtiValid=!1,e.name==="QtiValidationException")throw console.log("[QtiChoiceInteraction][ValidationException]",e.message),new c(e.message);if(e.name==="QtiEvaluationException")throw console.log("[QtiChoiceInteraction][EvaluationException]",e.message),new O(e.message)}}},mx=["role"];function gx(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("ul",{ref:"choicegroup",role:n.role,class:"qti-choice-list"},[l.renderSlot(e.$slots,"default")],8,mx)}const rm=B(px,[["render",gx]]),am=new G,yx={name:"QtiChoiceInteraction",components:[rm],props:{responseIdentifier:{required:!0,type:String},minChoices:{required:!1,type:String,default:"0"},maxChoices:{required:!1,type:String,default:"1"},shuffle:{required:!1,type:String,default:"false"},orientation:{required:!1,type:String},dataMaxSelectionsMessage:{required:!1,type:String},dataMinSelectionsMessage:{required:!1,type:String}},data(){return{response:null,state:null,isValidResponse:!1,cardinality:"single",minSelectionsMessage:"",maxSelectionsMessage:"",responseDeclaration:null,choices:[],firstChoice:null,lastChoice:null,currentChoice:null,isRadio:!0,isShuffle:!1,hasPrompts:!1,isDisabled:!1,isQtiValid:!0,priorState:null}},methods:{getResponse(){return this.response},setResponse(e){this.response=e},getState(){return this.state},setState(e){this.state=e},getIsValid(){return this.isValidResponse},setIsValid(e){this.isValidResponse=e},disable(){this.toggleDisableChoices(!0)},enable(){this.toggleDisableChoices(!1)},toggleDisableChoices(e){this.isDisabled=e,this.choices.forEach(t=>{t.setIsDisabled(e)})},getInvalidResponseMessage(){return this.minSelectionsMessage},resetValue(){console.log("[ResetValue][identifier]",this.responseIdentifier),this.choices.forEach(e=>{e.setChecked(!1),this.isRadio&&e.setTabIndex("-1")}),this.currentChoice=null,this.priorState=null,this.$refs.choicegroup.resetGroupUI()},restoreValue(e){e!==null&&(this.isRadio?this.handleSetChecked({identifier:e,checked:"true"},!0):e.forEach(t=>{this.handleSetChecked({identifier:t,checked:"true"},!0)},this),this.updateValidity(this.computeIsValid()))},getCardinality(){let e=_.getResponseDeclaration(this.responseIdentifier);return this.cardinality=typeof e<"u"?e.cardinality!=="multiple"?"single":"multiple":"single",this.cardinality},getPrompts(e){let t=[];return e.default&&e.default().forEach(i=>{typeof i.type<"u"&&i.type.name==="QtiPrompt"&&t.push(i)}),t},movePrompt(){if(!this.hasPrompts)return;const e=this.$refs.root.querySelector(".qti-prompt");e!==null&&this.$refs.prompt.appendChild(e)},handleSetChecked(e,t=!1){this.choices.forEach(i=>{this.isRadio&&(i.setChecked(!1),i.setTabIndex("-1")),i.identifier===e.identifier&&(this.currentChoice=i)}),e.checked==="true"?this.checkMaxChoicesLimit()?this.currentChoice.setChecked(!1):this.currentChoice.setChecked(!0):this.currentChoice.setChecked(!1),t||(this.setResponse(this.computeResponse()),this.currentChoice.setFocus(),this.evaluateValidity()),this.currentChoice.setTabIndex("0")},handleSetFocusPreviousChoice(e){this.isRadio&&this.removeChoiceFromTabOrder(e),this.setFocusChoice(this.findPreviousIdentifier(e))},handleSetFocusNextChoice(e){this.isRadio&&this.removeChoiceFromTabOrder(e),this.setFocusChoice(this.findNextIdentifier(e))},handleSetActiveDescendant(e){this.$refs.choicegroup.setActiveDescendant(e)},setFocusChoice(e){for(let t=0;t<this.choices.length;t++)this.choices[t].identifier===e&&(this.currentChoice=this.choices[t]);this.currentChoice.setTabIndex("0"),this.currentChoice.setFocus()},removeChoiceFromTabOrder(e){for(let t=0;t<this.choices.length;t++)if(this.choices[t].identifier===e){this.choices[t].setTabIndex(-1);break}},findPreviousIdentifier(e){if(e===this.firstChoice.identifier)return this.lastChoice.identifier;for(let t=0;t<this.choices.length;t++)if(this.choices[t].identifier===e)return this.choices[t-1].identifier;return null},findNextIdentifier(e){if(e===this.lastChoice.identifier)return this.firstChoice.identifier;for(let t=0;t<this.choices.length;t++)if(this.choices[t].identifier===e)return this.choices[t+1].identifier;return null},handleChoiceGroupReady(e){this.choices=e.choices,this.firstChoice=e.firstChoice,this.lastChoice=e.lastChoice,this.isRadio&&this.firstChoice.setTabIndex("0"),this.priorState!==null&&this.restoreValue(this.priorState.value),this.setResponse(this.computeResponse()),this.setState(this.computeState()),this.setIsValid(this.computeIsValid())},computeResponse(){let e=this.isRadio?null:[];return this.choices.forEach(t=>{t.isChecked()&&(this.isRadio?e=t.identifier:e.push(t.identifier))}),this.isRadio?e:e.length===0?null:e},computeState(){const e={};let t=[];return this.choices.forEach(i=>{t.push(i.identifier)}),e.order=t,e},computeIsValid(){return this.minChoices*1===0?!0:this.response===null?!1:this.cardinality==="single"||this.cardinality==="multiple"&&this.response.length>=this.minChoices*1},evaluateValidity(){const e=this.getIsValid(),t=this.computeIsValid();e!==t&&this.updateValidity(t)},updateValidity(e){this.setIsValid(e),_.setInteractionIsValidResponse({identifier:this.responseIdentifier,isValidResponse:e})},checkMaxChoicesLimit(){if(this.isRadio||this.maxChoices==0)return!1;const e=this.getResponse();return e!==null&&e.length==this.maxChoices?(_.NotifyInteractionSelectionsLimit(this.maxSelectionsMessage),!0):!1},computeMaxSelectionsMessage(){if(typeof this.dataMaxSelectionsMessage<"u"){this.maxSelectionsMessage=this.dataMaxSelectionsMessage;return}this.maxSelectionsMessage=this.maxChoices==0?"":"You are permitted a maximum of "+this.maxChoices+" choice"+(this.maxChoices>1?"s":"")+" for this question.<br/><br/>Please unselect one of your choices before making another choice."},computeMinSelectionsMessage(){if(typeof this.dataMinSelectionsMessage<"u"){this.minSelectionsMessage=this.dataMinSelectionsMessage;return}this.minSelectionsMessage=this.minChoices==0?"":"You must make at least "+this.minChoices+" choice"+(this.minChoices>1?"s":"")+" for this question."},getPriorState(e){const t=_.getItemContextStateVariable(e);if(t===null)return null;if(!("value"in t))throw new O('Choice Interaction State Invalid. "value" property not found.');if(!("state"in t))throw new O('Choice Interaction State Invalid. "state" property not found.');if(!("order"in t.state))throw new O('Choice Interaction State Invalid. "order" property not found.');return t},showSolution(e){if(e!==null){if(this.isRadio){this.choices.forEach(t=>{this.setChoiceSolution(t,e)},this);return}this.choices.forEach(t=>{const i=this.findIdentifierInCorrectResponse(t.identifier,e);this.setChoiceSolution(t,i)},this)}},setChoiceSolution(e,t){e.isChecked()?e.identifier===t?e.setCorrectSolution():e.setIncorrectSolution():e.identifier===t?e.setExpectedSolution():e.setIgnoreSolution()},findIdentifierInCorrectResponse(e,t){for(let i=0;i<t.length;i++)if(e===t[i])return e;return null}},created(){try{this.responseDeclaration=am.validateResponseIdentifierAttribute(_,this.responseIdentifier),this.priorState=this.getPriorState(this.responseIdentifier),am.validateMaxMinChoices(this.maxChoices,this.minChoices),this.cardinality=this.getCardinality(),this.isRadio=this.cardinality!=="multiple",this.isShuffle=this.shuffle==="true",this.hasPrompts=this.getPrompts(this.$slots).length>0,this.computeMinSelectionsMessage(),this.computeMaxSelectionsMessage()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.movePrompt(),_.defineInteraction({identifier:this.responseIdentifier,interactionType:"Choice",node:this,resetValue:this.resetValue,isValidResponse:this.getIsValid(),invalidResponseMessage:this.getInvalidResponseMessage(),maxSelectionsMessage:this.maxSelectionsMessage}),console.log("["+this.$options.name+"][Identifier]",this.responseIdentifier)}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}}},wx={ref:"root",class:"qti-choice-interaction"},bx={ref:"prompt",class:"qti-prompt-wrapper"};function vx(e,t,i,s,n,r){const a=l.resolveComponent("ChoiceGroup");return l.openBlock(),l.createElementBlock("div",wx,[l.createElementVNode("div",bx,null,512),l.createVNode(a,l.mergeProps({ref:"choicegroup",cardinality:n.cardinality,shuffle:i.shuffle,responseIdentifier:i.responseIdentifier,maxChoices:i.maxChoices,minChoices:i.minChoices,onChoiceGroupReady:r.handleChoiceGroupReady,onSetChecked:r.handleSetChecked,onSetFocusNextChoice:r.handleSetFocusNextChoice,onSetFocusPreviousChoice:r.handleSetFocusPreviousChoice,onSetActiveDescendant:r.handleSetActiveDescendant},e.$attrs),{default:l.withCtx(()=>[l.renderSlot(e.$slots,"default")]),_:3},16,["cardinality","shuffle","responseIdentifier","maxChoices","minChoices","onChoiceGroupReady","onSetChecked","onSetFocusNextChoice","onSetFocusPreviousChoice","onSetActiveDescendant"])],512)}const Ex=B(yx,[["render",vx]]);class Tx{constructor(t){return this.constants={QTI_ORIENTATION_HORIZONTAL:"qti-orientation-horizontal",QTI_ORIENTATION_VERTICAL:"qti-orientation-vertical",QTI_WRITING_ORIENTATION_VERTICAL_RL:"qti-writing-orientation-vertical-rl"},this.classList=t,this.presentation_OrientationClass=this.constants.QTI_ORIENTATION_HORIZONTAL,this.processClassAttribute(),this}processClassAttribute(){if(typeof this.classList>"u"||this.classList===null||this.classList.length==0)return;const t=this.classList.split(" ");for(let i=0;i<t.length;i++)switch(t[i]){case this.constants.QTI_ORIENTATION_VERTICAL:case this.constants.QTI_WRITING_ORIENTATION_VERTICAL_RL:this.presentation_OrientationClass=this.constants.QTI_ORIENTATION_VERTICAL;break;case this.constants.QTI_ORIENTATION_HORIZONTAL:this.presentation_OrientationClass=this.constants.QTI_ORIENTATION_HORIZONTAL;break}}getOrientationClass(){return this.presentation_OrientationClass}isOrientationVertical(){return this.presentation_OrientationClass==this.constants.QTI_ORIENTATION_VERTICAL}setVerticalOrientation(t){this.isOrientationVertical()&&t.classList.add(this.constants.QTI_ORIENTATION_VERTICAL)}}const lu=new G,Cx=new ie,Sx={name:"QtiInlineChoiceInteraction",props:{responseIdentifier:{required:!0,type:String},shuffle:{required:!1,type:String,default:"false"},required:{required:!1,type:String,default:"false"},dataPrompt:{required:!1,type:String,default:"Choose..."},minChoices:{required:!1,type:String,default:"0"},maxChoices:{required:!1,type:String,default:"1"},dataMinSelectionsMessage:{required:!1,type:String}},computed:{labelId(){return"inlinechoice_label_"+this.responseIdentifier},buttonId(){return"inlinechoice_button_"+this.responseIdentifier},buttonAriaLabelledbyId(){return"inlinechoice_label_"+this.responseIdentifier+" inlinechoice_button_"+this.responseIdentifier},listboxId(){return"inlinechoice_listbox_"+this.responseIdentifier},listboxAriaLabelledbyId(){return"inlinechoice_label_"+this.responseIdentifier}},data(){return{response:null,state:null,isValidResponse:!1,cardinality:"single",minSelectionsMessage:"",choices:[],allOptionElements:null,activeDescendant:null,keysSoFar:"",searchIndex:null,isShuffle:null,isRequired:!1,isDisabled:!1,isQtiValid:!0,presentationFactory:null,isOrientationVertical:!1,priorState:null}},methods:{getResponse(){return this.response},setResponse(e){this.response=e},getState(){return this.state},setState(e){this.state=e},getIsValid(){return this.isValidResponse},setIsValid(e){this.isValidResponse=e},getInvalidResponseMessage(){return this.minSelectionsMessage},disable(){this.toggleDisable(!0)},enable(){this.toggleDisable(!1)},toggleDisable(e){this.isDisabled=e,e?(this.getResponse()===null&&(this.$refs.label.innerHTML=""),this.$refs.label.classList.remove("qti-hidden"),this.$refs.label.setAttribute("tabIndex",0),this.$refs.button.classList.add("qti-hidden"),this.$refs.listbox.classList.add("inline-choice-select-listbox-hidden")):(this.$refs.label.classList.add("qti-hidden"),this.$refs.label.setAttribute("tabIndex",-1),this.$refs.button.classList.remove("qti-hidden"))},resetValue(){console.log("[ResetValue][identifier]",this.responseIdentifier),this.$refs.listbox.querySelectorAll('[role="option"]').forEach(t=>{this.defocusOption(t)},this),this.processGroupUI()},restoreValue(e){if(e===null)return;const t=this.findChoiceByIdentifier(e,this.choices);this.focusOption(t.$el,!0),this.setResponse(this.computeResponse(e)),this.updateValidity(this.computeIsValid())},getCardinality(){let e=_.getResponseDeclaration(this.responseIdentifier);if(typeof e>"u"&&(this.cardinality="single"),e.cardinality!=="single")throw new c('Invalid qti-inline-choice-interaction Response Variable cardinality: "'+this.cardinality+'"');return this.cardinality="single",this.cardinality},computeResponse(e){return e===null||e.length===0?null:e},computeState(){const e={};let t=[];return this.choices.forEach(i=>{t.push(i.identifier)}),e.order=t,e},computeIsValid(){return!this.isRequired&&this.minChoices*1===0?!0:this.response!==null},evaluateValidity(){const e=this.getIsValid(),t=this.computeIsValid();e!==t&&this.updateValidity(t)},updateValidity(e){this.setIsValid(e),_.setInteractionIsValidResponse({identifier:this.responseIdentifier,isValidResponse:e})},computeMinSelectionsMessage(){if(typeof this.dataMinSelectionsMessage<"u"){this.minSelectionsMessage=this.dataMinSelectionsMessage;return}!this.isRequired&&this.minChoices*1===0||(this.minSelectionsMessage="You must make at least 1 choice for this question.")},handleButtonClick(){this.isDisabled||this.showListbox()},handleButtonKeyup(e){switch(e.code){case"ArrowUp":case"ArrowDown":if(e.preventDefault(),this.isDisabled)return;this.showListbox();break}},handleChoiceMousedown(e){e.preventDefault();let t=e.target;t.getAttribute("role")==="option"&&(this.focusOption(t),this.hideListbox(),this.$refs.button.focus())},handleBlur(){this.hideListbox()},handleFocusChange(e){this.$refs.prompt.innerHTML=e.innerHTML,this.$refs.label.innerHTML=e.innerHTML},showListbox(){this.$refs.listbox.classList.remove("inline-choice-select-listbox-hidden"),this.$refs.button.setAttribute("aria-expanded","true"),this.$refs.listbox.focus()},hideListbox(){this.$refs.listbox.classList.add("inline-choice-select-listbox-hidden"),this.$refs.button.removeAttribute("aria-expanded")},setupFocus(){this.activeDescendant||this.focusFirstOption()},focusFirstOption(){let e=this.$refs.listbox.querySelector('[role="option"]');e&&this.focusOption(e)},focusLastOption(){let e=this.$refs.listbox.querySelectorAll('[role="option"]');e.length&&this.focusOption(e[e.length-1])},focusOption(e,t=!1){if(t||this.defocusOption(document.getElementById(this.activeDescendant)),e.setAttribute("aria-selected","true"),e.classList.add("focused"),this.setActiveDescendant(e.id),!t&&(this.setResponse(this.computeResponse(e.getAttribute("data-identifier"))),this.evaluateValidity(),this.$refs.listbox.scrollHeight>this.$refs.listbox.clientHeight)){const i=this.$refs.listbox.clientHeight+this.$refs.listbox.scrollTop,s=e.offsetTop+e.offsetHeight;s>i?this.$refs.listbox.scrollTop=s-this.$refs.listbox.clientHeight:e.offsetTop<this.$refs.listbox.scrollTop&&(this.$refs.listbox.scrollTop=e.offsetTop)}this.handleFocusChange(e)},defocusOption(e){e&&(e.removeAttribute("aria-selected"),e.classList.remove("focused"))},checkKeyPress(e){if(e.code=="Enter"||e.code=="Escape"){e.preventDefault(),this.hideListbox(),this.$refs.button.focus();return}let t=document.getElementById(this.activeDescendant);if(t)switch(e.code){case"ArrowUp":case"ArrowDown":e.preventDefault(),e.code=="ArrowUp"?t=t.previousElementSibling:t=t.nextElementSibling,t&&this.focusOption(t);break;case"Home":e.preventDefault(),this.focusFirstOption();break;case"End":e.preventDefault(),this.focusLastOption();break}},findOptionToFocus(e){let t=this.$refs.listbox.querySelectorAll('[role="option"]');if(!this.keysSoFar)for(let s=0;s<t.length;s++)t[s].getAttribute("id")==this.activeDescendant&&(this.searchIndex=s);this.keysSoFar+=e,this.clearKeysSoFarAfterDelay();let i=this.findMatchInRange(t,this.searchIndex+1,t.length);return i||(i=this.findMatchInRange(t,0,this.searchIndex)),i},clearKeysSoFarAfterDelay(){this.keyClear&&(clearTimeout(this.keyClear),this.keyClear=null);let e=this;this.keyClear=setTimeout((function(){e.keysSoFar="",e.keyClear=null}).bind(this),500)},findMatchInRange(e,t,i){for(let s=t;s<i;s++){let n=e[s].innerText;if(n&&n.toUpperCase().indexOf(this.keysSoFar)===0)return e[s]}return null},validateChildren(){this.$slots.default&&this.$slots.default().forEach(e=>{if(lu.isValidSlot(e)){if(e.type.name==="QtiInlineChoice")return;throw new c('Node is not a qti-inline-choice: "'+e.type.name+'"')}})},processChildren(){const e=this.$.subTree.children[0].children[2].children[0];this.choices.push(e.component.proxy),this.$.subTree.children[0].children[2].children[1].children.forEach(i=>{i.component!==null&&this.choices.push(i.component.proxy)})},processGroupUI(){this.isOrientationVertical&&this.presentationFactory.setVerticalOrientation(this.$refs.root),this.isShuffle&&this.processShuffle(),this.setResponse(null),this.setState(this.computeState()),this.setIsValid(this.computeIsValid()),this.setActiveDescendant("")},processShuffle(){let e=this.createShuffleContainer(this.choices,this.priorState);this.choices.splice(0,this.choices.length),this.$refs.listbox.innerHTML="",e.forEach(t=>{this.$refs.listbox.appendChild(t.node.$el),this.choices.push(t.node)},this)},createShuffleContainer(e,t){let i=[];return t===null?(e.forEach(s=>{i.push({fixed:s.fixed==="true",node:s})}),Cx.shuffleArrayFixed(i),i):(t.state.order.forEach(s=>{i.push({node:this.findChoiceByIdentifier(s,e)})},this),i)},findChoiceByIdentifier(e,t){for(let i=0;i<t.length;i++)if(t[i].$el.getAttribute("data-identifier")===e)return t[i];throw new O('Inline Choice Interaction State Invalid. Inline Choice identifier "'+e+'" not found.')},setActiveDescendant(e){this.activeDescendant=e,this.$refs.listbox.setAttribute("aria-activedescendant",e)},getPriorState(e){const t=_.getItemContextStateVariable(e);if(t===null)return null;if(!("value"in t))throw new O('Choice Interaction State Invalid. "value" property not found.');if(!("state"in t))throw new O('Choice Interaction State Invalid. "state" property not found.');if(!("order"in t.state))throw new O('Choice Interaction State Invalid. "order" property not found.');return t},addChoiceMousedownListeners(){this.allOptionElements=this.$refs.listbox.querySelectorAll('[role="option"]'),this.allOptionElements.forEach(e=>{e.addEventListener("mousedown",this.handleChoiceMousedown)})},removeChoiceMousedownListeners(){this.allOptionsElements!==null&&this.allOptionElements.forEach(e=>{e.removeEventListener("mousedown",this.handleChoiceMousedown)})}},created(){try{if(this.responseDeclaration=lu.validateResponseIdentifierAttribute(_,this.responseIdentifier),this.presentationFactory=new Tx(this.$.vnode.props.class),this.isOrientationVertical=this.presentationFactory.isOrientationVertical(),this.validateChildren(),this.priorState=this.getPriorState(this.responseIdentifier),lu.validateMaxMinChoices(this.maxChoices,this.minChoices),this.minChoices>1)throw new c('Invalid qti-inline-choice-interaction min-choices attribute: "'+this.minChoices+'"');this.cardinality=this.getCardinality(),this.isShuffle=this.shuffle==="true",this.isRequired=this.required==="true",this.computeMinSelectionsMessage()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.processChildren(),this.processGroupUI(),this.priorState!==null&&this.restoreValue(this.priorState.value),this.addChoiceMousedownListeners(),_.defineInteraction({identifier:this.responseIdentifier,interactionType:"InlineChoice",node:this,resetValue:this.resetValue,isValidResponse:this.isValidResponse,invalidResponseMessage:this.getInvalidResponseMessage(),maxSelectionsMessage:null}),console.log("["+this.$options.name+"][Identifier]",this.responseIdentifier)}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}},beforeUnmount(){this.removeChoiceMousedownListeners()}},xx={ref:"root",class:"qti-inline-choice-interaction"},_x={class:"inline-choice-wrapper"},Ix=["aria-labelledby","id"],Vx=["aria-labelledby"];function Ax(e,t,i,s,n,r){const a=l.resolveComponent("qti-inline-choice");return l.openBlock(),l.createElementBlock("div",xx,[l.createElementVNode("div",_x,[l.createElementVNode("div",{ref:"label",class:"inline-choice-select-label qti-hidden"},l.toDisplayString(i.dataPrompt),513),l.createElementVNode("button",{ref:"button","aria-haspopup":"listbox","aria-labelledby":r.buttonAriaLabelledbyId,id:r.buttonId,class:"inline-choice-select",onClick:t[0]||(t[0]=(...o)=>r.handleButtonClick&&r.handleButtonClick(...o)),onKeyup:t[1]||(t[1]=(...o)=>r.handleButtonKeyup&&r.handleButtonKeyup(...o))},[l.createElementVNode("div",{ref:"prompt",class:"inline-choice-select-prompt"},l.toDisplayString(i.dataPrompt),513)],40,Ix),l.createElementVNode("ul",{ref:"listbox",tabindex:"-1",role:"listbox","aria-labelledby":r.labelId,class:"inline-choice-select-listbox inline-choice-select-listbox-hidden",onBlur:t[2]||(t[2]=(...o)=>r.handleBlur&&r.handleBlur(...o)),onFocus:t[3]||(t[3]=(...o)=>r.setupFocus&&r.setupFocus(...o)),onKeydown:t[4]||(t[4]=(...o)=>r.checkKeyPress&&r.checkKeyPress(...o))},[l.createVNode(a,{identifier:"",fixed:"true"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(i.dataPrompt),1)]),_:1}),l.renderSlot(e.$slots,"default")],40,Vx)])],512)}const $x=B(Sx,[["render",Ax]]),Lx={name:"EndAttemptGeneric",props:{title:{required:!0,type:String}},data(){return{step:1,isBtnDisabled:!1}},methods:{getIsBtnDisabled(){return this.isBtnDisabled},setIsBtnDisabled(e){this.isBtnDisabled=e},handleEndAttempt(){this.$parent.$emit("endAttempt",{response:!0})},enable(){this.toggleButtonDisabled(!1)},disable(){this.toggleButtonDisabled(!0)},toggleButtonDisabled(e){e?this.$refs.root.setAttribute("disabled",""):this.$refs.root.removeAttribute("disabled"),this.setIsBtnDisabled(e)}},created(){},mounted(){this.$parent.$emit("endAttemptReady",{node:this})}};function Mx(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("button",{ref:"root",class:"qti-end-attempt-interaction",onClick:t[0]||(t[0]=l.withModifiers((...a)=>r.handleEndAttempt&&r.handleEndAttempt(...a),["prevent"])),type:"button"},l.toDisplayString(i.title),513)}const Nx=B(Lx,[["render",Mx]]),Rx={name:"EndAttemptControllerBar",props:{responseIdentifier:{required:!0,type:String},title:{required:!0,type:String},dataSteps:{required:!1,type:String},dataHastemplates:{required:!1,type:String},dataControllerType:{required:!1,type:String},dataHideprogress:{required:!1,type:String}},data(){return{step:1,isBtnDisabled:!1,response:!1}},computed:{progressMaximumSteps(){return typeof this.dataSteps>"u"?1:this.dataSteps*1},progressActiveWidth(){let e=this.progressMaximumSteps;return e=this.step>e?this.step:e,Math.floor(100*(this.step/e))},progressMessage(){return this.step===this.progressMaximumSteps?"All Parts Showing":"Step "+this.step+" of "+this.progressMaximumSteps},hasTemplates(){return typeof this.dataHastemplates<"u"?this.dataHastemplates==="true":!1},controllerType(){return typeof this.dataControllerType<"u"?this.dataControllerType:"generic"},progressClass(){return{"endattempt-progress-panel":!0,"progress-hidden":typeof this.dataHideprogress<"u"?this.dataHideprogress==="true":!1}}},methods:{getStep(){return this.step},setStep(e){this.step=e<this.progressMaximumSteps?e:this.progressMaximumSteps},incrementStep(){this.setStep(this.getStep()+1)},getIsBtnDisabled(){return this.isBtnDisabled},setIsBtnDisabled(e){this.isBtnDisabled=e},handleControllerNewTemplate(){this.resetControllerState(),_.NotifyNewTemplate({identifier:this.responseIdentifier,step:this.getStep(),maximumSteps:this.progressMaximumSteps})},handleControllerEndAttempt(){this.updateControllerState(),this.$parent.$emit("endAttempt",{response:this.response})},enable(){this.toggleButtonDisabled(!1)},disable(){this.toggleButtonDisabled(!0)},toggleButtonDisabled(e){e?this.$refs.endattempt.setAttribute("disabled",""):this.$refs.endattempt.removeAttribute("disabled"),this.setIsBtnDisabled(e)},resetControllerState(){this.setStep(1),this.enable(),this.$parent.$emit("notifyUpdateState",{})},updateControllerState(){switch(this.dataControllerType){case"showexample":case"solve":this.incrementStep(),this.getStep()<this.progressMaximumSteps?(this.response=!1,this.enable()):(this.response=!0,this.disable());break;case"generic":default:this.getStep()<this.progressMaximumSteps?(this.response=!1,this.incrementStep(),this.enable()):(this.response=!0,this.disable())}}},created(){},mounted(){this.$parent.$emit("endAttemptReady",{node:this})}},kx={class:"endattempt-controller"},qx={class:"endattempt-controller-progress"},Ox={id:"msgNotes"},Bx={class:"progress"},Px=["aria-valuenow"],Dx={class:"endattempt-controller-buttons"};function Qx(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",kx,[l.createElementVNode("div",qx,[l.createElementVNode("div",{class:l.normalizeClass(r.progressClass)},[l.createElementVNode("div",Ox,l.toDisplayString(r.progressMessage),1),l.createElementVNode("div",Bx,[l.createElementVNode("div",{class:"progress-bar",style:l.normalizeStyle({width:r.progressActiveWidth+"%"}),role:"progressbar","aria-valuenow":r.progressActiveWidth,"aria-valuemin":"0","aria-valuemax":"progressMaximumSteps"},null,12,Px)])],2)]),t[2]||(t[2]=l.createElementVNode("div",{class:"endattempt-controller-filler"},null,-1)),l.createElementVNode("div",Dx,[r.hasTemplates?(l.openBlock(),l.createElementBlock("button",{key:0,id:"btnNewTemplate",onClick:t[0]||(t[0]=l.withModifiers((...a)=>r.handleControllerNewTemplate&&r.handleControllerNewTemplate(...a),["prevent"])),type:"button",class:"endattempt-btn endattempt-btn-secondary"},"New Question")):l.createCommentVNode("",!0),l.createElementVNode("button",{ref:"endattempt",id:"btnEndAttempt",onClick:t[1]||(t[1]=l.withModifiers((...a)=>r.handleControllerEndAttempt&&r.handleControllerEndAttempt(...a),["prevent"])),type:"button",class:"endattempt-btn endattempt-btn-primary"},l.toDisplayString(i.title),513)])])}const Hx=B(Rx,[["render",Qx]]),Zo={DEFAULT:"",ENDATTEMPT_CONTROLLER_BAR:"endattempt-controller-bar"};function Fx(e,t){switch(e){case Zo.ENDATTEMPT_CONTROLLER_BAR:return{template:'<end-attempt-controller-bar response-identifier="'+t.responseIdentifier+'" title="'+t.title+'" data-steps="'+t.dataSteps+'" data-hastemplates="'+t.dataHastemplates+'" data-controller-type="'+t.dataControllerType+'" data-hideprogress="'+t.dataHideprogress+'" />',components:{EndAttemptControllerBar:Hx}};default:return{template:'<end-attempt-default response-identifier="'+t.responseIdentifier+'" title="'+t.title+'"/>',components:{EndAttemptDefault:Nx}}}}function Ux(e){if(typeof e>"u"||e===null||e.length==0)return Zo.DEFAULT;const t=e.split(" ");for(let i=0;i<t.length;i++)switch(t[i]){case Zo.ENDATTEMPT_CONTROLLER_BAR:return t[i]}return Zo.DEFAULT}const Gx=new G,jx={name:"QtiEndAttemptInteraction",props:{responseIdentifier:{required:!0,type:String},title:{required:!0,type:String},dataSteps:{required:!1,type:String},dataHastemplates:{required:!1,type:String},dataControllerType:{required:!1,type:String},dataHideprogress:{required:!1,type:String}},data(){return{response:!1,state:null,cardinality:"single",responseDeclaration:null,interactionSubType:"",isBtnDisabled:!1,isValidResponse:!0,invalidResponseMessage:"",isQtiValid:!0,node:null,priorState:null}},computed:{interactionTemplate(){return Fx(this.interactionSubType,this.createComponentProperties())}},methods:{getResponse(){return this.response},setResponse(e){this.response=e},getState(){return this.state},setState(e){this.state=e},updateState(){this.setState(this.computeState())},getIsValid(){return this.isValidResponse},setIsValid(e){this.isValidResponse=e},getInvalidResponseMessage(){return this.invalidResponseMessage},getCardinality(){return this.cardinality},getStep(){return this.interactionSubType==="endattempt-controller-bar"?this.node.getStep():1},setStep(e){this.interactionSubType==="endattempt-controller-bar"&&this.node.setStep(e)},initializeValue(){this.enableButton(),this.setStep(1),this.updateState(),this.setResponse(!1),this.setIsValid(!0)},resetValue(){console.log("[ResetValue][identifier]",this.responseIdentifier),this.initializeValue()},restoreValue(e){e.state.isBtnDisabled?this.disableButton():this.enableButton(),this.setStep(e.state.step),this.setState(this.computeState()),this.setResponse(this.computeResponse(e.value)),this.setIsValid(!0)},computeResponse(e){return e===null?!1:e},computeState(){return{step:this.getStep(),isBtnDisabled:this.getIsBtnDisabled(),interactionSubType:this.getInteractionSubType()}},disable(){this.disableButton(),this.updateState()},enable(){this.enableButton(),this.setResponse(!1),this.updateState()},getIsBtnDisabled(){return this.node.getIsBtnDisabled()},setIsBtnDisabled(e){this.node.setIsBtnDisabled(e)},setInteractionSubType(e){this.interactionSubType=e},getInteractionSubType(){return this.interactionSubType},handleEndAttempt(e){this.setResponse(e.response),this.updateState(),this.notifyEndAttempt()},handleUpdateState(){this.updateState()},enableButton(){this.node.enable()},disableButton(){this.node.disable()},detectInteractionSubType(e){return Ux(e)},createComponentProperties(){const e={responseIdentifier:this.responseIdentifier,title:this.title};return e.dataSteps=typeof this.dataSteps<"u"?this.dataSteps:"1",e.dataHastemplates=typeof this.dataHastemplates<"u"?this.dataHastemplates==="true":!1,e.dataHideprogress=typeof this.dataHideprogress<"u"?this.dataHideprogress==="true":!1,e.dataControllerType=typeof this.dataControllerType<"u"?this.dataControllerType:"generic",e},handleEndAttemptReady(e){this.node=e.node},notifyEndAttempt(){_.NotifyEndAttempt({identifier:this.responseIdentifier,step:this.getStep(),maximumSteps:typeof this.dataSteps<"u"?this.dataSteps*1:1,interactionSubType:this.getInteractionSubType()})},getPriorState(e){const t=_.getItemContextStateVariable(e);if(t===null)return null;if(!("value"in t))throw new O('End Attempt Interaction State Invalid. "value" property not found.');if(!("state"in t))throw new O('End Attempt Interaction State Invalid. "state" property not found.');if(!("step"in t.state))throw new O('End Attempt Interaction State Invalid. "step" property not found.');if(!("isBtnDisabled"in t.state))throw new O('End Attempt Interaction State Invalid. "isBtnDisabled" property not found.');return t}},created(){try{this.responseDeclaration=Gx.validateResponseIdentifierAttribute(_,this.responseIdentifier),this.setInteractionSubType(this.detectInteractionSubType(this.$attrs.class)),this.priorState=this.getPriorState(this.responseIdentifier)}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.priorState===null?this.initializeValue():this.restoreValue(this.priorState),_.defineInteraction({identifier:this.responseIdentifier,interactionType:"EndAttemptInteraction",interactionSubType:this.interactionSubType,node:this,resetValue:this.resetValue,disable:this.disable,enable:this.enable,isValidResponse:this.isValidResponse,invalidResponseMessage:this.getInvalidResponseMessage()}),console.log("["+this.$options.name+":"+this.interactionSubType+"][Identifier]",this.responseIdentifier)}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}}},Wx={ref:"root"};function zx(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",Wx,[(l.openBlock(),l.createBlock(l.resolveDynamicComponent(r.interactionTemplate),l.mergeProps({ref:"endattempt",onEndAttempt:r.handleEndAttempt,onUpdateState:r.handleUpdateState,onEndAttemptReady:r.handleEndAttemptReady},e.$attrs),null,16,["onEndAttempt","onUpdateState","onEndAttemptReady"]))],512)}const Kx=B(jx,[["render",zx]]);class Yx{constructor(t,i){return this.constants={QTI_COUNTER_NONE:"none",QTI_COUNTER_UP:"qti-counter-up",QTI_COUNTER_DOWN:"qti-counter-down",QTI_HEIGHT_LINES_3:"qti-height-lines-3",QTI_HEIGHT_LINES_6:"qti-height-lines-6",QTI_HEIGHT_LINES_15:"qti-height-lines-15",SBAC_HEIGHT_LINES_95:"sbac-height-lines-95",SBAC_PRESENTATION:"sbac"},this.classList=t,this.expectedLength=i,this.presentation_HeightClass=this.constants.QTI_HEIGHT_LINES_3,this.presentation_CounterStyle=this.constants.QTI_COUNTER_NONE,this.presentation_Sbac=!1,this.processClassAttribute(),this}processClassAttribute(){if(typeof this.classList>"u"||this.classList===null||this.classList.length==0)return;const t=this.classList.split(" ");for(let i=0;i<t.length;i++)switch(t[i]){case this.constants.SBAC_PRESENTATION:this.presentation_Sbac=!0;break;case this.constants.SBAC_HEIGHT_LINES_95:this.presentation_HeightClass=this.constants.SBAC_HEIGHT_LINES_95;break;case this.constants.QTI_COUNTER_UP:this.presentation_CounterStyle="up",this.expectedLength=this.processExpectedLength();break;case this.constants.QTI_COUNTER_DOWN:this.presentation_CounterStyle="down",this.expectedLength=this.processExpectedLength();break;case this.constants.QTI_HEIGHT_LINES_3:this.presentation_HeightClass=this.constants.QTI_HEIGHT_LINES_3;break;case this.constants.QTI_HEIGHT_LINES_6:this.presentation_HeightClass=this.constants.QTI_HEIGHT_LINES_6;break;case this.constants.QTI_HEIGHT_LINES_15:this.presentation_HeightClass=this.constants.QTI_HEIGHT_LINES_15;break}}processExpectedLength(){return typeof this.expectedLength>"u"||this.expectedLength===null||this.expectedLength.length==0||this.expectedLength==="0"?400:this.expectedLength*1}getCounterStyle(){return this.presentation_CounterStyle}getHeightClass(){return this.presentation_HeightClass}getExpectedLength(){return this.expectedLength}getIsSbac(){return this.presentation_Sbac}}var At="top",Jt="bottom",ei="right",$t="left",cu="auto",jr=[At,Jt,ei,$t],qn="start",Wr="end",Xx="clippingParents",om="viewport",zr="popper",Zx="reference",lm=jr.reduce(function(e,t){return e.concat([t+"-"+qn,t+"-"+Wr])},[]),cm=[].concat(jr,[cu]).reduce(function(e,t){return e.concat([t,t+"-"+qn,t+"-"+Wr])},[]),Jx="beforeRead",e_="read",t_="afterRead",i_="beforeMain",s_="main",n_="afterMain",r_="beforeWrite",a_="write",o_="afterWrite",l_=[Jx,e_,t_,i_,s_,n_,r_,a_,o_];function Ri(e){return e?(e.nodeName||"").toLowerCase():null}function Ht(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function Zs(e){var t=Ht(e).Element;return e instanceof t||e instanceof Element}function ti(e){var t=Ht(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function uu(e){if(typeof ShadowRoot>"u")return!1;var t=Ht(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function c_(e){var t=e.state;Object.keys(t.elements).forEach(function(i){var s=t.styles[i]||{},n=t.attributes[i]||{},r=t.elements[i];!ti(r)||!Ri(r)||(Object.assign(r.style,s),Object.keys(n).forEach(function(a){var o=n[a];o===!1?r.removeAttribute(a):r.setAttribute(a,o===!0?"":o)}))})}function u_(e){var t=e.state,i={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,i.popper),t.styles=i,t.elements.arrow&&Object.assign(t.elements.arrow.style,i.arrow),function(){Object.keys(t.elements).forEach(function(s){var n=t.elements[s],r=t.attributes[s]||{},a=Object.keys(t.styles.hasOwnProperty(s)?t.styles[s]:i[s]),o=a.reduce(function(u,h){return u[h]="",u},{});!ti(n)||!Ri(n)||(Object.assign(n.style,o),Object.keys(r).forEach(function(u){n.removeAttribute(u)}))})}}const um={name:"applyStyles",enabled:!0,phase:"write",fn:c_,effect:u_,requires:["computeStyles"]};function ki(e){return e.split("-")[0]}var Js=Math.max,Jo=Math.min,On=Math.round;function hu(){var e=navigator.userAgentData;return e!=null&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function hm(){return!/^((?!chrome|android).)*safari/i.test(hu())}function Bn(e,t,i){t===void 0&&(t=!1),i===void 0&&(i=!1);var s=e.getBoundingClientRect(),n=1,r=1;t&&ti(e)&&(n=e.offsetWidth>0&&On(s.width)/e.offsetWidth||1,r=e.offsetHeight>0&&On(s.height)/e.offsetHeight||1);var a=Zs(e)?Ht(e):window,o=a.visualViewport,u=!hm()&&i,h=(s.left+(u&&o?o.offsetLeft:0))/n,f=(s.top+(u&&o?o.offsetTop:0))/r,m=s.width/n,w=s.height/r;return{width:m,height:w,top:f,right:h+m,bottom:f+w,left:h,x:h,y:f}}function du(e){var t=Bn(e),i=e.offsetWidth,s=e.offsetHeight;return Math.abs(t.width-i)<=1&&(i=t.width),Math.abs(t.height-s)<=1&&(s=t.height),{x:e.offsetLeft,y:e.offsetTop,width:i,height:s}}function dm(e,t){var i=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(i&&uu(i)){var s=t;do{if(s&&e.isSameNode(s))return!0;s=s.parentNode||s.host}while(s)}return!1}function ts(e){return Ht(e).getComputedStyle(e)}function h_(e){return["table","td","th"].indexOf(Ri(e))>=0}function Cs(e){return((Zs(e)?e.ownerDocument:e.document)||window.document).documentElement}function el(e){return Ri(e)==="html"?e:e.assignedSlot||e.parentNode||(uu(e)?e.host:null)||Cs(e)}function fm(e){return!ti(e)||ts(e).position==="fixed"?null:e.offsetParent}function d_(e){var t=/firefox/i.test(hu()),i=/Trident/i.test(hu());if(i&&ti(e)){var s=ts(e);if(s.position==="fixed")return null}var n=el(e);for(uu(n)&&(n=n.host);ti(n)&&["html","body"].indexOf(Ri(n))<0;){var r=ts(n);if(r.transform!=="none"||r.perspective!=="none"||r.contain==="paint"||["transform","perspective"].indexOf(r.willChange)!==-1||t&&r.willChange==="filter"||t&&r.filter&&r.filter!=="none")return n;n=n.parentNode}return null}function Kr(e){for(var t=Ht(e),i=fm(e);i&&h_(i)&&ts(i).position==="static";)i=fm(i);return i&&(Ri(i)==="html"||Ri(i)==="body"&&ts(i).position==="static")?t:i||d_(e)||t}function fu(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function Yr(e,t,i){return Js(e,Jo(t,i))}function f_(e,t,i){var s=Yr(e,t,i);return s>i?i:s}function pm(){return{top:0,right:0,bottom:0,left:0}}function mm(e){return Object.assign({},pm(),e)}function gm(e,t){return t.reduce(function(i,s){return i[s]=e,i},{})}var p_=function(t,i){return t=typeof t=="function"?t(Object.assign({},i.rects,{placement:i.placement})):t,mm(typeof t!="number"?t:gm(t,jr))};function m_(e){var t,i=e.state,s=e.name,n=e.options,r=i.elements.arrow,a=i.modifiersData.popperOffsets,o=ki(i.placement),u=fu(o),h=[$t,ei].indexOf(o)>=0,f=h?"height":"width";if(!(!r||!a)){var m=p_(n.padding,i),w=du(r),y=u==="y"?At:$t,b=u==="y"?Jt:ei,S=i.rects.reference[f]+i.rects.reference[u]-a[u]-i.rects.popper[f],C=a[u]-i.rects.reference[u],L=Kr(r),x=L?u==="y"?L.clientHeight||0:L.clientWidth||0:0,D=S/2-C/2,E=m[y],U=x-w[f]-m[b],Q=x/2-w[f]/2+D,ee=Yr(E,Q,U),p=u;i.modifiersData[s]=(t={},t[p]=ee,t.centerOffset=ee-Q,t)}}function g_(e){var t=e.state,i=e.options,s=i.element,n=s===void 0?"[data-popper-arrow]":s;n!=null&&(typeof n=="string"&&(n=t.elements.popper.querySelector(n),!n)||dm(t.elements.popper,n)&&(t.elements.arrow=n))}const y_={name:"arrow",enabled:!0,phase:"main",fn:m_,effect:g_,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Pn(e){return e.split("-")[1]}var w_={top:"auto",right:"auto",bottom:"auto",left:"auto"};function b_(e,t){var i=e.x,s=e.y,n=t.devicePixelRatio||1;return{x:On(i*n)/n||0,y:On(s*n)/n||0}}function ym(e){var t,i=e.popper,s=e.popperRect,n=e.placement,r=e.variation,a=e.offsets,o=e.position,u=e.gpuAcceleration,h=e.adaptive,f=e.roundOffsets,m=e.isFixed,w=a.x,y=w===void 0?0:w,b=a.y,S=b===void 0?0:b,C=typeof f=="function"?f({x:y,y:S}):{x:y,y:S};y=C.x,S=C.y;var L=a.hasOwnProperty("x"),x=a.hasOwnProperty("y"),D=$t,E=At,U=window;if(h){var Q=Kr(i),ee="clientHeight",p="clientWidth";if(Q===Ht(i)&&(Q=Cs(i),ts(Q).position!=="static"&&o==="absolute"&&(ee="scrollHeight",p="scrollWidth")),Q=Q,n===At||(n===$t||n===ei)&&r===Wr){E=Jt;var v=m&&Q===U&&U.visualViewport?U.visualViewport.height:Q[ee];S-=v-s.height,S*=u?1:-1}if(n===$t||(n===At||n===Jt)&&r===Wr){D=ei;var T=m&&Q===U&&U.visualViewport?U.visualViewport.width:Q[p];y-=T-s.width,y*=u?1:-1}}var N=Object.assign({position:o},h&&w_),V=f===!0?b_({x:y,y:S},Ht(i)):{x:y,y:S};if(y=V.x,S=V.y,u){var $;return Object.assign({},N,($={},$[E]=x?"0":"",$[D]=L?"0":"",$.transform=(U.devicePixelRatio||1)<=1?"translate("+y+"px, "+S+"px)":"translate3d("+y+"px, "+S+"px, 0)",$))}return Object.assign({},N,(t={},t[E]=x?S+"px":"",t[D]=L?y+"px":"",t.transform="",t))}function v_(e){var t=e.state,i=e.options,s=i.gpuAcceleration,n=s===void 0?!0:s,r=i.adaptive,a=r===void 0?!0:r,o=i.roundOffsets,u=o===void 0?!0:o,h={placement:ki(t.placement),variation:Pn(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:n,isFixed:t.options.strategy==="fixed"};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,ym(Object.assign({},h,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:a,roundOffsets:u})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,ym(Object.assign({},h,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:u})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}const E_={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:v_,data:{}};var tl={passive:!0};function T_(e){var t=e.state,i=e.instance,s=e.options,n=s.scroll,r=n===void 0?!0:n,a=s.resize,o=a===void 0?!0:a,u=Ht(t.elements.popper),h=[].concat(t.scrollParents.reference,t.scrollParents.popper);return r&&h.forEach(function(f){f.addEventListener("scroll",i.update,tl)}),o&&u.addEventListener("resize",i.update,tl),function(){r&&h.forEach(function(f){f.removeEventListener("scroll",i.update,tl)}),o&&u.removeEventListener("resize",i.update,tl)}}const C_={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:T_,data:{}};var S_={left:"right",right:"left",bottom:"top",top:"bottom"};function il(e){return e.replace(/left|right|bottom|top/g,function(t){return S_[t]})}var x_={start:"end",end:"start"};function wm(e){return e.replace(/start|end/g,function(t){return x_[t]})}function pu(e){var t=Ht(e),i=t.pageXOffset,s=t.pageYOffset;return{scrollLeft:i,scrollTop:s}}function mu(e){return Bn(Cs(e)).left+pu(e).scrollLeft}function __(e,t){var i=Ht(e),s=Cs(e),n=i.visualViewport,r=s.clientWidth,a=s.clientHeight,o=0,u=0;if(n){r=n.width,a=n.height;var h=hm();(h||!h&&t==="fixed")&&(o=n.offsetLeft,u=n.offsetTop)}return{width:r,height:a,x:o+mu(e),y:u}}function I_(e){var t,i=Cs(e),s=pu(e),n=(t=e.ownerDocument)==null?void 0:t.body,r=Js(i.scrollWidth,i.clientWidth,n?n.scrollWidth:0,n?n.clientWidth:0),a=Js(i.scrollHeight,i.clientHeight,n?n.scrollHeight:0,n?n.clientHeight:0),o=-s.scrollLeft+mu(e),u=-s.scrollTop;return ts(n||i).direction==="rtl"&&(o+=Js(i.clientWidth,n?n.clientWidth:0)-r),{width:r,height:a,x:o,y:u}}function gu(e){var t=ts(e),i=t.overflow,s=t.overflowX,n=t.overflowY;return/auto|scroll|overlay|hidden/.test(i+n+s)}function bm(e){return["html","body","#document"].indexOf(Ri(e))>=0?e.ownerDocument.body:ti(e)&&gu(e)?e:bm(el(e))}function Xr(e,t){var i;t===void 0&&(t=[]);var s=bm(e),n=s===((i=e.ownerDocument)==null?void 0:i.body),r=Ht(s),a=n?[r].concat(r.visualViewport||[],gu(s)?s:[]):s,o=t.concat(a);return n?o:o.concat(Xr(el(a)))}function yu(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function V_(e,t){var i=Bn(e,!1,t==="fixed");return i.top=i.top+e.clientTop,i.left=i.left+e.clientLeft,i.bottom=i.top+e.clientHeight,i.right=i.left+e.clientWidth,i.width=e.clientWidth,i.height=e.clientHeight,i.x=i.left,i.y=i.top,i}function vm(e,t,i){return t===om?yu(__(e,i)):Zs(t)?V_(t,i):yu(I_(Cs(e)))}function A_(e){var t=Xr(el(e)),i=["absolute","fixed"].indexOf(ts(e).position)>=0,s=i&&ti(e)?Kr(e):e;return Zs(s)?t.filter(function(n){return Zs(n)&&dm(n,s)&&Ri(n)!=="body"}):[]}function $_(e,t,i,s){var n=t==="clippingParents"?A_(e):[].concat(t),r=[].concat(n,[i]),a=r[0],o=r.reduce(function(u,h){var f=vm(e,h,s);return u.top=Js(f.top,u.top),u.right=Jo(f.right,u.right),u.bottom=Jo(f.bottom,u.bottom),u.left=Js(f.left,u.left),u},vm(e,a,s));return o.width=o.right-o.left,o.height=o.bottom-o.top,o.x=o.left,o.y=o.top,o}function Em(e){var t=e.reference,i=e.element,s=e.placement,n=s?ki(s):null,r=s?Pn(s):null,a=t.x+t.width/2-i.width/2,o=t.y+t.height/2-i.height/2,u;switch(n){case At:u={x:a,y:t.y-i.height};break;case Jt:u={x:a,y:t.y+t.height};break;case ei:u={x:t.x+t.width,y:o};break;case $t:u={x:t.x-i.width,y:o};break;default:u={x:t.x,y:t.y}}var h=n?fu(n):null;if(h!=null){var f=h==="y"?"height":"width";switch(r){case qn:u[h]=u[h]-(t[f]/2-i[f]/2);break;case Wr:u[h]=u[h]+(t[f]/2-i[f]/2);break}}return u}function Zr(e,t){t===void 0&&(t={});var i=t,s=i.placement,n=s===void 0?e.placement:s,r=i.strategy,a=r===void 0?e.strategy:r,o=i.boundary,u=o===void 0?Xx:o,h=i.rootBoundary,f=h===void 0?om:h,m=i.elementContext,w=m===void 0?zr:m,y=i.altBoundary,b=y===void 0?!1:y,S=i.padding,C=S===void 0?0:S,L=mm(typeof C!="number"?C:gm(C,jr)),x=w===zr?Zx:zr,D=e.rects.popper,E=e.elements[b?x:w],U=$_(Zs(E)?E:E.contextElement||Cs(e.elements.popper),u,f,a),Q=Bn(e.elements.reference),ee=Em({reference:Q,element:D,strategy:"absolute",placement:n}),p=yu(Object.assign({},D,ee)),v=w===zr?p:Q,T={top:U.top-v.top+L.top,bottom:v.bottom-U.bottom+L.bottom,left:U.left-v.left+L.left,right:v.right-U.right+L.right},N=e.modifiersData.offset;if(w===zr&&N){var V=N[n];Object.keys(T).forEach(function($){var q=[ei,Jt].indexOf($)>=0?1:-1,A=[At,Jt].indexOf($)>=0?"y":"x";T[$]+=V[A]*q})}return T}function L_(e,t){t===void 0&&(t={});var i=t,s=i.placement,n=i.boundary,r=i.rootBoundary,a=i.padding,o=i.flipVariations,u=i.allowedAutoPlacements,h=u===void 0?cm:u,f=Pn(s),m=f?o?lm:lm.filter(function(b){return Pn(b)===f}):jr,w=m.filter(function(b){return h.indexOf(b)>=0});w.length===0&&(w=m);var y=w.reduce(function(b,S){return b[S]=Zr(e,{placement:S,boundary:n,rootBoundary:r,padding:a})[ki(S)],b},{});return Object.keys(y).sort(function(b,S){return y[b]-y[S]})}function M_(e){if(ki(e)===cu)return[];var t=il(e);return[wm(e),t,wm(t)]}function N_(e){var t=e.state,i=e.options,s=e.name;if(!t.modifiersData[s]._skip){for(var n=i.mainAxis,r=n===void 0?!0:n,a=i.altAxis,o=a===void 0?!0:a,u=i.fallbackPlacements,h=i.padding,f=i.boundary,m=i.rootBoundary,w=i.altBoundary,y=i.flipVariations,b=y===void 0?!0:y,S=i.allowedAutoPlacements,C=t.options.placement,L=ki(C),x=L===C,D=u||(x||!b?[il(C)]:M_(C)),E=[C].concat(D).reduce(function(Ee,P){return Ee.concat(ki(P)===cu?L_(t,{placement:P,boundary:f,rootBoundary:m,padding:h,flipVariations:b,allowedAutoPlacements:S}):P)},[]),U=t.rects.reference,Q=t.rects.popper,ee=new Map,p=!0,v=E[0],T=0;T<E.length;T++){var N=E[T],V=ki(N),$=Pn(N)===qn,q=[At,Jt].indexOf(V)>=0,A=q?"width":"height",M=Zr(t,{placement:N,boundary:f,rootBoundary:m,altBoundary:w,padding:h}),k=q?$?ei:$t:$?Jt:At;U[A]>Q[A]&&(k=il(k));var R=il(k),z=[];if(r&&z.push(M[V]<=0),o&&z.push(M[k]<=0,M[R]<=0),z.every(function(Ee){return Ee})){v=N,p=!1;break}ee.set(N,z)}if(p)for(var Z=b?3:1,ne=function(P){var K=E.find(function(Me){var qe=ee.get(Me);if(qe)return qe.slice(0,P).every(function(Et){return Et})});if(K)return v=K,"break"},de=Z;de>0;de--){var ge=ne(de);if(ge==="break")break}t.placement!==v&&(t.modifiersData[s]._skip=!0,t.placement=v,t.reset=!0)}}const R_={name:"flip",enabled:!0,phase:"main",fn:N_,requiresIfExists:["offset"],data:{_skip:!1}};function Tm(e,t,i){return i===void 0&&(i={x:0,y:0}),{top:e.top-t.height-i.y,right:e.right-t.width+i.x,bottom:e.bottom-t.height+i.y,left:e.left-t.width-i.x}}function Cm(e){return[At,ei,Jt,$t].some(function(t){return e[t]>=0})}function k_(e){var t=e.state,i=e.name,s=t.rects.reference,n=t.rects.popper,r=t.modifiersData.preventOverflow,a=Zr(t,{elementContext:"reference"}),o=Zr(t,{altBoundary:!0}),u=Tm(a,s),h=Tm(o,n,r),f=Cm(u),m=Cm(h);t.modifiersData[i]={referenceClippingOffsets:u,popperEscapeOffsets:h,isReferenceHidden:f,hasPopperEscaped:m},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":f,"data-popper-escaped":m})}const q_={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:k_};function O_(e,t,i){var s=ki(e),n=[$t,At].indexOf(s)>=0?-1:1,r=typeof i=="function"?i(Object.assign({},t,{placement:e})):i,a=r[0],o=r[1];return a=a||0,o=(o||0)*n,[$t,ei].indexOf(s)>=0?{x:o,y:a}:{x:a,y:o}}function B_(e){var t=e.state,i=e.options,s=e.name,n=i.offset,r=n===void 0?[0,0]:n,a=cm.reduce(function(f,m){return f[m]=O_(m,t.rects,r),f},{}),o=a[t.placement],u=o.x,h=o.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=u,t.modifiersData.popperOffsets.y+=h),t.modifiersData[s]=a}const P_={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:B_};function D_(e){var t=e.state,i=e.name;t.modifiersData[i]=Em({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})}const Q_={name:"popperOffsets",enabled:!0,phase:"read",fn:D_,data:{}};function H_(e){return e==="x"?"y":"x"}function F_(e){var t=e.state,i=e.options,s=e.name,n=i.mainAxis,r=n===void 0?!0:n,a=i.altAxis,o=a===void 0?!1:a,u=i.boundary,h=i.rootBoundary,f=i.altBoundary,m=i.padding,w=i.tether,y=w===void 0?!0:w,b=i.tetherOffset,S=b===void 0?0:b,C=Zr(t,{boundary:u,rootBoundary:h,padding:m,altBoundary:f}),L=ki(t.placement),x=Pn(t.placement),D=!x,E=fu(L),U=H_(E),Q=t.modifiersData.popperOffsets,ee=t.rects.reference,p=t.rects.popper,v=typeof S=="function"?S(Object.assign({},t.rects,{placement:t.placement})):S,T=typeof v=="number"?{mainAxis:v,altAxis:v}:Object.assign({mainAxis:0,altAxis:0},v),N=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,V={x:0,y:0};if(Q){if(r){var $,q=E==="y"?At:$t,A=E==="y"?Jt:ei,M=E==="y"?"height":"width",k=Q[E],R=k+C[q],z=k-C[A],Z=y?-p[M]/2:0,ne=x===qn?ee[M]:p[M],de=x===qn?-p[M]:-ee[M],ge=t.elements.arrow,Ee=y&&ge?du(ge):{width:0,height:0},P=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:pm(),K=P[q],Me=P[A],qe=Yr(0,ee[M],Ee[M]),Et=D?ee[M]/2-Z-qe-K-T.mainAxis:ne-qe-K-T.mainAxis,at=D?-ee[M]/2+Z+qe+Me+T.mainAxis:de+qe+Me+T.mainAxis,He=t.elements.arrow&&Kr(t.elements.arrow),ft=He?E==="y"?He.clientTop||0:He.clientLeft||0:0,Fe=($=N==null?void 0:N[E])!=null?$:0,Oe=k+Et-Fe-ft,_e=k+at-Fe,_i=Yr(y?Jo(R,Oe):R,k,y?Js(z,_e):z);Q[E]=_i,V[E]=_i-k}if(o){var ji,ks=E==="x"?At:$t,qs=E==="x"?Jt:ei,pt=Q[U],Rt=U==="y"?"height":"width",Wi=pt+C[ks],li=pt-C[qs],mt=[At,$t].indexOf(L)!==-1,Ii=(ji=N==null?void 0:N[U])!=null?ji:0,Os=mt?Wi:pt-ee[Rt]-p[Rt]-Ii+T.altAxis,ci=mt?pt+ee[Rt]+p[Rt]-Ii-T.altAxis:li,Vi=y&&mt?f_(Os,pt,ci):Yr(y?Os:Wi,pt,y?ci:li);Q[U]=Vi,V[U]=Vi-pt}t.modifiersData[s]=V}}const U_={name:"preventOverflow",enabled:!0,phase:"main",fn:F_,requiresIfExists:["offset"]};function G_(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function j_(e){return e===Ht(e)||!ti(e)?pu(e):G_(e)}function W_(e){var t=e.getBoundingClientRect(),i=On(t.width)/e.offsetWidth||1,s=On(t.height)/e.offsetHeight||1;return i!==1||s!==1}function z_(e,t,i){i===void 0&&(i=!1);var s=ti(t),n=ti(t)&&W_(t),r=Cs(t),a=Bn(e,n,i),o={scrollLeft:0,scrollTop:0},u={x:0,y:0};return(s||!s&&!i)&&((Ri(t)!=="body"||gu(r))&&(o=j_(t)),ti(t)?(u=Bn(t,!0),u.x+=t.clientLeft,u.y+=t.clientTop):r&&(u.x=mu(r))),{x:a.left+o.scrollLeft-u.x,y:a.top+o.scrollTop-u.y,width:a.width,height:a.height}}function K_(e){var t=new Map,i=new Set,s=[];e.forEach(function(r){t.set(r.name,r)});function n(r){i.add(r.name);var a=[].concat(r.requires||[],r.requiresIfExists||[]);a.forEach(function(o){if(!i.has(o)){var u=t.get(o);u&&n(u)}}),s.push(r)}return e.forEach(function(r){i.has(r.name)||n(r)}),s}function Y_(e){var t=K_(e);return l_.reduce(function(i,s){return i.concat(t.filter(function(n){return n.phase===s}))},[])}function X_(e){var t;return function(){return t||(t=new Promise(function(i){Promise.resolve().then(function(){t=void 0,i(e())})})),t}}function Z_(e){var t=e.reduce(function(i,s){var n=i[s.name];return i[s.name]=n?Object.assign({},n,s,{options:Object.assign({},n.options,s.options),data:Object.assign({},n.data,s.data)}):s,i},{});return Object.keys(t).map(function(i){return t[i]})}var Sm={placement:"bottom",modifiers:[],strategy:"absolute"};function xm(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return!t.some(function(s){return!(s&&typeof s.getBoundingClientRect=="function")})}function J_(e){e===void 0&&(e={});var t=e,i=t.defaultModifiers,s=i===void 0?[]:i,n=t.defaultOptions,r=n===void 0?Sm:n;return function(o,u,h){h===void 0&&(h=r);var f={placement:"bottom",orderedModifiers:[],options:Object.assign({},Sm,r),modifiersData:{},elements:{reference:o,popper:u},attributes:{},styles:{}},m=[],w=!1,y={state:f,setOptions:function(L){var x=typeof L=="function"?L(f.options):L;S(),f.options=Object.assign({},r,f.options,x),f.scrollParents={reference:Zs(o)?Xr(o):o.contextElement?Xr(o.contextElement):[],popper:Xr(u)};var D=Y_(Z_([].concat(s,f.options.modifiers)));return f.orderedModifiers=D.filter(function(E){return E.enabled}),b(),y.update()},forceUpdate:function(){if(!w){var L=f.elements,x=L.reference,D=L.popper;if(xm(x,D)){f.rects={reference:z_(x,Kr(D),f.options.strategy==="fixed"),popper:du(D)},f.reset=!1,f.placement=f.options.placement,f.orderedModifiers.forEach(function(T){return f.modifiersData[T.name]=Object.assign({},T.data)});for(var E=0;E<f.orderedModifiers.length;E++){if(f.reset===!0){f.reset=!1,E=-1;continue}var U=f.orderedModifiers[E],Q=U.fn,ee=U.options,p=ee===void 0?{}:ee,v=U.name;typeof Q=="function"&&(f=Q({state:f,options:p,name:v,instance:y})||f)}}}},update:X_(function(){return new Promise(function(C){y.forceUpdate(),C(f)})}),destroy:function(){S(),w=!0}};if(!xm(o,u))return y;y.setOptions(h).then(function(C){!w&&h.onFirstUpdate&&h.onFirstUpdate(C)});function b(){f.orderedModifiers.forEach(function(C){var L=C.name,x=C.options,D=x===void 0?{}:x,E=C.effect;if(typeof E=="function"){var U=E({state:f,name:L,instance:y,options:D}),Q=function(){};m.push(U||Q)}})}function S(){m.forEach(function(C){return C()}),m=[]}return y}}var eI=[C_,Q_,E_,um,P_,R_,U_,y_,q_],tI=J_({defaultModifiers:eI}),iI="tippy-box",_m="tippy-content",sI="tippy-backdrop",Im="tippy-arrow",Vm="tippy-svg-arrow",en={passive:!0,capture:!0},Am=function(){return document.body};function nI(e,t){return{}.hasOwnProperty.call(e,t)}function wu(e,t,i){if(Array.isArray(e)){var s=e[t];return s??(Array.isArray(i)?i[t]:i)}return e}function bu(e,t){var i={}.toString.call(e);return i.indexOf("[object")===0&&i.indexOf(t+"]")>-1}function $m(e,t){return typeof e=="function"?e.apply(void 0,t):e}function Lm(e,t){if(t===0)return e;var i;return function(s){clearTimeout(i),i=setTimeout(function(){e(s)},t)}}function rI(e,t){var i=Object.assign({},e);return t.forEach(function(s){delete i[s]}),i}function aI(e){return e.split(/\s+/).filter(Boolean)}function Dn(e){return[].concat(e)}function Mm(e,t){e.indexOf(t)===-1&&e.push(t)}function oI(e){return e.filter(function(t,i){return e.indexOf(t)===i})}function lI(e){return e.split("-")[0]}function sl(e){return[].slice.call(e)}function Nm(e){return Object.keys(e).reduce(function(t,i){return e[i]!==void 0&&(t[i]=e[i]),t},{})}function Jr(){return document.createElement("div")}function ea(e){return["Element","Fragment"].some(function(t){return bu(e,t)})}function cI(e){return bu(e,"NodeList")}function uI(e){return bu(e,"MouseEvent")}function hI(e){return!!(e&&e._tippy&&e._tippy.reference===e)}function dI(e){return ea(e)?[e]:cI(e)?sl(e):Array.isArray(e)?e:sl(document.querySelectorAll(e))}function vu(e,t){e.forEach(function(i){i&&(i.style.transitionDuration=t+"ms")})}function Rm(e,t){e.forEach(function(i){i&&i.setAttribute("data-state",t)})}function fI(e){var t,i=Dn(e),s=i[0];return s!=null&&(t=s.ownerDocument)!=null&&t.body?s.ownerDocument:document}function pI(e,t){var i=t.clientX,s=t.clientY;return e.every(function(n){var r=n.popperRect,a=n.popperState,o=n.props,u=o.interactiveBorder,h=lI(a.placement),f=a.modifiersData.offset;if(!f)return!0;var m=h==="bottom"?f.top.y:0,w=h==="top"?f.bottom.y:0,y=h==="right"?f.left.x:0,b=h==="left"?f.right.x:0,S=r.top-s+m>u,C=s-r.bottom-w>u,L=r.left-i+y>u,x=i-r.right-b>u;return S||C||L||x})}function Eu(e,t,i){var s=t+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(n){e[s](n,i)})}function km(e,t){for(var i=t;i;){var s;if(e.contains(i))return!0;i=i.getRootNode==null||(s=i.getRootNode())==null?void 0:s.host}return!1}var qi={isTouch:!1},qm=0;function mI(){qi.isTouch||(qi.isTouch=!0,window.performance&&document.addEventListener("mousemove",Om))}function Om(){var e=performance.now();e-qm<20&&(qi.isTouch=!1,document.removeEventListener("mousemove",Om)),qm=e}function gI(){var e=document.activeElement;if(hI(e)){var t=e._tippy;e.blur&&!t.state.isVisible&&e.blur()}}function yI(){document.addEventListener("touchstart",mI,en),window.addEventListener("blur",gI)}var wI=typeof window<"u"&&typeof document<"u",bI=wI?!!window.msCrypto:!1;function Qn(e){var t=e==="destroy"?"n already-":" ";return[e+"() was called on a"+t+"destroyed instance. This is a no-op but","indicates a potential memory leak."].join(" ")}function Bm(e){var t=/[ \t]{2,}/g,i=/^[ \t]*/gm;return e.replace(t," ").replace(i,"").trim()}function vI(e){return Bm(`
88
88
  %ctippy.js
89
89
 
90
90
  %c`+Bm(e)+`
@@ -164,7 +164,7 @@ ${El(this.code(t,i))}
164
164
  </svg>`,e.redo=`<svg viewbox="0 0 18 18">
165
165
  <polygon class="ql-fill ql-stroke" points="12 10 14 12 16 10 12 10"></polygon>
166
166
  <path class="ql-stroke" d="M9.91,13.91A4.6,4.6,0,0,1,9,14a5,5,0,1,1,5-5"></path>
167
- </svg>`;const t={theme:"snow",boundary:"div.qti-extended-text-interaction",modules:{toolbar:{container:[["undo","redo"],["bold","italic","underline"],["blockquote"],[{list:"ordered"},{list:"bullet"}]],handlers:{redo(){this.quill.history.redo()},undo(){this.quill.history.undo()}}},history:{delay:2e3,maxStack:100,userOnly:!1},keyboard:{bindings:{tab:{key:9,handler:function(){return!0}}}}},placeholder:this.placeholder,readOnly:!1};this.quill=new Y(this.$refs.editor,t),this.quill.root.setAttribute("spellcheck",!1),this.quill.on("text-change",this.textChangeHandler),this.updateCounter(this.getLength()),this.quill.enable(!0)}},setQuillEditorStyleProperties(){this.$refs.editor!=null&&this.$refs.editor.children!=null&&this.$refs.editor.children.length>0&&(this.$refs.editor.children[0].style=`width:${this.editorHeight};overflow-x:auto;`)},textChangeHandler(){let e=this.getText(),t=this.$refs.editor.children[0].innerHTML,i=this.getLength();if(this.expectedLength&&i>this.expectedLength){this.quill.deleteText(this.expectedLength,i);return}t==="<p><br></p>"&&(t=""),this.updateCounter(this.getLength()),this.$emit("input",{html:t,text:e})},updateCounter(e){if(this.showCounter){if(this.isCounterUp){this.counter=e;return}this.counter=this.computedExpectedLength-e}},getLength(){return this.quill.getLength()-1},getText(){return this.quill.getText()}},mounted(){this.initialize(),this.setQuillEditorStyleProperties(),this.$emit("editorReady",{node:this})},beforeUnmount(){this.$el&&this.quill.off("text-change",this.textChangeHandler),this.$el.remove(),this.quill=void 0}},qR={ref:"root",class:"quill-editor vertical-rl"},OR={key:0,"aria-hidden":"true",class:"ext-text-xhtml-vert-rl-counter"},BR={key:0};function PR(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",qR,[l.createElementVNode("div",{ref:"label",style:l.normalizeStyle(r.styleLabel),class:"ext-text-xhtml-vert-label qti-hidden"},null,4),l.createElementVNode("div",{ref:"editor",style:l.normalizeStyle(r.style)},null,4),r.showCounter?(l.openBlock(),l.createElementBlock("div",OR,[l.createTextVNode(l.toDisplayString(n.counter),1),r.isCounterUp?(l.openBlock(),l.createElementBlock("span",BR," / "+l.toDisplayString(i.expectedLength),1)):l.createCommentVNode("",!0)])):l.createCommentVNode("",!0)],512)}const DR={name:"ExtendedTextXhtmlVerticalRl",components:{EditorQuillVerticalRl:B(kR,[["render",PR]])},props:{responseIdentifier:{required:!0,type:String},expectedLength:{required:!1,type:String},placeholder:{required:!1,type:String,default:""},heightClass:{required:!1,type:String,default:""},counterStyle:{required:!1,type:String,default:"none"}},computed:{computedExpectedLength(){return typeof this.expectedLength<"u"?this.expectedLength:"400"},colorStyle(){return _.getItemContextPnp().getColorStyle()},editorHeight(){return this.heightClass==="qti-height-lines-15"?"25.9rem":this.heightClass==="qti-height-lines-6"?"11.5rem":"6.7rem"},labelHeight(){return this.heightClass==="qti-height-lines-15"?"29.7rem":this.heightClass==="qti-height-lines-6"?"12.3rem":"6.6rem"},maxLength(){return 1e4},disabled(){return this.isDisabled}},data(){return{response:"",content:"",state:null,editor:null,isDisabled:!1}},inheritAttrs:!1,methods:{getResponse(){return this.response},setResponse(e){if(e===null){this.response="",this.setContent("");return}this.setContent(e),this.response=e},updateResponse(e){this.response=e},getState(){return this.state},setState(e){this.state=e},getContent(){return this.content},setContent(e){this.content=e},computeState(e){return{text:e}},setIsDisabled(e){this.isDisabled=e},handleInput(e){e.html&&(this.updateResponse(e.html),this.setState(this.computeState(e.text)),this.$parent.$emit("extendedTextUpdate",{response:this.getResponse()}))},handleEditorReady(e){this.node=e.node,this.$parent.$emit("extendedTextReady",{node:this})}},mounted(){}},QR={ref:"root"};function HR(e,t,i,s,n,r){const a=l.resolveComponent("EditorQuillVerticalRl");return l.openBlock(),l.createElementBlock("div",QR,[l.createVNode(a,{content:n.content,placeholder:i.placeholder,editorHeight:r.editorHeight,labelHeight:r.labelHeight,counterStyle:i.counterStyle,expectedLength:r.computedExpectedLength,disabled:r.disabled,onInput:r.handleInput,onEditorReady:r.handleEditorReady},null,8,["content","placeholder","editorHeight","labelHeight","counterStyle","expectedLength","disabled","onInput","onEditorReady"])],512)}const FR=B(DR,[["render",HR]]),jt={DEFAULT:"default-plain",DEFAULT_SBAC:"sbac-plain",DEFAULT_LRN:"lrn-plain",DEFAULT_VERTICAL_RL:"vertical-rl-plain",XHTML_DEFAULT:"default-xhtml",XHTML_SBAC:"sbac-xhtml",XHTML_VERTICAL_RL:"vertical-rl-xhtml"};function UR(e,t,i){switch(e){case jt.XHTML_DEFAULT:case jt.XHTML_SBAC:return{template:'<extended-text-xhtml-default response-identifier="'+t.responseIdentifier+'" '+Ia(t)+Sa(t)+xa(t)+_a(t)+Va(t)+Aa(t)+$a(i)+" />",components:{ExtendedTextXhtmlDefault:RR}};case jt.DEFAULT_LRN:return{template:'<extended-text-plain-lrn response-identifier="'+t.responseIdentifier+'" '+Ia(t)+Sa(t)+xa(t)+_a(t)+Va(t)+Aa(t)+$a(i)+" />",components:{ExtendedTextPlainLrn:ZI}};case jt.DEFAULT_VERTICAL_RL:return{template:'<extended-text-plain-vertical-rl response-identifier="'+t.responseIdentifier+'" '+Ia(t)+Sa(t)+xa(t)+_a(t)+Va(t)+Aa(t)+$a(i)+" />",components:{ExtendedTextPlainVerticalRl:oV}};case jt.XHTML_VERTICAL_RL:return{template:'<extended-text-xhtml-vertical-rl response-identifier="'+t.responseIdentifier+'" '+Ia(t)+Sa(t)+xa(t)+_a(t)+Va(t)+Aa(t)+$a(i)+" />",components:{ExtendedTextXhtmlVerticalRl:FR}};default:return{template:'<extended-text-plain-default response-identifier="'+t.responseIdentifier+'" '+Ia(t)+Sa(t)+xa(t)+_a(t)+Va(t)+Aa(t)+$a(i)+" />",components:{ExtendedTextPlainDefault:QI}}}}function GR(e,t){const i=jR(e);if(i&&t==="plain")return jt.DEFAULT_SBAC;if(i&&t==="xhtml")return jt.XHTML_DEFAULT;if(WR(e)&&t==="plain")return jt.DEFAULT_LRN;const n=zR(e);return n&&t==="plain"?jt.DEFAULT_VERTICAL_RL:n&&t==="xhtml"?jt.XHTML_VERTICAL_RL:t==="plain"?jt.DEFAULT:t==="xhtml"?jt.XHTML_DEFAULT:jt.DEFAULT}function Sa(e){return typeof e.patternMask>"u"?"":'pattern-mask="'+e.patternMask+'" '}function xa(e){return'pattern-mask-message="'+e.patternMaskMessage+'" '}function _a(e){return'placeholder="'+e.placeholder+'" '}function Ia(e){return typeof e.expectedLength>"u"?"":'expected-length="'+e.expectedLength+'" '}function Va(e){return typeof e.heightClass>"u"?"":'height-class="'+e.heightClass+'" '}function Aa(e){return typeof e.counterStyle>"u"?"none":'counter-style="'+e.counterStyle+'" '}function $a(e){let t="";for(const[i,s]of Object.entries(e))t+=`${i}="${s}" `;return t}function jR(e){return typeof e>"u"||e===null||e.length==0?!1:kh("sbac",e)}function WR(e){return typeof e>"u"||e===null||e.length==0?!1:kh("lrn",e)}function zR(e){return typeof e>"u"||e===null||e.length==0?!1:kh("qti-writing-orientation-vertical-rl",e)}function kh(e,t){const i=t.split(" ");for(let s=0;s<i.length;s++)if(i[s]===e)return!0;return!1}const La=new G,KR=new ie,YR={name:"QtiExtendedTextInteraction",props:{responseIdentifier:{required:!0,type:String},expectedLength:{required:!1,type:String},patternMask:{required:!1,type:String},placeholderText:{required:!1,type:String},format:{required:!1,type:String,default:"plain"},dataPatternmaskMessage:{required:!1,type:String},minStrings:{required:!1,type:String,default:"0"},maxStrings:{required:!1,type:String,default:"0"}},computed:{interactionTemplate(){return UR(this.interactionSubType,this.createComponentProperties(),this.$attrs)},placeholder(){return La.validatePlaceholderText(this.placeholderText,"")},hasPatternMask(){return typeof this.patternMask<"u"},patternMaskMessage(){return La.validatePatternmaskMessage(this.dataPatternmaskMessage,"Invalid Input")}},data(){return{response:"",state:null,baseType:"string",cardinality:"single",interactionSubType:null,isValidResponse:!1,invalidResponseMessage:"Input Required",classAttribute:"",isDisabled:!1,isQtiValid:!0,hasPrompts:!1,presentationFactory:null,node:null,priorState:null}},methods:{getResponse(){return this.response.length===0?null:this.response},setResponse(e){e===null?this.response="":this.response=e,this.node.setResponse(this.response,!0)},updateResponse(e){e===null?this.response="":this.response=e},getState(){return this.state},setState(e){this.state=e,this.node.setState(this.state,!0)},updateState(e){this.state=e},getIsValid(){return this.isValidResponse},setIsValid(e){this.isValidResponse=e},setInteractionSubType(e){this.interactionSubType=e},getInteractionSubType(){return this.interactionSubType},disable(){this.toggleDisable(!0)},enable(){this.toggleDisable(!1)},toggleDisable(e){this.isDisabled=e,this.node.setIsDisabled(e)},getInvalidResponseMessage(){return this.invalidResponseMessage},initializeValue(){this.setResponse(null),this.setState(this.computeState()),this.setIsValid(this.computeIsValid())},resetValue(){console.log("[ResetValue][identifier]",this.responseIdentifier),this.setResponse(null),this.setState(this.computeState()),this.setIsValid(this.computeIsValid())},restoreValue(e){this.setResponse(e.value),this.setState(e.state),this.updateValidity(this.computeIsValid())},getCardinality(){return this.cardinality},computeState(){return{}},computeIsValid(){const e=this.minStrings*1;if(e===0)return!0;if(this.response===null)return!1;const t=this.response.trim();return!(t.length<1||KR.computeWordCount(t)<e)},evaluateValidity(){const e=this.getIsValid(),t=this.computeIsValid();e!==t&&this.updateValidity(t)},updateValidity(e){this.setIsValid(e),_.setInteractionIsValidResponse({identifier:this.responseIdentifier,isValidResponse:e})},getPrompts(e){let t=[];return e.default().forEach(i=>{typeof i.type<"u"&&i.type.name==="QtiPrompt"&&t.push(i)}),t},detectInteractionSubType(e,t){return GR(e,t)},createComponentProperties(){return{responseIdentifier:this.responseIdentifier,expectedLength:this.presentationFactory.getExpectedLength(),placeholder:this.placeholder,patternMask:this.patternMask,patternMaskMessage:this.patternMaskMessage,heightClass:this.presentationFactory.getHeightClass(),counterStyle:this.presentationFactory.getCounterStyle()}},handleExtendedTextUpdate(e){this.updateResponse(e.response),"state"in e&&this.updateState(e.state),this.evaluateValidity()},handleExtendedTextReady(e){this.node=e.node,this.priorState===null?this.initializeValue():this.restoreValue(this.priorState)},getPriorState(e){const t=_.getItemContextStateVariable(e);if(t===null)return null;if(!("value"in t))throw new O('Extended Text Interaction State Invalid. "value" property not found.');if(!("state"in t))throw new O('Extended Text Interaction State Invalid. "state" property not found.');return t}},created(){try{this.responseDeclaration=La.validateResponseIdentifierAttribute(_,this.responseIdentifier),this.setInteractionSubType(this.detectInteractionSubType(this.$.vnode.props.class,this.format)),this.presentationFactory=new Yx(this.$.vnode.props.class,this.expectedLength),La.validateMaxMinStrings(this.maxStrings,this.minStrings),this.priorState=this.getPriorState(this.responseIdentifier),this.cardinality=this.getCardinality(),this.hasPrompts=this.getPrompts(this.$slots).length>0,this.appliedRegex=La.validatePattern("pattern-mask",this.patternMask)}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{_.defineInteraction({identifier:this.responseIdentifier,interactionType:"ExtendedText",interactionSubType:this.interactionSubType,node:this,resetValue:this.resetValue,isValidResponse:this.isValidResponse,invalidResponseMessage:this.getInvalidResponseMessage()}),console.log("["+this.$options.name+"][Identifier]",this.responseIdentifier)}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}}},XR={ref:"root",class:"qti-extended-text-interaction"},ZR={ref:"prompt",class:"qti-prompt-wrapper"};function JR(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",XR,[l.createElementVNode("div",ZR,[l.renderSlot(e.$slots,"default")],512),(l.openBlock(),l.createBlock(l.resolveDynamicComponent(r.interactionTemplate),{ref:"textarea",onExtendedTextUpdate:r.handleExtendedTextUpdate,onExtendedTextReady:r.handleExtendedTextReady},null,40,["onExtendedTextUpdate","onExtendedTextReady"]))],512)}const ek=B(YR,[["render",JR]]);class tk{constructor(t){return this.constants={QTI_ORIENTATION_HORIZONTAL:"qti-orientation-horizontal",QTI_ORIENTATION_VERTICAL:"qti-orientation-vertical",QTI_INPUT_WIDTH_DEFAULT:"",QTI_INPUT_WIDTH_1:"qti-input-width-1",QTI_INPUT_WIDTH_2:"qti-input-width-2",QTI_INPUT_WIDTH_3:"qti-input-width-3",QTI_INPUT_WIDTH_4:"qti-input-width-4",QTI_INPUT_WIDTH_5:"qti-input-width-5",QTI_INPUT_WIDTH_6:"qti-input-width-6",QTI_INPUT_WIDTH_10:"qti-input-width-10",QTI_INPUT_WIDTH_15:"qti-input-width-15",QTI_INPUT_WIDTH_20:"qti-input-width-20",QTI_INPUT_WIDTH_25:"qti-input-width-25",QTI_INPUT_WIDTH_30:"qti-input-width-30",QTI_INPUT_WIDTH_35:"qti-input-width-35",QTI_INPUT_WIDTH_40:"qti-input-width-40",QTI_INPUT_WIDTH_45:"qti-input-width-45",QTI_INPUT_WIDTH_50:"qti-input-width-50",QTI_INPUT_WIDTH_72:"qti-input-width-72"},this.classList=t,this.presentation_OrientationClass=this.constants.QTI_ORIENTATION_HORIZONTAL,this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_DEFAULT,this.presentation_MaxLength=8,this.processClassAttribute(),this}processClassAttribute(){if(typeof this.classList>"u"||this.classList===null||this.classList.length==0)return;const t=this.classList.split(" ");for(let i=0;i<t.length;i++)switch(t[i]){case this.constants.QTI_ORIENTATION_VERTICAL:this.presentation_OrientationClass=this.constants.QTI_ORIENTATION_VERTICAL;break;case this.constants.QTI_ORIENTATION_HORIZONTAL:this.presentation_OrientationClass=this.constants.QTI_ORIENTATION_HORIZONTAL;break;case this.constants.QTI_INPUT_WIDTH_1:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_1,this.presentation_MaxLength=1;break;case this.constants.QTI_INPUT_WIDTH_2:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_2,this.presentation_MaxLength=2;break;case this.constants.QTI_INPUT_WIDTH_3:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_3,this.presentation_MaxLength=3;break;case this.constants.QTI_INPUT_WIDTH_4:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_4,this.presentation_MaxLength=4;break;case this.constants.QTI_INPUT_WIDTH_5:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_5,this.presentation_MaxLength=5;break;case this.constants.QTI_INPUT_WIDTH_6:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_6,this.presentation_MaxLength=6;break;case this.constants.QTI_INPUT_WIDTH_10:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_10,this.presentation_MaxLength=10;break;case this.constants.QTI_INPUT_WIDTH_15:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_15,this.presentation_MaxLength=15;break;case this.constants.QTI_INPUT_WIDTH_20:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_20,this.presentation_MaxLength=20;break;case this.constants.QTI_INPUT_WIDTH_25:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_25,this.presentation_MaxLength=25;break;case this.constants.QTI_INPUT_WIDTH_30:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_30,this.presentation_MaxLength=30;break;case this.constants.QTI_INPUT_WIDTH_35:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_35,this.presentation_MaxLength=35;break;case this.constants.QTI_INPUT_WIDTH_40:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_40,this.presentation_MaxLength=40;break;case this.constants.QTI_INPUT_WIDTH_45:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_45,this.presentation_MaxLength=45;break;case this.constants.QTI_INPUT_WIDTH_50:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_50,this.presentation_MaxLength=50;break;case this.constants.QTI_INPUT_WIDTH_72:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_72,this.presentation_MaxLength=500;break}}getOrientationClass(){return this.presentation_OrientationClass}isOrientationVertical(){return this.presentation_OrientationClass==this.constants.QTI_ORIENTATION_VERTICAL}getWidthClass(){return this.presentation_WidthClass}getVerticalMaxLength(){return this.presentation_MaxLength}}const ik=new G,sk={name:"TextEntryPlainDefault",emits:["textEntryReady","textEntryUpdate"],components:{Tooltip:sa},props:{responseIdentifier:{required:!0,type:String},expectedLength:{required:!1,type:String},placeholder:{required:!1,type:String,default:""},patternMask:{required:!1,type:String},patternMaskMessage:{required:!1,type:String,default:"Invalid Input"},spellcheck:{required:!1,type:String,default:"false"},maxlength:{required:!1,type:String,default:"500"}},computed:{computedExpectedLength(){return typeof this.expectedLength<"u"?this.expectedLength*1:400},hasPatternMask(){return typeof this.patternMask<"u"},colorStyle(){return _.getItemContextPnp().getColorStyle()},disabled(){return this.isDisabled}},data(){return{response:"",priorResponse:"",appliedRegex:null,displayMessage:!1,isDisabled:!1}},methods:{getResponse(){return this.response},setResponse(e){if(e===null){this.response="";return}this.response=e},getState(){return this.state},setState(e){this.state=e},setIsDisabled(e){if(this.isDisabled=e,e){const t=this.getResponse();this.$refs.label.innerHTML=t===null?"":t,this.$refs.label.classList.remove("qti-hidden"),this.$refs.label.setAttribute("tabIndex",0),this.$refs.input.classList.add("qti-hidden"),(t===null||t.length===0)&&(this.$refs.label.style.paddingRight="1.1rem")}else this.$refs.label.classList.add("qti-hidden"),this.$refs.label.setAttribute("tabIndex",-1),this.$refs.input.classList.remove("qti-hidden")},handleInput(e){e.preventDefault();let t=!0;this.appliedRegex!==null?t=this.applyPatternMask(this.$refs.input.value):this.setResponse(this.$refs.input.value),t&&(this.priorResponse=this.$refs.input.value,this.$parent.$emit("textEntryUpdate",{response:this.getResponse()}))},getLength(){return this.response.length},applyPatternMask(e){return this.appliedRegex.test(e)?(this.setResponse(e),this.priorResponse=e,!0):(this.showPatternMaskMessage(),this.setResponse(this.priorResponse),!1)},showPatternMaskMessage(){this.$refs.tooltip.show(),this.hidePatternMaskMessage()},hidePatternMaskMessage(e=3e3){setTimeout(()=>{this.$refs.tooltip.hide()},e)}},created(){this.appliedRegex=ik.validatePattern("pattern-mask",this.patternMask)},mounted(){this.$parent.$emit("textEntryReady",{node:this})}},nk={ref:"root"},rk={ref:"label",class:"text-entry-default-label qti-hidden"},ak=["placeholder","disabled","spellcheck","maxlength"];function ok(e,t,i,s,n,r){const a=l.resolveComponent("tooltip");return l.openBlock(),l.createElementBlock("span",nk,[l.createElementVNode("span",rk,null,512),l.withDirectives(l.createElementVNode("input",l.mergeProps({ref:"input",class:"text-entry-default"},e.$attrs,{"onUpdate:modelValue":t[0]||(t[0]=o=>n.response=o),type:"text",placeholder:i.placeholder,disabled:r.disabled,autocapitalize:"none",spellcheck:i.spellcheck,maxlength:i.maxlength,onInput:t[1]||(t[1]=(...o)=>r.handleInput&&r.handleInput(...o))}),null,16,ak),[[l.vModelText,n.response]]),r.hasPatternMask?(l.openBlock(),l.createBlock(a,{key:0,ref:"tooltip",target:()=>e.$refs.input,message:i.patternMaskMessage,"color-style":r.colorStyle},null,8,["target","message","color-style"])):l.createCommentVNode("",!0)],512)}const ow=B(sk,[["render",ok]]),lk=new G,ck={name:"TextEntryPlainDefaultVertical",emits:["textEntryReady","textEntryUpdate"],components:{Tooltip:sa},props:{responseIdentifier:{required:!0,type:String},expectedLength:{required:!1,type:String},placeholder:{required:!1,type:String,default:""},patternMask:{required:!1,type:String},patternMaskMessage:{required:!1,type:String,default:"Invalid Input"},spellcheck:{required:!1,type:String,default:"false"},widthClass:{required:!1,type:String,default:""},maxlength:{required:!1,type:String,default:"8"}},computed:{computedExpectedLength(){return typeof this.expectedLength<"u"?this.expectedLength*1:400},hasPatternMask(){return typeof this.patternMask<"u"},colorStyle(){return _.getItemContextPnp().getColorStyle()},disabled(){return this.isDisabled}},data(){return{response:"",priorResponse:"",appliedRegex:null,displayMessage:!1,caretIndex:0,maxlengthMessage:"",isDisabled:!1}},inheritAttrs:!1,methods:{getResponse(){return this.response},setResponse(e,t=!1){e===null?this.response="":this.response=e,t&&this.updateContent(this.response)},getState(){return this.state},setState(e){this.state=e},setIsDisabled(e){if(this.isDisabled=e,e){const t=this.getResponse();this.$refs.label.innerHTML=t===null?"":t,this.$refs.label.classList.remove("qti-hidden"),this.$refs.label.setAttribute("tabIndex",0),this.$refs.input.classList.add("qti-hidden"),this.hidePlaceholder()}else this.$refs.label.classList.add("qti-hidden"),this.$refs.label.setAttribute("tabIndex",-1),this.$refs.input.classList.remove("qti-hidden"),this.getContent().length===0?this.showPlaceholder():this.hidePlaceholder()},getContent(){return this.$refs.input.innerText},updateContent(e){this.$refs.input.innerText=e,e.length>0?this.hidePlaceholder():this.showPlaceholder()},getCaretIndex(){return this.caretIndex},setCaretIndex(e){this.caretIndex=e},handleInput(e){e.preventDefault();let t=!0;this.setCaretIndex(this.getCaretPos(this.$refs.input)-1);const i=this.getContent();i.length>0&&this.hidePlaceholder(),this.applyLimitCheck(i)&&(this.appliedRegex!==null?t=this.applyPatternMask(i):this.setResponse(i),t&&(i.length==0&&this.showPlaceholder(),this.priorResponse=i,this.$parent.$emit("textEntryUpdate",{response:this.getResponse()})))},handlePaste(e){e.preventDefault();const t=this.getRange();if(t===null)return;const i=this.getContent(),s=t.startOffset,n=t.endOffset;let r=e.clipboardData.getData("text/plain"),a=i.substring(0,s)+r+i.substring(n),o=!0;if(a.length>0&&this.hidePlaceholder(),a.length>this.maxlength){this.showMaxlengthMessage(),this.setResponse(this.priorResponse,!0),this.setCaretPos(this.$refs.input,s);return}this.appliedRegex!==null?o=this.applyPatternMask(a):this.setResponse(a,!0),o&&(this.setCaretIndex(s+r.length),this.setCaretPos(this.$refs.input,this.getCaretIndex()),this.priorResponse=a,this.$parent.$emit("textEntryUpdate",{response:this.getResponse()}))},handleDrop(e){e.preventDefault()},handleKeydown(e){switch(this.setCaretIndex(this.getCaretPos(this.$refs.input)),e.code){case"Enter":e.preventDefault();return;case"KeyI":case"KeyB":case"KeyU":e.ctrlKey&&e.preventDefault();return}},newDownRange(e){const t=e.firstChild,i=this.getRange();if(i===null)return;const s=i.startOffset,n=i.endOffset;if(n===this.getResponse().length)return;const r=window.getSelection();r.removeAllRanges();const a=document.createRange();a.setStart(t,s),a.setEnd(t,n+1),r.addRange(a)},newUpRange(e){const t=e.firstChild,i=this.getRange();if(i===null)return;const s=i.startOffset,n=i.endOffset;if(s===0)return;const r=window.getSelection();r.removeAllRanges();const a=document.createRange();a.setStart(t,s-1),a.setEnd(t,n),r.addRange(a)},getRange(){const e=document.getSelection();return e.rangeCount===0?null:e.getRangeAt(0)},getCaretPos(e){let t=0;if(typeof window.getSelection<"u"&&window.getSelection().rangeCount!==0){const n=window.getSelection().getRangeAt(0),r=n.cloneRange();r.selectNodeContents(e),r.setEnd(n.endContainer,n.endOffset),t=r.toString().length}return t},setCaretPos(e,t){e.focus(),e.childNodes.length===1&&document.getSelection().collapse(e.childNodes[0],t)},showPlaceholder(){this.$refs.placeholder.classList.remove("text-entry-ph-hidden")},hidePlaceholder(){this.$refs.placeholder.classList.add("text-entry-ph-hidden")},handleBlur(){this.$refs.root.classList.remove("focused")},handleFocus(){this.$refs.root.classList.add("focused")},getLength(){return this.response.length},applyLimitCheck(e){return e.length>this.maxlength?(this.showMaxlengthMessage(),this.setResponse(this.priorResponse,!0),this.setCaretPos(this.$refs.input,this.getCaretIndex()),!1):!0},applyPatternMask(e){return this.appliedRegex.test(e)?(this.setResponse(e),this.priorResponse=e,!0):(this.showPatternMaskMessage(),this.setResponse(this.priorResponse,!0),this.setCaretPos(this.$refs.input,this.getCaretIndex()),!1)},showPatternMaskMessage(){this.$refs.tooltip.show(),this.hidePatternMaskMessage()},hidePatternMaskMessage(e=3e3){setTimeout(()=>{this.$refs.tooltip.hide()},e)},showMaxlengthMessage(){this.$refs.tooltipMaxlength.show(),this.hideMaxlengthMessage()},hideMaxlengthMessage(e=1e3){setTimeout(()=>{this.$refs.tooltipMaxlength.hide()},e)},computeMaxlengthMessage(){this.maxlengthMessage=`Maximum of ${this.maxlength} character`+(this.maxlength==="1"?"":"s")}},created(){this.appliedRegex=lk.validatePattern("pattern-mask",this.patternMask),this.computeMaxlengthMessage()},mounted(){this.$parent.$emit("textEntryReady",{node:this})}},uk=["spellcheck","maxlength","disabled"];function hk(e,t,i,s,n,r){const a=l.resolveComponent("tooltip");return l.openBlock(),l.createElementBlock("div",l.mergeProps({ref:"root",class:"text-entry-default-vert-wrapper"},e.$attrs),[l.createElementVNode("div",{ref:"label",class:"text-entry-default-vert-label qti-hidden",onFocus:t[0]||(t[0]=(...o)=>r.handleFocus&&r.handleFocus(...o)),onBlur:t[1]||(t[1]=(...o)=>r.handleBlur&&r.handleBlur(...o))},null,544),l.createElementVNode("div",{ref:"input",class:"text-entry-default-vert",tabindex:"0",contenteditable:"true",autocapitalize:"false",spellcheck:i.spellcheck,maxlength:i.maxlength,disabled:r.disabled,onInput:t[2]||(t[2]=(...o)=>r.handleInput&&r.handleInput(...o)),onBlur:t[3]||(t[3]=(...o)=>r.handleBlur&&r.handleBlur(...o)),onFocus:t[4]||(t[4]=(...o)=>r.handleFocus&&r.handleFocus(...o)),onKeydown:t[5]||(t[5]=(...o)=>r.handleKeydown&&r.handleKeydown(...o)),onPaste:t[6]||(t[6]=(...o)=>r.handlePaste&&r.handlePaste(...o)),onDrop:t[7]||(t[7]=(...o)=>r.handleDrop&&r.handleDrop(...o))},null,40,uk),l.createElementVNode("label",{ref:"placeholder",class:"text-entry-default-vert-ph","aria-hidden":"true"},l.toDisplayString(i.placeholder),513),r.hasPatternMask?(l.openBlock(),l.createBlock(a,{key:0,ref:"tooltip",target:()=>e.$refs.input,message:i.patternMaskMessage,"color-style":r.colorStyle},null,8,["target","message","color-style"])):l.createCommentVNode("",!0),l.createVNode(a,{ref:"tooltipMaxlength",target:()=>e.$refs.input,message:n.maxlengthMessage,"color-style":r.colorStyle},null,8,["target","message","color-style"])],16)}const dk=B(ck,[["render",hk]]),Ll={DEFAULT:"default-plain-horizontal",DEFAULT_VERTICAL:"default-plain-vertical"};function fk(e,t,i){switch(e){case Ll.DEFAULT:return{template:'<text-entry-plain-default response-identifier="'+t.responseIdentifier+'" '+Ph(t)+qh(t)+Oh(t)+Bh(t)+Dh(t)+Qh(t)+lw(t)+Hh(i)+" />",components:{TextEntryPlainDefault:ow}};case Ll.DEFAULT_VERTICAL:return{template:'<text-entry-plain-default-vertical response-identifier="'+t.responseIdentifier+'" '+Ph(t)+qh(t)+Oh(t)+Bh(t)+Dh(t)+Qh(t)+mk(t)+gk(t)+Hh(i)+" />",components:{TextEntryPlainDefaultVertical:dk}};default:return{template:'<text-entry-plain-default response-identifier="'+t.responseIdentifier+'" '+Ph(t)+qh(t)+Oh(t)+Bh(t)+Dh(t)+Qh(t)+lw(t)+Hh(i)+" />",components:{TextEntryPlainDefault:ow}}}}function pk(e){return yk(e)?Ll.DEFAULT_VERTICAL:Ll.DEFAULT}function qh(e){return typeof e.patternMask>"u"?"":'pattern-mask="'+e.patternMask+'" '}function Oh(e){return'pattern-mask-message="'+e.patternMaskMessage+'" '}function Bh(e){return'placeholder="'+e.placeholder+'" '}function Ph(e){return typeof e.expectedLength>"u"?"":'expected-length="'+e.expectedLength+'" '}function Dh(e){return typeof e.format>"u"||e.format.length==0?"":'format="'+e.format+'" '}function Qh(e){return typeof e.spellcheck>"u"?"":'spellcheck="'+e.spellcheck+'" '}function lw(e){return typeof e.maxlength>"u"?"":'maxlength="'+e.maxlength+'" '}function mk(e){return typeof e.widthClass>"u"?"":'width-class="'+e.widthClass+'" '}function gk(e){return typeof e.verticalMaxlength>"u"?"":'maxlength="'+e.verticalMaxlength+'" '}function Hh(e){let t="";for(const[i,s]of Object.entries(e))t+=`${i}="${s}" `;return t}function yk(e){return typeof e>"u"||e===null||e.length==0?!1:cw("qti-writing-orientation-vertical-rl",e)?!0:cw("qti-orientation-vertical",e)}function cw(e,t){const i=t.split(" ");for(let s=0;s<i.length;s++)if(i[s]===e)return!0;return!1}const Ml=new G,wk={name:"QtiTextEntryInteraction",props:{responseIdentifier:{required:!0,type:String},expectedLength:{required:!1,type:String},patternMask:{required:!1,type:String},placeholderText:{required:!1,type:String},format:{required:!1,type:String,default:""},dataPatternmaskMessage:{required:!1,type:String},dataMaxlength:{required:!1,type:String},dataSpellcheck:{required:!1,type:String}},computed:{interactionTemplate(){return fk(this.interactionSubType,this.createComponentProperties(),this.$attrs)},placeholder(){return Ml.validatePlaceholderText(this.placeholderText,"")},hasPatternMask(){return typeof this.patternMask<"u"},patternMaskMessage(){return Ml.validatePatternmaskMessage(this.dataPatternmaskMessage,"Invalid Input")},colorStyle(){return _.getItemContextPnp().getColorStyle()},computeMaxlength(){return typeof this.dataMaxlength<"u"?this.dataMaxlength:500},computeSpellcheck(){return typeof this.dataSpellcheck<"u"?this.dataSpellcheck:!1}},data(){return{response:"",state:null,baseType:"string",cardinality:"single",interactionSubType:null,isValidResponse:!1,invalidResponseMessage:"Input Required",classAttribute:"",isDisabled:!1,isQtiValid:!0,presentationFactory:null,node:null,priorState:null}},methods:{getResponse(){return this.response.length===0?null:this.response},setResponse(e){e===null?this.response="":this.response=e,this.node.setResponse(this.response,!0)},updateResponse(e){e===null?this.response="":this.response=e},getState(){return this.state},setState(e){this.state=e},getIsValid(){return this.isValidResponse},setIsValid(e){this.isValidResponse=e},setInteractionSubType(e){this.interactionSubType=e},getInteractionSubType(){return this.interactionSubType},disable(){this.toggleDisable(!0)},enable(){this.toggleDisable(!1)},toggleDisable(e){this.isDisabled=e,this.node.setIsDisabled(e)},getInvalidResponseMessage(){return this.invalidResponseMessage},initializeValue(){this.setResponse(null),this.setState(this.computeState()),this.setIsValid(!1)},resetValue(){console.log("[ResetValue][identifier]",this.responseIdentifier),this.setResponse(null),this.setState(this.computeState()),this.setIsValid(!1)},restoreValue(e){this.setResponse(e.value),this.setState(e.state),this.updateValidity(this.computeIsValid())},getCardinality(){return this.cardinality},computeState(){return{}},computeIsValid(){return!(this.response===null||this.response.length<1)},evaluateValidity(){const e=this.getIsValid(),t=this.computeIsValid();e!==t&&this.updateValidity(t)},updateValidity(e){this.setIsValid(e),_.setInteractionIsValidResponse({identifier:this.responseIdentifier,isValidResponse:e})},detectInteractionSubType(e){return pk(e)},createComponentProperties(){return{responseIdentifier:this.responseIdentifier,placeholder:this.placeholder,patternMask:this.patternMask,patternMaskMessage:this.patternMaskMessage,spellcheck:this.computeSpellcheck,maxlength:this.computeMaxlength,widthClass:this.presentationFactory.getWidthClass(),verticalMaxlength:this.presentationFactory.getVerticalMaxLength(),format:this.format}},handleTextEntryUpdate(e){this.updateResponse(e.response),this.evaluateValidity()},handleTextEntryReady(e){this.node=e.node,this.priorState===null?this.initializeValue():this.restoreValue(this.priorState)},getPriorState(e){const t=_.getItemContextStateVariable(e);if(t===null)return null;if(!("value"in t))throw new O('Text Entry Interaction State Invalid. "value" property not found.');if(!("state"in t))throw new O('Text Entry Interaction State Invalid. "state" property not found.');return t}},created(){try{this.responseDeclaration=Ml.validateResponseIdentifierAttribute(_,this.responseIdentifier),this.setInteractionSubType(this.detectInteractionSubType(this.$.vnode.props.class)),this.presentationFactory=new tk(this.$.vnode.props.class),this.priorState=this.getPriorState(this.responseIdentifier),this.cardinality=this.getCardinality(),this.appliedRegex=Ml.validatePattern("pattern-mask",this.patternMask)}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.priorState===null?this.initializeValue():this.restoreValue(this.priorState),_.defineInteraction({identifier:this.responseIdentifier,interactionType:"TextEntry",node:this,resetValue:this.resetValue,isValidResponse:this.isValidResponse,invalidResponseMessage:this.getInvalidResponseMessage()}),console.log("["+this.$options.name+"][Identifier]",this.responseIdentifier)}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}}};function bk(e,t,i,s,n,r){return l.openBlock(),l.createBlock(l.resolveDynamicComponent(r.interactionTemplate),{ref:"input",class:"qti-text-entry-interaction",onTextEntryUpdate:r.handleTextEntryUpdate,onTextEntryReady:r.handleTextEntryReady},null,40,["onTextEntryUpdate","onTextEntryReady"])}const vk=B(wk,[["render",bk]]),Ek=new G,Tk={name:"QtiMatchInteraction",props:{responseIdentifier:{required:!0,type:String},minAssociations:{required:!1,type:String,default:"0"},maxAssociations:{required:!1,type:String,default:"1"},shuffle:{required:!1,type:String,default:"false"},dataMaxSelectionsMessage:{required:!1,type:String},dataMinSelectionsMessage:{required:!1,type:String},dataFirstColumnHeader:{required:!1,type:String,default:null}},data(){return{response:null,state:null,isValidResponse:!1,matchsets:[],orders:[],cardinality:"single",minSelectionsMessage:"",maxSelectionsMessage:"",responseDeclaration:null,hasPrompts:!1,matchInteractionStaticClass:"",interactionSubType:"default",headerHidden:"false",rowCentric:"false",isQtiValid:!0,priorState:null}},methods:{getResponse(){return this.response},setResponse(e){this.response=e},getState(){return this.state},setState(e){this.state=e},setInteractionSubType(e){this.interactionSubType=e},getInteractionSubType(){return this.interactionSubType},getIsValid(){return this.isValidResponse},setIsValid(e){this.isValidResponse=e},getInvalidResponseMessage(){return this.minSelectionsMessage},disable(){this.$refs.matchgroup.disable()},enable(){this.$refs.matchgroup.enable()},initializeValue(e){this.setResponse(e),this.setState(this.computeState()),this.updateValidity(this.computeIsValid())},resetValue(){console.log("[ResetValue][identifier]",this.responseIdentifier),this.setResponse(null),this.setState(null),this.priorState=null,this.$refs.matchgroup.resetGroupUI()},restoreValue(e){this.setResponse(e),this.setState(this.computeState()),this.updateValidity(this.computeIsValid())},getCardinality(){let e=_.getResponseDeclaration(this.responseIdentifier);return this.cardinality=typeof e<"u"?e.cardinality:"single",this.cardinality},getPrompts(e){let t=[];return e.default().forEach(i=>{typeof i.type<"u"&&i.type.name==="QtiPrompt"&&t.push(i)}),t},movePrompt(){if(!this.hasPrompts)return;const e=this.$refs.root.querySelector(".qti-prompt");e!==null&&this.$refs.prompt.appendChild(e)},handleMatchGroupReady(e){this.matchsets=e.matchsets,this.orders=e.orders,this.initializeValue(e.response)},handleMatchGroupUpdate(e){this.setResponse(e.response),this.updateValidity(this.computeIsValid())},handleAssociationsLimit(){_.NotifyInteractionSelectionsLimit(this.maxSelectionsMessage)},computeState(){return this.priorState!==null?this.priorState.state:{orders:this.orders}},computeIsValid(){const e=this.getResponse(),t=this.minAssociations*1;return t===0?!0:e===null?!1:this.cardinality==="single"||e.length>=t},evaluateValidity(){const e=this.getIsValid(),t=this.computeIsValid();e!==t&&this.updateValidity(t)},updateValidity(e){this.setIsValid(e),_.setInteractionIsValidResponse({identifier:this.responseIdentifier,isValidResponse:e})},computeMaxSelectionsMessage(){if(typeof this.dataMaxSelectionsMessage<"u"){this.maxSelectionsMessage=this.dataMaxSelectionsMessage;return}this.maxSelectionsMessage=this.maxAssociations*1==0?"":"You may make a maximum of "+this.maxAssociations+" match"+(this.maxAssociations*1>1?"es":"")+" for this question."},computeMinSelectionsMessage(){if(typeof this.dataMinSelectionsMessage<"u"){this.minSelectionsMessage=this.dataMinSelectionsMessage;return}this.minAssociations*1!=0&&(this.minSelectionsMessage="You must make at least "+this.minAssociations+" match"+(this.minAssociations*1>1?"es":"")+" for this question.")},detectInteractionSubType(e){return this.getMatchInteractionSubType(e)},getMatchInteractionSubType(e){let t="default";if(typeof e>"u"||e===null||e.length==0)return t;this.matchInteractionStaticClass=e;const i=e.split(" ");for(let s=0;s<i.length;s++)switch(i[s]){case"qti-match-tabular":t="matchtabular";break;case"qti-header-hidden":this.headerHidden="true";break;case"row-centric":this.rowCentric="true";break}return t},getPriorState(e){const t=_.getItemContextStateVariable(e);if(t===null)return null;if(!("value"in t))throw new O('Match Interaction State Invalid. "value" property not found.');if(!("state"in t))throw new O('Match Interaction State Invalid. "state" property not found.');if(!("orders"in t.state))throw new O('Match Interaction State Invalid. "orders" property not found.');return t}},created(){try{if(this.responseDeclaration=Ek.validateResponseIdentifierAttribute(_,this.responseIdentifier),this.setInteractionSubType(this.detectInteractionSubType(this.$.vnode.props.class)),this.priorState=this.getPriorState(this.responseIdentifier),this.cardinality=this.getCardinality(),this.cardinality!=="single"&&this.cardinality!=="multiple")throw new c('qti-match-interaction cardinality must be "single" or "multiple"');if(this.maxAssociations*1!=1&&this.cardinality!=="multiple")throw new c('qti-match-interaction response variable must have "multiple" cardinality because max-associations is '+this.maxAssociations);if(this.minAssociations*1>1&&this.cardinality==="single")throw new c('qti-match-interaction response variable must have "multiple" cardinality because min-associations is '+this.minAssociations);this.hasPrompts=this.getPrompts(this.$slots).length>0,this.computeMinSelectionsMessage(),this.computeMaxSelectionsMessage()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.movePrompt(),_.defineInteraction({identifier:this.responseIdentifier,interactionType:"Match",interactionSubType:this.interactionSubType,node:this,resetValue:this.resetValue,isValidResponse:this.getIsValid(),invalidResponseMessage:this.getInvalidResponseMessage(),maxSelectionsMessage:this.maxSelectionsMessage}),console.log("["+this.$options.name+"][Identifier]",this.responseIdentifier)}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}}},Ck={ref:"root",class:"qti-match-interaction"},Sk={ref:"prompt",class:"qti-prompt-wrapper"};function xk(e,t,i,s,n,r){const a=l.resolveComponent("MatchGroup");return l.openBlock(),l.createElementBlock("div",Ck,[l.createElementVNode("div",Sk,null,512),l.createVNode(a,l.mergeProps({ref:"matchgroup",cardinality:n.cardinality,shuffle:i.shuffle,responseIdentifier:i.responseIdentifier,maxAssociations:i.maxAssociations,minAssociations:i.minAssociations,interactionSubType:n.interactionSubType,matchInteractionStaticClass:n.matchInteractionStaticClass,headerHidden:n.headerHidden,rowCentric:n.rowCentric,dataFirstColumnHeader:i.dataFirstColumnHeader,priorState:n.priorState,onMatchGroupReady:r.handleMatchGroupReady,onMatchGroupUpdate:r.handleMatchGroupUpdate,onMatchGroupAssociationsLimit:r.handleAssociationsLimit},e.$attrs),{default:l.withCtx(()=>[l.renderSlot(e.$slots,"default")]),_:3},16,["cardinality","shuffle","responseIdentifier","maxAssociations","minAssociations","interactionSubType","matchInteractionStaticClass","headerHidden","rowCentric","dataFirstColumnHeader","priorState","onMatchGroupReady","onMatchGroupUpdate","onMatchGroupAssociationsLimit"])],512)}const _k=B(Tk,[["render",xk]]),Ik=new G,Vk={name:"QtiGapMatchInteraction",props:{responseIdentifier:{required:!0,type:String},minAssociations:{required:!1,type:String,default:"0"},maxAssociations:{required:!1,type:String,default:"1"},shuffle:{required:!1,type:String,default:"false"},dataMaxSelectionsMessage:{required:!1,type:String},dataMinSelectionsMessage:{required:!1,type:String},dataChoicesContainerWidth:{required:!1,type:String,default:null}},data(){return{response:null,state:null,isValidResponse:!1,choices:[],order:[],cardinality:"single",minSelectionsMessage:"",maxSelectionsMessage:"",responseDeclaration:null,hasPrompts:!1,gapMatchInteractionStaticClass:"",interactionSubType:"default",isQtiValid:!0,priorState:null}},methods:{getResponse(){return this.response},setResponse(e){this.response=e},getState(){return this.state},setState(e){this.state=e},setInteractionSubType(e){this.interactionSubType=e},getInteractionSubType(){return this.interactionSubType},getIsValid(){return this.isValidResponse},setIsValid(e){this.isValidResponse=e},getInvalidResponseMessage(){return this.minSelectionsMessage},disable(){this.$refs.gapmatchgroup.disable()},enable(){this.$refs.gapmatchgroup.enable()},initializeValue(e){this.setResponse(e),this.setState(this.computeState()),this.updateValidity(this.computeIsValid())},resetValue(){console.log("[ResetValue][identifier]",this.responseIdentifier),this.setResponse(null),this.setState(null),this.priorState=null,this.$refs.matchgroup.resetGroupUI()},restoreValue(e){this.setResponse(e),this.setState(this.computeState()),this.updateValidity(this.computeIsValid())},getCardinality(){let e=_.getResponseDeclaration(this.responseIdentifier);return this.cardinality=typeof e<"u"?e.cardinality:"single",this.cardinality},getPrompts(e){let t=[];return e.default().forEach(i=>{typeof i.type<"u"&&i.type.name==="QtiPrompt"&&t.push(i)}),t},movePrompt(){if(!this.hasPrompts)return;const e=this.$refs.root.querySelector(".qti-prompt");e!==null&&this.$refs.prompt.appendChild(e)},handleGapMatchGroupReady(e){this.choices=e.choices,this.order=e.order,this.initializeValue(e.response)},handleGapMatchGroupUpdate(e){this.setResponse(e.response),this.updateValidity(this.computeIsValid())},handleAssociationsLimit(){_.NotifyInteractionSelectionsLimit(this.maxSelectionsMessage)},computeState(){return this.priorState!==null?this.priorState.state:{order:this.order}},computeIsValid(){const e=this.getResponse(),t=this.minAssociations*1;return t===0?!0:e===null?!1:this.cardinality==="single"||e.length>=t},evaluateValidity(){const e=this.getIsValid(),t=this.computeIsValid();e!==t&&this.updateValidity(t)},updateValidity(e){this.setIsValid(e),_.setInteractionIsValidResponse({identifier:this.responseIdentifier,isValidResponse:e})},computeMaxSelectionsMessage(){if(typeof this.dataMaxSelectionsMessage<"u"){this.maxSelectionsMessage=this.dataMaxSelectionsMessage;return}this.maxSelectionsMessage=this.maxAssociations*1==0?"":"You may make a maximum of "+this.maxAssociations+" match"+(this.maxAssociations*1>1?"es":"")+" for this question."},computeMinSelectionsMessage(){if(typeof this.dataMinSelectionsMessage<"u"){this.minSelectionsMessage=this.dataMinSelectionsMessage;return}this.minAssociations*1!=0&&(this.minSelectionsMessage="You must make at least "+this.minAssociations+" match"+(this.minAssociations*1>1?"es":"")+" for this question.")},detectInteractionSubType(e){return this.computeInteractionSubType(e)},computeInteractionSubType(e){let t="default";return typeof e>"u"||e===null||e.length==0||(this.gapMatchInteractionStaticClass=e),t},getPriorState(e){const t=_.getItemContextStateVariable(e);if(t===null)return null;if(!("value"in t))throw new O('Gap Match Interaction State Invalid. "value" property not found.');if(!("state"in t))throw new O('Gap Match Interaction State Invalid. "state" property not found.');if(!("order"in t.state))throw new O('Gap Match Interaction State Invalid. "order" property not found.');return t}},created(){try{if(this.responseDeclaration=Ik.validateResponseIdentifierAttribute(_,this.responseIdentifier),this.setInteractionSubType(this.detectInteractionSubType(this.$.vnode.props.class)),this.priorState=this.getPriorState(this.responseIdentifier),this.cardinality=this.getCardinality(),this.cardinality!=="single"&&this.cardinality!=="multiple")throw new c('qti-gap-match-interaction cardinality must be "single" or "multiple"');if(this.maxAssociations*1!=1&&this.cardinality!=="multiple")throw new c('qti-gap-match-interaction response variable must have "multiple" cardinality because max-associations is '+this.maxAssociations);if(this.minAssociations*1>1&&this.cardinality==="single")throw new c('qti-gap-match-interaction response variable must have "multiple" cardinality because min-associations is '+this.minAssociations);this.hasPrompts=this.getPrompts(this.$slots).length>0,this.computeMinSelectionsMessage(),this.computeMaxSelectionsMessage()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.movePrompt(),_.defineInteraction({identifier:this.responseIdentifier,interactionType:"GapMatch",interactionSubType:this.interactionSubType,node:this,resetValue:this.resetValue,isValidResponse:this.getIsValid(),invalidResponseMessage:this.getInvalidResponseMessage(),maxSelectionsMessage:this.maxSelectionsMessage}),console.log("["+this.$options.name+"][Identifier]",this.responseIdentifier)}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}}},Ak={ref:"root",class:"qti-gap-match-interaction"},$k={ref:"prompt",class:"qti-prompt-wrapper"};function Lk(e,t,i,s,n,r){const a=l.resolveComponent("GapMatchGroup");return l.openBlock(),l.createElementBlock("div",Ak,[l.createElementVNode("div",$k,null,512),l.createVNode(a,l.mergeProps({ref:"gapmatchgroup",cardinality:n.cardinality,shuffle:i.shuffle,responseIdentifier:i.responseIdentifier,maxAssociations:i.maxAssociations,minAssociations:i.minAssociations,interactionSubType:n.interactionSubType,gapMatchInteractionStaticClass:n.gapMatchInteractionStaticClass,dataChoicesContainerWidth:i.dataChoicesContainerWidth,priorState:n.priorState,onGapMatchGroupReady:r.handleGapMatchGroupReady,onGapMatchGroupUpdate:r.handleGapMatchGroupUpdate,onGapMatchGroupAssociationsLimit:r.handleAssociationsLimit},e.$attrs),{default:l.withCtx(()=>[l.renderSlot(e.$slots,"default")]),_:3},16,["cardinality","shuffle","responseIdentifier","maxAssociations","minAssociations","interactionSubType","gapMatchInteractionStaticClass","dataChoicesContainerWidth","priorState","onGapMatchGroupReady","onGapMatchGroupUpdate","onGapMatchGroupAssociationsLimit"])],512)}const Mk=B(Vk,[["render",Lk]]),Nk=new G,Rk={name:"QtiGraphicGapMatchInteraction",props:{responseIdentifier:{required:!0,type:String},minAssociations:{required:!1,type:String,default:"0"},maxAssociations:{required:!1,type:String,default:"1"},shuffle:{required:!1,type:String,default:"false"},dataMaxSelectionsMessage:{required:!1,type:String},dataMinSelectionsMessage:{required:!1,type:String},dataChoicesContainerWidth:{required:!1,type:String,default:null}},data(){return{response:null,state:null,isValidResponse:!1,choices:[],order:[],cardinality:"multiple",minSelectionsMessage:"",maxSelectionsMessage:"",responseDeclaration:null,hasPrompts:!1,interactionStaticClass:"",interactionSubType:"default",isQtiValid:!0,priorState:null}},methods:{getResponse(){return this.response},setResponse(e){this.response=e},getState(){return this.state},setState(e){this.state=e},setInteractionSubType(e){this.interactionSubType=e},getInteractionSubType(){return this.interactionSubType},getIsValid(){return this.isValidResponse},setIsValid(e){this.isValidResponse=e},getInvalidResponseMessage(){return this.minSelectionsMessage},disable(){this.$refs.ggmgroup.disable()},enable(){this.$refs.ggmgroup.enable()},initializeValue(e){this.setResponse(e),this.setState(this.computeState()),this.updateValidity(this.computeIsValid())},resetValue(){console.log("[ResetValue][identifier]",this.responseIdentifier),this.setResponse(null),this.setState(null),this.priorState=null,this.$refs.matchgroup.resetGroupUI()},restoreValue(e){this.setResponse(e),this.setState(this.computeState()),this.updateValidity(this.computeIsValid())},getCardinality(){let e=_.getResponseDeclaration(this.responseIdentifier);return this.cardinality=typeof e<"u"?e.cardinality:"single",this.cardinality},getPrompts(e){let t=[];return e.default().forEach(i=>{typeof i.type<"u"&&i.type.name==="QtiPrompt"&&t.push(i)}),t},movePrompt(){if(!this.hasPrompts)return;const e=this.$refs.root.querySelector(".qti-prompt");e!==null&&this.$refs.prompt.appendChild(e)},handleGraphicGapMatchGroupReady(e){this.choices=e.choices,this.order=e.order,this.initializeValue(e.response)},handleGraphicGapMatchGroupUpdate(e){this.setResponse(e.response),this.updateValidity(this.computeIsValid())},handleAssociationsLimit(){_.NotifyInteractionSelectionsLimit(this.maxSelectionsMessage)},computeState(){return this.priorState!==null?this.priorState.state:{order:this.order}},computeIsValid(){const e=this.getResponse(),t=this.minAssociations*1;return t===0?!0:e===null?!1:this.cardinality==="single"||e.length>=t},evaluateValidity(){const e=this.getIsValid(),t=this.computeIsValid();e!==t&&this.updateValidity(t)},updateValidity(e){this.setIsValid(e),_.setInteractionIsValidResponse({identifier:this.responseIdentifier,isValidResponse:e})},computeMaxSelectionsMessage(){if(typeof this.dataMaxSelectionsMessage<"u"){this.maxSelectionsMessage=this.dataMaxSelectionsMessage;return}this.maxSelectionsMessage=this.maxAssociations*1==0?"":"You may make a maximum of "+this.maxAssociations+" match"+(this.maxAssociations*1>1?"es":"")+" for this question."},computeMinSelectionsMessage(){if(typeof this.dataMinSelectionsMessage<"u"){this.minSelectionsMessage=this.dataMinSelectionsMessage;return}this.minAssociations*1!=0&&(this.minSelectionsMessage="You must make at least "+this.minAssociations+" match"+(this.minAssociations*1>1?"es":"")+" for this question.")},detectInteractionSubType(e){return this.computeInteractionSubType(e)},computeInteractionSubType(e){let t="default";return typeof e>"u"||e===null||e.length==0||(this.interactionStaticClass=e),t},getPriorState(e){const t=_.getItemContextStateVariable(e);if(t===null)return null;if(!("value"in t))throw new O('Gap Match Interaction State Invalid. "value" property not found.');if(!("state"in t))throw new O('Gap Match Interaction State Invalid. "state" property not found.');if(!("order"in t.state))throw new O('Gap Match Interaction State Invalid. "order" property not found.');return t}},created(){try{if(this.responseDeclaration=Nk.validateResponseIdentifierAttribute(_,this.responseIdentifier),this.setInteractionSubType(this.detectInteractionSubType(this.$.vnode.props.class)),this.priorState=this.getPriorState(this.responseIdentifier),this.cardinality=this.getCardinality(),this.cardinality!=="multiple")throw new c('qti-graphic-gap-match-interaction cardinality must be "multiple"');this.hasPrompts=this.getPrompts(this.$slots).length>0,this.computeMinSelectionsMessage(),this.computeMaxSelectionsMessage()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.movePrompt(),_.defineInteraction({identifier:this.responseIdentifier,interactionType:"GraphicGapMatch",interactionSubType:this.interactionSubType,node:this,resetValue:this.resetValue,isValidResponse:this.getIsValid(),invalidResponseMessage:this.getInvalidResponseMessage(),maxSelectionsMessage:this.maxSelectionsMessage}),console.log("["+this.$options.name+"][Identifier]",this.responseIdentifier)}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}}},kk={ref:"root",class:"qti-graphic-gap-match-interaction"},qk={ref:"prompt",class:"qti-prompt-wrapper"};function Ok(e,t,i,s,n,r){const a=l.resolveComponent("GraphicGapMatchGroup");return l.openBlock(),l.createElementBlock("div",kk,[l.createElementVNode("div",qk,null,512),l.createVNode(a,l.mergeProps({ref:"ggmgroup",cardinality:n.cardinality,shuffle:i.shuffle,responseIdentifier:i.responseIdentifier,maxAssociations:i.maxAssociations,minAssociations:i.minAssociations,interactionSubType:n.interactionSubType,interactionStaticClass:n.interactionStaticClass,dataChoicesContainerWidth:i.dataChoicesContainerWidth,priorState:n.priorState,onGgmGroupReady:r.handleGraphicGapMatchGroupReady,onGgmGroupUpdate:r.handleGraphicGapMatchGroupUpdate,onGgmGroupAssociationsLimit:r.handleAssociationsLimit},e.$attrs),{default:l.withCtx(()=>[l.renderSlot(e.$slots,"default")]),_:3},16,["cardinality","shuffle","responseIdentifier","maxAssociations","minAssociations","interactionSubType","interactionStaticClass","dataChoicesContainerWidth","priorState","onGgmGroupReady","onGgmGroupUpdate","onGgmGroupAssociationsLimit"])],512)}const Bk=B(Rk,[["render",Ok]]),Pk={},Dk={ref:"root",class:"qti3-player-media-group"};function Qk(e,t){return l.openBlock(),l.createElementBlock("div",Dk,[l.renderSlot(e.$slots,"default")],512)}const uw=B(Pk,[["render",Qk]]),hw=new G,Hk={name:"QtiMediaInteraction",components:[uw],props:{responseIdentifier:{required:!0,type:String},autostart:{required:!1,type:String,default:"false"},minPlays:{required:!1,type:String,default:"0"},maxPlays:{required:!1,type:String,default:"0"},loop:{required:!1,type:String,default:"false"},coords:{required:!1,type:String},dataMaxPlaysMessage:{required:!1,type:String},dataMinPlaysMessage:{required:!1,type:String}},data(){return{response:null,state:null,isValidResponse:!1,cardinality:"single",minPlaysMessage:"",maxPlaysMessage:"",responseDeclaration:null,mediaType:"media",isAutostart:!1,isLoop:!1,isDisabled:!1,isQtiValid:!0,hasPrompts:!1,node:null,priorState:null}},methods:{getResponse(){return this.response},setResponse(e){this.response=e},incrementPlays(){let e=this.getResponse();this.setResponse(e===null?1:e+1)},getState(){return this.state},setState(e){this.state=e},getIsValid(){return this.isValidResponse},setIsValid(e){this.isValidResponse=e},disable(){this.node!==null&&this.node.disable()},enable(){this.node!==null&&this.node.enable()},getInvalidResponseMessage(){return this.computeMinPlaysMessage(),this.minPlaysMessage},resetValue(){console.log("[ResetValue][identifier]",this.responseIdentifier),this.priorState=null,this.setResponse(null),this.setState(this.computeState()),this.updateValidity(this.computeIsValid())},restoreValue(e){e!==null&&(this.setResponse(e),this.setState(this.computeState()),this.updateValidity(this.computeIsValid()),this.evaluateMaxPlays())},getCardinality(){return this.cardinality},getPrompts(e){let t=[];return e.default().forEach(i=>{typeof i.type<"u"&&i.type.name==="QtiPrompt"&&t.push(i)}),t},movePrompt(){if(!this.hasPrompts)return;const e=this.$refs.root.querySelector(".qti-prompt");e!==null&&this.$refs.prompt.appendChild(e)},handleMediaMounted(e){this.node=e.node,this.mediaType=e.mediaType,e.mediaType==="audio"&&this.node.setAudioSubType("audioprogress"),this.evaluateMaxPlays()},handleMediaLoaded(e){this.node=e.node,this.evaluateMaxPlays(),this.evaluateAutostart()},handleMediaEnded(){this.incrementPlays(),this.evaluateValidity(),this.evaluateMaxPlays(),this.evaluateLoop()},computeState(){return{}},computeIsValid(){const e=this.minPlays*1;if(e===0)return!0;const t=this.getResponse();return t===null?!1:t>=e},evaluateValidity(){const e=this.getIsValid(),t=this.computeIsValid();e!==t&&this.updateValidity(t)},updateValidity(e){this.setIsValid(e),_.setInteractionIsValidResponse({identifier:this.responseIdentifier,isValidResponse:e})},evaluateMaxPlays(){this.checkMaxPlaysLimit()?this.disable():this.enable()},evaluateLoop(){this.isLoop&&(this.checkMaxPlaysLimit()||this.isDisabled||this.playMedia())},evaluateAutostart(){this.isAutostart&&(this.checkMaxPlaysLimit()||this.isDisabled||(console.log(`[${this.$options.name}][Identifier=${this.responseIdentifier}][AutoStart]`),this.playMedia()))},playMedia(){if(this.node!=null){if(this.mediaType==="audio")return this.node.playAudio();this.node.playVideo()}},checkMaxPlaysLimit(){if(this.maxPlays*1===0)return!1;const e=this.getResponse();return e!==null&&e==this.maxPlays*1},computeMaxPlaysMessage(){if(typeof this.dataMaxPlaysMessage<"u"){this.maxPlaysMessage=this.dataMaxPlaysMessage;return}const e=this.maxPlays*1;this.maxPlaysMessage=e===0?"":`You are permitted a maximum of ${this.maxPlays} play${e>1?"s":""} for this ${this.mediaType}.`},computeMinPlaysMessage(){if(typeof this.dataMinPlaysMessage<"u"){this.minPlaysMessage=this.dataMinPlaysMessage;return}const e=this.minPlays*1;this.minPlaysMessage=e===0?"":`You must play this ${this.mediaType} to the end at least ${this.minPlays} time${e>1?"s":""}.`},validateChildren(){},processChildren(){this.processMedia(),this.setIsValid(this.computeIsValid()),this.priorState!==null&&this.restoreValue(this.priorState.value)},processMedia(){let e=this.$refs.mediagroup.$el.getElementsByTagName("object");if(e.length!==0)throw new c("Unsupported Media Interaction element. The <object> elemnt is deprecated. Use <video> or <audio> instead.");if(e=this.$refs.mediagroup.$el.getElementsByTagName("video"),e.length===0&&(e=this.$refs.mediagroup.$el.getElementsByTagName("audio")),e.length!==1)throw new c("Media Interaction must have exactly one <video> or <audio> node.")},getPriorState(e){const t=_.getItemContextStateVariable(e);if(t===null)return null;if(!("value"in t))throw new O('Media Interaction State Invalid. "value" property not found.');if(!("state"in t))throw new O('Media Interaction State Invalid. "state" property not found.');return t}},created(){try{this.responseDeclaration=hw.validateResponseIdentifierAttribute(_,this.responseIdentifier),this.validateChildren(),this.priorState=this.getPriorState(this.responseIdentifier),hw.validateMaxMinPlays(this.maxPlays,this.minPlays),this.hasPrompts=this.getPrompts(this.$slots).length>0,this.isAutostart=this.autostart==="true",this.isLoop=this.loop==="true",this.computeMaxPlaysMessage()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.movePrompt(),this.processChildren(),_.defineInteraction({identifier:this.responseIdentifier,interactionType:"Media",node:this,resetValue:this.resetValue,disable:this.disable,isValidResponse:this.getIsValid(),invalidResponseMessage:this.getInvalidResponseMessage(),maxSelectionsMessage:this.maxPlaysMessage}),console.log("["+this.$options.name+"][Identifier]",this.responseIdentifier)}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}}},Fk={ref:"root",class:"qti-media-interaction"},Uk={ref:"prompt",class:"qti-prompt-wrapper"};function Gk(e,t,i,s,n,r){const a=l.resolveComponent("MediaGroup");return l.openBlock(),l.createElementBlock("div",Fk,[l.createElementVNode("div",Uk,null,512),l.createVNode(a,{ref:"mediagroup",onMediaMounted:r.handleMediaMounted,onMediaLoaded:r.handleMediaLoaded,onMediaEnded:r.handleMediaEnded},{default:l.withCtx(()=>[l.renderSlot(e.$slots,"default")]),_:3},8,["onMediaMounted","onMediaLoaded","onMediaEnded"])],512)}const jk=B(Hk,[["render",Gk]]),Fh=new G,Wk={name:"QtiOrderInteraction",props:{responseIdentifier:{required:!0,type:String},minChoices:{required:!1,type:String},maxChoices:{required:!1,type:String},shuffle:{required:!1,type:String,default:"false"},orientation:{required:!1,type:String,default:"horizontal"},dataMaxSelectionsMessage:{required:!1,type:String},dataMinSelectionsMessage:{required:!1,type:String},dataChoicesContainerWidth:{required:!1,type:String,default:null}},data(){return{response:null,state:null,isValidResponse:!1,cardinality:"ordered",minSelectionsMessage:"",maxSelectionsMessage:"",responseDeclaration:null,interactionSubType:"default",choices:[],isShuffle:!1,hasPrompts:!1,minChoicesValue:null,maxChoicesValue:null,isMinChoicesSpecified:!1,isMaxChoicesSpecified:!1,isQtiValid:!0,priorState:null,originalOrder:null}},methods:{getResponse(){return this.response},setResponse(e){this.response=e},getState(){return this.state},setState(e){this.state=e},setInteractionSubType(e){this.interactionSubType=e},getInteractionSubType(){return this.interactionSubType},getIsValid(){return this.isValidResponse},setIsValid(e){this.isValidResponse=e},getInvalidResponseMessage(){return this.minSelectionsMessage},disable(){this.$refs.ordergroup.disable()},enable(){this.$refs.ordergroup.enable()},initializeValue(e){this.setResponse(this.computeResponse(e)),this.setState(this.computeState()),this.updateValidity(this.computeIsValid())},initializeOriginalOrder(){if(this.originalOrder!==null)return;let e=[];this.choices.forEach(t=>{e.push(t.identifier)}),this.originalOrder=e},resetValue(){console.log("[ResetValue][identifier]",this.responseIdentifier),this.setResponse(null),this.setState(null),this.priorState=null,this.$refs.ordergroup.resetGroupUI()},restoreValue(e){this.setResponse(e),this.setState(this.computeState()),this.updateValidity(this.computeIsValid())},getCardinality(){let e=_.getResponseDeclaration(this.responseIdentifier);return this.cardinality=typeof e<"u"?e.cardinality:"ordered",this.cardinality},getPrompts(e){let t=[];return e.default().forEach(i=>{typeof i.type<"u"&&i.type.name==="QtiPrompt"&&t.push(i)}),t},movePrompt(){this.hasPrompts&&this.$refs.prompt.appendChild(this.$refs.ordergroup.getPromptElement())},handleOrderGroupReady(e){this.choices=e.choices,this.isMinChoicesSpecified||(this.minChoicesValue=this.choices.length),this.originalOrder===null&&this.initializeOriginalOrder(),this.initializeValue(e.response)},handleOrderGroupUpdate(e){this.setResponse(this.computeResponse(e.response)),this.setState({order:e.response,oorder:this.originalOrder}),this.updateValidity(this.computeIsValid())},handleSelectionsLimit(){_.NotifyInteractionSelectionsLimit(this.maxSelectionsMessage)},computeResponse(e){let t=[];typeof e>"u"?this.choices.forEach(s=>{t.push(s.identifier)}):t=e;let i=0;switch(this.interactionSubType){case"default":for(let s=0;s<t.length;s++)t[s]!==this.originalOrder[s]&&(i+=1);break;case"ordermatch":for(let s=0;s<t.length;s++)t[s]!==null&&(i+=1);break}return i===0?null:t},computeOrder(){const e=[];return this.choices.forEach(t=>{e.push(t.identifier)}),e},computeState(){return this.priorState!==null?this.priorState.state:{order:this.computeOrder(),oorder:this.originalOrder}},computeIsValid(){const e=this.getResponse(),t=this.minChoicesValue;if(e===null||e.length!==this.originalOrder.length)return!1;let i=0;switch(this.interactionSubType){case"default":for(let s=0;s<e.length;s++)e[s]!==this.originalOrder[s]&&(i+=1);return this.isMinChoicesSpecified?i>=t:i===t;case"ordermatch":for(let s=0;s<e.length;s++)e[s]!==null&&(i+=1);return this.isMinChoicesSpecified?i>=t:i===e.length}return!1},evaluateValidity(){const e=this.getIsValid(),t=this.computeIsValid();e!==t&&this.updateValidity(t)},updateValidity(e){this.setIsValid(e),_.setInteractionIsValidResponse({identifier:this.responseIdentifier,isValidResponse:e})},computeMaxSelectionsMessage(){if(typeof this.dataMaxSelectionsMessage<"u"){this.maxSelectionsMessage=this.dataMaxSelectionsMessage;return}this.maxSelectionsMessage=this.maxChoicesValue===null?"":"You may set an order for a maximum of "+this.maxChoicesValue+" choice"+(this.maxChoicesValue>1?"s":"")+" for this question."},computeMinSelectionsMessage(){if(typeof this.dataMinSelectionsMessage<"u"){this.minSelectionsMessage=this.dataMinSelectionsMessage;return}this.isMinChoicesSpecified?this.minSelectionsMessage="You must set the order for at least "+this.minChoicesValue+" choice"+(this.minChoicesValue>1?"s":"")+" for this question.":this.minSelectionsMessage="You must set the order for all choices for this question."},detectInteractionSubType(e){return this.getOrderInteractionSubType(e)},getOrderInteractionSubType(e){if(typeof e>"u"||e===null||e.length==0)return"default";const t=e.split(" ");for(let i=0;i<t.length;i++)switch(t[i]){case"qti-choices-top":case"qti-choices-bottom":case"qti-choices-left":case"qti-choices-right":return"ordermatch"}return"default"},getPriorState(e){const t=_.getItemContextStateVariable(e);if(t===null)return null;if(!("value"in t))throw new O('Order Interaction State Invalid. "value" property not found.');if(!("state"in t))throw new O('Order Interaction State Invalid. "state" property not found.');if(!("order"in t.state))throw new O('Order Interaction State Invalid. "order" property not found.');if(!("oorder"in t.state))throw new O('Order Interaction State Invalid. "oorder" property not found.');return this.originalOrder=t.state.oorder,t}},created(){try{if(this.responseDeclaration=Fh.validateResponseIdentifierAttribute(_,this.responseIdentifier),this.setInteractionSubType(this.detectInteractionSubType(this.$.vnode.props.class)),this.priorState=this.getPriorState(this.responseIdentifier),this.cardinality=this.getCardinality(),this.cardinality!=="ordered")throw new c('qti-order-interaction cardinality must be "ordered"');if(this.isShuffle=this.shuffle==="true",this.hasPrompts=this.getPrompts(this.$slots).length>0,typeof this.minChoices<"u"&&(this.isMinChoicesSpecified=!0),this.minChoicesValue=Fh.validateIntegerAttribute("min-choices",this.minChoices,!1,null),this.minChoicesValue===0)throw new c('qti-order-interaction "min-choices", when specified, must not be 0');if(this.isMinChoicesSpecified?(typeof this.maxChoices<"u"&&(this.isMaxChoicesSpecified=!0),this.maxChoicesValue=Fh.validateIntegerAttribute("max-choices",this.maxChoices,!1,null)):this.maxChoicesValue=null,this.isMinChoicesSpecified&&this.isMaxChoicesSpecified&&this.minChoicesValue>this.maxChoicesValue)throw new c('qti-order-interaction "min-choices" must not be greater than "max-choices"');this.computeMinSelectionsMessage(),this.computeMaxSelectionsMessage()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.movePrompt(),_.defineInteraction({identifier:this.responseIdentifier,interactionType:"Order",node:this,resetValue:this.resetValue,isValidResponse:this.getIsValid(),invalidResponseMessage:this.getInvalidResponseMessage(),maxSelectionsMessage:this.maxSelectionsMessage}),console.log("["+this.$options.name+"][Identifier]",this.responseIdentifier)}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}}},zk={ref:"root",class:"qti-order-interaction"},Kk={ref:"prompt",class:"qti-prompt-wrapper"};function Yk(e,t,i,s,n,r){const a=l.resolveComponent("OrderGroup");return l.openBlock(),l.createElementBlock("div",zk,[l.createElementVNode("div",Kk,null,512),l.createVNode(a,l.mergeProps({ref:"ordergroup",cardinality:n.cardinality,shuffle:i.shuffle,responseIdentifier:i.responseIdentifier,orientation:i.orientation,maxChoices:n.maxChoicesValue,minChoices:n.minChoicesValue,interactionSubType:n.interactionSubType,dataChoicesContainerWidth:i.dataChoicesContainerWidth,priorState:n.priorState,onOrderGroupReady:r.handleOrderGroupReady,onOrderGroupUpdate:r.handleOrderGroupUpdate,onOrderGroupSelectionsLimit:r.handleSelectionsLimit},e.$attrs),{default:l.withCtx(()=>[l.renderSlot(e.$slots,"default")]),_:3},16,["cardinality","shuffle","responseIdentifier","orientation","maxChoices","minChoices","interactionSubType","dataChoicesContainerWidth","priorState","onOrderGroupReady","onOrderGroupUpdate","onOrderGroupSelectionsLimit"])],512)}const Xk=B(Wk,[["render",Yk]]);class Zk{constructor(){this.nodes=[]}find(t,i){if(Array.isArray(t))return t.forEach(s=>{var n;if(s.component!==null&&((n=s.component.type)==null?void 0:n.name)===i){this.nodes.push(s.component.proxy);return}Array.isArray(s==null?void 0:s.children)&&this.find(s.children,i)}),this.nodes}findNodes(t,{within:i}){return this.find(i,t)}}class Jk{constructor(t){return this.constants={QTI_UNSELECTED_HIDDEN:"qti-unselected-hidden"},this.classList=t,this.presentation_UnselectedHidden=!1,this.processClassAttribute(),this}processClassAttribute(){if(typeof this.classList>"u"||this.classList===null||this.classList.length==0)return;const t=this.classList.split(" ");for(let i=0;i<t.length;i++)switch(t[i]){case this.constants.QTI_UNSELECTED_HIDDEN:this.presentation_UnselectedHidden=!0;break}}getUnselectedHidden(){return this.presentation_UnselectedHidden}}const dw=new G,e2=new Zk,t2={name:"QtiHottextInteraction",props:{responseIdentifier:{required:!0,type:String},minChoices:{required:!1,type:String,default:"0"},maxChoices:{required:!1,type:String,default:"1"},dataMaxSelectionsMessage:{required:!1,type:String},dataMinSelectionsMessage:{required:!1,type:String}},inheritAttrs:!0,data(){return{response:null,state:null,isValidResponse:!1,cardinality:"single",minSelectionsMessage:"",maxSelectionsMessage:"",responseDeclaration:null,choices:[],currentChoice:null,isRadio:!0,isDisabled:!1,isQtiValid:!0,hasPrompts:!1,presentationFactory:null,priorState:null}},methods:{getResponse(){return this.response},setResponse(e){this.response=e},getState(){return this.state},setState(e){this.state=e},getIsValid(){return this.isValidResponse},setIsValid(e){this.isValidResponse=e},disable(){this.toggleDisableChoices(!0)},enable(){this.toggleDisableChoices(!1)},toggleDisableChoices(e){this.isDisabled=e,this.choices.forEach(t=>{t.setIsDisabled(e)})},getInvalidResponseMessage(){return this.minSelectionsMessage},resetValue(){console.log("[ResetValue][identifier]",this.responseIdentifier),this.choices.forEach(e=>{e.setChecked(!1)}),this.currentChoice=null,this.priorState=null},restoreValue(e){e!==null&&(this.isRadio?this.handleSetChecked(new CustomEvent("setChecked",{bubbles:!1,detail:{identifier:e,checked:"true"}}),!0):e.forEach(t=>{this.handleSetChecked(new CustomEvent("setChecked",{bubbles:!1,detail:{identifier:t,checked:"true"}}),!0)},this),this.setResponse(this.computeResponse()),this.setState(this.computeState()),this.updateValidity(this.computeIsValid()))},getCardinality(){let e=_.getResponseDeclaration(this.responseIdentifier);return this.cardinality=typeof e<"u"?e.cardinality!=="multiple"?"single":"multiple":"single",this.cardinality},getPrompts(e){let t=[];return e.default().forEach(i=>{typeof i.type<"u"&&i.type.name==="QtiPrompt"&&t.push(i)}),t},movePrompt(){if(!this.hasPrompts)return;const e=this.$refs.root.querySelector(".qti-prompt");e!==null&&this.$refs.prompt.appendChild(e)},handleSetChecked(e,t=!1){const i=e.detail;this.choices.forEach(s=>{this.isRadio&&s.setChecked(!1),s.identifier===i.identifier&&(this.currentChoice=s)}),i.checked==="true"?this.checkMaxChoicesLimit()?this.currentChoice.setChecked(!1):this.currentChoice.setChecked(!0):this.currentChoice.setChecked(!1),t||(this.setResponse(this.computeResponse()),this.currentChoice.setFocus(),this.evaluateValidity())},computeResponse(){let e=this.isRadio?null:[];return this.choices.forEach(t=>{t.isChecked()&&(this.isRadio?e=t.identifier:e.push(t.identifier))}),this.isRadio?e:e.length===0?null:e},computeState(){return{}},computeIsValid(){return this.minChoices*1===0?!0:this.response===null?!1:this.cardinality==="single"||this.cardinality==="multiple"&&this.response.length>=this.minChoices*1},evaluateValidity(){const e=this.getIsValid(),t=this.computeIsValid();e!==t&&this.updateValidity(t)},updateValidity(e){this.setIsValid(e),_.setInteractionIsValidResponse({identifier:this.responseIdentifier,isValidResponse:e})},checkMaxChoicesLimit(){if(this.isRadio||this.maxChoices==0)return!1;const e=this.getResponse();return e!==null&&e.length==this.maxChoices?(_.NotifyInteractionSelectionsLimit(this.maxSelectionsMessage),!0):!1},computeMaxSelectionsMessage(){if(typeof this.dataMaxSelectionsMessage<"u"){this.maxSelectionsMessage=this.dataMaxSelectionsMessage;return}this.maxSelectionsMessage=this.maxChoices==0?"":"You are permitted a maximum of "+this.maxChoices+" selection"+(this.maxChoices>1?"s":"")+" for this question.<br/><br/>Please unselect one of your selections before making another selection."},computeMinSelectionsMessage(){if(typeof this.dataMinSelectionsMessage<"u"){this.minSelectionsMessage=this.dataMinSelectionsMessage;return}this.minSelectionsMessage=this.minChoices==0?"":"You must make at least "+this.minChoices+" selection"+(this.minChoices>1?"s":"")+" for this question."},validateChildren(){},processChildren(){const e=this.$.subTree===null?null:this.$.subTree.children[1].children;this.choices=e2.findNodes("QtiHottext",{within:e}),this.processGroupUI(),this.priorState!==null&&this.restoreValue(this.priorState.value)},processGroupUI(){this.setUnselectedHidden(),this.setResponse(null),this.setState(this.computeState()),this.setIsValid(this.computeIsValid())},setUnselectedHidden(){this.presentationFactory.getUnselectedHidden()&&this.$refs.hottextgroup.setAttribute("class","qti3-player-hottext-group qti-unselected-hidden")},getPriorState(e){const t=_.getItemContextStateVariable(e);if(t===null)return null;if(!("value"in t))throw new O('Hottext Interaction State Invalid. "value" property not found.');if(!("state"in t))throw new O('Hottext Interaction State Invalid. "state" property not found.');return t}},created(){try{this.responseDeclaration=dw.validateResponseIdentifierAttribute(_,this.responseIdentifier),this.presentationFactory=new Jk(this.$.vnode.props.class),this.validateChildren(),this.priorState=this.getPriorState(this.responseIdentifier),dw.validateMaxMinChoices(this.maxChoices,this.minChoices),this.isRadio=this.getCardinality()!=="multiple",this.hasPrompts=this.getPrompts(this.$slots).length>0,this.computeMinSelectionsMessage(),this.computeMaxSelectionsMessage()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.movePrompt(),this.processChildren(),_.defineInteraction({identifier:this.responseIdentifier,interactionType:"Hottext",node:this,resetValue:this.resetValue,disable:this.disable,isValidResponse:this.getIsValid(),invalidResponseMessage:this.getInvalidResponseMessage(),maxSelectionsMessage:this.maxSelectionsMessage}),console.log("["+this.$options.name+"][Identifier]",this.responseIdentifier)}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}}},i2={ref:"root",class:"qti-hottext-interaction"},s2={ref:"prompt",class:"qti-prompt-wrapper"};function n2(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",i2,[l.createElementVNode("div",s2,null,512),l.createElementVNode("div",{ref:"hottextgroup","on:setChecked":t[0]||(t[0]=(...a)=>r.handleSetChecked&&r.handleSetChecked(...a)),class:"qti3-player-hottext-group"},[l.renderSlot(e.$slots,"default")],544)],512)}const r2=B(t2,[["render",n2]]);class a2{constructor(t){return this.constants={QTI_SELECTIONS_LIGHT:"qti-selections-light",QTI_SELECTIONS_DARK:"qti-selections-dark",QTI_UNSELECTED_HIDDEN:"qti-unselected-hidden",THEME_LIGHT:{selectedOpacity:"1.0",unselectedOpacity:"0.5",fillColor:"orange",fillOpacity:"0",strokeColor:"orange",strokeWidth:2,selectedStrokeWidth:4},THEME_DARK:{selectedOpacity:"1.0",unselectedOpacity:"0.5",fillColor:"#0088CC",fillOpacity:"0",strokeColor:"blue",strokeWidth:2,selectedStrokeWidth:4},THEME_HIDDEN_LIGHT:{selectedOpacity:"1.0",unselectedOpacity:"0",fillColor:"orange",fillOpacity:"0",strokeColor:"orange",strokeWidth:2,selectedStrokeWidth:4},THEME_HIDDEN_DARK:{selectedOpacity:"1.0",unselectedOpacity:"0",fillColor:"blue",fillOpacity:"0",strokeColor:"blue",strokeWidth:2,selectedStrokeWidth:4}},this.classList=t,this.presentation_Theme=this.constants.QTI_SELECTIONS_DARK,this.theme=this.constants.THEME_DARK,this.presentation_UnselectedHidden=!1,this.processClassAttribute(),this}processClassAttribute(){if(typeof this.classList>"u"||this.classList===null||this.classList.length==0)return;const t=this.classList.split(" ");for(let i=0;i<t.length;i++)switch(t[i]){case this.constants.QTI_SELECTIONS_DARK:this.presentation_Theme=this.constants.QTI_SELECTIONS_DARK;break;case this.constants.QTI_SELECTIONS_LIGHT:this.presentation_Theme=this.constants.QTI_SELECTIONS_LIGHT;break;case this.constants.QTI_UNSELECTED_HIDDEN:this.presentation_UnselectedHidden=!0;break}switch(this.presentation_Theme){case this.constants.QTI_SELECTIONS_DARK:this.presentation_UnselectedHidden&&(this.theme=this.constants.THEME_HIDDEN_DARK);break;case this.constants.QTI_SELECTIONS_LIGHT:this.presentation_UnselectedHidden?this.theme=this.constants.THEME_HIDDEN_LIGHT:this.theme=this.constants.THEME_LIGHT;break}}getThemeColors(){return this.theme}}const fw=new G,o2={name:"QtiHotspotInteraction",props:{responseIdentifier:{required:!0,type:String},minChoices:{required:!1,type:String,default:"0"},maxChoices:{required:!1,type:String,default:"1"},dataMaxSelectionsMessage:{required:!1,type:String},dataMinSelectionsMessage:{required:!1,type:String}},data(){return{response:null,state:null,isValidResponse:!1,cardinality:"single",minSelectionsMessage:"",maxSelectionsMessage:"",responseDeclaration:null,choices:[],currentChoice:null,shapeElements:[],currentElement:null,backgroundImage:null,backgroundImageWidth:"0",backgroundImageHeight:"0",isRadio:!0,isDisabled:!1,isQtiValid:!0,hasPrompts:!1,presentationFactory:null,shapeColorProperties:null,priorState:null}},methods:{getResponse(){return this.response},setResponse(e){this.response=e},getState(){return this.state},setState(e){this.state=e},getIsValid(){return this.isValidResponse},setIsValid(e){this.isValidResponse=e},disable(){this.toggleDisableChoices(!0)},enable(){this.toggleDisableChoices(!1)},toggleDisableChoices(e){this.isDisabled=e},getInvalidResponseMessage(){return this.minSelectionsMessage},resetValue(){console.log("[ResetValue][identifier]",this.responseIdentifier);for(let e=0;e<this.choices.length;e++)this.setChoiceUnChecked(this.choices[e],this.shapeElements[e]);this.currentChoice=null,this.currentElement=null,this.priorState=null,this.setResponse(null),this.setState(this.computeState()),this.updateValidity(this.computeIsValid())},restoreValue(e){e!==null&&(this.isRadio?this.handleSetChecked(new CustomEvent("setChecked",{bubbles:!1,detail:{identifier:e,checked:"true"}}),!0):e.forEach(t=>{this.handleSetChecked(new CustomEvent("setChecked",{bubbles:!1,detail:{identifier:t,checked:"true"}}),!0)},this),this.setResponse(this.computeResponse()),this.setState(this.computeState()),this.updateValidity(this.computeIsValid()))},getCardinality(){let e=_.getResponseDeclaration(this.responseIdentifier);return this.cardinality=typeof e<"u"?e.cardinality!=="multiple"?"single":"multiple":"single",this.cardinality},getPrompts(e){let t=[];return e.default().forEach(i=>{typeof i.type<"u"&&i.type.name==="QtiPrompt"&&t.push(i)}),t},movePrompt(){if(!this.hasPrompts)return;const e=this.$refs.root.querySelector(".qti-prompt");e!==null&&this.$refs.prompt.appendChild(e)},handleSetChecked(e,t=!1){const i=e.detail;for(let s=0;s<this.choices.length;s++)this.isRadio&&this.setChoiceUnChecked(this.choices[s],this.shapeElements[s]),this.choices[s].identifier===i.identifier&&(this.currentChoice=this.choices[s],this.currentElement=this.shapeElements[s]);i.checked==="true"?this.checkMaxChoicesLimit()?this.setChoiceUnChecked(this.currentChoice,this.currentElement):this.setChoiceChecked(this.currentChoice,this.currentElement):this.setChoiceUnChecked(this.currentChoice,this.currentElement),t||(this.setResponse(this.computeResponse()),this.currentElement.focus(),this.evaluateValidity())},computeResponse(){let e=this.isRadio?null:[];return this.choices.forEach(t=>{t.isChecked()&&(this.isRadio?e=t.identifier:e.push(t.identifier))}),this.isRadio?e:e.length===0?null:e},computeState(){return{}},computeIsValid(){return this.minChoices*1===0?!0:this.response===null?!1:this.cardinality==="single"||this.cardinality==="multiple"&&this.response.length>=this.minChoices*1},evaluateValidity(){const e=this.getIsValid(),t=this.computeIsValid();e!==t&&this.updateValidity(t)},updateValidity(e){this.setIsValid(e),_.setInteractionIsValidResponse({identifier:this.responseIdentifier,isValidResponse:e})},checkMaxChoicesLimit(){if(this.isRadio||this.maxChoices==0)return!1;const e=this.getResponse();return e!==null&&e.length==this.maxChoices?(_.NotifyInteractionSelectionsLimit(this.maxSelectionsMessage),!0):!1},computeMaxSelectionsMessage(){if(typeof this.dataMaxSelectionsMessage<"u"){this.maxSelectionsMessage=this.dataMaxSelectionsMessage;return}this.maxSelectionsMessage=this.maxChoices==0?"":"You are permitted a maximum of "+this.maxChoices+" selection"+(this.maxChoices>1?"s":"")+" for this question.<br/><br/>Please unselect one of your selections before making another selection."},computeMinSelectionsMessage(){if(typeof this.dataMinSelectionsMessage<"u"){this.minSelectionsMessage=this.dataMinSelectionsMessage;return}this.minSelectionsMessage=this.minChoices==0?"":"You must make at least "+this.minChoices+" selection"+(this.minChoices>1?"s":"")+" for this question."},validateChildren(){},processChildren(){this.processBackgroundImage(),this.$.subTree.children[1].children[0].dynamicChildren.forEach(t=>{if(t.component!==null&&t.type.name==="QtiHotspotChoice"){const i=t.component.proxy;this.choices.push(i);const s=i.getShapeElement();s!==null&&(this.addHotspotListeners(s),this.shapeElements.push(s),this.$refs.overlay.appendChild(s))}}),this.processGroupUI(),this.priorState!==null&&this.restoreValue(this.priorState.value)},addHotspotListeners(e){e.addEventListener("click",this.handleHotspotClick),e.addEventListener("keydown",this.handleHotspotKeydown)},removeHotspotListeners(e){e.removeEventListener("click",this.handleHotspotClick),e.removeEventListener("keydown",this.handleHotspotKeydown)},handleHotspotClick(e){if(e.preventDefault(),this.isDisabled)return;const t=e.target.getAttribute("data-identifier"),i=this.findChoiceByIdentifier(t);this.isRadio?this.triggerChecked(e.target.getAttribute("data-identifier"),"true"):(this.toggleChecked(i,e.target),this.triggerChecked(t,i.getChecked()))},handleHotspotKeydown(e){const t=e.target.getAttribute("data-identifier"),i=this.findChoiceByIdentifier(t);switch(e.code){case"Space":case"Enter":if(e.stopPropagation(),e.preventDefault(),this.isDisabled||i==null)return;this.toggleChecked(i,e.target),this.triggerChecked(t,i.getChecked());break}},findChoiceByIdentifier(e){for(let t=0;t<this.choices.length;t++)if(this.choices[t].identifier===e)return this.choices[t];return null},toggleChecked(e,t){if(e.toggleChecked(),t===null)return;const i=t.getAttribute("aria-checked");t.setAttribute("aria-checked",i==="true"?"false":"true")},triggerChecked(e,t){const i=new CustomEvent("setChecked",{bubbles:!0,cancelable:!0,detail:{identifier:e,checked:t}});this.$refs.hotspotgroup.dispatchEvent(i)},setChoiceUnChecked(e,t){e.setChecked(!1),t.setAttribute("aria-checked","false");const i=e.getShapeColorProperties();t.setAttribute("fill",`${i.fillColor}`),t.setAttribute("fill-opacity",`${i.fillOpacity}`),t.setAttribute("opacity",`${i.unselectedOpacity}`),t.setAttribute("stroke",`${i.strokeColor}`),t.setAttribute("stroke-width",`${i.strokeWidth}`)},setChoiceChecked(e,t){e.setChecked(!0),t.setAttribute("aria-checked","true");const i=e.getShapeColorProperties();t.setAttribute("fill",`${i.fillColor}`),t.setAttribute("fill-opacity",`${i.fillOpacity}`),t.setAttribute("opacity",`${i.selectedOpacity}`),t.setAttribute("stroke",`${i.strokeColor}`),t.setAttribute("stroke-width",`${i.selectedStrokeWidth}`)},processGroupUI(){this.setResponse(null),this.setState(this.computeState()),this.setIsValid(this.computeIsValid())},processBackgroundImage(){let e=this.$refs.hotspotgroup.getElementsByTagName("object");if(e.length===0&&(e=this.$refs.hotspotgroup.getElementsByTagName("img")),e.length===0&&(e=this.$refs.hotspotgroup.getElementsByTagName("picture")),e.length!==1)throw new c("Hotspot interaction must have exactly one <img>, <object>, or <picture> node");this.backgroundImage=e[0],this.backgroundImage.setAttribute("draggable","false"),this.backgroundImageWidth=`${e[0].clientWidth}`,this.backgroundImageHeight=`${e[0].clientHeight}`,this.$refs.overlay.setAttribute("viewBox",`0 0 ${this.backgroundImageWidth} ${this.backgroundImageHeight}`),this.$refs.overlay.setAttribute("tabindex","-1"),this.$refs.overlay.setAttribute("role","application"),this.$refs.overlay.setAttribute("focusable","false"),this.$refs.hotspotgroup.setAttribute("style",`width:${e[0].clientWidth};height:${e[0].clientHeight}`)},getShapeColorProperties(){return this.shapeColorProperties},setShapeColorProperties(e){this.shapeColorProperties=e},getPriorState(e){const t=_.getItemContextStateVariable(e);if(t===null)return null;if(!("value"in t))throw new O('Hotspot Interaction State Invalid. "value" property not found.');if(!("state"in t))throw new O('Hotspot Interaction State Invalid. "state" property not found.');return t}},created(){try{this.responseDeclaration=fw.validateResponseIdentifierAttribute(_,this.responseIdentifier),this.presentationFactory=new a2(this.$.vnode.props.class),this.setShapeColorProperties(this.presentationFactory.getThemeColors()),this.validateChildren(),this.priorState=this.getPriorState(this.responseIdentifier),fw.validateMaxMinChoices(this.maxChoices,this.minChoices),this.isRadio=this.getCardinality()!=="multiple",this.hasPrompts=this.getPrompts(this.$slots).length>0,this.computeMinSelectionsMessage(),this.computeMaxSelectionsMessage()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.movePrompt(),this.processChildren(),_.defineInteraction({identifier:this.responseIdentifier,interactionType:"Hotspot",node:this,resetValue:this.resetValue,disable:this.disable,isValidResponse:this.getIsValid(),invalidResponseMessage:this.getInvalidResponseMessage(),maxSelectionsMessage:this.maxSelectionsMessage}),console.log("["+this.$options.name+"][Identifier]",this.responseIdentifier)}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}},beforeUnmount(){this.shapeElements.forEach(e=>{this.removeHotspotListeners(e)})}},l2={ref:"root",class:"qti-hotspot-interaction"},c2={ref:"prompt",class:"qti-prompt-wrapper"},u2={ref:"overlay",class:"qti3-player-hotspot-overlay"};function h2(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",l2,[l.createElementVNode("div",c2,null,512),l.createElementVNode("div",{ref:"hotspotgroup","on:setChecked":t[0]||(t[0]=(...a)=>r.handleSetChecked&&r.handleSetChecked(...a)),class:"qti3-player-hotspot-group"},[l.renderSlot(e.$slots,"default"),(l.openBlock(),l.createElementBlock("svg",u2,null,512))],544)],512)}const d2=B(o2,[["render",h2]]);class f2{constructor(t,i,s){J(this,"moduleAttribute","");J(this,"modulesNode",null);J(this,"itemPathUri","");J(this,"modules",null);J(this,"constants",{BASE_CONFIG:{waitSeconds:60,paths:{}}});return this.moduleAttribute=t,this.modulesNode=i,this.itemPathUri=s,this}async getConfiguration(t){this.setModules(this.getInteractionModules());let i=null;this.moduleAttribute.length>0&&this.modulesNode===null?i=await this.getConfigurationFromUrl(this.getModules()):i=await this.resolveModules(this.getModules()),t&&t(i)}async resolveModules(t){let i=null;if(t===null)return i;let s=this.constants.BASE_CONFIG;return s=await this.initBaseConfiguration(s,t),i=await this.resolvePrimaryConfigurationModules(s,t),i!==null||(i=await this.resolveSecondaryConfigurationModules(s,t)),i}async initBaseConfiguration(t,i){const s=`${this.getItemPathUri()}modules/module_resolution.js`;if(typeof i.primaryconfiguration>"u"&&typeof i.secondaryConfiguration>"u"){const n=await this.fetchDefaultModuleResolution(s,!1);if(n!==null)return n}return t}async resolvePrimaryConfigurationModules(t,i){let s=[];if(typeof i.primaryconfiguration>"u"){for(let o=0;o<i.module.length;o++){if(typeof i.module[o].primarypath>"u")return null;s.push(this.addPathJs(i.module[o].primarypath)),t.paths[i.module[o].id]=this.stripPathJs(i.module[o].primarypath)}return await this.resolveConfigurationModules(s)?t:null}const n=await this.fetchConfiguration(i.primaryconfiguration,!0,!0);if(n===null)return null;for(const a in n.paths)n.paths[a]=this.stripPathJs(n.paths[a]);for(let a=0;a<i.module.length;a++)typeof i.module[a].primarypath<"u"&&(n.paths[i.module[a].id]=this.stripPathJs(this.addPathJs(i.module[a].primarypath)));return await this.resolveConfigurationPathUrls(n.paths)?n:null}async resolveSecondaryConfigurationModules(t,i){let s=[];if(typeof i.secondaryconfiguration>"u"){for(let o=0;o<i.module.length;o++){if(typeof i.module[o].fallbackpath>"u")return null;s.push(this.addPathJs(i.module[o].fallbackpath)),t.paths[i.module[o].id]=this.stripPathJs(i.module[o].fallbackpath)}return await this.resolveConfigurationModules(s)?t:null}const n=await this.fetchConfiguration(i.secondaryconfiguration,!1,!0);if(n===null)return null;for(const a in n.paths)n.paths[a]=this.stripPathJs(n.paths[a]);for(let a=0;a<i.module.length;a++)typeof i.module[a].fallbackpath<"u"&&(n.paths[i.module[a].id]=this.stripPathJs(this.addPathJs(i.module[a].fallbackpath)));return await this.resolveConfigurationPathUrls(n.paths)?n:null}async resolveConfigurationPathUrls(t){let i=[];for(let n=0;n<t.length;n++)i.push(t[n]);return await this.resolveConfigurationModules(i)}async resolveConfigurationModules(t){return await Promise.all(t.map(s=>fetch(s).then(n=>{if(n.ok)return console.log("[PCI Parent] Module Loader Success:",s),n;throw new Error(s)}))).catch(s=>(console.log("[PCI Parent] Module Loader Failure:",s.message),null))!==null}async getConfigurationFromUrl(t){let i=null;return t===null||(typeof t.primaryconfiguration<"u"&&(i=await this.fetchConfiguration(t.primaryconfiguration,!0,!1)),i!==null)||typeof t.secondaryconfiguration<"u"&&(i=await this.fetchConfiguration(t.secondaryconfiguration,!1,!1)),i}async fetchConfiguration(t,i,s){try{const n=await fetch(t);if(!n.ok)throw new Error(`HTTP error: ${n.status}`);const r=await n.json();let a=r.paths;for(let o in a)a[o]!==null&&!a[o].startsWith("http")&&(s?a[o]=`${this.getConfigurationRelativePath(t)}${a[o]}`:a[o]=`${this.getItemPathUri()}${a[o]}`);return r}catch(n){return console.log((i?"Primary":"Fallback")+"configuration Fetch error:",n),null}}async fetchDefaultModuleResolution(t,i){try{const s=await fetch(t);if(!s.ok)throw new Error(`HTTP error: ${s.status}`);const n=await s.json();let r=n.paths;for(let a in r)r[a]!==null&&!r[a].startsWith("http")&&(i?r[a]=`${this.getConfigurationRelativePath(t)}${r[a]}`:r[a]=`${this.getItemPathUri()}${r[a]}`);return n}catch(s){return console.log("module_resolution.js Fetch error:",s),null}}getItemPathUri(){return this.itemPathUri}getModules(){return this.modules}setModules(t){this.modules=t}getInteractionModules(){let t={};if(this.modulesNode===null)return t={primaryconfiguration:"modules/module_resolution.js",secondaryconfiguration:"modules/fallback_module_resolution.js"},this.addPackagePath(t);const i=this.modulesNode.getPrimaryConfiguration();i.length>0&&(t.primaryconfiguration=i);const s=this.modulesNode.getSecondaryConfiguration();s.length>0&&(t.secondaryconfiguration=s),t.module=[];let n=this.modulesNode.getModules();for(let r=0;r<n.length;r++){let a={id:n[r].getId()};n[r].getPrimaryPath().length>0&&(a.primarypath=n[r].getPrimaryPath()),n[r].getFallbackPath().length>0&&(a.fallbackpath=n[r].getFallbackPath()),t.module.push(a)}return this.addPackagePath(t)}addPackagePath(t){for(let s in{primaryconfiguration:"",secondaryconfiguration:""})s in t&&t[s]!==null&&!t[s].startsWith("http")&&(t[s]=this.getAbsolutePath(this.getItemPathUri(),t[s]));let i=t.module;if(i!=null)for(let s=0;s<i.length;s++){let n=i[s];for(let r in{primarypath:"",fallbackpath:""})r in n&&n[r]!==null&&!n[r].startsWith("http")&&(n[r]=this.getAbsolutePath(this.getItemPathUri(),n[r]))}return t}getAbsolutePath(t,i){let s=t.split("/"),n=i.split("/");s.pop();for(var r=0;r<n.length;r++)n[r]!="."&&(n[r]==".."?s.pop():s.push(n[r]));return s.join("/")}getConfigurationRelativePath(t){if(t===null||t.length===0)return"";const i=t.lastIndexOf("/");return i<0?"":t.substring(0,i+1)}stripPathJs(t){return t===null?null:t.endsWith(".js")?t.slice(0,t.lastIndexOf(".")):t}addPathJs(t){return t===null?null:t.length>0&&!t.endsWith(".js")?`${t}.js`:t}}const Uh=new G,pw=new ie,p2={name:"QtiPortableCustomInteraction",props:{responseIdentifier:{required:!0,type:String},customInteractionTypeIdentifier:{required:!0,type:String},module:{required:!1,type:String,default:""},dataItemPathUri:{required:!1,type:String,default:""}},inheritAttrs:!0,data(){return{response:null,state:null,baseType:null,cardinality:null,isValidResponse:!0,isQtiValid:!0,hasPrompts:!1,pciModuleResolver:null,loadIframeHandler:null,renderer:"",classAttribute:"",properties:{},modulesNode:null,modules:null,configuration:null,templateVariables:[],contextVariables:[],uniqueId:null,pciIframe:null,isReady:!1,initialWidth:0,priorState:null}},methods:{getResponse(){return this.response},setResponse(e){this.response=e},getState(){return this.state},setState(e){this.state=e},getStateRequest(){this.pciIframe.contentWindow.postMessage({message:"PciGetState_Request"},"*")},getIsValid(){return this.isValidResponse},setIsValid(e){this.isValidResponse=e},getInvalidResponseMessage(){return""},resetValue(){console.log("[ResetValue][identifier]",this.responseIdentifier),this.priorState=null},restoreValue(e,t){this.setResponse(e),this.setState(t)},getCardinality(){let e=_.getResponseDeclaration(this.responseIdentifier);return this.cardinality=e.cardinality,this.cardinality},getBaseType(){let e=_.getResponseDeclaration(this.responseIdentifier);return this.baseType=e.baseType,this.baseType},getPrompts(e){let t=[];return e.default().forEach(i=>{typeof i.type<"u"&&i.type.name==="QtiPrompt"&&t.push(i)}),t},movePrompt(){if(!this.hasPrompts)return;const e=this.$refs.root.querySelector(".qti-prompt");e!==null&&this.$refs.prompt.appendChild(e)},computeState(){return{}},computeIsValid(){return!0},evaluateValidity(){const e=this.getIsValid(),t=this.computeIsValid();e!==t&&this.updateValidity(t)},updateValidity(e){this.setIsValid(e),_.setInteractionIsValidResponse({identifier:this.responseIdentifier,isValidResponse:e})},validateChildren(){if(!this.$slots.default)return;let e=!1,t=!1,i=!1,s=!1,n=!1;this.$slots.default().forEach(r=>{if(Uh.isValidSlot(r)){if(r.type.name==="QtiPrompt"){if(t||i||s||n)throw new c("Invalid element order. qti-prompt must be the first element");if(!e)return e=!0;throw new c("Maximum of 1 qti-prompt element permitted")}if(r.type.name==="QtiInteractionModules"){if(t||s||n)throw new c("Invalid element order: qti-interaction-modules");if(!i)return i=!0;throw new c("Maximum of 1 qti-interaction-modules element permitted")}if(r.type.name==="QtiInteractionMarkup"){if(s||n)throw new c("Invalid element order: qti-interaction-markup");if(!t)return t=!0;throw new c("Maximum of 1 qti-interaction-markup element permitted")}if(r.type.name==="QtiTemplateVariable"){if(s)throw new c("Invalid element order: qti-template-variable");if(!n)return n=!0;throw new c("Maximum of 1 qti-interaction-markup element permitted")}if(r.type.name==="QtiContextVariable")return s=!0;if(r.type.name==="QtiStylesheet")return!0;throw new c('Node is not permitted inside QtiPortableCustomInteraction: "'+r.type.name+'"')}})},processChildren(){const e=this.$.subTree.children[1].children[0].children;e!==null&&(e.forEach(t=>{if(t.component===null)return;const i=t.component.proxy;switch(t.type.name){case"QtiInteractionMarkup":this.markup=i.getMarkup();break;case"QtiInteractionModules":this.modulesNode=i;break;case"QtiTemplateVariable":this.templateVariables.push(i);break;case"QtiContextVariable":this.contextVariables.push(i);break}}),this.priorState!==null&&this.restoreValue(this.priorState.value,this.priorState.state),this.initialWidth=this.$refs.root.clientWidth)},disable(){},enable(){},getPriorState(e){const t=_.getItemContextStateVariable(e);if(t===null)return null;if(!("value"in t))throw new O('PCI State Invalid. "value" property not found.');if(!("state"in t))throw new O('PCI State Invalid. "state" property not found.');return t},createId(){return"pci_"+Uh.randomString(5,"a")},initialize(){this.setProperties(this.getPciProperties()),this.pciModuleResolver=new f2(this.module,this.modulesNode,this.dataItemPathUri),this.pciModuleResolver.getConfiguration((function(e){this.setConfiguration(e),console.log("[PCI Parent] PCI Configuration:",e),e!==null&&this.loadPciIframe(this.initialWidth)}).bind(this))},loadPciIframe(e){const t=document.createElement("iframe");t.name=this.uniqueId,t.id=this.uniqueId,t.setAttribute("scrolling","no"),t.style.border="none",t.style.width=`${e}px`,t.addEventListener("load",this.loadIframeHandler),t.src=`${this.renderer}?identifier=${this.responseIdentifier}&uniqueId=${this.uniqueId}`,this.$refs.ic.appendChild(t)},handleLoadIframe(e){this.pciIframe=e.target},getItemPathUri(){return this.dataItemPathUri},getPciProperties(){let e=this.$refs.root;const t={};for(let i in e.dataset)i!=="uniqueId"&&(t[i]=e.dataset[i]);return t},getProperties(){return this.properties},setProperties(e){this.properties=e},getContextVariables(){let e={};for(let t=0;t<this.contextVariables.length;t++)e[this.contextVariables[t].getIdentifier()]=this.contextVariables[t].evaluate();return e},getTemplateVariables(){let e={};for(let t=0;t<this.templateVariables.length;t++)e[this.templateVariables[t].getIdentifier()]=this.templateVariables[t].evaluate();return e},getModules(){return this.modules},setModules(e){this.modules=e},getConfiguration(){return this.configuration},setConfiguration(e){this.configuration=e},getClassAttribute(){return this.classAttribute},setClassAttribute(e){this.classAttribute=e},copyAttributes(e,t,i){return e.forEach(function(s){let n=s.replace("-","");t[n]=i.getAttribute(s)}),t},getResponseVariable(){let e=pw.valueToPciJson(this.getResponse(),this.baseType,this.cardinality),t={};return t[this.responseIdentifier]=e,t},pciInitialize(){let e={typeIdentifier:this.customInteractionTypeIdentifier,classAttribute:this.getClassAttribute(),markup:this.markup,properties:this.getProperties(),boundTo:this.getResponseVariable(),templateVariables:this.getTemplateVariables(),contextVariables:this.getContextVariables(),module:this.module,modules:this.getModules(),moduleResolution:this.getConfiguration(),status:_.getItemLifecycleStatus()},t={message:"PciLoadInteraction",pci:JSON.stringify(e)};this.priorState!==null&&(t.state=JSON.stringify({response:pw.valueToPciJson(this.getResponse(),this.baseType,this.cardinality),state:this.getState()})),this.pciIframe.contentWindow.postMessage(t,"*")},pciResizeIframe(e,t){this.pciIframe!==null&&(this.pciIframe.style.height=`${e}px`,this.pciIframe.style.width=`${t}px`)},pciResizeIframeWidthToContainer(){this.pciIframe!==null&&(this.pciIframe.style.width=`${this.$refs.ic.clientWidth}px`)},pciSaveState(e){const t=JSON.parse(e);typeof t.response<"u"?this.setResponse(t.response):this.setResponse(null),typeof t.state<"u"?this.setState(t.state):this.setState(null),this.notifyInteractionStateReady()},pciSetReady(){this.isReady=!0},pciIsReady(){return this.pciIframe!==null&&this.isReady},notifyInteractionStateReady(){_.NotifyInteractionStateReady({identifier:this.responseIdentifier})}},created(){try{this.responseDeclaration=Uh.validateResponseIdentifierAttribute(_,this.responseIdentifier),this.validateChildren(),this.renderer=_.getPciContextRenderer(),this.loadIframeHandler=this.handleLoadIframe.bind(this);const e=typeof this.$.vnode.props.class<"u"?this.$.vnode.props.class:"";this.setClassAttribute(e),this.priorState=this.getPriorState(this.responseIdentifier),this.hasPrompts=this.getPrompts(this.$slots).length>0,this.cardinality=this.getCardinality(),this.baseType=this.getBaseType(),this.uniqueId=this.createId()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.movePrompt(),this.processChildren(),_.defineInteraction({identifier:this.responseIdentifier,interactionType:"PortableCustom",node:this,resetValue:this.resetValue,disable:this.disable,isValidResponse:this.getIsValid(),invalidResponseMessage:this.getInvalidResponseMessage(),maxSelectionsMessage:""}),this.initialize(),console.log("["+this.$options.name+"][Identifier]",this.responseIdentifier)}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}},beforeUnmount(){this.pciIframe!==null&&this.pciIframe.removeEventListener("load",this.loadIframeHandler)}},m2={ref:"root",class:"qti-portable-custom-interaction"},g2={ref:"prompt",class:"qti-prompt-wrapper"},y2={ref:"pcigroup",class:"qti3-player-pci-group"},w2={ref:"ic",class:"qti3-player-pci-iframe-container"};function b2(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",m2,[l.createElementVNode("div",g2,null,512),l.createElementVNode("div",y2,[l.renderSlot(e.$slots,"default")],512),l.createElementVNode("div",w2,null,512)],512)}const v2=B(p2,[["render",b2]]),E2={name:"QtiPrompt"},T2={class:"qti-prompt"};function C2(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",T2,[l.renderSlot(e.$slots,"default")])}const S2=B(E2,[["render",C2]]),x2=new G,_2={name:"QtiInlineChoice",props:{identifier:{required:!0,type:String},fixed:{required:!1,type:String,default:"false"},templateIdentifier:{required:!1,type:String},showHide:{required:!1,type:String,default:"show"}},data(){return{id:null}},inheritAttrs:!0,methods:{createId(){if(this.$refs.choice.hasAttribute("id")){this.id=this.$refs.choice.getAttribute("id");return}this.id="inlinechoice_"+x2.randomString(5,"a")+"_"+this.identifier,this.$refs.choice.setAttribute("id",this.id)}},created(){},mounted(){this.createId()}},I2=["data-identifier"];function V2(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("li",{ref:"choice",role:"option","data-identifier":i.identifier,class:"qti-inline-choice"},[l.renderSlot(e.$slots,"default")],8,I2)}const A2=B(_2,[["render",V2]]),$2=new G,L2={name:"QtiSimpleChoice",emits:["setChecked","setFocusPreviousChoice","setFocusNextChoice","setActiveDescendant"],props:{identifier:{required:!0,type:String},fixed:{required:!1,type:String,default:"false"},templateIdentifier:{required:!1,type:String},showHide:{required:!1,type:String,default:"show"}},data(){return{id:null,checked:"false",isRadio:!0,role:"radio",tabIndex:"-1",hasMath:!1,isDisabled:!1,parentCardinality:"single"}},inheritAttrs:!0,methods:{handleClick(){if(!this.isDisabled)if(this.isRadio)this.$parent.$emit("setChecked",{identifier:this.identifier,checked:"true"});else{if(this.toggleChecked(),this.parentCardinality==="ordered")return;this.$parent.$emit("setChecked",{identifier:this.identifier,checked:this.checked})}},handleKeydown(e){let t=!1;switch(e.code){case"Space":if(!this.isDisabled){if(this.toggleChecked(),this.parentCardinality==="ordered")return;this.$parent.$emit("setChecked",{identifier:this.identifier,checked:this.checked})}t=!0;break;case"Enter":if(!this.isDisabled){if(this.toggleChecked(),this.parentCardinality==="ordered")return;this.$parent.$emit("setChecked",{identifier:this.identifier,checked:this.checked})}t=!0;break;case"ArrowUp":case"ArrowLeft":this.isRadio&&(this.$parent.$emit("setFocusPreviousChoice",this.identifier),t=!0);break;case"ArrowDown":case"ArrowRight":this.isRadio&&(this.$parent.$emit("setFocusNextChoice",this.identifier),t=!0);break}t&&(e.stopPropagation(),e.preventDefault())},handleFocus(){this.parentCardinality!=="ordered"&&this.$parent.$emit("setActiveDescendant",this.id)},handleBlur(){},setChecked(e){this.checked=e?"true":"false"},isChecked(){return this.checked==="true"},setTabIndex(e){this.tabIndex=e},setFocus(){this.$refs.choice.focus()},setBlur(){this.$refs.choice.blur()},toggleChecked(){this.checked=this.checked==="true"?"false":"true"},setLabel(e){this.$refs.label.innerText=e},hideLabel(){this.$refs.label.classList.add("qti-hidden")},showLabel(){this.$refs.label.classList.remove("qti-hidden")},setLabelSbac(e){this.$refs.choice.classList.add("sbac"),this.$refs.choice.setAttribute("data-label",e),this.$refs.label.innerText=e,this.$refs.label.classList.add("qti-visually-hidden")},setChoiceLrn(){this.$refs.choice.classList.add("lrn")},hideControl(){this.$refs.choice.classList.add("control-hidden")},setIsDisabled(e){this.isDisabled=e},initializeChoice(){switch(this.parentCardinality=this.$parent.cardinality,this.parentCardinality){case"ordered":this.role="button",this.isRadio=!1,this.tabIndex=0;break;case"multiple":this.role="checkbox",this.isRadio=!1,this.tabIndex=0;break;default:this.role="radio",this.isRadio=!0,this.tabIndex=-1;break}},initializeOrderChoice(){this.role==="button"&&(this.hideLabel(),this.hideControl())},createId(){if(this.$refs.choice.hasAttribute("id")){this.id=this.$refs.choice.getAttribute("id");return}this.id="choice_"+$2.randomString(5,"a")+"_"+this.identifier,this.$refs.choice.setAttribute("id",this.id)},setExpectedSolution(){this.$refs.choice.classList.add("player-show-solution","player-choice-expected")},setCorrectSolution(){this.$refs.choice.classList.add("player-show-solution","player-choice-correct")},setIncorrectSolution(){this.$refs.choice.classList.add("player-show-solution","player-choice-incorrect")},setIgnoreSolution(){this.$refs.choice.classList.remove("player-show-solution","player-choice-incorrect","player-choice-correct","player-choice-expected")}},created(){this.initializeChoice()},mounted(){this.initializeOrderChoice(),this.createId()}},M2=["role","aria-checked","tabindex","data-identifier"],N2={ref:"label",class:"qti-choice-label"},R2={ref:"description",class:"qti-choice-description"};function k2(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("li",{ref:"choice",role:n.role,"aria-checked":n.checked,tabindex:n.tabIndex,"data-identifier":i.identifier,onFocus:t[0]||(t[0]=(...a)=>r.handleFocus&&r.handleFocus(...a)),onBlur:t[1]||(t[1]=(...a)=>r.handleBlur&&r.handleBlur(...a)),onClick:t[2]||(t[2]=(...a)=>r.handleClick&&r.handleClick(...a)),onKeydown:t[3]||(t[3]=(...a)=>r.handleKeydown&&r.handleKeydown(...a)),class:l.normalizeClass(["qti-simple-choice",{source:n.role=="button"}])},[l.createElementVNode("div",{class:l.normalizeClass(["qti-simple-choice-wrapper",{draggable:n.role=="button"}]),style:{width:"100%"}},[l.createElementVNode("div",N2,null,512),l.createElementVNode("div",R2,[l.renderSlot(e.$slots,"default")],512)],2)],42,M2)}const q2=B(L2,[["render",k2]]),O2=new G,B2={name:"QtiSimpleAssociableChoice",props:{identifier:{required:!0,type:String},fixed:{required:!1,type:String,default:"false"},templateIdentifier:{required:!1,type:String},showHide:{required:!1,type:String,default:"show"},matchGroup:{required:!1,type:String,default:""},matchMax:{required:!0,type:String},matchMin:{required:!1,type:String,default:"0"}},data(){return{id:null}},methods:{createId(){if(this.$refs.choice.hasAttribute("id")){this.id=this.$refs.choice.getAttribute("id");return}this.id="choice_"+O2.randomString(5,"a")+"_"+this.identifier,this.$refs.choice.setAttribute("id",this.id)}},mounted(){this.createId()}},P2=["data-identifier","data-match-max","data-match-min","data-match-group"],D2={ref:"description",class:"choice-description"};function Q2(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("li",{ref:"choice","data-identifier":i.identifier,"data-match-max":i.matchMax,"data-match-min":i.matchMin,"data-match-group":i.matchGroup,class:"qti-simple-associable-choice"},[l.createElementVNode("div",D2,[l.renderSlot(e.$slots,"default")],512)],8,P2)}const H2=B(B2,[["render",Q2]]),F2=new G,U2={name:"QtiAssociableHotspot",props:{identifier:{required:!0,type:String},templateIdentifier:{required:!1,type:String},showHide:{required:!1,type:String,default:"show"},matchGroup:{required:!1,type:String,default:""},shape:{required:!0,type:String},coords:{required:!0,type:String},hotspotLabel:{required:!1,type:String,default:""},ariaLabel:{required:!1,type:String,default:""},matchMax:{required:!0,type:String},matchMin:{required:!1,type:String,default:"0"}},data(){return{shapeData:null,shapeColorProperties:null,isQtiValid:!0}},inheritAttrs:!0,methods:{getIdentifier(){return this.identifier},getShape(){return this.shape},getShapeData(){return this.shapeData},setShapeData(){const e=this.coords.split(",");switch(this.getShape()){case"circle":if(e.length!=3)return;this.shapeData=e;return;case"rect":if(e.length!==4)return;e[2]=parseInt(e[2])-parseInt(e[0]),e[3]=parseInt(e[3])-parseInt(e[1]),this.shapeData=e;return;case"poly":this.shapeData=this.transformPolyCoords(e);return;case"ellipse":if(e.length!=4)return;this.shapeData=e;return;case"default":this.shapeData="";return}},transformPolyCoords(e){let t=[];if(e.length%2!=0)return t;for(let i=0;i<e.length;i+=2)t.push(`${e[i]} ${e[i+1]}`);return t},initialize(){F2.validateShapeAttribute(this.shape),this.setShapeData()}},created(){try{this.initialize()}catch(e){if(this.isQtiValid=!1,e.name==="QtiValidationException")throw new c(e.message)}},mounted(){if(this.isQtiValid)try{console.log("["+this.$options.name+"][Identifier]",this.identifier)}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}}},G2=["data-identifier","data-match-max","data-match-min","data-match-group"];function j2(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",{ref:"gap","data-identifier":i.identifier,"data-match-max":i.matchMax,"data-match-min":i.matchMin,"data-match-group":i.matchGroup,class:"ggm-gap"},null,8,G2)}const W2=B(U2,[["render",j2]]),z2=new G,K2=new ie,Y2={name:"QtiSimpleMatchSet",data(){return{choices:[],isShuffle:!1,isQtiValid:!0}},methods:{getChoices(){return this.choices},setIsShuffle(e){this.isShuffle=e},createContainer(e,t){let i=[];return e===null?(this.choices.forEach(n=>{i.push({fixed:n.fixed==="true",node:n})}),this.isShuffle&&K2.shuffleArrayFixed(i),i):(e.state.orders[t].forEach(n=>{const r=this.findChoiceByIdentifier(n,this.choices);r!==null&&i.push({fixed:r.fixed==="true",node:r})},this),i)},processContainerChoices(e){this.choices.splice(0,this.choices.length),this.$refs.matchset.innerHTML="",e.forEach(t=>{this.$refs.matchset.appendChild(t.node.$el),this.choices.push(t.node)},this)},validateChildren(){let e=0;if(!this.$slots.default)throw new c("Must have at least 1 qti-simple-associable-choice");if(this.$slots.default().forEach(t=>{if(z2.isValidSlot(t)){if(t.type.name==="QtiSimpleAssociableChoice")return e+=1;throw new c('Node is not a qti-simple-associable-choice: "'+t.type.name+'"')}}),e===0)throw new c("Must have at least 1 qti-simple-associable-choice")},processChildren(){this.$.subTree.children[0].children.forEach(t=>{t.component!==null&&this.choices.push(t.component.proxy)})},findChoiceByIdentifier(e,t){for(let i=0;i<t.length;i++)if(t[i].$el.getAttribute("data-identifier")===e)return t[i];throw new O('Match Interaction State Invalid. Choice identifier "'+e+'" not found.')}},created(){try{this.validateChildren()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.processChildren(),console.log("["+this.$options.name+"]")}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}}},X2={ref:"matchset",class:"qti-simple-match-set"};function Z2(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("ul",X2,[l.renderSlot(e.$slots,"default")],512)}const J2=B(Y2,[["render",Z2]]);class eq{constructor(t){this.constants={QTI_CHOICES_TOP:"qti-choices-top",QTI_CHOICES_BOTTOM:"qti-choices-bottom",QTI_CHOICES_LEFT:"qti-choices-left",QTI_CHOICES_RIGHT:"qti-choices-right",DATA_MAX_SELECTIONS_MESSAGE:"data-max-selections-message",DATA_MIN_SELECTIONS_MESSAGE:"data-min-selections-message",DATA_CHOICES_CONTAINER_WIDTH:null},this.parentClass=t,this.clazzTokens=[],this.gapMatchGroupElement=null,this.gapChoiceWrapperElement=null,this.gapTargetWrapperElement=null,this.choicesContainerWidth=null,this.gapChoices=[],this.gaps=[],this.presentation_Choices_Orientation=null,this.presentation_MaxSelectionsMessage="",this.presentation_MinSelectionsMessage=""}initialize(t,i,s,n,r,a){this.gapMatchGroupElement=t,this.gapChoiceWrapperElement=i,this.gapTargetWrapperElement=s,this.choicesContainerWidth=n,this.gapChoices=r,this.gaps=a,this.processRootClassAttribute(this.parentClass),this.processPresentation()}processRootClassAttribute(t){const i=t.split(" ");for(let s=0;s<i.length;s++)switch(i[s]){case this.constants.QTI_CHOICES_TOP:case this.constants.QTI_CHOICES_BOTTOM:case this.constants.QTI_CHOICES_LEFT:case this.constants.QTI_CHOICES_RIGHT:this.presentation_Choices_Orientation=i[s];break}this.clazzTokens=i}processPresentation(){this.presentation_Choices_Orientation===null&&(this.presentation_Choices_Orientation=this.constants.QTI_CHOICES_TOP),this.presentation_Choices_Orientation===this.constants.QTI_CHOICES_LEFT?(this.gapChoiceWrapperElement.classList.add(this.constants.QTI_CHOICES_LEFT),this.gapTargetWrapperElement.classList.add(this.constants.QTI_CHOICES_LEFT),this.gapMatchGroupElement.classList.add(this.constants.QTI_CHOICES_LEFT)):this.presentation_Choices_Orientation===this.constants.QTI_CHOICES_TOP?(this.gapChoiceWrapperElement.classList.add(this.constants.QTI_CHOICES_TOP),this.gapTargetWrapperElement.classList.add(this.constants.QTI_CHOICES_TOP)):this.presentation_Choices_Orientation===this.constants.QTI_CHOICES_RIGHT?(this.gapChoiceWrapperElement.classList.add(this.constants.QTI_CHOICES_RIGHT),this.gapTargetWrapperElement.classList.add(this.constants.QTI_CHOICES_RIGHT),this.gapMatchGroupElement.classList.add(this.constants.QTI_CHOICES_RIGHT),this.gapMatchGroupElement.insertBefore(this.gapTargetWrapperElement,this.gapChoiceWrapperElement)):this.presentation_Choices_Orientation===this.constants.QTI_CHOICES_BOTTOM&&(this.gapChoiceWrapperElement.classList.add(this.constants.QTI_CHOICES_BOTTOM),this.gapTargetWrapperElement.classList.add(this.constants.QTI_CHOICES_BOTTOM),this.gapMatchGroupElement.insertBefore(this.gapTargetWrapperElement,this.gapChoiceWrapperElement)),this.processChoicesContainerWidth(),this.processGaps()}processChoicesContainerWidth(){this.choicesContainerWidth!==null&&(this.gapChoiceWrapperElement.style.width=`${this.choicesContainerWidth}px`)}processGaps(){for(let t=0;t<this.gaps.length;t++)this.gaps[t].classList.add("target")}}class tq{constructor(t,i){J(this,"options",{interactionSubType:"default",cardinality:"single",maxAssociations:0,response:null,onReady:null,onUpdate:null,onSelectionsLimit:null});return this.qtiAttributeValidation=new G,this.wrapper=t,this.sourcewrapper=this.wrapper.querySelector(".qti-gap-match-source-wrapper"),this.targetwrapper=this.wrapper.querySelector(".qti-gap-match-target-wrapper"),this.processOptions(i),this.handleDragStart=this.handleDragStart.bind(this),this.handleDragMove=this.handleDragMove.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.handleTouchStart=this.handleTouchStart.bind(this),this.handleTouchMove=this.handleTouchMove.bind(this),this.handleTouchEnd=this.handleTouchEnd.bind(this),this.itemTarget=null,this.itemStart=null,this.isItemStartSource=!0,this.initialX=0,this.initialY=0,this.offsetX=0,this.offsetY=0,this.startingX=0,this.startingY=0,this.currentAssociationsCount=0,this.isDisabled=!1,this.currentDragger=null,this.initializeSources(this.sourcewrapper),this.initializeTargets(this.targetwrapper),this.restoreResponse(this.options.response),this.notifyReady(),this}processOptions(t){"interactionSubType"in t&&(this.options.interactionSubType=t.interactionSubType),"cardinality"in t&&(this.options.cardinality=t.cardinality),"response"in t&&(this.options.response=t.response),"maxAssociations"in t&&(this.options.maxAssociations=t.maxAssociations),"onReady"in t&&(this.options.onReady=t.onReady),"onUpdate"in t&&(this.options.onUpdate=t.onUpdate),"onAssociationsLimit"in t&&(this.options.onAssociationsLimit=t.onAssociationsLimit)}notifyReady(){this.options.onReady!==null&&this.options.onReady({response:this.getResponse()})}notifyUpdate(){this.options.onUpdate!==null&&this.options.onUpdate({response:this.computeResponse()})}notifyAssociationsLimit(){this.options.onAssociationsLimit!==null&&this.options.onAssociationsLimit()}toggleDisable(t){this.isDisabled=t,this.draggers.forEach(i=>{t?i.classList.add("disabled"):i.classList.remove("disabled")})}handleDragStart(t){if(t.preventDefault(),!this.isDisabled&&t.button==0)return this.interactionStart(t.target,t.clientX,t.clientY,!1),!1}handleTouchStart(t){if(t.preventDefault(),!this.isDisabled)return t.targetTouches.length!=1||this.interactionStart(t.target,t.touches[0].pageX,t.touches[0].pageY,!0),!1}interactionStart(t,i,s,n){const r=this.getClosestElement(t,"draggable");this.itemStart=r.parentNode,this.isItemStartSource=this.itemStart.classList.contains("source"),this.identifyTargets(this.itemStart,!0),this.itemTarget=null;const a=r.getBoundingClientRect();this.initialX=i,this.initialY=s,this.startingX=a.left,this.startingY=a.top,this.offsetX=i-this.startingX,this.offsetY=s-this.startingY,this.addPlaceholder(r),r.style.userSelect="none",r.style.width=a.width+"px",r.style.height=a.height+"px",r.style.transform=`translateX(${a.left}px) translateY(${a.top}px) translateZ(0)`,r.classList.add("dragging"),this.setCurrentDragger(r),this.addListeners(r,n)}handleDragMove(t){t.preventDefault(),!this.isDisabled&&this.interactionMove(t.clientX,t.clientY)}handleTouchMove(t){t.preventDefault(),!this.isDisabled&&t.targetTouches.length==1&&this.interactionMove(t.touches[0].clientX,t.touches[0].clientY)}interactionMove(t,i){const s=this.currentDragger;this.offsetX=t-this.initialX,this.offsetY=i-this.initialY,this.constrainDraggerToWrapper(s,this.wrapper),s.style.transform=`translateX(${this.startingX+this.offsetX}px) translateY(${this.startingY+this.offsetY}px) translateZ(0) scale(1)`;const n=s.getBoundingClientRect();this.findDraggerItemTarget(s,n,this.targets),this.isItemStartSource||this.findSourceDraggerTarget(s,n)}constrainDraggerToWrapper(t,i){const s=t.getBoundingClientRect(),n=i.getBoundingClientRect(),r=this.startingX+this.offsetX-n.x,a=this.startingY+this.offsetY-n.y,o=this.startingX+s.width+this.offsetX-(n.x+n.width),u=this.startingY+s.height+this.offsetY-(n.y+n.height);r<0&&(this.offsetX=this.offsetX-r),o>0&&(this.offsetX=this.offsetX-o),a<0&&(this.offsetY=this.offsetY-a),u>0&&(this.offsetY=this.offsetY-u)}handleDragEnd(t){this.isDisabled||this.interactionEnd(t.clientX,t.clientY,!1)}handleTouchEnd(t){this.isDisabled||this.interactionEnd(t.changedTouches[0].clientX,t.changedTouches[0].clientY,!0)}interactionEnd(t,i,s){const n=this.currentDragger;if(this.itemTarget===null?n.style.transform=`translateX(${this.startingX}px) translateY(${this.startingY}px) translateZ(0)`:n.style.transform=`translateX(${this.startingX+this.offsetX}px) translateY(${this.startingY+this.offsetY}px) translateZ(0)`,n.removeAttribute("style"),n.classList.remove("dragging"),this.clearTargetHighlights(),this.itemTarget===null){this.resetDraggerToItemStart(this.itemStart,n),this.setCurrentDragger(null),this.removeListeners(n,s);return}if(this.itemTarget.classList.contains("active")){if(this.itemTarget.classList.remove("active"),this.isExceedingMaxAssociations(this.itemStart,this.itemTarget,n)){this.resetDraggerToItemStart(this.itemStart,n),this.notifyAssociationsLimit(),this.setCurrentDragger(null),this.removeListeners(n,s);return}if(this.itemStart.getAttribute("data-identifier")===this.itemTarget.getAttribute("data-identifier")){this.resetDraggerToItemStart(this.itemStart,n),this.setCurrentDragger(null),this.removeListeners(n,s);return}this.removePlaceholder(n),this.setDraggerToItemTarget(this.itemTarget,n),this.itemTarget.classList.contains("source")&&(this.itemTarget.classList.add("full"),this.itemTarget.dataset.matchMax*1>0&&this.incrementRemaining(this.itemTarget),this.decrementAssociationsCount(),this.sortContainerElements(this.sourcewrapper)),this.itemStart.classList.contains("source")&&(this.itemStart.dataset.matchMax*1>0&&this.decrementRemaining(this.itemStart)===0&&this.itemStart.classList.remove("full"),this.incrementAssociationsCount()),this.itemStart.classList.contains("target")&&(this.isTargetFull(this.itemStart)?this.itemStart.classList.add("full"):this.itemStart.classList.remove("full")),this.notifyUpdate()}this.setCurrentDragger(null),this.removeListeners(n,s)}setCurrentDragger(t){this.currentDragger=t}resetDraggerToItemStart(t,i){this.replacePlaceholder(i),t.classList.contains("source")||i.setAttribute("style","width:100%")}setDraggerToItemTarget(t,i){if(t.classList.contains("source")){if(t.classList.contains("full")){const s=t.querySelector(".draggable");s!=null&&t.replaceChild(i,s);return}t.append(i);return}t.append(i),i.setAttribute("style","width:100%"),this.isTargetFull(t)?t.classList.add("full"):t.classList.remove("full")}findDraggerItemTarget(t,i,s){this.itemTarget=null,s.forEach(n=>{const r=n.getBoundingClientRect();if(i.top+t.offsetHeight/2<r.bottom&&i.right-t.offsetWidth/2>r.left&&i.bottom-t.offsetHeight/2>r.top&&i.left+t.offsetWidth/2<r.right){if(this.isItemStartSource&&n.classList.contains("source")||n.classList.contains("full")||!this.hasMatchingMatchGroup(t.parentNode,n))return;n.classList.add("active"),this.itemTarget=n}else n.classList.remove("active")},this)}findSourceDraggerTarget(t,i){const s=this.sourcewrapper.getBoundingClientRect();if(i.top+t.offsetHeight/2<s.bottom&&i.right-t.offsetWidth/2>s.left&&i.bottom-t.offsetHeight/2>s.top&&i.left+t.offsetWidth/2<s.right){for(let n=0;n<this.sources.length;n++)if(this.sources[n].dataset.identifier===t.dataset.identifier){this.sources[n].classList.add("active"),this.itemTarget=this.sources[n];break}}else for(let n=0;n<this.sources.length;n++)this.sources[n].classList.contains("active")&&this.sources[n].classList.remove("active")}addPlaceholder(t){if(!t.parentNode.classList.contains("source")){this.addPlaceholderElement(t,!1);return}const i=t.parentNode.dataset.matchMax*1;if(i===1){this.addPlaceholderElement(t,!1);return}if(i===0){this.addPlaceholderElement(t,!0);return}if(this.getRemaining(t.parentNode)===1){this.addPlaceholderElement(t,!1);return}this.addPlaceholderElement(t,!0)}addPlaceholderElement(t,i){const s=t.cloneNode(!0);this.deepCloneId(s),i?(s.classList.add("clone"),s.addEventListener("mousedown",this.handleDragStart),s.addEventListener("touchstart",this.handleTouchStart)):s.classList.add("gm-dragger-placeholder"),s.classList.add("placeholder-fade"),t.parentNode.insertBefore(s,t)}removePlaceholder(t){if(t.parentNode.classList.contains("target")){const n=t.parentNode.querySelector(".gm-dragger-placeholder");if(n===null)return;t.parentNode.removeChild(n);return}const i=t.parentNode.dataset.matchMax*1,s=t.parentNode.querySelector(".gm-dragger-placeholder");if(s===null){const n=t.parentNode.querySelector(".clone");if(n===null)return;n.classList.remove("placeholder-fade");return}i!==0&&t.parentNode.removeChild(s)}replacePlaceholder(t){const i=t.parentNode;let s=i.querySelector(".gm-dragger-placeholder");if(i.classList.contains("source")){if(s==null&&(s=i.querySelector(".draggable")),s===null)return;i.replaceChild(t,s);return}s!==null&&i.replaceChild(t,s)}addClonePlaceholder(t){const i=t.cloneNode(!0);this.deepCloneId(i),i.classList.add("clone"),t.parentNode.insertBefore(i,t),i.addEventListener("mousedown",this.handleDragStart),i.addEventListener("touchstart",this.handleTouchStart)}initializeSources(t){this.sources=t.querySelectorAll(".source"),this.sources.forEach(i=>{i.classList.add("full");const s=i.dataset.matchMax*1;this.setRemaining(i,s===0?1e3:s)},this),this.draggers=t.querySelectorAll(".draggable"),this.draggers.forEach((i,s)=>{const n=i.parentNode.getAttribute("data-identifier");i.setAttribute("data-identifier",n),i.setAttribute("data-order",s),i.setAttribute("tabindex",0),i.addEventListener("mousedown",this.handleDragStart),i.addEventListener("touchstart",this.handleTouchStart)},this)}initializeTargets(t){this.targets=t.querySelectorAll(".target"),this.targets.forEach(i=>{i.setAttribute("tabindex",0)})}identifyTargets(t,i){this.targets.forEach(s=>{i&&!s.classList.contains("full")&&this.hasMatchingMatchGroup(t,s)&&s.classList.add("target-active")},this),i&&!this.isItemStartSource&&this.sourcewrapper.classList.add("target-active")}addListeners(t,i){i?(this.removeListeners(t,i),t.addEventListener("touchmove",this.handleTouchMove),t.addEventListener("touchend",this.handleTouchEnd)):(this.removeListeners(t,i),document.addEventListener("mousemove",this.handleDragMove),document.addEventListener("mouseup",this.handleDragEnd))}removeListeners(t,i){i?(t.removeEventListener("touchmove",this.handleTouchMove),t.removeEventListener("touchend",this.handleTouchEnd)):(document.removeEventListener("mousemove",this.handleDragMove),document.removeEventListener("mouseup",this.handleDragEnd))}clearTargetHighlights(){this.targets.forEach(t=>{t.classList.remove("target-active")},this),this.sourcewrapper.classList.remove("target-active")}getClosestElement(t,i){return t?t&&t.classList.contains(i)?t:this.getClosestElement(t.parentElement,i):!1}sortContainerElements(t){let i=[],s=t.children;for(let n=0;n<s.length;n++){const r=s[n].querySelector("div.draggable");r&&i.push([1*r.dataset.order,s[n]])}i.sort(function(n,r){return n[0]-r[0]});for(let n=0;n<i.length;n++)t.appendChild(i[n][1])}getResponse(){return this.computeResponse()}computeResponse(){let t=[];return this.targets.forEach(i=>{i.querySelectorAll(".draggable").forEach(s=>{t.push(`${s.dataset.identifier} ${i.dataset.identifier}`)})}),t.length===0?null:this.options.cardinality==="single"?t[0]:t}restoreResponse(t){t!==null&&(this.options.cardinality==="single"?this.restoreResponsePair(t):t.forEach(i=>{this.restoreResponsePair(i)},this))}restoreResponsePair(t){const i=this.getPair(t);if(i===null)return;const s=this.findSourceByIdentifier(i.source),n=this.findTargetGapByIdentifier(i.target);if(s===null||n===null)return;const r=s.querySelector(".draggable");r!==null&&(this.cloneOrEmptySourceDragger(s,r),this.restoreSourceDraggerToTarget(n,r))}cloneOrEmptySourceDragger(t,i){const s=t.dataset.matchMax*1;if(s===1){t.classList.remove("full"),this.decrementRemaining(t);return}if(s===0){this.addClonePlaceholder(i);return}if(this.getRemaining(t)===1){t.classList.remove("full"),this.decrementRemaining(t);return}this.decrementRemaining(t),this.addClonePlaceholder(i)}findSourceByIdentifier(t){for(let i=0;i<this.sources.length;i++)if(t===this.sources[i].dataset.identifier)return this.sources[i];return null}findTargetGapByIdentifier(t){for(let i=0;i<this.targets.length;i++)if(t===this.targets[i].dataset.identifier)return this.targets[i];return null}getPair(t){if(t===null)return null;const i=t.split(" ");return i.length!=2?null:{source:i[0],target:i[1]}}restoreSourceDraggerToTarget(t,i){t===null||i===null||(t.append(i),i.setAttribute("style","width:100%"),this.incrementAssociationsCount(),this.isTargetFull(t)&&t.classList.add("full"))}hasMatchingMatchGroup(t,i){return t===null||i===null?!1:t.dataset.matchGroup===i.dataset.matchGroup}isTargetFull(t){if(t==null)return!1;const i=t.querySelectorAll(".draggable"),s=t.dataset.matchMax*1;return s===0?!1:i.length>=s}isExceedingMaxAssociations(t,i){return!(this.options.maxAssociations===0||i.classList.contains("source")||t.classList.contains("target")||this.currentAssociationsCount<this.options.maxAssociations)}initializeAssociationsCount(){this.currentAssociationsCount=0}incrementAssociationsCount(){this.currentAssociationsCount+=1}decrementAssociationsCount(){this.currentAssociationsCount!==0&&(this.currentAssociationsCount-=1)}getRemaining(t){return t.dataset.remaining*1}setRemaining(t,i){t.setAttribute("data-remaining",i)}incrementRemaining(t){const i=t.dataset.remaining*1+1;return t.setAttribute("data-remaining",i),i}decrementRemaining(t){let i=t.dataset.remaining*1-1;return i=i>=0?i:0,t.setAttribute("data-remaining",i),i}deepCloneId(t){t.id&&(t.id=`clone_${this.qtiAttributeValidation.randomString(5,"a")}`);for(let i=0;i<t.children.length;i++)this.deepCloneId(t.children[i])}reset(){this.resetDraggersToSources(),this.initializeAssociationsCount(),this.destroy()}resetDraggersToSources(){this.targets.forEach(t=>{t.querySelectorAll(".draggable").forEach(s=>{const n=this.findSourceByIdentifier(s.getAttribute("data-identifier"));n.classList.contains("full")||(t.classList.remove("full"),n.classList.contains("full")?t.removeChild(s):(n.append(s),n.classList.add("full")))},this)},this)}destroy(){this.currentDragger!==null&&(document.removeEventListener("mousemove",this.handleDragMove),document.removeEventListener("mouseup",this.handleDragEnd)),this.wrapper.querySelectorAll(".draggable").forEach(i=>{i.removeEventListener("touchstart",this.handleTouchStart),i.removeEventListener("touchmove",this.handleTouchMove),i.removeEventListener("touchend",this.handleTouchEnd),i.removeEventListener("mousedown",this.handleDragStart)},this)}}const iq=new G,sq=new ie,nq={emits:["gapMatchGroupReady","gapMatchGroupUpdate","gapMatchGroupAssociationsLimit"],props:{responseIdentifier:{required:!0,type:String},cardinality:{required:!0,type:String},shuffle:{required:!1,type:String,default:"false"},maxAssociations:{required:!1,type:String,default:"1"},minAssociations:{required:!1,type:String,default:"0"},dataChoicesContainerWidth:{required:!1,type:String,default:null},interactionSubType:{required:!1,type:String,default:"default"},gapMatchInteractionStaticClass:{required:!0,type:String},priorState:{required:!1,type:Object,default:null}},data(){return{choices:[],order:[],gaps:[],response:null,isShuffle:null,hasPrompt:!1,gapMatchInteractionClassAttribute:null,presentationFactory:null,matchable:null,isQtiValid:!0}},computed:{computedMaxAssociations(){return this.maxAssociations*1}},methods:{getResponse(){return this.response},setResponse(e){this.response=e},disable(){this.matchable!==null&&this.matchable.toggleDisable(!0)},enable(){this.matchable!==null&&this.matchable.toggleDisable(!1)},getChoices(){return this.choices},setIsShuffle(e){this.isShuffle=e},validateChildren(){let e=0;this.$slots.default()[0].children.forEach(t=>{if(iq.isValidSlot(t)){if(t.type.name==="QtiPrompt"){if(e>0)throw new c("Invalid element order. qti-prompt must come before qti-gap-text's, qti-gap-img's, or qti-gap's");if(!this.hasPrompt)return this.hasPrompt=!0;throw new c("Maximum of 1 qti-prompt element permitted")}if(t.type.name==="QtiGapText"||t.type.name==="QtiGapImg")return e+=1;throw new c('Node is not one of qti-gap-text or qti-gap-img: "'+t.type.name+'"')}})},processChildren(){this.$.subTree.children[0].children[0].children.forEach(i=>{i.component!==null&&(i.type.name==="QtiGapText"||i.type.name==="QtiGapImg")&&this.choices.push(i.component.proxy)}),this.$refs.root.querySelectorAll(".gap-match-gap").forEach(i=>{this.gaps.push(i)})},insertAfter(e,t){t.parentNode.insertBefore(e,t.nextSibling)},processGroupUI(e){let t=this.createGapChoiceWrapper();if(t==null)return;let i=this.createContainer(this.priorState);this.processContainerChoices(i,t),this.saveContainerOrder(i);let s=this.createGapTargetWrapper(t);this.presentationFactory.initialize(this.$refs.root,t,s,this.dataChoicesContainerWidth,this.choices,this.gaps),this.matchable=new tq(this.$refs.root,{interactionSubType:this.interactionSubType,cardinality:this.cardinality,maxAssociations:this.computedMaxAssociations,response:e,onReady:this.handleWidgetReady,onUpdate:this.handleWidgetUpdate,onAssociationsLimit:this.handleAssociationsLimit})},createGapChoiceWrapper(){let e=this.$refs.root.querySelector(".qti-gap-choice");if(e===null)return null;let t=document.createElement("ul");return t.classList.add("qti-gap-match-source-wrapper"),this.$refs.root.insertBefore(t,e),t},createGapTargetWrapper(e){const t=document.createElement("div");t.classList.add("qti-gap-match-target-wrapper"),this.insertAfter(t,e);const i=t.nextElementSibling;return i!=null&&t.append(i),t},createContainer(e){let t=[];return e===null?(this.choices.forEach(s=>{t.push({fixed:s.fixed==="true",node:s})}),this.isShuffle&&sq.shuffleArrayFixed(t),t):(e.state.order.forEach(s=>{const n=this.findChoiceByIdentifier(s,this.choices);n!==null&&t.push({fixed:n.fixed==="true",node:n})},this),t)},processContainerChoices(e,t){this.choices.splice(0,this.choices.length),t.innerHTML="",e.forEach(i=>{t.appendChild(i.node.$el),this.choices.push(i.node)},this)},saveContainerOrder(e){const t=[];e.forEach(i=>{t.push(i.node.identifier)}),this.order=t},findChoiceByIdentifier(e,t){for(let i=0;i<t.length;i++)if(t[i].$el.getAttribute("data-identifier")===e)return t[i];throw new O('Gap Match Interaction State Invalid. Choice identifier "'+e+'" not found.')},resetGroupUI(){this.processGroupUI(null)},handleWidgetReady(e){this.setResponse(e.response),this.$emit("gapMatchGroupReady",{response:this.getResponse(),order:this.order})},handleWidgetUpdate(e){this.setResponse(e.response),this.$emit("gapMatchGroupUpdate",{response:this.getResponse()})},handleAssociationsLimit(){this.$emit("gapMatchGroupAssociationsLimit")},initializeGapMatchGroup(){this.presentationFactory=new eq(this.gapMatchInteractionStaticClass)}},created(){try{if(typeof this.cardinality>"u")throw new c("Undefined qti-gap-match-interaction cardinality");if(this.cardinality!=="single"&&this.cardinality!=="multiple")throw new c('qti-gap-match-interaction cardinality must be "single" or "multiple"');this.setIsShuffle(this.shuffle==="true"),this.initializeGapMatchGroup(),this.validateChildren()}catch(e){throw this.isQtiValid=!1,console.log("[QtiGapMatchInteraction][ValidationError]",e.name,e.message),new c(e.message)}},mounted(){if(this.isQtiValid)try{this.processChildren(),this.processGroupUI(this.priorState===null?null:this.priorState.value)}catch(e){if(this.isQtiValid=!1,e.name==="QtiValidationException")throw console.log("[QtiGapMatchInteraction][ValidationException]",e.message),new c(e.message);if(e.name==="QtiEvaluationException")throw console.log("[QtiGapMatchInteraction][EvaluationException]",e.message),new O(e.message)}},beforeUnmount(){this.matchable!==null&&(this.matchable.destroy(),this.matchable=null)}},rq={ref:"root",class:"qti-gap-match-group-wrapper"};function aq(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",rq,[l.renderSlot(e.$slots,"default")],512)}const oq=B(nq,[["render",aq]]);class lq{constructor(t){this.constants={QTI_SELECTIONS_LIGHT:"qti-selections-light",QTI_SELECTIONS_DARK:"qti-selections-dark",QTI_UNSELECTED_HIDDEN:"qti-unselected-hidden",QTI_CHOICES_TOP:"qti-choices-top",QTI_CHOICES_BOTTOM:"qti-choices-bottom",QTI_CHOICES_LEFT:"qti-choices-left",QTI_CHOICES_RIGHT:"qti-choices-right",DATA_MAX_SELECTIONS_MESSAGE:"data-max-selections-message",DATA_MIN_SELECTIONS_MESSAGE:"data-min-selections-message",DATA_CHOICES_CONTAINER_WIDTH:null},this.parentClass=t,this.clazzTokens=[],this.ggmGroupElement=null,this.ggmChoiceWrapperElement=null,this.ggmTargetWrapperElement=null,this.image=null,this.choicesContainerWidth=null,this.gapChoices=[],this.gaps=[],this.presentation_Choices_Orientation=null,this.presentation_Theme=this.constants.QTI_SELECTIONS_DARK,this.presentation_UnselectedHidden=!1,this.presentation_MaxSelectionsMessage="",this.presentation_MinSelectionsMessage=""}initialize(t,i,s,n,r,a,o){this.ggmGroupElement=t,this.ggmChoiceWrapperElement=i,this.ggmTargetWrapperElement=s,this.image=n,this.choicesContainerWidth=r,this.gapChoices=a,this.gaps=o,this.processRootClassAttribute(this.parentClass),this.processPresentation()}processRootClassAttribute(t){const i=t.split(" ");for(let s=0;s<i.length;s++)switch(i[s]){case this.constants.QTI_CHOICES_TOP:case this.constants.QTI_CHOICES_BOTTOM:case this.constants.QTI_CHOICES_LEFT:case this.constants.QTI_CHOICES_RIGHT:this.presentation_Choices_Orientation=i[s];break;case this.constants.QTI_SELECTIONS_DARK:case this.constants.QTI_SELECTIONS_LIGHT:this.presentation_Theme=i[s];break;case this.constants.QTI_UNSELECTED_HIDDEN:this.presentation_UnselectedHidden=!0;break}this.clazzTokens=i}processPresentation(){this.presentation_Choices_Orientation===null&&(this.presentation_Choices_Orientation=this.constants.QTI_CHOICES_TOP),this.presentation_Choices_Orientation===this.constants.QTI_CHOICES_LEFT?(this.ggmChoiceWrapperElement.classList.add(this.constants.QTI_CHOICES_LEFT),this.ggmTargetWrapperElement.classList.add(this.constants.QTI_CHOICES_LEFT),this.ggmGroupElement.classList.add(this.constants.QTI_CHOICES_LEFT)):this.presentation_Choices_Orientation===this.constants.QTI_CHOICES_TOP?(this.ggmChoiceWrapperElement.classList.add(this.constants.QTI_CHOICES_TOP),this.ggmTargetWrapperElement.classList.add(this.constants.QTI_CHOICES_TOP)):this.presentation_Choices_Orientation===this.constants.QTI_CHOICES_RIGHT?(this.ggmChoiceWrapperElement.classList.add(this.constants.QTI_CHOICES_RIGHT),this.ggmTargetWrapperElement.classList.add(this.constants.QTI_CHOICES_RIGHT),this.ggmGroupElement.classList.add(this.constants.QTI_CHOICES_RIGHT),this.ggmGroupElement.insertBefore(this.ggmTargetWrapperElement,this.ggmChoiceWrapperElement)):this.presentation_Choices_Orientation===this.constants.QTI_CHOICES_BOTTOM&&(this.ggmChoiceWrapperElement.classList.add(this.constants.QTI_CHOICES_BOTTOM),this.ggmTargetWrapperElement.classList.add(this.constants.QTI_CHOICES_BOTTOM),this.ggmGroupElement.insertBefore(this.ggmTargetWrapperElement,this.ggmChoiceWrapperElement)),this.processBackgroundImage(),this.processChoicesContainerWidth(),this.processGaps()}processBackgroundImage(){if(this.image===null)return;this.image.setAttribute("draggable","false");const t=this.image.getBoundingClientRect();this.ggmTargetWrapperElement.style.width=`${t.width}px`,this.ggmTargetWrapperElement.style.height=`${t.height}px`}processChoicesContainerWidth(){this.choicesContainerWidth!==null&&(this.ggmChoiceWrapperElement.style.width=`${this.choicesContainerWidth}px`,this.ggmChoiceWrapperElement.style.textAlign="center")}processGaps(){for(let t=0;t<this.gaps.length;t++){const i=this.gaps[t];this.setGapStyle(i,i.getShape(),i.getShapeData()),this.gaps[t].$refs.gap.classList.add("target",this.presentation_Theme),this.presentation_UnselectedHidden&&this.gaps[t].$refs.gap.classList.add(this.constants.QTI_UNSELECTED_HIDDEN)}}setGapStyle(t,i,s){switch(i){case"rect":t.$refs.gap.style.left=`${s[0]}px`,t.$refs.gap.style.top=`${s[1]}px`,t.$refs.gap.style.width=`${s[2]}px`,t.$refs.gap.style.height=`${s[3]}px`;break}}}class cq{constructor(t,i){J(this,"options",{interactionSubType:"default",cardinality:"multiple",maxAssociations:0,response:null,onReady:null,onUpdate:null,onSelectionsLimit:null,zindex:1e3});return this.qtiAttributeValidation=new G,this.wrapper=t,this.sourcewrapper=this.wrapper.querySelector(".qti-ggm-source-wrapper"),this.targetwrapper=this.wrapper.querySelector(".qti-ggm-target-wrapper"),this.processOptions(i),this.handleDragStart=this.handleDragStart.bind(this),this.handleDragMove=this.handleDragMove.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.handleTouchStart=this.handleTouchStart.bind(this),this.handleTouchMove=this.handleTouchMove.bind(this),this.handleTouchEnd=this.handleTouchEnd.bind(this),this.itemTarget=null,this.itemStart=null,this.isItemStartSource=!0,this.savedGapZindex="",this.initialX=0,this.initialY=0,this.offsetX=0,this.offsetY=0,this.startingX=0,this.startingY=0,this.currentAssociationsCount=0,this.isDisabled=!1,this.currentDragger=null,this.initializeSources(this.sourcewrapper),this.initializeTargets(this.targetwrapper),this.restoreResponse(this.options.response),this.notifyReady(),this}processOptions(t){"interactionSubType"in t&&(this.options.interactionSubType=t.interactionSubType),"cardinality"in t&&(this.options.cardinality=t.cardinality),"response"in t&&(this.options.response=t.response),"maxAssociations"in t&&(this.options.maxAssociations=t.maxAssociations),"onReady"in t&&(this.options.onReady=t.onReady),"onUpdate"in t&&(this.options.onUpdate=t.onUpdate),"onAssociationsLimit"in t&&(this.options.onAssociationsLimit=t.onAssociationsLimit)}notifyReady(){this.options.onReady!==null&&this.options.onReady({response:this.getResponse()})}notifyUpdate(){this.options.onUpdate!==null&&this.options.onUpdate({response:this.computeResponse()})}notifyAssociationsLimit(){this.options.onAssociationsLimit!==null&&this.options.onAssociationsLimit()}toggleDisable(t){this.isDisabled=t,this.draggers.forEach(i=>{t?i.classList.add("disabled"):i.classList.remove("disabled")})}handleDragStart(t){if(t.preventDefault(),!this.isDisabled&&t.button==0)return this.interactionStart(t.target,t.clientX,t.clientY,!1),!1}handleTouchStart(t){if(t.preventDefault(),!this.isDisabled)return t.targetTouches.length!=1||this.interactionStart(t.target,t.touches[0].pageX,t.touches[0].pageY,!0),!1}interactionStart(t,i,s,n){const r=this.getClosestElement(t,"draggable");this.itemStart=r.parentNode,this.isItemStartSource=this.itemStart.classList.contains("source"),this.isItemStartSource||this.saveGapZindex(this.itemStart),this.identifyTargets(this.itemStart,!0),this.itemTarget=null;const a=r.getBoundingClientRect();this.initialX=i,this.initialY=s,this.startingX=a.left,this.startingY=a.top,this.offsetX=i-this.startingX,this.offsetY=s-this.startingY,this.addPlaceholder(r),r.classList.add("dragging"),r.style.userSelect="none",r.style.width=a.width+"px",r.style.height=a.height+"px",r.style.transform=`translateX(${a.left}px) translateY(${a.top}px) translateZ(0)`,this.setCurrentDragger(r),this.addListeners(r,n)}handleDragMove(t){t.preventDefault(),!this.isDisabled&&this.interactionMove(t.clientX,t.clientY)}handleTouchMove(t){t.preventDefault(),!this.isDisabled&&t.targetTouches.length==1&&this.interactionMove(t.touches[0].clientX,t.touches[0].clientY)}interactionMove(t,i){const s=this.currentDragger;this.offsetX=t-this.initialX,this.offsetY=i-this.initialY,this.constrainDraggerToWrapper(s,this.wrapper),s.style.transform=`translateX(${this.startingX+this.offsetX}px) translateY(${this.startingY+this.offsetY}px) translateZ(0) scale(1)`;const n=s.getBoundingClientRect();this.findDraggerItemTarget(s,n,this.targets),this.isItemStartSource||this.findSourceDraggerTarget(s,n)}constrainDraggerToWrapper(t,i){const s=t.getBoundingClientRect(),n=i.getBoundingClientRect(),r=this.startingX+this.offsetX-n.x,a=this.startingY+this.offsetY-n.y,o=this.startingX+s.width+this.offsetX-(n.x+n.width),u=this.startingY+s.height+this.offsetY-(n.y+n.height);r<0&&(this.offsetX=this.offsetX-r),o>0&&(this.offsetX=this.offsetX-o),a<0&&(this.offsetY=this.offsetY-a),u>0&&(this.offsetY=this.offsetY-u)}handleDragEnd(t){this.isDisabled||this.interactionEnd(t.clientX,t.clientY,!1)}handleTouchEnd(t){this.isDisabled||this.interactionEnd(t.changedTouches[0].clientX,t.changedTouches[0].clientY,!0)}interactionEnd(t,i,s){const n=this.currentDragger;if(this.itemTarget===null?n.style.transform=`translateX(${this.startingX}px) translateY(${this.startingY}px) translateZ(0)`:n.style.transform=`translateX(${this.startingX+this.offsetX}px) translateY(${this.startingY+this.offsetY}px) translateZ(0)`,n.removeAttribute("style"),n.classList.remove("dragging"),this.clearTargetHighlights(),this.itemTarget===null){this.resetDraggerToItemStart(this.itemStart,n),this.setCurrentDragger(null),this.removeListeners(n,s);return}if(this.itemTarget.classList.contains("active")){if(this.itemTarget.classList.remove("active"),this.isExceedingMaxAssociations(this.itemStart,this.itemTarget,n)){this.resetDraggerToItemStart(this.itemStart,n),this.notifyAssociationsLimit(),this.setCurrentDragger(null),this.removeListeners(n,s);return}if(this.itemStart.getAttribute("data-identifier")===this.itemTarget.getAttribute("data-identifier")){this.resetDraggerToItemStart(this.itemStart,n),this.setCurrentDragger(null),this.removeListeners(n,s);return}this.removePlaceholder(n),this.setDraggerToItemTarget(this.itemTarget,n),this.itemTarget.classList.contains("source")&&(this.itemTarget.classList.add("full"),this.itemTarget.dataset.matchMax*1>0&&this.incrementRemaining(this.itemTarget),this.decrementAssociationsCount(),this.sortContainerElements(this.sourcewrapper)),this.itemStart.classList.contains("source")&&(this.itemStart.dataset.matchMax*1>0&&this.decrementRemaining(this.itemStart)===0&&this.itemStart.classList.remove("full"),this.incrementAssociationsCount()),this.itemStart.classList.contains("target")&&(this.restoreGapZindex(this.itemStart),this.isTargetFull(this.itemStart)?this.itemStart.classList.add("full","contains-choice"):(this.itemStart.classList.remove("full"),this.containsChoices(this.itemStart)?this.itemStart.classList.add("contains-choice"):this.itemStart.classList.remove("contains-choice"))),this.notifyUpdate()}this.setCurrentDragger(null),this.removeListeners(n,s)}setCurrentDragger(t){this.currentDragger=t}resetDraggerToItemStart(t,i){t.classList.contains("target")&&this.restoreGapZindex(t),this.replacePlaceholder(i)}setDraggerToItemTarget(t,i){if(t.classList.contains("source")){this.appendDraggerToSourceTarget(t,i);return}this.appendDraggerToGapTarget(t,i),this.isTargetFull(t)?t.classList.add("full"):t.classList.remove("full")}appendDraggerToSourceTarget(t,i){if(t.classList.contains("full")){const s=t.querySelector(".draggable");s!=null&&t.replaceChild(i,s);return}t.append(i)}appendDraggerToGapTarget(t,i){t.classList.add("contains-choice"),t.append(i)}findDraggerItemTarget(t,i,s){this.itemTarget=null,s.forEach(n=>{const r=n.getBoundingClientRect();if(i.top+t.offsetHeight/2<r.bottom&&i.right-t.offsetWidth/2>r.left&&i.bottom-t.offsetHeight/2>r.top&&i.left+t.offsetWidth/2<r.right){if(this.isItemStartSource&&n.classList.contains("source")||n.classList.contains("full")||!this.hasMatchingMatchGroup(t.parentNode,n))return;n.classList.add("active"),this.itemTarget=n}else n.classList.remove("active")},this)}findSourceDraggerTarget(t,i){const s=this.sourcewrapper.getBoundingClientRect();if(i.top+t.offsetHeight/2<s.bottom&&i.right-t.offsetWidth/2>s.left&&i.bottom-t.offsetHeight/2>s.top&&i.left+t.offsetWidth/2<s.right){for(let n=0;n<this.sources.length;n++)if(this.sources[n].dataset.identifier===t.dataset.identifier){this.sources[n].classList.add("active"),this.itemTarget=this.sources[n];break}}else for(let n=0;n<this.sources.length;n++)this.sources[n].classList.contains("active")&&this.sources[n].classList.remove("active")}addPlaceholder(t){if(!t.parentNode.classList.contains("source")){this.addPlaceholderElement(t,!1);return}const i=t.parentNode.dataset.matchMax*1;if(i===1){this.addPlaceholderElement(t,!1);return}if(i===0){this.addPlaceholderElement(t,!0);return}if(this.getRemaining(t.parentNode)===1){this.addPlaceholderElement(t,!1);return}this.addPlaceholderElement(t,!0)}addPlaceholderElement(t,i){const s=t.cloneNode(!0);this.deepCloneId(s),i?(s.classList.add("clone"),s.addEventListener("mousedown",this.handleDragStart),s.addEventListener("touchstart",this.handleTouchStart)):s.classList.add("ggm-dragger-placeholder"),s.classList.add("placeholder-fade"),t.parentNode.insertBefore(s,t)}removePlaceholder(t){if(t.parentNode.classList.contains("target")){const n=t.parentNode.querySelector(".ggm-dragger-placeholder");if(n===null)return;t.parentNode.removeChild(n);return}const i=t.parentNode.dataset.matchMax*1,s=t.parentNode.querySelector(".ggm-dragger-placeholder");if(s===null){const n=t.parentNode.querySelector(".clone");if(n===null)return;n.classList.remove("placeholder-fade");return}i!==0&&t.parentNode.removeChild(s)}replacePlaceholder(t){const i=t.parentNode;let s=i.querySelector(".ggm-dragger-placeholder");if(i.classList.contains("source")){if(s==null&&(s=i.querySelector(".draggable")),s===null)return;i.replaceChild(t,s);return}s!==null&&i.replaceChild(t,s)}addClonePlaceholder(t){const i=t.cloneNode(!0);this.deepCloneId(i),i.classList.add("clone"),t.parentNode.insertBefore(i,t),i.addEventListener("mousedown",this.handleDragStart),i.addEventListener("touchstart",this.handleTouchStart)}initializeSources(t){this.sources=t.querySelectorAll(".source"),this.sources.forEach(i=>{i.classList.add("full");const s=i.dataset.matchMax*1;this.setRemaining(i,s===0?1e3:s)},this),this.draggers=t.querySelectorAll(".draggable"),this.draggers.forEach((i,s)=>{const n=i.parentNode.getAttribute("data-identifier");i.setAttribute("data-identifier",n),i.setAttribute("data-order",s),i.setAttribute("tabindex",0),i.addEventListener("mousedown",this.handleDragStart),i.addEventListener("touchstart",this.handleTouchStart)},this)}initializeTargets(t){this.targets=t.querySelectorAll(".target"),this.targets.forEach(i=>{i.setAttribute("tabindex",0)})}identifyTargets(t,i){this.targets.forEach(s=>{i&&!s.classList.contains("full")&&this.hasMatchingMatchGroup(t,s)&&s.classList.add("target-active")},this),i&&!this.isItemStartSource&&this.sourcewrapper.classList.add("target-active")}addListeners(t,i){i?(this.removeListeners(t,i),t.addEventListener("touchmove",this.handleTouchMove),t.addEventListener("touchend",this.handleTouchEnd)):(this.removeListeners(t,i),document.addEventListener("mousemove",this.handleDragMove),document.addEventListener("mouseup",this.handleDragEnd))}removeListeners(t,i){i?(t.removeEventListener("touchmove",this.handleTouchMove),t.removeEventListener("touchend",this.handleTouchEnd)):(document.removeEventListener("mousemove",this.handleDragMove),document.removeEventListener("mouseup",this.handleDragEnd))}clearTargetHighlights(){this.targets.forEach(t=>{t.classList.remove("target-active")},this),this.sourcewrapper.classList.remove("target-active")}getClosestElement(t,i){return t?t&&t.classList.contains(i)?t:this.getClosestElement(t.parentElement,i):!1}sortContainerElements(t){let i=[],s=t.children;for(let n=0;n<s.length;n++){const r=s[n].querySelector("div.draggable");r&&i.push([1*r.dataset.order,s[n]])}i.sort(function(n,r){return n[0]-r[0]});for(let n=0;n<i.length;n++)t.appendChild(i[n][1])}saveGapZindex(t){this.savedGapZindex=t.style.zIndex,t.style.zIndex=this.options.zindex}restoreGapZindex(t){t.style.zIndex=this.savedGapZindex}getResponse(){return this.computeResponse()}computeResponse(){let t=[];return this.targets.forEach(i=>{i.querySelectorAll(".draggable").forEach(s=>{t.push(`${s.dataset.identifier} ${i.dataset.identifier}`)})}),t.length===0?null:this.options.cardinality==="single"?t[0]:t}restoreResponse(t){t!==null&&(this.options.cardinality==="single"?this.restoreResponsePair(t):t.forEach(i=>{this.restoreResponsePair(i)},this))}restoreResponsePair(t){const i=this.getPair(t);if(i===null)return;const s=this.findSourceByIdentifier(i.source),n=this.findTargetGapByIdentifier(i.target);if(s===null||n===null)return;const r=s.querySelector(".draggable");r!==null&&(this.cloneOrEmptySourceDragger(s,r),this.restoreSourceDraggerToTarget(n,r))}cloneOrEmptySourceDragger(t,i){const s=t.dataset.matchMax*1;if(s===1){t.classList.remove("full"),this.decrementRemaining(t);return}if(s===0){this.addClonePlaceholder(i);return}if(this.getRemaining(t)===1){t.classList.remove("full"),this.decrementRemaining(t);return}this.decrementRemaining(t),this.addClonePlaceholder(i)}findSourceByIdentifier(t){for(let i=0;i<this.sources.length;i++)if(t===this.sources[i].dataset.identifier)return this.sources[i];return null}findTargetGapByIdentifier(t){for(let i=0;i<this.targets.length;i++)if(t===this.targets[i].dataset.identifier)return this.targets[i];return null}getPair(t){if(t===null)return null;const i=t.split(" ");return i.length!=2?null:{source:i[0],target:i[1]}}restoreSourceDraggerToTarget(t,i){t===null||i===null||(this.appendDraggerToGapTarget(t,i),this.incrementAssociationsCount(),this.isTargetFull(t)&&t.classList.add("full"))}hasMatchingMatchGroup(t,i){return t===null||i===null?!1:t.dataset.matchGroup===i.dataset.matchGroup}isTargetFull(t){if(t==null)return!1;const i=t.querySelectorAll(".draggable"),s=t.dataset.matchMax*1;return s===0?!1:i.length>=s}containsChoices(t){return t==null?!1:t.querySelectorAll(".draggable").length!==0}isExceedingMaxAssociations(t,i){return!(this.options.maxAssociations===0||i.classList.contains("source")||t.classList.contains("target")||this.currentAssociationsCount<this.options.maxAssociations)}initializeAssociationsCount(){this.currentAssociationsCount=0}incrementAssociationsCount(){this.currentAssociationsCount+=1}decrementAssociationsCount(){this.currentAssociationsCount!==0&&(this.currentAssociationsCount-=1)}getRemaining(t){return t.dataset.remaining*1}setRemaining(t,i){t.setAttribute("data-remaining",i)}incrementRemaining(t){const i=t.dataset.remaining*1+1;return t.setAttribute("data-remaining",i),i}decrementRemaining(t){let i=t.dataset.remaining*1-1;return i=i>=0?i:0,t.setAttribute("data-remaining",i),i}deepCloneId(t){t.id&&(t.id=`clone_${this.qtiAttributeValidation.randomString(5,"a")}`);for(let i=0;i<t.children.length;i++)this.deepCloneId(t.children[i])}reset(){this.resetDraggersToSources(),this.initializeAssociationsCount(),this.destroy()}resetDraggersToSources(){this.targets.forEach(t=>{t.querySelectorAll(".draggable").forEach(s=>{const n=this.findSourceByIdentifier(s.getAttribute("data-identifier"));n.classList.contains("full")||(n.classList.contains("full")?t.removeChild(s):(n.append(s),n.classList.add("full")))},this),t.classList.remove("full","contains-choice")},this)}destroy(){this.currentDragger!==null&&(document.removeEventListener("mousemove",this.handleDragMove),document.removeEventListener("mouseup",this.handleDragEnd)),this.wrapper.querySelectorAll(".draggable").forEach(i=>{i.removeEventListener("touchstart",this.handleTouchStart),i.removeEventListener("touchmove",this.handleTouchMove),i.removeEventListener("touchend",this.handleTouchEnd),i.removeEventListener("mousedown",this.handleDragStart)},this)}}const uq=new G,hq=new ie,dq={emits:["ggmGroupReady","ggmGroupUpdate","ggmGroupAssociationsLimit"],props:{responseIdentifier:{required:!0,type:String},cardinality:{required:!0,type:String},shuffle:{required:!1,type:String,default:"false"},maxAssociations:{required:!1,type:String,default:"1"},minAssociations:{required:!1,type:String,default:"0"},dataChoicesContainerWidth:{required:!1,type:String,default:null},interactionSubType:{required:!1,type:String,default:"default"},interactionStaticClass:{required:!0,type:String},priorState:{required:!1,type:Object,default:null}},data(){return{image:null,choices:[],order:[],gaps:[],response:null,isShuffle:null,hasPrompt:!1,interactionClassAttribute:null,presentationFactory:null,matchable:null,isQtiValid:!0}},computed:{computedMaxAssociations(){return this.maxAssociations*1}},methods:{getResponse(){return this.response},setResponse(e){this.response=e},disable(){this.matchable!==null&&this.matchable.toggleDisable(!0)},enable(){this.matchable!==null&&this.matchable.toggleDisable(!1)},getChoices(){return this.choices},setIsShuffle(e){this.isShuffle=e},validateChildren(){let e=0,t=0,i=!1;this.$slots.default()[0].children.forEach(s=>{if(uq.isValidSlot(s)){if(s.type.name==="QtiPrompt"){if(e>0||t>0||i)throw new c("Invalid element order. qti-prompt must come before the background image, qti-gap-text's, qti-gap-img's, or qti-associable-hotspot's");if(!this.hasPrompt)return this.hasPrompt=!0;throw new c("Maximum of 1 qti-prompt element permitted")}if(s.type.name==="QtiGapText"||s.type.name==="QtiGapImg"){if(t>0)throw new c("Invalid element order. qti-gap-text's and qti-gap-img's must come before qti-associable-hotspot's");return e+=1}if(s.type.name==="QtiAssociableHotspot")return t+=1;throw new c('Node is not one of qti-gap-text, qti-gap-img, or qti-associable-hotspot: "'+s.type.name+'"')}else if(s.type==="img"||s.type==="object"||s.type==="picture"){if(e>0||t>0)throw new c("Invalid element order. Background image must preceed qti-gap-text's, qti-gap-img's and qti-associable-hotspot's");i=!0}})},processChildren(){this.$.subTree.children[0].children[0].children.forEach(t=>{if(t.type==="img"||t.type==="object"||t.type==="picture"){this.image=t.el;return}t.component!==null&&(t.type.name==="QtiGapText"||t.type.name==="QtiGapImg"?this.choices.push(t.component.proxy):t.type.name==="QtiAssociableHotspot"&&this.gaps.push(t.component.proxy))})},insertAfter(e,t){t.parentNode.insertBefore(e,t.nextSibling)},processGroupUI(e){let t=this.createGapChoiceWrapper();if(t==null)return;let i=this.createGapTargetWrapper(),s=this.createContainer(this.priorState);this.processContainerChoices(s,t),this.saveContainerOrder(s),this.presentationFactory.initialize(this.$refs.root,t,i,this.image,this.dataChoicesContainerWidth,this.choices,this.gaps),this.matchable=new cq(this.$refs.root,{interactionSubType:this.interactionSubType,cardinality:this.cardinality,maxAssociations:this.computedMaxAssociations,response:e,onReady:this.handleWidgetReady,onUpdate:this.handleWidgetUpdate,onAssociationsLimit:this.handleAssociationsLimit})},createGapChoiceWrapper(){let e=this.$refs.root.querySelector(".qti-gap-choice");if(e===null)return null;let t=document.createElement("ul");return t.classList.add("qti-ggm-source-wrapper"),this.$refs.root.insertBefore(t,e),t},createGapTargetWrapper(){let e=document.createElement("div");e.classList.add("qti-ggm-target-wrapper"),e.append(this.image);for(let t=0;t<this.gaps.length;t++)e.append(this.gaps[t].$el);return this.$refs.root.append(e),e},createContainer(e){let t=[];return e===null?(this.choices.forEach(s=>{t.push({fixed:s.fixed==="true",node:s})}),this.isShuffle&&hq.shuffleArrayFixed(t),t):(e.state.order.forEach(s=>{const n=this.findChoiceByIdentifier(s,this.choices);n!==null&&t.push({fixed:n.fixed==="true",node:n})},this),t)},processContainerChoices(e,t){this.choices.splice(0,this.choices.length),t.innerHTML="",e.forEach(i=>{t.appendChild(i.node.$el),this.choices.push(i.node)},this)},saveContainerOrder(e){const t=[];e.forEach(i=>{t.push(i.node.identifier)}),this.order=t},findChoiceByIdentifier(e,t){for(let i=0;i<t.length;i++)if(t[i].$el.getAttribute("data-identifier")===e)return t[i];throw new O('Gap Match Interaction State Invalid. Choice identifier "'+e+'" not found.')},resetGroupUI(){this.processGroupUI(null)},handleWidgetReady(e){this.setResponse(e.response),this.$emit("ggmGroupReady",{response:this.getResponse(),order:this.order})},handleWidgetUpdate(e){this.setResponse(e.response),this.$emit("ggmGroupUpdate",{response:this.getResponse()})},handleAssociationsLimit(){this.$emit("ggmGroupAssociationsLimit")},initializeGraphicGapMatchGroup(){this.presentationFactory=new lq(this.interactionStaticClass)}},created(){try{if(typeof this.cardinality>"u")throw new c("Undefined qti-graphic-gap-match-interaction cardinality");if(this.cardinality!=="multiple")throw new c('qti-graphic-gap-match-interaction cardinality must be "multiple"');this.setIsShuffle(this.shuffle==="true"),this.initializeGraphicGapMatchGroup(),this.validateChildren()}catch(e){throw this.isQtiValid=!1,console.log("[QtiGapMatchInteraction][ValidationError]",e.name,e.message),new c(e.message)}},mounted(){if(this.isQtiValid)try{this.processChildren(),this.processGroupUI(this.priorState===null?null:this.priorState.value)}catch(e){if(this.isQtiValid=!1,e.name==="QtiValidationException")throw console.log("[QtiGapMatchInteraction][ValidationException]",e.message),new c(e.message);if(e.name==="QtiEvaluationException")throw console.log("[QtiGapMatchInteraction][EvaluationException]",e.message),new O(e.message)}},beforeUnmount(){this.matchable!==null&&(this.matchable.destroy(),this.matchable=null)}},fq={ref:"root",class:"qti-ggm-group-wrapper"};function pq(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",fq,[l.renderSlot(e.$slots,"default")],512)}const mq=B(dq,[["render",pq]]);class gq{constructor(){this.constants={QTI_CHOICES_TOP:"qti-choices-top",QTI_CHOICES_BOTTOM:"qti-choices-bottom",QTI_CHOICES_LEFT:"qti-choices-left",QTI_CHOICES_RIGHT:"qti-choices-right",QTI_MATCH_TABULAR:"qti-match-tabular",QTI_HEADER_HIDDEN:"qti-header-hidden",ROW_CENTRIC:"row-centric",DATA_MAX_SELECTIONS_MESSAGE:"data-max-selections-message",DATA_MIN_SELECTIONS_MESSAGE:"data-min-selections-message",DATA_FIRST_COLUMN_HEADER:""},this.interactionSubType="default",this.parentClass="",this.clazzTokens=[],this.matchWrapperElement=null,this.matchGroupNode=null,this.matchSetNode1=null,this.matchSetNode2=null,this.choices1=[],this.choices2=[],this.presentation_Choices_Orientation=null,this.presentation_Header_Hidden=!1,this.presentation_Row_Centric=!1,this.presentation_MaxSelectionsMessage="",this.presentation_MinSelectionsMessage=""}initialize(t,i,s,n,r){this.interactionSubType=t,this.matchWrapperElement=i,this.matchGroupNode=s,this.parentClass=s.matchInteractionStaticClass,this.matchSetNode1=n,this.matchSetNode2=r,this.choices1=this.matchSetNode1.getChoices(),this.choices2=this.matchSetNode2.getChoices(),this.processRootClassAttribute(this.parentClass),this.processPresentation()}processRootClassAttribute(t){const i=t.split(" ");for(let s=0;s<i.length;s++)switch(i[s]){case this.constants.QTI_CHOICES_TOP:case this.constants.QTI_CHOICES_BOTTOM:case this.constants.QTI_CHOICES_LEFT:case this.constants.QTI_CHOICES_RIGHT:this.presentation_Choices_Orientation=i[s];break;case this.constants.QTI_MATCH_TABULAR:break;case this.constants.QTI_HEADER_HIDDEN:this.presentation_Header_Hidden=!0;break;case this.constants.ROW_CENTRIC:this.presentation_Row_Centric=!0;break}this.clazzTokens=i}processPresentation(){this.matchSetNode1.$refs.matchset.classList.add("qti-match-source-wrapper"),this.matchSetNode2.$refs.matchset.classList.add("qti-match-target-wrapper"),this.interactionSubType==="default"?(this.presentation_Choices_Orientation===null&&(this.presentation_Choices_Orientation=this.constants.QTI_CHOICES_TOP),this.presentation_Choices_Orientation===this.constants.QTI_CHOICES_LEFT?(this.matchSetNode1.$refs.matchset.classList.add(this.constants.QTI_CHOICES_LEFT),this.matchSetNode2.$refs.matchset.classList.add(this.constants.QTI_CHOICES_LEFT)):this.presentation_Choices_Orientation===this.constants.QTI_CHOICES_TOP?(this.matchSetNode1.$refs.matchset.classList.add(this.constants.QTI_CHOICES_TOP),this.matchSetNode2.$refs.matchset.classList.add(this.constants.QTI_CHOICES_TOP)):this.presentation_Choices_Orientation===this.constants.QTI_CHOICES_RIGHT?(this.matchSetNode1.$refs.matchset.classList.add(this.constants.QTI_CHOICES_RIGHT),this.matchSetNode2.$refs.matchset.classList.add(this.constants.QTI_CHOICES_RIGHT),this.matchWrapperElement.insertBefore(this.matchSetNode2.$refs.matchset,this.matchSetNode1.$refs.matchset)):this.presentation_Choices_Orientation===this.constants.QTI_CHOICES_BOTTOM&&(this.matchSetNode1.$refs.matchset.classList.add(this.constants.QTI_CHOICES_BOTTOM),this.matchSetNode2.$refs.matchset.classList.add(this.constants.QTI_CHOICES_BOTTOM),this.matchWrapperElement.insertBefore(this.matchSetNode2.$refs.matchset,this.matchSetNode1.$refs.matchset)),this.updateMatchSetChoices(this.matchSetNode1,!0),this.updateMatchSetChoices(this.matchSetNode2,!1)):this.interactionSubType==="matchtabular"&&(this.createMatchTable(),this.matchSetNode1.$refs.matchset.classList.add("matchset-hidden"),this.matchSetNode2.$refs.matchset.classList.add("matchset-hidden"))}updateMatchSetChoices(t,i){const s=t.getChoices();for(let n=0;n<s.length;n++)i?(s[n].$refs.choice.classList.add("source"),s[n].$refs.description.classList.add("draggable")):(s[n].$refs.choice.classList.add("target"),s[n].$refs.description.classList.add("match-target-label"))}createMatchTable(){const t=document.createElement("table");this.clazzTokens.forEach(i=>{t.classList.add(i)}),t.classList.add("matchtabular","table","table-bordered"),this.matchWrapperElement.insertBefore(t,this.matchSetNode1.$refs.matchset)}}class yq{constructor(t,i){J(this,"options",{interactionSubType:"default",cardinality:"single",maxAssociations:0,response:null,onReady:null,onUpdate:null,onSelectionsLimit:null});return this.qtiAttributeValidation=new G,this.wrapper=t,this.sourcewrapper=this.wrapper.querySelector(".qti-match-source-wrapper"),this.targetwrapper=this.wrapper.querySelector(".qti-match-target-wrapper"),this.processOptions(i),this.handleDragStart=this.handleDragStart.bind(this),this.handleDragMove=this.handleDragMove.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.handleTouchStart=this.handleTouchStart.bind(this),this.handleTouchMove=this.handleTouchMove.bind(this),this.handleTouchEnd=this.handleTouchEnd.bind(this),this.itemTarget=null,this.itemStart=null,this.isItemStartSource=!0,this.initialX=0,this.initialY=0,this.offsetX=0,this.offsetY=0,this.startingX=0,this.startingY=0,this.currentAssociationsCount=0,this.isDisabled=!1,this.currentDragger=null,this.initializeSources(this.sourcewrapper),this.initializeTargets(this.targetwrapper),this.restoreResponse(this.options.response),this.notifyReady(),this}processOptions(t){"interactionSubType"in t&&(this.options.interactionSubType=t.interactionSubType),"cardinality"in t&&(this.options.cardinality=t.cardinality),"response"in t&&(this.options.response=t.response),"maxAssociations"in t&&(this.options.maxAssociations=t.maxAssociations),"onReady"in t&&(this.options.onReady=t.onReady),"onUpdate"in t&&(this.options.onUpdate=t.onUpdate),"onAssociationsLimit"in t&&(this.options.onAssociationsLimit=t.onAssociationsLimit)}notifyReady(){this.options.onReady!==null&&this.options.onReady({response:this.getResponse()})}notifyUpdate(){this.options.onUpdate!==null&&this.options.onUpdate({response:this.computeResponse()})}notifyAssociationsLimit(){this.options.onAssociationsLimit!==null&&this.options.onAssociationsLimit()}toggleDisable(t){this.isDisabled=t,this.draggers.forEach(i=>{t?i.classList.add("disabled"):i.classList.remove("disabled")})}handleDragStart(t){if(t.preventDefault(),!this.isDisabled&&t.button==0)return this.interactionStart(t.target,t.clientX,t.clientY,!1),!1}handleTouchStart(t){if(t.preventDefault(),!this.isDisabled)return t.targetTouches.length!=1||this.interactionStart(t.target,t.touches[0].pageX,t.touches[0].pageY,!0),!1}interactionStart(t,i,s,n){const r=this.getClosestElement(t,"draggable");this.itemStart=r.parentNode,this.isItemStartSource=this.itemStart.classList.contains("source"),this.identifyTargets(this.itemStart,!0),this.itemTarget=null;const a=r.getBoundingClientRect();this.initialX=i,this.initialY=s,this.startingX=a.left,this.startingY=a.top,this.offsetX=i-this.startingX,this.offsetY=s-this.startingY,this.addPlaceholder(r),r.style.userSelect="none",r.style.width=a.width+"px",r.style.height=a.height+"px",r.style.transform=`translateX(${a.left}px) translateY(${a.top}px) translateZ(0)`,r.classList.add("dragging"),this.setCurrentDragger(r),this.addListeners(r,n)}handleDragMove(t){t.preventDefault(),!this.isDisabled&&this.interactionMove(t.clientX,t.clientY)}handleTouchMove(t){t.preventDefault(),!this.isDisabled&&t.targetTouches.length==1&&this.interactionMove(t.touches[0].clientX,t.touches[0].clientY)}interactionMove(t,i){const s=this.currentDragger;this.offsetX=t-this.initialX,this.offsetY=i-this.initialY,this.constrainDraggerToWrapper(s,this.wrapper),s.style.transform=`translateX(${this.startingX+this.offsetX}px) translateY(${this.startingY+this.offsetY}px) translateZ(0) scale(1)`;const n=s.getBoundingClientRect();this.findDraggerItemTarget(s,n,this.targets),this.isItemStartSource||this.findSourceDraggerTarget(s,n)}constrainDraggerToWrapper(t,i){const s=t.getBoundingClientRect(),n=i.getBoundingClientRect(),r=this.startingX+this.offsetX-n.x,a=this.startingY+this.offsetY-n.y,o=this.startingX+s.width+this.offsetX-(n.x+n.width),u=this.startingY+s.height+this.offsetY-(n.y+n.height);r<0&&(this.offsetX=this.offsetX-r),o>0&&(this.offsetX=this.offsetX-o),a<0&&(this.offsetY=this.offsetY-a),u>0&&(this.offsetY=this.offsetY-u)}handleDragEnd(t){this.isDisabled||this.interactionEnd(t.clientX,t.clientY,!1)}handleTouchEnd(t){this.isDisabled||this.interactionEnd(t.changedTouches[0].clientX,t.changedTouches[0].clientY,!0)}interactionEnd(t,i,s){const n=this.currentDragger;if(this.itemTarget===null?n.style.transform=`translateX(${this.startingX}px) translateY(${this.startingY}px) translateZ(0)`:n.style.transform=`translateX(${this.startingX+this.offsetX}px) translateY(${this.startingY+this.offsetY}px) translateZ(0)`,n.removeAttribute("style"),n.classList.remove("dragging"),this.clearTargetHighlights(),this.itemTarget===null){this.resetDraggerToItemStart(this.itemStart,n),this.setCurrentDragger(null),this.removeListeners(n,s);return}if(this.itemTarget.classList.contains("active")){if(this.itemTarget.classList.remove("active"),this.isExceedingMaxAssociations(this.itemStart,this.itemTarget,n)){this.resetDraggerToItemStart(this.itemStart,n),this.notifyAssociationsLimit(),this.setCurrentDragger(null),this.removeListeners(n,s);return}if(this.itemStart.getAttribute("data-identifier")===this.itemTarget.getAttribute("data-identifier")){this.resetDraggerToItemStart(this.itemStart,n),this.setCurrentDragger(null),this.removeListeners(n,s);return}this.removePlaceholder(n),this.setDraggerToItemTarget(this.itemTarget,n),this.itemTarget.classList.contains("source")&&(this.itemTarget.classList.add("full"),this.itemTarget.dataset.matchMax*1>0&&this.incrementRemaining(this.itemTarget),this.decrementAssociationsCount(),this.sortContainerElements(this.sourcewrapper)),this.itemStart.classList.contains("source")&&(this.itemStart.dataset.matchMax*1>0&&this.decrementRemaining(this.itemStart)===0&&this.itemStart.classList.remove("full"),this.incrementAssociationsCount()),this.itemStart.classList.contains("target")&&(this.isTargetFull(this.itemStart)?this.itemStart.classList.add("full"):this.itemStart.classList.remove("full")),this.notifyUpdate()}this.setCurrentDragger(null),this.removeListeners(n,s)}setCurrentDragger(t){this.currentDragger=t}resetDraggerToItemStart(t,i){this.replacePlaceholder(i),t.classList.contains("source")||i.setAttribute("style","width:100%")}setDraggerToItemTarget(t,i){if(t.classList.contains("source")){if(t.classList.contains("full")){const s=t.querySelector(".draggable");s!=null&&t.replaceChild(i,s);return}t.append(i);return}t.append(i),i.setAttribute("style","width:100%"),this.isTargetFull(t)?t.classList.add("full"):t.classList.remove("full")}findDraggerItemTarget(t,i,s){this.itemTarget=null,s.forEach(n=>{const r=n.getBoundingClientRect();if(i.top+t.offsetHeight/2<r.bottom&&i.right-t.offsetWidth/2>r.left&&i.bottom-t.offsetHeight/2>r.top&&i.left+t.offsetWidth/2<r.right){if(this.isItemStartSource&&n.classList.contains("source")||n.classList.contains("full")||!this.hasMatchingMatchGroup(t.parentNode,n))return;n.classList.add("active"),this.itemTarget=n}else n.classList.remove("active")},this)}findSourceDraggerTarget(t,i){const s=this.sourcewrapper.getBoundingClientRect();if(i.top+t.offsetHeight/2<s.bottom&&i.right-t.offsetWidth/2>s.left&&i.bottom-t.offsetHeight/2>s.top&&i.left+t.offsetWidth/2<s.right){for(let n=0;n<this.sources.length;n++)if(this.sources[n].dataset.identifier===t.dataset.identifier){this.sources[n].classList.add("active"),this.itemTarget=this.sources[n];break}}else for(let n=0;n<this.sources.length;n++)this.sources[n].classList.contains("active")&&this.sources[n].classList.remove("active")}addPlaceholder(t){if(!t.parentNode.classList.contains("source")){this.addPlaceholderElement(t,!1);return}const i=t.parentNode.dataset.matchMax*1;if(i===1){this.addPlaceholderElement(t,!1);return}if(i===0){this.addPlaceholderElement(t,!0);return}if(this.getRemaining(t.parentNode)===1){this.addPlaceholderElement(t,!1);return}this.addPlaceholderElement(t,!0)}addPlaceholderElement(t,i){const s=t.cloneNode(!0);this.deepCloneId(s),i?(s.classList.add("clone"),s.addEventListener("mousedown",this.handleDragStart),s.addEventListener("touchstart",this.handleTouchStart)):s.classList.add("match-dragger-placeholder"),s.classList.add("placeholder-fade"),t.parentNode.insertBefore(s,t)}removePlaceholder(t){if(t.parentNode.classList.contains("target")){const n=t.parentNode.querySelector(".match-dragger-placeholder");if(n===null)return;t.parentNode.removeChild(n);return}const i=t.parentNode.dataset.matchMax*1,s=t.parentNode.querySelector(".match-dragger-placeholder");if(s===null){const n=t.parentNode.querySelector(".clone");if(n===null)return;n.classList.remove("placeholder-fade");return}i!==0&&t.parentNode.removeChild(s)}replacePlaceholder(t){const i=t.parentNode;let s=i.querySelector(".match-dragger-placeholder");if(i.classList.contains("source")){if(s==null&&(s=i.querySelector(".draggable")),s===null)return;i.replaceChild(t,s);return}s!==null&&i.replaceChild(t,s)}addClonePlaceholder(t){const i=t.cloneNode(!0);this.deepCloneId(i),i.classList.add("clone"),t.parentNode.insertBefore(i,t),i.addEventListener("mousedown",this.handleDragStart),i.addEventListener("touchstart",this.handleTouchStart)}initializeSources(t){this.sources=t.querySelectorAll(".source"),this.sources.forEach(i=>{i.classList.add("full");const s=i.dataset.matchMax*1;this.setRemaining(i,s===0?1e3:s)},this),this.draggers=t.querySelectorAll(".draggable"),this.draggers.forEach((i,s)=>{const n=i.parentNode.getAttribute("data-identifier");i.setAttribute("data-identifier",n),i.setAttribute("data-order",s),i.setAttribute("tabindex",0),i.addEventListener("mousedown",this.handleDragStart),i.addEventListener("touchstart",this.handleTouchStart)},this)}initializeTargets(t){this.targets=t.querySelectorAll(".target"),this.targets.forEach(i=>{i.setAttribute("tabindex",0)})}identifyTargets(t,i){this.targets.forEach(s=>{i&&!s.classList.contains("full")&&this.hasMatchingMatchGroup(t,s)&&s.classList.add("target-active")},this),i&&!this.isItemStartSource&&this.sourcewrapper.classList.add("target-active")}addListeners(t,i){i?(this.removeListeners(t,i),t.addEventListener("touchmove",this.handleTouchMove),t.addEventListener("touchend",this.handleTouchEnd)):(this.removeListeners(t,i),document.addEventListener("mousemove",this.handleDragMove),document.addEventListener("mouseup",this.handleDragEnd))}removeListeners(t,i){i?(t.removeEventListener("touchmove",this.handleTouchMove),t.removeEventListener("touchend",this.handleTouchEnd)):(document.removeEventListener("mousemove",this.handleDragMove),document.removeEventListener("mouseup",this.handleDragEnd))}clearTargetHighlights(){this.targets.forEach(t=>{t.classList.remove("target-active")},this),this.sourcewrapper.classList.remove("target-active")}getClosestElement(t,i){return t?t&&t.classList.contains(i)?t:this.getClosestElement(t.parentElement,i):!1}sortContainerElements(t){let i=[],s=t.children;for(let n=0;n<s.length;n++){const r=s[n].querySelector("div.draggable");r&&i.push([1*r.dataset.order,s[n]])}i.sort(function(n,r){return n[0]-r[0]});for(let n=0;n<i.length;n++)t.appendChild(i[n][1])}getResponse(){return this.computeResponse()}computeResponse(){let t=[];return this.targets.forEach(i=>{i.querySelectorAll(".draggable").forEach(s=>{t.push(`${s.dataset.identifier} ${i.dataset.identifier}`)})}),t.length===0?null:this.options.cardinality==="single"?t[0]:t}restoreResponse(t){t!==null&&(this.options.cardinality==="single"?this.restoreResponsePair(t):t.forEach(i=>{this.restoreResponsePair(i)},this))}restoreResponsePair(t){const i=this.getPair(t);if(i===null)return;const s=this.findSourceByIdentifier(i.source),n=this.findTargetGapByIdentifier(i.target);if(s===null||n===null)return;const r=s.querySelector(".draggable");r!==null&&(this.cloneOrEmptySourceDragger(s,r),this.restoreSourceDraggerToTarget(n,r))}cloneOrEmptySourceDragger(t,i){const s=t.dataset.matchMax*1;if(s===1){t.classList.remove("full"),this.decrementRemaining(t);return}if(s===0){this.addClonePlaceholder(i);return}if(this.getRemaining(t)===1){t.classList.remove("full"),this.decrementRemaining(t);return}this.decrementRemaining(t),this.addClonePlaceholder(i)}findSourceByIdentifier(t){for(let i=0;i<this.sources.length;i++)if(t===this.sources[i].dataset.identifier)return this.sources[i];return null}findTargetGapByIdentifier(t){for(let i=0;i<this.targets.length;i++)if(t===this.targets[i].dataset.identifier)return this.targets[i];return null}getPair(t){if(t===null)return null;const i=t.split(" ");return i.length!=2?null:{source:i[0],target:i[1]}}restoreSourceDraggerToTarget(t,i){t===null||i===null||(t.append(i),i.setAttribute("style","width:100%"),this.incrementAssociationsCount(),this.isTargetFull(t)&&t.classList.add("full"))}hasMatchingMatchGroup(t,i){return t===null||i===null?!1:t.dataset.matchGroup===i.dataset.matchGroup}isTargetFull(t){if(t==null)return!1;const i=t.querySelectorAll(".draggable"),s=t.dataset.matchMax*1;return s===0?!1:i.length>=s}isExceedingMaxAssociations(t,i){return!(this.options.maxAssociations===0||i.classList.contains("source")||t.classList.contains("target")||this.currentAssociationsCount<this.options.maxAssociations)}initializeAssociationsCount(){this.currentAssociationsCount=0}incrementAssociationsCount(){this.currentAssociationsCount+=1}decrementAssociationsCount(){this.currentAssociationsCount!==0&&(this.currentAssociationsCount-=1)}getRemaining(t){return t.dataset.remaining*1}setRemaining(t,i){t.setAttribute("data-remaining",i)}incrementRemaining(t){const i=t.dataset.remaining*1+1;return t.setAttribute("data-remaining",i),i}decrementRemaining(t){let i=t.dataset.remaining*1-1;return i=i>=0?i:0,t.setAttribute("data-remaining",i),i}deepCloneId(t){t.id&&(t.id=`clone_${this.qtiAttributeValidation.randomString(5,"a")}`);for(let i=0;i<t.children.length;i++)this.deepCloneId(t.children[i])}reset(){this.resetDraggersToSources(),this.initializeAssociationsCount(),this.destroy()}resetDraggersToSources(){this.targets.forEach(t=>{t.querySelectorAll(".draggable").forEach(s=>{const n=this.findSourceByIdentifier(s.getAttribute("data-identifier"));n.classList.contains("full")||(t.classList.remove("full"),n.classList.contains("full")?t.removeChild(s):(n.append(s),n.classList.add("full")))},this)},this)}destroy(){this.currentDragger!==null&&(document.removeEventListener("mousemove",this.handleDragMove),document.removeEventListener("mouseup",this.handleDragEnd)),this.wrapper.querySelectorAll(".draggable").forEach(i=>{i.removeEventListener("touchstart",this.handleTouchStart),i.removeEventListener("touchmove",this.handleTouchMove),i.removeEventListener("touchend",this.handleTouchEnd),i.removeEventListener("mousedown",this.handleDragStart)},this)}}class wq{constructor(t,i){J(this,"options",{interactionSubType:"matchtabular",isHeaderHidden:!1,isRowCentric:!1,firstColumnHeader:null,cardinality:"single",maxAssociations:0,response:null,onReady:null,onUpdate:null,onSelectionsLimit:null});J(this,"keyCodes",{Enter:13,Space:32,End:35,Home:36,ArrowLeft:37,ArrowUp:38,ArrowRight:39,ArrowDown:40});return this.wrapper=t,this.table=this.wrapper.querySelector("table.matchtabular"),this.sourcewrapper=this.wrapper.querySelector(".qti-match-source-wrapper"),this.targetwrapper=this.wrapper.querySelector(".qti-match-target-wrapper"),this.currentAssociationsCount=0,this.isDisabled=!1,this.processOptions(i),this.handleClick=this.handleClick.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleBlur=this.handleBlur.bind(this),this.state=new Map,this.initializeTable(this.sourcewrapper,this.targetwrapper),this.restoreResponse(),this.notifyReady(),this}processOptions(t){"interactionSubType"in t&&(this.options.interactionSubType=t.interactionSubType),"isHeaderHidden"in t&&(this.options.isHeaderHidden=t.isHeaderHidden),"isRowCentric"in t&&(this.options.isRowCentric=t.isRowCentric),"firstColumnHeader"in t&&(this.options.firstColumnHeader=t.firstColumnHeader),"cardinality"in t&&(this.options.cardinality=t.cardinality),"response"in t&&(this.options.response=t.response),"maxAssociations"in t&&(this.options.maxAssociations=t.maxAssociations),"onReady"in t&&(this.options.onReady=t.onReady),"onUpdate"in t&&(this.options.onUpdate=t.onUpdate),"onAssociationsLimit"in t&&(this.options.onAssociationsLimit=t.onAssociationsLimit)}notifyReady(){this.options.onReady!==null&&this.options.onReady({response:this.getResponse()})}notifyUpdate(){this.options.onUpdate!==null&&this.options.onUpdate({response:this.computeResponse()})}notifyAssociationsLimit(){this.options.onAssociationsLimit!==null&&this.options.onAssociationsLimit()}toggleDisable(t){this.isDisabled=t,this.controls.forEach(i=>{t?i.classList.add("disabled"):i.classList.remove("disabled")})}handleClick(t){if(!this.isDisabled){if(this.isRadio(t.target)){this.setControlChecked(t.target);return}this.toggleControl(t.target)}}handleKeydown(t){let i=!1;switch(t.code){case"Space":case"Enter":this.isDisabled||this.toggleControl(t.target),i=!0;break;case"ArrowUp":case"ArrowLeft":i=!0;break;case"ArrowDown":case"ArrowRight":i=!0;break}i&&(t.stopPropagation(),t.preventDefault())}handleFocus(){}handleBlur(){}toggleControl(t){if(!this.isChecked(t)){if(this.isExceedingMaxAssociations()){this.notifyAssociationsLimit();return}if(this.isExceedingMatchMax(t.dataset.pair,t.dataset.sourceMax*1,!0)||this.isExceedingMatchMax(t.dataset.pair,t.dataset.targetMax*1,!1))return;this.updateState(t.dataset.pair,this.toggleChecked(t)),this.notifyUpdate();return}this.updateState(t.dataset.pair,this.toggleChecked(t)),this.notifyUpdate()}setControlChecked(t){if(!this.isChecked(t)){if(this.isExceedingMaxAssociations()){this.notifyAssociationsLimit();return}if(this.isExceedingMatchMax(t.dataset.pair,t.dataset.sourceMax*1,!0)||this.isExceedingMatchMax(t.dataset.pair,t.dataset.targetMax*1,!1))return;this.updateState(t.dataset.pair,this.setChecked(t,!0)),this.notifyUpdate();return}this.updateState(t.dataset.pair,this.setChecked(t,!0)),this.notifyUpdate()}setChecked(t,i){const s=i?"true":"false";return t.setAttribute("aria-checked",s),s}toggleChecked(t){const s=t.getAttribute("aria-checked")==="true"?"false":"true";return t.setAttribute("aria-checked",s),s}isRadio(t){return t===null?!1:t.getAttribute("role")==="radio"}isChecked(t){return t===null?!1:t.getAttribute("aria-checked")==="true"}setTabIndex(t){this.tabIndex=t}setFocus(){}setBlur(){}updateState(t,i){this.state.set(t,i),this.currentAssociationsCount=0;for(let s of this.state.values())s==="true"&&(this.currentAssociationsCount+=1)}initializeTable(t,i){this.sources=this.getChoices(t),this.targets=this.getChoices(i);const s=`width:${this.getColumnWidthPercentage(this.targets.length)}%`;this.table.innerHTML=`${this.getHeader(s)}${this.getBody(s)}`,this.controls=this.table.querySelectorAll(".control-cell"),this.controls.forEach(n=>{const r=n.getAttribute("data-pair");this.updateState(r,"false"),n.addEventListener("click",this.handleClick),n.addEventListener("keydown",this.handleKeydown),n.addEventListener("focus",this.handleFocus),n.addEventListener("blur",this.handleBlur)},this)}getHeader(t){if(this.options.isHeaderHidden)return"";let i=`<th scope="col" class="header-cell">${this.options.firstColumnHeader==null?"":this.options.firstColumnHeader}</th>`;return this.options.isRowCentric?(i+=this.getSourceHeader(t),`<thead>${i}</thead>`):(i+=this.getTargetHeader(t),`<thead>${i}</thead>`)}getTargetHeader(t){let i="";return this.targets.forEach(s=>{i+=`<th scope="col" class="header-cell" style="${t}">${s.innerHTML}</th>`}),i}getSourceHeader(t){let i="";return this.sources.forEach(s=>{i+=`<th scope="col" class="header-cell" style="${t}">${s.innerHTML}</th>`}),i}getBody(t){let i="";return this.options.isRowCentric?(this.targets.forEach(s=>{i+=`<tr><th scope="row" class="row-header-cell">${s.innerHTML}</th>`;const n=s.getAttribute("data-match-max");this.sources.forEach(r=>{const a=r.getAttribute("data-match-max"),o=r.getAttribute("data-identifier"),u=s.getAttribute("data-identifier"),h=`${o} ${u}`;i+=`<td class="table-cell" style="${t}">
167
+ </svg>`;const t={theme:"snow",boundary:"div.qti-extended-text-interaction",modules:{toolbar:{container:[["undo","redo"],["bold","italic","underline"],["blockquote"],[{list:"ordered"},{list:"bullet"}]],handlers:{redo(){this.quill.history.redo()},undo(){this.quill.history.undo()}}},history:{delay:2e3,maxStack:100,userOnly:!1},keyboard:{bindings:{tab:{key:9,handler:function(){return!0}}}}},placeholder:this.placeholder,readOnly:!1};this.quill=new Y(this.$refs.editor,t),this.quill.root.setAttribute("spellcheck",!1),this.quill.on("text-change",this.textChangeHandler),this.updateCounter(this.getLength()),this.quill.enable(!0)}},setQuillEditorStyleProperties(){this.$refs.editor!=null&&this.$refs.editor.children!=null&&this.$refs.editor.children.length>0&&(this.$refs.editor.children[0].style=`width:${this.editorHeight};overflow-x:auto;`)},textChangeHandler(){let e=this.getText(),t=this.$refs.editor.children[0].innerHTML,i=this.getLength();if(this.expectedLength&&i>this.expectedLength){this.quill.deleteText(this.expectedLength,i);return}t==="<p><br></p>"&&(t=""),this.updateCounter(this.getLength()),this.$emit("input",{html:t,text:e})},updateCounter(e){if(this.showCounter){if(this.isCounterUp){this.counter=e;return}this.counter=this.computedExpectedLength-e}},getLength(){return this.quill.getLength()-1},getText(){return this.quill.getText()}},mounted(){this.initialize(),this.setQuillEditorStyleProperties(),this.$emit("editorReady",{node:this})},beforeUnmount(){this.$el&&this.quill.off("text-change",this.textChangeHandler),this.$el.remove(),this.quill=void 0}},qR={ref:"root",class:"quill-editor vertical-rl"},OR={key:0,"aria-hidden":"true",class:"ext-text-xhtml-vert-rl-counter"},BR={key:0};function PR(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",qR,[l.createElementVNode("div",{ref:"label",style:l.normalizeStyle(r.styleLabel),class:"ext-text-xhtml-vert-label qti-hidden"},null,4),l.createElementVNode("div",{ref:"editor",style:l.normalizeStyle(r.style)},null,4),r.showCounter?(l.openBlock(),l.createElementBlock("div",OR,[l.createTextVNode(l.toDisplayString(n.counter),1),r.isCounterUp?(l.openBlock(),l.createElementBlock("span",BR," / "+l.toDisplayString(i.expectedLength),1)):l.createCommentVNode("",!0)])):l.createCommentVNode("",!0)],512)}const DR={name:"ExtendedTextXhtmlVerticalRl",components:{EditorQuillVerticalRl:B(kR,[["render",PR]])},props:{responseIdentifier:{required:!0,type:String},expectedLength:{required:!1,type:String},placeholder:{required:!1,type:String,default:""},heightClass:{required:!1,type:String,default:""},counterStyle:{required:!1,type:String,default:"none"}},computed:{computedExpectedLength(){return typeof this.expectedLength<"u"?this.expectedLength:"400"},colorStyle(){return _.getItemContextPnp().getColorStyle()},editorHeight(){return this.heightClass==="qti-height-lines-15"?"25.9rem":this.heightClass==="qti-height-lines-6"?"11.5rem":"6.7rem"},labelHeight(){return this.heightClass==="qti-height-lines-15"?"29.7rem":this.heightClass==="qti-height-lines-6"?"12.3rem":"6.6rem"},maxLength(){return 1e4},disabled(){return this.isDisabled}},data(){return{response:"",content:"",state:null,editor:null,isDisabled:!1}},inheritAttrs:!1,methods:{getResponse(){return this.response},setResponse(e){if(e===null){this.response="",this.setContent("");return}this.setContent(e),this.response=e},updateResponse(e){this.response=e},getState(){return this.state},setState(e){this.state=e},getContent(){return this.content},setContent(e){this.content=e},computeState(e){return{text:e}},setIsDisabled(e){this.isDisabled=e},handleInput(e){e.html&&(this.updateResponse(e.html),this.setState(this.computeState(e.text)),this.$parent.$emit("extendedTextUpdate",{response:this.getResponse()}))},handleEditorReady(e){this.node=e.node,this.$parent.$emit("extendedTextReady",{node:this})}},mounted(){}},QR={ref:"root"};function HR(e,t,i,s,n,r){const a=l.resolveComponent("EditorQuillVerticalRl");return l.openBlock(),l.createElementBlock("div",QR,[l.createVNode(a,{content:n.content,placeholder:i.placeholder,editorHeight:r.editorHeight,labelHeight:r.labelHeight,counterStyle:i.counterStyle,expectedLength:r.computedExpectedLength,disabled:r.disabled,onInput:r.handleInput,onEditorReady:r.handleEditorReady},null,8,["content","placeholder","editorHeight","labelHeight","counterStyle","expectedLength","disabled","onInput","onEditorReady"])],512)}const FR=B(DR,[["render",HR]]),jt={DEFAULT:"default-plain",DEFAULT_SBAC:"sbac-plain",DEFAULT_LRN:"lrn-plain",DEFAULT_VERTICAL_RL:"vertical-rl-plain",XHTML_DEFAULT:"default-xhtml",XHTML_SBAC:"sbac-xhtml",XHTML_VERTICAL_RL:"vertical-rl-xhtml"};function UR(e,t,i){switch(e){case jt.XHTML_DEFAULT:case jt.XHTML_SBAC:return{template:'<extended-text-xhtml-default response-identifier="'+t.responseIdentifier+'" '+Ia(t)+Sa(t)+xa(t)+_a(t)+Va(t)+Aa(t)+$a(i)+" />",components:{ExtendedTextXhtmlDefault:RR}};case jt.DEFAULT_LRN:return{template:'<extended-text-plain-lrn response-identifier="'+t.responseIdentifier+'" '+Ia(t)+Sa(t)+xa(t)+_a(t)+Va(t)+Aa(t)+$a(i)+" />",components:{ExtendedTextPlainLrn:ZI}};case jt.DEFAULT_VERTICAL_RL:return{template:'<extended-text-plain-vertical-rl response-identifier="'+t.responseIdentifier+'" '+Ia(t)+Sa(t)+xa(t)+_a(t)+Va(t)+Aa(t)+$a(i)+" />",components:{ExtendedTextPlainVerticalRl:oV}};case jt.XHTML_VERTICAL_RL:return{template:'<extended-text-xhtml-vertical-rl response-identifier="'+t.responseIdentifier+'" '+Ia(t)+Sa(t)+xa(t)+_a(t)+Va(t)+Aa(t)+$a(i)+" />",components:{ExtendedTextXhtmlVerticalRl:FR}};default:return{template:'<extended-text-plain-default response-identifier="'+t.responseIdentifier+'" '+Ia(t)+Sa(t)+xa(t)+_a(t)+Va(t)+Aa(t)+$a(i)+" />",components:{ExtendedTextPlainDefault:QI}}}}function GR(e,t){const i=jR(e);if(i&&t==="plain")return jt.DEFAULT_SBAC;if(i&&t==="xhtml")return jt.XHTML_DEFAULT;if(WR(e)&&t==="plain")return jt.DEFAULT_LRN;const n=zR(e);return n&&t==="plain"?jt.DEFAULT_VERTICAL_RL:n&&t==="xhtml"?jt.XHTML_VERTICAL_RL:t==="plain"?jt.DEFAULT:t==="xhtml"?jt.XHTML_DEFAULT:jt.DEFAULT}function Sa(e){return typeof e.patternMask>"u"?"":'pattern-mask="'+e.patternMask+'" '}function xa(e){return'pattern-mask-message="'+e.patternMaskMessage+'" '}function _a(e){return'placeholder="'+e.placeholder+'" '}function Ia(e){return typeof e.expectedLength>"u"?"":'expected-length="'+e.expectedLength+'" '}function Va(e){return typeof e.heightClass>"u"?"":'height-class="'+e.heightClass+'" '}function Aa(e){return typeof e.counterStyle>"u"?"none":'counter-style="'+e.counterStyle+'" '}function $a(e){let t="";for(const[i,s]of Object.entries(e))t+=`${i}="${s}" `;return t}function jR(e){return typeof e>"u"||e===null||e.length==0?!1:kh("sbac",e)}function WR(e){return typeof e>"u"||e===null||e.length==0?!1:kh("lrn",e)}function zR(e){return typeof e>"u"||e===null||e.length==0?!1:kh("qti-writing-orientation-vertical-rl",e)}function kh(e,t){const i=t.split(" ");for(let s=0;s<i.length;s++)if(i[s]===e)return!0;return!1}const La=new G,KR=new ie,YR={name:"QtiExtendedTextInteraction",props:{responseIdentifier:{required:!0,type:String},expectedLength:{required:!1,type:String},patternMask:{required:!1,type:String},placeholderText:{required:!1,type:String},format:{required:!1,type:String,default:"plain"},dataPatternmaskMessage:{required:!1,type:String},minStrings:{required:!1,type:String,default:"0"},maxStrings:{required:!1,type:String,default:"0"}},computed:{interactionTemplate(){return UR(this.interactionSubType,this.createComponentProperties(),this.$attrs)},placeholder(){return La.validatePlaceholderText(this.placeholderText,"")},hasPatternMask(){return typeof this.patternMask<"u"},patternMaskMessage(){return La.validatePatternmaskMessage(this.dataPatternmaskMessage,"Invalid Input")}},data(){return{response:"",state:null,baseType:"string",cardinality:"single",interactionSubType:null,isValidResponse:!1,invalidResponseMessage:"Input Required",classAttribute:"",isDisabled:!1,isQtiValid:!0,hasPrompts:!1,presentationFactory:null,node:null,priorState:null}},methods:{getResponse(){return this.response.length===0?null:this.response},setResponse(e){e===null?this.response="":this.response=e,this.node.setResponse(this.response,!0)},updateResponse(e){e===null?this.response="":this.response=e},getState(){return this.state},setState(e){this.state=e,this.node.setState(this.state,!0)},updateState(e){this.state=e},getIsValid(){return this.isValidResponse},setIsValid(e){this.isValidResponse=e},setInteractionSubType(e){this.interactionSubType=e},getInteractionSubType(){return this.interactionSubType},disable(){this.toggleDisable(!0)},enable(){this.toggleDisable(!1)},toggleDisable(e){this.isDisabled=e,this.node.setIsDisabled(e)},getInvalidResponseMessage(){return this.invalidResponseMessage},initializeValue(){this.setResponse(null),this.setState(this.computeState()),this.setIsValid(this.computeIsValid())},resetValue(){console.log("[ResetValue][identifier]",this.responseIdentifier),this.setResponse(null),this.setState(this.computeState()),this.setIsValid(this.computeIsValid())},restoreValue(e){this.setResponse(e.value),this.setState(e.state),this.updateValidity(this.computeIsValid())},getCardinality(){return this.cardinality},computeState(){return{}},computeIsValid(){const e=this.minStrings*1;if(e===0)return!0;if(this.response===null)return!1;const t=this.response.trim();return!(t.length<1||KR.computeWordCount(t)<e)},evaluateValidity(){const e=this.getIsValid(),t=this.computeIsValid();e!==t&&this.updateValidity(t)},updateValidity(e){this.setIsValid(e),_.setInteractionIsValidResponse({identifier:this.responseIdentifier,isValidResponse:e})},getPrompts(e){let t=[];return e.default&&e.default().forEach(i=>{typeof i.type<"u"&&i.type.name==="QtiPrompt"&&t.push(i)}),t},detectInteractionSubType(e,t){return GR(e,t)},createComponentProperties(){return{responseIdentifier:this.responseIdentifier,expectedLength:this.presentationFactory.getExpectedLength(),placeholder:this.placeholder,patternMask:this.patternMask,patternMaskMessage:this.patternMaskMessage,heightClass:this.presentationFactory.getHeightClass(),counterStyle:this.presentationFactory.getCounterStyle()}},handleExtendedTextUpdate(e){this.updateResponse(e.response),"state"in e&&this.updateState(e.state),this.evaluateValidity()},handleExtendedTextReady(e){this.node=e.node,this.priorState===null?this.initializeValue():this.restoreValue(this.priorState)},getPriorState(e){const t=_.getItemContextStateVariable(e);if(t===null)return null;if(!("value"in t))throw new O('Extended Text Interaction State Invalid. "value" property not found.');if(!("state"in t))throw new O('Extended Text Interaction State Invalid. "state" property not found.');return t}},created(){try{this.responseDeclaration=La.validateResponseIdentifierAttribute(_,this.responseIdentifier),this.setInteractionSubType(this.detectInteractionSubType(this.$.vnode.props.class,this.format)),this.presentationFactory=new Yx(this.$.vnode.props.class,this.expectedLength),La.validateMaxMinStrings(this.maxStrings,this.minStrings),this.priorState=this.getPriorState(this.responseIdentifier),this.cardinality=this.getCardinality(),this.hasPrompts=this.getPrompts(this.$slots).length>0,this.appliedRegex=La.validatePattern("pattern-mask",this.patternMask)}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{_.defineInteraction({identifier:this.responseIdentifier,interactionType:"ExtendedText",interactionSubType:this.interactionSubType,node:this,resetValue:this.resetValue,isValidResponse:this.isValidResponse,invalidResponseMessage:this.getInvalidResponseMessage()}),console.log("["+this.$options.name+"][Identifier]",this.responseIdentifier)}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}}},XR={ref:"root",class:"qti-extended-text-interaction"},ZR={ref:"prompt",class:"qti-prompt-wrapper"};function JR(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",XR,[l.createElementVNode("div",ZR,[l.renderSlot(e.$slots,"default")],512),(l.openBlock(),l.createBlock(l.resolveDynamicComponent(r.interactionTemplate),{ref:"textarea",onExtendedTextUpdate:r.handleExtendedTextUpdate,onExtendedTextReady:r.handleExtendedTextReady},null,40,["onExtendedTextUpdate","onExtendedTextReady"]))],512)}const ek=B(YR,[["render",JR]]);class tk{constructor(t){return this.constants={QTI_ORIENTATION_HORIZONTAL:"qti-orientation-horizontal",QTI_ORIENTATION_VERTICAL:"qti-orientation-vertical",QTI_INPUT_WIDTH_DEFAULT:"",QTI_INPUT_WIDTH_1:"qti-input-width-1",QTI_INPUT_WIDTH_2:"qti-input-width-2",QTI_INPUT_WIDTH_3:"qti-input-width-3",QTI_INPUT_WIDTH_4:"qti-input-width-4",QTI_INPUT_WIDTH_5:"qti-input-width-5",QTI_INPUT_WIDTH_6:"qti-input-width-6",QTI_INPUT_WIDTH_10:"qti-input-width-10",QTI_INPUT_WIDTH_15:"qti-input-width-15",QTI_INPUT_WIDTH_20:"qti-input-width-20",QTI_INPUT_WIDTH_25:"qti-input-width-25",QTI_INPUT_WIDTH_30:"qti-input-width-30",QTI_INPUT_WIDTH_35:"qti-input-width-35",QTI_INPUT_WIDTH_40:"qti-input-width-40",QTI_INPUT_WIDTH_45:"qti-input-width-45",QTI_INPUT_WIDTH_50:"qti-input-width-50",QTI_INPUT_WIDTH_72:"qti-input-width-72"},this.classList=t,this.presentation_OrientationClass=this.constants.QTI_ORIENTATION_HORIZONTAL,this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_DEFAULT,this.presentation_MaxLength=8,this.processClassAttribute(),this}processClassAttribute(){if(typeof this.classList>"u"||this.classList===null||this.classList.length==0)return;const t=this.classList.split(" ");for(let i=0;i<t.length;i++)switch(t[i]){case this.constants.QTI_ORIENTATION_VERTICAL:this.presentation_OrientationClass=this.constants.QTI_ORIENTATION_VERTICAL;break;case this.constants.QTI_ORIENTATION_HORIZONTAL:this.presentation_OrientationClass=this.constants.QTI_ORIENTATION_HORIZONTAL;break;case this.constants.QTI_INPUT_WIDTH_1:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_1,this.presentation_MaxLength=1;break;case this.constants.QTI_INPUT_WIDTH_2:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_2,this.presentation_MaxLength=2;break;case this.constants.QTI_INPUT_WIDTH_3:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_3,this.presentation_MaxLength=3;break;case this.constants.QTI_INPUT_WIDTH_4:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_4,this.presentation_MaxLength=4;break;case this.constants.QTI_INPUT_WIDTH_5:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_5,this.presentation_MaxLength=5;break;case this.constants.QTI_INPUT_WIDTH_6:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_6,this.presentation_MaxLength=6;break;case this.constants.QTI_INPUT_WIDTH_10:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_10,this.presentation_MaxLength=10;break;case this.constants.QTI_INPUT_WIDTH_15:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_15,this.presentation_MaxLength=15;break;case this.constants.QTI_INPUT_WIDTH_20:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_20,this.presentation_MaxLength=20;break;case this.constants.QTI_INPUT_WIDTH_25:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_25,this.presentation_MaxLength=25;break;case this.constants.QTI_INPUT_WIDTH_30:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_30,this.presentation_MaxLength=30;break;case this.constants.QTI_INPUT_WIDTH_35:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_35,this.presentation_MaxLength=35;break;case this.constants.QTI_INPUT_WIDTH_40:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_40,this.presentation_MaxLength=40;break;case this.constants.QTI_INPUT_WIDTH_45:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_45,this.presentation_MaxLength=45;break;case this.constants.QTI_INPUT_WIDTH_50:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_50,this.presentation_MaxLength=50;break;case this.constants.QTI_INPUT_WIDTH_72:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_72,this.presentation_MaxLength=500;break}}getOrientationClass(){return this.presentation_OrientationClass}isOrientationVertical(){return this.presentation_OrientationClass==this.constants.QTI_ORIENTATION_VERTICAL}getWidthClass(){return this.presentation_WidthClass}getVerticalMaxLength(){return this.presentation_MaxLength}}const ik=new G,sk={name:"TextEntryPlainDefault",emits:["textEntryReady","textEntryUpdate"],components:{Tooltip:sa},props:{responseIdentifier:{required:!0,type:String},expectedLength:{required:!1,type:String},placeholder:{required:!1,type:String,default:""},patternMask:{required:!1,type:String},patternMaskMessage:{required:!1,type:String,default:"Invalid Input"},spellcheck:{required:!1,type:String,default:"false"},maxlength:{required:!1,type:String,default:"500"}},computed:{computedExpectedLength(){return typeof this.expectedLength<"u"?this.expectedLength*1:400},hasPatternMask(){return typeof this.patternMask<"u"},colorStyle(){return _.getItemContextPnp().getColorStyle()},disabled(){return this.isDisabled}},data(){return{response:"",priorResponse:"",appliedRegex:null,displayMessage:!1,isDisabled:!1}},methods:{getResponse(){return this.response},setResponse(e){if(e===null){this.response="";return}this.response=e},getState(){return this.state},setState(e){this.state=e},setIsDisabled(e){if(this.isDisabled=e,e){const t=this.getResponse();this.$refs.label.innerHTML=t===null?"":t,this.$refs.label.classList.remove("qti-hidden"),this.$refs.label.setAttribute("tabIndex",0),this.$refs.input.classList.add("qti-hidden"),(t===null||t.length===0)&&(this.$refs.label.style.paddingRight="1.1rem")}else this.$refs.label.classList.add("qti-hidden"),this.$refs.label.setAttribute("tabIndex",-1),this.$refs.input.classList.remove("qti-hidden")},handleInput(e){e.preventDefault();let t=!0;this.appliedRegex!==null?t=this.applyPatternMask(this.$refs.input.value):this.setResponse(this.$refs.input.value),t&&(this.priorResponse=this.$refs.input.value,this.$parent.$emit("textEntryUpdate",{response:this.getResponse()}))},getLength(){return this.response.length},applyPatternMask(e){return this.appliedRegex.test(e)?(this.setResponse(e),this.priorResponse=e,!0):(this.showPatternMaskMessage(),this.setResponse(this.priorResponse),!1)},showPatternMaskMessage(){this.$refs.tooltip.show(),this.hidePatternMaskMessage()},hidePatternMaskMessage(e=3e3){setTimeout(()=>{this.$refs.tooltip.hide()},e)}},created(){this.appliedRegex=ik.validatePattern("pattern-mask",this.patternMask)},mounted(){this.$parent.$emit("textEntryReady",{node:this})}},nk={ref:"root"},rk={ref:"label",class:"text-entry-default-label qti-hidden"},ak=["placeholder","disabled","spellcheck","maxlength"];function ok(e,t,i,s,n,r){const a=l.resolveComponent("tooltip");return l.openBlock(),l.createElementBlock("span",nk,[l.createElementVNode("span",rk,null,512),l.withDirectives(l.createElementVNode("input",l.mergeProps({ref:"input",class:"text-entry-default"},e.$attrs,{"onUpdate:modelValue":t[0]||(t[0]=o=>n.response=o),type:"text",placeholder:i.placeholder,disabled:r.disabled,autocapitalize:"none",spellcheck:i.spellcheck,maxlength:i.maxlength,onInput:t[1]||(t[1]=(...o)=>r.handleInput&&r.handleInput(...o))}),null,16,ak),[[l.vModelText,n.response]]),r.hasPatternMask?(l.openBlock(),l.createBlock(a,{key:0,ref:"tooltip",target:()=>e.$refs.input,message:i.patternMaskMessage,"color-style":r.colorStyle},null,8,["target","message","color-style"])):l.createCommentVNode("",!0)],512)}const ow=B(sk,[["render",ok]]),lk=new G,ck={name:"TextEntryPlainDefaultVertical",emits:["textEntryReady","textEntryUpdate"],components:{Tooltip:sa},props:{responseIdentifier:{required:!0,type:String},expectedLength:{required:!1,type:String},placeholder:{required:!1,type:String,default:""},patternMask:{required:!1,type:String},patternMaskMessage:{required:!1,type:String,default:"Invalid Input"},spellcheck:{required:!1,type:String,default:"false"},widthClass:{required:!1,type:String,default:""},maxlength:{required:!1,type:String,default:"8"}},computed:{computedExpectedLength(){return typeof this.expectedLength<"u"?this.expectedLength*1:400},hasPatternMask(){return typeof this.patternMask<"u"},colorStyle(){return _.getItemContextPnp().getColorStyle()},disabled(){return this.isDisabled}},data(){return{response:"",priorResponse:"",appliedRegex:null,displayMessage:!1,caretIndex:0,maxlengthMessage:"",isDisabled:!1}},inheritAttrs:!1,methods:{getResponse(){return this.response},setResponse(e,t=!1){e===null?this.response="":this.response=e,t&&this.updateContent(this.response)},getState(){return this.state},setState(e){this.state=e},setIsDisabled(e){if(this.isDisabled=e,e){const t=this.getResponse();this.$refs.label.innerHTML=t===null?"":t,this.$refs.label.classList.remove("qti-hidden"),this.$refs.label.setAttribute("tabIndex",0),this.$refs.input.classList.add("qti-hidden"),this.hidePlaceholder()}else this.$refs.label.classList.add("qti-hidden"),this.$refs.label.setAttribute("tabIndex",-1),this.$refs.input.classList.remove("qti-hidden"),this.getContent().length===0?this.showPlaceholder():this.hidePlaceholder()},getContent(){return this.$refs.input.innerText},updateContent(e){this.$refs.input.innerText=e,e.length>0?this.hidePlaceholder():this.showPlaceholder()},getCaretIndex(){return this.caretIndex},setCaretIndex(e){this.caretIndex=e},handleInput(e){e.preventDefault();let t=!0;this.setCaretIndex(this.getCaretPos(this.$refs.input)-1);const i=this.getContent();i.length>0&&this.hidePlaceholder(),this.applyLimitCheck(i)&&(this.appliedRegex!==null?t=this.applyPatternMask(i):this.setResponse(i),t&&(i.length==0&&this.showPlaceholder(),this.priorResponse=i,this.$parent.$emit("textEntryUpdate",{response:this.getResponse()})))},handlePaste(e){e.preventDefault();const t=this.getRange();if(t===null)return;const i=this.getContent(),s=t.startOffset,n=t.endOffset;let r=e.clipboardData.getData("text/plain"),a=i.substring(0,s)+r+i.substring(n),o=!0;if(a.length>0&&this.hidePlaceholder(),a.length>this.maxlength){this.showMaxlengthMessage(),this.setResponse(this.priorResponse,!0),this.setCaretPos(this.$refs.input,s);return}this.appliedRegex!==null?o=this.applyPatternMask(a):this.setResponse(a,!0),o&&(this.setCaretIndex(s+r.length),this.setCaretPos(this.$refs.input,this.getCaretIndex()),this.priorResponse=a,this.$parent.$emit("textEntryUpdate",{response:this.getResponse()}))},handleDrop(e){e.preventDefault()},handleKeydown(e){switch(this.setCaretIndex(this.getCaretPos(this.$refs.input)),e.code){case"Enter":e.preventDefault();return;case"KeyI":case"KeyB":case"KeyU":e.ctrlKey&&e.preventDefault();return}},newDownRange(e){const t=e.firstChild,i=this.getRange();if(i===null)return;const s=i.startOffset,n=i.endOffset;if(n===this.getResponse().length)return;const r=window.getSelection();r.removeAllRanges();const a=document.createRange();a.setStart(t,s),a.setEnd(t,n+1),r.addRange(a)},newUpRange(e){const t=e.firstChild,i=this.getRange();if(i===null)return;const s=i.startOffset,n=i.endOffset;if(s===0)return;const r=window.getSelection();r.removeAllRanges();const a=document.createRange();a.setStart(t,s-1),a.setEnd(t,n),r.addRange(a)},getRange(){const e=document.getSelection();return e.rangeCount===0?null:e.getRangeAt(0)},getCaretPos(e){let t=0;if(typeof window.getSelection<"u"&&window.getSelection().rangeCount!==0){const n=window.getSelection().getRangeAt(0),r=n.cloneRange();r.selectNodeContents(e),r.setEnd(n.endContainer,n.endOffset),t=r.toString().length}return t},setCaretPos(e,t){e.focus(),e.childNodes.length===1&&document.getSelection().collapse(e.childNodes[0],t)},showPlaceholder(){this.$refs.placeholder.classList.remove("text-entry-ph-hidden")},hidePlaceholder(){this.$refs.placeholder.classList.add("text-entry-ph-hidden")},handleBlur(){this.$refs.root.classList.remove("focused")},handleFocus(){this.$refs.root.classList.add("focused")},getLength(){return this.response.length},applyLimitCheck(e){return e.length>this.maxlength?(this.showMaxlengthMessage(),this.setResponse(this.priorResponse,!0),this.setCaretPos(this.$refs.input,this.getCaretIndex()),!1):!0},applyPatternMask(e){return this.appliedRegex.test(e)?(this.setResponse(e),this.priorResponse=e,!0):(this.showPatternMaskMessage(),this.setResponse(this.priorResponse,!0),this.setCaretPos(this.$refs.input,this.getCaretIndex()),!1)},showPatternMaskMessage(){this.$refs.tooltip.show(),this.hidePatternMaskMessage()},hidePatternMaskMessage(e=3e3){setTimeout(()=>{this.$refs.tooltip.hide()},e)},showMaxlengthMessage(){this.$refs.tooltipMaxlength.show(),this.hideMaxlengthMessage()},hideMaxlengthMessage(e=1e3){setTimeout(()=>{this.$refs.tooltipMaxlength.hide()},e)},computeMaxlengthMessage(){this.maxlengthMessage=`Maximum of ${this.maxlength} character`+(this.maxlength==="1"?"":"s")}},created(){this.appliedRegex=lk.validatePattern("pattern-mask",this.patternMask),this.computeMaxlengthMessage()},mounted(){this.$parent.$emit("textEntryReady",{node:this})}},uk=["spellcheck","maxlength","disabled"];function hk(e,t,i,s,n,r){const a=l.resolveComponent("tooltip");return l.openBlock(),l.createElementBlock("div",l.mergeProps({ref:"root",class:"text-entry-default-vert-wrapper"},e.$attrs),[l.createElementVNode("div",{ref:"label",class:"text-entry-default-vert-label qti-hidden",onFocus:t[0]||(t[0]=(...o)=>r.handleFocus&&r.handleFocus(...o)),onBlur:t[1]||(t[1]=(...o)=>r.handleBlur&&r.handleBlur(...o))},null,544),l.createElementVNode("div",{ref:"input",class:"text-entry-default-vert",tabindex:"0",contenteditable:"true",autocapitalize:"false",spellcheck:i.spellcheck,maxlength:i.maxlength,disabled:r.disabled,onInput:t[2]||(t[2]=(...o)=>r.handleInput&&r.handleInput(...o)),onBlur:t[3]||(t[3]=(...o)=>r.handleBlur&&r.handleBlur(...o)),onFocus:t[4]||(t[4]=(...o)=>r.handleFocus&&r.handleFocus(...o)),onKeydown:t[5]||(t[5]=(...o)=>r.handleKeydown&&r.handleKeydown(...o)),onPaste:t[6]||(t[6]=(...o)=>r.handlePaste&&r.handlePaste(...o)),onDrop:t[7]||(t[7]=(...o)=>r.handleDrop&&r.handleDrop(...o))},null,40,uk),l.createElementVNode("label",{ref:"placeholder",class:"text-entry-default-vert-ph","aria-hidden":"true"},l.toDisplayString(i.placeholder),513),r.hasPatternMask?(l.openBlock(),l.createBlock(a,{key:0,ref:"tooltip",target:()=>e.$refs.input,message:i.patternMaskMessage,"color-style":r.colorStyle},null,8,["target","message","color-style"])):l.createCommentVNode("",!0),l.createVNode(a,{ref:"tooltipMaxlength",target:()=>e.$refs.input,message:n.maxlengthMessage,"color-style":r.colorStyle},null,8,["target","message","color-style"])],16)}const dk=B(ck,[["render",hk]]),Ll={DEFAULT:"default-plain-horizontal",DEFAULT_VERTICAL:"default-plain-vertical"};function fk(e,t,i){switch(e){case Ll.DEFAULT:return{template:'<text-entry-plain-default response-identifier="'+t.responseIdentifier+'" '+Ph(t)+qh(t)+Oh(t)+Bh(t)+Dh(t)+Qh(t)+lw(t)+Hh(i)+" />",components:{TextEntryPlainDefault:ow}};case Ll.DEFAULT_VERTICAL:return{template:'<text-entry-plain-default-vertical response-identifier="'+t.responseIdentifier+'" '+Ph(t)+qh(t)+Oh(t)+Bh(t)+Dh(t)+Qh(t)+mk(t)+gk(t)+Hh(i)+" />",components:{TextEntryPlainDefaultVertical:dk}};default:return{template:'<text-entry-plain-default response-identifier="'+t.responseIdentifier+'" '+Ph(t)+qh(t)+Oh(t)+Bh(t)+Dh(t)+Qh(t)+lw(t)+Hh(i)+" />",components:{TextEntryPlainDefault:ow}}}}function pk(e){return yk(e)?Ll.DEFAULT_VERTICAL:Ll.DEFAULT}function qh(e){return typeof e.patternMask>"u"?"":'pattern-mask="'+e.patternMask+'" '}function Oh(e){return'pattern-mask-message="'+e.patternMaskMessage+'" '}function Bh(e){return'placeholder="'+e.placeholder+'" '}function Ph(e){return typeof e.expectedLength>"u"?"":'expected-length="'+e.expectedLength+'" '}function Dh(e){return typeof e.format>"u"||e.format.length==0?"":'format="'+e.format+'" '}function Qh(e){return typeof e.spellcheck>"u"?"":'spellcheck="'+e.spellcheck+'" '}function lw(e){return typeof e.maxlength>"u"?"":'maxlength="'+e.maxlength+'" '}function mk(e){return typeof e.widthClass>"u"?"":'width-class="'+e.widthClass+'" '}function gk(e){return typeof e.verticalMaxlength>"u"?"":'maxlength="'+e.verticalMaxlength+'" '}function Hh(e){let t="";for(const[i,s]of Object.entries(e))t+=`${i}="${s}" `;return t}function yk(e){return typeof e>"u"||e===null||e.length==0?!1:cw("qti-writing-orientation-vertical-rl",e)?!0:cw("qti-orientation-vertical",e)}function cw(e,t){const i=t.split(" ");for(let s=0;s<i.length;s++)if(i[s]===e)return!0;return!1}const Ml=new G,wk={name:"QtiTextEntryInteraction",props:{responseIdentifier:{required:!0,type:String},expectedLength:{required:!1,type:String},patternMask:{required:!1,type:String},placeholderText:{required:!1,type:String},format:{required:!1,type:String,default:""},dataPatternmaskMessage:{required:!1,type:String},dataMaxlength:{required:!1,type:String},dataSpellcheck:{required:!1,type:String}},computed:{interactionTemplate(){return fk(this.interactionSubType,this.createComponentProperties(),this.$attrs)},placeholder(){return Ml.validatePlaceholderText(this.placeholderText,"")},hasPatternMask(){return typeof this.patternMask<"u"},patternMaskMessage(){return Ml.validatePatternmaskMessage(this.dataPatternmaskMessage,"Invalid Input")},colorStyle(){return _.getItemContextPnp().getColorStyle()},computeMaxlength(){return typeof this.dataMaxlength<"u"?this.dataMaxlength:500},computeSpellcheck(){return typeof this.dataSpellcheck<"u"?this.dataSpellcheck:!1}},data(){return{response:"",state:null,baseType:"string",cardinality:"single",interactionSubType:null,isValidResponse:!1,invalidResponseMessage:"Input Required",classAttribute:"",isDisabled:!1,isQtiValid:!0,presentationFactory:null,node:null,priorState:null}},methods:{getResponse(){return this.response.length===0?null:this.response},setResponse(e){e===null?this.response="":this.response=e,this.node.setResponse(this.response,!0)},updateResponse(e){e===null?this.response="":this.response=e},getState(){return this.state},setState(e){this.state=e},getIsValid(){return this.isValidResponse},setIsValid(e){this.isValidResponse=e},setInteractionSubType(e){this.interactionSubType=e},getInteractionSubType(){return this.interactionSubType},disable(){this.toggleDisable(!0)},enable(){this.toggleDisable(!1)},toggleDisable(e){this.isDisabled=e,this.node.setIsDisabled(e)},getInvalidResponseMessage(){return this.invalidResponseMessage},initializeValue(){this.setResponse(null),this.setState(this.computeState()),this.setIsValid(!1)},resetValue(){console.log("[ResetValue][identifier]",this.responseIdentifier),this.setResponse(null),this.setState(this.computeState()),this.setIsValid(!1)},restoreValue(e){this.setResponse(e.value),this.setState(e.state),this.updateValidity(this.computeIsValid())},getCardinality(){return this.cardinality},computeState(){return{}},computeIsValid(){return!(this.response===null||this.response.length<1)},evaluateValidity(){const e=this.getIsValid(),t=this.computeIsValid();e!==t&&this.updateValidity(t)},updateValidity(e){this.setIsValid(e),_.setInteractionIsValidResponse({identifier:this.responseIdentifier,isValidResponse:e})},detectInteractionSubType(e){return pk(e)},createComponentProperties(){return{responseIdentifier:this.responseIdentifier,placeholder:this.placeholder,patternMask:this.patternMask,patternMaskMessage:this.patternMaskMessage,spellcheck:this.computeSpellcheck,maxlength:this.computeMaxlength,widthClass:this.presentationFactory.getWidthClass(),verticalMaxlength:this.presentationFactory.getVerticalMaxLength(),format:this.format}},handleTextEntryUpdate(e){this.updateResponse(e.response),this.evaluateValidity()},handleTextEntryReady(e){this.node=e.node,this.priorState===null?this.initializeValue():this.restoreValue(this.priorState)},getPriorState(e){const t=_.getItemContextStateVariable(e);if(t===null)return null;if(!("value"in t))throw new O('Text Entry Interaction State Invalid. "value" property not found.');if(!("state"in t))throw new O('Text Entry Interaction State Invalid. "state" property not found.');return t}},created(){try{this.responseDeclaration=Ml.validateResponseIdentifierAttribute(_,this.responseIdentifier),this.setInteractionSubType(this.detectInteractionSubType(this.$.vnode.props.class)),this.presentationFactory=new tk(this.$.vnode.props.class),this.priorState=this.getPriorState(this.responseIdentifier),this.cardinality=this.getCardinality(),this.appliedRegex=Ml.validatePattern("pattern-mask",this.patternMask)}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.priorState===null?this.initializeValue():this.restoreValue(this.priorState),_.defineInteraction({identifier:this.responseIdentifier,interactionType:"TextEntry",node:this,resetValue:this.resetValue,isValidResponse:this.isValidResponse,invalidResponseMessage:this.getInvalidResponseMessage()}),console.log("["+this.$options.name+"][Identifier]",this.responseIdentifier)}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}}};function bk(e,t,i,s,n,r){return l.openBlock(),l.createBlock(l.resolveDynamicComponent(r.interactionTemplate),{ref:"input",class:"qti-text-entry-interaction",onTextEntryUpdate:r.handleTextEntryUpdate,onTextEntryReady:r.handleTextEntryReady},null,40,["onTextEntryUpdate","onTextEntryReady"])}const vk=B(wk,[["render",bk]]),Ek=new G,Tk={name:"QtiMatchInteraction",props:{responseIdentifier:{required:!0,type:String},minAssociations:{required:!1,type:String,default:"0"},maxAssociations:{required:!1,type:String,default:"1"},shuffle:{required:!1,type:String,default:"false"},dataMaxSelectionsMessage:{required:!1,type:String},dataMinSelectionsMessage:{required:!1,type:String},dataFirstColumnHeader:{required:!1,type:String,default:null}},data(){return{response:null,state:null,isValidResponse:!1,matchsets:[],orders:[],cardinality:"single",minSelectionsMessage:"",maxSelectionsMessage:"",responseDeclaration:null,hasPrompts:!1,matchInteractionStaticClass:"",interactionSubType:"default",headerHidden:"false",rowCentric:"false",isQtiValid:!0,priorState:null}},methods:{getResponse(){return this.response},setResponse(e){this.response=e},getState(){return this.state},setState(e){this.state=e},setInteractionSubType(e){this.interactionSubType=e},getInteractionSubType(){return this.interactionSubType},getIsValid(){return this.isValidResponse},setIsValid(e){this.isValidResponse=e},getInvalidResponseMessage(){return this.minSelectionsMessage},disable(){this.$refs.matchgroup.disable()},enable(){this.$refs.matchgroup.enable()},initializeValue(e){this.setResponse(e),this.setState(this.computeState()),this.updateValidity(this.computeIsValid())},resetValue(){console.log("[ResetValue][identifier]",this.responseIdentifier),this.setResponse(null),this.setState(null),this.priorState=null,this.$refs.matchgroup.resetGroupUI()},restoreValue(e){this.setResponse(e),this.setState(this.computeState()),this.updateValidity(this.computeIsValid())},getCardinality(){let e=_.getResponseDeclaration(this.responseIdentifier);return this.cardinality=typeof e<"u"?e.cardinality:"single",this.cardinality},getPrompts(e){let t=[];return e.default&&e.default().forEach(i=>{typeof i.type<"u"&&i.type.name==="QtiPrompt"&&t.push(i)}),t},movePrompt(){if(!this.hasPrompts)return;const e=this.$refs.root.querySelector(".qti-prompt");e!==null&&this.$refs.prompt.appendChild(e)},handleMatchGroupReady(e){this.matchsets=e.matchsets,this.orders=e.orders,this.initializeValue(e.response)},handleMatchGroupUpdate(e){this.setResponse(e.response),this.updateValidity(this.computeIsValid())},handleAssociationsLimit(){_.NotifyInteractionSelectionsLimit(this.maxSelectionsMessage)},computeState(){return this.priorState!==null?this.priorState.state:{orders:this.orders}},computeIsValid(){const e=this.getResponse(),t=this.minAssociations*1;return t===0?!0:e===null?!1:this.cardinality==="single"||e.length>=t},evaluateValidity(){const e=this.getIsValid(),t=this.computeIsValid();e!==t&&this.updateValidity(t)},updateValidity(e){this.setIsValid(e),_.setInteractionIsValidResponse({identifier:this.responseIdentifier,isValidResponse:e})},computeMaxSelectionsMessage(){if(typeof this.dataMaxSelectionsMessage<"u"){this.maxSelectionsMessage=this.dataMaxSelectionsMessage;return}this.maxSelectionsMessage=this.maxAssociations*1==0?"":"You may make a maximum of "+this.maxAssociations+" match"+(this.maxAssociations*1>1?"es":"")+" for this question."},computeMinSelectionsMessage(){if(typeof this.dataMinSelectionsMessage<"u"){this.minSelectionsMessage=this.dataMinSelectionsMessage;return}this.minAssociations*1!=0&&(this.minSelectionsMessage="You must make at least "+this.minAssociations+" match"+(this.minAssociations*1>1?"es":"")+" for this question.")},detectInteractionSubType(e){return this.getMatchInteractionSubType(e)},getMatchInteractionSubType(e){let t="default";if(typeof e>"u"||e===null||e.length==0)return t;this.matchInteractionStaticClass=e;const i=e.split(" ");for(let s=0;s<i.length;s++)switch(i[s]){case"qti-match-tabular":t="matchtabular";break;case"qti-header-hidden":this.headerHidden="true";break;case"row-centric":this.rowCentric="true";break}return t},getPriorState(e){const t=_.getItemContextStateVariable(e);if(t===null)return null;if(!("value"in t))throw new O('Match Interaction State Invalid. "value" property not found.');if(!("state"in t))throw new O('Match Interaction State Invalid. "state" property not found.');if(!("orders"in t.state))throw new O('Match Interaction State Invalid. "orders" property not found.');return t}},created(){try{if(this.responseDeclaration=Ek.validateResponseIdentifierAttribute(_,this.responseIdentifier),this.setInteractionSubType(this.detectInteractionSubType(this.$.vnode.props.class)),this.priorState=this.getPriorState(this.responseIdentifier),this.cardinality=this.getCardinality(),this.cardinality!=="single"&&this.cardinality!=="multiple")throw new c('qti-match-interaction cardinality must be "single" or "multiple"');if(this.maxAssociations*1!=1&&this.cardinality!=="multiple")throw new c('qti-match-interaction response variable must have "multiple" cardinality because max-associations is '+this.maxAssociations);if(this.minAssociations*1>1&&this.cardinality==="single")throw new c('qti-match-interaction response variable must have "multiple" cardinality because min-associations is '+this.minAssociations);this.hasPrompts=this.getPrompts(this.$slots).length>0,this.computeMinSelectionsMessage(),this.computeMaxSelectionsMessage()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.movePrompt(),_.defineInteraction({identifier:this.responseIdentifier,interactionType:"Match",interactionSubType:this.interactionSubType,node:this,resetValue:this.resetValue,isValidResponse:this.getIsValid(),invalidResponseMessage:this.getInvalidResponseMessage(),maxSelectionsMessage:this.maxSelectionsMessage}),console.log("["+this.$options.name+"][Identifier]",this.responseIdentifier)}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}}},Ck={ref:"root",class:"qti-match-interaction"},Sk={ref:"prompt",class:"qti-prompt-wrapper"};function xk(e,t,i,s,n,r){const a=l.resolveComponent("MatchGroup");return l.openBlock(),l.createElementBlock("div",Ck,[l.createElementVNode("div",Sk,null,512),l.createVNode(a,l.mergeProps({ref:"matchgroup",cardinality:n.cardinality,shuffle:i.shuffle,responseIdentifier:i.responseIdentifier,maxAssociations:i.maxAssociations,minAssociations:i.minAssociations,interactionSubType:n.interactionSubType,matchInteractionStaticClass:n.matchInteractionStaticClass,headerHidden:n.headerHidden,rowCentric:n.rowCentric,dataFirstColumnHeader:i.dataFirstColumnHeader,priorState:n.priorState,onMatchGroupReady:r.handleMatchGroupReady,onMatchGroupUpdate:r.handleMatchGroupUpdate,onMatchGroupAssociationsLimit:r.handleAssociationsLimit},e.$attrs),{default:l.withCtx(()=>[l.renderSlot(e.$slots,"default")]),_:3},16,["cardinality","shuffle","responseIdentifier","maxAssociations","minAssociations","interactionSubType","matchInteractionStaticClass","headerHidden","rowCentric","dataFirstColumnHeader","priorState","onMatchGroupReady","onMatchGroupUpdate","onMatchGroupAssociationsLimit"])],512)}const _k=B(Tk,[["render",xk]]),Ik=new G,Vk={name:"QtiGapMatchInteraction",props:{responseIdentifier:{required:!0,type:String},minAssociations:{required:!1,type:String,default:"0"},maxAssociations:{required:!1,type:String,default:"1"},shuffle:{required:!1,type:String,default:"false"},dataMaxSelectionsMessage:{required:!1,type:String},dataMinSelectionsMessage:{required:!1,type:String},dataChoicesContainerWidth:{required:!1,type:String,default:null}},data(){return{response:null,state:null,isValidResponse:!1,choices:[],order:[],cardinality:"single",minSelectionsMessage:"",maxSelectionsMessage:"",responseDeclaration:null,hasPrompts:!1,gapMatchInteractionStaticClass:"",interactionSubType:"default",isQtiValid:!0,priorState:null}},methods:{getResponse(){return this.response},setResponse(e){this.response=e},getState(){return this.state},setState(e){this.state=e},setInteractionSubType(e){this.interactionSubType=e},getInteractionSubType(){return this.interactionSubType},getIsValid(){return this.isValidResponse},setIsValid(e){this.isValidResponse=e},getInvalidResponseMessage(){return this.minSelectionsMessage},disable(){this.$refs.gapmatchgroup.disable()},enable(){this.$refs.gapmatchgroup.enable()},initializeValue(e){this.setResponse(e),this.setState(this.computeState()),this.updateValidity(this.computeIsValid())},resetValue(){console.log("[ResetValue][identifier]",this.responseIdentifier),this.setResponse(null),this.setState(null),this.priorState=null,this.$refs.matchgroup.resetGroupUI()},restoreValue(e){this.setResponse(e),this.setState(this.computeState()),this.updateValidity(this.computeIsValid())},getCardinality(){let e=_.getResponseDeclaration(this.responseIdentifier);return this.cardinality=typeof e<"u"?e.cardinality:"single",this.cardinality},getPrompts(e){let t=[];return e.default&&e.default().forEach(i=>{typeof i.type<"u"&&i.type.name==="QtiPrompt"&&t.push(i)}),t},movePrompt(){if(!this.hasPrompts)return;const e=this.$refs.root.querySelector(".qti-prompt");e!==null&&this.$refs.prompt.appendChild(e)},handleGapMatchGroupReady(e){this.choices=e.choices,this.order=e.order,this.initializeValue(e.response)},handleGapMatchGroupUpdate(e){this.setResponse(e.response),this.updateValidity(this.computeIsValid())},handleAssociationsLimit(){_.NotifyInteractionSelectionsLimit(this.maxSelectionsMessage)},computeState(){return this.priorState!==null?this.priorState.state:{order:this.order}},computeIsValid(){const e=this.getResponse(),t=this.minAssociations*1;return t===0?!0:e===null?!1:this.cardinality==="single"||e.length>=t},evaluateValidity(){const e=this.getIsValid(),t=this.computeIsValid();e!==t&&this.updateValidity(t)},updateValidity(e){this.setIsValid(e),_.setInteractionIsValidResponse({identifier:this.responseIdentifier,isValidResponse:e})},computeMaxSelectionsMessage(){if(typeof this.dataMaxSelectionsMessage<"u"){this.maxSelectionsMessage=this.dataMaxSelectionsMessage;return}this.maxSelectionsMessage=this.maxAssociations*1==0?"":"You may make a maximum of "+this.maxAssociations+" match"+(this.maxAssociations*1>1?"es":"")+" for this question."},computeMinSelectionsMessage(){if(typeof this.dataMinSelectionsMessage<"u"){this.minSelectionsMessage=this.dataMinSelectionsMessage;return}this.minAssociations*1!=0&&(this.minSelectionsMessage="You must make at least "+this.minAssociations+" match"+(this.minAssociations*1>1?"es":"")+" for this question.")},detectInteractionSubType(e){return this.computeInteractionSubType(e)},computeInteractionSubType(e){let t="default";return typeof e>"u"||e===null||e.length==0||(this.gapMatchInteractionStaticClass=e),t},getPriorState(e){const t=_.getItemContextStateVariable(e);if(t===null)return null;if(!("value"in t))throw new O('Gap Match Interaction State Invalid. "value" property not found.');if(!("state"in t))throw new O('Gap Match Interaction State Invalid. "state" property not found.');if(!("order"in t.state))throw new O('Gap Match Interaction State Invalid. "order" property not found.');return t}},created(){try{if(this.responseDeclaration=Ik.validateResponseIdentifierAttribute(_,this.responseIdentifier),this.setInteractionSubType(this.detectInteractionSubType(this.$.vnode.props.class)),this.priorState=this.getPriorState(this.responseIdentifier),this.cardinality=this.getCardinality(),this.cardinality!=="single"&&this.cardinality!=="multiple")throw new c('qti-gap-match-interaction cardinality must be "single" or "multiple"');if(this.maxAssociations*1!=1&&this.cardinality!=="multiple")throw new c('qti-gap-match-interaction response variable must have "multiple" cardinality because max-associations is '+this.maxAssociations);if(this.minAssociations*1>1&&this.cardinality==="single")throw new c('qti-gap-match-interaction response variable must have "multiple" cardinality because min-associations is '+this.minAssociations);this.hasPrompts=this.getPrompts(this.$slots).length>0,this.computeMinSelectionsMessage(),this.computeMaxSelectionsMessage()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.movePrompt(),_.defineInteraction({identifier:this.responseIdentifier,interactionType:"GapMatch",interactionSubType:this.interactionSubType,node:this,resetValue:this.resetValue,isValidResponse:this.getIsValid(),invalidResponseMessage:this.getInvalidResponseMessage(),maxSelectionsMessage:this.maxSelectionsMessage}),console.log("["+this.$options.name+"][Identifier]",this.responseIdentifier)}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}}},Ak={ref:"root",class:"qti-gap-match-interaction"},$k={ref:"prompt",class:"qti-prompt-wrapper"};function Lk(e,t,i,s,n,r){const a=l.resolveComponent("GapMatchGroup");return l.openBlock(),l.createElementBlock("div",Ak,[l.createElementVNode("div",$k,null,512),l.createVNode(a,l.mergeProps({ref:"gapmatchgroup",cardinality:n.cardinality,shuffle:i.shuffle,responseIdentifier:i.responseIdentifier,maxAssociations:i.maxAssociations,minAssociations:i.minAssociations,interactionSubType:n.interactionSubType,gapMatchInteractionStaticClass:n.gapMatchInteractionStaticClass,dataChoicesContainerWidth:i.dataChoicesContainerWidth,priorState:n.priorState,onGapMatchGroupReady:r.handleGapMatchGroupReady,onGapMatchGroupUpdate:r.handleGapMatchGroupUpdate,onGapMatchGroupAssociationsLimit:r.handleAssociationsLimit},e.$attrs),{default:l.withCtx(()=>[l.renderSlot(e.$slots,"default")]),_:3},16,["cardinality","shuffle","responseIdentifier","maxAssociations","minAssociations","interactionSubType","gapMatchInteractionStaticClass","dataChoicesContainerWidth","priorState","onGapMatchGroupReady","onGapMatchGroupUpdate","onGapMatchGroupAssociationsLimit"])],512)}const Mk=B(Vk,[["render",Lk]]),Nk=new G,Rk={name:"QtiGraphicGapMatchInteraction",props:{responseIdentifier:{required:!0,type:String},minAssociations:{required:!1,type:String,default:"0"},maxAssociations:{required:!1,type:String,default:"1"},shuffle:{required:!1,type:String,default:"false"},dataMaxSelectionsMessage:{required:!1,type:String},dataMinSelectionsMessage:{required:!1,type:String},dataChoicesContainerWidth:{required:!1,type:String,default:null}},data(){return{response:null,state:null,isValidResponse:!1,choices:[],order:[],cardinality:"multiple",minSelectionsMessage:"",maxSelectionsMessage:"",responseDeclaration:null,hasPrompts:!1,interactionStaticClass:"",interactionSubType:"default",isQtiValid:!0,priorState:null}},methods:{getResponse(){return this.response},setResponse(e){this.response=e},getState(){return this.state},setState(e){this.state=e},setInteractionSubType(e){this.interactionSubType=e},getInteractionSubType(){return this.interactionSubType},getIsValid(){return this.isValidResponse},setIsValid(e){this.isValidResponse=e},getInvalidResponseMessage(){return this.minSelectionsMessage},disable(){this.$refs.ggmgroup.disable()},enable(){this.$refs.ggmgroup.enable()},initializeValue(e){this.setResponse(e),this.setState(this.computeState()),this.updateValidity(this.computeIsValid())},resetValue(){console.log("[ResetValue][identifier]",this.responseIdentifier),this.setResponse(null),this.setState(null),this.priorState=null,this.$refs.matchgroup.resetGroupUI()},restoreValue(e){this.setResponse(e),this.setState(this.computeState()),this.updateValidity(this.computeIsValid())},getCardinality(){let e=_.getResponseDeclaration(this.responseIdentifier);return this.cardinality=typeof e<"u"?e.cardinality:"single",this.cardinality},getPrompts(e){let t=[];return e.default&&e.default().forEach(i=>{typeof i.type<"u"&&i.type.name==="QtiPrompt"&&t.push(i)}),t},movePrompt(){if(!this.hasPrompts)return;const e=this.$refs.root.querySelector(".qti-prompt");e!==null&&this.$refs.prompt.appendChild(e)},handleGraphicGapMatchGroupReady(e){this.choices=e.choices,this.order=e.order,this.initializeValue(e.response)},handleGraphicGapMatchGroupUpdate(e){this.setResponse(e.response),this.updateValidity(this.computeIsValid())},handleAssociationsLimit(){_.NotifyInteractionSelectionsLimit(this.maxSelectionsMessage)},computeState(){return this.priorState!==null?this.priorState.state:{order:this.order}},computeIsValid(){const e=this.getResponse(),t=this.minAssociations*1;return t===0?!0:e===null?!1:this.cardinality==="single"||e.length>=t},evaluateValidity(){const e=this.getIsValid(),t=this.computeIsValid();e!==t&&this.updateValidity(t)},updateValidity(e){this.setIsValid(e),_.setInteractionIsValidResponse({identifier:this.responseIdentifier,isValidResponse:e})},computeMaxSelectionsMessage(){if(typeof this.dataMaxSelectionsMessage<"u"){this.maxSelectionsMessage=this.dataMaxSelectionsMessage;return}this.maxSelectionsMessage=this.maxAssociations*1==0?"":"You may make a maximum of "+this.maxAssociations+" match"+(this.maxAssociations*1>1?"es":"")+" for this question."},computeMinSelectionsMessage(){if(typeof this.dataMinSelectionsMessage<"u"){this.minSelectionsMessage=this.dataMinSelectionsMessage;return}this.minAssociations*1!=0&&(this.minSelectionsMessage="You must make at least "+this.minAssociations+" match"+(this.minAssociations*1>1?"es":"")+" for this question.")},detectInteractionSubType(e){return this.computeInteractionSubType(e)},computeInteractionSubType(e){let t="default";return typeof e>"u"||e===null||e.length==0||(this.interactionStaticClass=e),t},getPriorState(e){const t=_.getItemContextStateVariable(e);if(t===null)return null;if(!("value"in t))throw new O('Gap Match Interaction State Invalid. "value" property not found.');if(!("state"in t))throw new O('Gap Match Interaction State Invalid. "state" property not found.');if(!("order"in t.state))throw new O('Gap Match Interaction State Invalid. "order" property not found.');return t}},created(){try{if(this.responseDeclaration=Nk.validateResponseIdentifierAttribute(_,this.responseIdentifier),this.setInteractionSubType(this.detectInteractionSubType(this.$.vnode.props.class)),this.priorState=this.getPriorState(this.responseIdentifier),this.cardinality=this.getCardinality(),this.cardinality!=="multiple")throw new c('qti-graphic-gap-match-interaction cardinality must be "multiple"');this.hasPrompts=this.getPrompts(this.$slots).length>0,this.computeMinSelectionsMessage(),this.computeMaxSelectionsMessage()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.movePrompt(),_.defineInteraction({identifier:this.responseIdentifier,interactionType:"GraphicGapMatch",interactionSubType:this.interactionSubType,node:this,resetValue:this.resetValue,isValidResponse:this.getIsValid(),invalidResponseMessage:this.getInvalidResponseMessage(),maxSelectionsMessage:this.maxSelectionsMessage}),console.log("["+this.$options.name+"][Identifier]",this.responseIdentifier)}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}}},kk={ref:"root",class:"qti-graphic-gap-match-interaction"},qk={ref:"prompt",class:"qti-prompt-wrapper"};function Ok(e,t,i,s,n,r){const a=l.resolveComponent("GraphicGapMatchGroup");return l.openBlock(),l.createElementBlock("div",kk,[l.createElementVNode("div",qk,null,512),l.createVNode(a,l.mergeProps({ref:"ggmgroup",cardinality:n.cardinality,shuffle:i.shuffle,responseIdentifier:i.responseIdentifier,maxAssociations:i.maxAssociations,minAssociations:i.minAssociations,interactionSubType:n.interactionSubType,interactionStaticClass:n.interactionStaticClass,dataChoicesContainerWidth:i.dataChoicesContainerWidth,priorState:n.priorState,onGgmGroupReady:r.handleGraphicGapMatchGroupReady,onGgmGroupUpdate:r.handleGraphicGapMatchGroupUpdate,onGgmGroupAssociationsLimit:r.handleAssociationsLimit},e.$attrs),{default:l.withCtx(()=>[l.renderSlot(e.$slots,"default")]),_:3},16,["cardinality","shuffle","responseIdentifier","maxAssociations","minAssociations","interactionSubType","interactionStaticClass","dataChoicesContainerWidth","priorState","onGgmGroupReady","onGgmGroupUpdate","onGgmGroupAssociationsLimit"])],512)}const Bk=B(Rk,[["render",Ok]]),Pk={},Dk={ref:"root",class:"qti3-player-media-group"};function Qk(e,t){return l.openBlock(),l.createElementBlock("div",Dk,[l.renderSlot(e.$slots,"default")],512)}const uw=B(Pk,[["render",Qk]]),hw=new G,Hk={name:"QtiMediaInteraction",components:[uw],props:{responseIdentifier:{required:!0,type:String},autostart:{required:!1,type:String,default:"false"},minPlays:{required:!1,type:String,default:"0"},maxPlays:{required:!1,type:String,default:"0"},loop:{required:!1,type:String,default:"false"},coords:{required:!1,type:String},dataMaxPlaysMessage:{required:!1,type:String},dataMinPlaysMessage:{required:!1,type:String}},data(){return{response:null,state:null,isValidResponse:!1,cardinality:"single",minPlaysMessage:"",maxPlaysMessage:"",responseDeclaration:null,mediaType:"media",isAutostart:!1,isLoop:!1,isDisabled:!1,isQtiValid:!0,hasPrompts:!1,node:null,priorState:null}},methods:{getResponse(){return this.response},setResponse(e){this.response=e},incrementPlays(){let e=this.getResponse();this.setResponse(e===null?1:e+1)},getState(){return this.state},setState(e){this.state=e},getIsValid(){return this.isValidResponse},setIsValid(e){this.isValidResponse=e},disable(){this.node!==null&&this.node.disable()},enable(){this.node!==null&&this.node.enable()},getInvalidResponseMessage(){return this.computeMinPlaysMessage(),this.minPlaysMessage},resetValue(){console.log("[ResetValue][identifier]",this.responseIdentifier),this.priorState=null,this.setResponse(null),this.setState(this.computeState()),this.updateValidity(this.computeIsValid())},restoreValue(e){e!==null&&(this.setResponse(e),this.setState(this.computeState()),this.updateValidity(this.computeIsValid()),this.evaluateMaxPlays())},getCardinality(){return this.cardinality},getPrompts(e){let t=[];return e.default&&e.default().forEach(i=>{typeof i.type<"u"&&i.type.name==="QtiPrompt"&&t.push(i)}),t},movePrompt(){if(!this.hasPrompts)return;const e=this.$refs.root.querySelector(".qti-prompt");e!==null&&this.$refs.prompt.appendChild(e)},handleMediaMounted(e){this.node=e.node,this.mediaType=e.mediaType,e.mediaType==="audio"&&this.node.setAudioSubType("audioprogress"),this.evaluateMaxPlays()},handleMediaLoaded(e){this.node=e.node,this.evaluateMaxPlays(),this.evaluateAutostart()},handleMediaEnded(){this.incrementPlays(),this.evaluateValidity(),this.evaluateMaxPlays(),this.evaluateLoop()},computeState(){return{}},computeIsValid(){const e=this.minPlays*1;if(e===0)return!0;const t=this.getResponse();return t===null?!1:t>=e},evaluateValidity(){const e=this.getIsValid(),t=this.computeIsValid();e!==t&&this.updateValidity(t)},updateValidity(e){this.setIsValid(e),_.setInteractionIsValidResponse({identifier:this.responseIdentifier,isValidResponse:e})},evaluateMaxPlays(){this.checkMaxPlaysLimit()?this.disable():this.enable()},evaluateLoop(){this.isLoop&&(this.checkMaxPlaysLimit()||this.isDisabled||this.playMedia())},evaluateAutostart(){this.isAutostart&&(this.checkMaxPlaysLimit()||this.isDisabled||(console.log(`[${this.$options.name}][Identifier=${this.responseIdentifier}][AutoStart]`),this.playMedia()))},playMedia(){if(this.node!=null){if(this.mediaType==="audio")return this.node.playAudio();this.node.playVideo()}},checkMaxPlaysLimit(){if(this.maxPlays*1===0)return!1;const e=this.getResponse();return e!==null&&e==this.maxPlays*1},computeMaxPlaysMessage(){if(typeof this.dataMaxPlaysMessage<"u"){this.maxPlaysMessage=this.dataMaxPlaysMessage;return}const e=this.maxPlays*1;this.maxPlaysMessage=e===0?"":`You are permitted a maximum of ${this.maxPlays} play${e>1?"s":""} for this ${this.mediaType}.`},computeMinPlaysMessage(){if(typeof this.dataMinPlaysMessage<"u"){this.minPlaysMessage=this.dataMinPlaysMessage;return}const e=this.minPlays*1;this.minPlaysMessage=e===0?"":`You must play this ${this.mediaType} to the end at least ${this.minPlays} time${e>1?"s":""}.`},validateChildren(){},processChildren(){this.processMedia(),this.setIsValid(this.computeIsValid()),this.priorState!==null&&this.restoreValue(this.priorState.value)},processMedia(){let e=this.$refs.mediagroup.$el.getElementsByTagName("object");if(e.length!==0)throw new c("Unsupported Media Interaction element. The <object> elemnt is deprecated. Use <video> or <audio> instead.");if(e=this.$refs.mediagroup.$el.getElementsByTagName("video"),e.length===0&&(e=this.$refs.mediagroup.$el.getElementsByTagName("audio")),e.length!==1)throw new c("Media Interaction must have exactly one <video> or <audio> node.")},getPriorState(e){const t=_.getItemContextStateVariable(e);if(t===null)return null;if(!("value"in t))throw new O('Media Interaction State Invalid. "value" property not found.');if(!("state"in t))throw new O('Media Interaction State Invalid. "state" property not found.');return t}},created(){try{this.responseDeclaration=hw.validateResponseIdentifierAttribute(_,this.responseIdentifier),this.validateChildren(),this.priorState=this.getPriorState(this.responseIdentifier),hw.validateMaxMinPlays(this.maxPlays,this.minPlays),this.hasPrompts=this.getPrompts(this.$slots).length>0,this.isAutostart=this.autostart==="true",this.isLoop=this.loop==="true",this.computeMaxPlaysMessage()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.movePrompt(),this.processChildren(),_.defineInteraction({identifier:this.responseIdentifier,interactionType:"Media",node:this,resetValue:this.resetValue,disable:this.disable,isValidResponse:this.getIsValid(),invalidResponseMessage:this.getInvalidResponseMessage(),maxSelectionsMessage:this.maxPlaysMessage}),console.log("["+this.$options.name+"][Identifier]",this.responseIdentifier)}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}}},Fk={ref:"root",class:"qti-media-interaction"},Uk={ref:"prompt",class:"qti-prompt-wrapper"};function Gk(e,t,i,s,n,r){const a=l.resolveComponent("MediaGroup");return l.openBlock(),l.createElementBlock("div",Fk,[l.createElementVNode("div",Uk,null,512),l.createVNode(a,{ref:"mediagroup",onMediaMounted:r.handleMediaMounted,onMediaLoaded:r.handleMediaLoaded,onMediaEnded:r.handleMediaEnded},{default:l.withCtx(()=>[l.renderSlot(e.$slots,"default")]),_:3},8,["onMediaMounted","onMediaLoaded","onMediaEnded"])],512)}const jk=B(Hk,[["render",Gk]]),Fh=new G,Wk={name:"QtiOrderInteraction",props:{responseIdentifier:{required:!0,type:String},minChoices:{required:!1,type:String},maxChoices:{required:!1,type:String},shuffle:{required:!1,type:String,default:"false"},orientation:{required:!1,type:String,default:"horizontal"},dataMaxSelectionsMessage:{required:!1,type:String},dataMinSelectionsMessage:{required:!1,type:String},dataChoicesContainerWidth:{required:!1,type:String,default:null}},data(){return{response:null,state:null,isValidResponse:!1,cardinality:"ordered",minSelectionsMessage:"",maxSelectionsMessage:"",responseDeclaration:null,interactionSubType:"default",choices:[],isShuffle:!1,hasPrompts:!1,minChoicesValue:null,maxChoicesValue:null,isMinChoicesSpecified:!1,isMaxChoicesSpecified:!1,isQtiValid:!0,priorState:null,originalOrder:null}},methods:{getResponse(){return this.response},setResponse(e){this.response=e},getState(){return this.state},setState(e){this.state=e},setInteractionSubType(e){this.interactionSubType=e},getInteractionSubType(){return this.interactionSubType},getIsValid(){return this.isValidResponse},setIsValid(e){this.isValidResponse=e},getInvalidResponseMessage(){return this.minSelectionsMessage},disable(){this.$refs.ordergroup.disable()},enable(){this.$refs.ordergroup.enable()},initializeValue(e){this.setResponse(this.computeResponse(e)),this.setState(this.computeState()),this.updateValidity(this.computeIsValid())},initializeOriginalOrder(){if(this.originalOrder!==null)return;let e=[];this.choices.forEach(t=>{e.push(t.identifier)}),this.originalOrder=e},resetValue(){console.log("[ResetValue][identifier]",this.responseIdentifier),this.setResponse(null),this.setState(null),this.priorState=null,this.$refs.ordergroup.resetGroupUI()},restoreValue(e){this.setResponse(e),this.setState(this.computeState()),this.updateValidity(this.computeIsValid())},getCardinality(){let e=_.getResponseDeclaration(this.responseIdentifier);return this.cardinality=typeof e<"u"?e.cardinality:"ordered",this.cardinality},getPrompts(e){let t=[];return e.default&&e.default().forEach(i=>{typeof i.type<"u"&&i.type.name==="QtiPrompt"&&t.push(i)}),t},movePrompt(){this.hasPrompts&&this.$refs.prompt.appendChild(this.$refs.ordergroup.getPromptElement())},handleOrderGroupReady(e){this.choices=e.choices,this.isMinChoicesSpecified||(this.minChoicesValue=this.choices.length),this.originalOrder===null&&this.initializeOriginalOrder(),this.initializeValue(e.response)},handleOrderGroupUpdate(e){this.setResponse(this.computeResponse(e.response)),this.setState({order:e.response,oorder:this.originalOrder}),this.updateValidity(this.computeIsValid())},handleSelectionsLimit(){_.NotifyInteractionSelectionsLimit(this.maxSelectionsMessage)},computeResponse(e){let t=[];typeof e>"u"?this.choices.forEach(s=>{t.push(s.identifier)}):t=e;let i=0;switch(this.interactionSubType){case"default":for(let s=0;s<t.length;s++)t[s]!==this.originalOrder[s]&&(i+=1);break;case"ordermatch":for(let s=0;s<t.length;s++)t[s]!==null&&(i+=1);break}return i===0?null:t},computeOrder(){const e=[];return this.choices.forEach(t=>{e.push(t.identifier)}),e},computeState(){return this.priorState!==null?this.priorState.state:{order:this.computeOrder(),oorder:this.originalOrder}},computeIsValid(){const e=this.getResponse(),t=this.minChoicesValue;if(e===null||e.length!==this.originalOrder.length)return!1;let i=0;switch(this.interactionSubType){case"default":for(let s=0;s<e.length;s++)e[s]!==this.originalOrder[s]&&(i+=1);return this.isMinChoicesSpecified?i>=t:i===t;case"ordermatch":for(let s=0;s<e.length;s++)e[s]!==null&&(i+=1);return this.isMinChoicesSpecified?i>=t:i===e.length}return!1},evaluateValidity(){const e=this.getIsValid(),t=this.computeIsValid();e!==t&&this.updateValidity(t)},updateValidity(e){this.setIsValid(e),_.setInteractionIsValidResponse({identifier:this.responseIdentifier,isValidResponse:e})},computeMaxSelectionsMessage(){if(typeof this.dataMaxSelectionsMessage<"u"){this.maxSelectionsMessage=this.dataMaxSelectionsMessage;return}this.maxSelectionsMessage=this.maxChoicesValue===null?"":"You may set an order for a maximum of "+this.maxChoicesValue+" choice"+(this.maxChoicesValue>1?"s":"")+" for this question."},computeMinSelectionsMessage(){if(typeof this.dataMinSelectionsMessage<"u"){this.minSelectionsMessage=this.dataMinSelectionsMessage;return}this.isMinChoicesSpecified?this.minSelectionsMessage="You must set the order for at least "+this.minChoicesValue+" choice"+(this.minChoicesValue>1?"s":"")+" for this question.":this.minSelectionsMessage="You must set the order for all choices for this question."},detectInteractionSubType(e){return this.getOrderInteractionSubType(e)},getOrderInteractionSubType(e){if(typeof e>"u"||e===null||e.length==0)return"default";const t=e.split(" ");for(let i=0;i<t.length;i++)switch(t[i]){case"qti-choices-top":case"qti-choices-bottom":case"qti-choices-left":case"qti-choices-right":return"ordermatch"}return"default"},getPriorState(e){const t=_.getItemContextStateVariable(e);if(t===null)return null;if(!("value"in t))throw new O('Order Interaction State Invalid. "value" property not found.');if(!("state"in t))throw new O('Order Interaction State Invalid. "state" property not found.');if(!("order"in t.state))throw new O('Order Interaction State Invalid. "order" property not found.');if(!("oorder"in t.state))throw new O('Order Interaction State Invalid. "oorder" property not found.');return this.originalOrder=t.state.oorder,t}},created(){try{if(this.responseDeclaration=Fh.validateResponseIdentifierAttribute(_,this.responseIdentifier),this.setInteractionSubType(this.detectInteractionSubType(this.$.vnode.props.class)),this.priorState=this.getPriorState(this.responseIdentifier),this.cardinality=this.getCardinality(),this.cardinality!=="ordered")throw new c('qti-order-interaction cardinality must be "ordered"');if(this.isShuffle=this.shuffle==="true",this.hasPrompts=this.getPrompts(this.$slots).length>0,typeof this.minChoices<"u"&&(this.isMinChoicesSpecified=!0),this.minChoicesValue=Fh.validateIntegerAttribute("min-choices",this.minChoices,!1,null),this.minChoicesValue===0)throw new c('qti-order-interaction "min-choices", when specified, must not be 0');if(this.isMinChoicesSpecified?(typeof this.maxChoices<"u"&&(this.isMaxChoicesSpecified=!0),this.maxChoicesValue=Fh.validateIntegerAttribute("max-choices",this.maxChoices,!1,null)):this.maxChoicesValue=null,this.isMinChoicesSpecified&&this.isMaxChoicesSpecified&&this.minChoicesValue>this.maxChoicesValue)throw new c('qti-order-interaction "min-choices" must not be greater than "max-choices"');this.computeMinSelectionsMessage(),this.computeMaxSelectionsMessage()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.movePrompt(),_.defineInteraction({identifier:this.responseIdentifier,interactionType:"Order",node:this,resetValue:this.resetValue,isValidResponse:this.getIsValid(),invalidResponseMessage:this.getInvalidResponseMessage(),maxSelectionsMessage:this.maxSelectionsMessage}),console.log("["+this.$options.name+"][Identifier]",this.responseIdentifier)}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}}},zk={ref:"root",class:"qti-order-interaction"},Kk={ref:"prompt",class:"qti-prompt-wrapper"};function Yk(e,t,i,s,n,r){const a=l.resolveComponent("OrderGroup");return l.openBlock(),l.createElementBlock("div",zk,[l.createElementVNode("div",Kk,null,512),l.createVNode(a,l.mergeProps({ref:"ordergroup",cardinality:n.cardinality,shuffle:i.shuffle,responseIdentifier:i.responseIdentifier,orientation:i.orientation,maxChoices:n.maxChoicesValue,minChoices:n.minChoicesValue,interactionSubType:n.interactionSubType,dataChoicesContainerWidth:i.dataChoicesContainerWidth,priorState:n.priorState,onOrderGroupReady:r.handleOrderGroupReady,onOrderGroupUpdate:r.handleOrderGroupUpdate,onOrderGroupSelectionsLimit:r.handleSelectionsLimit},e.$attrs),{default:l.withCtx(()=>[l.renderSlot(e.$slots,"default")]),_:3},16,["cardinality","shuffle","responseIdentifier","orientation","maxChoices","minChoices","interactionSubType","dataChoicesContainerWidth","priorState","onOrderGroupReady","onOrderGroupUpdate","onOrderGroupSelectionsLimit"])],512)}const Xk=B(Wk,[["render",Yk]]);class Zk{constructor(){this.nodes=[]}find(t,i){if(Array.isArray(t))return t.forEach(s=>{var n;if(s.component!==null&&((n=s.component.type)==null?void 0:n.name)===i){this.nodes.push(s.component.proxy);return}Array.isArray(s==null?void 0:s.children)&&this.find(s.children,i)}),this.nodes}findNodes(t,{within:i}){return this.find(i,t)}}class Jk{constructor(t){return this.constants={QTI_UNSELECTED_HIDDEN:"qti-unselected-hidden"},this.classList=t,this.presentation_UnselectedHidden=!1,this.processClassAttribute(),this}processClassAttribute(){if(typeof this.classList>"u"||this.classList===null||this.classList.length==0)return;const t=this.classList.split(" ");for(let i=0;i<t.length;i++)switch(t[i]){case this.constants.QTI_UNSELECTED_HIDDEN:this.presentation_UnselectedHidden=!0;break}}getUnselectedHidden(){return this.presentation_UnselectedHidden}}const dw=new G,e2=new Zk,t2={name:"QtiHottextInteraction",props:{responseIdentifier:{required:!0,type:String},minChoices:{required:!1,type:String,default:"0"},maxChoices:{required:!1,type:String,default:"1"},dataMaxSelectionsMessage:{required:!1,type:String},dataMinSelectionsMessage:{required:!1,type:String}},inheritAttrs:!0,data(){return{response:null,state:null,isValidResponse:!1,cardinality:"single",minSelectionsMessage:"",maxSelectionsMessage:"",responseDeclaration:null,choices:[],currentChoice:null,isRadio:!0,isDisabled:!1,isQtiValid:!0,hasPrompts:!1,presentationFactory:null,priorState:null}},methods:{getResponse(){return this.response},setResponse(e){this.response=e},getState(){return this.state},setState(e){this.state=e},getIsValid(){return this.isValidResponse},setIsValid(e){this.isValidResponse=e},disable(){this.toggleDisableChoices(!0)},enable(){this.toggleDisableChoices(!1)},toggleDisableChoices(e){this.isDisabled=e,this.choices.forEach(t=>{t.setIsDisabled(e)})},getInvalidResponseMessage(){return this.minSelectionsMessage},resetValue(){console.log("[ResetValue][identifier]",this.responseIdentifier),this.choices.forEach(e=>{e.setChecked(!1)}),this.currentChoice=null,this.priorState=null},restoreValue(e){e!==null&&(this.isRadio?this.handleSetChecked(new CustomEvent("setChecked",{bubbles:!1,detail:{identifier:e,checked:"true"}}),!0):e.forEach(t=>{this.handleSetChecked(new CustomEvent("setChecked",{bubbles:!1,detail:{identifier:t,checked:"true"}}),!0)},this),this.setResponse(this.computeResponse()),this.setState(this.computeState()),this.updateValidity(this.computeIsValid()))},getCardinality(){let e=_.getResponseDeclaration(this.responseIdentifier);return this.cardinality=typeof e<"u"?e.cardinality!=="multiple"?"single":"multiple":"single",this.cardinality},getPrompts(e){let t=[];return e.default&&e.default().forEach(i=>{typeof i.type<"u"&&i.type.name==="QtiPrompt"&&t.push(i)}),t},movePrompt(){if(!this.hasPrompts)return;const e=this.$refs.root.querySelector(".qti-prompt");e!==null&&this.$refs.prompt.appendChild(e)},handleSetChecked(e,t=!1){const i=e.detail;this.choices.forEach(s=>{this.isRadio&&s.setChecked(!1),s.identifier===i.identifier&&(this.currentChoice=s)}),i.checked==="true"?this.checkMaxChoicesLimit()?this.currentChoice.setChecked(!1):this.currentChoice.setChecked(!0):this.currentChoice.setChecked(!1),t||(this.setResponse(this.computeResponse()),this.currentChoice.setFocus(),this.evaluateValidity())},computeResponse(){let e=this.isRadio?null:[];return this.choices.forEach(t=>{t.isChecked()&&(this.isRadio?e=t.identifier:e.push(t.identifier))}),this.isRadio?e:e.length===0?null:e},computeState(){return{}},computeIsValid(){return this.minChoices*1===0?!0:this.response===null?!1:this.cardinality==="single"||this.cardinality==="multiple"&&this.response.length>=this.minChoices*1},evaluateValidity(){const e=this.getIsValid(),t=this.computeIsValid();e!==t&&this.updateValidity(t)},updateValidity(e){this.setIsValid(e),_.setInteractionIsValidResponse({identifier:this.responseIdentifier,isValidResponse:e})},checkMaxChoicesLimit(){if(this.isRadio||this.maxChoices==0)return!1;const e=this.getResponse();return e!==null&&e.length==this.maxChoices?(_.NotifyInteractionSelectionsLimit(this.maxSelectionsMessage),!0):!1},computeMaxSelectionsMessage(){if(typeof this.dataMaxSelectionsMessage<"u"){this.maxSelectionsMessage=this.dataMaxSelectionsMessage;return}this.maxSelectionsMessage=this.maxChoices==0?"":"You are permitted a maximum of "+this.maxChoices+" selection"+(this.maxChoices>1?"s":"")+" for this question.<br/><br/>Please unselect one of your selections before making another selection."},computeMinSelectionsMessage(){if(typeof this.dataMinSelectionsMessage<"u"){this.minSelectionsMessage=this.dataMinSelectionsMessage;return}this.minSelectionsMessage=this.minChoices==0?"":"You must make at least "+this.minChoices+" selection"+(this.minChoices>1?"s":"")+" for this question."},validateChildren(){},processChildren(){const e=this.$.subTree===null?null:this.$.subTree.children[1].children;this.choices=e2.findNodes("QtiHottext",{within:e}),this.processGroupUI(),this.priorState!==null&&this.restoreValue(this.priorState.value)},processGroupUI(){this.setUnselectedHidden(),this.setResponse(null),this.setState(this.computeState()),this.setIsValid(this.computeIsValid())},setUnselectedHidden(){this.presentationFactory.getUnselectedHidden()&&this.$refs.hottextgroup.setAttribute("class","qti3-player-hottext-group qti-unselected-hidden")},getPriorState(e){const t=_.getItemContextStateVariable(e);if(t===null)return null;if(!("value"in t))throw new O('Hottext Interaction State Invalid. "value" property not found.');if(!("state"in t))throw new O('Hottext Interaction State Invalid. "state" property not found.');return t}},created(){try{this.responseDeclaration=dw.validateResponseIdentifierAttribute(_,this.responseIdentifier),this.presentationFactory=new Jk(this.$.vnode.props.class),this.validateChildren(),this.priorState=this.getPriorState(this.responseIdentifier),dw.validateMaxMinChoices(this.maxChoices,this.minChoices),this.isRadio=this.getCardinality()!=="multiple",this.hasPrompts=this.getPrompts(this.$slots).length>0,this.computeMinSelectionsMessage(),this.computeMaxSelectionsMessage()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.movePrompt(),this.processChildren(),_.defineInteraction({identifier:this.responseIdentifier,interactionType:"Hottext",node:this,resetValue:this.resetValue,disable:this.disable,isValidResponse:this.getIsValid(),invalidResponseMessage:this.getInvalidResponseMessage(),maxSelectionsMessage:this.maxSelectionsMessage}),console.log("["+this.$options.name+"][Identifier]",this.responseIdentifier)}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}}},i2={ref:"root",class:"qti-hottext-interaction"},s2={ref:"prompt",class:"qti-prompt-wrapper"};function n2(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",i2,[l.createElementVNode("div",s2,null,512),l.createElementVNode("div",{ref:"hottextgroup","on:setChecked":t[0]||(t[0]=(...a)=>r.handleSetChecked&&r.handleSetChecked(...a)),class:"qti3-player-hottext-group"},[l.renderSlot(e.$slots,"default")],544)],512)}const r2=B(t2,[["render",n2]]);class a2{constructor(t){return this.constants={QTI_SELECTIONS_LIGHT:"qti-selections-light",QTI_SELECTIONS_DARK:"qti-selections-dark",QTI_UNSELECTED_HIDDEN:"qti-unselected-hidden",THEME_LIGHT:{selectedOpacity:"1.0",unselectedOpacity:"0.5",fillColor:"orange",fillOpacity:"0",strokeColor:"orange",strokeWidth:2,selectedStrokeWidth:4},THEME_DARK:{selectedOpacity:"1.0",unselectedOpacity:"0.5",fillColor:"#0088CC",fillOpacity:"0",strokeColor:"blue",strokeWidth:2,selectedStrokeWidth:4},THEME_HIDDEN_LIGHT:{selectedOpacity:"1.0",unselectedOpacity:"0",fillColor:"orange",fillOpacity:"0",strokeColor:"orange",strokeWidth:2,selectedStrokeWidth:4},THEME_HIDDEN_DARK:{selectedOpacity:"1.0",unselectedOpacity:"0",fillColor:"blue",fillOpacity:"0",strokeColor:"blue",strokeWidth:2,selectedStrokeWidth:4}},this.classList=t,this.presentation_Theme=this.constants.QTI_SELECTIONS_DARK,this.theme=this.constants.THEME_DARK,this.presentation_UnselectedHidden=!1,this.processClassAttribute(),this}processClassAttribute(){if(typeof this.classList>"u"||this.classList===null||this.classList.length==0)return;const t=this.classList.split(" ");for(let i=0;i<t.length;i++)switch(t[i]){case this.constants.QTI_SELECTIONS_DARK:this.presentation_Theme=this.constants.QTI_SELECTIONS_DARK;break;case this.constants.QTI_SELECTIONS_LIGHT:this.presentation_Theme=this.constants.QTI_SELECTIONS_LIGHT;break;case this.constants.QTI_UNSELECTED_HIDDEN:this.presentation_UnselectedHidden=!0;break}switch(this.presentation_Theme){case this.constants.QTI_SELECTIONS_DARK:this.presentation_UnselectedHidden&&(this.theme=this.constants.THEME_HIDDEN_DARK);break;case this.constants.QTI_SELECTIONS_LIGHT:this.presentation_UnselectedHidden?this.theme=this.constants.THEME_HIDDEN_LIGHT:this.theme=this.constants.THEME_LIGHT;break}}getThemeColors(){return this.theme}}const fw=new G,o2={name:"QtiHotspotInteraction",props:{responseIdentifier:{required:!0,type:String},minChoices:{required:!1,type:String,default:"0"},maxChoices:{required:!1,type:String,default:"1"},dataMaxSelectionsMessage:{required:!1,type:String},dataMinSelectionsMessage:{required:!1,type:String}},data(){return{response:null,state:null,isValidResponse:!1,cardinality:"single",minSelectionsMessage:"",maxSelectionsMessage:"",responseDeclaration:null,choices:[],currentChoice:null,shapeElements:[],currentElement:null,backgroundImage:null,backgroundImageWidth:"0",backgroundImageHeight:"0",isRadio:!0,isDisabled:!1,isQtiValid:!0,hasPrompts:!1,presentationFactory:null,shapeColorProperties:null,priorState:null}},methods:{getResponse(){return this.response},setResponse(e){this.response=e},getState(){return this.state},setState(e){this.state=e},getIsValid(){return this.isValidResponse},setIsValid(e){this.isValidResponse=e},disable(){this.toggleDisableChoices(!0)},enable(){this.toggleDisableChoices(!1)},toggleDisableChoices(e){this.isDisabled=e},getInvalidResponseMessage(){return this.minSelectionsMessage},resetValue(){console.log("[ResetValue][identifier]",this.responseIdentifier);for(let e=0;e<this.choices.length;e++)this.setChoiceUnChecked(this.choices[e],this.shapeElements[e]);this.currentChoice=null,this.currentElement=null,this.priorState=null,this.setResponse(null),this.setState(this.computeState()),this.updateValidity(this.computeIsValid())},restoreValue(e){e!==null&&(this.isRadio?this.handleSetChecked(new CustomEvent("setChecked",{bubbles:!1,detail:{identifier:e,checked:"true"}}),!0):e.forEach(t=>{this.handleSetChecked(new CustomEvent("setChecked",{bubbles:!1,detail:{identifier:t,checked:"true"}}),!0)},this),this.setResponse(this.computeResponse()),this.setState(this.computeState()),this.updateValidity(this.computeIsValid()))},getCardinality(){let e=_.getResponseDeclaration(this.responseIdentifier);return this.cardinality=typeof e<"u"?e.cardinality!=="multiple"?"single":"multiple":"single",this.cardinality},getPrompts(e){let t=[];return e.default&&e.default().forEach(i=>{typeof i.type<"u"&&i.type.name==="QtiPrompt"&&t.push(i)}),t},movePrompt(){if(!this.hasPrompts)return;const e=this.$refs.root.querySelector(".qti-prompt");e!==null&&this.$refs.prompt.appendChild(e)},handleSetChecked(e,t=!1){const i=e.detail;for(let s=0;s<this.choices.length;s++)this.isRadio&&this.setChoiceUnChecked(this.choices[s],this.shapeElements[s]),this.choices[s].identifier===i.identifier&&(this.currentChoice=this.choices[s],this.currentElement=this.shapeElements[s]);i.checked==="true"?this.checkMaxChoicesLimit()?this.setChoiceUnChecked(this.currentChoice,this.currentElement):this.setChoiceChecked(this.currentChoice,this.currentElement):this.setChoiceUnChecked(this.currentChoice,this.currentElement),t||(this.setResponse(this.computeResponse()),this.currentElement.focus(),this.evaluateValidity())},computeResponse(){let e=this.isRadio?null:[];return this.choices.forEach(t=>{t.isChecked()&&(this.isRadio?e=t.identifier:e.push(t.identifier))}),this.isRadio?e:e.length===0?null:e},computeState(){return{}},computeIsValid(){return this.minChoices*1===0?!0:this.response===null?!1:this.cardinality==="single"||this.cardinality==="multiple"&&this.response.length>=this.minChoices*1},evaluateValidity(){const e=this.getIsValid(),t=this.computeIsValid();e!==t&&this.updateValidity(t)},updateValidity(e){this.setIsValid(e),_.setInteractionIsValidResponse({identifier:this.responseIdentifier,isValidResponse:e})},checkMaxChoicesLimit(){if(this.isRadio||this.maxChoices==0)return!1;const e=this.getResponse();return e!==null&&e.length==this.maxChoices?(_.NotifyInteractionSelectionsLimit(this.maxSelectionsMessage),!0):!1},computeMaxSelectionsMessage(){if(typeof this.dataMaxSelectionsMessage<"u"){this.maxSelectionsMessage=this.dataMaxSelectionsMessage;return}this.maxSelectionsMessage=this.maxChoices==0?"":"You are permitted a maximum of "+this.maxChoices+" selection"+(this.maxChoices>1?"s":"")+" for this question.<br/><br/>Please unselect one of your selections before making another selection."},computeMinSelectionsMessage(){if(typeof this.dataMinSelectionsMessage<"u"){this.minSelectionsMessage=this.dataMinSelectionsMessage;return}this.minSelectionsMessage=this.minChoices==0?"":"You must make at least "+this.minChoices+" selection"+(this.minChoices>1?"s":"")+" for this question."},validateChildren(){},processChildren(){this.processBackgroundImage(),this.$.subTree.children[1].children[0].dynamicChildren.forEach(t=>{if(t.component!==null&&t.type.name==="QtiHotspotChoice"){const i=t.component.proxy;this.choices.push(i);const s=i.getShapeElement();s!==null&&(this.addHotspotListeners(s),this.shapeElements.push(s),this.$refs.overlay.appendChild(s))}}),this.processGroupUI(),this.priorState!==null&&this.restoreValue(this.priorState.value)},addHotspotListeners(e){e.addEventListener("click",this.handleHotspotClick),e.addEventListener("keydown",this.handleHotspotKeydown)},removeHotspotListeners(e){e.removeEventListener("click",this.handleHotspotClick),e.removeEventListener("keydown",this.handleHotspotKeydown)},handleHotspotClick(e){if(e.preventDefault(),this.isDisabled)return;const t=e.target.getAttribute("data-identifier"),i=this.findChoiceByIdentifier(t);this.isRadio?this.triggerChecked(e.target.getAttribute("data-identifier"),"true"):(this.toggleChecked(i,e.target),this.triggerChecked(t,i.getChecked()))},handleHotspotKeydown(e){const t=e.target.getAttribute("data-identifier"),i=this.findChoiceByIdentifier(t);switch(e.code){case"Space":case"Enter":if(e.stopPropagation(),e.preventDefault(),this.isDisabled||i==null)return;this.toggleChecked(i,e.target),this.triggerChecked(t,i.getChecked());break}},findChoiceByIdentifier(e){for(let t=0;t<this.choices.length;t++)if(this.choices[t].identifier===e)return this.choices[t];return null},toggleChecked(e,t){if(e.toggleChecked(),t===null)return;const i=t.getAttribute("aria-checked");t.setAttribute("aria-checked",i==="true"?"false":"true")},triggerChecked(e,t){const i=new CustomEvent("setChecked",{bubbles:!0,cancelable:!0,detail:{identifier:e,checked:t}});this.$refs.hotspotgroup.dispatchEvent(i)},setChoiceUnChecked(e,t){e.setChecked(!1),t.setAttribute("aria-checked","false");const i=e.getShapeColorProperties();t.setAttribute("fill",`${i.fillColor}`),t.setAttribute("fill-opacity",`${i.fillOpacity}`),t.setAttribute("opacity",`${i.unselectedOpacity}`),t.setAttribute("stroke",`${i.strokeColor}`),t.setAttribute("stroke-width",`${i.strokeWidth}`)},setChoiceChecked(e,t){e.setChecked(!0),t.setAttribute("aria-checked","true");const i=e.getShapeColorProperties();t.setAttribute("fill",`${i.fillColor}`),t.setAttribute("fill-opacity",`${i.fillOpacity}`),t.setAttribute("opacity",`${i.selectedOpacity}`),t.setAttribute("stroke",`${i.strokeColor}`),t.setAttribute("stroke-width",`${i.selectedStrokeWidth}`)},processGroupUI(){this.setResponse(null),this.setState(this.computeState()),this.setIsValid(this.computeIsValid())},processBackgroundImage(){let e=this.$refs.hotspotgroup.getElementsByTagName("object");if(e.length===0&&(e=this.$refs.hotspotgroup.getElementsByTagName("img")),e.length===0&&(e=this.$refs.hotspotgroup.getElementsByTagName("picture")),e.length!==1)throw new c("Hotspot interaction must have exactly one <img>, <object>, or <picture> node");this.backgroundImage=e[0],this.backgroundImage.setAttribute("draggable","false"),this.backgroundImageWidth=`${e[0].clientWidth}`,this.backgroundImageHeight=`${e[0].clientHeight}`,this.$refs.overlay.setAttribute("viewBox",`0 0 ${this.backgroundImageWidth} ${this.backgroundImageHeight}`),this.$refs.overlay.setAttribute("tabindex","-1"),this.$refs.overlay.setAttribute("role","application"),this.$refs.overlay.setAttribute("focusable","false"),this.$refs.hotspotgroup.setAttribute("style",`width:${e[0].clientWidth};height:${e[0].clientHeight}`)},getShapeColorProperties(){return this.shapeColorProperties},setShapeColorProperties(e){this.shapeColorProperties=e},getPriorState(e){const t=_.getItemContextStateVariable(e);if(t===null)return null;if(!("value"in t))throw new O('Hotspot Interaction State Invalid. "value" property not found.');if(!("state"in t))throw new O('Hotspot Interaction State Invalid. "state" property not found.');return t}},created(){try{this.responseDeclaration=fw.validateResponseIdentifierAttribute(_,this.responseIdentifier),this.presentationFactory=new a2(this.$.vnode.props.class),this.setShapeColorProperties(this.presentationFactory.getThemeColors()),this.validateChildren(),this.priorState=this.getPriorState(this.responseIdentifier),fw.validateMaxMinChoices(this.maxChoices,this.minChoices),this.isRadio=this.getCardinality()!=="multiple",this.hasPrompts=this.getPrompts(this.$slots).length>0,this.computeMinSelectionsMessage(),this.computeMaxSelectionsMessage()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.movePrompt(),this.processChildren(),_.defineInteraction({identifier:this.responseIdentifier,interactionType:"Hotspot",node:this,resetValue:this.resetValue,disable:this.disable,isValidResponse:this.getIsValid(),invalidResponseMessage:this.getInvalidResponseMessage(),maxSelectionsMessage:this.maxSelectionsMessage}),console.log("["+this.$options.name+"][Identifier]",this.responseIdentifier)}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}},beforeUnmount(){this.shapeElements.forEach(e=>{this.removeHotspotListeners(e)})}},l2={ref:"root",class:"qti-hotspot-interaction"},c2={ref:"prompt",class:"qti-prompt-wrapper"},u2={ref:"overlay",class:"qti3-player-hotspot-overlay"};function h2(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",l2,[l.createElementVNode("div",c2,null,512),l.createElementVNode("div",{ref:"hotspotgroup","on:setChecked":t[0]||(t[0]=(...a)=>r.handleSetChecked&&r.handleSetChecked(...a)),class:"qti3-player-hotspot-group"},[l.renderSlot(e.$slots,"default"),(l.openBlock(),l.createElementBlock("svg",u2,null,512))],544)],512)}const d2=B(o2,[["render",h2]]);class f2{constructor(t,i,s){J(this,"moduleAttribute","");J(this,"modulesNode",null);J(this,"itemPathUri","");J(this,"modules",null);J(this,"constants",{BASE_CONFIG:{waitSeconds:60,paths:{}}});return this.moduleAttribute=t,this.modulesNode=i,this.itemPathUri=s,this}async getConfiguration(t){this.setModules(this.getInteractionModules());let i=null;this.moduleAttribute.length>0&&this.modulesNode===null?i=await this.getConfigurationFromUrl(this.getModules()):i=await this.resolveModules(this.getModules()),t&&t(i)}async resolveModules(t){let i=null;if(t===null)return i;let s=this.constants.BASE_CONFIG;return s=await this.initBaseConfiguration(s,t),i=await this.resolvePrimaryConfigurationModules(s,t),i!==null||(i=await this.resolveSecondaryConfigurationModules(s,t)),i}async initBaseConfiguration(t,i){const s=`${this.getItemPathUri()}modules/module_resolution.js`;if(typeof i.primaryconfiguration>"u"&&typeof i.secondaryConfiguration>"u"){const n=await this.fetchDefaultModuleResolution(s,!1);if(n!==null)return n}return t}async resolvePrimaryConfigurationModules(t,i){let s=[];if(typeof i.primaryconfiguration>"u"){for(let o=0;o<i.module.length;o++){if(typeof i.module[o].primarypath>"u")return null;s.push(this.addPathJs(i.module[o].primarypath)),t.paths[i.module[o].id]=this.stripPathJs(i.module[o].primarypath)}return await this.resolveConfigurationModules(s)?t:null}const n=await this.fetchConfiguration(i.primaryconfiguration,!0,!0);if(n===null)return null;for(const a in n.paths)n.paths[a]=this.stripPathJs(n.paths[a]);for(let a=0;a<i.module.length;a++)typeof i.module[a].primarypath<"u"&&(n.paths[i.module[a].id]=this.stripPathJs(this.addPathJs(i.module[a].primarypath)));return await this.resolveConfigurationPathUrls(n.paths)?n:null}async resolveSecondaryConfigurationModules(t,i){let s=[];if(typeof i.secondaryconfiguration>"u"){for(let o=0;o<i.module.length;o++){if(typeof i.module[o].fallbackpath>"u")return null;s.push(this.addPathJs(i.module[o].fallbackpath)),t.paths[i.module[o].id]=this.stripPathJs(i.module[o].fallbackpath)}return await this.resolveConfigurationModules(s)?t:null}const n=await this.fetchConfiguration(i.secondaryconfiguration,!1,!0);if(n===null)return null;for(const a in n.paths)n.paths[a]=this.stripPathJs(n.paths[a]);for(let a=0;a<i.module.length;a++)typeof i.module[a].fallbackpath<"u"&&(n.paths[i.module[a].id]=this.stripPathJs(this.addPathJs(i.module[a].fallbackpath)));return await this.resolveConfigurationPathUrls(n.paths)?n:null}async resolveConfigurationPathUrls(t){let i=[];for(let n=0;n<t.length;n++)i.push(t[n]);return await this.resolveConfigurationModules(i)}async resolveConfigurationModules(t){return await Promise.all(t.map(s=>fetch(s).then(n=>{if(n.ok)return console.log("[PCI Parent] Module Loader Success:",s),n;throw new Error(s)}))).catch(s=>(console.log("[PCI Parent] Module Loader Failure:",s.message),null))!==null}async getConfigurationFromUrl(t){let i=null;return t===null||(typeof t.primaryconfiguration<"u"&&(i=await this.fetchConfiguration(t.primaryconfiguration,!0,!1)),i!==null)||typeof t.secondaryconfiguration<"u"&&(i=await this.fetchConfiguration(t.secondaryconfiguration,!1,!1)),i}async fetchConfiguration(t,i,s){try{const n=await fetch(t);if(!n.ok)throw new Error(`HTTP error: ${n.status}`);const r=await n.json();let a=r.paths;for(let o in a)a[o]!==null&&!a[o].startsWith("http")&&(s?a[o]=`${this.getConfigurationRelativePath(t)}${a[o]}`:a[o]=`${this.getItemPathUri()}${a[o]}`);return r}catch(n){return console.log((i?"Primary":"Fallback")+"configuration Fetch error:",n),null}}async fetchDefaultModuleResolution(t,i){try{const s=await fetch(t);if(!s.ok)throw new Error(`HTTP error: ${s.status}`);const n=await s.json();let r=n.paths;for(let a in r)r[a]!==null&&!r[a].startsWith("http")&&(i?r[a]=`${this.getConfigurationRelativePath(t)}${r[a]}`:r[a]=`${this.getItemPathUri()}${r[a]}`);return n}catch(s){return console.log("module_resolution.js Fetch error:",s),null}}getItemPathUri(){return this.itemPathUri}getModules(){return this.modules}setModules(t){this.modules=t}getInteractionModules(){let t={};if(this.modulesNode===null)return t={primaryconfiguration:"modules/module_resolution.js",secondaryconfiguration:"modules/fallback_module_resolution.js"},this.addPackagePath(t);const i=this.modulesNode.getPrimaryConfiguration();i.length>0&&(t.primaryconfiguration=i);const s=this.modulesNode.getSecondaryConfiguration();s.length>0&&(t.secondaryconfiguration=s),t.module=[];let n=this.modulesNode.getModules();for(let r=0;r<n.length;r++){let a={id:n[r].getId()};n[r].getPrimaryPath().length>0&&(a.primarypath=n[r].getPrimaryPath()),n[r].getFallbackPath().length>0&&(a.fallbackpath=n[r].getFallbackPath()),t.module.push(a)}return this.addPackagePath(t)}addPackagePath(t){for(let s in{primaryconfiguration:"",secondaryconfiguration:""})s in t&&t[s]!==null&&!t[s].startsWith("http")&&(t[s]=this.getAbsolutePath(this.getItemPathUri(),t[s]));let i=t.module;if(i!=null)for(let s=0;s<i.length;s++){let n=i[s];for(let r in{primarypath:"",fallbackpath:""})r in n&&n[r]!==null&&!n[r].startsWith("http")&&(n[r]=this.getAbsolutePath(this.getItemPathUri(),n[r]))}return t}getAbsolutePath(t,i){let s=t.split("/"),n=i.split("/");s.pop();for(var r=0;r<n.length;r++)n[r]!="."&&(n[r]==".."?s.pop():s.push(n[r]));return s.join("/")}getConfigurationRelativePath(t){if(t===null||t.length===0)return"";const i=t.lastIndexOf("/");return i<0?"":t.substring(0,i+1)}stripPathJs(t){return t===null?null:t.endsWith(".js")?t.slice(0,t.lastIndexOf(".")):t}addPathJs(t){return t===null?null:t.length>0&&!t.endsWith(".js")?`${t}.js`:t}}const Uh=new G,pw=new ie,p2={name:"QtiPortableCustomInteraction",props:{responseIdentifier:{required:!0,type:String},customInteractionTypeIdentifier:{required:!0,type:String},module:{required:!1,type:String,default:""},dataItemPathUri:{required:!1,type:String,default:""}},inheritAttrs:!0,data(){return{response:null,state:null,baseType:null,cardinality:null,isValidResponse:!0,isQtiValid:!0,hasPrompts:!1,pciModuleResolver:null,loadIframeHandler:null,renderer:"",classAttribute:"",properties:{},modulesNode:null,modules:null,configuration:null,templateVariables:[],contextVariables:[],uniqueId:null,pciIframe:null,isReady:!1,initialWidth:0,priorState:null}},methods:{getResponse(){return this.response},setResponse(e){this.response=e},getState(){return this.state},setState(e){this.state=e},getStateRequest(){this.pciIframe.contentWindow.postMessage({message:"PciGetState_Request"},"*")},getIsValid(){return this.isValidResponse},setIsValid(e){this.isValidResponse=e},getInvalidResponseMessage(){return""},resetValue(){console.log("[ResetValue][identifier]",this.responseIdentifier),this.priorState=null},restoreValue(e,t){this.setResponse(e),this.setState(t)},getCardinality(){let e=_.getResponseDeclaration(this.responseIdentifier);return this.cardinality=e.cardinality,this.cardinality},getBaseType(){let e=_.getResponseDeclaration(this.responseIdentifier);return this.baseType=e.baseType,this.baseType},getPrompts(e){let t=[];return e.default().forEach(i=>{typeof i.type<"u"&&i.type.name==="QtiPrompt"&&t.push(i)}),t},movePrompt(){if(!this.hasPrompts)return;const e=this.$refs.root.querySelector(".qti-prompt");e!==null&&this.$refs.prompt.appendChild(e)},computeState(){return{}},computeIsValid(){return!0},evaluateValidity(){const e=this.getIsValid(),t=this.computeIsValid();e!==t&&this.updateValidity(t)},updateValidity(e){this.setIsValid(e),_.setInteractionIsValidResponse({identifier:this.responseIdentifier,isValidResponse:e})},validateChildren(){if(!this.$slots.default)return;let e=!1,t=!1,i=!1,s=!1,n=!1;this.$slots.default().forEach(r=>{if(Uh.isValidSlot(r)){if(r.type.name==="QtiPrompt"){if(t||i||s||n)throw new c("Invalid element order. qti-prompt must be the first element");if(!e)return e=!0;throw new c("Maximum of 1 qti-prompt element permitted")}if(r.type.name==="QtiInteractionModules"){if(t||s||n)throw new c("Invalid element order: qti-interaction-modules");if(!i)return i=!0;throw new c("Maximum of 1 qti-interaction-modules element permitted")}if(r.type.name==="QtiInteractionMarkup"){if(s||n)throw new c("Invalid element order: qti-interaction-markup");if(!t)return t=!0;throw new c("Maximum of 1 qti-interaction-markup element permitted")}if(r.type.name==="QtiTemplateVariable"){if(s)throw new c("Invalid element order: qti-template-variable");if(!n)return n=!0;throw new c("Maximum of 1 qti-interaction-markup element permitted")}if(r.type.name==="QtiContextVariable")return s=!0;if(r.type.name==="QtiStylesheet")return!0;throw new c('Node is not permitted inside QtiPortableCustomInteraction: "'+r.type.name+'"')}})},processChildren(){const e=this.$.subTree.children[1].children[0].children;e!==null&&(e.forEach(t=>{if(t.component===null)return;const i=t.component.proxy;switch(t.type.name){case"QtiInteractionMarkup":this.markup=i.getMarkup();break;case"QtiInteractionModules":this.modulesNode=i;break;case"QtiTemplateVariable":this.templateVariables.push(i);break;case"QtiContextVariable":this.contextVariables.push(i);break}}),this.priorState!==null&&this.restoreValue(this.priorState.value,this.priorState.state),this.initialWidth=this.$refs.root.clientWidth)},disable(){},enable(){},getPriorState(e){const t=_.getItemContextStateVariable(e);if(t===null)return null;if(!("value"in t))throw new O('PCI State Invalid. "value" property not found.');if(!("state"in t))throw new O('PCI State Invalid. "state" property not found.');return t},createId(){return"pci_"+Uh.randomString(5,"a")},initialize(){this.setProperties(this.getPciProperties()),this.pciModuleResolver=new f2(this.module,this.modulesNode,this.dataItemPathUri),this.pciModuleResolver.getConfiguration((function(e){this.setConfiguration(e),console.log("[PCI Parent] PCI Configuration:",e),e!==null&&this.loadPciIframe(this.initialWidth)}).bind(this))},loadPciIframe(e){const t=document.createElement("iframe");t.name=this.uniqueId,t.id=this.uniqueId,t.setAttribute("scrolling","no"),t.style.border="none",t.style.width=`${e}px`,t.addEventListener("load",this.loadIframeHandler),t.src=`${this.renderer}?identifier=${this.responseIdentifier}&uniqueId=${this.uniqueId}`,this.$refs.ic.appendChild(t)},handleLoadIframe(e){this.pciIframe=e.target},getItemPathUri(){return this.dataItemPathUri},getPciProperties(){let e=this.$refs.root;const t={};for(let i in e.dataset)i!=="uniqueId"&&(t[i]=e.dataset[i]);return t},getProperties(){return this.properties},setProperties(e){this.properties=e},getContextVariables(){let e={};for(let t=0;t<this.contextVariables.length;t++)e[this.contextVariables[t].getIdentifier()]=this.contextVariables[t].evaluate();return e},getTemplateVariables(){let e={};for(let t=0;t<this.templateVariables.length;t++)e[this.templateVariables[t].getIdentifier()]=this.templateVariables[t].evaluate();return e},getModules(){return this.modules},setModules(e){this.modules=e},getConfiguration(){return this.configuration},setConfiguration(e){this.configuration=e},getClassAttribute(){return this.classAttribute},setClassAttribute(e){this.classAttribute=e},copyAttributes(e,t,i){return e.forEach(function(s){let n=s.replace("-","");t[n]=i.getAttribute(s)}),t},getResponseVariable(){let e=pw.valueToPciJson(this.getResponse(),this.baseType,this.cardinality),t={};return t[this.responseIdentifier]=e,t},pciInitialize(){let e={typeIdentifier:this.customInteractionTypeIdentifier,classAttribute:this.getClassAttribute(),markup:this.markup,properties:this.getProperties(),boundTo:this.getResponseVariable(),templateVariables:this.getTemplateVariables(),contextVariables:this.getContextVariables(),module:this.module,modules:this.getModules(),moduleResolution:this.getConfiguration(),status:_.getItemLifecycleStatus()},t={message:"PciLoadInteraction",pci:JSON.stringify(e)};this.priorState!==null&&(t.state=JSON.stringify({response:pw.valueToPciJson(this.getResponse(),this.baseType,this.cardinality),state:this.getState()})),this.pciIframe.contentWindow.postMessage(t,"*")},pciResizeIframe(e,t){this.pciIframe!==null&&(this.pciIframe.style.height=`${e}px`,this.pciIframe.style.width=`${t}px`)},pciResizeIframeWidthToContainer(){this.pciIframe!==null&&(this.pciIframe.style.width=`${this.$refs.ic.clientWidth}px`)},pciSaveState(e){const t=JSON.parse(e);typeof t.response<"u"?this.setResponse(t.response):this.setResponse(null),typeof t.state<"u"?this.setState(t.state):this.setState(null),this.notifyInteractionStateReady()},pciSetReady(){this.isReady=!0},pciIsReady(){return this.pciIframe!==null&&this.isReady},notifyInteractionStateReady(){_.NotifyInteractionStateReady({identifier:this.responseIdentifier})}},created(){try{this.responseDeclaration=Uh.validateResponseIdentifierAttribute(_,this.responseIdentifier),this.validateChildren(),this.renderer=_.getPciContextRenderer(),this.loadIframeHandler=this.handleLoadIframe.bind(this);const e=typeof this.$.vnode.props.class<"u"?this.$.vnode.props.class:"";this.setClassAttribute(e),this.priorState=this.getPriorState(this.responseIdentifier),this.hasPrompts=this.getPrompts(this.$slots).length>0,this.cardinality=this.getCardinality(),this.baseType=this.getBaseType(),this.uniqueId=this.createId()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.movePrompt(),this.processChildren(),_.defineInteraction({identifier:this.responseIdentifier,interactionType:"PortableCustom",node:this,resetValue:this.resetValue,disable:this.disable,isValidResponse:this.getIsValid(),invalidResponseMessage:this.getInvalidResponseMessage(),maxSelectionsMessage:""}),this.initialize(),console.log("["+this.$options.name+"][Identifier]",this.responseIdentifier)}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}},beforeUnmount(){this.pciIframe!==null&&this.pciIframe.removeEventListener("load",this.loadIframeHandler)}},m2={ref:"root",class:"qti-portable-custom-interaction"},g2={ref:"prompt",class:"qti-prompt-wrapper"},y2={ref:"pcigroup",class:"qti3-player-pci-group"},w2={ref:"ic",class:"qti3-player-pci-iframe-container"};function b2(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",m2,[l.createElementVNode("div",g2,null,512),l.createElementVNode("div",y2,[l.renderSlot(e.$slots,"default")],512),l.createElementVNode("div",w2,null,512)],512)}const v2=B(p2,[["render",b2]]),E2={name:"QtiPrompt"},T2={class:"qti-prompt"};function C2(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",T2,[l.renderSlot(e.$slots,"default")])}const S2=B(E2,[["render",C2]]),x2=new G,_2={name:"QtiInlineChoice",props:{identifier:{required:!0,type:String},fixed:{required:!1,type:String,default:"false"},templateIdentifier:{required:!1,type:String},showHide:{required:!1,type:String,default:"show"}},data(){return{id:null}},inheritAttrs:!0,methods:{createId(){if(this.$refs.choice.hasAttribute("id")){this.id=this.$refs.choice.getAttribute("id");return}this.id="inlinechoice_"+x2.randomString(5,"a")+"_"+this.identifier,this.$refs.choice.setAttribute("id",this.id)}},created(){},mounted(){this.createId()}},I2=["data-identifier"];function V2(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("li",{ref:"choice",role:"option","data-identifier":i.identifier,class:"qti-inline-choice"},[l.renderSlot(e.$slots,"default")],8,I2)}const A2=B(_2,[["render",V2]]),$2=new G,L2={name:"QtiSimpleChoice",emits:["setChecked","setFocusPreviousChoice","setFocusNextChoice","setActiveDescendant"],props:{identifier:{required:!0,type:String},fixed:{required:!1,type:String,default:"false"},templateIdentifier:{required:!1,type:String},showHide:{required:!1,type:String,default:"show"}},data(){return{id:null,checked:"false",isRadio:!0,role:"radio",tabIndex:"-1",hasMath:!1,isDisabled:!1,parentCardinality:"single"}},inheritAttrs:!0,methods:{handleClick(){if(!this.isDisabled)if(this.isRadio)this.$parent.$emit("setChecked",{identifier:this.identifier,checked:"true"});else{if(this.toggleChecked(),this.parentCardinality==="ordered")return;this.$parent.$emit("setChecked",{identifier:this.identifier,checked:this.checked})}},handleKeydown(e){let t=!1;switch(e.code){case"Space":if(!this.isDisabled){if(this.toggleChecked(),this.parentCardinality==="ordered")return;this.$parent.$emit("setChecked",{identifier:this.identifier,checked:this.checked})}t=!0;break;case"Enter":if(!this.isDisabled){if(this.toggleChecked(),this.parentCardinality==="ordered")return;this.$parent.$emit("setChecked",{identifier:this.identifier,checked:this.checked})}t=!0;break;case"ArrowUp":case"ArrowLeft":this.isRadio&&(this.$parent.$emit("setFocusPreviousChoice",this.identifier),t=!0);break;case"ArrowDown":case"ArrowRight":this.isRadio&&(this.$parent.$emit("setFocusNextChoice",this.identifier),t=!0);break}t&&(e.stopPropagation(),e.preventDefault())},handleFocus(){this.parentCardinality!=="ordered"&&this.$parent.$emit("setActiveDescendant",this.id)},handleBlur(){},setChecked(e){this.checked=e?"true":"false"},isChecked(){return this.checked==="true"},setTabIndex(e){this.tabIndex=e},setFocus(){this.$refs.choice.focus()},setBlur(){this.$refs.choice.blur()},toggleChecked(){this.checked=this.checked==="true"?"false":"true"},setLabel(e){this.$refs.label.innerText=e},hideLabel(){this.$refs.label.classList.add("qti-hidden")},showLabel(){this.$refs.label.classList.remove("qti-hidden")},setLabelSbac(e){this.$refs.choice.classList.add("sbac"),this.$refs.choice.setAttribute("data-label",e),this.$refs.label.innerText=e,this.$refs.label.classList.add("qti-visually-hidden")},setChoiceLrn(){this.$refs.choice.classList.add("lrn")},hideControl(){this.$refs.choice.classList.add("control-hidden")},setIsDisabled(e){this.isDisabled=e},initializeChoice(){switch(this.parentCardinality=this.$parent.cardinality,this.parentCardinality){case"ordered":this.role="button",this.isRadio=!1,this.tabIndex=0;break;case"multiple":this.role="checkbox",this.isRadio=!1,this.tabIndex=0;break;default:this.role="radio",this.isRadio=!0,this.tabIndex=-1;break}},initializeOrderChoice(){this.role==="button"&&(this.hideLabel(),this.hideControl())},createId(){if(this.$refs.choice.hasAttribute("id")){this.id=this.$refs.choice.getAttribute("id");return}this.id="choice_"+$2.randomString(5,"a")+"_"+this.identifier,this.$refs.choice.setAttribute("id",this.id)},setExpectedSolution(){this.$refs.choice.classList.add("player-show-solution","player-choice-expected")},setCorrectSolution(){this.$refs.choice.classList.add("player-show-solution","player-choice-correct")},setIncorrectSolution(){this.$refs.choice.classList.add("player-show-solution","player-choice-incorrect")},setIgnoreSolution(){this.$refs.choice.classList.remove("player-show-solution","player-choice-incorrect","player-choice-correct","player-choice-expected")}},created(){this.initializeChoice()},mounted(){this.initializeOrderChoice(),this.createId()}},M2=["role","aria-checked","tabindex","data-identifier"],N2={ref:"label",class:"qti-choice-label"},R2={ref:"description",class:"qti-choice-description"};function k2(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("li",{ref:"choice",role:n.role,"aria-checked":n.checked,tabindex:n.tabIndex,"data-identifier":i.identifier,onFocus:t[0]||(t[0]=(...a)=>r.handleFocus&&r.handleFocus(...a)),onBlur:t[1]||(t[1]=(...a)=>r.handleBlur&&r.handleBlur(...a)),onClick:t[2]||(t[2]=(...a)=>r.handleClick&&r.handleClick(...a)),onKeydown:t[3]||(t[3]=(...a)=>r.handleKeydown&&r.handleKeydown(...a)),class:l.normalizeClass(["qti-simple-choice",{source:n.role=="button"}])},[l.createElementVNode("div",{class:l.normalizeClass(["qti-simple-choice-wrapper",{draggable:n.role=="button"}]),style:{width:"100%"}},[l.createElementVNode("div",N2,null,512),l.createElementVNode("div",R2,[l.renderSlot(e.$slots,"default")],512)],2)],42,M2)}const q2=B(L2,[["render",k2]]),O2=new G,B2={name:"QtiSimpleAssociableChoice",props:{identifier:{required:!0,type:String},fixed:{required:!1,type:String,default:"false"},templateIdentifier:{required:!1,type:String},showHide:{required:!1,type:String,default:"show"},matchGroup:{required:!1,type:String,default:""},matchMax:{required:!0,type:String},matchMin:{required:!1,type:String,default:"0"}},data(){return{id:null}},methods:{createId(){if(this.$refs.choice.hasAttribute("id")){this.id=this.$refs.choice.getAttribute("id");return}this.id="choice_"+O2.randomString(5,"a")+"_"+this.identifier,this.$refs.choice.setAttribute("id",this.id)}},mounted(){this.createId()}},P2=["data-identifier","data-match-max","data-match-min","data-match-group"],D2={ref:"description",class:"choice-description"};function Q2(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("li",{ref:"choice","data-identifier":i.identifier,"data-match-max":i.matchMax,"data-match-min":i.matchMin,"data-match-group":i.matchGroup,class:"qti-simple-associable-choice"},[l.createElementVNode("div",D2,[l.renderSlot(e.$slots,"default")],512)],8,P2)}const H2=B(B2,[["render",Q2]]),F2=new G,U2={name:"QtiAssociableHotspot",props:{identifier:{required:!0,type:String},templateIdentifier:{required:!1,type:String},showHide:{required:!1,type:String,default:"show"},matchGroup:{required:!1,type:String,default:""},shape:{required:!0,type:String},coords:{required:!0,type:String},hotspotLabel:{required:!1,type:String,default:""},ariaLabel:{required:!1,type:String,default:""},matchMax:{required:!0,type:String},matchMin:{required:!1,type:String,default:"0"}},data(){return{shapeData:null,shapeColorProperties:null,isQtiValid:!0}},inheritAttrs:!0,methods:{getIdentifier(){return this.identifier},getShape(){return this.shape},getShapeData(){return this.shapeData},setShapeData(){const e=this.coords.split(",");switch(this.getShape()){case"circle":if(e.length!=3)return;this.shapeData=e;return;case"rect":if(e.length!==4)return;e[2]=parseInt(e[2])-parseInt(e[0]),e[3]=parseInt(e[3])-parseInt(e[1]),this.shapeData=e;return;case"poly":this.shapeData=this.transformPolyCoords(e);return;case"ellipse":if(e.length!=4)return;this.shapeData=e;return;case"default":this.shapeData="";return}},transformPolyCoords(e){let t=[];if(e.length%2!=0)return t;for(let i=0;i<e.length;i+=2)t.push(`${e[i]} ${e[i+1]}`);return t},initialize(){F2.validateShapeAttribute(this.shape),this.setShapeData()}},created(){try{this.initialize()}catch(e){if(this.isQtiValid=!1,e.name==="QtiValidationException")throw new c(e.message)}},mounted(){if(this.isQtiValid)try{console.log("["+this.$options.name+"][Identifier]",this.identifier)}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}}},G2=["data-identifier","data-match-max","data-match-min","data-match-group"];function j2(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",{ref:"gap","data-identifier":i.identifier,"data-match-max":i.matchMax,"data-match-min":i.matchMin,"data-match-group":i.matchGroup,class:"ggm-gap"},null,8,G2)}const W2=B(U2,[["render",j2]]),z2=new G,K2=new ie,Y2={name:"QtiSimpleMatchSet",data(){return{choices:[],isShuffle:!1,isQtiValid:!0}},methods:{getChoices(){return this.choices},setIsShuffle(e){this.isShuffle=e},createContainer(e,t){let i=[];return e===null?(this.choices.forEach(n=>{i.push({fixed:n.fixed==="true",node:n})}),this.isShuffle&&K2.shuffleArrayFixed(i),i):(e.state.orders[t].forEach(n=>{const r=this.findChoiceByIdentifier(n,this.choices);r!==null&&i.push({fixed:r.fixed==="true",node:r})},this),i)},processContainerChoices(e){this.choices.splice(0,this.choices.length),this.$refs.matchset.innerHTML="",e.forEach(t=>{this.$refs.matchset.appendChild(t.node.$el),this.choices.push(t.node)},this)},validateChildren(){let e=0;if(!this.$slots.default)throw new c("Must have at least 1 qti-simple-associable-choice");if(this.$slots.default().forEach(t=>{if(z2.isValidSlot(t)){if(t.type.name==="QtiSimpleAssociableChoice")return e+=1;throw new c('Node is not a qti-simple-associable-choice: "'+t.type.name+'"')}}),e===0)throw new c("Must have at least 1 qti-simple-associable-choice")},processChildren(){this.$.subTree.children[0].children.forEach(t=>{t.component!==null&&this.choices.push(t.component.proxy)})},findChoiceByIdentifier(e,t){for(let i=0;i<t.length;i++)if(t[i].$el.getAttribute("data-identifier")===e)return t[i];throw new O('Match Interaction State Invalid. Choice identifier "'+e+'" not found.')}},created(){try{this.validateChildren()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.processChildren(),console.log("["+this.$options.name+"]")}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}}},X2={ref:"matchset",class:"qti-simple-match-set"};function Z2(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("ul",X2,[l.renderSlot(e.$slots,"default")],512)}const J2=B(Y2,[["render",Z2]]);class eq{constructor(t){this.constants={QTI_CHOICES_TOP:"qti-choices-top",QTI_CHOICES_BOTTOM:"qti-choices-bottom",QTI_CHOICES_LEFT:"qti-choices-left",QTI_CHOICES_RIGHT:"qti-choices-right",DATA_MAX_SELECTIONS_MESSAGE:"data-max-selections-message",DATA_MIN_SELECTIONS_MESSAGE:"data-min-selections-message",DATA_CHOICES_CONTAINER_WIDTH:null},this.parentClass=t,this.clazzTokens=[],this.gapMatchGroupElement=null,this.gapChoiceWrapperElement=null,this.gapTargetWrapperElement=null,this.choicesContainerWidth=null,this.gapChoices=[],this.gaps=[],this.presentation_Choices_Orientation=null,this.presentation_MaxSelectionsMessage="",this.presentation_MinSelectionsMessage=""}initialize(t,i,s,n,r,a){this.gapMatchGroupElement=t,this.gapChoiceWrapperElement=i,this.gapTargetWrapperElement=s,this.choicesContainerWidth=n,this.gapChoices=r,this.gaps=a,this.processRootClassAttribute(this.parentClass),this.processPresentation()}processRootClassAttribute(t){const i=t.split(" ");for(let s=0;s<i.length;s++)switch(i[s]){case this.constants.QTI_CHOICES_TOP:case this.constants.QTI_CHOICES_BOTTOM:case this.constants.QTI_CHOICES_LEFT:case this.constants.QTI_CHOICES_RIGHT:this.presentation_Choices_Orientation=i[s];break}this.clazzTokens=i}processPresentation(){this.presentation_Choices_Orientation===null&&(this.presentation_Choices_Orientation=this.constants.QTI_CHOICES_TOP),this.presentation_Choices_Orientation===this.constants.QTI_CHOICES_LEFT?(this.gapChoiceWrapperElement.classList.add(this.constants.QTI_CHOICES_LEFT),this.gapTargetWrapperElement.classList.add(this.constants.QTI_CHOICES_LEFT),this.gapMatchGroupElement.classList.add(this.constants.QTI_CHOICES_LEFT)):this.presentation_Choices_Orientation===this.constants.QTI_CHOICES_TOP?(this.gapChoiceWrapperElement.classList.add(this.constants.QTI_CHOICES_TOP),this.gapTargetWrapperElement.classList.add(this.constants.QTI_CHOICES_TOP)):this.presentation_Choices_Orientation===this.constants.QTI_CHOICES_RIGHT?(this.gapChoiceWrapperElement.classList.add(this.constants.QTI_CHOICES_RIGHT),this.gapTargetWrapperElement.classList.add(this.constants.QTI_CHOICES_RIGHT),this.gapMatchGroupElement.classList.add(this.constants.QTI_CHOICES_RIGHT),this.gapMatchGroupElement.insertBefore(this.gapTargetWrapperElement,this.gapChoiceWrapperElement)):this.presentation_Choices_Orientation===this.constants.QTI_CHOICES_BOTTOM&&(this.gapChoiceWrapperElement.classList.add(this.constants.QTI_CHOICES_BOTTOM),this.gapTargetWrapperElement.classList.add(this.constants.QTI_CHOICES_BOTTOM),this.gapMatchGroupElement.insertBefore(this.gapTargetWrapperElement,this.gapChoiceWrapperElement)),this.processChoicesContainerWidth(),this.processGaps()}processChoicesContainerWidth(){this.choicesContainerWidth!==null&&(this.gapChoiceWrapperElement.style.width=`${this.choicesContainerWidth}px`)}processGaps(){for(let t=0;t<this.gaps.length;t++)this.gaps[t].classList.add("target")}}class tq{constructor(t,i){J(this,"options",{interactionSubType:"default",cardinality:"single",maxAssociations:0,response:null,onReady:null,onUpdate:null,onSelectionsLimit:null});return this.qtiAttributeValidation=new G,this.wrapper=t,this.sourcewrapper=this.wrapper.querySelector(".qti-gap-match-source-wrapper"),this.targetwrapper=this.wrapper.querySelector(".qti-gap-match-target-wrapper"),this.processOptions(i),this.handleDragStart=this.handleDragStart.bind(this),this.handleDragMove=this.handleDragMove.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.handleTouchStart=this.handleTouchStart.bind(this),this.handleTouchMove=this.handleTouchMove.bind(this),this.handleTouchEnd=this.handleTouchEnd.bind(this),this.itemTarget=null,this.itemStart=null,this.isItemStartSource=!0,this.initialX=0,this.initialY=0,this.offsetX=0,this.offsetY=0,this.startingX=0,this.startingY=0,this.currentAssociationsCount=0,this.isDisabled=!1,this.currentDragger=null,this.initializeSources(this.sourcewrapper),this.initializeTargets(this.targetwrapper),this.restoreResponse(this.options.response),this.notifyReady(),this}processOptions(t){"interactionSubType"in t&&(this.options.interactionSubType=t.interactionSubType),"cardinality"in t&&(this.options.cardinality=t.cardinality),"response"in t&&(this.options.response=t.response),"maxAssociations"in t&&(this.options.maxAssociations=t.maxAssociations),"onReady"in t&&(this.options.onReady=t.onReady),"onUpdate"in t&&(this.options.onUpdate=t.onUpdate),"onAssociationsLimit"in t&&(this.options.onAssociationsLimit=t.onAssociationsLimit)}notifyReady(){this.options.onReady!==null&&this.options.onReady({response:this.getResponse()})}notifyUpdate(){this.options.onUpdate!==null&&this.options.onUpdate({response:this.computeResponse()})}notifyAssociationsLimit(){this.options.onAssociationsLimit!==null&&this.options.onAssociationsLimit()}toggleDisable(t){this.isDisabled=t,this.draggers.forEach(i=>{t?i.classList.add("disabled"):i.classList.remove("disabled")})}handleDragStart(t){if(t.preventDefault(),!this.isDisabled&&t.button==0)return this.interactionStart(t.target,t.clientX,t.clientY,!1),!1}handleTouchStart(t){if(t.preventDefault(),!this.isDisabled)return t.targetTouches.length!=1||this.interactionStart(t.target,t.touches[0].pageX,t.touches[0].pageY,!0),!1}interactionStart(t,i,s,n){const r=this.getClosestElement(t,"draggable");this.itemStart=r.parentNode,this.isItemStartSource=this.itemStart.classList.contains("source"),this.identifyTargets(this.itemStart,!0),this.itemTarget=null;const a=r.getBoundingClientRect();this.initialX=i,this.initialY=s,this.startingX=a.left,this.startingY=a.top,this.offsetX=i-this.startingX,this.offsetY=s-this.startingY,this.addPlaceholder(r),r.style.userSelect="none",r.style.width=a.width+"px",r.style.height=a.height+"px",r.style.transform=`translateX(${a.left}px) translateY(${a.top}px) translateZ(0)`,r.classList.add("dragging"),this.setCurrentDragger(r),this.addListeners(r,n)}handleDragMove(t){t.preventDefault(),!this.isDisabled&&this.interactionMove(t.clientX,t.clientY)}handleTouchMove(t){t.preventDefault(),!this.isDisabled&&t.targetTouches.length==1&&this.interactionMove(t.touches[0].clientX,t.touches[0].clientY)}interactionMove(t,i){const s=this.currentDragger;this.offsetX=t-this.initialX,this.offsetY=i-this.initialY,this.constrainDraggerToWrapper(s,this.wrapper),s.style.transform=`translateX(${this.startingX+this.offsetX}px) translateY(${this.startingY+this.offsetY}px) translateZ(0) scale(1)`;const n=s.getBoundingClientRect();this.findDraggerItemTarget(s,n,this.targets),this.isItemStartSource||this.findSourceDraggerTarget(s,n)}constrainDraggerToWrapper(t,i){const s=t.getBoundingClientRect(),n=i.getBoundingClientRect(),r=this.startingX+this.offsetX-n.x,a=this.startingY+this.offsetY-n.y,o=this.startingX+s.width+this.offsetX-(n.x+n.width),u=this.startingY+s.height+this.offsetY-(n.y+n.height);r<0&&(this.offsetX=this.offsetX-r),o>0&&(this.offsetX=this.offsetX-o),a<0&&(this.offsetY=this.offsetY-a),u>0&&(this.offsetY=this.offsetY-u)}handleDragEnd(t){this.isDisabled||this.interactionEnd(t.clientX,t.clientY,!1)}handleTouchEnd(t){this.isDisabled||this.interactionEnd(t.changedTouches[0].clientX,t.changedTouches[0].clientY,!0)}interactionEnd(t,i,s){const n=this.currentDragger;if(this.itemTarget===null?n.style.transform=`translateX(${this.startingX}px) translateY(${this.startingY}px) translateZ(0)`:n.style.transform=`translateX(${this.startingX+this.offsetX}px) translateY(${this.startingY+this.offsetY}px) translateZ(0)`,n.removeAttribute("style"),n.classList.remove("dragging"),this.clearTargetHighlights(),this.itemTarget===null){this.resetDraggerToItemStart(this.itemStart,n),this.setCurrentDragger(null),this.removeListeners(n,s);return}if(this.itemTarget.classList.contains("active")){if(this.itemTarget.classList.remove("active"),this.isExceedingMaxAssociations(this.itemStart,this.itemTarget,n)){this.resetDraggerToItemStart(this.itemStart,n),this.notifyAssociationsLimit(),this.setCurrentDragger(null),this.removeListeners(n,s);return}if(this.itemStart.getAttribute("data-identifier")===this.itemTarget.getAttribute("data-identifier")){this.resetDraggerToItemStart(this.itemStart,n),this.setCurrentDragger(null),this.removeListeners(n,s);return}this.removePlaceholder(n),this.setDraggerToItemTarget(this.itemTarget,n),this.itemTarget.classList.contains("source")&&(this.itemTarget.classList.add("full"),this.itemTarget.dataset.matchMax*1>0&&this.incrementRemaining(this.itemTarget),this.decrementAssociationsCount(),this.sortContainerElements(this.sourcewrapper)),this.itemStart.classList.contains("source")&&(this.itemStart.dataset.matchMax*1>0&&this.decrementRemaining(this.itemStart)===0&&this.itemStart.classList.remove("full"),this.incrementAssociationsCount()),this.itemStart.classList.contains("target")&&(this.isTargetFull(this.itemStart)?this.itemStart.classList.add("full"):this.itemStart.classList.remove("full")),this.notifyUpdate()}this.setCurrentDragger(null),this.removeListeners(n,s)}setCurrentDragger(t){this.currentDragger=t}resetDraggerToItemStart(t,i){this.replacePlaceholder(i),t.classList.contains("source")||i.setAttribute("style","width:100%")}setDraggerToItemTarget(t,i){if(t.classList.contains("source")){if(t.classList.contains("full")){const s=t.querySelector(".draggable");s!=null&&t.replaceChild(i,s);return}t.append(i);return}t.append(i),i.setAttribute("style","width:100%"),this.isTargetFull(t)?t.classList.add("full"):t.classList.remove("full")}findDraggerItemTarget(t,i,s){this.itemTarget=null,s.forEach(n=>{const r=n.getBoundingClientRect();if(i.top+t.offsetHeight/2<r.bottom&&i.right-t.offsetWidth/2>r.left&&i.bottom-t.offsetHeight/2>r.top&&i.left+t.offsetWidth/2<r.right){if(this.isItemStartSource&&n.classList.contains("source")||n.classList.contains("full")||!this.hasMatchingMatchGroup(t.parentNode,n))return;n.classList.add("active"),this.itemTarget=n}else n.classList.remove("active")},this)}findSourceDraggerTarget(t,i){const s=this.sourcewrapper.getBoundingClientRect();if(i.top+t.offsetHeight/2<s.bottom&&i.right-t.offsetWidth/2>s.left&&i.bottom-t.offsetHeight/2>s.top&&i.left+t.offsetWidth/2<s.right){for(let n=0;n<this.sources.length;n++)if(this.sources[n].dataset.identifier===t.dataset.identifier){this.sources[n].classList.add("active"),this.itemTarget=this.sources[n];break}}else for(let n=0;n<this.sources.length;n++)this.sources[n].classList.contains("active")&&this.sources[n].classList.remove("active")}addPlaceholder(t){if(!t.parentNode.classList.contains("source")){this.addPlaceholderElement(t,!1);return}const i=t.parentNode.dataset.matchMax*1;if(i===1){this.addPlaceholderElement(t,!1);return}if(i===0){this.addPlaceholderElement(t,!0);return}if(this.getRemaining(t.parentNode)===1){this.addPlaceholderElement(t,!1);return}this.addPlaceholderElement(t,!0)}addPlaceholderElement(t,i){const s=t.cloneNode(!0);this.deepCloneId(s),i?(s.classList.add("clone"),s.addEventListener("mousedown",this.handleDragStart),s.addEventListener("touchstart",this.handleTouchStart)):s.classList.add("gm-dragger-placeholder"),s.classList.add("placeholder-fade"),t.parentNode.insertBefore(s,t)}removePlaceholder(t){if(t.parentNode.classList.contains("target")){const n=t.parentNode.querySelector(".gm-dragger-placeholder");if(n===null)return;t.parentNode.removeChild(n);return}const i=t.parentNode.dataset.matchMax*1,s=t.parentNode.querySelector(".gm-dragger-placeholder");if(s===null){const n=t.parentNode.querySelector(".clone");if(n===null)return;n.classList.remove("placeholder-fade");return}i!==0&&t.parentNode.removeChild(s)}replacePlaceholder(t){const i=t.parentNode;let s=i.querySelector(".gm-dragger-placeholder");if(i.classList.contains("source")){if(s==null&&(s=i.querySelector(".draggable")),s===null)return;i.replaceChild(t,s);return}s!==null&&i.replaceChild(t,s)}addClonePlaceholder(t){const i=t.cloneNode(!0);this.deepCloneId(i),i.classList.add("clone"),t.parentNode.insertBefore(i,t),i.addEventListener("mousedown",this.handleDragStart),i.addEventListener("touchstart",this.handleTouchStart)}initializeSources(t){this.sources=t.querySelectorAll(".source"),this.sources.forEach(i=>{i.classList.add("full");const s=i.dataset.matchMax*1;this.setRemaining(i,s===0?1e3:s)},this),this.draggers=t.querySelectorAll(".draggable"),this.draggers.forEach((i,s)=>{const n=i.parentNode.getAttribute("data-identifier");i.setAttribute("data-identifier",n),i.setAttribute("data-order",s),i.setAttribute("tabindex",0),i.addEventListener("mousedown",this.handleDragStart),i.addEventListener("touchstart",this.handleTouchStart)},this)}initializeTargets(t){this.targets=t.querySelectorAll(".target"),this.targets.forEach(i=>{i.setAttribute("tabindex",0)})}identifyTargets(t,i){this.targets.forEach(s=>{i&&!s.classList.contains("full")&&this.hasMatchingMatchGroup(t,s)&&s.classList.add("target-active")},this),i&&!this.isItemStartSource&&this.sourcewrapper.classList.add("target-active")}addListeners(t,i){i?(this.removeListeners(t,i),t.addEventListener("touchmove",this.handleTouchMove),t.addEventListener("touchend",this.handleTouchEnd)):(this.removeListeners(t,i),document.addEventListener("mousemove",this.handleDragMove),document.addEventListener("mouseup",this.handleDragEnd))}removeListeners(t,i){i?(t.removeEventListener("touchmove",this.handleTouchMove),t.removeEventListener("touchend",this.handleTouchEnd)):(document.removeEventListener("mousemove",this.handleDragMove),document.removeEventListener("mouseup",this.handleDragEnd))}clearTargetHighlights(){this.targets.forEach(t=>{t.classList.remove("target-active")},this),this.sourcewrapper.classList.remove("target-active")}getClosestElement(t,i){return t?t&&t.classList.contains(i)?t:this.getClosestElement(t.parentElement,i):!1}sortContainerElements(t){let i=[],s=t.children;for(let n=0;n<s.length;n++){const r=s[n].querySelector("div.draggable");r&&i.push([1*r.dataset.order,s[n]])}i.sort(function(n,r){return n[0]-r[0]});for(let n=0;n<i.length;n++)t.appendChild(i[n][1])}getResponse(){return this.computeResponse()}computeResponse(){let t=[];return this.targets.forEach(i=>{i.querySelectorAll(".draggable").forEach(s=>{t.push(`${s.dataset.identifier} ${i.dataset.identifier}`)})}),t.length===0?null:this.options.cardinality==="single"?t[0]:t}restoreResponse(t){t!==null&&(this.options.cardinality==="single"?this.restoreResponsePair(t):t.forEach(i=>{this.restoreResponsePair(i)},this))}restoreResponsePair(t){const i=this.getPair(t);if(i===null)return;const s=this.findSourceByIdentifier(i.source),n=this.findTargetGapByIdentifier(i.target);if(s===null||n===null)return;const r=s.querySelector(".draggable");r!==null&&(this.cloneOrEmptySourceDragger(s,r),this.restoreSourceDraggerToTarget(n,r))}cloneOrEmptySourceDragger(t,i){const s=t.dataset.matchMax*1;if(s===1){t.classList.remove("full"),this.decrementRemaining(t);return}if(s===0){this.addClonePlaceholder(i);return}if(this.getRemaining(t)===1){t.classList.remove("full"),this.decrementRemaining(t);return}this.decrementRemaining(t),this.addClonePlaceholder(i)}findSourceByIdentifier(t){for(let i=0;i<this.sources.length;i++)if(t===this.sources[i].dataset.identifier)return this.sources[i];return null}findTargetGapByIdentifier(t){for(let i=0;i<this.targets.length;i++)if(t===this.targets[i].dataset.identifier)return this.targets[i];return null}getPair(t){if(t===null)return null;const i=t.split(" ");return i.length!=2?null:{source:i[0],target:i[1]}}restoreSourceDraggerToTarget(t,i){t===null||i===null||(t.append(i),i.setAttribute("style","width:100%"),this.incrementAssociationsCount(),this.isTargetFull(t)&&t.classList.add("full"))}hasMatchingMatchGroup(t,i){return t===null||i===null?!1:t.dataset.matchGroup===i.dataset.matchGroup}isTargetFull(t){if(t==null)return!1;const i=t.querySelectorAll(".draggable"),s=t.dataset.matchMax*1;return s===0?!1:i.length>=s}isExceedingMaxAssociations(t,i){return!(this.options.maxAssociations===0||i.classList.contains("source")||t.classList.contains("target")||this.currentAssociationsCount<this.options.maxAssociations)}initializeAssociationsCount(){this.currentAssociationsCount=0}incrementAssociationsCount(){this.currentAssociationsCount+=1}decrementAssociationsCount(){this.currentAssociationsCount!==0&&(this.currentAssociationsCount-=1)}getRemaining(t){return t.dataset.remaining*1}setRemaining(t,i){t.setAttribute("data-remaining",i)}incrementRemaining(t){const i=t.dataset.remaining*1+1;return t.setAttribute("data-remaining",i),i}decrementRemaining(t){let i=t.dataset.remaining*1-1;return i=i>=0?i:0,t.setAttribute("data-remaining",i),i}deepCloneId(t){t.id&&(t.id=`clone_${this.qtiAttributeValidation.randomString(5,"a")}`);for(let i=0;i<t.children.length;i++)this.deepCloneId(t.children[i])}reset(){this.resetDraggersToSources(),this.initializeAssociationsCount(),this.destroy()}resetDraggersToSources(){this.targets.forEach(t=>{t.querySelectorAll(".draggable").forEach(s=>{const n=this.findSourceByIdentifier(s.getAttribute("data-identifier"));n.classList.contains("full")||(t.classList.remove("full"),n.classList.contains("full")?t.removeChild(s):(n.append(s),n.classList.add("full")))},this)},this)}destroy(){this.currentDragger!==null&&(document.removeEventListener("mousemove",this.handleDragMove),document.removeEventListener("mouseup",this.handleDragEnd)),this.wrapper.querySelectorAll(".draggable").forEach(i=>{i.removeEventListener("touchstart",this.handleTouchStart),i.removeEventListener("touchmove",this.handleTouchMove),i.removeEventListener("touchend",this.handleTouchEnd),i.removeEventListener("mousedown",this.handleDragStart)},this)}}const iq=new G,sq=new ie,nq={emits:["gapMatchGroupReady","gapMatchGroupUpdate","gapMatchGroupAssociationsLimit"],props:{responseIdentifier:{required:!0,type:String},cardinality:{required:!0,type:String},shuffle:{required:!1,type:String,default:"false"},maxAssociations:{required:!1,type:String,default:"1"},minAssociations:{required:!1,type:String,default:"0"},dataChoicesContainerWidth:{required:!1,type:String,default:null},interactionSubType:{required:!1,type:String,default:"default"},gapMatchInteractionStaticClass:{required:!0,type:String},priorState:{required:!1,type:Object,default:null}},data(){return{choices:[],order:[],gaps:[],response:null,isShuffle:null,hasPrompt:!1,gapMatchInteractionClassAttribute:null,presentationFactory:null,matchable:null,isQtiValid:!0}},computed:{computedMaxAssociations(){return this.maxAssociations*1}},methods:{getResponse(){return this.response},setResponse(e){this.response=e},disable(){this.matchable!==null&&this.matchable.toggleDisable(!0)},enable(){this.matchable!==null&&this.matchable.toggleDisable(!1)},getChoices(){return this.choices},setIsShuffle(e){this.isShuffle=e},validateChildren(){let e=0;this.$slots.default()[0].children.forEach(t=>{if(iq.isValidSlot(t)){if(t.type.name==="QtiPrompt"){if(e>0)throw new c("Invalid element order. qti-prompt must come before qti-gap-text's, qti-gap-img's, or qti-gap's");if(!this.hasPrompt)return this.hasPrompt=!0;throw new c("Maximum of 1 qti-prompt element permitted")}if(t.type.name==="QtiGapText"||t.type.name==="QtiGapImg")return e+=1;throw new c('Node is not one of qti-gap-text or qti-gap-img: "'+t.type.name+'"')}})},processChildren(){this.$.subTree.children[0].children[0].children.forEach(i=>{i.component!==null&&(i.type.name==="QtiGapText"||i.type.name==="QtiGapImg")&&this.choices.push(i.component.proxy)}),this.$refs.root.querySelectorAll(".gap-match-gap").forEach(i=>{this.gaps.push(i)})},insertAfter(e,t){t.parentNode.insertBefore(e,t.nextSibling)},processGroupUI(e){let t=this.createGapChoiceWrapper();if(t==null)return;let i=this.createContainer(this.priorState);this.processContainerChoices(i,t),this.saveContainerOrder(i);let s=this.createGapTargetWrapper(t);this.presentationFactory.initialize(this.$refs.root,t,s,this.dataChoicesContainerWidth,this.choices,this.gaps),this.matchable=new tq(this.$refs.root,{interactionSubType:this.interactionSubType,cardinality:this.cardinality,maxAssociations:this.computedMaxAssociations,response:e,onReady:this.handleWidgetReady,onUpdate:this.handleWidgetUpdate,onAssociationsLimit:this.handleAssociationsLimit})},createGapChoiceWrapper(){let e=this.$refs.root.querySelector(".qti-gap-choice");if(e===null)return null;let t=document.createElement("ul");return t.classList.add("qti-gap-match-source-wrapper"),this.$refs.root.insertBefore(t,e),t},createGapTargetWrapper(e){const t=document.createElement("div");t.classList.add("qti-gap-match-target-wrapper"),this.insertAfter(t,e);const i=t.nextElementSibling;return i!=null&&t.append(i),t},createContainer(e){let t=[];return e===null?(this.choices.forEach(s=>{t.push({fixed:s.fixed==="true",node:s})}),this.isShuffle&&sq.shuffleArrayFixed(t),t):(e.state.order.forEach(s=>{const n=this.findChoiceByIdentifier(s,this.choices);n!==null&&t.push({fixed:n.fixed==="true",node:n})},this),t)},processContainerChoices(e,t){this.choices.splice(0,this.choices.length),t.innerHTML="",e.forEach(i=>{t.appendChild(i.node.$el),this.choices.push(i.node)},this)},saveContainerOrder(e){const t=[];e.forEach(i=>{t.push(i.node.identifier)}),this.order=t},findChoiceByIdentifier(e,t){for(let i=0;i<t.length;i++)if(t[i].$el.getAttribute("data-identifier")===e)return t[i];throw new O('Gap Match Interaction State Invalid. Choice identifier "'+e+'" not found.')},resetGroupUI(){this.processGroupUI(null)},handleWidgetReady(e){this.setResponse(e.response),this.$emit("gapMatchGroupReady",{response:this.getResponse(),order:this.order})},handleWidgetUpdate(e){this.setResponse(e.response),this.$emit("gapMatchGroupUpdate",{response:this.getResponse()})},handleAssociationsLimit(){this.$emit("gapMatchGroupAssociationsLimit")},initializeGapMatchGroup(){this.presentationFactory=new eq(this.gapMatchInteractionStaticClass)}},created(){try{if(typeof this.cardinality>"u")throw new c("Undefined qti-gap-match-interaction cardinality");if(this.cardinality!=="single"&&this.cardinality!=="multiple")throw new c('qti-gap-match-interaction cardinality must be "single" or "multiple"');this.setIsShuffle(this.shuffle==="true"),this.initializeGapMatchGroup(),this.validateChildren()}catch(e){throw this.isQtiValid=!1,console.log("[QtiGapMatchInteraction][ValidationError]",e.name,e.message),new c(e.message)}},mounted(){if(this.isQtiValid)try{this.processChildren(),this.processGroupUI(this.priorState===null?null:this.priorState.value)}catch(e){if(this.isQtiValid=!1,e.name==="QtiValidationException")throw console.log("[QtiGapMatchInteraction][ValidationException]",e.message),new c(e.message);if(e.name==="QtiEvaluationException")throw console.log("[QtiGapMatchInteraction][EvaluationException]",e.message),new O(e.message)}},beforeUnmount(){this.matchable!==null&&(this.matchable.destroy(),this.matchable=null)}},rq={ref:"root",class:"qti-gap-match-group-wrapper"};function aq(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",rq,[l.renderSlot(e.$slots,"default")],512)}const oq=B(nq,[["render",aq]]);class lq{constructor(t){this.constants={QTI_SELECTIONS_LIGHT:"qti-selections-light",QTI_SELECTIONS_DARK:"qti-selections-dark",QTI_UNSELECTED_HIDDEN:"qti-unselected-hidden",QTI_CHOICES_TOP:"qti-choices-top",QTI_CHOICES_BOTTOM:"qti-choices-bottom",QTI_CHOICES_LEFT:"qti-choices-left",QTI_CHOICES_RIGHT:"qti-choices-right",DATA_MAX_SELECTIONS_MESSAGE:"data-max-selections-message",DATA_MIN_SELECTIONS_MESSAGE:"data-min-selections-message",DATA_CHOICES_CONTAINER_WIDTH:null},this.parentClass=t,this.clazzTokens=[],this.ggmGroupElement=null,this.ggmChoiceWrapperElement=null,this.ggmTargetWrapperElement=null,this.image=null,this.choicesContainerWidth=null,this.gapChoices=[],this.gaps=[],this.presentation_Choices_Orientation=null,this.presentation_Theme=this.constants.QTI_SELECTIONS_DARK,this.presentation_UnselectedHidden=!1,this.presentation_MaxSelectionsMessage="",this.presentation_MinSelectionsMessage=""}initialize(t,i,s,n,r,a,o){this.ggmGroupElement=t,this.ggmChoiceWrapperElement=i,this.ggmTargetWrapperElement=s,this.image=n,this.choicesContainerWidth=r,this.gapChoices=a,this.gaps=o,this.processRootClassAttribute(this.parentClass),this.processPresentation()}processRootClassAttribute(t){const i=t.split(" ");for(let s=0;s<i.length;s++)switch(i[s]){case this.constants.QTI_CHOICES_TOP:case this.constants.QTI_CHOICES_BOTTOM:case this.constants.QTI_CHOICES_LEFT:case this.constants.QTI_CHOICES_RIGHT:this.presentation_Choices_Orientation=i[s];break;case this.constants.QTI_SELECTIONS_DARK:case this.constants.QTI_SELECTIONS_LIGHT:this.presentation_Theme=i[s];break;case this.constants.QTI_UNSELECTED_HIDDEN:this.presentation_UnselectedHidden=!0;break}this.clazzTokens=i}processPresentation(){this.presentation_Choices_Orientation===null&&(this.presentation_Choices_Orientation=this.constants.QTI_CHOICES_TOP),this.presentation_Choices_Orientation===this.constants.QTI_CHOICES_LEFT?(this.ggmChoiceWrapperElement.classList.add(this.constants.QTI_CHOICES_LEFT),this.ggmTargetWrapperElement.classList.add(this.constants.QTI_CHOICES_LEFT),this.ggmGroupElement.classList.add(this.constants.QTI_CHOICES_LEFT)):this.presentation_Choices_Orientation===this.constants.QTI_CHOICES_TOP?(this.ggmChoiceWrapperElement.classList.add(this.constants.QTI_CHOICES_TOP),this.ggmTargetWrapperElement.classList.add(this.constants.QTI_CHOICES_TOP)):this.presentation_Choices_Orientation===this.constants.QTI_CHOICES_RIGHT?(this.ggmChoiceWrapperElement.classList.add(this.constants.QTI_CHOICES_RIGHT),this.ggmTargetWrapperElement.classList.add(this.constants.QTI_CHOICES_RIGHT),this.ggmGroupElement.classList.add(this.constants.QTI_CHOICES_RIGHT),this.ggmGroupElement.insertBefore(this.ggmTargetWrapperElement,this.ggmChoiceWrapperElement)):this.presentation_Choices_Orientation===this.constants.QTI_CHOICES_BOTTOM&&(this.ggmChoiceWrapperElement.classList.add(this.constants.QTI_CHOICES_BOTTOM),this.ggmTargetWrapperElement.classList.add(this.constants.QTI_CHOICES_BOTTOM),this.ggmGroupElement.insertBefore(this.ggmTargetWrapperElement,this.ggmChoiceWrapperElement)),this.processBackgroundImage(),this.processChoicesContainerWidth(),this.processGaps()}processBackgroundImage(){if(this.image===null)return;this.image.setAttribute("draggable","false");const t=this.image.getBoundingClientRect();this.ggmTargetWrapperElement.style.width=`${t.width}px`,this.ggmTargetWrapperElement.style.height=`${t.height}px`}processChoicesContainerWidth(){this.choicesContainerWidth!==null&&(this.ggmChoiceWrapperElement.style.width=`${this.choicesContainerWidth}px`,this.ggmChoiceWrapperElement.style.textAlign="center")}processGaps(){for(let t=0;t<this.gaps.length;t++){const i=this.gaps[t];this.setGapStyle(i,i.getShape(),i.getShapeData()),this.gaps[t].$refs.gap.classList.add("target",this.presentation_Theme),this.presentation_UnselectedHidden&&this.gaps[t].$refs.gap.classList.add(this.constants.QTI_UNSELECTED_HIDDEN)}}setGapStyle(t,i,s){switch(i){case"rect":t.$refs.gap.style.left=`${s[0]}px`,t.$refs.gap.style.top=`${s[1]}px`,t.$refs.gap.style.width=`${s[2]}px`,t.$refs.gap.style.height=`${s[3]}px`;break}}}class cq{constructor(t,i){J(this,"options",{interactionSubType:"default",cardinality:"multiple",maxAssociations:0,response:null,onReady:null,onUpdate:null,onSelectionsLimit:null,zindex:1e3});return this.qtiAttributeValidation=new G,this.wrapper=t,this.sourcewrapper=this.wrapper.querySelector(".qti-ggm-source-wrapper"),this.targetwrapper=this.wrapper.querySelector(".qti-ggm-target-wrapper"),this.processOptions(i),this.handleDragStart=this.handleDragStart.bind(this),this.handleDragMove=this.handleDragMove.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.handleTouchStart=this.handleTouchStart.bind(this),this.handleTouchMove=this.handleTouchMove.bind(this),this.handleTouchEnd=this.handleTouchEnd.bind(this),this.itemTarget=null,this.itemStart=null,this.isItemStartSource=!0,this.savedGapZindex="",this.initialX=0,this.initialY=0,this.offsetX=0,this.offsetY=0,this.startingX=0,this.startingY=0,this.currentAssociationsCount=0,this.isDisabled=!1,this.currentDragger=null,this.initializeSources(this.sourcewrapper),this.initializeTargets(this.targetwrapper),this.restoreResponse(this.options.response),this.notifyReady(),this}processOptions(t){"interactionSubType"in t&&(this.options.interactionSubType=t.interactionSubType),"cardinality"in t&&(this.options.cardinality=t.cardinality),"response"in t&&(this.options.response=t.response),"maxAssociations"in t&&(this.options.maxAssociations=t.maxAssociations),"onReady"in t&&(this.options.onReady=t.onReady),"onUpdate"in t&&(this.options.onUpdate=t.onUpdate),"onAssociationsLimit"in t&&(this.options.onAssociationsLimit=t.onAssociationsLimit)}notifyReady(){this.options.onReady!==null&&this.options.onReady({response:this.getResponse()})}notifyUpdate(){this.options.onUpdate!==null&&this.options.onUpdate({response:this.computeResponse()})}notifyAssociationsLimit(){this.options.onAssociationsLimit!==null&&this.options.onAssociationsLimit()}toggleDisable(t){this.isDisabled=t,this.draggers.forEach(i=>{t?i.classList.add("disabled"):i.classList.remove("disabled")})}handleDragStart(t){if(t.preventDefault(),!this.isDisabled&&t.button==0)return this.interactionStart(t.target,t.clientX,t.clientY,!1),!1}handleTouchStart(t){if(t.preventDefault(),!this.isDisabled)return t.targetTouches.length!=1||this.interactionStart(t.target,t.touches[0].pageX,t.touches[0].pageY,!0),!1}interactionStart(t,i,s,n){const r=this.getClosestElement(t,"draggable");this.itemStart=r.parentNode,this.isItemStartSource=this.itemStart.classList.contains("source"),this.isItemStartSource||this.saveGapZindex(this.itemStart),this.identifyTargets(this.itemStart,!0),this.itemTarget=null;const a=r.getBoundingClientRect();this.initialX=i,this.initialY=s,this.startingX=a.left,this.startingY=a.top,this.offsetX=i-this.startingX,this.offsetY=s-this.startingY,this.addPlaceholder(r),r.classList.add("dragging"),r.style.userSelect="none",r.style.width=a.width+"px",r.style.height=a.height+"px",r.style.transform=`translateX(${a.left}px) translateY(${a.top}px) translateZ(0)`,this.setCurrentDragger(r),this.addListeners(r,n)}handleDragMove(t){t.preventDefault(),!this.isDisabled&&this.interactionMove(t.clientX,t.clientY)}handleTouchMove(t){t.preventDefault(),!this.isDisabled&&t.targetTouches.length==1&&this.interactionMove(t.touches[0].clientX,t.touches[0].clientY)}interactionMove(t,i){const s=this.currentDragger;this.offsetX=t-this.initialX,this.offsetY=i-this.initialY,this.constrainDraggerToWrapper(s,this.wrapper),s.style.transform=`translateX(${this.startingX+this.offsetX}px) translateY(${this.startingY+this.offsetY}px) translateZ(0) scale(1)`;const n=s.getBoundingClientRect();this.findDraggerItemTarget(s,n,this.targets),this.isItemStartSource||this.findSourceDraggerTarget(s,n)}constrainDraggerToWrapper(t,i){const s=t.getBoundingClientRect(),n=i.getBoundingClientRect(),r=this.startingX+this.offsetX-n.x,a=this.startingY+this.offsetY-n.y,o=this.startingX+s.width+this.offsetX-(n.x+n.width),u=this.startingY+s.height+this.offsetY-(n.y+n.height);r<0&&(this.offsetX=this.offsetX-r),o>0&&(this.offsetX=this.offsetX-o),a<0&&(this.offsetY=this.offsetY-a),u>0&&(this.offsetY=this.offsetY-u)}handleDragEnd(t){this.isDisabled||this.interactionEnd(t.clientX,t.clientY,!1)}handleTouchEnd(t){this.isDisabled||this.interactionEnd(t.changedTouches[0].clientX,t.changedTouches[0].clientY,!0)}interactionEnd(t,i,s){const n=this.currentDragger;if(this.itemTarget===null?n.style.transform=`translateX(${this.startingX}px) translateY(${this.startingY}px) translateZ(0)`:n.style.transform=`translateX(${this.startingX+this.offsetX}px) translateY(${this.startingY+this.offsetY}px) translateZ(0)`,n.removeAttribute("style"),n.classList.remove("dragging"),this.clearTargetHighlights(),this.itemTarget===null){this.resetDraggerToItemStart(this.itemStart,n),this.setCurrentDragger(null),this.removeListeners(n,s);return}if(this.itemTarget.classList.contains("active")){if(this.itemTarget.classList.remove("active"),this.isExceedingMaxAssociations(this.itemStart,this.itemTarget,n)){this.resetDraggerToItemStart(this.itemStart,n),this.notifyAssociationsLimit(),this.setCurrentDragger(null),this.removeListeners(n,s);return}if(this.itemStart.getAttribute("data-identifier")===this.itemTarget.getAttribute("data-identifier")){this.resetDraggerToItemStart(this.itemStart,n),this.setCurrentDragger(null),this.removeListeners(n,s);return}this.removePlaceholder(n),this.setDraggerToItemTarget(this.itemTarget,n),this.itemTarget.classList.contains("source")&&(this.itemTarget.classList.add("full"),this.itemTarget.dataset.matchMax*1>0&&this.incrementRemaining(this.itemTarget),this.decrementAssociationsCount(),this.sortContainerElements(this.sourcewrapper)),this.itemStart.classList.contains("source")&&(this.itemStart.dataset.matchMax*1>0&&this.decrementRemaining(this.itemStart)===0&&this.itemStart.classList.remove("full"),this.incrementAssociationsCount()),this.itemStart.classList.contains("target")&&(this.restoreGapZindex(this.itemStart),this.isTargetFull(this.itemStart)?this.itemStart.classList.add("full","contains-choice"):(this.itemStart.classList.remove("full"),this.containsChoices(this.itemStart)?this.itemStart.classList.add("contains-choice"):this.itemStart.classList.remove("contains-choice"))),this.notifyUpdate()}this.setCurrentDragger(null),this.removeListeners(n,s)}setCurrentDragger(t){this.currentDragger=t}resetDraggerToItemStart(t,i){t.classList.contains("target")&&this.restoreGapZindex(t),this.replacePlaceholder(i)}setDraggerToItemTarget(t,i){if(t.classList.contains("source")){this.appendDraggerToSourceTarget(t,i);return}this.appendDraggerToGapTarget(t,i),this.isTargetFull(t)?t.classList.add("full"):t.classList.remove("full")}appendDraggerToSourceTarget(t,i){if(t.classList.contains("full")){const s=t.querySelector(".draggable");s!=null&&t.replaceChild(i,s);return}t.append(i)}appendDraggerToGapTarget(t,i){t.classList.add("contains-choice"),t.append(i)}findDraggerItemTarget(t,i,s){this.itemTarget=null,s.forEach(n=>{const r=n.getBoundingClientRect();if(i.top+t.offsetHeight/2<r.bottom&&i.right-t.offsetWidth/2>r.left&&i.bottom-t.offsetHeight/2>r.top&&i.left+t.offsetWidth/2<r.right){if(this.isItemStartSource&&n.classList.contains("source")||n.classList.contains("full")||!this.hasMatchingMatchGroup(t.parentNode,n))return;n.classList.add("active"),this.itemTarget=n}else n.classList.remove("active")},this)}findSourceDraggerTarget(t,i){const s=this.sourcewrapper.getBoundingClientRect();if(i.top+t.offsetHeight/2<s.bottom&&i.right-t.offsetWidth/2>s.left&&i.bottom-t.offsetHeight/2>s.top&&i.left+t.offsetWidth/2<s.right){for(let n=0;n<this.sources.length;n++)if(this.sources[n].dataset.identifier===t.dataset.identifier){this.sources[n].classList.add("active"),this.itemTarget=this.sources[n];break}}else for(let n=0;n<this.sources.length;n++)this.sources[n].classList.contains("active")&&this.sources[n].classList.remove("active")}addPlaceholder(t){if(!t.parentNode.classList.contains("source")){this.addPlaceholderElement(t,!1);return}const i=t.parentNode.dataset.matchMax*1;if(i===1){this.addPlaceholderElement(t,!1);return}if(i===0){this.addPlaceholderElement(t,!0);return}if(this.getRemaining(t.parentNode)===1){this.addPlaceholderElement(t,!1);return}this.addPlaceholderElement(t,!0)}addPlaceholderElement(t,i){const s=t.cloneNode(!0);this.deepCloneId(s),i?(s.classList.add("clone"),s.addEventListener("mousedown",this.handleDragStart),s.addEventListener("touchstart",this.handleTouchStart)):s.classList.add("ggm-dragger-placeholder"),s.classList.add("placeholder-fade"),t.parentNode.insertBefore(s,t)}removePlaceholder(t){if(t.parentNode.classList.contains("target")){const n=t.parentNode.querySelector(".ggm-dragger-placeholder");if(n===null)return;t.parentNode.removeChild(n);return}const i=t.parentNode.dataset.matchMax*1,s=t.parentNode.querySelector(".ggm-dragger-placeholder");if(s===null){const n=t.parentNode.querySelector(".clone");if(n===null)return;n.classList.remove("placeholder-fade");return}i!==0&&t.parentNode.removeChild(s)}replacePlaceholder(t){const i=t.parentNode;let s=i.querySelector(".ggm-dragger-placeholder");if(i.classList.contains("source")){if(s==null&&(s=i.querySelector(".draggable")),s===null)return;i.replaceChild(t,s);return}s!==null&&i.replaceChild(t,s)}addClonePlaceholder(t){const i=t.cloneNode(!0);this.deepCloneId(i),i.classList.add("clone"),t.parentNode.insertBefore(i,t),i.addEventListener("mousedown",this.handleDragStart),i.addEventListener("touchstart",this.handleTouchStart)}initializeSources(t){this.sources=t.querySelectorAll(".source"),this.sources.forEach(i=>{i.classList.add("full");const s=i.dataset.matchMax*1;this.setRemaining(i,s===0?1e3:s)},this),this.draggers=t.querySelectorAll(".draggable"),this.draggers.forEach((i,s)=>{const n=i.parentNode.getAttribute("data-identifier");i.setAttribute("data-identifier",n),i.setAttribute("data-order",s),i.setAttribute("tabindex",0),i.addEventListener("mousedown",this.handleDragStart),i.addEventListener("touchstart",this.handleTouchStart)},this)}initializeTargets(t){this.targets=t.querySelectorAll(".target"),this.targets.forEach(i=>{i.setAttribute("tabindex",0)})}identifyTargets(t,i){this.targets.forEach(s=>{i&&!s.classList.contains("full")&&this.hasMatchingMatchGroup(t,s)&&s.classList.add("target-active")},this),i&&!this.isItemStartSource&&this.sourcewrapper.classList.add("target-active")}addListeners(t,i){i?(this.removeListeners(t,i),t.addEventListener("touchmove",this.handleTouchMove),t.addEventListener("touchend",this.handleTouchEnd)):(this.removeListeners(t,i),document.addEventListener("mousemove",this.handleDragMove),document.addEventListener("mouseup",this.handleDragEnd))}removeListeners(t,i){i?(t.removeEventListener("touchmove",this.handleTouchMove),t.removeEventListener("touchend",this.handleTouchEnd)):(document.removeEventListener("mousemove",this.handleDragMove),document.removeEventListener("mouseup",this.handleDragEnd))}clearTargetHighlights(){this.targets.forEach(t=>{t.classList.remove("target-active")},this),this.sourcewrapper.classList.remove("target-active")}getClosestElement(t,i){return t?t&&t.classList.contains(i)?t:this.getClosestElement(t.parentElement,i):!1}sortContainerElements(t){let i=[],s=t.children;for(let n=0;n<s.length;n++){const r=s[n].querySelector("div.draggable");r&&i.push([1*r.dataset.order,s[n]])}i.sort(function(n,r){return n[0]-r[0]});for(let n=0;n<i.length;n++)t.appendChild(i[n][1])}saveGapZindex(t){this.savedGapZindex=t.style.zIndex,t.style.zIndex=this.options.zindex}restoreGapZindex(t){t.style.zIndex=this.savedGapZindex}getResponse(){return this.computeResponse()}computeResponse(){let t=[];return this.targets.forEach(i=>{i.querySelectorAll(".draggable").forEach(s=>{t.push(`${s.dataset.identifier} ${i.dataset.identifier}`)})}),t.length===0?null:this.options.cardinality==="single"?t[0]:t}restoreResponse(t){t!==null&&(this.options.cardinality==="single"?this.restoreResponsePair(t):t.forEach(i=>{this.restoreResponsePair(i)},this))}restoreResponsePair(t){const i=this.getPair(t);if(i===null)return;const s=this.findSourceByIdentifier(i.source),n=this.findTargetGapByIdentifier(i.target);if(s===null||n===null)return;const r=s.querySelector(".draggable");r!==null&&(this.cloneOrEmptySourceDragger(s,r),this.restoreSourceDraggerToTarget(n,r))}cloneOrEmptySourceDragger(t,i){const s=t.dataset.matchMax*1;if(s===1){t.classList.remove("full"),this.decrementRemaining(t);return}if(s===0){this.addClonePlaceholder(i);return}if(this.getRemaining(t)===1){t.classList.remove("full"),this.decrementRemaining(t);return}this.decrementRemaining(t),this.addClonePlaceholder(i)}findSourceByIdentifier(t){for(let i=0;i<this.sources.length;i++)if(t===this.sources[i].dataset.identifier)return this.sources[i];return null}findTargetGapByIdentifier(t){for(let i=0;i<this.targets.length;i++)if(t===this.targets[i].dataset.identifier)return this.targets[i];return null}getPair(t){if(t===null)return null;const i=t.split(" ");return i.length!=2?null:{source:i[0],target:i[1]}}restoreSourceDraggerToTarget(t,i){t===null||i===null||(this.appendDraggerToGapTarget(t,i),this.incrementAssociationsCount(),this.isTargetFull(t)&&t.classList.add("full"))}hasMatchingMatchGroup(t,i){return t===null||i===null?!1:t.dataset.matchGroup===i.dataset.matchGroup}isTargetFull(t){if(t==null)return!1;const i=t.querySelectorAll(".draggable"),s=t.dataset.matchMax*1;return s===0?!1:i.length>=s}containsChoices(t){return t==null?!1:t.querySelectorAll(".draggable").length!==0}isExceedingMaxAssociations(t,i){return!(this.options.maxAssociations===0||i.classList.contains("source")||t.classList.contains("target")||this.currentAssociationsCount<this.options.maxAssociations)}initializeAssociationsCount(){this.currentAssociationsCount=0}incrementAssociationsCount(){this.currentAssociationsCount+=1}decrementAssociationsCount(){this.currentAssociationsCount!==0&&(this.currentAssociationsCount-=1)}getRemaining(t){return t.dataset.remaining*1}setRemaining(t,i){t.setAttribute("data-remaining",i)}incrementRemaining(t){const i=t.dataset.remaining*1+1;return t.setAttribute("data-remaining",i),i}decrementRemaining(t){let i=t.dataset.remaining*1-1;return i=i>=0?i:0,t.setAttribute("data-remaining",i),i}deepCloneId(t){t.id&&(t.id=`clone_${this.qtiAttributeValidation.randomString(5,"a")}`);for(let i=0;i<t.children.length;i++)this.deepCloneId(t.children[i])}reset(){this.resetDraggersToSources(),this.initializeAssociationsCount(),this.destroy()}resetDraggersToSources(){this.targets.forEach(t=>{t.querySelectorAll(".draggable").forEach(s=>{const n=this.findSourceByIdentifier(s.getAttribute("data-identifier"));n.classList.contains("full")||(n.classList.contains("full")?t.removeChild(s):(n.append(s),n.classList.add("full")))},this),t.classList.remove("full","contains-choice")},this)}destroy(){this.currentDragger!==null&&(document.removeEventListener("mousemove",this.handleDragMove),document.removeEventListener("mouseup",this.handleDragEnd)),this.wrapper.querySelectorAll(".draggable").forEach(i=>{i.removeEventListener("touchstart",this.handleTouchStart),i.removeEventListener("touchmove",this.handleTouchMove),i.removeEventListener("touchend",this.handleTouchEnd),i.removeEventListener("mousedown",this.handleDragStart)},this)}}const uq=new G,hq=new ie,dq={emits:["ggmGroupReady","ggmGroupUpdate","ggmGroupAssociationsLimit"],props:{responseIdentifier:{required:!0,type:String},cardinality:{required:!0,type:String},shuffle:{required:!1,type:String,default:"false"},maxAssociations:{required:!1,type:String,default:"1"},minAssociations:{required:!1,type:String,default:"0"},dataChoicesContainerWidth:{required:!1,type:String,default:null},interactionSubType:{required:!1,type:String,default:"default"},interactionStaticClass:{required:!0,type:String},priorState:{required:!1,type:Object,default:null}},data(){return{image:null,choices:[],order:[],gaps:[],response:null,isShuffle:null,hasPrompt:!1,interactionClassAttribute:null,presentationFactory:null,matchable:null,isQtiValid:!0}},computed:{computedMaxAssociations(){return this.maxAssociations*1}},methods:{getResponse(){return this.response},setResponse(e){this.response=e},disable(){this.matchable!==null&&this.matchable.toggleDisable(!0)},enable(){this.matchable!==null&&this.matchable.toggleDisable(!1)},getChoices(){return this.choices},setIsShuffle(e){this.isShuffle=e},validateChildren(){let e=0,t=0,i=!1;this.$slots.default()[0].children.forEach(s=>{if(uq.isValidSlot(s)){if(s.type.name==="QtiPrompt"){if(e>0||t>0||i)throw new c("Invalid element order. qti-prompt must come before the background image, qti-gap-text's, qti-gap-img's, or qti-associable-hotspot's");if(!this.hasPrompt)return this.hasPrompt=!0;throw new c("Maximum of 1 qti-prompt element permitted")}if(s.type.name==="QtiGapText"||s.type.name==="QtiGapImg"){if(t>0)throw new c("Invalid element order. qti-gap-text's and qti-gap-img's must come before qti-associable-hotspot's");return e+=1}if(s.type.name==="QtiAssociableHotspot")return t+=1;throw new c('Node is not one of qti-gap-text, qti-gap-img, or qti-associable-hotspot: "'+s.type.name+'"')}else if(s.type==="img"||s.type==="object"||s.type==="picture"){if(e>0||t>0)throw new c("Invalid element order. Background image must preceed qti-gap-text's, qti-gap-img's and qti-associable-hotspot's");i=!0}})},processChildren(){this.$.subTree.children[0].children[0].children.forEach(t=>{if(t.type==="img"||t.type==="object"||t.type==="picture"){this.image=t.el;return}t.component!==null&&(t.type.name==="QtiGapText"||t.type.name==="QtiGapImg"?this.choices.push(t.component.proxy):t.type.name==="QtiAssociableHotspot"&&this.gaps.push(t.component.proxy))})},insertAfter(e,t){t.parentNode.insertBefore(e,t.nextSibling)},processGroupUI(e){let t=this.createGapChoiceWrapper();if(t==null)return;let i=this.createGapTargetWrapper(),s=this.createContainer(this.priorState);this.processContainerChoices(s,t),this.saveContainerOrder(s),this.presentationFactory.initialize(this.$refs.root,t,i,this.image,this.dataChoicesContainerWidth,this.choices,this.gaps),this.matchable=new cq(this.$refs.root,{interactionSubType:this.interactionSubType,cardinality:this.cardinality,maxAssociations:this.computedMaxAssociations,response:e,onReady:this.handleWidgetReady,onUpdate:this.handleWidgetUpdate,onAssociationsLimit:this.handleAssociationsLimit})},createGapChoiceWrapper(){let e=this.$refs.root.querySelector(".qti-gap-choice");if(e===null)return null;let t=document.createElement("ul");return t.classList.add("qti-ggm-source-wrapper"),this.$refs.root.insertBefore(t,e),t},createGapTargetWrapper(){let e=document.createElement("div");e.classList.add("qti-ggm-target-wrapper"),e.append(this.image);for(let t=0;t<this.gaps.length;t++)e.append(this.gaps[t].$el);return this.$refs.root.append(e),e},createContainer(e){let t=[];return e===null?(this.choices.forEach(s=>{t.push({fixed:s.fixed==="true",node:s})}),this.isShuffle&&hq.shuffleArrayFixed(t),t):(e.state.order.forEach(s=>{const n=this.findChoiceByIdentifier(s,this.choices);n!==null&&t.push({fixed:n.fixed==="true",node:n})},this),t)},processContainerChoices(e,t){this.choices.splice(0,this.choices.length),t.innerHTML="",e.forEach(i=>{t.appendChild(i.node.$el),this.choices.push(i.node)},this)},saveContainerOrder(e){const t=[];e.forEach(i=>{t.push(i.node.identifier)}),this.order=t},findChoiceByIdentifier(e,t){for(let i=0;i<t.length;i++)if(t[i].$el.getAttribute("data-identifier")===e)return t[i];throw new O('Gap Match Interaction State Invalid. Choice identifier "'+e+'" not found.')},resetGroupUI(){this.processGroupUI(null)},handleWidgetReady(e){this.setResponse(e.response),this.$emit("ggmGroupReady",{response:this.getResponse(),order:this.order})},handleWidgetUpdate(e){this.setResponse(e.response),this.$emit("ggmGroupUpdate",{response:this.getResponse()})},handleAssociationsLimit(){this.$emit("ggmGroupAssociationsLimit")},initializeGraphicGapMatchGroup(){this.presentationFactory=new lq(this.interactionStaticClass)}},created(){try{if(typeof this.cardinality>"u")throw new c("Undefined qti-graphic-gap-match-interaction cardinality");if(this.cardinality!=="multiple")throw new c('qti-graphic-gap-match-interaction cardinality must be "multiple"');this.setIsShuffle(this.shuffle==="true"),this.initializeGraphicGapMatchGroup(),this.validateChildren()}catch(e){throw this.isQtiValid=!1,console.log("[QtiGapMatchInteraction][ValidationError]",e.name,e.message),new c(e.message)}},mounted(){if(this.isQtiValid)try{this.processChildren(),this.processGroupUI(this.priorState===null?null:this.priorState.value)}catch(e){if(this.isQtiValid=!1,e.name==="QtiValidationException")throw console.log("[QtiGapMatchInteraction][ValidationException]",e.message),new c(e.message);if(e.name==="QtiEvaluationException")throw console.log("[QtiGapMatchInteraction][EvaluationException]",e.message),new O(e.message)}},beforeUnmount(){this.matchable!==null&&(this.matchable.destroy(),this.matchable=null)}},fq={ref:"root",class:"qti-ggm-group-wrapper"};function pq(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",fq,[l.renderSlot(e.$slots,"default")],512)}const mq=B(dq,[["render",pq]]);class gq{constructor(){this.constants={QTI_CHOICES_TOP:"qti-choices-top",QTI_CHOICES_BOTTOM:"qti-choices-bottom",QTI_CHOICES_LEFT:"qti-choices-left",QTI_CHOICES_RIGHT:"qti-choices-right",QTI_MATCH_TABULAR:"qti-match-tabular",QTI_HEADER_HIDDEN:"qti-header-hidden",ROW_CENTRIC:"row-centric",DATA_MAX_SELECTIONS_MESSAGE:"data-max-selections-message",DATA_MIN_SELECTIONS_MESSAGE:"data-min-selections-message",DATA_FIRST_COLUMN_HEADER:""},this.interactionSubType="default",this.parentClass="",this.clazzTokens=[],this.matchWrapperElement=null,this.matchGroupNode=null,this.matchSetNode1=null,this.matchSetNode2=null,this.choices1=[],this.choices2=[],this.presentation_Choices_Orientation=null,this.presentation_Header_Hidden=!1,this.presentation_Row_Centric=!1,this.presentation_MaxSelectionsMessage="",this.presentation_MinSelectionsMessage=""}initialize(t,i,s,n,r){this.interactionSubType=t,this.matchWrapperElement=i,this.matchGroupNode=s,this.parentClass=s.matchInteractionStaticClass,this.matchSetNode1=n,this.matchSetNode2=r,this.choices1=this.matchSetNode1.getChoices(),this.choices2=this.matchSetNode2.getChoices(),this.processRootClassAttribute(this.parentClass),this.processPresentation()}processRootClassAttribute(t){const i=t.split(" ");for(let s=0;s<i.length;s++)switch(i[s]){case this.constants.QTI_CHOICES_TOP:case this.constants.QTI_CHOICES_BOTTOM:case this.constants.QTI_CHOICES_LEFT:case this.constants.QTI_CHOICES_RIGHT:this.presentation_Choices_Orientation=i[s];break;case this.constants.QTI_MATCH_TABULAR:break;case this.constants.QTI_HEADER_HIDDEN:this.presentation_Header_Hidden=!0;break;case this.constants.ROW_CENTRIC:this.presentation_Row_Centric=!0;break}this.clazzTokens=i}processPresentation(){this.matchSetNode1.$refs.matchset.classList.add("qti-match-source-wrapper"),this.matchSetNode2.$refs.matchset.classList.add("qti-match-target-wrapper"),this.interactionSubType==="default"?(this.presentation_Choices_Orientation===null&&(this.presentation_Choices_Orientation=this.constants.QTI_CHOICES_TOP),this.presentation_Choices_Orientation===this.constants.QTI_CHOICES_LEFT?(this.matchSetNode1.$refs.matchset.classList.add(this.constants.QTI_CHOICES_LEFT),this.matchSetNode2.$refs.matchset.classList.add(this.constants.QTI_CHOICES_LEFT)):this.presentation_Choices_Orientation===this.constants.QTI_CHOICES_TOP?(this.matchSetNode1.$refs.matchset.classList.add(this.constants.QTI_CHOICES_TOP),this.matchSetNode2.$refs.matchset.classList.add(this.constants.QTI_CHOICES_TOP)):this.presentation_Choices_Orientation===this.constants.QTI_CHOICES_RIGHT?(this.matchSetNode1.$refs.matchset.classList.add(this.constants.QTI_CHOICES_RIGHT),this.matchSetNode2.$refs.matchset.classList.add(this.constants.QTI_CHOICES_RIGHT),this.matchWrapperElement.insertBefore(this.matchSetNode2.$refs.matchset,this.matchSetNode1.$refs.matchset)):this.presentation_Choices_Orientation===this.constants.QTI_CHOICES_BOTTOM&&(this.matchSetNode1.$refs.matchset.classList.add(this.constants.QTI_CHOICES_BOTTOM),this.matchSetNode2.$refs.matchset.classList.add(this.constants.QTI_CHOICES_BOTTOM),this.matchWrapperElement.insertBefore(this.matchSetNode2.$refs.matchset,this.matchSetNode1.$refs.matchset)),this.updateMatchSetChoices(this.matchSetNode1,!0),this.updateMatchSetChoices(this.matchSetNode2,!1)):this.interactionSubType==="matchtabular"&&(this.createMatchTable(),this.matchSetNode1.$refs.matchset.classList.add("matchset-hidden"),this.matchSetNode2.$refs.matchset.classList.add("matchset-hidden"))}updateMatchSetChoices(t,i){const s=t.getChoices();for(let n=0;n<s.length;n++)i?(s[n].$refs.choice.classList.add("source"),s[n].$refs.description.classList.add("draggable")):(s[n].$refs.choice.classList.add("target"),s[n].$refs.description.classList.add("match-target-label"))}createMatchTable(){const t=document.createElement("table");this.clazzTokens.forEach(i=>{t.classList.add(i)}),t.classList.add("matchtabular","table","table-bordered"),this.matchWrapperElement.insertBefore(t,this.matchSetNode1.$refs.matchset)}}class yq{constructor(t,i){J(this,"options",{interactionSubType:"default",cardinality:"single",maxAssociations:0,response:null,onReady:null,onUpdate:null,onSelectionsLimit:null});return this.qtiAttributeValidation=new G,this.wrapper=t,this.sourcewrapper=this.wrapper.querySelector(".qti-match-source-wrapper"),this.targetwrapper=this.wrapper.querySelector(".qti-match-target-wrapper"),this.processOptions(i),this.handleDragStart=this.handleDragStart.bind(this),this.handleDragMove=this.handleDragMove.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.handleTouchStart=this.handleTouchStart.bind(this),this.handleTouchMove=this.handleTouchMove.bind(this),this.handleTouchEnd=this.handleTouchEnd.bind(this),this.itemTarget=null,this.itemStart=null,this.isItemStartSource=!0,this.initialX=0,this.initialY=0,this.offsetX=0,this.offsetY=0,this.startingX=0,this.startingY=0,this.currentAssociationsCount=0,this.isDisabled=!1,this.currentDragger=null,this.initializeSources(this.sourcewrapper),this.initializeTargets(this.targetwrapper),this.restoreResponse(this.options.response),this.notifyReady(),this}processOptions(t){"interactionSubType"in t&&(this.options.interactionSubType=t.interactionSubType),"cardinality"in t&&(this.options.cardinality=t.cardinality),"response"in t&&(this.options.response=t.response),"maxAssociations"in t&&(this.options.maxAssociations=t.maxAssociations),"onReady"in t&&(this.options.onReady=t.onReady),"onUpdate"in t&&(this.options.onUpdate=t.onUpdate),"onAssociationsLimit"in t&&(this.options.onAssociationsLimit=t.onAssociationsLimit)}notifyReady(){this.options.onReady!==null&&this.options.onReady({response:this.getResponse()})}notifyUpdate(){this.options.onUpdate!==null&&this.options.onUpdate({response:this.computeResponse()})}notifyAssociationsLimit(){this.options.onAssociationsLimit!==null&&this.options.onAssociationsLimit()}toggleDisable(t){this.isDisabled=t,this.draggers.forEach(i=>{t?i.classList.add("disabled"):i.classList.remove("disabled")})}handleDragStart(t){if(t.preventDefault(),!this.isDisabled&&t.button==0)return this.interactionStart(t.target,t.clientX,t.clientY,!1),!1}handleTouchStart(t){if(t.preventDefault(),!this.isDisabled)return t.targetTouches.length!=1||this.interactionStart(t.target,t.touches[0].pageX,t.touches[0].pageY,!0),!1}interactionStart(t,i,s,n){const r=this.getClosestElement(t,"draggable");this.itemStart=r.parentNode,this.isItemStartSource=this.itemStart.classList.contains("source"),this.identifyTargets(this.itemStart,!0),this.itemTarget=null;const a=r.getBoundingClientRect();this.initialX=i,this.initialY=s,this.startingX=a.left,this.startingY=a.top,this.offsetX=i-this.startingX,this.offsetY=s-this.startingY,this.addPlaceholder(r),r.style.userSelect="none",r.style.width=a.width+"px",r.style.height=a.height+"px",r.style.transform=`translateX(${a.left}px) translateY(${a.top}px) translateZ(0)`,r.classList.add("dragging"),this.setCurrentDragger(r),this.addListeners(r,n)}handleDragMove(t){t.preventDefault(),!this.isDisabled&&this.interactionMove(t.clientX,t.clientY)}handleTouchMove(t){t.preventDefault(),!this.isDisabled&&t.targetTouches.length==1&&this.interactionMove(t.touches[0].clientX,t.touches[0].clientY)}interactionMove(t,i){const s=this.currentDragger;this.offsetX=t-this.initialX,this.offsetY=i-this.initialY,this.constrainDraggerToWrapper(s,this.wrapper),s.style.transform=`translateX(${this.startingX+this.offsetX}px) translateY(${this.startingY+this.offsetY}px) translateZ(0) scale(1)`;const n=s.getBoundingClientRect();this.findDraggerItemTarget(s,n,this.targets),this.isItemStartSource||this.findSourceDraggerTarget(s,n)}constrainDraggerToWrapper(t,i){const s=t.getBoundingClientRect(),n=i.getBoundingClientRect(),r=this.startingX+this.offsetX-n.x,a=this.startingY+this.offsetY-n.y,o=this.startingX+s.width+this.offsetX-(n.x+n.width),u=this.startingY+s.height+this.offsetY-(n.y+n.height);r<0&&(this.offsetX=this.offsetX-r),o>0&&(this.offsetX=this.offsetX-o),a<0&&(this.offsetY=this.offsetY-a),u>0&&(this.offsetY=this.offsetY-u)}handleDragEnd(t){this.isDisabled||this.interactionEnd(t.clientX,t.clientY,!1)}handleTouchEnd(t){this.isDisabled||this.interactionEnd(t.changedTouches[0].clientX,t.changedTouches[0].clientY,!0)}interactionEnd(t,i,s){const n=this.currentDragger;if(this.itemTarget===null?n.style.transform=`translateX(${this.startingX}px) translateY(${this.startingY}px) translateZ(0)`:n.style.transform=`translateX(${this.startingX+this.offsetX}px) translateY(${this.startingY+this.offsetY}px) translateZ(0)`,n.removeAttribute("style"),n.classList.remove("dragging"),this.clearTargetHighlights(),this.itemTarget===null){this.resetDraggerToItemStart(this.itemStart,n),this.setCurrentDragger(null),this.removeListeners(n,s);return}if(this.itemTarget.classList.contains("active")){if(this.itemTarget.classList.remove("active"),this.isExceedingMaxAssociations(this.itemStart,this.itemTarget,n)){this.resetDraggerToItemStart(this.itemStart,n),this.notifyAssociationsLimit(),this.setCurrentDragger(null),this.removeListeners(n,s);return}if(this.itemStart.getAttribute("data-identifier")===this.itemTarget.getAttribute("data-identifier")){this.resetDraggerToItemStart(this.itemStart,n),this.setCurrentDragger(null),this.removeListeners(n,s);return}this.removePlaceholder(n),this.setDraggerToItemTarget(this.itemTarget,n),this.itemTarget.classList.contains("source")&&(this.itemTarget.classList.add("full"),this.itemTarget.dataset.matchMax*1>0&&this.incrementRemaining(this.itemTarget),this.decrementAssociationsCount(),this.sortContainerElements(this.sourcewrapper)),this.itemStart.classList.contains("source")&&(this.itemStart.dataset.matchMax*1>0&&this.decrementRemaining(this.itemStart)===0&&this.itemStart.classList.remove("full"),this.incrementAssociationsCount()),this.itemStart.classList.contains("target")&&(this.isTargetFull(this.itemStart)?this.itemStart.classList.add("full"):this.itemStart.classList.remove("full")),this.notifyUpdate()}this.setCurrentDragger(null),this.removeListeners(n,s)}setCurrentDragger(t){this.currentDragger=t}resetDraggerToItemStart(t,i){this.replacePlaceholder(i),t.classList.contains("source")||i.setAttribute("style","width:100%")}setDraggerToItemTarget(t,i){if(t.classList.contains("source")){if(t.classList.contains("full")){const s=t.querySelector(".draggable");s!=null&&t.replaceChild(i,s);return}t.append(i);return}t.append(i),i.setAttribute("style","width:100%"),this.isTargetFull(t)?t.classList.add("full"):t.classList.remove("full")}findDraggerItemTarget(t,i,s){this.itemTarget=null,s.forEach(n=>{const r=n.getBoundingClientRect();if(i.top+t.offsetHeight/2<r.bottom&&i.right-t.offsetWidth/2>r.left&&i.bottom-t.offsetHeight/2>r.top&&i.left+t.offsetWidth/2<r.right){if(this.isItemStartSource&&n.classList.contains("source")||n.classList.contains("full")||!this.hasMatchingMatchGroup(t.parentNode,n))return;n.classList.add("active"),this.itemTarget=n}else n.classList.remove("active")},this)}findSourceDraggerTarget(t,i){const s=this.sourcewrapper.getBoundingClientRect();if(i.top+t.offsetHeight/2<s.bottom&&i.right-t.offsetWidth/2>s.left&&i.bottom-t.offsetHeight/2>s.top&&i.left+t.offsetWidth/2<s.right){for(let n=0;n<this.sources.length;n++)if(this.sources[n].dataset.identifier===t.dataset.identifier){this.sources[n].classList.add("active"),this.itemTarget=this.sources[n];break}}else for(let n=0;n<this.sources.length;n++)this.sources[n].classList.contains("active")&&this.sources[n].classList.remove("active")}addPlaceholder(t){if(!t.parentNode.classList.contains("source")){this.addPlaceholderElement(t,!1);return}const i=t.parentNode.dataset.matchMax*1;if(i===1){this.addPlaceholderElement(t,!1);return}if(i===0){this.addPlaceholderElement(t,!0);return}if(this.getRemaining(t.parentNode)===1){this.addPlaceholderElement(t,!1);return}this.addPlaceholderElement(t,!0)}addPlaceholderElement(t,i){const s=t.cloneNode(!0);this.deepCloneId(s),i?(s.classList.add("clone"),s.addEventListener("mousedown",this.handleDragStart),s.addEventListener("touchstart",this.handleTouchStart)):s.classList.add("match-dragger-placeholder"),s.classList.add("placeholder-fade"),t.parentNode.insertBefore(s,t)}removePlaceholder(t){if(t.parentNode.classList.contains("target")){const n=t.parentNode.querySelector(".match-dragger-placeholder");if(n===null)return;t.parentNode.removeChild(n);return}const i=t.parentNode.dataset.matchMax*1,s=t.parentNode.querySelector(".match-dragger-placeholder");if(s===null){const n=t.parentNode.querySelector(".clone");if(n===null)return;n.classList.remove("placeholder-fade");return}i!==0&&t.parentNode.removeChild(s)}replacePlaceholder(t){const i=t.parentNode;let s=i.querySelector(".match-dragger-placeholder");if(i.classList.contains("source")){if(s==null&&(s=i.querySelector(".draggable")),s===null)return;i.replaceChild(t,s);return}s!==null&&i.replaceChild(t,s)}addClonePlaceholder(t){const i=t.cloneNode(!0);this.deepCloneId(i),i.classList.add("clone"),t.parentNode.insertBefore(i,t),i.addEventListener("mousedown",this.handleDragStart),i.addEventListener("touchstart",this.handleTouchStart)}initializeSources(t){this.sources=t.querySelectorAll(".source"),this.sources.forEach(i=>{i.classList.add("full");const s=i.dataset.matchMax*1;this.setRemaining(i,s===0?1e3:s)},this),this.draggers=t.querySelectorAll(".draggable"),this.draggers.forEach((i,s)=>{const n=i.parentNode.getAttribute("data-identifier");i.setAttribute("data-identifier",n),i.setAttribute("data-order",s),i.setAttribute("tabindex",0),i.addEventListener("mousedown",this.handleDragStart),i.addEventListener("touchstart",this.handleTouchStart)},this)}initializeTargets(t){this.targets=t.querySelectorAll(".target"),this.targets.forEach(i=>{i.setAttribute("tabindex",0)})}identifyTargets(t,i){this.targets.forEach(s=>{i&&!s.classList.contains("full")&&this.hasMatchingMatchGroup(t,s)&&s.classList.add("target-active")},this),i&&!this.isItemStartSource&&this.sourcewrapper.classList.add("target-active")}addListeners(t,i){i?(this.removeListeners(t,i),t.addEventListener("touchmove",this.handleTouchMove),t.addEventListener("touchend",this.handleTouchEnd)):(this.removeListeners(t,i),document.addEventListener("mousemove",this.handleDragMove),document.addEventListener("mouseup",this.handleDragEnd))}removeListeners(t,i){i?(t.removeEventListener("touchmove",this.handleTouchMove),t.removeEventListener("touchend",this.handleTouchEnd)):(document.removeEventListener("mousemove",this.handleDragMove),document.removeEventListener("mouseup",this.handleDragEnd))}clearTargetHighlights(){this.targets.forEach(t=>{t.classList.remove("target-active")},this),this.sourcewrapper.classList.remove("target-active")}getClosestElement(t,i){return t?t&&t.classList.contains(i)?t:this.getClosestElement(t.parentElement,i):!1}sortContainerElements(t){let i=[],s=t.children;for(let n=0;n<s.length;n++){const r=s[n].querySelector("div.draggable");r&&i.push([1*r.dataset.order,s[n]])}i.sort(function(n,r){return n[0]-r[0]});for(let n=0;n<i.length;n++)t.appendChild(i[n][1])}getResponse(){return this.computeResponse()}computeResponse(){let t=[];return this.targets.forEach(i=>{i.querySelectorAll(".draggable").forEach(s=>{t.push(`${s.dataset.identifier} ${i.dataset.identifier}`)})}),t.length===0?null:this.options.cardinality==="single"?t[0]:t}restoreResponse(t){t!==null&&(this.options.cardinality==="single"?this.restoreResponsePair(t):t.forEach(i=>{this.restoreResponsePair(i)},this))}restoreResponsePair(t){const i=this.getPair(t);if(i===null)return;const s=this.findSourceByIdentifier(i.source),n=this.findTargetGapByIdentifier(i.target);if(s===null||n===null)return;const r=s.querySelector(".draggable");r!==null&&(this.cloneOrEmptySourceDragger(s,r),this.restoreSourceDraggerToTarget(n,r))}cloneOrEmptySourceDragger(t,i){const s=t.dataset.matchMax*1;if(s===1){t.classList.remove("full"),this.decrementRemaining(t);return}if(s===0){this.addClonePlaceholder(i);return}if(this.getRemaining(t)===1){t.classList.remove("full"),this.decrementRemaining(t);return}this.decrementRemaining(t),this.addClonePlaceholder(i)}findSourceByIdentifier(t){for(let i=0;i<this.sources.length;i++)if(t===this.sources[i].dataset.identifier)return this.sources[i];return null}findTargetGapByIdentifier(t){for(let i=0;i<this.targets.length;i++)if(t===this.targets[i].dataset.identifier)return this.targets[i];return null}getPair(t){if(t===null)return null;const i=t.split(" ");return i.length!=2?null:{source:i[0],target:i[1]}}restoreSourceDraggerToTarget(t,i){t===null||i===null||(t.append(i),i.setAttribute("style","width:100%"),this.incrementAssociationsCount(),this.isTargetFull(t)&&t.classList.add("full"))}hasMatchingMatchGroup(t,i){return t===null||i===null?!1:t.dataset.matchGroup===i.dataset.matchGroup}isTargetFull(t){if(t==null)return!1;const i=t.querySelectorAll(".draggable"),s=t.dataset.matchMax*1;return s===0?!1:i.length>=s}isExceedingMaxAssociations(t,i){return!(this.options.maxAssociations===0||i.classList.contains("source")||t.classList.contains("target")||this.currentAssociationsCount<this.options.maxAssociations)}initializeAssociationsCount(){this.currentAssociationsCount=0}incrementAssociationsCount(){this.currentAssociationsCount+=1}decrementAssociationsCount(){this.currentAssociationsCount!==0&&(this.currentAssociationsCount-=1)}getRemaining(t){return t.dataset.remaining*1}setRemaining(t,i){t.setAttribute("data-remaining",i)}incrementRemaining(t){const i=t.dataset.remaining*1+1;return t.setAttribute("data-remaining",i),i}decrementRemaining(t){let i=t.dataset.remaining*1-1;return i=i>=0?i:0,t.setAttribute("data-remaining",i),i}deepCloneId(t){t.id&&(t.id=`clone_${this.qtiAttributeValidation.randomString(5,"a")}`);for(let i=0;i<t.children.length;i++)this.deepCloneId(t.children[i])}reset(){this.resetDraggersToSources(),this.initializeAssociationsCount(),this.destroy()}resetDraggersToSources(){this.targets.forEach(t=>{t.querySelectorAll(".draggable").forEach(s=>{const n=this.findSourceByIdentifier(s.getAttribute("data-identifier"));n.classList.contains("full")||(t.classList.remove("full"),n.classList.contains("full")?t.removeChild(s):(n.append(s),n.classList.add("full")))},this)},this)}destroy(){this.currentDragger!==null&&(document.removeEventListener("mousemove",this.handleDragMove),document.removeEventListener("mouseup",this.handleDragEnd)),this.wrapper.querySelectorAll(".draggable").forEach(i=>{i.removeEventListener("touchstart",this.handleTouchStart),i.removeEventListener("touchmove",this.handleTouchMove),i.removeEventListener("touchend",this.handleTouchEnd),i.removeEventListener("mousedown",this.handleDragStart)},this)}}class wq{constructor(t,i){J(this,"options",{interactionSubType:"matchtabular",isHeaderHidden:!1,isRowCentric:!1,firstColumnHeader:null,cardinality:"single",maxAssociations:0,response:null,onReady:null,onUpdate:null,onSelectionsLimit:null});J(this,"keyCodes",{Enter:13,Space:32,End:35,Home:36,ArrowLeft:37,ArrowUp:38,ArrowRight:39,ArrowDown:40});return this.wrapper=t,this.table=this.wrapper.querySelector("table.matchtabular"),this.sourcewrapper=this.wrapper.querySelector(".qti-match-source-wrapper"),this.targetwrapper=this.wrapper.querySelector(".qti-match-target-wrapper"),this.currentAssociationsCount=0,this.isDisabled=!1,this.processOptions(i),this.handleClick=this.handleClick.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleBlur=this.handleBlur.bind(this),this.state=new Map,this.initializeTable(this.sourcewrapper,this.targetwrapper),this.restoreResponse(),this.notifyReady(),this}processOptions(t){"interactionSubType"in t&&(this.options.interactionSubType=t.interactionSubType),"isHeaderHidden"in t&&(this.options.isHeaderHidden=t.isHeaderHidden),"isRowCentric"in t&&(this.options.isRowCentric=t.isRowCentric),"firstColumnHeader"in t&&(this.options.firstColumnHeader=t.firstColumnHeader),"cardinality"in t&&(this.options.cardinality=t.cardinality),"response"in t&&(this.options.response=t.response),"maxAssociations"in t&&(this.options.maxAssociations=t.maxAssociations),"onReady"in t&&(this.options.onReady=t.onReady),"onUpdate"in t&&(this.options.onUpdate=t.onUpdate),"onAssociationsLimit"in t&&(this.options.onAssociationsLimit=t.onAssociationsLimit)}notifyReady(){this.options.onReady!==null&&this.options.onReady({response:this.getResponse()})}notifyUpdate(){this.options.onUpdate!==null&&this.options.onUpdate({response:this.computeResponse()})}notifyAssociationsLimit(){this.options.onAssociationsLimit!==null&&this.options.onAssociationsLimit()}toggleDisable(t){this.isDisabled=t,this.controls.forEach(i=>{t?i.classList.add("disabled"):i.classList.remove("disabled")})}handleClick(t){if(!this.isDisabled){if(this.isRadio(t.target)){this.setControlChecked(t.target);return}this.toggleControl(t.target)}}handleKeydown(t){let i=!1;switch(t.code){case"Space":case"Enter":this.isDisabled||this.toggleControl(t.target),i=!0;break;case"ArrowUp":case"ArrowLeft":i=!0;break;case"ArrowDown":case"ArrowRight":i=!0;break}i&&(t.stopPropagation(),t.preventDefault())}handleFocus(){}handleBlur(){}toggleControl(t){if(!this.isChecked(t)){if(this.isExceedingMaxAssociations()){this.notifyAssociationsLimit();return}if(this.isExceedingMatchMax(t.dataset.pair,t.dataset.sourceMax*1,!0)||this.isExceedingMatchMax(t.dataset.pair,t.dataset.targetMax*1,!1))return;this.updateState(t.dataset.pair,this.toggleChecked(t)),this.notifyUpdate();return}this.updateState(t.dataset.pair,this.toggleChecked(t)),this.notifyUpdate()}setControlChecked(t){if(!this.isChecked(t)){if(this.isExceedingMaxAssociations()){this.notifyAssociationsLimit();return}if(this.isExceedingMatchMax(t.dataset.pair,t.dataset.sourceMax*1,!0)||this.isExceedingMatchMax(t.dataset.pair,t.dataset.targetMax*1,!1))return;this.updateState(t.dataset.pair,this.setChecked(t,!0)),this.notifyUpdate();return}this.updateState(t.dataset.pair,this.setChecked(t,!0)),this.notifyUpdate()}setChecked(t,i){const s=i?"true":"false";return t.setAttribute("aria-checked",s),s}toggleChecked(t){const s=t.getAttribute("aria-checked")==="true"?"false":"true";return t.setAttribute("aria-checked",s),s}isRadio(t){return t===null?!1:t.getAttribute("role")==="radio"}isChecked(t){return t===null?!1:t.getAttribute("aria-checked")==="true"}setTabIndex(t){this.tabIndex=t}setFocus(){}setBlur(){}updateState(t,i){this.state.set(t,i),this.currentAssociationsCount=0;for(let s of this.state.values())s==="true"&&(this.currentAssociationsCount+=1)}initializeTable(t,i){this.sources=this.getChoices(t),this.targets=this.getChoices(i);const s=`width:${this.getColumnWidthPercentage(this.targets.length)}%`;this.table.innerHTML=`${this.getHeader(s)}${this.getBody(s)}`,this.controls=this.table.querySelectorAll(".control-cell"),this.controls.forEach(n=>{const r=n.getAttribute("data-pair");this.updateState(r,"false"),n.addEventListener("click",this.handleClick),n.addEventListener("keydown",this.handleKeydown),n.addEventListener("focus",this.handleFocus),n.addEventListener("blur",this.handleBlur)},this)}getHeader(t){if(this.options.isHeaderHidden)return"";let i=`<th scope="col" class="header-cell">${this.options.firstColumnHeader==null?"":this.options.firstColumnHeader}</th>`;return this.options.isRowCentric?(i+=this.getSourceHeader(t),`<thead>${i}</thead>`):(i+=this.getTargetHeader(t),`<thead>${i}</thead>`)}getTargetHeader(t){let i="";return this.targets.forEach(s=>{i+=`<th scope="col" class="header-cell" style="${t}">${s.innerHTML}</th>`}),i}getSourceHeader(t){let i="";return this.sources.forEach(s=>{i+=`<th scope="col" class="header-cell" style="${t}">${s.innerHTML}</th>`}),i}getBody(t){let i="";return this.options.isRowCentric?(this.targets.forEach(s=>{i+=`<tr><th scope="row" class="row-header-cell">${s.innerHTML}</th>`;const n=s.getAttribute("data-match-max");this.sources.forEach(r=>{const a=r.getAttribute("data-match-max"),o=r.getAttribute("data-identifier"),u=s.getAttribute("data-identifier"),h=`${o} ${u}`;i+=`<td class="table-cell" style="${t}">
168
168
  <div class="control-cell" aria-checked="false" tabindex="0" role="checkbox"
169
169
  data-source-max="${a}" data-target-max="${n}" data-pair="${h}"></div>
170
170
  </td>`}),i+="</tr>"}),`<tbody>${i}</tbody>`):(this.sources.forEach(s=>{i+=`<tr><th scope="row" class="row-header-cell">${s.innerHTML}</th>`;const n=s.getAttribute("data-match-max");this.targets.forEach(r=>{const a=r.getAttribute("data-match-max"),o=s.getAttribute("data-identifier"),u=r.getAttribute("data-identifier"),h=`${o} ${u}`;i+=`<td class="table-cell" style="${t}">