@citolab/qti-components 7.28.0 → 7.28.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/cdn/index.global.js +1 -1
  2. package/cdn/index.js +188 -188
  3. package/custom-elements.json +91 -1
  4. package/dist/base.d.ts +2 -2
  5. package/dist/base.js +5 -1
  6. package/dist/chunk-3WBG257S.js +697 -0
  7. package/dist/chunk-3WBG257S.js.map +1 -0
  8. package/dist/{chunk-Z2SUBRH5.js → chunk-3XV26R5M.js} +6 -1
  9. package/dist/chunk-3XV26R5M.js.map +1 -0
  10. package/dist/{chunk-LQZCSHN5.js → chunk-AQ5RJFM6.js} +2 -2
  11. package/dist/{chunk-N7S3GNUP.js → chunk-FLJAKWXL.js} +2 -2
  12. package/dist/{chunk-PINGOK2F.js → chunk-HFCZFWSH.js} +27 -48
  13. package/dist/chunk-HFCZFWSH.js.map +1 -0
  14. package/dist/{chunk-FK2IVMS3.js → chunk-MPC7LIPC.js} +3 -3
  15. package/dist/{chunk-YLIYPNMK.js → chunk-REI3AMCZ.js} +2 -2
  16. package/dist/{chunk-U2FLSHK7.js → chunk-RLTYVS2I.js} +25 -5
  17. package/dist/chunk-RLTYVS2I.js.map +1 -0
  18. package/dist/{chunk-F6WP6WEF.js → chunk-SP6S2WMG.js} +2 -2
  19. package/dist/{chunk-OQ77SE2W.js → chunk-WDO2TRFM.js} +4 -4
  20. package/dist/elements.js +4 -4
  21. package/dist/index.d.ts +3 -3
  22. package/dist/index.js +14 -10
  23. package/dist/interactions.d.ts +1 -1
  24. package/dist/interactions.js +3 -3
  25. package/dist/item.d.ts +7 -0
  26. package/dist/item.js +4 -4
  27. package/dist/loader.js +2 -2
  28. package/dist/processing.d.ts +2 -2
  29. package/dist/processing.js +2 -2
  30. package/dist/qti-components-jsx.d.ts +178 -151
  31. package/dist/{qti-condition-expression-B1BYmCcq.d.ts → qti-condition-expression-Dam-RER6.d.ts} +1 -1
  32. package/dist/{qti-transform-test-DMx816H0.d.ts → qti-transform-test-DoZaWItm.d.ts} +11 -9
  33. package/dist/qti.context-CejJMlfZ.d.ts +50 -0
  34. package/dist/test.d.ts +5 -3
  35. package/dist/test.js +6 -6
  36. package/dist/transformers.d.ts +1 -1
  37. package/dist/transformers.js +1 -1
  38. package/package.json +6 -6
  39. package/dist/chunk-BPIDAS3T.js +0 -495
  40. package/dist/chunk-BPIDAS3T.js.map +0 -1
  41. package/dist/chunk-PINGOK2F.js.map +0 -1
  42. package/dist/chunk-U2FLSHK7.js.map +0 -1
  43. package/dist/chunk-Z2SUBRH5.js.map +0 -1
  44. package/dist/qti.context-B8PSyIWm.d.ts +0 -14
  45. /package/dist/{chunk-LQZCSHN5.js.map → chunk-AQ5RJFM6.js.map} +0 -0
  46. /package/dist/{chunk-N7S3GNUP.js.map → chunk-FLJAKWXL.js.map} +0 -0
  47. /package/dist/{chunk-FK2IVMS3.js.map → chunk-MPC7LIPC.js.map} +0 -0
  48. /package/dist/{chunk-YLIYPNMK.js.map → chunk-REI3AMCZ.js.map} +0 -0
  49. /package/dist/{chunk-F6WP6WEF.js.map → chunk-SP6S2WMG.js.map} +0 -0
  50. /package/dist/{chunk-OQ77SE2W.js.map → chunk-WDO2TRFM.js.map} +0 -0
package/cdn/index.js CHANGED
@@ -1,12 +1,12 @@
1
- var Cd=Object.defineProperty;var Sd=Object.getOwnPropertyDescriptor;var ba=s=>{throw TypeError(s)};var d=(s,r,e,t)=>{for(var i=t>1?void 0:t?Sd(r,e):r,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=(t?o(r,e,i):o(i))||i);return t&&i&&Cd(r,e,i),i};var _o=(s,r,e)=>r.has(s)||ba("Cannot "+e);var I=(s,r,e)=>(_o(s,r,"read from private field"),e?e.call(s):r.get(s)),L=(s,r,e)=>r.has(s)?ba("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(s):r.set(s,e),U=(s,r,e,t)=>(_o(s,r,"write to private field"),t?t.call(s,e):r.set(s,e),e),P=(s,r,e)=>(_o(s,r,"access private method"),e);var va=class{get shadowRoot(){return this.__host.__shadowRoot}constructor(r){this.ariaActiveDescendantElement=null,this.ariaAtomic="",this.ariaAutoComplete="",this.ariaBrailleLabel="",this.ariaBrailleRoleDescription="",this.ariaBusy="",this.ariaChecked="",this.ariaColCount="",this.ariaColIndex="",this.ariaColIndexText="",this.ariaColSpan="",this.ariaControlsElements=null,this.ariaCurrent="",this.ariaDescribedByElements=null,this.ariaDescription="",this.ariaDetailsElements=null,this.ariaDisabled="",this.ariaErrorMessageElements=null,this.ariaExpanded="",this.ariaFlowToElements=null,this.ariaHasPopup="",this.ariaHidden="",this.ariaInvalid="",this.ariaKeyShortcuts="",this.ariaLabel="",this.ariaLabelledByElements=null,this.ariaLevel="",this.ariaLive="",this.ariaModal="",this.ariaMultiLine="",this.ariaMultiSelectable="",this.ariaOrientation="",this.ariaOwnsElements=null,this.ariaPlaceholder="",this.ariaPosInSet="",this.ariaPressed="",this.ariaReadOnly="",this.ariaRelevant="",this.ariaRequired="",this.ariaRoleDescription="",this.ariaRowCount="",this.ariaRowIndex="",this.ariaRowIndexText="",this.ariaRowSpan="",this.ariaSelected="",this.ariaSetSize="",this.ariaSort="",this.ariaValueMax="",this.ariaValueMin="",this.ariaValueNow="",this.ariaValueText="",this.role="",this.form=null,this.labels=[],this.states=new Set,this.validationMessage="",this.validity={},this.willValidate=!0,this.__host=r}checkValidity(){return console.warn("`ElementInternals.checkValidity()` was called on the server.This method always returns true."),!0}reportValidity(){return!0}setFormValue(){}setValidity(){}};var ke=function(s,r,e,t,i){if(t==="m")throw new TypeError("Private method is not writable");if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof r=="function"?s!==r||!i:!r.has(s))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t==="a"?i.call(s,e):i?i.value=e:r.set(s,e),e},Y=function(s,r,e,t){if(e==="a"&&!t)throw new TypeError("Private accessor was defined without a getter");if(typeof r=="function"?s!==r||!t:!r.has(s))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?t:e==="a"?t.call(s):t?t.value:r.get(s)},Gt,Zi,en,Mr,Lo,_r,tn,St,Lr,Ze,rn,ya,xa=s=>typeof s=="boolean"?s:s?.capture??!1;var $o=class{constructor(){this.__eventListeners=new Map,this.__captureEventListeners=new Map}addEventListener(r,e,t){if(e==null)return;let i=xa(t)?this.__captureEventListeners:this.__eventListeners,n=i.get(r);if(n===void 0)n=new Map,i.set(r,n);else if(n.has(e))return;let o=typeof t=="object"&&t?t:{};o.signal?.addEventListener("abort",()=>this.removeEventListener(r,e,t)),n.set(e,o??{})}removeEventListener(r,e,t){if(e==null)return;let i=xa(t)?this.__captureEventListeners:this.__eventListeners,n=i.get(r);n!==void 0&&(n.delete(e),n.size||i.delete(r))}dispatchEvent(r){let e=[this],t=this.__eventTargetParent;if(r.composed)for(;t;)e.push(t),t=t.__eventTargetParent;else for(;t&&t!==this.__host;)e.push(t),t=t.__eventTargetParent;let i=!1,n=!1,o=0,a=null,l=null,c=null,p=r.stopPropagation,u=r.stopImmediatePropagation;Object.defineProperties(r,{target:{get(){return a??l},...j},srcElement:{get(){return r.target},...j},currentTarget:{get(){return c},...j},eventPhase:{get(){return o},...j},composedPath:{value:()=>e,...j},stopPropagation:{value:()=>{i=!0,p.call(r)},...j},stopImmediatePropagation:{value:()=>{n=!0,u.call(r)},...j}});let m=(h,v,q)=>{typeof h=="function"?h(r):typeof h?.handleEvent=="function"&&h.handleEvent(r),v.once&&q.delete(h)},y=()=>(c=null,o=0,!r.defaultPrevented),b=e.slice().reverse();a=!this.__host||!r.composed?this:null;let w=h=>{for(l=this;l.__host&&h.includes(l.__host);)l=l.__host};for(let h of b){!a&&(!l||l===h.__host)&&w(b.slice(b.indexOf(h))),c=h,o=h===r.target?2:1;let v=h.__captureEventListeners.get(r.type);if(v){for(let[q,A]of v)if(m(q,A,v),n)return y()}if(i)return y()}let f=r.bubbles?e:[this];l=null;for(let h of f){!a&&(!l||h===l.__host)&&w(f.slice(0,f.indexOf(h)+1)),c=h,o=h===r.target?2:3;let v=h.__eventListeners.get(r.type);if(v){for(let[q,A]of v)if(m(q,A,v),n)return y()}if(i)return y()}return y()}},Po=$o;var j={__proto__:null};j.enumerable=!0;Object.freeze(j);var Vo=(Ze=class{constructor(r,e={}){if(Gt.set(this,!1),Zi.set(this,!1),en.set(this,!1),Mr.set(this,!1),Lo.set(this,Date.now()),_r.set(this,!1),tn.set(this,void 0),St.set(this,void 0),Lr.set(this,void 0),this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,arguments.length===0)throw new Error("The type argument must be specified");if(typeof e!="object"||!e)throw new Error('The "options" argument must be an object');let{bubbles:t,cancelable:i,composed:n}=e;ke(this,Gt,!!i,"f"),ke(this,Zi,!!t,"f"),ke(this,en,!!n,"f"),ke(this,tn,`${r}`,"f"),ke(this,St,null,"f"),ke(this,Lr,!1,"f")}initEvent(r,e,t){throw new Error("Method not implemented.")}stopImmediatePropagation(){this.stopPropagation()}preventDefault(){ke(this,Mr,!0,"f")}get target(){return Y(this,St,"f")}get currentTarget(){return Y(this,St,"f")}get srcElement(){return Y(this,St,"f")}get type(){return Y(this,tn,"f")}get cancelable(){return Y(this,Gt,"f")}get defaultPrevented(){return Y(this,Gt,"f")&&Y(this,Mr,"f")}get timeStamp(){return Y(this,Lo,"f")}composedPath(){return Y(this,Lr,"f")?[Y(this,St,"f")]:[]}get returnValue(){return!Y(this,Gt,"f")||!Y(this,Mr,"f")}get bubbles(){return Y(this,Zi,"f")}get composed(){return Y(this,en,"f")}get eventPhase(){return Y(this,Lr,"f")?Ze.AT_TARGET:Ze.NONE}get cancelBubble(){return Y(this,_r,"f")}set cancelBubble(r){r&&ke(this,_r,!0,"f")}stopPropagation(){ke(this,_r,!0,"f")}get isTrusted(){return!1}},Gt=new WeakMap,Zi=new WeakMap,en=new WeakMap,Mr=new WeakMap,Lo=new WeakMap,_r=new WeakMap,tn=new WeakMap,St=new WeakMap,Lr=new WeakMap,Ze.NONE=0,Ze.CAPTURING_PHASE=1,Ze.AT_TARGET=2,Ze.BUBBLING_PHASE=3,Ze);Object.defineProperties(Vo.prototype,{initEvent:j,stopImmediatePropagation:j,preventDefault:j,target:j,currentTarget:j,srcElement:j,type:j,cancelable:j,defaultPrevented:j,timeStamp:j,composedPath:j,returnValue:j,bubbles:j,composed:j,eventPhase:j,cancelBubble:j,stopPropagation:j,isTrusted:j});var qa=(ya=class extends Vo{constructor(r,e={}){super(r,e),rn.set(this,void 0),ke(this,rn,e?.detail??null,"f")}initCustomEvent(r,e,t,i){throw new Error("Method not implemented.")}get detail(){return Y(this,rn,"f")}},rn=new WeakMap,ya);Object.defineProperties(qa.prototype,{detail:j});var Do=Vo,No=qa;var te;var Wp=(te=class{constructor(){this.STYLE_RULE=1,this.CHARSET_RULE=2,this.IMPORT_RULE=3,this.MEDIA_RULE=4,this.FONT_FACE_RULE=5,this.PAGE_RULE=6,this.NAMESPACE_RULE=10,this.KEYFRAMES_RULE=7,this.KEYFRAME_RULE=8,this.SUPPORTS_RULE=12,this.COUNTER_STYLE_RULE=11,this.FONT_FEATURE_VALUES_RULE=14,this.__parentStyleSheet=null,this.cssText=""}get parentRule(){return null}get parentStyleSheet(){return this.__parentStyleSheet}get type(){return 0}},te.STYLE_RULE=1,te.CHARSET_RULE=2,te.IMPORT_RULE=3,te.MEDIA_RULE=4,te.FONT_FACE_RULE=5,te.PAGE_RULE=6,te.NAMESPACE_RULE=10,te.KEYFRAMES_RULE=7,te.KEYFRAME_RULE=8,te.SUPPORTS_RULE=12,te.COUNTER_STYLE_RULE=11,te.FONT_FEATURE_VALUES_RULE=14,te);globalThis.Event??=Do;globalThis.CustomEvent??=No;var wa=new WeakMap,$r=s=>{let r=wa.get(s);return r===void 0&&wa.set(s,r=new Map),r},Ad=class extends Po{constructor(){super(...arguments),this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from($r(this)).map(([r,e])=>({name:r,value:e}))}get shadowRoot(){return this.__shadowRootMode==="closed"?null:this.__shadowRoot}get localName(){return this.constructor.__localName}get tagName(){return this.localName?.toUpperCase()}setAttribute(r,e){$r(this).set(r,String(e))}removeAttribute(r){$r(this).delete(r)}toggleAttribute(r,e){if(this.hasAttribute(r)){if(e===void 0||!e)return this.removeAttribute(r),!1}else return e===void 0||e?(this.setAttribute(r,""),!0):!1;return!0}hasAttribute(r){return $r(this).has(r)}attachShadow(r){let e={host:this};return this.__shadowRootMode=r.mode,r&&r.mode==="open"&&(this.__shadowRoot=e),e}attachInternals(){if(this.__internals!==null)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");let r=new va(this);return this.__internals=r,r}getAttribute(r){return $r(this).get(r)??null}};var Td=class extends Ad{},Ho=Td;globalThis.litServerRoot??=Object.defineProperty(new Ho,"localName",{get(){return"lit-server-root"}});function Id(){let s,r;return{promise:new Promise((t,i)=>{s=t,r=i}),resolve:s,reject:r}}var Oo=class{constructor(){this.__definitions=new Map,this.__reverseDefinitions=new Map,this.__pendingWhenDefineds=new Map}define(r,e){if(this.__definitions.has(r))if(process.env.NODE_ENV==="development")console.warn(`'CustomElementRegistry' already has "${r}" defined. This may have been caused by live reload or hot module replacement in which case it can be safely ignored.
2
- Make sure to test your application with a production build as repeat registrations will throw in production.`);else throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the name "${r}" has already been used with this registry`);if(this.__reverseDefinitions.has(e))throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the constructor has already been used with this registry for the tag name ${this.__reverseDefinitions.get(e)}`);e.__localName=r,this.__definitions.set(r,{ctor:e,observedAttributes:e.observedAttributes??[]}),this.__reverseDefinitions.set(e,r),this.__pendingWhenDefineds.get(r)?.resolve(e),this.__pendingWhenDefineds.delete(r)}get(r){return this.__definitions.get(r)?.ctor}getName(r){return this.__reverseDefinitions.get(r)??null}upgrade(r){throw new Error("customElements.upgrade is not currently supported in SSR. Please file a bug if you need it.")}async whenDefined(r){let e=this.__definitions.get(r);if(e)return e.ctor;let t=this.__pendingWhenDefineds.get(r);return t||(t=Id(),this.__pendingWhenDefineds.set(r,t)),t.promise}},Rd=Oo;var Ea=new Rd;var Pr=globalThis,nn=Pr.ShadowRoot&&(Pr.ShadyCSS===void 0||Pr.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Fo=Symbol(),Ca=new WeakMap,Vr=class{constructor(r,e,t){if(this._$cssResult$=!0,t!==Fo)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=r,this.t=e}get styleSheet(){let r=this.o,e=this.t;if(nn&&r===void 0){let t=e!==void 0&&e.length===1;t&&(r=Ca.get(e)),r===void 0&&((this.o=r=new CSSStyleSheet).replaceSync(this.cssText),t&&Ca.set(e,r))}return r}toString(){return this.cssText}},Sa=s=>new Vr(typeof s=="string"?s:s+"",void 0,Fo),C=(s,...r)=>{let e=s.length===1?s[0]:r.reduce((t,i,n)=>t+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+s[n+1],s[0]);return new Vr(e,s,Fo)},Aa=(s,r)=>{if(nn)s.adoptedStyleSheets=r.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of r){let t=document.createElement("style"),i=Pr.litNonce;i!==void 0&&t.setAttribute("nonce",i),t.textContent=e.cssText,s.appendChild(t)}},Uo=nn||Pr.CSSStyleSheet===void 0?s=>s:s=>s instanceof CSSStyleSheet?(r=>{let e="";for(let t of r.cssRules)e+=t.cssText;return Sa(e)})(s):s;var{is:kd,defineProperty:Md,getOwnPropertyDescriptor:_d,getOwnPropertyNames:Ld,getOwnPropertySymbols:$d,getPrototypeOf:Pd}=Object,Or=globalThis;Or.customElements??=Ea;var Ta=Or.trustedTypes,Vd=Ta?Ta.emptyScript:"",Dd=Or.reactiveElementPolyfillSupport,Dr=(s,r)=>s,Nr={toAttribute(s,r){switch(r){case Boolean:s=s?Vd:null;break;case Object:case Array:s=s==null?s:JSON.stringify(s)}return s},fromAttribute(s,r){let e=s;switch(r){case Boolean:e=s!==null;break;case Number:e=s===null?null:Number(s);break;case Object:case Array:try{e=JSON.parse(s)}catch{e=null}}return e}},on=(s,r)=>!kd(s,r),Ia={attribute:!0,type:String,converter:Nr,reflect:!1,useDefault:!1,hasChanged:on};Symbol.metadata??=Symbol("metadata"),Or.litPropertyMetadata??=new WeakMap;var Fe=class extends(globalThis.HTMLElement??Ho){static addInitializer(r){this._$Ei(),(this.l??=[]).push(r)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(r,e=Ia){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(r)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(r,e),!e.noAccessor){let t=Symbol(),i=this.getPropertyDescriptor(r,t,e);i!==void 0&&Md(this.prototype,r,i)}}static getPropertyDescriptor(r,e,t){let{get:i,set:n}=_d(this.prototype,r)??{get(){return this[e]},set(o){this[e]=o}};return{get:i,set(o){let a=i?.call(this);n?.call(this,o),this.requestUpdate(r,a,t)},configurable:!0,enumerable:!0}}static getPropertyOptions(r){return this.elementProperties.get(r)??Ia}static _$Ei(){if(this.hasOwnProperty(Dr("elementProperties")))return;let r=Pd(this);r.finalize(),r.l!==void 0&&(this.l=[...r.l]),this.elementProperties=new Map(r.elementProperties)}static finalize(){if(this.hasOwnProperty(Dr("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Dr("properties"))){let e=this.properties,t=[...Ld(e),...$d(e)];for(let i of t)this.createProperty(i,e[i])}let r=this[Symbol.metadata];if(r!==null){let e=litPropertyMetadata.get(r);if(e!==void 0)for(let[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let i=this._$Eu(e,t);i!==void 0&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(r){let e=[];if(Array.isArray(r)){let t=new Set(r.flat(1/0).reverse());for(let i of t)e.unshift(Uo(i))}else r!==void 0&&e.push(Uo(r));return e}static _$Eu(r,e){let t=e.attribute;return t===!1?void 0:typeof t=="string"?t:typeof r=="string"?r.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(r=>this.enableUpdating=r),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(r=>r(this))}addController(r){(this._$EO??=new Set).add(r),this.renderRoot!==void 0&&this.isConnected&&r.hostConnected?.()}removeController(r){this._$EO?.delete(r)}_$E_(){let r=new Map,e=this.constructor.elementProperties;for(let t of e.keys())this.hasOwnProperty(t)&&(r.set(t,this[t]),delete this[t]);r.size>0&&(this._$Ep=r)}createRenderRoot(){let r=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Aa(r,this.constructor.elementStyles),r}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(r=>r.hostConnected?.())}enableUpdating(r){}disconnectedCallback(){this._$EO?.forEach(r=>r.hostDisconnected?.())}attributeChangedCallback(r,e,t){this._$AK(r,t)}_$ET(r,e){let t=this.constructor.elementProperties.get(r),i=this.constructor._$Eu(r,t);if(i!==void 0&&t.reflect===!0){let n=(t.converter?.toAttribute!==void 0?t.converter:Nr).toAttribute(e,t.type);this._$Em=r,n==null?this.removeAttribute(i):this.setAttribute(i,n),this._$Em=null}}_$AK(r,e){let t=this.constructor,i=t._$Eh.get(r);if(i!==void 0&&this._$Em!==i){let n=t.getPropertyOptions(i),o=typeof n.converter=="function"?{fromAttribute:n.converter}:n.converter?.fromAttribute!==void 0?n.converter:Nr;this._$Em=i;let a=o.fromAttribute(e,n.type);this[i]=a??this._$Ej?.get(i)??a,this._$Em=null}}requestUpdate(r,e,t,i=!1,n){if(r!==void 0){let o=this.constructor;if(i===!1&&(n=this[r]),t??=o.getPropertyOptions(r),!((t.hasChanged??on)(n,e)||t.useDefault&&t.reflect&&n===this._$Ej?.get(r)&&!this.hasAttribute(o._$Eu(r,t))))return;this.C(r,e,t)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(r,e,{useDefault:t,reflect:i,wrapped:n},o){t&&!(this._$Ej??=new Map).has(r)&&(this._$Ej.set(r,o??e??this[r]),n!==!0||o!==void 0)||(this._$AL.has(r)||(this.hasUpdated||t||(e=void 0),this._$AL.set(r,e)),i===!0&&this._$Em!==r&&(this._$Eq??=new Set).add(r))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let r=this.scheduleUpdate();return r!=null&&await r,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[i,n]of this._$Ep)this[i]=n;this._$Ep=void 0}let t=this.constructor.elementProperties;if(t.size>0)for(let[i,n]of t){let{wrapped:o}=n,a=this[i];o!==!0||this._$AL.has(i)||a===void 0||this.C(i,void 0,n,a)}}let r=!1,e=this._$AL;try{r=this.shouldUpdate(e),r?(this.willUpdate(e),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(e)):this._$EM()}catch(t){throw r=!1,this._$EM(),t}r&&this._$AE(e)}willUpdate(r){}_$AE(r){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(r)),this.updated(r)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(r){return!0}update(r){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(r){}firstUpdated(r){}};Fe.elementStyles=[],Fe.shadowRootOptions={mode:"open"},Fe[Dr("elementProperties")]=new Map,Fe[Dr("finalized")]=new Map,Dd?.({ReactiveElement:Fe}),(Or.reactiveElementVersions??=[]).push("2.1.2");var un=globalThis,Ra=s=>s,sn=un.trustedTypes,ka=sn?sn.createPolicy("lit-html",{createHTML:s=>s}):void 0,zo="$lit$",Ue=`lit$${Math.random().toFixed(9).slice(2)}$`,jo="?"+Ue,Nd=`<${jo}>`,It=un.document===void 0?{createTreeWalker:()=>({})}:document,Fr=()=>It.createComment(""),Ur=s=>s===null||typeof s!="object"&&typeof s!="function",Wo=Array.isArray,Va=s=>Wo(s)||typeof s?.[Symbol.iterator]=="function",Bo=`[
3
- \f\r]`,Hr=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ma=/-->/g,_a=/>/g,At=RegExp(`>|${Bo}(?:([^\\s"'>=/]+)(${Bo}*=${Bo}*(?:[^
4
- \f\r"'\`<>=]|("|')|))|$)`,"g"),La=/'/g,$a=/"/g,Da=/^(?:script|style|textarea|title)$/i,Go=s=>(r,...e)=>({_$litType$:s,strings:r,values:e}),x=Go(1),mn=Go(2),gu=Go(3),re=Symbol.for("lit-noChange"),O=Symbol.for("lit-nothing"),Pa=new WeakMap,Tt=It.createTreeWalker(It,129);function Na(s,r){if(!Wo(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return ka!==void 0?ka.createHTML(r):r}var Oa=(s,r)=>{let e=s.length-1,t=[],i,n=r===2?"<svg>":r===3?"<math>":"",o=Hr;for(let a=0;a<e;a++){let l=s[a],c,p,u=-1,m=0;for(;m<l.length&&(o.lastIndex=m,p=o.exec(l),p!==null);)m=o.lastIndex,o===Hr?p[1]==="!--"?o=Ma:p[1]!==void 0?o=_a:p[2]!==void 0?(Da.test(p[2])&&(i=RegExp("</"+p[2],"g")),o=At):p[3]!==void 0&&(o=At):o===At?p[0]===">"?(o=i??Hr,u=-1):p[1]===void 0?u=-2:(u=o.lastIndex-p[2].length,c=p[1],o=p[3]===void 0?At:p[3]==='"'?$a:La):o===$a||o===La?o=At:o===Ma||o===_a?o=Hr:(o=At,i=void 0);let y=o===At&&s[a+1].startsWith("/>")?" ":"";n+=o===Hr?l+Nd:u>=0?(t.push(c),l.slice(0,u)+zo+l.slice(u)+Ue+y):l+Ue+(u===-2?a:y)}return[Na(s,n+(s[e]||"<?>")+(r===2?"</svg>":r===3?"</math>":"")),t]},Br=class s{constructor({strings:r,_$litType$:e},t){let i;this.parts=[];let n=0,o=0,a=r.length-1,l=this.parts,[c,p]=Oa(r,e);if(this.el=s.createElement(c,t),Tt.currentNode=this.el.content,e===2||e===3){let u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(i=Tt.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let u of i.getAttributeNames())if(u.endsWith(zo)){let m=p[o++],y=i.getAttribute(u).split(Ue),b=/([.?@])?(.*)/.exec(m);l.push({type:1,index:n,name:b[2],strings:y,ctor:b[1]==="."?ln:b[1]==="?"?cn:b[1]==="@"?dn:kt}),i.removeAttribute(u)}else u.startsWith(Ue)&&(l.push({type:6,index:n}),i.removeAttribute(u));if(Da.test(i.tagName)){let u=i.textContent.split(Ue),m=u.length-1;if(m>0){i.textContent=sn?sn.emptyScript:"";for(let y=0;y<m;y++)i.append(u[y],Fr()),Tt.nextNode(),l.push({type:2,index:++n});i.append(u[m],Fr())}}}else if(i.nodeType===8)if(i.data===jo)l.push({type:2,index:n});else{let u=-1;for(;(u=i.data.indexOf(Ue,u+1))!==-1;)l.push({type:7,index:n}),u+=Ue.length-1}n++}}static createElement(r,e){let t=It.createElement("template");return t.innerHTML=r,t}};function Rt(s,r,e=s,t){if(r===re)return r;let i=t!==void 0?e._$Co?.[t]:e._$Cl,n=Ur(r)?void 0:r._$litDirective$;return i?.constructor!==n&&(i?._$AO?.(!1),n===void 0?i=void 0:(i=new n(s),i._$AT(s,e,t)),t!==void 0?(e._$Co??=[])[t]=i:e._$Cl=i),i!==void 0&&(r=Rt(s,i._$AS(s,r.values),i,t)),r}var an=class{constructor(r,e){this._$AV=[],this._$AN=void 0,this._$AD=r,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(r){let{el:{content:e},parts:t}=this._$AD,i=(r?.creationScope??It).importNode(e,!0);Tt.currentNode=i;let n=Tt.nextNode(),o=0,a=0,l=t[0];for(;l!==void 0;){if(o===l.index){let c;l.type===2?c=new Xt(n,n.nextSibling,this,r):l.type===1?c=new l.ctor(n,l.name,l.strings,this,r):l.type===6&&(c=new pn(n,this,r)),this._$AV.push(c),l=t[++a]}o!==l?.index&&(n=Tt.nextNode(),o++)}return Tt.currentNode=It,i}p(r){let e=0;for(let t of this._$AV)t!==void 0&&(t.strings!==void 0?(t._$AI(r,t,e),e+=t.strings.length-2):t._$AI(r[e])),e++}},Xt=class s{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(r,e,t,i){this.type=2,this._$AH=O,this._$AN=void 0,this._$AA=r,this._$AB=e,this._$AM=t,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let r=this._$AA.parentNode,e=this._$AM;return e!==void 0&&r?.nodeType===11&&(r=e.parentNode),r}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(r,e=this){r=Rt(this,r,e),Ur(r)?r===O||r==null||r===""?(this._$AH!==O&&this._$AR(),this._$AH=O):r!==this._$AH&&r!==re&&this._(r):r._$litType$!==void 0?this.$(r):r.nodeType!==void 0?this.T(r):Va(r)?this.k(r):this._(r)}O(r){return this._$AA.parentNode.insertBefore(r,this._$AB)}T(r){this._$AH!==r&&(this._$AR(),this._$AH=this.O(r))}_(r){this._$AH!==O&&Ur(this._$AH)?this._$AA.nextSibling.data=r:this.T(It.createTextNode(r)),this._$AH=r}$(r){let{values:e,_$litType$:t}=r,i=typeof t=="number"?this._$AC(r):(t.el===void 0&&(t.el=Br.createElement(Na(t.h,t.h[0]),this.options)),t);if(this._$AH?._$AD===i)this._$AH.p(e);else{let n=new an(i,this),o=n.u(this.options);n.p(e),this.T(o),this._$AH=n}}_$AC(r){let e=Pa.get(r.strings);return e===void 0&&Pa.set(r.strings,e=new Br(r)),e}k(r){Wo(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,t,i=0;for(let n of r)i===e.length?e.push(t=new s(this.O(Fr()),this.O(Fr()),this,this.options)):t=e[i],t._$AI(n),i++;i<e.length&&(this._$AR(t&&t._$AB.nextSibling,i),e.length=i)}_$AR(r=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);r!==this._$AB;){let t=Ra(r).nextSibling;Ra(r).remove(),r=t}}setConnected(r){this._$AM===void 0&&(this._$Cv=r,this._$AP?.(r))}},kt=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(r,e,t,i,n){this.type=1,this._$AH=O,this._$AN=void 0,this.element=r,this.name=e,this._$AM=i,this.options=n,t.length>2||t[0]!==""||t[1]!==""?(this._$AH=Array(t.length-1).fill(new String),this.strings=t):this._$AH=O}_$AI(r,e=this,t,i){let n=this.strings,o=!1;if(n===void 0)r=Rt(this,r,e,0),o=!Ur(r)||r!==this._$AH&&r!==re,o&&(this._$AH=r);else{let a=r,l,c;for(r=n[0],l=0;l<n.length-1;l++)c=Rt(this,a[t+l],e,l),c===re&&(c=this._$AH[l]),o||=!Ur(c)||c!==this._$AH[l],c===O?r=O:r!==O&&(r+=(c??"")+n[l+1]),this._$AH[l]=c}o&&!i&&this.j(r)}j(r){r===O?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,r??"")}},ln=class extends kt{constructor(){super(...arguments),this.type=3}j(r){this.element[this.name]=r===O?void 0:r}},cn=class extends kt{constructor(){super(...arguments),this.type=4}j(r){this.element.toggleAttribute(this.name,!!r&&r!==O)}},dn=class extends kt{constructor(r,e,t,i,n){super(r,e,t,i,n),this.type=5}_$AI(r,e=this){if((r=Rt(this,r,e,0)??O)===re)return;let t=this._$AH,i=r===O&&t!==O||r.capture!==t.capture||r.once!==t.once||r.passive!==t.passive,n=r!==O&&(t===O||i);i&&this.element.removeEventListener(this.name,this,t),n&&this.element.addEventListener(this.name,this,r),this._$AH=r}handleEvent(r){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,r):this._$AH.handleEvent(r)}},pn=class{constructor(r,e,t){this.element=r,this.type=6,this._$AN=void 0,this._$AM=e,this.options=t}get _$AU(){return this._$AM._$AU}_$AI(r){Rt(this,r)}},Ha={M:zo,P:Ue,A:jo,C:1,L:Oa,R:an,D:Va,V:Rt,I:Xt,H:kt,N:cn,U:dn,B:ln,F:pn},Od=un.litHtmlPolyfillSupport;Od?.(Br,Xt),(un.litHtmlVersions??=[]).push("3.3.2");var Fa=(s,r,e)=>{let t=e?.renderBefore??r,i=t._$litPart$;if(i===void 0){let n=e?.renderBefore??null;t._$litPart$=i=new Xt(r.insertBefore(Fr(),n),n,void 0,e??{})}return i._$AI(s),i};var Xo=globalThis,E=class extends Fe{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let r=super.createRenderRoot();return this.renderOptions.renderBefore??=r.firstChild,r}update(r){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(r),this._$Do=Fa(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return re}};E._$litElement$=!0,E.finalized=!0,Xo.litElementHydrateSupport?.({LitElement:E});var Hd=Xo.litElementPolyfillSupport;Hd?.({LitElement:E});(Xo.litElementVersions??=[]).push("4.2.2");var k=s=>(r,e)=>{e!==void 0?e.addInitializer(()=>{customElements.define(s,r)}):customElements.define(s,r)};var Fd={attribute:!0,type:String,converter:Nr,reflect:!1,hasChanged:on},Ud=(s=Fd,r,e)=>{let{kind:t,metadata:i}=e,n=globalThis.litPropertyMetadata.get(i);if(n===void 0&&globalThis.litPropertyMetadata.set(i,n=new Map),t==="setter"&&((s=Object.create(s)).wrapped=!0),n.set(e.name,s),t==="accessor"){let{name:o}=e;return{set(a){let l=r.get.call(this);r.set.call(this,a),this.requestUpdate(o,l,s,!0,a)},init(a){return a!==void 0&&this.C(o,void 0,s,a),a}}}if(t==="setter"){let{name:o}=e;return function(a){let l=this[o];r.call(this,a),this.requestUpdate(o,l,s,!0,a)}}throw Error("Unsupported decorator location: "+t)};function g(s){return(r,e)=>typeof e=="object"?Ud(s,r,e):((t,i,n)=>{let o=i.hasOwnProperty(n);return i.constructor.createProperty(n,t),o?Object.getOwnPropertyDescriptor(i,n):void 0})(s,r,e)}function M(s){return g({...s,state:!0,attribute:!1})}var et=(s,r,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof r!="object"&&Object.defineProperty(s,r,e),e);function Qt(s,r){return(e,t,i)=>{let n=o=>o.renderRoot?.querySelector(s)??null;if(r){let{get:o,set:a}=typeof t=="object"?e:i??(()=>{let l=Symbol();return{get(){return this[l]},set(c){this[l]=c}}})();return et(e,t,{get(){let l=o.call(this);return l===void 0&&(l=n(this),(l!==null||this.hasUpdated)&&a.call(this,l)),l}})}return et(e,t,{get(){return n(this)}})}}function Ua(s){return(r,e)=>{let{slot:t,selector:i}=s??{},n="slot"+(t?`[name=${t}]`:":not([name])");return et(r,e,{get(){let o=this.renderRoot?.querySelector(n),a=o?.assignedElements(s)??[];return i===void 0?a:a.filter(l=>l.matches(i))}})}}function Ba(s,r,e){Array.from(s.getElementsByTagName("*")).filter(n=>n.localName===r||n.localName?.toLowerCase()===r.toLowerCase()).forEach(n=>{let o=`${r}-${e}`,a=ja(n,o);n.replaceWith(a)})}function za(s,r){s.querySelectorAll("*").forEach(e=>{let t=e.classList;t&&t.forEach(i=>{if(i.startsWith(`${r}:`)){let n=i.slice(`${r}:`.length),o=`${e.nodeName}-${n}`,a=ja(e,o);e.replaceWith(a)}})})}function ja(s,r){let e=s.ownerDocument.createElement(r);for(let t of s.attributes)e.setAttribute(t.name,t.value);for(;s.firstChild;)e.appendChild(s.firstChild);return e}function Wa(s){let r=[];return s.querySelectorAll("qti-assessment-item-ref").forEach(e=>{let t=e.getAttribute("identifier"),i=e.getAttribute("href"),n=e.getAttribute("category");r.push({identifier:t,href:i,category:n})}),r}function Yt(s,r){return fetch(s,{signal:r}).then(e=>{if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return e.text()}).then(e=>new DOMParser().parseFromString(e,"text/xml")).catch(e=>{throw e.name==="AbortError"?e:new Error(`Failed to load XML: ${e.message}`)})}function Jt(s){return new DOMParser().parseFromString(s,"text/xml")}function Ga(s,r){if(s.nodeType===Node.ELEMENT_NODE){let e=s,t;!e.namespaceURI||e.namespaceURI.startsWith("http://www.imsglobal.org/xsd/qti/")||e.namespaceURI.startsWith("http://www.imsglobal.org/xsd/imsqti")?t=r.createElement(e.localName):t=r.createElementNS(e.namespaceURI,e.tagName);for(let i=0;i<e.attributes.length;i++){let n=e.attributes[i];t.setAttribute(n.localName,n.value)}for(let i=0;i<e.childNodes.length;i++)t.appendChild(Ga(e.childNodes[i],r));return t}return s.cloneNode(!1)}function Kt(s){let r=document.createDocumentFragment();for(let e=0;e<s.childNodes.length;e++)r.appendChild(Ga(s.childNodes[e],document));return r}function Zt(s,r){r.endsWith("/")||(r+="/"),s.querySelectorAll("*").forEach(t=>{for(let i of["src","href","srcset","poster"]){let n=t.getAttribute(i)?.trim();if(n&&!/^(data:|https?:|blob:)/.test(n)){let o=r+encodeURI(n);t.setAttribute(i,o)}}})}function Xa(s){s.querySelectorAll('qti-custom-operator[class="js.org"] > qti-base-value').forEach(e=>{let t=document.createComment(e.textContent);e.replaceChild(t,e.firstChild)})}function Qa(s){s.querySelectorAll("qti-stylesheet").forEach(r=>r.remove())}function Ya(s){switch(s){case"qti-choice-interaction":case"qti-order-interaction":return"qti-simple-choice";case"qti-inline-choice-interaction":return"qti-inline-choice";case"qti-match-interaction":return["qti-simple-match-set:first-of-type qti-simple-associable-choice","qti-simple-match-set:last-of-type > qti-simple-associable-choice"];case"qti-gap-match-interaction":return"qti-gap-text";case"qti-associate-interaction":return"qti-simple-associable-choice";default:return null}}var Me=(s=!1)=>{let r,e="",t={load(i,n){let{signal:o,shuffle:a=!0}=n instanceof AbortSignal?{signal:n,shuffle:!0}:n??{};e=i;let l=encodeURI(i);return s&&sessionStorage.getItem(l)?Promise.resolve(t.parse(sessionStorage.getItem(l))):Yt(i,o).then(c=>(r=c,a&&t.shuffleInteractions(),s&&sessionStorage.setItem(l,new XMLSerializer().serializeToString(r)),t))},parse(i){return r=Jt(i),t},path:i=>(Zt(r,i),e=null,t),fn(i){return i(r),t},pciHooks(i){let n=["hook","module"],o=i.substring(0,i.lastIndexOf("/"));for(let a of n)r.querySelectorAll("["+a+"]").forEach(c=>{let p=c.getAttribute(a);!p.startsWith("data:")&&!p.startsWith("http")&&(c.setAttribute("base-url",i),c.setAttribute("module",o+"/"+encodeURI(p+(p.endsWith(".js")?"":".js"))))});return t},async configurePci(i,n,o="qti-portable-custom-interaction"){let a=[],l=r.querySelectorAll(o);if(l.length===0)return t;let c=null,p=null,u=async()=>{if(c===null)try{c=await n(i,"/modules/module_resolution.js")}catch{c=null}if(p===null)try{p=await n(i,"/modules/fallback_module_resolution.js")}catch{p=null}};for(let m of Array.from(l)){m.setAttribute("data-base-url",i);let y=m.getAttribute("custom-interaction-type-identifier");y&&a.includes(y)&&(y=y+a.length,m.setAttribute("custom-interaction-type-identifier",y),a.push(y)),y&&a.push(y);let b=m.querySelector("qti-interaction-modules");if(b&&b.getAttribute("primary-configuration")){await u();let w=b.getAttribute("primary-configuration");if(w)try{let f=await n(i,`/${w}`),h=Array.from(b.querySelectorAll("qti-interaction-module"));for(let v of h){let q=v.getAttribute("id");if(q&&f.paths&&f.paths[q]){let A=f.paths[q],S=Array.isArray(A)?A[0]:A;if(v.setAttribute("primary-path",S),p&&p.paths&&p.paths[q]){let T=p.paths[q];Array.isArray(T)?v.setAttribute("fallback-path",T[0]):v.setAttribute("fallback-path",T)}}}if(f.paths){for(let v in f.paths)if(!b.querySelector(`qti-interaction-module[id="${v}"]`)){let A=r.createElement("qti-interaction-module");A.setAttribute("id",v);let S=Array.isArray(f.paths[v])?f.paths[v][0]:f.paths[v];if(A.setAttribute("primary-path",S),p&&p.paths&&p.paths[v]){let T=p.paths[v];Array.isArray(T)?A.setAttribute("fallback-path",T[0]):A.setAttribute("fallback-path",T)}b.appendChild(A)}}f.urlArgs&&b.setAttribute("url-args",f.urlArgs)}catch(f){console.warn(`Failed to load primary configuration: ${w}`,f)}}else if(await u(),c){m.querySelector("qti-interaction-modules")===null?(b=r.createElement("qti-interaction-modules"),m.appendChild(b)):b=m.querySelector("qti-interaction-modules");for(let w in c.paths){let f=c.paths[w],h="";p&&p.paths&&p.paths[w]&&(h=p.paths[w]);let v=Array.isArray(f)?f:[f],q=Array.isArray(h)?h:[h],A=v.map((S,T)=>{let _=q.length>T?q[T]:"";return{primaryPath:S,fallbackPath:_}});for(let S of q)A.some(T=>T.fallbackPath===S)||A.push({primaryPath:v.length>0?v[0]:S,fallbackPath:S});for(let S of A){let T=r.createElement("qti-interaction-module");S.fallbackPath&&T.setAttribute("fallback-path",S.fallbackPath),T.setAttribute("id",w),T.setAttribute("primary-path",S.primaryPath),b&&b.appendChild(T)}}}}return t},shuffleInteractions(){let i=r.querySelectorAll('[shuffle="true"]'),n=Array.from(i).filter(o=>o.tagName?.toLowerCase().endsWith("-interaction"));for(let o of n){let a=Ya(o.tagName.toLowerCase()),l=Array.isArray(a)?a:[a];for(let c of l){let p=Array.from(o.querySelectorAll(c)),u=p.map((b,w)=>({element:b,fixed:b.hasAttribute("fixed")&&b.getAttribute("fixed")==="true",originalOrder:w})).filter(b=>b.fixed),m=p.filter(b=>!b.hasAttribute("fixed")||b.getAttribute("fixed")!=="true");if(m.length<=1)return console.warn("Shuffling is not possible with fewer than 2 non-fixed elements."),t;for(let b=m.length-1;b>0;b--){let w=Math.floor(Math.random()*b);[m[b],m[w]]=[m[w],m[b]]}o.removeAttribute("shuffle");let y=0;for(let b of m)b.parentElement.insertBefore(b,u[y]?.element),y++;for(let b of u)b.element.parentElement.insertBefore(b.element,m[b.originalOrder])}}return t},extendElementName:(i,n)=>(Ba(r,i,n),t),extendElementsWithClass:(i="extend")=>(za(r,i),t),customInteraction(i,n){let o=r.querySelector("qti-custom-interaction"),a=o.querySelector("object");return o.setAttribute("data-base-ref",i),o.setAttribute("data-base-item",i+n),o.setAttribute("data",a.getAttribute("data")),o.setAttribute("width",a.getAttribute("width")),o.setAttribute("height",a.getAttribute("height")),o.removeChild(a),t},convertCDATAtoComment(){return Xa(r),t},stripStyleSheets(){return Qa(r),t},html(){return e!==null&&Zt(r,e.substring(0,e.lastIndexOf("/"))),new XMLSerializer().serializeToString(Kt(r))},xml(){return new XMLSerializer().serializeToString(r)},htmlDoc(){return e!==null&&Zt(r,e.substring(0,e.lastIndexOf("/"))),Kt(r)},xmlDoc(){return r}};return t};var Ja=()=>{let s,r={async load(e,t){return new Promise(i=>{Yt(e,t).then(n=>(s=n,i(r)))})},parse(e){s=Jt(e)},assessmentTest(){let e=s.querySelector('resource[type="imsqti_test_xmlv3p0"]');return{href:e.getAttribute("href"),identifier:e.getAttribute("identifier")}}};return r};var er=()=>{let s,r={async load(e,t){return new Promise((i,n)=>{Yt(e,t).then(o=>(s=o,r.path(e.substring(0,e.lastIndexOf("/"))),i(r)))})},parse(e){return s=Jt(e),r},path:e=>(Zt(s,e),r),fn(e){return e(s),r},items(){return Wa(s)},html(){return new XMLSerializer().serializeToString(Kt(s))},xml(){return new XMLSerializer().serializeToString(s)},htmlDoc(){return Kt(s)},xmlDoc(){return s}};return r};var Ka=s=>{class r extends s{constructor(...i){super(...i);this.navigate=null;this.cacheTransform=!1;this.requestTimeout=3e4;this.postLoadTransformCallback=null;this.postLoadTestTransformCallback=null;this._activeController=null;this._loadResults=[];this._navigationId=0;this._loadingState={expectedItems:0,connectedItems:0,expectedStimulus:0,loadedStimulus:0,isComplete:!1};this._loadedStimulusHrefs=new Set;this._loadingStimulusHrefs=new Set;this._bindEventHandlers()}navigateTo(i,n){let o=n||this._getDefaultNavigationId(i);o&&this.dispatchEvent(new CustomEvent("qti-request-navigation",{detail:{type:i,id:o},bubbles:!0,composed:!0}))}_bindEventHandlers(){this.addEventListener("qti-request-navigation",this._handleNavigationRequest.bind(this)),this.addEventListener("qti-assessment-test-connected",this._handleTestConnected.bind(this)),this.addEventListener("qti-assessment-item-connected",this._handleItemConnected.bind(this)),this.addEventListener("qti-assessment-stimulus-ref-connected",this._handleStimulusRefConnected.bind(this))}_handleTestConnected(i){this._testElement=i.detail,this._initializeNavigation()}_handleItemConnected(i){let n=i.detail;this._loadingState.connectedItems++;let o=n.querySelectorAll("qti-assessment-stimulus-ref");this._loadingState.expectedStimulus+=o.length,this._checkLoadingComplete()}async _handleStimulusRefConnected(i){i.preventDefault();let{element:n,item:o}=i;if(console.info("Stimulus ref connected:",{identifier:n.identifier,href:n.href,item:o.identifier}),this._loadedStimulusHrefs.has(n.href)){console.info("Stimulus already loaded, skipping:",n.href),this._loadingState.loadedStimulus++,this._checkLoadingComplete();return}if(this._loadingStimulusHrefs.has(n.href)){console.info("Stimulus already loading, skipping duplicate:",n.href),this._loadingState.loadedStimulus++,this._checkLoadingComplete();return}this._loadingStimulusHrefs.add(n.href),console.info("Starting stimulus load:",n.href);try{await this._loadStimulusRef(n,o),this._loadedStimulusHrefs.add(n.href),this._loadingState.loadedStimulus++,console.info("Stimulus loaded successfully:",n.href),this._checkLoadingComplete()}catch(a){a.name!=="AbortError"&&console.warn(`Failed to load stimulus ${n.identifier}:`,a),this._loadingState.loadedStimulus++,this._checkLoadingComplete()}finally{this._loadingStimulusHrefs.delete(n.href)}}_getDefaultNavigationId(i){return i==="section"?this._testElement?.querySelector("qti-assessment-section")?.identifier:this.sessionContext?.navItemRefId??this._testElement?.querySelector("qti-assessment-item-ref")?.identifier}_initializeNavigation(){if(!this.navigate)return;let i=this._getDefaultNavigationId(this.navigate);i&&this.navigateTo(this.navigate,i)}async _handleNavigationRequest({detail:i}){if(!i?.id)return;this._cancelPreviousNavigation();let n=++this._navigationId,o=new AbortController;try{this._dispatchLoadingStarted(i.type,i.id),this._activeController=o,await this._executeNavigation(i.type,i.id,n,o)}catch(a){this._handleNavigationError(a,i.type,i.id)}finally{this._activeController===o&&(this._activeController=null),this._dispatchLoadingEnded(i.type,i.id)}}_handleNavigationError(i,n,o){i.name!=="AbortError"&&this._dispatchError(this._createNavigationError(i,n,o))}async _executeNavigation(i,n,o,a){i==="item"?await this._navigateToItem(n,o,a):await this._navigateToSection(n,o,a)}async _navigateToItem(i,n,o){let a=this._findItemRef(i);this._updateSessionContext(a,i),this._resetLoadingState(),this._loadingState.expectedItems=1,await this._loadItems([i],n,o),await this._waitForLoadingComplete(n,o),!this._isStaleNavigation(n,o)&&this._dispatchTestLoaded(this._loadResults)}async _navigateToSection(i,n,o){let l=this._findSection(i)?.closest("qti-test-part")?.identifier;this.sessionContext={...this.sessionContext,navPartId:l,navSectionId:i,navItemRefId:null};let c=this._getSectionItemIds(i);this._resetLoadingState(),this._loadingState.expectedItems=c.length,await this._loadItems(c,n,o),await this._waitForLoadingComplete(n,o),!this._isStaleNavigation(n,o)&&this._dispatchTestLoaded(this._loadResults)}_resetLoadingState(){this._loadingState={expectedItems:0,connectedItems:0,expectedStimulus:0,loadedStimulus:0,isComplete:!1},this._loadedStimulusHrefs.clear(),this._loadingStimulusHrefs.clear()}_checkLoadingComplete(){let i=this._loadingState.connectedItems>=this._loadingState.expectedItems,n=this._loadingState.loadedStimulus>=this._loadingState.expectedStimulus;i&&n&&!this._loadingState.isComplete&&(this._loadingState.isComplete=!0)}async _waitForLoadingComplete(i,n){for(;!this._loadingState.isComplete;){if(this._isStaleNavigation(i,n))return;await new Promise(o=>setTimeout(o,10))}}getLoadingProgress(){return{...this._loadingState}}async _loadStimulusRef(i,n){console.info("Loading stimulus:",i.href);let o=await this._loadStimulus(i.href);console.info("Stimulus loaded, applying content:",o?"has content":"no content"),this._applyStimulusContent(o,i,n)}_applyStimulusContent(i,n,o){if(!i){console.warn("No stimulus content to apply");return}let a=i.querySelectorAll("qti-stimulus-body, qti-stylesheet");if(console.info(`Found ${a.length} stimulus elements to apply for ${n.identifier}`),a.length===0){console.warn("No qti-stimulus-body or qti-stylesheet elements found in stimulus");return}let l=[],c=o.querySelector(`[data-stimulus-idref="${n.identifier}"]`);if(c)l.push(c),console.info("Found specific target:",c);else{let p=Array.from(this.querySelectorAll(`[data-stimulus-idref="${n.identifier}"]`));if(p.length>0)l=p,console.info("Found targets by identifier:",p.length);else{let u=Array.from(this.querySelectorAll("[data-stimulus-idref]"));l=u,console.info("Using fallback targets:",u.length)}}if(l.length===0){console.warn("No targets found for stimulus content");return}l.forEach((p,u)=>{p.innerHTML="";let m=Array.from(a).map(y=>y.cloneNode(!0));p.append(...m),console.info(`Applied stimulus content to target ${u+1}/${l.length}`)})}_cancelPreviousNavigation(){this._activeController&&(this._activeController.abort(),console.info("Previous navigation request cancelled")),this._clearNavigationState()}_clearNavigationState(){this._clearLoadedItems(),this._resetLoadingState(),this._loadResults=[]}async _loadItems(i,n,o){if(!this._testElement||i.length===0)return;let a=i.map(p=>this._findItemRef(p));this._clearLoadedItems(),this._clearStimulusRef();let c=(await Promise.all(a.map(p=>this._loadSingleItem(p,n,o)))).filter(Boolean);this._isStaleNavigation(n,o)||(c.forEach(({itemRef:p,doc:u})=>{p&&u&&(p.xmlDoc=u)}),c.forEach(({itemRef:p})=>{let u=p?.identifier;if(!p||!u)return;let m=this.testContext.items.find(y=>y.identifier===u)?.state;m!==void 0&&p.updateComplete.then(()=>{let y=p.assessmentItem;y&&(y.state=m)})}),this._loadResults=c)}async _loadSingleItem(i,n,o){try{let a=await Me(this.cacheTransform).load(i.href,o.signal);return this.postLoadTransformCallback&&(a=await this.postLoadTransformCallback(a,i)),this._isStaleNavigation(n,o)?null:{itemRef:i,doc:a.htmlDoc()}}catch(a){if(a.name==="AbortError")throw console.info(`Item load for ${i.identifier} was aborted`),a;return console.warn(`Failed to load item ${i.identifier}:`,a),null}}async _loadStimulus(i){return(await Me().load(i,this._activeController?.signal)).htmlDoc()}_findItemRef(i){let n=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${i}"]`);if(!n)throw new Error(`Item with identifier "${i}" not found`);return n}_findSection(i){return this._testElement?.querySelector(`qti-assessment-section[identifier="${i}"]`)||null}_updateSessionContext(i,n){let o=i.closest("qti-test-part")?.identifier,a=i.closest("qti-assessment-section")?.identifier;this.sessionContext={...this.sessionContext,navPartId:o,navSectionId:a,navItemRefId:n}}_getSectionItemIds(i){return Array.from(this._testElement.querySelectorAll(`qti-assessment-section[identifier="${i}"] > qti-assessment-item-ref`)).map(n=>n.identifier).filter(Boolean)}_clearLoadedItems(){let i=this._testElement?.querySelectorAll("qti-assessment-item-ref");Array.from(i||[]).forEach(n=>{n.xmlDoc=null})}_clearStimulusRef(){this.querySelectorAll("[data-stimulus-idref]").forEach(i=>i.innerHTML="")}_isStaleNavigation(i,n){return n.signal.aborted||i!==this._navigationId}_createNavigationError(i,n,o){return{message:i.message||`Failed to load ${n}: ${o}`,details:i,itemId:n==="item"?o:void 0,sectionId:n==="section"?o:void 0}}_dispatchLoadingStarted(i,n){this.dispatchEvent(new CustomEvent("qti-navigation-loading-started",{detail:{type:i,id:n},bubbles:!0,composed:!0}))}_dispatchLoadingEnded(i,n){this.dispatchEvent(new CustomEvent("qti-navigation-loading-ended",{detail:{type:i,id:n},bubbles:!0,composed:!0}))}_dispatchError(i){this.dispatchEvent(new CustomEvent("qti-navigation-error",{detail:i,bubbles:!0,composed:!0}))}_dispatchTestLoaded(i){requestAnimationFrame(()=>{this.dispatchEvent(new CustomEvent("qti-test-loaded",{detail:i.map(({itemRef:n})=>({identifier:n?.identifier,element:n})),bubbles:!0,composed:!0}))})}}return d([g({type:String})],r.prototype,"navigate",2),d([g({type:Boolean,attribute:"cache-transform"})],r.prototype,"cacheTransform",2),d([g({type:Number})],r.prototype,"requestTimeout",2),d([g({attribute:!1})],r.prototype,"postLoadTransformCallback",2),d([g({attribute:!1})],r.prototype,"postLoadTestTransformCallback",2),r};var Za=s=>{class r extends s{constructor(...t){super(...t),this.sessionContext={...this.sessionContext,view:"candidate"},this.addEventListener("on-test-switch-view",i=>{this.sessionContext={...this.sessionContext,view:i.detail},this._updateElementView()}),this.addEventListener("qti-assessment-test-connected",()=>{this._updateElementView()}),this.addEventListener("qti-assessment-item-connected",i=>{this._updateElementView(),this._setCorrectResponseVisibility(i.detail)})}willUpdate(t){super.willUpdate(t),t.has("sessionContext")&&this._updateElementView()}_updateElementView(){if(this._testElement){Array.from(this._testElement.querySelectorAll("[view]")).forEach(o=>{o.classList.toggle("show",o.getAttribute("view")===this.sessionContext.view)});let n=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${this.sessionContext.navItemRefId}"]`)?.assessmentItem;n&&n.showCorrectResponse(this.sessionContext.view==="scorer")}}_setCorrectResponseVisibility(t){t.showCorrectResponse(this.sessionContext.view==="scorer")}}return r};var tt=class extends Event{constructor(r,e,t,i){super("context-request",{bubbles:!0,composed:!0}),this.context=r,this.contextTarget=e,this.callback=t,this.subscribe=i??!1}};var tr=class{constructor(r,e,t,i){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(n,o)=>{this.unsubscribe&&(this.unsubscribe!==o&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=n,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(n,o)),this.unsubscribe=o},this.host=r,e.context!==void 0){let n=e;this.context=n.context,this.callback=n.callback,this.subscribe=n.subscribe??!1}else this.context=e,this.callback=t,this.subscribe=i??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new tt(this.context,this.host,this.t,this.subscribe))}};var hn=class{get value(){return this.o}set value(r){this.setValue(r)}setValue(r,e=!1){let t=e||!Object.is(r,this.o);this.o=r,t&&this.updateObservers()}constructor(r){this.subscriptions=new Map,this.updateObservers=()=>{for(let[e,{disposer:t}]of this.subscriptions)e(this.o,t)},r!==void 0&&(this.value=r)}addCallback(r,e,t){if(!t)return void r(this.value);this.subscriptions.has(r)||this.subscriptions.set(r,{disposer:()=>{this.subscriptions.delete(r)},consumerHost:e});let{disposer:i}=this.subscriptions.get(r);r(this.value,i)}clearCallbacks(){this.subscriptions.clear()}};var Qo=class extends Event{constructor(r,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=r,this.contextTarget=e}},rr=class extends hn{constructor(r,e,t){super(e.context!==void 0?e.initialValue:t),this.onContextRequest=i=>{if(i.context!==this.context)return;let n=i.contextTarget??i.composedPath()[0];n!==this.host&&(i.stopPropagation(),this.addCallback(i.callback,n,i.subscribe))},this.onProviderRequest=i=>{if(i.context!==this.context||(i.contextTarget??i.composedPath()[0])===this.host)return;let n=new Set;for(let[o,{consumerHost:a}]of this.subscriptions)n.has(o)||(n.add(o),a.dispatchEvent(new tt(this.context,a,o,!0)));i.stopPropagation()},this.host=r,e.context!==void 0?this.context=e.context:this.context=e,this.attachListeners(),this.host.addController?.(this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new Qo(this.context,this.host))}};function ce({context:s}){return(r,e)=>{let t=new WeakMap;if(typeof e=="object")return{get(){return r.get.call(this)},set(i){return t.get(this).setValue(i),r.set.call(this,i)},init(i){return t.set(this,new rr(this,{context:s,initialValue:i})),i}};{r.constructor.addInitializer((o=>{t.set(o,new rr(o,{context:s}))}));let i=Object.getOwnPropertyDescriptor(r,e),n;if(i===void 0){let o=new WeakMap;n={get(){return o.get(this)},set(a){t.get(this).setValue(a),o.set(this,a)},configurable:!0,enumerable:!0}}else{let o=i.set;n={...i,set(a){t.get(this).setValue(a),o?.call(this,a)}}}return void Object.defineProperty(r,e,n)}}}function $({context:s,subscribe:r}){return(e,t)=>{typeof t=="object"?t.addInitializer((function(){new tr(this,{context:s,callback:i=>{e.set.call(this,i)},subscribe:r})})):e.constructor.addInitializer((i=>{new tr(i,{context:s,callback:n=>{i[t]=n},subscribe:r})}))}}var rt=Symbol("computedItemContext");var G=Symbol("computedContext");var ge=Symbol("configContext");var el=[{identifier:"completionStatus",cardinality:"single",baseType:"string",value:"unknown",type:"outcome"},{identifier:"numAttempts",cardinality:"single",baseType:"integer",value:"0",type:"response"}];var W=Symbol("item");var ir=Symbol("qtiContext");var Yo={view:"candidate"},it=Symbol("testContext");var Jo={items:[],testOutcomeVariables:[]},_e=Symbol("testContext");function B(s,r){let e={waitUntilFirstUpdate:!1,...r};return(t,i)=>{let{update:n}=t,o=Array.isArray(s)?s:[s];t.update=function(a){o.forEach(l=>{let c=l;if(a.has(c)){let p=a.get(c),u=this[c];p!==u&&(!e.waitUntilFirstUpdate||this.hasUpdated)&&this[i](p,u)}}),n.call(this,a)}}}var nr={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},qe=s=>(...r)=>({_$litDirective$:s,values:r}),nt=class{constructor(r){}get _$AU(){return this._$AM._$AU}_$AT(r,e,t){this._$Ct=r,this._$AM=e,this._$Ci=t}_$AS(r,e){return this.update(r,e)}update(r,e){return this.render(...e)}};var{I:Bd}=Ha,tl=s=>s,il=s=>s===null||typeof s!="object"&&typeof s!="function";var nl=s=>s.strings===void 0,rl=()=>document.createComment(""),or=(s,r,e)=>{let t=s._$AA.parentNode,i=r===void 0?s._$AB:r._$AA;if(e===void 0){let n=t.insertBefore(rl(),i),o=t.insertBefore(rl(),i);e=new Bd(n,o,s,s.options)}else{let n=e._$AB.nextSibling,o=e._$AM,a=o!==s;if(a){let l;e._$AQ?.(s),e._$AM=s,e._$AP!==void 0&&(l=s._$AU)!==o._$AU&&e._$AP(l)}if(n!==i||a){let l=e._$AA;for(;l!==n;){let c=tl(l).nextSibling;tl(t).insertBefore(l,i),l=c}}}return e},ot=(s,r,e=s)=>(s._$AI(r,e),s),zd={},ol=(s,r=zd)=>s._$AH=r,sl=s=>s._$AH,fn=s=>{s._$AR(),s._$AA.remove()};var zr=(s,r)=>{let e=s._$AN;if(e===void 0)return!1;for(let t of e)t._$AO?.(r,!1),zr(t,r);return!0},gn=s=>{let r,e;do{if((r=s._$AM)===void 0)break;e=r._$AN,e.delete(s),s=r}while(e?.size===0)},al=s=>{for(let r;r=s._$AM;s=r){let e=r._$AN;if(e===void 0)r._$AN=e=new Set;else if(e.has(s))break;e.add(s),Gd(r)}};function jd(s){this._$AN!==void 0?(gn(this),this._$AM=s,al(this)):this._$AM=s}function Wd(s,r=!1,e=0){let t=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(r)if(Array.isArray(t))for(let n=e;n<t.length;n++)zr(t[n],!1),gn(t[n]);else t!=null&&(zr(t,!1),gn(t));else zr(this,s)}var Gd=s=>{s.type==nr.CHILD&&(s._$AP??=Wd,s._$AQ??=jd)},st=class extends nt{constructor(){super(...arguments),this._$AN=void 0}_$AT(r,e,t){super._$AT(r,e,t),al(this),this.isConnected=r._$AU}_$AO(r,e=!0){r!==this.isConnected&&(this.isConnected=r,r?this.reconnected?.():this.disconnected?.()),e&&(zr(this,r),gn(this))}setValue(r){if(nl(this._$Ct))this._$Ct._$AI(r,this);else{let e=[...this._$Ct._$AH];e[this._$Ci]=r,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}};var Ko=class extends st{constructor(){super(...arguments);this.prevData={}}render(e){return O}update(e,[t]){return this.element!==e.element&&(this.element=e.element),this.host=e.options?.host||this.element,this.apply(t),this.groom(t),this.prevData={...t},O}apply(e){let t=this.#e(e),{prevData:i,element:n}=this;for(let o in t){let a=t[o];a!==i[o]&&(a===!0?n.setAttribute(o,""):a===!1?n.removeAttribute(o):a!=null?n.setAttribute(o,String(a)):n.removeAttribute(o))}}groom(e){let{prevData:t,element:i}=this;if(!t)return;let n=e?this.#e(e):{};for(let o in t)(!n||!(o in n))&&i.removeAttribute(o)}#e(e){return Object.fromEntries(Object.entries(e).filter(([t,i])=>typeof i=="function"?!1:t==="max-choices"&&i===0?!0:!(i===""||i===null||i===void 0)))}},Ah=qe(Ko);var ll=(t=>(t.Correct="correct",t.PartiallyCorrect="partially-correct",t.Incorrect="incorrect",t))(ll||{}),V=class extends E{constructor(){super();this.disabled=!1;this.readonly=!1;this.showCorrectResponse=!1;this._handleShowCorrectResponseChange=(e,t)=>{this.toggleInternalCorrectResponse(t)};this.showFullCorrectResponse=!1;this._handleShowFullCorrectResponseChange=(e,t)=>{this.toggleFullCorrectResponse(t)};this.showCandidateCorrection=!1;this._handleShowCandidateCorrectionChange=(e,t)=>{this.toggleCandidateCorrection(t)};this._correctResponse=null;this._internals=this.attachInternals()}static{this.formAssociated=!0}get internals(){return this._internals}set correctResponseAttr(e){e===null?this._correctResponse=null:e.includes(",")?this._correctResponse=e.split(",").map(t=>t.trim()):this._correctResponse=e}get correctResponseAttr(){return this._correctResponse===null||this._correctResponse===void 0?null:Array.isArray(this._correctResponse)?this._correctResponse.join(","):this._correctResponse}get isFullCorrectResponse(){return this._isFullCorrectResponse}set isFullCorrectResponse(e){this._isFullCorrectResponse=e,e&&(this.disabled=!0,this.setAttribute("inert",""),this.setAttribute("response-identifier",this.responseIdentifier+"_cr"))}get correctResponse(){let e=this.responseVariable;return e?.correctResponse?e.correctResponse:this._correctResponse}set correctResponse(e){let t=this._correctResponse;this._correctResponse=e,e==null?this.removeAttribute("correct-response"):this.setAttribute("correct-response",Array.isArray(e)?e.join(","):e),this.requestUpdate("_correctResponse",t)}get correctness(){let e=this.correctResponse;if(!e)return null;let t=this.response;if(t==null||t===""||Array.isArray(t)&&t.length===0)return null;let i=Array.isArray(e)?e:[e],o=(Array.isArray(t)?t:[t]).filter(c=>c!=="");if(o.length===0)return null;let a=o.filter(c=>i.includes(c)).length,l=o.filter(c=>!i.includes(c)).length;return a===i.length&&l===0&&o.length===i.length?"correct":a>0&&(a<i.length||l>0)?"partially-correct":"incorrect"}get isInline(){return!1}get responseVariable(){if(!this._context?.variables)return;let e=this._context.variables.filter(i=>i.type==="response"),t=this.getAttribute("response-identifier");return e.find(i=>i.identifier===t)}toggleCorrectResponse(e){(this?.configContext?.correctResponseMode||"internal")==="full"?this.toggleFullCorrectResponse(e):this.toggleInternalCorrectResponse(e)}async toggleFullCorrectResponse(e){let t=this.nextSibling,i=t instanceof HTMLDivElement&&t?.classList.contains("full-correct-response"),n=this.correctResponse;if(!n)return;if(!(e&&(this?.configContext?.fullCorrectResponseOnlyWhenIncorrect===!1||this.correctness!=="correct"))){if(!i)return;this.parentElement?.removeChild(t);return}if(i)return;let a=this.cloneNode(!0);a.removeAttribute("show-full-correct-response"),a.removeAttribute("show-correct-response"),a.removeAttribute("show-candidate-correction");let l=document.createElement("div");l.classList.add("full-correct-response"),this.isInline?l.classList.add("full-correct-response-inline"):l.classList.add("full-correct-response-block"),l.role="full-correct-response",l.appendChild(a),a.isFullCorrectResponse=!0,this.parentElement?.insertBefore(l,this.nextSibling),await a.updateComplete,a.response=Array.isArray(n)?[...n]:n}toggleInternalCorrectResponse(e){this._internals.states.delete("show-correct-response"),e&&this.correctResponse&&this._internals.states.add("show-correct-response")}toggleCandidateCorrection(e){this._internals.states.delete("candidate-correct"),this._internals.states.delete("candidate-partially-correct"),this._internals.states.delete("candidate-incorrect"),e&&(this.correctness==="correct"&&this._internals.states.add("candidate-correct"),this.correctness==="partially-correct"&&this._internals.states.add("candidate-partially-correct"),this.correctness==="incorrect"&&this._internals.states.add("candidate-incorrect"))}get value(){return JSON.stringify(this.response)}set value(e){this.response=e?JSON.parse(e):null}reportValidity(){return this._internals.reportValidity()}reset(){this.response=null}formResetCallback(){this.reset()}connectedCallback(){super.connectedCallback(),!this.isFullCorrectResponse&&this.dispatchEvent(new CustomEvent("qti-register-interaction",{bubbles:!0,composed:!0,cancelable:!1,detail:{interactionElement:this,responseIdentifier:this.responseIdentifier}}))}firstUpdated(){this.isFullCorrectResponse||(this.showCorrectResponse&&this.toggleInternalCorrectResponse(!0),this.showFullCorrectResponse&&this.toggleFullCorrectResponse(!0),this.showCandidateCorrection&&this.toggleCandidateCorrection(!0))}saveResponse(e,t){this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,cancelable:!1,detail:{responseIdentifier:this.responseIdentifier,response:Array.isArray(e)?[...e]:e,...t!==void 0?{state:t}:{}}}))}};d([$({context:W,subscribe:!0})],V.prototype,"_context",2),d([$({context:ge,subscribe:!0})],V.prototype,"configContext",2),d([g({type:String,attribute:"response-identifier"})],V.prototype,"responseIdentifier",2),d([g({reflect:!0,type:Boolean})],V.prototype,"disabled",2),d([g({reflect:!0,type:Boolean})],V.prototype,"readonly",2),d([g({type:String})],V.prototype,"name",2),d([g({type:String,attribute:"correct-response",reflect:!0})],V.prototype,"correctResponseAttr",1),d([g({type:Boolean,attribute:"show-correct-response",reflect:!0})],V.prototype,"showCorrectResponse",2),d([B("showCorrectResponse",{waitUntilFirstUpdate:!0})],V.prototype,"_handleShowCorrectResponseChange",2),d([g({type:Boolean,attribute:"show-full-correct-response",reflect:!0})],V.prototype,"showFullCorrectResponse",2),d([B("showFullCorrectResponse",{waitUntilFirstUpdate:!0})],V.prototype,"_handleShowFullCorrectResponseChange",2),d([g({type:Boolean,attribute:"show-candidate-correction",reflect:!0})],V.prototype,"showCandidateCorrection",2),d([B("showCandidateCorrection",{waitUntilFirstUpdate:!0})],V.prototype,"_handleShowCandidateCorrectionChange",2),d([M()],V.prototype,"_isFullCorrectResponse",2),d([M()],V.prototype,"_correctResponse",2);var sr=class extends E{render(){return x`<slot></slot>`}defaultValues(r){let e=Array.from(this.querySelectorAll("qti-default-value > qti-value"));if(e.length===0)return null;let t=e.map(i=>i.innerHTML.trim());return t.length>1||r==="multiple"||r==="ordered"?t:t[0]}};var R=class extends E{constructor(){super(...arguments);this.getVariables=()=>Array.from(this.children).map(e=>{switch(console.debug("getVariables",e.tagName.toLowerCase()),e.tagName.toLowerCase()){case"qti-base-value":return{baseType:e.getAttribute("base-type"),value:e.textContent.trim(),cardinality:"single"};case"qti-variable":{let t=e.getAttribute("identifier")||"";return t==="QTI_CONTEXT"?this.qtiContext?.QTI_CONTEXT?{identifier:"QTI_CONTEXT",baseType:"record",value:this.qtiContext.QTI_CONTEXT,cardinality:"record",type:"context"}:(console.warn("QTI_CONTEXT not available"),{identifier:"QTI_CONTEXT",baseType:"record",value:this.qtiContext.QTI_CONTEXT,cardinality:"record",type:"context"}):this.context.variables.find(n=>n.identifier===t)||null}case"qti-multiple":{let i=e.getResult();return console.debug("values",i),i?.length>0?{identifier:"",baseType:i[0].baseType,value:i.map(n=>n.value),cardinality:"multiple",type:"response"}:null}case"qti-ordered":{let i=e.getResult();return i?.length>0?{identifier:"",baseType:i[0].baseType,value:i.map(n=>n.value),cardinality:"ordered",type:"response"}:null}case"qti-repeat":{let i=e.getResult();return i?.length>0?i:null}case"qti-correct":{let t=e.getAttribute("identifier")||"",i=this.context?.variables?.find(n=>n.identifier===t)||null;return{baseType:i.baseType,value:i.correctResponse,cardinality:i.cardinality}}default:{try{return{baseType:"integer",value:e.getResult()?.toString()||null,cardinality:"single"}}catch{console.warn("default not sufficient")}return null}}}).flatMap(e=>Array.isArray(e)?e:[e]).filter(e=>e!==null)}static{this.styles=C`
1
+ var Vd=Object.defineProperty;var Dd=Object.getOwnPropertyDescriptor;var Sa=o=>{throw TypeError(o)};var d=(o,r,e,t)=>{for(var i=t>1?void 0:t?Dd(r,e):r,n=o.length-1,s;n>=0;n--)(s=o[n])&&(i=(t?s(r,e,i):s(i))||i);return t&&i&&Vd(r,e,i),i};var Vo=(o,r,e)=>r.has(o)||Sa("Cannot "+e);var S=(o,r,e)=>(Vo(o,r,"read from private field"),e?e.call(o):r.get(o)),L=(o,r,e)=>r.has(o)?Sa("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(o):r.set(o,e),U=(o,r,e,t)=>(Vo(o,r,"write to private field"),t?t.call(o,e):r.set(o,e),e),P=(o,r,e)=>(Vo(o,r,"access private method"),e);var et=class extends Event{constructor(r,e,t,i){super("context-request",{bubbles:!0,composed:!0}),this.context=r,this.contextTarget=e,this.callback=t,this.subscribe=i??!1}};var Qt=class{constructor(r,e,t,i){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(n,s)=>{this.unsubscribe&&(this.unsubscribe!==s&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=n,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(n,s)),this.unsubscribe=s},this.host=r,e.context!==void 0){let n=e;this.context=n.context,this.callback=n.callback,this.subscribe=n.subscribe??!1}else this.context=e,this.callback=t,this.subscribe=i??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new et(this.context,this.host,this.t,this.subscribe))}};var rn=class{get value(){return this.o}set value(r){this.setValue(r)}setValue(r,e=!1){let t=e||!Object.is(r,this.o);this.o=r,t&&this.updateObservers()}constructor(r){this.subscriptions=new Map,this.updateObservers=()=>{for(let[e,{disposer:t}]of this.subscriptions)e(this.o,t)},r!==void 0&&(this.value=r)}addCallback(r,e,t){if(!t)return void r(this.value);this.subscriptions.has(r)||this.subscriptions.set(r,{disposer:()=>{this.subscriptions.delete(r)},consumerHost:e});let{disposer:i}=this.subscriptions.get(r);r(this.value,i)}clearCallbacks(){this.subscriptions.clear()}};var Do=class extends Event{constructor(r,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=r,this.contextTarget=e}},Yt=class extends rn{constructor(r,e,t){super(e.context!==void 0?e.initialValue:t),this.onContextRequest=i=>{if(i.context!==this.context)return;let n=i.contextTarget??i.composedPath()[0];n!==this.host&&(i.stopPropagation(),this.addCallback(i.callback,n,i.subscribe))},this.onProviderRequest=i=>{if(i.context!==this.context||(i.contextTarget??i.composedPath()[0])===this.host)return;let n=new Set;for(let[s,{consumerHost:a}]of this.subscriptions)n.has(s)||(n.add(s),a.dispatchEvent(new et(this.context,a,s,!0)));i.stopPropagation()},this.host=r,e.context!==void 0?this.context=e.context:this.context=e,this.attachListeners(),this.host.addController?.(this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new Do(this.context,this.host))}};function ee({context:o}){return(r,e)=>{let t=new WeakMap;if(typeof e=="object")return{get(){return r.get.call(this)},set(i){return t.get(this).setValue(i),r.set.call(this,i)},init(i){return t.set(this,new Yt(this,{context:o,initialValue:i})),i}};{r.constructor.addInitializer((s=>{t.set(s,new Yt(s,{context:o}))}));let i=Object.getOwnPropertyDescriptor(r,e),n;if(i===void 0){let s=new WeakMap;n={get(){return s.get(this)},set(a){t.get(this).setValue(a),s.set(this,a)},configurable:!0,enumerable:!0}}else{let s=i.set;n={...i,set(a){t.get(this).setValue(a),s?.call(this,a)}}}return void Object.defineProperty(r,e,n)}}}function $({context:o,subscribe:r}){return(e,t)=>{typeof t=="object"?t.addInitializer((function(){new Qt(this,{context:o,callback:i=>{e.set.call(this,i)},subscribe:r})})):e.constructor.addInitializer((i=>{new Qt(i,{context:o,callback:n=>{i[t]=n},subscribe:r})}))}}var Aa=class{get shadowRoot(){return this.__host.__shadowRoot}constructor(r){this.ariaActiveDescendantElement=null,this.ariaAtomic="",this.ariaAutoComplete="",this.ariaBrailleLabel="",this.ariaBrailleRoleDescription="",this.ariaBusy="",this.ariaChecked="",this.ariaColCount="",this.ariaColIndex="",this.ariaColIndexText="",this.ariaColSpan="",this.ariaControlsElements=null,this.ariaCurrent="",this.ariaDescribedByElements=null,this.ariaDescription="",this.ariaDetailsElements=null,this.ariaDisabled="",this.ariaErrorMessageElements=null,this.ariaExpanded="",this.ariaFlowToElements=null,this.ariaHasPopup="",this.ariaHidden="",this.ariaInvalid="",this.ariaKeyShortcuts="",this.ariaLabel="",this.ariaLabelledByElements=null,this.ariaLevel="",this.ariaLive="",this.ariaModal="",this.ariaMultiLine="",this.ariaMultiSelectable="",this.ariaOrientation="",this.ariaOwnsElements=null,this.ariaPlaceholder="",this.ariaPosInSet="",this.ariaPressed="",this.ariaReadOnly="",this.ariaRelevant="",this.ariaRequired="",this.ariaRoleDescription="",this.ariaRowCount="",this.ariaRowIndex="",this.ariaRowIndexText="",this.ariaRowSpan="",this.ariaSelected="",this.ariaSetSize="",this.ariaSort="",this.ariaValueMax="",this.ariaValueMin="",this.ariaValueNow="",this.ariaValueText="",this.role="",this.form=null,this.labels=[],this.states=new Set,this.validationMessage="",this.validity={},this.willValidate=!0,this.__host=r}checkValidity(){return console.warn("`ElementInternals.checkValidity()` was called on the server.This method always returns true."),!0}reportValidity(){return!0}setFormValue(){}setValidity(){}};var Me=function(o,r,e,t,i){if(t==="m")throw new TypeError("Private method is not writable");if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof r=="function"?o!==r||!i:!r.has(o))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t==="a"?i.call(o,e):i?i.value=e:r.set(o,e),e},Y=function(o,r,e,t){if(e==="a"&&!t)throw new TypeError("Private accessor was defined without a getter");if(typeof r=="function"?o!==r||!t:!r.has(o))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?t:e==="a"?t.call(o):t?t.value:r.get(o)},Jt,nn,on,_r,No,Lr,sn,Tt,$r,tt,an,Ta,Ia=o=>typeof o=="boolean"?o:o?.capture??!1;var Oo=class{constructor(){this.__eventListeners=new Map,this.__captureEventListeners=new Map}addEventListener(r,e,t){if(e==null)return;let i=Ia(t)?this.__captureEventListeners:this.__eventListeners,n=i.get(r);if(n===void 0)n=new Map,i.set(r,n);else if(n.has(e))return;let s=typeof t=="object"&&t?t:{};s.signal?.addEventListener("abort",()=>this.removeEventListener(r,e,t)),n.set(e,s??{})}removeEventListener(r,e,t){if(e==null)return;let i=Ia(t)?this.__captureEventListeners:this.__eventListeners,n=i.get(r);n!==void 0&&(n.delete(e),n.size||i.delete(r))}dispatchEvent(r){let e=[this],t=this.__eventTargetParent;if(r.composed)for(;t;)e.push(t),t=t.__eventTargetParent;else for(;t&&t!==this.__host;)e.push(t),t=t.__eventTargetParent;let i=!1,n=!1,s=0,a=null,l=null,c=null,p=r.stopPropagation,u=r.stopImmediatePropagation;Object.defineProperties(r,{target:{get(){return a??l},...j},srcElement:{get(){return r.target},...j},currentTarget:{get(){return c},...j},eventPhase:{get(){return s},...j},composedPath:{value:()=>e,...j},stopPropagation:{value:()=>{i=!0,p.call(r)},...j},stopImmediatePropagation:{value:()=>{n=!0,u.call(r)},...j}});let h=(m,b,q)=>{typeof m=="function"?m(r):typeof m?.handleEvent=="function"&&m.handleEvent(r),b.once&&q.delete(m)},v=()=>(c=null,s=0,!r.defaultPrevented),y=e.slice().reverse();a=!this.__host||!r.composed?this:null;let w=m=>{for(l=this;l.__host&&m.includes(l.__host);)l=l.__host};for(let m of y){!a&&(!l||l===m.__host)&&w(y.slice(y.indexOf(m))),c=m,s=m===r.target?2:1;let b=m.__captureEventListeners.get(r.type);if(b){for(let[q,A]of b)if(h(q,A,b),n)return v()}if(i)return v()}let f=r.bubbles?e:[this];l=null;for(let m of f){!a&&(!l||m===l.__host)&&w(f.slice(0,f.indexOf(m)+1)),c=m,s=m===r.target?2:3;let b=m.__eventListeners.get(r.type);if(b){for(let[q,A]of b)if(h(q,A,b),n)return v()}if(i)return v()}return v()}},Ho=Oo;var j={__proto__:null};j.enumerable=!0;Object.freeze(j);var Fo=(tt=class{constructor(r,e={}){if(Jt.set(this,!1),nn.set(this,!1),on.set(this,!1),_r.set(this,!1),No.set(this,Date.now()),Lr.set(this,!1),sn.set(this,void 0),Tt.set(this,void 0),$r.set(this,void 0),this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,arguments.length===0)throw new Error("The type argument must be specified");if(typeof e!="object"||!e)throw new Error('The "options" argument must be an object');let{bubbles:t,cancelable:i,composed:n}=e;Me(this,Jt,!!i,"f"),Me(this,nn,!!t,"f"),Me(this,on,!!n,"f"),Me(this,sn,`${r}`,"f"),Me(this,Tt,null,"f"),Me(this,$r,!1,"f")}initEvent(r,e,t){throw new Error("Method not implemented.")}stopImmediatePropagation(){this.stopPropagation()}preventDefault(){Me(this,_r,!0,"f")}get target(){return Y(this,Tt,"f")}get currentTarget(){return Y(this,Tt,"f")}get srcElement(){return Y(this,Tt,"f")}get type(){return Y(this,sn,"f")}get cancelable(){return Y(this,Jt,"f")}get defaultPrevented(){return Y(this,Jt,"f")&&Y(this,_r,"f")}get timeStamp(){return Y(this,No,"f")}composedPath(){return Y(this,$r,"f")?[Y(this,Tt,"f")]:[]}get returnValue(){return!Y(this,Jt,"f")||!Y(this,_r,"f")}get bubbles(){return Y(this,nn,"f")}get composed(){return Y(this,on,"f")}get eventPhase(){return Y(this,$r,"f")?tt.AT_TARGET:tt.NONE}get cancelBubble(){return Y(this,Lr,"f")}set cancelBubble(r){r&&Me(this,Lr,!0,"f")}stopPropagation(){Me(this,Lr,!0,"f")}get isTrusted(){return!1}},Jt=new WeakMap,nn=new WeakMap,on=new WeakMap,_r=new WeakMap,No=new WeakMap,Lr=new WeakMap,sn=new WeakMap,Tt=new WeakMap,$r=new WeakMap,tt.NONE=0,tt.CAPTURING_PHASE=1,tt.AT_TARGET=2,tt.BUBBLING_PHASE=3,tt);Object.defineProperties(Fo.prototype,{initEvent:j,stopImmediatePropagation:j,preventDefault:j,target:j,currentTarget:j,srcElement:j,type:j,cancelable:j,defaultPrevented:j,timeStamp:j,composedPath:j,returnValue:j,bubbles:j,composed:j,eventPhase:j,cancelBubble:j,stopPropagation:j,isTrusted:j});var Ra=(Ta=class extends Fo{constructor(r,e={}){super(r,e),an.set(this,void 0),Me(this,an,e?.detail??null,"f")}initCustomEvent(r,e,t,i){throw new Error("Method not implemented.")}get detail(){return Y(this,an,"f")}},an=new WeakMap,Ta);Object.defineProperties(Ra.prototype,{detail:j});var Uo=Fo,Bo=Ra;var re;var Pu=(re=class{constructor(){this.STYLE_RULE=1,this.CHARSET_RULE=2,this.IMPORT_RULE=3,this.MEDIA_RULE=4,this.FONT_FACE_RULE=5,this.PAGE_RULE=6,this.NAMESPACE_RULE=10,this.KEYFRAMES_RULE=7,this.KEYFRAME_RULE=8,this.SUPPORTS_RULE=12,this.COUNTER_STYLE_RULE=11,this.FONT_FEATURE_VALUES_RULE=14,this.__parentStyleSheet=null,this.cssText=""}get parentRule(){return null}get parentStyleSheet(){return this.__parentStyleSheet}get type(){return 0}},re.STYLE_RULE=1,re.CHARSET_RULE=2,re.IMPORT_RULE=3,re.MEDIA_RULE=4,re.FONT_FACE_RULE=5,re.PAGE_RULE=6,re.NAMESPACE_RULE=10,re.KEYFRAMES_RULE=7,re.KEYFRAME_RULE=8,re.SUPPORTS_RULE=12,re.COUNTER_STYLE_RULE=11,re.FONT_FEATURE_VALUES_RULE=14,re);globalThis.Event??=Uo;globalThis.CustomEvent??=Bo;var ka=new WeakMap,Pr=o=>{let r=ka.get(o);return r===void 0&&ka.set(o,r=new Map),r},Nd=class extends Ho{constructor(){super(...arguments),this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from(Pr(this)).map(([r,e])=>({name:r,value:e}))}get shadowRoot(){return this.__shadowRootMode==="closed"?null:this.__shadowRoot}get localName(){return this.constructor.__localName}get tagName(){return this.localName?.toUpperCase()}setAttribute(r,e){Pr(this).set(r,String(e))}removeAttribute(r){Pr(this).delete(r)}toggleAttribute(r,e){if(this.hasAttribute(r)){if(e===void 0||!e)return this.removeAttribute(r),!1}else return e===void 0||e?(this.setAttribute(r,""),!0):!1;return!0}hasAttribute(r){return Pr(this).has(r)}attachShadow(r){let e={host:this};return this.__shadowRootMode=r.mode,r&&r.mode==="open"&&(this.__shadowRoot=e),e}attachInternals(){if(this.__internals!==null)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");let r=new Aa(this);return this.__internals=r,r}getAttribute(r){return Pr(this).get(r)??null}};var Od=class extends Nd{},jo=Od;globalThis.litServerRoot??=Object.defineProperty(new jo,"localName",{get(){return"lit-server-root"}});function Hd(){let o,r;return{promise:new Promise((t,i)=>{o=t,r=i}),resolve:o,reject:r}}var zo=class{constructor(){this.__definitions=new Map,this.__reverseDefinitions=new Map,this.__pendingWhenDefineds=new Map}define(r,e){if(this.__definitions.has(r))if(process.env.NODE_ENV==="development")console.warn(`'CustomElementRegistry' already has "${r}" defined. This may have been caused by live reload or hot module replacement in which case it can be safely ignored.
2
+ Make sure to test your application with a production build as repeat registrations will throw in production.`);else throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the name "${r}" has already been used with this registry`);if(this.__reverseDefinitions.has(e))throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the constructor has already been used with this registry for the tag name ${this.__reverseDefinitions.get(e)}`);e.__localName=r,this.__definitions.set(r,{ctor:e,observedAttributes:e.observedAttributes??[]}),this.__reverseDefinitions.set(e,r),this.__pendingWhenDefineds.get(r)?.resolve(e),this.__pendingWhenDefineds.delete(r)}get(r){return this.__definitions.get(r)?.ctor}getName(r){return this.__reverseDefinitions.get(r)??null}upgrade(r){throw new Error("customElements.upgrade is not currently supported in SSR. Please file a bug if you need it.")}async whenDefined(r){let e=this.__definitions.get(r);if(e)return e.ctor;let t=this.__pendingWhenDefineds.get(r);return t||(t=Hd(),this.__pendingWhenDefineds.set(r,t)),t.promise}},Fd=zo;var Ma=new Fd;var Vr=globalThis,ln=Vr.ShadowRoot&&(Vr.ShadyCSS===void 0||Vr.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Wo=Symbol(),_a=new WeakMap,Dr=class{constructor(r,e,t){if(this._$cssResult$=!0,t!==Wo)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=r,this.t=e}get styleSheet(){let r=this.o,e=this.t;if(ln&&r===void 0){let t=e!==void 0&&e.length===1;t&&(r=_a.get(e)),r===void 0&&((this.o=r=new CSSStyleSheet).replaceSync(this.cssText),t&&_a.set(e,r))}return r}toString(){return this.cssText}},La=o=>new Dr(typeof o=="string"?o:o+"",void 0,Wo),C=(o,...r)=>{let e=o.length===1?o[0]:r.reduce((t,i,n)=>t+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s=="number")return s;throw Error("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+o[n+1],o[0]);return new Dr(e,o,Wo)},$a=(o,r)=>{if(ln)o.adoptedStyleSheets=r.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of r){let t=document.createElement("style"),i=Vr.litNonce;i!==void 0&&t.setAttribute("nonce",i),t.textContent=e.cssText,o.appendChild(t)}},Go=ln||Vr.CSSStyleSheet===void 0?o=>o:o=>o instanceof CSSStyleSheet?(r=>{let e="";for(let t of r.cssRules)e+=t.cssText;return La(e)})(o):o;var{is:Ud,defineProperty:Bd,getOwnPropertyDescriptor:zd,getOwnPropertyNames:jd,getOwnPropertySymbols:Wd,getPrototypeOf:Gd}=Object,Hr=globalThis;Hr.customElements??=Ma;var Pa=Hr.trustedTypes,Xd=Pa?Pa.emptyScript:"",Qd=Hr.reactiveElementPolyfillSupport,Nr=(o,r)=>o,Or={toAttribute(o,r){switch(r){case Boolean:o=o?Xd:null;break;case Object:case Array:o=o==null?o:JSON.stringify(o)}return o},fromAttribute(o,r){let e=o;switch(r){case Boolean:e=o!==null;break;case Number:e=o===null?null:Number(o);break;case Object:case Array:try{e=JSON.parse(o)}catch{e=null}}return e}},cn=(o,r)=>!Ud(o,r),Va={attribute:!0,type:String,converter:Or,reflect:!1,useDefault:!1,hasChanged:cn};Symbol.metadata??=Symbol("metadata"),Hr.litPropertyMetadata??=new WeakMap;var ze=class extends(globalThis.HTMLElement??jo){static addInitializer(r){this._$Ei(),(this.l??=[]).push(r)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(r,e=Va){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(r)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(r,e),!e.noAccessor){let t=Symbol(),i=this.getPropertyDescriptor(r,t,e);i!==void 0&&Bd(this.prototype,r,i)}}static getPropertyDescriptor(r,e,t){let{get:i,set:n}=zd(this.prototype,r)??{get(){return this[e]},set(s){this[e]=s}};return{get:i,set(s){let a=i?.call(this);n?.call(this,s),this.requestUpdate(r,a,t)},configurable:!0,enumerable:!0}}static getPropertyOptions(r){return this.elementProperties.get(r)??Va}static _$Ei(){if(this.hasOwnProperty(Nr("elementProperties")))return;let r=Gd(this);r.finalize(),r.l!==void 0&&(this.l=[...r.l]),this.elementProperties=new Map(r.elementProperties)}static finalize(){if(this.hasOwnProperty(Nr("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Nr("properties"))){let e=this.properties,t=[...jd(e),...Wd(e)];for(let i of t)this.createProperty(i,e[i])}let r=this[Symbol.metadata];if(r!==null){let e=litPropertyMetadata.get(r);if(e!==void 0)for(let[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let i=this._$Eu(e,t);i!==void 0&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(r){let e=[];if(Array.isArray(r)){let t=new Set(r.flat(1/0).reverse());for(let i of t)e.unshift(Go(i))}else r!==void 0&&e.push(Go(r));return e}static _$Eu(r,e){let t=e.attribute;return t===!1?void 0:typeof t=="string"?t:typeof r=="string"?r.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(r=>this.enableUpdating=r),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(r=>r(this))}addController(r){(this._$EO??=new Set).add(r),this.renderRoot!==void 0&&this.isConnected&&r.hostConnected?.()}removeController(r){this._$EO?.delete(r)}_$E_(){let r=new Map,e=this.constructor.elementProperties;for(let t of e.keys())this.hasOwnProperty(t)&&(r.set(t,this[t]),delete this[t]);r.size>0&&(this._$Ep=r)}createRenderRoot(){let r=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return $a(r,this.constructor.elementStyles),r}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(r=>r.hostConnected?.())}enableUpdating(r){}disconnectedCallback(){this._$EO?.forEach(r=>r.hostDisconnected?.())}attributeChangedCallback(r,e,t){this._$AK(r,t)}_$ET(r,e){let t=this.constructor.elementProperties.get(r),i=this.constructor._$Eu(r,t);if(i!==void 0&&t.reflect===!0){let n=(t.converter?.toAttribute!==void 0?t.converter:Or).toAttribute(e,t.type);this._$Em=r,n==null?this.removeAttribute(i):this.setAttribute(i,n),this._$Em=null}}_$AK(r,e){let t=this.constructor,i=t._$Eh.get(r);if(i!==void 0&&this._$Em!==i){let n=t.getPropertyOptions(i),s=typeof n.converter=="function"?{fromAttribute:n.converter}:n.converter?.fromAttribute!==void 0?n.converter:Or;this._$Em=i;let a=s.fromAttribute(e,n.type);this[i]=a??this._$Ej?.get(i)??a,this._$Em=null}}requestUpdate(r,e,t,i=!1,n){if(r!==void 0){let s=this.constructor;if(i===!1&&(n=this[r]),t??=s.getPropertyOptions(r),!((t.hasChanged??cn)(n,e)||t.useDefault&&t.reflect&&n===this._$Ej?.get(r)&&!this.hasAttribute(s._$Eu(r,t))))return;this.C(r,e,t)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(r,e,{useDefault:t,reflect:i,wrapped:n},s){t&&!(this._$Ej??=new Map).has(r)&&(this._$Ej.set(r,s??e??this[r]),n!==!0||s!==void 0)||(this._$AL.has(r)||(this.hasUpdated||t||(e=void 0),this._$AL.set(r,e)),i===!0&&this._$Em!==r&&(this._$Eq??=new Set).add(r))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let r=this.scheduleUpdate();return r!=null&&await r,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[i,n]of this._$Ep)this[i]=n;this._$Ep=void 0}let t=this.constructor.elementProperties;if(t.size>0)for(let[i,n]of t){let{wrapped:s}=n,a=this[i];s!==!0||this._$AL.has(i)||a===void 0||this.C(i,void 0,n,a)}}let r=!1,e=this._$AL;try{r=this.shouldUpdate(e),r?(this.willUpdate(e),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(e)):this._$EM()}catch(t){throw r=!1,this._$EM(),t}r&&this._$AE(e)}willUpdate(r){}_$AE(r){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(r)),this.updated(r)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(r){return!0}update(r){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(r){}firstUpdated(r){}};ze.elementStyles=[],ze.shadowRootOptions={mode:"open"},ze[Nr("elementProperties")]=new Map,ze[Nr("finalized")]=new Map,Qd?.({ReactiveElement:ze}),(Hr.reactiveElementVersions??=[]).push("2.1.2");var gn=globalThis,Da=o=>o,dn=gn.trustedTypes,Na=dn?dn.createPolicy("lit-html",{createHTML:o=>o}):void 0,Qo="$lit$",je=`lit$${Math.random().toFixed(9).slice(2)}$`,Yo="?"+je,Yd=`<${Yo}>`,kt=gn.document===void 0?{createTreeWalker:()=>({})}:document,Ur=()=>kt.createComment(""),Br=o=>o===null||typeof o!="object"&&typeof o!="function",Jo=Array.isArray,za=o=>Jo(o)||typeof o?.[Symbol.iterator]=="function",Xo=`[
3
+ \f\r]`,Fr=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Oa=/-->/g,Ha=/>/g,It=RegExp(`>|${Xo}(?:([^\\s"'>=/]+)(${Xo}*=${Xo}*(?:[^
4
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Fa=/'/g,Ua=/"/g,ja=/^(?:script|style|textarea|title)$/i,Ko=o=>(r,...e)=>({_$litType$:o,strings:r,values:e}),x=Ko(1),bn=Ko(2),om=Ko(3),ie=Symbol.for("lit-noChange"),O=Symbol.for("lit-nothing"),Ba=new WeakMap,Rt=kt.createTreeWalker(kt,129);function Wa(o,r){if(!Jo(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return Na!==void 0?Na.createHTML(r):r}var Ga=(o,r)=>{let e=o.length-1,t=[],i,n=r===2?"<svg>":r===3?"<math>":"",s=Fr;for(let a=0;a<e;a++){let l=o[a],c,p,u=-1,h=0;for(;h<l.length&&(s.lastIndex=h,p=s.exec(l),p!==null);)h=s.lastIndex,s===Fr?p[1]==="!--"?s=Oa:p[1]!==void 0?s=Ha:p[2]!==void 0?(ja.test(p[2])&&(i=RegExp("</"+p[2],"g")),s=It):p[3]!==void 0&&(s=It):s===It?p[0]===">"?(s=i??Fr,u=-1):p[1]===void 0?u=-2:(u=s.lastIndex-p[2].length,c=p[1],s=p[3]===void 0?It:p[3]==='"'?Ua:Fa):s===Ua||s===Fa?s=It:s===Oa||s===Ha?s=Fr:(s=It,i=void 0);let v=s===It&&o[a+1].startsWith("/>")?" ":"";n+=s===Fr?l+Yd:u>=0?(t.push(c),l.slice(0,u)+Qo+l.slice(u)+je+v):l+je+(u===-2?a:v)}return[Wa(o,n+(o[e]||"<?>")+(r===2?"</svg>":r===3?"</math>":"")),t]},zr=class o{constructor({strings:r,_$litType$:e},t){let i;this.parts=[];let n=0,s=0,a=r.length-1,l=this.parts,[c,p]=Ga(r,e);if(this.el=o.createElement(c,t),Rt.currentNode=this.el.content,e===2||e===3){let u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(i=Rt.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let u of i.getAttributeNames())if(u.endsWith(Qo)){let h=p[s++],v=i.getAttribute(u).split(je),y=/([.?@])?(.*)/.exec(h);l.push({type:1,index:n,name:y[2],strings:v,ctor:y[1]==="."?un:y[1]==="?"?mn:y[1]==="@"?hn:_t}),i.removeAttribute(u)}else u.startsWith(je)&&(l.push({type:6,index:n}),i.removeAttribute(u));if(ja.test(i.tagName)){let u=i.textContent.split(je),h=u.length-1;if(h>0){i.textContent=dn?dn.emptyScript:"";for(let v=0;v<h;v++)i.append(u[v],Ur()),Rt.nextNode(),l.push({type:2,index:++n});i.append(u[h],Ur())}}}else if(i.nodeType===8)if(i.data===Yo)l.push({type:2,index:n});else{let u=-1;for(;(u=i.data.indexOf(je,u+1))!==-1;)l.push({type:7,index:n}),u+=je.length-1}n++}}static createElement(r,e){let t=kt.createElement("template");return t.innerHTML=r,t}};function Mt(o,r,e=o,t){if(r===ie)return r;let i=t!==void 0?e._$Co?.[t]:e._$Cl,n=Br(r)?void 0:r._$litDirective$;return i?.constructor!==n&&(i?._$AO?.(!1),n===void 0?i=void 0:(i=new n(o),i._$AT(o,e,t)),t!==void 0?(e._$Co??=[])[t]=i:e._$Cl=i),i!==void 0&&(r=Mt(o,i._$AS(o,r.values),i,t)),r}var pn=class{constructor(r,e){this._$AV=[],this._$AN=void 0,this._$AD=r,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(r){let{el:{content:e},parts:t}=this._$AD,i=(r?.creationScope??kt).importNode(e,!0);Rt.currentNode=i;let n=Rt.nextNode(),s=0,a=0,l=t[0];for(;l!==void 0;){if(s===l.index){let c;l.type===2?c=new Kt(n,n.nextSibling,this,r):l.type===1?c=new l.ctor(n,l.name,l.strings,this,r):l.type===6&&(c=new fn(n,this,r)),this._$AV.push(c),l=t[++a]}s!==l?.index&&(n=Rt.nextNode(),s++)}return Rt.currentNode=kt,i}p(r){let e=0;for(let t of this._$AV)t!==void 0&&(t.strings!==void 0?(t._$AI(r,t,e),e+=t.strings.length-2):t._$AI(r[e])),e++}},Kt=class o{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(r,e,t,i){this.type=2,this._$AH=O,this._$AN=void 0,this._$AA=r,this._$AB=e,this._$AM=t,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let r=this._$AA.parentNode,e=this._$AM;return e!==void 0&&r?.nodeType===11&&(r=e.parentNode),r}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(r,e=this){r=Mt(this,r,e),Br(r)?r===O||r==null||r===""?(this._$AH!==O&&this._$AR(),this._$AH=O):r!==this._$AH&&r!==ie&&this._(r):r._$litType$!==void 0?this.$(r):r.nodeType!==void 0?this.T(r):za(r)?this.k(r):this._(r)}O(r){return this._$AA.parentNode.insertBefore(r,this._$AB)}T(r){this._$AH!==r&&(this._$AR(),this._$AH=this.O(r))}_(r){this._$AH!==O&&Br(this._$AH)?this._$AA.nextSibling.data=r:this.T(kt.createTextNode(r)),this._$AH=r}$(r){let{values:e,_$litType$:t}=r,i=typeof t=="number"?this._$AC(r):(t.el===void 0&&(t.el=zr.createElement(Wa(t.h,t.h[0]),this.options)),t);if(this._$AH?._$AD===i)this._$AH.p(e);else{let n=new pn(i,this),s=n.u(this.options);n.p(e),this.T(s),this._$AH=n}}_$AC(r){let e=Ba.get(r.strings);return e===void 0&&Ba.set(r.strings,e=new zr(r)),e}k(r){Jo(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,t,i=0;for(let n of r)i===e.length?e.push(t=new o(this.O(Ur()),this.O(Ur()),this,this.options)):t=e[i],t._$AI(n),i++;i<e.length&&(this._$AR(t&&t._$AB.nextSibling,i),e.length=i)}_$AR(r=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);r!==this._$AB;){let t=Da(r).nextSibling;Da(r).remove(),r=t}}setConnected(r){this._$AM===void 0&&(this._$Cv=r,this._$AP?.(r))}},_t=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(r,e,t,i,n){this.type=1,this._$AH=O,this._$AN=void 0,this.element=r,this.name=e,this._$AM=i,this.options=n,t.length>2||t[0]!==""||t[1]!==""?(this._$AH=Array(t.length-1).fill(new String),this.strings=t):this._$AH=O}_$AI(r,e=this,t,i){let n=this.strings,s=!1;if(n===void 0)r=Mt(this,r,e,0),s=!Br(r)||r!==this._$AH&&r!==ie,s&&(this._$AH=r);else{let a=r,l,c;for(r=n[0],l=0;l<n.length-1;l++)c=Mt(this,a[t+l],e,l),c===ie&&(c=this._$AH[l]),s||=!Br(c)||c!==this._$AH[l],c===O?r=O:r!==O&&(r+=(c??"")+n[l+1]),this._$AH[l]=c}s&&!i&&this.j(r)}j(r){r===O?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,r??"")}},un=class extends _t{constructor(){super(...arguments),this.type=3}j(r){this.element[this.name]=r===O?void 0:r}},mn=class extends _t{constructor(){super(...arguments),this.type=4}j(r){this.element.toggleAttribute(this.name,!!r&&r!==O)}},hn=class extends _t{constructor(r,e,t,i,n){super(r,e,t,i,n),this.type=5}_$AI(r,e=this){if((r=Mt(this,r,e,0)??O)===ie)return;let t=this._$AH,i=r===O&&t!==O||r.capture!==t.capture||r.once!==t.once||r.passive!==t.passive,n=r!==O&&(t===O||i);i&&this.element.removeEventListener(this.name,this,t),n&&this.element.addEventListener(this.name,this,r),this._$AH=r}handleEvent(r){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,r):this._$AH.handleEvent(r)}},fn=class{constructor(r,e,t){this.element=r,this.type=6,this._$AN=void 0,this._$AM=e,this.options=t}get _$AU(){return this._$AM._$AU}_$AI(r){Mt(this,r)}},Xa={M:Qo,P:je,A:Yo,C:1,L:Ga,R:pn,D:za,V:Mt,I:Kt,H:_t,N:mn,U:hn,B:un,F:fn},Jd=gn.litHtmlPolyfillSupport;Jd?.(zr,Kt),(gn.litHtmlVersions??=[]).push("3.3.2");var Qa=(o,r,e)=>{let t=e?.renderBefore??r,i=t._$litPart$;if(i===void 0){let n=e?.renderBefore??null;t._$litPart$=i=new Kt(r.insertBefore(Ur(),n),n,void 0,e??{})}return i._$AI(o),i};var Zo=globalThis,E=class extends ze{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let r=super.createRenderRoot();return this.renderOptions.renderBefore??=r.firstChild,r}update(r){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(r),this._$Do=Qa(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return ie}};E._$litElement$=!0,E.finalized=!0,Zo.litElementHydrateSupport?.({LitElement:E});var Kd=Zo.litElementPolyfillSupport;Kd?.({LitElement:E});(Zo.litElementVersions??=[]).push("4.2.2");var R=o=>(r,e)=>{e!==void 0?e.addInitializer(()=>{customElements.define(o,r)}):customElements.define(o,r)};var Zd={attribute:!0,type:String,converter:Or,reflect:!1,hasChanged:cn},ep=(o=Zd,r,e)=>{let{kind:t,metadata:i}=e,n=globalThis.litPropertyMetadata.get(i);if(n===void 0&&globalThis.litPropertyMetadata.set(i,n=new Map),t==="setter"&&((o=Object.create(o)).wrapped=!0),n.set(e.name,o),t==="accessor"){let{name:s}=e;return{set(a){let l=r.get.call(this);r.set.call(this,a),this.requestUpdate(s,l,o,!0,a)},init(a){return a!==void 0&&this.C(s,void 0,o,a),a}}}if(t==="setter"){let{name:s}=e;return function(a){let l=this[s];r.call(this,a),this.requestUpdate(s,l,o,!0,a)}}throw Error("Unsupported decorator location: "+t)};function g(o){return(r,e)=>typeof e=="object"?ep(o,r,e):((t,i,n)=>{let s=i.hasOwnProperty(n);return i.constructor.createProperty(n,t),s?Object.getOwnPropertyDescriptor(i,n):void 0})(o,r,e)}function k(o){return g({...o,state:!0,attribute:!1})}var rt=(o,r,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof r!="object"&&Object.defineProperty(o,r,e),e);function Zt(o,r){return(e,t,i)=>{let n=s=>s.renderRoot?.querySelector(o)??null;if(r){let{get:s,set:a}=typeof t=="object"?e:i??(()=>{let l=Symbol();return{get(){return this[l]},set(c){this[l]=c}}})();return rt(e,t,{get(){let l=s.call(this);return l===void 0&&(l=n(this),(l!==null||this.hasUpdated)&&a.call(this,l)),l}})}return rt(e,t,{get(){return n(this)}})}}function Ya(o){return(r,e)=>{let{slot:t,selector:i}=o??{},n="slot"+(t?`[name=${t}]`:":not([name])");return rt(r,e,{get(){let s=this.renderRoot?.querySelector(n),a=s?.assignedElements(o)??[];return i===void 0?a:a.filter(l=>l.matches(i))}})}}var it=Symbol("computedItemContext");var G=Symbol("computedContext");var ne=Symbol("configContext");var Ja=[{identifier:"completionStatus",cardinality:"single",baseType:"string",value:"unknown",type:"outcome"},{identifier:"numAttempts",cardinality:"single",baseType:"integer",value:"0",type:"response"}];var W=Symbol("item");var tp=/^[A-Za-z0-9-]+$/,rp=o=>typeof o=="string"&&tp.test(o),th=o=>rp(o)?o:void 0,be=Symbol("qtiContext");var es={view:"candidate"},nt=Symbol("testContext");var ts={items:[],testOutcomeVariables:[]},_e=Symbol("testContext");function B(o,r){let e={waitUntilFirstUpdate:!1,...r};return(t,i)=>{let{update:n}=t,s=Array.isArray(o)?o:[o];t.update=function(a){s.forEach(l=>{let c=l;if(a.has(c)){let p=a.get(c),u=this[c];p!==u&&(!e.waitUntilFirstUpdate||this.hasUpdated)&&this[i](p,u)}}),n.call(this,a)}}}var er={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},we=o=>(...r)=>({_$litDirective$:o,values:r}),ot=class{constructor(r){}get _$AU(){return this._$AM._$AU}_$AT(r,e,t){this._$Ct=r,this._$AM=e,this._$Ci=t}_$AS(r,e){return this.update(r,e)}update(r,e){return this.render(...e)}};var{I:ip}=Xa,Ka=o=>o,el=o=>o===null||typeof o!="object"&&typeof o!="function";var tl=o=>o.strings===void 0,Za=()=>document.createComment(""),tr=(o,r,e)=>{let t=o._$AA.parentNode,i=r===void 0?o._$AB:r._$AA;if(e===void 0){let n=t.insertBefore(Za(),i),s=t.insertBefore(Za(),i);e=new ip(n,s,o,o.options)}else{let n=e._$AB.nextSibling,s=e._$AM,a=s!==o;if(a){let l;e._$AQ?.(o),e._$AM=o,e._$AP!==void 0&&(l=o._$AU)!==s._$AU&&e._$AP(l)}if(n!==i||a){let l=e._$AA;for(;l!==n;){let c=Ka(l).nextSibling;Ka(t).insertBefore(l,i),l=c}}}return e},st=(o,r,e=o)=>(o._$AI(r,e),o),np={},rl=(o,r=np)=>o._$AH=r,il=o=>o._$AH,vn=o=>{o._$AR(),o._$AA.remove()};var jr=(o,r)=>{let e=o._$AN;if(e===void 0)return!1;for(let t of e)t._$AO?.(r,!1),jr(t,r);return!0},yn=o=>{let r,e;do{if((r=o._$AM)===void 0)break;e=r._$AN,e.delete(o),o=r}while(e?.size===0)},nl=o=>{for(let r;r=o._$AM;o=r){let e=r._$AN;if(e===void 0)r._$AN=e=new Set;else if(e.has(o))break;e.add(o),ap(r)}};function op(o){this._$AN!==void 0?(yn(this),this._$AM=o,nl(this)):this._$AM=o}function sp(o,r=!1,e=0){let t=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(r)if(Array.isArray(t))for(let n=e;n<t.length;n++)jr(t[n],!1),yn(t[n]);else t!=null&&(jr(t,!1),yn(t));else jr(this,o)}var ap=o=>{o.type==er.CHILD&&(o._$AP??=sp,o._$AQ??=op)},at=class extends ot{constructor(){super(...arguments),this._$AN=void 0}_$AT(r,e,t){super._$AT(r,e,t),nl(this),this.isConnected=r._$AU}_$AO(r,e=!0){r!==this.isConnected&&(this.isConnected=r,r?this.reconnected?.():this.disconnected?.()),e&&(jr(this,r),yn(this))}setValue(r){if(tl(this._$Ct))this._$Ct._$AI(r,this);else{let e=[...this._$Ct._$AH];e[this._$Ci]=r,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}};var rs=class extends at{constructor(){super(...arguments);this.prevData={}}render(e){return O}update(e,[t]){return this.element!==e.element&&(this.element=e.element),this.host=e.options?.host||this.element,this.apply(t),this.groom(t),this.prevData={...t},O}apply(e){let t=this.#e(e),{prevData:i,element:n}=this;for(let s in t){let a=t[s];a!==i[s]&&(a===!0?n.setAttribute(s,""):a===!1?n.removeAttribute(s):a!=null?n.setAttribute(s,String(a)):n.removeAttribute(s))}}groom(e){let{prevData:t,element:i}=this;if(!t)return;let n=e?this.#e(e):{};for(let s in t)(!n||!(s in n))&&i.removeAttribute(s)}#e(e){return Object.fromEntries(Object.entries(e).filter(([t,i])=>typeof i=="function"?!1:t==="max-choices"&&i===0?!0:!(i===""||i===null||i===void 0)))}},Mh=we(rs);var ol=(t=>(t.Correct="correct",t.PartiallyCorrect="partially-correct",t.Incorrect="incorrect",t))(ol||{}),V=class extends E{constructor(){super();this.disabled=!1;this.readonly=!1;this.showCorrectResponse=!1;this._handleShowCorrectResponseChange=(e,t)=>{this.toggleInternalCorrectResponse(t)};this.showFullCorrectResponse=!1;this._handleShowFullCorrectResponseChange=(e,t)=>{this.toggleFullCorrectResponse(t)};this.showCandidateCorrection=!1;this._handleShowCandidateCorrectionChange=(e,t)=>{this.toggleCandidateCorrection(t)};this._correctResponse=null;this._internals=this.attachInternals()}static{this.formAssociated=!0}get internals(){return this._internals}set correctResponseAttr(e){e===null?this._correctResponse=null:e.includes(",")?this._correctResponse=e.split(",").map(t=>t.trim()):this._correctResponse=e}get correctResponseAttr(){return this._correctResponse===null||this._correctResponse===void 0?null:Array.isArray(this._correctResponse)?this._correctResponse.join(","):this._correctResponse}get isFullCorrectResponse(){return this._isFullCorrectResponse}set isFullCorrectResponse(e){this._isFullCorrectResponse=e,e&&(this.disabled=!0,this.setAttribute("inert",""),this.setAttribute("response-identifier",this.responseIdentifier+"_cr"))}get correctResponse(){let e=this.responseVariable;return e?.correctResponse?e.correctResponse:this._correctResponse}set correctResponse(e){let t=this._correctResponse;this._correctResponse=e,e==null?this.removeAttribute("correct-response"):this.setAttribute("correct-response",Array.isArray(e)?e.join(","):e),this.requestUpdate("_correctResponse",t)}get correctness(){let e=this.correctResponse;if(!e)return null;let t=this.response;if(t==null||t===""||Array.isArray(t)&&t.length===0)return null;let i=Array.isArray(e)?e:[e],s=(Array.isArray(t)?t:[t]).filter(c=>c!=="");if(s.length===0)return null;let a=s.filter(c=>i.includes(c)).length,l=s.filter(c=>!i.includes(c)).length;return a===i.length&&l===0&&s.length===i.length?"correct":a>0&&(a<i.length||l>0)?"partially-correct":"incorrect"}get isInline(){return!1}get responseVariable(){if(!this._context?.variables)return;let e=this._context.variables.filter(i=>i.type==="response"),t=this.getAttribute("response-identifier");return e.find(i=>i.identifier===t)}toggleCorrectResponse(e){(this?.configContext?.correctResponseMode||"internal")==="full"?this.toggleFullCorrectResponse(e):this.toggleInternalCorrectResponse(e)}async toggleFullCorrectResponse(e){let t=this.nextSibling,i=t instanceof HTMLDivElement&&t?.classList.contains("full-correct-response"),n=this.correctResponse;if(!n)return;if(!(e&&(this?.configContext?.fullCorrectResponseOnlyWhenIncorrect===!1||this.correctness!=="correct"))){if(!i)return;this.parentElement?.removeChild(t);return}if(i)return;let a=this.cloneNode(!0);a.removeAttribute("show-full-correct-response"),a.removeAttribute("show-correct-response"),a.removeAttribute("show-candidate-correction");let l=document.createElement("div");l.classList.add("full-correct-response"),this.isInline?l.classList.add("full-correct-response-inline"):l.classList.add("full-correct-response-block"),l.role="full-correct-response",l.appendChild(a),a.isFullCorrectResponse=!0,this.parentElement?.insertBefore(l,this.nextSibling),await a.updateComplete,a.response=Array.isArray(n)?[...n]:n}toggleInternalCorrectResponse(e){this._internals.states.delete("show-correct-response"),e&&this.correctResponse&&this._internals.states.add("show-correct-response")}toggleCandidateCorrection(e){this._internals.states.delete("candidate-correct"),this._internals.states.delete("candidate-partially-correct"),this._internals.states.delete("candidate-incorrect"),e&&(this.correctness==="correct"&&this._internals.states.add("candidate-correct"),this.correctness==="partially-correct"&&this._internals.states.add("candidate-partially-correct"),this.correctness==="incorrect"&&this._internals.states.add("candidate-incorrect"))}get value(){return JSON.stringify(this.response)}set value(e){this.response=e?JSON.parse(e):null}reportValidity(){return this._internals.reportValidity()}reset(){this.response=null}formResetCallback(){this.reset()}connectedCallback(){super.connectedCallback(),!this.isFullCorrectResponse&&this.dispatchEvent(new CustomEvent("qti-register-interaction",{bubbles:!0,composed:!0,cancelable:!1,detail:{interactionElement:this,responseIdentifier:this.responseIdentifier}}))}firstUpdated(){this.isFullCorrectResponse||(this.showCorrectResponse&&this.toggleInternalCorrectResponse(!0),this.showFullCorrectResponse&&this.toggleFullCorrectResponse(!0),this.showCandidateCorrection&&this.toggleCandidateCorrection(!0))}saveResponse(e,t){this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,cancelable:!1,detail:{responseIdentifier:this.responseIdentifier,response:Array.isArray(e)?[...e]:e,...t!==void 0?{state:t}:{}}}))}};d([$({context:W,subscribe:!0})],V.prototype,"_context",2),d([$({context:ne,subscribe:!0})],V.prototype,"configContext",2),d([g({type:String,attribute:"response-identifier"})],V.prototype,"responseIdentifier",2),d([g({reflect:!0,type:Boolean})],V.prototype,"disabled",2),d([g({reflect:!0,type:Boolean})],V.prototype,"readonly",2),d([g({type:String})],V.prototype,"name",2),d([g({type:String,attribute:"correct-response",reflect:!0})],V.prototype,"correctResponseAttr",1),d([g({type:Boolean,attribute:"show-correct-response",reflect:!0})],V.prototype,"showCorrectResponse",2),d([B("showCorrectResponse",{waitUntilFirstUpdate:!0})],V.prototype,"_handleShowCorrectResponseChange",2),d([g({type:Boolean,attribute:"show-full-correct-response",reflect:!0})],V.prototype,"showFullCorrectResponse",2),d([B("showFullCorrectResponse",{waitUntilFirstUpdate:!0})],V.prototype,"_handleShowFullCorrectResponseChange",2),d([g({type:Boolean,attribute:"show-candidate-correction",reflect:!0})],V.prototype,"showCandidateCorrection",2),d([B("showCandidateCorrection",{waitUntilFirstUpdate:!0})],V.prototype,"_handleShowCandidateCorrectionChange",2),d([k()],V.prototype,"_isFullCorrectResponse",2),d([k()],V.prototype,"_correctResponse",2);var rr=class extends E{render(){return x`<slot></slot>`}defaultValues(r){let e=Array.from(this.querySelectorAll("qti-default-value > qti-value"));if(e.length===0)return null;let t=e.map(i=>i.innerHTML.trim());return t.length>1||r==="multiple"||r==="ordered"?t:t[0]}};var I=class extends E{constructor(){super(...arguments);this.getVariables=()=>Array.from(this.children).map(e=>{switch(console.debug("getVariables",e.tagName.toLowerCase()),e.tagName.toLowerCase()){case"qti-base-value":return{baseType:e.getAttribute("base-type"),value:e.textContent.trim(),cardinality:"single"};case"qti-variable":{let t=e.getAttribute("identifier")||"";return t==="QTI_CONTEXT"?this.qtiContext?.QTI_CONTEXT?{identifier:"QTI_CONTEXT",baseType:"record",value:this.qtiContext.QTI_CONTEXT,cardinality:"record",type:"context"}:(console.warn("QTI_CONTEXT not available"),{identifier:"QTI_CONTEXT",baseType:"record",value:this.qtiContext.QTI_CONTEXT,cardinality:"record",type:"context"}):this.context.variables.find(n=>n.identifier===t)||null}case"qti-multiple":{let i=e.getResult();return console.debug("values",i),i?.length>0?{identifier:"",baseType:i[0].baseType,value:i.map(n=>n.value),cardinality:"multiple",type:"response"}:null}case"qti-ordered":{let i=e.getResult();return i?.length>0?{identifier:"",baseType:i[0].baseType,value:i.map(n=>n.value),cardinality:"ordered",type:"response"}:null}case"qti-repeat":{let i=e.getResult();return i?.length>0?i:null}case"qti-correct":{let t=e.getAttribute("identifier")||"",i=this.context?.variables?.find(n=>n.identifier===t)||null;return{baseType:i.baseType,value:i.correctResponse,cardinality:i.cardinality}}default:{try{return{baseType:"integer",value:e.getResult()?.toString()||null,cardinality:"single"}}catch{console.warn("default not sufficient")}return null}}}).flatMap(e=>Array.isArray(e)?e:[e]).filter(e=>e!==null)}static{this.styles=C`
5
5
  slot {
6
6
  display: none;
7
7
  }
8
8
  `}render(){return x`<pre>${JSON.stringify(this.result,null,2)}</pre>
9
- <slot></slot>`}calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};d([M()],R.prototype,"result",2),d([$({context:W,subscribe:!0}),M()],R.prototype,"context",2),d([$({context:ir,subscribe:!0}),M()],R.prototype,"qtiContext",2);var be=class extends R{calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};var Xd=()=>new Intl.NumberFormat().format(.1).replace(/\d/g,""),we=s=>{if(typeof s=="string")return s;let r=Xd();return r==="."?s.toLocaleString():s.toString().replace(".","").replace(r,".")};function Zo(s){return s==null}function bn(s){return s.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}var de=class extends E{constructor(){super(...arguments);this.showHide="show"}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-feedback",{bubbles:!0,composed:!0,detail:this}))}checkShowFeedback(e){let t=this._context.variables.find(n=>n.identifier===e)||null;if(this.outcomeIdentifier!==e||!t)return;let i=!1;Array.isArray(t.value)?i=t.value.includes(this.identifier):i=!Zo(this.identifier)&&!Zo(t?.value)&&this.identifier===t.value||!1,this.#e(i)}#e(e){this.showStatus=e&&this.showHide==="show"||!e&&this.showHide==="hide"?"on":"off"}};d([g({type:String,attribute:"show-hide"})],de.prototype,"showHide",2),d([g({type:String,attribute:"outcome-identifier"})],de.prototype,"outcomeIdentifier",2),d([g({type:String})],de.prototype,"identifier",2),d([g({type:String,attribute:!1})],de.prototype,"showStatus",2),d([$({context:W,subscribe:!0}),M()],de.prototype,"_context",2);var cl=class extends E{};var J=class{static isPointInArea(r,e,t){if(t!=="point")return console.warn(`Base type ${t} is not supported for point area mapping.`),!1;let[i,n]=r.split(" ").map(Number),[o,...a]=e.split(","),l=a.map(Number);switch(o.toLowerCase()){case"circle":case"default":{let[c,p,u]=l;return l.length!==3?(console.warn(`Invalid circle definition: ${e}`),!1):Math.sqrt((i-c)**2+(n-p)**2)<=u}case"rect":{let[c,p,u,m]=l;return l.length!==4?(console.warn(`Invalid rectangle definition: ${e}`),!1):i>=c&&i<=u&&n>=p&&n<=m}case"ellipse":{let[c,p,u,m]=l;if(l.length!==4)return console.warn(`Invalid ellipse definition: ${e}`),!1;let y=(i-c)**2/u**2,b=(n-p)**2/m**2;return y+b<=1}case"poly":{if(l.length<6||l.length%2!==0)return console.warn(`Invalid polygon definition: ${e}`),!1;let c=[];for(let p=0;p<l.length;p+=2)c.push({x:l[p],y:l[p+1]});return this.isPointInPolygon({x:i,y:n},c)}default:return console.warn(`Unsupported shape type: ${o}`),!1}}static isPointInPolygon(r,e){let t=!1;for(let i=0,n=e.length-1;i<e.length;n=i++){let o=e[i].x,a=e[i].y,l=e[n].x,c=e[n].y;a>r.y!=c>r.y&&r.x<(l-o)*(r.y-a)/(c-a)+o&&(t=!t)}return t}static compareSingleValues(r,e,t){switch(t){case"identifier":case"string":return r===e;case"integer":{let i=parseInt(r,10),n=parseInt(e,10);if(!isNaN(i)&&!isNaN(n))return i===n;console.error(`Cannot convert ${r} and/or ${e} to int.`);break}case"float":{let i=parseFloat(r),n=parseFloat(e);if(!isNaN(i)&&!isNaN(n))return i===n;console.error(`couldn't convert ${r} and/or ${e} to float.`);break}case"pair":case"directedPair":{let i=r.split(" ").sort(),n=e.split(" ").sort();if(i.length===2&&n.length===2)return t==="pair"&&(i.sort(),n.sort()),i.join(" ")===n.join(" ");console.error(`compared two pair but one of the values does not have 2 values: 1: ${r} 2: ${e}`);break}}return!1}};var es=s=>{class r extends s{constructor(...i){super(...i);this.testContext=Jo;this.sessionContext=Yo;this._updateItemInTestContext=i=>{let n=i._context,o=n.identifier,a=n.variables,l=this.testContext.items.find(c=>c?.identifier===o);if(!l){console.warn(`Item IDs between assessment.xml and item.xml should match: ${o} is not found!`);return}if(l.variables?.length===1)this._updateItemVariablesInTestContext(o,a);else{let c=[...i.variables];for(let p of l.variables){let u=c.find(m=>m.identifier===p.identifier);u?u.value=p.value:c.push(p)}i.variables=c}};this._initializeEventListeners()}updateItemVariables(i,n){let o=this.testContext.items.find(l=>l.identifier===i);o&&(o.variables=o.variables.map(l=>{let c=n.find(p=>p.identifier===l.identifier);return c?{...l,...c}:l}));let a=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${i}"]`);a&&a.assessmentItem&&(a.assessmentItem.variables=n)}_initializeEventListeners(){this.addEventListener("qti-assessment-test-connected",i=>{if(this.testContext=Jo,this.sessionContext=Yo,this.testContext&&this.testContext.items.length>0)return;this._testElement=i.detail;let n=Array.from(this._testElement.querySelectorAll("qti-assessment-item-ref")).map(o=>({href:o.href,identifier:o.identifier,category:o.category,variables:[{identifier:"completionStatus",value:"not_attempted",type:"outcome"}]}));this.testContext={...this.testContext,items:n}}),this.addEventListener("qti-assessment-item-connected",i=>{let n=i.detail,o=n.closest("qti-assessment-item-ref")?.identifier;o&&(n.assessmentItemRefId=o),this._updateItemInTestContext(i.detail)}),this.addEventListener("qti-item-context-updated",i=>{this._updateItemVariablesInTestContext(i.detail.itemContext.identifier,i.detail.itemContext.variables,i.detail.itemContext.state)})}_updateItemVariablesInTestContext(i,n,o){this.testContext={...this.testContext,items:this.testContext.items.map(a=>a.identifier!==i?a:{...a,variables:n.map(l=>{let c=a.variables.find(p=>p.identifier===l.identifier);return c?{...c,...l}:l}),...o!==void 0?{state:o?{...o}:void 0}:{}})},this.dispatchEvent(new CustomEvent("qti-test-context-updated",{detail:this.testContext,bubbles:!1,composed:!1}))}}return d([g({attribute:!1,type:Object}),ce({context:_e})],r.prototype,"testContext",2),d([g({attribute:!1,type:Object}),ce({context:it})],r.prototype,"sessionContext",2),r},dl=class extends es(E){};var pl=s=>{class r extends s{constructor(...t){super(...t),this.addEventListener("qti-register-variable",i=>{this.testContext={...this.testContext,testOutcomeVariables:[...this.testContext.testOutcomeVariables||[],i.detail.variable]},i.stopPropagation()}),this.addEventListener("qti-set-outcome-value",i=>{let{outcomeIdentifier:n,value:o}=i.detail;this.updateOutcomeVariable(n,o),i.stopPropagation()})}outcomeProcessing(){let t=this.querySelector("qti-outcome-processing");return t?(t?.process(),!0):!1}updateOutcomeVariable(t,i){let n=this.getOutcome(t);if(!n){console.warn(`Can not set qti-outcome-identifier: ${t}, it is not available`);return}this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(o=>o.identifier!==t?o:{...o,value:n.cardinality==="single"?i:[...o.value,i]})}}getOutcome(t){return this.getVariable(t)}getVariable(t){return this.testContext.testOutcomeVariables?.find(i=>i.identifier===t)||null}}return r};var vn=class extends Ka(Za(pl(es(E)))){async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-test-connected",{detail:this}))}render(){return x`<slot></slot>`}};vn=d([k("qti-test")],vn);var ul={fromAttribute(s){return s==="true"},toAttribute(s){return s?"true":"false"}},Be=class extends E{constructor(){super(...arguments);this.weigths=new Map}createRenderRoot(){return this}get assessmentItem(){return this.renderRoot?.querySelector("qti-assessment-item")}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-assessment-item-ref-connected",{bubbles:!0,composed:!0,detail:{identifier:this.identifier,href:this.href,category:this.category}}))}render(){return this.myTemplate?this.myTemplate({xmlDoc:this.xmlDoc}):this.xmlDoc}};d([g({type:String})],Be.prototype,"category",2),d([g({type:String})],Be.prototype,"identifier",2),d([g({type:Boolean,converter:ul})],Be.prototype,"required",2),d([g({type:Boolean,converter:ul})],Be.prototype,"fixed",2),d([g({type:String})],Be.prototype,"href",2),d([g({type:Object,attribute:!1})],Be.prototype,"xmlDoc",2);customElements.get("qti-assessment-item-ref")||customElements.define("qti-assessment-item-ref",Be);var ts={fromAttribute(s){return s==="true"},toAttribute(s){return s?"true":"false"}},ze=class extends E{get title(){return this.#e}set title(r){this.#e=r,this.removeAttribute("title"),this.setAttribute("data-title",r)}#e="";async connectedCallback(){this.#e=this.getAttribute("title")||"",super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-assessment-section-connected",{bubbles:!0,composed:!0}))}render(){return x`<slot name="qti-rubric-block"></slot><slot></slot>`}};d([g({type:String})],ze.prototype,"identifier",2),d([g({type:String})],ze.prototype,"required",2),d([g({type:Boolean,converter:ts})],ze.prototype,"fixed",2),d([g({type:Boolean,converter:ts})],ze.prototype,"visible",2),d([g({type:Boolean,converter:ts,attribute:"keep-together"})],ze.prototype,"keepTogether",2),d([$({context:_e,subscribe:!0})],ze.prototype,"_testContext",2);customElements.get("qti-assessment-section")||customElements.define("qti-assessment-section",ze);var jr,_t=class extends E{constructor(){super(...arguments);L(this,jr,"")}get title(){return I(this,jr)}set title(e){U(this,jr,e),this.removeAttribute("title"),this.setAttribute("data-title",e)}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-assessment-test-connected",{detail:this,bubbles:!0,composed:!0}))}render(){return x` <slot></slot>`}};jr=new WeakMap,d([g({type:String})],_t.prototype,"identifier",2),d([g({type:String})],_t.prototype,"title",1),d([$({context:_e,subscribe:!0})],_t.prototype,"_testContext",2),_t=d([k("qti-assessment-test")],_t);var Wr,je=class extends E{constructor(){super(...arguments);this.identifier="";this.class="";this.navigationMode="nonlinear";this.submissionMode="individual";L(this,Wr,"")}get title(){return I(this,Wr)}set title(e){U(this,Wr,e),this.removeAttribute("title"),this.setAttribute("data-title",e)}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-test-part-connected",{bubbles:!0,composed:!0}))}render(){return x` <slot></slot>`}};Wr=new WeakMap,d([g({type:String})],je.prototype,"identifier",2),d([g({type:String})],je.prototype,"class",2),d([g({type:String,attribute:"navigation-mode"})],je.prototype,"navigationMode",2),d([g({type:String,attribute:"submission-mode"})],je.prototype,"submissionMode",2),je=d([k("qti-test-part")],je);customElements.get("qti-test-part")||customElements.define("qti-test-part",je);var Gr,ar,lr,cr,ve,ue,ml,hl,Xr,Qr,Yr,Jr,Kr,Zr,ei,ti,fl,rs,gl,pe=class extends E{constructor(){super(...arguments);L(this,ue);L(this,Gr);L(this,ar,null);this.identifier="";this.adaptive="false";this.timeDependent=null;this._handleDisabledChange=(e,t)=>{I(this,ve).forEach(i=>i.disabled=t)};this._handleReadonlyChange=(e,t)=>I(this,ve).forEach(i=>i.readonly=t);this._context={variables:el};L(this,lr,{...this._context,variables:this._context.variables});L(this,cr,[]);L(this,ve,[]);L(this,Xr,e=>{e.stopImmediatePropagation(),this._context={...this._context,variables:[...this._context.variables,e.detail.variable]},U(this,lr,this._context),e.stopPropagation()});L(this,Qr,e=>{e.stopImmediatePropagation();let t=e.detail;I(this,cr).push(t),(Number(this._context.variables.find(n=>n.identifier==="numAttempts")?.value)||0)>0&&t.checkShowFeedback(t.outcomeIdentifier)});L(this,Yr,e=>{e.stopImmediatePropagation(),I(this,ve).push(e.detail.interactionElement)});L(this,Jr,e=>{e.stopImmediatePropagation();let{responseIdentifier:t,countAttempt:i}=e.detail;this.validate(),this.updateResponseVariable(t,"true"),this.processResponse(i)});L(this,Kr,e=>{e.stopImmediatePropagation();let{outcomeIdentifier:t,value:i}=e.detail;this.updateOutcomeVariable(t,i),e.stopPropagation()});L(this,Zr,e=>{e.stopImmediatePropagation();let{templateIdentifier:t,value:i}=e.detail;this.updateTemplateVariable(t,i??void 0),e.stopPropagation()});L(this,ei,e=>{e.stopImmediatePropagation();let{responseIdentifier:t,value:i}=e.detail;this.updateCorrectResponse(t,i??void 0),e.stopPropagation()});L(this,ti,e=>{e.stopImmediatePropagation();let{responseIdentifier:t,response:i,state:n}=e.detail;this.updateResponseVariable(t,i),n!==void 0&&(this._context={...this._context,state:{...this._context.state||{},[t]:n}}),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))})}get title(){return I(this,Gr)}set title(e){U(this,Gr,e),this.removeAttribute("title"),this.setAttribute("data-title",e)}set assessmentItemRefId(e){this._context={...this._context,identifier:e}}get assessmentItemRefId(){return this._context.identifier}get variables(){return this._context.variables.map(e=>({identifier:e.identifier,value:e.value,type:e.type,...e.type==="outcome"&&e.identifier==="SCORE"?{externalScored:e.externalScored}:{}}))}set variables(e){if(!Array.isArray(e)||e.some(t=>!("identifier"in t))){console.warn("variables property should be an array of VariableDeclaration");return}this._context={...this._context,variables:this._context.variables.map(t=>{let i=e.find(n=>n.identifier===t.identifier);return i?{...t,...i,interpolationTable:t.interpolationTable}:t})},this._context.variables.forEach(t=>{if(t.type==="response"){let i=I(this,ve).find(n=>n.responseIdentifier===t.identifier);i&&(i.response=t.value)}}),this.variables.forEach(t=>{t.type==="outcome"&&I(this,cr).forEach(i=>i.checkShowFeedback(t.identifier))})}get state(){return this._context.state}set state(e){this._context={...this._context,state:e?{...e}:void 0}}set responses(e){if(e)for(let t of e){this.getResponse(t.responseIdentifier)&&this.updateResponseVariable(t.responseIdentifier,t.response);let n=I(this,ve).find(o=>o.getAttribute("response-identifier")===t.responseIdentifier);n&&(n.response=t.response)}}render(){return x`<slot></slot>`}connectedCallback(){P(this,ue,ml).call(this),super.connectedCallback(),this.updateComplete.then(()=>{this.dispatchEvent(new CustomEvent("qti-assessment-item-connected",{bubbles:!0,composed:!0,detail:this})),P(this,ue,fl).call(this)})}disconnectedCallback(){P(this,ue,hl).call(this),super.disconnectedCallback()}showCorrectResponse(e){for(let t of I(this,ve))t.toggleCorrectResponse(e);document.querySelectorAll("item-show-correct-response").forEach(t=>{t.shown=e})}showCandidateCorrection(e){for(let t of I(this,ve))t.toggleCandidateCorrection(e);document.querySelectorAll("item-show-candidate-correction").forEach(t=>{t.shown=e})}processResponse(e=!0,t=!0){this.validate(t),e&&this.updateOutcomeVariable("numAttempts",(+this._context.variables.find(o=>o.identifier==="numAttempts")?.value+1).toString()),this.adaptive==="false"&&P(this,ue,gl).call(this);let i=this.querySelector("qti-response-processing"),n=!!(i&&typeof i.process=="function");return n&&i.process(),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",P(this,ue,rs).call(this)),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}})),n}resetResponses(){this._context=I(this,lr)}getResponse(e){return this.getVariable(e)}getOutcome(e){return this.getVariable(e)}getVariable(e){return this._context.variables.find(t=>t.identifier===e)||null}updateResponseVariable(e,t){this._context={...this._context,variables:this._context.variables.map(i=>i.identifier!==e?i:{...i,value:t})},this.showCandidateCorrection(!1),this.dispatchEvent(new CustomEvent("qti-interaction-changed",{bubbles:!0,composed:!0,detail:{item:this.identifier,responseIdentifier:e,response:Array.isArray(t)?[...t]:t}})),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",P(this,ue,rs).call(this))}updateTemplateVariable(e,t){let i=this._context.variables.find(o=>o.identifier===e&&o.type==="template");if(!i){console.warn(`Can not set qti-template-identifier: ${e}, it is not available`);return}let n=i.cardinality==="single"?Array.isArray(t)?t[0]:t??null:t==null?null:Array.isArray(t)?t:[t];this._context={...this._context,variables:this._context.variables.map(o=>o.identifier!==e?o:{...o,value:n})},this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}updateCorrectResponse(e,t){let i=this.getResponse(e);if(!i){console.warn(`Can not set correct response for identifier: ${e}, it is not available`);return}let n=i.cardinality==="single"?Array.isArray(t)?t[0]:t??null:t==null?null:Array.isArray(t)?t:[t];this._context={...this._context,variables:this._context.variables.map(o=>o.identifier!==e?o:{...o,correctResponse:n})},this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}setOutcomeVariable(e,t){this.updateOutcomeVariable(e,t),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}updateOutcomeVariable(e,t){let i=this.getOutcome(e);if(!i){console.warn(`Can not set qti-outcome-identifier: ${e}, it is not available`);return}this._context={...this._context,variables:this._context.variables.map(n=>n.identifier!==e?n:{...n,value:i.cardinality==="single"||Array.isArray(t)?t:[t]})},I(this,cr).forEach(n=>n.checkShowFeedback(e)),this.dispatchEvent(new CustomEvent("qti-outcome-changed",{bubbles:!0,composed:!0,detail:{item:this.identifier,outcomeIdentifier:e,value:this._context.variables.find(n=>n.identifier===e)?.value}}))}validate(e=!0){let t=I(this,ve).every(i=>i.validate());return e&&this.reportValidity(),t}reportValidity(){for(let e of I(this,ve))e.reportValidity()}};Gr=new WeakMap,ar=new WeakMap,lr=new WeakMap,cr=new WeakMap,ve=new WeakMap,ue=new WeakSet,ml=function(){this.addEventListener("qti-register-variable",I(this,Xr)),this.addEventListener("qti-register-feedback",I(this,Qr)),this.addEventListener("qti-register-interaction",I(this,Yr)),this.addEventListener("end-attempt",I(this,Jr)),this.addEventListener("qti-set-outcome-value",I(this,Kr)),this.addEventListener("qti-set-template-value",I(this,Zr)),this.addEventListener("qti-set-correct-response",I(this,ei)),this.addEventListener("qti-interaction-response",I(this,ti))},hl=function(){this.removeEventListener("qti-register-variable",I(this,Xr)),this.removeEventListener("qti-register-feedback",I(this,Qr)),this.removeEventListener("qti-register-interaction",I(this,Yr)),this.removeEventListener("end-attempt",I(this,Jr)),this.removeEventListener("qti-set-outcome-value",I(this,Kr)),this.removeEventListener("qti-set-template-value",I(this,Zr)),this.removeEventListener("qti-set-correct-response",I(this,ei)),this.removeEventListener("qti-interaction-response",I(this,ti))},Xr=new WeakMap,Qr=new WeakMap,Yr=new WeakMap,Jr=new WeakMap,Kr=new WeakMap,Zr=new WeakMap,ei=new WeakMap,ti=new WeakMap,fl=async function(){let e=Array.from(this.querySelectorAll("qti-template-declaration"));e.length>0&&(await Promise.all(e.map(t=>t.updateComplete)),await Promise.resolve()),U(this,ar,this.querySelector("qti-template-processing")),I(this,ar)&&(I(this,ar).process(),U(this,lr,{...this._context,variables:this._context.variables}))},rs=function(){let e=this.validate(!1);return e===!0?"completed":e===!1?"incomplete":"not_attempted"},gl=function(){this._context={...this._context,variables:this._context.variables.map(e=>{if(e.type!=="outcome")return e;let n=("defaultValue"in e?e.defaultValue:null)??null;return n==null&&(e.baseType==="integer"||e.baseType==="float")&&(n="0"),{...e,value:n}})}},d([g({type:String})],pe.prototype,"identifier",2),d([g({type:String})],pe.prototype,"adaptive",2),d([g({type:String})],pe.prototype,"timeDependent",2),d([g({type:String})],pe.prototype,"title",1),d([g({type:Boolean})],pe.prototype,"disabled",2),d([B("disabled",{waitUntilFirstUpdate:!0})],pe.prototype,"_handleDisabledChange",2),d([g({type:Boolean})],pe.prototype,"readonly",2),d([B("readonly",{waitUntilFirstUpdate:!0})],pe.prototype,"_handleReadonlyChange",2),d([ce({context:W})],pe.prototype,"_context",2),pe=d([k("qti-assessment-item")],pe);var is=class s extends Event{constructor(e,t){super(s.eventName,{bubbles:!0,composed:!0,cancelable:!0});this.element=e;this.item=t}static{this.eventName="qti-assessment-stimulus-ref-connected"}},dr=class extends E{constructor(){super(...arguments);this.identifier="";this.href=""}async connectedCallback(){super.connectedCallback(),await this.updateComplete;let e=this.closest("qti-assessment-item"),t=new is(this,e);this.dispatchEvent(t);let i=e?.querySelector(`[data-stimulus-idref="${this.identifier}"]`);!t.defaultPrevented&&i&&await this.updateStimulusRef(i)}async updateStimulusRef(e){let t=await Me().load(this.href).then(i=>i.htmlDoc());if(t){let i=t.querySelectorAll("qti-stimulus-body, qti-stylesheet");e.innerHTML="",e.append(...i)}}};d([g({type:String})],dr.prototype,"identifier",2),d([g({type:String})],dr.prototype,"href",2),dr=d([k("qti-assessment-stimulus-ref")],dr);var yn=class extends E{};yn=d([k("qti-companion-materials-info")],yn);var ii,ri=class extends E{constructor(){super(...arguments);L(this,ii)}render(){return x`<slot @slotchange=${this.handleSlotChange}></slot>`}handleSlotChange(){let e=Array.from(this.firstElementChild?.childNodes??[]).find(t=>t.nodeType===Node.COMMENT_NODE);try{U(this,ii,new Function("context","fn","item",e?.textContent??""))}catch(t){console.error("custom-operator contains invalid javascript code",t)}}calculate(){let e={variable:i=>this._context?.variables.find(n=>n.identifier===i)?.value??"",correct:i=>this._context?.variables.find(n=>n.identifier===i)?.correctResponse??""},t={getVariable:i=>this._context?.variables.find(n=>n.identifier===i),updateOutcomeVariable:(i,n)=>{this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:i,value:n}}))},updateResponseVariable:(i,n)=>{this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:i,response:n}}))}};return I(this,ii).call(this,this._context,e,t)}};ii=new WeakMap,d([$({context:W,subscribe:!0}),M()],ri.prototype,"_context",2),ri=d([k("qti-custom-operator")],ri);var ni=class extends de{render(){return x` <slot part="feedback" class="feedback ${this.showStatus}"></slot> `}connectedCallback(){super.connectedCallback(),this.checkShowFeedback(this.outcomeIdentifier)}};ni.styles=C`
9
+ <slot></slot>`}calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};d([k()],I.prototype,"result",2),d([$({context:W,subscribe:!0}),k()],I.prototype,"context",2),d([$({context:be,subscribe:!0}),k()],I.prototype,"qtiContext",2);var ve=class extends I{calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};var lp=()=>new Intl.NumberFormat().format(.1).replace(/\d/g,""),Ee=o=>{if(typeof o=="string")return o;let r=lp();return r==="."?o.toLocaleString():o.toString().replace(".","").replace(r,".")};function is(o){return o==null}function xn(o){return o.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}var pe=class extends E{constructor(){super(...arguments);this.showHide="show"}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-feedback",{bubbles:!0,composed:!0,detail:this}))}checkShowFeedback(e){let t=this._context.variables.find(n=>n.identifier===e)||null;if(this.outcomeIdentifier!==e||!t)return;let i=!1;Array.isArray(t.value)?i=t.value.includes(this.identifier):i=!is(this.identifier)&&!is(t?.value)&&this.identifier===t.value||!1,this.#e(i)}#e(e){this.showStatus=e&&this.showHide==="show"||!e&&this.showHide==="hide"?"on":"off"}};d([g({type:String,attribute:"show-hide"})],pe.prototype,"showHide",2),d([g({type:String,attribute:"outcome-identifier"})],pe.prototype,"outcomeIdentifier",2),d([g({type:String})],pe.prototype,"identifier",2),d([g({type:String,attribute:!1})],pe.prototype,"showStatus",2),d([$({context:W,subscribe:!0}),k()],pe.prototype,"_context",2);var sl=class extends E{};var J=class{static isPointInArea(r,e,t){if(t!=="point")return console.warn(`Base type ${t} is not supported for point area mapping.`),!1;let[i,n]=r.split(" ").map(Number),[s,...a]=e.split(","),l=a.map(Number);switch(s.toLowerCase()){case"circle":case"default":{let[c,p,u]=l;return l.length!==3?(console.warn(`Invalid circle definition: ${e}`),!1):Math.sqrt((i-c)**2+(n-p)**2)<=u}case"rect":{let[c,p,u,h]=l;return l.length!==4?(console.warn(`Invalid rectangle definition: ${e}`),!1):i>=c&&i<=u&&n>=p&&n<=h}case"ellipse":{let[c,p,u,h]=l;if(l.length!==4)return console.warn(`Invalid ellipse definition: ${e}`),!1;let v=(i-c)**2/u**2,y=(n-p)**2/h**2;return v+y<=1}case"poly":{if(l.length<6||l.length%2!==0)return console.warn(`Invalid polygon definition: ${e}`),!1;let c=[];for(let p=0;p<l.length;p+=2)c.push({x:l[p],y:l[p+1]});return this.isPointInPolygon({x:i,y:n},c)}default:return console.warn(`Unsupported shape type: ${s}`),!1}}static isPointInPolygon(r,e){let t=!1;for(let i=0,n=e.length-1;i<e.length;n=i++){let s=e[i].x,a=e[i].y,l=e[n].x,c=e[n].y;a>r.y!=c>r.y&&r.x<(l-s)*(r.y-a)/(c-a)+s&&(t=!t)}return t}static compareSingleValues(r,e,t){switch(t){case"identifier":case"string":return r===e;case"integer":{let i=parseInt(r,10),n=parseInt(e,10);if(!isNaN(i)&&!isNaN(n))return i===n;console.error(`Cannot convert ${r} and/or ${e} to int.`);break}case"float":{let i=parseFloat(r),n=parseFloat(e);if(!isNaN(i)&&!isNaN(n))return i===n;console.error(`couldn't convert ${r} and/or ${e} to float.`);break}case"pair":case"directedPair":{let i=r.split(" ").sort(),n=e.split(" ").sort();if(i.length===2&&n.length===2)return t==="pair"&&(i.sort(),n.sort()),i.join(" ")===n.join(" ");console.error(`compared two pair but one of the values does not have 2 values: 1: ${r} 2: ${e}`);break}}return!1}};function al(o){o.querySelectorAll('qti-custom-operator[class="js.org"] > qti-base-value').forEach(e=>{let t=document.createComment(e.textContent);e.replaceChild(t,e.firstChild)})}async function ll(o,r,e,t="qti-portable-custom-interaction"){let i=[],n=o.querySelectorAll(t);if(n.length===0)return;let s=null,a=null,l=async()=>{if(s===null)try{s=await e(r,"/modules/module_resolution.js")}catch{s=null}if(a===null)try{a=await e(r,"/modules/fallback_module_resolution.js")}catch{a=null}};for(let c of Array.from(n)){c.setAttribute("data-base-url",r);let p=c.getAttribute("custom-interaction-type-identifier");p&&i.includes(p)&&(p=p+i.length,c.setAttribute("custom-interaction-type-identifier",p),i.push(p)),p&&i.push(p);let u=c.querySelector("qti-interaction-modules");if(u&&u.getAttribute("primary-configuration")){await l();let h=u.getAttribute("primary-configuration");if(h)try{let v=await e(r,`/${h}`),y=Array.from(u.querySelectorAll("qti-interaction-module"));for(let w of y){let f=w.getAttribute("id");if(f&&v.paths&&v.paths[f]){let m=v.paths[f],b=Array.isArray(m)?m[0]:m;if(w.setAttribute("primary-path",b),a&&a.paths&&a.paths[f]){let q=a.paths[f];Array.isArray(q)?w.setAttribute("fallback-path",q[0]):w.setAttribute("fallback-path",q)}}}if(v.paths){for(let w in v.paths)if(!u.querySelector(`qti-interaction-module[id="${w}"]`)){let m=o.createElement("qti-interaction-module");m.setAttribute("id",w);let b=Array.isArray(v.paths[w])?v.paths[w][0]:v.paths[w];if(m.setAttribute("primary-path",b),a&&a.paths&&a.paths[w]){let q=a.paths[w];Array.isArray(q)?m.setAttribute("fallback-path",q[0]):m.setAttribute("fallback-path",q)}u.appendChild(m)}}v.urlArgs&&u.setAttribute("url-args",v.urlArgs)}catch(v){console.warn(`Failed to load primary configuration: ${h}`,v)}}else if(await l(),s){c.querySelector("qti-interaction-modules")===null?(u=o.createElement("qti-interaction-modules"),c.appendChild(u)):u=c.querySelector("qti-interaction-modules");for(let h in s.paths){let v=s.paths[h],y="";a&&a.paths&&a.paths[h]&&(y=a.paths[h]);let w=Array.isArray(v)?v:[v],f=Array.isArray(y)?y:[y],m=w.map((b,q)=>{let A=f.length>q?f[q]:"";return{primaryPath:b,fallbackPath:A}});for(let b of f)m.some(q=>q.fallbackPath===b)||m.push({primaryPath:w.length>0?w[0]:b,fallbackPath:b});for(let b of m){let q=o.createElement("qti-interaction-module");b.fallbackPath&&q.setAttribute("fallback-path",b.fallbackPath),q.setAttribute("id",h),q.setAttribute("primary-path",b.primaryPath),u&&u.appendChild(q)}}}}}function cl(o,r,e){Array.from(o.getElementsByTagName("*")).filter(n=>n.localName===r||n.localName?.toLowerCase()===r.toLowerCase()).forEach(n=>{let s=`${r}-${e}`,a=pl(n,s);n.replaceWith(a)})}function dl(o,r){o.querySelectorAll("*").forEach(e=>{let t=e.classList;t&&t.forEach(i=>{if(i.startsWith(`${r}:`)){let n=i.slice(`${r}:`.length),s=`${e.nodeName}-${n}`,a=pl(e,s);e.replaceWith(a)}})})}function pl(o,r){let e=o.ownerDocument.createElement(r);for(let t of o.attributes)e.setAttribute(t.name,t.value);for(;o.firstChild;)e.appendChild(o.firstChild);return e}function ul(o,r){let e=["hook","module"],t=r.substring(0,r.lastIndexOf("/"));for(let i of e)o.querySelectorAll("["+i+"]").forEach(s=>{let a=s.getAttribute(i);!a.startsWith("data:")&&!a.startsWith("http")&&(s.setAttribute("base-url",r),s.setAttribute("module",t+"/"+encodeURI(a+(a.endsWith(".js")?"":".js"))))})}var ns=class o{#e;constructor(r){if(!(r instanceof Uint8Array))throw new TypeError("SeededRandom seed must be a Uint8Array.");if(r.length>32)throw new RangeError("SeededRandom seed must be 32 bytes or less.");let e=new Uint8Array(32);e.set(r,32-r.length),this.#e=dp(e)}static fromSeed(r){if(r.length!==32)throw new RangeError("SeededRandom.fromSeed requires a 32-byte seed.");return new o(r)}static fromFixed(r){if(typeof r!="number")throw new TypeError("SeededRandom.fromFixed requires a number.");if(!Number.isInteger(r)||r<0||r>255)throw new RangeError("SeededRandom.fromFixed requires an integer from 0 to 255.");let e=new Uint8Array(32);return e[31]=r,new o(e)}static fromSeedKey(r){let e=new o(new Uint8Array);return e.#e=cp(`${r}`),e}random(){this.#e|=0,this.#e=this.#e+1831565813|0;let r=Math.imul(this.#e^this.#e>>>15,1|this.#e);return r=r+Math.imul(r^r>>>7,61|r)^r,((r^r>>>14)>>>0)/4294967296}};function qn(o){return ns.fromSeedKey(o)}function cp(o){let r=1779033703^o.length;for(let e=0;e<o.length;e++)r=Math.imul(r^o.charCodeAt(e),3432918353),r=r<<13|r>>>19;return ml(r)}function dp(o){let r=1779033703^o.length;for(let e=0;e<o.length;e++)r=Math.imul(r^o[e],3432918353),r=r<<13|r>>>19;return ml(r)}function ml(o){let r=Math.imul(o^o>>>16,2246822507);return r=Math.imul(r^r>>>13,3266489909),(r^r>>>16)>>>0}var pp=o=>typeof o=="function"?o():o.random();function wn(o,r){let e=o.filter(i=>!i.fixed);for(let i=e.length-1;i>0;i--){let n=Math.floor(pp(r)*(i+1));[e[i],e[n]]=[e[n],e[i]]}let t=0;return o.map(i=>i.fixed?i:e[t++])}function up(o){switch(o){case"qti-choice-interaction":case"qti-order-interaction":return"qti-simple-choice";case"qti-inline-choice-interaction":return"qti-inline-choice";case"qti-match-interaction":return["qti-simple-match-set:first-of-type qti-simple-associable-choice","qti-simple-match-set:last-of-type > qti-simple-associable-choice"];case"qti-gap-match-interaction":return"qti-gap-text";case"qti-associate-interaction":return"qti-simple-associable-choice";default:return null}}function os(o,r){let e=o.querySelectorAll('[shuffle="true"]'),t=Array.from(e).filter(a=>a.tagName?.toLowerCase().endsWith("-interaction")),i=r!=null&&`${r}`.length>0,n=o.querySelector?.("qti-assessment-item")?.getAttribute("identifier")??"",s=0;for(let a of t){let l=a.getAttribute("response-identifier")??`${s}`;s++;let c=up(a.tagName.toLowerCase()),p=Array.isArray(c)?c:[c],u=!1,h=0;for(let v of p){if(!v)continue;let y=i?qn(`${r}:${n}:${l}:${h}`):Math.random;h++;let w=Array.from(a.querySelectorAll(v)).filter(q=>q.parentElement!==null);if(w.filter(q=>q.getAttribute("fixed")!=="true").length<=1){console.warn("Shuffling is not possible with fewer than 2 non-fixed elements.");continue}let f=w[0].parentElement;if(!f||w.some(q=>q.parentElement!==f)){console.warn("Shuffling is not possible when choices do not share the same parent element.");continue}let m=w[w.length-1].nextSibling,b=wn(w.map(q=>({element:q,fixed:q.getAttribute("fixed")==="true"})),y);for(let q of w)q.remove();for(let{element:q}of b)f.insertBefore(q,m);u=!0}u&&a.removeAttribute("shuffle")}}function hl(o){o.querySelectorAll("qti-stylesheet").forEach(r=>r.remove())}function ir(o,r){return fetch(o,{signal:r}).then(e=>{if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return e.text()}).then(e=>new DOMParser().parseFromString(e,"text/xml")).catch(e=>{throw e.name==="AbortError"?e:new Error(`Failed to load XML: ${e.message}`)})}function nr(o){return new DOMParser().parseFromString(o,"text/xml")}function fl(o,r){if(o.nodeType===Node.ELEMENT_NODE){let e=o,t;!e.namespaceURI||e.namespaceURI.startsWith("http://www.imsglobal.org/xsd/qti/")||e.namespaceURI.startsWith("http://www.imsglobal.org/xsd/imsqti")?t=r.createElement(e.localName):t=r.createElementNS(e.namespaceURI,e.tagName);for(let i=0;i<e.attributes.length;i++){let n=e.attributes[i];t.setAttribute(n.localName,n.value)}for(let i=0;i<e.childNodes.length;i++)t.appendChild(fl(e.childNodes[i],r));return t}return o.cloneNode(!1)}function or(o){let r=document.createDocumentFragment();for(let e=0;e<o.childNodes.length;e++)r.appendChild(fl(o.childNodes[e],document));return r}function sr(o,r){r.endsWith("/")||(r+="/"),o.querySelectorAll("*").forEach(t=>{for(let i of["src","href","srcset","poster"]){let n=t.getAttribute(i)?.trim();if(n&&!/^(data:|https?:|blob:)/.test(n)){let s=r+encodeURI(n);t.setAttribute(i,s)}}})}var Le=()=>{let o,r="",e={load(t,i){return r=t,ir(t,i).then(n=>(o=n,e))},parse(t){return o=nr(t),r="",e},path:t=>(sr(o,t),r=null,e),fn(t){return t(o),e},pciHooks(t){return ul(o,t),e},async configurePci(t,i,n="qti-portable-custom-interaction"){return await ll(o,t,i,n),e},shuffleInteractions(t){let i=typeof t=="string"?t.trim():t;if(i==null||i===""){let n=r||"default-item-seed";return console.warn(`[qtiTransformItem] No QTI_CONTEXT.seed provided; using "${n}" as deterministic fallback seed.`),os(o,n),e}return os(o,i),e},extendElementName:(t,i)=>(cl(o,t,i),e),extendElementsWithClass:(t="extend")=>(dl(o,t),e),customInteraction(t,i){let n=o.querySelector("qti-custom-interaction"),s=n.querySelector("object");return n.setAttribute("data-base-ref",t),n.setAttribute("data-base-item",t+i),n.setAttribute("data",s.getAttribute("data")),n.setAttribute("width",s.getAttribute("width")),n.setAttribute("height",s.getAttribute("height")),n.removeChild(s),e},convertCDATAtoComment(){return al(o),e},stripStyleSheets(){return hl(o),e},html(){return r!==null&&sr(o,r.substring(0,r.lastIndexOf("/"))),new XMLSerializer().serializeToString(or(o))},xml(){return new XMLSerializer().serializeToString(o)},htmlDoc(){return r!==null&&sr(o,r.substring(0,r.lastIndexOf("/"))),or(o)},xmlDoc(){return o}};return e};var gl=()=>{let o,r={async load(e,t){return new Promise(i=>{ir(e,t).then(n=>(o=n,i(r)))})},parse(e){o=nr(e)},assessmentTest(){let e=o.querySelector('resource[type="imsqti_test_xmlv3p0"]');return{href:e.getAttribute("href"),identifier:e.getAttribute("identifier")}}};return r};function bl(o){let r=[];return o.querySelectorAll("qti-assessment-item-ref").forEach(e=>{let t=e.getAttribute("identifier"),i=e.getAttribute("href"),n=e.getAttribute("category");r.push({identifier:t,href:i,category:n})}),r}var ss=(o,...r)=>r.includes(o.localName)||r.includes(o.localName?.toLowerCase?.()),vl=o=>ss(o,"qti-assessment-item-ref","assessmentitemref"),Wr=o=>ss(o,"qti-assessment-section","assessmentsection"),ar=(o,...r)=>r.some(e=>{let t=(o.getAttribute(e)??"").trim().toLowerCase();return t==="true"||t==="1"}),mp=o=>Array.from(o.children).filter(r=>ss(r,"qti-ordering","ordering")&&ar(r,"shuffle")),hp=(o,r)=>qn(`${o}:${r}`);function yl(o,r){for(let a of Array.from(o.children))Wr(a)&&yl(a,r);let e=mp(o);if(e.length===0)return;let t=[],i=[];for(let a of Array.from(o.children))if(vl(a))t.push({nodes:[a],fixed:ar(a,"fixed")}),i.push(a);else if(Wr(a))if(ar(a,"keep-together","keeptogether")||ar(a,"visible"))t.push({nodes:[a],fixed:ar(a,"fixed")}),i.push(a);else{for(let c of Array.from(a.children))(vl(c)||Wr(c))&&t.push({nodes:[c],fixed:ar(c,"fixed")});i.push(a)}if(t.length<=1){for(let a of e)a.remove();return}let n=o.getAttribute("identifier")??"",s=wn(t,hp(r,n));for(let a of i)a.remove();for(let a of s)for(let l of a.nodes)o.appendChild(l);for(let a of e)a.remove()}function as(o,r){let e=Array.from(o.getElementsByTagName("*")).filter(t=>Wr(t));for(let t of e){let i=t.parentElement;(!i||!Wr(i))&&yl(t,r)}}var lr=()=>{let o,r="",e={async load(t,i){return new Promise((n,s)=>{ir(t,i).then(a=>(o=a,r=t,e.path(t.substring(0,t.lastIndexOf("/"))),n(e)))})},parse(t){return o=nr(t),r="",e},path:t=>(sr(o,t),e),fn(t){return t(o),e},shuffleOrdering(t){let i=typeof t=="string"?t.trim():t;if(i==null||i===""){let n=r||"default-test-seed";return console.warn(`[qtiTransformTest] No QTI_CONTEXT.seed provided; using "${n}" as deterministic fallback seed.`),as(o,n),e}return as(o,i),e},items(){return bl(o)},html(){return new XMLSerializer().serializeToString(or(o))},xml(){return new XMLSerializer().serializeToString(o)},htmlDoc(){return or(o)},xmlDoc(){return o}};return e};var xl=o=>{class r extends o{constructor(...i){super(...i);this.navigate=null;this.requestTimeout=3e4;this.postLoadTransformCallback=null;this.postLoadTestTransformCallback=null;this._activeController=null;this._loadResults=[];this._navigationId=0;this._loadingState={expectedItems:0,connectedItems:0,expectedStimulus:0,loadedStimulus:0,isComplete:!1};this._loadedStimulusHrefs=new Set;this._loadingStimulusHrefs=new Set;this._bindEventHandlers()}navigateTo(i,n){let s=n||this._getDefaultNavigationId(i);s&&this.dispatchEvent(new CustomEvent("qti-request-navigation",{detail:{type:i,id:s},bubbles:!0,composed:!0}))}_bindEventHandlers(){this.addEventListener("qti-request-navigation",this._handleNavigationRequest.bind(this)),this.addEventListener("qti-assessment-test-connected",this._handleTestConnected.bind(this)),this.addEventListener("qti-assessment-item-connected",this._handleItemConnected.bind(this)),this.addEventListener("qti-assessment-stimulus-ref-connected",this._handleStimulusRefConnected.bind(this))}_handleTestConnected(i){this._testElement=i.detail,this._initializeNavigation()}_handleItemConnected(i){let n=i.detail;this._loadingState.connectedItems++;let s=n.querySelectorAll("qti-assessment-stimulus-ref");this._loadingState.expectedStimulus+=s.length,this._checkLoadingComplete()}async _handleStimulusRefConnected(i){i.preventDefault();let{element:n,item:s}=i;if(console.info("Stimulus ref connected:",{identifier:n.identifier,href:n.href,item:s.identifier}),this._loadedStimulusHrefs.has(n.href)){console.info("Stimulus already loaded, skipping:",n.href),this._loadingState.loadedStimulus++,this._checkLoadingComplete();return}if(this._loadingStimulusHrefs.has(n.href)){console.info("Stimulus already loading, skipping duplicate:",n.href),this._loadingState.loadedStimulus++,this._checkLoadingComplete();return}this._loadingStimulusHrefs.add(n.href),console.info("Starting stimulus load:",n.href);try{await this._loadStimulusRef(n,s),this._loadedStimulusHrefs.add(n.href),this._loadingState.loadedStimulus++,console.info("Stimulus loaded successfully:",n.href),this._checkLoadingComplete()}catch(a){a.name!=="AbortError"&&console.warn(`Failed to load stimulus ${n.identifier}:`,a),this._loadingState.loadedStimulus++,this._checkLoadingComplete()}finally{this._loadingStimulusHrefs.delete(n.href)}}_getDefaultNavigationId(i){return i==="section"?this._testElement?.querySelector("qti-assessment-section")?.identifier:this.sessionContext?.navItemRefId??this._testElement?.querySelector("qti-assessment-item-ref")?.identifier}_initializeNavigation(){if(!this.navigate)return;let i=this._getDefaultNavigationId(this.navigate);i&&this.navigateTo(this.navigate,i)}async _handleNavigationRequest({detail:i}){if(!i?.id)return;this._cancelPreviousNavigation();let n=++this._navigationId,s=new AbortController;try{this._dispatchLoadingStarted(i.type,i.id),this._activeController=s,await this._executeNavigation(i.type,i.id,n,s)}catch(a){this._handleNavigationError(a,i.type,i.id)}finally{this._activeController===s&&(this._activeController=null),this._dispatchLoadingEnded(i.type,i.id)}}_handleNavigationError(i,n,s){i.name!=="AbortError"&&this._dispatchError(this._createNavigationError(i,n,s))}async _executeNavigation(i,n,s,a){i==="item"?await this._navigateToItem(n,s,a):await this._navigateToSection(n,s,a)}async _navigateToItem(i,n,s){let a=this._findItemRef(i);this._updateSessionContext(a,i),this._resetLoadingState(),this._loadingState.expectedItems=1,await this._loadItems([i],n,s),await this._waitForLoadingComplete(n,s),!this._isStaleNavigation(n,s)&&this._dispatchTestLoaded(this._loadResults)}async _navigateToSection(i,n,s){let l=this._findSection(i)?.closest("qti-test-part")?.identifier;this.sessionContext={...this.sessionContext,navPartId:l,navSectionId:i,navItemRefId:null};let c=this._getSectionItemIds(i);this._resetLoadingState(),this._loadingState.expectedItems=c.length,await this._loadItems(c,n,s),await this._waitForLoadingComplete(n,s),!this._isStaleNavigation(n,s)&&this._dispatchTestLoaded(this._loadResults)}_resetLoadingState(){this._loadingState={expectedItems:0,connectedItems:0,expectedStimulus:0,loadedStimulus:0,isComplete:!1},this._loadedStimulusHrefs.clear(),this._loadingStimulusHrefs.clear()}_checkLoadingComplete(){let i=this._loadingState.connectedItems>=this._loadingState.expectedItems,n=this._loadingState.loadedStimulus>=this._loadingState.expectedStimulus;i&&n&&!this._loadingState.isComplete&&(this._loadingState.isComplete=!0)}async _waitForLoadingComplete(i,n){for(;!this._loadingState.isComplete;){if(this._isStaleNavigation(i,n))return;await new Promise(s=>setTimeout(s,10))}}getLoadingProgress(){return{...this._loadingState}}async _loadStimulusRef(i,n){console.info("Loading stimulus:",i.href);let s=await this._loadStimulus(i.href);console.info("Stimulus loaded, applying content:",s?"has content":"no content"),this._applyStimulusContent(s,i,n)}_applyStimulusContent(i,n,s){if(!i){console.warn("No stimulus content to apply");return}let a=i.querySelectorAll("qti-stimulus-body, qti-stylesheet");if(console.info(`Found ${a.length} stimulus elements to apply for ${n.identifier}`),a.length===0){console.warn("No qti-stimulus-body or qti-stylesheet elements found in stimulus");return}let l=[],c=s.querySelector(`[data-stimulus-idref="${n.identifier}"]`);if(c)l.push(c),console.info("Found specific target:",c);else{let p=Array.from(this.querySelectorAll(`[data-stimulus-idref="${n.identifier}"]`));if(p.length>0)l=p,console.info("Found targets by identifier:",p.length);else{let u=Array.from(this.querySelectorAll("[data-stimulus-idref]"));l=u,console.info("Using fallback targets:",u.length)}}if(l.length===0){console.warn("No targets found for stimulus content");return}l.forEach((p,u)=>{p.innerHTML="";let h=Array.from(a).map(v=>v.cloneNode(!0));p.append(...h),console.info(`Applied stimulus content to target ${u+1}/${l.length}`)})}_cancelPreviousNavigation(){this._activeController&&(this._activeController.abort(),console.info("Previous navigation request cancelled")),this._clearNavigationState()}_clearNavigationState(){this._clearLoadedItems(),this._resetLoadingState(),this._loadResults=[]}async _loadItems(i,n,s){if(!this._testElement||i.length===0)return;let a=i.map(p=>this._findItemRef(p));this._clearLoadedItems(),this._clearStimulusRef();let c=(await Promise.all(a.map(p=>this._loadSingleItem(p,n,s)))).filter(Boolean);this._isStaleNavigation(n,s)||(c.forEach(({itemRef:p,doc:u})=>{p&&u&&(p.xmlDoc=u)}),c.forEach(({itemRef:p})=>{let u=p?.identifier;if(!p||!u)return;let h=this.testContext.items.find(v=>v.identifier===u)?.state;h!==void 0&&p.updateComplete.then(()=>{let v=p.assessmentItem;v&&(v.state=h)})}),this._loadResults=c)}async _loadSingleItem(i,n,s){try{let a=this.querySelector("test-navigation")?.qtiContext?.QTI_CONTEXT?.seed,l=(await Le().load(i.href,s.signal)).shuffleInteractions(a);return this.postLoadTransformCallback&&(l=await this.postLoadTransformCallback(l,i)),this._isStaleNavigation(n,s)?null:{itemRef:i,doc:l.htmlDoc()}}catch(a){if(a.name==="AbortError")throw console.info(`Item load for ${i.identifier} was aborted`),a;return console.warn(`Failed to load item ${i.identifier}:`,a),null}}async _loadStimulus(i){return(await Le().load(i,this._activeController?.signal)).htmlDoc()}_findItemRef(i){let n=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${i}"]`);if(!n)throw new Error(`Item with identifier "${i}" not found`);return n}_findSection(i){return this._testElement?.querySelector(`qti-assessment-section[identifier="${i}"]`)||null}_updateSessionContext(i,n){let s=i.closest("qti-test-part")?.identifier,a=i.closest("qti-assessment-section")?.identifier;this.sessionContext={...this.sessionContext,navPartId:s,navSectionId:a,navItemRefId:n}}_getSectionItemIds(i){return Array.from(this._testElement.querySelectorAll(`qti-assessment-section[identifier="${i}"] > qti-assessment-item-ref`)).map(n=>n.identifier).filter(Boolean)}_clearLoadedItems(){let i=this._testElement?.querySelectorAll("qti-assessment-item-ref");Array.from(i||[]).forEach(n=>{n.xmlDoc=null})}_clearStimulusRef(){this.querySelectorAll("[data-stimulus-idref]").forEach(i=>i.innerHTML="")}_isStaleNavigation(i,n){return n.signal.aborted||i!==this._navigationId}_createNavigationError(i,n,s){return{message:i.message||`Failed to load ${n}: ${s}`,details:i,itemId:n==="item"?s:void 0,sectionId:n==="section"?s:void 0}}_dispatchLoadingStarted(i,n){this.dispatchEvent(new CustomEvent("qti-navigation-loading-started",{detail:{type:i,id:n},bubbles:!0,composed:!0}))}_dispatchLoadingEnded(i,n){this.dispatchEvent(new CustomEvent("qti-navigation-loading-ended",{detail:{type:i,id:n},bubbles:!0,composed:!0}))}_dispatchError(i){this.dispatchEvent(new CustomEvent("qti-navigation-error",{detail:i,bubbles:!0,composed:!0}))}_dispatchTestLoaded(i){requestAnimationFrame(()=>{this.dispatchEvent(new CustomEvent("qti-test-loaded",{detail:i.map(({itemRef:n})=>({identifier:n?.identifier,element:n})),bubbles:!0,composed:!0}))})}}return d([g({type:String})],r.prototype,"navigate",2),d([g({type:Number})],r.prototype,"requestTimeout",2),d([g({attribute:!1})],r.prototype,"postLoadTransformCallback",2),d([g({attribute:!1})],r.prototype,"postLoadTestTransformCallback",2),r};var ql=o=>{class r extends o{constructor(...t){super(...t),this.sessionContext={...this.sessionContext,view:"candidate"},this.addEventListener("on-test-switch-view",i=>{this.sessionContext={...this.sessionContext,view:i.detail},this._updateElementView()}),this.addEventListener("qti-assessment-test-connected",()=>{this._updateElementView()}),this.addEventListener("qti-assessment-item-connected",i=>{this._updateElementView(),this._setCorrectResponseVisibility(i.detail)})}willUpdate(t){super.willUpdate(t),t.has("sessionContext")&&this._updateElementView()}_updateElementView(){if(this._testElement){Array.from(this._testElement.querySelectorAll("[view]")).forEach(s=>{s.classList.toggle("show",s.getAttribute("view")===this.sessionContext.view)});let n=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${this.sessionContext.navItemRefId}"]`)?.assessmentItem;n&&n.showCorrectResponse(this.sessionContext.view==="scorer")}}_setCorrectResponseVisibility(t){t.showCorrectResponse(this.sessionContext.view==="scorer")}}return r};var ls=o=>{class r extends o{constructor(...i){super(...i);this.testContext=ts;this.sessionContext=es;this._updateItemInTestContext=i=>{let n=i._context,s=n.identifier,a=n.variables,l=this.testContext.items.find(c=>c?.identifier===s);if(!l){console.warn(`Item IDs between assessment.xml and item.xml should match: ${s} is not found!`);return}if(l.variables?.length===1)this._updateItemVariablesInTestContext(s,a);else{let c=[...i.variables];for(let p of l.variables){let u=c.find(h=>h.identifier===p.identifier);u?u.value=p.value:c.push(p)}i.variables=c}};this._initializeEventListeners()}updateItemVariables(i,n){let s=this.testContext.items.find(l=>l.identifier===i);s&&(s.variables=s.variables.map(l=>{let c=n.find(p=>p.identifier===l.identifier);return c?{...l,...c}:l}));let a=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${i}"]`);a&&a.assessmentItem&&(a.assessmentItem.variables=n)}_initializeEventListeners(){this.addEventListener("qti-assessment-test-connected",i=>{if(this.testContext=ts,this.sessionContext=es,this.testContext&&this.testContext.items.length>0)return;this._testElement=i.detail;let n=Array.from(this._testElement.querySelectorAll("qti-assessment-item-ref")).map(s=>({href:s.href,identifier:s.identifier,category:s.category,variables:[{identifier:"completionStatus",value:"not_attempted",type:"outcome"}]}));this.testContext={...this.testContext,items:n}}),this.addEventListener("qti-assessment-item-connected",i=>{let n=i.detail,s=n.closest("qti-assessment-item-ref")?.identifier;s&&(n.assessmentItemRefId=s),this._updateItemInTestContext(i.detail)}),this.addEventListener("qti-item-context-updated",i=>{this._updateItemVariablesInTestContext(i.detail.itemContext.identifier,i.detail.itemContext.variables,i.detail.itemContext.state)})}_updateItemVariablesInTestContext(i,n,s){this.testContext={...this.testContext,items:this.testContext.items.map(a=>a.identifier!==i?a:{...a,variables:n.map(l=>{let c=a.variables.find(p=>p.identifier===l.identifier);return c?{...c,...l}:l}),...s!==void 0?{state:s?{...s}:void 0}:{}})},this.dispatchEvent(new CustomEvent("qti-test-context-updated",{detail:this.testContext,bubbles:!1,composed:!1}))}}return d([g({attribute:!1,type:Object}),ee({context:_e})],r.prototype,"testContext",2),d([g({attribute:!1,type:Object}),ee({context:nt})],r.prototype,"sessionContext",2),r},wl=class extends ls(E){};var El=o=>{class r extends o{constructor(...t){super(...t),this.addEventListener("qti-register-variable",i=>{this.testContext={...this.testContext,testOutcomeVariables:[...this.testContext.testOutcomeVariables||[],i.detail.variable]},i.stopPropagation()}),this.addEventListener("qti-set-outcome-value",i=>{let{outcomeIdentifier:n,value:s}=i.detail;this.updateOutcomeVariable(n,s),i.stopPropagation()})}outcomeProcessing(){let t=this.querySelector("qti-outcome-processing");return t?(t?.process(),!0):!1}updateOutcomeVariable(t,i){let n=this.getOutcome(t);if(!n){console.warn(`Can not set qti-outcome-identifier: ${t}, it is not available`);return}this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(s=>s.identifier!==t?s:{...s,value:n.cardinality==="single"?i:[...s.value,i]})}}getOutcome(t){return this.getVariable(t)}getVariable(t){return this.testContext.testOutcomeVariables?.find(i=>i.identifier===t)||null}}return r};var Gr=class extends xl(ql(El(ls(E)))){constructor(){super(...arguments);this.configContext={}}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-test-connected",{detail:this}))}render(){return x`<slot></slot>`}};d([k(),ee({context:ne})],Gr.prototype,"configContext",2),Gr=d([R("qti-test")],Gr);var Cl={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},We=class extends E{constructor(){super(...arguments);this.weigths=new Map}createRenderRoot(){return this}get assessmentItem(){return this.renderRoot?.querySelector("qti-assessment-item")}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-assessment-item-ref-connected",{bubbles:!0,composed:!0,detail:{identifier:this.identifier,href:this.href,category:this.category}}))}render(){return this.myTemplate?this.myTemplate({xmlDoc:this.xmlDoc}):this.xmlDoc}};d([g({type:String})],We.prototype,"category",2),d([g({type:String})],We.prototype,"identifier",2),d([g({type:Boolean,converter:Cl})],We.prototype,"required",2),d([g({type:Boolean,converter:Cl})],We.prototype,"fixed",2),d([g({type:String})],We.prototype,"href",2),d([g({type:Object,attribute:!1})],We.prototype,"xmlDoc",2);customElements.get("qti-assessment-item-ref")||customElements.define("qti-assessment-item-ref",We);var cs={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},Ge=class extends E{get title(){return this.#e}set title(r){this.#e=r,this.removeAttribute("title"),this.setAttribute("data-title",r)}#e="";async connectedCallback(){this.#e=this.getAttribute("title")||"",super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-assessment-section-connected",{bubbles:!0,composed:!0}))}render(){return x`<slot name="qti-rubric-block"></slot><slot></slot>`}};d([g({type:String})],Ge.prototype,"identifier",2),d([g({type:String})],Ge.prototype,"required",2),d([g({type:Boolean,converter:cs})],Ge.prototype,"fixed",2),d([g({type:Boolean,converter:cs})],Ge.prototype,"visible",2),d([g({type:Boolean,converter:cs,attribute:"keep-together"})],Ge.prototype,"keepTogether",2),d([$({context:_e,subscribe:!0})],Ge.prototype,"_testContext",2);customElements.get("qti-assessment-section")||customElements.define("qti-assessment-section",Ge);var Xr,Lt=class extends E{constructor(){super(...arguments);L(this,Xr,"")}get title(){return S(this,Xr)}set title(e){U(this,Xr,e),this.removeAttribute("title"),this.setAttribute("data-title",e)}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-assessment-test-connected",{detail:this,bubbles:!0,composed:!0}))}render(){return x` <slot></slot>`}};Xr=new WeakMap,d([g({type:String})],Lt.prototype,"identifier",2),d([g({type:String})],Lt.prototype,"title",1),d([$({context:_e,subscribe:!0})],Lt.prototype,"_testContext",2),Lt=d([R("qti-assessment-test")],Lt);var Qr,Xe=class extends E{constructor(){super(...arguments);this.identifier="";this.class="";this.navigationMode="nonlinear";this.submissionMode="individual";L(this,Qr,"")}get title(){return S(this,Qr)}set title(e){U(this,Qr,e),this.removeAttribute("title"),this.setAttribute("data-title",e)}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-test-part-connected",{bubbles:!0,composed:!0}))}render(){return x` <slot></slot>`}};Qr=new WeakMap,d([g({type:String})],Xe.prototype,"identifier",2),d([g({type:String})],Xe.prototype,"class",2),d([g({type:String,attribute:"navigation-mode"})],Xe.prototype,"navigationMode",2),d([g({type:String,attribute:"submission-mode"})],Xe.prototype,"submissionMode",2),Xe=d([R("qti-test-part")],Xe);customElements.get("qti-test-part")||customElements.define("qti-test-part",Xe);var Yr,cr,dr,pr,ye,me,Sl,Al,Jr,Kr,Zr,ei,ti,ri,ii,ni,Tl,ds,Il,ue=class extends E{constructor(){super(...arguments);L(this,me);L(this,Yr);L(this,cr,null);this.identifier="";this.adaptive="false";this.timeDependent=null;this._handleDisabledChange=(e,t)=>{S(this,ye).forEach(i=>i.disabled=t)};this._handleReadonlyChange=(e,t)=>S(this,ye).forEach(i=>i.readonly=t);this._context={variables:Ja};L(this,dr,{...this._context,variables:this._context.variables});L(this,pr,[]);L(this,ye,[]);L(this,Jr,e=>{e.stopImmediatePropagation(),this._context={...this._context,variables:[...this._context.variables,e.detail.variable]},U(this,dr,this._context),e.stopPropagation()});L(this,Kr,e=>{e.stopImmediatePropagation();let t=e.detail;S(this,pr).push(t),(Number(this._context.variables.find(n=>n.identifier==="numAttempts")?.value)||0)>0&&t.checkShowFeedback(t.outcomeIdentifier)});L(this,Zr,e=>{e.stopImmediatePropagation(),S(this,ye).push(e.detail.interactionElement)});L(this,ei,e=>{e.stopImmediatePropagation();let{responseIdentifier:t,countAttempt:i}=e.detail;this.validate(),this.updateResponseVariable(t,"true"),this.processResponse(i)});L(this,ti,e=>{e.stopImmediatePropagation();let{outcomeIdentifier:t,value:i}=e.detail;this.updateOutcomeVariable(t,i),e.stopPropagation()});L(this,ri,e=>{e.stopImmediatePropagation();let{templateIdentifier:t,value:i}=e.detail;this.updateTemplateVariable(t,i??void 0),e.stopPropagation()});L(this,ii,e=>{e.stopImmediatePropagation();let{responseIdentifier:t,value:i}=e.detail;this.updateCorrectResponse(t,i??void 0),e.stopPropagation()});L(this,ni,e=>{e.stopImmediatePropagation();let{responseIdentifier:t,response:i,state:n}=e.detail;this.updateResponseVariable(t,i),n!==void 0&&(this._context={...this._context,state:{...this._context.state||{},[t]:n}}),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))})}get title(){return S(this,Yr)}set title(e){U(this,Yr,e),this.removeAttribute("title"),this.setAttribute("data-title",e)}set assessmentItemRefId(e){this._context={...this._context,identifier:e}}get assessmentItemRefId(){return this._context.identifier}get variables(){return this._context.variables.map(e=>({identifier:e.identifier,value:e.value,type:e.type,...e.type==="outcome"&&e.identifier==="SCORE"?{externalScored:e.externalScored}:{}}))}set variables(e){if(!Array.isArray(e)||e.some(t=>!("identifier"in t))){console.warn("variables property should be an array of VariableDeclaration");return}this._context={...this._context,variables:this._context.variables.map(t=>{let i=e.find(n=>n.identifier===t.identifier);return i?{...t,...i,interpolationTable:t.interpolationTable}:t})},this._context.variables.forEach(t=>{if(t.type==="response"){let i=S(this,ye).find(n=>n.responseIdentifier===t.identifier);i&&(i.response=t.value)}}),this.variables.forEach(t=>{t.type==="outcome"&&S(this,pr).forEach(i=>i.checkShowFeedback(t.identifier))})}get state(){return this._context.state}set state(e){this._context={...this._context,state:e?{...e}:void 0}}set responses(e){if(e)for(let t of e){this.getResponse(t.responseIdentifier)&&this.updateResponseVariable(t.responseIdentifier,t.response);let n=S(this,ye).find(s=>s.getAttribute("response-identifier")===t.responseIdentifier);n&&(n.response=t.response)}}render(){return x`<slot></slot>`}connectedCallback(){P(this,me,Sl).call(this),super.connectedCallback(),this.updateComplete.then(()=>{this.dispatchEvent(new CustomEvent("qti-assessment-item-connected",{bubbles:!0,composed:!0,detail:this})),P(this,me,Tl).call(this)})}disconnectedCallback(){P(this,me,Al).call(this),super.disconnectedCallback()}showCorrectResponse(e){for(let t of S(this,ye))t.toggleCorrectResponse(e);document.querySelectorAll("item-show-correct-response").forEach(t=>{t.shown=e})}showCandidateCorrection(e){for(let t of S(this,ye))t.toggleCandidateCorrection(e);document.querySelectorAll("item-show-candidate-correction").forEach(t=>{t.shown=e})}processResponse(e=!0,t=!0){this.validate(t),e&&this.updateOutcomeVariable("numAttempts",(+this._context.variables.find(s=>s.identifier==="numAttempts")?.value+1).toString()),this.adaptive==="false"&&P(this,me,Il).call(this);let i=this.querySelector("qti-response-processing"),n=!!(i&&typeof i.process=="function");return n&&i.process(),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",P(this,me,ds).call(this)),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}})),n}resetResponses(){this._context=S(this,dr)}getResponse(e){return this.getVariable(e)}getOutcome(e){return this.getVariable(e)}getVariable(e){return this._context.variables.find(t=>t.identifier===e)||null}updateResponseVariable(e,t){this._context={...this._context,variables:this._context.variables.map(i=>i.identifier!==e?i:{...i,value:t})},this.showCandidateCorrection(!1),this.dispatchEvent(new CustomEvent("qti-interaction-changed",{bubbles:!0,composed:!0,detail:{item:this.identifier,responseIdentifier:e,response:Array.isArray(t)?[...t]:t}})),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",P(this,me,ds).call(this))}updateTemplateVariable(e,t){let i=this._context.variables.find(s=>s.identifier===e&&s.type==="template");if(!i){console.warn(`Can not set qti-template-identifier: ${e}, it is not available`);return}let n=i.cardinality==="single"?Array.isArray(t)?t[0]:t??null:t==null?null:Array.isArray(t)?t:[t];this._context={...this._context,variables:this._context.variables.map(s=>s.identifier!==e?s:{...s,value:n})},this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}updateCorrectResponse(e,t){let i=this.getResponse(e);if(!i){console.warn(`Can not set correct response for identifier: ${e}, it is not available`);return}let n=i.cardinality==="single"?Array.isArray(t)?t[0]:t??null:t==null?null:Array.isArray(t)?t:[t];this._context={...this._context,variables:this._context.variables.map(s=>s.identifier!==e?s:{...s,correctResponse:n})},this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}setOutcomeVariable(e,t){this.updateOutcomeVariable(e,t),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}updateOutcomeVariable(e,t){let i=this.getOutcome(e);if(!i){console.warn(`Can not set qti-outcome-identifier: ${e}, it is not available`);return}this._context={...this._context,variables:this._context.variables.map(n=>n.identifier!==e?n:{...n,value:i.cardinality==="single"||Array.isArray(t)?t:[t]})},S(this,pr).forEach(n=>n.checkShowFeedback(e)),this.dispatchEvent(new CustomEvent("qti-outcome-changed",{bubbles:!0,composed:!0,detail:{item:this.identifier,outcomeIdentifier:e,value:this._context.variables.find(n=>n.identifier===e)?.value}}))}validate(e=!0){let t=S(this,ye).every(i=>i.validate());return e&&this.reportValidity(),t}reportValidity(){for(let e of S(this,ye))e.reportValidity()}};Yr=new WeakMap,cr=new WeakMap,dr=new WeakMap,pr=new WeakMap,ye=new WeakMap,me=new WeakSet,Sl=function(){this.addEventListener("qti-register-variable",S(this,Jr)),this.addEventListener("qti-register-feedback",S(this,Kr)),this.addEventListener("qti-register-interaction",S(this,Zr)),this.addEventListener("end-attempt",S(this,ei)),this.addEventListener("qti-set-outcome-value",S(this,ti)),this.addEventListener("qti-set-template-value",S(this,ri)),this.addEventListener("qti-set-correct-response",S(this,ii)),this.addEventListener("qti-interaction-response",S(this,ni))},Al=function(){this.removeEventListener("qti-register-variable",S(this,Jr)),this.removeEventListener("qti-register-feedback",S(this,Kr)),this.removeEventListener("qti-register-interaction",S(this,Zr)),this.removeEventListener("end-attempt",S(this,ei)),this.removeEventListener("qti-set-outcome-value",S(this,ti)),this.removeEventListener("qti-set-template-value",S(this,ri)),this.removeEventListener("qti-set-correct-response",S(this,ii)),this.removeEventListener("qti-interaction-response",S(this,ni))},Jr=new WeakMap,Kr=new WeakMap,Zr=new WeakMap,ei=new WeakMap,ti=new WeakMap,ri=new WeakMap,ii=new WeakMap,ni=new WeakMap,Tl=async function(){let e=Array.from(this.querySelectorAll("qti-template-declaration"));e.length>0&&(await Promise.all(e.map(t=>t.updateComplete)),await Promise.resolve()),U(this,cr,this.querySelector("qti-template-processing")),S(this,cr)&&(S(this,cr).process(),U(this,dr,{...this._context,variables:this._context.variables}))},ds=function(){let e=this.validate(!1);return e===!0?"completed":e===!1?"incomplete":"not_attempted"},Il=function(){this._context={...this._context,variables:this._context.variables.map(e=>{if(e.type!=="outcome")return e;let n=("defaultValue"in e?e.defaultValue:null)??null;return n==null&&(e.baseType==="integer"||e.baseType==="float")&&(n="0"),{...e,value:n}})}},d([g({type:String})],ue.prototype,"identifier",2),d([g({type:String})],ue.prototype,"adaptive",2),d([g({type:String})],ue.prototype,"timeDependent",2),d([g({type:String})],ue.prototype,"title",1),d([g({type:Boolean})],ue.prototype,"disabled",2),d([B("disabled",{waitUntilFirstUpdate:!0})],ue.prototype,"_handleDisabledChange",2),d([g({type:Boolean})],ue.prototype,"readonly",2),d([B("readonly",{waitUntilFirstUpdate:!0})],ue.prototype,"_handleReadonlyChange",2),d([ee({context:W})],ue.prototype,"_context",2),ue=d([R("qti-assessment-item")],ue);var ps=class o extends Event{constructor(e,t){super(o.eventName,{bubbles:!0,composed:!0,cancelable:!0});this.element=e;this.item=t}static{this.eventName="qti-assessment-stimulus-ref-connected"}},ur=class extends E{constructor(){super(...arguments);this.identifier="";this.href=""}async connectedCallback(){super.connectedCallback(),await this.updateComplete;let e=this.closest("qti-assessment-item"),t=new ps(this,e);this.dispatchEvent(t);let i=e?.querySelector(`[data-stimulus-idref="${this.identifier}"]`);!t.defaultPrevented&&i&&await this.updateStimulusRef(i)}async updateStimulusRef(e){let t=await Le().load(this.href).then(i=>i.htmlDoc());if(t){let i=t.querySelectorAll("qti-stimulus-body, qti-stylesheet");e.innerHTML="",e.append(...i)}}};d([g({type:String})],ur.prototype,"identifier",2),d([g({type:String})],ur.prototype,"href",2),ur=d([R("qti-assessment-stimulus-ref")],ur);var En=class extends E{};En=d([R("qti-companion-materials-info")],En);var si,oi=class extends E{constructor(){super(...arguments);L(this,si)}render(){return x`<slot @slotchange=${this.handleSlotChange}></slot>`}handleSlotChange(){let e=Array.from(this.firstElementChild?.childNodes??[]).find(t=>t.nodeType===Node.COMMENT_NODE);try{U(this,si,new Function("context","fn","item",e?.textContent??""))}catch(t){console.error("custom-operator contains invalid javascript code",t)}}calculate(){let e={variable:i=>this._context?.variables.find(n=>n.identifier===i)?.value??"",correct:i=>this._context?.variables.find(n=>n.identifier===i)?.correctResponse??""},t={getVariable:i=>this._context?.variables.find(n=>n.identifier===i),updateOutcomeVariable:(i,n)=>{this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:i,value:n}}))},updateResponseVariable:(i,n)=>{this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:i,response:n}}))}};return S(this,si).call(this,this._context,e,t)}};si=new WeakMap,d([$({context:W,subscribe:!0}),k()],oi.prototype,"_context",2),oi=d([R("qti-custom-operator")],oi);var ai=class extends pe{render(){return x` <slot part="feedback" class="feedback ${this.showStatus}"></slot> `}connectedCallback(){super.connectedCallback(),this.checkShowFeedback(this.outcomeIdentifier)}};ai.styles=C`
10
10
  :host {
11
11
  display: block;
12
12
  }
@@ -16,21 +16,21 @@ Make sure to test your application with a production build as repeat registratio
16
16
  .off {
17
17
  display: none;
18
18
  }
19
- `,ni=d([k("qti-feedback-block")],ni);var Le=s=>s??O;var oi=class extends de{constructor(){super(...arguments);this.render=()=>x` <slot part="feedback" class="${Le(this.showStatus)}"></slot> `}connectedCallback(){super.connectedCallback(),this.checkShowFeedback(this.outcomeIdentifier)}};oi.styles=C`
19
+ `,ai=d([R("qti-feedback-block")],ai);var $e=o=>o??O;var li=class extends pe{constructor(){super(...arguments);this.render=()=>x` <slot part="feedback" class="${$e(this.showStatus)}"></slot> `}connectedCallback(){super.connectedCallback(),this.checkShowFeedback(this.outcomeIdentifier)}};li.styles=C`
20
20
  .on {
21
21
  display: inline-block;
22
22
  }
23
23
  .off {
24
24
  display: none;
25
25
  }
26
- `,oi=d([k("qti-feedback-inline")],oi);var Lt=class extends de{render(){return x`
26
+ `,li=d([R("qti-feedback-inline")],li);var $t=class extends pe{render(){return x`
27
27
  <dialog class="qti-dialog" part="feedback" ?open="${this.showStatus==="on"}">
28
28
  <slot></slot>
29
29
  <div style="margin-top: var(--qti-gap-size); text-align: center;">
30
30
  <button class="button close-button" @click="${this.closeFeedback}">Close</button>
31
31
  </div>
32
32
  </dialog>
33
- `}openFeedback(){let r=this.shadowRoot?.querySelector("dialog");r&&!r.open&&r.showModal()}closeFeedback(){let r=this.shadowRoot?.querySelector("dialog");r&&r.open&&(r.close(),this.showStatus="off")}connectedCallback(){super.connectedCallback(),this.showStatus==="on"&&this.openFeedback()}updated(r){r.has("showStatus")&&(this.showStatus==="on"?this.openFeedback():this.closeFeedback())}};Lt.styles=C`
33
+ `}openFeedback(){let r=this.shadowRoot?.querySelector("dialog");r&&!r.open&&r.showModal()}closeFeedback(){let r=this.shadowRoot?.querySelector("dialog");r&&r.open&&(r.close(),this.showStatus="off")}connectedCallback(){super.connectedCallback(),this.showStatus==="on"&&this.openFeedback()}updated(r){r.has("showStatus")&&(this.showStatus==="on"?this.openFeedback():this.closeFeedback())}};$t.styles=C`
34
34
  .qti-dialog {
35
35
  background: var(--qti-bg);
36
36
  border: var(--qti-border-thickness) var(--qti-border-style) var(--qti-border-color);
@@ -69,23 +69,23 @@ Make sure to test your application with a production build as repeat registratio
69
69
  .button:focus {
70
70
  outline: var(--qti-focus-border-width) solid var(--qti-focus-color);
71
71
  }
72
- `,Lt=d([k("qti-modal-feedback")],Lt);var bl=C`
72
+ `,$t=d([R("qti-modal-feedback")],$t);var Rl=C`
73
73
  :host {
74
74
  display: block;
75
75
  }
76
- `;var si=class extends E{render(){return x`<slot part="qti-rubric-blocks" name="qti-rubric-block"></slot><slot></slot>`}};si.styles=bl,si=d([k("qti-item-body")],si);var at,xn,vl,ai=class extends E{constructor(){super(...arguments);L(this,at)}render(){return x`<slot @slotchange=${P(this,at,xn)}></slot>`}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>P(this,at,xn).call(this))}updated(e){e.has("context")&&P(this,at,xn).call(this)}};at=new WeakSet,xn=function(){let e=new Map,t=(this.context?.variables??[]).filter(n=>n.type==="template");for(let n of t){let o=n;o.mathVariable!==!0||o.value===null||o.value===void 0||e.set(o.identifier,P(this,at,vl).call(this,o.value))}if(e.size===0)return;let i=Array.from(this.querySelectorAll("*")).filter(n=>n.localName.toLowerCase()==="mi"||n.localName.toLowerCase()==="mn");for(let n of i){let o=n.getAttribute("data-qti-math-variable-source")??n.textContent?.trim()??"",a=e.get(o);if(!a)continue;if(n.localName.toLowerCase()==="mn"){n.textContent=a,n.setAttribute("data-qti-math-variable-source",o);continue}let l=document.createElement("mn");l.textContent=a,l.setAttribute("data-qti-math-variable-source",o),n.replaceWith(l)}},vl=function(e){return Array.isArray(e)?e.join(" "):e?.toString()??""},d([$({context:W,subscribe:!0}),M()],ai.prototype,"context",2),ai=d([k("qti-content-body")],ai);var $e=class extends E{handleclassNamesChange(){this.classNames.split(" ").forEach(e=>{switch(e){case"qti-rubric-discretionary-placement":{let t=new CustomEvent("qti-rubric:discretionary-placement",{detail:{className:e,element:this},bubbles:!0,composed:!0,cancelable:!0});if(!this.dispatchEvent(t))return;this.setAttribute("slot","qti-rubric-block")}break;case"qti-rubric-inline":this.setAttribute("slot","");break;default:break}})}render(){return x`<slot></slot>`}};$e.styles=C`
76
+ `;var ci=class extends E{render(){return x`<slot part="qti-rubric-blocks" name="qti-rubric-block"></slot><slot></slot>`}};ci.styles=Rl,ci=d([R("qti-item-body")],ci);var lt,Cn,kl,di=class extends E{constructor(){super(...arguments);L(this,lt)}render(){return x`<slot @slotchange=${P(this,lt,Cn)}></slot>`}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>P(this,lt,Cn).call(this))}updated(e){e.has("context")&&P(this,lt,Cn).call(this)}};lt=new WeakSet,Cn=function(){let e=new Map,t=(this.context?.variables??[]).filter(n=>n.type==="template");for(let n of t){let s=n;s.mathVariable!==!0||s.value===null||s.value===void 0||e.set(s.identifier,P(this,lt,kl).call(this,s.value))}if(e.size===0)return;let i=Array.from(this.querySelectorAll("*")).filter(n=>n.localName.toLowerCase()==="mi"||n.localName.toLowerCase()==="mn");for(let n of i){let s=n.getAttribute("data-qti-math-variable-source")??n.textContent?.trim()??"",a=e.get(s);if(!a)continue;if(n.localName.toLowerCase()==="mn"){n.textContent=a,n.setAttribute("data-qti-math-variable-source",s);continue}let l=document.createElement("mn");l.textContent=a,l.setAttribute("data-qti-math-variable-source",s),n.replaceWith(l)}},kl=function(e){return Array.isArray(e)?e.join(" "):e?.toString()??""},d([$({context:W,subscribe:!0}),k()],di.prototype,"context",2),di=d([R("qti-content-body")],di);var Pe=class extends E{handleclassNamesChange(){this.classNames.split(" ").forEach(e=>{switch(e){case"qti-rubric-discretionary-placement":{let t=new CustomEvent("qti-rubric:discretionary-placement",{detail:{className:e,element:this},bubbles:!0,composed:!0,cancelable:!0});if(!this.dispatchEvent(t))return;this.setAttribute("slot","qti-rubric-block")}break;case"qti-rubric-inline":this.setAttribute("slot","");break;default:break}})}render(){return x`<slot></slot>`}};Pe.styles=C`
77
77
  :host {
78
78
  display: block;
79
79
  }
80
- `,d([g({type:String})],$e.prototype,"id",2),d([g({type:String})],$e.prototype,"use",2),d([g({type:String})],$e.prototype,"view",2),d([g({type:String,attribute:"class"})],$e.prototype,"classNames",2),d([B("classNames",{waitUntilFirstUpdate:!0})],$e.prototype,"handleclassNamesChange",1),$e=d([k("qti-rubric-block")],$e);var me,li,ns,qn=class extends E{constructor(){super(...arguments);L(this,li);L(this,me,null)}firstUpdated(e){super.firstUpdated(e);let t=this.getAttribute("href");if(t!==null&&fetch(t).then(i=>i.text()).then(i=>{let n=P(this,li,ns).call(this,i);U(this,me,document.createElement("style")),I(this,me).media="screen",I(this,me).textContent=`@scope {${n}}`,this.parentElement?this.parentElement.appendChild(I(this,me)):console.warn("No parent element to append the scoped stylesheet to.")}).catch(i=>{console.error("Failed to load stylesheet:",i)}),this.textContent!==null&&this.textContent.trim()!==""){let i=P(this,li,ns).call(this,this.textContent);U(this,me,document.createElement("style")),I(this,me).media="screen",I(this,me).textContent=`@scope {${i}}`,this.parentElement?this.parentElement.appendChild(I(this,me)):console.warn("No parent element to append the scoped stylesheet to.")}}disconnectedCallback(){if(I(this,me))try{I(this,me).remove()}catch(e){console.error("Could not remove stylesheet:",e)}super.disconnectedCallback()}};me=new WeakMap,li=new WeakSet,ns=function(e){return e.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\s+/g," ").replace(/\s*([{}:;])\s*/g,"$1").trim()},qn=d([k("qti-stylesheet")],qn);var lt,yl,xl,ql,We=class extends sr{constructor(){super(...arguments);L(this,lt)}render(){let e=this.itemContext?.variables.find(t=>t.identifier===this.identifier)?.value;return x`${JSON.stringify(e,null,2)}`}connectedCallback(){super.connectedCallback();let e=this.defaultValues(this.cardinality),t={baseType:this.baseType,identifier:this.identifier,correctResponse:I(this,lt,yl),cardinality:this.cardinality||"single",mapping:I(this,lt,xl),defaultValue:e,areaMapping:I(this,lt,ql),value:null,type:"response",candidateResponse:null};t.value=e,this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:t}}))}};lt=new WeakSet,yl=function(){let e,t=this.querySelector("qti-correct-response");if(t){let i=t.querySelectorAll("qti-value");if(this.cardinality==="single"&&i.length>0)e=i[0].textContent.trim(),i[0].remove();else if(this.cardinality!=="single"){e=[];for(let n=0;n<i.length;n++)e.push(i[n].textContent.trim()),i[n].remove()}}return e},xl=function(){let e=this.querySelector("qti-mapping"),t=parseFloat(e?.getAttribute("lower-bound")),i=parseFloat(e?.getAttribute("upper-bound"));return{defaultValue:Number(e?.getAttribute("default-value"))||0,lowerBound:isNaN(t)?null:t,upperBound:isNaN(i)?null:i,mapEntries:Array.from(e?.querySelectorAll("qti-map-entry")||[]).map(o=>({mapKey:o.getAttribute("map-key")||"",mappedValue:Number(o.getAttribute("mapped-value"))||0,caseSensitive:o.hasAttribute("case-sensitive")?o.getAttribute("case-sensitive")!=="false":!1}))}},ql=function(){let e=this.querySelector("qti-area-mapping"),t=Number(e?.getAttribute("default-value"))||0,i=parseFloat(e?.getAttribute("lower-bound")),n=parseFloat(e?.getAttribute("upper-bound")),o=Array.from(e?.querySelectorAll("qti-area-map-entry")||[]).map(a=>({shape:a.getAttribute("shape")||"default",coords:a.getAttribute("coords")||"",mappedValue:Number(a.getAttribute("mapped-value"))||0,defaultValue:Number(a.getAttribute("default-value"))||0}));return{defaultValue:t,lowerBound:isNaN(i)?null:i,upperBound:isNaN(n)?null:n,areaMapEntries:o}},We.styles=[C`
80
+ `,d([g({type:String})],Pe.prototype,"id",2),d([g({type:String})],Pe.prototype,"use",2),d([g({type:String})],Pe.prototype,"view",2),d([g({type:String,attribute:"class"})],Pe.prototype,"classNames",2),d([B("classNames",{waitUntilFirstUpdate:!0})],Pe.prototype,"handleclassNamesChange",1),Pe=d([R("qti-rubric-block")],Pe);var he,pi,us,Sn=class extends E{constructor(){super(...arguments);L(this,pi);L(this,he,null)}firstUpdated(e){super.firstUpdated(e);let t=this.getAttribute("href");if(t!==null&&fetch(t).then(i=>i.text()).then(i=>{let n=P(this,pi,us).call(this,i);U(this,he,document.createElement("style")),S(this,he).media="screen",S(this,he).textContent=`@scope {${n}}`,this.parentElement?this.parentElement.appendChild(S(this,he)):console.warn("No parent element to append the scoped stylesheet to.")}).catch(i=>{console.error("Failed to load stylesheet:",i)}),this.textContent!==null&&this.textContent.trim()!==""){let i=P(this,pi,us).call(this,this.textContent);U(this,he,document.createElement("style")),S(this,he).media="screen",S(this,he).textContent=`@scope {${i}}`,this.parentElement?this.parentElement.appendChild(S(this,he)):console.warn("No parent element to append the scoped stylesheet to.")}}disconnectedCallback(){if(S(this,he))try{S(this,he).remove()}catch(e){console.error("Could not remove stylesheet:",e)}super.disconnectedCallback()}};he=new WeakMap,pi=new WeakSet,us=function(e){return e.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\s+/g," ").replace(/\s*([{}:;])\s*/g,"$1").trim()},Sn=d([R("qti-stylesheet")],Sn);var ct,Ml,_l,Ll,Qe=class extends rr{constructor(){super(...arguments);L(this,ct)}render(){let e=this.itemContext?.variables.find(t=>t.identifier===this.identifier)?.value;return x`${JSON.stringify(e,null,2)}`}connectedCallback(){super.connectedCallback();let e=this.defaultValues(this.cardinality),t={baseType:this.baseType,identifier:this.identifier,correctResponse:S(this,ct,Ml),cardinality:this.cardinality||"single",mapping:S(this,ct,_l),defaultValue:e,areaMapping:S(this,ct,Ll),value:null,type:"response",candidateResponse:null};t.value=e,this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:t}}))}};ct=new WeakSet,Ml=function(){let e,t=this.querySelector("qti-correct-response");if(t){let i=t.querySelectorAll("qti-value");if(this.cardinality==="single"&&i.length>0)e=i[0].textContent.trim(),i[0].remove();else if(this.cardinality!=="single"){e=[];for(let n=0;n<i.length;n++)e.push(i[n].textContent.trim()),i[n].remove()}}return e},_l=function(){let e=this.querySelector("qti-mapping"),t=parseFloat(e?.getAttribute("lower-bound")),i=parseFloat(e?.getAttribute("upper-bound"));return{defaultValue:Number(e?.getAttribute("default-value"))||0,lowerBound:isNaN(t)?null:t,upperBound:isNaN(i)?null:i,mapEntries:Array.from(e?.querySelectorAll("qti-map-entry")||[]).map(s=>({mapKey:s.getAttribute("map-key")||"",mappedValue:Number(s.getAttribute("mapped-value"))||0,caseSensitive:s.hasAttribute("case-sensitive")?s.getAttribute("case-sensitive")!=="false":!1}))}},Ll=function(){let e=this.querySelector("qti-area-mapping"),t=Number(e?.getAttribute("default-value"))||0,i=parseFloat(e?.getAttribute("lower-bound")),n=parseFloat(e?.getAttribute("upper-bound")),s=Array.from(e?.querySelectorAll("qti-area-map-entry")||[]).map(a=>({shape:a.getAttribute("shape")||"default",coords:a.getAttribute("coords")||"",mappedValue:Number(a.getAttribute("mapped-value"))||0,defaultValue:Number(a.getAttribute("default-value"))||0}));return{defaultValue:t,lowerBound:isNaN(i)?null:i,upperBound:isNaN(n)?null:n,areaMapEntries:s}},Qe.styles=[C`
81
81
  :host {
82
82
  display: none;
83
83
  }
84
- `],d([g({type:String,attribute:"base-type"})],We.prototype,"baseType",2),d([g({type:String})],We.prototype,"identifier",2),d([g({type:String})],We.prototype,"cardinality",2),d([$({context:W,subscribe:!0}),M()],We.prototype,"itemContext",2),We=d([k("qti-response-declaration")],We);var Pe=class extends sr{constructor(){super(...arguments);this.externalScored=null}render(){let e=this.itemContext?.variables.find(t=>t.identifier===this.identifier)?.value;return x`${JSON.stringify(e,null,2)}`}get interpolationTable(){let e=this.querySelector("qti-interpolation-table");if(e){let t=new Map;for(let i of e.querySelectorAll("qti-interpolation-table-entry")){!i.getAttribute("source-value")&&i.getAttribute("target-value")&&console.error("source-value or target-value is missing in qti-interpolation-table-entry");let n=parseFloat(i.getAttribute("source-value")),o=parseFloat(i.getAttribute("target-value"));(isNaN(n)||isNaN(o))&&console.error("source-value or target-value is not a number in qti-interpolation-table-entry"),t.set(n,o)}return t}return null}connectedCallback(){super.connectedCallback();let e=this.defaultValues(this.cardinality),t={identifier:this.identifier,cardinality:this.cardinality,baseType:this.baseType,defaultValue:e,type:"outcome",value:null,interpolationTable:this.interpolationTable,externalScored:this.externalScored};t.value=e,(t.value===null||t.value==null)&&(t.baseType==="integer"||t.baseType==="float")&&(t.value="0"),this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:t}}))}};Pe.styles=[C`
84
+ `],d([g({type:String,attribute:"base-type"})],Qe.prototype,"baseType",2),d([g({type:String})],Qe.prototype,"identifier",2),d([g({type:String})],Qe.prototype,"cardinality",2),d([$({context:W,subscribe:!0}),k()],Qe.prototype,"itemContext",2),Qe=d([R("qti-response-declaration")],Qe);var Ve=class extends rr{constructor(){super(...arguments);this.externalScored=null}render(){let e=this.itemContext?.variables.find(t=>t.identifier===this.identifier)?.value;return x`${JSON.stringify(e,null,2)}`}get interpolationTable(){let e=this.querySelector("qti-interpolation-table");if(e){let t=new Map;for(let i of e.querySelectorAll("qti-interpolation-table-entry")){!i.getAttribute("source-value")&&i.getAttribute("target-value")&&console.error("source-value or target-value is missing in qti-interpolation-table-entry");let n=parseFloat(i.getAttribute("source-value")),s=parseFloat(i.getAttribute("target-value"));(isNaN(n)||isNaN(s))&&console.error("source-value or target-value is not a number in qti-interpolation-table-entry"),t.set(n,s)}return t}return null}connectedCallback(){super.connectedCallback();let e=this.defaultValues(this.cardinality),t={identifier:this.identifier,cardinality:this.cardinality,baseType:this.baseType,defaultValue:e,type:"outcome",value:null,interpolationTable:this.interpolationTable,externalScored:this.externalScored};t.value=e,(t.value===null||t.value==null)&&(t.baseType==="integer"||t.baseType==="float")&&(t.value="0"),this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:t}}))}};Ve.styles=[C`
85
85
  :host {
86
86
  display: none;
87
87
  }
88
- `],d([g({type:String,attribute:"base-type"})],Pe.prototype,"baseType",2),d([g({type:String,attribute:"external-scored"})],Pe.prototype,"externalScored",2),d([g({type:String})],Pe.prototype,"identifier",2),d([g({type:String})],Pe.prototype,"cardinality",2),d([$({context:W,subscribe:!0}),M()],Pe.prototype,"itemContext",2),Pe=d([k("qti-outcome-declaration")],Pe);var wl=`<qti-response-processing>
88
+ `],d([g({type:String,attribute:"base-type"})],Ve.prototype,"baseType",2),d([g({type:String,attribute:"external-scored"})],Ve.prototype,"externalScored",2),d([g({type:String})],Ve.prototype,"identifier",2),d([g({type:String})],Ve.prototype,"cardinality",2),d([$({context:W,subscribe:!0}),k()],Ve.prototype,"itemContext",2),Ve=d([R("qti-outcome-declaration")],Ve);var $l=`<qti-response-processing>
89
89
  <qti-response-condition>
90
90
  <qti-response-if>
91
91
  <qti-match>
@@ -102,7 +102,7 @@ Make sure to test your application with a production build as repeat registratio
102
102
  </qti-set-outcome-value>
103
103
  </qti-response-else>
104
104
  </qti-response-condition>
105
- </qti-response-processing>`,El=`<qti-response-processing>
105
+ </qti-response-processing>`,Pl=`<qti-response-processing>
106
106
  <qti-response-condition>
107
107
  <qti-response-if>
108
108
  <qti-is-null>
@@ -118,7 +118,7 @@ Make sure to test your application with a production build as repeat registratio
118
118
  </qti-set-outcome-value>
119
119
  </qti-response-else>
120
120
  </qti-response-condition>
121
- </qti-response-processing>`,Cl=`<qti-response-processing>
121
+ </qti-response-processing>`,Vl=`<qti-response-processing>
122
122
  <qti-response-condition>
123
123
  <qti-response-if>
124
124
  <qti-is-null>
@@ -134,57 +134,57 @@ Make sure to test your application with a production build as repeat registratio
134
134
  </qti-set-outcome-value>
135
135
  </qti-response-else>
136
136
  </qti-response-condition>
137
- </qti-response-processing>`;var pr,wn,ci=class extends E{constructor(){super(...arguments);L(this,pr)}render(){return x`<slot></slot>`}process(){if(!this.closest("qti-assessment-item"))return;let t=[...this.children];for(let i of t)i.process()}firstUpdated(e){if(this.getAttribute("template")){let t=this.getAttribute("template").split("/"),i=t[t.length-1].replace(".xml","");switch(this.innerHTML="",i){case"map_response":{this.appendChild(P(this,pr,wn).call(this,El).firstElementChild.firstElementChild);break}case"map_response_point":{this.appendChild(P(this,pr,wn).call(this,Cl).firstElementChild.firstElementChild);break}case"match_correct":this.appendChild(P(this,pr,wn).call(this,wl).firstElementChild.firstElementChild);break}}}};pr=new WeakSet,wn=function(e){return document.createRange().createContextualFragment(e)},ci.styles=[C`
137
+ </qti-response-processing>`;var mr,An,ui=class extends E{constructor(){super(...arguments);L(this,mr)}render(){return x`<slot></slot>`}process(){if(!this.closest("qti-assessment-item"))return;let t=[...this.children];for(let i of t)i.process()}firstUpdated(e){if(this.getAttribute("template")){let t=this.getAttribute("template").split("/"),i=t[t.length-1].replace(".xml","");switch(this.innerHTML="",i){case"map_response":{this.appendChild(P(this,mr,An).call(this,Pl).firstElementChild.firstElementChild);break}case"map_response_point":{this.appendChild(P(this,mr,An).call(this,Vl).firstElementChild.firstElementChild);break}case"match_correct":this.appendChild(P(this,mr,An).call(this,$l).firstElementChild.firstElementChild);break}}}};mr=new WeakSet,An=function(e){return document.createRange().createContextualFragment(e)},ui.styles=[C`
138
138
  :host {
139
139
  display: none;
140
140
  }
141
- `],ci=d([k("qti-response-processing")],ci);var ct,dt,Sl,Al,Tl,Ve=class extends E{constructor(){super(...arguments);L(this,dt);this.identifier="";this.cardinality="single";this.baseType="string";this.mathVariable=!1;this.paramVariable=!1;L(this,ct,null)}render(){return x`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{P(this,dt,Sl).call(this),P(this,dt,Tl).call(this)})}getTemplateVariable(){return{identifier:this.identifier,cardinality:this.cardinality,baseType:this.baseType,value:I(this,ct),type:"template",mathVariable:this.mathVariable,paramVariable:this.paramVariable}}};ct=new WeakMap,dt=new WeakSet,Sl=function(){let e=this.querySelector("qti-default-value");if(!e)return;let t=e.textContent?.trim()||"";U(this,ct,P(this,dt,Al).call(this,t))},Al=function(e){if(!e)return null;switch(this.baseType){case"integer":return parseInt(e,10);case"float":case"duration":return parseFloat(e);case"boolean":return e.toLowerCase()==="true";default:return e}},Tl=function(){let t={...{identifier:this.identifier,cardinality:this.cardinality,baseType:this.baseType,defaultValue:I(this,ct),value:I(this,ct),type:"template",mathVariable:this.mathVariable,paramVariable:this.paramVariable},value:I(this,ct)?.toString()||""};this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:t}}))},Ve.styles=[C`
141
+ `],ui=d([R("qti-response-processing")],ui);var dt,pt,Dl,Nl,Ol,De=class extends E{constructor(){super(...arguments);L(this,pt);this.identifier="";this.cardinality="single";this.baseType="string";this.mathVariable=!1;this.paramVariable=!1;L(this,dt,null)}render(){return x`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{P(this,pt,Dl).call(this),P(this,pt,Ol).call(this)})}getTemplateVariable(){return{identifier:this.identifier,cardinality:this.cardinality,baseType:this.baseType,value:S(this,dt),type:"template",mathVariable:this.mathVariable,paramVariable:this.paramVariable}}};dt=new WeakMap,pt=new WeakSet,Dl=function(){let e=this.querySelector("qti-default-value");if(!e)return;let t=e.textContent?.trim()||"";U(this,dt,P(this,pt,Nl).call(this,t))},Nl=function(e){if(!e)return null;switch(this.baseType){case"integer":return parseInt(e,10);case"float":case"duration":return parseFloat(e);case"boolean":return e.toLowerCase()==="true";default:return e}},Ol=function(){let t={...{identifier:this.identifier,cardinality:this.cardinality,baseType:this.baseType,defaultValue:S(this,dt),value:S(this,dt),type:"template",mathVariable:this.mathVariable,paramVariable:this.paramVariable},value:S(this,dt)?.toString()||""};this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:t}}))},De.styles=[C`
142
142
  :host {
143
143
  display: none;
144
144
  }
145
- `],d([g({type:String})],Ve.prototype,"identifier",2),d([g({type:String})],Ve.prototype,"cardinality",2),d([g({type:String,attribute:"base-type"})],Ve.prototype,"baseType",2),d([g({type:Boolean,attribute:"math-variable"})],Ve.prototype,"mathVariable",2),d([g({type:Boolean,attribute:"param-variable"})],Ve.prototype,"paramVariable",2),Ve=d([k("qti-template-declaration")],Ve);var En,di=class extends E{constructor(){super(...arguments);L(this,En,100)}render(){return x`<slot></slot>`}process(){if(!this.closest("qti-assessment-item")){console.warn("qti-template-processing must be inside qti-assessment-item");return}let t=0,i=!1;do{if(i=!1,t++,t>I(this,En)){console.error("Template processing exceeded maximum iterations. Possible infinite loop.");break}try{let n=[...this.children];for(let o of n)if(o.tagName.toLowerCase()==="qti-template-constraint"){if(o.calculate()===!1){i=!0;break}}else o.process()}catch(n){console.error("Error during template processing:",n);break}}while(i);this.dispatchEvent(new CustomEvent("qti-template-processing-complete",{bubbles:!0,composed:!0,detail:{iterations:t}}))}firstUpdated(e){this.getAttribute("template")&&console.info("Template processing with external template not yet implemented")}};En=new WeakMap,di.styles=[C`
145
+ `],d([g({type:String})],De.prototype,"identifier",2),d([g({type:String})],De.prototype,"cardinality",2),d([g({type:String,attribute:"base-type"})],De.prototype,"baseType",2),d([g({type:Boolean,attribute:"math-variable"})],De.prototype,"mathVariable",2),d([g({type:Boolean,attribute:"param-variable"})],De.prototype,"paramVariable",2),De=d([R("qti-template-declaration")],De);var Tn,mi=class extends E{constructor(){super(...arguments);L(this,Tn,100)}render(){return x`<slot></slot>`}process(){if(!this.closest("qti-assessment-item")){console.warn("qti-template-processing must be inside qti-assessment-item");return}let t=0,i=!1;do{if(i=!1,t++,t>S(this,Tn)){console.error("Template processing exceeded maximum iterations. Possible infinite loop.");break}try{let n=[...this.children];for(let s of n)if(s.tagName.toLowerCase()==="qti-template-constraint"){if(s.calculate()===!1){i=!0;break}}else s.process()}catch(n){console.error("Error during template processing:",n);break}}while(i);this.dispatchEvent(new CustomEvent("qti-template-processing-complete",{bubbles:!0,composed:!0,detail:{iterations:t}}))}firstUpdated(e){this.getAttribute("template")&&console.info("Template processing with external template not yet implemented")}};Tn=new WeakMap,mi.styles=[C`
146
146
  :host {
147
147
  display: none;
148
148
  }
149
- `],di=d([k("qti-template-processing")],di);var Cn=class extends E{render(){return x`<slot></slot>`}calculate(){let r=[...this.children];if(r.length!==1)return console.error("qti-template-constraint must have exactly one child expression"),!0;try{return!!r[0].calculate()}catch(e){return console.error("Error evaluating template constraint:",e),!0}}getSubRules(){return[]}process(){let r=this.calculate();return r||console.debug("Template constraint not satisfied, restarting template processing"),r}};Cn=d([k("qti-template-constraint")],Cn);var $t=class extends E{constructor(){super(...arguments);this.identifier="";this.cardinality="record"}render(){return x`<slot></slot>`}};$t.styles=[C`
149
+ `],mi=d([R("qti-template-processing")],mi);var In=class extends E{render(){return x`<slot></slot>`}calculate(){let r=[...this.children];if(r.length!==1)return console.error("qti-template-constraint must have exactly one child expression"),!0;try{return!!r[0].calculate()}catch(e){return console.error("Error evaluating template constraint:",e),!0}}getSubRules(){return[]}process(){let r=this.calculate();return r||console.debug("Template constraint not satisfied, restarting template processing"),r}};In=d([R("qti-template-constraint")],In);var Pt=class extends E{constructor(){super(...arguments);this.identifier="";this.cardinality="record"}render(){return x`<slot></slot>`}};Pt.styles=[C`
150
150
  :host {
151
151
  display: none;
152
152
  }
153
- `],d([g({type:String})],$t.prototype,"identifier",2),d([g({type:String})],$t.prototype,"cardinality",2),$t=d([k("qti-context-declaration")],$t);var pi=class extends Lt{render(){return x``}};pi.styles=C`
153
+ `],d([g({type:String})],Pt.prototype,"identifier",2),d([g({type:String})],Pt.prototype,"cardinality",2),Pt=d([R("qti-context-declaration")],Pt);var hi=class extends $t{render(){return x``}};hi.styles=C`
154
154
  :host {
155
155
  color: gray;
156
156
  }
157
- `,pi=d([k("qti-test-feedback")],pi);var he,Q,Il,Rl,kl,Ml,_l,Ll,$l,Pl,ye=class extends E{constructor(){super();L(this,Q);this.identifier=void 0;this.initContext=[];this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}};this.configContext={};this.autoScoreItems=!1;L(this,he);this.addEventListener("qti-assessment-test-connected",P(this,Q,Ll).bind(this)),this.addEventListener("qti-assessment-item-connected",P(this,Q,Pl).bind(this)),this.addEventListener("qti-interaction-changed",P(this,Q,_l).bind(this)),this.addEventListener("test-end-attempt",P(this,Q,Il).bind(this)),this.addEventListener("test-show-correct-response",P(this,Q,Rl).bind(this)),this.addEventListener("test-show-candidate-correction",P(this,Q,kl).bind(this)),this.addEventListener("test-update-outcome-variable",P(this,Q,Ml).bind(this))}render(){return x`<slot></slot>`}willUpdate(e){if(!this.computedContext)return;let t=1;this.computedContext={...this.computedContext,view:this._sessionContext?.view,testParts:this.computedContext.testParts.map(i=>({...i,active:this._sessionContext?.navPartId===i.identifier||!1,sections:i.sections.map(n=>({...n,active:this._sessionContext?.navSectionId===n.identifier||!1,completed:n.items.every(o=>this._testContext.items.find(a=>a.identifier===o.identifier)?.variables.find(a=>a.identifier==="completionStatus").value==="completed"),items:n.items.map(o=>{let a=this._testContext?.items.find(v=>v.identifier===o.identifier),l={...o,...a,...this.initContext?.find(v=>v.identifier===o.identifier)},c=l.variables?.find(v=>v.identifier=="SCORE")?.value,p=c==null?null:parseFloat(c?.toString()),u=l.variables?.find(v=>v.identifier==="completionStatus")?.value,m=l.variables?.find(v=>v.identifier==="RESPONSE")?.value||"",y=l.variables?.find(v=>v.identifier==="numAttempts")?.value||0,b=this._sessionContext?.navItemRefId===l.identifier||!1,w=o.categories.includes(this.configContext?.infoItemCategory)?null:t++,f=o.variables?.find(v=>v.identifier=="MAXSCORE")?.value,h=f==null?null:parseFloat(f?.toString());return{...l,completionStatus:u,numAttempts:y,score:p,response:m,index:w,active:b,maxScore:h}})}))}))},this.dispatchEvent(new CustomEvent("qti-computed-context-updated",{detail:this.computedContext,bubbles:!0}))}};he=new WeakMap,Q=new WeakSet,Il=function(e){let i=I(this,he).querySelector(`qti-assessment-item-ref[identifier="${this._sessionContext.navItemRefId}"]`).assessmentItem,n=this.configContext?.reportValidityAfterScoring===!0;i.processResponse(!0,n)},Rl=function(e){let i=I(this,he).querySelector(`qti-assessment-item-ref[identifier="${this._sessionContext.navItemRefId}"]`).assessmentItem;i&&i.showCorrectResponse(e.detail)},kl=function(e){I(this,he).querySelector(`qti-assessment-item-ref[identifier="${this._sessionContext.navItemRefId}"]`).assessmentItem.showCandidateCorrection(e.detail)},Ml=function(e){I(this,he).querySelector(`qti-assessment-item-ref[identifier="${e.detail.assessmentItemRefId}"]`).assessmentItem.setOutcomeVariable(e.detail.outcomeVariableId,e.detail.value)},_l=function(e){if(this.autoScoreItems){let t=e.composedPath()[0].closest("qti-assessment-item"),i=t.variables.find(n=>n.identifier==="SCORE");if(i&&i.externalScored===null&&t.adaptive==="false"){let n=this.configContext?.reportValidityAfterScoring===!0;t.processResponse(!0,n)}}},Ll=function(e){if(U(this,he,e.detail),!this.qtiContext.QTI_CONTEXT?.testIdentifier){let n=this.qtiContext.QTI_CONTEXT||{testIdentifier:"",candidateIdentifier:"not set",environmentIdentifier:"default"};this.qtiContext={QTI_CONTEXT:{...n,testIdentifier:I(this,he).identifier,environmentIdentifier:n.environmentIdentifier||"default"}}}I(this,he).querySelectorAll('qti-context-declaration[identifier="QTI_CONTEXT"]').forEach(n=>{let o=P(this,Q,$l).call(this,n);Object.keys(o).length>0&&(this.qtiContext={QTI_CONTEXT:{...o,...this.qtiContext.QTI_CONTEXT}})});let i=Array.from(I(this,he)?.querySelectorAll("qti-test-part")||[]);this.computedContext={identifier:I(this,he).identifier,title:I(this,he).title,view:this._sessionContext?.view,testParts:i.map(n=>{let o=[...n.querySelectorAll("qti-assessment-section")];return{active:!1,identifier:n.identifier,navigationMode:n.navigationMode,submissionMode:n.submissionMode,sections:o.map(a=>{let l=[...a.querySelectorAll("qti-assessment-item-ref")];return{active:!1,identifier:a.identifier,title:a.title,items:l.map(c=>({...this.initContext?.find(p=>p.identifier===c.identifier),active:!1,identifier:c.identifier,categories:c.category?c.category?.split(" "):[],href:c.href,variables:[]}))}})}})}},$l=function(e){let t={},i=e.querySelector("qti-default-value");return i&&i.querySelectorAll("qti-value[field-identifier]").forEach(o=>{let a=o.getAttribute("field-identifier"),l=o.getAttribute("base-type")||"string",c=o.textContent?.trim()||"";if(a){let p=c;switch(l){case"integer":p=parseInt(c,10);break;case"float":case"duration":p=parseFloat(c);break;case"boolean":p=c.toLowerCase()==="true";break;default:p=c;break}t[a]=p}}),t},Pl=function(e){let t=e.detail;this.computedContext={...this.computedContext,testParts:this.computedContext.testParts.map(i=>({...i,sections:i.sections.map(n=>({...n,items:n.items.map(o=>{if(o.identifier!==t.parentElement.getAttribute("identifier"))return o;let l=t.querySelector("qti-outcome-declaration[identifier='SCORE']")?.getAttribute("externalScored"),c=t.querySelectorAll("qti-response-declaration"),p=Array.from(c).some(b=>b.querySelector("qti-correct-response")),u=Array.from(c).some(b=>{let w=b.querySelector("qti-mapping"),f=b.querySelector("qti-area-mapping");return w?.querySelector("qti-map-entry")||f?.querySelector("qti-area-map-entry")}),m=p||u,y=!!t.querySelector("qti-response-processing");return{...o,assessmentItemIdentifier:t.getAttribute("identifier"),label:t.getAttribute("label"),title:t.title,externalScored:l,adaptive:t.adaptive=="true"||!1,timeDependent:t.timeDependent=="true"||!1,variables:t.variables,hasCorrectResponse:m,hasResponseProcessing:y}})}))}))}},d([g({type:String})],ye.prototype,"identifier",2),d([M()],ye.prototype,"initContext",2),d([M(),ce({context:ir})],ye.prototype,"qtiContext",2),d([M(),ce({context:ge})],ye.prototype,"configContext",2),d([M(),$({context:_e,subscribe:!0})],ye.prototype,"_testContext",2),d([M(),$({context:it,subscribe:!0})],ye.prototype,"_sessionContext",2),d([M(),ce({context:G})],ye.prototype,"computedContext",2),d([g({type:Boolean,attribute:"auto-score-items"})],ye.prototype,"autoScoreItems",2),ye=d([k("test-navigation")],ye);var Vl=C`
157
+ `,hi=d([R("qti-test-feedback")],hi);var fe,Q,Hl,Fl,Ul,Bl,zl,jl,Wl,Gl,xe=class extends E{constructor(){super();L(this,Q);this.identifier=void 0;this.initContext=[];this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}};this.configContext={};this.autoScoreItems=!1;L(this,fe);this.addEventListener("qti-assessment-test-connected",P(this,Q,jl).bind(this)),this.addEventListener("qti-assessment-item-connected",P(this,Q,Gl).bind(this)),this.addEventListener("qti-interaction-changed",P(this,Q,zl).bind(this)),this.addEventListener("test-end-attempt",P(this,Q,Hl).bind(this)),this.addEventListener("test-show-correct-response",P(this,Q,Fl).bind(this)),this.addEventListener("test-show-candidate-correction",P(this,Q,Ul).bind(this)),this.addEventListener("test-update-outcome-variable",P(this,Q,Bl).bind(this))}render(){return x`<slot></slot>`}willUpdate(e){if(!this.computedContext)return;let t=1;this.computedContext={...this.computedContext,view:this._sessionContext?.view,testParts:this.computedContext.testParts.map(i=>({...i,active:this._sessionContext?.navPartId===i.identifier||!1,sections:i.sections.map(n=>({...n,active:this._sessionContext?.navSectionId===n.identifier||!1,completed:n.items.every(s=>this._testContext.items.find(a=>a.identifier===s.identifier)?.variables.find(a=>a.identifier==="completionStatus").value==="completed"),items:n.items.map(s=>{let a=this._testContext?.items.find(b=>b.identifier===s.identifier),l={...s,...a,...this.initContext?.find(b=>b.identifier===s.identifier)},c=l.variables?.find(b=>b.identifier=="SCORE")?.value,p=c==null?null:parseFloat(c?.toString()),u=l.variables?.find(b=>b.identifier==="completionStatus")?.value,h=l.variables?.find(b=>b.identifier==="RESPONSE")?.value||"",v=l.variables?.find(b=>b.identifier==="numAttempts")?.value||0,y=this._sessionContext?.navItemRefId===l.identifier||!1,w=s.categories.includes(this.configContext?.infoItemCategory)?null:t++,f=s.variables?.find(b=>b.identifier=="MAXSCORE")?.value,m=f==null?null:parseFloat(f?.toString());return{...l,completionStatus:u,numAttempts:v,score:p,response:h,index:w,active:y,maxScore:m}})}))}))},this.dispatchEvent(new CustomEvent("qti-computed-context-updated",{detail:this.computedContext,bubbles:!0}))}};fe=new WeakMap,Q=new WeakSet,Hl=function(e){let i=S(this,fe).querySelector(`qti-assessment-item-ref[identifier="${this._sessionContext.navItemRefId}"]`).assessmentItem,n=this.configContext?.reportValidityAfterScoring===!0;i.processResponse(!0,n)},Fl=function(e){let i=S(this,fe).querySelector(`qti-assessment-item-ref[identifier="${this._sessionContext.navItemRefId}"]`).assessmentItem;i&&i.showCorrectResponse(e.detail)},Ul=function(e){S(this,fe).querySelector(`qti-assessment-item-ref[identifier="${this._sessionContext.navItemRefId}"]`).assessmentItem.showCandidateCorrection(e.detail)},Bl=function(e){S(this,fe).querySelector(`qti-assessment-item-ref[identifier="${e.detail.assessmentItemRefId}"]`).assessmentItem.setOutcomeVariable(e.detail.outcomeVariableId,e.detail.value)},zl=function(e){if(this.autoScoreItems){let t=e.composedPath()[0].closest("qti-assessment-item"),i=t.variables.find(n=>n.identifier==="SCORE");if(i&&i.externalScored===null&&t.adaptive==="false"){let n=this.configContext?.reportValidityAfterScoring===!0;t.processResponse(!0,n)}}},jl=function(e){if(U(this,fe,e.detail),!this.qtiContext.QTI_CONTEXT?.testIdentifier){let n=this.qtiContext.QTI_CONTEXT||{testIdentifier:"",candidateIdentifier:"not set",environmentIdentifier:"default"};this.qtiContext={QTI_CONTEXT:{...n,testIdentifier:S(this,fe).identifier,environmentIdentifier:n.environmentIdentifier||"default"}}}S(this,fe).querySelectorAll('qti-context-declaration[identifier="QTI_CONTEXT"]').forEach(n=>{let s=P(this,Q,Wl).call(this,n);Object.keys(s).length>0&&(this.qtiContext={QTI_CONTEXT:{...s,...this.qtiContext.QTI_CONTEXT}})});let i=Array.from(S(this,fe)?.querySelectorAll("qti-test-part")||[]);this.computedContext={identifier:S(this,fe).identifier,title:S(this,fe).title,view:this._sessionContext?.view,testParts:i.map(n=>{let s=[...n.querySelectorAll("qti-assessment-section")];return{active:!1,identifier:n.identifier,navigationMode:n.navigationMode,submissionMode:n.submissionMode,sections:s.map(a=>{let l=[...a.querySelectorAll("qti-assessment-item-ref")];return{active:!1,identifier:a.identifier,title:a.title,items:l.map(c=>({...this.initContext?.find(p=>p.identifier===c.identifier),active:!1,identifier:c.identifier,categories:c.category?c.category?.split(" "):[],href:c.href,variables:[]}))}})}})}},Wl=function(e){let t={},i=e.querySelector("qti-default-value");return i&&i.querySelectorAll("qti-value[field-identifier]").forEach(s=>{let a=s.getAttribute("field-identifier"),l=s.getAttribute("base-type")||"string",c=s.textContent?.trim()||"";if(a){let p=c;switch(l){case"integer":p=parseInt(c,10);break;case"float":case"duration":p=parseFloat(c);break;case"boolean":p=c.toLowerCase()==="true";break;default:p=c;break}t[a]=p}}),t},Gl=function(e){let t=e.detail;this.computedContext={...this.computedContext,testParts:this.computedContext.testParts.map(i=>({...i,sections:i.sections.map(n=>({...n,items:n.items.map(s=>{if(s.identifier!==t.parentElement.getAttribute("identifier"))return s;let l=t.querySelector("qti-outcome-declaration[identifier='SCORE']")?.getAttribute("externalScored"),c=t.querySelectorAll("qti-response-declaration"),p=Array.from(c).some(y=>y.querySelector("qti-correct-response")),u=Array.from(c).some(y=>{let w=y.querySelector("qti-mapping"),f=y.querySelector("qti-area-mapping");return w?.querySelector("qti-map-entry")||f?.querySelector("qti-area-map-entry")}),h=p||u,v=!!t.querySelector("qti-response-processing");return{...s,assessmentItemIdentifier:t.getAttribute("identifier"),label:t.getAttribute("label"),title:t.title,externalScored:l,adaptive:t.adaptive=="true"||!1,timeDependent:t.timeDependent=="true"||!1,variables:t.variables,hasCorrectResponse:h,hasResponseProcessing:v}})}))}))}},d([g({type:String})],xe.prototype,"identifier",2),d([k()],xe.prototype,"initContext",2),d([k(),ee({context:be})],xe.prototype,"qtiContext",2),d([k(),$({context:ne,subscribe:!0})],xe.prototype,"configContext",2),d([k(),$({context:_e,subscribe:!0})],xe.prototype,"_testContext",2),d([k(),$({context:nt,subscribe:!0})],xe.prototype,"_sessionContext",2),d([k(),ee({context:G})],xe.prototype,"computedContext",2),d([g({type:Boolean,attribute:"auto-score-items"})],xe.prototype,"autoScoreItems",2),xe=d([R("test-navigation")],xe);var Xl=C`
158
158
  display: inline-flex;
159
159
  align-items: center;
160
160
  cursor: pointer;
161
161
  padding: 0.5rem 1rem;
162
162
  border-radius: 0.25rem;
163
163
  user-select: none;
164
- `,ie=C`
164
+ `,oe=C`
165
165
  background-color: lightgray;
166
- ${Vl};
167
- `,ne=C`
166
+ ${Xl};
167
+ `,se=C`
168
168
  cursor: not-allowed;
169
169
  opacity: 0.8;
170
- `,Uv=C`
171
- ${Vl};
170
+ `,Ly=C`
171
+ ${Xl};
172
172
  border: 1px solid gray;
173
- `;var ur,pt=class extends E{constructor(){super();this._internalDisabled=!0;L(this,ur);U(this,ur,this.attachInternals()),I(this,ur).role="button",I(this,ur).ariaLabel="Next item",this.addEventListener("click",e=>{e.preventDefault(),this._internalDisabled||this._requestItem(this.sectionItems[this.itemIndex+1].identifier)})}_handleTestElementChange(e,t){t&&(this._internalDisabled=!1)}connectedCallback(){super.connectedCallback(),this.checkDisabled()}willUpdate(e){if(!this.computedContext)return;let t=this.computedContext?.testParts.find(i=>i.active);t&&(this.sectionItems=t.sections.flatMap(i=>i.items),this.itemIndex=this.sectionItems.findIndex(i=>i.active),this.checkDisabled())}checkDisabled(){this._internalDisabled=!this.computedContext||this.itemIndex<0||this.itemIndex>=this.sectionItems?.length-1}_requestItem(e){this.dispatchEvent(new CustomEvent("qti-request-navigation",{composed:!0,bubbles:!0,detail:{type:"item",id:e}}))}render(){return x`<slot></slot>`}};ur=new WeakMap,pt.styles=C`
173
+ `;var hr,ut=class extends E{constructor(){super();this._internalDisabled=!0;L(this,hr);U(this,hr,this.attachInternals()),S(this,hr).role="button",S(this,hr).ariaLabel="Next item",this.addEventListener("click",e=>{e.preventDefault(),this._internalDisabled||this._requestItem(this.sectionItems[this.itemIndex+1].identifier)})}_handleTestElementChange(e,t){t&&(this._internalDisabled=!1)}connectedCallback(){super.connectedCallback(),this.checkDisabled()}willUpdate(e){if(!this.computedContext)return;let t=this.computedContext?.testParts.find(i=>i.active);t&&(this.sectionItems=t.sections.flatMap(i=>i.items),this.itemIndex=this.sectionItems.findIndex(i=>i.active),this.checkDisabled())}checkDisabled(){this._internalDisabled=!this.computedContext||this.itemIndex<0||this.itemIndex>=this.sectionItems?.length-1}_requestItem(e){this.dispatchEvent(new CustomEvent("qti-request-navigation",{composed:!0,bubbles:!0,detail:{type:"item",id:e}}))}render(){return x`<slot></slot>`}};hr=new WeakMap,ut.styles=C`
174
174
  :host {
175
- ${ie};
175
+ ${oe};
176
176
  }
177
177
  :host([disabled]) {
178
- ${ne};
178
+ ${se};
179
179
  }
180
- `,d([g({type:Boolean,reflect:!0,attribute:"disabled"})],pt.prototype,"_internalDisabled",2),d([$({context:G,subscribe:!0})],pt.prototype,"computedContext",2),d([B("computedContext")],pt.prototype,"_handleTestElementChange",1),pt=d([k("test-next")],pt);var ut=class extends E{constructor(){super();this._internalDisabled=!0;this.addEventListener("click",e=>{e.preventDefault(),this._internalDisabled||this._requestItem(this.sectionItems[this.itemIndex-1].identifier)})}_handleTestElementChange(e,t){t&&(this._internalDisabled=!1)}willUpdate(e){if(!this.computedContext)return;let t=this.computedContext?.testParts.find(i=>i.active);t&&(this.sectionItems=t.sections.flatMap(i=>i.items),this.itemIndex=this.sectionItems.findIndex(i=>i.active),this.checkDisabled())}checkDisabled(){this._internalDisabled=!this.computedContext||this.itemIndex===0||this.itemIndex===-1}_requestItem(e){this.dispatchEvent(new CustomEvent("qti-request-navigation",{composed:!0,bubbles:!0,detail:{type:"item",id:e}}))}render(){return x`<slot></slot>`}};ut.styles=C`
180
+ `,d([g({type:Boolean,reflect:!0,attribute:"disabled"})],ut.prototype,"_internalDisabled",2),d([$({context:G,subscribe:!0})],ut.prototype,"computedContext",2),d([B("computedContext")],ut.prototype,"_handleTestElementChange",1),ut=d([R("test-next")],ut);var mt=class extends E{constructor(){super();this._internalDisabled=!0;this.addEventListener("click",e=>{e.preventDefault(),this._internalDisabled||this._requestItem(this.sectionItems[this.itemIndex-1].identifier)})}_handleTestElementChange(e,t){t&&(this._internalDisabled=!1)}willUpdate(e){if(!this.computedContext)return;let t=this.computedContext?.testParts.find(i=>i.active);t&&(this.sectionItems=t.sections.flatMap(i=>i.items),this.itemIndex=this.sectionItems.findIndex(i=>i.active),this.checkDisabled())}checkDisabled(){this._internalDisabled=!this.computedContext||this.itemIndex===0||this.itemIndex===-1}_requestItem(e){this.dispatchEvent(new CustomEvent("qti-request-navigation",{composed:!0,bubbles:!0,detail:{type:"item",id:e}}))}render(){return x`<slot></slot>`}};mt.styles=C`
181
181
  :host {
182
- ${ie};
182
+ ${oe};
183
183
  }
184
184
  :host([disabled]) {
185
- ${ne};
185
+ ${se};
186
186
  }
187
- `,d([g({type:Boolean,reflect:!0,attribute:"disabled"})],ut.prototype,"_internalDisabled",2),d([$({context:G,subscribe:!0})],ut.prototype,"computedContext",2),d([B("computedContext")],ut.prototype,"_handleTestElementChange",1),ut=d([k("test-prev")],ut);var ui,os,oe=class extends E{constructor(){super(...arguments);L(this,ui);this.label="view";this._handleViewOptionsChange=()=>{P(this,ui,os).call(this)};this._viewOptions=oe.DEFAULT_VIEW_OPTIONS}connectedCallback(){super.connectedCallback(),P(this,ui,os).call(this)}_switchView(e){this.dispatchEvent(new CustomEvent("on-test-switch-view",{composed:!0,bubbles:!0,detail:e}))}render(){return x`
187
+ `,d([g({type:Boolean,reflect:!0,attribute:"disabled"})],mt.prototype,"_internalDisabled",2),d([$({context:G,subscribe:!0})],mt.prototype,"computedContext",2),d([B("computedContext")],mt.prototype,"_handleTestElementChange",1),mt=d([R("test-prev")],mt);var fi,ms,ae=class extends E{constructor(){super(...arguments);L(this,fi);this.label="view";this._handleViewOptionsChange=()=>{P(this,fi,ms).call(this)};this._viewOptions=ae.DEFAULT_VIEW_OPTIONS}connectedCallback(){super.connectedCallback(),P(this,fi,ms).call(this)}_switchView(e){this.dispatchEvent(new CustomEvent("on-test-switch-view",{composed:!0,bubbles:!0,detail:e}))}render(){return x`
188
188
  <label part="label" for="viewSelect">${this.label}</label>
189
189
  <select
190
190
  part="select"
@@ -193,31 +193,31 @@ Make sure to test your application with a production build as repeat registratio
193
193
  >
194
194
  ${this._viewOptions.map(e=>x`<option value="${e}" ?selected=${e===this.sessionContext.view}>${e}</option>`)}
195
195
  </select>
196
- `}};ui=new WeakSet,os=function(){if(this.viewOptions){let e=this.viewOptions.split(",").map(t=>t.trim());this._viewOptions=e.filter(t=>oe.DEFAULT_VIEW_OPTIONS.includes(t))}else this._viewOptions=oe.DEFAULT_VIEW_OPTIONS},oe.DEFAULT_VIEW_OPTIONS=["author","candidate","proctor","scorer","testConstructor","tutor"],d([$({context:it,subscribe:!0})],oe.prototype,"sessionContext",2),d([g({type:String})],oe.prototype,"label",2),d([g({type:String,attribute:"view-options"})],oe.prototype,"viewOptions",2),d([B("viewOptions",{waitUntilFirstUpdate:!0})],oe.prototype,"_handleViewOptionsChange",2),d([M()],oe.prototype,"_viewOptions",2),oe=d([k("test-view")],oe);var mr=class extends E{constructor(){super();this.itemId=null;this.addEventListener("click",()=>this._requestItem(this.itemId))}_requestItem(e){this.dispatchEvent(new CustomEvent("qti-request-navigation",{composed:!0,bubbles:!0,detail:{type:"item",id:e}}))}render(){return x` <slot></slot> `}};mr.styles=C`
196
+ `}};fi=new WeakSet,ms=function(){if(this.viewOptions){let e=this.viewOptions.split(",").map(t=>t.trim());this._viewOptions=e.filter(t=>ae.DEFAULT_VIEW_OPTIONS.includes(t))}else this._viewOptions=ae.DEFAULT_VIEW_OPTIONS},ae.DEFAULT_VIEW_OPTIONS=["author","candidate","proctor","scorer","testConstructor","tutor"],d([$({context:nt,subscribe:!0})],ae.prototype,"sessionContext",2),d([g({type:String})],ae.prototype,"label",2),d([g({type:String,attribute:"view-options"})],ae.prototype,"viewOptions",2),d([B("viewOptions",{waitUntilFirstUpdate:!0})],ae.prototype,"_handleViewOptionsChange",2),d([k()],ae.prototype,"_viewOptions",2),ae=d([R("test-view")],ae);var fr=class extends E{constructor(){super();this.itemId=null;this.addEventListener("click",()=>this._requestItem(this.itemId))}_requestItem(e){this.dispatchEvent(new CustomEvent("qti-request-navigation",{composed:!0,bubbles:!0,detail:{type:"item",id:e}}))}render(){return x` <slot></slot> `}};fr.styles=C`
197
197
  :host {
198
- ${ie};
198
+ ${oe};
199
199
  }
200
200
  :host([disabled]) {
201
- ${ne};
201
+ ${se};
202
202
  }
203
- `,d([g({type:String,attribute:"item-id"})],mr.prototype,"itemId",2),mr=d([k("test-item-link")],mr);var mi=class extends E{constructor(){super(),this.addEventListener("click",()=>this.dispatchEvent(new CustomEvent("test-end-attempt",{bubbles:!0})))}render(){return x` <slot></slot> `}};mi.styles=C`
203
+ `,d([g({type:String,attribute:"item-id"})],fr.prototype,"itemId",2),fr=d([R("test-item-link")],fr);var gi=class extends E{constructor(){super(),this.addEventListener("click",()=>this.dispatchEvent(new CustomEvent("test-end-attempt",{bubbles:!0})))}render(){return x` <slot></slot> `}};gi.styles=C`
204
204
  :host {
205
- ${ie};
205
+ ${oe};
206
206
  }
207
207
  :host([disabled]) {
208
- ${ne};
208
+ ${se};
209
209
  }
210
- `,mi=d([k("test-end-attempt")],mi);var hi,hr,Dl,Nl,Ee=class extends E{constructor(){super(...arguments);L(this,hr);this.shown=!1;this.disabled=!1;this.showCorrectText="Show correct response";this.hideCorrectText="Hide correct response";this.noCorrectResponseText="No correct response specified";L(this,hi)}willUpdate(e){let t=this.computedContext?.testParts.flatMap(i=>i.sections.flatMap(n=>n.items)).find(i=>i.active);if(I(this,hi)!==t&&(this.shown=!1,U(this,hi,t)),t){let i=!!t?.variables?.some(o=>o.correctResponse),n=!!t?.variables?.some(o=>o.mapping?.mapEntries?.length>0||o.areaMapping?.areaMapEntries?.length>0);this.disabled=!i&&!n}else this.disabled=!0}render(){return x` <div @click="${P(this,hr,Dl)}">${P(this,hr,Nl).call(this)}</div> `}};hi=new WeakMap,hr=new WeakSet,Dl=function(){this.disabled||(this.shown=!this.shown,this.dispatchEvent(new CustomEvent("test-show-correct-response",{detail:this.shown,bubbles:!0})))},Nl=function(){return this.disabled?this.noCorrectResponseText:this.shown?this.hideCorrectText:this.showCorrectText},Ee.styles=C`
210
+ `,gi=d([R("test-end-attempt")],gi);var bi,gr,Ql,Yl,Ce=class extends E{constructor(){super(...arguments);L(this,gr);this.shown=!1;this.disabled=!1;this.showCorrectText="Show correct response";this.hideCorrectText="Hide correct response";this.noCorrectResponseText="No correct response specified";L(this,bi)}willUpdate(e){let t=this.computedContext?.testParts.flatMap(i=>i.sections.flatMap(n=>n.items)).find(i=>i.active);if(S(this,bi)!==t&&(this.shown=!1,U(this,bi,t)),t){let i=!!t?.variables?.some(s=>s.correctResponse),n=!!t?.variables?.some(s=>s.mapping?.mapEntries?.length>0||s.areaMapping?.areaMapEntries?.length>0);this.disabled=!i&&!n}else this.disabled=!0}render(){return x` <div @click="${P(this,gr,Ql)}">${P(this,gr,Yl).call(this)}</div> `}};bi=new WeakMap,gr=new WeakSet,Ql=function(){this.disabled||(this.shown=!this.shown,this.dispatchEvent(new CustomEvent("test-show-correct-response",{detail:this.shown,bubbles:!0})))},Yl=function(){return this.disabled?this.noCorrectResponseText:this.shown?this.hideCorrectText:this.showCorrectText},Ce.styles=C`
211
211
  :host {
212
- ${ie};
212
+ ${oe};
213
213
  }
214
214
  :host([disabled]) {
215
- ${ne};
215
+ ${se};
216
216
  }
217
- `,d([$({context:G,subscribe:!0})],Ee.prototype,"computedContext",2),d([g({type:Boolean,reflect:!0})],Ee.prototype,"shown",2),d([g({type:Boolean,reflect:!0})],Ee.prototype,"disabled",2),d([g({type:String})],Ee.prototype,"showCorrectText",2),d([g({type:String})],Ee.prototype,"hideCorrectText",2),d([g({type:String})],Ee.prototype,"noCorrectResponseText",2),Ee=d([k("test-show-correct-response")],Ee);var _n=globalThis,Sn=_n.trustedTypes,Ol=Sn?Sn.createPolicy("lit-html",{createHTML:s=>s}):void 0,as="$lit$",Ge=`lit$${Math.random().toFixed(9).slice(2)}$`,ls="?"+Ge,Qd=`<${ls}>`,Nt=_n.document===void 0?{createTreeWalker:()=>({})}:document,An=()=>Nt.createComment(""),gi=s=>s===null||typeof s!="object"&&typeof s!="function",cs=Array.isArray,jl=s=>cs(s)||typeof s?.[Symbol.iterator]=="function",ss=`[
218
- \f\r]`,fi=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Hl=/-->/g,Fl=/>/g,Vt=RegExp(`>|${ss}(?:([^\\s"'>=/]+)(${ss}*=${ss}*(?:[^
219
- \f\r"'\`<>=]|("|')|))|$)`,"g"),Ul=/'/g,Bl=/"/g,Wl=/^(?:script|style|textarea|title)$/i,ds=s=>(r,...e)=>({_$litType$:s,strings:r,values:e}),Cy=ds(1),Sy=ds(2),Ay=ds(3),Ot=Symbol.for("lit-noChange"),X=Symbol.for("lit-nothing"),zl=new WeakMap,Dt=Nt.createTreeWalker(Nt,129);function Gl(s,r){if(!cs(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ol!==void 0?Ol.createHTML(r):r}var Xl=(s,r)=>{let e=s.length-1,t=[],i,n=r===2?"<svg>":r===3?"<math>":"",o=fi;for(let a=0;a<e;a++){let l=s[a],c,p,u=-1,m=0;for(;m<l.length&&(o.lastIndex=m,p=o.exec(l),p!==null);)m=o.lastIndex,o===fi?p[1]==="!--"?o=Hl:p[1]!==void 0?o=Fl:p[2]!==void 0?(Wl.test(p[2])&&(i=RegExp("</"+p[2],"g")),o=Vt):p[3]!==void 0&&(o=Vt):o===Vt?p[0]===">"?(o=i??fi,u=-1):p[1]===void 0?u=-2:(u=o.lastIndex-p[2].length,c=p[1],o=p[3]===void 0?Vt:p[3]==='"'?Bl:Ul):o===Bl||o===Ul?o=Vt:o===Hl||o===Fl?o=fi:(o=Vt,i=void 0);let y=o===Vt&&s[a+1].startsWith("/>")?" ":"";n+=o===fi?l+Qd:u>=0?(t.push(c),l.slice(0,u)+as+l.slice(u)+Ge+y):l+Ge+(u===-2?a:y)}return[Gl(s,n+(s[e]||"<?>")+(r===2?"</svg>":r===3?"</math>":"")),t]},bi=class s{constructor({strings:r,_$litType$:e},t){let i;this.parts=[];let n=0,o=0,a=r.length-1,l=this.parts,[c,p]=Xl(r,e);if(this.el=s.createElement(c,t),Dt.currentNode=this.el.content,e===2||e===3){let u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(i=Dt.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let u of i.getAttributeNames())if(u.endsWith(as)){let m=p[o++],y=i.getAttribute(u).split(Ge),b=/([.?@])?(.*)/.exec(m);l.push({type:1,index:n,name:b[2],strings:y,ctor:b[1]==="."?In:b[1]==="?"?Rn:b[1]==="@"?kn:Ft}),i.removeAttribute(u)}else u.startsWith(Ge)&&(l.push({type:6,index:n}),i.removeAttribute(u));if(Wl.test(i.tagName)){let u=i.textContent.split(Ge),m=u.length-1;if(m>0){i.textContent=Sn?Sn.emptyScript:"";for(let y=0;y<m;y++)i.append(u[y],An()),Dt.nextNode(),l.push({type:2,index:++n});i.append(u[m],An())}}}else if(i.nodeType===8)if(i.data===ls)l.push({type:2,index:n});else{let u=-1;for(;(u=i.data.indexOf(Ge,u+1))!==-1;)l.push({type:7,index:n}),u+=Ge.length-1}n++}}static createElement(r,e){let t=Nt.createElement("template");return t.innerHTML=r,t}};function Ht(s,r,e=s,t){if(r===Ot)return r;let i=t!==void 0?e._$Co?.[t]:e._$Cl,n=gi(r)?void 0:r._$litDirective$;return i?.constructor!==n&&(i?._$AO?.(!1),n===void 0?i=void 0:(i=new n(s),i._$AT(s,e,t)),t!==void 0?(e._$Co??=[])[t]=i:e._$Cl=i),i!==void 0&&(r=Ht(s,i._$AS(s,r.values),i,t)),r}var Tn=class{constructor(r,e){this._$AV=[],this._$AN=void 0,this._$AD=r,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(r){let{el:{content:e},parts:t}=this._$AD,i=(r?.creationScope??Nt).importNode(e,!0);Dt.currentNode=i;let n=Dt.nextNode(),o=0,a=0,l=t[0];for(;l!==void 0;){if(o===l.index){let c;l.type===2?c=new vi(n,n.nextSibling,this,r):l.type===1?c=new l.ctor(n,l.name,l.strings,this,r):l.type===6&&(c=new Mn(n,this,r)),this._$AV.push(c),l=t[++a]}o!==l?.index&&(n=Dt.nextNode(),o++)}return Dt.currentNode=Nt,i}p(r){let e=0;for(let t of this._$AV)t!==void 0&&(t.strings!==void 0?(t._$AI(r,t,e),e+=t.strings.length-2):t._$AI(r[e])),e++}},vi=class s{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(r,e,t,i){this.type=2,this._$AH=X,this._$AN=void 0,this._$AA=r,this._$AB=e,this._$AM=t,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let r=this._$AA.parentNode,e=this._$AM;return e!==void 0&&r?.nodeType===11&&(r=e.parentNode),r}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(r,e=this){r=Ht(this,r,e),gi(r)?r===X||r==null||r===""?(this._$AH!==X&&this._$AR(),this._$AH=X):r!==this._$AH&&r!==Ot&&this._(r):r._$litType$!==void 0?this.$(r):r.nodeType!==void 0?this.T(r):jl(r)?this.k(r):this._(r)}O(r){return this._$AA.parentNode.insertBefore(r,this._$AB)}T(r){this._$AH!==r&&(this._$AR(),this._$AH=this.O(r))}_(r){this._$AH!==X&&gi(this._$AH)?this._$AA.nextSibling.data=r:this.T(Nt.createTextNode(r)),this._$AH=r}$(r){let{values:e,_$litType$:t}=r,i=typeof t=="number"?this._$AC(r):(t.el===void 0&&(t.el=bi.createElement(Gl(t.h,t.h[0]),this.options)),t);if(this._$AH?._$AD===i)this._$AH.p(e);else{let n=new Tn(i,this),o=n.u(this.options);n.p(e),this.T(o),this._$AH=n}}_$AC(r){let e=zl.get(r.strings);return e===void 0&&zl.set(r.strings,e=new bi(r)),e}k(r){cs(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,t,i=0;for(let n of r)i===e.length?e.push(t=new s(this.O(An()),this.O(An()),this,this.options)):t=e[i],t._$AI(n),i++;i<e.length&&(this._$AR(t&&t._$AB.nextSibling,i),e.length=i)}_$AR(r=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);r!==this._$AB;){let t=r.nextSibling;r.remove(),r=t}}setConnected(r){this._$AM===void 0&&(this._$Cv=r,this._$AP?.(r))}},Ft=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(r,e,t,i,n){this.type=1,this._$AH=X,this._$AN=void 0,this.element=r,this.name=e,this._$AM=i,this.options=n,t.length>2||t[0]!==""||t[1]!==""?(this._$AH=Array(t.length-1).fill(new String),this.strings=t):this._$AH=X}_$AI(r,e=this,t,i){let n=this.strings,o=!1;if(n===void 0)r=Ht(this,r,e,0),o=!gi(r)||r!==this._$AH&&r!==Ot,o&&(this._$AH=r);else{let a=r,l,c;for(r=n[0],l=0;l<n.length-1;l++)c=Ht(this,a[t+l],e,l),c===Ot&&(c=this._$AH[l]),o||=!gi(c)||c!==this._$AH[l],c===X?r=X:r!==X&&(r+=(c??"")+n[l+1]),this._$AH[l]=c}o&&!i&&this.j(r)}j(r){r===X?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,r??"")}},In=class extends Ft{constructor(){super(...arguments),this.type=3}j(r){this.element[this.name]=r===X?void 0:r}},Rn=class extends Ft{constructor(){super(...arguments),this.type=4}j(r){this.element.toggleAttribute(this.name,!!r&&r!==X)}},kn=class extends Ft{constructor(r,e,t,i,n){super(r,e,t,i,n),this.type=5}_$AI(r,e=this){if((r=Ht(this,r,e,0)??X)===Ot)return;let t=this._$AH,i=r===X&&t!==X||r.capture!==t.capture||r.once!==t.once||r.passive!==t.passive,n=r!==X&&(t===X||i);i&&this.element.removeEventListener(this.name,this,t),n&&this.element.addEventListener(this.name,this,r),this._$AH=r}handleEvent(r){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,r):this._$AH.handleEvent(r)}},Mn=class{constructor(r,e,t){this.element=r,this.type=6,this._$AN=void 0,this._$AM=e,this.options=t}get _$AU(){return this._$AM._$AU}_$AI(r){Ht(this,r)}},ee={M:as,P:Ge,A:ls,C:1,L:Xl,R:Tn,D:jl,V:Ht,I:vi,H:Ft,N:Rn,U:kn,B:In,F:Mn},Yd=_n.litHtmlPolyfillSupport;Yd?.(bi,vi),(_n.litHtmlVersions??=[]).push("3.3.1");var Ln=["this"],Ql=["+","-","!"],Yl=["=","+","-","*","/","%","^","==","!=",">","<",">=","<=","||","&&","??","&","===","!==","|","|>"],ps={"!":0,":":0,",":0,")":0,"]":0,"}":0,"|>":1,"?":2,"??":3,"||":4,"&&":5,"|":6,"^":7,"&":8,"!=":9,"==":9,"!==":9,"===":9,">=":10,">":10,"<=":10,"<":10,"+":11,"-":11,"%":12,"/":12,"*":12,"(":13,"[":13,".":13,"{":13},$n=13;var Jd=["==","!=","<=",">=","||","&&","??","|>"],Kd=["===","!=="],D;(function(s){s[s.STRING=1]="STRING",s[s.IDENTIFIER=2]="IDENTIFIER",s[s.DOT=3]="DOT",s[s.COMMA=4]="COMMA",s[s.COLON=5]="COLON",s[s.INTEGER=6]="INTEGER",s[s.DECIMAL=7]="DECIMAL",s[s.OPERATOR=8]="OPERATOR",s[s.GROUPER=9]="GROUPER",s[s.KEYWORD=10]="KEYWORD",s[s.ARROW=11]="ARROW"})(D||(D={}));var De=(s,r,e=0)=>({kind:s,value:r,precedence:e}),Zd=s=>s===9||s===10||s===13||s===32,Jl=s=>s===95||s===36||(s&=-33,65<=s&&s<=90),ep=s=>Jl(s)||yi(s),tp=s=>Ln.indexOf(s)!==-1,rp=s=>s===34||s===39,yi=s=>48<=s&&s<=57,ip=s=>s===43||s===45||s===42||s===47||s===33||s===38||s===37||s===60||s===61||s===62||s===63||s===94||s===124,np=s=>s===40||s===41||s===91||s===93||s===123||s===125,op=s=>s.replace(/\\(.)/g,(r,e)=>{switch(e){case"n":return`
220
- `;case"r":return"\r";case"t":return" ";case"b":return"\b";case"f":return"\f";default:return e}}),Pn=class{#e;#t=-1;#r=0;#i;constructor(r){this.#e=r,this.#n()}nextToken(){for(;Zd(this.#i);)this.#n(!0);if(rp(this.#i))return this.#a();if(Jl(this.#i))return this.#c();if(yi(this.#i))return this.#d();if(this.#i===46)return this.#l();if(this.#i===44)return this.#u();if(this.#i===58)return this.#h();if(ip(this.#i))return this.#b();if(np(this.#i))return this.#f();if(this.#n(),this.#i!==void 0)throw new Error(`Expected end of input, got ${this.#i}`)}#n(r){this.#t++,this.#t<this.#e.length?(this.#i=this.#e.charCodeAt(this.#t),r===!0&&(this.#r=this.#t)):this.#i=void 0}#o(r=0){let e=this.#e.substring(this.#r,this.#t+r);return r===0&&this.#s(),e}#s(){this.#r=this.#t}#a(){let r="unterminated string",e=this.#i;for(this.#n(!0);this.#i!==e;){if(this.#i===void 0)throw new Error(r);if(this.#i===92&&(this.#n(),this.#i===void 0))throw new Error(r);this.#n()}let t=De(D.STRING,op(this.#o()));return this.#n(),t}#c(){do this.#n();while(ep(this.#i));let r=this.#o(),e=tp(r)?D.KEYWORD:D.IDENTIFIER;return De(e,r)}#d(){do this.#n();while(yi(this.#i));return this.#i===46?this.#l():De(D.INTEGER,this.#o())}#l(){return this.#n(),yi(this.#i)?this.#g():(this.#s(),De(D.DOT,".",$n))}#u(){return this.#n(!0),De(D.COMMA,",")}#h(){return this.#n(!0),De(D.COLON,":")}#g(){do this.#n();while(yi(this.#i));return De(D.DECIMAL,this.#o())}#b(){this.#n();let r=this.#o(2);if(Kd.indexOf(r)!==-1)this.#n(),this.#n();else{if(r=this.#o(1),r==="=>")return this.#n(),De(D.ARROW,r);Jd.indexOf(r)!==-1&&this.#n()}return r=this.#o(),De(D.OPERATOR,r,ps[r])}#f(){let r=String.fromCharCode(this.#i),e=De(D.GROUPER,r,ps[r]);return this.#n(!0),e}};var us=(s,r)=>new xi(s,r).parse(),xi=class{#e;#t;#r;#i;#n;constructor(r,e){this.#t=new Pn(r),this.#r=e}parse(){return this.#o(),this.#s()}#o(r,e){if(!this._matches(r,e))throw new Error(`Expected kind ${r} (${e}), was ${this.#i?.kind} (${this.#i?.value})`);let t=this.#t.nextToken();this.#i=t,this.#e=t?.kind,this.#n=t?.value}_matches(r,e){return!(r&&this.#e!==r||e&&this.#n!==e)}#s(){if(!this.#i)return this.#r.empty();let r=this.#l();return r===void 0?void 0:this.#a(r,0)}#a(r,e){if(r===void 0)throw new Error("Expected left to be defined.");for(;this.#i;)if(this._matches(D.GROUPER,"(")){let t=this.#p();r=this.#r.invoke(r,void 0,t)}else if(this._matches(D.GROUPER,"[")){let t=this.#v();r=this.#r.index(r,t)}else if(this._matches(D.DOT)){this.#o();let t=this.#l();r=this.#c(r,t)}else{if(this._matches(D.KEYWORD))break;if(this._matches(D.OPERATOR)&&this.#i.precedence>=e)r=this.#n==="?"?this.#u(r):this.#d(r,this.#i);else break}return r}#c(r,e){if(e===void 0)throw new Error("expected identifier");if(e.type==="ID")return this.#r.getter(r,e.value);if(e.type==="Invoke"&&e.receiver.type==="ID"){let t=e.receiver;return this.#r.invoke(r,t.value,e.arguments)}else throw new Error(`expected identifier: ${e}`)}#d(r,e){if(Yl.indexOf(e.value)===-1)throw new Error(`unknown operator: ${e.value}`);this.#o();let t=this.#l();for(;(this.#e===D.OPERATOR||this.#e===D.DOT||this.#e===D.GROUPER)&&this.#i.precedence>e.precedence;)t=this.#a(t,this.#i.precedence);return this.#r.binary(r,e.value,t)}#l(){if(this._matches(D.OPERATOR)){let r=this.#n;if(this.#o(),r==="+"||r==="-"){if(this._matches(D.INTEGER))return this.#m(r);if(this._matches(D.DECIMAL))return this.#w(r)}if(Ql.indexOf(r)===-1)throw new Error(`unexpected token: ${r}`);let e=this.#a(this.#h(),$n);return this.#r.unary(r,e)}return this.#h()}#u(r){this.#o(D.OPERATOR,"?");let e=this.#s();this.#o(D.COLON);let t=this.#s();return this.#r.ternary(r,e,t)}#h(){switch(this.#e){case D.KEYWORD:let r=this.#n;if(r==="this")return this.#o(),this.#r.id(r);throw Ln.indexOf(r)!==-1?new Error(`unexpected keyword: ${r}`):new Error(`unrecognized keyword: ${r}`);case D.IDENTIFIER:return this.#f();case D.STRING:return this.#q();case D.INTEGER:return this.#m();case D.DECIMAL:return this.#w();case D.GROUPER:return this.#n==="("?this.#x():this.#n==="{"?this.#b():this.#n==="["?this.#g():void 0;case D.COLON:throw new Error('unexpected token ":"');default:return}}#g(){let r=[];do{if(this.#o(),this._matches(D.GROUPER,"]"))break;r.push(this.#s())}while(this._matches(D.COMMA));return this.#o(D.GROUPER,"]"),this.#r.list(r)}#b(){let r={};do{if(this.#o(),this._matches(D.GROUPER,"}"))break;let e=this.#n;(this._matches(D.STRING)||this._matches(D.IDENTIFIER))&&this.#o(),this.#o(D.COLON),r[e]=this.#s()}while(this._matches(D.COMMA));return this.#o(D.GROUPER,"}"),this.#r.map(r)}#f(){let r=this.#n;if(r==="true")return this.#o(),this.#r.literal(!0);if(r==="false")return this.#o(),this.#r.literal(!1);if(r==="null")return this.#o(),this.#r.literal(null);if(r==="undefined")return this.#o(),this.#r.literal(void 0);let e=this.#y(),t=this.#p();return t?this.#r.invoke(e,void 0,t):e}#y(){if(!this._matches(D.IDENTIFIER))throw new Error(`expected identifier: ${this.#n}`);let r=this.#n;return this.#o(),this.#r.id(r)}#p(){if(!this._matches(D.GROUPER,"("))return;let r=[];do{if(this.#o(),this._matches(D.GROUPER,")"))break;let e=this.#s();r.push(e)}while(this._matches(D.COMMA));return this.#o(D.GROUPER,")"),r}#v(){this.#o();let r=this.#s();return this.#o(D.GROUPER,"]"),r}#x(){let r=this.#p();if(this._matches(D.ARROW)){this.#o();let e=this.#s(),t=r?.map(i=>i.value)??[];return this.#r.arrowFunction(t,e)}else return this.#r.paren(r[0])}#q(){let r=this.#r.literal(this.#n);return this.#o(),r}#m(r=""){let e=this.#r.literal(parseInt(`${r}${this.#n}`,10));return this.#o(),e}#w(r=""){let e=this.#r.literal(parseFloat(`${r}${this.#n}`));return this.#o(),e}};var{hasOwn:Kl,fromEntries:sp}=Object,ap={"+":(s,r)=>s+r,"-":(s,r)=>s-r,"*":(s,r)=>s*r,"/":(s,r)=>s/r,"%":(s,r)=>s%r,"==":(s,r)=>s==r,"!=":(s,r)=>s!=r,"===":(s,r)=>s===r,"!==":(s,r)=>s!==r,">":(s,r)=>s>r,">=":(s,r)=>s>=r,"<":(s,r)=>s<r,"<=":(s,r)=>s<=r,"||":(s,r)=>s||r,"&&":(s,r)=>s&&r,"??":(s,r)=>s??r,"|":(s,r)=>r(s),"|>":(s,r)=>r(s)},lp={"+":s=>s,"-":s=>-s,"!":s=>!s},Vn=class{empty(){return{type:"Empty",evaluate(r){return r},getIds(r){return r}}}literal(r){return{type:"Literal",value:r,evaluate(e){return this.value},getIds(e){return e}}}id(r){return{type:"ID",value:r,evaluate(e){return this.value==="this"?e:e?.[this.value]},getIds(e){return e.push(this.value),e}}}unary(r,e){let t=lp[r];return{type:"Unary",operator:r,child:e,evaluate(i){return t(this.child.evaluate(i))},getIds(i){return this.child.getIds(i)}}}binary(r,e,t){let i=ap[e];return{type:"Binary",operator:e,left:r,right:t,evaluate(n){if(this.operator==="="){if(this.left.type!=="ID"&&this.left.type!=="Getter"&&this.left.type!=="Index")throw new Error(`Invalid assignment target: ${this.left}`);let o=this.right.evaluate(n),a,l;return this.left.type==="Getter"?(a=this.left.receiver.evaluate(n),l=this.left.name):this.left.type==="Index"?(a=this.left.receiver.evaluate(n),l=this.left.argument.evaluate(n)):this.left.type==="ID"&&(a=n,l=this.left.value),a===void 0?void 0:a[l]=o}return i(this.left.evaluate(n),this.right.evaluate(n))},getIds(n){return this.left.getIds(n),this.right.getIds(n),n}}}getter(r,e){return{type:"Getter",receiver:r,name:e,evaluate(t){return this.receiver.evaluate(t)?.[this.name]},getIds(t){return this.receiver.getIds(t),t}}}invoke(r,e,t){if(e!=null&&typeof e!="string")throw new Error("method not a string");return{type:"Invoke",receiver:r,method:e,arguments:t,evaluate(i){let n=this.receiver.evaluate(i),o=this.method?n:i?.this??i,a=this.method?n?.[e]:n,c=(this.arguments??[]).map(p=>p?.evaluate(i));return a?.apply?.(o,c)},getIds(i){return this.receiver.getIds(i),this.arguments?.forEach(n=>n?.getIds(i)),i}}}paren(r){return r}index(r,e){return{type:"Index",receiver:r,argument:e,evaluate(t){return this.receiver.evaluate(t)?.[this.argument.evaluate(t)]},getIds(t){return this.receiver.getIds(t),t}}}ternary(r,e,t){return{type:"Ternary",condition:r,trueExpr:e,falseExpr:t,evaluate(i){return this.condition.evaluate(i)?this.trueExpr.evaluate(i):this.falseExpr.evaluate(i)},getIds(i){return this.condition.getIds(i),this.trueExpr.getIds(i),this.falseExpr.getIds(i),i}}}map(r){return{type:"Map",entries:r,evaluate(e){let t={};if(r&&this.entries)for(let i in r){let n=this.entries[i];n&&(t[i]=n.evaluate(e))}return t},getIds(e){if(r&&this.entries)for(let t in r){let i=this.entries[t];i&&i.getIds(e)}return e}}}list(r){return{type:"List",items:r,evaluate(e){return this.items?.map(t=>t?.evaluate(e))},getIds(e){return this.items?.forEach(t=>t?.getIds(e)),e}}}arrowFunction(r,e){return{type:"ArrowFunction",params:r,body:e,evaluate(t){let i=this.params,n=this.body;return function(...o){let a=sp(i.map((c,p)=>[c,o[p]])),l=new Proxy(t??{},{set(c,p,u){return Kl(a,p)&&(a[p]=u),c[p]=u},get(c,p){return Kl(a,p)?a[p]:c[p]}});return n.evaluate(l)}},getIds(t){return this.body.getIds(t).filter(i=>!this.params.includes(i))}}}};var ms=null,Zl={boundAttributeSuffix:ee.M,marker:ee.P,markerMatch:ee.A,HTML_RESULT:ee.C,getTemplateHtml:ee.L,overrideDirectiveResolve:(s,r)=>class extends s{_$AS(e,t){return r(this,t)}},patchDirectiveResolve:(s,r)=>{if(s.prototype._$AS.name!==r.name){ms??=s.prototype._$AS.name;for(let e=s.prototype;e!==Object.prototype;e=Object.getPrototypeOf(e))if(e.hasOwnProperty(ms))return void(e[ms]=r);throw Error("Internal error: It is possible that both dev mode and production mode Lit was mixed together during SSR. Please comment on the issue: https://github.com/lit/lit/issues/4527")}},setDirectiveClass(s,r){s._$litDirective$=r},getAttributePartCommittedValue:(s,r,e)=>{let t=Ot;return s.j=i=>t=i,s._$AI(r,s,e),t},connectedDisconnectable:s=>({...s,_$AU:!0}),resolveDirective:ee.V,AttributePart:ee.H,PropertyPart:ee.B,BooleanAttributePart:ee.N,EventPart:ee.U,ElementPart:ee.F,TemplateInstance:ee.R,isIterable:ee.D,ChildPart:ee.I};var{AttributePart:cp,PropertyPart:dp,BooleanAttributePart:pp,EventPart:up}=Zl,fs=new Vn,hs=new Map,ec=s=>s.replace(/-(-|\w)/g,(r,e)=>e.toUpperCase()),Dn=(s,r)=>{let e=hs.get(s);if(e===void 0){if(hs.has(s))return;if(s=s.trim(),s.startsWith("{{")&&s.endsWith("}}")){let t=s.substring(2,s.length-2).trim();e=new xi(t,fs).parse(),hs.set(s,e)}}return e?.evaluate(r)},mp=(s,r,e,t)=>{let i=s.getAttribute("if");if(i!==null&&Dn(i,r))return Nn(s,r,e,t)},tc=/(?<!\\){{(.*?)(?:(?<!\\)}})/g,rc=s=>/(?:\\{{)|(?:\\}})/g.test(s),qi=s=>s.replaceAll(/\\{{/g,"{{").replace(/\\}}/g,"}}"),hp=(s,r,e,t)=>{let i=s.getAttribute("repeat");if(i!==null){let n=Dn(i,r);if(!n[Symbol.iterator])return X;let o=wi(s),a=-1,l=[];for(let c of n){a++;let p=Object.create(r);p.item=c,p.index=a,p.this=r.this??r;let u=[];for(let y of o.parts){let b=y.update(p,e,t);y.type===1?u.push(...b):u.push(b)}let m={_$litType$:o,values:u};l.push(m)}return l}},nc={if:mp,repeat:hp},Ne=(s,r=nc,e={},t)=>{let n=wi(s).renderers;if(t){let a=wi(t).renderers,l=n.super;l!==void 0?e={...n,...e,super:(c,p,u)=>(u={...a,...u,super:(m,y,b)=>Nn(t,m,y,b)},l(c,p,u))}:(e={...a,...n,...e},s=t)}else e={...n,...e};return o=>Nn(s,o,r,e)};var Nn=(s,r,e=nc,t={})=>{let i=wi(s),n=[];for(let a of i.parts){let l=a.update(r,e,t);a.type===1?n.push(...l):n.push(l)}return{_$litType$:i,values:n}},ic=new Map,wi=s=>{let r=ic.get(s);return r===void 0&&ic.set(s,r=fp(s)),r},fp=s=>{let r={h:void 0,el:s.cloneNode(!0),parts:[],renderers:{}},e=document.createTreeWalker(r.el.content,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT|NodeFilter.SHOW_COMMENT),t=e.currentNode,i=-1,n=[];for(;(t=e.nextNode())!==null;)if(t.nodeType===Node.COMMENT_NODE)i++;else if(t.nodeType===Node.ELEMENT_NODE){i++;let o=t;if(o.tagName==="TEMPLATE"){let l=o.getAttribute("type"),c=o.getAttribute("name"),p=o.getAttribute("call");if(p!==null||l!==null||c!==null){o.parentNode.insertBefore(document.createComment(""),o),n.push(o);let u;if(p!==null){let m=p.trim(),y=m.startsWith("{{")&&m.endsWith("}}");u=(b,w,f)=>{let h=o.getAttribute("data"),v=h===null?void 0:Dn(h,b);return(y?Dn(m,b):f[p])?.(v,w,f)}}else l!==null?u=(m,y,b)=>{let w=y[l];return w?.(o,m,y,b)}:(c==="super"?r.renderers.super=(m,y,b)=>{let w=b.super,f=wi(o);return b={...b,...f.renderers},w(m,y,b)}:r.renderers[c]=(m,y,b)=>Nn(o,m,y,b),u=(m,y,b)=>{let w=b[c];return w?.(m,y,b)});r.parts.push({type:2,index:i,update:u});continue}}let a=o.getAttributeNames();for(let l of a){let c=o.getAttribute(l),p=c.split(tc);if(p.length===1){rc(c)&&o.setAttribute(l,qi(c));continue}o.removeAttribute(l);let u=l,m=cp,y=l[0];y==="."?(u=ec(l.substring(1)),m=dp):y==="?"?(u=l.substring(1),m=pp):y==="@"&&(u=ec(l.substring(1)),m=up);let b=[qi(p[0])],w=[];for(let f=1;f<p.length;f+=2){let h=p[f];w.push(us(h,fs)),b.push(qi(p[f+1]))}r.parts.push({type:1,index:i,name:u,strings:b,ctor:m,update:(f,h,v)=>w.map(q=>q.evaluate(f))})}}else if(t.nodeType===Node.TEXT_NODE){let o=t,a=o.textContent,l=a.split(tc);l.length>1?o.textContent=qi(l[0]):rc(a)&&(o.textContent=qi(a));for(let c=1;c<l.length;c+=2){let p=l[c],u=us(p,fs);r.parts.push({type:2,index:++i,update:(y,b)=>u.evaluate(y)});let m=new Text(l[c+1].replace("\\{{","{{"));o.parentNode.insertBefore(m,o.nextSibling),o.parentNode.insertBefore(document.createComment(""),o.nextSibling),o=m,e.currentNode=m}}for(let o of n)o.remove();return r};var Ci,Ei=class extends E{constructor(){super();L(this,Ci);U(this,Ci,this.attachInternals()),I(this,Ci).ariaLabel="pagination"}createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let e=this.querySelector("template");this.myTemplate=Ne(e)}render(){if(!this.computedContext)return x``;let e=this.computedContext.testParts.flatMap(t=>t.sections.flatMap(i=>i.items));return x` ${e.map(t=>this.myTemplate({item:t,view:this.computedContext.view}))} `}};Ci=new WeakMap,d([$({context:G,subscribe:!0})],Ei.prototype,"computedContext",2),Ei=d([k("test-paging-buttons-stamp")],Ei);var On=class{constructor(r){this.G=r}disconnect(){this.G=void 0}reconnect(r){this.G=r}deref(){return this.G}},Hn=class{constructor(){this.Y=void 0,this.Z=void 0}get(){return this.Y}pause(){this.Y??=new Promise(r=>this.Z=r)}resume(){this.Z?.(),this.Y=this.Z=void 0}};var oc=s=>!il(s)&&typeof s.then=="function",sc=1073741823,gs=class extends st{constructor(){super(...arguments),this._$Cwt=sc,this._$Cbt=[],this._$CK=new On(this),this._$CX=new Hn}render(...r){return r.find(e=>!oc(e))??re}update(r,e){let t=this._$Cbt,i=t.length;this._$Cbt=e;let n=this._$CK,o=this._$CX;this.isConnected||this.disconnected();for(let a=0;a<e.length&&!(a>this._$Cwt);a++){let l=e[a];if(!oc(l))return this._$Cwt=a,l;a<i&&l===t[a]||(this._$Cwt=sc,i=0,Promise.resolve(l).then(async c=>{for(;o.get();)await o.get();let p=n.deref();if(p!==void 0){let u=p._$Cbt.indexOf(l);u>-1&&u<p._$Cwt&&(p._$Cwt=u,p.setValue(c))}}))}return re}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}},Fn=qe(gs);var Un=`@layer qti-base, qti-components, qti-utilities, qti-variants, qti-extended;
217
+ `,d([$({context:G,subscribe:!0})],Ce.prototype,"computedContext",2),d([g({type:Boolean,reflect:!0})],Ce.prototype,"shown",2),d([g({type:Boolean,reflect:!0})],Ce.prototype,"disabled",2),d([g({type:String})],Ce.prototype,"showCorrectText",2),d([g({type:String})],Ce.prototype,"hideCorrectText",2),d([g({type:String})],Ce.prototype,"noCorrectResponseText",2),Ce=d([R("test-show-correct-response")],Ce);var Vn=globalThis,Rn=Vn.trustedTypes,Jl=Rn?Rn.createPolicy("lit-html",{createHTML:o=>o}):void 0,fs="$lit$",Ye=`lit$${Math.random().toFixed(9).slice(2)}$`,gs="?"+Ye,fp=`<${gs}>`,Ot=Vn.document===void 0?{createTreeWalker:()=>({})}:document,kn=()=>Ot.createComment(""),yi=o=>o===null||typeof o!="object"&&typeof o!="function",bs=Array.isArray,ic=o=>bs(o)||typeof o?.[Symbol.iterator]=="function",hs=`[
218
+ \f\r]`,vi=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Kl=/-->/g,Zl=/>/g,Dt=RegExp(`>|${hs}(?:([^\\s"'>=/]+)(${hs}*=${hs}*(?:[^
219
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),ec=/'/g,tc=/"/g,nc=/^(?:script|style|textarea|title)$/i,vs=o=>(r,...e)=>({_$litType$:o,strings:r,values:e}),fx=vs(1),gx=vs(2),bx=vs(3),Ht=Symbol.for("lit-noChange"),X=Symbol.for("lit-nothing"),rc=new WeakMap,Nt=Ot.createTreeWalker(Ot,129);function oc(o,r){if(!bs(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return Jl!==void 0?Jl.createHTML(r):r}var sc=(o,r)=>{let e=o.length-1,t=[],i,n=r===2?"<svg>":r===3?"<math>":"",s=vi;for(let a=0;a<e;a++){let l=o[a],c,p,u=-1,h=0;for(;h<l.length&&(s.lastIndex=h,p=s.exec(l),p!==null);)h=s.lastIndex,s===vi?p[1]==="!--"?s=Kl:p[1]!==void 0?s=Zl:p[2]!==void 0?(nc.test(p[2])&&(i=RegExp("</"+p[2],"g")),s=Dt):p[3]!==void 0&&(s=Dt):s===Dt?p[0]===">"?(s=i??vi,u=-1):p[1]===void 0?u=-2:(u=s.lastIndex-p[2].length,c=p[1],s=p[3]===void 0?Dt:p[3]==='"'?tc:ec):s===tc||s===ec?s=Dt:s===Kl||s===Zl?s=vi:(s=Dt,i=void 0);let v=s===Dt&&o[a+1].startsWith("/>")?" ":"";n+=s===vi?l+fp:u>=0?(t.push(c),l.slice(0,u)+fs+l.slice(u)+Ye+v):l+Ye+(u===-2?a:v)}return[oc(o,n+(o[e]||"<?>")+(r===2?"</svg>":r===3?"</math>":"")),t]},xi=class o{constructor({strings:r,_$litType$:e},t){let i;this.parts=[];let n=0,s=0,a=r.length-1,l=this.parts,[c,p]=sc(r,e);if(this.el=o.createElement(c,t),Nt.currentNode=this.el.content,e===2||e===3){let u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(i=Nt.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let u of i.getAttributeNames())if(u.endsWith(fs)){let h=p[s++],v=i.getAttribute(u).split(Ye),y=/([.?@])?(.*)/.exec(h);l.push({type:1,index:n,name:y[2],strings:v,ctor:y[1]==="."?_n:y[1]==="?"?Ln:y[1]==="@"?$n:Ut}),i.removeAttribute(u)}else u.startsWith(Ye)&&(l.push({type:6,index:n}),i.removeAttribute(u));if(nc.test(i.tagName)){let u=i.textContent.split(Ye),h=u.length-1;if(h>0){i.textContent=Rn?Rn.emptyScript:"";for(let v=0;v<h;v++)i.append(u[v],kn()),Nt.nextNode(),l.push({type:2,index:++n});i.append(u[h],kn())}}}else if(i.nodeType===8)if(i.data===gs)l.push({type:2,index:n});else{let u=-1;for(;(u=i.data.indexOf(Ye,u+1))!==-1;)l.push({type:7,index:n}),u+=Ye.length-1}n++}}static createElement(r,e){let t=Ot.createElement("template");return t.innerHTML=r,t}};function Ft(o,r,e=o,t){if(r===Ht)return r;let i=t!==void 0?e._$Co?.[t]:e._$Cl,n=yi(r)?void 0:r._$litDirective$;return i?.constructor!==n&&(i?._$AO?.(!1),n===void 0?i=void 0:(i=new n(o),i._$AT(o,e,t)),t!==void 0?(e._$Co??=[])[t]=i:e._$Cl=i),i!==void 0&&(r=Ft(o,i._$AS(o,r.values),i,t)),r}var Mn=class{constructor(r,e){this._$AV=[],this._$AN=void 0,this._$AD=r,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(r){let{el:{content:e},parts:t}=this._$AD,i=(r?.creationScope??Ot).importNode(e,!0);Nt.currentNode=i;let n=Nt.nextNode(),s=0,a=0,l=t[0];for(;l!==void 0;){if(s===l.index){let c;l.type===2?c=new qi(n,n.nextSibling,this,r):l.type===1?c=new l.ctor(n,l.name,l.strings,this,r):l.type===6&&(c=new Pn(n,this,r)),this._$AV.push(c),l=t[++a]}s!==l?.index&&(n=Nt.nextNode(),s++)}return Nt.currentNode=Ot,i}p(r){let e=0;for(let t of this._$AV)t!==void 0&&(t.strings!==void 0?(t._$AI(r,t,e),e+=t.strings.length-2):t._$AI(r[e])),e++}},qi=class o{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(r,e,t,i){this.type=2,this._$AH=X,this._$AN=void 0,this._$AA=r,this._$AB=e,this._$AM=t,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let r=this._$AA.parentNode,e=this._$AM;return e!==void 0&&r?.nodeType===11&&(r=e.parentNode),r}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(r,e=this){r=Ft(this,r,e),yi(r)?r===X||r==null||r===""?(this._$AH!==X&&this._$AR(),this._$AH=X):r!==this._$AH&&r!==Ht&&this._(r):r._$litType$!==void 0?this.$(r):r.nodeType!==void 0?this.T(r):ic(r)?this.k(r):this._(r)}O(r){return this._$AA.parentNode.insertBefore(r,this._$AB)}T(r){this._$AH!==r&&(this._$AR(),this._$AH=this.O(r))}_(r){this._$AH!==X&&yi(this._$AH)?this._$AA.nextSibling.data=r:this.T(Ot.createTextNode(r)),this._$AH=r}$(r){let{values:e,_$litType$:t}=r,i=typeof t=="number"?this._$AC(r):(t.el===void 0&&(t.el=xi.createElement(oc(t.h,t.h[0]),this.options)),t);if(this._$AH?._$AD===i)this._$AH.p(e);else{let n=new Mn(i,this),s=n.u(this.options);n.p(e),this.T(s),this._$AH=n}}_$AC(r){let e=rc.get(r.strings);return e===void 0&&rc.set(r.strings,e=new xi(r)),e}k(r){bs(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,t,i=0;for(let n of r)i===e.length?e.push(t=new o(this.O(kn()),this.O(kn()),this,this.options)):t=e[i],t._$AI(n),i++;i<e.length&&(this._$AR(t&&t._$AB.nextSibling,i),e.length=i)}_$AR(r=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);r!==this._$AB;){let t=r.nextSibling;r.remove(),r=t}}setConnected(r){this._$AM===void 0&&(this._$Cv=r,this._$AP?.(r))}},Ut=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(r,e,t,i,n){this.type=1,this._$AH=X,this._$AN=void 0,this.element=r,this.name=e,this._$AM=i,this.options=n,t.length>2||t[0]!==""||t[1]!==""?(this._$AH=Array(t.length-1).fill(new String),this.strings=t):this._$AH=X}_$AI(r,e=this,t,i){let n=this.strings,s=!1;if(n===void 0)r=Ft(this,r,e,0),s=!yi(r)||r!==this._$AH&&r!==Ht,s&&(this._$AH=r);else{let a=r,l,c;for(r=n[0],l=0;l<n.length-1;l++)c=Ft(this,a[t+l],e,l),c===Ht&&(c=this._$AH[l]),s||=!yi(c)||c!==this._$AH[l],c===X?r=X:r!==X&&(r+=(c??"")+n[l+1]),this._$AH[l]=c}s&&!i&&this.j(r)}j(r){r===X?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,r??"")}},_n=class extends Ut{constructor(){super(...arguments),this.type=3}j(r){this.element[this.name]=r===X?void 0:r}},Ln=class extends Ut{constructor(){super(...arguments),this.type=4}j(r){this.element.toggleAttribute(this.name,!!r&&r!==X)}},$n=class extends Ut{constructor(r,e,t,i,n){super(r,e,t,i,n),this.type=5}_$AI(r,e=this){if((r=Ft(this,r,e,0)??X)===Ht)return;let t=this._$AH,i=r===X&&t!==X||r.capture!==t.capture||r.once!==t.once||r.passive!==t.passive,n=r!==X&&(t===X||i);i&&this.element.removeEventListener(this.name,this,t),n&&this.element.addEventListener(this.name,this,r),this._$AH=r}handleEvent(r){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,r):this._$AH.handleEvent(r)}},Pn=class{constructor(r,e,t){this.element=r,this.type=6,this._$AN=void 0,this._$AM=e,this.options=t}get _$AU(){return this._$AM._$AU}_$AI(r){Ft(this,r)}},te={M:fs,P:Ye,A:gs,C:1,L:sc,R:Mn,D:ic,V:Ft,I:qi,H:Ut,N:Ln,U:$n,B:_n,F:Pn},gp=Vn.litHtmlPolyfillSupport;gp?.(xi,qi),(Vn.litHtmlVersions??=[]).push("3.3.1");var Dn=["this"],ac=["+","-","!"],lc=["=","+","-","*","/","%","^","==","!=",">","<",">=","<=","||","&&","??","&","===","!==","|","|>"],ys={"!":0,":":0,",":0,")":0,"]":0,"}":0,"|>":1,"?":2,"??":3,"||":4,"&&":5,"|":6,"^":7,"&":8,"!=":9,"==":9,"!==":9,"===":9,">=":10,">":10,"<=":10,"<":10,"+":11,"-":11,"%":12,"/":12,"*":12,"(":13,"[":13,".":13,"{":13},Nn=13;var bp=["==","!=","<=",">=","||","&&","??","|>"],vp=["===","!=="],D;(function(o){o[o.STRING=1]="STRING",o[o.IDENTIFIER=2]="IDENTIFIER",o[o.DOT=3]="DOT",o[o.COMMA=4]="COMMA",o[o.COLON=5]="COLON",o[o.INTEGER=6]="INTEGER",o[o.DECIMAL=7]="DECIMAL",o[o.OPERATOR=8]="OPERATOR",o[o.GROUPER=9]="GROUPER",o[o.KEYWORD=10]="KEYWORD",o[o.ARROW=11]="ARROW"})(D||(D={}));var Ne=(o,r,e=0)=>({kind:o,value:r,precedence:e}),yp=o=>o===9||o===10||o===13||o===32,cc=o=>o===95||o===36||(o&=-33,65<=o&&o<=90),xp=o=>cc(o)||wi(o),qp=o=>Dn.indexOf(o)!==-1,wp=o=>o===34||o===39,wi=o=>48<=o&&o<=57,Ep=o=>o===43||o===45||o===42||o===47||o===33||o===38||o===37||o===60||o===61||o===62||o===63||o===94||o===124,Cp=o=>o===40||o===41||o===91||o===93||o===123||o===125,Sp=o=>o.replace(/\\(.)/g,(r,e)=>{switch(e){case"n":return`
220
+ `;case"r":return"\r";case"t":return" ";case"b":return"\b";case"f":return"\f";default:return e}}),On=class{#e;#t=-1;#r=0;#i;constructor(r){this.#e=r,this.#n()}nextToken(){for(;yp(this.#i);)this.#n(!0);if(wp(this.#i))return this.#a();if(cc(this.#i))return this.#c();if(wi(this.#i))return this.#d();if(this.#i===46)return this.#l();if(this.#i===44)return this.#u();if(this.#i===58)return this.#h();if(Ep(this.#i))return this.#b();if(Cp(this.#i))return this.#f();if(this.#n(),this.#i!==void 0)throw new Error(`Expected end of input, got ${this.#i}`)}#n(r){this.#t++,this.#t<this.#e.length?(this.#i=this.#e.charCodeAt(this.#t),r===!0&&(this.#r=this.#t)):this.#i=void 0}#o(r=0){let e=this.#e.substring(this.#r,this.#t+r);return r===0&&this.#s(),e}#s(){this.#r=this.#t}#a(){let r="unterminated string",e=this.#i;for(this.#n(!0);this.#i!==e;){if(this.#i===void 0)throw new Error(r);if(this.#i===92&&(this.#n(),this.#i===void 0))throw new Error(r);this.#n()}let t=Ne(D.STRING,Sp(this.#o()));return this.#n(),t}#c(){do this.#n();while(xp(this.#i));let r=this.#o(),e=qp(r)?D.KEYWORD:D.IDENTIFIER;return Ne(e,r)}#d(){do this.#n();while(wi(this.#i));return this.#i===46?this.#l():Ne(D.INTEGER,this.#o())}#l(){return this.#n(),wi(this.#i)?this.#g():(this.#s(),Ne(D.DOT,".",Nn))}#u(){return this.#n(!0),Ne(D.COMMA,",")}#h(){return this.#n(!0),Ne(D.COLON,":")}#g(){do this.#n();while(wi(this.#i));return Ne(D.DECIMAL,this.#o())}#b(){this.#n();let r=this.#o(2);if(vp.indexOf(r)!==-1)this.#n(),this.#n();else{if(r=this.#o(1),r==="=>")return this.#n(),Ne(D.ARROW,r);bp.indexOf(r)!==-1&&this.#n()}return r=this.#o(),Ne(D.OPERATOR,r,ys[r])}#f(){let r=String.fromCharCode(this.#i),e=Ne(D.GROUPER,r,ys[r]);return this.#n(!0),e}};var xs=(o,r)=>new Ei(o,r).parse(),Ei=class{#e;#t;#r;#i;#n;constructor(r,e){this.#t=new On(r),this.#r=e}parse(){return this.#o(),this.#s()}#o(r,e){if(!this._matches(r,e))throw new Error(`Expected kind ${r} (${e}), was ${this.#i?.kind} (${this.#i?.value})`);let t=this.#t.nextToken();this.#i=t,this.#e=t?.kind,this.#n=t?.value}_matches(r,e){return!(r&&this.#e!==r||e&&this.#n!==e)}#s(){if(!this.#i)return this.#r.empty();let r=this.#l();return r===void 0?void 0:this.#a(r,0)}#a(r,e){if(r===void 0)throw new Error("Expected left to be defined.");for(;this.#i;)if(this._matches(D.GROUPER,"(")){let t=this.#p();r=this.#r.invoke(r,void 0,t)}else if(this._matches(D.GROUPER,"[")){let t=this.#v();r=this.#r.index(r,t)}else if(this._matches(D.DOT)){this.#o();let t=this.#l();r=this.#c(r,t)}else{if(this._matches(D.KEYWORD))break;if(this._matches(D.OPERATOR)&&this.#i.precedence>=e)r=this.#n==="?"?this.#u(r):this.#d(r,this.#i);else break}return r}#c(r,e){if(e===void 0)throw new Error("expected identifier");if(e.type==="ID")return this.#r.getter(r,e.value);if(e.type==="Invoke"&&e.receiver.type==="ID"){let t=e.receiver;return this.#r.invoke(r,t.value,e.arguments)}else throw new Error(`expected identifier: ${e}`)}#d(r,e){if(lc.indexOf(e.value)===-1)throw new Error(`unknown operator: ${e.value}`);this.#o();let t=this.#l();for(;(this.#e===D.OPERATOR||this.#e===D.DOT||this.#e===D.GROUPER)&&this.#i.precedence>e.precedence;)t=this.#a(t,this.#i.precedence);return this.#r.binary(r,e.value,t)}#l(){if(this._matches(D.OPERATOR)){let r=this.#n;if(this.#o(),r==="+"||r==="-"){if(this._matches(D.INTEGER))return this.#m(r);if(this._matches(D.DECIMAL))return this.#w(r)}if(ac.indexOf(r)===-1)throw new Error(`unexpected token: ${r}`);let e=this.#a(this.#h(),Nn);return this.#r.unary(r,e)}return this.#h()}#u(r){this.#o(D.OPERATOR,"?");let e=this.#s();this.#o(D.COLON);let t=this.#s();return this.#r.ternary(r,e,t)}#h(){switch(this.#e){case D.KEYWORD:let r=this.#n;if(r==="this")return this.#o(),this.#r.id(r);throw Dn.indexOf(r)!==-1?new Error(`unexpected keyword: ${r}`):new Error(`unrecognized keyword: ${r}`);case D.IDENTIFIER:return this.#f();case D.STRING:return this.#q();case D.INTEGER:return this.#m();case D.DECIMAL:return this.#w();case D.GROUPER:return this.#n==="("?this.#x():this.#n==="{"?this.#b():this.#n==="["?this.#g():void 0;case D.COLON:throw new Error('unexpected token ":"');default:return}}#g(){let r=[];do{if(this.#o(),this._matches(D.GROUPER,"]"))break;r.push(this.#s())}while(this._matches(D.COMMA));return this.#o(D.GROUPER,"]"),this.#r.list(r)}#b(){let r={};do{if(this.#o(),this._matches(D.GROUPER,"}"))break;let e=this.#n;(this._matches(D.STRING)||this._matches(D.IDENTIFIER))&&this.#o(),this.#o(D.COLON),r[e]=this.#s()}while(this._matches(D.COMMA));return this.#o(D.GROUPER,"}"),this.#r.map(r)}#f(){let r=this.#n;if(r==="true")return this.#o(),this.#r.literal(!0);if(r==="false")return this.#o(),this.#r.literal(!1);if(r==="null")return this.#o(),this.#r.literal(null);if(r==="undefined")return this.#o(),this.#r.literal(void 0);let e=this.#y(),t=this.#p();return t?this.#r.invoke(e,void 0,t):e}#y(){if(!this._matches(D.IDENTIFIER))throw new Error(`expected identifier: ${this.#n}`);let r=this.#n;return this.#o(),this.#r.id(r)}#p(){if(!this._matches(D.GROUPER,"("))return;let r=[];do{if(this.#o(),this._matches(D.GROUPER,")"))break;let e=this.#s();r.push(e)}while(this._matches(D.COMMA));return this.#o(D.GROUPER,")"),r}#v(){this.#o();let r=this.#s();return this.#o(D.GROUPER,"]"),r}#x(){let r=this.#p();if(this._matches(D.ARROW)){this.#o();let e=this.#s(),t=r?.map(i=>i.value)??[];return this.#r.arrowFunction(t,e)}else return this.#r.paren(r[0])}#q(){let r=this.#r.literal(this.#n);return this.#o(),r}#m(r=""){let e=this.#r.literal(parseInt(`${r}${this.#n}`,10));return this.#o(),e}#w(r=""){let e=this.#r.literal(parseFloat(`${r}${this.#n}`));return this.#o(),e}};var{hasOwn:dc,fromEntries:Ap}=Object,Tp={"+":(o,r)=>o+r,"-":(o,r)=>o-r,"*":(o,r)=>o*r,"/":(o,r)=>o/r,"%":(o,r)=>o%r,"==":(o,r)=>o==r,"!=":(o,r)=>o!=r,"===":(o,r)=>o===r,"!==":(o,r)=>o!==r,">":(o,r)=>o>r,">=":(o,r)=>o>=r,"<":(o,r)=>o<r,"<=":(o,r)=>o<=r,"||":(o,r)=>o||r,"&&":(o,r)=>o&&r,"??":(o,r)=>o??r,"|":(o,r)=>r(o),"|>":(o,r)=>r(o)},Ip={"+":o=>o,"-":o=>-o,"!":o=>!o},Hn=class{empty(){return{type:"Empty",evaluate(r){return r},getIds(r){return r}}}literal(r){return{type:"Literal",value:r,evaluate(e){return this.value},getIds(e){return e}}}id(r){return{type:"ID",value:r,evaluate(e){return this.value==="this"?e:e?.[this.value]},getIds(e){return e.push(this.value),e}}}unary(r,e){let t=Ip[r];return{type:"Unary",operator:r,child:e,evaluate(i){return t(this.child.evaluate(i))},getIds(i){return this.child.getIds(i)}}}binary(r,e,t){let i=Tp[e];return{type:"Binary",operator:e,left:r,right:t,evaluate(n){if(this.operator==="="){if(this.left.type!=="ID"&&this.left.type!=="Getter"&&this.left.type!=="Index")throw new Error(`Invalid assignment target: ${this.left}`);let s=this.right.evaluate(n),a,l;return this.left.type==="Getter"?(a=this.left.receiver.evaluate(n),l=this.left.name):this.left.type==="Index"?(a=this.left.receiver.evaluate(n),l=this.left.argument.evaluate(n)):this.left.type==="ID"&&(a=n,l=this.left.value),a===void 0?void 0:a[l]=s}return i(this.left.evaluate(n),this.right.evaluate(n))},getIds(n){return this.left.getIds(n),this.right.getIds(n),n}}}getter(r,e){return{type:"Getter",receiver:r,name:e,evaluate(t){return this.receiver.evaluate(t)?.[this.name]},getIds(t){return this.receiver.getIds(t),t}}}invoke(r,e,t){if(e!=null&&typeof e!="string")throw new Error("method not a string");return{type:"Invoke",receiver:r,method:e,arguments:t,evaluate(i){let n=this.receiver.evaluate(i),s=this.method?n:i?.this??i,a=this.method?n?.[e]:n,c=(this.arguments??[]).map(p=>p?.evaluate(i));return a?.apply?.(s,c)},getIds(i){return this.receiver.getIds(i),this.arguments?.forEach(n=>n?.getIds(i)),i}}}paren(r){return r}index(r,e){return{type:"Index",receiver:r,argument:e,evaluate(t){return this.receiver.evaluate(t)?.[this.argument.evaluate(t)]},getIds(t){return this.receiver.getIds(t),t}}}ternary(r,e,t){return{type:"Ternary",condition:r,trueExpr:e,falseExpr:t,evaluate(i){return this.condition.evaluate(i)?this.trueExpr.evaluate(i):this.falseExpr.evaluate(i)},getIds(i){return this.condition.getIds(i),this.trueExpr.getIds(i),this.falseExpr.getIds(i),i}}}map(r){return{type:"Map",entries:r,evaluate(e){let t={};if(r&&this.entries)for(let i in r){let n=this.entries[i];n&&(t[i]=n.evaluate(e))}return t},getIds(e){if(r&&this.entries)for(let t in r){let i=this.entries[t];i&&i.getIds(e)}return e}}}list(r){return{type:"List",items:r,evaluate(e){return this.items?.map(t=>t?.evaluate(e))},getIds(e){return this.items?.forEach(t=>t?.getIds(e)),e}}}arrowFunction(r,e){return{type:"ArrowFunction",params:r,body:e,evaluate(t){let i=this.params,n=this.body;return function(...s){let a=Ap(i.map((c,p)=>[c,s[p]])),l=new Proxy(t??{},{set(c,p,u){return dc(a,p)&&(a[p]=u),c[p]=u},get(c,p){return dc(a,p)?a[p]:c[p]}});return n.evaluate(l)}},getIds(t){return this.body.getIds(t).filter(i=>!this.params.includes(i))}}}};var qs=null,pc={boundAttributeSuffix:te.M,marker:te.P,markerMatch:te.A,HTML_RESULT:te.C,getTemplateHtml:te.L,overrideDirectiveResolve:(o,r)=>class extends o{_$AS(e,t){return r(this,t)}},patchDirectiveResolve:(o,r)=>{if(o.prototype._$AS.name!==r.name){qs??=o.prototype._$AS.name;for(let e=o.prototype;e!==Object.prototype;e=Object.getPrototypeOf(e))if(e.hasOwnProperty(qs))return void(e[qs]=r);throw Error("Internal error: It is possible that both dev mode and production mode Lit was mixed together during SSR. Please comment on the issue: https://github.com/lit/lit/issues/4527")}},setDirectiveClass(o,r){o._$litDirective$=r},getAttributePartCommittedValue:(o,r,e)=>{let t=Ht;return o.j=i=>t=i,o._$AI(r,o,e),t},connectedDisconnectable:o=>({...o,_$AU:!0}),resolveDirective:te.V,AttributePart:te.H,PropertyPart:te.B,BooleanAttributePart:te.N,EventPart:te.U,ElementPart:te.F,TemplateInstance:te.R,isIterable:te.D,ChildPart:te.I};var{AttributePart:Rp,PropertyPart:kp,BooleanAttributePart:Mp,EventPart:_p}=pc,Es=new Hn,ws=new Map,uc=o=>o.replace(/-(-|\w)/g,(r,e)=>e.toUpperCase()),Fn=(o,r)=>{let e=ws.get(o);if(e===void 0){if(ws.has(o))return;if(o=o.trim(),o.startsWith("{{")&&o.endsWith("}}")){let t=o.substring(2,o.length-2).trim();e=new Ei(t,Es).parse(),ws.set(o,e)}}return e?.evaluate(r)},Lp=(o,r,e,t)=>{let i=o.getAttribute("if");if(i!==null&&Fn(i,r))return Un(o,r,e,t)},mc=/(?<!\\){{(.*?)(?:(?<!\\)}})/g,hc=o=>/(?:\\{{)|(?:\\}})/g.test(o),Ci=o=>o.replaceAll(/\\{{/g,"{{").replace(/\\}}/g,"}}"),$p=(o,r,e,t)=>{let i=o.getAttribute("repeat");if(i!==null){let n=Fn(i,r);if(!n[Symbol.iterator])return X;let s=Si(o),a=-1,l=[];for(let c of n){a++;let p=Object.create(r);p.item=c,p.index=a,p.this=r.this??r;let u=[];for(let v of s.parts){let y=v.update(p,e,t);v.type===1?u.push(...y):u.push(y)}let h={_$litType$:s,values:u};l.push(h)}return l}},gc={if:Lp,repeat:$p},Oe=(o,r=gc,e={},t)=>{let n=Si(o).renderers;if(t){let a=Si(t).renderers,l=n.super;l!==void 0?e={...n,...e,super:(c,p,u)=>(u={...a,...u,super:(h,v,y)=>Un(t,h,v,y)},l(c,p,u))}:(e={...a,...n,...e},o=t)}else e={...n,...e};return s=>Un(o,s,r,e)};var Un=(o,r,e=gc,t={})=>{let i=Si(o),n=[];for(let a of i.parts){let l=a.update(r,e,t);a.type===1?n.push(...l):n.push(l)}return{_$litType$:i,values:n}},fc=new Map,Si=o=>{let r=fc.get(o);return r===void 0&&fc.set(o,r=Pp(o)),r},Pp=o=>{let r={h:void 0,el:o.cloneNode(!0),parts:[],renderers:{}},e=document.createTreeWalker(r.el.content,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT|NodeFilter.SHOW_COMMENT),t=e.currentNode,i=-1,n=[];for(;(t=e.nextNode())!==null;)if(t.nodeType===Node.COMMENT_NODE)i++;else if(t.nodeType===Node.ELEMENT_NODE){i++;let s=t;if(s.tagName==="TEMPLATE"){let l=s.getAttribute("type"),c=s.getAttribute("name"),p=s.getAttribute("call");if(p!==null||l!==null||c!==null){s.parentNode.insertBefore(document.createComment(""),s),n.push(s);let u;if(p!==null){let h=p.trim(),v=h.startsWith("{{")&&h.endsWith("}}");u=(y,w,f)=>{let m=s.getAttribute("data"),b=m===null?void 0:Fn(m,y);return(v?Fn(h,y):f[p])?.(b,w,f)}}else l!==null?u=(h,v,y)=>{let w=v[l];return w?.(s,h,v,y)}:(c==="super"?r.renderers.super=(h,v,y)=>{let w=y.super,f=Si(s);return y={...y,...f.renderers},w(h,v,y)}:r.renderers[c]=(h,v,y)=>Un(s,h,v,y),u=(h,v,y)=>{let w=y[c];return w?.(h,v,y)});r.parts.push({type:2,index:i,update:u});continue}}let a=s.getAttributeNames();for(let l of a){let c=s.getAttribute(l),p=c.split(mc);if(p.length===1){hc(c)&&s.setAttribute(l,Ci(c));continue}s.removeAttribute(l);let u=l,h=Rp,v=l[0];v==="."?(u=uc(l.substring(1)),h=kp):v==="?"?(u=l.substring(1),h=Mp):v==="@"&&(u=uc(l.substring(1)),h=_p);let y=[Ci(p[0])],w=[];for(let f=1;f<p.length;f+=2){let m=p[f];w.push(xs(m,Es)),y.push(Ci(p[f+1]))}r.parts.push({type:1,index:i,name:u,strings:y,ctor:h,update:(f,m,b)=>w.map(q=>q.evaluate(f))})}}else if(t.nodeType===Node.TEXT_NODE){let s=t,a=s.textContent,l=a.split(mc);l.length>1?s.textContent=Ci(l[0]):hc(a)&&(s.textContent=Ci(a));for(let c=1;c<l.length;c+=2){let p=l[c],u=xs(p,Es);r.parts.push({type:2,index:++i,update:(v,y)=>u.evaluate(v)});let h=new Text(l[c+1].replace("\\{{","{{"));s.parentNode.insertBefore(h,s.nextSibling),s.parentNode.insertBefore(document.createComment(""),s.nextSibling),s=h,e.currentNode=h}}for(let s of n)s.remove();return r};var Ti,Ai=class extends E{constructor(){super();L(this,Ti);U(this,Ti,this.attachInternals()),S(this,Ti).ariaLabel="pagination"}createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let e=this.querySelector("template");this.myTemplate=Oe(e)}render(){if(!this.computedContext)return x``;let e=this.computedContext.testParts.flatMap(t=>t.sections.flatMap(i=>i.items));return x` ${e.map(t=>this.myTemplate({item:t,view:this.computedContext.view}))} `}};Ti=new WeakMap,d([$({context:G,subscribe:!0})],Ai.prototype,"computedContext",2),Ai=d([R("test-paging-buttons-stamp")],Ai);var Bn=class{constructor(r){this.G=r}disconnect(){this.G=void 0}reconnect(r){this.G=r}deref(){return this.G}},zn=class{constructor(){this.Y=void 0,this.Z=void 0}get(){return this.Y}pause(){this.Y??=new Promise(r=>this.Z=r)}resume(){this.Z?.(),this.Y=this.Z=void 0}};var bc=o=>!el(o)&&typeof o.then=="function",vc=1073741823,Cs=class extends at{constructor(){super(...arguments),this._$Cwt=vc,this._$Cbt=[],this._$CK=new Bn(this),this._$CX=new zn}render(...r){return r.find(e=>!bc(e))??ie}update(r,e){let t=this._$Cbt,i=t.length;this._$Cbt=e;let n=this._$CK,s=this._$CX;this.isConnected||this.disconnected();for(let a=0;a<e.length&&!(a>this._$Cwt);a++){let l=e[a];if(!bc(l))return this._$Cwt=a,l;a<i&&l===t[a]||(this._$Cwt=vc,i=0,Promise.resolve(l).then(async c=>{for(;s.get();)await s.get();let p=n.deref();if(p!==void 0){let u=p._$Cbt.indexOf(l);u>-1&&u<p._$Cwt&&(p._$Cwt=u,p.setValue(c))}}))}return ie}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}},jn=we(Cs);var Wn=`@layer qti-base, qti-components, qti-utilities, qti-variants, qti-extended;
221
221
 
222
222
  /* https://www.imsglobal.org/sites/default/files/spec/qti/v3/guide/img/qti3p0.css */
223
223
 
@@ -3790,12 +3790,12 @@ div.full-correct-response-inline {
3790
3790
  margin-right: var(--qti-padding-horizontal);
3791
3791
  padding: 0.2rem;
3792
3792
  }
3793
- `;var Si,fr,ac,lc,Xe=class extends E{constructor(){super(...arguments);L(this,fr);this.testURL=null;this.testDoc=null;this.testXML=null;L(this,Si,null)}async handleTestURLChange(){if(this.testURL)try{let e=await er().load(this.testURL),t=this.closest("qti-test");if(t?.postLoadTestTransformCallback){let n=e.htmlDoc().querySelector("qti-assessment-test");n&&(e=await t.postLoadTestTransformCallback(e,n))}this.testDoc=e.htmlDoc()}catch(e){console.error("Error loading or parsing XML:",e)}}handleTestXMLChange(){if(this.testXML)try{this.testDoc=er().parse(this.testXML).htmlDoc()}catch(e){console.error("Error parsing XML:",e)}}async connectedCallback(){super.connectedCallback(),P(this,fr,ac).call(this),P(this,fr,lc).call(this),this.testURL&&this.handleTestURLChange(),this.testXML&&this.handleTestXMLChange()}render(){return x`
3794
- ${I(this,Si)}
3793
+ `;var Ii,br,yc,xc,He=class extends E{constructor(){super(...arguments);L(this,br);this.testURL=null;this.testDoc=null;this.testXML=null;this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}};L(this,Ii,null)}async handleTestURLChange(){if(this.testURL)try{let e=this.qtiContext?.QTI_CONTEXT?.seed,t=(await lr().load(this.testURL)).shuffleOrdering(e),i=this.closest("qti-test");if(i?.postLoadTestTransformCallback){let s=t.htmlDoc().querySelector("qti-assessment-test");s&&(t=await i.postLoadTestTransformCallback(t,s))}this.testDoc=t.htmlDoc()}catch(e){console.error("Error loading or parsing XML:",e)}}handleTestXMLChange(){if(this.testXML)try{this.testDoc=lr().parse(this.testXML).htmlDoc()}catch(e){console.error("Error parsing XML:",e)}}async connectedCallback(){super.connectedCallback(),P(this,br,yc).call(this),P(this,br,xc).call(this),this.testURL&&this.handleTestURLChange(),this.testXML&&this.handleTestXMLChange()}render(){return x`
3794
+ ${S(this,Ii)}
3795
3795
  <slot></slot>
3796
- ${Fn(this.testDoc,x`<span>Loading...</span>`)}
3797
- `}};Si=new WeakMap,fr=new WeakSet,ac=function(){let e=this.querySelector("template");U(this,Si,e?e.content:x``)},lc=function(){let e=new CSSStyleSheet;e.replaceSync(Un),this.shadowRoot.adoptedStyleSheets=[e]},d([g({type:String,attribute:"test-url"})],Xe.prototype,"testURL",2),d([M()],Xe.prototype,"testDoc",2),d([M()],Xe.prototype,"testXML",2),d([B("testURL",{waitUntilFirstUpdate:!0})],Xe.prototype,"handleTestURLChange",1),d([B("testXML",{waitUntilFirstUpdate:!0})],Xe.prototype,"handleTestXMLChange",1),Xe=d([k("test-container")],Xe);var gr=class extends E{render(){let r=this.computedContext?.testParts.flatMap(n=>n.sections.flatMap(o=>o.items)).find(n=>n.active);if(!r||!r.variables)return x``;let e=r.variables.filter(n=>n.type==="response"),t=r.variables.filter(n=>n.type==="outcome"),i=(n,o)=>x`
3798
- <h3>${o}</h3>
3796
+ ${jn(this.testDoc,x`<span>Loading...</span>`)}
3797
+ `}};Ii=new WeakMap,br=new WeakSet,yc=function(){let e=this.querySelector("template");U(this,Ii,e?e.content:x``)},xc=function(){let e=new CSSStyleSheet;e.replaceSync(Wn),this.shadowRoot.adoptedStyleSheets=[e]},d([g({type:String,attribute:"test-url"})],He.prototype,"testURL",2),d([k()],He.prototype,"testDoc",2),d([k()],He.prototype,"testXML",2),d([k(),$({context:be,subscribe:!0})],He.prototype,"qtiContext",2),d([B("testURL",{waitUntilFirstUpdate:!0})],He.prototype,"handleTestURLChange",1),d([B("testXML",{waitUntilFirstUpdate:!0})],He.prototype,"handleTestXMLChange",1),He=d([R("test-container")],He);var vr=class extends E{render(){let r=this.computedContext?.testParts.flatMap(n=>n.sections.flatMap(s=>s.items)).find(n=>n.active);if(!r||!r.variables)return x``;let e=r.variables.filter(n=>n.type==="response"),t=r.variables.filter(n=>n.type==="outcome"),i=(n,s)=>x`
3798
+ <h3>${s}</h3>
3799
3799
  <table>
3800
3800
  <thead>
3801
3801
  <tr>
@@ -3820,7 +3820,7 @@ div.full-correct-response-inline {
3820
3820
  </table>
3821
3821
  `;return x`
3822
3822
  ${i(e,"Response Variables")} ${i(t,"Outcome Variables")}
3823
- `}};gr.styles=C`
3823
+ `}};vr.styles=C`
3824
3824
  table {
3825
3825
  width: 100%;
3826
3826
  border-collapse: collapse;
@@ -3841,68 +3841,68 @@ div.full-correct-response-inline {
3841
3841
  margin-top: 20px;
3842
3842
  font-size: 16px;
3843
3843
  }
3844
- `,d([$({context:G,subscribe:!0})],gr.prototype,"computedContext",2),gr=d([k("test-print-item-variables")],gr);var Ti,Ai=class extends E{constructor(){super();L(this,Ti);U(this,Ti,this.attachInternals()),I(this,Ti).ariaLabel="pagination"}createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let e=this.querySelector("template");this.myTemplate=Ne(e)}render(){if(!this.computedContext)return x``;let e=this.computedContext.testParts.flatMap(t=>t.sections);return x` ${e.map(t=>this.myTemplate({item:t}))} `}};Ti=new WeakMap,d([$({context:G,subscribe:!0})],Ai.prototype,"computedContext",2),Ai=d([k("test-section-buttons-stamp")],Ai);var Bn,cc,br=class extends E{constructor(){super();L(this,Bn);this.sectionId=null;this.addEventListener("click",()=>P(this,Bn,cc).call(this,this.sectionId))}render(){return x` <slot></slot> `}};Bn=new WeakSet,cc=function(e){this.dispatchEvent(new CustomEvent("qti-request-navigation",{composed:!0,bubbles:!0,detail:{type:"section",id:e}}))},br.styles=C`
3844
+ `,d([$({context:G,subscribe:!0})],vr.prototype,"computedContext",2),vr=d([R("test-print-item-variables")],vr);var ki,Ri=class extends E{constructor(){super();L(this,ki);U(this,ki,this.attachInternals()),S(this,ki).ariaLabel="pagination"}createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let e=this.querySelector("template");this.myTemplate=Oe(e)}render(){if(!this.computedContext)return x``;let e=this.computedContext.testParts.flatMap(t=>t.sections);return x` ${e.map(t=>this.myTemplate({item:t}))} `}};ki=new WeakMap,d([$({context:G,subscribe:!0})],Ri.prototype,"computedContext",2),Ri=d([R("test-section-buttons-stamp")],Ri);var Gn,qc,yr=class extends E{constructor(){super();L(this,Gn);this.sectionId=null;this.addEventListener("click",()=>P(this,Gn,qc).call(this,this.sectionId))}render(){return x` <slot></slot> `}};Gn=new WeakSet,qc=function(e){this.dispatchEvent(new CustomEvent("qti-request-navigation",{composed:!0,bubbles:!0,detail:{type:"section",id:e}}))},yr.styles=C`
3845
3845
  :host {
3846
- ${ie};
3846
+ ${oe};
3847
3847
  }
3848
3848
  :host([disabled]) {
3849
- ${ne};
3849
+ ${se};
3850
3850
  }
3851
- `,d([g({type:String,attribute:"section-id"})],br.prototype,"sectionId",2),br=d([k("test-section-link")],br);var Ii=class extends E{render(){return x` <small><pre>${JSON.stringify(this.computedContext,null,2)}</pre></small> `}};d([M(),$({context:G,subscribe:!0})],Ii.prototype,"computedContext",2),Ii=d([k("test-print-context")],Ii);var Ut=class extends E{constructor(){super(...arguments);this.debug=!1;this.stampContext={view:"candidate",activeItem:{},activeSection:{items:[]},activeTestpart:{items:[],sections:[]},test:{}}}createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let e=this.querySelector("template");if(!e){this.myTemplate=null;return}this.myTemplate=Ne(e)}willUpdate(e){if(!this.computedContext)return;let t=this.computedContext.testParts.find(m=>m.active),i=t?.sections.find(m=>m.active),n=i?.items.find(m=>m.active),{variables:o,...a}=n||{};if(!t||!i||!n)return;let l={...t,items:t.sections.flatMap(m=>m.items.map(({variables:y,...b})=>b)),sections:t.sections.map(m=>({...m,items:m.items.map(({variables:y,...b})=>b)}))},c={...i,items:i.items.map(({variables:m,...y})=>y)},{testParts:p,...u}=this.computedContext;this.stampContext={view:this.computedContext.view,activeItem:a,activeSection:c,activeTestpart:l,test:u},this.dispatchEvent(new CustomEvent("qti-stamp-context-updated",{detail:this.stampContext,bubbles:!0}))}render(){return x` ${this.debug?x`<small><pre>${JSON.stringify(this.stampContext,null,2)}</pre></small>`:O}
3852
- ${this.myTemplate?this.myTemplate(this.stampContext):O}`}};d([g({type:Boolean,reflect:!0})],Ut.prototype,"debug",2),d([M(),$({context:G,subscribe:!0})],Ut.prototype,"computedContext",2),d([M()],Ut.prototype,"stampContext",2),Ut=d([k("test-stamp")],Ut);var zn,dc,Bt=class extends E{constructor(){super();L(this,zn);this.view="";this.disabled=!1;this.myTemplate=null;this.addEventListener("click",e=>{let t=e.target,i=parseFloat(t.value);t.tagName==="INPUT"&&P(this,zn,dc).call(this,i)})}createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let e=this.querySelector("template");if(!e){this.myTemplate=null;return}this.myTemplate=Ne(e)}render(){let e=this.computedContext?.testParts.flatMap(l=>l.sections.flatMap(c=>c.items)).find(l=>l.active);if(!e||!e.variables)return x``;let t=e.variables.find(l=>l.identifier=="MAXSCORE")?.value,i=e.variables.find(l=>l.identifier=="SCORE"),n=i?.value,o=i?.externalScored!=="human";if(!t||!i)return O;let a=[...Array(Number(t)+1).keys()];return x`${this.myTemplate?this.myTemplate({scores:a,score:n,disabled:o}):O}`}};zn=new WeakSet,dc=function(e){let n=(this.computedContext?.testParts.find(o=>o.active)).sections.flatMap(o=>o.items).find(o=>o.active)?.identifier;this.dispatchEvent(new CustomEvent("test-update-outcome-variable",{detail:{assessmentItemRefId:n,outcomeVariableId:"SCORE",value:e},bubbles:!0}))},d([g({type:String,attribute:"view"})],Bt.prototype,"view",2),d([g({type:Boolean})],Bt.prototype,"disabled",2),d([$({context:G,subscribe:!0})],Bt.prototype,"computedContext",2),Bt=d([k("test-scoring-buttons")],Bt);var Ri=class extends E{createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let r=this.querySelector("template");if(!r){this.myTemplate=null;return}this.myTemplate=Ne(r)}_switchView(r){this.dispatchEvent(new CustomEvent("on-test-switch-view",{composed:!0,bubbles:!0,detail:r}))}firstUpdated(r){this.addEventListener("click",()=>{this.sessionContext?.view==="scorer"?this._switchView("candidate"):this._switchView("scorer")})}render(){return x`${this.myTemplate?this.myTemplate({view:this.sessionContext?.view}):O}`}};d([$({context:it,subscribe:!0})],Ri.prototype,"sessionContext",2),Ri=d([k("test-view-toggle")],Ri);var vr=class extends E{constructor(){super(...arguments);this.view=null}render(){let e=this.computedContext?.testParts.flatMap(l=>l.sections.flatMap(c=>c.items)).find(l=>l.active);if(!e||!e.variables)return x``;if(e.category==="dep-informational")return x`<div>${this.dataset.informational}</div>`;let t=e?.variables.find(l=>l.identifier==="completionStatus")?.value,i=e?.variables.find(l=>l.identifier=="SCORE"),n=parseFloat(i?.value),o=e.externalScored;return x`<div>${t!=="completed"?this.dataset.textNoResponse:!o&&n!==void 0&&!Number.isNaN(n)?n>0?this.dataset.textCorrect:this.dataset.textIncorrect:o==="externalMachine"?Number.isNaN(n)||n===void 0?this.dataset.scoreUnknown:`We hebben je antwoord ${n===0?"geen punten":n==1?"\xE9\xE9n punt":`${n} punten`} gegeven. Je kunt je score zelf aanpassen als je denkt dat dat niet klopt.`:o==="human"?Number.isNaN(n)?"":"Deze score heb je zelf toegekend.":this.dataset.inProgress}</div>`}};d([$({context:G,subscribe:!0})],vr.prototype,"computedContext",2),d([g({type:String,attribute:"view"})],vr.prototype,"view",2),vr=d([k("test-scoring-feedback")],vr);var ki=class extends E{constructor(){super(),this.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("test-end-attempt",{bubbles:!0})),this.dispatchEvent(new CustomEvent("test-show-correct-response",{detail:!0,bubbles:!0}));let e=this.closest("qti-test").querySelector("test-container");Array.from(e.shadowRoot.querySelectorAll("[view]")).forEach(i=>{i.classList.toggle("show",!0)})})}render(){return x` <slot></slot> `}};ki.styles=C`
3851
+ `,d([g({type:String,attribute:"section-id"})],yr.prototype,"sectionId",2),yr=d([R("test-section-link")],yr);var Mi=class extends E{render(){return x` <small><pre>${JSON.stringify(this.computedContext,null,2)}</pre></small> `}};d([k(),$({context:G,subscribe:!0})],Mi.prototype,"computedContext",2),Mi=d([R("test-print-context")],Mi);var Bt=class extends E{constructor(){super(...arguments);this.debug=!1;this.stampContext={view:"candidate",activeItem:{},activeSection:{items:[]},activeTestpart:{items:[],sections:[]},test:{}}}createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let e=this.querySelector("template");if(!e){this.myTemplate=null;return}this.myTemplate=Oe(e)}willUpdate(e){if(!this.computedContext)return;let t=this.computedContext.testParts.find(h=>h.active),i=t?.sections.find(h=>h.active),n=i?.items.find(h=>h.active),{variables:s,...a}=n||{};if(!t||!i||!n)return;let l={...t,items:t.sections.flatMap(h=>h.items.map(({variables:v,...y})=>y)),sections:t.sections.map(h=>({...h,items:h.items.map(({variables:v,...y})=>y)}))},c={...i,items:i.items.map(({variables:h,...v})=>v)},{testParts:p,...u}=this.computedContext;this.stampContext={view:this.computedContext.view,activeItem:a,activeSection:c,activeTestpart:l,test:u},this.dispatchEvent(new CustomEvent("qti-stamp-context-updated",{detail:this.stampContext,bubbles:!0}))}render(){return x` ${this.debug?x`<small><pre>${JSON.stringify(this.stampContext,null,2)}</pre></small>`:O}
3852
+ ${this.myTemplate?this.myTemplate(this.stampContext):O}`}};d([g({type:Boolean,reflect:!0})],Bt.prototype,"debug",2),d([k(),$({context:G,subscribe:!0})],Bt.prototype,"computedContext",2),d([k()],Bt.prototype,"stampContext",2),Bt=d([R("test-stamp")],Bt);var Xn,wc,zt=class extends E{constructor(){super();L(this,Xn);this.view="";this.disabled=!1;this.myTemplate=null;this.addEventListener("click",e=>{let t=e.target,i=parseFloat(t.value);t.tagName==="INPUT"&&P(this,Xn,wc).call(this,i)})}createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let e=this.querySelector("template");if(!e){this.myTemplate=null;return}this.myTemplate=Oe(e)}render(){let e=this.computedContext?.testParts.flatMap(l=>l.sections.flatMap(c=>c.items)).find(l=>l.active);if(!e||!e.variables)return x``;let t=e.variables.find(l=>l.identifier=="MAXSCORE")?.value,i=e.variables.find(l=>l.identifier=="SCORE"),n=i?.value,s=i?.externalScored!=="human";if(!t||!i)return O;let a=[...Array(Number(t)+1).keys()];return x`${this.myTemplate?this.myTemplate({scores:a,score:n,disabled:s}):O}`}};Xn=new WeakSet,wc=function(e){let n=(this.computedContext?.testParts.find(s=>s.active)).sections.flatMap(s=>s.items).find(s=>s.active)?.identifier;this.dispatchEvent(new CustomEvent("test-update-outcome-variable",{detail:{assessmentItemRefId:n,outcomeVariableId:"SCORE",value:e},bubbles:!0}))},d([g({type:String,attribute:"view"})],zt.prototype,"view",2),d([g({type:Boolean})],zt.prototype,"disabled",2),d([$({context:G,subscribe:!0})],zt.prototype,"computedContext",2),zt=d([R("test-scoring-buttons")],zt);var _i=class extends E{createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let r=this.querySelector("template");if(!r){this.myTemplate=null;return}this.myTemplate=Oe(r)}_switchView(r){this.dispatchEvent(new CustomEvent("on-test-switch-view",{composed:!0,bubbles:!0,detail:r}))}firstUpdated(r){this.addEventListener("click",()=>{this.sessionContext?.view==="scorer"?this._switchView("candidate"):this._switchView("scorer")})}render(){return x`${this.myTemplate?this.myTemplate({view:this.sessionContext?.view}):O}`}};d([$({context:nt,subscribe:!0})],_i.prototype,"sessionContext",2),_i=d([R("test-view-toggle")],_i);var xr=class extends E{constructor(){super(...arguments);this.view=null}render(){let e=this.computedContext?.testParts.flatMap(l=>l.sections.flatMap(c=>c.items)).find(l=>l.active);if(!e||!e.variables)return x``;if(e.category==="dep-informational")return x`<div>${this.dataset.informational}</div>`;let t=e?.variables.find(l=>l.identifier==="completionStatus")?.value,i=e?.variables.find(l=>l.identifier=="SCORE"),n=parseFloat(i?.value),s=e.externalScored;return x`<div>${t!=="completed"?this.dataset.textNoResponse:!s&&n!==void 0&&!Number.isNaN(n)?n>0?this.dataset.textCorrect:this.dataset.textIncorrect:s==="externalMachine"?Number.isNaN(n)||n===void 0?this.dataset.scoreUnknown:`We hebben je antwoord ${n===0?"geen punten":n==1?"\xE9\xE9n punt":`${n} punten`} gegeven. Je kunt je score zelf aanpassen als je denkt dat dat niet klopt.`:s==="human"?Number.isNaN(n)?"":"Deze score heb je zelf toegekend.":this.dataset.inProgress}</div>`}};d([$({context:G,subscribe:!0})],xr.prototype,"computedContext",2),d([g({type:String,attribute:"view"})],xr.prototype,"view",2),xr=d([R("test-scoring-feedback")],xr);var Li=class extends E{constructor(){super(),this.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("test-end-attempt",{bubbles:!0})),this.dispatchEvent(new CustomEvent("test-show-correct-response",{detail:!0,bubbles:!0}));let e=this.closest("qti-test").querySelector("test-container");Array.from(e.shadowRoot.querySelectorAll("[view]")).forEach(i=>{i.classList.toggle("show",!0)})})}render(){return x` <slot></slot> `}};Li.styles=C`
3853
3853
  :host {
3854
- ${ie};
3854
+ ${oe};
3855
3855
  }
3856
3856
  :host([disabled]) {
3857
- ${ne};
3857
+ ${se};
3858
3858
  }
3859
- `,ki=d([k("test-check-item")],ki);var Mi,yr,pc,uc,Qe=class extends E{constructor(){super(...arguments);L(this,yr);this.itemURL=null;this.itemDoc=null;this.itemXML=null;L(this,Mi,null)}async handleItemURLChange(){if(this.itemURL)try{let e=await Me().load(this.itemURL);this.itemDoc=e.htmlDoc()}catch(e){console.error("Error loading or parsing XML:",e)}}handleItemXMLChange(){if(this.itemXML)try{this.itemDoc=Me().parse(this.itemXML).htmlDoc()}catch(e){console.error("Error parsing XML:",e)}}async connectedCallback(){super.connectedCallback(),P(this,yr,pc).call(this),P(this,yr,uc).call(this),this.itemURL&&this.handleItemURLChange(),this.itemXML&&this.handleItemXMLChange()}render(){return x`
3860
- ${I(this,Mi)}
3859
+ `,Li=d([R("test-check-item")],Li);var $i,qr,Ec,Cc,Fe=class extends E{constructor(){super(...arguments);L(this,qr);this.itemURL=null;this.itemDoc=null;this.itemXML=null;this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}};L(this,$i,null)}async handleItemURLChange(){if(this.itemURL)try{let e=this.qtiContext?.QTI_CONTEXT?.seed,t=(await Le().load(this.itemURL)).shuffleInteractions(e);this.itemDoc=t.htmlDoc()}catch(e){console.error("Error loading or parsing XML:",e)}}handleItemXMLChange(){if(this.itemXML)try{this.itemDoc=Le().parse(this.itemXML).htmlDoc()}catch(e){console.error("Error parsing XML:",e)}}async connectedCallback(){super.connectedCallback(),P(this,qr,Ec).call(this),P(this,qr,Cc).call(this),this.itemURL&&this.handleItemURLChange(),this.itemXML&&this.handleItemXMLChange()}render(){return x`
3860
+ ${S(this,$i)}
3861
3861
  <slot></slot>
3862
- ${Fn(this.itemDoc,x`<span>Loading...</span>`)}
3863
- `}};Mi=new WeakMap,yr=new WeakSet,pc=function(){let e=this.querySelector("template");U(this,Mi,e?e.content:x``)},uc=function(){let e=new CSSStyleSheet;e.replaceSync(Un),this.shadowRoot.adoptedStyleSheets=[e]},d([g({type:String,attribute:"item-url"})],Qe.prototype,"itemURL",2),d([M()],Qe.prototype,"itemDoc",2),d([M()],Qe.prototype,"itemXML",2),d([B("itemURL",{waitUntilFirstUpdate:!0})],Qe.prototype,"handleItemURLChange",1),d([B("itemXML",{waitUntilFirstUpdate:!0})],Qe.prototype,"handleItemXMLChange",1),Qe=d([k("item-container")],Qe);var jn,mc,zt=class extends E{constructor(){super(...arguments);L(this,jn);this.label="Correct response mode";this._options={internal:"Internal",full:"Full (copy)"}}render(){return x`
3862
+ ${jn(this.itemDoc,x`<span>Loading...</span>`)}
3863
+ `}};$i=new WeakMap,qr=new WeakSet,Ec=function(){let e=this.querySelector("template");U(this,$i,e?e.content:x``)},Cc=function(){let e=new CSSStyleSheet;e.replaceSync(Wn),this.shadowRoot.adoptedStyleSheets=[e]},d([g({type:String,attribute:"item-url"})],Fe.prototype,"itemURL",2),d([k()],Fe.prototype,"itemDoc",2),d([k()],Fe.prototype,"itemXML",2),d([k(),$({context:be,subscribe:!0})],Fe.prototype,"qtiContext",2),d([B("itemURL",{waitUntilFirstUpdate:!0})],Fe.prototype,"handleItemURLChange",1),d([B("itemXML",{waitUntilFirstUpdate:!0})],Fe.prototype,"handleItemXMLChange",1),Fe=d([R("item-container")],Fe);var Qn,Sc,jt=class extends E{constructor(){super(...arguments);L(this,Qn);this.label="Correct response mode";this._options={internal:"Internal",full:"Full (copy)"}}render(){return x`
3864
3864
  <label part="label" for="modeSelect">${this.label}</label>
3865
3865
  <select
3866
3866
  part="select"
3867
3867
  id="modeSelect"
3868
- @change=${e=>{let t=e.target;P(this,jn,mc).call(this,t.value)}}
3868
+ @change=${e=>{let t=e.target;P(this,Qn,Sc).call(this,t.value)}}
3869
3869
  >
3870
3870
  ${Object.keys(this._options).map(e=>x`<option value="${e}" ?selected=${e===this.itemContext?.correctResponseMode}>
3871
3871
  ${this._options[e]}
3872
3872
  </option>`)}
3873
3873
  </select>
3874
- `}};jn=new WeakSet,mc=function(e){this.dispatchEvent(new CustomEvent("item-switch-correct-response-mode",{detail:e,bubbles:!0}))},d([$({context:ge,subscribe:!0})],zt.prototype,"itemContext",2),d([g({type:String})],zt.prototype,"label",2),d([M()],zt.prototype,"_options",2),zt=d([k("item-correct-response-mode")],zt);var hc=C`
3874
+ `}};Qn=new WeakSet,Sc=function(e){this.dispatchEvent(new CustomEvent("item-switch-correct-response-mode",{detail:e,bubbles:!0}))},d([$({context:ne,subscribe:!0})],jt.prototype,"itemContext",2),d([g({type:String})],jt.prototype,"label",2),d([k()],jt.prototype,"_options",2),jt=d([R("item-correct-response-mode")],jt);var Ac=C`
3875
3875
  display: inline-flex;
3876
3876
  align-items: center;
3877
3877
  cursor: pointer;
3878
3878
  padding: 0.5rem 1rem;
3879
3879
  border-radius: 0.25rem;
3880
3880
  user-select: none;
3881
- `,Wn=C`
3881
+ `,Yn=C`
3882
3882
  background-color: lightgray;
3883
- ${hc};
3884
- `,Gn=C`
3883
+ ${Ac};
3884
+ `,Jn=C`
3885
3885
  cursor: not-allowed;
3886
3886
  opacity: 0.8;
3887
- `,lw=C`
3888
- ${hc};
3887
+ `,iE=C`
3888
+ ${Ac};
3889
3889
  border: 1px solid gray;
3890
- `;var xr,_i,qr,gc,bc,Ce=class extends E{constructor(){super();L(this,qr);this.shown=!1;this.disabled=!1;this.showCandidateCorrectionText="Show candidate correction";this.hideCandidateCorrectionText="Hide candidate correction";this.noCorrectResponseText="No correct response specified";L(this,xr,!1);L(this,_i,"")}updated(){if(!I(this,xr)||I(this,_i)!==this.computedContext?.identifier){U(this,_i,this.computedContext?.identifier);let e=!!this.computedContext?.variables.some(i=>i.correctResponse),t=!!this.computedContext?.variables.some(i=>i.mapping?.mapEntries?.length>0||i.areaMapping?.areaMapEntries?.length>0);U(this,xr,e||t)}this.disabled=!I(this,xr)}render(){return x` <div @click="${P(this,qr,gc)}">${P(this,qr,bc).call(this)}</div> `}};xr=new WeakMap,_i=new WeakMap,qr=new WeakSet,gc=function(){this.disabled||this.dispatchEvent(new CustomEvent("item-show-candidate-correction",{detail:!this.shown,bubbles:!0}))},bc=function(){return this.disabled?this.noCorrectResponseText:this.shown?this.hideCandidateCorrectionText:this.showCandidateCorrectionText},Ce.styles=C`
3890
+ `;var wr,Pi,Er,Ic,Rc,Se=class extends E{constructor(){super();L(this,Er);this.shown=!1;this.disabled=!1;this.showCandidateCorrectionText="Show candidate correction";this.hideCandidateCorrectionText="Hide candidate correction";this.noCorrectResponseText="No correct response specified";L(this,wr,!1);L(this,Pi,"")}updated(){if(!S(this,wr)||S(this,Pi)!==this.computedContext?.identifier){U(this,Pi,this.computedContext?.identifier);let e=!!this.computedContext?.variables.some(i=>i.correctResponse),t=!!this.computedContext?.variables.some(i=>i.mapping?.mapEntries?.length>0||i.areaMapping?.areaMapEntries?.length>0);U(this,wr,e||t)}this.disabled=!S(this,wr)}render(){return x` <div @click="${P(this,Er,Ic)}">${P(this,Er,Rc).call(this)}</div> `}};wr=new WeakMap,Pi=new WeakMap,Er=new WeakSet,Ic=function(){this.disabled||this.dispatchEvent(new CustomEvent("item-show-candidate-correction",{detail:!this.shown,bubbles:!0}))},Rc=function(){return this.disabled?this.noCorrectResponseText:this.shown?this.hideCandidateCorrectionText:this.showCandidateCorrectionText},Se.styles=C`
3891
3891
  :host {
3892
- ${Wn};
3892
+ ${Yn};
3893
3893
  }
3894
3894
  :host([disabled]) {
3895
- ${Gn};
3895
+ ${Jn};
3896
3896
  }
3897
- `,d([$({context:rt,subscribe:!0})],Ce.prototype,"computedContext",2),d([g({type:Boolean,reflect:!0})],Ce.prototype,"shown",2),d([g({type:Boolean,reflect:!0})],Ce.prototype,"disabled",2),d([g({type:String})],Ce.prototype,"showCandidateCorrectionText",2),d([g({type:String})],Ce.prototype,"hideCandidateCorrectionText",2),d([g({type:String})],Ce.prototype,"noCorrectResponseText",2),Ce=d([k("item-show-candidate-correction")],Ce);var wr,Li,Er,vc,yc,Se=class extends E{constructor(){super(...arguments);L(this,Er);this.shown=!1;this.disabled=!1;this.showCorrectText="Show correct response";this.hideCorrectText="Hide correct response";this.noCorrectResponseText="No correct response specified";L(this,wr,!1);L(this,Li,"")}updated(){if(!I(this,wr)||I(this,Li)!==this.computedContext?.identifier){U(this,Li,this.computedContext?.identifier);let e=!!this.computedContext?.variables.some(i=>i.correctResponse),t=!!this.computedContext?.variables.some(i=>i.mapping?.mapEntries?.length>0||i.areaMapping?.areaMapEntries?.length>0);U(this,wr,e||t)}this.disabled=!I(this,wr)}render(){return x` <div @click="${P(this,Er,vc)}">${P(this,Er,yc).call(this)}</div> `}};wr=new WeakMap,Li=new WeakMap,Er=new WeakSet,vc=function(){this.disabled||this.dispatchEvent(new CustomEvent("item-show-correct-response",{detail:!this.shown,bubbles:!0}))},yc=function(){return this.disabled?this.noCorrectResponseText:this.shown?this.hideCorrectText:this.showCorrectText},Se.styles=C`
3897
+ `,d([$({context:it,subscribe:!0})],Se.prototype,"computedContext",2),d([g({type:Boolean,reflect:!0})],Se.prototype,"shown",2),d([g({type:Boolean,reflect:!0})],Se.prototype,"disabled",2),d([g({type:String})],Se.prototype,"showCandidateCorrectionText",2),d([g({type:String})],Se.prototype,"hideCandidateCorrectionText",2),d([g({type:String})],Se.prototype,"noCorrectResponseText",2),Se=d([R("item-show-candidate-correction")],Se);var Cr,Vi,Sr,kc,Mc,Ae=class extends E{constructor(){super(...arguments);L(this,Sr);this.shown=!1;this.disabled=!1;this.showCorrectText="Show correct response";this.hideCorrectText="Hide correct response";this.noCorrectResponseText="No correct response specified";L(this,Cr,!1);L(this,Vi,"")}updated(){if(!S(this,Cr)||S(this,Vi)!==this.computedContext?.identifier){U(this,Vi,this.computedContext?.identifier);let e=!!this.computedContext?.variables.some(i=>i.correctResponse),t=!!this.computedContext?.variables.some(i=>i.mapping?.mapEntries?.length>0||i.areaMapping?.areaMapEntries?.length>0);U(this,Cr,e||t)}this.disabled=!S(this,Cr)}render(){return x` <div @click="${P(this,Sr,kc)}">${P(this,Sr,Mc).call(this)}</div> `}};Cr=new WeakMap,Vi=new WeakMap,Sr=new WeakSet,kc=function(){this.disabled||this.dispatchEvent(new CustomEvent("item-show-correct-response",{detail:!this.shown,bubbles:!0}))},Mc=function(){return this.disabled?this.noCorrectResponseText:this.shown?this.hideCorrectText:this.showCorrectText},Ae.styles=C`
3898
3898
  :host {
3899
- ${Wn};
3899
+ ${Yn};
3900
3900
  }
3901
3901
  :host([disabled]) {
3902
- ${Gn};
3902
+ ${Jn};
3903
3903
  }
3904
- `,d([$({context:rt,subscribe:!0})],Se.prototype,"computedContext",2),d([g({type:Boolean,reflect:!0})],Se.prototype,"shown",2),d([g({type:Boolean,reflect:!0})],Se.prototype,"disabled",2),d([g({type:String})],Se.prototype,"showCorrectText",2),d([g({type:String})],Se.prototype,"hideCorrectText",2),d([g({type:String})],Se.prototype,"noCorrectResponseText",2),Se=d([k("item-show-correct-response")],Se);var Cr=class extends E{render(){let r=this.computedContext;if(!r||!r.variables)return x``;let e=r.variables.filter(n=>n.type==="response"),t=r.variables.filter(n=>n.type==="outcome"),i=(n,o)=>x`
3905
- <h3>${o}</h3>
3904
+ `,d([$({context:it,subscribe:!0})],Ae.prototype,"computedContext",2),d([g({type:Boolean,reflect:!0})],Ae.prototype,"shown",2),d([g({type:Boolean,reflect:!0})],Ae.prototype,"disabled",2),d([g({type:String})],Ae.prototype,"showCorrectText",2),d([g({type:String})],Ae.prototype,"hideCorrectText",2),d([g({type:String})],Ae.prototype,"noCorrectResponseText",2),Ae=d([R("item-show-correct-response")],Ae);var Ar=class extends E{render(){let r=this.computedContext;if(!r||!r.variables)return x``;let e=r.variables.filter(n=>n.type==="response"),t=r.variables.filter(n=>n.type==="outcome"),i=(n,s)=>x`
3905
+ <h3>${s}</h3>
3906
3906
  <table>
3907
3907
  <thead>
3908
3908
  <tr>
@@ -3927,7 +3927,7 @@ div.full-correct-response-inline {
3927
3927
  </table>
3928
3928
  `;return x`
3929
3929
  ${i(e,"Response Variables")} ${i(t,"Outcome Variables")}
3930
- `}};Cr.styles=C`
3930
+ `}};Ar.styles=C`
3931
3931
  table {
3932
3932
  width: 100%;
3933
3933
  border-collapse: collapse;
@@ -3948,40 +3948,40 @@ div.full-correct-response-inline {
3948
3948
  margin-top: 20px;
3949
3949
  font-size: 16px;
3950
3950
  }
3951
- `,d([$({context:rt,subscribe:!0})],Cr.prototype,"computedContext",2),Cr=d([k("item-print-variables")],Cr);var se,$i,Pi,Xn,Qn,Yn,Z,xc,qc,bs,wc,Ec,vs,Sr=class extends E{constructor(){super();L(this,Z);L(this,se);this.configContext={};L(this,$i,P(this,Z,xc).bind(this));L(this,Pi,P(this,Z,qc).bind(this));L(this,Xn,P(this,Z,bs).bind(this));L(this,Qn,P(this,Z,wc).bind(this));L(this,Yn,P(this,Z,Ec).bind(this));this.addEventListener("qti-item-context-updated",I(this,$i)),this.addEventListener("qti-assessment-item-connected",I(this,Pi)),this.addEventListener("item-show-correct-response",I(this,Xn)),this.addEventListener("item-show-candidate-correction",I(this,Qn)),this.addEventListener("item-switch-correct-response-mode",I(this,Yn))}render(){return x`<slot></slot>`}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-item-context-changed",I(this,$i)),this.removeEventListener("qti-assessment-item-connected",I(this,Pi))}};se=new WeakMap,$i=new WeakMap,Pi=new WeakMap,Xn=new WeakMap,Qn=new WeakMap,Yn=new WeakMap,Z=new WeakSet,xc=function(e){P(this,Z,vs).call(this,e.detail.itemContext.identifier,e.detail?.itemContext?.variables||[])},qc=function(e){let t=e.detail._context.variables;U(this,se,e.detail),this.computedContext=this.computedContext?.identifier===I(this,se).identifier?{...this.computedContext,title:I(this,se).title}:{identifier:I(this,se).identifier,title:I(this,se).title,adaptive:I(this,se).getAttribute("adaptive")?.toLowerCase()==="true"||!1,variables:t,correctResponseMode:"internal"},P(this,Z,vs).call(this,I(this,se).identifier,t||[])},bs=function(e){I(this,se)&&I(this,se).showCorrectResponse(e.detail)},wc=function(e){I(this,se)&&I(this,se).showCandidateCorrection(e.detail)},Ec=function(e){P(this,Z,bs).call(this,new CustomEvent("item-show-correct-response",{detail:!1,bubbles:!0})),this.configContext={...this.configContext,correctResponseMode:e.detail}},vs=function(e,t){let i=t?.find(p=>p.identifier=="SCORE")?.value,n=parseFloat(i?.toString()),o=t?.find(p=>p.identifier==="completionStatus")?.value,a=n!==void 0&&!isNaN(n)&&n>0,l=n!==void 0&&!isNaN(n)&&n<=0,c=o==="completed";this.computedContext={...this.computedContext,identifier:e,correct:a,incorrect:l,completed:c,variables:t}},d([M(),ce({context:rt})],Sr.prototype,"computedContext",2),d([M(),ce({context:ge})],Sr.prototype,"configContext",2),Sr=d([k("qti-item")],Sr);var Cc=C`
3951
+ `,d([$({context:it,subscribe:!0})],Ar.prototype,"computedContext",2),Ar=d([R("item-print-variables")],Ar);var le,Di,Ni,Kn,Zn,eo,Z,_c,Lc,Ss,$c,Pc,As,Wt=class extends E{constructor(){super();L(this,Z);L(this,le);this.configContext={};this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}};L(this,Di,P(this,Z,_c).bind(this));L(this,Ni,P(this,Z,Lc).bind(this));L(this,Kn,P(this,Z,Ss).bind(this));L(this,Zn,P(this,Z,$c).bind(this));L(this,eo,P(this,Z,Pc).bind(this));this.addEventListener("qti-item-context-updated",S(this,Di)),this.addEventListener("qti-assessment-item-connected",S(this,Ni)),this.addEventListener("item-show-correct-response",S(this,Kn)),this.addEventListener("item-show-candidate-correction",S(this,Zn)),this.addEventListener("item-switch-correct-response-mode",S(this,eo))}render(){return x`<slot></slot>`}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-item-context-changed",S(this,Di)),this.removeEventListener("qti-assessment-item-connected",S(this,Ni))}};le=new WeakMap,Di=new WeakMap,Ni=new WeakMap,Kn=new WeakMap,Zn=new WeakMap,eo=new WeakMap,Z=new WeakSet,_c=function(e){P(this,Z,As).call(this,e.detail.itemContext.identifier,e.detail?.itemContext?.variables||[])},Lc=function(e){let t=e.detail._context.variables;U(this,le,e.detail),this.computedContext=this.computedContext?.identifier===S(this,le).identifier?{...this.computedContext,title:S(this,le).title}:{identifier:S(this,le).identifier,title:S(this,le).title,adaptive:S(this,le).getAttribute("adaptive")?.toLowerCase()==="true"||!1,variables:t,correctResponseMode:"internal"},P(this,Z,As).call(this,S(this,le).identifier,t||[])},Ss=function(e){S(this,le)&&S(this,le).showCorrectResponse(e.detail)},$c=function(e){S(this,le)&&S(this,le).showCandidateCorrection(e.detail)},Pc=function(e){P(this,Z,Ss).call(this,new CustomEvent("item-show-correct-response",{detail:!1,bubbles:!0})),this.configContext={...this.configContext,correctResponseMode:e.detail}},As=function(e,t){let i=t?.find(p=>p.identifier=="SCORE")?.value,n=parseFloat(i?.toString()),s=t?.find(p=>p.identifier==="completionStatus")?.value,a=n!==void 0&&!isNaN(n)&&n>0,l=n!==void 0&&!isNaN(n)&&n<=0,c=s==="completed";this.computedContext={...this.computedContext,identifier:e,correct:a,incorrect:l,completed:c,variables:t}},d([k(),ee({context:it})],Wt.prototype,"computedContext",2),d([k(),ee({context:ne})],Wt.prototype,"configContext",2),d([k(),ee({context:be})],Wt.prototype,"qtiContext",2),Wt=d([R("qti-item")],Wt);var Vc=C`
3952
3952
  :host {
3953
3953
  display: flex;
3954
3954
  user-select: none;
3955
3955
  position: absolute;
3956
3956
  }
3957
- `;var Jn=class extends E{static{this.styles=Cc}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-hotspot",{bubbles:!0,composed:!0,cancelable:!1}))}render(){return x` <slot name="drags"></slot> `}};customElements.define("qti-associable-hotspot",Jn);var Sc=C`
3957
+ `;var to=class extends E{static{this.styles=Vc}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-hotspot",{bubbles:!0,composed:!0,cancelable:!1}))}render(){return x` <slot name="drags"></slot> `}};customElements.define("qti-associable-hotspot",to);var Dc=C`
3958
3958
  :host {
3959
3959
  display: flex;
3960
3960
  user-select: none;
3961
3961
  }
3962
- `;var Vi=class extends E{constructor(){super(...arguments);this.tabindex=0}static{this.styles=Sc}render(){return x` <slot name="drags"></slot>`}};d([g({type:Number,reflect:!0})],Vi.prototype,"tabindex",2);customElements.define("qti-gap",Vi);var Ac=C`
3962
+ `;var Oi=class extends E{constructor(){super(...arguments);this.tabindex=0}static{this.styles=Dc}render(){return x` <slot name="drags"></slot>`}};d([g({type:Number,reflect:!0})],Oi.prototype,"tabindex",2);customElements.define("qti-gap",Oi);var Nc=C`
3963
3963
  :host {
3964
3964
  display: flex;
3965
3965
  user-select: none;
3966
3966
  }
3967
- `;var Di=class extends E{constructor(){super(...arguments);this.tabindex=0}static{this.styles=Ac}connectedCallback(){this.setAttribute("slot","drags")}};d([g({type:Number,reflect:!0})],Di.prototype,"tabindex",2);customElements.define("qti-gap-img",Di);var Tc={toAttribute:s=>s?"true":"false",fromAttribute:s=>s==="true"};function xe(s,r){class e extends s{constructor(...n){super(...n);this.identifier="";this.tabIndex=0;this.disabled=!1;this.readonly=!1;this.internals=this.attachInternals()}handleDisabledChange(n,o){this.tabIndex=o?-1:0,o&&this.blur()}connectedCallback(){super.connectedCallback(),this.internals.ariaChecked="false",this.disabled&&(this.tabIndex=-1),this.addEventListener("keyup",this._onKeyUp),this.addEventListener("click",this._onClick),this.dispatchEvent(new CustomEvent(`register-${r}`,{bubbles:!0,composed:!0}))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keyup",this._onKeyUp),this.removeEventListener("click",this._onClick),this.dispatchEvent(new CustomEvent(`unregister-${r}`,{bubbles:!0,composed:!0}))}_onKeyUp(n){n.altKey||(n.code==="Space"||n.code==="Enter")&&(n.preventDefault(),this._activate())}_onClick(){this.disabled||this.readonly||(this.focus(),this._activate())}_activate(){this.disabled||this.readonly||this.dispatchEvent(new CustomEvent(`activate-${r}`,{bubbles:!0,composed:!0,detail:{identifier:this.identifier}}))}render(){return x`<slot></slot>`}}return d([g({type:String})],e.prototype,"identifier",2),d([g({type:Number,reflect:!0,attribute:"tabindex"})],e.prototype,"tabIndex",2),d([g({type:Boolean,reflect:!0,attribute:"aria-disabled",converter:Tc})],e.prototype,"disabled",2),d([g({type:Boolean,reflect:!0,attribute:"aria-readonly",converter:Tc})],e.prototype,"readonly",2),d([B("disabled",{waitUntilFirstUpdate:!0})],e.prototype,"handleDisabledChange",1),e}var Ic=C`
3967
+ `;var Hi=class extends E{constructor(){super(...arguments);this.tabindex=0}static{this.styles=Nc}connectedCallback(){this.setAttribute("slot","drags")}};d([g({type:Number,reflect:!0})],Hi.prototype,"tabindex",2);customElements.define("qti-gap-img",Hi);var Oc={toAttribute:o=>o?"true":"false",fromAttribute:o=>o==="true"};function qe(o,r){class e extends o{constructor(...n){super(...n);this.identifier="";this.tabIndex=0;this.disabled=!1;this.readonly=!1;this.internals=this.attachInternals()}handleDisabledChange(n,s){this.tabIndex=s?-1:0,s&&this.blur()}connectedCallback(){super.connectedCallback(),this.internals.ariaChecked="false",this.disabled&&(this.tabIndex=-1),this.addEventListener("keyup",this._onKeyUp),this.addEventListener("click",this._onClick),this.dispatchEvent(new CustomEvent(`register-${r}`,{bubbles:!0,composed:!0}))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keyup",this._onKeyUp),this.removeEventListener("click",this._onClick),this.dispatchEvent(new CustomEvent(`unregister-${r}`,{bubbles:!0,composed:!0}))}_onKeyUp(n){n.altKey||(n.code==="Space"||n.code==="Enter")&&(n.preventDefault(),this._activate())}_onClick(){this.disabled||this.readonly||(this.focus(),this._activate())}_activate(){this.disabled||this.readonly||this.dispatchEvent(new CustomEvent(`activate-${r}`,{bubbles:!0,composed:!0,detail:{identifier:this.identifier}}))}render(){return x`<slot></slot>`}}return d([g({type:String})],e.prototype,"identifier",2),d([g({type:Number,reflect:!0,attribute:"tabindex"})],e.prototype,"tabIndex",2),d([g({type:Boolean,reflect:!0,attribute:"aria-disabled",converter:Oc})],e.prototype,"disabled",2),d([g({type:Boolean,reflect:!0,attribute:"aria-readonly",converter:Oc})],e.prototype,"readonly",2),d([B("disabled",{waitUntilFirstUpdate:!0})],e.prototype,"handleDisabledChange",1),e}var Hc=C`
3968
3968
  :host {
3969
3969
  display: inline-flex;
3970
3970
  user-select: none;
3971
3971
  }
3972
- `;var Ni=class extends xe(E,"qti-gap-text"){constructor(){super(...arguments);this.tabindex=0}static{this.styles=Ic}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","drags")}render(){return x`<slot></slot>`}};d([g({type:Number,reflect:!0})],Ni.prototype,"tabindex",2);customElements.define("qti-gap-text",Ni);var Rc=C`
3972
+ `;var Fi=class extends qe(E,"qti-gap-text"){constructor(){super(...arguments);this.tabindex=0}static{this.styles=Hc}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","drags")}render(){return x`<slot></slot>`}};d([g({type:Number,reflect:!0})],Fi.prototype,"tabindex",2);customElements.define("qti-gap-text",Fi);var Fc=C`
3973
3973
  :host {
3974
3974
  display: flex;
3975
3975
  user-select: none;
3976
3976
  position: absolute;
3977
3977
  }
3978
- `;var Ar=class extends xe(E,"qti-hotspot-choice"){static{this.styles=Rc}};d([g({attribute:"aria-ordervalue",type:Number,reflect:!0})],Ar.prototype,"order",2),d([g({attribute:"aria-ordercorrectvalue",type:Number,reflect:!0})],Ar.prototype,"orderCorrect",2);customElements.define("qti-hotspot-choice",Ar);var kc=C`
3978
+ `;var Tr=class extends qe(E,"qti-hotspot-choice"){static{this.styles=Fc}};d([g({attribute:"aria-ordervalue",type:Number,reflect:!0})],Tr.prototype,"order",2),d([g({attribute:"aria-ordercorrectvalue",type:Number,reflect:!0})],Tr.prototype,"orderCorrect",2);customElements.define("qti-hotspot-choice",Tr);var Uc=C`
3979
3979
  :host {
3980
3980
  display: flex;
3981
3981
  user-select: none;
3982
3982
  }
3983
- `;var Kn=class extends xe(E,"qti-hottext"){static{this.styles=kc}render(){return x`<div part="ch"><div part="cha"></div></div>
3984
- <slot></slot> `}};customElements.define("qti-hottext",Kn);var bp=C`
3983
+ `;var ro=class extends qe(E,"qti-hottext"){static{this.styles=Uc}render(){return x`<div part="ch"><div part="cha"></div></div>
3984
+ <slot></slot> `}};customElements.define("qti-hottext",ro);var Dp=C`
3985
3985
  :host {
3986
3986
  display: block;
3987
3987
  box-sizing: border-box;
@@ -3990,11 +3990,11 @@ div.full-correct-response-inline {
3990
3990
  slot {
3991
3991
  display: inline;
3992
3992
  }
3993
- `,Mc=bp;var Oi=class extends xe(E,"qti-inline-choice"){static{this.styles=Mc}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this.#e),this.dispatchEvent(new CustomEvent("qti-inline-choice-register",{bubbles:!0,composed:!0,cancelable:!1}))}disconnectedCallback(){this.removeEventListener("click",this.#e)}render(){return x` <slot></slot> `}#e(){this.dispatchEvent(new CustomEvent("qti-inline-choice-select",{bubbles:!0,cancelable:!1,composed:!0,detail:{identifier:this.identifier}}))}};d([g({type:String})],Oi.prototype,"identifier",2);customElements.define("qti-inline-choice",Oi);var _c=C`
3993
+ `,Bc=Dp;var Ui=class extends qe(E,"qti-inline-choice"){static{this.styles=Bc}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this.#e),this.dispatchEvent(new CustomEvent("qti-inline-choice-register",{bubbles:!0,composed:!0,cancelable:!1}))}disconnectedCallback(){this.removeEventListener("click",this.#e)}render(){return x` <slot></slot> `}#e(){this.dispatchEvent(new CustomEvent("qti-inline-choice-select",{bubbles:!0,cancelable:!1,composed:!0,detail:{identifier:this.identifier}}))}};d([g({type:String})],Ui.prototype,"identifier",2);customElements.define("qti-inline-choice",Ui);var zc=C`
3994
3994
  :host {
3995
3995
  display: block;
3996
3996
  }
3997
- `;var Zn=class extends E{static{this.styles=_c}render(){return x`<slot></slot>`}connectedCallback(){this.parentElement.tagName.endsWith("INTERACTION")&&this.setAttribute("slot","prompt")}};customElements.define("qti-prompt",Zn);var Lc=C`
3997
+ `;var io=class extends E{static{this.styles=zc}render(){return x`<slot></slot>`}connectedCallback(){this.parentElement.tagName.endsWith("INTERACTION")&&this.setAttribute("slot","prompt")}};customElements.define("qti-prompt",io);var jc=C`
3998
3998
  :host {
3999
3999
  display: flex;
4000
4000
  user-select: none;
@@ -4006,10 +4006,10 @@ div.full-correct-response-inline {
4006
4006
  slot[name='qti-simple-associable-choice'] {
4007
4007
  width: auto;
4008
4008
  }
4009
- `;var jt=class extends xe(E,"qti-simple-associable-choice"){constructor(){super(...arguments);this.matchMin=0;this.matchMax=1;this.fixed=!1}static{this.styles=Lc}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-simple-associable-choice"),this.setAttribute("part","qti-simple-associable-choice")}render(){return x`
4009
+ `;var Gt=class extends qe(E,"qti-simple-associable-choice"){constructor(){super(...arguments);this.matchMin=0;this.matchMax=1;this.fixed=!1}static{this.styles=jc}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-simple-associable-choice"),this.setAttribute("part","qti-simple-associable-choice")}render(){return x`
4010
4010
  <slot part="slot"></slot>
4011
4011
  <slot part="dropslot" name="qti-simple-associable-choice"></slot>
4012
- `}};d([g({type:Number,attribute:"match-min"})],jt.prototype,"matchMin",2),d([g({type:Number,attribute:"match-max"})],jt.prototype,"matchMax",2),d([g({type:String,attribute:"fixed",converter:{fromAttribute:e=>e==="true",toAttribute:e=>String(e)}})],jt.prototype,"fixed",2);customElements.define("qti-simple-associable-choice",jt);var $c=C`
4012
+ `}};d([g({type:Number,attribute:"match-min"})],Gt.prototype,"matchMin",2),d([g({type:Number,attribute:"match-max"})],Gt.prototype,"matchMax",2),d([g({type:String,attribute:"fixed",converter:{fromAttribute:e=>e==="true",toAttribute:e=>String(e)}})],Gt.prototype,"fixed",2);customElements.define("qti-simple-associable-choice",Gt);var Wc=C`
4013
4013
  :host {
4014
4014
  display: flex;
4015
4015
  align-items: center;
@@ -4026,11 +4026,11 @@ div.full-correct-response-inline {
4026
4026
  align-items: center;
4027
4027
  justify-content: center;
4028
4028
  }
4029
- `;var mt=class extends xe(E,"qti-simple-choice"){constructor(){super(...arguments);this.templateIdentifier=null;this.showHide="show";this.fixed=!1}static{this.styles=$c}get checked(){return this.internals.states.has("--checked")}render(){return x`<div part="ch">
4029
+ `;var ht=class extends qe(E,"qti-simple-choice"){constructor(){super(...arguments);this.templateIdentifier=null;this.showHide="show";this.fixed=!1}static{this.styles=Wc}get checked(){return this.internals.states.has("--checked")}render(){return x`<div part="ch">
4030
4030
  <div part="cha"></div>
4031
4031
  </div>
4032
4032
  ${this.marker?x`<div id="label">${this.marker}</div>`:O}
4033
- <slot part="slot"></slot>`}};d([g({type:String,attribute:"template-identifier"})],mt.prototype,"templateIdentifier",2),d([g({type:String,attribute:"show-hide"})],mt.prototype,"showHide",2),d([g({type:Boolean,converter:{fromAttribute:e=>e==="true",toAttribute:e=>String(e)}})],mt.prototype,"fixed",2),d([g({type:String,attribute:!1})],mt.prototype,"marker",2);customElements.define("qti-simple-choice",mt);var{AbortController:Oe,AbortSignal:ys,WeakMap:vp,WeakRef:yp,Window:Pc,reportError:eo=console.log}=globalThis,ht=s=>s&&s.defaultView!==null&&s.defaultView.document===s&&(s.defaultView.top===s.defaultView||ht(s.defaultView.parent.document)),Wt=()=>!!Pc&&globalThis instanceof Pc,xs=Symbol("unset"),[Vc,xp]=(()=>{function s(w,f,h=!0){Object.defineProperty(w,f,{...Object.getOwnPropertyDescriptor(w,f),enumerable:h})}let r="try"in Promise?Promise.try.bind(Promise):(w,...f)=>new Promise(h=>h(w(...f))),e="withResolvers"in Promise?Promise.withResolvers.bind(Promise):()=>{let w,f;return{promise:new Promise((v,q)=>(w=v,f=q)),resolve:w,reject:f}};function t(w,f){let h=f.call(w);if(h===null||typeof h!="object")throw new TypeError("Iterator is not an object");return h}let i=new vp,n={next(...w){let f=this,h=i.get(f);if(!h?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.next called on invalid object");let{syncIteratorRecord:v}=h;return r(()=>v.next(...w))},return(...w){let f=this,h=i.get(f);if(!h?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.return called on invalid object");let{syncIteratorRecord:v}=h;return r(()=>v.return?v.return(...w):{value:void 0,done:!0})},throw(...w){let f=this,h=i.get(f);if(!h?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.throw called on invalid object");let{syncIteratorRecord:v}=h;return r(()=>{if(!v.throw)throw v.return(),new TypeError("no throw method");return v.throw(...w)})}};function o(w){let f=Object.create(n);return i.set(f,{syncIteratorRecord:w}),f}function a(w,f){let h;if(f){if(h=w[Symbol.asyncIterator],h==null){if(h=w[Symbol.iterator],h==null)throw new TypeError("Object is not async iterable");let v=t(w,h);return o(v)}}else h=w[Symbol.iterator];if(h==null)throw new TypeError("Object is not iterable");return t(w,h)}let l="any"in ys?ys.any.bind(ys):w=>{let f=new Oe;for(let h of w)if(h.aborted)return f.abort(h.reason),f.signal;for(let h of w)h.addEventListener("abort",()=>{f.abort(h.reason)},{signal:f.signal});return f.signal},c=w=>l(w.filter(Boolean));class p{constructor({next:f,error:h,complete:v}={}){i.set(this,{next:f,error:h,complete:v})}next(f){let{next:h}=i.get(this)||{};h&&h(f)}error(f){let{error:h}=i.get(this)||{};h?h(f):eo(f)}complete(){let{complete:f}=i.get(this)||{};f&&f()}}function u(w,f){let h=i.get(w);if(h?.active){h.active=!1,h.subscriptionController.abort(f);for(let v of h.teardowns.reverse()){if(Wt()&&!ht(document))return;try{v()}catch(q){eo(q)}}}}function m(w,f,h={}){if(Wt()&&!ht(document))return;let v;typeof f=="function"?v=new p({next:f}):f&&!(f instanceof p)?v=new p(f):v=f||new p;let q=i.get(w),A=q.weakSubscriber?.deref();if(A?.active){let T=A,_=i.get(T);_.observers.add(v),h.signal&&(h.signal.aborted?_.observers.delete(v):h.signal.addEventListener("abort",()=>{let N=i.get(T);N?.active&&(N.observers.delete(v),N.observers.size==0&&u(T,h.signal.reason))}));return}let S=new y(v);if(q.weakSubscriber=new yp(S),"signal"in h&&(h.signal.aborted?u(S,h.signal.reason):h.signal.addEventListener("abort",()=>{let T=i.get(S);T?.active&&(T.observers.delete(v),T.observers.size==0&&u(S,h.signal.reason))})),q.subscribeCallback)try{q.subscribeCallback(S)}catch(T){S.error(T)}}class y{get[Symbol.toStringTag](){return"Subscriber"}constructor(f=null){if(!(f instanceof p))throw new TypeError("Illegal constructor");i.set(this,{active:!0,observers:new Set([f]),teardowns:[],subscriptionController:new Oe})}next(f){if(!(this instanceof y))throw new TypeError("illegal invocation");if(!arguments.length)throw new TypeError("too few arguments");let h=i.get(this);if(!h?.active||Wt()&&!ht(document))return;let v=new Set(h.observers);for(let q of v)q.next(f)}error(f){if(!(this instanceof y))throw new TypeError("illegal invocation");if(!arguments.length)throw new TypeError("too few arguments");let h=i.get(this);if(!h?.active){eo(f);return}if(Wt()&&!ht(document))return;u(this,f);let v=new Set(h.observers);for(let q of v)q.error(f)}complete(){if(!(this instanceof y))throw new TypeError("illegal invocation");let f=i.get(this);if(!f?.active||Wt()&&!ht(document))return;u(this);let h=new Set(f.observers);for(let v of h)v.complete()}addTeardown(f){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof f!="function")throw new TypeError("Parameter 1 is not of type 'Function'");if(Wt()&&!ht(document))return;let h=i.get(this);h?.active?h.teardowns.push(f):f()}get active(){if(!(this instanceof y))throw new TypeError("illegal invocation");return!!i.get(this)?.active}get signal(){if(!(this instanceof y))throw new TypeError("illegal invocation");if(!i.has(this)){let f=new Oe;return f.abort(),f.signal}return i.get(this).subscriptionController.signal}}s(y.prototype,"next"),s(y.prototype,"error"),s(y.prototype,"complete"),s(y.prototype,"addTeardown"),s(y.prototype,"active"),s(y.prototype,"signal");class b{get[Symbol.toStringTag](){return"Observable"}constructor(f){if(!f)throw new TypeError("1 argument required but 0 present");i.set(this,{weakSubscriber:null,subscribeCallback:f})}static from(f){if(f===null||typeof f!="object")throw new TypeError("Observable.from only accepts objects");if(f instanceof b)return f;if(typeof(Symbol.asyncIterator in f&&f[Symbol.asyncIterator])=="function"){let A=function(S,T){if(S.signal.aborted)return;let _;try{let N=T.next();_=Promise.resolve(N)}catch(N){_=Promise.reject(N)}_.then(N=>{if(N===null||typeof N!="object"){S.error(new TypeError("Not an IteratorResult."));return}try{({done:q}=N)}catch(z){S.error(z);return}if(q){S.complete();return}let H;try{H=N.value}catch(z){S.error(z);return}S.next(H),A(S,T)},N=>{S.error(N)})},q=!1;return new b(S=>{if(S.signal.aborted)return;let T;try{T=a(f,!0)}catch(N){S.error(N);return}let _=T;S.signal.aborted||(S.signal.addEventListener("abort",()=>{if(typeof _.return!="function"||q)return;r(()=>_.return(S.signal.reason)).then(H=>{if(H===null||typeof H!="object")throw new TypeError("Iterator .return() must return an Object")})}),A(S,_))})}if(typeof(Symbol.iterator in f&&f[Symbol.iterator])=="function")return new b(q=>{if(q.signal.aborted)return;let A;try{A=a(f,!1)}catch(_){q.error(_);return}let S=!1,T=A;if(!q.signal.aborted)for(q.signal.addEventListener("abort",()=>{if(typeof T.return!="function"||S)return;let _=T.return();if(_===null||typeof _!="object")throw new TypeError("Iterator .return() must return an Object")});;)try{let _=T.next();if({done:S}=_,S){q.complete();return}if(q.next(_.value),q.signal.aborted)break}catch(_){q.error(_);break}});if(f instanceof Promise||typeof f.then=="function")return new b(q=>{f.then(A=>{q.next(A),q.complete()},A=>{q.error(A)})});throw new TypeError("Could not convert value to Observable")}subscribe(f=null,h={}){if(!(this instanceof b))throw new TypeError("illegal invocation");m(this,f,h)}takeUntil(f){if(!(this instanceof b))throw new TypeError("illegal invocation");let h=this,v=b.from(f);return new b(q=>{let A=new p({next(){q.complete()},error(){q.complete()}}),S={signal:q.signal};if(m(v,A,S),!q.active)return;let T=new p({next(_){q.next(_)},error(_){q.error(_)},complete(){q.complete()}});m(h,T,S)})}map(f){if(!(this instanceof b))throw new TypeError("illegal invocation");if(typeof f!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let h=this;return new b(v=>{let q=0,A=new p({next(T){let _;try{_=f(T,q)}catch(N){v.error(N);return}q+=1,v.next(_)},error(T){v.error(T)},complete(){v.complete()}}),S={signal:v.signal};m(h,A,S)})}inspect(f={}){let h=null,v=null,q=null,A=null,S=null;typeof f=="function"?v=f:f&&typeof f=="object"&&("subscribe"in f&&(h=f.subscribe),"next"in f&&(v=f.next),"error"in f&&(q=f.error),"complete"in f&&(A=f.complete),"abort"in f&&(S=f.abort));let T=this;return new b(_=>{if(h!==null)try{h()}catch(F){_.error(F);return}let N=()=>{try{S!==null&&S(_.signal.reason)}catch(F){eo(F)}};_.signal.addEventListener("abort",N,{once:!0});let H=new p({next(F){if(v!==null)try{v(F)}catch(le){_.signal.removeEventListener("abort",N),_.error(le);return}_.next(F)},error(F){if(_.signal.removeEventListener("abort",N),q!==null)try{q(F)}catch(le){_.error(le);return}_.error(F)},complete(){if(_.signal.removeEventListener("abort",N),A!==null)try{A()}catch(F){_.error(F);return}_.complete()}}),z={signal:_.signal};m(T,H,z)})}filter(f){if(!(this instanceof b))throw new TypeError("illegal invocation");if(typeof f!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let h=this;return new b(v=>{let q=0,A=new p({next(T){let _=!1;try{_=f(T,q)}catch(N){v.error(N);return}q+=1,_&&v.next(T)},error(T){v.error(T)},complete(){v.complete()}}),S={signal:v.signal};m(h,A,S)})}take(f){if(!(this instanceof b))throw new TypeError("illegal invocation");let h=this;return new b(v=>{let q=f;if(q==0)return v.complete();let A=new p({next(T){v.next(T),q-=1,q==0&&v.complete()},error(T){v.error(T)},complete(){v.complete()}}),S={signal:v.signal};m(h,A,S)})}drop(f){if(!(this instanceof b))throw new TypeError("illegal invocation");let h=this;return new b(v=>{let q=f,A=new p({next(T){if(q>0)return q-=1;q==0&&v.next(T)},error(T){v.error(T)},complete(){v.complete()}}),S={signal:v.signal};m(h,A,S)})}flatMap(f){if(!(this instanceof b))throw new TypeError("illegal invocation");if(typeof f!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let h=this;return new b(v=>{let q=0,A=!1,S=[];function T(z){let F;try{F=f(z,q)}catch(He){return v.error(He)}q+=1;let le;try{le=b.from(F)}catch(He){return v.error(He)}let Mo=new p({next(He){v.next(He)},error(He){v.error(He)},complete(){if(S.length){let He=S.shift();T(He)}else _=!1,A&&v.complete()}}),Re={signal:v.signal};m(le,Mo,Re)}let _=!1,N=new p({next(z){_?S.push(z):(_=!0,T(z))},error(z){v.error(z)},complete(){A=!0,!_&&!S.length&&v.complete()}}),H={signal:v.signal};m(h,N,H)})}switchMap(f){if(!(this instanceof b))throw new TypeError("illegal invocation");if(typeof f!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let h=this;return new b(v=>{let q=0,A=!1,S=null;function T(H){let z;try{z=f(H,q)}catch(Re){return v.error(Re)}q+=1;let F;try{F=b.from(z)}catch(Re){return v.error(Re)}let le=new p({next(Re){v.next(Re)},error(Re){v.error(Re)},complete(Re){A?v.complete():S=null}}),Mo={signal:c([S.signal,v.signal])};m(F,le,Mo)}let _=new p({next(H){S&&S.abort(),S=new Oe,T(H)},error(H){v.error(H)},complete(){A=!0,S||v.complete()}}),N={signal:v.signal};m(h,_,N)})}catch(f){if(!(this instanceof b))throw new TypeError("illegal invocation");if(typeof f!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let h=this;return new b(q=>{let A=new p({next(T){q.next(T)},error(T){let _;try{_=f(T)}catch(F){q.error(F);return}let N;try{N=b.from(_)}catch(F){q.error(F);return}let H=new p({next(F){q.next(F)},error(F){q.error(F)},complete(){q.complete()}}),z={signal:q.signal};m(N,H,z)},complete(){q.complete()}}),S={signal:q.signal};m(h,A,S)})}finally(f){if(!(this instanceof b))throw new TypeError("illegal invocation");if(typeof f!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let h=this;return new b(v=>{v.addTeardown(f);let q=new p({next(S){v.next(S)},error(S){v.error(S)},complete(){v.complete()}}),A={signal:v.signal};m(h,q,A)})}toArray(f={}){if(!(this instanceof b))throw new TypeError("illegal invocation");let{promise:h,resolve:v,reject:q}=e();if(f.signal){if(f.signal.aborted)return Promise.reject(f.signal.reason);f.signal.addEventListener("abort",()=>{q(f.signal.reason)})}let A=[],S=new p({next(T){A.push(T)},error(T){q(T)},complete(){v(A)}});return m(this,S,f),h}forEach(f,h={}){if(!(this instanceof b))throw new TypeError("illegal invocation");if(typeof f!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:v,resolve:q,reject:A}=e(),S=new Oe,T={signal:c([S.signal,h.signal])};if(T.signal.aborted)return A(T.signal.reason),v;T.signal.addEventListener("abort",()=>{A(T.signal.reason)});let _=0,N=new p({next(H){try{f(H,_)}catch(z){A(z),S.abort(z)}_+=1},error(H){A(H)},complete(){q()}});return m(this,N,T),v}every(f,h={}){if(!(this instanceof b))throw new TypeError("illegal invocation");if(typeof f!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:v,resolve:q,reject:A}=e(),S=new Oe,T={signal:c([S.signal,h.signal])};if(T.signal.aborted)return A(T.signal.reason),v;T.signal.addEventListener("abort",()=>{A(T.signal.reason)});let _=0,N=new p({next(H){let z=!1;try{z=f(H,_)}catch(F){A(F),S.abort(F)}_+=1,z||(q(!1),S.abort())},error(H){A(H)},complete(){q(!0)}});return m(this,N,T),v}first(f={}){if(!(this instanceof b))throw new TypeError("illegal invocation");let{promise:h,resolve:v,reject:q}=e(),A=new Oe,S={signal:c([A.signal,f.signal])};if(S.signal.aborted)return q(S.signal.reason),h;S.signal.addEventListener("abort",()=>{q(S.signal.reason)});let T=new p({next(_){v(_),A.abort()},error(_){q(_)},complete(){q(new RangeError("No values in Observable"))}});return m(this,T,S),h}last(f={}){if(!(this instanceof b))throw new TypeError("illegal invocation");let{promise:h,resolve:v,reject:q}=e();if(f.signal){if(f.signal.aborted)return q(f.signal.reason),h;f.signal.addEventListener("abort",()=>{q(f.signal.reason)})}let A=null,S=!1,T=new p({next(_){S=!0,A=_},error(_){q(_)},complete(){S?v(A):q(new RangeError("No values in Observable"))}});return m(this,T,f),h}find(f,h={}){if(!(this instanceof b))throw new TypeError("illegal invocation");if(typeof f!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:v,resolve:q,reject:A}=e(),S=new Oe,T={signal:c([S.signal,h.signal])};if(T.signal.aborted)return A(T.signal.reason),v;T.signal.addEventListener("abort",()=>{A(T.signal.reason)});let _=0,N=new p({next(H){let z=!1;try{z=f(H,_)}catch(F){A(F),S.abort(F)}_+=1,z&&(q(H),S.abort())},error(H){A(H)},complete(){q()}});return m(this,N,T),v}some(f,h={}){if(!(this instanceof b))throw new TypeError("illegal invocation");if(typeof f!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:v,resolve:q,reject:A}=e(),S=new Oe,T={signal:c([S.signal,h.signal])};if(T.signal.aborted)return A(T.signal.reason),v;T.signal.addEventListener("abort",()=>{A(T.signal.reason)});let _=0,N=new p({next(H){let z=!1;try{z=f(H,_)}catch(F){A(F),S.abort(F)}_+=1,z&&(q(!0),S.abort())},error(H){A(H)},complete(){q(!1)}});return m(this,N,T),v}reduce(f,h,v={}){if(!(this instanceof b))throw new TypeError("illegal invocation");if(typeof f!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:q,resolve:A,reject:S}=e(),T=new Oe,_={signal:c([T.signal,v.signal])};if(_.signal.aborted)return S(_.signal.reason),q;_.signal.addEventListener("abort",()=>{S(_.signal.reason)},{once:!0});let N=0,H=arguments.length>1?h:xs,z=new p({next(F){if(H===xs){H=F,N++;return}try{let le=f(H,F,N);N++,H=le}catch(le){S(le),T.abort(le);return}},error(F){S(F)},complete(){H!==xs?A(H):S(new TypeError("no initial value provided and no values emitted"))}});return m(this,z,_),q}}return s(b.prototype,"subscribe"),[b,y]})();function Dc(){return typeof globalThis.Observable=="function"}function Nc(){Object.defineProperties(globalThis,{Observable:{value:Vc,configurable:!0,writable:!0},Subscriber:{value:xp,configurable:!0,writable:!0}}),EventTarget.prototype.when=function(s,r={}){if(Wt()&&!ht(document))return;let e=this;return new Vc(t=>{if(!e||t.signal.aborted)return;let i=n=>{t.next(n)};e.addEventListener(s,i,{capture:r.capture||!1,passive:r.passive,once:!1,signal:t.signal})})}}function qs(s,r,e){let t=s.filter(i=>!i.hasAttribute("disabled"));for(let i of t){let n=i.getBoundingClientRect();if(r>=n.left&&r<=n.right&&e>=n.top&&e<=n.bottom)return i}return null}function Oc(s,r,e,t){if(!t)return null;let i=s.filter(o=>!o.hasAttribute("disabled")),n=t.getBoundingClientRect();for(let o of i){let a=o.getBoundingClientRect();if(!(n.right<a.left||n.left>a.right||n.bottom<a.top||n.top>a.bottom))return o}return null}function Hc(s,r,e,t){let i=s.filter(c=>!c.hasAttribute("disabled"));if(i.length===0)return null;let n,o;if(t){let c=t.getBoundingClientRect();n=c.left+c.width/2,o=c.top+c.height/2}else n=r,o=e;let a=null,l=1/0;for(let c of i){let p=c.getBoundingClientRect(),u=p.left+p.width/2,m=p.top+p.height/2,y=Math.sqrt(Math.pow(n-u,2)+Math.pow(o-m,2));y<l&&(l=y,a=c)}return a}function Fc(s,r,e,t){let i=s.filter(l=>!l.hasAttribute("disabled"));if(i.length===0)return null;let n;if(t){let l=t.getBoundingClientRect();n=[{x:l.left,y:l.top},{x:l.right,y:l.top},{x:l.left,y:l.bottom},{x:l.right,y:l.bottom}]}else n=[{x:r,y:e},{x:r,y:e},{x:r,y:e},{x:r,y:e}];let o=null,a=1/0;for(let l of i){let c=l.getBoundingClientRect(),p=[{x:c.left,y:c.top},{x:c.right,y:c.top},{x:c.left,y:c.bottom},{x:c.right,y:c.bottom}],u=0,m=0;for(let b of n)for(let w of p){let f=Math.sqrt(Math.pow(b.x-w.x,2)+Math.pow(b.y-w.y,2));u+=f,m++}let y=u/m;y<a&&(a=y,o=l)}return o}function qp(s,r,e,t,i){let n=i&&i.length>0?s.filter(h=>i.includes(h)):s.filter(h=>h.tagName==="SLOT"&&h.hasAttribute("part")&&h.getAttribute("part")?.includes("drags")),a=s.filter(h=>!n.includes(h));if(n.length===0&&a.length===0)return null;let l;if(t){let h=t.getBoundingClientRect();l=[{x:h.left,y:h.top},{x:h.right,y:h.top},{x:h.left,y:h.bottom},{x:h.right,y:h.bottom}]}else l=[{x:r,y:e},{x:r,y:e},{x:r,y:e},{x:r,y:e}];let c=h=>{let v=h.getBoundingClientRect(),q=[{x:v.left,y:v.top},{x:v.right,y:v.top},{x:v.left,y:v.bottom},{x:v.right,y:v.bottom}],A=0,S=0;for(let T of l)for(let _ of q){let N=Math.sqrt(Math.pow(T.x-_.x,2)+Math.pow(T.y-_.y,2));A+=N,S++}return A/S},p=null,u=1/0;for(let h of n){let v=c(h);v<u&&(u=v,p=h)}let m=null,y=1/0;for(let h of a){let v=c(h);v<y&&(y=v,m=h)}if(p&&t){let h=t.getBoundingClientRect(),v=p.getBoundingClientRect(),q=h.left+h.width/2,A=h.top+h.height/2;if(q>=v.left&&q<=v.right&&A>=v.top&&A<=v.bottom)return p}let w=t?.getAttribute("data-drag-origin")==="droppable"?.85:1.5;return p&&m?u<=y*w?p:m:p||m}function Uc(s){switch(s){case"pointerWithin":return qs;case"rectangleIntersection":return Oc;case"closestCenter":return Hc;case"closestCorners":return Fc;case"closestCornersWithInventoryPriority":return qp;default:return qs}}function Tr(s,r,e,t,i="pointerWithin",n){return Uc(i)(s,r,e,t,n)}function ft(s,r){let e=s.composedPath?s.composedPath():[s.target];for(let t of e)if(t instanceof HTMLElement&&t.tagName!=="SLOT"){if(t.matches(r)||t.hasAttribute("qti-draggable"))return t;let i=t.closest(r)||t.closest('[qti-draggable="true"]');if(i)return i}return null}function to(s,r){let e=[];return s.forEach(t=>{let i=[];t.tagName.toLowerCase()==="slot"?i=t.assignedElements({flatten:!0}).filter(a=>a.getAttribute("identifier")===r):i=Array.from(t.querySelectorAll(`[identifier="${r}"]`)),e.push(...i)}),e}function Bc(s,r){let e=s.find(i=>i.getAttribute("identifier")===r);if(!e)return 1;let t=e.getAttribute("match-max");return t?parseInt(t,10)||0:1}function zc(s,r){let e=parseInt(s.getAttribute("match-max")||"1",10),t=Number.isNaN(e)?1:e;if(t===0)return!1;let i=s.querySelectorAll(r),n=s.querySelectorAll('[qti-draggable="true"]');return Math.max(i.length,n.length)>=t}function Hi(s,r){return s.reduce((e,t)=>{let i=t.querySelectorAll(r).length,n=t.querySelectorAll('[qti-draggable="true"]').length;return e+Math.max(i,n)},0)}function ro(s,r){return s.map(e=>{let i=Array.from(e.querySelectorAll(r)).map(o=>o.getAttribute("identifier")).filter(o=>!!o),n=e.getAttribute("identifier");return i.map(o=>`${o} ${n}`)}).flat()}function jc(s,r,e,t=typeof window<"u"?window:null){if(!s.length||!r.length||!t)return;let i=0,n=0;s.forEach(c=>{let p=c.getBoundingClientRect();i=Math.max(i,p.height),n=Math.max(n,p.width)});let o=r[0].parentElement,a=r[0].tagName==="QTI-SIMPLE-ASSOCIABLE-CHOICE",l=r[0].tagName==="QTI-GAP";if(a&&o){let c;if(o.clientWidth>0){let p=t.getComputedStyle(o),u=parseFloat(p.paddingLeft),m=parseFloat(p.paddingRight);c=o.clientWidth-u-m}else c=Math.min(t.innerWidth*.8,600);o.style.gridTemplateColumns=`repeat(auto-fit, minmax(calc(min(${c}px, ${n}px + 2 * var(--qti-dropzone-padding, 0.5rem))), 1fr))`}r.forEach(c=>{c.style.minHeight=`${i}px`,(a||l)&&(c.style.minWidth=`${n}px`);let p=c.shadowRoot?.querySelector('slot[part="dropslot"]');p&&(p.style.minHeight=`${i}px`)}),e.forEach(c=>{c.style.minHeight=`${i}px`})}Dc()||Nc();var Wc=new WeakSet;function wp(s){!s||Wc.has(s)||(s.addEventListener("touchmove",()=>{},{capture:!1,passive:!1}),Wc.add(s))}var io=(s,r,e,t='slot[part="drags"]',i="pointerWithin")=>{class n extends s{constructor(){super(...arguments);this.trackedDraggables=[];this.trackedDroppables=[];this.trackedDragContainers=[];this.allDropzones=[];this.collisionDetectionAlgorithm=i;this.dragState={dragging:!1,dragSource:null,dragClone:null,startOffset:{x:0,y:0},currentTarget:null,sourceDroppable:null,inputType:null};this.subscriptions=[];this.dragSubscriptions=[];this.lastPointerDownAt=0;this.lastTouchStartAt=0}connectedCallback(){super.connectedCallback(),wp(this.ownerDocument?.defaultView),this.setupDragDrop()}disconnectedCallback(){super.disconnectedCallback(),this.cleanup()}async setupDragDrop(){await this.updateComplete,this.cacheInteractiveElements(),this.afterCache(),this.setupDragObservables()}afterCache(){}cacheInteractiveElements(){let l=(h,v)=>Array.from(v?.querySelectorAll(h)??[]),c=l(r,this),p=l(r,this.shadowRoot),u=l('[qti-draggable="true"]:not([data-drag-clone])',this),m=l('[qti-draggable="true"]:not([data-drag-clone])',this.shadowRoot);this.trackedDraggables=Array.from(new Set([...c,...p,...u,...m]));let y=l(e,this),b=l(e,this.shadowRoot);this.trackedDroppables=Array.from(new Set([...y,...b]));let w=l(t,this),f=l(t,this.shadowRoot);this.trackedDragContainers=Array.from(new Set([...w,...f])),this.allDropzones=[...this.trackedDroppables,...this.trackedDragContainers],this.trackedDraggables.forEach(h=>{h.style.cursor="grab",h.style.userSelect="none",h.style.touchAction="none",h.style.webkitUserSelect="none",h.style.webkitTouchCallout="none",h.setAttribute("qti-draggable","true"),h.setAttribute("tabindex","0")})}setupDragObservables(){let l=this.shadowRoot;if(!l){console.error("\u274C [Observable DnD] No shadow root found!");return}let c=l.when("pointerdown").filter(b=>{if(!b.isTrusted)return!1;let w=ft(b,r),f=this.disabled||this.readonly,h=w?.hasAttribute("disabled")||w?.getAttribute("aria-disabled")==="true",v=Date.now()-this.lastTouchStartAt<50;return w&&b.isPrimary!==!1&&b.button===0&&!f&&!h&&!v}).subscribe(b=>{this.lastPointerDownAt=Date.now();let w=ft(b,r);if(!w){console.warn("\u26A0\uFE0F [Observable DnD] No draggable target found");return}b.pointerType==="touch"&&(b.preventDefault(),b.stopPropagation());let f=b.isTrusted?b.pointerType==="touch"?100:10:0;if(this.dragState.activationTimeout&&clearTimeout(this.dragState.activationTimeout),f===0){this.dragState.dragging||this.initiateDrag(w,b.clientX,b.clientY,b.pointerType,"pointer",b.pointerId,b.isTrusted);return}let h=()=>{this.dragState.activationTimeout&&(clearTimeout(this.dragState.activationTimeout),this.dragState.activationTimeout=void 0),document.removeEventListener("pointerup",h,!0),document.removeEventListener("pointercancel",h,!0)};document.addEventListener("pointerup",h,{once:!0,capture:!0}),document.addEventListener("pointercancel",h,{once:!0,capture:!0}),this.dragState.activationTimeout=window.setTimeout(()=>{this.dragState.activationTimeout=void 0,document.removeEventListener("pointerup",h,!0),document.removeEventListener("pointercancel",h,!0),this.dragState.dragging||this.initiateDrag(w,b.clientX,b.clientY,b.pointerType,"pointer",b.pointerId,b.isTrusted)},f)}),p=l.when("mousedown").filter(b=>{let w=ft(b,r),f=this.disabled||this.readonly,h=w?.hasAttribute("disabled")||w?.getAttribute("aria-disabled")==="true",v=b.button===0,q=Date.now()-this.lastPointerDownAt<50;return w&&v&&!f&&!h&&!q}).subscribe(b=>{let w=ft(b,r);!w||this.dragState.dragging||(b.preventDefault(),this.initiateDrag(w,b.clientX,b.clientY,"mouse","mouse",void 0,b.isTrusted))}),u=l.when("touchstart").filter(b=>{let w=ft(b,r),f=this.disabled||this.readonly,h=w?.hasAttribute("disabled")||w?.getAttribute("aria-disabled")==="true",v=!!(b.touches?.[0]||b.changedTouches?.[0]),q=Date.now()-this.lastPointerDownAt<50;return w&&v&&!f&&!h&&!q}).subscribe(b=>{let w=ft(b,r),f=b.touches?.[0]||b.changedTouches?.[0];!w||!f||this.dragState.dragging||(this.lastTouchStartAt=Date.now(),b.preventDefault(),b.stopPropagation(),this.initiateDrag(w,f.clientX,f.clientY,"touch","touch",void 0,b.isTrusted))}),m={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null},y=l.when("keydown").subscribe(b=>{let w=this.trackedDraggables.filter(h=>h.style.opacity!=="0"),f=[...this.trackedDroppables,...this.trackedDragContainers];if(m.dragging)switch(b.code){case"ArrowRight":case"ArrowDown":{b.preventDefault();let h=(m.dropIndex+1)%f.length;m={...m,dropIndex:h,dropElement:f[h]};break}case"ArrowLeft":case"ArrowUp":{b.preventDefault();let h=(m.dropIndex-1+f.length)%f.length;m={...m,dropIndex:h,dropElement:f[h]};break}case"Space":case"Enter":case"Tab":{b.preventDefault(),m.dragElement&&m.dropElement&&(this.allowDrop(m.dragElement,m.dropElement)||this.trackedDragContainers.includes(m.dropElement)?this.handleDrop(m.dragElement,m.dropElement):this.handleInvalidDrop(m.dragElement)),this.trackedDraggables.forEach(h=>h.removeAttribute("data-keyboard-dragging")),this.saveResponse(),m={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null};break}case"Escape":{b.preventDefault(),this.trackedDraggables.forEach(h=>h.removeAttribute("data-keyboard-dragging")),m={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null};break}}else{let h=ft(b,r),v=this.disabled||this.readonly,q=h?.hasAttribute("disabled")||h?.getAttribute("aria-disabled")==="true";h&&["Space","Enter"].includes(b.code)&&!v&&!q&&(b.preventDefault(),h.setAttribute("data-keyboard-dragging","true"),m={dragging:!0,dragElement:h,dragIndex:w.indexOf(h),dropIndex:0,dropElement:f[0]})}this.allDropzones.forEach(h=>h.removeAttribute("hover")),m.dragging&&m.dropElement&&(m.dropElement.setAttribute("hover",""),m.dropElement.hasAttribute("tabindex")&&m.dropElement.getAttribute("tabindex")!=="-1"&&m.dropElement.focus())});this.subscriptions.push(c,p,u,y)}initiateDrag(l,c,p,u,m="pointer",y,b){if(this.dragState.dragging){console.warn("\u26A0\uFE0F [Observable DnD] Already dragging, ignoring initiateDrag");return}if(l.hasAttribute("data-drag-clone")){console.warn("\u26A0\uFE0F [Observable DnD] Attempted to drag visual clone, ignoring");return}let w=this.trackedDroppables.some(v=>v.contains(l)),f=this.trackedDroppables.find(v=>v.contains(l))||null,h=l.getBoundingClientRect();this.dragState={dragging:!0,dragSource:l,dragClone:this.createDragClone(l,h),startOffset:{x:c-h.left,y:p-h.top},currentTarget:null,sourceDroppable:f,inputType:u,pointerId:y,startedFromTrustedEvent:b,initialCoordinates:{x:c,y:p}},w?(this.dragState.dragClone?.setAttribute("data-drag-origin","droppable"),l.remove(),this.cacheInteractiveElements(),f&&f.setAttribute("data-drag-source","true")):(this.dragState.dragClone?.setAttribute("data-drag-origin","inventory"),l.style.opacity="0",l.style.pointerEvents="none"),this.updateClonePosition(c,p),this.activateAllDroppables(),this.setupMoveObservables(u,m)}setupMoveObservables(l,c="pointer"){if(l==="touch"){if(c==="pointer")try{let A=this.dragState.dragSource,S=this.dragState.pointerId;A&&S!==void 0&&A.setPointerCapture&&A.setPointerCapture(S)}catch{}let v=A=>{A.cancelable&&(A.preventDefault(),c==="pointer"&&A.stopPropagation())};document.addEventListener("touchmove",v,{passive:!1,capture:!0}),document.addEventListener("touchstart",v,{passive:!1,capture:!0}),document.addEventListener("touchend",v,{passive:!1,capture:!0}),document.addEventListener("gesturestart",v,{passive:!1}),document.addEventListener("gesturechange",v,{passive:!1}),document.addEventListener("gestureend",v,{passive:!1});let q=()=>{if(document.removeEventListener("touchmove",v,{capture:!0}),document.removeEventListener("touchstart",v,{capture:!0}),document.removeEventListener("touchend",v,{capture:!0}),document.removeEventListener("gesturestart",v),document.removeEventListener("gesturechange",v),document.removeEventListener("gestureend",v),c==="pointer")try{let A=this.dragState.dragSource,S=this.dragState.pointerId;A&&S!==void 0&&A.releasePointerCapture&&A.releasePointerCapture(S)}catch{}};this.dragState.touchCleanup=q}let p=c==="mouse"?"mousemove":c==="touch"?"touchmove":"pointermove",u=c==="mouse"?"mouseup":c==="touch"?"touchend":"pointerup",m=v=>{let q=this.dragState.startedFromTrustedEvent;return q===void 0||v.isTrusted===q},y=document.when(p).takeUntil(document.when(u)).subscribe({next:v=>{if(m(v)){if(v.preventDefault(),v.stopPropagation(),c==="touch"){let q=v.touches?.[0]||v.changedTouches?.[0];if(!q)return;this.handleDragMove(q.clientX,q.clientY);return}if(c==="mouse"){let q=v;if(typeof q.buttons=="number"&&(q.buttons&1)!==1)return}this.handleDragMove(v.clientX,v.clientY)}}}),b=document.when(u).subscribe({next:v=>{m(v)&&(v.preventDefault(),v.stopPropagation(),this.handleDragEnd())}}),w=c==="touch"?document.when("touchcancel").subscribe({next:v=>{m(v)&&this.handleDragEnd()}}):c==="mouse"?null:document.when("pointercancel").subscribe({next:v=>{m(v)&&this.handleDragEnd()}}),f=document.when("keydown").filter(v=>v.key==="Escape").subscribe({next:v=>{m(v)&&this.handleDragEnd()}}),h=[y,b,f];w&&h.push(w),this.dragSubscriptions.push(...h)}handleDragMove(l,c){if(!this.dragState.dragging||!this.dragState.dragClone)return;this.updateClonePosition(l,c);let p=Tr(this.allDropzones,l,c,this.dragState.dragClone,this.collisionDetectionAlgorithm,this.trackedDragContainers),u=Date.now(),m=u-(this.dragState.lastTargetChangeTime||0);p!==this.dragState.currentTarget&&(p===null||m>=50)&&(this.allDropzones.forEach(b=>b.removeAttribute("hover")),p&&p.setAttribute("hover",""),this.dragState.currentTarget=p,this.dragState.lastTargetChangeTime=u)}handleDragEnd(){if(!this.dragState.dragging)return;let{dragSource:l,dragClone:c,currentTarget:p,sourceDroppable:u}=this.dragState,m=p;if(!m&&c){let f=c.getBoundingClientRect(),h=this.dragState.initialCoordinates?.x??f.left+f.width/2,v=this.dragState.initialCoordinates?.y??f.top+f.height/2;m=Tr(this.allDropzones,h,v,c,this.collisionDetectionAlgorithm,this.trackedDragContainers)}let y=m?.hasAttribute("disabled")&&m.hasAttribute("data-drag-source");!!l&&!!m&&this.allowDrop(l,m)&&(!m.hasAttribute("disabled")||y)&&l&&m?this.handleDrop(l,m):this.handleInvalidDrop(l),c&&c.remove(),this.dragState.touchCleanup&&this.dragState.touchCleanup(),this.resetDragState(),this.deactivateAllDroppables(),this.saveResponse(),u&&u.removeAttribute("data-drag-source"),this.cacheInteractiveElements();let w=this.checkAllMaxAssociations;typeof w=="function"&&w.call(this)}allowDrop(l,c){return this.trackedDroppables.includes(c)||this.trackedDragContainers.includes(c)}handleInvalidDrop(l){l&&(l.style.opacity="1.0",l.style.pointerEvents="auto")}createDragClone(l,c){let p=l.cloneNode(!0),u=window.getComputedStyle(l);for(let m=0;m<u.length;m++){let y=u[m];p.style.setProperty(y,u.getPropertyValue(y))}return p.style.position="fixed",p.style.width=`${c.width}px`,p.style.height=`${c.height}px`,p.style.zIndex="9999",p.style.pointerEvents="none",p.style.touchAction="none",p.style.userSelect="none",p.style.opacity="0.8",p.removeAttribute("qti-draggable"),p.removeAttribute("tabindex"),p.setAttribute("data-drag-clone","true"),document.body.appendChild(p),p}updateClonePosition(l,c){if(!this.dragState.dragClone)return;let{startOffset:p}=this.dragState,u=l-p.x,m=c-p.y;this.dragState.dragClone.style.left=`${u}px`,this.dragState.dragClone.style.top=`${m}px`}activateAllDroppables(){this.setInternalsState("--dragzone-enabled",!0),this.setInternalsState("--dragzone-active",!0),this.allDropzones.forEach(l=>{l.setAttribute("enabled",""),l.setAttribute("active","")})}deactivateAllDroppables(){this.setInternalsState("--dragzone-enabled",!1),this.setInternalsState("--dragzone-active",!1),this.allDropzones.forEach(l=>{l.removeAttribute("enabled"),l.removeAttribute("active"),l.removeAttribute("hover")})}resetDragState(){if(this.dragState.activationTimeout&&clearTimeout(this.dragState.activationTimeout),this.dragState.touchCleanup)try{this.dragState.touchCleanup()}catch(l){console.warn("\u26A0\uFE0F [Observable DnD] Error during touch cleanup:",l)}this.dragSubscriptions.forEach(l=>{try{l&&typeof l.unsubscribe=="function"&&l.unsubscribe()}catch(c){console.warn("\u26A0\uFE0F [Observable DnD] Error unsubscribing:",c)}}),this.dragSubscriptions=[],this.dragState={dragging:!1,dragSource:null,dragClone:null,startOffset:{x:0,y:0},currentTarget:null,sourceDroppable:null,inputType:null,pointerId:void 0,startedFromTrustedEvent:void 0,touchCleanup:void 0}}setInternalsState(l,c){let p=this._internals;p?.states&&(c?p.states.add(l):p.states.delete(l))}cleanup(){this.subscriptions.forEach(l=>{try{l.unsubscribe()}catch{}}),this.subscriptions=[],this.dragState.dragClone&&this.dragState.dragClone.remove(),this.resetDragState()}}return n};var Gc={duration:250,easing:"ease",fill:"both"};function ws(s){let r=s.getBoundingClientRect();return{left:r.left,top:r.top,width:r.width,height:r.height}}function gt(s){let r=new Map;return s.forEach(e=>{r.set(e,ws(e))}),r}function Xc(s,r){return{deltaX:s.left-r.left,deltaY:s.top-r.top,deltaW:s.width/r.width,deltaH:s.height/r.height}}function Qc(s,r,e={}){let t=ws(s),{deltaX:i,deltaY:n,deltaW:o,deltaH:a}=Xc(r,t);if(i===0&&n===0&&o===1&&a===1)return null;let{duration:l,easing:c,fill:p}={...Gc,...e};return s.animate([{transformOrigin:"top left",transform:`translate(${i}px, ${n}px) scale(${o}, ${a})`},{transformOrigin:"top left",transform:"none"}],{duration:l,easing:c,fill:p})}function bt(s,r={}){let e=new Map;return s.forEach((t,i)=>{if(!(i instanceof HTMLElement))return;let n=Qc(i,t,r);n&&e.set(i,n)}),e}var Ae=(s,r,e,t='slot[part="drags"]',i="closestCornersWithInventoryPriority")=>{let n=io(s,r,e,t,i);class o extends n{constructor(){super(...arguments);this.configuration={copyStylesDragClone:!0,dragCanBePlacedBack:!0,dragOnClick:!1};this.minAssociations=1;this._maxAssociations=0;this._maxAssociationsDefaultApplied=!1;this._response=[];this._dropBlockedDueToMax=!1;this.flipAnimationConfig={duration:200,easing:"ease"};this._enableFlipAnimations=!0;this.autoSizeDropzones=!1}get maxAssociations(){if(!this._maxAssociationsDefaultApplied){this._maxAssociationsDefaultApplied=!0;let c=this.tagName?.toLowerCase()||"";(c==="qti-graphic-gap-match-interaction"||c==="qti-gap-match-interaction")&&!this.hasAttribute("max-associations")&&this._maxAssociations===0&&(this._maxAssociations=1)}return this._maxAssociations}set maxAssociations(c){let p=this._maxAssociations;this._maxAssociations=c,this.requestUpdate("maxAssociations",p)}set disableAnimations(c){this._enableFlipAnimations=!c}get disableAnimations(){return!this._enableFlipAnimations}get enableFlipAnimations(){return this._enableFlipAnimations}get response(){let c=this.getResponse,p=typeof c=="function"?c.call(this):void 0;return(Array.isArray(p)?p:(this.cacheInteractiveElements(),ro(this.trackedDroppables,r))).join(",")}set response(c){if(Array.isArray(c)){let p=this.getValue,u=typeof p=="function"?p.call(this,c):c,m=Array.isArray(u)?u:typeof u=="string"&&u.length>0?[u]:[];this.reset(!1),m.forEach(w=>this.placeResponse(w));let y=this.getResponse,b=typeof y=="function"?y.call(this):void 0;this._response=Array.isArray(b)?b:(this.cacheInteractiveElements(),ro(this.trackedDroppables,r))}else this._response=typeof c=="string"&&c.length>0?[c]:[];this._internals.setFormValue(JSON.stringify(this._response))}afterCache(){this.applyConfiguredChoicesContainerWidth(),this.updateMinDimensionsForDropZones()}applyConfiguredChoicesContainerWidth(){let c=this.dataset.choicesContainerWidth;c&&this.trackedDroppables.forEach(p=>{p.style.width=`${c}px`,p.style.boxSizing="border-box"})}shouldTreatBlockedMaxAsInvalid(){return!0}shouldReturnToInventoryOnInventoryDrop(){return!1}getFirstMessageAttribute(c){for(let u of c){let m=this.getAttribute(u);if(m&&m.trim().length>0)return m}let p=c.map(u=>u.toLowerCase());for(let u of Array.from(this.attributes))if(p.includes(u.name.toLowerCase())&&u.value.trim().length>0)return u.value;return null}allowDrop(c,p){if(this.trackedDragContainers.includes(p))return!0;let u=this.trackedDroppables.includes(p),m=p.hasAttribute("disabled"),y=p.hasAttribute("data-drag-source");return u&&(!m||y)}handleDrop(c,p){let u=this.dragState.dragClone?.getBoundingClientRect();this.dropDraggableInDroppable(c,p,u);let m=c.getAttribute("identifier");m&&this.updateInventoryBasedOnMatchMax(m);let y=Hi(this.trackedDroppables,r);this.maxAssociations>0&&y>this.maxAssociations&&(this._dropBlockedDueToMax=!0,this.validate(),this.reportValidity())}handleInvalidDrop(c){let p=this.dragState.sourceDroppable,u=this.dragState.currentTarget,m=!u,y=this.trackedDragContainers[0]||null;if(!c)return;p&&m&&y&&this.configuration.dragCanBePlacedBack!==!1?this.dropDraggableInDroppable(c,y):p&&this.trackedDroppables.includes(p)?this.dropDraggableInDroppable(c,p):c.style.opacity==="0"&&(this.restoreInventoryItem(c),this.cacheInteractiveElements(),this.checkAllMaxAssociations());let b=Hi(this.trackedDroppables,r),w=this.maxAssociations>0&&b>=this.maxAssociations,f=!!u&&u.hasAttribute("disabled")&&!u.hasAttribute("data-drag-source");this._dropBlockedDueToMax=f&&w,this.validate(),this.reportValidity()}updateMinDimensionsForDropZones(){this.trackedDraggables.length!==0&&jc(this.trackedDraggables,this.trackedDroppables,this.trackedDragContainers)}restoreInventoryItem(c){c.style.opacity="1.0",c.style.display="",c.style.position="",c.style.pointerEvents="auto"}placeResponse(c){let[p,...u]=c.split(" ").reverse(),m=this.trackedDroppables.find(y=>y.getAttribute("identifier")===p);m&&u.forEach(y=>{if(!y)return;let w=to(this.trackedDragContainers,y).at(0)||this.trackedDraggables.find(f=>f.getAttribute("identifier")===y);w&&this.dropDraggableInDroppable(w,m)})}dropDraggableInDroppable(c,p,u){if(this.trackedDragContainers.includes(p)){if(!this.dragState.sourceDroppable){if(this.shouldReturnToInventoryOnInventoryDrop()){this.returnToInventory(c),this._dropBlockedDueToMax=!1,this.validate();return}this.restoreInventoryItem(c),this.cacheInteractiveElements(),this.checkAllMaxAssociations(),this._dropBlockedDueToMax=!1,this.validate();return}let A=c.getAttribute("identifier");c.remove(),A&&this.restoreOriginalInInventory(A),this.cacheInteractiveElements(),this.checkAllMaxAssociations(),this._dropBlockedDueToMax=!1,this.validate();return}let y=parseInt(p.getAttribute("match-max")||"1",10),b=Number.isNaN(y)?1:y,w=b===0||b>1,f=Array.from(p.querySelectorAll('[qti-draggable="true"]')),h=this.enableFlipAnimations&&f.length>0?gt(f):null;if(!w){let A=p.querySelector(r)||p.querySelector('[qti-draggable="true"]');if(A){let S=A.getAttribute("identifier");A.remove(),S&&this.restoreOriginalInInventory(S)}}let v=c.cloneNode(!0);v.removeAttribute("style"),v.removeAttribute("data-keyboard-dragging"),v.setAttribute("qti-draggable","true"),v.setAttribute("tabindex","0"),p.tagName==="SLOT"?v.setAttribute("slot",p.getAttribute("name")||""):p.tagName==="QTI-SIMPLE-ASSOCIABLE-CHOICE"?(v.setAttribute("slot","qti-simple-associable-choice"),p.appendChild(v),p.setAttribute("data-has-drop","true")):p.appendChild(v),h&&this.enableFlipAnimations&&bt(h,this.flipAnimationConfig),u&&this.enableFlipAnimations&&requestAnimationFrame(()=>{let A=v.getBoundingClientRect(),S=u.left-A.left,T=u.top-A.top;(S!==0||T!==0)&&v.animate([{transform:`translate(${S}px, ${T}px)`,opacity:.8},{transform:"translate(0, 0)",opacity:1}],{duration:this.flipAnimationConfig.duration||200,easing:this.flipAnimationConfig.easing||"ease",fill:"both"})});let q=c.getAttribute("identifier");q&&this.updateInventoryBasedOnMatchMax(q),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}returnToInventory(c){let p=c.getAttribute("identifier");p&&(this.trackedDroppables.forEach(u=>{Array.from(u.querySelectorAll(`[identifier="${p}"][qti-draggable="true"]`)).forEach(y=>{y.remove(),u.tagName==="QTI-SIMPLE-ASSOCIABLE-CHOICE"&&u.removeAttribute("data-has-drop")})}),this.restoreOriginalInInventory(p)),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}restoreOriginalInInventory(c){let p=to(this.trackedDragContainers,c),u=[];this.trackedDragContainers.forEach(y=>{u.push(...Array.from(y.querySelectorAll('[qti-draggable="true"]')))});let m=this.enableFlipAnimations&&u.length>0?gt(u):null;p.forEach(y=>{y.style.opacity="1.0",y.style.pointerEvents="auto",y.style.display="",y.style.visibility="visible",y.style.setProperty("opacity","1.0","important"),y.style.setProperty("pointer-events","auto","important")}),m&&this.enableFlipAnimations&&bt(m,this.flipAnimationConfig)}updateInventoryBasedOnMatchMax(c){let p=to(this.trackedDragContainers,c),u=Bc(this.trackedDraggables,c),m=this.trackedDroppables.reduce((y,b)=>{let w=b.querySelectorAll(`[identifier="${c}"]`);return y+w.length},0);p.forEach(y=>{u!==0&&m>=u?(y.style.opacity="0.0",y.style.pointerEvents="none"):(y.style.opacity="1.0",y.style.pointerEvents="auto")})}checkAllMaxAssociations(){let c=Hi(this.trackedDroppables,r),p=this.maxAssociations>0&&c>=this.maxAssociations;this.trackedDroppables.forEach(u=>{let m=u.hasAttribute("data-drag-source"),y=zc(u,r);(p||y)&&!m?u.setAttribute("disabled",""):u.removeAttribute("disabled")})}saveResponse(c){let p=this.getResponse,u=c??(typeof p=="function"?p.call(this):void 0),m=Array.isArray(u)?u:typeof u=="string"?[u]:(this.cacheInteractiveElements(),ro(this.trackedDroppables,r));this._response=m,this._internals.setFormValue(JSON.stringify(this._response)),this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:m}})),this.requestUpdate()}reset(c=!0){this.trackedDroppables.forEach(p=>{Array.from(p.querySelectorAll(r)).forEach(m=>m.remove()),p.tagName==="QTI-SIMPLE-ASSOCIABLE-CHOICE"&&p.removeAttribute("data-has-drop")}),this.trackedDraggables.forEach(p=>{let u=p.getAttribute("identifier");u&&this.restoreOriginalInInventory(u)}),this.resetDragState(),this.cacheInteractiveElements(),this._response=[],this._internals.setFormValue(JSON.stringify(this._response)),c&&this.saveResponse()}validate(){let c=Hi(this.trackedDroppables,r),p=this.maxAssociations>0&&c>=this.maxAssociations,u=this.maxAssociations>0&&c>this.maxAssociations,m=this.minAssociations>0&&c<this.minAssociations,y="",b=!0;u?(y=this.getFirstMessageAttribute(["data-max-associations-message","data-max-selections-message"])||this.dataset.maxAssociationsMessage||this.dataset.maxSelectionsMessage||`You've selected too many associations. Maximum allowed is ${this.maxAssociations}.`,b=!1):p&&this._dropBlockedDueToMax&&this.shouldTreatBlockedMaxAsInvalid()?(y=this.getFirstMessageAttribute(["data-max-associations-message","data-max-selections-message"])||this.dataset.maxAssociationsMessage||this.dataset.maxSelectionsMessage||`You've selected too many associations. Maximum allowed is ${this.maxAssociations}.`,b=!1):m?(y=this.getFirstMessageAttribute(["data-min-associations-message","data-min-selections-message"])||this.dataset.minAssociationsMessage||this.dataset.minSelectionsMessage||`Please select at least ${this.minAssociations} ${this.minAssociations===1?"association":"associations"}.`,b=!1,this._dropBlockedDueToMax=!1):this._dropBlockedDueToMax=!1;let w=this.trackedDroppables[0]??this.trackedDraggables[0]??this;return this._internals.setValidity(b?{}:{customError:!0},y,w),b}reportValidity(){let c=this._internals.reportValidity(),p=this.shadowRoot?.querySelector("#validation-message");return p&&(c?(p.textContent="",p.style.display="none"):(p.textContent=this._internals.validationMessage,p.style.setProperty("display","block","important"))),c}}return d([g({attribute:!1,type:Object})],o.prototype,"configuration",2),d([g({type:Number,reflect:!0,attribute:"min-associations"})],o.prototype,"minAssociations",2),d([g({type:Number,reflect:!0,attribute:"max-associations"})],o.prototype,"maxAssociations",1),d([g({type:Boolean,attribute:"disable-animations"})],o.prototype,"disableAnimations",1),d([g({type:Boolean,attribute:"auto-size-dropzones"})],o.prototype,"autoSizeDropzones",2),o};var no=class{getInsertPosition(r,e,t,i,n){let o=r.indexOf(t);if(o===-1)return null;let a=t.getBoundingClientRect(),l=(n-a.top)/a.height,p=Math.min(1,Math.max(0,l))>.5;return{index:o,placeAfter:p}}};var Yc=new no;var Ep={borderStyle:"2px dashed",borderColor:"var(--qti-drop-placeholder, #c1c1c1)",background:"transparent",transitionDuration:150};function Fi(){return{placeholder:null,lastHoverTarget:null,lastPlacement:null,sortContainer:null}}function oo(s){s.placeholder?.remove(),s.placeholder=null,s.lastHoverTarget=null,s.lastPlacement=null,s.sortContainer=null}function so(s,r,e={}){let t={...Ep,...e},i=document.createElement("div");return i.setAttribute("data-drop-placeholder","true"),i.style.width=`${r.width}px`,i.style.height=`${r.height}px`,i.style.margin=window.getComputedStyle(s).margin,i.style.boxSizing="border-box",i.style.border=`${t.borderStyle} ${t.borderColor}`,i.style.borderRadius=getComputedStyle(s).borderRadius,i.style.background=t.background,i.style.transition=`transform ${t.transitionDuration}ms ease`,i.style.pointerEvents="none",i}function Es(s,r){for(let e of r)if(e.contains(s)&&e!==s)return e;return null}var Te=(s,r='[qti-draggable="true"]')=>{class e extends s{constructor(){super(...arguments);this.#e=null;this.#t=Fi();this.#r={hoveredSlot:null,originalPositions:new Map};this.#i=new Set;this.allowReorder=!0;this.sortablePlaceholderConfig={};this.sortableAnimationConfig={duration:150,easing:"ease"}}#e;#t;#r;#i;get isDraggingFromSlot(){return this.#e!==null}findContainingDroppable(n){return Es(n,this.trackedDroppables)}#n(n){return n.querySelector(r)}#o(n){let o=this.#s(n);return o===0||o>1}#s(n){let o=parseInt(n.getAttribute("match-max")||"1",10);return Number.isNaN(o)?1:o}#a(n){return n.querySelectorAll(r).length}#c(n){let o=this.#s(n);return o===0?!1:this.#a(n)>=o}#d(){this.#r={hoveredSlot:null,originalPositions:new Map}}#l(n){if(!this.#e||n===this.#e){this.#u();return}if(this.#r.hoveredSlot===n)return;this.#u();let o=this.#n(n);if(!o){this.#t.placeholder&&n.appendChild(this.#t.placeholder),this.#r.hoveredSlot=n;return}if(this.#o(n)){if(this.#c(n)){this.#t.placeholder&&this.#e&&this.#e.appendChild(this.#t.placeholder),this.#r.hoveredSlot=null;return}this.#t.placeholder&&n.appendChild(this.#t.placeholder),this.#r.hoveredSlot=n;return}let l=gt([o]);this.#r.originalPositions.set(o,n),this.#t.placeholder&&this.#t.placeholder.parentElement&&this.#t.placeholder.remove(),this.#e.appendChild(o),this.#t.placeholder&&n.appendChild(this.#t.placeholder),this.#r.hoveredSlot=n,bt(l,this.sortableAnimationConfig)}#u(){if(this.#r.originalPositions.size===0&&this.#r.hoveredSlot===null)return;let n=Array.from(this.#r.originalPositions.keys()),o=n.length>0?gt(n):null;for(let[a,l]of this.#r.originalPositions)l.appendChild(a);this.#t.placeholder&&this.#e&&this.#e.appendChild(this.#t.placeholder),o&&bt(o,this.sortableAnimationConfig),this.#r.originalPositions.clear(),this.#r.hoveredSlot=null}initiateDrag(n,o,a,l,...c){this.#e=null,this.#t=Fi(),this.#d();let p=this.findContainingDroppable(n);if(p&&this.allowReorder){this.#e=p,this.#t.sortContainer=p;let m=n.getBoundingClientRect();this.#t.placeholder=so(n,m,this.sortablePlaceholderConfig);let y=n.getAttribute("slot");y&&this.#t.placeholder.setAttribute("slot",y),this.#t.placeholder.style.visibility="hidden",p.appendChild(this.#t.placeholder),this.trackedDroppables.forEach(b=>{if(b!==p&&b.hasAttribute("disabled")){if(this.#o(b)&&this.#c(b))return;b.removeAttribute("disabled"),this.#i.add(b)}})}let[u]=c;super.initiateDrag(n,o,a,l,u)}cleanupSortableState(n=!0){if(n)for(let[o,a]of this.#r.originalPositions)a.appendChild(o);this.#t.placeholder&&this.#t.placeholder.remove(),oo(this.#t),this.#i.clear(),this.#e=null,this.#d()}onSortableDragMove(n,o){if(!this.isDraggingFromSlot)return;let a=Tr(this.trackedDroppables,n,o,this.dragState.dragClone,this.collisionDetectionAlgorithm);a?this.#l(a):this.#u()}handleDragMove(n,o){Object.getPrototypeOf(e.prototype).handleDragMove?.call(this,n,o),this.onSortableDragMove(n,o)}allowDrop(n,o){return this.isDraggingFromSlot&&this.trackedDroppables.includes(o)?this.#o(o)?!this.#c(o):!0:this.isDraggingFromSlot&&this.trackedDragContainers.includes(o)?!0:super.allowDrop(n,o)}handleDrop(n,o){super.handleDrop(n,o),this.cleanupSortableState(!1)}handleInvalidDrop(n){this.cleanupSortableState(),super.handleInvalidDrop(n)}}return e};var Jc=C`
4033
+ <slot part="slot"></slot>`}};d([g({type:String,attribute:"template-identifier"})],ht.prototype,"templateIdentifier",2),d([g({type:String,attribute:"show-hide"})],ht.prototype,"showHide",2),d([g({type:Boolean,converter:{fromAttribute:e=>e==="true",toAttribute:e=>String(e)}})],ht.prototype,"fixed",2),d([g({type:String,attribute:!1})],ht.prototype,"marker",2);customElements.define("qti-simple-choice",ht);var{AbortController:Ue,AbortSignal:Ts,WeakMap:Np,WeakRef:Op,Window:Gc,reportError:no=console.log}=globalThis,ft=o=>o&&o.defaultView!==null&&o.defaultView.document===o&&(o.defaultView.top===o.defaultView||ft(o.defaultView.parent.document)),Xt=()=>!!Gc&&globalThis instanceof Gc,Is=Symbol("unset"),[Xc,Hp]=(()=>{function o(w,f,m=!0){Object.defineProperty(w,f,{...Object.getOwnPropertyDescriptor(w,f),enumerable:m})}let r="try"in Promise?Promise.try.bind(Promise):(w,...f)=>new Promise(m=>m(w(...f))),e="withResolvers"in Promise?Promise.withResolvers.bind(Promise):()=>{let w,f;return{promise:new Promise((b,q)=>(w=b,f=q)),resolve:w,reject:f}};function t(w,f){let m=f.call(w);if(m===null||typeof m!="object")throw new TypeError("Iterator is not an object");return m}let i=new Np,n={next(...w){let f=this,m=i.get(f);if(!m?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.next called on invalid object");let{syncIteratorRecord:b}=m;return r(()=>b.next(...w))},return(...w){let f=this,m=i.get(f);if(!m?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.return called on invalid object");let{syncIteratorRecord:b}=m;return r(()=>b.return?b.return(...w):{value:void 0,done:!0})},throw(...w){let f=this,m=i.get(f);if(!m?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.throw called on invalid object");let{syncIteratorRecord:b}=m;return r(()=>{if(!b.throw)throw b.return(),new TypeError("no throw method");return b.throw(...w)})}};function s(w){let f=Object.create(n);return i.set(f,{syncIteratorRecord:w}),f}function a(w,f){let m;if(f){if(m=w[Symbol.asyncIterator],m==null){if(m=w[Symbol.iterator],m==null)throw new TypeError("Object is not async iterable");let b=t(w,m);return s(b)}}else m=w[Symbol.iterator];if(m==null)throw new TypeError("Object is not iterable");return t(w,m)}let l="any"in Ts?Ts.any.bind(Ts):w=>{let f=new Ue;for(let m of w)if(m.aborted)return f.abort(m.reason),f.signal;for(let m of w)m.addEventListener("abort",()=>{f.abort(m.reason)},{signal:f.signal});return f.signal},c=w=>l(w.filter(Boolean));class p{constructor({next:f,error:m,complete:b}={}){i.set(this,{next:f,error:m,complete:b})}next(f){let{next:m}=i.get(this)||{};m&&m(f)}error(f){let{error:m}=i.get(this)||{};m?m(f):no(f)}complete(){let{complete:f}=i.get(this)||{};f&&f()}}function u(w,f){let m=i.get(w);if(m?.active){m.active=!1,m.subscriptionController.abort(f);for(let b of m.teardowns.reverse()){if(Xt()&&!ft(document))return;try{b()}catch(q){no(q)}}}}function h(w,f,m={}){if(Xt()&&!ft(document))return;let b;typeof f=="function"?b=new p({next:f}):f&&!(f instanceof p)?b=new p(f):b=f||new p;let q=i.get(w),A=q.weakSubscriber?.deref();if(A?.active){let M=A,_=i.get(M);_.observers.add(b),m.signal&&(m.signal.aborted?_.observers.delete(b):m.signal.addEventListener("abort",()=>{let N=i.get(M);N?.active&&(N.observers.delete(b),N.observers.size==0&&u(M,m.signal.reason))}));return}let T=new v(b);if(q.weakSubscriber=new Op(T),"signal"in m&&(m.signal.aborted?u(T,m.signal.reason):m.signal.addEventListener("abort",()=>{let M=i.get(T);M?.active&&(M.observers.delete(b),M.observers.size==0&&u(T,m.signal.reason))})),q.subscribeCallback)try{q.subscribeCallback(T)}catch(M){T.error(M)}}class v{get[Symbol.toStringTag](){return"Subscriber"}constructor(f=null){if(!(f instanceof p))throw new TypeError("Illegal constructor");i.set(this,{active:!0,observers:new Set([f]),teardowns:[],subscriptionController:new Ue})}next(f){if(!(this instanceof v))throw new TypeError("illegal invocation");if(!arguments.length)throw new TypeError("too few arguments");let m=i.get(this);if(!m?.active||Xt()&&!ft(document))return;let b=new Set(m.observers);for(let q of b)q.next(f)}error(f){if(!(this instanceof v))throw new TypeError("illegal invocation");if(!arguments.length)throw new TypeError("too few arguments");let m=i.get(this);if(!m?.active){no(f);return}if(Xt()&&!ft(document))return;u(this,f);let b=new Set(m.observers);for(let q of b)q.error(f)}complete(){if(!(this instanceof v))throw new TypeError("illegal invocation");let f=i.get(this);if(!f?.active||Xt()&&!ft(document))return;u(this);let m=new Set(f.observers);for(let b of m)b.complete()}addTeardown(f){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof f!="function")throw new TypeError("Parameter 1 is not of type 'Function'");if(Xt()&&!ft(document))return;let m=i.get(this);m?.active?m.teardowns.push(f):f()}get active(){if(!(this instanceof v))throw new TypeError("illegal invocation");return!!i.get(this)?.active}get signal(){if(!(this instanceof v))throw new TypeError("illegal invocation");if(!i.has(this)){let f=new Ue;return f.abort(),f.signal}return i.get(this).subscriptionController.signal}}o(v.prototype,"next"),o(v.prototype,"error"),o(v.prototype,"complete"),o(v.prototype,"addTeardown"),o(v.prototype,"active"),o(v.prototype,"signal");class y{get[Symbol.toStringTag](){return"Observable"}constructor(f){if(!f)throw new TypeError("1 argument required but 0 present");i.set(this,{weakSubscriber:null,subscribeCallback:f})}static from(f){if(f===null||typeof f!="object")throw new TypeError("Observable.from only accepts objects");if(f instanceof y)return f;if(typeof(Symbol.asyncIterator in f&&f[Symbol.asyncIterator])=="function"){let A=function(T,M){if(T.signal.aborted)return;let _;try{let N=M.next();_=Promise.resolve(N)}catch(N){_=Promise.reject(N)}_.then(N=>{if(N===null||typeof N!="object"){T.error(new TypeError("Not an IteratorResult."));return}try{({done:q}=N)}catch(z){T.error(z);return}if(q){T.complete();return}let H;try{H=N.value}catch(z){T.error(z);return}T.next(H),A(T,M)},N=>{T.error(N)})},q=!1;return new y(T=>{if(T.signal.aborted)return;let M;try{M=a(f,!0)}catch(N){T.error(N);return}let _=M;T.signal.aborted||(T.signal.addEventListener("abort",()=>{if(typeof _.return!="function"||q)return;r(()=>_.return(T.signal.reason)).then(H=>{if(H===null||typeof H!="object")throw new TypeError("Iterator .return() must return an Object")})}),A(T,_))})}if(typeof(Symbol.iterator in f&&f[Symbol.iterator])=="function")return new y(q=>{if(q.signal.aborted)return;let A;try{A=a(f,!1)}catch(_){q.error(_);return}let T=!1,M=A;if(!q.signal.aborted)for(q.signal.addEventListener("abort",()=>{if(typeof M.return!="function"||T)return;let _=M.return();if(_===null||typeof _!="object")throw new TypeError("Iterator .return() must return an Object")});;)try{let _=M.next();if({done:T}=_,T){q.complete();return}if(q.next(_.value),q.signal.aborted)break}catch(_){q.error(_);break}});if(f instanceof Promise||typeof f.then=="function")return new y(q=>{f.then(A=>{q.next(A),q.complete()},A=>{q.error(A)})});throw new TypeError("Could not convert value to Observable")}subscribe(f=null,m={}){if(!(this instanceof y))throw new TypeError("illegal invocation");h(this,f,m)}takeUntil(f){if(!(this instanceof y))throw new TypeError("illegal invocation");let m=this,b=y.from(f);return new y(q=>{let A=new p({next(){q.complete()},error(){q.complete()}}),T={signal:q.signal};if(h(b,A,T),!q.active)return;let M=new p({next(_){q.next(_)},error(_){q.error(_)},complete(){q.complete()}});h(m,M,T)})}map(f){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof f!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let m=this;return new y(b=>{let q=0,A=new p({next(M){let _;try{_=f(M,q)}catch(N){b.error(N);return}q+=1,b.next(_)},error(M){b.error(M)},complete(){b.complete()}}),T={signal:b.signal};h(m,A,T)})}inspect(f={}){let m=null,b=null,q=null,A=null,T=null;typeof f=="function"?b=f:f&&typeof f=="object"&&("subscribe"in f&&(m=f.subscribe),"next"in f&&(b=f.next),"error"in f&&(q=f.error),"complete"in f&&(A=f.complete),"abort"in f&&(T=f.abort));let M=this;return new y(_=>{if(m!==null)try{m()}catch(F){_.error(F);return}let N=()=>{try{T!==null&&T(_.signal.reason)}catch(F){no(F)}};_.signal.addEventListener("abort",N,{once:!0});let H=new p({next(F){if(b!==null)try{b(F)}catch(de){_.signal.removeEventListener("abort",N),_.error(de);return}_.next(F)},error(F){if(_.signal.removeEventListener("abort",N),q!==null)try{q(F)}catch(de){_.error(de);return}_.error(F)},complete(){if(_.signal.removeEventListener("abort",N),A!==null)try{A()}catch(F){_.error(F);return}_.complete()}}),z={signal:_.signal};h(M,H,z)})}filter(f){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof f!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let m=this;return new y(b=>{let q=0,A=new p({next(M){let _=!1;try{_=f(M,q)}catch(N){b.error(N);return}q+=1,_&&b.next(M)},error(M){b.error(M)},complete(){b.complete()}}),T={signal:b.signal};h(m,A,T)})}take(f){if(!(this instanceof y))throw new TypeError("illegal invocation");let m=this;return new y(b=>{let q=f;if(q==0)return b.complete();let A=new p({next(M){b.next(M),q-=1,q==0&&b.complete()},error(M){b.error(M)},complete(){b.complete()}}),T={signal:b.signal};h(m,A,T)})}drop(f){if(!(this instanceof y))throw new TypeError("illegal invocation");let m=this;return new y(b=>{let q=f,A=new p({next(M){if(q>0)return q-=1;q==0&&b.next(M)},error(M){b.error(M)},complete(){b.complete()}}),T={signal:b.signal};h(m,A,T)})}flatMap(f){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof f!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let m=this;return new y(b=>{let q=0,A=!1,T=[];function M(z){let F;try{F=f(z,q)}catch(Be){return b.error(Be)}q+=1;let de;try{de=y.from(F)}catch(Be){return b.error(Be)}let Po=new p({next(Be){b.next(Be)},error(Be){b.error(Be)},complete(){if(T.length){let Be=T.shift();M(Be)}else _=!1,A&&b.complete()}}),ke={signal:b.signal};h(de,Po,ke)}let _=!1,N=new p({next(z){_?T.push(z):(_=!0,M(z))},error(z){b.error(z)},complete(){A=!0,!_&&!T.length&&b.complete()}}),H={signal:b.signal};h(m,N,H)})}switchMap(f){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof f!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let m=this;return new y(b=>{let q=0,A=!1,T=null;function M(H){let z;try{z=f(H,q)}catch(ke){return b.error(ke)}q+=1;let F;try{F=y.from(z)}catch(ke){return b.error(ke)}let de=new p({next(ke){b.next(ke)},error(ke){b.error(ke)},complete(ke){A?b.complete():T=null}}),Po={signal:c([T.signal,b.signal])};h(F,de,Po)}let _=new p({next(H){T&&T.abort(),T=new Ue,M(H)},error(H){b.error(H)},complete(){A=!0,T||b.complete()}}),N={signal:b.signal};h(m,_,N)})}catch(f){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof f!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let m=this;return new y(q=>{let A=new p({next(M){q.next(M)},error(M){let _;try{_=f(M)}catch(F){q.error(F);return}let N;try{N=y.from(_)}catch(F){q.error(F);return}let H=new p({next(F){q.next(F)},error(F){q.error(F)},complete(){q.complete()}}),z={signal:q.signal};h(N,H,z)},complete(){q.complete()}}),T={signal:q.signal};h(m,A,T)})}finally(f){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof f!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let m=this;return new y(b=>{b.addTeardown(f);let q=new p({next(T){b.next(T)},error(T){b.error(T)},complete(){b.complete()}}),A={signal:b.signal};h(m,q,A)})}toArray(f={}){if(!(this instanceof y))throw new TypeError("illegal invocation");let{promise:m,resolve:b,reject:q}=e();if(f.signal){if(f.signal.aborted)return Promise.reject(f.signal.reason);f.signal.addEventListener("abort",()=>{q(f.signal.reason)})}let A=[],T=new p({next(M){A.push(M)},error(M){q(M)},complete(){b(A)}});return h(this,T,f),m}forEach(f,m={}){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof f!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:b,resolve:q,reject:A}=e(),T=new Ue,M={signal:c([T.signal,m.signal])};if(M.signal.aborted)return A(M.signal.reason),b;M.signal.addEventListener("abort",()=>{A(M.signal.reason)});let _=0,N=new p({next(H){try{f(H,_)}catch(z){A(z),T.abort(z)}_+=1},error(H){A(H)},complete(){q()}});return h(this,N,M),b}every(f,m={}){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof f!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:b,resolve:q,reject:A}=e(),T=new Ue,M={signal:c([T.signal,m.signal])};if(M.signal.aborted)return A(M.signal.reason),b;M.signal.addEventListener("abort",()=>{A(M.signal.reason)});let _=0,N=new p({next(H){let z=!1;try{z=f(H,_)}catch(F){A(F),T.abort(F)}_+=1,z||(q(!1),T.abort())},error(H){A(H)},complete(){q(!0)}});return h(this,N,M),b}first(f={}){if(!(this instanceof y))throw new TypeError("illegal invocation");let{promise:m,resolve:b,reject:q}=e(),A=new Ue,T={signal:c([A.signal,f.signal])};if(T.signal.aborted)return q(T.signal.reason),m;T.signal.addEventListener("abort",()=>{q(T.signal.reason)});let M=new p({next(_){b(_),A.abort()},error(_){q(_)},complete(){q(new RangeError("No values in Observable"))}});return h(this,M,T),m}last(f={}){if(!(this instanceof y))throw new TypeError("illegal invocation");let{promise:m,resolve:b,reject:q}=e();if(f.signal){if(f.signal.aborted)return q(f.signal.reason),m;f.signal.addEventListener("abort",()=>{q(f.signal.reason)})}let A=null,T=!1,M=new p({next(_){T=!0,A=_},error(_){q(_)},complete(){T?b(A):q(new RangeError("No values in Observable"))}});return h(this,M,f),m}find(f,m={}){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof f!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:b,resolve:q,reject:A}=e(),T=new Ue,M={signal:c([T.signal,m.signal])};if(M.signal.aborted)return A(M.signal.reason),b;M.signal.addEventListener("abort",()=>{A(M.signal.reason)});let _=0,N=new p({next(H){let z=!1;try{z=f(H,_)}catch(F){A(F),T.abort(F)}_+=1,z&&(q(H),T.abort())},error(H){A(H)},complete(){q()}});return h(this,N,M),b}some(f,m={}){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof f!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:b,resolve:q,reject:A}=e(),T=new Ue,M={signal:c([T.signal,m.signal])};if(M.signal.aborted)return A(M.signal.reason),b;M.signal.addEventListener("abort",()=>{A(M.signal.reason)});let _=0,N=new p({next(H){let z=!1;try{z=f(H,_)}catch(F){A(F),T.abort(F)}_+=1,z&&(q(!0),T.abort())},error(H){A(H)},complete(){q(!1)}});return h(this,N,M),b}reduce(f,m,b={}){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof f!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:q,resolve:A,reject:T}=e(),M=new Ue,_={signal:c([M.signal,b.signal])};if(_.signal.aborted)return T(_.signal.reason),q;_.signal.addEventListener("abort",()=>{T(_.signal.reason)},{once:!0});let N=0,H=arguments.length>1?m:Is,z=new p({next(F){if(H===Is){H=F,N++;return}try{let de=f(H,F,N);N++,H=de}catch(de){T(de),M.abort(de);return}},error(F){T(F)},complete(){H!==Is?A(H):T(new TypeError("no initial value provided and no values emitted"))}});return h(this,z,_),q}}return o(y.prototype,"subscribe"),[y,v]})();function Qc(){return typeof globalThis.Observable=="function"}function Yc(){Object.defineProperties(globalThis,{Observable:{value:Xc,configurable:!0,writable:!0},Subscriber:{value:Hp,configurable:!0,writable:!0}}),EventTarget.prototype.when=function(o,r={}){if(Xt()&&!ft(document))return;let e=this;return new Xc(t=>{if(!e||t.signal.aborted)return;let i=n=>{t.next(n)};e.addEventListener(o,i,{capture:r.capture||!1,passive:r.passive,once:!1,signal:t.signal})})}}function Rs(o,r,e){let t=o.filter(i=>!i.hasAttribute("disabled"));for(let i of t){let n=i.getBoundingClientRect();if(r>=n.left&&r<=n.right&&e>=n.top&&e<=n.bottom)return i}return null}function Jc(o,r,e,t){if(!t)return null;let i=o.filter(s=>!s.hasAttribute("disabled")),n=t.getBoundingClientRect();for(let s of i){let a=s.getBoundingClientRect();if(!(n.right<a.left||n.left>a.right||n.bottom<a.top||n.top>a.bottom))return s}return null}function Kc(o,r,e,t){let i=o.filter(c=>!c.hasAttribute("disabled"));if(i.length===0)return null;let n,s;if(t){let c=t.getBoundingClientRect();n=c.left+c.width/2,s=c.top+c.height/2}else n=r,s=e;let a=null,l=1/0;for(let c of i){let p=c.getBoundingClientRect(),u=p.left+p.width/2,h=p.top+p.height/2,v=Math.sqrt(Math.pow(n-u,2)+Math.pow(s-h,2));v<l&&(l=v,a=c)}return a}function Zc(o,r,e,t){let i=o.filter(l=>!l.hasAttribute("disabled"));if(i.length===0)return null;let n;if(t){let l=t.getBoundingClientRect();n=[{x:l.left,y:l.top},{x:l.right,y:l.top},{x:l.left,y:l.bottom},{x:l.right,y:l.bottom}]}else n=[{x:r,y:e},{x:r,y:e},{x:r,y:e},{x:r,y:e}];let s=null,a=1/0;for(let l of i){let c=l.getBoundingClientRect(),p=[{x:c.left,y:c.top},{x:c.right,y:c.top},{x:c.left,y:c.bottom},{x:c.right,y:c.bottom}],u=0,h=0;for(let y of n)for(let w of p){let f=Math.sqrt(Math.pow(y.x-w.x,2)+Math.pow(y.y-w.y,2));u+=f,h++}let v=u/h;v<a&&(a=v,s=l)}return s}function Fp(o,r,e,t,i){let n=i&&i.length>0?o.filter(m=>i.includes(m)):o.filter(m=>m.tagName==="SLOT"&&m.hasAttribute("part")&&m.getAttribute("part")?.includes("drags")),a=o.filter(m=>!n.includes(m));if(n.length===0&&a.length===0)return null;let l;if(t){let m=t.getBoundingClientRect();l=[{x:m.left,y:m.top},{x:m.right,y:m.top},{x:m.left,y:m.bottom},{x:m.right,y:m.bottom}]}else l=[{x:r,y:e},{x:r,y:e},{x:r,y:e},{x:r,y:e}];let c=m=>{let b=m.getBoundingClientRect(),q=[{x:b.left,y:b.top},{x:b.right,y:b.top},{x:b.left,y:b.bottom},{x:b.right,y:b.bottom}],A=0,T=0;for(let M of l)for(let _ of q){let N=Math.sqrt(Math.pow(M.x-_.x,2)+Math.pow(M.y-_.y,2));A+=N,T++}return A/T},p=null,u=1/0;for(let m of n){let b=c(m);b<u&&(u=b,p=m)}let h=null,v=1/0;for(let m of a){let b=c(m);b<v&&(v=b,h=m)}if(p&&t){let m=t.getBoundingClientRect(),b=p.getBoundingClientRect(),q=m.left+m.width/2,A=m.top+m.height/2;if(q>=b.left&&q<=b.right&&A>=b.top&&A<=b.bottom)return p}let w=t?.getAttribute("data-drag-origin")==="droppable"?.85:1.5;return p&&h?u<=v*w?p:h:p||h}function ed(o){switch(o){case"pointerWithin":return Rs;case"rectangleIntersection":return Jc;case"closestCenter":return Kc;case"closestCorners":return Zc;case"closestCornersWithInventoryPriority":return Fp;default:return Rs}}function Ir(o,r,e,t,i="pointerWithin",n){return ed(i)(o,r,e,t,n)}function gt(o,r){let e=o.composedPath?o.composedPath():[o.target];for(let t of e)if(t instanceof HTMLElement&&t.tagName!=="SLOT"){if(t.matches(r)||t.hasAttribute("qti-draggable"))return t;let i=t.closest(r)||t.closest('[qti-draggable="true"]');if(i)return i}return null}function oo(o,r){let e=[];return o.forEach(t=>{let i=[];t.tagName.toLowerCase()==="slot"?i=t.assignedElements({flatten:!0}).filter(a=>a.getAttribute("identifier")===r):i=Array.from(t.querySelectorAll(`[identifier="${r}"]`)),e.push(...i)}),e}function td(o,r){let e=o.find(i=>i.getAttribute("identifier")===r);if(!e)return 1;let t=e.getAttribute("match-max");return t?parseInt(t,10)||0:1}function rd(o,r){let e=parseInt(o.getAttribute("match-max")||"1",10),t=Number.isNaN(e)?1:e;if(t===0)return!1;let i=o.querySelectorAll(r),n=o.querySelectorAll('[qti-draggable="true"]');return Math.max(i.length,n.length)>=t}function Bi(o,r){return o.reduce((e,t)=>{let i=t.querySelectorAll(r).length,n=t.querySelectorAll('[qti-draggable="true"]').length;return e+Math.max(i,n)},0)}function so(o,r){return o.map(e=>{let i=Array.from(e.querySelectorAll(r)).map(s=>s.getAttribute("identifier")).filter(s=>!!s),n=e.getAttribute("identifier");return i.map(s=>`${s} ${n}`)}).flat()}function id(o,r,e,t=typeof window<"u"?window:null){if(!o.length||!r.length||!t)return;let i=0,n=0;o.forEach(c=>{let p=c.getBoundingClientRect();i=Math.max(i,p.height),n=Math.max(n,p.width)});let s=r[0].parentElement,a=r[0].tagName==="QTI-SIMPLE-ASSOCIABLE-CHOICE",l=r[0].tagName==="QTI-GAP";if(a&&s){let c;if(s.clientWidth>0){let p=t.getComputedStyle(s),u=parseFloat(p.paddingLeft),h=parseFloat(p.paddingRight);c=s.clientWidth-u-h}else c=Math.min(t.innerWidth*.8,600);s.style.gridTemplateColumns=`repeat(auto-fit, minmax(calc(min(${c}px, ${n}px + 2 * var(--qti-dropzone-padding, 0.5rem))), 1fr))`}r.forEach(c=>{c.style.minHeight=`${i}px`,(a||l)&&(c.style.minWidth=`${n}px`);let p=c.shadowRoot?.querySelector('slot[part="dropslot"]');p&&(p.style.minHeight=`${i}px`)}),e.forEach(c=>{c.style.minHeight=`${i}px`})}Qc()||Yc();var nd=new WeakSet;function Up(o){!o||nd.has(o)||(o.addEventListener("touchmove",()=>{},{capture:!1,passive:!1}),nd.add(o))}var ao=(o,r,e,t='slot[part="drags"]',i="pointerWithin")=>{class n extends o{constructor(){super(...arguments);this.trackedDraggables=[];this.trackedDroppables=[];this.trackedDragContainers=[];this.allDropzones=[];this.collisionDetectionAlgorithm=i;this.dragState={dragging:!1,dragSource:null,dragClone:null,startOffset:{x:0,y:0},currentTarget:null,sourceDroppable:null,inputType:null};this.subscriptions=[];this.dragSubscriptions=[];this.lastPointerDownAt=0;this.lastTouchStartAt=0}connectedCallback(){super.connectedCallback(),Up(this.ownerDocument?.defaultView),this.setupDragDrop()}disconnectedCallback(){super.disconnectedCallback(),this.cleanup()}async setupDragDrop(){await this.updateComplete,this.cacheInteractiveElements(),this.afterCache(),this.setupDragObservables()}afterCache(){}cacheInteractiveElements(){let l=(m,b)=>Array.from(b?.querySelectorAll(m)??[]),c=l(r,this),p=l(r,this.shadowRoot),u=l('[qti-draggable="true"]:not([data-drag-clone])',this),h=l('[qti-draggable="true"]:not([data-drag-clone])',this.shadowRoot);this.trackedDraggables=Array.from(new Set([...c,...p,...u,...h]));let v=l(e,this),y=l(e,this.shadowRoot);this.trackedDroppables=Array.from(new Set([...v,...y]));let w=l(t,this),f=l(t,this.shadowRoot);this.trackedDragContainers=Array.from(new Set([...w,...f])),this.allDropzones=[...this.trackedDroppables,...this.trackedDragContainers],this.trackedDraggables.forEach(m=>{m.style.cursor="grab",m.style.userSelect="none",m.style.touchAction="none",m.style.webkitUserSelect="none",m.style.webkitTouchCallout="none",m.setAttribute("qti-draggable","true"),m.setAttribute("tabindex","0")})}setupDragObservables(){let l=this.shadowRoot;if(!l){console.error("\u274C [Observable DnD] No shadow root found!");return}let c=l.when("pointerdown").filter(y=>{if(!y.isTrusted)return!1;let w=gt(y,r),f=this.disabled||this.readonly,m=w?.hasAttribute("disabled")||w?.getAttribute("aria-disabled")==="true",b=Date.now()-this.lastTouchStartAt<50;return w&&y.isPrimary!==!1&&y.button===0&&!f&&!m&&!b}).subscribe(y=>{this.lastPointerDownAt=Date.now();let w=gt(y,r);if(!w){console.warn("\u26A0\uFE0F [Observable DnD] No draggable target found");return}y.pointerType==="touch"&&(y.preventDefault(),y.stopPropagation());let f=y.isTrusted?y.pointerType==="touch"?100:10:0;if(this.dragState.activationTimeout&&clearTimeout(this.dragState.activationTimeout),f===0){this.dragState.dragging||this.initiateDrag(w,y.clientX,y.clientY,y.pointerType,"pointer",y.pointerId,y.isTrusted);return}let m=()=>{this.dragState.activationTimeout&&(clearTimeout(this.dragState.activationTimeout),this.dragState.activationTimeout=void 0),document.removeEventListener("pointerup",m,!0),document.removeEventListener("pointercancel",m,!0)};document.addEventListener("pointerup",m,{once:!0,capture:!0}),document.addEventListener("pointercancel",m,{once:!0,capture:!0}),this.dragState.activationTimeout=window.setTimeout(()=>{this.dragState.activationTimeout=void 0,document.removeEventListener("pointerup",m,!0),document.removeEventListener("pointercancel",m,!0),this.dragState.dragging||this.initiateDrag(w,y.clientX,y.clientY,y.pointerType,"pointer",y.pointerId,y.isTrusted)},f)}),p=l.when("mousedown").filter(y=>{let w=gt(y,r),f=this.disabled||this.readonly,m=w?.hasAttribute("disabled")||w?.getAttribute("aria-disabled")==="true",b=y.button===0,q=Date.now()-this.lastPointerDownAt<50;return w&&b&&!f&&!m&&!q}).subscribe(y=>{let w=gt(y,r);!w||this.dragState.dragging||(y.preventDefault(),this.initiateDrag(w,y.clientX,y.clientY,"mouse","mouse",void 0,y.isTrusted))}),u=l.when("touchstart").filter(y=>{let w=gt(y,r),f=this.disabled||this.readonly,m=w?.hasAttribute("disabled")||w?.getAttribute("aria-disabled")==="true",b=!!(y.touches?.[0]||y.changedTouches?.[0]),q=Date.now()-this.lastPointerDownAt<50;return w&&b&&!f&&!m&&!q}).subscribe(y=>{let w=gt(y,r),f=y.touches?.[0]||y.changedTouches?.[0];!w||!f||this.dragState.dragging||(this.lastTouchStartAt=Date.now(),y.preventDefault(),y.stopPropagation(),this.initiateDrag(w,f.clientX,f.clientY,"touch","touch",void 0,y.isTrusted))}),h={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null},v=l.when("keydown").subscribe(y=>{let w=this.trackedDraggables.filter(m=>m.style.opacity!=="0"),f=[...this.trackedDroppables,...this.trackedDragContainers];if(h.dragging)switch(y.code){case"ArrowRight":case"ArrowDown":{y.preventDefault();let m=(h.dropIndex+1)%f.length;h={...h,dropIndex:m,dropElement:f[m]};break}case"ArrowLeft":case"ArrowUp":{y.preventDefault();let m=(h.dropIndex-1+f.length)%f.length;h={...h,dropIndex:m,dropElement:f[m]};break}case"Space":case"Enter":case"Tab":{y.preventDefault(),h.dragElement&&h.dropElement&&(this.allowDrop(h.dragElement,h.dropElement)||this.trackedDragContainers.includes(h.dropElement)?this.handleDrop(h.dragElement,h.dropElement):this.handleInvalidDrop(h.dragElement)),this.trackedDraggables.forEach(m=>m.removeAttribute("data-keyboard-dragging")),this.saveResponse(),h={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null};break}case"Escape":{y.preventDefault(),this.trackedDraggables.forEach(m=>m.removeAttribute("data-keyboard-dragging")),h={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null};break}}else{let m=gt(y,r),b=this.disabled||this.readonly,q=m?.hasAttribute("disabled")||m?.getAttribute("aria-disabled")==="true";m&&["Space","Enter"].includes(y.code)&&!b&&!q&&(y.preventDefault(),m.setAttribute("data-keyboard-dragging","true"),h={dragging:!0,dragElement:m,dragIndex:w.indexOf(m),dropIndex:0,dropElement:f[0]})}this.allDropzones.forEach(m=>m.removeAttribute("hover")),h.dragging&&h.dropElement&&(h.dropElement.setAttribute("hover",""),h.dropElement.hasAttribute("tabindex")&&h.dropElement.getAttribute("tabindex")!=="-1"&&h.dropElement.focus())});this.subscriptions.push(c,p,u,v)}initiateDrag(l,c,p,u,h="pointer",v,y){if(this.dragState.dragging){console.warn("\u26A0\uFE0F [Observable DnD] Already dragging, ignoring initiateDrag");return}if(l.hasAttribute("data-drag-clone")){console.warn("\u26A0\uFE0F [Observable DnD] Attempted to drag visual clone, ignoring");return}let w=this.trackedDroppables.some(b=>b.contains(l)),f=this.trackedDroppables.find(b=>b.contains(l))||null,m=l.getBoundingClientRect();this.dragState={dragging:!0,dragSource:l,dragClone:this.createDragClone(l,m),startOffset:{x:c-m.left,y:p-m.top},currentTarget:null,sourceDroppable:f,inputType:u,pointerId:v,startedFromTrustedEvent:y,initialCoordinates:{x:c,y:p}},w?(this.dragState.dragClone?.setAttribute("data-drag-origin","droppable"),l.remove(),this.cacheInteractiveElements(),f&&f.setAttribute("data-drag-source","true")):(this.dragState.dragClone?.setAttribute("data-drag-origin","inventory"),l.style.opacity="0",l.style.pointerEvents="none"),this.updateClonePosition(c,p),this.activateAllDroppables(),this.setupMoveObservables(u,h)}setupMoveObservables(l,c="pointer"){if(l==="touch"){if(c==="pointer")try{let A=this.dragState.dragSource,T=this.dragState.pointerId;A&&T!==void 0&&A.setPointerCapture&&A.setPointerCapture(T)}catch{}let b=A=>{A.cancelable&&(A.preventDefault(),c==="pointer"&&A.stopPropagation())};document.addEventListener("touchmove",b,{passive:!1,capture:!0}),document.addEventListener("touchstart",b,{passive:!1,capture:!0}),document.addEventListener("touchend",b,{passive:!1,capture:!0}),document.addEventListener("gesturestart",b,{passive:!1}),document.addEventListener("gesturechange",b,{passive:!1}),document.addEventListener("gestureend",b,{passive:!1});let q=()=>{if(document.removeEventListener("touchmove",b,{capture:!0}),document.removeEventListener("touchstart",b,{capture:!0}),document.removeEventListener("touchend",b,{capture:!0}),document.removeEventListener("gesturestart",b),document.removeEventListener("gesturechange",b),document.removeEventListener("gestureend",b),c==="pointer")try{let A=this.dragState.dragSource,T=this.dragState.pointerId;A&&T!==void 0&&A.releasePointerCapture&&A.releasePointerCapture(T)}catch{}};this.dragState.touchCleanup=q}let p=c==="mouse"?"mousemove":c==="touch"?"touchmove":"pointermove",u=c==="mouse"?"mouseup":c==="touch"?"touchend":"pointerup",h=b=>{let q=this.dragState.startedFromTrustedEvent;return q===void 0||b.isTrusted===q},v=document.when(p).takeUntil(document.when(u)).subscribe({next:b=>{if(h(b)){if(b.preventDefault(),b.stopPropagation(),c==="touch"){let q=b.touches?.[0]||b.changedTouches?.[0];if(!q)return;this.handleDragMove(q.clientX,q.clientY);return}if(c==="mouse"){let q=b;if(typeof q.buttons=="number"&&(q.buttons&1)!==1)return}this.handleDragMove(b.clientX,b.clientY)}}}),y=document.when(u).subscribe({next:b=>{h(b)&&(b.preventDefault(),b.stopPropagation(),this.handleDragEnd())}}),w=c==="touch"?document.when("touchcancel").subscribe({next:b=>{h(b)&&this.handleDragEnd()}}):c==="mouse"?null:document.when("pointercancel").subscribe({next:b=>{h(b)&&this.handleDragEnd()}}),f=document.when("keydown").filter(b=>b.key==="Escape").subscribe({next:b=>{h(b)&&this.handleDragEnd()}}),m=[v,y,f];w&&m.push(w),this.dragSubscriptions.push(...m)}handleDragMove(l,c){if(!this.dragState.dragging||!this.dragState.dragClone)return;this.updateClonePosition(l,c);let p=Ir(this.allDropzones,l,c,this.dragState.dragClone,this.collisionDetectionAlgorithm,this.trackedDragContainers),u=Date.now(),h=u-(this.dragState.lastTargetChangeTime||0);p!==this.dragState.currentTarget&&(p===null||h>=50)&&(this.allDropzones.forEach(y=>y.removeAttribute("hover")),p&&p.setAttribute("hover",""),this.dragState.currentTarget=p,this.dragState.lastTargetChangeTime=u)}handleDragEnd(){if(!this.dragState.dragging)return;let{dragSource:l,dragClone:c,currentTarget:p,sourceDroppable:u}=this.dragState,h=p;if(!h&&c){let f=c.getBoundingClientRect(),m=this.dragState.initialCoordinates?.x??f.left+f.width/2,b=this.dragState.initialCoordinates?.y??f.top+f.height/2;h=Ir(this.allDropzones,m,b,c,this.collisionDetectionAlgorithm,this.trackedDragContainers)}let v=h?.hasAttribute("disabled")&&h.hasAttribute("data-drag-source");!!l&&!!h&&this.allowDrop(l,h)&&(!h.hasAttribute("disabled")||v)&&l&&h?this.handleDrop(l,h):this.handleInvalidDrop(l),c&&c.remove(),this.dragState.touchCleanup&&this.dragState.touchCleanup(),this.resetDragState(),this.deactivateAllDroppables(),this.saveResponse(),u&&u.removeAttribute("data-drag-source"),this.cacheInteractiveElements();let w=this.checkAllMaxAssociations;typeof w=="function"&&w.call(this)}allowDrop(l,c){return this.trackedDroppables.includes(c)||this.trackedDragContainers.includes(c)}handleInvalidDrop(l){l&&(l.style.opacity="1.0",l.style.pointerEvents="auto")}createDragClone(l,c){let p=l.cloneNode(!0),u=window.getComputedStyle(l);for(let h=0;h<u.length;h++){let v=u[h];p.style.setProperty(v,u.getPropertyValue(v))}return p.style.position="fixed",p.style.width=`${c.width}px`,p.style.height=`${c.height}px`,p.style.zIndex="9999",p.style.pointerEvents="none",p.style.touchAction="none",p.style.userSelect="none",p.style.opacity="0.8",p.removeAttribute("qti-draggable"),p.removeAttribute("tabindex"),p.setAttribute("data-drag-clone","true"),document.body.appendChild(p),p}updateClonePosition(l,c){if(!this.dragState.dragClone)return;let{startOffset:p}=this.dragState,u=l-p.x,h=c-p.y;this.dragState.dragClone.style.left=`${u}px`,this.dragState.dragClone.style.top=`${h}px`}activateAllDroppables(){this.setInternalsState("--dragzone-enabled",!0),this.setInternalsState("--dragzone-active",!0),this.allDropzones.forEach(l=>{l.setAttribute("enabled",""),l.setAttribute("active","")})}deactivateAllDroppables(){this.setInternalsState("--dragzone-enabled",!1),this.setInternalsState("--dragzone-active",!1),this.allDropzones.forEach(l=>{l.removeAttribute("enabled"),l.removeAttribute("active"),l.removeAttribute("hover")})}resetDragState(){if(this.dragState.activationTimeout&&clearTimeout(this.dragState.activationTimeout),this.dragState.touchCleanup)try{this.dragState.touchCleanup()}catch(l){console.warn("\u26A0\uFE0F [Observable DnD] Error during touch cleanup:",l)}this.dragSubscriptions.forEach(l=>{try{l&&typeof l.unsubscribe=="function"&&l.unsubscribe()}catch(c){console.warn("\u26A0\uFE0F [Observable DnD] Error unsubscribing:",c)}}),this.dragSubscriptions=[],this.dragState={dragging:!1,dragSource:null,dragClone:null,startOffset:{x:0,y:0},currentTarget:null,sourceDroppable:null,inputType:null,pointerId:void 0,startedFromTrustedEvent:void 0,touchCleanup:void 0}}setInternalsState(l,c){let p=this._internals;p?.states&&(c?p.states.add(l):p.states.delete(l))}cleanup(){this.subscriptions.forEach(l=>{try{l.unsubscribe()}catch{}}),this.subscriptions=[],this.dragState.dragClone&&this.dragState.dragClone.remove(),this.resetDragState()}}return n};var od={duration:250,easing:"ease",fill:"both"};function ks(o){let r=o.getBoundingClientRect();return{left:r.left,top:r.top,width:r.width,height:r.height}}function bt(o){let r=new Map;return o.forEach(e=>{r.set(e,ks(e))}),r}function sd(o,r){return{deltaX:o.left-r.left,deltaY:o.top-r.top,deltaW:o.width/r.width,deltaH:o.height/r.height}}function ad(o,r,e={}){let t=ks(o),{deltaX:i,deltaY:n,deltaW:s,deltaH:a}=sd(r,t);if(i===0&&n===0&&s===1&&a===1)return null;let{duration:l,easing:c,fill:p}={...od,...e};return o.animate([{transformOrigin:"top left",transform:`translate(${i}px, ${n}px) scale(${s}, ${a})`},{transformOrigin:"top left",transform:"none"}],{duration:l,easing:c,fill:p})}function vt(o,r={}){let e=new Map;return o.forEach((t,i)=>{if(!(i instanceof HTMLElement))return;let n=ad(i,t,r);n&&e.set(i,n)}),e}var Te=(o,r,e,t='slot[part="drags"]',i="closestCornersWithInventoryPriority")=>{let n=ao(o,r,e,t,i);class s extends n{constructor(){super(...arguments);this.configuration={copyStylesDragClone:!0,dragCanBePlacedBack:!0,dragOnClick:!1};this.minAssociations=1;this._maxAssociations=0;this._maxAssociationsDefaultApplied=!1;this._response=[];this._dropBlockedDueToMax=!1;this.flipAnimationConfig={duration:200,easing:"ease"};this._enableFlipAnimations=!0;this.autoSizeDropzones=!1}get maxAssociations(){if(!this._maxAssociationsDefaultApplied){this._maxAssociationsDefaultApplied=!0;let c=this.tagName?.toLowerCase()||"";(c==="qti-graphic-gap-match-interaction"||c==="qti-gap-match-interaction")&&!this.hasAttribute("max-associations")&&this._maxAssociations===0&&(this._maxAssociations=1)}return this._maxAssociations}set maxAssociations(c){let p=this._maxAssociations;this._maxAssociations=c,this.requestUpdate("maxAssociations",p)}set disableAnimations(c){this._enableFlipAnimations=!c}get disableAnimations(){return!this._enableFlipAnimations}get enableFlipAnimations(){return this._enableFlipAnimations}get response(){let c=this.getResponse,p=typeof c=="function"?c.call(this):void 0;return(Array.isArray(p)?p:(this.cacheInteractiveElements(),so(this.trackedDroppables,r))).join(",")}set response(c){if(Array.isArray(c)){let p=this.getValue,u=typeof p=="function"?p.call(this,c):c,h=Array.isArray(u)?u:typeof u=="string"&&u.length>0?[u]:[];this.reset(!1),h.forEach(w=>this.placeResponse(w));let v=this.getResponse,y=typeof v=="function"?v.call(this):void 0;this._response=Array.isArray(y)?y:(this.cacheInteractiveElements(),so(this.trackedDroppables,r))}else this._response=typeof c=="string"&&c.length>0?[c]:[];this._internals.setFormValue(JSON.stringify(this._response))}afterCache(){this.applyConfiguredChoicesContainerWidth(),this.updateMinDimensionsForDropZones()}applyConfiguredChoicesContainerWidth(){let c=this.dataset.choicesContainerWidth;c&&this.trackedDroppables.forEach(p=>{p.style.width=`${c}px`,p.style.boxSizing="border-box"})}shouldTreatBlockedMaxAsInvalid(){return!0}shouldReturnToInventoryOnInventoryDrop(){return!1}getFirstMessageAttribute(c){for(let u of c){let h=this.getAttribute(u);if(h&&h.trim().length>0)return h}let p=c.map(u=>u.toLowerCase());for(let u of Array.from(this.attributes))if(p.includes(u.name.toLowerCase())&&u.value.trim().length>0)return u.value;return null}allowDrop(c,p){if(this.trackedDragContainers.includes(p))return!0;let u=this.trackedDroppables.includes(p),h=p.hasAttribute("disabled"),v=p.hasAttribute("data-drag-source");return u&&(!h||v)}handleDrop(c,p){let u=this.dragState.dragClone?.getBoundingClientRect();this.dropDraggableInDroppable(c,p,u);let h=c.getAttribute("identifier");h&&this.updateInventoryBasedOnMatchMax(h);let v=Bi(this.trackedDroppables,r);this.maxAssociations>0&&v>this.maxAssociations&&(this._dropBlockedDueToMax=!0,this.validate(),this.reportValidity())}handleInvalidDrop(c){let p=this.dragState.sourceDroppable,u=this.dragState.currentTarget,h=!u,v=this.trackedDragContainers[0]||null;if(!c)return;p&&h&&v&&this.configuration.dragCanBePlacedBack!==!1?this.dropDraggableInDroppable(c,v):p&&this.trackedDroppables.includes(p)?this.dropDraggableInDroppable(c,p):c.style.opacity==="0"&&(this.restoreInventoryItem(c),this.cacheInteractiveElements(),this.checkAllMaxAssociations());let y=Bi(this.trackedDroppables,r),w=this.maxAssociations>0&&y>=this.maxAssociations,f=!!u&&u.hasAttribute("disabled")&&!u.hasAttribute("data-drag-source");this._dropBlockedDueToMax=f&&w,this.validate(),this.reportValidity()}updateMinDimensionsForDropZones(){this.trackedDraggables.length!==0&&id(this.trackedDraggables,this.trackedDroppables,this.trackedDragContainers)}restoreInventoryItem(c){c.style.opacity="1.0",c.style.display="",c.style.position="",c.style.pointerEvents="auto"}placeResponse(c){let[p,...u]=c.split(" ").reverse(),h=this.trackedDroppables.find(v=>v.getAttribute("identifier")===p);h&&u.forEach(v=>{if(!v)return;let w=oo(this.trackedDragContainers,v).at(0)||this.trackedDraggables.find(f=>f.getAttribute("identifier")===v);w&&this.dropDraggableInDroppable(w,h)})}dropDraggableInDroppable(c,p,u){if(this.trackedDragContainers.includes(p)){if(!this.dragState.sourceDroppable){if(this.shouldReturnToInventoryOnInventoryDrop()){this.returnToInventory(c),this._dropBlockedDueToMax=!1,this.validate();return}this.restoreInventoryItem(c),this.cacheInteractiveElements(),this.checkAllMaxAssociations(),this._dropBlockedDueToMax=!1,this.validate();return}let A=c.getAttribute("identifier");c.remove(),A&&this.restoreOriginalInInventory(A),this.cacheInteractiveElements(),this.checkAllMaxAssociations(),this._dropBlockedDueToMax=!1,this.validate();return}let v=parseInt(p.getAttribute("match-max")||"1",10),y=Number.isNaN(v)?1:v,w=y===0||y>1,f=Array.from(p.querySelectorAll('[qti-draggable="true"]')),m=this.enableFlipAnimations&&f.length>0?bt(f):null;if(!w){let A=p.querySelector(r)||p.querySelector('[qti-draggable="true"]');if(A){let T=A.getAttribute("identifier");A.remove(),T&&this.restoreOriginalInInventory(T)}}let b=c.cloneNode(!0);b.removeAttribute("style"),b.removeAttribute("data-keyboard-dragging"),b.setAttribute("qti-draggable","true"),b.setAttribute("tabindex","0"),p.tagName==="SLOT"?b.setAttribute("slot",p.getAttribute("name")||""):p.tagName==="QTI-SIMPLE-ASSOCIABLE-CHOICE"?(b.setAttribute("slot","qti-simple-associable-choice"),p.appendChild(b),p.setAttribute("data-has-drop","true")):p.appendChild(b),m&&this.enableFlipAnimations&&vt(m,this.flipAnimationConfig),u&&this.enableFlipAnimations&&requestAnimationFrame(()=>{let A=b.getBoundingClientRect(),T=u.left-A.left,M=u.top-A.top;(T!==0||M!==0)&&b.animate([{transform:`translate(${T}px, ${M}px)`,opacity:.8},{transform:"translate(0, 0)",opacity:1}],{duration:this.flipAnimationConfig.duration||200,easing:this.flipAnimationConfig.easing||"ease",fill:"both"})});let q=c.getAttribute("identifier");q&&this.updateInventoryBasedOnMatchMax(q),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}returnToInventory(c){let p=c.getAttribute("identifier");p&&(this.trackedDroppables.forEach(u=>{Array.from(u.querySelectorAll(`[identifier="${p}"][qti-draggable="true"]`)).forEach(v=>{v.remove(),u.tagName==="QTI-SIMPLE-ASSOCIABLE-CHOICE"&&u.removeAttribute("data-has-drop")})}),this.restoreOriginalInInventory(p)),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}restoreOriginalInInventory(c){let p=oo(this.trackedDragContainers,c),u=[];this.trackedDragContainers.forEach(v=>{u.push(...Array.from(v.querySelectorAll('[qti-draggable="true"]')))});let h=this.enableFlipAnimations&&u.length>0?bt(u):null;p.forEach(v=>{v.style.opacity="1.0",v.style.pointerEvents="auto",v.style.display="",v.style.visibility="visible",v.style.setProperty("opacity","1.0","important"),v.style.setProperty("pointer-events","auto","important")}),h&&this.enableFlipAnimations&&vt(h,this.flipAnimationConfig)}updateInventoryBasedOnMatchMax(c){let p=oo(this.trackedDragContainers,c),u=td(this.trackedDraggables,c),h=this.trackedDroppables.reduce((v,y)=>{let w=y.querySelectorAll(`[identifier="${c}"]`);return v+w.length},0);p.forEach(v=>{u!==0&&h>=u?(v.style.opacity="0.0",v.style.pointerEvents="none"):(v.style.opacity="1.0",v.style.pointerEvents="auto")})}checkAllMaxAssociations(){let c=Bi(this.trackedDroppables,r),p=this.maxAssociations>0&&c>=this.maxAssociations;this.trackedDroppables.forEach(u=>{let h=u.hasAttribute("data-drag-source"),v=rd(u,r);(p||v)&&!h?u.setAttribute("disabled",""):u.removeAttribute("disabled")})}saveResponse(c){let p=this.getResponse,u=c??(typeof p=="function"?p.call(this):void 0),h=Array.isArray(u)?u:typeof u=="string"?[u]:(this.cacheInteractiveElements(),so(this.trackedDroppables,r));this._response=h,this._internals.setFormValue(JSON.stringify(this._response)),this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:h}})),this.requestUpdate()}reset(c=!0){this.trackedDroppables.forEach(p=>{Array.from(p.querySelectorAll(r)).forEach(h=>h.remove()),p.tagName==="QTI-SIMPLE-ASSOCIABLE-CHOICE"&&p.removeAttribute("data-has-drop")}),this.trackedDraggables.forEach(p=>{let u=p.getAttribute("identifier");u&&this.restoreOriginalInInventory(u)}),this.resetDragState(),this.cacheInteractiveElements(),this._response=[],this._internals.setFormValue(JSON.stringify(this._response)),c&&this.saveResponse()}validate(){let c=Bi(this.trackedDroppables,r),p=this.maxAssociations>0&&c>=this.maxAssociations,u=this.maxAssociations>0&&c>this.maxAssociations,h=this.minAssociations>0&&c<this.minAssociations,v="",y=!0;u?(v=this.getFirstMessageAttribute(["data-max-associations-message","data-max-selections-message"])||this.dataset.maxAssociationsMessage||this.dataset.maxSelectionsMessage||`You've selected too many associations. Maximum allowed is ${this.maxAssociations}.`,y=!1):p&&this._dropBlockedDueToMax&&this.shouldTreatBlockedMaxAsInvalid()?(v=this.getFirstMessageAttribute(["data-max-associations-message","data-max-selections-message"])||this.dataset.maxAssociationsMessage||this.dataset.maxSelectionsMessage||`You've selected too many associations. Maximum allowed is ${this.maxAssociations}.`,y=!1):h?(v=this.getFirstMessageAttribute(["data-min-associations-message","data-min-selections-message"])||this.dataset.minAssociationsMessage||this.dataset.minSelectionsMessage||`Please select at least ${this.minAssociations} ${this.minAssociations===1?"association":"associations"}.`,y=!1,this._dropBlockedDueToMax=!1):this._dropBlockedDueToMax=!1;let w=this.trackedDroppables[0]??this.trackedDraggables[0]??this;return this._internals.setValidity(y?{}:{customError:!0},v,w),y}reportValidity(){let c=this._internals.reportValidity(),p=this.shadowRoot?.querySelector("#validation-message");return p&&(c?(p.textContent="",p.style.display="none"):(p.textContent=this._internals.validationMessage,p.style.setProperty("display","block","important"))),c}}return d([g({attribute:!1,type:Object})],s.prototype,"configuration",2),d([g({type:Number,reflect:!0,attribute:"min-associations"})],s.prototype,"minAssociations",2),d([g({type:Number,reflect:!0,attribute:"max-associations"})],s.prototype,"maxAssociations",1),d([g({type:Boolean,attribute:"disable-animations"})],s.prototype,"disableAnimations",1),d([g({type:Boolean,attribute:"auto-size-dropzones"})],s.prototype,"autoSizeDropzones",2),s};var lo=class{getInsertPosition(r,e,t,i,n){let s=r.indexOf(t);if(s===-1)return null;let a=t.getBoundingClientRect(),l=(n-a.top)/a.height,p=Math.min(1,Math.max(0,l))>.5;return{index:s,placeAfter:p}}};var ld=new lo;var Bp={borderStyle:"2px dashed",borderColor:"var(--qti-drop-placeholder, #c1c1c1)",background:"transparent",transitionDuration:150};function zi(){return{placeholder:null,lastHoverTarget:null,lastPlacement:null,sortContainer:null}}function co(o){o.placeholder?.remove(),o.placeholder=null,o.lastHoverTarget=null,o.lastPlacement=null,o.sortContainer=null}function po(o,r,e={}){let t={...Bp,...e},i=document.createElement("div");return i.setAttribute("data-drop-placeholder","true"),i.style.width=`${r.width}px`,i.style.height=`${r.height}px`,i.style.margin=window.getComputedStyle(o).margin,i.style.boxSizing="border-box",i.style.border=`${t.borderStyle} ${t.borderColor}`,i.style.borderRadius=getComputedStyle(o).borderRadius,i.style.background=t.background,i.style.transition=`transform ${t.transitionDuration}ms ease`,i.style.pointerEvents="none",i}function Ms(o,r){for(let e of r)if(e.contains(o)&&e!==o)return e;return null}var Ie=(o,r='[qti-draggable="true"]')=>{class e extends o{constructor(){super(...arguments);this.#e=null;this.#t=zi();this.#r={hoveredSlot:null,originalPositions:new Map};this.#i=new Set;this.allowReorder=!0;this.sortablePlaceholderConfig={};this.sortableAnimationConfig={duration:150,easing:"ease"}}#e;#t;#r;#i;get isDraggingFromSlot(){return this.#e!==null}findContainingDroppable(n){return Ms(n,this.trackedDroppables)}#n(n){return n.querySelector(r)}#o(n){let s=this.#s(n);return s===0||s>1}#s(n){let s=parseInt(n.getAttribute("match-max")||"1",10);return Number.isNaN(s)?1:s}#a(n){return n.querySelectorAll(r).length}#c(n){let s=this.#s(n);return s===0?!1:this.#a(n)>=s}#d(){this.#r={hoveredSlot:null,originalPositions:new Map}}#l(n){if(!this.#e||n===this.#e){this.#u();return}if(this.#r.hoveredSlot===n)return;this.#u();let s=this.#n(n);if(!s){this.#t.placeholder&&n.appendChild(this.#t.placeholder),this.#r.hoveredSlot=n;return}if(this.#o(n)){if(this.#c(n)){this.#t.placeholder&&this.#e&&this.#e.appendChild(this.#t.placeholder),this.#r.hoveredSlot=null;return}this.#t.placeholder&&n.appendChild(this.#t.placeholder),this.#r.hoveredSlot=n;return}let l=bt([s]);this.#r.originalPositions.set(s,n),this.#t.placeholder&&this.#t.placeholder.parentElement&&this.#t.placeholder.remove(),this.#e.appendChild(s),this.#t.placeholder&&n.appendChild(this.#t.placeholder),this.#r.hoveredSlot=n,vt(l,this.sortableAnimationConfig)}#u(){if(this.#r.originalPositions.size===0&&this.#r.hoveredSlot===null)return;let n=Array.from(this.#r.originalPositions.keys()),s=n.length>0?bt(n):null;for(let[a,l]of this.#r.originalPositions)l.appendChild(a);this.#t.placeholder&&this.#e&&this.#e.appendChild(this.#t.placeholder),s&&vt(s,this.sortableAnimationConfig),this.#r.originalPositions.clear(),this.#r.hoveredSlot=null}initiateDrag(n,s,a,l,...c){this.#e=null,this.#t=zi(),this.#d();let p=this.findContainingDroppable(n);if(p&&this.allowReorder){this.#e=p,this.#t.sortContainer=p;let h=n.getBoundingClientRect();this.#t.placeholder=po(n,h,this.sortablePlaceholderConfig);let v=n.getAttribute("slot");v&&this.#t.placeholder.setAttribute("slot",v),this.#t.placeholder.style.visibility="hidden",p.appendChild(this.#t.placeholder),this.trackedDroppables.forEach(y=>{if(y!==p&&y.hasAttribute("disabled")){if(this.#o(y)&&this.#c(y))return;y.removeAttribute("disabled"),this.#i.add(y)}})}let[u]=c;super.initiateDrag(n,s,a,l,u)}cleanupSortableState(n=!0){if(n)for(let[s,a]of this.#r.originalPositions)a.appendChild(s);this.#t.placeholder&&this.#t.placeholder.remove(),co(this.#t),this.#i.clear(),this.#e=null,this.#d()}onSortableDragMove(n,s){if(!this.isDraggingFromSlot)return;let a=Ir(this.trackedDroppables,n,s,this.dragState.dragClone,this.collisionDetectionAlgorithm);a?this.#l(a):this.#u()}handleDragMove(n,s){Object.getPrototypeOf(e.prototype).handleDragMove?.call(this,n,s),this.onSortableDragMove(n,s)}allowDrop(n,s){return this.isDraggingFromSlot&&this.trackedDroppables.includes(s)?this.#o(s)?!this.#c(s):!0:this.isDraggingFromSlot&&this.trackedDragContainers.includes(s)?!0:super.allowDrop(n,s)}handleDrop(n,s){super.handleDrop(n,s),this.cleanupSortableState(!1)}handleInvalidDrop(n){this.cleanupSortableState(),super.handleInvalidDrop(n)}}return e};var cd=C`
4034
4034
  :host {
4035
4035
  display: block; /* necessary to calculate scaling position */
4036
4036
  }
@@ -4078,7 +4078,7 @@ div.full-correct-response-inline {
4078
4078
  rgb(0 0 0 / 0%) calc(50% + 1px)
4079
4079
  );
4080
4080
  }
4081
- `;var Rp=Ae(V,"qti-simple-associable-choice",".dl","slot[name='qti-simple-associable-choice']","pointerWithin"),Ui=class extends Te(Rp,'[qti-draggable="true"]'){constructor(){super();this._childrenMap=[];this._registerChoiceHandler=this._registerChoice.bind(this),this.addEventListener("register-qti-simple-associable-choice",this._registerChoiceHandler)}static{this.styles=Jc}_registerChoice(e){let t=e.composedPath()[0];if(this.shadowRoot?.contains(t))return;let i=t;this._childrenMap.includes(i)||(this._childrenMap=[...this._childrenMap,i])}getResponse(){let e=Math.ceil(this._childrenMap.length/2),t=[];for(let i=0;i<e;i++){let n=this.shadowRoot?.querySelector(`.dl[identifier="droplist${i}_left"]`),o=this.shadowRoot?.querySelector(`.dl[identifier="droplist${i}_right"]`),a=n?.querySelector('[qti-draggable="true"]')?.getAttribute("identifier"),l=o?.querySelector('[qti-draggable="true"]')?.getAttribute("identifier");a&&l&&t.push(`${a} ${l}`)}return t}getValue(e){return e?.flatMap((t,i)=>{let n=t.split(" ");return n.length!==2?[]:[`${n[0]} droplist${i}_left`,`${n[1]} droplist${i}_right`]})??[]}render(){return x` <slot name="prompt"></slot>
4081
+ `;var Qp=Te(V,"qti-simple-associable-choice",".dl","slot[name='qti-simple-associable-choice']","pointerWithin"),ji=class extends Ie(Qp,'[qti-draggable="true"]'){constructor(){super();this._childrenMap=[];this._registerChoiceHandler=this._registerChoice.bind(this),this.addEventListener("register-qti-simple-associable-choice",this._registerChoiceHandler)}static{this.styles=cd}_registerChoice(e){let t=e.composedPath()[0];if(this.shadowRoot?.contains(t))return;let i=t;this._childrenMap.includes(i)||(this._childrenMap=[...this._childrenMap,i])}getResponse(){let e=Math.ceil(this._childrenMap.length/2),t=[];for(let i=0;i<e;i++){let n=this.shadowRoot?.querySelector(`.dl[identifier="droplist${i}_left"]`),s=this.shadowRoot?.querySelector(`.dl[identifier="droplist${i}_right"]`),a=n?.querySelector('[qti-draggable="true"]')?.getAttribute("identifier"),l=s?.querySelector('[qti-draggable="true"]')?.getAttribute("identifier");a&&l&&t.push(`${a} ${l}`)}return t}getValue(e){return e?.flatMap((t,i)=>{let n=t.split(" ");return n.length!==2?[]:[`${n[0]} droplist${i}_left`,`${n[1]} droplist${i}_right`]})??[]}render(){return x` <slot name="prompt"></slot>
4082
4082
  <slot name="qti-simple-associable-choice"></slot>
4083
4083
  <div part="drop-container">
4084
4084
  ${this._childrenMap.length>0&&Array.from(Array(Math.ceil(this._childrenMap.length/2)).keys()).map((e,t)=>x`<div part="associables-container">
@@ -4087,7 +4087,7 @@ div.full-correct-response-inline {
4087
4087
  </div>`)}
4088
4088
 
4089
4089
  <div role="alert" part="message" id="validation-message"></div>
4090
- </div>`}updated(e){super.updated(e),e.has("_childrenMap")&&this.cacheInteractiveElements()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("register-qti-simple-associable-choice",this._registerChoiceHandler)}};d([M()],Ui.prototype,"_childrenMap",2);customElements.define("qti-associate-interaction",Ui);var vt=(s,r)=>{class e extends s{constructor(){super(...arguments);this._choiceElements=[];this._mutationObserver=null;this._validationMessageShown=!1;this.minChoices=0;this.maxChoices=1;this._handleDisabledChange=(n,o)=>{this._choiceElements.forEach(a=>a.disabled=o)};this._handleReadonlyChange=(n,o)=>{this._choiceElements.forEach(a=>a.readonly=o)};this.response="";this._handleValueChange=()=>{this._internals.setFormValue(this.value),this._updateChoiceSelection()}}_handleMaxChoicesChange(n,o){this._determineInputType()}get value(){return Array.isArray(this.response)&&this.response.length===0||this.response===""?null:Array.isArray(this.response)?this.response.join(","):this.response}set value(n){this.maxChoices>1&&(typeof n=="string"||n===null)?this.response=n?n.toString().split(","):[]:this.response=n||""}toggleInternalCorrectResponse(n){let o=this.correctResponse;if(o){let a=Array.isArray(o)?o:[o];this._choiceElements.forEach(l=>{l.internals.states.delete("correct-response"),l.internals.states.delete("incorrect-response"),n&&a.length>0&&(a.includes(l.identifier)?l.internals.states.add("correct-response"):l.internals.states.add("incorrect-response"))})}}toggleCandidateCorrection(n){let o=this.correctResponse;if(!o)return;let a=Array.isArray(o)?o:[o],l=this.response,c=Array.isArray(l)?l:l?[l]:[];this._choiceElements.forEach(p=>{p.internals.states.delete("candidate-correct"),p.internals.states.delete("candidate-incorrect"),n&&c.includes(p.identifier)&&(a.includes(p.identifier)?p.internals.states.add("candidate-correct"):p.internals.states.add("candidate-incorrect"))}),super.toggleCandidateCorrection(n)}connectedCallback(){super.connectedCallback(),this.addEventListener(`activate-${r}`,this._choiceElementSelectedHandler),this._mutationObserver=new MutationObserver(()=>this._syncChoicesFromDOM()),this._mutationObserver.observe(this,{childList:!0,subtree:!0}),this._syncChoicesFromDOM()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`activate-${r}`,this._choiceElementSelectedHandler),this._mutationObserver&&(this._mutationObserver.disconnect(),this._mutationObserver=null)}_syncChoicesFromDOM(){let n=new Set(this._choiceElements);this._choiceElements=Array.from(this.querySelectorAll(r)),this._choiceElements.forEach(a=>{n.has(a)||(this.disabled&&(a.disabled=!0),a.readonly=this.readonly,a.internals&&!a.internals.ariaChecked&&(a.internals.ariaChecked="false"),this._setInputType(a))});let o=new Set(this._choiceElements.map(a=>a.identifier));if(Array.isArray(this.response)){let a=this.response.filter(l=>o.has(l));a.length!==this.response.length&&(this.response=a)}else this.response&&!o.has(this.response)&&(this.response="");this._updateChoiceSelection()}validate(){let o=this._choiceElements.filter(p=>this._getChoiceChecked(p)).length,a=!0,l="";this.maxChoices!==0&&o>this.maxChoices?(a=!1,l=this.dataset.maxSelectionsMessage||`Please select no more than ${this.maxChoices} ${this.maxChoices===1?"option":"options"}.`):o<this.minChoices&&(a=!1,l=this.dataset.minSelectionsMessage||`Please select at least ${this.minChoices} ${this.minChoices===1?"option":"options"}.`);let c=this._choiceElements.find(p=>this.contains(p))||this;return this._internals.setValidity(a?{}:{customError:!0},l,c),a}reportValidity(){return this._validationMessageElement&&(this._internals.validity.valid?(this._validationMessageElement.textContent="",this._validationMessageElement.style.display="none"):(this._validationMessageElement.textContent=this._internals.validationMessage,this._validationMessageElement.style.setProperty("display","block","important"),this._validationMessageShown=!0)),this._internals.validity.valid}_determineInputType(){this._choiceElements.forEach(n=>{this._setInputType(n)})}async _setInputType(n){if(this._internals.role=this.maxChoices===1?"radiogroup":null,n.internals){let o=this.maxChoices===1?"radio":"checkbox";n.internals.role=o,n.internals.states.delete(o==="radio"?"checkbox":"radio"),n.internals.states.add(o)}}_choiceElementSelectedHandler(n){this._toggleChoiceChecked(n.target),this.maxChoices===1?this._choiceElements.forEach(o=>{o.identifier!==n.detail.identifier&&this._setChoiceChecked(o,!1)}):this.maxChoices!==0&&this._configContext?.disableAfterIfMaxChoicesReached&&(this._choiceElements.filter(a=>this._getChoiceChecked(a)).length>=this.maxChoices?this._choiceElements.forEach(a=>{this._getChoiceChecked(a)||(a.disabled=!0)}):this._choiceElements.forEach(a=>a.disabled=!1)),this._handleChoiceSelection()}_setChoiceChecked(n,o){n.internals?.states&&(o?(n.internals.states.add("--checked"),n.internals.ariaChecked="true"):(n.internals.states.delete("--checked"),n.internals.ariaChecked="false"))}_getChoiceChecked(n){return n.internals.states.has("--checked")}_toggleChoiceChecked(n){let o=this._getChoiceChecked(n);this._setChoiceChecked(n,!o)}_handleChoiceSelection(){let o=this._choiceElements.filter(a=>this._getChoiceChecked(a)).map(a=>a.identifier);this.response=this.maxChoices===1?o[0]||"":o,this.validate(),this._validationMessageShown&&(this.reportValidity(),this._internals.validity.valid&&(this._validationMessageShown=!1)),this.saveResponse(this.response)}_updateChoiceSelection(){let n=Array.isArray(this.response)?this.response:[this.response];this._choiceElements.forEach(o=>{let a=n.includes(o.identifier);this._setChoiceChecked(o,a)})}}return d([Qt("#validation-message")],e.prototype,"_validationMessageElement",2),d([g({type:Number,attribute:"min-choices"})],e.prototype,"minChoices",2),d([g({type:Number,attribute:"max-choices"})],e.prototype,"maxChoices",2),d([B("maxChoices")],e.prototype,"_handleMaxChoicesChange",1),d([B("disabled",{waitUntilFirstUpdate:!0})],e.prototype,"_handleDisabledChange",2),d([B("readonly",{waitUntilFirstUpdate:!0})],e.prototype,"_handleReadonlyChange",2),d([M()],e.prototype,"response",2),d([B("response",{waitUntilFirstUpdate:!0})],e.prototype,"_handleValueChange",2),d([M(),$({context:ge,subscribe:!0})],e.prototype,"_configContext",2),e};var Kc=(s,r)=>{class e extends s{#e=[];#t=["qti-labels-none","qti-labels-decimal","qti-labels-lower-alpha","qti-labels-upper-alpha"];#r=["qti-labels-suffix-none","qti-labels-suffix-period","qti-labels-suffix-parenthesis"];#i=null;set class(i){this.#e=this.#n(i),this.#o()}get class(){return this.#e.join(" ")}attributeChangedCallback(i,n,o){super.attributeChangedCallback(i,n,o),i==="class"&&n!==o&&(this.class=o??"")}updated(i){super.updated(i),this.#o()}connectedCallback(){super.connectedCallback(),this.class=this.getAttribute("class")??"",this.#i=new MutationObserver(i=>{i.some(n=>n.type==="childList"||n.type==="attributes"&&n.attributeName==="style")&&this.#o()}),this.#i.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]})}disconnectedCallback(){super.disconnectedCallback(),this.#i?.disconnect(),this.#i=null}#n(i){return i?i.split(/\s+/).map(n=>n.trim()).filter(Boolean).filter((n,o,a)=>a.indexOf(n)===o):[]}#o(){let i=Array.from(this.querySelectorAll("qti-simple-choice")).map(l=>l),n=this.#s(i),o=this.#a(),a=this.#c();n.forEach((l,c)=>{l.marker=this.#d(c+1,o,a)})}#s(i){return i.map((n,o)=>{let a=Number(n.style.order);return{el:n,order:Number.isFinite(a)?a:o+1,index:o}}).sort((n,o)=>n.order-o.order||n.index-o.index).map(n=>n.el)}#a(){return this.#e.filter(i=>this.#t.includes(i)).pop()??null}#c(){return this.#e.filter(i=>this.#r.includes(i)).pop()??null}#d(i,n,o){let a=n;if(!a&&o&&o!=="qti-labels-suffix-none"&&(a="qti-labels-upper-alpha"),!a||a==="qti-labels-none")return"";let l="";switch(a){case"qti-labels-decimal":l=`${i}`;break;case"qti-labels-lower-alpha":l=this.#l(i,"lower");break;case"qti-labels-upper-alpha":l=this.#l(i,"upper");break}return o==="qti-labels-suffix-period"?`${l}.`:o==="qti-labels-suffix-parenthesis"?`${l})`:l}#l(i,n){let o=i,a="",l=n==="lower"?97:65;for(;o>0;)o-=1,a=String.fromCharCode(l+o%26)+a,o=Math.floor(o/26);return a}}return d([g({type:String,attribute:"class"})],e.prototype,"class",1),e};var Zc=C`
4090
+ </div>`}updated(e){super.updated(e),e.has("_childrenMap")&&this.cacheInteractiveElements()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("register-qti-simple-associable-choice",this._registerChoiceHandler)}};d([k()],ji.prototype,"_childrenMap",2);customElements.define("qti-associate-interaction",ji);var yt=(o,r)=>{class e extends o{constructor(){super(...arguments);this._choiceElements=[];this._mutationObserver=null;this._validationMessageShown=!1;this.minChoices=0;this.maxChoices=1;this._handleDisabledChange=(n,s)=>{this._choiceElements.forEach(a=>a.disabled=s)};this._handleReadonlyChange=(n,s)=>{this._choiceElements.forEach(a=>a.readonly=s)};this.response="";this._handleValueChange=()=>{this._internals.setFormValue(this.value),this._updateChoiceSelection()}}_handleMaxChoicesChange(n,s){this._determineInputType()}get value(){return Array.isArray(this.response)&&this.response.length===0||this.response===""?null:Array.isArray(this.response)?this.response.join(","):this.response}set value(n){this.maxChoices>1&&(typeof n=="string"||n===null)?this.response=n?n.toString().split(","):[]:this.response=n||""}toggleInternalCorrectResponse(n){let s=this.correctResponse;if(s){let a=Array.isArray(s)?s:[s];this._choiceElements.forEach(l=>{l.internals.states.delete("correct-response"),l.internals.states.delete("incorrect-response"),n&&a.length>0&&(a.includes(l.identifier)?l.internals.states.add("correct-response"):l.internals.states.add("incorrect-response"))})}}toggleCandidateCorrection(n){let s=this.correctResponse;if(!s)return;let a=Array.isArray(s)?s:[s],l=this.response,c=Array.isArray(l)?l:l?[l]:[];this._choiceElements.forEach(p=>{p.internals.states.delete("candidate-correct"),p.internals.states.delete("candidate-incorrect"),n&&c.includes(p.identifier)&&(a.includes(p.identifier)?p.internals.states.add("candidate-correct"):p.internals.states.add("candidate-incorrect"))}),super.toggleCandidateCorrection(n)}connectedCallback(){super.connectedCallback(),this.addEventListener(`activate-${r}`,this._choiceElementSelectedHandler),this._mutationObserver=new MutationObserver(()=>this._syncChoicesFromDOM()),this._mutationObserver.observe(this,{childList:!0,subtree:!0}),this._syncChoicesFromDOM()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`activate-${r}`,this._choiceElementSelectedHandler),this._mutationObserver&&(this._mutationObserver.disconnect(),this._mutationObserver=null)}_syncChoicesFromDOM(){let n=new Set(this._choiceElements);this._choiceElements=Array.from(this.querySelectorAll(r)),this._choiceElements.forEach(a=>{n.has(a)||(this.disabled&&(a.disabled=!0),a.readonly=this.readonly,a.internals&&!a.internals.ariaChecked&&(a.internals.ariaChecked="false"),this._setInputType(a))});let s=new Set(this._choiceElements.map(a=>a.identifier));if(Array.isArray(this.response)){let a=this.response.filter(l=>s.has(l));a.length!==this.response.length&&(this.response=a)}else this.response&&!s.has(this.response)&&(this.response="");this._updateChoiceSelection()}validate(){let s=this._choiceElements.filter(p=>this._getChoiceChecked(p)).length,a=!0,l="";this.maxChoices!==0&&s>this.maxChoices?(a=!1,l=this.dataset.maxSelectionsMessage||`Please select no more than ${this.maxChoices} ${this.maxChoices===1?"option":"options"}.`):s<this.minChoices&&(a=!1,l=this.dataset.minSelectionsMessage||`Please select at least ${this.minChoices} ${this.minChoices===1?"option":"options"}.`);let c=this._choiceElements.find(p=>this.contains(p))||this;return this._internals.setValidity(a?{}:{customError:!0},l,c),a}reportValidity(){return this._validationMessageElement&&(this._internals.validity.valid?(this._validationMessageElement.textContent="",this._validationMessageElement.style.display="none"):(this._validationMessageElement.textContent=this._internals.validationMessage,this._validationMessageElement.style.setProperty("display","block","important"),this._validationMessageShown=!0)),this._internals.validity.valid}_determineInputType(){this._choiceElements.forEach(n=>{this._setInputType(n)})}async _setInputType(n){if(this._internals.role=this.maxChoices===1?"radiogroup":null,n.internals){let s=this.maxChoices===1?"radio":"checkbox";n.internals.role=s,n.internals.states.delete(s==="radio"?"checkbox":"radio"),n.internals.states.add(s)}}_choiceElementSelectedHandler(n){this._toggleChoiceChecked(n.target),this.maxChoices===1?this._choiceElements.forEach(s=>{s.identifier!==n.detail.identifier&&this._setChoiceChecked(s,!1)}):this.maxChoices!==0&&this._configContext?.disableAfterIfMaxChoicesReached&&(this._choiceElements.filter(a=>this._getChoiceChecked(a)).length>=this.maxChoices?this._choiceElements.forEach(a=>{this._getChoiceChecked(a)||(a.disabled=!0)}):this._choiceElements.forEach(a=>a.disabled=!1)),this._handleChoiceSelection()}_setChoiceChecked(n,s){n.internals?.states&&(s?(n.internals.states.add("--checked"),n.internals.ariaChecked="true"):(n.internals.states.delete("--checked"),n.internals.ariaChecked="false"))}_getChoiceChecked(n){return n.internals.states.has("--checked")}_toggleChoiceChecked(n){let s=this._getChoiceChecked(n);this._setChoiceChecked(n,!s)}_handleChoiceSelection(){let s=this._choiceElements.filter(a=>this._getChoiceChecked(a)).map(a=>a.identifier);this.response=this.maxChoices===1?s[0]||"":s,this.validate(),this._validationMessageShown&&(this.reportValidity(),this._internals.validity.valid&&(this._validationMessageShown=!1)),this.saveResponse(this.response)}_updateChoiceSelection(){let n=Array.isArray(this.response)?this.response:[this.response];this._choiceElements.forEach(s=>{let a=n.includes(s.identifier);this._setChoiceChecked(s,a)})}}return d([Zt("#validation-message")],e.prototype,"_validationMessageElement",2),d([g({type:Number,attribute:"min-choices"})],e.prototype,"minChoices",2),d([g({type:Number,attribute:"max-choices"})],e.prototype,"maxChoices",2),d([B("maxChoices")],e.prototype,"_handleMaxChoicesChange",1),d([B("disabled",{waitUntilFirstUpdate:!0})],e.prototype,"_handleDisabledChange",2),d([B("readonly",{waitUntilFirstUpdate:!0})],e.prototype,"_handleReadonlyChange",2),d([k()],e.prototype,"response",2),d([B("response",{waitUntilFirstUpdate:!0})],e.prototype,"_handleValueChange",2),d([k(),$({context:ne,subscribe:!0})],e.prototype,"_configContext",2),e};var dd=(o,r)=>{class e extends o{#e=[];#t=["qti-labels-none","qti-labels-decimal","qti-labels-lower-alpha","qti-labels-upper-alpha"];#r=["qti-labels-suffix-none","qti-labels-suffix-period","qti-labels-suffix-parenthesis"];#i=null;set class(i){this.#e=this.#n(i),this.#o()}get class(){return this.#e.join(" ")}attributeChangedCallback(i,n,s){super.attributeChangedCallback(i,n,s),i==="class"&&n!==s&&(this.class=s??"")}updated(i){super.updated(i),this.#o()}connectedCallback(){super.connectedCallback(),this.class=this.getAttribute("class")??"",this.#i=new MutationObserver(i=>{i.some(n=>n.type==="childList"||n.type==="attributes"&&n.attributeName==="style")&&this.#o()}),this.#i.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]})}disconnectedCallback(){super.disconnectedCallback(),this.#i?.disconnect(),this.#i=null}#n(i){return i?i.split(/\s+/).map(n=>n.trim()).filter(Boolean).filter((n,s,a)=>a.indexOf(n)===s):[]}#o(){let i=Array.from(this.querySelectorAll("qti-simple-choice")).map(l=>l),n=this.#s(i),s=this.#a(),a=this.#c();n.forEach((l,c)=>{l.marker=this.#d(c+1,s,a)})}#s(i){return i.map((n,s)=>{let a=Number(n.style.order);return{el:n,order:Number.isFinite(a)?a:s+1,index:s}}).sort((n,s)=>n.order-s.order||n.index-s.index).map(n=>n.el)}#a(){return this.#e.filter(i=>this.#t.includes(i)).pop()??null}#c(){return this.#e.filter(i=>this.#r.includes(i)).pop()??null}#d(i,n,s){let a=n;if(!a&&s&&s!=="qti-labels-suffix-none"&&(a="qti-labels-upper-alpha"),!a||a==="qti-labels-none")return"";let l="";switch(a){case"qti-labels-decimal":l=`${i}`;break;case"qti-labels-lower-alpha":l=this.#l(i,"lower");break;case"qti-labels-upper-alpha":l=this.#l(i,"upper");break}return s==="qti-labels-suffix-period"?`${l}.`:s==="qti-labels-suffix-parenthesis"?`${l})`:l}#l(i,n){let s=i,a="",l=n==="lower"?97:65;for(;s>0;)s-=1,a=String.fromCharCode(l+s%26)+a,s=Math.floor(s/26);return a}}return d([g({type:String,attribute:"class"})],e.prototype,"class",1),e};var pd=C`
4091
4091
  :host {
4092
4092
  display: block;
4093
4093
  }
@@ -4157,11 +4157,11 @@ div.full-correct-response-inline {
4157
4157
  :host(.qti-orientation-vertical) ::slotted(qti-simple-choice:nth-child(even)) {
4158
4158
  grid-row: auto;
4159
4159
  }
4160
- `;var Bi=class extends Kc(vt(V,"qti-simple-choice"),"qti-simple-choice"){constructor(){super(...arguments);this.orientation="vertical"}static{this.styles=Zc}#e(){let e=this.querySelectorAll("qti-simple-choice");this.style.setProperty("--item-count",e.length.toString())}render(){return x`
4160
+ `;var Wi=class extends dd(yt(V,"qti-simple-choice"),"qti-simple-choice"){constructor(){super(...arguments);this.orientation="vertical"}static{this.styles=pd}#e(){let e=this.querySelectorAll("qti-simple-choice");this.style.setProperty("--item-count",e.length.toString())}render(){return x`
4161
4161
  <slot part="prompt" name="prompt"></slot>
4162
4162
  <slot part="slot" @slotchange=${this.#e}></slot>
4163
4163
  <div part="message" role="alert" id="validation-message"></div>
4164
- `}};d([g({type:String})],Bi.prototype,"orientation",2);customElements.define("qti-choice-interaction",Bi);var ed=C``;var Cs=`
4164
+ `}};d([g({type:String})],Wi.prototype,"orientation",2);customElements.define("qti-choice-interaction",Wi);var ud=C``;var _s=`
4165
4165
  const postToParentWindows = (type, data) => {
4166
4166
  window.top.postMessage(data ? { type, data } : { type }, '*');
4167
4167
  let w = window.parent;
@@ -4228,7 +4228,7 @@ window.CES = {
4228
4228
  },
4229
4229
  };
4230
4230
  CES.load();
4231
- `,kp=`
4231
+ `,Yp=`
4232
4232
  (function() {
4233
4233
  var blobUrlReceived = null;
4234
4234
 
@@ -4272,7 +4272,7 @@ CES.load();
4272
4272
  requestBlobUrl();
4273
4273
  }
4274
4274
  })();
4275
- `,Ye=class extends V{constructor(){super();this.#e="";this.#t=null;this.#r=null;this._errorMessage=null;this.#i=null;this.handlePostMessage=this.handlePostMessage.bind(this)}#e;#t;#r;static{this.styles=ed}#i;connectedCallback(){super.connectedCallback();let e=this.data;if(!e){let i=this.querySelector("object[data]");if(i){e=i.getAttribute("data");let n=i.getAttribute("width"),o=i.getAttribute("height");n&&this.setAttribute("width",n),o&&this.setAttribute("height",o)}}if(!e){this._errorMessage="No manifest path found (neither data attribute nor object child)";return}let t=e.startsWith("http")||e.startsWith("blob")?e:bn((this.baseItemUrl||"")+"/"+e);this.#t=new URL(t,window.location.href).toString(),fetch(t).then(i=>i.json()).then(i=>{this.manifest=i,this.setupCES()}).catch(i=>{this._errorMessage=i})}async setupCES(){await this.updateComplete;let e=this.shadowRoot?.querySelector("#pciContainer");if(!e){this._errorMessage="pciContainer iframe not found";return}e.getAttribute("src")||e.setAttribute("src","about:blank");let t=e.contentDocument??e.contentWindow?.document??null;if(t||(await new Promise(u=>e.addEventListener("load",()=>u(),{once:!0})),t=e.contentDocument??e.contentWindow?.document??null),!t){this._errorMessage="pciContainer iframe document not available";return}if(!this.manifest.script||this.manifest.script.length===0){this._errorMessage="No script found in manifest";return}if(!this.manifest.style||this.manifest.style.length===0){this._errorMessage="No style found in manifest";return}let i=this.manifest.style[0],n=this.#a(),o=await this.#l(i,n),a=o.url;if(o.baseUrl&&!this.#r&&(this.#r=o.baseUrl),!0){let u="";if(this.manifest.media&&this.manifest.media.length>0){let m=this.manifest.media[0],y=await this.#l(m,n,{returnText:!0});if(u=y.url,y.baseUrl&&!this.#r&&(this.#r=y.baseUrl),y.text){let b=y.text;if(!(b.includes("postToParentWindows")||b.includes("window.CES"))){let h="<script>"+Cs+"</script>",v=b.indexOf("<head>");v!==-1?b=b.slice(0,v+6)+h+b.slice(v+6):b=h+b}let f=new Blob([b],{type:"text/html"});this.#i=URL.createObjectURL(f)}}else{let m=this.data||"manifest.json",y=m.includes("/")?m.substring(0,m.lastIndexOf("/")):"",b=y?`${y}/index.html`:"index.html",w=await this.#l(b,n,{returnText:!0});if(u=w.url,w.baseUrl&&!this.#r&&(this.#r=w.baseUrl),w.text){let f=w.text;if(!(f.includes("postToParentWindows")||f.includes("window.CES"))){let q="<script>"+Cs+"</script>",A=f.indexOf("<head>");A!==-1?f=f.slice(0,A+6)+q+f.slice(A+6):f=q+f}let v=new Blob([f],{type:"text/html"});this.#i=URL.createObjectURL(v)}}if(u&&!this.#i)try{let m=await fetch(u);if(m.ok){let y=await m.text();if(!(y.includes("postToParentWindows")||y.includes("window.CES"))){let f="<script>"+Cs+"</script>",h=y.indexOf("<head>");h!==-1?y=y.slice(0,h+6)+f+y.slice(h+6):y=f+y}let w=new Blob([y],{type:"text/html"});this.#i=URL.createObjectURL(w)}else console.error(`Failed to fetch index.html: ${m.status}`)}catch(m){console.error(`Error fetching index.html: ${m}`)}}let c=`<script>${kp}</script>`;window.addEventListener("message",this.handlePostMessage);let p=`
4275
+ `,Je=class extends V{constructor(){super();this.#e="";this.#t=null;this.#r=null;this._errorMessage=null;this.#i=null;this.handlePostMessage=this.handlePostMessage.bind(this)}#e;#t;#r;static{this.styles=ud}#i;connectedCallback(){super.connectedCallback();let e=this.data;if(!e){let i=this.querySelector("object[data]");if(i){e=i.getAttribute("data");let n=i.getAttribute("width"),s=i.getAttribute("height");n&&this.setAttribute("width",n),s&&this.setAttribute("height",s)}}if(!e){this._errorMessage="No manifest path found (neither data attribute nor object child)";return}let t=e.startsWith("http")||e.startsWith("blob")?e:xn((this.baseItemUrl||"")+"/"+e);this.#t=new URL(t,window.location.href).toString(),fetch(t).then(i=>i.json()).then(i=>{this.manifest=i,this.setupCES()}).catch(i=>{this._errorMessage=i})}async setupCES(){await this.updateComplete;let e=this.shadowRoot?.querySelector("#pciContainer");if(!e){this._errorMessage="pciContainer iframe not found";return}e.getAttribute("src")||e.setAttribute("src","about:blank");let t=e.contentDocument??e.contentWindow?.document??null;if(t||(await new Promise(u=>e.addEventListener("load",()=>u(),{once:!0})),t=e.contentDocument??e.contentWindow?.document??null),!t){this._errorMessage="pciContainer iframe document not available";return}if(!this.manifest.script||this.manifest.script.length===0){this._errorMessage="No script found in manifest";return}if(!this.manifest.style||this.manifest.style.length===0){this._errorMessage="No style found in manifest";return}let i=this.manifest.style[0],n=this.#a(),s=await this.#l(i,n),a=s.url;if(s.baseUrl&&!this.#r&&(this.#r=s.baseUrl),!0){let u="";if(this.manifest.media&&this.manifest.media.length>0){let h=this.manifest.media[0],v=await this.#l(h,n,{returnText:!0});if(u=v.url,v.baseUrl&&!this.#r&&(this.#r=v.baseUrl),v.text){let y=v.text;if(!(y.includes("postToParentWindows")||y.includes("window.CES"))){let m="<script>"+_s+"</script>",b=y.indexOf("<head>");b!==-1?y=y.slice(0,b+6)+m+y.slice(b+6):y=m+y}let f=new Blob([y],{type:"text/html"});this.#i=URL.createObjectURL(f)}}else{let h=this.data||"manifest.json",v=h.includes("/")?h.substring(0,h.lastIndexOf("/")):"",y=v?`${v}/index.html`:"index.html",w=await this.#l(y,n,{returnText:!0});if(u=w.url,w.baseUrl&&!this.#r&&(this.#r=w.baseUrl),w.text){let f=w.text;if(!(f.includes("postToParentWindows")||f.includes("window.CES"))){let q="<script>"+_s+"</script>",A=f.indexOf("<head>");A!==-1?f=f.slice(0,A+6)+q+f.slice(A+6):f=q+f}let b=new Blob([f],{type:"text/html"});this.#i=URL.createObjectURL(b)}}if(u&&!this.#i)try{let h=await fetch(u);if(h.ok){let v=await h.text();if(!(v.includes("postToParentWindows")||v.includes("window.CES"))){let f="<script>"+_s+"</script>",m=v.indexOf("<head>");m!==-1?v=v.slice(0,m+6)+f+v.slice(m+6):v=f+v}let w=new Blob([v],{type:"text/html"});this.#i=URL.createObjectURL(w)}else console.error(`Failed to fetch index.html: ${h.status}`)}catch(h){console.error(`Error fetching index.html: ${h}`)}}let c=`<script>${Yp}</script>`;window.addEventListener("message",this.handlePostMessage);let p=`
4276
4276
  <!DOCTYPE html>
4277
4277
  <html>
4278
4278
  <head>
@@ -4281,7 +4281,7 @@ CES.load();
4281
4281
  </head>
4282
4282
  <body></body>
4283
4283
  </html>
4284
- `;e.srcdoc=p}#n(){let e=this.shadowRoot.querySelectorAll("iframe"),t=this.querySelectorAll("iframe"),i=[...e,...t];for(let n of i){let o=n.src;if(new URL(o,window.location.href).origin===window.location.origin)try{let l=n.contentDocument||n.contentWindow.document;l&&this.#o(l,i)}catch(l){console.error("Error accessing nested iframe:",l)}}return i.forEach((n,o)=>{i.indexOf(n)!==o&&i.splice(o,1)}),i}#o(e,t=[]){return e.querySelectorAll("iframe").forEach(n=>{t.push(n);let o=n.src;if(new URL(o,window.location.href).origin===window.location.origin)try{let l=n.contentDocument||n.contentWindow.document;this.#o(l,t)}catch(l){console.error("Error accessing nested iframe:",l)}else console.warn("Skipped cross-origin iframe:",o)}),t}#s(e,t){window.postMessage({type:e,data:t},"*");let i=this.#n();for(let n of i)n.contentWindow&&n.contentWindow.postMessage({type:e,data:t},"*")}handlePostMessage(e){let{type:t,data:i}=e.data;switch(t){case"setResponse":(i===null||!(Array.isArray(i)&&i.length===1&&i[0]===""))&&(this.#e=i,this.saveResponse(i));break;case"getResponse":{this.#s("responseData",this.#e);break}case"getBlobUrl":{this.#i&&(this.#s("blobUrl",this.#i),e.source&&e.source!==window&&e.source.postMessage({type:"blobUrl",data:this.#i},"*"));break}case"getMedia":{let n=this.#a(),o=this.manifest.media.map(a=>{if(a.startsWith("http")||a.startsWith("blob"))return a;let l=this.#r||n[0];return l?new URL(a,l.endsWith("/")?l:`${l}/`).toString():a});this.#s("mediaData",o);break}case"setStageHeight":console.log("setStageHeight not implemented");break}}validate(){if(!this.#e)return!1;if(Array.isArray(this.#e)){if(this.#e.length===0)return!1;for(let e of this.#e)if(e!==""&&e!==null)return!0}return!0}get response(){return this.#e||null}set response(e){if(typeof e=="string")this.#e=e,this.saveResponse(e);else if(Array.isArray(e))this.#e=e;else if(e)throw new Error("Value must be a string or an array of strings")}disconnectedCallback(){window.removeEventListener("message",this.handlePostMessage),super.disconnectedCallback()}render(){return x`<iframe
4284
+ `;e.srcdoc=p}#n(){let e=this.shadowRoot.querySelectorAll("iframe"),t=this.querySelectorAll("iframe"),i=[...e,...t];for(let n of i){let s=n.src;if(new URL(s,window.location.href).origin===window.location.origin)try{let l=n.contentDocument||n.contentWindow.document;l&&this.#o(l,i)}catch(l){console.error("Error accessing nested iframe:",l)}}return i.forEach((n,s)=>{i.indexOf(n)!==s&&i.splice(s,1)}),i}#o(e,t=[]){return e.querySelectorAll("iframe").forEach(n=>{t.push(n);let s=n.src;if(new URL(s,window.location.href).origin===window.location.origin)try{let l=n.contentDocument||n.contentWindow.document;this.#o(l,t)}catch(l){console.error("Error accessing nested iframe:",l)}else console.warn("Skipped cross-origin iframe:",s)}),t}#s(e,t){window.postMessage({type:e,data:t},"*");let i=this.#n();for(let n of i)n.contentWindow&&n.contentWindow.postMessage({type:e,data:t},"*")}handlePostMessage(e){let{type:t,data:i}=e.data;switch(t){case"setResponse":(i===null||!(Array.isArray(i)&&i.length===1&&i[0]===""))&&(this.#e=i,this.saveResponse(i));break;case"getResponse":{this.#s("responseData",this.#e);break}case"getBlobUrl":{this.#i&&(this.#s("blobUrl",this.#i),e.source&&e.source!==window&&e.source.postMessage({type:"blobUrl",data:this.#i},"*"));break}case"getMedia":{let n=this.#a(),s=this.manifest.media.map(a=>{if(a.startsWith("http")||a.startsWith("blob"))return a;let l=this.#r||n[0];return l?new URL(a,l.endsWith("/")?l:`${l}/`).toString():a});this.#s("mediaData",s);break}case"setStageHeight":console.log("setStageHeight not implemented");break}}validate(){if(!this.#e)return!1;if(Array.isArray(this.#e)){if(this.#e.length===0)return!1;for(let e of this.#e)if(e!==""&&e!==null)return!0}return!0}get response(){return this.#e||null}set response(e){if(typeof e=="string")this.#e=e,this.saveResponse(e);else if(Array.isArray(e))this.#e=e;else if(e)throw new Error("Value must be a string or an array of strings")}disconnectedCallback(){window.removeEventListener("message",this.handlePostMessage),super.disconnectedCallback()}render(){return x`<iframe
4285
4285
  width=${this.getAttribute("width")}
4286
4286
  height=${this.getAttribute("height")}
4287
4287
  frameborder="0"
@@ -4292,7 +4292,7 @@ CES.load();
4292
4292
  ${this._errorMessage&&x`<div style="color:red">
4293
4293
  <h1>Error</h1>
4294
4294
  ${this._errorMessage}
4295
- </div>`}`}#a(){let t=[this.#r,this.baseRefUrl,this.baseItemUrl,this.#c()].filter(Boolean).map(n=>new URL(n,window.location.href).toString()),i=this.#d();return i&&t.push(i),[...new Set(t)]}#c(){return this.#t?new URL(".",this.#t).toString():null}#d(){return this.#t?new URL("..",this.#t).toString():null}async#l(e,t,i={}){if(!e)return{url:"",baseUrl:null};if(e.startsWith("http")||e.startsWith("blob"))return{url:e,baseUrl:null};for(let n of t){let o=new URL(n,window.location.href).toString(),a=new URL(e,o.endsWith("/")?o:`${o}/`).toString();try{let l=await fetch(a);if(l.ok){if(i.returnText){let c=await l.text();return{url:a,baseUrl:o,text:c}}return{url:a,baseUrl:o}}}catch{}}return{url:"",baseUrl:null}}};d([g({type:String,attribute:"data"})],Ye.prototype,"data",2),d([g({type:String,attribute:"data-base-item"})],Ye.prototype,"baseItemUrl",2),d([g({type:String,attribute:"data-base-ref"})],Ye.prototype,"baseRefUrl",2),d([g({type:String,attribute:"id"})],Ye.prototype,"id",2),d([M()],Ye.prototype,"_errorMessage",2);customElements.define("qti-custom-interaction",Ye);var td=C``;var yt=class extends E{constructor(){super(...arguments);this.disabled=!1;this.countAttempt=null;this.title="end attempt"}static{this.styles=td}render(){return x`<button ?disabled=${this.disabled} part="button" @click=${this.endAttempt}>${this.title}</button>`}endAttempt(e){this.dispatchEvent(new CustomEvent("end-attempt",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,countAttempt:this.countAttempt==="true"}}))}};d([g({type:String,attribute:"response-identifier"})],yt.prototype,"responseIdentifier",2),d([g({reflect:!0,type:Boolean})],yt.prototype,"disabled",2),d([g({type:String,attribute:"count-attempt"})],yt.prototype,"countAttempt",2),d([g({type:String})],yt.prototype,"title",2);customElements.define("qti-end-attempt-interaction",yt);var rd=C`
4295
+ </div>`}`}#a(){let t=[this.#r,this.baseRefUrl,this.baseItemUrl,this.#c()].filter(Boolean).map(n=>new URL(n,window.location.href).toString()),i=this.#d();return i&&t.push(i),[...new Set(t)]}#c(){return this.#t?new URL(".",this.#t).toString():null}#d(){return this.#t?new URL("..",this.#t).toString():null}async#l(e,t,i={}){if(!e)return{url:"",baseUrl:null};if(e.startsWith("http")||e.startsWith("blob"))return{url:e,baseUrl:null};for(let n of t){let s=new URL(n,window.location.href).toString(),a=new URL(e,s.endsWith("/")?s:`${s}/`).toString();try{let l=await fetch(a);if(l.ok){if(i.returnText){let c=await l.text();return{url:a,baseUrl:s,text:c}}return{url:a,baseUrl:s}}}catch{}}return{url:"",baseUrl:null}}};d([g({type:String,attribute:"data"})],Je.prototype,"data",2),d([g({type:String,attribute:"data-base-item"})],Je.prototype,"baseItemUrl",2),d([g({type:String,attribute:"data-base-ref"})],Je.prototype,"baseRefUrl",2),d([g({type:String,attribute:"id"})],Je.prototype,"id",2),d([k()],Je.prototype,"_errorMessage",2);customElements.define("qti-custom-interaction",Je);var md=C``;var xt=class extends E{constructor(){super(...arguments);this.disabled=!1;this.countAttempt=null;this.title="end attempt"}static{this.styles=md}render(){return x`<button ?disabled=${this.disabled} part="button" @click=${this.endAttempt}>${this.title}</button>`}endAttempt(e){this.dispatchEvent(new CustomEvent("end-attempt",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,countAttempt:this.countAttempt==="true"}}))}};d([g({type:String,attribute:"response-identifier"})],xt.prototype,"responseIdentifier",2),d([g({reflect:!0,type:Boolean})],xt.prototype,"disabled",2),d([g({type:String,attribute:"count-attempt"})],xt.prototype,"countAttempt",2),d([g({type:String})],xt.prototype,"title",2);customElements.define("qti-end-attempt-interaction",xt);var hd=C`
4296
4296
  /* PK: display host as block, else design will be collapsed */
4297
4297
  :host {
4298
4298
  display: block;
@@ -4303,7 +4303,7 @@ CES.load();
4303
4303
  height: 100%;
4304
4304
  border: 0;
4305
4305
  }
4306
- `;var fe=class extends V{constructor(){super(...arguments);this._rows=5;this.response=null;this._handleResponseChange=()=>{this._internals.setFormValue(this.value),this.validate()}}static{this.styles=rd}handleclassNamesChange(e,t){let i=t.split(" "),n=!1;if(i.forEach(o=>{if(o.startsWith("qti-height-lines-")){let a=o.replace("qti-height-lines-","");this._rows=parseInt(a),n=!0}}),!n&&this.expectedLength){let o=Math.ceil(this.expectedLength/50);this._rows=o}}get value(){return this.response||null}set value(e){this.response=e||null}validate(){let e=this.shadowRoot.querySelector("textarea");if(!e)return!1;if(this.patternMask&&this.dataPatternmaskMessage){this._internals.setValidity({}),e.setCustomValidity("");let t=this.patternMask.startsWith("^")&&this.patternMask.endsWith("$")?this.patternMask:`^${this.patternMask}$`,i=new RegExp(t);e.checkValidity()&&i.test(e.value)||(this._internals.setValidity({customError:!0},this.dataPatternmaskMessage),e.setCustomValidity(this.dataPatternmaskMessage))}else{let t=e.checkValidity();this._internals.setValidity(t?{}:{customError:!1})}return!!this.response&&e.checkValidity()}toggleCorrectResponse(){}reportValidity(){let e=this.shadowRoot.querySelector("textarea");if(!e)return!1;let t=this.validate();return t||e.reportValidity(),t}render(){return x`<slot name="prompt"></slot
4306
+ `;var ge=class extends V{constructor(){super(...arguments);this._rows=5;this.response=null;this._handleResponseChange=()=>{this._internals.setFormValue(this.value),this.validate()}}static{this.styles=hd}handleclassNamesChange(e,t){let i=t.split(" "),n=!1;if(i.forEach(s=>{if(s.startsWith("qti-height-lines-")){let a=s.replace("qti-height-lines-","");this._rows=parseInt(a),n=!0}}),!n&&this.expectedLength){let s=Math.ceil(this.expectedLength/50);this._rows=s}}get value(){return this.response||null}set value(e){this.response=e||null}validate(){let e=this.shadowRoot.querySelector("textarea");if(!e)return!1;if(this.patternMask&&this.dataPatternmaskMessage){this._internals.setValidity({}),e.setCustomValidity("");let t=this.patternMask.startsWith("^")&&this.patternMask.endsWith("$")?this.patternMask:`^${this.patternMask}$`,i=new RegExp(t);e.checkValidity()&&i.test(e.value)||(this._internals.setValidity({customError:!0},this.dataPatternmaskMessage),e.setCustomValidity(this.dataPatternmaskMessage))}else{let t=e.checkValidity();this._internals.setValidity(t?{}:{customError:!1})}return!!this.response&&e.checkValidity()}toggleCorrectResponse(){}reportValidity(){let e=this.shadowRoot.querySelector("textarea");if(!e)return!1;let t=this.validate();return t||e.reportValidity(),t}render(){return x`<slot name="prompt"></slot
4307
4307
  ><textarea
4308
4308
  part="textarea"
4309
4309
  name="${this.responseIdentifier}"
@@ -4314,12 +4314,12 @@ CES.load();
4314
4314
  @keyup="${this.textChanged}"
4315
4315
  @change="${this.textChanged}"
4316
4316
  @blur="${e=>{this.reportValidity()}}"
4317
- placeholder="${Le(this.placeholderText?this.placeholderText:void 0)}"
4317
+ placeholder="${$e(this.placeholderText?this.placeholderText:void 0)}"
4318
4318
  rows="${this._rows}"
4319
4319
  ?disabled="${this.disabled}"
4320
4320
  ?readonly="${this.readonly}"
4321
4321
  .value=${this.response}
4322
- ></textarea>`}textChanged(e){if(this.disabled||this.readonly)return;let t=e.target;this.setEmptyAttribute(t.value),this.response!==t.value&&(this.value=t.value,this.saveResponse(t.value))}setEmptyAttribute(e){this.setAttribute("empty",e===""?"true":"false")}};d([M()],fe.prototype,"_rows",2),d([g({type:Number,attribute:"expected-length"})],fe.prototype,"expectedLength",2),d([g({type:String,attribute:"pattern-mask"})],fe.prototype,"patternMask",2),d([g({type:String,attribute:"placeholder-text"})],fe.prototype,"placeholderText",2),d([g({type:String,attribute:"data-patternmask-message"})],fe.prototype,"dataPatternmaskMessage",2),d([g({type:String,attribute:"class"})],fe.prototype,"classNames",2),d([B("classNames")],fe.prototype,"handleclassNamesChange",1),d([M()],fe.prototype,"response",2),d([B("response",{waitUntilFirstUpdate:!0})],fe.prototype,"_handleResponseChange",2);customElements.define("qti-extended-text-interaction",fe);var id=C`
4322
+ ></textarea>`}textChanged(e){if(this.disabled||this.readonly)return;let t=e.target;this.setEmptyAttribute(t.value),this.response!==t.value&&(this.value=t.value,this.saveResponse(t.value))}setEmptyAttribute(e){this.setAttribute("empty",e===""?"true":"false")}};d([k()],ge.prototype,"_rows",2),d([g({type:Number,attribute:"expected-length"})],ge.prototype,"expectedLength",2),d([g({type:String,attribute:"pattern-mask"})],ge.prototype,"patternMask",2),d([g({type:String,attribute:"placeholder-text"})],ge.prototype,"placeholderText",2),d([g({type:String,attribute:"data-patternmask-message"})],ge.prototype,"dataPatternmaskMessage",2),d([g({type:String,attribute:"class"})],ge.prototype,"classNames",2),d([B("classNames")],ge.prototype,"handleclassNamesChange",1),d([k()],ge.prototype,"response",2),d([B("response",{waitUntilFirstUpdate:!0})],ge.prototype,"_handleResponseChange",2);customElements.define("qti-extended-text-interaction",ge);var fd=C`
4323
4323
  :host {
4324
4324
  display: flex;
4325
4325
  align-items: flex-start;
@@ -4353,10 +4353,10 @@ CES.load();
4353
4353
  border-radius: 0.3rem;
4354
4354
  gap: 0.5rem;
4355
4355
  }
4356
- `;var Mp=Ae(V,"qti-gap-text","qti-gap","slot[part='drags']"),ao=class extends Te(Mp,'[qti-draggable="true"]'){static{this.styles=id}render(){return x`<slot name="prompt"> </slot>
4356
+ `;var Jp=Te(V,"qti-gap-text","qti-gap","slot[part='drags']"),uo=class extends Ie(Jp,'[qti-draggable="true"]'){static{this.styles=fd}render(){return x`<slot name="prompt"> </slot>
4357
4357
  <slot part="drags" name="drags"></slot>
4358
4358
  <slot part="drops"></slot>
4359
- <div role="alert" part="message" id="validation-message"></div>`}toggleCorrectResponse(r){let e=this.responseVariable;if(r&&e?.correctResponse){let t=[],i=Array.isArray(e.correctResponse)?e.correctResponse:[e.correctResponse];i&&(t=i.map(o=>{let a=o.split(" ");return{text:a[0],gap:a[1]}})),this.querySelectorAll("qti-gap").forEach(o=>{let a=o.getAttribute("identifier"),l=t.find(p=>p.gap===a)?.text,c=this.querySelector(`qti-gap-text[identifier="${l}"]`)?.textContent.trim();if(l&&c){if(!o.nextElementSibling?.classList.contains("correct-option")){let p=document.createElement("span");p.classList.add("correct-option"),p.textContent=c,p.style.border="1px solid var(--qti-correct)",p.style.borderRadius="4px",p.style.padding="2px 4px",p.style.display="inline-block",o.insertAdjacentElement("afterend",p)}}else o.nextElementSibling?.classList.contains("correct-option")&&o.nextElementSibling.remove()})}else this.querySelectorAll(".correct-option").forEach(i=>{i.remove()})}#e(r){if(!r.correctResponse)return[];let e=Array.isArray(r.correctResponse)?r.correctResponse:[r.correctResponse],t=[];return e&&e.forEach(i=>{let n=i.split(" ");t.push({source:n[0],target:n[1]})}),t}toggleCandidateCorrection(r){let e=this.responseVariable;if(!e?.correctResponse)return;let t=this.#e(e);Array.from(this.querySelectorAll("qti-gap")).forEach(n=>{let o=n.getAttribute("identifier"),a=t.filter(c=>c.target===o);n.querySelectorAll("qti-gap-text").forEach(c=>{if(c.internals.states.delete("candidate-correct"),c.internals.states.delete("candidate-incorrect"),!r)return;a.find(u=>u.source===c.identifier)?.source!==void 0?c.internals.states.add("candidate-correct"):c.internals.states.add("candidate-incorrect")})})}};customElements.define("qti-gap-match-interaction",ao);var nd=(s,r,e)=>{let t=new Map;for(let i=r;i<=e;i++)t.set(s[i],i);return t},Ir=qe(class extends nt{constructor(s){if(super(s),s.type!==nr.CHILD)throw Error("repeat() can only be used in text expressions")}dt(s,r,e){let t;e===void 0?e=r:r!==void 0&&(t=r);let i=[],n=[],o=0;for(let a of s)i[o]=t?t(a,o):o,n[o]=e(a,o),o++;return{values:n,keys:i}}render(s,r,e){return this.dt(s,r,e).values}update(s,[r,e,t]){let i=sl(s),{values:n,keys:o}=this.dt(r,e,t);if(!Array.isArray(i))return this.ut=o,n;let a=this.ut??=[],l=[],c,p,u=0,m=i.length-1,y=0,b=n.length-1;for(;u<=m&&y<=b;)if(i[u]===null)u++;else if(i[m]===null)m--;else if(a[u]===o[y])l[y]=ot(i[u],n[y]),u++,y++;else if(a[m]===o[b])l[b]=ot(i[m],n[b]),m--,b--;else if(a[u]===o[b])l[b]=ot(i[u],n[b]),or(s,l[b+1],i[u]),u++,b--;else if(a[m]===o[y])l[y]=ot(i[m],n[y]),or(s,i[u],i[m]),m--,y++;else if(c===void 0&&(c=nd(o,y,b),p=nd(a,u,m)),c.has(a[u]))if(c.has(a[m])){let w=p.get(o[y]),f=w!==void 0?i[w]:null;if(f===null){let h=or(s,i[u]);ot(h,n[y]),l[y]=h}else l[y]=ot(f,n[y]),or(s,i[u],f),i[w]=null;y++}else fn(i[m]),m--;else fn(i[u]),u++;for(;y<=b;){let w=or(s,l[b+1]);ot(w,n[y]),l[y++]=w}for(;u<=m;){let w=i[u++];w!==null&&fn(w)}return this.ut=o,ol(s,l),re}});function xt(s,r,e,t){let i=e.getAttribute("width")?parseFloat(e.getAttribute("width")):e.naturalWidth,n=e.getAttribute("height")?parseFloat(e.getAttribute("height")):e.naturalHeight;switch(s){case"circle":{if(r.length!==3){console.error("Invalid circle coordinates:",r);return}let[o,a,l]=r,c=o/i*100,p=a/n*100,u=l/i*100,m=l/n*100;t.style.left=c-u+"%",t.style.top=p-m+"%",t.style.width=2*u+"%",t.style.height=2*m+"%",t.style.borderRadius="50%"}break;case"rect":{if(r.length!==4){console.error("Invalid rectangle coordinates:",r);return}let[o,a,l,c]=r,p=o/i*100,u=a/n*100,m=l/i*100,y=c/n*100;t.style.left=p+"%",t.style.top=u+"%",t.style.width=m-p+"%",t.style.height=y-u+"%"}break;case"ellipse":{if(r.length!==4){console.error("Invalid ellipse coordinates:",r);return}let[o,a,l,c]=r,p=o/i*100,u=a/n*100,m=l/i*100,y=c/n*100;t.style.left=p-m+"%",t.style.top=u-y+"%",t.style.width=2*m+"%",t.style.height=2*y+"%",t.style.borderRadius="50%"}break;case"poly":{if(r.length<6||r.length%2!==0){console.error("Invalid polygon coordinates:",r);return}let o=[];for(let h=0;h<r.length;h+=2)o.push({x:r[h],y:r[h+1]});let a=Math.min(...o.map(h=>h.x)),l=Math.max(...o.map(h=>h.x)),c=Math.min(...o.map(h=>h.y)),p=Math.max(...o.map(h=>h.y)),u=a/i*100,m=c/n*100,y=l/i*100,b=p/n*100;t.style.left=u+"%",t.style.top=m+"%",t.style.width=y-u+"%",t.style.height=b-m+"%";let f=o.map(h=>({x:(h.x-a)/(l-a)*100,y:(h.y-c)/(p-c)*100})).map(h=>`${h.x}% ${h.y}%`).join(",");t.style.clipPath=`polygon(${f})`}break;default:console.error(`Unsupported shape: ${s}`);break}}var od=C`
4359
+ <div role="alert" part="message" id="validation-message"></div>`}toggleCorrectResponse(r){let e=this.responseVariable;if(r&&e?.correctResponse){let t=[],i=Array.isArray(e.correctResponse)?e.correctResponse:[e.correctResponse];i&&(t=i.map(s=>{let a=s.split(" ");return{text:a[0],gap:a[1]}})),this.querySelectorAll("qti-gap").forEach(s=>{let a=s.getAttribute("identifier"),l=t.find(p=>p.gap===a)?.text,c=this.querySelector(`qti-gap-text[identifier="${l}"]`)?.textContent.trim();if(l&&c){if(!s.nextElementSibling?.classList.contains("correct-option")){let p=document.createElement("span");p.classList.add("correct-option"),p.textContent=c,p.style.border="1px solid var(--qti-correct)",p.style.borderRadius="4px",p.style.padding="2px 4px",p.style.display="inline-block",s.insertAdjacentElement("afterend",p)}}else s.nextElementSibling?.classList.contains("correct-option")&&s.nextElementSibling.remove()})}else this.querySelectorAll(".correct-option").forEach(i=>{i.remove()})}#e(r){if(!r.correctResponse)return[];let e=Array.isArray(r.correctResponse)?r.correctResponse:[r.correctResponse],t=[];return e&&e.forEach(i=>{let n=i.split(" ");t.push({source:n[0],target:n[1]})}),t}toggleCandidateCorrection(r){let e=this.responseVariable;if(!e?.correctResponse)return;let t=this.#e(e);Array.from(this.querySelectorAll("qti-gap")).forEach(n=>{let s=n.getAttribute("identifier"),a=t.filter(c=>c.target===s);n.querySelectorAll("qti-gap-text").forEach(c=>{if(c.internals.states.delete("candidate-correct"),c.internals.states.delete("candidate-incorrect"),!r)return;a.find(u=>u.source===c.identifier)?.source!==void 0?c.internals.states.add("candidate-correct"):c.internals.states.add("candidate-incorrect")})})}};customElements.define("qti-gap-match-interaction",uo);var gd=(o,r,e)=>{let t=new Map;for(let i=r;i<=e;i++)t.set(o[i],i);return t},Rr=we(class extends ot{constructor(o){if(super(o),o.type!==er.CHILD)throw Error("repeat() can only be used in text expressions")}dt(o,r,e){let t;e===void 0?e=r:r!==void 0&&(t=r);let i=[],n=[],s=0;for(let a of o)i[s]=t?t(a,s):s,n[s]=e(a,s),s++;return{values:n,keys:i}}render(o,r,e){return this.dt(o,r,e).values}update(o,[r,e,t]){let i=il(o),{values:n,keys:s}=this.dt(r,e,t);if(!Array.isArray(i))return this.ut=s,n;let a=this.ut??=[],l=[],c,p,u=0,h=i.length-1,v=0,y=n.length-1;for(;u<=h&&v<=y;)if(i[u]===null)u++;else if(i[h]===null)h--;else if(a[u]===s[v])l[v]=st(i[u],n[v]),u++,v++;else if(a[h]===s[y])l[y]=st(i[h],n[y]),h--,y--;else if(a[u]===s[y])l[y]=st(i[u],n[y]),tr(o,l[y+1],i[u]),u++,y--;else if(a[h]===s[v])l[v]=st(i[h],n[v]),tr(o,i[u],i[h]),h--,v++;else if(c===void 0&&(c=gd(s,v,y),p=gd(a,u,h)),c.has(a[u]))if(c.has(a[h])){let w=p.get(s[v]),f=w!==void 0?i[w]:null;if(f===null){let m=tr(o,i[u]);st(m,n[v]),l[v]=m}else l[v]=st(f,n[v]),tr(o,i[u],f),i[w]=null;v++}else vn(i[h]),h--;else vn(i[u]),u++;for(;v<=y;){let w=tr(o,l[y+1]);st(w,n[v]),l[v++]=w}for(;u<=h;){let w=i[u++];w!==null&&vn(w)}return this.ut=s,rl(o,l),ie}});function qt(o,r,e,t){let i=e.getAttribute("width")?parseFloat(e.getAttribute("width")):e.naturalWidth,n=e.getAttribute("height")?parseFloat(e.getAttribute("height")):e.naturalHeight;switch(o){case"circle":{if(r.length!==3){console.error("Invalid circle coordinates:",r);return}let[s,a,l]=r,c=s/i*100,p=a/n*100,u=l/i*100,h=l/n*100;t.style.left=c-u+"%",t.style.top=p-h+"%",t.style.width=2*u+"%",t.style.height=2*h+"%",t.style.borderRadius="50%"}break;case"rect":{if(r.length!==4){console.error("Invalid rectangle coordinates:",r);return}let[s,a,l,c]=r,p=s/i*100,u=a/n*100,h=l/i*100,v=c/n*100;t.style.left=p+"%",t.style.top=u+"%",t.style.width=h-p+"%",t.style.height=v-u+"%"}break;case"ellipse":{if(r.length!==4){console.error("Invalid ellipse coordinates:",r);return}let[s,a,l,c]=r,p=s/i*100,u=a/n*100,h=l/i*100,v=c/n*100;t.style.left=p-h+"%",t.style.top=u-v+"%",t.style.width=2*h+"%",t.style.height=2*v+"%",t.style.borderRadius="50%"}break;case"poly":{if(r.length<6||r.length%2!==0){console.error("Invalid polygon coordinates:",r);return}let s=[];for(let m=0;m<r.length;m+=2)s.push({x:r[m],y:r[m+1]});let a=Math.min(...s.map(m=>m.x)),l=Math.max(...s.map(m=>m.x)),c=Math.min(...s.map(m=>m.y)),p=Math.max(...s.map(m=>m.y)),u=a/i*100,h=c/n*100,v=l/i*100,y=p/n*100;t.style.left=u+"%",t.style.top=h+"%",t.style.width=v-u+"%",t.style.height=y-h+"%";let f=s.map(m=>({x:(m.x-a)/(l-a)*100,y:(m.y-c)/(p-c)*100})).map(m=>`${m.x}% ${m.y}%`).join(",");t.style.clipPath=`polygon(${f})`}break;default:console.error(`Unsupported shape: ${o}`);break}}var bd=C`
4360
4360
  slot:not([name='prompt']) {
4361
4361
  // position: relative; /* qti-hotspot-choice relative to the slot */
4362
4362
  display: block;
@@ -4380,14 +4380,14 @@ CES.load();
4380
4380
  top: 0px;
4381
4381
  left: 0px;
4382
4382
  }
4383
- `;var Je=class extends V{constructor(){super();this.#t=null;this.#r=null;this._correctLines=[];this._response=[];this.addEventListener("qti-register-hotspot",this.#o)}static{this.styles=od}#e;#t;#r;reset(){this._response=[],this._correctLines=[]}validate(){return this.#n().length>0}set response(e){this._response=this.#i(e)}get response(){return this._response}#i(e){return e==null||e===""?[]:Array.isArray(e)?e:[e]}#n(){return this.#i(this._response)}toggleInternalCorrectResponse(e){let t=this.responseVariable;if(!e||!t){this._correctLines=[];return}if(!t.correctResponse){console.error("No correct response found for this interaction.");return}let i=Array.isArray(t.correctResponse)?t.correctResponse:[t.correctResponse];this._correctLines=i}render(){return x`<slot name="prompt"></slot>
4383
+ `;var Ke=class extends V{constructor(){super();this.#t=null;this.#r=null;this._correctLines=[];this._response=[];this.addEventListener("qti-register-hotspot",this.#o)}static{this.styles=bd}#e;#t;#r;reset(){this._response=[],this._correctLines=[]}validate(){return this.#n().length>0}set response(e){this._response=this.#i(e)}get response(){return this._response}#i(e){return e==null||e===""?[]:Array.isArray(e)?e:[e]}#n(){return this.#i(this._response)}toggleInternalCorrectResponse(e){let t=this.responseVariable;if(!e||!t){this._correctLines=[];return}if(!t.correctResponse){console.error("No correct response found for this interaction.");return}let i=Array.isArray(t.correctResponse)?t.correctResponse:[t.correctResponse];this._correctLines=i}render(){return x`<slot name="prompt"></slot>
4384
4384
  <line-container>
4385
4385
  <svg
4386
- width=${Le(this.grImage[0]?.width)}
4387
- height=${Le(this.grImage[0]?.height)}
4386
+ width=${$e(this.grImage[0]?.width)}
4387
+ height=${$e(this.grImage[0]?.height)}
4388
4388
  viewbox="0 0 ${this.grImage[0]?.width} ${this.grImage[0]?.height}"
4389
4389
  >
4390
- ${Ir(this.#n(),e=>e,(e,t)=>mn`
4390
+ ${Rr(this.#n(),e=>e,(e,t)=>bn`
4391
4391
  <line
4392
4392
  part="line"
4393
4393
  x1=${parseInt(this.querySelector(`[identifier=${e.split(" ")[0]}]`).style.left)}
@@ -4396,10 +4396,10 @@ CES.load();
4396
4396
  y2=${parseInt(this.querySelector(`[identifier=${e.split(" ")[1]}]`).style.top)}
4397
4397
  stroke="red"
4398
4398
  stroke-width="3"
4399
- @click=${i=>{i.stopPropagation(),this._response=this._response.filter((n,o)=>o!==t),this.saveResponse(this.response)}}
4399
+ @click=${i=>{i.stopPropagation(),this._response=this._response.filter((n,s)=>s!==t),this.saveResponse(this.response)}}
4400
4400
  />
4401
4401
  `)}
4402
- ${Ir(this._correctLines||[],e=>e,(e,t)=>mn`
4402
+ ${Rr(this._correctLines||[],e=>e,(e,t)=>bn`
4403
4403
  <line
4404
4404
  part="correct-line"
4405
4405
  x1=${parseInt(this.querySelector(`[identifier=${e.split(" ")[0]}]`).style.left)}
@@ -4411,7 +4411,7 @@ CES.load();
4411
4411
  stroke-dasharray="5,5"
4412
4412
  />
4413
4413
  `)}
4414
- ${this.#t&&mn`<line
4414
+ ${this.#t&&bn`<line
4415
4415
  part="point"
4416
4416
  x1=${this.startCoord.x}
4417
4417
  y1=${this.startCoord.y}
@@ -4423,7 +4423,7 @@ CES.load();
4423
4423
  </svg>
4424
4424
  <slot></slot>
4425
4425
  </line-container>
4426
- <div role="alert" part="message" id="validation-message"></div>`}#o(e){let t=this.querySelector("img"),i=e.target,n=i.getAttribute("coords"),o=i.getAttribute("shape"),a=n.split(",").map(l=>parseInt(l));xt(o,a,t,i)}firstUpdated(){this.#e=this.querySelectorAll("qti-associable-hotspot"),this.addEventListener("mousemove",e=>{let t=this.grImage[0];if(!t)return;let i=t.getBoundingClientRect();this.mouseCoord={x:e.clientX-i.left,y:e.clientY-i.top}}),this.#e.forEach(e=>{e.style.left=e.getAttribute("coords").split(",")[0]+"px",e.style.top=e.getAttribute("coords").split(",")[1]+"px",e.addEventListener("click",t=>{this.#t?this.#r||(this.#r=t.target,this._response=this.#n(),this._response=[...this._response,`${this.#t.getAttribute("identifier")} ${this.#r.getAttribute("identifier")}`],this.saveResponse(this.response),this.#t=null,this.#r=null):(this.#t=t.target,this.startCoord={x:parseInt(this.#t.getAttribute("coords").split(",")[0]),y:parseInt(this.#t.getAttribute("coords").split(",")[1])})})})}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.#o)}};d([M()],Je.prototype,"_correctLines",2),d([M()],Je.prototype,"startCoord",2),d([M()],Je.prototype,"mouseCoord",2),d([Ua({selector:"img"})],Je.prototype,"grImage",2),d([M()],Je.prototype,"_response",2);customElements.define("qti-graphic-associate-interaction",Je);var sd=C`
4426
+ <div role="alert" part="message" id="validation-message"></div>`}#o(e){let t=this.querySelector("img"),i=e.target,n=i.getAttribute("coords"),s=i.getAttribute("shape"),a=n.split(",").map(l=>parseInt(l));qt(s,a,t,i)}firstUpdated(){this.#e=this.querySelectorAll("qti-associable-hotspot"),this.addEventListener("mousemove",e=>{let t=this.grImage[0];if(!t)return;let i=t.getBoundingClientRect();this.mouseCoord={x:e.clientX-i.left,y:e.clientY-i.top}}),this.#e.forEach(e=>{e.style.left=e.getAttribute("coords").split(",")[0]+"px",e.style.top=e.getAttribute("coords").split(",")[1]+"px",e.addEventListener("click",t=>{this.#t?this.#r||(this.#r=t.target,this._response=this.#n(),this._response=[...this._response,`${this.#t.getAttribute("identifier")} ${this.#r.getAttribute("identifier")}`],this.saveResponse(this.response),this.#t=null,this.#r=null):(this.#t=t.target,this.startCoord={x:parseInt(this.#t.getAttribute("coords").split(",")[0]),y:parseInt(this.#t.getAttribute("coords").split(",")[1])})})})}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.#o)}};d([k()],Ke.prototype,"_correctLines",2),d([k()],Ke.prototype,"startCoord",2),d([k()],Ke.prototype,"mouseCoord",2),d([Ya({selector:"img"})],Ke.prototype,"grImage",2),d([k()],Ke.prototype,"_response",2);customElements.define("qti-graphic-associate-interaction",Ke);var vd=C`
4427
4427
  :host {
4428
4428
  display: flex;
4429
4429
  align-items: flex-start;
@@ -4477,10 +4477,10 @@ CES.load();
4477
4477
  user-select: none;
4478
4478
  pointer-events: none;
4479
4479
  }
4480
- `;var _p=Ae(V,"qti-gap-img, qti-gap-text","qti-associable-hotspot","slot[part='drags']"),lo=class extends Te(_p,'[qti-draggable="true"]'){static{this.styles=sd}render(){return x` <slot name="prompt"></slot>
4480
+ `;var Kp=Te(V,"qti-gap-img, qti-gap-text","qti-associable-hotspot","slot[part='drags']"),mo=class extends Ie(Kp,'[qti-draggable="true"]'){static{this.styles=vd}render(){return x` <slot name="prompt"></slot>
4481
4481
  <slot part="image"></slot>
4482
4482
  <slot part="drags" name="drags" class="hover-border"></slot>
4483
- <div role="alert" part="message" id="validation-message"></div>`}shouldReturnToInventoryOnInventoryDrop(){return!0}#e(r){let e=r.target,t=e.getAttribute("coords"),i=e.getAttribute("shape"),n=t.split(",").map(o=>parseInt(o));switch(i){case"circle":{let[o,a,l]=n;e.style.left=o-l+"px",e.style.top=a-l+"px",e.style.width=e.style.height=2*l+"px"}break;case"rect":{let[o,a,l,c]=n;e.style.left=o+"px",e.style.top=a+"px",e.style.width=l-o+"px",e.style.height=c-a+"px"}break;default:break}}connectedCallback(){super.connectedCallback(),this.addEventListener("qti-register-hotspot",this.#e)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.#e)}};customElements.define("qti-graphic-gap-match-interaction",lo);var ad=C`
4483
+ <div role="alert" part="message" id="validation-message"></div>`}shouldReturnToInventoryOnInventoryDrop(){return!0}#e(r){let e=r.target,t=e.getAttribute("coords"),i=e.getAttribute("shape"),n=t.split(",").map(s=>parseInt(s));switch(i){case"circle":{let[s,a,l]=n;e.style.left=s-l+"px",e.style.top=a-l+"px",e.style.width=e.style.height=2*l+"px"}break;case"rect":{let[s,a,l,c]=n;e.style.left=s+"px",e.style.top=a+"px",e.style.width=l-s+"px",e.style.height=c-a+"px"}break;default:break}}connectedCallback(){super.connectedCallback(),this.addEventListener("qti-register-hotspot",this.#e)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.#e)}};customElements.define("qti-graphic-gap-match-interaction",mo);var yd=C`
4484
4484
  slot:not([name='prompt']) {
4485
4485
  position: relative; /* qti-hotspot-choice relative to the slot */
4486
4486
  display: block;
@@ -4491,11 +4491,11 @@ CES.load();
4491
4491
  pointer-events: none;
4492
4492
  user-select: none;
4493
4493
  }
4494
- `;var co=class extends vt(V,"qti-hotspot-choice"){constructor(){super(...arguments);this._choiceElements=[]}static{this.styles=ad}render(){return x`
4494
+ `;var ho=class extends yt(V,"qti-hotspot-choice"){constructor(){super(...arguments);this._choiceElements=[]}static{this.styles=yd}render(){return x`
4495
4495
  <slot name="prompt"></slot>
4496
4496
  <slot></slot>
4497
4497
  <div role="alert" part="message" id="validation-message"></div>
4498
- `}#e(e){let{identifier:t}=e.detail,i=this._choiceElements.find(o=>o.getAttribute("identifier")===t);if(!i)return;let n=this._choiceElements.length;if(!this.choiceOrdering){if(this.choiceOrdering=!0,i.order==null){let o=this._choiceElements.filter(a=>a.order!=null).length;if(o>=n){this.choiceOrdering=!1;return}i.order=o+1}else{let o=i.order;i.order=null,this._choiceElements.forEach(a=>{a.order!=null&&a.order>o&&a.order--})}this.choiceOrdering=!1}}toggleCorrectResponse(e){let t=this.responseVariable,i=this._choiceElements;for(let n of i)if(e&&t?.correctResponse?.length>0&&Array.isArray(t.correctResponse)){let o=t.correctResponse.findIndex(a=>a===n.identifier);o>=0?n.orderCorrect=o+1:n.orderCorrect=null}else n.orderCorrect=null}#t(e){let t=this.querySelector("img"),i=e.target,n=i.getAttribute("coords"),o=i.getAttribute("shape"),a=n.split(",").map(l=>parseInt(l));xt(o,a,t,i)}connectedCallback(){super.connectedCallback(),this.addEventListener("activate-qti-hotspot-choice",this.#e),this.addEventListener("register-qti-hotspot-choice",this.#t)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("activate-qti-hotspot-choice",this.#e),this.removeEventListener("register-qti-hotspot-choice",this.#t)}};customElements.define("qti-graphic-order-interaction",co);var ld=C`
4498
+ `}#e(e){let{identifier:t}=e.detail,i=this._choiceElements.find(s=>s.getAttribute("identifier")===t);if(!i)return;let n=this._choiceElements.length;if(!this.choiceOrdering){if(this.choiceOrdering=!0,i.order==null){let s=this._choiceElements.filter(a=>a.order!=null).length;if(s>=n){this.choiceOrdering=!1;return}i.order=s+1}else{let s=i.order;i.order=null,this._choiceElements.forEach(a=>{a.order!=null&&a.order>s&&a.order--})}this.choiceOrdering=!1}}toggleCorrectResponse(e){let t=this.responseVariable,i=this._choiceElements;for(let n of i)if(e&&t?.correctResponse?.length>0&&Array.isArray(t.correctResponse)){let s=t.correctResponse.findIndex(a=>a===n.identifier);s>=0?n.orderCorrect=s+1:n.orderCorrect=null}else n.orderCorrect=null}#t(e){let t=this.querySelector("img"),i=e.target,n=i.getAttribute("coords"),s=i.getAttribute("shape"),a=n.split(",").map(l=>parseInt(l));qt(s,a,t,i)}connectedCallback(){super.connectedCallback(),this.addEventListener("activate-qti-hotspot-choice",this.#e),this.addEventListener("register-qti-hotspot-choice",this.#t)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("activate-qti-hotspot-choice",this.#e),this.removeEventListener("register-qti-hotspot-choice",this.#t)}};customElements.define("qti-graphic-order-interaction",ho);var xd=C`
4499
4499
  slot:not([name='prompt']) {
4500
4500
  position: relative; /* qti-hotspot-choice relative to the slot */
4501
4501
  display: inline-block;
@@ -4509,11 +4509,11 @@ CES.load();
4509
4509
  user-select: none;
4510
4510
  /* width:100%; */
4511
4511
  }
4512
- `;var po=class extends vt(V,"qti-hotspot-choice"){static{this.styles=ld}render(){return x`
4512
+ `;var fo=class extends yt(V,"qti-hotspot-choice"){static{this.styles=xd}render(){return x`
4513
4513
  <slot name="prompt"></slot>
4514
4514
  <slot></slot>
4515
- `}#e=null;#t(r){return this.#e||(r.naturalWidth>0&&r.naturalHeight>0?this.#e=Promise.resolve(r):this.#e=new Promise(e=>{let t=()=>{r.removeEventListener("load",t),e(r)};r.addEventListener("load",t)})),this.#e}async#r(r){let e=this.querySelector("img"),t=r.target,i=t.getAttribute("coords"),n=t.getAttribute("shape"),o=i.split(",").map(l=>parseInt(l)),a=await this.#t(e);xt(n,o,a,t)}connectedCallback(){super.connectedCallback(),this.addEventListener("register-qti-hotspot-choice",this.#r)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("unregister-qti-hotspot-choice",this.#r)}};customElements.define("qti-hotspot-interaction",po);var cd=C``;var zi=class extends vt(V,"qti-hottext"){constructor(){super(...arguments);this.class="";this.render=()=>x`<slot></slot>
4516
- <div part="message" role="alert" id="validation-message"></div>`}static{this.styles=cd}get#e(){let e={"qti-input-control-hidden":!0};return this.class&&this.class.split(" ").forEach(t=>{t.trim()&&(e[t.trim()]=!0)}),e}connectedCallback(){super.connectedCallback(),this.#t()}updated(e){super.updated(e),this.#t()}#t(){let e=Object.keys(this.#e).join(" ");this.className=e}};d([g({type:String,reflect:!0})],zi.prototype,"class",2);customElements.define("qti-hottext-interaction",zi);var Lp=C`
4515
+ `}#e=null;#t(r){return this.#e||(r.naturalWidth>0&&r.naturalHeight>0?this.#e=Promise.resolve(r):this.#e=new Promise(e=>{let t=()=>{r.removeEventListener("load",t),e(r)};r.addEventListener("load",t)})),this.#e}async#r(r){let e=this.querySelector("img"),t=r.target,i=t.getAttribute("coords"),n=t.getAttribute("shape"),s=i.split(",").map(l=>parseInt(l)),a=await this.#t(e);qt(n,s,a,t)}connectedCallback(){super.connectedCallback(),this.addEventListener("register-qti-hotspot-choice",this.#r)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("unregister-qti-hotspot-choice",this.#r)}};customElements.define("qti-hotspot-interaction",fo);var qd=C``;var Gi=class extends yt(V,"qti-hottext"){constructor(){super(...arguments);this.class="";this.render=()=>x`<slot></slot>
4516
+ <div part="message" role="alert" id="validation-message"></div>`}static{this.styles=qd}get#e(){let e={"qti-input-control-hidden":!0};return this.class&&this.class.split(" ").forEach(t=>{t.trim()&&(e[t.trim()]=!0)}),e}connectedCallback(){super.connectedCallback(),this.#t()}updated(e){super.updated(e),this.#t()}#t(){let e=Object.keys(this.#e).join(" ");this.className=e}};d([g({type:String,reflect:!0})],Gi.prototype,"class",2);customElements.define("qti-hottext-interaction",Gi);var Zp=C`
4517
4517
  :host {
4518
4518
  display: inline-block;
4519
4519
  vertical-align: baseline;
@@ -4569,7 +4569,7 @@ CES.load();
4569
4569
  display: inline-block;
4570
4570
  vertical-align: middle;
4571
4571
  }
4572
- `,dd=Lp;var $p=0,qt=class extends V{constructor(){super();this.options=[];this.correctOption=O;this._dropdownOpen=!1;this._slotObserver=null;this._menuId=`qti-inline-choice-menu-${$p++}`;this.#o=e=>{(this.disabled||this.readonly)&&e.preventDefault()};this.#s=e=>{this.disabled||this.readonly||(e.key==="ArrowDown"||e.key==="Enter"||e.key===" ")&&(e.preventDefault(),this.#n(!0))};this.#a=e=>{let i=e.newState==="open";this._dropdownOpen!==i&&(this._dropdownOpen=i)};this.#c=e=>{if(!this._dropdownOpen)return;if(e.key==="Escape"){e.preventDefault(),this.#n(!1),this.#d();return}let t=this.#v(),i=this.renderRoot.activeElement,n=this.#l(),o=i||(n instanceof HTMLElement&&this.#u(n)?n:null),a=t.findIndex(l=>l===o);if(e.key==="ArrowDown"&&(e.preventDefault(),t[Math.min(t.length-1,Math.max(0,a+1))]?.focus()),e.key==="ArrowUp"&&(e.preventDefault(),t[Math.max(0,a-1)]?.focus()),e.key==="Enter"||e.key===" "){if(!o)return;if(e.preventDefault(),o instanceof HTMLButtonElement)o.click();else{let l=o.getAttribute("identifier")??"";this.#i(l)}}};this.#b=()=>{this.#t()};this.#f=e=>{if(this.disabled||this.readonly)return;let i=e.currentTarget.getAttribute("identifier")??"";this.#i(i)};this.internals.role="listbox"}get isInline(){return!0}static get styles(){return[dd]}render(){let e=this.#e();return x`
4572
+ `,wd=Zp;var eu=0,wt=class extends V{constructor(){super();this.options=[];this.correctOption=O;this._dropdownOpen=!1;this._slotObserver=null;this._menuId=`qti-inline-choice-menu-${eu++}`;this.#o=e=>{(this.disabled||this.readonly)&&e.preventDefault()};this.#s=e=>{this.disabled||this.readonly||(e.key==="ArrowDown"||e.key==="Enter"||e.key===" ")&&(e.preventDefault(),this.#n(!0))};this.#a=e=>{let i=e.newState==="open";this._dropdownOpen!==i&&(this._dropdownOpen=i)};this.#c=e=>{if(!this._dropdownOpen)return;if(e.key==="Escape"){e.preventDefault(),this.#n(!1),this.#d();return}let t=this.#v(),i=this.renderRoot.activeElement,n=this.#l(),s=i||(n instanceof HTMLElement&&this.#u(n)?n:null),a=t.findIndex(l=>l===s);if(e.key==="ArrowDown"&&(e.preventDefault(),t[Math.min(t.length-1,Math.max(0,a+1))]?.focus()),e.key==="ArrowUp"&&(e.preventDefault(),t[Math.max(0,a-1)]?.focus()),e.key==="Enter"||e.key===" "){if(!s)return;if(e.preventDefault(),s instanceof HTMLButtonElement)s.click();else{let l=s.getAttribute("identifier")??"";this.#i(l)}}};this.#b=()=>{this.#t()};this.#f=e=>{if(this.disabled||this.readonly)return;let i=e.currentTarget.getAttribute("identifier")??"";this.#i(i)};this.internals.role="listbox"}get isInline(){return!0}static get styles(){return[wd]}render(){let e=this.#e();return x`
4573
4573
  <button
4574
4574
  part="trigger"
4575
4575
  type="button"
@@ -4608,11 +4608,11 @@ CES.load();
4608
4608
  <slot @slotchange=${this.#b}></slot>
4609
4609
  </div>
4610
4610
  ${this.correctOption}
4611
- `}async connectedCallback(){super.connectedCallback(),this.#t(),this.#g(),await this.updateComplete,this.#r()}disconnectedCallback(){super.disconnectedCallback(),this.#y(),this._slotObserver?.disconnect(),this._slotObserver=null}willUpdate(e){e.has("configContext")&&this.#t()}updated(e){e.has("_dropdownOpen")&&this._dropdownOpen&&(this.#p(),this.#v()[0]?.focus()),(e.has("disabled")||e.has("readonly"))&&this.#p()}#e(){return this.options.find(e=>e.selected)??this.options[0]}#t(){let e=Array.from(this.querySelectorAll("qti-inline-choice")),t=this.dataset.prompt||this.configContext?.inlineChoicePrompt||"select",i=this.options.find(a=>a.selected)?.value??"",n=[{content:t,value:"",selected:i===""},...e.map(a=>{let l=a.getAttribute("identifier")??"";return{content:Array.from(a.childNodes).map(c=>c.cloneNode(!0)),value:l,selected:l!==""&&l===i}})],o=n.some(a=>a.selected);this.options=o?n:n.map((a,l)=>({...a,selected:l===0})),this.#p(),this.#r()}#r(){let e=this.#h(),t=this.renderRoot.querySelector('button[part="trigger"]');if(!e||!t)return;let i=t.querySelector('span[part~="dropdown-icon"]'),n=i?i.getBoundingClientRect().width:0,o=e.matches(":popover-open"),a=e.style.visibility,l=e.style.display;o||(e.style.visibility="hidden",e.style.display="block",e.showPopover());let c=e.getBoundingClientRect().width,p=Math.max(c,e.scrollWidth);o||(e.hidePopover(),e.style.visibility=a,e.style.display=l),t.style.width=`${p+n}px`}validate(){let e=this.options.find(t=>t.selected);return e?e.value!=="":!1}reset(){this.#n(!1),this.options=this.options.map((e,t)=>({...e,selected:t===0})),this.#p()}set response(e){let t=e??"";this.options=this.options.map(i=>({...i,selected:i.value===t})),this.#p()}get response(){let e=this.options.find(t=>t.selected)?.value??"";return e===""?null:e}toggleInternalCorrectResponse(e){super.toggleInternalCorrectResponse(e);let t=this.correctResponse;if(!e||!t){this.correctOption=O;return}let i=this.options.find(n=>t===n.value);if(!i){this.correctOption=O;return}this.correctOption=x`<span
4611
+ `}async connectedCallback(){super.connectedCallback(),this.#t(),this.#g(),await this.updateComplete,this.#r()}disconnectedCallback(){super.disconnectedCallback(),this.#y(),this._slotObserver?.disconnect(),this._slotObserver=null}willUpdate(e){e.has("configContext")&&this.#t()}updated(e){e.has("_dropdownOpen")&&this._dropdownOpen&&(this.#p(),this.#v()[0]?.focus()),(e.has("disabled")||e.has("readonly"))&&this.#p()}#e(){return this.options.find(e=>e.selected)??this.options[0]}#t(){let e=Array.from(this.querySelectorAll("qti-inline-choice")),t=this.dataset.prompt||this.configContext?.inlineChoicePrompt||"select",i=this.options.find(a=>a.selected)?.value??"",n=[{content:t,value:"",selected:i===""},...e.map(a=>{let l=a.getAttribute("identifier")??"";return{content:Array.from(a.childNodes).map(c=>c.cloneNode(!0)),value:l,selected:l!==""&&l===i}})],s=n.some(a=>a.selected);this.options=s?n:n.map((a,l)=>({...a,selected:l===0})),this.#p(),this.#r()}#r(){let e=this.#h(),t=this.renderRoot.querySelector('button[part="trigger"]');if(!e||!t)return;let i=t.querySelector('span[part~="dropdown-icon"]'),n=i?i.getBoundingClientRect().width:0,s=e.matches(":popover-open"),a=e.style.visibility,l=e.style.display;s||(e.style.visibility="hidden",e.style.display="block",e.showPopover());let c=e.getBoundingClientRect().width,p=Math.max(c,e.scrollWidth);s||(e.hidePopover(),e.style.visibility=a,e.style.display=l),t.style.width=`${p+n}px`}validate(){let e=this.options.find(t=>t.selected);return e?e.value!=="":!1}reset(){this.#n(!1),this.options=this.options.map((e,t)=>({...e,selected:t===0})),this.#p()}set response(e){let t=e??"";this.options=this.options.map(i=>({...i,selected:i.value===t})),this.#p()}get response(){let e=this.options.find(t=>t.selected)?.value??"";return e===""?null:e}toggleInternalCorrectResponse(e){super.toggleInternalCorrectResponse(e);let t=this.correctResponse;if(!e||!t){this.correctOption=O;return}let i=this.options.find(n=>t===n.value);if(!i){this.correctOption=O;return}this.correctOption=x`<span
4612
4612
  part="correct-option"
4613
4613
  style="border:1px solid var(--qti-correct); border-radius:4px; padding: 2px 4px; margin: 4px; display:inline-block"
4614
4614
  >${i.content}</span
4615
- >`}#i(e){this.options=this.options.map(t=>({...t,selected:t.value===e})),this.#p(),this.saveResponse(e),this.#n(!1)}#n(e){let t=this.#h();if(t){if(e){t.matches(":popover-open")||t.showPopover();return}t.matches(":popover-open")&&t.hidePopover()}}#o;#s;#a;#c;#d(){this.renderRoot.querySelector('button[part="trigger"]')?.focus()}#l(){let e=document.activeElement;for(;e&&e instanceof HTMLElement&&e.shadowRoot?.activeElement;)e=e.shadowRoot.activeElement;return e}#u(e){return e===this||this.contains(e)||this.renderRoot.contains(e)}#h(){return this.renderRoot.querySelector(`#${this._menuId}`)}#g(){this._slotObserver=new MutationObserver(()=>this.#t()),this._slotObserver.observe(this,{childList:!0,subtree:!0})}#b;#f;#y(){let e=Array.from(this.querySelectorAll("qti-inline-choice"));for(let t of e)t.removeEventListener("click",this.#f),t.removeAttribute("tabindex"),t.internals.role=null,t.internals.ariaSelected=null,t.internals.ariaChecked="false",t.internals.states.delete("--checked")}async#p(){await this.updateComplete;let e=this.options.find(i=>i.selected)?.value??"",t=Array.from(this.querySelectorAll("qti-inline-choice"));for(let i of t){let o=(i.getAttribute("identifier")??"")===e;i.removeEventListener("click",this.#f),i.addEventListener("click",this.#f),i.disabled=this.disabled,i.readonly=this.readonly,i.internals.role="option",i.internals.ariaSelected=o?"true":"false",i.internals.ariaChecked=o?"true":"false",i.internals.ariaDisabled=this.disabled?"true":"false",i.internals.ariaReadOnly=this.readonly?"true":"false",i.removeAttribute("aria-disabled"),i.removeAttribute("aria-readonly"),o?i.internals.states.add("--checked"):i.internals.states.delete("--checked"),i.tabIndex=-1}}#v(){let e=this.renderRoot.querySelector('button[part~="option"]'),t=Array.from(this.querySelectorAll("qti-inline-choice"));return[...e?[e]:[],...t]}};d([M()],qt.prototype,"options",2),d([M()],qt.prototype,"correctOption",2),d([M()],qt.prototype,"_dropdownOpen",2),d([$({context:ge,subscribe:!0}),g({attribute:!1})],qt.prototype,"configContext",2);customElements.define("qti-inline-choice-interaction",qt);var pd=C`
4615
+ >`}#i(e){this.options=this.options.map(t=>({...t,selected:t.value===e})),this.#p(),this.saveResponse(e),this.#n(!1)}#n(e){let t=this.#h();if(t){if(e){t.matches(":popover-open")||t.showPopover();return}t.matches(":popover-open")&&t.hidePopover()}}#o;#s;#a;#c;#d(){this.renderRoot.querySelector('button[part="trigger"]')?.focus()}#l(){let e=document.activeElement;for(;e&&e instanceof HTMLElement&&e.shadowRoot?.activeElement;)e=e.shadowRoot.activeElement;return e}#u(e){return e===this||this.contains(e)||this.renderRoot.contains(e)}#h(){return this.renderRoot.querySelector(`#${this._menuId}`)}#g(){this._slotObserver=new MutationObserver(()=>this.#t()),this._slotObserver.observe(this,{childList:!0,subtree:!0})}#b;#f;#y(){let e=Array.from(this.querySelectorAll("qti-inline-choice"));for(let t of e)t.removeEventListener("click",this.#f),t.removeAttribute("tabindex"),t.internals.role=null,t.internals.ariaSelected=null,t.internals.ariaChecked="false",t.internals.states.delete("--checked")}async#p(){await this.updateComplete;let e=this.options.find(i=>i.selected)?.value??"",t=Array.from(this.querySelectorAll("qti-inline-choice"));for(let i of t){let s=(i.getAttribute("identifier")??"")===e;i.removeEventListener("click",this.#f),i.addEventListener("click",this.#f),i.disabled=this.disabled,i.readonly=this.readonly,i.internals.role="option",i.internals.ariaSelected=s?"true":"false",i.internals.ariaChecked=s?"true":"false",i.internals.ariaDisabled=this.disabled?"true":"false",i.internals.ariaReadOnly=this.readonly?"true":"false",i.removeAttribute("aria-disabled"),i.removeAttribute("aria-readonly"),s?i.internals.states.add("--checked"):i.internals.states.delete("--checked"),i.tabIndex=-1}}#v(){let e=this.renderRoot.querySelector('button[part~="option"]'),t=Array.from(this.querySelectorAll("qti-inline-choice"));return[...e?[e]:[],...t]}};d([k()],wt.prototype,"options",2),d([k()],wt.prototype,"correctOption",2),d([k()],wt.prototype,"_dropdownOpen",2),d([$({context:ne,subscribe:!0}),g({attribute:!1})],wt.prototype,"configContext",2);customElements.define("qti-inline-choice-interaction",wt);var Ed=C`
4616
4616
  slot:not([hidden]) {
4617
4617
  /* slot where the */
4618
4618
  display: flex;
@@ -4638,7 +4638,7 @@ CES.load();
4638
4638
  /* Make sure the drag and drop container slots have the same width */
4639
4639
  flex: 1;
4640
4640
  }
4641
- `;var Pp=Ae(V,"qti-simple-match-set:first-of-type qti-simple-associable-choice, qti-simple-match-set:last-of-type > qti-simple-associable-choice > qti-simple-associable-choice","qti-simple-match-set:last-of-type > qti-simple-associable-choice","qti-simple-match-set:first-of-type"),wt=class extends Te(Pp,'[qti-draggable="true"]'){constructor(){super(...arguments);this.lastCheckedRadio=null;this.class="";this._response=[];this.responseIdentifier="";this.correctOptions=null;this.handleRadioClick=e=>{let t=e.target;this.lastCheckedRadio===t?(t.checked=!1,this.lastCheckedRadio=null,this.handleRadioChange(e)):this.lastCheckedRadio=t};this.handleRadioChange=e=>{let t=e.target,i=t.value,n=t.name,o=t.type;t.checked?(this.response?this.response.indexOf(i)===-1&&(o==="radio"&&(this.response=(this.response||[]).filter(a=>a.indexOf(n)===-1)),this.response=[...this.response,i]):this.response=[i],this.lastCheckedRadio=t):(this.response=(this.response||[]).filter(a=>a!==i),this.lastCheckedRadio=null),this.requestUpdate(),this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:Array.isArray(this.response)?[...this.response]:this.response}}))}}static{this.styles=pd}get response(){return this.classList.contains("qti-match-tabular")?this._response:super.response}set response(e){this.classList.contains("qti-match-tabular")?this._response=e:super.response=e}async connectedCallback(){super.connectedCallback(),this.sourceChoices=Array.from(this.querySelectorAll("qti-simple-match-set:first-of-type qti-simple-associable-choice")),this.targetChoices=Array.from(this.querySelectorAll("qti-simple-match-set:last-of-type qti-simple-associable-choice")),this.response=[]}validate(){return this.class.split(" ").includes("qti-match-tabular")?this.response?.length===this.sourceChoices.length:super.validate()}#e(e){if(!e.correctResponse)return[];let t=Array.isArray(e.correctResponse)?e.correctResponse:[e.correctResponse],i=[];return t&&t.forEach(n=>{let o=n.split(" ");i.push({source:o[0],target:o[1]})}),i}toggleInternalCorrectResponse(e){let t=this.responseVariable;if(!t?.correctResponse){this.querySelectorAll(".correct-option").forEach(n=>n.remove());return}let i=this.#e(t);this.class.split(" ").includes("qti-match-tabular")?e?this.correctOptions=i||[]:this.correctOptions=null:e?(this.querySelectorAll(".correct-option").forEach(n=>n.remove()),this.targetChoices.forEach(n=>{let o=n.getAttribute("identifier"),a=i.find(l=>l.target===o);if(a?.source){let l=this.querySelector(`qti-simple-associable-choice[identifier="${a.source}"]`),c=Array.from(l?.childNodes||[]).map(p=>p.cloneNode(!0));if(c.length>0&&!n.previousElementSibling?.classList.contains("correct-option")){let p=document.createElement("span");p.classList.add("correct-option"),c.forEach(u=>p.appendChild(u)),p.style.border="1px solid var(--qti-correct)",p.style.borderRadius="4px",p.style.padding="2px 4px",p.style.display="inline-block",n.insertAdjacentElement("beforebegin",p)}}})):this.correctOptions=null}toggleCandidateCorrection(e){let t=this.responseVariable;if(!t?.correctResponse)return;let i=this.#e(t);this.targetChoices.forEach(n=>{let o=n.getAttribute("identifier"),a=i.filter(c=>c.target===o);n.querySelectorAll("qti-simple-associable-choice").forEach(c=>{if(c.internals.states.delete("candidate-correct"),c.internals.states.delete("candidate-incorrect"),!e)return;a.find(u=>u.source===c.identifier)?.source!==void 0?c.internals.states.add("candidate-correct"):c.internals.states.add("candidate-incorrect")})})}render(){let e=this.class.split(" ").includes("qti-match-tabular"),t=this.correctOptions!==null;return x`
4641
+ `;var tu=Te(V,"qti-simple-match-set:first-of-type qti-simple-associable-choice, qti-simple-match-set:last-of-type > qti-simple-associable-choice > qti-simple-associable-choice","qti-simple-match-set:last-of-type > qti-simple-associable-choice","qti-simple-match-set:first-of-type"),Et=class extends Ie(tu,'[qti-draggable="true"]'){constructor(){super(...arguments);this.lastCheckedRadio=null;this.class="";this._response=[];this.responseIdentifier="";this.correctOptions=null;this.handleRadioClick=e=>{let t=e.target;this.lastCheckedRadio===t?(t.checked=!1,this.lastCheckedRadio=null,this.handleRadioChange(e)):this.lastCheckedRadio=t};this.handleRadioChange=e=>{let t=e.target,i=t.value,n=t.name,s=t.type;t.checked?(this.response?this.response.indexOf(i)===-1&&(s==="radio"&&(this.response=(this.response||[]).filter(a=>a.indexOf(n)===-1)),this.response=[...this.response,i]):this.response=[i],this.lastCheckedRadio=t):(this.response=(this.response||[]).filter(a=>a!==i),this.lastCheckedRadio=null),this.requestUpdate(),this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:Array.isArray(this.response)?[...this.response]:this.response}}))}}static{this.styles=Ed}get response(){return this.classList.contains("qti-match-tabular")?this._response:super.response}set response(e){this.classList.contains("qti-match-tabular")?this._response=e:super.response=e}async connectedCallback(){super.connectedCallback(),this.sourceChoices=Array.from(this.querySelectorAll("qti-simple-match-set:first-of-type qti-simple-associable-choice")),this.targetChoices=Array.from(this.querySelectorAll("qti-simple-match-set:last-of-type qti-simple-associable-choice")),this.response=[]}validate(){return this.class.split(" ").includes("qti-match-tabular")?this.response?.length===this.sourceChoices.length:super.validate()}#e(e){if(!e.correctResponse)return[];let t=Array.isArray(e.correctResponse)?e.correctResponse:[e.correctResponse],i=[];return t&&t.forEach(n=>{let s=n.split(" ");i.push({source:s[0],target:s[1]})}),i}toggleInternalCorrectResponse(e){let t=this.responseVariable;if(!t?.correctResponse){this.querySelectorAll(".correct-option").forEach(n=>n.remove());return}let i=this.#e(t);this.class.split(" ").includes("qti-match-tabular")?e?this.correctOptions=i||[]:this.correctOptions=null:e?(this.querySelectorAll(".correct-option").forEach(n=>n.remove()),this.targetChoices.forEach(n=>{let s=n.getAttribute("identifier"),a=i.find(l=>l.target===s);if(a?.source){let l=this.querySelector(`qti-simple-associable-choice[identifier="${a.source}"]`),c=Array.from(l?.childNodes||[]).map(p=>p.cloneNode(!0));if(c.length>0&&!n.previousElementSibling?.classList.contains("correct-option")){let p=document.createElement("span");p.classList.add("correct-option"),c.forEach(u=>p.appendChild(u)),p.style.border="1px solid var(--qti-correct)",p.style.borderRadius="4px",p.style.padding="2px 4px",p.style.display="inline-block",n.insertAdjacentElement("beforebegin",p)}}})):this.correctOptions=null}toggleCandidateCorrection(e){let t=this.responseVariable;if(!t?.correctResponse)return;let i=this.#e(t);this.targetChoices.forEach(n=>{let s=n.getAttribute("identifier"),a=i.filter(c=>c.target===s);n.querySelectorAll("qti-simple-associable-choice").forEach(c=>{if(c.internals.states.delete("candidate-correct"),c.internals.states.delete("candidate-incorrect"),!e)return;a.find(u=>u.source===c.identifier)?.source!==void 0?c.internals.states.add("candidate-correct"):c.internals.states.add("candidate-incorrect")})})}render(){let e=this.class.split(" ").includes("qti-match-tabular"),t=this.correctOptions!==null;return x`
4642
4642
  <slot name="prompt"></slot>
4643
4643
  <slot ?hidden=${e}></slot>
4644
4644
 
@@ -4651,17 +4651,17 @@ CES.load();
4651
4651
 
4652
4652
  ${this.sourceChoices.map(i=>x`<tr part="row">
4653
4653
  <td part="c-header">${Array.from(i.childNodes).map(n=>n.cloneNode(!0))}</td>
4654
- ${this.targetChoices.map(n=>{let o=i.getAttribute("identifier"),a=n.getAttribute("identifier"),l=`${o} ${a}`,c=(this.response||[]).filter(w=>w.split(" ")[0]===o).length||0,p=this.response?.includes(l)||!1,u=i.matchMax===1?"radio":"checkbox",m=!!this.correctOptions?.find(w=>w.source===o&&w.target===a),y=u==="radio"?`rb ${p?"rb-checked":""} ${t?m?"rb-correct":"rb-incorrect":""}`:`cb ${p?"cb-checked":""} ${t?m?"cb-correct":"cb-incorrect":""}`,b=this.correctOptions?.length>0?!0:i.matchMax===1?!1:i.matchMax!==0&&c>=i.matchMax&&!p;return x`<td part="input-cell">
4654
+ ${this.targetChoices.map(n=>{let s=i.getAttribute("identifier"),a=n.getAttribute("identifier"),l=`${s} ${a}`,c=(this.response||[]).filter(w=>w.split(" ")[0]===s).length||0,p=this.response?.includes(l)||!1,u=i.matchMax===1?"radio":"checkbox",h=!!this.correctOptions?.find(w=>w.source===s&&w.target===a),v=u==="radio"?`rb ${p?"rb-checked":""} ${t?h?"rb-correct":"rb-incorrect":""}`:`cb ${p?"cb-checked":""} ${t?h?"cb-correct":"cb-incorrect":""}`,y=this.correctOptions?.length>0?!0:i.matchMax===1?!1:i.matchMax!==0&&c>=i.matchMax&&!p;return x`<td part="input-cell">
4655
4655
  <div
4656
4656
  class="input-container"
4657
4657
  style="position: relative; width: 24px; height: 24px; margin: 0 auto;"
4658
4658
  >
4659
4659
  <input
4660
4660
  type=${u}
4661
- part=${y}
4662
- name=${o}
4661
+ part=${v}
4662
+ name=${s}
4663
4663
  value=${l}
4664
- .disabled=${b}
4664
+ .disabled=${y}
4665
4665
  @change=${w=>this.handleRadioChange(w)}
4666
4666
  @click=${w=>i.matchMax===1?this.handleRadioClick(w):null}
4667
4667
  />
@@ -4681,8 +4681,8 @@ CES.load();
4681
4681
  `:O}
4682
4682
 
4683
4683
  <div role="alert" part="message" id="validation-message"></div>
4684
- `}};d([g({type:String})],wt.prototype,"class",2),d([M()],wt.prototype,"_response",2),d([g({type:String,attribute:"response-identifier"})],wt.prototype,"responseIdentifier",2),d([M()],wt.prototype,"correctOptions",2);customElements.define("qti-match-interaction",wt);var ud=C``;var uo=class extends V{static{this.styles=ud}#e=null;reset(){this.#e=null}validate(){return!0}get response(){return this.#e?this.#e.toString():null}set response(r){if(r)if(!isNaN(parseInt(r?.toString())))this.#e=parseInt(r.toString());else throw new Error(`Value must be a number ${r}`)}static get properties(){return{...V.properties,step:{type:Number,attribute:"step",default:10}}}render(){return x` <slot name="prompt"></slot>
4685
- <slot></slot>`}constructor(){super()}connectedCallback(){super.connectedCallback();let r=this.querySelector("audio")||this.querySelector("video")||this.querySelector("object");r&&r.addEventListener("ended",()=>{this.#e++,this.saveResponse(this.value)})}};customElements.define("qti-media-interaction",uo);var md=C`
4684
+ `}};d([g({type:String})],Et.prototype,"class",2),d([k()],Et.prototype,"_response",2),d([g({type:String,attribute:"response-identifier"})],Et.prototype,"responseIdentifier",2),d([k()],Et.prototype,"correctOptions",2);customElements.define("qti-match-interaction",Et);var Cd=C``;var go=class extends V{static{this.styles=Cd}#e=null;reset(){this.#e=null}validate(){return!0}get response(){return this.#e?this.#e.toString():null}set response(r){if(r)if(!isNaN(parseInt(r?.toString())))this.#e=parseInt(r.toString());else throw new Error(`Value must be a number ${r}`)}static get properties(){return{...V.properties,step:{type:Number,attribute:"step",default:10}}}render(){return x` <slot name="prompt"></slot>
4685
+ <slot></slot>`}constructor(){super()}connectedCallback(){super.connectedCallback();let r=this.querySelector("audio")||this.querySelector("video")||this.querySelector("object");r&&r.addEventListener("ended",()=>{this.#e++,this.saveResponse(this.value)})}};customElements.define("qti-media-interaction",go);var Sd=C`
4686
4686
  [part='drags'] {
4687
4687
  display: flex;
4688
4688
  align-items: flex-start;
@@ -4758,13 +4758,13 @@ CES.load();
4758
4758
  :host(.qti-choices-right) [part='container'] {
4759
4759
  flex-direction: row-reverse;
4760
4760
  }
4761
- `;var Vp=Ae(V,"qti-simple-choice","drop-list","slot[part='drags']"),Et=class extends Te(Vp,'[qti-draggable="true"]'){constructor(){super(...arguments);this.nrChoices=0;this.correctResponses=[];this.showCorrectResponses=!1}static{this.styles=md}#e(){let e=this.responseVariable;return e?.correctResponse?(Array.isArray(e.correctResponse)?e.correctResponse:[e.correctResponse]).map((i,n)=>{let[o,a]=i.split(" "),l=a?.startsWith("droplist")?parseInt(a.replace("droplist",""),10):n,c=Number.isNaN(l)?n:l;return{identifier:o,dropIndex:c}}).filter(i=>!!i.identifier):[]}render(){let e=Array.from(this.querySelectorAll("qti-simple-choice"));return this.nrChoices<e.length&&(this.nrChoices=e.length),x` <slot name="prompt"> </slot>
4761
+ `;var ru=Te(V,"qti-simple-choice","drop-list","slot[part='drags']"),Ct=class extends Ie(ru,'[qti-draggable="true"]'){constructor(){super(...arguments);this.nrChoices=0;this.correctResponses=[];this.showCorrectResponses=!1}static{this.styles=Sd}#e(){let e=this.responseVariable;return e?.correctResponse?(Array.isArray(e.correctResponse)?e.correctResponse:[e.correctResponse]).map((i,n)=>{let[s,a]=i.split(" "),l=a?.startsWith("droplist")?parseInt(a.replace("droplist",""),10):n,c=Number.isNaN(l)?n:l;return{identifier:s,dropIndex:c}}).filter(i=>!!i.identifier):[]}render(){let e=Array.from(this.querySelectorAll("qti-simple-choice"));return this.nrChoices<e.length&&(this.nrChoices=e.length),x` <slot name="prompt"> </slot>
4762
4762
  <div part="container">
4763
4763
  <slot part="drags"> </slot>
4764
4764
  <div part="drops">
4765
4765
  ${[...Array(this.nrChoices)].map((t,i)=>x`<drop-list role="region" part="drop-list" identifier="droplist${i}"></drop-list>`)}
4766
4766
  </div>
4767
- </div>`}toggleCorrectResponse(e){if(this.shadowRoot.querySelectorAll(".correct-option").forEach(t=>t.remove()),e){let t=this.#e(),i=new Map;Array.from(this.querySelectorAll("qti-simple-choice")).forEach(n=>{let o=n.getAttribute("identifier"),a=n.textContent?.trim();o&&a&&i.set(o,a)}),t.forEach(({identifier:n,dropIndex:o})=>{let a=i.get(n);if(!a)return;let l=this.shadowRoot.querySelector(`drop-list[identifier="droplist${o}"]`);if(!l)return;let c=document.createElement("span");c.classList.add("correct-option"),c.textContent=a,c.style.border="1px solid var(--qti-correct)",c.style.borderRadius="4px",c.style.padding="2px 4px",c.style.display="inline-block",c.style.marginTop="4px",l.insertAdjacentElement("afterend",c)})}}toggleCandidateCorrection(e){if(super.toggleCandidateCorrection(e),Array.from(this.shadowRoot.querySelectorAll('drop-list [qti-draggable="true"]')).forEach(a=>{a.internals.states.delete("candidate-correct"),a.internals.states.delete("candidate-incorrect")}),!e)return;let i=this.#e(),n=new Map;i.forEach(a=>n.set(a.dropIndex,a.identifier)),Array.from(this.shadowRoot.querySelectorAll("drop-list")).forEach((a,l)=>{let c=a.querySelector('[qti-draggable="true"]');if(!c)return;let p=n.get(l),u=c.getAttribute("identifier");p&&u===p?c.internals.states.add("candidate-correct"):c.internals.states.add("candidate-incorrect")})}getValue(e){return e?.map((t,i)=>`${t} droplist${i}`)||[]}getResponse(){return Array.from(this.shadowRoot.querySelectorAll("drop-list")).map(i=>{let n=i.querySelectorAll('[qti-draggable="true"]');return[...Array.from(n).map(a=>a.getAttribute("identifier"))].join(" ")})}shouldTreatBlockedMaxAsInvalid(){return!1}async firstUpdated(){super.firstUpdated(),this.childrenMap=Array.from(this.querySelectorAll("qti-simple-choice")),this.childrenMap.forEach(e=>e.setAttribute("part","qti-simple-choice"))}};d([M()],Et.prototype,"nrChoices",2),d([M()],Et.prototype,"correctResponses",2),d([M()],Et.prototype,"showCorrectResponses",2),d([g({type:String})],Et.prototype,"orientation",2);customElements.define("qti-order-interaction",Et);var hd=C`
4767
+ </div>`}toggleCorrectResponse(e){if(this.shadowRoot.querySelectorAll(".correct-option").forEach(t=>t.remove()),e){let t=this.#e(),i=new Map;Array.from(this.querySelectorAll("qti-simple-choice")).forEach(n=>{let s=n.getAttribute("identifier"),a=n.textContent?.trim();s&&a&&i.set(s,a)}),t.forEach(({identifier:n,dropIndex:s})=>{let a=i.get(n);if(!a)return;let l=this.shadowRoot.querySelector(`drop-list[identifier="droplist${s}"]`);if(!l)return;let c=document.createElement("span");c.classList.add("correct-option"),c.textContent=a,c.style.border="1px solid var(--qti-correct)",c.style.borderRadius="4px",c.style.padding="2px 4px",c.style.display="inline-block",c.style.marginTop="4px",l.insertAdjacentElement("afterend",c)})}}toggleCandidateCorrection(e){if(super.toggleCandidateCorrection(e),Array.from(this.shadowRoot.querySelectorAll('drop-list [qti-draggable="true"]')).forEach(a=>{a.internals.states.delete("candidate-correct"),a.internals.states.delete("candidate-incorrect")}),!e)return;let i=this.#e(),n=new Map;i.forEach(a=>n.set(a.dropIndex,a.identifier)),Array.from(this.shadowRoot.querySelectorAll("drop-list")).forEach((a,l)=>{let c=a.querySelector('[qti-draggable="true"]');if(!c)return;let p=n.get(l),u=c.getAttribute("identifier");p&&u===p?c.internals.states.add("candidate-correct"):c.internals.states.add("candidate-incorrect")})}getValue(e){return e?.map((t,i)=>`${t} droplist${i}`)||[]}getResponse(){return Array.from(this.shadowRoot.querySelectorAll("drop-list")).map(i=>{let n=i.querySelectorAll('[qti-draggable="true"]');return[...Array.from(n).map(a=>a.getAttribute("identifier"))].join(" ")})}shouldTreatBlockedMaxAsInvalid(){return!1}async firstUpdated(){super.firstUpdated(),this.childrenMap=Array.from(this.querySelectorAll("qti-simple-choice")),this.childrenMap.forEach(e=>e.setAttribute("part","qti-simple-choice"))}};d([k()],Ct.prototype,"nrChoices",2),d([k()],Ct.prototype,"correctResponses",2),d([k()],Ct.prototype,"showCorrectResponses",2),d([g({type:String})],Ct.prototype,"orientation",2);customElements.define("qti-order-interaction",Ct);var Ad=C`
4768
4768
  :host {
4769
4769
  display: block;
4770
4770
  width: 100%;
@@ -4774,14 +4774,14 @@ CES.load();
4774
4774
  ::slotted(qti-interaction-markup) {
4775
4775
  display: none;
4776
4776
  }
4777
- `;var K=class extends V{constructor(){super(...arguments);this._iframeLoaded=!1;this._pendingMessages=[];this._iframeMessageOrigin=null;this._iframeObjectUrl=null;this.requirePathsJson="";this.requireShimJson="";this.requireJsUrl="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js";this.baseUrl="";this.useDefaultPaths=!1;this._errorMessage=null;this.response=null;this.#t=null;this.#r=null;this.#i=null;this.#n="";this.handleIframeMessage=e=>{let{data:t}=e;if(!(!t||t.source!=="qti-pci-iframe")&&!(!this.iframe?.contentWindow||e.source!==this.iframe.contentWindow)&&!(t.responseIdentifier&&t.responseIdentifier!==this.responseIdentifier)){if(this._iframeMessageOrigin===null)this._iframeMessageOrigin=e.origin;else if(e.origin!==this._iframeMessageOrigin)return;switch(t.method){case"iframeReady":this.#q(),this.#y(),this.dispatchEvent(new CustomEvent("qti-portable-custom-interaction-loaded",{bubbles:!0}));break;case"resize":typeof t.height=="number"&&this.iframe&&(this.iframe.style.height=`${t.height}px`,this.iframe.style.width=`${t.width}px`);break;case"console":this.dispatchEvent(new CustomEvent("qti-pci-console",{detail:{level:t.level,args:t.args},bubbles:!0}));break;case"interactionChanged":{let i=t?.params?.value,n=i&&typeof i=="object"?this.#d(i):null,o=typeof t?.params?.valid=="boolean"?t.params.valid:null,a=typeof t?.params?.customValidity=="string"?t.params.customValidity:null;o!==null&&(this.#i=o,o&&a===null&&(this.#n="")),a!==null&&(this.#n=a);let l=t?.params?.state,c;if(l===void 0)c=void 0;else if(l===null)c=null;else if(typeof l=="string")c=l;else try{c=`__qti_json__::${JSON.stringify(l)}`}catch{c=null}if(n===null){let p=this.responseVariable?.cardinality==="single"?"":[];this.response=p,this.validate(),this.saveResponse(p,c);break}this.response=n,this.validate(),this.saveResponse(n,c);break}case"error":this._errorMessage=t.params.message,console.error("Error from PCI iframe:",t.params.message);break}}};this.#m=null}#e;static{this.styles=[hd,C`
4777
+ `;var K=class extends V{constructor(){super(...arguments);this._iframeLoaded=!1;this._pendingMessages=[];this._iframeMessageOrigin=null;this._iframeObjectUrl=null;this.requirePathsJson="";this.requireShimJson="";this.requireJsUrl="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js";this.baseUrl="";this.useDefaultPaths=!1;this._errorMessage=null;this.response=null;this.#t=null;this.#r=null;this.#i=null;this.#n="";this.handleIframeMessage=e=>{let{data:t}=e;if(!(!t||t.source!=="qti-pci-iframe")&&!(!this.iframe?.contentWindow||e.source!==this.iframe.contentWindow)&&!(t.responseIdentifier&&t.responseIdentifier!==this.responseIdentifier)){if(this._iframeMessageOrigin===null)this._iframeMessageOrigin=e.origin;else if(e.origin!==this._iframeMessageOrigin)return;switch(t.method){case"iframeReady":this.#q(),this.#y(),this.dispatchEvent(new CustomEvent("qti-portable-custom-interaction-loaded",{bubbles:!0}));break;case"resize":typeof t.height=="number"&&this.iframe&&(this.iframe.style.height=`${t.height}px`,this.iframe.style.width=`${t.width}px`);break;case"console":this.dispatchEvent(new CustomEvent("qti-pci-console",{detail:{level:t.level,args:t.args},bubbles:!0}));break;case"interactionChanged":{let i=t?.params?.value,n=i&&typeof i=="object"?this.#d(i):null,s=typeof t?.params?.valid=="boolean"?t.params.valid:null,a=typeof t?.params?.customValidity=="string"?t.params.customValidity:null;s!==null&&(this.#i=s,s&&a===null&&(this.#n="")),a!==null&&(this.#n=a);let l=t?.params?.state,c;if(l===void 0)c=void 0;else if(l===null)c=null;else if(typeof l=="string")c=l;else try{c=`__qti_json__::${JSON.stringify(l)}`}catch{c=null}if(n===null){let p=this.responseVariable?.cardinality==="single"?"":[];this.response=p,this.validate(),this.saveResponse(p,c);break}this.response=n,this.validate(),this.saveResponse(n,c);break}case"error":this._errorMessage=t.params.message,console.error("Error from PCI iframe:",t.params.message);break}}};this.#m=null}#e;static{this.styles=[Ad,C`
4778
4778
  :host {
4779
4779
  display: block;
4780
4780
  width: 100%;
4781
4781
  min-height: 50px;
4782
4782
  }
4783
- `]}#t;#r;#i;#n;#o(){if(this.#t===null&&this.requirePathsJson)try{let e=JSON.parse(this.requirePathsJson);if(Array.isArray(e)||!e||typeof e!="object")throw new Error("Require paths must be a JSON object.");this.#t=e}catch(e){console.error("Error parsing require paths JSON:",e),this._errorMessage=`Error parsing require paths JSON: ${e.message}`,this.#t={}}return this.#t||{}}#s(){if(this.#r===null&&this.requireShimJson)try{this.#r=JSON.parse(this.requireShimJson)}catch(e){console.error("Error parsing require shim JSON:",e),this._errorMessage=`Error parsing require shim JSON: ${e.message}`,this.#r={}}return this.#r||{}}#a(){return this.#o()}#c(){return this.#s()}#d(e){for(let t in e)if(e.hasOwnProperty(t)){let i=e[t];if(i){for(let n in i)if(i.hasOwnProperty(n)){let o=i[n];if(Array.isArray(o))return o.map(String);if(o!=null)return String(o)}}}return null}getDirectChildrenByTag(e){let t=e.toLowerCase();return Array.from(this.children).filter(i=>i.tagName.toLowerCase()===t)}coerceBaseValue(e,t){if(e==null)return e;switch(t){case"integer":{if(typeof e=="number")return e;let i=parseInt(String(e),10);return Number.isNaN(i)?e:i}case"float":case"duration":{if(typeof e=="number")return e;let i=parseFloat(String(e));return Number.isNaN(i)?e:i}case"boolean":{if(typeof e=="boolean")return e;if(typeof e=="string"){let i=e.toLowerCase();if(i==="true")return!0;if(i==="false")return!1}return e}default:return String(e)}}normalizeListValue(e){return e==null?[]:Array.isArray(e)?e:[e]}variableToQtiVariableJSON(e,t,i){if(t==="record"||i==="record")return this.recordToQtiVariableJSON(e);if(t!=="single"){let n=this.normalizeListValue(e).map(o=>this.coerceBaseValue(o,i));return{list:{[i]:n}}}return{base:{[i]:this.coerceBaseValue(e,i)}}}recordToQtiVariableJSON(e){if(!e||typeof e!="object")return{record:[]};let t=[];for(let[i,n]of Object.entries(e))t.push(this.recordEntryFromValue(i,n));return{record:t}}recordEntryFromValue(e,t){if(Array.isArray(t)){let i=t.filter(n=>n!=null);if(i.length&&i.every(n=>typeof n=="boolean"))return{name:e,list:{boolean:i}};if(i.length&&i.every(n=>typeof n=="number")){let n=i,o=n.every(a=>Number.isInteger(a));return{name:e,list:{[o?"integer":"float"]:n}}}return{name:e,list:{string:t.map(n=>n==null?"":String(n))}}}if(typeof t=="boolean")return{name:e,base:{boolean:t}};if(typeof t=="number")return Number.isInteger(t)?{name:e,base:{integer:t}}:{name:e,base:{float:t}};if(t==null)return{name:e,base:{string:""}};if(typeof t=="object")try{return{name:e,base:{string:JSON.stringify(t)}}}catch{return{name:e,base:{string:String(t)}}}return{name:e,base:{string:String(t)}}}getQtiContextDefaultsFromItem(){let e=this.closest("qti-assessment-item");if(!e)return{};let t={};return e.querySelectorAll('qti-context-declaration[identifier="QTI_CONTEXT"]').forEach(n=>{let o=n.querySelector("qti-default-value");if(!o)return;o.querySelectorAll("qti-value[field-identifier]").forEach(l=>{let c=l.getAttribute("field-identifier");if(!c)return;let p=l.getAttribute("base-type")||"string",u=l.textContent?.trim()||"";t[c]=this.coerceBaseValue(u,p)})}),t}getQtiContextRecord(){let e=this.getQtiContextDefaultsFromItem(),t=this.qtiContext?.QTI_CONTEXT||{},i={...e,...t};if(!Object.keys(i).length)return null;let n={candidateIdentifier:i.candidateIdentifier??"",testIdentifier:i.testIdentifier??"",environmentIdentifier:i.environmentIdentifier??"",...i};return this.recordToQtiVariableJSON(n)}getTemplateVariables(){let e={},t=this.getDirectChildrenByTag("qti-template-variable");return t.length&&t.forEach(i=>{let n=i.getAttribute("template-identifier")||i.getAttribute("identifier")||"";if(!n)return;let o=this.context?.variables?.find(c=>c.identifier===n);if(!o)return;let a=o.cardinality||"single",l=o.baseType||"string";e[n]=this.variableToQtiVariableJSON(o.value,a,l)}),e}getContextVariables(){let e={},t=this.getDirectChildrenByTag("qti-context-variable");return t.length&&t.forEach(i=>{let n=i.getAttribute("identifier")||"";if(!n)return;if(n==="QTI_CONTEXT"){let c=this.getQtiContextRecord();c&&(e[n]=c);return}let o=this.context?.variables?.find(c=>c.identifier===n);if(!o)return;let a=o.cardinality||"single",l=o.baseType||"string";e[n]=this.variableToQtiVariableJSON(o.value,a,l)}),e}#l(e){let t={...e};for(let i in e)if(Object.prototype.hasOwnProperty.call(e,i)){let n=i.replace(/[A-Z]/g,o=>`-${o.toLowerCase()}`);t[n]=e[i]}return t}#u(e){let t={...e},i=(n,o,a)=>{let l=n;for(let c=0;c<o.length;c+=1){let p=o[c];if(c===o.length-1){l[p]=a;return}(!l[p]||typeof l[p]!="object"||Array.isArray(l[p]))&&(l[p]={}),l=l[p]}};for(let[n,o]of Object.entries(e)){if(!n.includes("__"))continue;let a=n.split("__").filter(Boolean);a.length<2||i(t,a,o)}return t}responseVariablesToQtiVariableJSON(e,t,i){if(t!=="single"){let n={list:{}};return n.list[i]=e,n}else{let n={base:{}};return n.base[i]=e,n}}#h(){return this.response===null||this.response===void 0?!1:Array.isArray(this.response)?this.response.length===0?!1:this.response.some(e=>e!==""&&e!==null&&e!==void 0):this.response!==""}#g(e,t){let i=this.dataset.invalidresponsemessage||"Invalid response.",n=e?"":t&&t.trim().length>0?t:i;this._internals.setValidity(e?{}:{customError:!0},n)}validate(){let e=typeof this.#i=="boolean"?this.#i:this.#h();return this.#g(e,this.#n),e}set value(e){e===null?this.#e=[]:this.#e=Array.isArray(e)?e:e.split(",")}get value(){return this.#e===null||this.#e===void 0?null:Array.isArray(this.#e)?this.#e.join(","):String(this.#e)}set boundTo(e){if(!e||!e[this.responseIdentifier])return;let t=this.#d(e[this.responseIdentifier]);this.#e=t,this.saveResponse(t)}get boundTo(){let e={};if(this.context?.variables?.find(i=>i.identifier===this.responseIdentifier)){let i=this.context?.variables?.find(l=>l.identifier===this.responseIdentifier)?.cardinality||"single",n=this.context?.variables?.find(l=>l.identifier===this.responseIdentifier)?.baseType||"string",o=this.context?.variables?.find(l=>l.identifier===this.responseIdentifier)?.value||null,a=this.responseVariablesToQtiVariableJSON(o,i,n);e[this.responseIdentifier]=a}return e}#b(e){return e&&e.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#x27;/g,"'").replace(/&#x2F;/g,"/").replace(/&#x60;/g,"`").replace(/&#x3D;/g,"=")}#f(e){let t={};for(let[i,n]of Object.entries(e))typeof n=="string"?t[i]=this.#b(n):t[i]=n;return t}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("message",this.handleIframeMessage),this._iframeObjectUrl&&(URL.revokeObjectURL(this._iframeObjectUrl),this._iframeObjectUrl=null)}sendMessageToIframe(e,t){let i=this.iframe?.contentWindow;if(!this._iframeLoaded||!i){this._pendingMessages.push({method:e,params:t});return}i.postMessage({source:"qti-portable-custom-interaction",responseIdentifier:this.responseIdentifier,method:e,params:t},"*")}#y(){this._pendingMessages.length&&(this._pendingMessages.forEach(e=>{this.sendMessageToIframe(e.method,e.params)}),this._pendingMessages=[])}createIframe(){this._iframeObjectUrl&&(URL.revokeObjectURL(this._iframeObjectUrl),this._iframeObjectUrl=null),this.iframe=document.createElement("iframe"),this.iframe.id=`pci-iframe-${this.responseIdentifier}`,this.iframe.setAttribute("title","QTI PCI Iframe"),this.iframe.setAttribute("aria-label","QTI PCI Iframe"),this.iframe.setAttribute("aria-hidden","false"),this.iframe.setAttribute("role","application"),this.iframe.style.width="100%",this.iframe.style.border="none",this.iframe.style.display="block",this.iframe.onload=()=>{this._iframeLoaded=!0,this._iframeObjectUrl&&(URL.revokeObjectURL(this._iframeObjectUrl),this._iframeObjectUrl=null),this.#x(),this.#p()};let e=`qti-pci-${this.responseIdentifier}-${Date.now()}`;this.iframe.name=e;let t=this.generateIframeContent();try{let i=new Blob([t],{type:"text/html"});this._iframeObjectUrl=URL.createObjectURL(i),this.iframe.src=this._iframeObjectUrl}catch{let i=encodeURIComponent(t);this.iframe.src=`data:text/html;charset=utf-8,${i}`}this.appendChild(this.iframe)}#p(){let e=this.#l(this.#u(this.#f({...this.dataset}))),t=this.context?.state?.[this.responseIdentifier],i=typeof t=="string"&&t.length>0?t:null,n={module:this.module,customInteractionTypeIdentifier:this.customInteractionTypeIdentifier,baseUrl:this.baseUrl?this.baseUrl.startsWith("http")||this.baseUrl.startsWith("blob")||this.baseUrl.startsWith("base64")?this.baseUrl:bn(`${window.location.origin}${this.baseUrl}`):window.location.origin,responseIdentifier:this.responseIdentifier,properties:e,contextVariables:this.getContextVariables(),templateVariables:this.getTemplateVariables(),dataAttributes:{...this.dataset},interactionModules:this.#v(),boundTo:i?null:this.boundTo,state:i};this.sendMessageToIframe("initialize",n)}#v(){let e=[],t=this.querySelector("qti-interaction-modules");if(t){let i=t.querySelectorAll("qti-interaction-module");for(let n of i)e.push({id:n.getAttribute("id"),primaryPath:n.getAttribute("primary-path"),fallbackPath:n.getAttribute("fallback-path")})}return e}#x(){let e=this.querySelector("qti-interaction-markup");e&&this.sendMessageToIframe("setMarkup",e.innerHTML);let t=Array.from(this.querySelectorAll("qti-stylesheet"));if(t.length){let n=t.map(o=>o.outerHTML).join(`
4784
- `);this.sendMessageToIframe("setStylesheets",n)}let i=this.querySelector("properties");i&&this.sendMessageToIframe("setProperties",i.innerHTML)}#q(){}connectedCallback(){super.connectedCallback(),this.#i=null,this.#n="",this.response=this.responseVariable?.value??null,window.addEventListener("message",this.handleIframeMessage),this.createIframe()}generateIframeContent(){let e=window.getComputedStyle(document.body),t=JSON.stringify(this.#a()),i=JSON.stringify(this.#c()),n=this.dataset.baseUrl?this.dataset.baseUrl.startsWith("/")?`${window.location.origin}${this.dataset.baseUrl}`:this.dataset.baseUrl:"",o=this.dataset.forwardConsole==="true",a=window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1",l=a?`${window.location.origin}/cdn/index.js`:"https://unpkg.com/@citolab/qti-components/cdn",c=a?`${window.location.origin}/dist/item.css`:"https://unpkg.com/@citolab/qti-components@latest/dist/item.css",p=this.dataset.componentsCdnUrl||l,u=this.dataset.componentsCssUrl||c,m=`
4783
+ `]}#t;#r;#i;#n;#o(){if(this.#t===null&&this.requirePathsJson)try{let e=JSON.parse(this.requirePathsJson);if(Array.isArray(e)||!e||typeof e!="object")throw new Error("Require paths must be a JSON object.");this.#t=e}catch(e){console.error("Error parsing require paths JSON:",e),this._errorMessage=`Error parsing require paths JSON: ${e.message}`,this.#t={}}return this.#t||{}}#s(){if(this.#r===null&&this.requireShimJson)try{this.#r=JSON.parse(this.requireShimJson)}catch(e){console.error("Error parsing require shim JSON:",e),this._errorMessage=`Error parsing require shim JSON: ${e.message}`,this.#r={}}return this.#r||{}}#a(){return this.#o()}#c(){return this.#s()}#d(e){for(let t in e)if(e.hasOwnProperty(t)){let i=e[t];if(i){for(let n in i)if(i.hasOwnProperty(n)){let s=i[n];if(Array.isArray(s))return s.map(String);if(s!=null)return String(s)}}}return null}getDirectChildrenByTag(e){let t=e.toLowerCase();return Array.from(this.children).filter(i=>i.tagName.toLowerCase()===t)}coerceBaseValue(e,t){if(e==null)return e;switch(t){case"integer":{if(typeof e=="number")return e;let i=parseInt(String(e),10);return Number.isNaN(i)?e:i}case"float":case"duration":{if(typeof e=="number")return e;let i=parseFloat(String(e));return Number.isNaN(i)?e:i}case"boolean":{if(typeof e=="boolean")return e;if(typeof e=="string"){let i=e.toLowerCase();if(i==="true")return!0;if(i==="false")return!1}return e}default:return String(e)}}normalizeListValue(e){return e==null?[]:Array.isArray(e)?e:[e]}variableToQtiVariableJSON(e,t,i){if(t==="record"||i==="record")return this.recordToQtiVariableJSON(e);if(t!=="single"){let n=this.normalizeListValue(e).map(s=>this.coerceBaseValue(s,i));return{list:{[i]:n}}}return{base:{[i]:this.coerceBaseValue(e,i)}}}recordToQtiVariableJSON(e){if(!e||typeof e!="object")return{record:[]};let t=[];for(let[i,n]of Object.entries(e))t.push(this.recordEntryFromValue(i,n));return{record:t}}recordEntryFromValue(e,t){if(Array.isArray(t)){let i=t.filter(n=>n!=null);if(i.length&&i.every(n=>typeof n=="boolean"))return{name:e,list:{boolean:i}};if(i.length&&i.every(n=>typeof n=="number")){let n=i,s=n.every(a=>Number.isInteger(a));return{name:e,list:{[s?"integer":"float"]:n}}}return{name:e,list:{string:t.map(n=>n==null?"":String(n))}}}if(typeof t=="boolean")return{name:e,base:{boolean:t}};if(typeof t=="number")return Number.isInteger(t)?{name:e,base:{integer:t}}:{name:e,base:{float:t}};if(t==null)return{name:e,base:{string:""}};if(typeof t=="object")try{return{name:e,base:{string:JSON.stringify(t)}}}catch{return{name:e,base:{string:String(t)}}}return{name:e,base:{string:String(t)}}}getQtiContextDefaultsFromItem(){let e=this.closest("qti-assessment-item");if(!e)return{};let t={};return e.querySelectorAll('qti-context-declaration[identifier="QTI_CONTEXT"]').forEach(n=>{let s=n.querySelector("qti-default-value");if(!s)return;s.querySelectorAll("qti-value[field-identifier]").forEach(l=>{let c=l.getAttribute("field-identifier");if(!c)return;let p=l.getAttribute("base-type")||"string",u=l.textContent?.trim()||"";t[c]=this.coerceBaseValue(u,p)})}),t}getQtiContextRecord(){let e=this.getQtiContextDefaultsFromItem(),t=this.qtiContext?.QTI_CONTEXT||{},i={...e,...t};if(!Object.keys(i).length)return null;let n={candidateIdentifier:i.candidateIdentifier??"",testIdentifier:i.testIdentifier??"",environmentIdentifier:i.environmentIdentifier??"",...i};return this.recordToQtiVariableJSON(n)}getTemplateVariables(){let e={},t=this.getDirectChildrenByTag("qti-template-variable");return t.length&&t.forEach(i=>{let n=i.getAttribute("template-identifier")||i.getAttribute("identifier")||"";if(!n)return;let s=this.context?.variables?.find(c=>c.identifier===n);if(!s)return;let a=s.cardinality||"single",l=s.baseType||"string";e[n]=this.variableToQtiVariableJSON(s.value,a,l)}),e}getContextVariables(){let e={},t=this.getDirectChildrenByTag("qti-context-variable");return t.length&&t.forEach(i=>{let n=i.getAttribute("identifier")||"";if(!n)return;if(n==="QTI_CONTEXT"){let c=this.getQtiContextRecord();c&&(e[n]=c);return}let s=this.context?.variables?.find(c=>c.identifier===n);if(!s)return;let a=s.cardinality||"single",l=s.baseType||"string";e[n]=this.variableToQtiVariableJSON(s.value,a,l)}),e}#l(e){let t={...e};for(let i in e)if(Object.prototype.hasOwnProperty.call(e,i)){let n=i.replace(/[A-Z]/g,s=>`-${s.toLowerCase()}`);t[n]=e[i]}return t}#u(e){let t={...e},i=(n,s,a)=>{let l=n;for(let c=0;c<s.length;c+=1){let p=s[c];if(c===s.length-1){l[p]=a;return}(!l[p]||typeof l[p]!="object"||Array.isArray(l[p]))&&(l[p]={}),l=l[p]}};for(let[n,s]of Object.entries(e)){if(!n.includes("__"))continue;let a=n.split("__").filter(Boolean);a.length<2||i(t,a,s)}return t}responseVariablesToQtiVariableJSON(e,t,i){if(t!=="single"){let n={list:{}};return n.list[i]=e,n}else{let n={base:{}};return n.base[i]=e,n}}#h(){return this.response===null||this.response===void 0?!1:Array.isArray(this.response)?this.response.length===0?!1:this.response.some(e=>e!==""&&e!==null&&e!==void 0):this.response!==""}#g(e,t){let i=this.dataset.invalidresponsemessage||"Invalid response.",n=e?"":t&&t.trim().length>0?t:i;this._internals.setValidity(e?{}:{customError:!0},n)}validate(){let e=typeof this.#i=="boolean"?this.#i:this.#h();return this.#g(e,this.#n),e}set value(e){e===null?this.#e=[]:this.#e=Array.isArray(e)?e:e.split(",")}get value(){return this.#e===null||this.#e===void 0?null:Array.isArray(this.#e)?this.#e.join(","):String(this.#e)}set boundTo(e){if(!e||!e[this.responseIdentifier])return;let t=this.#d(e[this.responseIdentifier]);this.#e=t,this.saveResponse(t)}get boundTo(){let e={};if(this.context?.variables?.find(i=>i.identifier===this.responseIdentifier)){let i=this.context?.variables?.find(l=>l.identifier===this.responseIdentifier)?.cardinality||"single",n=this.context?.variables?.find(l=>l.identifier===this.responseIdentifier)?.baseType||"string",s=this.context?.variables?.find(l=>l.identifier===this.responseIdentifier)?.value||null,a=this.responseVariablesToQtiVariableJSON(s,i,n);e[this.responseIdentifier]=a}return e}#b(e){return e&&e.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#x27;/g,"'").replace(/&#x2F;/g,"/").replace(/&#x60;/g,"`").replace(/&#x3D;/g,"=")}#f(e){let t={};for(let[i,n]of Object.entries(e))typeof n=="string"?t[i]=this.#b(n):t[i]=n;return t}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("message",this.handleIframeMessage),this._iframeObjectUrl&&(URL.revokeObjectURL(this._iframeObjectUrl),this._iframeObjectUrl=null)}sendMessageToIframe(e,t){let i=this.iframe?.contentWindow;if(!this._iframeLoaded||!i){this._pendingMessages.push({method:e,params:t});return}i.postMessage({source:"qti-portable-custom-interaction",responseIdentifier:this.responseIdentifier,method:e,params:t},"*")}#y(){this._pendingMessages.length&&(this._pendingMessages.forEach(e=>{this.sendMessageToIframe(e.method,e.params)}),this._pendingMessages=[])}createIframe(){this._iframeObjectUrl&&(URL.revokeObjectURL(this._iframeObjectUrl),this._iframeObjectUrl=null),this.iframe=document.createElement("iframe"),this.iframe.id=`pci-iframe-${this.responseIdentifier}`,this.iframe.setAttribute("title","QTI PCI Iframe"),this.iframe.setAttribute("aria-label","QTI PCI Iframe"),this.iframe.setAttribute("aria-hidden","false"),this.iframe.setAttribute("role","application"),this.iframe.style.width="100%",this.iframe.style.border="none",this.iframe.style.display="block",this.iframe.onload=()=>{this._iframeLoaded=!0,this._iframeObjectUrl&&(URL.revokeObjectURL(this._iframeObjectUrl),this._iframeObjectUrl=null),this.#x(),this.#p()};let e=`qti-pci-${this.responseIdentifier}-${Date.now()}`;this.iframe.name=e;let t=this.generateIframeContent();try{let i=new Blob([t],{type:"text/html"});this._iframeObjectUrl=URL.createObjectURL(i),this.iframe.src=this._iframeObjectUrl}catch{let i=encodeURIComponent(t);this.iframe.src=`data:text/html;charset=utf-8,${i}`}this.appendChild(this.iframe)}#p(){let e=this.#l(this.#u(this.#f({...this.dataset}))),t=this.context?.state?.[this.responseIdentifier],i=typeof t=="string"&&t.length>0?t:null,n={module:this.module,customInteractionTypeIdentifier:this.customInteractionTypeIdentifier,baseUrl:this.baseUrl?this.baseUrl.startsWith("http")||this.baseUrl.startsWith("blob")||this.baseUrl.startsWith("base64")?this.baseUrl:xn(`${window.location.origin}${this.baseUrl}`):window.location.origin,responseIdentifier:this.responseIdentifier,properties:e,contextVariables:this.getContextVariables(),templateVariables:this.getTemplateVariables(),dataAttributes:{...this.dataset},interactionModules:this.#v(),boundTo:i?null:this.boundTo,state:i};this.sendMessageToIframe("initialize",n)}#v(){let e=[],t=this.querySelector("qti-interaction-modules");if(t){let i=t.querySelectorAll("qti-interaction-module");for(let n of i)e.push({id:n.getAttribute("id"),primaryPath:n.getAttribute("primary-path"),fallbackPath:n.getAttribute("fallback-path")})}return e}#x(){let e=this.querySelector("qti-interaction-markup");e&&this.sendMessageToIframe("setMarkup",e.innerHTML);let t=Array.from(this.querySelectorAll("qti-stylesheet"));if(t.length){let n=t.map(s=>s.outerHTML).join(`
4784
+ `);this.sendMessageToIframe("setStylesheets",n)}let i=this.querySelector("properties");i&&this.sendMessageToIframe("setProperties",i.innerHTML)}#q(){}connectedCallback(){super.connectedCallback(),this.#i=null,this.#n="",this.response=this.responseVariable?.value??null,window.addEventListener("message",this.handleIframeMessage),this.createIframe()}generateIframeContent(){let e=window.getComputedStyle(document.body),t=JSON.stringify(this.#a()),i=JSON.stringify(this.#c()),n=this.dataset.baseUrl?this.dataset.baseUrl.startsWith("/")?`${window.location.origin}${this.dataset.baseUrl}`:this.dataset.baseUrl:"",s=this.dataset.forwardConsole==="true",a=window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1",l=a?`${window.location.origin}/cdn/index.js`:"https://unpkg.com/@citolab/qti-components/cdn",c=a?`${window.location.origin}/dist/item.css`:"https://unpkg.com/@citolab/qti-components@latest/dist/item.css",p=this.dataset.componentsCdnUrl||l,u=this.dataset.componentsCssUrl||c,h=`
4785
4785
  font-family: ${e.getPropertyValue("font-family")};
4786
4786
  font-size: ${e.getPropertyValue("font-size")};
4787
4787
  line-height: ${e.getPropertyValue("line-height")};
@@ -4804,7 +4804,7 @@ CES.load();
4804
4804
  height: auto;
4805
4805
  overflow: hidden;
4806
4806
  /* Add the extracted font styles here */
4807
- ${m}
4807
+ ${h}
4808
4808
  };
4809
4809
  .qti-customInteraction {
4810
4810
  width: 100%;
@@ -4822,7 +4822,7 @@ CES.load();
4822
4822
  <link href="${u}" rel="stylesheet" />
4823
4823
  <script src="${this.requireJsUrl}"></script>
4824
4824
  <script>
4825
- const forwardConsole = ${o?"true":"false"};
4825
+ const forwardConsole = ${s?"true":"false"};
4826
4826
  if (forwardConsole) {
4827
4827
  const originalLog = console.log.bind(console);
4828
4828
  const originalError = console.error.bind(console);
@@ -5666,13 +5666,13 @@ CES.load();
5666
5666
  <body>
5667
5667
  <div id="pci-container"></div>
5668
5668
  </body>
5669
- </html>`}toggleInternalCorrectResponse(e){let t=this.responseVariable;this.correctResponse=e?t?.correctResponse:t.cardinality==="single"?"":[];let i=`correct-response-container-${this.responseIdentifier}`,n=this.parentElement?.querySelectorAll(`#${i}`);if(n&&n.forEach(m=>{m.remove()}),e)this.disable();else{this.enable();return}if(!e||!t?.correctResponse)return;let o=document.createElement("div");o.id=i,o.className="pci-correct-response-container",o.style.position="relative",o.style.marginTop="20px",o.style.border="2px solid green",o.style.padding="16px",o.style.borderRadius="4px",o.style.backgroundColor="rgba(0, 128, 0, 0.05)";let a=document.createElement("div");a.textContent="Correct Response:",a.style.fontWeight="bold",a.style.marginBottom="10px",a.style.color="green",o.appendChild(a);let l=document.createElement("qti-portable-custom-interaction");Array.from(this.attributes).forEach(m=>{m.name!=="id"&&m.name!=="response-identifier"&&l.setAttribute(m.name,m.value)});let c=this.responseIdentifier;l.responseIdentifier=`${c}-correct`,Array.from(this.children).forEach(m=>{let y=m.cloneNode(!0);l.appendChild(y)});let p=t.correctResponse,u=l.connectedCallback;l.connectedCallback=function(){u.call(this);let m=()=>{let y=this.responseVariablesToQtiVariableJSON(p,t.cardinality,t.baseType);this.sendMessageToIframe("setBoundTo",{[c]:y}),this.sendMessageToIframe("setState",{state:"review"})};this._iframeLoaded?m():this.addEventListener("qti-portable-custom-interaction-loaded",m,{once:!0})},l.style.pointerEvents="none",o.appendChild(l),this.after(o)}disable(){if(this.#m={pointerEvents:this.style.pointerEvents,position:this.style.position},this.sendMessageToIframe("setState",{state:"disabled"}),!this.querySelector(".pci-interaction-overlay")){let t=document.createElement("div");t.className="pci-interaction-overlay",t.style.position="absolute",t.style.top="0",t.style.left="0",t.style.width="100%",t.style.height="100%",t.style.backgroundColor="rgba(200, 200, 200, 0.3)",t.style.zIndex="100",t.style.pointerEvents="all",t.style.cursor="not-allowed",getComputedStyle(this).position==="static"&&(this.style.position="relative"),this.appendChild(t)}}enable(){let e=this.querySelector(".pci-interaction-overlay");e&&e.remove(),this.#m&&(this.#m.pointerEvents&&(this.style.pointerEvents=this.#m.pointerEvents),this.#m.position&&(this.style.position=this.#m.position),this.#m=null),this.sendMessageToIframe("setState",{state:"interacting"})}#m;render(){return x`
5669
+ </html>`}toggleInternalCorrectResponse(e){let t=this.responseVariable;this.correctResponse=e?t?.correctResponse:t.cardinality==="single"?"":[];let i=`correct-response-container-${this.responseIdentifier}`,n=this.parentElement?.querySelectorAll(`#${i}`);if(n&&n.forEach(h=>{h.remove()}),e)this.disable();else{this.enable();return}if(!e||!t?.correctResponse)return;let s=document.createElement("div");s.id=i,s.className="pci-correct-response-container",s.style.position="relative",s.style.marginTop="20px",s.style.border="2px solid green",s.style.padding="16px",s.style.borderRadius="4px",s.style.backgroundColor="rgba(0, 128, 0, 0.05)";let a=document.createElement("div");a.textContent="Correct Response:",a.style.fontWeight="bold",a.style.marginBottom="10px",a.style.color="green",s.appendChild(a);let l=document.createElement("qti-portable-custom-interaction");Array.from(this.attributes).forEach(h=>{h.name!=="id"&&h.name!=="response-identifier"&&l.setAttribute(h.name,h.value)});let c=this.responseIdentifier;l.responseIdentifier=`${c}-correct`,Array.from(this.children).forEach(h=>{let v=h.cloneNode(!0);l.appendChild(v)});let p=t.correctResponse,u=l.connectedCallback;l.connectedCallback=function(){u.call(this);let h=()=>{let v=this.responseVariablesToQtiVariableJSON(p,t.cardinality,t.baseType);this.sendMessageToIframe("setBoundTo",{[c]:v}),this.sendMessageToIframe("setState",{state:"review"})};this._iframeLoaded?h():this.addEventListener("qti-portable-custom-interaction-loaded",h,{once:!0})},l.style.pointerEvents="none",s.appendChild(l),this.after(s)}disable(){if(this.#m={pointerEvents:this.style.pointerEvents,position:this.style.position},this.sendMessageToIframe("setState",{state:"disabled"}),!this.querySelector(".pci-interaction-overlay")){let t=document.createElement("div");t.className="pci-interaction-overlay",t.style.position="absolute",t.style.top="0",t.style.left="0",t.style.width="100%",t.style.height="100%",t.style.backgroundColor="rgba(200, 200, 200, 0.3)",t.style.zIndex="100",t.style.pointerEvents="all",t.style.cursor="not-allowed",getComputedStyle(this).position==="static"&&(this.style.position="relative"),this.appendChild(t)}}enable(){let e=this.querySelector(".pci-interaction-overlay");e&&e.remove(),this.#m&&(this.#m.pointerEvents&&(this.style.pointerEvents=this.#m.pointerEvents),this.#m.position&&(this.style.position=this.#m.position),this.#m=null),this.sendMessageToIframe("setState",{state:"interacting"})}#m;render(){return x`
5670
5670
  <slot></slot>
5671
5671
  ${this._errorMessage?x`<div style="color:red">
5672
5672
  <h1>Error</h1>
5673
5673
  ${this._errorMessage}
5674
5674
  </div>`:""}
5675
- `}};d([g({type:String,attribute:"module"})],K.prototype,"module",2),d([g({type:String,attribute:"custom-interaction-type-identifier"})],K.prototype,"customInteractionTypeIdentifier",2),d([g({type:String,attribute:"data-require-paths"})],K.prototype,"requirePathsJson",2),d([g({type:String,attribute:"data-require-shim"})],K.prototype,"requireShimJson",2),d([g({type:String,attribute:"data-require-js-url"})],K.prototype,"requireJsUrl",2),d([g({type:String,attribute:"data-base-url"})],K.prototype,"baseUrl",2),d([g({type:Boolean,attribute:"data-use-default-paths"})],K.prototype,"useDefaultPaths",2),d([M()],K.prototype,"_errorMessage",2),d([$({context:W,subscribe:!0}),M()],K.prototype,"context",2),d([$({context:ir,subscribe:!0}),M()],K.prototype,"qtiContext",2),d([M()],K.prototype,"response",2);var mo=class extends K{#e=!1;async getIFrameContent(){return new Promise(r=>{let e=`get-content-${Date.now()}`,t=i=>{let{data:n}=i;n?.source==="qti-pci-iframe"&&(!n?.responseIdentifier||n?.responseIdentifier===this.responseIdentifier)&&n?.method==="getContentResponse"&&n?.messageId===e&&(window.removeEventListener("message",t),r(n.content))};window.addEventListener("message",t),this.sendMessageToIframe("getContent",{messageId:e}),setTimeout(()=>{window.removeEventListener("message",t),r("")},5e3)})}setTestContext(r){this.context=r,this.updateComplete.then(()=>{this.value=r?.variables?.find(e=>e.identifier===this.responseIdentifier).value})}async recreateIframe(){this.#e=!0;try{return this.iframe&&(this._iframeLoaded=!1,this.iframe.remove()),this._pendingMessages=[],this.createIframe(),new Promise(r=>{let e=()=>{this.removeEventListener("qti-portable-custom-interaction-loaded",e),r()};this.addEventListener("qti-portable-custom-interaction-loaded",e),setTimeout(()=>{this.removeEventListener("qti-portable-custom-interaction-loaded",e),r()},5e3)})}finally{this.#e=!1}}disconnectedCallback(){this.#e||super.disconnectedCallback()}async iFrameMouseClick(r,e){return new Promise(t=>{let i=`click-${Date.now()}`,n=o=>{let{data:a}=o;a?.source==="qti-pci-iframe"&&(!a?.responseIdentifier||a?.responseIdentifier===this.responseIdentifier)&&a?.method==="clickResponse"&&a?.messageId===i&&(window.removeEventListener("message",n),t())};window.addEventListener("message",n),this.sendMessageToIframe("simulateClick",{x:r,y:e,messageId:i}),setTimeout(()=>{window.removeEventListener("message",n),t()},5e3)})}async iFrameClickOnElement(r){return new Promise(e=>{let t=`click-selector-${Date.now()}`,i=n=>{let{data:o}=n;o?.source==="qti-pci-iframe"&&(!o?.responseIdentifier||o?.responseIdentifier===this.responseIdentifier)&&o?.method==="clickSelectorResponse"&&o?.messageId===t&&(window.removeEventListener("message",i),e(o.success))};window.addEventListener("message",i),this.sendMessageToIframe("clickOnSelector",{selector:r,messageId:t}),setTimeout(()=>{window.removeEventListener("message",i),e(!1)},5e3)})}async iFrameClickOnElementByText(r){return new Promise(e=>{let t=`click-text-${Date.now()}`,i=n=>{let{data:o}=n;o?.source==="qti-pci-iframe"&&(!o?.responseIdentifier||o?.responseIdentifier===this.responseIdentifier)&&o?.method==="clickTextResponse"&&o?.messageId===t&&(window.removeEventListener("message",i),e(o.success))};window.addEventListener("message",i),this.sendMessageToIframe("clickOnElementByText",{text:r,messageId:t}),setTimeout(()=>{window.removeEventListener("message",i),e(!1)},5e3)})}async iFrameSetValueElement(r,e){return new Promise(t=>{let i=`set-value-${Date.now()}`,n=o=>{let{data:a}=o;a?.source==="qti-pci-iframe"&&(!a?.responseIdentifier||a?.responseIdentifier===this.responseIdentifier)&&a?.method==="setValueResponse"&&a?.messageId===i&&(window.removeEventListener("message",n),t(a.success))};window.addEventListener("message",n),this.sendMessageToIframe("setValueElement",{selector:r,value:e,messageId:i}),setTimeout(()=>{window.removeEventListener("message",n),t(!1)},5e3)})}async iFrameGetBoundingClientRect(r){return new Promise(e=>{let t=`get-bounding-rect-${Date.now()}`,i=n=>{let{data:o}=n;o?.source==="qti-pci-iframe"&&(!o?.responseIdentifier||o?.responseIdentifier===this.responseIdentifier)&&o?.method==="getBoundingRectResponse"&&o?.messageId===t&&(window.removeEventListener("message",i),e(o.rect??null))};window.addEventListener("message",i),this.sendMessageToIframe("getBoundingRect",{selector:r,messageId:t}),setTimeout(()=>{window.removeEventListener("message",i),e(null)},5e3)})}async iFrameSetValueElementByText(r,e){return new Promise(t=>{let i=`set-value-text-${Date.now()}`,n=o=>{let{data:a}=o;a?.source==="qti-pci-iframe"&&(!a?.responseIdentifier||a?.responseIdentifier===this.responseIdentifier)&&a?.method==="setValueByTextResponse"&&a?.messageId===i&&(window.removeEventListener("message",n),t(a.success))};window.addEventListener("message",n),this.sendMessageToIframe("setValueElementByText",{text:r,value:e,messageId:i}),setTimeout(()=>{window.removeEventListener("message",n),t(!1)},5e3)})}async iFrameMousedownOnElement(r){return new Promise(e=>{let t=`mousedown-selector-${Date.now()}`,i=n=>{let{data:o}=n;o?.source==="qti-pci-iframe"&&(!o?.responseIdentifier||o?.responseIdentifier===this.responseIdentifier)&&o?.method==="mousedownSelectorResponse"&&o?.messageId===t&&(window.removeEventListener("message",i),e(o.success))};window.addEventListener("message",i),this.sendMessageToIframe("mousedownOnSelector",{selector:r,messageId:t}),setTimeout(()=>{window.removeEventListener("message",i),e(!1)},5e3)})}generateIframeContent(){let r=super.generateIframeContent(),e=`
5675
+ `}};d([g({type:String,attribute:"module"})],K.prototype,"module",2),d([g({type:String,attribute:"custom-interaction-type-identifier"})],K.prototype,"customInteractionTypeIdentifier",2),d([g({type:String,attribute:"data-require-paths"})],K.prototype,"requirePathsJson",2),d([g({type:String,attribute:"data-require-shim"})],K.prototype,"requireShimJson",2),d([g({type:String,attribute:"data-require-js-url"})],K.prototype,"requireJsUrl",2),d([g({type:String,attribute:"data-base-url"})],K.prototype,"baseUrl",2),d([g({type:Boolean,attribute:"data-use-default-paths"})],K.prototype,"useDefaultPaths",2),d([k()],K.prototype,"_errorMessage",2),d([$({context:W,subscribe:!0}),k()],K.prototype,"context",2),d([$({context:be,subscribe:!0}),k()],K.prototype,"qtiContext",2),d([k()],K.prototype,"response",2);var bo=class extends K{#e=!1;async getIFrameContent(){return new Promise(r=>{let e=`get-content-${Date.now()}`,t=i=>{let{data:n}=i;n?.source==="qti-pci-iframe"&&(!n?.responseIdentifier||n?.responseIdentifier===this.responseIdentifier)&&n?.method==="getContentResponse"&&n?.messageId===e&&(window.removeEventListener("message",t),r(n.content))};window.addEventListener("message",t),this.sendMessageToIframe("getContent",{messageId:e}),setTimeout(()=>{window.removeEventListener("message",t),r("")},5e3)})}setTestContext(r){this.context=r,this.updateComplete.then(()=>{this.value=r?.variables?.find(e=>e.identifier===this.responseIdentifier).value})}async recreateIframe(){this.#e=!0;try{return this.iframe&&(this._iframeLoaded=!1,this.iframe.remove()),this._pendingMessages=[],this.createIframe(),new Promise(r=>{let e=()=>{this.removeEventListener("qti-portable-custom-interaction-loaded",e),r()};this.addEventListener("qti-portable-custom-interaction-loaded",e),setTimeout(()=>{this.removeEventListener("qti-portable-custom-interaction-loaded",e),r()},5e3)})}finally{this.#e=!1}}disconnectedCallback(){this.#e||super.disconnectedCallback()}async iFrameMouseClick(r,e){return new Promise(t=>{let i=`click-${Date.now()}`,n=s=>{let{data:a}=s;a?.source==="qti-pci-iframe"&&(!a?.responseIdentifier||a?.responseIdentifier===this.responseIdentifier)&&a?.method==="clickResponse"&&a?.messageId===i&&(window.removeEventListener("message",n),t())};window.addEventListener("message",n),this.sendMessageToIframe("simulateClick",{x:r,y:e,messageId:i}),setTimeout(()=>{window.removeEventListener("message",n),t()},5e3)})}async iFrameClickOnElement(r){return new Promise(e=>{let t=`click-selector-${Date.now()}`,i=n=>{let{data:s}=n;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="clickSelectorResponse"&&s?.messageId===t&&(window.removeEventListener("message",i),e(s.success))};window.addEventListener("message",i),this.sendMessageToIframe("clickOnSelector",{selector:r,messageId:t}),setTimeout(()=>{window.removeEventListener("message",i),e(!1)},5e3)})}async iFrameClickOnElementByText(r){return new Promise(e=>{let t=`click-text-${Date.now()}`,i=n=>{let{data:s}=n;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="clickTextResponse"&&s?.messageId===t&&(window.removeEventListener("message",i),e(s.success))};window.addEventListener("message",i),this.sendMessageToIframe("clickOnElementByText",{text:r,messageId:t}),setTimeout(()=>{window.removeEventListener("message",i),e(!1)},5e3)})}async iFrameSetValueElement(r,e){return new Promise(t=>{let i=`set-value-${Date.now()}`,n=s=>{let{data:a}=s;a?.source==="qti-pci-iframe"&&(!a?.responseIdentifier||a?.responseIdentifier===this.responseIdentifier)&&a?.method==="setValueResponse"&&a?.messageId===i&&(window.removeEventListener("message",n),t(a.success))};window.addEventListener("message",n),this.sendMessageToIframe("setValueElement",{selector:r,value:e,messageId:i}),setTimeout(()=>{window.removeEventListener("message",n),t(!1)},5e3)})}async iFrameGetBoundingClientRect(r){return new Promise(e=>{let t=`get-bounding-rect-${Date.now()}`,i=n=>{let{data:s}=n;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="getBoundingRectResponse"&&s?.messageId===t&&(window.removeEventListener("message",i),e(s.rect??null))};window.addEventListener("message",i),this.sendMessageToIframe("getBoundingRect",{selector:r,messageId:t}),setTimeout(()=>{window.removeEventListener("message",i),e(null)},5e3)})}async iFrameSetValueElementByText(r,e){return new Promise(t=>{let i=`set-value-text-${Date.now()}`,n=s=>{let{data:a}=s;a?.source==="qti-pci-iframe"&&(!a?.responseIdentifier||a?.responseIdentifier===this.responseIdentifier)&&a?.method==="setValueByTextResponse"&&a?.messageId===i&&(window.removeEventListener("message",n),t(a.success))};window.addEventListener("message",n),this.sendMessageToIframe("setValueElementByText",{text:r,value:e,messageId:i}),setTimeout(()=>{window.removeEventListener("message",n),t(!1)},5e3)})}async iFrameMousedownOnElement(r){return new Promise(e=>{let t=`mousedown-selector-${Date.now()}`,i=n=>{let{data:s}=n;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="mousedownSelectorResponse"&&s?.messageId===t&&(window.removeEventListener("message",i),e(s.success))};window.addEventListener("message",i),this.sendMessageToIframe("mousedownOnSelector",{selector:r,messageId:t}),setTimeout(()=>{window.removeEventListener("message",i),e(!1)},5e3)})}generateIframeContent(){let r=super.generateIframeContent(),e=`
5676
5676
  // Test helper functions for QtiPortableCustomInteractionTest
5677
5677
  // Base iframe implementation already provides PCIManager.getContent
5678
5678
 
@@ -5865,7 +5865,7 @@ CES.load();
5865
5865
  }
5866
5866
  },
5867
5867
  true
5868
- );`,t=r.lastIndexOf("</script>");return r.substring(0,t)+e+r.substring(t)}};customElements.define("qti-portable-custom-interaction",K);customElements.define("qti-portable-custom-interaction-test",mo);var fd=C`
5868
+ );`,t=r.lastIndexOf("</script>");return r.substring(0,t)+e+r.substring(t)}};customElements.define("qti-portable-custom-interaction",K);customElements.define("qti-portable-custom-interaction-test",bo);var Td=C`
5869
5869
  :host {
5870
5870
  display: block;
5871
5871
  }
@@ -5876,12 +5876,12 @@ CES.load();
5876
5876
  left: 50%;
5877
5877
  transform: translateX(-50%);
5878
5878
  }
5879
- `;var ho=class extends E{static{this.styles=fd}render(){return x`<slot></slot>`}};var gd=C`
5879
+ `;var vo=class extends E{static{this.styles=Td}render(){return x`<slot></slot>`}};var Id=C`
5880
5880
  :host {
5881
5881
  display: inline-block;
5882
5882
  position: relative;
5883
5883
  }
5884
- `;var fo=class extends E{static{this.styles=gd}render(){return x`<slot></slot>`}constructor(){super(),this.removeMoveListener=this.removeMoveListener.bind(this),this.dragElementHandler=this.dragElementHandler.bind(this)}dragElementHandler(r){r.preventDefault();let e=r.clientX-this.startX,t=r.clientY-this.startY;this.dragElement.style.left=this.dragElement.offsetLeft+e+"px",this.dragElement.style.top=this.dragElement.offsetTop+t+"px",this.startX=r.clientX,this.startY=r.clientY}firstUpdated(r){super.firstUpdated(r),this.dragElement=this.querySelector("qti-position-object-interaction>img"),this.startX=0,this.startY=0,this.dragElement.addEventListener("mousedown",e=>{this.startX=e.clientX,this.startY=e.clientY,document.addEventListener("mousemove",this.dragElementHandler,!0)}),document.addEventListener("mouseup",this.removeMoveListener)}removeMoveListener(){document.removeEventListener("mousemove",this.dragElementHandler,!0)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("mousemove",this.dragElementHandler),document.removeEventListener("mouseup",this.removeMoveListener)}};customElements.define("qti-position-object-interaction",ho);customElements.define("qti-position-object-stage",fo);var bd="important",Dp=" !"+bd,Ss=qe(class extends nt{constructor(s){if(super(s),s.type!==nr.ATTRIBUTE||s.name!=="style"||s.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(s){return Object.keys(s).reduce((r,e)=>{let t=s[e];return t==null?r:r+`${e=e.includes("-")?e:e.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${t};`},"")}update(s,[r]){let{style:e}=s.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(r)),this.render(r);for(let t of this.ft)r[t]==null&&(this.ft.delete(t),t.includes("-")?e.removeProperty(t):e[t]=null);for(let t in r){let i=r[t];if(i!=null){this.ft.add(t);let n=typeof i=="string"&&i.endsWith(Dp);t.includes("-")||n?e.setProperty(t,n?i.slice(0,-11):i,n?bd:""):e[t]=i}}return re}});var vd=C`
5884
+ `;var yo=class extends E{static{this.styles=Id}render(){return x`<slot></slot>`}constructor(){super(),this.removeMoveListener=this.removeMoveListener.bind(this),this.dragElementHandler=this.dragElementHandler.bind(this)}dragElementHandler(r){r.preventDefault();let e=r.clientX-this.startX,t=r.clientY-this.startY;this.dragElement.style.left=this.dragElement.offsetLeft+e+"px",this.dragElement.style.top=this.dragElement.offsetTop+t+"px",this.startX=r.clientX,this.startY=r.clientY}firstUpdated(r){super.firstUpdated(r),this.dragElement=this.querySelector("qti-position-object-interaction>img"),this.startX=0,this.startY=0,this.dragElement.addEventListener("mousedown",e=>{this.startX=e.clientX,this.startY=e.clientY,document.addEventListener("mousemove",this.dragElementHandler,!0)}),document.addEventListener("mouseup",this.removeMoveListener)}removeMoveListener(){document.removeEventListener("mousemove",this.dragElementHandler,!0)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("mousemove",this.dragElementHandler),document.removeEventListener("mouseup",this.removeMoveListener)}};customElements.define("qti-position-object-interaction",vo);customElements.define("qti-position-object-stage",yo);var Rd="important",iu=" !"+Rd,Ls=we(class extends ot{constructor(o){if(super(o),o.type!==er.ATTRIBUTE||o.name!=="style"||o.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(o){return Object.keys(o).reduce((r,e)=>{let t=o[e];return t==null?r:r+`${e=e.includes("-")?e:e.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${t};`},"")}update(o,[r]){let{style:e}=o.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(r)),this.render(r);for(let t of this.ft)r[t]==null&&(this.ft.delete(t),t.includes("-")?e.removeProperty(t):e[t]=null);for(let t in r){let i=r[t];if(i!=null){this.ft.add(t);let n=typeof i=="string"&&i.endsWith(iu);t.includes("-")||n?e.setProperty(t,n?i.slice(0,-11):i,n?Rd:""):e[t]=i}}return ie}});var kd=C`
5885
5885
  :host {
5886
5886
  display: block;
5887
5887
  }
@@ -5896,25 +5896,25 @@ CES.load();
5896
5896
  height: auto;
5897
5897
  display: block;
5898
5898
  }
5899
- `;var Ke=class extends V{constructor(){super(...arguments);this.maxChoices=1/0;this.minChoices=0;this.response=null;this._correctAreas=[];this._responseCorrection=[];this.#e=null;this.#t=1;this.#r=1;this.#i=0;this.#n=0;this.#o=e=>{if(this.disabled)return;if(!this.#e){console.warn("No <img> element found in <qti-select-point-interaction>");return}this.#a();let t=this.#e.getBoundingClientRect(),i=(e.clientX-t.left)*this.#t,n=(e.clientY-t.top)*this.#r,o=`${i.toFixed()} ${n.toFixed()}`;this.maxChoices===1?this.response=[o]:(this.maxChoices===0||(this.response||[]).length<this.maxChoices)&&(this.response=[...this.response||[],o]),this.saveResponse(this.response)};this.#s=()=>{this.#a()}}static{this.styles=vd}#e;#t;#r;#i;#n;#o;connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.#s)}#s;get responsePoints(){return(this.response||[]).filter(e=>e).map(e=>{let[t,i]=e.split(" ").map(Number);return{x:t,y:i}})}toggleCandidateCorrection(e){this._responseCorrection=[],e&&this.responsePoints.forEach(t=>{let i=this.responseVariable.areaMapping.areaMapEntries.some(n=>J.isPointInArea(`${t.x} ${t.y}`,`${n.shape},${n.coords}`,this.responseVariable.baseType));this._responseCorrection.push(i)})}toggleCorrectResponse(e){let t=this.responseVariable;if(!e||!t){this._correctAreas=[];return}let i=t.areaMapping,n=[];if(!i||i.areaMapEntries.length===0)if(t.correctResponse){let o=Array.isArray(t.correctResponse)?t.correctResponse:[t.correctResponse];if(o.length===0||o.find(a=>a.split(" ").length<2))return console.error("No valid correct responses found for the response variable."),null;console.warn("No area mapping found for the response variable. Using the correct responses to display the correct response but it probably won't score correct."),n=o.map(a=>({shape:"circle",coords:a.split(" ").join(",").concat(",10"),defaultValue:1,mappedValue:1}))}else{console.error("No area mapping found for the response variable.");return}else n=i.areaMapEntries;this._correctAreas=n.map(o=>({coords:o.coords,shape:o.shape}))}updated(e){super.updated(e);let t=this.#e;t&&e.has("_correctAreas")&&this._correctAreas.length>0&&(this.#a(),this.shadowRoot.querySelectorAll("div").forEach(i=>{let n=i.dataset.coord,o=i.dataset.shape;n&&o&&xt(o,n.split(",").map(a=>+a),t,i)}))}render(){return x` <slot name="prompt"></slot>
5899
+ `;var Ze=class extends V{constructor(){super(...arguments);this.maxChoices=1/0;this.minChoices=0;this.response=null;this._correctAreas=[];this._responseCorrection=[];this.#e=null;this.#t=1;this.#r=1;this.#i=0;this.#n=0;this.#o=e=>{if(this.disabled)return;if(!this.#e){console.warn("No <img> element found in <qti-select-point-interaction>");return}this.#a();let t=this.#e.getBoundingClientRect(),i=(e.clientX-t.left)*this.#t,n=(e.clientY-t.top)*this.#r,s=`${i.toFixed()} ${n.toFixed()}`;this.maxChoices===1?this.response=[s]:(this.maxChoices===0||(this.response||[]).length<this.maxChoices)&&(this.response=[...this.response||[],s]),this.saveResponse(this.response)};this.#s=()=>{this.#a()}}static{this.styles=kd}#e;#t;#r;#i;#n;#o;connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.#s)}#s;get responsePoints(){return(this.response||[]).filter(e=>e).map(e=>{let[t,i]=e.split(" ").map(Number);return{x:t,y:i}})}toggleCandidateCorrection(e){this._responseCorrection=[],e&&this.responsePoints.forEach(t=>{let i=this.responseVariable.areaMapping.areaMapEntries.some(n=>J.isPointInArea(`${t.x} ${t.y}`,`${n.shape},${n.coords}`,this.responseVariable.baseType));this._responseCorrection.push(i)})}toggleCorrectResponse(e){let t=this.responseVariable;if(!e||!t){this._correctAreas=[];return}let i=t.areaMapping,n=[];if(!i||i.areaMapEntries.length===0)if(t.correctResponse){let s=Array.isArray(t.correctResponse)?t.correctResponse:[t.correctResponse];if(s.length===0||s.find(a=>a.split(" ").length<2))return console.error("No valid correct responses found for the response variable."),null;console.warn("No area mapping found for the response variable. Using the correct responses to display the correct response but it probably won't score correct."),n=s.map(a=>({shape:"circle",coords:a.split(" ").join(",").concat(",10"),defaultValue:1,mappedValue:1}))}else{console.error("No area mapping found for the response variable.");return}else n=i.areaMapEntries;this._correctAreas=n.map(s=>({coords:s.coords,shape:s.shape}))}updated(e){super.updated(e);let t=this.#e;t&&e.has("_correctAreas")&&this._correctAreas.length>0&&(this.#a(),this.shadowRoot.querySelectorAll("div").forEach(i=>{let n=i.dataset.coord,s=i.dataset.shape;n&&s&&qt(s,n.split(",").map(a=>+a),t,i)}))}render(){return x` <slot name="prompt"></slot>
5900
5900
  <point-container>
5901
- ${Ir((this.response||[]).filter(e=>e),e=>e,(e,t)=>{let[i,n]=e.split(" ").map(Number),o=i/(this.#i||1)*100,a=n/(this.#n||1)*100,l=16,c=l/(this.#i||1)*100,p=l/(this.#n||1)*100,u="";return this._responseCorrection[t]===!0?u=" correct":this._responseCorrection[t]===!1&&(u=" incorrect"),x`
5901
+ ${Rr((this.response||[]).filter(e=>e),e=>e,(e,t)=>{let[i,n]=e.split(" ").map(Number),s=i/(this.#i||1)*100,a=n/(this.#n||1)*100,l=16,c=l/(this.#i||1)*100,p=l/(this.#n||1)*100,u="";return this._responseCorrection[t]===!0?u=" correct":this._responseCorrection[t]===!1&&(u=" incorrect"),x`
5902
5902
  <button
5903
5903
  part="point${u}"
5904
- style=${Ss({pointerEvents:this.maxChoices===1?"none":"auto",position:"absolute",transform:"translate(-50%, -50%)",left:`${o}%`,top:`${a}%`,width:`min(${c}%, 1rem)`,height:`min(${p}%, 1rem)`,minWidth:`min(${c}%, 1rem)`,minHeight:`min(${p}%, 1rem)`,borderRadius:"50%",background:"red"})}
5904
+ style=${Ls({pointerEvents:this.maxChoices===1?"none":"auto",position:"absolute",transform:"translate(-50%, -50%)",left:`${s}%`,top:`${a}%`,width:`min(${c}%, 1rem)`,height:`min(${p}%, 1rem)`,minWidth:`min(${c}%, 1rem)`,minHeight:`min(${p}%, 1rem)`,borderRadius:"50%",background:"red"})}
5905
5905
  aria-label="Remove point at ${e}"
5906
5906
  ?disabled=${this.disabled}
5907
- @click=${m=>{m.stopPropagation(),this.response=(this.response||[]).filter((y,b)=>b!==t),this.saveResponse(this.response)}}
5907
+ @click=${h=>{h.stopPropagation(),this.response=(this.response||[]).filter((v,y)=>y!==t),this.saveResponse(this.response)}}
5908
5908
  ></button>
5909
5909
  `})}
5910
- ${Ir(this._correctAreas?.filter(e=>e)||[],e=>e,(e,t)=>x`<div
5911
- style=${Ss({position:"absolute",pointerEvents:"none",backgroundColor:"var(--qti-correct)",opacity:"0.5"})}
5910
+ ${Rr(this._correctAreas?.filter(e=>e)||[],e=>e,(e,t)=>x`<div
5911
+ style=${Ls({position:"absolute",pointerEvents:"none",backgroundColor:"var(--qti-correct)",opacity:"0.5"})}
5912
5912
  data-coord="${e.coords}"
5913
5913
  alt=${`correct-response-${t+1}`}
5914
5914
  data-shape="${e.shape}"
5915
5915
  ></div>`)}
5916
5916
  <slot></slot>
5917
- </point-container>`}validate(){return this.response!==null&&this.response.length>=this.minChoices&&this.response.length<=this.maxChoices}#a(){this.#i=this.#e.getAttribute("width")?parseFloat(this.#e.getAttribute("width")):this.#e.naturalWidth,this.#n=this.#e.getAttribute("height")?parseFloat(this.#e.getAttribute("height")):this.#e.naturalHeight;let e=this.#e.getBoundingClientRect();this.#t=e.width===0?1:this.#i/e.width,this.#r=e.height===0?1:this.#n/e.height}firstUpdated(){this.#e=this.querySelector("img"),this.#e?(this.#a(),this.#e.addEventListener("click",this.#o)):console.warn("No <img> element found in <qti-select-point-interaction>")}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this.#s),this.#e&&this.#e.removeEventListener("click",this.#o)}};d([g({type:Number,attribute:"max-choices"})],Ke.prototype,"maxChoices",2),d([g({type:Number,attribute:"min-choices"})],Ke.prototype,"minChoices",2),d([M()],Ke.prototype,"response",2),d([M()],Ke.prototype,"_correctAreas",2),d([M()],Ke.prototype,"_responseCorrection",2);customElements.define("qti-select-point-interaction",Ke);var yd=C`
5917
+ </point-container>`}validate(){return this.response!==null&&this.response.length>=this.minChoices&&this.response.length<=this.maxChoices}#a(){this.#i=this.#e.getAttribute("width")?parseFloat(this.#e.getAttribute("width")):this.#e.naturalWidth,this.#n=this.#e.getAttribute("height")?parseFloat(this.#e.getAttribute("height")):this.#e.naturalHeight;let e=this.#e.getBoundingClientRect();this.#t=e.width===0?1:this.#i/e.width,this.#r=e.height===0?1:this.#n/e.height}firstUpdated(){this.#e=this.querySelector("img"),this.#e?(this.#a(),this.#e.addEventListener("click",this.#o)):console.warn("No <img> element found in <qti-select-point-interaction>")}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this.#s),this.#e&&this.#e.removeEventListener("click",this.#o)}};d([g({type:Number,attribute:"max-choices"})],Ze.prototype,"maxChoices",2),d([g({type:Number,attribute:"min-choices"})],Ze.prototype,"minChoices",2),d([k()],Ze.prototype,"response",2),d([k()],Ze.prototype,"_correctAreas",2),d([k()],Ze.prototype,"_responseCorrection",2);customElements.define("qti-select-point-interaction",Ze);var Md=C`
5918
5918
  :host {
5919
5919
  display: block;
5920
5920
  --show-bounds: true;
@@ -5994,7 +5994,7 @@ CES.load();
5994
5994
  text-align: center;
5995
5995
  color: #6b7280; /* text-gray-500 */
5996
5996
  }
5997
- `;var Ct=class extends V{constructor(){super(...arguments);this.#e=0;this.#t=null;this.min=0;this.max=100;this.step=1}static{this.styles=yd}#e;#t;validate(){return!0}connectedCallback(){super.connectedCallback(),this.#r(this.min),this.setAttribute("tabindex","0"),this.setAttribute("role","slider")}get response(){return this.#e.toString()}set response(e){let t=parseInt(e,10);isNaN(t)||this.#r(t)}toggleCorrectResponse(e){let t=this.responseVariable;if(t?.correctResponse){if(e){this._correctResponse=t.correctResponse.toString();let i=parseFloat(t.correctResponse.toString());if(isNaN(i))this.#t=null;else{this.#t=i;let n=(this.#t-this.min)/(this.max-this.min)*100;this.style.setProperty("--value-percentage-correct",`${n}%`)}}else this.#t=null;this.requestUpdate()}}#r(e){let t=this.#e;if(this.#e=Math.min(this.max,Math.max(this.min,e)),this.#e===t)return;let i=(this.#e-this.min)/(this.max-this.min)*100;this.style.setProperty("--value-percentage",`${i}%`),this._internals.setFormValue(this.value),this.saveResponse(this.response),this.requestUpdate()}render(){return x`
5997
+ `;var St=class extends V{constructor(){super(...arguments);this.#e=0;this.#t=null;this.min=0;this.max=100;this.step=1}static{this.styles=Md}#e;#t;validate(){return!0}connectedCallback(){super.connectedCallback(),this.#r(this.min),this.setAttribute("tabindex","0"),this.setAttribute("role","slider")}get response(){return this.#e.toString()}set response(e){let t=parseInt(e,10);isNaN(t)||this.#r(t)}toggleCorrectResponse(e){let t=this.responseVariable;if(t?.correctResponse){if(e){this._correctResponse=t.correctResponse.toString();let i=parseFloat(t.correctResponse.toString());if(isNaN(i))this.#t=null;else{this.#t=i;let n=(this.#t-this.min)/(this.max-this.min)*100;this.style.setProperty("--value-percentage-correct",`${n}%`)}}else this.#t=null;this.requestUpdate()}}#r(e){let t=this.#e;if(this.#e=Math.min(this.max,Math.max(this.min,e)),this.#e===t)return;let i=(this.#e-this.min)/(this.max-this.min)*100;this.style.setProperty("--value-percentage",`${i}%`),this._internals.setFormValue(this.value),this.saveResponse(this.response),this.requestUpdate()}render(){return x`
5998
5998
  <slot name="prompt"></slot>
5999
5999
  <div id="slider" part="slider">
6000
6000
  <div id="bounds" part="bounds">
@@ -6016,7 +6016,7 @@ CES.load();
6016
6016
  `:null}
6017
6017
  </div>
6018
6018
  </div>
6019
- `}#i(e){this.#o(e.pageX);let t=n=>this.#s(n.pageX),i=()=>{document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",i),this.#a()};document.addEventListener("mousemove",t),document.addEventListener("mouseup",i)}#n(e){this.#o(e.touches[0].pageX);let t=n=>this.#s(n.touches[0].pageX),i=()=>{document.removeEventListener("touchmove",t),document.removeEventListener("touchend",i),this.#a()};document.addEventListener("touchmove",t,{passive:!1}),document.addEventListener("touchend",i)}#o(e){this.#s(e)}#s(e){let t=this._rail.getBoundingClientRect(),i=e-t.left,n=Math.min(1,Math.max(0,i/t.width)),o=this.min+Math.round(n*(this.max-this.min)/this.step)*this.step;this.#r(o)}#a(){this.dispatchEvent(new Event("change",{bubbles:!0}))}};d([Qt("#rail")],Ct.prototype,"_rail",2),d([g({type:Number,attribute:"lower-bound"})],Ct.prototype,"min",2),d([g({type:Number,attribute:"upper-bound"})],Ct.prototype,"max",2),d([g({type:Number,attribute:"step"})],Ct.prototype,"step",2);customElements.define("qti-slider-interaction",Ct);var xd=()=>new Ts,Ts=class{},As=new WeakMap,uI=qe(class extends st{render(s){return O}update(s,[r]){let e=r!==this.G;return e&&this.G!==void 0&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.G=r,this.ht=s.options?.host,this.rt(this.ct=s.element)),O}rt(s){if(this.isConnected||(s=void 0),typeof this.G=="function"){let r=this.ht??globalThis,e=As.get(r);e===void 0&&(e=new WeakMap,As.set(r,e)),e.get(this.G)!==void 0&&this.G.call(this.ht,void 0),e.set(this.G,s),s!==void 0&&this.G.call(this.ht,s)}else this.G.value=s}get lt(){return typeof this.G=="function"?As.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var qd=C`
6019
+ `}#i(e){this.#o(e.pageX);let t=n=>this.#s(n.pageX),i=()=>{document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",i),this.#a()};document.addEventListener("mousemove",t),document.addEventListener("mouseup",i)}#n(e){this.#o(e.touches[0].pageX);let t=n=>this.#s(n.touches[0].pageX),i=()=>{document.removeEventListener("touchmove",t),document.removeEventListener("touchend",i),this.#a()};document.addEventListener("touchmove",t,{passive:!1}),document.addEventListener("touchend",i)}#o(e){this.#s(e)}#s(e){let t=this._rail.getBoundingClientRect(),i=e-t.left,n=Math.min(1,Math.max(0,i/t.width)),s=this.min+Math.round(n*(this.max-this.min)/this.step)*this.step;this.#r(s)}#a(){this.dispatchEvent(new Event("change",{bubbles:!0}))}};d([Zt("#rail")],St.prototype,"_rail",2),d([g({type:Number,attribute:"lower-bound"})],St.prototype,"min",2),d([g({type:Number,attribute:"upper-bound"})],St.prototype,"max",2),d([g({type:Number,attribute:"step"})],St.prototype,"step",2);customElements.define("qti-slider-interaction",St);var _d=()=>new Ps,Ps=class{},$s=new WeakMap,lR=we(class extends at{render(o){return O}update(o,[r]){let e=r!==this.G;return e&&this.G!==void 0&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.G=r,this.ht=o.options?.host,this.rt(this.ct=o.element)),O}rt(o){if(this.isConnected||(o=void 0),typeof this.G=="function"){let r=this.ht??globalThis,e=$s.get(r);e===void 0&&(e=new WeakMap,$s.set(r,e)),e.get(this.G)!==void 0&&this.G.call(this.ht,void 0),e.set(this.G,o),o!==void 0&&this.G.call(this.ht,o)}else this.G.value=o}get lt(){return typeof this.G=="function"?$s.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var Ld=C`
6020
6020
  :host {
6021
6021
  display: inline-block;
6022
6022
  }
@@ -6124,7 +6124,7 @@ CES.load();
6124
6124
  bottom: 0;
6125
6125
  }
6126
6126
  }
6127
- `;var Ie=class extends V{constructor(){super(...arguments);this.inputRef=xd();this.response=null;this._handleValueChange=()=>{this._internals.setFormValue(this.value),this.validate()}}static{this.styles=qd}get value(){return this.response||null}set value(e){this.response=e||null}get correctness(){let e=this.responseVariable;if(!e)return null;if(e.value===null)return"incorrect";if(e.mapping){let t=e.mapping.mapEntries.reduce((i,n)=>Math.max(n.mappedValue,i),0);for(let i of e.mapping.mapEntries){let n=i.mapKey,o=e.value;if(i.caseSensitive||(n=n.toLowerCase(),o=o.toLowerCase()),n===o)return i.mappedValue===t?"correct":i.mappedValue<=(e.mapping.defaultValue||0)?"incorrect":"partially-correct"}}return e.correctResponse===e.value?"correct":"incorrect"}get isInline(){return!0}validate(){if(!this._input)return!1;if(this.patternMask&&this.dataPatternmaskMessage)this._internals.setValidity({}),this._input.setCustomValidity(""),this._input.checkValidity()||(this._internals.setValidity({customError:!0},this.dataPatternmaskMessage),this._input.setCustomValidity(this.dataPatternmaskMessage));else{let e=this._input.checkValidity();this._internals.setValidity(e?{}:{customError:!1})}return this.response!==""&&this._input.checkValidity()}toggleInternalCorrectResponse(e){let t=this.responseVariable;if(e&&t?.correctResponse){let i=t.correctResponse.toString();this._correctResponse=i}else this._correctResponse=null}render(){return x`
6127
+ `;var Re=class extends V{constructor(){super(...arguments);this.inputRef=_d();this.response=null;this._handleValueChange=()=>{this._internals.setFormValue(this.value),this.validate()}}static{this.styles=Ld}get value(){return this.response||null}set value(e){this.response=e||null}get correctness(){let e=this.responseVariable;if(!e)return null;if(e.value===null)return"incorrect";if(e.mapping){let t=e.mapping.mapEntries.reduce((i,n)=>Math.max(n.mappedValue,i),0);for(let i of e.mapping.mapEntries){let n=i.mapKey,s=e.value;if(i.caseSensitive||(n=n.toLowerCase(),s=s.toLowerCase()),n===s)return i.mappedValue===t?"correct":i.mappedValue<=(e.mapping.defaultValue||0)?"incorrect":"partially-correct"}}return e.correctResponse===e.value?"correct":"incorrect"}get isInline(){return!0}validate(){if(!this._input)return!1;if(this.patternMask&&this.dataPatternmaskMessage)this._internals.setValidity({}),this._input.setCustomValidity(""),this._input.checkValidity()||(this._internals.setValidity({customError:!0},this.dataPatternmaskMessage),this._input.setCustomValidity(this.dataPatternmaskMessage));else{let e=this._input.checkValidity();this._internals.setValidity(e?{}:{customError:!1})}return this.response!==""&&this._input.checkValidity()}toggleInternalCorrectResponse(e){let t=this.responseVariable;if(e&&t?.correctResponse){let i=t.correctResponse.toString();this._correctResponse=i}else this._correctResponse=null}render(){return x`
6128
6128
  <input
6129
6129
  part="input"
6130
6130
  name="${this.responseIdentifier}"
@@ -6135,15 +6135,15 @@ CES.load();
6135
6135
  @keyup="${this.textChanged}"
6136
6136
  @change="${this.textChanged}"
6137
6137
  type="${this.patternMask=="[0-9]*"?"number":"text"}"
6138
- placeholder="${Le(this.placeholderText?this.placeholderText:void 0)}"
6138
+ placeholder="${$e(this.placeholderText?this.placeholderText:void 0)}"
6139
6139
  .value="${this.response}"
6140
- pattern="${Le(this.patternMask?this.patternMask:void 0)}"
6140
+ pattern="${$e(this.patternMask?this.patternMask:void 0)}"
6141
6141
  maxlength=${1e3}
6142
6142
  ?disabled="${this.disabled}"
6143
6143
  ?readonly="${this.readonly}"
6144
6144
  />
6145
6145
  ${this._correctResponse?x`<div part="correct">${this._correctResponse}</div>`:O}
6146
- `}textChanged(e){if(this.disabled||this.readonly)return;let t=e.target;this.#e(t.value),this.response!==t.value&&(this.value=t.value,this.saveResponse(t.value))}reportValidity(){let e=this.shadowRoot.querySelector("input");if(!e)return!1;let t=this.validate();return t||e.reportValidity(),t}reset(){this.response=""}#e(e){this.setAttribute("empty",e===""?"true":"false")}};d([g({type:Number,attribute:"expected-length"})],Ie.prototype,"expectedLength",2),d([g({type:String,attribute:"pattern-mask"})],Ie.prototype,"patternMask",2),d([g({type:String,attribute:"placeholder-text"})],Ie.prototype,"placeholderText",2),d([g({type:String,attribute:"data-patternmask-message"})],Ie.prototype,"dataPatternmaskMessage",2),d([M()],Ie.prototype,"response",2),d([Qt("input")],Ie.prototype,"_input",2),d([B("response",{waitUntilFirstUpdate:!0})],Ie.prototype,"_handleValueChange",2);customElements.define("qti-text-entry-interaction",Ie);var wd=C`
6146
+ `}textChanged(e){if(this.disabled||this.readonly)return;let t=e.target;this.#e(t.value),this.response!==t.value&&(this.value=t.value,this.saveResponse(t.value))}reportValidity(){let e=this.shadowRoot.querySelector("input");if(!e)return!1;let t=this.validate();return t||e.reportValidity(),t}reset(){this.response=""}#e(e){this.setAttribute("empty",e===""?"true":"false")}};d([g({type:Number,attribute:"expected-length"})],Re.prototype,"expectedLength",2),d([g({type:String,attribute:"pattern-mask"})],Re.prototype,"patternMask",2),d([g({type:String,attribute:"placeholder-text"})],Re.prototype,"placeholderText",2),d([g({type:String,attribute:"data-patternmask-message"})],Re.prototype,"dataPatternmaskMessage",2),d([k()],Re.prototype,"response",2),d([Zt("input")],Re.prototype,"_input",2),d([B("response",{waitUntilFirstUpdate:!0})],Re.prototype,"_handleValueChange",2);customElements.define("qti-text-entry-interaction",Re);var $d=C`
6147
6147
  :host {
6148
6148
  display: block;
6149
6149
  margin: 1em 0;
@@ -6152,38 +6152,29 @@ CES.load();
6152
6152
  display: block;
6153
6153
  margin-top: 0.5em;
6154
6154
  }
6155
- `;var go=class extends V{static{this.styles=wd}#e=null;#t=null;reset(){this.#e=null,this.#t=null,this.saveResponse(null)}validate(){return this.#t!==null}get response(){return this.#t}set response(r){if(typeof r=="string")this.#t=r,this.saveResponse(r);else if(r===null)this.reset();else throw new Error("Value must be a Base64-encoded string or null")}static get properties(){return{...V.properties}}render(){return x`
6155
+ `;var xo=class extends V{static{this.styles=$d}#e=null;#t=null;reset(){this.#e=null,this.#t=null,this.saveResponse(null)}validate(){return this.#t!==null}get response(){return this.#t}set response(r){if(typeof r=="string")this.#t=r,this.saveResponse(r);else if(r===null)this.reset();else throw new Error("Value must be a Base64-encoded string or null")}static get properties(){return{...V.properties}}render(){return x`
6156
6156
  <div>
6157
6157
  <slot name="prompt"></slot>
6158
6158
  <input type="file" @change="${this.#r}" ?disabled="${this.disabled}" ?readonly="${this.readonly}" />
6159
6159
  </div>
6160
- `}async#r(r){let e=r.target;e.files&&e.files.length>0&&(this.#e=e.files[0],this.#t=await this.#i(this.#e),this.saveResponse(this.#t),this.dispatchEvent(new CustomEvent("qti-interaction-response",{detail:{response:this.#t}})))}#i(r){return new Promise((e,t)=>{let i=new FileReader;i.onload=()=>e(i.result),i.onerror=()=>t(i.error),i.readAsDataURL(r)})}};customElements.define("qti-upload-interaction",go);var fM=async s=>{let r=s.substring(0,s.lastIndexOf("/")),e=await Ja().load(`${s}`).then(a=>a.assessmentTest()),t=await er().load(`${r}/${e.href}`).then(a=>a.htmlDoc()),i=await er().load(`${r}/${e.href}`).then(a=>a.items()),n=`${r}/${e.href}`,o=`${r}/${e.href.substring(0,e.href.lastIndexOf("/"))}`;return{testHTMLDoc:t,testURI:o,testURL:n,items:i,testIdentifier:e.identifier}},gM=async s=>Me().load(s).then(r=>r.htmlDoc().firstElementChild);var ae=class extends E{render(){return x`<slot></slot>`}process(){throw new Error("Not implemented")}};ae=d([k("qti-rule")],ae);var ji=class extends ae{get childExpression(){return this.firstElementChild}process(){let r=this.getAttribute("identifier"),e=this.context.variables.find(i=>i.identifier===r)||null,t;return e.interpolationTable&&(t=e.interpolationTable.get(parseFloat(this.childExpression.calculate()))),t==null?(console.warn("lookupOutcomeValue: value is null or undefined"),0):(this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:this.identifier,value:we(t)}})),t)}};d([g({type:String})],ji.prototype,"identifier",2),d([$({context:W,subscribe:!0}),M()],ji.prototype,"context",2);customElements.define("qti-lookup-outcome-value",ji);var Is=class extends ae{render(){return x`<slot></slot>`}process(){let r=[...this.children];for(let e=0;e<r.length;e++){let t=r[e];if(t.calculate()){t.process();return}}}};customElements.define("qti-response-condition",Is);var Rs=class extends ae{process(){let r=this.getAttribute("identifier");if(!r){console.warn('QtiSetOutcomeValue: Missing "identifier" attribute.');return}let e=this.firstElementChild;if(!e){console.warn("QtiSetOutcomeValue: No expression found.");return}let i=new ks(e).process();this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:r,value:this.#e(i)}}))}#e(r){return Array.isArray(r)?r.map(we):r!==null?we(r):null}},ks=class{constructor(r){this.expression=r}process(){let r=this.expression.calculate()??null;return r===null&&console.warn("QtiSetOutcomeValueRule: Evaluated value is null."),Array.isArray(r)?r.map(e=>e.value?e.value:e):r}};customElements.define("qti-set-outcome-value",Rs);var Wi=class extends E{render(){return x`<slot></slot>`}calculate(){return!0}getSubRules(){return[...this.children]}process(){let r=this.getSubRules();for(let e=0;e<r.length;e++)r[e].process()}};customElements.define("qti-response-else",Wi);var Gi=class extends Wi{calculate(){return this.firstElementChild.calculate()}getSubRules(){let r=[];for(let e=1;e<this.children.length;e++)r.push(this.children[e]);return r}};customElements.define("qti-response-if",Gi);var Ms=class extends Gi{render(){return x`${super.render()}`}};customElements.define("qti-response-else-if",Ms);var bo=class extends Np(be){calculate(){return this.calculateChildren(Array.from(this.children))}};bo=d([k("qti-and")],bo);function Np(s){return class extends s{calculateChildren(e){return e.map(i=>{let n=i;if(!n.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let o=n.calculate(),a=!1;if(typeof o=="string")if(o==="true")a=!0;else if(o==="false")a=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof o=="boolean"&&(a=o);return a}).every(i=>typeof i=="boolean"&&i)}}}var Xi=class extends R{constructor(){super(...arguments);this.min=0;this.max=1/0}getResult(){let e=this.getVariables();if(!e||e.length===0)return console.error("qti-any-n requires at least one child expression"),null;if(this.min<0||this.max<this.min)return console.error("qti-any-n requires 0 <= min <= max"),null;let t=0;for(let i of e){if(i.cardinality!=="single"||Array.isArray(i.value))return console.error("qti-any-n requires single cardinality boolean expressions"),null;if(i.baseType!=="boolean")return console.error("qti-any-n requires boolean base-type"),null;if(i.value===null||i.value===void 0)return null;i.value==="true"&&t++}return t>=this.min&&t<=this.max}};d([g({type:Number})],Xi.prototype,"min",2),d([g({type:Number})],Xi.prototype,"max",2);customElements.define("qti-any-n",Xi);var vo=class extends R{constructor(){super(...arguments);this.baseType="string"}getResult(){return this.textContent.trim()}};d([g({type:String,attribute:"base-type"})],vo.prototype,"baseType",2);customElements.define("qti-base-value",vo);var _s=class extends R{getResult(){if(this.children?.length!==1)return console.error("qti-container-size must have exactly one child expression"),0;let r=this.getVariables();if(!r||r?.length===0)return 0;let e=r[0];return e.value===null||e.value===void 0?0:e.cardinality!=="multiple"&&e.cardinality!=="ordered"?(console.error("qti-container-size requires multiple or ordered cardinality"),0):Array.isArray(e.value)?e.value.length:(console.error("qti-container-size: expected array value for multiple/ordered cardinality"),0)}};customElements.define("qti-container-size",_s);var Ls=class extends be{getResult(){let r=this.getVariables();if(this.children.length===2){let e=r[0],t=r[1];if(e.baseType==="directedPair"&&t.baseType==="directedPair"&&e.cardinality==="multiple"){let i=e.value,n=t.value;return i.filter(l=>n.includes(l)).length>0}else if(e.baseType==="directedPair"&&t.baseType==="directedPair"&&e.cardinality==="single"){let i=e.value;return t.value.includes(i)}else console.error("unsupported baseType or cardinality in qti contains, only baseType: directedPair and cardinality: multiple is supported")}else console.error("unexpected number of children in qti contains");return!1}};customElements.define("qti-contains",Ls);var $s=class extends R{get interpretation(){return this.getAttribute("interpretation")||""}getResult(){let r=this.getAttribute("identifier")||"",e=this.context.variables.find(t=>t.identifier===r)||null;return e.cardinality!=="single"?e.correctResponse.length>0?e.correctResponse[0]:"":e.correctResponse}};customElements.define("qti-correct",$s);var Rr=class extends R{constructor(){super(...arguments);this.identifier=""}getResult(){if(!this.identifier)return console.error("qti-default requires an identifier attribute"),null;let e=this.identifier.split("."),t=null,i;if(e.length===2)t=e[0],i=e[1];else if(e.length===1)i=e[0];else return console.error("qti-default: invalid identifier format"),null;if(t){let o=this._testContext.items.find(l=>l.identifier===t);if(console.debug(`itemContext: ${JSON.stringify(o)}`),!this._testContext||!o)return console.warn(`qti-default: item "${t}" not found in test context`),null;let a=this._testContext.items.find(l=>l.identifier===t)?.variables.find(l=>l.identifier===i);return a?a.defaultValue||null:(console.warn(`qti-default: variable "${i}" not found in item "${t}"`),null)}if(!this.context?.variables)return console.warn("qti-default: no variables found in item context"),null;let n=this.context.variables.find(o=>o.identifier===i);return n?n.defaultValue||null:(console.warn(`qti-default: variable "${i}" not found in item context`),null)}};d([g({type:String})],Rr.prototype,"identifier",2),d([$({context:W,subscribe:!0}),M()],Rr.prototype,"context",2),d([M(),$({context:_e,subscribe:!0})],Rr.prototype,"_testContext",2);customElements.define("qti-default",Rr);var yo=class extends R{constructor(){super(...arguments);this.roundingMode="significantFigures"}get figures(){if(!this.getAttribute("figures"))return console.error("figures attribute is missing"),null;let t=parseInt(this.getAttribute("figures")||"0");return isNaN(t)?(console.error("figures attribute is not a number"),null):t<0?(console.error("figures attribute is negative"),null):t<1&&this.roundingMode==="significantFigures"?(console.error("figures cannot be smaller than 1 for RoundingMode significantFigures"),null):t}getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],i=e[1];if(this.roundingMode===null)return null;if(t.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(t.value)||Array.isArray(i.value))return console.error("unexpected cardinality in qti equal"),!1;switch(e[0].baseType){case"integer":case"float":{let n=parseFloat(t.value),o=parseFloat(i.value);if(!isNaN(n)&&!isNaN(o))return this.roundingMode==="significantFigures"?n.toPrecision(this.figures)===o.toPrecision(this.figures):Math.round(n*Math.pow(10,this.figures))/Math.pow(10,this.figures)===Math.round(o*Math.pow(10,this.figures))/Math.pow(10,this.figures);console.error(`value cannot be casted to numeric value in equalRounded operator: ${n}, ${o}`);break}default:{console.error("values other than float and int cannot be used in equalRounded operator.");break}}return!1}return console.error("unexpected number of children in qti-equal-rounded"),null}};d([g({type:String})],yo.prototype,"roundingMode",2);customElements.define("qti-equal-rounded",yo);var Ps=class extends R{getResult(){if(this.children.length!==1)return console.error("qti-round must have exactly one child expression"),null;let r=this.getVariables();if(!r||r.length===0)return null;let e=r[0];if(e.cardinality!=="single")return console.error("qti-round requires single cardinality"),null;if(Array.isArray(e.value))return console.error("qti-round unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float")return console.error("qti-round requires numerical base-type (integer or float)"),null;let t=parseFloat(e.value);return isNaN(t)?(console.warn("qti-round: NaN input results in NULL"),null):isFinite(t)?Math.floor(t+.5):t===1/0?1/0:t===-1/0?-1/0:null}};customElements.define("qti-round",Ps);var Qi=class extends R{constructor(){super(...arguments);this.roundingMode="significantFigures";this.figures=3}getResult(){if(this.children.length!==1)return console.error("qti-round-to must have exactly one child expression"),null;let e=this.getVariables();if(!e||e.length===0)return null;let t=e[0];if(t.cardinality!=="single")return console.error("qti-round-to requires single cardinality"),null;if(Array.isArray(t.value))return console.error("qti-round-to unexpected array value for single cardinality"),null;if(t.value===null||t.value===void 0)return null;if(t.baseType!=="integer"&&t.baseType!=="float")return console.error("qti-round-to requires numerical base-type"),null;let i=parseFloat(t.value);return isNaN(i)?null:isFinite(i)?this.figures<0?(console.error("qti-round-to: figures must be non-negative"),null):this.roundingMode==="significantFigures"&&this.figures<1?(console.error("qti-round-to: figures must be at least 1 for significantFigures mode"),null):this.roundingMode==="decimalPlaces"?this.#e(i,this.figures):this.#t(i,this.figures):i===1/0?1/0:i===-1/0?-1/0:null}#e(e,t){if(e===0)return 0;let i=Math.pow(10,t);return Math.round(e*i)/i}#t(e,t){if(e===0)return 0;let i=Math.floor(Math.log10(Math.abs(e))),n=Math.pow(10,t-i-1);return Math.round(e*n)/n}};d([g({type:String,attribute:"rounding-mode"})],Qi.prototype,"roundingMode",2),d([g({type:Number})],Qi.prototype,"figures",2);customElements.define("qti-round-to",Qi);var xo=class extends R{constructor(){super(...arguments);this.toleranceMode="exact"}getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],i=e[1];return!t||!i?null:this.toleranceMode!=="exact"?(console.error("toleranceMode is not supported yet"),!1):t.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(t.value)||Array.isArray(i.value)?(console.error("unexpected cardinality in qti equal"),!1):t.value===null||i.value===null||t.value===void 0||i.value===void 0?null:J.compareSingleValues(t.value,i.value,t.baseType)}return console.error("unexpected number of children in qti-equal"),null}};d([g({type:String})],xo.prototype,"toleranceMode",2);customElements.define("qti-equal",xo);var Vs=class extends R{getResult(){let r=this.#e(this.getVariables());return r.length!==2?(console.warn("qti-divide: expected exactly 2 numeric values"),null):r[1]===0?(console.warn("qti-divide: division by zero"),null):r[0]/r[1]}#e(r){let e=[];for(let t of r){if(!t)continue;let i=n=>{if(n==null)return;let o=parseFloat(n.toString());if(Number.isNaN(o)){console.warn("qti-divide: non-numeric value encountered");return}e.push(o)};if(Array.isArray(t.value)){t.value.forEach(n=>i(n));continue}i(t.value)}return e}};customElements.define("qti-divide",Vs);var Ds=class extends R{getResult(){let r=this.#e();return r?r[0]>=r[1]:null}#e(){let r=this.getVariables();if(r.length!==2)return console.error("qti-duration-gte requires exactly 2 duration expressions"),null;let e=r.map(t=>this.#t(t));return e.some(t=>t===null)?null:e}#t(r){if(r.cardinality!=="single"||Array.isArray(r.value))return console.error("qti-duration-gte requires single cardinality"),null;if(r.baseType!=="duration")return console.error("qti-duration-gte requires duration base-type"),null;if(r.value===null||r.value===void 0)return null;let e=Number.parseFloat(r.value.toString());return Number.isNaN(e)?(console.error(`qti-duration-gte requires duration values expressed in seconds, got "${r.value.toString()}"`),null):e}};customElements.define("qti-duration-gte",Ds);var Ns=class extends R{getResult(){let r=this.#e();return r?r[0]<r[1]:null}#e(){let r=this.getVariables();if(r.length!==2)return console.error("qti-duration-lt requires exactly 2 duration expressions"),null;let e=r.map(t=>this.#t(t));return e.some(t=>t===null)?null:e}#t(r){if(r.cardinality!=="single"||Array.isArray(r.value))return console.error("qti-duration-lt requires single cardinality"),null;if(r.baseType!=="duration")return console.error("qti-duration-lt requires duration base-type"),null;if(r.value===null||r.value===void 0)return null;let e=Number.parseFloat(r.value.toString());return Number.isNaN(e)?(console.error(`qti-duration-lt requires duration values expressed in seconds, got "${r.value.toString()}"`),null):e}};customElements.define("qti-duration-lt",Ns);var Os=class extends R{getResult(){if(this.children.length===0)return console.error("qti-gcd must have at least one child expression"),null;let r=this.getVariables();if(!r||r.length===0)return null;let e=[];for(let t of r){if(t.baseType!=="integer")return console.error("qti-gcd requires integer base-type"),null;if(t.value===null||t.value===void 0)return null;if(t.cardinality==="single"){if(Array.isArray(t.value))return console.error("qti-gcd unexpected array value for single cardinality"),null;let i=parseInt(t.value,10);if(isNaN(i))return console.error("qti-gcd non-numerical value"),null;e.push(i)}else if(t.cardinality==="multiple"||t.cardinality==="ordered"){if(!Array.isArray(t.value))return console.error("qti-gcd expected array value for multiple/ordered cardinality"),null;for(let i of t.value){if(i==null)return null;let n=parseInt(i,10);if(isNaN(n))return console.error("qti-gcd non-numerical value"),null;e.push(n)}}else return console.error("qti-gcd unsupported cardinality"),null}return e.length===0?null:this.#e(e)}#e(r){if(r.length===0)return 0;if(r.length===1)return Math.abs(r[0]);let e=Math.abs(r[0]);for(let t=1;t<r.length&&(e=this.#t(e,Math.abs(r[t])),e!==1);t++);return e}#t(r,e){if(r===0&&e===0)return 0;if(r===0)return e;if(e===0)return r;for(;e!==0;){let t=e;e=r%e,r=t}return r}};customElements.define("qti-gcd",Os);var Hs=class extends R{getResult(){if(this.children.length===2){let r=this.getVariables(),e=r[0],t=r[1];if((e.baseType==="integer"||e.baseType==="float")&&(t.baseType==="integer"||t.baseType==="float"))return+e.value>+t.value;console.error("unexpected baseType or cardinality in qti gt")}return console.error("unexpected number of children in qt"),null}};customElements.define("qti-gt",Hs);var Fs=class extends be{getResult(){if(this.children.length===2){let r=this.getVariables(),e=r[0],t=r[1];return(e.baseType==="integer"||e.baseType==="float")&&(t.baseType==="integer"||t.baseType==="float")?+e.value>=+t.value:(console.error("unexpected baseType or cardinality in qti gte"),null)}return console.log("unexpected number of children in qte"),null}};customElements.define("qti-gte",Fs);var Yi=class extends R{constructor(){super(...arguments);this.shape="";this.coords=""}getResult(){let e=this.getVariables();if(e.length!==1)return console.error("qti-inside requires exactly one point expression"),null;let t=e[0];if(t.cardinality!=="single"||Array.isArray(t.value))return console.error("qti-inside requires single cardinality"),null;if(t.value===null||t.value===void 0)return null;if(!this.shape||!this.coords)return console.error("qti-inside requires shape and coords attributes"),null;let i=this.#e(t.value.toString()),n=this.#t(this.coords);if(!i||n.length===0)return null;switch(this.shape.toLowerCase()){case"circle":return this.#r(i,n);case"rect":return this.#i(i,n);case"ellipse":return this.#n(i,n);case"poly":case"polygon":return this.#o(i,n);default:return console.error(`qti-inside does not support shape "${this.shape}"`),null}}#e(e){let t=e.split(/[,\s]+/).map(o=>o.trim()).filter(Boolean);if(t.length!==2)return console.error('qti-inside requires a point value formatted as "x y" or "x,y"'),null;let i=Number.parseFloat(t[0]),n=Number.parseFloat(t[1]);return Number.isNaN(i)||Number.isNaN(n)?(console.error("qti-inside requires numeric point coordinates"),null):{x:i,y:n}}#t(e){let t=e.split(",").map(i=>i.trim()).filter(Boolean).map(i=>Number.parseFloat(i));return t.some(i=>Number.isNaN(i))?(console.error("qti-inside requires numeric coords"),[]):t}#r(e,t){if(t.length!==3)return console.error("qti-inside circle requires x,y,r"),null;let[i,n,o]=t;return(e.x-i)**2+(e.y-n)**2<=o**2}#i(e,t){if(t.length!==4)return console.error("qti-inside rect requires left,top,right,bottom"),null;let[i,n,o,a]=t,l=Math.min(i,o),c=Math.max(i,o),p=Math.min(n,a),u=Math.max(n,a);return e.x>=l&&e.x<=c&&e.y>=p&&e.y<=u}#n(e,t){if(t.length!==4)return console.error("qti-inside ellipse requires centerX,centerY,radiusX,radiusY"),null;let[i,n,o,a]=t;return o===0||a===0?!1:(e.x-i)**2/o**2+(e.y-n)**2/a**2<=1}#o(e,t){if(t.length<6||t.length%2!==0)return console.error("qti-inside polygon requires at least 3 coordinate pairs"),null;let i=!1;for(let n=0,o=t.length-2;n<t.length;n+=2){let a=t[n],l=t[n+1],c=t[o],p=t[o+1];l>e.y!=p>e.y&&e.x<(c-a)*(e.y-l)/(p-l||Number.EPSILON)+a&&(i=!i),o=n}return i}};d([g({type:String})],Yi.prototype,"shape",2),d([g({type:String})],Yi.prototype,"coords",2);customElements.define("qti-inside",Yi);var Us=class extends R{getResult(){let r=this.#e(this.getVariables());return r.length!==2?(console.error("qti-integer-divide requires exactly 2 integer values"),null):r[1]===0?(console.error("qti-integer-divide: division by zero"),null):Math.floor(r[0]/r[1])}#e(r){let e=[];for(let t of r){if(t.baseType!=="integer")return console.error("qti-integer-divide requires integer base-type"),[];if(t.cardinality!=="single"||Array.isArray(t.value))return console.error("qti-integer-divide requires single cardinality"),[];if(t.value===null||t.value===void 0)return[];let i=Number.parseInt(t.value,10);if(Number.isNaN(i))return console.error("qti-integer-divide requires integer values"),[];e.push(i)}return e}};customElements.define("qti-integer-divide",Us);var Bs=class extends R{getResult(){let r=this.#e(this.getVariables());return r.length!==2?(console.error("qti-integer-modulus requires exactly 2 integer values"),null):r[1]===0?(console.error("qti-integer-modulus: division by zero"),null):r[0]%r[1]}#e(r){let e=[];for(let t of r){if(t.baseType!=="integer")return console.error("qti-integer-modulus requires integer base-type"),[];if(t.cardinality!=="single"||Array.isArray(t.value))return console.error("qti-integer-modulus requires single cardinality"),[];if(t.value===null||t.value===void 0)return[];let i=Number.parseInt(t.value,10);if(Number.isNaN(i))return console.error("qti-integer-modulus requires integer values"),[];e.push(i)}return e}};customElements.define("qti-integer-modulus",Bs);var zs=class extends R{getResult(){let r=this.getVariables();if(r.length!==1)return console.error("qti-integer-to-float requires exactly one child expression"),null;let e=r[0];if(e.baseType!=="integer")return console.error("qti-integer-to-float requires integer base-type"),null;if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-integer-to-float requires single cardinality"),null;if(e.value===null||e.value===void 0)return null;let t=Number.parseInt(e.value,10);return Number.isNaN(t)?(console.error("qti-integer-to-float requires an integer value"),null):t}};customElements.define("qti-integer-to-float",zs);var js=class extends R{getResult(){let r=this.#e(this.getVariables());return r.length===0?(console.error("qti-lcm requires at least one integer value"),null):r.reduce((e,t)=>this.#r(e,t))}#e(r){let e=[];for(let t of r){if(t.baseType!=="integer")return console.error("qti-lcm requires integer base-type"),[];if(t.value===null||t.value===void 0)return[];if(t.cardinality==="single"){if(Array.isArray(t.value))return console.error("qti-lcm unexpected array value for single cardinality"),[];let i=Number.parseInt(t.value,10);if(Number.isNaN(i))return console.error("qti-lcm requires integer values"),[];e.push(i);continue}if(t.cardinality!=="multiple"&&t.cardinality!=="ordered")return console.error("qti-lcm unsupported cardinality"),[];if(!Array.isArray(t.value))return console.error("qti-lcm expected array value for container cardinality"),[];for(let i of t.value){let n=Number.parseInt(i,10);if(Number.isNaN(n))return console.error("qti-lcm requires integer values"),[];e.push(n)}}return e}#t(r,e){let t=Math.abs(r),i=Math.abs(e);for(;i!==0;){let n=t%i;t=i,i=n}return t}#r(r,e){return r===0||e===0?0:Math.abs(r*e/this.#t(r,e))}};customElements.define("qti-lcm",js);var Ws=class extends R{getResult(){return null}};customElements.define("qti-null",Ws);var Gs=class extends R{getResult(){if(this.children.length===1){let r=this.getVariables();if(!r)return!0;let e=r[0].value;return e==null||e==null||e===""}return console.error("unexpected number of children in qti Null"),null}};customElements.define("qti-is-null",Gs);var Xs=class extends R{getResult(){let r=this.getAttribute("field-identifier");if(!r)throw new Error("field-identifier attribute is required");if(Array.from(this.children).length!==1)throw new Error("qti-field-value must have exactly one child expression");let t=this.getVariables()[0];if(t.baseType!=="record"||t.value===null)throw new Error("qti-field-value child expression must return a record");let i=t.value[r];if(i===void 0)throw new Error(`Field "${r}" not found in record`);return i}};customElements.define("qti-field-value",Xs);var Qs=class extends R{getResult(){if(this.children.length===2){let r=this.getVariables(),e=r[0],t=r[1];if((e.baseType==="integer"||e.baseType==="float")&&(t.baseType==="integer"||t.baseType==="float"))return+e.value<+t.value;console.error("unexpected baseType or cardinality in qti lt")}return console.error("unexpected number of children in lt"),null}};customElements.define("qti-lt",Qs);var Ys=class extends be{getResult(){if(this.children.length===2){let r=this.getVariables(),e=r[0],t=r[1];return(e.baseType==="integer"||e.baseType==="float")&&(t.baseType==="integer"||t.baseType==="float")?+e.value<=+t.value:(console.error("unexpected baseType or cardinality in qti lte"),null)}return console.log("unexpected number of children in lte"),null}};customElements.define("qti-lte",Ys);var qo=class extends R{getResult(){let r=this.context.variables.find(n=>n.identifier===this.identifier);if(!r||!r.mapping)return console.error(`Response ${this.identifier} can not be found`),null;let e=r.mapping,t=Array.isArray(r.value)?r.value:[r.value],i=0;for(let n of t){let o=e.mapEntries.filter(l=>r.baseType==="string"&&!l.caseSensitive?J.compareSingleValues(l.mapKey.toLowerCase(),n.toLowerCase(),r.baseType):J.compareSingleValues(l.mapKey,n,r.baseType)),a=o.reduce((l,c)=>l.mappedValue>c.mappedValue?l:c,o.length>0?o[0]:{mapKey:null,mappedValue:null});a===null||a.mappedValue==null?i+=e.defaultValue:i+=a.mappedValue}return e?.lowerBound!==null&&e?.lowerBound!==void 0&&(i=Math.max(e.lowerBound,i)),e?.upperBound!==null&&e?.upperBound!==void 0&&(i=Math.min(e.upperBound,i)),i}};d([g({type:String})],qo.prototype,"identifier",2);customElements.define("qti-map-response",qo);var wo=class extends R{getResult(){let r=this.context.variables.find(o=>o.identifier===this.identifier);if(!r)return console.warn(`Response ${this.identifier} cannot be found`),null;let e=r.areaMapping;if(!e)return console.warn(`Area mapping not found for response ${this.identifier}`),null;let t=Array.isArray(r.value)?r.value:[r.value];if(!t||t.length===0)return console.warn(`No candidate responses for response ${this.identifier}`),null;let i=0,n=new Set;for(let o of t)for(let a of e.areaMapEntries){if(n.has(a.coords))continue;J.isPointInArea(o,`${a.shape},${a.coords}`,r.baseType)&&(i+=a.mappedValue??0,n.add(a.coords))}return n.size<t.length&&(i+=e.defaultValue),e.lowerBound!=null&&(i=Math.max(e.lowerBound,i)),e.upperBound!=null&&(i=Math.min(e.upperBound,i)),i}};d([g({type:String})],wo.prototype,"identifier",2);customElements.define("qti-map-response-point",wo);var Eo=class extends R{constructor(){super(...arguments);this.name=""}getResult(){if(!this.name)return console.error("qti-math-operator requires a name attribute"),null;let e=this.getVariables();if(!e||e.length===0)return null;let t=[];for(let i of e){if(i.cardinality!=="single")return console.error("qti-math-operator requires single cardinality"),null;if(Array.isArray(i.value))return console.error("qti-math-operator unexpected array value for single cardinality"),null;if(i.value===null||i.value===void 0)return null;if(i.baseType!=="integer"&&i.baseType!=="float")return console.error("qti-math-operator requires numerical base-type"),null;let n=parseFloat(i.value);if(isNaN(n))return console.error("qti-math-operator non-numerical value"),null;t.push(n)}return this.#e(this.name,t)}#e(e,t){try{switch(e.toLowerCase()){case"sin":return t.length!==1?null:Math.sin(t[0]);case"cos":return t.length!==1?null:Math.cos(t[0]);case"tan":return t.length!==1?null:Math.tan(t[0]);case"asin":return t.length!==1||t[0]<-1||t[0]>1?null:Math.asin(t[0]);case"acos":return t.length!==1||t[0]<-1||t[0]>1?null:Math.acos(t[0]);case"atan":return t.length!==1?null:Math.atan(t[0]);case"sinh":return t.length!==1?null:Math.sinh(t[0]);case"cosh":return t.length!==1?null:Math.cosh(t[0]);case"tanh":return t.length!==1?null:Math.tanh(t[0]);case"log":return t.length!==1||t[0]<=0?null:Math.log(t[0]);case"ln":return t.length!==1||t[0]<=0?null:Math.log(t[0]);case"log10":return t.length!==1||t[0]<=0?null:Math.log10(t[0]);case"exp":return t.length!==1?null:Math.exp(t[0]);case"abs":return t.length!==1?null:Math.abs(t[0]);case"sqrt":return t.length!==1||t[0]<0?null:Math.sqrt(t[0]);case"signum":return t.length!==1?null:Math.sign(t[0]);case"floor":return t.length!==1?null:Math.floor(t[0]);case"ceil":return t.length!==1?null:Math.ceil(t[0]);case"round":return t.length!==1?null:Math.round(t[0]);case"atan2":return t.length!==2?null:Math.atan2(t[0],t[1]);case"pow":{if(t.length!==2)return null;let i=t[0],n=t[1];return i===0&&n<=0||i<0&&!Number.isInteger(n)?null:Math.pow(i,n)}case"log_base":{if(t.length!==2)return null;let i=t[0],n=t[1];return i<=0||n<=0||n===1?null:Math.log(i)/Math.log(n)}case"mod":return t.length!==2||t[1]===0?null:t[0]%t[1];case"max":return t.length<1?null:Math.max(...t);case"min":return t.length<1?null:Math.min(...t);default:return console.error(`qti-math-operator: unknown operation "${e}"`),null}}catch(i){return console.error(`qti-math-operator: error performing operation "${e}":`,i),null}}};d([g({type:String})],Eo.prototype,"name",2);customElements.define("qti-math-operator",Eo);var Js=class s extends R{getResult(){if(this.children.length===2){let r=this.getVariables(),e=r[0],t=r[1];return s.match(e,t)}return console.error("unexpected number of children in match"),null}static match(r,e){if(r.value===null)return!1;switch(e.cardinality){case"single":return Array.isArray(r.value)||Array.isArray(e.value)?(console.error("unexpected cardinality in qti match"),!1):J.compareSingleValues(r.value?.toString(),e.value.toString(),e.baseType);case"ordered":{if(!Array.isArray(r.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(r.value.length!==e.value.length)return!1;for(let t=0;t<r.value.length;t++)if(!J.compareSingleValues(e.value[t],r.value[t],e.baseType))return!1;return!0}case"multiple":{if(!Array.isArray(r.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(r.value.length!==e.value.length)return!1;let t=0;for(let i of e.value){let n=null,o=[...r.value];for(let a of o)if(J.compareSingleValues(i,a,e.baseType)){n=a;break}if(n!==null)o.splice(o.indexOf(n),1);else return!1;t++}return!0}default:return console.error("unexpected cardinality in qti match"),!1}}};customElements.define("qti-match",Js);var Ks=class extends R{getResult(){let r=this.#e(this.getVariables());return r.length===0?(console.warn("qti-max: no numeric values provided"),null):Math.max(...r)}#e(r){let e=[];for(let t of r){if(!t)continue;let i=n=>{if(n==null)return;let o=parseFloat(n.toString());if(Number.isNaN(o)){console.warn("qti-max: non-numeric value encountered");return}e.push(o)};if(Array.isArray(t.value)){t.value.forEach(n=>i(n));continue}i(t.value)}return e}};customElements.define("qti-max",Ks);var Zs=class extends R{getResult(){let r=this.getVariables();this.children.length!==2&&console.warn("The member operator takes two sub-expressions");let[e,t]=r;if(e.baseType===t.baseType||e.baseType==="integer"&&t.baseType==="float"||e.baseType==="float"&&t.baseType==="integer"||console.warn("Which must both have the same base-type"),t.cardinality==="multiple"||t.cardinality==="ordered"||console.warn("and the second must be a multiple or ordered container"),(e.baseType==="float"||t.baseType==="float")&&console.warn("The member operator should not be used on sub-expressions with a base-type of float"),(e.baseType==="duration"||t.baseType==="duration")&&console.warn("It must not be used on sub-expressions with a base-type of duration"),e.value===null||t.value===null)return null;let i=e.value;return t.value.includes(i)}};customElements.define("qti-member",Zs);var ea=class extends R{getResult(){let r=this.#e(this.getVariables());return r.length===0?(console.warn("qti-min: no numeric values provided"),null):Math.min(...r)}#e(r){let e=[];for(let t of r){if(!t)continue;let i=n=>{if(n==null)return;let o=parseFloat(n.toString());if(Number.isNaN(o)){console.warn("qti-min: non-numeric value encountered");return}e.push(o)};if(Array.isArray(t.value)){t.value.forEach(n=>i(n));continue}i(t.value)}return e}};customElements.define("qti-min",ea);var ta=class extends R{getResult(){console.debug("qti-multiple getResult called",this.innerHTML);let r=this.getVariables();if(r.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of r)if(e.cardinality!=="multiple"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti multiple"),[];return r}};customElements.define("qti-multiple",ta);var ra=class extends R{render(){return x`${super.render()}`}getResult(){return!this.firstElementChild.calculate()}};customElements.define("qti-not",ra);var ia=class extends be{getResult(){return Array.from(this.children).map(e=>{let t=e;if(!t.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let i=t.calculate(),n=!1;if(typeof i=="string")if(i==="true")n=!0;else if(i==="false")n=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof i=="boolean"&&(n=i);return n}).some(e=>typeof e=="boolean"&&e)}};customElements.define("qti-or",ia);var na=class extends R{getResult(){let r=this.getVariables();if(r.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of r)if(e.cardinality!=="ordered"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti ordered"),[];return r}};customElements.define("qti-ordered",na);var oa=class extends R{getResult(){if(this.children.length!==2)return console.error("qti-power must have exactly two child expressions"),null;let r=this.getVariables();if(!r||r.length!==2)return null;let[e,t]=r;if(e.cardinality!=="single"||t.cardinality!=="single")return console.error("qti-power requires single cardinality for both expressions"),null;if(Array.isArray(e.value)||Array.isArray(t.value))return console.error("qti-power unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0||t.value===null||t.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float"||t.baseType!=="integer"&&t.baseType!=="float")return console.error("qti-power requires numerical base-types"),null;let i=parseFloat(e.value),n=parseFloat(t.value);if(isNaN(i)||isNaN(n))return console.error("qti-power: non-numerical values encountered"),null;if(i===0&&n<=0||i<0&&!Number.isInteger(n))return null;let o;try{o=Math.pow(i,n)}catch(a){return console.error("qti-power: error calculating power:",a),null}if(isNaN(o))return null;if(o===1/0||o===-1/0)return o;if(!isFinite(o)||Math.abs(o)>Number.MAX_VALUE||o!==0&&Math.abs(o)<Number.MIN_VALUE)return null;if(isFinite(o)&&o!==0){let a=Math.floor(Math.log10(Math.abs(o))),l=Math.max(0,14-a),c=Math.pow(10,l);o=Math.round(o*c)/c}return o}};customElements.define("qti-power",oa);var Co=class extends R{constructor(){super(...arguments);this.pattern=""}getResult(){let e=this.getVariables();if(e.length!==1)return console.error("qti-pattern-match requires exactly one child expression"),null;if(!this.pattern)return console.error("qti-pattern-match requires a pattern attribute"),null;let t=e[0];if(t.cardinality!=="single"||Array.isArray(t.value))return console.error("qti-pattern-match requires single cardinality"),null;if(t.value===null||t.value===void 0)return null;try{return new RegExp(this.pattern).test(t.value.toString())}catch(i){return console.error("qti-pattern-match requires a valid regular expression",i),null}}};d([g({type:String})],Co.prototype,"pattern",2);customElements.define("qti-pattern-match",Co);var Ji=class extends E{render(){let r=this.context?.variables.find(e=>e.identifier===this.identifier)?.value;return r===null?O:x`${JSON.stringify(r,null,2)}`}calculate(){return this.context.variables.find(e=>e.identifier===this.identifier)||null}};d([g({type:String})],Ji.prototype,"identifier",2),d([$({context:W,subscribe:!0}),M()],Ji.prototype,"context",2);customElements.define("qti-printed-variable",Ji);var sa=class extends R{getResult(){return this.getVariables().reduce((t,i)=>{if(i.baseType=="float"||i.baseType=="integer")try{return t*parseFloat(i.value.toString())}catch{console.warn("can not convert to number")}else console.warn(`has another baseType ${i.baseType}`);return t},1)}};customElements.define("qti-product",sa);var So=class extends R{constructor(){super(...arguments);this.numberRepeats=""}getResult(){let e=this.#e();if(e<=0)return[];let t=this.firstElementChild;if(!t)return console.warn("qti-repeat: missing child expression"),[];let i=[];for(let n=0;n<e;n++){let o=t.calculate(),a=this.#t(o);a&&i.push(a)}return i}#e(){if(!this.numberRepeats)return console.warn("qti-repeat: missing number-repeats attribute"),0;let e=parseInt(this.numberRepeats,10);if(!Number.isNaN(e))return e;let t=this.numberRepeats,i=this.context?.variables?.find(a=>a.identifier===t);if(!i)return console.warn(`qti-repeat: unknown identifier "${t}"`),0;let n=Array.isArray(i.value)?i.value[0]:i.value,o=parseInt(n?.toString()??"",10);return Number.isNaN(o)?(console.warn(`qti-repeat: invalid repeat count from "${t}"`),0):o}#t(e){if(e==null)return null;if(typeof e=="number")return{identifier:"",cardinality:"single",baseType:Number.isInteger(e)?"integer":"float",value:e.toString(),type:"response"};if(typeof e=="string"){let t=parseFloat(e);if(!Number.isNaN(t))return{identifier:"",cardinality:"single",baseType:Number.isInteger(t)?"integer":"float",value:e.toString(),type:"response"}}if(e&&typeof e=="object"&&"value"in e){let t=e.value;return{identifier:"",cardinality:"single",baseType:e.baseType??"string",value:t!=null?t.toString():null,type:"response"}}return{identifier:"",cardinality:"single",baseType:"string",value:e.toString(),type:"response"}}};d([g({type:String,attribute:"number-repeats"})],So.prototype,"numberRepeats",2);customElements.define("qti-repeat",So);var aa=class extends ae{process(){let r=this.getAttribute("identifier");if(!r){console.warn('QtiSetCorrectResponse: Missing "identifier" attribute.');return}let e=this.firstElementChild;if(!e){console.warn("QtiSetCorrectResponse: No expression found.");return}let i=new la(e).process();this.dispatchEvent(new CustomEvent("qti-set-correct-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:r,value:this.#e(i)}}))}#e(r){return r==null?null:Array.isArray(r)?r.map(e=>we(this.#t(e))):we(this.#t(r))}#t(r){if(r&&typeof r=="object"&&"value"in r){let e=r.value;return e!=null?e.toString():""}return r?.toString()??""}},la=class{constructor(r){this.expression=r}process(){let r=this.expression.calculate()??null;return r===null&&console.warn("QtiSetCorrectResponseRule: Evaluated value is null."),Array.isArray(r)?r.map(e=>this.#e(e)):this.#e(r)}#e(r){return r&&typeof r=="object"&&"value"in r?r.value:r}};customElements.define("qti-set-correct-response",aa);var ca=class extends ae{process(){let r=this.getAttribute("identifier");if(!r){console.warn('QtiSetTemplateValue: Missing "identifier" attribute.');return}let e=this.firstElementChild;if(!e){console.warn("QtiSetTemplateValue: No expression found.");return}let i=new da(e).process();this.dispatchEvent(new CustomEvent("qti-set-template-value",{bubbles:!0,composed:!0,detail:{templateIdentifier:r,value:this.#e(i)}}))}#e(r){return r==null?null:Array.isArray(r)?r.map(e=>we(this.#t(e))):we(this.#t(r))}#t(r){if(r&&typeof r=="object"&&"value"in r){let e=r.value;return e!=null?e.toString():""}return r?.toString()??""}},da=class{constructor(r){this.expression=r}process(){let r=this.expression.calculate()??null;return r===null&&console.warn("QtiSetTemplateValueRule: Evaluated value is null."),Array.isArray(r)?r.map(e=>this.#e(e)):this.#e(r)}#e(r){return r&&typeof r=="object"&&"value"in r?r.value:r}};customElements.define("qti-set-template-value",ca);var Ao=class extends R{constructor(){super(...arguments);this.name=""}getResult(){if(!this.name)return console.warn("qti-stats-operator: missing name attribute"),null;let e=this.#t(this.getVariables());if(e.length===0)return console.warn("qti-stats-operator: no numeric values provided"),null;switch(this.name.toLowerCase()){case"mean":return e.reduce((t,i)=>t+i,0)/e.length;case"popsd":return this.#e(e);default:return console.warn(`qti-stats-operator: unsupported operator "${this.name}"`),null}}#e(e){let t=e.reduce((n,o)=>n+o,0)/e.length,i=e.reduce((n,o)=>n+Math.pow(o-t,2),0)/e.length;return Math.sqrt(i)}#t(e){let t=[];for(let i of e){if(!i)continue;let n=o=>{if(o==null)return;let a=parseFloat(o.toString());if(Number.isNaN(a)){console.warn("qti-stats-operator: non-numeric value encountered");return}t.push(a)};if(Array.isArray(i.value)){i.value.forEach(o=>n(o));continue}n(i.value)}return t}};d([g({type:String})],Ao.prototype,"name",2);customElements.define("qti-stats-operator",Ao);var To=class extends Op(R){getResult(){return this.calculateChildren(Array.from(this.children))}};function Op(s){return class extends s{calculateChildren(e){let t=e.map(i=>{if(!i.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let n=i.calculate();return Number.isNaN(n)?(console.error("Unexpected value in qti-subtract, expected number"),null):Number(n)});return t.some(i=>i===null)?(console.error("One or more child expressions returned invalid values"),0):t[0]-t[1]}}}customElements.define("qti-subtract",To);var Io=class extends R{constructor(){super(...arguments);this.caseSensitive="true"}getResult(){let e=this.getVariables();if(e.length!==2)return console.error("qti-substring requires exactly 2 child expressions"),null;let[t,i]=e;if(t.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(t.value)||Array.isArray(i.value))return console.error("qti-substring requires single cardinality"),null;if(t.value===null||i.value===null||t.value===void 0||i.value===void 0)return null;let n=t.value.toString(),o=i.value.toString();return this.caseSensitive!=="true"?o.toLowerCase().includes(n.toLowerCase()):o.includes(n)}};d([g({type:String,attribute:"case-sensitive"})],Io.prototype,"caseSensitive",2);customElements.define("qti-substring",Io);var Ro=class extends R{constructor(){super(...arguments);this.caseSensitive="true"}getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],i=e[1];if(t.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(t.value)||Array.isArray(i.value))return console.error("unexpected cardinality in qti string-match"),!1;let n=this.caseSensitive==="true"?t.value:t.value.toLowerCase(),o=this.caseSensitive==="true"?i.value:i.value.toLowerCase();return J.compareSingleValues(n,o,t.baseType)}return console.error("unexpected number of children in qti-string-match"),null}};d([g({type:String,attribute:"case-sensitive"})],Ro.prototype,"caseSensitive",2);customElements.define("qti-string-match",Ro);var pa=class extends R{getResult(){return new ua(Array.from(this.children)).calculate()}},ua=class{constructor(r){this.expressions=r}calculate(){return this.expressions.filter(t=>t.calculate!==void 0).some(t=>t.calculate()===null)?null:this.expressions.map(t=>{let i=t.calculate();return Number.isNaN(i)?(console.error("unexpected value in qti-sum, expected number"),null):Number(i)}).reduce((t,i)=>t+i,0)}};customElements.define("qti-sum",pa);var ma=class extends R{getResult(){let r=this.getVariables();if(r.length!==1)return console.error("qti-truncate requires exactly one child expression"),null;let e=r[0];if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-truncate requires single cardinality"),null;if(e.baseType!=="integer"&&e.baseType!=="float")return console.error("qti-truncate requires numerical base-type"),null;if(e.value===null||e.value===void 0)return null;let t=Number.parseFloat(e.value);return Number.isNaN(t)?(console.error("qti-truncate requires a numerical value"),null):Math.trunc(t)}};customElements.define("qti-truncate",ma);var ha=class extends R{getResult(){let r=this.getAttribute("identifier");return this.context.variables.find(t=>t.identifier===r).value}};customElements.define("qti-variable",ha);var kr=class extends R{constructor(){super(...arguments);this.min=0;this.max=10;this.step=1}getResult(){if(this.min>this.max)return console.error("qti-random-integer: min cannot be greater than max"),this.min;if(this.step<=0)return console.error("qti-random-integer: step must be positive"),this.min;let e=[],t=0;for(;;){let n=this.min+this.step*t;if(n>this.max)break;Number.isInteger(n)&&e.push(n),t++}if(e.length===0)return console.warn("qti-random-integer: no valid integer values in range"),Number.isInteger(this.min)?this.min:Math.floor(this.min);let i=Math.floor(Math.random()*e.length);return e[i]}getPossibleValues(){let e=[];if(this.min>this.max||this.step<=0)return[Number.isInteger(this.min)?this.min:Math.floor(this.min)];let t=0;for(;;){let i=this.min+this.step*t;if(i>this.max)break;Number.isInteger(i)&&e.push(i),t++}return e.length>0?e:[Number.isInteger(this.min)?this.min:Math.floor(this.min)]}};d([g({type:Number})],kr.prototype,"min",2),d([g({type:Number})],kr.prototype,"max",2),d([g({type:Number})],kr.prototype,"step",2);customElements.define("qti-random-integer",kr);var fa=class extends R{getResult(){let r=this.getVariables();if(r.length===1){let e=r[0].value;if(Array.isArray(e)){let t=Math.floor(Math.random()*e.length);return e[t]}return e}return console.error("unexpected number of children in match"),null}};customElements.define("qti-random",fa);var ga=class extends R{getResult(){if(this.children.length===2){let r=this.getVariables(),e=r[0],t=r[1];return e.cardinality!=="single"||!Array.isArray(t.value)?(console.error("unexpected cardinality in qti equal"),null):r[0].baseType!==r[1].baseType?(console.error("The baseType of the two variables is different"),null):t.value.filter(n=>!e.value.includes(n))}return null}};customElements.define("qti-delete",ga);var ko,Ed,Ki=class extends R{constructor(){super(...arguments);L(this,ko)}getResult(){if(!this.n)return console.error('qti-index: missing required attribute "n"'),null;if(this.children.length!==1)return console.error("qti-index: must have exactly one child container element"),null;let e=this.getVariables()[0];if(!e)return console.error("qti-index: missing container"),null;let t;if(!isNaN(Number(this.n)))t=Number(this.n);else{let i=P(this,ko,Ed).call(this,this.n);if(i===null)return console.error(`qti-index: variable "${this.n}" is not a valid number`),null;t=Number(i)}if(t<=0||!Number.isInteger(t))return console.error("qti-index: index must be a positive integer"),null;if(e.cardinality==="ordered"){let i=Array.isArray(e.value)?e.value:[e.value];return e.value===null||t>i.length?null:i[t-1]}else return console.error("qti-index: child must have ordered cardinality"),null}};ko=new WeakSet,Ed=function(e){let t=this.context.variables.find(i=>i.identifier===e)?.value;return t===null||isNaN(Number(t))?null:Number(t)},d([g({type:String})],Ki.prototype,"n",2),Ki=d([k("qti-index")],Ki);export{ll as Correctness,Yo as INITIAL_SESSION_CONTEXT,Jo as INITIAL_TEST_CONTEXT,V as Interaction,Zo as IsNullOrUndefined,Qe as ItemContainer,zt as ItemCorrectResponseMode,Cr as ItemPrintVariables,Ce as ItemShowCandidateCorrection,Se as ItemShowCorrectResponse,bo as QtiAnd,Xi as QtiAnyN,pe as QtiAssessmentItem,Be as QtiAssessmentItemRef,ze as QtiAssessmentSection,dr as QtiAssessmentStimulusRef,is as QtiAssessmentStimulusRefConnectedEvent,_t as QtiAssessmentTest,Jn as QtiAssociableHotspot,Ui as QtiAssociateInteraction,vo as QtiBaseValue,Bi as QtiChoiceInteraction,yn as QtiCompanionMaterialsInfo,be as QtiConditionExpression,_s as QtiContainerSize,Ls as QtiContains,ai as QtiContentBody,$t as QtiContextDeclaration,$s as QtiCorrect,Ye as QtiCustomInteraction,ri as QtiCustomOperator,Rr as QtiDefault,ga as QtiDelete,Vs as QtiDivide,Ds as QtiDurationGte,Ns as QtiDurationLt,yt as QtiEndAttemptInteraction,xo as QtiEqual,yo as QtiEqualRounded,R as QtiExpression,fe as QtiExtendedTextInteraction,de as QtiFeedback,ni as QtiFeedbackBlock,oi as QtiFeedbackInline,Xs as QtiFieldValue,Vi as QtiGap,Di as QtiGapImg,ao as QtiGapMatchInteraction,Ni as QtiGapText,Os as QtiGcd,Je as QtiGraphicAssociateInteraction,lo as QtiGraphicGapMatchInteraction,co as QtiGraphicOrderInteraction,Hs as QtiGt,Fs as QtiGte,Ar as QtiHotspotChoice,po as QtiHotspotInteraction,Kn as QtiHottext,zi as QtiHottextInteraction,Ki as QtiIndex,Oi as QtiInlineChoice,qt as QtiInlineChoiceInteraction,Yi as QtiInside,Us as QtiIntegerDivide,Bs as QtiIntegerModulus,zs as QtiIntegerToFloat,Gs as QtiIsNull,Sr as QtiItem,si as QtiItemBody,js as QtiLcm,ji as QtiLookupOutcomeValue,Qs as QtiLt,Ys as QtiLte,qo as QtiMapResponse,wo as QtiMapResponsePoint,Js as QtiMatch,wt as QtiMatchInteraction,Eo as QtiMathOperator,Ks as QtiMax,uo as QtiMediaInteraction,Zs as QtiMember,ea as QtiMin,Lt as QtiModalFeedback,ta as QtiMultiple,ra as QtiNot,Ws as QtiNull,ia as QtiOr,Et as QtiOrderInteraction,na as QtiOrdered,Pe as QtiOutcomeDeclaration,Co as QtiPatternMatch,K as QtiPortableCustomInteraction,ho as QtiPositionObjectInteraction,fo as QtiPositionObjectStage,oa as QtiPower,Ji as QtiPrintedVariable,sa as QtiProduct,Zn as QtiPrompt,fa as QtiRandom,kr as QtiRandomInteger,So as QtiRepeat,Is as QtiResponseCondition,We as QtiResponseDeclaration,Wi as QtiResponseElse,Ms as QtiResponseElseIf,Gi as QtiResponseIf,ci as QtiResponseProcessing,Ps as QtiRound,Qi as QtiRoundTo,$e as QtiRubricBlock,cl as QtiRuleElement,Ke as QtiSelectPointInteraction,aa as QtiSetCorrectResponse,la as QtiSetCorrectResponseRule,Rs as QtiSetOutcomeValue,ks as QtiSetOutcomeValueRule,ca as QtiSetTemplateValue,da as QtiSetTemplateValueRule,jt as QtiSimpleAssociableChoice,mt as QtiSimpleChoice,Ct as QtiSliderInteraction,Ao as QtiStatsOperator,Ro as QtiStringMatch,qn as QtiStylesheet,Io as QtiSubstring,To as QtiSubtract,pa as QtiSum,ua as QtiSumExpression,Cn as QtiTemplateConstraint,Ve as QtiTemplateDeclaration,di as QtiTemplateProcessing,vn as QtiTest,pi as QtiTestFeedback,je as QtiTestPart,Ie as QtiTextEntryInteraction,ma as QtiTruncate,go as QtiUploadInteraction,ha as QtiVariable,sr as QtiVariableDeclaration,J as ScoringHelper,ki as TestCheckItem,Xe as TestContainer,mi as TestEndAttempt,mr as TestItemLink,ye as TestNavigation,pt as TestNext,Ei as TestPagingButtonsStamp,ut as TestPrev,Ii as TestPrintContext,gr as TestPrintVariables,Bt as TestScoringButtons,vr as TestScoringFeedback,Ai as TestSectionButtonsStamp,br as TestSectionLink,Ee as TestShowCorrectResponse,Ut as TestStamp,oe as TestView,Ri as TestViewToggle,G as computedContext,rt as computedItemContext,ge as configContext,we as convertNumberToUniversalFormat,Xd as decimalSeparator,gM as getItemByUri,fM as getManifestInfo,W as itemContext,el as itemContextVariables,Np as qtiAndMixin,ir as qtiContext,Op as qtiSubtractMixin,Me as qtiTransformItem,Ja as qtiTransformManifest,er as qtiTransformTest,bn as removeDoubleSlashes,it as sessionContext,_e as testContext};
6160
+ `}async#r(r){let e=r.target;e.files&&e.files.length>0&&(this.#e=e.files[0],this.#t=await this.#i(this.#e),this.saveResponse(this.#t),this.dispatchEvent(new CustomEvent("qti-interaction-response",{detail:{response:this.#t}})))}#i(r){return new Promise((e,t)=>{let i=new FileReader;i.onload=()=>e(i.result),i.onerror=()=>t(i.error),i.readAsDataURL(r)})}};customElements.define("qti-upload-interaction",xo);var p_=async o=>{let r=o.substring(0,o.lastIndexOf("/")),e=await gl().load(`${o}`).then(a=>a.assessmentTest()),t=await lr().load(`${r}/${e.href}`).then(a=>a.htmlDoc()),i=await lr().load(`${r}/${e.href}`).then(a=>a.items()),n=`${r}/${e.href}`,s=`${r}/${e.href.substring(0,e.href.lastIndexOf("/"))}`;return{testHTMLDoc:t,testURI:s,testURL:n,items:i,testIdentifier:e.identifier}},u_=async o=>Le().load(o).then(r=>r.htmlDoc().firstElementChild);var ce=class extends E{render(){return x`<slot></slot>`}process(){throw new Error("Not implemented")}};ce=d([R("qti-rule")],ce);var Xi=class extends ce{get childExpression(){return this.firstElementChild}process(){let r=this.getAttribute("identifier"),e=this.context.variables.find(i=>i.identifier===r)||null,t;return e.interpolationTable&&(t=e.interpolationTable.get(parseFloat(this.childExpression.calculate()))),t==null?(console.warn("lookupOutcomeValue: value is null or undefined"),0):(this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:this.identifier,value:Ee(t)}})),t)}};d([g({type:String})],Xi.prototype,"identifier",2),d([$({context:W,subscribe:!0}),k()],Xi.prototype,"context",2);customElements.define("qti-lookup-outcome-value",Xi);var Vs=class extends ce{render(){return x`<slot></slot>`}process(){let r=[...this.children];for(let e=0;e<r.length;e++){let t=r[e];if(t.calculate()){t.process();return}}}};customElements.define("qti-response-condition",Vs);var Ds=class extends ce{process(){let r=this.getAttribute("identifier");if(!r){console.warn('QtiSetOutcomeValue: Missing "identifier" attribute.');return}let e=this.firstElementChild;if(!e){console.warn("QtiSetOutcomeValue: No expression found.");return}let i=new Ns(e).process();this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:r,value:this.#e(i)}}))}#e(r){return Array.isArray(r)?r.map(Ee):r!==null?Ee(r):null}},Ns=class{constructor(r){this.expression=r}process(){let r=this.expression.calculate()??null;return r===null&&console.warn("QtiSetOutcomeValueRule: Evaluated value is null."),Array.isArray(r)?r.map(e=>e.value?e.value:e):r}};customElements.define("qti-set-outcome-value",Ds);var Qi=class extends E{render(){return x`<slot></slot>`}calculate(){return!0}getSubRules(){return[...this.children]}process(){let r=this.getSubRules();for(let e=0;e<r.length;e++)r[e].process()}};customElements.define("qti-response-else",Qi);var Yi=class extends Qi{calculate(){return this.firstElementChild.calculate()}getSubRules(){let r=[];for(let e=1;e<this.children.length;e++)r.push(this.children[e]);return r}};customElements.define("qti-response-if",Yi);var Os=class extends Yi{render(){return x`${super.render()}`}};customElements.define("qti-response-else-if",Os);var qo=class extends nu(ve){calculate(){return this.calculateChildren(Array.from(this.children))}};qo=d([R("qti-and")],qo);function nu(o){return class extends o{calculateChildren(e){return e.map(i=>{let n=i;if(!n.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let s=n.calculate(),a=!1;if(typeof s=="string")if(s==="true")a=!0;else if(s==="false")a=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof s=="boolean"&&(a=s);return a}).every(i=>typeof i=="boolean"&&i)}}}var Ji=class extends I{constructor(){super(...arguments);this.min=0;this.max=1/0}getResult(){let e=this.getVariables();if(!e||e.length===0)return console.error("qti-any-n requires at least one child expression"),null;if(this.min<0||this.max<this.min)return console.error("qti-any-n requires 0 <= min <= max"),null;let t=0;for(let i of e){if(i.cardinality!=="single"||Array.isArray(i.value))return console.error("qti-any-n requires single cardinality boolean expressions"),null;if(i.baseType!=="boolean")return console.error("qti-any-n requires boolean base-type"),null;if(i.value===null||i.value===void 0)return null;i.value==="true"&&t++}return t>=this.min&&t<=this.max}};d([g({type:Number})],Ji.prototype,"min",2),d([g({type:Number})],Ji.prototype,"max",2);customElements.define("qti-any-n",Ji);var wo=class extends I{constructor(){super(...arguments);this.baseType="string"}getResult(){return this.textContent.trim()}};d([g({type:String,attribute:"base-type"})],wo.prototype,"baseType",2);customElements.define("qti-base-value",wo);var Hs=class extends I{getResult(){if(this.children?.length!==1)return console.error("qti-container-size must have exactly one child expression"),0;let r=this.getVariables();if(!r||r?.length===0)return 0;let e=r[0];return e.value===null||e.value===void 0?0:e.cardinality!=="multiple"&&e.cardinality!=="ordered"?(console.error("qti-container-size requires multiple or ordered cardinality"),0):Array.isArray(e.value)?e.value.length:(console.error("qti-container-size: expected array value for multiple/ordered cardinality"),0)}};customElements.define("qti-container-size",Hs);var Fs=class extends ve{getResult(){let r=this.getVariables();if(this.children.length===2){let e=r[0],t=r[1];if(e.baseType==="directedPair"&&t.baseType==="directedPair"&&e.cardinality==="multiple"){let i=e.value,n=t.value;return i.filter(l=>n.includes(l)).length>0}else if(e.baseType==="directedPair"&&t.baseType==="directedPair"&&e.cardinality==="single"){let i=e.value;return t.value.includes(i)}else console.error("unsupported baseType or cardinality in qti contains, only baseType: directedPair and cardinality: multiple is supported")}else console.error("unexpected number of children in qti contains");return!1}};customElements.define("qti-contains",Fs);var Us=class extends I{get interpretation(){return this.getAttribute("interpretation")||""}getResult(){let r=this.getAttribute("identifier")||"",e=this.context.variables.find(t=>t.identifier===r)||null;return e.cardinality!=="single"?e.correctResponse.length>0?e.correctResponse[0]:"":e.correctResponse}};customElements.define("qti-correct",Us);var kr=class extends I{constructor(){super(...arguments);this.identifier=""}getResult(){if(!this.identifier)return console.error("qti-default requires an identifier attribute"),null;let e=this.identifier.split("."),t=null,i;if(e.length===2)t=e[0],i=e[1];else if(e.length===1)i=e[0];else return console.error("qti-default: invalid identifier format"),null;if(t){let s=this._testContext.items.find(l=>l.identifier===t);if(console.debug(`itemContext: ${JSON.stringify(s)}`),!this._testContext||!s)return console.warn(`qti-default: item "${t}" not found in test context`),null;let a=this._testContext.items.find(l=>l.identifier===t)?.variables.find(l=>l.identifier===i);return a?a.defaultValue||null:(console.warn(`qti-default: variable "${i}" not found in item "${t}"`),null)}if(!this.context?.variables)return console.warn("qti-default: no variables found in item context"),null;let n=this.context.variables.find(s=>s.identifier===i);return n?n.defaultValue||null:(console.warn(`qti-default: variable "${i}" not found in item context`),null)}};d([g({type:String})],kr.prototype,"identifier",2),d([$({context:W,subscribe:!0}),k()],kr.prototype,"context",2),d([k(),$({context:_e,subscribe:!0})],kr.prototype,"_testContext",2);customElements.define("qti-default",kr);var Eo=class extends I{constructor(){super(...arguments);this.roundingMode="significantFigures"}get figures(){if(!this.getAttribute("figures"))return console.error("figures attribute is missing"),null;let t=parseInt(this.getAttribute("figures")||"0");return isNaN(t)?(console.error("figures attribute is not a number"),null):t<0?(console.error("figures attribute is negative"),null):t<1&&this.roundingMode==="significantFigures"?(console.error("figures cannot be smaller than 1 for RoundingMode significantFigures"),null):t}getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],i=e[1];if(this.roundingMode===null)return null;if(t.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(t.value)||Array.isArray(i.value))return console.error("unexpected cardinality in qti equal"),!1;switch(e[0].baseType){case"integer":case"float":{let n=parseFloat(t.value),s=parseFloat(i.value);if(!isNaN(n)&&!isNaN(s))return this.roundingMode==="significantFigures"?n.toPrecision(this.figures)===s.toPrecision(this.figures):Math.round(n*Math.pow(10,this.figures))/Math.pow(10,this.figures)===Math.round(s*Math.pow(10,this.figures))/Math.pow(10,this.figures);console.error(`value cannot be casted to numeric value in equalRounded operator: ${n}, ${s}`);break}default:{console.error("values other than float and int cannot be used in equalRounded operator.");break}}return!1}return console.error("unexpected number of children in qti-equal-rounded"),null}};d([g({type:String})],Eo.prototype,"roundingMode",2);customElements.define("qti-equal-rounded",Eo);var Bs=class extends I{getResult(){if(this.children.length!==1)return console.error("qti-round must have exactly one child expression"),null;let r=this.getVariables();if(!r||r.length===0)return null;let e=r[0];if(e.cardinality!=="single")return console.error("qti-round requires single cardinality"),null;if(Array.isArray(e.value))return console.error("qti-round unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float")return console.error("qti-round requires numerical base-type (integer or float)"),null;let t=parseFloat(e.value);return isNaN(t)?(console.warn("qti-round: NaN input results in NULL"),null):isFinite(t)?Math.floor(t+.5):t===1/0?1/0:t===-1/0?-1/0:null}};customElements.define("qti-round",Bs);var Ki=class extends I{constructor(){super(...arguments);this.roundingMode="significantFigures";this.figures=3}getResult(){if(this.children.length!==1)return console.error("qti-round-to must have exactly one child expression"),null;let e=this.getVariables();if(!e||e.length===0)return null;let t=e[0];if(t.cardinality!=="single")return console.error("qti-round-to requires single cardinality"),null;if(Array.isArray(t.value))return console.error("qti-round-to unexpected array value for single cardinality"),null;if(t.value===null||t.value===void 0)return null;if(t.baseType!=="integer"&&t.baseType!=="float")return console.error("qti-round-to requires numerical base-type"),null;let i=parseFloat(t.value);return isNaN(i)?null:isFinite(i)?this.figures<0?(console.error("qti-round-to: figures must be non-negative"),null):this.roundingMode==="significantFigures"&&this.figures<1?(console.error("qti-round-to: figures must be at least 1 for significantFigures mode"),null):this.roundingMode==="decimalPlaces"?this.#e(i,this.figures):this.#t(i,this.figures):i===1/0?1/0:i===-1/0?-1/0:null}#e(e,t){if(e===0)return 0;let i=Math.pow(10,t);return Math.round(e*i)/i}#t(e,t){if(e===0)return 0;let i=Math.floor(Math.log10(Math.abs(e))),n=Math.pow(10,t-i-1);return Math.round(e*n)/n}};d([g({type:String,attribute:"rounding-mode"})],Ki.prototype,"roundingMode",2),d([g({type:Number})],Ki.prototype,"figures",2);customElements.define("qti-round-to",Ki);var Co=class extends I{constructor(){super(...arguments);this.toleranceMode="exact"}getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],i=e[1];return!t||!i?null:this.toleranceMode!=="exact"?(console.error("toleranceMode is not supported yet"),!1):t.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(t.value)||Array.isArray(i.value)?(console.error("unexpected cardinality in qti equal"),!1):t.value===null||i.value===null||t.value===void 0||i.value===void 0?null:J.compareSingleValues(t.value,i.value,t.baseType)}return console.error("unexpected number of children in qti-equal"),null}};d([g({type:String})],Co.prototype,"toleranceMode",2);customElements.define("qti-equal",Co);var zs=class extends I{getResult(){let r=this.#e(this.getVariables());return r.length!==2?(console.warn("qti-divide: expected exactly 2 numeric values"),null):r[1]===0?(console.warn("qti-divide: division by zero"),null):r[0]/r[1]}#e(r){let e=[];for(let t of r){if(!t)continue;let i=n=>{if(n==null)return;let s=parseFloat(n.toString());if(Number.isNaN(s)){console.warn("qti-divide: non-numeric value encountered");return}e.push(s)};if(Array.isArray(t.value)){t.value.forEach(n=>i(n));continue}i(t.value)}return e}};customElements.define("qti-divide",zs);var js=class extends I{getResult(){let r=this.#e();return r?r[0]>=r[1]:null}#e(){let r=this.getVariables();if(r.length!==2)return console.error("qti-duration-gte requires exactly 2 duration expressions"),null;let e=r.map(t=>this.#t(t));return e.some(t=>t===null)?null:e}#t(r){if(r.cardinality!=="single"||Array.isArray(r.value))return console.error("qti-duration-gte requires single cardinality"),null;if(r.baseType!=="duration")return console.error("qti-duration-gte requires duration base-type"),null;if(r.value===null||r.value===void 0)return null;let e=Number.parseFloat(r.value.toString());return Number.isNaN(e)?(console.error(`qti-duration-gte requires duration values expressed in seconds, got "${r.value.toString()}"`),null):e}};customElements.define("qti-duration-gte",js);var Ws=class extends I{getResult(){let r=this.#e();return r?r[0]<r[1]:null}#e(){let r=this.getVariables();if(r.length!==2)return console.error("qti-duration-lt requires exactly 2 duration expressions"),null;let e=r.map(t=>this.#t(t));return e.some(t=>t===null)?null:e}#t(r){if(r.cardinality!=="single"||Array.isArray(r.value))return console.error("qti-duration-lt requires single cardinality"),null;if(r.baseType!=="duration")return console.error("qti-duration-lt requires duration base-type"),null;if(r.value===null||r.value===void 0)return null;let e=Number.parseFloat(r.value.toString());return Number.isNaN(e)?(console.error(`qti-duration-lt requires duration values expressed in seconds, got "${r.value.toString()}"`),null):e}};customElements.define("qti-duration-lt",Ws);var Gs=class extends I{getResult(){if(this.children.length===0)return console.error("qti-gcd must have at least one child expression"),null;let r=this.getVariables();if(!r||r.length===0)return null;let e=[];for(let t of r){if(t.baseType!=="integer")return console.error("qti-gcd requires integer base-type"),null;if(t.value===null||t.value===void 0)return null;if(t.cardinality==="single"){if(Array.isArray(t.value))return console.error("qti-gcd unexpected array value for single cardinality"),null;let i=parseInt(t.value,10);if(isNaN(i))return console.error("qti-gcd non-numerical value"),null;e.push(i)}else if(t.cardinality==="multiple"||t.cardinality==="ordered"){if(!Array.isArray(t.value))return console.error("qti-gcd expected array value for multiple/ordered cardinality"),null;for(let i of t.value){if(i==null)return null;let n=parseInt(i,10);if(isNaN(n))return console.error("qti-gcd non-numerical value"),null;e.push(n)}}else return console.error("qti-gcd unsupported cardinality"),null}return e.length===0?null:this.#e(e)}#e(r){if(r.length===0)return 0;if(r.length===1)return Math.abs(r[0]);let e=Math.abs(r[0]);for(let t=1;t<r.length&&(e=this.#t(e,Math.abs(r[t])),e!==1);t++);return e}#t(r,e){if(r===0&&e===0)return 0;if(r===0)return e;if(e===0)return r;for(;e!==0;){let t=e;e=r%e,r=t}return r}};customElements.define("qti-gcd",Gs);var Xs=class extends I{getResult(){if(this.children.length===2){let r=this.getVariables(),e=r[0],t=r[1];if((e.baseType==="integer"||e.baseType==="float")&&(t.baseType==="integer"||t.baseType==="float"))return+e.value>+t.value;console.error("unexpected baseType or cardinality in qti gt")}return console.error("unexpected number of children in qt"),null}};customElements.define("qti-gt",Xs);var Qs=class extends ve{getResult(){if(this.children.length===2){let r=this.getVariables(),e=r[0],t=r[1];return(e.baseType==="integer"||e.baseType==="float")&&(t.baseType==="integer"||t.baseType==="float")?+e.value>=+t.value:(console.error("unexpected baseType or cardinality in qti gte"),null)}return console.log("unexpected number of children in qte"),null}};customElements.define("qti-gte",Qs);var Zi=class extends I{constructor(){super(...arguments);this.shape="";this.coords=""}getResult(){let e=this.getVariables();if(e.length!==1)return console.error("qti-inside requires exactly one point expression"),null;let t=e[0];if(t.cardinality!=="single"||Array.isArray(t.value))return console.error("qti-inside requires single cardinality"),null;if(t.value===null||t.value===void 0)return null;if(!this.shape||!this.coords)return console.error("qti-inside requires shape and coords attributes"),null;let i=this.#e(t.value.toString()),n=this.#t(this.coords);if(!i||n.length===0)return null;switch(this.shape.toLowerCase()){case"circle":return this.#r(i,n);case"rect":return this.#i(i,n);case"ellipse":return this.#n(i,n);case"poly":case"polygon":return this.#o(i,n);default:return console.error(`qti-inside does not support shape "${this.shape}"`),null}}#e(e){let t=e.split(/[,\s]+/).map(s=>s.trim()).filter(Boolean);if(t.length!==2)return console.error('qti-inside requires a point value formatted as "x y" or "x,y"'),null;let i=Number.parseFloat(t[0]),n=Number.parseFloat(t[1]);return Number.isNaN(i)||Number.isNaN(n)?(console.error("qti-inside requires numeric point coordinates"),null):{x:i,y:n}}#t(e){let t=e.split(",").map(i=>i.trim()).filter(Boolean).map(i=>Number.parseFloat(i));return t.some(i=>Number.isNaN(i))?(console.error("qti-inside requires numeric coords"),[]):t}#r(e,t){if(t.length!==3)return console.error("qti-inside circle requires x,y,r"),null;let[i,n,s]=t;return(e.x-i)**2+(e.y-n)**2<=s**2}#i(e,t){if(t.length!==4)return console.error("qti-inside rect requires left,top,right,bottom"),null;let[i,n,s,a]=t,l=Math.min(i,s),c=Math.max(i,s),p=Math.min(n,a),u=Math.max(n,a);return e.x>=l&&e.x<=c&&e.y>=p&&e.y<=u}#n(e,t){if(t.length!==4)return console.error("qti-inside ellipse requires centerX,centerY,radiusX,radiusY"),null;let[i,n,s,a]=t;return s===0||a===0?!1:(e.x-i)**2/s**2+(e.y-n)**2/a**2<=1}#o(e,t){if(t.length<6||t.length%2!==0)return console.error("qti-inside polygon requires at least 3 coordinate pairs"),null;let i=!1;for(let n=0,s=t.length-2;n<t.length;n+=2){let a=t[n],l=t[n+1],c=t[s],p=t[s+1];l>e.y!=p>e.y&&e.x<(c-a)*(e.y-l)/(p-l||Number.EPSILON)+a&&(i=!i),s=n}return i}};d([g({type:String})],Zi.prototype,"shape",2),d([g({type:String})],Zi.prototype,"coords",2);customElements.define("qti-inside",Zi);var Ys=class extends I{getResult(){let r=this.#e(this.getVariables());return r.length!==2?(console.error("qti-integer-divide requires exactly 2 integer values"),null):r[1]===0?(console.error("qti-integer-divide: division by zero"),null):Math.floor(r[0]/r[1])}#e(r){let e=[];for(let t of r){if(t.baseType!=="integer")return console.error("qti-integer-divide requires integer base-type"),[];if(t.cardinality!=="single"||Array.isArray(t.value))return console.error("qti-integer-divide requires single cardinality"),[];if(t.value===null||t.value===void 0)return[];let i=Number.parseInt(t.value,10);if(Number.isNaN(i))return console.error("qti-integer-divide requires integer values"),[];e.push(i)}return e}};customElements.define("qti-integer-divide",Ys);var Js=class extends I{getResult(){let r=this.#e(this.getVariables());return r.length!==2?(console.error("qti-integer-modulus requires exactly 2 integer values"),null):r[1]===0?(console.error("qti-integer-modulus: division by zero"),null):r[0]%r[1]}#e(r){let e=[];for(let t of r){if(t.baseType!=="integer")return console.error("qti-integer-modulus requires integer base-type"),[];if(t.cardinality!=="single"||Array.isArray(t.value))return console.error("qti-integer-modulus requires single cardinality"),[];if(t.value===null||t.value===void 0)return[];let i=Number.parseInt(t.value,10);if(Number.isNaN(i))return console.error("qti-integer-modulus requires integer values"),[];e.push(i)}return e}};customElements.define("qti-integer-modulus",Js);var Ks=class extends I{getResult(){let r=this.getVariables();if(r.length!==1)return console.error("qti-integer-to-float requires exactly one child expression"),null;let e=r[0];if(e.baseType!=="integer")return console.error("qti-integer-to-float requires integer base-type"),null;if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-integer-to-float requires single cardinality"),null;if(e.value===null||e.value===void 0)return null;let t=Number.parseInt(e.value,10);return Number.isNaN(t)?(console.error("qti-integer-to-float requires an integer value"),null):t}};customElements.define("qti-integer-to-float",Ks);var Zs=class extends I{getResult(){let r=this.#e(this.getVariables());return r.length===0?(console.error("qti-lcm requires at least one integer value"),null):r.reduce((e,t)=>this.#r(e,t))}#e(r){let e=[];for(let t of r){if(t.baseType!=="integer")return console.error("qti-lcm requires integer base-type"),[];if(t.value===null||t.value===void 0)return[];if(t.cardinality==="single"){if(Array.isArray(t.value))return console.error("qti-lcm unexpected array value for single cardinality"),[];let i=Number.parseInt(t.value,10);if(Number.isNaN(i))return console.error("qti-lcm requires integer values"),[];e.push(i);continue}if(t.cardinality!=="multiple"&&t.cardinality!=="ordered")return console.error("qti-lcm unsupported cardinality"),[];if(!Array.isArray(t.value))return console.error("qti-lcm expected array value for container cardinality"),[];for(let i of t.value){let n=Number.parseInt(i,10);if(Number.isNaN(n))return console.error("qti-lcm requires integer values"),[];e.push(n)}}return e}#t(r,e){let t=Math.abs(r),i=Math.abs(e);for(;i!==0;){let n=t%i;t=i,i=n}return t}#r(r,e){return r===0||e===0?0:Math.abs(r*e/this.#t(r,e))}};customElements.define("qti-lcm",Zs);var ea=class extends I{getResult(){return null}};customElements.define("qti-null",ea);var ta=class extends I{getResult(){if(this.children.length===1){let r=this.getVariables();if(!r)return!0;let e=r[0].value;return e==null||e==null||e===""}return console.error("unexpected number of children in qti Null"),null}};customElements.define("qti-is-null",ta);var ra=class extends I{getResult(){let r=this.getAttribute("field-identifier");if(!r)throw new Error("field-identifier attribute is required");if(Array.from(this.children).length!==1)throw new Error("qti-field-value must have exactly one child expression");let t=this.getVariables()[0];if(t.baseType!=="record"||t.value===null)throw new Error("qti-field-value child expression must return a record");let i=t.value[r];if(i===void 0)throw new Error(`Field "${r}" not found in record`);return i}};customElements.define("qti-field-value",ra);var ia=class extends I{getResult(){if(this.children.length===2){let r=this.getVariables(),e=r[0],t=r[1];if((e.baseType==="integer"||e.baseType==="float")&&(t.baseType==="integer"||t.baseType==="float"))return+e.value<+t.value;console.error("unexpected baseType or cardinality in qti lt")}return console.error("unexpected number of children in lt"),null}};customElements.define("qti-lt",ia);var na=class extends ve{getResult(){if(this.children.length===2){let r=this.getVariables(),e=r[0],t=r[1];return(e.baseType==="integer"||e.baseType==="float")&&(t.baseType==="integer"||t.baseType==="float")?+e.value<=+t.value:(console.error("unexpected baseType or cardinality in qti lte"),null)}return console.log("unexpected number of children in lte"),null}};customElements.define("qti-lte",na);var So=class extends I{getResult(){let r=this.context.variables.find(n=>n.identifier===this.identifier);if(!r||!r.mapping)return console.error(`Response ${this.identifier} can not be found`),null;let e=r.mapping,t=Array.isArray(r.value)?r.value:[r.value],i=0;for(let n of t){let s=e.mapEntries.filter(l=>r.baseType==="string"&&!l.caseSensitive?J.compareSingleValues(l.mapKey.toLowerCase(),n.toLowerCase(),r.baseType):J.compareSingleValues(l.mapKey,n,r.baseType)),a=s.reduce((l,c)=>l.mappedValue>c.mappedValue?l:c,s.length>0?s[0]:{mapKey:null,mappedValue:null});a===null||a.mappedValue==null?i+=e.defaultValue:i+=a.mappedValue}return e?.lowerBound!==null&&e?.lowerBound!==void 0&&(i=Math.max(e.lowerBound,i)),e?.upperBound!==null&&e?.upperBound!==void 0&&(i=Math.min(e.upperBound,i)),i}};d([g({type:String})],So.prototype,"identifier",2);customElements.define("qti-map-response",So);var Ao=class extends I{getResult(){let r=this.context.variables.find(s=>s.identifier===this.identifier);if(!r)return console.warn(`Response ${this.identifier} cannot be found`),null;let e=r.areaMapping;if(!e)return console.warn(`Area mapping not found for response ${this.identifier}`),null;let t=Array.isArray(r.value)?r.value:[r.value];if(!t||t.length===0)return console.warn(`No candidate responses for response ${this.identifier}`),null;let i=0,n=new Set;for(let s of t)for(let a of e.areaMapEntries){if(n.has(a.coords))continue;J.isPointInArea(s,`${a.shape},${a.coords}`,r.baseType)&&(i+=a.mappedValue??0,n.add(a.coords))}return n.size<t.length&&(i+=e.defaultValue),e.lowerBound!=null&&(i=Math.max(e.lowerBound,i)),e.upperBound!=null&&(i=Math.min(e.upperBound,i)),i}};d([g({type:String})],Ao.prototype,"identifier",2);customElements.define("qti-map-response-point",Ao);var To=class extends I{constructor(){super(...arguments);this.name=""}getResult(){if(!this.name)return console.error("qti-math-operator requires a name attribute"),null;let e=this.getVariables();if(!e||e.length===0)return null;let t=[];for(let i of e){if(i.cardinality!=="single")return console.error("qti-math-operator requires single cardinality"),null;if(Array.isArray(i.value))return console.error("qti-math-operator unexpected array value for single cardinality"),null;if(i.value===null||i.value===void 0)return null;if(i.baseType!=="integer"&&i.baseType!=="float")return console.error("qti-math-operator requires numerical base-type"),null;let n=parseFloat(i.value);if(isNaN(n))return console.error("qti-math-operator non-numerical value"),null;t.push(n)}return this.#e(this.name,t)}#e(e,t){try{switch(e.toLowerCase()){case"sin":return t.length!==1?null:Math.sin(t[0]);case"cos":return t.length!==1?null:Math.cos(t[0]);case"tan":return t.length!==1?null:Math.tan(t[0]);case"asin":return t.length!==1||t[0]<-1||t[0]>1?null:Math.asin(t[0]);case"acos":return t.length!==1||t[0]<-1||t[0]>1?null:Math.acos(t[0]);case"atan":return t.length!==1?null:Math.atan(t[0]);case"sinh":return t.length!==1?null:Math.sinh(t[0]);case"cosh":return t.length!==1?null:Math.cosh(t[0]);case"tanh":return t.length!==1?null:Math.tanh(t[0]);case"log":return t.length!==1||t[0]<=0?null:Math.log(t[0]);case"ln":return t.length!==1||t[0]<=0?null:Math.log(t[0]);case"log10":return t.length!==1||t[0]<=0?null:Math.log10(t[0]);case"exp":return t.length!==1?null:Math.exp(t[0]);case"abs":return t.length!==1?null:Math.abs(t[0]);case"sqrt":return t.length!==1||t[0]<0?null:Math.sqrt(t[0]);case"signum":return t.length!==1?null:Math.sign(t[0]);case"floor":return t.length!==1?null:Math.floor(t[0]);case"ceil":return t.length!==1?null:Math.ceil(t[0]);case"round":return t.length!==1?null:Math.round(t[0]);case"atan2":return t.length!==2?null:Math.atan2(t[0],t[1]);case"pow":{if(t.length!==2)return null;let i=t[0],n=t[1];return i===0&&n<=0||i<0&&!Number.isInteger(n)?null:Math.pow(i,n)}case"log_base":{if(t.length!==2)return null;let i=t[0],n=t[1];return i<=0||n<=0||n===1?null:Math.log(i)/Math.log(n)}case"mod":return t.length!==2||t[1]===0?null:t[0]%t[1];case"max":return t.length<1?null:Math.max(...t);case"min":return t.length<1?null:Math.min(...t);default:return console.error(`qti-math-operator: unknown operation "${e}"`),null}}catch(i){return console.error(`qti-math-operator: error performing operation "${e}":`,i),null}}};d([g({type:String})],To.prototype,"name",2);customElements.define("qti-math-operator",To);var oa=class o extends I{getResult(){if(this.children.length===2){let r=this.getVariables(),e=r[0],t=r[1];return o.match(e,t)}return console.error("unexpected number of children in match"),null}static match(r,e){if(r.value===null)return!1;switch(e.cardinality){case"single":return Array.isArray(r.value)||Array.isArray(e.value)?(console.error("unexpected cardinality in qti match"),!1):J.compareSingleValues(r.value?.toString(),e.value.toString(),e.baseType);case"ordered":{if(!Array.isArray(r.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(r.value.length!==e.value.length)return!1;for(let t=0;t<r.value.length;t++)if(!J.compareSingleValues(e.value[t],r.value[t],e.baseType))return!1;return!0}case"multiple":{if(!Array.isArray(r.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(r.value.length!==e.value.length)return!1;let t=0;for(let i of e.value){let n=null,s=[...r.value];for(let a of s)if(J.compareSingleValues(i,a,e.baseType)){n=a;break}if(n!==null)s.splice(s.indexOf(n),1);else return!1;t++}return!0}default:return console.error("unexpected cardinality in qti match"),!1}}};customElements.define("qti-match",oa);var sa=class extends I{getResult(){let r=this.#e(this.getVariables());return r.length===0?(console.warn("qti-max: no numeric values provided"),null):Math.max(...r)}#e(r){let e=[];for(let t of r){if(!t)continue;let i=n=>{if(n==null)return;let s=parseFloat(n.toString());if(Number.isNaN(s)){console.warn("qti-max: non-numeric value encountered");return}e.push(s)};if(Array.isArray(t.value)){t.value.forEach(n=>i(n));continue}i(t.value)}return e}};customElements.define("qti-max",sa);var aa=class extends I{getResult(){let r=this.getVariables();this.children.length!==2&&console.warn("The member operator takes two sub-expressions");let[e,t]=r;if(e.baseType===t.baseType||e.baseType==="integer"&&t.baseType==="float"||e.baseType==="float"&&t.baseType==="integer"||console.warn("Which must both have the same base-type"),t.cardinality==="multiple"||t.cardinality==="ordered"||console.warn("and the second must be a multiple or ordered container"),(e.baseType==="float"||t.baseType==="float")&&console.warn("The member operator should not be used on sub-expressions with a base-type of float"),(e.baseType==="duration"||t.baseType==="duration")&&console.warn("It must not be used on sub-expressions with a base-type of duration"),e.value===null||t.value===null)return null;let i=e.value;return t.value.includes(i)}};customElements.define("qti-member",aa);var la=class extends I{getResult(){let r=this.#e(this.getVariables());return r.length===0?(console.warn("qti-min: no numeric values provided"),null):Math.min(...r)}#e(r){let e=[];for(let t of r){if(!t)continue;let i=n=>{if(n==null)return;let s=parseFloat(n.toString());if(Number.isNaN(s)){console.warn("qti-min: non-numeric value encountered");return}e.push(s)};if(Array.isArray(t.value)){t.value.forEach(n=>i(n));continue}i(t.value)}return e}};customElements.define("qti-min",la);var ca=class extends I{getResult(){console.debug("qti-multiple getResult called",this.innerHTML);let r=this.getVariables();if(r.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of r)if(e.cardinality!=="multiple"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti multiple"),[];return r}};customElements.define("qti-multiple",ca);var da=class extends I{render(){return x`${super.render()}`}getResult(){return!this.firstElementChild.calculate()}};customElements.define("qti-not",da);var pa=class extends ve{getResult(){return Array.from(this.children).map(e=>{let t=e;if(!t.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let i=t.calculate(),n=!1;if(typeof i=="string")if(i==="true")n=!0;else if(i==="false")n=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof i=="boolean"&&(n=i);return n}).some(e=>typeof e=="boolean"&&e)}};customElements.define("qti-or",pa);var ua=class extends I{getResult(){let r=this.getVariables();if(r.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of r)if(e.cardinality!=="ordered"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti ordered"),[];return r}};customElements.define("qti-ordered",ua);var ma=class extends I{getResult(){if(this.children.length!==2)return console.error("qti-power must have exactly two child expressions"),null;let r=this.getVariables();if(!r||r.length!==2)return null;let[e,t]=r;if(e.cardinality!=="single"||t.cardinality!=="single")return console.error("qti-power requires single cardinality for both expressions"),null;if(Array.isArray(e.value)||Array.isArray(t.value))return console.error("qti-power unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0||t.value===null||t.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float"||t.baseType!=="integer"&&t.baseType!=="float")return console.error("qti-power requires numerical base-types"),null;let i=parseFloat(e.value),n=parseFloat(t.value);if(isNaN(i)||isNaN(n))return console.error("qti-power: non-numerical values encountered"),null;if(i===0&&n<=0||i<0&&!Number.isInteger(n))return null;let s;try{s=Math.pow(i,n)}catch(a){return console.error("qti-power: error calculating power:",a),null}if(isNaN(s))return null;if(s===1/0||s===-1/0)return s;if(!isFinite(s)||Math.abs(s)>Number.MAX_VALUE||s!==0&&Math.abs(s)<Number.MIN_VALUE)return null;if(isFinite(s)&&s!==0){let a=Math.floor(Math.log10(Math.abs(s))),l=Math.max(0,14-a),c=Math.pow(10,l);s=Math.round(s*c)/c}return s}};customElements.define("qti-power",ma);var Io=class extends I{constructor(){super(...arguments);this.pattern=""}getResult(){let e=this.getVariables();if(e.length!==1)return console.error("qti-pattern-match requires exactly one child expression"),null;if(!this.pattern)return console.error("qti-pattern-match requires a pattern attribute"),null;let t=e[0];if(t.cardinality!=="single"||Array.isArray(t.value))return console.error("qti-pattern-match requires single cardinality"),null;if(t.value===null||t.value===void 0)return null;try{return new RegExp(this.pattern).test(t.value.toString())}catch(i){return console.error("qti-pattern-match requires a valid regular expression",i),null}}};d([g({type:String})],Io.prototype,"pattern",2);customElements.define("qti-pattern-match",Io);var en=class extends E{render(){let r=this.context?.variables.find(e=>e.identifier===this.identifier)?.value;return r===null?O:x`${JSON.stringify(r,null,2)}`}calculate(){return this.context.variables.find(e=>e.identifier===this.identifier)||null}};d([g({type:String})],en.prototype,"identifier",2),d([$({context:W,subscribe:!0}),k()],en.prototype,"context",2);customElements.define("qti-printed-variable",en);var ha=class extends I{getResult(){return this.getVariables().reduce((t,i)=>{if(i.baseType=="float"||i.baseType=="integer")try{return t*parseFloat(i.value.toString())}catch{console.warn("can not convert to number")}else console.warn(`has another baseType ${i.baseType}`);return t},1)}};customElements.define("qti-product",ha);var Ro=class extends I{constructor(){super(...arguments);this.numberRepeats=""}getResult(){let e=this.#e();if(e<=0)return[];let t=this.firstElementChild;if(!t)return console.warn("qti-repeat: missing child expression"),[];let i=[];for(let n=0;n<e;n++){let s=t.calculate(),a=this.#t(s);a&&i.push(a)}return i}#e(){if(!this.numberRepeats)return console.warn("qti-repeat: missing number-repeats attribute"),0;let e=parseInt(this.numberRepeats,10);if(!Number.isNaN(e))return e;let t=this.numberRepeats,i=this.context?.variables?.find(a=>a.identifier===t);if(!i)return console.warn(`qti-repeat: unknown identifier "${t}"`),0;let n=Array.isArray(i.value)?i.value[0]:i.value,s=parseInt(n?.toString()??"",10);return Number.isNaN(s)?(console.warn(`qti-repeat: invalid repeat count from "${t}"`),0):s}#t(e){if(e==null)return null;if(typeof e=="number")return{identifier:"",cardinality:"single",baseType:Number.isInteger(e)?"integer":"float",value:e.toString(),type:"response"};if(typeof e=="string"){let t=parseFloat(e);if(!Number.isNaN(t))return{identifier:"",cardinality:"single",baseType:Number.isInteger(t)?"integer":"float",value:e.toString(),type:"response"}}if(e&&typeof e=="object"&&"value"in e){let t=e.value;return{identifier:"",cardinality:"single",baseType:e.baseType??"string",value:t!=null?t.toString():null,type:"response"}}return{identifier:"",cardinality:"single",baseType:"string",value:e.toString(),type:"response"}}};d([g({type:String,attribute:"number-repeats"})],Ro.prototype,"numberRepeats",2);customElements.define("qti-repeat",Ro);var fa=class extends ce{process(){let r=this.getAttribute("identifier");if(!r){console.warn('QtiSetCorrectResponse: Missing "identifier" attribute.');return}let e=this.firstElementChild;if(!e){console.warn("QtiSetCorrectResponse: No expression found.");return}let i=new ga(e).process();this.dispatchEvent(new CustomEvent("qti-set-correct-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:r,value:this.#e(i)}}))}#e(r){return r==null?null:Array.isArray(r)?r.map(e=>Ee(this.#t(e))):Ee(this.#t(r))}#t(r){if(r&&typeof r=="object"&&"value"in r){let e=r.value;return e!=null?e.toString():""}return r?.toString()??""}},ga=class{constructor(r){this.expression=r}process(){let r=this.expression.calculate()??null;return r===null&&console.warn("QtiSetCorrectResponseRule: Evaluated value is null."),Array.isArray(r)?r.map(e=>this.#e(e)):this.#e(r)}#e(r){return r&&typeof r=="object"&&"value"in r?r.value:r}};customElements.define("qti-set-correct-response",fa);var ba=class extends ce{process(){let r=this.getAttribute("identifier");if(!r){console.warn('QtiSetTemplateValue: Missing "identifier" attribute.');return}let e=this.firstElementChild;if(!e){console.warn("QtiSetTemplateValue: No expression found.");return}let i=new va(e).process();this.dispatchEvent(new CustomEvent("qti-set-template-value",{bubbles:!0,composed:!0,detail:{templateIdentifier:r,value:this.#e(i)}}))}#e(r){return r==null?null:Array.isArray(r)?r.map(e=>Ee(this.#t(e))):Ee(this.#t(r))}#t(r){if(r&&typeof r=="object"&&"value"in r){let e=r.value;return e!=null?e.toString():""}return r?.toString()??""}},va=class{constructor(r){this.expression=r}process(){let r=this.expression.calculate()??null;return r===null&&console.warn("QtiSetTemplateValueRule: Evaluated value is null."),Array.isArray(r)?r.map(e=>this.#e(e)):this.#e(r)}#e(r){return r&&typeof r=="object"&&"value"in r?r.value:r}};customElements.define("qti-set-template-value",ba);var ko=class extends I{constructor(){super(...arguments);this.name=""}getResult(){if(!this.name)return console.warn("qti-stats-operator: missing name attribute"),null;let e=this.#t(this.getVariables());if(e.length===0)return console.warn("qti-stats-operator: no numeric values provided"),null;switch(this.name.toLowerCase()){case"mean":return e.reduce((t,i)=>t+i,0)/e.length;case"popsd":return this.#e(e);default:return console.warn(`qti-stats-operator: unsupported operator "${this.name}"`),null}}#e(e){let t=e.reduce((n,s)=>n+s,0)/e.length,i=e.reduce((n,s)=>n+Math.pow(s-t,2),0)/e.length;return Math.sqrt(i)}#t(e){let t=[];for(let i of e){if(!i)continue;let n=s=>{if(s==null)return;let a=parseFloat(s.toString());if(Number.isNaN(a)){console.warn("qti-stats-operator: non-numeric value encountered");return}t.push(a)};if(Array.isArray(i.value)){i.value.forEach(s=>n(s));continue}n(i.value)}return t}};d([g({type:String})],ko.prototype,"name",2);customElements.define("qti-stats-operator",ko);var Mo=class extends ou(I){getResult(){return this.calculateChildren(Array.from(this.children))}};function ou(o){return class extends o{calculateChildren(e){let t=e.map(i=>{if(!i.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let n=i.calculate();return Number.isNaN(n)?(console.error("Unexpected value in qti-subtract, expected number"),null):Number(n)});return t.some(i=>i===null)?(console.error("One or more child expressions returned invalid values"),0):t[0]-t[1]}}}customElements.define("qti-subtract",Mo);var _o=class extends I{constructor(){super(...arguments);this.caseSensitive="true"}getResult(){let e=this.getVariables();if(e.length!==2)return console.error("qti-substring requires exactly 2 child expressions"),null;let[t,i]=e;if(t.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(t.value)||Array.isArray(i.value))return console.error("qti-substring requires single cardinality"),null;if(t.value===null||i.value===null||t.value===void 0||i.value===void 0)return null;let n=t.value.toString(),s=i.value.toString();return this.caseSensitive!=="true"?s.toLowerCase().includes(n.toLowerCase()):s.includes(n)}};d([g({type:String,attribute:"case-sensitive"})],_o.prototype,"caseSensitive",2);customElements.define("qti-substring",_o);var Lo=class extends I{constructor(){super(...arguments);this.caseSensitive="true"}getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],i=e[1];if(t.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(t.value)||Array.isArray(i.value))return console.error("unexpected cardinality in qti string-match"),!1;let n=this.caseSensitive==="true"?t.value:t.value.toLowerCase(),s=this.caseSensitive==="true"?i.value:i.value.toLowerCase();return J.compareSingleValues(n,s,t.baseType)}return console.error("unexpected number of children in qti-string-match"),null}};d([g({type:String,attribute:"case-sensitive"})],Lo.prototype,"caseSensitive",2);customElements.define("qti-string-match",Lo);var ya=class extends I{getResult(){return new xa(Array.from(this.children)).calculate()}},xa=class{constructor(r){this.expressions=r}calculate(){return this.expressions.filter(t=>t.calculate!==void 0).some(t=>t.calculate()===null)?null:this.expressions.map(t=>{let i=t.calculate();return Number.isNaN(i)?(console.error("unexpected value in qti-sum, expected number"),null):Number(i)}).reduce((t,i)=>t+i,0)}};customElements.define("qti-sum",ya);var qa=class extends I{getResult(){let r=this.getVariables();if(r.length!==1)return console.error("qti-truncate requires exactly one child expression"),null;let e=r[0];if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-truncate requires single cardinality"),null;if(e.baseType!=="integer"&&e.baseType!=="float")return console.error("qti-truncate requires numerical base-type"),null;if(e.value===null||e.value===void 0)return null;let t=Number.parseFloat(e.value);return Number.isNaN(t)?(console.error("qti-truncate requires a numerical value"),null):Math.trunc(t)}};customElements.define("qti-truncate",qa);var wa=class extends I{getResult(){let r=this.getAttribute("identifier");return this.context.variables.find(t=>t.identifier===r).value}};customElements.define("qti-variable",wa);var Mr=class extends I{constructor(){super(...arguments);this.min=0;this.max=10;this.step=1}getResult(){if(this.min>this.max)return console.error("qti-random-integer: min cannot be greater than max"),this.min;if(this.step<=0)return console.error("qti-random-integer: step must be positive"),this.min;let e=[],t=0;for(;;){let n=this.min+this.step*t;if(n>this.max)break;Number.isInteger(n)&&e.push(n),t++}if(e.length===0)return console.warn("qti-random-integer: no valid integer values in range"),Number.isInteger(this.min)?this.min:Math.floor(this.min);let i=Math.floor(Math.random()*e.length);return e[i]}getPossibleValues(){let e=[];if(this.min>this.max||this.step<=0)return[Number.isInteger(this.min)?this.min:Math.floor(this.min)];let t=0;for(;;){let i=this.min+this.step*t;if(i>this.max)break;Number.isInteger(i)&&e.push(i),t++}return e.length>0?e:[Number.isInteger(this.min)?this.min:Math.floor(this.min)]}};d([g({type:Number})],Mr.prototype,"min",2),d([g({type:Number})],Mr.prototype,"max",2),d([g({type:Number})],Mr.prototype,"step",2);customElements.define("qti-random-integer",Mr);var Ea=class extends I{getResult(){let r=this.getVariables();if(r.length===1){let e=r[0].value;if(Array.isArray(e)){let t=Math.floor(Math.random()*e.length);return e[t]}return e}return console.error("unexpected number of children in match"),null}};customElements.define("qti-random",Ea);var Ca=class extends I{getResult(){if(this.children.length===2){let r=this.getVariables(),e=r[0],t=r[1];return e.cardinality!=="single"||!Array.isArray(t.value)?(console.error("unexpected cardinality in qti equal"),null):r[0].baseType!==r[1].baseType?(console.error("The baseType of the two variables is different"),null):t.value.filter(n=>!e.value.includes(n))}return null}};customElements.define("qti-delete",Ca);var $o,Pd,tn=class extends I{constructor(){super(...arguments);L(this,$o)}getResult(){if(!this.n)return console.error('qti-index: missing required attribute "n"'),null;if(this.children.length!==1)return console.error("qti-index: must have exactly one child container element"),null;let e=this.getVariables()[0];if(!e)return console.error("qti-index: missing container"),null;let t;if(!isNaN(Number(this.n)))t=Number(this.n);else{let i=P(this,$o,Pd).call(this,this.n);if(i===null)return console.error(`qti-index: variable "${this.n}" is not a valid number`),null;t=Number(i)}if(t<=0||!Number.isInteger(t))return console.error("qti-index: index must be a positive integer"),null;if(e.cardinality==="ordered"){let i=Array.isArray(e.value)?e.value:[e.value];return e.value===null||t>i.length?null:i[t-1]}else return console.error("qti-index: child must have ordered cardinality"),null}};$o=new WeakSet,Pd=function(e){let t=this.context.variables.find(i=>i.identifier===e)?.value;return t===null||isNaN(Number(t))?null:Number(t)},d([g({type:String})],tn.prototype,"n",2),tn=d([R("qti-index")],tn);export{ol as Correctness,es as INITIAL_SESSION_CONTEXT,ts as INITIAL_TEST_CONTEXT,V as Interaction,is as IsNullOrUndefined,Fe as ItemContainer,jt as ItemCorrectResponseMode,Ar as ItemPrintVariables,Se as ItemShowCandidateCorrection,Ae as ItemShowCorrectResponse,qo as QtiAnd,Ji as QtiAnyN,ue as QtiAssessmentItem,We as QtiAssessmentItemRef,Ge as QtiAssessmentSection,ur as QtiAssessmentStimulusRef,ps as QtiAssessmentStimulusRefConnectedEvent,Lt as QtiAssessmentTest,to as QtiAssociableHotspot,ji as QtiAssociateInteraction,wo as QtiBaseValue,Wi as QtiChoiceInteraction,En as QtiCompanionMaterialsInfo,ve as QtiConditionExpression,Hs as QtiContainerSize,Fs as QtiContains,di as QtiContentBody,Pt as QtiContextDeclaration,Us as QtiCorrect,Je as QtiCustomInteraction,oi as QtiCustomOperator,kr as QtiDefault,Ca as QtiDelete,zs as QtiDivide,js as QtiDurationGte,Ws as QtiDurationLt,xt as QtiEndAttemptInteraction,Co as QtiEqual,Eo as QtiEqualRounded,I as QtiExpression,ge as QtiExtendedTextInteraction,pe as QtiFeedback,ai as QtiFeedbackBlock,li as QtiFeedbackInline,ra as QtiFieldValue,Oi as QtiGap,Hi as QtiGapImg,uo as QtiGapMatchInteraction,Fi as QtiGapText,Gs as QtiGcd,Ke as QtiGraphicAssociateInteraction,mo as QtiGraphicGapMatchInteraction,ho as QtiGraphicOrderInteraction,Xs as QtiGt,Qs as QtiGte,Tr as QtiHotspotChoice,fo as QtiHotspotInteraction,ro as QtiHottext,Gi as QtiHottextInteraction,tn as QtiIndex,Ui as QtiInlineChoice,wt as QtiInlineChoiceInteraction,Zi as QtiInside,Ys as QtiIntegerDivide,Js as QtiIntegerModulus,Ks as QtiIntegerToFloat,ta as QtiIsNull,Wt as QtiItem,ci as QtiItemBody,Zs as QtiLcm,Xi as QtiLookupOutcomeValue,ia as QtiLt,na as QtiLte,So as QtiMapResponse,Ao as QtiMapResponsePoint,oa as QtiMatch,Et as QtiMatchInteraction,To as QtiMathOperator,sa as QtiMax,go as QtiMediaInteraction,aa as QtiMember,la as QtiMin,$t as QtiModalFeedback,ca as QtiMultiple,da as QtiNot,ea as QtiNull,pa as QtiOr,Ct as QtiOrderInteraction,ua as QtiOrdered,Ve as QtiOutcomeDeclaration,Io as QtiPatternMatch,K as QtiPortableCustomInteraction,vo as QtiPositionObjectInteraction,yo as QtiPositionObjectStage,ma as QtiPower,en as QtiPrintedVariable,ha as QtiProduct,io as QtiPrompt,Ea as QtiRandom,Mr as QtiRandomInteger,Ro as QtiRepeat,Vs as QtiResponseCondition,Qe as QtiResponseDeclaration,Qi as QtiResponseElse,Os as QtiResponseElseIf,Yi as QtiResponseIf,ui as QtiResponseProcessing,Bs as QtiRound,Ki as QtiRoundTo,Pe as QtiRubricBlock,sl as QtiRuleElement,Ze as QtiSelectPointInteraction,fa as QtiSetCorrectResponse,ga as QtiSetCorrectResponseRule,Ds as QtiSetOutcomeValue,Ns as QtiSetOutcomeValueRule,ba as QtiSetTemplateValue,va as QtiSetTemplateValueRule,Gt as QtiSimpleAssociableChoice,ht as QtiSimpleChoice,St as QtiSliderInteraction,ko as QtiStatsOperator,Lo as QtiStringMatch,Sn as QtiStylesheet,_o as QtiSubstring,Mo as QtiSubtract,ya as QtiSum,xa as QtiSumExpression,In as QtiTemplateConstraint,De as QtiTemplateDeclaration,mi as QtiTemplateProcessing,Gr as QtiTest,hi as QtiTestFeedback,Xe as QtiTestPart,Re as QtiTextEntryInteraction,qa as QtiTruncate,xo as QtiUploadInteraction,wa as QtiVariable,rr as QtiVariableDeclaration,J as ScoringHelper,Li as TestCheckItem,He as TestContainer,gi as TestEndAttempt,fr as TestItemLink,xe as TestNavigation,ut as TestNext,Ai as TestPagingButtonsStamp,mt as TestPrev,Mi as TestPrintContext,vr as TestPrintVariables,zt as TestScoringButtons,xr as TestScoringFeedback,Ri as TestSectionButtonsStamp,yr as TestSectionLink,Ce as TestShowCorrectResponse,Bt as TestStamp,ae as TestView,_i as TestViewToggle,th as asSeed,G as computedContext,it as computedItemContext,ne as configContext,Ee as convertNumberToUniversalFormat,lp as decimalSeparator,u_ as getItemByUri,p_ as getManifestInfo,rp as isSeed,W as itemContext,Ja as itemContextVariables,nu as qtiAndMixin,be as qtiContext,ou as qtiSubtractMixin,Le as qtiTransformItem,gl as qtiTransformManifest,lr as qtiTransformTest,xn as removeDoubleSlashes,nt as sessionContext,_e as testContext};
6161
6161
  /*! Bundled license information:
6162
6162
 
6163
- @lit-labs/ssr-dom-shim/lib/element-internals.js:
6164
- @lit-labs/ssr-dom-shim/lib/events.js:
6165
- (**
6166
- * @license
6167
- * Copyright 2023 Google LLC
6168
- * SPDX-License-Identifier: BSD-3-Clause
6169
- *)
6170
-
6171
- @lit-labs/ssr-dom-shim/lib/css.js:
6172
- (**
6173
- * @license
6174
- * Copyright 2024 Google LLC
6175
- * SPDX-License-Identifier: BSD-3-Clause
6176
- *)
6177
-
6178
- @lit-labs/ssr-dom-shim/index.js:
6179
- @lit/reactive-element/node/css-tag.js:
6180
- lit-html/node/private-ssr-support.js:
6163
+ @lit/context/lib/context-request-event.js:
6164
+ @lit/context/lib/create-context.js:
6165
+ @lit/context/lib/controllers/context-consumer.js:
6166
+ @lit/context/lib/value-notifier.js:
6167
+ @lit/context/lib/controllers/context-provider.js:
6168
+ @lit/context/lib/context-root.js:
6169
+ @lit/reactive-element/node/decorators/query-assigned-elements.js:
6170
+ lit-html/node/directives/private-async-helpers.js:
6181
6171
  (**
6182
6172
  * @license
6183
- * Copyright 2019 Google LLC
6173
+ * Copyright 2021 Google LLC
6184
6174
  * SPDX-License-Identifier: BSD-3-Clause
6185
6175
  *)
6186
6176
 
6177
+ @lit/context/lib/decorators/provide.js:
6187
6178
  lit-html/node/lit-html.js:
6188
6179
  lit-element/lit-element.js:
6189
6180
  @lit/reactive-element/node/decorators/custom-element.js:
@@ -6195,7 +6186,6 @@ lit-element/lit-element.js:
6195
6186
  @lit/reactive-element/node/decorators/query-all.js:
6196
6187
  @lit/reactive-element/node/decorators/query-async.js:
6197
6188
  @lit/reactive-element/node/decorators/query-assigned-nodes.js:
6198
- @lit/context/lib/decorators/provide.js:
6199
6189
  lit-html/node/directive.js:
6200
6190
  lit-html/node/async-directive.js:
6201
6191
  lit-html/node/lit-html.js:
@@ -6207,25 +6197,35 @@ lit-html/node/directives/repeat.js:
6207
6197
  * SPDX-License-Identifier: BSD-3-Clause
6208
6198
  *)
6209
6199
 
6210
- lit-html/node/is-server.js:
6211
6200
  @lit/context/lib/decorators/consume.js:
6201
+ lit-html/node/is-server.js:
6212
6202
  (**
6213
6203
  * @license
6214
6204
  * Copyright 2022 Google LLC
6215
6205
  * SPDX-License-Identifier: BSD-3-Clause
6216
6206
  *)
6217
6207
 
6218
- @lit/reactive-element/node/decorators/query-assigned-elements.js:
6219
- @lit/context/lib/context-request-event.js:
6220
- @lit/context/lib/create-context.js:
6221
- @lit/context/lib/controllers/context-consumer.js:
6222
- @lit/context/lib/value-notifier.js:
6223
- @lit/context/lib/controllers/context-provider.js:
6224
- @lit/context/lib/context-root.js:
6225
- lit-html/node/directives/private-async-helpers.js:
6208
+ @lit-labs/ssr-dom-shim/lib/element-internals.js:
6209
+ @lit-labs/ssr-dom-shim/lib/events.js:
6226
6210
  (**
6227
6211
  * @license
6228
- * Copyright 2021 Google LLC
6212
+ * Copyright 2023 Google LLC
6213
+ * SPDX-License-Identifier: BSD-3-Clause
6214
+ *)
6215
+
6216
+ @lit-labs/ssr-dom-shim/lib/css.js:
6217
+ (**
6218
+ * @license
6219
+ * Copyright 2024 Google LLC
6220
+ * SPDX-License-Identifier: BSD-3-Clause
6221
+ *)
6222
+
6223
+ @lit-labs/ssr-dom-shim/index.js:
6224
+ @lit/reactive-element/node/css-tag.js:
6225
+ lit-html/node/private-ssr-support.js:
6226
+ (**
6227
+ * @license
6228
+ * Copyright 2019 Google LLC
6229
6229
  * SPDX-License-Identifier: BSD-3-Clause
6230
6230
  *)
6231
6231