@citolab/qti-components 10.0.0-next.0 → 10.0.0-next.2

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 (46) hide show
  1. package/cdn/index.global.js +1 -1
  2. package/cdn/index.js +191 -183
  3. package/dist/base.d.ts +2 -2
  4. package/dist/base.js +1 -1
  5. package/dist/{chunk-EPSUZIWL.js → chunk-2KP5UU5A.js} +6 -6
  6. package/dist/{chunk-GPNWMLLA.js → chunk-35WWWFS6.js} +2 -2
  7. package/dist/{chunk-QD3Y6UK3.js → chunk-3ZNECUPV.js} +2 -2
  8. package/dist/{chunk-3BAQWO5C.js → chunk-6K3QWJHH.js} +2 -2
  9. package/dist/{chunk-AWTQKBC4.js → chunk-6U3YPHXU.js} +2 -2
  10. package/dist/{chunk-WNAOVXXN.js → chunk-FD4AB6TM.js} +2 -2
  11. package/dist/{chunk-SVYHZIJ7.js → chunk-GBZNFSFY.js} +2 -2
  12. package/dist/{chunk-EUKU5QKV.js → chunk-K3VKQ6QF.js} +509 -274
  13. package/dist/chunk-K3VKQ6QF.js.map +1 -0
  14. package/dist/{chunk-ACRN7YJM.js → chunk-MI7774NV.js} +2 -2
  15. package/dist/{chunk-CNFVA3AA.js → chunk-RSMYGGQK.js} +2 -2
  16. package/dist/{chunk-F7R7GSWL.js → chunk-RU6332MD.js} +2 -2
  17. package/dist/{chunk-R7MMMDP7.js → chunk-TDWJ6WZA.js} +20 -2
  18. package/dist/chunk-TDWJ6WZA.js.map +1 -0
  19. package/dist/corrections.d.ts +2 -2
  20. package/dist/corrections.js +7 -7
  21. package/dist/elements.js +3 -3
  22. package/dist/index.d.ts +3 -3
  23. package/dist/index.js +16 -12
  24. package/dist/interactions.js +3 -3
  25. package/dist/item.js +3 -3
  26. package/dist/processing.d.ts +2 -2
  27. package/dist/processing.js +3 -3
  28. package/dist/qti-components-jsx.d.ts +120 -0
  29. package/dist/{qti-condition-expression.d-L7yb3Rzy.d.ts → qti-condition-expression.d-VJH6cWxf.d.ts} +1 -1
  30. package/dist/{qti-expression.d-CuaLjZ6g.d.ts → qti-expression.d-BPxEp8HU.d.ts} +7 -0
  31. package/dist/{qti-test.d-_THYXPzd.d.ts → qti-test.d-DkpBNcsv.d.ts} +62 -2
  32. package/dist/test.d.ts +3 -3
  33. package/dist/test.js +8 -4
  34. package/package.json +8 -8
  35. package/dist/chunk-EUKU5QKV.js.map +0 -1
  36. package/dist/chunk-R7MMMDP7.js.map +0 -1
  37. /package/dist/{chunk-EPSUZIWL.js.map → chunk-2KP5UU5A.js.map} +0 -0
  38. /package/dist/{chunk-GPNWMLLA.js.map → chunk-35WWWFS6.js.map} +0 -0
  39. /package/dist/{chunk-QD3Y6UK3.js.map → chunk-3ZNECUPV.js.map} +0 -0
  40. /package/dist/{chunk-3BAQWO5C.js.map → chunk-6K3QWJHH.js.map} +0 -0
  41. /package/dist/{chunk-AWTQKBC4.js.map → chunk-6U3YPHXU.js.map} +0 -0
  42. /package/dist/{chunk-WNAOVXXN.js.map → chunk-FD4AB6TM.js.map} +0 -0
  43. /package/dist/{chunk-SVYHZIJ7.js.map → chunk-GBZNFSFY.js.map} +0 -0
  44. /package/dist/{chunk-ACRN7YJM.js.map → chunk-MI7774NV.js.map} +0 -0
  45. /package/dist/{chunk-CNFVA3AA.js.map → chunk-RSMYGGQK.js.map} +0 -0
  46. /package/dist/{chunk-F7R7GSWL.js.map → chunk-RU6332MD.js.map} +0 -0
package/cdn/index.js CHANGED
@@ -1,8 +1,8 @@
1
- var uc=class{get shadowRoot(){return this.__host.__shadowRoot}constructor(t){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=t}checkValidity(){return console.warn("`ElementInternals.checkValidity()` was called on the server.This method always returns true."),!0}reportValidity(){return!0}setFormValue(){}setValidity(){}};var Ht=function(o,t,e,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?o!==t||!n:!t.has(o))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(o,e):n?n.value=e:t.set(o,e),e},et=function(o,t,e,r){if(e==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?o!==t||!r:!t.has(o))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?r:e==="a"?r.call(o):r?r.value:t.get(o)},Sr,kn,En,fi,va,gi,An,Qe,bi,ye,In,mc;var B={__proto__:null};B.enumerable=!0;Object.freeze(B);var wa=(ye=class{constructor(t,e={}){if(Sr.set(this,!1),kn.set(this,!1),En.set(this,!1),fi.set(this,!1),va.set(this,Date.now()),gi.set(this,!1),An.set(this,void 0),Qe.set(this,void 0),bi.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:r,cancelable:n,composed:i}=e;Ht(this,Sr,!!n,"f"),Ht(this,kn,!!r,"f"),Ht(this,En,!!i,"f"),Ht(this,An,`${t}`,"f"),Ht(this,Qe,null,"f"),Ht(this,bi,!1,"f")}initEvent(t,e,r){throw new Error("Method not implemented.")}stopImmediatePropagation(){this.stopPropagation()}preventDefault(){Ht(this,fi,!0,"f")}get target(){return et(this,Qe,"f")}get currentTarget(){return et(this,Qe,"f")}get srcElement(){return et(this,Qe,"f")}get type(){return et(this,An,"f")}get cancelable(){return et(this,Sr,"f")}get defaultPrevented(){return et(this,Sr,"f")&&et(this,fi,"f")}get timeStamp(){return et(this,va,"f")}composedPath(){return et(this,bi,"f")?[et(this,Qe,"f")]:[]}get returnValue(){return!et(this,Sr,"f")||!et(this,fi,"f")}get bubbles(){return et(this,kn,"f")}get composed(){return et(this,En,"f")}get eventPhase(){return et(this,bi,"f")?ye.AT_TARGET:ye.NONE}get cancelBubble(){return et(this,gi,"f")}set cancelBubble(t){t&&Ht(this,gi,!0,"f")}stopPropagation(){Ht(this,gi,!0,"f")}get isTrusted(){return!1}},Sr=new WeakMap,kn=new WeakMap,En=new WeakMap,fi=new WeakMap,va=new WeakMap,gi=new WeakMap,An=new WeakMap,Qe=new WeakMap,bi=new WeakMap,ye.NONE=0,ye.CAPTURING_PHASE=1,ye.AT_TARGET=2,ye.BUBBLING_PHASE=3,ye);Object.defineProperties(wa.prototype,{initEvent:B,stopImmediatePropagation:B,preventDefault:B,target:B,currentTarget:B,srcElement:B,type:B,cancelable:B,defaultPrevented:B,timeStamp:B,composedPath:B,returnValue:B,bubbles:B,composed:B,eventPhase:B,cancelBubble:B,stopPropagation:B,isTrusted:B});var fc=(mc=class extends wa{constructor(t,e={}){super(t,e),In.set(this,void 0),Ht(this,In,e?.detail??null,"f")}initCustomEvent(t,e,r,n){throw new Error("Method not implemented.")}get detail(){return et(this,In,"f")}},In=new WeakMap,mc);Object.defineProperties(fc.prototype,{detail:B});var ie=wa,xa=fc;var ot;var Sf=(ot=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.MARGIN_RULE=9,this.__parentStyleSheet=null,this.cssText=""}get parentRule(){return null}get parentStyleSheet(){return this.__parentStyleSheet}get type(){return 0}},ot.STYLE_RULE=1,ot.CHARSET_RULE=2,ot.IMPORT_RULE=3,ot.MEDIA_RULE=4,ot.FONT_FACE_RULE=5,ot.PAGE_RULE=6,ot.NAMESPACE_RULE=10,ot.KEYFRAMES_RULE=7,ot.KEYFRAME_RULE=8,ot.SUPPORTS_RULE=12,ot.COUNTER_STYLE_RULE=11,ot.FONT_FEATURE_VALUES_RULE=14,ot.MARGIN_RULE=9,ot);globalThis.Event??=ie;globalThis.CustomEvent??=xa;var Ca=Symbol(),gc=o=>typeof o=="boolean"?o:o?.capture??!1,ne={__proto__:null};ne.enumerable=!0;Object.freeze(ne);var _n=class{constructor(){this.__eventListeners=new Map,this.__captureEventListeners=new Map}addEventListener(t,e,r){if(e==null)return;let n=gc(r)?this.__captureEventListeners:this.__eventListeners,i=n.get(t);if(i===void 0)i=new Map,n.set(t,i);else if(i.has(e))return;let s=typeof r=="object"&&r?r:{};s.signal?.addEventListener("abort",()=>this.removeEventListener(t,e,r)),i.set(e,s??{})}removeEventListener(t,e,r){if(e==null)return;let n=gc(r)?this.__captureEventListeners:this.__eventListeners,i=n.get(t);i!==void 0&&(i.delete(e),i.size||n.delete(t))}dispatchEvent(t){let e=this.__resolveFullEventPath();!t.composed&&this.__host&&(e=e.slice(0,e.indexOf(this.__host)));let r=!1,n=!1,i=ie.NONE,s=null,a=null,l=null,c=t.stopPropagation,d=t.stopImmediatePropagation;Object.defineProperties(t,{target:{get(){return s??a},...ne},srcElement:{get(){return t.target},...ne},currentTarget:{get(){return l},...ne},eventPhase:{get(){return i},...ne},composedPath:{value:()=>e,...ne},stopPropagation:{value:()=>{r=!0,c.call(t)},...ne},stopImmediatePropagation:{value:()=>{n=!0,d.call(t)},...ne}});let h=(u,g,y)=>{typeof u=="function"?u(t):typeof u?.handleEvent=="function"&&u.handleEvent(t),g.once&&y.delete(u)},f=()=>(l=null,i=ie.NONE,!t.defaultPrevented),m=e.slice().reverse();s=!this.__host||!t.composed?this:null;let v=u=>{for(a=this;a.__host&&u.includes(a.__host);)a=a.__host};for(let u of m){!s&&(!a||a===u.__host)&&v(m.slice(m.indexOf(u))),l=u,i=u===t.target?ie.AT_TARGET:ie.CAPTURING_PHASE;let g=u.__captureEventListeners.get(t.type);if(g){for(let[y,w]of g)if(h(y,w,g),n)return f()}if(r)return f()}let x=t.bubbles?e:[this];a=null;for(let u of x){!s&&(!a||u===a.__host)&&v(x.slice(0,x.indexOf(u)+1)),l=u,i=u===t.target?ie.AT_TARGET:ie.BUBBLING_PHASE;let g=u.__eventListeners.get(t.type);if(g){for(let[y,w]of g)if(h(y,w,g),n)return f()}if(r)return f()}return f()}__resolveFullEventPath(){return this.__eventPathCache?this.__eventPathCache:this.__eventTargetParent?this.__eventPathCache=[this,...this.__eventTargetParent.__resolveFullEventPath()]:this.__eventPathCache=[this,vc,Fp]}};var bc=new WeakMap,yi=o=>{let t=bc.get(o);return t===void 0&&bc.set(o,t=new Map),t},vi=class extends _n{getRootNode(t){return t?.composed?qa:this.__host?.__shadowRoot??qa}};var yc=class extends vi{get adoptedStyleSheets(){return[]}createTreeWalker(){return{}}createTextNode(){return{}}createElement(){return{}}};var vc=new yc,qa=vc;var wc=class extends vi{constructor(t){if(super(),t!==Ca)throw new TypeError("Illegal constructor");Object.assign(this,globalThis,{CustomElementRegistry:Tn,customElements:ka,document:qa,Document:yc,Element:xc,EventTarget:_n,HTMLElement:qc,Node:vi,ShadowRoot:Cc,window:this,Window:wc})}};var xc=class extends vi{constructor(){super(...arguments),this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from(yi(this)).map(([t,e])=>({name:t,value:e}))}get shadowRoot(){return this.__shadowRootMode==="closed"?null:this.__shadowRoot}get localName(){return this.constructor.__localName}get tagName(){return this.localName?.toUpperCase()}setAttribute(t,e){yi(this).set(t,String(e))}removeAttribute(t){yi(this).delete(t)}toggleAttribute(t,e){if(this.hasAttribute(t)){if(e===void 0||!e)return this.removeAttribute(t),!1}else return e===void 0||e?(this.setAttribute(t,""),!0):!1;return!0}hasAttribute(t){return yi(this).has(t)}attachShadow(t){this.__shadowRootMode=t.mode;let e=new Cc(Ca,t);return e.__eventTargetParent=this,e.__host=this,this.__shadowRoot=e}attachInternals(){if(this.__internals!==null)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");let t=new uc(this);return this.__internals=t,t}getAttribute(t){return yi(this).get(t)??null}};var qc=class extends xc{},Sa=qc;var Cc=class extends vi{get host(){return this.__host}constructor(t,e){if(super(),t!==t)throw new TypeError("Illegal constructor");this.mode=e.mode}};globalThis.litServerRoot??=Object.defineProperty(new Sa,"localName",{get(){return"lit-server-root"}});function zp(){let o,t;return{promise:new Promise((r,n)=>{o=r,t=n}),resolve:o,reject:t}}var Tn=class{constructor(){this.__definitions=new Map,this.__reverseDefinitions=new Map,this.__pendingWhenDefineds=new Map}define(t,e){if(this.__definitions.has(t))if(process.env.NODE_ENV==="development")console.warn(`'CustomElementRegistry' already has "${t}" 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 "${t}" 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=t,this.__definitions.set(t,{ctor:e,observedAttributes:e.observedAttributes??[]}),this.__reverseDefinitions.set(e,t),this.__pendingWhenDefineds.get(t)?.resolve(e),this.__pendingWhenDefineds.delete(t)}get(t){return this.__definitions.get(t)?.ctor}getName(t){return this.__reverseDefinitions.get(t)??null}initialize(t){throw new Error("customElements.initialize is not currently supported in SSR. Please file a bug if you need it.")}upgrade(t){throw new Error("customElements.upgrade is not currently supported in SSR. Please file a bug if you need it.")}async whenDefined(t){let e=this.__definitions.get(t);if(e)return e.ctor;let r=this.__pendingWhenDefineds.get(t);return r||(r=zp(),this.__pendingWhenDefineds.set(t,r)),r.promise}},jp=Tn;var ka=new jp,Fp=new wc(Ca);var wi=globalThis,Rn=wi.ShadowRoot&&(wi.ShadyCSS===void 0||wi.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ea=Symbol(),Sc=new WeakMap,xi=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==Ea)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,e=this.t;if(Rn&&t===void 0){let r=e!==void 0&&e.length===1;r&&(t=Sc.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&Sc.set(e,t))}return t}toString(){return this.cssText}},kc=o=>new xi(typeof o=="string"?o:o+"",void 0,Ea),q=(o,...t)=>{let e=o.length===1?o[0]:t.reduce((r,n,i)=>r+(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.")})(n)+o[i+1],o[0]);return new xi(e,o,Ea)},Ec=(o,t)=>{if(Rn)o.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let r=document.createElement("style"),n=wi.litNonce;n!==void 0&&r.setAttribute("nonce",n),r.textContent=e.cssText,o.appendChild(r)}},Aa=Rn||wi.CSSStyleSheet===void 0?o=>o:o=>o instanceof CSSStyleSheet?(t=>{let e="";for(let r of t.cssRules)e+=r.cssText;return kc(e)})(o):o;var{is:Bp,defineProperty:Up,getOwnPropertyDescriptor:Hp,getOwnPropertyNames:Wp,getOwnPropertySymbols:Qp,getPrototypeOf:Gp}=Object,Si=globalThis;Si.customElements??=ka;var Ac=Si.trustedTypes,Xp=Ac?Ac.emptyScript:"",Yp=Si.reactiveElementPolyfillSupport,qi=(o,t)=>o,Ci={toAttribute(o,t){switch(t){case Boolean:o=o?Xp:null;break;case Object:case Array:o=o==null?o:JSON.stringify(o)}return o},fromAttribute(o,t){let e=o;switch(t){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}},Pn=(o,t)=>!Bp(o,t),Ic={attribute:!0,type:String,converter:Ci,reflect:!1,useDefault:!1,hasChanged:Pn};Symbol.metadata??=Symbol("metadata"),Si.litPropertyMetadata??=new WeakMap;var oe=class extends(globalThis.HTMLElement??Sa){static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=Ic){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){let r=Symbol(),n=this.getPropertyDescriptor(t,r,e);n!==void 0&&Up(this.prototype,t,n)}}static getPropertyDescriptor(t,e,r){let{get:n,set:i}=Hp(this.prototype,t)??{get(){return this[e]},set(s){this[e]=s}};return{get:n,set(s){let a=n?.call(this);i?.call(this,s),this.requestUpdate(t,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Ic}static _$Ei(){if(this.hasOwnProperty(qi("elementProperties")))return;let t=Gp(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(qi("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(qi("properties"))){let e=this.properties,r=[...Wp(e),...Qp(e)];for(let n of r)this.createProperty(n,e[n])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[r,n]of e)this.elementProperties.set(r,n)}this._$Eh=new Map;for(let[e,r]of this.elementProperties){let n=this._$Eu(e,r);n!==void 0&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let r=new Set(t.flat(1/0).reverse());for(let n of r)e.unshift(Aa(n))}else t!==void 0&&e.push(Aa(t));return e}static _$Eu(t,e){let r=e.attribute;return r===!1?void 0:typeof r=="string"?r:typeof t=="string"?t.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(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let r of e.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Ec(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,r){this._$AK(t,r)}_$ET(t,e){let r=this.constructor.elementProperties.get(t),n=this.constructor._$Eu(t,r);if(n!==void 0&&r.reflect===!0){let i=(r.converter?.toAttribute!==void 0?r.converter:Ci).toAttribute(e,r.type);this._$Em=t,i==null?this.removeAttribute(n):this.setAttribute(n,i),this._$Em=null}}_$AK(t,e){let r=this.constructor,n=r._$Eh.get(t);if(n!==void 0&&this._$Em!==n){let i=r.getPropertyOptions(n),s=typeof i.converter=="function"?{fromAttribute:i.converter}:i.converter?.fromAttribute!==void 0?i.converter:Ci;this._$Em=n;let a=s.fromAttribute(e,i.type);this[n]=a??this._$Ej?.get(n)??a,this._$Em=null}}requestUpdate(t,e,r,n=!1,i){if(t!==void 0){let s=this.constructor;if(n===!1&&(i=this[t]),r??=s.getPropertyOptions(t),!((r.hasChanged??Pn)(i,e)||r.useDefault&&r.reflect&&i===this._$Ej?.get(t)&&!this.hasAttribute(s._$Eu(t,r))))return;this.C(t,e,r)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,e,{useDefault:r,reflect:n,wrapped:i},s){r&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,s??e??this[t]),i!==!0||s!==void 0)||(this._$AL.has(t)||(this.hasUpdated||r||(e=void 0),this._$AL.set(t,e)),n===!0&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[n,i]of this._$Ep)this[n]=i;this._$Ep=void 0}let r=this.constructor.elementProperties;if(r.size>0)for(let[n,i]of r){let{wrapped:s}=i,a=this[n];s!==!0||this._$AL.has(n)||a===void 0||this.C(n,void 0,i,a)}}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(r=>r.hostUpdate?.()),this.update(e)):this._$EM()}catch(r){throw t=!1,this._$EM(),r}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(t){}firstUpdated(t){}};oe.elementStyles=[],oe.shadowRootOptions={mode:"open"},oe[qi("elementProperties")]=new Map,oe[qi("finalized")]=new Map,Yp?.({ReactiveElement:oe}),(Si.reactiveElementVersions??=[]).push("2.1.2");var Vn=globalThis,_c=o=>o,On=Vn.trustedTypes,Tc=On?On.createPolicy("lit-html",{createHTML:o=>o}):void 0,_a="$lit$",se=`lit$${Math.random().toFixed(9).slice(2)}$`,Ta="?"+se,Kp=`<${Ta}>`,Ye=Vn.document===void 0?{createTreeWalker:()=>({})}:document,Ei=()=>Ye.createComment(""),Ai=o=>o===null||typeof o!="object"&&typeof o!="function",Ra=Array.isArray,Nc=o=>Ra(o)||typeof o?.[Symbol.iterator]=="function",Ia=`[
3
- \f\r]`,ki=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Rc=/-->/g,Pc=/>/g,Ge=RegExp(`>|${Ia}(?:([^\\s"'>=/]+)(${Ia}*=${Ia}*(?:[^
4
- \f\r"'\`<>=]|("|')|))|$)`,"g"),Oc=/'/g,Mc=/"/g,$c=/^(?:script|style|textarea|title)$/i,Pa=o=>(t,...e)=>({_$litType$:o,strings:t,values:e}),b=Pa(1),_i=Pa(2),ig=Pa(3),it=Symbol.for("lit-noChange"),O=Symbol.for("lit-nothing"),Dc=new WeakMap,Xe=Ye.createTreeWalker(Ye,129);function Lc(o,t){if(!Ra(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return Tc!==void 0?Tc.createHTML(t):t}var Vc=(o,t)=>{let e=o.length-1,r=[],n,i=t===2?"<svg>":t===3?"<math>":"",s=ki;for(let a=0;a<e;a++){let l=o[a],c,d,h=-1,f=0;for(;f<l.length&&(s.lastIndex=f,d=s.exec(l),d!==null);)f=s.lastIndex,s===ki?d[1]==="!--"?s=Rc:d[1]!==void 0?s=Pc:d[2]!==void 0?($c.test(d[2])&&(n=RegExp("</"+d[2],"g")),s=Ge):d[3]!==void 0&&(s=Ge):s===Ge?d[0]===">"?(s=n??ki,h=-1):d[1]===void 0?h=-2:(h=s.lastIndex-d[2].length,c=d[1],s=d[3]===void 0?Ge:d[3]==='"'?Mc:Oc):s===Mc||s===Oc?s=Ge:s===Rc||s===Pc?s=ki:(s=Ge,n=void 0);let m=s===Ge&&o[a+1].startsWith("/>")?" ":"";i+=s===ki?l+Kp:h>=0?(r.push(c),l.slice(0,h)+_a+l.slice(h)+se+m):l+se+(h===-2?a:m)}return[Lc(o,i+(o[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]},Ii=class o{constructor({strings:t,_$litType$:e},r){let n;this.parts=[];let i=0,s=0,a=t.length-1,l=this.parts,[c,d]=Vc(t,e);if(this.el=o.createElement(c,r),Xe.currentNode=this.el.content,e===2||e===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(n=Xe.nextNode())!==null&&l.length<a;){if(n.nodeType===1){if(n.hasAttributes())for(let h of n.getAttributeNames())if(h.endsWith(_a)){let f=d[s++],m=n.getAttribute(h).split(se),v=/([.?@])?(.*)/.exec(f);l.push({type:1,index:i,name:v[2],strings:m,ctor:v[1]==="."?Dn:v[1]==="?"?Nn:v[1]==="@"?$n:Je}),n.removeAttribute(h)}else h.startsWith(se)&&(l.push({type:6,index:i}),n.removeAttribute(h));if($c.test(n.tagName)){let h=n.textContent.split(se),f=h.length-1;if(f>0){n.textContent=On?On.emptyScript:"";for(let m=0;m<f;m++)n.append(h[m],Ei()),Xe.nextNode(),l.push({type:2,index:++i});n.append(h[f],Ei())}}}else if(n.nodeType===8)if(n.data===Ta)l.push({type:2,index:i});else{let h=-1;for(;(h=n.data.indexOf(se,h+1))!==-1;)l.push({type:7,index:i}),h+=se.length-1}i++}}static createElement(t,e){let r=Ye.createElement("template");return r.innerHTML=t,r}};function Ke(o,t,e=o,r){if(t===it)return t;let n=r!==void 0?e._$Co?.[r]:e._$Cl,i=Ai(t)?void 0:t._$litDirective$;return n?.constructor!==i&&(n?._$AO?.(!1),i===void 0?n=void 0:(n=new i(o),n._$AT(o,e,r)),r!==void 0?(e._$Co??=[])[r]=n:e._$Cl=n),n!==void 0&&(t=Ke(o,n._$AS(o,t.values),n,r)),t}var Mn=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:e},parts:r}=this._$AD,n=(t?.creationScope??Ye).importNode(e,!0);Xe.currentNode=n;let i=Xe.nextNode(),s=0,a=0,l=r[0];for(;l!==void 0;){if(s===l.index){let c;l.type===2?c=new kr(i,i.nextSibling,this,t):l.type===1?c=new l.ctor(i,l.name,l.strings,this,t):l.type===6&&(c=new Ln(i,this,t)),this._$AV.push(c),l=r[++a]}s!==l?.index&&(i=Xe.nextNode(),s++)}return Xe.currentNode=Ye,n}p(t){let e=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}},kr=class o{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,r,n){this.type=2,this._$AH=O,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=n,this._$Cv=n?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=Ke(this,t,e),Ai(t)?t===O||t==null||t===""?(this._$AH!==O&&this._$AR(),this._$AH=O):t!==this._$AH&&t!==it&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Nc(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==O&&Ai(this._$AH)?this._$AA.nextSibling.data=t:this.T(Ye.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:r}=t,n=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=Ii.createElement(Lc(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===n)this._$AH.p(e);else{let i=new Mn(n,this),s=i.u(this.options);i.p(e),this.T(s),this._$AH=i}}_$AC(t){let e=Dc.get(t.strings);return e===void 0&&Dc.set(t.strings,e=new Ii(t)),e}k(t){Ra(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,r,n=0;for(let i of t)n===e.length?e.push(r=new o(this.O(Ei()),this.O(Ei()),this,this.options)):r=e[n],r._$AI(i),n++;n<e.length&&(this._$AR(r&&r._$AB.nextSibling,n),e.length=n)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){let r=_c(t).nextSibling;_c(t).remove(),t=r}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},Je=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,n,i){this.type=1,this._$AH=O,this._$AN=void 0,this.element=t,this.name=e,this._$AM=n,this.options=i,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=O}_$AI(t,e=this,r,n){let i=this.strings,s=!1;if(i===void 0)t=Ke(this,t,e,0),s=!Ai(t)||t!==this._$AH&&t!==it,s&&(this._$AH=t);else{let a=t,l,c;for(t=i[0],l=0;l<i.length-1;l++)c=Ke(this,a[r+l],e,l),c===it&&(c=this._$AH[l]),s||=!Ai(c)||c!==this._$AH[l],c===O?t=O:t!==O&&(t+=(c??"")+i[l+1]),this._$AH[l]=c}s&&!n&&this.j(t)}j(t){t===O?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},Dn=class extends Je{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===O?void 0:t}},Nn=class extends Je{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==O)}},$n=class extends Je{constructor(t,e,r,n,i){super(t,e,r,n,i),this.type=5}_$AI(t,e=this){if((t=Ke(this,t,e,0)??O)===it)return;let r=this._$AH,n=t===O&&r!==O||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,i=t!==O&&(r===O||n);n&&this.element.removeEventListener(this.name,this,r),i&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},Ln=class{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){Ke(this,t)}},rt={M:_a,P:se,A:Ta,C:1,L:Vc,R:Mn,D:Nc,V:Ke,I:kr,H:Je,N:Nn,U:$n,B:Dn,F:Ln},Jp=Vn.litHtmlPolyfillSupport;Jp?.(Ii,kr),(Vn.litHtmlVersions??=[]).push("3.3.3");var Oa=(o,t,e)=>{let r=e?.renderBefore??t,n=r._$litPart$;if(n===void 0){let i=e?.renderBefore??null;r._$litPart$=n=new kr(t.insertBefore(Ei(),i),i,void 0,e??{})}return n._$AI(o),n};var Ma=globalThis,C=class extends oe{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Oa(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return it}};C._$litElement$=!0,C.finalized=!0,Ma.litElementHydrateSupport?.({LitElement:C});var Zp=Ma.litElementPolyfillSupport;Zp?.({LitElement:C});(Ma.litElementVersions??=[]).push("4.2.2");var tu={attribute:!0,type:String,converter:Ci,reflect:!1,hasChanged:Pn},eu=(o=tu,t,e)=>{let{kind:r,metadata:n}=e,i=globalThis.litPropertyMetadata.get(n);if(i===void 0&&globalThis.litPropertyMetadata.set(n,i=new Map),r==="setter"&&((o=Object.create(o)).wrapped=!0),i.set(e.name,o),r==="accessor"){let{name:s}=e;return{set(a){let l=t.get.call(this);t.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(r==="setter"){let{name:s}=e;return function(a){let l=this[s];t.call(this,a),this.requestUpdate(s,l,o,!0,a)}}throw Error("Unsupported decorator location: "+r)};function p(o){return(t,e)=>typeof e=="object"?eu(o,t,e):((r,n,i)=>{let s=n.hasOwnProperty(i);return n.constructor.createProperty(i,r),s?Object.getOwnPropertyDescriptor(n,i):void 0})(o,t,e)}function T(o){return p({...o,state:!0,attribute:!1})}var ve=(o,t,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(o,t,e),e);function Er(o,t){return(e,r,n)=>{let i=s=>s.renderRoot?.querySelector(o)??null;if(t){let{get:s,set:a}=typeof r=="object"?e:n??(()=>{let l=Symbol();return{get(){return this[l]},set(c){this[l]=c}}})();return ve(e,r,{get(){let l=s.call(this);return l===void 0&&(l=i(this),(l!==null||this.hasUpdated)&&a.call(this,l)),l}})}return ve(e,r,{get(){return i(this)}})}}function zc(o){return(t,e)=>{let{slot:r,selector:n}=o??{},i="slot"+(r?`[name=${r}]`:":not([name])");return ve(t,e,{get(){let s=this.renderRoot?.querySelector(i),a=s?.assignedElements(o)??[];return n===void 0?a:a.filter(l=>l.matches(n))}})}}var ae=class extends Event{constructor(t,e,r,n){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e,this.callback=r,this.subscribe=n??!1}};var wt=class{constructor(t,e,r,n){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(i,s)=>{this.unsubscribe&&(this.unsubscribe!==s&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=i,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(i,s)),this.unsubscribe=s},this.host=t,e.context!==void 0){let i=e;this.context=i.context,this.callback=i.callback,this.subscribe=i.subscribe??!1}else this.context=e,this.callback=r,this.subscribe=n??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new ae(this.context,this.host,this.t,this.subscribe))}};var zn=class{get value(){return this.o}set value(t){this.setValue(t)}setValue(t,e=!1){let r=e||!Object.is(t,this.o);this.o=t,r&&this.updateObservers()}constructor(t){this.subscriptions=new Map,this.updateObservers=()=>{for(let[e,{disposer:r}]of this.subscriptions)e(this.o,r)},t!==void 0&&(this.value=t)}addCallback(t,e,r){if(!r)return void t(this.value);this.subscriptions.has(t)||this.subscriptions.set(t,{disposer:()=>{this.subscriptions.delete(t)},consumerHost:e});let{disposer:n}=this.subscriptions.get(t);t(this.value,n)}clearCallbacks(){this.subscriptions.clear()}};var Da=class extends Event{constructor(t,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e}},we=class extends zn{constructor(t,e,r){super(e.context!==void 0?e.initialValue:r),this.onContextRequest=n=>{if(n.context!==this.context)return;let i=n.contextTarget??n.composedPath()[0];i!==this.host&&(n.stopPropagation(),this.addCallback(n.callback,i,n.subscribe))},this.onProviderRequest=n=>{if(n.context!==this.context||(n.contextTarget??n.composedPath()[0])===this.host)return;let i=new Set;for(let[s,{consumerHost:a}]of this.subscriptions)i.has(s)||(i.add(s),a.dispatchEvent(new ae(this.context,a,s,!0)));n.stopPropagation()},this.host=t,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 Da(this.context,this.host))}};var Ti=class{constructor(){this.pendingContextRequests=new Map,this.onContextProvider=t=>{let e=this.pendingContextRequests.get(t.context);if(e===void 0)return;this.pendingContextRequests.delete(t.context);let{requests:r}=e;for(let{elementRef:n,callbackRef:i}of r){let s=n.deref(),a=i.deref();s===void 0||a===void 0||s.dispatchEvent(new ae(t.context,s,a,!0))}},this.onContextRequest=t=>{if(t.subscribe!==!0)return;let e=t.contextTarget??t.composedPath()[0],r=t.callback,n=this.pendingContextRequests.get(t.context);n===void 0&&this.pendingContextRequests.set(t.context,n={callbacks:new WeakMap,requests:[]});let i=n.callbacks.get(e);i===void 0&&n.callbacks.set(e,i=new WeakSet),i.has(r)||(i.add(r),n.requests.push({elementRef:new WeakRef(e),callbackRef:new WeakRef(r)}))}}attach(t){t.addEventListener("context-request",this.onContextRequest),t.addEventListener("context-provider",this.onContextProvider)}detach(t){t.removeEventListener("context-request",this.onContextRequest),t.removeEventListener("context-provider",this.onContextProvider)}};function U({context:o}){return(t,e)=>{let r=new WeakMap;if(typeof e=="object")return{get(){return t.get.call(this)},set(n){return r.get(this).setValue(n),t.set.call(this,n)},init(n){return r.set(this,new we(this,{context:o,initialValue:n})),n}};{t.constructor.addInitializer((s=>{r.set(s,new we(s,{context:o}))}));let n=Object.getOwnPropertyDescriptor(t,e),i;if(n===void 0){let s=new WeakMap;i={get(){return s.get(this)},set(a){r.get(this).setValue(a),s.set(this,a)},configurable:!0,enumerable:!0}}else{let s=n.set;i={...n,set(a){r.get(this).setValue(a),s?.call(this,a)}}}return void Object.defineProperty(t,e,i)}}}function _({context:o,subscribe:t}){return(e,r)=>{typeof r=="object"?r.addInitializer((function(){new wt(this,{context:o,callback:n=>{e.set.call(this,n)},subscribe:t})})):e.constructor.addInitializer((n=>{new wt(n,{context:o,callback:i=>{n[r]=i},subscribe:t})}))}}var jn=["this"],jc=["+","-","!"],Fc=["=","+","-","*","/","%","^","==","!=",">","<",">=","<=","||","&&","??","&","===","!==","|","|>"],Na={"!":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},Fn=13;var ru=["==","!=","<=",">=","||","&&","??","|>"],iu=["===","!=="],M;(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"})(M||(M={}));var Wt=(o,t,e=0)=>({kind:o,value:t,precedence:e}),nu=o=>o===9||o===10||o===13||o===32,Bc=o=>o===95||o===36||(o&=-33,65<=o&&o<=90),ou=o=>Bc(o)||Ri(o),su=o=>jn.indexOf(o)!==-1,au=o=>o===34||o===39,Ri=o=>48<=o&&o<=57,lu=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,cu=o=>o===40||o===41||o===91||o===93||o===123||o===125,du=o=>o.replace(/\\(.)/g,(t,e)=>{switch(e){case"n":return`
5
- `;case"r":return"\r";case"t":return" ";case"b":return"\b";case"f":return"\f";default:return e}}),Bn=class{#t;#e=-1;#r=0;#i;constructor(t){this.#t=t,this.#n()}nextToken(){for(;nu(this.#i);)this.#n(!0);if(au(this.#i))return this.#a();if(Bc(this.#i))return this.#c();if(Ri(this.#i))return this.#p();if(this.#i===46)return this.#l();if(this.#i===44)return this.#d();if(this.#i===58)return this.#m();if(lu(this.#i))return this.#f();if(cu(this.#i))return this.#g();if(this.#n(),this.#i!==void 0)throw new Error(`Expected end of input, got ${this.#i}`)}#n(t){this.#e++,this.#e<this.#t.length?(this.#i=this.#t.charCodeAt(this.#e),t===!0&&(this.#r=this.#e)):this.#i=void 0}#o(t=0){let e=this.#t.substring(this.#r,this.#e+t);return t===0&&this.#s(),e}#s(){this.#r=this.#e}#a(){let t="unterminated string",e=this.#i;for(this.#n(!0);this.#i!==e;){if(this.#i===void 0)throw new Error(t);if(this.#i===92&&(this.#n(),this.#i===void 0))throw new Error(t);this.#n()}let r=Wt(M.STRING,du(this.#o()));return this.#n(),r}#c(){do this.#n();while(ou(this.#i));let t=this.#o(),e=su(t)?M.KEYWORD:M.IDENTIFIER;return Wt(e,t)}#p(){do this.#n();while(Ri(this.#i));return this.#i===46?this.#l():Wt(M.INTEGER,this.#o())}#l(){return this.#n(),Ri(this.#i)?this.#h():(this.#s(),Wt(M.DOT,".",Fn))}#d(){return this.#n(!0),Wt(M.COMMA,",")}#m(){return this.#n(!0),Wt(M.COLON,":")}#h(){do this.#n();while(Ri(this.#i));return Wt(M.DECIMAL,this.#o())}#f(){this.#n();let t=this.#o(2);if(iu.indexOf(t)!==-1)this.#n(),this.#n();else{if(t=this.#o(1),t==="=>")return this.#n(),Wt(M.ARROW,t);ru.indexOf(t)!==-1&&this.#n()}return t=this.#o(),Wt(M.OPERATOR,t,Na[t])}#g(){let t=String.fromCharCode(this.#i),e=Wt(M.GROUPER,t,Na[t]);return this.#n(!0),e}};var $a=(o,t)=>new Pi(o,t).parse(),Pi=class{#t;#e;#r;#i;#n;constructor(t,e){this.#e=new Bn(t),this.#r=e}parse(){return this.#o(),this.#s()}#o(t,e){if(!this._matches(t,e))throw new Error(`Expected kind ${t} (${e}), was ${this.#i?.kind} (${this.#i?.value})`);let r=this.#e.nextToken();this.#i=r,this.#t=r?.kind,this.#n=r?.value}_matches(t,e){return!(t&&this.#t!==t||e&&this.#n!==e)}#s(){if(!this.#i)return this.#r.empty();let t=this.#l();return t===void 0?void 0:this.#a(t,0)}#a(t,e){if(t===void 0)throw new Error("Expected left to be defined.");for(;this.#i;)if(this._matches(M.GROUPER,"(")){let r=this.#u();t=this.#r.invoke(t,void 0,r)}else if(this._matches(M.GROUPER,"[")){let r=this.#y();t=this.#r.index(t,r)}else if(this._matches(M.DOT)){this.#o();let r=this.#l();t=this.#c(t,r)}else{if(this._matches(M.KEYWORD))break;if(this._matches(M.OPERATOR)&&this.#i.precedence>=e)t=this.#n==="?"?this.#d(t):this.#p(t,this.#i);else break}return t}#c(t,e){if(e===void 0)throw new Error("expected identifier");if(e.type==="ID")return this.#r.getter(t,e.value);if(e.type==="Invoke"&&e.receiver.type==="ID"){let r=e.receiver;return this.#r.invoke(t,r.value,e.arguments)}else throw new Error(`expected identifier: ${e}`)}#p(t,e){if(Fc.indexOf(e.value)===-1)throw new Error(`unknown operator: ${e.value}`);this.#o();let r=this.#l();for(;(this.#t===M.OPERATOR||this.#t===M.DOT||this.#t===M.GROUPER)&&this.#i.precedence>e.precedence;)r=this.#a(r,this.#i.precedence);return this.#r.binary(t,e.value,r)}#l(){if(this._matches(M.OPERATOR)){let t=this.#n;if(this.#o(),t==="+"||t==="-"){if(this._matches(M.INTEGER))return this.#k(t);if(this._matches(M.DECIMAL))return this.#E(t)}if(jc.indexOf(t)===-1)throw new Error(`unexpected token: ${t}`);let e=this.#a(this.#m(),Fn);return this.#r.unary(t,e)}return this.#m()}#d(t){this.#o(M.OPERATOR,"?");let e=this.#s();this.#o(M.COLON);let r=this.#s();return this.#r.ternary(t,e,r)}#m(){switch(this.#t){case M.KEYWORD:let t=this.#n;if(t==="this")return this.#o(),this.#r.id(t);throw jn.indexOf(t)!==-1?new Error(`unexpected keyword: ${t}`):new Error(`unrecognized keyword: ${t}`);case M.IDENTIFIER:return this.#g();case M.STRING:return this.#S();case M.INTEGER:return this.#k();case M.DECIMAL:return this.#E();case M.GROUPER:return this.#n==="("?this.#v():this.#n==="{"?this.#f():this.#n==="["?this.#h():void 0;case M.COLON:throw new Error('unexpected token ":"');default:return}}#h(){let t=[];do{if(this.#o(),this._matches(M.GROUPER,"]"))break;t.push(this.#s())}while(this._matches(M.COMMA));return this.#o(M.GROUPER,"]"),this.#r.list(t)}#f(){let t={};do{if(this.#o(),this._matches(M.GROUPER,"}"))break;let e=this.#n;(this._matches(M.STRING)||this._matches(M.IDENTIFIER))&&this.#o(),this.#o(M.COLON),t[e]=this.#s()}while(this._matches(M.COMMA));return this.#o(M.GROUPER,"}"),this.#r.map(t)}#g(){let t=this.#n;if(t==="true")return this.#o(),this.#r.literal(!0);if(t==="false")return this.#o(),this.#r.literal(!1);if(t==="null")return this.#o(),this.#r.literal(null);if(t==="undefined")return this.#o(),this.#r.literal(void 0);let e=this.#b(),r=this.#u();return r?this.#r.invoke(e,void 0,r):e}#b(){if(!this._matches(M.IDENTIFIER))throw new Error(`expected identifier: ${this.#n}`);let t=this.#n;return this.#o(),this.#r.id(t)}#u(){if(!this._matches(M.GROUPER,"("))return;let t=[];do{if(this.#o(),this._matches(M.GROUPER,")"))break;let e=this.#s();t.push(e)}while(this._matches(M.COMMA));return this.#o(M.GROUPER,")"),t}#y(){this.#o();let t=this.#s();return this.#o(M.GROUPER,"]"),t}#v(){let t=this.#u();if(this._matches(M.ARROW)){this.#o();let e=this.#s(),r=t?.map(n=>n.value)??[];return this.#r.arrowFunction(r,e)}else return this.#r.paren(t[0])}#S(){let t=this.#r.literal(this.#n);return this.#o(),t}#k(t=""){let e=this.#r.literal(parseInt(`${t}${this.#n}`,10));return this.#o(),e}#E(t=""){let e=this.#r.literal(parseFloat(`${t}${this.#n}`));return this.#o(),e}};var{hasOwn:Uc,fromEntries:hu}=Object,pu={"+":(o,t)=>o+t,"-":(o,t)=>o-t,"*":(o,t)=>o*t,"/":(o,t)=>o/t,"%":(o,t)=>o%t,"==":(o,t)=>o==t,"!=":(o,t)=>o!=t,"===":(o,t)=>o===t,"!==":(o,t)=>o!==t,">":(o,t)=>o>t,">=":(o,t)=>o>=t,"<":(o,t)=>o<t,"<=":(o,t)=>o<=t,"||":(o,t)=>o||t,"&&":(o,t)=>o&&t,"??":(o,t)=>o??t,"|":(o,t)=>t(o),"|>":(o,t)=>t(o)},uu={"+":o=>o,"-":o=>-o,"!":o=>!o},Un=class{empty(){return{type:"Empty",evaluate(t){return t},getIds(t){return t}}}literal(t){return{type:"Literal",value:t,evaluate(e){return this.value},getIds(e){return e}}}id(t){return{type:"ID",value:t,evaluate(e){return this.value==="this"?e:e?.[this.value]},getIds(e){return e.push(this.value),e}}}unary(t,e){let r=uu[t];return{type:"Unary",operator:t,child:e,evaluate(n){return r(this.child.evaluate(n))},getIds(n){return this.child.getIds(n)}}}binary(t,e,r){let n=pu[e];return{type:"Binary",operator:e,left:t,right:r,evaluate(i){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(i),a,l;return this.left.type==="Getter"?(a=this.left.receiver.evaluate(i),l=this.left.name):this.left.type==="Index"?(a=this.left.receiver.evaluate(i),l=this.left.argument.evaluate(i)):this.left.type==="ID"&&(a=i,l=this.left.value),a===void 0?void 0:a[l]=s}return n(this.left.evaluate(i),this.right.evaluate(i))},getIds(i){return this.left.getIds(i),this.right.getIds(i),i}}}getter(t,e){return{type:"Getter",receiver:t,name:e,evaluate(r){return this.receiver.evaluate(r)?.[this.name]},getIds(r){return this.receiver.getIds(r),r}}}invoke(t,e,r){if(e!=null&&typeof e!="string")throw new Error("method not a string");return{type:"Invoke",receiver:t,method:e,arguments:r,evaluate(n){let i=this.receiver.evaluate(n),s=this.method?i:n?.this??n,a=this.method?i?.[e]:i,c=(this.arguments??[]).map(d=>d?.evaluate(n));return a?.apply?.(s,c)},getIds(n){return this.receiver.getIds(n),this.arguments?.forEach(i=>i?.getIds(n)),n}}}paren(t){return t}index(t,e){return{type:"Index",receiver:t,argument:e,evaluate(r){return this.receiver.evaluate(r)?.[this.argument.evaluate(r)]},getIds(r){return this.receiver.getIds(r),r}}}ternary(t,e,r){return{type:"Ternary",condition:t,trueExpr:e,falseExpr:r,evaluate(n){return this.condition.evaluate(n)?this.trueExpr.evaluate(n):this.falseExpr.evaluate(n)},getIds(n){return this.condition.getIds(n),this.trueExpr.getIds(n),this.falseExpr.getIds(n),n}}}map(t){return{type:"Map",entries:t,evaluate(e){let r={};if(t&&this.entries)for(let n in t){let i=this.entries[n];i&&(r[n]=i.evaluate(e))}return r},getIds(e){if(t&&this.entries)for(let r in t){let n=this.entries[r];n&&n.getIds(e)}return e}}}list(t){return{type:"List",items:t,evaluate(e){return this.items?.map(r=>r?.evaluate(e))},getIds(e){return this.items?.forEach(r=>r?.getIds(e)),e}}}arrowFunction(t,e){return{type:"ArrowFunction",params:t,body:e,evaluate(r){let n=this.params,i=this.body;return function(...s){let a=hu(n.map((c,d)=>[c,s[d]])),l=new Proxy(r??{},{set(c,d,h){return Uc(a,d)&&(a[d]=h),c[d]=h},get(c,d){return Uc(a,d)?a[d]:c[d]}});return i.evaluate(l)}},getIds(r){return this.body.getIds(r).filter(n=>!this.params.includes(n))}}}};var La=null,Hc={boundAttributeSuffix:rt.M,marker:rt.P,markerMatch:rt.A,HTML_RESULT:rt.C,getTemplateHtml:rt.L,overrideDirectiveResolve:(o,t)=>class extends o{_$AS(e,r){return t(this,r)}},patchDirectiveResolve:(o,t)=>{if(o.prototype._$AS.name!==t.name){La??=o.prototype._$AS.name;for(let e=o.prototype;e!==Object.prototype;e=Object.getPrototypeOf(e))if(e.hasOwnProperty(La))return void(e[La]=t);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,t){o._$litDirective$=t},getAttributePartCommittedValue:(o,t,e)=>{let r=it;return o.j=n=>r=n,o._$AI(t,o,e),r},connectedDisconnectable:o=>({...o,_$AU:!0}),resolveDirective:rt.V,AttributePart:rt.H,PropertyPart:rt.B,BooleanAttributePart:rt.N,EventPart:rt.U,ElementPart:rt.F,TemplateInstance:rt.R,isIterable:rt.D,ChildPart:rt.I};var{AttributePart:mu,PropertyPart:fu,BooleanAttributePart:gu,EventPart:bu}=Hc,za=new Un,Va=new Map,Wc=o=>o.replace(/-(-|\w)/g,(t,e)=>e.toUpperCase()),Hn=(o,t)=>{let e=Va.get(o);if(e===void 0){if(Va.has(o))return;if(o=o.trim(),o.startsWith("{{")&&o.endsWith("}}")){let r=o.substring(2,o.length-2).trim();e=new Pi(r,za).parse(),Va.set(o,e)}}return e?.evaluate(t)},yu=(o,t,e,r)=>{let n=o.getAttribute("if");if(n!==null&&Hn(n,t))return Wn(o,t,e,r)},Qc=/(?<!\\){{(.*?)(?:(?<!\\)}})/g,Gc=o=>/(?:\\{{)|(?:\\}})/g.test(o),Oi=o=>o.replaceAll(/\\{{/g,"{{").replace(/\\}}/g,"}}"),vu=(o,t,e,r)=>{let n=o.getAttribute("repeat");if(n!==null){let i=Hn(n,t);if(!i[Symbol.iterator])return O;let s=Mi(o),a=-1,l=[];for(let c of i){a++;let d=Object.create(t);d.item=c,d.index=a,d.this=t.this??t;let h=[];for(let m of s.parts){let v=m.update(d,e,r);m.type===1?h.push(...v):h.push(v)}let f={_$litType$:s,values:h};l.push(f)}return l}},Yc={if:yu,repeat:vu},xt=(o,t=Yc,e={},r)=>{let i=Mi(o).renderers;if(r){let a=Mi(r).renderers,l=i.super;l!==void 0?e={...i,...e,super:(c,d,h)=>(h={...a,...h,super:(f,m,v)=>Wn(r,f,m,v)},l(c,d,h))}:(e={...a,...i,...e},o=r)}else e={...i,...e};return s=>Wn(o,s,t,e)};var Wn=(o,t,e=Yc,r={})=>{let n=Mi(o),i=[];for(let a of n.parts){let l=a.update(t,e,r);a.type===1?i.push(...l):i.push(l)}return{_$litType$:n,values:i}},Xc=new Map,Mi=o=>{let t=Xc.get(o);return t===void 0&&Xc.set(o,t=wu(o)),t},wu=o=>{let t={h:void 0,el:o.cloneNode(!0),parts:[],renderers:{}},e=document.createTreeWalker(t.el.content,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT|NodeFilter.SHOW_COMMENT),r=e.currentNode,n=-1,i=[];for(;(r=e.nextNode())!==null;)if(r.nodeType===Node.COMMENT_NODE)n++;else if(r.nodeType===Node.ELEMENT_NODE){n++;let s=r;if(s.tagName==="TEMPLATE"){let l=s.getAttribute("type"),c=s.getAttribute("name"),d=s.getAttribute("call");if(d!==null||l!==null||c!==null){s.parentNode.insertBefore(document.createComment(""),s),i.push(s);let h;if(d!==null){let f=d.trim(),m=f.startsWith("{{")&&f.endsWith("}}");h=(v,x,u)=>{let g=s.getAttribute("data"),y=g===null?void 0:Hn(g,v);return(m?Hn(f,v):u[d])?.(y,x,u)}}else l!==null?h=(f,m,v)=>{let x=m[l];return x?.(s,f,m,v)}:(c==="super"?t.renderers.super=(f,m,v)=>{let x=v.super,u=Mi(s);return v={...v,...u.renderers},x(f,m,v)}:t.renderers[c]=(f,m,v)=>Wn(s,f,m,v),h=(f,m,v)=>{let x=v[c];return x?.(f,m,v)});t.parts.push({type:2,index:n,update:h});continue}}let a=s.getAttributeNames();for(let l of a){let c=s.getAttribute(l),d=c.split(Qc);if(d.length===1){Gc(c)&&s.setAttribute(l,Oi(c));continue}s.removeAttribute(l);let h=l,f=mu,m=l[0];m==="."?(h=Wc(l.substring(1)),f=fu):m==="?"?(h=l.substring(1),f=gu):m==="@"&&(h=Wc(l.substring(1)),f=bu);let v=[Oi(d[0])],x=[];for(let u=1;u<d.length;u+=2){let g=d[u];x.push($a(g,za)),v.push(Oi(d[u+1]))}t.parts.push({type:1,index:n,name:h,strings:v,ctor:f,update:(u,g,y)=>x.map(w=>w.evaluate(u))})}}else if(r.nodeType===Node.TEXT_NODE){let s=r,a=s.textContent,l=a.split(Qc);l.length>1?s.textContent=Oi(l[0]):Gc(a)&&(s.textContent=Oi(a));for(let c=1;c<l.length;c+=2){let d=l[c],h=$a(d,za);t.parts.push({type:2,index:++n,update:(m,v)=>h.evaluate(m)});let f=new Text(l[c+1].replace("\\{{","{{"));s.parentNode.insertBefore(f,s.nextSibling),s.parentNode.insertBefore(document.createComment(""),s.nextSibling),s=f,e.currentNode=f}}for(let s of i)s.remove();return t};var ja=Symbol.for("qti-components.context-root"),xu=()=>{if(typeof document>"u")return;let o=globalThis;o[ja]||(o[ja]=new Ti,o[ja].attach(document.documentElement))};xu();var Kc=[];var Ba=class extends Set{#t;constructor(t){super(),this.#t=t}add(t){return super.add(t),this.#e(),this}delete(t){let e=super.delete(t);return this.#e(),e}clear(){super.clear(),this.#e()}#e(){this.#t.isConnected?this.#r():queueMicrotask(()=>this.#r())}#r(){this.size===0?this.#t.removeAttribute("data-state"):this.#t.setAttribute("data-state",Array.from(this).join(" "))}},Fa="custom-state-support-probe";function qu(o){if(!("states"in ElementInternals.prototype))return"missing";if(typeof customElements>"u")return"modern";try{customElements.get(Fa)||customElements.define(Fa,class extends HTMLElement{});let t=o.call(document.createElement(Fa)).states;return t?(t.add("probe"),t.delete("probe"),"modern"):"missing"}catch{return"legacy"}}var Jc=!1;function Zc(){if(Jc)return"already-installed";if(typeof HTMLElement>"u"||typeof ElementInternals>"u")return"modern";let o=HTMLElement.prototype.attachInternals;if(!o)return"modern";let t=qu(o);return t==="modern"||(Jc=!0,HTMLElement.prototype.attachInternals=function(){let r=o.call(this);return Object.defineProperty(r,"states",{configurable:!0,enumerable:!0,value:new Ba(this)}),r}),t}Zc();for(let{tag:o,ctor:t}of Kc)customElements.get(o)||customElements.define(o,t);var xe=Symbol("computedItemContext");var j=Symbol("computedContext");var qt=Symbol("configContext");var Ar=Symbol("interactionContext");var F=Symbol("item");var td=[{identifier:"completionStatus",cardinality:"single",baseType:"string",value:"unknown",type:"outcome"},{identifier:"numAttempts",cardinality:"single",baseType:"integer",value:"0",type:"response"}];var Cu=/^[A-Za-z0-9-]+$/,Su=o=>typeof o=="string"&&Cu.test(o),Xb=o=>Su(o)?o:void 0,Ct=Symbol("qtiContext");var Ua={view:"candidate"},Qt=Symbol("sessionContext");var Ha={items:[],testOutcomeVariables:[]},at=Symbol("testContext");var P=q`
1
+ var vc=class{get shadowRoot(){return this.__host.__shadowRoot}constructor(t){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=t}checkValidity(){return console.warn("`ElementInternals.checkValidity()` was called on the server.This method always returns true."),!0}reportValidity(){return!0}setFormValue(){}setValidity(){}};var Wt=function(o,t,e,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?o!==t||!n:!t.has(o))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(o,e):n?n.value=e:t.set(o,e),e},et=function(o,t,e,i){if(e==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?o!==t||!i:!t.has(o))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?i:e==="a"?i.call(o):i?i.value:t.get(o)},Ei,An,_n,br,ka,yr,Tn,Ge,vr,we,Rn,wc;var B={__proto__:null};B.enumerable=!0;Object.freeze(B);var Ea=(we=class{constructor(t,e={}){if(Ei.set(this,!1),An.set(this,!1),_n.set(this,!1),br.set(this,!1),ka.set(this,Date.now()),yr.set(this,!1),Tn.set(this,void 0),Ge.set(this,void 0),vr.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:i,cancelable:n,composed:r}=e;Wt(this,Ei,!!n,"f"),Wt(this,An,!!i,"f"),Wt(this,_n,!!r,"f"),Wt(this,Tn,`${t}`,"f"),Wt(this,Ge,null,"f"),Wt(this,vr,!1,"f")}initEvent(t,e,i){throw new Error("Method not implemented.")}stopImmediatePropagation(){this.stopPropagation()}preventDefault(){Wt(this,br,!0,"f")}get target(){return et(this,Ge,"f")}get currentTarget(){return et(this,Ge,"f")}get srcElement(){return et(this,Ge,"f")}get type(){return et(this,Tn,"f")}get cancelable(){return et(this,Ei,"f")}get defaultPrevented(){return et(this,Ei,"f")&&et(this,br,"f")}get timeStamp(){return et(this,ka,"f")}composedPath(){return et(this,vr,"f")?[et(this,Ge,"f")]:[]}get returnValue(){return!et(this,Ei,"f")||!et(this,br,"f")}get bubbles(){return et(this,An,"f")}get composed(){return et(this,_n,"f")}get eventPhase(){return et(this,vr,"f")?we.AT_TARGET:we.NONE}get cancelBubble(){return et(this,yr,"f")}set cancelBubble(t){t&&Wt(this,yr,!0,"f")}stopPropagation(){Wt(this,yr,!0,"f")}get isTrusted(){return!1}},Ei=new WeakMap,An=new WeakMap,_n=new WeakMap,br=new WeakMap,ka=new WeakMap,yr=new WeakMap,Tn=new WeakMap,Ge=new WeakMap,vr=new WeakMap,we.NONE=0,we.CAPTURING_PHASE=1,we.AT_TARGET=2,we.BUBBLING_PHASE=3,we);Object.defineProperties(Ea.prototype,{initEvent:B,stopImmediatePropagation:B,preventDefault:B,target:B,currentTarget:B,srcElement:B,type:B,cancelable:B,defaultPrevented:B,timeStamp:B,composedPath:B,returnValue:B,bubbles:B,composed:B,eventPhase:B,cancelBubble:B,stopPropagation:B,isTrusted:B});var xc=(wc=class extends Ea{constructor(t,e={}){super(t,e),Rn.set(this,void 0),Wt(this,Rn,e?.detail??null,"f")}initCustomEvent(t,e,i,n){throw new Error("Method not implemented.")}get detail(){return et(this,Rn,"f")}},Rn=new WeakMap,wc);Object.defineProperties(xc.prototype,{detail:B});var ne=Ea,Ia=xc;var ot;var $f=(ot=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.MARGIN_RULE=9,this.__parentStyleSheet=null,this.cssText=""}get parentRule(){return null}get parentStyleSheet(){return this.__parentStyleSheet}get type(){return 0}},ot.STYLE_RULE=1,ot.CHARSET_RULE=2,ot.IMPORT_RULE=3,ot.MEDIA_RULE=4,ot.FONT_FACE_RULE=5,ot.PAGE_RULE=6,ot.NAMESPACE_RULE=10,ot.KEYFRAMES_RULE=7,ot.KEYFRAME_RULE=8,ot.SUPPORTS_RULE=12,ot.COUNTER_STYLE_RULE=11,ot.FONT_FEATURE_VALUES_RULE=14,ot.MARGIN_RULE=9,ot);globalThis.Event??=ne;globalThis.CustomEvent??=Ia;var _a=Symbol(),qc=o=>typeof o=="boolean"?o:o?.capture??!1,oe={__proto__:null};oe.enumerable=!0;Object.freeze(oe);var Pn=class{constructor(){this.__eventListeners=new Map,this.__captureEventListeners=new Map}addEventListener(t,e,i){if(e==null)return;let n=qc(i)?this.__captureEventListeners:this.__eventListeners,r=n.get(t);if(r===void 0)r=new Map,n.set(t,r);else if(r.has(e))return;let s=typeof i=="object"&&i?i:{};s.signal?.addEventListener("abort",()=>this.removeEventListener(t,e,i)),r.set(e,s??{})}removeEventListener(t,e,i){if(e==null)return;let n=qc(i)?this.__captureEventListeners:this.__eventListeners,r=n.get(t);r!==void 0&&(r.delete(e),r.size||n.delete(t))}dispatchEvent(t){let e=this.__resolveFullEventPath();!t.composed&&this.__host&&(e=e.slice(0,e.indexOf(this.__host)));let i=!1,n=!1,r=ne.NONE,s=null,a=null,l=null,c=t.stopPropagation,d=t.stopImmediatePropagation;Object.defineProperties(t,{target:{get(){return s??a},...oe},srcElement:{get(){return t.target},...oe},currentTarget:{get(){return l},...oe},eventPhase:{get(){return r},...oe},composedPath:{value:()=>e,...oe},stopPropagation:{value:()=>{i=!0,c.call(t)},...oe},stopImmediatePropagation:{value:()=>{n=!0,d.call(t)},...oe}});let h=(u,g,y)=>{typeof u=="function"?u(t):typeof u?.handleEvent=="function"&&u.handleEvent(t),g.once&&y.delete(u)},f=()=>(l=null,r=ne.NONE,!t.defaultPrevented),m=e.slice().reverse();s=!this.__host||!t.composed?this:null;let v=u=>{for(a=this;a.__host&&u.includes(a.__host);)a=a.__host};for(let u of m){!s&&(!a||a===u.__host)&&v(m.slice(m.indexOf(u))),l=u,r=u===t.target?ne.AT_TARGET:ne.CAPTURING_PHASE;let g=u.__captureEventListeners.get(t.type);if(g){for(let[y,w]of g)if(h(y,w,g),n)return f()}if(i)return f()}let x=t.bubbles?e:[this];a=null;for(let u of x){!s&&(!a||u===a.__host)&&v(x.slice(0,x.indexOf(u)+1)),l=u,r=u===t.target?ne.AT_TARGET:ne.BUBBLING_PHASE;let g=u.__eventListeners.get(t.type);if(g){for(let[y,w]of g)if(h(y,w,g),n)return f()}if(i)return f()}return f()}__resolveFullEventPath(){return this.__eventPathCache?this.__eventPathCache:this.__eventTargetParent?this.__eventPathCache=[this,...this.__eventTargetParent.__resolveFullEventPath()]:this.__eventPathCache=[this,kc,Jp]}};var Cc=new WeakMap,wr=o=>{let t=Cc.get(o);return t===void 0&&Cc.set(o,t=new Map),t},xr=class extends Pn{getRootNode(t){return t?.composed?Aa:this.__host?.__shadowRoot??Aa}};var Sc=class extends xr{get adoptedStyleSheets(){return[]}createTreeWalker(){return{}}createTextNode(){return{}}createElement(){return{}}};var kc=new Sc,Aa=kc;var Ec=class extends xr{constructor(t){if(super(),t!==_a)throw new TypeError("Illegal constructor");Object.assign(this,globalThis,{CustomElementRegistry:On,customElements:Ra,document:Aa,Document:Sc,Element:Ic,EventTarget:Pn,HTMLElement:Ac,Node:xr,ShadowRoot:_c,window:this,Window:Ec})}};var Ic=class extends xr{constructor(){super(...arguments),this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from(wr(this)).map(([t,e])=>({name:t,value:e}))}get shadowRoot(){return this.__shadowRootMode==="closed"?null:this.__shadowRoot}get localName(){return this.constructor.__localName}get tagName(){return this.localName?.toUpperCase()}setAttribute(t,e){wr(this).set(t,String(e))}removeAttribute(t){wr(this).delete(t)}toggleAttribute(t,e){if(this.hasAttribute(t)){if(e===void 0||!e)return this.removeAttribute(t),!1}else return e===void 0||e?(this.setAttribute(t,""),!0):!1;return!0}hasAttribute(t){return wr(this).has(t)}attachShadow(t){this.__shadowRootMode=t.mode;let e=new _c(_a,t);return e.__eventTargetParent=this,e.__host=this,this.__shadowRoot=e}attachInternals(){if(this.__internals!==null)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");let t=new vc(this);return this.__internals=t,t}getAttribute(t){return wr(this).get(t)??null}};var Ac=class extends Ic{},Ta=Ac;var _c=class extends xr{get host(){return this.__host}constructor(t,e){if(super(),t!==t)throw new TypeError("Illegal constructor");this.mode=e.mode}};globalThis.litServerRoot??=Object.defineProperty(new Ta,"localName",{get(){return"lit-server-root"}});function Yp(){let o,t;return{promise:new Promise((i,n)=>{o=i,t=n}),resolve:o,reject:t}}var On=class{constructor(){this.__definitions=new Map,this.__reverseDefinitions=new Map,this.__pendingWhenDefineds=new Map}define(t,e){if(this.__definitions.has(t))if(process.env.NODE_ENV==="development")console.warn(`'CustomElementRegistry' already has "${t}" 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 "${t}" 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=t,this.__definitions.set(t,{ctor:e,observedAttributes:e.observedAttributes??[]}),this.__reverseDefinitions.set(e,t),this.__pendingWhenDefineds.get(t)?.resolve(e),this.__pendingWhenDefineds.delete(t)}get(t){return this.__definitions.get(t)?.ctor}getName(t){return this.__reverseDefinitions.get(t)??null}initialize(t){throw new Error("customElements.initialize is not currently supported in SSR. Please file a bug if you need it.")}upgrade(t){throw new Error("customElements.upgrade is not currently supported in SSR. Please file a bug if you need it.")}async whenDefined(t){let e=this.__definitions.get(t);if(e)return e.ctor;let i=this.__pendingWhenDefineds.get(t);return i||(i=Yp(),this.__pendingWhenDefineds.set(t,i)),i.promise}},Kp=On;var Ra=new Kp,Jp=new Ec(_a);var qr=globalThis,Mn=qr.ShadowRoot&&(qr.ShadyCSS===void 0||qr.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Pa=Symbol(),Tc=new WeakMap,Cr=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==Pa)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,e=this.t;if(Mn&&t===void 0){let i=e!==void 0&&e.length===1;i&&(t=Tc.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&Tc.set(e,t))}return t}toString(){return this.cssText}},Rc=o=>new Cr(typeof o=="string"?o:o+"",void 0,Pa),q=(o,...t)=>{let e=o.length===1?o[0]:t.reduce((i,n,r)=>i+(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.")})(n)+o[r+1],o[0]);return new Cr(e,o,Pa)},Pc=(o,t)=>{if(Mn)o.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let i=document.createElement("style"),n=qr.litNonce;n!==void 0&&i.setAttribute("nonce",n),i.textContent=e.cssText,o.appendChild(i)}},Oa=Mn||qr.CSSStyleSheet===void 0?o=>o:o=>o instanceof CSSStyleSheet?(t=>{let e="";for(let i of t.cssRules)e+=i.cssText;return Rc(e)})(o):o;var{is:Zp,defineProperty:tu,getOwnPropertyDescriptor:eu,getOwnPropertyNames:iu,getOwnPropertySymbols:ru,getPrototypeOf:nu}=Object,Er=globalThis;Er.customElements??=Ra;var Oc=Er.trustedTypes,ou=Oc?Oc.emptyScript:"",su=Er.reactiveElementPolyfillSupport,Sr=(o,t)=>o,kr={toAttribute(o,t){switch(t){case Boolean:o=o?ou:null;break;case Object:case Array:o=o==null?o:JSON.stringify(o)}return o},fromAttribute(o,t){let e=o;switch(t){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}},Dn=(o,t)=>!Zp(o,t),Mc={attribute:!0,type:String,converter:kr,reflect:!1,useDefault:!1,hasChanged:Dn};Symbol.metadata??=Symbol("metadata"),Er.litPropertyMetadata??=new WeakMap;var se=class extends(globalThis.HTMLElement??Ta){static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=Mc){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){let i=Symbol(),n=this.getPropertyDescriptor(t,i,e);n!==void 0&&tu(this.prototype,t,n)}}static getPropertyDescriptor(t,e,i){let{get:n,set:r}=eu(this.prototype,t)??{get(){return this[e]},set(s){this[e]=s}};return{get:n,set(s){let a=n?.call(this);r?.call(this,s),this.requestUpdate(t,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Mc}static _$Ei(){if(this.hasOwnProperty(Sr("elementProperties")))return;let t=nu(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(Sr("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Sr("properties"))){let e=this.properties,i=[...iu(e),...ru(e)];for(let n of i)this.createProperty(n,e[n])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[i,n]of e)this.elementProperties.set(i,n)}this._$Eh=new Map;for(let[e,i]of this.elementProperties){let n=this._$Eu(e,i);n!==void 0&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let i=new Set(t.flat(1/0).reverse());for(let n of i)e.unshift(Oa(n))}else t!==void 0&&e.push(Oa(t));return e}static _$Eu(t,e){let i=e.attribute;return i===!1?void 0:typeof i=="string"?i:typeof t=="string"?t.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(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let i of e.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Pc(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$ET(t,e){let i=this.constructor.elementProperties.get(t),n=this.constructor._$Eu(t,i);if(n!==void 0&&i.reflect===!0){let r=(i.converter?.toAttribute!==void 0?i.converter:kr).toAttribute(e,i.type);this._$Em=t,r==null?this.removeAttribute(n):this.setAttribute(n,r),this._$Em=null}}_$AK(t,e){let i=this.constructor,n=i._$Eh.get(t);if(n!==void 0&&this._$Em!==n){let r=i.getPropertyOptions(n),s=typeof r.converter=="function"?{fromAttribute:r.converter}:r.converter?.fromAttribute!==void 0?r.converter:kr;this._$Em=n;let a=s.fromAttribute(e,r.type);this[n]=a??this._$Ej?.get(n)??a,this._$Em=null}}requestUpdate(t,e,i,n=!1,r){if(t!==void 0){let s=this.constructor;if(n===!1&&(r=this[t]),i??=s.getPropertyOptions(t),!((i.hasChanged??Dn)(r,e)||i.useDefault&&i.reflect&&r===this._$Ej?.get(t)&&!this.hasAttribute(s._$Eu(t,i))))return;this.C(t,e,i)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,e,{useDefault:i,reflect:n,wrapped:r},s){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,s??e??this[t]),r!==!0||s!==void 0)||(this._$AL.has(t)||(this.hasUpdated||i||(e=void 0),this._$AL.set(t,e)),n===!0&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[n,r]of this._$Ep)this[n]=r;this._$Ep=void 0}let i=this.constructor.elementProperties;if(i.size>0)for(let[n,r]of i){let{wrapped:s}=r,a=this[n];s!==!0||this._$AL.has(n)||a===void 0||this.C(n,void 0,r,a)}}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(i=>i.hostUpdate?.()),this.update(e)):this._$EM()}catch(i){throw t=!1,this._$EM(),i}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(t){}firstUpdated(t){}};se.elementStyles=[],se.shadowRootOptions={mode:"open"},se[Sr("elementProperties")]=new Map,se[Sr("finalized")]=new Map,su?.({ReactiveElement:se}),(Er.reactiveElementVersions??=[]).push("2.1.2");var Fn=globalThis,Dc=o=>o,Nn=Fn.trustedTypes,Nc=Nn?Nn.createPolicy("lit-html",{createHTML:o=>o}):void 0,Da="$lit$",ae=`lit$${Math.random().toFixed(9).slice(2)}$`,Na="?"+ae,au=`<${Na}>`,Je=Fn.document===void 0?{createTreeWalker:()=>({})}:document,Ar=()=>Je.createComment(""),_r=o=>o===null||typeof o!="object"&&typeof o!="function",$a=Array.isArray,Fc=o=>$a(o)||typeof o?.[Symbol.iterator]=="function",Ma=`[
3
+ \f\r]`,Ir=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,$c=/-->/g,Lc=/>/g,Ye=RegExp(`>|${Ma}(?:([^\\s"'>=/]+)(${Ma}*=${Ma}*(?:[^
4
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Vc=/'/g,zc=/"/g,Bc=/^(?:script|style|textarea|title)$/i,La=o=>(t,...e)=>({_$litType$:o,strings:t,values:e}),b=La(1),Rr=La(2),gg=La(3),rt=Symbol.for("lit-noChange"),O=Symbol.for("lit-nothing"),jc=new WeakMap,Ke=Je.createTreeWalker(Je,129);function Uc(o,t){if(!$a(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return Nc!==void 0?Nc.createHTML(t):t}var Hc=(o,t)=>{let e=o.length-1,i=[],n,r=t===2?"<svg>":t===3?"<math>":"",s=Ir;for(let a=0;a<e;a++){let l=o[a],c,d,h=-1,f=0;for(;f<l.length&&(s.lastIndex=f,d=s.exec(l),d!==null);)f=s.lastIndex,s===Ir?d[1]==="!--"?s=$c:d[1]!==void 0?s=Lc:d[2]!==void 0?(Bc.test(d[2])&&(n=RegExp("</"+d[2],"g")),s=Ye):d[3]!==void 0&&(s=Ye):s===Ye?d[0]===">"?(s=n??Ir,h=-1):d[1]===void 0?h=-2:(h=s.lastIndex-d[2].length,c=d[1],s=d[3]===void 0?Ye:d[3]==='"'?zc:Vc):s===zc||s===Vc?s=Ye:s===$c||s===Lc?s=Ir:(s=Ye,n=void 0);let m=s===Ye&&o[a+1].startsWith("/>")?" ":"";r+=s===Ir?l+au:h>=0?(i.push(c),l.slice(0,h)+Da+l.slice(h)+ae+m):l+ae+(h===-2?a:m)}return[Uc(o,r+(o[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),i]},Tr=class o{constructor({strings:t,_$litType$:e},i){let n;this.parts=[];let r=0,s=0,a=t.length-1,l=this.parts,[c,d]=Hc(t,e);if(this.el=o.createElement(c,i),Ke.currentNode=this.el.content,e===2||e===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(n=Ke.nextNode())!==null&&l.length<a;){if(n.nodeType===1){if(n.hasAttributes())for(let h of n.getAttributeNames())if(h.endsWith(Da)){let f=d[s++],m=n.getAttribute(h).split(ae),v=/([.?@])?(.*)/.exec(f);l.push({type:1,index:r,name:v[2],strings:m,ctor:v[1]==="."?Ln:v[1]==="?"?Vn:v[1]==="@"?zn:ti}),n.removeAttribute(h)}else h.startsWith(ae)&&(l.push({type:6,index:r}),n.removeAttribute(h));if(Bc.test(n.tagName)){let h=n.textContent.split(ae),f=h.length-1;if(f>0){n.textContent=Nn?Nn.emptyScript:"";for(let m=0;m<f;m++)n.append(h[m],Ar()),Ke.nextNode(),l.push({type:2,index:++r});n.append(h[f],Ar())}}}else if(n.nodeType===8)if(n.data===Na)l.push({type:2,index:r});else{let h=-1;for(;(h=n.data.indexOf(ae,h+1))!==-1;)l.push({type:7,index:r}),h+=ae.length-1}r++}}static createElement(t,e){let i=Je.createElement("template");return i.innerHTML=t,i}};function Ze(o,t,e=o,i){if(t===rt)return t;let n=i!==void 0?e._$Co?.[i]:e._$Cl,r=_r(t)?void 0:t._$litDirective$;return n?.constructor!==r&&(n?._$AO?.(!1),r===void 0?n=void 0:(n=new r(o),n._$AT(o,e,i)),i!==void 0?(e._$Co??=[])[i]=n:e._$Cl=n),n!==void 0&&(t=Ze(o,n._$AS(o,t.values),n,i)),t}var $n=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:e},parts:i}=this._$AD,n=(t?.creationScope??Je).importNode(e,!0);Ke.currentNode=n;let r=Ke.nextNode(),s=0,a=0,l=i[0];for(;l!==void 0;){if(s===l.index){let c;l.type===2?c=new Ii(r,r.nextSibling,this,t):l.type===1?c=new l.ctor(r,l.name,l.strings,this,t):l.type===6&&(c=new jn(r,this,t)),this._$AV.push(c),l=i[++a]}s!==l?.index&&(r=Ke.nextNode(),s++)}return Ke.currentNode=Je,n}p(t){let e=0;for(let i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}},Ii=class o{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,i,n){this.type=2,this._$AH=O,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=n,this._$Cv=n?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=Ze(this,t,e),_r(t)?t===O||t==null||t===""?(this._$AH!==O&&this._$AR(),this._$AH=O):t!==this._$AH&&t!==rt&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Fc(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==O&&_r(this._$AH)?this._$AA.nextSibling.data=t:this.T(Je.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:i}=t,n=typeof i=="number"?this._$AC(t):(i.el===void 0&&(i.el=Tr.createElement(Uc(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===n)this._$AH.p(e);else{let r=new $n(n,this),s=r.u(this.options);r.p(e),this.T(s),this._$AH=r}}_$AC(t){let e=jc.get(t.strings);return e===void 0&&jc.set(t.strings,e=new Tr(t)),e}k(t){$a(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,i,n=0;for(let r of t)n===e.length?e.push(i=new o(this.O(Ar()),this.O(Ar()),this,this.options)):i=e[n],i._$AI(r),n++;n<e.length&&(this._$AR(i&&i._$AB.nextSibling,n),e.length=n)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){let i=Dc(t).nextSibling;Dc(t).remove(),t=i}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},ti=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,i,n,r){this.type=1,this._$AH=O,this._$AN=void 0,this.element=t,this.name=e,this._$AM=n,this.options=r,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=O}_$AI(t,e=this,i,n){let r=this.strings,s=!1;if(r===void 0)t=Ze(this,t,e,0),s=!_r(t)||t!==this._$AH&&t!==rt,s&&(this._$AH=t);else{let a=t,l,c;for(t=r[0],l=0;l<r.length-1;l++)c=Ze(this,a[i+l],e,l),c===rt&&(c=this._$AH[l]),s||=!_r(c)||c!==this._$AH[l],c===O?t=O:t!==O&&(t+=(c??"")+r[l+1]),this._$AH[l]=c}s&&!n&&this.j(t)}j(t){t===O?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},Ln=class extends ti{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===O?void 0:t}},Vn=class extends ti{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==O)}},zn=class extends ti{constructor(t,e,i,n,r){super(t,e,i,n,r),this.type=5}_$AI(t,e=this){if((t=Ze(this,t,e,0)??O)===rt)return;let i=this._$AH,n=t===O&&i!==O||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,r=t!==O&&(i===O||n);n&&this.element.removeEventListener(this.name,this,i),r&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},jn=class{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){Ze(this,t)}},it={M:Da,P:ae,A:Na,C:1,L:Hc,R:$n,D:Fc,V:Ze,I:Ii,H:ti,N:Vn,U:zn,B:Ln,F:jn},lu=Fn.litHtmlPolyfillSupport;lu?.(Tr,Ii),(Fn.litHtmlVersions??=[]).push("3.3.3");var Va=(o,t,e)=>{let i=e?.renderBefore??t,n=i._$litPart$;if(n===void 0){let r=e?.renderBefore??null;i._$litPart$=n=new Ii(t.insertBefore(Ar(),r),r,void 0,e??{})}return n._$AI(o),n};var za=globalThis,C=class extends se{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Va(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return rt}};C._$litElement$=!0,C.finalized=!0,za.litElementHydrateSupport?.({LitElement:C});var cu=za.litElementPolyfillSupport;cu?.({LitElement:C});(za.litElementVersions??=[]).push("4.2.2");var du={attribute:!0,type:String,converter:kr,reflect:!1,hasChanged:Dn},hu=(o=du,t,e)=>{let{kind:i,metadata:n}=e,r=globalThis.litPropertyMetadata.get(n);if(r===void 0&&globalThis.litPropertyMetadata.set(n,r=new Map),i==="setter"&&((o=Object.create(o)).wrapped=!0),r.set(e.name,o),i==="accessor"){let{name:s}=e;return{set(a){let l=t.get.call(this);t.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(i==="setter"){let{name:s}=e;return function(a){let l=this[s];t.call(this,a),this.requestUpdate(s,l,o,!0,a)}}throw Error("Unsupported decorator location: "+i)};function p(o){return(t,e)=>typeof e=="object"?hu(o,t,e):((i,n,r)=>{let s=n.hasOwnProperty(r);return n.constructor.createProperty(r,i),s?Object.getOwnPropertyDescriptor(n,r):void 0})(o,t,e)}function T(o){return p({...o,state:!0,attribute:!1})}var xe=(o,t,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(o,t,e),e);function Ai(o,t){return(e,i,n)=>{let r=s=>s.renderRoot?.querySelector(o)??null;if(t){let{get:s,set:a}=typeof i=="object"?e:n??(()=>{let l=Symbol();return{get(){return this[l]},set(c){this[l]=c}}})();return xe(e,i,{get(){let l=s.call(this);return l===void 0&&(l=r(this),(l!==null||this.hasUpdated)&&a.call(this,l)),l}})}return xe(e,i,{get(){return r(this)}})}}function Wc(o){return(t,e)=>{let{slot:i,selector:n}=o??{},r="slot"+(i?`[name=${i}]`:":not([name])");return xe(t,e,{get(){let s=this.renderRoot?.querySelector(r),a=s?.assignedElements(o)??[];return n===void 0?a:a.filter(l=>l.matches(n))}})}}var le=class extends Event{constructor(t,e,i,n){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e,this.callback=i,this.subscribe=n??!1}};var wt=class{constructor(t,e,i,n){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(r,s)=>{this.unsubscribe&&(this.unsubscribe!==s&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=r,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(r,s)),this.unsubscribe=s},this.host=t,e.context!==void 0){let r=e;this.context=r.context,this.callback=r.callback,this.subscribe=r.subscribe??!1}else this.context=e,this.callback=i,this.subscribe=n??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new le(this.context,this.host,this.t,this.subscribe))}};var Bn=class{get value(){return this.o}set value(t){this.setValue(t)}setValue(t,e=!1){let i=e||!Object.is(t,this.o);this.o=t,i&&this.updateObservers()}constructor(t){this.subscriptions=new Map,this.updateObservers=()=>{for(let[e,{disposer:i}]of this.subscriptions)e(this.o,i)},t!==void 0&&(this.value=t)}addCallback(t,e,i){if(!i)return void t(this.value);this.subscriptions.has(t)||this.subscriptions.set(t,{disposer:()=>{this.subscriptions.delete(t)},consumerHost:e});let{disposer:n}=this.subscriptions.get(t);t(this.value,n)}clearCallbacks(){this.subscriptions.clear()}};var ja=class extends Event{constructor(t,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e}},qe=class extends Bn{constructor(t,e,i){super(e.context!==void 0?e.initialValue:i),this.onContextRequest=n=>{if(n.context!==this.context)return;let r=n.contextTarget??n.composedPath()[0];r!==this.host&&(n.stopPropagation(),this.addCallback(n.callback,r,n.subscribe))},this.onProviderRequest=n=>{if(n.context!==this.context||(n.contextTarget??n.composedPath()[0])===this.host)return;let r=new Set;for(let[s,{consumerHost:a}]of this.subscriptions)r.has(s)||(r.add(s),a.dispatchEvent(new le(this.context,a,s,!0)));n.stopPropagation()},this.host=t,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 ja(this.context,this.host))}};var Pr=class{constructor(){this.pendingContextRequests=new Map,this.onContextProvider=t=>{let e=this.pendingContextRequests.get(t.context);if(e===void 0)return;this.pendingContextRequests.delete(t.context);let{requests:i}=e;for(let{elementRef:n,callbackRef:r}of i){let s=n.deref(),a=r.deref();s===void 0||a===void 0||s.dispatchEvent(new le(t.context,s,a,!0))}},this.onContextRequest=t=>{if(t.subscribe!==!0)return;let e=t.contextTarget??t.composedPath()[0],i=t.callback,n=this.pendingContextRequests.get(t.context);n===void 0&&this.pendingContextRequests.set(t.context,n={callbacks:new WeakMap,requests:[]});let r=n.callbacks.get(e);r===void 0&&n.callbacks.set(e,r=new WeakSet),r.has(i)||(r.add(i),n.requests.push({elementRef:new WeakRef(e),callbackRef:new WeakRef(i)}))}}attach(t){t.addEventListener("context-request",this.onContextRequest),t.addEventListener("context-provider",this.onContextProvider)}detach(t){t.removeEventListener("context-request",this.onContextRequest),t.removeEventListener("context-provider",this.onContextProvider)}};function U({context:o}){return(t,e)=>{let i=new WeakMap;if(typeof e=="object")return{get(){return t.get.call(this)},set(n){return i.get(this).setValue(n),t.set.call(this,n)},init(n){return i.set(this,new qe(this,{context:o,initialValue:n})),n}};{t.constructor.addInitializer((s=>{i.set(s,new qe(s,{context:o}))}));let n=Object.getOwnPropertyDescriptor(t,e),r;if(n===void 0){let s=new WeakMap;r={get(){return s.get(this)},set(a){i.get(this).setValue(a),s.set(this,a)},configurable:!0,enumerable:!0}}else{let s=n.set;r={...n,set(a){i.get(this).setValue(a),s?.call(this,a)}}}return void Object.defineProperty(t,e,r)}}}function _({context:o,subscribe:t}){return(e,i)=>{typeof i=="object"?i.addInitializer((function(){new wt(this,{context:o,callback:n=>{e.set.call(this,n)},subscribe:t})})):e.constructor.addInitializer((n=>{new wt(n,{context:o,callback:r=>{n[i]=r},subscribe:t})}))}}var Un=["this"],Qc=["+","-","!"],Xc=["=","+","-","*","/","%","^","==","!=",">","<",">=","<=","||","&&","??","&","===","!==","|","|>"],Fa={"!":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},Hn=13;var pu=["==","!=","<=",">=","||","&&","??","|>"],uu=["===","!=="],M;(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"})(M||(M={}));var Qt=(o,t,e=0)=>({kind:o,value:t,precedence:e}),mu=o=>o===9||o===10||o===13||o===32,Gc=o=>o===95||o===36||(o&=-33,65<=o&&o<=90),fu=o=>Gc(o)||Or(o),gu=o=>Un.indexOf(o)!==-1,bu=o=>o===34||o===39,Or=o=>48<=o&&o<=57,yu=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,vu=o=>o===40||o===41||o===91||o===93||o===123||o===125,wu=o=>o.replace(/\\(.)/g,(t,e)=>{switch(e){case"n":return`
5
+ `;case"r":return"\r";case"t":return" ";case"b":return"\b";case"f":return"\f";default:return e}}),Wn=class{#t;#e=-1;#i=0;#r;constructor(t){this.#t=t,this.#n()}nextToken(){for(;mu(this.#r);)this.#n(!0);if(bu(this.#r))return this.#a();if(Gc(this.#r))return this.#c();if(Or(this.#r))return this.#p();if(this.#r===46)return this.#l();if(this.#r===44)return this.#d();if(this.#r===58)return this.#m();if(yu(this.#r))return this.#f();if(vu(this.#r))return this.#g();if(this.#n(),this.#r!==void 0)throw new Error(`Expected end of input, got ${this.#r}`)}#n(t){this.#e++,this.#e<this.#t.length?(this.#r=this.#t.charCodeAt(this.#e),t===!0&&(this.#i=this.#e)):this.#r=void 0}#o(t=0){let e=this.#t.substring(this.#i,this.#e+t);return t===0&&this.#s(),e}#s(){this.#i=this.#e}#a(){let t="unterminated string",e=this.#r;for(this.#n(!0);this.#r!==e;){if(this.#r===void 0)throw new Error(t);if(this.#r===92&&(this.#n(),this.#r===void 0))throw new Error(t);this.#n()}let i=Qt(M.STRING,wu(this.#o()));return this.#n(),i}#c(){do this.#n();while(fu(this.#r));let t=this.#o(),e=gu(t)?M.KEYWORD:M.IDENTIFIER;return Qt(e,t)}#p(){do this.#n();while(Or(this.#r));return this.#r===46?this.#l():Qt(M.INTEGER,this.#o())}#l(){return this.#n(),Or(this.#r)?this.#h():(this.#s(),Qt(M.DOT,".",Hn))}#d(){return this.#n(!0),Qt(M.COMMA,",")}#m(){return this.#n(!0),Qt(M.COLON,":")}#h(){do this.#n();while(Or(this.#r));return Qt(M.DECIMAL,this.#o())}#f(){this.#n();let t=this.#o(2);if(uu.indexOf(t)!==-1)this.#n(),this.#n();else{if(t=this.#o(1),t==="=>")return this.#n(),Qt(M.ARROW,t);pu.indexOf(t)!==-1&&this.#n()}return t=this.#o(),Qt(M.OPERATOR,t,Fa[t])}#g(){let t=String.fromCharCode(this.#r),e=Qt(M.GROUPER,t,Fa[t]);return this.#n(!0),e}};var Ba=(o,t)=>new Mr(o,t).parse(),Mr=class{#t;#e;#i;#r;#n;constructor(t,e){this.#e=new Wn(t),this.#i=e}parse(){return this.#o(),this.#s()}#o(t,e){if(!this._matches(t,e))throw new Error(`Expected kind ${t} (${e}), was ${this.#r?.kind} (${this.#r?.value})`);let i=this.#e.nextToken();this.#r=i,this.#t=i?.kind,this.#n=i?.value}_matches(t,e){return!(t&&this.#t!==t||e&&this.#n!==e)}#s(){if(!this.#r)return this.#i.empty();let t=this.#l();return t===void 0?void 0:this.#a(t,0)}#a(t,e){if(t===void 0)throw new Error("Expected left to be defined.");for(;this.#r;)if(this._matches(M.GROUPER,"(")){let i=this.#u();t=this.#i.invoke(t,void 0,i)}else if(this._matches(M.GROUPER,"[")){let i=this.#y();t=this.#i.index(t,i)}else if(this._matches(M.DOT)){this.#o();let i=this.#l();t=this.#c(t,i)}else{if(this._matches(M.KEYWORD))break;if(this._matches(M.OPERATOR)&&this.#r.precedence>=e)t=this.#n==="?"?this.#d(t):this.#p(t,this.#r);else break}return t}#c(t,e){if(e===void 0)throw new Error("expected identifier");if(e.type==="ID")return this.#i.getter(t,e.value);if(e.type==="Invoke"&&e.receiver.type==="ID"){let i=e.receiver;return this.#i.invoke(t,i.value,e.arguments)}else throw new Error(`expected identifier: ${e}`)}#p(t,e){if(Xc.indexOf(e.value)===-1)throw new Error(`unknown operator: ${e.value}`);this.#o();let i=this.#l();for(;(this.#t===M.OPERATOR||this.#t===M.DOT||this.#t===M.GROUPER)&&this.#r.precedence>e.precedence;)i=this.#a(i,this.#r.precedence);return this.#i.binary(t,e.value,i)}#l(){if(this._matches(M.OPERATOR)){let t=this.#n;if(this.#o(),t==="+"||t==="-"){if(this._matches(M.INTEGER))return this.#k(t);if(this._matches(M.DECIMAL))return this.#E(t)}if(Qc.indexOf(t)===-1)throw new Error(`unexpected token: ${t}`);let e=this.#a(this.#m(),Hn);return this.#i.unary(t,e)}return this.#m()}#d(t){this.#o(M.OPERATOR,"?");let e=this.#s();this.#o(M.COLON);let i=this.#s();return this.#i.ternary(t,e,i)}#m(){switch(this.#t){case M.KEYWORD:let t=this.#n;if(t==="this")return this.#o(),this.#i.id(t);throw Un.indexOf(t)!==-1?new Error(`unexpected keyword: ${t}`):new Error(`unrecognized keyword: ${t}`);case M.IDENTIFIER:return this.#g();case M.STRING:return this.#S();case M.INTEGER:return this.#k();case M.DECIMAL:return this.#E();case M.GROUPER:return this.#n==="("?this.#v():this.#n==="{"?this.#f():this.#n==="["?this.#h():void 0;case M.COLON:throw new Error('unexpected token ":"');default:return}}#h(){let t=[];do{if(this.#o(),this._matches(M.GROUPER,"]"))break;t.push(this.#s())}while(this._matches(M.COMMA));return this.#o(M.GROUPER,"]"),this.#i.list(t)}#f(){let t={};do{if(this.#o(),this._matches(M.GROUPER,"}"))break;let e=this.#n;(this._matches(M.STRING)||this._matches(M.IDENTIFIER))&&this.#o(),this.#o(M.COLON),t[e]=this.#s()}while(this._matches(M.COMMA));return this.#o(M.GROUPER,"}"),this.#i.map(t)}#g(){let t=this.#n;if(t==="true")return this.#o(),this.#i.literal(!0);if(t==="false")return this.#o(),this.#i.literal(!1);if(t==="null")return this.#o(),this.#i.literal(null);if(t==="undefined")return this.#o(),this.#i.literal(void 0);let e=this.#b(),i=this.#u();return i?this.#i.invoke(e,void 0,i):e}#b(){if(!this._matches(M.IDENTIFIER))throw new Error(`expected identifier: ${this.#n}`);let t=this.#n;return this.#o(),this.#i.id(t)}#u(){if(!this._matches(M.GROUPER,"("))return;let t=[];do{if(this.#o(),this._matches(M.GROUPER,")"))break;let e=this.#s();t.push(e)}while(this._matches(M.COMMA));return this.#o(M.GROUPER,")"),t}#y(){this.#o();let t=this.#s();return this.#o(M.GROUPER,"]"),t}#v(){let t=this.#u();if(this._matches(M.ARROW)){this.#o();let e=this.#s(),i=t?.map(n=>n.value)??[];return this.#i.arrowFunction(i,e)}else return this.#i.paren(t[0])}#S(){let t=this.#i.literal(this.#n);return this.#o(),t}#k(t=""){let e=this.#i.literal(parseInt(`${t}${this.#n}`,10));return this.#o(),e}#E(t=""){let e=this.#i.literal(parseFloat(`${t}${this.#n}`));return this.#o(),e}};var{hasOwn:Yc,fromEntries:xu}=Object,qu={"+":(o,t)=>o+t,"-":(o,t)=>o-t,"*":(o,t)=>o*t,"/":(o,t)=>o/t,"%":(o,t)=>o%t,"==":(o,t)=>o==t,"!=":(o,t)=>o!=t,"===":(o,t)=>o===t,"!==":(o,t)=>o!==t,">":(o,t)=>o>t,">=":(o,t)=>o>=t,"<":(o,t)=>o<t,"<=":(o,t)=>o<=t,"||":(o,t)=>o||t,"&&":(o,t)=>o&&t,"??":(o,t)=>o??t,"|":(o,t)=>t(o),"|>":(o,t)=>t(o)},Cu={"+":o=>o,"-":o=>-o,"!":o=>!o},Qn=class{empty(){return{type:"Empty",evaluate(t){return t},getIds(t){return t}}}literal(t){return{type:"Literal",value:t,evaluate(e){return this.value},getIds(e){return e}}}id(t){return{type:"ID",value:t,evaluate(e){return this.value==="this"?e:e?.[this.value]},getIds(e){return e.push(this.value),e}}}unary(t,e){let i=Cu[t];return{type:"Unary",operator:t,child:e,evaluate(n){return i(this.child.evaluate(n))},getIds(n){return this.child.getIds(n)}}}binary(t,e,i){let n=qu[e];return{type:"Binary",operator:e,left:t,right:i,evaluate(r){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(r),a,l;return this.left.type==="Getter"?(a=this.left.receiver.evaluate(r),l=this.left.name):this.left.type==="Index"?(a=this.left.receiver.evaluate(r),l=this.left.argument.evaluate(r)):this.left.type==="ID"&&(a=r,l=this.left.value),a===void 0?void 0:a[l]=s}return n(this.left.evaluate(r),this.right.evaluate(r))},getIds(r){return this.left.getIds(r),this.right.getIds(r),r}}}getter(t,e){return{type:"Getter",receiver:t,name:e,evaluate(i){return this.receiver.evaluate(i)?.[this.name]},getIds(i){return this.receiver.getIds(i),i}}}invoke(t,e,i){if(e!=null&&typeof e!="string")throw new Error("method not a string");return{type:"Invoke",receiver:t,method:e,arguments:i,evaluate(n){let r=this.receiver.evaluate(n),s=this.method?r:n?.this??n,a=this.method?r?.[e]:r,c=(this.arguments??[]).map(d=>d?.evaluate(n));return a?.apply?.(s,c)},getIds(n){return this.receiver.getIds(n),this.arguments?.forEach(r=>r?.getIds(n)),n}}}paren(t){return t}index(t,e){return{type:"Index",receiver:t,argument:e,evaluate(i){return this.receiver.evaluate(i)?.[this.argument.evaluate(i)]},getIds(i){return this.receiver.getIds(i),i}}}ternary(t,e,i){return{type:"Ternary",condition:t,trueExpr:e,falseExpr:i,evaluate(n){return this.condition.evaluate(n)?this.trueExpr.evaluate(n):this.falseExpr.evaluate(n)},getIds(n){return this.condition.getIds(n),this.trueExpr.getIds(n),this.falseExpr.getIds(n),n}}}map(t){return{type:"Map",entries:t,evaluate(e){let i={};if(t&&this.entries)for(let n in t){let r=this.entries[n];r&&(i[n]=r.evaluate(e))}return i},getIds(e){if(t&&this.entries)for(let i in t){let n=this.entries[i];n&&n.getIds(e)}return e}}}list(t){return{type:"List",items:t,evaluate(e){return this.items?.map(i=>i?.evaluate(e))},getIds(e){return this.items?.forEach(i=>i?.getIds(e)),e}}}arrowFunction(t,e){return{type:"ArrowFunction",params:t,body:e,evaluate(i){let n=this.params,r=this.body;return function(...s){let a=xu(n.map((c,d)=>[c,s[d]])),l=new Proxy(i??{},{set(c,d,h){return Yc(a,d)&&(a[d]=h),c[d]=h},get(c,d){return Yc(a,d)?a[d]:c[d]}});return r.evaluate(l)}},getIds(i){return this.body.getIds(i).filter(n=>!this.params.includes(n))}}}};var Ua=null,Kc={boundAttributeSuffix:it.M,marker:it.P,markerMatch:it.A,HTML_RESULT:it.C,getTemplateHtml:it.L,overrideDirectiveResolve:(o,t)=>class extends o{_$AS(e,i){return t(this,i)}},patchDirectiveResolve:(o,t)=>{if(o.prototype._$AS.name!==t.name){Ua??=o.prototype._$AS.name;for(let e=o.prototype;e!==Object.prototype;e=Object.getPrototypeOf(e))if(e.hasOwnProperty(Ua))return void(e[Ua]=t);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,t){o._$litDirective$=t},getAttributePartCommittedValue:(o,t,e)=>{let i=rt;return o.j=n=>i=n,o._$AI(t,o,e),i},connectedDisconnectable:o=>({...o,_$AU:!0}),resolveDirective:it.V,AttributePart:it.H,PropertyPart:it.B,BooleanAttributePart:it.N,EventPart:it.U,ElementPart:it.F,TemplateInstance:it.R,isIterable:it.D,ChildPart:it.I};var{AttributePart:Su,PropertyPart:ku,BooleanAttributePart:Eu,EventPart:Iu}=Kc,Wa=new Qn,Ha=new Map,Jc=o=>o.replace(/-(-|\w)/g,(t,e)=>e.toUpperCase()),Xn=(o,t)=>{let e=Ha.get(o);if(e===void 0){if(Ha.has(o))return;if(o=o.trim(),o.startsWith("{{")&&o.endsWith("}}")){let i=o.substring(2,o.length-2).trim();e=new Mr(i,Wa).parse(),Ha.set(o,e)}}return e?.evaluate(t)},Au=(o,t,e,i)=>{let n=o.getAttribute("if");if(n!==null&&Xn(n,t))return Gn(o,t,e,i)},Zc=/(?<!\\){{(.*?)(?:(?<!\\)}})/g,td=o=>/(?:\\{{)|(?:\\}})/g.test(o),Dr=o=>o.replaceAll(/\\{{/g,"{{").replace(/\\}}/g,"}}"),_u=(o,t,e,i)=>{let n=o.getAttribute("repeat");if(n!==null){let r=Xn(n,t);if(!r[Symbol.iterator])return O;let s=Nr(o),a=-1,l=[];for(let c of r){a++;let d=Object.create(t);d.item=c,d.index=a,d.this=t.this??t;let h=[];for(let m of s.parts){let v=m.update(d,e,i);m.type===1?h.push(...v):h.push(v)}let f={_$litType$:s,values:h};l.push(f)}return l}},id={if:Au,repeat:_u},xt=(o,t=id,e={},i)=>{let r=Nr(o).renderers;if(i){let a=Nr(i).renderers,l=r.super;l!==void 0?e={...r,...e,super:(c,d,h)=>(h={...a,...h,super:(f,m,v)=>Gn(i,f,m,v)},l(c,d,h))}:(e={...a,...r,...e},o=i)}else e={...r,...e};return s=>Gn(o,s,t,e)};var Gn=(o,t,e=id,i={})=>{let n=Nr(o),r=[];for(let a of n.parts){let l=a.update(t,e,i);a.type===1?r.push(...l):r.push(l)}return{_$litType$:n,values:r}},ed=new Map,Nr=o=>{let t=ed.get(o);return t===void 0&&ed.set(o,t=Tu(o)),t},Tu=o=>{let t={h:void 0,el:o.cloneNode(!0),parts:[],renderers:{}},e=document.createTreeWalker(t.el.content,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT|NodeFilter.SHOW_COMMENT),i=e.currentNode,n=-1,r=[];for(;(i=e.nextNode())!==null;)if(i.nodeType===Node.COMMENT_NODE)n++;else if(i.nodeType===Node.ELEMENT_NODE){n++;let s=i;if(s.tagName==="TEMPLATE"){let l=s.getAttribute("type"),c=s.getAttribute("name"),d=s.getAttribute("call");if(d!==null||l!==null||c!==null){s.parentNode.insertBefore(document.createComment(""),s),r.push(s);let h;if(d!==null){let f=d.trim(),m=f.startsWith("{{")&&f.endsWith("}}");h=(v,x,u)=>{let g=s.getAttribute("data"),y=g===null?void 0:Xn(g,v);return(m?Xn(f,v):u[d])?.(y,x,u)}}else l!==null?h=(f,m,v)=>{let x=m[l];return x?.(s,f,m,v)}:(c==="super"?t.renderers.super=(f,m,v)=>{let x=v.super,u=Nr(s);return v={...v,...u.renderers},x(f,m,v)}:t.renderers[c]=(f,m,v)=>Gn(s,f,m,v),h=(f,m,v)=>{let x=v[c];return x?.(f,m,v)});t.parts.push({type:2,index:n,update:h});continue}}let a=s.getAttributeNames();for(let l of a){let c=s.getAttribute(l),d=c.split(Zc);if(d.length===1){td(c)&&s.setAttribute(l,Dr(c));continue}s.removeAttribute(l);let h=l,f=Su,m=l[0];m==="."?(h=Jc(l.substring(1)),f=ku):m==="?"?(h=l.substring(1),f=Eu):m==="@"&&(h=Jc(l.substring(1)),f=Iu);let v=[Dr(d[0])],x=[];for(let u=1;u<d.length;u+=2){let g=d[u];x.push(Ba(g,Wa)),v.push(Dr(d[u+1]))}t.parts.push({type:1,index:n,name:h,strings:v,ctor:f,update:(u,g,y)=>x.map(w=>w.evaluate(u))})}}else if(i.nodeType===Node.TEXT_NODE){let s=i,a=s.textContent,l=a.split(Zc);l.length>1?s.textContent=Dr(l[0]):td(a)&&(s.textContent=Dr(a));for(let c=1;c<l.length;c+=2){let d=l[c],h=Ba(d,Wa);t.parts.push({type:2,index:++n,update:(m,v)=>h.evaluate(m)});let f=new Text(l[c+1].replace("\\{{","{{"));s.parentNode.insertBefore(f,s.nextSibling),s.parentNode.insertBefore(document.createComment(""),s.nextSibling),s=f,e.currentNode=f}}for(let s of r)s.remove();return t};var Qa=Symbol.for("qti-components.context-root"),Ru=()=>{if(typeof document>"u")return;let o=globalThis;o[Qa]||(o[Qa]=new Pr,o[Qa].attach(document.documentElement))};Ru();var rd=[];var Ga=class extends Set{#t;constructor(t){super(),this.#t=t}add(t){return super.add(t),this.#e(),this}delete(t){let e=super.delete(t);return this.#e(),e}clear(){super.clear(),this.#e()}#e(){this.#t.isConnected?this.#i():queueMicrotask(()=>this.#i())}#i(){this.size===0?this.#t.removeAttribute("data-state"):this.#t.setAttribute("data-state",Array.from(this).join(" "))}},Xa="custom-state-support-probe";function Pu(o){if(!("states"in ElementInternals.prototype))return"missing";if(typeof customElements>"u")return"modern";try{customElements.get(Xa)||customElements.define(Xa,class extends HTMLElement{});let t=o.call(document.createElement(Xa)).states;return t?(t.add("probe"),t.delete("probe"),"modern"):"missing"}catch{return"legacy"}}var nd=!1;function od(){if(nd)return"already-installed";if(typeof HTMLElement>"u"||typeof ElementInternals>"u")return"modern";let o=HTMLElement.prototype.attachInternals;if(!o)return"modern";let t=Pu(o);return t==="modern"||(nd=!0,HTMLElement.prototype.attachInternals=function(){let i=o.call(this);return Object.defineProperty(i,"states",{configurable:!0,enumerable:!0,value:new Ga(this)}),i}),t}od();for(let{tag:o,ctor:t}of rd)customElements.get(o)||customElements.define(o,t);var Ce=Symbol("computedItemContext");var j=Symbol("computedContext");var qt=Symbol("configContext");var _i=Symbol("interactionContext");var F=Symbol("item");var sd=[{identifier:"completionStatus",cardinality:"single",baseType:"string",value:"unknown",type:"outcome"},{identifier:"numAttempts",cardinality:"single",baseType:"integer",value:"0",type:"response"}];var Ou=/^[A-Za-z0-9-]+$/,Mu=o=>typeof o=="string"&&Ou.test(o),ly=o=>Mu(o)?o:void 0,Ct=Symbol("qtiContext");var Ya={view:"candidate"},Xt=Symbol("sessionContext");var Ka={items:[],testOutcomeVariables:[]},at=Symbol("testContext");var P=q`
6
6
  :host {
7
7
  box-sizing: border-box;
8
8
  }
@@ -56,15 +56,23 @@ Make sure to test your application with a production build as repeat registratio
56
56
  [part~='message'] {
57
57
  display: none;
58
58
  }
59
- `;var Ir=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},D=class extends C{#t;get _context(){return this.#t.value}#e;#r;#i(t){t?.readonly!==void 0&&t.readonly!==this.#e&&(this.#e=t.readonly,this.readonly=t.readonly),t?.disabled!==void 0&&t.disabled!==this.#r&&(this.#r=t.disabled,this.disabled=t.disabled),this.#a(t)}#n;#o;#s;#a(t){let e=this.responseIdentifier??this.getAttribute("response-identifier"),r=t?.variables?.find(s=>s.type==="response"&&s.identifier===e);if(!r)return;if(!this.hasUpdated){this.#s||(this.#s=!0,this.updateComplete.then(()=>{this.#s=!1,this.#a(this._context)}));return}let n=this.#n===void 0,i=JSON.stringify(r.value??null);i!==this.#n&&(this.#n=i,!(n&&(r.value===null||r.value===void 0))&&i!==this.#o&&(this.#o=i,this.response=r.value))}#c;static{this.formAssociated=!0}get internals(){return this._internals}get registersWithItem(){return!0}get isInline(){return!1}get responseVariable(){if(!this._context?.variables)return;let t=this._context.variables.filter(r=>r.type==="response"),e=this.getAttribute("response-identifier");return t.find(r=>r.identifier===e)}get value(){return JSON.stringify(this.response)}set value(t){this.response=t?JSON.parse(t):null}reportValidity(){let t=this._internals.validity.valid,e=this.validationDisplayMode;return(e==="native"||e==="both")&&this._internals.reportValidity(),e==="inline"||e==="both"?this.updateInlineValidationMessage():this.clearInlineValidationMessage(),e==="none"&&this.clearInlineValidationMessage(),t}get validationDisplayMode(){return this.configContext?.validationDisplayMode??"inline"}resolveAllowReorder(t){let e=t?.defaultWhenUnset??!0,r=this.configContext;return r&&r.allowReorder!==void 0?r.allowReorder:e}resolveDisableAfterMaxReached(t){let e=t?.defaultWhenUnset??!1,r=this.configContext;return r?r.disableAfterMaxReached!==void 0?r.disableAfterMaxReached:r.disableAfterIfMaxChoicesReached!==void 0?(this.#c||(this.#c=!0,console.warn("[QTI Config] `disableAfterIfMaxChoicesReached` is deprecated. Use `disableAfterMaxReached` instead.")),r.disableAfterIfMaxChoicesReached):e:e}setInteractionValidity(t,e="",r,n){let i=r??this;this._internals.setValidity(t?{}:{customError:!0},e,i),n?.suppressInline!==!0&&(this.validationDisplayMode==="inline"||this.validationDisplayMode==="both")&&this.updateInlineValidationMessage()}updateInlineValidationMessage(){let t=this.getValidationMessageElement();if(t){if(!this._internals.validity.valid){t.textContent=this._internals.validationMessage,t.style.setProperty("display","block","important");return}t.textContent="",t.style.display="none"}}clearInlineValidationMessage(){let t=this.getValidationMessageElement();t&&(t.textContent="",t.style.display="none")}getValidationMessageElement(){return this.shadowRoot?.querySelector("#validation-message")}reset(){this.response=null}formResetCallback(){this.reset()}connectedCallback(){super.connectedCallback(),this.registersWithItem&&this.dispatchEvent(new CustomEvent("qti-register-interaction",{bubbles:!0,composed:!0,cancelable:!1,detail:{interactionElement:this,responseIdentifier:this.responseIdentifier}}))}saveResponse(t,e){this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,cancelable:!1,detail:{responseIdentifier:this.responseIdentifier,response:Array.isArray(t)?[...t]:t,...e!==void 0?{state:e}:{}}}))}constructor(){super(),this.#t=new wt(this,{context:F,subscribe:!0,callback:t=>this.#i(t)}),this.#s=!1,this.#c=!1,this._interactionContext={choiceRole:null,draggablesSelector:null},this.disabled=!1,this.readonly=!1,this._internals=this.attachInternals(),this.addEventListener("qti-interaction-response",t=>{this.#o=JSON.stringify(t.detail?.response??null)})}firstUpdated(t){}};Ir([_({context:qt,subscribe:!0})],D.prototype,"configContext",void 0);Ir([U({context:Ar})],D.prototype,"_interactionContext",void 0);Ir([p({type:String,attribute:"response-identifier"})],D.prototype,"responseIdentifier",void 0);Ir([p({reflect:!0,type:Boolean})],D.prototype,"disabled",void 0);Ir([p({reflect:!0,type:Boolean})],D.prototype,"readonly",void 0);Ir([p({type:String})],D.prototype,"name",void 0);var _r=class extends C{render(){return b`<slot></slot>`}defaultValues(t){let e=Array.from(this.querySelectorAll("qti-default-value > qti-value"));if(e.length===0)return null;let r=e.map(n=>n.innerHTML.trim());return r.length>1||t==="multiple"||t==="ordered"?r:r[0]}};var Qa=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Wa=(o,t)=>o==null?{identifier:"",baseType:"string",value:null,cardinality:"single",type:"response"}:Array.isArray(o)?{identifier:"",baseType:t??ed(o[0]),value:o.map(e=>String(e)),cardinality:"multiple",type:"response"}:{identifier:"",baseType:t??ed(o),value:String(o),cardinality:"single",type:"response"},ed=o=>typeof o=="number"?Number.isInteger(o)?"integer":"float":typeof o=="boolean"?"boolean":"string",ku=(o,t)=>{if(!(!Array.isArray(t)||t.length>0))return o.lastVariables.find(e=>e?.baseType&&e.baseType!=="record"&&e.cardinality!=="record")?.baseType},E=class extends C{constructor(){super(...arguments),this.#t=[],this.getVariables=()=>{let t=Array.from(this.children).map(e=>{switch(e.tagName.toLowerCase()){case"qti-base-value":return{baseType:e.getAttribute("base-type"),value:e.textContent.trim(),cardinality:"single"};case"qti-variable":{let r=e.getAttribute("identifier")||"";return r==="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.resolveVariable(r)}case"qti-multiple":{let n=e.getResult();return n?.length>0?{identifier:"",baseType:n[0].baseType,value:n.map(i=>i.value),cardinality:"multiple",type:"response"}:null}case"qti-ordered":{let n=e.getResult();return n?.length>0?{identifier:"",baseType:n[0].baseType,value:n.map(i=>i.value),cardinality:"ordered",type:"response"}:null}case"qti-repeat":{let n=e.getResult();return n?.length>0?n:null}case"qti-custom-operator":return Wa(e.calculate?.());case"qti-correct":{let r=e.getAttribute("identifier")||"",n=this.context?.variables?.find(i=>i.identifier===r);return n?{baseType:n.baseType,value:n.correctResponse,cardinality:n.cardinality}:(console.warn(`qti-correct: no response declaration for "${r}"`),Wa(null))}default:{try{let r=e,n=r.getResult();return Wa(n,r.resultBaseType??ku(r,n))}catch(r){console.warn(`getVariables: could not read a value from <${e.tagName.toLowerCase()}>`,r)}return null}}}).flatMap(e=>Array.isArray(e)?e:[e]).filter(e=>e!==null);return this.#t=t,t}}#t;get lastResult(){return this.result}get lastVariables(){return this.#t}static{this.styles=q`
59
+ `;var Ti=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},D=class extends C{#t;get _context(){return this.#t.value}#e;#i;#r(t){t?.readonly!==void 0&&t.readonly!==this.#e&&(this.#e=t.readonly,this.readonly=t.readonly),t?.disabled!==void 0&&t.disabled!==this.#i&&(this.#i=t.disabled,this.disabled=t.disabled),this.#a(t)}#n;#o;#s;#a(t){let e=this.responseIdentifier??this.getAttribute("response-identifier"),i=t?.variables?.find(s=>s.type==="response"&&s.identifier===e);if(!i)return;if(!this.hasUpdated){this.#s||(this.#s=!0,this.updateComplete.then(()=>{this.#s=!1,this.#a(this._context)}));return}let n=this.#n===void 0,r=JSON.stringify(i.value??null);r!==this.#n&&(this.#n=r,!(n&&(i.value===null||i.value===void 0))&&r!==this.#o&&(this.#o=r,this.response=i.value))}#c;static{this.formAssociated=!0}get internals(){return this._internals}get registersWithItem(){return!0}get isInline(){return!1}get responseVariable(){if(!this._context?.variables)return;let t=this._context.variables.filter(i=>i.type==="response"),e=this.getAttribute("response-identifier");return t.find(i=>i.identifier===e)}get value(){return JSON.stringify(this.response)}set value(t){this.response=t?JSON.parse(t):null}reportValidity(){let t=this._internals.validity.valid,e=this.validationDisplayMode;return(e==="native"||e==="both")&&this._internals.reportValidity(),e==="inline"||e==="both"?this.updateInlineValidationMessage():this.clearInlineValidationMessage(),e==="none"&&this.clearInlineValidationMessage(),t}get validationDisplayMode(){return this.configContext?.validationDisplayMode??"inline"}resolveAllowReorder(t){let e=t?.defaultWhenUnset??!0,i=this.configContext;return i&&i.allowReorder!==void 0?i.allowReorder:e}resolveDisableAfterMaxReached(t){let e=t?.defaultWhenUnset??!1,i=this.configContext;return i?i.disableAfterMaxReached!==void 0?i.disableAfterMaxReached:i.disableAfterIfMaxChoicesReached!==void 0?(this.#c||(this.#c=!0,console.warn("[QTI Config] `disableAfterIfMaxChoicesReached` is deprecated. Use `disableAfterMaxReached` instead.")),i.disableAfterIfMaxChoicesReached):e:e}setInteractionValidity(t,e="",i,n){let r=i??this;this._internals.setValidity(t?{}:{customError:!0},e,r),n?.suppressInline!==!0&&(this.validationDisplayMode==="inline"||this.validationDisplayMode==="both")&&this.updateInlineValidationMessage()}updateInlineValidationMessage(){let t=this.getValidationMessageElement();if(t){if(!this._internals.validity.valid){t.textContent=this._internals.validationMessage,t.style.setProperty("display","block","important");return}t.textContent="",t.style.display="none"}}clearInlineValidationMessage(){let t=this.getValidationMessageElement();t&&(t.textContent="",t.style.display="none")}getValidationMessageElement(){return this.shadowRoot?.querySelector("#validation-message")}reset(){this.response=null}formResetCallback(){this.reset()}connectedCallback(){super.connectedCallback(),this.registersWithItem&&this.dispatchEvent(new CustomEvent("qti-register-interaction",{bubbles:!0,composed:!0,cancelable:!1,detail:{interactionElement:this,responseIdentifier:this.responseIdentifier}}))}saveResponse(t,e){this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,cancelable:!1,detail:{responseIdentifier:this.responseIdentifier,response:Array.isArray(t)?[...t]:t,...e!==void 0?{state:e}:{}}}))}constructor(){super(),this.#t=new wt(this,{context:F,subscribe:!0,callback:t=>this.#r(t)}),this.#s=!1,this.#c=!1,this._interactionContext={choiceRole:null,draggablesSelector:null},this.disabled=!1,this.readonly=!1,this._internals=this.attachInternals(),this.addEventListener("qti-interaction-response",t=>{this.#o=JSON.stringify(t.detail?.response??null)})}firstUpdated(t){}};Ti([_({context:qt,subscribe:!0})],D.prototype,"configContext",void 0);Ti([U({context:_i})],D.prototype,"_interactionContext",void 0);Ti([p({type:String,attribute:"response-identifier"})],D.prototype,"responseIdentifier",void 0);Ti([p({reflect:!0,type:Boolean})],D.prototype,"disabled",void 0);Ti([p({reflect:!0,type:Boolean})],D.prototype,"readonly",void 0);Ti([p({type:String})],D.prototype,"name",void 0);var Ri=class extends C{render(){return b`<slot></slot>`}defaultValues(t){let e=Array.from(this.querySelectorAll("qti-default-value > qti-value"));if(e.length===0)return null;let i=e.map(n=>n.innerHTML.trim());return i.length>1||t==="multiple"||t==="ordered"?i:i[0]}};var Za=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},Ja=(o,t)=>o==null?{identifier:"",baseType:"string",value:null,cardinality:"single",type:"response"}:Array.isArray(o)?{identifier:"",baseType:t??ad(o[0]),value:o.map(e=>String(e)),cardinality:"multiple",type:"response"}:{identifier:"",baseType:t??ad(o),value:String(o),cardinality:"single",type:"response"},ad=o=>typeof o=="number"?Number.isInteger(o)?"integer":"float":typeof o=="boolean"?"boolean":"string",Du=(o,t)=>{if(!(!Array.isArray(t)||t.length>0))return o.lastVariables.find(e=>e?.baseType&&e.baseType!=="record"&&e.cardinality!=="record")?.baseType},E=class extends C{constructor(){super(...arguments),this.#t=[],this.getVariables=()=>{let t=Array.from(this.children).map(e=>{switch(e.tagName.toLowerCase()){case"qti-base-value":return{baseType:e.getAttribute("base-type"),value:e.textContent.trim(),cardinality:"single"};case"qti-variable":{let i=e.getAttribute("identifier")||"";return i==="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.resolveVariable(i)}case"qti-multiple":{let n=e.getResult();return n?.length>0?{identifier:"",baseType:n[0].baseType,value:n.map(r=>r.value),cardinality:"multiple",type:"response"}:null}case"qti-ordered":{let n=e.getResult();return n?.length>0?{identifier:"",baseType:n[0].baseType,value:n.map(r=>r.value),cardinality:"ordered",type:"response"}:null}case"qti-repeat":{let n=e.getResult();return n?.length>0?n:null}case"qti-custom-operator":return Ja(e.calculate?.());case"qti-correct":{let i=e.getAttribute("identifier")||"",n=this.context?.variables?.find(r=>r.identifier===i);return n?{baseType:n.baseType,value:n.correctResponse,cardinality:n.cardinality}:(console.warn(`qti-correct: no response declaration for "${i}"`),Ja(null))}default:{try{let i=e,n=i.getResult();return Ja(n,i.resultBaseType??Du(i,n))}catch(i){console.warn(`getVariables: could not read a value from <${e.tagName.toLowerCase()}>`,i)}return null}}}).flatMap(e=>Array.isArray(e)?e:[e]).filter(e=>e!==null);return this.#t=t,t}}#t;get lastResult(){return this.result}get lastVariables(){return this.#t}static{this.styles=q`
60
60
  slot {
61
61
  display: none;
62
62
  }
63
- `}render(){return b`<slot></slot>`}shouldUpdate(){return!this.hasUpdated}calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}get resultBaseType(){}resolveVariable(t){return this.context?.variables.find(e=>e.identifier===t)??this._testContext?.testOutcomeVariables?.find(e=>e.identifier===t)??null}};Qa([_({context:F,subscribe:!0})],E.prototype,"context",void 0);Qa([_({context:Ct,subscribe:!0})],E.prototype,"qtiContext",void 0);Qa([_({context:at,subscribe:!0})],E.prototype,"_testContext",void 0);var Xt=class extends E{calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};var Sy=()=>new Intl.NumberFormat().format(.1).replace(/\d/g,""),Ot=o=>typeof o=="string"?o:o.toString();function Ga(o){return o==null}function Qn(o){return o.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}var Di=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},mt=class extends C{constructor(){super(...arguments),this.showHide="show",this.#t=new wt(this,{context:F,subscribe:!0,callback:t=>this.#r(t)})}#t;get _context(){return this.#t.value}#e;#r(t){let e=t?.variables;if(!e||!this.outcomeIdentifier)return;let r=JSON.stringify(e.find(s=>s.identifier===this.outcomeIdentifier)?.value??null),n=Number(e.find(s=>s.identifier==="numAttempts")?.value)||0,i=this.#e===void 0?n>0:this.#e!==r||n>0;this.#e=r,i&&this.checkShowFeedback(this.outcomeIdentifier)}checkShowFeedback(t){let e=this._context.variables.find(n=>n.identifier===t)||null;if(this.outcomeIdentifier!==t||!e)return;let r=!1;Array.isArray(e.value)?r=e.value.includes(this.identifier):r=!Ga(this.identifier)&&!Ga(e?.value)&&this.identifier===e.value||!1,this.#i(r)}#i(t){if(!this.#n()){this.showStatus="off";return}this.showStatus=t&&this.showHide==="show"||!t&&this.showHide==="hide"?"on":"off"}#n(){if(!this._computedContext)return!0;let t=this._computedContext.testParts?.find(n=>n.active)?.sections.flatMap(n=>n.items).find(n=>n.active);if(!t||t.showFeedback)return!0;if(t.adaptive)return t.completionStatus!=="completed";let e=t.maxAttempts??1;return e<=0?!0:(Number(this._context?.variables?.find(n=>n.identifier==="numAttempts")?.value)||0)<e}};Di([p({type:String,attribute:"show-hide"})],mt.prototype,"showHide",void 0);Di([p({type:String,attribute:"outcome-identifier"})],mt.prototype,"outcomeIdentifier",void 0);Di([p({type:String})],mt.prototype,"identifier",void 0);Di([p({type:String,attribute:!1})],mt.prototype,"showStatus",void 0);Di([_({context:j,subscribe:!0}),T()],mt.prototype,"_computedContext",void 0);function Xa(o){if(o==null)return null;if(!o.includes(",")){let e=o.trim();return e.length>0?e:null}let t=o.split(",").map(e=>e.trim()).filter(e=>e.length>0);return t.length===0?null:t.length===1?t[0]:t}function Ya(o){if(o==null)return null;if(Array.isArray(o)){let e=o.map(r=>r.trim()).filter(r=>r.length>0);return e.length>0?e.join(","):null}let t=o.trim();return t.length>0?t:null}function*Oy(o){if(o!=null){if(Array.isArray(o)){for(let t of o){let e=t.trim();e&&(yield e)}return}if(!o.includes(",")){let t=o.trim();t&&(yield t);return}for(let t of o.split(",")){let e=t.trim();e&&(yield e)}}}function My(o){let[t,e,...r]=o.trim().split(/\s+/);if(!t||!e||r.length>0)throw new Error(`malformed directed-pair value: "${o}" (expected "source target")`);return{source:t,target:e}}function Dy(o,t){return`${o} ${t}`}function Ny(o){let[t,e,...r]=o.trim().split(/\s+/),n=Number(t),i=Number(e);if(!Number.isFinite(n)||!Number.isFinite(i)||r.length>0)throw new Error(`malformed point value: "${o}" (expected "x y" numeric coords)`);return{x:n,y:i}}function $y(o,t){return`${o} ${t}`}function Yt(o){let{emptyAs:t}=o,e=r=>r===t||r==null||r===""||Array.isArray(r)&&r.length===0;return{fromAttribute:r=>{let n=Xa(r);return n===null?t:n},toAttribute:r=>e(r)?null:Ya(r)}}var rd=class extends C{},Tr=class extends Error{constructor(){super("qti-exit-response"),this.name="QtiExitResponseSignal"}},Rr=class extends Error{constructor(){super("qti-exit-test"),this.name="QtiExitTestSignal"}};var Eu=o=>{let t=o[0];return t==null?null:Array.isArray(t)?t[0]??null:String(t)},Ka=o=>t=>{let e=Eu(t);return e===null?null:o(e)},Au=["depcp","questify","qade"],Iu={Trim:Ka(o=>o.trim()),ToAscii:Ka(o=>o.normalize("NFD").replace(/[̀-ͯ]/g,"")),ParseCommaDecimal:Ka(o=>o.replace(",","."))},_u=new Map(Au.flatMap(o=>Object.entries(Iu).map(([t,e])=>[`${o}:${t}`,e]))),Ja=new Map,jy=(o,t)=>{Ja.set(o,t)},Fy=o=>{Ja.delete(o)},id=o=>Ja.get(o)??_u.get(o)??null;var Y=class{static isPointInArea(t,e,r){if(r!=="point")return console.warn(`Base type ${r} is not supported for point area mapping.`),!1;let[n,i]=t.split(" ").map(Number),[s,...a]=e.split(","),l=a.map(Number);switch(s.toLowerCase()){case"default":return!0;case"circle":{let[c,d,h]=l;return l.length!==3?(console.warn(`Invalid circle definition: ${e}`),!1):Math.sqrt((n-c)**2+(i-d)**2)<=h}case"rect":{let[c,d,h,f]=l;return l.length!==4?(console.warn(`Invalid rectangle definition: ${e}`),!1):n>=c&&n<=h&&i>=d&&i<=f}case"ellipse":{let[c,d,h,f]=l;if(l.length!==4)return console.warn(`Invalid ellipse definition: ${e}`),!1;let m=(n-c)**2/h**2,v=(i-d)**2/f**2;return m+v<=1}case"poly":{if(l.length<6||l.length%2!==0)return console.warn(`Invalid polygon definition: ${e}`),!1;let c=[];for(let d=0;d<l.length;d+=2)c.push({x:l[d],y:l[d+1]});return this.isPointInPolygon({x:n,y:i},c)}default:return console.warn(`Unsupported shape type: ${s}`),!1}}static isPointInPolygon(t,e){let r=!1;for(let n=0,i=e.length-1;n<e.length;i=n++){let s=e[n].x,a=e[n].y,l=e[i].x,c=e[i].y;a>t.y!=c>t.y&&t.x<(l-s)*(t.y-a)/(c-a)+s&&(r=!r)}return r}static compareSingleValues(t,e,r){switch(r){case"identifier":case"string":return t===e;case"integer":{let n=parseInt(t,10),i=parseInt(e,10);if(!isNaN(n)&&!isNaN(i)){let s=parseFloat(t),a=parseFloat(e);return!Number.isInteger(s)||!Number.isInteger(a)?s===a:n===i}else console.error(`Cannot convert ${t} and/or ${e} to int.`);break}case"float":{let n=parseFloat(t),i=parseFloat(e);if(!isNaN(n)&&!isNaN(i))return n===i;console.error(`couldn't convert ${t} and/or ${e} to float.`);break}case"pair":case"directedPair":{let n=t.split(" "),i=e.split(" ");if(n.length===2&&i.length===2)return r==="pair"&&(n.sort(),i.sort()),n.join(" ")===i.join(" ");console.error(`compared two pair but one of the values does not have 2 values: 1: ${t} 2: ${e}`);break}}return!1}};var St=Symbol("testHost");var od={"cito-item-rendered":{kind:"notification",scope:"item"},"cito-item-response-changed":{kind:"notification",scope:"item",deprecated:"qti-interaction-changed"},"cito-item-outcome-changed":{kind:"notification",scope:"item",deprecated:"qti-outcome-changed"},"cito-item-rubric-placement":{kind:"notification",scope:"item",deprecated:"qti-rubric:discretionary-placement"}};function Za(o,t,e,r,n=!1){let i={detail:r??{},bubbles:!0,composed:!0,cancelable:n},s=o.dispatchEvent(new CustomEvent(e,i)),{deprecated:a}=t[e];return a?o.dispatchEvent(new CustomEvent(a,i))&&s:s}var nd=new Set;function tl(o,t,e,r){let n;o.addEventListener(e,s=>{n=s.detail,queueMicrotask(()=>n=void 0),r(s)});let{deprecated:i}=t[e];i&&o.addEventListener(i,s=>{n!==void 0&&s.detail===n||(nd.has(i)||(nd.add(i),console.warn(`[qti-components] The event "${i}" is deprecated; dispatch "${e}" instead.`)),r(s))})}function Pr(o,t,e,r=!1){return Za(o,od,t,e,r)}function sd(o,t,e){tl(o,od,t,e)}var ad={"cito-test-navigate":{kind:"request",scope:"test",deprecated:"qti-request-navigation"},"cito-test-end-attempt":{kind:"request",scope:"test",deprecated:"test-end-attempt"},"cito-test-update-outcome":{kind:"request",scope:"test",deprecated:"test-update-outcome-variable"},"cito-test-switch-view":{kind:"request",scope:"test",deprecated:"on-test-switch-view"},"cito-test-navigated":{kind:"notification",scope:"test"},"cito-test-navigation-started":{kind:"notification",scope:"test",deprecated:"qti-navigation-loading-started"},"cito-test-navigation-failed":{kind:"notification",scope:"test",deprecated:"qti-navigation-error"},"cito-test-rendered":{kind:"notification",scope:"test",deprecated:"qti-test-loaded"},"cito-test-loaded":{kind:"notification",scope:"test",deprecated:"qti-assessment-test-connected"},"cito-test-state-changed":{kind:"notification",scope:"test",deprecated:"qti-state-changed"},"cito-item-ref-connected":{kind:"notification",scope:"item",deprecated:"qti-assessment-item-ref-connected"}};function z(o,t,e){Za(o,ad,t,e)}function J(o,t,e){tl(o,ad,t,e)}var qe=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},ld={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},kt=class extends C{constructor(){super(...arguments),this.xmlDoc=null,this.myTemplate=null,this.#e=null}get weights(){let t=new Map;for(let e of this.querySelectorAll(":scope > qti-weight")){let r=e.getAttribute("identifier");if(!r)continue;let n=Number(e.getAttribute("value"));if(Number.isNaN(n)){console.warn(`qti-weight "${r}" has a non-numeric value, ignoring it`);continue}t.set(r,n)}return t}createRenderRoot(){return this}get assessmentItem(){return this.renderRoot?.querySelector("qti-assessment-item")}disconnectedCallback(){super.disconnectedCallback(),this.testHost=void 0}async connectedCallback(){super.connectedCallback();let t=this.testHost?.querySelector("template[item-ref]");this.myTemplate=t?xt(t):null,this.requestUpdate(),await this.updateComplete,z(this,"cito-item-ref-connected",{identifier:this.identifier,href:this.href,category:this.category})}#t(){for(let t of this.computedContext?.testParts??[])for(let e of t.sections){let r=e.items.find(n=>n.identifier===this.identifier);if(r)return r}}#e;render(){if(!this.xmlDoc)return this.#e=null,O;(this.#e?.source!==this.xmlDoc||this.#e.template!==this.myTemplate)&&(this.#e={source:this.xmlDoc,template:this.myTemplate,doc:this.xmlDoc.cloneNode(!0)});let t=this.#e.doc;if(!this.myTemplate)return t;let e={xmlDoc:t,identifier:this.identifier,href:this.href,category:this.category,item:this.#t(),itemRef:this};return this.myTemplate(e)}};qe([p({type:String})],kt.prototype,"category",void 0);qe([p({type:String})],kt.prototype,"identifier",void 0);qe([p({type:Boolean,converter:ld})],kt.prototype,"required",void 0);qe([p({type:Boolean,converter:ld})],kt.prototype,"fixed",void 0);qe([p({type:String})],kt.prototype,"href",void 0);qe([T(),_({context:j,subscribe:!0})],kt.prototype,"computedContext",void 0);qe([p({type:Object,attribute:!1})],kt.prototype,"xmlDoc",void 0);qe([_({context:St,subscribe:!0})],kt.prototype,"testHost",void 0);var Ce=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},el={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},Et=class extends C{get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}#t="";async connectedCallback(){this.#t=this.getAttribute("title")||"",super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-assessment-section-connected",{bubbles:!0,composed:!0}))}render(){return b`<slot name="qti-rubric-block"></slot><slot></slot>`}};Ce([p({type:String})],Et.prototype,"identifier",void 0);Ce([p({type:String})],Et.prototype,"required",void 0);Ce([p({type:Boolean,converter:el})],Et.prototype,"fixed",void 0);Ce([p({type:Boolean,converter:el})],Et.prototype,"visible",void 0);Ce([p({type:Boolean,converter:el,attribute:"keep-together"})],Et.prototype,"keepTogether",void 0);Ce([p({type:String,attribute:"navigation-mode"})],Et.prototype,"navigationMode",void 0);Ce([p({type:String,attribute:"submission-mode"})],Et.prototype,"submissionMode",void 0);Ce([_({context:at,subscribe:!0})],Et.prototype,"_testContext",void 0);var rl=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Ze=class extends C{get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}#t="";async connectedCallback(){super.connectedCallback(),await this.updateComplete,z(this,"cito-test-loaded",this)}render(){return b` <slot></slot>`}};rl([p({type:String})],Ze.prototype,"identifier",void 0);rl([p({type:String})],Ze.prototype,"title",null);rl([_({context:at,subscribe:!0})],Ze.prototype,"_testContext",void 0);var tr=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Or={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},Mt=class extends C{constructor(){super(...arguments),this.maxAttempts=1,this.showFeedback=!1,this.allowReview=!0,this.showSolution=!1,this.allowComment=!1,this.allowSkipping=!0,this.validateResponses=!1}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-item-session-control-connected",{detail:this,bubbles:!0,composed:!0}))}render(){return b`<slot></slot>`}};tr([p({type:Number,attribute:"max-attempts"})],Mt.prototype,"maxAttempts",void 0);tr([p({type:Boolean,converter:Or,attribute:"show-feedback"})],Mt.prototype,"showFeedback",void 0);tr([p({type:Boolean,converter:Or,attribute:"allow-review"})],Mt.prototype,"allowReview",void 0);tr([p({type:Boolean,converter:Or,attribute:"show-solution"})],Mt.prototype,"showSolution",void 0);tr([p({type:Boolean,converter:Or,attribute:"allow-comment"})],Mt.prototype,"allowComment",void 0);tr([p({type:Boolean,converter:Or,attribute:"allow-skipping"})],Mt.prototype,"allowSkipping",void 0);tr([p({type:Boolean,converter:Or,attribute:"validate-responses"})],Mt.prototype,"validateResponses",void 0);var il=o=>o?.split(/\s+/).filter(Boolean)??[],Gn=o=>({sectionIdentifier:o.getAttribute("section-identifier"),includeCategories:il(o.getAttribute("include-category")),excludeCategories:il(o.getAttribute("exclude-category"))}),Xn=(o,{sectionIdentifier:t,includeCategories:e,excludeCategories:r})=>{let n=t?Array.from(o.querySelectorAll(`qti-assessment-section[identifier="${CSS.escape(t)}"]`)):[o];return n.length===0?(console.warn(`no qti-assessment-section with identifier "${t}"`),[]):n.flatMap(i=>Array.from(i.querySelectorAll("qti-assessment-item-ref"))).filter(i=>{let s=il(i.category);return!(e.length>0&&!s.some(a=>e.includes(a))||r.length>0&&s.some(a=>r.includes(a)))})};var Yn=class extends E{#t=null;constructor(){super(),J(this,"cito-test-loaded",t=>this.#t=t.detail)}get#e(){return this.#t??this.closest("qti-assessment-test")}getResult(){let t=this.#e;return t?Xn(t,Gn(this)).length:(console.warn("qti-number-selected: no enclosing qti-assessment-test, nothing to count"),0)}calculate(){return this.getResult()}};var Kn=class extends C{static{this.styles=[q`
63
+ `}render(){return b`<slot></slot>`}shouldUpdate(){return!this.hasUpdated}calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}get resultBaseType(){}resolveVariable(t){return this.context?.variables.find(e=>e.identifier===t)??this._testContext?.testOutcomeVariables?.find(e=>e.identifier===t)??this.resolveItemVariable(t)}resolveItemVariable(t){if(!t?.includes("."))return null;let e=t.split(".");return this._testContext?.items?.find(n=>n.identifier===e[0])?.variables?.find(n=>n.identifier===e[e.length-1])??null}};Za([_({context:F,subscribe:!0})],E.prototype,"context",void 0);Za([_({context:Ct,subscribe:!0})],E.prototype,"qtiContext",void 0);Za([_({context:at,subscribe:!0})],E.prototype,"_testContext",void 0);var Yt=class extends E{calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};var $y=()=>new Intl.NumberFormat().format(.1).replace(/\d/g,""),Ot=o=>typeof o=="string"?o:o.toString();function tl(o){return o==null}function Yn(o){return o.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}var $r=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},mt=class extends C{constructor(){super(...arguments),this.showHide="show",this.#t=new wt(this,{context:F,subscribe:!0,callback:t=>this.#i(t)})}#t;get _context(){return this.#t.value}#e;#i(t){let e=t?.variables;if(!e||!this.outcomeIdentifier)return;let i=JSON.stringify(e.find(s=>s.identifier===this.outcomeIdentifier)?.value??null),n=Number(e.find(s=>s.identifier==="numAttempts")?.value)||0,r=this.#e===void 0?n>0:this.#e!==i||n>0;this.#e=i,r&&this.checkShowFeedback(this.outcomeIdentifier)}checkShowFeedback(t){let e=this._context.variables.find(n=>n.identifier===t)||null;if(this.outcomeIdentifier!==t||!e)return;let i=!1;Array.isArray(e.value)?i=e.value.includes(this.identifier):i=!tl(this.identifier)&&!tl(e?.value)&&this.identifier===e.value||!1,this.#r(i)}#r(t){if(!this.#n()){this.showStatus="off";return}this.showStatus=t&&this.showHide==="show"||!t&&this.showHide==="hide"?"on":"off"}#n(){if(!this._computedContext)return!0;let t=this._computedContext.testParts?.find(n=>n.active)?.sections.flatMap(n=>n.items).find(n=>n.active);if(!t||t.showFeedback)return!0;if(t.adaptive)return t.completionStatus!=="completed";let e=t.maxAttempts??1;return e<=0?!0:(Number(this._context?.variables?.find(n=>n.identifier==="numAttempts")?.value)||0)<e}};$r([p({type:String,attribute:"show-hide"})],mt.prototype,"showHide",void 0);$r([p({type:String,attribute:"outcome-identifier"})],mt.prototype,"outcomeIdentifier",void 0);$r([p({type:String})],mt.prototype,"identifier",void 0);$r([p({type:String,attribute:!1})],mt.prototype,"showStatus",void 0);$r([_({context:j,subscribe:!0}),T()],mt.prototype,"_computedContext",void 0);function el(o){if(o==null)return null;if(!o.includes(",")){let e=o.trim();return e.length>0?e:null}let t=o.split(",").map(e=>e.trim()).filter(e=>e.length>0);return t.length===0?null:t.length===1?t[0]:t}function il(o){if(o==null)return null;if(Array.isArray(o)){let e=o.map(i=>i.trim()).filter(i=>i.length>0);return e.length>0?e.join(","):null}let t=o.trim();return t.length>0?t:null}function*Wy(o){if(o!=null){if(Array.isArray(o)){for(let t of o){let e=t.trim();e&&(yield e)}return}if(!o.includes(",")){let t=o.trim();t&&(yield t);return}for(let t of o.split(",")){let e=t.trim();e&&(yield e)}}}function Qy(o){let[t,e,...i]=o.trim().split(/\s+/);if(!t||!e||i.length>0)throw new Error(`malformed directed-pair value: "${o}" (expected "source target")`);return{source:t,target:e}}function Xy(o,t){return`${o} ${t}`}function Gy(o){let[t,e,...i]=o.trim().split(/\s+/),n=Number(t),r=Number(e);if(!Number.isFinite(n)||!Number.isFinite(r)||i.length>0)throw new Error(`malformed point value: "${o}" (expected "x y" numeric coords)`);return{x:n,y:r}}function Yy(o,t){return`${o} ${t}`}function Kt(o){let{emptyAs:t}=o,e=i=>i===t||i==null||i===""||Array.isArray(i)&&i.length===0;return{fromAttribute:i=>{let n=el(i);return n===null?t:n},toAttribute:i=>e(i)?null:il(i)}}var ld=class extends C{},Pi=class extends Error{constructor(){super("qti-exit-response"),this.name="QtiExitResponseSignal"}},Oi=class extends Error{constructor(){super("qti-exit-test"),this.name="QtiExitTestSignal"}};var Nu=o=>{let t=o[0];return t==null?null:Array.isArray(t)?t[0]??null:String(t)},rl=o=>t=>{let e=Nu(t);return e===null?null:o(e)},$u=["depcp","questify","qade"],Lu={Trim:rl(o=>o.trim()),ToAscii:rl(o=>o.normalize("NFD").replace(/[̀-ͯ]/g,"")),ParseCommaDecimal:rl(o=>o.replace(",","."))},Vu=new Map($u.flatMap(o=>Object.entries(Lu).map(([t,e])=>[`${o}:${t}`,e]))),nl=new Map,tv=(o,t)=>{nl.set(o,t)},ev=o=>{nl.delete(o)},cd=o=>nl.get(o)??Vu.get(o)??null;var dd={true:!0,1:!0,false:!1,0:!1},Y=class{static isPointInArea(t,e,i){if(i!=="point")return console.warn(`Base type ${i} is not supported for point area mapping.`),!1;let[n,r]=t.split(" ").map(Number),[s,...a]=e.split(","),l=a.map(Number);switch(s.toLowerCase()){case"default":return!0;case"circle":{let[c,d,h]=l;return l.length!==3?(console.warn(`Invalid circle definition: ${e}`),!1):Math.sqrt((n-c)**2+(r-d)**2)<=h}case"rect":{let[c,d,h,f]=l;return l.length!==4?(console.warn(`Invalid rectangle definition: ${e}`),!1):n>=c&&n<=h&&r>=d&&r<=f}case"ellipse":{let[c,d,h,f]=l;if(l.length!==4)return console.warn(`Invalid ellipse definition: ${e}`),!1;let m=(n-c)**2/h**2,v=(r-d)**2/f**2;return m+v<=1}case"poly":{if(l.length<6||l.length%2!==0)return console.warn(`Invalid polygon definition: ${e}`),!1;let c=[];for(let d=0;d<l.length;d+=2)c.push({x:l[d],y:l[d+1]});return this.isPointInPolygon({x:n,y:r},c)}default:return console.warn(`Unsupported shape type: ${s}`),!1}}static isPointInPolygon(t,e){let i=!1;for(let n=0,r=e.length-1;n<e.length;r=n++){let s=e[n].x,a=e[n].y,l=e[r].x,c=e[r].y;a>t.y!=c>t.y&&t.x<(l-s)*(t.y-a)/(c-a)+s&&(i=!i)}return i}static compareSingleValues(t,e,i){switch(i){case"identifier":case"string":return t===e;case"boolean":{let n=dd[t.trim().toLowerCase()];return n!==void 0&&n===dd[e.trim().toLowerCase()]}case"integer":{let n=parseInt(t,10),r=parseInt(e,10);if(!isNaN(n)&&!isNaN(r)){let s=parseFloat(t),a=parseFloat(e);return!Number.isInteger(s)||!Number.isInteger(a)?s===a:n===r}else console.error(`Cannot convert ${t} and/or ${e} to int.`);break}case"float":{let n=parseFloat(t),r=parseFloat(e);if(!isNaN(n)&&!isNaN(r))return n===r;console.error(`couldn't convert ${t} and/or ${e} to float.`);break}case"pair":case"directedPair":{let n=t.split(" "),r=e.split(" ");if(n.length===2&&r.length===2)return i==="pair"&&(n.sort(),r.sort()),n.join(" ")===r.join(" ");console.error(`compared two pair but one of the values does not have 2 values: 1: ${t} 2: ${e}`);break}}return!1}};var St=Symbol("testHost");var pd={"cito-item-rendered":{kind:"notification",scope:"item"},"cito-item-response-changed":{kind:"notification",scope:"item",deprecated:"qti-interaction-changed"},"cito-item-outcome-changed":{kind:"notification",scope:"item",deprecated:"qti-outcome-changed"},"cito-item-rubric-placement":{kind:"notification",scope:"item",deprecated:"qti-rubric:discretionary-placement"}};function ol(o,t,e,i,n=!1){let r={detail:i??{},bubbles:!0,composed:!0,cancelable:n},s=o.dispatchEvent(new CustomEvent(e,r)),{deprecated:a}=t[e];return a?o.dispatchEvent(new CustomEvent(a,r))&&s:s}var hd=new Set;function sl(o,t,e,i){let n;o.addEventListener(e,s=>{n=s.detail,queueMicrotask(()=>n=void 0),i(s)});let{deprecated:r}=t[e];r&&o.addEventListener(r,s=>{n!==void 0&&s.detail===n||(hd.has(r)||(hd.add(r),console.warn(`[qti-components] The event "${r}" is deprecated; dispatch "${e}" instead.`)),i(s))})}function Mi(o,t,e,i=!1){return ol(o,pd,t,e,i)}function ud(o,t,e){sl(o,pd,t,e)}var md={"cito-test-navigate":{kind:"request",scope:"test",deprecated:"qti-request-navigation"},"cito-test-end-attempt":{kind:"request",scope:"test",deprecated:"test-end-attempt"},"cito-test-update-outcome":{kind:"request",scope:"test",deprecated:"test-update-outcome-variable"},"cito-test-switch-view":{kind:"request",scope:"test",deprecated:"on-test-switch-view"},"cito-test-navigated":{kind:"notification",scope:"test"},"cito-test-navigation-started":{kind:"notification",scope:"test",deprecated:"qti-navigation-loading-started"},"cito-test-navigation-failed":{kind:"notification",scope:"test",deprecated:"qti-navigation-error"},"cito-test-rendered":{kind:"notification",scope:"test",deprecated:"qti-test-loaded"},"cito-test-loaded":{kind:"notification",scope:"test",deprecated:"qti-assessment-test-connected"},"cito-test-state-changed":{kind:"notification",scope:"test",deprecated:"qti-state-changed"},"cito-test-items-skipped":{kind:"notification",scope:"test"},"cito-test-end-reached":{kind:"notification",scope:"test"},"cito-item-ref-connected":{kind:"notification",scope:"item",deprecated:"qti-assessment-item-ref-connected"}};function V(o,t,e){ol(o,md,t,e)}function J(o,t,e){sl(o,md,t,e)}var Se=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},fd={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},kt=class extends C{constructor(){super(...arguments),this.xmlDoc=null,this.myTemplate=null,this.#e=null}get weights(){let t=new Map;for(let e of this.querySelectorAll(":scope > qti-weight")){let i=e.getAttribute("identifier");if(!i)continue;let n=Number(e.getAttribute("value"));if(Number.isNaN(n)){console.warn(`qti-weight "${i}" has a non-numeric value, ignoring it`);continue}t.set(i,n)}return t}createRenderRoot(){return this}get assessmentItem(){return this.renderRoot?.querySelector("qti-assessment-item")}disconnectedCallback(){super.disconnectedCallback(),this.testHost=void 0}async connectedCallback(){super.connectedCallback();let t=this.testHost?.querySelector("template[item-ref]");this.myTemplate=t?xt(t):null,this.requestUpdate(),await this.updateComplete,V(this,"cito-item-ref-connected",{identifier:this.identifier,href:this.href,category:this.category})}#t(){for(let t of this.computedContext?.testParts??[])for(let e of t.sections){let i=e.items.find(n=>n.identifier===this.identifier);if(i)return i}}#e;render(){if(!this.xmlDoc)return this.#e=null,O;(this.#e?.source!==this.xmlDoc||this.#e.template!==this.myTemplate)&&(this.#e={source:this.xmlDoc,template:this.myTemplate,doc:this.xmlDoc.cloneNode(!0)});let t=this.#e.doc;if(!this.myTemplate)return t;let e={xmlDoc:t,identifier:this.identifier,href:this.href,category:this.category,item:this.#t(),itemRef:this};return this.myTemplate(e)}};Se([p({type:String})],kt.prototype,"category",void 0);Se([p({type:String})],kt.prototype,"identifier",void 0);Se([p({type:Boolean,converter:fd})],kt.prototype,"required",void 0);Se([p({type:Boolean,converter:fd})],kt.prototype,"fixed",void 0);Se([p({type:String})],kt.prototype,"href",void 0);Se([T(),_({context:j,subscribe:!0})],kt.prototype,"computedContext",void 0);Se([p({type:Object,attribute:!1})],kt.prototype,"xmlDoc",void 0);Se([_({context:St,subscribe:!0})],kt.prototype,"testHost",void 0);var ke=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},al={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},Et=class extends C{get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}#t="";async connectedCallback(){this.#t=this.getAttribute("title")||"",super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-assessment-section-connected",{bubbles:!0,composed:!0}))}render(){return b`<slot name="qti-rubric-block"></slot><slot></slot>`}};ke([p({type:String})],Et.prototype,"identifier",void 0);ke([p({type:String})],Et.prototype,"required",void 0);ke([p({type:Boolean,converter:al})],Et.prototype,"fixed",void 0);ke([p({type:Boolean,converter:al})],Et.prototype,"visible",void 0);ke([p({type:Boolean,converter:al,attribute:"keep-together"})],Et.prototype,"keepTogether",void 0);ke([p({type:String,attribute:"navigation-mode"})],Et.prototype,"navigationMode",void 0);ke([p({type:String,attribute:"submission-mode"})],Et.prototype,"submissionMode",void 0);ke([_({context:at,subscribe:!0})],Et.prototype,"_testContext",void 0);var ll=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},ei=class extends C{get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}#t="";async connectedCallback(){super.connectedCallback(),await this.updateComplete,V(this,"cito-test-loaded",this)}render(){return b` <slot></slot>`}};ll([p({type:String})],ei.prototype,"identifier",void 0);ll([p({type:String})],ei.prototype,"title",null);ll([_({context:at,subscribe:!0})],ei.prototype,"_testContext",void 0);function Kn(o,t){let e=o.firstElementChild;if(!e||typeof e.calculate!="function")return console.warn(`<${o.localName}> has no evaluable expression child`,o),t;try{let i=e.calculate();return i===!0||i==="true"}catch(i){return console.warn(`<${o.localName}> could not evaluate its expression`,i),t}}var zu=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},ce=class extends C{constructor(){super(...arguments),this.target=""}static{this.EXIT_SECTION="EXIT_SECTION"}static{this.EXIT_TESTPART="EXIT_TESTPART"}static{this.EXIT_TEST="EXIT_TEST"}static{this.styles=q`
64
+ :host {
65
+ display: none;
66
+ }
67
+ `}evaluate(){return Kn(this,!1)}render(){return b`<slot></slot>`}};zu([p({type:String})],ce.prototype,"target",void 0);var ii=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},Di={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},Mt=class extends C{constructor(){super(...arguments),this.maxAttempts=1,this.showFeedback=!1,this.allowReview=!0,this.showSolution=!1,this.allowComment=!1,this.allowSkipping=!0,this.validateResponses=!1}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-item-session-control-connected",{detail:this,bubbles:!0,composed:!0}))}render(){return b`<slot></slot>`}};ii([p({type:Number,attribute:"max-attempts"})],Mt.prototype,"maxAttempts",void 0);ii([p({type:Boolean,converter:Di,attribute:"show-feedback"})],Mt.prototype,"showFeedback",void 0);ii([p({type:Boolean,converter:Di,attribute:"allow-review"})],Mt.prototype,"allowReview",void 0);ii([p({type:Boolean,converter:Di,attribute:"show-solution"})],Mt.prototype,"showSolution",void 0);ii([p({type:Boolean,converter:Di,attribute:"allow-comment"})],Mt.prototype,"allowComment",void 0);ii([p({type:Boolean,converter:Di,attribute:"allow-skipping"})],Mt.prototype,"allowSkipping",void 0);ii([p({type:Boolean,converter:Di,attribute:"validate-responses"})],Mt.prototype,"validateResponses",void 0);var cl=o=>o?.split(/\s+/).filter(Boolean)??[],Jn=o=>({sectionIdentifier:o.getAttribute("section-identifier"),includeCategories:cl(o.getAttribute("include-category")),excludeCategories:cl(o.getAttribute("exclude-category"))}),Zn=(o,{sectionIdentifier:t,includeCategories:e,excludeCategories:i})=>{let n=t?Array.from(o.querySelectorAll(`qti-assessment-section[identifier="${CSS.escape(t)}"]`)):[o];return n.length===0?(console.warn(`no qti-assessment-section with identifier "${t}"`),[]):n.flatMap(r=>Array.from(r.querySelectorAll("qti-assessment-item-ref"))).filter(r=>{let s=cl(r.category);return!(e.length>0&&!s.some(a=>e.includes(a))||i.length>0&&s.some(a=>i.includes(a)))})};var to=class extends E{#t=null;constructor(){super(),J(this,"cito-test-loaded",t=>this.#t=t.detail)}get#e(){return this.#t??this.closest("qti-assessment-test")}getResult(){let t=this.#e;return t?Zn(t,Jn(this)).length:(console.warn("qti-number-selected: no enclosing qti-assessment-test, nothing to count"),0)}calculate(){return this.getResult()}};var eo=class extends C{static{this.styles=q`
68
+ :host {
69
+ display: none;
70
+ }
71
+ `}evaluate(){return Kn(this,!0)}render(){return b`<slot></slot>`}};var io=class extends C{static{this.styles=[q`
64
72
  :host {
65
73
  display: none;
66
74
  }
67
- `]}render(){return b`<slot></slot>`}process(){let t=new nl,e=[...this.children];t.process(e)}},nl=class{process(t){try{for(let e of t)e.process()}catch(e){if(!(e instanceof Rr))throw e}}};var er=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},ft=class extends C{constructor(){super(...arguments),this.#e=null,this.identifier="",this.adaptive="false",this.timeDependent=null,this._context={variables:td},this.#r={...this._context,variables:this._context.variables},this.#i=new Map,this.#n=!1,this.interactionElements=[],this.#a=t=>{t.stopImmediatePropagation();let{variable:e}=t.detail,r=e.type==="template"?this.#i.get(e.identifier):void 0,n=r!==void 0?{...e,value:r}:e;this._context={...this._context,variables:[...this._context.variables,n]},this.#r=this._context,t.stopPropagation()},this.#c=t=>{t.stopImmediatePropagation(),this.interactionElements.push(t.detail.interactionElement)},this.#p=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,countAttempt:r}=t.detail;this.validate(),this.updateResponseVariable(e,"true"),this.processResponse(r)},this.#l=t=>{t.stopImmediatePropagation();let{outcomeIdentifier:e,value:r}=t.detail;this.updateOutcomeVariable(e,r),t.stopPropagation()},this.#d=t=>{t.stopImmediatePropagation();let{templateIdentifier:e,value:r}=t.detail;this.#i.has(e)||this.updateTemplateVariable(e,r??void 0),t.stopPropagation()},this.#m=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,value:r}=t.detail;this.updateCorrectResponse(e,r??void 0),t.stopPropagation()},this.#h=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,response:r,state:n}=t.detail;this.updateResponseVariable(e,r),n!==void 0&&(this._context={...this._context,state:{...this._context.state||{},[e]:n}}),this.validate(!1),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}}#t;#e;get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}willUpdate(t){super.willUpdate(t);let e=t.has("readonly")&&(this.readonly??!1)!==(this._context.readonly??!1),r=t.has("disabled")&&(this.disabled??!1)!==(this._context.disabled??!1);(e||r)&&(this._context={...this._context,...e?{readonly:!!this.readonly}:{},...r?{disabled:!!this.disabled}:{}})}set assessmentItemRefId(t){this._context={...this._context,identifier:t}}get assessmentItemRefId(){return this._context.identifier}get itemContext(){return this._context}get variables(){return this._context.variables.map(t=>({identifier:t.identifier,value:t.value,type:t.type,...t.type==="outcome"&&t.identifier==="SCORE"?{externalScored:t.externalScored}:{}}))}set variables(t){if(!Array.isArray(t)||t.some(i=>!("identifier"in i))){console.warn("variables property should be an array of VariableDeclaration");return}let e=this._context.variables,r=t.filter(i=>i.value!==null&&i.value!==void 0&&(i.type==="template"||e.some(s=>s.identifier===i.identifier&&s.type==="template")));r.forEach(i=>this.#i.set(i.identifier,i.value));let n=r.some(i=>JSON.stringify(e.find(s=>s.identifier===i.identifier)?.value)!==JSON.stringify(i.value));this._context={...this._context,variables:this._context.variables.map(i=>{let s=t.find(a=>a.identifier===i.identifier);return s?{...i,...s,interpolationTable:i.interpolationTable,matchTable:i.matchTable}:i})},this.#n&&n&&this.#g(),this.updateComplete.then(()=>this.#u())}get state(){return this._context.state}set state(t){this._context={...this._context,state:t?{...t}:void 0}}#r;#i;#n;set responses(t){if(t)for(let e of t){this.getResponse(e.responseIdentifier)&&this.updateResponseVariable(e.responseIdentifier,e.response);let n=this.interactionElements.find(i=>i.getAttribute("response-identifier")===e.responseIdentifier);n&&(n.response=e.response)}}render(){return b`<slot></slot>`}connectedCallback(){this.#o(),super.connectedCallback(),this.updateComplete.then(()=>{this.validate(!1),Pr(this,"cito-item-rendered",this),this.dispatchEvent(new CustomEvent("qti-assessment-item-connected",{bubbles:!0,composed:!0,detail:this})),this.#f()})}disconnectedCallback(){this.#s(),super.disconnectedCallback()}#o(){this.addEventListener("qti-register-variable",this.#a),this.addEventListener("qti-register-interaction",this.#c),this.addEventListener("end-attempt",this.#p),this.addEventListener("qti-set-outcome-value",this.#l),this.addEventListener("qti-set-template-value",this.#d),this.addEventListener("qti-set-correct-response",this.#m),this.addEventListener("qti-interaction-response",this.#h)}#s(){this.removeEventListener("qti-register-variable",this.#a),this.removeEventListener("qti-register-interaction",this.#c),this.removeEventListener("end-attempt",this.#p),this.removeEventListener("qti-set-outcome-value",this.#l),this.removeEventListener("qti-set-template-value",this.#d),this.removeEventListener("qti-set-correct-response",this.#m),this.removeEventListener("qti-interaction-response",this.#h)}#a;#c;#p;#l;#d;#m;#h;async#f(){let t=Array.from(this.querySelectorAll("qti-template-declaration"));t.length>0&&(await Promise.all(t.map(e=>e.updateComplete)),await Promise.resolve()),this.#e=this.querySelector("qti-template-processing"),this.#n=!0,this.#g()}#g(){this.#e&&(this.#e.process(),this.#r={...this._context,variables:this._context.variables})}processResponse(t=!0,e=!0){this.validate(e),t&&this.updateOutcomeVariable("numAttempts",(+this._context.variables.find(i=>i.identifier==="numAttempts")?.value+1).toString()),this.adaptive==="false"&&this.#v();let r=this.querySelector("qti-response-processing"),n=!!(r&&typeof r.process=="function");return n&&r.process(),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this.#y()),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context,responseProcessed:!0}})),n}resetResponses(){this._context=this.#r}getResponse(t){return this.getVariable(t)}getOutcome(t){return this.getVariable(t)}getVariable(t){return this._context.variables.find(e=>e.identifier===t)||null}afterResponseVariableUpdated(){}updateResponseVariable(t,e){this._context={...this._context,variables:this._context.variables.map(r=>r.identifier!==t?r:{...r,value:e})},this.afterResponseVariableUpdated(),Pr(this,"cito-item-response-changed",{item:this.identifier,responseIdentifier:t,response:Array.isArray(e)?[...e]:e}),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this.#y())}updateTemplateVariable(t,e){let r=this._context.variables.find(i=>i.identifier===t&&i.type==="template");if(!r){console.warn(`Can not set qti-template-identifier: ${t}, it is not available`);return}let n=r.cardinality==="single"?Array.isArray(e)?e[0]:e??null:e==null?null:Array.isArray(e)?e:[e];this._context={...this._context,variables:this._context.variables.map(i=>i.identifier!==t?i:{...i,value:n})},this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}updateCorrectResponse(t,e){let r=this.getResponse(t);if(!r){console.warn(`Can not set correct response for identifier: ${t}, it is not available`);return}let n=r.cardinality==="single"?Array.isArray(e)?e[0]:e??null:e==null?null:Array.isArray(e)?e:[e];this._context={...this._context,variables:this._context.variables.map(i=>i.identifier!==t?i:{...i,correctResponse:n})},this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}setOutcomeVariable(t,e){this.updateOutcomeVariable(t,e),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}updateOutcomeVariable(t,e){let r=this.getOutcome(t);if(!r){console.warn(`Can not set qti-outcome-identifier: ${t}, it is not available`);return}this._context={...this._context,variables:this._context.variables.map(n=>n.identifier!==t?n:{...n,value:r.cardinality==="single"||Array.isArray(e)?e:[e]})},Pr(this,"cito-item-outcome-changed",{item:this.identifier,outcomeIdentifier:t,value:this._context.variables.find(n=>n.identifier===t)?.value})}validate(t=!0){let e=this.interactionElements.every(r=>r.validate());return this.#b(e),t&&this.reportValidity(),e}#b(t){this._context.valid!==t&&(this._context={...this._context,valid:t})}#u(){let t=this._context.valid;this.validate(!1),this._context.valid!==t&&this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}reportValidity(){for(let t of this.interactionElements)t.reportValidity()}#y(){let t=this.validate(!1);return t===!0?"completed":t===!1?"incomplete":"not_attempted"}#v(){this._context={...this._context,variables:this._context.variables.map(t=>{if(t.type!=="outcome")return t;let n=("defaultValue"in t?t.defaultValue:null)??null;return n==null&&(t.baseType==="integer"||t.baseType==="float")&&(n="0"),{...t,value:n}})}}};er([p({type:String})],ft.prototype,"identifier",void 0);er([p({type:String})],ft.prototype,"adaptive",void 0);er([p({type:String,attribute:"time-dependent"})],ft.prototype,"timeDependent",void 0);er([p({type:String})],ft.prototype,"title",null);er([p({type:Boolean})],ft.prototype,"disabled",void 0);er([p({type:Boolean})],ft.prototype,"readonly",void 0);er([U({context:F})],ft.prototype,"_context",void 0);var cd=q`
75
+ `]}render(){return b`<slot></slot>`}process(){let t=new dl,e=[...this.children];t.process(e)}},dl=class{process(t){try{for(let e of t)e.process()}catch(e){if(!(e instanceof Oi))throw e}}};var ri=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},ft=class extends C{constructor(){super(...arguments),this.#e=null,this.identifier="",this.adaptive="false",this.timeDependent=null,this._context={variables:sd},this.#i={...this._context,variables:this._context.variables},this.#r=new Map,this.#n=!1,this.interactionElements=[],this.#a=t=>{t.stopImmediatePropagation();let{variable:e}=t.detail,i=e.type==="template"?this.#r.get(e.identifier):void 0,n=i!==void 0?{...e,value:i}:e;this._context={...this._context,variables:[...this._context.variables,n]},this.#i=this._context,t.stopPropagation()},this.#c=t=>{t.stopImmediatePropagation(),this.interactionElements.push(t.detail.interactionElement)},this.#p=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,countAttempt:i}=t.detail;this.validate(),this.updateResponseVariable(e,"true"),this.processResponse(i)},this.#l=t=>{t.stopImmediatePropagation();let{outcomeIdentifier:e,value:i}=t.detail;this.updateOutcomeVariable(e,i),t.stopPropagation()},this.#d=t=>{t.stopImmediatePropagation();let{templateIdentifier:e,value:i}=t.detail;this.#r.has(e)||this.updateTemplateVariable(e,i??void 0),t.stopPropagation()},this.#m=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,value:i}=t.detail;this.updateCorrectResponse(e,i??void 0),t.stopPropagation()},this.#h=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,response:i,state:n}=t.detail;this.updateResponseVariable(e,i),n!==void 0&&(this._context={...this._context,state:{...this._context.state||{},[e]:n}}),this.validate(!1),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}}#t;#e;get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}willUpdate(t){super.willUpdate(t);let e=t.has("readonly")&&(this.readonly??!1)!==(this._context.readonly??!1),i=t.has("disabled")&&(this.disabled??!1)!==(this._context.disabled??!1);(e||i)&&(this._context={...this._context,...e?{readonly:!!this.readonly}:{},...i?{disabled:!!this.disabled}:{}})}set assessmentItemRefId(t){this._context={...this._context,identifier:t}}get assessmentItemRefId(){return this._context.identifier}get itemContext(){return this._context}get variables(){return this._context.variables.map(t=>({identifier:t.identifier,value:t.value,type:t.type,...t.type==="outcome"&&t.identifier==="SCORE"?{externalScored:t.externalScored}:{}}))}set variables(t){if(!Array.isArray(t)||t.some(r=>!("identifier"in r))){console.warn("variables property should be an array of VariableDeclaration");return}let e=this._context.variables,i=t.filter(r=>r.value!==null&&r.value!==void 0&&(r.type==="template"||e.some(s=>s.identifier===r.identifier&&s.type==="template")));i.forEach(r=>this.#r.set(r.identifier,r.value));let n=i.some(r=>JSON.stringify(e.find(s=>s.identifier===r.identifier)?.value)!==JSON.stringify(r.value));this._context={...this._context,variables:this._context.variables.map(r=>{let s=t.find(a=>a.identifier===r.identifier);return s?{...r,...s,interpolationTable:r.interpolationTable,matchTable:r.matchTable}:r})},this.#n&&n&&this.#g(),this.updateComplete.then(()=>this.#u())}get state(){return this._context.state}set state(t){this._context={...this._context,state:t?{...t}:void 0}}#i;#r;#n;set responses(t){if(t)for(let e of t){this.getResponse(e.responseIdentifier)&&this.updateResponseVariable(e.responseIdentifier,e.response);let n=this.interactionElements.find(r=>r.getAttribute("response-identifier")===e.responseIdentifier);n&&(n.response=e.response)}}render(){return b`<slot></slot>`}connectedCallback(){this.#o(),super.connectedCallback(),this.updateComplete.then(()=>{this.validate(!1),Mi(this,"cito-item-rendered",this),this.dispatchEvent(new CustomEvent("qti-assessment-item-connected",{bubbles:!0,composed:!0,detail:this})),this.#f()})}disconnectedCallback(){this.#s(),super.disconnectedCallback()}#o(){this.addEventListener("qti-register-variable",this.#a),this.addEventListener("qti-register-interaction",this.#c),this.addEventListener("end-attempt",this.#p),this.addEventListener("qti-set-outcome-value",this.#l),this.addEventListener("qti-set-template-value",this.#d),this.addEventListener("qti-set-correct-response",this.#m),this.addEventListener("qti-interaction-response",this.#h)}#s(){this.removeEventListener("qti-register-variable",this.#a),this.removeEventListener("qti-register-interaction",this.#c),this.removeEventListener("end-attempt",this.#p),this.removeEventListener("qti-set-outcome-value",this.#l),this.removeEventListener("qti-set-template-value",this.#d),this.removeEventListener("qti-set-correct-response",this.#m),this.removeEventListener("qti-interaction-response",this.#h)}#a;#c;#p;#l;#d;#m;#h;async#f(){let t=Array.from(this.querySelectorAll("qti-template-declaration"));t.length>0&&(await Promise.all(t.map(e=>e.updateComplete)),await Promise.resolve()),this.#e=this.querySelector("qti-template-processing"),this.#n=!0,this.#g()}#g(){this.#e&&(this.#e.process(),this.#i={...this._context,variables:this._context.variables})}processResponse(t=!0,e=!0){this.validate(e),t&&this.updateOutcomeVariable("numAttempts",(+this._context.variables.find(r=>r.identifier==="numAttempts")?.value+1).toString()),this.adaptive==="false"&&this.#v();let i=this.querySelector("qti-response-processing"),n=!!(i&&typeof i.process=="function");return n&&i.process(),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this.#y()),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context,responseProcessed:!0}})),n}resetResponses(){this._context=this.#i}getResponse(t){return this.getVariable(t)}getOutcome(t){return this.getVariable(t)}getVariable(t){return this._context.variables.find(e=>e.identifier===t)||null}afterResponseVariableUpdated(){}updateResponseVariable(t,e){this._context={...this._context,variables:this._context.variables.map(i=>i.identifier!==t?i:{...i,value:e})},this.afterResponseVariableUpdated(),Mi(this,"cito-item-response-changed",{item:this.identifier,responseIdentifier:t,response:Array.isArray(e)?[...e]:e}),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this.#y())}updateTemplateVariable(t,e){let i=this._context.variables.find(r=>r.identifier===t&&r.type==="template");if(!i){console.warn(`Can not set qti-template-identifier: ${t}, it is not available`);return}let n=i.cardinality==="single"?Array.isArray(e)?e[0]:e??null:e==null?null:Array.isArray(e)?e:[e];this._context={...this._context,variables:this._context.variables.map(r=>r.identifier!==t?r:{...r,value:n})},this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}updateCorrectResponse(t,e){let i=this.getResponse(t);if(!i){console.warn(`Can not set correct response for identifier: ${t}, it is not available`);return}let n=i.cardinality==="single"?Array.isArray(e)?e[0]:e??null:e==null?null:Array.isArray(e)?e:[e];this._context={...this._context,variables:this._context.variables.map(r=>r.identifier!==t?r:{...r,correctResponse:n})},this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}setOutcomeVariable(t,e){this.updateOutcomeVariable(t,e),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}updateOutcomeVariable(t,e){let i=this.getOutcome(t);if(!i){console.warn(`Can not set qti-outcome-identifier: ${t}, it is not available`);return}this._context={...this._context,variables:this._context.variables.map(n=>n.identifier!==t?n:{...n,value:i.cardinality==="single"||Array.isArray(e)?e:[e]})},Mi(this,"cito-item-outcome-changed",{item:this.identifier,outcomeIdentifier:t,value:this._context.variables.find(n=>n.identifier===t)?.value})}validate(t=!0){let e=this.interactionElements.every(i=>i.validate());return this.#b(e),t&&this.reportValidity(),e}#b(t){this._context.valid!==t&&(this._context={...this._context,valid:t})}#u(){let t=this._context.valid;this.validate(!1),this._context.valid!==t&&this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}reportValidity(){for(let t of this.interactionElements)t.reportValidity()}#y(){let t=this.validate(!1);return t===!0?"completed":t===!1?"incomplete":"not_attempted"}#v(){this._context={...this._context,variables:this._context.variables.map(t=>{if(t.type!=="outcome")return t;let n=("defaultValue"in t?t.defaultValue:null)??null;return n==null&&(t.baseType==="integer"||t.baseType==="float")&&(n="0"),{...t,value:n}})}}};ri([p({type:String})],ft.prototype,"identifier",void 0);ri([p({type:String})],ft.prototype,"adaptive",void 0);ri([p({type:String,attribute:"time-dependent"})],ft.prototype,"timeDependent",void 0);ri([p({type:String})],ft.prototype,"title",null);ri([p({type:Boolean})],ft.prototype,"disabled",void 0);ri([p({type:Boolean})],ft.prototype,"readonly",void 0);ri([U({context:F})],ft.prototype,"_context",void 0);var gd=q`
68
76
  :host {
69
77
  display: contents;
70
78
  }
@@ -72,11 +80,11 @@ Make sure to test your application with a production build as repeat registratio
72
80
  ::slotted(qti-catalog-info) {
73
81
  display: none;
74
82
  }
75
- `;var Jn=class extends C{static{this.styles=cd}connectedCallback(){super.connectedCallback(),this.removeAttribute("title")}render(){return b`<slot></slot>`}};function dd(o){o.querySelectorAll('qti-custom-operator[class="js.org"] > qti-base-value').forEach(e=>{let r=document.createComment(e.textContent);e.replaceChild(r,e.firstChild)})}async function hd(o,t,e,r="qti-portable-custom-interaction"){let n=[],i=o.querySelectorAll(r);if(i.length===0)return;let s=null,a=null,l=async()=>{if(s===null)try{s=await e(t,"/modules/module_resolution.js")}catch{s=null}if(a===null)try{a=await e(t,"/modules/fallback_module_resolution.js")}catch{a=null}};for(let c of Array.from(i)){c.setAttribute("data-base-url",t);let d=c.getAttribute("custom-interaction-type-identifier");d&&n.includes(d)&&(d=d+n.length,c.setAttribute("custom-interaction-type-identifier",d),n.push(d)),d&&n.push(d);let h=c.querySelector("qti-interaction-modules");if(h&&h.getAttribute("primary-configuration")){await l();let f=h.getAttribute("primary-configuration");if(f)try{let m=await e(t,`/${f}`),v=Array.from(h.querySelectorAll("qti-interaction-module"));for(let x of v){let u=x.getAttribute("id");if(u&&m.paths&&m.paths[u]){let g=m.paths[u],y=Array.isArray(g)?g[0]:g;if(x.setAttribute("primary-path",y),a&&a.paths&&a.paths[u]){let w=a.paths[u];Array.isArray(w)?x.setAttribute("fallback-path",w[0]):x.setAttribute("fallback-path",w)}}}if(m.paths){for(let x in m.paths)if(!h.querySelector(`qti-interaction-module[id="${x}"]`)){let g=o.createElement("qti-interaction-module");g.setAttribute("id",x);let y=Array.isArray(m.paths[x])?m.paths[x][0]:m.paths[x];if(g.setAttribute("primary-path",y),a&&a.paths&&a.paths[x]){let w=a.paths[x];Array.isArray(w)?g.setAttribute("fallback-path",w[0]):g.setAttribute("fallback-path",w)}h.appendChild(g)}}m.urlArgs&&h.setAttribute("url-args",m.urlArgs)}catch(m){console.warn(`Failed to load primary configuration: ${f}`,m)}}else if(await l(),s){c.querySelector("qti-interaction-modules")===null?(h=o.createElement("qti-interaction-modules"),c.appendChild(h)):h=c.querySelector("qti-interaction-modules");for(let f in s.paths){let m=s.paths[f],v="";a&&a.paths&&a.paths[f]&&(v=a.paths[f]);let x=Array.isArray(m)?m:[m],u=Array.isArray(v)?v:[v],g=x.map((y,w)=>{let I=u.length>w?u[w]:"";return{primaryPath:y,fallbackPath:I}});for(let y of u)g.some(w=>w.fallbackPath===y)||g.push({primaryPath:x.length>0?x[0]:y,fallbackPath:y});for(let y of g){let w=o.createElement("qti-interaction-module");y.fallbackPath&&w.setAttribute("fallback-path",y.fallbackPath),w.setAttribute("id",f),w.setAttribute("primary-path",y.primaryPath),h&&h.appendChild(w)}}}}}function pd(o,t,e){Array.from(o.getElementsByTagName("*")).filter(i=>i.localName===t||i.localName?.toLowerCase()===t.toLowerCase()).forEach(i=>{let s=`${t}-${e}`,a=md(i,s);i.replaceWith(a)})}function ud(o,t){o.querySelectorAll("*").forEach(e=>{let r=e.classList;r&&r.forEach(n=>{if(n.startsWith(`${t}:`)){let i=n.slice(`${t}:`.length),s=`${e.nodeName}-${i}`,a=md(e,s);e.replaceWith(a)}})})}function md(o,t){let e=o.ownerDocument.createElement(t);for(let r of o.attributes)e.setAttribute(r.name,r.value);for(;o.firstChild;)e.appendChild(o.firstChild);return e}function fd(o,t){let e=["hook","module"],r=t.substring(0,t.lastIndexOf("/"));for(let n of e)o.querySelectorAll("["+n+"]").forEach(s=>{let a=s.getAttribute(n);!a.startsWith("data:")&&!a.startsWith("http")&&(s.setAttribute("base-url",t),s.setAttribute("module",r+"/"+encodeURI(a+(a.endsWith(".js")?"":".js"))))})}var ol=class o{#t;constructor(t){if(!(t instanceof Uint8Array))throw new TypeError("SeededRandom seed must be a Uint8Array.");if(t.length>32)throw new RangeError("SeededRandom seed must be 32 bytes or less.");let e=new Uint8Array(32);e.set(t,32-t.length),this.#t=Ru(e)}static fromSeed(t){if(t.length!==32)throw new RangeError("SeededRandom.fromSeed requires a 32-byte seed.");return new o(t)}static fromFixed(t){if(typeof t!="number")throw new TypeError("SeededRandom.fromFixed requires a number.");if(!Number.isInteger(t)||t<0||t>255)throw new RangeError("SeededRandom.fromFixed requires an integer from 0 to 255.");let e=new Uint8Array(32);return e[31]=t,new o(e)}static fromSeedKey(t){let e=new o(new Uint8Array);return e.#t=Tu(`${t}`),e}random(){this.#t|=0,this.#t=this.#t+1831565813|0;let t=Math.imul(this.#t^this.#t>>>15,1|this.#t);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}};function Zn(o){return ol.fromSeedKey(o)}function Tu(o){let t=1779033703^o.length;for(let e=0;e<o.length;e++)t=Math.imul(t^o.charCodeAt(e),3432918353),t=t<<13|t>>>19;return gd(t)}function Ru(o){let t=1779033703^o.length;for(let e=0;e<o.length;e++)t=Math.imul(t^o[e],3432918353),t=t<<13|t>>>19;return gd(t)}function gd(o){let t=Math.imul(o^o>>>16,2246822507);return t=Math.imul(t^t>>>13,3266489909),(t^t>>>16)>>>0}var Pu=o=>typeof o=="function"?o():o.random();function to(o,t){let e=o.filter(n=>!n.fixed);for(let n=e.length-1;n>0;n--){let i=Math.floor(Pu(t)*(n+1));[e[n],e[i]]=[e[i],e[n]]}let r=0;return o.map(n=>n.fixed?n:e[r++])}function Ou(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 sl(o,t){let e=o.querySelectorAll('[shuffle="true"]'),r=Array.from(e).filter(a=>a.tagName?.toLowerCase().endsWith("-interaction")),n=t!=null&&`${t}`.length>0,i=o.querySelector?.("qti-assessment-item")?.getAttribute("identifier")??"",s=0;for(let a of r){let l=a.getAttribute("response-identifier")??`${s}`;s++;let c=Ou(a.tagName.toLowerCase()),d=Array.isArray(c)?c:[c],h=!1,f=0;for(let m of d){if(!m)continue;let v=n?Zn(`${t}:${i}:${l}:${f}`):Math.random;f++;let x=Array.from(a.querySelectorAll(m)).filter(w=>w.parentElement!==null);if(x.filter(w=>w.getAttribute("fixed")!=="true").length<=1){console.warn("Shuffling is not possible with fewer than 2 non-fixed elements.");continue}let u=x[0].parentElement;if(!u||x.some(w=>w.parentElement!==u)){console.warn("Shuffling is not possible when choices do not share the same parent element.");continue}let g=x[x.length-1].nextSibling,y=to(x.map(w=>({element:w,fixed:w.getAttribute("fixed")==="true"})),v);for(let w of x)w.remove();for(let{element:w}of y)u.insertBefore(w,g);h=!0}h&&a.removeAttribute("shuffle")}}function bd(o){o.querySelectorAll("qti-stylesheet").forEach(t=>t.remove())}var yd=!1;function eo(o,t){yd||(yd=!0,console.warn(`[${o}] No QTI_CONTEXT.seed provided; using "${t}" as deterministic fallback seed.`))}function Mu(o){return(o.textContent||"").replace(/\s+/g," ").trim().replace(/^This page contains the following errors:\s*/i,"").replace(/\s*Below is a rendering of the page up to the first error\.?\s*$/i,"").trim()||"malformed XML"}function vd(o,t){let r=new DOMParser().parseFromString(o.replace(/^[\s\uFEFF]+/,""),"text/xml"),n=r.getElementsByTagNameNS("http://www.w3.org/1999/xhtml","parsererror")[0]??r.getElementsByTagNameNS("http://www.mozilla.org/newlayout/xml/parsererror.xml","parsererror")[0];if(n)throw new Error(t(Mu(n)));return r}function Mr(o,t){return fetch(o,{signal:t}).then(e=>{if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return e.text()}).then(e=>vd(e,r=>`is not well-formed XML: ${r}`)).catch(e=>{throw e.name==="AbortError"?e:new Error(`Failed to load XML: ${e.message}`)})}function Dr(o){return vd(o,t=>`Failed to parse XML: ${t}`)}function wd(o,t,e){if(o.nodeType===Node.ELEMENT_NODE){let r=o,n;!r.namespaceURI||r.namespaceURI.startsWith("http://www.imsglobal.org/xsd/qti/")||r.namespaceURI.startsWith("http://www.imsglobal.org/xsd/imsqti")?n=e?t.createElement(r.localName,{customElementRegistry:e}):t.createElement(r.localName):n=t.createElementNS(r.namespaceURI,r.tagName);for(let i=0;i<r.attributes.length;i++){let s=r.attributes[i];n.setAttribute(s.localName,s.value)}for(let i=0;i<r.childNodes.length;i++)n.appendChild(wd(r.childNodes[i],t,e));return n}return o.cloneNode(!1)}function Nr(o,t){let e=document.createDocumentFragment();for(let r=0;r<o.childNodes.length;r++)e.appendChild(wd(o.childNodes[r],document,t));return e}function $r(o,t){t.endsWith("/")||(t+="/"),o.querySelectorAll("*").forEach(r=>{for(let n of["src","href","srcset","poster"]){let i=r.getAttribute(n)?.trim();if(i&&!/^(data:|https?:|blob:)/.test(i)){let s=t+encodeURI(i);r.setAttribute(n,s)}}})}var Kt=()=>{let o,t="",e={load(r,n){return t=r,Mr(r,n).then(i=>(o=i,e))},parse(r){return o=Dr(r),t="",e},path:r=>($r(o,r),t=null,e),fn(r){return r(o),e},pciHooks(r){return fd(o,r),e},async configurePci(r,n,i="qti-portable-custom-interaction"){return await hd(o,r,n,i),e},shuffleInteractions(r){let n=typeof r=="string"?r.trim():r;if(n==null||n===""){let i=t||"default-item-seed";return eo("qtiTransformItem",i),sl(o,i),e}return sl(o,n),e},extendElementName:(r,n)=>(pd(o,r,n),e),extendElementsWithClass:(r="extend")=>(ud(o,r),e),customInteraction(r,n){let i=o.querySelector("qti-custom-interaction"),s=i.querySelector("object");return i.setAttribute("data-base-ref",r),i.setAttribute("data-base-item",r+n),i.setAttribute("data",s.getAttribute("data")),i.setAttribute("width",s.getAttribute("width")),i.setAttribute("height",s.getAttribute("height")),i.removeChild(s),e},convertCDATAtoComment(){return dd(o),e},stripStyleSheets(){return bd(o),e},html(){return t!==null&&$r(o,t.substring(0,t.lastIndexOf("/"))),new XMLSerializer().serializeToString(Nr(o))},xml(){return new XMLSerializer().serializeToString(o)},htmlDoc(r){return t!==null&&$r(o,t.substring(0,t.lastIndexOf("/"))),Nr(o,r)},xmlDoc(){return o}};return e};var xd=()=>{let o,t={async load(e,r){return o=await Mr(e,r),t},parse(e){o=Dr(e)},assessmentTest(){let e=o.querySelector('resource[type="imsqti_test_xmlv3p0"]');return{href:e.getAttribute("href"),identifier:e.getAttribute("identifier")}}};return t};function qd(o){let t=[];return o.querySelectorAll("qti-assessment-item-ref").forEach(e=>{let r=e.getAttribute("identifier"),n=e.getAttribute("href"),i=e.getAttribute("category");t.push({identifier:r,href:n,category:i})}),t}var ro=(o,...t)=>t.includes(o.localName)||t.includes(o.localName?.toLowerCase?.()),Cd=o=>ro(o,"qti-assessment-item-ref","assessmentitemref"),$i=o=>ro(o,"qti-assessment-section","assessmentsection"),Ni=(o,...t)=>t.some(e=>{let r=(o.getAttribute(e)??"").trim().toLowerCase();return r==="true"||r==="1"}),Du=(o,...t)=>t.some(e=>{let r=(o.getAttribute(e)??"").trim().toLowerCase();return r==="false"||r==="0"}),al=o=>ro(o,"qti-ordering","ordering"),Nu=o=>ro(o,"qti-selection","selection"),$u=o=>Array.from(o.children).filter(t=>al(t)&&Ni(t,"shuffle")),Lu=(o,t)=>Zn(`${o}:${t}`);function Vu(o){let t=[],e=[],r=n=>{for(let i of Array.from(n.children))Cd(i)?t.push(i):$i(i)?r(i):!al(i)&&!Nu(i)&&e.push(i.localName)};return r(o),{itemRefs:t,dropped:e}}function zu(o,t){if(t.length===0)return;let e=o.getAttribute("identifier")??"(no identifier)";console.warn(`[qtiTransformTest] Subsection "${e}" is consumed by section ordering; discarding its ${[...new Set(t)].join(", ")}.`)}function Sd(o,t){for(let l of Array.from(o.children))$i(l)&&Sd(l,t);let e=$u(o);if(e.length===0)return;let r=[],n=[];for(let l of Array.from(o.children))if(Cd(l))r.push({nodes:[l],fixed:Ni(l,"fixed")}),n.push(l);else if($i(l)){let{itemRefs:c,dropped:d}=Vu(l);if(zu(l,d),Du(l,"keep-together","keeptogether"))for(let h of c)r.push({nodes:[h],fixed:Ni(h,"fixed")});else c.length>0&&r.push({nodes:c,fixed:Ni(l,"fixed")});n.push(l)}let i=n.length>0?n[n.length-1].nextSibling:null,s=o.getAttribute("identifier")??"",a=to(r,Lu(t,s));for(let l of n)l.remove();for(let l of a)for(let c of l.nodes)o.insertBefore(c,i);for(let l of e)l.remove()}function kd(o){return Array.from(o.getElementsByTagName("*")).some(t=>al(t)&&Ni(t,"shuffle"))}function ll(o,t){let e=Array.from(o.getElementsByTagName("*")).filter(r=>$i(r));for(let r of e){if(!r.parentNode)continue;let n=r.parentElement;n&&$i(n)||Sd(r,t)}}var Lr=()=>{let o,t="",e={async load(r,n){return o=await Mr(r,n),t=r,e.path(r.substring(0,r.lastIndexOf("/"))),e},parse(r){return o=Dr(r),t="",e},path:r=>($r(o,r),e),fn(r){return r(o),e},shuffleOrdering(r){if(!kd(o))return e;let n=typeof r=="string"?r.trim():r;if(n==null||n===""){let i=t||"default-test-seed";return eo("qtiTransformTest",i),ll(o,i),e}return ll(o,n),e},items(){return qd(o)},html(){return new XMLSerializer().serializeToString(Nr(o))},xml(){return new XMLSerializer().serializeToString(o)},htmlDoc(r){return Nr(o,r)},xmlDoc(){return o}};return e};var Ed=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},cl=class o extends Event{static{this.eventName="qti-assessment-stimulus-ref-connected"}constructor(t,e){super(o.eventName,{bubbles:!0,composed:!0,cancelable:!0}),this.element=t,this.item=e}},Vr=class extends C{constructor(){super(...arguments),this.identifier="",this.href=""}async connectedCallback(){super.connectedCallback(),await this.updateComplete;let t=this.closest("qti-assessment-item"),e=new cl(this,t);this.dispatchEvent(e);let r=t?.querySelector(`[data-stimulus-idref="${this.identifier}"]`);!e.defaultPrevented&&r&&await this.updateStimulusRef(r)}async updateStimulusRef(t){let r=(await Kt().load(this.href).then(n=>n.htmlDoc()))?.querySelector("qti-assessment-stimulus");r&&(t.innerHTML="",t.append(r))}};Ed([p({type:String})],Vr.prototype,"identifier",void 0);Ed([p({type:String})],Vr.prototype,"href",void 0);var io=class extends C{};var ju=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Li=class extends C{render(){return b`<slot @slotchange=${this.#t}></slot>`}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>this.#t())}updated(t){t.has("context")&&this.#t()}#t(){let t=new Map,e=(this.context?.variables??[]).filter(n=>n.type==="template");for(let n of e){let i=n;i.mathVariable!==!0||i.value===null||i.value===void 0||t.set(i.identifier,this.#e(i.value))}if(t.size===0)return;let r=Array.from(this.querySelectorAll("*")).filter(n=>n.localName.toLowerCase()==="mi"||n.localName.toLowerCase()==="mn");for(let n of r){let i=n.getAttribute("data-qti-math-variable-source")??n.textContent?.trim()??"",s=t.get(i);if(!s)continue;if(n.localName.toLowerCase()==="mn"){n.textContent=s,n.setAttribute("data-qti-math-variable-source",i);continue}let a=document.createElement("mn");a.textContent=s,a.setAttribute("data-qti-math-variable-source",i),n.replaceWith(a)}}#e(t){return Array.isArray(t)?t.join(" "):t?.toString()??""}};ju([_({context:F,subscribe:!0}),T()],Li.prototype,"context",void 0);var Ad=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},zr=class extends C{constructor(){super(...arguments),this.identifier="",this.cardinality="record"}static{this.styles=[q`
83
+ `;var ro=class extends C{static{this.styles=gd}connectedCallback(){super.connectedCallback(),this.removeAttribute("title")}render(){return b`<slot></slot>`}};function bd(o){o.querySelectorAll('qti-custom-operator[class="js.org"] > qti-base-value').forEach(e=>{let i=document.createComment(e.textContent);e.replaceChild(i,e.firstChild)})}async function yd(o,t,e,i="qti-portable-custom-interaction"){let n=[],r=o.querySelectorAll(i);if(r.length===0)return;let s=null,a=null,l=async()=>{if(s===null)try{s=await e(t,"/modules/module_resolution.js")}catch{s=null}if(a===null)try{a=await e(t,"/modules/fallback_module_resolution.js")}catch{a=null}};for(let c of Array.from(r)){c.setAttribute("data-base-url",t);let d=c.getAttribute("custom-interaction-type-identifier");d&&n.includes(d)&&(d=d+n.length,c.setAttribute("custom-interaction-type-identifier",d),n.push(d)),d&&n.push(d);let h=c.querySelector("qti-interaction-modules");if(h&&h.getAttribute("primary-configuration")){await l();let f=h.getAttribute("primary-configuration");if(f)try{let m=await e(t,`/${f}`),v=Array.from(h.querySelectorAll("qti-interaction-module"));for(let x of v){let u=x.getAttribute("id");if(u&&m.paths&&m.paths[u]){let g=m.paths[u],y=Array.isArray(g)?g[0]:g;if(x.setAttribute("primary-path",y),a&&a.paths&&a.paths[u]){let w=a.paths[u];Array.isArray(w)?x.setAttribute("fallback-path",w[0]):x.setAttribute("fallback-path",w)}}}if(m.paths){for(let x in m.paths)if(!h.querySelector(`qti-interaction-module[id="${x}"]`)){let g=o.createElement("qti-interaction-module");g.setAttribute("id",x);let y=Array.isArray(m.paths[x])?m.paths[x][0]:m.paths[x];if(g.setAttribute("primary-path",y),a&&a.paths&&a.paths[x]){let w=a.paths[x];Array.isArray(w)?g.setAttribute("fallback-path",w[0]):g.setAttribute("fallback-path",w)}h.appendChild(g)}}m.urlArgs&&h.setAttribute("url-args",m.urlArgs)}catch(m){console.warn(`Failed to load primary configuration: ${f}`,m)}}else if(await l(),s){c.querySelector("qti-interaction-modules")===null?(h=o.createElement("qti-interaction-modules"),c.appendChild(h)):h=c.querySelector("qti-interaction-modules");for(let f in s.paths){let m=s.paths[f],v="";a&&a.paths&&a.paths[f]&&(v=a.paths[f]);let x=Array.isArray(m)?m:[m],u=Array.isArray(v)?v:[v],g=x.map((y,w)=>{let A=u.length>w?u[w]:"";return{primaryPath:y,fallbackPath:A}});for(let y of u)g.some(w=>w.fallbackPath===y)||g.push({primaryPath:x.length>0?x[0]:y,fallbackPath:y});for(let y of g){let w=o.createElement("qti-interaction-module");y.fallbackPath&&w.setAttribute("fallback-path",y.fallbackPath),w.setAttribute("id",f),w.setAttribute("primary-path",y.primaryPath),h&&h.appendChild(w)}}}}}function vd(o,t,e){Array.from(o.getElementsByTagName("*")).filter(r=>r.localName===t||r.localName?.toLowerCase()===t.toLowerCase()).forEach(r=>{let s=`${t}-${e}`,a=xd(r,s);r.replaceWith(a)})}function wd(o,t){o.querySelectorAll("*").forEach(e=>{let i=e.classList;i&&i.forEach(n=>{if(n.startsWith(`${t}:`)){let r=n.slice(`${t}:`.length),s=`${e.nodeName}-${r}`,a=xd(e,s);e.replaceWith(a)}})})}function xd(o,t){let e=o.ownerDocument.createElement(t);for(let i of o.attributes)e.setAttribute(i.name,i.value);for(;o.firstChild;)e.appendChild(o.firstChild);return e}function qd(o,t){let e=["hook","module"],i=t.substring(0,t.lastIndexOf("/"));for(let n of e)o.querySelectorAll("["+n+"]").forEach(s=>{let a=s.getAttribute(n);!a.startsWith("data:")&&!a.startsWith("http")&&(s.setAttribute("base-url",t),s.setAttribute("module",i+"/"+encodeURI(a+(a.endsWith(".js")?"":".js"))))})}var hl=class o{#t;constructor(t){if(!(t instanceof Uint8Array))throw new TypeError("SeededRandom seed must be a Uint8Array.");if(t.length>32)throw new RangeError("SeededRandom seed must be 32 bytes or less.");let e=new Uint8Array(32);e.set(t,32-t.length),this.#t=Fu(e)}static fromSeed(t){if(t.length!==32)throw new RangeError("SeededRandom.fromSeed requires a 32-byte seed.");return new o(t)}static fromFixed(t){if(typeof t!="number")throw new TypeError("SeededRandom.fromFixed requires a number.");if(!Number.isInteger(t)||t<0||t>255)throw new RangeError("SeededRandom.fromFixed requires an integer from 0 to 255.");let e=new Uint8Array(32);return e[31]=t,new o(e)}static fromSeedKey(t){let e=new o(new Uint8Array);return e.#t=ju(`${t}`),e}random(){this.#t|=0,this.#t=this.#t+1831565813|0;let t=Math.imul(this.#t^this.#t>>>15,1|this.#t);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}};function no(o){return hl.fromSeedKey(o)}function ju(o){let t=1779033703^o.length;for(let e=0;e<o.length;e++)t=Math.imul(t^o.charCodeAt(e),3432918353),t=t<<13|t>>>19;return Cd(t)}function Fu(o){let t=1779033703^o.length;for(let e=0;e<o.length;e++)t=Math.imul(t^o[e],3432918353),t=t<<13|t>>>19;return Cd(t)}function Cd(o){let t=Math.imul(o^o>>>16,2246822507);return t=Math.imul(t^t>>>13,3266489909),(t^t>>>16)>>>0}var Bu=o=>typeof o=="function"?o():o.random();function oo(o,t){let e=o.filter(n=>!n.fixed);for(let n=e.length-1;n>0;n--){let r=Math.floor(Bu(t)*(n+1));[e[n],e[r]]=[e[r],e[n]]}let i=0;return o.map(n=>n.fixed?n:e[i++])}function Uu(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 pl(o,t){let e=o.querySelectorAll('[shuffle="true"]'),i=Array.from(e).filter(a=>a.tagName?.toLowerCase().endsWith("-interaction")),n=t!=null&&`${t}`.length>0,r=o.querySelector?.("qti-assessment-item")?.getAttribute("identifier")??"",s=0;for(let a of i){let l=a.getAttribute("response-identifier")??`${s}`;s++;let c=Uu(a.tagName.toLowerCase()),d=Array.isArray(c)?c:[c],h=!1,f=0;for(let m of d){if(!m)continue;let v=n?no(`${t}:${r}:${l}:${f}`):Math.random;f++;let x=Array.from(a.querySelectorAll(m)).filter(w=>w.parentElement!==null);if(x.filter(w=>w.getAttribute("fixed")!=="true").length<=1){console.warn("Shuffling is not possible with fewer than 2 non-fixed elements.");continue}let u=x[0].parentElement;if(!u||x.some(w=>w.parentElement!==u)){console.warn("Shuffling is not possible when choices do not share the same parent element.");continue}let g=x[x.length-1].nextSibling,y=oo(x.map(w=>({element:w,fixed:w.getAttribute("fixed")==="true"})),v);for(let w of x)w.remove();for(let{element:w}of y)u.insertBefore(w,g);h=!0}h&&a.removeAttribute("shuffle")}}function Sd(o){o.querySelectorAll("qti-stylesheet").forEach(t=>t.remove())}var kd=!1;function so(o,t){kd||(kd=!0,console.warn(`[${o}] No QTI_CONTEXT.seed provided; using "${t}" as deterministic fallback seed.`))}function Hu(o){return(o.textContent||"").replace(/\s+/g," ").trim().replace(/^This page contains the following errors:\s*/i,"").replace(/\s*Below is a rendering of the page up to the first error\.?\s*$/i,"").trim()||"malformed XML"}function Ed(o,t){let i=new DOMParser().parseFromString(o.replace(/^[\s\uFEFF]+/,""),"text/xml"),n=i.getElementsByTagNameNS("http://www.w3.org/1999/xhtml","parsererror")[0]??i.getElementsByTagNameNS("http://www.mozilla.org/newlayout/xml/parsererror.xml","parsererror")[0];if(n)throw new Error(t(Hu(n)));return i}function Ni(o,t){return fetch(o,{signal:t}).then(e=>{if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return e.text()}).then(e=>Ed(e,i=>`is not well-formed XML: ${i}`)).catch(e=>{throw e.name==="AbortError"?e:new Error(`Failed to load XML: ${e.message}`)})}function $i(o){return Ed(o,t=>`Failed to parse XML: ${t}`)}function Id(o,t,e){if(o.nodeType===Node.ELEMENT_NODE){let i=o,n;!i.namespaceURI||i.namespaceURI.startsWith("http://www.imsglobal.org/xsd/qti/")||i.namespaceURI.startsWith("http://www.imsglobal.org/xsd/imsqti")?n=e?t.createElement(i.localName,{customElementRegistry:e}):t.createElement(i.localName):n=t.createElementNS(i.namespaceURI,i.tagName);for(let r=0;r<i.attributes.length;r++){let s=i.attributes[r];n.setAttribute(s.localName,s.value)}for(let r=0;r<i.childNodes.length;r++)n.appendChild(Id(i.childNodes[r],t,e));return n}return o.cloneNode(!1)}function Li(o,t){let e=document.createDocumentFragment();for(let i=0;i<o.childNodes.length;i++)e.appendChild(Id(o.childNodes[i],document,t));return e}function Vi(o,t){t.endsWith("/")||(t+="/"),o.querySelectorAll("*").forEach(i=>{for(let n of["src","href","srcset","poster"]){let r=i.getAttribute(n)?.trim();if(r&&!/^(data:|https?:|blob:)/.test(r)){let s=t+encodeURI(r);i.setAttribute(n,s)}}})}var Jt=()=>{let o,t="",e={load(i,n){return t=i,Ni(i,n).then(r=>(o=r,e))},parse(i){return o=$i(i),t="",e},path:i=>(Vi(o,i),t=null,e),fn(i){return i(o),e},pciHooks(i){return qd(o,i),e},async configurePci(i,n,r="qti-portable-custom-interaction"){return await yd(o,i,n,r),e},shuffleInteractions(i){let n=typeof i=="string"?i.trim():i;if(n==null||n===""){let r=t||"default-item-seed";return so("qtiTransformItem",r),pl(o,r),e}return pl(o,n),e},extendElementName:(i,n)=>(vd(o,i,n),e),extendElementsWithClass:(i="extend")=>(wd(o,i),e),customInteraction(i,n){let r=o.querySelector("qti-custom-interaction"),s=r.querySelector("object");return r.setAttribute("data-base-ref",i),r.setAttribute("data-base-item",i+n),r.setAttribute("data",s.getAttribute("data")),r.setAttribute("width",s.getAttribute("width")),r.setAttribute("height",s.getAttribute("height")),r.removeChild(s),e},convertCDATAtoComment(){return bd(o),e},stripStyleSheets(){return Sd(o),e},html(){return t!==null&&Vi(o,t.substring(0,t.lastIndexOf("/"))),new XMLSerializer().serializeToString(Li(o))},xml(){return new XMLSerializer().serializeToString(o)},htmlDoc(i){return t!==null&&Vi(o,t.substring(0,t.lastIndexOf("/"))),Li(o,i)},xmlDoc(){return o}};return e};var Ad=()=>{let o,t={async load(e,i){return o=await Ni(e,i),t},parse(e){o=$i(e)},assessmentTest(){let e=o.querySelector('resource[type="imsqti_test_xmlv3p0"]');return{href:e.getAttribute("href"),identifier:e.getAttribute("identifier")}}};return t};function _d(o){let t=[];return o.querySelectorAll("qti-assessment-item-ref").forEach(e=>{let i=e.getAttribute("identifier"),n=e.getAttribute("href"),r=e.getAttribute("category");t.push({identifier:i,href:n,category:r})}),t}var ao=(o,...t)=>t.includes(o.localName)||t.includes(o.localName?.toLowerCase?.()),Td=o=>ao(o,"qti-assessment-item-ref","assessmentitemref"),Vr=o=>ao(o,"qti-assessment-section","assessmentsection"),Lr=(o,...t)=>t.some(e=>{let i=(o.getAttribute(e)??"").trim().toLowerCase();return i==="true"||i==="1"}),Wu=(o,...t)=>t.some(e=>{let i=(o.getAttribute(e)??"").trim().toLowerCase();return i==="false"||i==="0"}),ul=o=>ao(o,"qti-ordering","ordering"),Qu=o=>ao(o,"qti-selection","selection"),Xu=o=>Array.from(o.children).filter(t=>ul(t)&&Lr(t,"shuffle")),Gu=(o,t)=>no(`${o}:${t}`);function Yu(o){let t=[],e=[],i=n=>{for(let r of Array.from(n.children))Td(r)?t.push(r):Vr(r)?i(r):!ul(r)&&!Qu(r)&&e.push(r.localName)};return i(o),{itemRefs:t,dropped:e}}function Ku(o,t){if(t.length===0)return;let e=o.getAttribute("identifier")??"(no identifier)";console.warn(`[qtiTransformTest] Subsection "${e}" is consumed by section ordering; discarding its ${[...new Set(t)].join(", ")}.`)}function Rd(o,t){for(let l of Array.from(o.children))Vr(l)&&Rd(l,t);let e=Xu(o);if(e.length===0)return;let i=[],n=[];for(let l of Array.from(o.children))if(Td(l))i.push({nodes:[l],fixed:Lr(l,"fixed")}),n.push(l);else if(Vr(l)){let{itemRefs:c,dropped:d}=Yu(l);if(Ku(l,d),Wu(l,"keep-together","keeptogether"))for(let h of c)i.push({nodes:[h],fixed:Lr(h,"fixed")});else c.length>0&&i.push({nodes:c,fixed:Lr(l,"fixed")});n.push(l)}let r=n.length>0?n[n.length-1].nextSibling:null,s=o.getAttribute("identifier")??"",a=oo(i,Gu(t,s));for(let l of n)l.remove();for(let l of a)for(let c of l.nodes)o.insertBefore(c,r);for(let l of e)l.remove()}function Pd(o){return Array.from(o.getElementsByTagName("*")).some(t=>ul(t)&&Lr(t,"shuffle"))}function ml(o,t){let e=Array.from(o.getElementsByTagName("*")).filter(i=>Vr(i));for(let i of e){if(!i.parentNode)continue;let n=i.parentElement;n&&Vr(n)||Rd(i,t)}}var zi=()=>{let o,t="",e={async load(i,n){return o=await Ni(i,n),t=i,e.path(i.substring(0,i.lastIndexOf("/"))),e},parse(i){return o=$i(i),t="",e},path:i=>(Vi(o,i),e),fn(i){return i(o),e},shuffleOrdering(i){if(!Pd(o))return e;let n=typeof i=="string"?i.trim():i;if(n==null||n===""){let r=t||"default-test-seed";return so("qtiTransformTest",r),ml(o,r),e}return ml(o,n),e},items(){return _d(o)},html(){return new XMLSerializer().serializeToString(Li(o))},xml(){return new XMLSerializer().serializeToString(o)},htmlDoc(i){return Li(o,i)},xmlDoc(){return o}};return e};var Od=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},fl=class o extends Event{static{this.eventName="qti-assessment-stimulus-ref-connected"}constructor(t,e){super(o.eventName,{bubbles:!0,composed:!0,cancelable:!0}),this.element=t,this.item=e}},ji=class extends C{constructor(){super(...arguments),this.identifier="",this.href=""}async connectedCallback(){super.connectedCallback(),await this.updateComplete;let t=this.closest("qti-assessment-item"),e=new fl(this,t);this.dispatchEvent(e);let i=t?.querySelector(`[data-stimulus-idref="${this.identifier}"]`);!e.defaultPrevented&&i&&await this.updateStimulusRef(i)}async updateStimulusRef(t){let i=(await Jt().load(this.href).then(n=>n.htmlDoc()))?.querySelector("qti-assessment-stimulus");i&&(t.innerHTML="",t.append(i))}};Od([p({type:String})],ji.prototype,"identifier",void 0);Od([p({type:String})],ji.prototype,"href",void 0);var lo=class extends C{};var Ju=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},zr=class extends C{render(){return b`<slot @slotchange=${this.#t}></slot>`}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>this.#t())}updated(t){t.has("context")&&this.#t()}#t(){let t=new Map,e=(this.context?.variables??[]).filter(n=>n.type==="template");for(let n of e){let r=n;r.mathVariable!==!0||r.value===null||r.value===void 0||t.set(r.identifier,this.#e(r.value))}if(t.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 r=n.getAttribute("data-qti-math-variable-source")??n.textContent?.trim()??"",s=t.get(r);if(!s)continue;if(n.localName.toLowerCase()==="mn"){n.textContent=s,n.setAttribute("data-qti-math-variable-source",r);continue}let a=document.createElement("mn");a.textContent=s,a.setAttribute("data-qti-math-variable-source",r),n.replaceWith(a)}}#e(t){return Array.isArray(t)?t.join(" "):t?.toString()??""}};Ju([_({context:F,subscribe:!0}),T()],zr.prototype,"context",void 0);var Md=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},Fi=class extends C{constructor(){super(...arguments),this.identifier="",this.cardinality="record"}static{this.styles=[q`
76
84
  :host {
77
85
  display: none;
78
86
  }
79
- `]}render(){return b`<slot></slot>`}};Ad([p({type:String})],zr.prototype,"identifier",void 0);Ad([p({type:String})],zr.prototype,"cardinality",void 0);var Fu=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Vi=class extends C{#t;render(){return b`<slot @slotchange=${this.handleSlotChange}></slot>`}handleSlotChange(){let t=Array.from(this.firstElementChild?.childNodes??[]).find(e=>e.nodeType===Node.COMMENT_NODE);try{this.#t=new Function("context","fn","item",t?.textContent??"")}catch(e){console.error("custom-operator contains invalid javascript code",e)}}calculate(){let t=this.getAttribute("definition");if(t)return this.#e(t);let e={variable:n=>this._context?.variables.find(i=>i.identifier===n)?.value??"",correct:n=>this._context?.variables.find(i=>i.identifier===n)?.correctResponse??""},r={getVariable:n=>this._context?.variables.find(i=>i.identifier===n),updateOutcomeVariable:(n,i)=>{this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:n,value:i}}))},updateResponseVariable:(n,i)=>{this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:n,response:i}}))}};return this.#t(this._context,e,r)}#e(t){let e=id(t);if(!e)return console.warn(`qti-custom-operator: no operator registered for definition "${t}"`),null;let r=Array.from(this.children).map(n=>{let i=n.calculate;return typeof i=="function"?i.call(n):null});return e(r)}};Fu([_({context:F,subscribe:!0}),T()],Vi.prototype,"_context",void 0);var no=class extends mt{static{this.styles=q`
87
+ `]}render(){return b`<slot></slot>`}};Md([p({type:String})],Fi.prototype,"identifier",void 0);Md([p({type:String})],Fi.prototype,"cardinality",void 0);var Zu=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},jr=class extends C{#t;render(){return b`<slot @slotchange=${this.handleSlotChange}></slot>`}handleSlotChange(){let t=Array.from(this.firstElementChild?.childNodes??[]).find(e=>e.nodeType===Node.COMMENT_NODE);try{this.#t=new Function("context","fn","item",t?.textContent??"")}catch(e){console.error("custom-operator contains invalid javascript code",e)}}calculate(){let t=this.getAttribute("definition");if(t)return this.#e(t);let e={variable:n=>this._context?.variables.find(r=>r.identifier===n)?.value??"",correct:n=>this._context?.variables.find(r=>r.identifier===n)?.correctResponse??""},i={getVariable:n=>this._context?.variables.find(r=>r.identifier===n),updateOutcomeVariable:(n,r)=>{this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:n,value:r}}))},updateResponseVariable:(n,r)=>{this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:n,response:r}}))}};return this.#t(this._context,e,i)}#e(t){let e=cd(t);if(!e)return console.warn(`qti-custom-operator: no operator registered for definition "${t}"`),null;let i=Array.from(this.children).map(n=>{let r=n.calculate;return typeof r=="function"?r.call(n):null});return e(i)}};Zu([_({context:F,subscribe:!0}),T()],jr.prototype,"_context",void 0);var co=class extends mt{static{this.styles=q`
80
88
  :host {
81
89
  display: block;
82
90
  }
@@ -86,18 +94,18 @@ Make sure to test your application with a production build as repeat registratio
86
94
  .off {
87
95
  display: none;
88
96
  }
89
- `}render(){return b` <slot part="feedback" class="feedback ${this.showStatus}"></slot> `}connectedCallback(){super.connectedCallback(),this.checkShowFeedback(this.outcomeIdentifier)}};var Z=o=>o??O;var oo=class extends mt{constructor(){super(...arguments),this.render=()=>b` <slot part="feedback" class="${Z(this.showStatus)}"></slot> `}static{this.styles=q`
97
+ `}render(){return b` <slot part="feedback" class="feedback ${this.showStatus}"></slot> `}connectedCallback(){super.connectedCallback(),this.checkShowFeedback(this.outcomeIdentifier)}};var Z=o=>o??O;var ho=class extends mt{constructor(){super(...arguments),this.render=()=>b` <slot part="feedback" class="${Z(this.showStatus)}"></slot> `}static{this.styles=q`
90
98
  .on {
91
99
  display: inline-block;
92
100
  }
93
101
  .off {
94
102
  display: none;
95
103
  }
96
- `}connectedCallback(){super.connectedCallback(),this.checkShowFeedback(this.outcomeIdentifier)}};var Id=q`
104
+ `}connectedCallback(){super.connectedCallback(),this.checkShowFeedback(this.outcomeIdentifier)}};var Dd=q`
97
105
  :host {
98
106
  display: block;
99
107
  }
100
- `;var so=class extends C{static{this.styles=Id}render(){return b`<slot part="qti-rubric-blocks" name="qti-rubric-block"></slot><slot></slot>`}};var jr=class extends mt{static{this.styles=q`
108
+ `;var po=class extends C{static{this.styles=Dd}render(){return b`<slot part="qti-rubric-blocks" name="qti-rubric-block"></slot><slot></slot>`}};var Bi=class extends mt{static{this.styles=q`
101
109
  .cito-dialog {
102
110
  background: var(--qti-bg);
103
111
  border: var(--qti-border-thickness) var(--qti-border-style) var(--qti-border-color);
@@ -142,15 +150,15 @@ Make sure to test your application with a production build as repeat registratio
142
150
  <button class="button close-button" @click="${this.closeFeedback}">Close</button>
143
151
  </div>
144
152
  </dialog>
145
- `}openFeedback(){let t=this.shadowRoot?.querySelector("dialog");t&&!t.open&&t.showModal()}closeFeedback(){let t=this.shadowRoot?.querySelector("dialog");t&&t.open&&(t.close(),this.showStatus="off")}connectedCallback(){super.connectedCallback(),this.showStatus==="on"&&this.openFeedback()}updated(t){t.has("showStatus")&&(this.showStatus==="on"?this.openFeedback():this.closeFeedback())}};var zi=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},le=class extends _r{constructor(){super(...arguments),this.externalScored=null}static{this.styles=[q`
153
+ `}openFeedback(){let t=this.shadowRoot?.querySelector("dialog");t&&!t.open&&t.showModal()}closeFeedback(){let t=this.shadowRoot?.querySelector("dialog");t&&t.open&&(t.close(),this.showStatus="off")}connectedCallback(){super.connectedCallback(),this.showStatus==="on"&&this.openFeedback()}updated(t){t.has("showStatus")&&(this.showStatus==="on"?this.openFeedback():this.closeFeedback())}};var Fr=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},de=class extends Ri{constructor(){super(...arguments),this.externalScored=null}static{this.styles=[q`
146
154
  :host {
147
155
  display: none;
148
156
  }
149
- `]}render(){let t=this.itemContext?.variables.find(e=>e.identifier===this.identifier)?.value;return b`${JSON.stringify(t,null,2)}`}get interpolationTable(){let t=this.querySelector("qti-interpolation-table");if(!t)return null;let e=[];for(let r of t.querySelectorAll("qti-interpolation-table-entry")){let n=parseFloat(r.getAttribute("source-value")),i=parseFloat(r.getAttribute("target-value"));if(Number.isNaN(n)||Number.isNaN(i)){console.error("source-value or target-value is missing or not a number in qti-interpolation-table-entry");continue}e.push({sourceValue:n,targetValue:i,includeBoundary:r.getAttribute("include-boundary")!=="false"})}return e}get matchTable(){let t=this.querySelector("qti-match-table");if(!t)return null;let e=new Map;for(let r of t.querySelectorAll("qti-match-table-entry")){let n=parseFloat(r.getAttribute("source-value")),i=r.getAttribute("target-value");if(Number.isNaN(n)||i===null){console.error("source-value or target-value is missing or invalid in qti-match-table-entry");continue}e.set(n,i)}return e}connectedCallback(){super.connectedCallback();let t=this.defaultValues(this.cardinality),e={identifier:this.identifier,cardinality:this.cardinality,baseType:this.baseType,defaultValue:t,type:"outcome",value:null,interpolationTable:this.interpolationTable,matchTable:this.matchTable,externalScored:this.externalScored};e.value=t,(e.value===null||e.value==null)&&(e.baseType==="integer"||e.baseType==="float")&&(e.value="0"),this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:e}}))}};zi([p({type:String,attribute:"base-type"})],le.prototype,"baseType",void 0);zi([p({type:String,attribute:"external-scored"})],le.prototype,"externalScored",void 0);zi([p({type:String})],le.prototype,"identifier",void 0);zi([p({type:String})],le.prototype,"cardinality",void 0);zi([_({context:F,subscribe:!0}),T()],le.prototype,"itemContext",void 0);var ao=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Se=class extends _r{static{this.styles=[q`
157
+ `]}render(){let t=this.itemContext?.variables.find(e=>e.identifier===this.identifier)?.value;return b`${JSON.stringify(t,null,2)}`}get interpolationTable(){let t=this.querySelector("qti-interpolation-table");if(!t)return null;let e=[];for(let i of t.querySelectorAll("qti-interpolation-table-entry")){let n=parseFloat(i.getAttribute("source-value")),r=parseFloat(i.getAttribute("target-value"));if(Number.isNaN(n)||Number.isNaN(r)){console.error("source-value or target-value is missing or not a number in qti-interpolation-table-entry");continue}e.push({sourceValue:n,targetValue:r,includeBoundary:i.getAttribute("include-boundary")!=="false"})}return e}get matchTable(){let t=this.querySelector("qti-match-table");if(!t)return null;let e=new Map;for(let i of t.querySelectorAll("qti-match-table-entry")){let n=parseFloat(i.getAttribute("source-value")),r=i.getAttribute("target-value");if(Number.isNaN(n)||r===null){console.error("source-value or target-value is missing or invalid in qti-match-table-entry");continue}e.set(n,r)}return e}connectedCallback(){super.connectedCallback();let t=this.defaultValues(this.cardinality),e={identifier:this.identifier,cardinality:this.cardinality,baseType:this.baseType,defaultValue:t,type:"outcome",value:null,interpolationTable:this.interpolationTable,matchTable:this.matchTable,externalScored:this.externalScored};e.value=t,(e.value===null||e.value==null)&&(e.baseType==="integer"||e.baseType==="float")&&(e.value="0"),this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:e}}))}};Fr([p({type:String,attribute:"base-type"})],de.prototype,"baseType",void 0);Fr([p({type:String,attribute:"external-scored"})],de.prototype,"externalScored",void 0);Fr([p({type:String})],de.prototype,"identifier",void 0);Fr([p({type:String})],de.prototype,"cardinality",void 0);Fr([_({context:F,subscribe:!0}),T()],de.prototype,"itemContext",void 0);var uo=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},Ee=class extends Ri{static{this.styles=[q`
150
158
  :host {
151
159
  display: none;
152
160
  }
153
- `]}render(){let t=this.itemContext?.variables.find(e=>e.identifier===this.identifier)?.value;return b`${JSON.stringify(t,null,2)}`}connectedCallback(){super.connectedCallback();let t=this.defaultValues(this.cardinality),e={baseType:this.baseType,identifier:this.identifier,correctResponse:this.#t,cardinality:this.cardinality||"single",mapping:this.#e,defaultValue:t,areaMapping:this.#r,value:null,type:"response",candidateResponse:null};e.value=t,this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:e}}))}get#t(){let t,e=this.querySelector("qti-correct-response");if(e){let r=e.querySelectorAll("qti-value");if(this.cardinality==="single"&&r.length>0)t=r[0].textContent.trim(),r[0].remove();else if(this.cardinality!=="single"){t=[];for(let n=0;n<r.length;n++)t.push(r[n].textContent.trim()),r[n].remove()}}return t}get#e(){let t=this.querySelector("qti-mapping"),e=parseFloat(t?.getAttribute("lower-bound")),r=parseFloat(t?.getAttribute("upper-bound"));return{defaultValue:Number(t?.getAttribute("default-value"))||0,lowerBound:isNaN(e)?null:e,upperBound:isNaN(r)?null:r,mapEntries:Array.from(t?.querySelectorAll("qti-map-entry")||[]).map(i=>({mapKey:i.getAttribute("map-key")||"",mappedValue:Number(i.getAttribute("mapped-value"))||0,caseSensitive:i.hasAttribute("case-sensitive")?i.getAttribute("case-sensitive")!=="false":!1}))}}get#r(){let t=this.querySelector("qti-area-mapping"),e=Number(t?.getAttribute("default-value"))||0,r=parseFloat(t?.getAttribute("lower-bound")),n=parseFloat(t?.getAttribute("upper-bound")),i=Array.from(t?.querySelectorAll("qti-area-map-entry")||[]).map(s=>({shape:s.getAttribute("shape")||"default",coords:s.getAttribute("coords")||"",mappedValue:Number(s.getAttribute("mapped-value"))||0,defaultValue:Number(s.getAttribute("default-value"))||0}));return{defaultValue:e,lowerBound:isNaN(r)?null:r,upperBound:isNaN(n)?null:n,areaMapEntries:i}}};ao([p({type:String,attribute:"base-type"})],Se.prototype,"baseType",void 0);ao([p({type:String})],Se.prototype,"identifier",void 0);ao([p({type:String})],Se.prototype,"cardinality",void 0);ao([_({context:F,subscribe:!0}),T()],Se.prototype,"itemContext",void 0);var _d=`<qti-response-condition>
161
+ `]}render(){let t=this.itemContext?.variables.find(e=>e.identifier===this.identifier)?.value;return b`${JSON.stringify(t,null,2)}`}connectedCallback(){super.connectedCallback();let t=this.defaultValues(this.cardinality),e={baseType:this.baseType,identifier:this.identifier,correctResponse:this.#t,cardinality:this.cardinality||"single",mapping:this.#e,defaultValue:t,areaMapping:this.#i,value:null,type:"response",candidateResponse:null};e.value=t,this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:e}}))}get#t(){let t,e=this.querySelector("qti-correct-response");if(e){let i=e.querySelectorAll("qti-value");if(this.cardinality==="single"&&i.length>0)t=i[0].textContent.trim(),i[0].remove();else if(this.cardinality!=="single"){t=[];for(let n=0;n<i.length;n++)t.push(i[n].textContent.trim()),i[n].remove()}}return t}get#e(){let t=this.querySelector("qti-mapping"),e=parseFloat(t?.getAttribute("lower-bound")),i=parseFloat(t?.getAttribute("upper-bound"));return{defaultValue:Number(t?.getAttribute("default-value"))||0,lowerBound:isNaN(e)?null:e,upperBound:isNaN(i)?null:i,mapEntries:Array.from(t?.querySelectorAll("qti-map-entry")||[]).map(r=>({mapKey:r.getAttribute("map-key")||"",mappedValue:Number(r.getAttribute("mapped-value"))||0,caseSensitive:r.hasAttribute("case-sensitive")?r.getAttribute("case-sensitive")!=="false":!1}))}}get#i(){let t=this.querySelector("qti-area-mapping"),e=Number(t?.getAttribute("default-value"))||0,i=parseFloat(t?.getAttribute("lower-bound")),n=parseFloat(t?.getAttribute("upper-bound")),r=Array.from(t?.querySelectorAll("qti-area-map-entry")||[]).map(s=>({shape:s.getAttribute("shape")||"default",coords:s.getAttribute("coords")||"",mappedValue:Number(s.getAttribute("mapped-value"))||0,defaultValue:Number(s.getAttribute("default-value"))||0}));return{defaultValue:e,lowerBound:isNaN(i)?null:i,upperBound:isNaN(n)?null:n,areaMapEntries:r}}};uo([p({type:String,attribute:"base-type"})],Ee.prototype,"baseType",void 0);uo([p({type:String})],Ee.prototype,"identifier",void 0);uo([p({type:String})],Ee.prototype,"cardinality",void 0);uo([_({context:F,subscribe:!0}),T()],Ee.prototype,"itemContext",void 0);var Nd=`<qti-response-condition>
154
162
  <qti-response-if>
155
163
  <qti-match>
156
164
  <qti-variable identifier="RESPONSE"></qti-variable>
@@ -165,7 +173,7 @@ Make sure to test your application with a production build as repeat registratio
165
173
  <qti-base-value base-type="float">0</qti-base-value>
166
174
  </qti-set-outcome-value>
167
175
  </qti-response-else>
168
- </qti-response-condition>`,Td=`<qti-response-condition>
176
+ </qti-response-condition>`,$d=`<qti-response-condition>
169
177
  <qti-response-if>
170
178
  <qti-is-null>
171
179
  <qti-variable identifier="RESPONSE"></qti-variable>
@@ -179,7 +187,7 @@ Make sure to test your application with a production build as repeat registratio
179
187
  <qti-map-response identifier="RESPONSE"> </qti-map-response>
180
188
  </qti-set-outcome-value>
181
189
  </qti-response-else>
182
- </qti-response-condition>`,Rd=`<qti-response-condition>
190
+ </qti-response-condition>`,Ld=`<qti-response-condition>
183
191
  <qti-response-if>
184
192
  <qti-is-null>
185
193
  <qti-variable identifier="RESPONSE"></qti-variable>
@@ -193,27 +201,27 @@ Make sure to test your application with a production build as repeat registratio
193
201
  <qti-map-response-point identifier="RESPONSE"></qti-map-response-point>
194
202
  </qti-set-outcome-value>
195
203
  </qti-response-else>
196
- </qti-response-condition>`;var Bu={map_response:Td,map_response_point:Rd,match_correct:_d},lo=class extends C{static{this.styles=[q`
204
+ </qti-response-condition>`;var tm={map_response:$d,map_response_point:Ld,match_correct:Nd},mo=class extends C{static{this.styles=[q`
197
205
  :host {
198
206
  display: none;
199
207
  }
200
- `]}render(){return b`<slot></slot>`}process(){if(!this.closest("qti-assessment-item"))return;let e=[...this.children];try{for(let r of e)r.process()}catch(r){if(!(r instanceof Tr))throw r}}firstUpdated(t){let e=this.getAttribute("template");if(!e)return;let r=e.split("/").pop().replace(".xml",""),n=Bu[r];n&&(this.innerHTML=n)}};function L(o,t){let e={waitUntilFirstUpdate:!1,...t};return(r,n)=>{let{update:i}=r,s=Array.isArray(o)?o:[o];r.update=function(a){s.forEach(l=>{let c=l;if(a.has(c)){let d=a.get(c),h=this[c];d!==h&&(!e.waitUntilFirstUpdate||this.hasUpdated)&&this[n](d,h)}}),i.call(this,a)}}}var Fr={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Dt=o=>(...t)=>({_$litDirective$:o,values:t}),ke=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,r){this._$Ct=t,this._$AM=e,this._$Ci=r}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};var{I:Uu}=rt,Pd=o=>o,Md=o=>o===null||typeof o!="object"&&typeof o!="function";var Dd=o=>o.strings===void 0,Od=()=>document.createComment(""),Br=(o,t,e)=>{let r=o._$AA.parentNode,n=t===void 0?o._$AB:t._$AA;if(e===void 0){let i=r.insertBefore(Od(),n),s=r.insertBefore(Od(),n);e=new Uu(i,s,o,o.options)}else{let i=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(i!==n||a){let l=e._$AA;for(;l!==i;){let c=Pd(l).nextSibling;Pd(r).insertBefore(l,n),l=c}}}return e},Ee=(o,t,e=o)=>(o._$AI(t,e),o),Hu={},Nd=(o,t=Hu)=>o._$AH=t,$d=o=>o._$AH,co=o=>{o._$AR(),o._$AA.remove()};var ji=(o,t)=>{let e=o._$AN;if(e===void 0)return!1;for(let r of e)r._$AO?.(t,!1),ji(r,t);return!0},ho=o=>{let t,e;do{if((t=o._$AM)===void 0)break;e=t._$AN,e.delete(o),o=t}while(e?.size===0)},Ld=o=>{for(let t;t=o._$AM;o=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(o))break;e.add(o),Gu(t)}};function Wu(o){this._$AN!==void 0?(ho(this),this._$AM=o,Ld(this)):this._$AM=o}function Qu(o,t=!1,e=0){let r=this._$AH,n=this._$AN;if(n!==void 0&&n.size!==0)if(t)if(Array.isArray(r))for(let i=e;i<r.length;i++)ji(r[i],!1),ho(r[i]);else r!=null&&(ji(r,!1),ho(r));else ji(this,o)}var Gu=o=>{o.type==Fr.CHILD&&(o._$AP??=Qu,o._$AQ??=Wu)},Ae=class extends ke{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,r){super._$AT(t,e,r),Ld(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(ji(this,t),ho(this))}setValue(t){if(Dd(this._$Ct))this._$Ct._$AI(t,this);else{let e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}};var dl=class extends Ae{constructor(){super(...arguments),this.prevData={}}render(t){return O}update(t,[e]){return this.element!==t.element&&(this.element=t.element),this.host=t.options?.host||this.element,this.apply(e),this.groom(e),this.prevData={...e},O}apply(t){let e=this.#t(t),{prevData:r,element:n}=this;for(let i in e){let s=e[i];s!==r[i]&&(s===!0?n.setAttribute(i,""):s===!1?n.removeAttribute(i):s!=null?n.setAttribute(i,String(s)):n.removeAttribute(i))}}groom(t){let{prevData:e,element:r}=this;if(!e)return;let n=t?this.#t(t):{};for(let i in e)(!n||!(i in n))&&r.removeAttribute(i)}#t(t){return Object.fromEntries(Object.entries(t).filter(([e,r])=>typeof r=="function"?!1:e==="max-choices"&&r===0?!0:!(r===""||r===null||r===void 0)))}},yq=Dt(dl);var Fi=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},ce=class extends C{handleclassNamesChange(){this.classNames.split(" ").forEach(e=>{switch(e){case"qti-rubric-discretionary-placement":{if(!Pr(this,"cito-item-rubric-placement",{className:e,element:this},!0))return;this.setAttribute("slot","qti-rubric-block")}break;case"qti-rubric-inline":this.setAttribute("slot","");break;default:break}})}static{this.styles=q`
208
+ `]}render(){return b`<slot></slot>`}process(){if(!this.closest("qti-assessment-item"))return;let e=[...this.children];try{for(let i of e)i.process()}catch(i){if(!(i instanceof Pi))throw i}}firstUpdated(t){let e=this.getAttribute("template");if(!e)return;let i=e.split("/").pop().replace(".xml",""),n=tm[i];n&&(this.innerHTML=n)}};function L(o,t){let e={waitUntilFirstUpdate:!1,...t};return(i,n)=>{let{update:r}=i,s=Array.isArray(o)?o:[o];i.update=function(a){s.forEach(l=>{let c=l;if(a.has(c)){let d=a.get(c),h=this[c];d!==h&&(!e.waitUntilFirstUpdate||this.hasUpdated)&&this[n](d,h)}}),r.call(this,a)}}}var Ui={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Dt=o=>(...t)=>({_$litDirective$:o,values:t}),Ie=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};var{I:em}=it,Vd=o=>o,jd=o=>o===null||typeof o!="object"&&typeof o!="function";var Fd=o=>o.strings===void 0,zd=()=>document.createComment(""),Hi=(o,t,e)=>{let i=o._$AA.parentNode,n=t===void 0?o._$AB:t._$AA;if(e===void 0){let r=i.insertBefore(zd(),n),s=i.insertBefore(zd(),n);e=new em(r,s,o,o.options)}else{let r=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(r!==n||a){let l=e._$AA;for(;l!==r;){let c=Vd(l).nextSibling;Vd(i).insertBefore(l,n),l=c}}}return e},Ae=(o,t,e=o)=>(o._$AI(t,e),o),im={},Bd=(o,t=im)=>o._$AH=t,Ud=o=>o._$AH,fo=o=>{o._$AR(),o._$AA.remove()};var Br=(o,t)=>{let e=o._$AN;if(e===void 0)return!1;for(let i of e)i._$AO?.(t,!1),Br(i,t);return!0},go=o=>{let t,e;do{if((t=o._$AM)===void 0)break;e=t._$AN,e.delete(o),o=t}while(e?.size===0)},Hd=o=>{for(let t;t=o._$AM;o=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(o))break;e.add(o),om(t)}};function rm(o){this._$AN!==void 0?(go(this),this._$AM=o,Hd(this)):this._$AM=o}function nm(o,t=!1,e=0){let i=this._$AH,n=this._$AN;if(n!==void 0&&n.size!==0)if(t)if(Array.isArray(i))for(let r=e;r<i.length;r++)Br(i[r],!1),go(i[r]);else i!=null&&(Br(i,!1),go(i));else Br(this,o)}var om=o=>{o.type==Ui.CHILD&&(o._$AP??=nm,o._$AQ??=rm)},_e=class extends Ie{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,i){super._$AT(t,e,i),Hd(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(Br(this,t),go(this))}setValue(t){if(Fd(this._$Ct))this._$Ct._$AI(t,this);else{let e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}};var gl=class extends _e{constructor(){super(...arguments),this.prevData={}}render(t){return O}update(t,[e]){return this.element!==t.element&&(this.element=t.element),this.host=t.options?.host||this.element,this.apply(e),this.groom(e),this.prevData={...e},O}apply(t){let e=this.#t(t),{prevData:i,element:n}=this;for(let r in e){let s=e[r];s!==i[r]&&(s===!0?n.setAttribute(r,""):s===!1?n.removeAttribute(r):s!=null?n.setAttribute(r,String(s)):n.removeAttribute(r))}}groom(t){let{prevData:e,element:i}=this;if(!e)return;let n=t?this.#t(t):{};for(let r in e)(!n||!(r in n))&&i.removeAttribute(r)}#t(t){return Object.fromEntries(Object.entries(t).filter(([e,i])=>typeof i=="function"?!1:e==="max-choices"&&i===0?!0:!(i===""||i===null||i===void 0)))}},Vq=Dt(gl);var Ur=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},he=class extends C{handleclassNamesChange(){this.classNames.split(" ").forEach(e=>{switch(e){case"qti-rubric-discretionary-placement":{if(!Mi(this,"cito-item-rubric-placement",{className:e,element:this},!0))return;this.setAttribute("slot","qti-rubric-block")}break;case"qti-rubric-inline":this.setAttribute("slot","");break;default:break}})}static{this.styles=q`
201
209
  :host {
202
210
  display: block;
203
211
  }
204
- `}render(){return b`<slot></slot>`}};Fi([p({type:String})],ce.prototype,"id",void 0);Fi([p({type:String})],ce.prototype,"use",void 0);Fi([p({type:String})],ce.prototype,"view",void 0);Fi([p({type:String,attribute:"class"})],ce.prototype,"classNames",void 0);Fi([L("classNames",{waitUntilFirstUpdate:!0})],ce.prototype,"handleclassNamesChange",null);var po=class extends C{#t=null;firstUpdated(t){super.firstUpdated(t);let e=this.getAttribute("href");if(e!==null&&fetch(e).then(r=>r.text()).then(r=>{let n=this.#e(r);this.#t=document.createElement("style"),this.#t.media="screen",this.#t.textContent=`@scope {${n}}`,this.parentElement?this.parentElement.appendChild(this.#t):console.warn("No parent element to append the scoped stylesheet to.")}).catch(r=>{console.error("Failed to load stylesheet:",r)}),this.textContent!==null&&this.textContent.trim()!==""){let r=this.#e(this.textContent);this.#t=document.createElement("style"),this.#t.media="screen",this.#t.textContent=`@scope {${r}}`,this.parentElement?this.parentElement.appendChild(this.#t):console.warn("No parent element to append the scoped stylesheet to.")}}#e(t){return t.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\s+/g," ").replace(/\s*([{}:;])\s*/g,"$1").trim()}disconnectedCallback(){if(this.#t)try{this.#t.remove()}catch(t){console.error("Could not remove stylesheet:",t)}super.disconnectedCallback()}};var uo=class extends C{render(){return b`<slot></slot>`}calculate(){let t=[...this.children];if(t.length!==1)return console.error("qti-template-constraint must have exactly one child expression"),!0;try{return!!t[0].calculate()}catch(e){return console.error("Error evaluating template constraint:",e),!0}}getSubRules(){return[]}process(){let t=this.calculate();return t||console.debug("Template constraint not satisfied, restarting template processing"),t}};var Bi=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},de=class extends C{constructor(){super(...arguments),this.identifier="",this.cardinality="single",this.baseType="string",this.mathVariable=!1,this.paramVariable=!1,this.#t=null}#t;static{this.styles=[q`
212
+ `}render(){return b`<slot></slot>`}};Ur([p({type:String})],he.prototype,"id",void 0);Ur([p({type:String})],he.prototype,"use",void 0);Ur([p({type:String})],he.prototype,"view",void 0);Ur([p({type:String,attribute:"class"})],he.prototype,"classNames",void 0);Ur([L("classNames",{waitUntilFirstUpdate:!0})],he.prototype,"handleclassNamesChange",null);var bo=class extends C{#t=null;firstUpdated(t){super.firstUpdated(t);let e=this.getAttribute("href");if(e!==null&&fetch(e).then(i=>i.text()).then(i=>{let n=this.#e(i);this.#t=document.createElement("style"),this.#t.media="screen",this.#t.textContent=`@scope {${n}}`,this.parentElement?this.parentElement.appendChild(this.#t):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=this.#e(this.textContent);this.#t=document.createElement("style"),this.#t.media="screen",this.#t.textContent=`@scope {${i}}`,this.parentElement?this.parentElement.appendChild(this.#t):console.warn("No parent element to append the scoped stylesheet to.")}}#e(t){return t.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\s+/g," ").replace(/\s*([{}:;])\s*/g,"$1").trim()}disconnectedCallback(){if(this.#t)try{this.#t.remove()}catch(t){console.error("Could not remove stylesheet:",t)}super.disconnectedCallback()}};var yo=class extends C{render(){return b`<slot></slot>`}calculate(){let t=[...this.children];if(t.length!==1)return console.error("qti-template-constraint must have exactly one child expression"),!0;try{return!!t[0].calculate()}catch(e){return console.error("Error evaluating template constraint:",e),!0}}getSubRules(){return[]}process(){let t=this.calculate();return t||console.debug("Template constraint not satisfied, restarting template processing"),t}};var Hr=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},pe=class extends C{constructor(){super(...arguments),this.identifier="",this.cardinality="single",this.baseType="string",this.mathVariable=!1,this.paramVariable=!1,this.#t=null}#t;static{this.styles=[q`
205
213
  :host {
206
214
  display: none;
207
215
  }
208
- `]}render(){return b`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{this.#e(),this.#i()})}#e(){let t=this.querySelector("qti-default-value");if(!t)return;let e=t.textContent?.trim()||"";this.#t=this.#r(e)}#r(t){if(!t)return null;switch(this.baseType){case"integer":return parseInt(t,10);case"float":case"duration":return parseFloat(t);case"boolean":return t.toLowerCase()==="true";default:return t}}#i(){let e={...{identifier:this.identifier,cardinality:this.cardinality,baseType:this.baseType,defaultValue:this.#t,value:this.#t,type:"template",mathVariable:this.mathVariable,paramVariable:this.paramVariable},value:this.#t?.toString()||""};this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:e}}))}getTemplateVariable(){return{identifier:this.identifier,cardinality:this.cardinality,baseType:this.baseType,value:this.#t,type:"template",mathVariable:this.mathVariable,paramVariable:this.paramVariable}}};Bi([p({type:String})],de.prototype,"identifier",void 0);Bi([p({type:String})],de.prototype,"cardinality",void 0);Bi([p({type:String,attribute:"base-type"})],de.prototype,"baseType",void 0);Bi([p({type:Boolean,attribute:"math-variable"})],de.prototype,"mathVariable",void 0);Bi([p({type:Boolean,attribute:"param-variable"})],de.prototype,"paramVariable",void 0);var mo=class extends C{static{this.styles=[q`
216
+ `]}render(){return b`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{this.#e(),this.#r()})}#e(){let t=this.querySelector("qti-default-value");if(!t)return;let e=t.textContent?.trim()||"";this.#t=this.#i(e)}#i(t){if(!t)return null;switch(this.baseType){case"integer":return parseInt(t,10);case"float":case"duration":return parseFloat(t);case"boolean":return t.toLowerCase()==="true";default:return t}}#r(){let e={...{identifier:this.identifier,cardinality:this.cardinality,baseType:this.baseType,defaultValue:this.#t,value:this.#t,type:"template",mathVariable:this.mathVariable,paramVariable:this.paramVariable},value:this.#t?.toString()||""};this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:e}}))}getTemplateVariable(){return{identifier:this.identifier,cardinality:this.cardinality,baseType:this.baseType,value:this.#t,type:"template",mathVariable:this.mathVariable,paramVariable:this.paramVariable}}};Hr([p({type:String})],pe.prototype,"identifier",void 0);Hr([p({type:String})],pe.prototype,"cardinality",void 0);Hr([p({type:String,attribute:"base-type"})],pe.prototype,"baseType",void 0);Hr([p({type:Boolean,attribute:"math-variable"})],pe.prototype,"mathVariable",void 0);Hr([p({type:Boolean,attribute:"param-variable"})],pe.prototype,"paramVariable",void 0);var vo=class extends C{static{this.styles=[q`
209
217
  :host {
210
218
  display: none;
211
219
  }
212
- `]}#t=100;render(){return b`<slot></slot>`}process(){if(!this.closest("qti-assessment-item")){console.warn("qti-template-processing must be inside qti-assessment-item");return}let e=0,r=!1;do{if(r=!1,e++,e>this.#t){console.error("Template processing exceeded maximum iterations. Possible infinite loop.");break}try{let n=[...this.children];for(let i of n)if(i.tagName.toLowerCase()==="qti-template-constraint"){if(i.calculate()===!1){r=!0;break}}else i.process()}catch(n){console.error("Error during template processing:",n);break}}while(r);this.dispatchEvent(new CustomEvent("qti-template-processing-complete",{bubbles:!0,composed:!0,detail:{iterations:e}}))}firstUpdated(t){this.getAttribute("template")&&console.info("Template processing with external template not yet implemented")}};var Vd=[{tag:"qti-assessment-item",ctor:ft},{tag:"qti-assessment-stimulus",ctor:Jn},{tag:"qti-assessment-stimulus-ref",ctor:Vr},{tag:"qti-companion-materials-info",ctor:io},{tag:"qti-content-body",ctor:Li},{tag:"qti-context-declaration",ctor:zr},{tag:"qti-custom-operator",ctor:Vi},{tag:"qti-feedback-block",ctor:no},{tag:"qti-feedback-inline",ctor:oo},{tag:"qti-item-body",ctor:so},{tag:"qti-modal-feedback",ctor:jr},{tag:"qti-outcome-declaration",ctor:le},{tag:"qti-response-declaration",ctor:Se},{tag:"qti-response-processing",ctor:lo},{tag:"qti-rubric-block",ctor:ce},{tag:"qti-stylesheet",ctor:po},{tag:"qti-template-constraint",ctor:uo},{tag:"qti-template-declaration",ctor:de},{tag:"qti-template-processing",ctor:mo}];var fo=class extends jr{static{this.styles=q`
220
+ `]}#t=100;render(){return b`<slot></slot>`}process(){if(!this.closest("qti-assessment-item")){console.warn("qti-template-processing must be inside qti-assessment-item");return}let e=0,i=!1;do{if(i=!1,e++,e>this.#t){console.error("Template processing exceeded maximum iterations. Possible infinite loop.");break}try{let n=[...this.children];for(let r of n)if(r.tagName.toLowerCase()==="qti-template-constraint"){if(r.calculate()===!1){i=!0;break}}else r.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:e}}))}firstUpdated(t){this.getAttribute("template")&&console.info("Template processing with external template not yet implemented")}};var Wd=[{tag:"qti-assessment-item",ctor:ft},{tag:"qti-assessment-stimulus",ctor:ro},{tag:"qti-assessment-stimulus-ref",ctor:ji},{tag:"qti-companion-materials-info",ctor:lo},{tag:"qti-content-body",ctor:zr},{tag:"qti-context-declaration",ctor:Fi},{tag:"qti-custom-operator",ctor:jr},{tag:"qti-feedback-block",ctor:co},{tag:"qti-feedback-inline",ctor:ho},{tag:"qti-item-body",ctor:po},{tag:"qti-modal-feedback",ctor:Bi},{tag:"qti-outcome-declaration",ctor:de},{tag:"qti-response-declaration",ctor:Ee},{tag:"qti-response-processing",ctor:mo},{tag:"qti-rubric-block",ctor:he},{tag:"qti-stylesheet",ctor:bo},{tag:"qti-template-constraint",ctor:yo},{tag:"qti-template-declaration",ctor:pe},{tag:"qti-template-processing",ctor:vo}];var wo=class extends Bi{static{this.styles=q`
213
221
  :host {
214
222
  color: gray;
215
223
  }
216
- `}render(){return b``}};var go=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Ie=class extends C{constructor(){super(...arguments),this.identifier="",this.class="",this.navigationMode="nonlinear",this.submissionMode="individual",this.#t=""}get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}#t;async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-test-part-connected",{bubbles:!0,composed:!0}))}render(){return b` <slot></slot>`}};go([p({type:String})],Ie.prototype,"identifier",void 0);go([p({type:String})],Ie.prototype,"class",void 0);go([p({type:String,attribute:"navigation-mode"})],Ie.prototype,"navigationMode",void 0);go([p({type:String,attribute:"submission-mode"})],Ie.prototype,"submissionMode",void 0);var Xu=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Ui=class extends E{#t=null;constructor(){super(),J(this,"cito-test-loaded",t=>this.#t=t.detail)}get#e(){return this.#t??this.closest("qti-assessment-test")}getResult(){let t=this.#e;if(!t)return console.warn("qti-test-variables: no enclosing qti-assessment-test, nothing to aggregate"),0;let e=this.getAttribute("weight-identifier")??"",r=this.getAttribute("variable-identifier"),n=Xn(t,Gn(this)).map(a=>({item:a.identifier,weight:(e?a.weights.get(e):void 0)??1}));return new hl(this._testContext,r,n).calculate()}calculate(){return this.getResult()}};Xu([_({context:at,subscribe:!0})],Ui.prototype,"_testContext",void 0);var hl=class{constructor(t,e,r){this.testContext=t,this.itemVariable=e,this.includedItems=r}calculate(){let t=this.testContext?.items??[],e=0,r=[...new Set(this.includedItems.map(n=>n.item))];return t.forEach(n=>{if(r.includes(n.identifier)){let i=n.variables.find(a=>a.identifier===this.itemVariable),s=this.includedItems.find(a=>a.item===n.identifier)?.weight??1;if(i){let a=Number(i.value);Number.isNaN(a)||(e+=a*s)}}}),e}};var bo=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},zd=o=>{class t extends o{constructor(...r){super(...r),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(r,n){let i=n||this._getDefaultNavigationId(r);i&&z(this,"cito-test-navigate",{type:r,id:i})}_bindEventHandlers(){J(this,"cito-test-navigate",this._handleNavigationRequest.bind(this)),J(this,"cito-test-loaded",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(r){this._testElement=r.detail,this._initializeNavigation()}_handleItemConnected(r){let n=r.detail;this._loadingState.connectedItems++;let i=n.querySelectorAll("qti-assessment-stimulus-ref");this._loadingState.expectedStimulus+=i.length,this._checkLoadingComplete()}async _handleStimulusRefConnected(r){r.preventDefault();let{element:n,item:i}=r;if(console.info("Stimulus ref connected:",{identifier:n.identifier,href:n.href,item:i.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,i),this._loadedStimulusHrefs.add(n.href),this._loadingState.loadedStimulus++,console.info("Stimulus loaded successfully:",n.href),this._checkLoadingComplete()}catch(s){s.name!=="AbortError"&&console.warn(`Failed to load stimulus ${n.identifier}:`,s),this._loadingState.loadedStimulus++,this._checkLoadingComplete()}finally{this._loadingStimulusHrefs.delete(n.href)}}_getDefaultNavigationId(r){return r==="section"?this.sessionContext?.navSectionId??this._testElement?.querySelector("qti-assessment-section")?.identifier:this.sessionContext?.navItemRefId??this._testElement?.querySelector("qti-assessment-item-ref")?.identifier}_initializeNavigation(){if(!this.navigate)return;let r=this._getDefaultNavigationId(this.navigate);r&&this.navigateTo(this.navigate,r)}_isLinearNavigationRestricted(r,n){let i=this.sessionContext?.navItemRefId;if(!i||r==="item"&&n===i)return!1;let s=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${i}"]`);if(!s)return!1;let a=s.closest("qti-assessment-section"),l=s.closest("qti-test-part");if((a?.navigationMode||a?.getAttribute("navigation-mode")||l?.navigationMode||l?.getAttribute("navigation-mode")||"nonlinear")!=="linear")return!1;let d=Array.from(this._testElement?.querySelectorAll("qti-assessment-item-ref")||[]),h=d.findIndex(f=>f.identifier===i);if(r==="item"){let f=d.findIndex(m=>m.identifier===n);return f===-1||h===-1?!1:f!==h+1}return!0}async _handleNavigationRequest({detail:r}){if(!r?.id)return;if(this._isLinearNavigationRestricted(r.type,r.id)){this._handleNavigationError(new Error("Navigation restricted in linear mode"),r.type,r.id);return}this._cancelPreviousNavigation();let n=++this._navigationId,i=new AbortController;try{this._dispatchLoadingStarted(r.type,r.id),this._activeController=i,await this._executeNavigation(r.type,r.id,n,i)}catch(s){this._handleNavigationError(s,r.type,r.id)}finally{this._activeController===i&&(this._activeController=null),this._dispatchLoadingEnded(r.type,r.id)}}_handleNavigationError(r,n,i){r.name!=="AbortError"&&this._dispatchError(this._createNavigationError(r,n,i))}async _executeNavigation(r,n,i,s){r==="item"?await this._navigateToItem(n,i,s):await this._navigateToSection(n,i,s)}async _navigateToItem(r,n,i){let s=this._findItemRef(r);this._updateSessionContext(s,r),this._resetLoadingState(),this._loadingState.expectedItems=1,await this._loadItems([r],n,i),await this._waitForLoadingComplete(n,i),!this._isStaleNavigation(n,i)&&this._dispatchTestLoaded(this._loadResults,"item",r)}async _navigateToSection(r,n,i){let a=this._findSection(r)?.closest("qti-test-part")?.identifier;this.sessionContext={...this.sessionContext,navPartId:a,navSectionId:r,navItemRefId:null};let l=this._getSectionItemIds(r);this._resetLoadingState(),this._loadingState.expectedItems=l.length,await this._loadItems(l,n,i),await this._waitForLoadingComplete(n,i),!this._isStaleNavigation(n,i)&&this._dispatchTestLoaded(this._loadResults,"section",r)}_resetLoadingState(){this._loadingState={expectedItems:0,connectedItems:0,expectedStimulus:0,loadedStimulus:0,isComplete:!1},this._loadedStimulusHrefs.clear(),this._loadingStimulusHrefs.clear()}_checkLoadingComplete(){let r=this._loadingState.connectedItems>=this._loadingState.expectedItems,n=this._loadingState.loadedStimulus>=this._loadingState.expectedStimulus;r&&n&&!this._loadingState.isComplete&&(this._loadingState.isComplete=!0)}async _waitForLoadingComplete(r,n){for(;!this._loadingState.isComplete;){if(this._isStaleNavigation(r,n))return;await new Promise(i=>setTimeout(i,10))}}getLoadingProgress(){return{...this._loadingState}}async _loadStimulusRef(r,n){console.info("Loading stimulus:",r.href);let i=await this._loadStimulus(r.href);console.info("Stimulus loaded, applying content:",i?"has content":"no content"),this._applyStimulusContent(i,r,n)}_applyStimulusContent(r,n,i){if(!r){console.warn("No stimulus content to apply");return}let s=r.querySelector("qti-assessment-stimulus");if(!s){console.warn("No qti-assessment-stimulus element found in stimulus");return}let a=[],l=i.querySelector(`[data-stimulus-idref="${n.identifier}"]`);if(l)a.push(l),console.info("Found specific target:",l);else{let c=Array.from(this.querySelectorAll(`[data-stimulus-idref="${n.identifier}"]`));if(c.length>0)a=c,console.info("Found targets by identifier:",c.length);else{let d=Array.from(this.querySelectorAll("[data-stimulus-idref]"));a=d,console.info("Using fallback targets:",d.length)}}if(a.length===0){console.warn("No targets found for stimulus content");return}a.forEach((c,d)=>{c.innerHTML="",c.append(s.cloneNode(!0)),console.info(`Applied stimulus content to target ${d+1}/${a.length}`)})}_cancelPreviousNavigation(){this._activeController&&(this._activeController.abort(),console.info("Previous navigation request cancelled")),this._clearNavigationState()}_clearNavigationState(){this._clearLoadedItems(),this._resetLoadingState(),this._loadResults=[]}async _loadItems(r,n,i){if(!this._testElement||r.length===0)return;let s=r.map(c=>this._findItemRef(c));this._clearLoadedItems(),this._clearStimulusRef();let l=(await Promise.all(s.map(c=>this._loadSingleItem(c,n,i)))).filter(Boolean);this._isStaleNavigation(n,i)||(l.forEach(({itemRef:c,doc:d})=>{c&&d&&(c.xmlDoc=d)}),l.forEach(({itemRef:c})=>{let d=c?.identifier;if(!c||!d)return;let h=this.testContext.items.find(f=>f.identifier===d)?.state;h!==void 0&&c.updateComplete.then(()=>{let f=c.assessmentItem;f&&(f.state=h)})}),this._loadResults=l)}async _loadSingleItem(r,n,i){try{let s=this.qtiContext?.QTI_CONTEXT?.seed,a=(await Kt().load(r.href,i.signal)).shuffleInteractions(s);return this.postLoadTransformCallback&&(a=await this.postLoadTransformCallback(a,r)),this._isStaleNavigation(n,i)?null:{itemRef:r,doc:a.htmlDoc(this._customElementRegistry())}}catch(s){if(s.name==="AbortError")throw console.info(`Item load for ${r.identifier} was aborted`),s;return console.warn(`Failed to load item ${r.identifier}:`,s),null}}async _loadStimulus(r){return(await Kt().load(r,this._activeController?.signal)).htmlDoc(this._customElementRegistry())}_customElementRegistry(){let r=this.querySelector("test-container");if(r)return r.customElementRegistry??void 0}_findItemRef(r){let n=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${r}"]`);if(!n)throw new Error(`Item with identifier "${r}" not found`);return n}_findSection(r){return this._testElement?.querySelector(`qti-assessment-section[identifier="${r}"]`)||null}_updateSessionContext(r,n){let i=r.closest("qti-test-part")?.identifier,s=r.closest("qti-assessment-section")?.identifier;this.sessionContext={...this.sessionContext,navPartId:i,navSectionId:s,navItemRefId:n}}_getSectionItemIds(r){return Array.from(this._testElement.querySelectorAll(`qti-assessment-section[identifier="${r}"] > qti-assessment-item-ref`)).map(n=>n.identifier).filter(Boolean)}_clearLoadedItems(){let r=this._testElement?.querySelectorAll("qti-assessment-item-ref");Array.from(r||[]).forEach(n=>{n.xmlDoc=null})}_clearStimulusRef(){this.querySelectorAll("[data-stimulus-idref]").forEach(r=>r.innerHTML="")}_isStaleNavigation(r,n){return n.signal.aborted||r!==this._navigationId}_createNavigationError(r,n,i){return{message:r.message||`Failed to load ${n}: ${i}`,details:r,itemId:n==="item"?i:void 0,sectionId:n==="section"?i:void 0}}_dispatchLoadingStarted(r,n){z(this,"cito-test-navigation-started",{type:r,id:n})}_dispatchLoadingEnded(r,n){this.dispatchEvent(new CustomEvent("qti-navigation-loading-ended",{detail:{type:r,id:n},bubbles:!0,composed:!0}))}_dispatchError(r){z(this,"cito-test-navigation-failed",r)}_dispatchTestLoaded(r,n,i){requestAnimationFrame(()=>{z(this,"cito-test-rendered",r.map(({itemRef:s})=>({identifier:s?.identifier,element:s}))),z(this,"cito-test-navigated",{type:n,id:i})})}}return bo([p({type:String})],t.prototype,"navigate",void 0),bo([p({type:Number})],t.prototype,"requestTimeout",void 0),bo([p({attribute:!1})],t.prototype,"postLoadTransformCallback",void 0),bo([p({attribute:!1})],t.prototype,"postLoadTestTransformCallback",void 0),t};var jd=o=>{class t extends o{constructor(...r){super(...r),this.sessionContext={...this.sessionContext,view:"candidate"},J(this,"cito-test-switch-view",n=>{this.sessionContext={...this.sessionContext,view:n.detail},this._updateElementView()}),J(this,"cito-test-loaded",()=>{this._updateElementView()}),this.addEventListener("qti-assessment-item-connected",n=>{this._updateElementView(),this._setCorrectResponseVisibility(n.detail)})}willUpdate(r){super.willUpdate(r),r.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 i=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${this.sessionContext.navItemRefId}"]`)?.assessmentItem;i&&this.updateAssessmentItemView(i,this.sessionContext.view)}}_setCorrectResponseVisibility(r){this.updateAssessmentItemView(r,this.sessionContext.view)}updateAssessmentItemView(r,n){}}return t};var Fd=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},pl=o=>{class t extends o{constructor(...r){super(...r),this.testContext=Ha,this.sessionContext=Ua,this._updateItemInTestContext=n=>{let i=n.itemContext,s=i.identifier,a=i.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,void 0,i.valid);else{let c=[...n.variables];for(let d of l.variables){let h=c.find(f=>f.identifier===d.identifier);h?h.value=d.value:c.push(d)}n.variables=c,l.state&&(n.state=l.state)}},this._initializeEventListeners()}updateItemVariables(r,n,i){this.testContext={...this.testContext,items:this.testContext.items.map(a=>{if(a.identifier!==r)return a;let l=[...a.variables??[]];for(let{identifier:c,type:d,value:h}of n){let f=l.findIndex(v=>v.identifier===c),m={...f>=0?l[f]:{},identifier:c,...d?{type:d}:{},value:Array.isArray(h)?[...h]:h};f>=0?l[f]=m:l.push(m)}return{...a,variables:l,...i?{state:{...i}}:{}}})};let s=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${CSS.escape(r)}"]`)?.assessmentItem;s&&(s.variables=[...this.testContext.items.find(a=>a.identifier===r)?.variables??[]],i&&(s.state=i))}_initializeEventListeners(){this.addEventListener("qti-testdoc-loaded",()=>{this.testContext=Ha,this.sessionContext=Ua}),J(this,"cito-test-loaded",r=>{this._testElement=r.detail;let n=Array.from(this._testElement.querySelectorAll("qti-assessment-item-ref")).map(i=>({href:i.href,identifier:i.identifier,category:i.category,variables:[{identifier:"completionStatus",value:"not_attempted",type:"outcome"}]}));this.testContext={...this.testContext,items:n}}),this.addEventListener("qti-assessment-item-connected",r=>{let n=r.detail,i=n.closest("qti-assessment-item-ref")?.identifier;i&&(n.assessmentItemRefId=i),this._updateItemInTestContext(r.detail)}),this.addEventListener("qti-item-context-updated",r=>{this._updateItemVariablesInTestContext(r.detail.itemContext.identifier,r.detail.itemContext.variables,r.detail.itemContext.state,r.detail.itemContext.valid)})}_updateItemVariablesInTestContext(r,n,i,s){this.testContext={...this.testContext,items:this.testContext.items.map(a=>a.identifier!==r?a:{...a,variables:n.map(l=>{let c=a.variables.find(d=>d.identifier===l.identifier);return c?{...c,...l}:l}),...i!==void 0?{state:i?{...i}:void 0}:{},...s!==void 0?{valid:s}:{}})},this.dispatchEvent(new CustomEvent("qti-test-context-updated",{detail:this.testContext,bubbles:!1,composed:!1}))}}return Fd([p({attribute:!1,type:Object}),U({context:at})],t.prototype,"testContext",void 0),Fd([p({attribute:!1,type:Object}),U({context:Qt})],t.prototype,"sessionContext",void 0),t},Bd=class extends pl(C){};var yo=1;var ul=o=>Array.isArray(o)?[...o]:o??null,Yu=o=>{let t=o;return t?.version===1&&Array.isArray(t.test?.items)&&Array.isArray(t.test?.outcomes)&&typeof t.session=="object"&&t.session!==null},Ku=(o,t)=>({version:1,test:{items:(o?.items??[]).filter(e=>e.identifier).map(e=>({identifier:e.identifier,variables:(e.variables??[]).map(r=>({identifier:r.identifier,...r.type?{type:r.type}:{},value:ul(r.value)})),...e.state?{state:{...e.state}}:{}})),outcomes:(o?.testOutcomeVariables??[]).map(e=>({identifier:e.identifier,value:ul(e.value)}))},session:{...t?.navPartId!==void 0?{navPartId:t.navPartId}:{},...t?.navSectionId!==void 0?{navSectionId:t.navSectionId}:{},...t?.navItemRefId!==void 0?{navItemRefId:t.navItemRefId}:{}}}),Ud=o=>{class t extends o{#t=null;#e=!1;#r=null;constructor(...r){super(...r),this.addEventListener("qti-testdoc-loaded",()=>{this.#e=!1,this.#r=null}),J(this,"cito-test-loaded",()=>{this.#t&&(this.#i(this.#t),this.#t=null),this.#e=!0})}get state(){return Ku(this.testContext,this.sessionContext)}set state(r){if(!Yu(r)){console.warn(`[qti-test] Ignoring a state that is not a version ${1} QtiTestState.`);return}if(!this.#e){this.#t=r;return}let{navItemRefId:n,navSectionId:i}=this.sessionContext;this.#i(r);let s=this.sessionContext;s.navItemRefId&&s.navItemRefId!==n?this.#o("item",s.navItemRefId):!s.navItemRefId&&s.navSectionId&&s.navSectionId!==i&&this.#o("section",s.navSectionId)}updated(r){if(super.updated(r),!this.#e||!(r.has("testContext")||r.has("sessionContext")))return;let n=this.state,i=JSON.stringify(n);i!==this.#r&&(this.#r=i,z(this,"cito-test-state-changed",n))}#i(r){for(let i of r.test.items)this.updateItemVariables(i.identifier,i.variables,i.state);let n=new Map(r.test.outcomes.map(i=>[i.identifier,i.value]));this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(i=>n.has(i.identifier)?{...i,value:ul(n.get(i.identifier))}:i)},this.sessionContext={...this.sessionContext,...this.#n(r.session)}}#n(r){let n=(i,s)=>!!s&&!!this._testElement?.querySelector(`${i}[identifier="${CSS.escape(s)}"]`);return{...n("qti-test-part",r.navPartId)?{navPartId:r.navPartId}:{},...n("qti-assessment-section",r.navSectionId)?{navSectionId:r.navSectionId}:{},...this.testContext.items.some(i=>i.identifier===r.navItemRefId)?{navItemRefId:r.navItemRefId}:{}}}#o(r,n){z(this,"cito-test-navigate",{type:r,id:n})}}return t};var Hd=o=>{class t extends o{constructor(...r){super(...r),this.addEventListener("qti-register-variable",n=>{this.testContext={...this.testContext,testOutcomeVariables:[...this.testContext.testOutcomeVariables||[],n.detail.variable]},n.stopPropagation()}),this.addEventListener("qti-set-outcome-value",n=>{let{outcomeIdentifier:i,value:s}=n.detail;this.updateOutcomeVariable(i,s),n.stopPropagation()})}outcomeProcessing(){let r=(this._testElement??this).querySelector("qti-outcome-processing");return r?(r?.process(),!0):!1}updateOutcomeVariable(r,n){let i=this.getOutcome(r);if(!i){console.warn(`Can not set qti-outcome-identifier: ${r}, it is not available`);return}this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(s=>s.identifier!==r?s:{...s,value:i.cardinality==="single"?n:[...s.value,n]})}}getOutcome(r){return this.getVariable(r)}getVariable(r){return this.testContext.testOutcomeVariables?.find(n=>n.identifier===r)||null}}return t};var Wd=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},_e=class extends zd(jd(Hd(Ud(pl(C))))){constructor(){super(),this.configContext={},this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},new we(this,{context:St,initialValue:this})}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-test-connected",{detail:this}))}render(){return b`<slot></slot>`}};Wd([T(),U({context:qt})],_e.prototype,"configContext",void 0);Wd([T(),U({context:Ct})],_e.prototype,"qtiContext",void 0);var Qd=q`
224
+ `}render(){return b``}};var xo=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},Te=class extends C{constructor(){super(...arguments),this.identifier="",this.class="",this.navigationMode="nonlinear",this.submissionMode="individual",this.#t=""}get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}#t;async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-test-part-connected",{bubbles:!0,composed:!0}))}render(){return b` <slot></slot>`}};xo([p({type:String})],Te.prototype,"identifier",void 0);xo([p({type:String})],Te.prototype,"class",void 0);xo([p({type:String,attribute:"navigation-mode"})],Te.prototype,"navigationMode",void 0);xo([p({type:String,attribute:"submission-mode"})],Te.prototype,"submissionMode",void 0);var sm=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},Wr=class extends E{#t=null;constructor(){super(),J(this,"cito-test-loaded",t=>this.#t=t.detail)}get#e(){return this.#t??this.closest("qti-assessment-test")}getResult(){let t=this.#e;if(!t)return console.warn("qti-test-variables: no enclosing qti-assessment-test, nothing to aggregate"),0;let e=this.getAttribute("weight-identifier")??"",i=this.getAttribute("variable-identifier"),n=Zn(t,Jn(this)).map(a=>({item:a.identifier,weight:(e?a.weights.get(e):void 0)??1}));return new bl(this._testContext,i,n).calculate()}calculate(){return this.getResult()}};sm([_({context:at,subscribe:!0})],Wr.prototype,"_testContext",void 0);var bl=class{constructor(t,e,i){this.testContext=t,this.itemVariable=e,this.includedItems=i}calculate(){let t=this.testContext?.items??[],e=0,i=[...new Set(this.includedItems.map(n=>n.item))];return t.forEach(n=>{if(i.includes(n.identifier)){let r=n.variables.find(a=>a.identifier===this.itemVariable),s=this.includedItems.find(a=>a.item===n.identifier)?.weight??1;if(r){let a=Number(r.value);Number.isNaN(a)||(e+=a*s)}}}),e}};var Qr="qti-assessment-section",qo="qti-test-part",Nt=o=>o.identifier||o.getAttribute("identifier")||"";function Qd(o,t){let e=o[t],i=t+1,n=am(e,o,t);if(n){let s=lm(n,o,t);if(s===null)return{id:null,skipped:o.slice(t+1).map(Nt)};s>t?i=s:console.warn(`qti-branch-rule target "${n.target}" is not ahead of "${Nt(e)}", ignored`)}let r=o.slice(t+1,i).map(Nt);for(let s=i;s<o.length;s++){if(Gd(o[s],e))return{id:Nt(o[s]),skipped:r};r.push(Nt(o[s]))}return{id:null,skipped:r}}function Xd(o){let t=[];for(let e of o){if(Gd(e,null))return{id:Nt(e),skipped:t};t.push(Nt(e))}return{id:null,skipped:t}}function am(o,t,e){let i=[o];for(let n=o.parentElement;n&&(n.localName===Qr||n.localName===qo)&&!n.contains(t[e+1]??null);n=n.parentElement)i.push(n);for(let n of i)for(let r of n.querySelectorAll(":scope > qti-branch-rule"))if(r.evaluate?.())return r;return null}function lm(o,t,e){let i=o.parentElement,n=r=>{if(!r)return null;let s=t.findLastIndex(a=>r.contains(a));return s+1<t.length?s+1:null};switch(o.target){case ce.EXIT_TEST:return null;case ce.EXIT_TESTPART:return n(i.closest(qo));case ce.EXIT_SECTION:{let r=i.localName===Qr?i:i.closest(Qr);return n(r??i)}default:{let r=t.findIndex(l=>Nt(l)===o.target);if(r>=0)return r;let s=[...i.closest("qti-assessment-test")?.querySelectorAll(`${Qr}, ${qo}`)??[]].find(l=>l.getAttribute("identifier")===o.target),a=s?t.findIndex(l=>s.contains(l)):-1;return a>=0?a:(console.warn(`qti-branch-rule target "${o.target}" not found`),e+1)}}}function Gd(o,t){let e=[o];for(let i=o.parentElement;i&&(i.localName===Qr||i.localName===qo);i=i.parentElement)(!t||!i.contains(t))&&e.push(i);return e.every(i=>[...i.querySelectorAll(":scope > qti-pre-condition")].every(n=>n.evaluate?.()??!0))}var Co=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},Yd=o=>{class t 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 r=n||this._getDefaultNavigationId(i);r&&V(this,"cito-test-navigate",{type:i,id:r})}_bindEventHandlers(){J(this,"cito-test-navigate",this._handleNavigationRequest.bind(this)),J(this,"cito-test-loaded",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 r=n.querySelectorAll("qti-assessment-stimulus-ref");this._loadingState.expectedStimulus+=r.length,this._checkLoadingComplete()}async _handleStimulusRefConnected(i){i.preventDefault();let{element:n,item:r}=i;if(console.info("Stimulus ref connected:",{identifier:n.identifier,href:n.href,item:r.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,r),this._loadedStimulusHrefs.add(n.href),this._loadingState.loadedStimulus++,console.info("Stimulus loaded successfully:",n.href),this._checkLoadingComplete()}catch(s){s.name!=="AbortError"&&console.warn(`Failed to load stimulus ${n.identifier}:`,s),this._loadingState.loadedStimulus++,this._checkLoadingComplete()}finally{this._loadingStimulusHrefs.delete(n.href)}}_getDefaultNavigationId(i){return i==="section"?this.sessionContext?.navSectionId??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);if(this.navigate==="item"&&this._testElement&&!this.sessionContext?.navItemRefId){let n=[...this._testElement.querySelectorAll("qti-assessment-item-ref")];if(n[0]?.closest("qti-test-part")?.getAttribute("navigation-mode")==="linear"){let r=Xd(n);if(r.skipped.length&&V(this,"cito-test-items-skipped",{ids:r.skipped}),r.id===null){V(this,"cito-test-end-reached",{});return}i=r.id}}i&&this.navigateTo(this.navigate,i)}_isLinearNavigationRestricted(i,n){let r=this.sessionContext?.navItemRefId;if(!r||i==="item"&&n===r)return!1;let s=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${r}"]`);if(!s)return!1;let a=s.closest("qti-assessment-section"),l=s.closest("qti-test-part");if((a?.navigationMode||a?.getAttribute("navigation-mode")||l?.navigationMode||l?.getAttribute("navigation-mode")||"nonlinear")!=="linear")return!1;let d=Array.from(this._testElement?.querySelectorAll("qti-assessment-item-ref")||[]),h=d.findIndex(f=>f.identifier===r);if(i==="item"){let f=d.findIndex(m=>m.identifier===n);return f===-1||h===-1?!1:f!==h+1}return!0}_resolveLinearNext(i,n){if(i!=="item"||!this._testElement)return;let r=[...this._testElement.querySelectorAll("qti-assessment-item-ref")],s=r.findIndex(l=>Nt(l)===this.sessionContext?.navItemRefId);if(s<0||!r[s+1]||Nt(r[s+1])!==n||r[s].closest("qti-test-part")?.getAttribute("navigation-mode")!=="linear")return;let a=Qd(r,s);if(a.id!==n)return a}async _handleNavigationRequest({detail:i}){if(!i?.id)return;let n=this._resolveLinearNext(i.type,i.id);if(n?.id===null){n.skipped.length&&V(this,"cito-test-items-skipped",{ids:n.skipped}),V(this,"cito-test-end-reached",{});return}let r=n?.id??i.id;if(!n&&this._isLinearNavigationRestricted(i.type,r)){this._handleNavigationError(new Error("Navigation restricted in linear mode"),i.type,i.id);return}this._cancelPreviousNavigation();let s=++this._navigationId,a=new AbortController;try{this._dispatchLoadingStarted(i.type,r),this._activeController=a,await this._executeNavigation(i.type,r,s,a),n?.skipped.length&&s===this._navigationId&&!a.signal.aborted&&V(this,"cito-test-items-skipped",{ids:n.skipped})}catch(l){this._handleNavigationError(l,i.type,r)}finally{this._activeController===a&&(this._activeController=null),this._dispatchLoadingEnded(i.type,r)}}_handleNavigationError(i,n,r){i.name!=="AbortError"&&this._dispatchError(this._createNavigationError(i,n,r))}async _executeNavigation(i,n,r,s){i==="item"?await this._navigateToItem(n,r,s):await this._navigateToSection(n,r,s)}async _navigateToItem(i,n,r){let s=this._findItemRef(i);this._updateSessionContext(s,i),this._resetLoadingState(),this._loadingState.expectedItems=1,await this._loadItems([i],n,r),await this._waitForLoadingComplete(n,r),!this._isStaleNavigation(n,r)&&this._dispatchTestLoaded(this._loadResults,"item",i)}async _navigateToSection(i,n,r){let a=this._findSection(i)?.closest("qti-test-part")?.identifier;this.sessionContext={...this.sessionContext,navPartId:a,navSectionId:i,navItemRefId:null};let l=this._getSectionItemIds(i);this._resetLoadingState(),this._loadingState.expectedItems=l.length,await this._loadItems(l,n,r),await this._waitForLoadingComplete(n,r),!this._isStaleNavigation(n,r)&&this._dispatchTestLoaded(this._loadResults,"section",i)}_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(r=>setTimeout(r,10))}}getLoadingProgress(){return{...this._loadingState}}async _loadStimulusRef(i,n){console.info("Loading stimulus:",i.href);let r=await this._loadStimulus(i.href);console.info("Stimulus loaded, applying content:",r?"has content":"no content"),this._applyStimulusContent(r,i,n)}_applyStimulusContent(i,n,r){if(!i){console.warn("No stimulus content to apply");return}let s=i.querySelector("qti-assessment-stimulus");if(!s){console.warn("No qti-assessment-stimulus element found in stimulus");return}let a=[],l=r.querySelector(`[data-stimulus-idref="${n.identifier}"]`);if(l)a.push(l),console.info("Found specific target:",l);else{let c=Array.from(this.querySelectorAll(`[data-stimulus-idref="${n.identifier}"]`));if(c.length>0)a=c,console.info("Found targets by identifier:",c.length);else{let d=Array.from(this.querySelectorAll("[data-stimulus-idref]"));a=d,console.info("Using fallback targets:",d.length)}}if(a.length===0){console.warn("No targets found for stimulus content");return}a.forEach((c,d)=>{c.innerHTML="",c.append(s.cloneNode(!0)),console.info(`Applied stimulus content to target ${d+1}/${a.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,r){if(!this._testElement||i.length===0)return;let s=i.map(c=>this._findItemRef(c));this._clearLoadedItems(),this._clearStimulusRef();let l=(await Promise.all(s.map(c=>this._loadSingleItem(c,n,r)))).filter(Boolean);this._isStaleNavigation(n,r)||(l.forEach(({itemRef:c,doc:d})=>{c&&d&&(c.xmlDoc=d)}),l.forEach(({itemRef:c})=>{let d=c?.identifier;if(!c||!d)return;let h=this.testContext.items.find(f=>f.identifier===d)?.state;h!==void 0&&c.updateComplete.then(()=>{let f=c.assessmentItem;f&&(f.state=h)})}),this._loadResults=l)}async _loadSingleItem(i,n,r){try{let s=this.qtiContext?.QTI_CONTEXT?.seed,a=(await Jt().load(i.href,r.signal)).shuffleInteractions(s);return this.postLoadTransformCallback&&(a=await this.postLoadTransformCallback(a,i)),this._isStaleNavigation(n,r)?null:{itemRef:i,doc:a.htmlDoc(this._customElementRegistry())}}catch(s){if(s.name==="AbortError")throw console.info(`Item load for ${i.identifier} was aborted`),s;return console.warn(`Failed to load item ${i.identifier}:`,s),null}}async _loadStimulus(i){return(await Jt().load(i,this._activeController?.signal)).htmlDoc(this._customElementRegistry())}_customElementRegistry(){let i=this.querySelector("test-container");if(i)return i.customElementRegistry??void 0}_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 r=i.closest("qti-test-part")?.identifier,s=i.closest("qti-assessment-section")?.identifier;this.sessionContext={...this.sessionContext,navPartId:r,navSectionId:s,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,r){return{message:i.message||`Failed to load ${n}: ${r}`,details:i,itemId:n==="item"?r:void 0,sectionId:n==="section"?r:void 0}}_dispatchLoadingStarted(i,n){V(this,"cito-test-navigation-started",{type:i,id:n})}_dispatchLoadingEnded(i,n){this.dispatchEvent(new CustomEvent("qti-navigation-loading-ended",{detail:{type:i,id:n},bubbles:!0,composed:!0}))}_dispatchError(i){V(this,"cito-test-navigation-failed",i)}_dispatchTestLoaded(i,n,r){requestAnimationFrame(()=>{V(this,"cito-test-rendered",i.map(({itemRef:s})=>({identifier:s?.identifier,element:s}))),V(this,"cito-test-navigated",{type:n,id:r})})}}return Co([p({type:String})],t.prototype,"navigate",void 0),Co([p({type:Number})],t.prototype,"requestTimeout",void 0),Co([p({attribute:!1})],t.prototype,"postLoadTransformCallback",void 0),Co([p({attribute:!1})],t.prototype,"postLoadTestTransformCallback",void 0),t};var Kd=o=>{class t extends o{constructor(...i){super(...i),this.sessionContext={...this.sessionContext,view:"candidate"},J(this,"cito-test-switch-view",n=>{this.sessionContext={...this.sessionContext,view:n.detail},this._updateElementView()}),J(this,"cito-test-loaded",()=>{this._updateElementView()}),this.addEventListener("qti-assessment-item-connected",n=>{this._updateElementView(),this._setCorrectResponseVisibility(n.detail)})}willUpdate(i){super.willUpdate(i),i.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 r=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${this.sessionContext.navItemRefId}"]`)?.assessmentItem;r&&this.updateAssessmentItemView(r,this.sessionContext.view)}}_setCorrectResponseVisibility(i){this.updateAssessmentItemView(i,this.sessionContext.view)}updateAssessmentItemView(i,n){}}return t};var Jd=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},yl=o=>{class t extends o{constructor(...i){super(...i),this.testContext=Ka,this.sessionContext=Ya,this._updateItemInTestContext=n=>{let r=n.itemContext,s=r.identifier,a=r.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,void 0,r.valid);else{let c=[...n.variables];for(let d of l.variables){let h=c.find(f=>f.identifier===d.identifier);h?h.value=d.value:c.push(d)}n.variables=c,l.state&&(n.state=l.state)}},this._initializeEventListeners()}updateItemVariables(i,n,r){this.testContext={...this.testContext,items:this.testContext.items.map(a=>{if(a.identifier!==i)return a;let l=[...a.variables??[]];for(let{identifier:c,type:d,value:h}of n){let f=l.findIndex(v=>v.identifier===c),m={...f>=0?l[f]:{},identifier:c,...d?{type:d}:{},value:Array.isArray(h)?[...h]:h};f>=0?l[f]=m:l.push(m)}return{...a,variables:l,...r?{state:{...r}}:{}}})};let s=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${CSS.escape(i)}"]`)?.assessmentItem;s&&(s.variables=[...this.testContext.items.find(a=>a.identifier===i)?.variables??[]],r&&(s.state=r))}_initializeEventListeners(){this.addEventListener("qti-testdoc-loaded",()=>{this.testContext=Ka,this.sessionContext=Ya}),J(this,"cito-test-loaded",i=>{this._testElement=i.detail;let n=Array.from(this._testElement.querySelectorAll("qti-assessment-item-ref")).map(r=>({href:r.href,identifier:r.identifier,category:r.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,r=n.closest("qti-assessment-item-ref")?.identifier;r&&(n.assessmentItemRefId=r),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,i.detail.itemContext.valid)})}_updateItemVariablesInTestContext(i,n,r,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(d=>d.identifier===l.identifier);return c?{...c,...l}:l}),...r!==void 0?{state:r?{...r}:void 0}:{},...s!==void 0?{valid:s}:{}})},this.dispatchEvent(new CustomEvent("qti-test-context-updated",{detail:this.testContext,bubbles:!1,composed:!1}))}}return Jd([p({attribute:!1,type:Object}),U({context:at})],t.prototype,"testContext",void 0),Jd([p({attribute:!1,type:Object}),U({context:Xt})],t.prototype,"sessionContext",void 0),t},Zd=class extends yl(C){};var So=1;var vl=o=>Array.isArray(o)?[...o]:o??null,cm=o=>{let t=o;return t?.version===1&&Array.isArray(t.test?.items)&&Array.isArray(t.test?.outcomes)&&typeof t.session=="object"&&t.session!==null},dm=(o,t)=>({version:1,test:{items:(o?.items??[]).filter(e=>e.identifier).map(e=>({identifier:e.identifier,variables:(e.variables??[]).map(i=>({identifier:i.identifier,...i.type?{type:i.type}:{},value:vl(i.value)})),...e.state?{state:{...e.state}}:{}})),outcomes:(o?.testOutcomeVariables??[]).map(e=>({identifier:e.identifier,value:vl(e.value)}))},session:{...t?.navPartId!==void 0?{navPartId:t.navPartId}:{},...t?.navSectionId!==void 0?{navSectionId:t.navSectionId}:{},...t?.navItemRefId!==void 0?{navItemRefId:t.navItemRefId}:{}}}),th=o=>{class t extends o{#t=null;#e=!1;#i=null;constructor(...i){super(...i),this.addEventListener("qti-testdoc-loaded",()=>{this.#e=!1,this.#i=null}),J(this,"cito-test-loaded",()=>{this.#t&&(this.#r(this.#t),this.#t=null),this.#e=!0})}get state(){return dm(this.testContext,this.sessionContext)}set state(i){if(!cm(i)){console.warn(`[qti-test] Ignoring a state that is not a version ${1} QtiTestState.`);return}if(!this.#e){this.#t=i;return}let{navItemRefId:n,navSectionId:r}=this.sessionContext;this.#r(i);let s=this.sessionContext;s.navItemRefId&&s.navItemRefId!==n?this.#o("item",s.navItemRefId):!s.navItemRefId&&s.navSectionId&&s.navSectionId!==r&&this.#o("section",s.navSectionId)}updated(i){if(super.updated(i),!this.#e||!(i.has("testContext")||i.has("sessionContext")))return;let n=this.state,r=JSON.stringify(n);r!==this.#i&&(this.#i=r,V(this,"cito-test-state-changed",n))}#r(i){for(let r of i.test.items)this.updateItemVariables(r.identifier,r.variables,r.state);let n=new Map(i.test.outcomes.map(r=>[r.identifier,r.value]));this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(r=>n.has(r.identifier)?{...r,value:vl(n.get(r.identifier))}:r)},this.sessionContext={...this.sessionContext,...this.#n(i.session)}}#n(i){let n=(r,s)=>!!s&&!!this._testElement?.querySelector(`${r}[identifier="${CSS.escape(s)}"]`);return{...n("qti-test-part",i.navPartId)?{navPartId:i.navPartId}:{},...n("qti-assessment-section",i.navSectionId)?{navSectionId:i.navSectionId}:{},...this.testContext.items.some(r=>r.identifier===i.navItemRefId)?{navItemRefId:i.navItemRefId}:{}}}#o(i,n){V(this,"cito-test-navigate",{type:i,id:n})}}return t};var eh=o=>{class t extends o{constructor(...i){super(...i),this.addEventListener("qti-register-variable",n=>{this.testContext={...this.testContext,testOutcomeVariables:[...this.testContext.testOutcomeVariables||[],n.detail.variable]},n.stopPropagation()}),this.addEventListener("qti-set-outcome-value",n=>{let{outcomeIdentifier:r,value:s}=n.detail;this.updateOutcomeVariable(r,s),n.stopPropagation()})}outcomeProcessing(){let i=(this._testElement??this).querySelector("qti-outcome-processing");return i?(i?.process(),!0):!1}updateOutcomeVariable(i,n){let r=this.getOutcome(i);if(!r){console.warn(`Can not set qti-outcome-identifier: ${i}, it is not available`);return}this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(s=>s.identifier!==i?s:{...s,value:r.cardinality==="single"?n:[...s.value,n]})}}getOutcome(i){return this.getVariable(i)}getVariable(i){return this.testContext.testOutcomeVariables?.find(n=>n.identifier===i)||null}}return t};var ih=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},Re=class extends Yd(Kd(eh(th(yl(C))))){constructor(){super(),this.configContext={},this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},new qe(this,{context:St,initialValue:this})}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-test-connected",{detail:this}))}render(){return b`<slot></slot>`}};ih([T(),U({context:qt})],Re.prototype,"configContext",void 0);ih([T(),U({context:Ct})],Re.prototype,"qtiContext",void 0);var rh=q`
217
225
  display: inline-flex;
218
226
  align-items: center;
219
227
  justify-content: center;
@@ -227,7 +235,7 @@ Make sure to test your application with a production build as repeat registratio
227
235
  user-select: none;
228
236
  border-radius: var(--test-button-border-radius, var(--qti-component-border-radius, 0.2rem));
229
237
  `,lt=q`
230
- ${Qd};
238
+ ${rh};
231
239
  background-color: var(--test-button-background-color, var(--qti-component-background-color, #fff));
232
240
  color: var(--test-button-color, var(--qti-component-color, inherit));
233
241
  border: var(--qti-component-border-width, 1px) var(--qti-component-border-style, solid)
@@ -240,10 +248,10 @@ Make sure to test your application with a production build as repeat registratio
240
248
  `,ht=q`
241
249
  cursor: not-allowed;
242
250
  opacity: 0.45;
243
- `,K0=q`
244
- ${Qd};
251
+ `,xC=q`
252
+ ${rh};
245
253
  border: 1px solid gray;
246
- `;var Ju=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},ir=class extends C{static{this.styles=q`
254
+ `;var hm=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},oi=class extends C{static{this.styles=q`
247
255
  :host {
248
256
  ${lt};
249
257
  }
@@ -256,7 +264,7 @@ Make sure to test your application with a production build as repeat registratio
256
264
  :host([disabled]) {
257
265
  ${ht};
258
266
  }
259
- `}constructor(){super(),this.addEventListener("click",()=>{z(this,"cito-test-end-attempt",{});let t=this.testHost?.querySelector("test-container");if(!t)return;Array.from(t.shadowRoot.querySelectorAll("[view]")).forEach(r=>{r.classList.toggle("show",!0)})})}render(){return b` <slot></slot> `}};Ju([_({context:St,subscribe:!0})],ir.prototype,"testHost",void 0);var vo=class{constructor(t){this.G=t}disconnect(){this.G=void 0}reconnect(t){this.G=t}deref(){return this.G}},wo=class{constructor(){this.Y=void 0,this.Z=void 0}get(){return this.Y}pause(){this.Y??=new Promise(t=>this.Z=t)}resume(){this.Z?.(),this.Y=this.Z=void 0}};var Gd=o=>!Md(o)&&typeof o.then=="function",Xd=1073741823,ml=class extends Ae{constructor(){super(...arguments),this._$Cwt=Xd,this._$Cbt=[],this._$CK=new vo(this),this._$CX=new wo}render(...t){return t.find(e=>!Gd(e))??it}update(t,e){let r=this._$Cbt,n=r.length;this._$Cbt=e;let i=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(!Gd(l))return this._$Cwt=a,l;a<n&&l===r[a]||(this._$Cwt=Xd,n=0,Promise.resolve(l).then(async c=>{for(;s.get();)await s.get();let d=i.deref();if(d!==void 0){let h=d._$Cbt.indexOf(l);h>-1&&h<d._$Cwt&&(d._$Cwt=h,d.setValue(c))}}))}return it}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}},xo=Dt(ml);var qo=`
267
+ `}constructor(){super(),this.addEventListener("click",()=>{V(this,"cito-test-end-attempt",{});let t=this.testHost?.querySelector("test-container");if(!t)return;Array.from(t.shadowRoot.querySelectorAll("[view]")).forEach(i=>{i.classList.toggle("show",!0)})})}render(){return b` <slot></slot> `}};hm([_({context:St,subscribe:!0})],oi.prototype,"testHost",void 0);var ko=class{constructor(t){this.G=t}disconnect(){this.G=void 0}reconnect(t){this.G=t}deref(){return this.G}},Eo=class{constructor(){this.Y=void 0,this.Z=void 0}get(){return this.Y}pause(){this.Y??=new Promise(t=>this.Z=t)}resume(){this.Z?.(),this.Y=this.Z=void 0}};var nh=o=>!jd(o)&&typeof o.then=="function",oh=1073741823,wl=class extends _e{constructor(){super(...arguments),this._$Cwt=oh,this._$Cbt=[],this._$CK=new ko(this),this._$CX=new Eo}render(...t){return t.find(e=>!nh(e))??rt}update(t,e){let i=this._$Cbt,n=i.length;this._$Cbt=e;let r=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(!nh(l))return this._$Cwt=a,l;a<n&&l===i[a]||(this._$Cwt=oh,n=0,Promise.resolve(l).then(async c=>{for(;s.get();)await s.get();let d=r.deref();if(d!==void 0){let h=d._$Cbt.indexOf(l);h>-1&&h<d._$Cwt&&(d._$Cwt=h,d.setValue(c))}}))}return rt}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}},Io=Dt(wl);var Ao=`
260
268
  @layer qti-base, qti-components, qti-extended;
261
269
 
262
270
  @layer qti-components.reset, qti-components.global, qti-components.interactions.base,
@@ -6340,11 +6348,11 @@ div.full-correct-response-inline {
6340
6348
  display: inline-block;
6341
6349
  }
6342
6350
  }
6343
- `;var Te=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},At=class extends C{constructor(){super(...arguments),this.customElementRegistry=null,this.testURL=null,this.testDoc=null,this.testXML=null,this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},this.#t=null,this.#e=null}#t;#e;createRenderRoot(){let t=this.customElementRegistry;return this.#e=t,this.shadowRoot??this.attachShadow({...this.constructor.shadowRootOptions,...t?{customElementRegistry:t}:{}})}async handleTestURLChange(){if(this.testURL)try{let t=this.qtiContext?.QTI_CONTEXT?.seed,e=(await Lr().load(this.testURL)).shuffleOrdering(t),r=this.testHost;if(r?.postLoadTestTransformCallback){let i=e.htmlDoc(this.#e??void 0).querySelector("qti-assessment-test");i&&(e=await r.postLoadTestTransformCallback(e,i))}this.#r(e.htmlDoc(this.#e??void 0))}catch(t){console.error("Error loading or parsing XML:",t)}}#r(t){this.testDoc=t,this.dispatchEvent(new CustomEvent("qti-testdoc-loaded",{bubbles:!0,composed:!0}))}handleTestXMLChange(){if(this.testXML)try{let t=this.qtiContext?.QTI_CONTEXT?.seed;this.#r(Lr().parse(this.testXML).shuffleOrdering(t).htmlDoc(this.#e??void 0))}catch(t){console.error("Error parsing XML:",t)}}async connectedCallback(){super.connectedCallback(),this.#i(),this.#n(),this.testURL&&this.handleTestURLChange(),this.testXML&&this.handleTestXMLChange()}#i(){let t=this.querySelector("template");this.#t=t?t.content:b``}#n(){let t=new CSSStyleSheet;t.replaceSync(qo),this.shadowRoot.adoptedStyleSheets=[t]}render(){return b`
6351
+ `;var Pe=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},It=class extends C{constructor(){super(...arguments),this.customElementRegistry=null,this.testURL=null,this.testDoc=null,this.testXML=null,this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},this.#t=null,this.#e=null}#t;#e;createRenderRoot(){let t=this.customElementRegistry;return this.#e=t,this.shadowRoot??this.attachShadow({...this.constructor.shadowRootOptions,...t?{customElementRegistry:t}:{}})}async handleTestURLChange(){if(this.testURL)try{let t=this.qtiContext?.QTI_CONTEXT?.seed,e=(await zi().load(this.testURL)).shuffleOrdering(t),i=this.testHost;if(i?.postLoadTestTransformCallback){let r=e.htmlDoc(this.#e??void 0).querySelector("qti-assessment-test");r&&(e=await i.postLoadTestTransformCallback(e,r))}this.#i(e.htmlDoc(this.#e??void 0))}catch(t){console.error("Error loading or parsing XML:",t)}}#i(t){this.testDoc=t,this.dispatchEvent(new CustomEvent("qti-testdoc-loaded",{bubbles:!0,composed:!0}))}handleTestXMLChange(){if(this.testXML)try{let t=this.qtiContext?.QTI_CONTEXT?.seed;this.#i(zi().parse(this.testXML).shuffleOrdering(t).htmlDoc(this.#e??void 0))}catch(t){console.error("Error parsing XML:",t)}}async connectedCallback(){super.connectedCallback(),this.#r(),this.#n(),this.testURL&&this.handleTestURLChange(),this.testXML&&this.handleTestXMLChange()}#r(){let t=this.querySelector("template");this.#t=t?t.content:b``}#n(){let t=new CSSStyleSheet;t.replaceSync(Ao),this.shadowRoot.adoptedStyleSheets=[t]}render(){return b`
6344
6352
  ${this.#t}
6345
6353
  <slot></slot>
6346
- ${xo(this.testDoc,b`<span>Loading...</span>`)}
6347
- `}};Te([p({attribute:!1})],At.prototype,"customElementRegistry",void 0);Te([p({type:String,attribute:"test-url"})],At.prototype,"testURL",void 0);Te([T()],At.prototype,"testDoc",void 0);Te([T()],At.prototype,"testXML",void 0);Te([_({context:St,subscribe:!0})],At.prototype,"testHost",void 0);Te([T(),_({context:Ct,subscribe:!0})],At.prototype,"qtiContext",void 0);Te([L("testURL",{waitUntilFirstUpdate:!0})],At.prototype,"handleTestURLChange",null);Te([L("testXML",{waitUntilFirstUpdate:!0})],At.prototype,"handleTestXMLChange",null);var fl=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},nr=class extends C{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=q`
6354
+ ${Io(this.testDoc,b`<span>Loading...</span>`)}
6355
+ `}};Pe([p({attribute:!1})],It.prototype,"customElementRegistry",void 0);Pe([p({type:String,attribute:"test-url"})],It.prototype,"testURL",void 0);Pe([T()],It.prototype,"testDoc",void 0);Pe([T()],It.prototype,"testXML",void 0);Pe([_({context:St,subscribe:!0})],It.prototype,"testHost",void 0);Pe([T(),_({context:Ct,subscribe:!0})],It.prototype,"qtiContext",void 0);Pe([L("testURL",{waitUntilFirstUpdate:!0})],It.prototype,"handleTestURLChange",null);Pe([L("testXML",{waitUntilFirstUpdate:!0})],It.prototype,"handleTestXMLChange",null);var xl=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},si=class extends C{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=q`
6348
6356
  :host {
6349
6357
  ${lt};
6350
6358
  }
@@ -6357,7 +6365,7 @@ div.full-correct-response-inline {
6357
6365
  :host([disabled]) {
6358
6366
  ${ht};
6359
6367
  }
6360
- `}constructor(){super(),this._internalDisabled=!1,this.addEventListener("click",t=>{t.preventDefault(),this._internalDisabled||z(this,"cito-test-end-attempt",{})})}willUpdate(t){this.checkDisabled()}checkDisabled(){let t=this.computedContext?.testParts.find(a=>a.active);if(!t)return;let e=t.sections.flatMap(a=>a.items),r=e.findIndex(a=>a.active),n=e[r];if(!n){this._internalDisabled=!1;return}let i=n.maxAttempts??1,s=n.numAttempts||0;if(!n.adaptive&&n.optimal){this._internalDisabled=!0;return}if(!n.adaptive&&i>0&&s>=i){this._internalDisabled=!0;return}n.allowSkipping===!1?this._internalDisabled=n.valid===!1||n.isDefaultResponse:this._internalDisabled=!1}render(){return b` <slot></slot> `}};fl([_({context:j,subscribe:!0}),p({attribute:!1})],nr.prototype,"computedContext",void 0);fl([p({type:Boolean,reflect:!0,attribute:"disabled"})],nr.prototype,"_internalDisabled",void 0);fl([L("computedContext")],nr.prototype,"_handleTestElementChange",null);var Zu=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Hi=class extends C{static{this.styles=q`
6368
+ `}constructor(){super(),this._internalDisabled=!1,this.addEventListener("click",t=>{t.preventDefault(),this._internalDisabled||V(this,"cito-test-end-attempt",{})})}willUpdate(t){this.checkDisabled()}checkDisabled(){let t=this.computedContext?.testParts.find(a=>a.active);if(!t)return;let e=t.sections.flatMap(a=>a.items),i=e.findIndex(a=>a.active),n=e[i];if(!n){this._internalDisabled=!1;return}let r=n.maxAttempts??1,s=n.numAttempts||0;if(!n.adaptive&&n.optimal){this._internalDisabled=!0;return}if(n.adaptive&&n.completionStatus==="completed"){this._internalDisabled=!0;return}if(!n.adaptive&&r>0&&s>=r){this._internalDisabled=!0;return}n.allowSkipping===!1?this._internalDisabled=n.valid===!1||n.isDefaultResponse:this._internalDisabled=!1}render(){return b` <slot></slot> `}};xl([_({context:j,subscribe:!0}),p({attribute:!1})],si.prototype,"computedContext",void 0);xl([p({type:Boolean,reflect:!0,attribute:"disabled"})],si.prototype,"_internalDisabled",void 0);xl([L("computedContext")],si.prototype,"_handleTestElementChange",null);var pm=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},Xr=class extends C{static{this.styles=q`
6361
6369
  :host {
6362
6370
  ${lt};
6363
6371
  }
@@ -6370,12 +6378,12 @@ div.full-correct-response-inline {
6370
6378
  :host([disabled]) {
6371
6379
  ${ht};
6372
6380
  }
6373
- `}constructor(){super(),this.itemId=null,this.addEventListener("click",()=>this._requestItem(this.itemId))}_requestItem(t){z(this,"cito-test-navigate",{type:"item",id:t})}render(){return b` <slot></slot> `}};Zu([p({type:String,attribute:"item-id"})],Hi.prototype,"itemId",void 0);var or=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},So="tts-element",ko="tts-word",Co=null;function tm(){return Co||(Co=new CSSStyleSheet,Co.replaceSync(`
6374
- ::highlight(${So}) { background-color: #dbeafe; color: inherit; }
6375
- ::highlight(${ko}) { background-color: #ffe066; color: inherit; }
6376
- `)),Co}var Yd=Symbol("tts-context"),em={play:"M8 5v14l11-7z",pause:"M6 5h4v14H6zM14 5h4v14h-4z",stop:"M6 6h12v12H6z",prev:"M6 5h2v14H6zM20 5v14L9 12z",next:"M16 5h2v14h-2zM4 5v14l11-7z",pick:"M5 3l13 7-5.5 1.6 3.4 6.6-2.4 1.3-3.4-6.7L6 17z"},Re=(o,t)=>{let e=b`<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false">
6377
- <path d="${em[o]}"></path>
6378
- </svg>`;return b`${e}<span class="label">${t}</span>`},Nt=class extends C{static{this.styles=q`
6381
+ `}constructor(){super(),this.itemId=null,this.addEventListener("click",()=>this._requestItem(this.itemId))}_requestItem(t){V(this,"cito-test-navigate",{type:"item",id:t})}render(){return b` <slot></slot> `}};pm([p({type:String,attribute:"item-id"})],Xr.prototype,"itemId",void 0);var ai=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},To="tts-element",Ro="tts-word",_o=null;function um(){return _o||(_o=new CSSStyleSheet,_o.replaceSync(`
6382
+ ::highlight(${To}) { background-color: #dbeafe; color: inherit; }
6383
+ ::highlight(${Ro}) { background-color: #ffe066; color: inherit; }
6384
+ `)),_o}var sh=Symbol("tts-context"),mm={play:"M8 5v14l11-7z",pause:"M6 5h4v14H6zM14 5h4v14h-4z",stop:"M6 6h12v12H6z",prev:"M6 5h2v14H6zM20 5v14L9 12z",next:"M16 5h2v14h-2zM4 5v14l11-7z",pick:"M5 3l13 7-5.5 1.6 3.4 6.6-2.4 1.3-3.4-6.7L6 17z"},Oe=(o,t)=>{let e=b`<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false">
6385
+ <path d="${mm[o]}"></path>
6386
+ </svg>`;return b`${e}<span class="label">${t}</span>`},$t=class extends C{static{this.styles=q`
6379
6387
  :host {
6380
6388
  display: inline-flex;
6381
6389
  }
@@ -6420,67 +6428,67 @@ div.full-correct-response-inline {
6420
6428
  clip-path: inset(50%);
6421
6429
  white-space: nowrap;
6422
6430
  }
6423
- `}#t=this.attachInternals();#e;#r=!1;updated(t){let e=this._tts?.state,r=this._tts?.picking??!1;e===this.#e&&r===this.#r||(this.#e=e,this.#r=r,this.#t.states.clear(),e&&this.#t.states.add(e),r&&this.#t.states.add("picking"))}};or([p({type:String})],Nt.prototype,"label",void 0);or([_({context:Yd,subscribe:!0})],Nt.prototype,"_tts",void 0);var Pe=class extends C{static{this.styles=q`
6431
+ `}#t=this.attachInternals();#e;#i=!1;updated(t){let e=this._tts?.state,i=this._tts?.picking??!1;e===this.#e&&i===this.#i||(this.#e=e,this.#i=i,this.#t.states.clear(),e&&this.#t.states.add(e),i&&this.#t.states.add("picking"))}};ai([p({type:String})],$t.prototype,"label",void 0);ai([_({context:sh,subscribe:!0})],$t.prototype,"_tts",void 0);var Me=class extends C{static{this.styles=q`
6424
6432
  :host {
6425
6433
  display: inline-flex;
6426
6434
  flex-wrap: wrap;
6427
6435
  align-items: center;
6428
6436
  gap: var(--test-tts-gap, 0.25rem);
6429
6437
  }
6430
- `}#t;#e;#r;#i;#n;#o;#s;#a;#c;#p;#l;#d;#m;#h;#f;#g;#b;#u;#y;#v;constructor(){super(),this.language="nl-NL",this.#t=this.attachInternals(),this.#e=!1,this.#r=null,this.#i=!1,this.#n=null,this.#o=null,this.#s=this.#k.bind(this),this.#a=()=>this.#R(),this.#c=void 0,this.#p=void 0,this.#l=null,this.#d=0,this.#m=[],this.#h=null,this.#f=!1,this.#g=null,this.#b=this.#W.bind(this),this.#u=!1,this.#y=new Highlight,this.#v=new Highlight,this._ttsContext={state:"idle",currentElementIndex:0,elementCount:0,play:()=>this.#j(),pause:()=>this.#F(),resume:()=>this.#B(),stop:()=>{this.#C(),this.#R()},prevElement:()=>this.#Q(),nextElement:()=>this.#G(),togglePick:()=>this.#U(),picking:!1}}willUpdate(t){if(super.willUpdate(t),this.#e||this.#i||this.#n)return;let e=this._sessionContext?.navItemRefId??null,r=this._sessionContext?.navSectionId??null,n=this.#c!==void 0&&this.#c!==e,i=this.#p!==void 0&&this.#p!==r;(n||i)&&this.#S(),this.#c=e,this.#p=r}#S(){this.#C(),this.#R(),this.#l=null,this.#d=0,this.#u=!1,this.#A()}connectedCallback(){if(super.connectedCallback(),this.#x("idle"),this.#e=this.#w()!==null,this.#e){this.#r=new MutationObserver(t=>{t.some(e=>!this.contains(e.target))&&this.#E()}),this.#r.observe(this.parentElement,{childList:!0,subtree:!0});return}this.#i=this.#O()!==null,!this.#i&&(this.#n=this.closest("qti-assessment-item-ref"),this.#o=this.#n??this.closest("test-navigation")??this.testHost??this.getRootNode(),this.#o.addEventListener("qti-assessment-item-connected",this.#s),this.#n||(this.#o.addEventListener("cito-test-navigate",this.#a),this.#o.addEventListener("qti-request-navigation",this.#a)))}disconnectedCallback(){super.disconnectedCallback(),this.#h&&(this.#h=null,speechSynthesis.cancel()),this.#C(),this.#_(),this.#o?.removeEventListener("qti-assessment-item-connected",this.#s),this.#o?.removeEventListener("cito-test-navigate",this.#a),this.#o?.removeEventListener("qti-request-navigation",this.#a),this.#o=null,this.#n=null,this.#r?.disconnect(),this.#r=null,this.#e=!1,this.#i=!1}render(){return b`<slot></slot>`}#k(t){if(this.#l===null)return;let e=t.detail?.identifier;(this.#n||e===this._sessionContext?.navItemRefId)&&this.#S()}#E(){this.#h&&(this.#h=null,speechSynthesis.cancel()),this.#C(),this.#_(),this.#x("idle"),this.#l=null,this.#d=0,this.#u=!1,this.#A()}#w(){return this.parentElement?.querySelector(":scope > [data-stimulus-idref]")??null}#O(){return this.parentElement?.querySelector(":scope > [data-tts-content]")??null}#N(){return this.#e?this.#w()?.querySelector("qti-stimulus-body")??null:this.#i?this.#O():this.#$()?.querySelector("qti-item-body")??null}#$(){if(this.#n)return this.#n.assessmentItem;let t=this._sessionContext?.navItemRefId;return t?this.#L(t):null}#L(t){let e=`qti-assessment-item-ref[identifier="${CSS.escape(t)}"] qti-assessment-item`,r=a=>{let l=a.querySelector(e);if(l)return l;for(let c of Array.from(a.querySelectorAll("test-container"))){let d=c.shadowRoot?.querySelector(e);if(d)return d}return null},n=this.closest("qti-test"),i=n&&r(n);if(i)return i;let s=this.getRootNode();for(;;){let a=r(s);if(a)return a;let l=s.host;if(!l)return null;s=l.getRootNode()}}#x(t){this._ttsContext={...this._ttsContext,state:t},this.#t.states.delete("idle"),this.#t.states.delete("playing"),this.#t.states.delete("paused"),this.#t.states.add(t)}#A(){this._ttsContext={...this._ttsContext,currentElementIndex:this.#d,elementCount:this.#q().length}}#q(){if(this.#i&&this.#l?.some(t=>!t.isConnected)&&(this.#l=null,this.#d=0,this.#u=!1),this.#l===null){let t=this.#N();if(!t)return[];let e="p, h1, h2, h3, h4, h5, h6, li, dt, dd, th, td, caption, blockquote, figcaption, qti-prompt, qti-simple-choice";this.#l=Array.from(t.querySelectorAll(e)).filter(r=>(r.textContent??"").trim().length>0&&!r.querySelector(e)&&!r.closest('[aria-hidden="true"]'))}return this.#l.filter(t=>this.#V(t))}#V(t){return typeof t.checkVisibility=="function"?t.checkVisibility({checkOpacity:!1,checkVisibilityCSS:!0}):t.getClientRects().length>0}#z(t){let e=t;for(;e;){let n=e.getAttribute("lang")||e.getAttribute("xml:lang");if(n?.trim())return n.trim();e=e.parentElement??e.getRootNode().host??null}let r=document.documentElement.getAttribute("lang");return r?.trim()?r.trim():this.language}#j(){if(!this.#q().length){console.warn("test-item-to-speech: no readable elements found");return}this.#C(),speechSynthesis.cancel(),this.#u&&(this.#u=!1,this.#d=0),this.#i&&this.#d===0&&(this.#l=null),this.#T(this.#d)}#T(t){let e=this.#q();if(t>=e.length){this.#I(),this.#d=e.length-1,e.length>0&&this.#P(e[this.#d]),this.#u=!0,this.#x("idle"),this.#A();return}this.#d=t,this.#u=!1,this.#A();let r=e[t];r.scrollIntoView({behavior:"smooth",block:"nearest"}),this.#P(r),this.#m=this.#X(r);let n=this.#m.map(s=>s.textContent??"").join("");if(!n.trim()){this.#T(t+1);return}let i=new SpeechSynthesisUtterance(n);i.lang=this.#z(r),i.rate=1,i.onboundary=s=>{s.name==="word"&&this.#Y(s.charIndex,s.charLength??0)},i.onend=()=>{this.#h===i&&(this.#h=null,this.#I(),this.#T(this.#d+1))},i.onerror=()=>{this.#h===i&&(this.#h=null,this.#_(),this.#x("idle"))},this.#h=i,speechSynthesis.speak(i),this.#x("playing")}#F(){speechSynthesis.pause(),this.#x("paused")}#B(){speechSynthesis.resume(),this.#x("playing")}#R(){this.#h=null,speechSynthesis.cancel(),this.#_(),this.#x("idle")}#U(){this.#f?this.#C():this.#H()}#H(){this.#i&&(this.#l=null);let t=this.#q();if(!t.length){console.warn("test-item-to-speech: no readable elements found");return}this.#R(),this.#f=!0,this.#t.states.add("picking"),this.#M(t),this.#g=t[0].getRootNode(),this.#g.addEventListener("click",this.#b,!0),this._ttsContext={...this._ttsContext,picking:!0}}#C(){this.#f&&(this.#f=!1,this.#t.states.delete("picking"),this.#g?.removeEventListener("click",this.#b,!0),this.#g=null,this.#_(),this._ttsContext={...this._ttsContext,picking:!1})}#W(t){let e=this.#q(),r=t.composedPath(),n=e.findIndex(i=>r.includes(i));if(n<0){let i=r.find(s=>s instanceof Element&&s.matches("qti-simple-choice, li, qti-prompt"));i&&(n=e.findIndex(s=>i.contains(s)))}n<0||(t.preventDefault(),t.stopPropagation(),this.#C(),speechSynthesis.cancel(),this.#T(n))}#Q(){let t=this.#q();if(!t.length)return;this.#h=null,speechSynthesis.cancel(),this.#I(),this.#d=Math.max(0,this.#d-1),this.#u=!1,this.#A();let e=t[this.#d];e.scrollIntoView({behavior:"smooth",block:"nearest"}),this.#P(e),this.#x("idle")}#G(){let t=this.#q();if(!t.length)return;this.#h=null,speechSynthesis.cancel(),this.#I(),this.#d=Math.min(t.length-1,this.#d+1),this.#u=!1,this.#A();let e=t[this.#d];e.scrollIntoView({behavior:"smooth",block:"nearest"}),this.#P(e),this.#x("idle")}#X(t){let e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_TEXT),n;for(;n=r.nextNode();)(n.textContent??"").length>0&&!n.parentElement?.closest('[aria-hidden="true"]')&&e.push(n);return e}#P(t){this.#M([t])}#M(t){if("highlights"in CSS){this.#D(),this.#y.clear();for(let e of t){let r=new Range;r.selectNodeContents(e),this.#y.add(r)}CSS.highlights.set(So,this.#y)}}#Y(t,e){if(!("highlights"in CSS))return;this.#D(),this.#v.clear();let r=this.#m.map(d=>d.textContent??"").join(""),n=t+(e>0?e:this.#K(t,r)),i=0,s=null,a=0,l=null,c=0;for(let d of this.#m){let h=d.textContent?.length??0;if(!s&&i+h>t&&(s=d,a=t-i),s&&i+h>=n){l=d,c=n-i;break}i+=h}if(s&&l){let d=new Range;d.setStart(s,a),d.setEnd(l,c),this.#v.add(d),CSS.highlights.set(ko,this.#v)}}#I(){"highlights"in CSS&&(this.#v.clear(),CSS.highlights.get(ko)===this.#v&&CSS.highlights.delete(ko))}#_(){"highlights"in CSS&&(this.#I(),this.#y.clear(),CSS.highlights.get(So)===this.#y&&CSS.highlights.delete(So))}#K(t,e){let r=e.slice(t).search(/\s/);return r<0?e.length-t:r}#D(){if(!("highlights"in CSS))return;let t=tm();document.adoptedStyleSheets.includes(t)||(document.adoptedStyleSheets=[...document.adoptedStyleSheets,t]);let e=new Set,r=this.closest("test-navigation")?.querySelector("test-container")??this.testHost?.querySelector("test-container");r?.shadowRoot&&e.add(r.shadowRoot);let n=this.getRootNode();n instanceof ShadowRoot&&e.add(n);let i=this.#l?.[0]?.getRootNode();i instanceof ShadowRoot&&e.add(i);for(let s of e)s.adoptedStyleSheets.includes(t)||(s.adoptedStyleSheets=[...s.adoptedStyleSheets,t])}};or([p({type:String})],Pe.prototype,"language",void 0);or([_({context:Qt,subscribe:!0})],Pe.prototype,"_sessionContext",void 0);or([_({context:St,subscribe:!0})],Pe.prototype,"testHost",void 0);or([T(),U({context:Yd})],Pe.prototype,"_ttsContext",void 0);var Wi=class extends Nt{#t(){this._tts&&(this._tts.state==="idle"?this._tts.play():this._tts.state==="playing"?this._tts.pause():this._tts.resume())}render(){let t=this._tts?.state==="playing";return b`
6438
+ `}#t;#e;#i;#r;#n;#o;#s;#a;#c;#p;#l;#d;#m;#h;#f;#g;#b;#u;#y;#v;constructor(){super(),this.language="nl-NL",this.#t=this.attachInternals(),this.#e=!1,this.#i=null,this.#r=!1,this.#n=null,this.#o=null,this.#s=this.#k.bind(this),this.#a=()=>this.#R(),this.#c=void 0,this.#p=void 0,this.#l=null,this.#d=0,this.#m=[],this.#h=null,this.#f=!1,this.#g=null,this.#b=this.#W.bind(this),this.#u=!1,this.#y=new Highlight,this.#v=new Highlight,this._ttsContext={state:"idle",currentElementIndex:0,elementCount:0,play:()=>this.#j(),pause:()=>this.#F(),resume:()=>this.#B(),stop:()=>{this.#C(),this.#R()},prevElement:()=>this.#Q(),nextElement:()=>this.#X(),togglePick:()=>this.#U(),picking:!1}}willUpdate(t){if(super.willUpdate(t),this.#e||this.#r||this.#n)return;let e=this._sessionContext?.navItemRefId??null,i=this._sessionContext?.navSectionId??null,n=this.#c!==void 0&&this.#c!==e,r=this.#p!==void 0&&this.#p!==i;(n||r)&&this.#S(),this.#c=e,this.#p=i}#S(){this.#C(),this.#R(),this.#l=null,this.#d=0,this.#u=!1,this.#I()}connectedCallback(){if(super.connectedCallback(),this.#x("idle"),this.#e=this.#w()!==null,this.#e){this.#i=new MutationObserver(t=>{t.some(e=>!this.contains(e.target))&&this.#E()}),this.#i.observe(this.parentElement,{childList:!0,subtree:!0});return}this.#r=this.#O()!==null,!this.#r&&(this.#n=this.closest("qti-assessment-item-ref"),this.#o=this.#n??this.closest("test-navigation")??this.testHost??this.getRootNode(),this.#o.addEventListener("qti-assessment-item-connected",this.#s),this.#n||(this.#o.addEventListener("cito-test-navigate",this.#a),this.#o.addEventListener("qti-request-navigation",this.#a)))}disconnectedCallback(){super.disconnectedCallback(),this.#h&&(this.#h=null,speechSynthesis.cancel()),this.#C(),this.#_(),this.#o?.removeEventListener("qti-assessment-item-connected",this.#s),this.#o?.removeEventListener("cito-test-navigate",this.#a),this.#o?.removeEventListener("qti-request-navigation",this.#a),this.#o=null,this.#n=null,this.#i?.disconnect(),this.#i=null,this.#e=!1,this.#r=!1}render(){return b`<slot></slot>`}#k(t){if(this.#l===null)return;let e=t.detail?.identifier;(this.#n||e===this._sessionContext?.navItemRefId)&&this.#S()}#E(){this.#h&&(this.#h=null,speechSynthesis.cancel()),this.#C(),this.#_(),this.#x("idle"),this.#l=null,this.#d=0,this.#u=!1,this.#I()}#w(){return this.parentElement?.querySelector(":scope > [data-stimulus-idref]")??null}#O(){return this.parentElement?.querySelector(":scope > [data-tts-content]")??null}#N(){return this.#e?this.#w()?.querySelector("qti-stimulus-body")??null:this.#r?this.#O():this.#$()?.querySelector("qti-item-body")??null}#$(){if(this.#n)return this.#n.assessmentItem;let t=this._sessionContext?.navItemRefId;return t?this.#L(t):null}#L(t){let e=`qti-assessment-item-ref[identifier="${CSS.escape(t)}"] qti-assessment-item`,i=a=>{let l=a.querySelector(e);if(l)return l;for(let c of Array.from(a.querySelectorAll("test-container"))){let d=c.shadowRoot?.querySelector(e);if(d)return d}return null},n=this.closest("qti-test"),r=n&&i(n);if(r)return r;let s=this.getRootNode();for(;;){let a=i(s);if(a)return a;let l=s.host;if(!l)return null;s=l.getRootNode()}}#x(t){this._ttsContext={...this._ttsContext,state:t},this.#t.states.delete("idle"),this.#t.states.delete("playing"),this.#t.states.delete("paused"),this.#t.states.add(t)}#I(){this._ttsContext={...this._ttsContext,currentElementIndex:this.#d,elementCount:this.#q().length}}#q(){if(this.#r&&this.#l?.some(t=>!t.isConnected)&&(this.#l=null,this.#d=0,this.#u=!1),this.#l===null){let t=this.#N();if(!t)return[];let e="p, h1, h2, h3, h4, h5, h6, li, dt, dd, th, td, caption, blockquote, figcaption, qti-prompt, qti-simple-choice";this.#l=Array.from(t.querySelectorAll(e)).filter(i=>(i.textContent??"").trim().length>0&&!i.querySelector(e)&&!i.closest('[aria-hidden="true"]'))}return this.#l.filter(t=>this.#V(t))}#V(t){return typeof t.checkVisibility=="function"?t.checkVisibility({checkOpacity:!1,checkVisibilityCSS:!0}):t.getClientRects().length>0}#z(t){let e=t;for(;e;){let n=e.getAttribute("lang")||e.getAttribute("xml:lang");if(n?.trim())return n.trim();e=e.parentElement??e.getRootNode().host??null}let i=document.documentElement.getAttribute("lang");return i?.trim()?i.trim():this.language}#j(){if(!this.#q().length){console.warn("test-item-to-speech: no readable elements found");return}this.#C(),speechSynthesis.cancel(),this.#u&&(this.#u=!1,this.#d=0),this.#r&&this.#d===0&&(this.#l=null),this.#T(this.#d)}#T(t){let e=this.#q();if(t>=e.length){this.#A(),this.#d=e.length-1,e.length>0&&this.#P(e[this.#d]),this.#u=!0,this.#x("idle"),this.#I();return}this.#d=t,this.#u=!1,this.#I();let i=e[t];i.scrollIntoView({behavior:"smooth",block:"nearest"}),this.#P(i),this.#m=this.#G(i);let n=this.#m.map(s=>s.textContent??"").join("");if(!n.trim()){this.#T(t+1);return}let r=new SpeechSynthesisUtterance(n);r.lang=this.#z(i),r.rate=1,r.onboundary=s=>{s.name==="word"&&this.#Y(s.charIndex,s.charLength??0)},r.onend=()=>{this.#h===r&&(this.#h=null,this.#A(),this.#T(this.#d+1))},r.onerror=()=>{this.#h===r&&(this.#h=null,this.#_(),this.#x("idle"))},this.#h=r,speechSynthesis.speak(r),this.#x("playing")}#F(){speechSynthesis.pause(),this.#x("paused")}#B(){speechSynthesis.resume(),this.#x("playing")}#R(){this.#h=null,speechSynthesis.cancel(),this.#_(),this.#x("idle")}#U(){this.#f?this.#C():this.#H()}#H(){this.#r&&(this.#l=null);let t=this.#q();if(!t.length){console.warn("test-item-to-speech: no readable elements found");return}this.#R(),this.#f=!0,this.#t.states.add("picking"),this.#M(t),this.#g=t[0].getRootNode(),this.#g.addEventListener("click",this.#b,!0),this._ttsContext={...this._ttsContext,picking:!0}}#C(){this.#f&&(this.#f=!1,this.#t.states.delete("picking"),this.#g?.removeEventListener("click",this.#b,!0),this.#g=null,this.#_(),this._ttsContext={...this._ttsContext,picking:!1})}#W(t){let e=this.#q(),i=t.composedPath(),n=e.findIndex(r=>i.includes(r));if(n<0){let r=i.find(s=>s instanceof Element&&s.matches("qti-simple-choice, li, qti-prompt"));r&&(n=e.findIndex(s=>r.contains(s)))}n<0||(t.preventDefault(),t.stopPropagation(),this.#C(),speechSynthesis.cancel(),this.#T(n))}#Q(){let t=this.#q();if(!t.length)return;this.#h=null,speechSynthesis.cancel(),this.#A(),this.#d=Math.max(0,this.#d-1),this.#u=!1,this.#I();let e=t[this.#d];e.scrollIntoView({behavior:"smooth",block:"nearest"}),this.#P(e),this.#x("idle")}#X(){let t=this.#q();if(!t.length)return;this.#h=null,speechSynthesis.cancel(),this.#A(),this.#d=Math.min(t.length-1,this.#d+1),this.#u=!1,this.#I();let e=t[this.#d];e.scrollIntoView({behavior:"smooth",block:"nearest"}),this.#P(e),this.#x("idle")}#G(t){let e=[],i=document.createTreeWalker(t,NodeFilter.SHOW_TEXT),n;for(;n=i.nextNode();)(n.textContent??"").length>0&&!n.parentElement?.closest('[aria-hidden="true"]')&&e.push(n);return e}#P(t){this.#M([t])}#M(t){if("highlights"in CSS){this.#D(),this.#y.clear();for(let e of t){let i=new Range;i.selectNodeContents(e),this.#y.add(i)}CSS.highlights.set(To,this.#y)}}#Y(t,e){if(!("highlights"in CSS))return;this.#D(),this.#v.clear();let i=this.#m.map(d=>d.textContent??"").join(""),n=t+(e>0?e:this.#K(t,i)),r=0,s=null,a=0,l=null,c=0;for(let d of this.#m){let h=d.textContent?.length??0;if(!s&&r+h>t&&(s=d,a=t-r),s&&r+h>=n){l=d,c=n-r;break}r+=h}if(s&&l){let d=new Range;d.setStart(s,a),d.setEnd(l,c),this.#v.add(d),CSS.highlights.set(Ro,this.#v)}}#A(){"highlights"in CSS&&(this.#v.clear(),CSS.highlights.get(Ro)===this.#v&&CSS.highlights.delete(Ro))}#_(){"highlights"in CSS&&(this.#A(),this.#y.clear(),CSS.highlights.get(To)===this.#y&&CSS.highlights.delete(To))}#K(t,e){let i=e.slice(t).search(/\s/);return i<0?e.length-t:i}#D(){if(!("highlights"in CSS))return;let t=um();document.adoptedStyleSheets.includes(t)||(document.adoptedStyleSheets=[...document.adoptedStyleSheets,t]);let e=new Set,i=this.closest("test-navigation")?.querySelector("test-container")??this.testHost?.querySelector("test-container");i?.shadowRoot&&e.add(i.shadowRoot);let n=this.getRootNode();n instanceof ShadowRoot&&e.add(n);let r=this.#l?.[0]?.getRootNode();r instanceof ShadowRoot&&e.add(r);for(let s of e)s.adoptedStyleSheets.includes(t)||(s.adoptedStyleSheets=[...s.adoptedStyleSheets,t])}};ai([p({type:String})],Me.prototype,"language",void 0);ai([_({context:Xt,subscribe:!0})],Me.prototype,"_sessionContext",void 0);ai([_({context:St,subscribe:!0})],Me.prototype,"testHost",void 0);ai([T(),U({context:sh})],Me.prototype,"_ttsContext",void 0);var Gr=class extends $t{#t(){this._tts&&(this._tts.state==="idle"?this._tts.play():this._tts.state==="playing"?this._tts.pause():this._tts.resume())}render(){let t=this._tts?.state==="playing";return b`
6431
6439
  <button part="button" aria-label=${Z(t?this.pauseLabel:this.label)} @click=${this.#t}>
6432
- ${t?b`<slot name="pause">${Re("pause",this.pauseLabel??"Pause")}</slot>`:b`<slot name="play">${Re("play",this.label??"Play")}</slot>`}
6440
+ ${t?b`<slot name="pause">${Oe("pause",this.pauseLabel??"Pause")}</slot>`:b`<slot name="play">${Oe("play",this.label??"Play")}</slot>`}
6433
6441
  </button>
6434
- `}};or([p({type:String,attribute:"pause-label"})],Wi.prototype,"pauseLabel",void 0);var Eo=class extends Nt{render(){return b`
6442
+ `}};ai([p({type:String,attribute:"pause-label"})],Gr.prototype,"pauseLabel",void 0);var Po=class extends $t{render(){return b`
6435
6443
  <button
6436
6444
  part="button"
6437
6445
  aria-label=${Z(this.label)}
6438
6446
  ?disabled=${this._tts?.state!=="playing"}
6439
6447
  @click=${()=>this._tts?.pause()}
6440
6448
  >
6441
- <slot>${Re("pause",this.label??"Pause")}</slot>
6449
+ <slot>${Oe("pause",this.label??"Pause")}</slot>
6442
6450
  </button>
6443
- `}},Ao=class extends Nt{render(){return b`
6451
+ `}},Oo=class extends $t{render(){return b`
6444
6452
  <button
6445
6453
  part="button"
6446
6454
  aria-label=${Z(this.label)}
6447
6455
  ?disabled=${this._tts?.state!=="paused"}
6448
6456
  @click=${()=>this._tts?.resume()}
6449
6457
  >
6450
- <slot>${Re("play",this.label??"Resume")}</slot>
6458
+ <slot>${Oe("play",this.label??"Resume")}</slot>
6451
6459
  </button>
6452
- `}},Io=class extends Nt{render(){let t=this._tts?.state==="idle"&&!this._tts?.picking;return b`
6460
+ `}},Mo=class extends $t{render(){let t=this._tts?.state==="idle"&&!this._tts?.picking;return b`
6453
6461
  <button part="button" aria-label=${Z(this.label)} ?disabled=${t} @click=${()=>this._tts?.stop()}>
6454
- <slot>${Re("stop",this.label??"Stop")}</slot>
6462
+ <slot>${Oe("stop",this.label??"Stop")}</slot>
6455
6463
  </button>
6456
- `}},_o=class extends Nt{render(){let t=(this._tts?.elementCount??0)>0,e=(this._tts?.currentElementIndex??0)===0;return b`
6464
+ `}},Do=class extends $t{render(){let t=(this._tts?.elementCount??0)>0,e=(this._tts?.currentElementIndex??0)===0;return b`
6457
6465
  <button
6458
6466
  part="button"
6459
6467
  aria-label=${Z(this.label)}
6460
6468
  ?disabled=${t&&e}
6461
6469
  @click=${()=>this._tts?.prevElement()}
6462
6470
  >
6463
- <slot>${Re("prev",this.label??"Previous sentence")}</slot>
6471
+ <slot>${Oe("prev",this.label??"Previous sentence")}</slot>
6464
6472
  </button>
6465
- `}},To=class extends Nt{render(){let t=this._tts?.elementCount??0,e=t>0&&(this._tts?.currentElementIndex??0)>=t-1;return b`
6473
+ `}},No=class extends $t{render(){let t=this._tts?.elementCount??0,e=t>0&&(this._tts?.currentElementIndex??0)>=t-1;return b`
6466
6474
  <button
6467
6475
  part="button"
6468
6476
  aria-label=${Z(this.label)}
6469
6477
  ?disabled=${e}
6470
6478
  @click=${()=>this._tts?.nextElement()}
6471
6479
  >
6472
- <slot>${Re("next",this.label??"Next sentence")}</slot>
6480
+ <slot>${Oe("next",this.label??"Next sentence")}</slot>
6473
6481
  </button>
6474
- `}},Ro=class extends Nt{render(){return b`
6482
+ `}},$o=class extends $t{render(){return b`
6475
6483
  <button
6476
6484
  part="button"
6477
6485
  aria-label=${Z(this.label)}
6478
6486
  aria-pressed=${this._tts?.picking?"true":"false"}
6479
6487
  @click=${()=>this._tts?.togglePick()}
6480
6488
  >
6481
- <slot>${Re("pick",this.label??"Read from here")}</slot>
6489
+ <slot>${Oe("pick",this.label??"Read from here")}</slot>
6482
6490
  </button>
6483
- `}};var sr=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},rm=()=>({QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}}),gt=class extends C{get qtiContext(){return this.#n()?.qtiContext??(this.#t??=rm())}set qtiContext(t){this.#e||(this.#e=!0,console.warn("[qti-components] `test-navigation.qtiContext` is deprecated and will be removed in the next major release. Set `qtiContext` on `<qti-test>` instead; it is the same value.")),this.#r(t)}#t;#e;#r(t){let e=this.#n();e?e.qtiContext=t:this.#t=t}#i;#n(){return this.#i.value??null}#o;#s;constructor(){super(),this.identifier=void 0,this.initContext=[],this.#e=!1,this.#i=new wt(this,{context:St,subscribe:!0,callback:t=>{t&&this.#t&&(t.qtiContext=this.#t,this.#t=void 0)}}),this.configContext={},this.autoScoreItems=!1,this.#s=new Map,J(this,"cito-test-loaded",this.#m.bind(this)),this.addEventListener("qti-assessment-item-connected",this.#f.bind(this)),sd(this,"cito-item-response-changed",this.#d.bind(this)),this.addEventListener("qti-item-context-updated",this.#a.bind(this)),J(this,"cito-test-end-attempt",this.#p.bind(this)),J(this,"cito-test-update-outcome",this.#l.bind(this))}#a(t){if(!t.detail?.responseProcessed)return;let e=t.detail.itemContext;if(!e?.identifier)return;let r=this.#b(e);this.#s.set(e.identifier,r);let n=this.computedItemFor(e.identifier),i=Number(e.variables?.find(s=>s.identifier==="numAttempts")?.value)||0;this.afterAttemptEnded(t.composedPath()[0]?.closest("qti-assessment-item"),n,this.#g(i,r,n?.maxAttempts))}afterAttemptEnded(t,e,r){}computedItemFor(t){return this.computedContext?.testParts?.flatMap(e=>e.sections).flatMap(e=>e.items).find(e=>e.identifier===t)}#c(t){return t?this.#o?.querySelector(`qti-assessment-item-ref[identifier="${t}"]`)?.assessmentItem??void 0:void 0}get activeAssessmentItem(){if(!(!this.#o||!this._sessionContext?.navItemRefId))return this.#o.querySelector(`qti-assessment-item-ref[identifier="${this._sessionContext.navItemRefId}"]`)?.assessmentItem}#p(t){let e=this.activeAssessmentItem;if(!e)return;let r=this.configContext?.reportValidityAfterScoring===!0;e.processResponse(!0,r)}#l(t){let e=this.#c(t.detail?.assessmentItemRefId);e&&e.setOutcomeVariable(t.detail.outcomeVariableId,t.detail.value)}#d(t){if(this.autoScoreItems){let e=t.composedPath()[0].closest("qti-assessment-item");if(!e)return;let r=e.variables.find(n=>n.identifier==="SCORE");if(r&&r.externalScored===null&&e.adaptive==="false"){let n=this.configContext?.reportValidityAfterScoring===!0;e.processResponse(!0,n)}}}render(){return b`<slot></slot>`}#m(t){if(this.#o=t.detail,this.#s.clear(),!this.qtiContext.QTI_CONTEXT?.testIdentifier){let n=this.qtiContext.QTI_CONTEXT||{testIdentifier:"",candidateIdentifier:"not set",environmentIdentifier:"default"};this.#r({QTI_CONTEXT:{...n,testIdentifier:this.#o.identifier,environmentIdentifier:n.environmentIdentifier||"default"}})}this.#o.querySelectorAll('qti-context-declaration[identifier="QTI_CONTEXT"]').forEach(n=>{let i=this.#h(n);Object.keys(i).length>0&&this.#r({QTI_CONTEXT:{...i,...this.qtiContext.QTI_CONTEXT}})});let r=Array.from(this.#o?.querySelectorAll("qti-test-part")||[]);this.computedContext={identifier:this.#o.identifier,title:this.#o.title,view:this._sessionContext?.view,testParts:r.map(n=>{let i=[...n.querySelectorAll("qti-assessment-section")],s=n.querySelector(":scope > qti-item-session-control"),a=s?s.allowSkipping:!0,l=s?s.maxAttempts:1,c=s?s.showFeedback:!1,d=s?s.showSolution:!1;return{active:!1,identifier:n.identifier,navigationMode:n.navigationMode,submissionMode:n.submissionMode,allowSkipping:a,sections:i.map(h=>{let f=[...h.querySelectorAll("qti-assessment-item-ref")],m=h.querySelector(":scope > qti-item-session-control"),v=m?m.allowSkipping:a,x=m?m.maxAttempts:l,u=m?m.showFeedback:c,g=m?m.showSolution:d;return{active:!1,identifier:h.identifier,title:h.title,navigationMode:h.navigationMode,submissionMode:h.submissionMode,allowSkipping:v,items:f.map(y=>{let w=y.querySelector(":scope > qti-item-session-control"),I=w?w.allowSkipping:v,A=w?w.maxAttempts:x,k=w?w.showFeedback:u,S=w?w.showSolution:g;return{...this.initContext?.find(R=>R.identifier===y.identifier),active:!1,identifier:y.identifier,categories:y.category?y.category?.split(" "):[],href:y.href,variables:[],allowSkipping:I,maxAttempts:A,showFeedback:k,showSolution:S}})}})}})}}#h(t){let e={},r=t.querySelector("qti-default-value");return r&&r.querySelectorAll("qti-value[field-identifier]").forEach(i=>{let s=i.getAttribute("field-identifier"),a=i.getAttribute("base-type")||"string",l=i.textContent?.trim()||"";if(s){let c=l;switch(a){case"integer":c=parseInt(l,10);break;case"float":case"duration":c=parseFloat(l);break;case"boolean":c=l.toLowerCase()==="true";break;default:c=l;break}e[s]=c}}),e}#f(t){let e=t.detail;this.computedContext={...this.computedContext,testParts:this.computedContext.testParts.map(r=>({...r,sections:r.sections.map(n=>({...n,items:n.items.map(i=>{if(i.identifier!==e.parentElement.getAttribute("identifier"))return i;let a=e.querySelector("qti-outcome-declaration[identifier='SCORE']")?.getAttribute("externalScored"),l=e.querySelectorAll("qti-response-declaration"),c=Array.from(l).some(m=>m.querySelector("qti-correct-response")),d=Array.from(l).some(m=>{let v=m.querySelector("qti-mapping"),x=m.querySelector("qti-area-mapping");return v?.querySelector("qti-map-entry")||x?.querySelector("qti-area-map-entry")}),h=c||d,f=!!e.querySelector("qti-response-processing");return{...i,assessmentItemIdentifier:e.getAttribute("identifier"),label:e.getAttribute("label"),title:e.title,externalScored:a,adaptive:e.adaptive=="true"||!1,timeDependent:e.timeDependent=="true"||!1,variables:e.variables,hasCorrectResponse:h,hasResponseProcessing:f}})}))}))}}willUpdate(t){if(!this.computedContext)return;let e=1;this.computedContext={...this.computedContext,view:this._sessionContext?.view,testParts:this.computedContext.testParts.map(r=>({...r,active:this._sessionContext?.navPartId===r.identifier||!1,sections:r.sections.map(n=>({...n,active:this._sessionContext?.navSectionId===n.identifier||!1,completed:n.items.every(i=>this._testContext.items.find(s=>s.identifier===i.identifier)?.variables.find(s=>s.identifier==="completionStatus").value==="completed"),items:n.items.map(i=>{let s=this._testContext?.items.find(k=>k.identifier===i.identifier),a={...i,...s,...this.initContext?.find(k=>k.identifier===i.identifier)},l=a.variables?.find(k=>k.identifier=="SCORE")?.value,c=l==null?null:parseFloat(l?.toString()),d=a.variables?.find(k=>k.identifier==="completionStatus")?.value,h=a.variables?.find(k=>k.identifier==="RESPONSE")?.value||"",f=Number(a.variables?.find(k=>k.identifier==="numAttempts")?.value)||0,m=this._sessionContext?.navItemRefId===a.identifier||!1,v=s?.valid??!0,u=(s?.variables?.filter(k=>k.type==="response")||[]).every(k=>{if(k.value===void 0||k.value===null)return!0;let S;switch(k.baseType){case"integer":case"float":case"duration":S="0";break;case"boolean":S="false";break;default:S="";break}let R=k.defaultValue??S;if(Array.isArray(k.value)){let N=Array.isArray(R)?R:[R];return k.value.length===N.length&&k.value.every((V,$)=>V===N[$])}return k.value===R}),g=i.categories.includes(this.configContext?.infoItemCategory)?null:e++,y=i.variables?.find(k=>k.identifier=="MAXSCORE")?.value,w=y==null?null:parseFloat(y?.toString()),I=this.#s.get(a.identifier);I===void 0&&(I=s?this.#b(s):"unscored",f>0&&this.#s.set(a.identifier,I));let A=this.#g(f,I,a.maxAttempts);return{...a,completionStatus:d,numAttempts:f,score:c,response:h,index:g,active:m,valid:v,isDefaultResponse:u,maxScore:w,done:A,optimal:this.#s.get(a.identifier)==="optimal"}})}))}))},this.dispatchEvent(new CustomEvent("qti-computed-context-updated",{detail:this.computedContext,bubbles:!0}))}#g(t,e,r){if(t===0)return!1;if(e!=="suboptimal")return!0;let n=r??1;return n>0&&t>=n}#b(t){let e=t.variables??[],r=this.#u(e,"SCORE"),n=this.#u(e,"MAXSCORE");if(r!==null&&n!==null)return r>=n?"optimal":"suboptimal";let i=e.filter(a=>a.type==="response"&&a.correctResponse!==void 0&&a.correctResponse!==null);return i.length===0?"unscored":i.every(a=>{let l=a.correctResponse,c=a.value;return c==null?!1:Array.isArray(l)&&Array.isArray(c)?l.length===c.length&&l.every(d=>c.includes(d)):Array.isArray(l)||Array.isArray(c)?!1:l===c})?"optimal":"suboptimal"}#u(t,e){let r=t?.find(i=>i.identifier===e)?.value;if(r==null||Array.isArray(r))return null;let n=parseFloat(r.toString());return Number.isNaN(n)?null:n}};sr([p({type:String})],gt.prototype,"identifier",void 0);sr([T()],gt.prototype,"initContext",void 0);sr([T(),_({context:qt,subscribe:!0})],gt.prototype,"configContext",void 0);sr([T(),_({context:at,subscribe:!0})],gt.prototype,"_testContext",void 0);sr([T(),_({context:Qt,subscribe:!0})],gt.prototype,"_sessionContext",void 0);sr([T(),U({context:j})],gt.prototype,"computedContext",void 0);sr([p({type:Boolean,attribute:"auto-score-items"})],gt.prototype,"autoScoreItems",void 0);var gl=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},ar=class extends C{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=q`
6491
+ `}};var li=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},fm=()=>({QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}}),gt=class extends C{get qtiContext(){return this.#n()?.qtiContext??(this.#t??=fm())}set qtiContext(t){this.#e||(this.#e=!0,console.warn("[qti-components] `test-navigation.qtiContext` is deprecated and will be removed in the next major release. Set `qtiContext` on `<qti-test>` instead; it is the same value.")),this.#i(t)}#t;#e;#i(t){let e=this.#n();e?e.qtiContext=t:this.#t=t}#r;#n(){return this.#r.value??null}#o;#s;constructor(){super(),this.identifier=void 0,this.initContext=[],this.#e=!1,this.#r=new wt(this,{context:St,subscribe:!0,callback:t=>{t&&this.#t&&(t.qtiContext=this.#t,this.#t=void 0)}}),this.configContext={},this.autoScoreItems=!1,this.#s=new Map,J(this,"cito-test-loaded",this.#m.bind(this)),this.addEventListener("qti-assessment-item-connected",this.#f.bind(this)),ud(this,"cito-item-response-changed",this.#d.bind(this)),this.addEventListener("qti-item-context-updated",this.#a.bind(this)),J(this,"cito-test-end-attempt",this.#p.bind(this)),J(this,"cito-test-update-outcome",this.#l.bind(this))}#a(t){if(!t.detail?.responseProcessed)return;let e=t.detail.itemContext;if(!e?.identifier)return;let i=this.#b(e);this.#s.set(e.identifier,i);let n=this.computedItemFor(e.identifier),r=Number(e.variables?.find(a=>a.identifier==="numAttempts")?.value)||0,s=e.variables?.find(a=>a.identifier==="completionStatus")?.value;this.afterAttemptEnded(t.composedPath()[0]?.closest("qti-assessment-item"),n,this.#g(r,i,n?.maxAttempts,n?.adaptive,s))}afterAttemptEnded(t,e,i){}computedItemFor(t){return this.computedContext?.testParts?.flatMap(e=>e.sections).flatMap(e=>e.items).find(e=>e.identifier===t)}#c(t){return t?this.#o?.querySelector(`qti-assessment-item-ref[identifier="${t}"]`)?.assessmentItem??void 0:void 0}get activeAssessmentItem(){if(!(!this.#o||!this._sessionContext?.navItemRefId))return this.#o.querySelector(`qti-assessment-item-ref[identifier="${this._sessionContext.navItemRefId}"]`)?.assessmentItem}#p(t){let e=this.activeAssessmentItem;if(!e)return;let i=this.configContext?.reportValidityAfterScoring===!0;e.processResponse(!0,i)}#l(t){let e=this.#c(t.detail?.assessmentItemRefId);e&&e.setOutcomeVariable(t.detail.outcomeVariableId,t.detail.value)}#d(t){if(this.autoScoreItems){let e=t.composedPath()[0].closest("qti-assessment-item");if(!e)return;let i=e.variables.find(n=>n.identifier==="SCORE");if(i&&i.externalScored===null&&e.adaptive==="false"){let n=this.configContext?.reportValidityAfterScoring===!0;e.processResponse(!0,n)}}}render(){return b`<slot></slot>`}#m(t){if(this.#o=t.detail,this.#s.clear(),!this.qtiContext.QTI_CONTEXT?.testIdentifier){let n=this.qtiContext.QTI_CONTEXT||{testIdentifier:"",candidateIdentifier:"not set",environmentIdentifier:"default"};this.#i({QTI_CONTEXT:{...n,testIdentifier:this.#o.identifier,environmentIdentifier:n.environmentIdentifier||"default"}})}this.#o.querySelectorAll('qti-context-declaration[identifier="QTI_CONTEXT"]').forEach(n=>{let r=this.#h(n);Object.keys(r).length>0&&this.#i({QTI_CONTEXT:{...r,...this.qtiContext.QTI_CONTEXT}})});let i=Array.from(this.#o?.querySelectorAll("qti-test-part")||[]);this.computedContext={identifier:this.#o.identifier,title:this.#o.title,view:this._sessionContext?.view,testParts:i.map(n=>{let r=[...n.querySelectorAll("qti-assessment-section")],s=n.querySelector(":scope > qti-item-session-control"),a=s?s.allowSkipping:!0,l=s?s.maxAttempts:1,c=s?s.showFeedback:!1,d=s?s.showSolution:!1;return{active:!1,identifier:n.identifier,navigationMode:n.navigationMode,submissionMode:n.submissionMode,allowSkipping:a,sections:r.map(h=>{let f=[...h.querySelectorAll("qti-assessment-item-ref")],m=h.querySelector(":scope > qti-item-session-control"),v=m?m.allowSkipping:a,x=m?m.maxAttempts:l,u=m?m.showFeedback:c,g=m?m.showSolution:d;return{active:!1,identifier:h.identifier,title:h.title,navigationMode:h.navigationMode,submissionMode:h.submissionMode,allowSkipping:v,items:f.map(y=>{let w=y.querySelector(":scope > qti-item-session-control"),A=w?w.allowSkipping:v,I=w?w.maxAttempts:x,k=w?w.showFeedback:u,S=w?w.showSolution:g;return{...this.initContext?.find(R=>R.identifier===y.identifier),active:!1,identifier:y.identifier,categories:y.category?y.category?.split(" "):[],href:y.href,variables:[],allowSkipping:A,maxAttempts:I,showFeedback:k,showSolution:S}})}})}})}}#h(t){let e={},i=t.querySelector("qti-default-value");return i&&i.querySelectorAll("qti-value[field-identifier]").forEach(r=>{let s=r.getAttribute("field-identifier"),a=r.getAttribute("base-type")||"string",l=r.textContent?.trim()||"";if(s){let c=l;switch(a){case"integer":c=parseInt(l,10);break;case"float":case"duration":c=parseFloat(l);break;case"boolean":c=l.toLowerCase()==="true";break;default:c=l;break}e[s]=c}}),e}#f(t){let e=t.detail;this.computedContext={...this.computedContext,testParts:this.computedContext.testParts.map(i=>({...i,sections:i.sections.map(n=>({...n,items:n.items.map(r=>{if(r.identifier!==e.parentElement.getAttribute("identifier"))return r;let a=e.querySelector("qti-outcome-declaration[identifier='SCORE']")?.getAttribute("externalScored"),l=e.querySelectorAll("qti-response-declaration"),c=Array.from(l).some(m=>m.querySelector("qti-correct-response")),d=Array.from(l).some(m=>{let v=m.querySelector("qti-mapping"),x=m.querySelector("qti-area-mapping");return v?.querySelector("qti-map-entry")||x?.querySelector("qti-area-map-entry")}),h=c||d,f=!!e.querySelector("qti-response-processing");return{...r,assessmentItemIdentifier:e.getAttribute("identifier"),label:e.getAttribute("label"),title:e.title,externalScored:a,adaptive:e.adaptive=="true"||!1,timeDependent:e.timeDependent=="true"||!1,variables:e.variables,hasCorrectResponse:h,hasResponseProcessing:f}})}))}))}}willUpdate(t){if(!this.computedContext)return;let e=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(r=>this._testContext.items.find(s=>s.identifier===r.identifier)?.variables.find(s=>s.identifier==="completionStatus").value==="completed"),items:n.items.map(r=>{let s=this._testContext?.items.find(k=>k.identifier===r.identifier),a={...r,...s,...this.initContext?.find(k=>k.identifier===r.identifier)},l=a.variables?.find(k=>k.identifier=="SCORE")?.value,c=l==null?null:parseFloat(l?.toString()),d=a.variables?.find(k=>k.identifier==="completionStatus")?.value,h=a.variables?.find(k=>k.identifier==="RESPONSE")?.value||"",f=Number(a.variables?.find(k=>k.identifier==="numAttempts")?.value)||0,m=this._sessionContext?.navItemRefId===a.identifier||!1,v=s?.valid??!0,u=(s?.variables?.filter(k=>k.type==="response")||[]).every(k=>{if(k.value===void 0||k.value===null)return!0;let S;switch(k.baseType){case"integer":case"float":case"duration":S="0";break;case"boolean":S="false";break;default:S="";break}let R=k.defaultValue??S;if(Array.isArray(k.value)){let N=Array.isArray(R)?R:[R];return k.value.length===N.length&&k.value.every((z,$)=>z===N[$])}return k.value===R}),g=r.categories.includes(this.configContext?.infoItemCategory)?null:e++,y=r.variables?.find(k=>k.identifier=="MAXSCORE")?.value,w=y==null?null:parseFloat(y?.toString()),A=this.#s.get(a.identifier);A===void 0&&(A=s?this.#b(s):"unscored",f>0&&this.#s.set(a.identifier,A));let I=this.#g(f,A,a.maxAttempts,a.adaptive,d);return{...a,completionStatus:d,numAttempts:f,score:c,response:h,index:g,active:m,valid:v,isDefaultResponse:u,maxScore:w,done:I,optimal:this.#s.get(a.identifier)==="optimal"}})}))}))},this.dispatchEvent(new CustomEvent("qti-computed-context-updated",{detail:this.computedContext,bubbles:!0}))}#g(t,e,i,n,r){if(t===0)return!1;if(n)return r==="completed";if(e!=="suboptimal")return!0;let s=i??1;return s>0&&t>=s}#b(t){let e=t.variables??[],i=this.#u(e,"SCORE"),n=this.#u(e,"MAXSCORE");if(i!==null&&n!==null)return i>=n?"optimal":"suboptimal";let r=e.filter(a=>a.type==="response"&&a.correctResponse!==void 0&&a.correctResponse!==null);return r.length===0?"unscored":r.every(a=>{let l=a.correctResponse,c=a.value;return c==null?!1:Array.isArray(l)&&Array.isArray(c)?l.length===c.length&&l.every(d=>c.includes(d)):Array.isArray(l)||Array.isArray(c)?!1:l===c})?"optimal":"suboptimal"}#u(t,e){let i=t?.find(r=>r.identifier===e)?.value;if(i==null||Array.isArray(i))return null;let n=parseFloat(i.toString());return Number.isNaN(n)?null:n}};li([p({type:String})],gt.prototype,"identifier",void 0);li([T()],gt.prototype,"initContext",void 0);li([T(),_({context:qt,subscribe:!0})],gt.prototype,"configContext",void 0);li([T(),_({context:at,subscribe:!0})],gt.prototype,"_testContext",void 0);li([T(),_({context:Xt,subscribe:!0})],gt.prototype,"_sessionContext",void 0);li([T(),U({context:j})],gt.prototype,"computedContext",void 0);li([p({type:Boolean,attribute:"auto-score-items"})],gt.prototype,"autoScoreItems",void 0);var ql=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},ci=class extends C{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=q`
6484
6492
  :host {
6485
6493
  ${lt};
6486
6494
  }
@@ -6493,7 +6501,7 @@ div.full-correct-response-inline {
6493
6501
  :host([disabled]) {
6494
6502
  ${ht};
6495
6503
  }
6496
- `}#t;constructor(){super(),this._internalDisabled=!0,this.#t=this.attachInternals(),this.#t.role="button",this.#t.ariaLabel="Next item",this.addEventListener("click",t=>{t.preventDefault(),this._internalDisabled||this._requestItem(this.sectionItems[this.itemIndex+1].identifier)})}connectedCallback(){super.connectedCallback(),this.checkDisabled()}willUpdate(t){if(!this.computedContext)return;let e=this.computedContext?.testParts.find(r=>r.active);e&&(this.sectionItems=e.sections.flatMap(r=>r.items),this.itemIndex=this.sectionItems.findIndex(r=>r.active),this.checkDisabled())}checkDisabled(){let t=this.computedContext?.testParts.find(a=>a.active);if(!t)return;let e=t.sections.find(a=>a.active),r=e?.navigationMode||t.navigationMode,n=e?.submissionMode||t.submissionMode,i=this.sectionItems[this.itemIndex],s=r==="linear"&&n==="individual";this._internalDisabled=!this.computedContext||this.itemIndex<0||this.itemIndex>=(this.sectionItems?.length??0)-1||s&&!i?.done}_requestItem(t){z(this,"cito-test-navigate",{type:"item",id:t})}render(){return b`<slot></slot>`}};gl([p({type:Boolean,reflect:!0,attribute:"disabled"})],ar.prototype,"_internalDisabled",void 0);gl([_({context:j,subscribe:!0})],ar.prototype,"computedContext",void 0);gl([L("computedContext")],ar.prototype,"_handleTestElementChange",null);var im=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Qi=class extends C{#t;createRenderRoot(){return this}constructor(){super(),this.#t=this.attachInternals(),this.#t.ariaLabel="pagination"}connectedCallback(){super.connectedCallback();let t=this.querySelector("template");this.myTemplate=xt(t)}render(){if(!this.computedContext)return b``;let t=this.computedContext.testParts.flatMap(e=>e.sections.flatMap(r=>r.items));return b` ${t.map(e=>this.myTemplate({item:e,view:this.computedContext.view}))} `}};im([_({context:j,subscribe:!0})],Qi.prototype,"computedContext",void 0);var bl=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},lr=class extends C{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=q`
6504
+ `}#t;constructor(){super(),this._internalDisabled=!0,this.#t=this.attachInternals(),this.#t.role="button",this.#t.ariaLabel="Next item",this.addEventListener("click",t=>{t.preventDefault(),this._internalDisabled||this._requestItem(this.sectionItems[this.itemIndex+1].identifier)})}connectedCallback(){super.connectedCallback(),this.checkDisabled()}willUpdate(t){if(!this.computedContext)return;let e=this.computedContext?.testParts.find(i=>i.active);e&&(this.sectionItems=e.sections.flatMap(i=>i.items),this.itemIndex=this.sectionItems.findIndex(i=>i.active),this.checkDisabled())}checkDisabled(){let t=this.computedContext?.testParts.find(a=>a.active);if(!t)return;let e=t.sections.find(a=>a.active),i=e?.navigationMode||t.navigationMode,n=e?.submissionMode||t.submissionMode,r=this.sectionItems[this.itemIndex],s=i==="linear"&&n==="individual";this._internalDisabled=!this.computedContext||this.itemIndex<0||this.itemIndex>=(this.sectionItems?.length??0)-1||s&&!r?.done}_requestItem(t){V(this,"cito-test-navigate",{type:"item",id:t})}render(){return b`<slot></slot>`}};ql([p({type:Boolean,reflect:!0,attribute:"disabled"})],ci.prototype,"_internalDisabled",void 0);ql([_({context:j,subscribe:!0})],ci.prototype,"computedContext",void 0);ql([L("computedContext")],ci.prototype,"_handleTestElementChange",null);var gm=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},Yr=class extends C{#t;createRenderRoot(){return this}constructor(){super(),this.#t=this.attachInternals(),this.#t.ariaLabel="pagination"}connectedCallback(){super.connectedCallback();let t=this.querySelector("template");this.myTemplate=xt(t)}render(){if(!this.computedContext)return b``;let t=this.computedContext.testParts.flatMap(e=>e.sections.flatMap(i=>i.items));return b` ${t.map(e=>this.myTemplate({item:e,view:this.computedContext.view}))} `}};gm([_({context:j,subscribe:!0})],Yr.prototype,"computedContext",void 0);var Cl=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},di=class extends C{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=q`
6497
6505
  :host {
6498
6506
  ${lt};
6499
6507
  }
@@ -6506,7 +6514,7 @@ div.full-correct-response-inline {
6506
6514
  :host([disabled]) {
6507
6515
  ${ht};
6508
6516
  }
6509
- `}constructor(){super(),this._internalDisabled=!0,this.addEventListener("click",t=>{t.preventDefault(),this._internalDisabled||this._requestItem(this.sectionItems[this.itemIndex-1].identifier)})}willUpdate(t){if(!this.computedContext)return;let e=this.computedContext?.testParts.find(r=>r.active);e&&(this.sectionItems=e.sections.flatMap(r=>r.items),this.itemIndex=this.sectionItems.findIndex(r=>r.active),this.checkDisabled())}checkDisabled(){let t=this.computedContext?.testParts.find(n=>n.active),r=t?.sections.find(n=>n.active)?.navigationMode||t?.navigationMode||"nonlinear";this._internalDisabled=r==="linear"||!this.computedContext||this.itemIndex===0||this.itemIndex===-1}_requestItem(t){z(this,"cito-test-navigate",{type:"item",id:t})}render(){return b`<slot></slot>`}};bl([p({type:Boolean,reflect:!0,attribute:"disabled"})],lr.prototype,"_internalDisabled",void 0);bl([_({context:j,subscribe:!0})],lr.prototype,"computedContext",void 0);bl([L("computedContext")],lr.prototype,"_handleTestElementChange",null);var nm=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Gi=class extends C{render(){return b` <small><pre>${JSON.stringify(this.computedContext,null,2)}</pre></small> `}};nm([T(),_({context:j,subscribe:!0})],Gi.prototype,"computedContext",void 0);var om=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Xi=class extends C{static{this.styles=q`
6517
+ `}constructor(){super(),this._internalDisabled=!0,this.addEventListener("click",t=>{t.preventDefault(),this._internalDisabled||this._requestItem(this.sectionItems[this.itemIndex-1].identifier)})}willUpdate(t){if(!this.computedContext)return;let e=this.computedContext?.testParts.find(i=>i.active);e&&(this.sectionItems=e.sections.flatMap(i=>i.items),this.itemIndex=this.sectionItems.findIndex(i=>i.active),this.checkDisabled())}checkDisabled(){let t=this.computedContext?.testParts.find(n=>n.active),i=t?.sections.find(n=>n.active)?.navigationMode||t?.navigationMode||"nonlinear";this._internalDisabled=i==="linear"||!this.computedContext||this.itemIndex===0||this.itemIndex===-1}_requestItem(t){V(this,"cito-test-navigate",{type:"item",id:t})}render(){return b`<slot></slot>`}};Cl([p({type:Boolean,reflect:!0,attribute:"disabled"})],di.prototype,"_internalDisabled",void 0);Cl([_({context:j,subscribe:!0})],di.prototype,"computedContext",void 0);Cl([L("computedContext")],di.prototype,"_handleTestElementChange",null);var bm=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},Kr=class extends C{render(){return b` <small><pre>${JSON.stringify(this.computedContext,null,2)}</pre></small> `}};bm([T(),_({context:j,subscribe:!0})],Kr.prototype,"computedContext",void 0);var ym=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},Jr=class extends C{static{this.styles=q`
6510
6518
  table {
6511
6519
  width: 100%;
6512
6520
  border-collapse: collapse;
@@ -6527,7 +6535,7 @@ div.full-correct-response-inline {
6527
6535
  margin-top: 20px;
6528
6536
  font-size: 16px;
6529
6537
  }
6530
- `}render(){let t=this.computedContext?.testParts.flatMap(i=>i.sections.flatMap(s=>s.items)).find(i=>i.active);if(!t||!t.variables)return b``;let e=t.variables.filter(i=>i.type==="response"),r=t.variables.filter(i=>i.type==="outcome"),n=(i,s)=>b`
6538
+ `}render(){let t=this.computedContext?.testParts.flatMap(r=>r.sections.flatMap(s=>s.items)).find(r=>r.active);if(!t||!t.variables)return b``;let e=t.variables.filter(r=>r.type==="response"),i=t.variables.filter(r=>r.type==="outcome"),n=(r,s)=>b`
6531
6539
  <h3>${s}</h3>
6532
6540
  <table>
6533
6541
  <thead>
@@ -6540,7 +6548,7 @@ div.full-correct-response-inline {
6540
6548
  </tr>
6541
6549
  </thead>
6542
6550
  <tbody>
6543
- ${i.map(a=>{let l=a.correctResponse?Array.isArray(a.correctResponse)?a.correctResponse.join(", "):a.correctResponse:"",c=a.mapping?.mapEntries?.map(h=>`${h.mapKey}=${h.mappedValue}pt`).join(", ")||"",d=a.areaMapping?.areaMapEntries?.map(h=>`${h.shape}(${h.coords})=${h.mappedValue}pt`).join(", ")||"";return b`
6551
+ ${r.map(a=>{let l=a.correctResponse?Array.isArray(a.correctResponse)?a.correctResponse.join(", "):a.correctResponse:"",c=a.mapping?.mapEntries?.map(h=>`${h.mapKey}=${h.mappedValue}pt`).join(", ")||"",d=a.areaMapping?.areaMapEntries?.map(h=>`${h.shape}(${h.coords})=${h.mappedValue}pt`).join(", ")||"";return b`
6544
6552
  <tr>
6545
6553
  <td>${a.identifier}</td>
6546
6554
  <td>${Array.isArray(a.value)?a.value.join(", "):a.value}</td>
@@ -6552,8 +6560,8 @@ div.full-correct-response-inline {
6552
6560
  </tbody>
6553
6561
  </table>
6554
6562
  `;return b`
6555
- ${n(e,"Response Variables")} ${n(r,"Outcome Variables")}
6556
- `}};om([_({context:j,subscribe:!0})],Xi.prototype,"computedContext",void 0);var yl=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},cr=class extends C{createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let t=this.querySelector("template");if(!t){this.myTemplate=null;return}this.myTemplate=xt(t)}#t(t){let n=(this.computedContext?.testParts.find(i=>i.active)).sections.flatMap(i=>i.items).find(i=>i.active)?.identifier;z(this,"cito-test-update-outcome",{assessmentItemRefId:n,outcomeVariableId:"SCORE",value:t})}render(){let t=this.computedContext?.testParts.flatMap(a=>a.sections.flatMap(l=>l.items)).find(a=>a.active);if(!t||!t.variables)return b``;let e=t.variables.find(a=>a.identifier=="MAXSCORE")?.value,r=t.variables.find(a=>a.identifier=="SCORE"),n=r?.value,i=r?.externalScored!=="human";if(!e||!r)return O;let s=[...Array(Number(e)+1).keys()];return b`${this.myTemplate?this.myTemplate({scores:s,score:n,disabled:i}):O}`}constructor(){super(),this.view="",this.disabled=!1,this.myTemplate=null,this.addEventListener("click",t=>{let e=t.target,r=parseFloat(e.value);e.tagName==="INPUT"&&this.#t(r)})}};yl([p({type:String,attribute:"view"})],cr.prototype,"view",void 0);yl([p({type:Boolean})],cr.prototype,"disabled",void 0);yl([_({context:j,subscribe:!0})],cr.prototype,"computedContext",void 0);var Kd=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Ur=class extends C{constructor(){super(...arguments),this.view=null}render(){let t=this.computedContext?.testParts.flatMap(a=>a.sections.flatMap(l=>l.items)).find(a=>a.active);if(!t||!t.variables)return b``;if(t.category==="dep-informational")return b`<div>${this.dataset.informational}</div>`;let e=t?.variables.find(a=>a.identifier==="completionStatus")?.value,r=t?.variables.find(a=>a.identifier=="SCORE"),n=parseFloat(r?.value),i=t.externalScored;return b`<div>${e!=="completed"?this.dataset.textNoResponse:!i&&n!==void 0&&!Number.isNaN(n)?n>0?this.dataset.textCorrect:this.dataset.textIncorrect:i==="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.`:i==="human"?Number.isNaN(n)?"":"Deze score heb je zelf toegekend.":this.dataset.inProgress}</div>`}};Kd([_({context:j,subscribe:!0})],Ur.prototype,"computedContext",void 0);Kd([p({type:String,attribute:"view"})],Ur.prototype,"view",void 0);var sm=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Yi=class extends C{#t;createRenderRoot(){return this}constructor(){super(),this.#t=this.attachInternals(),this.#t.ariaLabel="pagination"}connectedCallback(){super.connectedCallback();let t=this.querySelector("template");this.myTemplate=xt(t)}render(){if(!this.computedContext)return b``;let t=this.computedContext.testParts.flatMap(e=>e.sections);return b` ${t.map(e=>this.myTemplate({item:e}))} `}};sm([_({context:j,subscribe:!0})],Yi.prototype,"computedContext",void 0);var am=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Ki=class extends C{static{this.styles=q`
6563
+ ${n(e,"Response Variables")} ${n(i,"Outcome Variables")}
6564
+ `}};ym([_({context:j,subscribe:!0})],Jr.prototype,"computedContext",void 0);var Sl=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},hi=class extends C{createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let t=this.querySelector("template");if(!t){this.myTemplate=null;return}this.myTemplate=xt(t)}#t(t){let n=(this.computedContext?.testParts.find(r=>r.active)).sections.flatMap(r=>r.items).find(r=>r.active)?.identifier;V(this,"cito-test-update-outcome",{assessmentItemRefId:n,outcomeVariableId:"SCORE",value:t})}render(){let t=this.computedContext?.testParts.flatMap(a=>a.sections.flatMap(l=>l.items)).find(a=>a.active);if(!t||!t.variables)return b``;let e=t.variables.find(a=>a.identifier=="MAXSCORE")?.value,i=t.variables.find(a=>a.identifier=="SCORE"),n=i?.value,r=i?.externalScored!=="human";if(!e||!i)return O;let s=[...Array(Number(e)+1).keys()];return b`${this.myTemplate?this.myTemplate({scores:s,score:n,disabled:r}):O}`}constructor(){super(),this.view="",this.disabled=!1,this.myTemplate=null,this.addEventListener("click",t=>{let e=t.target,i=parseFloat(e.value);e.tagName==="INPUT"&&this.#t(i)})}};Sl([p({type:String,attribute:"view"})],hi.prototype,"view",void 0);Sl([p({type:Boolean})],hi.prototype,"disabled",void 0);Sl([_({context:j,subscribe:!0})],hi.prototype,"computedContext",void 0);var ah=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},Wi=class extends C{constructor(){super(...arguments),this.view=null}render(){let t=this.computedContext?.testParts.flatMap(a=>a.sections.flatMap(l=>l.items)).find(a=>a.active);if(!t||!t.variables)return b``;if(t.category==="dep-informational")return b`<div>${this.dataset.informational}</div>`;let e=t?.variables.find(a=>a.identifier==="completionStatus")?.value,i=t?.variables.find(a=>a.identifier=="SCORE"),n=parseFloat(i?.value),r=t.externalScored;return b`<div>${e!=="completed"?this.dataset.textNoResponse:!r&&n!==void 0&&!Number.isNaN(n)?n>0?this.dataset.textCorrect:this.dataset.textIncorrect:r==="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.`:r==="human"?Number.isNaN(n)?"":"Deze score heb je zelf toegekend.":this.dataset.inProgress}</div>`}};ah([_({context:j,subscribe:!0})],Wi.prototype,"computedContext",void 0);ah([p({type:String,attribute:"view"})],Wi.prototype,"view",void 0);var vm=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},Zr=class extends C{#t;createRenderRoot(){return this}constructor(){super(),this.#t=this.attachInternals(),this.#t.ariaLabel="pagination"}connectedCallback(){super.connectedCallback();let t=this.querySelector("template");this.myTemplate=xt(t)}render(){if(!this.computedContext)return b``;let t=this.computedContext.testParts.flatMap(e=>e.sections);return b` ${t.map(e=>this.myTemplate({item:e}))} `}};vm([_({context:j,subscribe:!0})],Zr.prototype,"computedContext",void 0);var wm=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},tn=class extends C{static{this.styles=q`
6557
6565
  :host {
6558
6566
  ${lt};
6559
6567
  }
@@ -6566,8 +6574,8 @@ div.full-correct-response-inline {
6566
6574
  :host([disabled]) {
6567
6575
  ${ht};
6568
6576
  }
6569
- `}#t(t){z(this,"cito-test-navigate",{type:"section",id:t})}constructor(){super(),this.sectionId=null,this.addEventListener("click",()=>this.#t(this.sectionId))}render(){return b` <slot></slot> `}};am([p({type:String,attribute:"section-id"})],Ki.prototype,"sectionId",void 0);var vl=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},dr=class extends C{constructor(){super(...arguments),this.debug=!1,this.stampContext={view:"candidate",activeItem:{},activeSection:{items:[]},activeTestpart:{items:[],sections:[]},test:{}}}createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let t=this.querySelector("template");if(!t){this.myTemplate=null;return}this.myTemplate=xt(t)}willUpdate(t){if(!this.computedContext)return;let e=this.computedContext.testParts.find(h=>h.active),r=e?.sections.find(h=>h.active),n=r?.items.find(h=>h.active),{variables:i,...s}=n||{};if(!e||!r||!n)return;let a={...e,items:e.sections.flatMap(h=>h.items.map(({variables:f,...m})=>m)),sections:e.sections.map(h=>({...h,items:h.items.map(({variables:f,...m})=>m)}))},l={...r,items:r.items.map(({variables:h,...f})=>f)},{testParts:c,...d}=this.computedContext;this.stampContext={view:this.computedContext.view,activeItem:s,activeSection:l,activeTestpart:a,test:d},this.dispatchEvent(new CustomEvent("qti-stamp-context-updated",{detail:this.stampContext,bubbles:!0}))}render(){return b` ${this.debug?b`<small><pre>${JSON.stringify(this.stampContext,null,2)}</pre></small>`:O}
6570
- ${this.myTemplate?this.myTemplate(this.stampContext):O}`}};vl([p({type:Boolean,reflect:!0})],dr.prototype,"debug",void 0);vl([T(),_({context:j,subscribe:!0})],dr.prototype,"computedContext",void 0);vl([T()],dr.prototype,"stampContext",void 0);var Ji=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Po,Jt=class extends C{constructor(){super(...arguments),this.label="view",this._handleViewOptionsChange=()=>{this.#t()},this._viewOptions=Po.DEFAULT_VIEW_OPTIONS}static{this.DEFAULT_VIEW_OPTIONS=["author","candidate","proctor","scorer","testConstructor","tutor"]}connectedCallback(){super.connectedCallback(),this.#t()}#t(){if(this.viewOptions){let t=this.viewOptions.split(",").map(e=>e.trim());this._viewOptions=t.filter(e=>Po.DEFAULT_VIEW_OPTIONS.includes(e))}else this._viewOptions=Po.DEFAULT_VIEW_OPTIONS}_switchView(t){z(this,"cito-test-switch-view",t)}render(){return b`
6577
+ `}#t(t){V(this,"cito-test-navigate",{type:"section",id:t})}constructor(){super(),this.sectionId=null,this.addEventListener("click",()=>this.#t(this.sectionId))}render(){return b` <slot></slot> `}};wm([p({type:String,attribute:"section-id"})],tn.prototype,"sectionId",void 0);var kl=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},pi=class extends C{constructor(){super(...arguments),this.debug=!1,this.stampContext={view:"candidate",activeItem:{},activeSection:{items:[]},activeTestpart:{items:[],sections:[]},test:{}}}createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let t=this.querySelector("template");if(!t){this.myTemplate=null;return}this.myTemplate=xt(t)}willUpdate(t){if(!this.computedContext)return;let e=this.computedContext.testParts.find(h=>h.active),i=e?.sections.find(h=>h.active),n=i?.items.find(h=>h.active),{variables:r,...s}=n||{};if(!e||!i||!n)return;let a={...e,items:e.sections.flatMap(h=>h.items.map(({variables:f,...m})=>m)),sections:e.sections.map(h=>({...h,items:h.items.map(({variables:f,...m})=>m)}))},l={...i,items:i.items.map(({variables:h,...f})=>f)},{testParts:c,...d}=this.computedContext;this.stampContext={view:this.computedContext.view,activeItem:s,activeSection:l,activeTestpart:a,test:d},this.dispatchEvent(new CustomEvent("qti-stamp-context-updated",{detail:this.stampContext,bubbles:!0}))}render(){return b` ${this.debug?b`<small><pre>${JSON.stringify(this.stampContext,null,2)}</pre></small>`:O}
6578
+ ${this.myTemplate?this.myTemplate(this.stampContext):O}`}};kl([p({type:Boolean,reflect:!0})],pi.prototype,"debug",void 0);kl([T(),_({context:j,subscribe:!0})],pi.prototype,"computedContext",void 0);kl([T()],pi.prototype,"stampContext",void 0);var en=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},Lo,Zt=class extends C{constructor(){super(...arguments),this.label="view",this._handleViewOptionsChange=()=>{this.#t()},this._viewOptions=Lo.DEFAULT_VIEW_OPTIONS}static{this.DEFAULT_VIEW_OPTIONS=["author","candidate","proctor","scorer","testConstructor","tutor"]}connectedCallback(){super.connectedCallback(),this.#t()}#t(){if(this.viewOptions){let t=this.viewOptions.split(",").map(e=>e.trim());this._viewOptions=t.filter(e=>Lo.DEFAULT_VIEW_OPTIONS.includes(e))}else this._viewOptions=Lo.DEFAULT_VIEW_OPTIONS}_switchView(t){V(this,"cito-test-switch-view",t)}render(){return b`
6571
6579
  <label part="label" for="viewSelect">${this.label}</label>
6572
6580
  <select
6573
6581
  part="select"
@@ -6576,11 +6584,11 @@ div.full-correct-response-inline {
6576
6584
  >
6577
6585
  ${this._viewOptions.map(t=>b`<option value="${t}" ?selected=${t===this.sessionContext.view}>${t}</option>`)}
6578
6586
  </select>
6579
- `}};Po=Jt;Ji([_({context:Qt,subscribe:!0})],Jt.prototype,"sessionContext",void 0);Ji([p({type:String})],Jt.prototype,"label",void 0);Ji([p({type:String,attribute:"view-options"})],Jt.prototype,"viewOptions",void 0);Ji([L("viewOptions",{waitUntilFirstUpdate:!0})],Jt.prototype,"_handleViewOptionsChange",void 0);Ji([T()],Jt.prototype,"_viewOptions",void 0);var lm=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Zi=class extends C{createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let t=this.querySelector("template");if(!t){this.myTemplate=null;return}this.myTemplate=xt(t)}_switchView(t){z(this,"cito-test-switch-view",t)}firstUpdated(t){this.addEventListener("click",()=>{this.sessionContext?.view==="scorer"?this._switchView("candidate"):this._switchView("scorer")})}render(){return b`${this.myTemplate?this.myTemplate({view:this.sessionContext?.view}):O}`}};lm([_({context:Qt,subscribe:!0})],Zi.prototype,"sessionContext",void 0);var Jd=[{tag:"qti-assessment-item-ref",ctor:kt},{tag:"qti-assessment-section",ctor:Et},{tag:"qti-assessment-test",ctor:Ze},{tag:"qti-item-session-control",ctor:Mt},{tag:"qti-number-selected",ctor:Yn},{tag:"qti-outcome-processing",ctor:Kn},{tag:"qti-test",ctor:_e},{tag:"qti-test-feedback",ctor:fo},{tag:"qti-test-part",ctor:Ie},{tag:"qti-test-variables",ctor:Ui},{tag:"test-check-item",ctor:ir},{tag:"test-container",ctor:At},{tag:"test-end-attempt",ctor:nr},{tag:"test-item-link",ctor:Hi},{tag:"test-item-to-speech",ctor:Pe},{tag:"test-navigation",ctor:gt},{tag:"test-next",ctor:ar},{tag:"test-paging-buttons-stamp",ctor:Qi},{tag:"test-prev",ctor:lr},{tag:"test-print-context",ctor:Gi},{tag:"test-print-item-variables",ctor:Xi},{tag:"test-scoring-buttons",ctor:cr},{tag:"test-scoring-feedback",ctor:Ur},{tag:"test-section-buttons-stamp",ctor:Yi},{tag:"test-section-link",ctor:Ki},{tag:"test-stamp",ctor:dr},{tag:"test-tts-next",ctor:To},{tag:"test-tts-pause",ctor:Eo},{tag:"test-tts-pick",ctor:Ro},{tag:"test-tts-play",ctor:Wi},{tag:"test-tts-prev",ctor:_o},{tag:"test-tts-resume",ctor:Ao},{tag:"test-tts-stop",ctor:Io},{tag:"test-view",ctor:Jt},{tag:"test-view-toggle",ctor:Zi}];for(let{tag:o,ctor:t}of Jd)customElements.get(o)||customElements.define(o,t);var hr=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},$t=class extends C{constructor(){super(...arguments),this.customElementRegistry=null,this.itemURL=null,this.itemDoc=null,this.itemXML=null,this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},this.#t=null,this.#e=null}#t;#e;createRenderRoot(){let t=this.customElementRegistry;return this.#e=t,this.shadowRoot??this.attachShadow({...this.constructor.shadowRootOptions,...t?{customElementRegistry:t}:{}})}async handleItemURLChange(){if(this.itemURL)try{let t=this.qtiContext?.QTI_CONTEXT?.seed,e=(await Kt().load(this.itemURL)).shuffleInteractions(t);this.itemDoc=e.htmlDoc(this.#e??void 0)}catch(t){console.error("Error loading or parsing XML:",t)}}handleItemXMLChange(){if(this.itemXML)try{this.itemDoc=Kt().parse(this.itemXML).htmlDoc(this.#e??void 0)}catch(t){console.error("Error parsing XML:",t)}}async connectedCallback(){super.connectedCallback(),this.#r(),this.#i(),this.itemURL&&this.handleItemURLChange(),this.itemXML&&this.handleItemXMLChange()}#r(){let t=this.querySelector("template");this.#t=t?t.content:b``}#i(){let t=new CSSStyleSheet;t.replaceSync(qo),this.shadowRoot.adoptedStyleSheets=[t]}render(){return b`
6587
+ `}};Lo=Zt;en([_({context:Xt,subscribe:!0})],Zt.prototype,"sessionContext",void 0);en([p({type:String})],Zt.prototype,"label",void 0);en([p({type:String,attribute:"view-options"})],Zt.prototype,"viewOptions",void 0);en([L("viewOptions",{waitUntilFirstUpdate:!0})],Zt.prototype,"_handleViewOptionsChange",void 0);en([T()],Zt.prototype,"_viewOptions",void 0);var xm=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},rn=class extends C{createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let t=this.querySelector("template");if(!t){this.myTemplate=null;return}this.myTemplate=xt(t)}_switchView(t){V(this,"cito-test-switch-view",t)}firstUpdated(t){this.addEventListener("click",()=>{this.sessionContext?.view==="scorer"?this._switchView("candidate"):this._switchView("scorer")})}render(){return b`${this.myTemplate?this.myTemplate({view:this.sessionContext?.view}):O}`}};xm([_({context:Xt,subscribe:!0})],rn.prototype,"sessionContext",void 0);var lh=[{tag:"qti-assessment-item-ref",ctor:kt},{tag:"qti-assessment-section",ctor:Et},{tag:"qti-assessment-test",ctor:ei},{tag:"qti-branch-rule",ctor:ce},{tag:"qti-item-session-control",ctor:Mt},{tag:"qti-number-selected",ctor:to},{tag:"qti-outcome-processing",ctor:io},{tag:"qti-pre-condition",ctor:eo},{tag:"qti-test",ctor:Re},{tag:"qti-test-feedback",ctor:wo},{tag:"qti-test-part",ctor:Te},{tag:"qti-test-variables",ctor:Wr},{tag:"test-check-item",ctor:oi},{tag:"test-container",ctor:It},{tag:"test-end-attempt",ctor:si},{tag:"test-item-link",ctor:Xr},{tag:"test-item-to-speech",ctor:Me},{tag:"test-navigation",ctor:gt},{tag:"test-next",ctor:ci},{tag:"test-paging-buttons-stamp",ctor:Yr},{tag:"test-prev",ctor:di},{tag:"test-print-context",ctor:Kr},{tag:"test-print-item-variables",ctor:Jr},{tag:"test-scoring-buttons",ctor:hi},{tag:"test-scoring-feedback",ctor:Wi},{tag:"test-section-buttons-stamp",ctor:Zr},{tag:"test-section-link",ctor:tn},{tag:"test-stamp",ctor:pi},{tag:"test-tts-next",ctor:No},{tag:"test-tts-pause",ctor:Po},{tag:"test-tts-pick",ctor:$o},{tag:"test-tts-play",ctor:Gr},{tag:"test-tts-prev",ctor:Do},{tag:"test-tts-resume",ctor:Oo},{tag:"test-tts-stop",ctor:Mo},{tag:"test-view",ctor:Zt},{tag:"test-view-toggle",ctor:rn}];for(let{tag:o,ctor:t}of lh)customElements.get(o)||customElements.define(o,t);var ui=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},Lt=class extends C{constructor(){super(...arguments),this.customElementRegistry=null,this.itemURL=null,this.itemDoc=null,this.itemXML=null,this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},this.#t=null,this.#e=null}#t;#e;createRenderRoot(){let t=this.customElementRegistry;return this.#e=t,this.shadowRoot??this.attachShadow({...this.constructor.shadowRootOptions,...t?{customElementRegistry:t}:{}})}async handleItemURLChange(){if(this.itemURL)try{let t=this.qtiContext?.QTI_CONTEXT?.seed,e=(await Jt().load(this.itemURL)).shuffleInteractions(t);this.itemDoc=e.htmlDoc(this.#e??void 0)}catch(t){console.error("Error loading or parsing XML:",t)}}handleItemXMLChange(){if(this.itemXML)try{this.itemDoc=Jt().parse(this.itemXML).htmlDoc(this.#e??void 0)}catch(t){console.error("Error parsing XML:",t)}}async connectedCallback(){super.connectedCallback(),this.#i(),this.#r(),this.itemURL&&this.handleItemURLChange(),this.itemXML&&this.handleItemXMLChange()}#i(){let t=this.querySelector("template");this.#t=t?t.content:b``}#r(){let t=new CSSStyleSheet;t.replaceSync(Ao),this.shadowRoot.adoptedStyleSheets=[t]}render(){return b`
6580
6588
  ${this.#t}
6581
6589
  <slot></slot>
6582
- ${xo(this.itemDoc,b`<span>Loading...</span>`)}
6583
- `}};hr([p({attribute:!1})],$t.prototype,"customElementRegistry",void 0);hr([p({type:String,attribute:"item-url"})],$t.prototype,"itemURL",void 0);hr([T()],$t.prototype,"itemDoc",void 0);hr([T()],$t.prototype,"itemXML",void 0);hr([T(),_({context:Ct,subscribe:!0})],$t.prototype,"qtiContext",void 0);hr([L("itemURL",{waitUntilFirstUpdate:!0})],$t.prototype,"handleItemURLChange",null);hr([L("itemXML",{waitUntilFirstUpdate:!0})],$t.prototype,"handleItemXMLChange",null);var cm=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},tn=class extends C{static{this.styles=q`
6590
+ ${Io(this.itemDoc,b`<span>Loading...</span>`)}
6591
+ `}};ui([p({attribute:!1})],Lt.prototype,"customElementRegistry",void 0);ui([p({type:String,attribute:"item-url"})],Lt.prototype,"itemURL",void 0);ui([T()],Lt.prototype,"itemDoc",void 0);ui([T()],Lt.prototype,"itemXML",void 0);ui([T(),_({context:Ct,subscribe:!0})],Lt.prototype,"qtiContext",void 0);ui([L("itemURL",{waitUntilFirstUpdate:!0})],Lt.prototype,"handleItemURLChange",null);ui([L("itemXML",{waitUntilFirstUpdate:!0})],Lt.prototype,"handleItemXMLChange",null);var qm=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},nn=class extends C{static{this.styles=q`
6584
6592
  table {
6585
6593
  width: 100%;
6586
6594
  border-collapse: collapse;
@@ -6601,7 +6609,7 @@ div.full-correct-response-inline {
6601
6609
  margin-top: 20px;
6602
6610
  font-size: 16px;
6603
6611
  }
6604
- `}render(){let t=this.computedContext;if(!t||!t.variables)return b``;let e=t.variables.filter(i=>i.type==="response"),r=t.variables.filter(i=>i.type==="outcome"),n=(i,s)=>b`
6612
+ `}render(){let t=this.computedContext;if(!t||!t.variables)return b``;let e=t.variables.filter(r=>r.type==="response"),i=t.variables.filter(r=>r.type==="outcome"),n=(r,s)=>b`
6605
6613
  <h3>${s}</h3>
6606
6614
  <table>
6607
6615
  <thead>
@@ -6614,7 +6622,7 @@ div.full-correct-response-inline {
6614
6622
  </tr>
6615
6623
  </thead>
6616
6624
  <tbody>
6617
- ${i.map(a=>{let l=a.correctResponse?Array.isArray(a.correctResponse)?a.correctResponse.join(", "):a.correctResponse:"",c=a.mapping?.mapEntries?.map(h=>`${h.mapKey}=${h.mappedValue}pt`).join(", ")||"",d=a.areaMapping?.areaMapEntries?.map(h=>`${h.shape}(${h.coords})=${h.mappedValue}pt`).join(", ")||"";return b`
6625
+ ${r.map(a=>{let l=a.correctResponse?Array.isArray(a.correctResponse)?a.correctResponse.join(", "):a.correctResponse:"",c=a.mapping?.mapEntries?.map(h=>`${h.mapKey}=${h.mappedValue}pt`).join(", ")||"",d=a.areaMapping?.areaMapEntries?.map(h=>`${h.shape}(${h.coords})=${h.mappedValue}pt`).join(", ")||"";return b`
6618
6626
  <tr>
6619
6627
  <td>${a.identifier}</td>
6620
6628
  <td>${Array.isArray(a.value)?a.value.join(", "):a.value}</td>
@@ -6626,8 +6634,8 @@ div.full-correct-response-inline {
6626
6634
  </tbody>
6627
6635
  </table>
6628
6636
  `;return b`
6629
- ${n(e,"Response Variables")} ${n(r,"Outcome Variables")}
6630
- `}};cm([_({context:xe,subscribe:!0})],tn.prototype,"computedContext",void 0);var dm=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Zd=o=>{class t extends o{#t;constructor(...r){super(...r),this.view="candidate",this.addEventListener("qti-assessment-item-connected",n=>{this.#t=n.detail,this.#e()}),this.addEventListener("item-switch-view",n=>{this.view=n.detail})}willUpdate(r){super.willUpdate(r),r.has("view")&&this.#e()}#e(){let r=this.#t;r&&(r.querySelectorAll("[view]").forEach(n=>{n.classList.toggle("show",n.getAttribute("view")===this.view)}),this.updateAssessmentItemView(r,this.view))}updateAssessmentItemView(r,n){}}return dm([p({type:String})],t.prototype,"view",void 0),t};var wl=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},he=class extends Zd(C){#t;#e;constructor(){super(),this.configContext={},this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},this.#t=this.#r.bind(this),this.#e=this.#i.bind(this),this.addEventListener("qti-item-context-updated",this.#t),this.addEventListener("qti-assessment-item-connected",this.#e)}#r(t){this.#n(t.detail.itemContext.identifier,t.detail?.itemContext?.variables||[])}#i(t){let e=t.detail._context.variables;this.assessmentItem=t.detail,this.computedContext=this.computedContext?.identifier===this.assessmentItem.identifier?{...this.computedContext,title:this.assessmentItem.title}:{identifier:this.assessmentItem.identifier,title:this.assessmentItem.title,adaptive:this.assessmentItem.getAttribute("adaptive")?.toLowerCase()==="true"||!1,variables:e},this.#n(this.assessmentItem.identifier,e||[])}#n(t,e){let r=e?.find(c=>c.identifier=="SCORE")?.value,n=parseFloat(r?.toString()),i=e?.find(c=>c.identifier==="completionStatus")?.value,s=n!==void 0&&!isNaN(n)&&n>0,a=n!==void 0&&!isNaN(n)&&n<=0,l=i==="completed";this.computedContext={...this.computedContext,identifier:t,correct:s,incorrect:a,completed:l,variables:e}}render(){return b`<slot></slot>`}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-item-context-changed",this.#t),this.removeEventListener("qti-assessment-item-connected",this.#e)}};wl([T(),U({context:xe})],he.prototype,"computedContext",void 0);wl([T(),U({context:qt})],he.prototype,"configContext",void 0);wl([T(),U({context:Ct})],he.prototype,"qtiContext",void 0);var th=[{tag:"item-container",ctor:$t},{tag:"item-print-variables",ctor:tn},{tag:"qti-item",ctor:he}];for(let{tag:o,ctor:t}of th)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Vd)customElements.get(o)||customElements.define(o,t);var eh=(o,t,e)=>{let r=new Map;for(let n=t;n<=e;n++)r.set(o[n],n);return r},W=Dt(class extends ke{constructor(o){if(super(o),o.type!==Fr.CHILD)throw Error("repeat() can only be used in text expressions")}dt(o,t,e){let r;e===void 0?e=t:t!==void 0&&(r=t);let n=[],i=[],s=0;for(let a of o)n[s]=r?r(a,s):s,i[s]=e(a,s),s++;return{values:i,keys:n}}render(o,t,e){return this.dt(o,t,e).values}update(o,[t,e,r]){let n=$d(o),{values:i,keys:s}=this.dt(t,e,r);if(!Array.isArray(n))return this.ut=s,i;let a=this.ut??=[],l=[],c,d,h=0,f=n.length-1,m=0,v=i.length-1;for(;h<=f&&m<=v;)if(n[h]===null)h++;else if(n[f]===null)f--;else if(a[h]===s[m])l[m]=Ee(n[h],i[m]),h++,m++;else if(a[f]===s[v])l[v]=Ee(n[f],i[v]),f--,v--;else if(a[h]===s[v])l[v]=Ee(n[h],i[v]),Br(o,l[v+1],n[h]),h++,v--;else if(a[f]===s[m])l[m]=Ee(n[f],i[m]),Br(o,n[h],n[f]),f--,m++;else if(c===void 0&&(c=eh(s,m,v),d=eh(a,h,f)),c.has(a[h]))if(c.has(a[f])){let x=d.get(s[m]),u=x!==void 0?n[x]:null;if(u===null){let g=Br(o,n[h]);Ee(g,i[m]),l[m]=g}else l[m]=Ee(u,i[m]),Br(o,n[h],u),n[x]=null;m++}else co(n[f]),f--;else co(n[h]),h++;for(;m<=v;){let x=Br(o,l[v+1]);Ee(x,i[m]),l[m++]=x}for(;h<=f;){let x=n[h++];x!==null&&co(x)}return this.ut=s,Nd(o,l),it}});var Oe=Symbol("dragDropContext");var rh=[P,Gt,q`
6637
+ ${n(e,"Response Variables")} ${n(i,"Outcome Variables")}
6638
+ `}};qm([_({context:Ce,subscribe:!0})],nn.prototype,"computedContext",void 0);var Cm=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},ch=o=>{class t extends o{#t;constructor(...i){super(...i),this.view="candidate",this.addEventListener("qti-assessment-item-connected",n=>{this.#t=n.detail,this.#e()}),this.addEventListener("item-switch-view",n=>{this.view=n.detail})}willUpdate(i){super.willUpdate(i),i.has("view")&&this.#e()}#e(){let i=this.#t;i&&(i.querySelectorAll("[view]").forEach(n=>{n.classList.toggle("show",n.getAttribute("view")===this.view)}),this.updateAssessmentItemView(i,this.view))}updateAssessmentItemView(i,n){}}return Cm([p({type:String})],t.prototype,"view",void 0),t};var El=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},ue=class extends ch(C){#t;#e;constructor(){super(),this.configContext={},this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},this.#t=this.#i.bind(this),this.#e=this.#r.bind(this),this.addEventListener("qti-item-context-updated",this.#t),this.addEventListener("qti-assessment-item-connected",this.#e)}#i(t){this.#n(t.detail.itemContext.identifier,t.detail?.itemContext?.variables||[])}#r(t){let e=t.detail._context.variables;this.assessmentItem=t.detail,this.computedContext=this.computedContext?.identifier===this.assessmentItem.identifier?{...this.computedContext,title:this.assessmentItem.title}:{identifier:this.assessmentItem.identifier,title:this.assessmentItem.title,adaptive:this.assessmentItem.getAttribute("adaptive")?.toLowerCase()==="true"||!1,variables:e},this.#n(this.assessmentItem.identifier,e||[])}#n(t,e){let i=e?.find(c=>c.identifier=="SCORE")?.value,n=parseFloat(i?.toString()),r=e?.find(c=>c.identifier==="completionStatus")?.value,s=n!==void 0&&!isNaN(n)&&n>0,a=n!==void 0&&!isNaN(n)&&n<=0,l=r==="completed";this.computedContext={...this.computedContext,identifier:t,correct:s,incorrect:a,completed:l,variables:e}}render(){return b`<slot></slot>`}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-item-context-changed",this.#t),this.removeEventListener("qti-assessment-item-connected",this.#e)}};El([T(),U({context:Ce})],ue.prototype,"computedContext",void 0);El([T(),U({context:qt})],ue.prototype,"configContext",void 0);El([T(),U({context:Ct})],ue.prototype,"qtiContext",void 0);var dh=[{tag:"item-container",ctor:Lt},{tag:"item-print-variables",ctor:nn},{tag:"qti-item",ctor:ue}];for(let{tag:o,ctor:t}of dh)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Wd)customElements.get(o)||customElements.define(o,t);var hh=(o,t,e)=>{let i=new Map;for(let n=t;n<=e;n++)i.set(o[n],n);return i},W=Dt(class extends Ie{constructor(o){if(super(o),o.type!==Ui.CHILD)throw Error("repeat() can only be used in text expressions")}dt(o,t,e){let i;e===void 0?e=t:t!==void 0&&(i=t);let n=[],r=[],s=0;for(let a of o)n[s]=i?i(a,s):s,r[s]=e(a,s),s++;return{values:r,keys:n}}render(o,t,e){return this.dt(o,t,e).values}update(o,[t,e,i]){let n=Ud(o),{values:r,keys:s}=this.dt(t,e,i);if(!Array.isArray(n))return this.ut=s,r;let a=this.ut??=[],l=[],c,d,h=0,f=n.length-1,m=0,v=r.length-1;for(;h<=f&&m<=v;)if(n[h]===null)h++;else if(n[f]===null)f--;else if(a[h]===s[m])l[m]=Ae(n[h],r[m]),h++,m++;else if(a[f]===s[v])l[v]=Ae(n[f],r[v]),f--,v--;else if(a[h]===s[v])l[v]=Ae(n[h],r[v]),Hi(o,l[v+1],n[h]),h++,v--;else if(a[f]===s[m])l[m]=Ae(n[f],r[m]),Hi(o,n[h],n[f]),f--,m++;else if(c===void 0&&(c=hh(s,m,v),d=hh(a,h,f)),c.has(a[h]))if(c.has(a[f])){let x=d.get(s[m]),u=x!==void 0?n[x]:null;if(u===null){let g=Hi(o,n[h]);Ae(g,r[m]),l[m]=g}else l[m]=Ae(u,r[m]),Hi(o,n[h],u),n[x]=null;m++}else fo(n[f]),f--;else fo(n[h]),h++;for(;m<=v;){let x=Hi(o,l[v+1]);Ae(x,r[m]),l[m++]=x}for(;h<=f;){let x=n[h++];x!==null&&fo(x)}return this.ut=s,Bd(o,l),rt}});var De=Symbol("dragDropContext");var ph=[P,Gt,q`
6631
6639
  /* A drop target — see qti-gap.styles.ts. The interaction publishes the chip measurements as
6632
6640
  custom properties on its host; the properties themselves live here. */
6633
6641
  :host {
@@ -6645,9 +6653,9 @@ div.full-correct-response-inline {
6645
6653
  width: 100%;
6646
6654
  height: 100%;
6647
6655
  }
6648
- `];var ih=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Hr=class extends C{constructor(){super(...arguments),this.internals=this.attachInternals(),this.acceptsDeclarativeDrops=!0}static{this.styles=rh}get drags(){return this._dragDrop?.nodesByTarget?.[this.identifier]??[]}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-hotspot",{bubbles:!0,composed:!0,cancelable:!1}))}render(){return b`<div part="drop">
6656
+ `];var uh=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},Qi=class extends C{constructor(){super(...arguments),this.internals=this.attachInternals(),this.acceptsDeclarativeDrops=!0}static{this.styles=ph}get drags(){return this._dragDrop?.nodesByTarget?.[this.identifier]??[]}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-hotspot",{bubbles:!0,composed:!0,cancelable:!1}))}render(){return b`<div part="drop">
6649
6657
  ${W(this.drags,t=>t.getAttribute("identifier"),t=>t)}
6650
- </div>`}};ih([p({type:String,reflect:!0})],Hr.prototype,"identifier",void 0);ih([_({context:Oe,subscribe:!0}),T()],Hr.prototype,"_dragDrop",void 0);var nh=[{tag:"qti-associable-hotspot",ctor:Hr}];var oh=[P,Gt,q`
6658
+ </div>`}};uh([p({type:String,reflect:!0})],Qi.prototype,"identifier",void 0);uh([_({context:De,subscribe:!0}),T()],Qi.prototype,"_dragDrop",void 0);var mh=[{tag:"qti-associable-hotspot",ctor:Qi}];var fh=[P,Gt,q`
6651
6659
  /*
6652
6660
  * A drop target. The interaction measures its chips and publishes the result as custom
6653
6661
  * properties on its own host; the actual CSS properties live here, not in a style attribute.
@@ -6692,9 +6700,9 @@ div.full-correct-response-inline {
6692
6700
  min-height: var(--qti-dropzone-min-height, 0);
6693
6701
  min-width: var(--qti-dropzone-min-width, 0);
6694
6702
  }
6695
- `];var xl=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},pr=class extends C{constructor(){super(...arguments),this.internals=this.attachInternals(),this.acceptsDeclarativeDrops=!0,this.tabindex=0}static{this.styles=oh}get drags(){return this._dragDrop?.nodesByTarget?.[this.identifier]??[]}render(){return b`<div part="drop">
6703
+ `];var Il=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},mi=class extends C{constructor(){super(...arguments),this.internals=this.attachInternals(),this.acceptsDeclarativeDrops=!0,this.tabindex=0}static{this.styles=fh}get drags(){return this._dragDrop?.nodesByTarget?.[this.identifier]??[]}render(){return b`<div part="drop">
6696
6704
  ${W(this.drags,t=>t.getAttribute("identifier"),t=>t)}
6697
- </div>`}};xl([p({type:Number,reflect:!0})],pr.prototype,"tabindex",void 0);xl([p({type:String,reflect:!0})],pr.prototype,"identifier",void 0);xl([_({context:Oe,subscribe:!0}),T()],pr.prototype,"_dragDrop",void 0);var sh=[{tag:"qti-gap",ctor:pr}];var ah=[P,q`
6705
+ </div>`}};Il([p({type:Number,reflect:!0})],mi.prototype,"tabindex",void 0);Il([p({type:String,reflect:!0})],mi.prototype,"identifier",void 0);Il([_({context:De,subscribe:!0}),T()],mi.prototype,"_dragDrop",void 0);var gh=[{tag:"qti-gap",ctor:mi}];var bh=[P,q`
6698
6706
  /* Centred, because a gap-img is a picture inside a drop the same size as it. Was in the theme's
6699
6707
  graphic-gap-match rules, on the host from the document. */
6700
6708
  :host {
@@ -6703,7 +6711,7 @@ div.full-correct-response-inline {
6703
6711
  justify-content: center;
6704
6712
  user-select: none;
6705
6713
  }
6706
- `];var hm=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},en=class extends C{constructor(){super(...arguments),this.tabindex=0,this.internals=this.attachInternals()}static{this.styles=ah}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","drags")}render(){return b`<slot part="label"></slot>`}};hm([p({type:Number,reflect:!0})],en.prototype,"tabindex",void 0);var lh=[{tag:"qti-gap-img",ctor:en}];var ur=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},ch={toAttribute:o=>o?"true":"false",fromAttribute:o=>o==="true"};function It(o,t){class e extends o{#t;#e(){let i=this._interactionContext?.choiceRole??null;i!==this.#t&&(this.#t&&this.internals.states.delete(this.#t),this.#t=i,this.internals.role=i,i&&this.internals.states.add(i))}handleDisabledChange(n,i){i?(this.internals.ariaDisabled="true",this.internals.states.add("disabled"),this.blur()):(this.internals.ariaDisabled=null,this.internals.states.delete("disabled")),this.tabIndex=i?-1:0}handleReadonlyChange(n,i){i?(this.internals.ariaReadOnly="true",this.internals.states.add("readonly")):(this.internals.ariaReadOnly=null,this.internals.states.delete("readonly"))}constructor(...n){super(...n),this.identifier="",this.tabIndex=0,this.disabled=!1,this.readonly=!1,this.#t=null,this.internals=this.attachInternals()}willUpdate(n){super.willUpdate(n),this.#e()}connectedCallback(){super.connectedCallback(),this.internals.ariaChecked="false",this.disabled&&(this.internals.ariaDisabled="true",this.internals.states.add("disabled"),this.tabIndex=-1),this.readonly&&(this.internals.ariaReadOnly="true",this.internals.states.add("readonly")),this.addEventListener("keyup",this._onKeyUp),this.addEventListener("click",this._onClick),this.dispatchEvent(new CustomEvent(`register-${t}`,{bubbles:!0,composed:!0}))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keyup",this._onKeyUp),this.removeEventListener("click",this._onClick),this.dispatchEvent(new CustomEvent(`unregister-${t}`,{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-${t}`,{bubbles:!0,composed:!0,detail:{identifier:this.identifier}}))}render(){return b`<slot></slot>`}}return ur([p({type:String})],e.prototype,"identifier",void 0),ur([p({type:Number,reflect:!0,attribute:"tabindex"})],e.prototype,"tabIndex",void 0),ur([p({type:Boolean,attribute:"aria-disabled",converter:ch})],e.prototype,"disabled",void 0),ur([p({type:Boolean,attribute:"aria-readonly",converter:ch})],e.prototype,"readonly",void 0),ur([_({context:Ar,subscribe:!0}),T()],e.prototype,"_interactionContext",void 0),ur([L("disabled",{waitUntilFirstUpdate:!0})],e.prototype,"handleDisabledChange",null),ur([L("readonly",{waitUntilFirstUpdate:!0})],e.prototype,"handleReadonlyChange",null),e}var dh=[P,q`
6714
+ `];var Sm=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},on=class extends C{constructor(){super(...arguments),this.tabindex=0,this.internals=this.attachInternals()}static{this.styles=bh}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","drags")}render(){return b`<slot part="label"></slot>`}};Sm([p({type:Number,reflect:!0})],on.prototype,"tabindex",void 0);var yh=[{tag:"qti-gap-img",ctor:on}];var fi=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},vh={toAttribute:o=>o?"true":"false",fromAttribute:o=>o==="true"};function At(o,t){class e extends o{#t;#e(){let r=this._interactionContext?.choiceRole??null;r!==this.#t&&(this.#t&&this.internals.states.delete(this.#t),this.#t=r,this.internals.role=r,r&&this.internals.states.add(r))}handleDisabledChange(n,r){r?(this.internals.ariaDisabled="true",this.internals.states.add("disabled"),this.blur()):(this.internals.ariaDisabled=null,this.internals.states.delete("disabled")),this.tabIndex=r?-1:0}handleReadonlyChange(n,r){r?(this.internals.ariaReadOnly="true",this.internals.states.add("readonly")):(this.internals.ariaReadOnly=null,this.internals.states.delete("readonly"))}constructor(...n){super(...n),this.identifier="",this.tabIndex=0,this.disabled=!1,this.readonly=!1,this.#t=null,this.internals=this.attachInternals()}willUpdate(n){super.willUpdate(n),this.#e()}connectedCallback(){super.connectedCallback(),this.internals.ariaChecked="false",this.disabled&&(this.internals.ariaDisabled="true",this.internals.states.add("disabled"),this.tabIndex=-1),this.readonly&&(this.internals.ariaReadOnly="true",this.internals.states.add("readonly")),this.addEventListener("keyup",this._onKeyUp),this.addEventListener("click",this._onClick),this.dispatchEvent(new CustomEvent(`register-${t}`,{bubbles:!0,composed:!0}))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keyup",this._onKeyUp),this.removeEventListener("click",this._onClick),this.dispatchEvent(new CustomEvent(`unregister-${t}`,{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-${t}`,{bubbles:!0,composed:!0,detail:{identifier:this.identifier}}))}render(){return b`<slot></slot>`}}return fi([p({type:String})],e.prototype,"identifier",void 0),fi([p({type:Number,reflect:!0,attribute:"tabindex"})],e.prototype,"tabIndex",void 0),fi([p({type:Boolean,attribute:"aria-disabled",converter:vh})],e.prototype,"disabled",void 0),fi([p({type:Boolean,attribute:"aria-readonly",converter:vh})],e.prototype,"readonly",void 0),fi([_({context:_i,subscribe:!0}),T()],e.prototype,"_interactionContext",void 0),fi([L("disabled",{waitUntilFirstUpdate:!0})],e.prototype,"handleDisabledChange",null),fi([L("readonly",{waitUntilFirstUpdate:!0})],e.prototype,"handleReadonlyChange",null),e}var wh=[P,q`
6707
6715
  /*
6708
6716
  * A chip's own box. Both drag-drop interactions that use this element laid it out from the
6709
6717
  * theme — gap-match with 'display: flex !important; align-items: center !important',
@@ -6746,8 +6754,8 @@ div.full-correct-response-inline {
6746
6754
  align-items: center;
6747
6755
  justify-content: center;
6748
6756
  }
6749
- `];var pm=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Me=class extends It(C,"qti-gap-text"){constructor(){super(...arguments),this.tabindex=0}static{this.styles=dh}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","drags")}render(){return b`<div part="control"></div>
6750
- <slot part="label"></slot>`}};pm([p({type:Number,reflect:!0})],Me.prototype,"tabindex",void 0);var hh=[{tag:"qti-gap-text",ctor:Me}];var ph=[P,q`
6757
+ `];var km=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},Ne=class extends At(C,"qti-gap-text"){constructor(){super(...arguments),this.tabindex=0}static{this.styles=wh}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","drags")}render(){return b`<div part="control"></div>
6758
+ <slot part="label"></slot>`}};km([p({type:Number,reflect:!0})],Ne.prototype,"tabindex",void 0);var xh=[{tag:"qti-gap-text",ctor:Ne}];var qh=[P,q`
6751
6759
  :host {
6752
6760
  display: flex;
6753
6761
  user-select: none;
@@ -6767,7 +6775,7 @@ div.full-correct-response-inline {
6767
6775
  display: grid;
6768
6776
  place-content: center;
6769
6777
  }
6770
- `];var um=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},mr=class extends It(C,"qti-hotspot-choice"){static{this.styles=ph}};um([p({attribute:"aria-ordervalue",type:Number,reflect:!0})],mr.prototype,"order",void 0);var uh=[{tag:"qti-hotspot-choice",ctor:mr}];var mh=[P,q`
6778
+ `];var Em=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},gi=class extends At(C,"qti-hotspot-choice"){static{this.styles=qh}};Em([p({attribute:"aria-ordervalue",type:Number,reflect:!0})],gi.prototype,"order",void 0);var Ch=[{tag:"qti-hotspot-choice",ctor:gi}];var Sh=[P,q`
6771
6779
  /* 'position: relative' is the containing block for the answer-key tick the theme draws as an
6772
6780
  absolutely positioned ::before. See CONTRACT.md §7. */
6773
6781
  :host {
@@ -6787,8 +6795,8 @@ div.full-correct-response-inline {
6787
6795
  [part='control'] {
6788
6796
  display: none;
6789
6797
  }
6790
- `];var fr=class extends It(C,"qti-hottext"){static{this.styles=mh}render(){return b`<div part="control"><div part="control-mark"></div></div>
6791
- <slot part="label"></slot>`}};var fh=[{tag:"qti-hottext",ctor:fr}];var mm=q`
6798
+ `];var bi=class extends At(C,"qti-hottext"){static{this.styles=Sh}render(){return b`<div part="control"><div part="control-mark"></div></div>
6799
+ <slot part="label"></slot>`}};var kh=[{tag:"qti-hottext",ctor:bi}];var Im=q`
6792
6800
  /*
6793
6801
  * An option row: one line, clipped, with its text centred against the row's min-height. All four
6794
6802
  * were in the theme, set on this host from the document — which is also why the 'display: block'
@@ -6805,13 +6813,13 @@ div.full-correct-response-inline {
6805
6813
  slot {
6806
6814
  display: inline;
6807
6815
  }
6808
- `,gh=mm;var fm=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},rn=class extends It(C,"qti-inline-choice"){static{this.styles=gh}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this.#t),this.dispatchEvent(new CustomEvent("qti-inline-choice-register",{bubbles:!0,composed:!0,cancelable:!1}))}disconnectedCallback(){this.removeEventListener("click",this.#t)}render(){return b` <slot></slot> `}#t(){this.dispatchEvent(new CustomEvent("qti-inline-choice-select",{bubbles:!0,cancelable:!1,composed:!0,detail:{identifier:this.identifier}}))}};fm([p({type:String})],rn.prototype,"identifier",void 0);var bh=[{tag:"qti-inline-choice",ctor:rn}];var yh=[P,q`
6816
+ `,Eh=Im;var Am=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},sn=class extends At(C,"qti-inline-choice"){static{this.styles=Eh}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this.#t),this.dispatchEvent(new CustomEvent("qti-inline-choice-register",{bubbles:!0,composed:!0,cancelable:!1}))}disconnectedCallback(){this.removeEventListener("click",this.#t)}render(){return b` <slot></slot> `}#t(){this.dispatchEvent(new CustomEvent("qti-inline-choice-select",{bubbles:!0,cancelable:!1,composed:!0,detail:{identifier:this.identifier}}))}};Am([p({type:String})],sn.prototype,"identifier",void 0);var Ih=[{tag:"qti-inline-choice",ctor:sn}];var Ah=[P,q`
6809
6817
  :host {
6810
6818
  display: block;
6811
6819
  margin: var(--qti-gap) 0;
6812
6820
  width: 100%;
6813
6821
  }
6814
- `];var Oo=class extends C{static{this.styles=yh}render(){return b`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.parentElement?.tagName.endsWith("INTERACTION")&&this.setAttribute("slot","prompt")}};var vh=[{tag:"qti-prompt",ctor:Oo}];var wh=[P,Gt,q`
6822
+ `];var Vo=class extends C{static{this.styles=Ah}render(){return b`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.parentElement?.tagName.endsWith("INTERACTION")&&this.setAttribute("slot","prompt")}};var _h=[{tag:"qti-prompt",ctor:Vo}];var Th=[P,Gt,q`
6815
6823
  /*
6816
6824
  * 'align-items' / 'justify-content' are variables because one caller cannot be reached any other
6817
6825
  * way. In tabular match this element is a light-DOM *grandchild* of the slotted
@@ -6960,13 +6968,13 @@ div.full-correct-response-inline {
6960
6968
  align-items: center;
6961
6969
  justify-content: center;
6962
6970
  }
6963
- `];var Mo=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Lt=class extends It(C,"qti-simple-associable-choice"){constructor(){super(...arguments),this.matchMin=0,this.matchMax=1,this.fixed=!1,this.acceptsDeclarativeDrops=!0}static{this.styles=wh}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-simple-associable-choice")}get drags(){return this._dragDrop?.nodesByTarget?.[this.identifier]??[]}render(){return b`
6971
+ `];var zo=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},Vt=class extends At(C,"qti-simple-associable-choice"){constructor(){super(...arguments),this.matchMin=0,this.matchMax=1,this.fixed=!1,this.acceptsDeclarativeDrops=!0}static{this.styles=Th}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-simple-associable-choice")}get drags(){return this._dragDrop?.nodesByTarget?.[this.identifier]??[]}render(){return b`
6964
6972
  <div part="control"></div>
6965
6973
  <slot part="label"></slot>
6966
6974
  <div part="drop">
6967
6975
  ${W(this.drags,t=>t.getAttribute("identifier"),t=>t)}
6968
6976
  </div>
6969
- `}};Mo([p({type:Number,attribute:"match-min"})],Lt.prototype,"matchMin",void 0);Mo([p({type:Number,attribute:"match-max"})],Lt.prototype,"matchMax",void 0);Mo([p({type:String,attribute:"fixed",converter:{fromAttribute:o=>o==="true",toAttribute:o=>String(o)}})],Lt.prototype,"fixed",void 0);Mo([_({context:Oe,subscribe:!0}),T()],Lt.prototype,"_dragDrop",void 0);var xh=[{tag:"qti-simple-associable-choice",ctor:Lt}];var qh=[P,q`
6977
+ `}};zo([p({type:Number,attribute:"match-min"})],Vt.prototype,"matchMin",void 0);zo([p({type:Number,attribute:"match-max"})],Vt.prototype,"matchMax",void 0);zo([p({type:String,attribute:"fixed",converter:{fromAttribute:o=>o==="true",toAttribute:o=>String(o)}})],Vt.prototype,"fixed",void 0);zo([_({context:De,subscribe:!0}),T()],Vt.prototype,"_dragDrop",void 0);var Rh=[{tag:"qti-simple-associable-choice",ctor:Vt}];var Ph=[P,q`
6970
6978
  /*
6971
6979
  * 'position: relative' unconditionally, because this element can carry a correction badge and a
6972
6980
  * badge needs a containing block. The theme draws the badge as an absolutely positioned ::after
@@ -7002,9 +7010,9 @@ div.full-correct-response-inline {
7002
7010
  align-items: center;
7003
7011
  justify-content: center;
7004
7012
  }
7005
- `];var Do=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Vt=class extends It(C,"qti-simple-choice"){constructor(){super(...arguments),this.templateIdentifier=null,this.showHide="show",this.fixed=!1}static{this.styles=qh}static{this.shadowRootOptions={...C.shadowRootOptions,delegatesFocus:!0}}get checked(){return this.internals.states.has("checked")}render(){return b`<div part="control" tabindex="0"><div part="control-mark"></div></div>
7013
+ `];var jo=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},zt=class extends At(C,"qti-simple-choice"){constructor(){super(...arguments),this.templateIdentifier=null,this.showHide="show",this.fixed=!1}static{this.styles=Ph}static{this.shadowRootOptions={...C.shadowRootOptions,delegatesFocus:!0}}get checked(){return this.internals.states.has("checked")}render(){return b`<div part="control" tabindex="0"><div part="control-mark"></div></div>
7006
7014
  ${this.marker?b`<div id="label" part="marker">${this.marker}</div>`:O}
7007
- <slot part="label"></slot>`}};Do([p({type:String,attribute:"template-identifier"})],Vt.prototype,"templateIdentifier",void 0);Do([p({type:String,attribute:"show-hide"})],Vt.prototype,"showHide",void 0);Do([p({type:Boolean,converter:{fromAttribute:o=>o==="true",toAttribute:o=>String(o)}})],Vt.prototype,"fixed",void 0);Do([p({type:String,attribute:!1})],Vt.prototype,"marker",void 0);var Ch=[{tag:"qti-simple-choice",ctor:Vt}];var Sh=[...nh,...sh,...lh,...hh,...uh,...fh,...bh,...vh,...xh,...Ch];var gm=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i};function bm(o,t,e,r,n={}){let i=n.publishWidth??!0,s=n.hostWindow??(typeof window<"u"?window:null);if(!t.length||!e.length||!s)return;let a=0,l=0,c=r.length?r:[o],d=c.map(h=>({el:h,reservation:h.style.getPropertyValue("--qti-drag-min-width"),hadStyleAttribute:h.hasAttribute("style")}));c.forEach(h=>h.style.setProperty("--qti-drag-min-width","0px")),t.forEach(h=>{let f=h.getBoundingClientRect();a=Math.max(a,f.height),l=Math.max(l,f.width)}),d.forEach(({el:h,reservation:f,hadStyleAttribute:m})=>{f?h.style.setProperty("--qti-drag-min-width",f):h.style.removeProperty("--qti-drag-min-width"),!m&&h.getAttribute("style")===""&&h.removeAttribute("style")}),n.hasChanged?.({height:a,width:l})!==!1&&(o.style.setProperty("--qti-dropzone-min-height",`${a}px`),i&&(o.style.setProperty("--qti-dropzone-min-width",`${l}px`),o.style.setProperty("--qti-drag-min-width",`${l}px`)),r.forEach(h=>{h.style.minHeight=`var(--qti-drag-container-min-height, ${a}px)`,h.style.setProperty("--qti-dropzone-min-height",`${a}px`),i&&(h.style.setProperty("--qti-dropzone-min-width",`${l}px`),h.style.setProperty("--qti-drag-min-width",`${l}px`))}))}var ql=(o,t,e,r='slot[part="drags"]')=>{class n extends o{constructor(){super(...arguments),this.autoSizeDropzones=!0,this.#t=null,this.#e=new Set,this.#r=null,this.#i=0,this.#n=null}get autoSizeDropzoneWidth(){return!0}#t;#e;#r;#i;#n;collectAutoSizeTargets(){let s=(a,l)=>Array.from(l?.querySelectorAll(a)??[]);return{draggables:[...s(t,this),...s(t,this.shadowRoot)],droppables:[...s(e,this),...s(e,this.shadowRoot)],dragContainers:[...s(r,this),...s(r,this.shadowRoot)]}}dropzonePropertyTarget(){return this}updateMinDimensionsForDropZones(){if(!this.autoSizeDropzones)return;let{draggables:s,droppables:a,dragContainers:l}=this.collectAutoSizeTargets();s.length!==0&&(bm(this.dropzonePropertyTarget(),s,a,l,{publishWidth:this.autoSizeDropzoneWidth,hasChanged:c=>{let d=this.#n;return d&&d.height===c.height&&d.width===c.width?!1:(this.#n=c,!0)}}),this.#a(s),this.#o())}#o(){typeof MutationObserver>"u"||this.#r||(this.#r=new MutationObserver(()=>this.#s()),this.#r.observe(this,{childList:!0,subtree:!0,characterData:!0}))}#s(){this.#i||(this.#i=requestAnimationFrame(()=>{this.#i=0,this.updateMinDimensionsForDropZones()}))}#a(s){if(typeof ResizeObserver>"u")return;this.#t??=new ResizeObserver(()=>this.#s());let a=new Set(s);for(let l of this.#e)a.has(l)||this.#t.unobserve(l);for(let l of a)this.#e.has(l)||this.#t.observe(l);this.#e=a}disconnectedCallback(){this.#t?.disconnect(),this.#t=null,this.#e.clear(),this.#r?.disconnect(),this.#r=null,this.#i&&cancelAnimationFrame(this.#i),this.#i=0,super.disconnectedCallback()}}return gm([p({type:Boolean,attribute:"auto-size-dropzones"})],n.prototype,"autoSizeDropzones",void 0),n};var{AbortController:Zt,AbortSignal:Cl,WeakMap:ym,WeakRef:vm,Window:kh,reportError:No=console.log}=globalThis,De=o=>o&&o.defaultView!==null&&o.defaultView.document===o&&(o.defaultView.top===o.defaultView||De(o.defaultView.parent.document)),gr=()=>!!kh&&globalThis instanceof kh,Sl=Symbol("unset"),[Eh,wm]=(()=>{function o(x,u,g=!0){Object.defineProperty(x,u,{...Object.getOwnPropertyDescriptor(x,u),enumerable:g})}let t="try"in Promise?Promise.try.bind(Promise):(x,...u)=>new Promise(g=>g(x(...u))),e="withResolvers"in Promise?Promise.withResolvers.bind(Promise):()=>{let x,u;return{promise:new Promise((y,w)=>(x=y,u=w)),resolve:x,reject:u}};function r(x,u){let g=u.call(x);if(g===null||typeof g!="object")throw new TypeError("Iterator is not an object");return g}let n=new ym,i={next(...x){let u=this,g=n.get(u);if(!g?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.next called on invalid object");let{syncIteratorRecord:y}=g;return t(()=>y.next(...x))},return(...x){let u=this,g=n.get(u);if(!g?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.return called on invalid object");let{syncIteratorRecord:y}=g;return t(()=>y.return?y.return(...x):{value:void 0,done:!0})},throw(...x){let u=this,g=n.get(u);if(!g?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.throw called on invalid object");let{syncIteratorRecord:y}=g;return t(()=>{if(!y.throw)throw y.return(),new TypeError("no throw method");return y.throw(...x)})}};function s(x){let u=Object.create(i);return n.set(u,{syncIteratorRecord:x}),u}function a(x,u){let g;if(u){if(g=x[Symbol.asyncIterator],g==null){if(g=x[Symbol.iterator],g==null)throw new TypeError("Object is not async iterable");let y=r(x,g);return s(y)}}else g=x[Symbol.iterator];if(g==null)throw new TypeError("Object is not iterable");return r(x,g)}let l="any"in Cl?Cl.any.bind(Cl):x=>{let u=new Zt;for(let g of x)if(g.aborted)return u.abort(g.reason),u.signal;for(let g of x)g.addEventListener("abort",()=>{u.abort(g.reason)},{signal:u.signal});return u.signal},c=x=>l(x.filter(Boolean));class d{constructor({next:u,error:g,complete:y}={}){n.set(this,{next:u,error:g,complete:y})}next(u){let{next:g}=n.get(this)||{};g&&g(u)}error(u){let{error:g}=n.get(this)||{};g?g(u):No(u)}complete(){let{complete:u}=n.get(this)||{};u&&u()}}function h(x,u){let g=n.get(x);if(g?.active){g.active=!1,g.subscriptionController.abort(u);for(let y of g.teardowns.reverse()){if(gr()&&!De(document))return;try{y()}catch(w){No(w)}}}}function f(x,u,g={}){if(gr()&&!De(document))return;let y;typeof u=="function"?y=new d({next:u}):u&&!(u instanceof d)?y=new d(u):y=u||new d;let w=n.get(x),I=w.weakSubscriber?.deref();if(I?.active){let k=I,S=n.get(k);S.observers.add(y),g.signal&&(g.signal.aborted?S.observers.delete(y):g.signal.addEventListener("abort",()=>{let R=n.get(k);R?.active&&(R.observers.delete(y),R.observers.size==0&&h(k,g.signal.reason))}));return}let A=new m(y);if(w.weakSubscriber=new vm(A),"signal"in g&&(g.signal.aborted?h(A,g.signal.reason):g.signal.addEventListener("abort",()=>{let k=n.get(A);k?.active&&(k.observers.delete(y),k.observers.size==0&&h(A,g.signal.reason))})),w.subscribeCallback)try{w.subscribeCallback(A)}catch(k){A.error(k)}}class m{get[Symbol.toStringTag](){return"Subscriber"}constructor(u=null){if(!(u instanceof d))throw new TypeError("Illegal constructor");n.set(this,{active:!0,observers:new Set([u]),teardowns:[],subscriptionController:new Zt})}next(u){if(!(this instanceof m))throw new TypeError("illegal invocation");if(!arguments.length)throw new TypeError("too few arguments");let g=n.get(this);if(!g?.active||gr()&&!De(document))return;let y=new Set(g.observers);for(let w of y)w.next(u)}error(u){if(!(this instanceof m))throw new TypeError("illegal invocation");if(!arguments.length)throw new TypeError("too few arguments");let g=n.get(this);if(!g?.active){No(u);return}if(gr()&&!De(document))return;h(this,u);let y=new Set(g.observers);for(let w of y)w.error(u)}complete(){if(!(this instanceof m))throw new TypeError("illegal invocation");let u=n.get(this);if(!u?.active||gr()&&!De(document))return;h(this);let g=new Set(u.observers);for(let y of g)y.complete()}addTeardown(u){if(!(this instanceof m))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");if(gr()&&!De(document))return;let g=n.get(this);g?.active?g.teardowns.push(u):u()}get active(){if(!(this instanceof m))throw new TypeError("illegal invocation");return!!n.get(this)?.active}get signal(){if(!(this instanceof m))throw new TypeError("illegal invocation");if(!n.has(this)){let u=new Zt;return u.abort(),u.signal}return n.get(this).subscriptionController.signal}}o(m.prototype,"next"),o(m.prototype,"error"),o(m.prototype,"complete"),o(m.prototype,"addTeardown"),o(m.prototype,"active"),o(m.prototype,"signal");class v{get[Symbol.toStringTag](){return"Observable"}constructor(u){if(!u)throw new TypeError("1 argument required but 0 present");n.set(this,{weakSubscriber:null,subscribeCallback:u})}static from(u){if(u===null||typeof u!="object")throw new TypeError("Observable.from only accepts objects");if(u instanceof v)return u;if(typeof(Symbol.asyncIterator in u&&u[Symbol.asyncIterator])=="function"){let I=function(A,k){if(A.signal.aborted)return;let S;try{let R=k.next();S=Promise.resolve(R)}catch(R){S=Promise.reject(R)}S.then(R=>{if(R===null||typeof R!="object"){A.error(new TypeError("Not an IteratorResult."));return}try{({done:w}=R)}catch(V){A.error(V);return}if(w){A.complete();return}let N;try{N=R.value}catch(V){A.error(V);return}A.next(N),I(A,k)},R=>{A.error(R)})},w=!1;return new v(A=>{if(A.signal.aborted)return;let k;try{k=a(u,!0)}catch(R){A.error(R);return}let S=k;A.signal.aborted||(A.signal.addEventListener("abort",()=>{if(typeof S.return!="function"||w)return;t(()=>S.return(A.signal.reason)).then(N=>{if(N===null||typeof N!="object")throw new TypeError("Iterator .return() must return an Object")})}),I(A,S))})}if(typeof(Symbol.iterator in u&&u[Symbol.iterator])=="function")return new v(w=>{if(w.signal.aborted)return;let I;try{I=a(u,!1)}catch(S){w.error(S);return}let A=!1,k=I;if(!w.signal.aborted)for(w.signal.addEventListener("abort",()=>{if(typeof k.return!="function"||A)return;let S=k.return();if(S===null||typeof S!="object")throw new TypeError("Iterator .return() must return an Object")});;)try{let S=k.next();if({done:A}=S,A){w.complete();return}if(w.next(S.value),w.signal.aborted)break}catch(S){w.error(S);break}});if(u instanceof Promise||typeof u.then=="function")return new v(w=>{u.then(I=>{w.next(I),w.complete()},I=>{w.error(I)})});throw new TypeError("Could not convert value to Observable")}subscribe(u=null,g={}){if(!(this instanceof v))throw new TypeError("illegal invocation");f(this,u,g)}takeUntil(u){if(!(this instanceof v))throw new TypeError("illegal invocation");let g=this,y=v.from(u);return new v(w=>{let I=new d({next(){w.complete()},error(){w.complete()}}),A={signal:w.signal};if(f(y,I,A),!w.active)return;let k=new d({next(S){w.next(S)},error(S){w.error(S)},complete(){w.complete()}});f(g,k,A)})}map(u){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new v(y=>{let w=0,I=new d({next(k){let S;try{S=u(k,w)}catch(R){y.error(R);return}w+=1,y.next(S)},error(k){y.error(k)},complete(){y.complete()}}),A={signal:y.signal};f(g,I,A)})}inspect(u={}){let g=null,y=null,w=null,I=null,A=null;typeof u=="function"?y=u:u&&typeof u=="object"&&("subscribe"in u&&(g=u.subscribe),"next"in u&&(y=u.next),"error"in u&&(w=u.error),"complete"in u&&(I=u.complete),"abort"in u&&(A=u.abort));let k=this;return new v(S=>{if(g!==null)try{g()}catch($){S.error($);return}let R=()=>{try{A!==null&&A(S.signal.reason)}catch($){No($)}};S.signal.addEventListener("abort",R,{once:!0});let N=new d({next($){if(y!==null)try{y($)}catch(ut){S.signal.removeEventListener("abort",R),S.error(ut);return}S.next($)},error($){if(S.signal.removeEventListener("abort",R),w!==null)try{w($)}catch(ut){S.error(ut);return}S.error($)},complete(){if(S.signal.removeEventListener("abort",R),I!==null)try{I()}catch($){S.error($);return}S.complete()}}),V={signal:S.signal};f(k,N,V)})}filter(u){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new v(y=>{let w=0,I=new d({next(k){let S=!1;try{S=u(k,w)}catch(R){y.error(R);return}w+=1,S&&y.next(k)},error(k){y.error(k)},complete(){y.complete()}}),A={signal:y.signal};f(g,I,A)})}take(u){if(!(this instanceof v))throw new TypeError("illegal invocation");let g=this;return new v(y=>{let w=u;if(w==0)return y.complete();let I=new d({next(k){y.next(k),w-=1,w==0&&y.complete()},error(k){y.error(k)},complete(){y.complete()}}),A={signal:y.signal};f(g,I,A)})}drop(u){if(!(this instanceof v))throw new TypeError("illegal invocation");let g=this;return new v(y=>{let w=u,I=new d({next(k){if(w>0)return w-=1;w==0&&y.next(k)},error(k){y.error(k)},complete(){y.complete()}}),A={signal:y.signal};f(g,I,A)})}flatMap(u){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new v(y=>{let w=0,I=!1,A=[];function k(V){let $;try{$=u(V,w)}catch(re){return y.error(re)}w+=1;let ut;try{ut=v.from($)}catch(re){return y.error(re)}let ya=new d({next(re){y.next(re)},error(re){y.error(re)},complete(){if(A.length){let re=A.shift();k(re)}else S=!1,I&&y.complete()}}),Ut={signal:y.signal};f(ut,ya,Ut)}let S=!1,R=new d({next(V){S?A.push(V):(S=!0,k(V))},error(V){y.error(V)},complete(){I=!0,!S&&!A.length&&y.complete()}}),N={signal:y.signal};f(g,R,N)})}switchMap(u){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new v(y=>{let w=0,I=!1,A=null;function k(N){let V;try{V=u(N,w)}catch(Ut){return y.error(Ut)}w+=1;let $;try{$=v.from(V)}catch(Ut){return y.error(Ut)}let ut=new d({next(Ut){y.next(Ut)},error(Ut){y.error(Ut)},complete(Ut){I?y.complete():A=null}}),ya={signal:c([A.signal,y.signal])};f($,ut,ya)}let S=new d({next(N){A&&A.abort(),A=new Zt,k(N)},error(N){y.error(N)},complete(){I=!0,A||y.complete()}}),R={signal:y.signal};f(g,S,R)})}catch(u){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new v(w=>{let I=new d({next(k){w.next(k)},error(k){let S;try{S=u(k)}catch($){w.error($);return}let R;try{R=v.from(S)}catch($){w.error($);return}let N=new d({next($){w.next($)},error($){w.error($)},complete(){w.complete()}}),V={signal:w.signal};f(R,N,V)},complete(){w.complete()}}),A={signal:w.signal};f(g,I,A)})}finally(u){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new v(y=>{y.addTeardown(u);let w=new d({next(A){y.next(A)},error(A){y.error(A)},complete(){y.complete()}}),I={signal:y.signal};f(g,w,I)})}toArray(u={}){if(!(this instanceof v))throw new TypeError("illegal invocation");let{promise:g,resolve:y,reject:w}=e();if(u.signal){if(u.signal.aborted)return Promise.reject(u.signal.reason);u.signal.addEventListener("abort",()=>{w(u.signal.reason)})}let I=[],A=new d({next(k){I.push(k)},error(k){w(k)},complete(){y(I)}});return f(this,A,u),g}forEach(u,g={}){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:y,resolve:w,reject:I}=e(),A=new Zt,k={signal:c([A.signal,g.signal])};if(k.signal.aborted)return I(k.signal.reason),y;k.signal.addEventListener("abort",()=>{I(k.signal.reason)});let S=0,R=new d({next(N){try{u(N,S)}catch(V){I(V),A.abort(V)}S+=1},error(N){I(N)},complete(){w()}});return f(this,R,k),y}every(u,g={}){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:y,resolve:w,reject:I}=e(),A=new Zt,k={signal:c([A.signal,g.signal])};if(k.signal.aborted)return I(k.signal.reason),y;k.signal.addEventListener("abort",()=>{I(k.signal.reason)});let S=0,R=new d({next(N){let V=!1;try{V=u(N,S)}catch($){I($),A.abort($)}S+=1,V||(w(!1),A.abort())},error(N){I(N)},complete(){w(!0)}});return f(this,R,k),y}first(u={}){if(!(this instanceof v))throw new TypeError("illegal invocation");let{promise:g,resolve:y,reject:w}=e(),I=new Zt,A={signal:c([I.signal,u.signal])};if(A.signal.aborted)return w(A.signal.reason),g;A.signal.addEventListener("abort",()=>{w(A.signal.reason)});let k=new d({next(S){y(S),I.abort()},error(S){w(S)},complete(){w(new RangeError("No values in Observable"))}});return f(this,k,A),g}last(u={}){if(!(this instanceof v))throw new TypeError("illegal invocation");let{promise:g,resolve:y,reject:w}=e();if(u.signal){if(u.signal.aborted)return w(u.signal.reason),g;u.signal.addEventListener("abort",()=>{w(u.signal.reason)})}let I=null,A=!1,k=new d({next(S){A=!0,I=S},error(S){w(S)},complete(){A?y(I):w(new RangeError("No values in Observable"))}});return f(this,k,u),g}find(u,g={}){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:y,resolve:w,reject:I}=e(),A=new Zt,k={signal:c([A.signal,g.signal])};if(k.signal.aborted)return I(k.signal.reason),y;k.signal.addEventListener("abort",()=>{I(k.signal.reason)});let S=0,R=new d({next(N){let V=!1;try{V=u(N,S)}catch($){I($),A.abort($)}S+=1,V&&(w(N),A.abort())},error(N){I(N)},complete(){w()}});return f(this,R,k),y}some(u,g={}){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:y,resolve:w,reject:I}=e(),A=new Zt,k={signal:c([A.signal,g.signal])};if(k.signal.aborted)return I(k.signal.reason),y;k.signal.addEventListener("abort",()=>{I(k.signal.reason)});let S=0,R=new d({next(N){let V=!1;try{V=u(N,S)}catch($){I($),A.abort($)}S+=1,V&&(w(!0),A.abort())},error(N){I(N)},complete(){w(!1)}});return f(this,R,k),y}reduce(u,g,y={}){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:w,resolve:I,reject:A}=e(),k=new Zt,S={signal:c([k.signal,y.signal])};if(S.signal.aborted)return A(S.signal.reason),w;S.signal.addEventListener("abort",()=>{A(S.signal.reason)},{once:!0});let R=0,N=arguments.length>1?g:Sl,V=new d({next($){if(N===Sl){N=$,R++;return}try{let ut=u(N,$,R);R++,N=ut}catch(ut){A(ut),k.abort(ut);return}},error($){A($)},complete(){N!==Sl?I(N):A(new TypeError("no initial value provided and no values emitted"))}});return f(this,V,S),w}}return o(v.prototype,"subscribe"),[v,m]})();function Ah(){return typeof globalThis.Observable=="function"}function Ih(){Object.defineProperties(globalThis,{Observable:{value:Eh,configurable:!0,writable:!0},Subscriber:{value:wm,configurable:!0,writable:!0}}),EventTarget.prototype.when=function(o,t={}){if(gr()&&!De(document))return;let e=this;return new Eh(r=>{if(!e||r.signal.aborted)return;let n=i=>{r.next(i)};e.addEventListener(o,n,{capture:t.capture||!1,passive:t.passive,once:!1,signal:r.signal})})}}function kl(o,t,e){let r=o.filter(n=>!n.hasAttribute("disabled"));for(let n of r){let i=n.getBoundingClientRect();if(t>=i.left&&t<=i.right&&e>=i.top&&e<=i.bottom)return n}return null}function _h(o,t,e,r){if(!r)return null;let n=o.filter(s=>!s.hasAttribute("disabled")),i=r.getBoundingClientRect();for(let s of n){let a=s.getBoundingClientRect();if(!(i.right<a.left||i.left>a.right||i.bottom<a.top||i.top>a.bottom))return s}return null}function Th(o,t,e,r){let n=o.filter(c=>!c.hasAttribute("disabled"));if(n.length===0)return null;let i,s;if(r){let c=r.getBoundingClientRect();i=c.left+c.width/2,s=c.top+c.height/2}else i=t,s=e;let a=null,l=1/0;for(let c of n){let d=c.getBoundingClientRect(),h=d.left+d.width/2,f=d.top+d.height/2,m=Math.sqrt(Math.pow(i-h,2)+Math.pow(s-f,2));m<l&&(l=m,a=c)}return a}function Rh(o,t,e,r){let n=o.filter(l=>!l.hasAttribute("disabled"));if(n.length===0)return null;let i;if(r){let l=r.getBoundingClientRect();i=[{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 i=[{x:t,y:e},{x:t,y:e},{x:t,y:e},{x:t,y:e}];let s=null,a=1/0;for(let l of n){let c=l.getBoundingClientRect(),d=[{x:c.left,y:c.top},{x:c.right,y:c.top},{x:c.left,y:c.bottom},{x:c.right,y:c.bottom}],h=0,f=0;for(let v of i)for(let x of d){let u=Math.sqrt(Math.pow(v.x-x.x,2)+Math.pow(v.y-x.y,2));h+=u,f++}let m=h/f;m<a&&(a=m,s=l)}return s}function xm(o,t,e){let r=o.getBoundingClientRect();return t>=r.left&&t<=r.right&&e>=r.top&&e<=r.bottom}function qm(o,t,e,r,n){let i=n&&n.length>0?o.filter(g=>n.includes(g)):o.filter(g=>g.tagName==="SLOT"&&g.hasAttribute("part")&&g.getAttribute("part")?.includes("drags")),a=o.filter(g=>!i.includes(g));if(i.length===0&&a.length===0)return null;let l;if(r){let g=r.getBoundingClientRect();l=[{x:g.left,y:g.top},{x:g.right,y:g.top},{x:g.left,y:g.bottom},{x:g.right,y:g.bottom}]}else l=[{x:t,y:e},{x:t,y:e},{x:t,y:e},{x:t,y:e}];let c=g=>{let y=g.getBoundingClientRect(),w=[{x:y.left,y:y.top},{x:y.right,y:y.top},{x:y.left,y:y.bottom},{x:y.right,y:y.bottom}],I=0,A=0;for(let k of l)for(let S of w){let R=Math.sqrt(Math.pow(k.x-S.x,2)+Math.pow(k.y-S.y,2));I+=R,A++}return I/A},d=null,h=1/0;for(let g of i){let y=c(g);y<h&&(h=y,d=g)}let f=null,m=1/0;for(let g of a){let y=c(g);y<m&&(m=y,f=g)}if(d&&r){let g=r.getBoundingClientRect(),y=d.getBoundingClientRect(),w=g.left+g.width/2,I=g.top+g.height/2;if(w>=y.left&&w<=y.right&&I>=y.top&&I<=y.bottom)return d}if(f&&xm(f,t,e))return f;let x=r?.getAttribute("data-drag-origin")==="droppable"?.85:1.5;return d&&f?h<=m*x?d:f:d||f}function Ph(o){switch(o){case"pointerWithin":return kl;case"rectangleIntersection":return _h;case"closestCenter":return Th;case"closestCorners":return Rh;case"closestCornersWithInventoryPriority":return qm;default:return kl}}function Wr(o,t,e,r,n="pointerWithin",i){return Ph(n)(o,t,e,r,i)}function Ne(o,t){let e=o.composedPath?o.composedPath():[o.target];for(let r of e)if(r instanceof HTMLElement&&r.tagName!=="SLOT"){if(r.matches(t)||r.hasAttribute("qti-draggable"))return r;let n=r.closest(t)||r.closest('[qti-draggable="true"]');if(n)return n}return null}function nn(o){return o?o.hasAttribute("disabled")?!0:o.internals?.states?.has("disabled")??!1:!1}var El=o=>o?.internals;function zt(o,t,e){let r=El(o)?.states;r&&(e?r.add(t):r.delete(t))}function $o(o,t){return El(o)?.states?.has(t)??!1}function on(o){zt(o,"dragging",!1),zt(o,"placeholder",!1),zt(o,"return-anchor",!1)}function br(o){return $o(o,"dragging")||$o(o,"placeholder")}function pe(o,t,e){if(!o)return;e?o.setAttribute(t,""):o.removeAttribute(t);let r=El(o)?.states;if(r){e?r.add(t):r.delete(t);return}let n=new Set((o.getAttribute("part")??"").split(/\s+/).filter(Boolean));n.has("drop")&&(e?n.add(t):n.delete(t),o.setAttribute("part",[...n].join(" ")))}function Qr(o,t){pe(o,"filled",t)}function Gr(o,t){let e=[];return o.forEach(r=>{let n=[];r.tagName.toLowerCase()==="slot"?n=r.assignedElements({flatten:!0}).filter(a=>a.getAttribute("identifier")===t):n=Array.from(r.querySelectorAll(`[identifier="${t}"]`)),e.push(...n)}),e}function Oh(o,t){let e=o.find(n=>n.getAttribute("identifier")===t);if(!e)return 1;let r=e.getAttribute("match-max");return r?parseInt(r,10)||0:1}var Al={origin:{x:0,y:0},scale:{x:1,y:1}},Lo=100,Cm=o=>{let t=o.fullscreenElement??o.webkitFullscreenElement??null;for(;t instanceof HTMLElement;){let e=t.shadowRoot?.fullscreenElement??null;if(!e||e===t)break;t=e}return t instanceof HTMLElement?t:null},Sm=o=>{let t=o.shadowRoot;return t?t.querySelector("slot:not([name])")?o:t:o},km=(o,t)=>{let e=t;for(;e;){if(e===o)return!0;e=e.parentNode??e.host??null}return!1},Il=(o,t)=>{let e=o.ownerDocument??document,r=t??e.body,n=Cm(e);return n&&!km(n,r)?Sm(n):r},_l=o=>{let e=(o.ownerDocument??document).createElement("div");e.style.cssText=`position:fixed;left:0;top:0;width:${Lo}px;height:${Lo}px;margin:0;padding:0;border:0;visibility:hidden;pointer-events:none;`,o.appendChild(e);let r=e.getBoundingClientRect();return e.remove(),{origin:{x:r.left,y:r.top},scale:{x:r.width/Lo||1,y:r.height/Lo||1}}},Mh=(o,t,e)=>({x:(t-o.origin.x)/o.scale.x,y:(e-o.origin.y)/o.scale.y});Ah()||Ih();var Dh=new WeakSet;function Em(o){!o||Dh.has(o)||(o.addEventListener("touchmove",()=>{},{capture:!1,passive:!1}),Dh.add(o))}var Nh=o=>!!o.internals?.states,Vo=(o,t,e,r='slot[part="drags"]',n="pointerWithin")=>{class i extends o{constructor(){super(...arguments),this.trackedDraggables=[],this.trackedDroppables=[],this.trackedDragContainers=[],this.allDropzones=[],this.collisionDetectionAlgorithm=n,this.dragState={dragging:!1,dragSource:null,dragClone:null,startOffset:{x:0,y:0},currentTarget:null,sourceDroppable:null,inputType:null,returnAnchorItems:[]},this.cloneFrame=Al,this.subscriptions=[],this.dragSubscriptions=[],this.lastPointerDownAt=0,this.lastTouchStartAt=0,this.#t=new Set,this.#e=new Set,this.#r=a=>{let l=a;if(l.context!==Ar)return;let c=l.contextTarget;c instanceof HTMLElement&&this.#e.add(c)}}#t;isDragDropEnabled(){return!0}publishDraggablesSelector(){let a=this.isDragDropEnabled()?t:null;this._interactionContext.draggablesSelector!==a&&(this._interactionContext={...this._interactionContext,draggablesSelector:a})}connectedCallback(){super.connectedCallback(),this.addEventListener("context-request",this.#r,{capture:!0}),Em(this.ownerDocument?.defaultView),this.publishDraggablesSelector(),this.setupDragDrop()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("context-request",this.#r,{capture:!0}),this.#e.clear(),this.cleanup()}async setupDragDrop(){await this.updateComplete,this.cacheInteractiveElements(),this.afterCache(),this.setupDragObservables()}afterCache(){}removeChipFromDroppable(a,l){l.remove()}#e;#r;registeredMatching(a){for(let l of this.#e)l.isConnected||this.#e.delete(l);return[...this.#e].filter(l=>l.matches(a))}cacheInteractiveElements(){let a=(S,R)=>Array.from(R?.querySelectorAll(S)??[]),l=a(t,this),c=a(t,this.shadowRoot),d=a('[qti-draggable="true"]:not([data-drag-clone])',this),h=a('[qti-draggable="true"]:not([data-drag-clone])',this.shadowRoot),f=this.registeredMatching(t);this.trackedDraggables=Array.from(new Set([...l,...c,...d,...h,...f]));let m=a(e,this),v=a(e,this.shadowRoot);this.trackedDroppables=Array.from(new Set([...m,...v]));let x=a(r,this),u=a(r,this.shadowRoot);this.trackedDragContainers=Array.from(new Set([...x,...u])),this.allDropzones=[...this.trackedDroppables,...this.trackedDragContainers];let g=this.isDragDropEnabled(),y=new Set(this.trackedDraggables),w=new Set(this.trackedDroppables),I=g?y:new Set,A=g?w:new Set,k=new Set([...y,...w].filter(Nh));for(let S of this.#t)k.has(S)||(S.internals.states.delete("drag"),S.internals.states.delete("droppable"));for(let S of k){let R=I.has(S),N=!R&&A.has(S);R?S.internals.states.add("drag"):S.internals.states.delete("drag"),N?S.internals.states.add("droppable"):S.internals.states.delete("droppable")}this.#t=k,this.trackedDraggables.forEach(S=>{let R=br(S);g&&!R?(S.style.cursor="grab",S.style.userSelect="none",S.style.touchAction="none",S.style.webkitUserSelect="none",S.style.webkitTouchCallout="none",S.setAttribute("qti-draggable","true"),S.setAttribute("tabindex","0")):(S.style.cursor="",S.style.userSelect="",S.style.touchAction="",S.style.webkitUserSelect="",S.style.webkitTouchCallout="",S.removeAttribute("qti-draggable"),S.getAttribute("tabindex")==="0"&&S.removeAttribute("tabindex"))})}setupDragObservables(){let a=this.shadowRoot;if(!a){console.error("\u274C [Observable DnD] No shadow root found!");return}let l=a.when("pointerdown").filter(m=>{if(!m.isTrusted)return!1;let v=Ne(m,t),x=this.disabled||this.readonly,u=nn(v)||br(v),g=Date.now()-this.lastTouchStartAt<50;return v&&m.isPrimary!==!1&&m.button===0&&!x&&!u&&!g}).subscribe(m=>{this.lastPointerDownAt=Date.now();let v=Ne(m,t);if(!v){console.warn("\u26A0\uFE0F [Observable DnD] No draggable target found");return}m.pointerType==="touch"&&(m.preventDefault(),m.stopPropagation());let x=m.isTrusted?m.pointerType==="touch"?100:10:0;if(this.dragState.activationTimeout&&clearTimeout(this.dragState.activationTimeout),x===0){this.dragState.dragging||this.initiateDrag(v,m.clientX,m.clientY,m.pointerType,"pointer",m.pointerId,m.isTrusted);return}let u=()=>{this.dragState.activationTimeout&&(clearTimeout(this.dragState.activationTimeout),this.dragState.activationTimeout=void 0),document.removeEventListener("pointerup",u,!0),document.removeEventListener("pointercancel",u,!0)};document.addEventListener("pointerup",u,{once:!0,capture:!0}),document.addEventListener("pointercancel",u,{once:!0,capture:!0}),this.dragState.activationTimeout=window.setTimeout(()=>{this.dragState.activationTimeout=void 0,document.removeEventListener("pointerup",u,!0),document.removeEventListener("pointercancel",u,!0),this.dragState.dragging||this.initiateDrag(v,m.clientX,m.clientY,m.pointerType,"pointer",m.pointerId,m.isTrusted)},x)}),c=a.when("mousedown").filter(m=>{let v=Ne(m,t),x=this.disabled||this.readonly,u=nn(v)||br(v),g=m.button===0,y=Date.now()-this.lastPointerDownAt<50;return v&&g&&!x&&!u&&!y}).subscribe(m=>{let v=Ne(m,t);!v||this.dragState.dragging||(m.preventDefault(),this.initiateDrag(v,m.clientX,m.clientY,"mouse","mouse",void 0,m.isTrusted))}),d=a.when("touchstart").filter(m=>{let v=Ne(m,t),x=this.disabled||this.readonly,u=nn(v)||br(v),g=!!(m.touches?.[0]||m.changedTouches?.[0]),y=Date.now()-this.lastPointerDownAt<50;return v&&g&&!x&&!u&&!y}).subscribe(m=>{let v=Ne(m,t),x=m.touches?.[0]||m.changedTouches?.[0];!v||!x||this.dragState.dragging||(this.lastTouchStartAt=Date.now(),m.preventDefault(),m.stopPropagation(),this.initiateDrag(v,x.clientX,x.clientY,"touch","touch",void 0,m.isTrusted))}),h={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null},f=a.when("keydown").subscribe(m=>{let v=this.trackedDraggables.filter(u=>!br(u)),x=[...this.trackedDroppables,...this.trackedDragContainers];if(h.dragging)switch(m.code){case"ArrowRight":case"ArrowDown":{m.preventDefault();let u=(h.dropIndex+1)%x.length;h={...h,dropIndex:u,dropElement:x[u]};break}case"ArrowLeft":case"ArrowUp":{m.preventDefault();let u=(h.dropIndex-1+x.length)%x.length;h={...h,dropIndex:u,dropElement:x[u]};break}case"Space":case"Enter":case"Tab":{m.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(u=>u.removeAttribute("data-keyboard-dragging")),this.saveResponse(),h={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null};break}case"Escape":{m.preventDefault(),this.trackedDraggables.forEach(u=>u.removeAttribute("data-keyboard-dragging")),h={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null};break}}else{let u=Ne(m,t),g=this.disabled||this.readonly,y=nn(u)||br(u);u&&["Space","Enter"].includes(m.code)&&!g&&!y&&(m.preventDefault(),u.setAttribute("data-keyboard-dragging","true"),h={dragging:!0,dragElement:u,dragIndex:v.indexOf(u),dropIndex:0,dropElement:x[0]})}this.allDropzones.forEach(u=>u.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(l,c,d,f)}initiateDrag(a,l,c,d,h="pointer",f,m){if(this.dragState.dragging){console.warn("\u26A0\uFE0F [Observable DnD] Already dragging, ignoring initiateDrag");return}if(a.hasAttribute("data-drag-clone")){console.warn("\u26A0\uFE0F [Observable DnD] Attempted to drag visual clone, ignoring");return}let v=y=>y.contains(a)||!!y.shadowRoot?.contains(a),x=this.trackedDroppables.some(v),u=this.trackedDroppables.find(v)||null;a.getAnimations().forEach(y=>y.cancel());let g=a.getBoundingClientRect();if(this.dragState={dragging:!0,dragSource:a,dragClone:this.createDragClone(a,g),startOffset:{x:l-g.left,y:c-g.top},currentTarget:null,sourceDroppable:u,inputType:d,pointerId:f,startedFromTrustedEvent:m,initialCoordinates:{x:l,y:c},returnAnchorItems:[]},x){this.dragState.dragClone?.setAttribute("data-drag-origin","droppable"),this.removeChipFromDroppable(u,a),this.cacheInteractiveElements(),u&&u.setAttribute("data-drag-source","true");let y=a.getAttribute("identifier");if(y){let w=Gr(this.trackedDragContainers,y);w.forEach(I=>zt(I,"return-anchor",!0)),this.dragState.returnAnchorItems=w}}else this.dragState.dragClone?.setAttribute("data-drag-origin","inventory"),zt(a,"dragging",!0);this.updateClonePosition(l,c),this.activateAllDroppables(),this.watchDragCloneHost(),this.setupMoveObservables(d,h)}setupMoveObservables(a,l="pointer"){if(a==="touch"){if(l==="pointer")try{let w=this.dragState.dragSource,I=this.dragState.pointerId;w&&I!==void 0&&w.setPointerCapture&&w.setPointerCapture(I)}catch{}let g=w=>{w.cancelable&&(w.preventDefault(),l==="pointer"&&w.stopPropagation())};document.addEventListener("touchmove",g,{passive:!1,capture:!0}),document.addEventListener("touchstart",g,{passive:!1,capture:!0}),document.addEventListener("touchend",g,{passive:!1,capture:!0}),document.addEventListener("gesturestart",g,{passive:!1}),document.addEventListener("gesturechange",g,{passive:!1}),document.addEventListener("gestureend",g,{passive:!1});let y=()=>{if(document.removeEventListener("touchmove",g,{capture:!0}),document.removeEventListener("touchstart",g,{capture:!0}),document.removeEventListener("touchend",g,{capture:!0}),document.removeEventListener("gesturestart",g),document.removeEventListener("gesturechange",g),document.removeEventListener("gestureend",g),l==="pointer")try{let w=this.dragState.dragSource,I=this.dragState.pointerId;w&&I!==void 0&&w.releasePointerCapture&&w.releasePointerCapture(I)}catch{}};this.dragState.touchCleanup=y}let c=l==="mouse"?"mousemove":l==="touch"?"touchmove":"pointermove",d=l==="mouse"?"mouseup":l==="touch"?"touchend":"pointerup",h=g=>{let y=this.dragState.startedFromTrustedEvent;return y===void 0||g.isTrusted===y},f=document.when(c).takeUntil(document.when(d)).subscribe({next:g=>{if(h(g)){if(g.preventDefault(),g.stopPropagation(),l==="touch"){let y=g.touches?.[0]||g.changedTouches?.[0];if(!y)return;this.handleDragMove(y.clientX,y.clientY);return}if(l==="mouse"){let y=g;if(typeof y.buttons=="number"&&(y.buttons&1)!==1)return}this.handleDragMove(g.clientX,g.clientY)}}}),m=document.when(d).subscribe({next:g=>{h(g)&&(g.preventDefault(),g.stopPropagation(),this.handleDragEnd())}}),v=l==="touch"?document.when("touchcancel").subscribe({next:g=>{h(g)&&this.handleDragEnd()}}):l==="mouse"?null:document.when("pointercancel").subscribe({next:g=>{h(g)&&this.handleDragEnd()}}),x=document.when("keydown").filter(g=>g.key==="Escape").subscribe({next:g=>{h(g)&&this.handleDragEnd()}}),u=[f,m,x];v&&u.push(v),this.dragSubscriptions.push(...u)}handleDragMove(a,l){if(!this.dragState.dragging||!this.dragState.dragClone)return;this.updateClonePosition(a,l);let c=Wr(this.allDropzones,a,l,this.dragState.dragClone,this.collisionDetectionAlgorithm,this.trackedDragContainers),d=Date.now(),h=d-(this.dragState.lastTargetChangeTime||0);c!==this.dragState.currentTarget&&(c===null||h>=50)&&(this.allDropzones.forEach(m=>pe(m,"hover",!1)),c&&pe(c,"hover",!0),this.dragState.currentTarget=c,this.dragState.lastTargetChangeTime=d)}handleDragEnd(){if(!this.dragState.dragging)return;let{dragSource:a,dragClone:l,currentTarget:c,sourceDroppable:d}=this.dragState,h=c;if(l){let v=l.getBoundingClientRect();h=Wr(this.allDropzones,v.left+v.width/2,v.top+v.height/2,l,this.collisionDetectionAlgorithm,this.trackedDragContainers)??c}!!a&&!!h&&this.allowDrop(a,h)&&a&&h?(this.handleDrop(a,h),zt(a,"dragging",!1)):this.handleInvalidDrop(a),l&&l.remove(),(this.dragState.returnAnchorItems||[]).forEach(v=>{zt(v,"return-anchor",!1)}),this.dragState.touchCleanup&&this.dragState.touchCleanup(),this.resetDragState(),this.deactivateAllDroppables(),this.saveResponse(),d&&d.removeAttribute("data-drag-source"),this.cacheInteractiveElements();let m=this.checkAllMaxAssociations;typeof m=="function"&&m.call(this)}allowDrop(a,l){return this.trackedDroppables.includes(l)||this.trackedDragContainers.includes(l)}handleInvalidDrop(a){on(a)}createDragClone(a,l){let c=a.cloneNode(!0),d=window.getComputedStyle(a);for(let f=0;f<d.length;f++){let m=d[f];c.style.setProperty(m,d.getPropertyValue(m))}let h=Il(a.isConnected?a:this,this.dragCloneRoot());return this.cloneFrame=_l(h),c.style.position="fixed",c.style.width=`${l.width/this.cloneFrame.scale.x}px`,c.style.height=`${l.height/this.cloneFrame.scale.y}px`,c.style.zIndex="9999",c.style.pointerEvents="none",c.style.touchAction="none",c.style.userSelect="none",c.style.opacity="0.8",c.removeAttribute("qti-draggable"),c.removeAttribute("tabindex"),c.setAttribute("data-drag-clone","true"),c.setAttribute("data-drag-interaction",this.tagName.toLowerCase()),h.appendChild(c),c}dragCloneRoot(){let a=this.getRootNode();return a instanceof ShadowRoot?a:null}updateClonePosition(a,l){if(this.dragState.lastCoordinates={x:a,y:l},!this.dragState.dragClone)return;let{startOffset:c}=this.dragState,{x:d,y:h}=Mh(this.cloneFrame,a-c.x,l-c.y);this.dragState.dragClone.style.left=`${d}px`,this.dragState.dragClone.style.top=`${h}px`}watchDragCloneHost(){let a=this.ownerDocument??document,l=()=>{let{dragClone:c,dragSource:d,lastCoordinates:h}=this.dragState;if(!c)return;let f=d?.isConnected?d:this,m=Il(f,this.dragCloneRoot());m!==c.parentNode&&(m.appendChild(c),this.cloneFrame=_l(m),h&&this.updateClonePosition(h.x,h.y))};a.addEventListener("fullscreenchange",l),a.addEventListener("webkitfullscreenchange",l),this.dragSubscriptions.push({unsubscribe:()=>{a.removeEventListener("fullscreenchange",l),a.removeEventListener("webkitfullscreenchange",l)}})}activateAllDroppables(){this.setInternalsState("dragzone-enabled",!0),this.setInternalsState("dragzone-active",!0),this.allDropzones.forEach(a=>{pe(a,"enabled",!0),pe(a,"active",!0)})}deactivateAllDroppables(){this.setInternalsState("dragzone-enabled",!1),this.setInternalsState("dragzone-active",!1),this.allDropzones.forEach(a=>{pe(a,"enabled",!1),pe(a,"active",!1),pe(a,"hover",!1)})}resetDragState(){if(this.dragState.activationTimeout&&clearTimeout(this.dragState.activationTimeout),(this.dragState.returnAnchorItems||[]).forEach(a=>{zt(a,"return-anchor",!1)}),this.dragState.touchCleanup)try{this.dragState.touchCleanup()}catch(a){console.warn("\u26A0\uFE0F [Observable DnD] Error during touch cleanup:",a)}this.dragSubscriptions.forEach(a=>{try{a&&typeof a.unsubscribe=="function"&&a.unsubscribe()}catch(l){console.warn("\u26A0\uFE0F [Observable DnD] Error unsubscribing:",l)}}),this.dragSubscriptions=[],this.cloneFrame=Al,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,returnAnchorItems:[]}}setInternalsState(a,l){let c=this._internals;c?.states&&(l?c.states.add(a):c.states.delete(a))}cleanup(){this.subscriptions.forEach(a=>{try{a.unsubscribe()}catch{}}),this.subscriptions=[],this.dragState.dragClone&&this.dragState.dragClone.remove();for(let a of this.#t)Nh(a)&&(a.internals.states.delete("drag"),a.internals.states.delete("droppable"));this.#t.clear(),this.resetDragState()}}return i};var $h={duration:250,easing:"ease",fill:"both"};function Tl(o){let t=o.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}function Lh(o){return{left:o.left,top:o.top,width:o.width,height:o.height}}function $e(o){let t=new Map;return o.forEach(e=>{t.set(e,Tl(e))}),t}function Vh(o,t){return{deltaX:o.left-t.left,deltaY:o.top-t.top,deltaW:o.width/t.width,deltaH:o.height/t.height}}function zo(o){if(typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches)return 0;if(!o)return 1;let t=getComputedStyle(o).getPropertyValue("--qti-motion").trim();if(t==="")return 1;let e=Number.parseFloat(t);return Number.isFinite(e)&&e>0?e:0}function Rl(o){return zo(o)>0}function jo(o,t,e={}){let r=zo(o);if(r<=0)return null;let n=Tl(o),{deltaX:i,deltaY:s,deltaW:a,deltaH:l}=Vh(t,n);if(i===0&&s===0&&a===1&&l===1)return null;let{duration:c,easing:d,fill:h}={...$h,...e};return o.animate([{transformOrigin:"top left",transform:`translate(${i}px, ${s}px) scale(${a}, ${l})`},{transformOrigin:"top left",transform:"none"}],{duration:c*r,easing:d,fill:h})}function Le(o,t={}){let e=new Map;return o.forEach((r,n)=>{if(!(n instanceof HTMLElement))return;let i=jo(n,r,t);i&&e.set(n,i)}),e}var sn=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},jt=(o,t,e,r='slot[part="drags"]',n="closestCornersWithInventoryPriority")=>{let i=ql(o,t,e,r),s=Vo(i,t,e,r,n);class a extends s{constructor(){super(...arguments),this.minAssociations=1,this._maxAssociations=0,this._maxAssociationsDefaultApplied=!1,this._response=[],this._dragDrop={dragsByTarget:{},countByTarget:{},nodesByTarget:{}},this.#t=new WeakMap,this._dropBlockedDueToMax=!1,this.flipAnimationConfig={duration:200,easing:"ease"},this._enableFlipAnimations=!0,this._pendingResponse=void 0}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 d=this._maxAssociations;this._maxAssociations=c,this.requestUpdate("maxAssociations",d)}#t;isSwapTarget(c){let d=this.dragState.sourceDroppable,h=parseInt(c.getAttribute("match-max")||"1",10);return(Number.isNaN(h)?1:h)===1&&this.isDeclarativeTarget(c)&&!!d&&d!==c&&this.trackedDroppables.includes(d)}isDeclarativeTarget(c){return c?c.acceptsDeclarativeDrops===!0?!0:c.hasAttribute("data-declarative-drops"):!1}chipsIn(c){return this.isDeclarativeTarget(c)?[...this.#t.get(c)??[]]:Array.from(c.querySelectorAll(t))}droppableHolding(c){return this.trackedDroppables.find(d=>this.chipsIn(d).includes(c)||d.contains(c)||!!d.shadowRoot?.contains(c))??null}placeChip(c,d){this.#t.set(c,[...this.#t.get(c)??[],d])}removeChipFromDroppable(c,d){let h=c??this.droppableHolding(d);if(h&&this.isDeclarativeTarget(h)){let f=(this.#t.get(h)??[]).filter(m=>m!==d);this.#t.set(h,f),f.length===0&&Qr(h,!1),this.syncDragDropState();return}d.remove()}clearChips(c){this.isDeclarativeTarget(c)?(this.#t.set(c,[]),this.syncDragDropState()):this.chipsIn(c).forEach(d=>d.remove()),Qr(c,!1)}syncDragDropState(){let c={},d={},h={};for(let f of this.trackedDroppables){let m=f.getAttribute("identifier");if(!m)continue;let v=this.chipsIn(f),x=this.isDeclarativeTarget(f)?v:Array.from(f.querySelectorAll('[qti-draggable="true"]'));c[m]=v.map(u=>u.getAttribute("identifier")).filter(u=>!!u),d[m]=Math.max(v.length,x.length),h[m]=v}this._dragDrop={dragsByTarget:c,countByTarget:d,nodesByTarget:h},this.requestUpdate()}responseFromState(){this.syncDragDropState();let{dragsByTarget:c}=this._dragDrop;return this.trackedDroppables.flatMap(d=>{let h=d.getAttribute("identifier");return h?(c[h]??[]).map(f=>`${f} ${h}`):[]})}totalAssociationsFromState(){return this.syncDragDropState(),Object.values(this._dragDrop.countByTarget).reduce((c,d)=>c+d,0)}droppableAtCapacityFromState(c){let d=parseInt(c.getAttribute("match-max")||"1",10),h=Number.isNaN(d)?1:d;if(h===0)return!1;let f=c.getAttribute("identifier");return(f?this._dragDrop.countByTarget[f]??0:0)>=h}set disableAnimations(c){this._enableFlipAnimations=!c}get disableAnimations(){return!this._enableFlipAnimations}get enableFlipAnimations(){return this._enableFlipAnimations&&Rl(this)}collectAutoSizeTargets(){return{draggables:this.trackedDraggables,droppables:this.trackedDroppables,dragContainers:this.trackedDragContainers}}get response(){let c=this.getResponse,d=typeof c=="function"?c.call(this):void 0;return(Array.isArray(d)?d:(this.cacheInteractiveElements(),this.responseFromState())).join(",")}set response(c){if(Array.isArray(c)){if(!this.trackedDroppables||this.trackedDroppables.length===0){this._pendingResponse=c,this._internals.setFormValue(JSON.stringify(c));return}let d=this.getValue,h=typeof d=="function"?d.call(this,c):c,f=Array.isArray(h)?h:typeof h=="string"&&h.length>0?[h]:[];this.reset(!1),f.forEach(x=>this.placeResponse(x));let m=this.getResponse,v=typeof m=="function"?m.call(this):void 0;this._response=Array.isArray(v)?v:(this.cacheInteractiveElements(),this.responseFromState())}else this._response=typeof c=="string"&&c.length>0?[c]:[];this._internals.setFormValue(JSON.stringify(this._response))}afterCache(){if(this.updateMinDimensionsForDropZones(),this.applyConfiguredChoicesContainerWidth(),this._pendingResponse!==void 0){let c=this._pendingResponse;this._pendingResponse=void 0,this.response=c}}get autoSizeDropzoneWidth(){return!this.dataset.choicesContainerWidth}applyConfiguredChoicesContainerWidth(){let c=this.dataset.choicesContainerWidth;c&&this.trackedDroppables.forEach(d=>{d.style.width=`${c}px`,d.style.boxSizing="border-box"})}shouldTreatBlockedMaxAsInvalid(){return!0}shouldReturnToInventoryOnInventoryDrop(){return!1}getFirstMessageAttribute(c){for(let h of c){let f=this.getAttribute(h);if(f&&f.trim().length>0)return f}let d=c.map(h=>h.toLowerCase());for(let h of Array.from(this.attributes))if(d.includes(h.name.toLowerCase())&&h.value.trim().length>0)return h.value;return null}allowDrop(c,d){if(this.trackedDragContainers.includes(d))return!0;let h=this.trackedDroppables.includes(d),f=d.hasAttribute("disabled"),m=d.hasAttribute("data-drag-source");return f&&this.isSwapTarget(d)?!0:h&&(!f||m)}handleDrop(c,d){let h=this.dragState.dragClone?.getBoundingClientRect();this.dropDraggableInDroppable(c,d,h);let f=c.getAttribute("identifier");f&&this.updateInventoryBasedOnMatchMax(f),this.validate(),this.reportValidity()}handleInvalidDrop(c){let d=this.dragState.sourceDroppable,h=this.dragState.currentTarget,f=!h,m=this.trackedDragContainers[0]||null;if(!c)return;if(d&&f&&m)this.dropDraggableInDroppable(c,m);else if(d&&this.trackedDroppables.includes(d))this.dropDraggableInDroppable(c,d,this.dragState.dragClone?.getBoundingClientRect());else if($o(c,"dragging")){this.restoreInventoryItem(c,this.dragState.dragClone?.getBoundingClientRect());let g=c.getAttribute("identifier");g&&this.updateInventoryBasedOnMatchMax(g),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}let v=this.totalAssociationsFromState(),x=this.maxAssociations>0&&v>=this.maxAssociations,u=!!h&&h.hasAttribute("disabled")&&!h.hasAttribute("data-drag-source");this._dropBlockedDueToMax=u&&x,this.validate(),this.reportValidity()}animateReturn(c,d){!c||!d||!this.enableFlipAnimations||requestAnimationFrame(()=>{jo(c,Lh(d),this.flipAnimationConfig)})}restoreInventoryItem(c,d){on(c),c.style.display="",c.style.position="",this.animateReturn(c,d)}placeResponse(c){let[d,...h]=c.split(" ").reverse(),f=this.trackedDroppables.find(m=>m.getAttribute("identifier")===d);f&&h.forEach(m=>{if(!m)return;let x=Gr(this.trackedDragContainers,m).at(0)||this.trackedDraggables.find(u=>u.getAttribute("identifier")===m);x&&this.dropDraggableInDroppable(x,f)})}dropDraggableInDroppable(c,d,h){if(this.trackedDragContainers.includes(d)){if(!this.dragState.sourceDroppable){if(this.shouldReturnToInventoryOnInventoryDrop()){this.returnToInventory(c,h),this._dropBlockedDueToMax=!1,this.validate();return}this.restoreInventoryItem(c,h),this.cacheInteractiveElements(),this.checkAllMaxAssociations(),this._dropBlockedDueToMax=!1,this.validate();return}let I=c.getAttribute("identifier");this.removeChipFromDroppable(this.droppableHolding(c),c),I&&this.restoreOriginalInInventory(I,h),this.cacheInteractiveElements(),this.checkAllMaxAssociations(),this._dropBlockedDueToMax=!1,this.validate();return}let m=parseInt(d.getAttribute("match-max")||"1",10),v=Number.isNaN(m)?1:m,x=v===0||v>1,u=Array.from(d.querySelectorAll('[qti-draggable="true"]')),g=this.enableFlipAnimations&&u.length>0?$e(u):null;if(!x){let I=this.chipsIn(d)[0]??(this.isDeclarativeTarget(d)?null:d.querySelector('[qti-draggable="true"]'));if(I){let A=I.getAttribute("identifier"),k=I.getBoundingClientRect();this.removeChipFromDroppable(d,I);let S=this.dragState.sourceDroppable,R=this.isDeclarativeTarget(d)&&S&&S!==d&&this.isDeclarativeTarget(S)?S:null;R?(this.placeChip(R,I),Qr(R,!0),this.animateReturn(I,k)):A&&this.restoreOriginalInInventory(A,k)}}let y=c.cloneNode(!0);y.removeAttribute("style"),y.removeAttribute("data-keyboard-dragging"),y.setAttribute("qti-draggable","true"),y.setAttribute("tabindex","0"),this.isDeclarativeTarget(d)?(y.setAttribute("part","drag"),y.setAttribute("exportparts","control: drag-control, label: drag-label, correction, correction-correct, correction-incorrect"),this.placeChip(d,y)):d.tagName==="SLOT"?y.setAttribute("slot",d.getAttribute("name")||""):(d.tagName==="QTI-SIMPLE-ASSOCIABLE-CHOICE"&&y.setAttribute("slot","qti-simple-associable-choice"),d.appendChild(y)),Qr(d,!0),this.syncDragDropState(),g&&this.enableFlipAnimations&&Le(g,this.flipAnimationConfig),h&&this.enableFlipAnimations&&requestAnimationFrame(()=>{let I=y.getBoundingClientRect(),A=h.left-I.left,k=h.top-I.top;(A!==0||k!==0)&&y.animate([{transform:`translate(${A}px, ${k}px)`,opacity:.8},{transform:"translate(0, 0)",opacity:1}],{duration:this.flipAnimationConfig.duration||200,easing:this.flipAnimationConfig.easing||"ease",fill:"both"})});let w=c.getAttribute("identifier");w&&this.updateInventoryBasedOnMatchMax(w),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}returnToInventory(c,d){let h=c.getAttribute("identifier");h&&(this.trackedDroppables.forEach(f=>{let m=this.chipsIn(f).filter(v=>v.getAttribute("identifier")===h);m.forEach(v=>this.removeChipFromDroppable(f,v)),m.length>0&&this.chipsIn(f).length===0&&Qr(f,!1)}),this.restoreOriginalInInventory(h,d)),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}restoreOriginalInInventory(c,d){let h=Gr(this.trackedDragContainers,c),f=new Set(h),m=[];this.trackedDragContainers.forEach(x=>{x.querySelectorAll('[qti-draggable="true"]').forEach(u=>!f.has(u)&&m.push(u))});let v=this.enableFlipAnimations&&m.length>0?$e(m):null;h.forEach(x=>{on(x),x.style.display="",x.style.visibility="visible"}),v&&this.enableFlipAnimations&&Le(v,this.flipAnimationConfig),h.forEach(x=>this.animateReturn(x,d))}updateInventoryBasedOnMatchMax(c){let d=Gr(this.trackedDragContainers,c),h=Oh(this.trackedDraggables,c),f=this.trackedDroppables.reduce((m,v)=>this.isDeclarativeTarget(v)?m+this.chipsIn(v).filter(x=>x.getAttribute("identifier")===c).length:m+v.querySelectorAll(`[identifier="${c}"]`).length,0);d.forEach(m=>{zt(m,"placeholder",h!==0&&f>=h)})}checkAllMaxAssociations(){let c=this.totalAssociationsFromState(),d=this.resolveDisableAfterMaxReached({defaultWhenUnset:!0}),h=this.maxAssociations>0&&c>=this.maxAssociations;this.trackedDroppables.forEach(f=>{let m=f.hasAttribute("data-drag-source");(this.droppableAtCapacityFromState(f)||d&&h)&&!m?f.setAttribute("disabled",""):f.removeAttribute("disabled")})}saveResponse(c){let d=this.getResponse,h=c??(typeof d=="function"?d.call(this):void 0),f=Array.isArray(h)?h:typeof h=="string"?[h]:(this.cacheInteractiveElements(),this.responseFromState());this._response=f,this._internals.setFormValue(JSON.stringify(this._response)),this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:f}})),this.requestUpdate()}reset(c=!0){this.trackedDroppables.forEach(d=>{this.clearChips(d)}),this.trackedDraggables.forEach(d=>{let h=d.getAttribute("identifier");h&&this.restoreOriginalInInventory(h)}),this.resetDragState(),this.cacheInteractiveElements(),this._response=[],this._internals.setFormValue(JSON.stringify(this._response)),c&&this.saveResponse()}validate(){let c=this.totalAssociationsFromState(),d=this.maxAssociations>0&&c>=this.maxAssociations,h=this.maxAssociations>0&&c>this.maxAssociations,f=this.minAssociations>0&&c<this.minAssociations,m="",v=!0;h?(m=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}.`,v=!1):d&&this._dropBlockedDueToMax&&this.shouldTreatBlockedMaxAsInvalid()?(m=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}.`,v=!1):f?(m=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"}.`,v=!1,this._dropBlockedDueToMax=!1):this._dropBlockedDueToMax=!1;let x=this.trackedDroppables[0]??this.trackedDraggables[0]??this;return this.setInteractionValidity(v,m,x,{suppressInline:!0}),v}reportValidity(){return super.reportValidity()}}return sn([p({type:Number,reflect:!0,attribute:"min-associations"})],a.prototype,"minAssociations",void 0),sn([p({type:Number,reflect:!0,attribute:"max-associations"})],a.prototype,"maxAssociations",null),sn([U({context:Oe})],a.prototype,"_dragDrop",void 0),sn([p({type:Boolean,attribute:"disable-animations"})],a.prototype,"disableAnimations",null),sn([p({attribute:"response",reflect:!1,noAccessor:!0,converter:Yt({emptyAs:[]})})],a.prototype,"response",null),a};var Fo=class{getInsertPosition(t,e,r,n,i){let s=t.indexOf(r);if(s===-1)return null;let a=r.getBoundingClientRect(),l=(i-a.top)/a.height,d=Math.min(1,Math.max(0,l))>.5;return{index:s,placeAfter:d}}};var zh=new Fo;var Am={borderStyle:"2px dashed",borderColor:"var(--qti-drop-highlight-border-color, #c1c1c1)",background:"transparent",transitionDuration:150};function an(){return{placeholder:null,lastHoverTarget:null,lastPlacement:null,sortContainer:null}}function Bo(o){o.placeholder?.remove(),o.placeholder=null,o.lastHoverTarget=null,o.lastPlacement=null,o.sortContainer=null}function Uo(o,t,e={}){let r={...Am,...e},n=document.createElement("div");return n.setAttribute("data-drop-placeholder","true"),n.style.width=`${t.width}px`,n.style.height=`${t.height}px`,n.style.margin=window.getComputedStyle(o).margin,n.style.boxSizing="border-box",n.style.border=`${r.borderStyle} ${r.borderColor}`,n.style.borderRadius=getComputedStyle(o).borderRadius,n.style.background=r.background,n.style.transition=`transform ${r.transitionDuration*zo(o)}ms ease`,n.style.pointerEvents="none",n}function Pl(o,t){for(let e of t)if(e.contains(o)&&e!==o)return e;return null}var Ft=(o,t='[qti-draggable="true"]')=>{class e extends o{constructor(){super(...arguments),this.#t=null,this.#e=null,this.#r=an(),this.#i={hoveredSlot:null,originalPositions:new Map},this.#n=new Set,this.sortablePlaceholderConfig={},this.sortableAnimationConfig={duration:150,easing:"ease"}}#t;#e;#r;#i;#n;#o;set allowReorder(n){this.#o=n}get allowReorder(){return this.#o??this.resolveAllowReorder({defaultWhenUnset:!0})}get isDraggingFromSlot(){return this.#t!==null}findContainingDroppable(n){return Pl(n,this.trackedDroppables)}#s(n){return n.querySelector(t)}#a(n){let i=this.#c(n);return i===0||i>1}#c(n){let i=parseInt(n.getAttribute("match-max")||"1",10);return Number.isNaN(i)?1:i}#p(n){return n.querySelectorAll(t).length}#l(n){let i=this.#c(n);return i===0?!1:this.#p(n)>=i}#d(){this.#i={hoveredSlot:null,originalPositions:new Map}}#m(n){if(!this.#t||n===this.#t){this.#h();return}if(this.#i.hoveredSlot===n)return;this.#h();let i=this.#s(n);if(!i){this.#r.placeholder&&n.appendChild(this.#r.placeholder),this.#i.hoveredSlot=n;return}if(this.#a(n)){if(this.#l(n)){this.#r.placeholder&&this.#t&&this.#t.appendChild(this.#r.placeholder),this.#i.hoveredSlot=null;return}this.#r.placeholder&&n.appendChild(this.#r.placeholder),this.#i.hoveredSlot=n;return}if(this.isDeclarativeTarget(n)){this.#r.placeholder?.parentElement&&this.#r.placeholder.remove(),this.#i.hoveredSlot=n;return}let a=$e([i]);this.#i.originalPositions.set(i,n),this.#r.placeholder&&this.#r.placeholder.parentElement&&this.#r.placeholder.remove(),this.#t.appendChild(i),this.#r.placeholder&&n.appendChild(this.#r.placeholder),this.#i.hoveredSlot=n,Le(a,this.sortableAnimationConfig)}#h(){if(this.#i.originalPositions.size===0&&this.#i.hoveredSlot===null)return;let n=Array.from(this.#i.originalPositions.keys()),i=n.length>0?$e(n):null;for(let[s,a]of this.#i.originalPositions)a.appendChild(s);this.#r.placeholder&&this.#t&&this.#t.appendChild(this.#r.placeholder),i&&Le(i,this.sortableAnimationConfig),this.#i.originalPositions.clear(),this.#i.hoveredSlot=null}initiateDrag(n,i,s,a,...l){this.#t=null,this.#r=an(),this.#d();let c=this.findContainingDroppable(n);if(this.#e=c,c&&this.allowReorder){this.#t=c,this.#r.sortContainer=c;let h=n.getBoundingClientRect();this.#r.placeholder=Uo(n,h,this.sortablePlaceholderConfig);let f=n.getAttribute("slot");f&&this.#r.placeholder.setAttribute("slot",f),this.#r.placeholder.style.visibility="hidden",c.appendChild(this.#r.placeholder),this.trackedDroppables.forEach(m=>{if(m!==c&&m.hasAttribute("disabled")){if(this.#a(m)&&this.#l(m))return;m.removeAttribute("disabled"),this.#n.add(m)}})}let[d]=l;super.initiateDrag(n,i,s,a,d)}cleanupSortableState(n=!0){if(n)for(let[i,s]of this.#i.originalPositions)s.appendChild(i);this.#r.placeholder&&this.#r.placeholder.remove(),Bo(this.#r),this.#n.clear(),this.#t=null,this.#d()}onSortableDragMove(n,i){if(!this.isDraggingFromSlot)return;let s=Wr(this.trackedDroppables,n,i,this.dragState.dragClone,this.collisionDetectionAlgorithm);s?this.#m(s):this.#h()}handleDragMove(n,i){Object.getPrototypeOf(e.prototype).handleDragMove?.call(this,n,i),this.onSortableDragMove(n,i)}allowDrop(n,i){return!this.allowReorder&&this.#e&&!this.trackedDragContainers.includes(this.#e)&&i!==this.#e&&this.trackedDroppables.includes(i)?!1:this.isDraggingFromSlot&&this.trackedDroppables.includes(i)?this.#a(i)?!this.#l(i):!0:this.isDraggingFromSlot&&this.trackedDragContainers.includes(i)?!0:super.allowDrop(n,i)}handleDrop(n,i){super.handleDrop(n,i),this.cleanupSortableState(!1)}handleInvalidDrop(n){this.cleanupSortableState(),super.handleInvalidDrop(n)}}return e};var jh=[P,H,Gt,q`
7015
+ <slot part="label"></slot>`}};jo([p({type:String,attribute:"template-identifier"})],zt.prototype,"templateIdentifier",void 0);jo([p({type:String,attribute:"show-hide"})],zt.prototype,"showHide",void 0);jo([p({type:Boolean,converter:{fromAttribute:o=>o==="true",toAttribute:o=>String(o)}})],zt.prototype,"fixed",void 0);jo([p({type:String,attribute:!1})],zt.prototype,"marker",void 0);var Oh=[{tag:"qti-simple-choice",ctor:zt}];var Mh=[...mh,...gh,...yh,...xh,...Ch,...kh,...Ih,..._h,...Rh,...Oh];var _m=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r};function Tm(o,t,e,i,n={}){let r=n.publishWidth??!0,s=n.hostWindow??(typeof window<"u"?window:null);if(!t.length||!e.length||!s)return;let a=0,l=0,c=i.length?i:[o],d=c.map(h=>({el:h,reservation:h.style.getPropertyValue("--qti-drag-min-width"),hadStyleAttribute:h.hasAttribute("style")}));c.forEach(h=>h.style.setProperty("--qti-drag-min-width","0px")),t.forEach(h=>{let f=h.getBoundingClientRect();a=Math.max(a,f.height),l=Math.max(l,f.width)}),d.forEach(({el:h,reservation:f,hadStyleAttribute:m})=>{f?h.style.setProperty("--qti-drag-min-width",f):h.style.removeProperty("--qti-drag-min-width"),!m&&h.getAttribute("style")===""&&h.removeAttribute("style")}),n.hasChanged?.({height:a,width:l})!==!1&&(o.style.setProperty("--qti-dropzone-min-height",`${a}px`),r&&(o.style.setProperty("--qti-dropzone-min-width",`${l}px`),o.style.setProperty("--qti-drag-min-width",`${l}px`)),i.forEach(h=>{h.style.minHeight=`var(--qti-drag-container-min-height, ${a}px)`,h.style.setProperty("--qti-dropzone-min-height",`${a}px`),r&&(h.style.setProperty("--qti-dropzone-min-width",`${l}px`),h.style.setProperty("--qti-drag-min-width",`${l}px`))}))}var Al=(o,t,e,i='slot[part="drags"]')=>{class n extends o{constructor(){super(...arguments),this.autoSizeDropzones=!0,this.#t=null,this.#e=new Set,this.#i=null,this.#r=0,this.#n=null}get autoSizeDropzoneWidth(){return!0}#t;#e;#i;#r;#n;collectAutoSizeTargets(){let s=(a,l)=>Array.from(l?.querySelectorAll(a)??[]);return{draggables:[...s(t,this),...s(t,this.shadowRoot)],droppables:[...s(e,this),...s(e,this.shadowRoot)],dragContainers:[...s(i,this),...s(i,this.shadowRoot)]}}dropzonePropertyTarget(){return this}updateMinDimensionsForDropZones(){if(!this.autoSizeDropzones)return;let{draggables:s,droppables:a,dragContainers:l}=this.collectAutoSizeTargets();s.length!==0&&(Tm(this.dropzonePropertyTarget(),s,a,l,{publishWidth:this.autoSizeDropzoneWidth,hasChanged:c=>{let d=this.#n;return d&&d.height===c.height&&d.width===c.width?!1:(this.#n=c,!0)}}),this.#a(s),this.#o())}#o(){typeof MutationObserver>"u"||this.#i||(this.#i=new MutationObserver(()=>this.#s()),this.#i.observe(this,{childList:!0,subtree:!0,characterData:!0}))}#s(){this.#r||(this.#r=requestAnimationFrame(()=>{this.#r=0,this.updateMinDimensionsForDropZones()}))}#a(s){if(typeof ResizeObserver>"u")return;this.#t??=new ResizeObserver(()=>this.#s());let a=new Set(s);for(let l of this.#e)a.has(l)||this.#t.unobserve(l);for(let l of a)this.#e.has(l)||this.#t.observe(l);this.#e=a}disconnectedCallback(){this.#t?.disconnect(),this.#t=null,this.#e.clear(),this.#i?.disconnect(),this.#i=null,this.#r&&cancelAnimationFrame(this.#r),this.#r=0,super.disconnectedCallback()}}return _m([p({type:Boolean,attribute:"auto-size-dropzones"})],n.prototype,"autoSizeDropzones",void 0),n};var{AbortController:te,AbortSignal:_l,WeakMap:Rm,WeakRef:Pm,Window:Dh,reportError:Fo=console.log}=globalThis,$e=o=>o&&o.defaultView!==null&&o.defaultView.document===o&&(o.defaultView.top===o.defaultView||$e(o.defaultView.parent.document)),yi=()=>!!Dh&&globalThis instanceof Dh,Tl=Symbol("unset"),[Nh,Om]=(()=>{function o(x,u,g=!0){Object.defineProperty(x,u,{...Object.getOwnPropertyDescriptor(x,u),enumerable:g})}let t="try"in Promise?Promise.try.bind(Promise):(x,...u)=>new Promise(g=>g(x(...u))),e="withResolvers"in Promise?Promise.withResolvers.bind(Promise):()=>{let x,u;return{promise:new Promise((y,w)=>(x=y,u=w)),resolve:x,reject:u}};function i(x,u){let g=u.call(x);if(g===null||typeof g!="object")throw new TypeError("Iterator is not an object");return g}let n=new Rm,r={next(...x){let u=this,g=n.get(u);if(!g?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.next called on invalid object");let{syncIteratorRecord:y}=g;return t(()=>y.next(...x))},return(...x){let u=this,g=n.get(u);if(!g?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.return called on invalid object");let{syncIteratorRecord:y}=g;return t(()=>y.return?y.return(...x):{value:void 0,done:!0})},throw(...x){let u=this,g=n.get(u);if(!g?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.throw called on invalid object");let{syncIteratorRecord:y}=g;return t(()=>{if(!y.throw)throw y.return(),new TypeError("no throw method");return y.throw(...x)})}};function s(x){let u=Object.create(r);return n.set(u,{syncIteratorRecord:x}),u}function a(x,u){let g;if(u){if(g=x[Symbol.asyncIterator],g==null){if(g=x[Symbol.iterator],g==null)throw new TypeError("Object is not async iterable");let y=i(x,g);return s(y)}}else g=x[Symbol.iterator];if(g==null)throw new TypeError("Object is not iterable");return i(x,g)}let l="any"in _l?_l.any.bind(_l):x=>{let u=new te;for(let g of x)if(g.aborted)return u.abort(g.reason),u.signal;for(let g of x)g.addEventListener("abort",()=>{u.abort(g.reason)},{signal:u.signal});return u.signal},c=x=>l(x.filter(Boolean));class d{constructor({next:u,error:g,complete:y}={}){n.set(this,{next:u,error:g,complete:y})}next(u){let{next:g}=n.get(this)||{};g&&g(u)}error(u){let{error:g}=n.get(this)||{};g?g(u):Fo(u)}complete(){let{complete:u}=n.get(this)||{};u&&u()}}function h(x,u){let g=n.get(x);if(g?.active){g.active=!1,g.subscriptionController.abort(u);for(let y of g.teardowns.reverse()){if(yi()&&!$e(document))return;try{y()}catch(w){Fo(w)}}}}function f(x,u,g={}){if(yi()&&!$e(document))return;let y;typeof u=="function"?y=new d({next:u}):u&&!(u instanceof d)?y=new d(u):y=u||new d;let w=n.get(x),A=w.weakSubscriber?.deref();if(A?.active){let k=A,S=n.get(k);S.observers.add(y),g.signal&&(g.signal.aborted?S.observers.delete(y):g.signal.addEventListener("abort",()=>{let R=n.get(k);R?.active&&(R.observers.delete(y),R.observers.size==0&&h(k,g.signal.reason))}));return}let I=new m(y);if(w.weakSubscriber=new Pm(I),"signal"in g&&(g.signal.aborted?h(I,g.signal.reason):g.signal.addEventListener("abort",()=>{let k=n.get(I);k?.active&&(k.observers.delete(y),k.observers.size==0&&h(I,g.signal.reason))})),w.subscribeCallback)try{w.subscribeCallback(I)}catch(k){I.error(k)}}class m{get[Symbol.toStringTag](){return"Subscriber"}constructor(u=null){if(!(u instanceof d))throw new TypeError("Illegal constructor");n.set(this,{active:!0,observers:new Set([u]),teardowns:[],subscriptionController:new te})}next(u){if(!(this instanceof m))throw new TypeError("illegal invocation");if(!arguments.length)throw new TypeError("too few arguments");let g=n.get(this);if(!g?.active||yi()&&!$e(document))return;let y=new Set(g.observers);for(let w of y)w.next(u)}error(u){if(!(this instanceof m))throw new TypeError("illegal invocation");if(!arguments.length)throw new TypeError("too few arguments");let g=n.get(this);if(!g?.active){Fo(u);return}if(yi()&&!$e(document))return;h(this,u);let y=new Set(g.observers);for(let w of y)w.error(u)}complete(){if(!(this instanceof m))throw new TypeError("illegal invocation");let u=n.get(this);if(!u?.active||yi()&&!$e(document))return;h(this);let g=new Set(u.observers);for(let y of g)y.complete()}addTeardown(u){if(!(this instanceof m))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");if(yi()&&!$e(document))return;let g=n.get(this);g?.active?g.teardowns.push(u):u()}get active(){if(!(this instanceof m))throw new TypeError("illegal invocation");return!!n.get(this)?.active}get signal(){if(!(this instanceof m))throw new TypeError("illegal invocation");if(!n.has(this)){let u=new te;return u.abort(),u.signal}return n.get(this).subscriptionController.signal}}o(m.prototype,"next"),o(m.prototype,"error"),o(m.prototype,"complete"),o(m.prototype,"addTeardown"),o(m.prototype,"active"),o(m.prototype,"signal");class v{get[Symbol.toStringTag](){return"Observable"}constructor(u){if(!u)throw new TypeError("1 argument required but 0 present");n.set(this,{weakSubscriber:null,subscribeCallback:u})}static from(u){if(u===null||typeof u!="object")throw new TypeError("Observable.from only accepts objects");if(u instanceof v)return u;if(typeof(Symbol.asyncIterator in u&&u[Symbol.asyncIterator])=="function"){let A=function(I,k){if(I.signal.aborted)return;let S;try{let R=k.next();S=Promise.resolve(R)}catch(R){S=Promise.reject(R)}S.then(R=>{if(R===null||typeof R!="object"){I.error(new TypeError("Not an IteratorResult."));return}try{({done:w}=R)}catch(z){I.error(z);return}if(w){I.complete();return}let N;try{N=R.value}catch(z){I.error(z);return}I.next(N),A(I,k)},R=>{I.error(R)})},w=!1;return new v(I=>{if(I.signal.aborted)return;let k;try{k=a(u,!0)}catch(R){I.error(R);return}let S=k;I.signal.aborted||(I.signal.addEventListener("abort",()=>{if(typeof S.return!="function"||w)return;t(()=>S.return(I.signal.reason)).then(N=>{if(N===null||typeof N!="object")throw new TypeError("Iterator .return() must return an Object")})}),A(I,S))})}if(typeof(Symbol.iterator in u&&u[Symbol.iterator])=="function")return new v(w=>{if(w.signal.aborted)return;let A;try{A=a(u,!1)}catch(S){w.error(S);return}let I=!1,k=A;if(!w.signal.aborted)for(w.signal.addEventListener("abort",()=>{if(typeof k.return!="function"||I)return;let S=k.return();if(S===null||typeof S!="object")throw new TypeError("Iterator .return() must return an Object")});;)try{let S=k.next();if({done:I}=S,I){w.complete();return}if(w.next(S.value),w.signal.aborted)break}catch(S){w.error(S);break}});if(u instanceof Promise||typeof u.then=="function")return new v(w=>{u.then(A=>{w.next(A),w.complete()},A=>{w.error(A)})});throw new TypeError("Could not convert value to Observable")}subscribe(u=null,g={}){if(!(this instanceof v))throw new TypeError("illegal invocation");f(this,u,g)}takeUntil(u){if(!(this instanceof v))throw new TypeError("illegal invocation");let g=this,y=v.from(u);return new v(w=>{let A=new d({next(){w.complete()},error(){w.complete()}}),I={signal:w.signal};if(f(y,A,I),!w.active)return;let k=new d({next(S){w.next(S)},error(S){w.error(S)},complete(){w.complete()}});f(g,k,I)})}map(u){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new v(y=>{let w=0,A=new d({next(k){let S;try{S=u(k,w)}catch(R){y.error(R);return}w+=1,y.next(S)},error(k){y.error(k)},complete(){y.complete()}}),I={signal:y.signal};f(g,A,I)})}inspect(u={}){let g=null,y=null,w=null,A=null,I=null;typeof u=="function"?y=u:u&&typeof u=="object"&&("subscribe"in u&&(g=u.subscribe),"next"in u&&(y=u.next),"error"in u&&(w=u.error),"complete"in u&&(A=u.complete),"abort"in u&&(I=u.abort));let k=this;return new v(S=>{if(g!==null)try{g()}catch($){S.error($);return}let R=()=>{try{I!==null&&I(S.signal.reason)}catch($){Fo($)}};S.signal.addEventListener("abort",R,{once:!0});let N=new d({next($){if(y!==null)try{y($)}catch(ut){S.signal.removeEventListener("abort",R),S.error(ut);return}S.next($)},error($){if(S.signal.removeEventListener("abort",R),w!==null)try{w($)}catch(ut){S.error(ut);return}S.error($)},complete(){if(S.signal.removeEventListener("abort",R),A!==null)try{A()}catch($){S.error($);return}S.complete()}}),z={signal:S.signal};f(k,N,z)})}filter(u){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new v(y=>{let w=0,A=new d({next(k){let S=!1;try{S=u(k,w)}catch(R){y.error(R);return}w+=1,S&&y.next(k)},error(k){y.error(k)},complete(){y.complete()}}),I={signal:y.signal};f(g,A,I)})}take(u){if(!(this instanceof v))throw new TypeError("illegal invocation");let g=this;return new v(y=>{let w=u;if(w==0)return y.complete();let A=new d({next(k){y.next(k),w-=1,w==0&&y.complete()},error(k){y.error(k)},complete(){y.complete()}}),I={signal:y.signal};f(g,A,I)})}drop(u){if(!(this instanceof v))throw new TypeError("illegal invocation");let g=this;return new v(y=>{let w=u,A=new d({next(k){if(w>0)return w-=1;w==0&&y.next(k)},error(k){y.error(k)},complete(){y.complete()}}),I={signal:y.signal};f(g,A,I)})}flatMap(u){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new v(y=>{let w=0,A=!1,I=[];function k(z){let $;try{$=u(z,w)}catch(re){return y.error(re)}w+=1;let ut;try{ut=v.from($)}catch(re){return y.error(re)}let Sa=new d({next(re){y.next(re)},error(re){y.error(re)},complete(){if(I.length){let re=I.shift();k(re)}else S=!1,A&&y.complete()}}),Ht={signal:y.signal};f(ut,Sa,Ht)}let S=!1,R=new d({next(z){S?I.push(z):(S=!0,k(z))},error(z){y.error(z)},complete(){A=!0,!S&&!I.length&&y.complete()}}),N={signal:y.signal};f(g,R,N)})}switchMap(u){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new v(y=>{let w=0,A=!1,I=null;function k(N){let z;try{z=u(N,w)}catch(Ht){return y.error(Ht)}w+=1;let $;try{$=v.from(z)}catch(Ht){return y.error(Ht)}let ut=new d({next(Ht){y.next(Ht)},error(Ht){y.error(Ht)},complete(Ht){A?y.complete():I=null}}),Sa={signal:c([I.signal,y.signal])};f($,ut,Sa)}let S=new d({next(N){I&&I.abort(),I=new te,k(N)},error(N){y.error(N)},complete(){A=!0,I||y.complete()}}),R={signal:y.signal};f(g,S,R)})}catch(u){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new v(w=>{let A=new d({next(k){w.next(k)},error(k){let S;try{S=u(k)}catch($){w.error($);return}let R;try{R=v.from(S)}catch($){w.error($);return}let N=new d({next($){w.next($)},error($){w.error($)},complete(){w.complete()}}),z={signal:w.signal};f(R,N,z)},complete(){w.complete()}}),I={signal:w.signal};f(g,A,I)})}finally(u){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new v(y=>{y.addTeardown(u);let w=new d({next(I){y.next(I)},error(I){y.error(I)},complete(){y.complete()}}),A={signal:y.signal};f(g,w,A)})}toArray(u={}){if(!(this instanceof v))throw new TypeError("illegal invocation");let{promise:g,resolve:y,reject:w}=e();if(u.signal){if(u.signal.aborted)return Promise.reject(u.signal.reason);u.signal.addEventListener("abort",()=>{w(u.signal.reason)})}let A=[],I=new d({next(k){A.push(k)},error(k){w(k)},complete(){y(A)}});return f(this,I,u),g}forEach(u,g={}){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:y,resolve:w,reject:A}=e(),I=new te,k={signal:c([I.signal,g.signal])};if(k.signal.aborted)return A(k.signal.reason),y;k.signal.addEventListener("abort",()=>{A(k.signal.reason)});let S=0,R=new d({next(N){try{u(N,S)}catch(z){A(z),I.abort(z)}S+=1},error(N){A(N)},complete(){w()}});return f(this,R,k),y}every(u,g={}){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:y,resolve:w,reject:A}=e(),I=new te,k={signal:c([I.signal,g.signal])};if(k.signal.aborted)return A(k.signal.reason),y;k.signal.addEventListener("abort",()=>{A(k.signal.reason)});let S=0,R=new d({next(N){let z=!1;try{z=u(N,S)}catch($){A($),I.abort($)}S+=1,z||(w(!1),I.abort())},error(N){A(N)},complete(){w(!0)}});return f(this,R,k),y}first(u={}){if(!(this instanceof v))throw new TypeError("illegal invocation");let{promise:g,resolve:y,reject:w}=e(),A=new te,I={signal:c([A.signal,u.signal])};if(I.signal.aborted)return w(I.signal.reason),g;I.signal.addEventListener("abort",()=>{w(I.signal.reason)});let k=new d({next(S){y(S),A.abort()},error(S){w(S)},complete(){w(new RangeError("No values in Observable"))}});return f(this,k,I),g}last(u={}){if(!(this instanceof v))throw new TypeError("illegal invocation");let{promise:g,resolve:y,reject:w}=e();if(u.signal){if(u.signal.aborted)return w(u.signal.reason),g;u.signal.addEventListener("abort",()=>{w(u.signal.reason)})}let A=null,I=!1,k=new d({next(S){I=!0,A=S},error(S){w(S)},complete(){I?y(A):w(new RangeError("No values in Observable"))}});return f(this,k,u),g}find(u,g={}){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:y,resolve:w,reject:A}=e(),I=new te,k={signal:c([I.signal,g.signal])};if(k.signal.aborted)return A(k.signal.reason),y;k.signal.addEventListener("abort",()=>{A(k.signal.reason)});let S=0,R=new d({next(N){let z=!1;try{z=u(N,S)}catch($){A($),I.abort($)}S+=1,z&&(w(N),I.abort())},error(N){A(N)},complete(){w()}});return f(this,R,k),y}some(u,g={}){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:y,resolve:w,reject:A}=e(),I=new te,k={signal:c([I.signal,g.signal])};if(k.signal.aborted)return A(k.signal.reason),y;k.signal.addEventListener("abort",()=>{A(k.signal.reason)});let S=0,R=new d({next(N){let z=!1;try{z=u(N,S)}catch($){A($),I.abort($)}S+=1,z&&(w(!0),I.abort())},error(N){A(N)},complete(){w(!1)}});return f(this,R,k),y}reduce(u,g,y={}){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:w,resolve:A,reject:I}=e(),k=new te,S={signal:c([k.signal,y.signal])};if(S.signal.aborted)return I(S.signal.reason),w;S.signal.addEventListener("abort",()=>{I(S.signal.reason)},{once:!0});let R=0,N=arguments.length>1?g:Tl,z=new d({next($){if(N===Tl){N=$,R++;return}try{let ut=u(N,$,R);R++,N=ut}catch(ut){I(ut),k.abort(ut);return}},error($){I($)},complete(){N!==Tl?A(N):I(new TypeError("no initial value provided and no values emitted"))}});return f(this,z,S),w}}return o(v.prototype,"subscribe"),[v,m]})();function $h(){return typeof globalThis.Observable=="function"}function Lh(){Object.defineProperties(globalThis,{Observable:{value:Nh,configurable:!0,writable:!0},Subscriber:{value:Om,configurable:!0,writable:!0}}),EventTarget.prototype.when=function(o,t={}){if(yi()&&!$e(document))return;let e=this;return new Nh(i=>{if(!e||i.signal.aborted)return;let n=r=>{i.next(r)};e.addEventListener(o,n,{capture:t.capture||!1,passive:t.passive,once:!1,signal:i.signal})})}}function Rl(o,t,e){let i=o.filter(n=>!n.hasAttribute("disabled"));for(let n of i){let r=n.getBoundingClientRect();if(t>=r.left&&t<=r.right&&e>=r.top&&e<=r.bottom)return n}return null}function Vh(o,t,e,i){if(!i)return null;let n=o.filter(s=>!s.hasAttribute("disabled")),r=i.getBoundingClientRect();for(let s of n){let a=s.getBoundingClientRect();if(!(r.right<a.left||r.left>a.right||r.bottom<a.top||r.top>a.bottom))return s}return null}function zh(o,t,e,i){let n=o.filter(c=>!c.hasAttribute("disabled"));if(n.length===0)return null;let r,s;if(i){let c=i.getBoundingClientRect();r=c.left+c.width/2,s=c.top+c.height/2}else r=t,s=e;let a=null,l=1/0;for(let c of n){let d=c.getBoundingClientRect(),h=d.left+d.width/2,f=d.top+d.height/2,m=Math.sqrt(Math.pow(r-h,2)+Math.pow(s-f,2));m<l&&(l=m,a=c)}return a}function jh(o,t,e,i){let n=o.filter(l=>!l.hasAttribute("disabled"));if(n.length===0)return null;let r;if(i){let l=i.getBoundingClientRect();r=[{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 r=[{x:t,y:e},{x:t,y:e},{x:t,y:e},{x:t,y:e}];let s=null,a=1/0;for(let l of n){let c=l.getBoundingClientRect(),d=[{x:c.left,y:c.top},{x:c.right,y:c.top},{x:c.left,y:c.bottom},{x:c.right,y:c.bottom}],h=0,f=0;for(let v of r)for(let x of d){let u=Math.sqrt(Math.pow(v.x-x.x,2)+Math.pow(v.y-x.y,2));h+=u,f++}let m=h/f;m<a&&(a=m,s=l)}return s}function Mm(o,t,e){let i=o.getBoundingClientRect();return t>=i.left&&t<=i.right&&e>=i.top&&e<=i.bottom}function Dm(o,t,e,i,n){let r=n&&n.length>0?o.filter(g=>n.includes(g)):o.filter(g=>g.tagName==="SLOT"&&g.hasAttribute("part")&&g.getAttribute("part")?.includes("drags")),a=o.filter(g=>!r.includes(g));if(r.length===0&&a.length===0)return null;let l;if(i){let g=i.getBoundingClientRect();l=[{x:g.left,y:g.top},{x:g.right,y:g.top},{x:g.left,y:g.bottom},{x:g.right,y:g.bottom}]}else l=[{x:t,y:e},{x:t,y:e},{x:t,y:e},{x:t,y:e}];let c=g=>{let y=g.getBoundingClientRect(),w=[{x:y.left,y:y.top},{x:y.right,y:y.top},{x:y.left,y:y.bottom},{x:y.right,y:y.bottom}],A=0,I=0;for(let k of l)for(let S of w){let R=Math.sqrt(Math.pow(k.x-S.x,2)+Math.pow(k.y-S.y,2));A+=R,I++}return A/I},d=null,h=1/0;for(let g of r){let y=c(g);y<h&&(h=y,d=g)}let f=null,m=1/0;for(let g of a){let y=c(g);y<m&&(m=y,f=g)}if(d&&i){let g=i.getBoundingClientRect(),y=d.getBoundingClientRect(),w=g.left+g.width/2,A=g.top+g.height/2;if(w>=y.left&&w<=y.right&&A>=y.top&&A<=y.bottom)return d}if(f&&Mm(f,t,e))return f;let x=i?.getAttribute("data-drag-origin")==="droppable"?.85:1.5;return d&&f?h<=m*x?d:f:d||f}function Fh(o){switch(o){case"pointerWithin":return Rl;case"rectangleIntersection":return Vh;case"closestCenter":return zh;case"closestCorners":return jh;case"closestCornersWithInventoryPriority":return Dm;default:return Rl}}function Xi(o,t,e,i,n="pointerWithin",r){return Fh(n)(o,t,e,i,r)}function Le(o,t){let e=o.composedPath?o.composedPath():[o.target];for(let i of e)if(i instanceof HTMLElement&&i.tagName!=="SLOT"){if(i.matches(t)||i.hasAttribute("qti-draggable"))return i;let n=i.closest(t)||i.closest('[qti-draggable="true"]');if(n)return n}return null}function an(o){return o?o.hasAttribute("disabled")?!0:o.internals?.states?.has("disabled")??!1:!1}var Pl=o=>o?.internals;function jt(o,t,e){let i=Pl(o)?.states;i&&(e?i.add(t):i.delete(t))}function Bo(o,t){return Pl(o)?.states?.has(t)??!1}function ln(o){jt(o,"dragging",!1),jt(o,"placeholder",!1),jt(o,"return-anchor",!1)}function vi(o){return Bo(o,"dragging")||Bo(o,"placeholder")}function me(o,t,e){if(!o)return;e?o.setAttribute(t,""):o.removeAttribute(t);let i=Pl(o)?.states;if(i){e?i.add(t):i.delete(t);return}let n=new Set((o.getAttribute("part")??"").split(/\s+/).filter(Boolean));n.has("drop")&&(e?n.add(t):n.delete(t),o.setAttribute("part",[...n].join(" ")))}function Gi(o,t){me(o,"filled",t)}function Yi(o,t){let e=[];return o.forEach(i=>{let n=[];i.tagName.toLowerCase()==="slot"?n=i.assignedElements({flatten:!0}).filter(a=>a.getAttribute("identifier")===t):n=Array.from(i.querySelectorAll(`[identifier="${t}"]`)),e.push(...n)}),e}function Bh(o,t){let e=o.find(n=>n.getAttribute("identifier")===t);if(!e)return 1;let i=e.getAttribute("match-max");return i?parseInt(i,10)||0:1}var Ol={origin:{x:0,y:0},scale:{x:1,y:1}},Uo=100,Nm=o=>{let t=o.fullscreenElement??o.webkitFullscreenElement??null;for(;t instanceof HTMLElement;){let e=t.shadowRoot?.fullscreenElement??null;if(!e||e===t)break;t=e}return t instanceof HTMLElement?t:null},$m=o=>{let t=o.shadowRoot;return t?t.querySelector("slot:not([name])")?o:t:o},Lm=(o,t)=>{let e=t;for(;e;){if(e===o)return!0;e=e.parentNode??e.host??null}return!1},Ml=(o,t)=>{let e=o.ownerDocument??document,i=t??e.body,n=Nm(e);return n&&!Lm(n,i)?$m(n):i},Dl=o=>{let e=(o.ownerDocument??document).createElement("div");e.style.cssText=`position:fixed;left:0;top:0;width:${Uo}px;height:${Uo}px;margin:0;padding:0;border:0;visibility:hidden;pointer-events:none;`,o.appendChild(e);let i=e.getBoundingClientRect();return e.remove(),{origin:{x:i.left,y:i.top},scale:{x:i.width/Uo||1,y:i.height/Uo||1}}},Uh=(o,t,e)=>({x:(t-o.origin.x)/o.scale.x,y:(e-o.origin.y)/o.scale.y});$h()||Lh();var Hh=new WeakSet;function Vm(o){!o||Hh.has(o)||(o.addEventListener("touchmove",()=>{},{capture:!1,passive:!1}),Hh.add(o))}var Wh=o=>!!o.internals?.states,Ho=(o,t,e,i='slot[part="drags"]',n="pointerWithin")=>{class r extends o{constructor(){super(...arguments),this.trackedDraggables=[],this.trackedDroppables=[],this.trackedDragContainers=[],this.allDropzones=[],this.collisionDetectionAlgorithm=n,this.dragState={dragging:!1,dragSource:null,dragClone:null,startOffset:{x:0,y:0},currentTarget:null,sourceDroppable:null,inputType:null,returnAnchorItems:[]},this.cloneFrame=Ol,this.subscriptions=[],this.dragSubscriptions=[],this.lastPointerDownAt=0,this.lastTouchStartAt=0,this.#t=new Set,this.#e=new Set,this.#i=a=>{let l=a;if(l.context!==_i)return;let c=l.contextTarget;c instanceof HTMLElement&&this.#e.add(c)}}#t;isDragDropEnabled(){return!0}publishDraggablesSelector(){let a=this.isDragDropEnabled()?t:null;this._interactionContext.draggablesSelector!==a&&(this._interactionContext={...this._interactionContext,draggablesSelector:a})}connectedCallback(){super.connectedCallback(),this.addEventListener("context-request",this.#i,{capture:!0}),Vm(this.ownerDocument?.defaultView),this.publishDraggablesSelector(),this.setupDragDrop()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("context-request",this.#i,{capture:!0}),this.#e.clear(),this.cleanup()}async setupDragDrop(){await this.updateComplete,this.cacheInteractiveElements(),this.afterCache(),this.setupDragObservables()}afterCache(){}removeChipFromDroppable(a,l){l.remove()}#e;#i;registeredMatching(a){for(let l of this.#e)l.isConnected||this.#e.delete(l);return[...this.#e].filter(l=>l.matches(a))}cacheInteractiveElements(){let a=(S,R)=>Array.from(R?.querySelectorAll(S)??[]),l=a(t,this),c=a(t,this.shadowRoot),d=a('[qti-draggable="true"]:not([data-drag-clone])',this),h=a('[qti-draggable="true"]:not([data-drag-clone])',this.shadowRoot),f=this.registeredMatching(t);this.trackedDraggables=Array.from(new Set([...l,...c,...d,...h,...f]));let m=a(e,this),v=a(e,this.shadowRoot);this.trackedDroppables=Array.from(new Set([...m,...v]));let x=a(i,this),u=a(i,this.shadowRoot);this.trackedDragContainers=Array.from(new Set([...x,...u])),this.allDropzones=[...this.trackedDroppables,...this.trackedDragContainers];let g=this.isDragDropEnabled(),y=new Set(this.trackedDraggables),w=new Set(this.trackedDroppables),A=g?y:new Set,I=g?w:new Set,k=new Set([...y,...w].filter(Wh));for(let S of this.#t)k.has(S)||(S.internals.states.delete("drag"),S.internals.states.delete("droppable"));for(let S of k){let R=A.has(S),N=!R&&I.has(S);R?S.internals.states.add("drag"):S.internals.states.delete("drag"),N?S.internals.states.add("droppable"):S.internals.states.delete("droppable")}this.#t=k,this.trackedDraggables.forEach(S=>{let R=vi(S);g&&!R?(S.style.cursor="grab",S.style.userSelect="none",S.style.touchAction="none",S.style.webkitUserSelect="none",S.style.webkitTouchCallout="none",S.setAttribute("qti-draggable","true"),S.setAttribute("tabindex","0")):(S.style.cursor="",S.style.userSelect="",S.style.touchAction="",S.style.webkitUserSelect="",S.style.webkitTouchCallout="",S.removeAttribute("qti-draggable"),S.getAttribute("tabindex")==="0"&&S.removeAttribute("tabindex"))})}setupDragObservables(){let a=this.shadowRoot;if(!a){console.error("\u274C [Observable DnD] No shadow root found!");return}let l=a.when("pointerdown").filter(m=>{if(!m.isTrusted)return!1;let v=Le(m,t),x=this.disabled||this.readonly,u=an(v)||vi(v),g=Date.now()-this.lastTouchStartAt<50;return v&&m.isPrimary!==!1&&m.button===0&&!x&&!u&&!g}).subscribe(m=>{this.lastPointerDownAt=Date.now();let v=Le(m,t);if(!v){console.warn("\u26A0\uFE0F [Observable DnD] No draggable target found");return}m.pointerType==="touch"&&(m.preventDefault(),m.stopPropagation());let x=m.isTrusted?m.pointerType==="touch"?100:10:0;if(this.dragState.activationTimeout&&clearTimeout(this.dragState.activationTimeout),x===0){this.dragState.dragging||this.initiateDrag(v,m.clientX,m.clientY,m.pointerType,"pointer",m.pointerId,m.isTrusted);return}let u=()=>{this.dragState.activationTimeout&&(clearTimeout(this.dragState.activationTimeout),this.dragState.activationTimeout=void 0),document.removeEventListener("pointerup",u,!0),document.removeEventListener("pointercancel",u,!0)};document.addEventListener("pointerup",u,{once:!0,capture:!0}),document.addEventListener("pointercancel",u,{once:!0,capture:!0}),this.dragState.activationTimeout=window.setTimeout(()=>{this.dragState.activationTimeout=void 0,document.removeEventListener("pointerup",u,!0),document.removeEventListener("pointercancel",u,!0),this.dragState.dragging||this.initiateDrag(v,m.clientX,m.clientY,m.pointerType,"pointer",m.pointerId,m.isTrusted)},x)}),c=a.when("mousedown").filter(m=>{let v=Le(m,t),x=this.disabled||this.readonly,u=an(v)||vi(v),g=m.button===0,y=Date.now()-this.lastPointerDownAt<50;return v&&g&&!x&&!u&&!y}).subscribe(m=>{let v=Le(m,t);!v||this.dragState.dragging||(m.preventDefault(),this.initiateDrag(v,m.clientX,m.clientY,"mouse","mouse",void 0,m.isTrusted))}),d=a.when("touchstart").filter(m=>{let v=Le(m,t),x=this.disabled||this.readonly,u=an(v)||vi(v),g=!!(m.touches?.[0]||m.changedTouches?.[0]),y=Date.now()-this.lastPointerDownAt<50;return v&&g&&!x&&!u&&!y}).subscribe(m=>{let v=Le(m,t),x=m.touches?.[0]||m.changedTouches?.[0];!v||!x||this.dragState.dragging||(this.lastTouchStartAt=Date.now(),m.preventDefault(),m.stopPropagation(),this.initiateDrag(v,x.clientX,x.clientY,"touch","touch",void 0,m.isTrusted))}),h={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null},f=a.when("keydown").subscribe(m=>{let v=this.trackedDraggables.filter(u=>!vi(u)),x=[...this.trackedDroppables,...this.trackedDragContainers];if(h.dragging)switch(m.code){case"ArrowRight":case"ArrowDown":{m.preventDefault();let u=(h.dropIndex+1)%x.length;h={...h,dropIndex:u,dropElement:x[u]};break}case"ArrowLeft":case"ArrowUp":{m.preventDefault();let u=(h.dropIndex-1+x.length)%x.length;h={...h,dropIndex:u,dropElement:x[u]};break}case"Space":case"Enter":case"Tab":{m.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(u=>u.removeAttribute("data-keyboard-dragging")),this.saveResponse(),h={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null};break}case"Escape":{m.preventDefault(),this.trackedDraggables.forEach(u=>u.removeAttribute("data-keyboard-dragging")),h={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null};break}}else{let u=Le(m,t),g=this.disabled||this.readonly,y=an(u)||vi(u);u&&["Space","Enter"].includes(m.code)&&!g&&!y&&(m.preventDefault(),u.setAttribute("data-keyboard-dragging","true"),h={dragging:!0,dragElement:u,dragIndex:v.indexOf(u),dropIndex:0,dropElement:x[0]})}this.allDropzones.forEach(u=>u.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(l,c,d,f)}initiateDrag(a,l,c,d,h="pointer",f,m){if(this.dragState.dragging){console.warn("\u26A0\uFE0F [Observable DnD] Already dragging, ignoring initiateDrag");return}if(a.hasAttribute("data-drag-clone")){console.warn("\u26A0\uFE0F [Observable DnD] Attempted to drag visual clone, ignoring");return}let v=y=>y.contains(a)||!!y.shadowRoot?.contains(a),x=this.trackedDroppables.some(v),u=this.trackedDroppables.find(v)||null;a.getAnimations().forEach(y=>y.cancel());let g=a.getBoundingClientRect();if(this.dragState={dragging:!0,dragSource:a,dragClone:this.createDragClone(a,g),startOffset:{x:l-g.left,y:c-g.top},currentTarget:null,sourceDroppable:u,inputType:d,pointerId:f,startedFromTrustedEvent:m,initialCoordinates:{x:l,y:c},returnAnchorItems:[]},x){this.dragState.dragClone?.setAttribute("data-drag-origin","droppable"),this.removeChipFromDroppable(u,a),this.cacheInteractiveElements(),u&&u.setAttribute("data-drag-source","true");let y=a.getAttribute("identifier");if(y){let w=Yi(this.trackedDragContainers,y);w.forEach(A=>jt(A,"return-anchor",!0)),this.dragState.returnAnchorItems=w}}else this.dragState.dragClone?.setAttribute("data-drag-origin","inventory"),jt(a,"dragging",!0);this.updateClonePosition(l,c),this.activateAllDroppables(),this.watchDragCloneHost(),this.setupMoveObservables(d,h)}setupMoveObservables(a,l="pointer"){if(a==="touch"){if(l==="pointer")try{let w=this.dragState.dragSource,A=this.dragState.pointerId;w&&A!==void 0&&w.setPointerCapture&&w.setPointerCapture(A)}catch{}let g=w=>{w.cancelable&&(w.preventDefault(),l==="pointer"&&w.stopPropagation())};document.addEventListener("touchmove",g,{passive:!1,capture:!0}),document.addEventListener("touchstart",g,{passive:!1,capture:!0}),document.addEventListener("touchend",g,{passive:!1,capture:!0}),document.addEventListener("gesturestart",g,{passive:!1}),document.addEventListener("gesturechange",g,{passive:!1}),document.addEventListener("gestureend",g,{passive:!1});let y=()=>{if(document.removeEventListener("touchmove",g,{capture:!0}),document.removeEventListener("touchstart",g,{capture:!0}),document.removeEventListener("touchend",g,{capture:!0}),document.removeEventListener("gesturestart",g),document.removeEventListener("gesturechange",g),document.removeEventListener("gestureend",g),l==="pointer")try{let w=this.dragState.dragSource,A=this.dragState.pointerId;w&&A!==void 0&&w.releasePointerCapture&&w.releasePointerCapture(A)}catch{}};this.dragState.touchCleanup=y}let c=l==="mouse"?"mousemove":l==="touch"?"touchmove":"pointermove",d=l==="mouse"?"mouseup":l==="touch"?"touchend":"pointerup",h=g=>{let y=this.dragState.startedFromTrustedEvent;return y===void 0||g.isTrusted===y},f=document.when(c).takeUntil(document.when(d)).subscribe({next:g=>{if(h(g)){if(g.preventDefault(),g.stopPropagation(),l==="touch"){let y=g.touches?.[0]||g.changedTouches?.[0];if(!y)return;this.handleDragMove(y.clientX,y.clientY);return}if(l==="mouse"){let y=g;if(typeof y.buttons=="number"&&(y.buttons&1)!==1)return}this.handleDragMove(g.clientX,g.clientY)}}}),m=document.when(d).subscribe({next:g=>{h(g)&&(g.preventDefault(),g.stopPropagation(),this.handleDragEnd())}}),v=l==="touch"?document.when("touchcancel").subscribe({next:g=>{h(g)&&this.handleDragEnd()}}):l==="mouse"?null:document.when("pointercancel").subscribe({next:g=>{h(g)&&this.handleDragEnd()}}),x=document.when("keydown").filter(g=>g.key==="Escape").subscribe({next:g=>{h(g)&&this.handleDragEnd()}}),u=[f,m,x];v&&u.push(v),this.dragSubscriptions.push(...u)}handleDragMove(a,l){if(!this.dragState.dragging||!this.dragState.dragClone)return;this.updateClonePosition(a,l);let c=Xi(this.allDropzones,a,l,this.dragState.dragClone,this.collisionDetectionAlgorithm,this.trackedDragContainers),d=Date.now(),h=d-(this.dragState.lastTargetChangeTime||0);c!==this.dragState.currentTarget&&(c===null||h>=50)&&(this.allDropzones.forEach(m=>me(m,"hover",!1)),c&&me(c,"hover",!0),this.dragState.currentTarget=c,this.dragState.lastTargetChangeTime=d)}handleDragEnd(){if(!this.dragState.dragging)return;let{dragSource:a,dragClone:l,currentTarget:c,sourceDroppable:d}=this.dragState,h=c;if(l){let v=l.getBoundingClientRect();h=Xi(this.allDropzones,v.left+v.width/2,v.top+v.height/2,l,this.collisionDetectionAlgorithm,this.trackedDragContainers)??c}!!a&&!!h&&this.allowDrop(a,h)&&a&&h?(this.handleDrop(a,h),jt(a,"dragging",!1)):this.handleInvalidDrop(a),l&&l.remove(),(this.dragState.returnAnchorItems||[]).forEach(v=>{jt(v,"return-anchor",!1)}),this.dragState.touchCleanup&&this.dragState.touchCleanup(),this.resetDragState(),this.deactivateAllDroppables(),this.saveResponse(),d&&d.removeAttribute("data-drag-source"),this.cacheInteractiveElements();let m=this.checkAllMaxAssociations;typeof m=="function"&&m.call(this)}allowDrop(a,l){return this.trackedDroppables.includes(l)||this.trackedDragContainers.includes(l)}handleInvalidDrop(a){ln(a)}createDragClone(a,l){let c=a.cloneNode(!0),d=window.getComputedStyle(a);for(let f=0;f<d.length;f++){let m=d[f];c.style.setProperty(m,d.getPropertyValue(m))}let h=Ml(a.isConnected?a:this,this.dragCloneRoot());return this.cloneFrame=Dl(h),c.style.position="fixed",c.style.width=`${l.width/this.cloneFrame.scale.x}px`,c.style.height=`${l.height/this.cloneFrame.scale.y}px`,c.style.zIndex="9999",c.style.pointerEvents="none",c.style.touchAction="none",c.style.userSelect="none",c.style.opacity="0.8",c.removeAttribute("qti-draggable"),c.removeAttribute("tabindex"),c.setAttribute("data-drag-clone","true"),c.setAttribute("data-drag-interaction",this.tagName.toLowerCase()),h.appendChild(c),c}dragCloneRoot(){let a=this.getRootNode();return a instanceof ShadowRoot?a:null}updateClonePosition(a,l){if(this.dragState.lastCoordinates={x:a,y:l},!this.dragState.dragClone)return;let{startOffset:c}=this.dragState,{x:d,y:h}=Uh(this.cloneFrame,a-c.x,l-c.y);this.dragState.dragClone.style.left=`${d}px`,this.dragState.dragClone.style.top=`${h}px`}watchDragCloneHost(){let a=this.ownerDocument??document,l=()=>{let{dragClone:c,dragSource:d,lastCoordinates:h}=this.dragState;if(!c)return;let f=d?.isConnected?d:this,m=Ml(f,this.dragCloneRoot());m!==c.parentNode&&(m.appendChild(c),this.cloneFrame=Dl(m),h&&this.updateClonePosition(h.x,h.y))};a.addEventListener("fullscreenchange",l),a.addEventListener("webkitfullscreenchange",l),this.dragSubscriptions.push({unsubscribe:()=>{a.removeEventListener("fullscreenchange",l),a.removeEventListener("webkitfullscreenchange",l)}})}activateAllDroppables(){this.setInternalsState("dragzone-enabled",!0),this.setInternalsState("dragzone-active",!0),this.allDropzones.forEach(a=>{me(a,"enabled",!0),me(a,"active",!0)})}deactivateAllDroppables(){this.setInternalsState("dragzone-enabled",!1),this.setInternalsState("dragzone-active",!1),this.allDropzones.forEach(a=>{me(a,"enabled",!1),me(a,"active",!1),me(a,"hover",!1)})}resetDragState(){if(this.dragState.activationTimeout&&clearTimeout(this.dragState.activationTimeout),(this.dragState.returnAnchorItems||[]).forEach(a=>{jt(a,"return-anchor",!1)}),this.dragState.touchCleanup)try{this.dragState.touchCleanup()}catch(a){console.warn("\u26A0\uFE0F [Observable DnD] Error during touch cleanup:",a)}this.dragSubscriptions.forEach(a=>{try{a&&typeof a.unsubscribe=="function"&&a.unsubscribe()}catch(l){console.warn("\u26A0\uFE0F [Observable DnD] Error unsubscribing:",l)}}),this.dragSubscriptions=[],this.cloneFrame=Ol,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,returnAnchorItems:[]}}setInternalsState(a,l){let c=this._internals;c?.states&&(l?c.states.add(a):c.states.delete(a))}cleanup(){this.subscriptions.forEach(a=>{try{a.unsubscribe()}catch{}}),this.subscriptions=[],this.dragState.dragClone&&this.dragState.dragClone.remove();for(let a of this.#t)Wh(a)&&(a.internals.states.delete("drag"),a.internals.states.delete("droppable"));this.#t.clear(),this.resetDragState()}}return r};var Qh={duration:250,easing:"ease",fill:"both"};function Nl(o){let t=o.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}function Xh(o){return{left:o.left,top:o.top,width:o.width,height:o.height}}function Ve(o){let t=new Map;return o.forEach(e=>{t.set(e,Nl(e))}),t}function Gh(o,t){return{deltaX:o.left-t.left,deltaY:o.top-t.top,deltaW:o.width/t.width,deltaH:o.height/t.height}}function Wo(o){if(typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches)return 0;if(!o)return 1;let t=getComputedStyle(o).getPropertyValue("--qti-motion").trim();if(t==="")return 1;let e=Number.parseFloat(t);return Number.isFinite(e)&&e>0?e:0}function $l(o){return Wo(o)>0}function Qo(o,t,e={}){let i=Wo(o);if(i<=0)return null;let n=Nl(o),{deltaX:r,deltaY:s,deltaW:a,deltaH:l}=Gh(t,n);if(r===0&&s===0&&a===1&&l===1)return null;let{duration:c,easing:d,fill:h}={...Qh,...e};return o.animate([{transformOrigin:"top left",transform:`translate(${r}px, ${s}px) scale(${a}, ${l})`},{transformOrigin:"top left",transform:"none"}],{duration:c*i,easing:d,fill:h})}function ze(o,t={}){let e=new Map;return o.forEach((i,n)=>{if(!(n instanceof HTMLElement))return;let r=Qo(n,i,t);r&&e.set(n,r)}),e}var cn=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},Ft=(o,t,e,i='slot[part="drags"]',n="closestCornersWithInventoryPriority")=>{let r=Al(o,t,e,i),s=Ho(r,t,e,i,n);class a extends s{constructor(){super(...arguments),this.minAssociations=1,this._maxAssociations=0,this._maxAssociationsDefaultApplied=!1,this._response=[],this._dragDrop={dragsByTarget:{},countByTarget:{},nodesByTarget:{}},this.#t=new WeakMap,this._dropBlockedDueToMax=!1,this.flipAnimationConfig={duration:200,easing:"ease"},this._enableFlipAnimations=!0,this._pendingResponse=void 0}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 d=this._maxAssociations;this._maxAssociations=c,this.requestUpdate("maxAssociations",d)}#t;isSwapTarget(c){let d=this.dragState.sourceDroppable,h=parseInt(c.getAttribute("match-max")||"1",10);return(Number.isNaN(h)?1:h)===1&&this.isDeclarativeTarget(c)&&!!d&&d!==c&&this.trackedDroppables.includes(d)}isDeclarativeTarget(c){return c?c.acceptsDeclarativeDrops===!0?!0:c.hasAttribute("data-declarative-drops"):!1}chipsIn(c){return this.isDeclarativeTarget(c)?[...this.#t.get(c)??[]]:Array.from(c.querySelectorAll(t))}droppableHolding(c){return this.trackedDroppables.find(d=>this.chipsIn(d).includes(c)||d.contains(c)||!!d.shadowRoot?.contains(c))??null}placeChip(c,d){this.#t.set(c,[...this.#t.get(c)??[],d])}removeChipFromDroppable(c,d){let h=c??this.droppableHolding(d);if(h&&this.isDeclarativeTarget(h)){let f=(this.#t.get(h)??[]).filter(m=>m!==d);this.#t.set(h,f),f.length===0&&Gi(h,!1),this.syncDragDropState();return}d.remove()}clearChips(c){this.isDeclarativeTarget(c)?(this.#t.set(c,[]),this.syncDragDropState()):this.chipsIn(c).forEach(d=>d.remove()),Gi(c,!1)}syncDragDropState(){let c={},d={},h={};for(let f of this.trackedDroppables){let m=f.getAttribute("identifier");if(!m)continue;let v=this.chipsIn(f),x=this.isDeclarativeTarget(f)?v:Array.from(f.querySelectorAll('[qti-draggable="true"]'));c[m]=v.map(u=>u.getAttribute("identifier")).filter(u=>!!u),d[m]=Math.max(v.length,x.length),h[m]=v}this._dragDrop={dragsByTarget:c,countByTarget:d,nodesByTarget:h},this.requestUpdate()}responseFromState(){this.syncDragDropState();let{dragsByTarget:c}=this._dragDrop;return this.trackedDroppables.flatMap(d=>{let h=d.getAttribute("identifier");return h?(c[h]??[]).map(f=>`${f} ${h}`):[]})}totalAssociationsFromState(){return this.syncDragDropState(),Object.values(this._dragDrop.countByTarget).reduce((c,d)=>c+d,0)}droppableAtCapacityFromState(c){let d=parseInt(c.getAttribute("match-max")||"1",10),h=Number.isNaN(d)?1:d;if(h===0)return!1;let f=c.getAttribute("identifier");return(f?this._dragDrop.countByTarget[f]??0:0)>=h}set disableAnimations(c){this._enableFlipAnimations=!c}get disableAnimations(){return!this._enableFlipAnimations}get enableFlipAnimations(){return this._enableFlipAnimations&&$l(this)}collectAutoSizeTargets(){return{draggables:this.trackedDraggables,droppables:this.trackedDroppables,dragContainers:this.trackedDragContainers}}get response(){let c=this.getResponse,d=typeof c=="function"?c.call(this):void 0;return(Array.isArray(d)?d:(this.cacheInteractiveElements(),this.responseFromState())).join(",")}set response(c){if(Array.isArray(c)){if(!this.trackedDroppables||this.trackedDroppables.length===0){this._pendingResponse=c,this._internals.setFormValue(JSON.stringify(c));return}let d=this.getValue,h=typeof d=="function"?d.call(this,c):c,f=Array.isArray(h)?h:typeof h=="string"&&h.length>0?[h]:[];this.reset(!1),f.forEach(x=>this.placeResponse(x));let m=this.getResponse,v=typeof m=="function"?m.call(this):void 0;this._response=Array.isArray(v)?v:(this.cacheInteractiveElements(),this.responseFromState())}else this._response=typeof c=="string"&&c.length>0?[c]:[];this._internals.setFormValue(JSON.stringify(this._response))}afterCache(){if(this.updateMinDimensionsForDropZones(),this.applyConfiguredChoicesContainerWidth(),this._pendingResponse!==void 0){let c=this._pendingResponse;this._pendingResponse=void 0,this.response=c}}get autoSizeDropzoneWidth(){return!this.dataset.choicesContainerWidth}applyConfiguredChoicesContainerWidth(){let c=this.dataset.choicesContainerWidth;c&&this.trackedDroppables.forEach(d=>{d.style.width=`${c}px`,d.style.boxSizing="border-box"})}shouldTreatBlockedMaxAsInvalid(){return!0}shouldReturnToInventoryOnInventoryDrop(){return!1}getFirstMessageAttribute(c){for(let h of c){let f=this.getAttribute(h);if(f&&f.trim().length>0)return f}let d=c.map(h=>h.toLowerCase());for(let h of Array.from(this.attributes))if(d.includes(h.name.toLowerCase())&&h.value.trim().length>0)return h.value;return null}allowDrop(c,d){if(this.trackedDragContainers.includes(d))return!0;let h=this.trackedDroppables.includes(d),f=d.hasAttribute("disabled"),m=d.hasAttribute("data-drag-source");return f&&this.isSwapTarget(d)?!0:h&&(!f||m)}handleDrop(c,d){let h=this.dragState.dragClone?.getBoundingClientRect();this.dropDraggableInDroppable(c,d,h);let f=c.getAttribute("identifier");f&&this.updateInventoryBasedOnMatchMax(f),this.validate(),this.reportValidity()}handleInvalidDrop(c){let d=this.dragState.sourceDroppable,h=this.dragState.currentTarget,f=!h,m=this.trackedDragContainers[0]||null;if(!c)return;if(d&&f&&m)this.dropDraggableInDroppable(c,m);else if(d&&this.trackedDroppables.includes(d))this.dropDraggableInDroppable(c,d,this.dragState.dragClone?.getBoundingClientRect());else if(Bo(c,"dragging")){this.restoreInventoryItem(c,this.dragState.dragClone?.getBoundingClientRect());let g=c.getAttribute("identifier");g&&this.updateInventoryBasedOnMatchMax(g),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}let v=this.totalAssociationsFromState(),x=this.maxAssociations>0&&v>=this.maxAssociations,u=!!h&&h.hasAttribute("disabled")&&!h.hasAttribute("data-drag-source");this._dropBlockedDueToMax=u&&x,this.validate(),this.reportValidity()}animateReturn(c,d){!c||!d||!this.enableFlipAnimations||requestAnimationFrame(()=>{Qo(c,Xh(d),this.flipAnimationConfig)})}restoreInventoryItem(c,d){ln(c),c.style.display="",c.style.position="",this.animateReturn(c,d)}placeResponse(c){let[d,...h]=c.split(" ").reverse(),f=this.trackedDroppables.find(m=>m.getAttribute("identifier")===d);f&&h.forEach(m=>{if(!m)return;let x=Yi(this.trackedDragContainers,m).at(0)||this.trackedDraggables.find(u=>u.getAttribute("identifier")===m);x&&this.dropDraggableInDroppable(x,f)})}dropDraggableInDroppable(c,d,h){if(this.trackedDragContainers.includes(d)){if(!this.dragState.sourceDroppable){if(this.shouldReturnToInventoryOnInventoryDrop()){this.returnToInventory(c,h),this._dropBlockedDueToMax=!1,this.validate();return}this.restoreInventoryItem(c,h),this.cacheInteractiveElements(),this.checkAllMaxAssociations(),this._dropBlockedDueToMax=!1,this.validate();return}let A=c.getAttribute("identifier");this.removeChipFromDroppable(this.droppableHolding(c),c),A&&this.restoreOriginalInInventory(A,h),this.cacheInteractiveElements(),this.checkAllMaxAssociations(),this._dropBlockedDueToMax=!1,this.validate();return}let m=parseInt(d.getAttribute("match-max")||"1",10),v=Number.isNaN(m)?1:m,x=v===0||v>1,u=Array.from(d.querySelectorAll('[qti-draggable="true"]')),g=this.enableFlipAnimations&&u.length>0?Ve(u):null;if(!x){let A=this.chipsIn(d)[0]??(this.isDeclarativeTarget(d)?null:d.querySelector('[qti-draggable="true"]'));if(A){let I=A.getAttribute("identifier"),k=A.getBoundingClientRect();this.removeChipFromDroppable(d,A);let S=this.dragState.sourceDroppable,R=this.isDeclarativeTarget(d)&&S&&S!==d&&this.isDeclarativeTarget(S)?S:null;R?(this.placeChip(R,A),Gi(R,!0),this.animateReturn(A,k)):I&&this.restoreOriginalInInventory(I,k)}}let y=c.cloneNode(!0);y.removeAttribute("style"),y.removeAttribute("data-keyboard-dragging"),y.setAttribute("qti-draggable","true"),y.setAttribute("tabindex","0"),this.isDeclarativeTarget(d)?(y.setAttribute("part","drag"),y.setAttribute("exportparts","control: drag-control, label: drag-label, correction, correction-correct, correction-incorrect"),this.placeChip(d,y)):d.tagName==="SLOT"?y.setAttribute("slot",d.getAttribute("name")||""):(d.tagName==="QTI-SIMPLE-ASSOCIABLE-CHOICE"&&y.setAttribute("slot","qti-simple-associable-choice"),d.appendChild(y)),Gi(d,!0),this.syncDragDropState(),g&&this.enableFlipAnimations&&ze(g,this.flipAnimationConfig),h&&this.enableFlipAnimations&&requestAnimationFrame(()=>{let A=y.getBoundingClientRect(),I=h.left-A.left,k=h.top-A.top;(I!==0||k!==0)&&y.animate([{transform:`translate(${I}px, ${k}px)`,opacity:.8},{transform:"translate(0, 0)",opacity:1}],{duration:this.flipAnimationConfig.duration||200,easing:this.flipAnimationConfig.easing||"ease",fill:"both"})});let w=c.getAttribute("identifier");w&&this.updateInventoryBasedOnMatchMax(w),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}returnToInventory(c,d){let h=c.getAttribute("identifier");h&&(this.trackedDroppables.forEach(f=>{let m=this.chipsIn(f).filter(v=>v.getAttribute("identifier")===h);m.forEach(v=>this.removeChipFromDroppable(f,v)),m.length>0&&this.chipsIn(f).length===0&&Gi(f,!1)}),this.restoreOriginalInInventory(h,d)),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}restoreOriginalInInventory(c,d){let h=Yi(this.trackedDragContainers,c),f=new Set(h),m=[];this.trackedDragContainers.forEach(x=>{x.querySelectorAll('[qti-draggable="true"]').forEach(u=>!f.has(u)&&m.push(u))});let v=this.enableFlipAnimations&&m.length>0?Ve(m):null;h.forEach(x=>{ln(x),x.style.display="",x.style.visibility="visible"}),v&&this.enableFlipAnimations&&ze(v,this.flipAnimationConfig),h.forEach(x=>this.animateReturn(x,d))}updateInventoryBasedOnMatchMax(c){let d=Yi(this.trackedDragContainers,c),h=Bh(this.trackedDraggables,c),f=this.trackedDroppables.reduce((m,v)=>this.isDeclarativeTarget(v)?m+this.chipsIn(v).filter(x=>x.getAttribute("identifier")===c).length:m+v.querySelectorAll(`[identifier="${c}"]`).length,0);d.forEach(m=>{jt(m,"placeholder",h!==0&&f>=h)})}checkAllMaxAssociations(){let c=this.totalAssociationsFromState(),d=this.resolveDisableAfterMaxReached({defaultWhenUnset:!0}),h=this.maxAssociations>0&&c>=this.maxAssociations;this.trackedDroppables.forEach(f=>{let m=f.hasAttribute("data-drag-source");(this.droppableAtCapacityFromState(f)||d&&h)&&!m?f.setAttribute("disabled",""):f.removeAttribute("disabled")})}saveResponse(c){let d=this.getResponse,h=c??(typeof d=="function"?d.call(this):void 0),f=Array.isArray(h)?h:typeof h=="string"?[h]:(this.cacheInteractiveElements(),this.responseFromState());this._response=f,this._internals.setFormValue(JSON.stringify(this._response)),this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:f}})),this.requestUpdate()}reset(c=!0){this.trackedDroppables.forEach(d=>{this.clearChips(d)}),this.trackedDraggables.forEach(d=>{let h=d.getAttribute("identifier");h&&this.restoreOriginalInInventory(h)}),this.resetDragState(),this.cacheInteractiveElements(),this._response=[],this._internals.setFormValue(JSON.stringify(this._response)),c&&this.saveResponse()}validate(){let c=this.totalAssociationsFromState(),d=this.maxAssociations>0&&c>=this.maxAssociations,h=this.maxAssociations>0&&c>this.maxAssociations,f=this.minAssociations>0&&c<this.minAssociations,m="",v=!0;h?(m=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}.`,v=!1):d&&this._dropBlockedDueToMax&&this.shouldTreatBlockedMaxAsInvalid()?(m=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}.`,v=!1):f?(m=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"}.`,v=!1,this._dropBlockedDueToMax=!1):this._dropBlockedDueToMax=!1;let x=this.trackedDroppables[0]??this.trackedDraggables[0]??this;return this.setInteractionValidity(v,m,x,{suppressInline:!0}),v}reportValidity(){return super.reportValidity()}}return cn([p({type:Number,reflect:!0,attribute:"min-associations"})],a.prototype,"minAssociations",void 0),cn([p({type:Number,reflect:!0,attribute:"max-associations"})],a.prototype,"maxAssociations",null),cn([U({context:De})],a.prototype,"_dragDrop",void 0),cn([p({type:Boolean,attribute:"disable-animations"})],a.prototype,"disableAnimations",null),cn([p({attribute:"response",reflect:!1,noAccessor:!0,converter:Kt({emptyAs:[]})})],a.prototype,"response",null),a};var Xo=class{getInsertPosition(t,e,i,n,r){let s=t.indexOf(i);if(s===-1)return null;let a=i.getBoundingClientRect(),l=(r-a.top)/a.height,d=Math.min(1,Math.max(0,l))>.5;return{index:s,placeAfter:d}}};var Yh=new Xo;var zm={borderStyle:"2px dashed",borderColor:"var(--qti-drop-highlight-border-color, #c1c1c1)",background:"transparent",transitionDuration:150};function dn(){return{placeholder:null,lastHoverTarget:null,lastPlacement:null,sortContainer:null}}function Go(o){o.placeholder?.remove(),o.placeholder=null,o.lastHoverTarget=null,o.lastPlacement=null,o.sortContainer=null}function Yo(o,t,e={}){let i={...zm,...e},n=document.createElement("div");return n.setAttribute("data-drop-placeholder","true"),n.style.width=`${t.width}px`,n.style.height=`${t.height}px`,n.style.margin=window.getComputedStyle(o).margin,n.style.boxSizing="border-box",n.style.border=`${i.borderStyle} ${i.borderColor}`,n.style.borderRadius=getComputedStyle(o).borderRadius,n.style.background=i.background,n.style.transition=`transform ${i.transitionDuration*Wo(o)}ms ease`,n.style.pointerEvents="none",n}function Ll(o,t){for(let e of t)if(e.contains(o)&&e!==o)return e;return null}var Bt=(o,t='[qti-draggable="true"]')=>{class e extends o{constructor(){super(...arguments),this.#t=null,this.#e=null,this.#i=dn(),this.#r={hoveredSlot:null,originalPositions:new Map},this.#n=new Set,this.sortablePlaceholderConfig={},this.sortableAnimationConfig={duration:150,easing:"ease"}}#t;#e;#i;#r;#n;#o;set allowReorder(n){this.#o=n}get allowReorder(){return this.#o??this.resolveAllowReorder({defaultWhenUnset:!0})}get isDraggingFromSlot(){return this.#t!==null}findContainingDroppable(n){return Ll(n,this.trackedDroppables)}#s(n){return n.querySelector(t)}#a(n){let r=this.#c(n);return r===0||r>1}#c(n){let r=parseInt(n.getAttribute("match-max")||"1",10);return Number.isNaN(r)?1:r}#p(n){return n.querySelectorAll(t).length}#l(n){let r=this.#c(n);return r===0?!1:this.#p(n)>=r}#d(){this.#r={hoveredSlot:null,originalPositions:new Map}}#m(n){if(!this.#t||n===this.#t){this.#h();return}if(this.#r.hoveredSlot===n)return;this.#h();let r=this.#s(n);if(!r){this.#i.placeholder&&n.appendChild(this.#i.placeholder),this.#r.hoveredSlot=n;return}if(this.#a(n)){if(this.#l(n)){this.#i.placeholder&&this.#t&&this.#t.appendChild(this.#i.placeholder),this.#r.hoveredSlot=null;return}this.#i.placeholder&&n.appendChild(this.#i.placeholder),this.#r.hoveredSlot=n;return}if(this.isDeclarativeTarget(n)){this.#i.placeholder?.parentElement&&this.#i.placeholder.remove(),this.#r.hoveredSlot=n;return}let a=Ve([r]);this.#r.originalPositions.set(r,n),this.#i.placeholder&&this.#i.placeholder.parentElement&&this.#i.placeholder.remove(),this.#t.appendChild(r),this.#i.placeholder&&n.appendChild(this.#i.placeholder),this.#r.hoveredSlot=n,ze(a,this.sortableAnimationConfig)}#h(){if(this.#r.originalPositions.size===0&&this.#r.hoveredSlot===null)return;let n=Array.from(this.#r.originalPositions.keys()),r=n.length>0?Ve(n):null;for(let[s,a]of this.#r.originalPositions)a.appendChild(s);this.#i.placeholder&&this.#t&&this.#t.appendChild(this.#i.placeholder),r&&ze(r,this.sortableAnimationConfig),this.#r.originalPositions.clear(),this.#r.hoveredSlot=null}initiateDrag(n,r,s,a,...l){this.#t=null,this.#i=dn(),this.#d();let c=this.findContainingDroppable(n);if(this.#e=c,c&&this.allowReorder){this.#t=c,this.#i.sortContainer=c;let h=n.getBoundingClientRect();this.#i.placeholder=Yo(n,h,this.sortablePlaceholderConfig);let f=n.getAttribute("slot");f&&this.#i.placeholder.setAttribute("slot",f),this.#i.placeholder.style.visibility="hidden",c.appendChild(this.#i.placeholder),this.trackedDroppables.forEach(m=>{if(m!==c&&m.hasAttribute("disabled")){if(this.#a(m)&&this.#l(m))return;m.removeAttribute("disabled"),this.#n.add(m)}})}let[d]=l;super.initiateDrag(n,r,s,a,d)}cleanupSortableState(n=!0){if(n)for(let[r,s]of this.#r.originalPositions)s.appendChild(r);this.#i.placeholder&&this.#i.placeholder.remove(),Go(this.#i),this.#n.clear(),this.#t=null,this.#d()}onSortableDragMove(n,r){if(!this.isDraggingFromSlot)return;let s=Xi(this.trackedDroppables,n,r,this.dragState.dragClone,this.collisionDetectionAlgorithm);s?this.#m(s):this.#h()}handleDragMove(n,r){Object.getPrototypeOf(e.prototype).handleDragMove?.call(this,n,r),this.onSortableDragMove(n,r)}allowDrop(n,r){return!this.allowReorder&&this.#e&&!this.trackedDragContainers.includes(this.#e)&&r!==this.#e&&this.trackedDroppables.includes(r)?!1:this.isDraggingFromSlot&&this.trackedDroppables.includes(r)?this.#a(r)?!this.#l(r):!0:this.isDraggingFromSlot&&this.trackedDragContainers.includes(r)?!0:super.allowDrop(n,r)}handleDrop(n,r){super.handleDrop(n,r),this.cleanupSortableState(!1)}handleInvalidDrop(n){this.cleanupSortableState(),super.handleInvalidDrop(n)}}return e};var Kh=[P,H,Gt,q`
7008
7016
  :host {
7009
7017
  display: block; /* necessary to calculate scaling position */
7010
7018
  }
@@ -7057,9 +7065,9 @@ div.full-correct-response-inline {
7057
7065
  :host([answer-key]) ::slotted(qti-simple-associable-choice) {
7058
7066
  display: none;
7059
7067
  }
7060
- `];var Om=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Mm=jt(D,"qti-simple-associable-choice","[part~='drop']","slot[name='qti-simple-associable-choice']","pointerWithin"),yr=class extends Ft(Mm,'[qti-draggable="true"]'){static{this.styles=jh}constructor(){super(),this._childrenMap=[],this._registerChoiceHandler=this._registerChoice.bind(this),this.addEventListener("register-qti-simple-associable-choice",this._registerChoiceHandler)}_registerChoice(t){let e=t.composedPath()[0];if(this.shadowRoot?.contains(e))return;let r=e;this._childrenMap.includes(r)||(this._childrenMap=[...this._childrenMap,r])}#t(t,e){let r=this._dragDrop?.nodesByTarget?.[t]??[];return b`<div name=${e} part="drop" data-declarative-drops identifier=${t}>
7061
- ${W(r,n=>n.getAttribute("identifier"),n=>n)}
7062
- </div>`}get#e(){return this.maxAssociations>0?this.maxAssociations:Math.ceil(this._childrenMap.length/2)}getResponse(){let t=[];for(let e=0;e<this.#e;e++){let r=this.shadowRoot?.querySelector(`[part~='drop'][identifier="droplist${e}_left"]`),n=this.shadowRoot?.querySelector(`[part~='drop'][identifier="droplist${e}_right"]`),i=r&&this.chipsIn(r)[0]?.getAttribute("identifier"),s=n&&this.chipsIn(n)[0]?.getAttribute("identifier");i&&s&&t.push(`${i} ${s}`)}return t}totalAssociationsFromState(){return this.syncDragDropState(),this.getResponse().length}getValue(t){return t?.flatMap((e,r)=>{let n=e.split(" ");return n.length!==2?[]:[`${n[0]} droplist${r}_left`,`${n[1]} droplist${r}_right`]})??[]}render(){return b` <slot name="prompt"></slot>
7068
+ `];var Wm=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},Qm=Ft(D,"qti-simple-associable-choice","[part~='drop']","slot[name='qti-simple-associable-choice']","pointerWithin"),wi=class extends Bt(Qm,'[qti-draggable="true"]'){static{this.styles=Kh}constructor(){super(),this._childrenMap=[],this._registerChoiceHandler=this._registerChoice.bind(this),this.addEventListener("register-qti-simple-associable-choice",this._registerChoiceHandler)}_registerChoice(t){let e=t.composedPath()[0];if(this.shadowRoot?.contains(e))return;let i=e;this._childrenMap.includes(i)||(this._childrenMap=[...this._childrenMap,i])}#t(t,e){let i=this._dragDrop?.nodesByTarget?.[t]??[];return b`<div name=${e} part="drop" data-declarative-drops identifier=${t}>
7069
+ ${W(i,n=>n.getAttribute("identifier"),n=>n)}
7070
+ </div>`}get#e(){return this.maxAssociations>0?this.maxAssociations:Math.ceil(this._childrenMap.length/2)}getResponse(){let t=[];for(let e=0;e<this.#e;e++){let i=this.shadowRoot?.querySelector(`[part~='drop'][identifier="droplist${e}_left"]`),n=this.shadowRoot?.querySelector(`[part~='drop'][identifier="droplist${e}_right"]`),r=i&&this.chipsIn(i)[0]?.getAttribute("identifier"),s=n&&this.chipsIn(n)[0]?.getAttribute("identifier");r&&s&&t.push(`${r} ${s}`)}return t}totalAssociationsFromState(){return this.syncDragDropState(),this.getResponse().length}getValue(t){return t?.flatMap((e,i)=>{let n=e.split(" ");return n.length!==2?[]:[`${n[0]} droplist${i}_left`,`${n[1]} droplist${i}_right`]})??[]}render(){return b` <slot name="prompt"></slot>
7063
7071
  <slot part="drags" name="qti-simple-associable-choice"></slot>
7064
7072
  <div part="drops">
7065
7073
  ${this._childrenMap.length>0&&Array.from({length:this.#e},(t,e)=>b`<div part="drop-row">
@@ -7068,7 +7076,7 @@ div.full-correct-response-inline {
7068
7076
  </div>`)}
7069
7077
 
7070
7078
  <div role="alert" part="message" id="validation-message"></div>
7071
- </div>`}updated(t){super.updated(t),t.has("_childrenMap")&&this.cacheInteractiveElements()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("register-qti-simple-associable-choice",this._registerChoiceHandler)}};Om([T()],yr.prototype,"_childrenMap",void 0);var Ho=[{tag:"qti-associate-interaction",ctor:yr}];var Ve=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},ze=(o,t)=>{class e extends o{constructor(){super(...arguments),this._choiceElements=[],this.#t=null,this.minChoices=0,this.maxChoices=1,this._handleDisabledChange=(n,i)=>{this._choiceElements.forEach(s=>s.disabled=i)},this._handleReadonlyChange=(n,i)=>{this._choiceElements.forEach(s=>s.readonly=i)},this.response="",this._handleValueChange=()=>{this._internals.setFormValue(this.value),this._updateChoiceSelection()}}#t;_handleMaxChoicesChange(n,i){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||""}firstUpdated(){super.firstUpdated(),this._updateChoiceSelection()}connectedCallback(){super.connectedCallback(),this.addEventListener(`activate-${t}`,this._choiceElementSelectedHandler),this.#t=new MutationObserver(()=>this._syncChoicesFromDOM()),this.#t.observe(this,{childList:!0,subtree:!0}),this._syncChoicesFromDOM()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`activate-${t}`,this._choiceElementSelectedHandler),this.#t&&(this.#t.disconnect(),this.#t=null)}_syncChoicesFromDOM(){let n=new Set(this._choiceElements);this._choiceElements=Array.from(this.querySelectorAll(t)),this._choiceElements.forEach(s=>{n.has(s)||(this.disabled&&(s.disabled=!0),s.readonly=this.readonly,s.internals&&!s.internals.ariaChecked&&(s.internals.ariaChecked="false"))}),this._determineInputType();let i=new Set(this._choiceElements.map(s=>s.identifier));if(Array.isArray(this.response)){let s=this.response.filter(a=>i.has(a));s.length!==this.response.length&&(this.response=s)}else this.response&&!i.has(this.response)&&(this.response="");this._updateChoiceSelection()}validate(){let i=this._choiceElements.filter(c=>this._getChoiceChecked(c)).length,s=!0,a="";this.maxChoices!==0&&i>this.maxChoices?(s=!1,a=this.dataset.maxSelectionsMessage||`Please select no more than ${this.maxChoices} ${this.maxChoices===1?"option":"options"}.`):i<this.minChoices&&(s=!1,a=this.dataset.minSelectionsMessage||`Please select at least ${this.minChoices} ${this.minChoices===1?"option":"options"}.`);let l=this._choiceElements.find(c=>this.contains(c))||this;return this.setInteractionValidity(s,a,l,{suppressInline:!0}),s}reportValidity(){return super.reportValidity()}_determineInputType(){this._internals.role=this.maxChoices===1?"radiogroup":null;let n=this.maxChoices===1?"radio":"checkbox";this._interactionContext.choiceRole!==n&&(this._interactionContext={...this._interactionContext,choiceRole:n})}_choiceElementSelectedHandler(n){this._toggleChoiceChecked(n.target);let i=this.resolveDisableAfterMaxReached({defaultWhenUnset:!1});this.maxChoices===1?this._choiceElements.forEach(s=>{s.identifier!==n.detail.identifier&&this._setChoiceChecked(s,!1)}):this.maxChoices!==0&&i&&(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,i){n.internals?.states&&(i?(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 i=this._getChoiceChecked(n);this._setChoiceChecked(n,!i)}_handleChoiceSelection(){let i=this._choiceElements.filter(s=>this._getChoiceChecked(s)).map(s=>s.identifier);this.response=this.maxChoices===1?i[0]||"":i,this.validate(),this.reportValidity(),this.saveResponse(this.response)}_updateChoiceSelection(){let n=Array.isArray(this.response)?this.response:[this.response];this._choiceElements.forEach(i=>{let s=n.includes(i.identifier);this._setChoiceChecked(i,s)})}}return Ve([Er("#validation-message")],e.prototype,"_validationMessageElement",void 0),Ve([p({type:Number,attribute:"min-choices"})],e.prototype,"minChoices",void 0),Ve([p({type:Number,attribute:"max-choices"})],e.prototype,"maxChoices",void 0),Ve([L("maxChoices")],e.prototype,"_handleMaxChoicesChange",null),Ve([L("disabled",{waitUntilFirstUpdate:!0})],e.prototype,"_handleDisabledChange",void 0),Ve([L("readonly",{waitUntilFirstUpdate:!0})],e.prototype,"_handleReadonlyChange",void 0),Ve([p({attribute:"response",reflect:!1,converter:Yt({emptyAs:""})})],e.prototype,"response",void 0),Ve([L("response",{waitUntilFirstUpdate:!0})],e.prototype,"_handleValueChange",void 0),e};var Dm=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Fh=(o,t)=>{class e extends o{#t=[];#e=["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(n){this.#t=this.#n(n),this.#o()}get class(){return this.#t.join(" ")}attributeChangedCallback(n,i,s){super.attributeChangedCallback(n,i,s),n==="class"&&i!==s&&(this.class=s??"")}updated(n){super.updated(n),this.#o()}connectedCallback(){super.connectedCallback(),this.class=this.getAttribute("class")??"",this.#i=new MutationObserver(n=>{n.some(i=>i.type==="childList"||i.type==="attributes"&&i.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(n){return n?n.split(/\s+/).map(i=>i.trim()).filter(Boolean).filter((i,s,a)=>a.indexOf(i)===s):[]}#o(){let n=Array.from(this.querySelectorAll("qti-simple-choice")).map(l=>l),i=this.#s(n),s=this.#a(),a=this.#c();i.forEach((l,c)=>{l.marker=this.#p(c+1,s,a)})}#s(n){return n.map((i,s)=>{let a=Number(i.style.order);return{el:i,order:Number.isFinite(a)?a:s+1,index:s}}).sort((i,s)=>i.order-s.order||i.index-s.index).map(i=>i.el)}#a(){return this.#t.filter(n=>this.#e.includes(n)).pop()??null}#c(){return this.#t.filter(n=>this.#r.includes(n)).pop()??null}#p(n,i,s){let a=i;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=`${n}`;break;case"qti-labels-lower-alpha":l=this.#l(n,"lower");break;case"qti-labels-upper-alpha":l=this.#l(n,"upper");break}return s==="qti-labels-suffix-period"?`${l}.`:s==="qti-labels-suffix-parenthesis"?`${l})`:l}#l(n,i){let s=n,a="",l=i==="lower"?97:65;for(;s>0;)s-=1,a=String.fromCharCode(l+s%26)+a,s=Math.floor(s/26);return a}}return Dm([p({type:String,attribute:"class"})],e.prototype,"class",null),e};var Bh=[P,H,q`
7079
+ </div>`}updated(t){super.updated(t),t.has("_childrenMap")&&this.cacheInteractiveElements()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("register-qti-simple-associable-choice",this._registerChoiceHandler)}};Wm([T()],wi.prototype,"_childrenMap",void 0);var Ko=[{tag:"qti-associate-interaction",ctor:wi}];var je=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},Fe=(o,t)=>{class e extends o{constructor(){super(...arguments),this._choiceElements=[],this.#t=null,this.minChoices=0,this.maxChoices=1,this._handleDisabledChange=(n,r)=>{this._choiceElements.forEach(s=>s.disabled=r)},this._handleReadonlyChange=(n,r)=>{this._choiceElements.forEach(s=>s.readonly=r)},this.response="",this._handleValueChange=()=>{this._internals.setFormValue(this.value),this._updateChoiceSelection()}}#t;_handleMaxChoicesChange(n,r){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||""}firstUpdated(){super.firstUpdated(),this._updateChoiceSelection()}connectedCallback(){super.connectedCallback(),this.addEventListener(`activate-${t}`,this._choiceElementSelectedHandler),this.#t=new MutationObserver(()=>this._syncChoicesFromDOM()),this.#t.observe(this,{childList:!0,subtree:!0}),this._syncChoicesFromDOM()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`activate-${t}`,this._choiceElementSelectedHandler),this.#t&&(this.#t.disconnect(),this.#t=null)}_syncChoicesFromDOM(){let n=new Set(this._choiceElements);this._choiceElements=Array.from(this.querySelectorAll(t)),this._choiceElements.forEach(s=>{n.has(s)||(this.disabled&&(s.disabled=!0),s.readonly=this.readonly,s.internals&&!s.internals.ariaChecked&&(s.internals.ariaChecked="false"))}),this._determineInputType();let r=new Set(this._choiceElements.map(s=>s.identifier));if(Array.isArray(this.response)){let s=this.response.filter(a=>r.has(a));s.length!==this.response.length&&(this.response=s)}else this.response&&!r.has(this.response)&&(this.response="");this._updateChoiceSelection()}validate(){let r=this._choiceElements.filter(c=>this._getChoiceChecked(c)).length,s=!0,a="";this.maxChoices!==0&&r>this.maxChoices?(s=!1,a=this.dataset.maxSelectionsMessage||`Please select no more than ${this.maxChoices} ${this.maxChoices===1?"option":"options"}.`):r<this.minChoices&&(s=!1,a=this.dataset.minSelectionsMessage||`Please select at least ${this.minChoices} ${this.minChoices===1?"option":"options"}.`);let l=this._choiceElements.find(c=>this.contains(c))||this;return this.setInteractionValidity(s,a,l,{suppressInline:!0}),s}reportValidity(){return super.reportValidity()}_determineInputType(){this._internals.role=this.maxChoices===1?"radiogroup":null;let n=this.maxChoices===1?"radio":"checkbox";this._interactionContext.choiceRole!==n&&(this._interactionContext={...this._interactionContext,choiceRole:n})}_choiceElementSelectedHandler(n){this._toggleChoiceChecked(n.target);let r=this.resolveDisableAfterMaxReached({defaultWhenUnset:!1});this.maxChoices===1?this._choiceElements.forEach(s=>{s.identifier!==n.detail.identifier&&this._setChoiceChecked(s,!1)}):this.maxChoices!==0&&r&&(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,r){n.internals?.states&&(r?(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 r=this._getChoiceChecked(n);this._setChoiceChecked(n,!r)}_handleChoiceSelection(){let r=this._choiceElements.filter(s=>this._getChoiceChecked(s)).map(s=>s.identifier);this.response=this.maxChoices===1?r[0]||"":r,this.validate(),this.reportValidity(),this.saveResponse(this.response)}_updateChoiceSelection(){let n=Array.isArray(this.response)?this.response:[this.response];this._choiceElements.forEach(r=>{let s=n.includes(r.identifier);this._setChoiceChecked(r,s)})}}return je([Ai("#validation-message")],e.prototype,"_validationMessageElement",void 0),je([p({type:Number,attribute:"min-choices"})],e.prototype,"minChoices",void 0),je([p({type:Number,attribute:"max-choices"})],e.prototype,"maxChoices",void 0),je([L("maxChoices")],e.prototype,"_handleMaxChoicesChange",null),je([L("disabled",{waitUntilFirstUpdate:!0})],e.prototype,"_handleDisabledChange",void 0),je([L("readonly",{waitUntilFirstUpdate:!0})],e.prototype,"_handleReadonlyChange",void 0),je([p({attribute:"response",reflect:!1,converter:Kt({emptyAs:""})})],e.prototype,"response",void 0),je([L("response",{waitUntilFirstUpdate:!0})],e.prototype,"_handleValueChange",void 0),e};var Xm=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},Jh=(o,t)=>{class e extends o{#t=[];#e=["qti-labels-none","qti-labels-decimal","qti-labels-lower-alpha","qti-labels-upper-alpha"];#i=["qti-labels-suffix-none","qti-labels-suffix-period","qti-labels-suffix-parenthesis"];#r=null;set class(n){this.#t=this.#n(n),this.#o()}get class(){return this.#t.join(" ")}attributeChangedCallback(n,r,s){super.attributeChangedCallback(n,r,s),n==="class"&&r!==s&&(this.class=s??"")}updated(n){super.updated(n),this.#o()}connectedCallback(){super.connectedCallback(),this.class=this.getAttribute("class")??"",this.#r=new MutationObserver(n=>{n.some(r=>r.type==="childList"||r.type==="attributes"&&r.attributeName==="style")&&this.#o()}),this.#r.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]})}disconnectedCallback(){super.disconnectedCallback(),this.#r?.disconnect(),this.#r=null}#n(n){return n?n.split(/\s+/).map(r=>r.trim()).filter(Boolean).filter((r,s,a)=>a.indexOf(r)===s):[]}#o(){let n=Array.from(this.querySelectorAll("qti-simple-choice")).map(l=>l),r=this.#s(n),s=this.#a(),a=this.#c();r.forEach((l,c)=>{l.marker=this.#p(c+1,s,a)})}#s(n){return n.map((r,s)=>{let a=Number(r.style.order);return{el:r,order:Number.isFinite(a)?a:s+1,index:s}}).sort((r,s)=>r.order-s.order||r.index-s.index).map(r=>r.el)}#a(){return this.#t.filter(n=>this.#e.includes(n)).pop()??null}#c(){return this.#t.filter(n=>this.#i.includes(n)).pop()??null}#p(n,r,s){let a=r;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=`${n}`;break;case"qti-labels-lower-alpha":l=this.#l(n,"lower");break;case"qti-labels-upper-alpha":l=this.#l(n,"upper");break}return s==="qti-labels-suffix-period"?`${l}.`:s==="qti-labels-suffix-parenthesis"?`${l})`:l}#l(n,r){let s=n,a="",l=r==="lower"?97:65;for(;s>0;)s-=1,a=String.fromCharCode(l+s%26)+a,s=Math.floor(s/26);return a}}return Xm([p({type:String,attribute:"class"})],e.prototype,"class",null),e};var Zh=[P,H,q`
7072
7080
  :host {
7073
7081
  display: block;
7074
7082
  }
@@ -7135,16 +7143,16 @@ div.full-correct-response-inline {
7135
7143
  :host(.qti-orientation-vertical) ::slotted(qti-simple-choice:nth-child(even)) {
7136
7144
  grid-row: auto;
7137
7145
  }
7138
- `];var Nm=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},vr=class extends Fh(ze(D,"qti-simple-choice"),"qti-simple-choice"){constructor(){super(...arguments),this.orientation="vertical"}static{this.styles=Bh}#t(){let t=this.querySelectorAll("qti-simple-choice");this.style.setProperty("--item-count",t.length.toString())}render(){return b`
7146
+ `];var Gm=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},xi=class extends Jh(Fe(D,"qti-simple-choice"),"qti-simple-choice"){constructor(){super(...arguments),this.orientation="vertical"}static{this.styles=Zh}#t(){let t=this.querySelectorAll("qti-simple-choice");this.style.setProperty("--item-count",t.length.toString())}render(){return b`
7139
7147
  <slot part="prompt" name="prompt"></slot>
7140
7148
  <slot part="slot" @slotchange=${this.#t}></slot>
7141
7149
  <div part="message" role="alert" id="validation-message"></div>
7142
- `}};Nm([p({type:String})],vr.prototype,"orientation",void 0);var Wo=[{tag:"qti-choice-interaction",ctor:vr}];var Uh=[P,q`
7150
+ `}};Gm([p({type:String})],xi.prototype,"orientation",void 0);var Jo=[{tag:"qti-choice-interaction",ctor:xi}];var tp=[P,q`
7143
7151
  /* The box this element already had. See the note in qti-match-interaction.styles.ts. */
7144
7152
  :host {
7145
7153
  display: block;
7146
7154
  }
7147
- `];var ln=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Ol=`
7155
+ `];var hn=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},Vl=`
7148
7156
  const postToParentWindows = (type, data) => {
7149
7157
  window.top.postMessage(data ? { type, data } : { type }, '*');
7150
7158
  let w = window.parent;
@@ -7211,7 +7219,7 @@ window.CES = {
7211
7219
  },
7212
7220
  };
7213
7221
  CES.load();
7214
- `,$m=`
7222
+ `,Ym=`
7215
7223
  (function() {
7216
7224
  var blobUrlReceived = null;
7217
7225
 
@@ -7255,7 +7263,7 @@ CES.load();
7255
7263
  requestBlobUrl();
7256
7264
  }
7257
7265
  })();
7258
- `,ue=class extends D{#t;#e;#r;static{this.styles=Uh}constructor(){super(),this.#t="",this.#e=null,this.#r=null,this._errorMessage=null,this.#i=null,this.handlePostMessage=this.handlePostMessage.bind(this)}#i;connectedCallback(){super.connectedCallback();let t=this.data;if(!t){let r=this.querySelector("object[data]");if(r){t=r.getAttribute("data");let n=r.getAttribute("width"),i=r.getAttribute("height");n&&this.setAttribute("width",n),i&&this.setAttribute("height",i)}}if(!t){this._errorMessage="No manifest path found (neither data attribute nor object child)";return}let e=t.startsWith("http")||t.startsWith("blob")?t:Qn((this.baseItemUrl||"")+"/"+t);this.#e=new URL(e,window.location.href).toString(),fetch(e).then(r=>r.json()).then(r=>{this.manifest=r,this.setupCES()}).catch(r=>{this._errorMessage=r})}async setupCES(){await this.updateComplete;let t=this.shadowRoot?.querySelector("#pciContainer");if(!t){this._errorMessage="pciContainer iframe not found";return}t.getAttribute("src")||t.setAttribute("src","about:blank");let e=t.contentDocument??t.contentWindow?.document??null;if(e||(await new Promise(d=>t.addEventListener("load",()=>d(),{once:!0})),e=t.contentDocument??t.contentWindow?.document??null),!e){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 r=this.manifest.style[0],n=this.#a(),i=await this.#l(r,n),s=i.url;if(i.baseUrl&&!this.#r&&(this.#r=i.baseUrl),!0){let d="";if(this.manifest.media&&this.manifest.media.length>0){let h=this.manifest.media[0],f=await this.#l(h,n,{returnText:!0});if(d=f.url,f.baseUrl&&!this.#r&&(this.#r=f.baseUrl),f.text){let m=f.text;if(!(m.includes("postToParentWindows")||m.includes("window.CES"))){let u="<script>"+Ol+"</script>",g=m.indexOf("<head>");g!==-1?m=m.slice(0,g+6)+u+m.slice(g+6):m=u+m}let x=new Blob([m],{type:"text/html"});this.#i=URL.createObjectURL(x)}}else{let h=this.data||"manifest.json",f=h.includes("/")?h.substring(0,h.lastIndexOf("/")):"",m=f?`${f}/index.html`:"index.html",v=await this.#l(m,n,{returnText:!0});if(d=v.url,v.baseUrl&&!this.#r&&(this.#r=v.baseUrl),v.text){let x=v.text;if(!(x.includes("postToParentWindows")||x.includes("window.CES"))){let y="<script>"+Ol+"</script>",w=x.indexOf("<head>");w!==-1?x=x.slice(0,w+6)+y+x.slice(w+6):x=y+x}let g=new Blob([x],{type:"text/html"});this.#i=URL.createObjectURL(g)}}if(d&&!this.#i)try{let h=await fetch(d);if(h.ok){let f=await h.text();if(!(f.includes("postToParentWindows")||f.includes("window.CES"))){let x="<script>"+Ol+"</script>",u=f.indexOf("<head>");u!==-1?f=f.slice(0,u+6)+x+f.slice(u+6):f=x+f}let v=new Blob([f],{type:"text/html"});this.#i=URL.createObjectURL(v)}else console.error(`Failed to fetch index.html: ${h.status}`)}catch(h){console.error(`Error fetching index.html: ${h}`)}}let l=`<script>${$m}</script>`;window.addEventListener("message",this.handlePostMessage);let c=`
7266
+ `,fe=class extends D{#t;#e;#i;static{this.styles=tp}constructor(){super(),this.#t="",this.#e=null,this.#i=null,this._errorMessage=null,this.#r=null,this.handlePostMessage=this.handlePostMessage.bind(this)}#r;connectedCallback(){super.connectedCallback();let t=this.data;if(!t){let i=this.querySelector("object[data]");if(i){t=i.getAttribute("data");let n=i.getAttribute("width"),r=i.getAttribute("height");n&&this.setAttribute("width",n),r&&this.setAttribute("height",r)}}if(!t){this._errorMessage="No manifest path found (neither data attribute nor object child)";return}let e=t.startsWith("http")||t.startsWith("blob")?t:Yn((this.baseItemUrl||"")+"/"+t);this.#e=new URL(e,window.location.href).toString(),fetch(e).then(i=>i.json()).then(i=>{this.manifest=i,this.setupCES()}).catch(i=>{this._errorMessage=i})}async setupCES(){await this.updateComplete;let t=this.shadowRoot?.querySelector("#pciContainer");if(!t){this._errorMessage="pciContainer iframe not found";return}t.getAttribute("src")||t.setAttribute("src","about:blank");let e=t.contentDocument??t.contentWindow?.document??null;if(e||(await new Promise(d=>t.addEventListener("load",()=>d(),{once:!0})),e=t.contentDocument??t.contentWindow?.document??null),!e){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(),r=await this.#l(i,n),s=r.url;if(r.baseUrl&&!this.#i&&(this.#i=r.baseUrl),!0){let d="";if(this.manifest.media&&this.manifest.media.length>0){let h=this.manifest.media[0],f=await this.#l(h,n,{returnText:!0});if(d=f.url,f.baseUrl&&!this.#i&&(this.#i=f.baseUrl),f.text){let m=f.text;if(!(m.includes("postToParentWindows")||m.includes("window.CES"))){let u="<script>"+Vl+"</script>",g=m.indexOf("<head>");g!==-1?m=m.slice(0,g+6)+u+m.slice(g+6):m=u+m}let x=new Blob([m],{type:"text/html"});this.#r=URL.createObjectURL(x)}}else{let h=this.data||"manifest.json",f=h.includes("/")?h.substring(0,h.lastIndexOf("/")):"",m=f?`${f}/index.html`:"index.html",v=await this.#l(m,n,{returnText:!0});if(d=v.url,v.baseUrl&&!this.#i&&(this.#i=v.baseUrl),v.text){let x=v.text;if(!(x.includes("postToParentWindows")||x.includes("window.CES"))){let y="<script>"+Vl+"</script>",w=x.indexOf("<head>");w!==-1?x=x.slice(0,w+6)+y+x.slice(w+6):x=y+x}let g=new Blob([x],{type:"text/html"});this.#r=URL.createObjectURL(g)}}if(d&&!this.#r)try{let h=await fetch(d);if(h.ok){let f=await h.text();if(!(f.includes("postToParentWindows")||f.includes("window.CES"))){let x="<script>"+Vl+"</script>",u=f.indexOf("<head>");u!==-1?f=f.slice(0,u+6)+x+f.slice(u+6):f=x+f}let v=new Blob([f],{type:"text/html"});this.#r=URL.createObjectURL(v)}else console.error(`Failed to fetch index.html: ${h.status}`)}catch(h){console.error(`Error fetching index.html: ${h}`)}}let l=`<script>${Ym}</script>`;window.addEventListener("message",this.handlePostMessage);let c=`
7259
7267
  <!DOCTYPE html>
7260
7268
  <html>
7261
7269
  <head>
@@ -7264,7 +7272,7 @@ CES.load();
7264
7272
  </head>
7265
7273
  <body></body>
7266
7274
  </html>
7267
- `;t.srcdoc=c}#n(){let t=this.shadowRoot.querySelectorAll("iframe"),e=this.querySelectorAll("iframe"),r=[...t,...e];for(let n of r){let i=n.src;if(new URL(i,window.location.href).origin===window.location.origin)try{let a=n.contentDocument||n.contentWindow.document;a&&this.#o(a,r)}catch(a){console.error("Error accessing nested iframe:",a)}}return r.forEach((n,i)=>{r.indexOf(n)!==i&&r.splice(i,1)}),r}#o(t,e=[]){return t.querySelectorAll("iframe").forEach(n=>{e.push(n);let i=n.src;if(new URL(i,window.location.href).origin===window.location.origin)try{let a=n.contentDocument||n.contentWindow.document;this.#o(a,e)}catch(a){console.error("Error accessing nested iframe:",a)}else console.warn("Skipped cross-origin iframe:",i)}),e}#s(t,e){window.postMessage({type:t,data:e},"*");let r=this.#n();for(let n of r)n.contentWindow&&n.contentWindow.postMessage({type:t,data:e},"*")}handlePostMessage(t){let{type:e,data:r}=t.data;switch(e){case"setResponse":(r===null||!(Array.isArray(r)&&r.length===1&&r[0]===""))&&(this.#t=r,this.saveResponse(r));break;case"getResponse":{this.#s("responseData",this.#t);break}case"getBlobUrl":{this.#i&&(this.#s("blobUrl",this.#i),t.source&&t.source!==window&&t.source.postMessage({type:"blobUrl",data:this.#i},"*"));break}case"getMedia":{let n=this.#a(),i=this.manifest.media.map(s=>{if(s.startsWith("http")||s.startsWith("blob"))return s;let a=this.#r||n[0];return a?new URL(s,a.endsWith("/")?a:`${a}/`).toString():s});this.#s("mediaData",i);break}case"setStageHeight":console.log("setStageHeight not implemented");break}}validate(){if(!this.#t)return!1;if(Array.isArray(this.#t)){if(this.#t.length===0)return!1;for(let t of this.#t)if(t!==""&&t!==null)return!0}return!0}get response(){return this.#t||null}set response(t){if(typeof t=="string")this.#t=t,this.saveResponse(t);else if(Array.isArray(t))this.#t=t;else if(t)throw new Error("Value must be a string or an array of strings")}disconnectedCallback(){window.removeEventListener("message",this.handlePostMessage),super.disconnectedCallback()}render(){return b`<iframe
7275
+ `;t.srcdoc=c}#n(){let t=this.shadowRoot.querySelectorAll("iframe"),e=this.querySelectorAll("iframe"),i=[...t,...e];for(let n of i){let r=n.src;if(new URL(r,window.location.href).origin===window.location.origin)try{let a=n.contentDocument||n.contentWindow.document;a&&this.#o(a,i)}catch(a){console.error("Error accessing nested iframe:",a)}}return i.forEach((n,r)=>{i.indexOf(n)!==r&&i.splice(r,1)}),i}#o(t,e=[]){return t.querySelectorAll("iframe").forEach(n=>{e.push(n);let r=n.src;if(new URL(r,window.location.href).origin===window.location.origin)try{let a=n.contentDocument||n.contentWindow.document;this.#o(a,e)}catch(a){console.error("Error accessing nested iframe:",a)}else console.warn("Skipped cross-origin iframe:",r)}),e}#s(t,e){window.postMessage({type:t,data:e},"*");let i=this.#n();for(let n of i)n.contentWindow&&n.contentWindow.postMessage({type:t,data:e},"*")}handlePostMessage(t){let{type:e,data:i}=t.data;switch(e){case"setResponse":(i===null||!(Array.isArray(i)&&i.length===1&&i[0]===""))&&(this.#t=i,this.saveResponse(i));break;case"getResponse":{this.#s("responseData",this.#t);break}case"getBlobUrl":{this.#r&&(this.#s("blobUrl",this.#r),t.source&&t.source!==window&&t.source.postMessage({type:"blobUrl",data:this.#r},"*"));break}case"getMedia":{let n=this.#a(),r=this.manifest.media.map(s=>{if(s.startsWith("http")||s.startsWith("blob"))return s;let a=this.#i||n[0];return a?new URL(s,a.endsWith("/")?a:`${a}/`).toString():s});this.#s("mediaData",r);break}case"setStageHeight":console.log("setStageHeight not implemented");break}}validate(){if(!this.#t)return!1;if(Array.isArray(this.#t)){if(this.#t.length===0)return!1;for(let t of this.#t)if(t!==""&&t!==null)return!0}return!0}get response(){return this.#t||null}set response(t){if(typeof t=="string")this.#t=t,this.saveResponse(t);else if(Array.isArray(t))this.#t=t;else if(t)throw new Error("Value must be a string or an array of strings")}disconnectedCallback(){window.removeEventListener("message",this.handlePostMessage),super.disconnectedCallback()}render(){return b`<iframe
7268
7276
  width=${this.getAttribute("width")}
7269
7277
  height=${this.getAttribute("height")}
7270
7278
  frameborder="0"
@@ -7275,7 +7283,7 @@ CES.load();
7275
7283
  ${this._errorMessage&&b`<div style="color:red">
7276
7284
  <h1>Error</h1>
7277
7285
  ${this._errorMessage}
7278
- </div>`}`}#a(){let e=[this.#r,this.baseRefUrl,this.baseItemUrl,this.#c()].filter(Boolean).map(n=>new URL(n,window.location.href).toString()),r=this.#p();return r&&e.push(r),[...new Set(e)]}#c(){return this.#e?new URL(".",this.#e).toString():null}#p(){return this.#e?new URL("..",this.#e).toString():null}async#l(t,e,r={}){if(!t)return{url:"",baseUrl:null};if(t.startsWith("http")||t.startsWith("blob"))return{url:t,baseUrl:null};for(let n of e){let i=new URL(n,window.location.href).toString(),s=new URL(t,i.endsWith("/")?i:`${i}/`).toString();try{let a=await fetch(s);if(a.ok){if(r.returnText){let l=await a.text();return{url:s,baseUrl:i,text:l}}return{url:s,baseUrl:i}}}catch{}}return{url:"",baseUrl:null}}};ln([p({type:String,attribute:"data"})],ue.prototype,"data",void 0);ln([p({type:String,attribute:"data-base-item"})],ue.prototype,"baseItemUrl",void 0);ln([p({type:String,attribute:"data-base-ref"})],ue.prototype,"baseRefUrl",void 0);ln([p({type:String,attribute:"id"})],ue.prototype,"id",void 0);ln([T()],ue.prototype,"_errorMessage",void 0);var Qo=[{tag:"qti-custom-interaction",ctor:ue}];var Hh=[P];var Go=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},je=class extends C{constructor(){super(...arguments),this.disabled=!1,this.countAttempt=null,this.title="end attempt"}static{this.styles=Hh}render(){return b`<button ?disabled=${this.disabled} part="button" @click=${this.endAttempt}>${this.title}</button>`}endAttempt(t){this.dispatchEvent(new CustomEvent("end-attempt",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,countAttempt:this.countAttempt==="true"}}))}};Go([p({type:String,attribute:"response-identifier"})],je.prototype,"responseIdentifier",void 0);Go([p({reflect:!0,type:Boolean})],je.prototype,"disabled",void 0);Go([p({type:String,attribute:"count-attempt"})],je.prototype,"countAttempt",void 0);Go([p({type:String})],je.prototype,"title",void 0);var Xo=[{tag:"qti-end-attempt-interaction",ctor:je}];var Wh=[P,q`
7286
+ </div>`}`}#a(){let e=[this.#i,this.baseRefUrl,this.baseItemUrl,this.#c()].filter(Boolean).map(n=>new URL(n,window.location.href).toString()),i=this.#p();return i&&e.push(i),[...new Set(e)]}#c(){return this.#e?new URL(".",this.#e).toString():null}#p(){return this.#e?new URL("..",this.#e).toString():null}async#l(t,e,i={}){if(!t)return{url:"",baseUrl:null};if(t.startsWith("http")||t.startsWith("blob"))return{url:t,baseUrl:null};for(let n of e){let r=new URL(n,window.location.href).toString(),s=new URL(t,r.endsWith("/")?r:`${r}/`).toString();try{let a=await fetch(s);if(a.ok){if(i.returnText){let l=await a.text();return{url:s,baseUrl:r,text:l}}return{url:s,baseUrl:r}}}catch{}}return{url:"",baseUrl:null}}};hn([p({type:String,attribute:"data"})],fe.prototype,"data",void 0);hn([p({type:String,attribute:"data-base-item"})],fe.prototype,"baseItemUrl",void 0);hn([p({type:String,attribute:"data-base-ref"})],fe.prototype,"baseRefUrl",void 0);hn([p({type:String,attribute:"id"})],fe.prototype,"id",void 0);hn([T()],fe.prototype,"_errorMessage",void 0);var Zo=[{tag:"qti-custom-interaction",ctor:fe}];var ep=[P];var ts=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},Be=class extends C{constructor(){super(...arguments),this.disabled=!1,this.countAttempt=null,this.title="end attempt"}static{this.styles=ep}render(){return b`<button ?disabled=${this.disabled} part="button" @click=${this.endAttempt}>${this.title}</button>`}endAttempt(t){this.dispatchEvent(new CustomEvent("end-attempt",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,countAttempt:this.countAttempt==="true"}}))}};ts([p({type:String,attribute:"response-identifier"})],Be.prototype,"responseIdentifier",void 0);ts([p({reflect:!0,type:Boolean})],Be.prototype,"disabled",void 0);ts([p({type:String,attribute:"count-attempt"})],Be.prototype,"countAttempt",void 0);ts([p({type:String})],Be.prototype,"title",void 0);var es=[{tag:"qti-end-attempt-interaction",ctor:Be}];var ip=[P,q`
7279
7287
  /* PK: display host as block, else design will be collapsed */
7280
7288
  /* 'position: relative' anchors the correction glyph the theme draws over the textarea. */
7281
7289
  :host {
@@ -7288,7 +7296,7 @@ CES.load();
7288
7296
  height: 100%;
7289
7297
  border: 0;
7290
7298
  }
7291
- `];var bt=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Qh=5,Lm=50,Gh="qti-height-lines-",Xh=!1,Q=class extends D{constructor(){super(...arguments),this._rows=Qh,this.format="plain",this._handleFormatChange=()=>{this.format!=="xhtml"||Xh||(Xh=!0,console.warn('<qti-extended-text-interaction format="xhtml"> renders as plain text. The interaction has no rich-text editor; the recorded response will contain no markup.'))},this.minStrings=0,this.response=null,this._handleResponseChange=()=>{this._internals.setFormValue(this.value),this.validate()}}static{this.styles=Wh}_handleRowsInputChange(){this._rows=this.#t()}#t(){let t=this.#e();return t!==null?t:this.expectedLines>0?this.expectedLines:this.expectedLength>0?Math.ceil(this.expectedLength/Lm):Qh}#e(){for(let t of(this.classNames??"").split(" ")){if(!t.startsWith(Gh))continue;let e=parseInt(t.slice(Gh.length),10);if(!Number.isNaN(e)&&e>0)return e}return null}get value(){return this.response||null}set value(t){this.response=t||null}validate(){let t=this.shadowRoot.querySelector("textarea");if(!t)return!1;let e="",r=!1;if(this.patternMask&&this.dataPatternmaskMessage){t.setCustomValidity("");let n=this.patternMask.startsWith("^")&&this.patternMask.endsWith("$")?this.patternMask:`^${this.patternMask}$`,i=new RegExp(n);r=t.checkValidity()&&i.test(t.value),r||(e=this.dataPatternmaskMessage,t.setCustomValidity(this.dataPatternmaskMessage))}else r=t.checkValidity();return r&&!this.response&&this.minStrings>=1&&(r=!1),!r&&!e&&(e=t.validationMessage||"Invalid value."),this.setInteractionValidity(r,e,t,{suppressInline:!0}),r}reportValidity(){return this.validate(),super.reportValidity()}renderPrompt(){return b`<slot name="prompt"></slot>`}renderTextarea(){return b`<textarea
7299
+ `];var bt=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},rp=5,Km=50,np="qti-height-lines-",op=!1,Q=class extends D{constructor(){super(...arguments),this._rows=rp,this.format="plain",this._handleFormatChange=()=>{this.format!=="xhtml"||op||(op=!0,console.warn('<qti-extended-text-interaction format="xhtml"> renders as plain text. The interaction has no rich-text editor; the recorded response will contain no markup.'))},this.minStrings=0,this.response=null,this._handleResponseChange=()=>{this._internals.setFormValue(this.value),this.validate()}}static{this.styles=ip}_handleRowsInputChange(){this._rows=this.#t()}#t(){let t=this.#e();return t!==null?t:this.expectedLines>0?this.expectedLines:this.expectedLength>0?Math.ceil(this.expectedLength/Km):rp}#e(){for(let t of(this.classNames??"").split(" ")){if(!t.startsWith(np))continue;let e=parseInt(t.slice(np.length),10);if(!Number.isNaN(e)&&e>0)return e}return null}get value(){return this.response||null}set value(t){this.response=t||null}validate(){let t=this.shadowRoot.querySelector("textarea");if(!t)return!1;let e="",i=!1;if(this.patternMask&&this.dataPatternmaskMessage){t.setCustomValidity("");let n=this.patternMask.startsWith("^")&&this.patternMask.endsWith("$")?this.patternMask:`^${this.patternMask}$`,r=new RegExp(n);i=t.checkValidity()&&r.test(t.value),i||(e=this.dataPatternmaskMessage,t.setCustomValidity(this.dataPatternmaskMessage))}else i=t.checkValidity();return i&&!this.response&&this.minStrings>=1&&(i=!1),!i&&!e&&(e=t.validationMessage||"Invalid value."),this.setInteractionValidity(i,e,t,{suppressInline:!0}),i}reportValidity(){return this.validate(),super.reportValidity()}renderPrompt(){return b`<slot name="prompt"></slot>`}renderTextarea(){return b`<textarea
7292
7300
  part="textarea"
7293
7301
  name="${this.responseIdentifier}"
7294
7302
  spellcheck="false"
@@ -7303,7 +7311,7 @@ CES.load();
7303
7311
  ?disabled="${this.disabled}"
7304
7312
  ?readonly="${this.readonly}"
7305
7313
  .value=${this.response}
7306
- ></textarea>`}renderValidationMessage(){return b`<div id="validation-message" part="message" role="alert" style="display:none;"></div>`}render(){return b`${this.renderPrompt()}${this.renderTextarea()} ${this.renderValidationMessage()}`}textChanged(t){if(this.disabled||this.readonly)return;let e=t.target;this.response!==e.value&&(this.value=e.value,this.saveResponse(e.value))}};bt([T()],Q.prototype,"_rows",void 0);bt([p({type:Number,attribute:"expected-length"})],Q.prototype,"expectedLength",void 0);bt([p({type:Number,attribute:"expected-lines"})],Q.prototype,"expectedLines",void 0);bt([p({type:String,reflect:!0})],Q.prototype,"format",void 0);bt([L("format")],Q.prototype,"_handleFormatChange",void 0);bt([p({type:Number,attribute:"min-strings"})],Q.prototype,"minStrings",void 0);bt([p({type:String,attribute:"pattern-mask"})],Q.prototype,"patternMask",void 0);bt([p({type:String,attribute:"placeholder-text"})],Q.prototype,"placeholderText",void 0);bt([p({type:String,attribute:"data-patternmask-message"})],Q.prototype,"dataPatternmaskMessage",void 0);bt([p({type:String,attribute:"class"})],Q.prototype,"classNames",void 0);bt([L(["classNames","expectedLines","expectedLength"])],Q.prototype,"_handleRowsInputChange",null);bt([p({type:String,attribute:"response",reflect:!1})],Q.prototype,"response",void 0);bt([L("response",{waitUntilFirstUpdate:!0})],Q.prototype,"_handleResponseChange",void 0);var Yo=[{tag:"qti-extended-text-interaction",ctor:Q}];var Yh=[P,H,q`
7314
+ ></textarea>`}renderValidationMessage(){return b`<div id="validation-message" part="message" role="alert" style="display:none;"></div>`}render(){return b`${this.renderPrompt()}${this.renderTextarea()} ${this.renderValidationMessage()}`}textChanged(t){if(this.disabled||this.readonly)return;let e=t.target;this.response!==e.value&&(this.value=e.value,this.saveResponse(e.value))}};bt([T()],Q.prototype,"_rows",void 0);bt([p({type:Number,attribute:"expected-length"})],Q.prototype,"expectedLength",void 0);bt([p({type:Number,attribute:"expected-lines"})],Q.prototype,"expectedLines",void 0);bt([p({type:String,reflect:!0})],Q.prototype,"format",void 0);bt([L("format")],Q.prototype,"_handleFormatChange",void 0);bt([p({type:Number,attribute:"min-strings"})],Q.prototype,"minStrings",void 0);bt([p({type:String,attribute:"pattern-mask"})],Q.prototype,"patternMask",void 0);bt([p({type:String,attribute:"placeholder-text"})],Q.prototype,"placeholderText",void 0);bt([p({type:String,attribute:"data-patternmask-message"})],Q.prototype,"dataPatternmaskMessage",void 0);bt([p({type:String,attribute:"class"})],Q.prototype,"classNames",void 0);bt([L(["classNames","expectedLines","expectedLength"])],Q.prototype,"_handleRowsInputChange",null);bt([p({type:String,attribute:"response",reflect:!1})],Q.prototype,"response",void 0);bt([L("response",{waitUntilFirstUpdate:!0})],Q.prototype,"_handleResponseChange",void 0);var is=[{tag:"qti-extended-text-interaction",ctor:Q}];var sp=[P,H,q`
7307
7315
  :host {
7308
7316
  display: flex;
7309
7317
  align-items: flex-start;
@@ -7347,10 +7355,10 @@ CES.load();
7347
7355
  :host([answer-key]) [part~='drags'] {
7348
7356
  display: none;
7349
7357
  }
7350
- `];var Xr=class extends Ft(jt(D,"qti-gap-text","qti-gap","slot[part~='drags']"),'[qti-draggable="true"]'){static{this.styles=Yh}render(){return b`<slot name="prompt"> </slot>
7358
+ `];var Ki=class extends Bt(Ft(D,"qti-gap-text","qti-gap","slot[part~='drags']"),'[qti-draggable="true"]'){static{this.styles=sp}render(){return b`<slot name="prompt"> </slot>
7351
7359
  <slot part="drags" name="drags"></slot>
7352
7360
  <slot part="drops"></slot>
7353
- <div role="alert" part="message" id="validation-message"></div>`}};var Ko=[{tag:"qti-gap-match-interaction",ctor:Xr}];function tp(o){return o.querySelector('img, object[type^="image"]')}function Kh(o,t){let e=o.getAttribute(t)?.trim();if(!e||e.endsWith("%"))return null;let r=parseFloat(e);return Number.isFinite(r)&&r>0?r:null}var ep=new WeakMap,Jh=new WeakMap;function Vm(o){let t=Jh.get(o);return t||(t=new Promise(e=>{let r=o.data;if(!r){e(null);return}let n=new Image;n.onload=()=>{let i={width:n.naturalWidth,height:n.naturalHeight};if(!(i.width>0)||!(i.height>0)){e(null);return}ep.set(o,i),e(i)},n.onerror=()=>e(null),n.src=r}),Jh.set(o,t)),t}function zm(o){if(o.localName==="object")return ep.get(o)??null;let t=o;return t.naturalWidth>0&&t.naturalHeight>0?{width:t.naturalWidth,height:t.naturalHeight}:null}function Jo(o){let t=Kh(o,"width"),e=Kh(o,"height");if(t!==null&&e!==null)return{width:t,height:e};let r=zm(o);return r?{width:t??r.width,height:e??r.height}:null}function jm(o){let t=Jo(o);if(t)return Promise.resolve(t);if(o.localName==="object")return Vm(o).then(()=>Jo(o));let e=o;return e.complete?Promise.resolve(null):new Promise(r=>{let n=()=>{e.removeEventListener("load",n),e.removeEventListener("error",n),r(Jo(o))};e.addEventListener("load",n),e.addEventListener("error",n)})}function te(o,t,e,r){let n=Jo(e);if(n){Zh(o,t,n,r);return}jm(e).then(i=>{if(!i){console.error("Cannot position hotspots: the graphic has no usable width/height.",e);return}Zh(o,t,i,r)})}function Zh(o,t,{width:e,height:r},n){switch(o){case"circle":{if(t.length!==3){console.error("Invalid circle coordinates:",t);return}let[i,s,a]=t,l=i/e*100,c=s/r*100,d=a/e*100,h=a/r*100;n.style.left=l-d+"%",n.style.top=c-h+"%",n.style.width=2*d+"%",n.style.height=2*h+"%",n.style.borderRadius="50%"}break;case"rect":{if(t.length!==4){console.error("Invalid rectangle coordinates:",t);return}let[i,s,a,l]=t,c=i/e*100,d=s/r*100,h=a/e*100,f=l/r*100;n.style.left=c+"%",n.style.top=d+"%",n.style.width=h-c+"%",n.style.height=f-d+"%"}break;case"ellipse":{if(t.length!==4){console.error("Invalid ellipse coordinates:",t);return}let[i,s,a,l]=t,c=i/e*100,d=s/r*100,h=a/e*100,f=l/r*100;n.style.left=c-h+"%",n.style.top=d-f+"%",n.style.width=2*h+"%",n.style.height=2*f+"%",n.style.borderRadius="50%"}break;case"poly":{if(t.length<6||t.length%2!==0){console.error("Invalid polygon coordinates:",t);return}let i=[];for(let y=0;y<t.length;y+=2)i.push({x:t[y],y:t[y+1]});let s=Math.min(...i.map(y=>y.x)),a=Math.max(...i.map(y=>y.x)),l=Math.min(...i.map(y=>y.y)),c=Math.max(...i.map(y=>y.y)),d=s/e*100,h=l/r*100,f=a/e*100,m=c/r*100;n.style.left=d+"%",n.style.top=h+"%",n.style.width=f-d+"%",n.style.height=m-h+"%";let v=i.map(y=>({x:(y.x-s)/(a-s)*100,y:(y.y-l)/(c-l)*100})),x=v.map(y=>`${y.x}% ${y.y}%`).join(",");n.style.clipPath=`polygon(${x})`;let u=v.map(y=>`${y.x},${y.y}`).join(" "),g=y=>`url("data:image/svg+xml,${encodeURIComponent(`<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'><polygon points='${u}' fill='none' stroke='black' stroke-width='${y}' vector-effect='non-scaling-stroke' stroke-linejoin='round'/></svg>`)}")`;n.style.setProperty("--qti-shape-outline",g(4)),n.style.setProperty("--qti-shape-outline-bold",g(8))}break;case"default":n.style.left="0%",n.style.top="0%",n.style.width="100%",n.style.height="100%";break;default:console.error(`Unsupported shape: ${o}`);break}}var rp=[P,H,q`
7361
+ <div role="alert" part="message" id="validation-message"></div>`}};var rs=[{tag:"qti-gap-match-interaction",ctor:Ki}];function dp(o){return o.querySelector('img, object[type^="image"]')}function ap(o,t){let e=o.getAttribute(t)?.trim();if(!e||e.endsWith("%"))return null;let i=parseFloat(e);return Number.isFinite(i)&&i>0?i:null}var hp=new WeakMap,lp=new WeakMap;function Jm(o){let t=lp.get(o);return t||(t=new Promise(e=>{let i=o.data;if(!i){e(null);return}let n=new Image;n.onload=()=>{let r={width:n.naturalWidth,height:n.naturalHeight};if(!(r.width>0)||!(r.height>0)){e(null);return}hp.set(o,r),e(r)},n.onerror=()=>e(null),n.src=i}),lp.set(o,t)),t}function Zm(o){if(o.localName==="object")return hp.get(o)??null;let t=o;return t.naturalWidth>0&&t.naturalHeight>0?{width:t.naturalWidth,height:t.naturalHeight}:null}function ns(o){let t=ap(o,"width"),e=ap(o,"height");if(t!==null&&e!==null)return{width:t,height:e};let i=Zm(o);return i?{width:t??i.width,height:e??i.height}:null}function tf(o){let t=ns(o);if(t)return Promise.resolve(t);if(o.localName==="object")return Jm(o).then(()=>ns(o));let e=o;return e.complete?Promise.resolve(null):new Promise(i=>{let n=()=>{e.removeEventListener("load",n),e.removeEventListener("error",n),i(ns(o))};e.addEventListener("load",n),e.addEventListener("error",n)})}function ee(o,t,e,i){let n=ns(e);if(n){cp(o,t,n,i);return}tf(e).then(r=>{if(!r){console.error("Cannot position hotspots: the graphic has no usable width/height.",e);return}cp(o,t,r,i)})}function cp(o,t,{width:e,height:i},n){switch(o){case"circle":{if(t.length!==3){console.error("Invalid circle coordinates:",t);return}let[r,s,a]=t,l=r/e*100,c=s/i*100,d=a/e*100,h=a/i*100;n.style.left=l-d+"%",n.style.top=c-h+"%",n.style.width=2*d+"%",n.style.height=2*h+"%",n.style.borderRadius="50%"}break;case"rect":{if(t.length!==4){console.error("Invalid rectangle coordinates:",t);return}let[r,s,a,l]=t,c=r/e*100,d=s/i*100,h=a/e*100,f=l/i*100;n.style.left=c+"%",n.style.top=d+"%",n.style.width=h-c+"%",n.style.height=f-d+"%"}break;case"ellipse":{if(t.length!==4){console.error("Invalid ellipse coordinates:",t);return}let[r,s,a,l]=t,c=r/e*100,d=s/i*100,h=a/e*100,f=l/i*100;n.style.left=c-h+"%",n.style.top=d-f+"%",n.style.width=2*h+"%",n.style.height=2*f+"%",n.style.borderRadius="50%"}break;case"poly":{if(t.length<6||t.length%2!==0){console.error("Invalid polygon coordinates:",t);return}let r=[];for(let y=0;y<t.length;y+=2)r.push({x:t[y],y:t[y+1]});let s=Math.min(...r.map(y=>y.x)),a=Math.max(...r.map(y=>y.x)),l=Math.min(...r.map(y=>y.y)),c=Math.max(...r.map(y=>y.y)),d=s/e*100,h=l/i*100,f=a/e*100,m=c/i*100;n.style.left=d+"%",n.style.top=h+"%",n.style.width=f-d+"%",n.style.height=m-h+"%";let v=r.map(y=>({x:(y.x-s)/(a-s)*100,y:(y.y-l)/(c-l)*100})),x=v.map(y=>`${y.x}% ${y.y}%`).join(",");n.style.clipPath=`polygon(${x})`;let u=v.map(y=>`${y.x},${y.y}`).join(" "),g=y=>`url("data:image/svg+xml,${encodeURIComponent(`<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'><polygon points='${u}' fill='none' stroke='black' stroke-width='${y}' vector-effect='non-scaling-stroke' stroke-linejoin='round'/></svg>`)}")`;n.style.setProperty("--qti-shape-outline",g(4)),n.style.setProperty("--qti-shape-outline-bold",g(8))}break;case"default":n.style.left="0%",n.style.top="0%",n.style.width="100%",n.style.height="100%";break;default:console.error(`Unsupported shape: ${o}`);break}}var pp=[P,H,q`
7354
7362
  /* Containing block for the absolutely positioned hotspots over the image. Was on this host in
7355
7363
  the theme, together with a 'display: block' this component now owns. */
7356
7364
  :host {
@@ -7380,14 +7388,14 @@ CES.load();
7380
7388
  top: 0px;
7381
7389
  left: 0px;
7382
7390
  }
7383
- `];var cn=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Bt=class extends D{static{this.styles=rp}#t;#e;#r;constructor(){super(),this.#t=[],this.#e=null,this.#r=null,this._response=[],this.addEventListener("qti-register-hotspot",this.#o)}reset(){this._response=[]}validate(){return this.#n().length>0}set response(t){this._response=this.#i(t)}get response(){return this._response}#i(t){return t==null||t===""?[]:Array.isArray(t)?t:[t]}#n(){return this.#i(this._response)}renderSupplementalLines(){return O}render(){return b`<slot name="prompt"></slot>
7391
+ `];var pn=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},Ut=class extends D{static{this.styles=pp}#t;#e;#i;constructor(){super(),this.#t=[],this.#e=null,this.#i=null,this._response=[],this.addEventListener("qti-register-hotspot",this.#o)}reset(){this._response=[]}validate(){return this.#n().length>0}set response(t){this._response=this.#r(t)}get response(){return this._response}#r(t){return t==null||t===""?[]:Array.isArray(t)?t:[t]}#n(){return this.#r(this._response)}renderSupplementalLines(){return O}render(){return b`<slot name="prompt"></slot>
7384
7392
  <line-container>
7385
7393
  <svg
7386
7394
  width=${Z(this.grImage[0]?.width)}
7387
7395
  height=${Z(this.grImage[0]?.height)}
7388
7396
  viewbox="0 0 ${this.grImage[0]?.width} ${this.grImage[0]?.height}"
7389
7397
  >
7390
- ${W(this.#n(),t=>t,(t,e)=>_i`
7398
+ ${W(this.#n(),t=>t,(t,e)=>Rr`
7391
7399
  <line
7392
7400
  part="line"
7393
7401
  x1=${parseInt(this.querySelector(`[identifier=${t.split(" ")[0]}]`).style.left)}
@@ -7396,11 +7404,11 @@ CES.load();
7396
7404
  y2=${parseInt(this.querySelector(`[identifier=${t.split(" ")[1]}]`).style.top)}
7397
7405
  stroke="red"
7398
7406
  stroke-width="3"
7399
- @click=${r=>{r.stopPropagation(),this._response=this._response.filter((n,i)=>i!==e),this.saveResponse(this.response)}}
7407
+ @click=${i=>{i.stopPropagation(),this._response=this._response.filter((n,r)=>r!==e),this.saveResponse(this.response)}}
7400
7408
  />
7401
7409
  `)}
7402
7410
  ${this.renderSupplementalLines()}
7403
- ${this.#e&&_i`<line
7411
+ ${this.#e&&Rr`<line
7404
7412
  part="point"
7405
7413
  x1=${this.startCoord.x}
7406
7414
  y1=${this.startCoord.y}
@@ -7412,7 +7420,7 @@ CES.load();
7412
7420
  </svg>
7413
7421
  <slot></slot>
7414
7422
  </line-container>
7415
- <div role="alert" part="message" id="validation-message"></div>`}#o(t){let e=this.querySelector("img"),r=t.target,n=r.getAttribute("coords"),i=r.getAttribute("shape"),s=n.split(",").map(a=>parseInt(a));te(i,s,e,r)}firstUpdated(){super.firstUpdated(),this.#t=Array.from(this.querySelectorAll("qti-associable-hotspot")),this.addEventListener("mousemove",t=>{let e=this.grImage[0];if(!e)return;let r=e.getBoundingClientRect();this.mouseCoord={x:t.clientX-r.left,y:t.clientY-r.top}}),this.#t.forEach(t=>{t.style.left=t.getAttribute("coords").split(",")[0]+"px",t.style.top=t.getAttribute("coords").split(",")[1]+"px",t.addEventListener("click",e=>{this.#e?this.#r||(this.#r=e.target,this._response=this.#n(),this._response=[...this._response,`${this.#e.getAttribute("identifier")} ${this.#r.getAttribute("identifier")}`],this.saveResponse(this.response),this.#e=null,this.#r=null):(this.#e=e.target,this.startCoord={x:parseInt(this.#e.getAttribute("coords").split(",")[0]),y:parseInt(this.#e.getAttribute("coords").split(",")[1])})})})}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.#o)}};cn([T()],Bt.prototype,"startCoord",void 0);cn([T()],Bt.prototype,"mouseCoord",void 0);cn([zc({selector:"img"})],Bt.prototype,"grImage",void 0);cn([T()],Bt.prototype,"_response",void 0);cn([p({attribute:"response",reflect:!1,noAccessor:!0,converter:Yt({emptyAs:[]})})],Bt.prototype,"response",null);var Zo=[{tag:"qti-graphic-associate-interaction",ctor:Bt}];var ip=[P,H,q`
7423
+ <div role="alert" part="message" id="validation-message"></div>`}#o(t){let e=this.querySelector("img"),i=t.target,n=i.getAttribute("coords"),r=i.getAttribute("shape"),s=n.split(",").map(a=>parseInt(a));ee(r,s,e,i)}firstUpdated(){super.firstUpdated(),this.#t=Array.from(this.querySelectorAll("qti-associable-hotspot")),this.addEventListener("mousemove",t=>{let e=this.grImage[0];if(!e)return;let i=e.getBoundingClientRect();this.mouseCoord={x:t.clientX-i.left,y:t.clientY-i.top}}),this.#t.forEach(t=>{t.style.left=t.getAttribute("coords").split(",")[0]+"px",t.style.top=t.getAttribute("coords").split(",")[1]+"px",t.addEventListener("click",e=>{this.#e?this.#i||(this.#i=e.target,this._response=this.#n(),this._response=[...this._response,`${this.#e.getAttribute("identifier")} ${this.#i.getAttribute("identifier")}`],this.saveResponse(this.response),this.#e=null,this.#i=null):(this.#e=e.target,this.startCoord={x:parseInt(this.#e.getAttribute("coords").split(",")[0]),y:parseInt(this.#e.getAttribute("coords").split(",")[1])})})})}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.#o)}};pn([T()],Ut.prototype,"startCoord",void 0);pn([T()],Ut.prototype,"mouseCoord",void 0);pn([Wc({selector:"img"})],Ut.prototype,"grImage",void 0);pn([T()],Ut.prototype,"_response",void 0);pn([p({attribute:"response",reflect:!1,noAccessor:!0,converter:Kt({emptyAs:[]})})],Ut.prototype,"response",null);var os=[{tag:"qti-graphic-associate-interaction",ctor:Ut}];var up=[P,H,q`
7416
7424
  :host {
7417
7425
  display: flex;
7418
7426
  align-items: flex-start;
@@ -7497,10 +7505,10 @@ CES.load();
7497
7505
  user-select: none;
7498
7506
  pointer-events: none;
7499
7507
  }
7500
- `];var Fm=jt(D,"qti-gap-img, qti-gap-text","qti-associable-hotspot","slot[part~='drags']"),Yr=class extends Ft(Fm,'[qti-draggable="true"]'){static{this.styles=ip}render(){return b` <slot name="prompt"></slot>
7508
+ `];var ef=Ft(D,"qti-gap-img, qti-gap-text","qti-associable-hotspot","slot[part~='drags']"),Ji=class extends Bt(ef,'[qti-draggable="true"]'){static{this.styles=up}render(){return b` <slot name="prompt"></slot>
7501
7509
  <slot part="image"></slot>
7502
7510
  <slot part="drags" name="drags" class="hover-border"></slot>
7503
- <div role="alert" part="message" id="validation-message"></div>`}shouldReturnToInventoryOnInventoryDrop(){return!0}#t(){return this.querySelector(':scope > img, :scope > object[type^="image"]')}#e(t){if(t.style.aspectRatio)return;let e=i=>{let s=(t.getAttribute(i)??"").trim(),a=parseFloat(s);return s.endsWith("%")||!(a>0)?null:a},r=e("width"),n=e("height");r&&n&&(t.style.aspectRatio=`${r} / ${n}`)}#r(t){let e=this.#t(),r=t.getAttribute("coords"),n=t.getAttribute("shape");!e||!r||!n||(this.#e(e),te(n,r.split(",").map(i=>parseFloat(i)),e,t))}#i=t=>{this.#r(t.target)};connectedCallback(){super.connectedCallback(),this.addEventListener("qti-register-hotspot",this.#i),this.querySelectorAll(":scope > qti-associable-hotspot").forEach(t=>this.#r(t))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.#i)}};var ts=[{tag:"qti-graphic-gap-match-interaction",ctor:Yr}];var np=[P,H,q`
7511
+ <div role="alert" part="message" id="validation-message"></div>`}shouldReturnToInventoryOnInventoryDrop(){return!0}#t(){return this.querySelector(':scope > img, :scope > object[type^="image"]')}#e(t){if(t.style.aspectRatio)return;let e=r=>{let s=(t.getAttribute(r)??"").trim(),a=parseFloat(s);return s.endsWith("%")||!(a>0)?null:a},i=e("width"),n=e("height");i&&n&&(t.style.aspectRatio=`${i} / ${n}`)}#i(t){let e=this.#t(),i=t.getAttribute("coords"),n=t.getAttribute("shape");!e||!i||!n||(this.#e(e),ee(n,i.split(",").map(r=>parseFloat(r)),e,t))}#r=t=>{this.#i(t.target)};connectedCallback(){super.connectedCallback(),this.addEventListener("qti-register-hotspot",this.#r),this.querySelectorAll(":scope > qti-associable-hotspot").forEach(t=>this.#i(t))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.#r)}};var ss=[{tag:"qti-graphic-gap-match-interaction",ctor:Ji}];var mp=[P,H,q`
7504
7512
  /* The order pins are anchored outside their hotspot's box. */
7505
7513
  :host {
7506
7514
  /* The box this element already had. See the note in qti-match-interaction.styles.ts. */
@@ -7538,11 +7546,11 @@ CES.load();
7538
7546
  pointer-events: none;
7539
7547
  user-select: none;
7540
7548
  }
7541
- `];var op=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Fe=class o extends ze(D,"qti-hotspot-choice"){constructor(){super(...arguments),this.maxChoices=0,this._choiceElements=[],this.#n=t=>{this.#i(t.target),this.refreshLocatorPins()}}static{this.styles=np}static#t="cito-graphic-order-marker";render(){return b`
7549
+ `];var fp=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},Ue=class o extends Fe(D,"qti-hotspot-choice"){constructor(){super(...arguments),this.maxChoices=0,this._choiceElements=[],this.#n=t=>{this.#r(t.target),this.refreshLocatorPins()}}static{this.styles=mp}static#t="cito-graphic-order-marker";render(){return b`
7542
7550
  <slot name="prompt"></slot>
7543
7551
  <slot></slot>
7544
7552
  <div role="alert" part="message" id="validation-message"></div>
7545
- `}_choiceElementSelectedHandler(t){let{identifier:e}=t.detail;if(!this._choiceElements.some(i=>i.identifier===e))return;let r=[...this.#e()],n=r.indexOf(e);if(n>=0)r.splice(n,1);else{let i=this.maxChoices>0?this.maxChoices:this._choiceElements.length;if(r.length>=i)return;r.push(e)}this.response=r,this.validate(),this.reportValidity(),this.saveResponse(this.response)}#e(){return Array.isArray(this.response)?this.response:this.response?[this.response]:[]}handleOrderedResponseChange(){this.refreshLocatorPins()}#r(t){return`--qti-graphic-order-${(t.identifier||t.getAttribute("identifier")||"hotspot").toLowerCase().replace(/[^a-z0-9_-]/g,"-")}`}resolvePinColor(t){return"var(--qti-selected-bg)"}refreshLocatorPins(){let t=this.#e();for(let i of this._choiceElements){let s=t.indexOf(i.identifier);i.order=s>=0?s+1:null}let e=this._choiceElements.filter(i=>i.order!=null).sort((i,s)=>i.order-s.order),r=Array.from(this.querySelectorAll(`.${o.#t}`));r.length===e.length&&e.every((i,s)=>{let a=r[s];return a.textContent===String(i.order)&&a.style.getPropertyValue("position-anchor")===this.#r(i)&&a.style.getPropertyValue("--qti-graphic-order-pin-color")===this.resolvePinColor(i)})||(r.forEach(i=>i.remove()),this._choiceElements.forEach(i=>{i.style.removeProperty("anchor-name")}),e.forEach(i=>{let s=this.#r(i);i.style.setProperty("anchor-name",s);let a=document.createElement("span");a.className=o.#t,a.style.setProperty("position-anchor",s),a.style.setProperty("--qti-graphic-order-pin-color",this.resolvePinColor(i)),i.getAttribute("shape")==="poly"&&a.classList.add("cito-graphic-order-marker--poly"),a.setAttribute("aria-hidden","true"),a.textContent=String(i.order),this.append(a)}))}#i(t){let e=tp(this),r=t.getAttribute("coords"),n=t.getAttribute("shape");if(!e){console.error('No <img> or <object type="image/*"> found in <qti-graphic-order-interaction>.');return}let i=r.split(",").map(s=>parseInt(s));te(n,i,e,t)}#n;connectedCallback(){super.connectedCallback(),this.addEventListener("register-qti-hotspot-choice",this.#n),this.refreshLocatorPins(),this.querySelectorAll("qti-hotspot-choice").forEach(t=>this.#i(t))}disconnectedCallback(){this.querySelectorAll(`.${o.#t}`).forEach(t=>t.remove()),super.disconnectedCallback(),this.removeEventListener("register-qti-hotspot-choice",this.#n)}};op([p({type:Number,attribute:"max-choices"})],Fe.prototype,"maxChoices",void 0);op([L("response")],Fe.prototype,"handleOrderedResponseChange",null);var es=[{tag:"qti-graphic-order-interaction",ctor:Fe}];var sp=[P,H,q`
7553
+ `}_choiceElementSelectedHandler(t){let{identifier:e}=t.detail;if(!this._choiceElements.some(r=>r.identifier===e))return;let i=[...this.#e()],n=i.indexOf(e);if(n>=0)i.splice(n,1);else{let r=this.maxChoices>0?this.maxChoices:this._choiceElements.length;if(i.length>=r)return;i.push(e)}this.response=i,this.validate(),this.reportValidity(),this.saveResponse(this.response)}#e(){return Array.isArray(this.response)?this.response:this.response?[this.response]:[]}handleOrderedResponseChange(){this.refreshLocatorPins()}#i(t){return`--qti-graphic-order-${(t.identifier||t.getAttribute("identifier")||"hotspot").toLowerCase().replace(/[^a-z0-9_-]/g,"-")}`}resolvePinColor(t){return"var(--qti-selected-bg)"}refreshLocatorPins(){let t=this.#e();for(let r of this._choiceElements){let s=t.indexOf(r.identifier);r.order=s>=0?s+1:null}let e=this._choiceElements.filter(r=>r.order!=null).sort((r,s)=>r.order-s.order),i=Array.from(this.querySelectorAll(`.${o.#t}`));i.length===e.length&&e.every((r,s)=>{let a=i[s];return a.textContent===String(r.order)&&a.style.getPropertyValue("position-anchor")===this.#i(r)&&a.style.getPropertyValue("--qti-graphic-order-pin-color")===this.resolvePinColor(r)})||(i.forEach(r=>r.remove()),this._choiceElements.forEach(r=>{r.style.removeProperty("anchor-name")}),e.forEach(r=>{let s=this.#i(r);r.style.setProperty("anchor-name",s);let a=document.createElement("span");a.className=o.#t,a.style.setProperty("position-anchor",s),a.style.setProperty("--qti-graphic-order-pin-color",this.resolvePinColor(r)),r.getAttribute("shape")==="poly"&&a.classList.add("cito-graphic-order-marker--poly"),a.setAttribute("aria-hidden","true"),a.textContent=String(r.order),this.append(a)}))}#r(t){let e=dp(this),i=t.getAttribute("coords"),n=t.getAttribute("shape");if(!e){console.error('No <img> or <object type="image/*"> found in <qti-graphic-order-interaction>.');return}let r=i.split(",").map(s=>parseInt(s));ee(n,r,e,t)}#n;connectedCallback(){super.connectedCallback(),this.addEventListener("register-qti-hotspot-choice",this.#n),this.refreshLocatorPins(),this.querySelectorAll("qti-hotspot-choice").forEach(t=>this.#r(t))}disconnectedCallback(){this.querySelectorAll(`.${o.#t}`).forEach(t=>t.remove()),super.disconnectedCallback(),this.removeEventListener("register-qti-hotspot-choice",this.#n)}};fp([p({type:Number,attribute:"max-choices"})],Ue.prototype,"maxChoices",void 0);fp([L("response")],Ue.prototype,"handleOrderedResponseChange",null);var as=[{tag:"qti-graphic-order-interaction",ctor:Ue}];var gp=[P,H,q`
7546
7554
  :host {
7547
7555
  display: block;
7548
7556
  }
@@ -7591,17 +7599,17 @@ CES.load();
7591
7599
  max-width: 100%;
7592
7600
  height: auto;
7593
7601
  }
7594
- `];var Kr=class extends ze(D,"qti-hotspot-choice"){static{this.styles=sp}render(){return b`
7602
+ `];var Zi=class extends Fe(D,"qti-hotspot-choice"){static{this.styles=gp}render(){return b`
7595
7603
  <slot name="prompt"></slot>
7596
7604
  <slot></slot>
7597
7605
  <div part="message" role="alert" id="validation-message"></div>
7598
- `}#t=null;#e(t){return this.#t||(t.naturalWidth>0&&t.naturalHeight>0?this.#t=Promise.resolve(t):this.#t=new Promise(e=>{let r=()=>{t.removeEventListener("load",r),e(t)};t.addEventListener("load",r)})),this.#t}async#r(t){let e=this.querySelector("img"),r=t.getAttribute("coords"),n=t.getAttribute("shape"),i=r.split(",").map(a=>parseInt(a)),s=await this.#e(e);te(n,i,s,t)}#i=t=>{this.#r(t.target)};connectedCallback(){super.connectedCallback(),this.addEventListener("register-qti-hotspot-choice",this.#i),this.querySelectorAll("qti-hotspot-choice").forEach(t=>this.#r(t))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("register-qti-hotspot-choice",this.#i)}};var rs=[{tag:"qti-hotspot-interaction",ctor:Kr}];var ap=[P,H,q`
7606
+ `}#t=null;#e(t){return this.#t||(t.naturalWidth>0&&t.naturalHeight>0?this.#t=Promise.resolve(t):this.#t=new Promise(e=>{let i=()=>{t.removeEventListener("load",i),e(t)};t.addEventListener("load",i)})),this.#t}async#i(t){let e=this.querySelector("img"),i=t.getAttribute("coords"),n=t.getAttribute("shape"),r=i.split(",").map(a=>parseInt(a)),s=await this.#e(e);ee(n,r,s,t)}#r=t=>{this.#i(t.target)};connectedCallback(){super.connectedCallback(),this.addEventListener("register-qti-hotspot-choice",this.#r),this.querySelectorAll("qti-hotspot-choice").forEach(t=>this.#i(t))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("register-qti-hotspot-choice",this.#r)}};var ls=[{tag:"qti-hotspot-interaction",ctor:Zi}];var bp=[P,H,q`
7599
7607
  /* The box this element already had. See the note in qti-match-interaction.styles.ts. */
7600
7608
  :host {
7601
7609
  display: block;
7602
7610
  }
7603
- `];var Jr=class extends ze(D,"qti-hottext"){constructor(){super(...arguments),this.render=()=>b`<slot></slot>
7604
- <div part="message" role="alert" id="validation-message"></div>`}static{this.styles=ap}};var is=[{tag:"qti-hottext-interaction",ctor:Jr}];var Ml=(o,t="[part='menu']",e="[part='trigger']",r="--qti-inline-choice-width")=>{class n extends o{#t=null;#e=null;#r=null;#i=0;#n=null;shouldAutoSizeMenu(){return!1}menuAutoSizeExtraWidth(){return 0}menuAutoSizePropertyTarget(){return this.renderRoot?.querySelector(e)??null}menuAutoSizeRows(){let s=this.renderRoot?.querySelector(t);return s?Array.from(s.children).flatMap(a=>a instanceof HTMLSlotElement?a.assignedElements().filter(l=>l instanceof HTMLElement):a instanceof HTMLElement?[a]:[]):[]}withMenuMeasurable(s){let a=this.renderRoot?.querySelector(t);if(!a)return s();let l=a.matches(":popover-open"),c=a.style.visibility,d=a.style.display;l||(a.style.visibility="hidden",a.style.display="block",a.showPopover?.());try{return s()}finally{l||(a.hidePopover?.(),a.style.visibility=c,a.style.display=d)}}updateMenuWidth(){if(!this.isConnected||!this.shouldAutoSizeMenu())return;let s=this.menuAutoSizePropertyTarget();if(!s)return;let a=this.renderRoot?.querySelector(t);a&&this.#c(a),this.#s();let l=this.#o()+this.menuAutoSizeExtraWidth();l<=0||l===this.#n||(this.#n=l,s.style.setProperty(r,`${l}px`))}#o(){return this.withMenuMeasurable(()=>{let s=0;for(let c of this.menuAutoSizeRows()){let d=c.style.width;c.style.width="max-content",s=Math.max(s,c.getBoundingClientRect().width),c.style.width=d}if(s<=0)return 0;let a=this.renderRoot?.querySelector(t);if(!a)return s;let l=getComputedStyle(a);return s+parseFloat(l.paddingLeft)+parseFloat(l.paddingRight)+parseFloat(l.borderLeftWidth)+parseFloat(l.borderRightWidth)})}#s(){typeof MutationObserver>"u"||this.#r||(this.#r=new MutationObserver(()=>this.#a()),this.#r.observe(this,{childList:!0,subtree:!0,characterData:!0}))}#a(){this.#i||(this.#i=requestAnimationFrame(()=>{this.#i=0,this.updateMenuWidth()}))}#c(s){typeof ResizeObserver>"u"||this.#e===s||(this.#t??=new ResizeObserver(()=>{this.#e?.matches(":popover-open")&&this.#a()}),this.#e&&this.#t.unobserve(this.#e),this.#t.observe(s),this.#e=s)}disconnectedCallback(){this.#t?.disconnect(),this.#t=null,this.#e=null,this.#r?.disconnect(),this.#r=null,this.#i&&cancelAnimationFrame(this.#i),this.#i=0,super.disconnectedCallback()}}return n};var Bm=q`
7611
+ `];var tr=class extends Fe(D,"qti-hottext"){constructor(){super(...arguments),this.render=()=>b`<slot></slot>
7612
+ <div part="message" role="alert" id="validation-message"></div>`}static{this.styles=bp}};var cs=[{tag:"qti-hottext-interaction",ctor:tr}];var zl=(o,t="[part='menu']",e="[part='trigger']",i="--qti-inline-choice-width")=>{class n extends o{#t=null;#e=null;#i=null;#r=0;#n=null;shouldAutoSizeMenu(){return!1}menuAutoSizeExtraWidth(){return 0}menuAutoSizePropertyTarget(){return this.renderRoot?.querySelector(e)??null}menuAutoSizeRows(){let s=this.renderRoot?.querySelector(t);return s?Array.from(s.children).flatMap(a=>a instanceof HTMLSlotElement?a.assignedElements().filter(l=>l instanceof HTMLElement):a instanceof HTMLElement?[a]:[]):[]}withMenuMeasurable(s){let a=this.renderRoot?.querySelector(t);if(!a)return s();let l=a.matches(":popover-open"),c=a.style.visibility,d=a.style.display;l||(a.style.visibility="hidden",a.style.display="block",a.showPopover?.());try{return s()}finally{l||(a.hidePopover?.(),a.style.visibility=c,a.style.display=d)}}updateMenuWidth(){if(!this.isConnected||!this.shouldAutoSizeMenu())return;let s=this.menuAutoSizePropertyTarget();if(!s)return;let a=this.renderRoot?.querySelector(t);a&&this.#c(a),this.#s();let l=this.#o()+this.menuAutoSizeExtraWidth();l<=0||l===this.#n||(this.#n=l,s.style.setProperty(i,`${l}px`))}#o(){return this.withMenuMeasurable(()=>{let s=0;for(let c of this.menuAutoSizeRows()){let d=c.style.width;c.style.width="max-content",s=Math.max(s,c.getBoundingClientRect().width),c.style.width=d}if(s<=0)return 0;let a=this.renderRoot?.querySelector(t);if(!a)return s;let l=getComputedStyle(a);return s+parseFloat(l.paddingLeft)+parseFloat(l.paddingRight)+parseFloat(l.borderLeftWidth)+parseFloat(l.borderRightWidth)})}#s(){typeof MutationObserver>"u"||this.#i||(this.#i=new MutationObserver(()=>this.#a()),this.#i.observe(this,{childList:!0,subtree:!0,characterData:!0}))}#a(){this.#r||(this.#r=requestAnimationFrame(()=>{this.#r=0,this.updateMenuWidth()}))}#c(s){typeof ResizeObserver>"u"||this.#e===s||(this.#t??=new ResizeObserver(()=>{this.#e?.matches(":popover-open")&&this.#a()}),this.#e&&this.#t.unobserve(this.#e),this.#t.observe(s),this.#e=s)}disconnectedCallback(){this.#t?.disconnect(),this.#t=null,this.#e=null,this.#i?.disconnect(),this.#i=null,this.#r&&cancelAnimationFrame(this.#r),this.#r=0,super.disconnectedCallback()}}return n};var rf=q`
7605
7613
  /* ── Host ──────────────────────────────────────────────────────────────────
7606
7614
  Inline-block so the element flows with surrounding text.
7607
7615
  --qti-inline-choice-width is the single width control surface:
@@ -7782,7 +7790,7 @@ CES.load();
7782
7790
  z-index: var(--qti-overlay-z-index);
7783
7791
  white-space: nowrap;
7784
7792
  }
7785
- `,Um=Bm,lp=Um;var me=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Hm=0,nt=class extends Ml(D){constructor(){super(),this.options=[],this._dropdownOpen=!1,this._slotObserver=null,this._menuId=`qti-inline-choice-menu-${Hm++}`,this._handleDataPromptChange=()=>{this.#e()},this.required=!1,this.minChoices=0,this._handleRequiredChange=()=>{this.validate(),this.reportValidity()},this._pendingResponse=void 0,this.#n=t=>{(this.disabled||this.readonly)&&t.preventDefault()},this.#o=t=>{this.disabled||this.readonly||(t.key==="ArrowDown"||t.key==="Enter"||t.key===" ")&&(t.preventDefault(),this.#i(!0))},this.#s=t=>{let r=t.newState==="open";this._dropdownOpen!==r&&(this._dropdownOpen=r),r?this._internals.states.add("open"):this._internals.states.delete("open")},this.#a=t=>{if(!this._dropdownOpen)return;if(t.key==="Escape"){t.preventDefault(),this.#i(!1),this.#c();return}let e=this.#u(),r=this.renderRoot.activeElement,n=this.#p(),i=r||(n instanceof HTMLElement&&this.#l(n)?n:null),s=e.findIndex(a=>a===i);if(t.key==="ArrowDown"&&(t.preventDefault(),e[Math.min(e.length-1,Math.max(0,s+1))]?.focus()),t.key==="ArrowUp"&&(t.preventDefault(),e[Math.max(0,s-1)]?.focus()),t.key==="Enter"||t.key===" "){if(!i)return;if(t.preventDefault(),i instanceof HTMLButtonElement)i.click();else{let a=i.getAttribute("identifier")??"";this.#r(a)}}},this.#h=()=>{this.#e()},this.#f=t=>{if(this.disabled||this.readonly)return;let r=t.currentTarget.getAttribute("identifier")??"";this.#r(r)},this.internals.role="listbox"}get isInline(){return!0}static get styles(){return[lp]}renderTrigger(){let t=this.#t();return b`
7793
+ `,nf=rf,yp=nf;var ge=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},of=0,nt=class extends zl(D){constructor(){super(),this.options=[],this._dropdownOpen=!1,this._slotObserver=null,this._menuId=`qti-inline-choice-menu-${of++}`,this._handleDataPromptChange=()=>{this.#e()},this.required=!1,this.minChoices=0,this._handleRequiredChange=()=>{this.validate(),this.reportValidity()},this._pendingResponse=void 0,this.#n=t=>{(this.disabled||this.readonly)&&t.preventDefault()},this.#o=t=>{this.disabled||this.readonly||(t.key==="ArrowDown"||t.key==="Enter"||t.key===" ")&&(t.preventDefault(),this.#r(!0))},this.#s=t=>{let i=t.newState==="open";this._dropdownOpen!==i&&(this._dropdownOpen=i),i?this._internals.states.add("open"):this._internals.states.delete("open")},this.#a=t=>{if(!this._dropdownOpen)return;if(t.key==="Escape"){t.preventDefault(),this.#r(!1),this.#c();return}let e=this.#u(),i=this.renderRoot.activeElement,n=this.#p(),r=i||(n instanceof HTMLElement&&this.#l(n)?n:null),s=e.findIndex(a=>a===r);if(t.key==="ArrowDown"&&(t.preventDefault(),e[Math.min(e.length-1,Math.max(0,s+1))]?.focus()),t.key==="ArrowUp"&&(t.preventDefault(),e[Math.max(0,s-1)]?.focus()),t.key==="Enter"||t.key===" "){if(!r)return;if(t.preventDefault(),r instanceof HTMLButtonElement)r.click();else{let a=r.getAttribute("identifier")??"";this.#i(a)}}},this.#h=()=>{this.#e()},this.#f=t=>{if(this.disabled||this.readonly)return;let i=t.currentTarget.getAttribute("identifier")??"";this.#i(i)},this.internals.role="listbox"}get isInline(){return!0}static get styles(){return[yp]}renderTrigger(){let t=this.#t();return b`
7786
7794
  <button
7787
7795
  part="trigger"
7788
7796
  type="button"
@@ -7816,13 +7824,13 @@ CES.load();
7816
7824
  type="button"
7817
7825
  role="option"
7818
7826
  aria-selected="${this.options[0]?.selected?"true":"false"}"
7819
- @click=${()=>this.#r("")}
7827
+ @click=${()=>this.#i("")}
7820
7828
  >
7821
7829
  <span part="option-content">${this.options[0]?.content}</span>
7822
7830
  </button>
7823
7831
  <slot @slotchange=${this.#h}></slot>
7824
7832
  </div>
7825
- `}renderValidationMessage(){return b`<div id="validation-message" part="message" role="alert" style="display:none;"></div>`}render(){return b` ${this.renderTrigger()} ${this.renderMenu()} ${this.renderValidationMessage()} `}async connectedCallback(){super.connectedCallback(),this.#e(),this.#m(),await this.updateComplete,this.isConnected&&this.updateMenuWidth()}disconnectedCallback(){super.disconnectedCallback(),this.#g(),this._slotObserver?.disconnect(),this._slotObserver=null}willUpdate(t){t.has("configContext")&&this.#e()}updated(t){t.has("_dropdownOpen")&&this._dropdownOpen&&(this.#b(),this.#u()[0]?.focus()),(t.has("disabled")||t.has("readonly"))&&this.#b()}#t(){return this.options.find(t=>t.selected)??this.options[0]}#e(){let t=Array.from(this.querySelectorAll("qti-inline-choice")),e=this.dataPrompt||this.configContext?.inlineChoicePrompt||"select",r=this._pendingResponse,n=r!==void 0?r??"":this.options.find(a=>a.selected)?.value??"",i=[{content:e,value:"",selected:n===""},...t.map(a=>{let l=a.getAttribute("identifier")??"";return{content:Array.from(a.childNodes).map(c=>c.cloneNode(!0)),value:l,selected:l!==""&&l===n}})],s=i.some(a=>a.selected);this.options=s?i:i.map((a,l)=>({...a,selected:l===0})),this._pendingResponse=void 0,this.#b(),this.updateMenuWidth()}shouldAutoSizeMenu(){return this.configContext?.inlineChoiceAutosize?!Array.from(this.classList).some(t=>t.startsWith("qti-input-width-")):!1}menuAutoSizeExtraWidth(){return this.renderRoot.querySelector('span[part~="dropdown-icon"]')?.offsetWidth??0}validate(){let t=this.options.find(s=>s.selected),e=t?t.value!=="":!1,r=this.required||this.minChoices>=1,n=e||!r,i=this.dataset.minChoicesMessage||"Please select an option.";return this.setInteractionValidity(n,n?"":i,this,{suppressInline:!0}),n}reportValidity(){return super.reportValidity()}reset(){this.#i(!1),this.options=this.options.map((t,e)=>({...t,selected:e===0})),this.#b()}set response(t){let e=t??"";if(this.options.length===0){this._pendingResponse=t;return}this.options=this.options.map(r=>({...r,selected:r.value===e})),this.#b()}get response(){let t=this.options.find(e=>e.selected)?.value??"";return t===""?null:t}#r(t){this.options=this.options.map(e=>({...e,selected:e.value===t})),this.#b(),this.validate(),this.reportValidity(),this.saveResponse(t),this.#i(!1)}#i(t){let e=this.#d();if(e){if(t){e.matches(":popover-open")||e.showPopover();return}e.matches(":popover-open")&&e.hidePopover()}}#n;#o;#s;#a;#c(){this.renderRoot.querySelector('button[part="trigger"]')?.focus()}#p(){let t=document.activeElement;for(;t&&t instanceof HTMLElement&&t.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t}#l(t){return t===this||this.contains(t)||this.renderRoot.contains(t)}#d(){return this.renderRoot.querySelector(`#${this._menuId}`)}#m(){this._slotObserver=new MutationObserver(()=>this.#e()),this._slotObserver.observe(this,{childList:!0,subtree:!0})}#h;#f;#g(){let t=Array.from(this.querySelectorAll("qti-inline-choice"));for(let e of t)e.removeEventListener("click",this.#f),e.removeAttribute("tabindex"),e.internals.role=null,e.internals.ariaSelected=null,e.internals.ariaChecked="false",e.internals.states.delete("checked")}async#b(){await this.updateComplete;let t=this.options.find(r=>r.selected)?.value??"",e=Array.from(this.querySelectorAll("qti-inline-choice"));for(let r of e){let i=(r.getAttribute("identifier")??"")===t;r.removeEventListener("click",this.#f),r.addEventListener("click",this.#f),r.disabled=this.disabled,r.readonly=this.readonly,r.internals.role="option",r.internals.ariaSelected=i?"true":"false",r.internals.ariaChecked=i?"true":"false",r.internals.ariaDisabled=this.disabled?"true":"false",r.internals.ariaReadOnly=this.readonly?"true":"false",i?r.internals.states.add("checked"):r.internals.states.delete("checked"),r.tabIndex=-1}}#u(){let t=this.renderRoot.querySelector('button[part~="option"]'),e=Array.from(this.querySelectorAll("qti-inline-choice"));return[...t?[t]:[],...e]}};me([T()],nt.prototype,"options",void 0);me([T()],nt.prototype,"_dropdownOpen",void 0);me([_({context:qt,subscribe:!0}),p({attribute:!1})],nt.prototype,"configContext",void 0);me([p({type:String,attribute:"data-prompt"})],nt.prototype,"dataPrompt",void 0);me([L("dataPrompt",{waitUntilFirstUpdate:!0})],nt.prototype,"_handleDataPromptChange",void 0);me([p({type:Boolean,reflect:!0,converter:{fromAttribute:o=>o==="true"||o==="",toAttribute:o=>o?"true":null}})],nt.prototype,"required",void 0);me([p({type:Number,attribute:"min-choices"})],nt.prototype,"minChoices",void 0);me([L(["required","minChoices"],{waitUntilFirstUpdate:!0})],nt.prototype,"_handleRequiredChange",void 0);me([p({attribute:"response",reflect:!1,noAccessor:!0})],nt.prototype,"response",null);var ns=[{tag:"qti-inline-choice-interaction",ctor:nt}];var cp=[P,H,q`
7833
+ `}renderValidationMessage(){return b`<div id="validation-message" part="message" role="alert" style="display:none;"></div>`}render(){return b` ${this.renderTrigger()} ${this.renderMenu()} ${this.renderValidationMessage()} `}async connectedCallback(){super.connectedCallback(),this.#e(),this.#m(),await this.updateComplete,this.isConnected&&this.updateMenuWidth()}disconnectedCallback(){super.disconnectedCallback(),this.#g(),this._slotObserver?.disconnect(),this._slotObserver=null}willUpdate(t){t.has("configContext")&&this.#e()}updated(t){t.has("_dropdownOpen")&&this._dropdownOpen&&(this.#b(),this.#u()[0]?.focus()),(t.has("disabled")||t.has("readonly"))&&this.#b()}#t(){return this.options.find(t=>t.selected)??this.options[0]}#e(){let t=Array.from(this.querySelectorAll("qti-inline-choice")),e=this.dataPrompt||this.configContext?.inlineChoicePrompt||"select",i=this._pendingResponse,n=i!==void 0?i??"":this.options.find(a=>a.selected)?.value??"",r=[{content:e,value:"",selected:n===""},...t.map(a=>{let l=a.getAttribute("identifier")??"";return{content:Array.from(a.childNodes).map(c=>c.cloneNode(!0)),value:l,selected:l!==""&&l===n}})],s=r.some(a=>a.selected);this.options=s?r:r.map((a,l)=>({...a,selected:l===0})),this._pendingResponse=void 0,this.#b(),this.updateMenuWidth()}shouldAutoSizeMenu(){return this.configContext?.inlineChoiceAutosize?!Array.from(this.classList).some(t=>t.startsWith("qti-input-width-")):!1}menuAutoSizeExtraWidth(){return this.renderRoot.querySelector('span[part~="dropdown-icon"]')?.offsetWidth??0}validate(){let t=this.options.find(s=>s.selected),e=t?t.value!=="":!1,i=this.required||this.minChoices>=1,n=e||!i,r=this.dataset.minChoicesMessage||"Please select an option.";return this.setInteractionValidity(n,n?"":r,this,{suppressInline:!0}),n}reportValidity(){return super.reportValidity()}reset(){this.#r(!1),this.options=this.options.map((t,e)=>({...t,selected:e===0})),this.#b()}set response(t){let e=t??"";if(this.options.length===0){this._pendingResponse=t;return}this.options=this.options.map(i=>({...i,selected:i.value===e})),this.#b()}get response(){let t=this.options.find(e=>e.selected)?.value??"";return t===""?null:t}#i(t){this.options=this.options.map(e=>({...e,selected:e.value===t})),this.#b(),this.validate(),this.reportValidity(),this.saveResponse(t),this.#r(!1)}#r(t){let e=this.#d();if(e){if(t){e.matches(":popover-open")||e.showPopover();return}e.matches(":popover-open")&&e.hidePopover()}}#n;#o;#s;#a;#c(){this.renderRoot.querySelector('button[part="trigger"]')?.focus()}#p(){let t=document.activeElement;for(;t&&t instanceof HTMLElement&&t.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t}#l(t){return t===this||this.contains(t)||this.renderRoot.contains(t)}#d(){return this.renderRoot.querySelector(`#${this._menuId}`)}#m(){this._slotObserver=new MutationObserver(()=>this.#e()),this._slotObserver.observe(this,{childList:!0,subtree:!0})}#h;#f;#g(){let t=Array.from(this.querySelectorAll("qti-inline-choice"));for(let e of t)e.removeEventListener("click",this.#f),e.removeAttribute("tabindex"),e.internals.role=null,e.internals.ariaSelected=null,e.internals.ariaChecked="false",e.internals.states.delete("checked")}async#b(){await this.updateComplete;let t=this.options.find(i=>i.selected)?.value??"",e=Array.from(this.querySelectorAll("qti-inline-choice"));for(let i of e){let r=(i.getAttribute("identifier")??"")===t;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=r?"true":"false",i.internals.ariaChecked=r?"true":"false",i.internals.ariaDisabled=this.disabled?"true":"false",i.internals.ariaReadOnly=this.readonly?"true":"false",r?i.internals.states.add("checked"):i.internals.states.delete("checked"),i.tabIndex=-1}}#u(){let t=this.renderRoot.querySelector('button[part~="option"]'),e=Array.from(this.querySelectorAll("qti-inline-choice"));return[...t?[t]:[],...e]}};ge([T()],nt.prototype,"options",void 0);ge([T()],nt.prototype,"_dropdownOpen",void 0);ge([_({context:qt,subscribe:!0}),p({attribute:!1})],nt.prototype,"configContext",void 0);ge([p({type:String,attribute:"data-prompt"})],nt.prototype,"dataPrompt",void 0);ge([L("dataPrompt",{waitUntilFirstUpdate:!0})],nt.prototype,"_handleDataPromptChange",void 0);ge([p({type:Boolean,reflect:!0,converter:{fromAttribute:o=>o==="true"||o==="",toAttribute:o=>o?"true":null}})],nt.prototype,"required",void 0);ge([p({type:Number,attribute:"min-choices"})],nt.prototype,"minChoices",void 0);ge([L(["required","minChoices"],{waitUntilFirstUpdate:!0})],nt.prototype,"_handleRequiredChange",void 0);ge([p({attribute:"response",reflect:!1,noAccessor:!0})],nt.prototype,"response",null);var ds=[{tag:"qti-inline-choice-interaction",ctor:nt}];var vp=[P,H,q`
7826
7834
  /*
7827
7835
  * A custom element is inline unless it says otherwise, and this one never did. Its shadow content
7828
7836
  * is block-level, so block-in-inline generated the anonymous block boxes and it looked correct —
@@ -7928,7 +7936,7 @@ CES.load();
7928
7936
  :host(:disabled:not(.qti-match-tabular)) ::slotted(qti-simple-match-set:first-of-type) {
7929
7937
  display: none;
7930
7938
  }
7931
- `];var dp=[P,q`
7939
+ `];var wp=[P,q`
7932
7940
  :host(.qti-match-tabular) slot:not([hidden]) {
7933
7941
  display: contents;
7934
7942
  }
@@ -7984,7 +7992,7 @@ CES.load();
7984
7992
  justify-content: center;
7985
7993
  flex-shrink: 0;
7986
7994
  }
7987
- `];var Dl=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},fe=class extends Ft(jt(D,"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"),'[qti-draggable="true"]'){constructor(){super(...arguments),this.autoSizeDropzones=!1,this.lastCheckedRadio=null,this.class="",this._response=[],this.responseIdentifier="",this.handleRadioClick=t=>{let e=t.target;this.lastCheckedRadio===e?(e.checked=!1,this.lastCheckedRadio=null,this.handleRadioChange(t)):this.lastCheckedRadio=e},this.handleRadioChange=t=>{let e=t.target,r=e.value,n=e.name,i=e.type;e.checked?(this.response?this.response.indexOf(r)===-1&&(i==="radio"&&(this.response=(this.response||[]).filter(s=>s.indexOf(n)===-1)),this.response=[...this.response,r]):this.response=[r],this.lastCheckedRadio=e):(this.response=(this.response||[]).filter(s=>s!==r),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=[cp,dp]}get response(){return this.classList.contains("qti-match-tabular")?this._response:super.response}set response(t){this.classList.contains("qti-match-tabular")?this._response=t:super.response=t}isDragDropEnabled(){return!this.classList.contains("qti-match-tabular")}initiateDrag(...t){this.classList.contains("qti-match-tabular")||super.initiateDrag(...t)}afterCache(){this.classList.contains("qti-match-tabular")||super.afterCache()}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.syncTabularSlotting()}willUpdate(t){super.willUpdate?.(t),t.has("class")&&this.syncTabularSlotting()}syncTabularSlotting(){let t=this.classList.contains("qti-match-tabular"),e=this.querySelectorAll(":scope > qti-simple-match-set"),r=e[0],n=e[1],i=s=>{s.style.removeProperty("min-width"),s.style.removeProperty("min-height"),s.style.removeProperty("--qti-dropzone-min-height")};t?(r?.setAttribute("slot","match-rows"),n?.setAttribute("slot","match-cols"),this.sourceChoices?.forEach(s=>{i(s),s.setAttribute("role","rowheader")}),this.targetChoices?.forEach(s=>{i(s),s.setAttribute("role","columnheader")})):(r?.removeAttribute("slot"),n?.removeAttribute("slot"),this.sourceChoices?.forEach(s=>s.removeAttribute("role")),this.targetChoices?.forEach(s=>s.removeAttribute("role")))}validate(){return this.class.split(" ").includes("qti-match-tabular")?this.response?.length===this.sourceChoices.length:super.validate()}getCellStateVariant(t,e){return""}render(){let t=this.class.split(" ").includes("qti-match-tabular");return b`
7995
+ `];var jl=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},be=class extends Bt(Ft(D,"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"),'[qti-draggable="true"]'){constructor(){super(...arguments),this.autoSizeDropzones=!1,this.lastCheckedRadio=null,this.class="",this._response=[],this.responseIdentifier="",this.handleRadioClick=t=>{let e=t.target;this.lastCheckedRadio===e?(e.checked=!1,this.lastCheckedRadio=null,this.handleRadioChange(t)):this.lastCheckedRadio=e},this.handleRadioChange=t=>{let e=t.target,i=e.value,n=e.name,r=e.type;e.checked?(this.response?this.response.indexOf(i)===-1&&(r==="radio"&&(this.response=(this.response||[]).filter(s=>s.indexOf(n)===-1)),this.response=[...this.response,i]):this.response=[i],this.lastCheckedRadio=e):(this.response=(this.response||[]).filter(s=>s!==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=[vp,wp]}get response(){return this.classList.contains("qti-match-tabular")?this._response:super.response}set response(t){this.classList.contains("qti-match-tabular")?this._response=t:super.response=t}isDragDropEnabled(){return!this.classList.contains("qti-match-tabular")}initiateDrag(...t){this.classList.contains("qti-match-tabular")||super.initiateDrag(...t)}afterCache(){this.classList.contains("qti-match-tabular")||super.afterCache()}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.syncTabularSlotting()}willUpdate(t){super.willUpdate?.(t),t.has("class")&&this.syncTabularSlotting()}syncTabularSlotting(){let t=this.classList.contains("qti-match-tabular"),e=this.querySelectorAll(":scope > qti-simple-match-set"),i=e[0],n=e[1],r=s=>{s.style.removeProperty("min-width"),s.style.removeProperty("min-height"),s.style.removeProperty("--qti-dropzone-min-height")};t?(i?.setAttribute("slot","match-rows"),n?.setAttribute("slot","match-cols"),this.sourceChoices?.forEach(s=>{r(s),s.setAttribute("role","rowheader")}),this.targetChoices?.forEach(s=>{r(s),s.setAttribute("role","columnheader")})):(i?.removeAttribute("slot"),n?.removeAttribute("slot"),this.sourceChoices?.forEach(s=>s.removeAttribute("role")),this.targetChoices?.forEach(s=>s.removeAttribute("role")))}validate(){return this.class.split(" ").includes("qti-match-tabular")?this.response?.length===this.sourceChoices.length:super.validate()}getCellStateVariant(t,e){return""}render(){let t=this.class.split(" ").includes("qti-match-tabular");return b`
7988
7996
  <slot name="prompt"></slot>
7989
7997
  <slot ?hidden=${t}></slot>
7990
7998
 
@@ -7998,13 +8006,13 @@ CES.load();
7998
8006
  <div part="cols-wrap" role="row"><slot name="match-cols" part="c-header"></slot></div>
7999
8007
  <div part="rows-wrap"><slot name="match-rows" part="r-header"></slot></div>
8000
8008
  <div part="checkbox-grid">
8001
- ${this.sourceChoices.map((e,r)=>b`
8009
+ ${this.sourceChoices.map((e,i)=>b`
8002
8010
  <div role="row" style="display: contents;">
8003
- ${this.targetChoices.map((n,i)=>{let s=e.getAttribute("identifier"),a=n.getAttribute("identifier"),l=`${s} ${a}`,c=(this.response||[]).filter(g=>g.split(" ")[0]===s).length||0,d=this.response?.includes(l)||!1,h=e.matchMax===1?"radio":"checkbox",f=this.getCellStateVariant(l,d),m=d?"checked":"",v=`control ${h} ${m} ${f}`.trim(),x=`control-mark ${h} ${m} ${f}`.trim(),u=e.matchMax===1?!1:e.matchMax!==0&&c>=e.matchMax&&!d;return b`
8011
+ ${this.targetChoices.map((n,r)=>{let s=e.getAttribute("identifier"),a=n.getAttribute("identifier"),l=`${s} ${a}`,c=(this.response||[]).filter(g=>g.split(" ")[0]===s).length||0,d=this.response?.includes(l)||!1,h=e.matchMax===1?"radio":"checkbox",f=this.getCellStateVariant(l,d),m=d?"checked":"",v=`control ${h} ${m} ${f}`.trim(),x=`control-mark ${h} ${m} ${f}`.trim(),u=e.matchMax===1?!1:e.matchMax!==0&&c>=e.matchMax&&!d;return b`
8004
8012
  <label
8005
8013
  part="input-cell"
8006
8014
  role="gridcell"
8007
- style="grid-row: ${r+1}; grid-column: ${i+1}; display: flex; align-items: center; justify-content: center; cursor: pointer;"
8015
+ style="grid-row: ${i+1}; grid-column: ${r+1}; display: flex; align-items: center; justify-content: center; cursor: pointer;"
8008
8016
  >
8009
8017
  <input
8010
8018
  type=${h}
@@ -8028,13 +8036,13 @@ CES.load();
8028
8036
  `:O}
8029
8037
 
8030
8038
  <div role="alert" part="message" id="validation-message"></div>
8031
- `}};Dl([p({type:String})],fe.prototype,"class",void 0);Dl([T()],fe.prototype,"_response",void 0);Dl([p({type:String,attribute:"response-identifier"})],fe.prototype,"responseIdentifier",void 0);var os=[{tag:"qti-match-interaction",ctor:fe}];var hp=[P,q`
8039
+ `}};jl([p({type:String})],be.prototype,"class",void 0);jl([T()],be.prototype,"_response",void 0);jl([p({type:String,attribute:"response-identifier"})],be.prototype,"responseIdentifier",void 0);var hs=[{tag:"qti-match-interaction",ctor:be}];var xp=[P,q`
8032
8040
  /* The box this element already had. See the note in qti-match-interaction.styles.ts. */
8033
8041
  :host {
8034
8042
  display: block;
8035
8043
  }
8036
- `];var ss=class extends D{static{this.styles=hp}#t=null;reset(){this.#t=null}validate(){return!0}get response(){return this.#t?this.#t.toString():null}set response(t){if(t)if(!isNaN(parseInt(t?.toString())))this.#t=parseInt(t.toString());else throw new Error(`Value must be a number ${t}`)}static get properties(){return{...D.properties,step:{type:Number,attribute:"step",default:10}}}render(){return b` <slot name="prompt"></slot>
8037
- <slot></slot>`}constructor(){super()}connectedCallback(){super.connectedCallback();let t=this.querySelector("audio")||this.querySelector("video")||this.querySelector("object");t&&t.addEventListener("ended",()=>{this.#t++,this.saveResponse(this.value)})}};var as=[{tag:"qti-media-interaction",ctor:ss}];var pp=[P,H,Gt,q`
8044
+ `];var ps=class extends D{static{this.styles=xp}#t=null;reset(){this.#t=null}validate(){return!0}get response(){return this.#t?this.#t.toString():null}set response(t){if(t)if(!isNaN(parseInt(t?.toString())))this.#t=parseInt(t.toString());else throw new Error(`Value must be a number ${t}`)}static get properties(){return{...D.properties,step:{type:Number,attribute:"step",default:10}}}render(){return b` <slot name="prompt"></slot>
8045
+ <slot></slot>`}constructor(){super()}connectedCallback(){super.connectedCallback();let t=this.querySelector("audio")||this.querySelector("video")||this.querySelector("object");t&&t.addEventListener("ended",()=>{this.#t++,this.saveResponse(this.value)})}};var us=[{tag:"qti-media-interaction",ctor:ps}];var qp=[P,H,Gt,q`
8038
8046
  /* The box this element already had. See the note in qti-match-interaction.styles.ts. */
8039
8047
  :host {
8040
8048
  display: block;
@@ -8244,16 +8252,16 @@ CES.load();
8244
8252
  :host([answer-key]) [part~='drags'] {
8245
8253
  display: none;
8246
8254
  }
8247
- `];var up=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Wm=jt(D,"qti-simple-choice","[part~='drop']","slot[part~='drags']"),Be=class extends Ft(Wm,'[qti-draggable="true"]'){constructor(){super(...arguments),this.nrChoices=0}static{this.styles=pp}render(){let t=Array.from(this.querySelectorAll("qti-simple-choice"));return this.nrChoices<t.length&&(this.nrChoices=t.length),b` <slot name="prompt"> </slot>
8255
+ `];var Cp=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},sf=Ft(D,"qti-simple-choice","[part~='drop']","slot[part~='drags']"),He=class extends Bt(sf,'[qti-draggable="true"]'){constructor(){super(...arguments),this.nrChoices=0}static{this.styles=qp}render(){let t=Array.from(this.querySelectorAll("qti-simple-choice"));return this.nrChoices<t.length&&(this.nrChoices=t.length),b` <slot name="prompt"> </slot>
8248
8256
  <div part="container">
8249
8257
  <slot part="drags"> </slot>
8250
8258
  <div part="drops">
8251
- ${[...Array(this.nrChoices)].map((e,r)=>{let n=`droplist${r}`,i=this._dragDrop?.nodesByTarget?.[n]??[];return b`<div role="region" part="drop" data-declarative-drops identifier=${n}>
8252
- ${W(i,s=>s.getAttribute("identifier"),s=>s)}
8259
+ ${[...Array(this.nrChoices)].map((e,i)=>{let n=`droplist${i}`,r=this._dragDrop?.nodesByTarget?.[n]??[];return b`<div role="region" part="drop" data-declarative-drops identifier=${n}>
8260
+ ${W(r,s=>s.getAttribute("identifier"),s=>s)}
8253
8261
  </div>`})}
8254
8262
  </div>
8255
8263
  <div id="validation-message" part="message" role="alert" style="display:none;"></div>
8256
- </div>`}getValue(t){return t?.map((e,r)=>`${e} droplist${r}`)||[]}getResponse(){return Array.from(this.shadowRoot.querySelectorAll("[part~='drop']")).map(e=>this.chipsIn(e).map(r=>r.getAttribute("identifier")).join(" "))}shouldTreatBlockedMaxAsInvalid(){return!1}async firstUpdated(){super.firstUpdated(),this.childrenMap=Array.from(this.querySelectorAll("qti-simple-choice"))}};up([T()],Be.prototype,"nrChoices",void 0);up([p({type:String})],Be.prototype,"orientation",void 0);var ls=[{tag:"qti-order-interaction",ctor:Be}];var mp=[P,q`
8264
+ </div>`}getValue(t){return t?.map((e,i)=>`${e} droplist${i}`)||[]}getResponse(){return Array.from(this.shadowRoot.querySelectorAll("[part~='drop']")).map(e=>this.chipsIn(e).map(i=>i.getAttribute("identifier")).join(" "))}shouldTreatBlockedMaxAsInvalid(){return!1}async firstUpdated(){super.firstUpdated(),this.childrenMap=Array.from(this.querySelectorAll("qti-simple-choice"))}};Cp([T()],He.prototype,"nrChoices",void 0);Cp([p({type:String})],He.prototype,"orientation",void 0);var ms=[{tag:"qti-order-interaction",ctor:He}];var Sp=[P,q`
8257
8265
  :host {
8258
8266
  display: block;
8259
8267
  width: 100%;
@@ -8263,14 +8271,14 @@ CES.load();
8263
8271
  ::slotted(qti-interaction-markup) {
8264
8272
  display: none;
8265
8273
  }
8266
- `];var _t=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Qm=["solution","review"];function Gm(o){return o==null?!1:Array.isArray(o)?o.length>0:o!==""}var G=class extends D{constructor(){super(...arguments),this._iframeLoaded=!1,this._interactionReady=!1,this._pendingMessages=[],this._iframeMessageOrigin=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.status="interacting",this.#e=null,this._errorMessage=null,this.response=null,this.#i=null,this.#n=null,this.#o=null,this.#s="",this.handleIframeMessage=t=>{let{data:e}=t;if(!(!e||e.source!=="qti-pci-iframe")&&!(!this.iframe?.contentWindow||t.source!==this.iframe.contentWindow)&&!(e.responseIdentifier&&e.responseIdentifier!==this.responseIdentifier)){if(this._iframeMessageOrigin===null)this._iframeMessageOrigin=t.origin;else if(t.origin!==this._iframeMessageOrigin)return;switch(e.method){case"iframeReady":this._interactionReady=!0,this.#E(),this.#y(),this.dispatchEvent(new CustomEvent("qti-portable-custom-interaction-loaded",{bubbles:!0}));break;case"resize":typeof e.height=="number"&&this.iframe&&(this.iframe.style.height=`${e.height}px`,this.iframe.style.width=`${e.width}px`);break;case"console":this.dispatchEvent(new CustomEvent("qti-pci-console",{detail:{level:e.level,args:e.args},bubbles:!0}));break;case"interactionChanged":{let r=e?.params?.value,n=r&&typeof r=="object"?this.#d(r):null,i=typeof e?.params?.valid=="boolean"?e.params.valid:null,s=typeof e?.params?.customValidity=="string"?e.params.customValidity:null;i!==null&&(this.#o=i,i&&s===null&&(this.#s="")),s!==null&&(this.#s=s);let a=e?.params?.state,l;if(a===void 0)l=void 0;else if(a===null)l=null;else if(typeof a=="string")l=a;else try{l=`__qti_json__::${JSON.stringify(a)}`}catch{l=null}if(n===null){let c=this.responseVariable?.cardinality==="single"?"":[];this.response=c,this.validate(),this.saveResponse(c,l);break}this.response=n,this.validate(),this.saveResponse(n,l);break}case"error":this._errorMessage=e.params.message,console.error("Error from PCI iframe:",e.params.message);break}}},this.#w=null}#t;static{this.styles=[mp,q`
8274
+ `];var _t=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},af=["solution","review"];function lf(o){return o==null?!1:Array.isArray(o)?o.length>0:o!==""}var X=class extends D{constructor(){super(...arguments),this._iframeLoaded=!1,this._interactionReady=!1,this._pendingMessages=[],this._iframeMessageOrigin=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.status="interacting",this.#e=null,this._errorMessage=null,this.response=null,this.#r=null,this.#n=null,this.#o=null,this.#s="",this.handleIframeMessage=t=>{let{data:e}=t;if(!(!e||e.source!=="qti-pci-iframe")&&!(!this.iframe?.contentWindow||t.source!==this.iframe.contentWindow)&&!(e.responseIdentifier&&e.responseIdentifier!==this.responseIdentifier)){if(this._iframeMessageOrigin===null)this._iframeMessageOrigin=t.origin;else if(t.origin!==this._iframeMessageOrigin)return;switch(e.method){case"iframeReady":this._interactionReady=!0,this.#E(),this.#y(),this.dispatchEvent(new CustomEvent("qti-portable-custom-interaction-loaded",{bubbles:!0}));break;case"resize":typeof e.height=="number"&&this.iframe&&(this.iframe.style.height=`${e.height}px`,this.iframe.style.width=`${e.width}px`);break;case"console":this.dispatchEvent(new CustomEvent("qti-pci-console",{detail:{level:e.level,args:e.args},bubbles:!0}));break;case"interactionChanged":{let i=e?.params?.value,n=i&&typeof i=="object"?this.#d(i):null,r=typeof e?.params?.valid=="boolean"?e.params.valid:null,s=typeof e?.params?.customValidity=="string"?e.params.customValidity:null;r!==null&&(this.#o=r,r&&s===null&&(this.#s="")),s!==null&&(this.#s=s);let a=e?.params?.state,l;if(a===void 0)l=void 0;else if(a===null)l=null;else if(typeof a=="string")l=a;else try{l=`__qti_json__::${JSON.stringify(a)}`}catch{l=null}if(n===null){let c=this.responseVariable?.cardinality==="single"?"":[];this.response=c,this.validate(),this.saveResponse(c,l);break}this.response=n,this.validate(),this.saveResponse(n,l);break}case"error":this._errorMessage=e.params.message,console.error("Error from PCI iframe:",e.params.message);break}}},this.#w=null}#t;static{this.styles=[Sp,q`
8267
8275
  :host {
8268
8276
  display: block;
8269
8277
  width: 100%;
8270
8278
  min-height: 50px;
8271
8279
  }
8272
- `]}#e;set responseDeclaration(t){this.#e=t}get responseDeclaration(){if(this.#e)return this.#e;let t=this.responseVariable;if(!t)return null;let e={baseType:t.baseType,cardinality:t.cardinality},r=t.correctResponse;return Gm(r)&&(e.correctResponse={value:r}),e}#r(){let t=this.responseDeclaration;if(!t?.correctResponse||Qm.includes(this.status))return t;let{correctResponse:e,...r}=t;return r}#i;#n;#o;#s;#a(){if(this.#i===null&&this.requirePathsJson)try{let t=JSON.parse(this.requirePathsJson);if(Array.isArray(t)||!t||typeof t!="object")throw new Error("Require paths must be a JSON object.");this.#i=t}catch(t){console.error("Error parsing require paths JSON:",t),this._errorMessage=`Error parsing require paths JSON: ${t.message}`,this.#i={}}return this.#i||{}}#c(){if(this.#n===null&&this.requireShimJson)try{this.#n=JSON.parse(this.requireShimJson)}catch(t){console.error("Error parsing require shim JSON:",t),this._errorMessage=`Error parsing require shim JSON: ${t.message}`,this.#n={}}return this.#n||{}}#p(){return this.#a()}#l(){return this.#c()}#d(t){for(let e in t)if(t.hasOwnProperty(e)){let r=t[e];if(r){for(let n in r)if(r.hasOwnProperty(n)){let i=r[n];if(Array.isArray(i))return i.map(String);if(i!=null)return String(i)}}}return null}getDirectChildrenByTag(t){let e=t.toLowerCase();return Array.from(this.children).filter(r=>r.tagName.toLowerCase()===e)}coerceBaseValue(t,e){if(t==null)return t;switch(e){case"integer":{if(typeof t=="number")return t;let r=parseInt(String(t),10);return Number.isNaN(r)?t:r}case"float":case"duration":{if(typeof t=="number")return t;let r=parseFloat(String(t));return Number.isNaN(r)?t:r}case"boolean":{if(typeof t=="boolean")return t;if(typeof t=="string"){let r=t.toLowerCase();if(r==="true")return!0;if(r==="false")return!1}return t}default:return String(t)}}normalizeListValue(t){return t==null?[]:Array.isArray(t)?t:[t]}variableToQtiVariableJSON(t,e,r){if(e==="record"||r==="record")return this.recordToQtiVariableJSON(t);if(e!=="single"){let n=this.normalizeListValue(t).map(i=>this.coerceBaseValue(i,r));return{list:{[r]:n}}}return{base:{[r]:this.coerceBaseValue(t,r)}}}recordToQtiVariableJSON(t){if(!t||typeof t!="object")return{record:[]};let e=[];for(let[r,n]of Object.entries(t))e.push(this.recordEntryFromValue(r,n));return{record:e}}recordEntryFromValue(t,e){if(Array.isArray(e)){let r=e.filter(n=>n!=null);if(r.length&&r.every(n=>typeof n=="boolean"))return{name:t,list:{boolean:r}};if(r.length&&r.every(n=>typeof n=="number")){let n=r,i=n.every(s=>Number.isInteger(s));return{name:t,list:{[i?"integer":"float"]:n}}}return{name:t,list:{string:e.map(n=>n==null?"":String(n))}}}if(typeof e=="boolean")return{name:t,base:{boolean:e}};if(typeof e=="number")return Number.isInteger(e)?{name:t,base:{integer:e}}:{name:t,base:{float:e}};if(e==null)return{name:t,base:{string:""}};if(typeof e=="object")try{return{name:t,base:{string:JSON.stringify(e)}}}catch{return{name:t,base:{string:String(e)}}}return{name:t,base:{string:String(e)}}}getQtiContextDefaultsFromItem(){let t=this.closest("qti-assessment-item");if(!t)return{};let e={};return t.querySelectorAll('qti-context-declaration[identifier="QTI_CONTEXT"]').forEach(n=>{let i=n.querySelector("qti-default-value");if(!i)return;i.querySelectorAll("qti-value[field-identifier]").forEach(a=>{let l=a.getAttribute("field-identifier");if(!l)return;let c=a.getAttribute("base-type")||"string",d=a.textContent?.trim()||"";e[l]=this.coerceBaseValue(d,c)})}),e}getQtiContextRecord(){let t=this.getQtiContextDefaultsFromItem(),e=this.qtiContext?.QTI_CONTEXT||{},r={...t,...e};if(!Object.keys(r).length)return null;let n={candidateIdentifier:r.candidateIdentifier??"",testIdentifier:r.testIdentifier??"",environmentIdentifier:r.environmentIdentifier??"",...r};return this.recordToQtiVariableJSON(n)}getTemplateVariables(){let t={},e=this.getDirectChildrenByTag("qti-template-variable");return e.length&&e.forEach(r=>{let n=r.getAttribute("template-identifier")||r.getAttribute("identifier")||"";if(!n)return;let i=this.context?.variables?.find(l=>l.identifier===n);if(!i)return;let s=i.cardinality||"single",a=i.baseType||"string";t[n]=this.variableToQtiVariableJSON(i.value,s,a)}),t}getContextVariables(){let t={},e=this.getDirectChildrenByTag("qti-context-variable");return e.length&&e.forEach(r=>{let n=r.getAttribute("identifier")||"";if(!n)return;if(n==="QTI_CONTEXT"){let l=this.getQtiContextRecord();l&&(t[n]=l);return}let i=this.context?.variables?.find(l=>l.identifier===n);if(!i)return;let s=i.cardinality||"single",a=i.baseType||"string";t[n]=this.variableToQtiVariableJSON(i.value,s,a)}),t}#m(t){let e={...t};for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r)){let n=r.replace(/[A-Z]/g,i=>`-${i.toLowerCase()}`);e[n]=t[r]}return e}#h(t){let e={...t},r=(n,i,s)=>{let a=n;for(let l=0;l<i.length;l+=1){let c=i[l];if(l===i.length-1){a[c]=s;return}(!a[c]||typeof a[c]!="object"||Array.isArray(a[c]))&&(a[c]={}),a=a[c]}};for(let[n,i]of Object.entries(t)){if(!n.includes("__"))continue;let s=n.split("__").filter(Boolean);s.length<2||r(e,s,i)}return e}responseVariablesToQtiVariableJSON(t,e,r){if(e!=="single"){let n={list:{}};return n.list[r]=t,n}else{let n={base:{}};return n.base[r]=t,n}}#f(){return this.response===null||this.response===void 0?!1:Array.isArray(this.response)?this.response.length===0?!1:this.response.some(t=>t!==""&&t!==null&&t!==void 0):this.response!==""}#g(t,e){let r=this.dataset.invalidresponsemessage||"Invalid response.",n=t?"":e&&e.trim().length>0?e:r;this._internals.setValidity(t?{}:{customError:!0},n)}validate(){let t=typeof this.#o=="boolean"?this.#o:this.#f();return this.#g(t,this.#s),t}set value(t){t===null?this.#t=[]:this.#t=Array.isArray(t)?t:t.split(",")}get value(){return this.#t===null||this.#t===void 0?null:Array.isArray(this.#t)?this.#t.join(","):String(this.#t)}set boundTo(t){if(!t||!t[this.responseIdentifier])return;let e=this.#d(t[this.responseIdentifier]);this.#t=e,this.saveResponse(e)}get boundTo(){let t={};if(this.context?.variables?.find(r=>r.identifier===this.responseIdentifier)){let r=this.context?.variables?.find(a=>a.identifier===this.responseIdentifier)?.cardinality||"single",n=this.context?.variables?.find(a=>a.identifier===this.responseIdentifier)?.baseType||"string",i=this.context?.variables?.find(a=>a.identifier===this.responseIdentifier)?.value||null,s=this.responseVariablesToQtiVariableJSON(i,r,n);t[this.responseIdentifier]=s}return t}#b(t){return t&&t.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#x27;/g,"'").replace(/&#x2F;/g,"/").replace(/&#x60;/g,"`").replace(/&#x3D;/g,"=")}#u(t){let e={};for(let[r,n]of Object.entries(t))typeof n=="string"?e[r]=this.#b(n):e[r]=n;return e}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("message",this.handleIframeMessage)}sendMessageToIframe(t,e){let r=this.iframe?.contentWindow;if(!this._iframeLoaded||!r){this._pendingMessages.push({method:t,params:e});return}r.postMessage({source:"qti-portable-custom-interaction",responseIdentifier:this.responseIdentifier,method:t,params:e},"*")}#y(){this._pendingMessages.length&&(this._pendingMessages.forEach(t=>{this.sendMessageToIframe(t.method,t.params)}),this._pendingMessages=[])}createIframe(){this._interactionReady=!1,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.#k(),this.#v()};let t=`qti-pci-${this.responseIdentifier}-${Date.now()}`;this.iframe.name=t;let e=this.generateIframeContent();this.iframe.srcdoc=e,this.appendChild(this.iframe)}#v(){let t=this.#m(this.#h(this.#u({...this.dataset}))),e=this.context?.state?.[this.responseIdentifier],r=typeof e=="string"&&e.length>0?e: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:Qn(`${window.location.origin}${this.baseUrl}`):window.location.origin,responseIdentifier:this.responseIdentifier,properties:t,contextVariables:this.getContextVariables(),templateVariables:this.getTemplateVariables(),dataAttributes:{...this.dataset},interactionModules:this.#S(),boundTo:r?null:this.boundTo,responseDeclaration:this.#r(),status:this.status,state:r};this.sendMessageToIframe("initialize",n)}#S(){let t=[],e=this.querySelector("qti-interaction-modules");if(e){let r=e.querySelectorAll("qti-interaction-module");for(let n of r)t.push({id:n.getAttribute("id"),primaryPath:n.getAttribute("primary-path"),fallbackPath:n.getAttribute("fallback-path")})}return t}#k(){let t=this.querySelector("qti-interaction-markup");t&&this.sendMessageToIframe("setMarkup",t.innerHTML);let e=Array.from(this.querySelectorAll("qti-stylesheet"));if(e.length){let n=e.map(i=>i.outerHTML).join(`
8273
- `);this.sendMessageToIframe("setStylesheets",n)}let r=this.querySelector("properties");r&&this.sendMessageToIframe("setProperties",r.innerHTML)}#E(){}connectedCallback(){super.connectedCallback(),this.#o=null,this.#s="";let t=this.response;(Array.isArray(t)?t.length>0:t)||(this.response=this.responseVariable?.value??null),window.addEventListener("message",this.handleIframeMessage),this.createIframe()}generateIframeContent(){let t=window.getComputedStyle(document.body),e=JSON.stringify(this.#p()),r=JSON.stringify(this.#l()),n=this.dataset.baseUrl?this.dataset.baseUrl.startsWith("/")?`${window.location.origin}${this.dataset.baseUrl}`:this.dataset.baseUrl:"",i=n?n.endsWith("/")?n:`${n}/`:`${window.location.origin}/`,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",d=this.dataset.componentsCdnUrl||l,h=this.dataset.componentsCssUrl||c,f=`
8280
+ `]}#e;set responseDeclaration(t){this.#e=t}get responseDeclaration(){if(this.#e)return this.#e;let t=this.responseVariable;if(!t)return null;let e={baseType:t.baseType,cardinality:t.cardinality},i=t.correctResponse;return lf(i)&&(e.correctResponse={value:i}),e}#i(){let t=this.responseDeclaration;if(!t?.correctResponse||af.includes(this.status))return t;let{correctResponse:e,...i}=t;return i}#r;#n;#o;#s;#a(){if(this.#r===null&&this.requirePathsJson)try{let t=JSON.parse(this.requirePathsJson);if(Array.isArray(t)||!t||typeof t!="object")throw new Error("Require paths must be a JSON object.");this.#r=t}catch(t){console.error("Error parsing require paths JSON:",t),this._errorMessage=`Error parsing require paths JSON: ${t.message}`,this.#r={}}return this.#r||{}}#c(){if(this.#n===null&&this.requireShimJson)try{this.#n=JSON.parse(this.requireShimJson)}catch(t){console.error("Error parsing require shim JSON:",t),this._errorMessage=`Error parsing require shim JSON: ${t.message}`,this.#n={}}return this.#n||{}}#p(){return this.#a()}#l(){return this.#c()}#d(t){for(let e in t)if(t.hasOwnProperty(e)){let i=t[e];if(i){for(let n in i)if(i.hasOwnProperty(n)){let r=i[n];if(Array.isArray(r))return r.map(String);if(r!=null)return String(r)}}}return null}getDirectChildrenByTag(t){let e=t.toLowerCase();return Array.from(this.children).filter(i=>i.tagName.toLowerCase()===e)}coerceBaseValue(t,e){if(t==null)return t;switch(e){case"integer":{if(typeof t=="number")return t;let i=parseInt(String(t),10);return Number.isNaN(i)?t:i}case"float":case"duration":{if(typeof t=="number")return t;let i=parseFloat(String(t));return Number.isNaN(i)?t:i}case"boolean":{if(typeof t=="boolean")return t;if(typeof t=="string"){let i=t.toLowerCase();if(i==="true")return!0;if(i==="false")return!1}return t}default:return String(t)}}normalizeListValue(t){return t==null?[]:Array.isArray(t)?t:[t]}variableToQtiVariableJSON(t,e,i){if(e==="record"||i==="record")return this.recordToQtiVariableJSON(t);if(e!=="single"){let n=this.normalizeListValue(t).map(r=>this.coerceBaseValue(r,i));return{list:{[i]:n}}}return{base:{[i]:this.coerceBaseValue(t,i)}}}recordToQtiVariableJSON(t){if(!t||typeof t!="object")return{record:[]};let e=[];for(let[i,n]of Object.entries(t))e.push(this.recordEntryFromValue(i,n));return{record:e}}recordEntryFromValue(t,e){if(Array.isArray(e)){let i=e.filter(n=>n!=null);if(i.length&&i.every(n=>typeof n=="boolean"))return{name:t,list:{boolean:i}};if(i.length&&i.every(n=>typeof n=="number")){let n=i,r=n.every(s=>Number.isInteger(s));return{name:t,list:{[r?"integer":"float"]:n}}}return{name:t,list:{string:e.map(n=>n==null?"":String(n))}}}if(typeof e=="boolean")return{name:t,base:{boolean:e}};if(typeof e=="number")return Number.isInteger(e)?{name:t,base:{integer:e}}:{name:t,base:{float:e}};if(e==null)return{name:t,base:{string:""}};if(typeof e=="object")try{return{name:t,base:{string:JSON.stringify(e)}}}catch{return{name:t,base:{string:String(e)}}}return{name:t,base:{string:String(e)}}}getQtiContextDefaultsFromItem(){let t=this.closest("qti-assessment-item");if(!t)return{};let e={};return t.querySelectorAll('qti-context-declaration[identifier="QTI_CONTEXT"]').forEach(n=>{let r=n.querySelector("qti-default-value");if(!r)return;r.querySelectorAll("qti-value[field-identifier]").forEach(a=>{let l=a.getAttribute("field-identifier");if(!l)return;let c=a.getAttribute("base-type")||"string",d=a.textContent?.trim()||"";e[l]=this.coerceBaseValue(d,c)})}),e}getQtiContextRecord(){let t=this.getQtiContextDefaultsFromItem(),e=this.qtiContext?.QTI_CONTEXT||{},i={...t,...e};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 t={},e=this.getDirectChildrenByTag("qti-template-variable");return e.length&&e.forEach(i=>{let n=i.getAttribute("template-identifier")||i.getAttribute("identifier")||"";if(!n)return;let r=this.context?.variables?.find(l=>l.identifier===n);if(!r)return;let s=r.cardinality||"single",a=r.baseType||"string";t[n]=this.variableToQtiVariableJSON(r.value,s,a)}),t}getContextVariables(){let t={},e=this.getDirectChildrenByTag("qti-context-variable");return e.length&&e.forEach(i=>{let n=i.getAttribute("identifier")||"";if(!n)return;if(n==="QTI_CONTEXT"){let l=this.getQtiContextRecord();l&&(t[n]=l);return}let r=this.context?.variables?.find(l=>l.identifier===n);if(!r)return;let s=r.cardinality||"single",a=r.baseType||"string";t[n]=this.variableToQtiVariableJSON(r.value,s,a)}),t}#m(t){let e={...t};for(let i in t)if(Object.prototype.hasOwnProperty.call(t,i)){let n=i.replace(/[A-Z]/g,r=>`-${r.toLowerCase()}`);e[n]=t[i]}return e}#h(t){let e={...t},i=(n,r,s)=>{let a=n;for(let l=0;l<r.length;l+=1){let c=r[l];if(l===r.length-1){a[c]=s;return}(!a[c]||typeof a[c]!="object"||Array.isArray(a[c]))&&(a[c]={}),a=a[c]}};for(let[n,r]of Object.entries(t)){if(!n.includes("__"))continue;let s=n.split("__").filter(Boolean);s.length<2||i(e,s,r)}return e}responseVariablesToQtiVariableJSON(t,e,i){if(e!=="single"){let n={list:{}};return n.list[i]=t,n}else{let n={base:{}};return n.base[i]=t,n}}#f(){return this.response===null||this.response===void 0?!1:Array.isArray(this.response)?this.response.length===0?!1:this.response.some(t=>t!==""&&t!==null&&t!==void 0):this.response!==""}#g(t,e){let i=this.dataset.invalidresponsemessage||"Invalid response.",n=t?"":e&&e.trim().length>0?e:i;this._internals.setValidity(t?{}:{customError:!0},n)}validate(){let t=typeof this.#o=="boolean"?this.#o:this.#f();return this.#g(t,this.#s),t}set value(t){t===null?this.#t=[]:this.#t=Array.isArray(t)?t:t.split(",")}get value(){return this.#t===null||this.#t===void 0?null:Array.isArray(this.#t)?this.#t.join(","):String(this.#t)}set boundTo(t){if(!t||!t[this.responseIdentifier])return;let e=this.#d(t[this.responseIdentifier]);this.#t=e,this.saveResponse(e)}get boundTo(){let t={};if(this.context?.variables?.find(i=>i.identifier===this.responseIdentifier)){let i=this.context?.variables?.find(a=>a.identifier===this.responseIdentifier)?.cardinality||"single",n=this.context?.variables?.find(a=>a.identifier===this.responseIdentifier)?.baseType||"string",r=this.context?.variables?.find(a=>a.identifier===this.responseIdentifier)?.value||null,s=this.responseVariablesToQtiVariableJSON(r,i,n);t[this.responseIdentifier]=s}return t}#b(t){return t&&t.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#x27;/g,"'").replace(/&#x2F;/g,"/").replace(/&#x60;/g,"`").replace(/&#x3D;/g,"=")}#u(t){let e={};for(let[i,n]of Object.entries(t))typeof n=="string"?e[i]=this.#b(n):e[i]=n;return e}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("message",this.handleIframeMessage)}sendMessageToIframe(t,e){let i=this.iframe?.contentWindow;if(!this._iframeLoaded||!i){this._pendingMessages.push({method:t,params:e});return}i.postMessage({source:"qti-portable-custom-interaction",responseIdentifier:this.responseIdentifier,method:t,params:e},"*")}#y(){this._pendingMessages.length&&(this._pendingMessages.forEach(t=>{this.sendMessageToIframe(t.method,t.params)}),this._pendingMessages=[])}createIframe(){this._interactionReady=!1,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.#k(),this.#v()};let t=`qti-pci-${this.responseIdentifier}-${Date.now()}`;this.iframe.name=t;let e=this.generateIframeContent();this.iframe.srcdoc=e,this.appendChild(this.iframe)}#v(){let t=this.#m(this.#h(this.#u({...this.dataset}))),e=this.context?.state?.[this.responseIdentifier],i=typeof e=="string"&&e.length>0?e: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:Yn(`${window.location.origin}${this.baseUrl}`):window.location.origin,responseIdentifier:this.responseIdentifier,properties:t,contextVariables:this.getContextVariables(),templateVariables:this.getTemplateVariables(),dataAttributes:{...this.dataset},interactionModules:this.#S(),boundTo:i?null:this.boundTo,responseDeclaration:this.#i(),status:this.status,state:i};this.sendMessageToIframe("initialize",n)}#S(){let t=[],e=this.querySelector("qti-interaction-modules");if(e){let i=e.querySelectorAll("qti-interaction-module");for(let n of i)t.push({id:n.getAttribute("id"),primaryPath:n.getAttribute("primary-path"),fallbackPath:n.getAttribute("fallback-path")})}return t}#k(){let t=this.querySelector("qti-interaction-markup");t&&this.sendMessageToIframe("setMarkup",t.innerHTML);let e=Array.from(this.querySelectorAll("qti-stylesheet"));if(e.length){let n=e.map(r=>r.outerHTML).join(`
8281
+ `);this.sendMessageToIframe("setStylesheets",n)}let i=this.querySelector("properties");i&&this.sendMessageToIframe("setProperties",i.innerHTML)}#E(){}connectedCallback(){super.connectedCallback(),this.#o=null,this.#s="";let t=this.response;(Array.isArray(t)?t.length>0:t)||(this.response=this.responseVariable?.value??null),window.addEventListener("message",this.handleIframeMessage),this.createIframe()}generateIframeContent(){let t=window.getComputedStyle(document.body),e=JSON.stringify(this.#p()),i=JSON.stringify(this.#l()),n=this.dataset.baseUrl?this.dataset.baseUrl.startsWith("/")?`${window.location.origin}${this.dataset.baseUrl}`:this.dataset.baseUrl:"",r=n?n.endsWith("/")?n:`${n}/`:`${window.location.origin}/`,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",d=this.dataset.componentsCdnUrl||l,h=this.dataset.componentsCssUrl||c,f=`
8274
8282
  font-family: ${t.getPropertyValue("font-family")};
8275
8283
  font-size: ${t.getPropertyValue("font-size")};
8276
8284
  line-height: ${t.getPropertyValue("line-height")};
@@ -8281,7 +8289,7 @@ CES.load();
8281
8289
  <head>
8282
8290
  <meta charset="utf-8" />
8283
8291
  <title>QTI PCI Container</title>
8284
- <base href="${i}" />
8292
+ <base href="${r}" />
8285
8293
  <script type="module">
8286
8294
  import '${d}';
8287
8295
  </script>
@@ -8354,7 +8362,7 @@ CES.load();
8354
8362
  // Define standard paths and shims
8355
8363
  window.requirePaths = ${e};
8356
8364
 
8357
- window.requireShim = ${r};
8365
+ window.requireShim = ${i};
8358
8366
 
8359
8367
  // Single initial RequireJS configuration with error handling
8360
8368
  window.requirejs.config({
@@ -9167,7 +9175,7 @@ CES.load();
9167
9175
  <h1>Error</h1>
9168
9176
  ${this._errorMessage}
9169
9177
  </div>`:""}
9170
- `}};_t([p({type:String,attribute:"module"})],G.prototype,"module",void 0);_t([p({type:String,attribute:"custom-interaction-type-identifier"})],G.prototype,"customInteractionTypeIdentifier",void 0);_t([p({type:String,attribute:"data-require-paths"})],G.prototype,"requirePathsJson",void 0);_t([p({type:String,attribute:"data-require-shim"})],G.prototype,"requireShimJson",void 0);_t([p({type:String,attribute:"data-require-js-url"})],G.prototype,"requireJsUrl",void 0);_t([p({type:String,attribute:"data-base-url"})],G.prototype,"baseUrl",void 0);_t([p({type:Boolean,attribute:"data-use-default-paths"})],G.prototype,"useDefaultPaths",void 0);_t([p({type:String,attribute:"data-status"})],G.prototype,"status",void 0);_t([T()],G.prototype,"_errorMessage",void 0);_t([_({context:F,subscribe:!0}),T()],G.prototype,"context",void 0);_t([_({context:Ct,subscribe:!0}),T()],G.prototype,"qtiContext",void 0);_t([p({attribute:"response",reflect:!1,converter:Yt({emptyAs:null})})],G.prototype,"response",void 0);var cs=class extends G{#t=!1;async waitForReady(t=5e3){this._interactionReady||await new Promise((e,r)=>{let n=()=>{window.clearTimeout(i),e()},i=window.setTimeout(()=>{this.removeEventListener("qti-portable-custom-interaction-loaded",n),r(new Error(`Portable custom interaction did not become ready within ${t}ms`))},t);this.addEventListener("qti-portable-custom-interaction-loaded",n,{once:!0})})}async getIFrameContent(){return new Promise(t=>{let e=`get-content-${Date.now()}`,r=n=>{let{data:i}=n;i?.source==="qti-pci-iframe"&&(!i?.responseIdentifier||i?.responseIdentifier===this.responseIdentifier)&&i?.method==="getContentResponse"&&i?.messageId===e&&(window.removeEventListener("message",r),t(i.content))};window.addEventListener("message",r),this.sendMessageToIframe("getContent",{messageId:e}),setTimeout(()=>{window.removeEventListener("message",r),t("")},5e3)})}setTestContext(t){this.context=t,this.updateComplete.then(()=>{this.value=t?.variables?.find(e=>e.identifier===this.responseIdentifier).value})}async recreateIframe(){this.#t=!0;try{this.iframe&&(this._iframeLoaded=!1,this.iframe.remove()),this._pendingMessages=[],this.createIframe(),await this.waitForReady()}finally{this.#t=!1}}disconnectedCallback(){this.#t||super.disconnectedCallback()}async iFrameMouseClick(t,e){return new Promise(r=>{let n=`click-${Date.now()}`,i=s=>{let{data:a}=s;a?.source==="qti-pci-iframe"&&(!a?.responseIdentifier||a?.responseIdentifier===this.responseIdentifier)&&a?.method==="clickResponse"&&a?.messageId===n&&(window.removeEventListener("message",i),r())};window.addEventListener("message",i),this.sendMessageToIframe("simulateClick",{x:t,y:e,messageId:n}),setTimeout(()=>{window.removeEventListener("message",i),r()},5e3)})}async iFrameClickOnElement(t){return new Promise(e=>{let r=`click-selector-${Date.now()}`,n=i=>{let{data:s}=i;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="clickSelectorResponse"&&s?.messageId===r&&(window.removeEventListener("message",n),e(s.success))};window.addEventListener("message",n),this.sendMessageToIframe("clickOnSelector",{selector:t,messageId:r}),setTimeout(()=>{window.removeEventListener("message",n),e(!1)},5e3)})}async iFrameClickOnElementByText(t){return new Promise(e=>{let r=`click-text-${Date.now()}`,n=i=>{let{data:s}=i;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="clickTextResponse"&&s?.messageId===r&&(window.removeEventListener("message",n),e(s.success))};window.addEventListener("message",n),this.sendMessageToIframe("clickOnElementByText",{text:t,messageId:r}),setTimeout(()=>{window.removeEventListener("message",n),e(!1)},5e3)})}async iFrameSetValueElement(t,e){return new Promise(r=>{let n=`set-value-${Date.now()}`,i=s=>{let{data:a}=s;a?.source==="qti-pci-iframe"&&(!a?.responseIdentifier||a?.responseIdentifier===this.responseIdentifier)&&a?.method==="setValueResponse"&&a?.messageId===n&&(window.removeEventListener("message",i),r(a.success))};window.addEventListener("message",i),this.sendMessageToIframe("setValueElement",{selector:t,value:e,messageId:n}),setTimeout(()=>{window.removeEventListener("message",i),r(!1)},5e3)})}async iFrameGetBoundingClientRect(t){return new Promise(e=>{let r=`get-bounding-rect-${Date.now()}`,n=i=>{let{data:s}=i;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="getBoundingRectResponse"&&s?.messageId===r&&(window.removeEventListener("message",n),e(s.rect??null))};window.addEventListener("message",n),this.sendMessageToIframe("getBoundingRect",{selector:t,messageId:r}),setTimeout(()=>{window.removeEventListener("message",n),e(null)},5e3)})}async iFrameSetValueElementByText(t,e){return new Promise(r=>{let n=`set-value-text-${Date.now()}`,i=s=>{let{data:a}=s;a?.source==="qti-pci-iframe"&&(!a?.responseIdentifier||a?.responseIdentifier===this.responseIdentifier)&&a?.method==="setValueByTextResponse"&&a?.messageId===n&&(window.removeEventListener("message",i),r(a.success))};window.addEventListener("message",i),this.sendMessageToIframe("setValueElementByText",{text:t,value:e,messageId:n}),setTimeout(()=>{window.removeEventListener("message",i),r(!1)},5e3)})}async iFrameMousedownOnElement(t){return new Promise(e=>{let r=`mousedown-selector-${Date.now()}`,n=i=>{let{data:s}=i;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="mousedownSelectorResponse"&&s?.messageId===r&&(window.removeEventListener("message",n),e(s.success))};window.addEventListener("message",n),this.sendMessageToIframe("mousedownOnSelector",{selector:t,messageId:r}),setTimeout(()=>{window.removeEventListener("message",n),e(!1)},5e3)})}generateIframeContent(){let t=super.generateIframeContent(),e=`
9178
+ `}};_t([p({type:String,attribute:"module"})],X.prototype,"module",void 0);_t([p({type:String,attribute:"custom-interaction-type-identifier"})],X.prototype,"customInteractionTypeIdentifier",void 0);_t([p({type:String,attribute:"data-require-paths"})],X.prototype,"requirePathsJson",void 0);_t([p({type:String,attribute:"data-require-shim"})],X.prototype,"requireShimJson",void 0);_t([p({type:String,attribute:"data-require-js-url"})],X.prototype,"requireJsUrl",void 0);_t([p({type:String,attribute:"data-base-url"})],X.prototype,"baseUrl",void 0);_t([p({type:Boolean,attribute:"data-use-default-paths"})],X.prototype,"useDefaultPaths",void 0);_t([p({type:String,attribute:"data-status"})],X.prototype,"status",void 0);_t([T()],X.prototype,"_errorMessage",void 0);_t([_({context:F,subscribe:!0}),T()],X.prototype,"context",void 0);_t([_({context:Ct,subscribe:!0}),T()],X.prototype,"qtiContext",void 0);_t([p({attribute:"response",reflect:!1,converter:Kt({emptyAs:null})})],X.prototype,"response",void 0);var fs=class extends X{#t=!1;async waitForReady(t=5e3){this._interactionReady||await new Promise((e,i)=>{let n=()=>{window.clearTimeout(r),e()},r=window.setTimeout(()=>{this.removeEventListener("qti-portable-custom-interaction-loaded",n),i(new Error(`Portable custom interaction did not become ready within ${t}ms`))},t);this.addEventListener("qti-portable-custom-interaction-loaded",n,{once:!0})})}async getIFrameContent(){return new Promise(t=>{let e=`get-content-${Date.now()}`,i=n=>{let{data:r}=n;r?.source==="qti-pci-iframe"&&(!r?.responseIdentifier||r?.responseIdentifier===this.responseIdentifier)&&r?.method==="getContentResponse"&&r?.messageId===e&&(window.removeEventListener("message",i),t(r.content))};window.addEventListener("message",i),this.sendMessageToIframe("getContent",{messageId:e}),setTimeout(()=>{window.removeEventListener("message",i),t("")},5e3)})}setTestContext(t){this.context=t,this.updateComplete.then(()=>{this.value=t?.variables?.find(e=>e.identifier===this.responseIdentifier).value})}async recreateIframe(){this.#t=!0;try{this.iframe&&(this._iframeLoaded=!1,this.iframe.remove()),this._pendingMessages=[],this.createIframe(),await this.waitForReady()}finally{this.#t=!1}}disconnectedCallback(){this.#t||super.disconnectedCallback()}async iFrameMouseClick(t,e){return new Promise(i=>{let n=`click-${Date.now()}`,r=s=>{let{data:a}=s;a?.source==="qti-pci-iframe"&&(!a?.responseIdentifier||a?.responseIdentifier===this.responseIdentifier)&&a?.method==="clickResponse"&&a?.messageId===n&&(window.removeEventListener("message",r),i())};window.addEventListener("message",r),this.sendMessageToIframe("simulateClick",{x:t,y:e,messageId:n}),setTimeout(()=>{window.removeEventListener("message",r),i()},5e3)})}async iFrameClickOnElement(t){return new Promise(e=>{let i=`click-selector-${Date.now()}`,n=r=>{let{data:s}=r;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="clickSelectorResponse"&&s?.messageId===i&&(window.removeEventListener("message",n),e(s.success))};window.addEventListener("message",n),this.sendMessageToIframe("clickOnSelector",{selector:t,messageId:i}),setTimeout(()=>{window.removeEventListener("message",n),e(!1)},5e3)})}async iFrameClickOnElementByText(t){return new Promise(e=>{let i=`click-text-${Date.now()}`,n=r=>{let{data:s}=r;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="clickTextResponse"&&s?.messageId===i&&(window.removeEventListener("message",n),e(s.success))};window.addEventListener("message",n),this.sendMessageToIframe("clickOnElementByText",{text:t,messageId:i}),setTimeout(()=>{window.removeEventListener("message",n),e(!1)},5e3)})}async iFrameSetValueElement(t,e){return new Promise(i=>{let n=`set-value-${Date.now()}`,r=s=>{let{data:a}=s;a?.source==="qti-pci-iframe"&&(!a?.responseIdentifier||a?.responseIdentifier===this.responseIdentifier)&&a?.method==="setValueResponse"&&a?.messageId===n&&(window.removeEventListener("message",r),i(a.success))};window.addEventListener("message",r),this.sendMessageToIframe("setValueElement",{selector:t,value:e,messageId:n}),setTimeout(()=>{window.removeEventListener("message",r),i(!1)},5e3)})}async iFrameGetBoundingClientRect(t){return new Promise(e=>{let i=`get-bounding-rect-${Date.now()}`,n=r=>{let{data:s}=r;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="getBoundingRectResponse"&&s?.messageId===i&&(window.removeEventListener("message",n),e(s.rect??null))};window.addEventListener("message",n),this.sendMessageToIframe("getBoundingRect",{selector:t,messageId:i}),setTimeout(()=>{window.removeEventListener("message",n),e(null)},5e3)})}async iFrameSetValueElementByText(t,e){return new Promise(i=>{let n=`set-value-text-${Date.now()}`,r=s=>{let{data:a}=s;a?.source==="qti-pci-iframe"&&(!a?.responseIdentifier||a?.responseIdentifier===this.responseIdentifier)&&a?.method==="setValueByTextResponse"&&a?.messageId===n&&(window.removeEventListener("message",r),i(a.success))};window.addEventListener("message",r),this.sendMessageToIframe("setValueElementByText",{text:t,value:e,messageId:n}),setTimeout(()=>{window.removeEventListener("message",r),i(!1)},5e3)})}async iFrameMousedownOnElement(t){return new Promise(e=>{let i=`mousedown-selector-${Date.now()}`,n=r=>{let{data:s}=r;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="mousedownSelectorResponse"&&s?.messageId===i&&(window.removeEventListener("message",n),e(s.success))};window.addEventListener("message",n),this.sendMessageToIframe("mousedownOnSelector",{selector:t,messageId:i}),setTimeout(()=>{window.removeEventListener("message",n),e(!1)},5e3)})}generateIframeContent(){let t=super.generateIframeContent(),e=`
9171
9179
  // Test helper functions for QtiPortableCustomInteractionTest
9172
9180
  // Base iframe implementation already provides PCIManager.getContent
9173
9181
 
@@ -9360,7 +9368,7 @@ CES.load();
9360
9368
  }
9361
9369
  },
9362
9370
  true
9363
- );`,r=t.lastIndexOf("</script>");return t.substring(0,r)+e+t.substring(r)}};var ds=[{tag:"qti-portable-custom-interaction",ctor:G},{tag:"qti-portable-custom-interaction-test",ctor:cs}];var fp=[P,q`
9371
+ );`,i=t.lastIndexOf("</script>");return t.substring(0,i)+e+t.substring(i)}};var gs=[{tag:"qti-portable-custom-interaction",ctor:X},{tag:"qti-portable-custom-interaction-test",ctor:fs}];var kp=[P,q`
9364
9372
  :host {
9365
9373
  display: block;
9366
9374
  }
@@ -9371,12 +9379,12 @@ CES.load();
9371
9379
  left: 50%;
9372
9380
  transform: translateX(-50%);
9373
9381
  }
9374
- `];var hs=class extends C{static{this.styles=fp}render(){return b`<slot></slot>`}};var gp=[P,q`
9382
+ `];var bs=class extends C{static{this.styles=kp}render(){return b`<slot></slot>`}};var Ep=[P,q`
9375
9383
  :host {
9376
9384
  display: inline-block;
9377
9385
  position: relative;
9378
9386
  }
9379
- `];var ps=class extends C{static{this.styles=gp}render(){return b`<slot></slot>`}constructor(){super(),this.removeMoveListener=this.removeMoveListener.bind(this),this.dragElementHandler=this.dragElementHandler.bind(this)}dragElementHandler(t){t.preventDefault();let e=t.clientX-this.startX,r=t.clientY-this.startY;this.dragElement.style.left=this.dragElement.offsetLeft+e+"px",this.dragElement.style.top=this.dragElement.offsetTop+r+"px",this.startX=t.clientX,this.startY=t.clientY}firstUpdated(t){super.firstUpdated(t),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)}};var us=[{tag:"qti-position-object-interaction",ctor:hs},{tag:"qti-position-object-stage",ctor:ps}];var bp="important",Xm=" !"+bp,ms=Dt(class extends ke{constructor(o){if(super(o),o.type!==Fr.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((t,e)=>{let r=o[e];return r==null?t:t+`${e=e.includes("-")?e:e.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${r};`},"")}update(o,[t]){let{style:e}=o.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(t)),this.render(t);for(let r of this.ft)t[r]==null&&(this.ft.delete(r),r.includes("-")?e.removeProperty(r):e[r]=null);for(let r in t){let n=t[r];if(n!=null){this.ft.add(r);let i=typeof n=="string"&&n.endsWith(Xm);r.includes("-")||i?e.setProperty(r,i?n.slice(0,-11):n,i?bp:""):e[r]=n}}return it}});var yp=[P,q`
9387
+ `];var ys=class extends C{static{this.styles=Ep}render(){return b`<slot></slot>`}constructor(){super(),this.removeMoveListener=this.removeMoveListener.bind(this),this.dragElementHandler=this.dragElementHandler.bind(this)}dragElementHandler(t){t.preventDefault();let e=t.clientX-this.startX,i=t.clientY-this.startY;this.dragElement.style.left=this.dragElement.offsetLeft+e+"px",this.dragElement.style.top=this.dragElement.offsetTop+i+"px",this.startX=t.clientX,this.startY=t.clientY}firstUpdated(t){super.firstUpdated(t),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)}};var vs=[{tag:"qti-position-object-interaction",ctor:bs},{tag:"qti-position-object-stage",ctor:ys}];var Ip="important",cf=" !"+Ip,ws=Dt(class extends Ie{constructor(o){if(super(o),o.type!==Ui.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((t,e)=>{let i=o[e];return i==null?t:t+`${e=e.includes("-")?e:e.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${i};`},"")}update(o,[t]){let{style:e}=o.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(t)),this.render(t);for(let i of this.ft)t[i]==null&&(this.ft.delete(i),i.includes("-")?e.removeProperty(i):e[i]=null);for(let i in t){let n=t[i];if(n!=null){this.ft.add(i);let r=typeof n=="string"&&n.endsWith(cf);i.includes("-")||r?e.setProperty(i,r?n.slice(0,-11):n,r?Ip:""):e[i]=n}}return rt}});var Ap=[P,q`
9380
9388
  :host {
9381
9389
  display: block;
9382
9390
  --qti-select-point-marker-size: 1.5rem;
@@ -9411,20 +9419,20 @@ CES.load();
9411
9419
  -webkit-mask: var(--qti-select-point-icon) no-repeat center / contain;
9412
9420
  mask: var(--qti-select-point-icon) no-repeat center / contain;
9413
9421
  }
9414
- `];var Zr=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},yt=class extends D{constructor(){super(...arguments),this.maxChoices=1/0,this.minChoices=0,this.response=null,this.areaMappings=null,this._areaEntries=[],this._handleAreaMappingsChange=()=>{this.#t()},this.#e=null,this.#r=1,this.#i=1,this.#n=0,this.#o=0,this.#s=t=>{if(this.disabled)return;if(!this.#e){console.warn("No <img> element found in <qti-select-point-interaction>");return}this.#c();let e=this.#e.getBoundingClientRect(),r=(t.clientX-e.left)*this.#r,n=(t.clientY-e.top)*this.#i,i=`${r.toFixed()} ${n.toFixed()}`;this.maxChoices===1?this.response=[i]:(this.maxChoices===0||(this.response||[]).length<this.maxChoices)&&(this.response=[...this.response||[],i]),this.saveResponse(this.response)},this.#a=()=>{this.#c()}}static{this.styles=yp}#t(){try{let t=JSON.parse(this.areaMappings||"[]");if(!Array.isArray(t)){this._areaEntries=[];return}this._areaEntries=t.filter(e=>e&&(e.shape==="circle"||e.shape==="rect")&&typeof e.coords=="string").map(e=>({shape:e.shape,coords:String(e.coords),mappedValue:Number(e.mappedValue??1),defaultValue:Number(e.defaultValue??0)}))}catch{this._areaEntries=[]}}get _effectiveAreaEntries(){let t=this.responseVariable?.areaMapping?.areaMapEntries;return t?.length?t:this._areaEntries}#e;#r;#i;#n;#o;#s;connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.#a)}#a;get responsePoints(){let t=this.response;return(Array.isArray(t)?t:t?[t]:[]).filter(r=>r).map(r=>{let[n,i]=r.split(" ").map(Number);return{x:n,y:i}})}pointPart(t,e){return"point"}renderSupplementalLayer(){return O}positionOverlayElements(t){let e=this.#e;if(e){this.#c();for(let r of t){let n=r.dataset.coord,i=r.dataset.shape;!n||!i||te(i,n.split(",").map(s=>+s),e,r)}}}render(){let t=this.response,e=Array.isArray(t)?t:t?[t]:[];return b` <slot name="prompt"></slot>
9422
+ `];var er=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},yt=class extends D{constructor(){super(...arguments),this.maxChoices=1/0,this.minChoices=0,this.response=null,this.areaMappings=null,this._areaEntries=[],this._handleAreaMappingsChange=()=>{this.#t()},this.#e=null,this.#i=1,this.#r=1,this.#n=0,this.#o=0,this.#s=t=>{if(this.disabled)return;if(!this.#e){console.warn("No <img> element found in <qti-select-point-interaction>");return}this.#c();let e=this.#e.getBoundingClientRect(),i=(t.clientX-e.left)*this.#i,n=(t.clientY-e.top)*this.#r,r=`${i.toFixed()} ${n.toFixed()}`;this.maxChoices===1?this.response=[r]:(this.maxChoices===0||(this.response||[]).length<this.maxChoices)&&(this.response=[...this.response||[],r]),this.saveResponse(this.response)},this.#a=()=>{this.#c()}}static{this.styles=Ap}#t(){try{let t=JSON.parse(this.areaMappings||"[]");if(!Array.isArray(t)){this._areaEntries=[];return}this._areaEntries=t.filter(e=>e&&(e.shape==="circle"||e.shape==="rect")&&typeof e.coords=="string").map(e=>({shape:e.shape,coords:String(e.coords),mappedValue:Number(e.mappedValue??1),defaultValue:Number(e.defaultValue??0)}))}catch{this._areaEntries=[]}}get _effectiveAreaEntries(){let t=this.responseVariable?.areaMapping?.areaMapEntries;return t?.length?t:this._areaEntries}#e;#i;#r;#n;#o;#s;connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.#a)}#a;get responsePoints(){let t=this.response;return(Array.isArray(t)?t:t?[t]:[]).filter(i=>i).map(i=>{let[n,r]=i.split(" ").map(Number);return{x:n,y:r}})}pointPart(t,e){return"point"}renderSupplementalLayer(){return O}positionOverlayElements(t){let e=this.#e;if(e){this.#c();for(let i of t){let n=i.dataset.coord,r=i.dataset.shape;!n||!r||ee(r,n.split(",").map(s=>+s),e,i)}}}render(){let t=this.response,e=Array.isArray(t)?t:t?[t]:[];return b` <slot name="prompt"></slot>
9415
9423
  <point-container>
9416
- ${W(e.filter(r=>r),r=>r,(r,n)=>{let[i,s]=r.split(" ").map(Number),a=i/(this.#n||1)*100,l=s/(this.#o||1)*100;return b`
9424
+ ${W(e.filter(i=>i),i=>i,(i,n)=>{let[r,s]=i.split(" ").map(Number),a=r/(this.#n||1)*100,l=s/(this.#o||1)*100;return b`
9417
9425
  <button
9418
- part=${this.pointPart(r,n)}
9419
- style=${ms({pointerEvents:this.maxChoices===1?"none":"auto",position:"absolute",left:`${a}%`,top:`${l}%`})}
9420
- aria-label="Remove point at ${r}"
9426
+ part=${this.pointPart(i,n)}
9427
+ style=${ws({pointerEvents:this.maxChoices===1?"none":"auto",position:"absolute",left:`${a}%`,top:`${l}%`})}
9428
+ aria-label="Remove point at ${i}"
9421
9429
  ?disabled=${this.disabled}
9422
9430
  @click=${c=>{c.stopPropagation(),this.response=(this.response||[]).filter((d,h)=>h!==n),this.saveResponse(this.response)}}
9423
9431
  ></button>
9424
9432
  `})}
9425
9433
  ${this.renderSupplementalLayer()}
9426
9434
  <slot></slot>
9427
- </point-container>`}validate(){let t=this.response?.length??0,e=this.maxChoices!==0&&Number.isFinite(this.maxChoices)&&t>this.maxChoices,r=t<this.minChoices,n=!0,i="";return e?(n=!1,i=this.dataset.maxSelectionsMessage||`Please select no more than ${this.maxChoices} ${this.maxChoices===1?"point":"points"}.`):r&&(n=!1,i=this.dataset.minSelectionsMessage||`Please select at least ${this.minChoices} ${this.minChoices===1?"point":"points"}.`),this.setInteractionValidity(n,i,this.#e??this,{suppressInline:!0}),n}reportValidity(){return super.reportValidity()}#c(){this.#n=this.#e.getAttribute("width")?parseFloat(this.#e.getAttribute("width")):this.#e.naturalWidth,this.#o=this.#e.getAttribute("height")?parseFloat(this.#e.getAttribute("height")):this.#e.naturalHeight;let t=this.#e.getBoundingClientRect();this.#r=t.width===0?1:this.#n/t.width,this.#i=t.height===0?1:this.#o/t.height}firstUpdated(){super.firstUpdated(),this.#e=this.querySelector("img"),this.#e?(this.#c(),this.#e.addEventListener("click",this.#s)):console.warn("No <img> element found in <qti-select-point-interaction>")}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this.#a),this.#e&&this.#e.removeEventListener("click",this.#s)}};Zr([p({type:Number,attribute:"max-choices"})],yt.prototype,"maxChoices",void 0);Zr([p({type:Number,attribute:"min-choices"})],yt.prototype,"minChoices",void 0);Zr([p({attribute:"response",reflect:!1,converter:{fromAttribute:o=>{let t=Xa(o);return t===null?null:Array.isArray(t)?t:[t]},toAttribute:o=>Ya(o)}})],yt.prototype,"response",void 0);Zr([p({attribute:"area-mappings"})],yt.prototype,"areaMappings",void 0);Zr([T()],yt.prototype,"_areaEntries",void 0);Zr([L("areaMappings")],yt.prototype,"_handleAreaMappingsChange",void 0);var fs=[{tag:"qti-select-point-interaction",ctor:yt}];var vp=[P,q`
9435
+ </point-container>`}validate(){let t=this.response?.length??0,e=this.maxChoices!==0&&Number.isFinite(this.maxChoices)&&t>this.maxChoices,i=t<this.minChoices,n=!0,r="";return e?(n=!1,r=this.dataset.maxSelectionsMessage||`Please select no more than ${this.maxChoices} ${this.maxChoices===1?"point":"points"}.`):i&&(n=!1,r=this.dataset.minSelectionsMessage||`Please select at least ${this.minChoices} ${this.minChoices===1?"point":"points"}.`),this.setInteractionValidity(n,r,this.#e??this,{suppressInline:!0}),n}reportValidity(){return super.reportValidity()}#c(){this.#n=this.#e.getAttribute("width")?parseFloat(this.#e.getAttribute("width")):this.#e.naturalWidth,this.#o=this.#e.getAttribute("height")?parseFloat(this.#e.getAttribute("height")):this.#e.naturalHeight;let t=this.#e.getBoundingClientRect();this.#i=t.width===0?1:this.#n/t.width,this.#r=t.height===0?1:this.#o/t.height}firstUpdated(){super.firstUpdated(),this.#e=this.querySelector("img"),this.#e?(this.#c(),this.#e.addEventListener("click",this.#s)):console.warn("No <img> element found in <qti-select-point-interaction>")}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this.#a),this.#e&&this.#e.removeEventListener("click",this.#s)}};er([p({type:Number,attribute:"max-choices"})],yt.prototype,"maxChoices",void 0);er([p({type:Number,attribute:"min-choices"})],yt.prototype,"minChoices",void 0);er([p({attribute:"response",reflect:!1,converter:{fromAttribute:o=>{let t=el(o);return t===null?null:Array.isArray(t)?t:[t]},toAttribute:o=>il(o)}})],yt.prototype,"response",void 0);er([p({attribute:"area-mappings"})],yt.prototype,"areaMappings",void 0);er([T()],yt.prototype,"_areaEntries",void 0);er([L("areaMappings")],yt.prototype,"_handleAreaMappingsChange",void 0);var xs=[{tag:"qti-select-point-interaction",ctor:yt}];var _p=[P,q`
9428
9436
  :host {
9429
9437
  display: block;
9430
9438
  --show-bounds: true;
@@ -9492,7 +9500,7 @@ CES.load();
9492
9500
  text-align: center;
9493
9501
  color: #6b7280; /* text-gray-500 */
9494
9502
  }
9495
- `];var dn=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Tt=class extends D{constructor(){super(...arguments),this.#t=null,this.min=0,this.max=100,this.step=1}static{this.styles=vp}#t;validate(){return!0}connectedCallback(){super.connectedCallback(),this.setAttribute("tabindex","0"),this.setAttribute("role","slider")}willUpdate(t){super.willUpdate(t),this._internals.ariaValueMin=String(this.min),this._internals.ariaValueMax=String(this.max)}get response(){return this.#t===null?null:this.#t.toString()}set response(t){if(t==null||t===""){this.#e(null);return}let e=parseFloat(t);isNaN(e)||this.#e(e)}renderRailSupplement(){return O}#e(t){let e=this.#t;if(this.#t=t===null?null:Math.min(this.max,Math.max(this.min,t)),this.#t===e)return!1;if(this.#t===null)this.style.removeProperty("--value-percentage"),this._internals.setFormValue(null),this._internals.ariaValueNow=null;else{let r=(this.#t-this.min)/(this.max-this.min)*100;this.style.setProperty("--value-percentage",`${r}%`),this._internals.setFormValue(this.value),this._internals.ariaValueNow=String(this.#t)}return this.requestUpdate(),!0}#r(t){this.#e(t)&&this.saveResponse(this.response)}render(){return b`
9503
+ `];var un=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},Tt=class extends D{constructor(){super(...arguments),this.#t=null,this.min=0,this.max=100,this.step=1}static{this.styles=_p}#t;validate(){return!0}connectedCallback(){super.connectedCallback(),this.setAttribute("tabindex","0"),this.setAttribute("role","slider")}willUpdate(t){super.willUpdate(t),this._internals.ariaValueMin=String(this.min),this._internals.ariaValueMax=String(this.max)}get response(){return this.#t===null?null:this.#t.toString()}set response(t){if(t==null||t===""){this.#e(null);return}let e=parseFloat(t);isNaN(e)||this.#e(e)}renderRailSupplement(){return O}#e(t){let e=this.#t;if(this.#t=t===null?null:Math.min(this.max,Math.max(this.min,t)),this.#t===e)return!1;if(this.#t===null)this.style.removeProperty("--value-percentage"),this._internals.setFormValue(null),this._internals.ariaValueNow=null;else{let i=(this.#t-this.min)/(this.max-this.min)*100;this.style.setProperty("--value-percentage",`${i}%`),this._internals.setFormValue(this.value),this._internals.ariaValueNow=String(this.#t)}return this.requestUpdate(),!0}#i(t){this.#e(t)&&this.saveResponse(this.response)}render(){return b`
9496
9504
  <slot name="prompt"></slot>
9497
9505
  <div id="slider" part="slider">
9498
9506
  <div id="bounds" part="bounds">
@@ -9502,7 +9510,7 @@ CES.load();
9502
9510
 
9503
9511
  <div id="ticks" part="ticks"></div>
9504
9512
 
9505
- <div id="rail" part="rail" @mousedown=${this.#i} @touchstart=${this.#n}>
9513
+ <div id="rail" part="rail" @mousedown=${this.#r} @touchstart=${this.#n}>
9506
9514
  <div id="knob" part="knob">
9507
9515
  ${this.#t===null?O:b`<div id="value" part="value">${this.#t}</div>`}
9508
9516
  </div>
@@ -9510,7 +9518,7 @@ CES.load();
9510
9518
  ${this.renderRailSupplement()}
9511
9519
  </div>
9512
9520
  </div>
9513
- `}#i(t){this.#o(t.pageX);let e=n=>this.#s(n.pageX),r=()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",r),this.#a()};document.addEventListener("mousemove",e),document.addEventListener("mouseup",r)}#n(t){this.#o(t.touches[0].pageX);let e=n=>this.#s(n.touches[0].pageX),r=()=>{document.removeEventListener("touchmove",e),document.removeEventListener("touchend",r),this.#a()};document.addEventListener("touchmove",e,{passive:!1}),document.addEventListener("touchend",r)}#o(t){this.#s(t)}#s(t){let e=this._rail.getBoundingClientRect(),r=t-e.left,n=Math.min(1,Math.max(0,r/e.width)),i=this.min+Math.round(n*(this.max-this.min)/this.step)*this.step;this.#r(i)}#a(){this.dispatchEvent(new Event("change",{bubbles:!0}))}};dn([Er("#rail")],Tt.prototype,"_rail",void 0);dn([p({type:Number,attribute:"lower-bound"})],Tt.prototype,"min",void 0);dn([p({type:Number,attribute:"upper-bound"})],Tt.prototype,"max",void 0);dn([p({type:Number,attribute:"step"})],Tt.prototype,"step",void 0);dn([p({attribute:"response",reflect:!1,noAccessor:!0})],Tt.prototype,"response",null);var gs=[{tag:"qti-slider-interaction",ctor:Tt}];var wp=()=>new $l,$l=class{},Nl=new WeakMap,uM=Dt(class extends Ae{render(o){return O}update(o,[t]){let e=t!==this.G;return e&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.G=t,this.ht=o.options?.host,this.rt(this.ct=o.element)),O}rt(o){if(this.G!==void 0)if(this.isConnected||(o=void 0),typeof this.G=="function"){let t=this.ht??globalThis,e=Nl.get(t);e===void 0&&(e=new WeakMap,Nl.set(t,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"?Nl.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 xp=[P,q`
9521
+ `}#r(t){this.#o(t.pageX);let e=n=>this.#s(n.pageX),i=()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",i),this.#a()};document.addEventListener("mousemove",e),document.addEventListener("mouseup",i)}#n(t){this.#o(t.touches[0].pageX);let e=n=>this.#s(n.touches[0].pageX),i=()=>{document.removeEventListener("touchmove",e),document.removeEventListener("touchend",i),this.#a()};document.addEventListener("touchmove",e,{passive:!1}),document.addEventListener("touchend",i)}#o(t){this.#s(t)}#s(t){let e=this._rail.getBoundingClientRect(),i=t-e.left,n=Math.min(1,Math.max(0,i/e.width)),r=this.min+Math.round(n*(this.max-this.min)/this.step)*this.step;this.#i(r)}#a(){this.dispatchEvent(new Event("change",{bubbles:!0}))}};un([Ai("#rail")],Tt.prototype,"_rail",void 0);un([p({type:Number,attribute:"lower-bound"})],Tt.prototype,"min",void 0);un([p({type:Number,attribute:"upper-bound"})],Tt.prototype,"max",void 0);un([p({type:Number,attribute:"step"})],Tt.prototype,"step",void 0);un([p({attribute:"response",reflect:!1,noAccessor:!0})],Tt.prototype,"response",null);var qs=[{tag:"qti-slider-interaction",ctor:Tt}];var Tp=()=>new Bl,Bl=class{},Fl=new WeakMap,jM=Dt(class extends _e{render(o){return O}update(o,[t]){let e=t!==this.G;return e&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.G=t,this.ht=o.options?.host,this.rt(this.ct=o.element)),O}rt(o){if(this.G!==void 0)if(this.isConnected||(o=void 0),typeof this.G=="function"){let t=this.ht??globalThis,e=Fl.get(t);e===void 0&&(e=new WeakMap,Fl.set(t,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"?Fl.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 Rp=[P,q`
9514
9522
  :host {
9515
9523
  display: inline-flex;
9516
9524
  align-items: center;
@@ -9599,7 +9607,7 @@ CES.load();
9599
9607
  :host(.qti-input-width-72) {
9600
9608
  --qti-input-width: 72;
9601
9609
  }
9602
- `];var wr=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},pt=class extends D{constructor(){super(...arguments),this.inputRef=wp(),this.response=null,this._handleValueChange=()=>{this._internals.setFormValue(this.value),this.validate()}}static{this.styles=xp}get value(){return this.response||null}set value(t){this.response=t||null}get isInline(){return!0}validate(){if(!this._input)return!1;let t="",e=!1;return this.patternMask&&this.dataPatternmaskMessage?(this._input.setCustomValidity(""),e=this._input.checkValidity(),e||(t=this.dataPatternmaskMessage,this._input.setCustomValidity(this.dataPatternmaskMessage))):e=this._input.checkValidity(),e&&this.response===""&&(e=!1),!e&&!t&&(t=this._input.validationMessage||"Invalid value."),this.setInteractionValidity(e,t,this._input,{suppressInline:!0}),e}renderAnswer(){return b`<div part="answer" aria-hidden="true"></div>`}renderInput(){return b`<input
9610
+ `];var qi=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},pt=class extends D{constructor(){super(...arguments),this.inputRef=Tp(),this.response=null,this._handleValueChange=()=>{this._internals.setFormValue(this.value),this.validate()}}static{this.styles=Rp}get value(){return this.response||null}set value(t){this.response=t||null}get isInline(){return!0}validate(){if(!this._input)return!1;let t="",e=!1;return this.patternMask&&this.dataPatternmaskMessage?(this._input.setCustomValidity(""),e=this._input.checkValidity(),e||(t=this.dataPatternmaskMessage,this._input.setCustomValidity(this.dataPatternmaskMessage))):e=this._input.checkValidity(),e&&this.response===""&&(e=!1),!e&&!t&&(t=this._input.validationMessage||"Invalid value."),this.setInteractionValidity(e,t,this._input,{suppressInline:!0}),e}renderAnswer(){return b`<div part="answer" aria-hidden="true"></div>`}renderInput(){return b`<input
9603
9611
  part="input"
9604
9612
  name="${this.responseIdentifier}"
9605
9613
  spellcheck="false"
@@ -9615,7 +9623,7 @@ CES.load();
9615
9623
  maxlength=${1e3}
9616
9624
  ?disabled="${this.disabled}"
9617
9625
  ?readonly="${this.readonly}"
9618
- />`}renderValidationMessage(){return b`<div id="validation-message" part="message" role="alert" style="display:none;"></div>`}render(){return b` ${this.renderAnswer()} ${this.renderInput()} ${this.renderValidationMessage()} `}textChanged(t){if(this.disabled||this.readonly)return;let e=t.target;this.response!==e.value&&(this.value=e.value,this.saveResponse(e.value))}reportValidity(){return this.validate(),super.reportValidity()}reset(){this.response=""}};wr([p({type:Number,attribute:"expected-length"})],pt.prototype,"expectedLength",void 0);wr([p({type:String,attribute:"pattern-mask"})],pt.prototype,"patternMask",void 0);wr([p({type:String,attribute:"placeholder-text"})],pt.prototype,"placeholderText",void 0);wr([p({type:String,attribute:"data-patternmask-message"})],pt.prototype,"dataPatternmaskMessage",void 0);wr([p({type:String,attribute:"response",reflect:!1})],pt.prototype,"response",void 0);wr([Er("input")],pt.prototype,"_input",void 0);wr([L("response",{waitUntilFirstUpdate:!0})],pt.prototype,"_handleValueChange",void 0);var bs=[{tag:"qti-text-entry-interaction",ctor:pt}];var qp=[P,q`
9626
+ />`}renderValidationMessage(){return b`<div id="validation-message" part="message" role="alert" style="display:none;"></div>`}render(){return b` ${this.renderAnswer()} ${this.renderInput()} ${this.renderValidationMessage()} `}textChanged(t){if(this.disabled||this.readonly)return;let e=t.target;this.response!==e.value&&(this.value=e.value,this.saveResponse(e.value))}reportValidity(){return this.validate(),super.reportValidity()}reset(){this.response=""}};qi([p({type:Number,attribute:"expected-length"})],pt.prototype,"expectedLength",void 0);qi([p({type:String,attribute:"pattern-mask"})],pt.prototype,"patternMask",void 0);qi([p({type:String,attribute:"placeholder-text"})],pt.prototype,"placeholderText",void 0);qi([p({type:String,attribute:"data-patternmask-message"})],pt.prototype,"dataPatternmaskMessage",void 0);qi([p({type:String,attribute:"response",reflect:!1})],pt.prototype,"response",void 0);qi([Ai("input")],pt.prototype,"_input",void 0);qi([L("response",{waitUntilFirstUpdate:!0})],pt.prototype,"_handleValueChange",void 0);var Cs=[{tag:"qti-text-entry-interaction",ctor:pt}];var Pp=[P,q`
9619
9627
  :host {
9620
9628
  display: block;
9621
9629
  margin: 1em 0;
@@ -9624,12 +9632,12 @@ CES.load();
9624
9632
  display: block;
9625
9633
  margin-top: 0.5em;
9626
9634
  }
9627
- `];var ys=class extends D{static{this.styles=qp}#t=null;#e=null;reset(){this.#t=null,this.#e=null,this.saveResponse(null)}validate(){return this.#e!==null}get response(){return this.#e}set response(t){if(typeof t=="string")this.#e=t,this.saveResponse(t);else if(t===null)this.reset();else throw new Error("Value must be a Base64-encoded string or null")}static get properties(){return{...D.properties}}render(){return b`
9635
+ `];var Ss=class extends D{static{this.styles=Pp}#t=null;#e=null;reset(){this.#t=null,this.#e=null,this.saveResponse(null)}validate(){return this.#e!==null}get response(){return this.#e}set response(t){if(typeof t=="string")this.#e=t,this.saveResponse(t);else if(t===null)this.reset();else throw new Error("Value must be a Base64-encoded string or null")}static get properties(){return{...D.properties}}render(){return b`
9628
9636
  <div>
9629
9637
  <slot name="prompt"></slot>
9630
- <input type="file" @change="${this.#r}" ?disabled="${this.disabled}" ?readonly="${this.readonly}" />
9638
+ <input type="file" @change="${this.#i}" ?disabled="${this.disabled}" ?readonly="${this.readonly}" />
9631
9639
  </div>
9632
- `}async#r(t){let e=t.target;e.files&&e.files.length>0&&(this.#t=e.files[0],this.#e=await this.#i(this.#t),this.saveResponse(this.#e),this.dispatchEvent(new CustomEvent("qti-interaction-response",{detail:{response:this.#e}})))}#i(t){return new Promise((e,r)=>{let n=new FileReader;n.onload=()=>e(n.result),n.onerror=()=>r(n.error),n.readAsDataURL(t)})}};var vs=[{tag:"qti-upload-interaction",ctor:ys}];var Cp=[...Ho,...Wo,...Qo,...Xo,...Yo,...Ko,...Zo,...ts,...es,...rs,...is,...ns,...os,...as,...ls,...ds,...us,...fs,...gs,...bs,...vs,...Sh];for(let{tag:o,ctor:t}of Cp)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Ho)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Wo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Qo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Xo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Yo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Ko)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Zo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ts)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of es)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of rs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of is)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ns)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of os)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of as)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ls)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ds)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of us)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of fs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of gs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of bs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of vs)customElements.get(o)||customElements.define(o,t);var B$=async o=>{let t=o.substring(0,o.lastIndexOf("/")),e=await xd().load(`${o}`).then(a=>a.assessmentTest()),r=await Lr().load(`${t}/${e.href}`).then(a=>a.htmlDoc()),n=await Lr().load(`${t}/${e.href}`).then(a=>a.items()),i=`${t}/${e.href}`,s=`${t}/${e.href.substring(0,e.href.lastIndexOf("/"))}`;return{testHTMLDoc:r,testURI:s,testURL:i,items:n,testIdentifier:e.identifier}},U$=async o=>Kt().load(o).then(t=>t.htmlDoc().firstElementChild);var ws=class extends Ym(Xt){calculate(){return this.calculateChildren(Array.from(this.children))}};function Ym(o){return class extends o{calculateChildren(e){return e.map(n=>{let i=n;if(!i.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let s=i.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(n=>typeof n=="boolean"&&n)}}}var Sp=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},ti=class extends E{constructor(){super(...arguments),this.min=0,this.max=1/0}getResult(){let t=this.getVariables();if(!t||t.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 e=0;for(let r of t){if(r.cardinality!=="single"||Array.isArray(r.value))return console.error("qti-any-n requires single cardinality boolean expressions"),null;if(r.baseType!=="boolean")return console.error("qti-any-n requires boolean base-type"),null;if(r.value===null||r.value===void 0)return null;r.value==="true"&&e++}return e>=this.min&&e<=this.max}};Sp([p({type:Number})],ti.prototype,"min",void 0);Sp([p({type:Number})],ti.prototype,"max",void 0);var Km=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},hn=class extends E{constructor(){super(...arguments),this.baseType="string"}getResult(){return this.textContent.trim()}};Km([p({type:String,attribute:"base-type"})],hn.prototype,"baseType",void 0);var xs=class extends E{get resultBaseType(){return"integer"}getResult(){if(this.children?.length!==1)return console.error("qti-container-size must have exactly one child expression"),0;let t=this.getVariables();if(!t||t?.length===0)return 0;let e=t[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)}};var qs=class extends E{getResult(){if(this.children.length!==2)return console.error("qti-contains takes two sub-expressions"),null;let[t,e]=this.getVariables();if(!t||!e||t.value===null||t.value===void 0||e.value===null||e.value===void 0)return null;t.baseType!==e.baseType&&console.warn("qti-contains: both sub-expressions should have the same base-type");let r=t.baseType??e.baseType;if(t.cardinality==="single"&&e.cardinality!=="single")return console.warn("qti-contains: first sub-expression is single; treating it as a membership test"),this.#t(e.value).some(s=>this.#e(s,t.value,r));let n=this.#t(t.value),i=this.#t(e.value);return i.length===0?!0:t.cardinality==="ordered"&&e.cardinality==="ordered"?this.#i(n,i,r):this.#r(n,i,r)}#t(t){return Array.isArray(t)?[...t]:[t]}#e(t,e,r){return Y.compareSingleValues(t,e,r)||t===e}#r(t,e,r){let n=[...t];return e.every(i=>{let s=n.findIndex(a=>this.#e(a,i,r));return s===-1?!1:(n.splice(s,1),!0)})}#i(t,e,r){for(let n=0;n+e.length<=t.length;n++)if(e.every((i,s)=>this.#e(t[n+s],i,r)))return!0;return!1}};var Cs=class extends E{get interpretation(){return this.getAttribute("interpretation")||""}getResult(){let t=this.getAttribute("identifier")||"",e=this.context.variables.find(r=>r.identifier===t)||null;return e.cardinality!=="single"?e.correctResponse.length>0?e.correctResponse[0]:"":e.correctResponse}};var Ll=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},xr=class extends E{constructor(){super(...arguments),this.identifier=""}getResult(){if(!this.identifier)return console.error("qti-default requires an identifier attribute"),null;let t=this.identifier.split("."),e=null,r;if(t.length===2)e=t[0],r=t[1];else if(t.length===1)r=t[0];else return console.error("qti-default: invalid identifier format"),null;if(e){let i=this._testContext.items.find(a=>a.identifier===e);if(!this._testContext||!i)return console.warn(`qti-default: item "${e}" not found in test context`),null;let s=this._testContext.items.find(a=>a.identifier===e)?.variables.find(a=>a.identifier===r);return s?s.defaultValue||null:(console.warn(`qti-default: variable "${r}" not found in item "${e}"`),null)}if(!this.context?.variables)return console.warn("qti-default: no variables found in item context"),null;let n=this.context.variables.find(i=>i.identifier===r);return n?n.defaultValue||null:(console.warn(`qti-default: variable "${r}" not found in item context`),null)}};Ll([p({type:String})],xr.prototype,"identifier",void 0);Ll([_({context:F,subscribe:!0}),T()],xr.prototype,"context",void 0);Ll([T(),_({context:at,subscribe:!0})],xr.prototype,"_testContext",void 0);var Ss=class extends E{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return e.cardinality!=="single"||!Array.isArray(r.value)?(console.error("unexpected cardinality in qti equal"),null):t[0].baseType!==t[1].baseType?(console.error("The baseType of the two variables is different"),null):r.value.filter(i=>!e.value.includes(i))}return null}};var ks=class extends E{get resultBaseType(){return"float"}getResult(){let t=this.#t(this.getVariables());return t.length!==2?(console.warn("qti-divide: expected exactly 2 numeric values"),null):t[1]===0?(console.warn("qti-divide: division by zero"),null):t[0]/t[1]}#t(t){let e=[];for(let r of t){if(!r)continue;let n=i=>{if(i==null)return;let s=parseFloat(i.toString());if(Number.isNaN(s)){console.warn("qti-divide: non-numeric value encountered");return}e.push(s)};if(Array.isArray(r.value)){r.value.forEach(i=>n(i));continue}n(r.value)}return e}};var Es=class extends E{getResult(){let t=this.#t();return t?t[0]>=t[1]:null}#t(){let t=this.getVariables();if(t.length!==2)return console.error("qti-duration-gte requires exactly 2 duration expressions"),null;let e=t.map(r=>this.#e(r));return e.some(r=>r===null)?null:e}#e(t){if(t.cardinality!=="single"||Array.isArray(t.value))return console.error("qti-duration-gte requires single cardinality"),null;if(t.baseType!=="duration")return console.error("qti-duration-gte requires duration base-type"),null;if(t.value===null||t.value===void 0)return null;let e=Number.parseFloat(t.value.toString());return Number.isNaN(e)?(console.error(`qti-duration-gte requires duration values expressed in seconds, got "${t.value.toString()}"`),null):e}};var As=class extends E{getResult(){let t=this.#t();return t?t[0]<t[1]:null}#t(){let t=this.getVariables();if(t.length!==2)return console.error("qti-duration-lt requires exactly 2 duration expressions"),null;let e=t.map(r=>this.#e(r));return e.some(r=>r===null)?null:e}#e(t){if(t.cardinality!=="single"||Array.isArray(t.value))return console.error("qti-duration-lt requires single cardinality"),null;if(t.baseType!=="duration")return console.error("qti-duration-lt requires duration base-type"),null;if(t.value===null||t.value===void 0)return null;let e=Number.parseFloat(t.value.toString());return Number.isNaN(e)?(console.error(`qti-duration-lt requires duration values expressed in seconds, got "${t.value.toString()}"`),null):e}};var Jm=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},pn=class extends E{constructor(){super(...arguments),this.roundingMode="significantFigures"}get figures(){if(!this.getAttribute("figures"))return console.error("figures attribute is missing"),null;let e=parseInt(this.getAttribute("figures")||"0");return isNaN(e)?(console.error("figures attribute is not a number"),null):e<0?(console.error("figures attribute is negative"),null):e<1&&this.roundingMode==="significantFigures"?(console.error("figures cannot be smaller than 1 for RoundingMode significantFigures"),null):e}getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if(this.roundingMode===null)return null;if(e.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(r.value))return console.error("unexpected cardinality in qti equal"),!1;switch(t[0].baseType){case"integer":case"float":{let n=parseFloat(e.value),i=parseFloat(r.value);if(!isNaN(n)&&!isNaN(i))return this.roundingMode==="significantFigures"?n.toPrecision(this.figures)===i.toPrecision(this.figures):Math.round(n*Math.pow(10,this.figures))/Math.pow(10,this.figures)===Math.round(i*Math.pow(10,this.figures))/Math.pow(10,this.figures);console.error(`value cannot be casted to numeric value in equalRounded operator: ${n}, ${i}`);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}};Jm([p({type:String,attribute:"rounding-mode"})],pn.prototype,"roundingMode",void 0);var kp=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},ei=class extends E{constructor(){super(...arguments),this.toleranceMode="exact",this.tolerance=""}get includeLowerBound(){return this.getAttribute("include-lower-bound")!=="false"}get includeUpperBound(){return this.getAttribute("include-upper-bound")!=="false"}getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return!e||!r?null:e.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(r.value)?(console.error("unexpected cardinality in qti equal"),!1):e.value===null||r.value===null||e.value===void 0||r.value===void 0?null:this.toleranceMode==="exact"?Y.compareSingleValues(e.value,r.value,e.baseType):this.#t(parseFloat(e.value),parseFloat(r.value))}return console.error("unexpected number of children in qti-equal"),null}#t(t,e){if(Number.isNaN(t)||Number.isNaN(e))return console.error("qti-equal with a tolerance needs numeric values"),null;let r=this.tolerance.split(/\s+/).filter(Boolean).map(l=>parseFloat(l));if(r.length===0||r.some(l=>Number.isNaN(l)))return console.error(`qti-equal with tolerance-mode="${this.toleranceMode}" needs a numeric tolerance`),null;let[n,i=n]=r,[s,a]=this.toleranceMode==="absolute"?[e-n,e+i]:[e*(1-n/100),e*(1+i/100)];return(this.includeLowerBound?t>=s:t>s)&&(this.includeUpperBound?t<=a:t<a)}};kp([p({type:String,attribute:"tolerance-mode"})],ei.prototype,"toleranceMode",void 0);kp([p({type:String})],ei.prototype,"tolerance",void 0);var X=class extends C{render(){return b`<slot></slot>`}process(){throw new Error("Not implemented")}};var Is=class extends X{process(){throw new Tr}};var _s=class extends X{process(){throw new Rr}};var Ts=class extends E{getResult(){let t=this.getAttribute("field-identifier");if(!t)return console.error("qti-field-value requires a field-identifier attribute"),null;if(this.children.length!==1)return console.error("qti-field-value must have exactly one child expression"),null;let e=this.getVariables()[0];if(!e||e.baseType!=="record"||e.value===null||e.value===void 0)return console.warn("qti-field-value child expression must return a record"),null;let r=e.value[t];return r===void 0?null:r}};var Rs=class extends E{getResult(){if(this.children.length===0)return console.error("qti-gcd must have at least one child expression"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=[];for(let r of t){if(r.baseType!=="integer")return console.error("qti-gcd requires integer base-type"),null;if(r.value===null||r.value===void 0)return null;if(r.cardinality==="single"){if(Array.isArray(r.value))return console.error("qti-gcd unexpected array value for single cardinality"),null;let n=parseInt(r.value,10);if(isNaN(n))return console.error("qti-gcd non-numerical value"),null;e.push(n)}else if(r.cardinality==="multiple"||r.cardinality==="ordered"){if(!Array.isArray(r.value))return console.error("qti-gcd expected array value for multiple/ordered cardinality"),null;for(let n of r.value){if(n==null)return null;let i=parseInt(n,10);if(isNaN(i))return console.error("qti-gcd non-numerical value"),null;e.push(i)}}else return console.error("qti-gcd unsupported cardinality"),null}return e.length===0?null:this.#t(e)}#t(t){if(t.length===0)return 0;if(t.length===1)return Math.abs(t[0]);let e=Math.abs(t[0]);for(let r=1;r<t.length&&(e=this.#e(e,Math.abs(t[r])),e!==1);r++);return e}#e(t,e){if(t===0&&e===0)return 0;if(t===0)return e;if(e===0)return t;for(;e!==0;){let r=e;e=t%e,t=r}return t}};var Ps=class extends E{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if((e.baseType==="integer"||e.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float"))return+e.value>+r.value;console.error("unexpected baseType or cardinality in qti gt")}return console.error("unexpected number of children in qt"),null}};var Os=class extends Xt{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return(e.baseType==="integer"||e.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float")?+e.value>=+r.value:(console.error("unexpected baseType or cardinality in qti gte"),null)}return console.error("unexpected number of children in qti gte"),null}};var Zm=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},un=class extends E{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 t=this.getVariables()[0];if(!t)return console.error("qti-index: missing container"),null;let e;if(!isNaN(Number(this.n)))e=Number(this.n);else{let r=this.#t(this.n);if(r===null)return console.error(`qti-index: variable "${this.n}" is not a valid number`),null;e=Number(r)}if(e<=0||!Number.isInteger(e))return console.error("qti-index: index must be a positive integer"),null;if(t.cardinality==="ordered"){let r=Array.isArray(t.value)?t.value:[t.value];return t.value===null||e>r.length?null:r[e-1]}else return console.error("qti-index: child must have ordered cardinality"),null}#t(t){let e=this.context.variables.find(r=>r.identifier===t)?.value;return e===null||isNaN(Number(e))?null:Number(e)}};Zm([p({type:String})],un.prototype,"n",void 0);var Ep=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},ri=class extends E{constructor(){super(...arguments),this.shape="",this.coords=""}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-inside requires exactly one point expression"),null;let e=t[0];if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-inside requires single cardinality"),null;if(e.value===null||e.value===void 0)return null;if(!this.shape||!this.coords)return console.error("qti-inside requires shape and coords attributes"),null;let r=this.#t(e.value.toString()),n=this.#e(this.coords);if(!r||n.length===0)return null;switch(this.shape.toLowerCase()){case"circle":return this.#r(r,n);case"rect":return this.#i(r,n);case"ellipse":return this.#n(r,n);case"poly":case"polygon":return this.#o(r,n);default:return console.error(`qti-inside does not support shape "${this.shape}"`),null}}#t(t){let e=t.split(/[,\s]+/).map(i=>i.trim()).filter(Boolean);if(e.length!==2)return console.error('qti-inside requires a point value formatted as "x y" or "x,y"'),null;let r=Number.parseFloat(e[0]),n=Number.parseFloat(e[1]);return Number.isNaN(r)||Number.isNaN(n)?(console.error("qti-inside requires numeric point coordinates"),null):{x:r,y:n}}#e(t){let e=t.split(",").map(r=>r.trim()).filter(Boolean).map(r=>Number.parseFloat(r));return e.some(r=>Number.isNaN(r))?(console.error("qti-inside requires numeric coords"),[]):e}#r(t,e){if(e.length!==3)return console.error("qti-inside circle requires x,y,r"),null;let[r,n,i]=e;return(t.x-r)**2+(t.y-n)**2<=i**2}#i(t,e){if(e.length!==4)return console.error("qti-inside rect requires left,top,right,bottom"),null;let[r,n,i,s]=e,a=Math.min(r,i),l=Math.max(r,i),c=Math.min(n,s),d=Math.max(n,s);return t.x>=a&&t.x<=l&&t.y>=c&&t.y<=d}#n(t,e){if(e.length!==4)return console.error("qti-inside ellipse requires centerX,centerY,radiusX,radiusY"),null;let[r,n,i,s]=e;return i===0||s===0?!1:(t.x-r)**2/i**2+(t.y-n)**2/s**2<=1}#o(t,e){if(e.length<6||e.length%2!==0)return console.error("qti-inside polygon requires at least 3 coordinate pairs"),null;let r=!1;for(let n=0,i=e.length-2;n<e.length;n+=2){let s=e[n],a=e[n+1],l=e[i],c=e[i+1];a>t.y!=c>t.y&&t.x<(l-s)*(t.y-a)/(c-a||Number.EPSILON)+s&&(r=!r),i=n}return r}};Ep([p({type:String})],ri.prototype,"shape",void 0);Ep([p({type:String})],ri.prototype,"coords",void 0);var Ms=class extends E{get resultBaseType(){return"integer"}getResult(){let t=this.#t(this.getVariables());return t.length!==2?(console.error("qti-integer-divide requires exactly 2 integer values"),null):t[1]===0?(console.error("qti-integer-divide: division by zero"),null):Math.floor(t[0]/t[1])}#t(t){let e=[];for(let r of t){if(r.baseType!=="integer")return console.error("qti-integer-divide requires integer base-type"),[];if(r.cardinality!=="single"||Array.isArray(r.value))return console.error("qti-integer-divide requires single cardinality"),[];if(r.value===null||r.value===void 0)return[];let n=Number.parseInt(r.value,10);if(Number.isNaN(n))return console.error("qti-integer-divide requires integer values"),[];e.push(n)}return e}};var Ds=class extends E{get resultBaseType(){return"integer"}getResult(){let t=this.#t(this.getVariables());return t.length!==2?(console.error("qti-integer-modulus requires exactly 2 integer values"),null):t[1]===0?(console.error("qti-integer-modulus: division by zero"),null):t[0]-Math.floor(t[0]/t[1])*t[1]}#t(t){let e=[];for(let r of t){if(r.baseType!=="integer")return console.error("qti-integer-modulus requires integer base-type"),[];if(r.cardinality!=="single"||Array.isArray(r.value))return console.error("qti-integer-modulus requires single cardinality"),[];if(r.value===null||r.value===void 0)return[];let n=Number.parseInt(r.value,10);if(Number.isNaN(n))return console.error("qti-integer-modulus requires integer values"),[];e.push(n)}return e}};var Ns=class extends E{get resultBaseType(){return"float"}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-integer-to-float requires exactly one child expression"),null;let e=t[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 r=Number.parseInt(e.value,10);return Number.isNaN(r)?(console.error("qti-integer-to-float requires an integer value"),null):r}};var $s=class extends E{getResult(){if(this.children.length===1){let t=this.getVariables();if(!t?.length)return!0;let e=t[0].value;return e==null||e==null||e===""}return console.error("unexpected number of children in qti Null"),null}};var Ls=class extends E{getResult(){let t=this.#t(this.getVariables());return t.length===0?(console.error("qti-lcm requires at least one integer value"),null):t.reduce((e,r)=>this.#r(e,r))}#t(t){let e=[];for(let r of t){if(r.baseType!=="integer")return console.error("qti-lcm requires integer base-type"),[];if(r.value===null||r.value===void 0)return[];if(r.cardinality==="single"){if(Array.isArray(r.value))return console.error("qti-lcm unexpected array value for single cardinality"),[];let n=Number.parseInt(r.value,10);if(Number.isNaN(n))return console.error("qti-lcm requires integer values"),[];e.push(n);continue}if(r.cardinality!=="multiple"&&r.cardinality!=="ordered")return console.error("qti-lcm unsupported cardinality"),[];if(!Array.isArray(r.value))return console.error("qti-lcm expected array value for container cardinality"),[];for(let n of r.value){let i=Number.parseInt(n,10);if(Number.isNaN(i))return console.error("qti-lcm requires integer values"),[];e.push(i)}}return e}#e(t,e){let r=Math.abs(t),n=Math.abs(e);for(;n!==0;){let i=r%n;r=n,n=i}return r}#r(t,e){return t===0||e===0?0:Math.abs(t*e/this.#e(t,e))}};var Ap=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},ii=class extends X{get childExpression(){return this.firstElementChild}process(){let t=this.getAttribute("identifier"),e=this.context?.variables.find(i=>i.identifier===t)||null;if(!e)return console.warn(`lookupOutcomeValue: no outcome declaration for "${t}"`),null;let r=parseFloat(this.childExpression.calculate()),n;return e.matchTable?.size?n=e.matchTable.get(r):e.interpolationTable&&(n=this.#t(r,e.interpolationTable)),n==null?(console.warn(`lookupOutcomeValue: no table entry matches ${r} for "${t}"`),null):(this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:this.identifier,value:Ot(n)}})),n)}#t(t,e){if(!Number.isNaN(t))return e.find(r=>r.includeBoundary?t>=r.sourceValue:t>r.sourceValue)?.targetValue}};Ap([p({type:String})],ii.prototype,"identifier",void 0);Ap([_({context:F,subscribe:!0}),T()],ii.prototype,"context",void 0);var Vs=class extends E{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if((e.baseType==="integer"||e.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float"))return+e.value<+r.value;console.error("unexpected baseType or cardinality in qti lt")}return console.error("unexpected number of children in lt"),null}};var zs=class extends Xt{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return(e.baseType==="integer"||e.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float")?+e.value<=+r.value:(console.error("unexpected baseType or cardinality in qti lte"),null)}return console.error("unexpected number of children in qti lte"),null}};var tf=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},mn=class extends E{getResult(){let t=this.context.variables.find(s=>s.identifier===this.identifier);if(!t)return console.warn(`Response ${this.identifier} cannot be found`),null;let e=t.areaMapping;if(!e)return console.warn(`Area mapping not found for response ${this.identifier}`),null;let r=Array.isArray(t.value)?t.value:[t.value];if(!r||r.length===0)return console.warn(`No candidate responses for response ${this.identifier}`),null;let n=0,i=new Set;for(let s of r)for(let a of e.areaMapEntries){if(i.has(a.coords))continue;if(Y.isPointInArea(s,`${a.shape},${a.coords}`,t.baseType)){n+=a.mappedValue??0,i.add(a.coords);break}}return i.size<r.length&&(n+=e.defaultValue),e.lowerBound!=null&&(n=Math.max(e.lowerBound,n)),e.upperBound!=null&&(n=Math.min(e.upperBound,n)),n}};tf([p({type:String})],mn.prototype,"identifier",void 0);var ef=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},fn=class extends E{getResult(){let t=this.context.variables.find(i=>i.identifier===this.identifier);if(!t||!t.mapping)return console.error(`Response ${this.identifier} can not be found`),null;let e=t.mapping,r=Array.isArray(t.value)?t.value:[t.value],n=0;for(let i of r){let s=e.mapEntries.filter(l=>t.baseType==="string"&&!l.caseSensitive?Y.compareSingleValues(l.mapKey.toLowerCase(),i.toLowerCase(),t.baseType):Y.compareSingleValues(l.mapKey,i,t.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?n+=e.defaultValue:n+=a.mappedValue}return e?.lowerBound!==null&&e?.lowerBound!==void 0&&(n=Math.max(e.lowerBound,n)),e?.upperBound!==null&&e?.upperBound!==void 0&&(n=Math.min(e.upperBound,n)),n}};ef([p({type:String})],fn.prototype,"identifier",void 0);var js=class o extends E{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return o.match(e,r)}return console.error("unexpected number of children in match"),null}static match(t,e){if(t.value===null)return!1;switch(e.cardinality){case"single":return Array.isArray(t.value)||Array.isArray(e.value)?(console.error("unexpected cardinality in qti match"),!1):Y.compareSingleValues(t.value?.toString(),e.value.toString(),e.baseType);case"ordered":{if(!Array.isArray(t.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(t.value.length!==e.value.length)return!1;for(let r=0;r<t.value.length;r++)if(!Y.compareSingleValues(e.value[r],t.value[r],e.baseType))return!1;return!0}case"multiple":{if(!Array.isArray(t.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(t.value.length!==e.value.length)return!1;let r=0;for(let n of e.value){let i=null,s=[...t.value];for(let a of s)if(Y.compareSingleValues(n,a,e.baseType)){i=a;break}if(i!==null)s.splice(s.indexOf(i),1);else return!1;r++}return!0}default:return console.error("unexpected cardinality in qti match"),!1}}};var rf=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},gn=class extends E{constructor(){super(...arguments),this.name=""}get resultBaseType(){return"float"}getResult(){switch(this.name.toLowerCase()){case"pi":return Math.PI;case"e":return Math.E;default:return console.error(`qti-math-constant: unknown constant "${this.name}"`),null}}};rf([p({type:String})],gn.prototype,"name",void 0);var nf=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},bn=class extends E{constructor(){super(...arguments),this.name=""}get resultBaseType(){return["floor","ceil","signum"].includes(this.name?.toLowerCase())?"integer":"float"}getResult(){if(!this.name)return console.error("qti-math-operator requires a name attribute"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=[];for(let r of t){if(r.cardinality!=="single")return console.error("qti-math-operator requires single cardinality"),null;if(Array.isArray(r.value))return console.error("qti-math-operator unexpected array value for single cardinality"),null;if(r.value===null||r.value===void 0)return null;if(r.baseType!=="integer"&&r.baseType!=="float")return console.error("qti-math-operator requires numerical base-type"),null;let n=parseFloat(r.value);if(isNaN(n))return console.error("qti-math-operator non-numerical value"),null;e.push(n)}return this.#e(this.name,e)}#t(t){return Number.isFinite(t)?t:null}#e(t,e){try{switch(t.toLowerCase()){case"sin":return e.length!==1?null:Math.sin(e[0]);case"cos":return e.length!==1?null:Math.cos(e[0]);case"tan":return e.length!==1?null:Math.tan(e[0]);case"asin":return e.length!==1||e[0]<-1||e[0]>1?null:Math.asin(e[0]);case"acos":return e.length!==1||e[0]<-1||e[0]>1?null:Math.acos(e[0]);case"atan":return e.length!==1?null:Math.atan(e[0]);case"sinh":return e.length!==1?null:Math.sinh(e[0]);case"cosh":return e.length!==1?null:Math.cosh(e[0]);case"tanh":return e.length!==1?null:Math.tanh(e[0]);case"secant":case"sec":return e.length!==1?null:this.#t(1/Math.cos(e[0]));case"cosecant":case"csc":return e.length!==1?null:this.#t(1/Math.sin(e[0]));case"cotangent":case"cot":return e.length!==1?null:this.#t(Math.cos(e[0])/Math.sin(e[0]));case"todegrees":return e.length!==1?null:e[0]*180/Math.PI;case"toradians":return e.length!==1?null:e[0]*Math.PI/180;case"log":return e.length!==1||e[0]<=0?null:Math.log10(e[0]);case"ln":return e.length!==1||e[0]<=0?null:Math.log(e[0]);case"log10":return e.length!==1||e[0]<=0?null:Math.log10(e[0]);case"exp":return e.length!==1?null:Math.exp(e[0]);case"abs":return e.length!==1?null:Math.abs(e[0]);case"sqrt":return e.length!==1||e[0]<0?null:Math.sqrt(e[0]);case"signum":return e.length!==1?null:Math.sign(e[0]);case"floor":return e.length!==1?null:Math.floor(e[0]);case"ceil":return e.length!==1?null:Math.ceil(e[0]);case"round":return e.length!==1?null:Math.round(e[0]);case"atan2":return e.length!==2?null:Math.atan2(e[0],e[1]);case"pow":{if(e.length!==2)return null;let r=e[0],n=e[1];return r===0&&n<=0||r<0&&!Number.isInteger(n)?null:Math.pow(r,n)}case"log_base":{if(e.length!==2)return null;let r=e[0],n=e[1];return r<=0||n<=0||n===1?null:Math.log(r)/Math.log(n)}case"mod":return e.length!==2||e[1]===0?null:e[0]%e[1];case"max":return e.length<1?null:Math.max(...e);case"min":return e.length<1?null:Math.min(...e);default:return console.error(`qti-math-operator: unknown operation "${t}"`),null}}catch(r){return console.error(`qti-math-operator: error performing operation "${t}":`,r),null}}};nf([p({type:String})],bn.prototype,"name",void 0);var Fs=class extends E{getResult(){let t=this.#t(this.getVariables());return t.length===0?(console.warn("qti-max: no numeric values provided"),null):Math.max(...t)}#t(t){let e=[];for(let r of t){if(!r)continue;let n=i=>{if(i==null)return;let s=parseFloat(i.toString());if(Number.isNaN(s)){console.warn("qti-max: non-numeric value encountered");return}e.push(s)};if(Array.isArray(r.value)){r.value.forEach(i=>n(i));continue}n(r.value)}return e}};var Bs=class extends E{getResult(){let t=this.getVariables();this.children.length!==2&&console.warn("The member operator takes two sub-expressions");let[e,r]=t;if(e.baseType===r.baseType||e.baseType==="integer"&&r.baseType==="float"||e.baseType==="float"&&r.baseType==="integer"||console.warn("Which must both have the same base-type"),r.cardinality==="multiple"||r.cardinality==="ordered"||console.warn("and the second must be a multiple or ordered container"),(e.baseType==="float"||r.baseType==="float")&&console.warn("The member operator should not be used on sub-expressions with a base-type of float"),(e.baseType==="duration"||r.baseType==="duration")&&console.warn("It must not be used on sub-expressions with a base-type of duration"),e.value===null||r.value===null)return null;let n=e.value;return r.value.includes(n)}};var Us=class extends E{getResult(){let t=this.#t(this.getVariables());return t.length===0?(console.warn("qti-min: no numeric values provided"),null):Math.min(...t)}#t(t){let e=[];for(let r of t){if(!r)continue;let n=i=>{if(i==null)return;let s=parseFloat(i.toString());if(Number.isNaN(s)){console.warn("qti-min: non-numeric value encountered");return}e.push(s)};if(Array.isArray(r.value)){r.value.forEach(i=>n(i));continue}n(r.value)}return e}};var Hs=class extends E{getResult(){let t=this.getVariables();if(t.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of t)if(e.cardinality!=="multiple"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti multiple"),[];return t}};var Ws=class extends E{render(){return b`${super.render()}`}getResult(){return!this.firstElementChild.calculate()}};var Qs=class extends E{getResult(){return null}};var Gs=class extends Xt{getResult(){return Array.from(this.children).map(e=>{let r=e;if(!r.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let n=r.calculate(),i=!1;if(typeof n=="string")if(n==="true")i=!0;else if(n==="false")i=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof n=="boolean"&&(i=n);return i}).some(e=>typeof e=="boolean"&&e)}};var Xs=class extends E{getResult(){let t=this.getVariables();if(t.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of t)if(e.cardinality!=="ordered"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti ordered"),[];return t}};var Ys=class extends C{render(){return b`<slot></slot>`}process(){let t=this.getSubRules();for(let e=0;e<t.length;e++)t[e].process()}},ni=class extends Ys{shouldProcess(){return!0}getSubRules(){return[...this.children]}},oi=class extends Ys{shouldProcess(){return this.firstElementChild.calculate()}getSubRules(){let t=[];for(let e=1;e<this.children.length;e++)t.push(this.children[e]);return t}},si=class extends X{render(){return b`<slot></slot>`}process(){let t=[...this.children];for(let e of t)if(e.shouldProcess()){e.process();return}}};var Ks=class extends si{};var ai=class extends oi{};var Js=class extends ai{};var Zs=class extends ni{};var of=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},yn=class extends E{constructor(){super(...arguments),this.pattern=""}getResult(){let t=this.getVariables();if(t.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 e=t[0];if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-pattern-match requires single cardinality"),null;if(e.value===null||e.value===void 0)return null;let r=this.#t();return r?r.test(e.value.toString()):null}#t(){let t=`^(?:${this.pattern})$`;try{return new RegExp(t,"u")}catch{try{return new RegExp(t)}catch(e){return console.error("qti-pattern-match requires a valid regular expression",e),null}}}};of([p({type:String})],yn.prototype,"pattern",void 0);var ta=class extends E{get resultBaseType(){return"float"}getResult(){if(this.children.length!==2)return console.error("qti-power must have exactly two child expressions"),null;let t=this.getVariables();if(!t||t.length!==2)return null;let[e,r]=t;if(e.cardinality!=="single"||r.cardinality!=="single")return console.error("qti-power requires single cardinality for both expressions"),null;if(Array.isArray(e.value)||Array.isArray(r.value))return console.error("qti-power unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0||r.value===null||r.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float"||r.baseType!=="integer"&&r.baseType!=="float")return console.error("qti-power requires numerical base-types"),null;let n=parseFloat(e.value),i=parseFloat(r.value);if(isNaN(n)||isNaN(i))return console.error("qti-power: non-numerical values encountered"),null;if(n===0&&i<=0||n<0&&!Number.isInteger(i))return null;let s;try{s=Math.pow(n,i)}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}};var sf=/%(?:(%)|([-+ 0#]*)(\d+)?(?:\.(\d+))?([diuoxXfFeEgGsc]))/g;function af(o){return o.replace(/e([+-])(\d)$/,"e$10$2")}function vn(o,t){return af(t===void 0?o.toExponential():o.toExponential(t))}function Ip(o){let[t,e]=o.split(/e/i),r=t.includes(".")?t.replace(/\.?0+$/,""):t,n=e===void 0?"":`e${e}`;return`${r}${n}`}function _p(o,t){let e=t===0?1:t,r=o===0?0:Math.floor(Math.log10(o));return r<-4||r>=e?Ip(vn(o,e-1)):Ip(o.toFixed(Math.max(0,e-1-r)))}function lf(o,t,e,r){if(o==="s"||o==="c"){let c=o==="c"?r.slice(0,1):r;return e===void 0?c:c.slice(0,e)}let n=Number(r);if(r.trim()===""||!Number.isFinite(n))return r;let i=Math.abs(n),s,a=n<0;switch(o){case"d":case"i":s=String(Math.trunc(i));break;case"u":s=String(Math.trunc(i)),a=!1;break;case"o":s=`${t.includes("#")?"0":""}${Math.trunc(i).toString(8)}`;break;case"x":s=`${t.includes("#")?"0x":""}${Math.trunc(i).toString(16)}`;break;case"X":s=`${t.includes("#")?"0X":""}${Math.trunc(i).toString(16).toUpperCase()}`;break;case"f":case"F":s=i.toFixed(e??6);break;case"e":s=vn(i,e??6);break;case"E":s=vn(i,e??6).toUpperCase();break;case"g":s=_p(i,e??6);break;case"G":s=_p(i,e??6).toUpperCase();break;default:return r}return`${a?"-":t.includes("+")?"+":t.includes(" ")?" ":""}${s}`}function cf(o,t,e){if(o.length>=e)return o;let r=e-o.length;if(t.includes("-"))return`${o}${" ".repeat(r)}`;if(t.includes("0")){let[,n,i]=/^([-+ ]?)(.*)$/.exec(o);return`${n}${"0".repeat(r)}${i}`}return`${" ".repeat(r)}${o}`}function Tp(o,t){return o.replace(sf,(e,r,n,i,s,a)=>r?"%":cf(lf(a,n??"",s===void 0?void 0:Number(s),t),n??"",i===void 0?0:Number(i)))}var ge=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},vt=class extends C{constructor(){super(...arguments),this.base=10,this.powerForm=!1,this.delimiter=";",this.mappingIndicator="="}render(){let t=this.context?.variables.find(r=>r.identifier===this.identifier),e=t?this.#t(t):null;return e===null?O:b`${e}`}#t(t){let e=t.value;if(e==null)return null;if(Array.isArray(e)){if(e.length===0)return null;if(this.index!==void 0){let r=e[this.index-1];return r==null?null:this.#e(r,t.baseType)}return e.map(r=>this.#e(r,t.baseType)).join(this.delimiter)}if(typeof e=="object"){let r=e;if(this.field!==void 0){let i=r[this.field];return i==null?null:this.#e(i,t.baseType)}let n=Object.entries(r).filter(([,i])=>i!=null);return n.length===0?null:n.map(([i,s])=>`${i}${this.mappingIndicator}${this.#e(s,t.baseType)}`).join(this.delimiter)}return this.#e(e,t.baseType)}#e(t,e){let r=Array.isArray(t)?t.join(" "):String(t);if(this.format)return Tp(this.format,r);if(e==="integer"&&this.base!==10){let n=Number.parseInt(r,10);if(Number.isFinite(n))return n.toString(this.base)}if(this.powerForm){let n=Number(r);if(r.trim()!==""&&Number.isFinite(n))return vn(n)}return r}calculate(){return this.context.variables.find(e=>e.identifier===this.identifier)||null}};ge([p({type:String})],vt.prototype,"identifier",void 0);ge([p({type:String})],vt.prototype,"format",void 0);ge([p({type:Number})],vt.prototype,"base",void 0);ge([p({type:Number})],vt.prototype,"index",void 0);ge([p({type:Boolean,attribute:"power-form"})],vt.prototype,"powerForm",void 0);ge([p({type:String})],vt.prototype,"field",void 0);ge([p({type:String})],vt.prototype,"delimiter",void 0);ge([p({type:String,attribute:"mapping-indicator"})],vt.prototype,"mappingIndicator",void 0);ge([_({context:F,subscribe:!0}),T()],vt.prototype,"context",void 0);var ea=class extends E{getResult(){return this.getVariables().reduce((r,n)=>{if(n.baseType=="float"||n.baseType=="integer")try{return r*parseFloat(n.value.toString())}catch{console.warn("can not convert to number")}else console.warn(`has another baseType ${n.baseType}`);return r},1)}};var Vl=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},qr=class extends E{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 t=[],e=0;for(;;){let n=this.min+this.step*e;if(n>this.max)break;Number.isInteger(n)&&t.push(n),e++}if(t.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 r=Math.floor(Math.random()*t.length);return t[r]}getPossibleValues(){let t=[];if(this.min>this.max||this.step<=0)return[Number.isInteger(this.min)?this.min:Math.floor(this.min)];let e=0;for(;;){let r=this.min+this.step*e;if(r>this.max)break;Number.isInteger(r)&&t.push(r),e++}return t.length>0?t:[Number.isInteger(this.min)?this.min:Math.floor(this.min)]}};Vl([p({type:Number})],qr.prototype,"min",void 0);Vl([p({type:Number})],qr.prototype,"max",void 0);Vl([p({type:Number})],qr.prototype,"step",void 0);var ra=class extends E{getResult(){let t=this.getVariables();if(t.length===1){let e=t[0].value;if(Array.isArray(e)){let r=Math.floor(Math.random()*e.length);return e[r]}return e}return console.error("unexpected number of children in match"),null}};var df=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},zl=1e3,wn=class extends E{constructor(){super(...arguments),this.numberRepeats=""}getResult(){let t=this.#t();if(t<=0)return[];let e=this.firstElementChild;if(!e)return console.warn("qti-repeat: missing child expression"),[];let r=[];for(let n=0;n<t;n++){let i=e.calculate(),s=this.#r(i);s&&r.push(s)}return r}#t(){if(!this.numberRepeats)return console.warn("qti-repeat: missing number-repeats attribute"),0;let t=parseInt(this.numberRepeats,10);if(!Number.isNaN(t))return this.#e(t);let e=this.numberRepeats,r=this.context?.variables?.find(s=>s.identifier===e);if(!r)return console.warn(`qti-repeat: unknown identifier "${e}"`),0;let n=Array.isArray(r.value)?r.value[0]:r.value,i=parseInt(n?.toString()??"",10);return Number.isNaN(i)?(console.warn(`qti-repeat: invalid repeat count from "${e}"`),0):this.#e(i)}#e(t){return t>zl?(console.warn(`qti-repeat: number-repeats ${t} exceeds the ${zl} limit, truncating`),zl):t}#r(t){if(t==null)return null;if(typeof t=="number")return{identifier:"",cardinality:"single",baseType:Number.isInteger(t)?"integer":"float",value:t.toString(),type:"response"};if(typeof t=="string"){let e=parseFloat(t);if(!Number.isNaN(e))return{identifier:"",cardinality:"single",baseType:Number.isInteger(e)?"integer":"float",value:t.toString(),type:"response"}}if(t&&typeof t=="object"&&"value"in t){let e=t.value;return{identifier:"",cardinality:"single",baseType:t.baseType??"string",value:e!=null?e.toString():null,type:"response"}}return{identifier:"",cardinality:"single",baseType:"string",value:t.toString(),type:"response"}}};df([p({type:String,attribute:"number-repeats"})],wn.prototype,"numberRepeats",void 0);var ia=class extends si{};var li=class extends oi{};var na=class extends li{};var oa=class extends ni{};var sa=class extends X{process(){for(let t of[...this.children])t.process()}};var Rp=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},ci=class extends E{constructor(){super(...arguments),this.roundingMode="significantFigures",this.figures=3}get resultBaseType(){return"float"}getResult(){if(this.children.length!==1)return console.error("qti-round-to must have exactly one child expression"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=t[0];if(e.cardinality!=="single")return console.error("qti-round-to requires single cardinality"),null;if(Array.isArray(e.value))return console.error("qti-round-to 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-to requires numerical base-type"),null;let r=parseFloat(e.value);return isNaN(r)?null:isFinite(r)?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.#t(r,this.figures):this.#e(r,this.figures):r===1/0?1/0:r===-1/0?-1/0:null}#t(t,e){if(t===0)return 0;let r=Math.pow(10,e);return Math.round(t*r)/r}#e(t,e){if(t===0)return 0;let r=Math.floor(Math.log10(Math.abs(t))),n=Math.pow(10,e-r-1);return Math.round(t*n)/n}};Rp([p({type:String,attribute:"rounding-mode"})],ci.prototype,"roundingMode",void 0);Rp([p({type:Number})],ci.prototype,"figures",void 0);var aa=class extends E{get resultBaseType(){return"integer"}getResult(){if(this.children.length!==1)return console.error("qti-round must have exactly one child expression"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=t[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 r=parseFloat(e.value);return isNaN(r)?(console.warn("qti-round: NaN input results in NULL"),null):isFinite(r)?Math.floor(r+.5):r===1/0?1/0:r===-1/0?-1/0:null}};var la=class extends X{process(){let t=this.getAttribute("identifier");if(!t){console.warn('QtiSetCorrectResponse: Missing "identifier" attribute.');return}let e=this.firstElementChild;if(!e){console.warn("QtiSetCorrectResponse: No expression found.");return}let n=new jl(e).process();this.dispatchEvent(new CustomEvent("qti-set-correct-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:t,value:this.#t(n)}}))}#t(t){return t==null?null:Array.isArray(t)?t.map(e=>Ot(this.#e(e))):Ot(this.#e(t))}#e(t){if(t&&typeof t=="object"&&"value"in t){let e=t.value;return e!=null?e.toString():""}return t?.toString()??""}},jl=class{constructor(t){this.expression=t}process(){let t=this.expression.calculate()??null;return t===null&&console.warn("QtiSetCorrectResponseRule: Evaluated value is null."),Array.isArray(t)?t.map(e=>this.#t(e)):this.#t(t)}#t(t){return t&&typeof t=="object"&&"value"in t?t.value:t}};var ca=class extends X{process(){let t=this.getAttribute("identifier");if(!t){console.warn('QtiSetOutcomeValue: Missing "identifier" attribute.');return}let e=this.firstElementChild;if(!e){console.warn("QtiSetOutcomeValue: No expression found.");return}let n=new Fl(e).process();this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:t,value:this.#t(n)}}))}#t(t){return Array.isArray(t)?t.map(Ot):t!==null?Ot(t):null}},Fl=class{constructor(t){this.expression=t}process(){let t=this.expression.calculate()??null;return t===null&&console.warn("QtiSetOutcomeValueRule: Evaluated value is null."),Array.isArray(t)?t.map(e=>e.value?e.value:e):t}};var da=class extends X{process(){let t=this.getAttribute("identifier");if(!t){console.warn('QtiSetTemplateValue: Missing "identifier" attribute.');return}let e=this.firstElementChild;if(!e){console.warn("QtiSetTemplateValue: No expression found.");return}let n=new Bl(e).process();this.dispatchEvent(new CustomEvent("qti-set-template-value",{bubbles:!0,composed:!0,detail:{templateIdentifier:t,value:this.#t(n)}}))}#t(t){return t==null?null:Array.isArray(t)?t.map(e=>Ot(this.#e(e))):Ot(this.#e(t))}#e(t){if(t&&typeof t=="object"&&"value"in t){let e=t.value;return e!=null?e.toString():""}return t?.toString()??""}},Bl=class{constructor(t){this.expression=t}process(){let t=this.expression.calculate()??null;return t===null&&console.warn("QtiSetTemplateValueRule: Evaluated value is null."),Array.isArray(t)?t.map(e=>this.#t(e)):this.#t(t)}#t(t){return t&&typeof t=="object"&&"value"in t?t.value:t}};var hf=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},xn=class extends E{constructor(){super(...arguments),this.name=""}get resultBaseType(){return"float"}getResult(){if(!this.name)return console.warn("qti-stats-operator: missing name attribute"),null;let t=this.#i(this.getVariables());if(t.length===0)return console.warn("qti-stats-operator: no numeric values provided"),null;switch(this.name.toLowerCase()){case"mean":return this.#t(t);case"median":return this.#e(t);case"popvariance":return this.#r(t,t.length);case"popsd":return Math.sqrt(this.#r(t,t.length));case"samplevariance":return t.length<2?null:this.#r(t,t.length-1);case"samplesd":return t.length<2?null:Math.sqrt(this.#r(t,t.length-1));default:return console.warn(`qti-stats-operator: unsupported operator "${this.name}"`),null}}#t(t){return t.reduce((e,r)=>e+r,0)/t.length}#e(t){let e=[...t].sort((n,i)=>n-i),r=Math.floor(e.length/2);return e.length%2===0?(e[r-1]+e[r])/2:e[r]}#r(t,e){let r=this.#t(t);return t.reduce((n,i)=>n+Math.pow(i-r,2),0)/e}#i(t){let e=[];for(let r of t){if(!r)continue;let n=i=>{if(i==null)return;let s=parseFloat(i.toString());if(Number.isNaN(s)){console.warn("qti-stats-operator: non-numeric value encountered");return}e.push(s)};if(Array.isArray(r.value)){r.value.forEach(i=>n(i));continue}n(r.value)}return e}};hf([p({type:String})],xn.prototype,"name",void 0);var pf=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},qn=class extends E{constructor(){super(...arguments),this.caseSensitive="true"}getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if(e.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(r.value))return console.error("unexpected cardinality in qti string-match"),!1;let n=this.caseSensitive==="true"?e.value:e.value.toLowerCase(),i=this.caseSensitive==="true"?r.value:r.value.toLowerCase();return Y.compareSingleValues(n,i,e.baseType)}return console.error("unexpected number of children in qti-string-match"),null}};pf([p({type:String,attribute:"case-sensitive"})],qn.prototype,"caseSensitive",void 0);var uf=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Cn=class extends E{constructor(){super(...arguments),this.caseSensitive="true"}getResult(){let t=this.getVariables();if(t.length!==2)return console.error("qti-substring requires exactly 2 child expressions"),null;let[e,r]=t;if(e.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(r.value))return console.error("qti-substring requires single cardinality"),null;if(e.value===null||r.value===null||e.value===void 0||r.value===void 0)return null;let n=e.value.toString(),i=r.value.toString();return this.caseSensitive!=="true"?i.toLowerCase().includes(n.toLowerCase()):i.includes(n)}};uf([p({type:String,attribute:"case-sensitive"})],Cn.prototype,"caseSensitive",void 0);var ha=class extends mf(E){getResult(){return this.calculateChildren(Array.from(this.children))}};function mf(o){return class extends o{calculateChildren(e){let r=e.map(n=>{if(!n.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let i=n.calculate();return Number.isNaN(i)?(console.error("Unexpected value in qti-subtract, expected number"),null):Number(i)});return r.some(n=>n===null)?(console.error("One or more child expressions returned invalid values"),0):r[0]-r[1]}}}var pa=class extends E{getResult(){return new Ul(Array.from(this.children)).calculate()}},Ul=class{constructor(t){this.expressions=t}calculate(){return this.expressions.filter(r=>r.calculate!==void 0).some(r=>r.calculate()===null)?null:this.expressions.map(r=>{let n=r.calculate();return Number.isNaN(n)?(console.error("unexpected value in qti-sum, expected number"),null):Number(n)}).reduce((r,n)=>r+n,0)}};var ua=class extends E{get resultBaseType(){return"integer"}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-truncate requires exactly one child expression"),null;let e=t[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 r=Number.parseFloat(e.value);return Number.isNaN(r)?(console.error("qti-truncate requires a numerical value"),null):Math.trunc(r)}};var ma=class extends E{getResult(){let t=this.getAttribute("identifier")||"";return this.resolveVariable(t)?.value??null}};var Pp=[{tag:"qti-and",ctor:ws},{tag:"qti-any-n",ctor:ti},{tag:"qti-base-value",ctor:hn},{tag:"qti-container-size",ctor:xs},{tag:"qti-contains",ctor:qs},{tag:"qti-correct",ctor:Cs},{tag:"qti-default",ctor:xr},{tag:"qti-delete",ctor:Ss},{tag:"qti-divide",ctor:ks},{tag:"qti-duration-gte",ctor:Es},{tag:"qti-duration-lt",ctor:As},{tag:"qti-equal",ctor:ei},{tag:"qti-equal-rounded",ctor:pn},{tag:"qti-exit-response",ctor:Is},{tag:"qti-exit-test",ctor:_s},{tag:"qti-field-value",ctor:Ts},{tag:"qti-gcd",ctor:Rs},{tag:"qti-gt",ctor:Ps},{tag:"qti-gte",ctor:Os},{tag:"qti-index",ctor:un},{tag:"qti-inside",ctor:ri},{tag:"qti-integer-divide",ctor:Ms},{tag:"qti-integer-modulus",ctor:Ds},{tag:"qti-integer-to-float",ctor:Ns},{tag:"qti-is-null",ctor:$s},{tag:"qti-lcm",ctor:Ls},{tag:"qti-lookup-outcome-value",ctor:ii},{tag:"qti-lt",ctor:Vs},{tag:"qti-lte",ctor:zs},{tag:"qti-map-response",ctor:fn},{tag:"qti-map-response-point",ctor:mn},{tag:"qti-match",ctor:js},{tag:"qti-math-constant",ctor:gn},{tag:"qti-math-operator",ctor:bn},{tag:"qti-max",ctor:Fs},{tag:"qti-member",ctor:Bs},{tag:"qti-min",ctor:Us},{tag:"qti-multiple",ctor:Hs},{tag:"qti-not",ctor:Ws},{tag:"qti-null",ctor:Qs},{tag:"qti-or",ctor:Gs},{tag:"qti-ordered",ctor:Xs},{tag:"qti-outcome-condition",ctor:Ks},{tag:"qti-outcome-else",ctor:Zs},{tag:"qti-outcome-else-if",ctor:Js},{tag:"qti-outcome-if",ctor:ai},{tag:"qti-pattern-match",ctor:yn},{tag:"qti-power",ctor:ta},{tag:"qti-printed-variable",ctor:vt},{tag:"qti-product",ctor:ea},{tag:"qti-random",ctor:ra},{tag:"qti-random-integer",ctor:qr},{tag:"qti-repeat",ctor:wn},{tag:"qti-response-condition",ctor:ia},{tag:"qti-response-else",ctor:oa},{tag:"qti-response-else-if",ctor:na},{tag:"qti-response-if",ctor:li},{tag:"qti-response-processing-fragment",ctor:sa},{tag:"qti-round",ctor:aa},{tag:"qti-round-to",ctor:ci},{tag:"qti-rule",ctor:X},{tag:"qti-set-correct-response",ctor:la},{tag:"qti-set-outcome-value",ctor:ca},{tag:"qti-set-template-value",ctor:da},{tag:"qti-stats-operator",ctor:xn},{tag:"qti-string-match",ctor:qn},{tag:"qti-substring",ctor:Cn},{tag:"qti-subtract",ctor:ha},{tag:"qti-sum",ctor:pa},{tag:"qti-truncate",ctor:ua},{tag:"qti-variable",ctor:ma}];for(let{tag:o,ctor:t}of Pp)customElements.get(o)||customElements.define(o,t);var be=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},tt;(function(o){o.Correct="correct",o.PartiallyCorrect="partially-correct",o.Incorrect="incorrect"})(tt||(tt={}));var Hl=o=>{class t extends o{constructor(){super(...arguments),this.showCorrectResponse=!1,this._handleShowCorrectResponseChange=(r,n)=>{this.toggleInternalCorrectResponse(n)},this.showFullCorrectResponse=!1,this._handleShowFullCorrectResponseChange=(r,n)=>{this.toggleFullCorrectResponse(n)},this.showCandidateCorrection=!1,this._handleShowCandidateCorrectionChange=(r,n)=>{this.toggleCandidateCorrection(n)},this._correctResponse=null}set correctResponseAttr(r){this._correctResponse=r}get correctResponseAttr(){return this._correctResponse}get isFullCorrectResponse(){return this._isFullCorrectResponse}get registersWithItem(){return!this.isFullCorrectResponse&&super.registersWithItem}set isFullCorrectResponse(r){this._isFullCorrectResponse=r,r&&(this.setAttribute("inert",""),this.setAttribute("response-identifier",this.responseIdentifier+"_cr"),this.setAttribute("answer-key",""))}get correctResponse(){let r=this.responseVariable;return r?.correctResponse?r.correctResponse:this._correctResponse}set correctResponse(r){let n=this._correctResponse;this._correctResponse=r,r==null?this.removeAttribute("correct-response"):this.setAttribute("correct-response",Array.isArray(r)?r.join(","):r),this.requestUpdate("_correctResponse",n)}get correctness(){let r=this.correctResponse;if(!r)return null;let n=this.response;if(n==null||n===""||Array.isArray(n)&&n.length===0)return null;let i=Array.isArray(r)?r:[r],a=(Array.isArray(n)?n:[n]).filter(d=>d!=="");if(a.length===0)return null;let l=a.filter(d=>i.includes(d)).length,c=a.filter(d=>!i.includes(d)).length;return l===i.length&&c===0&&a.length===i.length?tt.Correct:l>0&&(l<i.length||c>0)?tt.PartiallyCorrect:tt.Incorrect}get correctionPart(){return"correction"}toggleCorrectResponse(r){(this.configContext?.correctResponseMode||"internal")==="full"?this.toggleFullCorrectResponse(r):this.toggleInternalCorrectResponse(r)}get withholdsFullCorrectResponseWhenCorrect(){return this.configContext?.fullCorrectResponseOnlyWhenIncorrect!==!1}async toggleFullCorrectResponse(r){let n=this.nextSibling,i=n instanceof HTMLDivElement&&n?.classList.contains("full-correct-response"),s=this.correctResponse;if(!s)return;if(!(r&&(!this.withholdsFullCorrectResponseWhenCorrect||this.correctness!==tt.Correct))){if(!i)return;this.parentElement?.removeChild(n);return}if(i)return;let l=this.cloneNode(!0);l.removeAttribute("show-full-correct-response"),l.removeAttribute("show-correct-response"),l.removeAttribute("show-candidate-correction");let c=document.createElement("div");c.classList.add("full-correct-response"),this.isInline?c.classList.add("full-correct-response-inline"):c.classList.add("full-correct-response-block"),c.role="full-correct-response",c.appendChild(l),l.isFullCorrectResponse=!0,this.parentElement?.insertBefore(c,this.nextSibling),await l.updateComplete,l.response=Array.isArray(s)?[...s]:s}toggleInternalCorrectResponse(r){this._internals.states.delete("show-correct-response"),r&&this.correctResponse&&this._internals.states.add("show-correct-response")}toggleCandidateCorrection(r){}firstUpdated(){super.firstUpdated(),!this.isFullCorrectResponse&&(this.showCorrectResponse&&this.toggleInternalCorrectResponse(!0),this.showFullCorrectResponse&&this.toggleFullCorrectResponse(!0))}}return be([p({attribute:"correct-response",reflect:!0,converter:Yt({emptyAs:null})})],t.prototype,"correctResponseAttr",null),be([p({type:Boolean,attribute:"show-correct-response",reflect:!0})],t.prototype,"showCorrectResponse",void 0),be([L("showCorrectResponse",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowCorrectResponseChange",void 0),be([p({type:Boolean,attribute:"show-full-correct-response",reflect:!0})],t.prototype,"showFullCorrectResponse",void 0),be([L("showFullCorrectResponse",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowFullCorrectResponseChange",void 0),be([p({type:Boolean,attribute:"show-candidate-correction",reflect:!0})],t.prototype,"showCandidateCorrection",void 0),be([L("showCandidateCorrection",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowCandidateCorrectionChange",void 0),be([T()],t.prototype,"_isFullCorrectResponse",void 0),be([T()],t.prototype,"_correctResponse",void 0),t};var st=q`
9640
+ `}async#i(t){let e=t.target;e.files&&e.files.length>0&&(this.#t=e.files[0],this.#e=await this.#r(this.#t),this.saveResponse(this.#e),this.dispatchEvent(new CustomEvent("qti-interaction-response",{detail:{response:this.#e}})))}#r(t){return new Promise((e,i)=>{let n=new FileReader;n.onload=()=>e(n.result),n.onerror=()=>i(n.error),n.readAsDataURL(t)})}};var ks=[{tag:"qti-upload-interaction",ctor:Ss}];var Op=[...Ko,...Jo,...Zo,...es,...is,...rs,...os,...ss,...as,...ls,...cs,...ds,...hs,...us,...ms,...gs,...vs,...xs,...qs,...Cs,...ks,...Mh];for(let{tag:o,ctor:t}of Op)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Ko)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Jo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Zo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of es)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of is)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of rs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of os)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ss)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of as)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ls)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of cs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ds)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of hs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of us)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ms)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of gs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of vs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of xs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of qs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Cs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ks)customElements.get(o)||customElements.define(o,t);var b3=async o=>{let t=o.substring(0,o.lastIndexOf("/")),e=await Ad().load(`${o}`).then(a=>a.assessmentTest()),i=await zi().load(`${t}/${e.href}`).then(a=>a.htmlDoc()),n=await zi().load(`${t}/${e.href}`).then(a=>a.items()),r=`${t}/${e.href}`,s=`${t}/${e.href.substring(0,e.href.lastIndexOf("/"))}`;return{testHTMLDoc:i,testURI:s,testURL:r,items:n,testIdentifier:e.identifier}},y3=async o=>Jt().load(o).then(t=>t.htmlDoc().firstElementChild);var Es=class extends df(Yt){calculate(){return this.calculateChildren(Array.from(this.children))}};function df(o){return class extends o{calculateChildren(e){return e.map(n=>{let r=n;if(!r.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let s=r.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(n=>typeof n=="boolean"&&n)}}}var Mp=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},ir=class extends E{constructor(){super(...arguments),this.min=0,this.max=1/0}getResult(){let t=this.getVariables();if(!t||t.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 e=0;for(let i of t){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"&&e++}return e>=this.min&&e<=this.max}};Mp([p({type:Number})],ir.prototype,"min",void 0);Mp([p({type:Number})],ir.prototype,"max",void 0);var hf=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},mn=class extends E{constructor(){super(...arguments),this.baseType="string"}getResult(){return this.textContent.trim()}};hf([p({type:String,attribute:"base-type"})],mn.prototype,"baseType",void 0);var Is=class extends E{get resultBaseType(){return"integer"}getResult(){if(this.children?.length!==1)return console.error("qti-container-size must have exactly one child expression"),0;let t=this.getVariables();if(!t||t?.length===0)return 0;let e=t[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)}};var As=class extends E{getResult(){if(this.children.length!==2)return console.error("qti-contains takes two sub-expressions"),null;let[t,e]=this.getVariables();if(!t||!e||t.value===null||t.value===void 0||e.value===null||e.value===void 0)return null;t.baseType!==e.baseType&&console.warn("qti-contains: both sub-expressions should have the same base-type");let i=t.baseType??e.baseType;if(t.cardinality==="single"&&e.cardinality!=="single")return console.warn("qti-contains: first sub-expression is single; treating it as a membership test"),this.#t(e.value).some(s=>this.#e(s,t.value,i));let n=this.#t(t.value),r=this.#t(e.value);return r.length===0?!0:t.cardinality==="ordered"&&e.cardinality==="ordered"?this.#r(n,r,i):this.#i(n,r,i)}#t(t){return Array.isArray(t)?[...t]:[t]}#e(t,e,i){return Y.compareSingleValues(t,e,i)||t===e}#i(t,e,i){let n=[...t];return e.every(r=>{let s=n.findIndex(a=>this.#e(a,r,i));return s===-1?!1:(n.splice(s,1),!0)})}#r(t,e,i){for(let n=0;n+e.length<=t.length;n++)if(e.every((r,s)=>this.#e(t[n+s],r,i)))return!0;return!1}};var _s=class extends E{get interpretation(){return this.getAttribute("interpretation")||""}getResult(){let t=this.getAttribute("identifier")||"",e=this.context.variables.find(i=>i.identifier===t)||null;return e.cardinality!=="single"?e.correctResponse.length>0?e.correctResponse[0]:"":e.correctResponse}};var Ul=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},Ci=class extends E{constructor(){super(...arguments),this.identifier=""}getResult(){if(!this.identifier)return console.error("qti-default requires an identifier attribute"),null;let t=this.identifier.split("."),e=null,i;if(t.length===2)e=t[0],i=t[1];else if(t.length===1)i=t[0];else return console.error("qti-default: invalid identifier format"),null;if(e){let r=this._testContext.items.find(a=>a.identifier===e);if(!this._testContext||!r)return console.warn(`qti-default: item "${e}" not found in test context`),null;let s=this._testContext.items.find(a=>a.identifier===e)?.variables.find(a=>a.identifier===i);return s?s.defaultValue||null:(console.warn(`qti-default: variable "${i}" not found in item "${e}"`),null)}if(!this.context?.variables)return console.warn("qti-default: no variables found in item context"),null;let n=this.context.variables.find(r=>r.identifier===i);return n?n.defaultValue||null:(console.warn(`qti-default: variable "${i}" not found in item context`),null)}};Ul([p({type:String})],Ci.prototype,"identifier",void 0);Ul([_({context:F,subscribe:!0}),T()],Ci.prototype,"context",void 0);Ul([T(),_({context:at,subscribe:!0})],Ci.prototype,"_testContext",void 0);var Ts=class extends E{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],i=t[1];return e.cardinality!=="single"||!Array.isArray(i.value)?(console.error("unexpected cardinality in qti equal"),null):t[0].baseType!==t[1].baseType?(console.error("The baseType of the two variables is different"),null):i.value.filter(r=>!e.value.includes(r))}return null}};var Rs=class extends E{get resultBaseType(){return"float"}getResult(){let t=this.#t(this.getVariables());return t.length!==2?(console.warn("qti-divide: expected exactly 2 numeric values"),null):t[1]===0?(console.warn("qti-divide: division by zero"),null):t[0]/t[1]}#t(t){let e=[];for(let i of t){if(!i)continue;let n=r=>{if(r==null)return;let s=parseFloat(r.toString());if(Number.isNaN(s)){console.warn("qti-divide: non-numeric value encountered");return}e.push(s)};if(Array.isArray(i.value)){i.value.forEach(r=>n(r));continue}n(i.value)}return e}};var Ps=class extends E{getResult(){let t=this.#t();return t?t[0]>=t[1]:null}#t(){let t=this.getVariables();if(t.length!==2)return console.error("qti-duration-gte requires exactly 2 duration expressions"),null;let e=t.map(i=>this.#e(i));return e.some(i=>i===null)?null:e}#e(t){if(t.cardinality!=="single"||Array.isArray(t.value))return console.error("qti-duration-gte requires single cardinality"),null;if(t.baseType!=="duration")return console.error("qti-duration-gte requires duration base-type"),null;if(t.value===null||t.value===void 0)return null;let e=Number.parseFloat(t.value.toString());return Number.isNaN(e)?(console.error(`qti-duration-gte requires duration values expressed in seconds, got "${t.value.toString()}"`),null):e}};var Os=class extends E{getResult(){let t=this.#t();return t?t[0]<t[1]:null}#t(){let t=this.getVariables();if(t.length!==2)return console.error("qti-duration-lt requires exactly 2 duration expressions"),null;let e=t.map(i=>this.#e(i));return e.some(i=>i===null)?null:e}#e(t){if(t.cardinality!=="single"||Array.isArray(t.value))return console.error("qti-duration-lt requires single cardinality"),null;if(t.baseType!=="duration")return console.error("qti-duration-lt requires duration base-type"),null;if(t.value===null||t.value===void 0)return null;let e=Number.parseFloat(t.value.toString());return Number.isNaN(e)?(console.error(`qti-duration-lt requires duration values expressed in seconds, got "${t.value.toString()}"`),null):e}};var pf=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},fn=class extends E{constructor(){super(...arguments),this.roundingMode="significantFigures"}get figures(){if(!this.getAttribute("figures"))return console.error("figures attribute is missing"),null;let e=parseInt(this.getAttribute("figures")||"0");return isNaN(e)?(console.error("figures attribute is not a number"),null):e<0?(console.error("figures attribute is negative"),null):e<1&&this.roundingMode==="significantFigures"?(console.error("figures cannot be smaller than 1 for RoundingMode significantFigures"),null):e}getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],i=t[1];if(this.roundingMode===null)return null;if(e.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(i.value))return console.error("unexpected cardinality in qti equal"),!1;switch(t[0].baseType){case"integer":case"float":{let n=parseFloat(e.value),r=parseFloat(i.value);if(!isNaN(n)&&!isNaN(r))return this.roundingMode==="significantFigures"?n.toPrecision(this.figures)===r.toPrecision(this.figures):Math.round(n*Math.pow(10,this.figures))/Math.pow(10,this.figures)===Math.round(r*Math.pow(10,this.figures))/Math.pow(10,this.figures);console.error(`value cannot be casted to numeric value in equalRounded operator: ${n}, ${r}`);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}};pf([p({type:String,attribute:"rounding-mode"})],fn.prototype,"roundingMode",void 0);var Dp=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},rr=class extends E{constructor(){super(...arguments),this.toleranceMode="exact",this.tolerance=""}get includeLowerBound(){return this.getAttribute("include-lower-bound")!=="false"}get includeUpperBound(){return this.getAttribute("include-upper-bound")!=="false"}getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],i=t[1];return!e||!i?null:e.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(i.value)?(console.error("unexpected cardinality in qti equal"),!1):e.value===null||i.value===null||e.value===void 0||i.value===void 0?null:this.toleranceMode==="exact"?Y.compareSingleValues(e.value,i.value,e.baseType):this.#t(parseFloat(e.value),parseFloat(i.value))}return console.error("unexpected number of children in qti-equal"),null}#t(t,e){if(Number.isNaN(t)||Number.isNaN(e))return console.error("qti-equal with a tolerance needs numeric values"),null;let i=this.tolerance.split(/\s+/).filter(Boolean).map(l=>parseFloat(l));if(i.length===0||i.some(l=>Number.isNaN(l)))return console.error(`qti-equal with tolerance-mode="${this.toleranceMode}" needs a numeric tolerance`),null;let[n,r=n]=i,[s,a]=this.toleranceMode==="absolute"?[e-n,e+r]:[e*(1-n/100),e*(1+r/100)];return(this.includeLowerBound?t>=s:t>s)&&(this.includeUpperBound?t<=a:t<a)}};Dp([p({type:String,attribute:"tolerance-mode"})],rr.prototype,"toleranceMode",void 0);Dp([p({type:String})],rr.prototype,"tolerance",void 0);var G=class extends C{render(){return b`<slot></slot>`}process(){throw new Error("Not implemented")}};var Ms=class extends G{process(){throw new Pi}};var Ds=class extends G{process(){throw new Oi}};var Ns=class extends E{getResult(){let t=this.getAttribute("field-identifier");if(!t)return console.error("qti-field-value requires a field-identifier attribute"),null;if(this.children.length!==1)return console.error("qti-field-value must have exactly one child expression"),null;let e=this.getVariables()[0];if(!e||e.baseType!=="record"||e.value===null||e.value===void 0)return console.warn("qti-field-value child expression must return a record"),null;let i=e.value[t];return i===void 0?null:i}};var $s=class extends E{getResult(){if(this.children.length===0)return console.error("qti-gcd must have at least one child expression"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=[];for(let i of t){if(i.baseType!=="integer")return console.error("qti-gcd requires integer base-type"),null;if(i.value===null||i.value===void 0)return null;if(i.cardinality==="single"){if(Array.isArray(i.value))return console.error("qti-gcd unexpected array value for single cardinality"),null;let n=parseInt(i.value,10);if(isNaN(n))return console.error("qti-gcd non-numerical value"),null;e.push(n)}else if(i.cardinality==="multiple"||i.cardinality==="ordered"){if(!Array.isArray(i.value))return console.error("qti-gcd expected array value for multiple/ordered cardinality"),null;for(let n of i.value){if(n==null)return null;let r=parseInt(n,10);if(isNaN(r))return console.error("qti-gcd non-numerical value"),null;e.push(r)}}else return console.error("qti-gcd unsupported cardinality"),null}return e.length===0?null:this.#t(e)}#t(t){if(t.length===0)return 0;if(t.length===1)return Math.abs(t[0]);let e=Math.abs(t[0]);for(let i=1;i<t.length&&(e=this.#e(e,Math.abs(t[i])),e!==1);i++);return e}#e(t,e){if(t===0&&e===0)return 0;if(t===0)return e;if(e===0)return t;for(;e!==0;){let i=e;e=t%e,t=i}return t}};var Ls=class extends E{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],i=t[1];if((e.baseType==="integer"||e.baseType==="float")&&(i.baseType==="integer"||i.baseType==="float"))return+e.value>+i.value;console.error("unexpected baseType or cardinality in qti gt")}return console.error("unexpected number of children in qt"),null}};var Vs=class extends Yt{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],i=t[1];return(e.baseType==="integer"||e.baseType==="float")&&(i.baseType==="integer"||i.baseType==="float")?+e.value>=+i.value:(console.error("unexpected baseType or cardinality in qti gte"),null)}return console.error("unexpected number of children in qti gte"),null}};var uf=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},gn=class extends E{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 t=this.getVariables()[0];if(!t)return console.error("qti-index: missing container"),null;let e;if(!isNaN(Number(this.n)))e=Number(this.n);else{let i=this.#t(this.n);if(i===null)return console.error(`qti-index: variable "${this.n}" is not a valid number`),null;e=Number(i)}if(e<=0||!Number.isInteger(e))return console.error("qti-index: index must be a positive integer"),null;if(t.cardinality==="ordered"){let i=Array.isArray(t.value)?t.value:[t.value];return t.value===null||e>i.length?null:i[e-1]}else return console.error("qti-index: child must have ordered cardinality"),null}#t(t){let e=this.context.variables.find(i=>i.identifier===t)?.value;return e===null||isNaN(Number(e))?null:Number(e)}};uf([p({type:String})],gn.prototype,"n",void 0);var Np=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},nr=class extends E{constructor(){super(...arguments),this.shape="",this.coords=""}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-inside requires exactly one point expression"),null;let e=t[0];if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-inside requires single cardinality"),null;if(e.value===null||e.value===void 0)return null;if(!this.shape||!this.coords)return console.error("qti-inside requires shape and coords attributes"),null;let i=this.#t(e.value.toString()),n=this.#e(this.coords);if(!i||n.length===0)return null;switch(this.shape.toLowerCase()){case"circle":return this.#i(i,n);case"rect":return this.#r(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}}#t(t){let e=t.split(/[,\s]+/).map(r=>r.trim()).filter(Boolean);if(e.length!==2)return console.error('qti-inside requires a point value formatted as "x y" or "x,y"'),null;let i=Number.parseFloat(e[0]),n=Number.parseFloat(e[1]);return Number.isNaN(i)||Number.isNaN(n)?(console.error("qti-inside requires numeric point coordinates"),null):{x:i,y:n}}#e(t){let e=t.split(",").map(i=>i.trim()).filter(Boolean).map(i=>Number.parseFloat(i));return e.some(i=>Number.isNaN(i))?(console.error("qti-inside requires numeric coords"),[]):e}#i(t,e){if(e.length!==3)return console.error("qti-inside circle requires x,y,r"),null;let[i,n,r]=e;return(t.x-i)**2+(t.y-n)**2<=r**2}#r(t,e){if(e.length!==4)return console.error("qti-inside rect requires left,top,right,bottom"),null;let[i,n,r,s]=e,a=Math.min(i,r),l=Math.max(i,r),c=Math.min(n,s),d=Math.max(n,s);return t.x>=a&&t.x<=l&&t.y>=c&&t.y<=d}#n(t,e){if(e.length!==4)return console.error("qti-inside ellipse requires centerX,centerY,radiusX,radiusY"),null;let[i,n,r,s]=e;return r===0||s===0?!1:(t.x-i)**2/r**2+(t.y-n)**2/s**2<=1}#o(t,e){if(e.length<6||e.length%2!==0)return console.error("qti-inside polygon requires at least 3 coordinate pairs"),null;let i=!1;for(let n=0,r=e.length-2;n<e.length;n+=2){let s=e[n],a=e[n+1],l=e[r],c=e[r+1];a>t.y!=c>t.y&&t.x<(l-s)*(t.y-a)/(c-a||Number.EPSILON)+s&&(i=!i),r=n}return i}};Np([p({type:String})],nr.prototype,"shape",void 0);Np([p({type:String})],nr.prototype,"coords",void 0);var zs=class extends E{get resultBaseType(){return"integer"}getResult(){let t=this.#t(this.getVariables());return t.length!==2?(console.error("qti-integer-divide requires exactly 2 integer values"),null):t[1]===0?(console.error("qti-integer-divide: division by zero"),null):Math.floor(t[0]/t[1])}#t(t){let e=[];for(let i of t){if(i.baseType!=="integer")return console.error("qti-integer-divide requires integer base-type"),[];if(i.cardinality!=="single"||Array.isArray(i.value))return console.error("qti-integer-divide requires single cardinality"),[];if(i.value===null||i.value===void 0)return[];let n=Number.parseInt(i.value,10);if(Number.isNaN(n))return console.error("qti-integer-divide requires integer values"),[];e.push(n)}return e}};var js=class extends E{get resultBaseType(){return"integer"}getResult(){let t=this.#t(this.getVariables());return t.length!==2?(console.error("qti-integer-modulus requires exactly 2 integer values"),null):t[1]===0?(console.error("qti-integer-modulus: division by zero"),null):t[0]-Math.floor(t[0]/t[1])*t[1]}#t(t){let e=[];for(let i of t){if(i.baseType!=="integer")return console.error("qti-integer-modulus requires integer base-type"),[];if(i.cardinality!=="single"||Array.isArray(i.value))return console.error("qti-integer-modulus requires single cardinality"),[];if(i.value===null||i.value===void 0)return[];let n=Number.parseInt(i.value,10);if(Number.isNaN(n))return console.error("qti-integer-modulus requires integer values"),[];e.push(n)}return e}};var Fs=class extends E{get resultBaseType(){return"float"}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-integer-to-float requires exactly one child expression"),null;let e=t[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 i=Number.parseInt(e.value,10);return Number.isNaN(i)?(console.error("qti-integer-to-float requires an integer value"),null):i}};var Bs=class extends E{getResult(){if(this.children.length===1){let t=this.getVariables();if(!t?.length)return!0;let e=t[0].value;return e==null||e==null||e===""}return console.error("unexpected number of children in qti Null"),null}};var Us=class extends E{getResult(){let t=this.#t(this.getVariables());return t.length===0?(console.error("qti-lcm requires at least one integer value"),null):t.reduce((e,i)=>this.#i(e,i))}#t(t){let e=[];for(let i of t){if(i.baseType!=="integer")return console.error("qti-lcm requires integer base-type"),[];if(i.value===null||i.value===void 0)return[];if(i.cardinality==="single"){if(Array.isArray(i.value))return console.error("qti-lcm unexpected array value for single cardinality"),[];let n=Number.parseInt(i.value,10);if(Number.isNaN(n))return console.error("qti-lcm requires integer values"),[];e.push(n);continue}if(i.cardinality!=="multiple"&&i.cardinality!=="ordered")return console.error("qti-lcm unsupported cardinality"),[];if(!Array.isArray(i.value))return console.error("qti-lcm expected array value for container cardinality"),[];for(let n of i.value){let r=Number.parseInt(n,10);if(Number.isNaN(r))return console.error("qti-lcm requires integer values"),[];e.push(r)}}return e}#e(t,e){let i=Math.abs(t),n=Math.abs(e);for(;n!==0;){let r=i%n;i=n,n=r}return i}#i(t,e){return t===0||e===0?0:Math.abs(t*e/this.#e(t,e))}};var $p=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},or=class extends G{get childExpression(){return this.firstElementChild}process(){let t=this.getAttribute("identifier"),e=this.context?.variables.find(r=>r.identifier===t)||null;if(!e)return console.warn(`lookupOutcomeValue: no outcome declaration for "${t}"`),null;let i=parseFloat(this.childExpression.calculate()),n;return e.matchTable?.size?n=e.matchTable.get(i):e.interpolationTable&&(n=this.#t(i,e.interpolationTable)),n==null?(console.warn(`lookupOutcomeValue: no table entry matches ${i} for "${t}"`),null):(this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:this.identifier,value:Ot(n)}})),n)}#t(t,e){if(!Number.isNaN(t))return e.find(i=>i.includeBoundary?t>=i.sourceValue:t>i.sourceValue)?.targetValue}};$p([p({type:String})],or.prototype,"identifier",void 0);$p([_({context:F,subscribe:!0}),T()],or.prototype,"context",void 0);var Hs=class extends E{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],i=t[1];if((e.baseType==="integer"||e.baseType==="float")&&(i.baseType==="integer"||i.baseType==="float"))return+e.value<+i.value;console.error("unexpected baseType or cardinality in qti lt")}return console.error("unexpected number of children in lt"),null}};var Ws=class extends Yt{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],i=t[1];return(e.baseType==="integer"||e.baseType==="float")&&(i.baseType==="integer"||i.baseType==="float")?+e.value<=+i.value:(console.error("unexpected baseType or cardinality in qti lte"),null)}return console.error("unexpected number of children in qti lte"),null}};var mf=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},bn=class extends E{getResult(){let t=this.context.variables.find(s=>s.identifier===this.identifier);if(!t)return console.warn(`Response ${this.identifier} cannot be found`),null;let e=t.areaMapping;if(!e)return console.warn(`Area mapping not found for response ${this.identifier}`),null;let i=Array.isArray(t.value)?t.value:[t.value];if(!i||i.length===0)return console.warn(`No candidate responses for response ${this.identifier}`),null;let n=0,r=new Set;for(let s of i)for(let a of e.areaMapEntries){if(r.has(a.coords))continue;if(Y.isPointInArea(s,`${a.shape},${a.coords}`,t.baseType)){n+=a.mappedValue??0,r.add(a.coords);break}}return r.size<i.length&&(n+=e.defaultValue),e.lowerBound!=null&&(n=Math.max(e.lowerBound,n)),e.upperBound!=null&&(n=Math.min(e.upperBound,n)),n}};mf([p({type:String})],bn.prototype,"identifier",void 0);var ff=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},yn=class extends E{getResult(){let t=this.context.variables.find(r=>r.identifier===this.identifier);if(!t||!t.mapping)return console.error(`Response ${this.identifier} can not be found`),null;let e=t.mapping,i=Array.isArray(t.value)?t.value:[t.value],n=0;for(let r of i){let s=e.mapEntries.filter(l=>t.baseType==="string"&&!l.caseSensitive?Y.compareSingleValues(l.mapKey.toLowerCase(),r.toLowerCase(),t.baseType):Y.compareSingleValues(l.mapKey,r,t.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?n+=e.defaultValue:n+=a.mappedValue}return e?.lowerBound!==null&&e?.lowerBound!==void 0&&(n=Math.max(e.lowerBound,n)),e?.upperBound!==null&&e?.upperBound!==void 0&&(n=Math.min(e.upperBound,n)),n}};ff([p({type:String})],yn.prototype,"identifier",void 0);var Qs=class o extends E{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],i=t[1];return o.match(e,i)}return console.error("unexpected number of children in match"),null}static match(t,e){if(t.value===null)return!1;switch(e.cardinality){case"single":return Array.isArray(t.value)||Array.isArray(e.value)?(console.error("unexpected cardinality in qti match"),!1):Y.compareSingleValues(t.value?.toString(),e.value.toString(),e.baseType);case"ordered":{if(!Array.isArray(t.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(t.value.length!==e.value.length)return!1;for(let i=0;i<t.value.length;i++)if(!Y.compareSingleValues(e.value[i],t.value[i],e.baseType))return!1;return!0}case"multiple":{if(!Array.isArray(t.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(t.value.length!==e.value.length)return!1;let i=0;for(let n of e.value){let r=null,s=[...t.value];for(let a of s)if(Y.compareSingleValues(n,a,e.baseType)){r=a;break}if(r!==null)s.splice(s.indexOf(r),1);else return!1;i++}return!0}default:return console.error("unexpected cardinality in qti match"),!1}}};var gf=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},vn=class extends E{constructor(){super(...arguments),this.name=""}get resultBaseType(){return"float"}getResult(){switch(this.name.toLowerCase()){case"pi":return Math.PI;case"e":return Math.E;default:return console.error(`qti-math-constant: unknown constant "${this.name}"`),null}}};gf([p({type:String})],vn.prototype,"name",void 0);var bf=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},wn=class extends E{constructor(){super(...arguments),this.name=""}get resultBaseType(){return["floor","ceil","signum"].includes(this.name?.toLowerCase())?"integer":"float"}getResult(){if(!this.name)return console.error("qti-math-operator requires a name attribute"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=[];for(let i of t){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;e.push(n)}return this.#e(this.name,e)}#t(t){return Number.isFinite(t)?t:null}#e(t,e){try{switch(t.toLowerCase()){case"sin":return e.length!==1?null:Math.sin(e[0]);case"cos":return e.length!==1?null:Math.cos(e[0]);case"tan":return e.length!==1?null:Math.tan(e[0]);case"asin":return e.length!==1||e[0]<-1||e[0]>1?null:Math.asin(e[0]);case"acos":return e.length!==1||e[0]<-1||e[0]>1?null:Math.acos(e[0]);case"atan":return e.length!==1?null:Math.atan(e[0]);case"sinh":return e.length!==1?null:Math.sinh(e[0]);case"cosh":return e.length!==1?null:Math.cosh(e[0]);case"tanh":return e.length!==1?null:Math.tanh(e[0]);case"secant":case"sec":return e.length!==1?null:this.#t(1/Math.cos(e[0]));case"cosecant":case"csc":return e.length!==1?null:this.#t(1/Math.sin(e[0]));case"cotangent":case"cot":return e.length!==1?null:this.#t(Math.cos(e[0])/Math.sin(e[0]));case"todegrees":return e.length!==1?null:e[0]*180/Math.PI;case"toradians":return e.length!==1?null:e[0]*Math.PI/180;case"log":return e.length!==1||e[0]<=0?null:Math.log10(e[0]);case"ln":return e.length!==1||e[0]<=0?null:Math.log(e[0]);case"log10":return e.length!==1||e[0]<=0?null:Math.log10(e[0]);case"exp":return e.length!==1?null:Math.exp(e[0]);case"abs":return e.length!==1?null:Math.abs(e[0]);case"sqrt":return e.length!==1||e[0]<0?null:Math.sqrt(e[0]);case"signum":return e.length!==1?null:Math.sign(e[0]);case"floor":return e.length!==1?null:Math.floor(e[0]);case"ceil":return e.length!==1?null:Math.ceil(e[0]);case"round":return e.length!==1?null:Math.round(e[0]);case"atan2":return e.length!==2?null:Math.atan2(e[0],e[1]);case"pow":{if(e.length!==2)return null;let i=e[0],n=e[1];return i===0&&n<=0||i<0&&!Number.isInteger(n)?null:Math.pow(i,n)}case"log_base":{if(e.length!==2)return null;let i=e[0],n=e[1];return i<=0||n<=0||n===1?null:Math.log(i)/Math.log(n)}case"mod":return e.length!==2||e[1]===0?null:e[0]%e[1];case"max":return e.length<1?null:Math.max(...e);case"min":return e.length<1?null:Math.min(...e);default:return console.error(`qti-math-operator: unknown operation "${t}"`),null}}catch(i){return console.error(`qti-math-operator: error performing operation "${t}":`,i),null}}};bf([p({type:String})],wn.prototype,"name",void 0);var Xs=class extends E{getResult(){let t=this.#t(this.getVariables());return t.length===0?(console.warn("qti-max: no numeric values provided"),null):Math.max(...t)}#t(t){let e=[];for(let i of t){if(!i)continue;let n=r=>{if(r==null)return;let s=parseFloat(r.toString());if(Number.isNaN(s)){console.warn("qti-max: non-numeric value encountered");return}e.push(s)};if(Array.isArray(i.value)){i.value.forEach(r=>n(r));continue}n(i.value)}return e}};var Gs=class extends E{getResult(){let t=this.getVariables();this.children.length!==2&&console.warn("The member operator takes two sub-expressions");let[e,i]=t;if(e.baseType===i.baseType||e.baseType==="integer"&&i.baseType==="float"||e.baseType==="float"&&i.baseType==="integer"||console.warn("Which must both have the same base-type"),i.cardinality==="multiple"||i.cardinality==="ordered"||console.warn("and the second must be a multiple or ordered container"),(e.baseType==="float"||i.baseType==="float")&&console.warn("The member operator should not be used on sub-expressions with a base-type of float"),(e.baseType==="duration"||i.baseType==="duration")&&console.warn("It must not be used on sub-expressions with a base-type of duration"),e.value===null||i.value===null)return null;let n=e.value;return i.value.includes(n)}};var Ys=class extends E{getResult(){let t=this.#t(this.getVariables());return t.length===0?(console.warn("qti-min: no numeric values provided"),null):Math.min(...t)}#t(t){let e=[];for(let i of t){if(!i)continue;let n=r=>{if(r==null)return;let s=parseFloat(r.toString());if(Number.isNaN(s)){console.warn("qti-min: non-numeric value encountered");return}e.push(s)};if(Array.isArray(i.value)){i.value.forEach(r=>n(r));continue}n(i.value)}return e}};var Ks=class extends E{getResult(){let t=this.getVariables();if(t.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of t)if(e.cardinality!=="multiple"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti multiple"),[];return t}};var Js=class extends E{render(){return b`${super.render()}`}getResult(){return!this.firstElementChild.calculate()}};var Zs=class extends E{getResult(){return null}};var ta=class extends Yt{getResult(){return Array.from(this.children).map(e=>{let i=e;if(!i.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let n=i.calculate(),r=!1;if(typeof n=="string")if(n==="true")r=!0;else if(n==="false")r=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof n=="boolean"&&(r=n);return r}).some(e=>typeof e=="boolean"&&e)}};var ea=class extends E{getResult(){let t=this.getVariables();if(t.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of t)if(e.cardinality!=="ordered"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti ordered"),[];return t}};var ia=class extends C{render(){return b`<slot></slot>`}process(){let t=this.getSubRules();for(let e=0;e<t.length;e++)t[e].process()}},sr=class extends ia{shouldProcess(){return!0}getSubRules(){return[...this.children]}},ar=class extends ia{shouldProcess(){return this.firstElementChild.calculate()}getSubRules(){let t=[];for(let e=1;e<this.children.length;e++)t.push(this.children[e]);return t}},lr=class extends G{render(){return b`<slot></slot>`}process(){let t=[...this.children];for(let e of t)if(e.shouldProcess()){e.process();return}}};var ra=class extends lr{};var cr=class extends ar{};var na=class extends cr{};var oa=class extends sr{};var yf=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},xn=class extends E{constructor(){super(...arguments),this.pattern=""}getResult(){let t=this.getVariables();if(t.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 e=t[0];if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-pattern-match requires single cardinality"),null;if(e.value===null||e.value===void 0)return null;let i=this.#t();return i?i.test(e.value.toString()):null}#t(){let t=`^(?:${this.pattern})$`;try{return new RegExp(t,"u")}catch{try{return new RegExp(t)}catch(e){return console.error("qti-pattern-match requires a valid regular expression",e),null}}}};yf([p({type:String})],xn.prototype,"pattern",void 0);var sa=class extends E{get resultBaseType(){return"float"}getResult(){if(this.children.length!==2)return console.error("qti-power must have exactly two child expressions"),null;let t=this.getVariables();if(!t||t.length!==2)return null;let[e,i]=t;if(e.cardinality!=="single"||i.cardinality!=="single")return console.error("qti-power requires single cardinality for both expressions"),null;if(Array.isArray(e.value)||Array.isArray(i.value))return console.error("qti-power unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0||i.value===null||i.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float"||i.baseType!=="integer"&&i.baseType!=="float")return console.error("qti-power requires numerical base-types"),null;let n=parseFloat(e.value),r=parseFloat(i.value);if(isNaN(n)||isNaN(r))return console.error("qti-power: non-numerical values encountered"),null;if(n===0&&r<=0||n<0&&!Number.isInteger(r))return null;let s;try{s=Math.pow(n,r)}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}};var vf=/%(?:(%)|([-+ 0#]*)(\d+)?(?:\.(\d+))?([diuoxXfFeEgGsc]))/g;function wf(o){return o.replace(/e([+-])(\d)$/,"e$10$2")}function qn(o,t){return wf(t===void 0?o.toExponential():o.toExponential(t))}function Lp(o){let[t,e]=o.split(/e/i),i=t.includes(".")?t.replace(/\.?0+$/,""):t,n=e===void 0?"":`e${e}`;return`${i}${n}`}function Vp(o,t){let e=t===0?1:t,i=o===0?0:Math.floor(Math.log10(o));return i<-4||i>=e?Lp(qn(o,e-1)):Lp(o.toFixed(Math.max(0,e-1-i)))}function xf(o,t,e,i){if(o==="s"||o==="c"){let c=o==="c"?i.slice(0,1):i;return e===void 0?c:c.slice(0,e)}let n=Number(i);if(i.trim()===""||!Number.isFinite(n))return i;let r=Math.abs(n),s,a=n<0;switch(o){case"d":case"i":s=String(Math.trunc(r));break;case"u":s=String(Math.trunc(r)),a=!1;break;case"o":s=`${t.includes("#")?"0":""}${Math.trunc(r).toString(8)}`;break;case"x":s=`${t.includes("#")?"0x":""}${Math.trunc(r).toString(16)}`;break;case"X":s=`${t.includes("#")?"0X":""}${Math.trunc(r).toString(16).toUpperCase()}`;break;case"f":case"F":s=r.toFixed(e??6);break;case"e":s=qn(r,e??6);break;case"E":s=qn(r,e??6).toUpperCase();break;case"g":s=Vp(r,e??6);break;case"G":s=Vp(r,e??6).toUpperCase();break;default:return i}return`${a?"-":t.includes("+")?"+":t.includes(" ")?" ":""}${s}`}function qf(o,t,e){if(o.length>=e)return o;let i=e-o.length;if(t.includes("-"))return`${o}${" ".repeat(i)}`;if(t.includes("0")){let[,n,r]=/^([-+ ]?)(.*)$/.exec(o);return`${n}${"0".repeat(i)}${r}`}return`${" ".repeat(i)}${o}`}function zp(o,t){return o.replace(vf,(e,i,n,r,s,a)=>i?"%":qf(xf(a,n??"",s===void 0?void 0:Number(s),t),n??"",r===void 0?0:Number(r)))}var ye=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},vt=class extends C{constructor(){super(...arguments),this.base=10,this.powerForm=!1,this.delimiter=";",this.mappingIndicator="="}render(){let t=this.context?.variables.find(i=>i.identifier===this.identifier),e=t?this.#t(t):null;return e===null?O:b`${e}`}#t(t){let e=t.value;if(e==null)return null;if(Array.isArray(e)){if(e.length===0)return null;if(this.index!==void 0){let i=e[this.index-1];return i==null?null:this.#e(i,t.baseType)}return e.map(i=>this.#e(i,t.baseType)).join(this.delimiter)}if(typeof e=="object"){let i=e;if(this.field!==void 0){let r=i[this.field];return r==null?null:this.#e(r,t.baseType)}let n=Object.entries(i).filter(([,r])=>r!=null);return n.length===0?null:n.map(([r,s])=>`${r}${this.mappingIndicator}${this.#e(s,t.baseType)}`).join(this.delimiter)}return this.#e(e,t.baseType)}#e(t,e){let i=Array.isArray(t)?t.join(" "):String(t);if(this.format)return zp(this.format,i);if(e==="integer"&&this.base!==10){let n=Number.parseInt(i,10);if(Number.isFinite(n))return n.toString(this.base)}if(this.powerForm){let n=Number(i);if(i.trim()!==""&&Number.isFinite(n))return qn(n)}return i}calculate(){return this.context.variables.find(e=>e.identifier===this.identifier)||null}};ye([p({type:String})],vt.prototype,"identifier",void 0);ye([p({type:String})],vt.prototype,"format",void 0);ye([p({type:Number})],vt.prototype,"base",void 0);ye([p({type:Number})],vt.prototype,"index",void 0);ye([p({type:Boolean,attribute:"power-form"})],vt.prototype,"powerForm",void 0);ye([p({type:String})],vt.prototype,"field",void 0);ye([p({type:String})],vt.prototype,"delimiter",void 0);ye([p({type:String,attribute:"mapping-indicator"})],vt.prototype,"mappingIndicator",void 0);ye([_({context:F,subscribe:!0}),T()],vt.prototype,"context",void 0);var aa=class extends E{getResult(){return this.getVariables().reduce((i,n)=>{if(n.baseType=="float"||n.baseType=="integer")try{return i*parseFloat(n.value.toString())}catch{console.warn("can not convert to number")}else console.warn(`has another baseType ${n.baseType}`);return i},1)}};var Hl=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},Si=class extends E{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 t=[],e=0;for(;;){let n=this.min+this.step*e;if(n>this.max)break;Number.isInteger(n)&&t.push(n),e++}if(t.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()*t.length);return t[i]}getPossibleValues(){let t=[];if(this.min>this.max||this.step<=0)return[Number.isInteger(this.min)?this.min:Math.floor(this.min)];let e=0;for(;;){let i=this.min+this.step*e;if(i>this.max)break;Number.isInteger(i)&&t.push(i),e++}return t.length>0?t:[Number.isInteger(this.min)?this.min:Math.floor(this.min)]}};Hl([p({type:Number})],Si.prototype,"min",void 0);Hl([p({type:Number})],Si.prototype,"max",void 0);Hl([p({type:Number})],Si.prototype,"step",void 0);var la=class extends E{getResult(){let t=this.getVariables();if(t.length===1){let e=t[0].value;if(Array.isArray(e)){let i=Math.floor(Math.random()*e.length);return e[i]}return e}return console.error("unexpected number of children in match"),null}};var Cf=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},Wl=1e3,Cn=class extends E{constructor(){super(...arguments),this.numberRepeats=""}getResult(){let t=this.#t();if(t<=0)return[];let e=this.firstElementChild;if(!e)return console.warn("qti-repeat: missing child expression"),[];let i=[];for(let n=0;n<t;n++){let r=e.calculate(),s=this.#i(r);s&&i.push(s)}return i}#t(){if(!this.numberRepeats)return console.warn("qti-repeat: missing number-repeats attribute"),0;let t=parseInt(this.numberRepeats,10);if(!Number.isNaN(t))return this.#e(t);let e=this.numberRepeats,i=this.context?.variables?.find(s=>s.identifier===e);if(!i)return console.warn(`qti-repeat: unknown identifier "${e}"`),0;let n=Array.isArray(i.value)?i.value[0]:i.value,r=parseInt(n?.toString()??"",10);return Number.isNaN(r)?(console.warn(`qti-repeat: invalid repeat count from "${e}"`),0):this.#e(r)}#e(t){return t>Wl?(console.warn(`qti-repeat: number-repeats ${t} exceeds the ${Wl} limit, truncating`),Wl):t}#i(t){if(t==null)return null;if(typeof t=="number")return{identifier:"",cardinality:"single",baseType:Number.isInteger(t)?"integer":"float",value:t.toString(),type:"response"};if(typeof t=="string"){let e=parseFloat(t);if(!Number.isNaN(e))return{identifier:"",cardinality:"single",baseType:Number.isInteger(e)?"integer":"float",value:t.toString(),type:"response"}}if(t&&typeof t=="object"&&"value"in t){let e=t.value;return{identifier:"",cardinality:"single",baseType:t.baseType??"string",value:e!=null?e.toString():null,type:"response"}}return{identifier:"",cardinality:"single",baseType:"string",value:t.toString(),type:"response"}}};Cf([p({type:String,attribute:"number-repeats"})],Cn.prototype,"numberRepeats",void 0);var ca=class extends lr{};var dr=class extends ar{};var da=class extends dr{};var ha=class extends sr{};var pa=class extends G{process(){for(let t of[...this.children])t.process()}};var jp=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},hr=class extends E{constructor(){super(...arguments),this.roundingMode="significantFigures",this.figures=3}get resultBaseType(){return"float"}getResult(){if(this.children.length!==1)return console.error("qti-round-to must have exactly one child expression"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=t[0];if(e.cardinality!=="single")return console.error("qti-round-to requires single cardinality"),null;if(Array.isArray(e.value))return console.error("qti-round-to 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-to requires numerical base-type"),null;let i=parseFloat(e.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.#t(i,this.figures):this.#e(i,this.figures):i===1/0?1/0:i===-1/0?-1/0:null}#t(t,e){if(t===0)return 0;let i=Math.pow(10,e);return Math.round(t*i)/i}#e(t,e){if(t===0)return 0;let i=Math.floor(Math.log10(Math.abs(t))),n=Math.pow(10,e-i-1);return Math.round(t*n)/n}};jp([p({type:String,attribute:"rounding-mode"})],hr.prototype,"roundingMode",void 0);jp([p({type:Number})],hr.prototype,"figures",void 0);var ua=class extends E{get resultBaseType(){return"integer"}getResult(){if(this.children.length!==1)return console.error("qti-round must have exactly one child expression"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=t[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 i=parseFloat(e.value);return isNaN(i)?(console.warn("qti-round: NaN input results in NULL"),null):isFinite(i)?Math.floor(i+.5):i===1/0?1/0:i===-1/0?-1/0:null}};var ma=class extends G{process(){let t=this.getAttribute("identifier");if(!t){console.warn('QtiSetCorrectResponse: Missing "identifier" attribute.');return}let e=this.firstElementChild;if(!e){console.warn("QtiSetCorrectResponse: No expression found.");return}let n=new Ql(e).process();this.dispatchEvent(new CustomEvent("qti-set-correct-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:t,value:this.#t(n)}}))}#t(t){return t==null?null:Array.isArray(t)?t.map(e=>Ot(this.#e(e))):Ot(this.#e(t))}#e(t){if(t&&typeof t=="object"&&"value"in t){let e=t.value;return e!=null?e.toString():""}return t?.toString()??""}},Ql=class{constructor(t){this.expression=t}process(){let t=this.expression.calculate()??null;return t===null&&console.warn("QtiSetCorrectResponseRule: Evaluated value is null."),Array.isArray(t)?t.map(e=>this.#t(e)):this.#t(t)}#t(t){return t&&typeof t=="object"&&"value"in t?t.value:t}};var fa=class extends G{process(){let t=this.getAttribute("identifier");if(!t){console.warn('QtiSetOutcomeValue: Missing "identifier" attribute.');return}let e=this.firstElementChild;if(!e){console.warn("QtiSetOutcomeValue: No expression found.");return}let n=new Xl(e).process();this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:t,value:this.#t(n)}}))}#t(t){return Array.isArray(t)?t.map(Ot):t!==null?Ot(t):null}},Xl=class{constructor(t){this.expression=t}process(){let t=this.expression.calculate()??null;return t===null&&console.warn("QtiSetOutcomeValueRule: Evaluated value is null."),Array.isArray(t)?t.map(e=>e.value?e.value:e):t}};var ga=class extends G{process(){let t=this.getAttribute("identifier");if(!t){console.warn('QtiSetTemplateValue: Missing "identifier" attribute.');return}let e=this.firstElementChild;if(!e){console.warn("QtiSetTemplateValue: No expression found.");return}let n=new Gl(e).process();this.dispatchEvent(new CustomEvent("qti-set-template-value",{bubbles:!0,composed:!0,detail:{templateIdentifier:t,value:this.#t(n)}}))}#t(t){return t==null?null:Array.isArray(t)?t.map(e=>Ot(this.#e(e))):Ot(this.#e(t))}#e(t){if(t&&typeof t=="object"&&"value"in t){let e=t.value;return e!=null?e.toString():""}return t?.toString()??""}},Gl=class{constructor(t){this.expression=t}process(){let t=this.expression.calculate()??null;return t===null&&console.warn("QtiSetTemplateValueRule: Evaluated value is null."),Array.isArray(t)?t.map(e=>this.#t(e)):this.#t(t)}#t(t){return t&&typeof t=="object"&&"value"in t?t.value:t}};var Sf=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},Sn=class extends E{constructor(){super(...arguments),this.name=""}get resultBaseType(){return"float"}getResult(){if(!this.name)return console.warn("qti-stats-operator: missing name attribute"),null;let t=this.#r(this.getVariables());if(t.length===0)return console.warn("qti-stats-operator: no numeric values provided"),null;switch(this.name.toLowerCase()){case"mean":return this.#t(t);case"median":return this.#e(t);case"popvariance":return this.#i(t,t.length);case"popsd":return Math.sqrt(this.#i(t,t.length));case"samplevariance":return t.length<2?null:this.#i(t,t.length-1);case"samplesd":return t.length<2?null:Math.sqrt(this.#i(t,t.length-1));default:return console.warn(`qti-stats-operator: unsupported operator "${this.name}"`),null}}#t(t){return t.reduce((e,i)=>e+i,0)/t.length}#e(t){let e=[...t].sort((n,r)=>n-r),i=Math.floor(e.length/2);return e.length%2===0?(e[i-1]+e[i])/2:e[i]}#i(t,e){let i=this.#t(t);return t.reduce((n,r)=>n+Math.pow(r-i,2),0)/e}#r(t){let e=[];for(let i of t){if(!i)continue;let n=r=>{if(r==null)return;let s=parseFloat(r.toString());if(Number.isNaN(s)){console.warn("qti-stats-operator: non-numeric value encountered");return}e.push(s)};if(Array.isArray(i.value)){i.value.forEach(r=>n(r));continue}n(i.value)}return e}};Sf([p({type:String})],Sn.prototype,"name",void 0);var kf=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},kn=class extends E{constructor(){super(...arguments),this.caseSensitive="true"}getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],i=t[1];if(e.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(i.value))return console.error("unexpected cardinality in qti string-match"),!1;let n=this.caseSensitive==="true"?e.value:e.value.toLowerCase(),r=this.caseSensitive==="true"?i.value:i.value.toLowerCase();return Y.compareSingleValues(n,r,e.baseType)}return console.error("unexpected number of children in qti-string-match"),null}};kf([p({type:String,attribute:"case-sensitive"})],kn.prototype,"caseSensitive",void 0);var Ef=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},En=class extends E{constructor(){super(...arguments),this.caseSensitive="true"}getResult(){let t=this.getVariables();if(t.length!==2)return console.error("qti-substring requires exactly 2 child expressions"),null;let[e,i]=t;if(e.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(i.value))return console.error("qti-substring requires single cardinality"),null;if(e.value===null||i.value===null||e.value===void 0||i.value===void 0)return null;let n=e.value.toString(),r=i.value.toString();return this.caseSensitive!=="true"?r.toLowerCase().includes(n.toLowerCase()):r.includes(n)}};Ef([p({type:String,attribute:"case-sensitive"})],En.prototype,"caseSensitive",void 0);var ba=class extends If(E){getResult(){return this.calculateChildren(Array.from(this.children))}};function If(o){return class extends o{calculateChildren(e){let i=e.map(n=>{if(!n.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let r=n.calculate();return Number.isNaN(r)?(console.error("Unexpected value in qti-subtract, expected number"),null):Number(r)});return i.some(n=>n===null)?(console.error("One or more child expressions returned invalid values"),0):i[0]-i[1]}}}var ya=class extends E{getResult(){return new Yl(Array.from(this.children)).calculate()}},Yl=class{constructor(t){this.expressions=t}calculate(){return this.expressions.filter(i=>i.calculate!==void 0).some(i=>i.calculate()===null)?null:this.expressions.map(i=>{let n=i.calculate();return Number.isNaN(n)?(console.error("unexpected value in qti-sum, expected number"),null):Number(n)}).reduce((i,n)=>i+n,0)}};var va=class extends E{get resultBaseType(){return"integer"}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-truncate requires exactly one child expression"),null;let e=t[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 i=Number.parseFloat(e.value);return Number.isNaN(i)?(console.error("qti-truncate requires a numerical value"),null):Math.trunc(i)}};var wa=class extends E{getResult(){let t=this.getAttribute("identifier")||"";return this.resolveVariable(t)?.value??null}};var Fp=[{tag:"qti-and",ctor:Es},{tag:"qti-any-n",ctor:ir},{tag:"qti-base-value",ctor:mn},{tag:"qti-container-size",ctor:Is},{tag:"qti-contains",ctor:As},{tag:"qti-correct",ctor:_s},{tag:"qti-default",ctor:Ci},{tag:"qti-delete",ctor:Ts},{tag:"qti-divide",ctor:Rs},{tag:"qti-duration-gte",ctor:Ps},{tag:"qti-duration-lt",ctor:Os},{tag:"qti-equal",ctor:rr},{tag:"qti-equal-rounded",ctor:fn},{tag:"qti-exit-response",ctor:Ms},{tag:"qti-exit-test",ctor:Ds},{tag:"qti-field-value",ctor:Ns},{tag:"qti-gcd",ctor:$s},{tag:"qti-gt",ctor:Ls},{tag:"qti-gte",ctor:Vs},{tag:"qti-index",ctor:gn},{tag:"qti-inside",ctor:nr},{tag:"qti-integer-divide",ctor:zs},{tag:"qti-integer-modulus",ctor:js},{tag:"qti-integer-to-float",ctor:Fs},{tag:"qti-is-null",ctor:Bs},{tag:"qti-lcm",ctor:Us},{tag:"qti-lookup-outcome-value",ctor:or},{tag:"qti-lt",ctor:Hs},{tag:"qti-lte",ctor:Ws},{tag:"qti-map-response",ctor:yn},{tag:"qti-map-response-point",ctor:bn},{tag:"qti-match",ctor:Qs},{tag:"qti-math-constant",ctor:vn},{tag:"qti-math-operator",ctor:wn},{tag:"qti-max",ctor:Xs},{tag:"qti-member",ctor:Gs},{tag:"qti-min",ctor:Ys},{tag:"qti-multiple",ctor:Ks},{tag:"qti-not",ctor:Js},{tag:"qti-null",ctor:Zs},{tag:"qti-or",ctor:ta},{tag:"qti-ordered",ctor:ea},{tag:"qti-outcome-condition",ctor:ra},{tag:"qti-outcome-else",ctor:oa},{tag:"qti-outcome-else-if",ctor:na},{tag:"qti-outcome-if",ctor:cr},{tag:"qti-pattern-match",ctor:xn},{tag:"qti-power",ctor:sa},{tag:"qti-printed-variable",ctor:vt},{tag:"qti-product",ctor:aa},{tag:"qti-random",ctor:la},{tag:"qti-random-integer",ctor:Si},{tag:"qti-repeat",ctor:Cn},{tag:"qti-response-condition",ctor:ca},{tag:"qti-response-else",ctor:ha},{tag:"qti-response-else-if",ctor:da},{tag:"qti-response-if",ctor:dr},{tag:"qti-response-processing-fragment",ctor:pa},{tag:"qti-round",ctor:ua},{tag:"qti-round-to",ctor:hr},{tag:"qti-rule",ctor:G},{tag:"qti-set-correct-response",ctor:ma},{tag:"qti-set-outcome-value",ctor:fa},{tag:"qti-set-template-value",ctor:ga},{tag:"qti-stats-operator",ctor:Sn},{tag:"qti-string-match",ctor:kn},{tag:"qti-substring",ctor:En},{tag:"qti-subtract",ctor:ba},{tag:"qti-sum",ctor:ya},{tag:"qti-truncate",ctor:va},{tag:"qti-variable",ctor:wa}];for(let{tag:o,ctor:t}of Fp)customElements.get(o)||customElements.define(o,t);var ve=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},tt;(function(o){o.Correct="correct",o.PartiallyCorrect="partially-correct",o.Incorrect="incorrect"})(tt||(tt={}));var Kl=o=>{class t extends o{constructor(){super(...arguments),this.showCorrectResponse=!1,this._handleShowCorrectResponseChange=(i,n)=>{this.toggleInternalCorrectResponse(n)},this.showFullCorrectResponse=!1,this._handleShowFullCorrectResponseChange=(i,n)=>{this.toggleFullCorrectResponse(n)},this.showCandidateCorrection=!1,this._handleShowCandidateCorrectionChange=(i,n)=>{this.toggleCandidateCorrection(n)},this._correctResponse=null}set correctResponseAttr(i){this._correctResponse=i}get correctResponseAttr(){return this._correctResponse}get isFullCorrectResponse(){return this._isFullCorrectResponse}get registersWithItem(){return!this.isFullCorrectResponse&&super.registersWithItem}set isFullCorrectResponse(i){this._isFullCorrectResponse=i,i&&(this.setAttribute("inert",""),this.setAttribute("response-identifier",this.responseIdentifier+"_cr"),this.setAttribute("answer-key",""))}get correctResponse(){let i=this.responseVariable;return i?.correctResponse?i.correctResponse:this._correctResponse}set correctResponse(i){let n=this._correctResponse;this._correctResponse=i,i==null?this.removeAttribute("correct-response"):this.setAttribute("correct-response",Array.isArray(i)?i.join(","):i),this.requestUpdate("_correctResponse",n)}get correctness(){let i=this.correctResponse;if(!i)return null;let n=this.response;if(n==null||n===""||Array.isArray(n)&&n.length===0)return null;let r=Array.isArray(i)?i:[i],a=(Array.isArray(n)?n:[n]).filter(d=>d!=="");if(a.length===0)return null;let l=a.filter(d=>r.includes(d)).length,c=a.filter(d=>!r.includes(d)).length;return l===r.length&&c===0&&a.length===r.length?tt.Correct:l>0&&(l<r.length||c>0)?tt.PartiallyCorrect:tt.Incorrect}get correctionPart(){return"correction"}toggleCorrectResponse(i){(this.configContext?.correctResponseMode||"internal")==="full"?this.toggleFullCorrectResponse(i):this.toggleInternalCorrectResponse(i)}get withholdsFullCorrectResponseWhenCorrect(){return this.configContext?.fullCorrectResponseOnlyWhenIncorrect!==!1}async toggleFullCorrectResponse(i){let n=this.nextSibling,r=n instanceof HTMLDivElement&&n?.classList.contains("full-correct-response"),s=this.correctResponse;if(!s)return;if(!(i&&(!this.withholdsFullCorrectResponseWhenCorrect||this.correctness!==tt.Correct))){if(!r)return;this.parentElement?.removeChild(n);return}if(r)return;let l=this.cloneNode(!0);l.removeAttribute("show-full-correct-response"),l.removeAttribute("show-correct-response"),l.removeAttribute("show-candidate-correction");let c=document.createElement("div");c.classList.add("full-correct-response"),this.isInline?c.classList.add("full-correct-response-inline"):c.classList.add("full-correct-response-block"),c.role="full-correct-response",c.appendChild(l),l.isFullCorrectResponse=!0,this.parentElement?.insertBefore(c,this.nextSibling),await l.updateComplete,l.response=Array.isArray(s)?[...s]:s}toggleInternalCorrectResponse(i){this._internals.states.delete("show-correct-response"),i&&this.correctResponse&&this._internals.states.add("show-correct-response")}toggleCandidateCorrection(i){}firstUpdated(){super.firstUpdated(),!this.isFullCorrectResponse&&(this.showCorrectResponse&&this.toggleInternalCorrectResponse(!0),this.showFullCorrectResponse&&this.toggleFullCorrectResponse(!0))}}return ve([p({attribute:"correct-response",reflect:!0,converter:Kt({emptyAs:null})})],t.prototype,"correctResponseAttr",null),ve([p({type:Boolean,attribute:"show-correct-response",reflect:!0})],t.prototype,"showCorrectResponse",void 0),ve([L("showCorrectResponse",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowCorrectResponseChange",void 0),ve([p({type:Boolean,attribute:"show-full-correct-response",reflect:!0})],t.prototype,"showFullCorrectResponse",void 0),ve([L("showFullCorrectResponse",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowFullCorrectResponseChange",void 0),ve([p({type:Boolean,attribute:"show-candidate-correction",reflect:!0})],t.prototype,"showCandidateCorrection",void 0),ve([L("showCandidateCorrection",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowCandidateCorrectionChange",void 0),ve([T()],t.prototype,"_isFullCorrectResponse",void 0),ve([T()],t.prototype,"_correctResponse",void 0),t};var st=q`
9633
9641
  /* Nothing at all until the item judges this element. */
9634
9642
  [part~='correction'] {
9635
9643
  display: none;
@@ -9662,21 +9670,21 @@ CES.load();
9662
9670
 
9663
9671
  pointer-events: none;
9664
9672
  }
9665
- `;var ff=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},K=o=>{class t extends Hl(o){constructor(){super(...arguments),this._candidateCorrection=null}get correctionPart(){return this._candidateCorrection?`correction correction-${this._candidateCorrection}`:"correction"}toggleCandidateCorrection(r){this.showCandidateCorrection!==r&&(this.showCandidateCorrection=r),super.toggleCandidateCorrection(r);let n=this._internals;n.states.delete("candidate-correct"),n.states.delete("candidate-partially-correct"),n.states.delete("candidate-incorrect");let i=null;r&&(this.correctness===tt.Correct&&(n.states.add("candidate-correct"),i="correct"),this.correctness===tt.PartiallyCorrect&&(n.states.add("candidate-partially-correct"),i="partially-correct"),this.correctness===tt.Incorrect&&(n.states.add("candidate-incorrect"),i="incorrect")),this._candidateCorrection!==i&&(this._candidateCorrection=i)}connectedCallback(){super.connectedCallback?.(),queueMicrotask(()=>{!this.isConnected||this.isFullCorrectResponse||this.showCandidateCorrection&&this.toggleCandidateCorrection(!0)})}}return ff([T()],t.prototype,"_candidateCorrection",void 0),t};var Cr=o=>{class t extends K(o){toggleInternalCorrectResponse(r){super.toggleInternalCorrectResponse(r);let n=this.correctResponse,i=n?Array.isArray(n)?n:[n]:[];for(let s of this._choiceElements)s.internals.states.delete("correct-response"),s.internals.states.delete("incorrect-response"),r&&i.length>0&&s.internals.states.add(i.includes(s.identifier)?"correct-response":"incorrect-response")}toggleCandidateCorrection(r){super.toggleCandidateCorrection(r);for(let s of this._choiceElements)s.candidateCorrection=null;if(!r||!this.correctResponse)return;let n=Array.isArray(this.correctResponse)?this.correctResponse:[this.correctResponse],i=Array.isArray(this.response)?this.response:this.response?[this.response]:[];for(let s of this._choiceElements)i.includes(s.identifier)&&(s.candidateCorrection=n.includes(s.identifier)?"correct":"incorrect")}}return t};var Rt=o=>{class t extends o{#t=null;get candidateCorrection(){return this.#t}set candidateCorrection(r){if(this.#t===r)return;let n=this.#t;this.#t=r;let i=this.internals.states;i.delete("candidate-correct"),i.delete("candidate-incorrect"),i.delete("candidate-partially-correct"),r&&i.add(`candidate-${r}`),this.requestUpdate("candidateCorrection",n)}get correctionPart(){return this.#t?`correction correction-${this.#t}`:"correction"}}return t};var Wl=class extends Rt(Me){static{this.styles=[Me.styles,st]}render(){return b`<div part="control"></div>
9673
+ `;var Af=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},K=o=>{class t extends Kl(o){constructor(){super(...arguments),this._candidateCorrection=null}get correctionPart(){return this._candidateCorrection?`correction correction-${this._candidateCorrection}`:"correction"}toggleCandidateCorrection(i){this.showCandidateCorrection!==i&&(this.showCandidateCorrection=i),super.toggleCandidateCorrection(i);let n=this._internals;n.states.delete("candidate-correct"),n.states.delete("candidate-partially-correct"),n.states.delete("candidate-incorrect");let r=null;i&&(this.correctness===tt.Correct&&(n.states.add("candidate-correct"),r="correct"),this.correctness===tt.PartiallyCorrect&&(n.states.add("candidate-partially-correct"),r="partially-correct"),this.correctness===tt.Incorrect&&(n.states.add("candidate-incorrect"),r="incorrect")),this._candidateCorrection!==r&&(this._candidateCorrection=r)}connectedCallback(){super.connectedCallback?.(),queueMicrotask(()=>{!this.isConnected||this.isFullCorrectResponse||this.showCandidateCorrection&&this.toggleCandidateCorrection(!0)})}}return Af([T()],t.prototype,"_candidateCorrection",void 0),t};var ki=o=>{class t extends K(o){toggleInternalCorrectResponse(i){super.toggleInternalCorrectResponse(i);let n=this.correctResponse,r=n?Array.isArray(n)?n:[n]:[];for(let s of this._choiceElements)s.internals.states.delete("correct-response"),s.internals.states.delete("incorrect-response"),i&&r.length>0&&s.internals.states.add(r.includes(s.identifier)?"correct-response":"incorrect-response")}toggleCandidateCorrection(i){super.toggleCandidateCorrection(i);for(let s of this._choiceElements)s.candidateCorrection=null;if(!i||!this.correctResponse)return;let n=Array.isArray(this.correctResponse)?this.correctResponse:[this.correctResponse],r=Array.isArray(this.response)?this.response:this.response?[this.response]:[];for(let s of this._choiceElements)r.includes(s.identifier)&&(s.candidateCorrection=n.includes(s.identifier)?"correct":"incorrect")}}return t};var Rt=o=>{class t extends o{#t=null;get candidateCorrection(){return this.#t}set candidateCorrection(i){if(this.#t===i)return;let n=this.#t;this.#t=i;let r=this.internals.states;r.delete("candidate-correct"),r.delete("candidate-incorrect"),r.delete("candidate-partially-correct"),i&&r.add(`candidate-${i}`),this.requestUpdate("candidateCorrection",n)}get correctionPart(){return this.#t?`correction correction-${this.#t}`:"correction"}}return t};var Jl=class extends Rt(Ne){static{this.styles=[Ne.styles,st]}render(){return b`<div part="control"></div>
9666
9674
  <slot part="label"></slot>
9667
- <span part=${this.correctionPart} aria-hidden="true"></span>`}};var gf=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},fa=class extends Rt(mr){constructor(){super(...arguments),this.orderCorrect=null}};gf([p({attribute:"aria-ordercorrectvalue",type:Number,reflect:!0})],fa.prototype,"orderCorrect",void 0);var Ql=class extends Rt(fr){static{this.styles=[fr.styles,st]}render(){return b`<div part="control"><div part="control-mark"></div></div>
9675
+ <span part=${this.correctionPart} aria-hidden="true"></span>`}};var _f=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},xa=class extends Rt(gi){constructor(){super(...arguments),this.orderCorrect=null}};_f([p({attribute:"aria-ordercorrectvalue",type:Number,reflect:!0})],xa.prototype,"orderCorrect",void 0);var Zl=class extends Rt(bi){static{this.styles=[bi.styles,st]}render(){return b`<div part="control"><div part="control-mark"></div></div>
9668
9676
  <slot part="label"></slot>
9669
- <span part=${this.correctionPart} aria-hidden="true"></span>`}};var Gl=class extends Rt(Lt){static{this.styles=[Lt.styles,st]}render(){return b`
9677
+ <span part=${this.correctionPart} aria-hidden="true"></span>`}};var tc=class extends Rt(Vt){static{this.styles=[Vt.styles,st]}render(){return b`
9670
9678
  <div part="control"></div>
9671
9679
  <slot part="label"></slot>
9672
9680
  <span part=${this.correctionPart} aria-hidden="true"></span>
9673
9681
  <div part="drop">
9674
9682
  ${W(this.drags,t=>t.getAttribute("identifier"),t=>t)}
9675
9683
  </div>
9676
- `}};var Xl=class extends Rt(Vt){static{this.styles=[Vt.styles,st]}render(){return b`<div part="control" tabindex="0"><div part="control-mark"></div></div>
9684
+ `}};var ec=class extends Rt(zt){static{this.styles=[zt.styles,st]}render(){return b`<div part="control" tabindex="0"><div part="control-mark"></div></div>
9677
9685
  ${this.marker?b`<div id="label" part="marker">${this.marker}</div>`:O}
9678
9686
  <slot part="label"></slot>
9679
- <span part=${this.correctionPart} aria-hidden="true"></span>`}};var Op=class extends ft{showCorrectResponse(t){for(let e of this.interactionElements)e.toggleCorrectResponse?.(t);this.updateControlState("item-show-correct-response",t)}showCandidateCorrection(t){for(let e of this.interactionElements)e.toggleCandidateCorrection?.(t);this.updateControlState("item-show-candidate-correction",t)}afterResponseVariableUpdated(){this.showCandidateCorrection(!1)}updateControlState(t,e){let r=this.getRootNode();for(;;){if(r.querySelectorAll(t).forEach(n=>n.shown=e),!(r instanceof ShadowRoot))return;r=r.host.getRootNode()}}};var Mp=class extends he{#t=t=>{let e=t.detail;this.assessmentItem?.showCorrectResponse?.(e),this.updateControlState("item-show-correct-response",e)};#e=t=>{let e=t.detail;this.assessmentItem?.showCandidateCorrection?.(e),this.updateControlState("item-show-candidate-correction",e)};#r=t=>{this.assessmentItem?.showCorrectResponse?.(!1),this.configContext={...this.configContext,correctResponseMode:t.detail}};updateAssessmentItemView(t,e){t?.showCorrectResponse?.(e==="scorer"),this.updateControlState("item-show-correct-response",e==="scorer")}constructor(){super(),this.addEventListener("item-show-correct-response",this.#t),this.addEventListener("item-show-candidate-correction",this.#e),this.addEventListener("item-switch-correct-response-mode",this.#r)}updateControlState(t,e){this.querySelectorAll(t).forEach(r=>r.shown=e)}disconnectedCallback(){this.removeEventListener("item-show-correct-response",this.#t),this.removeEventListener("item-show-candidate-correction",this.#e),this.removeEventListener("item-switch-correct-response-mode",this.#r),super.disconnectedCallback()}};var Dp=class extends gt{#t=t=>{this.activeAssessmentItem?.showCorrectResponse?.(t.detail)};#e=t=>{this.activeAssessmentItem?.showCandidateCorrection?.(t.detail)};constructor(){super(),this.addEventListener("test-show-correct-response",this.#t),this.addEventListener("test-show-candidate-correction",this.#e)}disconnectedCallback(){this.removeEventListener("test-show-correct-response",this.#t),this.removeEventListener("test-show-candidate-correction",this.#e),super.disconnectedCallback()}afterAttemptEnded(t,e,r){if(!t||!e?.showSolution)return;let n=t;n.showCandidateCorrection?.(!0),n.showCorrectResponse?.(r)}},Np=class extends _e{updateAssessmentItemView(t,e){t.showCorrectResponse?.(e==="scorer")}},$p=class extends ir{constructor(){super(),this.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("test-show-correct-response",{detail:!0,bubbles:!0}))})}};var Yl=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Sn=class extends C{constructor(){super(...arguments),this.label="Correct response mode",this._options={internal:"Internal",full:"Full (copy)"}}#t(t){this.dispatchEvent(new CustomEvent("item-switch-correct-response-mode",{detail:t,bubbles:!0}))}render(){return b`
9687
+ <span part=${this.correctionPart} aria-hidden="true"></span>`}};var Bp=class extends ft{showCorrectResponse(t){for(let e of this.interactionElements)e.toggleCorrectResponse?.(t);this.updateControlState("item-show-correct-response",t)}showCandidateCorrection(t){for(let e of this.interactionElements)e.toggleCandidateCorrection?.(t);this.updateControlState("item-show-candidate-correction",t)}afterResponseVariableUpdated(){this.showCandidateCorrection(!1)}updateControlState(t,e){let i=this.getRootNode();for(;;){if(i.querySelectorAll(t).forEach(n=>n.shown=e),!(i instanceof ShadowRoot))return;i=i.host.getRootNode()}}};var Up=class extends ue{#t=t=>{let e=t.detail;this.assessmentItem?.showCorrectResponse?.(e),this.updateControlState("item-show-correct-response",e)};#e=t=>{let e=t.detail;this.assessmentItem?.showCandidateCorrection?.(e),this.updateControlState("item-show-candidate-correction",e)};#i=t=>{this.assessmentItem?.showCorrectResponse?.(!1),this.configContext={...this.configContext,correctResponseMode:t.detail}};updateAssessmentItemView(t,e){t?.showCorrectResponse?.(e==="scorer"),this.updateControlState("item-show-correct-response",e==="scorer")}constructor(){super(),this.addEventListener("item-show-correct-response",this.#t),this.addEventListener("item-show-candidate-correction",this.#e),this.addEventListener("item-switch-correct-response-mode",this.#i)}updateControlState(t,e){this.querySelectorAll(t).forEach(i=>i.shown=e)}disconnectedCallback(){this.removeEventListener("item-show-correct-response",this.#t),this.removeEventListener("item-show-candidate-correction",this.#e),this.removeEventListener("item-switch-correct-response-mode",this.#i),super.disconnectedCallback()}};var Hp=class extends gt{#t=t=>{this.activeAssessmentItem?.showCorrectResponse?.(t.detail)};#e=t=>{this.activeAssessmentItem?.showCandidateCorrection?.(t.detail)};constructor(){super(),this.addEventListener("test-show-correct-response",this.#t),this.addEventListener("test-show-candidate-correction",this.#e)}disconnectedCallback(){this.removeEventListener("test-show-correct-response",this.#t),this.removeEventListener("test-show-candidate-correction",this.#e),super.disconnectedCallback()}afterAttemptEnded(t,e,i){if(!t||!e?.showSolution)return;let n=t;n.showCandidateCorrection?.(!0),n.showCorrectResponse?.(i)}},Wp=class extends Re{updateAssessmentItemView(t,e){t.showCorrectResponse?.(e==="scorer")}},Qp=class extends oi{constructor(){super(),this.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("test-show-correct-response",{detail:!0,bubbles:!0}))})}};var ic=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},In=class extends C{constructor(){super(...arguments),this.label="Correct response mode",this._options={internal:"Internal",full:"Full (copy)"}}#t(t){this.dispatchEvent(new CustomEvent("item-switch-correct-response-mode",{detail:t,bubbles:!0}))}render(){return b`
9680
9688
  <label part="label" for="modeSelect">${this.label}</label>
9681
9689
  <select
9682
9690
  part="select"
@@ -9687,44 +9695,44 @@ CES.load();
9687
9695
  ${this._options[t]}
9688
9696
  </option>`)}
9689
9697
  </select>
9690
- `}};Yl([_({context:qt,subscribe:!0})],Sn.prototype,"itemContext",void 0);Yl([p({type:String})],Sn.prototype,"label",void 0);Yl([T()],Sn.prototype,"_options",void 0);var Lp=q`
9698
+ `}};ic([_({context:qt,subscribe:!0})],In.prototype,"itemContext",void 0);ic([p({type:String})],In.prototype,"label",void 0);ic([T()],In.prototype,"_options",void 0);var Xp=q`
9691
9699
  display: inline-flex;
9692
9700
  align-items: center;
9693
9701
  cursor: pointer;
9694
9702
  padding: 0.5rem 1rem;
9695
9703
  border-radius: 0.25rem;
9696
9704
  user-select: none;
9697
- `,di=q`
9705
+ `,pr=q`
9698
9706
  background-color: lightgray;
9699
- ${Lp};
9700
- `,hi=q`
9707
+ ${Xp};
9708
+ `,ur=q`
9701
9709
  cursor: not-allowed;
9702
9710
  opacity: 0.8;
9703
- `,lF=q`
9704
- ${Lp};
9711
+ `,NF=q`
9712
+ ${Xp};
9705
9713
  border: 1px solid gray;
9706
- `;var pi=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Ue=class extends C{static{this.styles=q`
9714
+ `;var mr=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},We=class extends C{static{this.styles=q`
9707
9715
  :host {
9708
- ${di};
9716
+ ${pr};
9709
9717
  }
9710
9718
  :host([disabled]) {
9711
- ${hi};
9719
+ ${ur};
9712
9720
  }
9713
- `}#t;#e;constructor(){super(),this.shown=!1,this.disabled=!1,this.showCandidateCorrectionText="Show candidate correction",this.hideCandidateCorrectionText="Hide candidate correction",this.noCorrectResponseText="No correct response specified",this.#t=!1,this.#e=""}updated(){if(!this.#t||this.#e!==this.computedContext?.identifier){this.#e=this.computedContext?.identifier;let t=!!this.computedContext?.variables.some(r=>r.correctResponse),e=!!this.computedContext?.variables.some(r=>r.mapping?.mapEntries?.length>0||r.areaMapping?.areaMapEntries?.length>0);this.#t=t||e}this.disabled=!this.#t}#r(){this.disabled||this.dispatchEvent(new CustomEvent("item-show-candidate-correction",{detail:!this.shown,bubbles:!0}))}#i(){return this.disabled?this.noCorrectResponseText:this.shown?this.hideCandidateCorrectionText:this.showCandidateCorrectionText}render(){return b` <div @click="${this.#r}">${this.#i()}</div> `}};pi([_({context:xe,subscribe:!0})],Ue.prototype,"computedContext",void 0);pi([p({type:Boolean,reflect:!0})],Ue.prototype,"shown",void 0);pi([p({type:Boolean,reflect:!0})],Ue.prototype,"disabled",void 0);pi([p({type:String})],Ue.prototype,"showCandidateCorrectionText",void 0);pi([p({type:String})],Ue.prototype,"hideCandidateCorrectionText",void 0);pi([p({type:String})],Ue.prototype,"noCorrectResponseText",void 0);var ui=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},He=class extends C{constructor(){super(...arguments),this.shown=!1,this.disabled=!1,this.showCorrectText="Show correct response",this.hideCorrectText="Hide correct response",this.noCorrectResponseText="No correct response specified",this.#t=!1,this.#e=""}static{this.styles=q`
9721
+ `}#t;#e;constructor(){super(),this.shown=!1,this.disabled=!1,this.showCandidateCorrectionText="Show candidate correction",this.hideCandidateCorrectionText="Hide candidate correction",this.noCorrectResponseText="No correct response specified",this.#t=!1,this.#e=""}updated(){if(!this.#t||this.#e!==this.computedContext?.identifier){this.#e=this.computedContext?.identifier;let t=!!this.computedContext?.variables.some(i=>i.correctResponse),e=!!this.computedContext?.variables.some(i=>i.mapping?.mapEntries?.length>0||i.areaMapping?.areaMapEntries?.length>0);this.#t=t||e}this.disabled=!this.#t}#i(){this.disabled||this.dispatchEvent(new CustomEvent("item-show-candidate-correction",{detail:!this.shown,bubbles:!0}))}#r(){return this.disabled?this.noCorrectResponseText:this.shown?this.hideCandidateCorrectionText:this.showCandidateCorrectionText}render(){return b` <div @click="${this.#i}">${this.#r()}</div> `}};mr([_({context:Ce,subscribe:!0})],We.prototype,"computedContext",void 0);mr([p({type:Boolean,reflect:!0})],We.prototype,"shown",void 0);mr([p({type:Boolean,reflect:!0})],We.prototype,"disabled",void 0);mr([p({type:String})],We.prototype,"showCandidateCorrectionText",void 0);mr([p({type:String})],We.prototype,"hideCandidateCorrectionText",void 0);mr([p({type:String})],We.prototype,"noCorrectResponseText",void 0);var fr=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},Qe=class extends C{constructor(){super(...arguments),this.shown=!1,this.disabled=!1,this.showCorrectText="Show correct response",this.hideCorrectText="Hide correct response",this.noCorrectResponseText="No correct response specified",this.#t=!1,this.#e=""}static{this.styles=q`
9714
9722
  :host {
9715
- ${di};
9723
+ ${pr};
9716
9724
  }
9717
9725
  :host([disabled]) {
9718
- ${hi};
9726
+ ${ur};
9719
9727
  }
9720
- `}#t;#e;updated(){if(!this.#t||this.#e!==this.computedContext?.identifier){this.#e=this.computedContext?.identifier;let t=!!this.computedContext?.variables.some(r=>r.correctResponse),e=!!this.computedContext?.variables.some(r=>r.mapping?.mapEntries?.length>0||r.areaMapping?.areaMapEntries?.length>0);this.#t=t||e}this.disabled=!this.#t}#r(){this.disabled||this.dispatchEvent(new CustomEvent("item-show-correct-response",{detail:!this.shown,bubbles:!0}))}#i(){return this.disabled?this.noCorrectResponseText:this.shown?this.hideCorrectText:this.showCorrectText}render(){return b` <div @click="${this.#r}">${this.#i()}</div> `}};ui([_({context:xe,subscribe:!0})],He.prototype,"computedContext",void 0);ui([p({type:Boolean,reflect:!0})],He.prototype,"shown",void 0);ui([p({type:Boolean,reflect:!0})],He.prototype,"disabled",void 0);ui([p({type:String})],He.prototype,"showCorrectText",void 0);ui([p({type:String})],He.prototype,"hideCorrectText",void 0);ui([p({type:String})],He.prototype,"noCorrectResponseText",void 0);var mi=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},We=class extends C{constructor(){super(...arguments),this.shown=!1,this.disabled=!1,this.showCorrectText="Show correct response",this.hideCorrectText="Hide correct response",this.noCorrectResponseText="No correct response specified"}static{this.styles=q`
9728
+ `}#t;#e;updated(){if(!this.#t||this.#e!==this.computedContext?.identifier){this.#e=this.computedContext?.identifier;let t=!!this.computedContext?.variables.some(i=>i.correctResponse),e=!!this.computedContext?.variables.some(i=>i.mapping?.mapEntries?.length>0||i.areaMapping?.areaMapEntries?.length>0);this.#t=t||e}this.disabled=!this.#t}#i(){this.disabled||this.dispatchEvent(new CustomEvent("item-show-correct-response",{detail:!this.shown,bubbles:!0}))}#r(){return this.disabled?this.noCorrectResponseText:this.shown?this.hideCorrectText:this.showCorrectText}render(){return b` <div @click="${this.#i}">${this.#r()}</div> `}};fr([_({context:Ce,subscribe:!0})],Qe.prototype,"computedContext",void 0);fr([p({type:Boolean,reflect:!0})],Qe.prototype,"shown",void 0);fr([p({type:Boolean,reflect:!0})],Qe.prototype,"disabled",void 0);fr([p({type:String})],Qe.prototype,"showCorrectText",void 0);fr([p({type:String})],Qe.prototype,"hideCorrectText",void 0);fr([p({type:String})],Qe.prototype,"noCorrectResponseText",void 0);var gr=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},Xe=class extends C{constructor(){super(...arguments),this.shown=!1,this.disabled=!1,this.showCorrectText="Show correct response",this.hideCorrectText="Hide correct response",this.noCorrectResponseText="No correct response specified"}static{this.styles=q`
9721
9729
  :host {
9722
- ${di};
9730
+ ${pr};
9723
9731
  }
9724
9732
  :host([disabled]) {
9725
- ${hi};
9733
+ ${ur};
9726
9734
  }
9727
- `}#t;willUpdate(t){let e=this.computedContext?.testParts.flatMap(r=>r.sections.flatMap(n=>n.items)).find(r=>r.active);if(this.#t!==e&&(this.shown=!1,this.#t=e),e){let r=!!e?.variables?.some(i=>i.correctResponse),n=!!e?.variables?.some(i=>i.mapping?.mapEntries?.length>0||i.areaMapping?.areaMapEntries?.length>0);this.disabled=!r&&!n}else this.disabled=!0}#e(){this.disabled||(this.shown=!this.shown,this.dispatchEvent(new CustomEvent("test-show-correct-response",{detail:this.shown,bubbles:!0})))}#r(){return this.disabled?this.noCorrectResponseText:this.shown?this.hideCorrectText:this.showCorrectText}render(){return b` <div @click="${this.#e}">${this.#r()}</div> `}};mi([_({context:j,subscribe:!0})],We.prototype,"computedContext",void 0);mi([p({type:Boolean,reflect:!0})],We.prototype,"shown",void 0);mi([p({type:Boolean,reflect:!0})],We.prototype,"disabled",void 0);mi([p({type:String})],We.prototype,"showCorrectText",void 0);mi([p({type:String})],We.prototype,"hideCorrectText",void 0);mi([p({type:String})],We.prototype,"noCorrectResponseText",void 0);var ee=o=>{class t extends K(o){toggleInternalCorrectResponse(r){this.showFullCorrectResponse||this.toggleFullCorrectResponse(r)}afterCache(){super.afterCache(),this.showCorrectResponse&&this.toggleInternalCorrectResponse(!0),this.showCandidateCorrection&&this.toggleCandidateCorrection(!0),this.showFullCorrectResponse&&this.toggleFullCorrectResponse(!0)}}return t};var Jl=class extends ee(yr){};var Zl=class extends Cr(vr){};var bf=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},ga=class extends Rt(Q){static{this.styles=[Q.styles,st,q`
9735
+ `}#t;willUpdate(t){let e=this.computedContext?.testParts.flatMap(i=>i.sections.flatMap(n=>n.items)).find(i=>i.active);if(this.#t!==e&&(this.shown=!1,this.#t=e),e){let i=!!e?.variables?.some(r=>r.correctResponse),n=!!e?.variables?.some(r=>r.mapping?.mapEntries?.length>0||r.areaMapping?.areaMapEntries?.length>0);this.disabled=!i&&!n}else this.disabled=!0}#e(){this.disabled||(this.shown=!this.shown,this.dispatchEvent(new CustomEvent("test-show-correct-response",{detail:this.shown,bubbles:!0})))}#i(){return this.disabled?this.noCorrectResponseText:this.shown?this.hideCorrectText:this.showCorrectText}render(){return b` <div @click="${this.#e}">${this.#i()}</div> `}};gr([_({context:j,subscribe:!0})],Xe.prototype,"computedContext",void 0);gr([p({type:Boolean,reflect:!0})],Xe.prototype,"shown",void 0);gr([p({type:Boolean,reflect:!0})],Xe.prototype,"disabled",void 0);gr([p({type:String})],Xe.prototype,"showCorrectText",void 0);gr([p({type:String})],Xe.prototype,"hideCorrectText",void 0);gr([p({type:String})],Xe.prototype,"noCorrectResponseText",void 0);var ie=o=>{class t extends K(o){toggleInternalCorrectResponse(i){this.showFullCorrectResponse||this.toggleFullCorrectResponse(i)}afterCache(){super.afterCache(),this.showCorrectResponse&&this.toggleInternalCorrectResponse(!0),this.showCandidateCorrection&&this.toggleCandidateCorrection(!0),this.showFullCorrectResponse&&this.toggleFullCorrectResponse(!0)}}return t};var nc=class extends ie(wi){};var oc=class extends ki(xi){};var Tf=function(o,t,e,i){var n=arguments.length,r=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(n<3?s(r):n>3?s(t,e,r):s(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r},qa=class extends Rt(Q){static{this.styles=[Q.styles,st,q`
9728
9736
  /*
9729
9737
  * Placement only — the glyph itself is the theme's, keyed on ::part(correction-*). That split
9730
9738
  * is the contract in correction.styles.ts, which deliberately leaves the shared badge in flow
@@ -9787,7 +9795,7 @@ CES.load();
9787
9795
  }
9788
9796
  `]}render(){return b`${this.renderPrompt()}${this.renderTextarea()}
9789
9797
  <span part=${this.correctionPart} aria-hidden="true"></span>
9790
- ${this.renderValidationMessage()}`}};bf([p({attribute:"candidate-correction",reflect:!0,noAccessor:!0})],ga.prototype,"candidateCorrection",void 0);var ba=o=>o?(Array.isArray(o)?o:[o]).map(e=>{let[r,n]=e.split(" ");return{source:r,target:n}}):[];var tc=class extends ee(Xr){toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=ba(this.correctResponse);for(let r of this.querySelectorAll("qti-gap")){let n=r.getAttribute("identifier"),i=r.drags;for(let s of i)s.candidateCorrection=null,t&&e.some(a=>a.source===s.identifier&&a.target===n)?s.candidateCorrection="correct":t&&(s.candidateCorrection="incorrect")}}};var ec=class extends K(Bt){#t=[];toggleInternalCorrectResponse(t){super.toggleInternalCorrectResponse(t);let e=this.correctResponse,r=this.#t;this.#t=t&&e?Array.isArray(e)?[...e]:[e]:[],this.requestUpdate("correctLines",r)}renderSupplementalLines(){return W(this.#t,t=>t,t=>_i`
9798
+ ${this.renderValidationMessage()}`}};Tf([p({attribute:"candidate-correction",reflect:!0,noAccessor:!0})],qa.prototype,"candidateCorrection",void 0);var Ca=o=>o?(Array.isArray(o)?o:[o]).map(e=>{let[i,n]=e.split(" ");return{source:i,target:n}}):[];var sc=class extends ie(Ki){toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=Ca(this.correctResponse);for(let i of this.querySelectorAll("qti-gap")){let n=i.getAttribute("identifier"),r=i.drags;for(let s of r)s.candidateCorrection=null,t&&e.some(a=>a.source===s.identifier&&a.target===n)?s.candidateCorrection="correct":t&&(s.candidateCorrection="incorrect")}}};var ac=class extends K(Ut){#t=[];toggleInternalCorrectResponse(t){super.toggleInternalCorrectResponse(t);let e=this.correctResponse,i=this.#t;this.#t=t&&e?Array.isArray(e)?[...e]:[e]:[],this.requestUpdate("correctLines",i)}renderSupplementalLines(){return W(this.#t,t=>t,t=>Rr`
9791
9799
  <line
9792
9800
  part="correct-line"
9793
9801
  x1=${parseInt(this.querySelector(`[identifier=${t.split(" ")[0]}]`).style.left)}
@@ -9798,7 +9806,7 @@ CES.load();
9798
9806
  stroke-width="3"
9799
9807
  stroke-dasharray="5,5"
9800
9808
  />
9801
- `)}};var rc=class extends ee(Yr){};var ic=class extends K(Fe){resolvePinColor(t){let e=t;return e.matches(":state(candidate-incorrect)")?"var(--qti-incorrect)":e.matches(":state(candidate-correct)")?"var(--qti-correct)":e.matches(":state(correct-response)")?"var(--qti-answer-border)":super.resolvePinColor(t)}toggleInternalCorrectResponse(t){super.toggleInternalCorrectResponse(t);let e=this.correctResponse,r=e?Array.isArray(e)?e:[e]:[];for(let n of this._choiceElements){let i=r.indexOf(n.identifier);n.orderCorrect=t&&i>=0?i+1:null}this.refreshLocatorPins()}toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=this.correctResponse,r=e?Array.isArray(e)?e:[e]:[];for(let n of this._choiceElements)n.candidateCorrection=null,t&&n.order!=null&&(n.candidateCorrection=r[n.order-1]===n.identifier?"correct":"incorrect");this.refreshLocatorPins()}};var nc=class extends Cr(Kr){};var oc=class extends Cr(Jr){};var sc=class extends K(nt){static get styles(){return[nt.styles,st,q`
9809
+ `)}};var lc=class extends ie(Ji){};var cc=class extends K(Ue){resolvePinColor(t){let e=t;return e.matches(":state(candidate-incorrect)")?"var(--qti-incorrect)":e.matches(":state(candidate-correct)")?"var(--qti-correct)":e.matches(":state(correct-response)")?"var(--qti-answer-border)":super.resolvePinColor(t)}toggleInternalCorrectResponse(t){super.toggleInternalCorrectResponse(t);let e=this.correctResponse,i=e?Array.isArray(e)?e:[e]:[];for(let n of this._choiceElements){let r=i.indexOf(n.identifier);n.orderCorrect=t&&r>=0?r+1:null}this.refreshLocatorPins()}toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=this.correctResponse,i=e?Array.isArray(e)?e:[e]:[];for(let n of this._choiceElements)n.candidateCorrection=null,t&&n.order!=null&&(n.candidateCorrection=i[n.order-1]===n.identifier?"correct":"incorrect");this.refreshLocatorPins()}};var dc=class extends ki(Zi){};var hc=class extends ki(tr){};var pc=class extends K(nt){static get styles(){return[nt.styles,st,q`
9802
9810
  /*
9803
9811
  * Only the TRAILING inset — the leading gap is the shared --qti-glyph-gap, like every other
9804
9812
  * badge. This used to set both margins to --qti-gap (1rem), twice everyone else's 0.5em, on
@@ -9817,20 +9825,20 @@ CES.load();
9817
9825
  `]}toggleInternalCorrectResponse(t){this.showFullCorrectResponse||this.toggleFullCorrectResponse(t)}get withholdsFullCorrectResponseWhenCorrect(){return!1}render(){return b`
9818
9826
  ${this.renderTrigger()} ${this.renderMenu()} ${this.renderValidationMessage()}
9819
9827
  <span part=${this.correctionPart} aria-hidden="true"></span>
9820
- `}};var ac=class extends ee(fe){#t=new Set;toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=ba(this.correctResponse);this.#t=t?new Set(e.map(r=>`${r.source} ${r.target}`)):new Set;for(let r of this.targetChoices){let n=r.getAttribute("identifier"),i=r.drags;for(let s of i)s.candidateCorrection=null,t&&(s.candidateCorrection=this.#t.has(`${s.identifier} ${n}`)?"correct":"incorrect")}this.requestUpdate()}getCellStateVariant(t,e){return!this.showCandidateCorrection||!e?"":this.#t.has(t)?"correct":"incorrect"}};function yf(o){if(o.length===0)return new Set;let t=new Array(o.length).fill(1),e=new Array(o.length).fill(-1);for(let i=0;i<o.length;i++)for(let s=0;s<i;s++)o[s]<o[i]&&t[s]+1>t[i]&&(t[i]=t[s]+1,e[i]=s);let r=0;for(let i=1;i<o.length;i++)t[i]>t[r]&&(r=i);let n=new Set;for(let i=r;i!==-1;i=e[i])n.add(i);return n}function Vp(o,t){let e=new Map(t.map((a,l)=>[a,l])),r=o.filter(a=>e.has(a)),n=r.map(a=>e.get(a)),i=yf(n),s=new Set;return i.forEach(a=>s.add(r[a])),s}var lc=class extends ee(Be){toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let r=Array.from(this.shadowRoot.querySelectorAll("[part~='drop']")).flatMap(c=>this.chipsIn(c));for(let c of r)c.candidateCorrection=null;if(!t)return;let n=this.correctResponse,s=(n?Array.isArray(n)?n:[n]:[]).map((c,d)=>{let[h,f]=c.split(" "),m=f?.startsWith("droplist")?parseInt(f.slice(8),10):d;return{identifier:h,dropIndex:Number.isNaN(m)?d:m}}).filter(c=>c.identifier).sort((c,d)=>c.dropIndex-d.dropIndex).map(c=>c.identifier);if(s.length===0)return;let a=r.map(c=>({choice:c,identifier:c.getAttribute("identifier")})).filter(c=>!!c.identifier),l=Vp(a.map(c=>c.identifier),s);for(let{choice:c,identifier:d}of a)c.candidateCorrection=l.has(d)?"correct":"incorrect"}};var cc=class extends K(G){toggleInternalCorrectResponse(t){super.toggleInternalCorrectResponse(t);let e=this.responseVariable,r=e?.correctResponse??this.correctResponse;this.correctResponse=t?r:e?.cardinality==="single"?"":[];let n=`correct-response-container-${this.responseIdentifier}`;if(this.parentElement?.querySelectorAll(`#${n}`).forEach(f=>f.remove()),!t){this.enable();return}if(this.disable(),!this.correctResponse)return;let i=document.createElement("div");i.id=n,i.className="pci-correct-response-container",Object.assign(i.style,{position:"relative",marginTop:"20px",border:"2px solid green",padding:"16px",borderRadius:"4px",backgroundColor:"rgba(0, 128, 0, 0.05)"});let s=document.createElement("div");s.textContent="Correct Response:",Object.assign(s.style,{fontWeight:"bold",marginBottom:"10px",color:"green"}),i.append(s);let a=this.cloneNode(!1);a.removeAttribute("id"),a.removeAttribute("show-correct-response"),a.removeAttribute("show-full-correct-response"),a.removeAttribute("show-candidate-correction"),a.isFullCorrectResponse=!0;let l=this.responseIdentifier;a.responseIdentifier=`${l}-correct`;for(let f of Array.from(this.children))f.tagName.startsWith("QTI-")&&a.append(f.cloneNode(!0));let c=this.correctResponse,d=e?.cardinality??(Array.isArray(c)?"multiple":"single"),h=e?.baseType??"string";a.status="solution",a.responseDeclaration={baseType:h,cardinality:d,correctResponse:{value:c}},a.addEventListener("qti-portable-custom-interaction-loaded",()=>{let f=a.responseVariablesToQtiVariableJSON(c,d,h);a.sendMessageToIframe("setBoundTo",{[l]:f}),a.sendMessageToIframe("setState",{state:"review"})},{once:!0}),a.style.pointerEvents="none",i.append(a),this.after(i)}};var dc=class extends K(yt){#t=[];#e=[];static{this.styles=[yt.styles,q`
9828
+ `}};var uc=class extends ie(be){#t=new Set;toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=Ca(this.correctResponse);this.#t=t?new Set(e.map(i=>`${i.source} ${i.target}`)):new Set;for(let i of this.targetChoices){let n=i.getAttribute("identifier"),r=i.drags;for(let s of r)s.candidateCorrection=null,t&&(s.candidateCorrection=this.#t.has(`${s.identifier} ${n}`)?"correct":"incorrect")}this.requestUpdate()}getCellStateVariant(t,e){return!this.showCandidateCorrection||!e?"":this.#t.has(t)?"correct":"incorrect"}};function Rf(o){if(o.length===0)return new Set;let t=new Array(o.length).fill(1),e=new Array(o.length).fill(-1);for(let r=0;r<o.length;r++)for(let s=0;s<r;s++)o[s]<o[r]&&t[s]+1>t[r]&&(t[r]=t[s]+1,e[r]=s);let i=0;for(let r=1;r<o.length;r++)t[r]>t[i]&&(i=r);let n=new Set;for(let r=i;r!==-1;r=e[r])n.add(r);return n}function Gp(o,t){let e=new Map(t.map((a,l)=>[a,l])),i=o.filter(a=>e.has(a)),n=i.map(a=>e.get(a)),r=Rf(n),s=new Set;return r.forEach(a=>s.add(i[a])),s}var mc=class extends ie(He){toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let i=Array.from(this.shadowRoot.querySelectorAll("[part~='drop']")).flatMap(c=>this.chipsIn(c));for(let c of i)c.candidateCorrection=null;if(!t)return;let n=this.correctResponse,s=(n?Array.isArray(n)?n:[n]:[]).map((c,d)=>{let[h,f]=c.split(" "),m=f?.startsWith("droplist")?parseInt(f.slice(8),10):d;return{identifier:h,dropIndex:Number.isNaN(m)?d:m}}).filter(c=>c.identifier).sort((c,d)=>c.dropIndex-d.dropIndex).map(c=>c.identifier);if(s.length===0)return;let a=i.map(c=>({choice:c,identifier:c.getAttribute("identifier")})).filter(c=>!!c.identifier),l=Gp(a.map(c=>c.identifier),s);for(let{choice:c,identifier:d}of a)c.candidateCorrection=l.has(d)?"correct":"incorrect"}};var fc=class extends K(X){toggleInternalCorrectResponse(t){super.toggleInternalCorrectResponse(t);let e=this.responseVariable,i=e?.correctResponse??this.correctResponse;this.correctResponse=t?i:e?.cardinality==="single"?"":[];let n=`correct-response-container-${this.responseIdentifier}`;if(this.parentElement?.querySelectorAll(`#${n}`).forEach(f=>f.remove()),!t){this.enable();return}if(this.disable(),!this.correctResponse)return;let r=document.createElement("div");r.id=n,r.className="pci-correct-response-container",Object.assign(r.style,{position:"relative",marginTop:"20px",border:"2px solid green",padding:"16px",borderRadius:"4px",backgroundColor:"rgba(0, 128, 0, 0.05)"});let s=document.createElement("div");s.textContent="Correct Response:",Object.assign(s.style,{fontWeight:"bold",marginBottom:"10px",color:"green"}),r.append(s);let a=this.cloneNode(!1);a.removeAttribute("id"),a.removeAttribute("show-correct-response"),a.removeAttribute("show-full-correct-response"),a.removeAttribute("show-candidate-correction"),a.isFullCorrectResponse=!0;let l=this.responseIdentifier;a.responseIdentifier=`${l}-correct`;for(let f of Array.from(this.children))f.tagName.startsWith("QTI-")&&a.append(f.cloneNode(!0));let c=this.correctResponse,d=e?.cardinality??(Array.isArray(c)?"multiple":"single"),h=e?.baseType??"string";a.status="solution",a.responseDeclaration={baseType:h,cardinality:d,correctResponse:{value:c}},a.addEventListener("qti-portable-custom-interaction-loaded",()=>{let f=a.responseVariablesToQtiVariableJSON(c,d,h);a.sendMessageToIframe("setBoundTo",{[l]:f}),a.sendMessageToIframe("setState",{state:"review"})},{once:!0}),a.style.pointerEvents="none",r.append(a),this.after(r)}};var gc=class extends K(yt){#t=[];#e=[];static{this.styles=[yt.styles,q`
9821
9829
  [part~='correct'] {
9822
9830
  --qti-select-point-marker-color: var(--qti-correct);
9823
9831
  }
9824
9832
  [part~='incorrect'] {
9825
9833
  --qti-select-point-marker-color: var(--qti-incorrect);
9826
9834
  }
9827
- `]}toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=this.#e;if(this.#e=[],!t){this.requestUpdate("responseCorrection",e);return}let r=this._effectiveAreaEntries,n=this.responseVariable?.baseType,i=this.correctResponse;for(let s of this.responsePoints){let a=r.some(l=>Y.isPointInArea(`${s.x} ${s.y}`,`${l.shape},${l.coords}`,n));!r.length&&i&&(a=(Array.isArray(i)?i:[i]).some(c=>{let[d,h]=c.split(" ").map(Number);return Number.isFinite(d)&&Number.isFinite(h)&&Math.hypot(s.x-d,s.y-h)<=10})),this.#e.push(a)}this.requestUpdate("responseCorrection",e)}toggleInternalCorrectResponse(t){if(super.toggleInternalCorrectResponse(t),!t){let n=this.#t;this.#t=[],this.requestUpdate("correctAreas",n);return}let e=this._effectiveAreaEntries;if(!e.length){let n=this.correctResponse,i=n?Array.isArray(n)?n:[n]:[];if(i.some(s=>s.split(" ").length<2)){console.error("No valid correct responses found.");return}e=i.map(s=>({shape:"circle",coords:`${s.split(" ").join(",")},10`,defaultValue:1,mappedValue:1}))}let r=this.#t;this.#t=e.map(n=>({shape:n.shape,coords:n.coords})),this.requestUpdate("correctAreas",r)}pointPart(t,e){let r=this.#e[e];return r===void 0?"point":`point ${r?"correct":"incorrect"}`}renderSupplementalLayer(){return W(this.#t,t=>`${t.shape}:${t.coords}`,(t,e)=>b`<div
9828
- style=${ms({position:"absolute",pointerEvents:"none",backgroundColor:"var(--qti-correct)",opacity:"0.5"})}
9835
+ `]}toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=this.#e;if(this.#e=[],!t){this.requestUpdate("responseCorrection",e);return}let i=this._effectiveAreaEntries,n=this.responseVariable?.baseType,r=this.correctResponse;for(let s of this.responsePoints){let a=i.some(l=>Y.isPointInArea(`${s.x} ${s.y}`,`${l.shape},${l.coords}`,n));!i.length&&r&&(a=(Array.isArray(r)?r:[r]).some(c=>{let[d,h]=c.split(" ").map(Number);return Number.isFinite(d)&&Number.isFinite(h)&&Math.hypot(s.x-d,s.y-h)<=10})),this.#e.push(a)}this.requestUpdate("responseCorrection",e)}toggleInternalCorrectResponse(t){if(super.toggleInternalCorrectResponse(t),!t){let n=this.#t;this.#t=[],this.requestUpdate("correctAreas",n);return}let e=this._effectiveAreaEntries;if(!e.length){let n=this.correctResponse,r=n?Array.isArray(n)?n:[n]:[];if(r.some(s=>s.split(" ").length<2)){console.error("No valid correct responses found.");return}e=r.map(s=>({shape:"circle",coords:`${s.split(" ").join(",")},10`,defaultValue:1,mappedValue:1}))}let i=this.#t;this.#t=e.map(n=>({shape:n.shape,coords:n.coords})),this.requestUpdate("correctAreas",i)}pointPart(t,e){let i=this.#e[e];return i===void 0?"point":`point ${i?"correct":"incorrect"}`}renderSupplementalLayer(){return W(this.#t,t=>`${t.shape}:${t.coords}`,(t,e)=>b`<div
9836
+ style=${ws({position:"absolute",pointerEvents:"none",backgroundColor:"var(--qti-correct)",opacity:"0.5"})}
9829
9837
  data-correction-area
9830
9838
  data-coord=${t.coords}
9831
9839
  data-shape=${t.shape}
9832
9840
  alt=${`correct-response-${e+1}`}
9833
- ></div>`)}updated(t){super.updated(t),t.has("correctAreas")&&this.positionOverlayElements(this.shadowRoot.querySelectorAll("[data-correction-area]"))}};var hc=class extends K(Tt){#t=null;static{this.styles=[Tt.styles,q`
9841
+ ></div>`)}updated(t){super.updated(t),t.has("correctAreas")&&this.positionOverlayElements(this.shadowRoot.querySelectorAll("[data-correction-area]"))}};var bc=class extends K(Tt){#t=null;static{this.styles=[Tt.styles,q`
9834
9842
  [part='knob-correct'] {
9835
9843
  background-color: var(--qti-correct-light);
9836
9844
  border: 2px solid var(--qti-correct);
@@ -9843,9 +9851,9 @@ CES.load();
9843
9851
  border-radius: 9999px;
9844
9852
  left: var(--value-percentage-correct);
9845
9853
  }
9846
- `]}toggleInternalCorrectResponse(t){super.toggleInternalCorrectResponse(t);let e=this.correctResponse,r=Array.isArray(e)?e[0]:e,n=t&&r?parseFloat(r):NaN,i=this.#t;if(this.#t=Number.isFinite(n)?n:null,this.#t!==null){let s=(this.#t-this.min)/(this.max-this.min)*100;this.style.setProperty("--value-percentage-correct",`${s}%`)}else this.style.removeProperty("--value-percentage-correct");this.requestUpdate("correctResponseNumber",i)}renderRailSupplement(){return this.#t===null?O:b`<div id="knob-correct" part="knob-correct">
9854
+ `]}toggleInternalCorrectResponse(t){super.toggleInternalCorrectResponse(t);let e=this.correctResponse,i=Array.isArray(e)?e[0]:e,n=t&&i?parseFloat(i):NaN,r=this.#t;if(this.#t=Number.isFinite(n)?n:null,this.#t!==null){let s=(this.#t-this.min)/(this.max-this.min)*100;this.style.setProperty("--value-percentage-correct",`${s}%`)}else this.style.removeProperty("--value-percentage-correct");this.requestUpdate("correctResponseNumber",r)}renderRailSupplement(){return this.#t===null?O:b`<div id="knob-correct" part="knob-correct">
9847
9855
  <div id="value" part="value">${this.#t}</div>
9848
- </div>`}};var pc=class extends K(pt){static{this.styles=[pt.styles,st,q`
9856
+ </div>`}};var yc=class extends K(pt){static{this.styles=[pt.styles,st,q`
9849
9857
  /*
9850
9858
  * The trailing inset only — size and leading gap come from the shared sheet.
9851
9859
  *
@@ -9874,11 +9882,11 @@ CES.load();
9874
9882
  background-color: var(--qti-bg);
9875
9883
  white-space: nowrap;
9876
9884
  }
9877
- `]}get correctness(){let t=this.responseVariable;if(!t)return super.correctness;if(t.value===null)return tt.Incorrect;if(t.mapping){let e=t.mapping.mapEntries.reduce((r,n)=>Math.max(n.mappedValue,r),0);for(let r of t.mapping.mapEntries){let n=r.mapKey,i=t.value;if(r.caseSensitive||(n=n.toLowerCase(),i=i.toLowerCase()),n===i)return r.mappedValue===e?tt.Correct:r.mappedValue<=(t.mapping.defaultValue||0)?tt.Incorrect:tt.PartiallyCorrect}}return t.correctResponse===t.value?tt.Correct:tt.Incorrect}toggleInternalCorrectResponse(t){this.showFullCorrectResponse||this.toggleFullCorrectResponse(t)}render(){return b`
9885
+ `]}get correctness(){let t=this.responseVariable;if(!t)return super.correctness;if(t.value===null)return tt.Incorrect;if(t.mapping){let e=t.mapping.mapEntries.reduce((i,n)=>Math.max(n.mappedValue,i),0);for(let i of t.mapping.mapEntries){let n=i.mapKey,r=t.value;if(i.caseSensitive||(n=n.toLowerCase(),r=r.toLowerCase()),n===r)return i.mappedValue===e?tt.Correct:i.mappedValue<=(t.mapping.defaultValue||0)?tt.Incorrect:tt.PartiallyCorrect}}return t.correctResponse===t.value?tt.Correct:tt.Incorrect}toggleInternalCorrectResponse(t){this.showFullCorrectResponse||this.toggleFullCorrectResponse(t)}render(){return b`
9878
9886
  ${this.renderAnswer()} ${this.renderInput()}
9879
9887
  <span part=${this.correctionPart} aria-hidden="true"></span>
9880
9888
  ${this.renderValidationMessage()}
9881
- `}};export{K as CandidateCorrectionMixin,Cr as ChoiceCorrectionMixin,Hl as CorrectResponseMixin,tt as Correctness,Ba as CustomStateSetShim,Ua as INITIAL_SESSION_CONTEXT,Ha as INITIAL_TEST_CONTEXT,D as Interaction,Ga as IsNullOrUndefined,$t as ItemContainer,Sn as ItemCorrectResponseMode,tn as ItemPrintVariables,Ue as ItemShowCandidateCorrection,He as ItemShowCorrectResponse,Zd as ItemViewMixin,od as PUBLIC_ITEM_EVENTS,yo as QTI_TEST_STATE_VERSION,ws as QtiAnd,ti as QtiAnyN,ft as QtiAssessmentItem,Op as QtiAssessmentItemCorrection,kt as QtiAssessmentItemRef,Et as QtiAssessmentSection,Jn as QtiAssessmentStimulus,Vr as QtiAssessmentStimulusRef,cl as QtiAssessmentStimulusRefConnectedEvent,Ze as QtiAssessmentTest,Hr as QtiAssociableHotspot,yr as QtiAssociateInteraction,Jl as QtiAssociateInteractionCorrection,hn as QtiBaseValue,vr as QtiChoiceInteraction,Zl as QtiChoiceInteractionCorrection,io as QtiCompanionMaterialsInfo,Xt as QtiConditionExpression,xs as QtiContainerSize,qs as QtiContains,Li as QtiContentBody,zr as QtiContextDeclaration,Cs as QtiCorrect,ue as QtiCustomInteraction,Vi as QtiCustomOperator,xr as QtiDefault,Ss as QtiDelete,ks as QtiDivide,Es as QtiDurationGte,As as QtiDurationLt,je as QtiEndAttemptInteraction,ei as QtiEqual,pn as QtiEqualRounded,Is as QtiExitResponse,Tr as QtiExitResponseSignal,_s as QtiExitTest,Rr as QtiExitTestSignal,E as QtiExpression,Q as QtiExtendedTextInteraction,ga as QtiExtendedTextInteractionCorrection,mt as QtiFeedback,no as QtiFeedbackBlock,oo as QtiFeedbackInline,Ts as QtiFieldValue,pr as QtiGap,en as QtiGapImg,Xr as QtiGapMatchInteraction,tc as QtiGapMatchInteractionCorrection,Me as QtiGapText,Wl as QtiGapTextCorrection,Rs as QtiGcd,Bt as QtiGraphicAssociateInteraction,ec as QtiGraphicAssociateInteractionCorrection,Yr as QtiGraphicGapMatchInteraction,rc as QtiGraphicGapMatchInteractionCorrection,Fe as QtiGraphicOrderInteraction,ic as QtiGraphicOrderInteractionCorrection,Ps as QtiGt,Os as QtiGte,mr as QtiHotspotChoice,fa as QtiHotspotChoiceCorrection,Kr as QtiHotspotInteraction,nc as QtiHotspotInteractionCorrection,fr as QtiHottext,Ql as QtiHottextCorrection,Jr as QtiHottextInteraction,oc as QtiHottextInteractionCorrection,un as QtiIndex,rn as QtiInlineChoice,nt as QtiInlineChoiceInteraction,sc as QtiInlineChoiceInteractionCorrection,ri as QtiInside,Ms as QtiIntegerDivide,Ds as QtiIntegerModulus,Ns as QtiIntegerToFloat,$s as QtiIsNull,he as QtiItem,so as QtiItemBody,Mp as QtiItemCorrection,Mt as QtiItemSessionControl,Ls as QtiLcm,ii as QtiLookupOutcomeValue,Vs as QtiLt,zs as QtiLte,fn as QtiMapResponse,mn as QtiMapResponsePoint,js as QtiMatch,fe as QtiMatchInteraction,ac as QtiMatchInteractionCorrection,gn as QtiMathConstant,bn as QtiMathOperator,Fs as QtiMax,ss as QtiMediaInteraction,Bs as QtiMember,Us as QtiMin,jr as QtiModalFeedback,Hs as QtiMultiple,Ws as QtiNot,Qs as QtiNull,Yn as QtiNumberSelected,Gs as QtiOr,Be as QtiOrderInteraction,lc as QtiOrderInteractionCorrection,Xs as QtiOrdered,Ks as QtiOutcomeCondition,le as QtiOutcomeDeclaration,Zs as QtiOutcomeElse,Js as QtiOutcomeElseIf,ai as QtiOutcomeIf,Kn as QtiOutcomeProcessing,nl as QtiOutcomeProcessingProcessor,yn as QtiPatternMatch,G as QtiPortableCustomInteraction,cc as QtiPortableCustomInteractionCorrection,hs as QtiPositionObjectInteraction,ps as QtiPositionObjectStage,ta as QtiPower,vt as QtiPrintedVariable,ea as QtiProduct,Oo as QtiPrompt,ra as QtiRandom,qr as QtiRandomInteger,wn as QtiRepeat,ia as QtiResponseCondition,Se as QtiResponseDeclaration,oa as QtiResponseElse,na as QtiResponseElseIf,li as QtiResponseIf,lo as QtiResponseProcessing,sa as QtiResponseProcessingFragment,aa as QtiRound,ci as QtiRoundTo,ce as QtiRubricBlock,rd as QtiRuleElement,yt as QtiSelectPointInteraction,dc as QtiSelectPointInteractionCorrection,la as QtiSetCorrectResponse,jl as QtiSetCorrectResponseRule,ca as QtiSetOutcomeValue,Fl as QtiSetOutcomeValueRule,da as QtiSetTemplateValue,Bl as QtiSetTemplateValueRule,Lt as QtiSimpleAssociableChoice,Gl as QtiSimpleAssociableChoiceCorrection,Vt as QtiSimpleChoice,Xl as QtiSimpleChoiceCorrection,Tt as QtiSliderInteraction,hc as QtiSliderInteractionCorrection,xn as QtiStatsOperator,qn as QtiStringMatch,po as QtiStylesheet,Cn as QtiSubstring,ha as QtiSubtract,pa as QtiSum,Ul as QtiSumExpression,uo as QtiTemplateConstraint,de as QtiTemplateDeclaration,mo as QtiTemplateProcessing,_e as QtiTest,Np as QtiTestCorrection,fo as QtiTestFeedback,Ie as QtiTestPart,Ui as QtiTestVariables,hl as QtiTestVariablesExpression,pt as QtiTextEntryInteraction,pc as QtiTextEntryInteractionCorrection,ua as QtiTruncate,ys as QtiUploadInteraction,ma as QtiVariable,_r as QtiVariableDeclaration,Y as ScoringHelper,ir as TestCheckItem,$p as TestCheckItemCorrection,At as TestContainer,nr as TestEndAttempt,Hi as TestItemLink,Pe as TestItemToSpeech,gt as TestNavigation,Dp as TestNavigationCorrection,ar as TestNext,Qi as TestPagingButtonsStamp,lr as TestPrev,Gi as TestPrintContext,Xi as TestPrintVariables,cr as TestScoringButtons,Ur as TestScoringFeedback,Yi as TestSectionButtonsStamp,Ki as TestSectionLink,We as TestShowCorrectResponse,dr as TestStamp,To as TestTtsNext,Eo as TestTtsPause,Ro as TestTtsPick,Wi as TestTtsPlay,_o as TestTtsPrev,Ao as TestTtsResume,Io as TestTtsStop,Jt as TestView,Zi as TestViewToggle,Xb as asSeed,P as boxSizing,qu as classifyCustomStateSupport,j as computedContext,xe as computedItemContext,qt as configContext,Ot as convertNumberToUniversalFormat,st as correctionPart,Sy as decimalSeparator,Za as dispatchDeclared,Pr as dispatchPublic,Gt as dropRegion,id as getCustomOperator,U$ as getItemByUri,B$ as getManifestInfo,Zc as installCustomStateSetFallback,Ar as interactionContext,Su as isSeed,F as itemContext,td as itemContextVariables,Oy as iterResponseValues,tl as listenDeclared,sd as listenPublic,My as parsePair,Ny as parsePoint,Xa as parseResponseAttribute,Ym as qtiAndMixin,Ct as qtiContext,Cp as qtiInteractionElements,mf as qtiSubtractMixin,Kt as qtiTransformItem,xd as qtiTransformManifest,Lr as qtiTransformTest,jy as registerCustomOperator,Qn as removeDoubleSlashes,Yt as responseAttributeConverter,Dy as serializePair,$y as serializePoint,Ya as serializeResponseAttribute,Qt as sessionContext,at as testContext,Yd as ttsContext,Fy as unregisterCustomOperator,H as validationMessage};
9889
+ `}};export{K as CandidateCorrectionMixin,ki as ChoiceCorrectionMixin,Kl as CorrectResponseMixin,tt as Correctness,Ga as CustomStateSetShim,Ya as INITIAL_SESSION_CONTEXT,Ka as INITIAL_TEST_CONTEXT,D as Interaction,tl as IsNullOrUndefined,Lt as ItemContainer,In as ItemCorrectResponseMode,nn as ItemPrintVariables,We as ItemShowCandidateCorrection,Qe as ItemShowCorrectResponse,ch as ItemViewMixin,pd as PUBLIC_ITEM_EVENTS,So as QTI_TEST_STATE_VERSION,Es as QtiAnd,ir as QtiAnyN,ft as QtiAssessmentItem,Bp as QtiAssessmentItemCorrection,kt as QtiAssessmentItemRef,Et as QtiAssessmentSection,ro as QtiAssessmentStimulus,ji as QtiAssessmentStimulusRef,fl as QtiAssessmentStimulusRefConnectedEvent,ei as QtiAssessmentTest,Qi as QtiAssociableHotspot,wi as QtiAssociateInteraction,nc as QtiAssociateInteractionCorrection,mn as QtiBaseValue,ce as QtiBranchRule,xi as QtiChoiceInteraction,oc as QtiChoiceInteractionCorrection,lo as QtiCompanionMaterialsInfo,Yt as QtiConditionExpression,Is as QtiContainerSize,As as QtiContains,zr as QtiContentBody,Fi as QtiContextDeclaration,_s as QtiCorrect,fe as QtiCustomInteraction,jr as QtiCustomOperator,Ci as QtiDefault,Ts as QtiDelete,Rs as QtiDivide,Ps as QtiDurationGte,Os as QtiDurationLt,Be as QtiEndAttemptInteraction,rr as QtiEqual,fn as QtiEqualRounded,Ms as QtiExitResponse,Pi as QtiExitResponseSignal,Ds as QtiExitTest,Oi as QtiExitTestSignal,E as QtiExpression,Q as QtiExtendedTextInteraction,qa as QtiExtendedTextInteractionCorrection,mt as QtiFeedback,co as QtiFeedbackBlock,ho as QtiFeedbackInline,Ns as QtiFieldValue,mi as QtiGap,on as QtiGapImg,Ki as QtiGapMatchInteraction,sc as QtiGapMatchInteractionCorrection,Ne as QtiGapText,Jl as QtiGapTextCorrection,$s as QtiGcd,Ut as QtiGraphicAssociateInteraction,ac as QtiGraphicAssociateInteractionCorrection,Ji as QtiGraphicGapMatchInteraction,lc as QtiGraphicGapMatchInteractionCorrection,Ue as QtiGraphicOrderInteraction,cc as QtiGraphicOrderInteractionCorrection,Ls as QtiGt,Vs as QtiGte,gi as QtiHotspotChoice,xa as QtiHotspotChoiceCorrection,Zi as QtiHotspotInteraction,dc as QtiHotspotInteractionCorrection,bi as QtiHottext,Zl as QtiHottextCorrection,tr as QtiHottextInteraction,hc as QtiHottextInteractionCorrection,gn as QtiIndex,sn as QtiInlineChoice,nt as QtiInlineChoiceInteraction,pc as QtiInlineChoiceInteractionCorrection,nr as QtiInside,zs as QtiIntegerDivide,js as QtiIntegerModulus,Fs as QtiIntegerToFloat,Bs as QtiIsNull,ue as QtiItem,po as QtiItemBody,Up as QtiItemCorrection,Mt as QtiItemSessionControl,Us as QtiLcm,or as QtiLookupOutcomeValue,Hs as QtiLt,Ws as QtiLte,yn as QtiMapResponse,bn as QtiMapResponsePoint,Qs as QtiMatch,be as QtiMatchInteraction,uc as QtiMatchInteractionCorrection,vn as QtiMathConstant,wn as QtiMathOperator,Xs as QtiMax,ps as QtiMediaInteraction,Gs as QtiMember,Ys as QtiMin,Bi as QtiModalFeedback,Ks as QtiMultiple,Js as QtiNot,Zs as QtiNull,to as QtiNumberSelected,ta as QtiOr,He as QtiOrderInteraction,mc as QtiOrderInteractionCorrection,ea as QtiOrdered,ra as QtiOutcomeCondition,de as QtiOutcomeDeclaration,oa as QtiOutcomeElse,na as QtiOutcomeElseIf,cr as QtiOutcomeIf,io as QtiOutcomeProcessing,dl as QtiOutcomeProcessingProcessor,xn as QtiPatternMatch,X as QtiPortableCustomInteraction,fc as QtiPortableCustomInteractionCorrection,bs as QtiPositionObjectInteraction,ys as QtiPositionObjectStage,sa as QtiPower,eo as QtiPreCondition,vt as QtiPrintedVariable,aa as QtiProduct,Vo as QtiPrompt,la as QtiRandom,Si as QtiRandomInteger,Cn as QtiRepeat,ca as QtiResponseCondition,Ee as QtiResponseDeclaration,ha as QtiResponseElse,da as QtiResponseElseIf,dr as QtiResponseIf,mo as QtiResponseProcessing,pa as QtiResponseProcessingFragment,ua as QtiRound,hr as QtiRoundTo,he as QtiRubricBlock,ld as QtiRuleElement,yt as QtiSelectPointInteraction,gc as QtiSelectPointInteractionCorrection,ma as QtiSetCorrectResponse,Ql as QtiSetCorrectResponseRule,fa as QtiSetOutcomeValue,Xl as QtiSetOutcomeValueRule,ga as QtiSetTemplateValue,Gl as QtiSetTemplateValueRule,Vt as QtiSimpleAssociableChoice,tc as QtiSimpleAssociableChoiceCorrection,zt as QtiSimpleChoice,ec as QtiSimpleChoiceCorrection,Tt as QtiSliderInteraction,bc as QtiSliderInteractionCorrection,Sn as QtiStatsOperator,kn as QtiStringMatch,bo as QtiStylesheet,En as QtiSubstring,ba as QtiSubtract,ya as QtiSum,Yl as QtiSumExpression,yo as QtiTemplateConstraint,pe as QtiTemplateDeclaration,vo as QtiTemplateProcessing,Re as QtiTest,Wp as QtiTestCorrection,wo as QtiTestFeedback,Te as QtiTestPart,Wr as QtiTestVariables,bl as QtiTestVariablesExpression,pt as QtiTextEntryInteraction,yc as QtiTextEntryInteractionCorrection,va as QtiTruncate,Ss as QtiUploadInteraction,wa as QtiVariable,Ri as QtiVariableDeclaration,Y as ScoringHelper,oi as TestCheckItem,Qp as TestCheckItemCorrection,It as TestContainer,si as TestEndAttempt,Xr as TestItemLink,Me as TestItemToSpeech,gt as TestNavigation,Hp as TestNavigationCorrection,ci as TestNext,Yr as TestPagingButtonsStamp,di as TestPrev,Kr as TestPrintContext,Jr as TestPrintVariables,hi as TestScoringButtons,Wi as TestScoringFeedback,Zr as TestSectionButtonsStamp,tn as TestSectionLink,Xe as TestShowCorrectResponse,pi as TestStamp,No as TestTtsNext,Po as TestTtsPause,$o as TestTtsPick,Gr as TestTtsPlay,Do as TestTtsPrev,Oo as TestTtsResume,Mo as TestTtsStop,Zt as TestView,rn as TestViewToggle,ly as asSeed,P as boxSizing,Pu as classifyCustomStateSupport,j as computedContext,Ce as computedItemContext,qt as configContext,Ot as convertNumberToUniversalFormat,st as correctionPart,$y as decimalSeparator,ol as dispatchDeclared,Mi as dispatchPublic,Gt as dropRegion,cd as getCustomOperator,y3 as getItemByUri,b3 as getManifestInfo,od as installCustomStateSetFallback,_i as interactionContext,Mu as isSeed,F as itemContext,sd as itemContextVariables,Wy as iterResponseValues,sl as listenDeclared,ud as listenPublic,Qy as parsePair,Gy as parsePoint,el as parseResponseAttribute,df as qtiAndMixin,Ct as qtiContext,Op as qtiInteractionElements,If as qtiSubtractMixin,Jt as qtiTransformItem,Ad as qtiTransformManifest,zi as qtiTransformTest,tv as registerCustomOperator,Yn as removeDoubleSlashes,Kt as responseAttributeConverter,Xy as serializePair,Yy as serializePoint,il as serializeResponseAttribute,Xt as sessionContext,at as testContext,sh as ttsContext,ev as unregisterCustomOperator,H as validationMessage};
9882
9890
  /*! Bundled license information:
9883
9891
 
9884
9892
  @lit-labs/ssr-dom-shim/lib/element-internals.js: